aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/media/v4l/pixfmt-nv12m.xml2
-rw-r--r--Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml2
-rw-r--r--Documentation/arm/SPEAr/overview.txt13
-rw-r--r--Documentation/devicetree/bindings/arm/lpc32xx-mic.txt38
-rw-r--r--Documentation/devicetree/bindings/arm/lpc32xx.txt8
-rw-r--r--Documentation/devicetree/bindings/arm/spear.txt18
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio-nmk.txt31
-rw-r--r--Documentation/devicetree/bindings/i2c/pnx.txt36
-rw-r--r--Documentation/devicetree/bindings/net/lpc-eth.txt24
-rw-r--r--MAINTAINERS4
-rw-r--r--Makefile2
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/boot/dts/db8500.dtsi63
-rw-r--r--arch/arm/boot/dts/lpc32xx.dtsi292
-rw-r--r--arch/arm/boot/dts/omap3-beagle.dts49
-rw-r--r--arch/arm/boot/dts/omap3.dtsi102
-rw-r--r--arch/arm/boot/dts/omap4-panda.dts56
-rw-r--r--arch/arm/boot/dts/omap4-sdp.dts97
-rw-r--r--arch/arm/boot/dts/omap4.dtsi117
-rw-r--r--arch/arm/boot/dts/phy3250.dts145
-rw-r--r--arch/arm/boot/dts/sh7372.dtsi21
-rw-r--r--arch/arm/boot/dts/snowball.dts40
-rw-r--r--arch/arm/boot/dts/spear300-evb.dts183
-rw-r--r--arch/arm/boot/dts/spear300.dtsi72
-rw-r--r--arch/arm/boot/dts/spear310-evb.dts111
-rw-r--r--arch/arm/boot/dts/spear310.dtsi75
-rw-r--r--arch/arm/boot/dts/spear320-evb.dts112
-rw-r--r--arch/arm/boot/dts/spear320.dtsi90
-rw-r--r--arch/arm/boot/dts/spear3xx.dtsi144
-rw-r--r--arch/arm/boot/dts/spear600-evb.dts4
-rw-r--r--arch/arm/boot/dts/spear600.dtsi8
-rw-r--r--arch/arm/boot/dts/twl4030.dtsi39
-rw-r--r--arch/arm/boot/dts/twl6030.dtsi86
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig1
-rw-r--r--arch/arm/configs/lpc32xx_defconfig44
-rw-r--r--arch/arm/configs/spear3xx_defconfig52
-rw-r--r--arch/arm/configs/spear6xx_defconfig41
-rw-r--r--arch/arm/configs/u8500_defconfig9
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c1
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c2
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c5
-rw-r--r--arch/arm/mach-at91/clock.c1
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc.h2
-rw-r--r--arch/arm/mach-at91/setup.c2
-rw-r--r--arch/arm/mach-bcmring/core.c4
-rw-r--r--arch/arm/mach-imx/imx27-dt.c6
-rw-r--r--arch/arm/mach-imx/mm-imx5.c2
-rw-r--r--arch/arm/mach-lpc32xx/Kconfig26
-rw-r--r--arch/arm/mach-lpc32xx/clock.c77
-rw-r--r--arch/arm/mach-lpc32xx/common.c188
-rw-r--r--arch/arm/mach-lpc32xx/common.h14
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/i2c.h63
-rw-r--r--arch/arm/mach-lpc32xx/irq.c78
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c149
-rw-r--r--arch/arm/mach-omap1/mux.c1
-rw-r--r--arch/arm/mach-omap1/timer.c4
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c12
-rw-r--r--arch/arm/mach-omap2/board-generic.c37
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c13
-rw-r--r--arch/arm/mach-omap2/devices.c4
-rw-r--r--arch/arm/mach-omap2/gpio.c8
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c17
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c9
-rw-r--r--arch/arm/mach-omap2/serial.c124
-rw-r--r--arch/arm/mach-omap2/twl-common.c37
-rw-r--r--arch/arm/mach-omap2/twl-common.h10
-rw-r--r--arch/arm/mach-pnx4008/i2c.c64
-rw-r--r--arch/arm/mach-pnx4008/include/mach/i2c.h64
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h2
-rw-r--r--arch/arm/mach-shmobile/include/mach/intc.h44
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c34
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c48
-rw-r--r--arch/arm/mach-shmobile/timer.c17
-rw-r--r--arch/arm/mach-spear3xx/Kconfig34
-rw-r--r--arch/arm/mach-spear3xx/Makefile13
-rw-r--r--arch/arm/mach-spear3xx/Makefile.boot4
-rw-r--r--arch/arm/mach-spear3xx/clock.c280
-rw-r--r--arch/arm/mach-spear3xx/include/mach/generic.h42
-rw-r--r--arch/arm/mach-spear3xx/include/mach/hardware.h24
-rw-r--r--arch/arm/mach-spear3xx/include/mach/irqs.h130
-rw-r--r--arch/arm/mach-spear3xx/include/mach/misc_regs.h144
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear.h47
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear300.h54
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear310.h58
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear320.h67
-rw-r--r--arch/arm/mach-spear3xx/spear300.c335
-rw-r--r--arch/arm/mach-spear3xx/spear300_evb.c75
-rw-r--r--arch/arm/mach-spear3xx/spear310.c391
-rw-r--r--arch/arm/mach-spear3xx/spear310_evb.c81
-rw-r--r--arch/arm/mach-spear3xx/spear320.c390
-rw-r--r--arch/arm/mach-spear3xx/spear320_evb.c79
-rw-r--r--arch/arm/mach-spear3xx/spear3xx.c152
-rw-r--r--arch/arm/mach-spear6xx/Makefile.boot2
-rw-r--r--arch/arm/mach-spear6xx/clock.c186
-rw-r--r--arch/arm/mach-spear6xx/include/mach/generic.h29
-rw-r--r--arch/arm/mach-spear6xx/include/mach/hardware.h24
-rw-r--r--arch/arm/mach-spear6xx/include/mach/irqs.h75
-rw-r--r--arch/arm/mach-spear6xx/include/mach/misc_regs.h154
-rw-r--r--arch/arm/mach-spear6xx/include/mach/spear.h55
-rw-r--r--arch/arm/mach-spear6xx/include/mach/spear600.h21
-rw-r--r--arch/arm/mach-spear6xx/spear6xx.c417
-rw-r--r--arch/arm/mach-ux500/Kconfig1
-rw-r--r--arch/arm/mach-ux500/board-mop500.c5
-rw-r--r--arch/arm/mach-ux500/platsmp.c2
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h4
-rw-r--r--arch/arm/plat-omap/sram.c12
-rw-r--r--arch/arm/plat-spear/Kconfig3
-rw-r--r--arch/arm/plat-spear/Makefile2
-rw-r--r--arch/arm/plat-spear/include/plat/debug-macro.S2
-rw-r--r--arch/arm/plat-spear/include/plat/hardware.h17
-rw-r--r--arch/arm/plat-spear/include/plat/pl080.h21
-rw-r--r--arch/arm/plat-spear/include/plat/uncompress.h2
-rw-r--r--arch/arm/plat-spear/pl080.c80
-rw-r--r--arch/arm/plat-spear/restart.c2
-rw-r--r--arch/arm/plat-spear/time.c17
-rw-r--r--arch/ia64/include/asm/futex.h9
-rw-r--r--arch/ia64/kernel/perfmon.c18
-rw-r--r--arch/m68k/configs/m5275evb_defconfig1
-rw-r--r--arch/m68k/platform/527x/config.c2
-rw-r--r--arch/m68k/platform/68EZ328/Makefile6
-rw-r--r--arch/m68k/platform/68VZ328/Makefile9
-rw-r--r--arch/m68k/platform/68VZ328/bootlogo.h (renamed from arch/m68k/platform/68EZ328/bootlogo.h)2
-rw-r--r--arch/m68k/platform/coldfire/device.c2
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/defconfig37
-rw-r--r--arch/s390/include/asm/facility.h3
-rw-r--r--arch/s390/include/asm/pgalloc.h3
-rw-r--r--arch/s390/include/asm/swab.h2
-rw-r--r--arch/s390/include/asm/tlb.h22
-rw-r--r--arch/s390/kernel/head.S2
-rw-r--r--arch/s390/kernel/irq.c9
-rw-r--r--arch/s390/kernel/perf_cpum_cf.c4
-rw-r--r--arch/s390/mm/maccess.c27
-rw-r--r--arch/s390/mm/pgtable.c63
-rw-r--r--arch/sparc/kernel/leon_smp.c3
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c7
-rw-r--r--arch/tile/kernel/single_step.c4
-rw-r--r--arch/x86/ia32/ia32_aout.c32
-rw-r--r--arch/x86/kvm/pmu.c18
-rw-r--r--arch/x86/kvm/vmx.c5
-rw-r--r--arch/x86/kvm/x86.c8
-rw-r--r--arch/x86/lib/insn.c53
-rw-r--r--crypto/sha512_generic.c2
-rw-r--r--drivers/acpi/acpica/hwxface.c3
-rw-r--r--drivers/acpi/osl.c3
-rw-r--r--drivers/acpi/reboot.c3
-rw-r--r--drivers/ata/ata_piix.c2
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/ata/libata-scsi.c4
-rw-r--r--drivers/ata/libata-transport.c1
-rw-r--r--drivers/ata/libata.h2
-rw-r--r--drivers/ata/sata_mv.c3
-rw-r--r--drivers/block/virtio_blk.c41
-rw-r--r--drivers/block/xen-blkback/xenbus.c2
-rw-r--r--drivers/crypto/ixp4xx_crypto.c1
-rw-r--r--drivers/crypto/talitos.c20
-rw-r--r--drivers/dma/Kconfig5
-rw-r--r--drivers/gpu/drm/drm_bufs.c12
-rw-r--r--drivers/gpu/drm/drm_crtc.c10
-rw-r--r--drivers/gpu/drm/drm_fops.c6
-rw-r--r--drivers/gpu/drm/drm_usb.c6
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.c4
-rw-r--r--drivers/gpu/drm/gma500/mdfld_dsi_output.h1
-rw-r--r--drivers/gpu/drm/i810/i810_dma.c6
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c4
-rw-r--r--drivers/gpu/drm/i915/intel_display.c15
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h4
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c4
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c6
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_pm.c1
-rw-r--r--drivers/gpu/drm/nouveau/nv50_sor.c2
-rw-r--r--drivers/gpu/drm/radeon/r600.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq_kms.c6
-rw-r--r--drivers/gpu/drm/radeon/rv770.c4
-rw-r--r--drivers/gpu/drm/radeon/si.c5
-rw-r--r--drivers/hid/Kconfig2
-rw-r--r--drivers/hid/hid-tivo.c2
-rw-r--r--drivers/hwmon/ads1015.c33
-rw-r--r--drivers/hwmon/fam15h_power.c39
-rw-r--r--drivers/i2c/busses/i2c-pnx.c160
-rw-r--r--drivers/input/misc/Kconfig3
-rw-r--r--drivers/input/misc/twl6040-vibra.c4
-rw-r--r--drivers/leds/leds-atmel-pwm.c2
-rw-r--r--drivers/media/common/tuners/xc5000.c39
-rw-r--r--drivers/media/common/tuners/xc5000.h1
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c25
-rw-r--r--drivers/media/dvb/frontends/drxk_hard.c6
-rw-r--r--drivers/media/rc/winbond-cir.c1
-rw-r--r--drivers/media/video/Kconfig2
-rw-r--r--drivers/media/video/mt9m032.c5
-rw-r--r--drivers/mfd/Kconfig11
-rw-r--r--drivers/mfd/asic3.c4
-rw-r--r--drivers/mfd/omap-usb-host.c44
-rw-r--r--drivers/mfd/rc5t583.c39
-rw-r--r--drivers/mfd/twl6040-core.c114
-rw-r--r--drivers/mmc/card/block.c56
-rw-r--r--drivers/mmc/card/queue.c2
-rw-r--r--drivers/mmc/core/bus.c24
-rw-r--r--drivers/mmc/core/cd-gpio.c1
-rw-r--r--drivers/mmc/core/core.c64
-rw-r--r--drivers/mmc/host/dw_mmc.c7
-rw-r--r--drivers/mmc/host/omap_hsmmc.c6
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c3
-rw-r--r--drivers/mmc/host/sdhci.c2
-rw-r--r--drivers/net/ethernet/nxp/lpc_eth.c71
-rw-r--r--drivers/of/address.c1
-rw-r--r--drivers/pci/pci.c24
-rw-r--r--drivers/pinctrl/core.c25
-rw-r--r--drivers/s390/block/dasd_eckd.c24
-rw-r--r--drivers/s390/char/vmur.c2
-rw-r--r--drivers/tty/amiserial.c4
-rw-r--r--drivers/tty/serial/clps711x.c14
-rw-r--r--drivers/tty/serial/pch_uart.c4
-rw-r--r--drivers/usb/core/hub.c3
-rw-r--r--drivers/usb/core/message.c6
-rw-r--r--drivers/usb/dwc3/core.c6
-rw-r--r--drivers/usb/dwc3/ep0.c12
-rw-r--r--drivers/usb/gadget/at91_udc.c8
-rw-r--r--drivers/usb/gadget/f_fs.c3
-rw-r--r--drivers/usb/gadget/f_rndis.c1
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c25
-rw-r--r--drivers/usb/gadget/g_ffs.c4
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c17
-rw-r--r--drivers/usb/gadget/udc-core.c6
-rw-r--r--drivers/usb/gadget/uvc_queue.c4
-rw-r--r--drivers/usb/host/ehci-fsl.c7
-rw-r--r--drivers/usb/host/ehci-hcd.c9
-rw-r--r--drivers/usb/host/ehci-omap.c39
-rw-r--r--drivers/usb/host/ehci-tegra.c1
-rw-r--r--drivers/usb/host/ohci-at91.c12
-rw-r--r--drivers/usb/misc/usbtest.c9
-rw-r--r--drivers/usb/misc/yurex.c10
-rw-r--r--drivers/usb/musb/musb_core.c40
-rw-r--r--drivers/usb/musb/musb_host.c2
-rw-r--r--drivers/usb/musb/omap2430.c31
-rw-r--r--drivers/usb/serial/cp210x.c9
-rw-r--r--drivers/usb/serial/sierra.c6
-rw-r--r--drivers/uwb/hwa-rc.c3
-rw-r--r--drivers/uwb/neh.c12
-rw-r--r--drivers/vhost/test.c2
-rw-r--r--drivers/virtio/virtio_balloon.c58
-rw-r--r--drivers/xen/gntdev.c2
-rw-r--r--drivers/xen/grant-table.c13
-rw-r--r--drivers/xen/manage.c1
-rw-r--r--drivers/xen/xenbus/xenbus_probe_frontend.c69
-rw-r--r--fs/aio.c16
-rw-r--r--fs/binfmt_aout.c32
-rw-r--r--fs/binfmt_elf.c23
-rw-r--r--fs/binfmt_elf_fdpic.c18
-rw-r--r--fs/binfmt_flat.c12
-rw-r--r--fs/binfmt_som.c12
-rw-r--r--fs/btrfs/ctree.h2
-rw-r--r--fs/cifs/connect.c82
-rw-r--r--fs/ext4/ext4.h3
-rw-r--r--fs/ext4/extents.c6
-rw-r--r--fs/ext4/super.c48
-rw-r--r--fs/fuse/dir.c25
-rw-r--r--fs/fuse/file.c129
-rw-r--r--fs/fuse/inode.c1
-rw-r--r--fs/lockd/clnt4xdr.c2
-rw-r--r--fs/lockd/clntxdr.c2
-rw-r--r--fs/nfsd/nfs3xdr.c22
-rw-r--r--fs/nfsd/nfs4proc.c15
-rw-r--r--fs/nfsd/nfs4state.c23
-rw-r--r--fs/nfsd/nfs4xdr.c4
-rw-r--r--fs/nfsd/vfs.c2
-rw-r--r--fs/ocfs2/alloc.c2
-rw-r--r--fs/ocfs2/refcounttree.c12
-rw-r--r--fs/ocfs2/suballoc.c4
-rw-r--r--include/linux/fuse.h2
-rw-r--r--include/linux/i2c-pnx.h10
-rw-r--r--include/linux/i2c/twl.h12
-rw-r--r--include/linux/kvm_host.h6
-rw-r--r--include/linux/mfd/db5500-prcmu.h88
-rw-r--r--include/linux/mfd/rc5t583.h47
-rw-r--r--include/linux/mfd/twl6040.h27
-rw-r--r--include/linux/mm.h27
-rw-r--r--include/linux/mmc/card.h2
-rw-r--r--include/linux/nfsd/Kbuild1
-rw-r--r--include/linux/pinctrl/machine.h4
-rw-r--r--include/linux/usb/otg.h1
-rw-r--r--lib/mpi/mpi-bit.c5
-rw-r--r--mm/memblock.c7
-rw-r--r--mm/memcontrol.c1
-rw-r--r--mm/mmap.c59
-rw-r--r--mm/nommu.c41
-rwxr-xr-xscripts/checkpatch.pl6
-rw-r--r--scripts/xz_wrap.sh4
-rw-r--r--security/commoncap.c6
-rw-r--r--security/smack/smack_lsm.c44
-rw-r--r--security/smack/smackfs.c14
-rw-r--r--sound/core/vmaster.c1
-rw-r--r--sound/last.c2
-rw-r--r--sound/pci/hda/patch_conexant.c35
-rw-r--r--sound/pci/hda/patch_realtek.c49
-rw-r--r--sound/pci/hda/patch_sigmatel.c5
-rw-r--r--sound/soc/codecs/Kconfig3
-rw-r--r--sound/soc/codecs/twl6040.c3
-rw-r--r--sound/soc/omap/Kconfig2
-rw-r--r--tools/perf/.gitignore2
-rw-r--r--tools/perf/Makefile21
-rw-r--r--tools/perf/perf-archive.sh3
-rw-r--r--tools/perf/util/session.c4
-rw-r--r--virt/kvm/iommu.c30
-rw-r--r--virt/kvm/kvm_main.c5
312 files changed, 6422 insertions, 3449 deletions
diff --git a/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml b/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml
index 3fd3ce5df270..5274c24d11e0 100644
--- a/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml
@@ -1,6 +1,6 @@
1 <refentry id="V4L2-PIX-FMT-NV12M"> 1 <refentry id="V4L2-PIX-FMT-NV12M">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>V4L2_PIX_FMT_NV12M ('NV12M')</refentrytitle> 3 <refentrytitle>V4L2_PIX_FMT_NV12M ('NM12')</refentrytitle>
4 &manvol; 4 &manvol;
5 </refmeta> 5 </refmeta>
6 <refnamediv> 6 <refnamediv>
diff --git a/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml b/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml
index 9957863daf18..60308f1eefdf 100644
--- a/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml
@@ -1,6 +1,6 @@
1 <refentry id="V4L2-PIX-FMT-YUV420M"> 1 <refentry id="V4L2-PIX-FMT-YUV420M">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>V4L2_PIX_FMT_YUV420M ('YU12M')</refentrytitle> 3 <refentrytitle>V4L2_PIX_FMT_YUV420M ('YM12')</refentrytitle>
4 &manvol; 4 &manvol;
5 </refmeta> 5 </refmeta>
6 <refnamediv> 6 <refnamediv>
diff --git a/Documentation/arm/SPEAr/overview.txt b/Documentation/arm/SPEAr/overview.txt
index 253a35c6f782..28a9af953b9d 100644
--- a/Documentation/arm/SPEAr/overview.txt
+++ b/Documentation/arm/SPEAr/overview.txt
@@ -17,14 +17,14 @@ Introduction
17 SPEAr (Platform) 17 SPEAr (Platform)
18 - SPEAr3XX (3XX SOC series, based on ARM9) 18 - SPEAr3XX (3XX SOC series, based on ARM9)
19 - SPEAr300 (SOC) 19 - SPEAr300 (SOC)
20 - SPEAr300_EVB (Evaluation Board) 20 - SPEAr300 Evaluation Board
21 - SPEAr310 (SOC) 21 - SPEAr310 (SOC)
22 - SPEAr310_EVB (Evaluation Board) 22 - SPEAr310 Evaluation Board
23 - SPEAr320 (SOC) 23 - SPEAr320 (SOC)
24 - SPEAr320_EVB (Evaluation Board) 24 - SPEAr320 Evaluation Board
25 - SPEAr6XX (6XX SOC series, based on ARM9) 25 - SPEAr6XX (6XX SOC series, based on ARM9)
26 - SPEAr600 (SOC) 26 - SPEAr600 (SOC)
27 - SPEAr600_EVB (Evaluation Board) 27 - SPEAr600 Evaluation Board
28 - SPEAr13XX (13XX SOC series, based on ARM CORTEXA9) 28 - SPEAr13XX (13XX SOC series, based on ARM CORTEXA9)
29 - SPEAr1300 (SOC) 29 - SPEAr1300 (SOC)
30 30
@@ -51,10 +51,11 @@ Introduction
51 Common file for machines of spear3xx family is mach-spear3xx/spear3xx.c and for 51 Common file for machines of spear3xx family is mach-spear3xx/spear3xx.c and for
52 spear6xx is mach-spear6xx/spear6xx.c. mach-spear* also contain soc/machine 52 spear6xx is mach-spear6xx/spear6xx.c. mach-spear* also contain soc/machine
53 specific files, like spear300.c, spear310.c, spear320.c and spear600.c. 53 specific files, like spear300.c, spear310.c, spear320.c and spear600.c.
54 mach-spear* also contains board specific files for each machine type. 54 mach-spear* doesn't contains board specific files as they fully support
55 Flattened Device Tree.
55 56
56 57
57 Document Author 58 Document Author
58 --------------- 59 ---------------
59 60
60 Viresh Kumar, (c) 2010 ST Microelectronics 61 Viresh Kumar <viresh.kumar@st.com>, (c) 2010-2012 ST Microelectronics
diff --git a/Documentation/devicetree/bindings/arm/lpc32xx-mic.txt b/Documentation/devicetree/bindings/arm/lpc32xx-mic.txt
new file mode 100644
index 000000000000..539adca19e8f
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/lpc32xx-mic.txt
@@ -0,0 +1,38 @@
1* NXP LPC32xx Main Interrupt Controller
2 (MIC, including SIC1 and SIC2 secondary controllers)
3
4Required properties:
5- compatible: Should be "nxp,lpc3220-mic"
6- interrupt-controller: Identifies the node as an interrupt controller.
7- interrupt-parent: Empty for the interrupt controller itself
8- #interrupt-cells: The number of cells to define the interrupts. Should be 2.
9 The first cell is the IRQ number
10 The second cell is used to specify mode:
11 1 = low-to-high edge triggered
12 2 = high-to-low edge triggered
13 4 = active high level-sensitive
14 8 = active low level-sensitive
15 Default for internal sources should be set to 4 (active high).
16- reg: Should contain MIC registers location and length
17
18Examples:
19 /*
20 * MIC
21 */
22 mic: interrupt-controller@40008000 {
23 compatible = "nxp,lpc3220-mic";
24 interrupt-controller;
25 interrupt-parent;
26 #interrupt-cells = <2>;
27 reg = <0x40008000 0xC000>;
28 };
29
30 /*
31 * ADC
32 */
33 adc@40048000 {
34 compatible = "nxp,lpc3220-adc";
35 reg = <0x40048000 0x1000>;
36 interrupt-parent = <&mic>;
37 interrupts = <39 4>;
38 };
diff --git a/Documentation/devicetree/bindings/arm/lpc32xx.txt b/Documentation/devicetree/bindings/arm/lpc32xx.txt
new file mode 100644
index 000000000000..56ec8ddc4a3b
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/lpc32xx.txt
@@ -0,0 +1,8 @@
1NXP LPC32xx Platforms Device Tree Bindings
2------------------------------------------
3
4Boards with the NXP LPC32xx SoC shall have the following properties:
5
6Required root node property:
7
8compatible: must be "nxp,lpc3220", "nxp,lpc3230", "nxp,lpc3240" or "nxp,lpc3250"
diff --git a/Documentation/devicetree/bindings/arm/spear.txt b/Documentation/devicetree/bindings/arm/spear.txt
index f8e54f092328..aa5f355cc947 100644
--- a/Documentation/devicetree/bindings/arm/spear.txt
+++ b/Documentation/devicetree/bindings/arm/spear.txt
@@ -6,3 +6,21 @@ Boards with the ST SPEAr600 SoC shall have the following properties:
6Required root node property: 6Required root node property:
7 7
8compatible = "st,spear600"; 8compatible = "st,spear600";
9
10Boards with the ST SPEAr300 SoC shall have the following properties:
11
12Required root node property:
13
14compatible = "st,spear300";
15
16Boards with the ST SPEAr310 SoC shall have the following properties:
17
18Required root node property:
19
20compatible = "st,spear310";
21
22Boards with the ST SPEAr320 SoC shall have the following properties:
23
24Required root node property:
25
26compatible = "st,spear320";
diff --git a/Documentation/devicetree/bindings/gpio/gpio-nmk.txt b/Documentation/devicetree/bindings/gpio/gpio-nmk.txt
new file mode 100644
index 000000000000..ee87467ad8d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-nmk.txt
@@ -0,0 +1,31 @@
1Nomadik GPIO controller
2
3Required properties:
4- compatible : Should be "st,nomadik-gpio".
5- reg : Physical base address and length of the controller's registers.
6- interrupts : The interrupt outputs from the controller.
7- #gpio-cells : Should be two:
8 The first cell is the pin number.
9 The second cell is used to specify optional parameters:
10 - bits[3:0] trigger type and level flags:
11 1 = low-to-high edge triggered.
12 2 = high-to-low edge triggered.
13 4 = active high level-sensitive.
14 8 = active low level-sensitive.
15- gpio-controller : Marks the device node as a GPIO controller.
16- interrupt-controller : Marks the device node as an interrupt controller.
17- gpio-bank : Specifies which bank a controller owns.
18- st,supports-sleepmode : Specifies whether controller can sleep or not
19
20Example:
21
22 gpio1: gpio@8012e080 {
23 compatible = "st,nomadik-gpio";
24 reg = <0x8012e080 0x80>;
25 interrupts = <0 120 0x4>;
26 #gpio-cells = <2>;
27 gpio-controller;
28 interrupt-controller;
29 supports-sleepmode;
30 gpio-bank = <1>;
31 };
diff --git a/Documentation/devicetree/bindings/i2c/pnx.txt b/Documentation/devicetree/bindings/i2c/pnx.txt
new file mode 100644
index 000000000000..fe98ada33ee4
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/pnx.txt
@@ -0,0 +1,36 @@
1* NXP PNX I2C Controller
2
3Required properties:
4
5 - reg: Offset and length of the register set for the device
6 - compatible: should be "nxp,pnx-i2c"
7 - interrupts: configure one interrupt line
8 - #address-cells: always 1 (for i2c addresses)
9 - #size-cells: always 0
10 - interrupt-parent: the phandle for the interrupt controller that
11 services interrupts for this device.
12
13Optional properties:
14
15 - clock-frequency: desired I2C bus clock frequency in Hz, Default: 100000 Hz
16
17Examples:
18
19 i2c1: i2c@400a0000 {
20 compatible = "nxp,pnx-i2c";
21 reg = <0x400a0000 0x100>;
22 interrupt-parent = <&mic>;
23 interrupts = <51 0>;
24 #address-cells = <1>;
25 #size-cells = <0>;
26 };
27
28 i2c2: i2c@400a8000 {
29 compatible = "nxp,pnx-i2c";
30 reg = <0x400a8000 0x100>;
31 interrupt-parent = <&mic>;
32 interrupts = <50 0>;
33 #address-cells = <1>;
34 #size-cells = <0>;
35 clock-frequency = <100000>;
36 };
diff --git a/Documentation/devicetree/bindings/net/lpc-eth.txt b/Documentation/devicetree/bindings/net/lpc-eth.txt
new file mode 100644
index 000000000000..585021acd178
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/lpc-eth.txt
@@ -0,0 +1,24 @@
1* NXP LPC32xx SoC Ethernet Controller
2
3Required properties:
4- compatible: Should be "nxp,lpc-eth"
5- reg: Address and length of the register set for the device
6- interrupts: Should contain ethernet controller interrupt
7
8Optional properties:
9- phy-mode: String, operation mode of the PHY interface.
10 Supported values are: "mii", "rmii" (default)
11- use-iram: Use LPC32xx internal SRAM (IRAM) for DMA buffering
12- local-mac-address : 6 bytes, mac address
13
14Example:
15
16 mac: ethernet@31060000 {
17 compatible = "nxp,lpc-eth";
18 reg = <0x31060000 0x1000>;
19 interrupt-parent = <&mic>;
20 interrupts = <29 0>;
21
22 phy-mode = "rmii";
23 use-iram;
24 };
diff --git a/MAINTAINERS b/MAINTAINERS
index b0f1073c40b0..1a2f8f5823e0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2321,9 +2321,9 @@ S: Supported
2321F: drivers/acpi/dock.c 2321F: drivers/acpi/dock.c
2322 2322
2323DOCUMENTATION 2323DOCUMENTATION
2324M: Randy Dunlap <rdunlap@xenotime.net> 2324M: Rob Landley <rob@landley.net>
2325L: linux-doc@vger.kernel.org 2325L: linux-doc@vger.kernel.org
2326T: quilt http://xenotime.net/kernel-doc-patches/current/ 2326T: TBD
2327S: Maintained 2327S: Maintained
2328F: Documentation/ 2328F: Documentation/
2329 2329
diff --git a/Makefile b/Makefile
index f6578f47e21e..afc868e6c75d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 4 2PATCHLEVEL = 4
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc3 4EXTRAVERSION = -rc4
5NAME = Saber-toothed Squirrel 5NAME = Saber-toothed Squirrel
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a69a199a5ecb..3707ff06e50c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -597,6 +597,7 @@ config ARCH_LPC32XX
597 select USB_ARCH_HAS_OHCI 597 select USB_ARCH_HAS_OHCI
598 select CLKDEV_LOOKUP 598 select CLKDEV_LOOKUP
599 select GENERIC_CLOCKEVENTS 599 select GENERIC_CLOCKEVENTS
600 select USE_OF
600 help 601 help
601 Support for the NXP LPC32XX family of processors 602 Support for the NXP LPC32XX family of processors
602 603
diff --git a/arch/arm/boot/dts/db8500.dtsi b/arch/arm/boot/dts/db8500.dtsi
index 14bc30705099..881bc3987844 100644
--- a/arch/arm/boot/dts/db8500.dtsi
+++ b/arch/arm/boot/dts/db8500.dtsi
@@ -55,83 +55,101 @@
55 55
56 gpio0: gpio@8012e000 { 56 gpio0: gpio@8012e000 {
57 compatible = "stericsson,db8500-gpio", 57 compatible = "stericsson,db8500-gpio",
58 "stmicroelectronics,nomadik-gpio"; 58 "st,nomadik-gpio";
59 reg = <0x8012e000 0x80>; 59 reg = <0x8012e000 0x80>;
60 interrupts = <0 119 0x4>; 60 interrupts = <0 119 0x4>;
61 supports-sleepmode; 61 supports-sleepmode;
62 gpio-controller; 62 gpio-controller;
63 #gpio-cells = <2>;
64 gpio-bank = <0>;
63 }; 65 };
64 66
65 gpio1: gpio@8012e080 { 67 gpio1: gpio@8012e080 {
66 compatible = "stericsson,db8500-gpio", 68 compatible = "stericsson,db8500-gpio",
67 "stmicroelectronics,nomadik-gpio"; 69 "st,nomadik-gpio";
68 reg = <0x8012e080 0x80>; 70 reg = <0x8012e080 0x80>;
69 interrupts = <0 120 0x4>; 71 interrupts = <0 120 0x4>;
70 supports-sleepmode; 72 supports-sleepmode;
71 gpio-controller; 73 gpio-controller;
74 #gpio-cells = <2>;
75 gpio-bank = <1>;
72 }; 76 };
73 77
74 gpio2: gpio@8000e000 { 78 gpio2: gpio@8000e000 {
75 compatible = "stericsson,db8500-gpio", 79 compatible = "stericsson,db8500-gpio",
76 "stmicroelectronics,nomadik-gpio"; 80 "st,nomadik-gpio";
77 reg = <0x8000e000 0x80>; 81 reg = <0x8000e000 0x80>;
78 interrupts = <0 121 0x4>; 82 interrupts = <0 121 0x4>;
79 supports-sleepmode; 83 supports-sleepmode;
80 gpio-controller; 84 gpio-controller;
85 #gpio-cells = <2>;
86 gpio-bank = <2>;
81 }; 87 };
82 88
83 gpio3: gpio@8000e080 { 89 gpio3: gpio@8000e080 {
84 compatible = "stericsson,db8500-gpio", 90 compatible = "stericsson,db8500-gpio",
85 "stmicroelectronics,nomadik-gpio"; 91 "st,nomadik-gpio";
86 reg = <0x8000e080 0x80>; 92 reg = <0x8000e080 0x80>;
87 interrupts = <0 122 0x4>; 93 interrupts = <0 122 0x4>;
88 supports-sleepmode; 94 supports-sleepmode;
89 gpio-controller; 95 gpio-controller;
96 #gpio-cells = <2>;
97 gpio-bank = <3>;
90 }; 98 };
91 99
92 gpio4: gpio@8000e100 { 100 gpio4: gpio@8000e100 {
93 compatible = "stericsson,db8500-gpio", 101 compatible = "stericsson,db8500-gpio",
94 "stmicroelectronics,nomadik-gpio"; 102 "st,nomadik-gpio";
95 reg = <0x8000e100 0x80>; 103 reg = <0x8000e100 0x80>;
96 interrupts = <0 123 0x4>; 104 interrupts = <0 123 0x4>;
97 supports-sleepmode; 105 supports-sleepmode;
98 gpio-controller; 106 gpio-controller;
107 #gpio-cells = <2>;
108 gpio-bank = <4>;
99 }; 109 };
100 110
101 gpio5: gpio@8000e180 { 111 gpio5: gpio@8000e180 {
102 compatible = "stericsson,db8500-gpio", 112 compatible = "stericsson,db8500-gpio",
103 "stmicroelectronics,nomadik-gpio"; 113 "st,nomadik-gpio";
104 reg = <0x8000e180 0x80>; 114 reg = <0x8000e180 0x80>;
105 interrupts = <0 124 0x4>; 115 interrupts = <0 124 0x4>;
106 supports-sleepmode; 116 supports-sleepmode;
107 gpio-controller; 117 gpio-controller;
118 #gpio-cells = <2>;
119 gpio-bank = <5>;
108 }; 120 };
109 121
110 gpio6: gpio@8011e000 { 122 gpio6: gpio@8011e000 {
111 compatible = "stericsson,db8500-gpio", 123 compatible = "stericsson,db8500-gpio",
112 "stmicroelectronics,nomadik-gpio"; 124 "st,nomadik-gpio";
113 reg = <0x8011e000 0x80>; 125 reg = <0x8011e000 0x80>;
114 interrupts = <0 125 0x4>; 126 interrupts = <0 125 0x4>;
115 supports-sleepmode; 127 supports-sleepmode;
116 gpio-controller; 128 gpio-controller;
129 #gpio-cells = <2>;
130 gpio-bank = <6>;
117 }; 131 };
118 132
119 gpio7: gpio@8011e080 { 133 gpio7: gpio@8011e080 {
120 compatible = "stericsson,db8500-gpio", 134 compatible = "stericsson,db8500-gpio",
121 "stmicroelectronics,nomadik-gpio"; 135 "st,nomadik-gpio";
122 reg = <0x8011e080 0x80>; 136 reg = <0x8011e080 0x80>;
123 interrupts = <0 126 0x4>; 137 interrupts = <0 126 0x4>;
124 supports-sleepmode; 138 supports-sleepmode;
125 gpio-controller; 139 gpio-controller;
140 #gpio-cells = <2>;
141 gpio-bank = <7>;
126 }; 142 };
127 143
128 gpio8: gpio@a03fe000 { 144 gpio8: gpio@a03fe000 {
129 compatible = "stericsson,db8500-gpio", 145 compatible = "stericsson,db8500-gpio",
130 "stmicroelectronics,nomadik-gpio"; 146 "st,nomadik-gpio";
131 reg = <0xa03fe000 0x80>; 147 reg = <0xa03fe000 0x80>;
132 interrupts = <0 127 0x4>; 148 interrupts = <0 127 0x4>;
133 supports-sleepmode; 149 supports-sleepmode;
134 gpio-controller; 150 gpio-controller;
151 #gpio-cells = <2>;
152 gpio-bank = <8>;
135 }; 153 };
136 154
137 usb@a03e0000 { 155 usb@a03e0000 {
@@ -153,7 +171,13 @@
153 reg = <0x80157000 0x1000>; 171 reg = <0x80157000 0x1000>;
154 interrupts = <46 47>; 172 interrupts = <46 47>;
155 #address-cells = <1>; 173 #address-cells = <1>;
156 #size-cells = <0>; 174 #size-cells = <1>;
175 ranges;
176
177 prcmu-timer-4@80157450 {
178 compatible = "stericsson,db8500-prcmu-timer-4";
179 reg = <0x80157450 0xC>;
180 };
157 181
158 ab8500@5 { 182 ab8500@5 {
159 compatible = "stericsson,ab8500"; 183 compatible = "stericsson,ab8500";
@@ -163,7 +187,7 @@
163 }; 187 };
164 188
165 i2c@80004000 { 189 i2c@80004000 {
166 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c"; 190 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
167 reg = <0x80004000 0x1000>; 191 reg = <0x80004000 0x1000>;
168 interrupts = <0 21 0x4>; 192 interrupts = <0 21 0x4>;
169 #address-cells = <1>; 193 #address-cells = <1>;
@@ -171,7 +195,7 @@
171 }; 195 };
172 196
173 i2c@80122000 { 197 i2c@80122000 {
174 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c"; 198 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
175 reg = <0x80122000 0x1000>; 199 reg = <0x80122000 0x1000>;
176 interrupts = <0 22 0x4>; 200 interrupts = <0 22 0x4>;
177 #address-cells = <1>; 201 #address-cells = <1>;
@@ -179,7 +203,7 @@
179 }; 203 };
180 204
181 i2c@80128000 { 205 i2c@80128000 {
182 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c"; 206 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
183 reg = <0x80128000 0x1000>; 207 reg = <0x80128000 0x1000>;
184 interrupts = <0 55 0x4>; 208 interrupts = <0 55 0x4>;
185 #address-cells = <1>; 209 #address-cells = <1>;
@@ -187,7 +211,7 @@
187 }; 211 };
188 212
189 i2c@80110000 { 213 i2c@80110000 {
190 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c"; 214 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
191 reg = <0x80110000 0x1000>; 215 reg = <0x80110000 0x1000>;
192 interrupts = <0 12 0x4>; 216 interrupts = <0 12 0x4>;
193 #address-cells = <1>; 217 #address-cells = <1>;
@@ -195,7 +219,7 @@
195 }; 219 };
196 220
197 i2c@8012a000 { 221 i2c@8012a000 {
198 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c"; 222 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
199 reg = <0x8012a000 0x1000>; 223 reg = <0x8012a000 0x1000>;
200 interrupts = <0 51 0x4>; 224 interrupts = <0 51 0x4>;
201 #address-cells = <1>; 225 #address-cells = <1>;
@@ -270,5 +294,14 @@
270 interrupts = <0 100 0x4>; 294 interrupts = <0 100 0x4>;
271 status = "disabled"; 295 status = "disabled";
272 }; 296 };
297
298 external-bus@50000000 {
299 compatible = "simple-bus";
300 reg = <0x50000000 0x4000000>;
301 #address-cells = <1>;
302 #size-cells = <1>;
303 ranges = <0 0x50000000 0x4000000>;
304 status = "disabled";
305 };
273 }; 306 };
274}; 307};
diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi
new file mode 100644
index 000000000000..2d696866f71c
--- /dev/null
+++ b/arch/arm/boot/dts/lpc32xx.dtsi
@@ -0,0 +1,292 @@
1/*
2 * NXP LPC32xx SoC
3 *
4 * Copyright 2012 Roland Stigge <stigge@antcom.de>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "skeleton.dtsi"
15
16/ {
17 compatible = "nxp,lpc3220";
18 interrupt-parent = <&mic>;
19
20 cpus {
21 cpu@0 {
22 compatible = "arm,arm926ejs";
23 };
24 };
25
26 ahb {
27 #address-cells = <1>;
28 #size-cells = <1>;
29 compatible = "simple-bus";
30 ranges = <0x20000000 0x20000000 0x30000000>;
31
32 /*
33 * Enable either SLC or MLC
34 */
35 slc: flash@20020000 {
36 compatible = "nxp,lpc3220-slc";
37 reg = <0x20020000 0x1000>;
38 status = "disable";
39 };
40
41 mlc: flash@200B0000 {
42 compatible = "nxp,lpc3220-mlc";
43 reg = <0x200B0000 0x1000>;
44 status = "disable";
45 };
46
47 dma@31000000 {
48 compatible = "arm,pl080", "arm,primecell";
49 reg = <0x31000000 0x1000>;
50 interrupts = <0x1c 0>;
51 };
52
53 /*
54 * Enable either ohci or usbd (gadget)!
55 */
56 ohci@31020000 {
57 compatible = "nxp,ohci-nxp", "usb-ohci";
58 reg = <0x31020000 0x300>;
59 interrupts = <0x3b 0>;
60 status = "disable";
61 };
62
63 usbd@31020000 {
64 compatible = "nxp,lpc3220-udc";
65 reg = <0x31020000 0x300>;
66 interrupts = <0x3d 0>, <0x3e 0>, <0x3c 0>, <0x3a 0>;
67 status = "disable";
68 };
69
70 clcd@31040000 {
71 compatible = "arm,pl110", "arm,primecell";
72 reg = <0x31040000 0x1000>;
73 interrupts = <0x0e 0>;
74 status = "disable";
75 };
76
77 mac: ethernet@31060000 {
78 compatible = "nxp,lpc-eth";
79 reg = <0x31060000 0x1000>;
80 interrupts = <0x1d 0>;
81 };
82
83 apb {
84 #address-cells = <1>;
85 #size-cells = <1>;
86 compatible = "simple-bus";
87 ranges = <0x20000000 0x20000000 0x30000000>;
88
89 ssp0: ssp@20084000 {
90 compatible = "arm,pl022", "arm,primecell";
91 reg = <0x20084000 0x1000>;
92 interrupts = <0x14 0>;
93 };
94
95 spi1: spi@20088000 {
96 compatible = "nxp,lpc3220-spi";
97 reg = <0x20088000 0x1000>;
98 };
99
100 ssp1: ssp@2008c000 {
101 compatible = "arm,pl022", "arm,primecell";
102 reg = <0x2008c000 0x1000>;
103 interrupts = <0x15 0>;
104 };
105
106 spi2: spi@20090000 {
107 compatible = "nxp,lpc3220-spi";
108 reg = <0x20090000 0x1000>;
109 };
110
111 i2s0: i2s@20094000 {
112 compatible = "nxp,lpc3220-i2s";
113 reg = <0x20094000 0x1000>;
114 };
115
116 sd@20098000 {
117 compatible = "arm,pl180", "arm,primecell";
118 reg = <0x20098000 0x1000>;
119 interrupts = <0x0f 0>, <0x0d 0>;
120 };
121
122 i2s1: i2s@2009C000 {
123 compatible = "nxp,lpc3220-i2s";
124 reg = <0x2009C000 0x1000>;
125 };
126
127 uart3: serial@40080000 {
128 compatible = "nxp,serial";
129 reg = <0x40080000 0x1000>;
130 };
131
132 uart4: serial@40088000 {
133 compatible = "nxp,serial";
134 reg = <0x40088000 0x1000>;
135 };
136
137 uart5: serial@40090000 {
138 compatible = "nxp,serial";
139 reg = <0x40090000 0x1000>;
140 };
141
142 uart6: serial@40098000 {
143 compatible = "nxp,serial";
144 reg = <0x40098000 0x1000>;
145 };
146
147 i2c1: i2c@400A0000 {
148 compatible = "nxp,pnx-i2c";
149 reg = <0x400A0000 0x100>;
150 interrupts = <0x33 0>;
151 #address-cells = <1>;
152 #size-cells = <0>;
153 pnx,timeout = <0x64>;
154 };
155
156 i2c2: i2c@400A8000 {
157 compatible = "nxp,pnx-i2c";
158 reg = <0x400A8000 0x100>;
159 interrupts = <0x32 0>;
160 #address-cells = <1>;
161 #size-cells = <0>;
162 pnx,timeout = <0x64>;
163 };
164
165 i2cusb: i2c@31020300 {
166 compatible = "nxp,pnx-i2c";
167 reg = <0x31020300 0x100>;
168 interrupts = <0x3f 0>;
169 #address-cells = <1>;
170 #size-cells = <0>;
171 pnx,timeout = <0x64>;
172 };
173 };
174
175 fab {
176 #address-cells = <1>;
177 #size-cells = <1>;
178 compatible = "simple-bus";
179 ranges = <0x20000000 0x20000000 0x30000000>;
180
181 /*
182 * MIC Interrupt controller includes:
183 * MIC @40008000
184 * SIC1 @4000C000
185 * SIC2 @40010000
186 */
187 mic: interrupt-controller@40008000 {
188 compatible = "nxp,lpc3220-mic";
189 interrupt-controller;
190 reg = <0x40008000 0xC000>;
191 #interrupt-cells = <2>;
192 };
193
194 uart1: serial@40014000 {
195 compatible = "nxp,serial";
196 reg = <0x40014000 0x1000>;
197 };
198
199 uart2: serial@40018000 {
200 compatible = "nxp,serial";
201 reg = <0x40018000 0x1000>;
202 };
203
204 uart7: serial@4001C000 {
205 compatible = "nxp,serial";
206 reg = <0x4001C000 0x1000>;
207 };
208
209 rtc@40024000 {
210 compatible = "nxp,lpc3220-rtc";
211 reg = <0x40024000 0x1000>;
212 interrupts = <0x34 0>;
213 };
214
215 gpio: gpio@40028000 {
216 compatible = "nxp,lpc3220-gpio";
217 reg = <0x40028000 0x1000>;
218 /* create a private address space for enumeration */
219 #address-cells = <1>;
220 #size-cells = <0>;
221
222 gpio_p0: gpio-bank@0 {
223 gpio-controller;
224 #gpio-cells = <2>;
225 reg = <0>;
226 };
227
228 gpio_p1: gpio-bank@1 {
229 gpio-controller;
230 #gpio-cells = <2>;
231 reg = <1>;
232 };
233
234 gpio_p2: gpio-bank@2 {
235 gpio-controller;
236 #gpio-cells = <2>;
237 reg = <2>;
238 };
239
240 gpio_p3: gpio-bank@3 {
241 gpio-controller;
242 #gpio-cells = <2>;
243 reg = <3>;
244 };
245
246 gpi_p3: gpio-bank@4 {
247 gpio-controller;
248 #gpio-cells = <2>;
249 reg = <4>;
250 };
251
252 gpo_p3: gpio-bank@5 {
253 gpio-controller;
254 #gpio-cells = <2>;
255 reg = <5>;
256 };
257 };
258
259 watchdog@4003C000 {
260 compatible = "nxp,pnx4008-wdt";
261 reg = <0x4003C000 0x1000>;
262 };
263
264 /*
265 * TSC vs. ADC: Since those two share the same
266 * hardware, you need to choose from one of the
267 * following two and do 'status = "okay";' for one of
268 * them
269 */
270
271 adc@40048000 {
272 compatible = "nxp,lpc3220-adc";
273 reg = <0x40048000 0x1000>;
274 interrupts = <0x27 0>;
275 status = "disable";
276 };
277
278 tsc@40048000 {
279 compatible = "nxp,lpc3220-tsc";
280 reg = <0x40048000 0x1000>;
281 interrupts = <0x27 0>;
282 status = "disable";
283 };
284
285 key@40050000 {
286 compatible = "nxp,lpc3220-key";
287 reg = <0x40050000 0x1000>;
288 };
289
290 };
291 };
292};
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index 9f72cd4cf308..8c756be4d7ad 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -18,3 +18,52 @@
18 reg = <0x80000000 0x20000000>; /* 512 MB */ 18 reg = <0x80000000 0x20000000>; /* 512 MB */
19 }; 19 };
20}; 20};
21
22&i2c1 {
23 clock-frequency = <2600000>;
24
25 twl: twl@48 {
26 reg = <0x48>;
27 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
28 interrupt-parent = <&intc>;
29
30 vsim: regulator@10 {
31 compatible = "ti,twl4030-vsim";
32 regulator-min-microvolt = <1800000>;
33 regulator-max-microvolt = <3000000>;
34 };
35 };
36};
37
38/include/ "twl4030.dtsi"
39
40&i2c2 {
41 clock-frequency = <400000>;
42};
43
44&i2c3 {
45 clock-frequency = <100000>;
46
47 /*
48 * Display monitor features are burnt in the EEPROM
49 * as EDID data.
50 */
51 eeprom@50 {
52 compatible = "ti,eeprom";
53 reg = <0x50>;
54 };
55};
56
57&mmc1 {
58 vmmc-supply = <&vmmc1>;
59 vmmc_aux-supply = <&vsim>;
60 ti,bus-width = <8>;
61};
62
63&mmc2 {
64 status = "disable";
65};
66
67&mmc3 {
68 status = "disable";
69};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index c6121357c1eb..99474fa5fac4 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -69,6 +69,60 @@
69 reg = <0x48200000 0x1000>; 69 reg = <0x48200000 0x1000>;
70 }; 70 };
71 71
72 gpio1: gpio@48310000 {
73 compatible = "ti,omap3-gpio";
74 ti,hwmods = "gpio1";
75 gpio-controller;
76 #gpio-cells = <2>;
77 interrupt-controller;
78 #interrupt-cells = <1>;
79 };
80
81 gpio2: gpio@49050000 {
82 compatible = "ti,omap3-gpio";
83 ti,hwmods = "gpio2";
84 gpio-controller;
85 #gpio-cells = <2>;
86 interrupt-controller;
87 #interrupt-cells = <1>;
88 };
89
90 gpio3: gpio@49052000 {
91 compatible = "ti,omap3-gpio";
92 ti,hwmods = "gpio3";
93 gpio-controller;
94 #gpio-cells = <2>;
95 interrupt-controller;
96 #interrupt-cells = <1>;
97 };
98
99 gpio4: gpio@49054000 {
100 compatible = "ti,omap3-gpio";
101 ti,hwmods = "gpio4";
102 gpio-controller;
103 #gpio-cells = <2>;
104 interrupt-controller;
105 #interrupt-cells = <1>;
106 };
107
108 gpio5: gpio@49056000 {
109 compatible = "ti,omap3-gpio";
110 ti,hwmods = "gpio5";
111 gpio-controller;
112 #gpio-cells = <2>;
113 interrupt-controller;
114 #interrupt-cells = <1>;
115 };
116
117 gpio6: gpio@49058000 {
118 compatible = "ti,omap3-gpio";
119 ti,hwmods = "gpio6";
120 gpio-controller;
121 #gpio-cells = <2>;
122 interrupt-controller;
123 #interrupt-cells = <1>;
124 };
125
72 uart1: serial@4806a000 { 126 uart1: serial@4806a000 {
73 compatible = "ti,omap3-uart"; 127 compatible = "ti,omap3-uart";
74 ti,hwmods = "uart1"; 128 ti,hwmods = "uart1";
@@ -113,5 +167,53 @@
113 #size-cells = <0>; 167 #size-cells = <0>;
114 ti,hwmods = "i2c3"; 168 ti,hwmods = "i2c3";
115 }; 169 };
170
171 mcspi1: spi@48098000 {
172 compatible = "ti,omap2-mcspi";
173 #address-cells = <1>;
174 #size-cells = <0>;
175 ti,hwmods = "mcspi1";
176 ti,spi-num-cs = <4>;
177 };
178
179 mcspi2: spi@4809a000 {
180 compatible = "ti,omap2-mcspi";
181 #address-cells = <1>;
182 #size-cells = <0>;
183 ti,hwmods = "mcspi2";
184 ti,spi-num-cs = <2>;
185 };
186
187 mcspi3: spi@480b8000 {
188 compatible = "ti,omap2-mcspi";
189 #address-cells = <1>;
190 #size-cells = <0>;
191 ti,hwmods = "mcspi3";
192 ti,spi-num-cs = <2>;
193 };
194
195 mcspi4: spi@480ba000 {
196 compatible = "ti,omap2-mcspi";
197 #address-cells = <1>;
198 #size-cells = <0>;
199 ti,hwmods = "mcspi4";
200 ti,spi-num-cs = <1>;
201 };
202
203 mmc1: mmc@4809c000 {
204 compatible = "ti,omap3-hsmmc";
205 ti,hwmods = "mmc1";
206 ti,dual-volt;
207 };
208
209 mmc2: mmc@480b4000 {
210 compatible = "ti,omap3-hsmmc";
211 ti,hwmods = "mmc2";
212 };
213
214 mmc3: mmc@480ad000 {
215 compatible = "ti,omap3-hsmmc";
216 ti,hwmods = "mmc3";
217 };
116 }; 218 };
117}; 219};
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 9755ad5917f8..ea6f5bb8a120 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -18,3 +18,59 @@
18 reg = <0x80000000 0x40000000>; /* 1 GB */ 18 reg = <0x80000000 0x40000000>; /* 1 GB */
19 }; 19 };
20}; 20};
21
22&i2c1 {
23 clock-frequency = <400000>;
24
25 twl: twl@48 {
26 reg = <0x48>;
27 /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
28 interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
29 interrupt-parent = <&gic>;
30 };
31};
32
33/include/ "twl6030.dtsi"
34
35&i2c2 {
36 clock-frequency = <400000>;
37};
38
39&i2c3 {
40 clock-frequency = <100000>;
41
42 /*
43 * Display monitor features are burnt in their EEPROM as EDID data.
44 * The EEPROM is connected as I2C slave device.
45 */
46 eeprom@50 {
47 compatible = "ti,eeprom";
48 reg = <0x50>;
49 };
50};
51
52&i2c4 {
53 clock-frequency = <400000>;
54};
55
56&mmc1 {
57 vmmc-supply = <&vmmc>;
58 ti,bus-width = <8>;
59};
60
61&mmc2 {
62 status = "disable";
63};
64
65&mmc3 {
66 status = "disable";
67};
68
69&mmc4 {
70 status = "disable";
71};
72
73&mmc5 {
74 ti,non-removable;
75 ti,bus-width = <4>;
76};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 63c6b2b2bf42..67b2e98074c6 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -17,4 +17,101 @@
17 device_type = "memory"; 17 device_type = "memory";
18 reg = <0x80000000 0x40000000>; /* 1 GB */ 18 reg = <0x80000000 0x40000000>; /* 1 GB */
19 }; 19 };
20
21 vdd_eth: fixedregulator@0 {
22 compatible = "regulator-fixed";
23 regulator-name = "VDD_ETH";
24 regulator-min-microvolt = <3300000>;
25 regulator-max-microvolt = <3300000>;
26 gpio = <&gpio2 16 0>; /* gpio line 48 */
27 enable-active-high;
28 regulator-boot-on;
29 };
30};
31
32&i2c1 {
33 clock-frequency = <400000>;
34
35 twl: twl@48 {
36 reg = <0x48>;
37 /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
38 interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
39 interrupt-parent = <&gic>;
40 };
41};
42
43/include/ "twl6030.dtsi"
44
45&i2c2 {
46 clock-frequency = <400000>;
47};
48
49&i2c3 {
50 clock-frequency = <400000>;
51
52 /*
53 * Temperature Sensor
54 * http://www.ti.com/lit/ds/symlink/tmp105.pdf
55 */
56 tmp105@48 {
57 compatible = "ti,tmp105";
58 reg = <0x48>;
59 };
60
61 /*
62 * Ambient Light Sensor
63 * http://www.rohm.com/products/databook/sensor/pdf/bh1780gli-e.pdf
64 */
65 bh1780@29 {
66 compatible = "rohm,bh1780";
67 reg = <0x29>;
68 };
69};
70
71&i2c4 {
72 clock-frequency = <400000>;
73
74 /*
75 * 3-Axis Digital Compass
76 * http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC5843.pdf
77 */
78 hmc5843@1e {
79 compatible = "honeywell,hmc5843";
80 reg = <0x1e>;
81 };
82};
83
84&mcspi1 {
85 eth@0 {
86 compatible = "ks8851";
87 spi-max-frequency = <24000000>;
88 reg = <0>;
89 interrupt-parent = <&gpio2>;
90 interrupts = <2>; /* gpio line 34 */
91 vdd-supply = <&vdd_eth>;
92 };
93};
94
95&mmc1 {
96 vmmc-supply = <&vmmc>;
97 ti,bus-width = <8>;
98};
99
100&mmc2 {
101 vmmc-supply = <&vaux1>;
102 ti,bus-width = <8>;
103 ti,non-removable;
104};
105
106&mmc3 {
107 status = "disable";
108};
109
110&mmc4 {
111 status = "disable";
112};
113
114&mmc5 {
115 ti,bus-width = <4>;
116 ti,non-removable;
20}; 117};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 3d35559e77bc..359c4979c8aa 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -104,6 +104,60 @@
104 <0x48240100 0x0100>; 104 <0x48240100 0x0100>;
105 }; 105 };
106 106
107 gpio1: gpio@4a310000 {
108 compatible = "ti,omap4-gpio";
109 ti,hwmods = "gpio1";
110 gpio-controller;
111 #gpio-cells = <2>;
112 interrupt-controller;
113 #interrupt-cells = <1>;
114 };
115
116 gpio2: gpio@48055000 {
117 compatible = "ti,omap4-gpio";
118 ti,hwmods = "gpio2";
119 gpio-controller;
120 #gpio-cells = <2>;
121 interrupt-controller;
122 #interrupt-cells = <1>;
123 };
124
125 gpio3: gpio@48057000 {
126 compatible = "ti,omap4-gpio";
127 ti,hwmods = "gpio3";
128 gpio-controller;
129 #gpio-cells = <2>;
130 interrupt-controller;
131 #interrupt-cells = <1>;
132 };
133
134 gpio4: gpio@48059000 {
135 compatible = "ti,omap4-gpio";
136 ti,hwmods = "gpio4";
137 gpio-controller;
138 #gpio-cells = <2>;
139 interrupt-controller;
140 #interrupt-cells = <1>;
141 };
142
143 gpio5: gpio@4805b000 {
144 compatible = "ti,omap4-gpio";
145 ti,hwmods = "gpio5";
146 gpio-controller;
147 #gpio-cells = <2>;
148 interrupt-controller;
149 #interrupt-cells = <1>;
150 };
151
152 gpio6: gpio@4805d000 {
153 compatible = "ti,omap4-gpio";
154 ti,hwmods = "gpio6";
155 gpio-controller;
156 #gpio-cells = <2>;
157 interrupt-controller;
158 #interrupt-cells = <1>;
159 };
160
107 uart1: serial@4806a000 { 161 uart1: serial@4806a000 {
108 compatible = "ti,omap4-uart"; 162 compatible = "ti,omap4-uart";
109 ti,hwmods = "uart1"; 163 ti,hwmods = "uart1";
@@ -155,5 +209,68 @@
155 #size-cells = <0>; 209 #size-cells = <0>;
156 ti,hwmods = "i2c4"; 210 ti,hwmods = "i2c4";
157 }; 211 };
212
213 mcspi1: spi@48098000 {
214 compatible = "ti,omap4-mcspi";
215 #address-cells = <1>;
216 #size-cells = <0>;
217 ti,hwmods = "mcspi1";
218 ti,spi-num-cs = <4>;
219 };
220
221 mcspi2: spi@4809a000 {
222 compatible = "ti,omap4-mcspi";
223 #address-cells = <1>;
224 #size-cells = <0>;
225 ti,hwmods = "mcspi2";
226 ti,spi-num-cs = <2>;
227 };
228
229 mcspi3: spi@480b8000 {
230 compatible = "ti,omap4-mcspi";
231 #address-cells = <1>;
232 #size-cells = <0>;
233 ti,hwmods = "mcspi3";
234 ti,spi-num-cs = <2>;
235 };
236
237 mcspi4: spi@480ba000 {
238 compatible = "ti,omap4-mcspi";
239 #address-cells = <1>;
240 #size-cells = <0>;
241 ti,hwmods = "mcspi4";
242 ti,spi-num-cs = <1>;
243 };
244
245 mmc1: mmc@4809c000 {
246 compatible = "ti,omap4-hsmmc";
247 ti,hwmods = "mmc1";
248 ti,dual-volt;
249 ti,needs-special-reset;
250 };
251
252 mmc2: mmc@480b4000 {
253 compatible = "ti,omap4-hsmmc";
254 ti,hwmods = "mmc2";
255 ti,needs-special-reset;
256 };
257
258 mmc3: mmc@480ad000 {
259 compatible = "ti,omap4-hsmmc";
260 ti,hwmods = "mmc3";
261 ti,needs-special-reset;
262 };
263
264 mmc4: mmc@480d1000 {
265 compatible = "ti,omap4-hsmmc";
266 ti,hwmods = "mmc4";
267 ti,needs-special-reset;
268 };
269
270 mmc5: mmc@480d5000 {
271 compatible = "ti,omap4-hsmmc";
272 ti,hwmods = "mmc5";
273 ti,needs-special-reset;
274 };
158 }; 275 };
159}; 276};
diff --git a/arch/arm/boot/dts/phy3250.dts b/arch/arm/boot/dts/phy3250.dts
new file mode 100644
index 000000000000..0167e86314c0
--- /dev/null
+++ b/arch/arm/boot/dts/phy3250.dts
@@ -0,0 +1,145 @@
1/*
2 * PHYTEC phyCORE-LPC3250 board
3 *
4 * Copyright 2012 Roland Stigge <stigge@antcom.de>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "lpc32xx.dtsi"
16
17/ {
18 model = "PHYTEC phyCORE-LPC3250 board based on NXP LPC3250";
19 compatible = "phytec,phy3250", "nxp,lpc3250";
20 #address-cells = <1>;
21 #size-cells = <1>;
22
23 memory {
24 device_type = "memory";
25 reg = <0 0x4000000>;
26 };
27
28 ahb {
29 mac: ethernet@31060000 {
30 phy-mode = "rmii";
31 use-iram;
32 };
33
34 /* Here, choose exactly one from: ohci, usbd */
35 ohci@31020000 {
36 transceiver = <&isp1301>;
37 status = "okay";
38 };
39
40/*
41 usbd@31020000 {
42 transceiver = <&isp1301>;
43 status = "okay";
44 };
45*/
46
47 clcd@31040000 {
48 status = "okay";
49 };
50
51 /* 64MB Flash via SLC NAND controller */
52 slc: flash@20020000 {
53 status = "okay";
54 #address-cells = <1>;
55 #size-cells = <1>;
56
57 mtd0@00000000 {
58 label = "phy3250-boot";
59 reg = <0x00000000 0x00064000>;
60 read-only;
61 };
62
63 mtd1@00064000 {
64 label = "phy3250-uboot";
65 reg = <0x00064000 0x00190000>;
66 read-only;
67 };
68
69 mtd2@001f4000 {
70 label = "phy3250-ubt-prms";
71 reg = <0x001f4000 0x00010000>;
72 };
73
74 mtd3@00204000 {
75 label = "phy3250-kernel";
76 reg = <0x00204000 0x00400000>;
77 };
78
79 mtd4@00604000 {
80 label = "phy3250-rootfs";
81 reg = <0x00604000 0x039fc000>;
82 };
83 };
84
85 apb {
86 i2c1: i2c@400A0000 {
87 clock-frequency = <100000>;
88
89 pcf8563: rtc@51 {
90 compatible = "nxp,pcf8563";
91 reg = <0x51>;
92 };
93
94 uda1380: uda1380@18 {
95 compatible = "nxp,uda1380";
96 reg = <0x18>;
97 power-gpio = <&gpio 0x59 0>;
98 reset-gpio = <&gpio 0x51 0>;
99 dac-clk = "wspll";
100 };
101 };
102
103 i2c2: i2c@400A8000 {
104 clock-frequency = <100000>;
105 };
106
107 i2cusb: i2c@31020300 {
108 clock-frequency = <100000>;
109
110 isp1301: usb-transceiver@2c {
111 compatible = "nxp,isp1301";
112 reg = <0x2c>;
113 };
114 };
115
116 ssp0: ssp@20084000 {
117 eeprom: at25@0 {
118 compatible = "atmel,at25";
119 };
120 };
121 };
122
123 fab {
124 tsc@40048000 {
125 status = "okay";
126 };
127 };
128 };
129
130 leds {
131 compatible = "gpio-leds";
132
133 led0 {
134 gpios = <&gpo_p3 1 1>; /* GPO_P3 1, GPIO 80, active low */
135 linux,default-trigger = "heartbeat";
136 default-state = "off";
137 };
138
139 led1 {
140 gpios = <&gpo_p3 14 1>; /* GPO_P3 14, GPIO 93, active low */
141 linux,default-trigger = "timer";
142 default-state = "off";
143 };
144 };
145};
diff --git a/arch/arm/boot/dts/sh7372.dtsi b/arch/arm/boot/dts/sh7372.dtsi
new file mode 100644
index 000000000000..677fc603f8b3
--- /dev/null
+++ b/arch/arm/boot/dts/sh7372.dtsi
@@ -0,0 +1,21 @@
1/*
2 * Device Tree Source for the sh7372 SoC
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/include/ "skeleton.dtsi"
12
13/ {
14 compatible = "renesas,sh7372";
15
16 cpus {
17 cpu@0 {
18 compatible = "arm,cortex-a8";
19 };
20 };
21};
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts
index 359c6d679156..d99dc04f0d91 100644
--- a/arch/arm/boot/dts/snowball.dts
+++ b/arch/arm/boot/dts/snowball.dts
@@ -30,35 +30,35 @@
30 wakeup = <1>; 30 wakeup = <1>;
31 linux,code = <2>; 31 linux,code = <2>;
32 label = "userpb"; 32 label = "userpb";
33 gpios = <&gpio1 0>; 33 gpios = <&gpio1 0 0>;
34 }; 34 };
35 button@2 { 35 button@2 {
36 debounce_interval = <50>; 36 debounce_interval = <50>;
37 wakeup = <1>; 37 wakeup = <1>;
38 linux,code = <3>; 38 linux,code = <3>;
39 label = "userpb"; 39 label = "extkb1";
40 gpios = <&gpio4 23>; 40 gpios = <&gpio4 23 0>;
41 }; 41 };
42 button@3 { 42 button@3 {
43 debounce_interval = <50>; 43 debounce_interval = <50>;
44 wakeup = <1>; 44 wakeup = <1>;
45 linux,code = <4>; 45 linux,code = <4>;
46 label = "userpb"; 46 label = "extkb2";
47 gpios = <&gpio4 23>; 47 gpios = <&gpio4 24 0>;
48 }; 48 };
49 button@4 { 49 button@4 {
50 debounce_interval = <50>; 50 debounce_interval = <50>;
51 wakeup = <1>; 51 wakeup = <1>;
52 linux,code = <5>; 52 linux,code = <5>;
53 label = "userpb"; 53 label = "extkb3";
54 gpios = <&gpio5 1>; 54 gpios = <&gpio5 1 0>;
55 }; 55 };
56 button@5 { 56 button@5 {
57 debounce_interval = <50>; 57 debounce_interval = <50>;
58 wakeup = <1>; 58 wakeup = <1>;
59 linux,code = <6>; 59 linux,code = <6>;
60 label = "userpb"; 60 label = "extkb4";
61 gpios = <&gpio5 2>; 61 gpios = <&gpio5 2 0>;
62 }; 62 };
63 }; 63 };
64 64
@@ -73,17 +73,19 @@
73 soc-u9500 { 73 soc-u9500 {
74 74
75 external-bus@50000000 { 75 external-bus@50000000 {
76 compatible = "simple-bus"; 76 status = "okay";
77 reg = <0x50000000 0x10000000>; 77
78 #address-cells = <1>; 78 ethernet@0 {
79 #size-cells = <1>; 79 compatible = "smsc,lan9115";
80 ranges; 80 reg = <0 0x10000>;
81 81 interrupts = <12 0x1>;
82 ethernet@50000000 {
83 compatible = "smsc,9111";
84 reg = <0x50000000 0x10000>;
85 interrupts = <12>;
86 interrupt-parent = <&gpio4>; 82 interrupt-parent = <&gpio4>;
83
84 reg-shift = <1>;
85 reg-io-width = <2>;
86 smsc,force-internal-phy;
87 smsc,irq-active-high;
88 smsc,irq-push-pull;
87 }; 89 };
88 }; 90 };
89 91
diff --git a/arch/arm/boot/dts/spear300-evb.dts b/arch/arm/boot/dts/spear300-evb.dts
new file mode 100644
index 000000000000..6a79d69775b5
--- /dev/null
+++ b/arch/arm/boot/dts/spear300-evb.dts
@@ -0,0 +1,183 @@
1/*
2 * DTS file for SPEAr300 Evaluation Baord
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "spear300.dtsi"
16
17/ {
18 model = "ST SPEAr300 Evaluation Board";
19 compatible = "st,spear300-evb", "st,spear300";
20 #address-cells = <1>;
21 #size-cells = <1>;
22
23 memory {
24 reg = <0 0x40000000>;
25 };
26
27 ahb {
28 clcd@60000000 {
29 status = "okay";
30 };
31
32 dma@fc400000 {
33 status = "okay";
34 };
35
36 fsmc: flash@94000000 {
37 status = "okay";
38 };
39
40 gmac: eth@e0800000 {
41 status = "okay";
42 };
43
44 sdhci@70000000 {
45 int-gpio = <&gpio1 0 0>;
46 power-gpio = <&gpio1 2 1>;
47 status = "okay";
48 };
49
50 smi: flash@fc000000 {
51 status = "okay";
52 };
53
54 spi0: spi@d0100000 {
55 status = "okay";
56 };
57
58 ehci@e1800000 {
59 status = "okay";
60 };
61
62 ohci@e1900000 {
63 status = "okay";
64 };
65
66 ohci@e2100000 {
67 status = "okay";
68 };
69
70 apb {
71 gpio0: gpio@fc980000 {
72 status = "okay";
73 };
74
75 gpio1: gpio@a9000000 {
76 status = "okay";
77 };
78
79 i2c0: i2c@d0180000 {
80 status = "okay";
81 };
82
83 kbd@a0000000 {
84 linux,keymap = < 0x00000001
85 0x00010002
86 0x00020003
87 0x00030004
88 0x00040005
89 0x00050006
90 0x00060007
91 0x00070008
92 0x00080009
93 0x0100000a
94 0x0101000c
95 0x0102000d
96 0x0103000e
97 0x0104000f
98 0x01050010
99 0x01060011
100 0x01070012
101 0x01080013
102 0x02000014
103 0x02010015
104 0x02020016
105 0x02030017
106 0x02040018
107 0x02050019
108 0x0206001a
109 0x0207001b
110 0x0208001c
111 0x0300001d
112 0x0301001e
113 0x0302001f
114 0x03030020
115 0x03040021
116 0x03050022
117 0x03060023
118 0x03070024
119 0x03080025
120 0x04000026
121 0x04010027
122 0x04020028
123 0x04030029
124 0x0404002a
125 0x0405002b
126 0x0406002c
127 0x0407002d
128 0x0408002e
129 0x0500002f
130 0x05010030
131 0x05020031
132 0x05030032
133 0x05040033
134 0x05050034
135 0x05060035
136 0x05070036
137 0x05080037
138 0x06000038
139 0x06010039
140 0x0602003a
141 0x0603003b
142 0x0604003c
143 0x0605003d
144 0x0606003e
145 0x0607003f
146 0x06080040
147 0x07000041
148 0x07010042
149 0x07020043
150 0x07030044
151 0x07040045
152 0x07050046
153 0x07060047
154 0x07070048
155 0x07080049
156 0x0800004a
157 0x0801004b
158 0x0802004c
159 0x0803004d
160 0x0804004e
161 0x0805004f
162 0x08060050
163 0x08070051
164 0x08080052 >;
165 autorepeat;
166 st,mode = <0>;
167 status = "okay";
168 };
169
170 rtc@fc900000 {
171 status = "okay";
172 };
173
174 serial@d0000000 {
175 status = "okay";
176 };
177
178 wdt@fc880000 {
179 status = "okay";
180 };
181 };
182 };
183};
diff --git a/arch/arm/boot/dts/spear300.dtsi b/arch/arm/boot/dts/spear300.dtsi
new file mode 100644
index 000000000000..f9fcbf4f477b
--- /dev/null
+++ b/arch/arm/boot/dts/spear300.dtsi
@@ -0,0 +1,72 @@
1/*
2 * DTS file for SPEAr300 SoC
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "spear3xx.dtsi"
15
16/ {
17 ahb {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 compatible = "simple-bus";
21 ranges = <0x60000000 0x60000000 0x50000000
22 0xd0000000 0xd0000000 0x30000000>;
23
24 clcd@60000000 {
25 compatible = "arm,clcd-pl110", "arm,primecell";
26 reg = <0x60000000 0x1000>;
27 interrupts = <30>;
28 status = "disabled";
29 };
30
31 fsmc: flash@94000000 {
32 compatible = "st,spear600-fsmc-nand";
33 #address-cells = <1>;
34 #size-cells = <1>;
35 reg = <0x94000000 0x1000 /* FSMC Register */
36 0x80000000 0x0010>; /* NAND Base */
37 reg-names = "fsmc_regs", "nand_data";
38 st,ale-off = <0x20000>;
39 st,cle-off = <0x10000>;
40 status = "disabled";
41 };
42
43 sdhci@70000000 {
44 compatible = "st,sdhci-spear";
45 reg = <0x70000000 0x100>;
46 interrupts = <1>;
47 status = "disabled";
48 };
49
50 apb {
51 #address-cells = <1>;
52 #size-cells = <1>;
53 compatible = "simple-bus";
54 ranges = <0xa0000000 0xa0000000 0x10000000
55 0xd0000000 0xd0000000 0x30000000>;
56
57 gpio1: gpio@a9000000 {
58 #gpio-cells = <2>;
59 compatible = "arm,pl061", "arm,primecell";
60 gpio-controller;
61 reg = <0xa9000000 0x1000>;
62 status = "disabled";
63 };
64
65 kbd@a0000000 {
66 compatible = "st,spear300-kbd";
67 reg = <0xa0000000 0x1000>;
68 status = "disabled";
69 };
70 };
71 };
72};
diff --git a/arch/arm/boot/dts/spear310-evb.dts b/arch/arm/boot/dts/spear310-evb.dts
new file mode 100644
index 000000000000..c86af33f700e
--- /dev/null
+++ b/arch/arm/boot/dts/spear310-evb.dts
@@ -0,0 +1,111 @@
1/*
2 * DTS file for SPEAr310 Evaluation Baord
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "spear310.dtsi"
16
17/ {
18 model = "ST SPEAr310 Evaluation Board";
19 compatible = "st,spear310-evb", "st,spear310";
20 #address-cells = <1>;
21 #size-cells = <1>;
22
23 memory {
24 reg = <0 0x40000000>;
25 };
26
27 ahb {
28 dma@fc400000 {
29 status = "okay";
30 };
31
32 fsmc: flash@44000000 {
33 status = "okay";
34 };
35
36 gmac: eth@e0800000 {
37 status = "okay";
38 };
39
40 smi: flash@fc000000 {
41 status = "okay";
42 clock-rate=<50000000>;
43
44 flash@f8000000 {
45 label = "m25p64";
46 reg = <0xf8000000 0x800000>;
47 #address-cells = <1>;
48 #size-cells = <1>;
49 st,smi-fast-mode;
50 };
51 };
52
53 spi0: spi@d0100000 {
54 status = "okay";
55 };
56
57 ehci@e1800000 {
58 status = "okay";
59 };
60
61 ohci@e1900000 {
62 status = "okay";
63 };
64
65 ohci@e2100000 {
66 status = "okay";
67 };
68
69 apb {
70 gpio0: gpio@fc980000 {
71 status = "okay";
72 };
73
74 i2c0: i2c@d0180000 {
75 status = "okay";
76 };
77
78 rtc@fc900000 {
79 status = "okay";
80 };
81
82 serial@d0000000 {
83 status = "okay";
84 };
85
86 serial@b2000000 {
87 status = "okay";
88 };
89
90 serial@b2080000 {
91 status = "okay";
92 };
93
94 serial@b2100000 {
95 status = "okay";
96 };
97
98 serial@b2180000 {
99 status = "okay";
100 };
101
102 serial@b2200000 {
103 status = "okay";
104 };
105
106 wdt@fc880000 {
107 status = "okay";
108 };
109 };
110 };
111};
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
new file mode 100644
index 000000000000..dc7fa14da846
--- /dev/null
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -0,0 +1,75 @@
1/*
2 * DTS file for SPEAr310 SoC
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "spear3xx.dtsi"
15
16/ {
17 ahb {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 compatible = "simple-bus";
21 ranges = <0x40000000 0x40000000 0x10000000
22 0xb0000000 0xb0000000 0x10000000
23 0xd0000000 0xd0000000 0x30000000>;
24
25 fsmc: flash@44000000 {
26 compatible = "st,spear600-fsmc-nand";
27 #address-cells = <1>;
28 #size-cells = <1>;
29 reg = <0x44000000 0x1000 /* FSMC Register */
30 0x40000000 0x0010>; /* NAND Base */
31 reg-names = "fsmc_regs", "nand_data";
32 st,ale-off = <0x10000>;
33 st,cle-off = <0x20000>;
34 status = "disabled";
35 };
36
37 apb {
38 #address-cells = <1>;
39 #size-cells = <1>;
40 compatible = "simple-bus";
41 ranges = <0xb0000000 0xb0000000 0x10000000
42 0xd0000000 0xd0000000 0x30000000>;
43
44 serial@b2000000 {
45 compatible = "arm,pl011", "arm,primecell";
46 reg = <0xb2000000 0x1000>;
47 status = "disabled";
48 };
49
50 serial@b2080000 {
51 compatible = "arm,pl011", "arm,primecell";
52 reg = <0xb2080000 0x1000>;
53 status = "disabled";
54 };
55
56 serial@b2100000 {
57 compatible = "arm,pl011", "arm,primecell";
58 reg = <0xb2100000 0x1000>;
59 status = "disabled";
60 };
61
62 serial@b2180000 {
63 compatible = "arm,pl011", "arm,primecell";
64 reg = <0xb2180000 0x1000>;
65 status = "disabled";
66 };
67
68 serial@b2200000 {
69 compatible = "arm,pl011", "arm,primecell";
70 reg = <0xb2200000 0x1000>;
71 status = "disabled";
72 };
73 };
74 };
75};
diff --git a/arch/arm/boot/dts/spear320-evb.dts b/arch/arm/boot/dts/spear320-evb.dts
new file mode 100644
index 000000000000..d43de712e863
--- /dev/null
+++ b/arch/arm/boot/dts/spear320-evb.dts
@@ -0,0 +1,112 @@
1/*
2 * DTS file for SPEAr320 Evaluation Baord
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "spear320.dtsi"
16
17/ {
18 model = "ST SPEAr300 Evaluation Board";
19 compatible = "st,spear300-evb", "st,spear300";
20 #address-cells = <1>;
21 #size-cells = <1>;
22
23 memory {
24 reg = <0 0x40000000>;
25 };
26
27 ahb {
28 clcd@90000000 {
29 status = "okay";
30 };
31
32 dma@fc400000 {
33 status = "okay";
34 };
35
36 fsmc: flash@4c000000 {
37 status = "okay";
38 };
39
40 gmac: eth@e0800000 {
41 status = "okay";
42 };
43
44 sdhci@70000000 {
45 power-gpio = <&gpio0 2 1>;
46 power_always_enb;
47 status = "okay";
48 };
49
50 smi: flash@fc000000 {
51 status = "okay";
52 };
53
54 spi0: spi@d0100000 {
55 status = "okay";
56 };
57
58 spi1: spi@a5000000 {
59 status = "okay";
60 };
61
62 spi2: spi@a6000000 {
63 status = "okay";
64 };
65
66 ehci@e1800000 {
67 status = "okay";
68 };
69
70 ohci@e1900000 {
71 status = "okay";
72 };
73
74 ohci@e2100000 {
75 status = "okay";
76 };
77
78 apb {
79 gpio0: gpio@fc980000 {
80 status = "okay";
81 };
82
83 i2c0: i2c@d0180000 {
84 status = "okay";
85 };
86
87 i2c1: i2c@a7000000 {
88 status = "okay";
89 };
90
91 rtc@fc900000 {
92 status = "okay";
93 };
94
95 serial@d0000000 {
96 status = "okay";
97 };
98
99 serial@a3000000 {
100 status = "okay";
101 };
102
103 serial@a4000000 {
104 status = "okay";
105 };
106
107 wdt@fc880000 {
108 status = "okay";
109 };
110 };
111 };
112};
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
new file mode 100644
index 000000000000..9a0267a5a0b7
--- /dev/null
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -0,0 +1,90 @@
1/*
2 * DTS file for SPEAr320 SoC
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "spear3xx.dtsi"
15
16/ {
17 ahb {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 compatible = "simple-bus";
21 ranges = <0x40000000 0x40000000 0x70000000
22 0xd0000000 0xd0000000 0x30000000>;
23
24 clcd@90000000 {
25 compatible = "arm,clcd-pl110", "arm,primecell";
26 reg = <0x90000000 0x1000>;
27 interrupts = <33>;
28 status = "disabled";
29 };
30
31 fsmc: flash@4c000000 {
32 compatible = "st,spear600-fsmc-nand";
33 #address-cells = <1>;
34 #size-cells = <1>;
35 reg = <0x4c000000 0x1000 /* FSMC Register */
36 0x50000000 0x0010>; /* NAND Base */
37 reg-names = "fsmc_regs", "nand_data";
38 st,ale-off = <0x20000>;
39 st,cle-off = <0x10000>;
40 status = "disabled";
41 };
42
43 sdhci@70000000 {
44 compatible = "st,sdhci-spear";
45 reg = <0x70000000 0x100>;
46 interrupts = <29>;
47 status = "disabled";
48 };
49
50 spi1: spi@a5000000 {
51 compatible = "arm,pl022", "arm,primecell";
52 reg = <0xa5000000 0x1000>;
53 status = "disabled";
54 };
55
56 spi2: spi@a6000000 {
57 compatible = "arm,pl022", "arm,primecell";
58 reg = <0xa6000000 0x1000>;
59 status = "disabled";
60 };
61
62 apb {
63 #address-cells = <1>;
64 #size-cells = <1>;
65 compatible = "simple-bus";
66 ranges = <0xa0000000 0xa0000000 0x10000000
67 0xd0000000 0xd0000000 0x30000000>;
68
69 i2c1: i2c@a7000000 {
70 #address-cells = <1>;
71 #size-cells = <0>;
72 compatible = "snps,designware-i2c";
73 reg = <0xa7000000 0x1000>;
74 status = "disabled";
75 };
76
77 serial@a3000000 {
78 compatible = "arm,pl011", "arm,primecell";
79 reg = <0xa3000000 0x1000>;
80 status = "disabled";
81 };
82
83 serial@a4000000 {
84 compatible = "arm,pl011", "arm,primecell";
85 reg = <0xa4000000 0x1000>;
86 status = "disabled";
87 };
88 };
89 };
90};
diff --git a/arch/arm/boot/dts/spear3xx.dtsi b/arch/arm/boot/dts/spear3xx.dtsi
new file mode 100644
index 000000000000..0ae7c8e86311
--- /dev/null
+++ b/arch/arm/boot/dts/spear3xx.dtsi
@@ -0,0 +1,144 @@
1/*
2 * DTS file for all SPEAr3xx SoCs
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "skeleton.dtsi"
15
16/ {
17 interrupt-parent = <&vic>;
18
19 cpus {
20 cpu@0 {
21 compatible = "arm,arm926ejs";
22 };
23 };
24
25 memory {
26 device_type = "memory";
27 reg = <0 0x40000000>;
28 };
29
30 ahb {
31 #address-cells = <1>;
32 #size-cells = <1>;
33 compatible = "simple-bus";
34 ranges = <0xd0000000 0xd0000000 0x30000000>;
35
36 vic: interrupt-controller@f1100000 {
37 compatible = "arm,pl190-vic";
38 interrupt-controller;
39 reg = <0xf1100000 0x1000>;
40 #interrupt-cells = <1>;
41 };
42
43 dma@fc400000 {
44 compatible = "arm,pl080", "arm,primecell";
45 reg = <0xfc400000 0x1000>;
46 interrupt-parent = <&vic>;
47 interrupts = <8>;
48 status = "disabled";
49 };
50
51 gmac: eth@e0800000 {
52 compatible = "st,spear600-gmac";
53 reg = <0xe0800000 0x8000>;
54 interrupts = <23 22>;
55 interrupt-names = "macirq", "eth_wake_irq";
56 status = "disabled";
57 };
58
59 smi: flash@fc000000 {
60 compatible = "st,spear600-smi";
61 #address-cells = <1>;
62 #size-cells = <1>;
63 reg = <0xfc000000 0x1000>;
64 interrupts = <9>;
65 status = "disabled";
66 };
67
68 spi0: spi@d0100000 {
69 compatible = "arm,pl022", "arm,primecell";
70 reg = <0xd0100000 0x1000>;
71 interrupts = <20>;
72 status = "disabled";
73 };
74
75 ehci@e1800000 {
76 compatible = "st,spear600-ehci", "usb-ehci";
77 reg = <0xe1800000 0x1000>;
78 interrupts = <26>;
79 status = "disabled";
80 };
81
82 ohci@e1900000 {
83 compatible = "st,spear600-ohci", "usb-ohci";
84 reg = <0xe1900000 0x1000>;
85 interrupts = <25>;
86 status = "disabled";
87 };
88
89 ohci@e2100000 {
90 compatible = "st,spear600-ohci", "usb-ohci";
91 reg = <0xe2100000 0x1000>;
92 interrupts = <27>;
93 status = "disabled";
94 };
95
96 apb {
97 #address-cells = <1>;
98 #size-cells = <1>;
99 compatible = "simple-bus";
100 ranges = <0xd0000000 0xd0000000 0x30000000>;
101
102 gpio0: gpio@fc980000 {
103 compatible = "arm,pl061", "arm,primecell";
104 reg = <0xfc980000 0x1000>;
105 interrupts = <11>;
106 gpio-controller;
107 #gpio-cells = <2>;
108 interrupt-controller;
109 #interrupt-cells = <2>;
110 status = "disabled";
111 };
112
113 i2c0: i2c@d0180000 {
114 #address-cells = <1>;
115 #size-cells = <0>;
116 compatible = "snps,designware-i2c";
117 reg = <0xd0180000 0x1000>;
118 interrupts = <21>;
119 status = "disabled";
120 };
121
122 rtc@fc900000 {
123 compatible = "st,spear-rtc";
124 reg = <0xfc900000 0x1000>;
125 interrupts = <10>;
126 status = "disabled";
127 };
128
129 serial@d0000000 {
130 compatible = "arm,pl011", "arm,primecell";
131 reg = <0xd0000000 0x1000>;
132 interrupts = <19>;
133 status = "disabled";
134 };
135
136 wdt@fc880000 {
137 compatible = "arm,sp805", "arm,primecell";
138 reg = <0xfc880000 0x1000>;
139 interrupts = <12>;
140 status = "disabled";
141 };
142 };
143 };
144};
diff --git a/arch/arm/boot/dts/spear600-evb.dts b/arch/arm/boot/dts/spear600-evb.dts
index 636292e18c90..790a7a8a5ccd 100644
--- a/arch/arm/boot/dts/spear600-evb.dts
+++ b/arch/arm/boot/dts/spear600-evb.dts
@@ -24,6 +24,10 @@
24 }; 24 };
25 25
26 ahb { 26 ahb {
27 dma@fc400000 {
28 status = "okay";
29 };
30
27 gmac: ethernet@e0800000 { 31 gmac: ethernet@e0800000 {
28 phy-mode = "gmii"; 32 phy-mode = "gmii";
29 status = "okay"; 33 status = "okay";
diff --git a/arch/arm/boot/dts/spear600.dtsi b/arch/arm/boot/dts/spear600.dtsi
index ebe0885a2b98..d777e3a6f178 100644
--- a/arch/arm/boot/dts/spear600.dtsi
+++ b/arch/arm/boot/dts/spear600.dtsi
@@ -45,6 +45,14 @@
45 #interrupt-cells = <1>; 45 #interrupt-cells = <1>;
46 }; 46 };
47 47
48 dma@fc400000 {
49 compatible = "arm,pl080", "arm,primecell";
50 reg = <0xfc400000 0x1000>;
51 interrupt-parent = <&vic1>;
52 interrupts = <10>;
53 status = "disabled";
54 };
55
48 gmac: ethernet@e0800000 { 56 gmac: ethernet@e0800000 {
49 compatible = "st,spear600-gmac"; 57 compatible = "st,spear600-gmac";
50 reg = <0xe0800000 0x8000>; 58 reg = <0xe0800000 0x8000>;
diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
new file mode 100644
index 000000000000..a94654c9eb8d
--- /dev/null
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
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 as
6 * published by the Free Software Foundation.
7 */
8
9/*
10 * Integrated Power Management Chip
11 */
12&twl {
13 compatible = "ti,twl4030";
14 interrupt-controller;
15 #interrupt-cells = <1>;
16
17 rtc {
18 compatible = "ti,twl4030-rtc";
19 interrupts = <11>;
20 };
21
22 vdac: regulator@0 {
23 compatible = "ti,twl4030-vdac";
24 regulator-min-microvolt = <1800000>;
25 regulator-max-microvolt = <1800000>;
26 };
27
28 vpll2: regulator@1 {
29 compatible = "ti,twl4030-vpll2";
30 regulator-min-microvolt = <1800000>;
31 regulator-max-microvolt = <1800000>;
32 };
33
34 vmmc1: regulator@2 {
35 compatible = "ti,twl4030-vmmc1";
36 regulator-min-microvolt = <1850000>;
37 regulator-max-microvolt = <3150000>;
38 };
39};
diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi
new file mode 100644
index 000000000000..3b2f3510d7eb
--- /dev/null
+++ b/arch/arm/boot/dts/twl6030.dtsi
@@ -0,0 +1,86 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
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 as
6 * published by the Free Software Foundation.
7 */
8
9/*
10 * Integrated Power Management Chip
11 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
12 */
13&twl {
14 compatible = "ti,twl6030";
15 interrupt-controller;
16 #interrupt-cells = <1>;
17
18 rtc {
19 compatible = "ti,twl4030-rtc";
20 interrupts = <11>;
21 };
22
23 vaux1: regulator@0 {
24 compatible = "ti,twl6030-vaux1";
25 regulator-min-microvolt = <1000000>;
26 regulator-max-microvolt = <3000000>;
27 };
28
29 vaux2: regulator@1 {
30 compatible = "ti,twl6030-vaux2";
31 regulator-min-microvolt = <1200000>;
32 regulator-max-microvolt = <2800000>;
33 };
34
35 vaux3: regulator@2 {
36 compatible = "ti,twl6030-vaux3";
37 regulator-min-microvolt = <1000000>;
38 regulator-max-microvolt = <3000000>;
39 };
40
41 vmmc: regulator@3 {
42 compatible = "ti,twl6030-vmmc";
43 regulator-min-microvolt = <1200000>;
44 regulator-max-microvolt = <3000000>;
45 };
46
47 vpp: regulator@4 {
48 compatible = "ti,twl6030-vpp";
49 regulator-min-microvolt = <1800000>;
50 regulator-max-microvolt = <2500000>;
51 };
52
53 vusim: regulator@5 {
54 compatible = "ti,twl6030-vusim";
55 regulator-min-microvolt = <1200000>;
56 regulator-max-microvolt = <2900000>;
57 };
58
59 vdac: regulator@6 {
60 compatible = "ti,twl6030-vdac";
61 };
62
63 vana: regulator@7 {
64 compatible = "ti,twl6030-vana";
65 };
66
67 vcxio: regulator@8 {
68 compatible = "ti,twl6030-vcxio";
69 };
70
71 vusb: regulator@9 {
72 compatible = "ti,twl6030-vusb";
73 };
74
75 v1v8: regulator@10 {
76 compatible = "ti,twl6030-v1v8";
77 };
78
79 v2v1: regulator@11 {
80 compatible = "ti,twl6030-v2v1";
81 };
82
83 clk32kg: regulator@12 {
84 compatible = "ti,twl6030-clk32kg";
85 };
86};
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index b5ac644e12af..6b31cb60daab 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -112,6 +112,7 @@ CONFIG_WATCHDOG=y
112CONFIG_IMX2_WDT=y 112CONFIG_IMX2_WDT=y
113CONFIG_MFD_MC13XXX=y 113CONFIG_MFD_MC13XXX=y
114CONFIG_REGULATOR=y 114CONFIG_REGULATOR=y
115CONFIG_REGULATOR_FIXED_VOLTAGE=y
115CONFIG_REGULATOR_MC13783=y 116CONFIG_REGULATOR_MC13783=y
116CONFIG_REGULATOR_MC13892=y 117CONFIG_REGULATOR_MC13892=y
117CONFIG_FB=y 118CONFIG_FB=y
diff --git a/arch/arm/configs/lpc32xx_defconfig b/arch/arm/configs/lpc32xx_defconfig
index fb2088171ca9..4fa60547494a 100644
--- a/arch/arm/configs/lpc32xx_defconfig
+++ b/arch/arm/configs/lpc32xx_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_SYSFS_DEPRECATED=y 6CONFIG_SYSFS_DEPRECATED=y
7CONFIG_SYSFS_DEPRECATED_V2=y 7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
@@ -10,6 +10,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
10CONFIG_SYSCTL_SYSCALL=y 10CONFIG_SYSCTL_SYSCALL=y
11CONFIG_EMBEDDED=y 11CONFIG_EMBEDDED=y
12CONFIG_SLAB=y 12CONFIG_SLAB=y
13CONFIG_JUMP_LABEL=y
13CONFIG_MODULES=y 14CONFIG_MODULES=y
14CONFIG_MODULE_UNLOAD=y 15CONFIG_MODULE_UNLOAD=y
15# CONFIG_BLK_DEV_BSG is not set 16# CONFIG_BLK_DEV_BSG is not set
@@ -21,6 +22,8 @@ CONFIG_PREEMPT=y
21CONFIG_AEABI=y 22CONFIG_AEABI=y
22CONFIG_ZBOOT_ROM_TEXT=0x0 23CONFIG_ZBOOT_ROM_TEXT=0x0
23CONFIG_ZBOOT_ROM_BSS=0x0 24CONFIG_ZBOOT_ROM_BSS=0x0
25CONFIG_ARM_APPENDED_DTB=y
26CONFIG_ARM_ATAG_DTB_COMPAT=y
24CONFIG_CMDLINE="console=ttyS0,115200n81 root=/dev/ram0" 27CONFIG_CMDLINE="console=ttyS0,115200n81 root=/dev/ram0"
25CONFIG_CPU_IDLE=y 28CONFIG_CPU_IDLE=y
26CONFIG_FPE_NWFPE=y 29CONFIG_FPE_NWFPE=y
@@ -40,7 +43,8 @@ CONFIG_IP_PNP_BOOTP=y
40# CONFIG_INET_XFRM_MODE_BEET is not set 43# CONFIG_INET_XFRM_MODE_BEET is not set
41# CONFIG_INET_LRO is not set 44# CONFIG_INET_LRO is not set
42# CONFIG_INET_DIAG is not set 45# CONFIG_INET_DIAG is not set
43# CONFIG_IPV6 is not set 46CONFIG_IPV6=y
47CONFIG_IPV6_PRIVACY=y
44# CONFIG_WIRELESS is not set 48# CONFIG_WIRELESS is not set
45CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 49CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
46# CONFIG_FW_LOADER is not set 50# CONFIG_FW_LOADER is not set
@@ -55,13 +59,24 @@ CONFIG_BLK_DEV_CRYPTOLOOP=y
55CONFIG_BLK_DEV_RAM=y 59CONFIG_BLK_DEV_RAM=y
56CONFIG_BLK_DEV_RAM_COUNT=1 60CONFIG_BLK_DEV_RAM_COUNT=1
57CONFIG_BLK_DEV_RAM_SIZE=16384 61CONFIG_BLK_DEV_RAM_SIZE=16384
58CONFIG_MISC_DEVICES=y
59CONFIG_EEPROM_AT25=y 62CONFIG_EEPROM_AT25=y
60CONFIG_SCSI=y 63CONFIG_SCSI=y
61CONFIG_BLK_DEV_SD=y 64CONFIG_BLK_DEV_SD=y
62CONFIG_NETDEVICES=y 65CONFIG_NETDEVICES=y
63CONFIG_MII=y 66CONFIG_MII=y
64CONFIG_PHYLIB=y 67# CONFIG_NET_VENDOR_BROADCOM is not set
68# CONFIG_NET_VENDOR_CHELSIO is not set
69# CONFIG_NET_VENDOR_CIRRUS is not set
70# CONFIG_NET_VENDOR_FARADAY is not set
71# CONFIG_NET_VENDOR_INTEL is not set
72# CONFIG_NET_VENDOR_MARVELL is not set
73# CONFIG_NET_VENDOR_MICREL is not set
74# CONFIG_NET_VENDOR_MICROCHIP is not set
75# CONFIG_NET_VENDOR_NATSEMI is not set
76CONFIG_LPC_ENET=y
77# CONFIG_NET_VENDOR_SEEQ is not set
78# CONFIG_NET_VENDOR_SMSC is not set
79# CONFIG_NET_VENDOR_STMICRO is not set
65CONFIG_SMSC_PHY=y 80CONFIG_SMSC_PHY=y
66# CONFIG_WLAN is not set 81# CONFIG_WLAN is not set
67# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 82# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
@@ -97,16 +112,22 @@ CONFIG_SND_SEQUENCER=y
97CONFIG_SND_MIXER_OSS=y 112CONFIG_SND_MIXER_OSS=y
98CONFIG_SND_PCM_OSS=y 113CONFIG_SND_PCM_OSS=y
99CONFIG_SND_SEQUENCER_OSS=y 114CONFIG_SND_SEQUENCER_OSS=y
100CONFIG_SND_DYNAMIC_MINORS=y 115# CONFIG_SND_SUPPORT_OLD_API is not set
101# CONFIG_SND_VERBOSE_PROCFS is not set 116# CONFIG_SND_VERBOSE_PROCFS is not set
117CONFIG_SND_DEBUG=y
118CONFIG_SND_DEBUG_VERBOSE=y
102# CONFIG_SND_DRIVERS is not set 119# CONFIG_SND_DRIVERS is not set
103# CONFIG_SND_ARM is not set 120# CONFIG_SND_ARM is not set
104# CONFIG_SND_SPI is not set 121# CONFIG_SND_SPI is not set
105CONFIG_SND_SOC=y 122CONFIG_SND_SOC=y
106# CONFIG_HID_SUPPORT is not set 123# CONFIG_HID_SUPPORT is not set
107CONFIG_USB=y 124CONFIG_USB=y
125CONFIG_USB_OHCI_HCD=y
108CONFIG_USB_STORAGE=y 126CONFIG_USB_STORAGE=y
109CONFIG_USB_LIBUSUAL=y 127CONFIG_USB_GADGET=y
128CONFIG_USB_LPC32XX=y
129CONFIG_USB_MASS_STORAGE=m
130CONFIG_USB_G_SERIAL=m
110CONFIG_MMC=y 131CONFIG_MMC=y
111# CONFIG_MMC_BLOCK_BOUNCE is not set 132# CONFIG_MMC_BLOCK_BOUNCE is not set
112CONFIG_MMC_ARMMMCI=y 133CONFIG_MMC_ARMMMCI=y
@@ -114,10 +135,21 @@ CONFIG_NEW_LEDS=y
114CONFIG_LEDS_CLASS=y 135CONFIG_LEDS_CLASS=y
115CONFIG_LEDS_GPIO=y 136CONFIG_LEDS_GPIO=y
116CONFIG_LEDS_TRIGGERS=y 137CONFIG_LEDS_TRIGGERS=y
138CONFIG_LEDS_TRIGGER_TIMER=y
117CONFIG_LEDS_TRIGGER_HEARTBEAT=y 139CONFIG_LEDS_TRIGGER_HEARTBEAT=y
140CONFIG_LEDS_TRIGGER_BACKLIGHT=y
141CONFIG_LEDS_TRIGGER_GPIO=y
142CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
118CONFIG_RTC_CLASS=y 143CONFIG_RTC_CLASS=y
119CONFIG_RTC_INTF_DEV_UIE_EMUL=y 144CONFIG_RTC_INTF_DEV_UIE_EMUL=y
145CONFIG_RTC_DRV_DS1374=y
146CONFIG_RTC_DRV_PCF8563=y
120CONFIG_RTC_DRV_LPC32XX=y 147CONFIG_RTC_DRV_LPC32XX=y
148CONFIG_DMADEVICES=y
149CONFIG_AMBA_PL08X=y
150CONFIG_STAGING=y
151CONFIG_IIO=y
152CONFIG_LPC32XX_ADC=y
121CONFIG_EXT2_FS=y 153CONFIG_EXT2_FS=y
122CONFIG_AUTOFS4_FS=y 154CONFIG_AUTOFS4_FS=y
123CONFIG_MSDOS_FS=y 155CONFIG_MSDOS_FS=y
diff --git a/arch/arm/configs/spear3xx_defconfig b/arch/arm/configs/spear3xx_defconfig
index fea7e1f026a3..7ed42912d69a 100644
--- a/arch/arm/configs/spear3xx_defconfig
+++ b/arch/arm/configs/spear3xx_defconfig
@@ -2,33 +2,67 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5CONFIG_KALLSYMS_EXTRA_PASS=y
6CONFIG_MODULES=y 5CONFIG_MODULES=y
7CONFIG_MODULE_UNLOAD=y 6CONFIG_MODULE_UNLOAD=y
8CONFIG_MODVERSIONS=y 7CONFIG_MODVERSIONS=y
8CONFIG_PARTITION_ADVANCED=y
9CONFIG_PLAT_SPEAR=y 9CONFIG_PLAT_SPEAR=y
10CONFIG_BOARD_SPEAR300_EVB=y 10CONFIG_MACH_SPEAR300=y
11CONFIG_BOARD_SPEAR310_EVB=y 11CONFIG_MACH_SPEAR310=y
12CONFIG_BOARD_SPEAR320_EVB=y 12CONFIG_MACH_SPEAR320=y
13CONFIG_BINFMT_MISC=y 13CONFIG_BINFMT_MISC=y
14CONFIG_NET=y
14CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 15CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
16CONFIG_MTD=y
17CONFIG_MTD_NAND=y
18CONFIG_MTD_NAND_FSMC=y
15CONFIG_BLK_DEV_RAM=y 19CONFIG_BLK_DEV_RAM=y
16CONFIG_BLK_DEV_RAM_SIZE=16384 20CONFIG_BLK_DEV_RAM_SIZE=16384
21CONFIG_NETDEVICES=y
22# CONFIG_NET_VENDOR_BROADCOM is not set
23# CONFIG_NET_VENDOR_CIRRUS is not set
24# CONFIG_NET_VENDOR_FARADAY is not set
25# CONFIG_NET_VENDOR_INTEL is not set
26# CONFIG_NET_VENDOR_MICREL is not set
27# CONFIG_NET_VENDOR_NATSEMI is not set
28# CONFIG_NET_VENDOR_SEEQ is not set
29# CONFIG_NET_VENDOR_SMSC is not set
30CONFIG_STMMAC_ETH=y
31# CONFIG_WLAN is not set
17CONFIG_INPUT_FF_MEMLESS=y 32CONFIG_INPUT_FF_MEMLESS=y
18# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 33# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
19# CONFIG_INPUT_KEYBOARD is not set 34# CONFIG_KEYBOARD_ATKBD is not set
35CONFIG_KEYBOARD_SPEAR=y
20# CONFIG_INPUT_MOUSE is not set 36# CONFIG_INPUT_MOUSE is not set
37# CONFIG_LEGACY_PTYS is not set
21CONFIG_SERIAL_AMBA_PL011=y 38CONFIG_SERIAL_AMBA_PL011=y
22CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 39CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
23# CONFIG_LEGACY_PTYS is not set
24# CONFIG_HW_RANDOM is not set 40# CONFIG_HW_RANDOM is not set
25CONFIG_RAW_DRIVER=y 41CONFIG_RAW_DRIVER=y
26CONFIG_MAX_RAW_DEVS=8192 42CONFIG_MAX_RAW_DEVS=8192
43CONFIG_I2C=y
44CONFIG_I2C_DESIGNWARE_PLATFORM=y
45CONFIG_SPI=y
46CONFIG_SPI_PL022=y
27CONFIG_GPIO_SYSFS=y 47CONFIG_GPIO_SYSFS=y
28CONFIG_GPIO_PL061=y 48CONFIG_GPIO_PL061=y
29# CONFIG_HWMON is not set 49# CONFIG_HWMON is not set
50CONFIG_WATCHDOG=y
51CONFIG_ARM_SP805_WATCHDOG=y
52CONFIG_FB=y
53CONFIG_FB_ARMCLCD=y
30# CONFIG_HID_SUPPORT is not set 54# CONFIG_HID_SUPPORT is not set
31# CONFIG_USB_SUPPORT is not set 55CONFIG_USB=y
56# CONFIG_USB_DEVICE_CLASS is not set
57CONFIG_USB_EHCI_HCD=y
58CONFIG_USB_OHCI_HCD=y
59CONFIG_MMC=y
60CONFIG_MMC_SDHCI=y
61CONFIG_MMC_SDHCI_SPEAR=y
62CONFIG_RTC_CLASS=y
63CONFIG_DMADEVICES=y
64CONFIG_AMBA_PL08X=y
65CONFIG_DMATEST=m
32CONFIG_EXT2_FS=y 66CONFIG_EXT2_FS=y
33CONFIG_EXT2_FS_XATTR=y 67CONFIG_EXT2_FS_XATTR=y
34CONFIG_EXT2_FS_SECURITY=y 68CONFIG_EXT2_FS_SECURITY=y
@@ -39,8 +73,6 @@ CONFIG_MSDOS_FS=m
39CONFIG_VFAT_FS=m 73CONFIG_VFAT_FS=m
40CONFIG_FAT_DEFAULT_IOCHARSET="ascii" 74CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
41CONFIG_TMPFS=y 75CONFIG_TMPFS=y
42CONFIG_PARTITION_ADVANCED=y
43CONFIG_NLS=y
44CONFIG_NLS_DEFAULT="utf8" 76CONFIG_NLS_DEFAULT="utf8"
45CONFIG_NLS_CODEPAGE_437=y 77CONFIG_NLS_CODEPAGE_437=y
46CONFIG_NLS_ASCII=m 78CONFIG_NLS_ASCII=m
@@ -48,6 +80,4 @@ CONFIG_MAGIC_SYSRQ=y
48CONFIG_DEBUG_FS=y 80CONFIG_DEBUG_FS=y
49CONFIG_DEBUG_KERNEL=y 81CONFIG_DEBUG_KERNEL=y
50CONFIG_DEBUG_SPINLOCK=y 82CONFIG_DEBUG_SPINLOCK=y
51CONFIG_DEBUG_SPINLOCK_SLEEP=y
52CONFIG_DEBUG_INFO=y 83CONFIG_DEBUG_INFO=y
53# CONFIG_CRC32 is not set
diff --git a/arch/arm/configs/spear6xx_defconfig b/arch/arm/configs/spear6xx_defconfig
index cef2e836afd2..cf94bc73a0e0 100644
--- a/arch/arm/configs/spear6xx_defconfig
+++ b/arch/arm/configs/spear6xx_defconfig
@@ -2,29 +2,58 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5CONFIG_KALLSYMS_EXTRA_PASS=y
6CONFIG_MODULES=y 5CONFIG_MODULES=y
7CONFIG_MODULE_UNLOAD=y 6CONFIG_MODULE_UNLOAD=y
8CONFIG_MODVERSIONS=y 7CONFIG_MODVERSIONS=y
8CONFIG_PARTITION_ADVANCED=y
9CONFIG_PLAT_SPEAR=y 9CONFIG_PLAT_SPEAR=y
10CONFIG_ARCH_SPEAR6XX=y 10CONFIG_ARCH_SPEAR6XX=y
11CONFIG_BOARD_SPEAR600_EVB=y 11CONFIG_BOARD_SPEAR600_DT=y
12CONFIG_BINFMT_MISC=y 12CONFIG_BINFMT_MISC=y
13CONFIG_NET=y
13CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 14CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
15CONFIG_MTD=y
16CONFIG_MTD_NAND=y
17CONFIG_MTD_NAND_FSMC=y
14CONFIG_BLK_DEV_RAM=y 18CONFIG_BLK_DEV_RAM=y
15CONFIG_BLK_DEV_RAM_SIZE=16384 19CONFIG_BLK_DEV_RAM_SIZE=16384
20CONFIG_NETDEVICES=y
21# CONFIG_NET_VENDOR_BROADCOM is not set
22# CONFIG_NET_VENDOR_CIRRUS is not set
23# CONFIG_NET_VENDOR_FARADAY is not set
24# CONFIG_NET_VENDOR_INTEL is not set
25# CONFIG_NET_VENDOR_MICREL is not set
26# CONFIG_NET_VENDOR_NATSEMI is not set
27# CONFIG_NET_VENDOR_SEEQ is not set
28# CONFIG_NET_VENDOR_SMSC is not set
29CONFIG_STMMAC_ETH=y
30# CONFIG_WLAN is not set
16CONFIG_INPUT_FF_MEMLESS=y 31CONFIG_INPUT_FF_MEMLESS=y
17# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 32# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
33# CONFIG_INPUT_KEYBOARD is not set
34# CONFIG_INPUT_MOUSE is not set
35# CONFIG_LEGACY_PTYS is not set
18CONFIG_SERIAL_AMBA_PL011=y 36CONFIG_SERIAL_AMBA_PL011=y
19CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 37CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
20# CONFIG_LEGACY_PTYS is not set
21CONFIG_RAW_DRIVER=y 38CONFIG_RAW_DRIVER=y
22CONFIG_MAX_RAW_DEVS=8192 39CONFIG_MAX_RAW_DEVS=8192
40CONFIG_I2C=y
41CONFIG_I2C_DESIGNWARE_PLATFORM=y
42CONFIG_SPI=y
43CONFIG_SPI_PL022=y
23CONFIG_GPIO_SYSFS=y 44CONFIG_GPIO_SYSFS=y
24CONFIG_GPIO_PL061=y 45CONFIG_GPIO_PL061=y
25# CONFIG_HWMON is not set 46# CONFIG_HWMON is not set
47CONFIG_WATCHDOG=y
48CONFIG_ARM_SP805_WATCHDOG=y
26# CONFIG_HID_SUPPORT is not set 49# CONFIG_HID_SUPPORT is not set
27# CONFIG_USB_SUPPORT is not set 50CONFIG_USB=y
51CONFIG_USB_EHCI_HCD=y
52CONFIG_USB_OHCI_HCD=y
53CONFIG_RTC_CLASS=y
54CONFIG_DMADEVICES=y
55CONFIG_AMBA_PL08X=y
56CONFIG_DMATEST=m
28CONFIG_EXT2_FS=y 57CONFIG_EXT2_FS=y
29CONFIG_EXT2_FS_XATTR=y 58CONFIG_EXT2_FS_XATTR=y
30CONFIG_EXT2_FS_SECURITY=y 59CONFIG_EXT2_FS_SECURITY=y
@@ -35,8 +64,6 @@ CONFIG_MSDOS_FS=m
35CONFIG_VFAT_FS=m 64CONFIG_VFAT_FS=m
36CONFIG_FAT_DEFAULT_IOCHARSET="ascii" 65CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
37CONFIG_TMPFS=y 66CONFIG_TMPFS=y
38CONFIG_PARTITION_ADVANCED=y
39CONFIG_NLS=y
40CONFIG_NLS_DEFAULT="utf8" 67CONFIG_NLS_DEFAULT="utf8"
41CONFIG_NLS_CODEPAGE_437=y 68CONFIG_NLS_CODEPAGE_437=y
42CONFIG_NLS_ASCII=m 69CONFIG_NLS_ASCII=m
@@ -44,6 +71,4 @@ CONFIG_MAGIC_SYSRQ=y
44CONFIG_DEBUG_FS=y 71CONFIG_DEBUG_FS=y
45CONFIG_DEBUG_KERNEL=y 72CONFIG_DEBUG_KERNEL=y
46CONFIG_DEBUG_SPINLOCK=y 73CONFIG_DEBUG_SPINLOCK=y
47CONFIG_DEBUG_SPINLOCK_SLEEP=y
48CONFIG_DEBUG_INFO=y 74CONFIG_DEBUG_INFO=y
49# CONFIG_CRC32 is not set
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 889d73ac1ae1..7e84f453e8a6 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -8,8 +8,6 @@ CONFIG_MODULE_UNLOAD=y
8# CONFIG_LBDAF is not set 8# CONFIG_LBDAF is not set
9# CONFIG_BLK_DEV_BSG is not set 9# CONFIG_BLK_DEV_BSG is not set
10CONFIG_ARCH_U8500=y 10CONFIG_ARCH_U8500=y
11CONFIG_UX500_SOC_DB5500=y
12CONFIG_UX500_SOC_DB8500=y
13CONFIG_MACH_HREFV60=y 11CONFIG_MACH_HREFV60=y
14CONFIG_MACH_SNOWBALL=y 12CONFIG_MACH_SNOWBALL=y
15CONFIG_MACH_U5500=y 13CONFIG_MACH_U5500=y
@@ -39,7 +37,6 @@ CONFIG_CAIF=y
39CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 37CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
40CONFIG_BLK_DEV_RAM=y 38CONFIG_BLK_DEV_RAM=y
41CONFIG_BLK_DEV_RAM_SIZE=65536 39CONFIG_BLK_DEV_RAM_SIZE=65536
42CONFIG_MISC_DEVICES=y
43CONFIG_AB8500_PWM=y 40CONFIG_AB8500_PWM=y
44CONFIG_SENSORS_BH1780=y 41CONFIG_SENSORS_BH1780=y
45CONFIG_NETDEVICES=y 42CONFIG_NETDEVICES=y
@@ -65,16 +62,18 @@ CONFIG_SERIAL_AMBA_PL011=y
65CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 62CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
66CONFIG_HW_RANDOM=y 63CONFIG_HW_RANDOM=y
67CONFIG_HW_RANDOM_NOMADIK=y 64CONFIG_HW_RANDOM_NOMADIK=y
68CONFIG_I2C=y
69CONFIG_I2C_NOMADIK=y
70CONFIG_SPI=y 65CONFIG_SPI=y
71CONFIG_SPI_PL022=y 66CONFIG_SPI_PL022=y
72CONFIG_GPIO_STMPE=y 67CONFIG_GPIO_STMPE=y
73CONFIG_GPIO_TC3589X=y 68CONFIG_GPIO_TC3589X=y
69CONFIG_POWER_SUPPLY=y
70CONFIG_AB8500_BM=y
71CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL=y
74CONFIG_MFD_STMPE=y 72CONFIG_MFD_STMPE=y
75CONFIG_MFD_TC3589X=y 73CONFIG_MFD_TC3589X=y
76CONFIG_AB5500_CORE=y 74CONFIG_AB5500_CORE=y
77CONFIG_AB8500_CORE=y 75CONFIG_AB8500_CORE=y
76CONFIG_REGULATOR=y
78CONFIG_REGULATOR_AB8500=y 77CONFIG_REGULATOR_AB8500=y
79# CONFIG_HID_SUPPORT is not set 78# CONFIG_HID_SUPPORT is not set
80CONFIG_USB_GADGET=y 79CONFIG_USB_GADGET=y
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index d9f0d770978e..99affb5d0563 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -1162,7 +1162,6 @@ void __init at91_add_device_serial(void)
1162 } 1162 }
1163} 1163}
1164#else 1164#else
1165void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1166void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} 1165void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1167void __init at91_add_device_serial(void) {} 1166void __init at91_add_device_serial(void) {}
1168#endif 1167#endif
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index dd7f782b0b91..104ca40d8d18 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -23,6 +23,7 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/clockchips.h> 25#include <linux/clockchips.h>
26#include <linux/export.h>
26 27
27#include <asm/mach/time.h> 28#include <asm/mach/time.h>
28 29
@@ -176,6 +177,7 @@ static struct clock_event_device clkevt = {
176}; 177};
177 178
178void __iomem *at91_st_base; 179void __iomem *at91_st_base;
180EXPORT_SYMBOL_GPL(at91_st_base);
179 181
180void __init at91rm9200_ioremap_st(u32 addr) 182void __init at91rm9200_ioremap_st(u32 addr)
181{ 183{
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 78ffc8315f97..2b15b8adec4c 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -103,7 +103,7 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = {
103}; 103};
104 104
105#define EK_FLASH_BASE AT91_CHIPSELECT_0 105#define EK_FLASH_BASE AT91_CHIPSELECT_0
106#define EK_FLASH_SIZE SZ_2M 106#define EK_FLASH_SIZE SZ_8M
107 107
108static struct physmap_flash_data ek_flash_data = { 108static struct physmap_flash_data ek_flash_data = {
109 .width = 2, 109 .width = 2,
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 065b5ee35070..2736453821b0 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -76,8 +76,6 @@ static struct resource dm9000_resource[] = {
76 .flags = IORESOURCE_MEM 76 .flags = IORESOURCE_MEM
77 }, 77 },
78 [2] = { 78 [2] = {
79 .start = AT91_PIN_PC11,
80 .end = AT91_PIN_PC11,
81 .flags = IORESOURCE_IRQ 79 .flags = IORESOURCE_IRQ
82 | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE, 80 | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE,
83 } 81 }
@@ -121,6 +119,8 @@ static struct sam9_smc_config __initdata dm9000_smc_config = {
121 119
122static void __init ek_add_device_dm9000(void) 120static void __init ek_add_device_dm9000(void)
123{ 121{
122 struct resource *r = &dm9000_resource[2];
123
124 /* Configure chip-select 2 (DM9000) */ 124 /* Configure chip-select 2 (DM9000) */
125 sam9_smc_configure(0, 2, &dm9000_smc_config); 125 sam9_smc_configure(0, 2, &dm9000_smc_config);
126 126
@@ -130,6 +130,7 @@ static void __init ek_add_device_dm9000(void)
130 /* Configure Interrupt pin as input, no pull-up */ 130 /* Configure Interrupt pin as input, no pull-up */
131 at91_set_gpio_input(AT91_PIN_PC11, 0); 131 at91_set_gpio_input(AT91_PIN_PC11, 0);
132 132
133 r->start = r->end = gpio_to_irq(AT91_PIN_PC11);
133 platform_device_register(&dm9000_device); 134 platform_device_register(&dm9000_device);
134} 135}
135#else 136#else
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index a0f4d7424cdc..6b692824c988 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -35,6 +35,7 @@
35#include "generic.h" 35#include "generic.h"
36 36
37void __iomem *at91_pmc_base; 37void __iomem *at91_pmc_base;
38EXPORT_SYMBOL_GPL(at91_pmc_base);
38 39
39/* 40/*
40 * There's a lot more which can be done with clocks, including cpufreq 41 * There's a lot more which can be done with clocks, including cpufreq
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
index 36604782a78f..ea2c57a86ca6 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -25,7 +25,7 @@ extern void __iomem *at91_pmc_base;
25#define at91_pmc_write(field, value) \ 25#define at91_pmc_write(field, value) \
26 __raw_writel(value, at91_pmc_base + field) 26 __raw_writel(value, at91_pmc_base + field)
27#else 27#else
28.extern at91_aic_base 28.extern at91_pmc_base
29#endif 29#endif
30 30
31#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ 31#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 97cc04dc8073..f44a2e7272e3 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -54,6 +54,7 @@ void __init at91_init_interrupts(unsigned int *priority)
54} 54}
55 55
56void __iomem *at91_ramc_base[2]; 56void __iomem *at91_ramc_base[2];
57EXPORT_SYMBOL_GPL(at91_ramc_base);
57 58
58void __init at91_ioremap_ramc(int id, u32 addr, u32 size) 59void __init at91_ioremap_ramc(int id, u32 addr, u32 size)
59{ 60{
@@ -292,6 +293,7 @@ void __init at91_ioremap_rstc(u32 base_addr)
292} 293}
293 294
294void __iomem *at91_matrix_base; 295void __iomem *at91_matrix_base;
296EXPORT_SYMBOL_GPL(at91_matrix_base);
295 297
296void __init at91_ioremap_matrix(u32 base_addr) 298void __init at91_ioremap_matrix(u32 base_addr)
297{ 299{
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 22e4e0a28ad1..adbfb1994582 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -52,8 +52,8 @@
52#include <mach/csp/chipcHw_inline.h> 52#include <mach/csp/chipcHw_inline.h>
53#include <mach/csp/tmrHw_reg.h> 53#include <mach/csp/tmrHw_reg.h>
54 54
55static AMBA_APB_DEVICE(uartA, "uarta", MM_ADDR_IO_UARTA, { IRQ_UARTA }, NULL); 55static AMBA_APB_DEVICE(uartA, "uartA", 0, MM_ADDR_IO_UARTA, {IRQ_UARTA}, NULL);
56static AMBA_APB_DEVICE(uartB, "uartb", MM_ADDR_IO_UARTB, { IRQ_UARTB }, NULL); 56static AMBA_APB_DEVICE(uartB, "uartB", 0, MM_ADDR_IO_UARTB, {IRQ_UARTB}, NULL);
57 57
58static struct clk pll1_clk = { 58static struct clk pll1_clk = {
59 .name = "PLL1", 59 .name = "PLL1",
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index 861ceb8232d6..ed38d03c61f2 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -35,7 +35,7 @@ static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
35static int __init imx27_avic_add_irq_domain(struct device_node *np, 35static int __init imx27_avic_add_irq_domain(struct device_node *np,
36 struct device_node *interrupt_parent) 36 struct device_node *interrupt_parent)
37{ 37{
38 irq_domain_add_simple(np, 0); 38 irq_domain_add_legacy(np, 64, 0, 0, &irq_domain_simple_ops, NULL);
39 return 0; 39 return 0;
40} 40}
41 41
@@ -44,7 +44,9 @@ static int __init imx27_gpio_add_irq_domain(struct device_node *np,
44{ 44{
45 static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; 45 static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
46 46
47 irq_domain_add_simple(np, gpio_irq_base); 47 gpio_irq_base -= 32;
48 irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops,
49 NULL);
48 50
49 return 0; 51 return 0;
50} 52}
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index 05250aed61fb..e10f3914fcfe 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -35,7 +35,7 @@ static void imx5_idle(void)
35 } 35 }
36 clk_enable(gpc_dvfs_clk); 36 clk_enable(gpc_dvfs_clk);
37 mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); 37 mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF);
38 if (tzic_enable_wake() != 0) 38 if (!tzic_enable_wake())
39 cpu_do_idle(); 39 cpu_do_idle();
40 clk_disable(gpc_dvfs_clk); 40 clk_disable(gpc_dvfs_clk);
41} 41}
diff --git a/arch/arm/mach-lpc32xx/Kconfig b/arch/arm/mach-lpc32xx/Kconfig
index 75946ac89ee9..e0b3eee83834 100644
--- a/arch/arm/mach-lpc32xx/Kconfig
+++ b/arch/arm/mach-lpc32xx/Kconfig
@@ -29,30 +29,4 @@ config ARCH_LPC32XX_UART6_SELECT
29 29
30endmenu 30endmenu
31 31
32menu "LPC32XX chip components"
33
34config ARCH_LPC32XX_IRAM_FOR_NET
35 bool "Use IRAM for network buffers"
36 default y
37 help
38 Say Y here to use the LPC internal fast IRAM (i.e. 256KB SRAM) as
39 network buffer. If the total combined required buffer sizes is
40 larger than the size of IRAM, then SDRAM will be used instead.
41
42 This can be enabled safely if the IRAM is not intended for other
43 uses.
44
45config ARCH_LPC32XX_MII_SUPPORT
46 bool "Check to enable MII support or leave disabled for RMII support"
47 help
48 Say Y here to enable MII support, or N for RMII support. Regardless of
49 which support is selected, the ethernet interface driver needs to be
50 selected in the device driver networking section.
51
52 The PHY3250 reference board uses RMII, so users of this board should
53 say N.
54
55endmenu
56
57endif 32endif
58
diff --git a/arch/arm/mach-lpc32xx/clock.c b/arch/arm/mach-lpc32xx/clock.c
index 2fc24ca12054..f6a3ffec1f4b 100644
--- a/arch/arm/mach-lpc32xx/clock.c
+++ b/arch/arm/mach-lpc32xx/clock.c
@@ -1095,49 +1095,42 @@ struct clk *clk_get_parent(struct clk *clk)
1095} 1095}
1096EXPORT_SYMBOL(clk_get_parent); 1096EXPORT_SYMBOL(clk_get_parent);
1097 1097
1098#define _REGISTER_CLOCK(d, n, c) \
1099 { \
1100 .dev_id = (d), \
1101 .con_id = (n), \
1102 .clk = &(c), \
1103 },
1104
1105static struct clk_lookup lookups[] = { 1098static struct clk_lookup lookups[] = {
1106 _REGISTER_CLOCK(NULL, "osc_32KHz", osc_32KHz) 1099 CLKDEV_INIT(NULL, "osc_32KHz", &osc_32KHz),
1107 _REGISTER_CLOCK(NULL, "osc_pll397", osc_pll397) 1100 CLKDEV_INIT(NULL, "osc_pll397", &osc_pll397),
1108 _REGISTER_CLOCK(NULL, "osc_main", osc_main) 1101 CLKDEV_INIT(NULL, "osc_main", &osc_main),
1109 _REGISTER_CLOCK(NULL, "sys_ck", clk_sys) 1102 CLKDEV_INIT(NULL, "sys_ck", &clk_sys),
1110 _REGISTER_CLOCK(NULL, "arm_pll_ck", clk_armpll) 1103 CLKDEV_INIT(NULL, "arm_pll_ck", &clk_armpll),
1111 _REGISTER_CLOCK(NULL, "ck_pll5", clk_usbpll) 1104 CLKDEV_INIT(NULL, "ck_pll5", &clk_usbpll),
1112 _REGISTER_CLOCK(NULL, "hclk_ck", clk_hclk) 1105 CLKDEV_INIT(NULL, "hclk_ck", &clk_hclk),
1113 _REGISTER_CLOCK(NULL, "pclk_ck", clk_pclk) 1106 CLKDEV_INIT(NULL, "pclk_ck", &clk_pclk),
1114 _REGISTER_CLOCK(NULL, "timer0_ck", clk_timer0) 1107 CLKDEV_INIT(NULL, "timer0_ck", &clk_timer0),
1115 _REGISTER_CLOCK(NULL, "timer1_ck", clk_timer1) 1108 CLKDEV_INIT(NULL, "timer1_ck", &clk_timer1),
1116 _REGISTER_CLOCK(NULL, "timer2_ck", clk_timer2) 1109 CLKDEV_INIT(NULL, "timer2_ck", &clk_timer2),
1117 _REGISTER_CLOCK(NULL, "timer3_ck", clk_timer3) 1110 CLKDEV_INIT(NULL, "timer3_ck", &clk_timer3),
1118 _REGISTER_CLOCK(NULL, "vfp9_ck", clk_vfp9) 1111 CLKDEV_INIT(NULL, "vfp9_ck", &clk_vfp9),
1119 _REGISTER_CLOCK(NULL, "clk_dmac", clk_dma) 1112 CLKDEV_INIT("pl08xdmac", NULL, &clk_dma),
1120 _REGISTER_CLOCK("pnx4008-watchdog", NULL, clk_wdt) 1113 CLKDEV_INIT("4003c000.watchdog", NULL, &clk_wdt),
1121 _REGISTER_CLOCK(NULL, "uart3_ck", clk_uart3) 1114 CLKDEV_INIT(NULL, "uart3_ck", &clk_uart3),
1122 _REGISTER_CLOCK(NULL, "uart4_ck", clk_uart4) 1115 CLKDEV_INIT(NULL, "uart4_ck", &clk_uart4),
1123 _REGISTER_CLOCK(NULL, "uart5_ck", clk_uart5) 1116 CLKDEV_INIT(NULL, "uart5_ck", &clk_uart5),
1124 _REGISTER_CLOCK(NULL, "uart6_ck", clk_uart6) 1117 CLKDEV_INIT(NULL, "uart6_ck", &clk_uart6),
1125 _REGISTER_CLOCK("pnx-i2c.0", NULL, clk_i2c0) 1118 CLKDEV_INIT("400a0000.i2c", NULL, &clk_i2c0),
1126 _REGISTER_CLOCK("pnx-i2c.1", NULL, clk_i2c1) 1119 CLKDEV_INIT("400a8000.i2c", NULL, &clk_i2c1),
1127 _REGISTER_CLOCK("pnx-i2c.2", NULL, clk_i2c2) 1120 CLKDEV_INIT("31020300.i2c", NULL, &clk_i2c2),
1128 _REGISTER_CLOCK("dev:ssp0", NULL, clk_ssp0) 1121 CLKDEV_INIT("dev:ssp0", NULL, &clk_ssp0),
1129 _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1) 1122 CLKDEV_INIT("dev:ssp1", NULL, &clk_ssp1),
1130 _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan) 1123 CLKDEV_INIT("lpc32xx_keys.0", NULL, &clk_kscan),
1131 _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand) 1124 CLKDEV_INIT("lpc32xx-nand.0", "nand_ck", &clk_nand),
1132 _REGISTER_CLOCK("lpc32xx-adc", NULL, clk_adc) 1125 CLKDEV_INIT("40048000.adc", NULL, &clk_adc),
1133 _REGISTER_CLOCK(NULL, "i2s0_ck", clk_i2s0) 1126 CLKDEV_INIT(NULL, "i2s0_ck", &clk_i2s0),
1134 _REGISTER_CLOCK(NULL, "i2s1_ck", clk_i2s1) 1127 CLKDEV_INIT(NULL, "i2s1_ck", &clk_i2s1),
1135 _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc) 1128 CLKDEV_INIT("40048000.tsc", NULL, &clk_tsc),
1136 _REGISTER_CLOCK("dev:mmc0", NULL, clk_mmc) 1129 CLKDEV_INIT("20098000.sd", NULL, &clk_mmc),
1137 _REGISTER_CLOCK("lpc-eth.0", NULL, clk_net) 1130 CLKDEV_INIT("31060000.ethernet", NULL, &clk_net),
1138 _REGISTER_CLOCK("dev:clcd", NULL, clk_lcd) 1131 CLKDEV_INIT("dev:clcd", NULL, &clk_lcd),
1139 _REGISTER_CLOCK("lpc32xx_udc", "ck_usbd", clk_usbd) 1132 CLKDEV_INIT("31020000.usbd", "ck_usbd", &clk_usbd),
1140 _REGISTER_CLOCK("lpc32xx_rtc", NULL, clk_rtc) 1133 CLKDEV_INIT("lpc32xx_rtc", NULL, &clk_rtc),
1141}; 1134};
1142 1135
1143static int __init clk_init(void) 1136static int __init clk_init(void)
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index bbbf063a74c2..5c96057b6d78 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -27,186 +27,11 @@
27 27
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29 29
30#include <mach/i2c.h>
31#include <mach/hardware.h> 30#include <mach/hardware.h>
32#include <mach/platform.h> 31#include <mach/platform.h>
33#include "common.h" 32#include "common.h"
34 33
35/* 34/*
36 * Watchdog timer
37 */
38static struct resource watchdog_resources[] = {
39 [0] = {
40 .start = LPC32XX_WDTIM_BASE,
41 .end = LPC32XX_WDTIM_BASE + SZ_4K - 1,
42 .flags = IORESOURCE_MEM,
43 },
44};
45
46struct platform_device lpc32xx_watchdog_device = {
47 .name = "pnx4008-watchdog",
48 .id = -1,
49 .num_resources = ARRAY_SIZE(watchdog_resources),
50 .resource = watchdog_resources,
51};
52
53/*
54 * I2C busses
55 */
56static struct i2c_pnx_data i2c0_data = {
57 .name = I2C_CHIP_NAME "1",
58 .base = LPC32XX_I2C1_BASE,
59 .irq = IRQ_LPC32XX_I2C_1,
60};
61
62static struct i2c_pnx_data i2c1_data = {
63 .name = I2C_CHIP_NAME "2",
64 .base = LPC32XX_I2C2_BASE,
65 .irq = IRQ_LPC32XX_I2C_2,
66};
67
68static struct i2c_pnx_data i2c2_data = {
69 .name = "USB-I2C",
70 .base = LPC32XX_OTG_I2C_BASE,
71 .irq = IRQ_LPC32XX_USB_I2C,
72};
73
74struct platform_device lpc32xx_i2c0_device = {
75 .name = "pnx-i2c",
76 .id = 0,
77 .dev = {
78 .platform_data = &i2c0_data,
79 },
80};
81
82struct platform_device lpc32xx_i2c1_device = {
83 .name = "pnx-i2c",
84 .id = 1,
85 .dev = {
86 .platform_data = &i2c1_data,
87 },
88};
89
90struct platform_device lpc32xx_i2c2_device = {
91 .name = "pnx-i2c",
92 .id = 2,
93 .dev = {
94 .platform_data = &i2c2_data,
95 },
96};
97
98/* TSC (Touch Screen Controller) */
99
100static struct resource lpc32xx_tsc_resources[] = {
101 {
102 .start = LPC32XX_ADC_BASE,
103 .end = LPC32XX_ADC_BASE + SZ_4K - 1,
104 .flags = IORESOURCE_MEM,
105 }, {
106 .start = IRQ_LPC32XX_TS_IRQ,
107 .end = IRQ_LPC32XX_TS_IRQ,
108 .flags = IORESOURCE_IRQ,
109 },
110};
111
112struct platform_device lpc32xx_tsc_device = {
113 .name = "ts-lpc32xx",
114 .id = -1,
115 .num_resources = ARRAY_SIZE(lpc32xx_tsc_resources),
116 .resource = lpc32xx_tsc_resources,
117};
118
119/* RTC */
120
121static struct resource lpc32xx_rtc_resources[] = {
122 {
123 .start = LPC32XX_RTC_BASE,
124 .end = LPC32XX_RTC_BASE + SZ_4K - 1,
125 .flags = IORESOURCE_MEM,
126 },{
127 .start = IRQ_LPC32XX_RTC,
128 .end = IRQ_LPC32XX_RTC,
129 .flags = IORESOURCE_IRQ,
130 },
131};
132
133struct platform_device lpc32xx_rtc_device = {
134 .name = "rtc-lpc32xx",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(lpc32xx_rtc_resources),
137 .resource = lpc32xx_rtc_resources,
138};
139
140/*
141 * ADC support
142 */
143static struct resource adc_resources[] = {
144 {
145 .start = LPC32XX_ADC_BASE,
146 .end = LPC32XX_ADC_BASE + SZ_4K - 1,
147 .flags = IORESOURCE_MEM,
148 }, {
149 .start = IRQ_LPC32XX_TS_IRQ,
150 .end = IRQ_LPC32XX_TS_IRQ,
151 .flags = IORESOURCE_IRQ,
152 },
153};
154
155struct platform_device lpc32xx_adc_device = {
156 .name = "lpc32xx-adc",
157 .id = -1,
158 .num_resources = ARRAY_SIZE(adc_resources),
159 .resource = adc_resources,
160};
161
162/*
163 * USB support
164 */
165/* The dmamask must be set for OHCI to work */
166static u64 ohci_dmamask = ~(u32) 0;
167static struct resource ohci_resources[] = {
168 {
169 .start = IO_ADDRESS(LPC32XX_USB_BASE),
170 .end = IO_ADDRESS(LPC32XX_USB_BASE + 0x100 - 1),
171 .flags = IORESOURCE_MEM,
172 }, {
173 .start = IRQ_LPC32XX_USB_HOST,
174 .flags = IORESOURCE_IRQ,
175 },
176};
177struct platform_device lpc32xx_ohci_device = {
178 .name = "usb-ohci",
179 .id = -1,
180 .dev = {
181 .dma_mask = &ohci_dmamask,
182 .coherent_dma_mask = 0xFFFFFFFF,
183 },
184 .num_resources = ARRAY_SIZE(ohci_resources),
185 .resource = ohci_resources,
186};
187
188/*
189 * Network Support
190 */
191static struct resource net_resources[] = {
192 [0] = DEFINE_RES_MEM(LPC32XX_ETHERNET_BASE, SZ_4K),
193 [1] = DEFINE_RES_MEM(LPC32XX_IRAM_BASE, SZ_128K),
194 [2] = DEFINE_RES_IRQ(IRQ_LPC32XX_ETHERNET),
195};
196
197static u64 lpc32xx_mac_dma_mask = 0xffffffffUL;
198struct platform_device lpc32xx_net_device = {
199 .name = "lpc-eth",
200 .id = 0,
201 .dev = {
202 .dma_mask = &lpc32xx_mac_dma_mask,
203 .coherent_dma_mask = 0xffffffffUL,
204 },
205 .num_resources = ARRAY_SIZE(net_resources),
206 .resource = net_resources,
207};
208
209/*
210 * Returns the unique ID for the device 35 * Returns the unique ID for the device
211 */ 36 */
212void lpc32xx_get_uid(u32 devid[4]) 37void lpc32xx_get_uid(u32 devid[4])
@@ -398,3 +223,16 @@ void lpc23xx_restart(char mode, const char *cmd)
398 while (1) 223 while (1)
399 ; 224 ;
400} 225}
226
227static int __init lpc32xx_display_uid(void)
228{
229 u32 uid[4];
230
231 lpc32xx_get_uid(uid);
232
233 printk(KERN_INFO "LPC32XX unique ID: %08x%08x%08x%08x\n",
234 uid[3], uid[2], uid[1], uid[0]);
235
236 return 1;
237}
238arch_initcall(lpc32xx_display_uid);
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h
index 68e45e8c9486..afeac3b1fae6 100644
--- a/arch/arm/mach-lpc32xx/common.h
+++ b/arch/arm/mach-lpc32xx/common.h
@@ -23,26 +23,12 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
25/* 25/*
26 * Arch specific platform device structures
27 */
28extern struct platform_device lpc32xx_watchdog_device;
29extern struct platform_device lpc32xx_i2c0_device;
30extern struct platform_device lpc32xx_i2c1_device;
31extern struct platform_device lpc32xx_i2c2_device;
32extern struct platform_device lpc32xx_tsc_device;
33extern struct platform_device lpc32xx_adc_device;
34extern struct platform_device lpc32xx_rtc_device;
35extern struct platform_device lpc32xx_ohci_device;
36extern struct platform_device lpc32xx_net_device;
37
38/*
39 * Other arch specific structures and functions 26 * Other arch specific structures and functions
40 */ 27 */
41extern struct sys_timer lpc32xx_timer; 28extern struct sys_timer lpc32xx_timer;
42extern void __init lpc32xx_init_irq(void); 29extern void __init lpc32xx_init_irq(void);
43extern void __init lpc32xx_map_io(void); 30extern void __init lpc32xx_map_io(void);
44extern void __init lpc32xx_serial_init(void); 31extern void __init lpc32xx_serial_init(void);
45extern void __init lpc32xx_gpio_init(void);
46extern void lpc23xx_restart(char, const char *); 32extern void lpc23xx_restart(char, const char *);
47 33
48 34
diff --git a/arch/arm/mach-lpc32xx/include/mach/i2c.h b/arch/arm/mach-lpc32xx/include/mach/i2c.h
deleted file mode 100644
index 034dc9286bcc..000000000000
--- a/arch/arm/mach-lpc32xx/include/mach/i2c.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * PNX4008-specific tweaks for I2C IP3204 block
3 *
4 * Author: Vitaly Wool <vwool@ru.mvista.com>
5 *
6 * 2005 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifndef __ASM_ARCH_I2C_H
13#define __ASM_ARCH_I2C_H
14
15enum {
16 mstatus_tdi = 0x00000001,
17 mstatus_afi = 0x00000002,
18 mstatus_nai = 0x00000004,
19 mstatus_drmi = 0x00000008,
20 mstatus_active = 0x00000020,
21 mstatus_scl = 0x00000040,
22 mstatus_sda = 0x00000080,
23 mstatus_rff = 0x00000100,
24 mstatus_rfe = 0x00000200,
25 mstatus_tff = 0x00000400,
26 mstatus_tfe = 0x00000800,
27};
28
29enum {
30 mcntrl_tdie = 0x00000001,
31 mcntrl_afie = 0x00000002,
32 mcntrl_naie = 0x00000004,
33 mcntrl_drmie = 0x00000008,
34 mcntrl_daie = 0x00000020,
35 mcntrl_rffie = 0x00000040,
36 mcntrl_tffie = 0x00000080,
37 mcntrl_reset = 0x00000100,
38 mcntrl_cdbmode = 0x00000400,
39};
40
41enum {
42 rw_bit = 1 << 0,
43 start_bit = 1 << 8,
44 stop_bit = 1 << 9,
45};
46
47#define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */
48#define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */
49#define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */
50#define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */
51#define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */
52#define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */
53#define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */
54#define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */
55#define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */
56#define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */
57#define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */
58#define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */
59#define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */
60
61#define I2C_CHIP_NAME "PNX4008-I2C"
62
63#endif /* __ASM_ARCH_I2C_H */
diff --git a/arch/arm/mach-lpc32xx/irq.c b/arch/arm/mach-lpc32xx/irq.c
index d080cb1123dd..5b1cc35e6fba 100644
--- a/arch/arm/mach-lpc32xx/irq.c
+++ b/arch/arm/mach-lpc32xx/irq.c
@@ -22,6 +22,11 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/of.h>
26#include <linux/of_address.h>
27#include <linux/of_irq.h>
28#include <linux/irqdomain.h>
29#include <linux/module.h>
25 30
26#include <mach/irqs.h> 31#include <mach/irqs.h>
27#include <mach/hardware.h> 32#include <mach/hardware.h>
@@ -44,6 +49,9 @@
44#define SIC1_ATR_DEFAULT 0x00026000 49#define SIC1_ATR_DEFAULT 0x00026000
45#define SIC2_ATR_DEFAULT 0x00000000 50#define SIC2_ATR_DEFAULT 0x00000000
46 51
52static struct irq_domain *lpc32xx_mic_domain;
53static struct device_node *lpc32xx_mic_np;
54
47struct lpc32xx_event_group_regs { 55struct lpc32xx_event_group_regs {
48 void __iomem *enab_reg; 56 void __iomem *enab_reg;
49 void __iomem *edge_reg; 57 void __iomem *edge_reg;
@@ -203,7 +211,7 @@ static void lpc32xx_mask_irq(struct irq_data *d)
203{ 211{
204 unsigned int reg, ctrl, mask; 212 unsigned int reg, ctrl, mask;
205 213
206 get_controller(d->irq, &ctrl, &mask); 214 get_controller(d->hwirq, &ctrl, &mask);
207 215
208 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) & ~mask; 216 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) & ~mask;
209 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl)); 217 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl));
@@ -213,7 +221,7 @@ static void lpc32xx_unmask_irq(struct irq_data *d)
213{ 221{
214 unsigned int reg, ctrl, mask; 222 unsigned int reg, ctrl, mask;
215 223
216 get_controller(d->irq, &ctrl, &mask); 224 get_controller(d->hwirq, &ctrl, &mask);
217 225
218 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) | mask; 226 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) | mask;
219 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl)); 227 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl));
@@ -223,14 +231,14 @@ static void lpc32xx_ack_irq(struct irq_data *d)
223{ 231{
224 unsigned int ctrl, mask; 232 unsigned int ctrl, mask;
225 233
226 get_controller(d->irq, &ctrl, &mask); 234 get_controller(d->hwirq, &ctrl, &mask);
227 235
228 __raw_writel(mask, LPC32XX_INTC_RAW_STAT(ctrl)); 236 __raw_writel(mask, LPC32XX_INTC_RAW_STAT(ctrl));
229 237
230 /* Also need to clear pending wake event */ 238 /* Also need to clear pending wake event */
231 if (lpc32xx_events[d->irq].mask != 0) 239 if (lpc32xx_events[d->hwirq].mask != 0)
232 __raw_writel(lpc32xx_events[d->irq].mask, 240 __raw_writel(lpc32xx_events[d->hwirq].mask,
233 lpc32xx_events[d->irq].event_group->rawstat_reg); 241 lpc32xx_events[d->hwirq].event_group->rawstat_reg);
234} 242}
235 243
236static void __lpc32xx_set_irq_type(unsigned int irq, int use_high_level, 244static void __lpc32xx_set_irq_type(unsigned int irq, int use_high_level,
@@ -274,22 +282,22 @@ static int lpc32xx_set_irq_type(struct irq_data *d, unsigned int type)
274 switch (type) { 282 switch (type) {
275 case IRQ_TYPE_EDGE_RISING: 283 case IRQ_TYPE_EDGE_RISING:
276 /* Rising edge sensitive */ 284 /* Rising edge sensitive */
277 __lpc32xx_set_irq_type(d->irq, 1, 1); 285 __lpc32xx_set_irq_type(d->hwirq, 1, 1);
278 break; 286 break;
279 287
280 case IRQ_TYPE_EDGE_FALLING: 288 case IRQ_TYPE_EDGE_FALLING:
281 /* Falling edge sensitive */ 289 /* Falling edge sensitive */
282 __lpc32xx_set_irq_type(d->irq, 0, 1); 290 __lpc32xx_set_irq_type(d->hwirq, 0, 1);
283 break; 291 break;
284 292
285 case IRQ_TYPE_LEVEL_LOW: 293 case IRQ_TYPE_LEVEL_LOW:
286 /* Low level sensitive */ 294 /* Low level sensitive */
287 __lpc32xx_set_irq_type(d->irq, 0, 0); 295 __lpc32xx_set_irq_type(d->hwirq, 0, 0);
288 break; 296 break;
289 297
290 case IRQ_TYPE_LEVEL_HIGH: 298 case IRQ_TYPE_LEVEL_HIGH:
291 /* High level sensitive */ 299 /* High level sensitive */
292 __lpc32xx_set_irq_type(d->irq, 1, 0); 300 __lpc32xx_set_irq_type(d->hwirq, 1, 0);
293 break; 301 break;
294 302
295 /* Other modes are not supported */ 303 /* Other modes are not supported */
@@ -298,7 +306,7 @@ static int lpc32xx_set_irq_type(struct irq_data *d, unsigned int type)
298 } 306 }
299 307
300 /* Ok to use the level handler for all types */ 308 /* Ok to use the level handler for all types */
301 irq_set_handler(d->irq, handle_level_irq); 309 irq_set_handler(d->hwirq, handle_level_irq);
302 310
303 return 0; 311 return 0;
304} 312}
@@ -307,33 +315,33 @@ static int lpc32xx_irq_wake(struct irq_data *d, unsigned int state)
307{ 315{
308 unsigned long eventreg; 316 unsigned long eventreg;
309 317
310 if (lpc32xx_events[d->irq].mask != 0) { 318 if (lpc32xx_events[d->hwirq].mask != 0) {
311 eventreg = __raw_readl(lpc32xx_events[d->irq]. 319 eventreg = __raw_readl(lpc32xx_events[d->hwirq].
312 event_group->enab_reg); 320 event_group->enab_reg);
313 321
314 if (state) 322 if (state)
315 eventreg |= lpc32xx_events[d->irq].mask; 323 eventreg |= lpc32xx_events[d->hwirq].mask;
316 else { 324 else {
317 eventreg &= ~lpc32xx_events[d->irq].mask; 325 eventreg &= ~lpc32xx_events[d->hwirq].mask;
318 326
319 /* 327 /*
320 * When disabling the wakeup, clear the latched 328 * When disabling the wakeup, clear the latched
321 * event 329 * event
322 */ 330 */
323 __raw_writel(lpc32xx_events[d->irq].mask, 331 __raw_writel(lpc32xx_events[d->hwirq].mask,
324 lpc32xx_events[d->irq]. 332 lpc32xx_events[d->hwirq].
325 event_group->rawstat_reg); 333 event_group->rawstat_reg);
326 } 334 }
327 335
328 __raw_writel(eventreg, 336 __raw_writel(eventreg,
329 lpc32xx_events[d->irq].event_group->enab_reg); 337 lpc32xx_events[d->hwirq].event_group->enab_reg);
330 338
331 return 0; 339 return 0;
332 } 340 }
333 341
334 /* Clear event */ 342 /* Clear event */
335 __raw_writel(lpc32xx_events[d->irq].mask, 343 __raw_writel(lpc32xx_events[d->hwirq].mask,
336 lpc32xx_events[d->irq].event_group->rawstat_reg); 344 lpc32xx_events[d->hwirq].event_group->rawstat_reg);
337 345
338 return -ENODEV; 346 return -ENODEV;
339} 347}
@@ -353,6 +361,7 @@ static void __init lpc32xx_set_default_mappings(unsigned int apr,
353} 361}
354 362
355static struct irq_chip lpc32xx_irq_chip = { 363static struct irq_chip lpc32xx_irq_chip = {
364 .name = "MIC",
356 .irq_ack = lpc32xx_ack_irq, 365 .irq_ack = lpc32xx_ack_irq,
357 .irq_mask = lpc32xx_mask_irq, 366 .irq_mask = lpc32xx_mask_irq,
358 .irq_unmask = lpc32xx_unmask_irq, 367 .irq_unmask = lpc32xx_unmask_irq,
@@ -386,9 +395,23 @@ static void lpc32xx_sic2_handler(unsigned int irq, struct irq_desc *desc)
386 } 395 }
387} 396}
388 397
398static int __init __lpc32xx_mic_of_init(struct device_node *node,
399 struct device_node *parent)
400{
401 lpc32xx_mic_np = node;
402
403 return 0;
404}
405
406static const struct of_device_id mic_of_match[] __initconst = {
407 { .compatible = "nxp,lpc3220-mic", .data = __lpc32xx_mic_of_init },
408 { }
409};
410
389void __init lpc32xx_init_irq(void) 411void __init lpc32xx_init_irq(void)
390{ 412{
391 unsigned int i; 413 unsigned int i;
414 int irq_base;
392 415
393 /* Setup MIC */ 416 /* Setup MIC */
394 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_MIC_BASE)); 417 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_MIC_BASE));
@@ -448,4 +471,19 @@ void __init lpc32xx_init_irq(void)
448 LPC32XX_CLKPWR_PIN_RS); 471 LPC32XX_CLKPWR_PIN_RS);
449 __raw_writel(__raw_readl(LPC32XX_CLKPWR_INT_RS), 472 __raw_writel(__raw_readl(LPC32XX_CLKPWR_INT_RS),
450 LPC32XX_CLKPWR_INT_RS); 473 LPC32XX_CLKPWR_INT_RS);
474
475 of_irq_init(mic_of_match);
476
477 irq_base = irq_alloc_descs(-1, 0, NR_IRQS, 0);
478 if (irq_base < 0) {
479 pr_warn("Cannot allocate irq_descs, assuming pre-allocated\n");
480 irq_base = 0;
481 }
482
483 lpc32xx_mic_domain = irq_domain_add_legacy(lpc32xx_mic_np, NR_IRQS,
484 irq_base, 0,
485 &irq_domain_simple_ops,
486 NULL);
487 if (!lpc32xx_mic_domain)
488 panic("Unable to add MIC irq domain\n");
451} 489}
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 7f7401ec7487..540106cdb9ec 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -1,8 +1,9 @@
1/* 1/*
2 * arch/arm/mach-lpc32xx/phy3250.c 2 * Platform support for LPC32xx SoC
3 * 3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com> 4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 * 5 *
6 * Copyright (C) 2012 Roland Stigge <stigge@antcom.de>
6 * Copyright (C) 2010 NXP Semiconductors 7 * Copyright (C) 2010 NXP Semiconductors
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -25,11 +26,16 @@
25#include <linux/device.h> 26#include <linux/device.h>
26#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
27#include <linux/spi/eeprom.h> 28#include <linux/spi/eeprom.h>
28#include <linux/leds.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30#include <linux/amba/bus.h> 30#include <linux/amba/bus.h>
31#include <linux/amba/clcd.h> 31#include <linux/amba/clcd.h>
32#include <linux/amba/pl022.h> 32#include <linux/amba/pl022.h>
33#include <linux/of.h>
34#include <linux/of_address.h>
35#include <linux/of_irq.h>
36#include <linux/of_platform.h>
37#include <linux/clk.h>
38#include <linux/amba/pl08x.h>
33 39
34#include <asm/setup.h> 40#include <asm/setup.h>
35#include <asm/mach-types.h> 41#include <asm/mach-types.h>
@@ -47,7 +53,6 @@
47#define SPI0_CS_GPIO LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5) 53#define SPI0_CS_GPIO LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
48#define LCD_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 0) 54#define LCD_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 0)
49#define BKL_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 4) 55#define BKL_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 4)
50#define LED_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 1)
51 56
52/* 57/*
53 * AMBA LCD controller 58 * AMBA LCD controller
@@ -150,9 +155,6 @@ static struct clcd_board lpc32xx_clcd_data = {
150 .remove = lpc32xx_clcd_remove, 155 .remove = lpc32xx_clcd_remove,
151}; 156};
152 157
153static AMBA_AHB_DEVICE(lpc32xx_clcd, "dev:clcd", 0,
154 LPC32XX_LCD_BASE, { IRQ_LPC32XX_LCD }, &lpc32xx_clcd_data);
155
156/* 158/*
157 * AMBA SSP (SPI) 159 * AMBA SSP (SPI)
158 */ 160 */
@@ -180,8 +182,11 @@ static struct pl022_ssp_controller lpc32xx_ssp0_data = {
180 .enable_dma = 0, 182 .enable_dma = 0,
181}; 183};
182 184
183static AMBA_APB_DEVICE(lpc32xx_ssp0, "dev:ssp0", 0, 185static struct pl022_ssp_controller lpc32xx_ssp1_data = {
184 LPC32XX_SSP0_BASE, { IRQ_LPC32XX_SSP0 }, &lpc32xx_ssp0_data); 186 .bus_id = 1,
187 .num_chipselect = 1,
188 .enable_dma = 0,
189};
185 190
186/* AT25 driver registration */ 191/* AT25 driver registration */
187static int __init phy3250_spi_board_register(void) 192static int __init phy3250_spi_board_register(void)
@@ -221,73 +226,20 @@ static int __init phy3250_spi_board_register(void)
221} 226}
222arch_initcall(phy3250_spi_board_register); 227arch_initcall(phy3250_spi_board_register);
223 228
224static struct i2c_board_info __initdata phy3250_i2c_board_info[] = { 229static struct pl08x_platform_data pl08x_pd = {
225 {
226 I2C_BOARD_INFO("pcf8563", 0x51),
227 },
228};
229
230static struct gpio_led phy_leds[] = {
231 {
232 .name = "led0",
233 .gpio = LED_GPIO,
234 .active_low = 1,
235 .default_trigger = "heartbeat",
236 },
237};
238
239static struct gpio_led_platform_data led_data = {
240 .leds = phy_leds,
241 .num_leds = ARRAY_SIZE(phy_leds),
242};
243
244static struct platform_device lpc32xx_gpio_led_device = {
245 .name = "leds-gpio",
246 .id = -1,
247 .dev.platform_data = &led_data,
248}; 230};
249 231
250static struct platform_device *phy3250_devs[] __initdata = { 232static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
251 &lpc32xx_rtc_device, 233 OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", &lpc32xx_ssp0_data),
252 &lpc32xx_tsc_device, 234 OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", &lpc32xx_ssp1_data),
253 &lpc32xx_i2c0_device, 235 OF_DEV_AUXDATA("arm,pl110", 0x31040000, "dev:clcd", &lpc32xx_clcd_data),
254 &lpc32xx_i2c1_device, 236 OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd),
255 &lpc32xx_i2c2_device, 237 { }
256 &lpc32xx_watchdog_device,
257 &lpc32xx_gpio_led_device,
258 &lpc32xx_adc_device,
259 &lpc32xx_ohci_device,
260 &lpc32xx_net_device,
261}; 238};
262 239
263static struct amba_device *amba_devs[] __initdata = { 240static void __init lpc3250_machine_init(void)
264 &lpc32xx_clcd_device,
265 &lpc32xx_ssp0_device,
266};
267
268/*
269 * Board specific functions
270 */
271static void __init phy3250_board_init(void)
272{ 241{
273 u32 tmp; 242 u32 tmp;
274 int i;
275
276 lpc32xx_gpio_init();
277
278 /* Register GPIOs used on this board */
279 if (gpio_request(SPI0_CS_GPIO, "spi0 cs"))
280 printk(KERN_ERR "Error requesting gpio %u",
281 SPI0_CS_GPIO);
282 else if (gpio_direction_output(SPI0_CS_GPIO, 1))
283 printk(KERN_ERR "Error setting gpio %u to output",
284 SPI0_CS_GPIO);
285
286 /* Setup network interface for RMII mode */
287 tmp = __raw_readl(LPC32XX_CLKPWR_MACCLK_CTRL);
288 tmp &= ~LPC32XX_CLKPWR_MACCTRL_PINS_MSK;
289 tmp |= LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS;
290 __raw_writel(tmp, LPC32XX_CLKPWR_MACCLK_CTRL);
291 243
292 /* Setup SLC NAND controller muxing */ 244 /* Setup SLC NAND controller muxing */
293 __raw_writel(LPC32XX_CLKPWR_NANDCLK_SEL_SLC, 245 __raw_writel(LPC32XX_CLKPWR_NANDCLK_SEL_SLC,
@@ -300,6 +252,12 @@ static void __init phy3250_board_init(void)
300 tmp |= LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT16; 252 tmp |= LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT16;
301 __raw_writel(tmp, LPC32XX_CLKPWR_LCDCLK_CTRL); 253 __raw_writel(tmp, LPC32XX_CLKPWR_LCDCLK_CTRL);
302 254
255 /* Set up USB power */
256 tmp = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
257 tmp |= LPC32XX_CLKPWR_USBCTRL_HCLK_EN |
258 LPC32XX_CLKPWR_USBCTRL_USBI2C_EN;
259 __raw_writel(tmp, LPC32XX_CLKPWR_USB_CTRL);
260
303 /* Set up I2C pull levels */ 261 /* Set up I2C pull levels */
304 tmp = __raw_readl(LPC32XX_CLKPWR_I2C_CLK_CTRL); 262 tmp = __raw_readl(LPC32XX_CLKPWR_I2C_CLK_CTRL);
305 tmp |= LPC32XX_CLKPWR_I2CCLK_USBI2CHI_DRIVE | 263 tmp |= LPC32XX_CLKPWR_I2CCLK_USBI2CHI_DRIVE |
@@ -321,54 +279,51 @@ static void __init phy3250_board_init(void)
321 /* 279 /*
322 * AMBA peripheral clocks need to be enabled prior to AMBA device 280 * AMBA peripheral clocks need to be enabled prior to AMBA device
323 * detection or a data fault will occur, so enable the clocks 281 * detection or a data fault will occur, so enable the clocks
324 * here. However, we don't want to enable them if the peripheral 282 * here.
325 * isn't included in the image
326 */ 283 */
327#ifdef CONFIG_FB_ARMCLCD
328 tmp = __raw_readl(LPC32XX_CLKPWR_LCDCLK_CTRL); 284 tmp = __raw_readl(LPC32XX_CLKPWR_LCDCLK_CTRL);
329 __raw_writel((tmp | LPC32XX_CLKPWR_LCDCTRL_CLK_EN), 285 __raw_writel((tmp | LPC32XX_CLKPWR_LCDCTRL_CLK_EN),
330 LPC32XX_CLKPWR_LCDCLK_CTRL); 286 LPC32XX_CLKPWR_LCDCLK_CTRL);
331#endif 287
332#ifdef CONFIG_SPI_PL022
333 tmp = __raw_readl(LPC32XX_CLKPWR_SSP_CLK_CTRL); 288 tmp = __raw_readl(LPC32XX_CLKPWR_SSP_CLK_CTRL);
334 __raw_writel((tmp | LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN), 289 __raw_writel((tmp | LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN),
335 LPC32XX_CLKPWR_SSP_CLK_CTRL); 290 LPC32XX_CLKPWR_SSP_CLK_CTRL);
336#endif
337 291
338 platform_add_devices(phy3250_devs, ARRAY_SIZE(phy3250_devs)); 292 tmp = __raw_readl(LPC32XX_CLKPWR_DMA_CLK_CTRL);
339 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 293 __raw_writel((tmp | LPC32XX_CLKPWR_DMACLKCTRL_CLK_EN),
340 struct amba_device *d = amba_devs[i]; 294 LPC32XX_CLKPWR_DMA_CLK_CTRL);
341 amba_device_register(d, &iomem_resource);
342 }
343 295
344 /* Test clock needed for UDA1380 initial init */ 296 /* Test clock needed for UDA1380 initial init */
345 __raw_writel(LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC | 297 __raw_writel(LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC |
346 LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN, 298 LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN,
347 LPC32XX_CLKPWR_TEST_CLK_SEL); 299 LPC32XX_CLKPWR_TEST_CLK_SEL);
348 300
349 i2c_register_board_info(0, phy3250_i2c_board_info, 301 of_platform_populate(NULL, of_default_bus_match_table,
350 ARRAY_SIZE(phy3250_i2c_board_info)); 302 lpc32xx_auxdata_lookup, NULL);
351}
352
353static int __init lpc32xx_display_uid(void)
354{
355 u32 uid[4];
356
357 lpc32xx_get_uid(uid);
358
359 printk(KERN_INFO "LPC32XX unique ID: %08x%08x%08x%08x\n",
360 uid[3], uid[2], uid[1], uid[0]);
361 303
362 return 1; 304 /* Register GPIOs used on this board */
305 if (gpio_request(SPI0_CS_GPIO, "spi0 cs"))
306 printk(KERN_ERR "Error requesting gpio %u",
307 SPI0_CS_GPIO);
308 else if (gpio_direction_output(SPI0_CS_GPIO, 1))
309 printk(KERN_ERR "Error setting gpio %u to output",
310 SPI0_CS_GPIO);
363} 311}
364arch_initcall(lpc32xx_display_uid);
365 312
366MACHINE_START(PHY3250, "Phytec 3250 board with the LPC3250 Microcontroller") 313static char const *lpc32xx_dt_compat[] __initdata = {
367 /* Maintainer: Kevin Wells, NXP Semiconductors */ 314 "nxp,lpc3220",
315 "nxp,lpc3230",
316 "nxp,lpc3240",
317 "nxp,lpc3250",
318 NULL
319};
320
321DT_MACHINE_START(LPC32XX_DT, "LPC32XX SoC (Flattened Device Tree)")
368 .atag_offset = 0x100, 322 .atag_offset = 0x100,
369 .map_io = lpc32xx_map_io, 323 .map_io = lpc32xx_map_io,
370 .init_irq = lpc32xx_init_irq, 324 .init_irq = lpc32xx_init_irq,
371 .timer = &lpc32xx_timer, 325 .timer = &lpc32xx_timer,
372 .init_machine = phy3250_board_init, 326 .init_machine = lpc3250_machine_init,
327 .dt_compat = lpc32xx_dt_compat,
373 .restart = lpc23xx_restart, 328 .restart = lpc23xx_restart,
374MACHINE_END 329MACHINE_END
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c
index 087dba0df47e..e9cc52d4cb28 100644
--- a/arch/arm/mach-omap1/mux.c
+++ b/arch/arm/mach-omap1/mux.c
@@ -27,6 +27,7 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29 29
30#include <mach/hardware.h>
30 31
31#include <plat/mux.h> 32#include <plat/mux.h>
32 33
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
index 6e90665a7c47..fb202af01d0d 100644
--- a/arch/arm/mach-omap1/timer.c
+++ b/arch/arm/mach-omap1/timer.c
@@ -47,9 +47,9 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev,
47 int n = (pdev->id - 1) << 1; 47 int n = (pdev->id - 1) << 1;
48 u32 l; 48 u32 l;
49 49
50 l = __raw_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); 50 l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
51 l |= source << n; 51 l |= source << n;
52 __raw_writel(l, MOD_CONF_CTRL_1); 52 omap_writel(l, MOD_CONF_CTRL_1);
53 53
54 return 0; 54 return 0;
55} 55}
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index a39fc4bbd2b8..130ab00c09a2 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -20,6 +20,7 @@
20#include <linux/usb/otg.h> 20#include <linux/usb/otg.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22#include <linux/i2c/twl.h> 22#include <linux/i2c/twl.h>
23#include <linux/mfd/twl6040.h>
23#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
24#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
25#include <linux/regulator/fixed.h> 26#include <linux/regulator/fixed.h>
@@ -560,7 +561,7 @@ static struct regulator_init_data sdp4430_vusim = {
560 }, 561 },
561}; 562};
562 563
563static struct twl4030_codec_data twl6040_codec = { 564static struct twl6040_codec_data twl6040_codec = {
564 /* single-step ramp for headset and handsfree */ 565 /* single-step ramp for headset and handsfree */
565 .hs_left_step = 0x0f, 566 .hs_left_step = 0x0f,
566 .hs_right_step = 0x0f, 567 .hs_right_step = 0x0f,
@@ -568,7 +569,7 @@ static struct twl4030_codec_data twl6040_codec = {
568 .hf_right_step = 0x1d, 569 .hf_right_step = 0x1d,
569}; 570};
570 571
571static struct twl4030_vibra_data twl6040_vibra = { 572static struct twl6040_vibra_data twl6040_vibra = {
572 .vibldrv_res = 8, 573 .vibldrv_res = 8,
573 .vibrdrv_res = 3, 574 .vibrdrv_res = 3,
574 .viblmotor_res = 10, 575 .viblmotor_res = 10,
@@ -577,16 +578,14 @@ static struct twl4030_vibra_data twl6040_vibra = {
577 .vddvibr_uV = 0, /* fixed volt supply - VBAT */ 578 .vddvibr_uV = 0, /* fixed volt supply - VBAT */
578}; 579};
579 580
580static struct twl4030_audio_data twl6040_audio = { 581static struct twl6040_platform_data twl6040_data = {
581 .codec = &twl6040_codec, 582 .codec = &twl6040_codec,
582 .vibra = &twl6040_vibra, 583 .vibra = &twl6040_vibra,
583 .audpwron_gpio = 127, 584 .audpwron_gpio = 127,
584 .naudint_irq = OMAP44XX_IRQ_SYS_2N,
585 .irq_base = TWL6040_CODEC_IRQ_BASE, 585 .irq_base = TWL6040_CODEC_IRQ_BASE,
586}; 586};
587 587
588static struct twl4030_platform_data sdp4430_twldata = { 588static struct twl4030_platform_data sdp4430_twldata = {
589 .audio = &twl6040_audio,
590 /* Regulators */ 589 /* Regulators */
591 .vusim = &sdp4430_vusim, 590 .vusim = &sdp4430_vusim,
592 .vaux1 = &sdp4430_vaux1, 591 .vaux1 = &sdp4430_vaux1,
@@ -617,7 +616,8 @@ static int __init omap4_i2c_init(void)
617 TWL_COMMON_REGULATOR_VCXIO | 616 TWL_COMMON_REGULATOR_VCXIO |
618 TWL_COMMON_REGULATOR_VUSB | 617 TWL_COMMON_REGULATOR_VUSB |
619 TWL_COMMON_REGULATOR_CLK32KG); 618 TWL_COMMON_REGULATOR_CLK32KG);
620 omap4_pmic_init("twl6030", &sdp4430_twldata); 619 omap4_pmic_init("twl6030", &sdp4430_twldata,
620 &twl6040_data, OMAP44XX_IRQ_SYS_2N);
621 omap_register_i2c_bus(2, 400, NULL, 0); 621 omap_register_i2c_bus(2, 400, NULL, 0);
622 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, 622 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
623 ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); 623 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 74e1687b5170..7302ba7ff1b9 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -15,7 +15,6 @@
15#include <linux/of_irq.h> 15#include <linux/of_irq.h>
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17#include <linux/irqdomain.h> 17#include <linux/irqdomain.h>
18#include <linux/i2c/twl.h>
19 18
20#include <mach/hardware.h> 19#include <mach/hardware.h>
21#include <asm/hardware/gic.h> 20#include <asm/hardware/gic.h>
@@ -95,22 +94,6 @@ MACHINE_END
95#endif 94#endif
96 95
97#ifdef CONFIG_ARCH_OMAP3 96#ifdef CONFIG_ARCH_OMAP3
98static struct twl4030_platform_data beagle_twldata = {
99 .irq_base = TWL4030_IRQ_BASE,
100 .irq_end = TWL4030_IRQ_END,
101};
102
103static void __init omap3_i2c_init(void)
104{
105 omap3_pmic_init("twl4030", &beagle_twldata);
106}
107
108static void __init omap3_init(void)
109{
110 omap3_i2c_init();
111 omap_generic_init();
112}
113
114static const char *omap3_boards_compat[] __initdata = { 97static const char *omap3_boards_compat[] __initdata = {
115 "ti,omap3", 98 "ti,omap3",
116 NULL, 99 NULL,
@@ -122,7 +105,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
122 .init_early = omap3430_init_early, 105 .init_early = omap3430_init_early,
123 .init_irq = omap_init_irq, 106 .init_irq = omap_init_irq,
124 .handle_irq = omap3_intc_handle_irq, 107 .handle_irq = omap3_intc_handle_irq,
125 .init_machine = omap3_init, 108 .init_machine = omap_generic_init,
126 .timer = &omap3_timer, 109 .timer = &omap3_timer,
127 .dt_compat = omap3_boards_compat, 110 .dt_compat = omap3_boards_compat,
128 .restart = omap_prcm_restart, 111 .restart = omap_prcm_restart,
@@ -130,22 +113,6 @@ MACHINE_END
130#endif 113#endif
131 114
132#ifdef CONFIG_ARCH_OMAP4 115#ifdef CONFIG_ARCH_OMAP4
133static struct twl4030_platform_data sdp4430_twldata = {
134 .irq_base = TWL6030_IRQ_BASE,
135 .irq_end = TWL6030_IRQ_END,
136};
137
138static void __init omap4_i2c_init(void)
139{
140 omap4_pmic_init("twl6030", &sdp4430_twldata);
141}
142
143static void __init omap4_init(void)
144{
145 omap4_i2c_init();
146 omap_generic_init();
147}
148
149static const char *omap4_boards_compat[] __initdata = { 116static const char *omap4_boards_compat[] __initdata = {
150 "ti,omap4", 117 "ti,omap4",
151 NULL, 118 NULL,
@@ -157,7 +124,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
157 .init_early = omap4430_init_early, 124 .init_early = omap4430_init_early,
158 .init_irq = omap_init_irq, 125 .init_irq = omap_init_irq,
159 .handle_irq = gic_handle_irq, 126 .handle_irq = gic_handle_irq,
160 .init_machine = omap4_init, 127 .init_machine = omap_generic_init,
161 .timer = &omap4_timer, 128 .timer = &omap4_timer,
162 .dt_compat = omap4_boards_compat, 129 .dt_compat = omap4_boards_compat,
163 .restart = omap_prcm_restart, 130 .restart = omap_prcm_restart,
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index d8c0e89f0126..1b782ba53433 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -25,6 +25,7 @@
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/usb/otg.h> 26#include <linux/usb/otg.h>
27#include <linux/i2c/twl.h> 27#include <linux/i2c/twl.h>
28#include <linux/mfd/twl6040.h>
28#include <linux/regulator/machine.h> 29#include <linux/regulator/machine.h>
29#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
30#include <linux/wl12xx.h> 31#include <linux/wl12xx.h>
@@ -284,7 +285,7 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
284 return 0; 285 return 0;
285} 286}
286 287
287static struct twl4030_codec_data twl6040_codec = { 288static struct twl6040_codec_data twl6040_codec = {
288 /* single-step ramp for headset and handsfree */ 289 /* single-step ramp for headset and handsfree */
289 .hs_left_step = 0x0f, 290 .hs_left_step = 0x0f,
290 .hs_right_step = 0x0f, 291 .hs_right_step = 0x0f,
@@ -292,17 +293,14 @@ static struct twl4030_codec_data twl6040_codec = {
292 .hf_right_step = 0x1d, 293 .hf_right_step = 0x1d,
293}; 294};
294 295
295static struct twl4030_audio_data twl6040_audio = { 296static struct twl6040_platform_data twl6040_data = {
296 .codec = &twl6040_codec, 297 .codec = &twl6040_codec,
297 .audpwron_gpio = 127, 298 .audpwron_gpio = 127,
298 .naudint_irq = OMAP44XX_IRQ_SYS_2N,
299 .irq_base = TWL6040_CODEC_IRQ_BASE, 299 .irq_base = TWL6040_CODEC_IRQ_BASE,
300}; 300};
301 301
302/* Panda board uses the common PMIC configuration */ 302/* Panda board uses the common PMIC configuration */
303static struct twl4030_platform_data omap4_panda_twldata = { 303static struct twl4030_platform_data omap4_panda_twldata;
304 .audio = &twl6040_audio,
305};
306 304
307/* 305/*
308 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM 306 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
@@ -326,7 +324,8 @@ static int __init omap4_panda_i2c_init(void)
326 TWL_COMMON_REGULATOR_VCXIO | 324 TWL_COMMON_REGULATOR_VCXIO |
327 TWL_COMMON_REGULATOR_VUSB | 325 TWL_COMMON_REGULATOR_VUSB |
328 TWL_COMMON_REGULATOR_CLK32KG); 326 TWL_COMMON_REGULATOR_CLK32KG);
329 omap4_pmic_init("twl6030", &omap4_panda_twldata); 327 omap4_pmic_init("twl6030", &omap4_panda_twldata,
328 &twl6040_data, OMAP44XX_IRQ_SYS_2N);
330 omap_register_i2c_bus(2, 400, NULL, 0); 329 omap_register_i2c_bus(2, 400, NULL, 0);
331 /* 330 /*
332 * Bus 3 is attached to the DVI port where devices like the pico DLP 331 * Bus 3 is attached to the DVI port where devices like the pico DLP
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index e4336035c0ea..98cab3a204b9 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -705,7 +705,9 @@ static int __init omap2_init_devices(void)
705 omap_init_dmic(); 705 omap_init_dmic();
706 omap_init_camera(); 706 omap_init_camera();
707 omap_init_mbox(); 707 omap_init_mbox();
708 omap_init_mcspi(); 708 /* If dtb is there, the devices will be created dynamically */
709 if (!of_have_populated_dt())
710 omap_init_mcspi();
709 omap_init_pmu(); 711 omap_init_pmu();
710 omap_hdq_init(); 712 omap_hdq_init();
711 omap_init_sti(); 713 omap_init_sti();
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 2f994e5194e8..18f9c7bd7200 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -20,6 +20,7 @@
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/of.h>
23 24
24#include <plat/omap_hwmod.h> 25#include <plat/omap_hwmod.h>
25#include <plat/omap_device.h> 26#include <plat/omap_device.h>
@@ -146,7 +147,10 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
146 */ 147 */
147static int __init omap2_gpio_init(void) 148static int __init omap2_gpio_init(void)
148{ 149{
149 return omap_hwmod_for_each_by_class("gpio", omap2_gpio_dev_init, 150 /* If dtb is there, the devices will be created dynamically */
150 NULL); 151 if (of_have_populated_dt())
152 return -ENODEV;
153
154 return omap_hwmod_for_each_by_class("gpio", omap2_gpio_dev_init, NULL);
151} 155}
152postcore_initcall(omap2_gpio_init); 156postcore_initcall(omap2_gpio_init);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 2c27fdb61e66..7144ae651d3d 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1422,6 +1422,9 @@ static int _ocp_softreset(struct omap_hwmod *oh)
1422 goto dis_opt_clks; 1422 goto dis_opt_clks;
1423 _write_sysconfig(v, oh); 1423 _write_sysconfig(v, oh);
1424 1424
1425 if (oh->class->sysc->srst_udelay)
1426 udelay(oh->class->sysc->srst_udelay);
1427
1425 if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS) 1428 if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
1426 omap_test_timeout((omap_hwmod_read(oh, 1429 omap_test_timeout((omap_hwmod_read(oh,
1427 oh->class->sysc->syss_offs) 1430 oh->class->sysc->syss_offs)
@@ -1903,10 +1906,20 @@ void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs)
1903 */ 1906 */
1904int omap_hwmod_softreset(struct omap_hwmod *oh) 1907int omap_hwmod_softreset(struct omap_hwmod *oh)
1905{ 1908{
1906 if (!oh) 1909 u32 v;
1910 int ret;
1911
1912 if (!oh || !(oh->_sysc_cache))
1907 return -EINVAL; 1913 return -EINVAL;
1908 1914
1909 return _ocp_softreset(oh); 1915 v = oh->_sysc_cache;
1916 ret = _set_softreset(oh, &v);
1917 if (ret)
1918 goto error;
1919 _write_sysconfig(v, oh);
1920
1921error:
1922 return ret;
1910} 1923}
1911 1924
1912/** 1925/**
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index a5409ce3f323..a6bde34e443a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -1000,7 +1000,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__dss_venc = {
1000 .flags = OMAP_FIREWALL_L4, 1000 .flags = OMAP_FIREWALL_L4,
1001 } 1001 }
1002 }, 1002 },
1003 .flags = OCPIF_SWSUP_IDLE,
1004 .user = OCP_USER_MPU | OCP_USER_SDMA, 1003 .user = OCP_USER_MPU | OCP_USER_SDMA,
1005}; 1004};
1006 1005
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index c4f56cb60d7d..04a3885f4475 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -1049,7 +1049,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__dss_venc = {
1049 .slave = &omap2430_dss_venc_hwmod, 1049 .slave = &omap2430_dss_venc_hwmod,
1050 .clk = "dss_ick", 1050 .clk = "dss_ick",
1051 .addr = omap2_dss_venc_addrs, 1051 .addr = omap2_dss_venc_addrs,
1052 .flags = OCPIF_SWSUP_IDLE,
1053 .user = OCP_USER_MPU | OCP_USER_SDMA, 1052 .user = OCP_USER_MPU | OCP_USER_SDMA,
1054}; 1053};
1055 1054
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 34b9766d1d23..db86ce90c69f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -1676,7 +1676,6 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_venc = {
1676 .flags = OMAP_FIREWALL_L4, 1676 .flags = OMAP_FIREWALL_L4,
1677 } 1677 }
1678 }, 1678 },
1679 .flags = OCPIF_SWSUP_IDLE,
1680 .user = OCP_USER_MPU | OCP_USER_SDMA, 1679 .user = OCP_USER_MPU | OCP_USER_SDMA,
1681}; 1680};
1682 1681
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index cc9bd106a854..6abc75753e42 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2594,6 +2594,15 @@ static struct omap_hwmod omap44xx_ipu_hwmod = {
2594static struct omap_hwmod_class_sysconfig omap44xx_iss_sysc = { 2594static struct omap_hwmod_class_sysconfig omap44xx_iss_sysc = {
2595 .rev_offs = 0x0000, 2595 .rev_offs = 0x0000,
2596 .sysc_offs = 0x0010, 2596 .sysc_offs = 0x0010,
2597 /*
2598 * ISS needs 100 OCP clk cycles delay after a softreset before
2599 * accessing sysconfig again.
2600 * The lowest frequency at the moment for L3 bus is 100 MHz, so
2601 * 1usec delay is needed. Add an x2 margin to be safe (2 usecs).
2602 *
2603 * TODO: Indicate errata when available.
2604 */
2605 .srst_udelay = 2,
2597 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS | 2606 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
2598 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), 2607 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
2599 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 2608 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 0cdd359a128e..9fc2f44188cb 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -108,8 +108,14 @@ static void omap_uart_set_noidle(struct platform_device *pdev)
108static void omap_uart_set_smartidle(struct platform_device *pdev) 108static void omap_uart_set_smartidle(struct platform_device *pdev)
109{ 109{
110 struct omap_device *od = to_omap_device(pdev); 110 struct omap_device *od = to_omap_device(pdev);
111 u8 idlemode;
111 112
112 omap_hwmod_set_slave_idlemode(od->hwmods[0], HWMOD_IDLEMODE_SMART); 113 if (od->hwmods[0]->class->sysc->idlemodes & SIDLE_SMART_WKUP)
114 idlemode = HWMOD_IDLEMODE_SMART_WKUP;
115 else
116 idlemode = HWMOD_IDLEMODE_SMART;
117
118 omap_hwmod_set_slave_idlemode(od->hwmods[0], idlemode);
113} 119}
114 120
115#else 121#else
@@ -120,124 +126,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {}
120#endif /* CONFIG_PM */ 126#endif /* CONFIG_PM */
121 127
122#ifdef CONFIG_OMAP_MUX 128#ifdef CONFIG_OMAP_MUX
123static struct omap_device_pad default_uart1_pads[] __initdata = {
124 {
125 .name = "uart1_cts.uart1_cts",
126 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
127 },
128 {
129 .name = "uart1_rts.uart1_rts",
130 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
131 },
132 {
133 .name = "uart1_tx.uart1_tx",
134 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
135 },
136 {
137 .name = "uart1_rx.uart1_rx",
138 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
139 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
140 .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
141 },
142};
143
144static struct omap_device_pad default_uart2_pads[] __initdata = {
145 {
146 .name = "uart2_cts.uart2_cts",
147 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
148 },
149 {
150 .name = "uart2_rts.uart2_rts",
151 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
152 },
153 {
154 .name = "uart2_tx.uart2_tx",
155 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
156 },
157 {
158 .name = "uart2_rx.uart2_rx",
159 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
160 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
161 .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
162 },
163};
164
165static struct omap_device_pad default_uart3_pads[] __initdata = {
166 {
167 .name = "uart3_cts_rctx.uart3_cts_rctx",
168 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
169 },
170 {
171 .name = "uart3_rts_sd.uart3_rts_sd",
172 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
173 },
174 {
175 .name = "uart3_tx_irtx.uart3_tx_irtx",
176 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
177 },
178 {
179 .name = "uart3_rx_irrx.uart3_rx_irrx",
180 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
181 .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
182 .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
183 },
184};
185
186static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = {
187 {
188 .name = "gpmc_wait2.uart4_tx",
189 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
190 },
191 {
192 .name = "gpmc_wait3.uart4_rx",
193 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
194 .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2,
195 .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2,
196 },
197};
198
199static struct omap_device_pad default_omap4_uart4_pads[] __initdata = {
200 {
201 .name = "uart4_tx.uart4_tx",
202 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
203 },
204 {
205 .name = "uart4_rx.uart4_rx",
206 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
207 .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
208 .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
209 },
210};
211
212static void omap_serial_fill_default_pads(struct omap_board_data *bdata) 129static void omap_serial_fill_default_pads(struct omap_board_data *bdata)
213{ 130{
214 switch (bdata->id) {
215 case 0:
216 bdata->pads = default_uart1_pads;
217 bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads);
218 break;
219 case 1:
220 bdata->pads = default_uart2_pads;
221 bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads);
222 break;
223 case 2:
224 bdata->pads = default_uart3_pads;
225 bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads);
226 break;
227 case 3:
228 if (cpu_is_omap44xx()) {
229 bdata->pads = default_omap4_uart4_pads;
230 bdata->pads_cnt =
231 ARRAY_SIZE(default_omap4_uart4_pads);
232 } else if (cpu_is_omap3630()) {
233 bdata->pads = default_omap36xx_uart4_pads;
234 bdata->pads_cnt =
235 ARRAY_SIZE(default_omap36xx_uart4_pads);
236 }
237 break;
238 default:
239 break;
240 }
241} 131}
242#else 132#else
243static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} 133static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {}
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 4b57757bf9d1..7a7b89304c48 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -37,6 +37,16 @@ static struct i2c_board_info __initdata pmic_i2c_board_info = {
37 .flags = I2C_CLIENT_WAKE, 37 .flags = I2C_CLIENT_WAKE,
38}; 38};
39 39
40static struct i2c_board_info __initdata omap4_i2c1_board_info[] = {
41 {
42 .addr = 0x48,
43 .flags = I2C_CLIENT_WAKE,
44 },
45 {
46 I2C_BOARD_INFO("twl6040", 0x4b),
47 },
48};
49
40void __init omap_pmic_init(int bus, u32 clkrate, 50void __init omap_pmic_init(int bus, u32 clkrate,
41 const char *pmic_type, int pmic_irq, 51 const char *pmic_type, int pmic_irq,
42 struct twl4030_platform_data *pmic_data) 52 struct twl4030_platform_data *pmic_data)
@@ -49,14 +59,31 @@ void __init omap_pmic_init(int bus, u32 clkrate,
49 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); 59 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
50} 60}
51 61
62void __init omap4_pmic_init(const char *pmic_type,
63 struct twl4030_platform_data *pmic_data,
64 struct twl6040_platform_data *twl6040_data, int twl6040_irq)
65{
66 /* PMIC part*/
67 strncpy(omap4_i2c1_board_info[0].type, pmic_type,
68 sizeof(omap4_i2c1_board_info[0].type));
69 omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N;
70 omap4_i2c1_board_info[0].platform_data = pmic_data;
71
72 /* TWL6040 audio IC part */
73 omap4_i2c1_board_info[1].irq = twl6040_irq;
74 omap4_i2c1_board_info[1].platform_data = twl6040_data;
75
76 omap_register_i2c_bus(1, 400, omap4_i2c1_board_info, 2);
77
78}
79
52void __init omap_pmic_late_init(void) 80void __init omap_pmic_late_init(void)
53{ 81{
54 /* Init the OMAP TWL parameters (if PMIC has been registerd) */ 82 /* Init the OMAP TWL parameters (if PMIC has been registerd) */
55 if (!pmic_i2c_board_info.irq) 83 if (pmic_i2c_board_info.irq)
56 return; 84 omap3_twl_init();
57 85 if (omap4_i2c1_board_info[0].irq)
58 omap3_twl_init(); 86 omap4_twl_init();
59 omap4_twl_init();
60} 87}
61 88
62#if defined(CONFIG_ARCH_OMAP3) 89#if defined(CONFIG_ARCH_OMAP3)
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h
index 275dde8cb27a..09627483a57f 100644
--- a/arch/arm/mach-omap2/twl-common.h
+++ b/arch/arm/mach-omap2/twl-common.h
@@ -29,6 +29,7 @@
29 29
30 30
31struct twl4030_platform_data; 31struct twl4030_platform_data;
32struct twl6040_platform_data;
32 33
33void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, 34void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
34 struct twl4030_platform_data *pmic_data); 35 struct twl4030_platform_data *pmic_data);
@@ -46,12 +47,9 @@ static inline void omap3_pmic_init(const char *pmic_type,
46 omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); 47 omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data);
47} 48}
48 49
49static inline void omap4_pmic_init(const char *pmic_type, 50void omap4_pmic_init(const char *pmic_type,
50 struct twl4030_platform_data *pmic_data) 51 struct twl4030_platform_data *pmic_data,
51{ 52 struct twl6040_platform_data *audio_data, int twl6040_irq);
52 /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */
53 omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data);
54}
55 53
56void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, 54void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
57 u32 pdata_flags, u32 regulators_flags); 55 u32 pdata_flags, u32 regulators_flags);
diff --git a/arch/arm/mach-pnx4008/i2c.c b/arch/arm/mach-pnx4008/i2c.c
index 8103f9644e2d..550cfc2a1f2e 100644
--- a/arch/arm/mach-pnx4008/i2c.c
+++ b/arch/arm/mach-pnx4008/i2c.c
@@ -16,48 +16,62 @@
16#include <linux/err.h> 16#include <linux/err.h>
17#include <mach/platform.h> 17#include <mach/platform.h>
18#include <mach/irqs.h> 18#include <mach/irqs.h>
19#include <mach/i2c.h>
20 19
21static struct i2c_pnx_data i2c0_data = { 20static struct resource i2c0_resources[] = {
22 .name = I2C_CHIP_NAME "0", 21 {
23 .base = PNX4008_I2C1_BASE, 22 .start = PNX4008_I2C1_BASE,
24 .irq = I2C_1_INT, 23 .end = PNX4008_I2C1_BASE + SZ_4K - 1,
24 .flags = IORESOURCE_MEM,
25 }, {
26 .start = I2C_1_INT,
27 .end = I2C_1_INT,
28 .flags = IORESOURCE_IRQ,
29 },
25}; 30};
26 31
27static struct i2c_pnx_data i2c1_data = { 32static struct resource i2c1_resources[] = {
28 .name = I2C_CHIP_NAME "1", 33 {
29 .base = PNX4008_I2C2_BASE, 34 .start = PNX4008_I2C2_BASE,
30 .irq = I2C_2_INT, 35 .end = PNX4008_I2C2_BASE + SZ_4K - 1,
36 .flags = IORESOURCE_MEM,
37 }, {
38 .start = I2C_2_INT,
39 .end = I2C_2_INT,
40 .flags = IORESOURCE_IRQ,
41 },
31}; 42};
32 43
33static struct i2c_pnx_data i2c2_data = { 44static struct resource i2c2_resources[] = {
34 .name = "USB-I2C", 45 {
35 .base = (PNX4008_USB_CONFIG_BASE + 0x300), 46 .start = PNX4008_USB_CONFIG_BASE + 0x300,
36 .irq = USB_I2C_INT, 47 .end = PNX4008_USB_CONFIG_BASE + 0x300 + SZ_4K - 1,
48 .flags = IORESOURCE_MEM,
49 }, {
50 .start = USB_I2C_INT,
51 .end = USB_I2C_INT,
52 .flags = IORESOURCE_IRQ,
53 },
37}; 54};
38 55
39static struct platform_device i2c0_device = { 56static struct platform_device i2c0_device = {
40 .name = "pnx-i2c", 57 .name = "pnx-i2c.0",
41 .id = 0, 58 .id = 0,
42 .dev = { 59 .resource = i2c0_resources,
43 .platform_data = &i2c0_data, 60 .num_resources = ARRAY_SIZE(i2c0_resources),
44 },
45}; 61};
46 62
47static struct platform_device i2c1_device = { 63static struct platform_device i2c1_device = {
48 .name = "pnx-i2c", 64 .name = "pnx-i2c.1",
49 .id = 1, 65 .id = 1,
50 .dev = { 66 .resource = i2c1_resources,
51 .platform_data = &i2c1_data, 67 .num_resources = ARRAY_SIZE(i2c1_resources),
52 },
53}; 68};
54 69
55static struct platform_device i2c2_device = { 70static struct platform_device i2c2_device = {
56 .name = "pnx-i2c", 71 .name = "pnx-i2c.2",
57 .id = 2, 72 .id = 2,
58 .dev = { 73 .resource = i2c2_resources,
59 .platform_data = &i2c2_data, 74 .num_resources = ARRAY_SIZE(i2c2_resources),
60 },
61}; 75};
62 76
63static struct platform_device *devices[] __initdata = { 77static struct platform_device *devices[] __initdata = {
diff --git a/arch/arm/mach-pnx4008/include/mach/i2c.h b/arch/arm/mach-pnx4008/include/mach/i2c.h
deleted file mode 100644
index 259ac53abf40..000000000000
--- a/arch/arm/mach-pnx4008/include/mach/i2c.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * PNX4008-specific tweaks for I2C IP3204 block
3 *
4 * Author: Vitaly Wool <vwool@ru.mvista.com>
5 *
6 * 2005 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifndef __ASM_ARCH_I2C_H__
13#define __ASM_ARCH_I2C_H__
14
15enum {
16 mstatus_tdi = 0x00000001,
17 mstatus_afi = 0x00000002,
18 mstatus_nai = 0x00000004,
19 mstatus_drmi = 0x00000008,
20 mstatus_active = 0x00000020,
21 mstatus_scl = 0x00000040,
22 mstatus_sda = 0x00000080,
23 mstatus_rff = 0x00000100,
24 mstatus_rfe = 0x00000200,
25 mstatus_tff = 0x00000400,
26 mstatus_tfe = 0x00000800,
27};
28
29enum {
30 mcntrl_tdie = 0x00000001,
31 mcntrl_afie = 0x00000002,
32 mcntrl_naie = 0x00000004,
33 mcntrl_drmie = 0x00000008,
34 mcntrl_daie = 0x00000020,
35 mcntrl_rffie = 0x00000040,
36 mcntrl_tffie = 0x00000080,
37 mcntrl_reset = 0x00000100,
38 mcntrl_cdbmode = 0x00000400,
39};
40
41enum {
42 rw_bit = 1 << 0,
43 start_bit = 1 << 8,
44 stop_bit = 1 << 9,
45};
46
47#define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */
48#define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */
49#define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */
50#define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */
51#define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */
52#define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */
53#define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */
54#define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */
55#define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */
56#define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */
57#define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */
58#define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */
59#define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */
60
61#define HCLK_MHZ 13
62#define I2C_CHIP_NAME "PNX4008-I2C"
63
64#endif /* __ASM_ARCH_I2C_H___ */
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 83ad3fe0a75f..cc1d73514ffa 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -3,6 +3,8 @@
3 3
4extern void shmobile_earlytimer_init(void); 4extern void shmobile_earlytimer_init(void);
5extern struct sys_timer shmobile_timer; 5extern struct sys_timer shmobile_timer;
6extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
7 unsigned int mult, unsigned int div);
6struct twd_local_timer; 8struct twd_local_timer;
7void shmobile_twd_init(struct twd_local_timer *twd_local_timer); 9void shmobile_twd_init(struct twd_local_timer *twd_local_timer);
8extern void shmobile_setup_console(void); 10extern void shmobile_setup_console(void);
diff --git a/arch/arm/mach-shmobile/include/mach/intc.h b/arch/arm/mach-shmobile/include/mach/intc.h
index 8b22258c8caa..a5603c76cfe0 100644
--- a/arch/arm/mach-shmobile/include/mach/intc.h
+++ b/arch/arm/mach-shmobile/include/mach/intc.h
@@ -142,6 +142,50 @@ static struct intc_desc p ## _desc __initdata = { \
142 p ## _sense_registers, p ## _ack_registers) \ 142 p ## _sense_registers, p ## _ack_registers) \
143} 143}
144 144
145#define INTC_IRQ_PINS_16H(p, base, vect, str) \
146 \
147static struct resource p ## _resources[] __initdata = { \
148 [0] = { \
149 .start = base, \
150 .end = base + 0x64, \
151 .flags = IORESOURCE_MEM, \
152 }, \
153}; \
154 \
155enum { \
156 p ## _UNUSED = 0, \
157 INTC_IRQ_PINS_ENUM_16H(p), \
158}; \
159 \
160static struct intc_vect p ## _vectors[] __initdata = { \
161 INTC_IRQ_PINS_VECT_16H(p, vect), \
162}; \
163 \
164static struct intc_mask_reg p ## _mask_registers[] __initdata = { \
165 INTC_IRQ_PINS_MASK_16H(p, base), \
166}; \
167 \
168static struct intc_prio_reg p ## _prio_registers[] __initdata = { \
169 INTC_IRQ_PINS_PRIO_16H(p, base), \
170}; \
171 \
172static struct intc_sense_reg p ## _sense_registers[] __initdata = { \
173 INTC_IRQ_PINS_SENSE_16H(p, base), \
174}; \
175 \
176static struct intc_mask_reg p ## _ack_registers[] __initdata = { \
177 INTC_IRQ_PINS_ACK_16H(p, base), \
178}; \
179 \
180static struct intc_desc p ## _desc __initdata = { \
181 .name = str, \
182 .resource = p ## _resources, \
183 .num_resources = ARRAY_SIZE(p ## _resources), \
184 .hw = INTC_HW_DESC(p ## _vectors, NULL, \
185 p ## _mask_registers, p ## _prio_registers, \
186 p ## _sense_registers, p ## _ack_registers) \
187}
188
145#define INTC_IRQ_PINS_32(p, base, vect, str) \ 189#define INTC_IRQ_PINS_32(p, base, vect, str) \
146 \ 190 \
147static struct resource p ## _resources[] __initdata = { \ 191static struct resource p ## _resources[] __initdata = { \
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
index 4e686cc201fc..06a5da3c3050 100644
--- a/arch/arm/mach-shmobile/include/mach/irqs.h
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -7,7 +7,7 @@
7#define gic_spi(nr) ((nr) + 32) 7#define gic_spi(nr) ((nr) + 32)
8 8
9/* INTCS */ 9/* INTCS */
10#define INTCS_VECT_BASE 0x2200 10#define INTCS_VECT_BASE 0x3400
11#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) 11#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
12#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt)) 12#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
13 13
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index 6447e0af52d4..2587a22842f2 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -19,6 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/module.h>
22#include <linux/irq.h> 23#include <linux/irq.h>
23#include <linux/io.h> 24#include <linux/io.h>
24#include <linux/sh_intc.h> 25#include <linux/sh_intc.h>
@@ -305,14 +306,16 @@ static DECLARE_INTC_DESC(intca_desc, "sh7372-intca",
305 intca_mask_registers, intca_prio_registers, 306 intca_mask_registers, intca_prio_registers,
306 NULL); 307 NULL);
307 308
308INTC_IRQ_PINS_32(intca_irq_pins, 0xe6900000, 309INTC_IRQ_PINS_16(intca_irq_pins_lo, 0xe6900000,
309 INTC_VECT, "sh7372-intca-irq-pins"); 310 INTC_VECT, "sh7372-intca-irq-lo");
311
312INTC_IRQ_PINS_16H(intca_irq_pins_hi, 0xe6900000,
313 INTC_VECT, "sh7372-intca-irq-hi");
314
310enum { 315enum {
311 UNUSED_INTCS = 0, 316 UNUSED_INTCS = 0,
312 ENABLED_INTCS, 317 ENABLED_INTCS,
313 318
314 INTCS,
315
316 /* interrupt sources INTCS */ 319 /* interrupt sources INTCS */
317 320
318 /* IRQ0S - IRQ31S */ 321 /* IRQ0S - IRQ31S */
@@ -426,8 +429,6 @@ static struct intc_vect intcs_vectors[] = {
426 INTCS_VECT(CPORTS2R, 0x1a20), 429 INTCS_VECT(CPORTS2R, 0x1a20),
427 /* CEC */ 430 /* CEC */
428 INTCS_VECT(JPU6E, 0x1a80), 431 INTCS_VECT(JPU6E, 0x1a80),
429
430 INTC_VECT(INTCS, 0xf80),
431}; 432};
432 433
433static struct intc_group intcs_groups[] __initdata = { 434static struct intc_group intcs_groups[] __initdata = {
@@ -490,9 +491,6 @@ static struct intc_mask_reg intcs_mask_registers[] = {
490 { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */ 491 { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */
491 { MFIS2_INTCS, CPORTS2R, 0, 0, 492 { MFIS2_INTCS, CPORTS2R, 0, 0,
492 JPU6E, 0, 0, 0 } }, 493 JPU6E, 0, 0, 0 } },
493 { 0xffd20104, 0, 16, /* INTAMASK */
494 { 0, 0, 0, 0, 0, 0, 0, 0,
495 0, 0, 0, 0, 0, 0, 0, INTCS } },
496}; 494};
497 495
498/* Priority is needed for INTCA to receive the INTCS interrupt */ 496/* Priority is needed for INTCA to receive the INTCS interrupt */
@@ -557,18 +555,30 @@ static void __iomem *intcs_ffd5;
557void __init sh7372_init_irq(void) 555void __init sh7372_init_irq(void)
558{ 556{
559 void __iomem *intevtsa; 557 void __iomem *intevtsa;
558 int n;
560 559
561 intcs_ffd2 = ioremap_nocache(0xffd20000, PAGE_SIZE); 560 intcs_ffd2 = ioremap_nocache(0xffd20000, PAGE_SIZE);
562 intevtsa = intcs_ffd2 + 0x100; 561 intevtsa = intcs_ffd2 + 0x100;
563 intcs_ffd5 = ioremap_nocache(0xffd50000, PAGE_SIZE); 562 intcs_ffd5 = ioremap_nocache(0xffd50000, PAGE_SIZE);
564 563
565 register_intc_controller(&intca_desc); 564 register_intc_controller(&intca_desc);
566 register_intc_controller(&intca_irq_pins_desc); 565 register_intc_controller(&intca_irq_pins_lo_desc);
566 register_intc_controller(&intca_irq_pins_hi_desc);
567 register_intc_controller(&intcs_desc); 567 register_intc_controller(&intcs_desc);
568 568
569 /* setup dummy cascade chip for INTCS */
570 n = evt2irq(0xf80);
571 irq_alloc_desc_at(n, numa_node_id());
572 irq_set_chip_and_handler_name(n, &dummy_irq_chip,
573 handle_level_irq, "level");
574 set_irq_flags(n, IRQF_VALID); /* yuck */
575
569 /* demux using INTEVTSA */ 576 /* demux using INTEVTSA */
570 irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa); 577 irq_set_handler_data(n, (void *)intevtsa);
571 irq_set_chained_handler(evt2irq(0xf80), intcs_demux); 578 irq_set_chained_handler(n, intcs_demux);
579
580 /* unmask INTCS in INTAMASK */
581 iowrite16(0, intcs_ffd2 + 0x104);
572} 582}
573 583
574static unsigned short ffd2[0x200]; 584static unsigned short ffd2[0x200];
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 2fe8f83ca124..4c7fece5ef92 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -22,6 +22,7 @@
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/of_platform.h>
25#include <linux/uio_driver.h> 26#include <linux/uio_driver.h>
26#include <linux/delay.h> 27#include <linux/delay.h>
27#include <linux/input.h> 28#include <linux/input.h>
@@ -1092,3 +1093,50 @@ void __init sh7372_add_early_devices(void)
1092 /* override timer setup with soc-specific code */ 1093 /* override timer setup with soc-specific code */
1093 shmobile_timer.init = sh7372_earlytimer_init; 1094 shmobile_timer.init = sh7372_earlytimer_init;
1094} 1095}
1096
1097#ifdef CONFIG_USE_OF
1098
1099void __init sh7372_add_early_devices_dt(void)
1100{
1101 shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */
1102
1103 early_platform_add_devices(sh7372_early_devices,
1104 ARRAY_SIZE(sh7372_early_devices));
1105
1106 /* setup early console here as well */
1107 shmobile_setup_console();
1108}
1109
1110static const struct of_dev_auxdata sh7372_auxdata_lookup[] __initconst = {
1111 { }
1112};
1113
1114void __init sh7372_add_standard_devices_dt(void)
1115{
1116 /* clocks are setup late during boot in the case of DT */
1117 sh7372_clock_init();
1118
1119 platform_add_devices(sh7372_early_devices,
1120 ARRAY_SIZE(sh7372_early_devices));
1121
1122 of_platform_populate(NULL, of_default_bus_match_table,
1123 sh7372_auxdata_lookup, NULL);
1124}
1125
1126static const char *sh7372_boards_compat_dt[] __initdata = {
1127 "renesas,sh7372",
1128 NULL,
1129};
1130
1131DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
1132 .map_io = sh7372_map_io,
1133 .init_early = sh7372_add_early_devices_dt,
1134 .nr_irqs = NR_IRQS_LEGACY,
1135 .init_irq = sh7372_init_irq,
1136 .handle_irq = shmobile_handle_irq_intc,
1137 .init_machine = sh7372_add_standard_devices_dt,
1138 .timer = &shmobile_timer,
1139 .dt_compat = sh7372_boards_compat_dt,
1140MACHINE_END
1141
1142#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 2fba5f3d1c8a..599e0081a533 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -19,9 +19,26 @@
19 * 19 *
20 */ 20 */
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/delay.h>
22#include <asm/mach/time.h> 23#include <asm/mach/time.h>
23#include <asm/smp_twd.h> 24#include <asm/smp_twd.h>
24 25
26void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
27 unsigned int mult, unsigned int div)
28{
29 /* calculate a worst-case loops-per-jiffy value
30 * based on maximum cpu core mhz setting and the
31 * __delay() implementation in arch/arm/lib/delay.S
32 *
33 * this will result in a longer delay than expected
34 * when the cpu core runs on lower frequencies.
35 */
36
37 unsigned int value = (1000000 * mult) / (HZ * div);
38
39 lpj_fine = max_cpu_core_mhz * value;
40}
41
25static void __init shmobile_late_time_init(void) 42static void __init shmobile_late_time_init(void)
26{ 43{
27 /* 44 /*
diff --git a/arch/arm/mach-spear3xx/Kconfig b/arch/arm/mach-spear3xx/Kconfig
index 2cee6b0de371..d9fe11cb6f16 100644
--- a/arch/arm/mach-spear3xx/Kconfig
+++ b/arch/arm/mach-spear3xx/Kconfig
@@ -5,39 +5,19 @@
5if ARCH_SPEAR3XX 5if ARCH_SPEAR3XX
6 6
7menu "SPEAr3xx Implementations" 7menu "SPEAr3xx Implementations"
8config BOARD_SPEAR300_EVB
9 bool "SPEAr300 Evaluation Board"
10 select MACH_SPEAR300
11 help
12 Supports ST SPEAr300 Evaluation Board
13
14config BOARD_SPEAR310_EVB
15 bool "SPEAr310 Evaluation Board"
16 select MACH_SPEAR310
17 help
18 Supports ST SPEAr310 Evaluation Board
19
20config BOARD_SPEAR320_EVB
21 bool "SPEAr320 Evaluation Board"
22 select MACH_SPEAR320
23 help
24 Supports ST SPEAr320 Evaluation Board
25
26endmenu
27
28config MACH_SPEAR300 8config MACH_SPEAR300
29 bool "SPEAr300" 9 bool "SPEAr300 Machine support with Device Tree"
30 help 10 help
31 Supports ST SPEAr300 Machine 11 Supports ST SPEAr300 machine configured via the device-tree
32 12
33config MACH_SPEAR310 13config MACH_SPEAR310
34 bool "SPEAr310" 14 bool "SPEAr310 Machine support with Device Tree"
35 help 15 help
36 Supports ST SPEAr310 Machine 16 Supports ST SPEAr310 machine configured via the device-tree
37 17
38config MACH_SPEAR320 18config MACH_SPEAR320
39 bool "SPEAr320" 19 bool "SPEAr320 Machine support with Device Tree"
40 help 20 help
41 Supports ST SPEAr320 Machine 21 Supports ST SPEAr320 machine configured via the device-tree
42 22endmenu
43endif #ARCH_SPEAR3XX 23endif #ARCH_SPEAR3XX
diff --git a/arch/arm/mach-spear3xx/Makefile b/arch/arm/mach-spear3xx/Makefile
index b24862489704..17b5d83cf2d5 100644
--- a/arch/arm/mach-spear3xx/Makefile
+++ b/arch/arm/mach-spear3xx/Makefile
@@ -3,24 +3,13 @@
3# 3#
4 4
5# common files 5# common files
6obj-y += spear3xx.o clock.o 6obj-$(CONFIG_ARCH_SPEAR3XX) += spear3xx.o clock.o
7 7
8# spear300 specific files 8# spear300 specific files
9obj-$(CONFIG_MACH_SPEAR300) += spear300.o 9obj-$(CONFIG_MACH_SPEAR300) += spear300.o
10 10
11# spear300 boards files
12obj-$(CONFIG_BOARD_SPEAR300_EVB) += spear300_evb.o
13
14
15# spear310 specific files 11# spear310 specific files
16obj-$(CONFIG_MACH_SPEAR310) += spear310.o 12obj-$(CONFIG_MACH_SPEAR310) += spear310.o
17 13
18# spear310 boards files
19obj-$(CONFIG_BOARD_SPEAR310_EVB) += spear310_evb.o
20
21
22# spear320 specific files 14# spear320 specific files
23obj-$(CONFIG_MACH_SPEAR320) += spear320.o 15obj-$(CONFIG_MACH_SPEAR320) += spear320.o
24
25# spear320 boards files
26obj-$(CONFIG_BOARD_SPEAR320_EVB) += spear320_evb.o
diff --git a/arch/arm/mach-spear3xx/Makefile.boot b/arch/arm/mach-spear3xx/Makefile.boot
index 4674a4c221db..d93e2177e6ec 100644
--- a/arch/arm/mach-spear3xx/Makefile.boot
+++ b/arch/arm/mach-spear3xx/Makefile.boot
@@ -1,3 +1,7 @@
1zreladdr-y += 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4
5dtb-$(CONFIG_MACH_SPEAR300) += spear300-evb.dtb
6dtb-$(CONFIG_MACH_SPEAR310) += spear310-evb.dtb
7dtb-$(CONFIG_MACH_SPEAR320) += spear320-evb.dtb
diff --git a/arch/arm/mach-spear3xx/clock.c b/arch/arm/mach-spear3xx/clock.c
index 6c4841f55223..cd6c11099083 100644
--- a/arch/arm/mach-spear3xx/clock.c
+++ b/arch/arm/mach-spear3xx/clock.c
@@ -11,12 +11,112 @@
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/clkdev.h>
14#include <linux/init.h> 15#include <linux/init.h>
15#include <linux/io.h> 16#include <linux/io.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/of_platform.h>
17#include <asm/mach-types.h> 19#include <asm/mach-types.h>
18#include <plat/clock.h> 20#include <plat/clock.h>
19#include <mach/misc_regs.h> 21#include <mach/misc_regs.h>
22#include <mach/spear.h>
23
24#define PLL1_CTR (MISC_BASE + 0x008)
25#define PLL1_FRQ (MISC_BASE + 0x00C)
26#define PLL1_MOD (MISC_BASE + 0x010)
27#define PLL2_CTR (MISC_BASE + 0x014)
28/* PLL_CTR register masks */
29#define PLL_ENABLE 2
30#define PLL_MODE_SHIFT 4
31#define PLL_MODE_MASK 0x3
32#define PLL_MODE_NORMAL 0
33#define PLL_MODE_FRACTION 1
34#define PLL_MODE_DITH_DSB 2
35#define PLL_MODE_DITH_SSB 3
36
37#define PLL2_FRQ (MISC_BASE + 0x018)
38/* PLL FRQ register masks */
39#define PLL_DIV_N_SHIFT 0
40#define PLL_DIV_N_MASK 0xFF
41#define PLL_DIV_P_SHIFT 8
42#define PLL_DIV_P_MASK 0x7
43#define PLL_NORM_FDBK_M_SHIFT 24
44#define PLL_NORM_FDBK_M_MASK 0xFF
45#define PLL_DITH_FDBK_M_SHIFT 16
46#define PLL_DITH_FDBK_M_MASK 0xFFFF
47
48#define PLL2_MOD (MISC_BASE + 0x01C)
49#define PLL_CLK_CFG (MISC_BASE + 0x020)
50#define CORE_CLK_CFG (MISC_BASE + 0x024)
51/* CORE CLK CFG register masks */
52#define PLL_HCLK_RATIO_SHIFT 10
53#define PLL_HCLK_RATIO_MASK 0x3
54#define HCLK_PCLK_RATIO_SHIFT 8
55#define HCLK_PCLK_RATIO_MASK 0x3
56
57#define PERIP_CLK_CFG (MISC_BASE + 0x028)
58/* PERIP_CLK_CFG register masks */
59#define UART_CLK_SHIFT 4
60#define UART_CLK_MASK 0x1
61#define FIRDA_CLK_SHIFT 5
62#define FIRDA_CLK_MASK 0x3
63#define GPT0_CLK_SHIFT 8
64#define GPT1_CLK_SHIFT 11
65#define GPT2_CLK_SHIFT 12
66#define GPT_CLK_MASK 0x1
67#define AUX_CLK_PLL3_VAL 0
68#define AUX_CLK_PLL1_VAL 1
69
70#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
71/* PERIP1_CLK_ENB register masks */
72#define UART_CLK_ENB 3
73#define SSP_CLK_ENB 5
74#define I2C_CLK_ENB 7
75#define JPEG_CLK_ENB 8
76#define FIRDA_CLK_ENB 10
77#define GPT1_CLK_ENB 11
78#define GPT2_CLK_ENB 12
79#define ADC_CLK_ENB 15
80#define RTC_CLK_ENB 17
81#define GPIO_CLK_ENB 18
82#define DMA_CLK_ENB 19
83#define SMI_CLK_ENB 21
84#define GMAC_CLK_ENB 23
85#define USBD_CLK_ENB 24
86#define USBH_CLK_ENB 25
87#define C3_CLK_ENB 31
88
89#define RAS_CLK_ENB (MISC_BASE + 0x034)
90
91#define PRSC1_CLK_CFG (MISC_BASE + 0x044)
92#define PRSC2_CLK_CFG (MISC_BASE + 0x048)
93#define PRSC3_CLK_CFG (MISC_BASE + 0x04C)
94/* gpt synthesizer register masks */
95#define GPT_MSCALE_SHIFT 0
96#define GPT_MSCALE_MASK 0xFFF
97#define GPT_NSCALE_SHIFT 12
98#define GPT_NSCALE_MASK 0xF
99
100#define AMEM_CLK_CFG (MISC_BASE + 0x050)
101#define EXPI_CLK_CFG (MISC_BASE + 0x054)
102#define CLCD_CLK_SYNT (MISC_BASE + 0x05C)
103#define FIRDA_CLK_SYNT (MISC_BASE + 0x060)
104#define UART_CLK_SYNT (MISC_BASE + 0x064)
105#define GMAC_CLK_SYNT (MISC_BASE + 0x068)
106#define RAS1_CLK_SYNT (MISC_BASE + 0x06C)
107#define RAS2_CLK_SYNT (MISC_BASE + 0x070)
108#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
109#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
110/* aux clk synthesiser register masks for irda to ras4 */
111#define AUX_SYNT_ENB 31
112#define AUX_EQ_SEL_SHIFT 30
113#define AUX_EQ_SEL_MASK 1
114#define AUX_EQ1_SEL 0
115#define AUX_EQ2_SEL 1
116#define AUX_XSCALE_SHIFT 16
117#define AUX_XSCALE_MASK 0xFFF
118#define AUX_YSCALE_SHIFT 0
119#define AUX_YSCALE_MASK 0xFFF
20 120
21/* root clks */ 121/* root clks */
22/* 32 KHz oscillator clock */ 122/* 32 KHz oscillator clock */
@@ -411,6 +511,21 @@ static struct clk usbd_clk = {
411 .recalc = &follow_parent, 511 .recalc = &follow_parent,
412}; 512};
413 513
514/* clock derived from usbh clk */
515/* usbh0 clock */
516static struct clk usbh0_clk = {
517 .flags = ALWAYS_ENABLED,
518 .pclk = &usbh_clk,
519 .recalc = &follow_parent,
520};
521
522/* usbh1 clock */
523static struct clk usbh1_clk = {
524 .flags = ALWAYS_ENABLED,
525 .pclk = &usbh_clk,
526 .recalc = &follow_parent,
527};
528
414/* clock derived from ahb clk */ 529/* clock derived from ahb clk */
415/* apb masks structure */ 530/* apb masks structure */
416static struct bus_clk_masks apb_masks = { 531static struct bus_clk_masks apb_masks = {
@@ -652,109 +767,126 @@ static struct clk pwm_clk = {
652 767
653/* array of all spear 3xx clock lookups */ 768/* array of all spear 3xx clock lookups */
654static struct clk_lookup spear_clk_lookups[] = { 769static struct clk_lookup spear_clk_lookups[] = {
655 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk}, 770 CLKDEV_INIT(NULL, "apb_pclk", &dummy_apb_pclk),
656 /* root clks */ 771 /* root clks */
657 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 772 CLKDEV_INIT(NULL, "osc_32k_clk", &osc_32k_clk),
658 { .con_id = "osc_24m_clk", .clk = &osc_24m_clk}, 773 CLKDEV_INIT(NULL, "osc_24m_clk", &osc_24m_clk),
659 /* clock derived from 32 KHz osc clk */ 774 /* clock derived from 32 KHz osc clk */
660 { .dev_id = "rtc-spear", .clk = &rtc_clk}, 775 CLKDEV_INIT("fc900000.rtc", NULL, &rtc_clk),
661 /* clock derived from 24 MHz osc clk */ 776 /* clock derived from 24 MHz osc clk */
662 { .con_id = "pll1_clk", .clk = &pll1_clk}, 777 CLKDEV_INIT(NULL, "pll1_clk", &pll1_clk),
663 { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk}, 778 CLKDEV_INIT(NULL, "pll3_48m_clk", &pll3_48m_clk),
664 { .dev_id = "wdt", .clk = &wdt_clk}, 779 CLKDEV_INIT("fc880000.wdt", NULL, &wdt_clk),
665 /* clock derived from pll1 clk */ 780 /* clock derived from pll1 clk */
666 { .con_id = "cpu_clk", .clk = &cpu_clk}, 781 CLKDEV_INIT(NULL, "cpu_clk", &cpu_clk),
667 { .con_id = "ahb_clk", .clk = &ahb_clk}, 782 CLKDEV_INIT(NULL, "ahb_clk", &ahb_clk),
668 { .con_id = "uart_synth_clk", .clk = &uart_synth_clk}, 783 CLKDEV_INIT(NULL, "uart_synth_clk", &uart_synth_clk),
669 { .con_id = "firda_synth_clk", .clk = &firda_synth_clk}, 784 CLKDEV_INIT(NULL, "firda_synth_clk", &firda_synth_clk),
670 { .con_id = "gpt0_synth_clk", .clk = &gpt0_synth_clk}, 785 CLKDEV_INIT(NULL, "gpt0_synth_clk", &gpt0_synth_clk),
671 { .con_id = "gpt1_synth_clk", .clk = &gpt1_synth_clk}, 786 CLKDEV_INIT(NULL, "gpt1_synth_clk", &gpt1_synth_clk),
672 { .con_id = "gpt2_synth_clk", .clk = &gpt2_synth_clk}, 787 CLKDEV_INIT(NULL, "gpt2_synth_clk", &gpt2_synth_clk),
673 { .dev_id = "uart", .clk = &uart_clk}, 788 CLKDEV_INIT("d0000000.serial", NULL, &uart_clk),
674 { .dev_id = "firda", .clk = &firda_clk}, 789 CLKDEV_INIT("firda", NULL, &firda_clk),
675 { .dev_id = "gpt0", .clk = &gpt0_clk}, 790 CLKDEV_INIT("gpt0", NULL, &gpt0_clk),
676 { .dev_id = "gpt1", .clk = &gpt1_clk}, 791 CLKDEV_INIT("gpt1", NULL, &gpt1_clk),
677 { .dev_id = "gpt2", .clk = &gpt2_clk}, 792 CLKDEV_INIT("gpt2", NULL, &gpt2_clk),
678 /* clock derived from pll3 clk */ 793 /* clock derived from pll3 clk */
679 { .dev_id = "designware_udc", .clk = &usbd_clk}, 794 CLKDEV_INIT("designware_udc", NULL, &usbd_clk),
680 { .con_id = "usbh_clk", .clk = &usbh_clk}, 795 CLKDEV_INIT(NULL, "usbh_clk", &usbh_clk),
796 /* clock derived from usbh clk */
797 CLKDEV_INIT(NULL, "usbh.0_clk", &usbh0_clk),
798 CLKDEV_INIT(NULL, "usbh.1_clk", &usbh1_clk),
681 /* clock derived from ahb clk */ 799 /* clock derived from ahb clk */
682 { .con_id = "apb_clk", .clk = &apb_clk}, 800 CLKDEV_INIT(NULL, "apb_clk", &apb_clk),
683 { .dev_id = "i2c_designware.0", .clk = &i2c_clk}, 801 CLKDEV_INIT("d0180000.i2c", NULL, &i2c_clk),
684 { .dev_id = "dma", .clk = &dma_clk}, 802 CLKDEV_INIT("fc400000.dma", NULL, &dma_clk),
685 { .dev_id = "jpeg", .clk = &jpeg_clk}, 803 CLKDEV_INIT("jpeg", NULL, &jpeg_clk),
686 { .dev_id = "gmac", .clk = &gmac_clk}, 804 CLKDEV_INIT("e0800000.eth", NULL, &gmac_clk),
687 { .dev_id = "smi", .clk = &smi_clk}, 805 CLKDEV_INIT("fc000000.flash", NULL, &smi_clk),
688 { .dev_id = "c3", .clk = &c3_clk}, 806 CLKDEV_INIT("c3", NULL, &c3_clk),
689 /* clock derived from apb clk */ 807 /* clock derived from apb clk */
690 { .dev_id = "adc", .clk = &adc_clk}, 808 CLKDEV_INIT("adc", NULL, &adc_clk),
691 { .dev_id = "ssp-pl022.0", .clk = &ssp0_clk}, 809 CLKDEV_INIT("d0100000.spi", NULL, &ssp0_clk),
692 { .dev_id = "gpio", .clk = &gpio_clk}, 810 CLKDEV_INIT("fc980000.gpio", NULL, &gpio_clk),
693}; 811};
694 812
695/* array of all spear 300 clock lookups */ 813/* array of all spear 300 clock lookups */
696#ifdef CONFIG_MACH_SPEAR300 814#ifdef CONFIG_MACH_SPEAR300
697static struct clk_lookup spear300_clk_lookups[] = { 815static struct clk_lookup spear300_clk_lookups[] = {
698 { .dev_id = "clcd", .clk = &clcd_clk}, 816 CLKDEV_INIT("60000000.clcd", NULL, &clcd_clk),
699 { .con_id = "fsmc", .clk = &fsmc_clk}, 817 CLKDEV_INIT("94000000.flash", NULL, &fsmc_clk),
700 { .dev_id = "gpio1", .clk = &gpio1_clk}, 818 CLKDEV_INIT("a9000000.gpio", NULL, &gpio1_clk),
701 { .dev_id = "keyboard", .clk = &kbd_clk}, 819 CLKDEV_INIT("a0000000.kbd", NULL, &kbd_clk),
702 { .dev_id = "sdhci", .clk = &sdhci_clk}, 820 CLKDEV_INIT("70000000.sdhci", NULL, &sdhci_clk),
703}; 821};
822
823void __init spear300_clk_init(void)
824{
825 int i;
826
827 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++)
828 clk_register(&spear_clk_lookups[i]);
829
830 for (i = 0; i < ARRAY_SIZE(spear300_clk_lookups); i++)
831 clk_register(&spear300_clk_lookups[i]);
832
833 clk_init();
834}
704#endif 835#endif
705 836
706/* array of all spear 310 clock lookups */ 837/* array of all spear 310 clock lookups */
707#ifdef CONFIG_MACH_SPEAR310 838#ifdef CONFIG_MACH_SPEAR310
708static struct clk_lookup spear310_clk_lookups[] = { 839static struct clk_lookup spear310_clk_lookups[] = {
709 { .con_id = "fsmc", .clk = &fsmc_clk}, 840 CLKDEV_INIT("44000000.flash", NULL, &fsmc_clk),
710 { .con_id = "emi", .clk = &emi_clk}, 841 CLKDEV_INIT(NULL, "emi", &emi_clk),
711 { .dev_id = "uart1", .clk = &uart1_clk}, 842 CLKDEV_INIT("b2000000.serial", NULL, &uart1_clk),
712 { .dev_id = "uart2", .clk = &uart2_clk}, 843 CLKDEV_INIT("b2080000.serial", NULL, &uart2_clk),
713 { .dev_id = "uart3", .clk = &uart3_clk}, 844 CLKDEV_INIT("b2100000.serial", NULL, &uart3_clk),
714 { .dev_id = "uart4", .clk = &uart4_clk}, 845 CLKDEV_INIT("b2180000.serial", NULL, &uart4_clk),
715 { .dev_id = "uart5", .clk = &uart5_clk}, 846 CLKDEV_INIT("b2200000.serial", NULL, &uart5_clk),
716}; 847};
848
849void __init spear310_clk_init(void)
850{
851 int i;
852
853 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++)
854 clk_register(&spear_clk_lookups[i]);
855
856 for (i = 0; i < ARRAY_SIZE(spear310_clk_lookups); i++)
857 clk_register(&spear310_clk_lookups[i]);
858
859 clk_init();
860}
717#endif 861#endif
718 862
719/* array of all spear 320 clock lookups */ 863/* array of all spear 320 clock lookups */
720#ifdef CONFIG_MACH_SPEAR320 864#ifdef CONFIG_MACH_SPEAR320
721static struct clk_lookup spear320_clk_lookups[] = { 865static struct clk_lookup spear320_clk_lookups[] = {
722 { .dev_id = "clcd", .clk = &clcd_clk}, 866 CLKDEV_INIT("90000000.clcd", NULL, &clcd_clk),
723 { .con_id = "fsmc", .clk = &fsmc_clk}, 867 CLKDEV_INIT("4c000000.flash", NULL, &fsmc_clk),
724 { .dev_id = "i2c_designware.1", .clk = &i2c1_clk}, 868 CLKDEV_INIT("a7000000.i2c", NULL, &i2c1_clk),
725 { .con_id = "emi", .clk = &emi_clk}, 869 CLKDEV_INIT(NULL, "emi", &emi_clk),
726 { .dev_id = "pwm", .clk = &pwm_clk}, 870 CLKDEV_INIT("pwm", NULL, &pwm_clk),
727 { .dev_id = "sdhci", .clk = &sdhci_clk}, 871 CLKDEV_INIT("70000000.sdhci", NULL, &sdhci_clk),
728 { .dev_id = "c_can_platform.0", .clk = &can0_clk}, 872 CLKDEV_INIT("c_can_platform.0", NULL, &can0_clk),
729 { .dev_id = "c_can_platform.1", .clk = &can1_clk}, 873 CLKDEV_INIT("c_can_platform.1", NULL, &can1_clk),
730 { .dev_id = "ssp-pl022.1", .clk = &ssp1_clk}, 874 CLKDEV_INIT("a5000000.spi", NULL, &ssp1_clk),
731 { .dev_id = "ssp-pl022.2", .clk = &ssp2_clk}, 875 CLKDEV_INIT("a6000000.spi", NULL, &ssp2_clk),
732 { .dev_id = "uart1", .clk = &uart1_clk}, 876 CLKDEV_INIT("a3000000.serial", NULL, &uart1_clk),
733 { .dev_id = "uart2", .clk = &uart2_clk}, 877 CLKDEV_INIT("a4000000.serial", NULL, &uart2_clk),
734}; 878};
735#endif 879
736 880void __init spear320_clk_init(void)
737void __init spear3xx_clk_init(void)
738{ 881{
739 int i, cnt; 882 int i;
740 struct clk_lookup *lookups;
741
742 if (machine_is_spear300()) {
743 cnt = ARRAY_SIZE(spear300_clk_lookups);
744 lookups = spear300_clk_lookups;
745 } else if (machine_is_spear310()) {
746 cnt = ARRAY_SIZE(spear310_clk_lookups);
747 lookups = spear310_clk_lookups;
748 } else {
749 cnt = ARRAY_SIZE(spear320_clk_lookups);
750 lookups = spear320_clk_lookups;
751 }
752 883
753 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++) 884 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++)
754 clk_register(&spear_clk_lookups[i]); 885 clk_register(&spear_clk_lookups[i]);
755 886
756 for (i = 0; i < cnt; i++) 887 for (i = 0; i < ARRAY_SIZE(spear320_clk_lookups); i++)
757 clk_register(&lookups[i]); 888 clk_register(&spear320_clk_lookups[i]);
758 889
759 clk_init(); 890 clk_init();
760} 891}
892#endif
diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h
index 14276e5a98d2..e4f4d721cda2 100644
--- a/arch/arm/mach-spear3xx/include/mach/generic.h
+++ b/arch/arm/mach-spear3xx/include/mach/generic.h
@@ -14,6 +14,7 @@
14#ifndef __MACH_GENERIC_H 14#ifndef __MACH_GENERIC_H
15#define __MACH_GENERIC_H 15#define __MACH_GENERIC_H
16 16
17#include <linux/amba/pl08x.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
19#include <linux/amba/bus.h> 20#include <linux/amba/bus.h>
@@ -21,26 +22,15 @@
21#include <asm/mach/map.h> 22#include <asm/mach/map.h>
22#include <plat/padmux.h> 23#include <plat/padmux.h>
23 24
24/* spear3xx declarations */
25/*
26 * Each GPT has 2 timer channels
27 * Following GPT channels will be used as clock source and clockevent
28 */
29#define SPEAR_GPT0_BASE SPEAR3XX_ML1_TMR_BASE
30#define SPEAR_GPT0_CHAN0_IRQ SPEAR3XX_IRQ_CPU_GPT1_1
31#define SPEAR_GPT0_CHAN1_IRQ SPEAR3XX_IRQ_CPU_GPT1_2
32
33/* Add spear3xx family device structure declarations here */ 25/* Add spear3xx family device structure declarations here */
34extern struct amba_device spear3xx_gpio_device;
35extern struct amba_device spear3xx_uart_device;
36extern struct sys_timer spear3xx_timer; 26extern struct sys_timer spear3xx_timer;
27extern struct pl022_ssp_controller pl022_plat_data;
28extern struct pl08x_platform_data pl080_plat_data;
37 29
38/* Add spear3xx family function declarations here */ 30/* Add spear3xx family function declarations here */
39void __init spear3xx_clk_init(void); 31void __init spear_setup_timer(resource_size_t base, int irq);
40void __init spear_setup_timer(void);
41void __init spear3xx_map_io(void); 32void __init spear3xx_map_io(void);
42void __init spear3xx_init_irq(void); 33void __init spear3xx_dt_init_irq(void);
43void __init spear3xx_init(void);
44 34
45void spear_restart(char, const char *); 35void spear_restart(char, const char *);
46 36
@@ -99,9 +89,6 @@ extern struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50;
99 89
100/* spear300 declarations */ 90/* spear300 declarations */
101#ifdef CONFIG_MACH_SPEAR300 91#ifdef CONFIG_MACH_SPEAR300
102/* Add spear300 machine device structure declarations here */
103extern struct amba_device spear300_gpio1_device;
104
105/* pad mux modes */ 92/* pad mux modes */
106extern struct pmx_mode spear300_nand_mode; 93extern struct pmx_mode spear300_nand_mode;
107extern struct pmx_mode spear300_nor_mode; 94extern struct pmx_mode spear300_nor_mode;
@@ -133,16 +120,13 @@ extern struct pmx_dev spear300_pmx_telecom_sdhci_4bit;
133extern struct pmx_dev spear300_pmx_telecom_sdhci_8bit; 120extern struct pmx_dev spear300_pmx_telecom_sdhci_8bit;
134extern struct pmx_dev spear300_pmx_gpio1; 121extern struct pmx_dev spear300_pmx_gpio1;
135 122
136/* Add spear300 machine function declarations here */ 123/* Add spear300 machine declarations here */
137void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 124void __init spear300_clk_init(void);
138 u8 pmx_dev_count);
139 125
140#endif /* CONFIG_MACH_SPEAR300 */ 126#endif /* CONFIG_MACH_SPEAR300 */
141 127
142/* spear310 declarations */ 128/* spear310 declarations */
143#ifdef CONFIG_MACH_SPEAR310 129#ifdef CONFIG_MACH_SPEAR310
144/* Add spear310 machine device structure declarations here */
145
146/* pad mux devices */ 130/* pad mux devices */
147extern struct pmx_dev spear310_pmx_emi_cs_0_1_4_5; 131extern struct pmx_dev spear310_pmx_emi_cs_0_1_4_5;
148extern struct pmx_dev spear310_pmx_emi_cs_2_3; 132extern struct pmx_dev spear310_pmx_emi_cs_2_3;
@@ -153,16 +137,13 @@ extern struct pmx_dev spear310_pmx_fsmc;
153extern struct pmx_dev spear310_pmx_rs485_0_1; 137extern struct pmx_dev spear310_pmx_rs485_0_1;
154extern struct pmx_dev spear310_pmx_tdm0; 138extern struct pmx_dev spear310_pmx_tdm0;
155 139
156/* Add spear310 machine function declarations here */ 140/* Add spear310 machine declarations here */
157void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 141void __init spear310_clk_init(void);
158 u8 pmx_dev_count);
159 142
160#endif /* CONFIG_MACH_SPEAR310 */ 143#endif /* CONFIG_MACH_SPEAR310 */
161 144
162/* spear320 declarations */ 145/* spear320 declarations */
163#ifdef CONFIG_MACH_SPEAR320 146#ifdef CONFIG_MACH_SPEAR320
164/* Add spear320 machine device structure declarations here */
165
166/* pad mux modes */ 147/* pad mux modes */
167extern struct pmx_mode spear320_auto_net_smii_mode; 148extern struct pmx_mode spear320_auto_net_smii_mode;
168extern struct pmx_mode spear320_auto_net_mii_mode; 149extern struct pmx_mode spear320_auto_net_mii_mode;
@@ -193,9 +174,8 @@ extern struct pmx_dev spear320_pmx_smii0;
193extern struct pmx_dev spear320_pmx_smii1; 174extern struct pmx_dev spear320_pmx_smii1;
194extern struct pmx_dev spear320_pmx_i2c1; 175extern struct pmx_dev spear320_pmx_i2c1;
195 176
196/* Add spear320 machine function declarations here */ 177/* Add spear320 machine declarations here */
197void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 178void __init spear320_clk_init(void);
198 u8 pmx_dev_count);
199 179
200#endif /* CONFIG_MACH_SPEAR320 */ 180#endif /* CONFIG_MACH_SPEAR320 */
201 181
diff --git a/arch/arm/mach-spear3xx/include/mach/hardware.h b/arch/arm/mach-spear3xx/include/mach/hardware.h
index 4660c0d8ec0d..40a8c178f10d 100644
--- a/arch/arm/mach-spear3xx/include/mach/hardware.h
+++ b/arch/arm/mach-spear3xx/include/mach/hardware.h
@@ -1,23 +1 @@
1/* /* empty */
2 * arch/arm/mach-spear3xx/include/mach/hardware.h
3 *
4 * Hardware definitions for SPEAr3xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_HARDWARE_H
15#define __MACH_HARDWARE_H
16
17#include <plat/hardware.h>
18#include <mach/spear.h>
19
20/* Vitual to physical translation of statically mapped space */
21#define IO_ADDRESS(x) (x | 0xF0000000)
22
23#endif /* __MACH_HARDWARE_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/irqs.h b/arch/arm/mach-spear3xx/include/mach/irqs.h
index 6e265442808e..319620a1afb4 100644
--- a/arch/arm/mach-spear3xx/include/mach/irqs.h
+++ b/arch/arm/mach-spear3xx/include/mach/irqs.h
@@ -14,141 +14,15 @@
14#ifndef __MACH_IRQS_H 14#ifndef __MACH_IRQS_H
15#define __MACH_IRQS_H 15#define __MACH_IRQS_H
16 16
17/* SPEAr3xx IRQ definitions */ 17/* FIXME: probe all these from DT */
18#define SPEAR3XX_IRQ_HW_ACCEL_MOD_0 0
19#define SPEAR3XX_IRQ_INTRCOMM_RAS_ARM 1 18#define SPEAR3XX_IRQ_INTRCOMM_RAS_ARM 1
20#define SPEAR3XX_IRQ_CPU_GPT1_1 2 19#define SPEAR3XX_IRQ_CPU_GPT1_1 2
21#define SPEAR3XX_IRQ_CPU_GPT1_2 3
22#define SPEAR3XX_IRQ_BASIC_GPT1_1 4
23#define SPEAR3XX_IRQ_BASIC_GPT1_2 5
24#define SPEAR3XX_IRQ_BASIC_GPT2_1 6
25#define SPEAR3XX_IRQ_BASIC_GPT2_2 7
26#define SPEAR3XX_IRQ_BASIC_DMA 8
27#define SPEAR3XX_IRQ_BASIC_SMI 9
28#define SPEAR3XX_IRQ_BASIC_RTC 10
29#define SPEAR3XX_IRQ_BASIC_GPIO 11
30#define SPEAR3XX_IRQ_BASIC_WDT 12
31#define SPEAR3XX_IRQ_DDR_CONTROLLER 13
32#define SPEAR3XX_IRQ_SYS_ERROR 14
33#define SPEAR3XX_IRQ_WAKEUP_RCV 15
34#define SPEAR3XX_IRQ_JPEG 16
35#define SPEAR3XX_IRQ_IRDA 17
36#define SPEAR3XX_IRQ_ADC 18
37#define SPEAR3XX_IRQ_UART 19
38#define SPEAR3XX_IRQ_SSP 20
39#define SPEAR3XX_IRQ_I2C 21
40#define SPEAR3XX_IRQ_MAC_1 22
41#define SPEAR3XX_IRQ_MAC_2 23
42#define SPEAR3XX_IRQ_USB_DEV 24
43#define SPEAR3XX_IRQ_USB_H_OHCI_0 25
44#define SPEAR3XX_IRQ_USB_H_EHCI_0 26
45#define SPEAR3XX_IRQ_USB_H_EHCI_1 SPEAR3XX_IRQ_USB_H_EHCI_0
46#define SPEAR3XX_IRQ_USB_H_OHCI_1 27
47#define SPEAR3XX_IRQ_GEN_RAS_1 28 20#define SPEAR3XX_IRQ_GEN_RAS_1 28
48#define SPEAR3XX_IRQ_GEN_RAS_2 29 21#define SPEAR3XX_IRQ_GEN_RAS_2 29
49#define SPEAR3XX_IRQ_GEN_RAS_3 30 22#define SPEAR3XX_IRQ_GEN_RAS_3 30
50#define SPEAR3XX_IRQ_HW_ACCEL_MOD_1 31
51#define SPEAR3XX_IRQ_VIC_END 32 23#define SPEAR3XX_IRQ_VIC_END 32
52
53#define SPEAR3XX_VIRQ_START SPEAR3XX_IRQ_VIC_END 24#define SPEAR3XX_VIRQ_START SPEAR3XX_IRQ_VIC_END
54 25
55/* SPEAr300 Virtual irq definitions */ 26#define NR_IRQS 160
56/* IRQs sharing IRQ_GEN_RAS_1 */
57#define SPEAR300_VIRQ_IT_PERS_S (SPEAR3XX_VIRQ_START + 0)
58#define SPEAR300_VIRQ_IT_CHANGE_S (SPEAR3XX_VIRQ_START + 1)
59#define SPEAR300_VIRQ_I2S (SPEAR3XX_VIRQ_START + 2)
60#define SPEAR300_VIRQ_TDM (SPEAR3XX_VIRQ_START + 3)
61#define SPEAR300_VIRQ_CAMERA_L (SPEAR3XX_VIRQ_START + 4)
62#define SPEAR300_VIRQ_CAMERA_F (SPEAR3XX_VIRQ_START + 5)
63#define SPEAR300_VIRQ_CAMERA_V (SPEAR3XX_VIRQ_START + 6)
64#define SPEAR300_VIRQ_KEYBOARD (SPEAR3XX_VIRQ_START + 7)
65#define SPEAR300_VIRQ_GPIO1 (SPEAR3XX_VIRQ_START + 8)
66
67/* IRQs sharing IRQ_GEN_RAS_3 */
68#define SPEAR300_IRQ_CLCD SPEAR3XX_IRQ_GEN_RAS_3
69
70/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
71#define SPEAR300_IRQ_SDHCI SPEAR3XX_IRQ_INTRCOMM_RAS_ARM
72
73/* SPEAr310 Virtual irq definitions */
74/* IRQs sharing IRQ_GEN_RAS_1 */
75#define SPEAR310_VIRQ_SMII0 (SPEAR3XX_VIRQ_START + 0)
76#define SPEAR310_VIRQ_SMII1 (SPEAR3XX_VIRQ_START + 1)
77#define SPEAR310_VIRQ_SMII2 (SPEAR3XX_VIRQ_START + 2)
78#define SPEAR310_VIRQ_SMII3 (SPEAR3XX_VIRQ_START + 3)
79#define SPEAR310_VIRQ_WAKEUP_SMII0 (SPEAR3XX_VIRQ_START + 4)
80#define SPEAR310_VIRQ_WAKEUP_SMII1 (SPEAR3XX_VIRQ_START + 5)
81#define SPEAR310_VIRQ_WAKEUP_SMII2 (SPEAR3XX_VIRQ_START + 6)
82#define SPEAR310_VIRQ_WAKEUP_SMII3 (SPEAR3XX_VIRQ_START + 7)
83
84/* IRQs sharing IRQ_GEN_RAS_2 */
85#define SPEAR310_VIRQ_UART1 (SPEAR3XX_VIRQ_START + 8)
86#define SPEAR310_VIRQ_UART2 (SPEAR3XX_VIRQ_START + 9)
87#define SPEAR310_VIRQ_UART3 (SPEAR3XX_VIRQ_START + 10)
88#define SPEAR310_VIRQ_UART4 (SPEAR3XX_VIRQ_START + 11)
89#define SPEAR310_VIRQ_UART5 (SPEAR3XX_VIRQ_START + 12)
90
91/* IRQs sharing IRQ_GEN_RAS_3 */
92#define SPEAR310_VIRQ_EMI (SPEAR3XX_VIRQ_START + 13)
93#define SPEAR310_VIRQ_PLGPIO (SPEAR3XX_VIRQ_START + 14)
94
95/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
96#define SPEAR310_VIRQ_TDM_HDLC (SPEAR3XX_VIRQ_START + 15)
97#define SPEAR310_VIRQ_RS485_0 (SPEAR3XX_VIRQ_START + 16)
98#define SPEAR310_VIRQ_RS485_1 (SPEAR3XX_VIRQ_START + 17)
99
100/* SPEAr320 Virtual irq definitions */
101/* IRQs sharing IRQ_GEN_RAS_1 */
102#define SPEAR320_VIRQ_EMI (SPEAR3XX_VIRQ_START + 0)
103#define SPEAR320_VIRQ_CLCD (SPEAR3XX_VIRQ_START + 1)
104#define SPEAR320_VIRQ_SPP (SPEAR3XX_VIRQ_START + 2)
105
106/* IRQs sharing IRQ_GEN_RAS_2 */
107#define SPEAR320_IRQ_SDHCI SPEAR3XX_IRQ_GEN_RAS_2
108
109/* IRQs sharing IRQ_GEN_RAS_3 */
110#define SPEAR320_VIRQ_PLGPIO (SPEAR3XX_VIRQ_START + 3)
111#define SPEAR320_VIRQ_I2S_PLAY (SPEAR3XX_VIRQ_START + 4)
112#define SPEAR320_VIRQ_I2S_REC (SPEAR3XX_VIRQ_START + 5)
113
114/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
115#define SPEAR320_VIRQ_CANU (SPEAR3XX_VIRQ_START + 6)
116#define SPEAR320_VIRQ_CANL (SPEAR3XX_VIRQ_START + 7)
117#define SPEAR320_VIRQ_UART1 (SPEAR3XX_VIRQ_START + 8)
118#define SPEAR320_VIRQ_UART2 (SPEAR3XX_VIRQ_START + 9)
119#define SPEAR320_VIRQ_SSP1 (SPEAR3XX_VIRQ_START + 10)
120#define SPEAR320_VIRQ_SSP2 (SPEAR3XX_VIRQ_START + 11)
121#define SPEAR320_VIRQ_SMII0 (SPEAR3XX_VIRQ_START + 12)
122#define SPEAR320_VIRQ_MII1_SMII1 (SPEAR3XX_VIRQ_START + 13)
123#define SPEAR320_VIRQ_WAKEUP_SMII0 (SPEAR3XX_VIRQ_START + 14)
124#define SPEAR320_VIRQ_WAKEUP_MII1_SMII1 (SPEAR3XX_VIRQ_START + 15)
125#define SPEAR320_VIRQ_I2C1 (SPEAR3XX_VIRQ_START + 16)
126
127/*
128 * GPIO pins virtual irqs
129 * Use the lowest number for the GPIO virtual IRQs base on which subarchs
130 * we have compiled in
131 */
132#if defined(CONFIG_MACH_SPEAR310)
133#define SPEAR3XX_GPIO_INT_BASE (SPEAR3XX_VIRQ_START + 18)
134#elif defined(CONFIG_MACH_SPEAR320)
135#define SPEAR3XX_GPIO_INT_BASE (SPEAR3XX_VIRQ_START + 17)
136#else
137#define SPEAR3XX_GPIO_INT_BASE (SPEAR3XX_VIRQ_START + 9)
138#endif
139
140#define SPEAR300_GPIO1_INT_BASE (SPEAR3XX_GPIO_INT_BASE + 8)
141#define SPEAR3XX_PLGPIO_COUNT 102
142
143#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
144#define SPEAR3XX_PLGPIO_INT_BASE (SPEAR3XX_GPIO_INT_BASE + 8)
145#define SPEAR3XX_GPIO_INT_END (SPEAR3XX_PLGPIO_INT_BASE + \
146 SPEAR3XX_PLGPIO_COUNT)
147#else
148#define SPEAR3XX_GPIO_INT_END (SPEAR300_GPIO1_INT_BASE + 8)
149#endif
150
151#define SPEAR3XX_VIRQ_END SPEAR3XX_GPIO_INT_END
152#define NR_IRQS SPEAR3XX_VIRQ_END
153 27
154#endif /* __MACH_IRQS_H */ 28#endif /* __MACH_IRQS_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/misc_regs.h b/arch/arm/mach-spear3xx/include/mach/misc_regs.h
index 5bd8cd8d4852..e0ab72e61507 100644
--- a/arch/arm/mach-spear3xx/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear3xx/include/mach/misc_regs.h
@@ -14,151 +14,7 @@
14#ifndef __MACH_MISC_REGS_H 14#ifndef __MACH_MISC_REGS_H
15#define __MACH_MISC_REGS_H 15#define __MACH_MISC_REGS_H
16 16
17#include <mach/hardware.h>
18
19#define MISC_BASE IOMEM(VA_SPEAR3XX_ICM3_MISC_REG_BASE) 17#define MISC_BASE IOMEM(VA_SPEAR3XX_ICM3_MISC_REG_BASE)
20
21#define SOC_CFG_CTR (MISC_BASE + 0x000)
22#define DIAG_CFG_CTR (MISC_BASE + 0x004)
23#define PLL1_CTR (MISC_BASE + 0x008)
24#define PLL1_FRQ (MISC_BASE + 0x00C)
25#define PLL1_MOD (MISC_BASE + 0x010)
26#define PLL2_CTR (MISC_BASE + 0x014)
27/* PLL_CTR register masks */
28#define PLL_ENABLE 2
29#define PLL_MODE_SHIFT 4
30#define PLL_MODE_MASK 0x3
31#define PLL_MODE_NORMAL 0
32#define PLL_MODE_FRACTION 1
33#define PLL_MODE_DITH_DSB 2
34#define PLL_MODE_DITH_SSB 3
35
36#define PLL2_FRQ (MISC_BASE + 0x018)
37/* PLL FRQ register masks */
38#define PLL_DIV_N_SHIFT 0
39#define PLL_DIV_N_MASK 0xFF
40#define PLL_DIV_P_SHIFT 8
41#define PLL_DIV_P_MASK 0x7
42#define PLL_NORM_FDBK_M_SHIFT 24
43#define PLL_NORM_FDBK_M_MASK 0xFF
44#define PLL_DITH_FDBK_M_SHIFT 16
45#define PLL_DITH_FDBK_M_MASK 0xFFFF
46
47#define PLL2_MOD (MISC_BASE + 0x01C)
48#define PLL_CLK_CFG (MISC_BASE + 0x020)
49#define CORE_CLK_CFG (MISC_BASE + 0x024)
50/* CORE CLK CFG register masks */
51#define PLL_HCLK_RATIO_SHIFT 10
52#define PLL_HCLK_RATIO_MASK 0x3
53#define HCLK_PCLK_RATIO_SHIFT 8
54#define HCLK_PCLK_RATIO_MASK 0x3
55
56#define PERIP_CLK_CFG (MISC_BASE + 0x028)
57/* PERIP_CLK_CFG register masks */
58#define UART_CLK_SHIFT 4
59#define UART_CLK_MASK 0x1
60#define FIRDA_CLK_SHIFT 5
61#define FIRDA_CLK_MASK 0x3
62#define GPT0_CLK_SHIFT 8
63#define GPT1_CLK_SHIFT 11
64#define GPT2_CLK_SHIFT 12
65#define GPT_CLK_MASK 0x1
66#define AUX_CLK_PLL3_VAL 0
67#define AUX_CLK_PLL1_VAL 1
68
69#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
70/* PERIP1_CLK_ENB register masks */
71#define UART_CLK_ENB 3
72#define SSP_CLK_ENB 5
73#define I2C_CLK_ENB 7
74#define JPEG_CLK_ENB 8
75#define FIRDA_CLK_ENB 10
76#define GPT1_CLK_ENB 11
77#define GPT2_CLK_ENB 12
78#define ADC_CLK_ENB 15
79#define RTC_CLK_ENB 17
80#define GPIO_CLK_ENB 18
81#define DMA_CLK_ENB 19
82#define SMI_CLK_ENB 21
83#define GMAC_CLK_ENB 23
84#define USBD_CLK_ENB 24
85#define USBH_CLK_ENB 25
86#define C3_CLK_ENB 31
87
88#define SOC_CORE_ID (MISC_BASE + 0x030)
89#define RAS_CLK_ENB (MISC_BASE + 0x034)
90#define PERIP1_SOF_RST (MISC_BASE + 0x038)
91/* PERIP1_SOF_RST register masks */
92#define JPEG_SOF_RST 8
93
94#define SOC_USER_ID (MISC_BASE + 0x03C)
95#define RAS_SOF_RST (MISC_BASE + 0x040)
96#define PRSC1_CLK_CFG (MISC_BASE + 0x044)
97#define PRSC2_CLK_CFG (MISC_BASE + 0x048)
98#define PRSC3_CLK_CFG (MISC_BASE + 0x04C)
99/* gpt synthesizer register masks */
100#define GPT_MSCALE_SHIFT 0
101#define GPT_MSCALE_MASK 0xFFF
102#define GPT_NSCALE_SHIFT 12
103#define GPT_NSCALE_MASK 0xF
104
105#define AMEM_CLK_CFG (MISC_BASE + 0x050)
106#define EXPI_CLK_CFG (MISC_BASE + 0x054)
107#define CLCD_CLK_SYNT (MISC_BASE + 0x05C)
108#define FIRDA_CLK_SYNT (MISC_BASE + 0x060)
109#define UART_CLK_SYNT (MISC_BASE + 0x064)
110#define GMAC_CLK_SYNT (MISC_BASE + 0x068)
111#define RAS1_CLK_SYNT (MISC_BASE + 0x06C)
112#define RAS2_CLK_SYNT (MISC_BASE + 0x070)
113#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
114#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
115/* aux clk synthesiser register masks for irda to ras4 */
116#define AUX_SYNT_ENB 31
117#define AUX_EQ_SEL_SHIFT 30
118#define AUX_EQ_SEL_MASK 1
119#define AUX_EQ1_SEL 0
120#define AUX_EQ2_SEL 1
121#define AUX_XSCALE_SHIFT 16
122#define AUX_XSCALE_MASK 0xFFF
123#define AUX_YSCALE_SHIFT 0
124#define AUX_YSCALE_MASK 0xFFF
125
126#define ICM1_ARB_CFG (MISC_BASE + 0x07C)
127#define ICM2_ARB_CFG (MISC_BASE + 0x080)
128#define ICM3_ARB_CFG (MISC_BASE + 0x084)
129#define ICM4_ARB_CFG (MISC_BASE + 0x088)
130#define ICM5_ARB_CFG (MISC_BASE + 0x08C)
131#define ICM6_ARB_CFG (MISC_BASE + 0x090)
132#define ICM7_ARB_CFG (MISC_BASE + 0x094)
133#define ICM8_ARB_CFG (MISC_BASE + 0x098)
134#define ICM9_ARB_CFG (MISC_BASE + 0x09C)
135#define DMA_CHN_CFG (MISC_BASE + 0x0A0) 18#define DMA_CHN_CFG (MISC_BASE + 0x0A0)
136#define USB2_PHY_CFG (MISC_BASE + 0x0A4)
137#define GMAC_CFG_CTR (MISC_BASE + 0x0A8)
138#define EXPI_CFG_CTR (MISC_BASE + 0x0AC)
139#define PRC1_LOCK_CTR (MISC_BASE + 0x0C0)
140#define PRC2_LOCK_CTR (MISC_BASE + 0x0C4)
141#define PRC3_LOCK_CTR (MISC_BASE + 0x0C8)
142#define PRC4_LOCK_CTR (MISC_BASE + 0x0CC)
143#define PRC1_IRQ_CTR (MISC_BASE + 0x0D0)
144#define PRC2_IRQ_CTR (MISC_BASE + 0x0D4)
145#define PRC3_IRQ_CTR (MISC_BASE + 0x0D8)
146#define PRC4_IRQ_CTR (MISC_BASE + 0x0DC)
147#define PWRDOWN_CFG_CTR (MISC_BASE + 0x0E0)
148#define COMPSSTL_1V8_CFG (MISC_BASE + 0x0E4)
149#define COMPSSTL_2V5_CFG (MISC_BASE + 0x0E8)
150#define COMPCOR_3V3_CFG (MISC_BASE + 0x0EC)
151#define SSTLPAD_CFG_CTR (MISC_BASE + 0x0F0)
152#define BIST1_CFG_CTR (MISC_BASE + 0x0F4)
153#define BIST2_CFG_CTR (MISC_BASE + 0x0F8)
154#define BIST3_CFG_CTR (MISC_BASE + 0x0FC)
155#define BIST4_CFG_CTR (MISC_BASE + 0x100)
156#define BIST5_CFG_CTR (MISC_BASE + 0x104)
157#define BIST1_STS_RES (MISC_BASE + 0x108)
158#define BIST2_STS_RES (MISC_BASE + 0x10C)
159#define BIST3_STS_RES (MISC_BASE + 0x110)
160#define BIST4_STS_RES (MISC_BASE + 0x114)
161#define BIST5_STS_RES (MISC_BASE + 0x118)
162#define SYSERR_CFG_CTR (MISC_BASE + 0x11C)
163 19
164#endif /* __MACH_MISC_REGS_H */ 20#endif /* __MACH_MISC_REGS_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/spear.h b/arch/arm/mach-spear3xx/include/mach/spear.h
index 63fd98356919..6d4dadc67633 100644
--- a/arch/arm/mach-spear3xx/include/mach/spear.h
+++ b/arch/arm/mach-spear3xx/include/mach/spear.h
@@ -15,60 +15,27 @@
15#define __MACH_SPEAR3XX_H 15#define __MACH_SPEAR3XX_H
16 16
17#include <asm/memory.h> 17#include <asm/memory.h>
18#include <mach/spear300.h>
19#include <mach/spear310.h>
20#include <mach/spear320.h>
21
22#define SPEAR3XX_ML_SDRAM_BASE UL(0x00000000)
23
24#define SPEAR3XX_ICM9_BASE UL(0xC0000000)
25 18
26/* ICM1 - Low speed connection */ 19/* ICM1 - Low speed connection */
27#define SPEAR3XX_ICM1_2_BASE UL(0xD0000000) 20#define SPEAR3XX_ICM1_2_BASE UL(0xD0000000)
21#define VA_SPEAR3XX_ICM1_2_BASE UL(0xFD000000)
28#define SPEAR3XX_ICM1_UART_BASE UL(0xD0000000) 22#define SPEAR3XX_ICM1_UART_BASE UL(0xD0000000)
29#define VA_SPEAR3XX_ICM1_UART_BASE IO_ADDRESS(SPEAR3XX_ICM1_UART_BASE) 23#define VA_SPEAR3XX_ICM1_UART_BASE (VA_SPEAR3XX_ICM1_2_BASE | SPEAR3XX_ICM1_UART_BASE)
30#define SPEAR3XX_ICM1_ADC_BASE UL(0xD0080000)
31#define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000) 24#define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000)
32#define SPEAR3XX_ICM1_I2C_BASE UL(0xD0180000)
33#define SPEAR3XX_ICM1_JPEG_BASE UL(0xD0800000)
34#define SPEAR3XX_ICM1_IRDA_BASE UL(0xD1000000)
35#define SPEAR3XX_ICM1_SRAM_BASE UL(0xD2800000)
36
37/* ICM2 - Application Subsystem */
38#define SPEAR3XX_ICM2_HWACCEL0_BASE UL(0xD8800000)
39#define SPEAR3XX_ICM2_HWACCEL1_BASE UL(0xD9000000)
40
41/* ICM4 - High Speed Connection */
42#define SPEAR3XX_ICM4_BASE UL(0xE0000000)
43#define SPEAR3XX_ICM4_MII_BASE UL(0xE0800000)
44#define SPEAR3XX_ICM4_USBD_FIFO_BASE UL(0xE1000000)
45#define SPEAR3XX_ICM4_USBD_CSR_BASE UL(0xE1100000)
46#define SPEAR3XX_ICM4_USBD_PLDT_BASE UL(0xE1200000)
47#define SPEAR3XX_ICM4_USB_EHCI0_1_BASE UL(0xE1800000)
48#define SPEAR3XX_ICM4_USB_OHCI0_BASE UL(0xE1900000)
49#define SPEAR3XX_ICM4_USB_OHCI1_BASE UL(0xE2100000)
50#define SPEAR3XX_ICM4_USB_ARB_BASE UL(0xE2800000)
51 25
52/* ML1 - Multi Layer CPU Subsystem */ 26/* ML1 - Multi Layer CPU Subsystem */
53#define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000) 27#define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000)
54#define SPEAR3XX_ML1_TMR_BASE UL(0xF0000000) 28#define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000)
55#define SPEAR3XX_ML1_VIC_BASE UL(0xF1100000) 29#define SPEAR3XX_CPU_TMR_BASE UL(0xF0000000)
56#define VA_SPEAR3XX_ML1_VIC_BASE IO_ADDRESS(SPEAR3XX_ML1_VIC_BASE)
57 30
58/* ICM3 - Basic Subsystem */ 31/* ICM3 - Basic Subsystem */
59#define SPEAR3XX_ICM3_SMEM_BASE UL(0xF8000000)
60#define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) 32#define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
33#define VA_SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
61#define SPEAR3XX_ICM3_DMA_BASE UL(0xFC400000) 34#define SPEAR3XX_ICM3_DMA_BASE UL(0xFC400000)
62#define SPEAR3XX_ICM3_SDRAM_CTRL_BASE UL(0xFC600000)
63#define SPEAR3XX_ICM3_TMR0_BASE UL(0xFC800000)
64#define SPEAR3XX_ICM3_WDT_BASE UL(0xFC880000)
65#define SPEAR3XX_ICM3_RTC_BASE UL(0xFC900000)
66#define SPEAR3XX_ICM3_GPIO_BASE UL(0xFC980000)
67#define SPEAR3XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000) 35#define SPEAR3XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000)
68#define VA_SPEAR3XX_ICM3_SYS_CTRL_BASE IO_ADDRESS(SPEAR3XX_ICM3_SYS_CTRL_BASE) 36#define VA_SPEAR3XX_ICM3_SYS_CTRL_BASE (VA_SPEAR3XX_ICM3_SMI_CTRL_BASE | SPEAR3XX_ICM3_SYS_CTRL_BASE)
69#define SPEAR3XX_ICM3_MISC_REG_BASE UL(0xFCA80000) 37#define SPEAR3XX_ICM3_MISC_REG_BASE UL(0xFCA80000)
70#define VA_SPEAR3XX_ICM3_MISC_REG_BASE IO_ADDRESS(SPEAR3XX_ICM3_MISC_REG_BASE) 38#define VA_SPEAR3XX_ICM3_MISC_REG_BASE (VA_SPEAR3XX_ICM3_SMI_CTRL_BASE | SPEAR3XX_ICM3_MISC_REG_BASE)
71#define SPEAR3XX_ICM3_TMR1_BASE UL(0xFCB00000)
72 39
73/* Debug uart for linux, will be used for debug and uncompress messages */ 40/* Debug uart for linux, will be used for debug and uncompress messages */
74#define SPEAR_DBG_UART_BASE SPEAR3XX_ICM1_UART_BASE 41#define SPEAR_DBG_UART_BASE SPEAR3XX_ICM1_UART_BASE
diff --git a/arch/arm/mach-spear3xx/include/mach/spear300.h b/arch/arm/mach-spear3xx/include/mach/spear300.h
deleted file mode 100644
index 3b6ea0729040..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/spear300.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/spear300.h
3 *
4 * SPEAr300 Machine specific definition
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifdef CONFIG_MACH_SPEAR300
15
16#ifndef __MACH_SPEAR300_H
17#define __MACH_SPEAR300_H
18
19/* Base address of various IPs */
20#define SPEAR300_TELECOM_BASE UL(0x50000000)
21
22/* Interrupt registers offsets and masks */
23#define SPEAR300_INT_ENB_MASK_REG 0x54
24#define SPEAR300_INT_STS_MASK_REG 0x58
25#define SPEAR300_IT_PERS_S_IRQ_MASK (1 << 0)
26#define SPEAR300_IT_CHANGE_S_IRQ_MASK (1 << 1)
27#define SPEAR300_I2S_IRQ_MASK (1 << 2)
28#define SPEAR300_TDM_IRQ_MASK (1 << 3)
29#define SPEAR300_CAMERA_L_IRQ_MASK (1 << 4)
30#define SPEAR300_CAMERA_F_IRQ_MASK (1 << 5)
31#define SPEAR300_CAMERA_V_IRQ_MASK (1 << 6)
32#define SPEAR300_KEYBOARD_IRQ_MASK (1 << 7)
33#define SPEAR300_GPIO1_IRQ_MASK (1 << 8)
34
35#define SPEAR300_SHIRQ_RAS1_MASK 0x1FF
36
37#define SPEAR300_CLCD_BASE UL(0x60000000)
38#define SPEAR300_SDHCI_BASE UL(0x70000000)
39#define SPEAR300_NAND_0_BASE UL(0x80000000)
40#define SPEAR300_NAND_1_BASE UL(0x84000000)
41#define SPEAR300_NAND_2_BASE UL(0x88000000)
42#define SPEAR300_NAND_3_BASE UL(0x8c000000)
43#define SPEAR300_NOR_0_BASE UL(0x90000000)
44#define SPEAR300_NOR_1_BASE UL(0x91000000)
45#define SPEAR300_NOR_2_BASE UL(0x92000000)
46#define SPEAR300_NOR_3_BASE UL(0x93000000)
47#define SPEAR300_FSMC_BASE UL(0x94000000)
48#define SPEAR300_SOC_CONFIG_BASE UL(0x99000000)
49#define SPEAR300_KEYBOARD_BASE UL(0xA0000000)
50#define SPEAR300_GPIO_BASE UL(0xA9000000)
51
52#endif /* __MACH_SPEAR300_H */
53
54#endif /* CONFIG_MACH_SPEAR300 */
diff --git a/arch/arm/mach-spear3xx/include/mach/spear310.h b/arch/arm/mach-spear3xx/include/mach/spear310.h
deleted file mode 100644
index 1567d0da725f..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/spear310.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/spear310.h
3 *
4 * SPEAr310 Machine specific definition
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifdef CONFIG_MACH_SPEAR310
15
16#ifndef __MACH_SPEAR310_H
17#define __MACH_SPEAR310_H
18
19#define SPEAR310_NAND_BASE UL(0x40000000)
20#define SPEAR310_FSMC_BASE UL(0x44000000)
21#define SPEAR310_UART1_BASE UL(0xB2000000)
22#define SPEAR310_UART2_BASE UL(0xB2080000)
23#define SPEAR310_UART3_BASE UL(0xB2100000)
24#define SPEAR310_UART4_BASE UL(0xB2180000)
25#define SPEAR310_UART5_BASE UL(0xB2200000)
26#define SPEAR310_HDLC_BASE UL(0xB2800000)
27#define SPEAR310_RS485_0_BASE UL(0xB3000000)
28#define SPEAR310_RS485_1_BASE UL(0xB3800000)
29#define SPEAR310_SOC_CONFIG_BASE UL(0xB4000000)
30
31/* Interrupt registers offsets and masks */
32#define SPEAR310_INT_STS_MASK_REG 0x04
33#define SPEAR310_SMII0_IRQ_MASK (1 << 0)
34#define SPEAR310_SMII1_IRQ_MASK (1 << 1)
35#define SPEAR310_SMII2_IRQ_MASK (1 << 2)
36#define SPEAR310_SMII3_IRQ_MASK (1 << 3)
37#define SPEAR310_WAKEUP_SMII0_IRQ_MASK (1 << 4)
38#define SPEAR310_WAKEUP_SMII1_IRQ_MASK (1 << 5)
39#define SPEAR310_WAKEUP_SMII2_IRQ_MASK (1 << 6)
40#define SPEAR310_WAKEUP_SMII3_IRQ_MASK (1 << 7)
41#define SPEAR310_UART1_IRQ_MASK (1 << 8)
42#define SPEAR310_UART2_IRQ_MASK (1 << 9)
43#define SPEAR310_UART3_IRQ_MASK (1 << 10)
44#define SPEAR310_UART4_IRQ_MASK (1 << 11)
45#define SPEAR310_UART5_IRQ_MASK (1 << 12)
46#define SPEAR310_EMI_IRQ_MASK (1 << 13)
47#define SPEAR310_TDM_HDLC_IRQ_MASK (1 << 14)
48#define SPEAR310_RS485_0_IRQ_MASK (1 << 15)
49#define SPEAR310_RS485_1_IRQ_MASK (1 << 16)
50
51#define SPEAR310_SHIRQ_RAS1_MASK 0x000FF
52#define SPEAR310_SHIRQ_RAS2_MASK 0x01F00
53#define SPEAR310_SHIRQ_RAS3_MASK 0x02000
54#define SPEAR310_SHIRQ_INTRCOMM_RAS_MASK 0x1C000
55
56#endif /* __MACH_SPEAR310_H */
57
58#endif /* CONFIG_MACH_SPEAR310 */
diff --git a/arch/arm/mach-spear3xx/include/mach/spear320.h b/arch/arm/mach-spear3xx/include/mach/spear320.h
deleted file mode 100644
index 8cfa83fa1296..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/spear320.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/spear320.h
3 *
4 * SPEAr320 Machine specific definition
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifdef CONFIG_MACH_SPEAR320
15
16#ifndef __MACH_SPEAR320_H
17#define __MACH_SPEAR320_H
18
19#define SPEAR320_EMI_CTRL_BASE UL(0x40000000)
20#define SPEAR320_FSMC_BASE UL(0x4C000000)
21#define SPEAR320_NAND_BASE UL(0x50000000)
22#define SPEAR320_I2S_BASE UL(0x60000000)
23#define SPEAR320_SDHCI_BASE UL(0x70000000)
24#define SPEAR320_CLCD_BASE UL(0x90000000)
25#define SPEAR320_PAR_PORT_BASE UL(0xA0000000)
26#define SPEAR320_CAN0_BASE UL(0xA1000000)
27#define SPEAR320_CAN1_BASE UL(0xA2000000)
28#define SPEAR320_UART1_BASE UL(0xA3000000)
29#define SPEAR320_UART2_BASE UL(0xA4000000)
30#define SPEAR320_SSP0_BASE UL(0xA5000000)
31#define SPEAR320_SSP1_BASE UL(0xA6000000)
32#define SPEAR320_I2C_BASE UL(0xA7000000)
33#define SPEAR320_PWM_BASE UL(0xA8000000)
34#define SPEAR320_SMII0_BASE UL(0xAA000000)
35#define SPEAR320_SMII1_BASE UL(0xAB000000)
36#define SPEAR320_SOC_CONFIG_BASE UL(0xB3000000)
37
38/* Interrupt registers offsets and masks */
39#define SPEAR320_INT_STS_MASK_REG 0x04
40#define SPEAR320_INT_CLR_MASK_REG 0x04
41#define SPEAR320_INT_ENB_MASK_REG 0x08
42#define SPEAR320_GPIO_IRQ_MASK (1 << 0)
43#define SPEAR320_I2S_PLAY_IRQ_MASK (1 << 1)
44#define SPEAR320_I2S_REC_IRQ_MASK (1 << 2)
45#define SPEAR320_EMI_IRQ_MASK (1 << 7)
46#define SPEAR320_CLCD_IRQ_MASK (1 << 8)
47#define SPEAR320_SPP_IRQ_MASK (1 << 9)
48#define SPEAR320_SDHCI_IRQ_MASK (1 << 10)
49#define SPEAR320_CAN_U_IRQ_MASK (1 << 11)
50#define SPEAR320_CAN_L_IRQ_MASK (1 << 12)
51#define SPEAR320_UART1_IRQ_MASK (1 << 13)
52#define SPEAR320_UART2_IRQ_MASK (1 << 14)
53#define SPEAR320_SSP1_IRQ_MASK (1 << 15)
54#define SPEAR320_SSP2_IRQ_MASK (1 << 16)
55#define SPEAR320_SMII0_IRQ_MASK (1 << 17)
56#define SPEAR320_MII1_SMII1_IRQ_MASK (1 << 18)
57#define SPEAR320_WAKEUP_SMII0_IRQ_MASK (1 << 19)
58#define SPEAR320_WAKEUP_MII1_SMII1_IRQ_MASK (1 << 20)
59#define SPEAR320_I2C1_IRQ_MASK (1 << 21)
60
61#define SPEAR320_SHIRQ_RAS1_MASK 0x000380
62#define SPEAR320_SHIRQ_RAS3_MASK 0x000007
63#define SPEAR320_SHIRQ_INTRCOMM_RAS_MASK 0x3FF800
64
65#endif /* __MACH_SPEAR320_H */
66
67#endif /* CONFIG_MACH_SPEAR320 */
diff --git a/arch/arm/mach-spear3xx/spear300.c b/arch/arm/mach-spear3xx/spear300.c
index f7db66812abb..febcdd8d4e92 100644
--- a/arch/arm/mach-spear3xx/spear300.c
+++ b/arch/arm/mach-spear3xx/spear300.c
@@ -3,21 +3,62 @@
3 * 3 *
4 * SPEAr300 machine source file 4 * SPEAr300 machine source file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.kumar@st.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/types.h> 14#define pr_fmt(fmt) "SPEAr300: " fmt
15#include <linux/amba/pl061.h> 15
16#include <linux/ptrace.h> 16#include <linux/amba/pl08x.h>
17#include <asm/irq.h> 17#include <linux/of_platform.h>
18#include <asm/hardware/vic.h>
19#include <asm/mach/arch.h>
18#include <plat/shirq.h> 20#include <plat/shirq.h>
19#include <mach/generic.h> 21#include <mach/generic.h>
20#include <mach/hardware.h> 22#include <mach/spear.h>
23
24/* Base address of various IPs */
25#define SPEAR300_TELECOM_BASE UL(0x50000000)
26
27/* Interrupt registers offsets and masks */
28#define SPEAR300_INT_ENB_MASK_REG 0x54
29#define SPEAR300_INT_STS_MASK_REG 0x58
30#define SPEAR300_IT_PERS_S_IRQ_MASK (1 << 0)
31#define SPEAR300_IT_CHANGE_S_IRQ_MASK (1 << 1)
32#define SPEAR300_I2S_IRQ_MASK (1 << 2)
33#define SPEAR300_TDM_IRQ_MASK (1 << 3)
34#define SPEAR300_CAMERA_L_IRQ_MASK (1 << 4)
35#define SPEAR300_CAMERA_F_IRQ_MASK (1 << 5)
36#define SPEAR300_CAMERA_V_IRQ_MASK (1 << 6)
37#define SPEAR300_KEYBOARD_IRQ_MASK (1 << 7)
38#define SPEAR300_GPIO1_IRQ_MASK (1 << 8)
39
40#define SPEAR300_SHIRQ_RAS1_MASK 0x1FF
41
42#define SPEAR300_SOC_CONFIG_BASE UL(0x99000000)
43
44
45/* SPEAr300 Virtual irq definitions */
46/* IRQs sharing IRQ_GEN_RAS_1 */
47#define SPEAR300_VIRQ_IT_PERS_S (SPEAR3XX_VIRQ_START + 0)
48#define SPEAR300_VIRQ_IT_CHANGE_S (SPEAR3XX_VIRQ_START + 1)
49#define SPEAR300_VIRQ_I2S (SPEAR3XX_VIRQ_START + 2)
50#define SPEAR300_VIRQ_TDM (SPEAR3XX_VIRQ_START + 3)
51#define SPEAR300_VIRQ_CAMERA_L (SPEAR3XX_VIRQ_START + 4)
52#define SPEAR300_VIRQ_CAMERA_F (SPEAR3XX_VIRQ_START + 5)
53#define SPEAR300_VIRQ_CAMERA_V (SPEAR3XX_VIRQ_START + 6)
54#define SPEAR300_VIRQ_KEYBOARD (SPEAR3XX_VIRQ_START + 7)
55#define SPEAR300_VIRQ_GPIO1 (SPEAR3XX_VIRQ_START + 8)
56
57/* IRQs sharing IRQ_GEN_RAS_3 */
58#define SPEAR300_IRQ_CLCD SPEAR3XX_IRQ_GEN_RAS_3
59
60/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
61#define SPEAR300_IRQ_SDHCI SPEAR3XX_IRQ_INTRCOMM_RAS_ARM
21 62
22/* pad multiplexing support */ 63/* pad multiplexing support */
23/* muxing registers */ 64/* muxing registers */
@@ -423,45 +464,275 @@ static struct spear_shirq shirq_ras1 = {
423 }, 464 },
424}; 465};
425 466
426/* Add spear300 specific devices here */ 467/* padmux devices to enable */
427/* arm gpio1 device registration */ 468static struct pmx_dev *spear300_evb_pmx_devs[] = {
428static struct pl061_platform_data gpio1_plat_data = { 469 /* spear3xx specific devices */
429 .gpio_base = 8, 470 &spear3xx_pmx_i2c,
430 .irq_base = SPEAR300_GPIO1_INT_BASE, 471 &spear3xx_pmx_ssp_cs,
472 &spear3xx_pmx_ssp,
473 &spear3xx_pmx_mii,
474 &spear3xx_pmx_uart0,
475
476 /* spear300 specific devices */
477 &spear300_pmx_fsmc_2_chips,
478 &spear300_pmx_clcd,
479 &spear300_pmx_telecom_sdhci_4bit,
480 &spear300_pmx_gpio1,
431}; 481};
432 482
433AMBA_APB_DEVICE(spear300_gpio1, "gpio1", 0, SPEAR300_GPIO_BASE, 483/* DMAC platform data's slave info */
434 {SPEAR300_VIRQ_GPIO1}, &gpio1_plat_data); 484struct pl08x_channel_data spear300_dma_info[] = {
485 {
486 .bus_id = "uart0_rx",
487 .min_signal = 2,
488 .max_signal = 2,
489 .muxval = 0,
490 .cctl = 0,
491 .periph_buses = PL08X_AHB1,
492 }, {
493 .bus_id = "uart0_tx",
494 .min_signal = 3,
495 .max_signal = 3,
496 .muxval = 0,
497 .cctl = 0,
498 .periph_buses = PL08X_AHB1,
499 }, {
500 .bus_id = "ssp0_rx",
501 .min_signal = 8,
502 .max_signal = 8,
503 .muxval = 0,
504 .cctl = 0,
505 .periph_buses = PL08X_AHB1,
506 }, {
507 .bus_id = "ssp0_tx",
508 .min_signal = 9,
509 .max_signal = 9,
510 .muxval = 0,
511 .cctl = 0,
512 .periph_buses = PL08X_AHB1,
513 }, {
514 .bus_id = "i2c_rx",
515 .min_signal = 10,
516 .max_signal = 10,
517 .muxval = 0,
518 .cctl = 0,
519 .periph_buses = PL08X_AHB1,
520 }, {
521 .bus_id = "i2c_tx",
522 .min_signal = 11,
523 .max_signal = 11,
524 .muxval = 0,
525 .cctl = 0,
526 .periph_buses = PL08X_AHB1,
527 }, {
528 .bus_id = "irda",
529 .min_signal = 12,
530 .max_signal = 12,
531 .muxval = 0,
532 .cctl = 0,
533 .periph_buses = PL08X_AHB1,
534 }, {
535 .bus_id = "adc",
536 .min_signal = 13,
537 .max_signal = 13,
538 .muxval = 0,
539 .cctl = 0,
540 .periph_buses = PL08X_AHB1,
541 }, {
542 .bus_id = "to_jpeg",
543 .min_signal = 14,
544 .max_signal = 14,
545 .muxval = 0,
546 .cctl = 0,
547 .periph_buses = PL08X_AHB1,
548 }, {
549 .bus_id = "from_jpeg",
550 .min_signal = 15,
551 .max_signal = 15,
552 .muxval = 0,
553 .cctl = 0,
554 .periph_buses = PL08X_AHB1,
555 }, {
556 .bus_id = "ras0_rx",
557 .min_signal = 0,
558 .max_signal = 0,
559 .muxval = 1,
560 .cctl = 0,
561 .periph_buses = PL08X_AHB1,
562 }, {
563 .bus_id = "ras0_tx",
564 .min_signal = 1,
565 .max_signal = 1,
566 .muxval = 1,
567 .cctl = 0,
568 .periph_buses = PL08X_AHB1,
569 }, {
570 .bus_id = "ras1_rx",
571 .min_signal = 2,
572 .max_signal = 2,
573 .muxval = 1,
574 .cctl = 0,
575 .periph_buses = PL08X_AHB1,
576 }, {
577 .bus_id = "ras1_tx",
578 .min_signal = 3,
579 .max_signal = 3,
580 .muxval = 1,
581 .cctl = 0,
582 .periph_buses = PL08X_AHB1,
583 }, {
584 .bus_id = "ras2_rx",
585 .min_signal = 4,
586 .max_signal = 4,
587 .muxval = 1,
588 .cctl = 0,
589 .periph_buses = PL08X_AHB1,
590 }, {
591 .bus_id = "ras2_tx",
592 .min_signal = 5,
593 .max_signal = 5,
594 .muxval = 1,
595 .cctl = 0,
596 .periph_buses = PL08X_AHB1,
597 }, {
598 .bus_id = "ras3_rx",
599 .min_signal = 6,
600 .max_signal = 6,
601 .muxval = 1,
602 .cctl = 0,
603 .periph_buses = PL08X_AHB1,
604 }, {
605 .bus_id = "ras3_tx",
606 .min_signal = 7,
607 .max_signal = 7,
608 .muxval = 1,
609 .cctl = 0,
610 .periph_buses = PL08X_AHB1,
611 }, {
612 .bus_id = "ras4_rx",
613 .min_signal = 8,
614 .max_signal = 8,
615 .muxval = 1,
616 .cctl = 0,
617 .periph_buses = PL08X_AHB1,
618 }, {
619 .bus_id = "ras4_tx",
620 .min_signal = 9,
621 .max_signal = 9,
622 .muxval = 1,
623 .cctl = 0,
624 .periph_buses = PL08X_AHB1,
625 }, {
626 .bus_id = "ras5_rx",
627 .min_signal = 10,
628 .max_signal = 10,
629 .muxval = 1,
630 .cctl = 0,
631 .periph_buses = PL08X_AHB1,
632 }, {
633 .bus_id = "ras5_tx",
634 .min_signal = 11,
635 .max_signal = 11,
636 .muxval = 1,
637 .cctl = 0,
638 .periph_buses = PL08X_AHB1,
639 }, {
640 .bus_id = "ras6_rx",
641 .min_signal = 12,
642 .max_signal = 12,
643 .muxval = 1,
644 .cctl = 0,
645 .periph_buses = PL08X_AHB1,
646 }, {
647 .bus_id = "ras6_tx",
648 .min_signal = 13,
649 .max_signal = 13,
650 .muxval = 1,
651 .cctl = 0,
652 .periph_buses = PL08X_AHB1,
653 }, {
654 .bus_id = "ras7_rx",
655 .min_signal = 14,
656 .max_signal = 14,
657 .muxval = 1,
658 .cctl = 0,
659 .periph_buses = PL08X_AHB1,
660 }, {
661 .bus_id = "ras7_tx",
662 .min_signal = 15,
663 .max_signal = 15,
664 .muxval = 1,
665 .cctl = 0,
666 .periph_buses = PL08X_AHB1,
667 },
668};
435 669
436/* spear300 routines */ 670/* Add SPEAr300 auxdata to pass platform data */
437void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 671static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = {
438 u8 pmx_dev_count) 672 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
673 &pl022_plat_data),
674 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL,
675 &pl080_plat_data),
676 {}
677};
678
679static void __init spear300_dt_init(void)
439{ 680{
440 int ret = 0; 681 int ret = -EINVAL;
682
683 pl080_plat_data.slave_channels = spear300_dma_info;
684 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info);
441 685
442 /* call spear3xx family common init function */ 686 of_platform_populate(NULL, of_default_bus_match_table,
443 spear3xx_init(); 687 spear300_auxdata_lookup, NULL);
444 688
445 /* shared irq registration */ 689 /* shared irq registration */
446 shirq_ras1.regs.base = ioremap(SPEAR300_TELECOM_BASE, SZ_4K); 690 shirq_ras1.regs.base = ioremap(SPEAR300_TELECOM_BASE, SZ_4K);
447 if (shirq_ras1.regs.base) { 691 if (shirq_ras1.regs.base) {
448 ret = spear_shirq_register(&shirq_ras1); 692 ret = spear_shirq_register(&shirq_ras1);
449 if (ret) 693 if (ret)
450 printk(KERN_ERR "Error registering Shared IRQ\n"); 694 pr_err("Error registering Shared IRQ\n");
451 } 695 }
452 696
453 /* pmx initialization */ 697 if (of_machine_is_compatible("st,spear300-evb")) {
454 pmx_driver.mode = pmx_mode; 698 /* pmx initialization */
455 pmx_driver.devs = pmx_devs; 699 pmx_driver.mode = &spear300_photo_frame_mode;
456 pmx_driver.devs_count = pmx_dev_count; 700 pmx_driver.devs = spear300_evb_pmx_devs;
701 pmx_driver.devs_count = ARRAY_SIZE(spear300_evb_pmx_devs);
702
703 pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE, SZ_4K);
704 if (pmx_driver.base) {
705 ret = pmx_register(&pmx_driver);
706 if (ret)
707 pr_err("padmux: registration failed. err no: %d\n",
708 ret);
709 /* Free Mapping, device selection already done */
710 iounmap(pmx_driver.base);
711 }
457 712
458 pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE, SZ_4K);
459 if (pmx_driver.base) {
460 ret = pmx_register(&pmx_driver);
461 if (ret) 713 if (ret)
462 printk(KERN_ERR "padmux: registration failed. err no" 714 pr_err("Initialization Failed");
463 ": %d\n", ret);
464 /* Free Mapping, device selection already done */
465 iounmap(pmx_driver.base);
466 } 715 }
467} 716}
717
718static const char * const spear300_dt_board_compat[] = {
719 "st,spear300",
720 "st,spear300-evb",
721 NULL,
722};
723
724static void __init spear300_map_io(void)
725{
726 spear3xx_map_io();
727 spear300_clk_init();
728}
729
730DT_MACHINE_START(SPEAR300_DT, "ST SPEAr300 SoC with Flattened Device Tree")
731 .map_io = spear300_map_io,
732 .init_irq = spear3xx_dt_init_irq,
733 .handle_irq = vic_handle_irq,
734 .timer = &spear3xx_timer,
735 .init_machine = spear300_dt_init,
736 .restart = spear_restart,
737 .dt_compat = spear300_dt_board_compat,
738MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear300_evb.c b/arch/arm/mach-spear3xx/spear300_evb.c
deleted file mode 100644
index 3462ab9d6122..000000000000
--- a/arch/arm/mach-spear3xx/spear300_evb.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/spear300_evb.c
3 *
4 * SPEAr300 evaluation board source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <asm/hardware/vic.h>
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19
20/* padmux devices to enable */
21static struct pmx_dev *pmx_devs[] = {
22 /* spear3xx specific devices */
23 &spear3xx_pmx_i2c,
24 &spear3xx_pmx_ssp_cs,
25 &spear3xx_pmx_ssp,
26 &spear3xx_pmx_mii,
27 &spear3xx_pmx_uart0,
28
29 /* spear300 specific devices */
30 &spear300_pmx_fsmc_2_chips,
31 &spear300_pmx_clcd,
32 &spear300_pmx_telecom_sdhci_4bit,
33 &spear300_pmx_gpio1,
34};
35
36static struct amba_device *amba_devs[] __initdata = {
37 /* spear3xx specific devices */
38 &spear3xx_gpio_device,
39 &spear3xx_uart_device,
40
41 /* spear300 specific devices */
42 &spear300_gpio1_device,
43};
44
45static struct platform_device *plat_devs[] __initdata = {
46 /* spear3xx specific devices */
47
48 /* spear300 specific devices */
49};
50
51static void __init spear300_evb_init(void)
52{
53 unsigned int i;
54
55 /* call spear300 machine init function */
56 spear300_init(&spear300_photo_frame_mode, pmx_devs,
57 ARRAY_SIZE(pmx_devs));
58
59 /* Add Platform Devices */
60 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
61
62 /* Add Amba Devices */
63 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
64 amba_device_register(amba_devs[i], &iomem_resource);
65}
66
67MACHINE_START(SPEAR300, "ST-SPEAR300-EVB")
68 .atag_offset = 0x100,
69 .map_io = spear3xx_map_io,
70 .init_irq = spear3xx_init_irq,
71 .handle_irq = vic_handle_irq,
72 .timer = &spear3xx_timer,
73 .init_machine = spear300_evb_init,
74 .restart = spear_restart,
75MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear310.c b/arch/arm/mach-spear3xx/spear310.c
index febaa6fcfb6a..b26e41566b50 100644
--- a/arch/arm/mach-spear3xx/spear310.c
+++ b/arch/arm/mach-spear3xx/spear310.c
@@ -3,19 +3,84 @@
3 * 3 *
4 * SPEAr310 machine source file 4 * SPEAr310 machine source file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.kumar@st.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/ptrace.h> 14#define pr_fmt(fmt) "SPEAr310: " fmt
15#include <asm/irq.h> 15
16#include <linux/amba/pl08x.h>
17#include <linux/amba/serial.h>
18#include <linux/of_platform.h>
19#include <asm/hardware/vic.h>
20#include <asm/mach/arch.h>
16#include <plat/shirq.h> 21#include <plat/shirq.h>
17#include <mach/generic.h> 22#include <mach/generic.h>
18#include <mach/hardware.h> 23#include <mach/spear.h>
24
25#define SPEAR310_UART1_BASE UL(0xB2000000)
26#define SPEAR310_UART2_BASE UL(0xB2080000)
27#define SPEAR310_UART3_BASE UL(0xB2100000)
28#define SPEAR310_UART4_BASE UL(0xB2180000)
29#define SPEAR310_UART5_BASE UL(0xB2200000)
30#define SPEAR310_SOC_CONFIG_BASE UL(0xB4000000)
31
32/* Interrupt registers offsets and masks */
33#define SPEAR310_INT_STS_MASK_REG 0x04
34#define SPEAR310_SMII0_IRQ_MASK (1 << 0)
35#define SPEAR310_SMII1_IRQ_MASK (1 << 1)
36#define SPEAR310_SMII2_IRQ_MASK (1 << 2)
37#define SPEAR310_SMII3_IRQ_MASK (1 << 3)
38#define SPEAR310_WAKEUP_SMII0_IRQ_MASK (1 << 4)
39#define SPEAR310_WAKEUP_SMII1_IRQ_MASK (1 << 5)
40#define SPEAR310_WAKEUP_SMII2_IRQ_MASK (1 << 6)
41#define SPEAR310_WAKEUP_SMII3_IRQ_MASK (1 << 7)
42#define SPEAR310_UART1_IRQ_MASK (1 << 8)
43#define SPEAR310_UART2_IRQ_MASK (1 << 9)
44#define SPEAR310_UART3_IRQ_MASK (1 << 10)
45#define SPEAR310_UART4_IRQ_MASK (1 << 11)
46#define SPEAR310_UART5_IRQ_MASK (1 << 12)
47#define SPEAR310_EMI_IRQ_MASK (1 << 13)
48#define SPEAR310_TDM_HDLC_IRQ_MASK (1 << 14)
49#define SPEAR310_RS485_0_IRQ_MASK (1 << 15)
50#define SPEAR310_RS485_1_IRQ_MASK (1 << 16)
51
52#define SPEAR310_SHIRQ_RAS1_MASK 0x000FF
53#define SPEAR310_SHIRQ_RAS2_MASK 0x01F00
54#define SPEAR310_SHIRQ_RAS3_MASK 0x02000
55#define SPEAR310_SHIRQ_INTRCOMM_RAS_MASK 0x1C000
56
57/* SPEAr310 Virtual irq definitions */
58/* IRQs sharing IRQ_GEN_RAS_1 */
59#define SPEAR310_VIRQ_SMII0 (SPEAR3XX_VIRQ_START + 0)
60#define SPEAR310_VIRQ_SMII1 (SPEAR3XX_VIRQ_START + 1)
61#define SPEAR310_VIRQ_SMII2 (SPEAR3XX_VIRQ_START + 2)
62#define SPEAR310_VIRQ_SMII3 (SPEAR3XX_VIRQ_START + 3)
63#define SPEAR310_VIRQ_WAKEUP_SMII0 (SPEAR3XX_VIRQ_START + 4)
64#define SPEAR310_VIRQ_WAKEUP_SMII1 (SPEAR3XX_VIRQ_START + 5)
65#define SPEAR310_VIRQ_WAKEUP_SMII2 (SPEAR3XX_VIRQ_START + 6)
66#define SPEAR310_VIRQ_WAKEUP_SMII3 (SPEAR3XX_VIRQ_START + 7)
67
68/* IRQs sharing IRQ_GEN_RAS_2 */
69#define SPEAR310_VIRQ_UART1 (SPEAR3XX_VIRQ_START + 8)
70#define SPEAR310_VIRQ_UART2 (SPEAR3XX_VIRQ_START + 9)
71#define SPEAR310_VIRQ_UART3 (SPEAR3XX_VIRQ_START + 10)
72#define SPEAR310_VIRQ_UART4 (SPEAR3XX_VIRQ_START + 11)
73#define SPEAR310_VIRQ_UART5 (SPEAR3XX_VIRQ_START + 12)
74
75/* IRQs sharing IRQ_GEN_RAS_3 */
76#define SPEAR310_VIRQ_EMI (SPEAR3XX_VIRQ_START + 13)
77#define SPEAR310_VIRQ_PLGPIO (SPEAR3XX_VIRQ_START + 14)
78
79/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
80#define SPEAR310_VIRQ_TDM_HDLC (SPEAR3XX_VIRQ_START + 15)
81#define SPEAR310_VIRQ_RS485_0 (SPEAR3XX_VIRQ_START + 16)
82#define SPEAR310_VIRQ_RS485_1 (SPEAR3XX_VIRQ_START + 17)
83
19 84
20/* pad multiplexing support */ 85/* pad multiplexing support */
21/* muxing registers */ 86/* muxing registers */
@@ -255,17 +320,271 @@ static struct spear_shirq shirq_intrcomm_ras = {
255 }, 320 },
256}; 321};
257 322
258/* Add spear310 specific devices here */ 323/* padmux devices to enable */
324static struct pmx_dev *spear310_evb_pmx_devs[] = {
325 /* spear3xx specific devices */
326 &spear3xx_pmx_i2c,
327 &spear3xx_pmx_ssp,
328 &spear3xx_pmx_gpio_pin0,
329 &spear3xx_pmx_gpio_pin1,
330 &spear3xx_pmx_gpio_pin2,
331 &spear3xx_pmx_gpio_pin3,
332 &spear3xx_pmx_gpio_pin4,
333 &spear3xx_pmx_gpio_pin5,
334 &spear3xx_pmx_uart0,
335
336 /* spear310 specific devices */
337 &spear310_pmx_emi_cs_0_1_4_5,
338 &spear310_pmx_emi_cs_2_3,
339 &spear310_pmx_uart1,
340 &spear310_pmx_uart2,
341 &spear310_pmx_uart3_4_5,
342 &spear310_pmx_fsmc,
343 &spear310_pmx_rs485_0_1,
344 &spear310_pmx_tdm0,
345};
259 346
260/* spear310 routines */ 347/* DMAC platform data's slave info */
261void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 348struct pl08x_channel_data spear310_dma_info[] = {
262 u8 pmx_dev_count) 349 {
350 .bus_id = "uart0_rx",
351 .min_signal = 2,
352 .max_signal = 2,
353 .muxval = 0,
354 .cctl = 0,
355 .periph_buses = PL08X_AHB1,
356 }, {
357 .bus_id = "uart0_tx",
358 .min_signal = 3,
359 .max_signal = 3,
360 .muxval = 0,
361 .cctl = 0,
362 .periph_buses = PL08X_AHB1,
363 }, {
364 .bus_id = "ssp0_rx",
365 .min_signal = 8,
366 .max_signal = 8,
367 .muxval = 0,
368 .cctl = 0,
369 .periph_buses = PL08X_AHB1,
370 }, {
371 .bus_id = "ssp0_tx",
372 .min_signal = 9,
373 .max_signal = 9,
374 .muxval = 0,
375 .cctl = 0,
376 .periph_buses = PL08X_AHB1,
377 }, {
378 .bus_id = "i2c_rx",
379 .min_signal = 10,
380 .max_signal = 10,
381 .muxval = 0,
382 .cctl = 0,
383 .periph_buses = PL08X_AHB1,
384 }, {
385 .bus_id = "i2c_tx",
386 .min_signal = 11,
387 .max_signal = 11,
388 .muxval = 0,
389 .cctl = 0,
390 .periph_buses = PL08X_AHB1,
391 }, {
392 .bus_id = "irda",
393 .min_signal = 12,
394 .max_signal = 12,
395 .muxval = 0,
396 .cctl = 0,
397 .periph_buses = PL08X_AHB1,
398 }, {
399 .bus_id = "adc",
400 .min_signal = 13,
401 .max_signal = 13,
402 .muxval = 0,
403 .cctl = 0,
404 .periph_buses = PL08X_AHB1,
405 }, {
406 .bus_id = "to_jpeg",
407 .min_signal = 14,
408 .max_signal = 14,
409 .muxval = 0,
410 .cctl = 0,
411 .periph_buses = PL08X_AHB1,
412 }, {
413 .bus_id = "from_jpeg",
414 .min_signal = 15,
415 .max_signal = 15,
416 .muxval = 0,
417 .cctl = 0,
418 .periph_buses = PL08X_AHB1,
419 }, {
420 .bus_id = "uart1_rx",
421 .min_signal = 0,
422 .max_signal = 0,
423 .muxval = 1,
424 .cctl = 0,
425 .periph_buses = PL08X_AHB1,
426 }, {
427 .bus_id = "uart1_tx",
428 .min_signal = 1,
429 .max_signal = 1,
430 .muxval = 1,
431 .cctl = 0,
432 .periph_buses = PL08X_AHB1,
433 }, {
434 .bus_id = "uart2_rx",
435 .min_signal = 2,
436 .max_signal = 2,
437 .muxval = 1,
438 .cctl = 0,
439 .periph_buses = PL08X_AHB1,
440 }, {
441 .bus_id = "uart2_tx",
442 .min_signal = 3,
443 .max_signal = 3,
444 .muxval = 1,
445 .cctl = 0,
446 .periph_buses = PL08X_AHB1,
447 }, {
448 .bus_id = "uart3_rx",
449 .min_signal = 4,
450 .max_signal = 4,
451 .muxval = 1,
452 .cctl = 0,
453 .periph_buses = PL08X_AHB1,
454 }, {
455 .bus_id = "uart3_tx",
456 .min_signal = 5,
457 .max_signal = 5,
458 .muxval = 1,
459 .cctl = 0,
460 .periph_buses = PL08X_AHB1,
461 }, {
462 .bus_id = "uart4_rx",
463 .min_signal = 6,
464 .max_signal = 6,
465 .muxval = 1,
466 .cctl = 0,
467 .periph_buses = PL08X_AHB1,
468 }, {
469 .bus_id = "uart4_tx",
470 .min_signal = 7,
471 .max_signal = 7,
472 .muxval = 1,
473 .cctl = 0,
474 .periph_buses = PL08X_AHB1,
475 }, {
476 .bus_id = "uart5_rx",
477 .min_signal = 8,
478 .max_signal = 8,
479 .muxval = 1,
480 .cctl = 0,
481 .periph_buses = PL08X_AHB1,
482 }, {
483 .bus_id = "uart5_tx",
484 .min_signal = 9,
485 .max_signal = 9,
486 .muxval = 1,
487 .cctl = 0,
488 .periph_buses = PL08X_AHB1,
489 }, {
490 .bus_id = "ras5_rx",
491 .min_signal = 10,
492 .max_signal = 10,
493 .muxval = 1,
494 .cctl = 0,
495 .periph_buses = PL08X_AHB1,
496 }, {
497 .bus_id = "ras5_tx",
498 .min_signal = 11,
499 .max_signal = 11,
500 .muxval = 1,
501 .cctl = 0,
502 .periph_buses = PL08X_AHB1,
503 }, {
504 .bus_id = "ras6_rx",
505 .min_signal = 12,
506 .max_signal = 12,
507 .muxval = 1,
508 .cctl = 0,
509 .periph_buses = PL08X_AHB1,
510 }, {
511 .bus_id = "ras6_tx",
512 .min_signal = 13,
513 .max_signal = 13,
514 .muxval = 1,
515 .cctl = 0,
516 .periph_buses = PL08X_AHB1,
517 }, {
518 .bus_id = "ras7_rx",
519 .min_signal = 14,
520 .max_signal = 14,
521 .muxval = 1,
522 .cctl = 0,
523 .periph_buses = PL08X_AHB1,
524 }, {
525 .bus_id = "ras7_tx",
526 .min_signal = 15,
527 .max_signal = 15,
528 .muxval = 1,
529 .cctl = 0,
530 .periph_buses = PL08X_AHB1,
531 },
532};
533
534/* uart devices plat data */
535static struct amba_pl011_data spear310_uart_data[] = {
536 {
537 .dma_filter = pl08x_filter_id,
538 .dma_tx_param = "uart1_tx",
539 .dma_rx_param = "uart1_rx",
540 }, {
541 .dma_filter = pl08x_filter_id,
542 .dma_tx_param = "uart2_tx",
543 .dma_rx_param = "uart2_rx",
544 }, {
545 .dma_filter = pl08x_filter_id,
546 .dma_tx_param = "uart3_tx",
547 .dma_rx_param = "uart3_rx",
548 }, {
549 .dma_filter = pl08x_filter_id,
550 .dma_tx_param = "uart4_tx",
551 .dma_rx_param = "uart4_rx",
552 }, {
553 .dma_filter = pl08x_filter_id,
554 .dma_tx_param = "uart5_tx",
555 .dma_rx_param = "uart5_rx",
556 },
557};
558
559/* Add SPEAr310 auxdata to pass platform data */
560static struct of_dev_auxdata spear310_auxdata_lookup[] __initdata = {
561 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
562 &pl022_plat_data),
563 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL,
564 &pl080_plat_data),
565 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART1_BASE, NULL,
566 &spear310_uart_data[0]),
567 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART2_BASE, NULL,
568 &spear310_uart_data[1]),
569 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART3_BASE, NULL,
570 &spear310_uart_data[2]),
571 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART4_BASE, NULL,
572 &spear310_uart_data[3]),
573 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART5_BASE, NULL,
574 &spear310_uart_data[4]),
575 {}
576};
577
578static void __init spear310_dt_init(void)
263{ 579{
264 void __iomem *base; 580 void __iomem *base;
265 int ret = 0; 581 int ret = 0;
266 582
267 /* call spear3xx family common init function */ 583 pl080_plat_data.slave_channels = spear310_dma_info;
268 spear3xx_init(); 584 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear310_dma_info);
585
586 of_platform_populate(NULL, of_default_bus_match_table,
587 spear310_auxdata_lookup, NULL);
269 588
270 /* shared irq registration */ 589 /* shared irq registration */
271 base = ioremap(SPEAR310_SOC_CONFIG_BASE, SZ_4K); 590 base = ioremap(SPEAR310_SOC_CONFIG_BASE, SZ_4K);
@@ -274,35 +593,59 @@ void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
274 shirq_ras1.regs.base = base; 593 shirq_ras1.regs.base = base;
275 ret = spear_shirq_register(&shirq_ras1); 594 ret = spear_shirq_register(&shirq_ras1);
276 if (ret) 595 if (ret)
277 printk(KERN_ERR "Error registering Shared IRQ 1\n"); 596 pr_err("Error registering Shared IRQ 1\n");
278 597
279 /* shirq 2 */ 598 /* shirq 2 */
280 shirq_ras2.regs.base = base; 599 shirq_ras2.regs.base = base;
281 ret = spear_shirq_register(&shirq_ras2); 600 ret = spear_shirq_register(&shirq_ras2);
282 if (ret) 601 if (ret)
283 printk(KERN_ERR "Error registering Shared IRQ 2\n"); 602 pr_err("Error registering Shared IRQ 2\n");
284 603
285 /* shirq 3 */ 604 /* shirq 3 */
286 shirq_ras3.regs.base = base; 605 shirq_ras3.regs.base = base;
287 ret = spear_shirq_register(&shirq_ras3); 606 ret = spear_shirq_register(&shirq_ras3);
288 if (ret) 607 if (ret)
289 printk(KERN_ERR "Error registering Shared IRQ 3\n"); 608 pr_err("Error registering Shared IRQ 3\n");
290 609
291 /* shirq 4 */ 610 /* shirq 4 */
292 shirq_intrcomm_ras.regs.base = base; 611 shirq_intrcomm_ras.regs.base = base;
293 ret = spear_shirq_register(&shirq_intrcomm_ras); 612 ret = spear_shirq_register(&shirq_intrcomm_ras);
294 if (ret) 613 if (ret)
295 printk(KERN_ERR "Error registering Shared IRQ 4\n"); 614 pr_err("Error registering Shared IRQ 4\n");
615 }
616
617 if (of_machine_is_compatible("st,spear310-evb")) {
618 /* pmx initialization */
619 pmx_driver.base = base;
620 pmx_driver.mode = NULL;
621 pmx_driver.devs = spear310_evb_pmx_devs;
622 pmx_driver.devs_count = ARRAY_SIZE(spear310_evb_pmx_devs);
623
624 ret = pmx_register(&pmx_driver);
625 if (ret)
626 pr_err("padmux: registration failed. err no: %d\n",
627 ret);
296 } 628 }
629}
297 630
298 /* pmx initialization */ 631static const char * const spear310_dt_board_compat[] = {
299 pmx_driver.base = base; 632 "st,spear310",
300 pmx_driver.mode = pmx_mode; 633 "st,spear310-evb",
301 pmx_driver.devs = pmx_devs; 634 NULL,
302 pmx_driver.devs_count = pmx_dev_count; 635};
303 636
304 ret = pmx_register(&pmx_driver); 637static void __init spear310_map_io(void)
305 if (ret) 638{
306 printk(KERN_ERR "padmux: registration failed. err no: %d\n", 639 spear3xx_map_io();
307 ret); 640 spear310_clk_init();
308} 641}
642
643DT_MACHINE_START(SPEAR310_DT, "ST SPEAr310 SoC with Flattened Device Tree")
644 .map_io = spear310_map_io,
645 .init_irq = spear3xx_dt_init_irq,
646 .handle_irq = vic_handle_irq,
647 .timer = &spear3xx_timer,
648 .init_machine = spear310_dt_init,
649 .restart = spear_restart,
650 .dt_compat = spear310_dt_board_compat,
651MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear310_evb.c b/arch/arm/mach-spear3xx/spear310_evb.c
deleted file mode 100644
index f92c4993f65a..000000000000
--- a/arch/arm/mach-spear3xx/spear310_evb.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/spear310_evb.c
3 *
4 * SPEAr310 evaluation board source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <asm/hardware/vic.h>
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19
20/* padmux devices to enable */
21static struct pmx_dev *pmx_devs[] = {
22 /* spear3xx specific devices */
23 &spear3xx_pmx_i2c,
24 &spear3xx_pmx_ssp,
25 &spear3xx_pmx_gpio_pin0,
26 &spear3xx_pmx_gpio_pin1,
27 &spear3xx_pmx_gpio_pin2,
28 &spear3xx_pmx_gpio_pin3,
29 &spear3xx_pmx_gpio_pin4,
30 &spear3xx_pmx_gpio_pin5,
31 &spear3xx_pmx_uart0,
32
33 /* spear310 specific devices */
34 &spear310_pmx_emi_cs_0_1_4_5,
35 &spear310_pmx_emi_cs_2_3,
36 &spear310_pmx_uart1,
37 &spear310_pmx_uart2,
38 &spear310_pmx_uart3_4_5,
39 &spear310_pmx_fsmc,
40 &spear310_pmx_rs485_0_1,
41 &spear310_pmx_tdm0,
42};
43
44static struct amba_device *amba_devs[] __initdata = {
45 /* spear3xx specific devices */
46 &spear3xx_gpio_device,
47 &spear3xx_uart_device,
48
49 /* spear310 specific devices */
50};
51
52static struct platform_device *plat_devs[] __initdata = {
53 /* spear3xx specific devices */
54
55 /* spear310 specific devices */
56};
57
58static void __init spear310_evb_init(void)
59{
60 unsigned int i;
61
62 /* call spear310 machine init function */
63 spear310_init(NULL, pmx_devs, ARRAY_SIZE(pmx_devs));
64
65 /* Add Platform Devices */
66 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
67
68 /* Add Amba Devices */
69 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
70 amba_device_register(amba_devs[i], &iomem_resource);
71}
72
73MACHINE_START(SPEAR310, "ST-SPEAR310-EVB")
74 .atag_offset = 0x100,
75 .map_io = spear3xx_map_io,
76 .init_irq = spear3xx_init_irq,
77 .handle_irq = vic_handle_irq,
78 .timer = &spear3xx_timer,
79 .init_machine = spear310_evb_init,
80 .restart = spear_restart,
81MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear320.c b/arch/arm/mach-spear3xx/spear320.c
index deaaf199612c..2f5979b0c169 100644
--- a/arch/arm/mach-spear3xx/spear320.c
+++ b/arch/arm/mach-spear3xx/spear320.c
@@ -3,19 +3,85 @@
3 * 3 *
4 * SPEAr320 machine source file 4 * SPEAr320 machine source file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.kumar@st.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/ptrace.h> 14#define pr_fmt(fmt) "SPEAr320: " fmt
15#include <asm/irq.h> 15
16#include <linux/amba/pl022.h>
17#include <linux/amba/pl08x.h>
18#include <linux/amba/serial.h>
19#include <linux/of_platform.h>
20#include <asm/hardware/vic.h>
21#include <asm/mach/arch.h>
16#include <plat/shirq.h> 22#include <plat/shirq.h>
17#include <mach/generic.h> 23#include <mach/generic.h>
18#include <mach/hardware.h> 24#include <mach/spear.h>
25
26#define SPEAR320_UART1_BASE UL(0xA3000000)
27#define SPEAR320_UART2_BASE UL(0xA4000000)
28#define SPEAR320_SSP0_BASE UL(0xA5000000)
29#define SPEAR320_SSP1_BASE UL(0xA6000000)
30#define SPEAR320_SOC_CONFIG_BASE UL(0xB3000000)
31
32/* Interrupt registers offsets and masks */
33#define SPEAR320_INT_STS_MASK_REG 0x04
34#define SPEAR320_INT_CLR_MASK_REG 0x04
35#define SPEAR320_INT_ENB_MASK_REG 0x08
36#define SPEAR320_GPIO_IRQ_MASK (1 << 0)
37#define SPEAR320_I2S_PLAY_IRQ_MASK (1 << 1)
38#define SPEAR320_I2S_REC_IRQ_MASK (1 << 2)
39#define SPEAR320_EMI_IRQ_MASK (1 << 7)
40#define SPEAR320_CLCD_IRQ_MASK (1 << 8)
41#define SPEAR320_SPP_IRQ_MASK (1 << 9)
42#define SPEAR320_SDHCI_IRQ_MASK (1 << 10)
43#define SPEAR320_CAN_U_IRQ_MASK (1 << 11)
44#define SPEAR320_CAN_L_IRQ_MASK (1 << 12)
45#define SPEAR320_UART1_IRQ_MASK (1 << 13)
46#define SPEAR320_UART2_IRQ_MASK (1 << 14)
47#define SPEAR320_SSP1_IRQ_MASK (1 << 15)
48#define SPEAR320_SSP2_IRQ_MASK (1 << 16)
49#define SPEAR320_SMII0_IRQ_MASK (1 << 17)
50#define SPEAR320_MII1_SMII1_IRQ_MASK (1 << 18)
51#define SPEAR320_WAKEUP_SMII0_IRQ_MASK (1 << 19)
52#define SPEAR320_WAKEUP_MII1_SMII1_IRQ_MASK (1 << 20)
53#define SPEAR320_I2C1_IRQ_MASK (1 << 21)
54
55#define SPEAR320_SHIRQ_RAS1_MASK 0x000380
56#define SPEAR320_SHIRQ_RAS3_MASK 0x000007
57#define SPEAR320_SHIRQ_INTRCOMM_RAS_MASK 0x3FF800
58
59/* SPEAr320 Virtual irq definitions */
60/* IRQs sharing IRQ_GEN_RAS_1 */
61#define SPEAR320_VIRQ_EMI (SPEAR3XX_VIRQ_START + 0)
62#define SPEAR320_VIRQ_CLCD (SPEAR3XX_VIRQ_START + 1)
63#define SPEAR320_VIRQ_SPP (SPEAR3XX_VIRQ_START + 2)
64
65/* IRQs sharing IRQ_GEN_RAS_2 */
66#define SPEAR320_IRQ_SDHCI SPEAR3XX_IRQ_GEN_RAS_2
67
68/* IRQs sharing IRQ_GEN_RAS_3 */
69#define SPEAR320_VIRQ_PLGPIO (SPEAR3XX_VIRQ_START + 3)
70#define SPEAR320_VIRQ_I2S_PLAY (SPEAR3XX_VIRQ_START + 4)
71#define SPEAR320_VIRQ_I2S_REC (SPEAR3XX_VIRQ_START + 5)
72
73/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
74#define SPEAR320_VIRQ_CANU (SPEAR3XX_VIRQ_START + 6)
75#define SPEAR320_VIRQ_CANL (SPEAR3XX_VIRQ_START + 7)
76#define SPEAR320_VIRQ_UART1 (SPEAR3XX_VIRQ_START + 8)
77#define SPEAR320_VIRQ_UART2 (SPEAR3XX_VIRQ_START + 9)
78#define SPEAR320_VIRQ_SSP1 (SPEAR3XX_VIRQ_START + 10)
79#define SPEAR320_VIRQ_SSP2 (SPEAR3XX_VIRQ_START + 11)
80#define SPEAR320_VIRQ_SMII0 (SPEAR3XX_VIRQ_START + 12)
81#define SPEAR320_VIRQ_MII1_SMII1 (SPEAR3XX_VIRQ_START + 13)
82#define SPEAR320_VIRQ_WAKEUP_SMII0 (SPEAR3XX_VIRQ_START + 14)
83#define SPEAR320_VIRQ_WAKEUP_MII1_SMII1 (SPEAR3XX_VIRQ_START + 15)
84#define SPEAR320_VIRQ_I2C1 (SPEAR3XX_VIRQ_START + 16)
19 85
20/* pad multiplexing support */ 86/* pad multiplexing support */
21/* muxing registers */ 87/* muxing registers */
@@ -508,17 +574,271 @@ static struct spear_shirq shirq_intrcomm_ras = {
508 }, 574 },
509}; 575};
510 576
511/* Add spear320 specific devices here */ 577/* padmux devices to enable */
578static struct pmx_dev *spear320_evb_pmx_devs[] = {
579 /* spear3xx specific devices */
580 &spear3xx_pmx_i2c,
581 &spear3xx_pmx_ssp,
582 &spear3xx_pmx_mii,
583 &spear3xx_pmx_uart0,
584
585 /* spear320 specific devices */
586 &spear320_pmx_fsmc,
587 &spear320_pmx_sdhci,
588 &spear320_pmx_i2s,
589 &spear320_pmx_uart1,
590 &spear320_pmx_uart2,
591 &spear320_pmx_can,
592 &spear320_pmx_pwm0,
593 &spear320_pmx_pwm1,
594 &spear320_pmx_pwm2,
595 &spear320_pmx_mii1,
596};
597
598/* DMAC platform data's slave info */
599struct pl08x_channel_data spear320_dma_info[] = {
600 {
601 .bus_id = "uart0_rx",
602 .min_signal = 2,
603 .max_signal = 2,
604 .muxval = 0,
605 .cctl = 0,
606 .periph_buses = PL08X_AHB1,
607 }, {
608 .bus_id = "uart0_tx",
609 .min_signal = 3,
610 .max_signal = 3,
611 .muxval = 0,
612 .cctl = 0,
613 .periph_buses = PL08X_AHB1,
614 }, {
615 .bus_id = "ssp0_rx",
616 .min_signal = 8,
617 .max_signal = 8,
618 .muxval = 0,
619 .cctl = 0,
620 .periph_buses = PL08X_AHB1,
621 }, {
622 .bus_id = "ssp0_tx",
623 .min_signal = 9,
624 .max_signal = 9,
625 .muxval = 0,
626 .cctl = 0,
627 .periph_buses = PL08X_AHB1,
628 }, {
629 .bus_id = "i2c0_rx",
630 .min_signal = 10,
631 .max_signal = 10,
632 .muxval = 0,
633 .cctl = 0,
634 .periph_buses = PL08X_AHB1,
635 }, {
636 .bus_id = "i2c0_tx",
637 .min_signal = 11,
638 .max_signal = 11,
639 .muxval = 0,
640 .cctl = 0,
641 .periph_buses = PL08X_AHB1,
642 }, {
643 .bus_id = "irda",
644 .min_signal = 12,
645 .max_signal = 12,
646 .muxval = 0,
647 .cctl = 0,
648 .periph_buses = PL08X_AHB1,
649 }, {
650 .bus_id = "adc",
651 .min_signal = 13,
652 .max_signal = 13,
653 .muxval = 0,
654 .cctl = 0,
655 .periph_buses = PL08X_AHB1,
656 }, {
657 .bus_id = "to_jpeg",
658 .min_signal = 14,
659 .max_signal = 14,
660 .muxval = 0,
661 .cctl = 0,
662 .periph_buses = PL08X_AHB1,
663 }, {
664 .bus_id = "from_jpeg",
665 .min_signal = 15,
666 .max_signal = 15,
667 .muxval = 0,
668 .cctl = 0,
669 .periph_buses = PL08X_AHB1,
670 }, {
671 .bus_id = "ssp1_rx",
672 .min_signal = 0,
673 .max_signal = 0,
674 .muxval = 1,
675 .cctl = 0,
676 .periph_buses = PL08X_AHB2,
677 }, {
678 .bus_id = "ssp1_tx",
679 .min_signal = 1,
680 .max_signal = 1,
681 .muxval = 1,
682 .cctl = 0,
683 .periph_buses = PL08X_AHB2,
684 }, {
685 .bus_id = "ssp2_rx",
686 .min_signal = 2,
687 .max_signal = 2,
688 .muxval = 1,
689 .cctl = 0,
690 .periph_buses = PL08X_AHB2,
691 }, {
692 .bus_id = "ssp2_tx",
693 .min_signal = 3,
694 .max_signal = 3,
695 .muxval = 1,
696 .cctl = 0,
697 .periph_buses = PL08X_AHB2,
698 }, {
699 .bus_id = "uart1_rx",
700 .min_signal = 4,
701 .max_signal = 4,
702 .muxval = 1,
703 .cctl = 0,
704 .periph_buses = PL08X_AHB2,
705 }, {
706 .bus_id = "uart1_tx",
707 .min_signal = 5,
708 .max_signal = 5,
709 .muxval = 1,
710 .cctl = 0,
711 .periph_buses = PL08X_AHB2,
712 }, {
713 .bus_id = "uart2_rx",
714 .min_signal = 6,
715 .max_signal = 6,
716 .muxval = 1,
717 .cctl = 0,
718 .periph_buses = PL08X_AHB2,
719 }, {
720 .bus_id = "uart2_tx",
721 .min_signal = 7,
722 .max_signal = 7,
723 .muxval = 1,
724 .cctl = 0,
725 .periph_buses = PL08X_AHB2,
726 }, {
727 .bus_id = "i2c1_rx",
728 .min_signal = 8,
729 .max_signal = 8,
730 .muxval = 1,
731 .cctl = 0,
732 .periph_buses = PL08X_AHB2,
733 }, {
734 .bus_id = "i2c1_tx",
735 .min_signal = 9,
736 .max_signal = 9,
737 .muxval = 1,
738 .cctl = 0,
739 .periph_buses = PL08X_AHB2,
740 }, {
741 .bus_id = "i2c2_rx",
742 .min_signal = 10,
743 .max_signal = 10,
744 .muxval = 1,
745 .cctl = 0,
746 .periph_buses = PL08X_AHB2,
747 }, {
748 .bus_id = "i2c2_tx",
749 .min_signal = 11,
750 .max_signal = 11,
751 .muxval = 1,
752 .cctl = 0,
753 .periph_buses = PL08X_AHB2,
754 }, {
755 .bus_id = "i2s_rx",
756 .min_signal = 12,
757 .max_signal = 12,
758 .muxval = 1,
759 .cctl = 0,
760 .periph_buses = PL08X_AHB2,
761 }, {
762 .bus_id = "i2s_tx",
763 .min_signal = 13,
764 .max_signal = 13,
765 .muxval = 1,
766 .cctl = 0,
767 .periph_buses = PL08X_AHB2,
768 }, {
769 .bus_id = "rs485_rx",
770 .min_signal = 14,
771 .max_signal = 14,
772 .muxval = 1,
773 .cctl = 0,
774 .periph_buses = PL08X_AHB2,
775 }, {
776 .bus_id = "rs485_tx",
777 .min_signal = 15,
778 .max_signal = 15,
779 .muxval = 1,
780 .cctl = 0,
781 .periph_buses = PL08X_AHB2,
782 },
783};
784
785static struct pl022_ssp_controller spear320_ssp_data[] = {
786 {
787 .bus_id = 1,
788 .enable_dma = 1,
789 .dma_filter = pl08x_filter_id,
790 .dma_tx_param = "ssp1_tx",
791 .dma_rx_param = "ssp1_rx",
792 .num_chipselect = 2,
793 }, {
794 .bus_id = 2,
795 .enable_dma = 1,
796 .dma_filter = pl08x_filter_id,
797 .dma_tx_param = "ssp2_tx",
798 .dma_rx_param = "ssp2_rx",
799 .num_chipselect = 2,
800 }
801};
802
803static struct amba_pl011_data spear320_uart_data[] = {
804 {
805 .dma_filter = pl08x_filter_id,
806 .dma_tx_param = "uart1_tx",
807 .dma_rx_param = "uart1_rx",
808 }, {
809 .dma_filter = pl08x_filter_id,
810 .dma_tx_param = "uart2_tx",
811 .dma_rx_param = "uart2_rx",
812 },
813};
512 814
513/* spear320 routines */ 815/* Add SPEAr310 auxdata to pass platform data */
514void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 816static struct of_dev_auxdata spear320_auxdata_lookup[] __initdata = {
515 u8 pmx_dev_count) 817 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
818 &pl022_plat_data),
819 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL,
820 &pl080_plat_data),
821 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE, NULL,
822 &spear320_ssp_data[0]),
823 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP1_BASE, NULL,
824 &spear320_ssp_data[1]),
825 OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART1_BASE, NULL,
826 &spear320_uart_data[0]),
827 OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART2_BASE, NULL,
828 &spear320_uart_data[1]),
829 {}
830};
831
832static void __init spear320_dt_init(void)
516{ 833{
517 void __iomem *base; 834 void __iomem *base;
518 int ret = 0; 835 int ret = 0;
519 836
520 /* call spear3xx family common init function */ 837 pl080_plat_data.slave_channels = spear320_dma_info;
521 spear3xx_init(); 838 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear320_dma_info);
839
840 of_platform_populate(NULL, of_default_bus_match_table,
841 spear320_auxdata_lookup, NULL);
522 842
523 /* shared irq registration */ 843 /* shared irq registration */
524 base = ioremap(SPEAR320_SOC_CONFIG_BASE, SZ_4K); 844 base = ioremap(SPEAR320_SOC_CONFIG_BASE, SZ_4K);
@@ -527,29 +847,53 @@ void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
527 shirq_ras1.regs.base = base; 847 shirq_ras1.regs.base = base;
528 ret = spear_shirq_register(&shirq_ras1); 848 ret = spear_shirq_register(&shirq_ras1);
529 if (ret) 849 if (ret)
530 printk(KERN_ERR "Error registering Shared IRQ 1\n"); 850 pr_err("Error registering Shared IRQ 1\n");
531 851
532 /* shirq 3 */ 852 /* shirq 3 */
533 shirq_ras3.regs.base = base; 853 shirq_ras3.regs.base = base;
534 ret = spear_shirq_register(&shirq_ras3); 854 ret = spear_shirq_register(&shirq_ras3);
535 if (ret) 855 if (ret)
536 printk(KERN_ERR "Error registering Shared IRQ 3\n"); 856 pr_err("Error registering Shared IRQ 3\n");
537 857
538 /* shirq 4 */ 858 /* shirq 4 */
539 shirq_intrcomm_ras.regs.base = base; 859 shirq_intrcomm_ras.regs.base = base;
540 ret = spear_shirq_register(&shirq_intrcomm_ras); 860 ret = spear_shirq_register(&shirq_intrcomm_ras);
541 if (ret) 861 if (ret)
542 printk(KERN_ERR "Error registering Shared IRQ 4\n"); 862 pr_err("Error registering Shared IRQ 4\n");
863 }
864
865 if (of_machine_is_compatible("st,spear320-evb")) {
866 /* pmx initialization */
867 pmx_driver.base = base;
868 pmx_driver.mode = &spear320_auto_net_mii_mode;
869 pmx_driver.devs = spear320_evb_pmx_devs;
870 pmx_driver.devs_count = ARRAY_SIZE(spear320_evb_pmx_devs);
871
872 ret = pmx_register(&pmx_driver);
873 if (ret)
874 pr_err("padmux: registration failed. err no: %d\n",
875 ret);
543 } 876 }
877}
544 878
545 /* pmx initialization */ 879static const char * const spear320_dt_board_compat[] = {
546 pmx_driver.base = base; 880 "st,spear320",
547 pmx_driver.mode = pmx_mode; 881 "st,spear320-evb",
548 pmx_driver.devs = pmx_devs; 882 NULL,
549 pmx_driver.devs_count = pmx_dev_count; 883};
550 884
551 ret = pmx_register(&pmx_driver); 885static void __init spear320_map_io(void)
552 if (ret) 886{
553 printk(KERN_ERR "padmux: registration failed. err no: %d\n", 887 spear3xx_map_io();
554 ret); 888 spear320_clk_init();
555} 889}
890
891DT_MACHINE_START(SPEAR320_DT, "ST SPEAr320 SoC with Flattened Device Tree")
892 .map_io = spear320_map_io,
893 .init_irq = spear3xx_dt_init_irq,
894 .handle_irq = vic_handle_irq,
895 .timer = &spear3xx_timer,
896 .init_machine = spear320_dt_init,
897 .restart = spear_restart,
898 .dt_compat = spear320_dt_board_compat,
899MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear320_evb.c b/arch/arm/mach-spear3xx/spear320_evb.c
deleted file mode 100644
index 105334ab7021..000000000000
--- a/arch/arm/mach-spear3xx/spear320_evb.c
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/spear320_evb.c
3 *
4 * SPEAr320 evaluation board source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <asm/hardware/vic.h>
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19
20/* padmux devices to enable */
21static struct pmx_dev *pmx_devs[] = {
22 /* spear3xx specific devices */
23 &spear3xx_pmx_i2c,
24 &spear3xx_pmx_ssp,
25 &spear3xx_pmx_mii,
26 &spear3xx_pmx_uart0,
27
28 /* spear320 specific devices */
29 &spear320_pmx_fsmc,
30 &spear320_pmx_sdhci,
31 &spear320_pmx_i2s,
32 &spear320_pmx_uart1,
33 &spear320_pmx_uart2,
34 &spear320_pmx_can,
35 &spear320_pmx_pwm0,
36 &spear320_pmx_pwm1,
37 &spear320_pmx_pwm2,
38 &spear320_pmx_mii1,
39};
40
41static struct amba_device *amba_devs[] __initdata = {
42 /* spear3xx specific devices */
43 &spear3xx_gpio_device,
44 &spear3xx_uart_device,
45
46 /* spear320 specific devices */
47};
48
49static struct platform_device *plat_devs[] __initdata = {
50 /* spear3xx specific devices */
51
52 /* spear320 specific devices */
53};
54
55static void __init spear320_evb_init(void)
56{
57 unsigned int i;
58
59 /* call spear320 machine init function */
60 spear320_init(&spear320_auto_net_mii_mode, pmx_devs,
61 ARRAY_SIZE(pmx_devs));
62
63 /* Add Platform Devices */
64 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
65
66 /* Add Amba Devices */
67 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
68 amba_device_register(amba_devs[i], &iomem_resource);
69}
70
71MACHINE_START(SPEAR320, "ST-SPEAR320-EVB")
72 .atag_offset = 0x100,
73 .map_io = spear3xx_map_io,
74 .init_irq = spear3xx_init_irq,
75 .handle_irq = vic_handle_irq,
76 .timer = &spear3xx_timer,
77 .init_machine = spear320_evb_init,
78 .restart = spear_restart,
79MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c
index b1733c37f209..bbb11efa6056 100644
--- a/arch/arm/mach-spear3xx/spear3xx.c
+++ b/arch/arm/mach-spear3xx/spear3xx.c
@@ -3,83 +3,25 @@
3 * 3 *
4 * SPEAr3XX machines common source file 4 * SPEAr3XX machines common source file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.kumar@st.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/types.h> 14#define pr_fmt(fmt) "SPEAr3xx: " fmt
15#include <linux/amba/pl061.h> 15
16#include <linux/ptrace.h> 16#include <linux/amba/pl022.h>
17#include <linux/amba/pl08x.h>
18#include <linux/of_irq.h>
17#include <linux/io.h> 19#include <linux/io.h>
20#include <asm/hardware/pl080.h>
18#include <asm/hardware/vic.h> 21#include <asm/hardware/vic.h>
19#include <asm/irq.h> 22#include <plat/pl080.h>
20#include <asm/mach/arch.h>
21#include <mach/generic.h> 23#include <mach/generic.h>
22#include <mach/hardware.h> 24#include <mach/spear.h>
23
24/* Add spear3xx machines common devices here */
25/* gpio device registration */
26static struct pl061_platform_data gpio_plat_data = {
27 .gpio_base = 0,
28 .irq_base = SPEAR3XX_GPIO_INT_BASE,
29};
30
31AMBA_APB_DEVICE(spear3xx_gpio, "gpio", 0, SPEAR3XX_ICM3_GPIO_BASE,
32 {SPEAR3XX_IRQ_BASIC_GPIO}, &gpio_plat_data);
33
34/* uart device registration */
35AMBA_APB_DEVICE(spear3xx_uart, "uart", 0, SPEAR3XX_ICM1_UART_BASE,
36 {SPEAR3XX_IRQ_UART}, NULL);
37
38/* Do spear3xx familiy common initialization part here */
39void __init spear3xx_init(void)
40{
41 /* nothing to do for now */
42}
43
44/* This will initialize vic */
45void __init spear3xx_init_irq(void)
46{
47 vic_init((void __iomem *)VA_SPEAR3XX_ML1_VIC_BASE, 0, ~0, 0);
48}
49
50/* Following will create static virtual/physical mappings */
51struct map_desc spear3xx_io_desc[] __initdata = {
52 {
53 .virtual = VA_SPEAR3XX_ICM1_UART_BASE,
54 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_UART_BASE),
55 .length = SZ_4K,
56 .type = MT_DEVICE
57 }, {
58 .virtual = VA_SPEAR3XX_ML1_VIC_BASE,
59 .pfn = __phys_to_pfn(SPEAR3XX_ML1_VIC_BASE),
60 .length = SZ_4K,
61 .type = MT_DEVICE
62 }, {
63 .virtual = VA_SPEAR3XX_ICM3_SYS_CTRL_BASE,
64 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SYS_CTRL_BASE),
65 .length = SZ_4K,
66 .type = MT_DEVICE
67 }, {
68 .virtual = VA_SPEAR3XX_ICM3_MISC_REG_BASE,
69 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_MISC_REG_BASE),
70 .length = SZ_4K,
71 .type = MT_DEVICE
72 },
73};
74
75/* This will create static memory mapping for selected devices */
76void __init spear3xx_map_io(void)
77{
78 iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
79
80 /* This will initialize clock framework */
81 spear3xx_clk_init();
82}
83 25
84/* pad multiplexing support */ 26/* pad multiplexing support */
85/* devices */ 27/* devices */
@@ -506,6 +448,68 @@ struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50 = {
506}; 448};
507#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */ 449#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */
508 450
451/* ssp device registration */
452struct pl022_ssp_controller pl022_plat_data = {
453 .bus_id = 0,
454 .enable_dma = 1,
455 .dma_filter = pl08x_filter_id,
456 .dma_tx_param = "ssp0_tx",
457 .dma_rx_param = "ssp0_rx",
458 /*
459 * This is number of spi devices that can be connected to spi. There are
460 * two type of chipselects on which slave devices can work. One is chip
461 * select provided by spi masters other is controlled through external
462 * gpio's. We can't use chipselect provided from spi master (because as
463 * soon as FIFO becomes empty, CS is disabled and transfer ends). So
464 * this number now depends on number of gpios available for spi. each
465 * slave on each master requires a separate gpio pin.
466 */
467 .num_chipselect = 2,
468};
469
470/* dmac device registration */
471struct pl08x_platform_data pl080_plat_data = {
472 .memcpy_channel = {
473 .bus_id = "memcpy",
474 .cctl = (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \
475 PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \
476 PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \
477 PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \
478 PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \
479 PL080_CONTROL_PROT_SYS),
480 },
481 .lli_buses = PL08X_AHB1,
482 .mem_buses = PL08X_AHB1,
483 .get_signal = pl080_get_signal,
484 .put_signal = pl080_put_signal,
485};
486
487/*
488 * Following will create 16MB static virtual/physical mappings
489 * PHYSICAL VIRTUAL
490 * 0xD0000000 0xFD000000
491 * 0xFC000000 0xFC000000
492 */
493struct map_desc spear3xx_io_desc[] __initdata = {
494 {
495 .virtual = VA_SPEAR3XX_ICM1_2_BASE,
496 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE),
497 .length = SZ_16M,
498 .type = MT_DEVICE
499 }, {
500 .virtual = VA_SPEAR3XX_ICM3_SMI_CTRL_BASE,
501 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE),
502 .length = SZ_16M,
503 .type = MT_DEVICE
504 },
505};
506
507/* This will create static memory mapping for selected devices */
508void __init spear3xx_map_io(void)
509{
510 iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
511}
512
509static void __init spear3xx_timer_init(void) 513static void __init spear3xx_timer_init(void)
510{ 514{
511 char pclk_name[] = "pll3_48m_clk"; 515 char pclk_name[] = "pll3_48m_clk";
@@ -530,9 +534,19 @@ static void __init spear3xx_timer_init(void)
530 clk_put(gpt_clk); 534 clk_put(gpt_clk);
531 clk_put(pclk); 535 clk_put(pclk);
532 536
533 spear_setup_timer(); 537 spear_setup_timer(SPEAR3XX_CPU_TMR_BASE, SPEAR3XX_IRQ_CPU_GPT1_1);
534} 538}
535 539
536struct sys_timer spear3xx_timer = { 540struct sys_timer spear3xx_timer = {
537 .init = spear3xx_timer_init, 541 .init = spear3xx_timer_init,
538}; 542};
543
544static const struct of_device_id vic_of_match[] __initconst = {
545 { .compatible = "arm,pl190-vic", .data = vic_of_init, },
546 { /* Sentinel */ }
547};
548
549void __init spear3xx_dt_init_irq(void)
550{
551 of_irq_init(vic_of_match);
552}
diff --git a/arch/arm/mach-spear6xx/Makefile.boot b/arch/arm/mach-spear6xx/Makefile.boot
index 4674a4c221db..af493da37ab6 100644
--- a/arch/arm/mach-spear6xx/Makefile.boot
+++ b/arch/arm/mach-spear6xx/Makefile.boot
@@ -1,3 +1,5 @@
1zreladdr-y += 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4
5dtb-$(CONFIG_BOARD_SPEAR600_DT) += spear600-evb.dtb
diff --git a/arch/arm/mach-spear6xx/clock.c b/arch/arm/mach-spear6xx/clock.c
index a86499a8a15f..bef77d43db87 100644
--- a/arch/arm/mach-spear6xx/clock.c
+++ b/arch/arm/mach-spear6xx/clock.c
@@ -16,6 +16,112 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <plat/clock.h> 17#include <plat/clock.h>
18#include <mach/misc_regs.h> 18#include <mach/misc_regs.h>
19#include <mach/spear.h>
20
21#define PLL1_CTR (MISC_BASE + 0x008)
22#define PLL1_FRQ (MISC_BASE + 0x00C)
23#define PLL1_MOD (MISC_BASE + 0x010)
24#define PLL2_CTR (MISC_BASE + 0x014)
25/* PLL_CTR register masks */
26#define PLL_ENABLE 2
27#define PLL_MODE_SHIFT 4
28#define PLL_MODE_MASK 0x3
29#define PLL_MODE_NORMAL 0
30#define PLL_MODE_FRACTION 1
31#define PLL_MODE_DITH_DSB 2
32#define PLL_MODE_DITH_SSB 3
33
34#define PLL2_FRQ (MISC_BASE + 0x018)
35/* PLL FRQ register masks */
36#define PLL_DIV_N_SHIFT 0
37#define PLL_DIV_N_MASK 0xFF
38#define PLL_DIV_P_SHIFT 8
39#define PLL_DIV_P_MASK 0x7
40#define PLL_NORM_FDBK_M_SHIFT 24
41#define PLL_NORM_FDBK_M_MASK 0xFF
42#define PLL_DITH_FDBK_M_SHIFT 16
43#define PLL_DITH_FDBK_M_MASK 0xFFFF
44
45#define PLL2_MOD (MISC_BASE + 0x01C)
46#define PLL_CLK_CFG (MISC_BASE + 0x020)
47#define CORE_CLK_CFG (MISC_BASE + 0x024)
48/* CORE CLK CFG register masks */
49#define PLL_HCLK_RATIO_SHIFT 10
50#define PLL_HCLK_RATIO_MASK 0x3
51#define HCLK_PCLK_RATIO_SHIFT 8
52#define HCLK_PCLK_RATIO_MASK 0x3
53
54#define PERIP_CLK_CFG (MISC_BASE + 0x028)
55/* PERIP_CLK_CFG register masks */
56#define CLCD_CLK_SHIFT 2
57#define CLCD_CLK_MASK 0x3
58#define UART_CLK_SHIFT 4
59#define UART_CLK_MASK 0x1
60#define FIRDA_CLK_SHIFT 5
61#define FIRDA_CLK_MASK 0x3
62#define GPT0_CLK_SHIFT 8
63#define GPT1_CLK_SHIFT 10
64#define GPT2_CLK_SHIFT 11
65#define GPT3_CLK_SHIFT 12
66#define GPT_CLK_MASK 0x1
67#define AUX_CLK_PLL3_VAL 0
68#define AUX_CLK_PLL1_VAL 1
69
70#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
71/* PERIP1_CLK_ENB register masks */
72#define UART0_CLK_ENB 3
73#define UART1_CLK_ENB 4
74#define SSP0_CLK_ENB 5
75#define SSP1_CLK_ENB 6
76#define I2C_CLK_ENB 7
77#define JPEG_CLK_ENB 8
78#define FSMC_CLK_ENB 9
79#define FIRDA_CLK_ENB 10
80#define GPT2_CLK_ENB 11
81#define GPT3_CLK_ENB 12
82#define GPIO2_CLK_ENB 13
83#define SSP2_CLK_ENB 14
84#define ADC_CLK_ENB 15
85#define GPT1_CLK_ENB 11
86#define RTC_CLK_ENB 17
87#define GPIO1_CLK_ENB 18
88#define DMA_CLK_ENB 19
89#define SMI_CLK_ENB 21
90#define CLCD_CLK_ENB 22
91#define GMAC_CLK_ENB 23
92#define USBD_CLK_ENB 24
93#define USBH0_CLK_ENB 25
94#define USBH1_CLK_ENB 26
95
96#define PRSC1_CLK_CFG (MISC_BASE + 0x044)
97#define PRSC2_CLK_CFG (MISC_BASE + 0x048)
98#define PRSC3_CLK_CFG (MISC_BASE + 0x04C)
99/* gpt synthesizer register masks */
100#define GPT_MSCALE_SHIFT 0
101#define GPT_MSCALE_MASK 0xFFF
102#define GPT_NSCALE_SHIFT 12
103#define GPT_NSCALE_MASK 0xF
104
105#define AMEM_CLK_CFG (MISC_BASE + 0x050)
106#define EXPI_CLK_CFG (MISC_BASE + 0x054)
107#define CLCD_CLK_SYNT (MISC_BASE + 0x05C)
108#define FIRDA_CLK_SYNT (MISC_BASE + 0x060)
109#define UART_CLK_SYNT (MISC_BASE + 0x064)
110#define GMAC_CLK_SYNT (MISC_BASE + 0x068)
111#define RAS1_CLK_SYNT (MISC_BASE + 0x06C)
112#define RAS2_CLK_SYNT (MISC_BASE + 0x070)
113#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
114#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
115/* aux clk synthesiser register masks for irda to ras4 */
116#define AUX_SYNT_ENB 31
117#define AUX_EQ_SEL_SHIFT 30
118#define AUX_EQ_SEL_MASK 1
119#define AUX_EQ1_SEL 0
120#define AUX_EQ2_SEL 1
121#define AUX_XSCALE_SHIFT 16
122#define AUX_XSCALE_MASK 0xFFF
123#define AUX_YSCALE_SHIFT 0
124#define AUX_YSCALE_MASK 0xFFF
19 125
20/* root clks */ 126/* root clks */
21/* 32 KHz oscillator clock */ 127/* 32 KHz oscillator clock */
@@ -623,53 +729,53 @@ static struct clk dummy_apb_pclk;
623 729
624/* array of all spear 6xx clock lookups */ 730/* array of all spear 6xx clock lookups */
625static struct clk_lookup spear_clk_lookups[] = { 731static struct clk_lookup spear_clk_lookups[] = {
626 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk}, 732 CLKDEV_INIT(NULL, "apb_pclk", &dummy_apb_pclk),
627 /* root clks */ 733 /* root clks */
628 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 734 CLKDEV_INIT(NULL, "osc_32k_clk", &osc_32k_clk),
629 { .con_id = "osc_30m_clk", .clk = &osc_30m_clk}, 735 CLKDEV_INIT(NULL, "osc_30m_clk", &osc_30m_clk),
630 /* clock derived from 32 KHz os clk */ 736 /* clock derived from 32 KHz os clk */
631 { .dev_id = "rtc-spear", .clk = &rtc_clk}, 737 CLKDEV_INIT("rtc-spear", NULL, &rtc_clk),
632 /* clock derived from 30 MHz os clk */ 738 /* clock derived from 30 MHz os clk */
633 { .con_id = "pll1_clk", .clk = &pll1_clk}, 739 CLKDEV_INIT(NULL, "pll1_clk", &pll1_clk),
634 { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk}, 740 CLKDEV_INIT(NULL, "pll3_48m_clk", &pll3_48m_clk),
635 { .dev_id = "wdt", .clk = &wdt_clk}, 741 CLKDEV_INIT("wdt", NULL, &wdt_clk),
636 /* clock derived from pll1 clk */ 742 /* clock derived from pll1 clk */
637 { .con_id = "cpu_clk", .clk = &cpu_clk}, 743 CLKDEV_INIT(NULL, "cpu_clk", &cpu_clk),
638 { .con_id = "ahb_clk", .clk = &ahb_clk}, 744 CLKDEV_INIT(NULL, "ahb_clk", &ahb_clk),
639 { .con_id = "uart_synth_clk", .clk = &uart_synth_clk}, 745 CLKDEV_INIT(NULL, "uart_synth_clk", &uart_synth_clk),
640 { .con_id = "firda_synth_clk", .clk = &firda_synth_clk}, 746 CLKDEV_INIT(NULL, "firda_synth_clk", &firda_synth_clk),
641 { .con_id = "clcd_synth_clk", .clk = &clcd_synth_clk}, 747 CLKDEV_INIT(NULL, "clcd_synth_clk", &clcd_synth_clk),
642 { .con_id = "gpt0_synth_clk", .clk = &gpt0_synth_clk}, 748 CLKDEV_INIT(NULL, "gpt0_synth_clk", &gpt0_synth_clk),
643 { .con_id = "gpt2_synth_clk", .clk = &gpt2_synth_clk}, 749 CLKDEV_INIT(NULL, "gpt2_synth_clk", &gpt2_synth_clk),
644 { .con_id = "gpt3_synth_clk", .clk = &gpt3_synth_clk}, 750 CLKDEV_INIT(NULL, "gpt3_synth_clk", &gpt3_synth_clk),
645 { .dev_id = "d0000000.serial", .clk = &uart0_clk}, 751 CLKDEV_INIT("d0000000.serial", NULL, &uart0_clk),
646 { .dev_id = "d0080000.serial", .clk = &uart1_clk}, 752 CLKDEV_INIT("d0080000.serial", NULL, &uart1_clk),
647 { .dev_id = "firda", .clk = &firda_clk}, 753 CLKDEV_INIT("firda", NULL, &firda_clk),
648 { .dev_id = "clcd", .clk = &clcd_clk}, 754 CLKDEV_INIT("clcd", NULL, &clcd_clk),
649 { .dev_id = "gpt0", .clk = &gpt0_clk}, 755 CLKDEV_INIT("gpt0", NULL, &gpt0_clk),
650 { .dev_id = "gpt1", .clk = &gpt1_clk}, 756 CLKDEV_INIT("gpt1", NULL, &gpt1_clk),
651 { .dev_id = "gpt2", .clk = &gpt2_clk}, 757 CLKDEV_INIT("gpt2", NULL, &gpt2_clk),
652 { .dev_id = "gpt3", .clk = &gpt3_clk}, 758 CLKDEV_INIT("gpt3", NULL, &gpt3_clk),
653 /* clock derived from pll3 clk */ 759 /* clock derived from pll3 clk */
654 { .dev_id = "designware_udc", .clk = &usbd_clk}, 760 CLKDEV_INIT("designware_udc", NULL, &usbd_clk),
655 { .con_id = "usbh.0_clk", .clk = &usbh0_clk}, 761 CLKDEV_INIT(NULL, "usbh.0_clk", &usbh0_clk),
656 { .con_id = "usbh.1_clk", .clk = &usbh1_clk}, 762 CLKDEV_INIT(NULL, "usbh.1_clk", &usbh1_clk),
657 /* clock derived from ahb clk */ 763 /* clock derived from ahb clk */
658 { .con_id = "apb_clk", .clk = &apb_clk}, 764 CLKDEV_INIT(NULL, "apb_clk", &apb_clk),
659 { .dev_id = "d0200000.i2c", .clk = &i2c_clk}, 765 CLKDEV_INIT("d0200000.i2c", NULL, &i2c_clk),
660 { .dev_id = "dma", .clk = &dma_clk}, 766 CLKDEV_INIT("fc400000.dma", NULL, &dma_clk),
661 { .dev_id = "jpeg", .clk = &jpeg_clk}, 767 CLKDEV_INIT("jpeg", NULL, &jpeg_clk),
662 { .dev_id = "gmac", .clk = &gmac_clk}, 768 CLKDEV_INIT("gmac", NULL, &gmac_clk),
663 { .dev_id = "smi", .clk = &smi_clk}, 769 CLKDEV_INIT("fc000000.flash", NULL, &smi_clk),
664 { .dev_id = "fsmc-nand", .clk = &fsmc_clk}, 770 CLKDEV_INIT("d1800000.flash", NULL, &fsmc_clk),
665 /* clock derived from apb clk */ 771 /* clock derived from apb clk */
666 { .dev_id = "adc", .clk = &adc_clk}, 772 CLKDEV_INIT("adc", NULL, &adc_clk),
667 { .dev_id = "ssp-pl022.0", .clk = &ssp0_clk}, 773 CLKDEV_INIT("ssp-pl022.0", NULL, &ssp0_clk),
668 { .dev_id = "ssp-pl022.1", .clk = &ssp1_clk}, 774 CLKDEV_INIT("ssp-pl022.1", NULL, &ssp1_clk),
669 { .dev_id = "ssp-pl022.2", .clk = &ssp2_clk}, 775 CLKDEV_INIT("ssp-pl022.2", NULL, &ssp2_clk),
670 { .dev_id = "f0100000.gpio", .clk = &gpio0_clk}, 776 CLKDEV_INIT("f0100000.gpio", NULL, &gpio0_clk),
671 { .dev_id = "fc980000.gpio", .clk = &gpio1_clk}, 777 CLKDEV_INIT("fc980000.gpio", NULL, &gpio1_clk),
672 { .dev_id = "d8100000.gpio", .clk = &gpio2_clk}, 778 CLKDEV_INIT("d8100000.gpio", NULL, &gpio2_clk),
673}; 779};
674 780
675void __init spear6xx_clk_init(void) 781void __init spear6xx_clk_init(void)
diff --git a/arch/arm/mach-spear6xx/include/mach/generic.h b/arch/arm/mach-spear6xx/include/mach/generic.h
index 116b99301cf5..7167fd331d86 100644
--- a/arch/arm/mach-spear6xx/include/mach/generic.h
+++ b/arch/arm/mach-spear6xx/include/mach/generic.h
@@ -15,34 +15,9 @@
15#define __MACH_GENERIC_H 15#define __MACH_GENERIC_H
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/amba/bus.h>
20#include <asm/mach/time.h>
21#include <asm/mach/map.h>
22
23/*
24 * Each GPT has 2 timer channels
25 * Following GPT channels will be used as clock source and clockevent
26 */
27#define SPEAR_GPT0_BASE SPEAR6XX_CPU_TMR_BASE
28#define SPEAR_GPT0_CHAN0_IRQ IRQ_CPU_GPT1_1
29#define SPEAR_GPT0_CHAN1_IRQ IRQ_CPU_GPT1_2
30
31/* Add spear6xx family device structure declarations here */
32extern struct amba_device gpio_device[];
33extern struct amba_device uart_device[];
34extern struct sys_timer spear6xx_timer;
35
36/* Add spear6xx family function declarations here */
37void __init spear_setup_timer(void);
38void __init spear6xx_map_io(void);
39void __init spear6xx_init_irq(void);
40void __init spear6xx_init(void);
41void __init spear600_init(void);
42void __init spear6xx_clk_init(void);
43 18
19void __init spear_setup_timer(resource_size_t base, int irq);
44void spear_restart(char, const char *); 20void spear_restart(char, const char *);
45 21void __init spear6xx_clk_init(void);
46/* Add spear600 machine device structure declarations here */
47 22
48#endif /* __MACH_GENERIC_H */ 23#endif /* __MACH_GENERIC_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/hardware.h b/arch/arm/mach-spear6xx/include/mach/hardware.h
index 0b3f96ae2848..40a8c178f10d 100644
--- a/arch/arm/mach-spear6xx/include/mach/hardware.h
+++ b/arch/arm/mach-spear6xx/include/mach/hardware.h
@@ -1,23 +1 @@
1/* /* empty */
2 * arch/arm/mach-spear6xx/include/mach/hardware.h
3 *
4 * Hardware definitions for SPEAr6xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_HARDWARE_H
15#define __MACH_HARDWARE_H
16
17#include <plat/hardware.h>
18#include <mach/spear.h>
19
20/* Vitual to physical translation of statically mapped space */
21#define IO_ADDRESS(x) (x | 0xF0000000)
22
23#endif /* __MACH_HARDWARE_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/irqs.h b/arch/arm/mach-spear6xx/include/mach/irqs.h
index 8f214b03d75d..2b735389e74b 100644
--- a/arch/arm/mach-spear6xx/include/mach/irqs.h
+++ b/arch/arm/mach-spear6xx/include/mach/irqs.h
@@ -16,82 +16,13 @@
16 16
17/* IRQ definitions */ 17/* IRQ definitions */
18/* VIC 1 */ 18/* VIC 1 */
19#define IRQ_INTRCOMM_SW_IRQ 0 19/* FIXME: probe this from DT */
20#define IRQ_INTRCOMM_CPU_1 1
21#define IRQ_INTRCOMM_CPU_2 2
22#define IRQ_INTRCOMM_RAS2A11_1 3
23#define IRQ_INTRCOMM_RAS2A11_2 4
24#define IRQ_INTRCOMM_RAS2A12_1 5
25#define IRQ_INTRCOMM_RAS2A12_2 6
26#define IRQ_GEN_RAS_0 7
27#define IRQ_GEN_RAS_1 8
28#define IRQ_GEN_RAS_2 9
29#define IRQ_GEN_RAS_3 10
30#define IRQ_GEN_RAS_4 11
31#define IRQ_GEN_RAS_5 12
32#define IRQ_GEN_RAS_6 13
33#define IRQ_GEN_RAS_7 14
34#define IRQ_GEN_RAS_8 15
35#define IRQ_CPU_GPT1_1 16 20#define IRQ_CPU_GPT1_1 16
36#define IRQ_CPU_GPT1_2 17
37#define IRQ_LOCAL_GPIO 18
38#define IRQ_PLL_UNLOCK 19
39#define IRQ_JPEG 20
40#define IRQ_FSMC 21
41#define IRQ_IRDA 22
42#define IRQ_RESERVED 23
43#define IRQ_UART_0 24
44#define IRQ_UART_1 25
45#define IRQ_SSP_1 26
46#define IRQ_SSP_2 27
47#define IRQ_I2C 28
48#define IRQ_GEN_RAS_9 29
49#define IRQ_GEN_RAS_10 30
50#define IRQ_GEN_RAS_11 31
51
52/* VIC 2 */
53#define IRQ_APPL_GPT1_1 32
54#define IRQ_APPL_GPT1_2 33
55#define IRQ_APPL_GPT2_1 34
56#define IRQ_APPL_GPT2_2 35
57#define IRQ_APPL_GPIO 36
58#define IRQ_APPL_SSP 37
59#define IRQ_APPL_ADC 38
60#define IRQ_APPL_RESERVED 39
61#define IRQ_AHB_EXP_MASTER 40
62#define IRQ_DDR_CONTROLLER 41
63#define IRQ_BASIC_DMA 42
64#define IRQ_BASIC_RESERVED1 43
65#define IRQ_BASIC_SMI 44
66#define IRQ_BASIC_CLCD 45
67#define IRQ_EXP_AHB_1 46
68#define IRQ_EXP_AHB_2 47
69#define IRQ_BASIC_GPT1_1 48
70#define IRQ_BASIC_GPT1_2 49
71#define IRQ_BASIC_RTC 50
72#define IRQ_BASIC_GPIO 51
73#define IRQ_BASIC_WDT 52
74#define IRQ_BASIC_RESERVED 53
75#define IRQ_AHB_EXP_SLAVE 54
76#define IRQ_GMAC_1 55
77#define IRQ_GMAC_2 56
78#define IRQ_USB_DEV 57
79#define IRQ_USB_H_OHCI_0 58
80#define IRQ_USB_H_EHCI_0 59
81#define IRQ_USB_H_OHCI_1 60
82#define IRQ_USB_H_EHCI_1 61
83#define IRQ_EXP_AHB_3 62
84#define IRQ_EXP_AHB_4 63
85 21
86#define IRQ_VIC_END 64 22#define IRQ_VIC_END 64
87 23
88/* GPIO pins virtual irqs */ 24/* GPIO pins virtual irqs */
89#define SPEAR_GPIO_INT_BASE IRQ_VIC_END 25#define VIRTUAL_IRQS 24
90#define SPEAR_GPIO0_INT_BASE SPEAR_GPIO_INT_BASE 26#define NR_IRQS (IRQ_VIC_END + VIRTUAL_IRQS)
91#define SPEAR_GPIO1_INT_BASE (SPEAR_GPIO0_INT_BASE + 8)
92#define SPEAR_GPIO2_INT_BASE (SPEAR_GPIO1_INT_BASE + 8)
93#define SPEAR_GPIO_INT_END (SPEAR_GPIO2_INT_BASE + 8)
94#define VIRTUAL_IRQS (SPEAR_GPIO_INT_END - IRQ_VIC_END)
95#define NR_IRQS (IRQ_VIC_END + VIRTUAL_IRQS)
96 27
97#endif /* __MACH_IRQS_H */ 28#endif /* __MACH_IRQS_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/misc_regs.h b/arch/arm/mach-spear6xx/include/mach/misc_regs.h
index 68c20a007b0d..2b9aaa6cdd11 100644
--- a/arch/arm/mach-spear6xx/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear6xx/include/mach/misc_regs.h
@@ -14,161 +14,7 @@
14#ifndef __MACH_MISC_REGS_H 14#ifndef __MACH_MISC_REGS_H
15#define __MACH_MISC_REGS_H 15#define __MACH_MISC_REGS_H
16 16
17#include <mach/hardware.h>
18
19#define MISC_BASE IOMEM(VA_SPEAR6XX_ICM3_MISC_REG_BASE) 17#define MISC_BASE IOMEM(VA_SPEAR6XX_ICM3_MISC_REG_BASE)
20
21#define SOC_CFG_CTR (MISC_BASE + 0x000)
22#define DIAG_CFG_CTR (MISC_BASE + 0x004)
23#define PLL1_CTR (MISC_BASE + 0x008)
24#define PLL1_FRQ (MISC_BASE + 0x00C)
25#define PLL1_MOD (MISC_BASE + 0x010)
26#define PLL2_CTR (MISC_BASE + 0x014)
27/* PLL_CTR register masks */
28#define PLL_ENABLE 2
29#define PLL_MODE_SHIFT 4
30#define PLL_MODE_MASK 0x3
31#define PLL_MODE_NORMAL 0
32#define PLL_MODE_FRACTION 1
33#define PLL_MODE_DITH_DSB 2
34#define PLL_MODE_DITH_SSB 3
35
36#define PLL2_FRQ (MISC_BASE + 0x018)
37/* PLL FRQ register masks */
38#define PLL_DIV_N_SHIFT 0
39#define PLL_DIV_N_MASK 0xFF
40#define PLL_DIV_P_SHIFT 8
41#define PLL_DIV_P_MASK 0x7
42#define PLL_NORM_FDBK_M_SHIFT 24
43#define PLL_NORM_FDBK_M_MASK 0xFF
44#define PLL_DITH_FDBK_M_SHIFT 16
45#define PLL_DITH_FDBK_M_MASK 0xFFFF
46
47#define PLL2_MOD (MISC_BASE + 0x01C)
48#define PLL_CLK_CFG (MISC_BASE + 0x020)
49#define CORE_CLK_CFG (MISC_BASE + 0x024)
50/* CORE CLK CFG register masks */
51#define PLL_HCLK_RATIO_SHIFT 10
52#define PLL_HCLK_RATIO_MASK 0x3
53#define HCLK_PCLK_RATIO_SHIFT 8
54#define HCLK_PCLK_RATIO_MASK 0x3
55
56#define PERIP_CLK_CFG (MISC_BASE + 0x028)
57/* PERIP_CLK_CFG register masks */
58#define CLCD_CLK_SHIFT 2
59#define CLCD_CLK_MASK 0x3
60#define UART_CLK_SHIFT 4
61#define UART_CLK_MASK 0x1
62#define FIRDA_CLK_SHIFT 5
63#define FIRDA_CLK_MASK 0x3
64#define GPT0_CLK_SHIFT 8
65#define GPT1_CLK_SHIFT 10
66#define GPT2_CLK_SHIFT 11
67#define GPT3_CLK_SHIFT 12
68#define GPT_CLK_MASK 0x1
69#define AUX_CLK_PLL3_VAL 0
70#define AUX_CLK_PLL1_VAL 1
71
72#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
73/* PERIP1_CLK_ENB register masks */
74#define UART0_CLK_ENB 3
75#define UART1_CLK_ENB 4
76#define SSP0_CLK_ENB 5
77#define SSP1_CLK_ENB 6
78#define I2C_CLK_ENB 7
79#define JPEG_CLK_ENB 8
80#define FSMC_CLK_ENB 9
81#define FIRDA_CLK_ENB 10
82#define GPT2_CLK_ENB 11
83#define GPT3_CLK_ENB 12
84#define GPIO2_CLK_ENB 13
85#define SSP2_CLK_ENB 14
86#define ADC_CLK_ENB 15
87#define GPT1_CLK_ENB 11
88#define RTC_CLK_ENB 17
89#define GPIO1_CLK_ENB 18
90#define DMA_CLK_ENB 19
91#define SMI_CLK_ENB 21
92#define CLCD_CLK_ENB 22
93#define GMAC_CLK_ENB 23
94#define USBD_CLK_ENB 24
95#define USBH0_CLK_ENB 25
96#define USBH1_CLK_ENB 26
97
98#define SOC_CORE_ID (MISC_BASE + 0x030)
99#define RAS_CLK_ENB (MISC_BASE + 0x034)
100#define PERIP1_SOF_RST (MISC_BASE + 0x038)
101/* PERIP1_SOF_RST register masks */
102#define JPEG_SOF_RST 8
103
104#define SOC_USER_ID (MISC_BASE + 0x03C)
105#define RAS_SOF_RST (MISC_BASE + 0x040)
106#define PRSC1_CLK_CFG (MISC_BASE + 0x044)
107#define PRSC2_CLK_CFG (MISC_BASE + 0x048)
108#define PRSC3_CLK_CFG (MISC_BASE + 0x04C)
109/* gpt synthesizer register masks */
110#define GPT_MSCALE_SHIFT 0
111#define GPT_MSCALE_MASK 0xFFF
112#define GPT_NSCALE_SHIFT 12
113#define GPT_NSCALE_MASK 0xF
114
115#define AMEM_CLK_CFG (MISC_BASE + 0x050)
116#define EXPI_CLK_CFG (MISC_BASE + 0x054)
117#define CLCD_CLK_SYNT (MISC_BASE + 0x05C)
118#define FIRDA_CLK_SYNT (MISC_BASE + 0x060)
119#define UART_CLK_SYNT (MISC_BASE + 0x064)
120#define GMAC_CLK_SYNT (MISC_BASE + 0x068)
121#define RAS1_CLK_SYNT (MISC_BASE + 0x06C)
122#define RAS2_CLK_SYNT (MISC_BASE + 0x070)
123#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
124#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
125/* aux clk synthesiser register masks for irda to ras4 */
126#define AUX_SYNT_ENB 31
127#define AUX_EQ_SEL_SHIFT 30
128#define AUX_EQ_SEL_MASK 1
129#define AUX_EQ1_SEL 0
130#define AUX_EQ2_SEL 1
131#define AUX_XSCALE_SHIFT 16
132#define AUX_XSCALE_MASK 0xFFF
133#define AUX_YSCALE_SHIFT 0
134#define AUX_YSCALE_MASK 0xFFF
135
136#define ICM1_ARB_CFG (MISC_BASE + 0x07C)
137#define ICM2_ARB_CFG (MISC_BASE + 0x080)
138#define ICM3_ARB_CFG (MISC_BASE + 0x084)
139#define ICM4_ARB_CFG (MISC_BASE + 0x088)
140#define ICM5_ARB_CFG (MISC_BASE + 0x08C)
141#define ICM6_ARB_CFG (MISC_BASE + 0x090)
142#define ICM7_ARB_CFG (MISC_BASE + 0x094)
143#define ICM8_ARB_CFG (MISC_BASE + 0x098)
144#define ICM9_ARB_CFG (MISC_BASE + 0x09C)
145#define DMA_CHN_CFG (MISC_BASE + 0x0A0) 18#define DMA_CHN_CFG (MISC_BASE + 0x0A0)
146#define USB2_PHY_CFG (MISC_BASE + 0x0A4)
147#define GMAC_CFG_CTR (MISC_BASE + 0x0A8)
148#define EXPI_CFG_CTR (MISC_BASE + 0x0AC)
149#define PRC1_LOCK_CTR (MISC_BASE + 0x0C0)
150#define PRC2_LOCK_CTR (MISC_BASE + 0x0C4)
151#define PRC3_LOCK_CTR (MISC_BASE + 0x0C8)
152#define PRC4_LOCK_CTR (MISC_BASE + 0x0CC)
153#define PRC1_IRQ_CTR (MISC_BASE + 0x0D0)
154#define PRC2_IRQ_CTR (MISC_BASE + 0x0D4)
155#define PRC3_IRQ_CTR (MISC_BASE + 0x0D8)
156#define PRC4_IRQ_CTR (MISC_BASE + 0x0DC)
157#define PWRDOWN_CFG_CTR (MISC_BASE + 0x0E0)
158#define COMPSSTL_1V8_CFG (MISC_BASE + 0x0E4)
159#define COMPSSTL_2V5_CFG (MISC_BASE + 0x0E8)
160#define COMPCOR_3V3_CFG (MISC_BASE + 0x0EC)
161#define SSTLPAD_CFG_CTR (MISC_BASE + 0x0F0)
162#define BIST1_CFG_CTR (MISC_BASE + 0x0F4)
163#define BIST2_CFG_CTR (MISC_BASE + 0x0F8)
164#define BIST3_CFG_CTR (MISC_BASE + 0x0FC)
165#define BIST4_CFG_CTR (MISC_BASE + 0x100)
166#define BIST5_CFG_CTR (MISC_BASE + 0x104)
167#define BIST1_STS_RES (MISC_BASE + 0x108)
168#define BIST2_STS_RES (MISC_BASE + 0x10C)
169#define BIST3_STS_RES (MISC_BASE + 0x110)
170#define BIST4_STS_RES (MISC_BASE + 0x114)
171#define BIST5_STS_RES (MISC_BASE + 0x118)
172#define SYSERR_CFG_CTR (MISC_BASE + 0x11C)
173 19
174#endif /* __MACH_MISC_REGS_H */ 20#endif /* __MACH_MISC_REGS_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/spear.h b/arch/arm/mach-spear6xx/include/mach/spear.h
index 7fd621532def..d278ed047a53 100644
--- a/arch/arm/mach-spear6xx/include/mach/spear.h
+++ b/arch/arm/mach-spear6xx/include/mach/spear.h
@@ -15,69 +15,26 @@
15#define __MACH_SPEAR6XX_H 15#define __MACH_SPEAR6XX_H
16 16
17#include <asm/memory.h> 17#include <asm/memory.h>
18#include <mach/spear600.h>
19 18
20#define SPEAR6XX_ML_SDRAM_BASE UL(0x00000000)
21/* ICM1 - Low speed connection */ 19/* ICM1 - Low speed connection */
22#define SPEAR6XX_ICM1_BASE UL(0xD0000000) 20#define SPEAR6XX_ICM1_BASE UL(0xD0000000)
23 21#define VA_SPEAR6XX_ICM1_BASE UL(0xFD000000)
24#define SPEAR6XX_ICM1_UART0_BASE UL(0xD0000000) 22#define SPEAR6XX_ICM1_UART0_BASE UL(0xD0000000)
25#define VA_SPEAR6XX_ICM1_UART0_BASE IO_ADDRESS(SPEAR6XX_ICM1_UART0_BASE) 23#define VA_SPEAR6XX_ICM1_UART0_BASE (VA_SPEAR6XX_ICM1_2_BASE | SPEAR6XX_ICM1_UART0_BASE)
26
27#define SPEAR6XX_ICM1_UART1_BASE UL(0xD0080000)
28#define SPEAR6XX_ICM1_SSP0_BASE UL(0xD0100000)
29#define SPEAR6XX_ICM1_SSP1_BASE UL(0xD0180000)
30#define SPEAR6XX_ICM1_I2C_BASE UL(0xD0200000)
31#define SPEAR6XX_ICM1_JPEG_BASE UL(0xD0800000)
32#define SPEAR6XX_ICM1_IRDA_BASE UL(0xD1000000)
33#define SPEAR6XX_ICM1_FSMC_BASE UL(0xD1800000)
34#define SPEAR6XX_ICM1_NAND_BASE UL(0xD2000000)
35#define SPEAR6XX_ICM1_SRAM_BASE UL(0xD2800000)
36
37/* ICM2 - Application Subsystem */
38#define SPEAR6XX_ICM2_BASE UL(0xD8000000)
39#define SPEAR6XX_ICM2_TMR0_BASE UL(0xD8000000)
40#define SPEAR6XX_ICM2_TMR1_BASE UL(0xD8080000)
41#define SPEAR6XX_ICM2_GPIO_BASE UL(0xD8100000)
42#define SPEAR6XX_ICM2_SSP2_BASE UL(0xD8180000)
43#define SPEAR6XX_ICM2_ADC_BASE UL(0xD8200000)
44 24
45/* ML-1, 2 - Multi Layer CPU Subsystem */ 25/* ML-1, 2 - Multi Layer CPU Subsystem */
46#define SPEAR6XX_ML_CPU_BASE UL(0xF0000000) 26#define SPEAR6XX_ML_CPU_BASE UL(0xF0000000)
27#define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000)
47#define SPEAR6XX_CPU_TMR_BASE UL(0xF0000000) 28#define SPEAR6XX_CPU_TMR_BASE UL(0xF0000000)
48#define SPEAR6XX_CPU_GPIO_BASE UL(0xF0100000)
49#define SPEAR6XX_CPU_VIC_SEC_BASE UL(0xF1000000)
50#define VA_SPEAR6XX_CPU_VIC_SEC_BASE IO_ADDRESS(SPEAR6XX_CPU_VIC_SEC_BASE)
51#define SPEAR6XX_CPU_VIC_PRI_BASE UL(0xF1100000)
52#define VA_SPEAR6XX_CPU_VIC_PRI_BASE IO_ADDRESS(SPEAR6XX_CPU_VIC_PRI_BASE)
53 29
54/* ICM3 - Basic Subsystem */ 30/* ICM3 - Basic Subsystem */
55#define SPEAR6XX_ICM3_BASE UL(0xF8000000)
56#define SPEAR6XX_ICM3_SMEM_BASE UL(0xF8000000)
57#define SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) 31#define SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
58#define SPEAR6XX_ICM3_CLCD_BASE UL(0xFC200000) 32#define VA_SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
59#define SPEAR6XX_ICM3_DMA_BASE UL(0xFC400000) 33#define SPEAR6XX_ICM3_DMA_BASE UL(0xFC400000)
60#define SPEAR6XX_ICM3_SDRAM_CTRL_BASE UL(0xFC600000)
61#define SPEAR6XX_ICM3_TMR_BASE UL(0xFC800000)
62#define SPEAR6XX_ICM3_WDT_BASE UL(0xFC880000)
63#define SPEAR6XX_ICM3_RTC_BASE UL(0xFC900000)
64#define SPEAR6XX_ICM3_GPIO_BASE UL(0xFC980000)
65#define SPEAR6XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000) 34#define SPEAR6XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000)
66#define VA_SPEAR6XX_ICM3_SYS_CTRL_BASE IO_ADDRESS(SPEAR6XX_ICM3_SYS_CTRL_BASE) 35#define VA_SPEAR6XX_ICM3_SYS_CTRL_BASE (VA_SPEAR6XX_ICM3_SMI_CTRL_BASE | SPEAR6XX_ICM3_SYS_CTRL_BASE)
67#define SPEAR6XX_ICM3_MISC_REG_BASE UL(0xFCA80000) 36#define SPEAR6XX_ICM3_MISC_REG_BASE UL(0xFCA80000)
68#define VA_SPEAR6XX_ICM3_MISC_REG_BASE IO_ADDRESS(SPEAR6XX_ICM3_MISC_REG_BASE) 37#define VA_SPEAR6XX_ICM3_MISC_REG_BASE (VA_SPEAR6XX_ICM3_SMI_CTRL_BASE | SPEAR6XX_ICM3_MISC_REG_BASE)
69
70/* ICM4 - High Speed Connection */
71#define SPEAR6XX_ICM4_BASE UL(0xE0000000)
72#define SPEAR6XX_ICM4_GMAC_BASE UL(0xE0800000)
73#define SPEAR6XX_ICM4_USBD_FIFO_BASE UL(0xE1000000)
74#define SPEAR6XX_ICM4_USBD_CSR_BASE UL(0xE1100000)
75#define SPEAR6XX_ICM4_USBD_PLDT_BASE UL(0xE1200000)
76#define SPEAR6XX_ICM4_USB_EHCI0_BASE UL(0xE1800000)
77#define SPEAR6XX_ICM4_USB_OHCI0_BASE UL(0xE1900000)
78#define SPEAR6XX_ICM4_USB_EHCI1_BASE UL(0xE2000000)
79#define SPEAR6XX_ICM4_USB_OHCI1_BASE UL(0xE2100000)
80#define SPEAR6XX_ICM4_USB_ARB_BASE UL(0xE2800000)
81 38
82/* Debug uart for linux, will be used for debug and uncompress messages */ 39/* Debug uart for linux, will be used for debug and uncompress messages */
83#define SPEAR_DBG_UART_BASE SPEAR6XX_ICM1_UART0_BASE 40#define SPEAR_DBG_UART_BASE SPEAR6XX_ICM1_UART0_BASE
diff --git a/arch/arm/mach-spear6xx/include/mach/spear600.h b/arch/arm/mach-spear6xx/include/mach/spear600.h
deleted file mode 100644
index c068cc50b0fb..000000000000
--- a/arch/arm/mach-spear6xx/include/mach/spear600.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * arch/arm/mach-spear66xx/include/mach/spear600.h
3 *
4 * SPEAr600 Machine specific definition
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifdef CONFIG_MACH_SPEAR600
15
16#ifndef __MACH_SPEAR600_H
17#define __MACH_SPEAR600_H
18
19#endif /* __MACH_SPEAR600_H */
20
21#endif /* CONFIG_MACH_SPEAR600 */
diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear6xx/spear6xx.c
index 2ed8b14c82c8..de194dbb8371 100644
--- a/arch/arm/mach-spear6xx/spear6xx.c
+++ b/arch/arm/mach-spear6xx/spear6xx.c
@@ -13,41 +13,404 @@
13 * warranty of any kind, whether express or implied. 13 * warranty of any kind, whether express or implied.
14 */ 14 */
15 15
16#include <linux/amba/pl08x.h>
17#include <linux/clk.h>
18#include <linux/err.h>
16#include <linux/of.h> 19#include <linux/of.h>
17#include <linux/of_address.h> 20#include <linux/of_address.h>
18#include <linux/of_irq.h> 21#include <linux/of_irq.h>
19#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <asm/hardware/pl080.h>
20#include <asm/hardware/vic.h> 24#include <asm/hardware/vic.h>
21#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/time.h>
27#include <asm/mach/map.h>
28#include <plat/pl080.h>
22#include <mach/generic.h> 29#include <mach/generic.h>
23#include <mach/hardware.h> 30#include <mach/spear.h>
24 31
25/* Following will create static virtual/physical mappings */ 32/* dmac device registration */
26static struct map_desc spear6xx_io_desc[] __initdata = { 33static struct pl08x_channel_data spear600_dma_info[] = {
27 { 34 {
28 .virtual = VA_SPEAR6XX_ICM1_UART0_BASE, 35 .bus_id = "ssp1_rx",
29 .pfn = __phys_to_pfn(SPEAR6XX_ICM1_UART0_BASE), 36 .min_signal = 0,
30 .length = SZ_4K, 37 .max_signal = 0,
31 .type = MT_DEVICE 38 .muxval = 0,
39 .cctl = 0,
40 .periph_buses = PL08X_AHB1,
32 }, { 41 }, {
33 .virtual = VA_SPEAR6XX_CPU_VIC_PRI_BASE, 42 .bus_id = "ssp1_tx",
34 .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_PRI_BASE), 43 .min_signal = 1,
35 .length = SZ_4K, 44 .max_signal = 1,
36 .type = MT_DEVICE 45 .muxval = 0,
46 .cctl = 0,
47 .periph_buses = PL08X_AHB1,
37 }, { 48 }, {
38 .virtual = VA_SPEAR6XX_CPU_VIC_SEC_BASE, 49 .bus_id = "uart0_rx",
39 .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_SEC_BASE), 50 .min_signal = 2,
40 .length = SZ_4K, 51 .max_signal = 2,
41 .type = MT_DEVICE 52 .muxval = 0,
53 .cctl = 0,
54 .periph_buses = PL08X_AHB1,
55 }, {
56 .bus_id = "uart0_tx",
57 .min_signal = 3,
58 .max_signal = 3,
59 .muxval = 0,
60 .cctl = 0,
61 .periph_buses = PL08X_AHB1,
62 }, {
63 .bus_id = "uart1_rx",
64 .min_signal = 4,
65 .max_signal = 4,
66 .muxval = 0,
67 .cctl = 0,
68 .periph_buses = PL08X_AHB1,
69 }, {
70 .bus_id = "uart1_tx",
71 .min_signal = 5,
72 .max_signal = 5,
73 .muxval = 0,
74 .cctl = 0,
75 .periph_buses = PL08X_AHB1,
76 }, {
77 .bus_id = "ssp2_rx",
78 .min_signal = 6,
79 .max_signal = 6,
80 .muxval = 0,
81 .cctl = 0,
82 .periph_buses = PL08X_AHB2,
83 }, {
84 .bus_id = "ssp2_tx",
85 .min_signal = 7,
86 .max_signal = 7,
87 .muxval = 0,
88 .cctl = 0,
89 .periph_buses = PL08X_AHB2,
90 }, {
91 .bus_id = "ssp0_rx",
92 .min_signal = 8,
93 .max_signal = 8,
94 .muxval = 0,
95 .cctl = 0,
96 .periph_buses = PL08X_AHB1,
97 }, {
98 .bus_id = "ssp0_tx",
99 .min_signal = 9,
100 .max_signal = 9,
101 .muxval = 0,
102 .cctl = 0,
103 .periph_buses = PL08X_AHB1,
104 }, {
105 .bus_id = "i2c_rx",
106 .min_signal = 10,
107 .max_signal = 10,
108 .muxval = 0,
109 .cctl = 0,
110 .periph_buses = PL08X_AHB1,
111 }, {
112 .bus_id = "i2c_tx",
113 .min_signal = 11,
114 .max_signal = 11,
115 .muxval = 0,
116 .cctl = 0,
117 .periph_buses = PL08X_AHB1,
118 }, {
119 .bus_id = "irda",
120 .min_signal = 12,
121 .max_signal = 12,
122 .muxval = 0,
123 .cctl = 0,
124 .periph_buses = PL08X_AHB1,
125 }, {
126 .bus_id = "adc",
127 .min_signal = 13,
128 .max_signal = 13,
129 .muxval = 0,
130 .cctl = 0,
131 .periph_buses = PL08X_AHB2,
132 }, {
133 .bus_id = "to_jpeg",
134 .min_signal = 14,
135 .max_signal = 14,
136 .muxval = 0,
137 .cctl = 0,
138 .periph_buses = PL08X_AHB1,
139 }, {
140 .bus_id = "from_jpeg",
141 .min_signal = 15,
142 .max_signal = 15,
143 .muxval = 0,
144 .cctl = 0,
145 .periph_buses = PL08X_AHB1,
146 }, {
147 .bus_id = "ras0_rx",
148 .min_signal = 0,
149 .max_signal = 0,
150 .muxval = 1,
151 .cctl = 0,
152 .periph_buses = PL08X_AHB1,
153 }, {
154 .bus_id = "ras0_tx",
155 .min_signal = 1,
156 .max_signal = 1,
157 .muxval = 1,
158 .cctl = 0,
159 .periph_buses = PL08X_AHB1,
160 }, {
161 .bus_id = "ras1_rx",
162 .min_signal = 2,
163 .max_signal = 2,
164 .muxval = 1,
165 .cctl = 0,
166 .periph_buses = PL08X_AHB1,
167 }, {
168 .bus_id = "ras1_tx",
169 .min_signal = 3,
170 .max_signal = 3,
171 .muxval = 1,
172 .cctl = 0,
173 .periph_buses = PL08X_AHB1,
174 }, {
175 .bus_id = "ras2_rx",
176 .min_signal = 4,
177 .max_signal = 4,
178 .muxval = 1,
179 .cctl = 0,
180 .periph_buses = PL08X_AHB1,
181 }, {
182 .bus_id = "ras2_tx",
183 .min_signal = 5,
184 .max_signal = 5,
185 .muxval = 1,
186 .cctl = 0,
187 .periph_buses = PL08X_AHB1,
188 }, {
189 .bus_id = "ras3_rx",
190 .min_signal = 6,
191 .max_signal = 6,
192 .muxval = 1,
193 .cctl = 0,
194 .periph_buses = PL08X_AHB1,
195 }, {
196 .bus_id = "ras3_tx",
197 .min_signal = 7,
198 .max_signal = 7,
199 .muxval = 1,
200 .cctl = 0,
201 .periph_buses = PL08X_AHB1,
202 }, {
203 .bus_id = "ras4_rx",
204 .min_signal = 8,
205 .max_signal = 8,
206 .muxval = 1,
207 .cctl = 0,
208 .periph_buses = PL08X_AHB1,
209 }, {
210 .bus_id = "ras4_tx",
211 .min_signal = 9,
212 .max_signal = 9,
213 .muxval = 1,
214 .cctl = 0,
215 .periph_buses = PL08X_AHB1,
216 }, {
217 .bus_id = "ras5_rx",
218 .min_signal = 10,
219 .max_signal = 10,
220 .muxval = 1,
221 .cctl = 0,
222 .periph_buses = PL08X_AHB1,
223 }, {
224 .bus_id = "ras5_tx",
225 .min_signal = 11,
226 .max_signal = 11,
227 .muxval = 1,
228 .cctl = 0,
229 .periph_buses = PL08X_AHB1,
230 }, {
231 .bus_id = "ras6_rx",
232 .min_signal = 12,
233 .max_signal = 12,
234 .muxval = 1,
235 .cctl = 0,
236 .periph_buses = PL08X_AHB1,
237 }, {
238 .bus_id = "ras6_tx",
239 .min_signal = 13,
240 .max_signal = 13,
241 .muxval = 1,
242 .cctl = 0,
243 .periph_buses = PL08X_AHB1,
42 }, { 244 }, {
43 .virtual = VA_SPEAR6XX_ICM3_SYS_CTRL_BASE, 245 .bus_id = "ras7_rx",
44 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SYS_CTRL_BASE), 246 .min_signal = 14,
45 .length = SZ_4K, 247 .max_signal = 14,
248 .muxval = 1,
249 .cctl = 0,
250 .periph_buses = PL08X_AHB1,
251 }, {
252 .bus_id = "ras7_tx",
253 .min_signal = 15,
254 .max_signal = 15,
255 .muxval = 1,
256 .cctl = 0,
257 .periph_buses = PL08X_AHB1,
258 }, {
259 .bus_id = "ext0_rx",
260 .min_signal = 0,
261 .max_signal = 0,
262 .muxval = 2,
263 .cctl = 0,
264 .periph_buses = PL08X_AHB2,
265 }, {
266 .bus_id = "ext0_tx",
267 .min_signal = 1,
268 .max_signal = 1,
269 .muxval = 2,
270 .cctl = 0,
271 .periph_buses = PL08X_AHB2,
272 }, {
273 .bus_id = "ext1_rx",
274 .min_signal = 2,
275 .max_signal = 2,
276 .muxval = 2,
277 .cctl = 0,
278 .periph_buses = PL08X_AHB2,
279 }, {
280 .bus_id = "ext1_tx",
281 .min_signal = 3,
282 .max_signal = 3,
283 .muxval = 2,
284 .cctl = 0,
285 .periph_buses = PL08X_AHB2,
286 }, {
287 .bus_id = "ext2_rx",
288 .min_signal = 4,
289 .max_signal = 4,
290 .muxval = 2,
291 .cctl = 0,
292 .periph_buses = PL08X_AHB2,
293 }, {
294 .bus_id = "ext2_tx",
295 .min_signal = 5,
296 .max_signal = 5,
297 .muxval = 2,
298 .cctl = 0,
299 .periph_buses = PL08X_AHB2,
300 }, {
301 .bus_id = "ext3_rx",
302 .min_signal = 6,
303 .max_signal = 6,
304 .muxval = 2,
305 .cctl = 0,
306 .periph_buses = PL08X_AHB2,
307 }, {
308 .bus_id = "ext3_tx",
309 .min_signal = 7,
310 .max_signal = 7,
311 .muxval = 2,
312 .cctl = 0,
313 .periph_buses = PL08X_AHB2,
314 }, {
315 .bus_id = "ext4_rx",
316 .min_signal = 8,
317 .max_signal = 8,
318 .muxval = 2,
319 .cctl = 0,
320 .periph_buses = PL08X_AHB2,
321 }, {
322 .bus_id = "ext4_tx",
323 .min_signal = 9,
324 .max_signal = 9,
325 .muxval = 2,
326 .cctl = 0,
327 .periph_buses = PL08X_AHB2,
328 }, {
329 .bus_id = "ext5_rx",
330 .min_signal = 10,
331 .max_signal = 10,
332 .muxval = 2,
333 .cctl = 0,
334 .periph_buses = PL08X_AHB2,
335 }, {
336 .bus_id = "ext5_tx",
337 .min_signal = 11,
338 .max_signal = 11,
339 .muxval = 2,
340 .cctl = 0,
341 .periph_buses = PL08X_AHB2,
342 }, {
343 .bus_id = "ext6_rx",
344 .min_signal = 12,
345 .max_signal = 12,
346 .muxval = 2,
347 .cctl = 0,
348 .periph_buses = PL08X_AHB2,
349 }, {
350 .bus_id = "ext6_tx",
351 .min_signal = 13,
352 .max_signal = 13,
353 .muxval = 2,
354 .cctl = 0,
355 .periph_buses = PL08X_AHB2,
356 }, {
357 .bus_id = "ext7_rx",
358 .min_signal = 14,
359 .max_signal = 14,
360 .muxval = 2,
361 .cctl = 0,
362 .periph_buses = PL08X_AHB2,
363 }, {
364 .bus_id = "ext7_tx",
365 .min_signal = 15,
366 .max_signal = 15,
367 .muxval = 2,
368 .cctl = 0,
369 .periph_buses = PL08X_AHB2,
370 },
371};
372
373struct pl08x_platform_data pl080_plat_data = {
374 .memcpy_channel = {
375 .bus_id = "memcpy",
376 .cctl = (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \
377 PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \
378 PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \
379 PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \
380 PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \
381 PL080_CONTROL_PROT_SYS),
382 },
383 .lli_buses = PL08X_AHB1,
384 .mem_buses = PL08X_AHB1,
385 .get_signal = pl080_get_signal,
386 .put_signal = pl080_put_signal,
387 .slave_channels = spear600_dma_info,
388 .num_slave_channels = ARRAY_SIZE(spear600_dma_info),
389};
390
391/*
392 * Following will create 16MB static virtual/physical mappings
393 * PHYSICAL VIRTUAL
394 * 0xF0000000 0xF0000000
395 * 0xF1000000 0xF1000000
396 * 0xD0000000 0xFD000000
397 * 0xFC000000 0xFC000000
398 */
399struct map_desc spear6xx_io_desc[] __initdata = {
400 {
401 .virtual = VA_SPEAR6XX_ML_CPU_BASE,
402 .pfn = __phys_to_pfn(SPEAR6XX_ML_CPU_BASE),
403 .length = 2 * SZ_16M,
404 .type = MT_DEVICE
405 }, {
406 .virtual = VA_SPEAR6XX_ICM1_BASE,
407 .pfn = __phys_to_pfn(SPEAR6XX_ICM1_BASE),
408 .length = SZ_16M,
46 .type = MT_DEVICE 409 .type = MT_DEVICE
47 }, { 410 }, {
48 .virtual = VA_SPEAR6XX_ICM3_MISC_REG_BASE, 411 .virtual = VA_SPEAR6XX_ICM3_SMI_CTRL_BASE,
49 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_MISC_REG_BASE), 412 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SMI_CTRL_BASE),
50 .length = SZ_4K, 413 .length = SZ_16M,
51 .type = MT_DEVICE 414 .type = MT_DEVICE
52 }, 415 },
53}; 416};
@@ -85,16 +448,24 @@ static void __init spear6xx_timer_init(void)
85 clk_put(gpt_clk); 448 clk_put(gpt_clk);
86 clk_put(pclk); 449 clk_put(pclk);
87 450
88 spear_setup_timer(); 451 spear_setup_timer(SPEAR6XX_CPU_TMR_BASE, IRQ_CPU_GPT1_1);
89} 452}
90 453
91struct sys_timer spear6xx_timer = { 454struct sys_timer spear6xx_timer = {
92 .init = spear6xx_timer_init, 455 .init = spear6xx_timer_init,
93}; 456};
94 457
458/* Add auxdata to pass platform data */
459struct of_dev_auxdata spear6xx_auxdata_lookup[] __initdata = {
460 OF_DEV_AUXDATA("arm,pl080", SPEAR6XX_ICM3_DMA_BASE, NULL,
461 &pl080_plat_data),
462 {}
463};
464
95static void __init spear600_dt_init(void) 465static void __init spear600_dt_init(void)
96{ 466{
97 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 467 of_platform_populate(NULL, of_default_bus_match_table,
468 spear6xx_auxdata_lookup, NULL);
98} 469}
99 470
100static const char *spear600_dt_board_compat[] = { 471static const char *spear600_dt_board_compat[] = {
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 880d02ec89d4..ef7099eea0f2 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -17,6 +17,7 @@ config UX500_SOC_DB5500
17config UX500_SOC_DB8500 17config UX500_SOC_DB8500
18 bool 18 bool
19 select MFD_DB8500_PRCMU 19 select MFD_DB8500_PRCMU
20 select REGULATOR
20 select REGULATOR_DB8500_PRCMU 21 select REGULATOR_DB8500_PRCMU
21 select CPU_FREQ_TABLE if CPU_FREQ 22 select CPU_FREQ_TABLE if CPU_FREQ
22 23
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 77d03c1fbd04..539da3f3c1c7 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -753,9 +753,10 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
753 {}, 753 {},
754}; 754};
755 755
756static const struct of_device_id u8500_soc_node[] = { 756static const struct of_device_id u8500_local_bus_nodes[] = {
757 /* only create devices below soc node */ 757 /* only create devices below soc node */
758 { .compatible = "stericsson,db8500", }, 758 { .compatible = "stericsson,db8500", },
759 { .compatible = "simple-bus"},
759 { }, 760 { },
760}; 761};
761 762
@@ -774,7 +775,7 @@ static void __init u8500_init_machine(void)
774 snowball_platform_devs[i]->dev.parent = parent; 775 snowball_platform_devs[i]->dev.parent = parent;
775 776
776 /* automatically probe child nodes of db8500 device */ 777 /* automatically probe child nodes of db8500 device */
777 of_platform_populate(NULL, u8500_soc_node, u8500_auxdata_lookup, parent); 778 of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
778 779
779 if (of_machine_is_compatible("st-ericsson,mop500")) { 780 if (of_machine_is_compatible("st-ericsson,mop500")) {
780 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 781 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index d2058ef8345f..eff5842f6232 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -99,7 +99,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
99 */ 99 */
100 write_pen_release(cpu_logical_map(cpu)); 100 write_pen_release(cpu_logical_map(cpu));
101 101
102 gic_raise_softirq(cpumask_of(cpu), 1); 102 smp_send_reschedule(cpu);
103 103
104 timeout = jiffies + (1 * HZ); 104 timeout = jiffies + (1 * HZ);
105 while (time_before(jiffies, timeout)) { 105 while (time_before(jiffies, timeout)) {
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 8070145ccb98..3f26db4ee8e6 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -305,6 +305,7 @@ struct omap_hwmod_sysc_fields {
305 * @rev_offs: IP block revision register offset (from module base addr) 305 * @rev_offs: IP block revision register offset (from module base addr)
306 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) 306 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr)
307 * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) 307 * @syss_offs: OCP_SYSSTATUS register offset (from module base addr)
308 * @srst_udelay: Delay needed after doing a softreset in usecs
308 * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART} 309 * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART}
309 * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported 310 * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported
310 * @clockact: the default value of the module CLOCKACTIVITY bits 311 * @clockact: the default value of the module CLOCKACTIVITY bits
@@ -330,9 +331,10 @@ struct omap_hwmod_class_sysconfig {
330 u16 sysc_offs; 331 u16 sysc_offs;
331 u16 syss_offs; 332 u16 syss_offs;
332 u16 sysc_flags; 333 u16 sysc_flags;
334 struct omap_hwmod_sysc_fields *sysc_fields;
335 u8 srst_udelay;
333 u8 idlemodes; 336 u8 idlemodes;
334 u8 clockact; 337 u8 clockact;
335 struct omap_hwmod_sysc_fields *sysc_fields;
336}; 338};
337 339
338/** 340/**
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index eec98afa0f83..f9a8c5341ee9 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -348,7 +348,6 @@ u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
348 sdrc_actim_ctrl_b_1, sdrc_mr_1); 348 sdrc_actim_ctrl_b_1, sdrc_mr_1);
349} 349}
350 350
351#ifdef CONFIG_PM
352void omap3_sram_restore_context(void) 351void omap3_sram_restore_context(void)
353{ 352{
354 omap_sram_ceil = omap_sram_base + omap_sram_size; 353 omap_sram_ceil = omap_sram_base + omap_sram_size;
@@ -358,17 +357,18 @@ void omap3_sram_restore_context(void)
358 omap3_sram_configure_core_dpll_sz); 357 omap3_sram_configure_core_dpll_sz);
359 omap_push_sram_idle(); 358 omap_push_sram_idle();
360} 359}
361#endif /* CONFIG_PM */
362
363#endif /* CONFIG_ARCH_OMAP3 */
364 360
365static inline int omap34xx_sram_init(void) 361static inline int omap34xx_sram_init(void)
366{ 362{
367#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
368 omap3_sram_restore_context(); 363 omap3_sram_restore_context();
369#endif
370 return 0; 364 return 0;
371} 365}
366#else
367static inline int omap34xx_sram_init(void)
368{
369 return 0;
370}
371#endif /* CONFIG_ARCH_OMAP3 */
372 372
373static inline int am33xx_sram_init(void) 373static inline int am33xx_sram_init(void)
374{ 374{
diff --git a/arch/arm/plat-spear/Kconfig b/arch/arm/plat-spear/Kconfig
index 1bb3dbce8810..6c066fcb2979 100644
--- a/arch/arm/plat-spear/Kconfig
+++ b/arch/arm/plat-spear/Kconfig
@@ -9,9 +9,10 @@ choice
9 default ARCH_SPEAR3XX 9 default ARCH_SPEAR3XX
10 10
11config ARCH_SPEAR3XX 11config ARCH_SPEAR3XX
12 bool "SPEAr3XX" 12 bool "ST SPEAr3xx with Device Tree"
13 select ARM_VIC 13 select ARM_VIC
14 select CPU_ARM926T 14 select CPU_ARM926T
15 select USE_OF
15 help 16 help
16 Supports for ARM's SPEAR3XX family 17 Supports for ARM's SPEAR3XX family
17 18
diff --git a/arch/arm/plat-spear/Makefile b/arch/arm/plat-spear/Makefile
index e0f2e5b9530c..4af6258d0fee 100644
--- a/arch/arm/plat-spear/Makefile
+++ b/arch/arm/plat-spear/Makefile
@@ -3,6 +3,6 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := clock.o restart.o time.o 6obj-y := clock.o restart.o time.o pl080.o
7 7
8obj-$(CONFIG_ARCH_SPEAR3XX) += shirq.o padmux.o 8obj-$(CONFIG_ARCH_SPEAR3XX) += shirq.o padmux.o
diff --git a/arch/arm/plat-spear/include/plat/debug-macro.S b/arch/arm/plat-spear/include/plat/debug-macro.S
index 02b160a1ec9b..ab3de721c5db 100644
--- a/arch/arm/plat-spear/include/plat/debug-macro.S
+++ b/arch/arm/plat-spear/include/plat/debug-macro.S
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include <linux/amba/serial.h> 14#include <linux/amba/serial.h>
15#include <mach/hardware.h> 15#include <mach/spear.h>
16 16
17 .macro addruart, rp, rv, tmp 17 .macro addruart, rp, rv, tmp
18 mov \rp, #SPEAR_DBG_UART_BASE @ Physical base 18 mov \rp, #SPEAR_DBG_UART_BASE @ Physical base
diff --git a/arch/arm/plat-spear/include/plat/hardware.h b/arch/arm/plat-spear/include/plat/hardware.h
deleted file mode 100644
index 70187d763e26..000000000000
--- a/arch/arm/plat-spear/include/plat/hardware.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * arch/arm/plat-spear/include/plat/hardware.h
3 *
4 * Hardware definitions for SPEAr
5 *
6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __PLAT_HARDWARE_H
15#define __PLAT_HARDWARE_H
16
17#endif /* __PLAT_HARDWARE_H */
diff --git a/arch/arm/plat-spear/include/plat/pl080.h b/arch/arm/plat-spear/include/plat/pl080.h
new file mode 100644
index 000000000000..e14a3e4932f9
--- /dev/null
+++ b/arch/arm/plat-spear/include/plat/pl080.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/plat-spear/include/plat/pl080.h
3 *
4 * DMAC pl080 definitions for SPEAr platform
5 *
6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __PLAT_PL080_H
15#define __PLAT_PL080_H
16
17struct pl08x_dma_chan;
18int pl080_get_signal(struct pl08x_dma_chan *ch);
19void pl080_put_signal(struct pl08x_dma_chan *ch);
20
21#endif /* __PLAT_PL080_H */
diff --git a/arch/arm/plat-spear/include/plat/uncompress.h b/arch/arm/plat-spear/include/plat/uncompress.h
index 1bf84527aee4..6dd455bafdfd 100644
--- a/arch/arm/plat-spear/include/plat/uncompress.h
+++ b/arch/arm/plat-spear/include/plat/uncompress.h
@@ -13,7 +13,7 @@
13 13
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/amba/serial.h> 15#include <linux/amba/serial.h>
16#include <mach/hardware.h> 16#include <mach/spear.h>
17 17
18#ifndef __PLAT_UNCOMPRESS_H 18#ifndef __PLAT_UNCOMPRESS_H
19#define __PLAT_UNCOMPRESS_H 19#define __PLAT_UNCOMPRESS_H
diff --git a/arch/arm/plat-spear/pl080.c b/arch/arm/plat-spear/pl080.c
new file mode 100644
index 000000000000..a56a067717c1
--- /dev/null
+++ b/arch/arm/plat-spear/pl080.c
@@ -0,0 +1,80 @@
1/*
2 * arch/arm/plat-spear/pl080.c
3 *
4 * DMAC pl080 definitions for SPEAr platform
5 *
6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/amba/pl08x.h>
15#include <linux/amba/bus.h>
16#include <linux/bug.h>
17#include <linux/err.h>
18#include <linux/io.h>
19#include <linux/spinlock_types.h>
20#include <mach/spear.h>
21#include <mach/misc_regs.h>
22
23static spinlock_t lock = __SPIN_LOCK_UNLOCKED(x);
24
25struct {
26 unsigned char busy;
27 unsigned char val;
28} signals[16] = {{0, 0}, };
29
30int pl080_get_signal(struct pl08x_dma_chan *ch)
31{
32 const struct pl08x_channel_data *cd = ch->cd;
33 unsigned int signal = cd->min_signal, val;
34 unsigned long flags;
35
36 spin_lock_irqsave(&lock, flags);
37
38 /* Return if signal is already acquired by somebody else */
39 if (signals[signal].busy &&
40 (signals[signal].val != cd->muxval)) {
41 spin_unlock_irqrestore(&lock, flags);
42 return -EBUSY;
43 }
44
45 /* If acquiring for the first time, configure it */
46 if (!signals[signal].busy) {
47 val = readl(DMA_CHN_CFG);
48
49 /*
50 * Each request line has two bits in DMA_CHN_CFG register. To
51 * goto the bits of current request line, do left shift of
52 * value by 2 * signal number.
53 */
54 val &= ~(0x3 << (signal * 2));
55 val |= cd->muxval << (signal * 2);
56 writel(val, DMA_CHN_CFG);
57 }
58
59 signals[signal].busy++;
60 signals[signal].val = cd->muxval;
61 spin_unlock_irqrestore(&lock, flags);
62
63 return signal;
64}
65
66void pl080_put_signal(struct pl08x_dma_chan *ch)
67{
68 const struct pl08x_channel_data *cd = ch->cd;
69 unsigned long flags;
70
71 spin_lock_irqsave(&lock, flags);
72
73 /* if signal is not used */
74 if (!signals[cd->min_signal].busy)
75 BUG();
76
77 signals[cd->min_signal].busy--;
78
79 spin_unlock_irqrestore(&lock, flags);
80}
diff --git a/arch/arm/plat-spear/restart.c b/arch/arm/plat-spear/restart.c
index 16f203e78d89..4471a232713a 100644
--- a/arch/arm/plat-spear/restart.c
+++ b/arch/arm/plat-spear/restart.c
@@ -13,7 +13,7 @@
13#include <linux/io.h> 13#include <linux/io.h>
14#include <asm/system_misc.h> 14#include <asm/system_misc.h>
15#include <asm/hardware/sp810.h> 15#include <asm/hardware/sp810.h>
16#include <mach/hardware.h> 16#include <mach/spear.h>
17#include <mach/generic.h> 17#include <mach/generic.h>
18 18
19void spear_restart(char mode, const char *cmd) 19void spear_restart(char mode, const char *cmd)
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
index abb5bdecd509..a3164d1647fd 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/plat-spear/time.c
@@ -15,14 +15,13 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/ioport.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/time.h> 21#include <linux/time.h>
21#include <linux/irq.h> 22#include <linux/irq.h>
22#include <asm/mach/time.h> 23#include <asm/mach/time.h>
23#include <mach/generic.h> 24#include <mach/generic.h>
24#include <mach/hardware.h>
25#include <mach/irqs.h>
26 25
27/* 26/*
28 * We would use TIMER0 and TIMER1 as clockevent and clocksource. 27 * We would use TIMER0 and TIMER1 as clockevent and clocksource.
@@ -175,7 +174,7 @@ static struct irqaction spear_timer_irq = {
175 .handler = spear_timer_interrupt 174 .handler = spear_timer_interrupt
176}; 175};
177 176
178static void __init spear_clockevent_init(void) 177static void __init spear_clockevent_init(int irq)
179{ 178{
180 u32 tick_rate; 179 u32 tick_rate;
181 180
@@ -195,19 +194,19 @@ static void __init spear_clockevent_init(void)
195 194
196 clockevents_register_device(&clkevt); 195 clockevents_register_device(&clkevt);
197 196
198 setup_irq(SPEAR_GPT0_CHAN0_IRQ, &spear_timer_irq); 197 setup_irq(irq, &spear_timer_irq);
199} 198}
200 199
201void __init spear_setup_timer(void) 200void __init spear_setup_timer(resource_size_t base, int irq)
202{ 201{
203 int ret; 202 int ret;
204 203
205 if (!request_mem_region(SPEAR_GPT0_BASE, SZ_1K, "gpt0")) { 204 if (!request_mem_region(base, SZ_1K, "gpt0")) {
206 pr_err("%s:cannot get IO addr\n", __func__); 205 pr_err("%s:cannot get IO addr\n", __func__);
207 return; 206 return;
208 } 207 }
209 208
210 gpt_base = (void __iomem *)ioremap(SPEAR_GPT0_BASE, SZ_1K); 209 gpt_base = ioremap(base, SZ_1K);
211 if (!gpt_base) { 210 if (!gpt_base) {
212 pr_err("%s:ioremap failed for gpt\n", __func__); 211 pr_err("%s:ioremap failed for gpt\n", __func__);
213 goto err_mem; 212 goto err_mem;
@@ -225,7 +224,7 @@ void __init spear_setup_timer(void)
225 goto err_clk; 224 goto err_clk;
226 } 225 }
227 226
228 spear_clockevent_init(); 227 spear_clockevent_init(irq);
229 spear_clocksource_init(); 228 spear_clocksource_init();
230 229
231 return; 230 return;
@@ -235,5 +234,5 @@ err_clk:
235err_iomap: 234err_iomap:
236 iounmap(gpt_base); 235 iounmap(gpt_base);
237err_mem: 236err_mem:
238 release_mem_region(SPEAR_GPT0_BASE, SZ_1K); 237 release_mem_region(base, SZ_1K);
239} 238}
diff --git a/arch/ia64/include/asm/futex.h b/arch/ia64/include/asm/futex.h
index 0ab82cc2dc8f..d2bf1fd5e44f 100644
--- a/arch/ia64/include/asm/futex.h
+++ b/arch/ia64/include/asm/futex.h
@@ -106,15 +106,16 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
106 return -EFAULT; 106 return -EFAULT;
107 107
108 { 108 {
109 register unsigned long r8 __asm ("r8") = 0; 109 register unsigned long r8 __asm ("r8");
110 unsigned long prev; 110 unsigned long prev;
111 __asm__ __volatile__( 111 __asm__ __volatile__(
112 " mf;; \n" 112 " mf;; \n"
113 " mov ar.ccv=%3;; \n" 113 " mov %0=r0 \n"
114 "[1:] cmpxchg4.acq %0=[%1],%2,ar.ccv \n" 114 " mov ar.ccv=%4;; \n"
115 "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n"
115 " .xdata4 \"__ex_table\", 1b-., 2f-. \n" 116 " .xdata4 \"__ex_table\", 1b-., 2f-. \n"
116 "[2:]" 117 "[2:]"
117 : "=r" (prev) 118 : "=r" (r8), "=r" (prev)
118 : "r" (uaddr), "r" (newval), 119 : "r" (uaddr), "r" (newval),
119 "rO" ((long) (unsigned) oldval) 120 "rO" ((long) (unsigned) oldval)
120 : "memory"); 121 : "memory");
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 9d0fd7d5bb82..f00ba025375d 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -604,12 +604,6 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f)
604 spin_unlock(&(x)->ctx_lock); 604 spin_unlock(&(x)->ctx_lock);
605} 605}
606 606
607static inline unsigned int
608pfm_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len, int acct)
609{
610 return do_munmap(mm, addr, len);
611}
612
613static inline unsigned long 607static inline unsigned long
614pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec) 608pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec)
615{ 609{
@@ -1458,8 +1452,9 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)
1458 * a PROTECT_CTX() section. 1452 * a PROTECT_CTX() section.
1459 */ 1453 */
1460static int 1454static int
1461pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long size) 1455pfm_remove_smpl_mapping(void *vaddr, unsigned long size)
1462{ 1456{
1457 struct task_struct *task = current;
1463 int r; 1458 int r;
1464 1459
1465 /* sanity checks */ 1460 /* sanity checks */
@@ -1473,13 +1468,8 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz
1473 /* 1468 /*
1474 * does the actual unmapping 1469 * does the actual unmapping
1475 */ 1470 */
1476 down_write(&task->mm->mmap_sem); 1471 r = vm_munmap((unsigned long)vaddr, size);
1477 1472
1478 DPRINT(("down_write done smpl_vaddr=%p size=%lu\n", vaddr, size));
1479
1480 r = pfm_do_munmap(task->mm, (unsigned long)vaddr, size, 0);
1481
1482 up_write(&task->mm->mmap_sem);
1483 if (r !=0) { 1473 if (r !=0) {
1484 printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size); 1474 printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size);
1485 } 1475 }
@@ -1945,7 +1935,7 @@ pfm_flush(struct file *filp, fl_owner_t id)
1945 * because some VM function reenables interrupts. 1935 * because some VM function reenables interrupts.
1946 * 1936 *
1947 */ 1937 */
1948 if (smpl_buf_vaddr) pfm_remove_smpl_mapping(current, smpl_buf_vaddr, smpl_buf_size); 1938 if (smpl_buf_vaddr) pfm_remove_smpl_mapping(smpl_buf_vaddr, smpl_buf_size);
1949 1939
1950 return 0; 1940 return 0;
1951} 1941}
diff --git a/arch/m68k/configs/m5275evb_defconfig b/arch/m68k/configs/m5275evb_defconfig
index 33c32aeca12b..a1230e82bb1e 100644
--- a/arch/m68k/configs/m5275evb_defconfig
+++ b/arch/m68k/configs/m5275evb_defconfig
@@ -49,7 +49,6 @@ CONFIG_BLK_DEV_RAM=y
49CONFIG_NETDEVICES=y 49CONFIG_NETDEVICES=y
50CONFIG_NET_ETHERNET=y 50CONFIG_NET_ETHERNET=y
51CONFIG_FEC=y 51CONFIG_FEC=y
52CONFIG_FEC2=y
53# CONFIG_NETDEV_1000 is not set 52# CONFIG_NETDEV_1000 is not set
54# CONFIG_NETDEV_10000 is not set 53# CONFIG_NETDEV_10000 is not set
55CONFIG_PPP=y 54CONFIG_PPP=y
diff --git a/arch/m68k/platform/527x/config.c b/arch/m68k/platform/527x/config.c
index 7ed848c3b848..f91a53294c35 100644
--- a/arch/m68k/platform/527x/config.c
+++ b/arch/m68k/platform/527x/config.c
@@ -74,9 +74,7 @@ static void __init m527x_fec_init(void)
74 writew(par | 0xf00, MCF_IPSBAR + 0x100082); 74 writew(par | 0xf00, MCF_IPSBAR + 0x100082);
75 v = readb(MCF_IPSBAR + 0x100078); 75 v = readb(MCF_IPSBAR + 0x100078);
76 writeb(v | 0xc0, MCF_IPSBAR + 0x100078); 76 writeb(v | 0xc0, MCF_IPSBAR + 0x100078);
77#endif
78 77
79#ifdef CONFIG_FEC2
80 /* Set multi-function pins to ethernet mode for fec1 */ 78 /* Set multi-function pins to ethernet mode for fec1 */
81 par = readw(MCF_IPSBAR + 0x100082); 79 par = readw(MCF_IPSBAR + 0x100082);
82 writew(par | 0xa0, MCF_IPSBAR + 0x100082); 80 writew(par | 0xa0, MCF_IPSBAR + 0x100082);
diff --git a/arch/m68k/platform/68EZ328/Makefile b/arch/m68k/platform/68EZ328/Makefile
index ee97735a242c..b44d799b1115 100644
--- a/arch/m68k/platform/68EZ328/Makefile
+++ b/arch/m68k/platform/68EZ328/Makefile
@@ -3,9 +3,3 @@
3# 3#
4 4
5obj-y := config.o 5obj-y := config.o
6
7extra-y := bootlogo.rh
8
9$(obj)/bootlogo.rh: $(src)/bootlogo.h
10 perl $(src)/../68328/bootlogo.pl < $(src)/bootlogo.h \
11 > $(obj)/bootlogo.rh
diff --git a/arch/m68k/platform/68VZ328/Makefile b/arch/m68k/platform/68VZ328/Makefile
index 447ffa0fd7c7..a49d75e65489 100644
--- a/arch/m68k/platform/68VZ328/Makefile
+++ b/arch/m68k/platform/68VZ328/Makefile
@@ -3,14 +3,9 @@
3# 3#
4 4
5obj-y := config.o 5obj-y := config.o
6logo-$(UCDIMM) := bootlogo.rh 6extra-$(DRAGEN2):= screen.h
7logo-$(DRAGEN2) := screen.h
8extra-y := $(logo-y)
9
10$(obj)/bootlogo.rh: $(src)/../68EZ328/bootlogo.h
11 perl $(src)/bootlogo.pl < $(src)/../68328/bootlogo.h > $(obj)/bootlogo.rh
12 7
13$(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl 8$(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl
14 perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h 9 perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h
15 10
16clean-files := $(obj)/screen.h $(obj)/bootlogo.rh 11clean-files := $(obj)/screen.h
diff --git a/arch/m68k/platform/68EZ328/bootlogo.h b/arch/m68k/platform/68VZ328/bootlogo.h
index e842bdae5839..b38e2b255142 100644
--- a/arch/m68k/platform/68EZ328/bootlogo.h
+++ b/arch/m68k/platform/68VZ328/bootlogo.h
@@ -1,6 +1,6 @@
1#define splash_width 640 1#define splash_width 640
2#define splash_height 480 2#define splash_height 480
3static unsigned char splash_bits[] = { 3unsigned char __attribute__ ((aligned(16))) bootlogo_bits[] = {
4 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 4 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 5 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 6 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c
index fa50c48292ff..7af97362b95c 100644
--- a/arch/m68k/platform/coldfire/device.c
+++ b/arch/m68k/platform/coldfire/device.c
@@ -114,7 +114,7 @@ static struct resource mcf_fec1_resources[] = {
114 114
115static struct platform_device mcf_fec1 = { 115static struct platform_device mcf_fec1 = {
116 .name = "fec", 116 .name = "fec",
117 .id = 0, 117 .id = 1,
118 .num_resources = ARRAY_SIZE(mcf_fec1_resources), 118 .num_resources = ARRAY_SIZE(mcf_fec1_resources),
119 .resource = mcf_fec1_resources, 119 .resource = mcf_fec1_resources,
120}; 120};
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 2b7c0fbe578e..9015060919a0 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -90,7 +90,6 @@ config S390
90 select HAVE_KERNEL_XZ 90 select HAVE_KERNEL_XZ
91 select HAVE_ARCH_MUTEX_CPU_RELAX 91 select HAVE_ARCH_MUTEX_CPU_RELAX
92 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 92 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
93 select HAVE_RCU_TABLE_FREE if SMP
94 select ARCH_SAVE_PAGE_KEYS if HIBERNATION 93 select ARCH_SAVE_PAGE_KEYS if HIBERNATION
95 select HAVE_MEMBLOCK 94 select HAVE_MEMBLOCK
96 select HAVE_MEMBLOCK_NODE_MAP 95 select HAVE_MEMBLOCK_NODE_MAP
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 6cf8e26b3137..1957a9dd256d 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,8 +1,12 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
4CONFIG_FHANDLE=y
5CONFIG_TASKSTATS=y
6CONFIG_TASK_DELAY_ACCT=y
7CONFIG_TASK_XACCT=y
8CONFIG_TASK_IO_ACCOUNTING=y
4CONFIG_AUDIT=y 9CONFIG_AUDIT=y
5CONFIG_RCU_TRACE=y
6CONFIG_IKCONFIG=y 10CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 11CONFIG_IKCONFIG_PROC=y
8CONFIG_CGROUPS=y 12CONFIG_CGROUPS=y
@@ -14,16 +18,22 @@ CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y
14CONFIG_CGROUP_SCHED=y 18CONFIG_CGROUP_SCHED=y
15CONFIG_RT_GROUP_SCHED=y 19CONFIG_RT_GROUP_SCHED=y
16CONFIG_BLK_CGROUP=y 20CONFIG_BLK_CGROUP=y
21CONFIG_NAMESPACES=y
17CONFIG_BLK_DEV_INITRD=y 22CONFIG_BLK_DEV_INITRD=y
18# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 23CONFIG_RD_BZIP2=y
24CONFIG_RD_LZMA=y
25CONFIG_RD_XZ=y
26CONFIG_RD_LZO=y
27CONFIG_EXPERT=y
19# CONFIG_COMPAT_BRK is not set 28# CONFIG_COMPAT_BRK is not set
20CONFIG_SLAB=y
21CONFIG_PROFILING=y 29CONFIG_PROFILING=y
22CONFIG_OPROFILE=y 30CONFIG_OPROFILE=y
23CONFIG_KPROBES=y 31CONFIG_KPROBES=y
24CONFIG_MODULES=y 32CONFIG_MODULES=y
25CONFIG_MODULE_UNLOAD=y 33CONFIG_MODULE_UNLOAD=y
26CONFIG_MODVERSIONS=y 34CONFIG_MODVERSIONS=y
35CONFIG_PARTITION_ADVANCED=y
36CONFIG_IBM_PARTITION=y
27CONFIG_DEFAULT_DEADLINE=y 37CONFIG_DEFAULT_DEADLINE=y
28CONFIG_NO_HZ=y 38CONFIG_NO_HZ=y
29CONFIG_HIGH_RES_TIMERS=y 39CONFIG_HIGH_RES_TIMERS=y
@@ -34,18 +44,15 @@ CONFIG_KSM=y
34CONFIG_BINFMT_MISC=m 44CONFIG_BINFMT_MISC=m
35CONFIG_CMM=m 45CONFIG_CMM=m
36CONFIG_HZ_100=y 46CONFIG_HZ_100=y
37CONFIG_KEXEC=y 47CONFIG_CRASH_DUMP=y
38CONFIG_PM=y
39CONFIG_HIBERNATION=y 48CONFIG_HIBERNATION=y
40CONFIG_PACKET=y 49CONFIG_PACKET=y
41CONFIG_UNIX=y 50CONFIG_UNIX=y
42CONFIG_NET_KEY=y 51CONFIG_NET_KEY=y
43CONFIG_AFIUCV=m
44CONFIG_INET=y 52CONFIG_INET=y
45CONFIG_IP_MULTICAST=y 53CONFIG_IP_MULTICAST=y
46# CONFIG_INET_LRO is not set 54# CONFIG_INET_LRO is not set
47CONFIG_IPV6=y 55CONFIG_IPV6=y
48CONFIG_NET_SCTPPROBE=m
49CONFIG_L2TP=m 56CONFIG_L2TP=m
50CONFIG_L2TP_DEBUGFS=m 57CONFIG_L2TP_DEBUGFS=m
51CONFIG_VLAN_8021Q=y 58CONFIG_VLAN_8021Q=y
@@ -84,15 +91,14 @@ CONFIG_SCSI_CONSTANTS=y
84CONFIG_SCSI_LOGGING=y 91CONFIG_SCSI_LOGGING=y
85CONFIG_SCSI_SCAN_ASYNC=y 92CONFIG_SCSI_SCAN_ASYNC=y
86CONFIG_ZFCP=y 93CONFIG_ZFCP=y
87CONFIG_ZFCP_DIF=y
88CONFIG_NETDEVICES=y 94CONFIG_NETDEVICES=y
89CONFIG_DUMMY=m
90CONFIG_BONDING=m 95CONFIG_BONDING=m
96CONFIG_DUMMY=m
91CONFIG_EQUALIZER=m 97CONFIG_EQUALIZER=m
92CONFIG_TUN=m 98CONFIG_TUN=m
93CONFIG_NET_ETHERNET=y
94CONFIG_VIRTIO_NET=y 99CONFIG_VIRTIO_NET=y
95CONFIG_RAW_DRIVER=m 100CONFIG_RAW_DRIVER=m
101CONFIG_VIRTIO_BALLOON=y
96CONFIG_EXT2_FS=y 102CONFIG_EXT2_FS=y
97CONFIG_EXT3_FS=y 103CONFIG_EXT3_FS=y
98# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 104# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
@@ -103,27 +109,21 @@ CONFIG_PROC_KCORE=y
103CONFIG_TMPFS=y 109CONFIG_TMPFS=y
104CONFIG_TMPFS_POSIX_ACL=y 110CONFIG_TMPFS_POSIX_ACL=y
105# CONFIG_NETWORK_FILESYSTEMS is not set 111# CONFIG_NETWORK_FILESYSTEMS is not set
106CONFIG_PARTITION_ADVANCED=y
107CONFIG_IBM_PARTITION=y
108CONFIG_DLM=m
109CONFIG_MAGIC_SYSRQ=y 112CONFIG_MAGIC_SYSRQ=y
110CONFIG_DEBUG_KERNEL=y
111CONFIG_TIMER_STATS=y 113CONFIG_TIMER_STATS=y
112CONFIG_PROVE_LOCKING=y 114CONFIG_PROVE_LOCKING=y
113CONFIG_PROVE_RCU=y 115CONFIG_PROVE_RCU=y
114CONFIG_LOCK_STAT=y 116CONFIG_LOCK_STAT=y
115CONFIG_DEBUG_LOCKDEP=y 117CONFIG_DEBUG_LOCKDEP=y
116CONFIG_DEBUG_SPINLOCK_SLEEP=y
117CONFIG_DEBUG_LIST=y 118CONFIG_DEBUG_LIST=y
118CONFIG_DEBUG_NOTIFIERS=y 119CONFIG_DEBUG_NOTIFIERS=y
119# CONFIG_RCU_CPU_STALL_DETECTOR is not set 120CONFIG_RCU_TRACE=y
120CONFIG_KPROBES_SANITY_TEST=y 121CONFIG_KPROBES_SANITY_TEST=y
121CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y 122CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
122CONFIG_CPU_NOTIFIER_ERROR_INJECT=m 123CONFIG_CPU_NOTIFIER_ERROR_INJECT=m
123CONFIG_LATENCYTOP=y 124CONFIG_LATENCYTOP=y
124CONFIG_SYSCTL_SYSCALL_CHECK=y
125CONFIG_DEBUG_PAGEALLOC=y 125CONFIG_DEBUG_PAGEALLOC=y
126# CONFIG_FTRACE is not set 126CONFIG_BLK_DEV_IO_TRACE=y
127# CONFIG_STRICT_DEVMEM is not set 127# CONFIG_STRICT_DEVMEM is not set
128CONFIG_CRYPTO_NULL=m 128CONFIG_CRYPTO_NULL=m
129CONFIG_CRYPTO_CRYPTD=m 129CONFIG_CRYPTO_CRYPTD=m
@@ -173,4 +173,3 @@ CONFIG_CRYPTO_SHA512_S390=m
173CONFIG_CRYPTO_DES_S390=m 173CONFIG_CRYPTO_DES_S390=m
174CONFIG_CRYPTO_AES_S390=m 174CONFIG_CRYPTO_AES_S390=m
175CONFIG_CRC7=m 175CONFIG_CRC7=m
176CONFIG_VIRTIO_BALLOON=y
diff --git a/arch/s390/include/asm/facility.h b/arch/s390/include/asm/facility.h
index 1e5b27edc0c9..2ee66a65f2d4 100644
--- a/arch/s390/include/asm/facility.h
+++ b/arch/s390/include/asm/facility.h
@@ -38,12 +38,11 @@ static inline void stfle(u64 *stfle_fac_list, int size)
38 unsigned long nr; 38 unsigned long nr;
39 39
40 preempt_disable(); 40 preempt_disable();
41 S390_lowcore.stfl_fac_list = 0;
42 asm volatile( 41 asm volatile(
43 " .insn s,0xb2b10000,0(0)\n" /* stfl */ 42 " .insn s,0xb2b10000,0(0)\n" /* stfl */
44 "0:\n" 43 "0:\n"
45 EX_TABLE(0b, 0b) 44 EX_TABLE(0b, 0b)
46 : "=m" (S390_lowcore.stfl_fac_list)); 45 : "+m" (S390_lowcore.stfl_fac_list));
47 nr = 4; /* bytes stored by stfl */ 46 nr = 4; /* bytes stored by stfl */
48 memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); 47 memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
49 if (S390_lowcore.stfl_fac_list & 0x01000000) { 48 if (S390_lowcore.stfl_fac_list & 0x01000000) {
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
index 8eef9b5b3cf4..78e3041919de 100644
--- a/arch/s390/include/asm/pgalloc.h
+++ b/arch/s390/include/asm/pgalloc.h
@@ -22,10 +22,7 @@ void crst_table_free(struct mm_struct *, unsigned long *);
22 22
23unsigned long *page_table_alloc(struct mm_struct *, unsigned long); 23unsigned long *page_table_alloc(struct mm_struct *, unsigned long);
24void page_table_free(struct mm_struct *, unsigned long *); 24void page_table_free(struct mm_struct *, unsigned long *);
25#ifdef CONFIG_HAVE_RCU_TABLE_FREE
26void page_table_free_rcu(struct mmu_gather *, unsigned long *); 25void page_table_free_rcu(struct mmu_gather *, unsigned long *);
27void __tlb_remove_table(void *_table);
28#endif
29 26
30static inline void clear_table(unsigned long *s, unsigned long val, size_t n) 27static inline void clear_table(unsigned long *s, unsigned long val, size_t n)
31{ 28{
diff --git a/arch/s390/include/asm/swab.h b/arch/s390/include/asm/swab.h
index 6bdee21c077e..a3e4ebb32090 100644
--- a/arch/s390/include/asm/swab.h
+++ b/arch/s390/include/asm/swab.h
@@ -77,7 +77,7 @@ static inline __u16 __arch_swab16p(const __u16 *x)
77 77
78 asm volatile( 78 asm volatile(
79#ifndef __s390x__ 79#ifndef __s390x__
80 " icm %0,2,%O+1(%R1)\n" 80 " icm %0,2,%O1+1(%R1)\n"
81 " ic %0,%1\n" 81 " ic %0,%1\n"
82 : "=&d" (result) : "Q" (*x) : "cc"); 82 : "=&d" (result) : "Q" (*x) : "cc");
83#else /* __s390x__ */ 83#else /* __s390x__ */
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
index c687a2c83462..775a5eea8f9e 100644
--- a/arch/s390/include/asm/tlb.h
+++ b/arch/s390/include/asm/tlb.h
@@ -30,14 +30,10 @@
30 30
31struct mmu_gather { 31struct mmu_gather {
32 struct mm_struct *mm; 32 struct mm_struct *mm;
33#ifdef CONFIG_HAVE_RCU_TABLE_FREE
34 struct mmu_table_batch *batch; 33 struct mmu_table_batch *batch;
35#endif
36 unsigned int fullmm; 34 unsigned int fullmm;
37 unsigned int need_flush;
38}; 35};
39 36
40#ifdef CONFIG_HAVE_RCU_TABLE_FREE
41struct mmu_table_batch { 37struct mmu_table_batch {
42 struct rcu_head rcu; 38 struct rcu_head rcu;
43 unsigned int nr; 39 unsigned int nr;
@@ -49,7 +45,6 @@ struct mmu_table_batch {
49 45
50extern void tlb_table_flush(struct mmu_gather *tlb); 46extern void tlb_table_flush(struct mmu_gather *tlb);
51extern void tlb_remove_table(struct mmu_gather *tlb, void *table); 47extern void tlb_remove_table(struct mmu_gather *tlb, void *table);
52#endif
53 48
54static inline void tlb_gather_mmu(struct mmu_gather *tlb, 49static inline void tlb_gather_mmu(struct mmu_gather *tlb,
55 struct mm_struct *mm, 50 struct mm_struct *mm,
@@ -57,29 +52,20 @@ static inline void tlb_gather_mmu(struct mmu_gather *tlb,
57{ 52{
58 tlb->mm = mm; 53 tlb->mm = mm;
59 tlb->fullmm = full_mm_flush; 54 tlb->fullmm = full_mm_flush;
60 tlb->need_flush = 0;
61#ifdef CONFIG_HAVE_RCU_TABLE_FREE
62 tlb->batch = NULL; 55 tlb->batch = NULL;
63#endif
64 if (tlb->fullmm) 56 if (tlb->fullmm)
65 __tlb_flush_mm(mm); 57 __tlb_flush_mm(mm);
66} 58}
67 59
68static inline void tlb_flush_mmu(struct mmu_gather *tlb) 60static inline void tlb_flush_mmu(struct mmu_gather *tlb)
69{ 61{
70 if (!tlb->need_flush)
71 return;
72 tlb->need_flush = 0;
73 __tlb_flush_mm(tlb->mm);
74#ifdef CONFIG_HAVE_RCU_TABLE_FREE
75 tlb_table_flush(tlb); 62 tlb_table_flush(tlb);
76#endif
77} 63}
78 64
79static inline void tlb_finish_mmu(struct mmu_gather *tlb, 65static inline void tlb_finish_mmu(struct mmu_gather *tlb,
80 unsigned long start, unsigned long end) 66 unsigned long start, unsigned long end)
81{ 67{
82 tlb_flush_mmu(tlb); 68 tlb_table_flush(tlb);
83} 69}
84 70
85/* 71/*
@@ -105,10 +91,8 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
105static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, 91static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
106 unsigned long address) 92 unsigned long address)
107{ 93{
108#ifdef CONFIG_HAVE_RCU_TABLE_FREE
109 if (!tlb->fullmm) 94 if (!tlb->fullmm)
110 return page_table_free_rcu(tlb, (unsigned long *) pte); 95 return page_table_free_rcu(tlb, (unsigned long *) pte);
111#endif
112 page_table_free(tlb->mm, (unsigned long *) pte); 96 page_table_free(tlb->mm, (unsigned long *) pte);
113} 97}
114 98
@@ -125,10 +109,8 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
125#ifdef __s390x__ 109#ifdef __s390x__
126 if (tlb->mm->context.asce_limit <= (1UL << 31)) 110 if (tlb->mm->context.asce_limit <= (1UL << 31))
127 return; 111 return;
128#ifdef CONFIG_HAVE_RCU_TABLE_FREE
129 if (!tlb->fullmm) 112 if (!tlb->fullmm)
130 return tlb_remove_table(tlb, pmd); 113 return tlb_remove_table(tlb, pmd);
131#endif
132 crst_table_free(tlb->mm, (unsigned long *) pmd); 114 crst_table_free(tlb->mm, (unsigned long *) pmd);
133#endif 115#endif
134} 116}
@@ -146,10 +128,8 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
146#ifdef __s390x__ 128#ifdef __s390x__
147 if (tlb->mm->context.asce_limit <= (1UL << 42)) 129 if (tlb->mm->context.asce_limit <= (1UL << 42))
148 return; 130 return;
149#ifdef CONFIG_HAVE_RCU_TABLE_FREE
150 if (!tlb->fullmm) 131 if (!tlb->fullmm)
151 return tlb_remove_table(tlb, pud); 132 return tlb_remove_table(tlb, pud);
152#endif
153 crst_table_free(tlb->mm, (unsigned long *) pud); 133 crst_table_free(tlb->mm, (unsigned long *) pud);
154#endif 134#endif
155} 135}
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index c27a0727f930..adccd908ebc7 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -474,9 +474,9 @@ ENTRY(startup_kdump)
474 stck __LC_LAST_UPDATE_CLOCK 474 stck __LC_LAST_UPDATE_CLOCK
475 spt 5f-.LPG0(%r13) 475 spt 5f-.LPG0(%r13)
476 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) 476 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13)
477 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
477#ifndef CONFIG_MARCH_G5 478#ifndef CONFIG_MARCH_G5
478 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} 479 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10}
479 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
480 .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list 480 .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list
481 tm __LC_STFL_FAC_LIST,0x01 # stfle available ? 481 tm __LC_STFL_FAC_LIST,0x01 # stfle available ?
482 jz 0f 482 jz 0f
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 1c2cdd59ccd0..8a22c27219dd 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -118,9 +118,10 @@ asmlinkage void do_softirq(void)
118 "a" (__do_softirq) 118 "a" (__do_softirq)
119 : "0", "1", "2", "3", "4", "5", "14", 119 : "0", "1", "2", "3", "4", "5", "14",
120 "cc", "memory" ); 120 "cc", "memory" );
121 } else 121 } else {
122 /* We are already on the async stack. */ 122 /* We are already on the async stack. */
123 __do_softirq(); 123 __do_softirq();
124 }
124 } 125 }
125 126
126 local_irq_restore(flags); 127 local_irq_restore(flags);
@@ -192,11 +193,12 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler)
192 int index = ext_hash(code); 193 int index = ext_hash(code);
193 194
194 spin_lock_irqsave(&ext_int_hash_lock, flags); 195 spin_lock_irqsave(&ext_int_hash_lock, flags);
195 list_for_each_entry_rcu(p, &ext_int_hash[index], entry) 196 list_for_each_entry_rcu(p, &ext_int_hash[index], entry) {
196 if (p->code == code && p->handler == handler) { 197 if (p->code == code && p->handler == handler) {
197 list_del_rcu(&p->entry); 198 list_del_rcu(&p->entry);
198 kfree_rcu(p, rcu); 199 kfree_rcu(p, rcu);
199 } 200 }
201 }
200 spin_unlock_irqrestore(&ext_int_hash_lock, flags); 202 spin_unlock_irqrestore(&ext_int_hash_lock, flags);
201 return 0; 203 return 0;
202} 204}
@@ -211,9 +213,10 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code,
211 213
212 old_regs = set_irq_regs(regs); 214 old_regs = set_irq_regs(regs);
213 irq_enter(); 215 irq_enter();
214 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) 216 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) {
215 /* Serve timer interrupts first. */ 217 /* Serve timer interrupts first. */
216 clock_comparator_work(); 218 clock_comparator_work();
219 }
217 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; 220 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
218 if (ext_code.code != 0x1004) 221 if (ext_code.code != 0x1004)
219 __get_cpu_var(s390_idle).nohz_delay = 1; 222 __get_cpu_var(s390_idle).nohz_delay = 1;
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index 46405086479c..cb019f429e88 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -178,7 +178,7 @@ static void cpumf_pmu_enable(struct pmu *pmu)
178 err = lcctl(cpuhw->state); 178 err = lcctl(cpuhw->state);
179 if (err) { 179 if (err) {
180 pr_err("Enabling the performance measuring unit " 180 pr_err("Enabling the performance measuring unit "
181 "failed with rc=%lx\n", err); 181 "failed with rc=%x\n", err);
182 return; 182 return;
183 } 183 }
184 184
@@ -203,7 +203,7 @@ static void cpumf_pmu_disable(struct pmu *pmu)
203 err = lcctl(inactive); 203 err = lcctl(inactive);
204 if (err) { 204 if (err) {
205 pr_err("Disabling the performance measuring unit " 205 pr_err("Disabling the performance measuring unit "
206 "failed with rc=%lx\n", err); 206 "failed with rc=%x\n", err);
207 return; 207 return;
208 } 208 }
209 209
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index 7bb15fcca75e..e1335dc2b1b7 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -61,21 +61,14 @@ long probe_kernel_write(void *dst, const void *src, size_t size)
61 return copied < 0 ? -EFAULT : 0; 61 return copied < 0 ? -EFAULT : 0;
62} 62}
63 63
64/* 64static int __memcpy_real(void *dest, void *src, size_t count)
65 * Copy memory in real mode (kernel to kernel)
66 */
67int memcpy_real(void *dest, void *src, size_t count)
68{ 65{
69 register unsigned long _dest asm("2") = (unsigned long) dest; 66 register unsigned long _dest asm("2") = (unsigned long) dest;
70 register unsigned long _len1 asm("3") = (unsigned long) count; 67 register unsigned long _len1 asm("3") = (unsigned long) count;
71 register unsigned long _src asm("4") = (unsigned long) src; 68 register unsigned long _src asm("4") = (unsigned long) src;
72 register unsigned long _len2 asm("5") = (unsigned long) count; 69 register unsigned long _len2 asm("5") = (unsigned long) count;
73 unsigned long flags;
74 int rc = -EFAULT; 70 int rc = -EFAULT;
75 71
76 if (!count)
77 return 0;
78 flags = __arch_local_irq_stnsm(0xf8UL);
79 asm volatile ( 72 asm volatile (
80 "0: mvcle %1,%2,0x0\n" 73 "0: mvcle %1,%2,0x0\n"
81 "1: jo 0b\n" 74 "1: jo 0b\n"
@@ -86,7 +79,23 @@ int memcpy_real(void *dest, void *src, size_t count)
86 "+d" (_len2), "=m" (*((long *) dest)) 79 "+d" (_len2), "=m" (*((long *) dest))
87 : "m" (*((long *) src)) 80 : "m" (*((long *) src))
88 : "cc", "memory"); 81 : "cc", "memory");
89 arch_local_irq_restore(flags); 82 return rc;
83}
84
85/*
86 * Copy memory in real mode (kernel to kernel)
87 */
88int memcpy_real(void *dest, void *src, size_t count)
89{
90 unsigned long flags;
91 int rc;
92
93 if (!count)
94 return 0;
95 local_irq_save(flags);
96 __arch_local_irq_stnsm(0xfbUL);
97 rc = __memcpy_real(dest, src, count);
98 local_irq_restore(flags);
90 return rc; 99 return rc;
91} 100}
92 101
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 373adf69b01c..6e765bf00670 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -678,8 +678,6 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
678 } 678 }
679} 679}
680 680
681#ifdef CONFIG_HAVE_RCU_TABLE_FREE
682
683static void __page_table_free_rcu(void *table, unsigned bit) 681static void __page_table_free_rcu(void *table, unsigned bit)
684{ 682{
685 struct page *page; 683 struct page *page;
@@ -733,7 +731,66 @@ void __tlb_remove_table(void *_table)
733 free_pages((unsigned long) table, ALLOC_ORDER); 731 free_pages((unsigned long) table, ALLOC_ORDER);
734} 732}
735 733
736#endif 734static void tlb_remove_table_smp_sync(void *arg)
735{
736 /* Simply deliver the interrupt */
737}
738
739static void tlb_remove_table_one(void *table)
740{
741 /*
742 * This isn't an RCU grace period and hence the page-tables cannot be
743 * assumed to be actually RCU-freed.
744 *
745 * It is however sufficient for software page-table walkers that rely
746 * on IRQ disabling. See the comment near struct mmu_table_batch.
747 */
748 smp_call_function(tlb_remove_table_smp_sync, NULL, 1);
749 __tlb_remove_table(table);
750}
751
752static void tlb_remove_table_rcu(struct rcu_head *head)
753{
754 struct mmu_table_batch *batch;
755 int i;
756
757 batch = container_of(head, struct mmu_table_batch, rcu);
758
759 for (i = 0; i < batch->nr; i++)
760 __tlb_remove_table(batch->tables[i]);
761
762 free_page((unsigned long)batch);
763}
764
765void tlb_table_flush(struct mmu_gather *tlb)
766{
767 struct mmu_table_batch **batch = &tlb->batch;
768
769 if (*batch) {
770 __tlb_flush_mm(tlb->mm);
771 call_rcu_sched(&(*batch)->rcu, tlb_remove_table_rcu);
772 *batch = NULL;
773 }
774}
775
776void tlb_remove_table(struct mmu_gather *tlb, void *table)
777{
778 struct mmu_table_batch **batch = &tlb->batch;
779
780 if (*batch == NULL) {
781 *batch = (struct mmu_table_batch *)
782 __get_free_page(GFP_NOWAIT | __GFP_NOWARN);
783 if (*batch == NULL) {
784 __tlb_flush_mm(tlb->mm);
785 tlb_remove_table_one(table);
786 return;
787 }
788 (*batch)->nr = 0;
789 }
790 (*batch)->tables[(*batch)->nr++] = table;
791 if ((*batch)->nr == MAX_TABLE_BATCH)
792 tlb_table_flush(tlb);
793}
737 794
738/* 795/*
739 * switch on pgstes for its userspace process (for kvm) 796 * switch on pgstes for its userspace process (for kvm)
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 1210fde18740..160cac9c4036 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -23,6 +23,7 @@
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/gfp.h> 25#include <linux/gfp.h>
26#include <linux/cpu.h>
26 27
27#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
28#include <asm/tlbflush.h> 29#include <asm/tlbflush.h>
@@ -78,6 +79,8 @@ void __cpuinit leon_callin(void)
78 local_flush_tlb_all(); 79 local_flush_tlb_all();
79 leon_configure_cache_smp(); 80 leon_configure_cache_smp();
80 81
82 notify_cpu_starting(cpuid);
83
81 /* Get our local ticker going. */ 84 /* Get our local ticker going. */
82 smp_setup_percpu_timer(); 85 smp_setup_percpu_timer();
83 86
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 232df9949530..3ee51f189a55 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -566,15 +566,10 @@ out:
566 566
567SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len) 567SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len)
568{ 568{
569 long ret;
570
571 if (invalid_64bit_range(addr, len)) 569 if (invalid_64bit_range(addr, len))
572 return -EINVAL; 570 return -EINVAL;
573 571
574 down_write(&current->mm->mmap_sem); 572 return vm_munmap(addr, len);
575 ret = do_munmap(current->mm, addr, len);
576 up_write(&current->mm->mmap_sem);
577 return ret;
578} 573}
579 574
580extern unsigned long do_mremap(unsigned long addr, 575extern unsigned long do_mremap(unsigned long addr,
diff --git a/arch/tile/kernel/single_step.c b/arch/tile/kernel/single_step.c
index 9efbc1391b3c..89529c9f0605 100644
--- a/arch/tile/kernel/single_step.c
+++ b/arch/tile/kernel/single_step.c
@@ -346,12 +346,10 @@ void single_step_once(struct pt_regs *regs)
346 } 346 }
347 347
348 /* allocate a cache line of writable, executable memory */ 348 /* allocate a cache line of writable, executable memory */
349 down_write(&current->mm->mmap_sem); 349 buffer = (void __user *) vm_mmap(NULL, 0, 64,
350 buffer = (void __user *) do_mmap(NULL, 0, 64,
351 PROT_EXEC | PROT_READ | PROT_WRITE, 350 PROT_EXEC | PROT_READ | PROT_WRITE,
352 MAP_PRIVATE | MAP_ANONYMOUS, 351 MAP_PRIVATE | MAP_ANONYMOUS,
353 0); 352 0);
354 up_write(&current->mm->mmap_sem);
355 353
356 if (IS_ERR((void __force *)buffer)) { 354 if (IS_ERR((void __force *)buffer)) {
357 kfree(state); 355 kfree(state);
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index d511d951a052..4824fb45560f 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -119,9 +119,7 @@ static void set_brk(unsigned long start, unsigned long end)
119 end = PAGE_ALIGN(end); 119 end = PAGE_ALIGN(end);
120 if (end <= start) 120 if (end <= start)
121 return; 121 return;
122 down_write(&current->mm->mmap_sem); 122 vm_brk(start, end - start);
123 do_brk(start, end - start);
124 up_write(&current->mm->mmap_sem);
125} 123}
126 124
127#ifdef CORE_DUMP 125#ifdef CORE_DUMP
@@ -332,9 +330,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
332 pos = 32; 330 pos = 32;
333 map_size = ex.a_text+ex.a_data; 331 map_size = ex.a_text+ex.a_data;
334 332
335 down_write(&current->mm->mmap_sem); 333 error = vm_brk(text_addr & PAGE_MASK, map_size);
336 error = do_brk(text_addr & PAGE_MASK, map_size);
337 up_write(&current->mm->mmap_sem);
338 334
339 if (error != (text_addr & PAGE_MASK)) { 335 if (error != (text_addr & PAGE_MASK)) {
340 send_sig(SIGKILL, current, 0); 336 send_sig(SIGKILL, current, 0);
@@ -373,9 +369,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
373 if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { 369 if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) {
374 loff_t pos = fd_offset; 370 loff_t pos = fd_offset;
375 371
376 down_write(&current->mm->mmap_sem); 372 vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
377 do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
378 up_write(&current->mm->mmap_sem);
379 bprm->file->f_op->read(bprm->file, 373 bprm->file->f_op->read(bprm->file,
380 (char __user *)N_TXTADDR(ex), 374 (char __user *)N_TXTADDR(ex),
381 ex.a_text+ex.a_data, &pos); 375 ex.a_text+ex.a_data, &pos);
@@ -385,26 +379,22 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
385 goto beyond_if; 379 goto beyond_if;
386 } 380 }
387 381
388 down_write(&current->mm->mmap_sem); 382 error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text,
389 error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text,
390 PROT_READ | PROT_EXEC, 383 PROT_READ | PROT_EXEC,
391 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | 384 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE |
392 MAP_EXECUTABLE | MAP_32BIT, 385 MAP_EXECUTABLE | MAP_32BIT,
393 fd_offset); 386 fd_offset);
394 up_write(&current->mm->mmap_sem);
395 387
396 if (error != N_TXTADDR(ex)) { 388 if (error != N_TXTADDR(ex)) {
397 send_sig(SIGKILL, current, 0); 389 send_sig(SIGKILL, current, 0);
398 return error; 390 return error;
399 } 391 }
400 392
401 down_write(&current->mm->mmap_sem); 393 error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
402 error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
403 PROT_READ | PROT_WRITE | PROT_EXEC, 394 PROT_READ | PROT_WRITE | PROT_EXEC,
404 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | 395 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE |
405 MAP_EXECUTABLE | MAP_32BIT, 396 MAP_EXECUTABLE | MAP_32BIT,
406 fd_offset + ex.a_text); 397 fd_offset + ex.a_text);
407 up_write(&current->mm->mmap_sem);
408 if (error != N_DATADDR(ex)) { 398 if (error != N_DATADDR(ex)) {
409 send_sig(SIGKILL, current, 0); 399 send_sig(SIGKILL, current, 0);
410 return error; 400 return error;
@@ -476,9 +466,7 @@ static int load_aout_library(struct file *file)
476 error_time = jiffies; 466 error_time = jiffies;
477 } 467 }
478#endif 468#endif
479 down_write(&current->mm->mmap_sem); 469 vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
480 do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
481 up_write(&current->mm->mmap_sem);
482 470
483 file->f_op->read(file, (char __user *)start_addr, 471 file->f_op->read(file, (char __user *)start_addr,
484 ex.a_text + ex.a_data, &pos); 472 ex.a_text + ex.a_data, &pos);
@@ -490,12 +478,10 @@ static int load_aout_library(struct file *file)
490 goto out; 478 goto out;
491 } 479 }
492 /* Now use mmap to map the library into memory. */ 480 /* Now use mmap to map the library into memory. */
493 down_write(&current->mm->mmap_sem); 481 error = vm_mmap(file, start_addr, ex.a_text + ex.a_data,
494 error = do_mmap(file, start_addr, ex.a_text + ex.a_data,
495 PROT_READ | PROT_WRITE | PROT_EXEC, 482 PROT_READ | PROT_WRITE | PROT_EXEC,
496 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT, 483 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT,
497 N_TXTOFF(ex)); 484 N_TXTOFF(ex));
498 up_write(&current->mm->mmap_sem);
499 retval = error; 485 retval = error;
500 if (error != start_addr) 486 if (error != start_addr)
501 goto out; 487 goto out;
@@ -503,9 +489,7 @@ static int load_aout_library(struct file *file)
503 len = PAGE_ALIGN(ex.a_text + ex.a_data); 489 len = PAGE_ALIGN(ex.a_text + ex.a_data);
504 bss = ex.a_text + ex.a_data + ex.a_bss; 490 bss = ex.a_text + ex.a_data + ex.a_bss;
505 if (bss > len) { 491 if (bss > len) {
506 down_write(&current->mm->mmap_sem); 492 error = vm_brk(start_addr + len, bss - len);
507 error = do_brk(start_addr + len, bss - len);
508 up_write(&current->mm->mmap_sem);
509 retval = error; 493 retval = error;
510 if (error != start_addr + len) 494 if (error != start_addr + len)
511 goto out; 495 goto out;
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index 173df38dbda5..2e88438ffd83 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -459,17 +459,17 @@ void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu)
459 pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1); 459 pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1);
460 460
461 if (pmu->version == 1) { 461 if (pmu->version == 1) {
462 pmu->global_ctrl = (1 << pmu->nr_arch_gp_counters) - 1; 462 pmu->nr_arch_fixed_counters = 0;
463 return; 463 } else {
464 pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f),
465 X86_PMC_MAX_FIXED);
466 pmu->counter_bitmask[KVM_PMC_FIXED] =
467 ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1;
464 } 468 }
465 469
466 pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f), 470 pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) |
467 X86_PMC_MAX_FIXED); 471 (((1ull << pmu->nr_arch_fixed_counters) - 1) << X86_PMC_IDX_FIXED);
468 pmu->counter_bitmask[KVM_PMC_FIXED] = 472 pmu->global_ctrl_mask = ~pmu->global_ctrl;
469 ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1;
470 pmu->global_ctrl_mask = ~(((1 << pmu->nr_arch_gp_counters) - 1)
471 | (((1ull << pmu->nr_arch_fixed_counters) - 1)
472 << X86_PMC_IDX_FIXED));
473} 473}
474 474
475void kvm_pmu_init(struct kvm_vcpu *vcpu) 475void kvm_pmu_init(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ad85adfef843..4ff0ab9bc3c8 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2210,9 +2210,12 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
2210 msr = find_msr_entry(vmx, msr_index); 2210 msr = find_msr_entry(vmx, msr_index);
2211 if (msr) { 2211 if (msr) {
2212 msr->data = data; 2212 msr->data = data;
2213 if (msr - vmx->guest_msrs < vmx->save_nmsrs) 2213 if (msr - vmx->guest_msrs < vmx->save_nmsrs) {
2214 preempt_disable();
2214 kvm_set_shared_msr(msr->index, msr->data, 2215 kvm_set_shared_msr(msr->index, msr->data,
2215 msr->mask); 2216 msr->mask);
2217 preempt_enable();
2218 }
2216 break; 2219 break;
2217 } 2220 }
2218 ret = kvm_set_msr_common(vcpu, msr_index, data); 2221 ret = kvm_set_msr_common(vcpu, msr_index, data);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4044ce0bf7c1..91a5e989abcf 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6336,13 +6336,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
6336 if (npages && !old.rmap) { 6336 if (npages && !old.rmap) {
6337 unsigned long userspace_addr; 6337 unsigned long userspace_addr;
6338 6338
6339 down_write(&current->mm->mmap_sem); 6339 userspace_addr = vm_mmap(NULL, 0,
6340 userspace_addr = do_mmap(NULL, 0,
6341 npages * PAGE_SIZE, 6340 npages * PAGE_SIZE,
6342 PROT_READ | PROT_WRITE, 6341 PROT_READ | PROT_WRITE,
6343 map_flags, 6342 map_flags,
6344 0); 6343 0);
6345 up_write(&current->mm->mmap_sem);
6346 6344
6347 if (IS_ERR((void *)userspace_addr)) 6345 if (IS_ERR((void *)userspace_addr))
6348 return PTR_ERR((void *)userspace_addr); 6346 return PTR_ERR((void *)userspace_addr);
@@ -6366,10 +6364,8 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
6366 if (!user_alloc && !old.user_alloc && old.rmap && !npages) { 6364 if (!user_alloc && !old.user_alloc && old.rmap && !npages) {
6367 int ret; 6365 int ret;
6368 6366
6369 down_write(&current->mm->mmap_sem); 6367 ret = vm_munmap(old.userspace_addr,
6370 ret = do_munmap(current->mm, old.userspace_addr,
6371 old.npages * PAGE_SIZE); 6368 old.npages * PAGE_SIZE);
6372 up_write(&current->mm->mmap_sem);
6373 if (ret < 0) 6369 if (ret < 0)
6374 printk(KERN_WARNING 6370 printk(KERN_WARNING
6375 "kvm_vm_ioctl_set_memory_region: " 6371 "kvm_vm_ioctl_set_memory_region: "
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c
index 25feb1ae71c5..b1e6c4b2e8eb 100644
--- a/arch/x86/lib/insn.c
+++ b/arch/x86/lib/insn.c
@@ -379,8 +379,8 @@ err_out:
379 return; 379 return;
380} 380}
381 381
382/* Decode moffset16/32/64 */ 382/* Decode moffset16/32/64. Return 0 if failed */
383static void __get_moffset(struct insn *insn) 383static int __get_moffset(struct insn *insn)
384{ 384{
385 switch (insn->addr_bytes) { 385 switch (insn->addr_bytes) {
386 case 2: 386 case 2:
@@ -397,15 +397,19 @@ static void __get_moffset(struct insn *insn)
397 insn->moffset2.value = get_next(int, insn); 397 insn->moffset2.value = get_next(int, insn);
398 insn->moffset2.nbytes = 4; 398 insn->moffset2.nbytes = 4;
399 break; 399 break;
400 default: /* opnd_bytes must be modified manually */
401 goto err_out;
400 } 402 }
401 insn->moffset1.got = insn->moffset2.got = 1; 403 insn->moffset1.got = insn->moffset2.got = 1;
402 404
405 return 1;
406
403err_out: 407err_out:
404 return; 408 return 0;
405} 409}
406 410
407/* Decode imm v32(Iz) */ 411/* Decode imm v32(Iz). Return 0 if failed */
408static void __get_immv32(struct insn *insn) 412static int __get_immv32(struct insn *insn)
409{ 413{
410 switch (insn->opnd_bytes) { 414 switch (insn->opnd_bytes) {
411 case 2: 415 case 2:
@@ -417,14 +421,18 @@ static void __get_immv32(struct insn *insn)
417 insn->immediate.value = get_next(int, insn); 421 insn->immediate.value = get_next(int, insn);
418 insn->immediate.nbytes = 4; 422 insn->immediate.nbytes = 4;
419 break; 423 break;
424 default: /* opnd_bytes must be modified manually */
425 goto err_out;
420 } 426 }
421 427
428 return 1;
429
422err_out: 430err_out:
423 return; 431 return 0;
424} 432}
425 433
426/* Decode imm v64(Iv/Ov) */ 434/* Decode imm v64(Iv/Ov), Return 0 if failed */
427static void __get_immv(struct insn *insn) 435static int __get_immv(struct insn *insn)
428{ 436{
429 switch (insn->opnd_bytes) { 437 switch (insn->opnd_bytes) {
430 case 2: 438 case 2:
@@ -441,15 +449,18 @@ static void __get_immv(struct insn *insn)
441 insn->immediate2.value = get_next(int, insn); 449 insn->immediate2.value = get_next(int, insn);
442 insn->immediate2.nbytes = 4; 450 insn->immediate2.nbytes = 4;
443 break; 451 break;
452 default: /* opnd_bytes must be modified manually */
453 goto err_out;
444 } 454 }
445 insn->immediate1.got = insn->immediate2.got = 1; 455 insn->immediate1.got = insn->immediate2.got = 1;
446 456
457 return 1;
447err_out: 458err_out:
448 return; 459 return 0;
449} 460}
450 461
451/* Decode ptr16:16/32(Ap) */ 462/* Decode ptr16:16/32(Ap) */
452static void __get_immptr(struct insn *insn) 463static int __get_immptr(struct insn *insn)
453{ 464{
454 switch (insn->opnd_bytes) { 465 switch (insn->opnd_bytes) {
455 case 2: 466 case 2:
@@ -462,14 +473,17 @@ static void __get_immptr(struct insn *insn)
462 break; 473 break;
463 case 8: 474 case 8:
464 /* ptr16:64 is not exist (no segment) */ 475 /* ptr16:64 is not exist (no segment) */
465 return; 476 return 0;
477 default: /* opnd_bytes must be modified manually */
478 goto err_out;
466 } 479 }
467 insn->immediate2.value = get_next(unsigned short, insn); 480 insn->immediate2.value = get_next(unsigned short, insn);
468 insn->immediate2.nbytes = 2; 481 insn->immediate2.nbytes = 2;
469 insn->immediate1.got = insn->immediate2.got = 1; 482 insn->immediate1.got = insn->immediate2.got = 1;
470 483
484 return 1;
471err_out: 485err_out:
472 return; 486 return 0;
473} 487}
474 488
475/** 489/**
@@ -489,7 +503,8 @@ void insn_get_immediate(struct insn *insn)
489 insn_get_displacement(insn); 503 insn_get_displacement(insn);
490 504
491 if (inat_has_moffset(insn->attr)) { 505 if (inat_has_moffset(insn->attr)) {
492 __get_moffset(insn); 506 if (!__get_moffset(insn))
507 goto err_out;
493 goto done; 508 goto done;
494 } 509 }
495 510
@@ -517,16 +532,20 @@ void insn_get_immediate(struct insn *insn)
517 insn->immediate2.nbytes = 4; 532 insn->immediate2.nbytes = 4;
518 break; 533 break;
519 case INAT_IMM_PTR: 534 case INAT_IMM_PTR:
520 __get_immptr(insn); 535 if (!__get_immptr(insn))
536 goto err_out;
521 break; 537 break;
522 case INAT_IMM_VWORD32: 538 case INAT_IMM_VWORD32:
523 __get_immv32(insn); 539 if (!__get_immv32(insn))
540 goto err_out;
524 break; 541 break;
525 case INAT_IMM_VWORD: 542 case INAT_IMM_VWORD:
526 __get_immv(insn); 543 if (!__get_immv(insn))
544 goto err_out;
527 break; 545 break;
528 default: 546 default:
529 break; 547 /* Here, insn must have an immediate, but failed */
548 goto err_out;
530 } 549 }
531 if (inat_has_second_immediate(insn->attr)) { 550 if (inat_has_second_immediate(insn->attr)) {
532 insn->immediate2.value = get_next(char, insn); 551 insn->immediate2.value = get_next(char, insn);
diff --git a/crypto/sha512_generic.c b/crypto/sha512_generic.c
index 107f6f7be5e1..dd30f40af9f5 100644
--- a/crypto/sha512_generic.c
+++ b/crypto/sha512_generic.c
@@ -174,7 +174,7 @@ sha512_update(struct shash_desc *desc, const u8 *data, unsigned int len)
174 index = sctx->count[0] & 0x7f; 174 index = sctx->count[0] & 0x7f;
175 175
176 /* Update number of bytes */ 176 /* Update number of bytes */
177 if (!(sctx->count[0] += len)) 177 if ((sctx->count[0] += len) < len)
178 sctx->count[1]++; 178 sctx->count[1]++;
179 179
180 part_len = 128 - index; 180 part_len = 128 - index;
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index ab513a972c95..a716fede4f25 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -74,7 +74,8 @@ acpi_status acpi_reset(void)
74 74
75 /* Check if the reset register is supported */ 75 /* Check if the reset register is supported */
76 76
77 if (!reset_reg->address) { 77 if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) ||
78 !reset_reg->address) {
78 return_ACPI_STATUS(AE_NOT_EXIST); 79 return_ACPI_STATUS(AE_NOT_EXIST);
79 } 80 }
80 81
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index ba14fb93c929..c3881b2eb8b2 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -607,8 +607,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
607 607
608 acpi_irq_handler = handler; 608 acpi_irq_handler = handler;
609 acpi_irq_context = context; 609 acpi_irq_context = context;
610 if (request_threaded_irq(irq, NULL, acpi_irq, IRQF_SHARED, "acpi", 610 if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
611 acpi_irq)) {
612 printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); 611 printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
613 acpi_irq_handler = NULL; 612 acpi_irq_handler = NULL;
614 return AE_NOT_ACQUIRED; 613 return AE_NOT_ACQUIRED;
diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c
index c1d612435939..a6c77e8b37bd 100644
--- a/drivers/acpi/reboot.c
+++ b/drivers/acpi/reboot.c
@@ -23,7 +23,8 @@ void acpi_reboot(void)
23 /* Is the reset register supported? The spec says we should be 23 /* Is the reset register supported? The spec says we should be
24 * checking the bit width and bit offset, but Windows ignores 24 * checking the bit width and bit offset, but Windows ignores
25 * these fields */ 25 * these fields */
26 /* Ignore also acpi_gbl_FADT.flags.ACPI_FADT_RESET_REGISTER */ 26 if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER))
27 return;
27 28
28 reset_value = acpi_gbl_FADT.reset_value; 29 reset_value = acpi_gbl_FADT.reset_value;
29 30
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 68013f96729f..7857e8fd0a3e 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -329,6 +329,8 @@ static const struct pci_device_id piix_pci_tbl[] = {
329 { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 329 { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
330 /* SATA Controller IDE (Lynx Point) */ 330 /* SATA Controller IDE (Lynx Point) */
331 { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 331 { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
332 /* SATA Controller IDE (DH89xxCC) */
333 { 0x8086, 0x2326, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
332 { } /* terminate list */ 334 { } /* terminate list */
333}; 335};
334 336
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index e0bda9ff89cd..28db50b57b91 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -95,7 +95,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev);
95static void ata_dev_xfermask(struct ata_device *dev); 95static void ata_dev_xfermask(struct ata_device *dev);
96static unsigned long ata_dev_blacklisted(const struct ata_device *dev); 96static unsigned long ata_dev_blacklisted(const struct ata_device *dev);
97 97
98unsigned int ata_print_id = 1; 98atomic_t ata_print_id = ATOMIC_INIT(1);
99 99
100struct ata_force_param { 100struct ata_force_param {
101 const char *name; 101 const char *name;
@@ -6029,7 +6029,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6029 6029
6030 /* give ports names and add SCSI hosts */ 6030 /* give ports names and add SCSI hosts */
6031 for (i = 0; i < host->n_ports; i++) 6031 for (i = 0; i < host->n_ports; i++)
6032 host->ports[i]->print_id = ata_print_id++; 6032 host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
6033 6033
6034 6034
6035 /* Create associated sysfs transport objects */ 6035 /* Create associated sysfs transport objects */
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 1ee00c8b5b04..93dabdcd2cbe 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3843,7 +3843,7 @@ int ata_sas_async_port_init(struct ata_port *ap)
3843 int rc = ap->ops->port_start(ap); 3843 int rc = ap->ops->port_start(ap);
3844 3844
3845 if (!rc) { 3845 if (!rc) {
3846 ap->print_id = ata_print_id++; 3846 ap->print_id = atomic_inc_return(&ata_print_id);
3847 __ata_port_probe(ap); 3847 __ata_port_probe(ap);
3848 } 3848 }
3849 3849
@@ -3867,7 +3867,7 @@ int ata_sas_port_init(struct ata_port *ap)
3867 int rc = ap->ops->port_start(ap); 3867 int rc = ap->ops->port_start(ap);
3868 3868
3869 if (!rc) { 3869 if (!rc) {
3870 ap->print_id = ata_print_id++; 3870 ap->print_id = atomic_inc_return(&ata_print_id);
3871 rc = ata_port_probe(ap); 3871 rc = ata_port_probe(ap);
3872 } 3872 }
3873 3873
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index 74aaee30e264..c34190485377 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -294,6 +294,7 @@ int ata_tport_add(struct device *parent,
294 device_enable_async_suspend(dev); 294 device_enable_async_suspend(dev);
295 pm_runtime_set_active(dev); 295 pm_runtime_set_active(dev);
296 pm_runtime_enable(dev); 296 pm_runtime_enable(dev);
297 pm_runtime_forbid(dev);
297 298
298 transport_add_device(dev); 299 transport_add_device(dev);
299 transport_configure_device(dev); 300 transport_configure_device(dev);
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 2e26fcaf635b..9d0fd0b71852 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -53,7 +53,7 @@ enum {
53 ATA_DNXFER_QUIET = (1 << 31), 53 ATA_DNXFER_QUIET = (1 << 31),
54}; 54};
55 55
56extern unsigned int ata_print_id; 56extern atomic_t ata_print_id;
57extern int atapi_passthru16; 57extern int atapi_passthru16;
58extern int libata_fua; 58extern int libata_fua;
59extern int libata_noacpi; 59extern int libata_noacpi;
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 38950ea8398a..7336d4a7ab31 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -4025,7 +4025,8 @@ static int mv_platform_probe(struct platform_device *pdev)
4025 struct ata_host *host; 4025 struct ata_host *host;
4026 struct mv_host_priv *hpriv; 4026 struct mv_host_priv *hpriv;
4027 struct resource *res; 4027 struct resource *res;
4028 int n_ports, rc; 4028 int n_ports = 0;
4029 int rc;
4029 4030
4030 ata_print_version_once(&pdev->dev, DRV_VERSION); 4031 ata_print_version_once(&pdev->dev, DRV_VERSION);
4031 4032
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 0e4ef3de9d5d..0d39f2f4294a 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -375,6 +375,34 @@ static int init_vq(struct virtio_blk *vblk)
375 return err; 375 return err;
376} 376}
377 377
378/*
379 * Legacy naming scheme used for virtio devices. We are stuck with it for
380 * virtio blk but don't ever use it for any new driver.
381 */
382static int virtblk_name_format(char *prefix, int index, char *buf, int buflen)
383{
384 const int base = 'z' - 'a' + 1;
385 char *begin = buf + strlen(prefix);
386 char *end = buf + buflen;
387 char *p;
388 int unit;
389
390 p = end - 1;
391 *p = '\0';
392 unit = base;
393 do {
394 if (p == begin)
395 return -EINVAL;
396 *--p = 'a' + (index % unit);
397 index = (index / unit) - 1;
398 } while (index >= 0);
399
400 memmove(begin, p, end - p);
401 memcpy(buf, prefix, strlen(prefix));
402
403 return 0;
404}
405
378static int __devinit virtblk_probe(struct virtio_device *vdev) 406static int __devinit virtblk_probe(struct virtio_device *vdev)
379{ 407{
380 struct virtio_blk *vblk; 408 struct virtio_blk *vblk;
@@ -443,18 +471,7 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
443 471
444 q->queuedata = vblk; 472 q->queuedata = vblk;
445 473
446 if (index < 26) { 474 virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN);
447 sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26);
448 } else if (index < (26 + 1) * 26) {
449 sprintf(vblk->disk->disk_name, "vd%c%c",
450 'a' + index / 26 - 1, 'a' + index % 26);
451 } else {
452 const unsigned int m1 = (index / 26 - 1) / 26 - 1;
453 const unsigned int m2 = (index / 26 - 1) % 26;
454 const unsigned int m3 = index % 26;
455 sprintf(vblk->disk->disk_name, "vd%c%c%c",
456 'a' + m1, 'a' + m2, 'a' + m3);
457 }
458 475
459 vblk->disk->major = major; 476 vblk->disk->major = major;
460 vblk->disk->first_minor = index_to_minor(index); 477 vblk->disk->first_minor = index_to_minor(index);
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 89860f34a7ec..4f66171c6683 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -416,7 +416,7 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
416 "discard-secure", "%d", 416 "discard-secure", "%d",
417 blkif->vbd.discard_secure); 417 blkif->vbd.discard_secure);
418 if (err) { 418 if (err) {
419 dev_warn(dev-dev, "writing discard-secure (%d)", err); 419 dev_warn(&dev->dev, "writing discard-secure (%d)", err);
420 return; 420 return;
421 } 421 }
422 } 422 }
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 0053d7ebb5ca..8f3f74ce8c7f 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -18,6 +18,7 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/gfp.h> 20#include <linux/gfp.h>
21#include <linux/module.h>
21 22
22#include <crypto/ctr.h> 23#include <crypto/ctr.h>
23#include <crypto/des.h> 24#include <crypto/des.h>
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index dc641c796526..921039e56f87 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -124,6 +124,9 @@ struct talitos_private {
124 void __iomem *reg; 124 void __iomem *reg;
125 int irq[2]; 125 int irq[2];
126 126
127 /* SEC global registers lock */
128 spinlock_t reg_lock ____cacheline_aligned;
129
127 /* SEC version geometry (from device tree node) */ 130 /* SEC version geometry (from device tree node) */
128 unsigned int num_channels; 131 unsigned int num_channels;
129 unsigned int chfifo_len; 132 unsigned int chfifo_len;
@@ -412,6 +415,7 @@ static void talitos_done_##name(unsigned long data) \
412{ \ 415{ \
413 struct device *dev = (struct device *)data; \ 416 struct device *dev = (struct device *)data; \
414 struct talitos_private *priv = dev_get_drvdata(dev); \ 417 struct talitos_private *priv = dev_get_drvdata(dev); \
418 unsigned long flags; \
415 \ 419 \
416 if (ch_done_mask & 1) \ 420 if (ch_done_mask & 1) \
417 flush_channel(dev, 0, 0, 0); \ 421 flush_channel(dev, 0, 0, 0); \
@@ -427,8 +431,10 @@ static void talitos_done_##name(unsigned long data) \
427out: \ 431out: \
428 /* At this point, all completed channels have been processed */ \ 432 /* At this point, all completed channels have been processed */ \
429 /* Unmask done interrupts for channels completed later on. */ \ 433 /* Unmask done interrupts for channels completed later on. */ \
434 spin_lock_irqsave(&priv->reg_lock, flags); \
430 setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ 435 setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \
431 setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ 436 setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \
437 spin_unlock_irqrestore(&priv->reg_lock, flags); \
432} 438}
433DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) 439DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE)
434DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) 440DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE)
@@ -619,22 +625,28 @@ static irqreturn_t talitos_interrupt_##name(int irq, void *data) \
619 struct device *dev = data; \ 625 struct device *dev = data; \
620 struct talitos_private *priv = dev_get_drvdata(dev); \ 626 struct talitos_private *priv = dev_get_drvdata(dev); \
621 u32 isr, isr_lo; \ 627 u32 isr, isr_lo; \
628 unsigned long flags; \
622 \ 629 \
630 spin_lock_irqsave(&priv->reg_lock, flags); \
623 isr = in_be32(priv->reg + TALITOS_ISR); \ 631 isr = in_be32(priv->reg + TALITOS_ISR); \
624 isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ 632 isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \
625 /* Acknowledge interrupt */ \ 633 /* Acknowledge interrupt */ \
626 out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ 634 out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \
627 out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ 635 out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \
628 \ 636 \
629 if (unlikely((isr & ~TALITOS_ISR_4CHDONE) & ch_err_mask || isr_lo)) \ 637 if (unlikely(isr & ch_err_mask || isr_lo)) { \
630 talitos_error(dev, isr, isr_lo); \ 638 spin_unlock_irqrestore(&priv->reg_lock, flags); \
631 else \ 639 talitos_error(dev, isr & ch_err_mask, isr_lo); \
640 } \
641 else { \
632 if (likely(isr & ch_done_mask)) { \ 642 if (likely(isr & ch_done_mask)) { \
633 /* mask further done interrupts. */ \ 643 /* mask further done interrupts. */ \
634 clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ 644 clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \
635 /* done_task will unmask done interrupts at exit */ \ 645 /* done_task will unmask done interrupts at exit */ \
636 tasklet_schedule(&priv->done_task[tlet]); \ 646 tasklet_schedule(&priv->done_task[tlet]); \
637 } \ 647 } \
648 spin_unlock_irqrestore(&priv->reg_lock, flags); \
649 } \
638 \ 650 \
639 return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ 651 return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \
640 IRQ_NONE; \ 652 IRQ_NONE; \
@@ -2719,6 +2731,8 @@ static int talitos_probe(struct platform_device *ofdev)
2719 2731
2720 priv->ofdev = ofdev; 2732 priv->ofdev = ofdev;
2721 2733
2734 spin_lock_init(&priv->reg_lock);
2735
2722 err = talitos_probe_irq(ofdev); 2736 err = talitos_probe_irq(ofdev);
2723 if (err) 2737 if (err)
2724 goto err_out; 2738 goto err_out;
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index cf9da362d64f..ef378b5b17e4 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -91,11 +91,10 @@ config DW_DMAC
91 91
92config AT_HDMAC 92config AT_HDMAC
93 tristate "Atmel AHB DMA support" 93 tristate "Atmel AHB DMA support"
94 depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 94 depends on ARCH_AT91
95 select DMA_ENGINE 95 select DMA_ENGINE
96 help 96 help
97 Support the Atmel AHB DMA controller. This can be integrated in 97 Support the Atmel AHB DMA controller.
98 chips such as the Atmel AT91SAM9RL.
99 98
100config FSL_DMA 99config FSL_DMA
101 tristate "Freescale Elo and Elo Plus DMA support" 100 tristate "Freescale Elo and Elo Plus DMA support"
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 30372f7b2d45..348b367debeb 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -1510,8 +1510,8 @@ int drm_freebufs(struct drm_device *dev, void *data,
1510 * \param arg pointer to a drm_buf_map structure. 1510 * \param arg pointer to a drm_buf_map structure.
1511 * \return zero on success or a negative number on failure. 1511 * \return zero on success or a negative number on failure.
1512 * 1512 *
1513 * Maps the AGP, SG or PCI buffer region with do_mmap(), and copies information 1513 * Maps the AGP, SG or PCI buffer region with vm_mmap(), and copies information
1514 * about each buffer into user space. For PCI buffers, it calls do_mmap() with 1514 * about each buffer into user space. For PCI buffers, it calls vm_mmap() with
1515 * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls 1515 * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls
1516 * drm_mmap_dma(). 1516 * drm_mmap_dma().
1517 */ 1517 */
@@ -1553,18 +1553,14 @@ int drm_mapbufs(struct drm_device *dev, void *data,
1553 retcode = -EINVAL; 1553 retcode = -EINVAL;
1554 goto done; 1554 goto done;
1555 } 1555 }
1556 down_write(&current->mm->mmap_sem); 1556 virtual = vm_mmap(file_priv->filp, 0, map->size,
1557 virtual = do_mmap(file_priv->filp, 0, map->size,
1558 PROT_READ | PROT_WRITE, 1557 PROT_READ | PROT_WRITE,
1559 MAP_SHARED, 1558 MAP_SHARED,
1560 token); 1559 token);
1561 up_write(&current->mm->mmap_sem);
1562 } else { 1560 } else {
1563 down_write(&current->mm->mmap_sem); 1561 virtual = vm_mmap(file_priv->filp, 0, dma->byte_count,
1564 virtual = do_mmap(file_priv->filp, 0, dma->byte_count,
1565 PROT_READ | PROT_WRITE, 1562 PROT_READ | PROT_WRITE,
1566 MAP_SHARED, 0); 1563 MAP_SHARED, 0);
1567 up_write(&current->mm->mmap_sem);
1568 } 1564 }
1569 if (virtual > -1024UL) { 1565 if (virtual > -1024UL) {
1570 /* Real error */ 1566 /* Real error */
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d3aaeb6ae236..c79870a75c2f 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -3335,10 +3335,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
3335 3335
3336 ret = crtc->funcs->page_flip(crtc, fb, e); 3336 ret = crtc->funcs->page_flip(crtc, fb, e);
3337 if (ret) { 3337 if (ret) {
3338 spin_lock_irqsave(&dev->event_lock, flags); 3338 if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
3339 file_priv->event_space += sizeof e->event; 3339 spin_lock_irqsave(&dev->event_lock, flags);
3340 spin_unlock_irqrestore(&dev->event_lock, flags); 3340 file_priv->event_space += sizeof e->event;
3341 kfree(e); 3341 spin_unlock_irqrestore(&dev->event_lock, flags);
3342 kfree(e);
3343 }
3342 } 3344 }
3343 3345
3344out: 3346out:
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index cdfbf27b2b3c..123de28f94ef 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -507,12 +507,12 @@ int drm_release(struct inode *inode, struct file *filp)
507 507
508 drm_events_release(file_priv); 508 drm_events_release(file_priv);
509 509
510 if (dev->driver->driver_features & DRIVER_GEM)
511 drm_gem_release(dev, file_priv);
512
513 if (dev->driver->driver_features & DRIVER_MODESET) 510 if (dev->driver->driver_features & DRIVER_MODESET)
514 drm_fb_release(file_priv); 511 drm_fb_release(file_priv);
515 512
513 if (dev->driver->driver_features & DRIVER_GEM)
514 drm_gem_release(dev, file_priv);
515
516 mutex_lock(&dev->ctxlist_mutex); 516 mutex_lock(&dev->ctxlist_mutex);
517 if (!list_empty(&dev->ctxlist)) { 517 if (!list_empty(&dev->ctxlist)) {
518 struct drm_ctx_list *pos, *n; 518 struct drm_ctx_list *pos, *n;
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index c8c83dad2ce1..37c9a523dd1c 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -1,6 +1,6 @@
1#include "drmP.h" 1#include "drmP.h"
2#include <linux/usb.h> 2#include <linux/usb.h>
3#include <linux/export.h> 3#include <linux/module.h>
4 4
5int drm_get_usb_dev(struct usb_interface *interface, 5int drm_get_usb_dev(struct usb_interface *interface,
6 const struct usb_device_id *id, 6 const struct usb_device_id *id,
@@ -114,3 +114,7 @@ void drm_usb_exit(struct drm_driver *driver,
114 usb_deregister(udriver); 114 usb_deregister(udriver);
115} 115}
116EXPORT_SYMBOL(drm_usb_exit); 116EXPORT_SYMBOL(drm_usb_exit);
117
118MODULE_AUTHOR("David Airlie");
119MODULE_DESCRIPTION("USB DRM support");
120MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 26d51979116b..392ce71ed6a1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -581,10 +581,8 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data,
581 obj->filp->f_op = &exynos_drm_gem_fops; 581 obj->filp->f_op = &exynos_drm_gem_fops;
582 obj->filp->private_data = obj; 582 obj->filp->private_data = obj;
583 583
584 down_write(&current->mm->mmap_sem); 584 addr = vm_mmap(obj->filp, 0, args->size,
585 addr = do_mmap(obj->filp, 0, args->size,
586 PROT_READ | PROT_WRITE, MAP_SHARED, 0); 585 PROT_READ | PROT_WRITE, MAP_SHARED, 0);
587 up_write(&current->mm->mmap_sem);
588 586
589 drm_gem_object_unreference_unlocked(obj); 587 drm_gem_object_unreference_unlocked(obj);
590 588
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.h b/drivers/gpu/drm/gma500/mdfld_dsi_output.h
index 21071cef92a4..36eb0744841c 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.h
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.h
@@ -29,7 +29,6 @@
29#define __MDFLD_DSI_OUTPUT_H__ 29#define __MDFLD_DSI_OUTPUT_H__
30 30
31#include <linux/backlight.h> 31#include <linux/backlight.h>
32#include <linux/version.h>
33#include <drm/drmP.h> 32#include <drm/drmP.h>
34#include <drm/drm.h> 33#include <drm/drm.h>
35#include <drm/drm_crtc.h> 34#include <drm/drm_crtc.h>
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index 2c8a60c3b98e..f920fb5e42b6 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -129,6 +129,7 @@ static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv)
129 if (buf_priv->currently_mapped == I810_BUF_MAPPED) 129 if (buf_priv->currently_mapped == I810_BUF_MAPPED)
130 return -EINVAL; 130 return -EINVAL;
131 131
132 /* This is all entirely broken */
132 down_write(&current->mm->mmap_sem); 133 down_write(&current->mm->mmap_sem);
133 old_fops = file_priv->filp->f_op; 134 old_fops = file_priv->filp->f_op;
134 file_priv->filp->f_op = &i810_buffer_fops; 135 file_priv->filp->f_op = &i810_buffer_fops;
@@ -157,11 +158,8 @@ static int i810_unmap_buffer(struct drm_buf *buf)
157 if (buf_priv->currently_mapped != I810_BUF_MAPPED) 158 if (buf_priv->currently_mapped != I810_BUF_MAPPED)
158 return -EINVAL; 159 return -EINVAL;
159 160
160 down_write(&current->mm->mmap_sem); 161 retcode = vm_munmap((unsigned long)buf_priv->virtual,
161 retcode = do_munmap(current->mm,
162 (unsigned long)buf_priv->virtual,
163 (size_t) buf->total); 162 (size_t) buf->total);
164 up_write(&current->mm->mmap_sem);
165 163
166 buf_priv->currently_mapped = I810_BUF_UNMAPPED; 164 buf_priv->currently_mapped = I810_BUF_UNMAPPED;
167 buf_priv->virtual = NULL; 165 buf_priv->virtual = NULL;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0e3c6acde955..0d1e4b7b4b99 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1087,11 +1087,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
1087 if (obj == NULL) 1087 if (obj == NULL)
1088 return -ENOENT; 1088 return -ENOENT;
1089 1089
1090 down_write(&current->mm->mmap_sem); 1090 addr = vm_mmap(obj->filp, 0, args->size,
1091 addr = do_mmap(obj->filp, 0, args->size,
1092 PROT_READ | PROT_WRITE, MAP_SHARED, 1091 PROT_READ | PROT_WRITE, MAP_SHARED,
1093 args->offset); 1092 args->offset);
1094 up_write(&current->mm->mmap_sem);
1095 drm_gem_object_unreference_unlocked(obj); 1093 drm_gem_object_unreference_unlocked(obj);
1096 if (IS_ERR((void *)addr)) 1094 if (IS_ERR((void *)addr))
1097 return addr; 1095 return addr;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index bae38acf44dc..5908cd563400 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3478,8 +3478,11 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
3478 return false; 3478 return false;
3479 } 3479 }
3480 3480
3481 /* All interlaced capable intel hw wants timings in frames. */ 3481 /* All interlaced capable intel hw wants timings in frames. Note though
3482 drm_mode_set_crtcinfo(adjusted_mode, 0); 3482 * that intel_lvds_mode_fixup does some funny tricks with the crtc
3483 * timings, so we need to be careful not to clobber these.*/
3484 if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET))
3485 drm_mode_set_crtcinfo(adjusted_mode, 0);
3483 3486
3484 return true; 3487 return true;
3485} 3488}
@@ -7465,7 +7468,13 @@ static int intel_gen6_queue_flip(struct drm_device *dev,
7465 OUT_RING(fb->pitches[0] | obj->tiling_mode); 7468 OUT_RING(fb->pitches[0] | obj->tiling_mode);
7466 OUT_RING(obj->gtt_offset); 7469 OUT_RING(obj->gtt_offset);
7467 7470
7468 pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; 7471 /* Contrary to the suggestions in the documentation,
7472 * "Enable Panel Fitter" does not seem to be required when page
7473 * flipping with a non-native mode, and worse causes a normal
7474 * modeset to fail.
7475 * pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE;
7476 */
7477 pf = 0;
7469 pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; 7478 pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff;
7470 OUT_RING(pf | pipesrc); 7479 OUT_RING(pf | pipesrc);
7471 ADVANCE_LP_RING(); 7480 ADVANCE_LP_RING();
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 5a14149b3794..715afa153025 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -105,6 +105,10 @@
105#define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) 105#define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0)
106#define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) 106#define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT)
107#define INTEL_MODE_DP_FORCE_6BPC (0x10) 107#define INTEL_MODE_DP_FORCE_6BPC (0x10)
108/* This flag must be set by the encoder's mode_fixup if it changes the crtc
109 * timings in the mode to prevent the crtc fixup from overwriting them.
110 * Currently only lvds needs that. */
111#define INTEL_MODE_CRTC_TIMINGS_SET (0x20)
108 112
109static inline void 113static inline void
110intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, 114intel_mode_set_pixel_multiplier(struct drm_display_mode *mode,
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 19ecd78b8a2c..6e9ee33fd412 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -279,6 +279,8 @@ void intel_fb_restore_mode(struct drm_device *dev)
279 struct drm_mode_config *config = &dev->mode_config; 279 struct drm_mode_config *config = &dev->mode_config;
280 struct drm_plane *plane; 280 struct drm_plane *plane;
281 281
282 mutex_lock(&dev->mode_config.mutex);
283
282 ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); 284 ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);
283 if (ret) 285 if (ret)
284 DRM_DEBUG("failed to restore crtc mode\n"); 286 DRM_DEBUG("failed to restore crtc mode\n");
@@ -286,4 +288,6 @@ void intel_fb_restore_mode(struct drm_device *dev)
286 /* Be sure to shut off any planes that may be active */ 288 /* Be sure to shut off any planes that may be active */
287 list_for_each_entry(plane, &config->plane_list, head) 289 list_for_each_entry(plane, &config->plane_list, head)
288 plane->funcs->disable_plane(plane); 290 plane->funcs->disable_plane(plane);
291
292 mutex_unlock(&dev->mode_config.mutex);
289} 293}
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 95db2e988227..30e2c82101de 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -187,6 +187,8 @@ centre_horizontally(struct drm_display_mode *mode,
187 187
188 mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; 188 mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos;
189 mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; 189 mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width;
190
191 mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET;
190} 192}
191 193
192static void 194static void
@@ -208,6 +210,8 @@ centre_vertically(struct drm_display_mode *mode,
208 210
209 mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; 211 mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos;
210 mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; 212 mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width;
213
214 mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET;
211} 215}
212 216
213static inline u32 panel_fitter_scaling(u32 source, u32 target) 217static inline u32 panel_fitter_scaling(u32 source, u32 target)
@@ -283,6 +287,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
283 for_each_pipe(pipe) 287 for_each_pipe(pipe)
284 I915_WRITE(BCLRPAT(pipe), 0); 288 I915_WRITE(BCLRPAT(pipe), 0);
285 289
290 drm_mode_set_crtcinfo(adjusted_mode, 0);
291
286 switch (intel_lvds->fitting_mode) { 292 switch (intel_lvds->fitting_mode) {
287 case DRM_MODE_SCALE_CENTER: 293 case DRM_MODE_SCALE_CENTER:
288 /* 294 /*
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 230a141dbea3..48177ec4720e 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -47,8 +47,6 @@ intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
47 adjusted_mode->vtotal = fixed_mode->vtotal; 47 adjusted_mode->vtotal = fixed_mode->vtotal;
48 48
49 adjusted_mode->clock = fixed_mode->clock; 49 adjusted_mode->clock = fixed_mode->clock;
50
51 drm_mode_set_crtcinfo(adjusted_mode, 0);
52} 50}
53 51
54/* adjusted_mode has been preset to be the panel's fixed mode */ 52/* adjusted_mode has been preset to be the panel's fixed mode */
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c
index 34d591b7d4ef..da3e7c3abab7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -235,6 +235,7 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile)
235 return -EPERM; 235 return -EPERM;
236 236
237 strncpy(string, profile, sizeof(string)); 237 strncpy(string, profile, sizeof(string));
238 string[sizeof(string) - 1] = 0;
238 if ((ptr = strchr(string, '\n'))) 239 if ((ptr = strchr(string, '\n')))
239 *ptr = '\0'; 240 *ptr = '\0';
240 241
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c
index a7844ab6a50c..274640212475 100644
--- a/drivers/gpu/drm/nouveau/nv50_sor.c
+++ b/drivers/gpu/drm/nouveau/nv50_sor.c
@@ -42,7 +42,7 @@ nv50_sor_dp_lane_map(struct drm_device *dev, struct dcb_entry *dcb, u8 lane)
42 struct drm_nouveau_private *dev_priv = dev->dev_private; 42 struct drm_nouveau_private *dev_priv = dev->dev_private;
43 static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ 43 static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */
44 static const u8 nv50[] = { 16, 8, 0, 24 }; 44 static const u8 nv50[] = { 16, 8, 0, 24 };
45 if (dev_priv->card_type == 0xaf) 45 if (dev_priv->chipset == 0xaf)
46 return nvaf[lane]; 46 return nvaf[lane];
47 return nv50[lane]; 47 return nv50[lane];
48} 48}
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index de71243b591f..c8187c4b6ae8 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1135,7 +1135,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc
1135 } 1135 }
1136 if (rdev->flags & RADEON_IS_AGP) { 1136 if (rdev->flags & RADEON_IS_AGP) {
1137 size_bf = mc->gtt_start; 1137 size_bf = mc->gtt_start;
1138 size_af = 0xFFFFFFFF - mc->gtt_end + 1; 1138 size_af = 0xFFFFFFFF - mc->gtt_end;
1139 if (size_bf > size_af) { 1139 if (size_bf > size_af) {
1140 if (mc->mc_vram_size > size_bf) { 1140 if (mc->mc_vram_size > size_bf) {
1141 dev_warn(rdev->dev, "limiting VRAM\n"); 1141 dev_warn(rdev->dev, "limiting VRAM\n");
@@ -1149,7 +1149,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc
1149 mc->real_vram_size = size_af; 1149 mc->real_vram_size = size_af;
1150 mc->mc_vram_size = size_af; 1150 mc->mc_vram_size = size_af;
1151 } 1151 }
1152 mc->vram_start = mc->gtt_end; 1152 mc->vram_start = mc->gtt_end + 1;
1153 } 1153 }
1154 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; 1154 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
1155 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", 1155 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n",
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index bd05156edbdb..3c2e7a000a2a 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -970,7 +970,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
970 970
971 encoder = obj_to_encoder(obj); 971 encoder = obj_to_encoder(obj);
972 972
973 if (encoder->encoder_type != DRM_MODE_ENCODER_DAC || 973 if (encoder->encoder_type != DRM_MODE_ENCODER_DAC &&
974 encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) 974 encoder->encoder_type != DRM_MODE_ENCODER_TVDAC)
975 continue; 975 continue;
976 976
@@ -1000,6 +1000,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
1000 * cases the DVI port is actually a virtual KVM port connected to the service 1000 * cases the DVI port is actually a virtual KVM port connected to the service
1001 * processor. 1001 * processor.
1002 */ 1002 */
1003out:
1003 if ((!rdev->is_atom_bios) && 1004 if ((!rdev->is_atom_bios) &&
1004 (ret == connector_status_disconnected) && 1005 (ret == connector_status_disconnected) &&
1005 rdev->mode_info.bios_hardcoded_edid_size) { 1006 rdev->mode_info.bios_hardcoded_edid_size) {
@@ -1007,7 +1008,6 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
1007 ret = connector_status_connected; 1008 ret = connector_status_connected;
1008 } 1009 }
1009 1010
1010out:
1011 /* updated in get modes as well since we need to know if it's analog or digital */ 1011 /* updated in get modes as well since we need to know if it's analog or digital */
1012 radeon_connector_update_scratch_regs(connector, ret); 1012 radeon_connector_update_scratch_regs(connector, ret);
1013 return ret; 1013 return ret;
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index 66d5fe1c8174..65060b77c805 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -147,6 +147,12 @@ static bool radeon_msi_ok(struct radeon_device *rdev)
147 (rdev->pdev->subsystem_device == 0x01fd)) 147 (rdev->pdev->subsystem_device == 0x01fd))
148 return true; 148 return true;
149 149
150 /* RV515 seems to have MSI issues where it loses
151 * MSI rearms occasionally. This leads to lockups and freezes.
152 * disable it by default.
153 */
154 if (rdev->family == CHIP_RV515)
155 return false;
150 if (rdev->flags & RADEON_IS_IGP) { 156 if (rdev->flags & RADEON_IS_IGP) {
151 /* APUs work fine with MSIs */ 157 /* APUs work fine with MSIs */
152 if (rdev->family >= CHIP_PALM) 158 if (rdev->family >= CHIP_PALM)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index c62ae4be3845..cdab1aeaed6e 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -969,7 +969,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
969 } 969 }
970 if (rdev->flags & RADEON_IS_AGP) { 970 if (rdev->flags & RADEON_IS_AGP) {
971 size_bf = mc->gtt_start; 971 size_bf = mc->gtt_start;
972 size_af = 0xFFFFFFFF - mc->gtt_end + 1; 972 size_af = 0xFFFFFFFF - mc->gtt_end;
973 if (size_bf > size_af) { 973 if (size_bf > size_af) {
974 if (mc->mc_vram_size > size_bf) { 974 if (mc->mc_vram_size > size_bf) {
975 dev_warn(rdev->dev, "limiting VRAM\n"); 975 dev_warn(rdev->dev, "limiting VRAM\n");
@@ -983,7 +983,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
983 mc->real_vram_size = size_af; 983 mc->real_vram_size = size_af;
984 mc->mc_vram_size = size_af; 984 mc->mc_vram_size = size_af;
985 } 985 }
986 mc->vram_start = mc->gtt_end; 986 mc->vram_start = mc->gtt_end + 1;
987 } 987 }
988 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; 988 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
989 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", 989 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n",
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index ac7a199ffece..27bda986fc2b 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2999,8 +2999,8 @@ int si_rlc_init(struct radeon_device *rdev)
2999 } 2999 }
3000 r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, 3000 r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM,
3001 &rdev->rlc.save_restore_gpu_addr); 3001 &rdev->rlc.save_restore_gpu_addr);
3002 radeon_bo_unreserve(rdev->rlc.save_restore_obj);
3002 if (r) { 3003 if (r) {
3003 radeon_bo_unreserve(rdev->rlc.save_restore_obj);
3004 dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); 3004 dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r);
3005 si_rlc_fini(rdev); 3005 si_rlc_fini(rdev);
3006 return r; 3006 return r;
@@ -3023,9 +3023,8 @@ int si_rlc_init(struct radeon_device *rdev)
3023 } 3023 }
3024 r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, 3024 r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM,
3025 &rdev->rlc.clear_state_gpu_addr); 3025 &rdev->rlc.clear_state_gpu_addr);
3026 radeon_bo_unreserve(rdev->rlc.clear_state_obj);
3026 if (r) { 3027 if (r) {
3027
3028 radeon_bo_unreserve(rdev->rlc.clear_state_obj);
3029 dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); 3028 dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r);
3030 si_rlc_fini(rdev); 3029 si_rlc_fini(rdev);
3031 return r; 3030 return r;
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index a3d033252995..ffddcba32af6 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -34,7 +34,7 @@ config HID
34config HID_BATTERY_STRENGTH 34config HID_BATTERY_STRENGTH
35 bool 35 bool
36 depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY 36 depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY
37 default y 37 default n
38 38
39config HIDRAW 39config HIDRAW
40 bool "/dev/hidraw raw HID device support" 40 bool "/dev/hidraw raw HID device support"
diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c
index de47039c708c..9f85f827607f 100644
--- a/drivers/hid/hid-tivo.c
+++ b/drivers/hid/hid-tivo.c
@@ -62,7 +62,7 @@ static int tivo_input_mapping(struct hid_device *hdev, struct hid_input *hi,
62 62
63static const struct hid_device_id tivo_devices[] = { 63static const struct hid_device_id tivo_devices[] = {
64 /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ 64 /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */
65 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, 65 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) },
66 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, 66 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) },
67 { } 67 { }
68}; 68};
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c
index 7765e4f74ec5..1958f03efd7a 100644
--- a/drivers/hwmon/ads1015.c
+++ b/drivers/hwmon/ads1015.c
@@ -59,14 +59,11 @@ struct ads1015_data {
59 struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; 59 struct ads1015_channel_data channel_data[ADS1015_CHANNELS];
60}; 60};
61 61
62static int ads1015_read_value(struct i2c_client *client, unsigned int channel, 62static int ads1015_read_adc(struct i2c_client *client, unsigned int channel)
63 int *value)
64{ 63{
65 u16 config; 64 u16 config;
66 s16 conversion;
67 struct ads1015_data *data = i2c_get_clientdata(client); 65 struct ads1015_data *data = i2c_get_clientdata(client);
68 unsigned int pga = data->channel_data[channel].pga; 66 unsigned int pga = data->channel_data[channel].pga;
69 int fullscale;
70 unsigned int data_rate = data->channel_data[channel].data_rate; 67 unsigned int data_rate = data->channel_data[channel].data_rate;
71 unsigned int conversion_time_ms; 68 unsigned int conversion_time_ms;
72 int res; 69 int res;
@@ -78,7 +75,6 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel,
78 if (res < 0) 75 if (res < 0)
79 goto err_unlock; 76 goto err_unlock;
80 config = res; 77 config = res;
81 fullscale = fullscale_table[pga];
82 conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); 78 conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]);
83 79
84 /* setup and start single conversion */ 80 /* setup and start single conversion */
@@ -105,33 +101,36 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel,
105 } 101 }
106 102
107 res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); 103 res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION);
108 if (res < 0)
109 goto err_unlock;
110 conversion = res;
111
112 mutex_unlock(&data->update_lock);
113
114 *value = DIV_ROUND_CLOSEST(conversion * fullscale, 0x7ff0);
115
116 return 0;
117 104
118err_unlock: 105err_unlock:
119 mutex_unlock(&data->update_lock); 106 mutex_unlock(&data->update_lock);
120 return res; 107 return res;
121} 108}
122 109
110static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel,
111 s16 reg)
112{
113 struct ads1015_data *data = i2c_get_clientdata(client);
114 unsigned int pga = data->channel_data[channel].pga;
115 int fullscale = fullscale_table[pga];
116
117 return DIV_ROUND_CLOSEST(reg * fullscale, 0x7ff0);
118}
119
123/* sysfs callback function */ 120/* sysfs callback function */
124static ssize_t show_in(struct device *dev, struct device_attribute *da, 121static ssize_t show_in(struct device *dev, struct device_attribute *da,
125 char *buf) 122 char *buf)
126{ 123{
127 struct sensor_device_attribute *attr = to_sensor_dev_attr(da); 124 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
128 struct i2c_client *client = to_i2c_client(dev); 125 struct i2c_client *client = to_i2c_client(dev);
129 int in;
130 int res; 126 int res;
127 int index = attr->index;
131 128
132 res = ads1015_read_value(client, attr->index, &in); 129 res = ads1015_read_adc(client, index);
130 if (res < 0)
131 return res;
133 132
134 return (res < 0) ? res : sprintf(buf, "%d\n", in); 133 return sprintf(buf, "%d\n", ads1015_reg_to_mv(client, index, res));
135} 134}
136 135
137static const struct sensor_device_attribute ads1015_in[] = { 136static const struct sensor_device_attribute ads1015_in[] = {
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
index b7494af1e4a9..37a8fc92b44a 100644
--- a/drivers/hwmon/fam15h_power.c
+++ b/drivers/hwmon/fam15h_power.c
@@ -122,6 +122,38 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
122 return true; 122 return true;
123} 123}
124 124
125/*
126 * Newer BKDG versions have an updated recommendation on how to properly
127 * initialize the running average range (was: 0xE, now: 0x9). This avoids
128 * counter saturations resulting in bogus power readings.
129 * We correct this value ourselves to cope with older BIOSes.
130 */
131static void __devinit tweak_runavg_range(struct pci_dev *pdev)
132{
133 u32 val;
134 const struct pci_device_id affected_device = {
135 PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) };
136
137 /*
138 * let this quirk apply only to the current version of the
139 * northbridge, since future versions may change the behavior
140 */
141 if (!pci_match_id(&affected_device, pdev))
142 return;
143
144 pci_bus_read_config_dword(pdev->bus,
145 PCI_DEVFN(PCI_SLOT(pdev->devfn), 5),
146 REG_TDP_RUNNING_AVERAGE, &val);
147 if ((val & 0xf) != 0xe)
148 return;
149
150 val &= ~0xf;
151 val |= 0x9;
152 pci_bus_write_config_dword(pdev->bus,
153 PCI_DEVFN(PCI_SLOT(pdev->devfn), 5),
154 REG_TDP_RUNNING_AVERAGE, val);
155}
156
125static void __devinit fam15h_power_init_data(struct pci_dev *f4, 157static void __devinit fam15h_power_init_data(struct pci_dev *f4,
126 struct fam15h_power_data *data) 158 struct fam15h_power_data *data)
127{ 159{
@@ -155,6 +187,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev,
155 struct device *dev; 187 struct device *dev;
156 int err; 188 int err;
157 189
190 /*
191 * though we ignore every other northbridge, we still have to
192 * do the tweaking on _each_ node in MCM processors as the counters
193 * are working hand-in-hand
194 */
195 tweak_runavg_range(pdev);
196
158 if (!fam15h_power_is_internal_node0(pdev)) { 197 if (!fam15h_power_is_internal_node0(pdev)) {
159 err = -ENODEV; 198 err = -ENODEV;
160 goto exit; 199 goto exit;
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 04be9f82e14b..99389d2eae51 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -23,16 +23,61 @@
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/of_i2c.h>
27
28#define I2C_PNX_TIMEOUT_DEFAULT 10 /* msec */
29#define I2C_PNX_SPEED_KHZ_DEFAULT 100
30#define I2C_PNX_REGION_SIZE 0x100
31
32enum {
33 mstatus_tdi = 0x00000001,
34 mstatus_afi = 0x00000002,
35 mstatus_nai = 0x00000004,
36 mstatus_drmi = 0x00000008,
37 mstatus_active = 0x00000020,
38 mstatus_scl = 0x00000040,
39 mstatus_sda = 0x00000080,
40 mstatus_rff = 0x00000100,
41 mstatus_rfe = 0x00000200,
42 mstatus_tff = 0x00000400,
43 mstatus_tfe = 0x00000800,
44};
26 45
27#include <mach/hardware.h> 46enum {
28#include <mach/i2c.h> 47 mcntrl_tdie = 0x00000001,
48 mcntrl_afie = 0x00000002,
49 mcntrl_naie = 0x00000004,
50 mcntrl_drmie = 0x00000008,
51 mcntrl_daie = 0x00000020,
52 mcntrl_rffie = 0x00000040,
53 mcntrl_tffie = 0x00000080,
54 mcntrl_reset = 0x00000100,
55 mcntrl_cdbmode = 0x00000400,
56};
29 57
30#define I2C_PNX_TIMEOUT 10 /* msec */ 58enum {
31#define I2C_PNX_SPEED_KHZ 100 59 rw_bit = 1 << 0,
32#define I2C_PNX_REGION_SIZE 0x100 60 start_bit = 1 << 8,
61 stop_bit = 1 << 9,
62};
33 63
34static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data) 64#define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */
65#define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */
66#define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */
67#define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */
68#define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */
69#define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */
70#define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */
71#define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */
72#define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */
73#define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */
74#define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */
75#define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */
76#define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */
77
78static inline int wait_timeout(struct i2c_pnx_algo_data *data)
35{ 79{
80 long timeout = data->timeout;
36 while (timeout > 0 && 81 while (timeout > 0 &&
37 (ioread32(I2C_REG_STS(data)) & mstatus_active)) { 82 (ioread32(I2C_REG_STS(data)) & mstatus_active)) {
38 mdelay(1); 83 mdelay(1);
@@ -41,8 +86,9 @@ static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data)
41 return (timeout <= 0); 86 return (timeout <= 0);
42} 87}
43 88
44static inline int wait_reset(long timeout, struct i2c_pnx_algo_data *data) 89static inline int wait_reset(struct i2c_pnx_algo_data *data)
45{ 90{
91 long timeout = data->timeout;
46 while (timeout > 0 && 92 while (timeout > 0 &&
47 (ioread32(I2C_REG_CTL(data)) & mcntrl_reset)) { 93 (ioread32(I2C_REG_CTL(data)) & mcntrl_reset)) {
48 mdelay(1); 94 mdelay(1);
@@ -54,7 +100,7 @@ static inline int wait_reset(long timeout, struct i2c_pnx_algo_data *data)
54static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data) 100static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data)
55{ 101{
56 struct timer_list *timer = &alg_data->mif.timer; 102 struct timer_list *timer = &alg_data->mif.timer;
57 unsigned long expires = msecs_to_jiffies(I2C_PNX_TIMEOUT); 103 unsigned long expires = msecs_to_jiffies(alg_data->timeout);
58 104
59 if (expires <= 1) 105 if (expires <= 1)
60 expires = 2; 106 expires = 2;
@@ -92,7 +138,7 @@ static int i2c_pnx_start(unsigned char slave_addr,
92 } 138 }
93 139
94 /* First, make sure bus is idle */ 140 /* First, make sure bus is idle */
95 if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) { 141 if (wait_timeout(alg_data)) {
96 /* Somebody else is monopolizing the bus */ 142 /* Somebody else is monopolizing the bus */
97 dev_err(&alg_data->adapter.dev, 143 dev_err(&alg_data->adapter.dev,
98 "%s: Bus busy. Slave addr = %02x, cntrl = %x, stat = %x\n", 144 "%s: Bus busy. Slave addr = %02x, cntrl = %x, stat = %x\n",
@@ -185,7 +231,7 @@ static int i2c_pnx_master_xmit(struct i2c_pnx_algo_data *alg_data)
185 if (alg_data->mif.len == 0) { 231 if (alg_data->mif.len == 0) {
186 if (alg_data->last) { 232 if (alg_data->last) {
187 /* Wait until the STOP is seen. */ 233 /* Wait until the STOP is seen. */
188 if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) 234 if (wait_timeout(alg_data))
189 dev_err(&alg_data->adapter.dev, 235 dev_err(&alg_data->adapter.dev,
190 "The bus is still active after timeout\n"); 236 "The bus is still active after timeout\n");
191 } 237 }
@@ -283,7 +329,7 @@ static int i2c_pnx_master_rcv(struct i2c_pnx_algo_data *alg_data)
283 if (alg_data->mif.len == 0) { 329 if (alg_data->mif.len == 0) {
284 if (alg_data->last) 330 if (alg_data->last)
285 /* Wait until the STOP is seen. */ 331 /* Wait until the STOP is seen. */
286 if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) 332 if (wait_timeout(alg_data))
287 dev_err(&alg_data->adapter.dev, 333 dev_err(&alg_data->adapter.dev,
288 "The bus is still active after timeout\n"); 334 "The bus is still active after timeout\n");
289 335
@@ -399,7 +445,7 @@ static void i2c_pnx_timeout(unsigned long data)
399 445
400 ctl |= mcntrl_reset; 446 ctl |= mcntrl_reset;
401 iowrite32(ctl, I2C_REG_CTL(alg_data)); 447 iowrite32(ctl, I2C_REG_CTL(alg_data));
402 wait_reset(I2C_PNX_TIMEOUT, alg_data); 448 wait_reset(alg_data);
403 alg_data->mif.ret = -EIO; 449 alg_data->mif.ret = -EIO;
404 complete(&alg_data->mif.complete); 450 complete(&alg_data->mif.complete);
405} 451}
@@ -414,18 +460,18 @@ static inline void bus_reset_if_active(struct i2c_pnx_algo_data *alg_data)
414 alg_data->adapter.name); 460 alg_data->adapter.name);
415 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, 461 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset,
416 I2C_REG_CTL(alg_data)); 462 I2C_REG_CTL(alg_data));
417 wait_reset(I2C_PNX_TIMEOUT, alg_data); 463 wait_reset(alg_data);
418 } else if (!(stat & mstatus_rfe) || !(stat & mstatus_tfe)) { 464 } else if (!(stat & mstatus_rfe) || !(stat & mstatus_tfe)) {
419 /* If there is data in the fifo's after transfer, 465 /* If there is data in the fifo's after transfer,
420 * flush fifo's by reset. 466 * flush fifo's by reset.
421 */ 467 */
422 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, 468 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset,
423 I2C_REG_CTL(alg_data)); 469 I2C_REG_CTL(alg_data));
424 wait_reset(I2C_PNX_TIMEOUT, alg_data); 470 wait_reset(alg_data);
425 } else if (stat & mstatus_nai) { 471 } else if (stat & mstatus_nai) {
426 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, 472 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset,
427 I2C_REG_CTL(alg_data)); 473 I2C_REG_CTL(alg_data));
428 wait_reset(I2C_PNX_TIMEOUT, alg_data); 474 wait_reset(alg_data);
429 } 475 }
430} 476}
431 477
@@ -546,8 +592,7 @@ static int i2c_pnx_controller_suspend(struct platform_device *pdev,
546{ 592{
547 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); 593 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev);
548 594
549 /* FIXME: shouldn't this be clk_disable? */ 595 clk_disable(alg_data->clk);
550 clk_enable(alg_data->clk);
551 596
552 return 0; 597 return 0;
553} 598}
@@ -569,14 +614,8 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
569 int ret = 0; 614 int ret = 0;
570 struct i2c_pnx_algo_data *alg_data; 615 struct i2c_pnx_algo_data *alg_data;
571 unsigned long freq; 616 unsigned long freq;
572 struct i2c_pnx_data *i2c_pnx = pdev->dev.platform_data; 617 struct resource *res;
573 618 u32 speed = I2C_PNX_SPEED_KHZ_DEFAULT * 1000;
574 if (!i2c_pnx || !i2c_pnx->name) {
575 dev_err(&pdev->dev, "%s: no platform data supplied\n",
576 __func__);
577 ret = -EINVAL;
578 goto out;
579 }
580 619
581 alg_data = kzalloc(sizeof(*alg_data), GFP_KERNEL); 620 alg_data = kzalloc(sizeof(*alg_data), GFP_KERNEL);
582 if (!alg_data) { 621 if (!alg_data) {
@@ -586,14 +625,27 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
586 625
587 platform_set_drvdata(pdev, alg_data); 626 platform_set_drvdata(pdev, alg_data);
588 627
589 strlcpy(alg_data->adapter.name, i2c_pnx->name,
590 sizeof(alg_data->adapter.name));
591 alg_data->adapter.dev.parent = &pdev->dev; 628 alg_data->adapter.dev.parent = &pdev->dev;
592 alg_data->adapter.algo = &pnx_algorithm; 629 alg_data->adapter.algo = &pnx_algorithm;
593 alg_data->adapter.algo_data = alg_data; 630 alg_data->adapter.algo_data = alg_data;
594 alg_data->adapter.nr = pdev->id; 631 alg_data->adapter.nr = pdev->id;
595 alg_data->i2c_pnx = i2c_pnx;
596 632
633 alg_data->timeout = I2C_PNX_TIMEOUT_DEFAULT;
634#ifdef CONFIG_OF
635 alg_data->adapter.dev.of_node = of_node_get(pdev->dev.of_node);
636 if (pdev->dev.of_node) {
637 of_property_read_u32(pdev->dev.of_node, "clock-frequency",
638 &speed);
639 /*
640 * At this point, it is planned to add an OF timeout property.
641 * As soon as there is a consensus about how to call and handle
642 * this, sth. like the following can be put here:
643 *
644 * of_property_read_u32(pdev->dev.of_node, "timeout",
645 * &alg_data->timeout);
646 */
647 }
648#endif
597 alg_data->clk = clk_get(&pdev->dev, NULL); 649 alg_data->clk = clk_get(&pdev->dev, NULL);
598 if (IS_ERR(alg_data->clk)) { 650 if (IS_ERR(alg_data->clk)) {
599 ret = PTR_ERR(alg_data->clk); 651 ret = PTR_ERR(alg_data->clk);
@@ -604,17 +656,27 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
604 alg_data->mif.timer.function = i2c_pnx_timeout; 656 alg_data->mif.timer.function = i2c_pnx_timeout;
605 alg_data->mif.timer.data = (unsigned long)alg_data; 657 alg_data->mif.timer.data = (unsigned long)alg_data;
606 658
659 snprintf(alg_data->adapter.name, sizeof(alg_data->adapter.name),
660 "%s", pdev->name);
661
607 /* Register I/O resource */ 662 /* Register I/O resource */
608 if (!request_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE, 663 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
664 if (!res) {
665 dev_err(&pdev->dev, "Unable to get mem resource.\n");
666 ret = -EBUSY;
667 goto out_clkget;
668 }
669 if (!request_mem_region(res->start, I2C_PNX_REGION_SIZE,
609 pdev->name)) { 670 pdev->name)) {
610 dev_err(&pdev->dev, 671 dev_err(&pdev->dev,
611 "I/O region 0x%08x for I2C already in use.\n", 672 "I/O region 0x%08x for I2C already in use.\n",
612 i2c_pnx->base); 673 res->start);
613 ret = -ENODEV; 674 ret = -ENOMEM;
614 goto out_clkget; 675 goto out_clkget;
615 } 676 }
616 677
617 alg_data->ioaddr = ioremap(i2c_pnx->base, I2C_PNX_REGION_SIZE); 678 alg_data->base = res->start;
679 alg_data->ioaddr = ioremap(res->start, I2C_PNX_REGION_SIZE);
618 if (!alg_data->ioaddr) { 680 if (!alg_data->ioaddr) {
619 dev_err(&pdev->dev, "Couldn't ioremap I2C I/O region\n"); 681 dev_err(&pdev->dev, "Couldn't ioremap I2C I/O region\n");
620 ret = -ENOMEM; 682 ret = -ENOMEM;
@@ -638,20 +700,25 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
638 * the deglitching filter length. 700 * the deglitching filter length.
639 */ 701 */
640 702
641 tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; 703 tmp = (freq / speed) / 2 - 2;
642 if (tmp > 0x3FF) 704 if (tmp > 0x3FF)
643 tmp = 0x3FF; 705 tmp = 0x3FF;
644 iowrite32(tmp, I2C_REG_CKH(alg_data)); 706 iowrite32(tmp, I2C_REG_CKH(alg_data));
645 iowrite32(tmp, I2C_REG_CKL(alg_data)); 707 iowrite32(tmp, I2C_REG_CKL(alg_data));
646 708
647 iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data)); 709 iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data));
648 if (wait_reset(I2C_PNX_TIMEOUT, alg_data)) { 710 if (wait_reset(alg_data)) {
649 ret = -ENODEV; 711 ret = -ENODEV;
650 goto out_clock; 712 goto out_clock;
651 } 713 }
652 init_completion(&alg_data->mif.complete); 714 init_completion(&alg_data->mif.complete);
653 715
654 ret = request_irq(i2c_pnx->irq, i2c_pnx_interrupt, 716 alg_data->irq = platform_get_irq(pdev, 0);
717 if (alg_data->irq < 0) {
718 dev_err(&pdev->dev, "Failed to get IRQ from platform resource\n");
719 goto out_irq;
720 }
721 ret = request_irq(alg_data->irq, i2c_pnx_interrupt,
655 0, pdev->name, alg_data); 722 0, pdev->name, alg_data);
656 if (ret) 723 if (ret)
657 goto out_clock; 724 goto out_clock;
@@ -663,39 +730,39 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
663 goto out_irq; 730 goto out_irq;
664 } 731 }
665 732
733 of_i2c_register_devices(&alg_data->adapter);
734
666 dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n", 735 dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
667 alg_data->adapter.name, i2c_pnx->base, i2c_pnx->irq); 736 alg_data->adapter.name, res->start, alg_data->irq);
668 737
669 return 0; 738 return 0;
670 739
671out_irq: 740out_irq:
672 free_irq(i2c_pnx->irq, alg_data); 741 free_irq(alg_data->irq, alg_data);
673out_clock: 742out_clock:
674 clk_disable(alg_data->clk); 743 clk_disable(alg_data->clk);
675out_unmap: 744out_unmap:
676 iounmap(alg_data->ioaddr); 745 iounmap(alg_data->ioaddr);
677out_release: 746out_release:
678 release_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE); 747 release_mem_region(res->start, I2C_PNX_REGION_SIZE);
679out_clkget: 748out_clkget:
680 clk_put(alg_data->clk); 749 clk_put(alg_data->clk);
681out_drvdata: 750out_drvdata:
682 kfree(alg_data); 751 kfree(alg_data);
683err_kzalloc: 752err_kzalloc:
684 platform_set_drvdata(pdev, NULL); 753 platform_set_drvdata(pdev, NULL);
685out:
686 return ret; 754 return ret;
687} 755}
688 756
689static int __devexit i2c_pnx_remove(struct platform_device *pdev) 757static int __devexit i2c_pnx_remove(struct platform_device *pdev)
690{ 758{
691 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); 759 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev);
692 struct i2c_pnx_data *i2c_pnx = alg_data->i2c_pnx;
693 760
694 free_irq(i2c_pnx->irq, alg_data); 761 free_irq(alg_data->irq, alg_data);
695 i2c_del_adapter(&alg_data->adapter); 762 i2c_del_adapter(&alg_data->adapter);
696 clk_disable(alg_data->clk); 763 clk_disable(alg_data->clk);
697 iounmap(alg_data->ioaddr); 764 iounmap(alg_data->ioaddr);
698 release_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE); 765 release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE);
699 clk_put(alg_data->clk); 766 clk_put(alg_data->clk);
700 kfree(alg_data); 767 kfree(alg_data);
701 platform_set_drvdata(pdev, NULL); 768 platform_set_drvdata(pdev, NULL);
@@ -703,10 +770,19 @@ static int __devexit i2c_pnx_remove(struct platform_device *pdev)
703 return 0; 770 return 0;
704} 771}
705 772
773#ifdef CONFIG_OF
774static const struct of_device_id i2c_pnx_of_match[] = {
775 { .compatible = "nxp,pnx-i2c" },
776 { },
777};
778MODULE_DEVICE_TABLE(of, i2c_pnx_of_match);
779#endif
780
706static struct platform_driver i2c_pnx_driver = { 781static struct platform_driver i2c_pnx_driver = {
707 .driver = { 782 .driver = {
708 .name = "pnx-i2c", 783 .name = "pnx-i2c",
709 .owner = THIS_MODULE, 784 .owner = THIS_MODULE,
785 .of_match_table = of_match_ptr(i2c_pnx_of_match),
710 }, 786 },
711 .probe = i2c_pnx_probe, 787 .probe = i2c_pnx_probe,
712 .remove = __devexit_p(i2c_pnx_remove), 788 .remove = __devexit_p(i2c_pnx_remove),
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 2d787796bf50..7faf4a7fcaa9 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -380,8 +380,7 @@ config INPUT_TWL4030_VIBRA
380 380
381config INPUT_TWL6040_VIBRA 381config INPUT_TWL6040_VIBRA
382 tristate "Support for TWL6040 Vibrator" 382 tristate "Support for TWL6040 Vibrator"
383 depends on TWL4030_CORE 383 depends on TWL6040_CORE
384 select TWL6040_CORE
385 select INPUT_FF_MEMLESS 384 select INPUT_FF_MEMLESS
386 help 385 help
387 This option enables support for TWL6040 Vibrator Driver. 386 This option enables support for TWL6040 Vibrator Driver.
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
index 45874fed523a..14e94f56cb7d 100644
--- a/drivers/input/misc/twl6040-vibra.c
+++ b/drivers/input/misc/twl6040-vibra.c
@@ -28,7 +28,7 @@
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31#include <linux/i2c/twl.h> 31#include <linux/input.h>
32#include <linux/mfd/twl6040.h> 32#include <linux/mfd/twl6040.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
@@ -257,7 +257,7 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL);
257 257
258static int __devinit twl6040_vibra_probe(struct platform_device *pdev) 258static int __devinit twl6040_vibra_probe(struct platform_device *pdev)
259{ 259{
260 struct twl4030_vibra_data *pdata = pdev->dev.platform_data; 260 struct twl6040_vibra_data *pdata = pdev->dev.platform_data;
261 struct vibra_info *info; 261 struct vibra_info *info;
262 int ret; 262 int ret;
263 263
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c
index 800243b6037e..64ad702a2ecc 100644
--- a/drivers/leds/leds-atmel-pwm.c
+++ b/drivers/leds/leds-atmel-pwm.c
@@ -35,7 +35,7 @@ static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b)
35 * NOTE: we reuse the platform_data structure of GPIO leds, 35 * NOTE: we reuse the platform_data structure of GPIO leds,
36 * but repurpose its "gpio" number as a PWM channel number. 36 * but repurpose its "gpio" number as a PWM channel number.
37 */ 37 */
38static int __init pwmled_probe(struct platform_device *pdev) 38static int __devinit pwmled_probe(struct platform_device *pdev)
39{ 39{
40 const struct gpio_led_platform_data *pdata; 40 const struct gpio_led_platform_data *pdata;
41 struct pwmled *leds; 41 struct pwmled *leds;
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index 7f98984e4fad..eab2ea424200 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -54,6 +54,7 @@ struct xc5000_priv {
54 struct list_head hybrid_tuner_instance_list; 54 struct list_head hybrid_tuner_instance_list;
55 55
56 u32 if_khz; 56 u32 if_khz;
57 u32 xtal_khz;
57 u32 freq_hz; 58 u32 freq_hz;
58 u32 bandwidth; 59 u32 bandwidth;
59 u8 video_standard; 60 u8 video_standard;
@@ -214,9 +215,9 @@ static const struct xc5000_fw_cfg xc5000a_1_6_114 = {
214 .size = 12401, 215 .size = 12401,
215}; 216};
216 217
217static const struct xc5000_fw_cfg xc5000c_41_024_5_31875 = { 218static const struct xc5000_fw_cfg xc5000c_41_024_5 = {
218 .name = "dvb-fe-xc5000c-41.024.5-31875.fw", 219 .name = "dvb-fe-xc5000c-41.024.5.fw",
219 .size = 16503, 220 .size = 16497,
220}; 221};
221 222
222static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) 223static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id)
@@ -226,7 +227,7 @@ static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id)
226 case XC5000A: 227 case XC5000A:
227 return &xc5000a_1_6_114; 228 return &xc5000a_1_6_114;
228 case XC5000C: 229 case XC5000C:
229 return &xc5000c_41_024_5_31875; 230 return &xc5000c_41_024_5;
230 } 231 }
231} 232}
232 233
@@ -572,6 +573,31 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode)
572 return found; 573 return found;
573} 574}
574 575
576static int xc_set_xtal(struct dvb_frontend *fe)
577{
578 struct xc5000_priv *priv = fe->tuner_priv;
579 int ret = XC_RESULT_SUCCESS;
580
581 switch (priv->chip_id) {
582 default:
583 case XC5000A:
584 /* 32.000 MHz xtal is default */
585 break;
586 case XC5000C:
587 switch (priv->xtal_khz) {
588 default:
589 case 32000:
590 /* 32.000 MHz xtal is default */
591 break;
592 case 31875:
593 /* 31.875 MHz xtal configuration */
594 ret = xc_write_reg(priv, 0x000f, 0x8081);
595 break;
596 }
597 break;
598 }
599 return ret;
600}
575 601
576static int xc5000_fwupload(struct dvb_frontend *fe) 602static int xc5000_fwupload(struct dvb_frontend *fe)
577{ 603{
@@ -603,6 +629,8 @@ static int xc5000_fwupload(struct dvb_frontend *fe)
603 } else { 629 } else {
604 printk(KERN_INFO "xc5000: firmware uploading...\n"); 630 printk(KERN_INFO "xc5000: firmware uploading...\n");
605 ret = xc_load_i2c_sequence(fe, fw->data); 631 ret = xc_load_i2c_sequence(fe, fw->data);
632 if (XC_RESULT_SUCCESS == ret)
633 ret = xc_set_xtal(fe);
606 printk(KERN_INFO "xc5000: firmware upload complete...\n"); 634 printk(KERN_INFO "xc5000: firmware upload complete...\n");
607 } 635 }
608 636
@@ -1164,6 +1192,9 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
1164 priv->if_khz = cfg->if_khz; 1192 priv->if_khz = cfg->if_khz;
1165 } 1193 }
1166 1194
1195 if (priv->xtal_khz == 0)
1196 priv->xtal_khz = cfg->xtal_khz;
1197
1167 if (priv->radio_input == 0) 1198 if (priv->radio_input == 0)
1168 priv->radio_input = cfg->radio_input; 1199 priv->radio_input = cfg->radio_input;
1169 1200
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h
index 3396f8e02b40..39a73bf01406 100644
--- a/drivers/media/common/tuners/xc5000.h
+++ b/drivers/media/common/tuners/xc5000.h
@@ -34,6 +34,7 @@ struct xc5000_config {
34 u8 i2c_address; 34 u8 i2c_address;
35 u32 if_khz; 35 u32 if_khz;
36 u8 radio_input; 36 u8 radio_input;
37 u32 xtal_khz;
37 38
38 int chip_id; 39 int chip_id;
39}; 40};
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 39696c6a4ed7..0f64d7182657 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1446,6 +1446,28 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
1446 __func__); 1446 __func__);
1447 return -EINVAL; 1447 return -EINVAL;
1448 } 1448 }
1449 /*
1450 * Get a delivery system that is compatible with DVBv3
1451 * NOTE: in order for this to work with softwares like Kaffeine that
1452 * uses a DVBv5 call for DVB-S2 and a DVBv3 call to go back to
1453 * DVB-S, drivers that support both should put the SYS_DVBS entry
1454 * before the SYS_DVBS2, otherwise it won't switch back to DVB-S.
1455 * The real fix is that userspace applications should not use DVBv3
1456 * and not trust on calling FE_SET_FRONTEND to switch the delivery
1457 * system.
1458 */
1459 ncaps = 0;
1460 while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) {
1461 if (fe->ops.delsys[ncaps] == desired_system) {
1462 delsys = desired_system;
1463 break;
1464 }
1465 ncaps++;
1466 }
1467 if (delsys == SYS_UNDEFINED) {
1468 dprintk("%s() Couldn't find a delivery system that matches %d\n",
1469 __func__, desired_system);
1470 }
1449 } else { 1471 } else {
1450 /* 1472 /*
1451 * This is a DVBv5 call. So, it likely knows the supported 1473 * This is a DVBv5 call. So, it likely knows the supported
@@ -1494,9 +1516,10 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
1494 __func__); 1516 __func__);
1495 return -EINVAL; 1517 return -EINVAL;
1496 } 1518 }
1497 c->delivery_system = delsys;
1498 } 1519 }
1499 1520
1521 c->delivery_system = delsys;
1522
1500 /* 1523 /*
1501 * The DVBv3 or DVBv5 call is requesting a different system. So, 1524 * The DVBv3 or DVBv5 call is requesting a different system. So,
1502 * emulation is needed. 1525 * emulation is needed.
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index 36d11756492f..a414b1f2b6a5 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -1520,8 +1520,10 @@ static int scu_command(struct drxk_state *state,
1520 dprintk(1, "\n"); 1520 dprintk(1, "\n");
1521 1521
1522 if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || 1522 if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) ||
1523 ((resultLen > 0) && (result == NULL))) 1523 ((resultLen > 0) && (result == NULL))) {
1524 goto error; 1524 printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__);
1525 return status;
1526 }
1525 1527
1526 mutex_lock(&state->mutex); 1528 mutex_lock(&state->mutex);
1527 1529
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
index b09c5fae489b..af526586fa26 100644
--- a/drivers/media/rc/winbond-cir.c
+++ b/drivers/media/rc/winbond-cir.c
@@ -1046,6 +1046,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1046 goto exit_unregister_led; 1046 goto exit_unregister_led;
1047 } 1047 }
1048 1048
1049 data->dev->driver_type = RC_DRIVER_IR_RAW;
1049 data->dev->driver_name = WBCIR_NAME; 1050 data->dev->driver_name = WBCIR_NAME;
1050 data->dev->input_name = WBCIR_NAME; 1051 data->dev->input_name = WBCIR_NAME;
1051 data->dev->input_phys = "wbcir/cir0"; 1052 data->dev->input_phys = "wbcir/cir0";
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index f2479c5c0eb2..ce1e7ba940f6 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -492,7 +492,7 @@ config VIDEO_VS6624
492 492
493config VIDEO_MT9M032 493config VIDEO_MT9M032
494 tristate "MT9M032 camera sensor support" 494 tristate "MT9M032 camera sensor support"
495 depends on I2C && VIDEO_V4L2 495 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
496 select VIDEO_APTINA_PLL 496 select VIDEO_APTINA_PLL
497 ---help--- 497 ---help---
498 This driver supports MT9M032 camera sensors from Aptina, monochrome 498 This driver supports MT9M032 camera sensors from Aptina, monochrome
diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c
index 7636672c3548..645973c5feb0 100644
--- a/drivers/media/video/mt9m032.c
+++ b/drivers/media/video/mt9m032.c
@@ -392,10 +392,11 @@ static int mt9m032_set_pad_format(struct v4l2_subdev *subdev,
392 } 392 }
393 393
394 /* Scaling is not supported, the format is thus fixed. */ 394 /* Scaling is not supported, the format is thus fixed. */
395 ret = mt9m032_get_pad_format(subdev, fh, fmt); 395 fmt->format = *__mt9m032_get_pad_format(sensor, fh, fmt->which);
396 ret = 0;
396 397
397done: 398done:
398 mutex_lock(&sensor->lock); 399 mutex_unlock(&sensor->lock);
399 return ret; 400 return ret;
400} 401}
401 402
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 29f463cc09cb..11e44386fa9b 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -268,10 +268,17 @@ config TWL6030_PWM
268 This is used to control charging LED brightness. 268 This is used to control charging LED brightness.
269 269
270config TWL6040_CORE 270config TWL6040_CORE
271 bool 271 bool "Support for TWL6040 audio codec"
272 depends on TWL4030_CORE && GENERIC_HARDIRQS 272 depends on I2C=y && GENERIC_HARDIRQS
273 select MFD_CORE 273 select MFD_CORE
274 select REGMAP_I2C
274 default n 275 default n
276 help
277 Say yes here if you want support for Texas Instruments TWL6040 audio
278 codec.
279 This driver provides common support for accessing the device,
280 additional drivers must be enabled in order to use the
281 functionality of the device (audio, vibra).
275 282
276config MFD_STMPE 283config MFD_STMPE
277 bool "Support STMicroelectronics STMPE" 284 bool "Support STMicroelectronics STMPE"
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 1895cf9fab8c..1582c3d95257 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -527,7 +527,9 @@ static void asic3_gpio_set(struct gpio_chip *chip,
527 527
528static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 528static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
529{ 529{
530 return (offset < ASIC3_NUM_GPIOS) ? IRQ_BOARD_START + offset : -ENXIO; 530 struct asic3 *asic = container_of(chip, struct asic3, gpio);
531
532 return (offset < ASIC3_NUM_GPIOS) ? asic->irq_base + offset : -ENXIO;
531} 533}
532 534
533static __init int asic3_gpio_probe(struct platform_device *pdev, 535static __init int asic3_gpio_probe(struct platform_device *pdev,
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 95a2e546a489..c8aae6640e64 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -25,7 +25,6 @@
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/gpio.h>
29#include <plat/usb.h> 28#include <plat/usb.h>
30#include <linux/pm_runtime.h> 29#include <linux/pm_runtime.h>
31 30
@@ -502,19 +501,6 @@ static void omap_usbhs_init(struct device *dev)
502 pm_runtime_get_sync(dev); 501 pm_runtime_get_sync(dev);
503 spin_lock_irqsave(&omap->lock, flags); 502 spin_lock_irqsave(&omap->lock, flags);
504 503
505 if (pdata->ehci_data->phy_reset) {
506 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
507 gpio_request_one(pdata->ehci_data->reset_gpio_port[0],
508 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
509
510 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
511 gpio_request_one(pdata->ehci_data->reset_gpio_port[1],
512 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
513
514 /* Hold the PHY in RESET for enough time till DIR is high */
515 udelay(10);
516 }
517
518 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); 504 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
519 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); 505 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev);
520 506
@@ -593,39 +579,10 @@ static void omap_usbhs_init(struct device *dev)
593 usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); 579 usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT);
594 } 580 }
595 581
596 if (pdata->ehci_data->phy_reset) {
597 /* Hold the PHY in RESET for enough time till
598 * PHY is settled and ready
599 */
600 udelay(10);
601
602 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
603 gpio_set_value
604 (pdata->ehci_data->reset_gpio_port[0], 1);
605
606 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
607 gpio_set_value
608 (pdata->ehci_data->reset_gpio_port[1], 1);
609 }
610
611 spin_unlock_irqrestore(&omap->lock, flags); 582 spin_unlock_irqrestore(&omap->lock, flags);
612 pm_runtime_put_sync(dev); 583 pm_runtime_put_sync(dev);
613} 584}
614 585
615static void omap_usbhs_deinit(struct device *dev)
616{
617 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
618 struct usbhs_omap_platform_data *pdata = &omap->platdata;
619
620 if (pdata->ehci_data->phy_reset) {
621 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
622 gpio_free(pdata->ehci_data->reset_gpio_port[0]);
623
624 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
625 gpio_free(pdata->ehci_data->reset_gpio_port[1]);
626 }
627}
628
629 586
630/** 587/**
631 * usbhs_omap_probe - initialize TI-based HCDs 588 * usbhs_omap_probe - initialize TI-based HCDs
@@ -860,7 +817,6 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev)
860{ 817{
861 struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); 818 struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev);
862 819
863 omap_usbhs_deinit(&pdev->dev);
864 iounmap(omap->tll_base); 820 iounmap(omap->tll_base);
865 iounmap(omap->uhh_base); 821 iounmap(omap->uhh_base);
866 clk_put(omap->init_60m_fclk); 822 clk_put(omap->init_60m_fclk);
diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c
index 99ef944c621d..44afae0a69ce 100644
--- a/drivers/mfd/rc5t583.c
+++ b/drivers/mfd/rc5t583.c
@@ -80,44 +80,6 @@ static struct mfd_cell rc5t583_subdevs[] = {
80 {.name = "rc5t583-key", } 80 {.name = "rc5t583-key", }
81}; 81};
82 82
83int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
84{
85 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
86 return regmap_write(rc5t583->regmap, reg, val);
87}
88
89int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val)
90{
91 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
92 unsigned int ival;
93 int ret;
94 ret = regmap_read(rc5t583->regmap, reg, &ival);
95 if (!ret)
96 *val = (uint8_t)ival;
97 return ret;
98}
99
100int rc5t583_set_bits(struct device *dev, unsigned int reg,
101 unsigned int bit_mask)
102{
103 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
104 return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask);
105}
106
107int rc5t583_clear_bits(struct device *dev, unsigned int reg,
108 unsigned int bit_mask)
109{
110 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
111 return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0);
112}
113
114int rc5t583_update(struct device *dev, unsigned int reg,
115 unsigned int val, unsigned int mask)
116{
117 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
118 return regmap_update_bits(rc5t583->regmap, reg, mask, val);
119}
120
121static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, 83static int __rc5t583_set_ext_pwrreq1_control(struct device *dev,
122 int id, int ext_pwr, int slots) 84 int id, int ext_pwr, int slots)
123{ 85{
@@ -197,6 +159,7 @@ int rc5t583_ext_power_req_config(struct device *dev, int ds_id,
197 ds_id, ext_pwr_req); 159 ds_id, ext_pwr_req);
198 return 0; 160 return 0;
199} 161}
162EXPORT_SYMBOL(rc5t583_ext_power_req_config);
200 163
201static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, 164static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583,
202 struct rc5t583_platform_data *pdata) 165 struct rc5t583_platform_data *pdata)
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
index b2d8e512d3cb..2d6bedadca09 100644
--- a/drivers/mfd/twl6040-core.c
+++ b/drivers/mfd/twl6040-core.c
@@ -30,7 +30,9 @@
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/i2c/twl.h> 33#include <linux/i2c.h>
34#include <linux/regmap.h>
35#include <linux/err.h>
34#include <linux/mfd/core.h> 36#include <linux/mfd/core.h>
35#include <linux/mfd/twl6040.h> 37#include <linux/mfd/twl6040.h>
36 38
@@ -39,7 +41,7 @@
39int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) 41int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg)
40{ 42{
41 int ret; 43 int ret;
42 u8 val = 0; 44 unsigned int val;
43 45
44 mutex_lock(&twl6040->io_mutex); 46 mutex_lock(&twl6040->io_mutex);
45 /* Vibra control registers from cache */ 47 /* Vibra control registers from cache */
@@ -47,7 +49,7 @@ int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg)
47 reg == TWL6040_REG_VIBCTLR)) { 49 reg == TWL6040_REG_VIBCTLR)) {
48 val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; 50 val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)];
49 } else { 51 } else {
50 ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); 52 ret = regmap_read(twl6040->regmap, reg, &val);
51 if (ret < 0) { 53 if (ret < 0) {
52 mutex_unlock(&twl6040->io_mutex); 54 mutex_unlock(&twl6040->io_mutex);
53 return ret; 55 return ret;
@@ -64,7 +66,7 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val)
64 int ret; 66 int ret;
65 67
66 mutex_lock(&twl6040->io_mutex); 68 mutex_lock(&twl6040->io_mutex);
67 ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); 69 ret = regmap_write(twl6040->regmap, reg, val);
68 /* Cache the vibra control registers */ 70 /* Cache the vibra control registers */
69 if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) 71 if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR)
70 twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; 72 twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val;
@@ -77,16 +79,9 @@ EXPORT_SYMBOL(twl6040_reg_write);
77int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) 79int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask)
78{ 80{
79 int ret; 81 int ret;
80 u8 val;
81 82
82 mutex_lock(&twl6040->io_mutex); 83 mutex_lock(&twl6040->io_mutex);
83 ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); 84 ret = regmap_update_bits(twl6040->regmap, reg, mask, mask);
84 if (ret)
85 goto out;
86
87 val |= mask;
88 ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg);
89out:
90 mutex_unlock(&twl6040->io_mutex); 85 mutex_unlock(&twl6040->io_mutex);
91 return ret; 86 return ret;
92} 87}
@@ -95,16 +90,9 @@ EXPORT_SYMBOL(twl6040_set_bits);
95int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) 90int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask)
96{ 91{
97 int ret; 92 int ret;
98 u8 val;
99 93
100 mutex_lock(&twl6040->io_mutex); 94 mutex_lock(&twl6040->io_mutex);
101 ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); 95 ret = regmap_update_bits(twl6040->regmap, reg, mask, 0);
102 if (ret)
103 goto out;
104
105 val &= ~mask;
106 ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg);
107out:
108 mutex_unlock(&twl6040->io_mutex); 96 mutex_unlock(&twl6040->io_mutex);
109 return ret; 97 return ret;
110} 98}
@@ -494,32 +482,58 @@ static struct resource twl6040_codec_rsrc[] = {
494 }, 482 },
495}; 483};
496 484
497static int __devinit twl6040_probe(struct platform_device *pdev) 485static bool twl6040_readable_reg(struct device *dev, unsigned int reg)
498{ 486{
499 struct twl4030_audio_data *pdata = pdev->dev.platform_data; 487 /* Register 0 is not readable */
488 if (!reg)
489 return false;
490 return true;
491}
492
493static struct regmap_config twl6040_regmap_config = {
494 .reg_bits = 8,
495 .val_bits = 8,
496 .max_register = TWL6040_REG_STATUS, /* 0x2e */
497
498 .readable_reg = twl6040_readable_reg,
499};
500
501static int __devinit twl6040_probe(struct i2c_client *client,
502 const struct i2c_device_id *id)
503{
504 struct twl6040_platform_data *pdata = client->dev.platform_data;
500 struct twl6040 *twl6040; 505 struct twl6040 *twl6040;
501 struct mfd_cell *cell = NULL; 506 struct mfd_cell *cell = NULL;
502 int ret, children = 0; 507 int ret, children = 0;
503 508
504 if (!pdata) { 509 if (!pdata) {
505 dev_err(&pdev->dev, "Platform data is missing\n"); 510 dev_err(&client->dev, "Platform data is missing\n");
506 return -EINVAL; 511 return -EINVAL;
507 } 512 }
508 513
509 /* In order to operate correctly we need valid interrupt config */ 514 /* In order to operate correctly we need valid interrupt config */
510 if (!pdata->naudint_irq || !pdata->irq_base) { 515 if (!client->irq || !pdata->irq_base) {
511 dev_err(&pdev->dev, "Invalid IRQ configuration\n"); 516 dev_err(&client->dev, "Invalid IRQ configuration\n");
512 return -EINVAL; 517 return -EINVAL;
513 } 518 }
514 519
515 twl6040 = kzalloc(sizeof(struct twl6040), GFP_KERNEL); 520 twl6040 = devm_kzalloc(&client->dev, sizeof(struct twl6040),
516 if (!twl6040) 521 GFP_KERNEL);
517 return -ENOMEM; 522 if (!twl6040) {
523 ret = -ENOMEM;
524 goto err;
525 }
526
527 twl6040->regmap = regmap_init_i2c(client, &twl6040_regmap_config);
528 if (IS_ERR(twl6040->regmap)) {
529 ret = PTR_ERR(twl6040->regmap);
530 goto err;
531 }
518 532
519 platform_set_drvdata(pdev, twl6040); 533 i2c_set_clientdata(client, twl6040);
520 534
521 twl6040->dev = &pdev->dev; 535 twl6040->dev = &client->dev;
522 twl6040->irq = pdata->naudint_irq; 536 twl6040->irq = client->irq;
523 twl6040->irq_base = pdata->irq_base; 537 twl6040->irq_base = pdata->irq_base;
524 538
525 mutex_init(&twl6040->mutex); 539 mutex_init(&twl6040->mutex);
@@ -588,12 +602,12 @@ static int __devinit twl6040_probe(struct platform_device *pdev)
588 } 602 }
589 603
590 if (children) { 604 if (children) {
591 ret = mfd_add_devices(&pdev->dev, pdev->id, twl6040->cells, 605 ret = mfd_add_devices(&client->dev, -1, twl6040->cells,
592 children, NULL, 0); 606 children, NULL, 0);
593 if (ret) 607 if (ret)
594 goto mfd_err; 608 goto mfd_err;
595 } else { 609 } else {
596 dev_err(&pdev->dev, "No platform data found for children\n"); 610 dev_err(&client->dev, "No platform data found for children\n");
597 ret = -ENODEV; 611 ret = -ENODEV;
598 goto mfd_err; 612 goto mfd_err;
599 } 613 }
@@ -608,14 +622,15 @@ gpio2_err:
608 if (gpio_is_valid(twl6040->audpwron)) 622 if (gpio_is_valid(twl6040->audpwron))
609 gpio_free(twl6040->audpwron); 623 gpio_free(twl6040->audpwron);
610gpio1_err: 624gpio1_err:
611 platform_set_drvdata(pdev, NULL); 625 i2c_set_clientdata(client, NULL);
612 kfree(twl6040); 626 regmap_exit(twl6040->regmap);
627err:
613 return ret; 628 return ret;
614} 629}
615 630
616static int __devexit twl6040_remove(struct platform_device *pdev) 631static int __devexit twl6040_remove(struct i2c_client *client)
617{ 632{
618 struct twl6040 *twl6040 = platform_get_drvdata(pdev); 633 struct twl6040 *twl6040 = i2c_get_clientdata(client);
619 634
620 if (twl6040->power_count) 635 if (twl6040->power_count)
621 twl6040_power(twl6040, 0); 636 twl6040_power(twl6040, 0);
@@ -626,23 +641,30 @@ static int __devexit twl6040_remove(struct platform_device *pdev)
626 free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); 641 free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040);
627 twl6040_irq_exit(twl6040); 642 twl6040_irq_exit(twl6040);
628 643
629 mfd_remove_devices(&pdev->dev); 644 mfd_remove_devices(&client->dev);
630 platform_set_drvdata(pdev, NULL); 645 i2c_set_clientdata(client, NULL);
631 kfree(twl6040); 646 regmap_exit(twl6040->regmap);
632 647
633 return 0; 648 return 0;
634} 649}
635 650
636static struct platform_driver twl6040_driver = { 651static const struct i2c_device_id twl6040_i2c_id[] = {
652 { "twl6040", 0, },
653 { },
654};
655MODULE_DEVICE_TABLE(i2c, twl6040_i2c_id);
656
657static struct i2c_driver twl6040_driver = {
658 .driver = {
659 .name = "twl6040",
660 .owner = THIS_MODULE,
661 },
637 .probe = twl6040_probe, 662 .probe = twl6040_probe,
638 .remove = __devexit_p(twl6040_remove), 663 .remove = __devexit_p(twl6040_remove),
639 .driver = { 664 .id_table = twl6040_i2c_id,
640 .owner = THIS_MODULE,
641 .name = "twl6040",
642 },
643}; 665};
644 666
645module_platform_driver(twl6040_driver); 667module_i2c_driver(twl6040_driver);
646 668
647MODULE_DESCRIPTION("TWL6040 MFD"); 669MODULE_DESCRIPTION("TWL6040 MFD");
648MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); 670MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>");
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index b1809650b7aa..dabec556ebb8 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -873,7 +873,7 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
873{ 873{
874 struct mmc_blk_data *md = mq->data; 874 struct mmc_blk_data *md = mq->data;
875 struct mmc_card *card = md->queue.card; 875 struct mmc_card *card = md->queue.card;
876 unsigned int from, nr, arg; 876 unsigned int from, nr, arg, trim_arg, erase_arg;
877 int err = 0, type = MMC_BLK_SECDISCARD; 877 int err = 0, type = MMC_BLK_SECDISCARD;
878 878
879 if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { 879 if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) {
@@ -881,20 +881,26 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
881 goto out; 881 goto out;
882 } 882 }
883 883
884 from = blk_rq_pos(req);
885 nr = blk_rq_sectors(req);
886
884 /* The sanitize operation is supported at v4.5 only */ 887 /* The sanitize operation is supported at v4.5 only */
885 if (mmc_can_sanitize(card)) { 888 if (mmc_can_sanitize(card)) {
886 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 889 erase_arg = MMC_ERASE_ARG;
887 EXT_CSD_SANITIZE_START, 1, 0); 890 trim_arg = MMC_TRIM_ARG;
888 goto out; 891 } else {
892 erase_arg = MMC_SECURE_ERASE_ARG;
893 trim_arg = MMC_SECURE_TRIM1_ARG;
889 } 894 }
890 895
891 from = blk_rq_pos(req); 896 if (mmc_erase_group_aligned(card, from, nr))
892 nr = blk_rq_sectors(req); 897 arg = erase_arg;
893 898 else if (mmc_can_trim(card))
894 if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) 899 arg = trim_arg;
895 arg = MMC_SECURE_TRIM1_ARG; 900 else {
896 else 901 err = -EINVAL;
897 arg = MMC_SECURE_ERASE_ARG; 902 goto out;
903 }
898retry: 904retry:
899 if (card->quirks & MMC_QUIRK_INAND_CMD38) { 905 if (card->quirks & MMC_QUIRK_INAND_CMD38) {
900 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 906 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
@@ -904,25 +910,41 @@ retry:
904 INAND_CMD38_ARG_SECERASE, 910 INAND_CMD38_ARG_SECERASE,
905 0); 911 0);
906 if (err) 912 if (err)
907 goto out; 913 goto out_retry;
908 } 914 }
915
909 err = mmc_erase(card, from, nr, arg); 916 err = mmc_erase(card, from, nr, arg);
910 if (!err && arg == MMC_SECURE_TRIM1_ARG) { 917 if (err == -EIO)
918 goto out_retry;
919 if (err)
920 goto out;
921
922 if (arg == MMC_SECURE_TRIM1_ARG) {
911 if (card->quirks & MMC_QUIRK_INAND_CMD38) { 923 if (card->quirks & MMC_QUIRK_INAND_CMD38) {
912 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 924 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
913 INAND_CMD38_ARG_EXT_CSD, 925 INAND_CMD38_ARG_EXT_CSD,
914 INAND_CMD38_ARG_SECTRIM2, 926 INAND_CMD38_ARG_SECTRIM2,
915 0); 927 0);
916 if (err) 928 if (err)
917 goto out; 929 goto out_retry;
918 } 930 }
931
919 err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); 932 err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG);
933 if (err == -EIO)
934 goto out_retry;
935 if (err)
936 goto out;
920 } 937 }
921out: 938
922 if (err == -EIO && !mmc_blk_reset(md, card->host, type)) 939 if (mmc_can_sanitize(card))
940 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
941 EXT_CSD_SANITIZE_START, 1, 0);
942out_retry:
943 if (err && !mmc_blk_reset(md, card->host, type))
923 goto retry; 944 goto retry;
924 if (!err) 945 if (!err)
925 mmc_blk_reset_success(md, type); 946 mmc_blk_reset_success(md, type);
947out:
926 spin_lock_irq(&md->lock); 948 spin_lock_irq(&md->lock);
927 __blk_end_request(req, err, blk_rq_bytes(req)); 949 __blk_end_request(req, err, blk_rq_bytes(req));
928 spin_unlock_irq(&md->lock); 950 spin_unlock_irq(&md->lock);
@@ -1802,7 +1824,7 @@ static void mmc_blk_remove(struct mmc_card *card)
1802} 1824}
1803 1825
1804#ifdef CONFIG_PM 1826#ifdef CONFIG_PM
1805static int mmc_blk_suspend(struct mmc_card *card, pm_message_t state) 1827static int mmc_blk_suspend(struct mmc_card *card)
1806{ 1828{
1807 struct mmc_blk_data *part_md; 1829 struct mmc_blk_data *part_md;
1808 struct mmc_blk_data *md = mmc_get_drvdata(card); 1830 struct mmc_blk_data *md = mmc_get_drvdata(card);
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 2517547b4366..996f8e36e23d 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -139,7 +139,7 @@ static void mmc_queue_setup_discard(struct request_queue *q,
139 139
140 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); 140 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
141 q->limits.max_discard_sectors = max_discard; 141 q->limits.max_discard_sectors = max_discard;
142 if (card->erased_byte == 0) 142 if (card->erased_byte == 0 && !mmc_can_discard(card))
143 q->limits.discard_zeroes_data = 1; 143 q->limits.discard_zeroes_data = 1;
144 q->limits.discard_granularity = card->pref_erase << 9; 144 q->limits.discard_granularity = card->pref_erase << 9;
145 /* granularity must not be greater than max. discard */ 145 /* granularity must not be greater than max. discard */
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 3f606068d552..c60cee92a2b2 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -122,14 +122,14 @@ static int mmc_bus_remove(struct device *dev)
122 return 0; 122 return 0;
123} 123}
124 124
125static int mmc_bus_suspend(struct device *dev, pm_message_t state) 125static int mmc_bus_suspend(struct device *dev)
126{ 126{
127 struct mmc_driver *drv = to_mmc_driver(dev->driver); 127 struct mmc_driver *drv = to_mmc_driver(dev->driver);
128 struct mmc_card *card = mmc_dev_to_card(dev); 128 struct mmc_card *card = mmc_dev_to_card(dev);
129 int ret = 0; 129 int ret = 0;
130 130
131 if (dev->driver && drv->suspend) 131 if (dev->driver && drv->suspend)
132 ret = drv->suspend(card, state); 132 ret = drv->suspend(card);
133 return ret; 133 return ret;
134} 134}
135 135
@@ -165,20 +165,14 @@ static int mmc_runtime_idle(struct device *dev)
165 return pm_runtime_suspend(dev); 165 return pm_runtime_suspend(dev);
166} 166}
167 167
168#endif /* !CONFIG_PM_RUNTIME */
169
168static const struct dev_pm_ops mmc_bus_pm_ops = { 170static const struct dev_pm_ops mmc_bus_pm_ops = {
169 .runtime_suspend = mmc_runtime_suspend, 171 SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume,
170 .runtime_resume = mmc_runtime_resume, 172 mmc_runtime_idle)
171 .runtime_idle = mmc_runtime_idle, 173 SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_suspend, mmc_bus_resume)
172}; 174};
173 175
174#define MMC_PM_OPS_PTR (&mmc_bus_pm_ops)
175
176#else /* !CONFIG_PM_RUNTIME */
177
178#define MMC_PM_OPS_PTR NULL
179
180#endif /* !CONFIG_PM_RUNTIME */
181
182static struct bus_type mmc_bus_type = { 176static struct bus_type mmc_bus_type = {
183 .name = "mmc", 177 .name = "mmc",
184 .dev_attrs = mmc_dev_attrs, 178 .dev_attrs = mmc_dev_attrs,
@@ -186,9 +180,7 @@ static struct bus_type mmc_bus_type = {
186 .uevent = mmc_bus_uevent, 180 .uevent = mmc_bus_uevent,
187 .probe = mmc_bus_probe, 181 .probe = mmc_bus_probe,
188 .remove = mmc_bus_remove, 182 .remove = mmc_bus_remove,
189 .suspend = mmc_bus_suspend, 183 .pm = &mmc_bus_pm_ops,
190 .resume = mmc_bus_resume,
191 .pm = MMC_PM_OPS_PTR,
192}; 184};
193 185
194int mmc_register_bus(void) 186int mmc_register_bus(void)
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c
index 29de31e260dd..2c14be73254c 100644
--- a/drivers/mmc/core/cd-gpio.c
+++ b/drivers/mmc/core/cd-gpio.c
@@ -12,6 +12,7 @@
12#include <linux/gpio.h> 12#include <linux/gpio.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/jiffies.h> 14#include <linux/jiffies.h>
15#include <linux/mmc/cd-gpio.h>
15#include <linux/mmc/host.h> 16#include <linux/mmc/host.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/slab.h> 18#include <linux/slab.h>
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 7474c47b9c08..ba821fe70bca 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1409,7 +1409,10 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
1409{ 1409{
1410 unsigned int erase_timeout; 1410 unsigned int erase_timeout;
1411 1411
1412 if (card->ext_csd.erase_group_def & 1) { 1412 if (arg == MMC_DISCARD_ARG ||
1413 (arg == MMC_TRIM_ARG && card->ext_csd.rev >= 6)) {
1414 erase_timeout = card->ext_csd.trim_timeout;
1415 } else if (card->ext_csd.erase_group_def & 1) {
1413 /* High Capacity Erase Group Size uses HC timeouts */ 1416 /* High Capacity Erase Group Size uses HC timeouts */
1414 if (arg == MMC_TRIM_ARG) 1417 if (arg == MMC_TRIM_ARG)
1415 erase_timeout = card->ext_csd.trim_timeout; 1418 erase_timeout = card->ext_csd.trim_timeout;
@@ -1681,8 +1684,6 @@ int mmc_can_trim(struct mmc_card *card)
1681{ 1684{
1682 if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) 1685 if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN)
1683 return 1; 1686 return 1;
1684 if (mmc_can_discard(card))
1685 return 1;
1686 return 0; 1687 return 0;
1687} 1688}
1688EXPORT_SYMBOL(mmc_can_trim); 1689EXPORT_SYMBOL(mmc_can_trim);
@@ -1701,6 +1702,8 @@ EXPORT_SYMBOL(mmc_can_discard);
1701 1702
1702int mmc_can_sanitize(struct mmc_card *card) 1703int mmc_can_sanitize(struct mmc_card *card)
1703{ 1704{
1705 if (!mmc_can_trim(card) && !mmc_can_erase(card))
1706 return 0;
1704 if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) 1707 if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE)
1705 return 1; 1708 return 1;
1706 return 0; 1709 return 0;
@@ -2235,6 +2238,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
2235 mmc_card_is_removable(host)) 2238 mmc_card_is_removable(host))
2236 return err; 2239 return err;
2237 2240
2241 mmc_claim_host(host);
2238 if (card && mmc_card_mmc(card) && 2242 if (card && mmc_card_mmc(card) &&
2239 (card->ext_csd.cache_size > 0)) { 2243 (card->ext_csd.cache_size > 0)) {
2240 enable = !!enable; 2244 enable = !!enable;
@@ -2252,6 +2256,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
2252 card->ext_csd.cache_ctrl = enable; 2256 card->ext_csd.cache_ctrl = enable;
2253 } 2257 }
2254 } 2258 }
2259 mmc_release_host(host);
2255 2260
2256 return err; 2261 return err;
2257} 2262}
@@ -2269,49 +2274,32 @@ int mmc_suspend_host(struct mmc_host *host)
2269 2274
2270 cancel_delayed_work(&host->detect); 2275 cancel_delayed_work(&host->detect);
2271 mmc_flush_scheduled_work(); 2276 mmc_flush_scheduled_work();
2272 if (mmc_try_claim_host(host)) {
2273 err = mmc_cache_ctrl(host, 0);
2274 mmc_release_host(host);
2275 } else {
2276 err = -EBUSY;
2277 }
2278 2277
2278 err = mmc_cache_ctrl(host, 0);
2279 if (err) 2279 if (err)
2280 goto out; 2280 goto out;
2281 2281
2282 mmc_bus_get(host); 2282 mmc_bus_get(host);
2283 if (host->bus_ops && !host->bus_dead) { 2283 if (host->bus_ops && !host->bus_dead) {
2284 2284
2285 /* 2285 if (host->bus_ops->suspend)
2286 * A long response time is not acceptable for device drivers 2286 err = host->bus_ops->suspend(host);
2287 * when doing suspend. Prevent mmc_claim_host in the suspend
2288 * sequence, to potentially wait "forever" by trying to
2289 * pre-claim the host.
2290 */
2291 if (mmc_try_claim_host(host)) {
2292 if (host->bus_ops->suspend) {
2293 err = host->bus_ops->suspend(host);
2294 }
2295 mmc_release_host(host);
2296 2287
2297 if (err == -ENOSYS || !host->bus_ops->resume) { 2288 if (err == -ENOSYS || !host->bus_ops->resume) {
2298 /* 2289 /*
2299 * We simply "remove" the card in this case. 2290 * We simply "remove" the card in this case.
2300 * It will be redetected on resume. (Calling 2291 * It will be redetected on resume. (Calling
2301 * bus_ops->remove() with a claimed host can 2292 * bus_ops->remove() with a claimed host can
2302 * deadlock.) 2293 * deadlock.)
2303 */ 2294 */
2304 if (host->bus_ops->remove) 2295 if (host->bus_ops->remove)
2305 host->bus_ops->remove(host); 2296 host->bus_ops->remove(host);
2306 mmc_claim_host(host); 2297 mmc_claim_host(host);
2307 mmc_detach_bus(host); 2298 mmc_detach_bus(host);
2308 mmc_power_off(host); 2299 mmc_power_off(host);
2309 mmc_release_host(host); 2300 mmc_release_host(host);
2310 host->pm_flags = 0; 2301 host->pm_flags = 0;
2311 err = 0; 2302 err = 0;
2312 }
2313 } else {
2314 err = -EBUSY;
2315 } 2303 }
2316 } 2304 }
2317 mmc_bus_put(host); 2305 mmc_bus_put(host);
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index bf3c9b456aaf..ab3fc4617107 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -526,8 +526,10 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
526 return -ENODEV; 526 return -ENODEV;
527 527
528 sg_len = dw_mci_pre_dma_transfer(host, data, 0); 528 sg_len = dw_mci_pre_dma_transfer(host, data, 0);
529 if (sg_len < 0) 529 if (sg_len < 0) {
530 host->dma_ops->stop(host);
530 return sg_len; 531 return sg_len;
532 }
531 533
532 host->using_dma = 1; 534 host->using_dma = 1;
533 535
@@ -1879,7 +1881,8 @@ static void dw_mci_init_dma(struct dw_mci *host)
1879 if (!host->dma_ops) 1881 if (!host->dma_ops)
1880 goto no_dma; 1882 goto no_dma;
1881 1883
1882 if (host->dma_ops->init) { 1884 if (host->dma_ops->init && host->dma_ops->start &&
1885 host->dma_ops->stop && host->dma_ops->cleanup) {
1883 if (host->dma_ops->init(host)) { 1886 if (host->dma_ops->init(host)) {
1884 dev_err(&host->dev, "%s: Unable to initialize " 1887 dev_err(&host->dev, "%s: Unable to initialize "
1885 "DMA Controller.\n", __func__); 1888 "DMA Controller.\n", __func__);
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5c2b1c10af9c..56d4499d4388 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -249,7 +249,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
249 * the pbias cell programming support is still missing when 249 * the pbias cell programming support is still missing when
250 * booting with Device tree 250 * booting with Device tree
251 */ 251 */
252 if (of_have_populated_dt() && !vdd) 252 if (dev->of_node && !vdd)
253 return 0; 253 return 0;
254 254
255 if (mmc_slot(host).before_set_reg) 255 if (mmc_slot(host).before_set_reg)
@@ -1549,7 +1549,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1549 * can't be allowed when booting with device 1549 * can't be allowed when booting with device
1550 * tree. 1550 * tree.
1551 */ 1551 */
1552 (!of_have_populated_dt())) { 1552 !host->dev->of_node) {
1553 /* 1553 /*
1554 * The mmc_select_voltage fn of the core does 1554 * The mmc_select_voltage fn of the core does
1555 * not seem to set the power_mode to 1555 * not seem to set the power_mode to
@@ -1741,7 +1741,7 @@ static const struct of_device_id omap_mmc_of_match[] = {
1741 .data = &omap4_reg_offset, 1741 .data = &omap4_reg_offset,
1742 }, 1742 },
1743 {}, 1743 {},
1744} 1744};
1745MODULE_DEVICE_TABLE(of, omap_mmc_of_match); 1745MODULE_DEVICE_TABLE(of, omap_mmc_of_match);
1746 1746
1747static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) 1747static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 6193a0d7bde5..8abdaf6697a8 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -467,8 +467,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
467 clk_prepare_enable(clk); 467 clk_prepare_enable(clk);
468 pltfm_host->clk = clk; 468 pltfm_host->clk = clk;
469 469
470 if (!is_imx25_esdhc(imx_data)) 470 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
471 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
472 471
473 if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) 472 if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data))
474 /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ 473 /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9aa77f3f04a8..ccefdebeff14 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -147,7 +147,7 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
147 u32 present, irqs; 147 u32 present, irqs;
148 148
149 if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || 149 if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
150 !mmc_card_is_removable(host->mmc)) 150 (host->mmc->caps & MMC_CAP_NONREMOVABLE))
151 return; 151 return;
152 152
153 present = sdhci_readl(host, SDHCI_PRESENT_STATE) & 153 present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 6dfc26d85e47..52deec0b22ea 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -40,6 +40,7 @@
40#include <linux/skbuff.h> 40#include <linux/skbuff.h>
41#include <linux/phy.h> 41#include <linux/phy.h>
42#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
43#include <linux/of.h>
43#include <linux/of_net.h> 44#include <linux/of_net.h>
44#include <linux/types.h> 45#include <linux/types.h>
45 46
@@ -340,13 +341,17 @@
340 */ 341 */
341#define LPC_POWERDOWN_MACAHB (1 << 31) 342#define LPC_POWERDOWN_MACAHB (1 << 31)
342 343
343/* Upon the upcoming introduction of device tree usage in LPC32xx, 344static phy_interface_t lpc_phy_interface_mode(struct device *dev)
344 * lpc_phy_interface_mode() and use_iram_for_net() will be extended with a
345 * device parameter for access to device tree information at runtime, instead
346 * of defining the values at compile time
347 */
348static inline phy_interface_t lpc_phy_interface_mode(void)
349{ 345{
346 if (dev && dev->of_node) {
347 const char *mode = of_get_property(dev->of_node,
348 "phy-mode", NULL);
349 if (mode && !strcmp(mode, "mii"))
350 return PHY_INTERFACE_MODE_MII;
351 return PHY_INTERFACE_MODE_RMII;
352 }
353
354 /* non-DT */
350#ifdef CONFIG_ARCH_LPC32XX_MII_SUPPORT 355#ifdef CONFIG_ARCH_LPC32XX_MII_SUPPORT
351 return PHY_INTERFACE_MODE_MII; 356 return PHY_INTERFACE_MODE_MII;
352#else 357#else
@@ -354,12 +359,16 @@ static inline phy_interface_t lpc_phy_interface_mode(void)
354#endif 359#endif
355} 360}
356 361
357static inline int use_iram_for_net(void) 362static bool use_iram_for_net(struct device *dev)
358{ 363{
364 if (dev && dev->of_node)
365 return of_property_read_bool(dev->of_node, "use-iram");
366
367 /* non-DT */
359#ifdef CONFIG_ARCH_LPC32XX_IRAM_FOR_NET 368#ifdef CONFIG_ARCH_LPC32XX_IRAM_FOR_NET
360 return 1; 369 return true;
361#else 370#else
362 return 0; 371 return false;
363#endif 372#endif
364} 373}
365 374
@@ -664,7 +673,7 @@ static void __lpc_eth_init(struct netdata_local *pldat)
664 LPC_ENET_CLRT(pldat->net_base)); 673 LPC_ENET_CLRT(pldat->net_base));
665 writel(LPC_IPGR_LOAD_PART2(0x12), LPC_ENET_IPGR(pldat->net_base)); 674 writel(LPC_IPGR_LOAD_PART2(0x12), LPC_ENET_IPGR(pldat->net_base));
666 675
667 if (lpc_phy_interface_mode() == PHY_INTERFACE_MODE_MII) 676 if (lpc_phy_interface_mode(&pldat->pdev->dev) == PHY_INTERFACE_MODE_MII)
668 writel(LPC_COMMAND_PASSRUNTFRAME, 677 writel(LPC_COMMAND_PASSRUNTFRAME,
669 LPC_ENET_COMMAND(pldat->net_base)); 678 LPC_ENET_COMMAND(pldat->net_base));
670 else { 679 else {
@@ -804,12 +813,13 @@ static int lpc_mii_probe(struct net_device *ndev)
804 } 813 }
805 814
806 /* Attach to the PHY */ 815 /* Attach to the PHY */
807 if (lpc_phy_interface_mode() == PHY_INTERFACE_MODE_MII) 816 if (lpc_phy_interface_mode(&pldat->pdev->dev) == PHY_INTERFACE_MODE_MII)
808 netdev_info(ndev, "using MII interface\n"); 817 netdev_info(ndev, "using MII interface\n");
809 else 818 else
810 netdev_info(ndev, "using RMII interface\n"); 819 netdev_info(ndev, "using RMII interface\n");
811 phydev = phy_connect(ndev, dev_name(&phydev->dev), 820 phydev = phy_connect(ndev, dev_name(&phydev->dev),
812 &lpc_handle_link_change, 0, lpc_phy_interface_mode()); 821 &lpc_handle_link_change, 0,
822 lpc_phy_interface_mode(&pldat->pdev->dev));
813 823
814 if (IS_ERR(phydev)) { 824 if (IS_ERR(phydev)) {
815 netdev_err(ndev, "Could not attach to PHY\n"); 825 netdev_err(ndev, "Could not attach to PHY\n");
@@ -843,7 +853,7 @@ static int lpc_mii_init(struct netdata_local *pldat)
843 } 853 }
844 854
845 /* Setup MII mode */ 855 /* Setup MII mode */
846 if (lpc_phy_interface_mode() == PHY_INTERFACE_MODE_MII) 856 if (lpc_phy_interface_mode(&pldat->pdev->dev) == PHY_INTERFACE_MODE_MII)
847 writel(LPC_COMMAND_PASSRUNTFRAME, 857 writel(LPC_COMMAND_PASSRUNTFRAME,
848 LPC_ENET_COMMAND(pldat->net_base)); 858 LPC_ENET_COMMAND(pldat->net_base));
849 else { 859 else {
@@ -1315,18 +1325,26 @@ static const struct net_device_ops lpc_netdev_ops = {
1315static int lpc_eth_drv_probe(struct platform_device *pdev) 1325static int lpc_eth_drv_probe(struct platform_device *pdev)
1316{ 1326{
1317 struct resource *res; 1327 struct resource *res;
1318 struct resource *dma_res;
1319 struct net_device *ndev; 1328 struct net_device *ndev;
1320 struct netdata_local *pldat; 1329 struct netdata_local *pldat;
1321 struct phy_device *phydev; 1330 struct phy_device *phydev;
1322 dma_addr_t dma_handle; 1331 dma_addr_t dma_handle;
1323 int irq, ret; 1332 int irq, ret;
1333 u32 tmp;
1334
1335 /* Setup network interface for RMII or MII mode */
1336 tmp = __raw_readl(LPC32XX_CLKPWR_MACCLK_CTRL);
1337 tmp &= ~LPC32XX_CLKPWR_MACCTRL_PINS_MSK;
1338 if (lpc_phy_interface_mode(&pdev->dev) == PHY_INTERFACE_MODE_MII)
1339 tmp |= LPC32XX_CLKPWR_MACCTRL_USE_MII_PINS;
1340 else
1341 tmp |= LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS;
1342 __raw_writel(tmp, LPC32XX_CLKPWR_MACCLK_CTRL);
1324 1343
1325 /* Get platform resources */ 1344 /* Get platform resources */
1326 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1345 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1327 dma_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1328 irq = platform_get_irq(pdev, 0); 1346 irq = platform_get_irq(pdev, 0);
1329 if ((!res) || (!dma_res) || (irq < 0) || (irq >= NR_IRQS)) { 1347 if ((!res) || (irq < 0) || (irq >= NR_IRQS)) {
1330 dev_err(&pdev->dev, "error getting resources.\n"); 1348 dev_err(&pdev->dev, "error getting resources.\n");
1331 ret = -ENXIO; 1349 ret = -ENXIO;
1332 goto err_exit; 1350 goto err_exit;
@@ -1389,17 +1407,19 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
1389 sizeof(struct txrx_desc_t) + sizeof(struct rx_status_t)); 1407 sizeof(struct txrx_desc_t) + sizeof(struct rx_status_t));
1390 pldat->dma_buff_base_v = 0; 1408 pldat->dma_buff_base_v = 0;
1391 1409
1392 if (use_iram_for_net()) { 1410 if (use_iram_for_net(&pldat->pdev->dev)) {
1393 dma_handle = dma_res->start; 1411 dma_handle = LPC32XX_IRAM_BASE;
1394 if (pldat->dma_buff_size <= lpc32xx_return_iram_size()) 1412 if (pldat->dma_buff_size <= lpc32xx_return_iram_size())
1395 pldat->dma_buff_base_v = 1413 pldat->dma_buff_base_v =
1396 io_p2v(dma_res->start); 1414 io_p2v(LPC32XX_IRAM_BASE);
1397 else 1415 else
1398 netdev_err(ndev, 1416 netdev_err(ndev,
1399 "IRAM not big enough for net buffers, using SDRAM instead.\n"); 1417 "IRAM not big enough for net buffers, using SDRAM instead.\n");
1400 } 1418 }
1401 1419
1402 if (pldat->dma_buff_base_v == 0) { 1420 if (pldat->dma_buff_base_v == 0) {
1421 pldat->pdev->dev.coherent_dma_mask = 0xFFFFFFFF;
1422 pldat->pdev->dev.dma_mask = &pldat->pdev->dev.coherent_dma_mask;
1403 pldat->dma_buff_size = PAGE_ALIGN(pldat->dma_buff_size); 1423 pldat->dma_buff_size = PAGE_ALIGN(pldat->dma_buff_size);
1404 1424
1405 /* Allocate a chunk of memory for the DMA ethernet buffers 1425 /* Allocate a chunk of memory for the DMA ethernet buffers
@@ -1488,7 +1508,7 @@ err_out_unregister_netdev:
1488 platform_set_drvdata(pdev, NULL); 1508 platform_set_drvdata(pdev, NULL);
1489 unregister_netdev(ndev); 1509 unregister_netdev(ndev);
1490err_out_dma_unmap: 1510err_out_dma_unmap:
1491 if (!use_iram_for_net() || 1511 if (!use_iram_for_net(&pldat->pdev->dev) ||
1492 pldat->dma_buff_size > lpc32xx_return_iram_size()) 1512 pldat->dma_buff_size > lpc32xx_return_iram_size())
1493 dma_free_coherent(&pldat->pdev->dev, pldat->dma_buff_size, 1513 dma_free_coherent(&pldat->pdev->dev, pldat->dma_buff_size,
1494 pldat->dma_buff_base_v, 1514 pldat->dma_buff_base_v,
@@ -1515,7 +1535,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev)
1515 unregister_netdev(ndev); 1535 unregister_netdev(ndev);
1516 platform_set_drvdata(pdev, NULL); 1536 platform_set_drvdata(pdev, NULL);
1517 1537
1518 if (!use_iram_for_net() || 1538 if (!use_iram_for_net(&pldat->pdev->dev) ||
1519 pldat->dma_buff_size > lpc32xx_return_iram_size()) 1539 pldat->dma_buff_size > lpc32xx_return_iram_size())
1520 dma_free_coherent(&pldat->pdev->dev, pldat->dma_buff_size, 1540 dma_free_coherent(&pldat->pdev->dev, pldat->dma_buff_size,
1521 pldat->dma_buff_base_v, 1541 pldat->dma_buff_base_v,
@@ -1584,6 +1604,14 @@ static int lpc_eth_drv_resume(struct platform_device *pdev)
1584} 1604}
1585#endif 1605#endif
1586 1606
1607#ifdef CONFIG_OF
1608static const struct of_device_id lpc_eth_match[] = {
1609 { .compatible = "nxp,lpc-eth" },
1610 { }
1611};
1612MODULE_DEVICE_TABLE(of, lpc_eth_match);
1613#endif
1614
1587static struct platform_driver lpc_eth_driver = { 1615static struct platform_driver lpc_eth_driver = {
1588 .probe = lpc_eth_drv_probe, 1616 .probe = lpc_eth_drv_probe,
1589 .remove = __devexit_p(lpc_eth_drv_remove), 1617 .remove = __devexit_p(lpc_eth_drv_remove),
@@ -1593,6 +1621,7 @@ static struct platform_driver lpc_eth_driver = {
1593#endif 1621#endif
1594 .driver = { 1622 .driver = {
1595 .name = MODNAME, 1623 .name = MODNAME,
1624 .of_match_table = of_match_ptr(lpc_eth_match),
1596 }, 1625 },
1597}; 1626};
1598 1627
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 66d96f14c274..7e262a6124c5 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -1,4 +1,5 @@
1 1
2#include <linux/device.h>
2#include <linux/io.h> 3#include <linux/io.h>
3#include <linux/ioport.h> 4#include <linux/ioport.h>
4#include <linux/module.h> 5#include <linux/module.h>
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d20f1334792b..111569ccab43 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -991,8 +991,8 @@ static void pci_restore_config_dword(struct pci_dev *pdev, int offset,
991 } 991 }
992} 992}
993 993
994static void pci_restore_config_space(struct pci_dev *pdev, int start, int end, 994static void pci_restore_config_space_range(struct pci_dev *pdev,
995 int retry) 995 int start, int end, int retry)
996{ 996{
997 int index; 997 int index;
998 998
@@ -1002,6 +1002,18 @@ static void pci_restore_config_space(struct pci_dev *pdev, int start, int end,
1002 retry); 1002 retry);
1003} 1003}
1004 1004
1005static void pci_restore_config_space(struct pci_dev *pdev)
1006{
1007 if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
1008 pci_restore_config_space_range(pdev, 10, 15, 0);
1009 /* Restore BARs before the command register. */
1010 pci_restore_config_space_range(pdev, 4, 9, 10);
1011 pci_restore_config_space_range(pdev, 0, 3, 0);
1012 } else {
1013 pci_restore_config_space_range(pdev, 0, 15, 0);
1014 }
1015}
1016
1005/** 1017/**
1006 * pci_restore_state - Restore the saved state of a PCI device 1018 * pci_restore_state - Restore the saved state of a PCI device
1007 * @dev: - PCI device that we're dealing with 1019 * @dev: - PCI device that we're dealing with
@@ -1015,13 +1027,7 @@ void pci_restore_state(struct pci_dev *dev)
1015 pci_restore_pcie_state(dev); 1027 pci_restore_pcie_state(dev);
1016 pci_restore_ats_state(dev); 1028 pci_restore_ats_state(dev);
1017 1029
1018 pci_restore_config_space(dev, 10, 15, 0); 1030 pci_restore_config_space(dev);
1019 /*
1020 * The Base Address register should be programmed before the command
1021 * register(s)
1022 */
1023 pci_restore_config_space(dev, 4, 9, 10);
1024 pci_restore_config_space(dev, 0, 3, 0);
1025 1031
1026 pci_restore_pcix_state(dev); 1032 pci_restore_pcix_state(dev);
1027 pci_restore_msi_state(dev); 1033 pci_restore_msi_state(dev);
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index ec3b8cc188af..df6296c5f47b 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -908,10 +908,6 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
908 const struct pinctrl_ops *ops = pctldev->desc->pctlops; 908 const struct pinctrl_ops *ops = pctldev->desc->pctlops;
909 unsigned selector = 0; 909 unsigned selector = 0;
910 910
911 /* No grouping */
912 if (!ops)
913 return 0;
914
915 mutex_lock(&pinctrl_mutex); 911 mutex_lock(&pinctrl_mutex);
916 912
917 seq_puts(s, "registered pin groups:\n"); 913 seq_puts(s, "registered pin groups:\n");
@@ -1225,6 +1221,19 @@ static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev)
1225 1221
1226#endif 1222#endif
1227 1223
1224static int pinctrl_check_ops(struct pinctrl_dev *pctldev)
1225{
1226 const struct pinctrl_ops *ops = pctldev->desc->pctlops;
1227
1228 if (!ops ||
1229 !ops->list_groups ||
1230 !ops->get_group_name ||
1231 !ops->get_group_pins)
1232 return -EINVAL;
1233
1234 return 0;
1235}
1236
1228/** 1237/**
1229 * pinctrl_register() - register a pin controller device 1238 * pinctrl_register() - register a pin controller device
1230 * @pctldesc: descriptor for this pin controller 1239 * @pctldesc: descriptor for this pin controller
@@ -1256,6 +1265,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
1256 INIT_LIST_HEAD(&pctldev->gpio_ranges); 1265 INIT_LIST_HEAD(&pctldev->gpio_ranges);
1257 pctldev->dev = dev; 1266 pctldev->dev = dev;
1258 1267
1268 /* check core ops for sanity */
1269 ret = pinctrl_check_ops(pctldev);
1270 if (ret) {
1271 pr_err("%s pinctrl ops lacks necessary functions\n",
1272 pctldesc->name);
1273 goto out_err;
1274 }
1275
1259 /* If we're implementing pinmuxing, check the ops for sanity */ 1276 /* If we're implementing pinmuxing, check the ops for sanity */
1260 if (pctldesc->pmxops) { 1277 if (pctldesc->pmxops) {
1261 ret = pinmux_check_ops(pctldev); 1278 ret = pinmux_check_ops(pctldev);
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index c21871a4e73d..bc2e8a7c265b 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -2844,6 +2844,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2844 sector_t recid, trkid; 2844 sector_t recid, trkid;
2845 unsigned int offs; 2845 unsigned int offs;
2846 unsigned int count, count_to_trk_end; 2846 unsigned int count, count_to_trk_end;
2847 int ret;
2847 2848
2848 basedev = block->base; 2849 basedev = block->base;
2849 if (rq_data_dir(req) == READ) { 2850 if (rq_data_dir(req) == READ) {
@@ -2884,8 +2885,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2884 2885
2885 itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); 2886 itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0);
2886 if (IS_ERR(itcw)) { 2887 if (IS_ERR(itcw)) {
2887 dasd_sfree_request(cqr, startdev); 2888 ret = -EINVAL;
2888 return ERR_PTR(-EINVAL); 2889 goto out_error;
2889 } 2890 }
2890 cqr->cpaddr = itcw_get_tcw(itcw); 2891 cqr->cpaddr = itcw_get_tcw(itcw);
2891 if (prepare_itcw(itcw, first_trk, last_trk, 2892 if (prepare_itcw(itcw, first_trk, last_trk,
@@ -2897,8 +2898,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2897 /* Clock not in sync and XRC is enabled. 2898 /* Clock not in sync and XRC is enabled.
2898 * Try again later. 2899 * Try again later.
2899 */ 2900 */
2900 dasd_sfree_request(cqr, startdev); 2901 ret = -EAGAIN;
2901 return ERR_PTR(-EAGAIN); 2902 goto out_error;
2902 } 2903 }
2903 len_to_track_end = 0; 2904 len_to_track_end = 0;
2904 /* 2905 /*
@@ -2937,8 +2938,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2937 tidaw_flags = 0; 2938 tidaw_flags = 0;
2938 last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, 2939 last_tidaw = itcw_add_tidaw(itcw, tidaw_flags,
2939 dst, part_len); 2940 dst, part_len);
2940 if (IS_ERR(last_tidaw)) 2941 if (IS_ERR(last_tidaw)) {
2941 return ERR_PTR(-EINVAL); 2942 ret = -EINVAL;
2943 goto out_error;
2944 }
2942 dst += part_len; 2945 dst += part_len;
2943 } 2946 }
2944 } 2947 }
@@ -2947,8 +2950,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2947 dst = page_address(bv->bv_page) + bv->bv_offset; 2950 dst = page_address(bv->bv_page) + bv->bv_offset;
2948 last_tidaw = itcw_add_tidaw(itcw, 0x00, 2951 last_tidaw = itcw_add_tidaw(itcw, 0x00,
2949 dst, bv->bv_len); 2952 dst, bv->bv_len);
2950 if (IS_ERR(last_tidaw)) 2953 if (IS_ERR(last_tidaw)) {
2951 return ERR_PTR(-EINVAL); 2954 ret = -EINVAL;
2955 goto out_error;
2956 }
2952 } 2957 }
2953 } 2958 }
2954 last_tidaw->flags |= TIDAW_FLAGS_LAST; 2959 last_tidaw->flags |= TIDAW_FLAGS_LAST;
@@ -2968,6 +2973,9 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2968 cqr->buildclk = get_clock(); 2973 cqr->buildclk = get_clock();
2969 cqr->status = DASD_CQR_FILLED; 2974 cqr->status = DASD_CQR_FILLED;
2970 return cqr; 2975 return cqr;
2976out_error:
2977 dasd_sfree_request(cqr, startdev);
2978 return ERR_PTR(ret);
2971} 2979}
2972 2980
2973static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, 2981static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev,
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 85f4a9a5d12e..73bef0bd394c 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -903,7 +903,7 @@ static int ur_set_online(struct ccw_device *cdev)
903 goto fail_urdev_put; 903 goto fail_urdev_put;
904 } 904 }
905 905
906 cdev_init(urd->char_device, &ur_fops); 906 urd->char_device->ops = &ur_fops;
907 urd->char_device->dev = MKDEV(major, minor); 907 urd->char_device->dev = MKDEV(major, minor);
908 urd->char_device->owner = ur_fops.owner; 908 urd->char_device->owner = ur_fops.owner;
909 909
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 24145c30c9b0..6cc4358f68c1 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1073,8 +1073,10 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
1073 (new_serial.close_delay != port->close_delay) || 1073 (new_serial.close_delay != port->close_delay) ||
1074 (new_serial.xmit_fifo_size != state->xmit_fifo_size) || 1074 (new_serial.xmit_fifo_size != state->xmit_fifo_size) ||
1075 ((new_serial.flags & ~ASYNC_USR_MASK) != 1075 ((new_serial.flags & ~ASYNC_USR_MASK) !=
1076 (port->flags & ~ASYNC_USR_MASK))) 1076 (port->flags & ~ASYNC_USR_MASK))) {
1077 tty_unlock();
1077 return -EPERM; 1078 return -EPERM;
1079 }
1078 port->flags = ((port->flags & ~ASYNC_USR_MASK) | 1080 port->flags = ((port->flags & ~ASYNC_USR_MASK) |
1079 (new_serial.flags & ASYNC_USR_MASK)); 1081 (new_serial.flags & ASYNC_USR_MASK));
1080 state->custom_divisor = new_serial.custom_divisor; 1082 state->custom_divisor = new_serial.custom_divisor;
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c
index e6c3dbd781d6..836fe2731234 100644
--- a/drivers/tty/serial/clps711x.c
+++ b/drivers/tty/serial/clps711x.c
@@ -154,10 +154,9 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
154 port->x_char = 0; 154 port->x_char = 0;
155 return IRQ_HANDLED; 155 return IRQ_HANDLED;
156 } 156 }
157 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { 157
158 clps711xuart_stop_tx(port); 158 if (uart_circ_empty(xmit) || uart_tx_stopped(port))
159 return IRQ_HANDLED; 159 goto disable_tx_irq;
160 }
161 160
162 count = port->fifosize >> 1; 161 count = port->fifosize >> 1;
163 do { 162 do {
@@ -171,8 +170,11 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
171 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 170 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
172 uart_write_wakeup(port); 171 uart_write_wakeup(port);
173 172
174 if (uart_circ_empty(xmit)) 173 if (uart_circ_empty(xmit)) {
175 clps711xuart_stop_tx(port); 174 disable_tx_irq:
175 disable_irq_nosync(TX_IRQ(port));
176 tx_enabled(port) = 0;
177 }
176 178
177 return IRQ_HANDLED; 179 return IRQ_HANDLED;
178} 180}
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index bbbec4a74cfb..c2816f494807 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1447,9 +1447,11 @@ static int pch_uart_verify_port(struct uart_port *port,
1447 __func__); 1447 __func__);
1448 return -EOPNOTSUPP; 1448 return -EOPNOTSUPP;
1449#endif 1449#endif
1450 priv->use_dma = 1;
1451 priv->use_dma_flag = 1; 1450 priv->use_dma_flag = 1;
1452 dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); 1451 dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n");
1452 if (!priv->use_dma)
1453 pch_request_dma(port);
1454 priv->use_dma = 1;
1453 } 1455 }
1454 1456
1455 return 0; 1457 return 0;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a2aa9d652c67..ec6c97dadbe4 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1667,7 +1667,6 @@ void usb_disconnect(struct usb_device **pdev)
1667{ 1667{
1668 struct usb_device *udev = *pdev; 1668 struct usb_device *udev = *pdev;
1669 int i; 1669 int i;
1670 struct usb_hcd *hcd = bus_to_hcd(udev->bus);
1671 1670
1672 /* mark the device as inactive, so any further urb submissions for 1671 /* mark the device as inactive, so any further urb submissions for
1673 * this device (and any of its children) will fail immediately. 1672 * this device (and any of its children) will fail immediately.
@@ -1690,9 +1689,7 @@ void usb_disconnect(struct usb_device **pdev)
1690 * so that the hardware is now fully quiesced. 1689 * so that the hardware is now fully quiesced.
1691 */ 1690 */
1692 dev_dbg (&udev->dev, "unregistering device\n"); 1691 dev_dbg (&udev->dev, "unregistering device\n");
1693 mutex_lock(hcd->bandwidth_mutex);
1694 usb_disable_device(udev, 0); 1692 usb_disable_device(udev, 0);
1695 mutex_unlock(hcd->bandwidth_mutex);
1696 usb_hcd_synchronize_unlinks(udev); 1693 usb_hcd_synchronize_unlinks(udev);
1697 1694
1698 usb_remove_ep_devs(&udev->ep0); 1695 usb_remove_ep_devs(&udev->ep0);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index aed3e07942d4..ca717da3be95 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1136,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf,
1136 * Deallocates hcd/hardware state for the endpoints (nuking all or most 1136 * Deallocates hcd/hardware state for the endpoints (nuking all or most
1137 * pending urbs) and usbcore state for the interfaces, so that usbcore 1137 * pending urbs) and usbcore state for the interfaces, so that usbcore
1138 * must usb_set_configuration() before any interfaces could be used. 1138 * must usb_set_configuration() before any interfaces could be used.
1139 *
1140 * Must be called with hcd->bandwidth_mutex held.
1141 */ 1139 */
1142void usb_disable_device(struct usb_device *dev, int skip_ep0) 1140void usb_disable_device(struct usb_device *dev, int skip_ep0)
1143{ 1141{
@@ -1190,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1190 usb_disable_endpoint(dev, i + USB_DIR_IN, false); 1188 usb_disable_endpoint(dev, i + USB_DIR_IN, false);
1191 } 1189 }
1192 /* Remove endpoints from the host controller internal state */ 1190 /* Remove endpoints from the host controller internal state */
1191 mutex_lock(hcd->bandwidth_mutex);
1193 usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); 1192 usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
1193 mutex_unlock(hcd->bandwidth_mutex);
1194 /* Second pass: remove endpoint pointers */ 1194 /* Second pass: remove endpoint pointers */
1195 } 1195 }
1196 for (i = skip_ep0; i < 16; ++i) { 1196 for (i = skip_ep0; i < 16; ++i) {
@@ -1750,7 +1750,6 @@ free_interfaces:
1750 /* if it's already configured, clear out old state first. 1750 /* if it's already configured, clear out old state first.
1751 * getting rid of old interfaces means unbinding their drivers. 1751 * getting rid of old interfaces means unbinding their drivers.
1752 */ 1752 */
1753 mutex_lock(hcd->bandwidth_mutex);
1754 if (dev->state != USB_STATE_ADDRESS) 1753 if (dev->state != USB_STATE_ADDRESS)
1755 usb_disable_device(dev, 1); /* Skip ep0 */ 1754 usb_disable_device(dev, 1); /* Skip ep0 */
1756 1755
@@ -1763,6 +1762,7 @@ free_interfaces:
1763 * host controller will not allow submissions to dropped endpoints. If 1762 * host controller will not allow submissions to dropped endpoints. If
1764 * this call fails, the device state is unchanged. 1763 * this call fails, the device state is unchanged.
1765 */ 1764 */
1765 mutex_lock(hcd->bandwidth_mutex);
1766 ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); 1766 ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL);
1767 if (ret < 0) { 1767 if (ret < 0) {
1768 mutex_unlock(hcd->bandwidth_mutex); 1768 mutex_unlock(hcd->bandwidth_mutex);
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 7bd815a507e8..99b58d84553a 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -206,11 +206,11 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc)
206 206
207 for (i = 0; i < dwc->num_event_buffers; i++) { 207 for (i = 0; i < dwc->num_event_buffers; i++) {
208 evt = dwc->ev_buffs[i]; 208 evt = dwc->ev_buffs[i];
209 if (evt) { 209 if (evt)
210 dwc3_free_one_event_buffer(dwc, evt); 210 dwc3_free_one_event_buffer(dwc, evt);
211 dwc->ev_buffs[i] = NULL;
212 }
213 } 211 }
212
213 kfree(dwc->ev_buffs);
214} 214}
215 215
216/** 216/**
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 25910e251c04..3584a169886f 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -353,6 +353,9 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
353 353
354 dwc->test_mode_nr = wIndex >> 8; 354 dwc->test_mode_nr = wIndex >> 8;
355 dwc->test_mode = true; 355 dwc->test_mode = true;
356 break;
357 default:
358 return -EINVAL;
356 } 359 }
357 break; 360 break;
358 361
@@ -559,15 +562,20 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
559 length = trb->size & DWC3_TRB_SIZE_MASK; 562 length = trb->size & DWC3_TRB_SIZE_MASK;
560 563
561 if (dwc->ep0_bounced) { 564 if (dwc->ep0_bounced) {
565 unsigned transfer_size = ur->length;
566 unsigned maxp = ep0->endpoint.maxpacket;
567
568 transfer_size += (maxp - (transfer_size % maxp));
562 transferred = min_t(u32, ur->length, 569 transferred = min_t(u32, ur->length,
563 ep0->endpoint.maxpacket - length); 570 transfer_size - length);
564 memcpy(ur->buf, dwc->ep0_bounce, transferred); 571 memcpy(ur->buf, dwc->ep0_bounce, transferred);
565 dwc->ep0_bounced = false; 572 dwc->ep0_bounced = false;
566 } else { 573 } else {
567 transferred = ur->length - length; 574 transferred = ur->length - length;
568 ur->actual += transferred;
569 } 575 }
570 576
577 ur->actual += transferred;
578
571 if ((epnum & 1) && ur->actual < ur->length) { 579 if ((epnum & 1) && ur->actual < ur->length) {
572 /* for some reason we did not get everything out */ 580 /* for some reason we did not get everything out */
573 581
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 0c935d7c65bd..9d7bcd910074 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1863,8 +1863,8 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1863 mod_timer(&udc->vbus_timer, 1863 mod_timer(&udc->vbus_timer,
1864 jiffies + VBUS_POLL_TIMEOUT); 1864 jiffies + VBUS_POLL_TIMEOUT);
1865 } else { 1865 } else {
1866 if (request_irq(udc->board.vbus_pin, at91_vbus_irq, 1866 if (request_irq(gpio_to_irq(udc->board.vbus_pin),
1867 0, driver_name, udc)) { 1867 at91_vbus_irq, 0, driver_name, udc)) {
1868 DBG("request vbus irq %d failed\n", 1868 DBG("request vbus irq %d failed\n",
1869 udc->board.vbus_pin); 1869 udc->board.vbus_pin);
1870 retval = -EBUSY; 1870 retval = -EBUSY;
@@ -1886,7 +1886,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1886 return 0; 1886 return 0;
1887fail4: 1887fail4:
1888 if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) 1888 if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled)
1889 free_irq(udc->board.vbus_pin, udc); 1889 free_irq(gpio_to_irq(udc->board.vbus_pin), udc);
1890fail3: 1890fail3:
1891 if (gpio_is_valid(udc->board.vbus_pin)) 1891 if (gpio_is_valid(udc->board.vbus_pin))
1892 gpio_free(udc->board.vbus_pin); 1892 gpio_free(udc->board.vbus_pin);
@@ -1924,7 +1924,7 @@ static int __exit at91udc_remove(struct platform_device *pdev)
1924 device_init_wakeup(&pdev->dev, 0); 1924 device_init_wakeup(&pdev->dev, 0);
1925 remove_debug_file(udc); 1925 remove_debug_file(udc);
1926 if (gpio_is_valid(udc->board.vbus_pin)) { 1926 if (gpio_is_valid(udc->board.vbus_pin)) {
1927 free_irq(udc->board.vbus_pin, udc); 1927 free_irq(gpio_to_irq(udc->board.vbus_pin), udc);
1928 gpio_free(udc->board.vbus_pin); 1928 gpio_free(udc->board.vbus_pin);
1929 } 1929 }
1930 free_irq(udc->udp_irq, udc); 1930 free_irq(udc->udp_irq, udc);
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 1cbba70836bc..f52cb1ae45d9 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
712 if (code == FUNCTIONFS_INTERFACE_REVMAP) { 712 if (code == FUNCTIONFS_INTERFACE_REVMAP) {
713 struct ffs_function *func = ffs->func; 713 struct ffs_function *func = ffs->func;
714 ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; 714 ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;
715 } else if (gadget->ops->ioctl) { 715 } else if (gadget && gadget->ops->ioctl) {
716 ret = gadget->ops->ioctl(gadget, code, value); 716 ret = gadget->ops->ioctl(gadget, code, value);
717 } else { 717 } else {
718 ret = -ENOTTY; 718 ret = -ENOTTY;
@@ -1382,6 +1382,7 @@ static void functionfs_unbind(struct ffs_data *ffs)
1382 ffs->ep0req = NULL; 1382 ffs->ep0req = NULL;
1383 ffs->gadget = NULL; 1383 ffs->gadget = NULL;
1384 ffs_data_put(ffs); 1384 ffs_data_put(ffs);
1385 clear_bit(FFS_FL_BOUND, &ffs->flags);
1385 } 1386 }
1386} 1387}
1387 1388
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c
index 7b1cf18df5e3..52343654f5df 100644
--- a/drivers/usb/gadget/f_rndis.c
+++ b/drivers/usb/gadget/f_rndis.c
@@ -500,6 +500,7 @@ rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
500 if (buf) { 500 if (buf) {
501 memcpy(req->buf, buf, n); 501 memcpy(req->buf, buf, n);
502 req->complete = rndis_response_complete; 502 req->complete = rndis_response_complete;
503 req->context = rndis;
503 rndis_free_response(rndis->config, buf); 504 rndis_free_response(rndis->config, buf);
504 value = n; 505 value = n;
505 } 506 }
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 5f94e79cd6b9..55abfb6bd612 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -730,7 +730,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
730 : (1 << (ep_index(ep))); 730 : (1 << (ep_index(ep)));
731 731
732 /* check if the pipe is empty */ 732 /* check if the pipe is empty */
733 if (!(list_empty(&ep->queue))) { 733 if (!(list_empty(&ep->queue)) && !(ep_index(ep) == 0)) {
734 /* Add td to the end */ 734 /* Add td to the end */
735 struct fsl_req *lastreq; 735 struct fsl_req *lastreq;
736 lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); 736 lastreq = list_entry(ep->queue.prev, struct fsl_req, queue);
@@ -918,10 +918,6 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
918 return -ENOMEM; 918 return -ENOMEM;
919 } 919 }
920 920
921 /* Update ep0 state */
922 if ((ep_index(ep) == 0))
923 udc->ep0_state = DATA_STATE_XMIT;
924
925 /* irq handler advances the queue */ 921 /* irq handler advances the queue */
926 if (req != NULL) 922 if (req != NULL)
927 list_add_tail(&req->queue, &ep->queue); 923 list_add_tail(&req->queue, &ep->queue);
@@ -1279,7 +1275,8 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
1279 udc->ep0_dir = USB_DIR_OUT; 1275 udc->ep0_dir = USB_DIR_OUT;
1280 1276
1281 ep = &udc->eps[0]; 1277 ep = &udc->eps[0];
1282 udc->ep0_state = WAIT_FOR_OUT_STATUS; 1278 if (udc->ep0_state != DATA_STATE_XMIT)
1279 udc->ep0_state = WAIT_FOR_OUT_STATUS;
1283 1280
1284 req->ep = ep; 1281 req->ep = ep;
1285 req->req.length = 0; 1282 req->req.length = 0;
@@ -1384,6 +1381,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
1384 1381
1385 list_add_tail(&req->queue, &ep->queue); 1382 list_add_tail(&req->queue, &ep->queue);
1386 udc->ep0_state = DATA_STATE_XMIT; 1383 udc->ep0_state = DATA_STATE_XMIT;
1384 if (ep0_prime_status(udc, EP_DIR_OUT))
1385 ep0stall(udc);
1386
1387 return; 1387 return;
1388stall: 1388stall:
1389 ep0stall(udc); 1389 ep0stall(udc);
@@ -1492,6 +1492,14 @@ static void setup_received_irq(struct fsl_udc *udc,
1492 spin_lock(&udc->lock); 1492 spin_lock(&udc->lock);
1493 udc->ep0_state = (setup->bRequestType & USB_DIR_IN) 1493 udc->ep0_state = (setup->bRequestType & USB_DIR_IN)
1494 ? DATA_STATE_XMIT : DATA_STATE_RECV; 1494 ? DATA_STATE_XMIT : DATA_STATE_RECV;
1495 /*
1496 * If the data stage is IN, send status prime immediately.
1497 * See 2.0 Spec chapter 8.5.3.3 for detail.
1498 */
1499 if (udc->ep0_state == DATA_STATE_XMIT)
1500 if (ep0_prime_status(udc, EP_DIR_OUT))
1501 ep0stall(udc);
1502
1495 } else { 1503 } else {
1496 /* No data phase, IN status from gadget */ 1504 /* No data phase, IN status from gadget */
1497 udc->ep0_dir = USB_DIR_IN; 1505 udc->ep0_dir = USB_DIR_IN;
@@ -1520,9 +1528,8 @@ static void ep0_req_complete(struct fsl_udc *udc, struct fsl_ep *ep0,
1520 1528
1521 switch (udc->ep0_state) { 1529 switch (udc->ep0_state) {
1522 case DATA_STATE_XMIT: 1530 case DATA_STATE_XMIT:
1523 /* receive status phase */ 1531 /* already primed at setup_received_irq */
1524 if (ep0_prime_status(udc, EP_DIR_OUT)) 1532 udc->ep0_state = WAIT_FOR_OUT_STATUS;
1525 ep0stall(udc);
1526 break; 1533 break;
1527 case DATA_STATE_RECV: 1534 case DATA_STATE_RECV:
1528 /* send status phase */ 1535 /* send status phase */
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index 331cd6729d3c..a85eaf40b948 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -161,7 +161,7 @@ static struct usb_composite_driver gfs_driver = {
161static struct ffs_data *gfs_ffs_data; 161static struct ffs_data *gfs_ffs_data;
162static unsigned long gfs_registered; 162static unsigned long gfs_registered;
163 163
164static int gfs_init(void) 164static int __init gfs_init(void)
165{ 165{
166 ENTER(); 166 ENTER();
167 167
@@ -169,7 +169,7 @@ static int gfs_init(void)
169} 169}
170module_init(gfs_init); 170module_init(gfs_init);
171 171
172static void gfs_exit(void) 172static void __exit gfs_exit(void)
173{ 173{
174 ENTER(); 174 ENTER();
175 175
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 69295ba9d99a..105b206cd844 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -340,7 +340,7 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
340 /* currently we allocate TX FIFOs for all possible endpoints, 340 /* currently we allocate TX FIFOs for all possible endpoints,
341 * and assume that they are all the same size. */ 341 * and assume that they are all the same size. */
342 342
343 for (ep = 0; ep <= 15; ep++) { 343 for (ep = 1; ep <= 15; ep++) {
344 val = addr; 344 val = addr;
345 val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; 345 val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT;
346 addr += size; 346 addr += size;
@@ -741,7 +741,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
741 /* write size / packets */ 741 /* write size / packets */
742 writel(epsize, hsotg->regs + epsize_reg); 742 writel(epsize, hsotg->regs + epsize_reg);
743 743
744 if (using_dma(hsotg)) { 744 if (using_dma(hsotg) && !continuing) {
745 unsigned int dma_reg; 745 unsigned int dma_reg;
746 746
747 /* write DMA address to control register, buffer already 747 /* write DMA address to control register, buffer already
@@ -1696,10 +1696,12 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg,
1696 reg |= mpsval; 1696 reg |= mpsval;
1697 writel(reg, regs + S3C_DIEPCTL(ep)); 1697 writel(reg, regs + S3C_DIEPCTL(ep));
1698 1698
1699 reg = readl(regs + S3C_DOEPCTL(ep)); 1699 if (ep) {
1700 reg &= ~S3C_DxEPCTL_MPS_MASK; 1700 reg = readl(regs + S3C_DOEPCTL(ep));
1701 reg |= mpsval; 1701 reg &= ~S3C_DxEPCTL_MPS_MASK;
1702 writel(reg, regs + S3C_DOEPCTL(ep)); 1702 reg |= mpsval;
1703 writel(reg, regs + S3C_DOEPCTL(ep));
1704 }
1703 1705
1704 return; 1706 return;
1705 1707
@@ -1919,7 +1921,8 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
1919 ints & S3C_DIEPMSK_TxFIFOEmpty) { 1921 ints & S3C_DIEPMSK_TxFIFOEmpty) {
1920 dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", 1922 dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n",
1921 __func__, idx); 1923 __func__, idx);
1922 s3c_hsotg_trytx(hsotg, hs_ep); 1924 if (!using_dma(hsotg))
1925 s3c_hsotg_trytx(hsotg, hs_ep);
1923 } 1926 }
1924 } 1927 }
1925} 1928}
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index 56da49f31d6c..2fa9865babed 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -264,8 +264,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
264 if (udc_is_newstyle(udc)) { 264 if (udc_is_newstyle(udc)) {
265 udc->driver->disconnect(udc->gadget); 265 udc->driver->disconnect(udc->gadget);
266 udc->driver->unbind(udc->gadget); 266 udc->driver->unbind(udc->gadget);
267 usb_gadget_udc_stop(udc->gadget, udc->driver);
268 usb_gadget_disconnect(udc->gadget); 267 usb_gadget_disconnect(udc->gadget);
268 usb_gadget_udc_stop(udc->gadget, udc->driver);
269 } else { 269 } else {
270 usb_gadget_stop(udc->gadget, udc->driver); 270 usb_gadget_stop(udc->gadget, udc->driver);
271 } 271 }
@@ -411,8 +411,12 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
411 struct usb_udc *udc = container_of(dev, struct usb_udc, dev); 411 struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
412 412
413 if (sysfs_streq(buf, "connect")) { 413 if (sysfs_streq(buf, "connect")) {
414 if (udc_is_newstyle(udc))
415 usb_gadget_udc_start(udc->gadget, udc->driver);
414 usb_gadget_connect(udc->gadget); 416 usb_gadget_connect(udc->gadget);
415 } else if (sysfs_streq(buf, "disconnect")) { 417 } else if (sysfs_streq(buf, "disconnect")) {
418 if (udc_is_newstyle(udc))
419 usb_gadget_udc_stop(udc->gadget, udc->driver);
416 usb_gadget_disconnect(udc->gadget); 420 usb_gadget_disconnect(udc->gadget);
417 } else { 421 } else {
418 dev_err(dev, "unsupported command '%s'\n", buf); 422 dev_err(dev, "unsupported command '%s'\n", buf);
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
index d776adb2da67..0cdf89d32a15 100644
--- a/drivers/usb/gadget/uvc_queue.c
+++ b/drivers/usb/gadget/uvc_queue.c
@@ -543,11 +543,11 @@ done:
543 return ret; 543 return ret;
544} 544}
545 545
546/* called with queue->irqlock held.. */
546static struct uvc_buffer * 547static struct uvc_buffer *
547uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) 548uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
548{ 549{
549 struct uvc_buffer *nextbuf; 550 struct uvc_buffer *nextbuf;
550 unsigned long flags;
551 551
552 if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && 552 if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) &&
553 buf->buf.length != buf->buf.bytesused) { 553 buf->buf.length != buf->buf.bytesused) {
@@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
556 return buf; 556 return buf;
557 } 557 }
558 558
559 spin_lock_irqsave(&queue->irqlock, flags);
560 list_del(&buf->queue); 559 list_del(&buf->queue);
561 if (!list_empty(&queue->irqqueue)) 560 if (!list_empty(&queue->irqqueue))
562 nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, 561 nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
563 queue); 562 queue);
564 else 563 else
565 nextbuf = NULL; 564 nextbuf = NULL;
566 spin_unlock_irqrestore(&queue->irqlock, flags);
567 565
568 buf->buf.sequence = queue->sequence++; 566 buf->buf.sequence = queue->sequence++;
569 do_gettimeofday(&buf->buf.timestamp); 567 do_gettimeofday(&buf->buf.timestamp);
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 3e7345172e03..d0a84bd3f3eb 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -218,6 +218,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci,
218 u32 portsc; 218 u32 portsc;
219 struct usb_hcd *hcd = ehci_to_hcd(ehci); 219 struct usb_hcd *hcd = ehci_to_hcd(ehci);
220 void __iomem *non_ehci = hcd->regs; 220 void __iomem *non_ehci = hcd->regs;
221 struct fsl_usb2_platform_data *pdata;
222
223 pdata = hcd->self.controller->platform_data;
221 224
222 portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); 225 portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]);
223 portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); 226 portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW);
@@ -234,7 +237,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci,
234 /* fall through */ 237 /* fall through */
235 case FSL_USB2_PHY_UTMI: 238 case FSL_USB2_PHY_UTMI:
236 /* enable UTMI PHY */ 239 /* enable UTMI PHY */
237 setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); 240 if (pdata->have_sysif_regs)
241 setbits32(non_ehci + FSL_SOC_USB_CTRL,
242 CTRL_UTMI_PHY_EN);
238 portsc |= PORT_PTS_UTMI; 243 portsc |= PORT_PTS_UTMI;
239 break; 244 break;
240 case FSL_USB2_PHY_NONE: 245 case FSL_USB2_PHY_NONE:
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 806cc95317aa..4a3bc5b7a06f 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -858,8 +858,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
858 goto dead; 858 goto dead;
859 } 859 }
860 860
861 /*
862 * We don't use STS_FLR, but some controllers don't like it to
863 * remain on, so mask it out along with the other status bits.
864 */
865 masked_status = status & (INTR_MASK | STS_FLR);
866
861 /* Shared IRQ? */ 867 /* Shared IRQ? */
862 masked_status = status & INTR_MASK;
863 if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { 868 if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) {
864 spin_unlock(&ehci->lock); 869 spin_unlock(&ehci->lock);
865 return IRQ_NONE; 870 return IRQ_NONE;
@@ -910,7 +915,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
910 pcd_status = status; 915 pcd_status = status;
911 916
912 /* resume root hub? */ 917 /* resume root hub? */
913 if (!(cmd & CMD_RUN)) 918 if (ehci->rh_state == EHCI_RH_SUSPENDED)
914 usb_hcd_resume_root_hub(hcd); 919 usb_hcd_resume_root_hub(hcd);
915 920
916 /* get per-port change detect bits */ 921 /* get per-port change detect bits */
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index bba9850f32f0..5c78f9e71466 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -42,6 +42,7 @@
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <linux/regulator/consumer.h> 43#include <linux/regulator/consumer.h>
44#include <linux/pm_runtime.h> 44#include <linux/pm_runtime.h>
45#include <linux/gpio.h>
45 46
46/* EHCI Register Set */ 47/* EHCI Register Set */
47#define EHCI_INSNREG04 (0xA0) 48#define EHCI_INSNREG04 (0xA0)
@@ -191,6 +192,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
191 } 192 }
192 } 193 }
193 194
195 if (pdata->phy_reset) {
196 if (gpio_is_valid(pdata->reset_gpio_port[0]))
197 gpio_request_one(pdata->reset_gpio_port[0],
198 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
199
200 if (gpio_is_valid(pdata->reset_gpio_port[1]))
201 gpio_request_one(pdata->reset_gpio_port[1],
202 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
203
204 /* Hold the PHY in RESET for enough time till DIR is high */
205 udelay(10);
206 }
207
194 pm_runtime_enable(dev); 208 pm_runtime_enable(dev);
195 pm_runtime_get_sync(dev); 209 pm_runtime_get_sync(dev);
196 210
@@ -237,6 +251,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
237 /* root ports should always stay powered */ 251 /* root ports should always stay powered */
238 ehci_port_power(omap_ehci, 1); 252 ehci_port_power(omap_ehci, 1);
239 253
254 if (pdata->phy_reset) {
255 /* Hold the PHY in RESET for enough time till
256 * PHY is settled and ready
257 */
258 udelay(10);
259
260 if (gpio_is_valid(pdata->reset_gpio_port[0]))
261 gpio_set_value(pdata->reset_gpio_port[0], 1);
262
263 if (gpio_is_valid(pdata->reset_gpio_port[1]))
264 gpio_set_value(pdata->reset_gpio_port[1], 1);
265 }
266
240 return 0; 267 return 0;
241 268
242err_add_hcd: 269err_add_hcd:
@@ -259,8 +286,9 @@ err_io:
259 */ 286 */
260static int ehci_hcd_omap_remove(struct platform_device *pdev) 287static int ehci_hcd_omap_remove(struct platform_device *pdev)
261{ 288{
262 struct device *dev = &pdev->dev; 289 struct device *dev = &pdev->dev;
263 struct usb_hcd *hcd = dev_get_drvdata(dev); 290 struct usb_hcd *hcd = dev_get_drvdata(dev);
291 struct ehci_hcd_omap_platform_data *pdata = dev->platform_data;
264 292
265 usb_remove_hcd(hcd); 293 usb_remove_hcd(hcd);
266 disable_put_regulator(dev->platform_data); 294 disable_put_regulator(dev->platform_data);
@@ -269,6 +297,13 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
269 pm_runtime_put_sync(dev); 297 pm_runtime_put_sync(dev);
270 pm_runtime_disable(dev); 298 pm_runtime_disable(dev);
271 299
300 if (pdata->phy_reset) {
301 if (gpio_is_valid(pdata->reset_gpio_port[0]))
302 gpio_free(pdata->reset_gpio_port[0]);
303
304 if (gpio_is_valid(pdata->reset_gpio_port[1]))
305 gpio_free(pdata->reset_gpio_port[1]);
306 }
272 return 0; 307 return 0;
273} 308}
274 309
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 73544bd440bd..86183366647f 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -731,7 +731,6 @@ static int tegra_ehci_probe(struct platform_device *pdev)
731 err = -ENODEV; 731 err = -ENODEV;
732 goto fail; 732 goto fail;
733 } 733 }
734 set_irq_flags(irq, IRQF_VALID);
735 734
736#ifdef CONFIG_USB_OTG_UTILS 735#ifdef CONFIG_USB_OTG_UTILS
737 if (pdata->operating_mode == TEGRA_USB_OTG) { 736 if (pdata->operating_mode == TEGRA_USB_OTG) {
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 09f597ad6e00..13ebeca8e73e 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -94,7 +94,7 @@ static void at91_stop_hc(struct platform_device *pdev)
94 94
95/*-------------------------------------------------------------------------*/ 95/*-------------------------------------------------------------------------*/
96 96
97static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); 97static void __devexit usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
98 98
99/* configure so an HC device and id are always provided */ 99/* configure so an HC device and id are always provided */
100/* always called with process context; sleeping is OK */ 100/* always called with process context; sleeping is OK */
@@ -108,7 +108,7 @@ static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
108 * then invokes the start() method for the HCD associated with it 108 * then invokes the start() method for the HCD associated with it
109 * through the hotplug entry's driver_data. 109 * through the hotplug entry's driver_data.
110 */ 110 */
111static int usb_hcd_at91_probe(const struct hc_driver *driver, 111static int __devinit usb_hcd_at91_probe(const struct hc_driver *driver,
112 struct platform_device *pdev) 112 struct platform_device *pdev)
113{ 113{
114 int retval; 114 int retval;
@@ -203,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
203 * context, "rmmod" or something similar. 203 * context, "rmmod" or something similar.
204 * 204 *
205 */ 205 */
206static void usb_hcd_at91_remove(struct usb_hcd *hcd, 206static void __devexit usb_hcd_at91_remove(struct usb_hcd *hcd,
207 struct platform_device *pdev) 207 struct platform_device *pdev)
208{ 208{
209 usb_remove_hcd(hcd); 209 usb_remove_hcd(hcd);
@@ -545,7 +545,7 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev)
545 545
546/*-------------------------------------------------------------------------*/ 546/*-------------------------------------------------------------------------*/
547 547
548static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) 548static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev)
549{ 549{
550 struct at91_usbh_data *pdata; 550 struct at91_usbh_data *pdata;
551 int i; 551 int i;
@@ -620,7 +620,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
620 return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); 620 return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev);
621} 621}
622 622
623static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) 623static int __devexit ohci_hcd_at91_drv_remove(struct platform_device *pdev)
624{ 624{
625 struct at91_usbh_data *pdata = pdev->dev.platform_data; 625 struct at91_usbh_data *pdata = pdev->dev.platform_data;
626 int i; 626 int i;
@@ -696,7 +696,7 @@ MODULE_ALIAS("platform:at91_ohci");
696 696
697static struct platform_driver ohci_hcd_at91_driver = { 697static struct platform_driver ohci_hcd_at91_driver = {
698 .probe = ohci_hcd_at91_drv_probe, 698 .probe = ohci_hcd_at91_drv_probe,
699 .remove = ohci_hcd_at91_drv_remove, 699 .remove = __devexit_p(ohci_hcd_at91_drv_remove),
700 .shutdown = usb_hcd_platform_shutdown, 700 .shutdown = usb_hcd_platform_shutdown,
701 .suspend = ohci_hcd_at91_drv_suspend, 701 .suspend = ohci_hcd_at91_drv_suspend,
702 .resume = ohci_hcd_at91_drv_resume, 702 .resume = ohci_hcd_at91_drv_resume,
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 959145baf3cf..9dcb68f04f03 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -423,7 +423,7 @@ alloc_sglist(int nents, int max, int vary)
423 unsigned i; 423 unsigned i;
424 unsigned size = max; 424 unsigned size = max;
425 425
426 sg = kmalloc(nents * sizeof *sg, GFP_KERNEL); 426 sg = kmalloc_array(nents, sizeof *sg, GFP_KERNEL);
427 if (!sg) 427 if (!sg)
428 return NULL; 428 return NULL;
429 sg_init_table(sg, nents); 429 sg_init_table(sg, nents);
@@ -904,6 +904,9 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param)
904 struct ctrl_ctx context; 904 struct ctrl_ctx context;
905 int i; 905 int i;
906 906
907 if (param->sglen == 0 || param->iterations > UINT_MAX / param->sglen)
908 return -EOPNOTSUPP;
909
907 spin_lock_init(&context.lock); 910 spin_lock_init(&context.lock);
908 context.dev = dev; 911 context.dev = dev;
909 init_completion(&context.complete); 912 init_completion(&context.complete);
@@ -1981,8 +1984,6 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf)
1981 1984
1982 /* queued control messaging */ 1985 /* queued control messaging */
1983 case 10: 1986 case 10:
1984 if (param->sglen == 0)
1985 break;
1986 retval = 0; 1987 retval = 0;
1987 dev_info(&intf->dev, 1988 dev_info(&intf->dev,
1988 "TEST 10: queue %d control calls, %d times\n", 1989 "TEST 10: queue %d control calls, %d times\n",
@@ -2276,6 +2277,8 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id)
2276 if (status < 0) { 2277 if (status < 0) {
2277 WARNING(dev, "couldn't get endpoints, %d\n", 2278 WARNING(dev, "couldn't get endpoints, %d\n",
2278 status); 2279 status);
2280 kfree(dev->buf);
2281 kfree(dev);
2279 return status; 2282 return status;
2280 } 2283 }
2281 /* may find bulk or ISO pipes */ 2284 /* may find bulk or ISO pipes */
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index 897edda42270..70201462e19c 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref)
99 usb_put_dev(dev->udev); 99 usb_put_dev(dev->udev);
100 if (dev->cntl_urb) { 100 if (dev->cntl_urb) {
101 usb_kill_urb(dev->cntl_urb); 101 usb_kill_urb(dev->cntl_urb);
102 if (dev->cntl_req) 102 kfree(dev->cntl_req);
103 usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
104 dev->cntl_req, dev->cntl_urb->setup_dma);
105 if (dev->cntl_buffer) 103 if (dev->cntl_buffer)
106 usb_free_coherent(dev->udev, YUREX_BUF_SIZE, 104 usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
107 dev->cntl_buffer, dev->cntl_urb->transfer_dma); 105 dev->cntl_buffer, dev->cntl_urb->transfer_dma);
@@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
234 } 232 }
235 233
236 /* allocate buffer for control req */ 234 /* allocate buffer for control req */
237 dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, 235 dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL);
238 GFP_KERNEL,
239 &dev->cntl_urb->setup_dma);
240 if (!dev->cntl_req) { 236 if (!dev->cntl_req) {
241 err("Could not allocate cntl_req"); 237 err("Could not allocate cntl_req");
242 goto error; 238 goto error;
@@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
286 usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), 282 usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
287 dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, 283 dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt,
288 dev, 1); 284 dev, 1);
289 dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 285 dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
290 if (usb_submit_urb(dev->urb, GFP_KERNEL)) { 286 if (usb_submit_urb(dev->urb, GFP_KERNEL)) {
291 retval = -EIO; 287 retval = -EIO;
292 err("Could not submitting URB"); 288 err("Could not submitting URB");
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0f8b82918a40..66aaccf04490 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -137,6 +137,9 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
137 int i = 0; 137 int i = 0;
138 u8 r; 138 u8 r;
139 u8 power; 139 u8 power;
140 int ret;
141
142 pm_runtime_get_sync(phy->io_dev);
140 143
141 /* Make sure the transceiver is not in low power mode */ 144 /* Make sure the transceiver is not in low power mode */
142 power = musb_readb(addr, MUSB_POWER); 145 power = musb_readb(addr, MUSB_POWER);
@@ -154,15 +157,22 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
154 while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) 157 while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
155 & MUSB_ULPI_REG_CMPLT)) { 158 & MUSB_ULPI_REG_CMPLT)) {
156 i++; 159 i++;
157 if (i == 10000) 160 if (i == 10000) {
158 return -ETIMEDOUT; 161 ret = -ETIMEDOUT;
162 goto out;
163 }
159 164
160 } 165 }
161 r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); 166 r = musb_readb(addr, MUSB_ULPI_REG_CONTROL);
162 r &= ~MUSB_ULPI_REG_CMPLT; 167 r &= ~MUSB_ULPI_REG_CMPLT;
163 musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); 168 musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r);
164 169
165 return musb_readb(addr, MUSB_ULPI_REG_DATA); 170 ret = musb_readb(addr, MUSB_ULPI_REG_DATA);
171
172out:
173 pm_runtime_put(phy->io_dev);
174
175 return ret;
166} 176}
167 177
168static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) 178static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
@@ -171,6 +181,9 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
171 int i = 0; 181 int i = 0;
172 u8 r = 0; 182 u8 r = 0;
173 u8 power; 183 u8 power;
184 int ret = 0;
185
186 pm_runtime_get_sync(phy->io_dev);
174 187
175 /* Make sure the transceiver is not in low power mode */ 188 /* Make sure the transceiver is not in low power mode */
176 power = musb_readb(addr, MUSB_POWER); 189 power = musb_readb(addr, MUSB_POWER);
@@ -184,15 +197,20 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
184 while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) 197 while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
185 & MUSB_ULPI_REG_CMPLT)) { 198 & MUSB_ULPI_REG_CMPLT)) {
186 i++; 199 i++;
187 if (i == 10000) 200 if (i == 10000) {
188 return -ETIMEDOUT; 201 ret = -ETIMEDOUT;
202 goto out;
203 }
189 } 204 }
190 205
191 r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); 206 r = musb_readb(addr, MUSB_ULPI_REG_CONTROL);
192 r &= ~MUSB_ULPI_REG_CMPLT; 207 r &= ~MUSB_ULPI_REG_CMPLT;
193 musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); 208 musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r);
194 209
195 return 0; 210out:
211 pm_runtime_put(phy->io_dev);
212
213 return ret;
196} 214}
197#else 215#else
198#define musb_ulpi_read NULL 216#define musb_ulpi_read NULL
@@ -1904,14 +1922,17 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1904 1922
1905 if (!musb->isr) { 1923 if (!musb->isr) {
1906 status = -ENODEV; 1924 status = -ENODEV;
1907 goto fail3; 1925 goto fail2;
1908 } 1926 }
1909 1927
1910 if (!musb->xceiv->io_ops) { 1928 if (!musb->xceiv->io_ops) {
1929 musb->xceiv->io_dev = musb->controller;
1911 musb->xceiv->io_priv = musb->mregs; 1930 musb->xceiv->io_priv = musb->mregs;
1912 musb->xceiv->io_ops = &musb_ulpi_access; 1931 musb->xceiv->io_ops = &musb_ulpi_access;
1913 } 1932 }
1914 1933
1934 pm_runtime_get_sync(musb->controller);
1935
1915#ifndef CONFIG_MUSB_PIO_ONLY 1936#ifndef CONFIG_MUSB_PIO_ONLY
1916 if (use_dma && dev->dma_mask) { 1937 if (use_dma && dev->dma_mask) {
1917 struct dma_controller *c; 1938 struct dma_controller *c;
@@ -2023,6 +2044,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
2023 goto fail5; 2044 goto fail5;
2024#endif 2045#endif
2025 2046
2047 pm_runtime_put(musb->controller);
2048
2026 dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", 2049 dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
2027 ({char *s; 2050 ({char *s;
2028 switch (musb->board_mode) { 2051 switch (musb->board_mode) {
@@ -2047,6 +2070,9 @@ fail4:
2047 musb_gadget_cleanup(musb); 2070 musb_gadget_cleanup(musb);
2048 2071
2049fail3: 2072fail3:
2073 pm_runtime_put_sync(musb->controller);
2074
2075fail2:
2050 if (musb->irq_wake) 2076 if (musb->irq_wake)
2051 device_init_wakeup(dev, 0); 2077 device_init_wakeup(dev, 0);
2052 musb_platform_exit(musb); 2078 musb_platform_exit(musb);
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 79cb0af779fa..ef8d744800ac 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2098,7 +2098,7 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
2098 } 2098 }
2099 2099
2100 /* turn off DMA requests, discard state, stop polling ... */ 2100 /* turn off DMA requests, discard state, stop polling ... */
2101 if (is_in) { 2101 if (ep->epnum && is_in) {
2102 /* giveback saves bulk toggle */ 2102 /* giveback saves bulk toggle */
2103 csr = musb_h_flush_rxfifo(ep, 0); 2103 csr = musb_h_flush_rxfifo(ep, 0);
2104 2104
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 2ae0bb309994..c7785e81254c 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -282,7 +282,8 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
282 282
283static int omap2430_musb_init(struct musb *musb) 283static int omap2430_musb_init(struct musb *musb)
284{ 284{
285 u32 l, status = 0; 285 u32 l;
286 int status = 0;
286 struct device *dev = musb->controller; 287 struct device *dev = musb->controller;
287 struct musb_hdrc_platform_data *plat = dev->platform_data; 288 struct musb_hdrc_platform_data *plat = dev->platform_data;
288 struct omap_musb_board_data *data = plat->board_data; 289 struct omap_musb_board_data *data = plat->board_data;
@@ -301,7 +302,7 @@ static int omap2430_musb_init(struct musb *musb)
301 302
302 status = pm_runtime_get_sync(dev); 303 status = pm_runtime_get_sync(dev);
303 if (status < 0) { 304 if (status < 0) {
304 dev_err(dev, "pm_runtime_get_sync FAILED"); 305 dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
305 goto err1; 306 goto err1;
306 } 307 }
307 308
@@ -333,6 +334,7 @@ static int omap2430_musb_init(struct musb *musb)
333 334
334 setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); 335 setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
335 336
337 pm_runtime_put_noidle(musb->controller);
336 return 0; 338 return 0;
337 339
338err1: 340err1:
@@ -452,14 +454,14 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
452 goto err2; 454 goto err2;
453 } 455 }
454 456
457 pm_runtime_enable(&pdev->dev);
458
455 ret = platform_device_add(musb); 459 ret = platform_device_add(musb);
456 if (ret) { 460 if (ret) {
457 dev_err(&pdev->dev, "failed to register musb device\n"); 461 dev_err(&pdev->dev, "failed to register musb device\n");
458 goto err2; 462 goto err2;
459 } 463 }
460 464
461 pm_runtime_enable(&pdev->dev);
462
463 return 0; 465 return 0;
464 466
465err2: 467err2:
@@ -478,7 +480,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev)
478 480
479 platform_device_del(glue->musb); 481 platform_device_del(glue->musb);
480 platform_device_put(glue->musb); 482 platform_device_put(glue->musb);
481 pm_runtime_put(&pdev->dev);
482 kfree(glue); 483 kfree(glue);
483 484
484 return 0; 485 return 0;
@@ -491,11 +492,13 @@ static int omap2430_runtime_suspend(struct device *dev)
491 struct omap2430_glue *glue = dev_get_drvdata(dev); 492 struct omap2430_glue *glue = dev_get_drvdata(dev);
492 struct musb *musb = glue_to_musb(glue); 493 struct musb *musb = glue_to_musb(glue);
493 494
494 musb->context.otg_interfsel = musb_readl(musb->mregs, 495 if (musb) {
495 OTG_INTERFSEL); 496 musb->context.otg_interfsel = musb_readl(musb->mregs,
497 OTG_INTERFSEL);
496 498
497 omap2430_low_level_exit(musb); 499 omap2430_low_level_exit(musb);
498 usb_phy_set_suspend(musb->xceiv, 1); 500 usb_phy_set_suspend(musb->xceiv, 1);
501 }
499 502
500 return 0; 503 return 0;
501} 504}
@@ -505,11 +508,13 @@ static int omap2430_runtime_resume(struct device *dev)
505 struct omap2430_glue *glue = dev_get_drvdata(dev); 508 struct omap2430_glue *glue = dev_get_drvdata(dev);
506 struct musb *musb = glue_to_musb(glue); 509 struct musb *musb = glue_to_musb(glue);
507 510
508 omap2430_low_level_init(musb); 511 if (musb) {
509 musb_writel(musb->mregs, OTG_INTERFSEL, 512 omap2430_low_level_init(musb);
510 musb->context.otg_interfsel); 513 musb_writel(musb->mregs, OTG_INTERFSEL,
514 musb->context.otg_interfsel);
511 515
512 usb_phy_set_suspend(musb->xceiv, 0); 516 usb_phy_set_suspend(musb->xceiv, 0);
517 }
513 518
514 return 0; 519 return 0;
515} 520}
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 0310e2df59f5..ec30f95ef399 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -287,7 +287,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
287 /* Issue the request, attempting to read 'size' bytes */ 287 /* Issue the request, attempting to read 'size' bytes */
288 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 288 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
289 request, REQTYPE_DEVICE_TO_HOST, 0x0000, 289 request, REQTYPE_DEVICE_TO_HOST, 0x0000,
290 port_priv->bInterfaceNumber, buf, size, 300); 290 port_priv->bInterfaceNumber, buf, size,
291 USB_CTRL_GET_TIMEOUT);
291 292
292 /* Convert data into an array of integers */ 293 /* Convert data into an array of integers */
293 for (i = 0; i < length; i++) 294 for (i = 0; i < length; i++)
@@ -340,12 +341,14 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
340 result = usb_control_msg(serial->dev, 341 result = usb_control_msg(serial->dev,
341 usb_sndctrlpipe(serial->dev, 0), 342 usb_sndctrlpipe(serial->dev, 0),
342 request, REQTYPE_HOST_TO_DEVICE, 0x0000, 343 request, REQTYPE_HOST_TO_DEVICE, 0x0000,
343 port_priv->bInterfaceNumber, buf, size, 300); 344 port_priv->bInterfaceNumber, buf, size,
345 USB_CTRL_SET_TIMEOUT);
344 } else { 346 } else {
345 result = usb_control_msg(serial->dev, 347 result = usb_control_msg(serial->dev,
346 usb_sndctrlpipe(serial->dev, 0), 348 usb_sndctrlpipe(serial->dev, 0),
347 request, REQTYPE_HOST_TO_DEVICE, data[0], 349 request, REQTYPE_HOST_TO_DEVICE, data[0],
348 port_priv->bInterfaceNumber, NULL, 0, 300); 350 port_priv->bInterfaceNumber, NULL, 0,
351 USB_CTRL_SET_TIMEOUT);
349 } 352 }
350 353
351 kfree(buf); 354 kfree(buf);
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index fdd5aa2c8d82..8c8bf806f6fa 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -221,7 +221,7 @@ static const struct sierra_iface_info typeB_interface_list = {
221}; 221};
222 222
223/* 'blacklist' of interfaces not served by this driver */ 223/* 'blacklist' of interfaces not served by this driver */
224static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11 }; 224static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 };
225static const struct sierra_iface_info direct_ip_interface_blacklist = { 225static const struct sierra_iface_info direct_ip_interface_blacklist = {
226 .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), 226 .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces),
227 .ifaceinfo = direct_ip_non_serial_ifaces, 227 .ifaceinfo = direct_ip_non_serial_ifaces,
@@ -289,7 +289,6 @@ static const struct usb_device_id id_table[] = {
289 { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ 289 { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */
290 { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ 290 { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */
291 { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ 291 { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */
292 { USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */
293 /* Sierra Wireless C885 */ 292 /* Sierra Wireless C885 */
294 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, 293 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)},
295 /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ 294 /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */
@@ -299,6 +298,9 @@ static const struct usb_device_id id_table[] = {
299 /* Sierra Wireless HSPA Non-Composite Device */ 298 /* Sierra Wireless HSPA Non-Composite Device */
300 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, 299 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)},
301 { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ 300 { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */
301 { USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */
302 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
303 },
302 { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ 304 { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */
303 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist 305 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
304 }, 306 },
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index 66797e9c5010..810c90ae2c55 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb)
645 dev_err(dev, "NEEP: URB error %d\n", urb->status); 645 dev_err(dev, "NEEP: URB error %d\n", urb->status);
646 } 646 }
647 result = usb_submit_urb(urb, GFP_ATOMIC); 647 result = usb_submit_urb(urb, GFP_ATOMIC);
648 if (result < 0) { 648 if (result < 0 && result != -ENODEV && result != -EPERM) {
649 /* ignoring unrecoverable errors */
649 dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", 650 dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n",
650 result); 651 result);
651 goto error; 652 goto error;
diff --git a/drivers/uwb/neh.c b/drivers/uwb/neh.c
index a269937be1b8..8cb71bb333c2 100644
--- a/drivers/uwb/neh.c
+++ b/drivers/uwb/neh.c
@@ -107,6 +107,7 @@ struct uwb_rc_neh {
107 u8 evt_type; 107 u8 evt_type;
108 __le16 evt; 108 __le16 evt;
109 u8 context; 109 u8 context;
110 u8 completed;
110 uwb_rc_cmd_cb_f cb; 111 uwb_rc_cmd_cb_f cb;
111 void *arg; 112 void *arg;
112 113
@@ -409,6 +410,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
409 struct device *dev = &rc->uwb_dev.dev; 410 struct device *dev = &rc->uwb_dev.dev;
410 struct uwb_rc_neh *neh; 411 struct uwb_rc_neh *neh;
411 struct uwb_rceb *notif; 412 struct uwb_rceb *notif;
413 unsigned long flags;
412 414
413 if (rceb->bEventContext == 0) { 415 if (rceb->bEventContext == 0) {
414 notif = kmalloc(size, GFP_ATOMIC); 416 notif = kmalloc(size, GFP_ATOMIC);
@@ -422,7 +424,11 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
422 } else { 424 } else {
423 neh = uwb_rc_neh_lookup(rc, rceb); 425 neh = uwb_rc_neh_lookup(rc, rceb);
424 if (neh) { 426 if (neh) {
425 del_timer_sync(&neh->timer); 427 spin_lock_irqsave(&rc->neh_lock, flags);
428 /* to guard against a timeout */
429 neh->completed = 1;
430 del_timer(&neh->timer);
431 spin_unlock_irqrestore(&rc->neh_lock, flags);
426 uwb_rc_neh_cb(neh, rceb, size); 432 uwb_rc_neh_cb(neh, rceb, size);
427 } else 433 } else
428 dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", 434 dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n",
@@ -568,6 +574,10 @@ static void uwb_rc_neh_timer(unsigned long arg)
568 unsigned long flags; 574 unsigned long flags;
569 575
570 spin_lock_irqsave(&rc->neh_lock, flags); 576 spin_lock_irqsave(&rc->neh_lock, flags);
577 if (neh->completed) {
578 spin_unlock_irqrestore(&rc->neh_lock, flags);
579 return;
580 }
571 if (neh->context) 581 if (neh->context)
572 __uwb_rc_neh_rm(rc, neh); 582 __uwb_rc_neh_rm(rc, neh);
573 else 583 else
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index fc9a1d75281f..3de00d9fae2e 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -155,7 +155,7 @@ static int vhost_test_release(struct inode *inode, struct file *f)
155 155
156 vhost_test_stop(n, &private); 156 vhost_test_stop(n, &private);
157 vhost_test_flush(n); 157 vhost_test_flush(n);
158 vhost_dev_cleanup(&n->dev); 158 vhost_dev_cleanup(&n->dev, false);
159 /* We do an extra flush before freeing memory, 159 /* We do an extra flush before freeing memory,
160 * since jobs can re-queue themselves. */ 160 * since jobs can re-queue themselves. */
161 vhost_test_flush(n); 161 vhost_test_flush(n);
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 05f0a80818a2..c2d05a8279fd 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -28,6 +28,13 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/module.h> 29#include <linux/module.h>
30 30
31/*
32 * Balloon device works in 4K page units. So each page is pointed to by
33 * multiple balloon pages. All memory counters in this driver are in balloon
34 * page units.
35 */
36#define VIRTIO_BALLOON_PAGES_PER_PAGE (PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT)
37
31struct virtio_balloon 38struct virtio_balloon
32{ 39{
33 struct virtio_device *vdev; 40 struct virtio_device *vdev;
@@ -42,8 +49,13 @@ struct virtio_balloon
42 /* Waiting for host to ack the pages we released. */ 49 /* Waiting for host to ack the pages we released. */
43 struct completion acked; 50 struct completion acked;
44 51
45 /* The pages we've told the Host we're not using. */ 52 /* Number of balloon pages we've told the Host we're not using. */
46 unsigned int num_pages; 53 unsigned int num_pages;
54 /*
55 * The pages we've told the Host we're not using.
56 * Each page on this list adds VIRTIO_BALLOON_PAGES_PER_PAGE
57 * to num_pages above.
58 */
47 struct list_head pages; 59 struct list_head pages;
48 60
49 /* The array of pfns we tell the Host about. */ 61 /* The array of pfns we tell the Host about. */
@@ -66,7 +78,13 @@ static u32 page_to_balloon_pfn(struct page *page)
66 78
67 BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT); 79 BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT);
68 /* Convert pfn from Linux page size to balloon page size. */ 80 /* Convert pfn from Linux page size to balloon page size. */
69 return pfn >> (PAGE_SHIFT - VIRTIO_BALLOON_PFN_SHIFT); 81 return pfn * VIRTIO_BALLOON_PAGES_PER_PAGE;
82}
83
84static struct page *balloon_pfn_to_page(u32 pfn)
85{
86 BUG_ON(pfn % VIRTIO_BALLOON_PAGES_PER_PAGE);
87 return pfn_to_page(pfn / VIRTIO_BALLOON_PAGES_PER_PAGE);
70} 88}
71 89
72static void balloon_ack(struct virtqueue *vq) 90static void balloon_ack(struct virtqueue *vq)
@@ -96,12 +114,23 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq)
96 wait_for_completion(&vb->acked); 114 wait_for_completion(&vb->acked);
97} 115}
98 116
117static void set_page_pfns(u32 pfns[], struct page *page)
118{
119 unsigned int i;
120
121 /* Set balloon pfns pointing at this page.
122 * Note that the first pfn points at start of the page. */
123 for (i = 0; i < VIRTIO_BALLOON_PAGES_PER_PAGE; i++)
124 pfns[i] = page_to_balloon_pfn(page) + i;
125}
126
99static void fill_balloon(struct virtio_balloon *vb, size_t num) 127static void fill_balloon(struct virtio_balloon *vb, size_t num)
100{ 128{
101 /* We can only do one array worth at a time. */ 129 /* We can only do one array worth at a time. */
102 num = min(num, ARRAY_SIZE(vb->pfns)); 130 num = min(num, ARRAY_SIZE(vb->pfns));
103 131
104 for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { 132 for (vb->num_pfns = 0; vb->num_pfns < num;
133 vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) {
105 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY | 134 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY |
106 __GFP_NOMEMALLOC | __GFP_NOWARN); 135 __GFP_NOMEMALLOC | __GFP_NOWARN);
107 if (!page) { 136 if (!page) {
@@ -113,9 +142,9 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num)
113 msleep(200); 142 msleep(200);
114 break; 143 break;
115 } 144 }
116 vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page); 145 set_page_pfns(vb->pfns + vb->num_pfns, page);
146 vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;
117 totalram_pages--; 147 totalram_pages--;
118 vb->num_pages++;
119 list_add(&page->lru, &vb->pages); 148 list_add(&page->lru, &vb->pages);
120 } 149 }
121 150
@@ -130,8 +159,9 @@ static void release_pages_by_pfn(const u32 pfns[], unsigned int num)
130{ 159{
131 unsigned int i; 160 unsigned int i;
132 161
133 for (i = 0; i < num; i++) { 162 /* Find pfns pointing at start of each page, get pages and free them. */
134 __free_page(pfn_to_page(pfns[i])); 163 for (i = 0; i < num; i += VIRTIO_BALLOON_PAGES_PER_PAGE) {
164 __free_page(balloon_pfn_to_page(pfns[i]));
135 totalram_pages++; 165 totalram_pages++;
136 } 166 }
137} 167}
@@ -143,11 +173,12 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num)
143 /* We can only do one array worth at a time. */ 173 /* We can only do one array worth at a time. */
144 num = min(num, ARRAY_SIZE(vb->pfns)); 174 num = min(num, ARRAY_SIZE(vb->pfns));
145 175
146 for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { 176 for (vb->num_pfns = 0; vb->num_pfns < num;
177 vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) {
147 page = list_first_entry(&vb->pages, struct page, lru); 178 page = list_first_entry(&vb->pages, struct page, lru);
148 list_del(&page->lru); 179 list_del(&page->lru);
149 vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page); 180 set_page_pfns(vb->pfns + vb->num_pfns, page);
150 vb->num_pages--; 181 vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE;
151 } 182 }
152 183
153 /* 184 /*
@@ -234,11 +265,14 @@ static void virtballoon_changed(struct virtio_device *vdev)
234 265
235static inline s64 towards_target(struct virtio_balloon *vb) 266static inline s64 towards_target(struct virtio_balloon *vb)
236{ 267{
237 u32 v; 268 __le32 v;
269 s64 target;
270
238 vb->vdev->config->get(vb->vdev, 271 vb->vdev->config->get(vb->vdev,
239 offsetof(struct virtio_balloon_config, num_pages), 272 offsetof(struct virtio_balloon_config, num_pages),
240 &v, sizeof(v)); 273 &v, sizeof(v));
241 return (s64)v - vb->num_pages; 274 target = le32_to_cpu(v);
275 return target - vb->num_pages;
242} 276}
243 277
244static void update_balloon_size(struct virtio_balloon *vb) 278static void update_balloon_size(struct virtio_balloon *vb)
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 99d8151c824a..1ffd03bf8e10 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -722,7 +722,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
722 vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; 722 vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND;
723 723
724 if (use_ptemod) 724 if (use_ptemod)
725 vma->vm_flags |= VM_DONTCOPY|VM_PFNMAP; 725 vma->vm_flags |= VM_DONTCOPY;
726 726
727 vma->vm_private_data = map; 727 vma->vm_private_data = map;
728 728
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index b4d4eac761db..f100ce20b16b 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -1029,6 +1029,7 @@ int gnttab_init(void)
1029 int i; 1029 int i;
1030 unsigned int max_nr_glist_frames, nr_glist_frames; 1030 unsigned int max_nr_glist_frames, nr_glist_frames;
1031 unsigned int nr_init_grefs; 1031 unsigned int nr_init_grefs;
1032 int ret;
1032 1033
1033 nr_grant_frames = 1; 1034 nr_grant_frames = 1;
1034 boot_max_nr_grant_frames = __max_nr_grant_frames(); 1035 boot_max_nr_grant_frames = __max_nr_grant_frames();
@@ -1047,12 +1048,16 @@ int gnttab_init(void)
1047 nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; 1048 nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
1048 for (i = 0; i < nr_glist_frames; i++) { 1049 for (i = 0; i < nr_glist_frames; i++) {
1049 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); 1050 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);
1050 if (gnttab_list[i] == NULL) 1051 if (gnttab_list[i] == NULL) {
1052 ret = -ENOMEM;
1051 goto ini_nomem; 1053 goto ini_nomem;
1054 }
1052 } 1055 }
1053 1056
1054 if (gnttab_resume() < 0) 1057 if (gnttab_resume() < 0) {
1055 return -ENODEV; 1058 ret = -ENODEV;
1059 goto ini_nomem;
1060 }
1056 1061
1057 nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; 1062 nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME;
1058 1063
@@ -1070,7 +1075,7 @@ int gnttab_init(void)
1070 for (i--; i >= 0; i--) 1075 for (i--; i >= 0; i--)
1071 free_page((unsigned long)gnttab_list[i]); 1076 free_page((unsigned long)gnttab_list[i]);
1072 kfree(gnttab_list); 1077 kfree(gnttab_list);
1073 return -ENOMEM; 1078 return ret;
1074} 1079}
1075EXPORT_SYMBOL_GPL(gnttab_init); 1080EXPORT_SYMBOL_GPL(gnttab_init);
1076 1081
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 9e14ae6cd49c..412b96cc5305 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -132,6 +132,7 @@ static void do_suspend(void)
132 err = dpm_suspend_end(PMSG_FREEZE); 132 err = dpm_suspend_end(PMSG_FREEZE);
133 if (err) { 133 if (err) {
134 printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); 134 printk(KERN_ERR "dpm_suspend_end failed: %d\n", err);
135 si.cancelled = 0;
135 goto out_resume; 136 goto out_resume;
136 } 137 }
137 138
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index f20c5f178b40..a31b54d48839 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -135,7 +135,7 @@ static int read_backend_details(struct xenbus_device *xendev)
135 return xenbus_read_otherend_details(xendev, "backend-id", "backend"); 135 return xenbus_read_otherend_details(xendev, "backend-id", "backend");
136} 136}
137 137
138static int is_device_connecting(struct device *dev, void *data) 138static int is_device_connecting(struct device *dev, void *data, bool ignore_nonessential)
139{ 139{
140 struct xenbus_device *xendev = to_xenbus_device(dev); 140 struct xenbus_device *xendev = to_xenbus_device(dev);
141 struct device_driver *drv = data; 141 struct device_driver *drv = data;
@@ -152,16 +152,41 @@ static int is_device_connecting(struct device *dev, void *data)
152 if (drv && (dev->driver != drv)) 152 if (drv && (dev->driver != drv))
153 return 0; 153 return 0;
154 154
155 if (ignore_nonessential) {
156 /* With older QEMU, for PVonHVM guests the guest config files
157 * could contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0']
158 * which is nonsensical as there is no PV FB (there can be
159 * a PVKB) running as HVM guest. */
160
161 if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0))
162 return 0;
163
164 if ((strncmp(xendev->nodename, "device/vfb", 10) == 0))
165 return 0;
166 }
155 xendrv = to_xenbus_driver(dev->driver); 167 xendrv = to_xenbus_driver(dev->driver);
156 return (xendev->state < XenbusStateConnected || 168 return (xendev->state < XenbusStateConnected ||
157 (xendev->state == XenbusStateConnected && 169 (xendev->state == XenbusStateConnected &&
158 xendrv->is_ready && !xendrv->is_ready(xendev))); 170 xendrv->is_ready && !xendrv->is_ready(xendev)));
159} 171}
172static int essential_device_connecting(struct device *dev, void *data)
173{
174 return is_device_connecting(dev, data, true /* ignore PV[KBB+FB] */);
175}
176static int non_essential_device_connecting(struct device *dev, void *data)
177{
178 return is_device_connecting(dev, data, false);
179}
160 180
161static int exists_connecting_device(struct device_driver *drv) 181static int exists_essential_connecting_device(struct device_driver *drv)
162{ 182{
163 return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, 183 return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
164 is_device_connecting); 184 essential_device_connecting);
185}
186static int exists_non_essential_connecting_device(struct device_driver *drv)
187{
188 return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
189 non_essential_device_connecting);
165} 190}
166 191
167static int print_device_status(struct device *dev, void *data) 192static int print_device_status(struct device *dev, void *data)
@@ -192,6 +217,23 @@ static int print_device_status(struct device *dev, void *data)
192/* We only wait for device setup after most initcalls have run. */ 217/* We only wait for device setup after most initcalls have run. */
193static int ready_to_wait_for_devices; 218static int ready_to_wait_for_devices;
194 219
220static bool wait_loop(unsigned long start, unsigned int max_delay,
221 unsigned int *seconds_waited)
222{
223 if (time_after(jiffies, start + (*seconds_waited+5)*HZ)) {
224 if (!*seconds_waited)
225 printk(KERN_WARNING "XENBUS: Waiting for "
226 "devices to initialise: ");
227 *seconds_waited += 5;
228 printk("%us...", max_delay - *seconds_waited);
229 if (*seconds_waited == max_delay)
230 return true;
231 }
232
233 schedule_timeout_interruptible(HZ/10);
234
235 return false;
236}
195/* 237/*
196 * On a 5-minute timeout, wait for all devices currently configured. We need 238 * On a 5-minute timeout, wait for all devices currently configured. We need
197 * to do this to guarantee that the filesystems and / or network devices 239 * to do this to guarantee that the filesystems and / or network devices
@@ -215,19 +257,14 @@ static void wait_for_devices(struct xenbus_driver *xendrv)
215 if (!ready_to_wait_for_devices || !xen_domain()) 257 if (!ready_to_wait_for_devices || !xen_domain())
216 return; 258 return;
217 259
218 while (exists_connecting_device(drv)) { 260 while (exists_non_essential_connecting_device(drv))
219 if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { 261 if (wait_loop(start, 30, &seconds_waited))
220 if (!seconds_waited) 262 break;
221 printk(KERN_WARNING "XENBUS: Waiting for " 263
222 "devices to initialise: "); 264 /* Skips PVKB and PVFB check.*/
223 seconds_waited += 5; 265 while (exists_essential_connecting_device(drv))
224 printk("%us...", 300 - seconds_waited); 266 if (wait_loop(start, 270, &seconds_waited))
225 if (seconds_waited == 300) 267 break;
226 break;
227 }
228
229 schedule_timeout_interruptible(HZ/10);
230 }
231 268
232 if (seconds_waited) 269 if (seconds_waited)
233 printk("\n"); 270 printk("\n");
diff --git a/fs/aio.c b/fs/aio.c
index da887604dfc5..67a6db3e1b6f 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -93,9 +93,8 @@ static void aio_free_ring(struct kioctx *ctx)
93 put_page(info->ring_pages[i]); 93 put_page(info->ring_pages[i]);
94 94
95 if (info->mmap_size) { 95 if (info->mmap_size) {
96 down_write(&ctx->mm->mmap_sem); 96 BUG_ON(ctx->mm != current->mm);
97 do_munmap(ctx->mm, info->mmap_base, info->mmap_size); 97 vm_munmap(info->mmap_base, info->mmap_size);
98 up_write(&ctx->mm->mmap_sem);
99 } 98 }
100 99
101 if (info->ring_pages && info->ring_pages != info->internal_pages) 100 if (info->ring_pages && info->ring_pages != info->internal_pages)
@@ -389,6 +388,17 @@ void exit_aio(struct mm_struct *mm)
389 "exit_aio:ioctx still alive: %d %d %d\n", 388 "exit_aio:ioctx still alive: %d %d %d\n",
390 atomic_read(&ctx->users), ctx->dead, 389 atomic_read(&ctx->users), ctx->dead,
391 ctx->reqs_active); 390 ctx->reqs_active);
391 /*
392 * We don't need to bother with munmap() here -
393 * exit_mmap(mm) is coming and it'll unmap everything.
394 * Since aio_free_ring() uses non-zero ->mmap_size
395 * as indicator that it needs to unmap the area,
396 * just set it to 0; aio_free_ring() is the only
397 * place that uses ->mmap_size, so it's safe.
398 * That way we get all munmap done to current->mm -
399 * all other callers have ctx->mm == current->mm.
400 */
401 ctx->ring_info.mmap_size = 0;
392 put_ioctx(ctx); 402 put_ioctx(ctx);
393 } 403 }
394} 404}
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index 2eb12f13593d..d146e181d10d 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -50,9 +50,7 @@ static int set_brk(unsigned long start, unsigned long end)
50 end = PAGE_ALIGN(end); 50 end = PAGE_ALIGN(end);
51 if (end > start) { 51 if (end > start) {
52 unsigned long addr; 52 unsigned long addr;
53 down_write(&current->mm->mmap_sem); 53 addr = vm_brk(start, end - start);
54 addr = do_brk(start, end - start);
55 up_write(&current->mm->mmap_sem);
56 if (BAD_ADDR(addr)) 54 if (BAD_ADDR(addr))
57 return addr; 55 return addr;
58 } 56 }
@@ -280,9 +278,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
280 pos = 32; 278 pos = 32;
281 map_size = ex.a_text+ex.a_data; 279 map_size = ex.a_text+ex.a_data;
282#endif 280#endif
283 down_write(&current->mm->mmap_sem); 281 error = vm_brk(text_addr & PAGE_MASK, map_size);
284 error = do_brk(text_addr & PAGE_MASK, map_size);
285 up_write(&current->mm->mmap_sem);
286 if (error != (text_addr & PAGE_MASK)) { 282 if (error != (text_addr & PAGE_MASK)) {
287 send_sig(SIGKILL, current, 0); 283 send_sig(SIGKILL, current, 0);
288 return error; 284 return error;
@@ -313,9 +309,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
313 309
314 if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { 310 if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) {
315 loff_t pos = fd_offset; 311 loff_t pos = fd_offset;
316 down_write(&current->mm->mmap_sem); 312 vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
317 do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
318 up_write(&current->mm->mmap_sem);
319 bprm->file->f_op->read(bprm->file, 313 bprm->file->f_op->read(bprm->file,
320 (char __user *)N_TXTADDR(ex), 314 (char __user *)N_TXTADDR(ex),
321 ex.a_text+ex.a_data, &pos); 315 ex.a_text+ex.a_data, &pos);
@@ -325,24 +319,20 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
325 goto beyond_if; 319 goto beyond_if;
326 } 320 }
327 321
328 down_write(&current->mm->mmap_sem); 322 error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text,
329 error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text,
330 PROT_READ | PROT_EXEC, 323 PROT_READ | PROT_EXEC,
331 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, 324 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
332 fd_offset); 325 fd_offset);
333 up_write(&current->mm->mmap_sem);
334 326
335 if (error != N_TXTADDR(ex)) { 327 if (error != N_TXTADDR(ex)) {
336 send_sig(SIGKILL, current, 0); 328 send_sig(SIGKILL, current, 0);
337 return error; 329 return error;
338 } 330 }
339 331
340 down_write(&current->mm->mmap_sem); 332 error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
341 error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
342 PROT_READ | PROT_WRITE | PROT_EXEC, 333 PROT_READ | PROT_WRITE | PROT_EXEC,
343 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, 334 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
344 fd_offset + ex.a_text); 335 fd_offset + ex.a_text);
345 up_write(&current->mm->mmap_sem);
346 if (error != N_DATADDR(ex)) { 336 if (error != N_DATADDR(ex)) {
347 send_sig(SIGKILL, current, 0); 337 send_sig(SIGKILL, current, 0);
348 return error; 338 return error;
@@ -412,9 +402,7 @@ static int load_aout_library(struct file *file)
412 "N_TXTOFF is not page aligned. Please convert library: %s\n", 402 "N_TXTOFF is not page aligned. Please convert library: %s\n",
413 file->f_path.dentry->d_name.name); 403 file->f_path.dentry->d_name.name);
414 } 404 }
415 down_write(&current->mm->mmap_sem); 405 vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
416 do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
417 up_write(&current->mm->mmap_sem);
418 406
419 file->f_op->read(file, (char __user *)start_addr, 407 file->f_op->read(file, (char __user *)start_addr,
420 ex.a_text + ex.a_data, &pos); 408 ex.a_text + ex.a_data, &pos);
@@ -425,12 +413,10 @@ static int load_aout_library(struct file *file)
425 goto out; 413 goto out;
426 } 414 }
427 /* Now use mmap to map the library into memory. */ 415 /* Now use mmap to map the library into memory. */
428 down_write(&current->mm->mmap_sem); 416 error = vm_mmap(file, start_addr, ex.a_text + ex.a_data,
429 error = do_mmap(file, start_addr, ex.a_text + ex.a_data,
430 PROT_READ | PROT_WRITE | PROT_EXEC, 417 PROT_READ | PROT_WRITE | PROT_EXEC,
431 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, 418 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE,
432 N_TXTOFF(ex)); 419 N_TXTOFF(ex));
433 up_write(&current->mm->mmap_sem);
434 retval = error; 420 retval = error;
435 if (error != start_addr) 421 if (error != start_addr)
436 goto out; 422 goto out;
@@ -438,9 +424,7 @@ static int load_aout_library(struct file *file)
438 len = PAGE_ALIGN(ex.a_text + ex.a_data); 424 len = PAGE_ALIGN(ex.a_text + ex.a_data);
439 bss = ex.a_text + ex.a_data + ex.a_bss; 425 bss = ex.a_text + ex.a_data + ex.a_bss;
440 if (bss > len) { 426 if (bss > len) {
441 down_write(&current->mm->mmap_sem); 427 error = vm_brk(start_addr + len, bss - len);
442 error = do_brk(start_addr + len, bss - len);
443 up_write(&current->mm->mmap_sem);
444 retval = error; 428 retval = error;
445 if (error != start_addr + len) 429 if (error != start_addr + len)
446 goto out; 430 goto out;
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 48ffb3dc610a..16f735417072 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -82,9 +82,7 @@ static int set_brk(unsigned long start, unsigned long end)
82 end = ELF_PAGEALIGN(end); 82 end = ELF_PAGEALIGN(end);
83 if (end > start) { 83 if (end > start) {
84 unsigned long addr; 84 unsigned long addr;
85 down_write(&current->mm->mmap_sem); 85 addr = vm_brk(start, end - start);
86 addr = do_brk(start, end - start);
87 up_write(&current->mm->mmap_sem);
88 if (BAD_ADDR(addr)) 86 if (BAD_ADDR(addr))
89 return addr; 87 return addr;
90 } 88 }
@@ -514,9 +512,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
514 elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); 512 elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1);
515 513
516 /* Map the last of the bss segment */ 514 /* Map the last of the bss segment */
517 down_write(&current->mm->mmap_sem); 515 error = vm_brk(elf_bss, last_bss - elf_bss);
518 error = do_brk(elf_bss, last_bss - elf_bss);
519 up_write(&current->mm->mmap_sem);
520 if (BAD_ADDR(error)) 516 if (BAD_ADDR(error))
521 goto out_close; 517 goto out_close;
522 } 518 }
@@ -962,10 +958,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
962 and some applications "depend" upon this behavior. 958 and some applications "depend" upon this behavior.
963 Since we do not have the power to recompile these, we 959 Since we do not have the power to recompile these, we
964 emulate the SVr4 behavior. Sigh. */ 960 emulate the SVr4 behavior. Sigh. */
965 down_write(&current->mm->mmap_sem); 961 error = vm_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC,
966 error = do_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC,
967 MAP_FIXED | MAP_PRIVATE, 0); 962 MAP_FIXED | MAP_PRIVATE, 0);
968 up_write(&current->mm->mmap_sem);
969 } 963 }
970 964
971#ifdef ELF_PLAT_INIT 965#ifdef ELF_PLAT_INIT
@@ -1050,8 +1044,7 @@ static int load_elf_library(struct file *file)
1050 eppnt++; 1044 eppnt++;
1051 1045
1052 /* Now use mmap to map the library into memory. */ 1046 /* Now use mmap to map the library into memory. */
1053 down_write(&current->mm->mmap_sem); 1047 error = vm_mmap(file,
1054 error = do_mmap(file,
1055 ELF_PAGESTART(eppnt->p_vaddr), 1048 ELF_PAGESTART(eppnt->p_vaddr),
1056 (eppnt->p_filesz + 1049 (eppnt->p_filesz +
1057 ELF_PAGEOFFSET(eppnt->p_vaddr)), 1050 ELF_PAGEOFFSET(eppnt->p_vaddr)),
@@ -1059,7 +1052,6 @@ static int load_elf_library(struct file *file)
1059 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, 1052 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE,
1060 (eppnt->p_offset - 1053 (eppnt->p_offset -
1061 ELF_PAGEOFFSET(eppnt->p_vaddr))); 1054 ELF_PAGEOFFSET(eppnt->p_vaddr)));
1062 up_write(&current->mm->mmap_sem);
1063 if (error != ELF_PAGESTART(eppnt->p_vaddr)) 1055 if (error != ELF_PAGESTART(eppnt->p_vaddr))
1064 goto out_free_ph; 1056 goto out_free_ph;
1065 1057
@@ -1072,11 +1064,8 @@ static int load_elf_library(struct file *file)
1072 len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + 1064 len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr +
1073 ELF_MIN_ALIGN - 1); 1065 ELF_MIN_ALIGN - 1);
1074 bss = eppnt->p_memsz + eppnt->p_vaddr; 1066 bss = eppnt->p_memsz + eppnt->p_vaddr;
1075 if (bss > len) { 1067 if (bss > len)
1076 down_write(&current->mm->mmap_sem); 1068 vm_brk(len, bss - len);
1077 do_brk(len, bss - len);
1078 up_write(&current->mm->mmap_sem);
1079 }
1080 error = 0; 1069 error = 0;
1081 1070
1082out_free_ph: 1071out_free_ph:
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 9bd5612a8224..d390a0fffc65 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -390,21 +390,17 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
390 (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC)) 390 (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC))
391 stack_prot |= PROT_EXEC; 391 stack_prot |= PROT_EXEC;
392 392
393 down_write(&current->mm->mmap_sem); 393 current->mm->start_brk = vm_mmap(NULL, 0, stack_size, stack_prot,
394 current->mm->start_brk = do_mmap(NULL, 0, stack_size, stack_prot,
395 MAP_PRIVATE | MAP_ANONYMOUS | 394 MAP_PRIVATE | MAP_ANONYMOUS |
396 MAP_UNINITIALIZED | MAP_GROWSDOWN, 395 MAP_UNINITIALIZED | MAP_GROWSDOWN,
397 0); 396 0);
398 397
399 if (IS_ERR_VALUE(current->mm->start_brk)) { 398 if (IS_ERR_VALUE(current->mm->start_brk)) {
400 up_write(&current->mm->mmap_sem);
401 retval = current->mm->start_brk; 399 retval = current->mm->start_brk;
402 current->mm->start_brk = 0; 400 current->mm->start_brk = 0;
403 goto error_kill; 401 goto error_kill;
404 } 402 }
405 403
406 up_write(&current->mm->mmap_sem);
407
408 current->mm->brk = current->mm->start_brk; 404 current->mm->brk = current->mm->start_brk;
409 current->mm->context.end_brk = current->mm->start_brk; 405 current->mm->context.end_brk = current->mm->start_brk;
410 current->mm->context.end_brk += 406 current->mm->context.end_brk +=
@@ -955,10 +951,8 @@ static int elf_fdpic_map_file_constdisp_on_uclinux(
955 if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE) 951 if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE)
956 mflags |= MAP_EXECUTABLE; 952 mflags |= MAP_EXECUTABLE;
957 953
958 down_write(&mm->mmap_sem); 954 maddr = vm_mmap(NULL, load_addr, top - base,
959 maddr = do_mmap(NULL, load_addr, top - base,
960 PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0); 955 PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0);
961 up_write(&mm->mmap_sem);
962 if (IS_ERR_VALUE(maddr)) 956 if (IS_ERR_VALUE(maddr))
963 return (int) maddr; 957 return (int) maddr;
964 958
@@ -1096,10 +1090,8 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
1096 1090
1097 /* create the mapping */ 1091 /* create the mapping */
1098 disp = phdr->p_vaddr & ~PAGE_MASK; 1092 disp = phdr->p_vaddr & ~PAGE_MASK;
1099 down_write(&mm->mmap_sem); 1093 maddr = vm_mmap(file, maddr, phdr->p_memsz + disp, prot, flags,
1100 maddr = do_mmap(file, maddr, phdr->p_memsz + disp, prot, flags,
1101 phdr->p_offset - disp); 1094 phdr->p_offset - disp);
1102 up_write(&mm->mmap_sem);
1103 1095
1104 kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx", 1096 kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx",
1105 loop, phdr->p_memsz + disp, prot, flags, 1097 loop, phdr->p_memsz + disp, prot, flags,
@@ -1143,10 +1135,8 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
1143 unsigned long xmaddr; 1135 unsigned long xmaddr;
1144 1136
1145 flags |= MAP_FIXED | MAP_ANONYMOUS; 1137 flags |= MAP_FIXED | MAP_ANONYMOUS;
1146 down_write(&mm->mmap_sem); 1138 xmaddr = vm_mmap(NULL, xaddr, excess - excess1,
1147 xmaddr = do_mmap(NULL, xaddr, excess - excess1,
1148 prot, flags, 0); 1139 prot, flags, 0);
1149 up_write(&mm->mmap_sem);
1150 1140
1151 kdebug("mmap[%d] <anon>" 1141 kdebug("mmap[%d] <anon>"
1152 " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx", 1142 " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx",
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 024d20ee3ca3..6b2daf99fab8 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -542,10 +542,8 @@ static int load_flat_file(struct linux_binprm * bprm,
542 */ 542 */
543 DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n"); 543 DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n");
544 544
545 down_write(&current->mm->mmap_sem); 545 textpos = vm_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC,
546 textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC,
547 MAP_PRIVATE|MAP_EXECUTABLE, 0); 546 MAP_PRIVATE|MAP_EXECUTABLE, 0);
548 up_write(&current->mm->mmap_sem);
549 if (!textpos || IS_ERR_VALUE(textpos)) { 547 if (!textpos || IS_ERR_VALUE(textpos)) {
550 if (!textpos) 548 if (!textpos)
551 textpos = (unsigned long) -ENOMEM; 549 textpos = (unsigned long) -ENOMEM;
@@ -556,10 +554,8 @@ static int load_flat_file(struct linux_binprm * bprm,
556 554
557 len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); 555 len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long);
558 len = PAGE_ALIGN(len); 556 len = PAGE_ALIGN(len);
559 down_write(&current->mm->mmap_sem); 557 realdatastart = vm_mmap(0, 0, len,
560 realdatastart = do_mmap(0, 0, len,
561 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); 558 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
562 up_write(&current->mm->mmap_sem);
563 559
564 if (realdatastart == 0 || IS_ERR_VALUE(realdatastart)) { 560 if (realdatastart == 0 || IS_ERR_VALUE(realdatastart)) {
565 if (!realdatastart) 561 if (!realdatastart)
@@ -603,10 +599,8 @@ static int load_flat_file(struct linux_binprm * bprm,
603 599
604 len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); 600 len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long);
605 len = PAGE_ALIGN(len); 601 len = PAGE_ALIGN(len);
606 down_write(&current->mm->mmap_sem); 602 textpos = vm_mmap(0, 0, len,
607 textpos = do_mmap(0, 0, len,
608 PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); 603 PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
609 up_write(&current->mm->mmap_sem);
610 604
611 if (!textpos || IS_ERR_VALUE(textpos)) { 605 if (!textpos || IS_ERR_VALUE(textpos)) {
612 if (!textpos) 606 if (!textpos)
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c
index e4fc746629a7..4517aaff61b4 100644
--- a/fs/binfmt_som.c
+++ b/fs/binfmt_som.c
@@ -147,10 +147,8 @@ static int map_som_binary(struct file *file,
147 code_size = SOM_PAGEALIGN(hpuxhdr->exec_tsize); 147 code_size = SOM_PAGEALIGN(hpuxhdr->exec_tsize);
148 current->mm->start_code = code_start; 148 current->mm->start_code = code_start;
149 current->mm->end_code = code_start + code_size; 149 current->mm->end_code = code_start + code_size;
150 down_write(&current->mm->mmap_sem); 150 retval = vm_mmap(file, code_start, code_size, prot,
151 retval = do_mmap(file, code_start, code_size, prot,
152 flags, SOM_PAGESTART(hpuxhdr->exec_tfile)); 151 flags, SOM_PAGESTART(hpuxhdr->exec_tfile));
153 up_write(&current->mm->mmap_sem);
154 if (retval < 0 && retval > -1024) 152 if (retval < 0 && retval > -1024)
155 goto out; 153 goto out;
156 154
@@ -158,20 +156,16 @@ static int map_som_binary(struct file *file,
158 data_size = SOM_PAGEALIGN(hpuxhdr->exec_dsize); 156 data_size = SOM_PAGEALIGN(hpuxhdr->exec_dsize);
159 current->mm->start_data = data_start; 157 current->mm->start_data = data_start;
160 current->mm->end_data = bss_start = data_start + data_size; 158 current->mm->end_data = bss_start = data_start + data_size;
161 down_write(&current->mm->mmap_sem); 159 retval = vm_mmap(file, data_start, data_size,
162 retval = do_mmap(file, data_start, data_size,
163 prot | PROT_WRITE, flags, 160 prot | PROT_WRITE, flags,
164 SOM_PAGESTART(hpuxhdr->exec_dfile)); 161 SOM_PAGESTART(hpuxhdr->exec_dfile));
165 up_write(&current->mm->mmap_sem);
166 if (retval < 0 && retval > -1024) 162 if (retval < 0 && retval > -1024)
167 goto out; 163 goto out;
168 164
169 som_brk = bss_start + SOM_PAGEALIGN(hpuxhdr->exec_bsize); 165 som_brk = bss_start + SOM_PAGEALIGN(hpuxhdr->exec_bsize);
170 current->mm->start_brk = current->mm->brk = som_brk; 166 current->mm->start_brk = current->mm->brk = som_brk;
171 down_write(&current->mm->mmap_sem); 167 retval = vm_mmap(NULL, bss_start, som_brk - bss_start,
172 retval = do_mmap(NULL, bss_start, som_brk - bss_start,
173 prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, 0); 168 prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, 0);
174 up_write(&current->mm->mmap_sem);
175 if (retval > 0 || retval < -1024) 169 if (retval > 0 || retval < -1024)
176 retval = 0; 170 retval = 0;
177out: 171out:
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 5b8ef8eb3521..3f65a812e282 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2166,7 +2166,7 @@ BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item,
2166 2166
2167static inline bool btrfs_root_readonly(struct btrfs_root *root) 2167static inline bool btrfs_root_readonly(struct btrfs_root *root)
2168{ 2168{
2169 return root->root_item.flags & BTRFS_ROOT_SUBVOL_RDONLY; 2169 return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0;
2170} 2170}
2171 2171
2172/* struct btrfs_root_backup */ 2172/* struct btrfs_root_backup */
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d81e933a796b..f31dc9ac37b7 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -109,6 +109,8 @@ enum {
109 109
110 /* Options which could be blank */ 110 /* Options which could be blank */
111 Opt_blank_pass, 111 Opt_blank_pass,
112 Opt_blank_user,
113 Opt_blank_ip,
112 114
113 Opt_err 115 Opt_err
114}; 116};
@@ -183,11 +185,15 @@ static const match_table_t cifs_mount_option_tokens = {
183 { Opt_wsize, "wsize=%s" }, 185 { Opt_wsize, "wsize=%s" },
184 { Opt_actimeo, "actimeo=%s" }, 186 { Opt_actimeo, "actimeo=%s" },
185 187
188 { Opt_blank_user, "user=" },
189 { Opt_blank_user, "username=" },
186 { Opt_user, "user=%s" }, 190 { Opt_user, "user=%s" },
187 { Opt_user, "username=%s" }, 191 { Opt_user, "username=%s" },
188 { Opt_blank_pass, "pass=" }, 192 { Opt_blank_pass, "pass=" },
189 { Opt_pass, "pass=%s" }, 193 { Opt_pass, "pass=%s" },
190 { Opt_pass, "password=%s" }, 194 { Opt_pass, "password=%s" },
195 { Opt_blank_ip, "ip=" },
196 { Opt_blank_ip, "addr=" },
191 { Opt_ip, "ip=%s" }, 197 { Opt_ip, "ip=%s" },
192 { Opt_ip, "addr=%s" }, 198 { Opt_ip, "addr=%s" },
193 { Opt_unc, "unc=%s" }, 199 { Opt_unc, "unc=%s" },
@@ -1117,7 +1123,7 @@ static int get_option_ul(substring_t args[], unsigned long *option)
1117 string = match_strdup(args); 1123 string = match_strdup(args);
1118 if (string == NULL) 1124 if (string == NULL)
1119 return -ENOMEM; 1125 return -ENOMEM;
1120 rc = kstrtoul(string, 10, option); 1126 rc = kstrtoul(string, 0, option);
1121 kfree(string); 1127 kfree(string);
1122 1128
1123 return rc; 1129 return rc;
@@ -1534,15 +1540,17 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1534 1540
1535 /* String Arguments */ 1541 /* String Arguments */
1536 1542
1543 case Opt_blank_user:
1544 /* null user, ie. anonymous authentication */
1545 vol->nullauth = 1;
1546 vol->username = NULL;
1547 break;
1537 case Opt_user: 1548 case Opt_user:
1538 string = match_strdup(args); 1549 string = match_strdup(args);
1539 if (string == NULL) 1550 if (string == NULL)
1540 goto out_nomem; 1551 goto out_nomem;
1541 1552
1542 if (!*string) { 1553 if (strnlen(string, MAX_USERNAME_SIZE) >
1543 /* null user, ie. anonymous authentication */
1544 vol->nullauth = 1;
1545 } else if (strnlen(string, MAX_USERNAME_SIZE) >
1546 MAX_USERNAME_SIZE) { 1554 MAX_USERNAME_SIZE) {
1547 printk(KERN_WARNING "CIFS: username too long\n"); 1555 printk(KERN_WARNING "CIFS: username too long\n");
1548 goto cifs_parse_mount_err; 1556 goto cifs_parse_mount_err;
@@ -1611,14 +1619,15 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1611 } 1619 }
1612 vol->password[j] = '\0'; 1620 vol->password[j] = '\0';
1613 break; 1621 break;
1622 case Opt_blank_ip:
1623 vol->UNCip = NULL;
1624 break;
1614 case Opt_ip: 1625 case Opt_ip:
1615 string = match_strdup(args); 1626 string = match_strdup(args);
1616 if (string == NULL) 1627 if (string == NULL)
1617 goto out_nomem; 1628 goto out_nomem;
1618 1629
1619 if (!*string) { 1630 if (strnlen(string, INET6_ADDRSTRLEN) >
1620 vol->UNCip = NULL;
1621 } else if (strnlen(string, INET6_ADDRSTRLEN) >
1622 INET6_ADDRSTRLEN) { 1631 INET6_ADDRSTRLEN) {
1623 printk(KERN_WARNING "CIFS: ip address " 1632 printk(KERN_WARNING "CIFS: ip address "
1624 "too long\n"); 1633 "too long\n");
@@ -1636,12 +1645,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1636 if (string == NULL) 1645 if (string == NULL)
1637 goto out_nomem; 1646 goto out_nomem;
1638 1647
1639 if (!*string) {
1640 printk(KERN_WARNING "CIFS: invalid path to "
1641 "network resource\n");
1642 goto cifs_parse_mount_err;
1643 }
1644
1645 temp_len = strnlen(string, 300); 1648 temp_len = strnlen(string, 300);
1646 if (temp_len == 300) { 1649 if (temp_len == 300) {
1647 printk(KERN_WARNING "CIFS: UNC name too long\n"); 1650 printk(KERN_WARNING "CIFS: UNC name too long\n");
@@ -1670,11 +1673,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1670 if (string == NULL) 1673 if (string == NULL)
1671 goto out_nomem; 1674 goto out_nomem;
1672 1675
1673 if (!*string) { 1676 if (strnlen(string, 256) == 256) {
1674 printk(KERN_WARNING "CIFS: invalid domain"
1675 " name\n");
1676 goto cifs_parse_mount_err;
1677 } else if (strnlen(string, 256) == 256) {
1678 printk(KERN_WARNING "CIFS: domain name too" 1677 printk(KERN_WARNING "CIFS: domain name too"
1679 " long\n"); 1678 " long\n");
1680 goto cifs_parse_mount_err; 1679 goto cifs_parse_mount_err;
@@ -1693,11 +1692,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1693 if (string == NULL) 1692 if (string == NULL)
1694 goto out_nomem; 1693 goto out_nomem;
1695 1694
1696 if (!*string) { 1695 if (!cifs_convert_address(
1697 printk(KERN_WARNING "CIFS: srcaddr value not"
1698 " specified\n");
1699 goto cifs_parse_mount_err;
1700 } else if (!cifs_convert_address(
1701 (struct sockaddr *)&vol->srcaddr, 1696 (struct sockaddr *)&vol->srcaddr,
1702 string, strlen(string))) { 1697 string, strlen(string))) {
1703 printk(KERN_WARNING "CIFS: Could not parse" 1698 printk(KERN_WARNING "CIFS: Could not parse"
@@ -1710,11 +1705,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1710 if (string == NULL) 1705 if (string == NULL)
1711 goto out_nomem; 1706 goto out_nomem;
1712 1707
1713 if (!*string) {
1714 printk(KERN_WARNING "CIFS: Invalid path"
1715 " prefix\n");
1716 goto cifs_parse_mount_err;
1717 }
1718 temp_len = strnlen(string, 1024); 1708 temp_len = strnlen(string, 1024);
1719 if (string[0] != '/') 1709 if (string[0] != '/')
1720 temp_len++; /* missing leading slash */ 1710 temp_len++; /* missing leading slash */
@@ -1742,11 +1732,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1742 if (string == NULL) 1732 if (string == NULL)
1743 goto out_nomem; 1733 goto out_nomem;
1744 1734
1745 if (!*string) { 1735 if (strnlen(string, 1024) >= 65) {
1746 printk(KERN_WARNING "CIFS: Invalid iocharset"
1747 " specified\n");
1748 goto cifs_parse_mount_err;
1749 } else if (strnlen(string, 1024) >= 65) {
1750 printk(KERN_WARNING "CIFS: iocharset name " 1736 printk(KERN_WARNING "CIFS: iocharset name "
1751 "too long.\n"); 1737 "too long.\n");
1752 goto cifs_parse_mount_err; 1738 goto cifs_parse_mount_err;
@@ -1771,11 +1757,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1771 if (string == NULL) 1757 if (string == NULL)
1772 goto out_nomem; 1758 goto out_nomem;
1773 1759
1774 if (!*string) {
1775 printk(KERN_WARNING "CIFS: No socket option"
1776 " specified\n");
1777 goto cifs_parse_mount_err;
1778 }
1779 if (strnicmp(string, "TCP_NODELAY", 11) == 0) 1760 if (strnicmp(string, "TCP_NODELAY", 11) == 0)
1780 vol->sockopt_tcp_nodelay = 1; 1761 vol->sockopt_tcp_nodelay = 1;
1781 break; 1762 break;
@@ -1784,12 +1765,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1784 if (string == NULL) 1765 if (string == NULL)
1785 goto out_nomem; 1766 goto out_nomem;
1786 1767
1787 if (!*string) {
1788 printk(KERN_WARNING "CIFS: Invalid (empty)"
1789 " netbiosname\n");
1790 break;
1791 }
1792
1793 memset(vol->source_rfc1001_name, 0x20, 1768 memset(vol->source_rfc1001_name, 0x20,
1794 RFC1001_NAME_LEN); 1769 RFC1001_NAME_LEN);
1795 /* 1770 /*
@@ -1817,11 +1792,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1817 if (string == NULL) 1792 if (string == NULL)
1818 goto out_nomem; 1793 goto out_nomem;
1819 1794
1820 if (!*string) {
1821 printk(KERN_WARNING "CIFS: Empty server"
1822 " netbiosname specified\n");
1823 break;
1824 }
1825 /* last byte, type, is 0x20 for servr type */ 1795 /* last byte, type, is 0x20 for servr type */
1826 memset(vol->target_rfc1001_name, 0x20, 1796 memset(vol->target_rfc1001_name, 0x20,
1827 RFC1001_NAME_LEN_WITH_NULL); 1797 RFC1001_NAME_LEN_WITH_NULL);
@@ -1848,12 +1818,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1848 if (string == NULL) 1818 if (string == NULL)
1849 goto out_nomem; 1819 goto out_nomem;
1850 1820
1851 if (!*string) {
1852 cERROR(1, "no protocol version specified"
1853 " after vers= mount option");
1854 goto cifs_parse_mount_err;
1855 }
1856
1857 if (strnicmp(string, "cifs", 4) == 0 || 1821 if (strnicmp(string, "cifs", 4) == 0 ||
1858 strnicmp(string, "1", 1) == 0) { 1822 strnicmp(string, "1", 1) == 0) {
1859 /* This is the default */ 1823 /* This is the default */
@@ -1868,12 +1832,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1868 if (string == NULL) 1832 if (string == NULL)
1869 goto out_nomem; 1833 goto out_nomem;
1870 1834
1871 if (!*string) {
1872 printk(KERN_WARNING "CIFS: no security flavor"
1873 " specified\n");
1874 break;
1875 }
1876
1877 if (cifs_parse_security_flavors(string, vol) != 0) 1835 if (cifs_parse_security_flavors(string, vol) != 0)
1878 goto cifs_parse_mount_err; 1836 goto cifs_parse_mount_err;
1879 break; 1837 break;
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index ab2594a30f86..0e01e90add8b 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1203,9 +1203,6 @@ struct ext4_sb_info {
1203 unsigned long s_ext_blocks; 1203 unsigned long s_ext_blocks;
1204 unsigned long s_ext_extents; 1204 unsigned long s_ext_extents;
1205#endif 1205#endif
1206 /* ext4 extent cache stats */
1207 unsigned long extent_cache_hits;
1208 unsigned long extent_cache_misses;
1209 1206
1210 /* for buddy allocator */ 1207 /* for buddy allocator */
1211 struct ext4_group_info ***s_group_info; 1208 struct ext4_group_info ***s_group_info;
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 1421938e6792..abcdeab67f52 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2066,10 +2066,6 @@ static int ext4_ext_check_cache(struct inode *inode, ext4_lblk_t block,
2066 ret = 1; 2066 ret = 1;
2067 } 2067 }
2068errout: 2068errout:
2069 if (!ret)
2070 sbi->extent_cache_misses++;
2071 else
2072 sbi->extent_cache_hits++;
2073 trace_ext4_ext_in_cache(inode, block, ret); 2069 trace_ext4_ext_in_cache(inode, block, ret);
2074 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 2070 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
2075 return ret; 2071 return ret;
@@ -2882,7 +2878,7 @@ static int ext4_split_extent_at(handle_t *handle,
2882 if (err) 2878 if (err)
2883 goto fix_extent_len; 2879 goto fix_extent_len;
2884 /* update the extent length and mark as initialized */ 2880 /* update the extent length and mark as initialized */
2885 ex->ee_len = cpu_to_le32(ee_len); 2881 ex->ee_len = cpu_to_le16(ee_len);
2886 ext4_ext_try_to_merge(inode, path, ex); 2882 ext4_ext_try_to_merge(inode, path, ex);
2887 err = ext4_ext_dirty(handle, inode, path + depth); 2883 err = ext4_ext_dirty(handle, inode, path + depth);
2888 goto out; 2884 goto out;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index ceebaf853beb..6da193564e43 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1305,20 +1305,20 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
1305 ext4_msg(sb, KERN_ERR, 1305 ext4_msg(sb, KERN_ERR,
1306 "Cannot change journaled " 1306 "Cannot change journaled "
1307 "quota options when quota turned on"); 1307 "quota options when quota turned on");
1308 return 0; 1308 return -1;
1309 } 1309 }
1310 qname = match_strdup(args); 1310 qname = match_strdup(args);
1311 if (!qname) { 1311 if (!qname) {
1312 ext4_msg(sb, KERN_ERR, 1312 ext4_msg(sb, KERN_ERR,
1313 "Not enough memory for storing quotafile name"); 1313 "Not enough memory for storing quotafile name");
1314 return 0; 1314 return -1;
1315 } 1315 }
1316 if (sbi->s_qf_names[qtype] && 1316 if (sbi->s_qf_names[qtype] &&
1317 strcmp(sbi->s_qf_names[qtype], qname)) { 1317 strcmp(sbi->s_qf_names[qtype], qname)) {
1318 ext4_msg(sb, KERN_ERR, 1318 ext4_msg(sb, KERN_ERR,
1319 "%s quota file already specified", QTYPE2NAME(qtype)); 1319 "%s quota file already specified", QTYPE2NAME(qtype));
1320 kfree(qname); 1320 kfree(qname);
1321 return 0; 1321 return -1;
1322 } 1322 }
1323 sbi->s_qf_names[qtype] = qname; 1323 sbi->s_qf_names[qtype] = qname;
1324 if (strchr(sbi->s_qf_names[qtype], '/')) { 1324 if (strchr(sbi->s_qf_names[qtype], '/')) {
@@ -1326,7 +1326,7 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
1326 "quotafile must be on filesystem root"); 1326 "quotafile must be on filesystem root");
1327 kfree(sbi->s_qf_names[qtype]); 1327 kfree(sbi->s_qf_names[qtype]);
1328 sbi->s_qf_names[qtype] = NULL; 1328 sbi->s_qf_names[qtype] = NULL;
1329 return 0; 1329 return -1;
1330 } 1330 }
1331 set_opt(sb, QUOTA); 1331 set_opt(sb, QUOTA);
1332 return 1; 1332 return 1;
@@ -1341,7 +1341,7 @@ static int clear_qf_name(struct super_block *sb, int qtype)
1341 sbi->s_qf_names[qtype]) { 1341 sbi->s_qf_names[qtype]) {
1342 ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options" 1342 ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options"
1343 " when quota turned on"); 1343 " when quota turned on");
1344 return 0; 1344 return -1;
1345 } 1345 }
1346 /* 1346 /*
1347 * The space will be released later when all options are confirmed 1347 * The space will be released later when all options are confirmed
@@ -1450,6 +1450,16 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1450 const struct mount_opts *m; 1450 const struct mount_opts *m;
1451 int arg = 0; 1451 int arg = 0;
1452 1452
1453#ifdef CONFIG_QUOTA
1454 if (token == Opt_usrjquota)
1455 return set_qf_name(sb, USRQUOTA, &args[0]);
1456 else if (token == Opt_grpjquota)
1457 return set_qf_name(sb, GRPQUOTA, &args[0]);
1458 else if (token == Opt_offusrjquota)
1459 return clear_qf_name(sb, USRQUOTA);
1460 else if (token == Opt_offgrpjquota)
1461 return clear_qf_name(sb, GRPQUOTA);
1462#endif
1453 if (args->from && match_int(args, &arg)) 1463 if (args->from && match_int(args, &arg))
1454 return -1; 1464 return -1;
1455 switch (token) { 1465 switch (token) {
@@ -1549,18 +1559,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1549 sbi->s_mount_opt |= m->mount_opt; 1559 sbi->s_mount_opt |= m->mount_opt;
1550 } 1560 }
1551#ifdef CONFIG_QUOTA 1561#ifdef CONFIG_QUOTA
1552 } else if (token == Opt_usrjquota) {
1553 if (!set_qf_name(sb, USRQUOTA, &args[0]))
1554 return -1;
1555 } else if (token == Opt_grpjquota) {
1556 if (!set_qf_name(sb, GRPQUOTA, &args[0]))
1557 return -1;
1558 } else if (token == Opt_offusrjquota) {
1559 if (!clear_qf_name(sb, USRQUOTA))
1560 return -1;
1561 } else if (token == Opt_offgrpjquota) {
1562 if (!clear_qf_name(sb, GRPQUOTA))
1563 return -1;
1564 } else if (m->flags & MOPT_QFMT) { 1562 } else if (m->flags & MOPT_QFMT) {
1565 if (sb_any_quota_loaded(sb) && 1563 if (sb_any_quota_loaded(sb) &&
1566 sbi->s_jquota_fmt != m->mount_opt) { 1564 sbi->s_jquota_fmt != m->mount_opt) {
@@ -2366,18 +2364,6 @@ static ssize_t lifetime_write_kbytes_show(struct ext4_attr *a,
2366 EXT4_SB(sb)->s_sectors_written_start) >> 1))); 2364 EXT4_SB(sb)->s_sectors_written_start) >> 1)));
2367} 2365}
2368 2366
2369static ssize_t extent_cache_hits_show(struct ext4_attr *a,
2370 struct ext4_sb_info *sbi, char *buf)
2371{
2372 return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_hits);
2373}
2374
2375static ssize_t extent_cache_misses_show(struct ext4_attr *a,
2376 struct ext4_sb_info *sbi, char *buf)
2377{
2378 return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_misses);
2379}
2380
2381static ssize_t inode_readahead_blks_store(struct ext4_attr *a, 2367static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
2382 struct ext4_sb_info *sbi, 2368 struct ext4_sb_info *sbi,
2383 const char *buf, size_t count) 2369 const char *buf, size_t count)
@@ -2435,8 +2421,6 @@ static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store)
2435EXT4_RO_ATTR(delayed_allocation_blocks); 2421EXT4_RO_ATTR(delayed_allocation_blocks);
2436EXT4_RO_ATTR(session_write_kbytes); 2422EXT4_RO_ATTR(session_write_kbytes);
2437EXT4_RO_ATTR(lifetime_write_kbytes); 2423EXT4_RO_ATTR(lifetime_write_kbytes);
2438EXT4_RO_ATTR(extent_cache_hits);
2439EXT4_RO_ATTR(extent_cache_misses);
2440EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show, 2424EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show,
2441 inode_readahead_blks_store, s_inode_readahead_blks); 2425 inode_readahead_blks_store, s_inode_readahead_blks);
2442EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal); 2426EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal);
@@ -2452,8 +2436,6 @@ static struct attribute *ext4_attrs[] = {
2452 ATTR_LIST(delayed_allocation_blocks), 2436 ATTR_LIST(delayed_allocation_blocks),
2453 ATTR_LIST(session_write_kbytes), 2437 ATTR_LIST(session_write_kbytes),
2454 ATTR_LIST(lifetime_write_kbytes), 2438 ATTR_LIST(lifetime_write_kbytes),
2455 ATTR_LIST(extent_cache_hits),
2456 ATTR_LIST(extent_cache_misses),
2457 ATTR_LIST(inode_readahead_blks), 2439 ATTR_LIST(inode_readahead_blks),
2458 ATTR_LIST(inode_goal), 2440 ATTR_LIST(inode_goal),
2459 ATTR_LIST(mb_stats), 2441 ATTR_LIST(mb_stats),
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 206632887bb4..df5ac048dc74 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -387,9 +387,6 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
387 if (fc->no_create) 387 if (fc->no_create)
388 return -ENOSYS; 388 return -ENOSYS;
389 389
390 if (flags & O_DIRECT)
391 return -EINVAL;
392
393 forget = fuse_alloc_forget(); 390 forget = fuse_alloc_forget();
394 if (!forget) 391 if (!forget)
395 return -ENOMEM; 392 return -ENOMEM;
@@ -644,13 +641,12 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
644 fuse_put_request(fc, req); 641 fuse_put_request(fc, req);
645 if (!err) { 642 if (!err) {
646 struct inode *inode = entry->d_inode; 643 struct inode *inode = entry->d_inode;
644 struct fuse_inode *fi = get_fuse_inode(inode);
647 645
648 /* 646 spin_lock(&fc->lock);
649 * Set nlink to zero so the inode can be cleared, if the inode 647 fi->attr_version = ++fc->attr_version;
650 * does have more links this will be discovered at the next 648 drop_nlink(inode);
651 * lookup/getattr. 649 spin_unlock(&fc->lock);
652 */
653 clear_nlink(inode);
654 fuse_invalidate_attr(inode); 650 fuse_invalidate_attr(inode);
655 fuse_invalidate_attr(dir); 651 fuse_invalidate_attr(dir);
656 fuse_invalidate_entry_cache(entry); 652 fuse_invalidate_entry_cache(entry);
@@ -762,8 +758,17 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
762 will reflect changes in the backing inode (link count, 758 will reflect changes in the backing inode (link count,
763 etc.) 759 etc.)
764 */ 760 */
765 if (!err || err == -EINTR) 761 if (!err) {
762 struct fuse_inode *fi = get_fuse_inode(inode);
763
764 spin_lock(&fc->lock);
765 fi->attr_version = ++fc->attr_version;
766 inc_nlink(inode);
767 spin_unlock(&fc->lock);
768 fuse_invalidate_attr(inode);
769 } else if (err == -EINTR) {
766 fuse_invalidate_attr(inode); 770 fuse_invalidate_attr(inode);
771 }
767 return err; 772 return err;
768} 773}
769 774
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a841868bf9ce..504e61b7fd75 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -194,10 +194,6 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir)
194 struct fuse_conn *fc = get_fuse_conn(inode); 194 struct fuse_conn *fc = get_fuse_conn(inode);
195 int err; 195 int err;
196 196
197 /* VFS checks this, but only _after_ ->open() */
198 if (file->f_flags & O_DIRECT)
199 return -EINVAL;
200
201 err = generic_file_open(inode, file); 197 err = generic_file_open(inode, file);
202 if (err) 198 if (err)
203 return err; 199 return err;
@@ -932,17 +928,23 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
932 struct file *file = iocb->ki_filp; 928 struct file *file = iocb->ki_filp;
933 struct address_space *mapping = file->f_mapping; 929 struct address_space *mapping = file->f_mapping;
934 size_t count = 0; 930 size_t count = 0;
931 size_t ocount = 0;
935 ssize_t written = 0; 932 ssize_t written = 0;
933 ssize_t written_buffered = 0;
936 struct inode *inode = mapping->host; 934 struct inode *inode = mapping->host;
937 ssize_t err; 935 ssize_t err;
938 struct iov_iter i; 936 struct iov_iter i;
937 loff_t endbyte = 0;
939 938
940 WARN_ON(iocb->ki_pos != pos); 939 WARN_ON(iocb->ki_pos != pos);
941 940
942 err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ); 941 ocount = 0;
942 err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ);
943 if (err) 943 if (err)
944 return err; 944 return err;
945 945
946 count = ocount;
947
946 mutex_lock(&inode->i_mutex); 948 mutex_lock(&inode->i_mutex);
947 vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); 949 vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE);
948 950
@@ -962,11 +964,41 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
962 964
963 file_update_time(file); 965 file_update_time(file);
964 966
965 iov_iter_init(&i, iov, nr_segs, count, 0); 967 if (file->f_flags & O_DIRECT) {
966 written = fuse_perform_write(file, mapping, &i, pos); 968 written = generic_file_direct_write(iocb, iov, &nr_segs,
967 if (written >= 0) 969 pos, &iocb->ki_pos,
968 iocb->ki_pos = pos + written; 970 count, ocount);
971 if (written < 0 || written == count)
972 goto out;
973
974 pos += written;
975 count -= written;
969 976
977 iov_iter_init(&i, iov, nr_segs, count, written);
978 written_buffered = fuse_perform_write(file, mapping, &i, pos);
979 if (written_buffered < 0) {
980 err = written_buffered;
981 goto out;
982 }
983 endbyte = pos + written_buffered - 1;
984
985 err = filemap_write_and_wait_range(file->f_mapping, pos,
986 endbyte);
987 if (err)
988 goto out;
989
990 invalidate_mapping_pages(file->f_mapping,
991 pos >> PAGE_CACHE_SHIFT,
992 endbyte >> PAGE_CACHE_SHIFT);
993
994 written += written_buffered;
995 iocb->ki_pos = pos + written_buffered;
996 } else {
997 iov_iter_init(&i, iov, nr_segs, count, 0);
998 written = fuse_perform_write(file, mapping, &i, pos);
999 if (written >= 0)
1000 iocb->ki_pos = pos + written;
1001 }
970out: 1002out:
971 current->backing_dev_info = NULL; 1003 current->backing_dev_info = NULL;
972 mutex_unlock(&inode->i_mutex); 1004 mutex_unlock(&inode->i_mutex);
@@ -1101,30 +1133,41 @@ static ssize_t fuse_direct_read(struct file *file, char __user *buf,
1101 return res; 1133 return res;
1102} 1134}
1103 1135
1104static ssize_t fuse_direct_write(struct file *file, const char __user *buf, 1136static ssize_t __fuse_direct_write(struct file *file, const char __user *buf,
1105 size_t count, loff_t *ppos) 1137 size_t count, loff_t *ppos)
1106{ 1138{
1107 struct inode *inode = file->f_path.dentry->d_inode; 1139 struct inode *inode = file->f_path.dentry->d_inode;
1108 ssize_t res; 1140 ssize_t res;
1109 1141
1110 if (is_bad_inode(inode))
1111 return -EIO;
1112
1113 /* Don't allow parallel writes to the same file */
1114 mutex_lock(&inode->i_mutex);
1115 res = generic_write_checks(file, ppos, &count, 0); 1142 res = generic_write_checks(file, ppos, &count, 0);
1116 if (!res) { 1143 if (!res) {
1117 res = fuse_direct_io(file, buf, count, ppos, 1); 1144 res = fuse_direct_io(file, buf, count, ppos, 1);
1118 if (res > 0) 1145 if (res > 0)
1119 fuse_write_update_size(inode, *ppos); 1146 fuse_write_update_size(inode, *ppos);
1120 } 1147 }
1121 mutex_unlock(&inode->i_mutex);
1122 1148
1123 fuse_invalidate_attr(inode); 1149 fuse_invalidate_attr(inode);
1124 1150
1125 return res; 1151 return res;
1126} 1152}
1127 1153
1154static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
1155 size_t count, loff_t *ppos)
1156{
1157 struct inode *inode = file->f_path.dentry->d_inode;
1158 ssize_t res;
1159
1160 if (is_bad_inode(inode))
1161 return -EIO;
1162
1163 /* Don't allow parallel writes to the same file */
1164 mutex_lock(&inode->i_mutex);
1165 res = __fuse_direct_write(file, buf, count, ppos);
1166 mutex_unlock(&inode->i_mutex);
1167
1168 return res;
1169}
1170
1128static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) 1171static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req)
1129{ 1172{
1130 __free_page(req->pages[0]); 1173 __free_page(req->pages[0]);
@@ -2077,6 +2120,57 @@ int fuse_notify_poll_wakeup(struct fuse_conn *fc,
2077 return 0; 2120 return 0;
2078} 2121}
2079 2122
2123static ssize_t fuse_loop_dio(struct file *filp, const struct iovec *iov,
2124 unsigned long nr_segs, loff_t *ppos, int rw)
2125{
2126 const struct iovec *vector = iov;
2127 ssize_t ret = 0;
2128
2129 while (nr_segs > 0) {
2130 void __user *base;
2131 size_t len;
2132 ssize_t nr;
2133
2134 base = vector->iov_base;
2135 len = vector->iov_len;
2136 vector++;
2137 nr_segs--;
2138
2139 if (rw == WRITE)
2140 nr = __fuse_direct_write(filp, base, len, ppos);
2141 else
2142 nr = fuse_direct_read(filp, base, len, ppos);
2143
2144 if (nr < 0) {
2145 if (!ret)
2146 ret = nr;
2147 break;
2148 }
2149 ret += nr;
2150 if (nr != len)
2151 break;
2152 }
2153
2154 return ret;
2155}
2156
2157
2158static ssize_t
2159fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
2160 loff_t offset, unsigned long nr_segs)
2161{
2162 ssize_t ret = 0;
2163 struct file *file = NULL;
2164 loff_t pos = 0;
2165
2166 file = iocb->ki_filp;
2167 pos = offset;
2168
2169 ret = fuse_loop_dio(file, iov, nr_segs, &pos, rw);
2170
2171 return ret;
2172}
2173
2080static const struct file_operations fuse_file_operations = { 2174static const struct file_operations fuse_file_operations = {
2081 .llseek = fuse_file_llseek, 2175 .llseek = fuse_file_llseek,
2082 .read = do_sync_read, 2176 .read = do_sync_read,
@@ -2120,6 +2214,7 @@ static const struct address_space_operations fuse_file_aops = {
2120 .readpages = fuse_readpages, 2214 .readpages = fuse_readpages,
2121 .set_page_dirty = __set_page_dirty_nobuffers, 2215 .set_page_dirty = __set_page_dirty_nobuffers,
2122 .bmap = fuse_bmap, 2216 .bmap = fuse_bmap,
2217 .direct_IO = fuse_direct_IO,
2123}; 2218};
2124 2219
2125void fuse_init_file_inode(struct inode *inode) 2220void fuse_init_file_inode(struct inode *inode)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 4aec5995867e..26783eb2b1fc 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -947,6 +947,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
947 sb->s_magic = FUSE_SUPER_MAGIC; 947 sb->s_magic = FUSE_SUPER_MAGIC;
948 sb->s_op = &fuse_super_operations; 948 sb->s_op = &fuse_super_operations;
949 sb->s_maxbytes = MAX_LFS_FILESIZE; 949 sb->s_maxbytes = MAX_LFS_FILESIZE;
950 sb->s_time_gran = 1;
950 sb->s_export_op = &fuse_export_operations; 951 sb->s_export_op = &fuse_export_operations;
951 952
952 file = fget(d.fd); 953 file = fget(d.fd);
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index 3ddcbb1c0a43..13ad1539fbf2 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -241,7 +241,7 @@ static int decode_nlm4_stat(struct xdr_stream *xdr, __be32 *stat)
241 p = xdr_inline_decode(xdr, 4); 241 p = xdr_inline_decode(xdr, 4);
242 if (unlikely(p == NULL)) 242 if (unlikely(p == NULL))
243 goto out_overflow; 243 goto out_overflow;
244 if (unlikely(*p > nlm4_failed)) 244 if (unlikely(ntohl(*p) > ntohl(nlm4_failed)))
245 goto out_bad_xdr; 245 goto out_bad_xdr;
246 *stat = *p; 246 *stat = *p;
247 return 0; 247 return 0;
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 3d35e3e80c1c..d269ada7670e 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -236,7 +236,7 @@ static int decode_nlm_stat(struct xdr_stream *xdr,
236 p = xdr_inline_decode(xdr, 4); 236 p = xdr_inline_decode(xdr, 4);
237 if (unlikely(p == NULL)) 237 if (unlikely(p == NULL))
238 goto out_overflow; 238 goto out_overflow;
239 if (unlikely(*p > nlm_lck_denied_grace_period)) 239 if (unlikely(ntohl(*p) > ntohl(nlm_lck_denied_grace_period)))
240 goto out_enum; 240 goto out_enum;
241 *stat = *p; 241 *stat = *p;
242 return 0; 242 return 0;
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 08c6e36ab2eb..43f46cd9edea 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -803,13 +803,13 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name,
803 return p; 803 return p;
804} 804}
805 805
806static int 806static __be32
807compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, 807compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
808 const char *name, int namlen) 808 const char *name, int namlen)
809{ 809{
810 struct svc_export *exp; 810 struct svc_export *exp;
811 struct dentry *dparent, *dchild; 811 struct dentry *dparent, *dchild;
812 int rv = 0; 812 __be32 rv = nfserr_noent;
813 813
814 dparent = cd->fh.fh_dentry; 814 dparent = cd->fh.fh_dentry;
815 exp = cd->fh.fh_export; 815 exp = cd->fh.fh_export;
@@ -817,26 +817,20 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
817 if (isdotent(name, namlen)) { 817 if (isdotent(name, namlen)) {
818 if (namlen == 2) { 818 if (namlen == 2) {
819 dchild = dget_parent(dparent); 819 dchild = dget_parent(dparent);
820 if (dchild == dparent) { 820 /* filesystem root - cannot return filehandle for ".." */
821 /* filesystem root - cannot return filehandle for ".." */ 821 if (dchild == dparent)
822 dput(dchild); 822 goto out;
823 return -ENOENT;
824 }
825 } else 823 } else
826 dchild = dget(dparent); 824 dchild = dget(dparent);
827 } else 825 } else
828 dchild = lookup_one_len(name, dparent, namlen); 826 dchild = lookup_one_len(name, dparent, namlen);
829 if (IS_ERR(dchild)) 827 if (IS_ERR(dchild))
830 return -ENOENT; 828 return rv;
831 rv = -ENOENT;
832 if (d_mountpoint(dchild)) 829 if (d_mountpoint(dchild))
833 goto out; 830 goto out;
834 rv = fh_compose(fhp, exp, dchild, &cd->fh);
835 if (rv)
836 goto out;
837 if (!dchild->d_inode) 831 if (!dchild->d_inode)
838 goto out; 832 goto out;
839 rv = 0; 833 rv = fh_compose(fhp, exp, dchild, &cd->fh);
840out: 834out:
841 dput(dchild); 835 dput(dchild);
842 return rv; 836 return rv;
@@ -845,7 +839,7 @@ out:
845static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen) 839static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen)
846{ 840{
847 struct svc_fh fh; 841 struct svc_fh fh;
848 int err; 842 __be32 err;
849 843
850 fh_init(&fh, NFS3_FHSIZE); 844 fh_init(&fh, NFS3_FHSIZE);
851 err = compose_entry_fh(cd, &fh, name, namlen); 845 err = compose_entry_fh(cd, &fh, name, namlen);
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 2ed14dfd00a2..987e719fbae8 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -235,17 +235,17 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
235 */ 235 */
236 if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0) 236 if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0)
237 open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS | 237 open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS |
238 FATTR4_WORD1_TIME_MODIFY); 238 FATTR4_WORD1_TIME_MODIFY);
239 } else { 239 } else {
240 status = nfsd_lookup(rqstp, current_fh, 240 status = nfsd_lookup(rqstp, current_fh,
241 open->op_fname.data, open->op_fname.len, resfh); 241 open->op_fname.data, open->op_fname.len, resfh);
242 fh_unlock(current_fh); 242 fh_unlock(current_fh);
243 if (status)
244 goto out;
245 status = nfsd_check_obj_isreg(resfh);
246 } 243 }
247 if (status) 244 if (status)
248 goto out; 245 goto out;
246 status = nfsd_check_obj_isreg(resfh);
247 if (status)
248 goto out;
249 249
250 if (is_create_with_attrs(open) && open->op_acl != NULL) 250 if (is_create_with_attrs(open) && open->op_acl != NULL)
251 do_set_nfs4_acl(rqstp, resfh, open->op_acl, open->op_bmval); 251 do_set_nfs4_acl(rqstp, resfh, open->op_acl, open->op_bmval);
@@ -841,6 +841,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
841 struct nfsd4_setattr *setattr) 841 struct nfsd4_setattr *setattr)
842{ 842{
843 __be32 status = nfs_ok; 843 __be32 status = nfs_ok;
844 int err;
844 845
845 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { 846 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
846 nfs4_lock_state(); 847 nfs4_lock_state();
@@ -852,9 +853,9 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
852 return status; 853 return status;
853 } 854 }
854 } 855 }
855 status = fh_want_write(&cstate->current_fh); 856 err = fh_want_write(&cstate->current_fh);
856 if (status) 857 if (err)
857 return status; 858 return nfserrno(err);
858 status = nfs_ok; 859 status = nfs_ok;
859 860
860 status = check_attr_support(rqstp, cstate, setattr->sa_bmval, 861 status = check_attr_support(rqstp, cstate, setattr->sa_bmval,
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 1841f8bf845e..7f71c69cdcdf 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4211,16 +4211,14 @@ out:
4211 * vfs_test_lock. (Arguably perhaps test_lock should be done with an 4211 * vfs_test_lock. (Arguably perhaps test_lock should be done with an
4212 * inode operation.) 4212 * inode operation.)
4213 */ 4213 */
4214static int nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) 4214static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock)
4215{ 4215{
4216 struct file *file; 4216 struct file *file;
4217 int err; 4217 __be32 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file);
4218 4218 if (!err) {
4219 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); 4219 err = nfserrno(vfs_test_lock(file, lock));
4220 if (err) 4220 nfsd_close(file);
4221 return err; 4221 }
4222 err = vfs_test_lock(file, lock);
4223 nfsd_close(file);
4224 return err; 4222 return err;
4225} 4223}
4226 4224
@@ -4234,7 +4232,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4234 struct inode *inode; 4232 struct inode *inode;
4235 struct file_lock file_lock; 4233 struct file_lock file_lock;
4236 struct nfs4_lockowner *lo; 4234 struct nfs4_lockowner *lo;
4237 int error;
4238 __be32 status; 4235 __be32 status;
4239 4236
4240 if (locks_in_grace()) 4237 if (locks_in_grace())
@@ -4280,12 +4277,10 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4280 4277
4281 nfs4_transform_lock_offset(&file_lock); 4278 nfs4_transform_lock_offset(&file_lock);
4282 4279
4283 status = nfs_ok; 4280 status = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock);
4284 error = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); 4281 if (status)
4285 if (error) {
4286 status = nfserrno(error);
4287 goto out; 4282 goto out;
4288 } 4283
4289 if (file_lock.fl_type != F_UNLCK) { 4284 if (file_lock.fl_type != F_UNLCK) {
4290 status = nfserr_denied; 4285 status = nfserr_denied;
4291 nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); 4286 nfs4_set_lock_denied(&file_lock, &lockt->lt_denied);
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index bcd8904ab1e3..74c00bc92b9a 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1392,7 +1392,7 @@ nfsd4_decode_test_stateid(struct nfsd4_compoundargs *argp, struct nfsd4_test_sta
1392 for (i = 0; i < test_stateid->ts_num_ids; i++) { 1392 for (i = 0; i < test_stateid->ts_num_ids; i++) {
1393 stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL); 1393 stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL);
1394 if (!stateid) { 1394 if (!stateid) {
1395 status = PTR_ERR(stateid); 1395 status = nfserrno(-ENOMEM);
1396 goto out; 1396 goto out;
1397 } 1397 }
1398 1398
@@ -3410,7 +3410,7 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, int nfserr,
3410 *p++ = htonl(test_stateid->ts_num_ids); 3410 *p++ = htonl(test_stateid->ts_num_ids);
3411 3411
3412 list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) { 3412 list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) {
3413 *p++ = htonl(stateid->ts_id_status); 3413 *p++ = stateid->ts_id_status;
3414 } 3414 }
3415 3415
3416 ADJUST_ARGS(); 3416 ADJUST_ARGS();
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 296d671654d6..568666156ea4 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1458,7 +1458,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1458 switch (createmode) { 1458 switch (createmode) {
1459 case NFS3_CREATE_UNCHECKED: 1459 case NFS3_CREATE_UNCHECKED:
1460 if (! S_ISREG(dchild->d_inode->i_mode)) 1460 if (! S_ISREG(dchild->d_inode->i_mode))
1461 err = nfserr_exist; 1461 goto out;
1462 else if (truncp) { 1462 else if (truncp) {
1463 /* in nfsv4, we need to treat this case a little 1463 /* in nfsv4, we need to treat this case a little
1464 * differently. we don't want to truncate the 1464 * differently. we don't want to truncate the
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 3165aebb43c8..31b9463fba1f 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -1134,7 +1134,7 @@ static int ocfs2_adjust_rightmost_branch(handle_t *handle,
1134 } 1134 }
1135 1135
1136 el = path_leaf_el(path); 1136 el = path_leaf_el(path);
1137 rec = &el->l_recs[le32_to_cpu(el->l_next_free_rec) - 1]; 1137 rec = &el->l_recs[le16_to_cpu(el->l_next_free_rec) - 1];
1138 1138
1139 ocfs2_adjust_rightmost_records(handle, et, path, rec); 1139 ocfs2_adjust_rightmost_records(handle, et, path, rec);
1140 1140
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index cf7823382664..9f32d7cbb7a3 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -1036,14 +1036,14 @@ static int ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci,
1036 1036
1037 tmp_el = left_path->p_node[subtree_root].el; 1037 tmp_el = left_path->p_node[subtree_root].el;
1038 blkno = left_path->p_node[subtree_root+1].bh->b_blocknr; 1038 blkno = left_path->p_node[subtree_root+1].bh->b_blocknr;
1039 for (i = 0; i < le32_to_cpu(tmp_el->l_next_free_rec); i++) { 1039 for (i = 0; i < le16_to_cpu(tmp_el->l_next_free_rec); i++) {
1040 if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) { 1040 if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) {
1041 *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos); 1041 *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos);
1042 break; 1042 break;
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 BUG_ON(i == le32_to_cpu(tmp_el->l_next_free_rec)); 1046 BUG_ON(i == le16_to_cpu(tmp_el->l_next_free_rec));
1047 1047
1048out: 1048out:
1049 ocfs2_free_path(left_path); 1049 ocfs2_free_path(left_path);
@@ -1468,7 +1468,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh,
1468 1468
1469 trace_ocfs2_divide_leaf_refcount_block( 1469 trace_ocfs2_divide_leaf_refcount_block(
1470 (unsigned long long)ref_leaf_bh->b_blocknr, 1470 (unsigned long long)ref_leaf_bh->b_blocknr,
1471 le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used)); 1471 le16_to_cpu(rl->rl_count), le16_to_cpu(rl->rl_used));
1472 1472
1473 /* 1473 /*
1474 * XXX: Improvement later. 1474 * XXX: Improvement later.
@@ -2411,7 +2411,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
2411 rb = (struct ocfs2_refcount_block *) 2411 rb = (struct ocfs2_refcount_block *)
2412 prev_bh->b_data; 2412 prev_bh->b_data;
2413 2413
2414 if (le64_to_cpu(rb->rf_records.rl_used) + 2414 if (le16_to_cpu(rb->rf_records.rl_used) +
2415 recs_add > 2415 recs_add >
2416 le16_to_cpu(rb->rf_records.rl_count)) 2416 le16_to_cpu(rb->rf_records.rl_count))
2417 ref_blocks++; 2417 ref_blocks++;
@@ -2476,7 +2476,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
2476 if (prev_bh) { 2476 if (prev_bh) {
2477 rb = (struct ocfs2_refcount_block *)prev_bh->b_data; 2477 rb = (struct ocfs2_refcount_block *)prev_bh->b_data;
2478 2478
2479 if (le64_to_cpu(rb->rf_records.rl_used) + recs_add > 2479 if (le16_to_cpu(rb->rf_records.rl_used) + recs_add >
2480 le16_to_cpu(rb->rf_records.rl_count)) 2480 le16_to_cpu(rb->rf_records.rl_count))
2481 ref_blocks++; 2481 ref_blocks++;
2482 2482
@@ -3629,7 +3629,7 @@ int ocfs2_refcounted_xattr_delete_need(struct inode *inode,
3629 * one will split a refcount rec, so totally we need 3629 * one will split a refcount rec, so totally we need
3630 * clusters * 2 new refcount rec. 3630 * clusters * 2 new refcount rec.
3631 */ 3631 */
3632 if (le64_to_cpu(rb->rf_records.rl_used) + clusters * 2 > 3632 if (le16_to_cpu(rb->rf_records.rl_used) + clusters * 2 >
3633 le16_to_cpu(rb->rf_records.rl_count)) 3633 le16_to_cpu(rb->rf_records.rl_count))
3634 ref_blocks++; 3634 ref_blocks++;
3635 3635
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index ba5d97e4a73e..f169da4624fd 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -600,7 +600,7 @@ static void ocfs2_bg_alloc_cleanup(handle_t *handle,
600 ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode, 600 ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode,
601 cluster_ac->ac_bh, 601 cluster_ac->ac_bh,
602 le64_to_cpu(rec->e_blkno), 602 le64_to_cpu(rec->e_blkno),
603 le32_to_cpu(rec->e_leaf_clusters)); 603 le16_to_cpu(rec->e_leaf_clusters));
604 if (ret) 604 if (ret)
605 mlog_errno(ret); 605 mlog_errno(ret);
606 /* Try all the clusters to free */ 606 /* Try all the clusters to free */
@@ -1628,7 +1628,7 @@ static int ocfs2_bg_discontig_fix_by_rec(struct ocfs2_suballoc_result *res,
1628{ 1628{
1629 unsigned int bpc = le16_to_cpu(cl->cl_bpc); 1629 unsigned int bpc = le16_to_cpu(cl->cl_bpc);
1630 unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc; 1630 unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc;
1631 unsigned int bitcount = le32_to_cpu(rec->e_leaf_clusters) * bpc; 1631 unsigned int bitcount = le16_to_cpu(rec->e_leaf_clusters) * bpc;
1632 1632
1633 if (res->sr_bit_offset < bitoff) 1633 if (res->sr_bit_offset < bitoff)
1634 return 0; 1634 return 0;
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 8ba2c9460b28..8f2ab8fef929 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -593,7 +593,7 @@ struct fuse_dirent {
593 __u64 off; 593 __u64 off;
594 __u32 namelen; 594 __u32 namelen;
595 __u32 type; 595 __u32 type;
596 char name[0]; 596 char name[];
597}; 597};
598 598
599#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) 599#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h
index a87124d4d533..1bc74afe7a35 100644
--- a/include/linux/i2c-pnx.h
+++ b/include/linux/i2c-pnx.h
@@ -29,14 +29,10 @@ struct i2c_pnx_algo_data {
29 struct i2c_pnx_mif mif; 29 struct i2c_pnx_mif mif;
30 int last; 30 int last;
31 struct clk *clk; 31 struct clk *clk;
32 struct i2c_pnx_data *i2c_pnx;
33 struct i2c_adapter adapter; 32 struct i2c_adapter adapter;
34}; 33 phys_addr_t base;
35 34 int irq;
36struct i2c_pnx_data { 35 u32 timeout;
37 const char *name;
38 u32 base;
39 int irq;
40}; 36};
41 37
42#endif /* __I2C_PNX_H__ */ 38#endif /* __I2C_PNX_H__ */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 2463b6100333..1f90de0cfdbe 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -666,23 +666,11 @@ struct twl4030_codec_data {
666 unsigned int check_defaults:1; 666 unsigned int check_defaults:1;
667 unsigned int reset_registers:1; 667 unsigned int reset_registers:1;
668 unsigned int hs_extmute:1; 668 unsigned int hs_extmute:1;
669 u16 hs_left_step;
670 u16 hs_right_step;
671 u16 hf_left_step;
672 u16 hf_right_step;
673 void (*set_hs_extmute)(int mute); 669 void (*set_hs_extmute)(int mute);
674}; 670};
675 671
676struct twl4030_vibra_data { 672struct twl4030_vibra_data {
677 unsigned int coexist; 673 unsigned int coexist;
678
679 /* twl6040 */
680 unsigned int vibldrv_res; /* left driver resistance */
681 unsigned int vibrdrv_res; /* right driver resistance */
682 unsigned int viblmotor_res; /* left motor resistance */
683 unsigned int vibrmotor_res; /* right motor resistance */
684 int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */
685 int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */
686}; 674};
687 675
688struct twl4030_audio_data { 676struct twl4030_audio_data {
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 665a260c7e09..72cbf08d45fb 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -596,6 +596,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
596 596
597#ifdef CONFIG_IOMMU_API 597#ifdef CONFIG_IOMMU_API
598int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); 598int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
599void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
599int kvm_iommu_map_guest(struct kvm *kvm); 600int kvm_iommu_map_guest(struct kvm *kvm);
600int kvm_iommu_unmap_guest(struct kvm *kvm); 601int kvm_iommu_unmap_guest(struct kvm *kvm);
601int kvm_assign_device(struct kvm *kvm, 602int kvm_assign_device(struct kvm *kvm,
@@ -609,6 +610,11 @@ static inline int kvm_iommu_map_pages(struct kvm *kvm,
609 return 0; 610 return 0;
610} 611}
611 612
613static inline void kvm_iommu_unmap_pages(struct kvm *kvm,
614 struct kvm_memory_slot *slot)
615{
616}
617
612static inline int kvm_iommu_map_guest(struct kvm *kvm) 618static inline int kvm_iommu_map_guest(struct kvm *kvm)
613{ 619{
614 return -ENODEV; 620 return -ENODEV;
diff --git a/include/linux/mfd/db5500-prcmu.h b/include/linux/mfd/db5500-prcmu.h
index 9890687f582d..5a049dfaf153 100644
--- a/include/linux/mfd/db5500-prcmu.h
+++ b/include/linux/mfd/db5500-prcmu.h
@@ -8,41 +8,14 @@
8#ifndef __MFD_DB5500_PRCMU_H 8#ifndef __MFD_DB5500_PRCMU_H
9#define __MFD_DB5500_PRCMU_H 9#define __MFD_DB5500_PRCMU_H
10 10
11#ifdef CONFIG_MFD_DB5500_PRCMU 11static inline int prcmu_resetout(u8 resoutn, u8 state)
12
13void db5500_prcmu_early_init(void);
14int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state);
15int db5500_prcmu_set_display_clocks(void);
16int db5500_prcmu_disable_dsipll(void);
17int db5500_prcmu_enable_dsipll(void);
18int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
19int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
20void db5500_prcmu_enable_wakeups(u32 wakeups);
21int db5500_prcmu_request_clock(u8 clock, bool enable);
22void db5500_prcmu_config_abb_event_readout(u32 abb_events);
23void db5500_prcmu_get_abb_event_buffer(void __iomem **buf);
24int prcmu_resetout(u8 resoutn, u8 state);
25int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
26 bool keep_ap_pll);
27int db5500_prcmu_config_esram0_deep_sleep(u8 state);
28void db5500_prcmu_system_reset(u16 reset_code);
29u16 db5500_prcmu_get_reset_code(void);
30bool db5500_prcmu_is_ac_wake_requested(void);
31int db5500_prcmu_set_arm_opp(u8 opp);
32int db5500_prcmu_get_arm_opp(void);
33
34#else /* !CONFIG_UX500_SOC_DB5500 */
35
36static inline void db5500_prcmu_early_init(void) {}
37
38static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
39{ 12{
40 return -ENOSYS; 13 return 0;
41} 14}
42 15
43static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) 16static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state)
44{ 17{
45 return -ENOSYS; 18 return 0;
46} 19}
47 20
48static inline int db5500_prcmu_request_clock(u8 clock, bool enable) 21static inline int db5500_prcmu_request_clock(u8 clock, bool enable)
@@ -50,69 +23,82 @@ static inline int db5500_prcmu_request_clock(u8 clock, bool enable)
50 return 0; 23 return 0;
51} 24}
52 25
53static inline int db5500_prcmu_set_display_clocks(void) 26static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
27 bool keep_ap_pll)
54{ 28{
55 return 0; 29 return 0;
56} 30}
57 31
58static inline int db5500_prcmu_disable_dsipll(void) 32static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state)
59{ 33{
60 return 0; 34 return 0;
61} 35}
62 36
63static inline int db5500_prcmu_enable_dsipll(void) 37static inline u16 db5500_prcmu_get_reset_code(void)
64{ 38{
65 return 0; 39 return 0;
66} 40}
67 41
68static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state) 42static inline bool db5500_prcmu_is_ac_wake_requested(void)
69{ 43{
70 return 0; 44 return 0;
71} 45}
72 46
73static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {} 47static inline int db5500_prcmu_set_arm_opp(u8 opp)
74
75static inline int prcmu_resetout(u8 resoutn, u8 state)
76{ 48{
77 return 0; 49 return 0;
78} 50}
79 51
80static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state) 52static inline int db5500_prcmu_get_arm_opp(void)
81{ 53{
82 return 0; 54 return 0;
83} 55}
84 56
85static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
86static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {} 57static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {}
87 58
88static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, 59static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
89 bool keep_ap_pll)
90{
91 return 0;
92}
93 60
94static inline void db5500_prcmu_system_reset(u16 reset_code) {} 61static inline void db5500_prcmu_system_reset(u16 reset_code) {}
95 62
96static inline u16 db5500_prcmu_get_reset_code(void) 63static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {}
64
65#ifdef CONFIG_MFD_DB5500_PRCMU
66
67void db5500_prcmu_early_init(void);
68int db5500_prcmu_set_display_clocks(void);
69int db5500_prcmu_disable_dsipll(void);
70int db5500_prcmu_enable_dsipll(void);
71int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
72int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
73
74#else /* !CONFIG_UX500_SOC_DB5500 */
75
76static inline void db5500_prcmu_early_init(void) {}
77
78static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
97{ 79{
98 return 0; 80 return -ENOSYS;
99} 81}
100 82
101static inline bool db5500_prcmu_is_ac_wake_requested(void) 83static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
102{ 84{
103 return 0; 85 return -ENOSYS;
104} 86}
105 87
106static inline int db5500_prcmu_set_arm_opp(u8 opp) 88static inline int db5500_prcmu_set_display_clocks(void)
107{ 89{
108 return 0; 90 return 0;
109} 91}
110 92
111static inline int db5500_prcmu_get_arm_opp(void) 93static inline int db5500_prcmu_disable_dsipll(void)
112{ 94{
113 return 0; 95 return 0;
114} 96}
115 97
98static inline int db5500_prcmu_enable_dsipll(void)
99{
100 return 0;
101}
116 102
117#endif /* CONFIG_MFD_DB5500_PRCMU */ 103#endif /* CONFIG_MFD_DB5500_PRCMU */
118 104
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index a2c61609d21d..0b64b19d81ab 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -26,6 +26,7 @@
26 26
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/regmap.h>
29 30
30#define RC5T583_MAX_REGS 0xF8 31#define RC5T583_MAX_REGS 0xF8
31 32
@@ -279,14 +280,44 @@ struct rc5t583_platform_data {
279 bool enable_shutdown; 280 bool enable_shutdown;
280}; 281};
281 282
282int rc5t583_write(struct device *dev, u8 reg, uint8_t val); 283static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
283int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val); 284{
284int rc5t583_set_bits(struct device *dev, unsigned int reg, 285 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
285 unsigned int bit_mask); 286 return regmap_write(rc5t583->regmap, reg, val);
286int rc5t583_clear_bits(struct device *dev, unsigned int reg, 287}
287 unsigned int bit_mask); 288
288int rc5t583_update(struct device *dev, unsigned int reg, 289static inline int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val)
289 unsigned int val, unsigned int mask); 290{
291 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
292 unsigned int ival;
293 int ret;
294 ret = regmap_read(rc5t583->regmap, reg, &ival);
295 if (!ret)
296 *val = (uint8_t)ival;
297 return ret;
298}
299
300static inline int rc5t583_set_bits(struct device *dev, unsigned int reg,
301 unsigned int bit_mask)
302{
303 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
304 return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask);
305}
306
307static inline int rc5t583_clear_bits(struct device *dev, unsigned int reg,
308 unsigned int bit_mask)
309{
310 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
311 return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0);
312}
313
314static inline int rc5t583_update(struct device *dev, unsigned int reg,
315 unsigned int val, unsigned int mask)
316{
317 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
318 return regmap_update_bits(rc5t583->regmap, reg, mask, val);
319}
320
290int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id, 321int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id,
291 int ext_pwr_req, int deepsleep_slot_nr); 322 int ext_pwr_req, int deepsleep_slot_nr);
292int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base); 323int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base);
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 9bc9ac651dad..b15b5f03f5c4 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -174,8 +174,35 @@
174#define TWL6040_SYSCLK_SEL_LPPLL 0 174#define TWL6040_SYSCLK_SEL_LPPLL 0
175#define TWL6040_SYSCLK_SEL_HPPLL 1 175#define TWL6040_SYSCLK_SEL_HPPLL 1
176 176
177struct twl6040_codec_data {
178 u16 hs_left_step;
179 u16 hs_right_step;
180 u16 hf_left_step;
181 u16 hf_right_step;
182};
183
184struct twl6040_vibra_data {
185 unsigned int vibldrv_res; /* left driver resistance */
186 unsigned int vibrdrv_res; /* right driver resistance */
187 unsigned int viblmotor_res; /* left motor resistance */
188 unsigned int vibrmotor_res; /* right motor resistance */
189 int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */
190 int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */
191};
192
193struct twl6040_platform_data {
194 int audpwron_gpio; /* audio power-on gpio */
195 unsigned int irq_base;
196
197 struct twl6040_codec_data *codec;
198 struct twl6040_vibra_data *vibra;
199};
200
201struct regmap;
202
177struct twl6040 { 203struct twl6040 {
178 struct device *dev; 204 struct device *dev;
205 struct regmap *regmap;
179 struct mutex mutex; 206 struct mutex mutex;
180 struct mutex io_mutex; 207 struct mutex io_mutex;
181 struct mutex irq_mutex; 208 struct mutex irq_mutex;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d8738a464b94..74aa71bea1e4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1393,29 +1393,20 @@ extern int install_special_mapping(struct mm_struct *mm,
1393 1393
1394extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); 1394extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
1395 1395
1396extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1397 unsigned long len, unsigned long prot,
1398 unsigned long flag, unsigned long pgoff);
1399extern unsigned long mmap_region(struct file *file, unsigned long addr, 1396extern unsigned long mmap_region(struct file *file, unsigned long addr,
1400 unsigned long len, unsigned long flags, 1397 unsigned long len, unsigned long flags,
1401 vm_flags_t vm_flags, unsigned long pgoff); 1398 vm_flags_t vm_flags, unsigned long pgoff);
1402 1399extern unsigned long do_mmap(struct file *, unsigned long,
1403static inline unsigned long do_mmap(struct file *file, unsigned long addr, 1400 unsigned long, unsigned long,
1404 unsigned long len, unsigned long prot, 1401 unsigned long, unsigned long);
1405 unsigned long flag, unsigned long offset)
1406{
1407 unsigned long ret = -EINVAL;
1408 if ((offset + PAGE_ALIGN(len)) < offset)
1409 goto out;
1410 if (!(offset & ~PAGE_MASK))
1411 ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
1412out:
1413 return ret;
1414}
1415
1416extern int do_munmap(struct mm_struct *, unsigned long, size_t); 1402extern int do_munmap(struct mm_struct *, unsigned long, size_t);
1417 1403
1418extern unsigned long do_brk(unsigned long, unsigned long); 1404/* These take the mm semaphore themselves */
1405extern unsigned long vm_brk(unsigned long, unsigned long);
1406extern int vm_munmap(unsigned long, size_t);
1407extern unsigned long vm_mmap(struct file *, unsigned long,
1408 unsigned long, unsigned long,
1409 unsigned long, unsigned long);
1419 1410
1420/* truncate.c */ 1411/* truncate.c */
1421extern void truncate_inode_pages(struct address_space *, loff_t); 1412extern void truncate_inode_pages(struct address_space *, loff_t);
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 01beae78f079..629b823f8836 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -481,7 +481,7 @@ struct mmc_driver {
481 struct device_driver drv; 481 struct device_driver drv;
482 int (*probe)(struct mmc_card *); 482 int (*probe)(struct mmc_card *);
483 void (*remove)(struct mmc_card *); 483 void (*remove)(struct mmc_card *);
484 int (*suspend)(struct mmc_card *, pm_message_t); 484 int (*suspend)(struct mmc_card *);
485 int (*resume)(struct mmc_card *); 485 int (*resume)(struct mmc_card *);
486}; 486};
487 487
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
index b8d4001212b3..5b7d84ac954a 100644
--- a/include/linux/nfsd/Kbuild
+++ b/include/linux/nfsd/Kbuild
@@ -1,3 +1,4 @@
1header-y += cld.h
1header-y += debug.h 2header-y += debug.h
2header-y += export.h 3header-y += export.h
3header-y += nfsfh.h 4header-y += nfsfh.h
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index fee4349364f7..e4d1de742502 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -12,6 +12,8 @@
12#ifndef __LINUX_PINCTRL_MACHINE_H 12#ifndef __LINUX_PINCTRL_MACHINE_H
13#define __LINUX_PINCTRL_MACHINE_H 13#define __LINUX_PINCTRL_MACHINE_H
14 14
15#include <linux/bug.h>
16
15#include "pinctrl-state.h" 17#include "pinctrl-state.h"
16 18
17enum pinctrl_map_type { 19enum pinctrl_map_type {
@@ -148,7 +150,7 @@ struct pinctrl_map {
148#define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \ 150#define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \
149 PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs) 151 PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs)
150 152
151#ifdef CONFIG_PINMUX 153#ifdef CONFIG_PINCTRL
152 154
153extern int pinctrl_register_mappings(struct pinctrl_map const *map, 155extern int pinctrl_register_mappings(struct pinctrl_map const *map,
154 unsigned num_maps); 156 unsigned num_maps);
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index f67810f8f21b..38ab3f46346f 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -94,6 +94,7 @@ struct usb_phy {
94 94
95 struct usb_otg *otg; 95 struct usb_otg *otg;
96 96
97 struct device *io_dev;
97 struct usb_phy_io_ops *io_ops; 98 struct usb_phy_io_ops *io_ops;
98 void __iomem *io_priv; 99 void __iomem *io_priv;
99 100
diff --git a/lib/mpi/mpi-bit.c b/lib/mpi/mpi-bit.c
index 2f526627e4f5..0c505361da19 100644
--- a/lib/mpi/mpi-bit.c
+++ b/lib/mpi/mpi-bit.c
@@ -177,8 +177,8 @@ int mpi_rshift(MPI x, MPI a, unsigned n)
177 */ 177 */
178int mpi_lshift_limbs(MPI a, unsigned int count) 178int mpi_lshift_limbs(MPI a, unsigned int count)
179{ 179{
180 mpi_ptr_t ap = a->d; 180 const int n = a->nlimbs;
181 int n = a->nlimbs; 181 mpi_ptr_t ap;
182 int i; 182 int i;
183 183
184 if (!count || !n) 184 if (!count || !n)
@@ -187,6 +187,7 @@ int mpi_lshift_limbs(MPI a, unsigned int count)
187 if (RESIZE_IF_NEEDED(a, n + count) < 0) 187 if (RESIZE_IF_NEEDED(a, n + count) < 0)
188 return -ENOMEM; 188 return -ENOMEM;
189 189
190 ap = a->d;
190 for (i = n - 1; i >= 0; i--) 191 for (i = n - 1; i >= 0; i--)
191 ap[i + count] = ap[i]; 192 ap[i + count] = ap[i];
192 for (i = 0; i < count; i++) 193 for (i = 0; i < count; i++)
diff --git a/mm/memblock.c b/mm/memblock.c
index 99f285599501..a44eab3157f8 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -330,6 +330,9 @@ static int __init_memblock memblock_add_region(struct memblock_type *type,
330 phys_addr_t end = base + memblock_cap_size(base, &size); 330 phys_addr_t end = base + memblock_cap_size(base, &size);
331 int i, nr_new; 331 int i, nr_new;
332 332
333 if (!size)
334 return 0;
335
333 /* special case for empty array */ 336 /* special case for empty array */
334 if (type->regions[0].size == 0) { 337 if (type->regions[0].size == 0) {
335 WARN_ON(type->cnt != 1 || type->total_size); 338 WARN_ON(type->cnt != 1 || type->total_size);
@@ -430,6 +433,9 @@ static int __init_memblock memblock_isolate_range(struct memblock_type *type,
430 433
431 *start_rgn = *end_rgn = 0; 434 *start_rgn = *end_rgn = 0;
432 435
436 if (!size)
437 return 0;
438
433 /* we'll create at most two more regions */ 439 /* we'll create at most two more regions */
434 while (type->cnt + 2 > type->max) 440 while (type->cnt + 2 > type->max)
435 if (memblock_double_array(type) < 0) 441 if (memblock_double_array(type) < 0)
@@ -514,7 +520,6 @@ int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
514 (unsigned long long)base, 520 (unsigned long long)base,
515 (unsigned long long)base + size, 521 (unsigned long long)base + size,
516 (void *)_RET_IP_); 522 (void *)_RET_IP_);
517 BUG_ON(0 == size);
518 523
519 return memblock_add_region(_rgn, base, size, MAX_NUMNODES); 524 return memblock_add_region(_rgn, base, size, MAX_NUMNODES);
520} 525}
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a7165a60d0a7..b868def9bcc1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3392,6 +3392,7 @@ void mem_cgroup_replace_page_cache(struct page *oldpage,
3392 * the newpage may be on LRU(or pagevec for LRU) already. We lock 3392 * the newpage may be on LRU(or pagevec for LRU) already. We lock
3393 * LRU while we overwrite pc->mem_cgroup. 3393 * LRU while we overwrite pc->mem_cgroup.
3394 */ 3394 */
3395 pc = lookup_page_cgroup(newpage);
3395 __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type, true); 3396 __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type, true);
3396} 3397}
3397 3398
diff --git a/mm/mmap.c b/mm/mmap.c
index a7bf6a31c9f6..848ef52d9603 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -240,6 +240,8 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
240 return next; 240 return next;
241} 241}
242 242
243static unsigned long do_brk(unsigned long addr, unsigned long len);
244
243SYSCALL_DEFINE1(brk, unsigned long, brk) 245SYSCALL_DEFINE1(brk, unsigned long, brk)
244{ 246{
245 unsigned long rlim, retval; 247 unsigned long rlim, retval;
@@ -951,7 +953,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
951 * The caller must hold down_write(&current->mm->mmap_sem). 953 * The caller must hold down_write(&current->mm->mmap_sem).
952 */ 954 */
953 955
954unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, 956static unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
955 unsigned long len, unsigned long prot, 957 unsigned long len, unsigned long prot,
956 unsigned long flags, unsigned long pgoff) 958 unsigned long flags, unsigned long pgoff)
957{ 959{
@@ -1087,7 +1089,32 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1087 1089
1088 return mmap_region(file, addr, len, flags, vm_flags, pgoff); 1090 return mmap_region(file, addr, len, flags, vm_flags, pgoff);
1089} 1091}
1090EXPORT_SYMBOL(do_mmap_pgoff); 1092
1093unsigned long do_mmap(struct file *file, unsigned long addr,
1094 unsigned long len, unsigned long prot,
1095 unsigned long flag, unsigned long offset)
1096{
1097 if (unlikely(offset + PAGE_ALIGN(len) < offset))
1098 return -EINVAL;
1099 if (unlikely(offset & ~PAGE_MASK))
1100 return -EINVAL;
1101 return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
1102}
1103EXPORT_SYMBOL(do_mmap);
1104
1105unsigned long vm_mmap(struct file *file, unsigned long addr,
1106 unsigned long len, unsigned long prot,
1107 unsigned long flag, unsigned long offset)
1108{
1109 unsigned long ret;
1110 struct mm_struct *mm = current->mm;
1111
1112 down_write(&mm->mmap_sem);
1113 ret = do_mmap(file, addr, len, prot, flag, offset);
1114 up_write(&mm->mmap_sem);
1115 return ret;
1116}
1117EXPORT_SYMBOL(vm_mmap);
1091 1118
1092SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, 1119SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
1093 unsigned long, prot, unsigned long, flags, 1120 unsigned long, prot, unsigned long, flags,
@@ -2105,21 +2132,25 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
2105 2132
2106 return 0; 2133 return 0;
2107} 2134}
2108
2109EXPORT_SYMBOL(do_munmap); 2135EXPORT_SYMBOL(do_munmap);
2110 2136
2111SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) 2137int vm_munmap(unsigned long start, size_t len)
2112{ 2138{
2113 int ret; 2139 int ret;
2114 struct mm_struct *mm = current->mm; 2140 struct mm_struct *mm = current->mm;
2115 2141
2116 profile_munmap(addr);
2117
2118 down_write(&mm->mmap_sem); 2142 down_write(&mm->mmap_sem);
2119 ret = do_munmap(mm, addr, len); 2143 ret = do_munmap(mm, start, len);
2120 up_write(&mm->mmap_sem); 2144 up_write(&mm->mmap_sem);
2121 return ret; 2145 return ret;
2122} 2146}
2147EXPORT_SYMBOL(vm_munmap);
2148
2149SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
2150{
2151 profile_munmap(addr);
2152 return vm_munmap(addr, len);
2153}
2123 2154
2124static inline void verify_mm_writelocked(struct mm_struct *mm) 2155static inline void verify_mm_writelocked(struct mm_struct *mm)
2125{ 2156{
@@ -2136,7 +2167,7 @@ static inline void verify_mm_writelocked(struct mm_struct *mm)
2136 * anonymous maps. eventually we may be able to do some 2167 * anonymous maps. eventually we may be able to do some
2137 * brk-specific accounting here. 2168 * brk-specific accounting here.
2138 */ 2169 */
2139unsigned long do_brk(unsigned long addr, unsigned long len) 2170static unsigned long do_brk(unsigned long addr, unsigned long len)
2140{ 2171{
2141 struct mm_struct * mm = current->mm; 2172 struct mm_struct * mm = current->mm;
2142 struct vm_area_struct * vma, * prev; 2173 struct vm_area_struct * vma, * prev;
@@ -2232,7 +2263,17 @@ out:
2232 return addr; 2263 return addr;
2233} 2264}
2234 2265
2235EXPORT_SYMBOL(do_brk); 2266unsigned long vm_brk(unsigned long addr, unsigned long len)
2267{
2268 struct mm_struct *mm = current->mm;
2269 unsigned long ret;
2270
2271 down_write(&mm->mmap_sem);
2272 ret = do_brk(addr, len);
2273 up_write(&mm->mmap_sem);
2274 return ret;
2275}
2276EXPORT_SYMBOL(vm_brk);
2236 2277
2237/* Release all mmaps. */ 2278/* Release all mmaps. */
2238void exit_mmap(struct mm_struct *mm) 2279void exit_mmap(struct mm_struct *mm)
diff --git a/mm/nommu.c b/mm/nommu.c
index f59e170fceb4..bb8f4f004a82 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1233,7 +1233,7 @@ enomem:
1233/* 1233/*
1234 * handle mapping creation for uClinux 1234 * handle mapping creation for uClinux
1235 */ 1235 */
1236unsigned long do_mmap_pgoff(struct file *file, 1236static unsigned long do_mmap_pgoff(struct file *file,
1237 unsigned long addr, 1237 unsigned long addr,
1238 unsigned long len, 1238 unsigned long len,
1239 unsigned long prot, 1239 unsigned long prot,
@@ -1470,7 +1470,32 @@ error_getting_region:
1470 show_free_areas(0); 1470 show_free_areas(0);
1471 return -ENOMEM; 1471 return -ENOMEM;
1472} 1472}
1473EXPORT_SYMBOL(do_mmap_pgoff); 1473
1474unsigned long do_mmap(struct file *file, unsigned long addr,
1475 unsigned long len, unsigned long prot,
1476 unsigned long flag, unsigned long offset)
1477{
1478 if (unlikely(offset + PAGE_ALIGN(len) < offset))
1479 return -EINVAL;
1480 if (unlikely(offset & ~PAGE_MASK))
1481 return -EINVAL;
1482 return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
1483}
1484EXPORT_SYMBOL(do_mmap);
1485
1486unsigned long vm_mmap(struct file *file, unsigned long addr,
1487 unsigned long len, unsigned long prot,
1488 unsigned long flag, unsigned long offset)
1489{
1490 unsigned long ret;
1491 struct mm_struct *mm = current->mm;
1492
1493 down_write(&mm->mmap_sem);
1494 ret = do_mmap(file, addr, len, prot, flag, offset);
1495 up_write(&mm->mmap_sem);
1496 return ret;
1497}
1498EXPORT_SYMBOL(vm_mmap);
1474 1499
1475SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, 1500SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
1476 unsigned long, prot, unsigned long, flags, 1501 unsigned long, prot, unsigned long, flags,
@@ -1709,16 +1734,22 @@ erase_whole_vma:
1709} 1734}
1710EXPORT_SYMBOL(do_munmap); 1735EXPORT_SYMBOL(do_munmap);
1711 1736
1712SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) 1737int vm_munmap(unsigned long addr, size_t len)
1713{ 1738{
1714 int ret;
1715 struct mm_struct *mm = current->mm; 1739 struct mm_struct *mm = current->mm;
1740 int ret;
1716 1741
1717 down_write(&mm->mmap_sem); 1742 down_write(&mm->mmap_sem);
1718 ret = do_munmap(mm, addr, len); 1743 ret = do_munmap(mm, addr, len);
1719 up_write(&mm->mmap_sem); 1744 up_write(&mm->mmap_sem);
1720 return ret; 1745 return ret;
1721} 1746}
1747EXPORT_SYMBOL(vm_munmap);
1748
1749SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
1750{
1751 return vm_munmap(addr, len);
1752}
1722 1753
1723/* 1754/*
1724 * release all the mappings made in a process's VM space 1755 * release all the mappings made in a process's VM space
@@ -1744,7 +1775,7 @@ void exit_mmap(struct mm_struct *mm)
1744 kleave(""); 1775 kleave("");
1745} 1776}
1746 1777
1747unsigned long do_brk(unsigned long addr, unsigned long len) 1778unsigned long vm_brk(unsigned long addr, unsigned long len)
1748{ 1779{
1749 return -ENOMEM; 1780 return -ENOMEM;
1750} 1781}
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index de639eeeed50..faea0ec612bf 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1869,12 +1869,6 @@ sub process {
1869 "No space is necessary after a cast\n" . $hereprev); 1869 "No space is necessary after a cast\n" . $hereprev);
1870 } 1870 }
1871 1871
1872 if ($rawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
1873 $prevrawline =~ /^\+[ \t]*$/) {
1874 CHK("BLOCK_COMMENT_STYLE",
1875 "Don't begin block comments with only a /* line, use /* comment...\n" . $hereprev);
1876 }
1877
1878# check for spaces at the beginning of a line. 1872# check for spaces at the beginning of a line.
1879# Exceptions: 1873# Exceptions:
1880# 1) within comments 1874# 1) within comments
diff --git a/scripts/xz_wrap.sh b/scripts/xz_wrap.sh
index 17a5798c29da..7a2d372f4885 100644
--- a/scripts/xz_wrap.sh
+++ b/scripts/xz_wrap.sh
@@ -12,8 +12,8 @@
12BCJ= 12BCJ=
13LZMA2OPTS= 13LZMA2OPTS=
14 14
15case $ARCH in 15case $SRCARCH in
16 x86|x86_64) BCJ=--x86 ;; 16 x86) BCJ=--x86 ;;
17 powerpc) BCJ=--powerpc ;; 17 powerpc) BCJ=--powerpc ;;
18 ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;; 18 ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;;
19 arm) BCJ=--arm ;; 19 arm) BCJ=--arm ;;
diff --git a/security/commoncap.c b/security/commoncap.c
index 0cf4b53480a7..71a166a05975 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -29,6 +29,7 @@
29#include <linux/securebits.h> 29#include <linux/securebits.h>
30#include <linux/user_namespace.h> 30#include <linux/user_namespace.h>
31#include <linux/binfmts.h> 31#include <linux/binfmts.h>
32#include <linux/personality.h>
32 33
33/* 34/*
34 * If a non-root user executes a setuid-root binary in 35 * If a non-root user executes a setuid-root binary in
@@ -505,6 +506,11 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
505 } 506 }
506skip: 507skip:
507 508
509 /* if we have fs caps, clear dangerous personality flags */
510 if (!cap_issubset(new->cap_permitted, old->cap_permitted))
511 bprm->per_clear |= PER_CLEAR_ON_SETID;
512
513
508 /* Don't let someone trace a set[ug]id/setpcap binary with the revised 514 /* Don't let someone trace a set[ug]id/setpcap binary with the revised
509 * credentials unless they have the appropriate permit 515 * credentials unless they have the appropriate permit
510 */ 516 */
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 10056f2f6df3..45c32f074166 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -3640,8 +3640,38 @@ struct security_operations smack_ops = {
3640}; 3640};
3641 3641
3642 3642
3643static __init void init_smack_know_list(void) 3643static __init void init_smack_known_list(void)
3644{ 3644{
3645 /*
3646 * Initialize CIPSO locks
3647 */
3648 spin_lock_init(&smack_known_huh.smk_cipsolock);
3649 spin_lock_init(&smack_known_hat.smk_cipsolock);
3650 spin_lock_init(&smack_known_star.smk_cipsolock);
3651 spin_lock_init(&smack_known_floor.smk_cipsolock);
3652 spin_lock_init(&smack_known_invalid.smk_cipsolock);
3653 spin_lock_init(&smack_known_web.smk_cipsolock);
3654 /*
3655 * Initialize rule list locks
3656 */
3657 mutex_init(&smack_known_huh.smk_rules_lock);
3658 mutex_init(&smack_known_hat.smk_rules_lock);
3659 mutex_init(&smack_known_floor.smk_rules_lock);
3660 mutex_init(&smack_known_star.smk_rules_lock);
3661 mutex_init(&smack_known_invalid.smk_rules_lock);
3662 mutex_init(&smack_known_web.smk_rules_lock);
3663 /*
3664 * Initialize rule lists
3665 */
3666 INIT_LIST_HEAD(&smack_known_huh.smk_rules);
3667 INIT_LIST_HEAD(&smack_known_hat.smk_rules);
3668 INIT_LIST_HEAD(&smack_known_star.smk_rules);
3669 INIT_LIST_HEAD(&smack_known_floor.smk_rules);
3670 INIT_LIST_HEAD(&smack_known_invalid.smk_rules);
3671 INIT_LIST_HEAD(&smack_known_web.smk_rules);
3672 /*
3673 * Create the known labels list
3674 */
3645 list_add(&smack_known_huh.list, &smack_known_list); 3675 list_add(&smack_known_huh.list, &smack_known_list);
3646 list_add(&smack_known_hat.list, &smack_known_list); 3676 list_add(&smack_known_hat.list, &smack_known_list);
3647 list_add(&smack_known_star.list, &smack_known_list); 3677 list_add(&smack_known_star.list, &smack_known_list);
@@ -3676,16 +3706,8 @@ static __init int smack_init(void)
3676 cred = (struct cred *) current->cred; 3706 cred = (struct cred *) current->cred;
3677 cred->security = tsp; 3707 cred->security = tsp;
3678 3708
3679 /* initialize the smack_know_list */ 3709 /* initialize the smack_known_list */
3680 init_smack_know_list(); 3710 init_smack_known_list();
3681 /*
3682 * Initialize locks
3683 */
3684 spin_lock_init(&smack_known_huh.smk_cipsolock);
3685 spin_lock_init(&smack_known_hat.smk_cipsolock);
3686 spin_lock_init(&smack_known_star.smk_cipsolock);
3687 spin_lock_init(&smack_known_floor.smk_cipsolock);
3688 spin_lock_init(&smack_known_invalid.smk_cipsolock);
3689 3711
3690 /* 3712 /*
3691 * Register with LSM 3713 * Register with LSM
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 5c32f36ff706..038811cb7e62 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -1614,20 +1614,6 @@ static int __init init_smk_fs(void)
1614 smk_cipso_doi(); 1614 smk_cipso_doi();
1615 smk_unlbl_ambient(NULL); 1615 smk_unlbl_ambient(NULL);
1616 1616
1617 mutex_init(&smack_known_floor.smk_rules_lock);
1618 mutex_init(&smack_known_hat.smk_rules_lock);
1619 mutex_init(&smack_known_huh.smk_rules_lock);
1620 mutex_init(&smack_known_invalid.smk_rules_lock);
1621 mutex_init(&smack_known_star.smk_rules_lock);
1622 mutex_init(&smack_known_web.smk_rules_lock);
1623
1624 INIT_LIST_HEAD(&smack_known_floor.smk_rules);
1625 INIT_LIST_HEAD(&smack_known_hat.smk_rules);
1626 INIT_LIST_HEAD(&smack_known_huh.smk_rules);
1627 INIT_LIST_HEAD(&smack_known_invalid.smk_rules);
1628 INIT_LIST_HEAD(&smack_known_star.smk_rules);
1629 INIT_LIST_HEAD(&smack_known_web.smk_rules);
1630
1631 return err; 1617 return err;
1632} 1618}
1633 1619
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c
index 14a286a7bf2b..857586135d18 100644
--- a/sound/core/vmaster.c
+++ b/sound/core/vmaster.c
@@ -419,6 +419,7 @@ EXPORT_SYMBOL(snd_ctl_make_virtual_master);
419 * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control 419 * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control
420 * @kcontrol: vmaster kctl element 420 * @kcontrol: vmaster kctl element
421 * @hook: the hook function 421 * @hook: the hook function
422 * @private_data: the private_data pointer to be saved
422 * 423 *
423 * Adds the given hook to the vmaster control element so that it's called 424 * Adds the given hook to the vmaster control element so that it's called
424 * at each time when the value is changed. 425 * at each time when the value is changed.
diff --git a/sound/last.c b/sound/last.c
index bdd0857b8871..7ffc182e0844 100644
--- a/sound/last.c
+++ b/sound/last.c
@@ -38,4 +38,4 @@ static int __init alsa_sound_last_init(void)
38 return 0; 38 return 0;
39} 39}
40 40
41__initcall(alsa_sound_last_init); 41late_initcall_sync(alsa_sound_last_init);
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index a36488d94aaa..d906c5b74cf0 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3971,9 +3971,14 @@ static void cx_auto_init_output(struct hda_codec *codec)
3971 int i; 3971 int i;
3972 3972
3973 mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids); 3973 mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids);
3974 for (i = 0; i < cfg->hp_outs; i++) 3974 for (i = 0; i < cfg->hp_outs; i++) {
3975 unsigned int val = PIN_OUT;
3976 if (snd_hda_query_pin_caps(codec, cfg->hp_pins[i]) &
3977 AC_PINCAP_HP_DRV)
3978 val |= AC_PINCTL_HP_EN;
3975 snd_hda_codec_write(codec, cfg->hp_pins[i], 0, 3979 snd_hda_codec_write(codec, cfg->hp_pins[i], 0,
3976 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); 3980 AC_VERB_SET_PIN_WIDGET_CONTROL, val);
3981 }
3977 mute_outputs(codec, cfg->hp_outs, cfg->hp_pins); 3982 mute_outputs(codec, cfg->hp_outs, cfg->hp_pins);
3978 mute_outputs(codec, cfg->line_outs, cfg->line_out_pins); 3983 mute_outputs(codec, cfg->line_outs, cfg->line_out_pins);
3979 mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins); 3984 mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins);
@@ -4391,8 +4396,10 @@ static void apply_pin_fixup(struct hda_codec *codec,
4391 4396
4392enum { 4397enum {
4393 CXT_PINCFG_LENOVO_X200, 4398 CXT_PINCFG_LENOVO_X200,
4399 CXT_PINCFG_LENOVO_TP410,
4394}; 4400};
4395 4401
4402/* ThinkPad X200 & co with cxt5051 */
4396static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { 4403static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = {
4397 { 0x16, 0x042140ff }, /* HP (seq# overridden) */ 4404 { 0x16, 0x042140ff }, /* HP (seq# overridden) */
4398 { 0x17, 0x21a11000 }, /* dock-mic */ 4405 { 0x17, 0x21a11000 }, /* dock-mic */
@@ -4401,15 +4408,33 @@ static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = {
4401 {} 4408 {}
4402}; 4409};
4403 4410
4411/* ThinkPad 410/420/510/520, X201 & co with cxt5066 */
4412static const struct cxt_pincfg cxt_pincfg_lenovo_tp410[] = {
4413 { 0x19, 0x042110ff }, /* HP (seq# overridden) */
4414 { 0x1a, 0x21a190f0 }, /* dock-mic */
4415 { 0x1c, 0x212140ff }, /* dock-HP */
4416 {}
4417};
4418
4404static const struct cxt_pincfg *cxt_pincfg_tbl[] = { 4419static const struct cxt_pincfg *cxt_pincfg_tbl[] = {
4405 [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200, 4420 [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200,
4421 [CXT_PINCFG_LENOVO_TP410] = cxt_pincfg_lenovo_tp410,
4406}; 4422};
4407 4423
4408static const struct snd_pci_quirk cxt_fixups[] = { 4424static const struct snd_pci_quirk cxt5051_fixups[] = {
4409 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), 4425 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200),
4410 {} 4426 {}
4411}; 4427};
4412 4428
4429static const struct snd_pci_quirk cxt5066_fixups[] = {
4430 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
4431 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410),
4432 SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410),
4433 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410),
4434 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
4435 {}
4436};
4437
4413/* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches 4438/* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches
4414 * can be created (bko#42825) 4439 * can be created (bko#42825)
4415 */ 4440 */
@@ -4446,13 +4471,13 @@ static int patch_conexant_auto(struct hda_codec *codec)
4446 case 0x14f15051: 4471 case 0x14f15051:
4447 add_cx5051_fake_mutes(codec); 4472 add_cx5051_fake_mutes(codec);
4448 codec->pin_amp_workaround = 1; 4473 codec->pin_amp_workaround = 1;
4474 apply_pin_fixup(codec, cxt5051_fixups, cxt_pincfg_tbl);
4449 break; 4475 break;
4450 default: 4476 default:
4451 codec->pin_amp_workaround = 1; 4477 codec->pin_amp_workaround = 1;
4478 apply_pin_fixup(codec, cxt5066_fixups, cxt_pincfg_tbl);
4452 } 4479 }
4453 4480
4454 apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl);
4455
4456 /* Show mute-led control only on HP laptops 4481 /* Show mute-led control only on HP laptops
4457 * This is a sort of white-list: on HP laptops, EAPD corresponds 4482 * This is a sort of white-list: on HP laptops, EAPD corresponds
4458 * only to the mute-LED without actualy amp function. Meanwhile, 4483 * only to the mute-LED without actualy amp function. Meanwhile,
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 2508f8109f11..e65e35433055 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1445,6 +1445,13 @@ enum {
1445 ALC_FIXUP_ACT_BUILD, 1445 ALC_FIXUP_ACT_BUILD,
1446}; 1446};
1447 1447
1448static void alc_apply_pincfgs(struct hda_codec *codec,
1449 const struct alc_pincfg *cfg)
1450{
1451 for (; cfg->nid; cfg++)
1452 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1453}
1454
1448static void alc_apply_fixup(struct hda_codec *codec, int action) 1455static void alc_apply_fixup(struct hda_codec *codec, int action)
1449{ 1456{
1450 struct alc_spec *spec = codec->spec; 1457 struct alc_spec *spec = codec->spec;
@@ -1478,9 +1485,7 @@ static void alc_apply_fixup(struct hda_codec *codec, int action)
1478 snd_printdd(KERN_INFO "hda_codec: %s: " 1485 snd_printdd(KERN_INFO "hda_codec: %s: "
1479 "Apply pincfg for %s\n", 1486 "Apply pincfg for %s\n",
1480 codec->chip_name, modelname); 1487 codec->chip_name, modelname);
1481 for (; cfg->nid; cfg++) 1488 alc_apply_pincfgs(codec, cfg);
1482 snd_hda_codec_set_pincfg(codec, cfg->nid,
1483 cfg->val);
1484 break; 1489 break;
1485 case ALC_FIXUP_VERBS: 1490 case ALC_FIXUP_VERBS:
1486 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) 1491 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
@@ -4861,6 +4866,7 @@ enum {
4861 ALC260_FIXUP_GPIO1_TOGGLE, 4866 ALC260_FIXUP_GPIO1_TOGGLE,
4862 ALC260_FIXUP_REPLACER, 4867 ALC260_FIXUP_REPLACER,
4863 ALC260_FIXUP_HP_B1900, 4868 ALC260_FIXUP_HP_B1900,
4869 ALC260_FIXUP_KN1,
4864}; 4870};
4865 4871
4866static void alc260_gpio1_automute(struct hda_codec *codec) 4872static void alc260_gpio1_automute(struct hda_codec *codec)
@@ -4888,6 +4894,36 @@ static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
4888 } 4894 }
4889} 4895}
4890 4896
4897static void alc260_fixup_kn1(struct hda_codec *codec,
4898 const struct alc_fixup *fix, int action)
4899{
4900 struct alc_spec *spec = codec->spec;
4901 static const struct alc_pincfg pincfgs[] = {
4902 { 0x0f, 0x02214000 }, /* HP/speaker */
4903 { 0x12, 0x90a60160 }, /* int mic */
4904 { 0x13, 0x02a19000 }, /* ext mic */
4905 { 0x18, 0x01446000 }, /* SPDIF out */
4906 /* disable bogus I/O pins */
4907 { 0x10, 0x411111f0 },
4908 { 0x11, 0x411111f0 },
4909 { 0x14, 0x411111f0 },
4910 { 0x15, 0x411111f0 },
4911 { 0x16, 0x411111f0 },
4912 { 0x17, 0x411111f0 },
4913 { 0x19, 0x411111f0 },
4914 { }
4915 };
4916
4917 switch (action) {
4918 case ALC_FIXUP_ACT_PRE_PROBE:
4919 alc_apply_pincfgs(codec, pincfgs);
4920 break;
4921 case ALC_FIXUP_ACT_PROBE:
4922 spec->init_amp = ALC_INIT_NONE;
4923 break;
4924 }
4925}
4926
4891static const struct alc_fixup alc260_fixups[] = { 4927static const struct alc_fixup alc260_fixups[] = {
4892 [ALC260_FIXUP_HP_DC5750] = { 4928 [ALC260_FIXUP_HP_DC5750] = {
4893 .type = ALC_FIXUP_PINS, 4929 .type = ALC_FIXUP_PINS,
@@ -4938,7 +4974,11 @@ static const struct alc_fixup alc260_fixups[] = {
4938 .v.func = alc260_fixup_gpio1_toggle, 4974 .v.func = alc260_fixup_gpio1_toggle,
4939 .chained = true, 4975 .chained = true,
4940 .chain_id = ALC260_FIXUP_COEF, 4976 .chain_id = ALC260_FIXUP_COEF,
4941 } 4977 },
4978 [ALC260_FIXUP_KN1] = {
4979 .type = ALC_FIXUP_FUNC,
4980 .v.func = alc260_fixup_kn1,
4981 },
4942}; 4982};
4943 4983
4944static const struct snd_pci_quirk alc260_fixup_tbl[] = { 4984static const struct snd_pci_quirk alc260_fixup_tbl[] = {
@@ -4948,6 +4988,7 @@ static const struct snd_pci_quirk alc260_fixup_tbl[] = {
4948 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), 4988 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
4949 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), 4989 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
4950 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), 4990 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
4991 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
4951 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER), 4992 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
4952 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF), 4993 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
4953 {} 4994 {}
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 33a9946b492c..4742cac26aa9 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -5063,12 +5063,11 @@ static void stac92xx_update_led_status(struct hda_codec *codec, int enabled)
5063 if (spec->gpio_led_polarity) 5063 if (spec->gpio_led_polarity)
5064 muted = !muted; 5064 muted = !muted;
5065 5065
5066 /*polarity defines *not* muted state level*/
5067 if (!spec->vref_mute_led_nid) { 5066 if (!spec->vref_mute_led_nid) {
5068 if (muted) 5067 if (muted)
5069 spec->gpio_data &= ~spec->gpio_led; /* orange */ 5068 spec->gpio_data |= spec->gpio_led;
5070 else 5069 else
5071 spec->gpio_data |= spec->gpio_led; /* white */ 5070 spec->gpio_data &= ~spec->gpio_led;
5072 stac_gpio_set(codec, spec->gpio_mask, 5071 stac_gpio_set(codec, spec->gpio_mask,
5073 spec->gpio_dir, spec->gpio_data); 5072 spec->gpio_dir, spec->gpio_data);
5074 } else { 5073 } else {
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 6508e8b790bb..59d8efaa17e9 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -57,7 +57,7 @@ config SND_SOC_ALL_CODECS
57 select SND_SOC_TPA6130A2 if I2C 57 select SND_SOC_TPA6130A2 if I2C
58 select SND_SOC_TLV320DAC33 if I2C 58 select SND_SOC_TLV320DAC33 if I2C
59 select SND_SOC_TWL4030 if TWL4030_CORE 59 select SND_SOC_TWL4030 if TWL4030_CORE
60 select SND_SOC_TWL6040 if TWL4030_CORE 60 select SND_SOC_TWL6040 if TWL6040_CORE
61 select SND_SOC_UDA134X 61 select SND_SOC_UDA134X
62 select SND_SOC_UDA1380 if I2C 62 select SND_SOC_UDA1380 if I2C
63 select SND_SOC_WL1273 if MFD_WL1273_CORE 63 select SND_SOC_WL1273 if MFD_WL1273_CORE
@@ -276,7 +276,6 @@ config SND_SOC_TWL4030
276 tristate 276 tristate
277 277
278config SND_SOC_TWL6040 278config SND_SOC_TWL6040
279 select TWL6040_CORE
280 tristate 279 tristate
281 280
282config SND_SOC_UDA134X 281config SND_SOC_UDA134X
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 2d8c6b825e57..dc7509b9d53a 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -26,7 +26,6 @@
26#include <linux/pm.h> 26#include <linux/pm.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/i2c/twl.h>
30#include <linux/mfd/twl6040.h> 29#include <linux/mfd/twl6040.h>
31 30
32#include <sound/core.h> 31#include <sound/core.h>
@@ -1528,7 +1527,7 @@ static int twl6040_resume(struct snd_soc_codec *codec)
1528static int twl6040_probe(struct snd_soc_codec *codec) 1527static int twl6040_probe(struct snd_soc_codec *codec)
1529{ 1528{
1530 struct twl6040_data *priv; 1529 struct twl6040_data *priv;
1531 struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); 1530 struct twl6040_codec_data *pdata = dev_get_platdata(codec->dev);
1532 struct platform_device *pdev = container_of(codec->dev, 1531 struct platform_device *pdev = container_of(codec->dev,
1533 struct platform_device, dev); 1532 struct platform_device, dev);
1534 int ret = 0; 1533 int ret = 0;
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index e00dd0b1139c..deafbfaacdbf 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -97,7 +97,7 @@ config SND_OMAP_SOC_SDP3430
97 97
98config SND_OMAP_SOC_OMAP_ABE_TWL6040 98config SND_OMAP_SOC_OMAP_ABE_TWL6040
99 tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec" 99 tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec"
100 depends on TWL4030_CORE && SND_OMAP_SOC && ARCH_OMAP4 100 depends on TWL6040_CORE && SND_OMAP_SOC && ARCH_OMAP4
101 select SND_OMAP_SOC_DMIC 101 select SND_OMAP_SOC_DMIC
102 select SND_OMAP_SOC_MCPDM 102 select SND_OMAP_SOC_MCPDM
103 select SND_SOC_TWL6040 103 select SND_SOC_TWL6040
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 416684be0ad3..26b823b61aa1 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -19,3 +19,5 @@ TAGS
19cscope* 19cscope*
20config.mak 20config.mak
21config.mak.autogen 21config.mak.autogen
22*-bison.*
23*-flex.*
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 820371f10d1b..03059e75665a 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -237,21 +237,20 @@ export PERL_PATH
237FLEX = $(CROSS_COMPILE)flex 237FLEX = $(CROSS_COMPILE)flex
238BISON= $(CROSS_COMPILE)bison 238BISON= $(CROSS_COMPILE)bison
239 239
240event-parser: 240$(OUTPUT)util/parse-events-flex.c: util/parse-events.l
241 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
242 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c 241 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
243 242
244$(OUTPUT)util/parse-events-flex.c: event-parser 243$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
245$(OUTPUT)util/parse-events-bison.c: event-parser 244 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
246 245
247pmu-parser: 246$(OUTPUT)util/pmu-flex.c: util/pmu.l
248 $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
249 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c 247 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
250 248
251$(OUTPUT)util/pmu-flex.c: pmu-parser 249$(OUTPUT)util/pmu-bison.c: util/pmu.y
252$(OUTPUT)util/pmu-bison.c: pmu-parser 250 $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
253 251
254$(OUTPUT)util/parse-events.o: event-parser pmu-parser 252$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
253$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
255 254
256LIB_FILE=$(OUTPUT)libperf.a 255LIB_FILE=$(OUTPUT)libperf.a
257 256
@@ -527,7 +526,7 @@ else
527endif 526endif
528 527
529ifdef NO_GTK2 528ifdef NO_GTK2
530 BASIC_CFLAGS += -DNO_GTK2 529 BASIC_CFLAGS += -DNO_GTK2_SUPPORT
531else 530else
532 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) 531 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0)
533 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) 532 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y)
@@ -852,8 +851,6 @@ help:
852 @echo ' html - make html documentation' 851 @echo ' html - make html documentation'
853 @echo ' info - make GNU info documentation (access with info <foo>)' 852 @echo ' info - make GNU info documentation (access with info <foo>)'
854 @echo ' pdf - make pdf documentation' 853 @echo ' pdf - make pdf documentation'
855 @echo ' event-parser - make event parser code'
856 @echo ' pmu-parser - make pmu format parser code'
857 @echo ' TAGS - use etags to make tag information for source browsing' 854 @echo ' TAGS - use etags to make tag information for source browsing'
858 @echo ' tags - use ctags to make tag information for source browsing' 855 @echo ' tags - use ctags to make tag information for source browsing'
859 @echo ' cscope - use cscope to make interactive browsing database' 856 @echo ' cscope - use cscope to make interactive browsing database'
diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh
index 677e59d62a8d..95b6f8b6177a 100644
--- a/tools/perf/perf-archive.sh
+++ b/tools/perf/perf-archive.sh
@@ -29,13 +29,14 @@ if [ ! -s $BUILDIDS ] ; then
29fi 29fi
30 30
31MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX) 31MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
32PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/
32 33
33cut -d ' ' -f 1 $BUILDIDS | \ 34cut -d ' ' -f 1 $BUILDIDS | \
34while read build_id ; do 35while read build_id ; do
35 linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2} 36 linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2}
36 filename=$(readlink -f $linkname) 37 filename=$(readlink -f $linkname)
37 echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST 38 echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST
38 echo ${filename#$PERF_BUILDID_DIR} >> $MANIFEST 39 echo ${filename#$PERF_BUILDID_LINKDIR} >> $MANIFEST
39done 40done
40 41
41tar cfj $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST 42tar cfj $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 00923cda4d9c..1efd3bee6336 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -876,11 +876,11 @@ static int perf_session_deliver_event(struct perf_session *session,
876 dump_sample(session, event, sample); 876 dump_sample(session, event, sample);
877 if (evsel == NULL) { 877 if (evsel == NULL) {
878 ++session->hists.stats.nr_unknown_id; 878 ++session->hists.stats.nr_unknown_id;
879 return -1; 879 return 0;
880 } 880 }
881 if (machine == NULL) { 881 if (machine == NULL) {
882 ++session->hists.stats.nr_unprocessable_samples; 882 ++session->hists.stats.nr_unprocessable_samples;
883 return -1; 883 return 0;
884 } 884 }
885 return tool->sample(tool, event, sample, evsel, machine); 885 return tool->sample(tool, event, sample, evsel, machine);
886 case PERF_RECORD_MMAP: 886 case PERF_RECORD_MMAP:
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index a457d2138f49..e9fff9830bf0 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -240,9 +240,13 @@ int kvm_iommu_map_guest(struct kvm *kvm)
240 return -ENODEV; 240 return -ENODEV;
241 } 241 }
242 242
243 mutex_lock(&kvm->slots_lock);
244
243 kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type); 245 kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type);
244 if (!kvm->arch.iommu_domain) 246 if (!kvm->arch.iommu_domain) {
245 return -ENOMEM; 247 r = -ENOMEM;
248 goto out_unlock;
249 }
246 250
247 if (!allow_unsafe_assigned_interrupts && 251 if (!allow_unsafe_assigned_interrupts &&
248 !iommu_domain_has_cap(kvm->arch.iommu_domain, 252 !iommu_domain_has_cap(kvm->arch.iommu_domain,
@@ -253,17 +257,16 @@ int kvm_iommu_map_guest(struct kvm *kvm)
253 " module option.\n", __func__); 257 " module option.\n", __func__);
254 iommu_domain_free(kvm->arch.iommu_domain); 258 iommu_domain_free(kvm->arch.iommu_domain);
255 kvm->arch.iommu_domain = NULL; 259 kvm->arch.iommu_domain = NULL;
256 return -EPERM; 260 r = -EPERM;
261 goto out_unlock;
257 } 262 }
258 263
259 r = kvm_iommu_map_memslots(kvm); 264 r = kvm_iommu_map_memslots(kvm);
260 if (r) 265 if (r)
261 goto out_unmap; 266 kvm_iommu_unmap_memslots(kvm);
262
263 return 0;
264 267
265out_unmap: 268out_unlock:
266 kvm_iommu_unmap_memslots(kvm); 269 mutex_unlock(&kvm->slots_lock);
267 return r; 270 return r;
268} 271}
269 272
@@ -310,6 +313,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
310 } 313 }
311} 314}
312 315
316void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
317{
318 kvm_iommu_put_pages(kvm, slot->base_gfn, slot->npages);
319}
320
313static int kvm_iommu_unmap_memslots(struct kvm *kvm) 321static int kvm_iommu_unmap_memslots(struct kvm *kvm)
314{ 322{
315 int idx; 323 int idx;
@@ -320,7 +328,7 @@ static int kvm_iommu_unmap_memslots(struct kvm *kvm)
320 slots = kvm_memslots(kvm); 328 slots = kvm_memslots(kvm);
321 329
322 kvm_for_each_memslot(memslot, slots) 330 kvm_for_each_memslot(memslot, slots)
323 kvm_iommu_put_pages(kvm, memslot->base_gfn, memslot->npages); 331 kvm_iommu_unmap_pages(kvm, memslot);
324 332
325 srcu_read_unlock(&kvm->srcu, idx); 333 srcu_read_unlock(&kvm->srcu, idx);
326 334
@@ -335,7 +343,11 @@ int kvm_iommu_unmap_guest(struct kvm *kvm)
335 if (!domain) 343 if (!domain)
336 return 0; 344 return 0;
337 345
346 mutex_lock(&kvm->slots_lock);
338 kvm_iommu_unmap_memslots(kvm); 347 kvm_iommu_unmap_memslots(kvm);
348 kvm->arch.iommu_domain = NULL;
349 mutex_unlock(&kvm->slots_lock);
350
339 iommu_domain_free(domain); 351 iommu_domain_free(domain);
340 return 0; 352 return 0;
341} 353}
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 42b73930a6de..9739b533ca2e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -808,12 +808,13 @@ int __kvm_set_memory_region(struct kvm *kvm,
808 if (r) 808 if (r)
809 goto out_free; 809 goto out_free;
810 810
811 /* map the pages in iommu page table */ 811 /* map/unmap the pages in iommu page table */
812 if (npages) { 812 if (npages) {
813 r = kvm_iommu_map_pages(kvm, &new); 813 r = kvm_iommu_map_pages(kvm, &new);
814 if (r) 814 if (r)
815 goto out_free; 815 goto out_free;
816 } 816 } else
817 kvm_iommu_unmap_pages(kvm, &old);
817 818
818 r = -ENOMEM; 819 r = -ENOMEM;
819 slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), 820 slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),