aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/media_api.tmpl4
-rw-r--r--Documentation/devicetree/bindings/arm/bcm/bcm11351.txt3
-rw-r--r--Documentation/devicetree/bindings/arm/bcm/kona-timer.txt (renamed from Documentation/devicetree/bindings/arm/bcm/bcm,kona-timer.txt)5
-rw-r--r--Documentation/devicetree/bindings/arm/bcm/kona-wdt.txt15
-rw-r--r--Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt2
-rw-r--r--Documentation/devicetree/bindings/media/s5p-mfc.txt10
-rw-r--r--Documentation/devicetree/bindings/misc/smc.txt5
-rw-r--r--Documentation/devicetree/bindings/mmc/kona-sdhci.txt (renamed from Documentation/devicetree/bindings/mmc/bcm,kona-sdhci.txt)5
-rw-r--r--Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt11
-rw-r--r--Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt11
-rw-r--r--Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt12
-rw-r--r--Documentation/devicetree/bindings/pinctrl/ste,nomadik.txt6
-rw-r--r--Documentation/devicetree/bindings/regulator/palmas-pmic.txt4
-rw-r--r--MAINTAINERS12
-rw-r--r--Makefile2
-rw-r--r--arch/arm/Makefile1
-rw-r--r--arch/arm/boot/dts/Makefile30
-rw-r--r--arch/arm/boot/dts/at91rm9200.dtsi1
-rw-r--r--arch/arm/boot/dts/at91rm9200_pqfp.dtsi17
-rw-r--r--arch/arm/boot/dts/at91sam9260.dtsi1
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi20
-rw-r--r--arch/arm/boot/dts/at91sam9n12ek.dts18
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi3
-rw-r--r--arch/arm/boot/dts/at91sam9x5ek.dtsi24
-rw-r--r--arch/arm/boot/dts/bcm11351-brt.dts8
-rw-r--r--arch/arm/boot/dts/bcm11351.dtsi33
-rw-r--r--arch/arm/boot/dts/bcm28155-ap.dts45
-rw-r--r--arch/arm/boot/dts/ccu8540.dts41
-rw-r--r--arch/arm/boot/dts/emev2-kzm9d-reference.dts57
-rw-r--r--arch/arm/boot/dts/emev2-kzm9d.dts2
-rw-r--r--arch/arm/boot/dts/emev2.dtsi59
-rw-r--r--arch/arm/boot/dts/exynos4.dtsi122
-rw-r--r--arch/arm/boot/dts/exynos4210-pinctrl.dtsi23
-rw-r--r--arch/arm/boot/dts/exynos4210-trats.dts100
-rw-r--r--arch/arm/boot/dts/exynos4210.dtsi30
-rw-r--r--arch/arm/boot/dts/exynos4412-origen.dts5
-rw-r--r--arch/arm/boot/dts/exynos4412-trats2.dts579
-rw-r--r--arch/arm/boot/dts/exynos4x12-pinctrl.dtsi61
-rw-r--r--arch/arm/boot/dts/exynos4x12.dtsi103
-rw-r--r--arch/arm/boot/dts/exynos5.dtsi19
-rw-r--r--arch/arm/boot/dts/exynos5250-arndale.dts105
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts32
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi38
-rw-r--r--arch/arm/boot/dts/exynos5420-pinctrl.dtsi7
-rw-r--r--arch/arm/boot/dts/exynos5420-smdk5420.dts31
-rw-r--r--arch/arm/boot/dts/exynos5420.dtsi75
-rw-r--r--arch/arm/boot/dts/exynos5440.dtsi27
-rw-r--r--arch/arm/boot/dts/imx23-evk.dts15
-rw-r--r--arch/arm/boot/dts/imx23-olinuxino.dts4
-rw-r--r--arch/arm/boot/dts/imx23.dtsi17
-rw-r--r--arch/arm/boot/dts/imx28-cfa10036.dts7
-rw-r--r--arch/arm/boot/dts/imx28-cfa10037.dts19
-rw-r--r--arch/arm/boot/dts/imx28-cfa10049.dts73
-rw-r--r--arch/arm/boot/dts/imx28-cfa10055.dts38
-rw-r--r--arch/arm/boot/dts/imx28-cfa10056.dts119
-rw-r--r--arch/arm/boot/dts/imx28-cfa10057.dts23
-rw-r--r--arch/arm/boot/dts/imx28-cfa10058.dts141
-rw-r--r--arch/arm/boot/dts/imx28-m28evk.dts13
-rw-r--r--arch/arm/boot/dts/imx28.dtsi143
-rw-r--r--arch/arm/boot/dts/msm8960-cdp.dts4
-rw-r--r--arch/arm/boot/dts/omap5-uevm.dts78
-rw-r--r--arch/arm/boot/dts/pxa3xx.dtsi11
-rw-r--r--arch/arm/boot/dts/r8a73a4-ape6evm.dts22
-rw-r--r--arch/arm/boot/dts/r8a73a4.dtsi133
-rw-r--r--arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts34
-rw-r--r--arch/arm/boot/dts/r8a7740.dtsi8
-rw-r--r--arch/arm/boot/dts/r8a7778.dtsi66
-rw-r--r--arch/arm/boot/dts/r8a7779-marzen-reference.dts49
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi90
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi132
-rw-r--r--arch/arm/boot/dts/sama5d3.dtsi5
-rw-r--r--arch/arm/boot/dts/sh7372.dtsi8
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g-reference.dts90
-rw-r--r--arch/arm/boot/dts/sh73a0.dtsi8
-rw-r--r--arch/arm/boot/dts/ste-ccu8540-pinctrl.dtsi196
-rw-r--r--arch/arm/boot/dts/ste-ccu8540.dts86
-rw-r--r--arch/arm/boot/dts/ste-ccu9540.dts (renamed from arch/arm/boot/dts/ccu9540.dts)2
-rw-r--r--arch/arm/boot/dts/ste-dbx5x0.dtsi (renamed from arch/arm/boot/dts/dbx5x0.dtsi)30
-rw-r--r--arch/arm/boot/dts/ste-href.dtsi (renamed from arch/arm/boot/dts/href.dtsi)2
-rw-r--r--arch/arm/boot/dts/ste-hrefprev60.dts (renamed from arch/arm/boot/dts/hrefprev60.dts)6
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus.dts (renamed from arch/arm/boot/dts/hrefv60plus.dts)6
-rw-r--r--arch/arm/boot/dts/ste-nomadik-pinctrl.dtsi95
-rw-r--r--arch/arm/boot/dts/ste-nomadik-stn8815.dtsi42
-rw-r--r--arch/arm/boot/dts/ste-snowball.dts (renamed from arch/arm/boot/dts/snowball.dts)44
-rw-r--r--arch/arm/boot/dts/ste-stuib.dtsi (renamed from arch/arm/boot/dts/stuib.dtsi)0
-rw-r--r--arch/arm/boot/dts/stih41x.dtsi2
-rw-r--r--arch/arm/boot/dts/sun4i-a10-a1000.dts101
-rw-r--r--arch/arm/boot/dts/sun4i-a10-cubieboard.dts6
-rw-r--r--arch/arm/boot/dts/sun4i-a10-hackberry.dts2
-rw-r--r--arch/arm/boot/dts/sun4i-a10-mini-xplus.dts2
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi3
-rw-r--r--arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts27
-rw-r--r--arch/arm/boot/dts/sun5i-a10s.dtsi57
-rw-r--r--arch/arm/boot/dts/sun5i-a13-olinuxino.dts2
-rw-r--r--arch/arm/boot/dts/sun5i-a13.dtsi3
-rw-r--r--arch/arm/boot/dts/sun6i-a31-colombus.dts30
-rw-r--r--arch/arm/boot/dts/sun6i-a31.dtsi156
-rw-r--r--arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts34
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi172
-rw-r--r--arch/arm/boot/dts/tegra114-dalmore.dts237
-rw-r--r--arch/arm/boot/dts/tegra114-pluto.dts33
-rw-r--r--arch/arm/boot/dts/tegra114.dtsi62
-rw-r--r--arch/arm/boot/dts/tegra20-colibri-512.dtsi3
-rw-r--r--arch/arm/boot/dts/tegra20-harmony.dts22
-rw-r--r--arch/arm/boot/dts/tegra20-paz00.dts2
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts4
-rw-r--r--arch/arm/boot/dts/tegra20-tamonten.dtsi19
-rw-r--r--arch/arm/boot/dts/tegra20-tec.dts8
-rw-r--r--arch/arm/boot/dts/tegra20-trimslice.dts32
-rw-r--r--arch/arm/boot/dts/tegra20-ventana.dts2
-rw-r--r--arch/arm/boot/dts/tegra20-whistler.dts2
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi55
-rw-r--r--arch/arm/boot/dts/tegra30-beaver.dts64
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu.dtsi64
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi156
-rw-r--r--arch/arm/boot/dts/u9540.dts72
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi4
-rw-r--r--arch/arm/mach-msm/Kconfig3
-rw-r--r--arch/arm/mach-msm/gpiomux-v1.c33
-rw-r--r--arch/arm/mach-msm/gpiomux.h10
-rw-r--r--arch/arm/mach-nomadik/Kconfig1
-rw-r--r--arch/arm/mach-omap2/dss-common.c2
-rw-r--r--arch/arm/mach-omap2/omap_device.c18
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h50
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c3
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c9
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c5
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_54xx_data.c3
-rw-r--r--arch/arm/mach-omap2/serial.c11
-rw-r--r--arch/arm/mach-pxa/pxa-dt.c2
-rw-r--r--arch/arm/mach-shmobile/Kconfig64
-rw-r--r--arch/arm/mach-shmobile/Makefile34
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot1
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm.c2
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva-reference.c18
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c12
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c8
-rw-r--r--arch/arm/mach-shmobile/board-kzm9d-reference.c47
-rw-r--r--arch/arm/mach-shmobile/board-kzm9d.c4
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g-reference.c49
-rw-r--r--arch/arm/mach-shmobile/board-lager.c4
-rw-r--r--arch/arm/mach-shmobile/board-marzen-reference.c28
-rw-r--r--arch/arm/mach-shmobile/clock-emev2.c2
-rw-r--r--arch/arm/mach-shmobile/include/mach/dma.h1
-rw-r--r--arch/arm/mach-shmobile/include/mach/emev2.h3
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7778.h1
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c381
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c2
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c16
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c72
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c7
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c7
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c7
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c34
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c17
-rw-r--r--arch/arm/mach-sti/headsmp.S2
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c8
-rw-r--r--arch/avr32/boards/atngw100/mrmt.c1
-rw-r--r--arch/mips/include/asm/cpu-features.h2
-rw-r--r--arch/mips/kernel/smp-bmips.c10
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c2
-rw-r--r--arch/mips/pnx833x/common/platform.c2
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/include/asm/processor.h4
-rw-r--r--arch/powerpc/include/asm/reg.h31
-rw-r--r--arch/powerpc/include/asm/switch_to.h9
-rw-r--r--arch/powerpc/kernel/asm-offsets.c3
-rw-r--r--arch/powerpc/kernel/eeh.c2
-rw-r--r--arch/powerpc/kernel/entry_64.S36
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S5
-rw-r--r--arch/powerpc/kernel/process.c10
-rw-r--r--arch/powerpc/kernel/tm.S20
-rw-r--r--arch/powerpc/kernel/traps.c58
-rw-r--r--arch/powerpc/kvm/book3s_hv.c4
-rw-r--r--arch/powerpc/kvm/book3s_pr.c5
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c80
-rw-r--r--arch/s390/Kconfig9
-rw-r--r--arch/s390/boot/compressed/Makefile9
-rw-r--r--arch/s390/boot/compressed/misc.c4
-rw-r--r--arch/s390/include/asm/bitops.h2
-rw-r--r--arch/s390/kernel/perf_event.c9
-rw-r--r--arch/s390/kernel/setup.c1
-rw-r--r--arch/s390/kvm/kvm-s390.c21
-rw-r--r--arch/s390/kvm/priv.c4
-rw-r--r--arch/s390/mm/init.c1
-rw-r--r--arch/s390/oprofile/init.c2
-rw-r--r--arch/x86/boot/compressed/eboot.c2
-rw-r--r--arch/x86/kernel/early-quirks.c14
-rw-r--r--arch/x86/kernel/i387.c2
-rw-r--r--arch/x86/kernel/microcode_amd.c9
-rw-r--r--drivers/acpi/acpi_processor.c3
-rw-r--r--drivers/acpi/glue.c133
-rw-r--r--drivers/acpi/proc.c8
-rw-r--r--drivers/acpi/video.c2
-rw-r--r--drivers/ata/pata_imx.c1
-rw-r--r--drivers/base/regmap/regcache.c3
-rw-r--r--drivers/char/virtio_console.c70
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c20
-rw-r--r--drivers/cpufreq/cpufreq_governor.c8
-rw-r--r--drivers/cpufreq/cpufreq_governor.h4
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c20
-rw-r--r--drivers/cpufreq/loongson2_cpufreq.c11
-rw-r--r--drivers/dma/sh/shdma.c4
-rw-r--r--drivers/gpu/drm/ast/ast_ttm.c1
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_ttm.c1
-rw-r--r--drivers/gpu/drm/drm_irq.c5
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h12
-rw-r--r--drivers/gpu/drm/i915/intel_display.c4
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c18
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c18
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_ttm.c1
-rw-r--r--drivers/gpu/drm/radeon/btc_dpm.c17
-rw-r--r--drivers/gpu/drm/radeon/cik.c18
-rw-r--r--drivers/gpu/drm/radeon/cypress_dpm.c17
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c6
-rw-r--r--drivers/gpu/drm/radeon/evergreen_hdmi.c26
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h3
-rw-r--r--drivers/gpu/drm/radeon/ni.c16
-rw-r--r--drivers/gpu/drm/radeon/ni_dpm.c17
-rw-r--r--drivers/gpu/drm/radeon/r600.c41
-rw-r--r--drivers/gpu/drm/radeon/r600_hdmi.c37
-rw-r--r--drivers/gpu/drm/radeon/r600d.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon.h4
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_uvd.c93
-rw-r--r--drivers/gpu/drm/radeon/rv6xx_dpm.c22
-rw-r--r--drivers/gpu/drm/radeon/rv770.c7
-rw-r--r--drivers/gpu/drm/radeon/rv770_dpm.c33
-rw-r--r--drivers/gpu/drm/radeon/rv770_dpm.h1
-rw-r--r--drivers/gpu/drm/radeon/si.c19
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c61
-rw-r--r--drivers/hid/hid-logitech-dj.c2
-rw-r--r--drivers/hwmon/adt7470.c2
-rw-r--r--drivers/i2c/busses/i2c-kempld.c4
-rw-r--r--drivers/i2c/busses/i2c-mxs.c2
-rw-r--r--drivers/iio/adc/ti_am335x_adc.c30
-rw-r--r--drivers/iio/industrialio-trigger.c34
-rw-r--r--drivers/media/i2c/ml86v7667.c4
-rw-r--r--drivers/media/platform/coda.c2
-rw-r--r--drivers/media/platform/s5p-g2d/g2d.c1
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_dec.c79
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_enc.c46
-rw-r--r--drivers/media/usb/em28xx/em28xx-i2c.c2
-rw-r--r--drivers/media/usb/hdpvr/hdpvr-core.c11
-rw-r--r--drivers/media/usb/usbtv/Kconfig2
-rw-r--r--drivers/media/usb/usbtv/usbtv.c51
-rw-r--r--drivers/pci/pci-acpi.c15
-rw-r--r--drivers/s390/block/dasd.c6
-rw-r--r--drivers/scsi/fnic/fnic.h2
-rw-r--r--drivers/scsi/fnic/fnic_main.c22
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c20
-rw-r--r--drivers/scsi/scsi.c3
-rw-r--r--drivers/scsi/virtio_scsi.c2
-rw-r--r--drivers/spi/spi-davinci.c2
-rw-r--r--drivers/staging/zcache/zcache-main.c6
-rw-r--r--drivers/usb/core/hub.c5
-rw-r--r--drivers/usb/host/xhci-mem.c1
-rw-r--r--drivers/usb/host/xhci.c1
-rw-r--r--drivers/video/mxsfb.c26
-rw-r--r--drivers/video/omap2/displays-new/connector-analog-tv.c18
-rw-r--r--fs/btrfs/backref.c48
-rw-r--r--fs/btrfs/ctree.c1
-rw-r--r--fs/btrfs/extent_io.c9
-rw-r--r--fs/btrfs/file.c62
-rw-r--r--fs/btrfs/inode.c52
-rw-r--r--fs/btrfs/transaction.c8
-rw-r--r--fs/btrfs/transaction.h2
-rw-r--r--fs/btrfs/tree-log.c5
-rw-r--r--fs/debugfs/inode.c69
-rw-r--r--fs/dlm/user.c1
-rw-r--r--fs/ext4/extents.c2
-rw-r--r--fs/ext4/ialloc.c10
-rw-r--r--fs/ext4/inode.c39
-rw-r--r--fs/ext4/super.c1
-rw-r--r--fs/fcntl.c4
-rw-r--r--fs/lockd/clntlock.c13
-rw-r--r--fs/lockd/clntproc.c5
-rw-r--r--fs/namei.c10
-rw-r--r--fs/nfs/inode.c11
-rw-r--r--fs/nfs/nfs4proc.c8
-rw-r--r--fs/nfs/super.c4
-rw-r--r--fs/nfsd/nfs4proc.c2
-rw-r--r--fs/nfsd/nfs4state.c2
-rw-r--r--fs/nfsd/nfs4xdr.c5
-rw-r--r--fs/open.c2
-rw-r--r--fs/reiserfs/procfs.c99
-rw-r--r--fs/reiserfs/super.c3
-rw-r--r--include/acpi/acpi_bus.h14
-rw-r--r--include/dt-bindings/pinctrl/nomadik.h36
-rw-r--r--include/linux/ftrace_event.h12
-rw-r--r--include/linux/iio/trigger.h3
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h16
-rw-r--r--include/linux/regmap.h1
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/user_namespace.h1
-rw-r--r--include/media/v4l2-ctrls.h1
-rw-r--r--kernel/cgroup.c4
-rw-r--r--kernel/printk/braille.c3
-rw-r--r--kernel/ptrace.c1
-rw-r--r--kernel/trace/ftrace.c87
-rw-r--r--kernel/trace/trace.c27
-rw-r--r--kernel/trace/trace_events.c200
-rw-r--r--kernel/trace/trace_events_filter.c17
-rw-r--r--kernel/trace/trace_kprobe.c21
-rw-r--r--kernel/trace/trace_uprobe.c51
-rw-r--r--kernel/user_namespace.c17
-rw-r--r--kernel/workqueue.c44
-rw-r--r--mm/slub.c3
-rw-r--r--net/sunrpc/clnt.c4
-rw-r--r--net/sunrpc/netns.h1
-rw-r--r--net/sunrpc/rpcb_clnt.c48
-rw-r--r--security/smack/smack_lsm.c24
-rw-r--r--sound/usb/6fire/comm.c38
-rw-r--r--sound/usb/6fire/comm.h2
-rw-r--r--sound/usb/endpoint.c13
322 files changed, 6650 insertions, 2210 deletions
diff --git a/Documentation/DocBook/media_api.tmpl b/Documentation/DocBook/media_api.tmpl
index 6a8b7158697f..9c92bb879b6d 100644
--- a/Documentation/DocBook/media_api.tmpl
+++ b/Documentation/DocBook/media_api.tmpl
@@ -1,6 +1,6 @@
1<?xml version="1.0"?> 1<?xml version="1.0"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4<!ENTITY % media-entities SYSTEM "./media-entities.tmpl"> %media-entities; 4<!ENTITY % media-entities SYSTEM "./media-entities.tmpl"> %media-entities;
5<!ENTITY media-indices SYSTEM "./media-indices.tmpl"> 5<!ENTITY media-indices SYSTEM "./media-indices.tmpl">
6 6
diff --git a/Documentation/devicetree/bindings/arm/bcm/bcm11351.txt b/Documentation/devicetree/bindings/arm/bcm/bcm11351.txt
index fb7b5cd2652f..0ff6560e6094 100644
--- a/Documentation/devicetree/bindings/arm/bcm/bcm11351.txt
+++ b/Documentation/devicetree/bindings/arm/bcm/bcm11351.txt
@@ -6,4 +6,5 @@ bcm11351, bcm28145, bcm28155 SoCs) shall have the following properties:
6 6
7Required root node property: 7Required root node property:
8 8
9compatible = "bcm,bcm11351"; 9compatible = "brcm,bcm11351";
10DEPRECATED: compatible = "bcm,bcm11351";
diff --git a/Documentation/devicetree/bindings/arm/bcm/bcm,kona-timer.txt b/Documentation/devicetree/bindings/arm/bcm/kona-timer.txt
index 59fa6e68d4f6..17d88b233d1b 100644
--- a/Documentation/devicetree/bindings/arm/bcm/bcm,kona-timer.txt
+++ b/Documentation/devicetree/bindings/arm/bcm/kona-timer.txt
@@ -4,14 +4,15 @@ This timer is used in the following Broadcom SoCs:
4 BCM11130, BCM11140, BCM11351, BCM28145, BCM28155 4 BCM11130, BCM11140, BCM11351, BCM28145, BCM28155
5 5
6Required properties: 6Required properties:
7- compatible : "bcm,kona-timer" 7- compatible : "brcm,kona-timer"
8- DEPRECATED: compatible : "bcm,kona-timer"
8- reg : Register range for the timer 9- reg : Register range for the timer
9- interrupts : interrupt for the timer 10- interrupts : interrupt for the timer
10- clock-frequency: frequency that the clock operates 11- clock-frequency: frequency that the clock operates
11 12
12Example: 13Example:
13 timer@35006000 { 14 timer@35006000 {
14 compatible = "bcm,kona-timer"; 15 compatible = "brcm,kona-timer";
15 reg = <0x35006000 0x1000>; 16 reg = <0x35006000 0x1000>;
16 interrupts = <0x0 7 0x4>; 17 interrupts = <0x0 7 0x4>;
17 clock-frequency = <32768>; 18 clock-frequency = <32768>;
diff --git a/Documentation/devicetree/bindings/arm/bcm/kona-wdt.txt b/Documentation/devicetree/bindings/arm/bcm/kona-wdt.txt
new file mode 100644
index 000000000000..2b86a00e351d
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/bcm/kona-wdt.txt
@@ -0,0 +1,15 @@
1Broadcom Kona Family Watchdog Timer
2-----------------------------------
3
4This watchdog timer is used in the following Broadcom SoCs:
5 BCM11130, BCM11140, BCM11351, BCM28145, BCM28155
6
7Required properties:
8 - compatible = "brcm,bcm11351-wdt", "brcm,kona-wdt";
9 - reg: memory address & range
10
11Example:
12 watchdog@35002f40 {
13 compatible = "brcm,bcm11351-wdt", "brcm,kona-wdt";
14 reg = <0x35002f40 0x6c>;
15 };
diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
index a1ee681942cc..6113f9275f42 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
@@ -4,7 +4,7 @@
4Required properties : 4Required properties :
5 5
6 - reg : Offset and length of the register set for the device 6 - reg : Offset and length of the register set for the device
7 - compatible : Should be "marvell,mv64xxx-i2c" 7 - compatible : Should be "marvell,mv64xxx-i2c" or "allwinner,sun4i-i2c"
8 - interrupts : The interrupt number 8 - interrupts : The interrupt number
9 9
10Optional properties : 10Optional properties :
diff --git a/Documentation/devicetree/bindings/media/s5p-mfc.txt b/Documentation/devicetree/bindings/media/s5p-mfc.txt
index df37b0230c75..d75c3e589d43 100644
--- a/Documentation/devicetree/bindings/media/s5p-mfc.txt
+++ b/Documentation/devicetree/bindings/media/s5p-mfc.txt
@@ -15,9 +15,9 @@ Required properties:
15 mapped region. 15 mapped region.
16 16
17 - interrupts : MFC interrupt number to the CPU. 17 - interrupts : MFC interrupt number to the CPU.
18 - clocks : from common clock binding: handle to mfc clocks. 18 - clocks : from common clock binding: handle to mfc clock.
19 - clock-names : from common clock binding: must contain "sclk_mfc" and "mfc", 19 - clock-names : from common clock binding: must contain "mfc",
20 corresponding to entries in the clocks property. 20 corresponding to entry in the clocks property.
21 21
22 - samsung,mfc-r : Base address of the first memory bank used by MFC 22 - samsung,mfc-r : Base address of the first memory bank used by MFC
23 for DMA contiguous memory allocation and its size. 23 for DMA contiguous memory allocation and its size.
@@ -37,8 +37,8 @@ mfc: codec@13400000 {
37 reg = <0x13400000 0x10000>; 37 reg = <0x13400000 0x10000>;
38 interrupts = <0 94 0>; 38 interrupts = <0 94 0>;
39 samsung,power-domain = <&pd_mfc>; 39 samsung,power-domain = <&pd_mfc>;
40 clocks = <&clock 170>, <&clock 273>; 40 clocks = <&clock 273>;
41 clock-names = "sclk_mfc", "mfc"; 41 clock-names = "mfc";
42}; 42};
43 43
44Board specific DT entry: 44Board specific DT entry:
diff --git a/Documentation/devicetree/bindings/misc/smc.txt b/Documentation/devicetree/bindings/misc/smc.txt
index 02b428136177..6c9f176f3571 100644
--- a/Documentation/devicetree/bindings/misc/smc.txt
+++ b/Documentation/devicetree/bindings/misc/smc.txt
@@ -4,11 +4,12 @@ This binding defines the location of the bounce buffer
4used for non-secure to secure communications. 4used for non-secure to secure communications.
5 5
6Required properties: 6Required properties:
7- compatible : "bcm,kona-smc" 7- compatible : "brcm,kona-smc"
8- DEPRECATED: compatible : "bcm,kona-smc"
8- reg : Location and size of bounce buffer 9- reg : Location and size of bounce buffer
9 10
10Example: 11Example:
11 smc@0x3404c000 { 12 smc@0x3404c000 {
12 compatible = "bcm,bcm11351-smc", "bcm,kona-smc"; 13 compatible = "brcm,bcm11351-smc", "brcm,kona-smc";
13 reg = <0x3404c000 0x400>; //1 KiB in SRAM 14 reg = <0x3404c000 0x400>; //1 KiB in SRAM
14 }; 15 };
diff --git a/Documentation/devicetree/bindings/mmc/bcm,kona-sdhci.txt b/Documentation/devicetree/bindings/mmc/kona-sdhci.txt
index 094ae010f2fb..789fb07a426d 100644
--- a/Documentation/devicetree/bindings/mmc/bcm,kona-sdhci.txt
+++ b/Documentation/devicetree/bindings/mmc/kona-sdhci.txt
@@ -4,12 +4,13 @@ This file documents differences between the core properties in mmc.txt
4and the properties present in the bcm281xx SDHCI 4and the properties present in the bcm281xx SDHCI
5 5
6Required properties: 6Required properties:
7- compatible : Should be "bcm,kona-sdhci" 7- compatible : Should be "brcm,kona-sdhci"
8- DEPRECATED: compatible : Should be "bcm,kona-sdhci"
8 9
9Example: 10Example:
10 11
11sdio2: sdio@0x3f1a0000 { 12sdio2: sdio@0x3f1a0000 {
12 compatible = "bcm,kona-sdhci"; 13 compatible = "brcm,kona-sdhci";
13 reg = <0x3f1a0000 0x10000>; 14 reg = <0x3f1a0000 0x10000>;
14 interrupts = <0x0 74 0x4>; 15 interrupts = <0x0 74 0x4>;
15}; 16};
diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt
index e204d009f16c..fb70856c5b51 100644
--- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt
+++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt
@@ -80,6 +80,17 @@ Valid values for pin and group names are:
80 dbg, sdio3, spi, uaa, uab, uart2, uart3, sdio1, ddc, gma, gme, gmf, gmg, 80 dbg, sdio3, spi, uaa, uab, uart2, uart3, sdio1, ddc, gma, gme, gmf, gmg,
81 gmh, owr, uda. 81 gmh, owr, uda.
82 82
83Valid values for nvidia,functions are:
84
85 blink, cec, cldvfs, clk12, cpu, dap, dap1, dap2, dev3, displaya,
86 displaya_alt, displayb, dtv, emc_dll, extperiph1, extperiph2,
87 extperiph3, gmi, gmi_alt, hda, hsi, i2c1, i2c2, i2c3, i2c4, i2cpwr,
88 i2s0, i2s1, i2s2, i2s3, i2s4, irda, kbc, nand, nand_alt, owr, pmi,
89 pwm0, pwm1, pwm2, pwm3, pwron, reset_out_n, rsvd1, rsvd2, rsvd3,
90 rsvd4, sdmmc1, sdmmc2, sdmmc3, sdmmc4, soc, spdif, spi1, spi2, spi3,
91 spi4, spi5, spi6, sysclk, trace, uarta, uartb, uartc, uartd, ulpi,
92 usb, vgp1, vgp2, vgp3, vgp4, vgp5, vgp6, vi, vi_alt1, vi_alt3
93
83Example: 94Example:
84 95
85 pinmux: pinmux { 96 pinmux: pinmux {
diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
index 683fde93c4fb..61e73cde9ae9 100644
--- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
+++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
@@ -103,6 +103,17 @@ Valid values for pin and group names are:
103 drive_gma, drive_gmb, drive_gmc, drive_gmd, drive_gme, drive_owr, 103 drive_gma, drive_gmb, drive_gmc, drive_gmd, drive_gme, drive_owr,
104 drive_uda. 104 drive_uda.
105 105
106Valid values for nvidia,functions are:
107
108 ahb_clk, apb_clk, audio_sync, crt, dap1, dap2, dap3, dap4, dap5,
109 displaya, displayb, emc_test0_dll, emc_test1_dll, gmi, gmi_int,
110 hdmi, i2cp, i2c1, i2c2, i2c3, ide, irda, kbc, mio, mipi_hs, nand,
111 osc, owr, pcie, plla_out, pllc_out1, pllm_out1, pllp_out2, pllp_out3,
112 pllp_out4, pwm, pwr_intr, pwr_on, rsvd1, rsvd2, rsvd3, rsvd4, rtck,
113 sdio1, sdio2, sdio3, sdio4, sflash, spdif, spi1, spi2, spi2_alt,
114 spi3, spi4, trace, twc, uarta, uartb, uartc, uartd, uarte, ulpi,
115 vi, vi_sensor_clk, xio
116
106Example: 117Example:
107 118
108 pinctrl@70000000 { 119 pinctrl@70000000 {
diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt
index 6f426ed7009e..0e6354c11e6d 100644
--- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt
+++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt
@@ -91,6 +91,18 @@ Valid values for pin and group names are:
91 gmh, gpv, lcd1, lcd2, owr, sdio1, sdio2, sdio3, spi, uaa, uab, uart2, 91 gmh, gpv, lcd1, lcd2, owr, sdio1, sdio2, sdio3, spi, uaa, uab, uart2,
92 uart3, uda, vi1. 92 uart3, uda, vi1.
93 93
94Valid values for nvidia,functions are:
95
96 blink, cec, clk_12m_out, clk_32k_in, core_pwr_req, cpu_pwr_req, crt,
97 dap, ddr, dev3, displaya, displayb, dtv, extperiph1, extperiph2,
98 extperiph3, gmi, gmi_alt, hda, hdcp, hdmi, hsi, i2c1, i2c2, i2c3,
99 i2c4, i2cpwr, i2s0, i2s1, i2s2, i2s3, i2s4, invalid, kbc, mio, nand,
100 nand_alt, owr, pcie, pwm0, pwm1, pwm2, pwm3, pwr_int_n, rsvd1, rsvd2,
101 rsvd3, rsvd4, rtck, sata, sdmmc1, sdmmc2, sdmmc3, sdmmc4, spdif, spi1,
102 spi2, spi2_alt, spi3, spi4, spi5, spi6, sysclk, test, trace, uarta,
103 uartb, uartc, uartd, uarte, ulpi, vgp1, vgp2, vgp3, vgp4, vgp5, vgp6,
104 vi, vi_alt1, vi_alt2, vi_alt3
105
94Example: 106Example:
95 107
96 pinctrl@70000000 { 108 pinctrl@70000000 {
diff --git a/Documentation/devicetree/bindings/pinctrl/ste,nomadik.txt b/Documentation/devicetree/bindings/pinctrl/ste,nomadik.txt
index 9a2f3f420526..6b33b9f18e88 100644
--- a/Documentation/devicetree/bindings/pinctrl/ste,nomadik.txt
+++ b/Documentation/devicetree/bindings/pinctrl/ste,nomadik.txt
@@ -1,8 +1,8 @@
1ST Ericsson Nomadik pinmux controller 1ST Ericsson Nomadik pinmux controller
2 2
3Required properties: 3Required properties:
4- compatible: "stericsson,nmk-pinctrl", "stericsson,nmk-pinctrl-db8540", 4- compatible: "stericsson,db8500-pinctrl", "stericsson,db8540-pinctrl",
5 "stericsson,nmk-pinctrl-stn8815" 5 "stericsson,stn8815-pinctrl"
6- reg: Should contain the register physical address and length of the PRCMU. 6- reg: Should contain the register physical address and length of the PRCMU.
7 7
8Please refer to pinctrl-bindings.txt in this directory for details of the 8Please refer to pinctrl-bindings.txt in this directory for details of the
@@ -68,7 +68,7 @@ Optional subnode-properties:
68Example board file extract: 68Example board file extract:
69 69
70 pinctrl@80157000 { 70 pinctrl@80157000 {
71 compatible = "stericsson,nmk-pinctrl"; 71 compatible = "stericsson,db8500-pinctrl";
72 reg = <0x80157000 0x2000>; 72 reg = <0x80157000 0x2000>;
73 73
74 pinctrl-names = "default"; 74 pinctrl-names = "default";
diff --git a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt
index d5a308629c57..30b0581bb1ce 100644
--- a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt
+++ b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt
@@ -31,9 +31,8 @@ Optional nodes:
31 Optional sub-node properties: 31 Optional sub-node properties:
32 ti,warm-reset - maintain voltage during warm reset(boolean) 32 ti,warm-reset - maintain voltage during warm reset(boolean)
33 ti,roof-floor - control voltage selection by pin(boolean) 33 ti,roof-floor - control voltage selection by pin(boolean)
34 ti,sleep-mode - mode to adopt in pmic sleep 0 - off, 1 - auto, 34 ti,mode-sleep - mode to adopt in pmic sleep 0 - off, 1 - auto,
35 2 - eco, 3 - forced pwm 35 2 - eco, 3 - forced pwm
36 ti,tstep - slope control 0 - Jump, 1 10mV/us, 2 5mV/us, 3 2.5mV/us
37 ti,smps-range - OTP has the wrong range set for the hardware so override 36 ti,smps-range - OTP has the wrong range set for the hardware so override
38 0 - low range, 1 - high range. 37 0 - low range, 1 - high range.
39 38
@@ -59,7 +58,6 @@ pmic {
59 ti,warm-reset; 58 ti,warm-reset;
60 ti,roof-floor; 59 ti,roof-floor;
61 ti,mode-sleep = <0>; 60 ti,mode-sleep = <0>;
62 ti,tstep = <0>;
63 ti,smps-range = <1>; 61 ti,smps-range = <1>;
64 }; 62 };
65 63
diff --git a/MAINTAINERS b/MAINTAINERS
index defc05383f83..7cacc88dc79c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -965,6 +965,12 @@ M: Lennert Buytenhek <kernel@wantstofly.org>
965L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 965L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
966S: Maintained 966S: Maintained
967 967
968ARM/TEXAS INSTRUMENT KEYSTONE ARCHITECTURE
969M: Santosh Shilimkar <santosh.shilimkar@ti.com>
970L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
971S: Maintained
972F: arch/arm/mach-keystone/
973
968ARM/LOGICPD PXA270 MACHINE SUPPORT 974ARM/LOGICPD PXA270 MACHINE SUPPORT
969M: Lennert Buytenhek <kernel@wantstofly.org> 975M: Lennert Buytenhek <kernel@wantstofly.org>
970L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 976L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -1259,7 +1265,6 @@ F: drivers/rtc/rtc-coh901331.c
1259T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git 1265T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git
1260 1266
1261ARM/Ux500 ARM ARCHITECTURE 1267ARM/Ux500 ARM ARCHITECTURE
1262M: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
1263M: Linus Walleij <linus.walleij@linaro.org> 1268M: Linus Walleij <linus.walleij@linaro.org>
1264L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1269L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1265S: Maintained 1270S: Maintained
@@ -8664,6 +8669,11 @@ T: git git://git.alsa-project.org/alsa-kernel.git
8664S: Maintained 8669S: Maintained
8665F: sound/usb/midi.* 8670F: sound/usb/midi.*
8666 8671
8672USB NETWORKING DRIVERS
8673L: linux-usb@vger.kernel.org
8674S: Odd Fixes
8675F: drivers/net/usb/
8676
8667USB OHCI DRIVER 8677USB OHCI DRIVER
8668M: Alan Stern <stern@rowland.harvard.edu> 8678M: Alan Stern <stern@rowland.harvard.edu>
8669L: linux-usb@vger.kernel.org 8679L: linux-usb@vger.kernel.org
diff --git a/Makefile b/Makefile
index f93d4f7a90c2..6e488480bff3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 11 2PATCHLEVEL = 11
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc4 4EXTRAVERSION = -rc5
5NAME = Linux for Workgroups 5NAME = Linux for Workgroups
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 6fd2ceae305a..a37a50f575a2 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -190,6 +190,7 @@ machine-$(CONFIG_ARCH_S5PV210) += s5pv210
190machine-$(CONFIG_ARCH_SA1100) += sa1100 190machine-$(CONFIG_ARCH_SA1100) += sa1100
191machine-$(CONFIG_ARCH_SHARK) += shark 191machine-$(CONFIG_ARCH_SHARK) += shark
192machine-$(CONFIG_ARCH_SHMOBILE) += shmobile 192machine-$(CONFIG_ARCH_SHMOBILE) += shmobile
193machine-$(CONFIG_ARCH_SHMOBILE_MULTI) += shmobile
193machine-$(CONFIG_ARCH_SIRF) += prima2 194machine-$(CONFIG_ARCH_SIRF) += prima2
194machine-$(CONFIG_ARCH_SOCFPGA) += socfpga 195machine-$(CONFIG_ARCH_SOCFPGA) += socfpga
195machine-$(CONFIG_ARCH_STI) += sti 196machine-$(CONFIG_ARCH_STI) += sti
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 641b3c9a7028..454288db3180 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -42,7 +42,8 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb
42dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb 42dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb
43 43
44dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 44dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
45dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb 45dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb \
46 bcm28155-ap.dtb
46dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \ 47dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
47 da850-evm.dtb 48 da850-evm.dtb
48dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \ 49dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
@@ -53,13 +54,14 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
53 exynos4210-trats.dtb \ 54 exynos4210-trats.dtb \
54 exynos4210-universal_c210.dtb \ 55 exynos4210-universal_c210.dtb \
55 exynos4412-odroidx.dtb \ 56 exynos4412-odroidx.dtb \
56 exynos4412-smdk4412.dtb \
57 exynos4412-origen.dtb \ 57 exynos4412-origen.dtb \
58 exynos4412-smdk4412.dtb \
59 exynos4412-trats2.dtb \
58 exynos5250-arndale.dtb \ 60 exynos5250-arndale.dtb \
59 exynos5440-sd5v1.dtb \
60 exynos5250-smdk5250.dtb \ 61 exynos5250-smdk5250.dtb \
61 exynos5250-snow.dtb \ 62 exynos5250-snow.dtb \
62 exynos5420-smdk5420.dtb \ 63 exynos5420-smdk5420.dtb \
64 exynos5440-sd5v1.dtb \
63 exynos5440-ssdk5440.dtb 65 exynos5440-ssdk5440.dtb
64dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \ 66dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
65 ecx-2000.dtb 67 ecx-2000.dtb
@@ -143,7 +145,9 @@ dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
143 imx28-cfa10037.dtb \ 145 imx28-cfa10037.dtb \
144 imx28-cfa10049.dtb \ 146 imx28-cfa10049.dtb \
145 imx28-cfa10055.dtb \ 147 imx28-cfa10055.dtb \
148 imx28-cfa10056.dtb \
146 imx28-cfa10057.dtb \ 149 imx28-cfa10057.dtb \
150 imx28-cfa10058.dtb \
147 imx28-evk.dtb \ 151 imx28-evk.dtb \
148 imx28-m28evk.dtb \ 152 imx28-m28evk.dtb \
149 imx28-sps1.dtb \ 153 imx28-sps1.dtb \
@@ -176,13 +180,14 @@ dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
176 am43x-epos-evm.dtb 180 am43x-epos-evm.dtb
177dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb 181dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb
178dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb 182dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
179dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \ 183dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \
180 hrefprev60.dtb \ 184 ste-hrefprev60.dtb \
181 hrefv60plus.dtb \ 185 ste-hrefv60plus.dtb \
182 ccu8540.dtb \ 186 ste-ccu8540.dtb \
183 ccu9540.dtb 187 ste-ccu9540.dtb
184dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb 188dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
185dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ 189dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
190 emev2-kzm9d-reference.dtb \
186 r8a7740-armadillo800eva.dtb \ 191 r8a7740-armadillo800eva.dtb \
187 r8a7778-bockw.dtb \ 192 r8a7778-bockw.dtb \
188 r8a7740-armadillo800eva-reference.dtb \ 193 r8a7740-armadillo800eva-reference.dtb \
@@ -192,6 +197,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
192 sh73a0-kzm9g-reference.dtb \ 197 sh73a0-kzm9g-reference.dtb \
193 r8a73a4-ape6evm.dtb \ 198 r8a73a4-ape6evm.dtb \
194 sh7372-mackerel.dtb 199 sh7372-mackerel.dtb
200dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d-reference.dtb
195dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \ 201dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \
196 socfpga_vt.dtb 202 socfpga_vt.dtb
197dtb-$(CONFIG_ARCH_SPEAR13XX) += spear1310-evb.dtb \ 203dtb-$(CONFIG_ARCH_SPEAR13XX) += spear1310-evb.dtb \
@@ -206,11 +212,14 @@ dtb-$(CONFIG_ARCH_STI)+= stih415-b2000.dtb \
206 stih415-b2020.dtb \ 212 stih415-b2020.dtb \
207 stih416-b2020.dtb 213 stih416-b2020.dtb
208dtb-$(CONFIG_ARCH_SUNXI) += \ 214dtb-$(CONFIG_ARCH_SUNXI) += \
215 sun4i-a10-a1000.dtb \
209 sun4i-a10-cubieboard.dtb \ 216 sun4i-a10-cubieboard.dtb \
210 sun4i-a10-mini-xplus.dtb \ 217 sun4i-a10-mini-xplus.dtb \
211 sun4i-a10-hackberry.dtb \ 218 sun4i-a10-hackberry.dtb \
212 sun5i-a10s-olinuxino-micro.dtb \ 219 sun5i-a10s-olinuxino-micro.dtb \
213 sun5i-a13-olinuxino.dtb 220 sun5i-a13-olinuxino.dtb \
221 sun6i-a31-colombus.dtb \
222 sun7i-a20-olinuxino-micro.dtb
214dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ 223dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
215 tegra20-iris-512.dtb \ 224 tegra20-iris-512.dtb \
216 tegra20-medcom-wide.dtb \ 225 tegra20-medcom-wide.dtb \
@@ -224,8 +233,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
224 tegra30-beaver.dtb \ 233 tegra30-beaver.dtb \
225 tegra30-cardhu-a02.dtb \ 234 tegra30-cardhu-a02.dtb \
226 tegra30-cardhu-a04.dtb \ 235 tegra30-cardhu-a04.dtb \
227 tegra114-dalmore.dtb \ 236 tegra114-dalmore.dtb
228 tegra114-pluto.dtb
229dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \ 237dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \
230 versatile-pb.dtb 238 versatile-pb.dtb
231dtb-$(CONFIG_ARCH_U300) += ste-u300.dtb 239dtb-$(CONFIG_ARCH_U300) += ste-u300.dtb
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
index 92b9e21389db..f77065506f1e 100644
--- a/arch/arm/boot/dts/at91rm9200.dtsi
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -120,6 +120,7 @@
120 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>; 120 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>;
121 #address-cells = <1>; 121 #address-cells = <1>;
122 #size-cells = <0>; 122 #size-cells = <0>;
123 pinctrl-names = "default";
123 status = "disabled"; 124 status = "disabled";
124 }; 125 };
125 126
diff --git a/arch/arm/boot/dts/at91rm9200_pqfp.dtsi b/arch/arm/boot/dts/at91rm9200_pqfp.dtsi
new file mode 100644
index 000000000000..93ca66f80360
--- /dev/null
+++ b/arch/arm/boot/dts/at91rm9200_pqfp.dtsi
@@ -0,0 +1,17 @@
1/*
2 * at91rm9200_pqfp.dtsi - Device Tree Include file for AT91RM9200 PQFP family SoC
3 *
4 * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include "at91rm9200.dtsi"
10
11/ {
12 compatible = "atmel,at91rm9200-pqfp", "atmel,at91rm9200";
13};
14
15&pioD {
16 status = "disabled";
17};
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index c7ccbcbffb3e..56ee8282a7a8 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -572,6 +572,7 @@
572 interrupts = <9 IRQ_TYPE_LEVEL_HIGH 0>; 572 interrupts = <9 IRQ_TYPE_LEVEL_HIGH 0>;
573 #address-cells = <1>; 573 #address-cells = <1>;
574 #size-cells = <0>; 574 #size-cells = <0>;
575 pinctrl-names = "default";
575 status = "disabled"; 576 status = "disabled";
576 }; 577 };
577 578
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index bb7f564b3a55..9fb7ffd32af2 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -291,6 +291,22 @@
291 }; 291 };
292 }; 292 };
293 293
294 i2c0 {
295 pinctrl_i2c0: i2c0-0 {
296 atmel,pins =
297 <AT91_PIOA 30 AT91_PERIPH_A AT91_PINCTRL_NONE
298 AT91_PIOA 31 AT91_PERIPH_A AT91_PINCTRL_NONE>;
299 };
300 };
301
302 i2c1 {
303 pinctrl_i2c1: i2c1-0 {
304 atmel,pins =
305 <AT91_PIOC 0 AT91_PERIPH_C AT91_PINCTRL_NONE
306 AT91_PIOC 1 AT91_PERIPH_C AT91_PINCTRL_NONE>;
307 };
308 };
309
294 tcb0 { 310 tcb0 {
295 pinctrl_tcb0_tclk0: tcb0_tclk0-0 { 311 pinctrl_tcb0_tclk0: tcb0_tclk0-0 {
296 atmel,pins = <AT91_PIOA 24 AT91_PERIPH_A AT91_PINCTRL_NONE>; 312 atmel,pins = <AT91_PIOA 24 AT91_PERIPH_A AT91_PINCTRL_NONE>;
@@ -471,6 +487,8 @@
471 dma-names = "tx", "rx"; 487 dma-names = "tx", "rx";
472 #address-cells = <1>; 488 #address-cells = <1>;
473 #size-cells = <0>; 489 #size-cells = <0>;
490 pinctrl-names = "default";
491 pinctrl-0 = <&pinctrl_i2c0>;
474 status = "disabled"; 492 status = "disabled";
475 }; 493 };
476 494
@@ -483,6 +501,8 @@
483 dma-names = "tx", "rx"; 501 dma-names = "tx", "rx";
484 #address-cells = <1>; 502 #address-cells = <1>;
485 #size-cells = <0>; 503 #size-cells = <0>;
504 pinctrl-names = "default";
505 pinctrl-0 = <&pinctrl_i2c1>;
486 status = "disabled"; 506 status = "disabled";
487 }; 507 };
488 508
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index d59b70c6a6a0..3e86b05bb136 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -40,6 +40,15 @@
40 40
41 i2c0: i2c@f8010000 { 41 i2c0: i2c@f8010000 {
42 status = "okay"; 42 status = "okay";
43
44 qt1070: keyboard@1b {
45 compatible = "qt1070";
46 reg = <0x1b>;
47 interrupt-parent = <&pioA>;
48 interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_qt1070_irq>;
51 };
43 }; 52 };
44 53
45 i2c1: i2c@f8014000 { 54 i2c1: i2c@f8014000 {
@@ -66,6 +75,13 @@
66 <AT91_PIOA 7 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PA7 gpio CD pin pull up and deglitch */ 75 <AT91_PIOA 7 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PA7 gpio CD pin pull up and deglitch */
67 }; 76 };
68 }; 77 };
78
79 qt1070 {
80 pinctrl_qt1070_irq: qt1070_irq {
81 atmel,pins =
82 <AT91_PIOA 2 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
83 };
84 };
69 }; 85 };
70 86
71 spi0: spi@f0000000 { 87 spi0: spi@f0000000 {
@@ -121,7 +137,7 @@
121 137
122 enter { 138 enter {
123 label = "Enter"; 139 label = "Enter";
124 gpios = <&pioB 4 GPIO_ACTIVE_LOW>; 140 gpios = <&pioB 3 GPIO_ACTIVE_LOW>;
125 linux,code = <28>; 141 linux,code = <28>;
126 gpio-key,wakeup; 142 gpio-key,wakeup;
127 }; 143 };
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 57d45f5bea09..cf78ac0b04b1 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -542,6 +542,9 @@
542 compatible = "atmel,at91sam9g45-ssc"; 542 compatible = "atmel,at91sam9g45-ssc";
543 reg = <0xf0010000 0x4000>; 543 reg = <0xf0010000 0x4000>;
544 interrupts = <28 IRQ_TYPE_LEVEL_HIGH 5>; 544 interrupts = <28 IRQ_TYPE_LEVEL_HIGH 5>;
545 dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(13)>,
546 <&dma0 1 AT91_DMA_CFG_PER_ID(14)>;
547 dma-names = "tx", "rx";
545 pinctrl-names = "default"; 548 pinctrl-names = "default";
546 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 549 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
547 status = "disabled"; 550 status = "disabled";
diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
index b753855b2058..5c404226a3d6 100644
--- a/arch/arm/boot/dts/at91sam9x5ek.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -59,6 +59,11 @@
59 59
60 i2c0: i2c@f8010000 { 60 i2c0: i2c@f8010000 {
61 status = "okay"; 61 status = "okay";
62
63 wm8731: wm8731@1a {
64 compatible = "wm8731";
65 reg = <0x1a>;
66 };
62 }; 67 };
63 68
64 pinctrl@fffff400 { 69 pinctrl@fffff400 {
@@ -90,6 +95,10 @@
90 watchdog@fffffe40 { 95 watchdog@fffffe40 {
91 status = "okay"; 96 status = "okay";
92 }; 97 };
98
99 ssc0: ssc@f0010000 {
100 status = "okay";
101 };
93 }; 102 };
94 103
95 usb0: ohci@00600000 { 104 usb0: ohci@00600000 {
@@ -104,4 +113,19 @@
104 status = "okay"; 113 status = "okay";
105 }; 114 };
106 }; 115 };
116
117 sound {
118 compatible = "atmel,sam9x5-wm8731-audio";
119
120 atmel,model = "wm8731 @ AT91SAM9X5EK";
121
122 atmel,audio-routing =
123 "Headphone Jack", "RHPOUT",
124 "Headphone Jack", "LHPOUT",
125 "LLINEIN", "Line In Jack",
126 "RLINEIN", "Line In Jack";
127
128 atmel,ssc-controller = <&ssc0>;
129 atmel,audio-codec = <&wm8731>;
130 };
107}; 131};
diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts
index 67ec524098b5..9d36eb4e3c41 100644
--- a/arch/arm/boot/dts/bcm11351-brt.dts
+++ b/arch/arm/boot/dts/bcm11351-brt.dts
@@ -17,7 +17,7 @@
17 17
18/ { 18/ {
19 model = "BCM11351 BRT board"; 19 model = "BCM11351 BRT board";
20 compatible = "bcm,bcm11351-brt", "bcm,bcm11351"; 20 compatible = "brcm,bcm11351-brt", "brcm,bcm11351";
21 21
22 memory { 22 memory {
23 reg = <0x80000000 0x40000000>; /* 1 GB */ 23 reg = <0x80000000 0x40000000>; /* 1 GB */
@@ -27,18 +27,18 @@
27 status = "okay"; 27 status = "okay";
28 }; 28 };
29 29
30 sdio0: sdio@0x3f180000 { 30 sdio1: sdio@3f180000 {
31 max-frequency = <48000000>; 31 max-frequency = <48000000>;
32 status = "okay"; 32 status = "okay";
33 }; 33 };
34 34
35 sdio1: sdio@0x3f190000 { 35 sdio2: sdio@3f190000 {
36 non-removable; 36 non-removable;
37 max-frequency = <48000000>; 37 max-frequency = <48000000>;
38 status = "okay"; 38 status = "okay";
39 }; 39 };
40 40
41 sdio3: sdio@0x3f1b0000 { 41 sdio4: sdio@3f1b0000 {
42 max-frequency = <48000000>; 42 max-frequency = <48000000>;
43 status = "okay"; 43 status = "okay";
44 }; 44 };
diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index c0cdf66f8964..05a5aabe3b2c 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2012 Broadcom Corporation 2 * Copyright (C) 2012-2013 Broadcom Corporation
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as 5 * modify it under the terms of the GNU General Public License as
@@ -18,7 +18,7 @@
18 18
19/ { 19/ {
20 model = "BCM11351 SoC"; 20 model = "BCM11351 SoC";
21 compatible = "bcm,bcm11351"; 21 compatible = "brcm,bcm11351";
22 interrupt-parent = <&gic>; 22 interrupt-parent = <&gic>;
23 23
24 chosen { 24 chosen {
@@ -35,12 +35,12 @@
35 }; 35 };
36 36
37 smc@0x3404c000 { 37 smc@0x3404c000 {
38 compatible = "bcm,bcm11351-smc", "bcm,kona-smc"; 38 compatible = "brcm,bcm11351-smc", "brcm,kona-smc";
39 reg = <0x3404c000 0x400>; /* 1 KiB in SRAM */ 39 reg = <0x3404c000 0x400>; /* 1 KiB in SRAM */
40 }; 40 };
41 41
42 uart@3e000000 { 42 uart@3e000000 {
43 compatible = "bcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart"; 43 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
44 status = "disabled"; 44 status = "disabled";
45 reg = <0x3e000000 0x1000>; 45 reg = <0x3e000000 0x1000>;
46 clock-frequency = <13000000>; 46 clock-frequency = <13000000>;
@@ -50,42 +50,47 @@
50 }; 50 };
51 51
52 L2: l2-cache { 52 L2: l2-cache {
53 compatible = "bcm,bcm11351-a2-pl310-cache"; 53 compatible = "brcm,bcm11351-a2-pl310-cache";
54 reg = <0x3ff20000 0x1000>; 54 reg = <0x3ff20000 0x1000>;
55 cache-unified; 55 cache-unified;
56 cache-level = <2>; 56 cache-level = <2>;
57 }; 57 };
58 58
59 watchdog@35002f40 {
60 compatible = "brcm,bcm11351-wdt", "brcm,kona-wdt";
61 reg = <0x35002f40 0x6c>;
62 };
63
59 timer@35006000 { 64 timer@35006000 {
60 compatible = "bcm,kona-timer"; 65 compatible = "brcm,kona-timer";
61 reg = <0x35006000 0x1000>; 66 reg = <0x35006000 0x1000>;
62 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; 67 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
63 clock-frequency = <32768>; 68 clock-frequency = <32768>;
64 }; 69 };
65 70
66 sdio0: sdio@0x3f180000 { 71 sdio1: sdio@3f180000 {
67 compatible = "bcm,kona-sdhci"; 72 compatible = "brcm,kona-sdhci";
68 reg = <0x3f180000 0x10000>; 73 reg = <0x3f180000 0x10000>;
69 interrupts = <0x0 77 0x4>; 74 interrupts = <0x0 77 0x4>;
70 status = "disabled"; 75 status = "disabled";
71 }; 76 };
72 77
73 sdio1: sdio@0x3f190000 { 78 sdio2: sdio@3f190000 {
74 compatible = "bcm,kona-sdhci"; 79 compatible = "brcm,kona-sdhci";
75 reg = <0x3f190000 0x10000>; 80 reg = <0x3f190000 0x10000>;
76 interrupts = <0x0 76 0x4>; 81 interrupts = <0x0 76 0x4>;
77 status = "disabled"; 82 status = "disabled";
78 }; 83 };
79 84
80 sdio2: sdio@0x3f1a0000 { 85 sdio3: sdio@3f1a0000 {
81 compatible = "bcm,kona-sdhci"; 86 compatible = "brcm,kona-sdhci";
82 reg = <0x3f1a0000 0x10000>; 87 reg = <0x3f1a0000 0x10000>;
83 interrupts = <0x0 74 0x4>; 88 interrupts = <0x0 74 0x4>;
84 status = "disabled"; 89 status = "disabled";
85 }; 90 };
86 91
87 sdio3: sdio@0x3f1b0000 { 92 sdio4: sdio@3f1b0000 {
88 compatible = "bcm,kona-sdhci"; 93 compatible = "brcm,kona-sdhci";
89 reg = <0x3f1b0000 0x10000>; 94 reg = <0x3f1b0000 0x10000>;
90 interrupts = <0x0 73 0x4>; 95 interrupts = <0x0 73 0x4>;
91 status = "disabled"; 96 status = "disabled";
diff --git a/arch/arm/boot/dts/bcm28155-ap.dts b/arch/arm/boot/dts/bcm28155-ap.dts
new file mode 100644
index 000000000000..96ae67a2f0d3
--- /dev/null
+++ b/arch/arm/boot/dts/bcm28155-ap.dts
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2013 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14/dts-v1/;
15
16#include "bcm11351.dtsi"
17
18/ {
19 model = "BCM28155 AP board";
20 compatible = "brcm,bcm28155-ap", "brcm,bcm11351";
21
22 memory {
23 reg = <0x80000000 0x40000000>; /* 1 GB */
24 };
25
26 uart@3e000000 {
27 status = "okay";
28 };
29
30 sdio1: sdio@3f180000 {
31 max-frequency = <48000000>;
32 status = "okay";
33 };
34
35 sdio2: sdio@3f190000 {
36 non-removable;
37 max-frequency = <48000000>;
38 status = "okay";
39 };
40
41 sdio4: sdio@3f1b0000 {
42 max-frequency = <48000000>;
43 status = "okay";
44 };
45};
diff --git a/arch/arm/boot/dts/ccu8540.dts b/arch/arm/boot/dts/ccu8540.dts
deleted file mode 100644
index 48ff03441f5a..000000000000
--- a/arch/arm/boot/dts/ccu8540.dts
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright 2013 ST-Ericsson AB
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "dbx5x0.dtsi"
14
15/ {
16 model = "ST-Ericsson U8540 platform with Device Tree";
17 compatible = "st-ericsson,ccu8540", "st-ericsson,u8540";
18
19 memory@0 {
20 reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>;
21 };
22
23 soc {
24 prcmu@80157000 {
25 reg = <0x80157000 0x2000>, <0x801b0000 0x8000>, <0x801b8000 0x3000>;
26 reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm";
27 };
28
29 uart@80120000 {
30 status = "okay";
31 };
32
33 uart@80121000 {
34 status = "okay";
35 };
36
37 uart@80007000 {
38 status = "okay";
39 };
40 };
41};
diff --git a/arch/arm/boot/dts/emev2-kzm9d-reference.dts b/arch/arm/boot/dts/emev2-kzm9d-reference.dts
new file mode 100644
index 000000000000..bed676b95c27
--- /dev/null
+++ b/arch/arm/boot/dts/emev2-kzm9d-reference.dts
@@ -0,0 +1,57 @@
1/*
2 * Device Tree Source for the KZM9D board
3 *
4 * Copyright (C) 2013 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/dts-v1/;
11
12/include/ "emev2.dtsi"
13
14/ {
15 model = "EMEV2 KZM9D Board";
16 compatible = "renesas,kzm9d-reference", "renesas,emev2";
17
18 memory {
19 device_type = "memory";
20 reg = <0x40000000 0x8000000>;
21 };
22
23 chosen {
24 bootargs = "console=ttyS1,115200n81 ignore_loglevel root=/dev/nfs ip=dhcp nfsroot=,rsize=4096,wsize=4096";
25 };
26
27 reg_1p8v: regulator@0 {
28 compatible = "regulator-fixed";
29 regulator-name = "fixed-1.8V";
30 regulator-min-microvolt = <1800000>;
31 regulator-max-microvolt = <1800000>;
32 regulator-always-on;
33 regulator-boot-on;
34 };
35
36 reg_3p3v: regulator@1 {
37 compatible = "regulator-fixed";
38 regulator-name = "fixed-3.3V";
39 regulator-min-microvolt = <3300000>;
40 regulator-max-microvolt = <3300000>;
41 regulator-always-on;
42 regulator-boot-on;
43 };
44
45 lan9220@20000000 {
46 compatible = "smsc,lan9220", "smsc,lan9115";
47 reg = <0x20000000 0x10000>;
48 phy-mode = "mii";
49 interrupt-parent = <&gpio0>;
50 interrupts = <1 1>; /* active high */
51 reg-io-width = <4>;
52 smsc,irq-active-high;
53 smsc,irq-push-pull;
54 vddvario-supply = <&reg_1p8v>;
55 vdd33a-supply = <&reg_3p3v>;
56 };
57};
diff --git a/arch/arm/boot/dts/emev2-kzm9d.dts b/arch/arm/boot/dts/emev2-kzm9d.dts
index b9b3241f173b..dda13bc02f9f 100644
--- a/arch/arm/boot/dts/emev2-kzm9d.dts
+++ b/arch/arm/boot/dts/emev2-kzm9d.dts
@@ -21,6 +21,6 @@
21 }; 21 };
22 22
23 chosen { 23 chosen {
24 bootargs = "console=tty0 console=ttyS1,115200n81 earlyprintk=serial8250-em.1,115200n81 mem=128M@0x40000000 ignore_loglevel root=/dev/nfs ip=dhcp nfsroot=,rsize=4096,wsize=4096"; 24 bootargs = "console=ttyS1,115200n81 ignore_loglevel root=/dev/nfs ip=dhcp nfsroot=,rsize=4096,wsize=4096";
25 }; 25 };
26}; 26};
diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi
index c8a8c08b48dd..99ad2b2e8e14 100644
--- a/arch/arm/boot/dts/emev2.dtsi
+++ b/arch/arm/boot/dts/emev2.dtsi
@@ -14,6 +14,14 @@
14 compatible = "renesas,emev2"; 14 compatible = "renesas,emev2";
15 interrupt-parent = <&gic>; 15 interrupt-parent = <&gic>;
16 16
17 aliases {
18 gpio0 = &gpio0;
19 gpio1 = &gpio1;
20 gpio2 = &gpio2;
21 gpio3 = &gpio3;
22 gpio4 = &gpio4;
23 };
24
17 cpus { 25 cpus {
18 #address-cells = <1>; 26 #address-cells = <1>;
19 #size-cells = <0>; 27 #size-cells = <0>;
@@ -67,4 +75,55 @@
67 reg = <0xe1050000 0x38>; 75 reg = <0xe1050000 0x38>;
68 interrupts = <0 11 0>; 76 interrupts = <0 11 0>;
69 }; 77 };
78
79 gpio0: gpio@e0050000 {
80 compatible = "renesas,em-gio";
81 reg = <0xe0050000 0x2c>, <0xe0050040 0x20>;
82 interrupts = <0 67 0>, <0 68 0>;
83 gpio-controller;
84 #gpio-cells = <2>;
85 ngpios = <32>;
86 interrupt-controller;
87 #interrupt-cells = <2>;
88 };
89 gpio1: gpio@e0050080 {
90 compatible = "renesas,em-gio";
91 reg = <0xe0050080 0x2c>, <0xe00500c0 0x20>;
92 interrupts = <0 69 0>, <0 70 0>;
93 gpio-controller;
94 #gpio-cells = <2>;
95 ngpios = <32>;
96 interrupt-controller;
97 #interrupt-cells = <2>;
98 };
99 gpio2: gpio@e0050100 {
100 compatible = "renesas,em-gio";
101 reg = <0xe0050100 0x2c>, <0xe0050140 0x20>;
102 interrupts = <0 71 0>, <0 72 0>;
103 gpio-controller;
104 #gpio-cells = <2>;
105 ngpios = <32>;
106 interrupt-controller;
107 #interrupt-cells = <2>;
108 };
109 gpio3: gpio@e0050180 {
110 compatible = "renesas,em-gio";
111 reg = <0xe0050180 0x2c>, <0xe00501c0 0x20>;
112 interrupts = <0 73 0>, <0 74 0>;
113 gpio-controller;
114 #gpio-cells = <2>;
115 ngpios = <32>;
116 interrupt-controller;
117 #interrupt-cells = <2>;
118 };
119 gpio4: gpio@e0050200 {
120 compatible = "renesas,em-gio";
121 reg = <0xe0050200 0x2c>, <0xe0050240 0x20>;
122 interrupts = <0 75 0>, <0 76 0>;
123 gpio-controller;
124 #gpio-cells = <2>;
125 ngpios = <31>;
126 interrupt-controller;
127 #interrupt-cells = <2>;
128 };
70}; 129};
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index 3f94fe8e3706..93c250139159 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -36,6 +36,12 @@
36 i2c5 = &i2c_5; 36 i2c5 = &i2c_5;
37 i2c6 = &i2c_6; 37 i2c6 = &i2c_6;
38 i2c7 = &i2c_7; 38 i2c7 = &i2c_7;
39 csis0 = &csis_0;
40 csis1 = &csis_1;
41 fimc0 = &fimc_0;
42 fimc1 = &fimc_1;
43 fimc2 = &fimc_2;
44 fimc3 = &fimc_3;
39 }; 45 };
40 46
41 chipid@10000000 { 47 chipid@10000000 {
@@ -92,6 +98,88 @@
92 reg = <0x10010000 0x400>; 98 reg = <0x10010000 0x400>;
93 }; 99 };
94 100
101 camera {
102 compatible = "samsung,fimc", "simple-bus";
103 status = "disabled";
104 #address-cells = <1>;
105 #size-cells = <1>;
106 ranges;
107
108 clock_cam: clock-controller {
109 #clock-cells = <1>;
110 };
111
112 fimc_0: fimc@11800000 {
113 compatible = "samsung,exynos4210-fimc";
114 reg = <0x11800000 0x1000>;
115 interrupts = <0 84 0>;
116 clocks = <&clock 256>, <&clock 128>;
117 clock-names = "fimc", "sclk_fimc";
118 samsung,power-domain = <&pd_cam>;
119 samsung,sysreg = <&sys_reg>;
120 status = "disabled";
121 };
122
123 fimc_1: fimc@11810000 {
124 compatible = "samsung,exynos4210-fimc";
125 reg = <0x11810000 0x1000>;
126 interrupts = <0 85 0>;
127 clocks = <&clock 257>, <&clock 129>;
128 clock-names = "fimc", "sclk_fimc";
129 samsung,power-domain = <&pd_cam>;
130 samsung,sysreg = <&sys_reg>;
131 status = "disabled";
132 };
133
134 fimc_2: fimc@11820000 {
135 compatible = "samsung,exynos4210-fimc";
136 reg = <0x11820000 0x1000>;
137 interrupts = <0 86 0>;
138 clocks = <&clock 258>, <&clock 130>;
139 clock-names = "fimc", "sclk_fimc";
140 samsung,power-domain = <&pd_cam>;
141 samsung,sysreg = <&sys_reg>;
142 status = "disabled";
143 };
144
145 fimc_3: fimc@11830000 {
146 compatible = "samsung,exynos4210-fimc";
147 reg = <0x11830000 0x1000>;
148 interrupts = <0 87 0>;
149 clocks = <&clock 259>, <&clock 131>;
150 clock-names = "fimc", "sclk_fimc";
151 samsung,power-domain = <&pd_cam>;
152 samsung,sysreg = <&sys_reg>;
153 status = "disabled";
154 };
155
156 csis_0: csis@11880000 {
157 compatible = "samsung,exynos4210-csis";
158 reg = <0x11880000 0x4000>;
159 interrupts = <0 78 0>;
160 clocks = <&clock 260>, <&clock 134>;
161 clock-names = "csis", "sclk_csis";
162 bus-width = <4>;
163 samsung,power-domain = <&pd_cam>;
164 status = "disabled";
165 #address-cells = <1>;
166 #size-cells = <0>;
167 };
168
169 csis_1: csis@11890000 {
170 compatible = "samsung,exynos4210-csis";
171 reg = <0x11890000 0x4000>;
172 interrupts = <0 80 0>;
173 clocks = <&clock 261>, <&clock 135>;
174 clock-names = "csis", "sclk_csis";
175 bus-width = <2>;
176 samsung,power-domain = <&pd_cam>;
177 status = "disabled";
178 #address-cells = <1>;
179 #size-cells = <0>;
180 };
181 };
182
95 watchdog@10060000 { 183 watchdog@10060000 {
96 compatible = "samsung,s3c2410-wdt"; 184 compatible = "samsung,s3c2410-wdt";
97 reg = <0x10060000 0x100>; 185 reg = <0x10060000 0x100>;
@@ -155,13 +243,31 @@
155 status = "disabled"; 243 status = "disabled";
156 }; 244 };
157 245
246 ehci@12580000 {
247 compatible = "samsung,exynos4210-ehci";
248 reg = <0x12580000 0x100>;
249 interrupts = <0 70 0>;
250 clocks = <&clock 304>;
251 clock-names = "usbhost";
252 status = "disabled";
253 };
254
255 ohci@12590000 {
256 compatible = "samsung,exynos4210-ohci";
257 reg = <0x12590000 0x100>;
258 interrupts = <0 70 0>;
259 clocks = <&clock 304>;
260 clock-names = "usbhost";
261 status = "disabled";
262 };
263
158 mfc: codec@13400000 { 264 mfc: codec@13400000 {
159 compatible = "samsung,mfc-v5"; 265 compatible = "samsung,mfc-v5";
160 reg = <0x13400000 0x10000>; 266 reg = <0x13400000 0x10000>;
161 interrupts = <0 94 0>; 267 interrupts = <0 94 0>;
162 samsung,power-domain = <&pd_mfc>; 268 samsung,power-domain = <&pd_mfc>;
163 clocks = <&clock 170>, <&clock 273>; 269 clocks = <&clock 273>;
164 clock-names = "sclk_mfc", "mfc"; 270 clock-names = "mfc";
165 status = "disabled"; 271 status = "disabled";
166 }; 272 };
167 273
@@ -297,8 +403,8 @@
297 compatible = "samsung,exynos4210-spi"; 403 compatible = "samsung,exynos4210-spi";
298 reg = <0x13920000 0x100>; 404 reg = <0x13920000 0x100>;
299 interrupts = <0 66 0>; 405 interrupts = <0 66 0>;
300 tx-dma-channel = <&pdma0 7>; /* preliminary */ 406 dmas = <&pdma0 7>, <&pdma0 6>;
301 rx-dma-channel = <&pdma0 6>; /* preliminary */ 407 dma-names = "tx", "rx";
302 #address-cells = <1>; 408 #address-cells = <1>;
303 #size-cells = <0>; 409 #size-cells = <0>;
304 clocks = <&clock 327>, <&clock 159>; 410 clocks = <&clock 327>, <&clock 159>;
@@ -312,8 +418,8 @@
312 compatible = "samsung,exynos4210-spi"; 418 compatible = "samsung,exynos4210-spi";
313 reg = <0x13930000 0x100>; 419 reg = <0x13930000 0x100>;
314 interrupts = <0 67 0>; 420 interrupts = <0 67 0>;
315 tx-dma-channel = <&pdma1 7>; /* preliminary */ 421 dmas = <&pdma1 7>, <&pdma1 6>;
316 rx-dma-channel = <&pdma1 6>; /* preliminary */ 422 dma-names = "tx", "rx";
317 #address-cells = <1>; 423 #address-cells = <1>;
318 #size-cells = <0>; 424 #size-cells = <0>;
319 clocks = <&clock 328>, <&clock 160>; 425 clocks = <&clock 328>, <&clock 160>;
@@ -327,8 +433,8 @@
327 compatible = "samsung,exynos4210-spi"; 433 compatible = "samsung,exynos4210-spi";
328 reg = <0x13940000 0x100>; 434 reg = <0x13940000 0x100>;
329 interrupts = <0 68 0>; 435 interrupts = <0 68 0>;
330 tx-dma-channel = <&pdma0 9>; /* preliminary */ 436 dmas = <&pdma0 9>, <&pdma0 8>;
331 rx-dma-channel = <&pdma0 8>; /* preliminary */ 437 dma-names = "tx", "rx";
332 #address-cells = <1>; 438 #address-cells = <1>;
333 #size-cells = <0>; 439 #size-cells = <0>;
334 clocks = <&clock 329>, <&clock 161>; 440 clocks = <&clock 329>, <&clock 161>;
diff --git a/arch/arm/boot/dts/exynos4210-pinctrl.dtsi b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
index 553bceae8967..a7c212891674 100644
--- a/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
@@ -797,6 +797,29 @@
797 samsung,pin-pud = <0>; 797 samsung,pin-pud = <0>;
798 samsung,pin-drv = <0>; 798 samsung,pin-drv = <0>;
799 }; 799 };
800
801 cam_port_a_io: cam-port-a-io {
802 samsung,pins = "gpj0-0", "gpj0-1", "gpj0-2", "gpj0-3",
803 "gpj0-4", "gpj0-5", "gpj0-6", "gpj0-7",
804 "gpj1-0", "gpj1-1", "gpj1-2", "gpj1-4";
805 samsung,pin-function = <2>;
806 samsung,pin-pud = <0>;
807 samsung,pin-drv = <0>;
808 };
809
810 cam_port_a_clk_active: cam-port-a-clk-active {
811 samsung,pins = "gpj1-3";
812 samsung,pin-function = <2>;
813 samsung,pin-pud = <0>;
814 samsung,pin-drv = <3>;
815 };
816
817 cam_port_a_clk_idle: cam-port-a-clk-idle {
818 samsung,pins = "gpj1-3";
819 samsung,pin-function = <0>;
820 samsung,pin-pud = <1>;
821 samsung,pin-drv = <0>;
822 };
800 }; 823 };
801 824
802 pinctrl@03860000 { 825 pinctrl@03860000 {
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts b/arch/arm/boot/dts/exynos4210-trats.dts
index 94eebffe3044..1c164f234bcc 100644
--- a/arch/arm/boot/dts/exynos4210-trats.dts
+++ b/arch/arm/boot/dts/exynos4210-trats.dts
@@ -30,13 +30,62 @@
30 bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rootwait earlyprintk panic=5"; 30 bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rootwait earlyprintk panic=5";
31 }; 31 };
32 32
33 vemmc_reg: voltage-regulator@0 { 33 regulators {
34 compatible = "regulator-fixed"; 34 compatible = "simple-bus";
35 regulator-name = "VMEM_VDD_2.8V"; 35
36 regulator-min-microvolt = <2800000>; 36 vemmc_reg: regulator-0 {
37 regulator-max-microvolt = <2800000>; 37 compatible = "regulator-fixed";
38 gpio = <&gpk0 2 0>; 38 regulator-name = "VMEM_VDD_2.8V";
39 enable-active-high; 39 regulator-min-microvolt = <2800000>;
40 regulator-max-microvolt = <2800000>;
41 gpio = <&gpk0 2 0>;
42 enable-active-high;
43 };
44
45 tsp_reg: regulator-1 {
46 compatible = "regulator-fixed";
47 regulator-name = "TSP_FIXED_VOLTAGES";
48 regulator-min-microvolt = <2800000>;
49 regulator-max-microvolt = <2800000>;
50 gpio = <&gpl0 3 0>;
51 enable-active-high;
52 };
53
54 cam_af_28v_reg: regulator-2 {
55 compatible = "regulator-fixed";
56 regulator-name = "8M_AF_2.8V_EN";
57 regulator-min-microvolt = <2800000>;
58 regulator-max-microvolt = <2800000>;
59 gpio = <&gpk1 1 0>;
60 enable-active-high;
61 };
62
63 cam_io_en_reg: regulator-3 {
64 compatible = "regulator-fixed";
65 regulator-name = "CAM_IO_EN";
66 regulator-min-microvolt = <2800000>;
67 regulator-max-microvolt = <2800000>;
68 gpio = <&gpe2 1 0>;
69 enable-active-high;
70 };
71
72 cam_io_12v_reg: regulator-4 {
73 compatible = "regulator-fixed";
74 regulator-name = "8M_1.2V_EN";
75 regulator-min-microvolt = <1200000>;
76 regulator-max-microvolt = <1200000>;
77 gpio = <&gpe2 5 0>;
78 enable-active-high;
79 };
80
81 vt_core_15v_reg: regulator-5 {
82 compatible = "regulator-fixed";
83 regulator-name = "VT_CORE_1.5V";
84 regulator-min-microvolt = <1500000>;
85 regulator-max-microvolt = <1500000>;
86 gpio = <&gpe2 2 0>;
87 enable-active-high;
88 };
40 }; 89 };
41 90
42 sdhci_emmc: sdhci@12510000 { 91 sdhci_emmc: sdhci@12510000 {
@@ -97,15 +146,6 @@
97 }; 146 };
98 }; 147 };
99 148
100 tsp_reg: voltage-regulator {
101 compatible = "regulator-fixed";
102 regulator-name = "TSP_FIXED_VOLTAGES";
103 regulator-min-microvolt = <2800000>;
104 regulator-max-microvolt = <2800000>;
105 gpio = <&gpl0 3 0>;
106 enable-active-high;
107 };
108
109 i2c@13890000 { 149 i2c@13890000 {
110 samsung,i2c-sda-delay = <100>; 150 samsung,i2c-sda-delay = <100>;
111 samsung,i2c-slave-addr = <0x10>; 151 samsung,i2c-slave-addr = <0x10>;
@@ -218,6 +258,12 @@
218 regulator-always-on; 258 regulator-always-on;
219 }; 259 };
220 260
261 vtcam_reg: LDO12 {
262 regulator-name = "VT_CAM_1.8V";
263 regulator-min-microvolt = <1800000>;
264 regulator-max-microvolt = <1800000>;
265 };
266
221 vcclcd_reg: LDO13 { 267 vcclcd_reg: LDO13 {
222 regulator-name = "VCC_3.3V_LCD"; 268 regulator-name = "VCC_3.3V_LCD";
223 regulator-min-microvolt = <3300000>; 269 regulator-min-microvolt = <3300000>;
@@ -301,4 +347,26 @@
301 clock-frequency = <24000000>; 347 clock-frequency = <24000000>;
302 }; 348 };
303 }; 349 };
350
351 camera {
352 pinctrl-names = "default";
353 pinctrl-0 = <>;
354 status = "okay";
355
356 fimc_0: fimc@11800000 {
357 status = "okay";
358 };
359
360 fimc_1: fimc@11810000 {
361 status = "okay";
362 };
363
364 fimc_2: fimc@11820000 {
365 status = "okay";
366 };
367
368 fimc_3: fimc@11830000 {
369 status = "okay";
370 };
371 };
304}; 372};
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index b7f358a93bcb..ef8c2a5d2d7f 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -125,4 +125,34 @@
125 clock-names = "sclk_fimg2d", "fimg2d"; 125 clock-names = "sclk_fimg2d", "fimg2d";
126 status = "disabled"; 126 status = "disabled";
127 }; 127 };
128
129 camera {
130 clocks = <&clock 132>, <&clock 133>, <&clock 351>, <&clock 352>;
131 clock-names = "sclk_cam0", "sclk_cam1", "pxl_async0", "pxl_async1";
132
133 fimc_0: fimc@11800000 {
134 samsung,pix-limits = <4224 8192 1920 4224>;
135 samsung,mainscaler-ext;
136 samsung,cam-if;
137 };
138
139 fimc_1: fimc@11810000 {
140 samsung,pix-limits = <4224 8192 1920 4224>;
141 samsung,mainscaler-ext;
142 samsung,cam-if;
143 };
144
145 fimc_2: fimc@11820000 {
146 samsung,pix-limits = <4224 8192 1920 4224>;
147 samsung,mainscaler-ext;
148 samsung,lcd-wb;
149 };
150
151 fimc_3: fimc@11830000 {
152 samsung,pix-limits = <1920 8192 1366 1920>;
153 samsung,rotators = <0>;
154 samsung,mainscaler-ext;
155 samsung,lcd-wb;
156 };
157 };
128}; 158};
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts
index 7993641cb32a..8768b03702e5 100644
--- a/arch/arm/boot/dts/exynos4412-origen.dts
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -27,6 +27,11 @@
27 bootargs ="console=ttySAC2,115200"; 27 bootargs ="console=ttySAC2,115200";
28 }; 28 };
29 29
30 firmware@0203F000 {
31 compatible = "samsung,secure-firmware";
32 reg = <0x0203F000 0x1000>;
33 };
34
30 mmc_reg: voltage-regulator { 35 mmc_reg: voltage-regulator {
31 compatible = "regulator-fixed"; 36 compatible = "regulator-fixed";
32 regulator-name = "VMEM_VDD_2.8V"; 37 regulator-name = "VMEM_VDD_2.8V";
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
new file mode 100644
index 000000000000..fb7b9ae5f399
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -0,0 +1,579 @@
1/*
2 * Samsung's Exynos4412 based Trats 2 board device tree source
3 *
4 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Device tree source file for Samsung's Trats 2 board which is based on
8 * Samsung's Exynos4412 SoC.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15/dts-v1/;
16#include "exynos4412.dtsi"
17
18/ {
19 model = "Samsung Trats 2 based on Exynos4412";
20 compatible = "samsung,trats2", "samsung,exynos4412";
21
22 aliases {
23 i2c8 = &i2c_ak8975;
24 };
25
26 memory {
27 reg = <0x40000000 0x40000000>;
28 };
29
30 chosen {
31 bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rootwait earlyprintk panic=5";
32 };
33
34 firmware@0204F000 {
35 compatible = "samsung,secure-firmware";
36 reg = <0x0204F000 0x1000>;
37 };
38
39 fixed-rate-clocks {
40 xxti {
41 compatible = "samsung,clock-xxti", "fixed-clock";
42 clock-frequency = <0>;
43 };
44
45 xusbxti {
46 compatible = "samsung,clock-xusbxti", "fixed-clock";
47 clock-frequency = <24000000>;
48 };
49 };
50
51 regulators {
52 compatible = "simple-bus";
53 #address-cells = <1>;
54 #size-cells = <0>;
55
56 vemmc_reg: regulator-0 {
57 compatible = "regulator-fixed";
58 regulator-name = "VMEM_VDD_2.8V";
59 regulator-min-microvolt = <2800000>;
60 regulator-max-microvolt = <2800000>;
61 gpio = <&gpk0 2 0>;
62 enable-active-high;
63 };
64
65 cam_io_reg: voltage-regulator-1 {
66 compatible = "regulator-fixed";
67 regulator-name = "CAM_SENSOR_A";
68 regulator-min-microvolt = <2800000>;
69 regulator-max-microvolt = <2800000>;
70 gpio = <&gpm0 2 0>;
71 enable-active-high;
72 };
73
74 /* More to come */
75 };
76
77 gpio-keys {
78 compatible = "gpio-keys";
79
80 key-down {
81 interrupt-parent = <&gpj1>;
82 interrupts = <2 0>;
83 gpios = <&gpj1 2 1>;
84 linux,code = <114>;
85 label = "volume down";
86 debounce-interval = <10>;
87 };
88
89 key-up {
90 interrupt-parent = <&gpj1>;
91 interrupts = <1 0>;
92 gpios = <&gpj1 1 1>;
93 linux,code = <115>;
94 label = "volume up";
95 debounce-interval = <10>;
96 };
97
98 key-power {
99 interrupt-parent = <&gpx2>;
100 interrupts = <7 0>;
101 gpios = <&gpx2 7 1>;
102 linux,code = <116>;
103 label = "power";
104 debounce-interval = <10>;
105 gpio-key,wakeup;
106 };
107 };
108
109 i2c@13890000 {
110 samsung,i2c-sda-delay = <100>;
111 samsung,i2c-slave-addr = <0x10>;
112 samsung,i2c-max-bus-freq = <400000>;
113 pinctrl-0 = <&i2c3_bus>;
114 pinctrl-names = "default";
115 status = "okay";
116
117 mms114-touchscreen@48 {
118 compatible = "melfas,mms114";
119 reg = <0x48>;
120 interrupt-parent = <&gpm2>;
121 interrupts = <3 2>;
122 x-size = <720>;
123 y-size = <1280>;
124 avdd-supply = <&ldo23_reg>;
125 vdd-supply = <&ldo24_reg>;
126 };
127 };
128
129 i2c@138D0000 {
130 samsung,i2c-sda-delay = <100>;
131 samsung,i2c-slave-addr = <0x10>;
132 samsung,i2c-max-bus-freq = <100000>;
133 pinctrl-0 = <&i2c7_bus>;
134 pinctrl-names = "default";
135 status = "okay";
136
137 max77686_pmic@09 {
138 compatible = "maxim,max77686";
139 interrupt-parent = <&gpx0>;
140 interrupts = <7 0>;
141 reg = <0x09>;
142
143 voltage-regulators {
144 ldo1_reg: ldo1 {
145 regulator-compatible = "LDO1";
146 regulator-name = "VALIVE_1.0V_AP";
147 regulator-min-microvolt = <1000000>;
148 regulator-max-microvolt = <1000000>;
149 regulator-always-on;
150 regulator-mem-on;
151 };
152
153 ldo2_reg: ldo2 {
154 regulator-compatible = "LDO2";
155 regulator-name = "VM1M2_1.2V_AP";
156 regulator-min-microvolt = <1200000>;
157 regulator-max-microvolt = <1200000>;
158 regulator-always-on;
159 regulator-mem-on;
160 };
161
162 ldo3_reg: ldo3 {
163 regulator-compatible = "LDO3";
164 regulator-name = "VCC_1.8V_AP";
165 regulator-min-microvolt = <1800000>;
166 regulator-max-microvolt = <1800000>;
167 regulator-always-on;
168 regulator-mem-on;
169 };
170
171 ldo4_reg: ldo4 {
172 regulator-compatible = "LDO4";
173 regulator-name = "VCC_2.8V_AP";
174 regulator-min-microvolt = <2800000>;
175 regulator-max-microvolt = <2800000>;
176 regulator-always-on;
177 regulator-mem-on;
178 };
179
180 ldo5_reg: ldo5 {
181 regulator-compatible = "LDO5";
182 regulator-name = "VCC_1.8V_IO";
183 regulator-min-microvolt = <1800000>;
184 regulator-max-microvolt = <1800000>;
185 regulator-always-on;
186 regulator-mem-on;
187 };
188
189 ldo6_reg: ldo6 {
190 regulator-compatible = "LDO6";
191 regulator-name = "VMPLL_1.0V_AP";
192 regulator-min-microvolt = <1000000>;
193 regulator-max-microvolt = <1000000>;
194 regulator-always-on;
195 regulator-mem-on;
196 };
197
198 ldo7_reg: ldo7 {
199 regulator-compatible = "LDO7";
200 regulator-name = "VPLL_1.0V_AP";
201 regulator-min-microvolt = <1000000>;
202 regulator-max-microvolt = <1000000>;
203 regulator-always-on;
204 regulator-mem-on;
205 };
206
207 ldo8_reg: ldo8 {
208 regulator-compatible = "LDO8";
209 regulator-name = "VMIPI_1.0V";
210 regulator-min-microvolt = <1000000>;
211 regulator-max-microvolt = <1000000>;
212 regulator-mem-off;
213 };
214
215 ldo9_reg: ldo9 {
216 regulator-compatible = "LDO9";
217 regulator-name = "CAM_ISP_MIPI_1.2V";
218 regulator-min-microvolt = <1200000>;
219 regulator-max-microvolt = <1200000>;
220 regulator-mem-idle;
221 };
222
223 ldo10_reg: ldo10 {
224 regulator-compatible = "LDO10";
225 regulator-name = "VMIPI_1.8V";
226 regulator-min-microvolt = <1800000>;
227 regulator-max-microvolt = <1800000>;
228 regulator-mem-off;
229 };
230
231 ldo11_reg: ldo11 {
232 regulator-compatible = "LDO11";
233 regulator-name = "VABB1_1.95V";
234 regulator-min-microvolt = <1950000>;
235 regulator-max-microvolt = <1950000>;
236 regulator-always-on;
237 regulator-mem-off;
238 };
239
240 ldo12_reg: ldo12 {
241 regulator-compatible = "LDO12";
242 regulator-name = "VUOTG_3.0V";
243 regulator-min-microvolt = <3000000>;
244 regulator-max-microvolt = <3000000>;
245 regulator-mem-off;
246 };
247
248 ldo13_reg: ldo13 {
249 regulator-compatible = "LDO13";
250 regulator-name = "NFC_AVDD_1.8V";
251 regulator-min-microvolt = <1800000>;
252 regulator-max-microvolt = <1800000>;
253 regulator-mem-idle;
254 };
255
256 ldo14_reg: ldo14 {
257 regulator-compatible = "LDO14";
258 regulator-name = "VABB2_1.95V";
259 regulator-min-microvolt = <1950000>;
260 regulator-max-microvolt = <1950000>;
261 regulator-always-on;
262 regulator-mem-off;
263 };
264
265 ldo15_reg: ldo15 {
266 regulator-compatible = "LDO15";
267 regulator-name = "VHSIC_1.0V";
268 regulator-min-microvolt = <1000000>;
269 regulator-max-microvolt = <1000000>;
270 regulator-mem-off;
271 };
272
273 ldo16_reg: ldo16 {
274 regulator-compatible = "LDO16";
275 regulator-name = "VHSIC_1.8V";
276 regulator-min-microvolt = <1800000>;
277 regulator-max-microvolt = <1800000>;
278 regulator-mem-off;
279 };
280
281 ldo17_reg: ldo17 {
282 regulator-compatible = "LDO17";
283 regulator-name = "CAM_SENSOR_CORE_1.2V";
284 regulator-min-microvolt = <1200000>;
285 regulator-max-microvolt = <1200000>;
286 regulator-mem-idle;
287 };
288
289 ldo18_reg: ldo18 {
290 regulator-compatible = "LDO18";
291 regulator-name = "CAM_ISP_SEN_IO_1.8V";
292 regulator-min-microvolt = <1800000>;
293 regulator-max-microvolt = <1800000>;
294 regulator-mem-idle;
295 };
296
297 ldo19_reg: ldo19 {
298 regulator-compatible = "LDO19";
299 regulator-name = "VT_CAM_1.8V";
300 regulator-min-microvolt = <1800000>;
301 regulator-max-microvolt = <1800000>;
302 regulator-mem-idle;
303 };
304
305 ldo20_reg: ldo20 {
306 regulator-compatible = "LDO20";
307 regulator-name = "VDDQ_PRE_1.8V";
308 regulator-min-microvolt = <1800000>;
309 regulator-max-microvolt = <1800000>;
310 regulator-mem-idle;
311 };
312
313 ldo21_reg: ldo21 {
314 regulator-compatible = "LDO21";
315 regulator-name = "VTF_2.8V";
316 regulator-min-microvolt = <2800000>;
317 regulator-max-microvolt = <2800000>;
318 regulator-mem-idle;
319 };
320
321 ldo22_reg: ldo22 {
322 regulator-compatible = "LDO22";
323 regulator-name = "VMEM_VDD_2.8V";
324 regulator-min-microvolt = <2800000>;
325 regulator-max-microvolt = <2800000>;
326 regulator-always-on;
327 regulator-mem-off;
328 };
329
330 ldo23_reg: ldo23 {
331 regulator-compatible = "LDO23";
332 regulator-name = "TSP_AVDD_3.3V";
333 regulator-min-microvolt = <3300000>;
334 regulator-max-microvolt = <3300000>;
335 regulator-mem-idle;
336 };
337
338 ldo24_reg: ldo24 {
339 regulator-compatible = "LDO24";
340 regulator-name = "TSP_VDD_1.8V";
341 regulator-min-microvolt = <1800000>;
342 regulator-max-microvolt = <1800000>;
343 regulator-mem-idle;
344 };
345
346 ldo25_reg: ldo25 {
347 regulator-compatible = "LDO25";
348 regulator-name = "LCD_VCC_3.3V";
349 regulator-min-microvolt = <2800000>;
350 regulator-max-microvolt = <2800000>;
351 regulator-mem-idle;
352 };
353
354 ldo26_reg: ldo26 {
355 regulator-compatible = "LDO26";
356 regulator-name = "MOTOR_VCC_3.0V";
357 regulator-min-microvolt = <3000000>;
358 regulator-max-microvolt = <3000000>;
359 regulator-mem-idle;
360 };
361
362 buck1_reg: buck1 {
363 regulator-compatible = "BUCK1";
364 regulator-name = "vdd_mif";
365 regulator-min-microvolt = <850000>;
366 regulator-max-microvolt = <1100000>;
367 regulator-always-on;
368 regulator-boot-on;
369 regulator-mem-off;
370 };
371
372 buck2_reg: buck2 {
373 regulator-compatible = "BUCK2";
374 regulator-name = "vdd_arm";
375 regulator-min-microvolt = <850000>;
376 regulator-max-microvolt = <1500000>;
377 regulator-always-on;
378 regulator-boot-on;
379 regulator-mem-off;
380 };
381
382 buck3_reg: buck3 {
383 regulator-compatible = "BUCK3";
384 regulator-name = "vdd_int";
385 regulator-min-microvolt = <850000>;
386 regulator-max-microvolt = <1150000>;
387 regulator-always-on;
388 regulator-boot-on;
389 regulator-mem-off;
390 };
391
392 buck4_reg: buck4 {
393 regulator-compatible = "BUCK4";
394 regulator-name = "vdd_g3d";
395 regulator-min-microvolt = <850000>;
396 regulator-max-microvolt = <1150000>;
397 regulator-boot-on;
398 regulator-mem-off;
399 };
400
401 buck5_reg: buck5 {
402 regulator-compatible = "BUCK5";
403 regulator-name = "VMEM_1.2V_AP";
404 regulator-min-microvolt = <1200000>;
405 regulator-max-microvolt = <1200000>;
406 regulator-always-on;
407 };
408
409 buck6_reg: buck6 {
410 regulator-compatible = "BUCK6";
411 regulator-name = "VCC_SUB_1.35V";
412 regulator-min-microvolt = <1350000>;
413 regulator-max-microvolt = <1350000>;
414 regulator-always-on;
415 };
416
417 buck7_reg: buck7 {
418 regulator-compatible = "BUCK7";
419 regulator-name = "VCC_SUB_2.0V";
420 regulator-min-microvolt = <2000000>;
421 regulator-max-microvolt = <2000000>;
422 regulator-always-on;
423 };
424
425 buck8_reg: buck8 {
426 regulator-compatible = "BUCK8";
427 regulator-name = "VMEM_VDDF_3.0V";
428 regulator-min-microvolt = <2850000>;
429 regulator-max-microvolt = <2850000>;
430 regulator-always-on;
431 regulator-mem-off;
432 };
433
434 buck9_reg: buck9 {
435 regulator-compatible = "BUCK9";
436 regulator-name = "CAM_ISP_CORE_1.2V";
437 regulator-min-microvolt = <1000000>;
438 regulator-max-microvolt = <1200000>;
439 regulator-mem-off;
440 };
441 };
442 };
443 };
444
445 sdhci@12510000 {
446 bus-width = <8>;
447 non-removable;
448 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus8>;
449 pinctrl-names = "default";
450 vmmc-supply = <&vemmc_reg>;
451 status = "okay";
452 };
453
454 serial@13800000 {
455 status = "okay";
456 };
457
458 serial@13810000 {
459 status = "okay";
460 };
461
462 serial@13820000 {
463 status = "okay";
464 };
465
466 serial@13830000 {
467 status = "okay";
468 };
469
470 i2c_ak8975: i2c-gpio-0 {
471 compatible = "i2c-gpio";
472 gpios = <&gpy2 4 0>, <&gpy2 5 0>;
473 i2c-gpio,delay-us = <2>;
474 #address-cells = <1>;
475 #size-cells = <0>;
476 status = "okay";
477
478 ak8975@0c {
479 compatible = "ak,ak8975";
480 reg = <0x0c>;
481 gpios = <&gpj0 7 0>;
482 };
483 };
484
485 spi_1: spi@13930000 {
486 pinctrl-names = "default";
487 pinctrl-0 = <&spi1_bus>;
488 status = "okay";
489
490 s5c73m3_spi: s5c73m3 {
491 compatible = "samsung,s5c73m3";
492 spi-max-frequency = <50000000>;
493 reg = <0>;
494 controller-data {
495 cs-gpio = <&gpb 5 0>;
496 samsung,spi-feedback-delay = <2>;
497 };
498 };
499 };
500
501 camera {
502 pinctrl-0 = <&cam_port_b_clk_active>;
503 pinctrl-names = "default";
504 status = "okay";
505
506 fimc_0: fimc@11800000 {
507 status = "okay";
508 };
509
510 fimc_1: fimc@11810000 {
511 status = "okay";
512 };
513
514 fimc_2: fimc@11820000 {
515 status = "okay";
516 };
517
518 fimc_3: fimc@11830000 {
519 status = "okay";
520 };
521
522 csis_1: csis@11890000 {
523 vddcore-supply = <&ldo8_reg>;
524 vddio-supply = <&ldo10_reg>;
525 clock-frequency = <160000000>;
526 status = "okay";
527
528 /* Camera D (4) MIPI CSI-2 (CSIS1) */
529 port@4 {
530 reg = <4>;
531 csis1_ep: endpoint {
532 remote-endpoint = <&is_s5k6a3_ep>;
533 data-lanes = <1>;
534 samsung,csis-hs-settle = <18>;
535 samsung,csis-wclk;
536 };
537 };
538 };
539
540 fimc_lite_0: fimc-lite@12390000 {
541 status = "okay";
542 };
543
544 fimc_lite_1: fimc-lite@123A0000 {
545 status = "okay";
546 };
547
548 fimc-is@12000000 {
549 pinctrl-0 = <&fimc_is_uart>;
550 pinctrl-names = "default";
551 status = "okay";
552
553 i2c1_isp: i2c-isp@12140000 {
554 pinctrl-0 = <&fimc_is_i2c1>;
555 pinctrl-names = "default";
556
557 s5k6a3@10 {
558 compatible = "samsung,s5k6a3";
559 reg = <0x10>;
560 svdda-supply = <&cam_io_reg>;
561 svddio-supply = <&ldo19_reg>;
562 clock-frequency = <24000000>;
563 /* CAM_B_CLKOUT */
564 clocks = <&clock_cam 1>;
565 clock-names = "mclk";
566 samsung,camclk-out = <1>;
567 gpios = <&gpm1 6 0>;
568
569 port {
570 is_s5k6a3_ep: endpoint {
571 remote-endpoint = <&csis1_ep>;
572 data-lanes = <1>;
573 };
574 };
575 };
576 };
577 };
578 };
579};
diff --git a/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi b/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
index 704290f7c5c0..99b26df8dbc7 100644
--- a/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
@@ -401,13 +401,26 @@
401 samsung,pin-drv = <0>; 401 samsung,pin-drv = <0>;
402 }; 402 };
403 403
404 cam_port_a: cam-port-a { 404 cam_port_a_io: cam-port-a-io {
405 samsung,pins = "gpj0-0", "gpj0-1", "gpj0-2", "gpj0-3", 405 samsung,pins = "gpj0-0", "gpj0-1", "gpj0-2", "gpj0-3",
406 "gpj0-4", "gpj0-5", "gpj0-6", "gpj0-7", 406 "gpj0-4", "gpj0-5", "gpj0-6", "gpj0-7",
407 "gpj1-0", "gpj1-1", "gpj1-2", "gpj1-3", 407 "gpj1-0", "gpj1-1", "gpj1-2", "gpj1-4";
408 "gpj1-4";
409 samsung,pin-function = <2>; 408 samsung,pin-function = <2>;
410 samsung,pin-pud = <3>; 409 samsung,pin-pud = <0>;
410 samsung,pin-drv = <0>;
411 };
412
413 cam_port_a_clk_active: cam-port-a-clk-active {
414 samsung,pins = "gpj1-3";
415 samsung,pin-function = <2>;
416 samsung,pin-pud = <0>;
417 samsung,pin-drv = <3>;
418 };
419
420 cam_port_a_clk_idle: cam-port-a-clk-idle {
421 samsung,pins = "gpj1-3";
422 samsung,pin-function = <0>;
423 samsung,pin-pud = <1>;
411 samsung,pin-drv = <0>; 424 samsung,pin-drv = <0>;
412 }; 425 };
413 }; 426 };
@@ -778,16 +791,29 @@
778 samsung,pin-drv = <3>; 791 samsung,pin-drv = <3>;
779 }; 792 };
780 793
781 cam_port_b: cam-port-b { 794 cam_port_b_io: cam-port-b-io {
782 samsung,pins = "gpm0-0", "gpm0-1", "gpm0-2", "gpm0-3", 795 samsung,pins = "gpm0-0", "gpm0-1", "gpm0-2", "gpm0-3",
783 "gpm0-4", "gpm0-5", "gpm0-6", "gpm0-7", 796 "gpm0-4", "gpm0-5", "gpm0-6", "gpm0-7",
784 "gpm1-0", "gpm1-1", "gpm2-0", "gpm2-1", 797 "gpm1-0", "gpm1-1", "gpm2-0", "gpm2-1";
785 "gpm2-2";
786 samsung,pin-function = <3>; 798 samsung,pin-function = <3>;
787 samsung,pin-pud = <3>; 799 samsung,pin-pud = <3>;
788 samsung,pin-drv = <0>; 800 samsung,pin-drv = <0>;
789 }; 801 };
790 802
803 cam_port_b_clk_active: cam-port-b-clk-active {
804 samsung,pins = "gpm2-2";
805 samsung,pin-function = <3>;
806 samsung,pin-pud = <0>;
807 samsung,pin-drv = <3>;
808 };
809
810 cam_port_b_clk_idle: cam-port-b-clk-idle {
811 samsung,pins = "gpm2-2";
812 samsung,pin-function = <0>;
813 samsung,pin-pud = <1>;
814 samsung,pin-drv = <0>;
815 };
816
791 eint0: ext-int0 { 817 eint0: ext-int0 {
792 samsung,pins = "gpx0-0"; 818 samsung,pins = "gpx0-0";
793 samsung,pin-function = <0xf>; 819 samsung,pin-function = <0xf>;
@@ -822,6 +848,27 @@
822 samsung,pin-pud = <0>; 848 samsung,pin-pud = <0>;
823 samsung,pin-drv = <0>; 849 samsung,pin-drv = <0>;
824 }; 850 };
851
852 fimc_is_i2c0: fimc-is-i2c0 {
853 samsung,pins = "gpm4-0", "gpm4-1";
854 samsung,pin-function = <2>;
855 samsung,pin-pud = <0>;
856 samsung,pin-drv = <0>;
857 };
858
859 fimc_is_i2c1: fimc-is-i2c1 {
860 samsung,pins = "gpm4-2", "gpm4-3";
861 samsung,pin-function = <2>;
862 samsung,pin-pud = <0>;
863 samsung,pin-drv = <0>;
864 };
865
866 fimc_is_uart: fimc-is-uart {
867 samsung,pins = "gpm3-5", "gpm3-7";
868 samsung,pin-function = <3>;
869 samsung,pin-pud = <0>;
870 samsung,pin-drv = <0>;
871 };
825 }; 872 };
826 873
827 pinctrl@03860000 { 874 pinctrl@03860000 {
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
index 01da194ba329..954628c7f167 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -26,6 +26,13 @@
26 pinctrl1 = &pinctrl_1; 26 pinctrl1 = &pinctrl_1;
27 pinctrl2 = &pinctrl_2; 27 pinctrl2 = &pinctrl_2;
28 pinctrl3 = &pinctrl_3; 28 pinctrl3 = &pinctrl_3;
29 fimc-lite0 = &fimc_lite_0;
30 fimc-lite1 = &fimc_lite_1;
31 };
32
33 pd_isp: isp-power-domain@10023CA0 {
34 compatible = "samsung,exynos4210-pd";
35 reg = <0x10023CA0 0x20>;
29 }; 36 };
30 37
31 clock: clock-controller@0x10030000 { 38 clock: clock-controller@0x10030000 {
@@ -73,4 +80,100 @@
73 clock-names = "sclk_fimg2d", "fimg2d"; 80 clock-names = "sclk_fimg2d", "fimg2d";
74 status = "disabled"; 81 status = "disabled";
75 }; 82 };
83
84 camera {
85 clocks = <&clock 132>, <&clock 133>, <&clock 351>, <&clock 352>;
86 clock-names = "sclk_cam0", "sclk_cam1", "pxl_async0", "pxl_async1";
87
88 fimc_0: fimc@11800000 {
89 compatible = "samsung,exynos4212-fimc";
90 samsung,pix-limits = <4224 8192 1920 4224>;
91 samsung,mainscaler-ext;
92 samsung,isp-wb;
93 samsung,cam-if;
94 };
95
96 fimc_1: fimc@11810000 {
97 compatible = "samsung,exynos4212-fimc";
98 samsung,pix-limits = <4224 8192 1920 4224>;
99 samsung,mainscaler-ext;
100 samsung,isp-wb;
101 samsung,cam-if;
102 };
103
104 fimc_2: fimc@11820000 {
105 compatible = "samsung,exynos4212-fimc";
106 samsung,pix-limits = <4224 8192 1920 4224>;
107 samsung,mainscaler-ext;
108 samsung,isp-wb;
109 samsung,lcd-wb;
110 samsung,cam-if;
111 };
112
113 fimc_3: fimc@11830000 {
114 compatible = "samsung,exynos4212-fimc";
115 samsung,pix-limits = <1920 8192 1366 1920>;
116 samsung,rotators = <0>;
117 samsung,mainscaler-ext;
118 samsung,isp-wb;
119 samsung,lcd-wb;
120 };
121
122 fimc_lite_0: fimc-lite@12390000 {
123 compatible = "samsung,exynos4212-fimc-lite";
124 reg = <0x12390000 0x1000>;
125 interrupts = <0 105 0>;
126 samsung,power-domain = <&pd_isp>;
127 clocks = <&clock 353>;
128 clock-names = "flite";
129 status = "disabled";
130 };
131
132 fimc_lite_1: fimc-lite@123A0000 {
133 compatible = "samsung,exynos4212-fimc-lite";
134 reg = <0x123A0000 0x1000>;
135 interrupts = <0 106 0>;
136 samsung,power-domain = <&pd_isp>;
137 clocks = <&clock 354>;
138 clock-names = "flite";
139 status = "disabled";
140 };
141
142 fimc_is: fimc-is@12000000 {
143 compatible = "samsung,exynos4212-fimc-is", "simple-bus";
144 reg = <0x12000000 0x260000>;
145 interrupts = <0 90 0>, <0 95 0>;
146 samsung,power-domain = <&pd_isp>;
147 clocks = <&clock 353>, <&clock 354>, <&clock 355>,
148 <&clock 356>, <&clock 17>, <&clock 357>,
149 <&clock 358>, <&clock 359>, <&clock 360>,
150 <&clock 450>,<&clock 451>, <&clock 452>,
151 <&clock 453>, <&clock 176>, <&clock 13>,
152 <&clock 454>, <&clock 395>, <&clock 455>;
153 clock-names = "lite0", "lite1", "ppmuispx",
154 "ppmuispmx", "mpll", "isp",
155 "drc", "fd", "mcuisp",
156 "ispdiv0", "ispdiv1", "mcuispdiv0",
157 "mcuispdiv1", "uart", "aclk200",
158 "div_aclk200", "aclk400mcuisp",
159 "div_aclk400mcuisp";
160 #address-cells = <1>;
161 #size-cells = <1>;
162 ranges;
163 status = "disabled";
164
165 pmu {
166 reg = <0x10020000 0x3000>;
167 };
168
169 i2c1_isp: i2c-isp@12140000 {
170 compatible = "samsung,exynos4212-i2c-isp";
171 reg = <0x12140000 0x100>;
172 clocks = <&clock 370>;
173 clock-names = "i2c_isp";
174 #address-cells = <1>;
175 #size-cells = <0>;
176 };
177 };
178 };
76}; 179};
diff --git a/arch/arm/boot/dts/exynos5.dtsi b/arch/arm/boot/dts/exynos5.dtsi
index f65e124c04a6..6afa57d2fecc 100644
--- a/arch/arm/boot/dts/exynos5.dtsi
+++ b/arch/arm/boot/dts/exynos5.dtsi
@@ -108,4 +108,23 @@
108 interrupts = <0 42 0>; 108 interrupts = <0 42 0>;
109 status = "disabled"; 109 status = "disabled";
110 }; 110 };
111
112 fimd@14400000 {
113 compatible = "samsung,exynos5250-fimd";
114 interrupt-parent = <&combiner>;
115 reg = <0x14400000 0x40000>;
116 interrupt-names = "fifo", "vsync", "lcd_sys";
117 interrupts = <18 4>, <18 5>, <18 6>;
118 status = "disabled";
119 };
120
121 dp-controller@145B0000 {
122 compatible = "samsung,exynos5-dp";
123 reg = <0x145B0000 0x1000>;
124 interrupts = <10 3>;
125 interrupt-parent = <&combiner>;
126 #address-cells = <1>;
127 #size-cells = <0>;
128 status = "disabled";
129 };
111}; 130};
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index abc7272c7afd..452d0b04d273 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -11,6 +11,7 @@
11 11
12/dts-v1/; 12/dts-v1/;
13#include "exynos5250.dtsi" 13#include "exynos5250.dtsi"
14#include <dt-bindings/interrupt-controller/irq.h>
14 15
15/ { 16/ {
16 model = "Insignal Arndale evaluation board based on EXYNOS5250"; 17 model = "Insignal Arndale evaluation board based on EXYNOS5250";
@@ -37,6 +38,28 @@
37 s5m8767_pmic@66 { 38 s5m8767_pmic@66 {
38 compatible = "samsung,s5m8767-pmic"; 39 compatible = "samsung,s5m8767-pmic";
39 reg = <0x66>; 40 reg = <0x66>;
41 interrupt-parent = <&gpx3>;
42 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
43
44 vinb1-supply = <&main_dc_reg>;
45 vinb2-supply = <&main_dc_reg>;
46 vinb3-supply = <&main_dc_reg>;
47 vinb4-supply = <&main_dc_reg>;
48 vinb5-supply = <&main_dc_reg>;
49 vinb6-supply = <&main_dc_reg>;
50 vinb7-supply = <&main_dc_reg>;
51 vinb8-supply = <&main_dc_reg>;
52 vinb9-supply = <&main_dc_reg>;
53
54 vinl1-supply = <&buck7_reg>;
55 vinl2-supply = <&buck7_reg>;
56 vinl3-supply = <&buck7_reg>;
57 vinl4-supply = <&main_dc_reg>;
58 vinl5-supply = <&main_dc_reg>;
59 vinl6-supply = <&main_dc_reg>;
60 vinl7-supply = <&main_dc_reg>;
61 vinl8-supply = <&buck8_reg>;
62 vinl9-supply = <&buck8_reg>;
40 63
41 s5m8767,pmic-buck2-dvs-voltage = <1300000>; 64 s5m8767,pmic-buck2-dvs-voltage = <1300000>;
42 s5m8767,pmic-buck3-dvs-voltage = <1100000>; 65 s5m8767,pmic-buck3-dvs-voltage = <1100000>;
@@ -276,6 +299,16 @@
276 op_mode = <1>; 299 op_mode = <1>;
277 }; 300 };
278 301
302 buck7_reg: BUCK7 {
303 regulator-name = "PVDD_BUCK7";
304 regulator-always-on;
305 };
306
307 buck8_reg: BUCK8 {
308 regulator-name = "PVDD_BUCK8";
309 regulator-always-on;
310 };
311
279 buck9_reg: BUCK9 { 312 buck9_reg: BUCK9 {
280 regulator-name = "VDD_33_OFF_EXT1"; 313 regulator-name = "VDD_33_OFF_EXT1";
281 regulator-min-microvolt = <750000>; 314 regulator-min-microvolt = <750000>;
@@ -295,7 +328,22 @@
295 }; 328 };
296 329
297 i2c@12C90000 { 330 i2c@12C90000 {
298 status = "disabled"; 331 wm1811a@1a {
332 compatible = "wlf,wm1811";
333 reg = <0x1a>;
334
335 AVDD2-supply = <&main_dc_reg>;
336 CPVDD-supply = <&main_dc_reg>;
337 DBVDD1-supply = <&main_dc_reg>;
338 DBVDD2-supply = <&main_dc_reg>;
339 DBVDD3-supply = <&main_dc_reg>;
340 LDO1VDD-supply = <&main_dc_reg>;
341 SPKVDD1-supply = <&main_dc_reg>;
342 SPKVDD2-supply = <&main_dc_reg>;
343
344 wlf,ldo1ena = <&gpb0 0 0>;
345 wlf,ldo2ena = <&gpb0 1 0>;
346 };
299 }; 347 };
300 348
301 i2c@12CA0000 { 349 i2c@12CA0000 {
@@ -429,18 +477,29 @@
429 vdd-supply = <&ldo8_reg>; 477 vdd-supply = <&ldo8_reg>;
430 }; 478 };
431 479
432 mmc_reg: voltage-regulator { 480 regulators {
433 compatible = "regulator-fixed"; 481 compatible = "simple-bus";
434 regulator-name = "VDD_33ON_2.8V"; 482 #address-cells = <1>;
435 regulator-min-microvolt = <2800000>; 483 #size-cells = <0>;
436 regulator-max-microvolt = <2800000>;
437 gpio = <&gpx1 1 1>;
438 enable-active-high;
439 };
440 484
441 reg_hdmi_en: fixedregulator@0 { 485 main_dc_reg: fixedregulator@1 {
442 compatible = "regulator-fixed"; 486 compatible = "regulator-fixed";
443 regulator-name = "hdmi-en"; 487 regulator-name = "MAIN_DC";
488 };
489
490 mmc_reg: voltage-regulator {
491 compatible = "regulator-fixed";
492 regulator-name = "VDD_33ON_2.8V";
493 regulator-min-microvolt = <2800000>;
494 regulator-max-microvolt = <2800000>;
495 gpio = <&gpx1 1 1>;
496 enable-active-high;
497 };
498
499 reg_hdmi_en: fixedregulator@0 {
500 compatible = "regulator-fixed";
501 regulator-name = "hdmi-en";
502 };
444 }; 503 };
445 504
446 fixed-rate-clocks { 505 fixed-rate-clocks {
@@ -450,16 +509,18 @@
450 }; 509 };
451 }; 510 };
452 511
453 dp-controller { 512 dp-controller@145B0000 {
454 samsung,color-space = <0>; 513 samsung,color-space = <0>;
455 samsung,dynamic-range = <0>; 514 samsung,dynamic-range = <0>;
456 samsung,ycbcr-coeff = <0>; 515 samsung,ycbcr-coeff = <0>;
457 samsung,color-depth = <1>; 516 samsung,color-depth = <1>;
458 samsung,link-rate = <0x0a>; 517 samsung,link-rate = <0x0a>;
459 samsung,lane-count = <4>; 518 samsung,lane-count = <4>;
519 status = "okay";
460 }; 520 };
461 521
462 fimd: fimd@14400000 { 522 fimd: fimd@14400000 {
523 status = "okay";
463 display-timings { 524 display-timings {
464 native-mode = <&timing0>; 525 native-mode = <&timing0>;
465 timing0: timing@0 { 526 timing0: timing@0 {
@@ -480,4 +541,22 @@
480 rtc { 541 rtc {
481 status = "okay"; 542 status = "okay";
482 }; 543 };
544
545 usb_hub_bus {
546 compatible = "simple-bus";
547 #address-cells = <1>;
548 #size-cells = <0>;
549
550 // SMSC USB3503 connected in hardware only mode as a PHY
551 usb_hub: usb_hub {
552 compatible = "smsc,usb3503a";
553
554 reset-gpios = <&gpx3 5 1>;
555 connect-gpios = <&gpd1 7 1>;
556 };
557 };
558
559 usb@12110000 {
560 usb-phy = <&usb2_phy>;
561 };
483}; 562};
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 49f18c24a576..2538b329f2ce 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -250,7 +250,7 @@
250 samsung,vbus-gpio = <&gpx2 6 0>; 250 samsung,vbus-gpio = <&gpx2 6 0>;
251 }; 251 };
252 252
253 dp-controller { 253 dp-controller@145B0000 {
254 samsung,color-space = <0>; 254 samsung,color-space = <0>;
255 samsung,dynamic-range = <0>; 255 samsung,dynamic-range = <0>;
256 samsung,ycbcr-coeff = <0>; 256 samsung,ycbcr-coeff = <0>;
@@ -260,21 +260,25 @@
260 260
261 pinctrl-names = "default"; 261 pinctrl-names = "default";
262 pinctrl-0 = <&dp_hpd>; 262 pinctrl-0 = <&dp_hpd>;
263 status = "okay";
263 }; 264 };
264 265
265 display-timings { 266 fimd@14400000 {
266 native-mode = <&timing0>; 267 status = "okay";
267 timing0: timing@0 { 268 display-timings {
268 /* 1280x800 */ 269 native-mode = <&timing0>;
269 clock-frequency = <50000>; 270 timing0: timing@0 {
270 hactive = <1280>; 271 /* 1280x800 */
271 vactive = <800>; 272 clock-frequency = <50000>;
272 hfront-porch = <4>; 273 hactive = <1280>;
273 hback-porch = <4>; 274 vactive = <800>;
274 hsync-len = <4>; 275 hfront-porch = <4>;
275 vback-porch = <4>; 276 hback-porch = <4>;
276 vfront-porch = <4>; 277 hsync-len = <4>;
277 vsync-len = <4>; 278 vback-porch = <4>;
279 vfront-porch = <4>;
280 vsync-len = <4>;
281 };
278 }; 282 };
279 }; 283 };
280 284
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index ef57277fc38f..63ef1246b9d5 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -163,11 +163,21 @@
163 clock-names = "watchdog"; 163 clock-names = "watchdog";
164 }; 164 };
165 165
166 g2d@10850000 {
167 compatible = "samsung,exynos5250-g2d";
168 reg = <0x10850000 0x1000>;
169 interrupts = <0 91 0>;
170 clocks = <&clock 345>;
171 clock-names = "fimg2d";
172 };
173
166 codec@11000000 { 174 codec@11000000 {
167 compatible = "samsung,mfc-v6"; 175 compatible = "samsung,mfc-v6";
168 reg = <0x11000000 0x10000>; 176 reg = <0x11000000 0x10000>;
169 interrupts = <0 96 0>; 177 interrupts = <0 96 0>;
170 samsung,power-domain = <&pd_mfc>; 178 samsung,power-domain = <&pd_mfc>;
179 clocks = <&clock 266>;
180 clock-names = "mfc";
171 }; 181 };
172 182
173 rtc { 183 rtc {
@@ -614,28 +624,20 @@
614 interrupts = <0 94 0>; 624 interrupts = <0 94 0>;
615 }; 625 };
616 626
617 dp-controller { 627 dp_phy: video-phy@10040720 {
618 compatible = "samsung,exynos5-dp"; 628 compatible = "samsung,exynos5250-dp-video-phy";
619 reg = <0x145b0000 0x1000>; 629 reg = <0x10040720 4>;
620 interrupts = <10 3>; 630 #phy-cells = <0>;
621 interrupt-parent = <&combiner>; 631 };
632
633 dp-controller@145B0000 {
622 clocks = <&clock 342>; 634 clocks = <&clock 342>;
623 clock-names = "dp"; 635 clock-names = "dp";
624 #address-cells = <1>; 636 phys = <&dp_phy>;
625 #size-cells = <0>; 637 phy-names = "dp";
626
627 dptx-phy {
628 reg = <0x10040720>;
629 samsung,enable-mask = <1>;
630 };
631 }; 638 };
632 639
633 fimd { 640 fimd@14400000 {
634 compatible = "samsung,exynos5250-fimd";
635 interrupt-parent = <&combiner>;
636 reg = <0x14400000 0x40000>;
637 interrupt-names = "fifo", "vsync", "lcd_sys";
638 interrupts = <18 4>, <18 5>, <18 6>;
639 clocks = <&clock 133>, <&clock 339>; 641 clocks = <&clock 133>, <&clock 339>;
640 clock-names = "sclk_fimd", "fimd"; 642 clock-names = "sclk_fimd", "fimd";
641 }; 643 };
diff --git a/arch/arm/boot/dts/exynos5420-pinctrl.dtsi b/arch/arm/boot/dts/exynos5420-pinctrl.dtsi
index 5848c425ae4d..e695aba5f73c 100644
--- a/arch/arm/boot/dts/exynos5420-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos5420-pinctrl.dtsi
@@ -59,6 +59,13 @@
59 interrupt-controller; 59 interrupt-controller;
60 #interrupt-cells = <2>; 60 #interrupt-cells = <2>;
61 }; 61 };
62
63 dp_hpd: dp_hpd {
64 samsung,pins = "gpx0-7";
65 samsung,pin-function = <3>;
66 samsung,pin-pud = <0>;
67 samaung,pin-drv = <0>;
68 };
62 }; 69 };
63 70
64 pinctrl@13410000 { 71 pinctrl@13410000 {
diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts
index 08607df6a180..bafba25ba7c2 100644
--- a/arch/arm/boot/dts/exynos5420-smdk5420.dts
+++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts
@@ -30,4 +30,35 @@
30 clock-frequency = <24000000>; 30 clock-frequency = <24000000>;
31 }; 31 };
32 }; 32 };
33
34 dp-controller@145B0000 {
35 pinctrl-names = "default";
36 pinctrl-0 = <&dp_hpd>;
37 samsung,color-space = <0>;
38 samsung,dynamic-range = <0>;
39 samsung,ycbcr-coeff = <0>;
40 samsung,color-depth = <1>;
41 samsung,link-rate = <0x0a>;
42 samsung,lane-count = <4>;
43 status = "okay";
44 };
45
46 fimd@14400000 {
47 status = "okay";
48 display-timings {
49 native-mode = <&timing0>;
50 timing0: timing@0 {
51 clock-frequency = <50000>;
52 hactive = <2560>;
53 vactive = <1600>;
54 hfront-porch = <48>;
55 hback-porch = <80>;
56 hsync-len = <32>;
57 vback-porch = <16>;
58 vfront-porch = <8>;
59 vsync-len = <6>;
60 };
61 };
62 };
63
33}; 64};
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index 8c54c4b74f0e..c950bad5f341 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -14,7 +14,10 @@
14 */ 14 */
15 15
16#include "exynos5.dtsi" 16#include "exynos5.dtsi"
17/include/ "exynos5420-pinctrl.dtsi" 17#include "exynos5420-pinctrl.dtsi"
18
19#include <dt-bindings/clk/exynos-audss-clk.h>
20
18/ { 21/ {
19 compatible = "samsung,exynos5420"; 22 compatible = "samsung,exynos5420";
20 23
@@ -65,6 +68,22 @@
65 #clock-cells = <1>; 68 #clock-cells = <1>;
66 }; 69 };
67 70
71 clock_audss: audss-clock-controller@3810000 {
72 compatible = "samsung,exynos5420-audss-clock";
73 reg = <0x03810000 0x0C>;
74 #clock-cells = <1>;
75 clocks = <&clock 148>;
76 clock-names = "sclk_audio";
77 };
78
79 codec@11000000 {
80 compatible = "samsung,mfc-v7";
81 reg = <0x11000000 0x10000>;
82 interrupts = <0 96 0>;
83 clocks = <&clock 401>;
84 clock-names = "mfc";
85 };
86
68 mct@101C0000 { 87 mct@101C0000 {
69 compatible = "samsung,exynos4210-mct"; 88 compatible = "samsung,exynos4210-mct";
70 reg = <0x101C0000 0x800>; 89 reg = <0x101C0000 0x800>;
@@ -90,6 +109,41 @@
90 }; 109 };
91 }; 110 };
92 111
112 gsc_pd: power-domain@10044000 {
113 compatible = "samsung,exynos4210-pd";
114 reg = <0x10044000 0x20>;
115 };
116
117 isp_pd: power-domain@10044020 {
118 compatible = "samsung,exynos4210-pd";
119 reg = <0x10044020 0x20>;
120 };
121
122 mfc_pd: power-domain@10044060 {
123 compatible = "samsung,exynos4210-pd";
124 reg = <0x10044060 0x20>;
125 };
126
127 disp_pd: power-domain@100440C0 {
128 compatible = "samsung,exynos4210-pd";
129 reg = <0x100440C0 0x20>;
130 };
131
132 mau_pd: power-domain@100440E0 {
133 compatible = "samsung,exynos4210-pd";
134 reg = <0x100440E0 0x20>;
135 };
136
137 g2d_pd: power-domain@10044100 {
138 compatible = "samsung,exynos4210-pd";
139 reg = <0x10044100 0x20>;
140 };
141
142 msc_pd: power-domain@10044120 {
143 compatible = "samsung,exynos4210-pd";
144 reg = <0x10044120 0x20>;
145 };
146
93 pinctrl_0: pinctrl@13400000 { 147 pinctrl_0: pinctrl@13400000 {
94 compatible = "samsung,exynos5420-pinctrl"; 148 compatible = "samsung,exynos5420-pinctrl";
95 reg = <0x13400000 0x1000>; 149 reg = <0x13400000 0x1000>;
@@ -145,4 +199,23 @@
145 clocks = <&clock 260>, <&clock 131>; 199 clocks = <&clock 260>, <&clock 131>;
146 clock-names = "uart", "clk_uart_baud0"; 200 clock-names = "uart", "clk_uart_baud0";
147 }; 201 };
202
203 dp_phy: video-phy@10040728 {
204 compatible = "samsung,exynos5250-dp-video-phy";
205 reg = <0x10040728 4>;
206 #phy-cells = <0>;
207 };
208
209 dp-controller@145B0000 {
210 clocks = <&clock 412>;
211 clock-names = "dp";
212 phys = <&dp_phy>;
213 phy-names = "dp";
214 };
215
216 fimd@14400000 {
217 samsung,power-domain = <&disp_pd>;
218 clocks = <&clock 147>, <&clock 421>;
219 clock-names = "sclk_fimd", "fimd";
220 };
148}; 221};
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi
index ff7f5d855845..606da5f39269 100644
--- a/arch/arm/boot/dts/exynos5440.dtsi
+++ b/arch/arm/boot/dts/exynos5440.dtsi
@@ -18,6 +18,9 @@
18 18
19 aliases { 19 aliases {
20 spi0 = &spi_0; 20 spi0 = &spi_0;
21 tmuctrl0 = &tmuctrl_0;
22 tmuctrl1 = &tmuctrl_1;
23 tmuctrl2 = &tmuctrl_2;
21 }; 24 };
22 25
23 clock: clock-controller@0x160000 { 26 clock: clock-controller@0x160000 {
@@ -207,6 +210,30 @@
207 clock-names = "rtc"; 210 clock-names = "rtc";
208 }; 211 };
209 212
213 tmuctrl_0: tmuctrl@160118 {
214 compatible = "samsung,exynos5440-tmu";
215 reg = <0x160118 0x230>, <0x160368 0x10>;
216 interrupts = <0 58 0>;
217 clocks = <&clock 21>;
218 clock-names = "tmu_apbif";
219 };
220
221 tmuctrl_1: tmuctrl@16011C {
222 compatible = "samsung,exynos5440-tmu";
223 reg = <0x16011C 0x230>, <0x160368 0x10>;
224 interrupts = <0 58 0>;
225 clocks = <&clock 21>;
226 clock-names = "tmu_apbif";
227 };
228
229 tmuctrl_2: tmuctrl@160120 {
230 compatible = "samsung,exynos5440-tmu";
231 reg = <0x160120 0x230>, <0x160368 0x10>;
232 interrupts = <0 58 0>;
233 clocks = <&clock 21>;
234 clock-names = "tmu_apbif";
235 };
236
210 sata@210000 { 237 sata@210000 {
211 compatible = "snps,exynos5440-ahci"; 238 compatible = "snps,exynos5440-ahci";
212 reg = <0x210000 0x10000>; 239 reg = <0x210000 0x10000>;
diff --git a/arch/arm/boot/dts/imx23-evk.dts b/arch/arm/boot/dts/imx23-evk.dts
index da0588a04131..185c7c01102a 100644
--- a/arch/arm/boot/dts/imx23-evk.dts
+++ b/arch/arm/boot/dts/imx23-evk.dts
@@ -90,6 +90,11 @@
90 }; 90 };
91 91
92 apbx@80040000 { 92 apbx@80040000 {
93 lradc@80050000 {
94 status = "okay";
95 fsl,lradc-touchscreen-wires = <4>;
96 };
97
93 pwm: pwm@80064000 { 98 pwm: pwm@80064000 {
94 pinctrl-names = "default"; 99 pinctrl-names = "default";
95 pinctrl-0 = <&pwm2_pins_a>; 100 pinctrl-0 = <&pwm2_pins_a>;
@@ -107,6 +112,16 @@
107 pinctrl-0 = <&duart_pins_a>; 112 pinctrl-0 = <&duart_pins_a>;
108 status = "okay"; 113 status = "okay";
109 }; 114 };
115
116 usbphy0: usbphy@8007c000 {
117 status = "okay";
118 };
119 };
120 };
121
122 ahb@80080000 {
123 usb0: usb@80080000 {
124 status = "okay";
110 }; 125 };
111 }; 126 };
112 127
diff --git a/arch/arm/boot/dts/imx23-olinuxino.dts b/arch/arm/boot/dts/imx23-olinuxino.dts
index d107c4af321f..fc766ae12e24 100644
--- a/arch/arm/boot/dts/imx23-olinuxino.dts
+++ b/arch/arm/boot/dts/imx23-olinuxino.dts
@@ -69,6 +69,10 @@
69 }; 69 };
70 70
71 apbx@80040000 { 71 apbx@80040000 {
72 lradc@80050000 {
73 status = "okay";
74 };
75
72 duart: serial@80070000 { 76 duart: serial@80070000 {
73 pinctrl-names = "default"; 77 pinctrl-names = "default";
74 pinctrl-0 = <&duart_pins_a>; 78 pinctrl-0 = <&duart_pins_a>;
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 587ceef81e45..28b5ce289662 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -20,6 +20,8 @@
20 gpio2 = &gpio2; 20 gpio2 = &gpio2;
21 serial0 = &auart0; 21 serial0 = &auart0;
22 serial1 = &auart1; 22 serial1 = &auart1;
23 spi0 = &ssp0;
24 spi1 = &ssp1;
23 }; 25 };
24 26
25 cpus { 27 cpus {
@@ -76,23 +78,21 @@
76 #size-cells = <1>; 78 #size-cells = <1>;
77 reg = <0x8000c000 0x2000>, <0x8000a000 0x2000>; 79 reg = <0x8000c000 0x2000>, <0x8000a000 0x2000>;
78 reg-names = "gpmi-nand", "bch"; 80 reg-names = "gpmi-nand", "bch";
79 interrupts = <13>, <56>; 81 interrupts = <56>;
80 interrupt-names = "gpmi-dma", "bch"; 82 interrupt-names = "bch";
81 clocks = <&clks 34>; 83 clocks = <&clks 34>;
82 clock-names = "gpmi_io"; 84 clock-names = "gpmi_io";
83 dmas = <&dma_apbh 4>; 85 dmas = <&dma_apbh 4>;
84 dma-names = "rx-tx"; 86 dma-names = "rx-tx";
85 fsl,gpmi-dma-channel = <4>;
86 status = "disabled"; 87 status = "disabled";
87 }; 88 };
88 89
89 ssp0: ssp@80010000 { 90 ssp0: ssp@80010000 {
90 reg = <0x80010000 0x2000>; 91 reg = <0x80010000 0x2000>;
91 interrupts = <15 14>; 92 interrupts = <15>;
92 clocks = <&clks 33>; 93 clocks = <&clks 33>;
93 dmas = <&dma_apbh 1>; 94 dmas = <&dma_apbh 1>;
94 dma-names = "rx-tx"; 95 dma-names = "rx-tx";
95 fsl,ssp-dma-channel = <1>;
96 status = "disabled"; 96 status = "disabled";
97 }; 97 };
98 98
@@ -366,11 +366,10 @@
366 366
367 ssp1: ssp@80034000 { 367 ssp1: ssp@80034000 {
368 reg = <0x80034000 0x2000>; 368 reg = <0x80034000 0x2000>;
369 interrupts = <2 20>; 369 interrupts = <2>;
370 clocks = <&clks 33>; 370 clocks = <&clks 33>;
371 dmas = <&dma_apbh 2>; 371 dmas = <&dma_apbh 2>;
372 dma-names = "rx-tx"; 372 dma-names = "rx-tx";
373 fsl,ssp-dma-channel = <2>;
374 status = "disabled"; 373 status = "disabled";
375 }; 374 };
376 375
@@ -472,7 +471,7 @@
472 auart0: serial@8006c000 { 471 auart0: serial@8006c000 {
473 compatible = "fsl,imx23-auart"; 472 compatible = "fsl,imx23-auart";
474 reg = <0x8006c000 0x2000>; 473 reg = <0x8006c000 0x2000>;
475 interrupts = <24 25 23>; 474 interrupts = <24>;
476 clocks = <&clks 32>; 475 clocks = <&clks 32>;
477 dmas = <&dma_apbx 6>, <&dma_apbx 7>; 476 dmas = <&dma_apbx 6>, <&dma_apbx 7>;
478 dma-names = "rx", "tx"; 477 dma-names = "rx", "tx";
@@ -482,7 +481,7 @@
482 auart1: serial@8006e000 { 481 auart1: serial@8006e000 {
483 compatible = "fsl,imx23-auart"; 482 compatible = "fsl,imx23-auart";
484 reg = <0x8006e000 0x2000>; 483 reg = <0x8006e000 0x2000>;
485 interrupts = <59 60 58>; 484 interrupts = <59>;
486 clocks = <&clks 32>; 485 clocks = <&clks 32>;
487 dmas = <&dma_apbx 8>, <&dma_apbx 9>; 486 dmas = <&dma_apbx 8>, <&dma_apbx 9>;
488 dma-names = "rx", "tx"; 487 dma-names = "rx", "tx";
diff --git a/arch/arm/boot/dts/imx28-cfa10036.dts b/arch/arm/boot/dts/imx28-cfa10036.dts
index 94c4476972c3..1ec8c94bbac9 100644
--- a/arch/arm/boot/dts/imx28-cfa10036.dts
+++ b/arch/arm/boot/dts/imx28-cfa10036.dts
@@ -23,10 +23,7 @@
23 apb@80000000 { 23 apb@80000000 {
24 apbh@80000000 { 24 apbh@80000000 {
25 pinctrl@80018000 { 25 pinctrl@80018000 {
26 pinctrl-names = "default"; 26 ssd1306_cfa10036: ssd1306-10036@0 {
27 pinctrl-0 = <&hog_pins_cfa10036>;
28
29 hog_pins_cfa10036: hog-10036@0 {
30 reg = <0>; 27 reg = <0>;
31 fsl,pinmux-ids = < 28 fsl,pinmux-ids = <
32 0x2073 /* MX28_PAD_SSP0_D7__GPIO_2_7 */ 29 0x2073 /* MX28_PAD_SSP0_D7__GPIO_2_7 */
@@ -83,6 +80,8 @@
83 80
84 ssd1306: oled@3c { 81 ssd1306: oled@3c {
85 compatible = "solomon,ssd1306fb-i2c"; 82 compatible = "solomon,ssd1306fb-i2c";
83 pinctrl-names = "default";
84 pinctrl-0 = <&ssd1306_cfa10036>;
86 reg = <0x3c>; 85 reg = <0x3c>;
87 reset-gpios = <&gpio2 7 0>; 86 reset-gpios = <&gpio2 7 0>;
88 solomon,height = <32>; 87 solomon,height = <32>;
diff --git a/arch/arm/boot/dts/imx28-cfa10037.dts b/arch/arm/boot/dts/imx28-cfa10037.dts
index c2ef3a3d655e..182b99fe35f3 100644
--- a/arch/arm/boot/dts/imx28-cfa10037.dts
+++ b/arch/arm/boot/dts/imx28-cfa10037.dts
@@ -22,13 +22,19 @@
22 apb@80000000 { 22 apb@80000000 {
23 apbh@80000000 { 23 apbh@80000000 {
24 pinctrl@80018000 { 24 pinctrl@80018000 {
25 pinctrl-names = "default", "default"; 25 usb_pins_cfa10037: usb-10037@0 {
26 pinctrl-1 = <&hog_pins_cfa10037>;
27
28 hog_pins_cfa10037: hog-10037@0 {
29 reg = <0>; 26 reg = <0>;
30 fsl,pinmux-ids = < 27 fsl,pinmux-ids = <
31 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */ 28 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */
29 >;
30 fsl,drive-strength = <0>;
31 fsl,voltage = <1>;
32 fsl,pull-up = <0>;
33 };
34
35 mac0_pins_cfa10037: mac0-10037@0 {
36 reg = <0>;
37 fsl,pinmux-ids = <
32 0x2153 /* MX28_PAD_SSP2_D5__GPIO_2_21 */ 38 0x2153 /* MX28_PAD_SSP2_D5__GPIO_2_21 */
33 >; 39 >;
34 fsl,drive-strength = <0>; 40 fsl,drive-strength = <0>;
@@ -56,7 +62,8 @@
56 mac0: ethernet@800f0000 { 62 mac0: ethernet@800f0000 {
57 phy-mode = "rmii"; 63 phy-mode = "rmii";
58 pinctrl-names = "default"; 64 pinctrl-names = "default";
59 pinctrl-0 = <&mac0_pins_a>; 65 pinctrl-0 = <&mac0_pins_a
66 &mac0_pins_cfa10037>;
60 phy-reset-gpios = <&gpio2 21 0>; 67 phy-reset-gpios = <&gpio2 21 0>;
61 phy-reset-duration = <100>; 68 phy-reset-duration = <100>;
62 status = "okay"; 69 status = "okay";
@@ -68,6 +75,8 @@
68 75
69 reg_usb1_vbus: usb1_vbus { 76 reg_usb1_vbus: usb1_vbus {
70 compatible = "regulator-fixed"; 77 compatible = "regulator-fixed";
78 pinctrl-names = "default";
79 pinctrl-0 = <&usb_pins_cfa10037>;
71 regulator-name = "usb1_vbus"; 80 regulator-name = "usb1_vbus";
72 regulator-min-microvolt = <5000000>; 81 regulator-min-microvolt = <5000000>;
73 regulator-max-microvolt = <5000000>; 82 regulator-max-microvolt = <5000000>;
diff --git a/arch/arm/boot/dts/imx28-cfa10049.dts b/arch/arm/boot/dts/imx28-cfa10049.dts
index 04b2f769ffbd..06e4cfaf7dd2 100644
--- a/arch/arm/boot/dts/imx28-cfa10049.dts
+++ b/arch/arm/boot/dts/imx28-cfa10049.dts
@@ -22,32 +22,62 @@
22 apb@80000000 { 22 apb@80000000 {
23 apbh@80000000 { 23 apbh@80000000 {
24 pinctrl@80018000 { 24 pinctrl@80018000 {
25 pinctrl-names = "default", "default"; 25 usb_pins_cfa10049: usb-10049@0 {
26 pinctrl-1 = <&hog_pins_cfa10049
27 &hog_pins_cfa10049_pullup>;
28
29 hog_pins_cfa10049: hog-10049@0 {
30 reg = <0>; 26 reg = <0>;
31 fsl,pinmux-ids = < 27 fsl,pinmux-ids = <
32 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */ 28 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */
29 >;
30 fsl,drive-strength = <0>;
31 fsl,voltage = <1>;
32 fsl,pull-up = <0>;
33 };
34
35 i2cmux_pins_cfa10049: i2cmux-10049@0 {
36 reg = <0>;
37 fsl,pinmux-ids = <
33 0x1163 /* MX28_PAD_LCD_D22__GPIO_1_22 */ 38 0x1163 /* MX28_PAD_LCD_D22__GPIO_1_22 */
34 0x1173 /* MX28_PAD_LCD_D22__GPIO_1_23 */ 39 0x1173 /* MX28_PAD_LCD_D22__GPIO_1_23 */
40 >;
41 fsl,drive-strength = <0>;
42 fsl,voltage = <1>;
43 fsl,pull-up = <0>;
44 };
45
46 mac0_pins_cfa10049: mac0-10049@0 {
47 reg = <0>;
48 fsl,pinmux-ids = <
35 0x2153 /* MX28_PAD_SSP2_D5__GPIO_2_21 */ 49 0x2153 /* MX28_PAD_SSP2_D5__GPIO_2_21 */
36 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
37 >; 50 >;
38 fsl,drive-strength = <0>; 51 fsl,drive-strength = <0>;
39 fsl,voltage = <1>; 52 fsl,voltage = <1>;
40 fsl,pull-up = <0>; 53 fsl,pull-up = <0>;
41 }; 54 };
42 55
43 hog_pins_cfa10049_pullup: hog-10049-pullup@0 { 56 pca_pins_cfa10049: pca-10049@0 {
44 reg = <0>; 57 reg = <0>;
45 fsl,pinmux-ids = < 58 fsl,pinmux-ids = <
46 0x2133 /* MX28_PAD_SSP2_D3__GPIO_2_19 */ 59 0x2133 /* MX28_PAD_SSP2_D3__GPIO_2_19 */
60 >;
61 fsl,drive-strength = <0>;
62 fsl,voltage = <1>;
63 fsl,pull-up = <1>;
64 };
65
66 rotary_pins_cfa10049: rotary-10049@0 {
67 reg = <0>;
68 fsl,pinmux-ids = <
47 0x3183 /* MX28_PAD_I2C0_SCL__GPIO_3_24 */ 69 0x3183 /* MX28_PAD_I2C0_SCL__GPIO_3_24 */
48 0x3193 /* MX28_PAD_I2C0_SDA__GPIO_3_25 */ 70 0x3193 /* MX28_PAD_I2C0_SDA__GPIO_3_25 */
71 >;
72 fsl,drive-strength = <0>;
73 fsl,voltage = <1>;
74 fsl,pull-up = <1>;
75 };
76
77 rotary_btn_pins_cfa10049: rotary-btn-10049@0 {
78 reg = <0>;
79 fsl,pinmux-ids = <
49 0x31a3 /* MX28_PAD_SAIF_SDATA0__GPIO_3_26 */ 80 0x31a3 /* MX28_PAD_SAIF_SDATA0__GPIO_3_26 */
50 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */
51 >; 81 >;
52 fsl,drive-strength = <0>; 82 fsl,drive-strength = <0>;
53 fsl,voltage = <1>; 83 fsl,voltage = <1>;
@@ -60,6 +90,7 @@
60 0x2103 /* MX28_PAD_SSP2_SCK__GPIO_2_16 */ 90 0x2103 /* MX28_PAD_SSP2_SCK__GPIO_2_16 */
61 0x2113 /* MX28_PAD_SSP2_CMD__GPIO_2_17 */ 91 0x2113 /* MX28_PAD_SSP2_CMD__GPIO_2_17 */
62 0x2123 /* MX28_PAD_SSP2_D0__GPIO_2_18 */ 92 0x2123 /* MX28_PAD_SSP2_D0__GPIO_2_18 */
93 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
63 >; 94 >;
64 fsl,drive-strength = <1>; 95 fsl,drive-strength = <1>;
65 fsl,voltage = <1>; 96 fsl,voltage = <1>;
@@ -120,6 +151,16 @@
120 fsl,pull-up = <0>; 151 fsl,pull-up = <0>;
121 }; 152 };
122 153
154 lcdif_pins_cfa10049_pullup: lcdif-10049-pullup@0 {
155 reg = <0>;
156 fsl,pinmux-ids = <
157 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */
158 >;
159 fsl,drive-strength = <0>;
160 fsl,voltage = <1>;
161 fsl,pull-up = <1>;
162 };
163
123 w1_gpio_pins: w1-gpio@0 { 164 w1_gpio_pins: w1-gpio@0 {
124 reg = <0>; 165 reg = <0>;
125 fsl,pinmux-ids = < 166 fsl,pinmux-ids = <
@@ -134,7 +175,8 @@
134 lcdif@80030000 { 175 lcdif@80030000 {
135 pinctrl-names = "default"; 176 pinctrl-names = "default";
136 pinctrl-0 = <&lcdif_18bit_pins_cfa10049 177 pinctrl-0 = <&lcdif_18bit_pins_cfa10049
137 &lcdif_pins_cfa10049>; 178 &lcdif_pins_cfa10049
179 &lcdif_pins_cfa10049_pullup>;
138 display = <&display>; 180 display = <&display>;
139 status = "okay"; 181 status = "okay";
140 182
@@ -181,6 +223,8 @@
181 compatible = "i2c-mux-gpio"; 223 compatible = "i2c-mux-gpio";
182 #address-cells = <1>; 224 #address-cells = <1>;
183 #size-cells = <0>; 225 #size-cells = <0>;
226 pinctrl-names = "default";
227 pinctrl-0 = <&i2cmux_pins_cfa10049>;
184 mux-gpios = <&gpio1 22 0 &gpio1 23 0>; 228 mux-gpios = <&gpio1 22 0 &gpio1 23 0>;
185 i2c-parent = <&i2c1>; 229 i2c-parent = <&i2c1>;
186 230
@@ -203,6 +247,8 @@
203 247
204 pca9555: pca9555@20 { 248 pca9555: pca9555@20 {
205 compatible = "nxp,pca9555"; 249 compatible = "nxp,pca9555";
250 pinctrl-names = "default";
251 pinctrl-0 = <&pca_pins_cfa10049>;
206 interrupt-parent = <&gpio2>; 252 interrupt-parent = <&gpio2>;
207 interrupts = <19 0x2>; 253 interrupts = <19 0x2>;
208 gpio-controller; 254 gpio-controller;
@@ -239,6 +285,8 @@
239 285
240 reg_usb1_vbus: usb1_vbus { 286 reg_usb1_vbus: usb1_vbus {
241 compatible = "regulator-fixed"; 287 compatible = "regulator-fixed";
288 pinctrl-names = "default";
289 pinctrl-0 = <&usb_pins_cfa10049>;
242 regulator-name = "usb1_vbus"; 290 regulator-name = "usb1_vbus";
243 regulator-min-microvolt = <5000000>; 291 regulator-min-microvolt = <5000000>;
244 regulator-max-microvolt = <5000000>; 292 regulator-max-microvolt = <5000000>;
@@ -250,7 +298,8 @@
250 mac0: ethernet@800f0000 { 298 mac0: ethernet@800f0000 {
251 phy-mode = "rmii"; 299 phy-mode = "rmii";
252 pinctrl-names = "default"; 300 pinctrl-names = "default";
253 pinctrl-0 = <&mac0_pins_a>; 301 pinctrl-0 = <&mac0_pins_a
302 &mac0_pins_cfa10049>;
254 phy-reset-gpios = <&gpio2 21 0>; 303 phy-reset-gpios = <&gpio2 21 0>;
255 phy-reset-duration = <100>; 304 phy-reset-duration = <100>;
256 status = "okay"; 305 status = "okay";
@@ -320,6 +369,8 @@
320 369
321 gpio_keys { 370 gpio_keys {
322 compatible = "gpio-keys"; 371 compatible = "gpio-keys";
372 pinctrl-names = "default";
373 pinctrl-0 = <&rotary_btn_pins_cfa10049>;
323 #address-cells = <1>; 374 #address-cells = <1>;
324 #size-cells = <0>; 375 #size-cells = <0>;
325 376
@@ -333,6 +384,8 @@
333 384
334 rotary { 385 rotary {
335 compatible = "rotary-encoder"; 386 compatible = "rotary-encoder";
387 pinctrl-names = "default";
388 pinctrl-0 = <&rotary_pins_cfa10049>;
336 gpios = <&gpio3 24 1>, <&gpio3 25 1>; 389 gpios = <&gpio3 24 1>, <&gpio3 25 1>;
337 linux,axis = <1>; /* REL_Y */ 390 linux,axis = <1>; /* REL_Y */
338 rotary-encoder,relative-axis; 391 rotary-encoder,relative-axis;
diff --git a/arch/arm/boot/dts/imx28-cfa10055.dts b/arch/arm/boot/dts/imx28-cfa10055.dts
index 158111244122..171bcbe1ec4b 100644
--- a/arch/arm/boot/dts/imx28-cfa10055.dts
+++ b/arch/arm/boot/dts/imx28-cfa10055.dts
@@ -23,36 +23,13 @@
23 apb@80000000 { 23 apb@80000000 {
24 apbh@80000000 { 24 apbh@80000000 {
25 pinctrl@80018000 { 25 pinctrl@80018000 {
26 pinctrl-names = "default", "default";
27 pinctrl-1 = <&hog_pins_cfa10055
28 &hog_pins_cfa10055_pullup>;
29
30 hog_pins_cfa10055: hog-10055@0 {
31 reg = <0>;
32 fsl,pinmux-ids = <
33 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
34 >;
35 fsl,drive-strength = <0>;
36 fsl,voltage = <1>;
37 fsl,pull-up = <0>;
38 };
39
40 hog_pins_cfa10055_pullup: hog-10055-pullup@0 {
41 reg = <0>;
42 fsl,pinmux-ids = <
43 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */
44 >;
45 fsl,drive-strength = <0>;
46 fsl,voltage = <1>;
47 fsl,pull-up = <1>;
48 };
49
50 spi2_pins_cfa10055: spi2-cfa10055@0 { 26 spi2_pins_cfa10055: spi2-cfa10055@0 {
51 reg = <0>; 27 reg = <0>;
52 fsl,pinmux-ids = < 28 fsl,pinmux-ids = <
53 0x2103 /* MX28_PAD_SSP2_SCK__GPIO_2_16 */ 29 0x2103 /* MX28_PAD_SSP2_SCK__GPIO_2_16 */
54 0x2113 /* MX28_PAD_SSP2_CMD__GPIO_2_17 */ 30 0x2113 /* MX28_PAD_SSP2_CMD__GPIO_2_17 */
55 0x2123 /* MX28_PAD_SSP2_D0__GPIO_2_18 */ 31 0x2123 /* MX28_PAD_SSP2_D0__GPIO_2_18 */
32 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
56 >; 33 >;
57 fsl,drive-strength = <1>; 34 fsl,drive-strength = <1>;
58 fsl,voltage = <1>; 35 fsl,voltage = <1>;
@@ -98,12 +75,23 @@
98 fsl,voltage = <1>; 75 fsl,voltage = <1>;
99 fsl,pull-up = <0>; 76 fsl,pull-up = <0>;
100 }; 77 };
78
79 lcdif_pins_cfa10055_pullup: lcdif-10055-pullup@0 {
80 reg = <0>;
81 fsl,pinmux-ids = <
82 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */
83 >;
84 fsl,drive-strength = <0>;
85 fsl,voltage = <1>;
86 fsl,pull-up = <1>;
87 };
101 }; 88 };
102 89
103 lcdif@80030000 { 90 lcdif@80030000 {
104 pinctrl-names = "default"; 91 pinctrl-names = "default";
105 pinctrl-0 = <&lcdif_18bit_pins_cfa10055 92 pinctrl-0 = <&lcdif_18bit_pins_cfa10055
106 &lcdif_pins_cfa10055>; 93 &lcdif_pins_cfa10055
94 &lcdif_pins_cfa10055_pullup>;
107 display = <&display>; 95 display = <&display>;
108 status = "okay"; 96 status = "okay";
109 97
diff --git a/arch/arm/boot/dts/imx28-cfa10056.dts b/arch/arm/boot/dts/imx28-cfa10056.dts
new file mode 100644
index 000000000000..b45dd0e4ee57
--- /dev/null
+++ b/arch/arm/boot/dts/imx28-cfa10056.dts
@@ -0,0 +1,119 @@
1/*
2 * Copyright 2013 Free Electrons
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/*
13 * The CFA-10055 is an expansion board for the CFA-10036 module and
14 * CFA-10037, thus we need to include the CFA-10037 DTS.
15 */
16/include/ "imx28-cfa10037.dts"
17
18/ {
19 model = "Crystalfontz CFA-10056 Board";
20 compatible = "crystalfontz,cfa10056", "crystalfontz,cfa10037", "crystalfontz,cfa10036", "fsl,imx28";
21
22 apb@80000000 {
23 apbh@80000000 {
24 pinctrl@80018000 {
25 spi2_pins_cfa10056: spi2-cfa10056@0 {
26 reg = <0>;
27 fsl,pinmux-ids = <
28 0x2103 /* MX28_PAD_SSP2_SCK__GPIO_2_16 */
29 0x2113 /* MX28_PAD_SSP2_CMD__GPIO_2_17 */
30 0x2123 /* MX28_PAD_SSP2_D0__GPIO_2_18 */
31 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
32 >;
33 fsl,drive-strength = <1>;
34 fsl,voltage = <1>;
35 fsl,pull-up = <1>;
36 };
37
38 lcdif_pins_cfa10056: lcdif-10056@0 {
39 reg = <0>;
40 fsl,pinmux-ids = <
41 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */
42 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */
43 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */
44 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */
45 >;
46 fsl,drive-strength = <0>;
47 fsl,voltage = <1>;
48 fsl,pull-up = <0>;
49 };
50
51 lcdif_pins_cfa10056_pullup: lcdif-10056-pullup@0 {
52 reg = <0>;
53 fsl,pinmux-ids = <
54 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */
55 >;
56 fsl,drive-strength = <0>;
57 fsl,voltage = <1>;
58 fsl,pull-up = <1>;
59 };
60 };
61
62 lcdif@80030000 {
63 pinctrl-names = "default";
64 pinctrl-0 = <&lcdif_24bit_pins_a
65 &lcdif_pins_cfa10056
66 &lcdif_pins_cfa10056_pullup >;
67 display = <&display>;
68 status = "okay";
69
70 display: display {
71 bits-per-pixel = <32>;
72 bus-width = <24>;
73
74 display-timings {
75 native-mode = <&timing0>;
76 timing0: timing0 {
77 clock-frequency = <32000000>;
78 hactive = <480>;
79 vactive = <800>;
80 hback-porch = <2>;
81 hfront-porch = <2>;
82 vback-porch = <2>;
83 vfront-porch = <2>;
84 hsync-len = <5>;
85 vsync-len = <5>;
86 hsync-active = <0>;
87 vsync-active = <0>;
88 de-active = <1>;
89 pixelclk-active = <1>;
90 };
91 };
92 };
93 };
94 };
95 };
96
97 spi2 {
98 compatible = "spi-gpio";
99 pinctrl-names = "default";
100 pinctrl-0 = <&spi2_pins_cfa10056>;
101 status = "okay";
102 gpio-sck = <&gpio2 16 0>;
103 gpio-mosi = <&gpio2 17 0>;
104 gpio-miso = <&gpio2 18 0>;
105 cs-gpios = <&gpio3 5 0>;
106 num-chipselects = <1>;
107 #address-cells = <1>;
108 #size-cells = <0>;
109
110 hx8369: hx8369@0 {
111 compatible = "himax,hx8369a", "himax,hx8369";
112 reg = <0>;
113 spi-max-frequency = <100000>;
114 spi-cpol;
115 spi-cpha;
116 gpios-reset = <&gpio3 30 0>;
117 };
118 };
119};
diff --git a/arch/arm/boot/dts/imx28-cfa10057.dts b/arch/arm/boot/dts/imx28-cfa10057.dts
index 2da713cdb42a..0333c0532f28 100644
--- a/arch/arm/boot/dts/imx28-cfa10057.dts
+++ b/arch/arm/boot/dts/imx28-cfa10057.dts
@@ -23,35 +23,16 @@
23 apb@80000000 { 23 apb@80000000 {
24 apbh@80000000 { 24 apbh@80000000 {
25 pinctrl@80018000 { 25 pinctrl@80018000 {
26 pinctrl-names = "default", "default"; 26 usb_pins_cfa10057: usb-10057@0 {
27 pinctrl-1 = <&hog_pins_cfa10057
28 &hog_pins_cfa10057_pullup>;
29
30 hog_pins_cfa10057: hog-10057@0 {
31 reg = <0>; 27 reg = <0>;
32 fsl,pinmux-ids = < 28 fsl,pinmux-ids = <
33 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */ 29 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */
34 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
35 >; 30 >;
36 fsl,drive-strength = <0>; 31 fsl,drive-strength = <0>;
37 fsl,voltage = <1>; 32 fsl,voltage = <1>;
38 fsl,pull-up = <0>; 33 fsl,pull-up = <0>;
39 }; 34 };
40 35
41 hog_pins_cfa10057_pullup: hog-10057-pullup@0 {
42 reg = <0>;
43 fsl,pinmux-ids = <
44 0x2133 /* MX28_PAD_SSP2_D3__GPIO_2_19 */
45 0x3183 /* MX28_PAD_I2C0_SCL__GPIO_3_24 */
46 0x3193 /* MX28_PAD_I2C0_SDA__GPIO_3_25 */
47 0x31a3 /* MX28_PAD_SAIF_SDATA0__GPIO_3_26 */
48 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */
49 >;
50 fsl,drive-strength = <0>;
51 fsl,voltage = <1>;
52 fsl,pull-up = <1>;
53 };
54
55 lcdif_18bit_pins_cfa10057: lcdif-18bit@0 { 36 lcdif_18bit_pins_cfa10057: lcdif-18bit@0 {
56 reg = <0>; 37 reg = <0>;
57 fsl,pinmux-ids = < 38 fsl,pinmux-ids = <
@@ -164,6 +145,8 @@
164 145
165 reg_usb1_vbus: usb1_vbus { 146 reg_usb1_vbus: usb1_vbus {
166 compatible = "regulator-fixed"; 147 compatible = "regulator-fixed";
148 pinctrl-names = "default";
149 pinctrl-0 = <&usb_pins_cfa10057>;
167 regulator-name = "usb1_vbus"; 150 regulator-name = "usb1_vbus";
168 regulator-min-microvolt = <5000000>; 151 regulator-min-microvolt = <5000000>;
169 regulator-max-microvolt = <5000000>; 152 regulator-max-microvolt = <5000000>;
diff --git a/arch/arm/boot/dts/imx28-cfa10058.dts b/arch/arm/boot/dts/imx28-cfa10058.dts
new file mode 100644
index 000000000000..64c64c55a82a
--- /dev/null
+++ b/arch/arm/boot/dts/imx28-cfa10058.dts
@@ -0,0 +1,141 @@
1/*
2 * Copyright 2013 Crystalfontz America, Inc.
3 * Copyright 2013 Free Electrons
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13/*
14 * The CFA-10058 is an expansion board for the CFA-10036 module, thus we
15 * need to include the CFA-10036 DTS.
16 */
17/include/ "imx28-cfa10036.dts"
18
19/ {
20 model = "Crystalfontz CFA-10058 Board";
21 compatible = "crystalfontz,cfa10058", "crystalfontz,cfa10036", "fsl,imx28";
22
23 apb@80000000 {
24 apbh@80000000 {
25 pinctrl@80018000 {
26 usb_pins_cfa10058: usb-10058@0 {
27 reg = <0>;
28 fsl,pinmux-ids = <
29 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */
30 >;
31 fsl,drive-strength = <0>;
32 fsl,voltage = <1>;
33 fsl,pull-up = <0>;
34 };
35
36 lcdif_pins_cfa10058: lcdif-10058@0 {
37 reg = <0>;
38 fsl,pinmux-ids = <
39 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */
40 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */
41 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */
42 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */
43 >;
44 fsl,drive-strength = <0>;
45 fsl,voltage = <1>;
46 fsl,pull-up = <0>;
47 };
48 };
49
50 lcdif@80030000 {
51 pinctrl-names = "default";
52 pinctrl-0 = <&lcdif_24bit_pins_a
53 &lcdif_pins_cfa10058>;
54 display = <&display>;
55 status = "okay";
56
57 display: display {
58 bits-per-pixel = <32>;
59 bus-width = <24>;
60
61 display-timings {
62 native-mode = <&timing0>;
63 timing0: timing0 {
64 clock-frequency = <30000000>;
65 hactive = <800>;
66 vactive = <480>;
67 hback-porch = <40>;
68 hfront-porch = <40>;
69 vback-porch = <13>;
70 vfront-porch = <29>;
71 hsync-len = <8>;
72 vsync-len = <8>;
73 hsync-active = <0>;
74 vsync-active = <0>;
75 de-active = <1>;
76 pixelclk-active = <1>;
77 };
78 };
79 };
80 };
81 };
82
83 apbx@80040000 {
84 lradc@80050000 {
85 fsl,lradc-touchscreen-wires = <4>;
86 status = "okay";
87 };
88
89 pwm: pwm@80064000 {
90 pinctrl-names = "default";
91 pinctrl-0 = <&pwm3_pins_b>;
92 status = "okay";
93 };
94
95 usbphy1: usbphy@8007e000 {
96 status = "okay";
97 };
98 };
99 };
100
101 ahb@80080000 {
102 usb1: usb@80090000 {
103 vbus-supply = <&reg_usb1_vbus>;
104 pinctrl-0 = <&usbphy1_pins_a>;
105 pinctrl-names = "default";
106 status = "okay";
107 };
108 };
109
110 regulators {
111 compatible = "simple-bus";
112
113 reg_usb1_vbus: usb1_vbus {
114 pinctrl-names = "default";
115 pinctrl-0 = <&usb_pins_cfa10058>;
116 compatible = "regulator-fixed";
117 regulator-name = "usb1_vbus";
118 regulator-min-microvolt = <5000000>;
119 regulator-max-microvolt = <5000000>;
120 gpio = <&gpio0 7 1>;
121 };
122 };
123
124 ahb@80080000 {
125 mac0: ethernet@800f0000 {
126 phy-mode = "rmii";
127 pinctrl-names = "default";
128 pinctrl-0 = <&mac0_pins_a>;
129 phy-reset-gpios = <&gpio2 21 0>;
130 phy-reset-duration = <100>;
131 status = "okay";
132 };
133 };
134
135 backlight {
136 compatible = "pwm-backlight";
137 pwms = <&pwm 3 5000000>;
138 brightness-levels = <0 4 8 16 32 64 128 255>;
139 default-brightness-level = <6>;
140 };
141};
diff --git a/arch/arm/boot/dts/imx28-m28evk.dts b/arch/arm/boot/dts/imx28-m28evk.dts
index 44d9da57736e..0d322a2bebaf 100644
--- a/arch/arm/boot/dts/imx28-m28evk.dts
+++ b/arch/arm/boot/dts/imx28-m28evk.dts
@@ -235,6 +235,12 @@
235 pinctrl-0 = <&auart2_2pins_b>; 235 pinctrl-0 = <&auart2_2pins_b>;
236 status = "okay"; 236 status = "okay";
237 }; 237 };
238
239 pwm: pwm@80064000 {
240 pinctrl-names = "default";
241 pinctrl-0 = <&pwm4_pins_a>;
242 status = "okay";
243 };
238 }; 244 };
239 }; 245 };
240 246
@@ -270,6 +276,13 @@
270 }; 276 };
271 }; 277 };
272 278
279 backlight {
280 compatible = "pwm-backlight";
281 pwms = <&pwm 4 5000000>;
282 brightness-levels = <0 4 8 16 32 64 128 255>;
283 default-brightness-level = <6>;
284 };
285
273 regulators { 286 regulators {
274 compatible = "simple-bus"; 287 compatible = "simple-bus";
275 288
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 9524a0571281..7363fded95ee 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -15,6 +15,8 @@
15 interrupt-parent = <&icoll>; 15 interrupt-parent = <&icoll>;
16 16
17 aliases { 17 aliases {
18 ethernet0 = &mac0;
19 ethernet1 = &mac1;
18 gpio0 = &gpio0; 20 gpio0 = &gpio0;
19 gpio1 = &gpio1; 21 gpio1 = &gpio1;
20 gpio2 = &gpio2; 22 gpio2 = &gpio2;
@@ -27,8 +29,8 @@
27 serial2 = &auart2; 29 serial2 = &auart2;
28 serial3 = &auart3; 30 serial3 = &auart3;
29 serial4 = &auart4; 31 serial4 = &auart4;
30 ethernet0 = &mac0; 32 spi0 = &ssp1;
31 ethernet1 = &mac1; 33 spi1 = &ssp2;
32 }; 34 };
33 35
34 cpus { 36 cpus {
@@ -62,9 +64,9 @@
62 reg = <0x80000000 0x2000>; 64 reg = <0x80000000 0x2000>;
63 }; 65 };
64 66
65 hsadc@80002000 { 67 hsadc: hsadc@80002000 {
66 reg = <0x80002000 0x2000>; 68 reg = <0x80002000 0x2000>;
67 interrupts = <13 87>; 69 interrupts = <13>;
68 dmas = <&dma_apbh 12>; 70 dmas = <&dma_apbh 12>;
69 dma-names = "rx"; 71 dma-names = "rx";
70 status = "disabled"; 72 status = "disabled";
@@ -86,25 +88,24 @@
86 clocks = <&clks 25>; 88 clocks = <&clks 25>;
87 }; 89 };
88 90
89 perfmon@80006000 { 91 perfmon: perfmon@80006000 {
90 reg = <0x80006000 0x800>; 92 reg = <0x80006000 0x800>;
91 interrupts = <27>; 93 interrupts = <27>;
92 status = "disabled"; 94 status = "disabled";
93 }; 95 };
94 96
95 gpmi-nand@8000c000 { 97 gpmi: gpmi-nand@8000c000 {
96 compatible = "fsl,imx28-gpmi-nand"; 98 compatible = "fsl,imx28-gpmi-nand";
97 #address-cells = <1>; 99 #address-cells = <1>;
98 #size-cells = <1>; 100 #size-cells = <1>;
99 reg = <0x8000c000 0x2000>, <0x8000a000 0x2000>; 101 reg = <0x8000c000 0x2000>, <0x8000a000 0x2000>;
100 reg-names = "gpmi-nand", "bch"; 102 reg-names = "gpmi-nand", "bch";
101 interrupts = <88>, <41>; 103 interrupts = <41>;
102 interrupt-names = "gpmi-dma", "bch"; 104 interrupt-names = "bch";
103 clocks = <&clks 50>; 105 clocks = <&clks 50>;
104 clock-names = "gpmi_io"; 106 clock-names = "gpmi_io";
105 dmas = <&dma_apbh 4>; 107 dmas = <&dma_apbh 4>;
106 dma-names = "rx-tx"; 108 dma-names = "rx-tx";
107 fsl,gpmi-dma-channel = <4>;
108 status = "disabled"; 109 status = "disabled";
109 }; 110 };
110 111
@@ -112,11 +113,10 @@
112 #address-cells = <1>; 113 #address-cells = <1>;
113 #size-cells = <0>; 114 #size-cells = <0>;
114 reg = <0x80010000 0x2000>; 115 reg = <0x80010000 0x2000>;
115 interrupts = <96 82>; 116 interrupts = <96>;
116 clocks = <&clks 46>; 117 clocks = <&clks 46>;
117 dmas = <&dma_apbh 0>; 118 dmas = <&dma_apbh 0>;
118 dma-names = "rx-tx"; 119 dma-names = "rx-tx";
119 fsl,ssp-dma-channel = <0>;
120 status = "disabled"; 120 status = "disabled";
121 }; 121 };
122 122
@@ -124,11 +124,10 @@
124 #address-cells = <1>; 124 #address-cells = <1>;
125 #size-cells = <0>; 125 #size-cells = <0>;
126 reg = <0x80012000 0x2000>; 126 reg = <0x80012000 0x2000>;
127 interrupts = <97 83>; 127 interrupts = <97>;
128 clocks = <&clks 47>; 128 clocks = <&clks 47>;
129 dmas = <&dma_apbh 1>; 129 dmas = <&dma_apbh 1>;
130 dma-names = "rx-tx"; 130 dma-names = "rx-tx";
131 fsl,ssp-dma-channel = <1>;
132 status = "disabled"; 131 status = "disabled";
133 }; 132 };
134 133
@@ -136,11 +135,10 @@
136 #address-cells = <1>; 135 #address-cells = <1>;
137 #size-cells = <0>; 136 #size-cells = <0>;
138 reg = <0x80014000 0x2000>; 137 reg = <0x80014000 0x2000>;
139 interrupts = <98 84>; 138 interrupts = <98>;
140 clocks = <&clks 48>; 139 clocks = <&clks 48>;
141 dmas = <&dma_apbh 2>; 140 dmas = <&dma_apbh 2>;
142 dma-names = "rx-tx"; 141 dma-names = "rx-tx";
143 fsl,ssp-dma-channel = <2>;
144 status = "disabled"; 142 status = "disabled";
145 }; 143 };
146 144
@@ -148,15 +146,14 @@
148 #address-cells = <1>; 146 #address-cells = <1>;
149 #size-cells = <0>; 147 #size-cells = <0>;
150 reg = <0x80016000 0x2000>; 148 reg = <0x80016000 0x2000>;
151 interrupts = <99 85>; 149 interrupts = <99>;
152 clocks = <&clks 49>; 150 clocks = <&clks 49>;
153 dmas = <&dma_apbh 3>; 151 dmas = <&dma_apbh 3>;
154 dma-names = "rx-tx"; 152 dma-names = "rx-tx";
155 fsl,ssp-dma-channel = <3>;
156 status = "disabled"; 153 status = "disabled";
157 }; 154 };
158 155
159 pinctrl@80018000 { 156 pinctrl: pinctrl@80018000 {
160 #address-cells = <1>; 157 #address-cells = <1>;
161 #size-cells = <0>; 158 #size-cells = <0>;
162 compatible = "fsl,imx28-pinctrl", "simple-bus"; 159 compatible = "fsl,imx28-pinctrl", "simple-bus";
@@ -521,6 +518,18 @@
521 fsl,pull-up = <1>; 518 fsl,pull-up = <1>;
522 }; 519 };
523 520
521 saif0_pins_b: saif0@1 {
522 reg = <1>;
523 fsl,pinmux-ids = <
524 0x3150 /* MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK */
525 0x3160 /* MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK */
526 0x3170 /* MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0 */
527 >;
528 fsl,drive-strength = <2>;
529 fsl,voltage = <1>;
530 fsl,pull-up = <1>;
531 };
532
524 saif1_pins_a: saif1@0 { 533 saif1_pins_a: saif1@0 {
525 reg = <0>; 534 reg = <0>;
526 fsl,pinmux-ids = < 535 fsl,pinmux-ids = <
@@ -639,6 +648,19 @@
639 fsl,pull-up = <0>; 648 fsl,pull-up = <0>;
640 }; 649 };
641 650
651 lcdif_sync_pins_a: lcdif-sync@0 {
652 reg = <0>;
653 fsl,pinmux-ids = <
654 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */
655 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */
656 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */
657 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */
658 >;
659 fsl,drive-strength = <0>;
660 fsl,voltage = <1>;
661 fsl,pull-up = <0>;
662 };
663
642 can0_pins_a: can0@0 { 664 can0_pins_a: can0@0 {
643 reg = <0>; 665 reg = <0>;
644 fsl,pinmux-ids = < 666 fsl,pinmux-ids = <
@@ -674,6 +696,21 @@
674 fsl,pull-up = <1>; 696 fsl,pull-up = <1>;
675 }; 697 };
676 698
699 spi3_pins_a: spi3@0 {
700 reg = <0>;
701 fsl,pinmux-ids = <
702 0x3082 /* MX28_PAD_AUART2_RX__SSP3_D4 */
703 0x3092 /* MX28_PAD_AUART2_TX__SSP3_D5 */
704 0x2180 /* MX28_PAD_SSP3_SCK__SSP3_SCK */
705 0x2190 /* MX28_PAD_SSP3_MOSI__SSP3_CMD */
706 0x21A0 /* MX28_PAD_SSP3_MISO__SSP3_D0 */
707 0x21B0 /* MX28_PAD_SSP3_SS0__SSP3_D3 */
708 >;
709 fsl,drive-strength = <1>;
710 fsl,voltage = <1>;
711 fsl,pull-up = <0>;
712 };
713
677 usbphy0_pins_a: usbphy0@0 { 714 usbphy0_pins_a: usbphy0@0 {
678 reg = <0>; 715 reg = <0>;
679 fsl,pinmux-ids = < 716 fsl,pinmux-ids = <
@@ -705,14 +742,14 @@
705 }; 742 };
706 }; 743 };
707 744
708 digctl@8001c000 { 745 digctl: digctl@8001c000 {
709 compatible = "fsl,imx28-digctl", "fsl,imx23-digctl"; 746 compatible = "fsl,imx28-digctl", "fsl,imx23-digctl";
710 reg = <0x8001c000 0x2000>; 747 reg = <0x8001c000 0x2000>;
711 interrupts = <89>; 748 interrupts = <89>;
712 status = "disabled"; 749 status = "disabled";
713 }; 750 };
714 751
715 etm@80022000 { 752 etm: etm@80022000 {
716 reg = <0x80022000 0x2000>; 753 reg = <0x80022000 0x2000>;
717 status = "disabled"; 754 status = "disabled";
718 }; 755 };
@@ -733,19 +770,19 @@
733 clocks = <&clks 26>; 770 clocks = <&clks 26>;
734 }; 771 };
735 772
736 dcp@80028000 { 773 dcp: dcp@80028000 {
737 reg = <0x80028000 0x2000>; 774 reg = <0x80028000 0x2000>;
738 interrupts = <52 53 54>; 775 interrupts = <52 53 54>;
739 compatible = "fsl-dcp"; 776 compatible = "fsl-dcp";
740 }; 777 };
741 778
742 pxp@8002a000 { 779 pxp: pxp@8002a000 {
743 reg = <0x8002a000 0x2000>; 780 reg = <0x8002a000 0x2000>;
744 interrupts = <39>; 781 interrupts = <39>;
745 status = "disabled"; 782 status = "disabled";
746 }; 783 };
747 784
748 ocotp@8002c000 { 785 ocotp: ocotp@8002c000 {
749 compatible = "fsl,ocotp"; 786 compatible = "fsl,ocotp";
750 reg = <0x8002c000 0x2000>; 787 reg = <0x8002c000 0x2000>;
751 status = "disabled"; 788 status = "disabled";
@@ -756,10 +793,10 @@
756 status = "disabled"; 793 status = "disabled";
757 }; 794 };
758 795
759 lcdif@80030000 { 796 lcdif: lcdif@80030000 {
760 compatible = "fsl,imx28-lcdif"; 797 compatible = "fsl,imx28-lcdif";
761 reg = <0x80030000 0x2000>; 798 reg = <0x80030000 0x2000>;
762 interrupts = <38 86>; 799 interrupts = <38>;
763 clocks = <&clks 55>; 800 clocks = <&clks 55>;
764 dmas = <&dma_apbh 13>; 801 dmas = <&dma_apbh 13>;
765 dma-names = "rx"; 802 dma-names = "rx";
@@ -784,41 +821,41 @@
784 status = "disabled"; 821 status = "disabled";
785 }; 822 };
786 823
787 simdbg@8003c000 { 824 simdbg: simdbg@8003c000 {
788 reg = <0x8003c000 0x200>; 825 reg = <0x8003c000 0x200>;
789 status = "disabled"; 826 status = "disabled";
790 }; 827 };
791 828
792 simgpmisel@8003c200 { 829 simgpmisel: simgpmisel@8003c200 {
793 reg = <0x8003c200 0x100>; 830 reg = <0x8003c200 0x100>;
794 status = "disabled"; 831 status = "disabled";
795 }; 832 };
796 833
797 simsspsel@8003c300 { 834 simsspsel: simsspsel@8003c300 {
798 reg = <0x8003c300 0x100>; 835 reg = <0x8003c300 0x100>;
799 status = "disabled"; 836 status = "disabled";
800 }; 837 };
801 838
802 simmemsel@8003c400 { 839 simmemsel: simmemsel@8003c400 {
803 reg = <0x8003c400 0x100>; 840 reg = <0x8003c400 0x100>;
804 status = "disabled"; 841 status = "disabled";
805 }; 842 };
806 843
807 gpiomon@8003c500 { 844 gpiomon: gpiomon@8003c500 {
808 reg = <0x8003c500 0x100>; 845 reg = <0x8003c500 0x100>;
809 status = "disabled"; 846 status = "disabled";
810 }; 847 };
811 848
812 simenet@8003c700 { 849 simenet: simenet@8003c700 {
813 reg = <0x8003c700 0x100>; 850 reg = <0x8003c700 0x100>;
814 status = "disabled"; 851 status = "disabled";
815 }; 852 };
816 853
817 armjtag@8003c800 { 854 armjtag: armjtag@8003c800 {
818 reg = <0x8003c800 0x100>; 855 reg = <0x8003c800 0x100>;
819 status = "disabled"; 856 status = "disabled";
820 }; 857 };
821 }; 858 };
822 859
823 apbx@80040000 { 860 apbx@80040000 {
824 compatible = "simple-bus"; 861 compatible = "simple-bus";
@@ -836,16 +873,15 @@
836 saif0: saif@80042000 { 873 saif0: saif@80042000 {
837 compatible = "fsl,imx28-saif"; 874 compatible = "fsl,imx28-saif";
838 reg = <0x80042000 0x2000>; 875 reg = <0x80042000 0x2000>;
839 interrupts = <59 80>; 876 interrupts = <59>;
840 #clock-cells = <0>; 877 #clock-cells = <0>;
841 clocks = <&clks 53>; 878 clocks = <&clks 53>;
842 dmas = <&dma_apbx 4>; 879 dmas = <&dma_apbx 4>;
843 dma-names = "rx-tx"; 880 dma-names = "rx-tx";
844 fsl,saif-dma-channel = <4>;
845 status = "disabled"; 881 status = "disabled";
846 }; 882 };
847 883
848 power@80044000 { 884 power: power@80044000 {
849 reg = <0x80044000 0x2000>; 885 reg = <0x80044000 0x2000>;
850 status = "disabled"; 886 status = "disabled";
851 }; 887 };
@@ -853,15 +889,14 @@
853 saif1: saif@80046000 { 889 saif1: saif@80046000 {
854 compatible = "fsl,imx28-saif"; 890 compatible = "fsl,imx28-saif";
855 reg = <0x80046000 0x2000>; 891 reg = <0x80046000 0x2000>;
856 interrupts = <58 81>; 892 interrupts = <58>;
857 clocks = <&clks 54>; 893 clocks = <&clks 54>;
858 dmas = <&dma_apbx 5>; 894 dmas = <&dma_apbx 5>;
859 dma-names = "rx-tx"; 895 dma-names = "rx-tx";
860 fsl,saif-dma-channel = <5>;
861 status = "disabled"; 896 status = "disabled";
862 }; 897 };
863 898
864 lradc@80050000 { 899 lradc: lradc@80050000 {
865 compatible = "fsl,imx28-lradc"; 900 compatible = "fsl,imx28-lradc";
866 reg = <0x80050000 0x2000>; 901 reg = <0x80050000 0x2000>;
867 interrupts = <10 14 15 16 17 18 19 902 interrupts = <10 14 15 16 17 18 19
@@ -869,15 +904,15 @@
869 status = "disabled"; 904 status = "disabled";
870 }; 905 };
871 906
872 spdif@80054000 { 907 spdif: spdif@80054000 {
873 reg = <0x80054000 0x2000>; 908 reg = <0x80054000 0x2000>;
874 interrupts = <45 66>; 909 interrupts = <45>;
875 dmas = <&dma_apbx 2>; 910 dmas = <&dma_apbx 2>;
876 dma-names = "tx"; 911 dma-names = "tx";
877 status = "disabled"; 912 status = "disabled";
878 }; 913 };
879 914
880 rtc@80056000 { 915 mxs_rtc: rtc@80056000 {
881 compatible = "fsl,imx28-rtc", "fsl,stmp3xxx-rtc"; 916 compatible = "fsl,imx28-rtc", "fsl,stmp3xxx-rtc";
882 reg = <0x80056000 0x2000>; 917 reg = <0x80056000 0x2000>;
883 interrupts = <29>; 918 interrupts = <29>;
@@ -888,11 +923,10 @@
888 #size-cells = <0>; 923 #size-cells = <0>;
889 compatible = "fsl,imx28-i2c"; 924 compatible = "fsl,imx28-i2c";
890 reg = <0x80058000 0x2000>; 925 reg = <0x80058000 0x2000>;
891 interrupts = <111 68>; 926 interrupts = <111>;
892 clock-frequency = <100000>; 927 clock-frequency = <100000>;
893 dmas = <&dma_apbx 6>; 928 dmas = <&dma_apbx 6>;
894 dma-names = "rx-tx"; 929 dma-names = "rx-tx";
895 fsl,i2c-dma-channel = <6>;
896 status = "disabled"; 930 status = "disabled";
897 }; 931 };
898 932
@@ -901,11 +935,10 @@
901 #size-cells = <0>; 935 #size-cells = <0>;
902 compatible = "fsl,imx28-i2c"; 936 compatible = "fsl,imx28-i2c";
903 reg = <0x8005a000 0x2000>; 937 reg = <0x8005a000 0x2000>;
904 interrupts = <110 69>; 938 interrupts = <110>;
905 clock-frequency = <100000>; 939 clock-frequency = <100000>;
906 dmas = <&dma_apbx 7>; 940 dmas = <&dma_apbx 7>;
907 dma-names = "rx-tx"; 941 dma-names = "rx-tx";
908 fsl,i2c-dma-channel = <7>;
909 status = "disabled"; 942 status = "disabled";
910 }; 943 };
911 944
@@ -918,7 +951,7 @@
918 status = "disabled"; 951 status = "disabled";
919 }; 952 };
920 953
921 timrot@80068000 { 954 timer: timrot@80068000 {
922 compatible = "fsl,imx28-timrot", "fsl,timrot"; 955 compatible = "fsl,imx28-timrot", "fsl,timrot";
923 reg = <0x80068000 0x2000>; 956 reg = <0x80068000 0x2000>;
924 interrupts = <48 49 50 51>; 957 interrupts = <48 49 50 51>;
@@ -928,10 +961,9 @@
928 auart0: serial@8006a000 { 961 auart0: serial@8006a000 {
929 compatible = "fsl,imx28-auart", "fsl,imx23-auart"; 962 compatible = "fsl,imx28-auart", "fsl,imx23-auart";
930 reg = <0x8006a000 0x2000>; 963 reg = <0x8006a000 0x2000>;
931 interrupts = <112 70 71>; 964 interrupts = <112>;
932 dmas = <&dma_apbx 8>, <&dma_apbx 9>; 965 dmas = <&dma_apbx 8>, <&dma_apbx 9>;
933 dma-names = "rx", "tx"; 966 dma-names = "rx", "tx";
934 fsl,auart-dma-channel = <8 9>;
935 clocks = <&clks 45>; 967 clocks = <&clks 45>;
936 status = "disabled"; 968 status = "disabled";
937 }; 969 };
@@ -939,7 +971,7 @@
939 auart1: serial@8006c000 { 971 auart1: serial@8006c000 {
940 compatible = "fsl,imx28-auart", "fsl,imx23-auart"; 972 compatible = "fsl,imx28-auart", "fsl,imx23-auart";
941 reg = <0x8006c000 0x2000>; 973 reg = <0x8006c000 0x2000>;
942 interrupts = <113 72 73>; 974 interrupts = <113>;
943 dmas = <&dma_apbx 10>, <&dma_apbx 11>; 975 dmas = <&dma_apbx 10>, <&dma_apbx 11>;
944 dma-names = "rx", "tx"; 976 dma-names = "rx", "tx";
945 clocks = <&clks 45>; 977 clocks = <&clks 45>;
@@ -949,7 +981,7 @@
949 auart2: serial@8006e000 { 981 auart2: serial@8006e000 {
950 compatible = "fsl,imx28-auart", "fsl,imx23-auart"; 982 compatible = "fsl,imx28-auart", "fsl,imx23-auart";
951 reg = <0x8006e000 0x2000>; 983 reg = <0x8006e000 0x2000>;
952 interrupts = <114 74 75>; 984 interrupts = <114>;
953 dmas = <&dma_apbx 12>, <&dma_apbx 13>; 985 dmas = <&dma_apbx 12>, <&dma_apbx 13>;
954 dma-names = "rx", "tx"; 986 dma-names = "rx", "tx";
955 clocks = <&clks 45>; 987 clocks = <&clks 45>;
@@ -959,7 +991,7 @@
959 auart3: serial@80070000 { 991 auart3: serial@80070000 {
960 compatible = "fsl,imx28-auart", "fsl,imx23-auart"; 992 compatible = "fsl,imx28-auart", "fsl,imx23-auart";
961 reg = <0x80070000 0x2000>; 993 reg = <0x80070000 0x2000>;
962 interrupts = <115 76 77>; 994 interrupts = <115>;
963 dmas = <&dma_apbx 14>, <&dma_apbx 15>; 995 dmas = <&dma_apbx 14>, <&dma_apbx 15>;
964 dma-names = "rx", "tx"; 996 dma-names = "rx", "tx";
965 clocks = <&clks 45>; 997 clocks = <&clks 45>;
@@ -969,7 +1001,7 @@
969 auart4: serial@80072000 { 1001 auart4: serial@80072000 {
970 compatible = "fsl,imx28-auart", "fsl,imx23-auart"; 1002 compatible = "fsl,imx28-auart", "fsl,imx23-auart";
971 reg = <0x80072000 0x2000>; 1003 reg = <0x80072000 0x2000>;
972 interrupts = <116 78 79>; 1004 interrupts = <116>;
973 dmas = <&dma_apbx 0>, <&dma_apbx 1>; 1005 dmas = <&dma_apbx 0>, <&dma_apbx 1>;
974 dma-names = "rx", "tx"; 1006 dma-names = "rx", "tx";
975 clocks = <&clks 45>; 1007 clocks = <&clks 45>;
@@ -1026,7 +1058,7 @@
1026 status = "disabled"; 1058 status = "disabled";
1027 }; 1059 };
1028 1060
1029 dflpt@800c0000 { 1061 dflpt: dflpt@800c0000 {
1030 reg = <0x800c0000 0x10000>; 1062 reg = <0x800c0000 0x10000>;
1031 status = "disabled"; 1063 status = "disabled";
1032 }; 1064 };
@@ -1049,10 +1081,9 @@
1049 status = "disabled"; 1081 status = "disabled";
1050 }; 1082 };
1051 1083
1052 switch@800f8000 { 1084 etn_switch: switch@800f8000 {
1053 reg = <0x800f8000 0x8000>; 1085 reg = <0x800f8000 0x8000>;
1054 status = "disabled"; 1086 status = "disabled";
1055 }; 1087 };
1056
1057 }; 1088 };
1058}; 1089};
diff --git a/arch/arm/boot/dts/msm8960-cdp.dts b/arch/arm/boot/dts/msm8960-cdp.dts
index db2060c46540..9c1167b0459b 100644
--- a/arch/arm/boot/dts/msm8960-cdp.dts
+++ b/arch/arm/boot/dts/msm8960-cdp.dts
@@ -26,7 +26,7 @@
26 cpu-offset = <0x80000>; 26 cpu-offset = <0x80000>;
27 }; 27 };
28 28
29 msmgpio: gpio@fd510000 { 29 msmgpio: gpio@800000 {
30 compatible = "qcom,msm-gpio"; 30 compatible = "qcom,msm-gpio";
31 gpio-controller; 31 gpio-controller;
32 #gpio-cells = <2>; 32 #gpio-cells = <2>;
@@ -34,7 +34,7 @@
34 interrupts = <0 32 0x4>; 34 interrupts = <0 32 0x4>;
35 interrupt-controller; 35 interrupt-controller;
36 #interrupt-cells = <2>; 36 #interrupt-cells = <2>;
37 reg = <0xfd510000 0x4000>; 37 reg = <0x800000 0x4000>;
38 }; 38 };
39 39
40 serial@16440000 { 40 serial@16440000 {
diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts
index 08b72678abff..65d7b601651c 100644
--- a/arch/arm/boot/dts/omap5-uevm.dts
+++ b/arch/arm/boot/dts/omap5-uevm.dts
@@ -235,7 +235,7 @@
235}; 235};
236 236
237&mmc1 { 237&mmc1 {
238 vmmc-supply = <&vmmcsd_fixed>; 238 vmmc-supply = <&ldo9_reg>;
239 bus-width = <4>; 239 bus-width = <4>;
240}; 240};
241 241
@@ -282,6 +282,7 @@
282 282
283 regulators { 283 regulators {
284 smps123_reg: smps123 { 284 smps123_reg: smps123 {
285 /* VDD_OPP_MPU */
285 regulator-name = "smps123"; 286 regulator-name = "smps123";
286 regulator-min-microvolt = < 600000>; 287 regulator-min-microvolt = < 600000>;
287 regulator-max-microvolt = <1500000>; 288 regulator-max-microvolt = <1500000>;
@@ -290,6 +291,7 @@
290 }; 291 };
291 292
292 smps45_reg: smps45 { 293 smps45_reg: smps45 {
294 /* VDD_OPP_MM */
293 regulator-name = "smps45"; 295 regulator-name = "smps45";
294 regulator-min-microvolt = < 600000>; 296 regulator-min-microvolt = < 600000>;
295 regulator-max-microvolt = <1310000>; 297 regulator-max-microvolt = <1310000>;
@@ -298,6 +300,7 @@
298 }; 300 };
299 301
300 smps6_reg: smps6 { 302 smps6_reg: smps6 {
303 /* VDD_DDR3 - over VDD_SMPS6 */
301 regulator-name = "smps6"; 304 regulator-name = "smps6";
302 regulator-min-microvolt = <1200000>; 305 regulator-min-microvolt = <1200000>;
303 regulator-max-microvolt = <1200000>; 306 regulator-max-microvolt = <1200000>;
@@ -306,6 +309,7 @@
306 }; 309 };
307 310
308 smps7_reg: smps7 { 311 smps7_reg: smps7 {
312 /* VDDS_1v8_OMAP over VDDS_1v8_MAIN */
309 regulator-name = "smps7"; 313 regulator-name = "smps7";
310 regulator-min-microvolt = <1800000>; 314 regulator-min-microvolt = <1800000>;
311 regulator-max-microvolt = <1800000>; 315 regulator-max-microvolt = <1800000>;
@@ -314,6 +318,7 @@
314 }; 318 };
315 319
316 smps8_reg: smps8 { 320 smps8_reg: smps8 {
321 /* VDD_OPP_CORE */
317 regulator-name = "smps8"; 322 regulator-name = "smps8";
318 regulator-min-microvolt = < 600000>; 323 regulator-min-microvolt = < 600000>;
319 regulator-max-microvolt = <1310000>; 324 regulator-max-microvolt = <1310000>;
@@ -322,15 +327,15 @@
322 }; 327 };
323 328
324 smps9_reg: smps9 { 329 smps9_reg: smps9 {
330 /* VDDA_2v1_AUD over VDD_2v1 */
325 regulator-name = "smps9"; 331 regulator-name = "smps9";
326 regulator-min-microvolt = <2100000>; 332 regulator-min-microvolt = <2100000>;
327 regulator-max-microvolt = <2100000>; 333 regulator-max-microvolt = <2100000>;
328 regulator-always-on;
329 regulator-boot-on;
330 ti,smps-range = <0x80>; 334 ti,smps-range = <0x80>;
331 }; 335 };
332 336
333 smps10_reg: smps10 { 337 smps10_reg: smps10 {
338 /* VBUS_5V_OTG */
334 regulator-name = "smps10"; 339 regulator-name = "smps10";
335 regulator-min-microvolt = <5000000>; 340 regulator-min-microvolt = <5000000>;
336 regulator-max-microvolt = <5000000>; 341 regulator-max-microvolt = <5000000>;
@@ -339,38 +344,40 @@
339 }; 344 };
340 345
341 ldo1_reg: ldo1 { 346 ldo1_reg: ldo1 {
347 /* VDDAPHY_CAM: vdda_csiport */
342 regulator-name = "ldo1"; 348 regulator-name = "ldo1";
343 regulator-min-microvolt = <2800000>; 349 regulator-min-microvolt = <1500000>;
344 regulator-max-microvolt = <2800000>; 350 regulator-max-microvolt = <1800000>;
345 regulator-always-on;
346 regulator-boot-on;
347 }; 351 };
348 352
349 ldo2_reg: ldo2 { 353 ldo2_reg: ldo2 {
354 /* VCC_2V8_DISP: Does not go anywhere */
350 regulator-name = "ldo2"; 355 regulator-name = "ldo2";
351 regulator-min-microvolt = <2900000>; 356 regulator-min-microvolt = <2800000>;
352 regulator-max-microvolt = <2900000>; 357 regulator-max-microvolt = <2800000>;
353 regulator-always-on; 358 /* Unused */
354 regulator-boot-on; 359 status = "disabled";
355 }; 360 };
356 361
357 ldo3_reg: ldo3 { 362 ldo3_reg: ldo3 {
363 /* VDDAPHY_MDM: vdda_lli */
358 regulator-name = "ldo3"; 364 regulator-name = "ldo3";
359 regulator-min-microvolt = <3000000>; 365 regulator-min-microvolt = <1500000>;
360 regulator-max-microvolt = <3000000>; 366 regulator-max-microvolt = <1500000>;
361 regulator-always-on;
362 regulator-boot-on; 367 regulator-boot-on;
368 /* Only if Modem is used */
369 status = "disabled";
363 }; 370 };
364 371
365 ldo4_reg: ldo4 { 372 ldo4_reg: ldo4 {
373 /* VDDAPHY_DISP: vdda_dsiport/hdmi */
366 regulator-name = "ldo4"; 374 regulator-name = "ldo4";
367 regulator-min-microvolt = <2200000>; 375 regulator-min-microvolt = <1500000>;
368 regulator-max-microvolt = <2200000>; 376 regulator-max-microvolt = <1800000>;
369 regulator-always-on;
370 regulator-boot-on;
371 }; 377 };
372 378
373 ldo5_reg: ldo5 { 379 ldo5_reg: ldo5 {
380 /* VDDA_1V8_PHY: usb/sata/hdmi.. */
374 regulator-name = "ldo5"; 381 regulator-name = "ldo5";
375 regulator-min-microvolt = <1800000>; 382 regulator-min-microvolt = <1800000>;
376 regulator-max-microvolt = <1800000>; 383 regulator-max-microvolt = <1800000>;
@@ -379,38 +386,43 @@
379 }; 386 };
380 387
381 ldo6_reg: ldo6 { 388 ldo6_reg: ldo6 {
389 /* VDDS_1V2_WKUP: hsic/ldo_emu_wkup */
382 regulator-name = "ldo6"; 390 regulator-name = "ldo6";
383 regulator-min-microvolt = <1500000>; 391 regulator-min-microvolt = <1200000>;
384 regulator-max-microvolt = <1500000>; 392 regulator-max-microvolt = <1200000>;
385 regulator-always-on; 393 regulator-always-on;
386 regulator-boot-on; 394 regulator-boot-on;
387 }; 395 };
388 396
389 ldo7_reg: ldo7 { 397 ldo7_reg: ldo7 {
398 /* VDD_VPP: vpp1 */
390 regulator-name = "ldo7"; 399 regulator-name = "ldo7";
391 regulator-min-microvolt = <1500000>; 400 regulator-min-microvolt = <2000000>;
392 regulator-max-microvolt = <1500000>; 401 regulator-max-microvolt = <2000000>;
393 regulator-always-on; 402 /* Only for efuse reprograming! */
394 regulator-boot-on; 403 status = "disabled";
395 }; 404 };
396 405
397 ldo8_reg: ldo8 { 406 ldo8_reg: ldo8 {
407 /* VDD_3v0: Does not go anywhere */
398 regulator-name = "ldo8"; 408 regulator-name = "ldo8";
399 regulator-min-microvolt = <1500000>; 409 regulator-min-microvolt = <3000000>;
400 regulator-max-microvolt = <1500000>; 410 regulator-max-microvolt = <3000000>;
401 regulator-always-on;
402 regulator-boot-on; 411 regulator-boot-on;
412 /* Unused */
413 status = "disabled";
403 }; 414 };
404 415
405 ldo9_reg: ldo9 { 416 ldo9_reg: ldo9 {
417 /* VCC_DV_SDIO: vdds_sdcard */
406 regulator-name = "ldo9"; 418 regulator-name = "ldo9";
407 regulator-min-microvolt = <1800000>; 419 regulator-min-microvolt = <1800000>;
408 regulator-max-microvolt = <3300000>; 420 regulator-max-microvolt = <3000000>;
409 regulator-always-on;
410 regulator-boot-on; 421 regulator-boot-on;
411 }; 422 };
412 423
413 ldoln_reg: ldoln { 424 ldoln_reg: ldoln {
425 /* VDDA_1v8_REF: vdds_osc/mm_l4per.. */
414 regulator-name = "ldoln"; 426 regulator-name = "ldoln";
415 regulator-min-microvolt = <1800000>; 427 regulator-min-microvolt = <1800000>;
416 regulator-max-microvolt = <1800000>; 428 regulator-max-microvolt = <1800000>;
@@ -419,12 +431,20 @@
419 }; 431 };
420 432
421 ldousb_reg: ldousb { 433 ldousb_reg: ldousb {
434 /* VDDA_3V_USB: VDDA_USBHS33 */
422 regulator-name = "ldousb"; 435 regulator-name = "ldousb";
423 regulator-min-microvolt = <3250000>; 436 regulator-min-microvolt = <3250000>;
424 regulator-max-microvolt = <3250000>; 437 regulator-max-microvolt = <3250000>;
425 regulator-always-on; 438 regulator-always-on;
426 regulator-boot-on; 439 regulator-boot-on;
427 }; 440 };
441
442 regen3_reg: regen3 {
443 /* REGEN3 controls LDO9 supply to card */
444 regulator-name = "regen3";
445 regulator-always-on;
446 regulator-boot-on;
447 };
428 }; 448 };
429 }; 449 };
430 }; 450 };
diff --git a/arch/arm/boot/dts/pxa3xx.dtsi b/arch/arm/boot/dts/pxa3xx.dtsi
index f9d92da86783..83bb0eff697b 100644
--- a/arch/arm/boot/dts/pxa3xx.dtsi
+++ b/arch/arm/boot/dts/pxa3xx.dtsi
@@ -28,5 +28,16 @@
28 marvell,intc-priority; 28 marvell,intc-priority;
29 marvell,intc-nr-irqs = <56>; 29 marvell,intc-nr-irqs = <56>;
30 }; 30 };
31
32 gpio: gpio@40e00000 {
33 compatible = "intel,pxa3xx-gpio";
34 reg = <0x40e00000 0x10000>;
35 interrupt-names = "gpio0", "gpio1", "gpio_mux";
36 interrupts = <8 9 10>;
37 gpio-controller;
38 #gpio-cells = <0x2>;
39 interrupt-controller;
40 #interrupt-cells = <0x2>;
41 };
31 }; 42 };
32}; 43};
diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm.dts b/arch/arm/boot/dts/r8a73a4-ape6evm.dts
index f603c6946c29..e657a9db1666 100644
--- a/arch/arm/boot/dts/r8a73a4-ape6evm.dts
+++ b/arch/arm/boot/dts/r8a73a4-ape6evm.dts
@@ -50,3 +50,25 @@
50 }; 50 };
51 }; 51 };
52}; 52};
53
54&i2c5 {
55 vdd_dvfs: max8973@1b {
56 compatible = "maxim,max8973";
57 reg = <0x1b>;
58
59 regulator-min-microvolt = <935000>;
60 regulator-max-microvolt = <1200000>;
61 regulator-boot-on;
62 regulator-always-on;
63 };
64};
65
66&cpu0 {
67 cpu0-supply = <&vdd_dvfs>;
68 operating-points = <
69 /* kHz uV */
70 1950000 1115000
71 1462500 995000
72 >;
73 voltage-tolerance = <1>; /* 1% */
74};
diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index 4ff2019c0e30..6c26caa880f2 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -85,4 +85,137 @@
85 interrupt-parent = <&gic>; 85 interrupt-parent = <&gic>;
86 interrupts = <0 69 4>; 86 interrupts = <0 69 4>;
87 }; 87 };
88
89 i2c0: i2c@e6500000 {
90 #address-cells = <1>;
91 #size-cells = <0>;
92 compatible = "renesas,rmobile-iic";
93 reg = <0 0xe6500000 0 0x428>;
94 interrupt-parent = <&gic>;
95 interrupts = <0 174 0x4>;
96 };
97
98 i2c1: i2c@e6510000 {
99 #address-cells = <1>;
100 #size-cells = <0>;
101 compatible = "renesas,rmobile-iic";
102 reg = <0 0xe6510000 0 0x428>;
103 interrupt-parent = <&gic>;
104 interrupts = <0 175 0x4>;
105 };
106
107 i2c2: i2c@e6520000 {
108 #address-cells = <1>;
109 #size-cells = <0>;
110 compatible = "renesas,rmobile-iic";
111 reg = <0 0xe6520000 0 0x428>;
112 interrupt-parent = <&gic>;
113 interrupts = <0 176 0x4>;
114 };
115
116 i2c3: i2c@e6530000 {
117 #address-cells = <1>;
118 #size-cells = <0>;
119 compatible = "renesas,rmobile-iic";
120 reg = <0 0xe6530000 0 0x428>;
121 interrupt-parent = <&gic>;
122 interrupts = <0 177 0x4>;
123 };
124
125 i2c4: i2c@e6540000 {
126 #address-cells = <1>;
127 #size-cells = <0>;
128 compatible = "renesas,rmobile-iic";
129 reg = <0 0xe6540000 0 0x428>;
130 interrupt-parent = <&gic>;
131 interrupts = <0 178 0x4>;
132 };
133
134 i2c5: i2c@e60b0000 {
135 #address-cells = <1>;
136 #size-cells = <0>;
137 compatible = "renesas,rmobile-iic";
138 reg = <0 0xe60b0000 0 0x428>;
139 interrupt-parent = <&gic>;
140 interrupts = <0 179 0x4>;
141 };
142
143 i2c6: i2c@e6550000 {
144 #address-cells = <1>;
145 #size-cells = <0>;
146 compatible = "renesas,rmobile-iic";
147 reg = <0 0xe6550000 0 0x428>;
148 interrupt-parent = <&gic>;
149 interrupts = <0 184 0x4>;
150 };
151
152 i2c7: i2c@e6560000 {
153 #address-cells = <1>;
154 #size-cells = <0>;
155 compatible = "renesas,rmobile-iic";
156 reg = <0 0xe6560000 0 0x428>;
157 interrupt-parent = <&gic>;
158 interrupts = <0 185 0x4>;
159 };
160
161 i2c8: i2c@e6570000 {
162 #address-cells = <1>;
163 #size-cells = <0>;
164 compatible = "renesas,rmobile-iic";
165 reg = <0 0xe6570000 0 0x428>;
166 interrupt-parent = <&gic>;
167 interrupts = <0 173 0x4>;
168 };
169
170 mmcif0: mmcif@ee200000 {
171 compatible = "renesas,sh-mmcif";
172 reg = <0 0xee200000 0 0x80>;
173 interrupt-parent = <&gic>;
174 interrupts = <0 169 0x4>;
175 reg-io-width = <4>;
176 status = "disabled";
177 };
178
179 mmcif1: mmcif@ee220000 {
180 compatible = "renesas,sh-mmcif";
181 reg = <0 0xee220000 0 0x80>;
182 interrupt-parent = <&gic>;
183 interrupts = <0 170 0x4>;
184 reg-io-width = <4>;
185 status = "disabled";
186 };
187
188 pfc: pfc@e6050000 {
189 compatible = "renesas,pfc-r8a73a4";
190 reg = <0 0xe6050000 0 0x9000>;
191 gpio-controller;
192 #gpio-cells = <2>;
193 };
194
195 sdhi0: sdhi@ee100000 {
196 compatible = "renesas,r8a73a4-sdhi";
197 reg = <0 0xee100000 0 0x100>;
198 interrupt-parent = <&gic>;
199 interrupts = <0 165 4>;
200 cap-sd-highspeed;
201 status = "disabled";
202 };
203
204 sdhi1: sdhi@ee120000 {
205 compatible = "renesas,r8a73a4-sdhi";
206 reg = <0 0xee120000 0 0x100>;
207 interrupt-parent = <&gic>;
208 interrupts = <0 166 4>;
209 cap-sd-highspeed;
210 status = "disabled";
211 };
212
213 sdhi2: sdhi@ee140000 {
214 compatible = "renesas,r8a73a4-sdhi";
215 reg = <0 0xee140000 0 0x100>;
216 interrupt-parent = <&gic>;
217 interrupts = <0 167 4>;
218 cap-sd-highspeed;
219 status = "disabled";
220 };
88}; 221};
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
index 09ea22c26359..366f72989dc3 100644
--- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
@@ -10,6 +10,7 @@
10 10
11/dts-v1/; 11/dts-v1/;
12/include/ "r8a7740.dtsi" 12/include/ "r8a7740.dtsi"
13#include <dt-bindings/gpio/gpio.h>
13 14
14/ { 15/ {
15 model = "armadillo 800 eva reference"; 16 model = "armadillo 800 eva reference";
@@ -33,6 +34,21 @@
33 regulator-boot-on; 34 regulator-boot-on;
34 }; 35 };
35 36
37 leds {
38 compatible = "gpio-leds";
39 led1 {
40 gpios = <&pfc 102 GPIO_ACTIVE_HIGH>;
41 };
42 led2 {
43 gpios = <&pfc 111 GPIO_ACTIVE_HIGH>;
44 };
45 led3 {
46 gpios = <&pfc 110 GPIO_ACTIVE_HIGH>;
47 };
48 led4 {
49 gpios = <&pfc 177 GPIO_ACTIVE_HIGH>;
50 };
51 };
36}; 52};
37 53
38&i2c0 { 54&i2c0 {
@@ -41,5 +57,23 @@
41 reg = <0x55>; 57 reg = <0x55>;
42 interrupt-parent = <&irqpin1>; 58 interrupt-parent = <&irqpin1>;
43 interrupts = <2 0>; /* IRQ10: hwirq 2 on irqpin1 */ 59 interrupts = <2 0>; /* IRQ10: hwirq 2 on irqpin1 */
60 pinctrl-0 = <&st1232_pins>;
61 pinctrl-names = "default";
62 gpios = <&pfc 166 GPIO_ACTIVE_LOW>;
63 };
64};
65
66&pfc {
67 pinctrl-0 = <&scifa1_pins>;
68 pinctrl-names = "default";
69
70 scifa1_pins: scifa1 {
71 renesas,groups = "scifa1_data";
72 renesas,function = "scifa1";
73 };
74
75 st1232_pins: st1232 {
76 renesas,groups = "intc_irq10";
77 renesas,function = "intc";
44 }; 78 };
45}; 79};
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 24e930643821..e18a195b55f3 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -139,4 +139,12 @@
139 0 72 0x4 139 0 72 0x4
140 0 73 0x4>; 140 0 73 0x4>;
141 }; 141 };
142
143 pfc: pfc@e6050000 {
144 compatible = "renesas,pfc-r8a7740";
145 reg = <0xe6050000 0x8000>,
146 <0xe605800c 0x20>;
147 gpio-controller;
148 #gpio-cells = <2>;
149 };
142}; 150};
diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index 474373559bdc..45ac404ab6d8 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -32,4 +32,70 @@
32 reg = <0xfe438000 0x1000>, 32 reg = <0xfe438000 0x1000>,
33 <0xfe430000 0x100>; 33 <0xfe430000 0x100>;
34 }; 34 };
35
36 gpio0: gpio@ffc40000 {
37 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
38 reg = <0xffc40000 0x2c>;
39 interrupt-parent = <&gic>;
40 interrupts = <0 103 0x4>;
41 #gpio-cells = <2>;
42 gpio-controller;
43 gpio-ranges = <&pfc 0 0 32>;
44 #interrupt-cells = <2>;
45 interrupt-controller;
46 };
47
48 gpio1: gpio@ffc41000 {
49 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
50 reg = <0xffc41000 0x2c>;
51 interrupt-parent = <&gic>;
52 interrupts = <0 103 0x4>;
53 #gpio-cells = <2>;
54 gpio-controller;
55 gpio-ranges = <&pfc 0 32 32>;
56 #interrupt-cells = <2>;
57 interrupt-controller;
58 };
59
60 gpio2: gpio@ffc42000 {
61 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
62 reg = <0xffc42000 0x2c>;
63 interrupt-parent = <&gic>;
64 interrupts = <0 103 0x4>;
65 #gpio-cells = <2>;
66 gpio-controller;
67 gpio-ranges = <&pfc 0 64 32>;
68 #interrupt-cells = <2>;
69 interrupt-controller;
70 };
71
72 gpio3: gpio@ffc43000 {
73 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
74 reg = <0xffc43000 0x2c>;
75 interrupt-parent = <&gic>;
76 interrupts = <0 103 0x4>;
77 #gpio-cells = <2>;
78 gpio-controller;
79 gpio-ranges = <&pfc 0 96 32>;
80 #interrupt-cells = <2>;
81 interrupt-controller;
82 };
83
84 gpio4: gpio@ffc44000 {
85 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
86 reg = <0xffc44000 0x2c>;
87 interrupt-parent = <&gic>;
88 interrupts = <0 103 0x4>;
89 #gpio-cells = <2>;
90 gpio-controller;
91 gpio-ranges = <&pfc 0 128 27>;
92 #interrupt-cells = <2>;
93 interrupt-controller;
94 };
95
96 pfc: pfc@fffc0000 {
97 compatible = "renesas,pfc-r8a7778";
98 reg = <0xfffc000 0x118>;
99 #gpio-range-cells = <3>;
100 };
35}; 101};
diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
index 72be4c87cfb5..b64705be258d 100644
--- a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
+++ b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
@@ -11,6 +11,7 @@
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "r8a7779.dtsi" 13/include/ "r8a7779.dtsi"
14#include <dt-bindings/gpio/gpio.h>
14 15
15/ { 16/ {
16 model = "marzen"; 17 model = "marzen";
@@ -37,6 +38,9 @@
37 lan0@18000000 { 38 lan0@18000000 {
38 compatible = "smsc,lan9220", "smsc,lan9115"; 39 compatible = "smsc,lan9220", "smsc,lan9115";
39 reg = <0x18000000 0x100>; 40 reg = <0x18000000 0x100>;
41 pinctrl-0 = <&lan0_pins>;
42 pinctrl-names = "default";
43
40 phy-mode = "mii"; 44 phy-mode = "mii";
41 interrupt-parent = <&gic>; 45 interrupt-parent = <&gic>;
42 interrupts = <0 28 0x4>; 46 interrupts = <0 28 0x4>;
@@ -44,4 +48,49 @@
44 vddvario-supply = <&fixedregulator3v3>; 48 vddvario-supply = <&fixedregulator3v3>;
45 vdd33a-supply = <&fixedregulator3v3>; 49 vdd33a-supply = <&fixedregulator3v3>;
46 }; 50 };
51
52 leds {
53 compatible = "gpio-leds";
54 led2 {
55 gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
56 };
57 led3 {
58 gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
59 };
60 led4 {
61 gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>;
62 };
63 };
64};
65
66&pfc {
67 pinctrl-0 = <&scif2_pins &scif4_pins &sdhi0_pins>;
68 pinctrl-names = "default";
69
70 lan0_pins: lan0 {
71 intc {
72 renesas,groups = "intc_irq1_b";
73 renesas,function = "intc";
74 };
75 lbsc {
76 renesas,groups = "lbsc_ex_cs0";
77 renesas,function = "lbsc";
78 };
79 };
80
81 scif2_pins: scif2 {
82 renesas,groups = "scif2_data_c";
83 renesas,function = "scif2";
84 };
85
86 scif4_pins: scif4 {
87 renesas,groups = "scif4_data";
88 renesas,function = "scif4";
89 };
90
91 sdhi0_pins: sdhi0 {
92 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd",
93 "sdhi0_wp";
94 renesas,function = "sdhi0";
95 };
47}; 96};
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index 7f146c6bf756..e9fbe3d572d7 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -48,6 +48,90 @@
48 <0xf0000100 0x100>; 48 <0xf0000100 0x100>;
49 }; 49 };
50 50
51 gpio0: gpio@ffc40000 {
52 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
53 reg = <0xffc40000 0x2c>;
54 interrupt-parent = <&gic>;
55 interrupts = <0 141 0x4>;
56 #gpio-cells = <2>;
57 gpio-controller;
58 gpio-ranges = <&pfc 0 0 32>;
59 #interrupt-cells = <2>;
60 interrupt-controller;
61 };
62
63 gpio1: gpio@ffc41000 {
64 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
65 reg = <0xffc41000 0x2c>;
66 interrupt-parent = <&gic>;
67 interrupts = <0 142 0x4>;
68 #gpio-cells = <2>;
69 gpio-controller;
70 gpio-ranges = <&pfc 0 32 32>;
71 #interrupt-cells = <2>;
72 interrupt-controller;
73 };
74
75 gpio2: gpio@ffc42000 {
76 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
77 reg = <0xffc42000 0x2c>;
78 interrupt-parent = <&gic>;
79 interrupts = <0 143 0x4>;
80 #gpio-cells = <2>;
81 gpio-controller;
82 gpio-ranges = <&pfc 0 64 32>;
83 #interrupt-cells = <2>;
84 interrupt-controller;
85 };
86
87 gpio3: gpio@ffc43000 {
88 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
89 reg = <0xffc43000 0x2c>;
90 interrupt-parent = <&gic>;
91 interrupts = <0 144 0x4>;
92 #gpio-cells = <2>;
93 gpio-controller;
94 gpio-ranges = <&pfc 0 96 32>;
95 #interrupt-cells = <2>;
96 interrupt-controller;
97 };
98
99 gpio4: gpio@ffc44000 {
100 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
101 reg = <0xffc44000 0x2c>;
102 interrupt-parent = <&gic>;
103 interrupts = <0 145 0x4>;
104 #gpio-cells = <2>;
105 gpio-controller;
106 gpio-ranges = <&pfc 0 128 32>;
107 #interrupt-cells = <2>;
108 interrupt-controller;
109 };
110
111 gpio5: gpio@ffc45000 {
112 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
113 reg = <0xffc45000 0x2c>;
114 interrupt-parent = <&gic>;
115 interrupts = <0 146 0x4>;
116 #gpio-cells = <2>;
117 gpio-controller;
118 gpio-ranges = <&pfc 0 160 32>;
119 #interrupt-cells = <2>;
120 interrupt-controller;
121 };
122
123 gpio6: gpio@ffc46000 {
124 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
125 reg = <0xffc46000 0x2c>;
126 interrupt-parent = <&gic>;
127 interrupts = <0 147 0x4>;
128 #gpio-cells = <2>;
129 gpio-controller;
130 gpio-ranges = <&pfc 0 192 9>;
131 #interrupt-cells = <2>;
132 interrupt-controller;
133 };
134
51 irqpin0: irqpin@fe780010 { 135 irqpin0: irqpin@fe780010 {
52 compatible = "renesas,intc-irqpin"; 136 compatible = "renesas,intc-irqpin";
53 #interrupt-cells = <2>; 137 #interrupt-cells = <2>;
@@ -101,6 +185,12 @@
101 interrupts = <0 81 0x4>; 185 interrupts = <0 81 0x4>;
102 }; 186 };
103 187
188 pfc: pfc@fffc0000 {
189 compatible = "renesas,pfc-r8a7779";
190 reg = <0xfffc0000 0x23c>;
191 #gpio-range-cells = <3>;
192 };
193
104 thermal@ffc48000 { 194 thermal@ffc48000 {
105 compatible = "renesas,rcar-thermal"; 195 compatible = "renesas,rcar-thermal";
106 reg = <0xffc48000 0x38>; 196 reg = <0xffc48000 0x38>;
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 339d9b11721c..3b879e7c697c 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -38,6 +38,78 @@
38 interrupts = <1 9 0xf04>; 38 interrupts = <1 9 0xf04>;
39 }; 39 };
40 40
41 gpio0: gpio@ffc40000 {
42 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
43 reg = <0 0xffc40000 0 0x2c>;
44 interrupt-parent = <&gic>;
45 interrupts = <0 4 0x4>;
46 #gpio-cells = <2>;
47 gpio-controller;
48 gpio-ranges = <&pfc 0 0 32>;
49 #interrupt-cells = <2>;
50 interrupt-controller;
51 };
52
53 gpio1: gpio@ffc41000 {
54 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
55 reg = <0 0xffc41000 0 0x2c>;
56 interrupt-parent = <&gic>;
57 interrupts = <0 5 0x4>;
58 #gpio-cells = <2>;
59 gpio-controller;
60 gpio-ranges = <&pfc 0 32 32>;
61 #interrupt-cells = <2>;
62 interrupt-controller;
63 };
64
65 gpio2: gpio@ffc42000 {
66 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
67 reg = <0 0xffc42000 0 0x2c>;
68 interrupt-parent = <&gic>;
69 interrupts = <0 6 0x4>;
70 #gpio-cells = <2>;
71 gpio-controller;
72 gpio-ranges = <&pfc 0 64 32>;
73 #interrupt-cells = <2>;
74 interrupt-controller;
75 };
76
77 gpio3: gpio@ffc43000 {
78 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
79 reg = <0 0xffc43000 0 0x2c>;
80 interrupt-parent = <&gic>;
81 interrupts = <0 7 0x4>;
82 #gpio-cells = <2>;
83 gpio-controller;
84 gpio-ranges = <&pfc 0 96 32>;
85 #interrupt-cells = <2>;
86 interrupt-controller;
87 };
88
89 gpio4: gpio@ffc44000 {
90 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
91 reg = <0 0xffc44000 0 0x2c>;
92 interrupt-parent = <&gic>;
93 interrupts = <0 8 0x4>;
94 #gpio-cells = <2>;
95 gpio-controller;
96 gpio-ranges = <&pfc 0 128 32>;
97 #interrupt-cells = <2>;
98 interrupt-controller;
99 };
100
101 gpio5: gpio@ffc45000 {
102 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
103 reg = <0 0xffc45000 0 0x2c>;
104 interrupt-parent = <&gic>;
105 interrupts = <0 9 0x4>;
106 #gpio-cells = <2>;
107 gpio-controller;
108 gpio-ranges = <&pfc 0 160 32>;
109 #interrupt-cells = <2>;
110 interrupt-controller;
111 };
112
41 timer { 113 timer {
42 compatible = "arm,armv7-timer"; 114 compatible = "arm,armv7-timer";
43 interrupts = <1 13 0xf08>, 115 interrupts = <1 13 0xf08>,
@@ -54,4 +126,64 @@
54 interrupt-parent = <&gic>; 126 interrupt-parent = <&gic>;
55 interrupts = <0 0 4>, <0 1 4>, <0 2 4>, <0 3 4>; 127 interrupts = <0 0 4>, <0 1 4>, <0 2 4>, <0 3 4>;
56 }; 128 };
129
130 mmcif0: mmcif@ee200000 {
131 compatible = "renesas,sh-mmcif";
132 reg = <0 0xee200000 0 0x80>;
133 interrupt-parent = <&gic>;
134 interrupts = <0 169 0x4>;
135 reg-io-width = <4>;
136 status = "disabled";
137 };
138
139 mmcif1: mmcif@ee220000 {
140 compatible = "renesas,sh-mmcif";
141 reg = <0 0xee220000 0 0x80>;
142 interrupt-parent = <&gic>;
143 interrupts = <0 170 0x4>;
144 reg-io-width = <4>;
145 status = "disabled";
146 };
147
148 pfc: pfc@e6060000 {
149 compatible = "renesas,pfc-r8a7790";
150 reg = <0 0xe6060000 0 0x250>;
151 #gpio-range-cells = <3>;
152 };
153
154 sdhi0: sdhi@ee100000 {
155 compatible = "renesas,r8a7790-sdhi";
156 reg = <0 0xee100000 0 0x100>;
157 interrupt-parent = <&gic>;
158 interrupts = <0 165 4>;
159 cap-sd-highspeed;
160 status = "disabled";
161 };
162
163 sdhi1: sdhi@ee120000 {
164 compatible = "renesas,r8a7790-sdhi";
165 reg = <0 0xee120000 0 0x100>;
166 interrupt-parent = <&gic>;
167 interrupts = <0 166 4>;
168 cap-sd-highspeed;
169 status = "disabled";
170 };
171
172 sdhi2: sdhi@ee140000 {
173 compatible = "renesas,r8a7790-sdhi";
174 reg = <0 0xee140000 0 0x100>;
175 interrupt-parent = <&gic>;
176 interrupts = <0 167 4>;
177 cap-sd-highspeed;
178 status = "disabled";
179 };
180
181 sdhi3: sdhi@ee160000 {
182 compatible = "renesas,r8a7790-sdhi";
183 reg = <0 0xee160000 0 0x100>;
184 interrupt-parent = <&gic>;
185 interrupts = <0 168 4>;
186 cap-sd-highspeed;
187 status = "disabled";
188 };
57}; 189};
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index a1d5e25a6698..ff63fbbd18ab 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -48,6 +48,11 @@
48 }; 48 };
49 }; 49 };
50 50
51 pmu {
52 compatible = "arm,cortex-a5-pmu";
53 interrupts = <46 IRQ_TYPE_LEVEL_HIGH 0>;
54 };
55
51 memory { 56 memory {
52 reg = <0x20000000 0x8000000>; 57 reg = <0x20000000 0x8000000>;
53 }; 58 };
diff --git a/arch/arm/boot/dts/sh7372.dtsi b/arch/arm/boot/dts/sh7372.dtsi
index 7bf020ecadf5..249f65be2a50 100644
--- a/arch/arm/boot/dts/sh7372.dtsi
+++ b/arch/arm/boot/dts/sh7372.dtsi
@@ -23,4 +23,12 @@
23 reg = <0x0>; 23 reg = <0x0>;
24 }; 24 };
25 }; 25 };
26
27 pfc: pfc@e6050000 {
28 compatible = "renesas,pfc-sh7372";
29 reg = <0xe6050000 0x8000>,
30 <0xe605801c 0x1c>;
31 gpio-controller;
32 #gpio-cells = <2>;
33 };
26}; 34};
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index b6f759e830ed..b99e890def54 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -13,6 +13,7 @@
13 13
14/dts-v1/; 14/dts-v1/;
15/include/ "sh73a0.dtsi" 15/include/ "sh73a0.dtsi"
16#include <dt-bindings/gpio/gpio.h>
16 17
17/ { 18/ {
18 model = "KZM-A9-GT"; 19 model = "KZM-A9-GT";
@@ -58,6 +59,24 @@
58 regulator-boot-on; 59 regulator-boot-on;
59 }; 60 };
60 61
62 vmmc_sdhi0: regulator@2 {
63 compatible = "regulator-fixed";
64 regulator-name = "SDHI0 Vcc";
65 regulator-min-microvolt = <3300000>;
66 regulator-max-microvolt = <3300000>;
67 gpio = <&pfc 15 GPIO_ACTIVE_HIGH>;
68 enable-active-high;
69 };
70
71 vmmc_sdhi2: regulator@3 {
72 compatible = "regulator-fixed";
73 regulator-name = "SDHI2 Vcc";
74 regulator-min-microvolt = <3300000>;
75 regulator-max-microvolt = <3300000>;
76 gpio = <&pfc 14 GPIO_ACTIVE_HIGH>;
77 enable-active-high;
78 };
79
61 lan9220@10000000 { 80 lan9220@10000000 {
62 compatible = "smsc,lan9220", "smsc,lan9115"; 81 compatible = "smsc,lan9220", "smsc,lan9115";
63 reg = <0x10000000 0x100>; 82 reg = <0x10000000 0x100>;
@@ -70,6 +89,22 @@
70 vddvario-supply = <&reg_1p8v>; 89 vddvario-supply = <&reg_1p8v>;
71 vdd33a-supply = <&reg_3p3v>; 90 vdd33a-supply = <&reg_3p3v>;
72 }; 91 };
92
93 leds {
94 compatible = "gpio-leds";
95 led1 {
96 gpios = <&pfc 20 GPIO_ACTIVE_LOW>;
97 };
98 led2 {
99 gpios = <&pfc 21 GPIO_ACTIVE_LOW>;
100 };
101 led3 {
102 gpios = <&pfc 22 GPIO_ACTIVE_LOW>;
103 };
104 led4 {
105 gpios = <&pfc 23 GPIO_ACTIVE_LOW>;
106 };
107 };
73}; 108};
74 109
75&i2c0 { 110&i2c0 {
@@ -145,20 +180,71 @@
145 }; 180 };
146}; 181};
147 182
183&i2c3 {
184 pinctrl-0 = <&i2c3_pins>;
185 pinctrl-names = "default";
186};
187
148&mmcif { 188&mmcif {
189 pinctrl-0 = <&mmcif_pins>;
190 pinctrl-names = "default";
191
149 bus-width = <8>; 192 bus-width = <8>;
150 vmmc-supply = <&reg_1p8v>; 193 vmmc-supply = <&reg_1p8v>;
151 status = "okay"; 194 status = "okay";
152}; 195};
153 196
197&pfc {
198 pinctrl-0 = <&scifa4_pins>;
199 pinctrl-names = "default";
200
201 i2c3_pins: i2c3 {
202 renesas,groups = "i2c3_1";
203 renesas,function = "i2c3";
204 };
205
206 mmcif_pins: mmcif {
207 mux {
208 renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0";
209 renesas,function = "mmc0";
210 };
211 cfg {
212 renesas,groups = "mmc0_data8_0";
213 renesas,pins = "PORT279";
214 bias-pull-up;
215 };
216 };
217
218 scifa4_pins: scifa4 {
219 renesas,groups = "scifa4_data", "scifa4_ctrl";
220 renesas,function = "scifa4";
221 };
222
223 sdhi0_pins: sdhi0 {
224 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd", "sdhi0_wp";
225 renesas,function = "sdhi0";
226 };
227
228 sdhi2_pins: sdhi2 {
229 renesas,groups = "sdhi2_data4", "sdhi2_ctrl";
230 renesas,function = "sdhi2";
231 };
232};
233
154&sdhi0 { 234&sdhi0 {
155 vmmc-supply = <&reg_3p3v>; 235 pinctrl-0 = <&sdhi0_pins>;
236 pinctrl-names = "default";
237
238 vmmc-supply = <&vmmc_sdhi0>;
156 bus-width = <4>; 239 bus-width = <4>;
157 status = "okay"; 240 status = "okay";
158}; 241};
159 242
160&sdhi2 { 243&sdhi2 {
161 vmmc-supply = <&reg_3p3v>; 244 pinctrl-0 = <&sdhi2_pins>;
245 pinctrl-names = "default";
246
247 vmmc-supply = <&vmmc_sdhi2>;
162 bus-width = <4>; 248 bus-width = <4>;
163 broken-cd; 249 broken-cd;
164 status = "okay"; 250 status = "okay";
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index b97750256003..86e79feb7560 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -222,4 +222,12 @@
222 cap-sd-highspeed; 222 cap-sd-highspeed;
223 status = "disabled"; 223 status = "disabled";
224 }; 224 };
225
226 pfc: pfc@e6050000 {
227 compatible = "renesas,pfc-sh73a0";
228 reg = <0xe6050000 0x8000>,
229 <0xe605801c 0x1c>;
230 gpio-controller;
231 #gpio-cells = <2>;
232 };
225}; 233};
diff --git a/arch/arm/boot/dts/ste-ccu8540-pinctrl.dtsi b/arch/arm/boot/dts/ste-ccu8540-pinctrl.dtsi
new file mode 100644
index 000000000000..e0799966bc25
--- /dev/null
+++ b/arch/arm/boot/dts/ste-ccu8540-pinctrl.dtsi
@@ -0,0 +1,196 @@
1/*
2 * Copyright 2012 ST-Ericsson
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11#include "ste-nomadik-pinctrl.dtsi"
12
13/ {
14 soc {
15 pinctrl {
16 uart0 {
17 uart0_default_mux: uart0_mux {
18 default_mux {
19 ste,function = "u0";
20 ste,pins = "u0_a_1";
21 };
22 };
23
24 uart0_default_mode: uart0_default {
25 default_cfg1 {
26 ste,pins = "GPIO0", "GPIO2";
27 ste,config = <&in_pu>;
28 };
29
30 default_cfg2 {
31 ste,pins = "GPIO1", "GPIO3";
32 ste,config = <&out_hi>;
33 };
34 };
35
36 uart0_sleep_mode: uart0_sleep {
37 sleep_cfg1 {
38 ste,pins = "GPIO0", "GPIO2";
39 ste,config = <&slpm_in_pu>;
40 };
41
42 sleep_cfg2 {
43 ste,pins = "GPIO1", "GPIO3";
44 ste,config = <&slpm_out_hi>;
45 };
46 };
47 };
48
49 uart2 {
50 uart2_default_mode: uart2_default {
51 default_mux {
52 ste,function = "u2";
53 ste,pins = "u2txrx_a_1";
54 };
55
56 default_cfg1 {
57 ste,pins = "GPIO120";
58 ste,config = <&in_pu>;
59 };
60
61 default_cfg2 {
62 ste,pins = "GPIO121";
63 ste,config = <&out_hi>;
64 };
65 };
66
67 uart2_sleep_mode: uart2_sleep {
68 sleep_cfg1 {
69 ste,pins = "GPIO120";
70 ste,config = <&slpm_in_pu>;
71 };
72
73 sleep_cfg2 {
74 ste,pins = "GPIO121";
75 ste,config = <&slpm_out_hi>;
76 };
77 };
78 };
79
80 i2c0 {
81 i2c0_default_mux: i2c_mux {
82 default_mux {
83 ste,function = "i2c0";
84 ste,pins = "i2c0_a_1";
85 };
86 };
87
88 i2c0_default_mode: i2c_default {
89 default_cfg1 {
90 ste,pins = "GPIO147", "GPIO148";
91 ste,config = <&in_pu>;
92 };
93 };
94
95 i2c0_sleep_mode: i2c_sleep {
96 sleep_cfg1 {
97 ste,pins = "GPIO147", "GPIO148";
98 ste,config = <&slpm_in_pu>;
99 };
100 };
101 };
102
103 i2c1 {
104 i2c1_default_mux: i2c_mux {
105 default_mux {
106 ste,function = "i2c1";
107 ste,pins = "i2c1_b_2";
108 };
109 };
110
111 i2c1_default_mode: i2c_default {
112 default_cfg1 {
113 ste,pins = "GPIO16", "GPIO17";
114 ste,config = <&in_pu>;
115 };
116 };
117
118 i2c1_sleep_mode: i2c_sleep {
119 sleep_cfg1 {
120 ste,pins = "GPIO16", "GPIO17";
121 ste,config = <&slpm_in_pu>;
122 };
123 };
124 };
125
126 i2c2 {
127 i2c2_default_mux: i2c_mux {
128 default_mux {
129 ste,function = "i2c2";
130 ste,pins = "i2c2_b_2";
131 };
132 };
133
134 i2c2_default_mode: i2c_default {
135 default_cfg1 {
136 ste,pins = "GPIO10", "GPIO11";
137 ste,config = <&in_pu>;
138 };
139 };
140
141 i2c2_sleep_mode: i2c_sleep {
142 sleep_cfg1 {
143 ste,pins = "GPIO11", "GPIO11";
144 ste,config = <&slpm_in_pu>;
145 };
146 };
147 };
148
149 i2c4 {
150 i2c4_default_mux: i2c_mux {
151 default_mux {
152 ste,function = "i2c4";
153 ste,pins = "i2c4_b_2";
154 };
155 };
156
157 i2c4_default_mode: i2c_default {
158 default_cfg1 {
159 ste,pins = "GPIO122", "GPIO123";
160 ste,config = <&in_pu>;
161 };
162 };
163
164 i2c4_sleep_mode: i2c_sleep {
165 sleep_cfg1 {
166 ste,pins = "GPIO122", "GPIO123";
167 ste,config = <&slpm_in_pu>;
168 };
169 };
170 };
171
172 i2c5 {
173 i2c5_default_mux: i2c_mux {
174 default_mux {
175 ste,function = "i2c5";
176 ste,pins = "i2c5_c_2";
177 };
178 };
179
180 i2c5_default_mode: i2c_default {
181 default_cfg1 {
182 ste,pins = "GPIO118", "GPIO119";
183 ste,config = <&in_pu>;
184 };
185 };
186
187 i2c5_sleep_mode: i2c_sleep {
188 sleep_cfg1 {
189 ste,pins = "GPIO118", "GPIO119";
190 ste,config = <&slpm_in_pu>;
191 };
192 };
193 };
194 };
195 };
196};
diff --git a/arch/arm/boot/dts/ste-ccu8540.dts b/arch/arm/boot/dts/ste-ccu8540.dts
new file mode 100644
index 000000000000..7f3baf51a3a9
--- /dev/null
+++ b/arch/arm/boot/dts/ste-ccu8540.dts
@@ -0,0 +1,86 @@
1/*
2 * Copyright 2013 ST-Ericsson AB
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "ste-dbx5x0.dtsi"
14#include "ste-ccu8540-pinctrl.dtsi"
15
16/ {
17 model = "ST-Ericsson U8540 platform with Device Tree";
18 compatible = "st-ericsson,ccu8540", "st-ericsson,u8540";
19
20 memory@0 {
21 reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>;
22 };
23
24 soc {
25 pinctrl {
26 compatible = "stericsson,db8540-pinctrl";
27 };
28
29 prcmu@80157000 {
30 reg = <0x80157000 0x2000>, <0x801b0000 0x8000>, <0x801b8000 0x3000>;
31 reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm";
32 };
33
34 uart@80120000 {
35 pinctrl-names = "default", "sleep";
36 pinctrl-0 = <&uart0_default_mux>, <&uart0_default_mode>;
37 pinctrl-1 = <&uart0_sleep_mode>;
38 status = "okay";
39 };
40
41 uart@80121000 {
42 status = "okay";
43 };
44
45 uart@80007000 {
46 pinctrl-names = "default", "sleep";
47 pinctrl-0 = <&uart2_default_mode>;
48 pinctrl-1 = <&uart2_sleep_mode>;
49 status = "okay";
50 };
51
52 i2c0: i2c@80004000 {
53 pinctrl-names = "default","sleep";
54 pinctrl-0 = <&i2c0_default_mux>, <&i2c0_default_mode>;
55 pinctrl-1 = <&i2c0_sleep_mode>;
56 };
57
58 i2c1: i2c@80122000 {
59 pinctrl-names = "default","sleep";
60 pinctrl-0 = <&i2c1_default_mux>, <&i2c1_default_mode>;
61 pinctrl-1 = <&i2c1_sleep_mode>;
62 };
63
64 i2c2: i2c@80128000 {
65 pinctrl-names = "default","sleep";
66 pinctrl-0 = <&i2c2_default_mux>, <&i2c2_default_mode>;
67 pinctrl-1 = <&i2c2_sleep_mode>;
68 };
69
70 i2c3: i2c@80110000 {
71 status = "disabled";
72 };
73
74 i2c4: i2c@8012a000 {
75 pinctrl-names = "default","sleep";
76 pinctrl-0 = <&i2c4_default_mux>, <&i2c4_default_mode>;
77 pinctrl-1 = <&i2c4_sleep_mode>;
78 };
79
80 i2c5: i2c@80001000 {
81 pinctrl-names = "default","sleep";
82 pinctrl-0 = <&i2c5_default_mux>, <&i2c5_default_mode>;
83 pinctrl-1 = <&i2c5_sleep_mode>;
84 };
85 };
86};
diff --git a/arch/arm/boot/dts/ccu9540.dts b/arch/arm/boot/dts/ste-ccu9540.dts
index ed29ec7288e4..229508750890 100644
--- a/arch/arm/boot/dts/ccu9540.dts
+++ b/arch/arm/boot/dts/ste-ccu9540.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13#include "dbx5x0.dtsi" 13#include "ste-dbx5x0.dtsi"
14 14
15/ { 15/ {
16 model = "ST-Ericsson CCU9540 platform with Device Tree"; 16 model = "ST-Ericsson CCU9540 platform with Device Tree";
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
index a1529455f081..1c1091eedade 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
@@ -245,7 +245,7 @@
245 <22 IRQ_TYPE_LEVEL_HIGH>; 245 <22 IRQ_TYPE_LEVEL_HIGH>;
246 interrupt-names = "IRQ_HOTMON_LOW", "IRQ_HOTMON_HIGH"; 246 interrupt-names = "IRQ_HOTMON_LOW", "IRQ_HOTMON_HIGH";
247 status = "disabled"; 247 status = "disabled";
248 }; 248 };
249 249
250 db8500-prcmu-regulators { 250 db8500-prcmu-regulators {
251 compatible = "stericsson,db8500-prcmu-regulator"; 251 compatible = "stericsson,db8500-prcmu-regulator";
@@ -457,8 +457,36 @@
457 stericsson,earpeice-cmv = <950>; /* Units in mV. */ 457 stericsson,earpeice-cmv = <950>; /* Units in mV. */
458 }; 458 };
459 459
460 ext_regulators: ab8500-ext-regulators {
461 compatible = "stericsson,ab8500-ext-regulator";
462
463 ab8500_ext1_reg: ab8500_ext1 {
464 regulator-compatible = "ab8500_ext1";
465 regulator-min-microvolt = <1800000>;
466 regulator-max-microvolt = <1800000>;
467 regulator-boot-on;
468 regulator-always-on;
469 };
470
471 ab8500_ext2_reg: ab8500_ext2 {
472 regulator-compatible = "ab8500_ext2";
473 regulator-min-microvolt = <1360000>;
474 regulator-max-microvolt = <1360000>;
475 regulator-boot-on;
476 regulator-always-on;
477 };
478
479 ab8500_ext3_reg: ab8500_ext3 {
480 regulator-compatible = "ab8500_ext3";
481 regulator-min-microvolt = <3400000>;
482 regulator-max-microvolt = <3400000>;
483 regulator-boot-on;
484 };
485 };
486
460 ab8500-regulators { 487 ab8500-regulators {
461 compatible = "stericsson,ab8500-regulator"; 488 compatible = "stericsson,ab8500-regulator";
489 vin-supply = <&ab8500_ext3_reg>;
462 490
463 // supplies to the display/camera 491 // supplies to the display/camera
464 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { 492 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
diff --git a/arch/arm/boot/dts/href.dtsi b/arch/arm/boot/dts/ste-href.dtsi
index 9db41b9d8358..370e03f5e7b2 100644
--- a/arch/arm/boot/dts/href.dtsi
+++ b/arch/arm/boot/dts/ste-href.dtsi
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include <dt-bindings/interrupt-controller/irq.h> 12#include <dt-bindings/interrupt-controller/irq.h>
13#include "dbx5x0.dtsi" 13#include "ste-dbx5x0.dtsi"
14 14
15/ { 15/ {
16 memory { 16 memory {
diff --git a/arch/arm/boot/dts/hrefprev60.dts b/arch/arm/boot/dts/ste-hrefprev60.dts
index c6bb07df2d1d..d8d3b99ab007 100644
--- a/arch/arm/boot/dts/hrefprev60.dts
+++ b/arch/arm/boot/dts/ste-hrefprev60.dts
@@ -10,9 +10,9 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13#include "dbx5x0.dtsi" 13#include "ste-dbx5x0.dtsi"
14#include "href.dtsi" 14#include "ste-href.dtsi"
15#include "stuib.dtsi" 15#include "ste-stuib.dtsi"
16 16
17/ { 17/ {
18 model = "ST-Ericsson HREF (pre-v60) platform with Device Tree"; 18 model = "ST-Ericsson HREF (pre-v60) platform with Device Tree";
diff --git a/arch/arm/boot/dts/hrefv60plus.dts b/arch/arm/boot/dts/ste-hrefv60plus.dts
index 3d580d6447f9..6e52ebbf113f 100644
--- a/arch/arm/boot/dts/hrefv60plus.dts
+++ b/arch/arm/boot/dts/ste-hrefv60plus.dts
@@ -10,9 +10,9 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13#include "dbx5x0.dtsi" 13#include "ste-dbx5x0.dtsi"
14#include "href.dtsi" 14#include "ste-href.dtsi"
15#include "stuib.dtsi" 15#include "ste-stuib.dtsi"
16 16
17/ { 17/ {
18 model = "ST-Ericsson HREF (v60+) platform with Device Tree"; 18 model = "ST-Ericsson HREF (v60+) platform with Device Tree";
diff --git a/arch/arm/boot/dts/ste-nomadik-pinctrl.dtsi b/arch/arm/boot/dts/ste-nomadik-pinctrl.dtsi
new file mode 100644
index 000000000000..efddee9403c4
--- /dev/null
+++ b/arch/arm/boot/dts/ste-nomadik-pinctrl.dtsi
@@ -0,0 +1,95 @@
1/*
2 * Copyright 2012 ST-Ericsson
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11#include <dt-bindings/pinctrl/nomadik.h>
12
13/ {
14 in_nopull: in_nopull {
15 ste,input = <INPUT_NOPULL>;
16 };
17
18 in_pu: input_pull_up {
19 ste,input = <INPUT_PULLUP>;
20 };
21
22 in_pd: input_pull_down {
23 ste,input = <INPUT_PULLDOWN>;
24 };
25
26 out_hi: output_high {
27 ste,output = <OUTPUT_HIGH>;
28 };
29
30 out_lo: output_low {
31 ste,output = <OUTPUT_LOW>;
32 };
33
34 gpio_out_lo: gpio_output_low {
35 ste,gpio = <GPIOMODE_ENABLED>;
36 ste,output = <OUTPUT_LOW>;
37 };
38
39 slpm_in_pu: slpm_in_pu {
40 ste,sleep = <SLPM_ENABLED>;
41 ste,sleep-input = <SLPM_INPUT_PULLUP>;
42 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
43 };
44
45 slpm_in_wkup_pdis: slpm_in_wkup_pdis {
46 ste,sleep = <SLPM_ENABLED>;
47 ste,sleep-input = <SLPM_DIR_INPUT>;
48 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
49 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
50 };
51
52 slpm_out_lo: slpm_out_lo {
53 ste,sleep = <SLPM_ENABLED>;
54 ste,sleep-output = <SLPM_OUTPUT_LOW>;
55 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
56 };
57
58 slpm_out_hi: slpm_out_hi {
59 ste,sleep = <SLPM_ENABLED>;
60 ste,sleep-output = <SLPM_OUTPUT_HIGH>;
61 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
62 };
63
64 slpm_out_hi_wkup_pdis: slpm_out_hi_wkup_pdis {
65 ste,sleep = <SLPM_ENABLED>;
66 ste,sleep-output = <SLPM_OUTPUT_HIGH>;
67 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
68 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
69 };
70
71 slpm_out_wkup_pdis: slpm_out_wkup_pdis {
72 ste,sleep = <SLPM_ENABLED>;
73 ste,sleep-output = <SLPM_DIR_OUTPUT>;
74 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
75 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
76 };
77
78 in_wkup_pdis: in_wkup_pdis {
79 ste,sleep-input = <SLPM_DIR_INPUT>;
80 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
81 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
82 };
83
84 out_hi_wkup_pdis: out_hi_wkup_pdis {
85 ste,sleep-output = <SLPM_OUTPUT_HIGH>;
86 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
87 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
88 };
89
90 out_wkup_pdis: out_wkup_pdis {
91 ste,sleep-output = <SLPM_DIR_OUTPUT>;
92 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
93 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
94 };
95};
diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
index a3acfa7b3dc9..9169d3025f39 100644
--- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
+++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
@@ -140,18 +140,30 @@
140 }; 140 };
141 }; 141 };
142 i2c0 { 142 i2c0 {
143 i2c0_default_mux: i2c0_mux {
144 i2c0_default_mux {
145 ste,function = "i2c0";
146 ste,pins = "i2c0_a_1";
147 };
148 };
143 i2c0_default_mode: i2c0_default { 149 i2c0_default_mode: i2c0_default {
144 i2c0_default_cfg { 150 i2c0_default_cfg {
145 ste,pins = "GPIO62_D3", "GPIO63_D2"; 151 ste,pins = "GPIO62_D3", "GPIO63_D2";
146 ste,input = <1>; 152 ste,input = <0>;
147 }; 153 };
148 }; 154 };
149 }; 155 };
150 i2c1 { 156 i2c1 {
157 i2c1_default_mux: i2c1_mux {
158 i2c1_default_mux {
159 ste,function = "i2c1";
160 ste,pins = "i2c1_a_1";
161 };
162 };
151 i2c1_default_mode: i2c1_default { 163 i2c1_default_mode: i2c1_default {
152 i2c1_default_cfg { 164 i2c1_default_cfg {
153 ste,pins = "GPIO53_L4", "GPIO54_L3"; 165 ste,pins = "GPIO53_L4", "GPIO54_L3";
154 ste,input = <1>; 166 ste,input = <0>;
155 }; 167 };
156 }; 168 };
157 }; 169 };
@@ -159,7 +171,7 @@
159 i2c2_default_mode: i2c2_default { 171 i2c2_default_mode: i2c2_default {
160 i2c2_default_cfg { 172 i2c2_default_cfg {
161 ste,pins = "GPIO73_C21", "GPIO74_C20"; 173 ste,pins = "GPIO73_C21", "GPIO74_C20";
162 ste,input = <1>; 174 ste,input = <0>;
163 }; 175 };
164 }; 176 };
165 }; 177 };
@@ -682,13 +694,17 @@
682 694
683 /* I2C0 connected to the STw4811 power management chip */ 695 /* I2C0 connected to the STw4811 power management chip */
684 i2c0 { 696 i2c0 {
685 compatible = "i2c-gpio"; 697 compatible = "st,nomadik-i2c", "arm,primecell";
686 gpios = <&gpio1 31 0>, /* sda */ 698 reg = <0x101f8000 0x1000>;
687 <&gpio1 30 0>; /* scl */ 699 interrupt-parent = <&vica>;
700 interrupts = <20>;
701 clock-frequency = <100000>;
688 #address-cells = <1>; 702 #address-cells = <1>;
689 #size-cells = <0>; 703 #size-cells = <0>;
704 clocks = <&i2c0clk>, <&pclki2c0>;
705 clock-names = "mclk", "apb_pclk";
690 pinctrl-names = "default"; 706 pinctrl-names = "default";
691 pinctrl-0 = <&i2c0_default_mode>; 707 pinctrl-0 = <&i2c0_default_mux>, <&i2c0_default_mode>;
692 708
693 stw4811@2d { 709 stw4811@2d {
694 compatible = "st,stw4811"; 710 compatible = "st,stw4811";
@@ -698,13 +714,17 @@
698 714
699 /* I2C1 connected to various sensors */ 715 /* I2C1 connected to various sensors */
700 i2c1 { 716 i2c1 {
701 compatible = "i2c-gpio"; 717 compatible = "st,nomadik-i2c", "arm,primecell";
702 gpios = <&gpio1 22 0>, /* sda */ 718 reg = <0x101f7000 0x1000>;
703 <&gpio1 21 0>; /* scl */ 719 interrupt-parent = <&vica>;
720 interrupts = <21>;
721 clock-frequency = <100000>;
704 #address-cells = <1>; 722 #address-cells = <1>;
705 #size-cells = <0>; 723 #size-cells = <0>;
724 clocks = <&i2c1clk>, <&pclki2c1>;
725 clock-names = "mclk", "apb_pclk";
706 pinctrl-names = "default"; 726 pinctrl-names = "default";
707 pinctrl-0 = <&i2c1_default_mode>; 727 pinctrl-0 = <&i2c1_default_mux>, <&i2c1_default_mode>;
708 728
709 camera@2d { 729 camera@2d {
710 compatible = "st,camera"; 730 compatible = "st,camera";
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index 49824be66845..f1fc128e249d 100644
--- a/arch/arm/boot/dts/snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13#include "dbx5x0.dtsi" 13#include "ste-dbx5x0.dtsi"
14 14
15/ { 15/ {
16 model = "Calao Systems Snowball platform with device tree"; 16 model = "Calao Systems Snowball platform with device tree";
@@ -165,34 +165,6 @@
165 status = "okay"; 165 status = "okay";
166 }; 166 };
167 167
168 i2c@80004000 {
169 tc3589x@42 {
170 //compatible = "tc3589x";
171 reg = <0x42>;
172 gpios = <&gpio6 25 0x4>;
173 interrupt-parent = <&gpio6>;
174 };
175 tps61052@33 {
176 //compatible = "tps61052";
177 reg = <0x33>;
178 };
179 };
180
181 i2c@80128000 {
182 lp5521@33 {
183 // compatible = "lp5521";
184 reg = <0x33>;
185 };
186 lp5521@34 {
187 // compatible = "lp5521";
188 reg = <0x34>;
189 };
190 bh1780@29 {
191 // compatible = "rohm,bh1780gli";
192 reg = <0x33>;
193 };
194 };
195
196 cpufreq-cooling { 168 cpufreq-cooling {
197 status = "okay"; 169 status = "okay";
198 }; 170 };
@@ -310,6 +282,20 @@
310 compatible = "stericsson,ab8500-gpio"; 282 compatible = "stericsson,ab8500-gpio";
311 }; 283 };
312 284
285 ext_regulators: ab8500-ext-regulators {
286 ab8500_ext1_reg: ab8500_ext1 {
287 regulator-name = "ab8500-ext-supply1";
288 };
289
290 ab8500_ext2_reg_reg: ab8500_ext2 {
291 regulator-name = "ab8500-ext-supply2";
292 };
293
294 ab8500_ext3_reg_reg: ab8500_ext3 {
295 regulator-name = "ab8500-ext-supply3";
296 };
297 };
298
313 ab8500-regulators { 299 ab8500-regulators {
314 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { 300 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
315 regulator-name = "V-DISPLAY"; 301 regulator-name = "V-DISPLAY";
diff --git a/arch/arm/boot/dts/stuib.dtsi b/arch/arm/boot/dts/ste-stuib.dtsi
index 524e33240ad4..524e33240ad4 100644
--- a/arch/arm/boot/dts/stuib.dtsi
+++ b/arch/arm/boot/dts/ste-stuib.dtsi
diff --git a/arch/arm/boot/dts/stih41x.dtsi b/arch/arm/boot/dts/stih41x.dtsi
index 7321403cab8a..f5b9898d9c6e 100644
--- a/arch/arm/boot/dts/stih41x.dtsi
+++ b/arch/arm/boot/dts/stih41x.dtsi
@@ -6,10 +6,12 @@
6 #address-cells = <1>; 6 #address-cells = <1>;
7 #size-cells = <0>; 7 #size-cells = <0>;
8 cpu@0 { 8 cpu@0 {
9 device_type = "cpu";
9 compatible = "arm,cortex-a9"; 10 compatible = "arm,cortex-a9";
10 reg = <0>; 11 reg = <0>;
11 }; 12 };
12 cpu@1 { 13 cpu@1 {
14 device_type = "cpu";
13 compatible = "arm,cortex-a9"; 15 compatible = "arm,cortex-a9";
14 reg = <1>; 16 reg = <1>;
15 }; 17 };
diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
new file mode 100644
index 000000000000..eb4d73b6a090
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
@@ -0,0 +1,101 @@
1/*
2 * Copyright 2013 Emilio López
3 *
4 * Emilio López <emilio@elopez.com.ar>
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/ "sun4i-a10.dtsi"
16
17/ {
18 model = "Mele A1000";
19 compatible = "mele,a1000", "allwinner,sun4i-a10";
20
21 aliases {
22 serial0 = &uart0;
23 };
24
25 soc@01c00000 {
26 emac: ethernet@01c0b000 {
27 pinctrl-names = "default";
28 pinctrl-0 = <&emac_pins_a>;
29 phy = <&phy1>;
30 status = "okay";
31 };
32
33 mdio@01c0b080 {
34 phy-supply = <&reg_emac_3v3>;
35 status = "okay";
36
37 phy1: ethernet-phy@1 {
38 reg = <1>;
39 };
40 };
41
42 pinctrl@01c20800 {
43 emac_power_pin_a1000: emac_power_pin@0 {
44 allwinner,pins = "PH15";
45 allwinner,function = "gpio_out";
46 allwinner,drive = <0>;
47 allwinner,pull = <0>;
48 };
49
50 led_pins_a1000: led_pins@0 {
51 allwinner,pins = "PH10", "PH20";
52 allwinner,function = "gpio_out";
53 allwinner,drive = <0>;
54 allwinner,pull = <0>;
55 };
56 };
57
58 uart0: serial@01c28000 {
59 pinctrl-names = "default";
60 pinctrl-0 = <&uart0_pins_a>;
61 status = "okay";
62 };
63
64 i2c0: i2c@01c2ac00 {
65 pinctrl-names = "default";
66 pinctrl-0 = <&i2c0_pins_a>;
67 status = "okay";
68 };
69 };
70
71 leds {
72 compatible = "gpio-leds";
73 pinctrl-names = "default";
74 pinctrl-0 = <&led_pins_a1000>;
75
76 red {
77 label = "a1000:red:usr";
78 gpios = <&pio 7 10 0>;
79 };
80
81 blue {
82 label = "a1000:blue:usr";
83 gpios = <&pio 7 20 0>;
84 };
85 };
86
87 regulators {
88 compatible = "simple-bus";
89
90 reg_emac_3v3: emac-3v3 {
91 compatible = "regulator-fixed";
92 pinctrl-names = "default";
93 pinctrl-0 = <&emac_power_pin_a1000>;
94 regulator-name = "emac-3v3";
95 regulator-min-microvolt = <3300000>;
96 regulator-max-microvolt = <3300000>;
97 enable-active-high;
98 gpio = <&pio 7 15 0>;
99 };
100 };
101};
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index 757c4cd900ee..425a7db898c5 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -26,7 +26,7 @@
26 bootargs = "earlyprintk console=ttyS0,115200"; 26 bootargs = "earlyprintk console=ttyS0,115200";
27 }; 27 };
28 28
29 soc@01c20000 { 29 soc@01c00000 {
30 emac: ethernet@01c0b000 { 30 emac: ethernet@01c0b000 {
31 pinctrl-names = "default"; 31 pinctrl-names = "default";
32 pinctrl-0 = <&emac_pins_a>; 32 pinctrl-0 = <&emac_pins_a>;
@@ -76,12 +76,12 @@
76 pinctrl-0 = <&led_pins_cubieboard>; 76 pinctrl-0 = <&led_pins_cubieboard>;
77 77
78 blue { 78 blue {
79 label = "cubieboard::blue"; 79 label = "cubieboard:blue:usr";
80 gpios = <&pio 7 21 0>; /* LED1 */ 80 gpios = <&pio 7 21 0>; /* LED1 */
81 }; 81 };
82 82
83 green { 83 green {
84 label = "cubieboard::green"; 84 label = "cubieboard:green:usr";
85 gpios = <&pio 7 20 0>; /* LED2 */ 85 gpios = <&pio 7 20 0>; /* LED2 */
86 linux,default-trigger = "heartbeat"; 86 linux,default-trigger = "heartbeat";
87 }; 87 };
diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
index 3514b37d66bc..b3ae51fa9372 100644
--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
+++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
@@ -22,7 +22,7 @@
22 bootargs = "earlyprintk console=ttyS0,115200"; 22 bootargs = "earlyprintk console=ttyS0,115200";
23 }; 23 };
24 24
25 soc@01c20000 { 25 soc@01c00000 {
26 emac: ethernet@01c0b000 { 26 emac: ethernet@01c0b000 {
27 pinctrl-names = "default"; 27 pinctrl-names = "default";
28 pinctrl-0 = <&emac_pins_a>; 28 pinctrl-0 = <&emac_pins_a>;
diff --git a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
index 078ed7f618d7..0c1447c68059 100644
--- a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
@@ -22,7 +22,7 @@
22 bootargs = "earlyprintk console=ttyS0,115200"; 22 bootargs = "earlyprintk console=ttyS0,115200";
23 }; 23 };
24 24
25 soc@01c20000 { 25 soc@01c00000 {
26 uart0: serial@01c28000 { 26 uart0: serial@01c28000 {
27 pinctrl-names = "default"; 27 pinctrl-names = "default";
28 pinctrl-0 = <&uart0_pins_a>; 28 pinctrl-0 = <&uart0_pins_a>;
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index b2bd6e124250..c32770a28acf 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -160,11 +160,10 @@
160 }; 160 };
161 }; 161 };
162 162
163 soc@01c20000 { 163 soc@01c00000 {
164 compatible = "simple-bus"; 164 compatible = "simple-bus";
165 #address-cells = <1>; 165 #address-cells = <1>;
166 #size-cells = <1>; 166 #size-cells = <1>;
167 reg = <0x01c20000 0x300000>;
168 ranges; 167 ranges;
169 168
170 emac: ethernet@01c0b000 { 169 emac: ethernet@01c0b000 {
diff --git a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
index 64dc0c42c43a..3c9f8b3cd3e3 100644
--- a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
@@ -18,7 +18,7 @@
18 model = "Olimex A10s-Olinuxino Micro"; 18 model = "Olimex A10s-Olinuxino Micro";
19 compatible = "olimex,a10s-olinuxino-micro", "allwinner,sun5i-a10s"; 19 compatible = "olimex,a10s-olinuxino-micro", "allwinner,sun5i-a10s";
20 20
21 soc@01c20000 { 21 soc@01c00000 {
22 emac: ethernet@01c0b000 { 22 emac: ethernet@01c0b000 {
23 pinctrl-names = "default"; 23 pinctrl-names = "default";
24 pinctrl-0 = <&emac_pins_a>; 24 pinctrl-0 = <&emac_pins_a>;
@@ -60,6 +60,31 @@
60 pinctrl-0 = <&uart3_pins_a>; 60 pinctrl-0 = <&uart3_pins_a>;
61 status = "okay"; 61 status = "okay";
62 }; 62 };
63
64 i2c0: i2c@01c2ac00 {
65 pinctrl-names = "default";
66 pinctrl-0 = <&i2c0_pins_a>;
67 status = "okay";
68 };
69
70 i2c1: i2c@01c2b000 {
71 pinctrl-names = "default";
72 pinctrl-0 = <&i2c1_pins_a>;
73 status = "okay";
74
75 at24@50 {
76 compatible = "at,24c16";
77 pagesize = <16>;
78 reg = <0x50>;
79 read-only;
80 };
81 };
82
83 i2c2: i2c@01c2b400 {
84 pinctrl-names = "default";
85 pinctrl-0 = <&i2c2_pins_a>;
86 status = "okay";
87 };
63 }; 88 };
64 89
65 leds { 90 leds {
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index 2307ce827ae0..ee0ff9ba1bca 100644
--- a/arch/arm/boot/dts/sun5i-a10s.dtsi
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -157,11 +157,10 @@
157 }; 157 };
158 }; 158 };
159 159
160 soc@01c20000 { 160 soc@01c00000 {
161 compatible = "simple-bus"; 161 compatible = "simple-bus";
162 #address-cells = <1>; 162 #address-cells = <1>;
163 #size-cells = <1>; 163 #size-cells = <1>;
164 reg = <0x01c20000 0x300000>;
165 ranges; 164 ranges;
166 165
167 emac: ethernet@01c0b000 { 166 emac: ethernet@01c0b000 {
@@ -229,6 +228,27 @@
229 allwinner,drive = <0>; 228 allwinner,drive = <0>;
230 allwinner,pull = <0>; 229 allwinner,pull = <0>;
231 }; 230 };
231
232 i2c0_pins_a: i2c0@0 {
233 allwinner,pins = "PB0", "PB1";
234 allwinner,function = "i2c0";
235 allwinner,drive = <0>;
236 allwinner,pull = <0>;
237 };
238
239 i2c1_pins_a: i2c1@0 {
240 allwinner,pins = "PB15", "PB16";
241 allwinner,function = "i2c1";
242 allwinner,drive = <0>;
243 allwinner,pull = <0>;
244 };
245
246 i2c2_pins_a: i2c2@0 {
247 allwinner,pins = "PB17", "PB18";
248 allwinner,function = "i2c2";
249 allwinner,drive = <0>;
250 allwinner,pull = <0>;
251 };
232 }; 252 };
233 253
234 timer@01c20c00 { 254 timer@01c20c00 {
@@ -282,5 +302,38 @@
282 clocks = <&apb1_gates 19>; 302 clocks = <&apb1_gates 19>;
283 status = "disabled"; 303 status = "disabled";
284 }; 304 };
305
306 i2c0: i2c@01c2ac00 {
307 #address-cells = <1>;
308 #size-cells = <0>;
309 compatible = "allwinner,sun4i-i2c";
310 reg = <0x01c2ac00 0x400>;
311 interrupts = <7>;
312 clocks = <&apb1_gates 0>;
313 clock-frequency = <100000>;
314 status = "disabled";
315 };
316
317 i2c1: i2c@01c2b000 {
318 #address-cells = <1>;
319 #size-cells = <0>;
320 compatible = "allwinner,sun4i-i2c";
321 reg = <0x01c2b000 0x400>;
322 interrupts = <8>;
323 clocks = <&apb1_gates 1>;
324 clock-frequency = <100000>;
325 status = "disabled";
326 };
327
328 i2c2: i2c@01c2b400 {
329 #address-cells = <1>;
330 #size-cells = <0>;
331 compatible = "allwinner,sun4i-i2c";
332 reg = <0x01c2b400 0x400>;
333 interrupts = <9>;
334 clocks = <&apb1_gates 2>;
335 clock-frequency = <100000>;
336 status = "disabled";
337 };
285 }; 338 };
286}; 339};
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
index 80497e376706..9e508dcc4245 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
@@ -22,7 +22,7 @@
22 bootargs = "earlyprintk console=ttyS0,115200"; 22 bootargs = "earlyprintk console=ttyS0,115200";
23 }; 23 };
24 24
25 soc@01c20000 { 25 soc@01c00000 {
26 pinctrl@01c20800 { 26 pinctrl@01c20800 {
27 led_pins_olinuxino: led_pins@0 { 27 led_pins_olinuxino: led_pins@0 {
28 allwinner,pins = "PG9"; 28 allwinner,pins = "PG9";
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index 7363211daf84..f6091dc0936c 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -150,11 +150,10 @@
150 }; 150 };
151 }; 151 };
152 152
153 soc@01c20000 { 153 soc@01c00000 {
154 compatible = "simple-bus"; 154 compatible = "simple-bus";
155 #address-cells = <1>; 155 #address-cells = <1>;
156 #size-cells = <1>; 156 #size-cells = <1>;
157 reg = <0x01c20000 0x300000>;
158 ranges; 157 ranges;
159 158
160 intc: interrupt-controller@01c20400 { 159 intc: interrupt-controller@01c20400 {
diff --git a/arch/arm/boot/dts/sun6i-a31-colombus.dts b/arch/arm/boot/dts/sun6i-a31-colombus.dts
new file mode 100644
index 000000000000..99c4b1847cab
--- /dev/null
+++ b/arch/arm/boot/dts/sun6i-a31-colombus.dts
@@ -0,0 +1,30 @@
1/*
2 * Copyright 2013 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.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/ "sun6i-a31.dtsi"
16
17/ {
18 model = "WITS A31 Colombus Evaluation Board";
19 compatible = "wits,colombus", "allwinner,sun6i-a31";
20
21 chosen {
22 bootargs = "earlyprintk console=ttyS0,115200";
23 };
24
25 soc@01c00000 {
26 uart0: serial@01c28000 {
27 status = "okay";
28 };
29 };
30};
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
new file mode 100644
index 000000000000..4d076ec24885
--- /dev/null
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -0,0 +1,156 @@
1/*
2 * Copyright 2013 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.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 = <&gic>;
18
19 cpus {
20 #address-cells = <1>;
21 #size-cells = <0>;
22
23 cpu@0 {
24 compatible = "arm,cortex-a7";
25 device_type = "cpu";
26 reg = <0>;
27 };
28
29 cpu@1 {
30 compatible = "arm,cortex-a7";
31 device_type = "cpu";
32 reg = <1>;
33 };
34
35 cpu@2 {
36 compatible = "arm,cortex-a7";
37 device_type = "cpu";
38 reg = <2>;
39 };
40
41 cpu@3 {
42 compatible = "arm,cortex-a7";
43 device_type = "cpu";
44 reg = <3>;
45 };
46 };
47
48 memory {
49 reg = <0x40000000 0x80000000>;
50 };
51
52 clocks {
53 #address-cells = <1>;
54 #size-cells = <0>;
55
56 osc: oscillator {
57 #clock-cells = <0>;
58 compatible = "fixed-clock";
59 clock-frequency = <24000000>;
60 };
61 };
62
63 soc@01c00000 {
64 compatible = "simple-bus";
65 #address-cells = <1>;
66 #size-cells = <1>;
67 ranges;
68
69 timer@01c20c00 {
70 compatible = "allwinner,sun4i-timer";
71 reg = <0x01c20c00 0xa0>;
72 interrupts = <0 18 1>,
73 <0 19 1>,
74 <0 20 1>,
75 <0 21 1>,
76 <0 22 1>;
77 clocks = <&osc>;
78 };
79
80 wdt1: watchdog@01c20ca0 {
81 compatible = "allwinner,sun6i-wdt";
82 reg = <0x01c20ca0 0x20>;
83 };
84
85 uart0: serial@01c28000 {
86 compatible = "snps,dw-apb-uart";
87 reg = <0x01c28000 0x400>;
88 interrupts = <0 0 1>;
89 reg-shift = <2>;
90 reg-io-width = <4>;
91 clocks = <&osc>;
92 status = "disabled";
93 };
94
95 uart1: serial@01c28400 {
96 compatible = "snps,dw-apb-uart";
97 reg = <0x01c28400 0x400>;
98 interrupts = <0 1 1>;
99 reg-shift = <2>;
100 reg-io-width = <4>;
101 clocks = <&osc>;
102 status = "disabled";
103 };
104
105 uart2: serial@01c28800 {
106 compatible = "snps,dw-apb-uart";
107 reg = <0x01c28800 0x400>;
108 interrupts = <0 2 1>;
109 reg-shift = <2>;
110 reg-io-width = <4>;
111 clocks = <&osc>;
112 status = "disabled";
113 };
114
115 uart3: serial@01c28c00 {
116 compatible = "snps,dw-apb-uart";
117 reg = <0x01c28c00 0x400>;
118 interrupts = <0 3 1>;
119 reg-shift = <2>;
120 reg-io-width = <4>;
121 clocks = <&osc>;
122 status = "disabled";
123 };
124
125 uart4: serial@01c29000 {
126 compatible = "snps,dw-apb-uart";
127 reg = <0x01c29000 0x400>;
128 interrupts = <0 4 1>;
129 reg-shift = <2>;
130 reg-io-width = <4>;
131 clocks = <&osc>;
132 status = "disabled";
133 };
134
135 uart5: serial@01c29400 {
136 compatible = "snps,dw-apb-uart";
137 reg = <0x01c29400 0x400>;
138 interrupts = <0 5 1>;
139 reg-shift = <2>;
140 reg-io-width = <4>;
141 clocks = <&osc>;
142 status = "disabled";
143 };
144
145 gic: interrupt-controller@01c81000 {
146 compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
147 reg = <0x01c81000 0x1000>,
148 <0x01c82000 0x1000>,
149 <0x01c84000 0x2000>,
150 <0x01c86000 0x2000>;
151 interrupt-controller;
152 #interrupt-cells = <3>;
153 interrupts = <1 9 0xf04>;
154 };
155 };
156};
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
new file mode 100644
index 000000000000..d3395846491c
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
@@ -0,0 +1,34 @@
1/*
2 * Copyright 2013 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.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/ "sun7i-a20.dtsi"
16
17/ {
18 model = "Olimex A20-Olinuxino Micro";
19 compatible = "olimex,a20-olinuxino-micro", "allwinner,sun7i-a20";
20
21 soc@01c00000 {
22 uart0: serial@01c28000 {
23 status = "okay";
24 };
25
26 uart6: serial@01c29800 {
27 status = "okay";
28 };
29
30 uart7: serial@01c29c00 {
31 status = "okay";
32 };
33 };
34};
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
new file mode 100644
index 000000000000..33391517118c
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -0,0 +1,172 @@
1/*
2 * Copyright 2013 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.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 = <&gic>;
18
19 cpus {
20 #address-cells = <1>;
21 #size-cells = <0>;
22
23 cpu@0 {
24 compatible = "arm,cortex-a7";
25 device_type = "cpu";
26 reg = <0>;
27 };
28
29 cpu@1 {
30 compatible = "arm,cortex-a7";
31 device_type = "cpu";
32 reg = <1>;
33 };
34 };
35
36 memory {
37 reg = <0x40000000 0x80000000>;
38 };
39
40 clocks {
41 #address-cells = <1>;
42 #size-cells = <1>;
43 ranges;
44
45 osc24M: osc24M@01c20050 {
46 #clock-cells = <0>;
47 compatible = "fixed-clock";
48 clock-frequency = <24000000>;
49 };
50
51 osc32k: osc32k {
52 #clock-cells = <0>;
53 compatible = "fixed-clock";
54 clock-frequency = <32768>;
55 };
56 };
57
58 soc@01c00000 {
59 compatible = "simple-bus";
60 #address-cells = <1>;
61 #size-cells = <1>;
62 ranges;
63
64 timer@01c20c00 {
65 compatible = "allwinner,sun4i-timer";
66 reg = <0x01c20c00 0x90>;
67 interrupts = <0 22 1>,
68 <0 23 1>,
69 <0 24 1>,
70 <0 25 1>,
71 <0 67 1>,
72 <0 68 1>;
73 clocks = <&osc24M>;
74 };
75
76 wdt: watchdog@01c20c90 {
77 compatible = "allwinner,sun4i-wdt";
78 reg = <0x01c20c90 0x10>;
79 };
80
81 uart0: serial@01c28000 {
82 compatible = "snps,dw-apb-uart";
83 reg = <0x01c28000 0x400>;
84 interrupts = <0 1 1>;
85 reg-shift = <2>;
86 reg-io-width = <4>;
87 clocks = <&osc24M>;
88 status = "disabled";
89 };
90
91 uart1: serial@01c28400 {
92 compatible = "snps,dw-apb-uart";
93 reg = <0x01c28400 0x400>;
94 interrupts = <0 2 1>;
95 reg-shift = <2>;
96 reg-io-width = <4>;
97 clocks = <&osc24M>;
98 status = "disabled";
99 };
100
101 uart2: serial@01c28800 {
102 compatible = "snps,dw-apb-uart";
103 reg = <0x01c28800 0x400>;
104 interrupts = <0 3 1>;
105 reg-shift = <2>;
106 reg-io-width = <4>;
107 clocks = <&osc24M>;
108 status = "disabled";
109 };
110
111 uart3: serial@01c28c00 {
112 compatible = "snps,dw-apb-uart";
113 reg = <0x01c28c00 0x400>;
114 interrupts = <0 4 1>;
115 reg-shift = <2>;
116 reg-io-width = <4>;
117 clocks = <&osc24M>;
118 status = "disabled";
119 };
120
121 uart4: serial@01c29000 {
122 compatible = "snps,dw-apb-uart";
123 reg = <0x01c29000 0x400>;
124 interrupts = <0 17 1>;
125 reg-shift = <2>;
126 reg-io-width = <4>;
127 clocks = <&osc24M>;
128 status = "disabled";
129 };
130
131 uart5: serial@01c29400 {
132 compatible = "snps,dw-apb-uart";
133 reg = <0x01c29400 0x400>;
134 interrupts = <0 18 1>;
135 reg-shift = <2>;
136 reg-io-width = <4>;
137 clocks = <&osc24M>;
138 status = "disabled";
139 };
140
141 uart6: serial@01c29800 {
142 compatible = "snps,dw-apb-uart";
143 reg = <0x01c29800 0x400>;
144 interrupts = <0 19 1>;
145 reg-shift = <2>;
146 reg-io-width = <4>;
147 clocks = <&osc24M>;
148 status = "disabled";
149 };
150
151 uart7: serial@01c29c00 {
152 compatible = "snps,dw-apb-uart";
153 reg = <0x01c29c00 0x400>;
154 interrupts = <0 20 1>;
155 reg-shift = <2>;
156 reg-io-width = <4>;
157 clocks = <&osc24M>;
158 status = "disabled";
159 };
160
161 gic: interrupt-controller@01c81000 {
162 compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
163 reg = <0x01c81000 0x1000>,
164 <0x01c82000 0x1000>,
165 <0x01c84000 0x2000>,
166 <0x01c86000 0x2000>;
167 interrupt-controller;
168 #interrupt-cells = <3>;
169 interrupts = <1 9 0xf04>;
170 };
171 };
172};
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts
index cb640eb6c932..60230288884b 100644
--- a/arch/arm/boot/dts/tegra114-dalmore.dts
+++ b/arch/arm/boot/dts/tegra114-dalmore.dts
@@ -791,7 +791,7 @@
791 regulator-boot-on; 791 regulator-boot-on;
792 }; 792 };
793 793
794 dcdc3 { 794 tps65090_dcdc3_reg: dcdc3 {
795 regulator-name = "vdd-ao"; 795 regulator-name = "vdd-ao";
796 regulator-always-on; 796 regulator-always-on;
797 regulator-boot-on; 797 regulator-boot-on;
@@ -836,6 +836,182 @@
836 }; 836 };
837 }; 837 };
838 }; 838 };
839
840 palmas: tps65913 {
841 compatible = "ti,palmas";
842 reg = <0x58>;
843 interrupts = <0 86 IRQ_TYPE_LEVEL_LOW>;
844
845 #interrupt-cells = <2>;
846 interrupt-controller;
847
848 ti,system-power-controller;
849
850 palmas_gpio: gpio {
851 compatible = "ti,palmas-gpio";
852 gpio-controller;
853 #gpio-cells = <2>;
854 };
855
856 pmic {
857 compatible = "ti,tps65913-pmic", "ti,palmas-pmic";
858 smps1-in-supply = <&tps65090_dcdc3_reg>;
859 smps3-in-supply = <&tps65090_dcdc3_reg>;
860 smps4-in-supply = <&tps65090_dcdc2_reg>;
861 smps7-in-supply = <&tps65090_dcdc2_reg>;
862 smps8-in-supply = <&tps65090_dcdc2_reg>;
863 smps9-in-supply = <&tps65090_dcdc2_reg>;
864 ldo1-in-supply = <&tps65090_dcdc2_reg>;
865 ldo2-in-supply = <&tps65090_dcdc2_reg>;
866 ldo3-in-supply = <&palmas_smps3_reg>;
867 ldo4-in-supply = <&tps65090_dcdc2_reg>;
868 ldo5-in-supply = <&vdd_ac_bat_reg>;
869 ldo6-in-supply = <&tps65090_dcdc2_reg>;
870 ldo7-in-supply = <&tps65090_dcdc2_reg>;
871 ldo8-in-supply = <&tps65090_dcdc3_reg>;
872 ldo9-in-supply = <&palmas_smps9_reg>;
873 ldoln-in-supply = <&tps65090_dcdc1_reg>;
874 ldousb-in-supply = <&tps65090_dcdc1_reg>;
875
876 regulators {
877 smps12 {
878 regulator-name = "vddio-ddr";
879 regulator-min-microvolt = <1350000>;
880 regulator-max-microvolt = <1350000>;
881 regulator-always-on;
882 regulator-boot-on;
883 };
884
885 palmas_smps3_reg: smps3 {
886 regulator-name = "vddio-1v8";
887 regulator-min-microvolt = <1800000>;
888 regulator-max-microvolt = <1800000>;
889 regulator-always-on;
890 regulator-boot-on;
891 };
892
893 smps45 {
894 regulator-name = "vdd-core";
895 regulator-min-microvolt = <900000>;
896 regulator-max-microvolt = <1400000>;
897 regulator-always-on;
898 regulator-boot-on;
899 };
900
901 smps457 {
902 regulator-name = "vdd-core";
903 regulator-min-microvolt = <900000>;
904 regulator-max-microvolt = <1400000>;
905 regulator-always-on;
906 regulator-boot-on;
907 };
908
909 smps8 {
910 regulator-name = "avdd-pll";
911 regulator-min-microvolt = <1050000>;
912 regulator-max-microvolt = <1050000>;
913 regulator-always-on;
914 regulator-boot-on;
915 };
916
917 palmas_smps9_reg: smps9 {
918 regulator-name = "sdhci-vdd-sd-slot";
919 regulator-min-microvolt = <2800000>;
920 regulator-max-microvolt = <2800000>;
921 regulator-always-on;
922 };
923
924 ldo1 {
925 regulator-name = "avdd-cam1";
926 regulator-min-microvolt = <2800000>;
927 regulator-max-microvolt = <2800000>;
928 };
929
930 ldo2 {
931 regulator-name = "avdd-cam2";
932 regulator-min-microvolt = <2800000>;
933 regulator-max-microvolt = <2800000>;
934 };
935
936 ldo3 {
937 regulator-name = "avdd-dsi-csi";
938 regulator-min-microvolt = <1200000>;
939 regulator-max-microvolt = <1200000>;
940 regulator-always-on;
941 regulator-boot-on;
942 };
943
944 ldo4 {
945 regulator-name = "vpp-fuse";
946 regulator-min-microvolt = <1800000>;
947 regulator-max-microvolt = <1800000>;
948 };
949
950 ldo6 {
951 regulator-name = "vdd-sensor-2v85";
952 regulator-min-microvolt = <2850000>;
953 regulator-max-microvolt = <2850000>;
954 };
955
956 ldo7 {
957 regulator-name = "vdd-af-cam1";
958 regulator-min-microvolt = <2800000>;
959 regulator-max-microvolt = <2800000>;
960 };
961
962 ldo8 {
963 regulator-name = "vdd-rtc";
964 regulator-min-microvolt = <900000>;
965 regulator-max-microvolt = <900000>;
966 regulator-always-on;
967 regulator-boot-on;
968 ti,enable-ldo8-tracking;
969 };
970
971 ldo9 {
972 regulator-name = "vddio-sdmmc-2";
973 regulator-min-microvolt = <1800000>;
974 regulator-max-microvolt = <3300000>;
975 regulator-always-on;
976 regulator-boot-on;
977 };
978
979 ldoln {
980 regulator-name = "hvdd-usb";
981 regulator-min-microvolt = <3300000>;
982 regulator-max-microvolt = <3300000>;
983 };
984
985 ldousb {
986 regulator-name = "avdd-usb";
987 regulator-min-microvolt = <3300000>;
988 regulator-max-microvolt = <3300000>;
989 regulator-always-on;
990 regulator-boot-on;
991 };
992
993 regen1 {
994 regulator-name = "rail-3v3";
995 regulator-max-microvolt = <3300000>;
996 regulator-always-on;
997 regulator-boot-on;
998 };
999
1000 regen2 {
1001 regulator-name = "rail-5v0";
1002 regulator-max-microvolt = <5000000>;
1003 regulator-always-on;
1004 regulator-boot-on;
1005 };
1006 };
1007 };
1008
1009 rtc {
1010 compatible = "ti,palmas-rtc";
1011 interrupt-parent = <&palmas>;
1012 interrupts = <8 0>;
1013 };
1014 };
839 }; 1015 };
840 1016
841 spi@7000da00 { 1017 spi@7000da00 {
@@ -850,6 +1026,13 @@
850 1026
851 pmc { 1027 pmc {
852 nvidia,invert-interrupt; 1028 nvidia,invert-interrupt;
1029 nvidia,suspend-mode = <1>;
1030 nvidia,cpu-pwr-good-time = <500>;
1031 nvidia,cpu-pwr-off-time = <300>;
1032 nvidia,core-pwr-good-time = <641 3845>;
1033 nvidia,core-pwr-off-time = <61036>;
1034 nvidia,core-power-req-active-high;
1035 nvidia,sys-clock-req-active-high;
853 }; 1036 };
854 1037
855 ahub { 1038 ahub {
@@ -870,6 +1053,15 @@
870 non-removable; 1053 non-removable;
871 }; 1054 };
872 1055
1056 usb@7d008000 {
1057 status = "okay";
1058 };
1059
1060 usb-phy@7d008000 {
1061 status = "okay";
1062 vbus-supply = <&usb3_vbus_reg>;
1063 };
1064
873 clocks { 1065 clocks {
874 compatible = "simple-bus"; 1066 compatible = "simple-bus";
875 #address-cells = <1>; 1067 #address-cells = <1>;
@@ -883,6 +1075,35 @@
883 }; 1075 };
884 }; 1076 };
885 1077
1078 gpio-keys {
1079 compatible = "gpio-keys";
1080
1081 home {
1082 label = "Home";
1083 gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
1084 linux,code = <102>; /* KEY_HOME */
1085 };
1086
1087 power {
1088 label = "Power";
1089 gpios = <&gpio TEGRA_GPIO(Q, 0) GPIO_ACTIVE_LOW>;
1090 linux,code = <116>; /* KEY_POWER */
1091 gpio-key,wakeup;
1092 };
1093
1094 volume_down {
1095 label = "Volume Down";
1096 gpios = <&gpio TEGRA_GPIO(R, 1) GPIO_ACTIVE_LOW>;
1097 linux,code = <114>; /* KEY_VOLUMEDOWN */
1098 };
1099
1100 volume_up {
1101 label = "Volume Up";
1102 gpios = <&gpio TEGRA_GPIO(R, 2) GPIO_ACTIVE_LOW>;
1103 linux,code = <115>; /* KEY_VOLUMEUP */
1104 };
1105 };
1106
886 regulators { 1107 regulators {
887 compatible = "simple-bus"; 1108 compatible = "simple-bus";
888 #address-cells = <1>; 1109 #address-cells = <1>;
@@ -951,6 +1172,16 @@
951 gpio = <&gpio TEGRA_GPIO(K, 1) GPIO_ACTIVE_HIGH>; 1172 gpio = <&gpio TEGRA_GPIO(K, 1) GPIO_ACTIVE_HIGH>;
952 vin-supply = <&tps65090_dcdc1_reg>; 1173 vin-supply = <&tps65090_dcdc1_reg>;
953 }; 1174 };
1175
1176 vdd_cam_1v8_reg: regulator@6 {
1177 compatible = "regulator-fixed";
1178 reg = <6>;
1179 regulator-name = "vdd_cam_1v8_reg";
1180 regulator-min-microvolt = <1800000>;
1181 regulator-max-microvolt = <1800000>;
1182 enable-active-high;
1183 gpio = <&palmas_gpio 6 0>;
1184 };
954 }; 1185 };
955 1186
956 sound { 1187 sound {
@@ -964,7 +1195,9 @@
964 "Speakers", "SPORP", 1195 "Speakers", "SPORP",
965 "Speakers", "SPORN", 1196 "Speakers", "SPORN",
966 "Speakers", "SPOLP", 1197 "Speakers", "SPOLP",
967 "Speakers", "SPOLN"; 1198 "Speakers", "SPOLN",
1199 "Mic Jack", "MICBIAS1",
1200 "IN2P", "Mic Jack";
968 1201
969 nvidia,i2s-controller = <&tegra_i2s1>; 1202 nvidia,i2s-controller = <&tegra_i2s1>;
970 nvidia,audio-codec = <&rt5640>; 1203 nvidia,audio-codec = <&rt5640>;
diff --git a/arch/arm/boot/dts/tegra114-pluto.dts b/arch/arm/boot/dts/tegra114-pluto.dts
deleted file mode 100644
index d5f8d3e0bde2..000000000000
--- a/arch/arm/boot/dts/tegra114-pluto.dts
+++ /dev/null
@@ -1,33 +0,0 @@
1/dts-v1/;
2
3#include "tegra114.dtsi"
4
5/ {
6 model = "NVIDIA Tegra114 Pluto evaluation board";
7 compatible = "nvidia,pluto", "nvidia,tegra114";
8
9 memory {
10 reg = <0x80000000 0x40000000>;
11 };
12
13 serial@70006300 {
14 status = "okay";
15 };
16
17 pmc {
18 nvidia,invert-interrupt;
19 };
20
21 clocks {
22 compatible = "simple-bus";
23 #address-cells = <1>;
24 #size-cells = <0>;
25
26 clk32k_in: clock {
27 compatible = "fixed-clock";
28 reg=<0>;
29 #clock-cells = <0>;
30 clock-frequency = <32768>;
31 };
32 };
33};
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi
index abf6c40d28c6..2905145d8e59 100644
--- a/arch/arm/boot/dts/tegra114.dtsi
+++ b/arch/arm/boot/dts/tegra114.dtsi
@@ -430,6 +430,68 @@
430 status = "disable"; 430 status = "disable";
431 }; 431 };
432 432
433 usb@7d000000 {
434 compatible = "nvidia,tegra30-ehci", "usb-ehci";
435 reg = <0x7d000000 0x4000>;
436 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
437 phy_type = "utmi";
438 clocks = <&tegra_car TEGRA114_CLK_USBD>;
439 nvidia,phy = <&phy1>;
440 status = "disabled";
441 };
442
443 phy1: usb-phy@7d000000 {
444 compatible = "nvidia,tegra30-usb-phy";
445 reg = <0x7d000000 0x4000 0x7d000000 0x4000>;
446 phy_type = "utmi";
447 clocks = <&tegra_car TEGRA114_CLK_USBD>,
448 <&tegra_car TEGRA114_CLK_PLL_U>,
449 <&tegra_car TEGRA114_CLK_USBD>;
450 clock-names = "reg", "pll_u", "utmi-pads";
451 nvidia,hssync-start-delay = <0>;
452 nvidia,idle-wait-delay = <17>;
453 nvidia,elastic-limit = <16>;
454 nvidia,term-range-adj = <6>;
455 nvidia,xcvr-setup = <9>;
456 nvidia,xcvr-lsfslew = <0>;
457 nvidia,xcvr-lsrslew = <3>;
458 nvidia,hssquelch-level = <2>;
459 nvidia,hsdiscon-level = <5>;
460 nvidia,xcvr-hsslew = <12>;
461 status = "disabled";
462 };
463
464 usb@7d008000 {
465 compatible = "nvidia,tegra30-ehci", "usb-ehci";
466 reg = <0x7d008000 0x4000>;
467 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
468 phy_type = "utmi";
469 clocks = <&tegra_car TEGRA114_CLK_USB3>;
470 nvidia,phy = <&phy3>;
471 status = "disabled";
472 };
473
474 phy3: usb-phy@7d008000 {
475 compatible = "nvidia,tegra30-usb-phy";
476 reg = <0x7d008000 0x4000 0x7d000000 0x4000>;
477 phy_type = "utmi";
478 clocks = <&tegra_car TEGRA114_CLK_USB3>,
479 <&tegra_car TEGRA114_CLK_PLL_U>,
480 <&tegra_car TEGRA114_CLK_USBD>;
481 clock-names = "reg", "pll_u", "utmi-pads";
482 nvidia,hssync-start-delay = <0>;
483 nvidia,idle-wait-delay = <17>;
484 nvidia,elastic-limit = <16>;
485 nvidia,term-range-adj = <6>;
486 nvidia,xcvr-setup = <9>;
487 nvidia,xcvr-lsfslew = <0>;
488 nvidia,xcvr-lsrslew = <3>;
489 nvidia,hssquelch-level = <2>;
490 nvidia,hsdiscon-level = <5>;
491 nvidia,xcvr-hsslew = <12>;
492 status = "disabled";
493 };
494
433 cpus { 495 cpus {
434 #address-cells = <1>; 496 #address-cells = <1>;
435 #size-cells = <0>; 497 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/tegra20-colibri-512.dtsi b/arch/arm/boot/dts/tegra20-colibri-512.dtsi
index 2fcb3f2ca160..d5c9bca01232 100644
--- a/arch/arm/boot/dts/tegra20-colibri-512.dtsi
+++ b/arch/arm/boot/dts/tegra20-colibri-512.dtsi
@@ -363,7 +363,7 @@
363 }; 363 };
364 364
365 pmc { 365 pmc {
366 nvidia,suspend-mode = <2>; 366 nvidia,suspend-mode = <1>;
367 nvidia,cpu-pwr-good-time = <5000>; 367 nvidia,cpu-pwr-good-time = <5000>;
368 nvidia,cpu-pwr-off-time = <5000>; 368 nvidia,cpu-pwr-off-time = <5000>;
369 nvidia,core-pwr-good-time = <3845 3845>; 369 nvidia,core-pwr-good-time = <3845 3845>;
@@ -457,6 +457,7 @@
457 }; 457 };
458 458
459 usb-phy@c5004000 { 459 usb-phy@c5004000 {
460 status = "okay";
460 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1) 461 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
461 GPIO_ACTIVE_LOW>; 462 GPIO_ACTIVE_LOW>;
462 }; 463 };
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts
index d9f89cd879a7..e156ab30e763 100644
--- a/arch/arm/boot/dts/tegra20-harmony.dts
+++ b/arch/arm/boot/dts/tegra20-harmony.dts
@@ -335,7 +335,7 @@
335 regulator-always-on; 335 regulator-always-on;
336 }; 336 };
337 337
338 ldo0 { 338 pci_clk_reg: ldo0 {
339 regulator-name = "vdd_ldo0,vddio_pex_clk"; 339 regulator-name = "vdd_ldo0,vddio_pex_clk";
340 regulator-min-microvolt = <3300000>; 340 regulator-min-microvolt = <3300000>;
341 regulator-max-microvolt = <3300000>; 341 regulator-max-microvolt = <3300000>;
@@ -417,7 +417,7 @@
417 417
418 pmc { 418 pmc {
419 nvidia,invert-interrupt; 419 nvidia,invert-interrupt;
420 nvidia,suspend-mode = <2>; 420 nvidia,suspend-mode = <1>;
421 nvidia,cpu-pwr-good-time = <5000>; 421 nvidia,cpu-pwr-good-time = <5000>;
422 nvidia,cpu-pwr-off-time = <5000>; 422 nvidia,cpu-pwr-off-time = <5000>;
423 nvidia,core-pwr-good-time = <3845 3845>; 423 nvidia,core-pwr-good-time = <3845 3845>;
@@ -425,6 +425,20 @@
425 nvidia,sys-clock-req-active-high; 425 nvidia,sys-clock-req-active-high;
426 }; 426 };
427 427
428 pcie-controller {
429 pex-clk-supply = <&pci_clk_reg>;
430 vdd-supply = <&pci_vdd_reg>;
431 status = "okay";
432
433 pci@1,0 {
434 status = "okay";
435 };
436
437 pci@2,0 {
438 status = "okay";
439 };
440 };
441
428 usb@c5000000 { 442 usb@c5000000 {
429 status = "okay"; 443 status = "okay";
430 }; 444 };
@@ -643,7 +657,7 @@
643 enable-active-high; 657 enable-active-high;
644 }; 658 };
645 659
646 regulator@3 { 660 pci_vdd_reg: regulator@3 {
647 compatible = "regulator-fixed"; 661 compatible = "regulator-fixed";
648 reg = <3>; 662 reg = <3>;
649 regulator-name = "vdd_1v05"; 663 regulator-name = "vdd_1v05";
@@ -651,8 +665,6 @@
651 regulator-max-microvolt = <1050000>; 665 regulator-max-microvolt = <1050000>;
652 gpio = <&pmic 2 GPIO_ACTIVE_HIGH>; 666 gpio = <&pmic 2 GPIO_ACTIVE_HIGH>;
653 enable-active-high; 667 enable-active-high;
654 /* Hack until board-harmony-pcie.c is removed */
655 status = "disabled";
656 }; 668 };
657 669
658 regulator@4 { 670 regulator@4 {
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts
index cfd12763b1b2..8d71fc9d8a2f 100644
--- a/arch/arm/boot/dts/tegra20-paz00.dts
+++ b/arch/arm/boot/dts/tegra20-paz00.dts
@@ -417,7 +417,7 @@
417 417
418 pmc { 418 pmc {
419 nvidia,invert-interrupt; 419 nvidia,invert-interrupt;
420 nvidia,suspend-mode = <2>; 420 nvidia,suspend-mode = <1>;
421 nvidia,cpu-pwr-good-time = <2000>; 421 nvidia,cpu-pwr-good-time = <2000>;
422 nvidia,cpu-pwr-off-time = <0>; 422 nvidia,cpu-pwr-off-time = <0>;
423 nvidia,core-pwr-good-time = <3845 3845>; 423 nvidia,core-pwr-good-time = <3845 3845>;
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index 365760b33a26..f44a9b8e23bf 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -518,7 +518,7 @@
518 518
519 pmc { 519 pmc {
520 nvidia,invert-interrupt; 520 nvidia,invert-interrupt;
521 nvidia,suspend-mode = <2>; 521 nvidia,suspend-mode = <1>;
522 nvidia,cpu-pwr-good-time = <5000>; 522 nvidia,cpu-pwr-good-time = <5000>;
523 nvidia,cpu-pwr-off-time = <5000>; 523 nvidia,cpu-pwr-off-time = <5000>;
524 nvidia,core-pwr-good-time = <3845 3845>; 524 nvidia,core-pwr-good-time = <3845 3845>;
@@ -829,7 +829,7 @@
829 regulator-min-microvolt = <5000000>; 829 regulator-min-microvolt = <5000000>;
830 regulator-max-microvolt = <5000000>; 830 regulator-max-microvolt = <5000000>;
831 enable-active-high; 831 enable-active-high;
832 gpio = <&gpio 24 0>; /* PD0 */ 832 gpio = <&gpio TEGRA_GPIO(D, 0) 0>;
833 }; 833 };
834 }; 834 };
835 835
diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi
index c54faae7cfb3..7726dab3d08d 100644
--- a/arch/arm/boot/dts/tegra20-tamonten.dtsi
+++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi
@@ -366,7 +366,7 @@
366 regulator-always-on; 366 regulator-always-on;
367 }; 367 };
368 368
369 ldo0 { 369 pci_clk_reg: ldo0 {
370 regulator-name = "vdd_ldo0,vddio_pex_clk"; 370 regulator-name = "vdd_ldo0,vddio_pex_clk";
371 regulator-min-microvolt = <3300000>; 371 regulator-min-microvolt = <3300000>;
372 regulator-max-microvolt = <3300000>; 372 regulator-max-microvolt = <3300000>;
@@ -459,7 +459,7 @@
459 459
460 pmc { 460 pmc {
461 nvidia,invert-interrupt; 461 nvidia,invert-interrupt;
462 nvidia,suspend-mode = <2>; 462 nvidia,suspend-mode = <1>;
463 nvidia,cpu-pwr-good-time = <5000>; 463 nvidia,cpu-pwr-good-time = <5000>;
464 nvidia,cpu-pwr-off-time = <5000>; 464 nvidia,cpu-pwr-off-time = <5000>;
465 nvidia,core-pwr-good-time = <3845 3845>; 465 nvidia,core-pwr-good-time = <3845 3845>;
@@ -467,6 +467,11 @@
467 nvidia,sys-clock-req-active-high; 467 nvidia,sys-clock-req-active-high;
468 }; 468 };
469 469
470 pcie-controller {
471 pex-clk-supply = <&pci_clk_reg>;
472 vdd-supply = <&pci_vdd_reg>;
473 };
474
470 usb@c5008000 { 475 usb@c5008000 {
471 status = "okay"; 476 status = "okay";
472 }; 477 };
@@ -509,5 +514,15 @@
509 regulator-max-microvolt = <5000000>; 514 regulator-max-microvolt = <5000000>;
510 regulator-always-on; 515 regulator-always-on;
511 }; 516 };
517
518 pci_vdd_reg: regulator@1 {
519 compatible = "regulator-fixed";
520 reg = <1>;
521 regulator-name = "vdd_1v05";
522 regulator-min-microvolt = <1050000>;
523 regulator-max-microvolt = <1050000>;
524 gpio = <&pmic 2 0>;
525 enable-active-high;
526 };
512 }; 527 };
513}; 528};
diff --git a/arch/arm/boot/dts/tegra20-tec.dts b/arch/arm/boot/dts/tegra20-tec.dts
index c572c43751b1..3ada3cb67f07 100644
--- a/arch/arm/boot/dts/tegra20-tec.dts
+++ b/arch/arm/boot/dts/tegra20-tec.dts
@@ -32,6 +32,14 @@
32 }; 32 };
33 }; 33 };
34 34
35 pcie-controller {
36 status = "okay";
37
38 pci@1,0 {
39 status = "okay";
40 };
41 };
42
35 sound { 43 sound {
36 compatible = "ad,tegra-audio-wm8903-tec", 44 compatible = "ad,tegra-audio-wm8903-tec",
37 "nvidia,tegra-audio-wm8903"; 45 "nvidia,tegra-audio-wm8903";
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts
index ed4b901b0227..22e227f87e4c 100644
--- a/arch/arm/boot/dts/tegra20-trimslice.dts
+++ b/arch/arm/boot/dts/tegra20-trimslice.dts
@@ -302,7 +302,7 @@
302 }; 302 };
303 303
304 pmc { 304 pmc {
305 nvidia,suspend-mode = <2>; 305 nvidia,suspend-mode = <1>;
306 nvidia,cpu-pwr-good-time = <5000>; 306 nvidia,cpu-pwr-good-time = <5000>;
307 nvidia,cpu-pwr-off-time = <5000>; 307 nvidia,cpu-pwr-off-time = <5000>;
308 nvidia,core-pwr-good-time = <3845 3845>; 308 nvidia,core-pwr-good-time = <3845 3845>;
@@ -310,6 +310,16 @@
310 nvidia,sys-clock-req-active-high; 310 nvidia,sys-clock-req-active-high;
311 }; 311 };
312 312
313 pcie-controller {
314 status = "okay";
315 pex-clk-supply = <&pci_clk_reg>;
316 vdd-supply = <&pci_vdd_reg>;
317
318 pci@1,0 {
319 status = "okay";
320 };
321 };
322
313 usb@c5000000 { 323 usb@c5000000 {
314 status = "okay"; 324 status = "okay";
315 nvidia,vbus-gpio = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>; 325 nvidia,vbus-gpio = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
@@ -411,7 +421,25 @@
411 regulator-min-microvolt = <5000000>; 421 regulator-min-microvolt = <5000000>;
412 regulator-max-microvolt = <5000000>; 422 regulator-max-microvolt = <5000000>;
413 enable-active-high; 423 enable-active-high;
414 gpio = <&gpio 170 0>; /* PV2 */ 424 gpio = <&gpio TEGRA_GPIO(V, 2) 0>;
425 };
426
427 pci_clk_reg: regulator@3 {
428 compatible = "regulator-fixed";
429 reg = <3>;
430 regulator-name = "pci_clk";
431 regulator-min-microvolt = <3300000>;
432 regulator-max-microvolt = <3300000>;
433 regulator-always-on;
434 };
435
436 pci_vdd_reg: regulator@4 {
437 compatible = "regulator-fixed";
438 reg = <4>;
439 regulator-name = "pci_vdd";
440 regulator-min-microvolt = <1050000>;
441 regulator-max-microvolt = <1050000>;
442 regulator-always-on;
415 }; 443 };
416 }; 444 };
417 445
diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts
index 7f8c28d1121f..aab872cd0530 100644
--- a/arch/arm/boot/dts/tegra20-ventana.dts
+++ b/arch/arm/boot/dts/tegra20-ventana.dts
@@ -494,7 +494,7 @@
494 494
495 pmc { 495 pmc {
496 nvidia,invert-interrupt; 496 nvidia,invert-interrupt;
497 nvidia,suspend-mode = <2>; 497 nvidia,suspend-mode = <1>;
498 nvidia,cpu-pwr-good-time = <2000>; 498 nvidia,cpu-pwr-good-time = <2000>;
499 nvidia,cpu-pwr-off-time = <100>; 499 nvidia,cpu-pwr-off-time = <100>;
500 nvidia,core-pwr-good-time = <3845 3845>; 500 nvidia,core-pwr-good-time = <3845 3845>;
diff --git a/arch/arm/boot/dts/tegra20-whistler.dts b/arch/arm/boot/dts/tegra20-whistler.dts
index ab67c94db280..3899cae2eacd 100644
--- a/arch/arm/boot/dts/tegra20-whistler.dts
+++ b/arch/arm/boot/dts/tegra20-whistler.dts
@@ -497,7 +497,7 @@
497 497
498 pmc { 498 pmc {
499 nvidia,invert-interrupt; 499 nvidia,invert-interrupt;
500 nvidia,suspend-mode = <2>; 500 nvidia,suspend-mode = <1>;
501 nvidia,cpu-pwr-good-time = <2000>; 501 nvidia,cpu-pwr-good-time = <2000>;
502 nvidia,cpu-pwr-off-time = <1000>; 502 nvidia,cpu-pwr-off-time = <1000>;
503 nvidia,core-pwr-good-time = <0 3845>; 503 nvidia,core-pwr-good-time = <0 3845>;
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 9653fd8288d2..3add9ac252d7 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -455,6 +455,61 @@
455 #size-cells = <0>; 455 #size-cells = <0>;
456 }; 456 };
457 457
458 pcie-controller {
459 compatible = "nvidia,tegra20-pcie";
460 device_type = "pci";
461 reg = <0x80003000 0x00000800 /* PADS registers */
462 0x80003800 0x00000200 /* AFI registers */
463 0x90000000 0x10000000>; /* configuration space */
464 reg-names = "pads", "afi", "cs";
465 interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH /* controller interrupt */
466 GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>; /* MSI interrupt */
467 interrupt-names = "intr", "msi";
468
469 bus-range = <0x00 0xff>;
470 #address-cells = <3>;
471 #size-cells = <2>;
472
473 ranges = <0x82000000 0 0x80000000 0x80000000 0 0x00001000 /* port 0 registers */
474 0x82000000 0 0x80001000 0x80001000 0 0x00001000 /* port 1 registers */
475 0x81000000 0 0 0x82000000 0 0x00010000 /* downstream I/O */
476 0x82000000 0 0xa0000000 0xa0000000 0 0x08000000 /* non-prefetchable memory */
477 0xc2000000 0 0xa8000000 0xa8000000 0 0x18000000>; /* prefetchable memory */
478
479 clocks = <&tegra_car TEGRA20_CLK_PEX>,
480 <&tegra_car TEGRA20_CLK_AFI>,
481 <&tegra_car TEGRA20_CLK_PCIE_XCLK>,
482 <&tegra_car TEGRA20_CLK_PLL_E>;
483 clock-names = "pex", "afi", "pcie_xclk", "pll_e";
484 status = "disabled";
485
486 pci@1,0 {
487 device_type = "pci";
488 assigned-addresses = <0x82000800 0 0x80000000 0 0x1000>;
489 reg = <0x000800 0 0 0 0>;
490 status = "disabled";
491
492 #address-cells = <3>;
493 #size-cells = <2>;
494 ranges;
495
496 nvidia,num-lanes = <2>;
497 };
498
499 pci@2,0 {
500 device_type = "pci";
501 assigned-addresses = <0x82001000 0 0x80001000 0 0x1000>;
502 reg = <0x001000 0 0 0 0>;
503 status = "disabled";
504
505 #address-cells = <3>;
506 #size-cells = <2>;
507 ranges;
508
509 nvidia,num-lanes = <2>;
510 };
511 };
512
458 usb@c5000000 { 513 usb@c5000000 {
459 compatible = "nvidia,tegra20-ehci", "usb-ehci"; 514 compatible = "nvidia,tegra20-ehci", "usb-ehci";
460 reg = <0xc5000000 0x4000>; 515 reg = <0xc5000000 0x4000>;
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts
index 87c5f7b7c271..08cad696e89f 100644
--- a/arch/arm/boot/dts/tegra30-beaver.dts
+++ b/arch/arm/boot/dts/tegra30-beaver.dts
@@ -10,6 +10,40 @@
10 reg = <0x80000000 0x7ff00000>; 10 reg = <0x80000000 0x7ff00000>;
11 }; 11 };
12 12
13 pcie-controller {
14 status = "okay";
15 pex-clk-supply = <&sys_3v3_pexs_reg>;
16 vdd-supply = <&ldo1_reg>;
17 avdd-supply = <&ldo2_reg>;
18
19 pci@1,0 {
20 status = "okay";
21 nvidia,num-lanes = <2>;
22 };
23
24 pci@2,0 {
25 nvidia,num-lanes = <2>;
26 };
27
28 pci@3,0 {
29 status = "okay";
30 nvidia,num-lanes = <2>;
31 };
32 };
33
34 host1x {
35 hdmi {
36 status = "okay";
37
38 vdd-supply = <&sys_3v3_reg>;
39 pll-supply = <&vio_reg>;
40
41 nvidia,hpd-gpio =
42 <&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;
43 nvidia,ddc-i2c-bus = <&hdmiddc>;
44 };
45 };
46
13 pinmux { 47 pinmux {
14 pinctrl-names = "default"; 48 pinctrl-names = "default";
15 pinctrl-0 = <&state_default>; 49 pinctrl-0 = <&state_default>;
@@ -76,6 +110,11 @@
76 nvidia,pull = <0>; 110 nvidia,pull = <0>;
77 nvidia,tristate = <0>; 111 nvidia,tristate = <0>;
78 }; 112 };
113 pex_l1_prsnt_n_pdd4 {
114 nvidia,pins = "pex_l1_prsnt_n_pdd4",
115 "pex_l1_clkreq_n_pdd6";
116 nvidia,pull = <2>;
117 };
79 sdio3 { 118 sdio3 {
80 nvidia,pins = "drive_sdio3"; 119 nvidia,pins = "drive_sdio3";
81 nvidia,high-speed-mode = <0>; 120 nvidia,high-speed-mode = <0>;
@@ -85,6 +124,10 @@
85 nvidia,slew-rate-rising = <1>; 124 nvidia,slew-rate-rising = <1>;
86 nvidia,slew-rate-falling = <1>; 125 nvidia,slew-rate-falling = <1>;
87 }; 126 };
127 gpv {
128 nvidia,pins = "drive_gpv";
129 nvidia,pull-up-strength = <16>;
130 };
88 }; 131 };
89 }; 132 };
90 133
@@ -107,7 +150,7 @@
107 clock-frequency = <100000>; 150 clock-frequency = <100000>;
108 }; 151 };
109 152
110 i2c@7000c700 { 153 hdmiddc: i2c@7000c700 {
111 status = "okay"; 154 status = "okay";
112 clock-frequency = <100000>; 155 clock-frequency = <100000>;
113 }; 156 };
@@ -262,7 +305,7 @@
262 pmc { 305 pmc {
263 status = "okay"; 306 status = "okay";
264 nvidia,invert-interrupt; 307 nvidia,invert-interrupt;
265 nvidia,suspend-mode = <2>; 308 nvidia,suspend-mode = <1>;
266 nvidia,cpu-pwr-good-time = <2000>; 309 nvidia,cpu-pwr-good-time = <2000>;
267 nvidia,cpu-pwr-off-time = <200>; 310 nvidia,cpu-pwr-off-time = <200>;
268 nvidia,core-pwr-good-time = <3845 3845>; 311 nvidia,core-pwr-good-time = <3845 3845>;
@@ -285,6 +328,15 @@
285 non-removable; 328 non-removable;
286 }; 329 };
287 330
331 usb@7d008000 {
332 status = "okay";
333 };
334
335 usb-phy@7d008000 {
336 vbus-supply = <&usb3_vbus_reg>;
337 status = "okay";
338 };
339
288 clocks { 340 clocks {
289 compatible = "simple-bus"; 341 compatible = "simple-bus";
290 #address-cells = <1>; 342 #address-cells = <1>;
@@ -357,7 +409,7 @@
357 regulator-min-microvolt = <5000000>; 409 regulator-min-microvolt = <5000000>;
358 regulator-max-microvolt = <5000000>; 410 regulator-max-microvolt = <5000000>;
359 enable-active-high; 411 enable-active-high;
360 gpio = <&gpio TEGRA_GPIO(I, 4) GPIO_ACTIVE_HIGH>; 412 gpio = <&gpio TEGRA_GPIO(DD, 6) GPIO_ACTIVE_HIGH>;
361 gpio-open-drain; 413 gpio-open-drain;
362 vin-supply = <&vdd_5v_in_reg>; 414 vin-supply = <&vdd_5v_in_reg>;
363 }; 415 };
@@ -369,7 +421,7 @@
369 regulator-min-microvolt = <5000000>; 421 regulator-min-microvolt = <5000000>;
370 regulator-max-microvolt = <5000000>; 422 regulator-max-microvolt = <5000000>;
371 enable-active-high; 423 enable-active-high;
372 gpio = <&gpio TEGRA_GPIO(H, 7) GPIO_ACTIVE_HIGH>; 424 gpio = <&gpio TEGRA_GPIO(DD, 4) GPIO_ACTIVE_HIGH>;
373 gpio-open-drain; 425 gpio-open-drain;
374 vin-supply = <&vdd_5v_in_reg>; 426 vin-supply = <&vdd_5v_in_reg>;
375 }; 427 };
@@ -421,7 +473,9 @@
421 473
422 nvidia,audio-routing = 474 nvidia,audio-routing =
423 "Headphones", "HPOR", 475 "Headphones", "HPOR",
424 "Headphones", "HPOL"; 476 "Headphones", "HPOL",
477 "Mic Jack", "MICBIAS1",
478 "IN2P", "Mic Jack";
425 479
426 nvidia,i2s-controller = <&tegra_i2s1>; 480 nvidia,i2s-controller = <&tegra_i2s1>;
427 nvidia,audio-codec = <&rt5640>; 481 nvidia,audio-codec = <&rt5640>;
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi
index f65b53d32416..e19dbf238e5c 100644
--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi
+++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi
@@ -31,6 +31,26 @@
31 reg = <0x80000000 0x40000000>; 31 reg = <0x80000000 0x40000000>;
32 }; 32 };
33 33
34 pcie-controller {
35 status = "okay";
36 pex-clk-supply = <&pex_hvdd_3v3_reg>;
37 vdd-supply = <&ldo1_reg>;
38 avdd-supply = <&ldo2_reg>;
39
40 pci@1,0 {
41 nvidia,num-lanes = <4>;
42 };
43
44 pci@2,0 {
45 nvidia,num-lanes = <1>;
46 };
47
48 pci@3,0 {
49 status = "okay";
50 nvidia,num-lanes = <1>;
51 };
52 };
53
34 pinmux { 54 pinmux {
35 pinctrl-names = "default"; 55 pinctrl-names = "default";
36 pinctrl-0 = <&state_default>; 56 pinctrl-0 = <&state_default>;
@@ -173,19 +193,6 @@
173 gpio-cfg = <0xffffffff 0xffffffff 0 0xffffffff 0xffffffff>; 193 gpio-cfg = <0xffffffff 0xffffffff 0 0xffffffff 0xffffffff>;
174 }; 194 };
175 195
176 tps62361 {
177 compatible = "ti,tps62361";
178 reg = <0x60>;
179
180 regulator-name = "tps62361-vout";
181 regulator-min-microvolt = <500000>;
182 regulator-max-microvolt = <1500000>;
183 regulator-boot-on;
184 regulator-always-on;
185 ti,vsel0-state-high;
186 ti,vsel1-state-high;
187 };
188
189 pmic: tps65911@2d { 196 pmic: tps65911@2d {
190 compatible = "ti,tps65911"; 197 compatible = "ti,tps65911";
191 reg = <0x2d>; 198 reg = <0x2d>;
@@ -286,6 +293,26 @@
286 }; 293 };
287 }; 294 };
288 }; 295 };
296
297 nct1008 {
298 compatible = "onnn,nct1008";
299 reg = <0x4c>;
300 interrupt-parent = <&gpio>;
301 interrupts = <TEGRA_GPIO(CC, 2) IRQ_TYPE_LEVEL_LOW>;
302 };
303
304 tps62361 {
305 compatible = "ti,tps62361";
306 reg = <0x60>;
307
308 regulator-name = "tps62361-vout";
309 regulator-min-microvolt = <500000>;
310 regulator-max-microvolt = <1500000>;
311 regulator-boot-on;
312 regulator-always-on;
313 ti,vsel0-state-high;
314 ti,vsel1-state-high;
315 };
289 }; 316 };
290 317
291 spi@7000da00 { 318 spi@7000da00 {
@@ -307,7 +334,7 @@
307 pmc { 334 pmc {
308 status = "okay"; 335 status = "okay";
309 nvidia,invert-interrupt; 336 nvidia,invert-interrupt;
310 nvidia,suspend-mode = <2>; 337 nvidia,suspend-mode = <1>;
311 nvidia,cpu-pwr-good-time = <2000>; 338 nvidia,cpu-pwr-good-time = <2000>;
312 nvidia,cpu-pwr-off-time = <200>; 339 nvidia,cpu-pwr-off-time = <200>;
313 nvidia,core-pwr-good-time = <3845 3845>; 340 nvidia,core-pwr-good-time = <3845 3845>;
@@ -330,6 +357,15 @@
330 non-removable; 357 non-removable;
331 }; 358 };
332 359
360 usb@7d008000 {
361 status = "okay";
362 };
363
364 usb-phy@7d008000 {
365 vbus-supply = <&usb3_vbus_reg>;
366 status = "okay";
367 };
368
333 clocks { 369 clocks {
334 compatible = "simple-bus"; 370 compatible = "simple-bus";
335 #address-cells = <1>; 371 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index d8783f0fae63..0022c127e1d9 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -16,6 +16,76 @@
16 serial4 = &uarte; 16 serial4 = &uarte;
17 }; 17 };
18 18
19 pcie-controller {
20 compatible = "nvidia,tegra30-pcie";
21 device_type = "pci";
22 reg = <0x00003000 0x00000800 /* PADS registers */
23 0x00003800 0x00000200 /* AFI registers */
24 0x10000000 0x10000000>; /* configuration space */
25 reg-names = "pads", "afi", "cs";
26 interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH /* controller interrupt */
27 GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>; /* MSI interrupt */
28 interrupt-names = "intr", "msi";
29
30 bus-range = <0x00 0xff>;
31 #address-cells = <3>;
32 #size-cells = <2>;
33
34 ranges = <0x82000000 0 0x00000000 0x00000000 0 0x00001000 /* port 0 configuration space */
35 0x82000000 0 0x00001000 0x00001000 0 0x00001000 /* port 1 configuration space */
36 0x82000000 0 0x00004000 0x00004000 0 0x00001000 /* port 2 configuration space */
37 0x81000000 0 0 0x02000000 0 0x00010000 /* downstream I/O */
38 0x82000000 0 0x20000000 0x20000000 0 0x08000000 /* non-prefetchable memory */
39 0xc2000000 0 0x28000000 0x28000000 0 0x18000000>; /* prefetchable memory */
40
41 clocks = <&tegra_car TEGRA30_CLK_PCIE>,
42 <&tegra_car TEGRA30_CLK_AFI>,
43 <&tegra_car TEGRA30_CLK_PCIEX>,
44 <&tegra_car TEGRA30_CLK_PLL_E>,
45 <&tegra_car TEGRA30_CLK_CML0>;
46 clock-names = "pex", "afi", "pcie_xclk", "pll_e", "cml";
47 status = "disabled";
48
49 pci@1,0 {
50 device_type = "pci";
51 assigned-addresses = <0x82000800 0 0x00000000 0 0x1000>;
52 reg = <0x000800 0 0 0 0>;
53 status = "disabled";
54
55 #address-cells = <3>;
56 #size-cells = <2>;
57 ranges;
58
59 nvidia,num-lanes = <2>;
60 };
61
62 pci@2,0 {
63 device_type = "pci";
64 assigned-addresses = <0x82001000 0 0x00001000 0 0x1000>;
65 reg = <0x001000 0 0 0 0>;
66 status = "disabled";
67
68 #address-cells = <3>;
69 #size-cells = <2>;
70 ranges;
71
72 nvidia,num-lanes = <2>;
73 };
74
75 pci@3,0 {
76 device_type = "pci";
77 assigned-addresses = <0x82001800 0 0x00004000 0 0x1000>;
78 reg = <0x001800 0 0 0 0>;
79 status = "disabled";
80
81 #address-cells = <3>;
82 #size-cells = <2>;
83 ranges;
84
85 nvidia,num-lanes = <2>;
86 };
87 };
88
19 host1x { 89 host1x {
20 compatible = "nvidia,tegra30-host1x", "simple-bus"; 90 compatible = "nvidia,tegra30-host1x", "simple-bus";
21 reg = <0x50000000 0x00024000>; 91 reg = <0x50000000 0x00024000>;
@@ -561,6 +631,92 @@
561 status = "disabled"; 631 status = "disabled";
562 }; 632 };
563 633
634 usb@7d000000 {
635 compatible = "nvidia,tegra30-ehci", "usb-ehci";
636 reg = <0x7d000000 0x4000>;
637 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
638 phy_type = "utmi";
639 clocks = <&tegra_car TEGRA30_CLK_USBD>;
640 nvidia,needs-double-reset;
641 nvidia,phy = <&phy1>;
642 status = "disabled";
643 };
644
645 phy1: usb-phy@7d000000 {
646 compatible = "nvidia,tegra30-usb-phy";
647 reg = <0x7d000000 0x4000 0x7d000000 0x4000>;
648 phy_type = "utmi";
649 clocks = <&tegra_car TEGRA30_CLK_USBD>,
650 <&tegra_car TEGRA30_CLK_PLL_U>,
651 <&tegra_car TEGRA30_CLK_USBD>;
652 clock-names = "reg", "pll_u", "utmi-pads";
653 nvidia,hssync-start-delay = <9>;
654 nvidia,idle-wait-delay = <17>;
655 nvidia,elastic-limit = <16>;
656 nvidia,term-range-adj = <6>;
657 nvidia,xcvr-setup = <51>;
658 nvidia.xcvr-setup-use-fuses;
659 nvidia,xcvr-lsfslew = <1>;
660 nvidia,xcvr-lsrslew = <1>;
661 nvidia,xcvr-hsslew = <32>;
662 nvidia,hssquelch-level = <2>;
663 nvidia,hsdiscon-level = <5>;
664 status = "disabled";
665 };
666
667 usb@7d004000 {
668 compatible = "nvidia,tegra30-ehci", "usb-ehci";
669 reg = <0x7d004000 0x4000>;
670 interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
671 phy_type = "ulpi";
672 clocks = <&tegra_car TEGRA30_CLK_USB2>;
673 nvidia,phy = <&phy2>;
674 status = "disabled";
675 };
676
677 phy2: usb-phy@7d004000 {
678 compatible = "nvidia,tegra30-usb-phy";
679 reg = <0x7d004000 0x4000>;
680 phy_type = "ulpi";
681 clocks = <&tegra_car TEGRA30_CLK_USB2>,
682 <&tegra_car TEGRA30_CLK_PLL_U>,
683 <&tegra_car TEGRA30_CLK_CDEV2>;
684 clock-names = "reg", "pll_u", "ulpi-link";
685 status = "disabled";
686 };
687
688 usb@7d008000 {
689 compatible = "nvidia,tegra30-ehci", "usb-ehci";
690 reg = <0x7d008000 0x4000>;
691 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
692 phy_type = "utmi";
693 clocks = <&tegra_car TEGRA30_CLK_USB3>;
694 nvidia,phy = <&phy3>;
695 status = "disabled";
696 };
697
698 phy3: usb-phy@7d008000 {
699 compatible = "nvidia,tegra30-usb-phy";
700 reg = <0x7d008000 0x4000 0x7d000000 0x4000>;
701 phy_type = "utmi";
702 clocks = <&tegra_car TEGRA30_CLK_USB3>,
703 <&tegra_car TEGRA30_CLK_PLL_U>,
704 <&tegra_car TEGRA30_CLK_USBD>;
705 clock-names = "reg", "pll_u", "utmi-pads";
706 nvidia,hssync-start-delay = <0>;
707 nvidia,idle-wait-delay = <17>;
708 nvidia,elastic-limit = <16>;
709 nvidia,term-range-adj = <6>;
710 nvidia,xcvr-setup = <51>;
711 nvidia.xcvr-setup-use-fuses;
712 nvidia,xcvr-lsfslew = <2>;
713 nvidia,xcvr-lsrslew = <2>;
714 nvidia,xcvr-hsslew = <32>;
715 nvidia,hssquelch-level = <2>;
716 nvidia,hsdiscon-level = <5>;
717 status = "disabled";
718 };
719
564 cpus { 720 cpus {
565 #address-cells = <1>; 721 #address-cells = <1>;
566 #size-cells = <0>; 722 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/u9540.dts b/arch/arm/boot/dts/u9540.dts
deleted file mode 100644
index 95892ec6c342..000000000000
--- a/arch/arm/boot/dts/u9540.dts
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * Copyright 2012 ST-Ericsson AB
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "dbx5x0.dtsi"
14
15/ {
16 model = "ST-Ericsson U9540 platform with Device Tree";
17 compatible = "st-ericsson,u9540";
18
19 memory {
20 reg = <0x00000000 0x20000000>;
21 };
22
23 soc-u9500 {
24 uart@80120000 {
25 status = "okay";
26 };
27
28 uart@80121000 {
29 status = "okay";
30 };
31
32 uart@80007000 {
33 status = "okay";
34 };
35
36 // External Micro SD slot
37 sdi0_per1@80126000 {
38 arm,primecell-periphid = <0x10480180>;
39 max-frequency = <100000000>;
40 bus-width = <4>;
41 mmc-cap-sd-highspeed;
42 mmc-cap-mmc-highspeed;
43 vmmc-supply = <&ab8500_ldo_aux3_reg>;
44
45 cd-gpios = <&gpio7 6 0x4>; // 230
46 cd-inverted;
47
48 status = "okay";
49 };
50
51
52 // WLAN SDIO channel
53 sdi1_per2@80118000 {
54 arm,primecell-periphid = <0x10480180>;
55 max-frequency = <50000000>;
56 bus-width = <4>;
57
58 status = "okay";
59 };
60
61 // On-board eMMC
62 sdi4_per2@80114000 {
63 arm,primecell-periphid = <0x10480180>;
64 max-frequency = <100000000>;
65 bus-width = <8>;
66 mmc-cap-mmc-highspeed;
67 vmmc-supply = <&ab8500_ldo_aux2_reg>;
68
69 status = "okay";
70 };
71 };
72};
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index 6f54a64850eb..e32b92b949d2 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -41,8 +41,8 @@
41 L2: cache-controller { 41 L2: cache-controller {
42 compatible = "arm,pl310-cache"; 42 compatible = "arm,pl310-cache";
43 reg = <0xF8F02000 0x1000>; 43 reg = <0xF8F02000 0x1000>;
44 arm,data-latency = <2 3 2>; 44 arm,data-latency = <3 2 2>;
45 arm,tag-latency = <2 3 2>; 45 arm,tag-latency = <2 2 2>;
46 cache-unified; 46 cache-unified;
47 cache-level = <2>; 47 cache-level = <2>;
48 }; 48 };
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 614e41e7881b..905efc8cac79 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -121,8 +121,7 @@ config MSM_SMD
121 bool 121 bool
122 122
123config MSM_GPIOMUX 123config MSM_GPIOMUX
124 depends on !(ARCH_MSM8X60 || ARCH_MSM8960) 124 bool
125 bool "MSM V1 TLMM GPIOMUX architecture"
126 help 125 help
127 Support for MSM V1 TLMM GPIOMUX architecture. 126 Support for MSM V1 TLMM GPIOMUX architecture.
128 127
diff --git a/arch/arm/mach-msm/gpiomux-v1.c b/arch/arm/mach-msm/gpiomux-v1.c
deleted file mode 100644
index 27de2abd7144..000000000000
--- a/arch/arm/mach-msm/gpiomux-v1.c
+++ /dev/null
@@ -1,33 +0,0 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#include <linux/kernel.h>
18#include "gpiomux.h"
19#include "proc_comm.h"
20
21void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val)
22{
23 unsigned tlmm_config = (val & ~GPIOMUX_CTL_MASK) |
24 ((gpio & 0x3ff) << 4);
25 unsigned tlmm_disable = 0;
26 int rc;
27
28 rc = msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX,
29 &tlmm_config, &tlmm_disable);
30 if (rc)
31 pr_err("%s: unexpected proc_comm failure %d: %08x %08x\n",
32 __func__, rc, tlmm_config, tlmm_disable);
33}
diff --git a/arch/arm/mach-msm/gpiomux.h b/arch/arm/mach-msm/gpiomux.h
index 8e82f41a8923..4410d7766f93 100644
--- a/arch/arm/mach-msm/gpiomux.h
+++ b/arch/arm/mach-msm/gpiomux.h
@@ -73,16 +73,6 @@ extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS];
73int msm_gpiomux_write(unsigned gpio, 73int msm_gpiomux_write(unsigned gpio,
74 gpiomux_config_t active, 74 gpiomux_config_t active,
75 gpiomux_config_t suspended); 75 gpiomux_config_t suspended);
76
77/* Architecture-internal function for use by the framework only.
78 * This function can assume the following:
79 * - the gpio value has passed a bounds-check
80 * - the gpiomux spinlock has been obtained
81 *
82 * This function is not for public consumption. External users
83 * should use msm_gpiomux_write.
84 */
85void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val);
86#else 76#else
87static inline int msm_gpiomux_write(unsigned gpio, 77static inline int msm_gpiomux_write(unsigned gpio,
88 gpiomux_config_t active, 78 gpiomux_config_t active,
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
index 5981c3db9b41..4d42da49753c 100644
--- a/arch/arm/mach-nomadik/Kconfig
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -27,6 +27,7 @@ config MACH_NOMADIK_8815NHK
27 select NOMADIK_8815 27 select NOMADIK_8815
28 select I2C 28 select I2C
29 select I2C_ALGOBIT 29 select I2C_ALGOBIT
30 select I2C_NOMADIK
30 31
31endmenu 32endmenu
32endif 33endif
diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c
index 393aeefaebb0..043e5705f2a6 100644
--- a/arch/arm/mach-omap2/dss-common.c
+++ b/arch/arm/mach-omap2/dss-common.c
@@ -42,7 +42,7 @@
42 42
43/* Using generic display panel */ 43/* Using generic display panel */
44static struct tfp410_platform_data omap4_dvi_panel = { 44static struct tfp410_platform_data omap4_dvi_panel = {
45 .i2c_bus_num = 3, 45 .i2c_bus_num = 2,
46 .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, 46 .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
47}; 47};
48 48
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index 5cc92874be7e..f99f68e1e85b 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -129,6 +129,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
129 struct device_node *node = pdev->dev.of_node; 129 struct device_node *node = pdev->dev.of_node;
130 const char *oh_name; 130 const char *oh_name;
131 int oh_cnt, i, ret = 0; 131 int oh_cnt, i, ret = 0;
132 bool device_active = false;
132 133
133 oh_cnt = of_property_count_strings(node, "ti,hwmods"); 134 oh_cnt = of_property_count_strings(node, "ti,hwmods");
134 if (oh_cnt <= 0) { 135 if (oh_cnt <= 0) {
@@ -152,6 +153,8 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
152 goto odbfd_exit1; 153 goto odbfd_exit1;
153 } 154 }
154 hwmods[i] = oh; 155 hwmods[i] = oh;
156 if (oh->flags & HWMOD_INIT_NO_IDLE)
157 device_active = true;
155 } 158 }
156 159
157 od = omap_device_alloc(pdev, hwmods, oh_cnt); 160 od = omap_device_alloc(pdev, hwmods, oh_cnt);
@@ -172,6 +175,11 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
172 175
173 pdev->dev.pm_domain = &omap_device_pm_domain; 176 pdev->dev.pm_domain = &omap_device_pm_domain;
174 177
178 if (device_active) {
179 omap_device_enable(pdev);
180 pm_runtime_set_active(&pdev->dev);
181 }
182
175odbfd_exit1: 183odbfd_exit1:
176 kfree(hwmods); 184 kfree(hwmods);
177odbfd_exit: 185odbfd_exit:
@@ -842,6 +850,7 @@ static int __init omap_device_late_idle(struct device *dev, void *data)
842{ 850{
843 struct platform_device *pdev = to_platform_device(dev); 851 struct platform_device *pdev = to_platform_device(dev);
844 struct omap_device *od = to_omap_device(pdev); 852 struct omap_device *od = to_omap_device(pdev);
853 int i;
845 854
846 if (!od) 855 if (!od)
847 return 0; 856 return 0;
@@ -850,6 +859,15 @@ static int __init omap_device_late_idle(struct device *dev, void *data)
850 * If omap_device state is enabled, but has no driver bound, 859 * If omap_device state is enabled, but has no driver bound,
851 * idle it. 860 * idle it.
852 */ 861 */
862
863 /*
864 * Some devices (like memory controllers) are always kept
865 * enabled, and should not be idled even with no drivers.
866 */
867 for (i = 0; i < od->hwmods_cnt; i++)
868 if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE)
869 return 0;
870
853 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) { 871 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) {
854 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { 872 if (od->_state == OMAP_DEVICE_STATE_ENABLED) {
855 dev_warn(dev, "%s: enabled but no driver. Idling\n", 873 dev_warn(dev, "%s: enabled but no driver. Idling\n",
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 7341eff63f56..7f4db12b1459 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2386,7 +2386,7 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
2386 2386
2387 np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); 2387 np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh);
2388 if (np) 2388 if (np)
2389 va_start = of_iomap(np, 0); 2389 va_start = of_iomap(np, oh->mpu_rt_idx);
2390 } else { 2390 } else {
2391 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); 2391 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
2392 } 2392 }
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index aab33fd814c0..e1482a9b3bc2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -95,6 +95,54 @@ extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type3;
95#define MODULEMODE_HWCTRL 1 95#define MODULEMODE_HWCTRL 1
96#define MODULEMODE_SWCTRL 2 96#define MODULEMODE_SWCTRL 2
97 97
98#define DEBUG_OMAP2UART1_FLAGS 0
99#define DEBUG_OMAP2UART2_FLAGS 0
100#define DEBUG_OMAP2UART3_FLAGS 0
101#define DEBUG_OMAP3UART3_FLAGS 0
102#define DEBUG_OMAP3UART4_FLAGS 0
103#define DEBUG_OMAP4UART3_FLAGS 0
104#define DEBUG_OMAP4UART4_FLAGS 0
105#define DEBUG_TI81XXUART1_FLAGS 0
106#define DEBUG_TI81XXUART2_FLAGS 0
107#define DEBUG_TI81XXUART3_FLAGS 0
108#define DEBUG_AM33XXUART1_FLAGS 0
109
110#define DEBUG_OMAPUART_FLAGS (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET)
111
112#if defined(CONFIG_DEBUG_OMAP2UART1)
113#undef DEBUG_OMAP2UART1_FLAGS
114#define DEBUG_OMAP2UART1_FLAGS DEBUG_OMAPUART_FLAGS
115#elif defined(CONFIG_DEBUG_OMAP2UART2)
116#undef DEBUG_OMAP2UART2_FLAGS
117#define DEBUG_OMAP2UART2_FLAGS DEBUG_OMAPUART_FLAGS
118#elif defined(CONFIG_DEBUG_OMAP2UART3)
119#undef DEBUG_OMAP2UART3_FLAGS
120#define DEBUG_OMAP2UART3_FLAGS DEBUG_OMAPUART_FLAGS
121#elif defined(CONFIG_DEBUG_OMAP3UART3)
122#undef DEBUG_OMAP3UART3_FLAGS
123#define DEBUG_OMAP3UART3_FLAGS DEBUG_OMAPUART_FLAGS
124#elif defined(CONFIG_DEBUG_OMAP3UART4)
125#undef DEBUG_OMAP3UART4_FLAGS
126#define DEBUG_OMAP3UART4_FLAGS DEBUG_OMAPUART_FLAGS
127#elif defined(CONFIG_DEBUG_OMAP4UART3)
128#undef DEBUG_OMAP4UART3_FLAGS
129#define DEBUG_OMAP4UART3_FLAGS DEBUG_OMAPUART_FLAGS
130#elif defined(CONFIG_DEBUG_OMAP4UART4)
131#undef DEBUG_OMAP4UART4_FLAGS
132#define DEBUG_OMAP4UART4_FLAGS DEBUG_OMAPUART_FLAGS
133#elif defined(CONFIG_DEBUG_TI81XXUART1)
134#undef DEBUG_TI81XXUART1_FLAGS
135#define DEBUG_TI81XXUART1_FLAGS DEBUG_OMAPUART_FLAGS
136#elif defined(CONFIG_DEBUG_TI81XXUART2)
137#undef DEBUG_TI81XXUART2_FLAGS
138#define DEBUG_TI81XXUART2_FLAGS DEBUG_OMAPUART_FLAGS
139#elif defined(CONFIG_DEBUG_TI81XXUART3)
140#undef DEBUG_TI81XXUART3_FLAGS
141#define DEBUG_TI81XXUART3_FLAGS DEBUG_OMAPUART_FLAGS
142#elif defined(CONFIG_DEBUG_AM33XXUART1)
143#undef DEBUG_AM33XXUART1_FLAGS
144#define DEBUG_AM33XXUART1_FLAGS DEBUG_OMAPUART_FLAGS
145#endif
98 146
99/** 147/**
100 * struct omap_hwmod_mux_info - hwmod specific mux configuration 148 * struct omap_hwmod_mux_info - hwmod specific mux configuration
@@ -568,6 +616,7 @@ struct omap_hwmod_link {
568 * @voltdm: pointer to voltage domain (filled in at runtime) 616 * @voltdm: pointer to voltage domain (filled in at runtime)
569 * @dev_attr: arbitrary device attributes that can be passed to the driver 617 * @dev_attr: arbitrary device attributes that can be passed to the driver
570 * @_sysc_cache: internal-use hwmod flags 618 * @_sysc_cache: internal-use hwmod flags
619 * @mpu_rt_idx: index of device address space for register target (for DT boot)
571 * @_mpu_rt_va: cached register target start address (internal use) 620 * @_mpu_rt_va: cached register target start address (internal use)
572 * @_mpu_port: cached MPU register target slave (internal use) 621 * @_mpu_port: cached MPU register target slave (internal use)
573 * @opt_clks_cnt: number of @opt_clks 622 * @opt_clks_cnt: number of @opt_clks
@@ -617,6 +666,7 @@ struct omap_hwmod {
617 struct list_head node; 666 struct list_head node;
618 struct omap_hwmod_ocp_if *_mpu_port; 667 struct omap_hwmod_ocp_if *_mpu_port;
619 u16 flags; 668 u16 flags;
669 u8 mpu_rt_idx;
620 u8 response_lat; 670 u8 response_lat;
621 u8 rst_lines_cnt; 671 u8 rst_lines_cnt;
622 u8 opt_clks_cnt; 672 u8 opt_clks_cnt;
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index d05fc7b54567..56cebb05509e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -512,7 +512,7 @@ struct omap_hwmod omap2xxx_uart1_hwmod = {
512 .mpu_irqs = omap2_uart1_mpu_irqs, 512 .mpu_irqs = omap2_uart1_mpu_irqs,
513 .sdma_reqs = omap2_uart1_sdma_reqs, 513 .sdma_reqs = omap2_uart1_sdma_reqs,
514 .main_clk = "uart1_fck", 514 .main_clk = "uart1_fck",
515 .flags = HWMOD_SWSUP_SIDLE_ACT, 515 .flags = DEBUG_OMAP2UART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
516 .prcm = { 516 .prcm = {
517 .omap2 = { 517 .omap2 = {
518 .module_offs = CORE_MOD, 518 .module_offs = CORE_MOD,
@@ -532,7 +532,7 @@ struct omap_hwmod omap2xxx_uart2_hwmod = {
532 .mpu_irqs = omap2_uart2_mpu_irqs, 532 .mpu_irqs = omap2_uart2_mpu_irqs,
533 .sdma_reqs = omap2_uart2_sdma_reqs, 533 .sdma_reqs = omap2_uart2_sdma_reqs,
534 .main_clk = "uart2_fck", 534 .main_clk = "uart2_fck",
535 .flags = HWMOD_SWSUP_SIDLE_ACT, 535 .flags = DEBUG_OMAP2UART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
536 .prcm = { 536 .prcm = {
537 .omap2 = { 537 .omap2 = {
538 .module_offs = CORE_MOD, 538 .module_offs = CORE_MOD,
@@ -552,7 +552,7 @@ struct omap_hwmod omap2xxx_uart3_hwmod = {
552 .mpu_irqs = omap2_uart3_mpu_irqs, 552 .mpu_irqs = omap2_uart3_mpu_irqs,
553 .sdma_reqs = omap2_uart3_sdma_reqs, 553 .sdma_reqs = omap2_uart3_sdma_reqs,
554 .main_clk = "uart3_fck", 554 .main_clk = "uart3_fck",
555 .flags = HWMOD_SWSUP_SIDLE_ACT, 555 .flags = DEBUG_OMAP2UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
556 .prcm = { 556 .prcm = {
557 .omap2 = { 557 .omap2 = {
558 .module_offs = CORE_MOD, 558 .module_offs = CORE_MOD,
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 28bbd56346a9..eb2f3b93b51c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -562,6 +562,7 @@ static struct omap_hwmod am33xx_cpgmac0_hwmod = {
562 .clkdm_name = "cpsw_125mhz_clkdm", 562 .clkdm_name = "cpsw_125mhz_clkdm",
563 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY), 563 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
564 .main_clk = "cpsw_125mhz_gclk", 564 .main_clk = "cpsw_125mhz_gclk",
565 .mpu_rt_idx = 1,
565 .prcm = { 566 .prcm = {
566 .omap4 = { 567 .omap4 = {
567 .clkctrl_offs = AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET, 568 .clkctrl_offs = AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET,
@@ -1512,7 +1513,7 @@ static struct omap_hwmod am33xx_uart1_hwmod = {
1512 .name = "uart1", 1513 .name = "uart1",
1513 .class = &uart_class, 1514 .class = &uart_class,
1514 .clkdm_name = "l4_wkup_clkdm", 1515 .clkdm_name = "l4_wkup_clkdm",
1515 .flags = HWMOD_SWSUP_SIDLE_ACT, 1516 .flags = DEBUG_AM33XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
1516 .main_clk = "dpll_per_m2_div4_wkupdm_ck", 1517 .main_clk = "dpll_per_m2_div4_wkupdm_ck",
1517 .prcm = { 1518 .prcm = {
1518 .omap4 = { 1519 .omap4 = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index f7a3df2fb579..0c3a427da544 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -490,7 +490,7 @@ static struct omap_hwmod omap3xxx_uart1_hwmod = {
490 .mpu_irqs = omap2_uart1_mpu_irqs, 490 .mpu_irqs = omap2_uart1_mpu_irqs,
491 .sdma_reqs = omap2_uart1_sdma_reqs, 491 .sdma_reqs = omap2_uart1_sdma_reqs,
492 .main_clk = "uart1_fck", 492 .main_clk = "uart1_fck",
493 .flags = HWMOD_SWSUP_SIDLE_ACT, 493 .flags = DEBUG_TI81XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
494 .prcm = { 494 .prcm = {
495 .omap2 = { 495 .omap2 = {
496 .module_offs = CORE_MOD, 496 .module_offs = CORE_MOD,
@@ -509,7 +509,7 @@ static struct omap_hwmod omap3xxx_uart2_hwmod = {
509 .mpu_irqs = omap2_uart2_mpu_irqs, 509 .mpu_irqs = omap2_uart2_mpu_irqs,
510 .sdma_reqs = omap2_uart2_sdma_reqs, 510 .sdma_reqs = omap2_uart2_sdma_reqs,
511 .main_clk = "uart2_fck", 511 .main_clk = "uart2_fck",
512 .flags = HWMOD_SWSUP_SIDLE_ACT, 512 .flags = DEBUG_TI81XXUART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
513 .prcm = { 513 .prcm = {
514 .omap2 = { 514 .omap2 = {
515 .module_offs = CORE_MOD, 515 .module_offs = CORE_MOD,
@@ -528,7 +528,8 @@ static struct omap_hwmod omap3xxx_uart3_hwmod = {
528 .mpu_irqs = omap2_uart3_mpu_irqs, 528 .mpu_irqs = omap2_uart3_mpu_irqs,
529 .sdma_reqs = omap2_uart3_sdma_reqs, 529 .sdma_reqs = omap2_uart3_sdma_reqs,
530 .main_clk = "uart3_fck", 530 .main_clk = "uart3_fck",
531 .flags = HWMOD_SWSUP_SIDLE_ACT, 531 .flags = DEBUG_OMAP3UART3_FLAGS | DEBUG_TI81XXUART3_FLAGS |
532 HWMOD_SWSUP_SIDLE_ACT,
532 .prcm = { 533 .prcm = {
533 .omap2 = { 534 .omap2 = {
534 .module_offs = OMAP3430_PER_MOD, 535 .module_offs = OMAP3430_PER_MOD,
@@ -558,7 +559,7 @@ static struct omap_hwmod omap36xx_uart4_hwmod = {
558 .mpu_irqs = uart4_mpu_irqs, 559 .mpu_irqs = uart4_mpu_irqs,
559 .sdma_reqs = uart4_sdma_reqs, 560 .sdma_reqs = uart4_sdma_reqs,
560 .main_clk = "uart4_fck", 561 .main_clk = "uart4_fck",
561 .flags = HWMOD_SWSUP_SIDLE_ACT, 562 .flags = DEBUG_OMAP3UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
562 .prcm = { 563 .prcm = {
563 .omap2 = { 564 .omap2 = {
564 .module_offs = OMAP3430_PER_MOD, 565 .module_offs = OMAP3430_PER_MOD,
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index d04b5e60fdbe..9c3b504477d7 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2858,8 +2858,7 @@ static struct omap_hwmod omap44xx_uart3_hwmod = {
2858 .name = "uart3", 2858 .name = "uart3",
2859 .class = &omap44xx_uart_hwmod_class, 2859 .class = &omap44xx_uart_hwmod_class,
2860 .clkdm_name = "l4_per_clkdm", 2860 .clkdm_name = "l4_per_clkdm",
2861 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET | 2861 .flags = DEBUG_OMAP4UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
2862 HWMOD_SWSUP_SIDLE_ACT,
2863 .main_clk = "func_48m_fclk", 2862 .main_clk = "func_48m_fclk",
2864 .prcm = { 2863 .prcm = {
2865 .omap4 = { 2864 .omap4 = {
@@ -2875,7 +2874,7 @@ static struct omap_hwmod omap44xx_uart4_hwmod = {
2875 .name = "uart4", 2874 .name = "uart4",
2876 .class = &omap44xx_uart_hwmod_class, 2875 .class = &omap44xx_uart_hwmod_class,
2877 .clkdm_name = "l4_per_clkdm", 2876 .clkdm_name = "l4_per_clkdm",
2878 .flags = HWMOD_SWSUP_SIDLE_ACT, 2877 .flags = DEBUG_OMAP4UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
2879 .main_clk = "func_48m_fclk", 2878 .main_clk = "func_48m_fclk",
2880 .prcm = { 2879 .prcm = {
2881 .omap4 = { 2880 .omap4 = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index f37ae96b70a1..3c70f5c1860f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -1375,7 +1375,7 @@ static struct omap_hwmod omap54xx_uart3_hwmod = {
1375 .name = "uart3", 1375 .name = "uart3",
1376 .class = &omap54xx_uart_hwmod_class, 1376 .class = &omap54xx_uart_hwmod_class,
1377 .clkdm_name = "l4per_clkdm", 1377 .clkdm_name = "l4per_clkdm",
1378 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 1378 .flags = DEBUG_OMAP4UART3_FLAGS,
1379 .main_clk = "func_48m_fclk", 1379 .main_clk = "func_48m_fclk",
1380 .prcm = { 1380 .prcm = {
1381 .omap4 = { 1381 .omap4 = {
@@ -1391,6 +1391,7 @@ static struct omap_hwmod omap54xx_uart4_hwmod = {
1391 .name = "uart4", 1391 .name = "uart4",
1392 .class = &omap54xx_uart_hwmod_class, 1392 .class = &omap54xx_uart_hwmod_class,
1393 .clkdm_name = "l4per_clkdm", 1393 .clkdm_name = "l4per_clkdm",
1394 .flags = DEBUG_OMAP4UART4_FLAGS,
1394 .main_clk = "func_48m_fclk", 1395 .main_clk = "func_48m_fclk",
1395 .prcm = { 1396 .prcm = {
1396 .omap4 = { 1397 .omap4 = {
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 3a674de6cb63..a388f8c1bcb3 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -208,17 +208,6 @@ static int __init omap_serial_early_init(void)
208 pr_info("%s used as console in debug mode: uart%d clocks will not be gated", 208 pr_info("%s used as console in debug mode: uart%d clocks will not be gated",
209 uart_name, uart->num); 209 uart_name, uart->num);
210 } 210 }
211
212 /*
213 * omap-uart can be used for earlyprintk logs
214 * So if omap-uart is used as console then prevent
215 * uart reset and idle to get logs from omap-uart
216 * until uart console driver is available to take
217 * care for console messages.
218 * Idling or resetting omap-uart while printing logs
219 * early boot logs can stall the boot-up.
220 */
221 oh->flags |= HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET;
222 } 211 }
223 } while (1); 212 } while (1);
224 213
diff --git a/arch/arm/mach-pxa/pxa-dt.c b/arch/arm/mach-pxa/pxa-dt.c
index 3835979a0dd3..f6a2c4b1c1dc 100644
--- a/arch/arm/mach-pxa/pxa-dt.c
+++ b/arch/arm/mach-pxa/pxa-dt.c
@@ -28,7 +28,7 @@ static const struct of_dev_auxdata pxa3xx_auxdata_lookup[] __initconst = {
28 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40700000, "pxa2xx-uart.2", NULL), 28 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40700000, "pxa2xx-uart.2", NULL),
29 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x41600000, "pxa2xx-uart.3", NULL), 29 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x41600000, "pxa2xx-uart.3", NULL),
30 OF_DEV_AUXDATA("marvell,pxa-mmc", 0x41100000, "pxa2xx-mci.0", NULL), 30 OF_DEV_AUXDATA("marvell,pxa-mmc", 0x41100000, "pxa2xx-mci.0", NULL),
31 OF_DEV_AUXDATA("mrvl,pxa-gpio", 0x40e00000, "pxa-gpio", NULL), 31 OF_DEV_AUXDATA("intel,pxa3xx-gpio", 0x40e00000, "pxa3xx-gpio", NULL),
32 OF_DEV_AUXDATA("marvell,pxa-ohci", 0x4c000000, "pxa27x-ohci", NULL), 32 OF_DEV_AUXDATA("marvell,pxa-ohci", 0x4c000000, "pxa27x-ohci", NULL),
33 OF_DEV_AUXDATA("mrvl,pxa-i2c", 0x40301680, "pxa2xx-i2c.0", NULL), 33 OF_DEV_AUXDATA("mrvl,pxa-i2c", 0x40301680, "pxa2xx-i2c.0", NULL),
34 OF_DEV_AUXDATA("mrvl,pwri2c", 0x40f500c0, "pxa3xx-i2c.1", NULL), 34 OF_DEV_AUXDATA("mrvl,pwri2c", 0x40f500c0, "pxa3xx-i2c.1", NULL),
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 3912ce91fee4..cdefd7dcca79 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -1,3 +1,41 @@
1config ARCH_SHMOBILE_MULTI
2 bool "SH-Mobile Series" if ARCH_MULTI_V7
3 depends on MMU
4 select CPU_V7
5 select GENERIC_CLOCKEVENTS
6 select HAVE_ARM_SCU if SMP
7 select HAVE_ARM_TWD if LOCAL_TIMERS
8 select HAVE_SMP
9 select ARM_GIC
10 select MIGHT_HAVE_CACHE_L2X0
11 select NO_IOPORT
12 select PINCTRL
13 select ARCH_REQUIRE_GPIOLIB
14 select CLKDEV_LOOKUP
15
16if ARCH_SHMOBILE_MULTI
17
18comment "SH-Mobile System Type"
19
20config ARCH_EMEV2
21 bool "Emma Mobile EV2"
22
23comment "SH-Mobile Board Type"
24
25config MACH_KZM9D_REFERENCE
26 bool "KZM9D board - Reference Device Tree Implementation"
27 depends on ARCH_EMEV2
28 select REGULATOR_FIXED_VOLTAGE if REGULATOR
29 ---help---
30 Use reference implementation of KZM9D board support
31 which makes a greater use of device tree at the expense
32 of not supporting a number of devices.
33
34 This is intended to aid developers
35
36comment "SH-Mobile System Configuration"
37endif
38
1if ARCH_SHMOBILE 39if ARCH_SHMOBILE
2 40
3comment "SH-Mobile System Type" 41comment "SH-Mobile System Type"
@@ -156,6 +194,18 @@ config MACH_KZM9D
156 select REGULATOR_FIXED_VOLTAGE if REGULATOR 194 select REGULATOR_FIXED_VOLTAGE if REGULATOR
157 select USE_OF 195 select USE_OF
158 196
197config MACH_KZM9D_REFERENCE
198 bool "KZM9D board - Reference Device Tree Implementation"
199 depends on ARCH_EMEV2
200 select REGULATOR_FIXED_VOLTAGE if REGULATOR
201 select USE_OF
202 ---help---
203 Use reference implementation of KZM9D board support
204 which makes a greater use of device tree at the expense
205 of not supporting a number of devices.
206
207 This is intended to aid developers
208
159config MACH_KZM9G 209config MACH_KZM9G
160 bool "KZM-A9-GT board" 210 bool "KZM-A9-GT board"
161 depends on ARCH_SH73A0 211 depends on ARCH_SH73A0
@@ -186,6 +236,15 @@ config CPU_HAS_INTEVT
186 bool 236 bool
187 default y 237 default y
188 238
239config SH_CLK_CPG
240 bool
241
242source "drivers/sh/Kconfig"
243
244endif
245
246if ARCH_SHMOBILE || ARCH_SHMOBILE_MULTI
247
189menu "Timer and clock configuration" 248menu "Timer and clock configuration"
190 249
191config SHMOBILE_TIMER_HZ 250config SHMOBILE_TIMER_HZ
@@ -220,9 +279,4 @@ config EM_TIMER_STI
220 279
221endmenu 280endmenu
222 281
223config SH_CLK_CPG
224 bool
225
226source "drivers/sh/Kconfig"
227
228endif 282endif
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 6165a517f580..b150c4508237 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -2,18 +2,33 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/arch/arm/mach-shmobile/include
6
5# Common objects 7# Common objects
6obj-y := timer.o console.o clock.o 8obj-y := timer.o console.o
7 9
8# CPU objects 10# CPU objects
9obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o clock-sh7372.o intc-sh7372.o 11obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o intc-sh7372.o
10obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o clock-sh73a0.o intc-sh73a0.o 12obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o intc-sh73a0.o
11obj-$(CONFIG_ARCH_R8A73A4) += setup-r8a73a4.o clock-r8a73a4.o 13obj-$(CONFIG_ARCH_R8A73A4) += setup-r8a73a4.o
12obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o 14obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o intc-r8a7740.o
13obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o clock-r8a7778.o 15obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o
14obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o clock-r8a7779.o intc-r8a7779.o 16obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o intc-r8a7779.o
15obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o clock-r8a7790.o 17obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o
16obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o clock-emev2.o 18obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o
19
20# Clock objects
21ifndef CONFIG_COMMON_CLK
22obj-y += clock.o
23obj-$(CONFIG_ARCH_SH7372) += clock-sh7372.o
24obj-$(CONFIG_ARCH_SH73A0) += clock-sh73a0.o
25obj-$(CONFIG_ARCH_R8A73A4) += clock-r8a73a4.o
26obj-$(CONFIG_ARCH_R8A7740) += clock-r8a7740.o
27obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o
28obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
29obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o
30obj-$(CONFIG_ARCH_EMEV2) += clock-emev2.o
31endif
17 32
18# SMP objects 33# SMP objects
19smp-y := platsmp.o headsmp.o 34smp-y := platsmp.o headsmp.o
@@ -46,6 +61,7 @@ obj-$(CONFIG_MACH_LAGER) += board-lager.o
46obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 61obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
47obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o 62obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o
48obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o 63obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
64obj-$(CONFIG_MACH_KZM9D_REFERENCE) += board-kzm9d-reference.o
49obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o 65obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
50obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o 66obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o
51 67
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index 84c6868580f0..7785c52b5cfd 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -7,6 +7,7 @@ loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
7loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000 7loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
8loadaddr-$(CONFIG_MACH_KOTA2) += 0x41008000 8loadaddr-$(CONFIG_MACH_KOTA2) += 0x41008000
9loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000 9loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000
10loadaddr-$(CONFIG_MACH_KZM9D_REFERENCE) += 0x40008000
10loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000 11loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
11loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000 12loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
12loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000 13loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index 5eb0caa6a7d0..1fbc39a14e25 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/irqchip.h>
24#include <linux/kernel.h> 23#include <linux/kernel.h>
25#include <linux/pinctrl/machine.h> 24#include <linux/pinctrl/machine.h>
26#include <linux/platform_device.h> 25#include <linux/platform_device.h>
@@ -102,7 +101,6 @@ static const char *ape6evm_boards_compat_dt[] __initdata = {
102}; 101};
103 102
104DT_MACHINE_START(APE6EVM_DT, "ape6evm") 103DT_MACHINE_START(APE6EVM_DT, "ape6evm")
105 .init_irq = irqchip_init,
106 .init_time = shmobile_timer_init, 104 .init_time = shmobile_timer_init,
107 .init_machine = ape6evm_add_standard_devices, 105 .init_machine = ape6evm_add_standard_devices,
108 .dt_compat = ape6evm_boards_compat_dt, 106 .dt_compat = ape6evm_boards_compat_dt,
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
index 03b85fec2ddb..002d8d3d0fc5 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
@@ -24,7 +24,6 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/pinctrl/machine.h>
28#include <mach/common.h> 27#include <mach/common.h>
29#include <mach/r8a7740.h> 28#include <mach/r8a7740.h>
30#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
@@ -119,12 +118,6 @@
119 * usbhsf_power_ctrl() 118 * usbhsf_power_ctrl()
120 */ 119 */
121 120
122static const struct pinctrl_map eva_pinctrl_map[] = {
123 /* SCIFA1 */
124 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.1", "pfc-r8a7740",
125 "scifa1_data", "scifa1"),
126};
127
128static void __init eva_clock_init(void) 121static void __init eva_clock_init(void)
129{ 122{
130 struct clk *system = clk_get(NULL, "system_clk"); 123 struct clk *system = clk_get(NULL, "system_clk");
@@ -165,27 +158,18 @@ clock_error:
165 */ 158 */
166static void __init eva_init(void) 159static void __init eva_init(void)
167{ 160{
168
169 r8a7740_clock_init(MD_CK0 | MD_CK2); 161 r8a7740_clock_init(MD_CK0 | MD_CK2);
170 eva_clock_init(); 162 eva_clock_init();
171 163
172 pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
173 r8a7740_pinmux_init();
174
175 r8a7740_meram_workaround(); 164 r8a7740_meram_workaround();
176 165
177 /*
178 * Touchscreen
179 * TODO: Move reset GPIO over to .dts when we can reference it
180 */
181 gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
182
183#ifdef CONFIG_CACHE_L2X0 166#ifdef CONFIG_CACHE_L2X0
184 /* Early BRESP enable, Shared attribute override enable, 32K*8way */ 167 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
185 l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff); 168 l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
186#endif 169#endif
187 170
188 r8a7740_add_standard_devices_dt(); 171 r8a7740_add_standard_devices_dt();
172
189 r8a7740_pm_init(); 173 r8a7740_pm_init();
190} 174}
191 175
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index e115f6742107..f6952c266fe9 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -679,15 +679,6 @@ static struct platform_device vcc_sdhi1 = {
679}; 679};
680 680
681/* SDHI0 */ 681/* SDHI0 */
682/*
683 * FIXME
684 *
685 * It use polling mode here, since
686 * CD (= Card Detect) pin is not connected to SDHI0_CD.
687 * We can use IRQ31 as card detect irq,
688 * but it needs chattering removal operation
689 */
690#define IRQ31 irq_pin(31)
691static struct sh_mobile_sdhi_info sdhi0_info = { 682static struct sh_mobile_sdhi_info sdhi0_info = {
692 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 683 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
693 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 684 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
@@ -1162,9 +1153,6 @@ static void __init eva_init(void)
1162 gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ 1153 gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1163 gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */ 1154 gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */
1164 1155
1165 /* Touchscreen */
1166 gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
1167
1168 /* GETHER */ 1156 /* GETHER */
1169 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */ 1157 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */
1170 1158
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index d5554646916c..3354a85c90f7 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -167,7 +167,13 @@ static const struct pinctrl_map bockw_pinctrl_map[] = {
167 "usb1", "usb1"), 167 "usb1", "usb1"),
168 /* SDHI0 */ 168 /* SDHI0 */
169 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", 169 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
170 "sdhi0", "sdhi0"), 170 "sdhi0_data4", "sdhi0"),
171 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
172 "sdhi0_ctrl", "sdhi0"),
173 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
174 "sdhi0_cd", "sdhi0"),
175 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
176 "sdhi0_wp", "sdhi0"),
171}; 177};
172 178
173#define FPGA 0x18200000 179#define FPGA 0x18200000
diff --git a/arch/arm/mach-shmobile/board-kzm9d-reference.c b/arch/arm/mach-shmobile/board-kzm9d-reference.c
new file mode 100644
index 000000000000..8f8bb2fab076
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-kzm9d-reference.c
@@ -0,0 +1,47 @@
1/*
2 * kzm9d board support - Reference DT implementation
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Magnus Damm
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/init.h>
22#include <linux/of_platform.h>
23#include <mach/emev2.h>
24#include <mach/common.h>
25#include <asm/mach/arch.h>
26
27static void __init kzm9d_add_standard_devices(void)
28{
29 if (!IS_ENABLED(CONFIG_COMMON_CLK))
30 emev2_clock_init();
31
32 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
33}
34
35static const char *kzm9d_boards_compat_dt[] __initdata = {
36 "renesas,kzm9d-reference",
37 NULL,
38};
39
40DT_MACHINE_START(KZM9D_DT, "kzm9d")
41 .smp = smp_ops(emev2_smp_ops),
42 .map_io = emev2_map_io,
43 .init_early = emev2_init_delay,
44 .init_machine = kzm9d_add_standard_devices,
45 .init_late = shmobile_init_late,
46 .dt_compat = kzm9d_boards_compat_dt,
47MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c
index 4368000e1127..30c2cc695b12 100644
--- a/arch/arm/mach-shmobile/board-kzm9d.c
+++ b/arch/arm/mach-shmobile/board-kzm9d.c
@@ -85,9 +85,7 @@ static const char *kzm9d_boards_compat_dt[] __initdata = {
85DT_MACHINE_START(KZM9D_DT, "kzm9d") 85DT_MACHINE_START(KZM9D_DT, "kzm9d")
86 .smp = smp_ops(emev2_smp_ops), 86 .smp = smp_ops(emev2_smp_ops),
87 .map_io = emev2_map_io, 87 .map_io = emev2_map_io,
88 .init_early = emev2_add_early_devices, 88 .init_early = emev2_init_delay,
89 .nr_irqs = NR_IRQS_LEGACY,
90 .init_irq = emev2_init_irq,
91 .init_machine = kzm9d_add_standard_devices, 89 .init_machine = kzm9d_add_standard_devices,
92 .init_late = shmobile_init_late, 90 .init_late = shmobile_init_late,
93 .dt_compat = kzm9d_boards_compat_dt, 91 .dt_compat = kzm9d_boards_compat_dt,
diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
index 44055fe8a45c..a66a808db012 100644
--- a/arch/arm/mach-shmobile/board-kzm9g-reference.c
+++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -21,67 +21,19 @@
21 */ 21 */
22 22
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/gpio.h>
25#include <linux/io.h> 24#include <linux/io.h>
26#include <linux/irq.h> 25#include <linux/irq.h>
27#include <linux/irqchip.h>
28#include <linux/input.h> 26#include <linux/input.h>
29#include <linux/of_platform.h> 27#include <linux/of_platform.h>
30#include <linux/pinctrl/machine.h>
31#include <linux/pinctrl/pinconf-generic.h>
32#include <mach/sh73a0.h> 28#include <mach/sh73a0.h>
33#include <mach/common.h> 29#include <mach/common.h>
34#include <asm/hardware/cache-l2x0.h> 30#include <asm/hardware/cache-l2x0.h>
35#include <asm/mach-types.h> 31#include <asm/mach-types.h>
36#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
37 33
38static unsigned long pin_pullup_conf[] = {
39 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
40};
41
42static const struct pinctrl_map kzm_pinctrl_map[] = {
43 PIN_MAP_MUX_GROUP_DEFAULT("e6826000.i2c", "pfc-sh73a0",
44 "i2c3_1", "i2c3"),
45 /* MMCIF */
46 PIN_MAP_MUX_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
47 "mmc0_data8_0", "mmc0"),
48 PIN_MAP_MUX_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
49 "mmc0_ctrl_0", "mmc0"),
50 PIN_MAP_CONFIGS_PIN_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
51 "PORT279", pin_pullup_conf),
52 PIN_MAP_CONFIGS_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
53 "mmc0_data8_0", pin_pullup_conf),
54 /* SCIFA4 */
55 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
56 "scifa4_data", "scifa4"),
57 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
58 "scifa4_ctrl", "scifa4"),
59 /* SDHI0 */
60 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
61 "sdhi0_data4", "sdhi0"),
62 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
63 "sdhi0_ctrl", "sdhi0"),
64 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
65 "sdhi0_cd", "sdhi0"),
66 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
67 "sdhi0_wp", "sdhi0"),
68 /* SDHI2 */
69 PIN_MAP_MUX_GROUP_DEFAULT("ee140000.sdhi", "pfc-sh73a0",
70 "sdhi2_data4", "sdhi2"),
71 PIN_MAP_MUX_GROUP_DEFAULT("ee140000.sdhi", "pfc-sh73a0",
72 "sdhi2_ctrl", "sdhi2"),
73};
74
75static void __init kzm_init(void) 34static void __init kzm_init(void)
76{ 35{
77 sh73a0_add_standard_devices_dt(); 36 sh73a0_add_standard_devices_dt();
78 pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map));
79 sh73a0_pinmux_init();
80
81 /* enable SD */
82 gpio_request_one(15, GPIOF_OUT_INIT_HIGH, NULL); /* power */
83
84 gpio_request_one(14, GPIOF_OUT_INIT_HIGH, NULL); /* power */
85 37
86#ifdef CONFIG_CACHE_L2X0 38#ifdef CONFIG_CACHE_L2X0
87 /* Early BRESP enable, Shared attribute override enable, 64K*8way */ 39 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
@@ -99,7 +51,6 @@ DT_MACHINE_START(KZM9G_DT, "kzm9g-reference")
99 .map_io = sh73a0_map_io, 51 .map_io = sh73a0_map_io,
100 .init_early = sh73a0_init_delay, 52 .init_early = sh73a0_init_delay,
101 .nr_irqs = NR_IRQS_LEGACY, 53 .nr_irqs = NR_IRQS_LEGACY,
102 .init_irq = irqchip_init,
103 .init_machine = kzm_init, 54 .init_machine = kzm_init,
104 .init_time = shmobile_timer_init, 55 .init_time = shmobile_timer_init,
105 .dt_compat = kzm9g_boards_compat_dt, 56 .dt_compat = kzm9g_boards_compat_dt,
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index d73e21d3ea8a..78d92d34665d 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -22,7 +22,6 @@
22#include <linux/gpio_keys.h> 22#include <linux/gpio_keys.h>
23#include <linux/input.h> 23#include <linux/input.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/irqchip.h>
26#include <linux/kernel.h> 25#include <linux/kernel.h>
27#include <linux/leds.h> 26#include <linux/leds.h>
28#include <linux/pinctrl/machine.h> 27#include <linux/pinctrl/machine.h>
@@ -59,7 +58,7 @@ static __initdata struct gpio_led_platform_data lager_leds_pdata = {
59#define GPIO_KEY(c, g, d, ...) \ 58#define GPIO_KEY(c, g, d, ...) \
60 { .code = c, .gpio = g, .desc = d, .active_low = 1 } 59 { .code = c, .gpio = g, .desc = d, .active_low = 1 }
61 60
62static __initdata struct gpio_keys_button gpio_buttons[] = { 61static struct gpio_keys_button gpio_buttons[] = {
63 GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"), 62 GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"),
64 GPIO_KEY(KEY_3, RCAR_GP_PIN(1, 26), "SW2-pin3"), 63 GPIO_KEY(KEY_3, RCAR_GP_PIN(1, 26), "SW2-pin3"),
65 GPIO_KEY(KEY_2, RCAR_GP_PIN(1, 24), "SW2-pin2"), 64 GPIO_KEY(KEY_2, RCAR_GP_PIN(1, 24), "SW2-pin2"),
@@ -103,7 +102,6 @@ static const char *lager_boards_compat_dt[] __initdata = {
103}; 102};
104 103
105DT_MACHINE_START(LAGER_DT, "lager") 104DT_MACHINE_START(LAGER_DT, "lager")
106 .init_irq = irqchip_init,
107 .init_time = r8a7790_timer_init, 105 .init_time = r8a7790_timer_init,
108 .init_machine = lager_add_standard_devices, 106 .init_machine = lager_add_standard_devices,
109 .dt_compat = lager_boards_compat_dt, 107 .dt_compat = lager_boards_compat_dt,
diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
index 480d882e42c7..3d1c439b4998 100644
--- a/arch/arm/mach-shmobile/board-marzen-reference.c
+++ b/arch/arm/mach-shmobile/board-marzen-reference.c
@@ -19,42 +19,14 @@
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21 21
22#include <linux/pinctrl/machine.h>
23#include <mach/r8a7779.h> 22#include <mach/r8a7779.h>
24#include <mach/common.h> 23#include <mach/common.h>
25#include <mach/irqs.h> 24#include <mach/irqs.h>
26#include <asm/irq.h> 25#include <asm/irq.h>
27#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
28 27
29static const struct pinctrl_map marzen_pinctrl_map[] = {
30 /* SCIF2 (CN18: DEBUG0) */
31 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-r8a7779",
32 "scif2_data_c", "scif2"),
33 /* SCIF4 (CN19: DEBUG1) */
34 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-r8a7779",
35 "scif4_data", "scif4"),
36 /* SDHI0 */
37 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
38 "sdhi0_data4", "sdhi0"),
39 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
40 "sdhi0_ctrl", "sdhi0"),
41 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
42 "sdhi0_cd", "sdhi0"),
43 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
44 "sdhi0_wp", "sdhi0"),
45 /* SMSC */
46 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
47 "intc_irq1_b", "intc"),
48 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
49 "lbsc_ex_cs0", "lbsc"),
50};
51
52static void __init marzen_init(void) 28static void __init marzen_init(void)
53{ 29{
54 pinctrl_register_mappings(marzen_pinctrl_map,
55 ARRAY_SIZE(marzen_pinctrl_map));
56 r8a7779_pinmux_init();
57
58 r8a7779_add_standard_devices_dt(); 30 r8a7779_add_standard_devices_dt();
59} 31}
60 32
diff --git a/arch/arm/mach-shmobile/clock-emev2.c b/arch/arm/mach-shmobile/clock-emev2.c
index 4710f1847bb7..56dd0cfcddc7 100644
--- a/arch/arm/mach-shmobile/clock-emev2.c
+++ b/arch/arm/mach-shmobile/clock-emev2.c
@@ -221,7 +221,7 @@ void __init emev2_clock_init(void)
221 smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE); 221 smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
222 BUG_ON(!smu_base); 222 BUG_ON(!smu_base);
223 223
224 /* setup STI timer to run on 37.768 kHz and deassert reset */ 224 /* setup STI timer to run on 32.768 kHz and deassert reset */
225 emev2_smu_write(0, STI_CLKSEL); 225 emev2_smu_write(0, STI_CLKSEL);
226 emev2_smu_write(1, STI_RSTCTRL); 226 emev2_smu_write(1, STI_RSTCTRL);
227 227
diff --git a/arch/arm/mach-shmobile/include/mach/dma.h b/arch/arm/mach-shmobile/include/mach/dma.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/arm/mach-shmobile/include/mach/dma.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-shmobile/include/mach/emev2.h b/arch/arm/mach-shmobile/include/mach/emev2.h
index ac3751705cab..b0ab4b72770a 100644
--- a/arch/arm/mach-shmobile/include/mach/emev2.h
+++ b/arch/arm/mach-shmobile/include/mach/emev2.h
@@ -2,8 +2,7 @@
2#define __ASM_EMEV2_H__ 2#define __ASM_EMEV2_H__
3 3
4extern void emev2_map_io(void); 4extern void emev2_map_io(void);
5extern void emev2_init_irq(void); 5extern void emev2_init_delay(void);
6extern void emev2_add_early_devices(void);
7extern void emev2_add_standard_devices(void); 6extern void emev2_add_standard_devices(void);
8extern void emev2_clock_init(void); 7extern void emev2_clock_init(void);
9extern void emev2_set_boot_vector(unsigned long value); 8extern void emev2_set_boot_vector(unsigned long value);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h
index 851d027a2f06..9b561bf4229f 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7778.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h
@@ -33,7 +33,6 @@ extern void r8a7778_add_mmc_device(struct sh_mmcif_plat_data *info);
33 33
34extern void r8a7778_init_late(void); 34extern void r8a7778_init_late(void);
35extern void r8a7778_init_delay(void); 35extern void r8a7778_init_delay(void);
36extern void r8a7778_init_irq(void);
37extern void r8a7778_init_irq_dt(void); 36extern void r8a7778_init_irq_dt(void);
38extern void r8a7778_clock_init(void); 37extern void r8a7778_clock_init(void);
39extern void r8a7778_init_irq_extpin(int irlm); 38extern void r8a7778_init_irq_extpin(int irlm);
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index 1ccddd228112..1553af8e04ff 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -20,7 +20,6 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/irqchip.h>
24#include <linux/platform_device.h> 23#include <linux/platform_device.h>
25#include <linux/platform_data/gpio-em.h> 24#include <linux/platform_data/gpio-em.h>
26#include <linux/of_platform.h> 25#include <linux/of_platform.h>
@@ -39,13 +38,6 @@
39 38
40static struct map_desc emev2_io_desc[] __initdata = { 39static struct map_desc emev2_io_desc[] __initdata = {
41#ifdef CONFIG_SMP 40#ifdef CONFIG_SMP
42 /* 128K entity map for 0xe0100000 (SMU) */
43 {
44 .virtual = 0xe0100000,
45 .pfn = __phys_to_pfn(0xe0100000),
46 .length = SZ_128K,
47 .type = MT_DEVICE
48 },
49 /* 2M mapping for SCU + L2 controller */ 41 /* 2M mapping for SCU + L2 controller */
50 { 42 {
51 .virtual = 0xf0000000, 43 .virtual = 0xf0000000,
@@ -63,102 +55,40 @@ void __init emev2_map_io(void)
63 55
64/* UART */ 56/* UART */
65static struct resource uart0_resources[] = { 57static struct resource uart0_resources[] = {
66 [0] = { 58 DEFINE_RES_MEM(0xe1020000, 0x38),
67 .start = 0xe1020000, 59 DEFINE_RES_IRQ(40),
68 .end = 0xe1020037,
69 .flags = IORESOURCE_MEM,
70 },
71 [1] = {
72 .start = 40,
73 .flags = IORESOURCE_IRQ,
74 }
75};
76
77static struct platform_device uart0_device = {
78 .name = "serial8250-em",
79 .id = 0,
80 .num_resources = ARRAY_SIZE(uart0_resources),
81 .resource = uart0_resources,
82}; 60};
83 61
84static struct resource uart1_resources[] = { 62static struct resource uart1_resources[] = {
85 [0] = { 63 DEFINE_RES_MEM(0xe1030000, 0x38),
86 .start = 0xe1030000, 64 DEFINE_RES_IRQ(41),
87 .end = 0xe1030037,
88 .flags = IORESOURCE_MEM,
89 },
90 [1] = {
91 .start = 41,
92 .flags = IORESOURCE_IRQ,
93 }
94};
95
96static struct platform_device uart1_device = {
97 .name = "serial8250-em",
98 .id = 1,
99 .num_resources = ARRAY_SIZE(uart1_resources),
100 .resource = uart1_resources,
101}; 65};
102 66
103static struct resource uart2_resources[] = { 67static struct resource uart2_resources[] = {
104 [0] = { 68 DEFINE_RES_MEM(0xe1040000, 0x38),
105 .start = 0xe1040000, 69 DEFINE_RES_IRQ(42),
106 .end = 0xe1040037,
107 .flags = IORESOURCE_MEM,
108 },
109 [1] = {
110 .start = 42,
111 .flags = IORESOURCE_IRQ,
112 }
113};
114
115static struct platform_device uart2_device = {
116 .name = "serial8250-em",
117 .id = 2,
118 .num_resources = ARRAY_SIZE(uart2_resources),
119 .resource = uart2_resources,
120}; 70};
121 71
122static struct resource uart3_resources[] = { 72static struct resource uart3_resources[] = {
123 [0] = { 73 DEFINE_RES_MEM(0xe1050000, 0x38),
124 .start = 0xe1050000, 74 DEFINE_RES_IRQ(43),
125 .end = 0xe1050037,
126 .flags = IORESOURCE_MEM,
127 },
128 [1] = {
129 .start = 43,
130 .flags = IORESOURCE_IRQ,
131 }
132}; 75};
133 76
134static struct platform_device uart3_device = { 77#define emev2_register_uart(idx) \
135 .name = "serial8250-em", 78 platform_device_register_simple("serial8250-em", idx, \
136 .id = 3, 79 uart##idx##_resources, \
137 .num_resources = ARRAY_SIZE(uart3_resources), 80 ARRAY_SIZE(uart##idx##_resources))
138 .resource = uart3_resources,
139};
140 81
141/* STI */ 82/* STI */
142static struct resource sti_resources[] = { 83static struct resource sti_resources[] = {
143 [0] = { 84 DEFINE_RES_MEM(0xe0180000, 0x54),
144 .name = "STI", 85 DEFINE_RES_IRQ(157),
145 .start = 0xe0180000,
146 .end = 0xe0180053,
147 .flags = IORESOURCE_MEM,
148 },
149 [1] = {
150 .start = 157,
151 .flags = IORESOURCE_IRQ,
152 },
153};
154
155static struct platform_device sti_device = {
156 .name = "em_sti",
157 .id = 0,
158 .resource = sti_resources,
159 .num_resources = ARRAY_SIZE(sti_resources),
160}; 86};
161 87
88#define emev2_register_sti() \
89 platform_device_register_simple("em_sti", 0, \
90 sti_resources, \
91 ARRAY_SIZE(sti_resources))
162 92
163/* GIO */ 93/* GIO */
164static struct gpio_em_config gio0_config = { 94static struct gpio_em_config gio0_config = {
@@ -168,36 +98,10 @@ static struct gpio_em_config gio0_config = {
168}; 98};
169 99
170static struct resource gio0_resources[] = { 100static struct resource gio0_resources[] = {
171 [0] = { 101 DEFINE_RES_MEM(0xe0050000, 0x2c),
172 .name = "GIO_000", 102 DEFINE_RES_MEM(0xe0050040, 0x20),
173 .start = 0xe0050000, 103 DEFINE_RES_IRQ(99),
174 .end = 0xe005002b, 104 DEFINE_RES_IRQ(100),
175 .flags = IORESOURCE_MEM,
176 },
177 [1] = {
178 .name = "GIO_000",
179 .start = 0xe0050040,
180 .end = 0xe005005f,
181 .flags = IORESOURCE_MEM,
182 },
183 [2] = {
184 .start = 99,
185 .flags = IORESOURCE_IRQ,
186 },
187 [3] = {
188 .start = 100,
189 .flags = IORESOURCE_IRQ,
190 },
191};
192
193static struct platform_device gio0_device = {
194 .name = "em_gio",
195 .id = 0,
196 .resource = gio0_resources,
197 .num_resources = ARRAY_SIZE(gio0_resources),
198 .dev = {
199 .platform_data = &gio0_config,
200 },
201}; 105};
202 106
203static struct gpio_em_config gio1_config = { 107static struct gpio_em_config gio1_config = {
@@ -207,36 +111,10 @@ static struct gpio_em_config gio1_config = {
207}; 111};
208 112
209static struct resource gio1_resources[] = { 113static struct resource gio1_resources[] = {
210 [0] = { 114 DEFINE_RES_MEM(0xe0050080, 0x2c),
211 .name = "GIO_032", 115 DEFINE_RES_MEM(0xe00500c0, 0x20),
212 .start = 0xe0050080, 116 DEFINE_RES_IRQ(101),
213 .end = 0xe00500ab, 117 DEFINE_RES_IRQ(102),
214 .flags = IORESOURCE_MEM,
215 },
216 [1] = {
217 .name = "GIO_032",
218 .start = 0xe00500c0,
219 .end = 0xe00500df,
220 .flags = IORESOURCE_MEM,
221 },
222 [2] = {
223 .start = 101,
224 .flags = IORESOURCE_IRQ,
225 },
226 [3] = {
227 .start = 102,
228 .flags = IORESOURCE_IRQ,
229 },
230};
231
232static struct platform_device gio1_device = {
233 .name = "em_gio",
234 .id = 1,
235 .resource = gio1_resources,
236 .num_resources = ARRAY_SIZE(gio1_resources),
237 .dev = {
238 .platform_data = &gio1_config,
239 },
240}; 118};
241 119
242static struct gpio_em_config gio2_config = { 120static struct gpio_em_config gio2_config = {
@@ -246,36 +124,10 @@ static struct gpio_em_config gio2_config = {
246}; 124};
247 125
248static struct resource gio2_resources[] = { 126static struct resource gio2_resources[] = {
249 [0] = { 127 DEFINE_RES_MEM(0xe0050100, 0x2c),
250 .name = "GIO_064", 128 DEFINE_RES_MEM(0xe0050140, 0x20),
251 .start = 0xe0050100, 129 DEFINE_RES_IRQ(103),
252 .end = 0xe005012b, 130 DEFINE_RES_IRQ(104),
253 .flags = IORESOURCE_MEM,
254 },
255 [1] = {
256 .name = "GIO_064",
257 .start = 0xe0050140,
258 .end = 0xe005015f,
259 .flags = IORESOURCE_MEM,
260 },
261 [2] = {
262 .start = 103,
263 .flags = IORESOURCE_IRQ,
264 },
265 [3] = {
266 .start = 104,
267 .flags = IORESOURCE_IRQ,
268 },
269};
270
271static struct platform_device gio2_device = {
272 .name = "em_gio",
273 .id = 2,
274 .resource = gio2_resources,
275 .num_resources = ARRAY_SIZE(gio2_resources),
276 .dev = {
277 .platform_data = &gio2_config,
278 },
279}; 131};
280 132
281static struct gpio_em_config gio3_config = { 133static struct gpio_em_config gio3_config = {
@@ -285,36 +137,10 @@ static struct gpio_em_config gio3_config = {
285}; 137};
286 138
287static struct resource gio3_resources[] = { 139static struct resource gio3_resources[] = {
288 [0] = { 140 DEFINE_RES_MEM(0xe0050180, 0x2c),
289 .name = "GIO_096", 141 DEFINE_RES_MEM(0xe00501c0, 0x20),
290 .start = 0xe0050180, 142 DEFINE_RES_IRQ(105),
291 .end = 0xe00501ab, 143 DEFINE_RES_IRQ(106),
292 .flags = IORESOURCE_MEM,
293 },
294 [1] = {
295 .name = "GIO_096",
296 .start = 0xe00501c0,
297 .end = 0xe00501df,
298 .flags = IORESOURCE_MEM,
299 },
300 [2] = {
301 .start = 105,
302 .flags = IORESOURCE_IRQ,
303 },
304 [3] = {
305 .start = 106,
306 .flags = IORESOURCE_IRQ,
307 },
308};
309
310static struct platform_device gio3_device = {
311 .name = "em_gio",
312 .id = 3,
313 .resource = gio3_resources,
314 .num_resources = ARRAY_SIZE(gio3_resources),
315 .dev = {
316 .platform_data = &gio3_config,
317 },
318}; 144};
319 145
320static struct gpio_em_config gio4_config = { 146static struct gpio_em_config gio4_config = {
@@ -324,126 +150,53 @@ static struct gpio_em_config gio4_config = {
324}; 150};
325 151
326static struct resource gio4_resources[] = { 152static struct resource gio4_resources[] = {
327 [0] = { 153 DEFINE_RES_MEM(0xe0050200, 0x2c),
328 .name = "GIO_128", 154 DEFINE_RES_MEM(0xe0050240, 0x20),
329 .start = 0xe0050200, 155 DEFINE_RES_IRQ(107),
330 .end = 0xe005022b, 156 DEFINE_RES_IRQ(108),
331 .flags = IORESOURCE_MEM,
332 },
333 [1] = {
334 .name = "GIO_128",
335 .start = 0xe0050240,
336 .end = 0xe005025f,
337 .flags = IORESOURCE_MEM,
338 },
339 [2] = {
340 .start = 107,
341 .flags = IORESOURCE_IRQ,
342 },
343 [3] = {
344 .start = 108,
345 .flags = IORESOURCE_IRQ,
346 },
347}; 157};
348 158
349static struct platform_device gio4_device = { 159#define emev2_register_gio(idx) \
350 .name = "em_gio", 160 platform_device_register_resndata(&platform_bus, "em_gio", \
351 .id = 4, 161 idx, gio##idx##_resources, \
352 .resource = gio4_resources, 162 ARRAY_SIZE(gio##idx##_resources), \
353 .num_resources = ARRAY_SIZE(gio4_resources), 163 &gio##idx##_config, \
354 .dev = { 164 sizeof(struct gpio_em_config))
355 .platform_data = &gio4_config,
356 },
357};
358 165
359static struct resource pmu_resources[] = { 166static struct resource pmu_resources[] = {
360 [0] = { 167 DEFINE_RES_IRQ(152),
361 .start = 152, 168 DEFINE_RES_IRQ(153),
362 .end = 152,
363 .flags = IORESOURCE_IRQ,
364 },
365 [1] = {
366 .start = 153,
367 .end = 153,
368 .flags = IORESOURCE_IRQ,
369 },
370};
371
372static struct platform_device pmu_device = {
373 .name = "arm-pmu",
374 .id = -1,
375 .num_resources = ARRAY_SIZE(pmu_resources),
376 .resource = pmu_resources,
377}; 169};
378 170
379static struct platform_device *emev2_early_devices[] __initdata = { 171#define emev2_register_pmu() \
380 &uart0_device, 172 platform_device_register_simple("arm-pmu", -1, \
381 &uart1_device, 173 pmu_resources, \
382 &uart2_device, 174 ARRAY_SIZE(pmu_resources))
383 &uart3_device,
384};
385
386static struct platform_device *emev2_late_devices[] __initdata = {
387 &sti_device,
388 &gio0_device,
389 &gio1_device,
390 &gio2_device,
391 &gio3_device,
392 &gio4_device,
393 &pmu_device,
394};
395 175
396void __init emev2_add_standard_devices(void) 176void __init emev2_add_standard_devices(void)
397{ 177{
398 emev2_clock_init(); 178 if (!IS_ENABLED(CONFIG_COMMON_CLK))
399 179 emev2_clock_init();
400 platform_add_devices(emev2_early_devices, 180
401 ARRAY_SIZE(emev2_early_devices)); 181 emev2_register_uart(0);
402 182 emev2_register_uart(1);
403 platform_add_devices(emev2_late_devices, 183 emev2_register_uart(2);
404 ARRAY_SIZE(emev2_late_devices)); 184 emev2_register_uart(3);
185 emev2_register_sti();
186 emev2_register_gio(0);
187 emev2_register_gio(1);
188 emev2_register_gio(2);
189 emev2_register_gio(3);
190 emev2_register_gio(4);
191 emev2_register_pmu();
405} 192}
406 193
407static void __init emev2_init_delay(void) 194void __init emev2_init_delay(void)
408{ 195{
409 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */ 196 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
410} 197}
411 198
412void __init emev2_add_early_devices(void)
413{
414 emev2_init_delay();
415
416 early_platform_add_devices(emev2_early_devices,
417 ARRAY_SIZE(emev2_early_devices));
418
419 /* setup early console here as well */
420 shmobile_setup_console();
421}
422
423void __init emev2_init_irq(void)
424{
425 void __iomem *gic_dist_base;
426 void __iomem *gic_cpu_base;
427
428 /* Static mappings, never released */
429 gic_dist_base = ioremap(0xe0028000, PAGE_SIZE);
430 gic_cpu_base = ioremap(0xe0020000, PAGE_SIZE);
431 BUG_ON(!gic_dist_base || !gic_cpu_base);
432
433 /* Use GIC to handle interrupts */
434 gic_init(0, 29, gic_dist_base, gic_cpu_base);
435}
436
437#ifdef CONFIG_USE_OF 199#ifdef CONFIG_USE_OF
438static const struct of_dev_auxdata emev2_auxdata_lookup[] __initconst = {
439 { }
440};
441
442static void __init emev2_add_standard_devices_dt(void)
443{
444 of_platform_populate(NULL, of_default_bus_match_table,
445 emev2_auxdata_lookup, NULL);
446}
447 200
448static const char *emev2_boards_compat_dt[] __initdata = { 201static const char *emev2_boards_compat_dt[] __initdata = {
449 "renesas,emev2", 202 "renesas,emev2",
@@ -452,10 +205,8 @@ static const char *emev2_boards_compat_dt[] __initdata = {
452 205
453DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)") 206DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
454 .smp = smp_ops(emev2_smp_ops), 207 .smp = smp_ops(emev2_smp_ops),
208 .map_io = emev2_map_io,
455 .init_early = emev2_init_delay, 209 .init_early = emev2_init_delay,
456 .nr_irqs = NR_IRQS_LEGACY,
457 .init_irq = irqchip_init,
458 .init_machine = emev2_add_standard_devices_dt,
459 .dt_compat = emev2_boards_compat_dt, 210 .dt_compat = emev2_boards_compat_dt,
460MACHINE_END 211MACHINE_END
461 212
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index 7f45c2edbca9..a8c4e41bf27a 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -18,7 +18,6 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/irqchip.h>
22#include <linux/kernel.h> 21#include <linux/kernel.h>
23#include <linux/of_platform.h> 22#include <linux/of_platform.h>
24#include <linux/platform_data/irq-renesas-irqc.h> 23#include <linux/platform_data/irq-renesas-irqc.h>
@@ -194,7 +193,6 @@ static const char *r8a73a4_boards_compat_dt[] __initdata = {
194}; 193};
195 194
196DT_MACHINE_START(R8A73A4_DT, "Generic R8A73A4 (Flattened Device Tree)") 195DT_MACHINE_START(R8A73A4_DT, "Generic R8A73A4 (Flattened Device Tree)")
197 .init_irq = irqchip_init,
198 .init_machine = r8a73a4_add_standard_devices_dt, 196 .init_machine = r8a73a4_add_standard_devices_dt,
199 .init_time = shmobile_timer_init, 197 .init_time = shmobile_timer_init,
200 .dt_compat = r8a73a4_boards_compat_dt, 198 .dt_compat = r8a73a4_boards_compat_dt,
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 00c5a707238b..ac29c2ee011f 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -986,16 +986,22 @@ void __init r8a7740_add_early_devices(void)
986 986
987#ifdef CONFIG_USE_OF 987#ifdef CONFIG_USE_OF
988 988
989static const struct of_dev_auxdata r8a7740_auxdata_lookup[] __initconst = { 989void __init r8a7740_add_early_devices_dt(void)
990 { } 990{
991}; 991 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
992
993 early_platform_add_devices(r8a7740_early_devices,
994 ARRAY_SIZE(r8a7740_early_devices));
995
996 /* setup early console here as well */
997 shmobile_setup_console();
998}
992 999
993void __init r8a7740_add_standard_devices_dt(void) 1000void __init r8a7740_add_standard_devices_dt(void)
994{ 1001{
995 platform_add_devices(r8a7740_devices_dt, 1002 platform_add_devices(r8a7740_devices_dt,
996 ARRAY_SIZE(r8a7740_devices_dt)); 1003 ARRAY_SIZE(r8a7740_devices_dt));
997 of_platform_populate(NULL, of_default_bus_match_table, 1004 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
998 r8a7740_auxdata_lookup, NULL);
999} 1005}
1000 1006
1001void __init r8a7740_init_delay(void) 1007void __init r8a7740_init_delay(void)
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index 80c20392ad7c..a3a2e37b03f3 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -53,7 +53,7 @@
53 .irqs = SCIx_IRQ_MUXED(irq), \ 53 .irqs = SCIx_IRQ_MUXED(irq), \
54} 54}
55 55
56static struct plat_sci_port scif_platform_data[] = { 56static struct plat_sci_port scif_platform_data[] __initdata = {
57 SCIF_INFO(0xffe40000, gic_iid(0x66)), 57 SCIF_INFO(0xffe40000, gic_iid(0x66)),
58 SCIF_INFO(0xffe41000, gic_iid(0x67)), 58 SCIF_INFO(0xffe41000, gic_iid(0x67)),
59 SCIF_INFO(0xffe42000, gic_iid(0x68)), 59 SCIF_INFO(0xffe42000, gic_iid(0x68)),
@@ -63,24 +63,24 @@ static struct plat_sci_port scif_platform_data[] = {
63}; 63};
64 64
65/* TMU */ 65/* TMU */
66static struct resource sh_tmu0_resources[] = { 66static struct resource sh_tmu0_resources[] __initdata = {
67 DEFINE_RES_MEM(0xffd80008, 12), 67 DEFINE_RES_MEM(0xffd80008, 12),
68 DEFINE_RES_IRQ(gic_iid(0x40)), 68 DEFINE_RES_IRQ(gic_iid(0x40)),
69}; 69};
70 70
71static struct sh_timer_config sh_tmu0_platform_data = { 71static struct sh_timer_config sh_tmu0_platform_data __initdata = {
72 .name = "TMU00", 72 .name = "TMU00",
73 .channel_offset = 0x4, 73 .channel_offset = 0x4,
74 .timer_bit = 0, 74 .timer_bit = 0,
75 .clockevent_rating = 200, 75 .clockevent_rating = 200,
76}; 76};
77 77
78static struct resource sh_tmu1_resources[] = { 78static struct resource sh_tmu1_resources[] __initdata = {
79 DEFINE_RES_MEM(0xffd80014, 12), 79 DEFINE_RES_MEM(0xffd80014, 12),
80 DEFINE_RES_IRQ(gic_iid(0x41)), 80 DEFINE_RES_IRQ(gic_iid(0x41)),
81}; 81};
82 82
83static struct sh_timer_config sh_tmu1_platform_data = { 83static struct sh_timer_config sh_tmu1_platform_data __initdata = {
84 .name = "TMU01", 84 .name = "TMU01",
85 .channel_offset = 0x10, 85 .channel_offset = 0x10,
86 .timer_bit = 1, 86 .timer_bit = 1,
@@ -189,7 +189,7 @@ USB_PLATFORM_INFO(ehci);
189USB_PLATFORM_INFO(ohci); 189USB_PLATFORM_INFO(ohci);
190 190
191/* Ether */ 191/* Ether */
192static struct resource ether_resources[] = { 192static struct resource ether_resources[] __initdata = {
193 DEFINE_RES_MEM(0xfde00000, 0x400), 193 DEFINE_RES_MEM(0xfde00000, 0x400),
194 DEFINE_RES_IRQ(gic_iid(0x89)), 194 DEFINE_RES_IRQ(gic_iid(0x89)),
195}; 195};
@@ -203,17 +203,17 @@ void __init r8a7778_add_ether_device(struct sh_eth_plat_data *pdata)
203} 203}
204 204
205/* PFC/GPIO */ 205/* PFC/GPIO */
206static struct resource pfc_resources[] = { 206static struct resource pfc_resources[] __initdata = {
207 DEFINE_RES_MEM(0xfffc0000, 0x118), 207 DEFINE_RES_MEM(0xfffc0000, 0x118),
208}; 208};
209 209
210#define R8A7778_GPIO(idx) \ 210#define R8A7778_GPIO(idx) \
211static struct resource r8a7778_gpio##idx##_resources[] = { \ 211static struct resource r8a7778_gpio##idx##_resources[] __initdata = { \
212 DEFINE_RES_MEM(0xffc40000 + 0x1000 * (idx), 0x30), \ 212 DEFINE_RES_MEM(0xffc40000 + 0x1000 * (idx), 0x30), \
213 DEFINE_RES_IRQ(gic_iid(0x87)), \ 213 DEFINE_RES_IRQ(gic_iid(0x87)), \
214}; \ 214}; \
215 \ 215 \
216static struct gpio_rcar_config r8a7778_gpio##idx##_platform_data = { \ 216static struct gpio_rcar_config r8a7778_gpio##idx##_platform_data __initdata = { \
217 .gpio_base = 32 * (idx), \ 217 .gpio_base = 32 * (idx), \
218 .irq_base = GPIO_IRQ_BASE(idx), \ 218 .irq_base = GPIO_IRQ_BASE(idx), \
219 .number_of_pins = 32, \ 219 .number_of_pins = 32, \
@@ -249,7 +249,7 @@ void __init r8a7778_pinmux_init(void)
249}; 249};
250 250
251/* SDHI */ 251/* SDHI */
252static struct resource sdhi_resources[] = { 252static struct resource sdhi_resources[] __initdata = {
253 /* SDHI0 */ 253 /* SDHI0 */
254 DEFINE_RES_MEM(0xFFE4C000, 0x100), 254 DEFINE_RES_MEM(0xFFE4C000, 0x100),
255 DEFINE_RES_IRQ(gic_iid(0x77)), 255 DEFINE_RES_IRQ(gic_iid(0x77)),
@@ -365,12 +365,12 @@ void __init r8a7778_init_late(void)
365 platform_device_register_full(&ohci_info); 365 platform_device_register_full(&ohci_info);
366} 366}
367 367
368static struct renesas_intc_irqpin_config irqpin_platform_data = { 368static struct renesas_intc_irqpin_config irqpin_platform_data __initdata = {
369 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */ 369 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
370 .sense_bitfield_width = 2, 370 .sense_bitfield_width = 2,
371}; 371};
372 372
373static struct resource irqpin_resources[] = { 373static struct resource irqpin_resources[] __initdata = {
374 DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */ 374 DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */
375 DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */ 375 DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */
376 DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */ 376 DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */
@@ -408,17 +408,25 @@ void __init r8a7778_init_irq_extpin(int irlm)
408 &irqpin_platform_data, sizeof(irqpin_platform_data)); 408 &irqpin_platform_data, sizeof(irqpin_platform_data));
409} 409}
410 410
411void __init r8a7778_init_delay(void)
412{
413 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
414}
415
416#ifdef CONFIG_USE_OF
411#define INT2SMSKCR0 0x82288 /* 0xfe782288 */ 417#define INT2SMSKCR0 0x82288 /* 0xfe782288 */
412#define INT2SMSKCR1 0x8228c /* 0xfe78228c */ 418#define INT2SMSKCR1 0x8228c /* 0xfe78228c */
413 419
414#define INT2NTSR0 0x00018 /* 0xfe700018 */ 420#define INT2NTSR0 0x00018 /* 0xfe700018 */
415#define INT2NTSR1 0x0002c /* 0xfe70002c */ 421#define INT2NTSR1 0x0002c /* 0xfe70002c */
416static void __init r8a7778_init_irq_common(void) 422void __init r8a7778_init_irq_dt(void)
417{ 423{
418 void __iomem *base = ioremap_nocache(0xfe700000, 0x00100000); 424 void __iomem *base = ioremap_nocache(0xfe700000, 0x00100000);
419 425
420 BUG_ON(!base); 426 BUG_ON(!base);
421 427
428 irqchip_init();
429
422 /* route all interrupts to ARM */ 430 /* route all interrupts to ARM */
423 __raw_writel(0x73ffffff, base + INT2NTSR0); 431 __raw_writel(0x73ffffff, base + INT2NTSR0);
424 __raw_writel(0xffffffff, base + INT2NTSR1); 432 __raw_writel(0xffffffff, base + INT2NTSR1);
@@ -430,43 +438,6 @@ static void __init r8a7778_init_irq_common(void)
430 iounmap(base); 438 iounmap(base);
431} 439}
432 440
433void __init r8a7778_init_irq(void)
434{
435 void __iomem *gic_dist_base;
436 void __iomem *gic_cpu_base;
437
438 gic_dist_base = ioremap_nocache(0xfe438000, PAGE_SIZE);
439 gic_cpu_base = ioremap_nocache(0xfe430000, PAGE_SIZE);
440 BUG_ON(!gic_dist_base || !gic_cpu_base);
441
442 /* use GIC to handle interrupts */
443 gic_init(0, 29, gic_dist_base, gic_cpu_base);
444
445 r8a7778_init_irq_common();
446}
447
448void __init r8a7778_init_delay(void)
449{
450 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
451}
452
453#ifdef CONFIG_USE_OF
454void __init r8a7778_init_irq_dt(void)
455{
456 irqchip_init();
457 r8a7778_init_irq_common();
458}
459
460static const struct of_dev_auxdata r8a7778_auxdata_lookup[] __initconst = {
461 {},
462};
463
464void __init r8a7778_add_standard_devices_dt(void)
465{
466 of_platform_populate(NULL, of_default_bus_match_table,
467 r8a7778_auxdata_lookup, NULL);
468}
469
470static const char *r8a7778_compat_dt[] __initdata = { 441static const char *r8a7778_compat_dt[] __initdata = {
471 "renesas,r8a7778", 442 "renesas,r8a7778",
472 NULL, 443 NULL,
@@ -475,7 +446,6 @@ static const char *r8a7778_compat_dt[] __initdata = {
475DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)") 446DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)")
476 .init_early = r8a7778_init_delay, 447 .init_early = r8a7778_init_delay,
477 .init_irq = r8a7778_init_irq_dt, 448 .init_irq = r8a7778_init_irq_dt,
478 .init_machine = r8a7778_add_standard_devices_dt,
479 .init_time = shmobile_timer_init, 449 .init_time = shmobile_timer_init,
480 .dt_compat = r8a7778_compat_dt, 450 .dt_compat = r8a7778_compat_dt,
481 .init_late = r8a7778_init_late, 451 .init_late = r8a7778_init_late,
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 398687761f50..66d38261ecaa 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -665,10 +665,6 @@ void __init r8a7779_init_delay(void)
665 shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */ 665 shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
666} 666}
667 667
668static const struct of_dev_auxdata r8a7779_auxdata_lookup[] __initconst = {
669 {},
670};
671
672void __init r8a7779_add_standard_devices_dt(void) 668void __init r8a7779_add_standard_devices_dt(void)
673{ 669{
674 /* clocks are setup late during boot in the case of DT */ 670 /* clocks are setup late during boot in the case of DT */
@@ -676,8 +672,7 @@ void __init r8a7779_add_standard_devices_dt(void)
676 672
677 platform_add_devices(r8a7779_devices_dt, 673 platform_add_devices(r8a7779_devices_dt,
678 ARRAY_SIZE(r8a7779_devices_dt)); 674 ARRAY_SIZE(r8a7779_devices_dt));
679 of_platform_populate(NULL, of_default_bus_match_table, 675 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
680 r8a7779_auxdata_lookup, NULL);
681} 676}
682 677
683static const char *r8a7779_compat_dt[] __initdata = { 678static const char *r8a7779_compat_dt[] __initdata = {
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 28f94752b8ff..b7e78b9a7fdf 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -19,7 +19,6 @@
19 */ 19 */
20 20
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/irqchip.h>
23#include <linux/kernel.h> 22#include <linux/kernel.h>
24#include <linux/of_platform.h> 23#include <linux/of_platform.h>
25#include <linux/serial_sci.h> 24#include <linux/serial_sci.h>
@@ -177,10 +176,6 @@ void __init r8a7790_timer_init(void)
177} 176}
178 177
179#ifdef CONFIG_USE_OF 178#ifdef CONFIG_USE_OF
180void __init r8a7790_add_standard_devices_dt(void)
181{
182 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
183}
184 179
185static const char *r8a7790_boards_compat_dt[] __initdata = { 180static const char *r8a7790_boards_compat_dt[] __initdata = {
186 "renesas,r8a7790", 181 "renesas,r8a7790",
@@ -188,8 +183,6 @@ static const char *r8a7790_boards_compat_dt[] __initdata = {
188}; 183};
189 184
190DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)") 185DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
191 .init_irq = irqchip_init,
192 .init_machine = r8a7790_add_standard_devices_dt,
193 .init_time = r8a7790_timer_init, 186 .init_time = r8a7790_timer_init,
194 .dt_compat = r8a7790_boards_compat_dt, 187 .dt_compat = r8a7790_boards_compat_dt,
195MACHINE_END 188MACHINE_END
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 5502d624aca6..13e6fdbde0a5 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -1147,10 +1147,6 @@ void __init sh7372_add_early_devices_dt(void)
1147 shmobile_setup_console(); 1147 shmobile_setup_console();
1148} 1148}
1149 1149
1150static const struct of_dev_auxdata sh7372_auxdata_lookup[] __initconst = {
1151 { }
1152};
1153
1154void __init sh7372_add_standard_devices_dt(void) 1150void __init sh7372_add_standard_devices_dt(void)
1155{ 1151{
1156 /* clocks are setup late during boot in the case of DT */ 1152 /* clocks are setup late during boot in the case of DT */
@@ -1159,8 +1155,7 @@ void __init sh7372_add_standard_devices_dt(void)
1159 platform_add_devices(sh7372_early_devices, 1155 platform_add_devices(sh7372_early_devices,
1160 ARRAY_SIZE(sh7372_early_devices)); 1156 ARRAY_SIZE(sh7372_early_devices));
1161 1157
1162 of_platform_populate(NULL, of_default_bus_match_table, 1158 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
1163 sh7372_auxdata_lookup, NULL);
1164} 1159}
1165 1160
1166static const char *sh7372_boards_compat_dt[] __initdata = { 1161static const char *sh7372_boards_compat_dt[] __initdata = {
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 96e7ca1e4e11..516c2391b47a 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -22,7 +22,6 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/irqchip.h>
26#include <linux/platform_device.h> 25#include <linux/platform_device.h>
27#include <linux/of_platform.h> 26#include <linux/of_platform.h>
28#include <linux/delay.h> 27#include <linux/delay.h>
@@ -61,29 +60,16 @@ void __init sh73a0_map_io(void)
61 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc)); 60 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
62} 61}
63 62
64static struct resource sh73a0_pfc_resources[] = { 63/* PFC */
65 [0] = { 64static struct resource pfc_resources[] __initdata = {
66 .start = 0xe6050000, 65 DEFINE_RES_MEM(0xe6050000, 0x8000),
67 .end = 0xe6057fff, 66 DEFINE_RES_MEM(0xe605801c, 0x000c),
68 .flags = IORESOURCE_MEM,
69 },
70 [1] = {
71 .start = 0xe605801c,
72 .end = 0xe6058027,
73 .flags = IORESOURCE_MEM,
74 }
75};
76
77static struct platform_device sh73a0_pfc_device = {
78 .name = "pfc-sh73a0",
79 .id = -1,
80 .resource = sh73a0_pfc_resources,
81 .num_resources = ARRAY_SIZE(sh73a0_pfc_resources),
82}; 67};
83 68
84void __init sh73a0_pinmux_init(void) 69void __init sh73a0_pinmux_init(void)
85{ 70{
86 platform_device_register(&sh73a0_pfc_device); 71 platform_device_register_simple("pfc-sh73a0", -1, pfc_resources,
72 ARRAY_SIZE(pfc_resources));
87} 73}
88 74
89static struct plat_sci_port scif0_platform_data = { 75static struct plat_sci_port scif0_platform_data = {
@@ -958,10 +944,6 @@ void __init sh73a0_add_early_devices(void)
958 944
959#ifdef CONFIG_USE_OF 945#ifdef CONFIG_USE_OF
960 946
961static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = {
962 {},
963};
964
965void __init sh73a0_add_standard_devices_dt(void) 947void __init sh73a0_add_standard_devices_dt(void)
966{ 948{
967 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", .id = -1, }; 949 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", .id = -1, };
@@ -971,8 +953,7 @@ void __init sh73a0_add_standard_devices_dt(void)
971 953
972 platform_add_devices(sh73a0_devices_dt, 954 platform_add_devices(sh73a0_devices_dt,
973 ARRAY_SIZE(sh73a0_devices_dt)); 955 ARRAY_SIZE(sh73a0_devices_dt));
974 of_platform_populate(NULL, of_default_bus_match_table, 956 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
975 sh73a0_auxdata_lookup, NULL);
976 957
977 /* Instantiate cpufreq-cpu0 */ 958 /* Instantiate cpufreq-cpu0 */
978 platform_device_register_full(&devinfo); 959 platform_device_register_full(&devinfo);
@@ -988,7 +969,6 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
988 .map_io = sh73a0_map_io, 969 .map_io = sh73a0_map_io,
989 .init_early = sh73a0_init_delay, 970 .init_early = sh73a0_init_delay,
990 .nr_irqs = NR_IRQS_LEGACY, 971 .nr_irqs = NR_IRQS_LEGACY,
991 .init_irq = irqchip_init,
992 .init_machine = sh73a0_add_standard_devices_dt, 972 .init_machine = sh73a0_add_standard_devices_dt,
993 .dt_compat = sh73a0_boards_compat_dt, 973 .dt_compat = sh73a0_boards_compat_dt,
994MACHINE_END 974MACHINE_END
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 22a05a869d25..1fcd607d64ad 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -38,9 +38,12 @@ static int emev2_boot_secondary(unsigned int cpu, struct task_struct *idle)
38 38
39static void __init emev2_smp_prepare_cpus(unsigned int max_cpus) 39static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
40{ 40{
41 /* setup EMEV2 specific SCU base, enable */
42 shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
41 scu_enable(shmobile_scu_base); 43 scu_enable(shmobile_scu_base);
42 44
43 /* Tell ROM loader about our vector (in headsmp-scu.S, headsmp.S) */ 45 /* Tell ROM loader about our vector (in headsmp-scu.S, headsmp.S) */
46 emev2_clock_init(); /* need ioremapped SMU */
44 emev2_set_boot_vector(__pa(shmobile_boot_vector)); 47 emev2_set_boot_vector(__pa(shmobile_boot_vector));
45 shmobile_boot_fn = virt_to_phys(shmobile_boot_scu); 48 shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
46 shmobile_boot_arg = (unsigned long)shmobile_scu_base; 49 shmobile_boot_arg = (unsigned long)shmobile_scu_base;
@@ -49,21 +52,7 @@ static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
49 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL); 52 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
50} 53}
51 54
52static void __init emev2_smp_init_cpus(void)
53{
54 unsigned int ncores;
55
56 /* setup EMEV2 specific SCU base */
57 shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
58 emev2_clock_init(); /* need ioremapped SMU */
59
60 ncores = shmobile_scu_base ? scu_get_core_count(shmobile_scu_base) : 1;
61
62 shmobile_smp_init_cpus(ncores);
63}
64
65struct smp_operations emev2_smp_ops __initdata = { 55struct smp_operations emev2_smp_ops __initdata = {
66 .smp_init_cpus = emev2_smp_init_cpus,
67 .smp_prepare_cpus = emev2_smp_prepare_cpus, 56 .smp_prepare_cpus = emev2_smp_prepare_cpus,
68 .smp_boot_secondary = emev2_boot_secondary, 57 .smp_boot_secondary = emev2_boot_secondary,
69}; 58};
diff --git a/arch/arm/mach-sti/headsmp.S b/arch/arm/mach-sti/headsmp.S
index 78ebc7559f53..4c09bae86edf 100644
--- a/arch/arm/mach-sti/headsmp.S
+++ b/arch/arm/mach-sti/headsmp.S
@@ -16,8 +16,6 @@
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <linux/init.h> 17#include <linux/init.h>
18 18
19 __INIT
20
21/* 19/*
22 * ST specific entry point for secondary CPUs. This provides 20 * ST specific entry point for secondary CPUs. This provides
23 * a "holding pen" into which all secondary cores are held until we're 21 * a "holding pen" into which all secondary cores are held until we're
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 12eee8167525..2061b6a2a766 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -223,10 +223,10 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
223 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", NULL), 223 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", NULL),
224 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", NULL), 224 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", NULL),
225 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat), 225 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
226 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data), 226 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", NULL),
227 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data), 227 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", NULL),
228 OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data), 228 OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", NULL),
229 OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data), 229 OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", NULL),
230 /* Requires clock name bindings. */ 230 /* Requires clock name bindings. */
231 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL), 231 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
232 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL), 232 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c
index f91431963452..7de083d19b7e 100644
--- a/arch/avr32/boards/atngw100/mrmt.c
+++ b/arch/avr32/boards/atngw100/mrmt.c
@@ -150,7 +150,6 @@ static struct ac97c_platform_data __initdata ac97c0_data = {
150static struct platform_device rmt_ts_device = { 150static struct platform_device rmt_ts_device = {
151 .name = "ucb1400_ts", 151 .name = "ucb1400_ts",
152 .id = -1, 152 .id = -1,
153 }
154}; 153};
155#endif 154#endif
156 155
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index 1dc086087a72..fa44f3ec5302 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -17,6 +17,8 @@
17#define current_cpu_type() current_cpu_data.cputype 17#define current_cpu_type() current_cpu_data.cputype
18#endif 18#endif
19 19
20#define boot_cpu_type() cpu_data[0].cputype
21
20/* 22/*
21 * SMP assumption: Options of CPU 0 are a superset of all processors. 23 * SMP assumption: Options of CPU 0 are a superset of all processors.
22 * This is true for all known MIPS systems. 24 * This is true for all known MIPS systems.
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 159abc8842d2..126da74d4c55 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -66,6 +66,8 @@ static void __init bmips_smp_setup(void)
66 int i, cpu = 1, boot_cpu = 0; 66 int i, cpu = 1, boot_cpu = 0;
67 67
68#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) 68#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380)
69 int cpu_hw_intr;
70
69 /* arbitration priority */ 71 /* arbitration priority */
70 clear_c0_brcm_cmt_ctrl(0x30); 72 clear_c0_brcm_cmt_ctrl(0x30);
71 73
@@ -80,8 +82,12 @@ static void __init bmips_smp_setup(void)
80 * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output 82 * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output
81 * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output 83 * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output
82 */ 84 */
83 change_c0_brcm_cmt_intr(0xf8018000, 85 if (boot_cpu == 0)
84 (0x02 << 27) | (0x03 << 15)); 86 cpu_hw_intr = 0x02;
87 else
88 cpu_hw_intr = 0x1d;
89
90 change_c0_brcm_cmt_intr(0xf8018000, (cpu_hw_intr << 27) | (0x03 << 15));
85 91
86 /* single core, 2 threads (2 pipelines) */ 92 /* single core, 2 threads (2 pipelines) */
87 max_cpus = 2; 93 max_cpus = 2;
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index e4b1140cdae0..3a2b6e9f25cf 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -166,7 +166,7 @@ static void mipsxx_reg_setup(struct op_counter_config *ctr)
166 reg.control[i] |= M_PERFCTL_USER; 166 reg.control[i] |= M_PERFCTL_USER;
167 if (ctr[i].exl) 167 if (ctr[i].exl)
168 reg.control[i] |= M_PERFCTL_EXL; 168 reg.control[i] |= M_PERFCTL_EXL;
169 if (current_cpu_type() == CPU_XLR) 169 if (boot_cpu_type() == CPU_XLR)
170 reg.control[i] |= M_PERFCTL_COUNT_ALL_THREADS; 170 reg.control[i] |= M_PERFCTL_COUNT_ALL_THREADS;
171 reg.counter[i] = 0x80000000 - ctr[i].count; 171 reg.counter[i] = 0x80000000 - ctr[i].count;
172 } 172 }
diff --git a/arch/mips/pnx833x/common/platform.c b/arch/mips/pnx833x/common/platform.c
index d22dc0d6f289..2b7e837dc2e2 100644
--- a/arch/mips/pnx833x/common/platform.c
+++ b/arch/mips/pnx833x/common/platform.c
@@ -206,11 +206,13 @@ static struct resource pnx833x_ethernet_resources[] = {
206 .end = PNX8335_IP3902_PORTS_END, 206 .end = PNX8335_IP3902_PORTS_END,
207 .flags = IORESOURCE_MEM, 207 .flags = IORESOURCE_MEM,
208 }, 208 },
209#ifdef CONFIG_SOC_PNX8335
209 [1] = { 210 [1] = {
210 .start = PNX8335_PIC_ETHERNET_INT, 211 .start = PNX8335_PIC_ETHERNET_INT,
211 .end = PNX8335_PIC_ETHERNET_INT, 212 .end = PNX8335_PIC_ETHERNET_INT,
212 .flags = IORESOURCE_IRQ, 213 .flags = IORESOURCE_IRQ,
213 }, 214 },
215#endif
214}; 216};
215 217
216static struct platform_device pnx833x_ethernet_device = { 218static struct platform_device pnx833x_ethernet_device = {
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 3bf72cd2c8fc..dbd9d3c991e8 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -566,7 +566,7 @@ config SCHED_SMT
566config PPC_DENORMALISATION 566config PPC_DENORMALISATION
567 bool "PowerPC denormalisation exception handling" 567 bool "PowerPC denormalisation exception handling"
568 depends on PPC_BOOK3S_64 568 depends on PPC_BOOK3S_64
569 default "n" 569 default "y" if PPC_POWERNV
570 ---help--- 570 ---help---
571 Add support for handling denormalisation of single precision 571 Add support for handling denormalisation of single precision
572 values. Useful for bare metal only. If unsure say Y here. 572 values. Useful for bare metal only. If unsure say Y here.
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 47a35b08b963..e378cccfca55 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -247,6 +247,10 @@ struct thread_struct {
247 unsigned long tm_orig_msr; /* Thread's MSR on ctx switch */ 247 unsigned long tm_orig_msr; /* Thread's MSR on ctx switch */
248 struct pt_regs ckpt_regs; /* Checkpointed registers */ 248 struct pt_regs ckpt_regs; /* Checkpointed registers */
249 249
250 unsigned long tm_tar;
251 unsigned long tm_ppr;
252 unsigned long tm_dscr;
253
250 /* 254 /*
251 * Transactional FP and VSX 0-31 register set. 255 * Transactional FP and VSX 0-31 register set.
252 * NOTE: the sense of these is the opposite of the integer ckpt_regs! 256 * NOTE: the sense of these is the opposite of the integer ckpt_regs!
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index a6840e4e24f7..99222e27f173 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -254,19 +254,28 @@
254#define SPRN_HRMOR 0x139 /* Real mode offset register */ 254#define SPRN_HRMOR 0x139 /* Real mode offset register */
255#define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */ 255#define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */
256#define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */ 256#define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */
257/* HFSCR and FSCR bit numbers are the same */
258#define FSCR_TAR_LG 8 /* Enable Target Address Register */
259#define FSCR_EBB_LG 7 /* Enable Event Based Branching */
260#define FSCR_TM_LG 5 /* Enable Transactional Memory */
261#define FSCR_PM_LG 4 /* Enable prob/priv access to PMU SPRs */
262#define FSCR_BHRB_LG 3 /* Enable Branch History Rolling Buffer*/
263#define FSCR_DSCR_LG 2 /* Enable Data Stream Control Register */
264#define FSCR_VECVSX_LG 1 /* Enable VMX/VSX */
265#define FSCR_FP_LG 0 /* Enable Floating Point */
257#define SPRN_FSCR 0x099 /* Facility Status & Control Register */ 266#define SPRN_FSCR 0x099 /* Facility Status & Control Register */
258#define FSCR_TAR (1 << (63-55)) /* Enable Target Address Register */ 267#define FSCR_TAR __MASK(FSCR_TAR_LG)
259#define FSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */ 268#define FSCR_EBB __MASK(FSCR_EBB_LG)
260#define FSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */ 269#define FSCR_DSCR __MASK(FSCR_DSCR_LG)
261#define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */ 270#define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */
262#define HFSCR_TAR (1 << (63-55)) /* Enable Target Address Register */ 271#define HFSCR_TAR __MASK(FSCR_TAR_LG)
263#define HFSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */ 272#define HFSCR_EBB __MASK(FSCR_EBB_LG)
264#define HFSCR_TM (1 << (63-58)) /* Enable Transactional Memory */ 273#define HFSCR_TM __MASK(FSCR_TM_LG)
265#define HFSCR_PM (1 << (63-60)) /* Enable prob/priv access to PMU SPRs */ 274#define HFSCR_PM __MASK(FSCR_PM_LG)
266#define HFSCR_BHRB (1 << (63-59)) /* Enable Branch History Rolling Buffer*/ 275#define HFSCR_BHRB __MASK(FSCR_BHRB_LG)
267#define HFSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */ 276#define HFSCR_DSCR __MASK(FSCR_DSCR_LG)
268#define HFSCR_VECVSX (1 << (63-62)) /* Enable VMX/VSX */ 277#define HFSCR_VECVSX __MASK(FSCR_VECVSX_LG)
269#define HFSCR_FP (1 << (63-63)) /* Enable Floating Point */ 278#define HFSCR_FP __MASK(FSCR_FP_LG)
270#define SPRN_TAR 0x32f /* Target Address Register */ 279#define SPRN_TAR 0x32f /* Target Address Register */
271#define SPRN_LPCR 0x13E /* LPAR Control Register */ 280#define SPRN_LPCR 0x13E /* LPAR Control Register */
272#define LPCR_VPM0 (1ul << (63-0)) 281#define LPCR_VPM0 (1ul << (63-0))
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 49a13e0ef234..294c2cedcf7a 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -15,6 +15,15 @@ extern struct task_struct *__switch_to(struct task_struct *,
15struct thread_struct; 15struct thread_struct;
16extern struct task_struct *_switch(struct thread_struct *prev, 16extern struct task_struct *_switch(struct thread_struct *prev,
17 struct thread_struct *next); 17 struct thread_struct *next);
18#ifdef CONFIG_PPC_BOOK3S_64
19static inline void save_tar(struct thread_struct *prev)
20{
21 if (cpu_has_feature(CPU_FTR_ARCH_207S))
22 prev->tar = mfspr(SPRN_TAR);
23}
24#else
25static inline void save_tar(struct thread_struct *prev) {}
26#endif
18 27
19extern void giveup_fpu(struct task_struct *); 28extern void giveup_fpu(struct task_struct *);
20extern void load_up_fpu(void); 29extern void load_up_fpu(void);
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index c7e8afc2ead0..8207459efe56 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -138,6 +138,9 @@ int main(void)
138 DEFINE(THREAD_TM_TFHAR, offsetof(struct thread_struct, tm_tfhar)); 138 DEFINE(THREAD_TM_TFHAR, offsetof(struct thread_struct, tm_tfhar));
139 DEFINE(THREAD_TM_TEXASR, offsetof(struct thread_struct, tm_texasr)); 139 DEFINE(THREAD_TM_TEXASR, offsetof(struct thread_struct, tm_texasr));
140 DEFINE(THREAD_TM_TFIAR, offsetof(struct thread_struct, tm_tfiar)); 140 DEFINE(THREAD_TM_TFIAR, offsetof(struct thread_struct, tm_tfiar));
141 DEFINE(THREAD_TM_TAR, offsetof(struct thread_struct, tm_tar));
142 DEFINE(THREAD_TM_PPR, offsetof(struct thread_struct, tm_ppr));
143 DEFINE(THREAD_TM_DSCR, offsetof(struct thread_struct, tm_dscr));
141 DEFINE(PT_CKPT_REGS, offsetof(struct thread_struct, ckpt_regs)); 144 DEFINE(PT_CKPT_REGS, offsetof(struct thread_struct, ckpt_regs));
142 DEFINE(THREAD_TRANSACT_VR0, offsetof(struct thread_struct, 145 DEFINE(THREAD_TRANSACT_VR0, offsetof(struct thread_struct,
143 transact_vr[0])); 146 transact_vr[0]));
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index ea9414c8088d..55593ee2d5aa 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -1061,7 +1061,7 @@ static const struct file_operations proc_eeh_operations = {
1061 1061
1062static int __init eeh_init_proc(void) 1062static int __init eeh_init_proc(void)
1063{ 1063{
1064 if (machine_is(pseries)) 1064 if (machine_is(pseries) || machine_is(powernv))
1065 proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations); 1065 proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations);
1066 return 0; 1066 return 0;
1067} 1067}
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index ab15b8d057ad..2bd0b885b0fe 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -449,15 +449,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_DSCR)
449 449
450#ifdef CONFIG_PPC_BOOK3S_64 450#ifdef CONFIG_PPC_BOOK3S_64
451BEGIN_FTR_SECTION 451BEGIN_FTR_SECTION
452 /*
453 * Back up the TAR across context switches. Note that the TAR is not
454 * available for use in the kernel. (To provide this, the TAR should
455 * be backed up/restored on exception entry/exit instead, and be in
456 * pt_regs. FIXME, this should be in pt_regs anyway (for debug).)
457 */
458 mfspr r0,SPRN_TAR
459 std r0,THREAD_TAR(r3)
460
461 /* Event based branch registers */ 452 /* Event based branch registers */
462 mfspr r0, SPRN_BESCR 453 mfspr r0, SPRN_BESCR
463 std r0, THREAD_BESCR(r3) 454 std r0, THREAD_BESCR(r3)
@@ -584,9 +575,34 @@ BEGIN_FTR_SECTION
584 ld r7,DSCR_DEFAULT@toc(2) 575 ld r7,DSCR_DEFAULT@toc(2)
585 ld r0,THREAD_DSCR(r4) 576 ld r0,THREAD_DSCR(r4)
586 cmpwi r6,0 577 cmpwi r6,0
578 li r8, FSCR_DSCR
587 bne 1f 579 bne 1f
588 ld r0,0(r7) 580 ld r0,0(r7)
5891: cmpd r0,r25 581 b 3f
5821:
583 BEGIN_FTR_SECTION_NESTED(70)
584 mfspr r6, SPRN_FSCR
585 or r6, r6, r8
586 mtspr SPRN_FSCR, r6
587 BEGIN_FTR_SECTION_NESTED(69)
588 mfspr r6, SPRN_HFSCR
589 or r6, r6, r8
590 mtspr SPRN_HFSCR, r6
591 END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69)
592 b 4f
593 END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70)
5943:
595 BEGIN_FTR_SECTION_NESTED(70)
596 mfspr r6, SPRN_FSCR
597 andc r6, r6, r8
598 mtspr SPRN_FSCR, r6
599 BEGIN_FTR_SECTION_NESTED(69)
600 mfspr r6, SPRN_HFSCR
601 andc r6, r6, r8
602 mtspr SPRN_HFSCR, r6
603 END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69)
604 END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70)
6054: cmpd r0,r25
590 beq 2f 606 beq 2f
591 mtspr SPRN_DSCR,r0 607 mtspr SPRN_DSCR,r0
5922: 6082:
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 4e00d223b2e3..902ca3c6b4b6 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -848,7 +848,7 @@ hv_facility_unavailable_relon_trampoline:
848 . = 0x4f80 848 . = 0x4f80
849 SET_SCRATCH0(r13) 849 SET_SCRATCH0(r13)
850 EXCEPTION_PROLOG_0(PACA_EXGEN) 850 EXCEPTION_PROLOG_0(PACA_EXGEN)
851 b facility_unavailable_relon_hv 851 b hv_facility_unavailable_relon_hv
852 852
853 STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint) 853 STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint)
854#ifdef CONFIG_PPC_DENORMALISATION 854#ifdef CONFIG_PPC_DENORMALISATION
@@ -1175,6 +1175,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
1175 b .ret_from_except 1175 b .ret_from_except
1176 1176
1177 STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception) 1177 STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception)
1178 STD_EXCEPTION_COMMON(0xf80, hv_facility_unavailable, .facility_unavailable_exception)
1178 1179
1179 .align 7 1180 .align 7
1180 .globl __end_handlers 1181 .globl __end_handlers
@@ -1188,7 +1189,7 @@ __end_handlers:
1188 STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable) 1189 STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
1189 STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable) 1190 STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
1190 STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable) 1191 STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
1191 STD_RELON_EXCEPTION_HV_OOL(0xf80, facility_unavailable) 1192 STD_RELON_EXCEPTION_HV_OOL(0xf80, hv_facility_unavailable)
1192 1193
1193#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) 1194#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
1194/* 1195/*
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index c517dbe705fd..8083be20fe5e 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -600,6 +600,16 @@ struct task_struct *__switch_to(struct task_struct *prev,
600 struct ppc64_tlb_batch *batch; 600 struct ppc64_tlb_batch *batch;
601#endif 601#endif
602 602
603 /* Back up the TAR across context switches.
604 * Note that the TAR is not available for use in the kernel. (To
605 * provide this, the TAR should be backed up/restored on exception
606 * entry/exit instead, and be in pt_regs. FIXME, this should be in
607 * pt_regs anyway (for debug).)
608 * Save the TAR here before we do treclaim/trecheckpoint as these
609 * will change the TAR.
610 */
611 save_tar(&prev->thread);
612
603 __switch_to_tm(prev); 613 __switch_to_tm(prev);
604 614
605#ifdef CONFIG_SMP 615#ifdef CONFIG_SMP
diff --git a/arch/powerpc/kernel/tm.S b/arch/powerpc/kernel/tm.S
index 51be8fb24803..0554d1f6d70d 100644
--- a/arch/powerpc/kernel/tm.S
+++ b/arch/powerpc/kernel/tm.S
@@ -233,6 +233,16 @@ dont_backup_fp:
233 std r5, _CCR(r7) 233 std r5, _CCR(r7)
234 std r6, _XER(r7) 234 std r6, _XER(r7)
235 235
236
237 /* ******************** TAR, PPR, DSCR ********** */
238 mfspr r3, SPRN_TAR
239 mfspr r4, SPRN_PPR
240 mfspr r5, SPRN_DSCR
241
242 std r3, THREAD_TM_TAR(r12)
243 std r4, THREAD_TM_PPR(r12)
244 std r5, THREAD_TM_DSCR(r12)
245
236 /* MSR and flags: We don't change CRs, and we don't need to alter 246 /* MSR and flags: We don't change CRs, and we don't need to alter
237 * MSR. 247 * MSR.
238 */ 248 */
@@ -347,6 +357,16 @@ dont_restore_fp:
347 mtmsr r6 /* FP/Vec off again! */ 357 mtmsr r6 /* FP/Vec off again! */
348 358
349restore_gprs: 359restore_gprs:
360
361 /* ******************** TAR, PPR, DSCR ********** */
362 ld r4, THREAD_TM_TAR(r3)
363 ld r5, THREAD_TM_PPR(r3)
364 ld r6, THREAD_TM_DSCR(r3)
365
366 mtspr SPRN_TAR, r4
367 mtspr SPRN_PPR, r5
368 mtspr SPRN_DSCR, r6
369
350 /* ******************** CR,LR,CCR,MSR ********** */ 370 /* ******************** CR,LR,CCR,MSR ********** */
351 ld r3, _CTR(r7) 371 ld r3, _CTR(r7)
352 ld r4, _LINK(r7) 372 ld r4, _LINK(r7)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index bf33c22e38a4..e435bc089ea3 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -44,9 +44,7 @@
44#include <asm/machdep.h> 44#include <asm/machdep.h>
45#include <asm/rtas.h> 45#include <asm/rtas.h>
46#include <asm/pmc.h> 46#include <asm/pmc.h>
47#ifdef CONFIG_PPC32
48#include <asm/reg.h> 47#include <asm/reg.h>
49#endif
50#ifdef CONFIG_PMAC_BACKLIGHT 48#ifdef CONFIG_PMAC_BACKLIGHT
51#include <asm/backlight.h> 49#include <asm/backlight.h>
52#endif 50#endif
@@ -1296,43 +1294,54 @@ void vsx_unavailable_exception(struct pt_regs *regs)
1296 die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT); 1294 die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT);
1297} 1295}
1298 1296
1297#ifdef CONFIG_PPC64
1299void facility_unavailable_exception(struct pt_regs *regs) 1298void facility_unavailable_exception(struct pt_regs *regs)
1300{ 1299{
1301 static char *facility_strings[] = { 1300 static char *facility_strings[] = {
1302 "FPU", 1301 [FSCR_FP_LG] = "FPU",
1303 "VMX/VSX", 1302 [FSCR_VECVSX_LG] = "VMX/VSX",
1304 "DSCR", 1303 [FSCR_DSCR_LG] = "DSCR",
1305 "PMU SPRs", 1304 [FSCR_PM_LG] = "PMU SPRs",
1306 "BHRB", 1305 [FSCR_BHRB_LG] = "BHRB",
1307 "TM", 1306 [FSCR_TM_LG] = "TM",
1308 "AT", 1307 [FSCR_EBB_LG] = "EBB",
1309 "EBB", 1308 [FSCR_TAR_LG] = "TAR",
1310 "TAR",
1311 }; 1309 };
1312 char *facility, *prefix; 1310 char *facility = "unknown";
1313 u64 value; 1311 u64 value;
1312 u8 status;
1313 bool hv;
1314 1314
1315 if (regs->trap == 0xf60) { 1315 hv = (regs->trap == 0xf80);
1316 value = mfspr(SPRN_FSCR); 1316 if (hv)
1317 prefix = "";
1318 } else {
1319 value = mfspr(SPRN_HFSCR); 1317 value = mfspr(SPRN_HFSCR);
1320 prefix = "Hypervisor "; 1318 else
1319 value = mfspr(SPRN_FSCR);
1320
1321 status = value >> 56;
1322 if (status == FSCR_DSCR_LG) {
1323 /* User is acessing the DSCR. Set the inherit bit and allow
1324 * the user to set it directly in future by setting via the
1325 * H/FSCR DSCR bit.
1326 */
1327 current->thread.dscr_inherit = 1;
1328 if (hv)
1329 mtspr(SPRN_HFSCR, value | HFSCR_DSCR);
1330 else
1331 mtspr(SPRN_FSCR, value | FSCR_DSCR);
1332 return;
1321 } 1333 }
1322 1334
1323 value = value >> 56; 1335 if ((status < ARRAY_SIZE(facility_strings)) &&
1336 facility_strings[status])
1337 facility = facility_strings[status];
1324 1338
1325 /* We restore the interrupt state now */ 1339 /* We restore the interrupt state now */
1326 if (!arch_irq_disabled_regs(regs)) 1340 if (!arch_irq_disabled_regs(regs))
1327 local_irq_enable(); 1341 local_irq_enable();
1328 1342
1329 if (value < ARRAY_SIZE(facility_strings))
1330 facility = facility_strings[value];
1331 else
1332 facility = "unknown";
1333
1334 pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n", 1343 pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n",
1335 prefix, facility, regs->nip, regs->msr); 1344 hv ? "Hypervisor " : "", facility, regs->nip, regs->msr);
1336 1345
1337 if (user_mode(regs)) { 1346 if (user_mode(regs)) {
1338 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); 1347 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
@@ -1341,6 +1350,7 @@ void facility_unavailable_exception(struct pt_regs *regs)
1341 1350
1342 die("Unexpected facility unavailable exception", regs, SIGABRT); 1351 die("Unexpected facility unavailable exception", regs, SIGABRT);
1343} 1352}
1353#endif
1344 1354
1345#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1355#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1346 1356
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 2efa9dde741a..7629cd3eb91a 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1809,7 +1809,7 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1809 rma_size <<= PAGE_SHIFT; 1809 rma_size <<= PAGE_SHIFT;
1810 rmls = lpcr_rmls(rma_size); 1810 rmls = lpcr_rmls(rma_size);
1811 err = -EINVAL; 1811 err = -EINVAL;
1812 if (rmls < 0) { 1812 if ((long)rmls < 0) {
1813 pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size); 1813 pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size);
1814 goto out_srcu; 1814 goto out_srcu;
1815 } 1815 }
@@ -1874,7 +1874,7 @@ int kvmppc_core_init_vm(struct kvm *kvm)
1874 /* Allocate the guest's logical partition ID */ 1874 /* Allocate the guest's logical partition ID */
1875 1875
1876 lpid = kvmppc_alloc_lpid(); 1876 lpid = kvmppc_alloc_lpid();
1877 if (lpid < 0) 1877 if ((long)lpid < 0)
1878 return -ENOMEM; 1878 return -ENOMEM;
1879 kvm->arch.lpid = lpid; 1879 kvm->arch.lpid = lpid;
1880 1880
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 19498a567a81..c6e13d9a9e15 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1047,11 +1047,12 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
1047 if (err) 1047 if (err)
1048 goto free_shadow_vcpu; 1048 goto free_shadow_vcpu;
1049 1049
1050 err = -ENOMEM;
1050 p = __get_free_page(GFP_KERNEL|__GFP_ZERO); 1051 p = __get_free_page(GFP_KERNEL|__GFP_ZERO);
1051 /* the real shared page fills the last 4k of our page */
1052 vcpu->arch.shared = (void*)(p + PAGE_SIZE - 4096);
1053 if (!p) 1052 if (!p)
1054 goto uninit_vcpu; 1053 goto uninit_vcpu;
1054 /* the real shared page fills the last 4k of our page */
1055 vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096);
1055 1056
1056#ifdef CONFIG_PPC_BOOK3S_64 1057#ifdef CONFIG_PPC_BOOK3S_64
1057 /* default to book3s_64 (970fx) */ 1058 /* default to book3s_64 (970fx) */
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 9f8671a44551..6a5f2b1f32ca 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -569,35 +569,6 @@ error:
569 return ret; 569 return ret;
570} 570}
571 571
572static int unzip_oops(char *oops_buf, char *big_buf)
573{
574 struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf;
575 u64 timestamp = oops_hdr->timestamp;
576 char *big_oops_data = NULL;
577 char *oops_data_buf = NULL;
578 size_t big_oops_data_sz;
579 int unzipped_len;
580
581 big_oops_data = big_buf + sizeof(struct oops_log_info);
582 big_oops_data_sz = big_oops_buf_sz - sizeof(struct oops_log_info);
583 oops_data_buf = oops_buf + sizeof(struct oops_log_info);
584
585 unzipped_len = nvram_decompress(oops_data_buf, big_oops_data,
586 oops_hdr->report_length,
587 big_oops_data_sz);
588
589 if (unzipped_len < 0) {
590 pr_err("nvram: decompression failed; returned %d\n",
591 unzipped_len);
592 return -1;
593 }
594 oops_hdr = (struct oops_log_info *)big_buf;
595 oops_hdr->version = OOPS_HDR_VERSION;
596 oops_hdr->report_length = (u16) unzipped_len;
597 oops_hdr->timestamp = timestamp;
598 return 0;
599}
600
601static int nvram_pstore_open(struct pstore_info *psi) 572static int nvram_pstore_open(struct pstore_info *psi)
602{ 573{
603 /* Reset the iterator to start reading partitions again */ 574 /* Reset the iterator to start reading partitions again */
@@ -685,10 +656,9 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
685 unsigned int err_type, id_no, size = 0; 656 unsigned int err_type, id_no, size = 0;
686 struct nvram_os_partition *part = NULL; 657 struct nvram_os_partition *part = NULL;
687 char *buff = NULL, *big_buff = NULL; 658 char *buff = NULL, *big_buff = NULL;
688 int rc, sig = 0; 659 int sig = 0;
689 loff_t p; 660 loff_t p;
690 661
691read_partition:
692 read_type++; 662 read_type++;
693 663
694 switch (nvram_type_ids[read_type]) { 664 switch (nvram_type_ids[read_type]) {
@@ -749,30 +719,46 @@ read_partition:
749 *id = id_no; 719 *id = id_no;
750 720
751 if (nvram_type_ids[read_type] == PSTORE_TYPE_DMESG) { 721 if (nvram_type_ids[read_type] == PSTORE_TYPE_DMESG) {
722 int length, unzipped_len;
723 size_t hdr_size;
724
752 oops_hdr = (struct oops_log_info *)buff; 725 oops_hdr = (struct oops_log_info *)buff;
753 *buf = buff + sizeof(*oops_hdr); 726 if (oops_hdr->version < OOPS_HDR_VERSION) {
727 /* Old format oops header had 2-byte record size */
728 hdr_size = sizeof(u16);
729 length = oops_hdr->version;
730 time->tv_sec = 0;
731 time->tv_nsec = 0;
732 } else {
733 hdr_size = sizeof(*oops_hdr);
734 length = oops_hdr->report_length;
735 time->tv_sec = oops_hdr->timestamp;
736 time->tv_nsec = 0;
737 }
738 *buf = kmalloc(length, GFP_KERNEL);
739 if (*buf == NULL)
740 return -ENOMEM;
741 memcpy(*buf, buff + hdr_size, length);
742 kfree(buff);
754 743
755 if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) { 744 if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) {
756 big_buff = kmalloc(big_oops_buf_sz, GFP_KERNEL); 745 big_buff = kmalloc(big_oops_buf_sz, GFP_KERNEL);
757 if (!big_buff) 746 if (!big_buff)
758 return -ENOMEM; 747 return -ENOMEM;
759 748
760 rc = unzip_oops(buff, big_buff); 749 unzipped_len = nvram_decompress(*buf, big_buff,
750 length, big_oops_buf_sz);
761 751
762 if (rc != 0) { 752 if (unzipped_len < 0) {
763 kfree(buff); 753 pr_err("nvram: decompression failed, returned "
754 "rc %d\n", unzipped_len);
764 kfree(big_buff); 755 kfree(big_buff);
765 goto read_partition; 756 } else {
757 *buf = big_buff;
758 length = unzipped_len;
766 } 759 }
767
768 oops_hdr = (struct oops_log_info *)big_buff;
769 *buf = big_buff + sizeof(*oops_hdr);
770 kfree(buff);
771 } 760 }
772 761 return length;
773 time->tv_sec = oops_hdr->timestamp;
774 time->tv_nsec = 0;
775 return oops_hdr->report_length;
776 } 762 }
777 763
778 *buf = buff; 764 *buf = buff;
@@ -816,6 +802,7 @@ static int nvram_pstore_init(void)
816static void __init nvram_init_oops_partition(int rtas_partition_exists) 802static void __init nvram_init_oops_partition(int rtas_partition_exists)
817{ 803{
818 int rc; 804 int rc;
805 size_t size;
819 806
820 rc = pseries_nvram_init_os_partition(&oops_log_partition); 807 rc = pseries_nvram_init_os_partition(&oops_log_partition);
821 if (rc != 0) { 808 if (rc != 0) {
@@ -844,8 +831,9 @@ static void __init nvram_init_oops_partition(int rtas_partition_exists)
844 big_oops_buf_sz = (oops_data_sz * 100) / 45; 831 big_oops_buf_sz = (oops_data_sz * 100) / 45;
845 big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); 832 big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
846 if (big_oops_buf) { 833 if (big_oops_buf) {
847 stream.workspace = kmalloc(zlib_deflate_workspacesize( 834 size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL),
848 WINDOW_BITS, MEM_LEVEL), GFP_KERNEL); 835 zlib_inflate_workspacesize());
836 stream.workspace = kmalloc(size, GFP_KERNEL);
849 if (!stream.workspace) { 837 if (!stream.workspace) {
850 pr_err("nvram: No memory for compression workspace; " 838 pr_err("nvram: No memory for compression workspace; "
851 "skipping compression of %s partition data\n", 839 "skipping compression of %s partition data\n",
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 22f75b504f7f..8a4cae78f03c 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -118,6 +118,7 @@ config S390
118 select HAVE_FUNCTION_TRACE_MCOUNT_TEST 118 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
119 select HAVE_KERNEL_BZIP2 119 select HAVE_KERNEL_BZIP2
120 select HAVE_KERNEL_GZIP 120 select HAVE_KERNEL_GZIP
121 select HAVE_KERNEL_LZ4
121 select HAVE_KERNEL_LZMA 122 select HAVE_KERNEL_LZMA
122 select HAVE_KERNEL_LZO 123 select HAVE_KERNEL_LZO
123 select HAVE_KERNEL_XZ 124 select HAVE_KERNEL_XZ
@@ -227,11 +228,12 @@ config MARCH_Z196
227 not work on older machines. 228 not work on older machines.
228 229
229config MARCH_ZEC12 230config MARCH_ZEC12
230 bool "IBM zEC12" 231 bool "IBM zBC12 and zEC12"
231 select HAVE_MARCH_ZEC12_FEATURES if 64BIT 232 select HAVE_MARCH_ZEC12_FEATURES if 64BIT
232 help 233 help
233 Select this to enable optimizations for IBM zEC12 (2827 series). The 234 Select this to enable optimizations for IBM zBC12 and zEC12 (2828 and
234 kernel will be slightly faster but will not work on older machines. 235 2827 series). The kernel will be slightly faster but will not work on
236 older machines.
235 237
236endchoice 238endchoice
237 239
@@ -709,6 +711,7 @@ config S390_GUEST
709 def_bool y 711 def_bool y
710 prompt "s390 support for virtio devices" 712 prompt "s390 support for virtio devices"
711 depends on 64BIT 713 depends on 64BIT
714 select TTY
712 select VIRTUALIZATION 715 select VIRTUALIZATION
713 select VIRTIO 716 select VIRTIO
714 select VIRTIO_CONSOLE 717 select VIRTIO_CONSOLE
diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile
index 3ad8f61c9985..866ecbe670e4 100644
--- a/arch/s390/boot/compressed/Makefile
+++ b/arch/s390/boot/compressed/Makefile
@@ -6,9 +6,9 @@
6 6
7BITS := $(if $(CONFIG_64BIT),64,31) 7BITS := $(if $(CONFIG_64BIT),64,31)
8 8
9targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ 9targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
10 vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo misc.o piggy.o \ 10targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
11 sizes.h head$(BITS).o 11targets += misc.o piggy.o sizes.h head$(BITS).o
12 12
13KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 13KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
14KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING 14KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
@@ -48,6 +48,7 @@ vmlinux.bin.all-y := $(obj)/vmlinux.bin
48 48
49suffix-$(CONFIG_KERNEL_GZIP) := gz 49suffix-$(CONFIG_KERNEL_GZIP) := gz
50suffix-$(CONFIG_KERNEL_BZIP2) := bz2 50suffix-$(CONFIG_KERNEL_BZIP2) := bz2
51suffix-$(CONFIG_KERNEL_LZ4) := lz4
51suffix-$(CONFIG_KERNEL_LZMA) := lzma 52suffix-$(CONFIG_KERNEL_LZMA) := lzma
52suffix-$(CONFIG_KERNEL_LZO) := lzo 53suffix-$(CONFIG_KERNEL_LZO) := lzo
53suffix-$(CONFIG_KERNEL_XZ) := xz 54suffix-$(CONFIG_KERNEL_XZ) := xz
@@ -56,6 +57,8 @@ $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
56 $(call if_changed,gzip) 57 $(call if_changed,gzip)
57$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) 58$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
58 $(call if_changed,bzip2) 59 $(call if_changed,bzip2)
60$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y)
61 $(call if_changed,lz4)
59$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) 62$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
60 $(call if_changed,lzma) 63 $(call if_changed,lzma)
61$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) 64$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y)
diff --git a/arch/s390/boot/compressed/misc.c b/arch/s390/boot/compressed/misc.c
index c4c6a1cf221b..57cbaff1f397 100644
--- a/arch/s390/boot/compressed/misc.c
+++ b/arch/s390/boot/compressed/misc.c
@@ -47,6 +47,10 @@ static unsigned long free_mem_end_ptr;
47#include "../../../../lib/decompress_bunzip2.c" 47#include "../../../../lib/decompress_bunzip2.c"
48#endif 48#endif
49 49
50#ifdef CONFIG_KERNEL_LZ4
51#include "../../../../lib/decompress_unlz4.c"
52#endif
53
50#ifdef CONFIG_KERNEL_LZMA 54#ifdef CONFIG_KERNEL_LZMA
51#include "../../../../lib/decompress_unlzma.c" 55#include "../../../../lib/decompress_unlzma.c"
52#endif 56#endif
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 4d8604e311f3..7d4676758733 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -693,7 +693,7 @@ static inline int find_next_bit_left(const unsigned long *addr,
693 size -= offset; 693 size -= offset;
694 p = addr + offset / BITS_PER_LONG; 694 p = addr + offset / BITS_PER_LONG;
695 if (bit) { 695 if (bit) {
696 set = __flo_word(0, *p & (~0UL << bit)); 696 set = __flo_word(0, *p & (~0UL >> bit));
697 if (set >= size) 697 if (set >= size)
698 return size + offset; 698 return size + offset;
699 if (set < BITS_PER_LONG) 699 if (set < BITS_PER_LONG)
diff --git a/arch/s390/kernel/perf_event.c b/arch/s390/kernel/perf_event.c
index a6fc037671b1..500aa1029bcb 100644
--- a/arch/s390/kernel/perf_event.c
+++ b/arch/s390/kernel/perf_event.c
@@ -52,12 +52,13 @@ static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs)
52 52
53static bool is_in_guest(struct pt_regs *regs) 53static bool is_in_guest(struct pt_regs *regs)
54{ 54{
55 unsigned long ip = instruction_pointer(regs);
56
57 if (user_mode(regs)) 55 if (user_mode(regs))
58 return false; 56 return false;
59 57#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE)
60 return ip == (unsigned long) &sie_exit; 58 return instruction_pointer(regs) == (unsigned long) &sie_exit;
59#else
60 return false;
61#endif
61} 62}
62 63
63static unsigned long guest_is_user_mode(struct pt_regs *regs) 64static unsigned long guest_is_user_mode(struct pt_regs *regs)
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 497451ec5e26..aeed8a61fa0d 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -994,6 +994,7 @@ static void __init setup_hwcaps(void)
994 strcpy(elf_platform, "z196"); 994 strcpy(elf_platform, "z196");
995 break; 995 break;
996 case 0x2827: 996 case 0x2827:
997 case 0x2828:
997 strcpy(elf_platform, "zEC12"); 998 strcpy(elf_platform, "zEC12");
998 break; 999 break;
999 } 1000 }
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index ba694d2ba51e..34c1c9a90be2 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -702,14 +702,25 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
702 return rc; 702 return rc;
703 703
704 vcpu->arch.sie_block->icptcode = 0; 704 vcpu->arch.sie_block->icptcode = 0;
705 preempt_disable();
706 kvm_guest_enter();
707 preempt_enable();
708 VCPU_EVENT(vcpu, 6, "entering sie flags %x", 705 VCPU_EVENT(vcpu, 6, "entering sie flags %x",
709 atomic_read(&vcpu->arch.sie_block->cpuflags)); 706 atomic_read(&vcpu->arch.sie_block->cpuflags));
710 trace_kvm_s390_sie_enter(vcpu, 707 trace_kvm_s390_sie_enter(vcpu,
711 atomic_read(&vcpu->arch.sie_block->cpuflags)); 708 atomic_read(&vcpu->arch.sie_block->cpuflags));
709
710 /*
711 * As PF_VCPU will be used in fault handler, between guest_enter
712 * and guest_exit should be no uaccess.
713 */
714 preempt_disable();
715 kvm_guest_enter();
716 preempt_enable();
712 rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs); 717 rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs);
718 kvm_guest_exit();
719
720 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
721 vcpu->arch.sie_block->icptcode);
722 trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode);
723
713 if (rc > 0) 724 if (rc > 0)
714 rc = 0; 725 rc = 0;
715 if (rc < 0) { 726 if (rc < 0) {
@@ -721,10 +732,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
721 rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 732 rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
722 } 733 }
723 } 734 }
724 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
725 vcpu->arch.sie_block->icptcode);
726 trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode);
727 kvm_guest_exit();
728 735
729 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); 736 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16);
730 return rc; 737 return rc;
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 0da3e6eb6be6..4cdc54e63ebc 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -16,6 +16,7 @@
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/compat.h> 17#include <linux/compat.h>
18#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
19#include <asm/facility.h>
19#include <asm/current.h> 20#include <asm/current.h>
20#include <asm/debug.h> 21#include <asm/debug.h>
21#include <asm/ebcdic.h> 22#include <asm/ebcdic.h>
@@ -532,8 +533,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
532 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 533 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
533 534
534 /* Only provide non-quiescing support if the host supports it */ 535 /* Only provide non-quiescing support if the host supports it */
535 if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && 536 if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && !test_facility(14))
536 S390_lowcore.stfl_fac_list & 0x00020000)
537 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 537 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
538 538
539 /* No support for conditional-SSKE */ 539 /* No support for conditional-SSKE */
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index ce36ea80e4f9..ad446b0c55b6 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -69,6 +69,7 @@ static void __init setup_zero_pages(void)
69 order = 2; 69 order = 2;
70 break; 70 break;
71 case 0x2827: /* zEC12 */ 71 case 0x2827: /* zEC12 */
72 case 0x2828: /* zEC12 */
72 default: 73 default:
73 order = 5; 74 order = 5;
74 break; 75 break;
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
index ffeb17ce7f31..930783d2c99b 100644
--- a/arch/s390/oprofile/init.c
+++ b/arch/s390/oprofile/init.c
@@ -440,7 +440,7 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops)
440 switch (id.machine) { 440 switch (id.machine) {
441 case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break; 441 case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break;
442 case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break; 442 case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break;
443 case 0x2827: ops->cpu_type = "s390/zEC12"; break; 443 case 0x2827: case 0x2828: ops->cpu_type = "s390/zEC12"; break;
444 default: return -ENODEV; 444 default: return -ENODEV;
445 } 445 }
446 } 446 }
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index d606463aa6d6..b7388a425f09 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -225,7 +225,7 @@ static void low_free(unsigned long size, unsigned long addr)
225 unsigned long nr_pages; 225 unsigned long nr_pages;
226 226
227 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; 227 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
228 efi_call_phys2(sys_table->boottime->free_pages, addr, size); 228 efi_call_phys2(sys_table->boottime->free_pages, addr, nr_pages);
229} 229}
230 230
231static void find_bits(unsigned long mask, u8 *pos, u8 *size) 231static void find_bits(unsigned long mask, u8 *pos, u8 *size)
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 94ab6b90dd3f..63bdb29b2549 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -196,15 +196,23 @@ static void __init ati_bugs_contd(int num, int slot, int func)
196static void __init intel_remapping_check(int num, int slot, int func) 196static void __init intel_remapping_check(int num, int slot, int func)
197{ 197{
198 u8 revision; 198 u8 revision;
199 u16 device;
199 200
201 device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID);
200 revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID); 202 revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID);
201 203
202 /* 204 /*
203 * Revision 0x13 of this chipset supports irq remapping 205 * Revision 13 of all triggering devices id in this quirk have
204 * but has an erratum that breaks its behavior, flag it as such 206 * a problem draining interrupts when irq remapping is enabled,
207 * and should be flagged as broken. Additionally revisions 0x12
208 * and 0x22 of device id 0x3405 has this problem.
205 */ 209 */
206 if (revision == 0x13) 210 if (revision == 0x13)
207 set_irq_remapping_broken(); 211 set_irq_remapping_broken();
212 else if ((device == 0x3405) &&
213 ((revision == 0x12) ||
214 (revision == 0x22)))
215 set_irq_remapping_broken();
208 216
209} 217}
210 218
@@ -239,6 +247,8 @@ static struct chipset early_qrk[] __initdata = {
239 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, 247 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd },
240 { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST, 248 { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST,
241 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, 249 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
250 { PCI_VENDOR_ID_INTEL, 0x3405, PCI_CLASS_BRIDGE_HOST,
251 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
242 { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, 252 { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST,
243 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, 253 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
244 {} 254 {}
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 202d24f0f7e7..5d576ab34403 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -116,7 +116,7 @@ static void mxcsr_feature_mask_init(void)
116 116
117 if (cpu_has_fxsr) { 117 if (cpu_has_fxsr) {
118 memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct)); 118 memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
119 asm volatile("fxsave %0" : : "m" (fx_scratch)); 119 asm volatile("fxsave %0" : "+m" (fx_scratch));
120 mask = fx_scratch.mxcsr_mask; 120 mask = fx_scratch.mxcsr_mask;
121 if (mask == 0) 121 if (mask == 0)
122 mask = 0x0000ffbf; 122 mask = 0x0000ffbf;
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 47ebb1dbfbcb..7a0adb7ee433 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -220,12 +220,13 @@ int apply_microcode_amd(int cpu)
220 return 0; 220 return 0;
221 } 221 }
222 222
223 if (__apply_microcode_amd(mc_amd)) 223 if (__apply_microcode_amd(mc_amd)) {
224 pr_err("CPU%d: update failed for patch_level=0x%08x\n", 224 pr_err("CPU%d: update failed for patch_level=0x%08x\n",
225 cpu, mc_amd->hdr.patch_id); 225 cpu, mc_amd->hdr.patch_id);
226 else 226 return -1;
227 pr_info("CPU%d: new patch_level=0x%08x\n", cpu, 227 }
228 mc_amd->hdr.patch_id); 228 pr_info("CPU%d: new patch_level=0x%08x\n", cpu,
229 mc_amd->hdr.patch_id);
229 230
230 uci->cpu_sig.rev = mc_amd->hdr.patch_id; 231 uci->cpu_sig.rev = mc_amd->hdr.patch_id;
231 c->microcode = mc_amd->hdr.patch_id; 232 c->microcode = mc_amd->hdr.patch_id;
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index fd6c51cc3acb..5a74a9c1e42c 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -451,7 +451,6 @@ static void acpi_processor_remove(struct acpi_device *device)
451 /* Clean up. */ 451 /* Clean up. */
452 per_cpu(processor_device_array, pr->id) = NULL; 452 per_cpu(processor_device_array, pr->id) = NULL;
453 per_cpu(processors, pr->id) = NULL; 453 per_cpu(processors, pr->id) = NULL;
454 try_offline_node(cpu_to_node(pr->id));
455 454
456 /* Remove the CPU. */ 455 /* Remove the CPU. */
457 get_online_cpus(); 456 get_online_cpus();
@@ -459,6 +458,8 @@ static void acpi_processor_remove(struct acpi_device *device)
459 acpi_unmap_lsapic(pr->id); 458 acpi_unmap_lsapic(pr->id);
460 put_online_cpus(); 459 put_online_cpus();
461 460
461 try_offline_node(cpu_to_node(pr->id));
462
462 out: 463 out:
463 free_cpumask_var(pr->throttling.shared_cpu_map); 464 free_cpumask_var(pr->throttling.shared_cpu_map);
464 kfree(pr); 465 kfree(pr);
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index f68095756fb7..408f6b2a5fa8 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -31,6 +31,7 @@ static LIST_HEAD(bus_type_list);
31static DECLARE_RWSEM(bus_type_sem); 31static DECLARE_RWSEM(bus_type_sem);
32 32
33#define PHYSICAL_NODE_STRING "physical_node" 33#define PHYSICAL_NODE_STRING "physical_node"
34#define PHYSICAL_NODE_NAME_SIZE (sizeof(PHYSICAL_NODE_STRING) + 10)
34 35
35int register_acpi_bus_type(struct acpi_bus_type *type) 36int register_acpi_bus_type(struct acpi_bus_type *type)
36{ 37{
@@ -78,41 +79,108 @@ static struct acpi_bus_type *acpi_get_bus_type(struct device *dev)
78 return ret; 79 return ret;
79} 80}
80 81
81static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used, 82static acpi_status acpi_dev_present(acpi_handle handle, u32 lvl_not_used,
82 void *addr_p, void **ret_p) 83 void *not_used, void **ret_p)
83{ 84{
84 unsigned long long addr, sta; 85 struct acpi_device *adev = NULL;
85 acpi_status status;
86 86
87 status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); 87 acpi_bus_get_device(handle, &adev);
88 if (ACPI_SUCCESS(status) && addr == *((u64 *)addr_p)) { 88 if (adev) {
89 *ret_p = handle; 89 *ret_p = handle;
90 status = acpi_bus_get_status_handle(handle, &sta); 90 return AE_CTRL_TERMINATE;
91 if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_ENABLED))
92 return AE_CTRL_TERMINATE;
93 } 91 }
94 return AE_OK; 92 return AE_OK;
95} 93}
96 94
97acpi_handle acpi_get_child(acpi_handle parent, u64 address) 95static bool acpi_extra_checks_passed(acpi_handle handle, bool is_bridge)
98{ 96{
99 void *ret = NULL; 97 unsigned long long sta;
98 acpi_status status;
99
100 status = acpi_bus_get_status_handle(handle, &sta);
101 if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
102 return false;
103
104 if (is_bridge) {
105 void *test = NULL;
106
107 /* Check if this object has at least one child device. */
108 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
109 acpi_dev_present, NULL, NULL, &test);
110 return !!test;
111 }
112 return true;
113}
114
115struct find_child_context {
116 u64 addr;
117 bool is_bridge;
118 acpi_handle ret;
119 bool ret_checked;
120};
121
122static acpi_status do_find_child(acpi_handle handle, u32 lvl_not_used,
123 void *data, void **not_used)
124{
125 struct find_child_context *context = data;
126 unsigned long long addr;
127 acpi_status status;
100 128
101 if (!parent) 129 status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr);
102 return NULL; 130 if (ACPI_FAILURE(status) || addr != context->addr)
131 return AE_OK;
103 132
104 acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, NULL, 133 if (!context->ret) {
105 do_acpi_find_child, &address, &ret); 134 /* This is the first matching object. Save its handle. */
106 return (acpi_handle)ret; 135 context->ret = handle;
136 return AE_OK;
137 }
138 /*
139 * There is more than one matching object with the same _ADR value.
140 * That really is unexpected, so we are kind of beyond the scope of the
141 * spec here. We have to choose which one to return, though.
142 *
143 * First, check if the previously found object is good enough and return
144 * its handle if so. Second, check the same for the object that we've
145 * just found.
146 */
147 if (!context->ret_checked) {
148 if (acpi_extra_checks_passed(context->ret, context->is_bridge))
149 return AE_CTRL_TERMINATE;
150 else
151 context->ret_checked = true;
152 }
153 if (acpi_extra_checks_passed(handle, context->is_bridge)) {
154 context->ret = handle;
155 return AE_CTRL_TERMINATE;
156 }
157 return AE_OK;
107} 158}
108EXPORT_SYMBOL(acpi_get_child); 159
160acpi_handle acpi_find_child(acpi_handle parent, u64 addr, bool is_bridge)
161{
162 if (parent) {
163 struct find_child_context context = {
164 .addr = addr,
165 .is_bridge = is_bridge,
166 };
167
168 acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, do_find_child,
169 NULL, &context, NULL);
170 return context.ret;
171 }
172 return NULL;
173}
174EXPORT_SYMBOL_GPL(acpi_find_child);
109 175
110int acpi_bind_one(struct device *dev, acpi_handle handle) 176int acpi_bind_one(struct device *dev, acpi_handle handle)
111{ 177{
112 struct acpi_device *acpi_dev; 178 struct acpi_device *acpi_dev;
113 acpi_status status; 179 acpi_status status;
114 struct acpi_device_physical_node *physical_node, *pn; 180 struct acpi_device_physical_node *physical_node, *pn;
115 char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; 181 char physical_node_name[PHYSICAL_NODE_NAME_SIZE];
182 struct list_head *physnode_list;
183 unsigned int node_id;
116 int retval = -EINVAL; 184 int retval = -EINVAL;
117 185
118 if (ACPI_HANDLE(dev)) { 186 if (ACPI_HANDLE(dev)) {
@@ -139,25 +207,27 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
139 207
140 mutex_lock(&acpi_dev->physical_node_lock); 208 mutex_lock(&acpi_dev->physical_node_lock);
141 209
142 /* Sanity check. */ 210 /*
143 list_for_each_entry(pn, &acpi_dev->physical_node_list, node) 211 * Keep the list sorted by node_id so that the IDs of removed nodes can
212 * be recycled easily.
213 */
214 physnode_list = &acpi_dev->physical_node_list;
215 node_id = 0;
216 list_for_each_entry(pn, &acpi_dev->physical_node_list, node) {
217 /* Sanity check. */
144 if (pn->dev == dev) { 218 if (pn->dev == dev) {
145 dev_warn(dev, "Already associated with ACPI node\n"); 219 dev_warn(dev, "Already associated with ACPI node\n");
146 goto err_free; 220 goto err_free;
147 } 221 }
148 222 if (pn->node_id == node_id) {
149 /* allocate physical node id according to physical_node_id_bitmap */ 223 physnode_list = &pn->node;
150 physical_node->node_id = 224 node_id++;
151 find_first_zero_bit(acpi_dev->physical_node_id_bitmap, 225 }
152 ACPI_MAX_PHYSICAL_NODE);
153 if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) {
154 retval = -ENOSPC;
155 goto err_free;
156 } 226 }
157 227
158 set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap); 228 physical_node->node_id = node_id;
159 physical_node->dev = dev; 229 physical_node->dev = dev;
160 list_add_tail(&physical_node->node, &acpi_dev->physical_node_list); 230 list_add(&physical_node->node, physnode_list);
161 acpi_dev->physical_node_count++; 231 acpi_dev->physical_node_count++;
162 232
163 mutex_unlock(&acpi_dev->physical_node_lock); 233 mutex_unlock(&acpi_dev->physical_node_lock);
@@ -208,7 +278,7 @@ int acpi_unbind_one(struct device *dev)
208 278
209 mutex_lock(&acpi_dev->physical_node_lock); 279 mutex_lock(&acpi_dev->physical_node_lock);
210 list_for_each_safe(node, next, &acpi_dev->physical_node_list) { 280 list_for_each_safe(node, next, &acpi_dev->physical_node_list) {
211 char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; 281 char physical_node_name[PHYSICAL_NODE_NAME_SIZE];
212 282
213 entry = list_entry(node, struct acpi_device_physical_node, 283 entry = list_entry(node, struct acpi_device_physical_node,
214 node); 284 node);
@@ -216,7 +286,6 @@ int acpi_unbind_one(struct device *dev)
216 continue; 286 continue;
217 287
218 list_del(node); 288 list_del(node);
219 clear_bit(entry->node_id, acpi_dev->physical_node_id_bitmap);
220 289
221 acpi_dev->physical_node_count--; 290 acpi_dev->physical_node_count--;
222 291
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index aa1227a7e3f2..04a13784dd20 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -311,6 +311,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
311 dev->pnp.bus_id, 311 dev->pnp.bus_id,
312 (u32) dev->wakeup.sleep_state); 312 (u32) dev->wakeup.sleep_state);
313 313
314 mutex_lock(&dev->physical_node_lock);
315
314 if (!dev->physical_node_count) { 316 if (!dev->physical_node_count) {
315 seq_printf(seq, "%c%-8s\n", 317 seq_printf(seq, "%c%-8s\n",
316 dev->wakeup.flags.run_wake ? '*' : ' ', 318 dev->wakeup.flags.run_wake ? '*' : ' ',
@@ -338,6 +340,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
338 put_device(ldev); 340 put_device(ldev);
339 } 341 }
340 } 342 }
343
344 mutex_unlock(&dev->physical_node_lock);
341 } 345 }
342 mutex_unlock(&acpi_device_lock); 346 mutex_unlock(&acpi_device_lock);
343 return 0; 347 return 0;
@@ -347,12 +351,16 @@ static void physical_device_enable_wakeup(struct acpi_device *adev)
347{ 351{
348 struct acpi_device_physical_node *entry; 352 struct acpi_device_physical_node *entry;
349 353
354 mutex_lock(&adev->physical_node_lock);
355
350 list_for_each_entry(entry, 356 list_for_each_entry(entry,
351 &adev->physical_node_list, node) 357 &adev->physical_node_list, node)
352 if (entry->dev && device_can_wakeup(entry->dev)) { 358 if (entry->dev && device_can_wakeup(entry->dev)) {
353 bool enable = !device_may_wakeup(entry->dev); 359 bool enable = !device_may_wakeup(entry->dev);
354 device_set_wakeup_enable(entry->dev, enable); 360 device_set_wakeup_enable(entry->dev, enable);
355 } 361 }
362
363 mutex_unlock(&adev->physical_node_lock);
356} 364}
357 365
358static ssize_t 366static ssize_t
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 0ec434d2586d..e1284b8dc6ee 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -689,7 +689,7 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device,
689 * Some systems always report current brightness level as maximum 689 * Some systems always report current brightness level as maximum
690 * through _BQC, we need to test another value for them. 690 * through _BQC, we need to test another value for them.
691 */ 691 */
692 test_level = current_level == max_level ? br->levels[2] : max_level; 692 test_level = current_level == max_level ? br->levels[3] : max_level;
693 693
694 result = acpi_video_device_lcd_set_level(device, test_level); 694 result = acpi_video_device_lcd_set_level(device, test_level);
695 if (result) 695 if (result)
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index 4ec7c04b3f82..26386f0b89a8 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -237,6 +237,7 @@ static const struct of_device_id imx_pata_dt_ids[] = {
237 /* sentinel */ 237 /* sentinel */
238 } 238 }
239}; 239};
240MODULE_DEVICE_TABLE(of, imx_pata_dt_ids);
240 241
241static struct platform_driver pata_imx_driver = { 242static struct platform_driver pata_imx_driver = {
242 .probe = pata_imx_probe, 243 .probe = pata_imx_probe,
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index e69102696533..3455f833e473 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -719,7 +719,8 @@ static int regcache_sync_block_raw(struct regmap *map, void *block,
719 } 719 }
720 } 720 }
721 721
722 return regcache_sync_block_raw_flush(map, &data, base, regtmp); 722 return regcache_sync_block_raw_flush(map, &data, base, regtmp +
723 map->reg_stride);
723} 724}
724 725
725int regcache_sync_block(struct regmap *map, void *block, 726int regcache_sync_block(struct regmap *map, void *block,
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 1b456fe9b87a..fc45567ad3ac 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -272,9 +272,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev,
272 unsigned long flags; 272 unsigned long flags;
273 273
274 spin_lock_irqsave(&portdev->ports_lock, flags); 274 spin_lock_irqsave(&portdev->ports_lock, flags);
275 list_for_each_entry(port, &portdev->ports, list) 275 list_for_each_entry(port, &portdev->ports, list) {
276 if (port->cdev->dev == dev) 276 if (port->cdev->dev == dev) {
277 kref_get(&port->kref);
277 goto out; 278 goto out;
279 }
280 }
278 port = NULL; 281 port = NULL;
279out: 282out:
280 spin_unlock_irqrestore(&portdev->ports_lock, flags); 283 spin_unlock_irqrestore(&portdev->ports_lock, flags);
@@ -746,6 +749,10 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
746 749
747 port = filp->private_data; 750 port = filp->private_data;
748 751
752 /* Port is hot-unplugged. */
753 if (!port->guest_connected)
754 return -ENODEV;
755
749 if (!port_has_data(port)) { 756 if (!port_has_data(port)) {
750 /* 757 /*
751 * If nothing's connected on the host just return 0 in 758 * If nothing's connected on the host just return 0 in
@@ -762,7 +769,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
762 if (ret < 0) 769 if (ret < 0)
763 return ret; 770 return ret;
764 } 771 }
765 /* Port got hot-unplugged. */ 772 /* Port got hot-unplugged while we were waiting above. */
766 if (!port->guest_connected) 773 if (!port->guest_connected)
767 return -ENODEV; 774 return -ENODEV;
768 /* 775 /*
@@ -932,13 +939,25 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe,
932 if (is_rproc_serial(port->out_vq->vdev)) 939 if (is_rproc_serial(port->out_vq->vdev))
933 return -EINVAL; 940 return -EINVAL;
934 941
942 /*
943 * pipe->nrbufs == 0 means there are no data to transfer,
944 * so this returns just 0 for no data.
945 */
946 pipe_lock(pipe);
947 if (!pipe->nrbufs) {
948 ret = 0;
949 goto error_out;
950 }
951
935 ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); 952 ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK);
936 if (ret < 0) 953 if (ret < 0)
937 return ret; 954 goto error_out;
938 955
939 buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); 956 buf = alloc_buf(port->out_vq, 0, pipe->nrbufs);
940 if (!buf) 957 if (!buf) {
941 return -ENOMEM; 958 ret = -ENOMEM;
959 goto error_out;
960 }
942 961
943 sgl.n = 0; 962 sgl.n = 0;
944 sgl.len = 0; 963 sgl.len = 0;
@@ -946,12 +965,17 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe,
946 sgl.sg = buf->sg; 965 sgl.sg = buf->sg;
947 sg_init_table(sgl.sg, sgl.size); 966 sg_init_table(sgl.sg, sgl.size);
948 ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); 967 ret = __splice_from_pipe(pipe, &sd, pipe_to_sg);
968 pipe_unlock(pipe);
949 if (likely(ret > 0)) 969 if (likely(ret > 0))
950 ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true); 970 ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true);
951 971
952 if (unlikely(ret <= 0)) 972 if (unlikely(ret <= 0))
953 free_buf(buf, true); 973 free_buf(buf, true);
954 return ret; 974 return ret;
975
976error_out:
977 pipe_unlock(pipe);
978 return ret;
955} 979}
956 980
957static unsigned int port_fops_poll(struct file *filp, poll_table *wait) 981static unsigned int port_fops_poll(struct file *filp, poll_table *wait)
@@ -1019,14 +1043,14 @@ static int port_fops_open(struct inode *inode, struct file *filp)
1019 struct port *port; 1043 struct port *port;
1020 int ret; 1044 int ret;
1021 1045
1046 /* We get the port with a kref here */
1022 port = find_port_by_devt(cdev->dev); 1047 port = find_port_by_devt(cdev->dev);
1048 if (!port) {
1049 /* Port was unplugged before we could proceed */
1050 return -ENXIO;
1051 }
1023 filp->private_data = port; 1052 filp->private_data = port;
1024 1053
1025 /* Prevent against a port getting hot-unplugged at the same time */
1026 spin_lock_irq(&port->portdev->ports_lock);
1027 kref_get(&port->kref);
1028 spin_unlock_irq(&port->portdev->ports_lock);
1029
1030 /* 1054 /*
1031 * Don't allow opening of console port devices -- that's done 1055 * Don't allow opening of console port devices -- that's done
1032 * via /dev/hvc 1056 * via /dev/hvc
@@ -1498,14 +1522,6 @@ static void remove_port(struct kref *kref)
1498 1522
1499 port = container_of(kref, struct port, kref); 1523 port = container_of(kref, struct port, kref);
1500 1524
1501 sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
1502 device_destroy(pdrvdata.class, port->dev->devt);
1503 cdev_del(port->cdev);
1504
1505 kfree(port->name);
1506
1507 debugfs_remove(port->debugfs_file);
1508
1509 kfree(port); 1525 kfree(port);
1510} 1526}
1511 1527
@@ -1539,12 +1555,14 @@ static void unplug_port(struct port *port)
1539 spin_unlock_irq(&port->portdev->ports_lock); 1555 spin_unlock_irq(&port->portdev->ports_lock);
1540 1556
1541 if (port->guest_connected) { 1557 if (port->guest_connected) {
1558 /* Let the app know the port is going down. */
1559 send_sigio_to_port(port);
1560
1561 /* Do this after sigio is actually sent */
1542 port->guest_connected = false; 1562 port->guest_connected = false;
1543 port->host_connected = false; 1563 port->host_connected = false;
1544 wake_up_interruptible(&port->waitqueue);
1545 1564
1546 /* Let the app know the port is going down. */ 1565 wake_up_interruptible(&port->waitqueue);
1547 send_sigio_to_port(port);
1548 } 1566 }
1549 1567
1550 if (is_console_port(port)) { 1568 if (is_console_port(port)) {
@@ -1563,6 +1581,14 @@ static void unplug_port(struct port *port)
1563 */ 1581 */
1564 port->portdev = NULL; 1582 port->portdev = NULL;
1565 1583
1584 sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
1585 device_destroy(pdrvdata.class, port->dev->devt);
1586 cdev_del(port->cdev);
1587
1588 kfree(port->name);
1589
1590 debugfs_remove(port->debugfs_file);
1591
1566 /* 1592 /*
1567 * Locks around here are not necessary - a port can't be 1593 * Locks around here are not necessary - a port can't be
1568 * opened after we removed the port struct from ports_list 1594 * opened after we removed the port struct from ports_list
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 0ceb2eff5a7e..f97cb3d8c5a2 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -221,8 +221,8 @@ static ssize_t store_down_threshold(struct dbs_data *dbs_data, const char *buf,
221 return count; 221 return count;
222} 222}
223 223
224static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, 224static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data,
225 size_t count) 225 const char *buf, size_t count)
226{ 226{
227 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; 227 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
228 unsigned int input, j; 228 unsigned int input, j;
@@ -235,10 +235,10 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf,
235 if (input > 1) 235 if (input > 1)
236 input = 1; 236 input = 1;
237 237
238 if (input == cs_tuners->ignore_nice) /* nothing to do */ 238 if (input == cs_tuners->ignore_nice_load) /* nothing to do */
239 return count; 239 return count;
240 240
241 cs_tuners->ignore_nice = input; 241 cs_tuners->ignore_nice_load = input;
242 242
243 /* we need to re-evaluate prev_cpu_idle */ 243 /* we need to re-evaluate prev_cpu_idle */
244 for_each_online_cpu(j) { 244 for_each_online_cpu(j) {
@@ -246,7 +246,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf,
246 dbs_info = &per_cpu(cs_cpu_dbs_info, j); 246 dbs_info = &per_cpu(cs_cpu_dbs_info, j);
247 dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, 247 dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j,
248 &dbs_info->cdbs.prev_cpu_wall, 0); 248 &dbs_info->cdbs.prev_cpu_wall, 0);
249 if (cs_tuners->ignore_nice) 249 if (cs_tuners->ignore_nice_load)
250 dbs_info->cdbs.prev_cpu_nice = 250 dbs_info->cdbs.prev_cpu_nice =
251 kcpustat_cpu(j).cpustat[CPUTIME_NICE]; 251 kcpustat_cpu(j).cpustat[CPUTIME_NICE];
252 } 252 }
@@ -279,7 +279,7 @@ show_store_one(cs, sampling_rate);
279show_store_one(cs, sampling_down_factor); 279show_store_one(cs, sampling_down_factor);
280show_store_one(cs, up_threshold); 280show_store_one(cs, up_threshold);
281show_store_one(cs, down_threshold); 281show_store_one(cs, down_threshold);
282show_store_one(cs, ignore_nice); 282show_store_one(cs, ignore_nice_load);
283show_store_one(cs, freq_step); 283show_store_one(cs, freq_step);
284declare_show_sampling_rate_min(cs); 284declare_show_sampling_rate_min(cs);
285 285
@@ -287,7 +287,7 @@ gov_sys_pol_attr_rw(sampling_rate);
287gov_sys_pol_attr_rw(sampling_down_factor); 287gov_sys_pol_attr_rw(sampling_down_factor);
288gov_sys_pol_attr_rw(up_threshold); 288gov_sys_pol_attr_rw(up_threshold);
289gov_sys_pol_attr_rw(down_threshold); 289gov_sys_pol_attr_rw(down_threshold);
290gov_sys_pol_attr_rw(ignore_nice); 290gov_sys_pol_attr_rw(ignore_nice_load);
291gov_sys_pol_attr_rw(freq_step); 291gov_sys_pol_attr_rw(freq_step);
292gov_sys_pol_attr_ro(sampling_rate_min); 292gov_sys_pol_attr_ro(sampling_rate_min);
293 293
@@ -297,7 +297,7 @@ static struct attribute *dbs_attributes_gov_sys[] = {
297 &sampling_down_factor_gov_sys.attr, 297 &sampling_down_factor_gov_sys.attr,
298 &up_threshold_gov_sys.attr, 298 &up_threshold_gov_sys.attr,
299 &down_threshold_gov_sys.attr, 299 &down_threshold_gov_sys.attr,
300 &ignore_nice_gov_sys.attr, 300 &ignore_nice_load_gov_sys.attr,
301 &freq_step_gov_sys.attr, 301 &freq_step_gov_sys.attr,
302 NULL 302 NULL
303}; 303};
@@ -313,7 +313,7 @@ static struct attribute *dbs_attributes_gov_pol[] = {
313 &sampling_down_factor_gov_pol.attr, 313 &sampling_down_factor_gov_pol.attr,
314 &up_threshold_gov_pol.attr, 314 &up_threshold_gov_pol.attr,
315 &down_threshold_gov_pol.attr, 315 &down_threshold_gov_pol.attr,
316 &ignore_nice_gov_pol.attr, 316 &ignore_nice_load_gov_pol.attr,
317 &freq_step_gov_pol.attr, 317 &freq_step_gov_pol.attr,
318 NULL 318 NULL
319}; 319};
@@ -338,7 +338,7 @@ static int cs_init(struct dbs_data *dbs_data)
338 tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; 338 tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD;
339 tuners->down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD; 339 tuners->down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD;
340 tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; 340 tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR;
341 tuners->ignore_nice = 0; 341 tuners->ignore_nice_load = 0;
342 tuners->freq_step = DEF_FREQUENCY_STEP; 342 tuners->freq_step = DEF_FREQUENCY_STEP;
343 343
344 dbs_data->tuners = tuners; 344 dbs_data->tuners = tuners;
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index 7b839a8db2a7..e59afaa9da23 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -47,9 +47,9 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)
47 unsigned int j; 47 unsigned int j;
48 48
49 if (dbs_data->cdata->governor == GOV_ONDEMAND) 49 if (dbs_data->cdata->governor == GOV_ONDEMAND)
50 ignore_nice = od_tuners->ignore_nice; 50 ignore_nice = od_tuners->ignore_nice_load;
51 else 51 else
52 ignore_nice = cs_tuners->ignore_nice; 52 ignore_nice = cs_tuners->ignore_nice_load;
53 53
54 policy = cdbs->cur_policy; 54 policy = cdbs->cur_policy;
55 55
@@ -298,12 +298,12 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
298 cs_tuners = dbs_data->tuners; 298 cs_tuners = dbs_data->tuners;
299 cs_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); 299 cs_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu);
300 sampling_rate = cs_tuners->sampling_rate; 300 sampling_rate = cs_tuners->sampling_rate;
301 ignore_nice = cs_tuners->ignore_nice; 301 ignore_nice = cs_tuners->ignore_nice_load;
302 } else { 302 } else {
303 od_tuners = dbs_data->tuners; 303 od_tuners = dbs_data->tuners;
304 od_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); 304 od_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu);
305 sampling_rate = od_tuners->sampling_rate; 305 sampling_rate = od_tuners->sampling_rate;
306 ignore_nice = od_tuners->ignore_nice; 306 ignore_nice = od_tuners->ignore_nice_load;
307 od_ops = dbs_data->cdata->gov_ops; 307 od_ops = dbs_data->cdata->gov_ops;
308 io_busy = od_tuners->io_is_busy; 308 io_busy = od_tuners->io_is_busy;
309 } 309 }
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index 6663ec3b3056..d5f12b4b11b8 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -165,7 +165,7 @@ struct cs_cpu_dbs_info_s {
165 165
166/* Per policy Governers sysfs tunables */ 166/* Per policy Governers sysfs tunables */
167struct od_dbs_tuners { 167struct od_dbs_tuners {
168 unsigned int ignore_nice; 168 unsigned int ignore_nice_load;
169 unsigned int sampling_rate; 169 unsigned int sampling_rate;
170 unsigned int sampling_down_factor; 170 unsigned int sampling_down_factor;
171 unsigned int up_threshold; 171 unsigned int up_threshold;
@@ -175,7 +175,7 @@ struct od_dbs_tuners {
175}; 175};
176 176
177struct cs_dbs_tuners { 177struct cs_dbs_tuners {
178 unsigned int ignore_nice; 178 unsigned int ignore_nice_load;
179 unsigned int sampling_rate; 179 unsigned int sampling_rate;
180 unsigned int sampling_down_factor; 180 unsigned int sampling_down_factor;
181 unsigned int up_threshold; 181 unsigned int up_threshold;
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 93eb5cbcc1f6..c087347d6688 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -403,8 +403,8 @@ static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data,
403 return count; 403 return count;
404} 404}
405 405
406static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, 406static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data,
407 size_t count) 407 const char *buf, size_t count)
408{ 408{
409 struct od_dbs_tuners *od_tuners = dbs_data->tuners; 409 struct od_dbs_tuners *od_tuners = dbs_data->tuners;
410 unsigned int input; 410 unsigned int input;
@@ -419,10 +419,10 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf,
419 if (input > 1) 419 if (input > 1)
420 input = 1; 420 input = 1;
421 421
422 if (input == od_tuners->ignore_nice) { /* nothing to do */ 422 if (input == od_tuners->ignore_nice_load) { /* nothing to do */
423 return count; 423 return count;
424 } 424 }
425 od_tuners->ignore_nice = input; 425 od_tuners->ignore_nice_load = input;
426 426
427 /* we need to re-evaluate prev_cpu_idle */ 427 /* we need to re-evaluate prev_cpu_idle */
428 for_each_online_cpu(j) { 428 for_each_online_cpu(j) {
@@ -430,7 +430,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf,
430 dbs_info = &per_cpu(od_cpu_dbs_info, j); 430 dbs_info = &per_cpu(od_cpu_dbs_info, j);
431 dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, 431 dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j,
432 &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); 432 &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy);
433 if (od_tuners->ignore_nice) 433 if (od_tuners->ignore_nice_load)
434 dbs_info->cdbs.prev_cpu_nice = 434 dbs_info->cdbs.prev_cpu_nice =
435 kcpustat_cpu(j).cpustat[CPUTIME_NICE]; 435 kcpustat_cpu(j).cpustat[CPUTIME_NICE];
436 436
@@ -461,7 +461,7 @@ show_store_one(od, sampling_rate);
461show_store_one(od, io_is_busy); 461show_store_one(od, io_is_busy);
462show_store_one(od, up_threshold); 462show_store_one(od, up_threshold);
463show_store_one(od, sampling_down_factor); 463show_store_one(od, sampling_down_factor);
464show_store_one(od, ignore_nice); 464show_store_one(od, ignore_nice_load);
465show_store_one(od, powersave_bias); 465show_store_one(od, powersave_bias);
466declare_show_sampling_rate_min(od); 466declare_show_sampling_rate_min(od);
467 467
@@ -469,7 +469,7 @@ gov_sys_pol_attr_rw(sampling_rate);
469gov_sys_pol_attr_rw(io_is_busy); 469gov_sys_pol_attr_rw(io_is_busy);
470gov_sys_pol_attr_rw(up_threshold); 470gov_sys_pol_attr_rw(up_threshold);
471gov_sys_pol_attr_rw(sampling_down_factor); 471gov_sys_pol_attr_rw(sampling_down_factor);
472gov_sys_pol_attr_rw(ignore_nice); 472gov_sys_pol_attr_rw(ignore_nice_load);
473gov_sys_pol_attr_rw(powersave_bias); 473gov_sys_pol_attr_rw(powersave_bias);
474gov_sys_pol_attr_ro(sampling_rate_min); 474gov_sys_pol_attr_ro(sampling_rate_min);
475 475
@@ -478,7 +478,7 @@ static struct attribute *dbs_attributes_gov_sys[] = {
478 &sampling_rate_gov_sys.attr, 478 &sampling_rate_gov_sys.attr,
479 &up_threshold_gov_sys.attr, 479 &up_threshold_gov_sys.attr,
480 &sampling_down_factor_gov_sys.attr, 480 &sampling_down_factor_gov_sys.attr,
481 &ignore_nice_gov_sys.attr, 481 &ignore_nice_load_gov_sys.attr,
482 &powersave_bias_gov_sys.attr, 482 &powersave_bias_gov_sys.attr,
483 &io_is_busy_gov_sys.attr, 483 &io_is_busy_gov_sys.attr,
484 NULL 484 NULL
@@ -494,7 +494,7 @@ static struct attribute *dbs_attributes_gov_pol[] = {
494 &sampling_rate_gov_pol.attr, 494 &sampling_rate_gov_pol.attr,
495 &up_threshold_gov_pol.attr, 495 &up_threshold_gov_pol.attr,
496 &sampling_down_factor_gov_pol.attr, 496 &sampling_down_factor_gov_pol.attr,
497 &ignore_nice_gov_pol.attr, 497 &ignore_nice_load_gov_pol.attr,
498 &powersave_bias_gov_pol.attr, 498 &powersave_bias_gov_pol.attr,
499 &io_is_busy_gov_pol.attr, 499 &io_is_busy_gov_pol.attr,
500 NULL 500 NULL
@@ -544,7 +544,7 @@ static int od_init(struct dbs_data *dbs_data)
544 } 544 }
545 545
546 tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; 546 tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR;
547 tuners->ignore_nice = 0; 547 tuners->ignore_nice_load = 0;
548 tuners->powersave_bias = default_powersave_bias; 548 tuners->powersave_bias = default_powersave_bias;
549 tuners->io_is_busy = should_io_be_busy(); 549 tuners->io_is_busy = should_io_be_busy();
550 550
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index bb838b985077..9536852c504a 100644
--- a/drivers/cpufreq/loongson2_cpufreq.c
+++ b/drivers/cpufreq/loongson2_cpufreq.c
@@ -118,11 +118,6 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
118 clk_put(cpuclk); 118 clk_put(cpuclk);
119 return -EINVAL; 119 return -EINVAL;
120 } 120 }
121 ret = clk_set_rate(cpuclk, rate);
122 if (ret) {
123 clk_put(cpuclk);
124 return ret;
125 }
126 121
127 /* clock table init */ 122 /* clock table init */
128 for (i = 2; 123 for (i = 2;
@@ -130,6 +125,12 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
130 i++) 125 i++)
131 loongson2_clockmod_table[i].frequency = (rate * i) / 8; 126 loongson2_clockmod_table[i].frequency = (rate * i) / 8;
132 127
128 ret = clk_set_rate(cpuclk, rate);
129 if (ret) {
130 clk_put(cpuclk);
131 return ret;
132 }
133
133 policy->cur = loongson2_cpufreq_get(policy->cpu); 134 policy->cur = loongson2_cpufreq_get(policy->cpu);
134 135
135 cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], 136 cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0],
diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c
index b67f45f5c271..5039fbc88254 100644
--- a/drivers/dma/sh/shdma.c
+++ b/drivers/dma/sh/shdma.c
@@ -400,8 +400,8 @@ static size_t sh_dmae_get_partial(struct shdma_chan *schan,
400 shdma_chan); 400 shdma_chan);
401 struct sh_dmae_desc *sh_desc = container_of(sdesc, 401 struct sh_dmae_desc *sh_desc = container_of(sdesc,
402 struct sh_dmae_desc, shdma_desc); 402 struct sh_dmae_desc, shdma_desc);
403 return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) << 403 return sh_desc->hw.tcr -
404 sh_chan->xmit_shift; 404 (sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift);
405} 405}
406 406
407/* Called from error IRQ or NMI */ 407/* Called from error IRQ or NMI */
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index 98d670825a1a..6e8887fe6c1b 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -323,6 +323,7 @@ int ast_bo_create(struct drm_device *dev, int size, int align,
323 323
324 astbo->gem.driver_private = NULL; 324 astbo->gem.driver_private = NULL;
325 astbo->bo.bdev = &ast->ttm.bdev; 325 astbo->bo.bdev = &ast->ttm.bdev;
326 astbo->bo.bdev->dev_mapping = dev->dev_mapping;
326 327
327 ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); 328 ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
328 329
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 0047012045c2..69fd8f1ac8df 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -328,6 +328,7 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align,
328 328
329 cirrusbo->gem.driver_private = NULL; 329 cirrusbo->gem.driver_private = NULL;
330 cirrusbo->bo.bdev = &cirrus->ttm.bdev; 330 cirrusbo->bo.bdev = &cirrus->ttm.bdev;
331 cirrusbo->bo.bdev->dev_mapping = dev->dev_mapping;
331 332
332 cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); 333 cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
333 334
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 8bcce7866d36..f92da0a32f0d 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -708,7 +708,10 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,
708 /* Subtract time delta from raw timestamp to get final 708 /* Subtract time delta from raw timestamp to get final
709 * vblank_time timestamp for end of vblank. 709 * vblank_time timestamp for end of vblank.
710 */ 710 */
711 etime = ktime_sub_ns(etime, delta_ns); 711 if (delta_ns < 0)
712 etime = ktime_add_ns(etime, -delta_ns);
713 else
714 etime = ktime_sub_ns(etime, delta_ns);
712 *vblank_time = ktime_to_timeval(etime); 715 *vblank_time = ktime_to_timeval(etime);
713 716
714 DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n", 717 DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n",
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index f2326fc60ac9..6f514297c483 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1856,10 +1856,16 @@
1856#define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) 1856#define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
1857 1857
1858#define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) 1858#define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114)
1859/* HDMI/DP bits are gen4+ */ 1859/*
1860#define PORTB_HOTPLUG_LIVE_STATUS (1 << 29) 1860 * HDMI/DP bits are gen4+
1861 *
1862 * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused.
1863 * Please check the detailed lore in the commit message for for experimental
1864 * evidence.
1865 */
1866#define PORTD_HOTPLUG_LIVE_STATUS (1 << 29)
1861#define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) 1867#define PORTC_HOTPLUG_LIVE_STATUS (1 << 28)
1862#define PORTD_HOTPLUG_LIVE_STATUS (1 << 27) 1868#define PORTB_HOTPLUG_LIVE_STATUS (1 << 27)
1863#define PORTD_HOTPLUG_INT_STATUS (3 << 21) 1869#define PORTD_HOTPLUG_INT_STATUS (3 << 21)
1864#define PORTC_HOTPLUG_INT_STATUS (3 << 19) 1870#define PORTC_HOTPLUG_INT_STATUS (3 << 19)
1865#define PORTB_HOTPLUG_INT_STATUS (3 << 17) 1871#define PORTB_HOTPLUG_INT_STATUS (3 << 17)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5fb305840db8..e38b45786653 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8269,9 +8269,11 @@ check_crtc_state(struct drm_device *dev)
8269 8269
8270 list_for_each_entry(encoder, &dev->mode_config.encoder_list, 8270 list_for_each_entry(encoder, &dev->mode_config.encoder_list,
8271 base.head) { 8271 base.head) {
8272 enum pipe pipe;
8272 if (encoder->base.crtc != &crtc->base) 8273 if (encoder->base.crtc != &crtc->base)
8273 continue; 8274 continue;
8274 if (encoder->get_config) 8275 if (encoder->get_config &&
8276 encoder->get_hw_state(encoder, &pipe))
8275 encoder->get_config(encoder, &pipe_config); 8277 encoder->get_config(encoder, &pipe_config);
8276 } 8278 }
8277 8279
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 67e2c1f1c9a8..5950888ae1d0 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -497,8 +497,11 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level, u32 max)
497 goto out; 497 goto out;
498 } 498 }
499 499
500 /* scale to hardware */ 500 /* scale to hardware, but be careful to not overflow */
501 level = level * freq / max; 501 if (freq < max)
502 level = level * freq / max;
503 else
504 level = freq / max * level;
502 505
503 dev_priv->backlight.level = level; 506 dev_priv->backlight.level = level;
504 if (dev_priv->backlight.device) 507 if (dev_priv->backlight.device)
@@ -515,6 +518,17 @@ void intel_panel_disable_backlight(struct drm_device *dev)
515 struct drm_i915_private *dev_priv = dev->dev_private; 518 struct drm_i915_private *dev_priv = dev->dev_private;
516 unsigned long flags; 519 unsigned long flags;
517 520
521 /*
522 * Do not disable backlight on the vgaswitcheroo path. When switching
523 * away from i915, the other client may depend on i915 to handle the
524 * backlight. This will leave the backlight on unnecessarily when
525 * another client is not activated.
526 */
527 if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) {
528 DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n");
529 return;
530 }
531
518 spin_lock_irqsave(&dev_priv->backlight.lock, flags); 532 spin_lock_irqsave(&dev_priv->backlight.lock, flags);
519 533
520 dev_priv->backlight.enabled = false; 534 dev_priv->backlight.enabled = false;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index f895d1508df8..b0e4a0bd1313 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -5063,8 +5063,26 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable)
5063 } 5063 }
5064 } else { 5064 } else {
5065 if (enable_requested) { 5065 if (enable_requested) {
5066 unsigned long irqflags;
5067 enum pipe p;
5068
5066 I915_WRITE(HSW_PWR_WELL_DRIVER, 0); 5069 I915_WRITE(HSW_PWR_WELL_DRIVER, 0);
5070 POSTING_READ(HSW_PWR_WELL_DRIVER);
5067 DRM_DEBUG_KMS("Requesting to disable the power well\n"); 5071 DRM_DEBUG_KMS("Requesting to disable the power well\n");
5072
5073 /*
5074 * After this, the registers on the pipes that are part
5075 * of the power well will become zero, so we have to
5076 * adjust our counters according to that.
5077 *
5078 * FIXME: Should we do this in general in
5079 * drm_vblank_post_modeset?
5080 */
5081 spin_lock_irqsave(&dev->vbl_lock, irqflags);
5082 for_each_pipe(p)
5083 if (p != PIPE_A)
5084 dev->last_vblank[p] = 0;
5085 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
5068 } 5086 }
5069 } 5087 }
5070} 5088}
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c
index 13878d5de063..d70e4a92773b 100644
--- a/drivers/gpu/drm/mgag200/mgag200_ttm.c
+++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c
@@ -323,6 +323,7 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align,
323 323
324 mgabo->gem.driver_private = NULL; 324 mgabo->gem.driver_private = NULL;
325 mgabo->bo.bdev = &mdev->ttm.bdev; 325 mgabo->bo.bdev = &mdev->ttm.bdev;
326 mgabo->bo.bdev->dev_mapping = dev->dev_mapping;
326 327
327 mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); 328 mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
328 329
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c
index 0bfd55e08820..9953e1fbc46d 100644
--- a/drivers/gpu/drm/radeon/btc_dpm.c
+++ b/drivers/gpu/drm/radeon/btc_dpm.c
@@ -2548,9 +2548,6 @@ int btc_dpm_init(struct radeon_device *rdev)
2548{ 2548{
2549 struct rv7xx_power_info *pi; 2549 struct rv7xx_power_info *pi;
2550 struct evergreen_power_info *eg_pi; 2550 struct evergreen_power_info *eg_pi;
2551 int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info);
2552 u16 data_offset, size;
2553 u8 frev, crev;
2554 struct atom_clock_dividers dividers; 2551 struct atom_clock_dividers dividers;
2555 int ret; 2552 int ret;
2556 2553
@@ -2633,16 +2630,7 @@ int btc_dpm_init(struct radeon_device *rdev)
2633 eg_pi->vddci_control = 2630 eg_pi->vddci_control =
2634 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); 2631 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0);
2635 2632
2636 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 2633 rv770_get_engine_memory_ss(rdev);
2637 &frev, &crev, &data_offset)) {
2638 pi->sclk_ss = true;
2639 pi->mclk_ss = true;
2640 pi->dynamic_ss = true;
2641 } else {
2642 pi->sclk_ss = false;
2643 pi->mclk_ss = false;
2644 pi->dynamic_ss = true;
2645 }
2646 2634
2647 pi->asi = RV770_ASI_DFLT; 2635 pi->asi = RV770_ASI_DFLT;
2648 pi->pasi = CYPRESS_HASI_DFLT; 2636 pi->pasi = CYPRESS_HASI_DFLT;
@@ -2659,8 +2647,7 @@ int btc_dpm_init(struct radeon_device *rdev)
2659 2647
2660 pi->dynamic_pcie_gen2 = true; 2648 pi->dynamic_pcie_gen2 = true;
2661 2649
2662 if (pi->gfx_clock_gating && 2650 if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)
2663 (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE))
2664 pi->thermal_protection = true; 2651 pi->thermal_protection = true;
2665 else 2652 else
2666 pi->thermal_protection = false; 2653 pi->thermal_protection = false;
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 6dacec4e2090..8928bd109c16 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -2587,9 +2587,11 @@ u32 cik_compute_ring_get_rptr(struct radeon_device *rdev,
2587 if (rdev->wb.enabled) { 2587 if (rdev->wb.enabled) {
2588 rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); 2588 rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]);
2589 } else { 2589 } else {
2590 mutex_lock(&rdev->srbm_mutex);
2590 cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); 2591 cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0);
2591 rptr = RREG32(CP_HQD_PQ_RPTR); 2592 rptr = RREG32(CP_HQD_PQ_RPTR);
2592 cik_srbm_select(rdev, 0, 0, 0, 0); 2593 cik_srbm_select(rdev, 0, 0, 0, 0);
2594 mutex_unlock(&rdev->srbm_mutex);
2593 } 2595 }
2594 rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; 2596 rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift;
2595 2597
@@ -2604,9 +2606,11 @@ u32 cik_compute_ring_get_wptr(struct radeon_device *rdev,
2604 if (rdev->wb.enabled) { 2606 if (rdev->wb.enabled) {
2605 wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]); 2607 wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]);
2606 } else { 2608 } else {
2609 mutex_lock(&rdev->srbm_mutex);
2607 cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); 2610 cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0);
2608 wptr = RREG32(CP_HQD_PQ_WPTR); 2611 wptr = RREG32(CP_HQD_PQ_WPTR);
2609 cik_srbm_select(rdev, 0, 0, 0, 0); 2612 cik_srbm_select(rdev, 0, 0, 0, 0);
2613 mutex_unlock(&rdev->srbm_mutex);
2610 } 2614 }
2611 wptr = (wptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; 2615 wptr = (wptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift;
2612 2616
@@ -2897,6 +2901,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev)
2897 WREG32(CP_CPF_DEBUG, tmp); 2901 WREG32(CP_CPF_DEBUG, tmp);
2898 2902
2899 /* init the pipes */ 2903 /* init the pipes */
2904 mutex_lock(&rdev->srbm_mutex);
2900 for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) { 2905 for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) {
2901 int me = (i < 4) ? 1 : 2; 2906 int me = (i < 4) ? 1 : 2;
2902 int pipe = (i < 4) ? i : (i - 4); 2907 int pipe = (i < 4) ? i : (i - 4);
@@ -2919,6 +2924,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev)
2919 WREG32(CP_HPD_EOP_CONTROL, tmp); 2924 WREG32(CP_HPD_EOP_CONTROL, tmp);
2920 } 2925 }
2921 cik_srbm_select(rdev, 0, 0, 0, 0); 2926 cik_srbm_select(rdev, 0, 0, 0, 0);
2927 mutex_unlock(&rdev->srbm_mutex);
2922 2928
2923 /* init the queues. Just two for now. */ 2929 /* init the queues. Just two for now. */
2924 for (i = 0; i < 2; i++) { 2930 for (i = 0; i < 2; i++) {
@@ -2972,6 +2978,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev)
2972 mqd->static_thread_mgmt23[0] = 0xffffffff; 2978 mqd->static_thread_mgmt23[0] = 0xffffffff;
2973 mqd->static_thread_mgmt23[1] = 0xffffffff; 2979 mqd->static_thread_mgmt23[1] = 0xffffffff;
2974 2980
2981 mutex_lock(&rdev->srbm_mutex);
2975 cik_srbm_select(rdev, rdev->ring[idx].me, 2982 cik_srbm_select(rdev, rdev->ring[idx].me,
2976 rdev->ring[idx].pipe, 2983 rdev->ring[idx].pipe,
2977 rdev->ring[idx].queue, 0); 2984 rdev->ring[idx].queue, 0);
@@ -3099,6 +3106,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev)
3099 WREG32(CP_HQD_ACTIVE, mqd->queue_state.cp_hqd_active); 3106 WREG32(CP_HQD_ACTIVE, mqd->queue_state.cp_hqd_active);
3100 3107
3101 cik_srbm_select(rdev, 0, 0, 0, 0); 3108 cik_srbm_select(rdev, 0, 0, 0, 0);
3109 mutex_unlock(&rdev->srbm_mutex);
3102 3110
3103 radeon_bo_kunmap(rdev->ring[idx].mqd_obj); 3111 radeon_bo_kunmap(rdev->ring[idx].mqd_obj);
3104 radeon_bo_unreserve(rdev->ring[idx].mqd_obj); 3112 radeon_bo_unreserve(rdev->ring[idx].mqd_obj);
@@ -4320,6 +4328,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev)
4320 4328
4321 /* XXX SH_MEM regs */ 4329 /* XXX SH_MEM regs */
4322 /* where to put LDS, scratch, GPUVM in FSA64 space */ 4330 /* where to put LDS, scratch, GPUVM in FSA64 space */
4331 mutex_lock(&rdev->srbm_mutex);
4323 for (i = 0; i < 16; i++) { 4332 for (i = 0; i < 16; i++) {
4324 cik_srbm_select(rdev, 0, 0, 0, i); 4333 cik_srbm_select(rdev, 0, 0, 0, i);
4325 /* CP and shaders */ 4334 /* CP and shaders */
@@ -4335,6 +4344,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev)
4335 /* XXX SDMA RLC - todo */ 4344 /* XXX SDMA RLC - todo */
4336 } 4345 }
4337 cik_srbm_select(rdev, 0, 0, 0, 0); 4346 cik_srbm_select(rdev, 0, 0, 0, 0);
4347 mutex_unlock(&rdev->srbm_mutex);
4338 4348
4339 cik_pcie_gart_tlb_flush(rdev); 4349 cik_pcie_gart_tlb_flush(rdev);
4340 DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", 4350 DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n",
@@ -5954,6 +5964,8 @@ static int cik_startup(struct radeon_device *rdev)
5954 struct radeon_ring *ring; 5964 struct radeon_ring *ring;
5955 int r; 5965 int r;
5956 5966
5967 cik_mc_program(rdev);
5968
5957 if (rdev->flags & RADEON_IS_IGP) { 5969 if (rdev->flags & RADEON_IS_IGP) {
5958 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || 5970 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw ||
5959 !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) { 5971 !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) {
@@ -5985,7 +5997,6 @@ static int cik_startup(struct radeon_device *rdev)
5985 if (r) 5997 if (r)
5986 return r; 5998 return r;
5987 5999
5988 cik_mc_program(rdev);
5989 r = cik_pcie_gart_enable(rdev); 6000 r = cik_pcie_gart_enable(rdev);
5990 if (r) 6001 if (r)
5991 return r; 6002 return r;
@@ -6194,7 +6205,7 @@ int cik_suspend(struct radeon_device *rdev)
6194 radeon_vm_manager_fini(rdev); 6205 radeon_vm_manager_fini(rdev);
6195 cik_cp_enable(rdev, false); 6206 cik_cp_enable(rdev, false);
6196 cik_sdma_enable(rdev, false); 6207 cik_sdma_enable(rdev, false);
6197 r600_uvd_rbc_stop(rdev); 6208 r600_uvd_stop(rdev);
6198 radeon_uvd_suspend(rdev); 6209 radeon_uvd_suspend(rdev);
6199 cik_irq_suspend(rdev); 6210 cik_irq_suspend(rdev);
6200 radeon_wb_disable(rdev); 6211 radeon_wb_disable(rdev);
@@ -6358,6 +6369,7 @@ void cik_fini(struct radeon_device *rdev)
6358 radeon_vm_manager_fini(rdev); 6369 radeon_vm_manager_fini(rdev);
6359 radeon_ib_pool_fini(rdev); 6370 radeon_ib_pool_fini(rdev);
6360 radeon_irq_kms_fini(rdev); 6371 radeon_irq_kms_fini(rdev);
6372 r600_uvd_stop(rdev);
6361 radeon_uvd_fini(rdev); 6373 radeon_uvd_fini(rdev);
6362 cik_pcie_gart_fini(rdev); 6374 cik_pcie_gart_fini(rdev);
6363 r600_vram_scratch_fini(rdev); 6375 r600_vram_scratch_fini(rdev);
@@ -6978,7 +6990,7 @@ int cik_uvd_resume(struct radeon_device *rdev)
6978 6990
6979 /* programm the VCPU memory controller bits 0-27 */ 6991 /* programm the VCPU memory controller bits 0-27 */
6980 addr = rdev->uvd.gpu_addr >> 3; 6992 addr = rdev->uvd.gpu_addr >> 3;
6981 size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; 6993 size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3;
6982 WREG32(UVD_VCPU_CACHE_OFFSET0, addr); 6994 WREG32(UVD_VCPU_CACHE_OFFSET0, addr);
6983 WREG32(UVD_VCPU_CACHE_SIZE0, size); 6995 WREG32(UVD_VCPU_CACHE_SIZE0, size);
6984 6996
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c
index 9bcdd174780f..7e5d0b570a30 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -2038,9 +2038,6 @@ int cypress_dpm_init(struct radeon_device *rdev)
2038{ 2038{
2039 struct rv7xx_power_info *pi; 2039 struct rv7xx_power_info *pi;
2040 struct evergreen_power_info *eg_pi; 2040 struct evergreen_power_info *eg_pi;
2041 int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info);
2042 uint16_t data_offset, size;
2043 uint8_t frev, crev;
2044 struct atom_clock_dividers dividers; 2041 struct atom_clock_dividers dividers;
2045 int ret; 2042 int ret;
2046 2043
@@ -2092,16 +2089,7 @@ int cypress_dpm_init(struct radeon_device *rdev)
2092 eg_pi->vddci_control = 2089 eg_pi->vddci_control =
2093 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); 2090 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0);
2094 2091
2095 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 2092 rv770_get_engine_memory_ss(rdev);
2096 &frev, &crev, &data_offset)) {
2097 pi->sclk_ss = true;
2098 pi->mclk_ss = true;
2099 pi->dynamic_ss = true;
2100 } else {
2101 pi->sclk_ss = false;
2102 pi->mclk_ss = false;
2103 pi->dynamic_ss = true;
2104 }
2105 2093
2106 pi->asi = RV770_ASI_DFLT; 2094 pi->asi = RV770_ASI_DFLT;
2107 pi->pasi = CYPRESS_HASI_DFLT; 2095 pi->pasi = CYPRESS_HASI_DFLT;
@@ -2122,8 +2110,7 @@ int cypress_dpm_init(struct radeon_device *rdev)
2122 2110
2123 pi->dynamic_pcie_gen2 = true; 2111 pi->dynamic_pcie_gen2 = true;
2124 2112
2125 if (pi->gfx_clock_gating && 2113 if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)
2126 (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE))
2127 pi->thermal_protection = true; 2114 pi->thermal_protection = true;
2128 else 2115 else
2129 pi->thermal_protection = false; 2116 pi->thermal_protection = false;
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 038dcac7670c..d5b49e33315e 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -5106,6 +5106,8 @@ static int evergreen_startup(struct radeon_device *rdev)
5106 /* enable aspm */ 5106 /* enable aspm */
5107 evergreen_program_aspm(rdev); 5107 evergreen_program_aspm(rdev);
5108 5108
5109 evergreen_mc_program(rdev);
5110
5109 if (ASIC_IS_DCE5(rdev)) { 5111 if (ASIC_IS_DCE5(rdev)) {
5110 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { 5112 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) {
5111 r = ni_init_microcode(rdev); 5113 r = ni_init_microcode(rdev);
@@ -5133,7 +5135,6 @@ static int evergreen_startup(struct radeon_device *rdev)
5133 if (r) 5135 if (r)
5134 return r; 5136 return r;
5135 5137
5136 evergreen_mc_program(rdev);
5137 if (rdev->flags & RADEON_IS_AGP) { 5138 if (rdev->flags & RADEON_IS_AGP) {
5138 evergreen_agp_enable(rdev); 5139 evergreen_agp_enable(rdev);
5139 } else { 5140 } else {
@@ -5291,10 +5292,10 @@ int evergreen_resume(struct radeon_device *rdev)
5291int evergreen_suspend(struct radeon_device *rdev) 5292int evergreen_suspend(struct radeon_device *rdev)
5292{ 5293{
5293 r600_audio_fini(rdev); 5294 r600_audio_fini(rdev);
5295 r600_uvd_stop(rdev);
5294 radeon_uvd_suspend(rdev); 5296 radeon_uvd_suspend(rdev);
5295 r700_cp_stop(rdev); 5297 r700_cp_stop(rdev);
5296 r600_dma_stop(rdev); 5298 r600_dma_stop(rdev);
5297 r600_uvd_rbc_stop(rdev);
5298 evergreen_irq_suspend(rdev); 5299 evergreen_irq_suspend(rdev);
5299 radeon_wb_disable(rdev); 5300 radeon_wb_disable(rdev);
5300 evergreen_pcie_gart_disable(rdev); 5301 evergreen_pcie_gart_disable(rdev);
@@ -5429,6 +5430,7 @@ void evergreen_fini(struct radeon_device *rdev)
5429 radeon_ib_pool_fini(rdev); 5430 radeon_ib_pool_fini(rdev);
5430 radeon_irq_kms_fini(rdev); 5431 radeon_irq_kms_fini(rdev);
5431 evergreen_pcie_gart_fini(rdev); 5432 evergreen_pcie_gart_fini(rdev);
5433 r600_uvd_stop(rdev);
5432 radeon_uvd_fini(rdev); 5434 radeon_uvd_fini(rdev);
5433 r600_vram_scratch_fini(rdev); 5435 r600_vram_scratch_fini(rdev);
5434 radeon_gem_fini(rdev); 5436 radeon_gem_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index bb9ea3641312..b0e280058b9b 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -148,18 +148,40 @@ static void evergreen_audio_set_dto(struct drm_encoder *encoder, u32 clock)
148 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 148 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
149 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); 149 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
150 u32 base_rate = 24000; 150 u32 base_rate = 24000;
151 u32 max_ratio = clock / base_rate;
152 u32 dto_phase;
153 u32 dto_modulo = clock;
154 u32 wallclock_ratio;
155 u32 dto_cntl;
151 156
152 if (!dig || !dig->afmt) 157 if (!dig || !dig->afmt)
153 return; 158 return;
154 159
160 if (max_ratio >= 8) {
161 dto_phase = 192 * 1000;
162 wallclock_ratio = 3;
163 } else if (max_ratio >= 4) {
164 dto_phase = 96 * 1000;
165 wallclock_ratio = 2;
166 } else if (max_ratio >= 2) {
167 dto_phase = 48 * 1000;
168 wallclock_ratio = 1;
169 } else {
170 dto_phase = 24 * 1000;
171 wallclock_ratio = 0;
172 }
173 dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK;
174 dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio);
175 WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl);
176
155 /* XXX two dtos; generally use dto0 for hdmi */ 177 /* XXX two dtos; generally use dto0 for hdmi */
156 /* Express [24MHz / target pixel clock] as an exact rational 178 /* Express [24MHz / target pixel clock] as an exact rational
157 * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE 179 * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE
158 * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator 180 * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator
159 */ 181 */
160 WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); 182 WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id));
161 WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); 183 WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase);
162 WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); 184 WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo);
163} 185}
164 186
165 187
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index a7baf67aef6c..0d582ac1dc31 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -497,6 +497,9 @@
497#define DCCG_AUDIO_DTO0_MODULE 0x05b4 497#define DCCG_AUDIO_DTO0_MODULE 0x05b4
498#define DCCG_AUDIO_DTO0_LOAD 0x05b8 498#define DCCG_AUDIO_DTO0_LOAD 0x05b8
499#define DCCG_AUDIO_DTO0_CNTL 0x05bc 499#define DCCG_AUDIO_DTO0_CNTL 0x05bc
500# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0)
501# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7
502# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0
500 503
501#define DCCG_AUDIO_DTO1_PHASE 0x05c0 504#define DCCG_AUDIO_DTO1_PHASE 0x05c0
502#define DCCG_AUDIO_DTO1_MODULE 0x05c4 505#define DCCG_AUDIO_DTO1_MODULE 0x05c4
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 56bd4f3be4fe..ccb4f8b54852 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -794,9 +794,13 @@ int ni_init_microcode(struct radeon_device *rdev)
794 if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { 794 if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) {
795 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); 795 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name);
796 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); 796 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
797 if (err) 797 if (err) {
798 goto out; 798 printk(KERN_ERR
799 if (rdev->smc_fw->size != smc_req_size) { 799 "smc: error loading firmware \"%s\"\n",
800 fw_name);
801 release_firmware(rdev->smc_fw);
802 rdev->smc_fw = NULL;
803 } else if (rdev->smc_fw->size != smc_req_size) {
800 printk(KERN_ERR 804 printk(KERN_ERR
801 "ni_mc: Bogus length %zu in firmware \"%s\"\n", 805 "ni_mc: Bogus length %zu in firmware \"%s\"\n",
802 rdev->mc_fw->size, fw_name); 806 rdev->mc_fw->size, fw_name);
@@ -2079,6 +2083,8 @@ static int cayman_startup(struct radeon_device *rdev)
2079 /* enable aspm */ 2083 /* enable aspm */
2080 evergreen_program_aspm(rdev); 2084 evergreen_program_aspm(rdev);
2081 2085
2086 evergreen_mc_program(rdev);
2087
2082 if (rdev->flags & RADEON_IS_IGP) { 2088 if (rdev->flags & RADEON_IS_IGP) {
2083 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { 2089 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
2084 r = ni_init_microcode(rdev); 2090 r = ni_init_microcode(rdev);
@@ -2107,7 +2113,6 @@ static int cayman_startup(struct radeon_device *rdev)
2107 if (r) 2113 if (r)
2108 return r; 2114 return r;
2109 2115
2110 evergreen_mc_program(rdev);
2111 r = cayman_pcie_gart_enable(rdev); 2116 r = cayman_pcie_gart_enable(rdev);
2112 if (r) 2117 if (r)
2113 return r; 2118 return r;
@@ -2286,7 +2291,7 @@ int cayman_suspend(struct radeon_device *rdev)
2286 radeon_vm_manager_fini(rdev); 2291 radeon_vm_manager_fini(rdev);
2287 cayman_cp_enable(rdev, false); 2292 cayman_cp_enable(rdev, false);
2288 cayman_dma_stop(rdev); 2293 cayman_dma_stop(rdev);
2289 r600_uvd_rbc_stop(rdev); 2294 r600_uvd_stop(rdev);
2290 radeon_uvd_suspend(rdev); 2295 radeon_uvd_suspend(rdev);
2291 evergreen_irq_suspend(rdev); 2296 evergreen_irq_suspend(rdev);
2292 radeon_wb_disable(rdev); 2297 radeon_wb_disable(rdev);
@@ -2418,6 +2423,7 @@ void cayman_fini(struct radeon_device *rdev)
2418 radeon_vm_manager_fini(rdev); 2423 radeon_vm_manager_fini(rdev);
2419 radeon_ib_pool_fini(rdev); 2424 radeon_ib_pool_fini(rdev);
2420 radeon_irq_kms_fini(rdev); 2425 radeon_irq_kms_fini(rdev);
2426 r600_uvd_stop(rdev);
2421 radeon_uvd_fini(rdev); 2427 radeon_uvd_fini(rdev);
2422 cayman_pcie_gart_fini(rdev); 2428 cayman_pcie_gart_fini(rdev);
2423 r600_vram_scratch_fini(rdev); 2429 r600_vram_scratch_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index 4f9b9bc20daa..f0f5f748938a 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -4067,9 +4067,6 @@ int ni_dpm_init(struct radeon_device *rdev)
4067 struct rv7xx_power_info *pi; 4067 struct rv7xx_power_info *pi;
4068 struct evergreen_power_info *eg_pi; 4068 struct evergreen_power_info *eg_pi;
4069 struct ni_power_info *ni_pi; 4069 struct ni_power_info *ni_pi;
4070 int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info);
4071 u16 data_offset, size;
4072 u8 frev, crev;
4073 struct atom_clock_dividers dividers; 4070 struct atom_clock_dividers dividers;
4074 int ret; 4071 int ret;
4075 4072
@@ -4162,16 +4159,7 @@ int ni_dpm_init(struct radeon_device *rdev)
4162 eg_pi->vddci_control = 4159 eg_pi->vddci_control =
4163 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); 4160 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0);
4164 4161
4165 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 4162 rv770_get_engine_memory_ss(rdev);
4166 &frev, &crev, &data_offset)) {
4167 pi->sclk_ss = true;
4168 pi->mclk_ss = true;
4169 pi->dynamic_ss = true;
4170 } else {
4171 pi->sclk_ss = false;
4172 pi->mclk_ss = false;
4173 pi->dynamic_ss = true;
4174 }
4175 4163
4176 pi->asi = RV770_ASI_DFLT; 4164 pi->asi = RV770_ASI_DFLT;
4177 pi->pasi = CYPRESS_HASI_DFLT; 4165 pi->pasi = CYPRESS_HASI_DFLT;
@@ -4188,8 +4176,7 @@ int ni_dpm_init(struct radeon_device *rdev)
4188 4176
4189 pi->dynamic_pcie_gen2 = true; 4177 pi->dynamic_pcie_gen2 = true;
4190 4178
4191 if (pi->gfx_clock_gating && 4179 if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)
4192 (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE))
4193 pi->thermal_protection = true; 4180 pi->thermal_protection = true;
4194 else 4181 else
4195 pi->thermal_protection = false; 4182 pi->thermal_protection = false;
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 10f712e37003..e66e72077350 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2299,9 +2299,13 @@ int r600_init_microcode(struct radeon_device *rdev)
2299 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { 2299 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) {
2300 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); 2300 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name);
2301 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); 2301 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
2302 if (err) 2302 if (err) {
2303 goto out; 2303 printk(KERN_ERR
2304 if (rdev->smc_fw->size != smc_req_size) { 2304 "smc: error loading firmware \"%s\"\n",
2305 fw_name);
2306 release_firmware(rdev->smc_fw);
2307 rdev->smc_fw = NULL;
2308 } else if (rdev->smc_fw->size != smc_req_size) {
2305 printk(KERN_ERR 2309 printk(KERN_ERR
2306 "smc: Bogus length %zu in firmware \"%s\"\n", 2310 "smc: Bogus length %zu in firmware \"%s\"\n",
2307 rdev->smc_fw->size, fw_name); 2311 rdev->smc_fw->size, fw_name);
@@ -2697,12 +2701,29 @@ int r600_uvd_rbc_start(struct radeon_device *rdev)
2697 return 0; 2701 return 0;
2698} 2702}
2699 2703
2700void r600_uvd_rbc_stop(struct radeon_device *rdev) 2704void r600_uvd_stop(struct radeon_device *rdev)
2701{ 2705{
2702 struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; 2706 struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX];
2703 2707
2704 /* force RBC into idle state */ 2708 /* force RBC into idle state */
2705 WREG32(UVD_RBC_RB_CNTL, 0x11010101); 2709 WREG32(UVD_RBC_RB_CNTL, 0x11010101);
2710
2711 /* Stall UMC and register bus before resetting VCPU */
2712 WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8));
2713 WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3));
2714 mdelay(1);
2715
2716 /* put VCPU into reset */
2717 WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET);
2718 mdelay(5);
2719
2720 /* disable VCPU clock */
2721 WREG32(UVD_VCPU_CNTL, 0x0);
2722
2723 /* Unstall UMC and register bus */
2724 WREG32_P(UVD_LMI_CTRL2, 0, ~(1 << 8));
2725 WREG32_P(UVD_RB_ARB_CTRL, 0, ~(1 << 3));
2726
2706 ring->ready = false; 2727 ring->ready = false;
2707} 2728}
2708 2729
@@ -2722,6 +2743,11 @@ int r600_uvd_init(struct radeon_device *rdev)
2722 /* disable interupt */ 2743 /* disable interupt */
2723 WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1)); 2744 WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1));
2724 2745
2746 /* Stall UMC and register bus before resetting VCPU */
2747 WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8));
2748 WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3));
2749 mdelay(1);
2750
2725 /* put LMI, VCPU, RBC etc... into reset */ 2751 /* put LMI, VCPU, RBC etc... into reset */
2726 WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET | 2752 WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET |
2727 LBSI_SOFT_RESET | RBC_SOFT_RESET | CSM_SOFT_RESET | 2753 LBSI_SOFT_RESET | RBC_SOFT_RESET | CSM_SOFT_RESET |
@@ -2751,10 +2777,6 @@ int r600_uvd_init(struct radeon_device *rdev)
2751 WREG32(UVD_MPC_SET_ALU, 0); 2777 WREG32(UVD_MPC_SET_ALU, 0);
2752 WREG32(UVD_MPC_SET_MUX, 0x88); 2778 WREG32(UVD_MPC_SET_MUX, 0x88);
2753 2779
2754 /* Stall UMC */
2755 WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8));
2756 WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3));
2757
2758 /* take all subblocks out of reset, except VCPU */ 2780 /* take all subblocks out of reset, except VCPU */
2759 WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); 2781 WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET);
2760 mdelay(5); 2782 mdelay(5);
@@ -3312,6 +3334,8 @@ static int r600_startup(struct radeon_device *rdev)
3312 /* enable pcie gen2 link */ 3334 /* enable pcie gen2 link */
3313 r600_pcie_gen2_enable(rdev); 3335 r600_pcie_gen2_enable(rdev);
3314 3336
3337 r600_mc_program(rdev);
3338
3315 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { 3339 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
3316 r = r600_init_microcode(rdev); 3340 r = r600_init_microcode(rdev);
3317 if (r) { 3341 if (r) {
@@ -3324,7 +3348,6 @@ static int r600_startup(struct radeon_device *rdev)
3324 if (r) 3348 if (r)
3325 return r; 3349 return r;
3326 3350
3327 r600_mc_program(rdev);
3328 if (rdev->flags & RADEON_IS_AGP) { 3351 if (rdev->flags & RADEON_IS_AGP) {
3329 r600_agp_enable(rdev); 3352 r600_agp_enable(rdev);
3330 } else { 3353 } else {
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index f48240bb8c56..f264df5470f7 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -226,10 +226,29 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock)
226 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 226 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
227 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 227 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
228 u32 base_rate = 24000; 228 u32 base_rate = 24000;
229 u32 max_ratio = clock / base_rate;
230 u32 dto_phase;
231 u32 dto_modulo = clock;
232 u32 wallclock_ratio;
233 u32 dto_cntl;
229 234
230 if (!dig || !dig->afmt) 235 if (!dig || !dig->afmt)
231 return; 236 return;
232 237
238 if (max_ratio >= 8) {
239 dto_phase = 192 * 1000;
240 wallclock_ratio = 3;
241 } else if (max_ratio >= 4) {
242 dto_phase = 96 * 1000;
243 wallclock_ratio = 2;
244 } else if (max_ratio >= 2) {
245 dto_phase = 48 * 1000;
246 wallclock_ratio = 1;
247 } else {
248 dto_phase = 24 * 1000;
249 wallclock_ratio = 0;
250 }
251
233 /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. 252 /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT.
234 * doesn't matter which one you use. Just use the first one. 253 * doesn't matter which one you use. Just use the first one.
235 */ 254 */
@@ -242,9 +261,21 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock)
242 /* according to the reg specs, this should DCE3.2 only, but in 261 /* according to the reg specs, this should DCE3.2 only, but in
243 * practice it seems to cover DCE3.0 as well. 262 * practice it seems to cover DCE3.0 as well.
244 */ 263 */
245 WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); 264 if (dig->dig_encoder == 0) {
246 WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); 265 dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK;
247 WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ 266 dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio);
267 WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl);
268 WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase);
269 WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo);
270 WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */
271 } else {
272 dto_cntl = RREG32(DCCG_AUDIO_DTO1_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK;
273 dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio);
274 WREG32(DCCG_AUDIO_DTO1_CNTL, dto_cntl);
275 WREG32(DCCG_AUDIO_DTO1_PHASE, dto_phase);
276 WREG32(DCCG_AUDIO_DTO1_MODULE, dto_modulo);
277 WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */
278 }
248 } else { 279 } else {
249 /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ 280 /* according to the reg specs, this should be DCE2.0 and DCE3.0 */
250 WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) | 281 WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 8e3fe815edab..7c780839a7f4 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -933,6 +933,9 @@
933#define DCCG_AUDIO_DTO0_LOAD 0x051c 933#define DCCG_AUDIO_DTO0_LOAD 0x051c
934# define DTO_LOAD (1 << 31) 934# define DTO_LOAD (1 << 31)
935#define DCCG_AUDIO_DTO0_CNTL 0x0520 935#define DCCG_AUDIO_DTO0_CNTL 0x0520
936# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0)
937# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7
938# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0
936 939
937#define DCCG_AUDIO_DTO1_PHASE 0x0524 940#define DCCG_AUDIO_DTO1_PHASE 0x0524
938#define DCCG_AUDIO_DTO1_MODULE 0x0528 941#define DCCG_AUDIO_DTO1_MODULE 0x0528
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 2f08219c39b6..274b8e1b889f 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1468,7 +1468,6 @@ struct radeon_uvd {
1468 void *cpu_addr; 1468 void *cpu_addr;
1469 uint64_t gpu_addr; 1469 uint64_t gpu_addr;
1470 void *saved_bo; 1470 void *saved_bo;
1471 unsigned fw_size;
1472 atomic_t handles[RADEON_MAX_UVD_HANDLES]; 1471 atomic_t handles[RADEON_MAX_UVD_HANDLES];
1473 struct drm_file *filp[RADEON_MAX_UVD_HANDLES]; 1472 struct drm_file *filp[RADEON_MAX_UVD_HANDLES];
1474 struct delayed_work idle_work; 1473 struct delayed_work idle_work;
@@ -2066,6 +2065,7 @@ struct radeon_device {
2066 const struct firmware *mec_fw; /* CIK MEC firmware */ 2065 const struct firmware *mec_fw; /* CIK MEC firmware */
2067 const struct firmware *sdma_fw; /* CIK SDMA firmware */ 2066 const struct firmware *sdma_fw; /* CIK SDMA firmware */
2068 const struct firmware *smc_fw; /* SMC firmware */ 2067 const struct firmware *smc_fw; /* SMC firmware */
2068 const struct firmware *uvd_fw; /* UVD firmware */
2069 struct r600_blit r600_blit; 2069 struct r600_blit r600_blit;
2070 struct r600_vram_scratch vram_scratch; 2070 struct r600_vram_scratch vram_scratch;
2071 int msi_enabled; /* msi enabled */ 2071 int msi_enabled; /* msi enabled */
@@ -2095,6 +2095,8 @@ struct radeon_device {
2095 /* ACPI interface */ 2095 /* ACPI interface */
2096 struct radeon_atif atif; 2096 struct radeon_atif atif;
2097 struct radeon_atcs atcs; 2097 struct radeon_atcs atcs;
2098 /* srbm instance registers */
2099 struct mutex srbm_mutex;
2098}; 2100};
2099 2101
2100int radeon_device_init(struct radeon_device *rdev, 2102int radeon_device_init(struct radeon_device *rdev,
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 902479fa737f..3d61d5aac18f 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -441,7 +441,7 @@ void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rde
441/* uvd */ 441/* uvd */
442int r600_uvd_init(struct radeon_device *rdev); 442int r600_uvd_init(struct radeon_device *rdev);
443int r600_uvd_rbc_start(struct radeon_device *rdev); 443int r600_uvd_rbc_start(struct radeon_device *rdev);
444void r600_uvd_rbc_stop(struct radeon_device *rdev); 444void r600_uvd_stop(struct radeon_device *rdev);
445int r600_uvd_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); 445int r600_uvd_ib_test(struct radeon_device *rdev, struct radeon_ring *ring);
446void r600_uvd_fence_emit(struct radeon_device *rdev, 446void r600_uvd_fence_emit(struct radeon_device *rdev,
447 struct radeon_fence *fence); 447 struct radeon_fence *fence);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 82335e38ec4f..63398ae1dbf5 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1163,6 +1163,7 @@ int radeon_device_init(struct radeon_device *rdev,
1163 mutex_init(&rdev->gem.mutex); 1163 mutex_init(&rdev->gem.mutex);
1164 mutex_init(&rdev->pm.mutex); 1164 mutex_init(&rdev->pm.mutex);
1165 mutex_init(&rdev->gpu_clock_mutex); 1165 mutex_init(&rdev->gpu_clock_mutex);
1166 mutex_init(&rdev->srbm_mutex);
1166 init_rwsem(&rdev->pm.mclk_lock); 1167 init_rwsem(&rdev->pm.mclk_lock);
1167 init_rwsem(&rdev->exclusive_lock); 1168 init_rwsem(&rdev->exclusive_lock);
1168 init_waitqueue_head(&rdev->irq.vblank_queue); 1169 init_waitqueue_head(&rdev->irq.vblank_queue);
@@ -1519,6 +1520,7 @@ int radeon_gpu_reset(struct radeon_device *rdev)
1519 radeon_save_bios_scratch_regs(rdev); 1520 radeon_save_bios_scratch_regs(rdev);
1520 /* block TTM */ 1521 /* block TTM */
1521 resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); 1522 resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev);
1523 radeon_pm_suspend(rdev);
1522 radeon_suspend(rdev); 1524 radeon_suspend(rdev);
1523 1525
1524 for (i = 0; i < RADEON_NUM_RINGS; ++i) { 1526 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
@@ -1564,6 +1566,7 @@ retry:
1564 } 1566 }
1565 } 1567 }
1566 1568
1569 radeon_pm_resume(rdev);
1567 drm_helper_resume_force_mode(rdev->ddev); 1570 drm_helper_resume_force_mode(rdev->ddev);
1568 1571
1569 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); 1572 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index 7ddb0efe2408..ddb8f8e04eb5 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -782,7 +782,7 @@ int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring)
782 782
783 } else { 783 } else {
784 /* put fence directly behind firmware */ 784 /* put fence directly behind firmware */
785 index = ALIGN(rdev->uvd.fw_size, 8); 785 index = ALIGN(rdev->uvd_fw->size, 8);
786 rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index; 786 rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index;
787 rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index; 787 rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index;
788 } 788 }
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index 6a51d943ccf4..b990b1a2bd50 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -207,7 +207,6 @@ void radeon_gart_table_vram_free(struct radeon_device *rdev)
207 if (rdev->gart.robj == NULL) { 207 if (rdev->gart.robj == NULL) {
208 return; 208 return;
209 } 209 }
210 radeon_gart_table_vram_unpin(rdev);
211 radeon_bo_unref(&rdev->gart.robj); 210 radeon_bo_unref(&rdev->gart.robj);
212} 211}
213 212
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index f374c467aaca..c557850cd345 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -1176,7 +1176,14 @@ int radeon_pm_init(struct radeon_device *rdev)
1176 case CHIP_VERDE: 1176 case CHIP_VERDE:
1177 case CHIP_OLAND: 1177 case CHIP_OLAND:
1178 case CHIP_HAINAN: 1178 case CHIP_HAINAN:
1179 if (radeon_dpm == 1) 1179 /* DPM requires the RLC, RV770+ dGPU requires SMC */
1180 if (!rdev->rlc_fw)
1181 rdev->pm.pm_method = PM_METHOD_PROFILE;
1182 else if ((rdev->family >= CHIP_RV770) &&
1183 (!(rdev->flags & RADEON_IS_IGP)) &&
1184 (!rdev->smc_fw))
1185 rdev->pm.pm_method = PM_METHOD_PROFILE;
1186 else if (radeon_dpm == 1)
1180 rdev->pm.pm_method = PM_METHOD_DPM; 1187 rdev->pm.pm_method = PM_METHOD_DPM;
1181 else 1188 else
1182 rdev->pm.pm_method = PM_METHOD_PROFILE; 1189 rdev->pm.pm_method = PM_METHOD_PROFILE;
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index 414fd145d20e..f1c15754e73c 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -56,7 +56,6 @@ static void radeon_uvd_idle_work_handler(struct work_struct *work);
56 56
57int radeon_uvd_init(struct radeon_device *rdev) 57int radeon_uvd_init(struct radeon_device *rdev)
58{ 58{
59 const struct firmware *fw;
60 unsigned long bo_size; 59 unsigned long bo_size;
61 const char *fw_name; 60 const char *fw_name;
62 int i, r; 61 int i, r;
@@ -105,14 +104,14 @@ int radeon_uvd_init(struct radeon_device *rdev)
105 return -EINVAL; 104 return -EINVAL;
106 } 105 }
107 106
108 r = request_firmware(&fw, fw_name, rdev->dev); 107 r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev);
109 if (r) { 108 if (r) {
110 dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", 109 dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n",
111 fw_name); 110 fw_name);
112 return r; 111 return r;
113 } 112 }
114 113
115 bo_size = RADEON_GPU_PAGE_ALIGN(fw->size + 8) + 114 bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 8) +
116 RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; 115 RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE;
117 r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, 116 r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true,
118 RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo); 117 RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo);
@@ -145,12 +144,6 @@ int radeon_uvd_init(struct radeon_device *rdev)
145 144
146 radeon_bo_unreserve(rdev->uvd.vcpu_bo); 145 radeon_bo_unreserve(rdev->uvd.vcpu_bo);
147 146
148 rdev->uvd.fw_size = fw->size;
149 memset(rdev->uvd.cpu_addr, 0, bo_size);
150 memcpy(rdev->uvd.cpu_addr, fw->data, fw->size);
151
152 release_firmware(fw);
153
154 for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { 147 for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) {
155 atomic_set(&rdev->uvd.handles[i], 0); 148 atomic_set(&rdev->uvd.handles[i], 0);
156 rdev->uvd.filp[i] = NULL; 149 rdev->uvd.filp[i] = NULL;
@@ -174,33 +167,60 @@ void radeon_uvd_fini(struct radeon_device *rdev)
174 } 167 }
175 168
176 radeon_bo_unref(&rdev->uvd.vcpu_bo); 169 radeon_bo_unref(&rdev->uvd.vcpu_bo);
170
171 release_firmware(rdev->uvd_fw);
177} 172}
178 173
179int radeon_uvd_suspend(struct radeon_device *rdev) 174int radeon_uvd_suspend(struct radeon_device *rdev)
180{ 175{
181 unsigned size; 176 unsigned size;
177 void *ptr;
178 int i;
182 179
183 if (rdev->uvd.vcpu_bo == NULL) 180 if (rdev->uvd.vcpu_bo == NULL)
184 return 0; 181 return 0;
185 182
183 for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i)
184 if (atomic_read(&rdev->uvd.handles[i]))
185 break;
186
187 if (i == RADEON_MAX_UVD_HANDLES)
188 return 0;
189
186 size = radeon_bo_size(rdev->uvd.vcpu_bo); 190 size = radeon_bo_size(rdev->uvd.vcpu_bo);
191 size -= rdev->uvd_fw->size;
192
193 ptr = rdev->uvd.cpu_addr;
194 ptr += rdev->uvd_fw->size;
195
187 rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); 196 rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL);
188 memcpy(rdev->uvd.saved_bo, rdev->uvd.cpu_addr, size); 197 memcpy(rdev->uvd.saved_bo, ptr, size);
189 198
190 return 0; 199 return 0;
191} 200}
192 201
193int radeon_uvd_resume(struct radeon_device *rdev) 202int radeon_uvd_resume(struct radeon_device *rdev)
194{ 203{
204 unsigned size;
205 void *ptr;
206
195 if (rdev->uvd.vcpu_bo == NULL) 207 if (rdev->uvd.vcpu_bo == NULL)
196 return -EINVAL; 208 return -EINVAL;
197 209
210 memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size);
211
212 size = radeon_bo_size(rdev->uvd.vcpu_bo);
213 size -= rdev->uvd_fw->size;
214
215 ptr = rdev->uvd.cpu_addr;
216 ptr += rdev->uvd_fw->size;
217
198 if (rdev->uvd.saved_bo != NULL) { 218 if (rdev->uvd.saved_bo != NULL) {
199 unsigned size = radeon_bo_size(rdev->uvd.vcpu_bo); 219 memcpy(ptr, rdev->uvd.saved_bo, size);
200 memcpy(rdev->uvd.cpu_addr, rdev->uvd.saved_bo, size);
201 kfree(rdev->uvd.saved_bo); 220 kfree(rdev->uvd.saved_bo);
202 rdev->uvd.saved_bo = NULL; 221 rdev->uvd.saved_bo = NULL;
203 } 222 } else
223 memset(ptr, 0, size);
204 224
205 return 0; 225 return 0;
206} 226}
@@ -215,8 +235,8 @@ void radeon_uvd_free_handles(struct radeon_device *rdev, struct drm_file *filp)
215{ 235{
216 int i, r; 236 int i, r;
217 for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { 237 for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) {
218 if (rdev->uvd.filp[i] == filp) { 238 uint32_t handle = atomic_read(&rdev->uvd.handles[i]);
219 uint32_t handle = atomic_read(&rdev->uvd.handles[i]); 239 if (handle != 0 && rdev->uvd.filp[i] == filp) {
220 struct radeon_fence *fence; 240 struct radeon_fence *fence;
221 241
222 r = radeon_uvd_get_destroy_msg(rdev, 242 r = radeon_uvd_get_destroy_msg(rdev,
@@ -337,8 +357,10 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
337 } 357 }
338 358
339 r = radeon_bo_kmap(bo, &ptr); 359 r = radeon_bo_kmap(bo, &ptr);
340 if (r) 360 if (r) {
361 DRM_ERROR("Failed mapping the UVD message (%d)!\n", r);
341 return r; 362 return r;
363 }
342 364
343 msg = ptr + offset; 365 msg = ptr + offset;
344 366
@@ -364,8 +386,14 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
364 radeon_bo_kunmap(bo); 386 radeon_bo_kunmap(bo);
365 return 0; 387 return 0;
366 } else { 388 } else {
367 /* it's a create msg, no special handling needed */
368 radeon_bo_kunmap(bo); 389 radeon_bo_kunmap(bo);
390
391 if (msg_type != 0) {
392 DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type);
393 return -EINVAL;
394 }
395
396 /* it's a create msg, no special handling needed */
369 } 397 }
370 398
371 /* create or decode, validate the handle */ 399 /* create or decode, validate the handle */
@@ -388,7 +416,7 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
388 416
389static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, 417static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p,
390 int data0, int data1, 418 int data0, int data1,
391 unsigned buf_sizes[]) 419 unsigned buf_sizes[], bool *has_msg_cmd)
392{ 420{
393 struct radeon_cs_chunk *relocs_chunk; 421 struct radeon_cs_chunk *relocs_chunk;
394 struct radeon_cs_reloc *reloc; 422 struct radeon_cs_reloc *reloc;
@@ -417,7 +445,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p,
417 445
418 if (cmd < 0x4) { 446 if (cmd < 0x4) {
419 if ((end - start) < buf_sizes[cmd]) { 447 if ((end - start) < buf_sizes[cmd]) {
420 DRM_ERROR("buffer to small (%d / %d)!\n", 448 DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd,
421 (unsigned)(end - start), buf_sizes[cmd]); 449 (unsigned)(end - start), buf_sizes[cmd]);
422 return -EINVAL; 450 return -EINVAL;
423 } 451 }
@@ -442,9 +470,17 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p,
442 } 470 }
443 471
444 if (cmd == 0) { 472 if (cmd == 0) {
473 if (*has_msg_cmd) {
474 DRM_ERROR("More than one message in a UVD-IB!\n");
475 return -EINVAL;
476 }
477 *has_msg_cmd = true;
445 r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes); 478 r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes);
446 if (r) 479 if (r)
447 return r; 480 return r;
481 } else if (!*has_msg_cmd) {
482 DRM_ERROR("Message needed before other commands are send!\n");
483 return -EINVAL;
448 } 484 }
449 485
450 return 0; 486 return 0;
@@ -453,7 +489,8 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p,
453static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, 489static int radeon_uvd_cs_reg(struct radeon_cs_parser *p,
454 struct radeon_cs_packet *pkt, 490 struct radeon_cs_packet *pkt,
455 int *data0, int *data1, 491 int *data0, int *data1,
456 unsigned buf_sizes[]) 492 unsigned buf_sizes[],
493 bool *has_msg_cmd)
457{ 494{
458 int i, r; 495 int i, r;
459 496
@@ -467,7 +504,8 @@ static int radeon_uvd_cs_reg(struct radeon_cs_parser *p,
467 *data1 = p->idx; 504 *data1 = p->idx;
468 break; 505 break;
469 case UVD_GPCOM_VCPU_CMD: 506 case UVD_GPCOM_VCPU_CMD:
470 r = radeon_uvd_cs_reloc(p, *data0, *data1, buf_sizes); 507 r = radeon_uvd_cs_reloc(p, *data0, *data1,
508 buf_sizes, has_msg_cmd);
471 if (r) 509 if (r)
472 return r; 510 return r;
473 break; 511 break;
@@ -488,6 +526,9 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p)
488 struct radeon_cs_packet pkt; 526 struct radeon_cs_packet pkt;
489 int r, data0 = 0, data1 = 0; 527 int r, data0 = 0, data1 = 0;
490 528
529 /* does the IB has a msg command */
530 bool has_msg_cmd = false;
531
491 /* minimum buffer sizes */ 532 /* minimum buffer sizes */
492 unsigned buf_sizes[] = { 533 unsigned buf_sizes[] = {
493 [0x00000000] = 2048, 534 [0x00000000] = 2048,
@@ -514,8 +555,8 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p)
514 return r; 555 return r;
515 switch (pkt.type) { 556 switch (pkt.type) {
516 case RADEON_PACKET_TYPE0: 557 case RADEON_PACKET_TYPE0:
517 r = radeon_uvd_cs_reg(p, &pkt, &data0, 558 r = radeon_uvd_cs_reg(p, &pkt, &data0, &data1,
518 &data1, buf_sizes); 559 buf_sizes, &has_msg_cmd);
519 if (r) 560 if (r)
520 return r; 561 return r;
521 break; 562 break;
@@ -527,6 +568,12 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p)
527 return -EINVAL; 568 return -EINVAL;
528 } 569 }
529 } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); 570 } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw);
571
572 if (!has_msg_cmd) {
573 DRM_ERROR("UVD-IBs need a msg command!\n");
574 return -EINVAL;
575 }
576
530 return 0; 577 return 0;
531} 578}
532 579
diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c
index 363018c60412..bdd888b4db2b 100644
--- a/drivers/gpu/drm/radeon/rv6xx_dpm.c
+++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c
@@ -1944,9 +1944,7 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev)
1944 1944
1945int rv6xx_dpm_init(struct radeon_device *rdev) 1945int rv6xx_dpm_init(struct radeon_device *rdev)
1946{ 1946{
1947 int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); 1947 struct radeon_atom_ss ss;
1948 uint16_t data_offset, size;
1949 uint8_t frev, crev;
1950 struct atom_clock_dividers dividers; 1948 struct atom_clock_dividers dividers;
1951 struct rv6xx_power_info *pi; 1949 struct rv6xx_power_info *pi;
1952 int ret; 1950 int ret;
@@ -1989,16 +1987,18 @@ int rv6xx_dpm_init(struct radeon_device *rdev)
1989 1987
1990 pi->gfx_clock_gating = true; 1988 pi->gfx_clock_gating = true;
1991 1989
1992 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 1990 pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss,
1993 &frev, &crev, &data_offset)) { 1991 ASIC_INTERNAL_ENGINE_SS, 0);
1994 pi->sclk_ss = true; 1992 pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss,
1995 pi->mclk_ss = true; 1993 ASIC_INTERNAL_MEMORY_SS, 0);
1994
1995 /* Disable sclk ss, causes hangs on a lot of systems */
1996 pi->sclk_ss = false;
1997
1998 if (pi->sclk_ss || pi->mclk_ss)
1996 pi->dynamic_ss = true; 1999 pi->dynamic_ss = true;
1997 } else { 2000 else
1998 pi->sclk_ss = false;
1999 pi->mclk_ss = false;
2000 pi->dynamic_ss = false; 2001 pi->dynamic_ss = false;
2001 }
2002 2002
2003 pi->dynamic_pcie_gen2 = true; 2003 pi->dynamic_pcie_gen2 = true;
2004 2004
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 30ea14e8854c..bcc68ec204ad 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -813,7 +813,7 @@ int rv770_uvd_resume(struct radeon_device *rdev)
813 813
814 /* programm the VCPU memory controller bits 0-27 */ 814 /* programm the VCPU memory controller bits 0-27 */
815 addr = rdev->uvd.gpu_addr >> 3; 815 addr = rdev->uvd.gpu_addr >> 3;
816 size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; 816 size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3;
817 WREG32(UVD_VCPU_CACHE_OFFSET0, addr); 817 WREG32(UVD_VCPU_CACHE_OFFSET0, addr);
818 WREG32(UVD_VCPU_CACHE_SIZE0, size); 818 WREG32(UVD_VCPU_CACHE_SIZE0, size);
819 819
@@ -1829,6 +1829,8 @@ static int rv770_startup(struct radeon_device *rdev)
1829 /* enable pcie gen2 link */ 1829 /* enable pcie gen2 link */
1830 rv770_pcie_gen2_enable(rdev); 1830 rv770_pcie_gen2_enable(rdev);
1831 1831
1832 rv770_mc_program(rdev);
1833
1832 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { 1834 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
1833 r = r600_init_microcode(rdev); 1835 r = r600_init_microcode(rdev);
1834 if (r) { 1836 if (r) {
@@ -1841,7 +1843,6 @@ static int rv770_startup(struct radeon_device *rdev)
1841 if (r) 1843 if (r)
1842 return r; 1844 return r;
1843 1845
1844 rv770_mc_program(rdev);
1845 if (rdev->flags & RADEON_IS_AGP) { 1846 if (rdev->flags & RADEON_IS_AGP) {
1846 rv770_agp_enable(rdev); 1847 rv770_agp_enable(rdev);
1847 } else { 1848 } else {
@@ -1983,6 +1984,7 @@ int rv770_resume(struct radeon_device *rdev)
1983int rv770_suspend(struct radeon_device *rdev) 1984int rv770_suspend(struct radeon_device *rdev)
1984{ 1985{
1985 r600_audio_fini(rdev); 1986 r600_audio_fini(rdev);
1987 r600_uvd_stop(rdev);
1986 radeon_uvd_suspend(rdev); 1988 radeon_uvd_suspend(rdev);
1987 r700_cp_stop(rdev); 1989 r700_cp_stop(rdev);
1988 r600_dma_stop(rdev); 1990 r600_dma_stop(rdev);
@@ -2098,6 +2100,7 @@ void rv770_fini(struct radeon_device *rdev)
2098 radeon_ib_pool_fini(rdev); 2100 radeon_ib_pool_fini(rdev);
2099 radeon_irq_kms_fini(rdev); 2101 radeon_irq_kms_fini(rdev);
2100 rv770_pcie_gart_fini(rdev); 2102 rv770_pcie_gart_fini(rdev);
2103 r600_uvd_stop(rdev);
2101 radeon_uvd_fini(rdev); 2104 radeon_uvd_fini(rdev);
2102 r600_vram_scratch_fini(rdev); 2105 r600_vram_scratch_fini(rdev);
2103 radeon_gem_fini(rdev); 2106 radeon_gem_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c
index 2d347925f77d..094c67a29d0d 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -2319,12 +2319,25 @@ int rv7xx_parse_power_table(struct radeon_device *rdev)
2319 return 0; 2319 return 0;
2320} 2320}
2321 2321
2322void rv770_get_engine_memory_ss(struct radeon_device *rdev)
2323{
2324 struct rv7xx_power_info *pi = rv770_get_pi(rdev);
2325 struct radeon_atom_ss ss;
2326
2327 pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss,
2328 ASIC_INTERNAL_ENGINE_SS, 0);
2329 pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss,
2330 ASIC_INTERNAL_MEMORY_SS, 0);
2331
2332 if (pi->sclk_ss || pi->mclk_ss)
2333 pi->dynamic_ss = true;
2334 else
2335 pi->dynamic_ss = false;
2336}
2337
2322int rv770_dpm_init(struct radeon_device *rdev) 2338int rv770_dpm_init(struct radeon_device *rdev)
2323{ 2339{
2324 struct rv7xx_power_info *pi; 2340 struct rv7xx_power_info *pi;
2325 int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info);
2326 uint16_t data_offset, size;
2327 uint8_t frev, crev;
2328 struct atom_clock_dividers dividers; 2341 struct atom_clock_dividers dividers;
2329 int ret; 2342 int ret;
2330 2343
@@ -2369,16 +2382,7 @@ int rv770_dpm_init(struct radeon_device *rdev)
2369 pi->mvdd_control = 2382 pi->mvdd_control =
2370 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0); 2383 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0);
2371 2384
2372 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 2385 rv770_get_engine_memory_ss(rdev);
2373 &frev, &crev, &data_offset)) {
2374 pi->sclk_ss = true;
2375 pi->mclk_ss = true;
2376 pi->dynamic_ss = true;
2377 } else {
2378 pi->sclk_ss = false;
2379 pi->mclk_ss = false;
2380 pi->dynamic_ss = false;
2381 }
2382 2386
2383 pi->asi = RV770_ASI_DFLT; 2387 pi->asi = RV770_ASI_DFLT;
2384 pi->pasi = RV770_HASI_DFLT; 2388 pi->pasi = RV770_HASI_DFLT;
@@ -2393,8 +2397,7 @@ int rv770_dpm_init(struct radeon_device *rdev)
2393 2397
2394 pi->dynamic_pcie_gen2 = true; 2398 pi->dynamic_pcie_gen2 = true;
2395 2399
2396 if (pi->gfx_clock_gating && 2400 if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)
2397 (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE))
2398 pi->thermal_protection = true; 2401 pi->thermal_protection = true;
2399 else 2402 else
2400 pi->thermal_protection = false; 2403 pi->thermal_protection = false;
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.h b/drivers/gpu/drm/radeon/rv770_dpm.h
index 96b1b2a62a8a..9244effc6b59 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.h
+++ b/drivers/gpu/drm/radeon/rv770_dpm.h
@@ -275,6 +275,7 @@ void rv770_set_uvd_clock_before_set_eng_clock(struct radeon_device *rdev,
275void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev, 275void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev,
276 struct radeon_ps *new_ps, 276 struct radeon_ps *new_ps,
277 struct radeon_ps *old_ps); 277 struct radeon_ps *old_ps);
278void rv770_get_engine_memory_ss(struct radeon_device *rdev);
278 279
279/* smc */ 280/* smc */
280int rv770_read_smc_soft_register(struct radeon_device *rdev, 281int rv770_read_smc_soft_register(struct radeon_device *rdev,
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 6ca904673a4f..daa8d2df8ec5 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -1663,9 +1663,13 @@ static int si_init_microcode(struct radeon_device *rdev)
1663 1663
1664 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); 1664 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name);
1665 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); 1665 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
1666 if (err) 1666 if (err) {
1667 goto out; 1667 printk(KERN_ERR
1668 if (rdev->smc_fw->size != smc_req_size) { 1668 "smc: error loading firmware \"%s\"\n",
1669 fw_name);
1670 release_firmware(rdev->smc_fw);
1671 rdev->smc_fw = NULL;
1672 } else if (rdev->smc_fw->size != smc_req_size) {
1669 printk(KERN_ERR 1673 printk(KERN_ERR
1670 "si_smc: Bogus length %zu in firmware \"%s\"\n", 1674 "si_smc: Bogus length %zu in firmware \"%s\"\n",
1671 rdev->smc_fw->size, fw_name); 1675 rdev->smc_fw->size, fw_name);
@@ -6418,6 +6422,8 @@ static int si_startup(struct radeon_device *rdev)
6418 /* enable aspm */ 6422 /* enable aspm */
6419 si_program_aspm(rdev); 6423 si_program_aspm(rdev);
6420 6424
6425 si_mc_program(rdev);
6426
6421 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || 6427 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw ||
6422 !rdev->rlc_fw || !rdev->mc_fw) { 6428 !rdev->rlc_fw || !rdev->mc_fw) {
6423 r = si_init_microcode(rdev); 6429 r = si_init_microcode(rdev);
@@ -6437,7 +6443,6 @@ static int si_startup(struct radeon_device *rdev)
6437 if (r) 6443 if (r)
6438 return r; 6444 return r;
6439 6445
6440 si_mc_program(rdev);
6441 r = si_pcie_gart_enable(rdev); 6446 r = si_pcie_gart_enable(rdev);
6442 if (r) 6447 if (r)
6443 return r; 6448 return r;
@@ -6621,7 +6626,7 @@ int si_suspend(struct radeon_device *rdev)
6621 si_cp_enable(rdev, false); 6626 si_cp_enable(rdev, false);
6622 cayman_dma_stop(rdev); 6627 cayman_dma_stop(rdev);
6623 if (rdev->has_uvd) { 6628 if (rdev->has_uvd) {
6624 r600_uvd_rbc_stop(rdev); 6629 r600_uvd_stop(rdev);
6625 radeon_uvd_suspend(rdev); 6630 radeon_uvd_suspend(rdev);
6626 } 6631 }
6627 si_irq_suspend(rdev); 6632 si_irq_suspend(rdev);
@@ -6763,8 +6768,10 @@ void si_fini(struct radeon_device *rdev)
6763 radeon_vm_manager_fini(rdev); 6768 radeon_vm_manager_fini(rdev);
6764 radeon_ib_pool_fini(rdev); 6769 radeon_ib_pool_fini(rdev);
6765 radeon_irq_kms_fini(rdev); 6770 radeon_irq_kms_fini(rdev);
6766 if (rdev->has_uvd) 6771 if (rdev->has_uvd) {
6772 r600_uvd_stop(rdev);
6767 radeon_uvd_fini(rdev); 6773 radeon_uvd_fini(rdev);
6774 }
6768 si_pcie_gart_fini(rdev); 6775 si_pcie_gart_fini(rdev);
6769 r600_vram_scratch_fini(rdev); 6776 r600_vram_scratch_fini(rdev);
6770 radeon_gem_fini(rdev); 6777 radeon_gem_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 41825575b403..88699e3cd868 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2903,7 +2903,8 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
2903{ 2903{
2904 struct ni_ps *ps = ni_get_ps(rps); 2904 struct ni_ps *ps = ni_get_ps(rps);
2905 struct radeon_clock_and_voltage_limits *max_limits; 2905 struct radeon_clock_and_voltage_limits *max_limits;
2906 bool disable_mclk_switching; 2906 bool disable_mclk_switching = false;
2907 bool disable_sclk_switching = false;
2907 u32 mclk, sclk; 2908 u32 mclk, sclk;
2908 u16 vddc, vddci; 2909 u16 vddc, vddci;
2909 int i; 2910 int i;
@@ -2911,8 +2912,11 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
2911 if ((rdev->pm.dpm.new_active_crtc_count > 1) || 2912 if ((rdev->pm.dpm.new_active_crtc_count > 1) ||
2912 ni_dpm_vblank_too_short(rdev)) 2913 ni_dpm_vblank_too_short(rdev))
2913 disable_mclk_switching = true; 2914 disable_mclk_switching = true;
2914 else 2915
2915 disable_mclk_switching = false; 2916 if (rps->vclk || rps->dclk) {
2917 disable_mclk_switching = true;
2918 disable_sclk_switching = true;
2919 }
2916 2920
2917 if (rdev->pm.dpm.ac_power) 2921 if (rdev->pm.dpm.ac_power)
2918 max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; 2922 max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac;
@@ -2940,27 +2944,43 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
2940 2944
2941 if (disable_mclk_switching) { 2945 if (disable_mclk_switching) {
2942 mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; 2946 mclk = ps->performance_levels[ps->performance_level_count - 1].mclk;
2943 sclk = ps->performance_levels[0].sclk;
2944 vddc = ps->performance_levels[0].vddc;
2945 vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; 2947 vddci = ps->performance_levels[ps->performance_level_count - 1].vddci;
2946 } else { 2948 } else {
2947 sclk = ps->performance_levels[0].sclk;
2948 mclk = ps->performance_levels[0].mclk; 2949 mclk = ps->performance_levels[0].mclk;
2949 vddc = ps->performance_levels[0].vddc;
2950 vddci = ps->performance_levels[0].vddci; 2950 vddci = ps->performance_levels[0].vddci;
2951 } 2951 }
2952 2952
2953 if (disable_sclk_switching) {
2954 sclk = ps->performance_levels[ps->performance_level_count - 1].sclk;
2955 vddc = ps->performance_levels[ps->performance_level_count - 1].vddc;
2956 } else {
2957 sclk = ps->performance_levels[0].sclk;
2958 vddc = ps->performance_levels[0].vddc;
2959 }
2960
2953 /* adjusted low state */ 2961 /* adjusted low state */
2954 ps->performance_levels[0].sclk = sclk; 2962 ps->performance_levels[0].sclk = sclk;
2955 ps->performance_levels[0].mclk = mclk; 2963 ps->performance_levels[0].mclk = mclk;
2956 ps->performance_levels[0].vddc = vddc; 2964 ps->performance_levels[0].vddc = vddc;
2957 ps->performance_levels[0].vddci = vddci; 2965 ps->performance_levels[0].vddci = vddci;
2958 2966
2959 for (i = 1; i < ps->performance_level_count; i++) { 2967 if (disable_sclk_switching) {
2960 if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) 2968 sclk = ps->performance_levels[0].sclk;
2961 ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; 2969 for (i = 1; i < ps->performance_level_count; i++) {
2962 if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) 2970 if (sclk < ps->performance_levels[i].sclk)
2963 ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; 2971 sclk = ps->performance_levels[i].sclk;
2972 }
2973 for (i = 0; i < ps->performance_level_count; i++) {
2974 ps->performance_levels[i].sclk = sclk;
2975 ps->performance_levels[i].vddc = vddc;
2976 }
2977 } else {
2978 for (i = 1; i < ps->performance_level_count; i++) {
2979 if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk)
2980 ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk;
2981 if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc)
2982 ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc;
2983 }
2964 } 2984 }
2965 2985
2966 if (disable_mclk_switching) { 2986 if (disable_mclk_switching) {
@@ -6253,9 +6273,6 @@ int si_dpm_init(struct radeon_device *rdev)
6253 struct evergreen_power_info *eg_pi; 6273 struct evergreen_power_info *eg_pi;
6254 struct ni_power_info *ni_pi; 6274 struct ni_power_info *ni_pi;
6255 struct si_power_info *si_pi; 6275 struct si_power_info *si_pi;
6256 int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info);
6257 u16 data_offset, size;
6258 u8 frev, crev;
6259 struct atom_clock_dividers dividers; 6276 struct atom_clock_dividers dividers;
6260 int ret; 6277 int ret;
6261 u32 mask; 6278 u32 mask;
@@ -6346,16 +6363,7 @@ int si_dpm_init(struct radeon_device *rdev)
6346 si_pi->vddc_phase_shed_control = 6363 si_pi->vddc_phase_shed_control =
6347 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, VOLTAGE_OBJ_PHASE_LUT); 6364 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, VOLTAGE_OBJ_PHASE_LUT);
6348 6365
6349 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 6366 rv770_get_engine_memory_ss(rdev);
6350 &frev, &crev, &data_offset)) {
6351 pi->sclk_ss = true;
6352 pi->mclk_ss = true;
6353 pi->dynamic_ss = true;
6354 } else {
6355 pi->sclk_ss = false;
6356 pi->mclk_ss = false;
6357 pi->dynamic_ss = true;
6358 }
6359 6367
6360 pi->asi = RV770_ASI_DFLT; 6368 pi->asi = RV770_ASI_DFLT;
6361 pi->pasi = CYPRESS_HASI_DFLT; 6369 pi->pasi = CYPRESS_HASI_DFLT;
@@ -6366,8 +6374,7 @@ int si_dpm_init(struct radeon_device *rdev)
6366 eg_pi->sclk_deep_sleep = true; 6374 eg_pi->sclk_deep_sleep = true;
6367 si_pi->sclk_deep_sleep_above_low = false; 6375 si_pi->sclk_deep_sleep_above_low = false;
6368 6376
6369 if (pi->gfx_clock_gating && 6377 if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)
6370 (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE))
6371 pi->thermal_protection = true; 6378 pi->thermal_protection = true;
6372 else 6379 else
6373 pi->thermal_protection = false; 6380 pi->thermal_protection = false;
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 7a5764843bfb..cd33084c7860 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -488,8 +488,6 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
488 if (djrcv_dev->querying_devices) 488 if (djrcv_dev->querying_devices)
489 return 0; 489 return 0;
490 490
491 djrcv_dev->querying_devices = true;
492
493 dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); 491 dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL);
494 if (!dj_report) 492 if (!dj_report)
495 return -ENOMEM; 493 return -ENOMEM;
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index 0f34bca9f5e5..6099f50b28aa 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -215,7 +215,7 @@ static inline int adt7470_write_word_data(struct i2c_client *client, u8 reg,
215 u16 value) 215 u16 value)
216{ 216{
217 return i2c_smbus_write_byte_data(client, reg, value & 0xFF) 217 return i2c_smbus_write_byte_data(client, reg, value & 0xFF)
218 && i2c_smbus_write_byte_data(client, reg + 1, value >> 8); 218 || i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
219} 219}
220 220
221static void adt7470_init_client(struct i2c_client *client) 221static void adt7470_init_client(struct i2c_client *client)
diff --git a/drivers/i2c/busses/i2c-kempld.c b/drivers/i2c/busses/i2c-kempld.c
index ccec916bc3eb..af8f65fb1c05 100644
--- a/drivers/i2c/busses/i2c-kempld.c
+++ b/drivers/i2c/busses/i2c-kempld.c
@@ -246,9 +246,9 @@ static void kempld_i2c_device_init(struct kempld_i2c_data *i2c)
246 bus_frequency = KEMPLD_I2C_FREQ_MAX; 246 bus_frequency = KEMPLD_I2C_FREQ_MAX;
247 247
248 if (pld->info.spec_major == 1) 248 if (pld->info.spec_major == 1)
249 prescale = pld->pld_clock / bus_frequency * 5 - 1000; 249 prescale = pld->pld_clock / (bus_frequency * 5) - 1000;
250 else 250 else
251 prescale = pld->pld_clock / bus_frequency * 4 - 3000; 251 prescale = pld->pld_clock / (bus_frequency * 4) - 3000;
252 252
253 if (prescale < 0) 253 if (prescale < 0)
254 prescale = 0; 254 prescale = 0;
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index df8ff5aea5b5..e2e9a0dade96 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -493,7 +493,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg,
493 * based on this empirical measurement and a lot of previous frobbing. 493 * based on this empirical measurement and a lot of previous frobbing.
494 */ 494 */
495 i2c->cmd_err = 0; 495 i2c->cmd_err = 0;
496 if (msg->len < 8) { 496 if (0) { /* disable PIO mode until a proper fix is made */
497 ret = mxs_i2c_pio_setup_xfer(adap, msg, flags); 497 ret = mxs_i2c_pio_setup_xfer(adap, msg, flags);
498 if (ret) 498 if (ret)
499 mxs_i2c_reset(i2c); 499 mxs_i2c_reset(i2c);
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 0ad208a69c29..3ceac3e91dde 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -60,7 +60,6 @@ static void tiadc_step_config(struct tiadc_device *adc_dev)
60{ 60{
61 unsigned int stepconfig; 61 unsigned int stepconfig;
62 int i, steps; 62 int i, steps;
63 u32 step_en;
64 63
65 /* 64 /*
66 * There are 16 configurable steps and 8 analog input 65 * There are 16 configurable steps and 8 analog input
@@ -86,8 +85,7 @@ static void tiadc_step_config(struct tiadc_device *adc_dev)
86 adc_dev->channel_step[i] = steps; 85 adc_dev->channel_step[i] = steps;
87 steps++; 86 steps++;
88 } 87 }
89 step_en = get_adc_step_mask(adc_dev); 88
90 am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en);
91} 89}
92 90
93static const char * const chan_name_ain[] = { 91static const char * const chan_name_ain[] = {
@@ -142,10 +140,22 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
142 int *val, int *val2, long mask) 140 int *val, int *val2, long mask)
143{ 141{
144 struct tiadc_device *adc_dev = iio_priv(indio_dev); 142 struct tiadc_device *adc_dev = iio_priv(indio_dev);
145 int i; 143 int i, map_val;
146 unsigned int fifo1count, read; 144 unsigned int fifo1count, read, stepid;
147 u32 step = UINT_MAX; 145 u32 step = UINT_MAX;
148 bool found = false; 146 bool found = false;
147 u32 step_en;
148 unsigned long timeout = jiffies + usecs_to_jiffies
149 (IDLE_TIMEOUT * adc_dev->channels);
150 step_en = get_adc_step_mask(adc_dev);
151 am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en);
152
153 /* Wait for ADC sequencer to complete sampling */
154 while (tiadc_readl(adc_dev, REG_ADCFSM) & SEQ_STATUS) {
155 if (time_after(jiffies, timeout))
156 return -EAGAIN;
157 }
158 map_val = chan->channel + TOTAL_CHANNELS;
149 159
150 /* 160 /*
151 * When the sub-system is first enabled, 161 * When the sub-system is first enabled,
@@ -170,12 +180,16 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
170 fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); 180 fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
171 for (i = 0; i < fifo1count; i++) { 181 for (i = 0; i < fifo1count; i++) {
172 read = tiadc_readl(adc_dev, REG_FIFO1); 182 read = tiadc_readl(adc_dev, REG_FIFO1);
173 if (read >> 16 == step) { 183 stepid = read & FIFOREAD_CHNLID_MASK;
174 *val = read & 0xfff; 184 stepid = stepid >> 0x10;
185
186 if (stepid == map_val) {
187 read = read & FIFOREAD_DATA_MASK;
175 found = true; 188 found = true;
189 *val = read;
176 } 190 }
177 } 191 }
178 am335x_tsc_se_update(adc_dev->mfd_tscadc); 192
179 if (found == false) 193 if (found == false)
180 return -EBUSY; 194 return -EBUSY;
181 return IIO_VAL_INT; 195 return IIO_VAL_INT;
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index ea8a4146620d..0dd9bb873130 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -127,12 +127,17 @@ static struct iio_trigger *iio_trigger_find_by_name(const char *name,
127void iio_trigger_poll(struct iio_trigger *trig, s64 time) 127void iio_trigger_poll(struct iio_trigger *trig, s64 time)
128{ 128{
129 int i; 129 int i;
130 if (!trig->use_count) 130
131 for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) 131 if (!atomic_read(&trig->use_count)) {
132 if (trig->subirqs[i].enabled) { 132 atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
133 trig->use_count++; 133
134 for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) {
135 if (trig->subirqs[i].enabled)
134 generic_handle_irq(trig->subirq_base + i); 136 generic_handle_irq(trig->subirq_base + i);
135 } 137 else
138 iio_trigger_notify_done(trig);
139 }
140 }
136} 141}
137EXPORT_SYMBOL(iio_trigger_poll); 142EXPORT_SYMBOL(iio_trigger_poll);
138 143
@@ -146,19 +151,24 @@ EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll);
146void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time) 151void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time)
147{ 152{
148 int i; 153 int i;
149 if (!trig->use_count) 154
150 for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) 155 if (!atomic_read(&trig->use_count)) {
151 if (trig->subirqs[i].enabled) { 156 atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
152 trig->use_count++; 157
158 for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) {
159 if (trig->subirqs[i].enabled)
153 handle_nested_irq(trig->subirq_base + i); 160 handle_nested_irq(trig->subirq_base + i);
154 } 161 else
162 iio_trigger_notify_done(trig);
163 }
164 }
155} 165}
156EXPORT_SYMBOL(iio_trigger_poll_chained); 166EXPORT_SYMBOL(iio_trigger_poll_chained);
157 167
158void iio_trigger_notify_done(struct iio_trigger *trig) 168void iio_trigger_notify_done(struct iio_trigger *trig)
159{ 169{
160 trig->use_count--; 170 if (atomic_dec_and_test(&trig->use_count) && trig->ops &&
161 if (trig->use_count == 0 && trig->ops && trig->ops->try_reenable) 171 trig->ops->try_reenable)
162 if (trig->ops->try_reenable(trig)) 172 if (trig->ops->try_reenable(trig))
163 /* Missed an interrupt so launch new poll now */ 173 /* Missed an interrupt so launch new poll now */
164 iio_trigger_poll(trig, 0); 174 iio_trigger_poll(trig, 0);
diff --git a/drivers/media/i2c/ml86v7667.c b/drivers/media/i2c/ml86v7667.c
index efdc873e58d1..a9857022f71d 100644
--- a/drivers/media/i2c/ml86v7667.c
+++ b/drivers/media/i2c/ml86v7667.c
@@ -117,7 +117,7 @@ static int ml86v7667_s_ctrl(struct v4l2_ctrl *ctrl)
117{ 117{
118 struct v4l2_subdev *sd = to_sd(ctrl); 118 struct v4l2_subdev *sd = to_sd(ctrl);
119 struct i2c_client *client = v4l2_get_subdevdata(sd); 119 struct i2c_client *client = v4l2_get_subdevdata(sd);
120 int ret; 120 int ret = -EINVAL;
121 121
122 switch (ctrl->id) { 122 switch (ctrl->id) {
123 case V4L2_CID_BRIGHTNESS: 123 case V4L2_CID_BRIGHTNESS:
@@ -157,7 +157,7 @@ static int ml86v7667_s_ctrl(struct v4l2_ctrl *ctrl)
157 break; 157 break;
158 } 158 }
159 159
160 return 0; 160 return ret;
161} 161}
162 162
163static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) 163static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index df4ada880e42..bd9405df1bd6 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -1987,7 +1987,7 @@ MODULE_DEVICE_TABLE(platform, coda_platform_ids);
1987 1987
1988#ifdef CONFIG_OF 1988#ifdef CONFIG_OF
1989static const struct of_device_id coda_dt_ids[] = { 1989static const struct of_device_id coda_dt_ids[] = {
1990 { .compatible = "fsl,imx27-vpu", .data = &coda_platform_ids[CODA_IMX27] }, 1990 { .compatible = "fsl,imx27-vpu", .data = &coda_devdata[CODA_IMX27] },
1991 { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, 1991 { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] },
1992 { /* sentinel */ } 1992 { /* sentinel */ }
1993}; 1993};
diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c
index 553d87e5ceab..fd6289d60cde 100644
--- a/drivers/media/platform/s5p-g2d/g2d.c
+++ b/drivers/media/platform/s5p-g2d/g2d.c
@@ -784,6 +784,7 @@ static int g2d_probe(struct platform_device *pdev)
784 } 784 }
785 *vfd = g2d_videodev; 785 *vfd = g2d_videodev;
786 vfd->lock = &dev->mutex; 786 vfd->lock = &dev->mutex;
787 vfd->v4l2_dev = &dev->v4l2_dev;
787 ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); 788 ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0);
788 if (ret) { 789 if (ret) {
789 v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); 790 v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 5296385153d5..4f6dd42c9adb 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -344,7 +344,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
344 pix_mp->num_planes = 2; 344 pix_mp->num_planes = 2;
345 /* Set pixelformat to the format in which MFC 345 /* Set pixelformat to the format in which MFC
346 outputs the decoded frame */ 346 outputs the decoded frame */
347 pix_mp->pixelformat = V4L2_PIX_FMT_NV12MT; 347 pix_mp->pixelformat = ctx->dst_fmt->fourcc;
348 pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; 348 pix_mp->plane_fmt[0].bytesperline = ctx->buf_width;
349 pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; 349 pix_mp->plane_fmt[0].sizeimage = ctx->luma_size;
350 pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; 350 pix_mp->plane_fmt[1].bytesperline = ctx->buf_width;
@@ -382,10 +382,16 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
382 mfc_err("Unsupported format for source.\n"); 382 mfc_err("Unsupported format for source.\n");
383 return -EINVAL; 383 return -EINVAL;
384 } 384 }
385 if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { 385 if (fmt->codec_mode == S5P_FIMV_CODEC_NONE) {
386 mfc_err("Not supported format.\n"); 386 mfc_err("Unknown codec\n");
387 return -EINVAL; 387 return -EINVAL;
388 } 388 }
389 if (!IS_MFCV6(dev)) {
390 if (fmt->fourcc == V4L2_PIX_FMT_VP8) {
391 mfc_err("Not supported format.\n");
392 return -EINVAL;
393 }
394 }
389 } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 395 } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
390 fmt = find_format(f, MFC_FMT_RAW); 396 fmt = find_format(f, MFC_FMT_RAW);
391 if (!fmt) { 397 if (!fmt) {
@@ -411,7 +417,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
411 struct s5p_mfc_dev *dev = video_drvdata(file); 417 struct s5p_mfc_dev *dev = video_drvdata(file);
412 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); 418 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
413 int ret = 0; 419 int ret = 0;
414 struct s5p_mfc_fmt *fmt;
415 struct v4l2_pix_format_mplane *pix_mp; 420 struct v4l2_pix_format_mplane *pix_mp;
416 421
417 mfc_debug_enter(); 422 mfc_debug_enter();
@@ -425,54 +430,32 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
425 goto out; 430 goto out;
426 } 431 }
427 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 432 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
428 fmt = find_format(f, MFC_FMT_RAW); 433 /* dst_fmt is validated by call to vidioc_try_fmt */
429 if (!fmt) { 434 ctx->dst_fmt = find_format(f, MFC_FMT_RAW);
430 mfc_err("Unsupported format for source.\n"); 435 ret = 0;
431 return -EINVAL;
432 }
433 if (!IS_MFCV6(dev) && (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) {
434 mfc_err("Not supported format.\n");
435 return -EINVAL;
436 } else if (IS_MFCV6(dev) &&
437 (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) {
438 mfc_err("Not supported format.\n");
439 return -EINVAL;
440 }
441 ctx->dst_fmt = fmt;
442 mfc_debug_leave();
443 return ret;
444 } else if (f->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
445 mfc_err("Wrong type error for S_FMT : %d", f->type);
446 return -EINVAL;
447 }
448 fmt = find_format(f, MFC_FMT_DEC);
449 if (!fmt || fmt->codec_mode == S5P_MFC_CODEC_NONE) {
450 mfc_err("Unknown codec\n");
451 ret = -EINVAL;
452 goto out; 436 goto out;
453 } 437 } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
454 if (fmt->type != MFC_FMT_DEC) { 438 /* src_fmt is validated by call to vidioc_try_fmt */
455 mfc_err("Wrong format selected, you should choose " 439 ctx->src_fmt = find_format(f, MFC_FMT_DEC);
456 "format for decoding\n"); 440 ctx->codec_mode = ctx->src_fmt->codec_mode;
441 mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode);
442 pix_mp->height = 0;
443 pix_mp->width = 0;
444 if (pix_mp->plane_fmt[0].sizeimage)
445 ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage;
446 else
447 pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size =
448 DEF_CPB_SIZE;
449 pix_mp->plane_fmt[0].bytesperline = 0;
450 ctx->state = MFCINST_INIT;
451 ret = 0;
452 goto out;
453 } else {
454 mfc_err("Wrong type error for S_FMT : %d", f->type);
457 ret = -EINVAL; 455 ret = -EINVAL;
458 goto out; 456 goto out;
459 } 457 }
460 if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { 458
461 mfc_err("Not supported format.\n");
462 return -EINVAL;
463 }
464 ctx->src_fmt = fmt;
465 ctx->codec_mode = fmt->codec_mode;
466 mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode);
467 pix_mp->height = 0;
468 pix_mp->width = 0;
469 if (pix_mp->plane_fmt[0].sizeimage)
470 ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage;
471 else
472 pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size =
473 DEF_CPB_SIZE;
474 pix_mp->plane_fmt[0].bytesperline = 0;
475 ctx->state = MFCINST_INIT;
476out: 459out:
477 mfc_debug_leave(); 460 mfc_debug_leave();
478 return ret; 461 return ret;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 2549967b2f85..59e56f4c8ce3 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -906,6 +906,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
906 906
907static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) 907static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
908{ 908{
909 struct s5p_mfc_dev *dev = video_drvdata(file);
909 struct s5p_mfc_fmt *fmt; 910 struct s5p_mfc_fmt *fmt;
910 struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; 911 struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
911 912
@@ -930,6 +931,18 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
930 return -EINVAL; 931 return -EINVAL;
931 } 932 }
932 933
934 if (!IS_MFCV6(dev)) {
935 if (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16) {
936 mfc_err("Not supported format.\n");
937 return -EINVAL;
938 }
939 } else if (IS_MFCV6(dev)) {
940 if (fmt->fourcc == V4L2_PIX_FMT_NV12MT) {
941 mfc_err("Not supported format.\n");
942 return -EINVAL;
943 }
944 }
945
933 if (fmt->num_planes != pix_fmt_mp->num_planes) { 946 if (fmt->num_planes != pix_fmt_mp->num_planes) {
934 mfc_err("failed to try output format\n"); 947 mfc_err("failed to try output format\n");
935 return -EINVAL; 948 return -EINVAL;
@@ -947,7 +960,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
947{ 960{
948 struct s5p_mfc_dev *dev = video_drvdata(file); 961 struct s5p_mfc_dev *dev = video_drvdata(file);
949 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); 962 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
950 struct s5p_mfc_fmt *fmt;
951 struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; 963 struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
952 int ret = 0; 964 int ret = 0;
953 965
@@ -960,13 +972,9 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
960 goto out; 972 goto out;
961 } 973 }
962 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 974 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
963 fmt = find_format(f, MFC_FMT_ENC); 975 /* dst_fmt is validated by call to vidioc_try_fmt */
964 if (!fmt) { 976 ctx->dst_fmt = find_format(f, MFC_FMT_ENC);
965 mfc_err("failed to set capture format\n");
966 return -EINVAL;
967 }
968 ctx->state = MFCINST_INIT; 977 ctx->state = MFCINST_INIT;
969 ctx->dst_fmt = fmt;
970 ctx->codec_mode = ctx->dst_fmt->codec_mode; 978 ctx->codec_mode = ctx->dst_fmt->codec_mode;
971 ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; 979 ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage;
972 pix_fmt_mp->plane_fmt[0].bytesperline = 0; 980 pix_fmt_mp->plane_fmt[0].bytesperline = 0;
@@ -987,28 +995,8 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
987 } 995 }
988 mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); 996 mfc_debug(2, "Got instance number: %d\n", ctx->inst_no);
989 } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 997 } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
990 fmt = find_format(f, MFC_FMT_RAW); 998 /* src_fmt is validated by call to vidioc_try_fmt */
991 if (!fmt) { 999 ctx->src_fmt = find_format(f, MFC_FMT_RAW);
992 mfc_err("failed to set output format\n");
993 return -EINVAL;
994 }
995
996 if (!IS_MFCV6(dev) &&
997 (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16)) {
998 mfc_err("Not supported format.\n");
999 return -EINVAL;
1000 } else if (IS_MFCV6(dev) &&
1001 (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) {
1002 mfc_err("Not supported format.\n");
1003 return -EINVAL;
1004 }
1005
1006 if (fmt->num_planes != pix_fmt_mp->num_planes) {
1007 mfc_err("failed to set output format\n");
1008 ret = -EINVAL;
1009 goto out;
1010 }
1011 ctx->src_fmt = fmt;
1012 ctx->img_width = pix_fmt_mp->width; 1000 ctx->img_width = pix_fmt_mp->width;
1013 ctx->img_height = pix_fmt_mp->height; 1001 ctx->img_height = pix_fmt_mp->height;
1014 mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode); 1002 mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode);
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index 4851cc2e4a4d..c4ff9739a7ae 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -726,7 +726,7 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
726 726
727 *eedata = data; 727 *eedata = data;
728 *eedata_len = len; 728 *eedata_len = len;
729 dev_config = (void *)eedata; 729 dev_config = (void *)*eedata;
730 730
731 switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) { 731 switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) {
732 case 0: 732 case 0:
diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c
index cb694055ba7d..6e5070774dc2 100644
--- a/drivers/media/usb/hdpvr/hdpvr-core.c
+++ b/drivers/media/usb/hdpvr/hdpvr-core.c
@@ -303,6 +303,11 @@ static int hdpvr_probe(struct usb_interface *interface,
303 303
304 dev->workqueue = 0; 304 dev->workqueue = 0;
305 305
306 /* init video transfer queues first of all */
307 /* to prevent oops in hdpvr_delete() on error paths */
308 INIT_LIST_HEAD(&dev->free_buff_list);
309 INIT_LIST_HEAD(&dev->rec_buff_list);
310
306 /* register v4l2_device early so it can be used for printks */ 311 /* register v4l2_device early so it can be used for printks */
307 if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { 312 if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) {
308 dev_err(&interface->dev, "v4l2_device_register failed\n"); 313 dev_err(&interface->dev, "v4l2_device_register failed\n");
@@ -325,10 +330,6 @@ static int hdpvr_probe(struct usb_interface *interface,
325 if (!dev->workqueue) 330 if (!dev->workqueue)
326 goto error; 331 goto error;
327 332
328 /* init video transfer queues */
329 INIT_LIST_HEAD(&dev->free_buff_list);
330 INIT_LIST_HEAD(&dev->rec_buff_list);
331
332 dev->options = hdpvr_default_options; 333 dev->options = hdpvr_default_options;
333 334
334 if (default_video_input < HDPVR_VIDEO_INPUTS) 335 if (default_video_input < HDPVR_VIDEO_INPUTS)
@@ -405,7 +406,7 @@ static int hdpvr_probe(struct usb_interface *interface,
405 video_nr[atomic_inc_return(&dev_nr)]); 406 video_nr[atomic_inc_return(&dev_nr)]);
406 if (retval < 0) { 407 if (retval < 0) {
407 v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); 408 v4l2_err(&dev->v4l2_dev, "registering videodev failed\n");
408 goto error; 409 goto reg_fail;
409 } 410 }
410 411
411 /* let the user know what node this device is now attached to */ 412 /* let the user know what node this device is now attached to */
diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig
index 8864436464bf..7c5b86006ee6 100644
--- a/drivers/media/usb/usbtv/Kconfig
+++ b/drivers/media/usb/usbtv/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_USBTV 1config VIDEO_USBTV
2 tristate "USBTV007 video capture support" 2 tristate "USBTV007 video capture support"
3 depends on VIDEO_DEV 3 depends on VIDEO_V4L2
4 select VIDEOBUF2_VMALLOC 4 select VIDEOBUF2_VMALLOC
5 5
6 ---help--- 6 ---help---
diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c
index bf43f874685e..91650173941a 100644
--- a/drivers/media/usb/usbtv/usbtv.c
+++ b/drivers/media/usb/usbtv/usbtv.c
@@ -57,7 +57,7 @@
57#define USBTV_CHUNK_SIZE 256 57#define USBTV_CHUNK_SIZE 256
58#define USBTV_CHUNK 240 58#define USBTV_CHUNK 240
59#define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ 59#define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \
60 / 2 / USBTV_CHUNK) 60 / 4 / USBTV_CHUNK)
61 61
62/* Chunk header. */ 62/* Chunk header. */
63#define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ 63#define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \
@@ -89,6 +89,7 @@ struct usbtv {
89 /* Number of currently processed frame, useful find 89 /* Number of currently processed frame, useful find
90 * out when a new one begins. */ 90 * out when a new one begins. */
91 u32 frame_id; 91 u32 frame_id;
92 int chunks_done;
92 93
93 int iso_size; 94 int iso_size;
94 unsigned int sequence; 95 unsigned int sequence;
@@ -202,6 +203,26 @@ static int usbtv_setup_capture(struct usbtv *usbtv)
202 return 0; 203 return 0;
203} 204}
204 205
206/* Copy data from chunk into a frame buffer, deinterlacing the data
207 * into every second line. Unfortunately, they don't align nicely into
208 * 720 pixel lines, as the chunk is 240 words long, which is 480 pixels.
209 * Therefore, we break down the chunk into two halves before copyting,
210 * so that we can interleave a line if needed. */
211static void usbtv_chunk_to_vbuf(u32 *frame, u32 *src, int chunk_no, int odd)
212{
213 int half;
214
215 for (half = 0; half < 2; half++) {
216 int part_no = chunk_no * 2 + half;
217 int line = part_no / 3;
218 int part_index = (line * 2 + !odd) * 3 + (part_no % 3);
219
220 u32 *dst = &frame[part_index * USBTV_CHUNK/2];
221 memcpy(dst, src, USBTV_CHUNK/2 * sizeof(*src));
222 src += USBTV_CHUNK/2;
223 }
224}
225
205/* Called for each 256-byte image chunk. 226/* Called for each 256-byte image chunk.
206 * First word identifies the chunk, followed by 240 words of image 227 * First word identifies the chunk, followed by 240 words of image
207 * data and padding. */ 228 * data and padding. */
@@ -218,17 +239,17 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk)
218 frame_id = USBTV_FRAME_ID(chunk); 239 frame_id = USBTV_FRAME_ID(chunk);
219 odd = USBTV_ODD(chunk); 240 odd = USBTV_ODD(chunk);
220 chunk_no = USBTV_CHUNK_NO(chunk); 241 chunk_no = USBTV_CHUNK_NO(chunk);
221
222 /* Deinterlace. TODO: Use interlaced frame format. */
223 chunk_no = (chunk_no - chunk_no % 3) * 2 + chunk_no % 3;
224 chunk_no += !odd * 3;
225
226 if (chunk_no >= USBTV_CHUNKS) 242 if (chunk_no >= USBTV_CHUNKS)
227 return; 243 return;
228 244
229 /* Beginning of a frame. */ 245 /* Beginning of a frame. */
230 if (chunk_no == 0) 246 if (chunk_no == 0) {
231 usbtv->frame_id = frame_id; 247 usbtv->frame_id = frame_id;
248 usbtv->chunks_done = 0;
249 }
250
251 if (usbtv->frame_id != frame_id)
252 return;
232 253
233 spin_lock_irqsave(&usbtv->buflock, flags); 254 spin_lock_irqsave(&usbtv->buflock, flags);
234 if (list_empty(&usbtv->bufs)) { 255 if (list_empty(&usbtv->bufs)) {
@@ -241,19 +262,23 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk)
241 buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list); 262 buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list);
242 frame = vb2_plane_vaddr(&buf->vb, 0); 263 frame = vb2_plane_vaddr(&buf->vb, 0);
243 264
244 /* Copy the chunk. */ 265 /* Copy the chunk data. */
245 memcpy(&frame[chunk_no * USBTV_CHUNK], &chunk[1], 266 usbtv_chunk_to_vbuf(frame, &chunk[1], chunk_no, odd);
246 USBTV_CHUNK * sizeof(chunk[1])); 267 usbtv->chunks_done++;
247 268
248 /* Last chunk in a frame, signalling an end */ 269 /* Last chunk in a frame, signalling an end */
249 if (usbtv->frame_id && chunk_no == USBTV_CHUNKS-1) { 270 if (odd && chunk_no == USBTV_CHUNKS-1) {
250 int size = vb2_plane_size(&buf->vb, 0); 271 int size = vb2_plane_size(&buf->vb, 0);
272 enum vb2_buffer_state state = usbtv->chunks_done ==
273 USBTV_CHUNKS ?
274 VB2_BUF_STATE_DONE :
275 VB2_BUF_STATE_ERROR;
251 276
252 buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; 277 buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED;
253 buf->vb.v4l2_buf.sequence = usbtv->sequence++; 278 buf->vb.v4l2_buf.sequence = usbtv->sequence++;
254 v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); 279 v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
255 vb2_set_plane_payload(&buf->vb, 0, size); 280 vb2_set_plane_payload(&buf->vb, 0, size);
256 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); 281 vb2_buffer_done(&buf->vb, state);
257 list_del(&buf->list); 282 list_del(&buf->list);
258 } 283 }
259 284
@@ -518,7 +543,7 @@ static int usbtv_queue_setup(struct vb2_queue *vq,
518 if (*nbuffers < 2) 543 if (*nbuffers < 2)
519 *nbuffers = 2; 544 *nbuffers = 2;
520 *nplanes = 1; 545 *nplanes = 1;
521 sizes[0] = USBTV_CHUNK * USBTV_CHUNKS * sizeof(u32); 546 sizes[0] = USBTV_WIDTH * USBTV_HEIGHT / 2 * sizeof(u32);
522 547
523 return 0; 548 return 0;
524} 549}
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index dbdc5f7e2b29..01e264fb50e0 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -317,13 +317,20 @@ void acpi_pci_remove_bus(struct pci_bus *bus)
317/* ACPI bus type */ 317/* ACPI bus type */
318static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) 318static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
319{ 319{
320 struct pci_dev * pci_dev; 320 struct pci_dev *pci_dev = to_pci_dev(dev);
321 u64 addr; 321 bool is_bridge;
322 u64 addr;
322 323
323 pci_dev = to_pci_dev(dev); 324 /*
325 * pci_is_bridge() is not suitable here, because pci_dev->subordinate
326 * is set only after acpi_pci_find_device() has been called for the
327 * given device.
328 */
329 is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
330 || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
324 /* Please ref to ACPI spec for the syntax of _ADR */ 331 /* Please ref to ACPI spec for the syntax of _ADR */
325 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); 332 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
326 *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr); 333 *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge);
327 if (!*handle) 334 if (!*handle)
328 return -ENODEV; 335 return -ENODEV;
329 return 0; 336 return 0;
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 17150a778984..451bf99582ff 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -2392,6 +2392,12 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
2392 rc = cqr->intrc; 2392 rc = cqr->intrc;
2393 else 2393 else
2394 rc = -EIO; 2394 rc = -EIO;
2395
2396 /* kick tasklets */
2397 dasd_schedule_device_bh(device);
2398 if (device->block)
2399 dasd_schedule_block_bh(device->block);
2400
2395 return rc; 2401 return rc;
2396} 2402}
2397 2403
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index b6d1f92ed33c..c18c68150e9f 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -38,7 +38,7 @@
38 38
39#define DRV_NAME "fnic" 39#define DRV_NAME "fnic"
40#define DRV_DESCRIPTION "Cisco FCoE HBA Driver" 40#define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
41#define DRV_VERSION "1.5.0.22" 41#define DRV_VERSION "1.5.0.23"
42#define PFX DRV_NAME ": " 42#define PFX DRV_NAME ": "
43#define DFX DRV_NAME "%d: " 43#define DFX DRV_NAME "%d: "
44 44
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 5f09d1814d26..42e15ee6e1bb 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -642,19 +642,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
642 INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); 642 INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame);
643 INIT_WORK(&fnic->event_work, fnic_handle_event); 643 INIT_WORK(&fnic->event_work, fnic_handle_event);
644 skb_queue_head_init(&fnic->fip_frame_queue); 644 skb_queue_head_init(&fnic->fip_frame_queue);
645 spin_lock_irqsave(&fnic_list_lock, flags);
646 if (!fnic_fip_queue) {
647 fnic_fip_queue =
648 create_singlethread_workqueue("fnic_fip_q");
649 if (!fnic_fip_queue) {
650 spin_unlock_irqrestore(&fnic_list_lock, flags);
651 printk(KERN_ERR PFX "fnic FIP work queue "
652 "create failed\n");
653 err = -ENOMEM;
654 goto err_out_free_max_pool;
655 }
656 }
657 spin_unlock_irqrestore(&fnic_list_lock, flags);
658 INIT_LIST_HEAD(&fnic->evlist); 645 INIT_LIST_HEAD(&fnic->evlist);
659 INIT_LIST_HEAD(&fnic->vlans); 646 INIT_LIST_HEAD(&fnic->vlans);
660 } else { 647 } else {
@@ -960,6 +947,13 @@ static int __init fnic_init_module(void)
960 spin_lock_init(&fnic_list_lock); 947 spin_lock_init(&fnic_list_lock);
961 INIT_LIST_HEAD(&fnic_list); 948 INIT_LIST_HEAD(&fnic_list);
962 949
950 fnic_fip_queue = create_singlethread_workqueue("fnic_fip_q");
951 if (!fnic_fip_queue) {
952 printk(KERN_ERR PFX "fnic FIP work queue create failed\n");
953 err = -ENOMEM;
954 goto err_create_fip_workq;
955 }
956
963 fnic_fc_transport = fc_attach_transport(&fnic_fc_functions); 957 fnic_fc_transport = fc_attach_transport(&fnic_fc_functions);
964 if (!fnic_fc_transport) { 958 if (!fnic_fc_transport) {
965 printk(KERN_ERR PFX "fc_attach_transport error\n"); 959 printk(KERN_ERR PFX "fc_attach_transport error\n");
@@ -978,6 +972,8 @@ static int __init fnic_init_module(void)
978err_pci_register: 972err_pci_register:
979 fc_release_transport(fnic_fc_transport); 973 fc_release_transport(fnic_fc_transport);
980err_fc_transport: 974err_fc_transport:
975 destroy_workqueue(fnic_fip_queue);
976err_create_fip_workq:
981 destroy_workqueue(fnic_event_queue); 977 destroy_workqueue(fnic_event_queue);
982err_create_fnic_workq: 978err_create_fnic_workq:
983 kmem_cache_destroy(fnic_io_req_cache); 979 kmem_cache_destroy(fnic_io_req_cache);
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 0177295599e0..1f0ca68409d4 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3547,11 +3547,21 @@ static int megasas_init_fw(struct megasas_instance *instance)
3547 break; 3547 break;
3548 } 3548 }
3549 3549
3550 /* 3550 if (megasas_transition_to_ready(instance, 0)) {
3551 * We expect the FW state to be READY 3551 atomic_set(&instance->fw_reset_no_pci_access, 1);
3552 */ 3552 instance->instancet->adp_reset
3553 if (megasas_transition_to_ready(instance, 0)) 3553 (instance, instance->reg_set);
3554 goto fail_ready_state; 3554 atomic_set(&instance->fw_reset_no_pci_access, 0);
3555 dev_info(&instance->pdev->dev,
3556 "megasas: FW restarted successfully from %s!\n",
3557 __func__);
3558
3559 /*waitting for about 30 second before retry*/
3560 ssleep(30);
3561
3562 if (megasas_transition_to_ready(instance, 0))
3563 goto fail_ready_state;
3564 }
3555 3565
3556 /* 3566 /*
3557 * MSI-X host index 0 is common for all adapter. 3567 * MSI-X host index 0 is common for all adapter.
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 3b1ea34e1f5a..eaa808e6ba91 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1031,6 +1031,9 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf,
1031{ 1031{
1032 int i, result; 1032 int i, result;
1033 1033
1034 if (sdev->skip_vpd_pages)
1035 goto fail;
1036
1034 /* Ask for all the pages supported by this device */ 1037 /* Ask for all the pages supported by this device */
1035 result = scsi_vpd_inquiry(sdev, buf, 0, buf_len); 1038 result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
1036 if (result) 1039 if (result)
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 2168258fb2c3..74b88efde6ad 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -751,7 +751,7 @@ static void __virtscsi_set_affinity(struct virtio_scsi *vscsi, bool affinity)
751 751
752 vscsi->affinity_hint_set = true; 752 vscsi->affinity_hint_set = true;
753 } else { 753 } else {
754 for (i = 0; i < vscsi->num_queues - VIRTIO_SCSI_VQ_BASE; i++) 754 for (i = 0; i < vscsi->num_queues; i++)
755 virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1); 755 virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1);
756 756
757 vscsi->affinity_hint_set = false; 757 vscsi->affinity_hint_set = false;
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 222d3e37fc28..707966bd5610 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -609,7 +609,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
609 else 609 else
610 buf = (void *)t->tx_buf; 610 buf = (void *)t->tx_buf;
611 t->tx_dma = dma_map_single(&spi->dev, buf, 611 t->tx_dma = dma_map_single(&spi->dev, buf,
612 t->len, DMA_FROM_DEVICE); 612 t->len, DMA_TO_DEVICE);
613 if (!t->tx_dma) { 613 if (!t->tx_dma) {
614 ret = -EFAULT; 614 ret = -EFAULT;
615 goto err_tx_map; 615 goto err_tx_map;
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index dcceed29d31a..81972fa47beb 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -1811,10 +1811,12 @@ static int zcache_comp_init(void)
1811#else 1811#else
1812 if (*zcache_comp_name != '\0') { 1812 if (*zcache_comp_name != '\0') {
1813 ret = crypto_has_comp(zcache_comp_name, 0, 0); 1813 ret = crypto_has_comp(zcache_comp_name, 0, 0);
1814 if (!ret) 1814 if (!ret) {
1815 pr_info("zcache: %s not supported\n", 1815 pr_info("zcache: %s not supported\n",
1816 zcache_comp_name); 1816 zcache_comp_name);
1817 goto out; 1817 ret = 1;
1818 goto out;
1819 }
1818 } 1820 }
1819 if (!ret) 1821 if (!ret)
1820 strcpy(zcache_comp_name, "lzo"); 1822 strcpy(zcache_comp_name, "lzo");
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 4a8a1d68002c..558313de4911 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4798,7 +4798,8 @@ static void hub_events(void)
4798 hub->ports[i - 1]->child; 4798 hub->ports[i - 1]->child;
4799 4799
4800 dev_dbg(hub_dev, "warm reset port %d\n", i); 4800 dev_dbg(hub_dev, "warm reset port %d\n", i);
4801 if (!udev) { 4801 if (!udev || !(portstatus &
4802 USB_PORT_STAT_CONNECTION)) {
4802 status = hub_port_reset(hub, i, 4803 status = hub_port_reset(hub, i,
4803 NULL, HUB_BH_RESET_TIME, 4804 NULL, HUB_BH_RESET_TIME,
4804 true); 4805 true);
@@ -4808,8 +4809,8 @@ static void hub_events(void)
4808 usb_lock_device(udev); 4809 usb_lock_device(udev);
4809 status = usb_reset_device(udev); 4810 status = usb_reset_device(udev);
4810 usb_unlock_device(udev); 4811 usb_unlock_device(udev);
4812 connect_change = 0;
4811 } 4813 }
4812 connect_change = 0;
4813 } 4814 }
4814 4815
4815 if (connect_change) 4816 if (connect_change)
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index df6978abd7e6..6f8c2fd47675 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -24,6 +24,7 @@
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/dmapool.h> 26#include <linux/dmapool.h>
27#include <linux/dma-mapping.h>
27 28
28#include "xhci.h" 29#include "xhci.h"
29 30
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 41eb4fc33453..9478caa2f71f 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -27,6 +27,7 @@
27#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/dmi.h> 29#include <linux/dmi.h>
30#include <linux/dma-mapping.h>
30 31
31#include "xhci.h" 32#include "xhci.h"
32 33
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 3ba37713b1f9..dc09ebe4aba5 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -239,24 +239,6 @@ static const struct fb_bitfield def_rgb565[] = {
239 } 239 }
240}; 240};
241 241
242static const struct fb_bitfield def_rgb666[] = {
243 [RED] = {
244 .offset = 16,
245 .length = 6,
246 },
247 [GREEN] = {
248 .offset = 8,
249 .length = 6,
250 },
251 [BLUE] = {
252 .offset = 0,
253 .length = 6,
254 },
255 [TRANSP] = { /* no support for transparency */
256 .length = 0,
257 }
258};
259
260static const struct fb_bitfield def_rgb888[] = { 242static const struct fb_bitfield def_rgb888[] = {
261 [RED] = { 243 [RED] = {
262 .offset = 16, 244 .offset = 16,
@@ -309,9 +291,6 @@ static int mxsfb_check_var(struct fb_var_screeninfo *var,
309 break; 291 break;
310 case STMLCDIF_16BIT: 292 case STMLCDIF_16BIT:
311 case STMLCDIF_18BIT: 293 case STMLCDIF_18BIT:
312 /* 24 bit to 18 bit mapping */
313 rgb = def_rgb666;
314 break;
315 case STMLCDIF_24BIT: 294 case STMLCDIF_24BIT:
316 /* real 24 bit */ 295 /* real 24 bit */
317 rgb = def_rgb888; 296 rgb = def_rgb888;
@@ -453,11 +432,6 @@ static int mxsfb_set_par(struct fb_info *fb_info)
453 return -EINVAL; 432 return -EINVAL;
454 case STMLCDIF_16BIT: 433 case STMLCDIF_16BIT:
455 case STMLCDIF_18BIT: 434 case STMLCDIF_18BIT:
456 /* 24 bit to 18 bit mapping */
457 ctrl |= CTRL_DF24; /* ignore the upper 2 bits in
458 * each colour component
459 */
460 break;
461 case STMLCDIF_24BIT: 435 case STMLCDIF_24BIT:
462 /* real 24 bit */ 436 /* real 24 bit */
463 break; 437 break;
diff --git a/drivers/video/omap2/displays-new/connector-analog-tv.c b/drivers/video/omap2/displays-new/connector-analog-tv.c
index 5338f362293b..1b60698f141e 100644
--- a/drivers/video/omap2/displays-new/connector-analog-tv.c
+++ b/drivers/video/omap2/displays-new/connector-analog-tv.c
@@ -28,6 +28,20 @@ struct panel_drv_data {
28 bool invert_polarity; 28 bool invert_polarity;
29}; 29};
30 30
31static const struct omap_video_timings tvc_pal_timings = {
32 .x_res = 720,
33 .y_res = 574,
34 .pixel_clock = 13500,
35 .hsw = 64,
36 .hfp = 12,
37 .hbp = 68,
38 .vsw = 5,
39 .vfp = 5,
40 .vbp = 41,
41
42 .interlace = true,
43};
44
31#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) 45#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
32 46
33static int tvc_connect(struct omap_dss_device *dssdev) 47static int tvc_connect(struct omap_dss_device *dssdev)
@@ -212,14 +226,14 @@ static int tvc_probe(struct platform_device *pdev)
212 return -ENODEV; 226 return -ENODEV;
213 } 227 }
214 228
215 ddata->timings = omap_dss_pal_timings; 229 ddata->timings = tvc_pal_timings;
216 230
217 dssdev = &ddata->dssdev; 231 dssdev = &ddata->dssdev;
218 dssdev->driver = &tvc_driver; 232 dssdev->driver = &tvc_driver;
219 dssdev->dev = &pdev->dev; 233 dssdev->dev = &pdev->dev;
220 dssdev->type = OMAP_DISPLAY_TYPE_VENC; 234 dssdev->type = OMAP_DISPLAY_TYPE_VENC;
221 dssdev->owner = THIS_MODULE; 235 dssdev->owner = THIS_MODULE;
222 dssdev->panel.timings = omap_dss_pal_timings; 236 dssdev->panel.timings = tvc_pal_timings;
223 237
224 r = omapdss_register_display(dssdev); 238 r = omapdss_register_display(dssdev);
225 if (r) { 239 if (r) {
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index eaf133384a8f..8bc5e8ccb091 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -36,16 +36,23 @@ static int check_extent_in_eb(struct btrfs_key *key, struct extent_buffer *eb,
36 u64 extent_item_pos, 36 u64 extent_item_pos,
37 struct extent_inode_elem **eie) 37 struct extent_inode_elem **eie)
38{ 38{
39 u64 data_offset; 39 u64 offset = 0;
40 u64 data_len;
41 struct extent_inode_elem *e; 40 struct extent_inode_elem *e;
42 41
43 data_offset = btrfs_file_extent_offset(eb, fi); 42 if (!btrfs_file_extent_compression(eb, fi) &&
44 data_len = btrfs_file_extent_num_bytes(eb, fi); 43 !btrfs_file_extent_encryption(eb, fi) &&
44 !btrfs_file_extent_other_encoding(eb, fi)) {
45 u64 data_offset;
46 u64 data_len;
45 47
46 if (extent_item_pos < data_offset || 48 data_offset = btrfs_file_extent_offset(eb, fi);
47 extent_item_pos >= data_offset + data_len) 49 data_len = btrfs_file_extent_num_bytes(eb, fi);
48 return 1; 50
51 if (extent_item_pos < data_offset ||
52 extent_item_pos >= data_offset + data_len)
53 return 1;
54 offset = extent_item_pos - data_offset;
55 }
49 56
50 e = kmalloc(sizeof(*e), GFP_NOFS); 57 e = kmalloc(sizeof(*e), GFP_NOFS);
51 if (!e) 58 if (!e)
@@ -53,7 +60,7 @@ static int check_extent_in_eb(struct btrfs_key *key, struct extent_buffer *eb,
53 60
54 e->next = *eie; 61 e->next = *eie;
55 e->inum = key->objectid; 62 e->inum = key->objectid;
56 e->offset = key->offset + (extent_item_pos - data_offset); 63 e->offset = key->offset + offset;
57 *eie = e; 64 *eie = e;
58 65
59 return 0; 66 return 0;
@@ -189,7 +196,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
189 struct extent_buffer *eb; 196 struct extent_buffer *eb;
190 struct btrfs_key key; 197 struct btrfs_key key;
191 struct btrfs_file_extent_item *fi; 198 struct btrfs_file_extent_item *fi;
192 struct extent_inode_elem *eie = NULL; 199 struct extent_inode_elem *eie = NULL, *old = NULL;
193 u64 disk_byte; 200 u64 disk_byte;
194 201
195 if (level != 0) { 202 if (level != 0) {
@@ -223,6 +230,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
223 230
224 if (disk_byte == wanted_disk_byte) { 231 if (disk_byte == wanted_disk_byte) {
225 eie = NULL; 232 eie = NULL;
233 old = NULL;
226 if (extent_item_pos) { 234 if (extent_item_pos) {
227 ret = check_extent_in_eb(&key, eb, fi, 235 ret = check_extent_in_eb(&key, eb, fi,
228 *extent_item_pos, 236 *extent_item_pos,
@@ -230,18 +238,20 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
230 if (ret < 0) 238 if (ret < 0)
231 break; 239 break;
232 } 240 }
233 if (!ret) { 241 if (ret > 0)
234 ret = ulist_add(parents, eb->start, 242 goto next;
235 (uintptr_t)eie, GFP_NOFS); 243 ret = ulist_add_merge(parents, eb->start,
236 if (ret < 0) 244 (uintptr_t)eie,
237 break; 245 (u64 *)&old, GFP_NOFS);
238 if (!extent_item_pos) { 246 if (ret < 0)
239 ret = btrfs_next_old_leaf(root, path, 247 break;
240 time_seq); 248 if (!ret && extent_item_pos) {
241 continue; 249 while (old->next)
242 } 250 old = old->next;
251 old->next = eie;
243 } 252 }
244 } 253 }
254next:
245 ret = btrfs_next_old_item(root, path, time_seq); 255 ret = btrfs_next_old_item(root, path, time_seq);
246 } 256 }
247 257
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 5bf4c39e2ad6..ed504607d8ec 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1271,7 +1271,6 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
1271 BUG_ON(!eb_rewin); 1271 BUG_ON(!eb_rewin);
1272 } 1272 }
1273 1273
1274 extent_buffer_get(eb_rewin);
1275 btrfs_tree_read_unlock(eb); 1274 btrfs_tree_read_unlock(eb);
1276 free_extent_buffer(eb); 1275 free_extent_buffer(eb);
1277 1276
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 583d98bd065e..fe443fece851 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -4048,7 +4048,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
4048 } 4048 }
4049 4049
4050 while (!end) { 4050 while (!end) {
4051 u64 offset_in_extent; 4051 u64 offset_in_extent = 0;
4052 4052
4053 /* break if the extent we found is outside the range */ 4053 /* break if the extent we found is outside the range */
4054 if (em->start >= max || extent_map_end(em) < off) 4054 if (em->start >= max || extent_map_end(em) < off)
@@ -4064,9 +4064,12 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
4064 4064
4065 /* 4065 /*
4066 * record the offset from the start of the extent 4066 * record the offset from the start of the extent
4067 * for adjusting the disk offset below 4067 * for adjusting the disk offset below. Only do this if the
4068 * extent isn't compressed since our in ram offset may be past
4069 * what we have actually allocated on disk.
4068 */ 4070 */
4069 offset_in_extent = em_start - em->start; 4071 if (!test_bit(EXTENT_FLAG_COMPRESSED, &em->flags))
4072 offset_in_extent = em_start - em->start;
4070 em_end = extent_map_end(em); 4073 em_end = extent_map_end(em);
4071 em_len = em_end - em_start; 4074 em_len = em_end - em_start;
4072 emflags = em->flags; 4075 emflags = em->flags;
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index a005fe2c072a..8e686a427ce2 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -596,20 +596,29 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
596 if (no_splits) 596 if (no_splits)
597 goto next; 597 goto next;
598 598
599 if (em->block_start < EXTENT_MAP_LAST_BYTE && 599 if (em->start < start) {
600 em->start < start) {
601 split->start = em->start; 600 split->start = em->start;
602 split->len = start - em->start; 601 split->len = start - em->start;
603 split->orig_start = em->orig_start;
604 split->block_start = em->block_start;
605 602
606 if (compressed) 603 if (em->block_start < EXTENT_MAP_LAST_BYTE) {
607 split->block_len = em->block_len; 604 split->orig_start = em->orig_start;
608 else 605 split->block_start = em->block_start;
609 split->block_len = split->len; 606
610 split->ram_bytes = em->ram_bytes; 607 if (compressed)
611 split->orig_block_len = max(split->block_len, 608 split->block_len = em->block_len;
612 em->orig_block_len); 609 else
610 split->block_len = split->len;
611 split->orig_block_len = max(split->block_len,
612 em->orig_block_len);
613 split->ram_bytes = em->ram_bytes;
614 } else {
615 split->orig_start = split->start;
616 split->block_len = 0;
617 split->block_start = em->block_start;
618 split->orig_block_len = 0;
619 split->ram_bytes = split->len;
620 }
621
613 split->generation = gen; 622 split->generation = gen;
614 split->bdev = em->bdev; 623 split->bdev = em->bdev;
615 split->flags = flags; 624 split->flags = flags;
@@ -620,8 +629,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
620 split = split2; 629 split = split2;
621 split2 = NULL; 630 split2 = NULL;
622 } 631 }
623 if (em->block_start < EXTENT_MAP_LAST_BYTE && 632 if (testend && em->start + em->len > start + len) {
624 testend && em->start + em->len > start + len) {
625 u64 diff = start + len - em->start; 633 u64 diff = start + len - em->start;
626 634
627 split->start = start + len; 635 split->start = start + len;
@@ -630,18 +638,28 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
630 split->flags = flags; 638 split->flags = flags;
631 split->compress_type = em->compress_type; 639 split->compress_type = em->compress_type;
632 split->generation = gen; 640 split->generation = gen;
633 split->orig_block_len = max(em->block_len, 641
642 if (em->block_start < EXTENT_MAP_LAST_BYTE) {
643 split->orig_block_len = max(em->block_len,
634 em->orig_block_len); 644 em->orig_block_len);
635 split->ram_bytes = em->ram_bytes;
636 645
637 if (compressed) { 646 split->ram_bytes = em->ram_bytes;
638 split->block_len = em->block_len; 647 if (compressed) {
639 split->block_start = em->block_start; 648 split->block_len = em->block_len;
640 split->orig_start = em->orig_start; 649 split->block_start = em->block_start;
650 split->orig_start = em->orig_start;
651 } else {
652 split->block_len = split->len;
653 split->block_start = em->block_start
654 + diff;
655 split->orig_start = em->orig_start;
656 }
641 } else { 657 } else {
642 split->block_len = split->len; 658 split->ram_bytes = split->len;
643 split->block_start = em->block_start + diff; 659 split->orig_start = split->start;
644 split->orig_start = em->orig_start; 660 split->block_len = 0;
661 split->block_start = em->block_start;
662 split->orig_block_len = 0;
645 } 663 }
646 664
647 ret = add_extent_mapping(em_tree, split, modified); 665 ret = add_extent_mapping(em_tree, split, modified);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 6d1b93c8aafb..021694c08181 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2166,16 +2166,23 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id,
2166 if (btrfs_file_extent_disk_bytenr(leaf, extent) != old->bytenr) 2166 if (btrfs_file_extent_disk_bytenr(leaf, extent) != old->bytenr)
2167 continue; 2167 continue;
2168 2168
2169 extent_offset = btrfs_file_extent_offset(leaf, extent); 2169 /*
2170 if (key.offset - extent_offset != offset) 2170 * 'offset' refers to the exact key.offset,
2171 * NOT the 'offset' field in btrfs_extent_data_ref, ie.
2172 * (key.offset - extent_offset).
2173 */
2174 if (key.offset != offset)
2171 continue; 2175 continue;
2172 2176
2177 extent_offset = btrfs_file_extent_offset(leaf, extent);
2173 num_bytes = btrfs_file_extent_num_bytes(leaf, extent); 2178 num_bytes = btrfs_file_extent_num_bytes(leaf, extent);
2179
2174 if (extent_offset >= old->extent_offset + old->offset + 2180 if (extent_offset >= old->extent_offset + old->offset +
2175 old->len || extent_offset + num_bytes <= 2181 old->len || extent_offset + num_bytes <=
2176 old->extent_offset + old->offset) 2182 old->extent_offset + old->offset)
2177 continue; 2183 continue;
2178 2184
2185 ret = 0;
2179 break; 2186 break;
2180 } 2187 }
2181 2188
@@ -2187,7 +2194,7 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id,
2187 2194
2188 backref->root_id = root_id; 2195 backref->root_id = root_id;
2189 backref->inum = inum; 2196 backref->inum = inum;
2190 backref->file_pos = offset + extent_offset; 2197 backref->file_pos = offset;
2191 backref->num_bytes = num_bytes; 2198 backref->num_bytes = num_bytes;
2192 backref->extent_offset = extent_offset; 2199 backref->extent_offset = extent_offset;
2193 backref->generation = btrfs_file_extent_generation(leaf, extent); 2200 backref->generation = btrfs_file_extent_generation(leaf, extent);
@@ -2210,7 +2217,8 @@ static noinline bool record_extent_backrefs(struct btrfs_path *path,
2210 new->path = path; 2217 new->path = path;
2211 2218
2212 list_for_each_entry_safe(old, tmp, &new->head, list) { 2219 list_for_each_entry_safe(old, tmp, &new->head, list) {
2213 ret = iterate_inodes_from_logical(old->bytenr, fs_info, 2220 ret = iterate_inodes_from_logical(old->bytenr +
2221 old->extent_offset, fs_info,
2214 path, record_one_backref, 2222 path, record_one_backref,
2215 old); 2223 old);
2216 BUG_ON(ret < 0 && ret != -ENOENT); 2224 BUG_ON(ret < 0 && ret != -ENOENT);
@@ -4391,9 +4399,6 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
4391 int mask = attr->ia_valid; 4399 int mask = attr->ia_valid;
4392 int ret; 4400 int ret;
4393 4401
4394 if (newsize == oldsize)
4395 return 0;
4396
4397 /* 4402 /*
4398 * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a 4403 * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a
4399 * special case where we need to update the times despite not having 4404 * special case where we need to update the times despite not having
@@ -5165,14 +5170,31 @@ next:
5165 } 5170 }
5166 5171
5167 /* Reached end of directory/root. Bump pos past the last item. */ 5172 /* Reached end of directory/root. Bump pos past the last item. */
5168 if (key_type == BTRFS_DIR_INDEX_KEY) 5173 ctx->pos++;
5169 /* 5174
5170 * 32-bit glibc will use getdents64, but then strtol - 5175 /*
5171 * so the last number we can serve is this. 5176 * Stop new entries from being returned after we return the last
5172 */ 5177 * entry.
5173 ctx->pos = 0x7fffffff; 5178 *
5174 else 5179 * New directory entries are assigned a strictly increasing
5175 ctx->pos++; 5180 * offset. This means that new entries created during readdir
5181 * are *guaranteed* to be seen in the future by that readdir.
5182 * This has broken buggy programs which operate on names as
5183 * they're returned by readdir. Until we re-use freed offsets
5184 * we have this hack to stop new entries from being returned
5185 * under the assumption that they'll never reach this huge
5186 * offset.
5187 *
5188 * This is being careful not to overflow 32bit loff_t unless the
5189 * last entry requires it because doing so has broken 32bit apps
5190 * in the past.
5191 */
5192 if (key_type == BTRFS_DIR_INDEX_KEY) {
5193 if (ctx->pos >= INT_MAX)
5194 ctx->pos = LLONG_MAX;
5195 else
5196 ctx->pos = INT_MAX;
5197 }
5176nopos: 5198nopos:
5177 ret = 0; 5199 ret = 0;
5178err: 5200err:
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index d58cce77fc6c..af1931a5960d 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -983,12 +983,12 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans,
983 * a dirty root struct and adds it into the list of dead roots that need to 983 * a dirty root struct and adds it into the list of dead roots that need to
984 * be deleted 984 * be deleted
985 */ 985 */
986int btrfs_add_dead_root(struct btrfs_root *root) 986void btrfs_add_dead_root(struct btrfs_root *root)
987{ 987{
988 spin_lock(&root->fs_info->trans_lock); 988 spin_lock(&root->fs_info->trans_lock);
989 list_add_tail(&root->root_list, &root->fs_info->dead_roots); 989 if (list_empty(&root->root_list))
990 list_add_tail(&root->root_list, &root->fs_info->dead_roots);
990 spin_unlock(&root->fs_info->trans_lock); 991 spin_unlock(&root->fs_info->trans_lock);
991 return 0;
992} 992}
993 993
994/* 994/*
@@ -1925,7 +1925,7 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root)
1925 } 1925 }
1926 root = list_first_entry(&fs_info->dead_roots, 1926 root = list_first_entry(&fs_info->dead_roots,
1927 struct btrfs_root, root_list); 1927 struct btrfs_root, root_list);
1928 list_del(&root->root_list); 1928 list_del_init(&root->root_list);
1929 spin_unlock(&fs_info->trans_lock); 1929 spin_unlock(&fs_info->trans_lock);
1930 1930
1931 pr_debug("btrfs: cleaner removing %llu\n", 1931 pr_debug("btrfs: cleaner removing %llu\n",
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index 005b0375d18c..defbc4269897 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -143,7 +143,7 @@ int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid);
143int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, 143int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
144 struct btrfs_root *root); 144 struct btrfs_root *root);
145 145
146int btrfs_add_dead_root(struct btrfs_root *root); 146void btrfs_add_dead_root(struct btrfs_root *root);
147int btrfs_defrag_root(struct btrfs_root *root); 147int btrfs_defrag_root(struct btrfs_root *root);
148int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root); 148int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root);
149int btrfs_commit_transaction(struct btrfs_trans_handle *trans, 149int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 2c6791493637..ff60d8978ae2 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3746,8 +3746,9 @@ next_slot:
3746 } 3746 }
3747 3747
3748log_extents: 3748log_extents:
3749 btrfs_release_path(path);
3750 btrfs_release_path(dst_path);
3749 if (fast_search) { 3751 if (fast_search) {
3750 btrfs_release_path(dst_path);
3751 ret = btrfs_log_changed_extents(trans, root, inode, dst_path); 3752 ret = btrfs_log_changed_extents(trans, root, inode, dst_path);
3752 if (ret) { 3753 if (ret) {
3753 err = ret; 3754 err = ret;
@@ -3764,8 +3765,6 @@ log_extents:
3764 } 3765 }
3765 3766
3766 if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { 3767 if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
3767 btrfs_release_path(path);
3768 btrfs_release_path(dst_path);
3769 ret = log_directory_changes(trans, root, inode, path, dst_path); 3768 ret = log_directory_changes(trans, root, inode, path, dst_path);
3770 if (ret) { 3769 if (ret) {
3771 err = ret; 3770 err = ret;
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 4888cb3fdef7..c7c83ff0f752 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -533,8 +533,7 @@ EXPORT_SYMBOL_GPL(debugfs_remove);
533 */ 533 */
534void debugfs_remove_recursive(struct dentry *dentry) 534void debugfs_remove_recursive(struct dentry *dentry)
535{ 535{
536 struct dentry *child; 536 struct dentry *child, *next, *parent;
537 struct dentry *parent;
538 537
539 if (IS_ERR_OR_NULL(dentry)) 538 if (IS_ERR_OR_NULL(dentry))
540 return; 539 return;
@@ -544,61 +543,37 @@ void debugfs_remove_recursive(struct dentry *dentry)
544 return; 543 return;
545 544
546 parent = dentry; 545 parent = dentry;
546 down:
547 mutex_lock(&parent->d_inode->i_mutex); 547 mutex_lock(&parent->d_inode->i_mutex);
548 list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) {
549 if (!debugfs_positive(child))
550 continue;
548 551
549 while (1) { 552 /* perhaps simple_empty(child) makes more sense */
550 /*
551 * When all dentries under "parent" has been removed,
552 * walk up the tree until we reach our starting point.
553 */
554 if (list_empty(&parent->d_subdirs)) {
555 mutex_unlock(&parent->d_inode->i_mutex);
556 if (parent == dentry)
557 break;
558 parent = parent->d_parent;
559 mutex_lock(&parent->d_inode->i_mutex);
560 }
561 child = list_entry(parent->d_subdirs.next, struct dentry,
562 d_u.d_child);
563 next_sibling:
564
565 /*
566 * If "child" isn't empty, walk down the tree and
567 * remove all its descendants first.
568 */
569 if (!list_empty(&child->d_subdirs)) { 553 if (!list_empty(&child->d_subdirs)) {
570 mutex_unlock(&parent->d_inode->i_mutex); 554 mutex_unlock(&parent->d_inode->i_mutex);
571 parent = child; 555 parent = child;
572 mutex_lock(&parent->d_inode->i_mutex); 556 goto down;
573 continue;
574 } 557 }
575 __debugfs_remove(child, parent); 558 up:
576 if (parent->d_subdirs.next == &child->d_u.d_child) { 559 if (!__debugfs_remove(child, parent))
577 /* 560 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
578 * Try the next sibling.
579 */
580 if (child->d_u.d_child.next != &parent->d_subdirs) {
581 child = list_entry(child->d_u.d_child.next,
582 struct dentry,
583 d_u.d_child);
584 goto next_sibling;
585 }
586
587 /*
588 * Avoid infinite loop if we fail to remove
589 * one dentry.
590 */
591 mutex_unlock(&parent->d_inode->i_mutex);
592 break;
593 }
594 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
595 } 561 }
596 562
597 parent = dentry->d_parent; 563 mutex_unlock(&parent->d_inode->i_mutex);
564 child = parent;
565 parent = parent->d_parent;
598 mutex_lock(&parent->d_inode->i_mutex); 566 mutex_lock(&parent->d_inode->i_mutex);
599 __debugfs_remove(dentry, parent); 567
568 if (child != dentry) {
569 next = list_entry(child->d_u.d_child.next, struct dentry,
570 d_u.d_child);
571 goto up;
572 }
573
574 if (!__debugfs_remove(child, parent))
575 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
600 mutex_unlock(&parent->d_inode->i_mutex); 576 mutex_unlock(&parent->d_inode->i_mutex);
601 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
602} 577}
603EXPORT_SYMBOL_GPL(debugfs_remove_recursive); 578EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
604 579
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index 911649a47dd5..812149119fa3 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -686,7 +686,6 @@ static int device_close(struct inode *inode, struct file *file)
686 device_remove_lockspace() */ 686 device_remove_lockspace() */
687 687
688 sigprocmask(SIG_SETMASK, &tmpsig, NULL); 688 sigprocmask(SIG_SETMASK, &tmpsig, NULL);
689 recalc_sigpending();
690 689
691 return 0; 690 return 0;
692} 691}
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index a61873808f76..72ba4705d4fa 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4412,7 +4412,7 @@ void ext4_ext_truncate(handle_t *handle, struct inode *inode)
4412retry: 4412retry:
4413 err = ext4_es_remove_extent(inode, last_block, 4413 err = ext4_es_remove_extent(inode, last_block,
4414 EXT_MAX_BLOCKS - last_block); 4414 EXT_MAX_BLOCKS - last_block);
4415 if (err == ENOMEM) { 4415 if (err == -ENOMEM) {
4416 cond_resched(); 4416 cond_resched();
4417 congestion_wait(BLK_RW_ASYNC, HZ/50); 4417 congestion_wait(BLK_RW_ASYNC, HZ/50);
4418 goto retry; 4418 goto retry;
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index f03598c6ffd3..8bf5999875ee 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -734,11 +734,8 @@ repeat_in_this_group:
734 ino = ext4_find_next_zero_bit((unsigned long *) 734 ino = ext4_find_next_zero_bit((unsigned long *)
735 inode_bitmap_bh->b_data, 735 inode_bitmap_bh->b_data,
736 EXT4_INODES_PER_GROUP(sb), ino); 736 EXT4_INODES_PER_GROUP(sb), ino);
737 if (ino >= EXT4_INODES_PER_GROUP(sb)) { 737 if (ino >= EXT4_INODES_PER_GROUP(sb))
738 if (++group == ngroups) 738 goto next_group;
739 group = 0;
740 continue;
741 }
742 if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) { 739 if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) {
743 ext4_error(sb, "reserved inode found cleared - " 740 ext4_error(sb, "reserved inode found cleared - "
744 "inode=%lu", ino + 1); 741 "inode=%lu", ino + 1);
@@ -769,6 +766,9 @@ repeat_in_this_group:
769 goto got; /* we grabbed the inode! */ 766 goto got; /* we grabbed the inode! */
770 if (ino < EXT4_INODES_PER_GROUP(sb)) 767 if (ino < EXT4_INODES_PER_GROUP(sb))
771 goto repeat_in_this_group; 768 goto repeat_in_this_group;
769next_group:
770 if (++group == ngroups)
771 group = 0;
772 } 772 }
773 err = -ENOSPC; 773 err = -ENOSPC;
774 goto out; 774 goto out;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index ba33c67d6e48..dd32a2eacd0d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -555,14 +555,13 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
555 int ret; 555 int ret;
556 unsigned long long status; 556 unsigned long long status;
557 557
558#ifdef ES_AGGRESSIVE_TEST 558 if (unlikely(retval != map->m_len)) {
559 if (retval != map->m_len) { 559 ext4_warning(inode->i_sb,
560 printk("ES len assertion failed for inode: %lu " 560 "ES len assertion failed for inode "
561 "retval %d != map->m_len %d " 561 "%lu: retval %d != map->m_len %d",
562 "in %s (lookup)\n", inode->i_ino, retval, 562 inode->i_ino, retval, map->m_len);
563 map->m_len, __func__); 563 WARN_ON(1);
564 } 564 }
565#endif
566 565
567 status = map->m_flags & EXT4_MAP_UNWRITTEN ? 566 status = map->m_flags & EXT4_MAP_UNWRITTEN ?
568 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; 567 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
@@ -656,14 +655,13 @@ found:
656 int ret; 655 int ret;
657 unsigned long long status; 656 unsigned long long status;
658 657
659#ifdef ES_AGGRESSIVE_TEST 658 if (unlikely(retval != map->m_len)) {
660 if (retval != map->m_len) { 659 ext4_warning(inode->i_sb,
661 printk("ES len assertion failed for inode: %lu " 660 "ES len assertion failed for inode "
662 "retval %d != map->m_len %d " 661 "%lu: retval %d != map->m_len %d",
663 "in %s (allocation)\n", inode->i_ino, retval, 662 inode->i_ino, retval, map->m_len);
664 map->m_len, __func__); 663 WARN_ON(1);
665 } 664 }
666#endif
667 665
668 /* 666 /*
669 * If the extent has been zeroed out, we don't need to update 667 * If the extent has been zeroed out, we don't need to update
@@ -1637,14 +1635,13 @@ add_delayed:
1637 int ret; 1635 int ret;
1638 unsigned long long status; 1636 unsigned long long status;
1639 1637
1640#ifdef ES_AGGRESSIVE_TEST 1638 if (unlikely(retval != map->m_len)) {
1641 if (retval != map->m_len) { 1639 ext4_warning(inode->i_sb,
1642 printk("ES len assertion failed for inode: %lu " 1640 "ES len assertion failed for inode "
1643 "retval %d != map->m_len %d " 1641 "%lu: retval %d != map->m_len %d",
1644 "in %s (lookup)\n", inode->i_ino, retval, 1642 inode->i_ino, retval, map->m_len);
1645 map->m_len, __func__); 1643 WARN_ON(1);
1646 } 1644 }
1647#endif
1648 1645
1649 status = map->m_flags & EXT4_MAP_UNWRITTEN ? 1646 status = map->m_flags & EXT4_MAP_UNWRITTEN ?
1650 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; 1647 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index bca26f34edf4..36b141e420b7 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5481,6 +5481,7 @@ static void __exit ext4_exit_fs(void)
5481 kset_unregister(ext4_kset); 5481 kset_unregister(ext4_kset);
5482 ext4_exit_system_zone(); 5482 ext4_exit_system_zone();
5483 ext4_exit_pageio(); 5483 ext4_exit_pageio();
5484 ext4_exit_es();
5484} 5485}
5485 5486
5486MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); 5487MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 6599222536eb..65343c3741ff 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -730,14 +730,14 @@ static int __init fcntl_init(void)
730 * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY 730 * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY
731 * is defined as O_NONBLOCK on some platforms and not on others. 731 * is defined as O_NONBLOCK on some platforms and not on others.
732 */ 732 */
733 BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( 733 BUILD_BUG_ON(20 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32(
734 O_RDONLY | O_WRONLY | O_RDWR | 734 O_RDONLY | O_WRONLY | O_RDWR |
735 O_CREAT | O_EXCL | O_NOCTTY | 735 O_CREAT | O_EXCL | O_NOCTTY |
736 O_TRUNC | O_APPEND | /* O_NONBLOCK | */ 736 O_TRUNC | O_APPEND | /* O_NONBLOCK | */
737 __O_SYNC | O_DSYNC | FASYNC | 737 __O_SYNC | O_DSYNC | FASYNC |
738 O_DIRECT | O_LARGEFILE | O_DIRECTORY | 738 O_DIRECT | O_LARGEFILE | O_DIRECTORY |
739 O_NOFOLLOW | O_NOATIME | O_CLOEXEC | 739 O_NOFOLLOW | O_NOATIME | O_CLOEXEC |
740 __FMODE_EXEC | O_PATH 740 __FMODE_EXEC | O_PATH | __O_TMPFILE
741 )); 741 ));
742 742
743 fasync_cache = kmem_cache_create("fasync_cache", 743 fasync_cache = kmem_cache_create("fasync_cache",
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index 01bfe7662751..41e491b8e5d7 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -64,12 +64,17 @@ struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init)
64 nlm_init->protocol, nlm_version, 64 nlm_init->protocol, nlm_version,
65 nlm_init->hostname, nlm_init->noresvport, 65 nlm_init->hostname, nlm_init->noresvport,
66 nlm_init->net); 66 nlm_init->net);
67 if (host == NULL) { 67 if (host == NULL)
68 lockd_down(nlm_init->net); 68 goto out_nohost;
69 return ERR_PTR(-ENOLCK); 69 if (host->h_rpcclnt == NULL && nlm_bind_host(host) == NULL)
70 } 70 goto out_nobind;
71 71
72 return host; 72 return host;
73out_nobind:
74 nlmclnt_release_host(host);
75out_nohost:
76 lockd_down(nlm_init->net);
77 return ERR_PTR(-ENOLCK);
73} 78}
74EXPORT_SYMBOL_GPL(nlmclnt_init); 79EXPORT_SYMBOL_GPL(nlmclnt_init);
75 80
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index 9760ecb9b60f..acd394716349 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -125,14 +125,15 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
125{ 125{
126 struct nlm_args *argp = &req->a_args; 126 struct nlm_args *argp = &req->a_args;
127 struct nlm_lock *lock = &argp->lock; 127 struct nlm_lock *lock = &argp->lock;
128 char *nodename = req->a_host->h_rpcclnt->cl_nodename;
128 129
129 nlmclnt_next_cookie(&argp->cookie); 130 nlmclnt_next_cookie(&argp->cookie);
130 memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh)); 131 memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh));
131 lock->caller = utsname()->nodename; 132 lock->caller = nodename;
132 lock->oh.data = req->a_owner; 133 lock->oh.data = req->a_owner;
133 lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", 134 lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s",
134 (unsigned int)fl->fl_u.nfs_fl.owner->pid, 135 (unsigned int)fl->fl_u.nfs_fl.owner->pid,
135 utsname()->nodename); 136 nodename);
136 lock->svid = fl->fl_u.nfs_fl.owner->pid; 137 lock->svid = fl->fl_u.nfs_fl.owner->pid;
137 lock->fl.fl_start = fl->fl_start; 138 lock->fl.fl_start = fl->fl_start;
138 lock->fl.fl_end = fl->fl_end; 139 lock->fl.fl_end = fl->fl_end;
diff --git a/fs/namei.c b/fs/namei.c
index 8b61d103a8a7..89a612e392eb 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3671,15 +3671,11 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
3671 if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) 3671 if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0)
3672 return -EINVAL; 3672 return -EINVAL;
3673 /* 3673 /*
3674 * To use null names we require CAP_DAC_READ_SEARCH 3674 * Using empty names is equivalent to using AT_SYMLINK_FOLLOW
3675 * This ensures that not everyone will be able to create 3675 * on /proc/self/fd/<fd>.
3676 * handlink using the passed filedescriptor.
3677 */ 3676 */
3678 if (flags & AT_EMPTY_PATH) { 3677 if (flags & AT_EMPTY_PATH)
3679 if (!capable(CAP_DAC_READ_SEARCH))
3680 return -ENOENT;
3681 how = LOOKUP_EMPTY; 3678 how = LOOKUP_EMPTY;
3682 }
3683 3679
3684 if (flags & AT_SYMLINK_FOLLOW) 3680 if (flags & AT_SYMLINK_FOLLOW)
3685 how |= LOOKUP_FOLLOW; 3681 how |= LOOKUP_FOLLOW;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index af6e806044d7..941246f2b43d 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -463,7 +463,6 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st
463 unlock_new_inode(inode); 463 unlock_new_inode(inode);
464 } else 464 } else
465 nfs_refresh_inode(inode, fattr); 465 nfs_refresh_inode(inode, fattr);
466 nfs_setsecurity(inode, fattr, label);
467 dprintk("NFS: nfs_fhget(%s/%Ld fh_crc=0x%08x ct=%d)\n", 466 dprintk("NFS: nfs_fhget(%s/%Ld fh_crc=0x%08x ct=%d)\n",
468 inode->i_sb->s_id, 467 inode->i_sb->s_id,
469 (long long)NFS_FILEID(inode), 468 (long long)NFS_FILEID(inode),
@@ -963,9 +962,15 @@ EXPORT_SYMBOL_GPL(nfs_revalidate_inode);
963static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping) 962static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping)
964{ 963{
965 struct nfs_inode *nfsi = NFS_I(inode); 964 struct nfs_inode *nfsi = NFS_I(inode);
966 965 int ret;
966
967 if (mapping->nrpages != 0) { 967 if (mapping->nrpages != 0) {
968 int ret = invalidate_inode_pages2(mapping); 968 if (S_ISREG(inode->i_mode)) {
969 ret = nfs_sync_mapping(mapping);
970 if (ret < 0)
971 return ret;
972 }
973 ret = invalidate_inode_pages2(mapping);
969 if (ret < 0) 974 if (ret < 0)
970 return ret; 975 return ret;
971 } 976 }
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index cf11799297c4..108a774095f7 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3071,15 +3071,13 @@ struct rpc_clnt *
3071nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name, 3071nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name,
3072 struct nfs_fh *fhandle, struct nfs_fattr *fattr) 3072 struct nfs_fh *fhandle, struct nfs_fattr *fattr)
3073{ 3073{
3074 struct rpc_clnt *client = NFS_CLIENT(dir);
3074 int status; 3075 int status;
3075 struct rpc_clnt *client = rpc_clone_client(NFS_CLIENT(dir));
3076 3076
3077 status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL); 3077 status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL);
3078 if (status < 0) { 3078 if (status < 0)
3079 rpc_shutdown_client(client);
3080 return ERR_PTR(status); 3079 return ERR_PTR(status);
3081 } 3080 return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client;
3082 return client;
3083} 3081}
3084 3082
3085static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) 3083static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 71fdc0dfa0d2..f6db66d8f647 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2478,6 +2478,10 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server,
2478 if (server->flags & NFS_MOUNT_NOAC) 2478 if (server->flags & NFS_MOUNT_NOAC)
2479 sb_mntdata.mntflags |= MS_SYNCHRONOUS; 2479 sb_mntdata.mntflags |= MS_SYNCHRONOUS;
2480 2480
2481 if (mount_info->cloned != NULL && mount_info->cloned->sb != NULL)
2482 if (mount_info->cloned->sb->s_flags & MS_SYNCHRONOUS)
2483 sb_mntdata.mntflags |= MS_SYNCHRONOUS;
2484
2481 /* Get a superblock - note that we may end up sharing one that already exists */ 2485 /* Get a superblock - note that we may end up sharing one that already exists */
2482 s = sget(nfs_mod->nfs_fs, compare_super, nfs_set_super, flags, &sb_mntdata); 2486 s = sget(nfs_mod->nfs_fs, compare_super, nfs_set_super, flags, &sb_mntdata);
2483 if (IS_ERR(s)) { 2487 if (IS_ERR(s)) {
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 0d4c410e4589..419572f33b72 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1524,7 +1524,7 @@ static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
1524static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) 1524static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
1525{ 1525{
1526 return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\ 1526 return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\
1527 1 + 1 + 0 + /* eir_flags, spr_how, SP4_NONE (for now) */\ 1527 1 + 1 + 2 + /* eir_flags, spr_how, spo_must_enforce & _allow */\
1528 2 + /*eir_server_owner.so_minor_id */\ 1528 2 + /*eir_server_owner.so_minor_id */\
1529 /* eir_server_owner.so_major_id<> */\ 1529 /* eir_server_owner.so_major_id<> */\
1530 XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\ 1530 XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 280acef6f0dc..43f42290e5df 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1264,6 +1264,8 @@ static bool svc_rqst_integrity_protected(struct svc_rqst *rqstp)
1264 struct svc_cred *cr = &rqstp->rq_cred; 1264 struct svc_cred *cr = &rqstp->rq_cred;
1265 u32 service; 1265 u32 service;
1266 1266
1267 if (!cr->cr_gss_mech)
1268 return false;
1267 service = gss_pseudoflavor_to_service(cr->cr_gss_mech, cr->cr_flavor); 1269 service = gss_pseudoflavor_to_service(cr->cr_gss_mech, cr->cr_flavor);
1268 return service == RPC_GSS_SVC_INTEGRITY || 1270 return service == RPC_GSS_SVC_INTEGRITY ||
1269 service == RPC_GSS_SVC_PRIVACY; 1271 service == RPC_GSS_SVC_PRIVACY;
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 0c0f3ea90de5..c2a4701d7286 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3360,7 +3360,8 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr,
3360 8 /* eir_clientid */ + 3360 8 /* eir_clientid */ +
3361 4 /* eir_sequenceid */ + 3361 4 /* eir_sequenceid */ +
3362 4 /* eir_flags */ + 3362 4 /* eir_flags */ +
3363 4 /* spr_how (SP4_NONE) */ + 3363 4 /* spr_how */ +
3364 8 /* spo_must_enforce, spo_must_allow */ +
3364 8 /* so_minor_id */ + 3365 8 /* so_minor_id */ +
3365 4 /* so_major_id.len */ + 3366 4 /* so_major_id.len */ +
3366 (XDR_QUADLEN(major_id_sz) * 4) + 3367 (XDR_QUADLEN(major_id_sz) * 4) +
@@ -3372,8 +3373,6 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr,
3372 WRITE32(exid->seqid); 3373 WRITE32(exid->seqid);
3373 WRITE32(exid->flags); 3374 WRITE32(exid->flags);
3374 3375
3375 /* state_protect4_r. Currently only support SP4_NONE */
3376 BUG_ON(exid->spa_how != SP4_NONE);
3377 WRITE32(exid->spa_how); 3376 WRITE32(exid->spa_how);
3378 switch (exid->spa_how) { 3377 switch (exid->spa_how) {
3379 case SP4_NONE: 3378 case SP4_NONE:
diff --git a/fs/open.c b/fs/open.c
index d53e29895082..7931f76acc2b 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -823,7 +823,7 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
823 int lookup_flags = 0; 823 int lookup_flags = 0;
824 int acc_mode; 824 int acc_mode;
825 825
826 if (flags & O_CREAT) 826 if (flags & (O_CREAT | __O_TMPFILE))
827 op->mode = (mode & S_IALLUGO) | S_IFREG; 827 op->mode = (mode & S_IALLUGO) | S_IFREG;
828 else 828 else
829 op->mode = 0; 829 op->mode = 0;
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
index 33532f79b4f7..a958444a75fc 100644
--- a/fs/reiserfs/procfs.c
+++ b/fs/reiserfs/procfs.c
@@ -19,12 +19,13 @@
19/* 19/*
20 * LOCKING: 20 * LOCKING:
21 * 21 *
22 * We rely on new Alexander Viro's super-block locking. 22 * These guys are evicted from procfs as the very first step in ->kill_sb().
23 * 23 *
24 */ 24 */
25 25
26static int show_version(struct seq_file *m, struct super_block *sb) 26static int show_version(struct seq_file *m, void *unused)
27{ 27{
28 struct super_block *sb = m->private;
28 char *format; 29 char *format;
29 30
30 if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) { 31 if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) {
@@ -66,8 +67,9 @@ static int show_version(struct seq_file *m, struct super_block *sb)
66#define DJP( x ) le32_to_cpu( jp -> x ) 67#define DJP( x ) le32_to_cpu( jp -> x )
67#define JF( x ) ( r -> s_journal -> x ) 68#define JF( x ) ( r -> s_journal -> x )
68 69
69static int show_super(struct seq_file *m, struct super_block *sb) 70static int show_super(struct seq_file *m, void *unused)
70{ 71{
72 struct super_block *sb = m->private;
71 struct reiserfs_sb_info *r = REISERFS_SB(sb); 73 struct reiserfs_sb_info *r = REISERFS_SB(sb);
72 74
73 seq_printf(m, "state: \t%s\n" 75 seq_printf(m, "state: \t%s\n"
@@ -128,8 +130,9 @@ static int show_super(struct seq_file *m, struct super_block *sb)
128 return 0; 130 return 0;
129} 131}
130 132
131static int show_per_level(struct seq_file *m, struct super_block *sb) 133static int show_per_level(struct seq_file *m, void *unused)
132{ 134{
135 struct super_block *sb = m->private;
133 struct reiserfs_sb_info *r = REISERFS_SB(sb); 136 struct reiserfs_sb_info *r = REISERFS_SB(sb);
134 int level; 137 int level;
135 138
@@ -186,8 +189,9 @@ static int show_per_level(struct seq_file *m, struct super_block *sb)
186 return 0; 189 return 0;
187} 190}
188 191
189static int show_bitmap(struct seq_file *m, struct super_block *sb) 192static int show_bitmap(struct seq_file *m, void *unused)
190{ 193{
194 struct super_block *sb = m->private;
191 struct reiserfs_sb_info *r = REISERFS_SB(sb); 195 struct reiserfs_sb_info *r = REISERFS_SB(sb);
192 196
193 seq_printf(m, "free_block: %lu\n" 197 seq_printf(m, "free_block: %lu\n"
@@ -218,8 +222,9 @@ static int show_bitmap(struct seq_file *m, struct super_block *sb)
218 return 0; 222 return 0;
219} 223}
220 224
221static int show_on_disk_super(struct seq_file *m, struct super_block *sb) 225static int show_on_disk_super(struct seq_file *m, void *unused)
222{ 226{
227 struct super_block *sb = m->private;
223 struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); 228 struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);
224 struct reiserfs_super_block *rs = sb_info->s_rs; 229 struct reiserfs_super_block *rs = sb_info->s_rs;
225 int hash_code = DFL(s_hash_function_code); 230 int hash_code = DFL(s_hash_function_code);
@@ -261,8 +266,9 @@ static int show_on_disk_super(struct seq_file *m, struct super_block *sb)
261 return 0; 266 return 0;
262} 267}
263 268
264static int show_oidmap(struct seq_file *m, struct super_block *sb) 269static int show_oidmap(struct seq_file *m, void *unused)
265{ 270{
271 struct super_block *sb = m->private;
266 struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); 272 struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);
267 struct reiserfs_super_block *rs = sb_info->s_rs; 273 struct reiserfs_super_block *rs = sb_info->s_rs;
268 unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize); 274 unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize);
@@ -291,8 +297,9 @@ static int show_oidmap(struct seq_file *m, struct super_block *sb)
291 return 0; 297 return 0;
292} 298}
293 299
294static int show_journal(struct seq_file *m, struct super_block *sb) 300static int show_journal(struct seq_file *m, void *unused)
295{ 301{
302 struct super_block *sb = m->private;
296 struct reiserfs_sb_info *r = REISERFS_SB(sb); 303 struct reiserfs_sb_info *r = REISERFS_SB(sb);
297 struct reiserfs_super_block *rs = r->s_rs; 304 struct reiserfs_super_block *rs = r->s_rs;
298 struct journal_params *jp = &rs->s_v1.s_journal; 305 struct journal_params *jp = &rs->s_v1.s_journal;
@@ -383,92 +390,24 @@ static int show_journal(struct seq_file *m, struct super_block *sb)
383 return 0; 390 return 0;
384} 391}
385 392
386/* iterator */
387static int test_sb(struct super_block *sb, void *data)
388{
389 return data == sb;
390}
391
392static int set_sb(struct super_block *sb, void *data)
393{
394 return -ENOENT;
395}
396
397struct reiserfs_seq_private {
398 struct super_block *sb;
399 int (*show) (struct seq_file *, struct super_block *);
400};
401
402static void *r_start(struct seq_file *m, loff_t * pos)
403{
404 struct reiserfs_seq_private *priv = m->private;
405 loff_t l = *pos;
406
407 if (l)
408 return NULL;
409
410 if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb)))
411 return NULL;
412
413 up_write(&priv->sb->s_umount);
414 return priv->sb;
415}
416
417static void *r_next(struct seq_file *m, void *v, loff_t * pos)
418{
419 ++*pos;
420 if (v)
421 deactivate_super(v);
422 return NULL;
423}
424
425static void r_stop(struct seq_file *m, void *v)
426{
427 if (v)
428 deactivate_super(v);
429}
430
431static int r_show(struct seq_file *m, void *v)
432{
433 struct reiserfs_seq_private *priv = m->private;
434 return priv->show(m, v);
435}
436
437static const struct seq_operations r_ops = {
438 .start = r_start,
439 .next = r_next,
440 .stop = r_stop,
441 .show = r_show,
442};
443
444static int r_open(struct inode *inode, struct file *file) 393static int r_open(struct inode *inode, struct file *file)
445{ 394{
446 struct reiserfs_seq_private *priv; 395 return single_open(file, PDE_DATA(inode),
447 int ret = seq_open_private(file, &r_ops, 396 proc_get_parent_data(inode));
448 sizeof(struct reiserfs_seq_private));
449
450 if (!ret) {
451 struct seq_file *m = file->private_data;
452 priv = m->private;
453 priv->sb = proc_get_parent_data(inode);
454 priv->show = PDE_DATA(inode);
455 }
456 return ret;
457} 397}
458 398
459static const struct file_operations r_file_operations = { 399static const struct file_operations r_file_operations = {
460 .open = r_open, 400 .open = r_open,
461 .read = seq_read, 401 .read = seq_read,
462 .llseek = seq_lseek, 402 .llseek = seq_lseek,
463 .release = seq_release_private, 403 .release = single_release,
464 .owner = THIS_MODULE,
465}; 404};
466 405
467static struct proc_dir_entry *proc_info_root = NULL; 406static struct proc_dir_entry *proc_info_root = NULL;
468static const char proc_info_root_name[] = "fs/reiserfs"; 407static const char proc_info_root_name[] = "fs/reiserfs";
469 408
470static void add_file(struct super_block *sb, char *name, 409static void add_file(struct super_block *sb, char *name,
471 int (*func) (struct seq_file *, struct super_block *)) 410 int (*func) (struct seq_file *, void *))
472{ 411{
473 proc_create_data(name, 0, REISERFS_SB(sb)->procdir, 412 proc_create_data(name, 0, REISERFS_SB(sb)->procdir,
474 &r_file_operations, func); 413 &r_file_operations, func);
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index f8a23c3078f8..e2e202a07b31 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -499,6 +499,7 @@ int remove_save_link(struct inode *inode, int truncate)
499static void reiserfs_kill_sb(struct super_block *s) 499static void reiserfs_kill_sb(struct super_block *s)
500{ 500{
501 if (REISERFS_SB(s)) { 501 if (REISERFS_SB(s)) {
502 reiserfs_proc_info_done(s);
502 /* 503 /*
503 * Force any pending inode evictions to occur now. Any 504 * Force any pending inode evictions to occur now. Any
504 * inodes to be removed that have extended attributes 505 * inodes to be removed that have extended attributes
@@ -554,8 +555,6 @@ static void reiserfs_put_super(struct super_block *s)
554 REISERFS_SB(s)->reserved_blocks); 555 REISERFS_SB(s)->reserved_blocks);
555 } 556 }
556 557
557 reiserfs_proc_info_done(s);
558
559 reiserfs_write_unlock(s); 558 reiserfs_write_unlock(s);
560 mutex_destroy(&REISERFS_SB(s)->lock); 559 mutex_destroy(&REISERFS_SB(s)->lock);
561 kfree(s->s_fs_info); 560 kfree(s->s_fs_info);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 56e6b68c8d2f..94383a70c1a3 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -274,15 +274,12 @@ struct acpi_device_wakeup {
274}; 274};
275 275
276struct acpi_device_physical_node { 276struct acpi_device_physical_node {
277 u8 node_id; 277 unsigned int node_id;
278 struct list_head node; 278 struct list_head node;
279 struct device *dev; 279 struct device *dev;
280 bool put_online:1; 280 bool put_online:1;
281}; 281};
282 282
283/* set maximum of physical nodes to 32 for expansibility */
284#define ACPI_MAX_PHYSICAL_NODE 32
285
286/* Device */ 283/* Device */
287struct acpi_device { 284struct acpi_device {
288 int device_type; 285 int device_type;
@@ -302,10 +299,9 @@ struct acpi_device {
302 struct acpi_driver *driver; 299 struct acpi_driver *driver;
303 void *driver_data; 300 void *driver_data;
304 struct device dev; 301 struct device dev;
305 u8 physical_node_count; 302 unsigned int physical_node_count;
306 struct list_head physical_node_list; 303 struct list_head physical_node_list;
307 struct mutex physical_node_lock; 304 struct mutex physical_node_lock;
308 DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE);
309 struct list_head power_dependent; 305 struct list_head power_dependent;
310 void (*remove)(struct acpi_device *); 306 void (*remove)(struct acpi_device *);
311}; 307};
@@ -445,7 +441,11 @@ struct acpi_pci_root {
445}; 441};
446 442
447/* helper */ 443/* helper */
448acpi_handle acpi_get_child(acpi_handle, u64); 444acpi_handle acpi_find_child(acpi_handle, u64, bool);
445static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr)
446{
447 return acpi_find_child(handle, addr, false);
448}
449int acpi_is_root_bridge(acpi_handle); 449int acpi_is_root_bridge(acpi_handle);
450struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); 450struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
451#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev)) 451#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev))
diff --git a/include/dt-bindings/pinctrl/nomadik.h b/include/dt-bindings/pinctrl/nomadik.h
new file mode 100644
index 000000000000..638fb321a1cb
--- /dev/null
+++ b/include/dt-bindings/pinctrl/nomadik.h
@@ -0,0 +1,36 @@
1/*
2 * nomadik.h
3 *
4 * Copyright (C) ST-Ericsson SA 2013
5 * Author: Gabriel Fernandez <gabriel.fernandez@st.com> for ST-Ericsson.
6 * License terms: GNU General Public License (GPL), version 2
7 */
8
9#define INPUT_NOPULL 0
10#define INPUT_PULLUP 1
11#define INPUT_PULLDOWN 2
12
13#define OUTPUT_LOW 0
14#define OUTPUT_HIGH 1
15#define DIR_OUTPUT 2
16
17#define SLPM_DISABLED 0
18#define SLPM_ENABLED 1
19
20#define SLPM_INPUT_NOPULL 0
21#define SLPM_INPUT_PULLUP 1
22#define SLPM_INPUT_PULLDOWN 2
23#define SLPM_DIR_INPUT 3
24
25#define SLPM_OUTPUT_LOW 0
26#define SLPM_OUTPUT_HIGH 1
27#define SLPM_DIR_OUTPUT 2
28
29#define SLPM_WAKEUP_DISABLE 0
30#define SLPM_WAKEUP_ENABLE 1
31
32#define GPIOMODE_DISABLED 0
33#define GPIOMODE_ENABLED 1
34
35#define SLPM_PDIS_DISABLED 0
36#define SLPM_PDIS_ENABLED 1
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 4372658c73ae..120d57a1c3a5 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -78,6 +78,11 @@ struct trace_iterator {
78 /* trace_seq for __print_flags() and __print_symbolic() etc. */ 78 /* trace_seq for __print_flags() and __print_symbolic() etc. */
79 struct trace_seq tmp_seq; 79 struct trace_seq tmp_seq;
80 80
81 cpumask_var_t started;
82
83 /* it's true when current open file is snapshot */
84 bool snapshot;
85
81 /* The below is zeroed out in pipe_read */ 86 /* The below is zeroed out in pipe_read */
82 struct trace_seq seq; 87 struct trace_seq seq;
83 struct trace_entry *ent; 88 struct trace_entry *ent;
@@ -90,10 +95,7 @@ struct trace_iterator {
90 loff_t pos; 95 loff_t pos;
91 long idx; 96 long idx;
92 97
93 cpumask_var_t started; 98 /* All new field here will be zeroed out in pipe_read */
94
95 /* it's true when current open file is snapshot */
96 bool snapshot;
97}; 99};
98 100
99enum trace_iter_flags { 101enum trace_iter_flags {
@@ -332,7 +334,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,
332 const char *name, int offset, int size, 334 const char *name, int offset, int size,
333 int is_signed, int filter_type); 335 int is_signed, int filter_type);
334extern int trace_add_event_call(struct ftrace_event_call *call); 336extern int trace_add_event_call(struct ftrace_event_call *call);
335extern void trace_remove_event_call(struct ftrace_event_call *call); 337extern int trace_remove_event_call(struct ftrace_event_call *call);
336 338
337#define is_signed_type(type) (((type)(-1)) < (type)1) 339#define is_signed_type(type) (((type)(-1)) < (type)1)
338 340
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 3869c525b052..369cf2cd5144 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -8,6 +8,7 @@
8 */ 8 */
9#include <linux/irq.h> 9#include <linux/irq.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/atomic.h>
11 12
12#ifndef _IIO_TRIGGER_H_ 13#ifndef _IIO_TRIGGER_H_
13#define _IIO_TRIGGER_H_ 14#define _IIO_TRIGGER_H_
@@ -61,7 +62,7 @@ struct iio_trigger {
61 62
62 struct list_head list; 63 struct list_head list;
63 struct list_head alloc_list; 64 struct list_head alloc_list;
64 int use_count; 65 atomic_t use_count;
65 66
66 struct irq_chip subirq_chip; 67 struct irq_chip subirq_chip;
67 int subirq_base; 68 int subirq_base;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3bef14c6586b..482ad2d84a32 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -629,7 +629,7 @@ extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
629static inline void tracing_start(void) { } 629static inline void tracing_start(void) { }
630static inline void tracing_stop(void) { } 630static inline void tracing_stop(void) { }
631static inline void ftrace_off_permanent(void) { } 631static inline void ftrace_off_permanent(void) { }
632static inline void trace_dump_stack(void) { } 632static inline void trace_dump_stack(int skip) { }
633 633
634static inline void tracing_on(void) { } 634static inline void tracing_on(void) { }
635static inline void tracing_off(void) { } 635static inline void tracing_off(void) { }
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 8d73fe29796a..db1791bb997a 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -113,11 +113,27 @@
113#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3) 113#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3)
114#define CNTRLREG_TSCENB BIT(7) 114#define CNTRLREG_TSCENB BIT(7)
115 115
116/* FIFO READ Register */
117#define FIFOREAD_DATA_MASK (0xfff << 0)
118#define FIFOREAD_CHNLID_MASK (0xf << 16)
119
120/* Sequencer Status */
121#define SEQ_STATUS BIT(5)
122
116#define ADC_CLK 3000000 123#define ADC_CLK 3000000
117#define MAX_CLK_DIV 7 124#define MAX_CLK_DIV 7
118#define TOTAL_STEPS 16 125#define TOTAL_STEPS 16
119#define TOTAL_CHANNELS 8 126#define TOTAL_CHANNELS 8
120 127
128/*
129* ADC runs at 3MHz, and it takes
130* 15 cycles to latch one data output.
131* Hence the idle time for ADC to
132* process one sample data would be
133* around 5 micro seconds.
134*/
135#define IDLE_TIMEOUT 5 /* microsec */
136
121#define TSCADC_CELLS 2 137#define TSCADC_CELLS 2
122 138
123struct ti_tscadc_dev { 139struct ti_tscadc_dev {
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 75981d0b57dc..580a5320cc96 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/rbtree.h> 17#include <linux/rbtree.h>
18#include <linux/err.h>
18 19
19struct module; 20struct module;
20struct device; 21struct device;
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 6d870353674a..1821445708d6 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -121,6 +121,7 @@ struct rpc_task_setup {
121#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ 121#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */
122#define RPC_TASK_SENT 0x0800 /* message was sent */ 122#define RPC_TASK_SENT 0x0800 /* message was sent */
123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ 123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
124#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */
124 125
125#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 126#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
126#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 127#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index b6b215f13b45..14105c26a836 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -23,6 +23,7 @@ struct user_namespace {
23 struct uid_gid_map projid_map; 23 struct uid_gid_map projid_map;
24 atomic_t count; 24 atomic_t count;
25 struct user_namespace *parent; 25 struct user_namespace *parent;
26 int level;
26 kuid_t owner; 27 kuid_t owner;
27 kgid_t group; 28 kgid_t group;
28 unsigned int proc_inum; 29 unsigned int proc_inum;
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 7343a27fe819..47ada23345a1 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -22,6 +22,7 @@
22#define _V4L2_CTRLS_H 22#define _V4L2_CTRLS_H
23 23
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/mutex.h>
25#include <linux/videodev2.h> 26#include <linux/videodev2.h>
26 27
27/* forward references */ 28/* forward references */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 789ec4683db3..781845a013ab 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4335,8 +4335,10 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
4335 } 4335 }
4336 4336
4337 err = percpu_ref_init(&css->refcnt, css_release); 4337 err = percpu_ref_init(&css->refcnt, css_release);
4338 if (err) 4338 if (err) {
4339 ss->css_free(cgrp);
4339 goto err_free_all; 4340 goto err_free_all;
4341 }
4340 4342
4341 init_cgroup_css(css, ss, cgrp); 4343 init_cgroup_css(css, ss, cgrp);
4342 4344
diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c
index b51087fb9ace..276762f3a460 100644
--- a/kernel/printk/braille.c
+++ b/kernel/printk/braille.c
@@ -19,7 +19,8 @@ char *_braille_console_setup(char **str, char **brl_options)
19 pr_err("need port name after brl=\n"); 19 pr_err("need port name after brl=\n");
20 else 20 else
21 *((*str)++) = 0; 21 *((*str)++) = 0;
22 } 22 } else
23 return NULL;
23 24
24 return *str; 25 return *str;
25} 26}
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 4041f5747e73..a146ee327f6a 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -469,7 +469,6 @@ static int ptrace_detach(struct task_struct *child, unsigned int data)
469 /* Architecture-specific hardware disable .. */ 469 /* Architecture-specific hardware disable .. */
470 ptrace_disable(child); 470 ptrace_disable(child);
471 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 471 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
472 flush_ptrace_hw_breakpoint(child);
473 472
474 write_lock_irq(&tasklist_lock); 473 write_lock_irq(&tasklist_lock);
475 /* 474 /*
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 8ce9eefc5bb4..a6d098c6df3f 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2169,12 +2169,57 @@ static cycle_t ftrace_update_time;
2169static unsigned long ftrace_update_cnt; 2169static unsigned long ftrace_update_cnt;
2170unsigned long ftrace_update_tot_cnt; 2170unsigned long ftrace_update_tot_cnt;
2171 2171
2172static int ops_traces_mod(struct ftrace_ops *ops) 2172static inline int ops_traces_mod(struct ftrace_ops *ops)
2173{ 2173{
2174 struct ftrace_hash *hash; 2174 /*
2175 * Filter_hash being empty will default to trace module.
2176 * But notrace hash requires a test of individual module functions.
2177 */
2178 return ftrace_hash_empty(ops->filter_hash) &&
2179 ftrace_hash_empty(ops->notrace_hash);
2180}
2181
2182/*
2183 * Check if the current ops references the record.
2184 *
2185 * If the ops traces all functions, then it was already accounted for.
2186 * If the ops does not trace the current record function, skip it.
2187 * If the ops ignores the function via notrace filter, skip it.
2188 */
2189static inline bool
2190ops_references_rec(struct ftrace_ops *ops, struct dyn_ftrace *rec)
2191{
2192 /* If ops isn't enabled, ignore it */
2193 if (!(ops->flags & FTRACE_OPS_FL_ENABLED))
2194 return 0;
2195
2196 /* If ops traces all mods, we already accounted for it */
2197 if (ops_traces_mod(ops))
2198 return 0;
2199
2200 /* The function must be in the filter */
2201 if (!ftrace_hash_empty(ops->filter_hash) &&
2202 !ftrace_lookup_ip(ops->filter_hash, rec->ip))
2203 return 0;
2204
2205 /* If in notrace hash, we ignore it too */
2206 if (ftrace_lookup_ip(ops->notrace_hash, rec->ip))
2207 return 0;
2208
2209 return 1;
2210}
2211
2212static int referenced_filters(struct dyn_ftrace *rec)
2213{
2214 struct ftrace_ops *ops;
2215 int cnt = 0;
2175 2216
2176 hash = ops->filter_hash; 2217 for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) {
2177 return ftrace_hash_empty(hash); 2218 if (ops_references_rec(ops, rec))
2219 cnt++;
2220 }
2221
2222 return cnt;
2178} 2223}
2179 2224
2180static int ftrace_update_code(struct module *mod) 2225static int ftrace_update_code(struct module *mod)
@@ -2183,6 +2228,7 @@ static int ftrace_update_code(struct module *mod)
2183 struct dyn_ftrace *p; 2228 struct dyn_ftrace *p;
2184 cycle_t start, stop; 2229 cycle_t start, stop;
2185 unsigned long ref = 0; 2230 unsigned long ref = 0;
2231 bool test = false;
2186 int i; 2232 int i;
2187 2233
2188 /* 2234 /*
@@ -2196,9 +2242,12 @@ static int ftrace_update_code(struct module *mod)
2196 2242
2197 for (ops = ftrace_ops_list; 2243 for (ops = ftrace_ops_list;
2198 ops != &ftrace_list_end; ops = ops->next) { 2244 ops != &ftrace_list_end; ops = ops->next) {
2199 if (ops->flags & FTRACE_OPS_FL_ENABLED && 2245 if (ops->flags & FTRACE_OPS_FL_ENABLED) {
2200 ops_traces_mod(ops)) 2246 if (ops_traces_mod(ops))
2201 ref++; 2247 ref++;
2248 else
2249 test = true;
2250 }
2202 } 2251 }
2203 } 2252 }
2204 2253
@@ -2208,12 +2257,16 @@ static int ftrace_update_code(struct module *mod)
2208 for (pg = ftrace_new_pgs; pg; pg = pg->next) { 2257 for (pg = ftrace_new_pgs; pg; pg = pg->next) {
2209 2258
2210 for (i = 0; i < pg->index; i++) { 2259 for (i = 0; i < pg->index; i++) {
2260 int cnt = ref;
2261
2211 /* If something went wrong, bail without enabling anything */ 2262 /* If something went wrong, bail without enabling anything */
2212 if (unlikely(ftrace_disabled)) 2263 if (unlikely(ftrace_disabled))
2213 return -1; 2264 return -1;
2214 2265
2215 p = &pg->records[i]; 2266 p = &pg->records[i];
2216 p->flags = ref; 2267 if (test)
2268 cnt += referenced_filters(p);
2269 p->flags = cnt;
2217 2270
2218 /* 2271 /*
2219 * Do the initial record conversion from mcount jump 2272 * Do the initial record conversion from mcount jump
@@ -2233,7 +2286,7 @@ static int ftrace_update_code(struct module *mod)
2233 * conversion puts the module to the correct state, thus 2286 * conversion puts the module to the correct state, thus
2234 * passing the ftrace_make_call check. 2287 * passing the ftrace_make_call check.
2235 */ 2288 */
2236 if (ftrace_start_up && ref) { 2289 if (ftrace_start_up && cnt) {
2237 int failed = __ftrace_replace_code(p, 1); 2290 int failed = __ftrace_replace_code(p, 1);
2238 if (failed) 2291 if (failed)
2239 ftrace_bug(failed, p->ip); 2292 ftrace_bug(failed, p->ip);
@@ -3384,6 +3437,12 @@ ftrace_match_addr(struct ftrace_hash *hash, unsigned long ip, int remove)
3384 return add_hash_entry(hash, ip); 3437 return add_hash_entry(hash, ip);
3385} 3438}
3386 3439
3440static void ftrace_ops_update_code(struct ftrace_ops *ops)
3441{
3442 if (ops->flags & FTRACE_OPS_FL_ENABLED && ftrace_enabled)
3443 ftrace_run_update_code(FTRACE_UPDATE_CALLS);
3444}
3445
3387static int 3446static int
3388ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, 3447ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len,
3389 unsigned long ip, int remove, int reset, int enable) 3448 unsigned long ip, int remove, int reset, int enable)
@@ -3426,9 +3485,8 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len,
3426 3485
3427 mutex_lock(&ftrace_lock); 3486 mutex_lock(&ftrace_lock);
3428 ret = ftrace_hash_move(ops, enable, orig_hash, hash); 3487 ret = ftrace_hash_move(ops, enable, orig_hash, hash);
3429 if (!ret && ops->flags & FTRACE_OPS_FL_ENABLED 3488 if (!ret)
3430 && ftrace_enabled) 3489 ftrace_ops_update_code(ops);
3431 ftrace_run_update_code(FTRACE_UPDATE_CALLS);
3432 3490
3433 mutex_unlock(&ftrace_lock); 3491 mutex_unlock(&ftrace_lock);
3434 3492
@@ -3655,9 +3713,8 @@ int ftrace_regex_release(struct inode *inode, struct file *file)
3655 mutex_lock(&ftrace_lock); 3713 mutex_lock(&ftrace_lock);
3656 ret = ftrace_hash_move(iter->ops, filter_hash, 3714 ret = ftrace_hash_move(iter->ops, filter_hash,
3657 orig_hash, iter->hash); 3715 orig_hash, iter->hash);
3658 if (!ret && (iter->ops->flags & FTRACE_OPS_FL_ENABLED) 3716 if (!ret)
3659 && ftrace_enabled) 3717 ftrace_ops_update_code(iter->ops);
3660 ftrace_run_update_code(FTRACE_UPDATE_CALLS);
3661 3718
3662 mutex_unlock(&ftrace_lock); 3719 mutex_unlock(&ftrace_lock);
3663 } 3720 }
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 882ec1dd1515..496f94d57698 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -243,20 +243,25 @@ int filter_current_check_discard(struct ring_buffer *buffer,
243} 243}
244EXPORT_SYMBOL_GPL(filter_current_check_discard); 244EXPORT_SYMBOL_GPL(filter_current_check_discard);
245 245
246cycle_t ftrace_now(int cpu) 246cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu)
247{ 247{
248 u64 ts; 248 u64 ts;
249 249
250 /* Early boot up does not have a buffer yet */ 250 /* Early boot up does not have a buffer yet */
251 if (!global_trace.trace_buffer.buffer) 251 if (!buf->buffer)
252 return trace_clock_local(); 252 return trace_clock_local();
253 253
254 ts = ring_buffer_time_stamp(global_trace.trace_buffer.buffer, cpu); 254 ts = ring_buffer_time_stamp(buf->buffer, cpu);
255 ring_buffer_normalize_time_stamp(global_trace.trace_buffer.buffer, cpu, &ts); 255 ring_buffer_normalize_time_stamp(buf->buffer, cpu, &ts);
256 256
257 return ts; 257 return ts;
258} 258}
259 259
260cycle_t ftrace_now(int cpu)
261{
262 return buffer_ftrace_now(&global_trace.trace_buffer, cpu);
263}
264
260/** 265/**
261 * tracing_is_enabled - Show if global_trace has been disabled 266 * tracing_is_enabled - Show if global_trace has been disabled
262 * 267 *
@@ -1211,7 +1216,7 @@ void tracing_reset_online_cpus(struct trace_buffer *buf)
1211 /* Make sure all commits have finished */ 1216 /* Make sure all commits have finished */
1212 synchronize_sched(); 1217 synchronize_sched();
1213 1218
1214 buf->time_start = ftrace_now(buf->cpu); 1219 buf->time_start = buffer_ftrace_now(buf, buf->cpu);
1215 1220
1216 for_each_online_cpu(cpu) 1221 for_each_online_cpu(cpu)
1217 ring_buffer_reset_cpu(buffer, cpu); 1222 ring_buffer_reset_cpu(buffer, cpu);
@@ -1219,11 +1224,6 @@ void tracing_reset_online_cpus(struct trace_buffer *buf)
1219 ring_buffer_record_enable(buffer); 1224 ring_buffer_record_enable(buffer);
1220} 1225}
1221 1226
1222void tracing_reset_current(int cpu)
1223{
1224 tracing_reset(&global_trace.trace_buffer, cpu);
1225}
1226
1227/* Must have trace_types_lock held */ 1227/* Must have trace_types_lock held */
1228void tracing_reset_all_online_cpus(void) 1228void tracing_reset_all_online_cpus(void)
1229{ 1229{
@@ -4151,6 +4151,7 @@ waitagain:
4151 memset(&iter->seq, 0, 4151 memset(&iter->seq, 0,
4152 sizeof(struct trace_iterator) - 4152 sizeof(struct trace_iterator) -
4153 offsetof(struct trace_iterator, seq)); 4153 offsetof(struct trace_iterator, seq));
4154 cpumask_clear(iter->started);
4154 iter->pos = -1; 4155 iter->pos = -1;
4155 4156
4156 trace_event_read_lock(); 4157 trace_event_read_lock();
@@ -4468,7 +4469,7 @@ tracing_free_buffer_release(struct inode *inode, struct file *filp)
4468 4469
4469 /* disable tracing ? */ 4470 /* disable tracing ? */
4470 if (trace_flags & TRACE_ITER_STOP_ON_FREE) 4471 if (trace_flags & TRACE_ITER_STOP_ON_FREE)
4471 tracing_off(); 4472 tracer_tracing_off(tr);
4472 /* resize the ring buffer to 0 */ 4473 /* resize the ring buffer to 0 */
4473 tracing_resize_ring_buffer(tr, 0, RING_BUFFER_ALL_CPUS); 4474 tracing_resize_ring_buffer(tr, 0, RING_BUFFER_ALL_CPUS);
4474 4475
@@ -4633,12 +4634,12 @@ static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf,
4633 * New clock may not be consistent with the previous clock. 4634 * New clock may not be consistent with the previous clock.
4634 * Reset the buffer so that it doesn't have incomparable timestamps. 4635 * Reset the buffer so that it doesn't have incomparable timestamps.
4635 */ 4636 */
4636 tracing_reset_online_cpus(&global_trace.trace_buffer); 4637 tracing_reset_online_cpus(&tr->trace_buffer);
4637 4638
4638#ifdef CONFIG_TRACER_MAX_TRACE 4639#ifdef CONFIG_TRACER_MAX_TRACE
4639 if (tr->flags & TRACE_ARRAY_FL_GLOBAL && tr->max_buffer.buffer) 4640 if (tr->flags & TRACE_ARRAY_FL_GLOBAL && tr->max_buffer.buffer)
4640 ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func); 4641 ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func);
4641 tracing_reset_online_cpus(&global_trace.max_buffer); 4642 tracing_reset_online_cpus(&tr->max_buffer);
4642#endif 4643#endif
4643 4644
4644 mutex_unlock(&trace_types_lock); 4645 mutex_unlock(&trace_types_lock);
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 898f868833f2..29a7ebcfb426 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -409,33 +409,42 @@ static void put_system(struct ftrace_subsystem_dir *dir)
409 mutex_unlock(&event_mutex); 409 mutex_unlock(&event_mutex);
410} 410}
411 411
412/* 412static void remove_subsystem(struct ftrace_subsystem_dir *dir)
413 * Open and update trace_array ref count.
414 * Must have the current trace_array passed to it.
415 */
416static int tracing_open_generic_file(struct inode *inode, struct file *filp)
417{ 413{
418 struct ftrace_event_file *file = inode->i_private; 414 if (!dir)
419 struct trace_array *tr = file->tr; 415 return;
420 int ret;
421 416
422 if (trace_array_get(tr) < 0) 417 if (!--dir->nr_events) {
423 return -ENODEV; 418 debugfs_remove_recursive(dir->entry);
419 list_del(&dir->list);
420 __put_system_dir(dir);
421 }
422}
424 423
425 ret = tracing_open_generic(inode, filp); 424static void *event_file_data(struct file *filp)
426 if (ret < 0) 425{
427 trace_array_put(tr); 426 return ACCESS_ONCE(file_inode(filp)->i_private);
428 return ret;
429} 427}
430 428
431static int tracing_release_generic_file(struct inode *inode, struct file *filp) 429static void remove_event_file_dir(struct ftrace_event_file *file)
432{ 430{
433 struct ftrace_event_file *file = inode->i_private; 431 struct dentry *dir = file->dir;
434 struct trace_array *tr = file->tr; 432 struct dentry *child;
435 433
436 trace_array_put(tr); 434 if (dir) {
435 spin_lock(&dir->d_lock); /* probably unneeded */
436 list_for_each_entry(child, &dir->d_subdirs, d_u.d_child) {
437 if (child->d_inode) /* probably unneeded */
438 child->d_inode->i_private = NULL;
439 }
440 spin_unlock(&dir->d_lock);
437 441
438 return 0; 442 debugfs_remove_recursive(dir);
443 }
444
445 list_del(&file->list);
446 remove_subsystem(file->system);
447 kmem_cache_free(file_cachep, file);
439} 448}
440 449
441/* 450/*
@@ -679,15 +688,25 @@ static ssize_t
679event_enable_read(struct file *filp, char __user *ubuf, size_t cnt, 688event_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
680 loff_t *ppos) 689 loff_t *ppos)
681{ 690{
682 struct ftrace_event_file *file = filp->private_data; 691 struct ftrace_event_file *file;
692 unsigned long flags;
683 char buf[4] = "0"; 693 char buf[4] = "0";
684 694
685 if (file->flags & FTRACE_EVENT_FL_ENABLED && 695 mutex_lock(&event_mutex);
686 !(file->flags & FTRACE_EVENT_FL_SOFT_DISABLED)) 696 file = event_file_data(filp);
697 if (likely(file))
698 flags = file->flags;
699 mutex_unlock(&event_mutex);
700
701 if (!file)
702 return -ENODEV;
703
704 if (flags & FTRACE_EVENT_FL_ENABLED &&
705 !(flags & FTRACE_EVENT_FL_SOFT_DISABLED))
687 strcpy(buf, "1"); 706 strcpy(buf, "1");
688 707
689 if (file->flags & FTRACE_EVENT_FL_SOFT_DISABLED || 708 if (flags & FTRACE_EVENT_FL_SOFT_DISABLED ||
690 file->flags & FTRACE_EVENT_FL_SOFT_MODE) 709 flags & FTRACE_EVENT_FL_SOFT_MODE)
691 strcat(buf, "*"); 710 strcat(buf, "*");
692 711
693 strcat(buf, "\n"); 712 strcat(buf, "\n");
@@ -699,13 +718,10 @@ static ssize_t
699event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, 718event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
700 loff_t *ppos) 719 loff_t *ppos)
701{ 720{
702 struct ftrace_event_file *file = filp->private_data; 721 struct ftrace_event_file *file;
703 unsigned long val; 722 unsigned long val;
704 int ret; 723 int ret;
705 724
706 if (!file)
707 return -EINVAL;
708
709 ret = kstrtoul_from_user(ubuf, cnt, 10, &val); 725 ret = kstrtoul_from_user(ubuf, cnt, 10, &val);
710 if (ret) 726 if (ret)
711 return ret; 727 return ret;
@@ -717,8 +733,11 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
717 switch (val) { 733 switch (val) {
718 case 0: 734 case 0:
719 case 1: 735 case 1:
736 ret = -ENODEV;
720 mutex_lock(&event_mutex); 737 mutex_lock(&event_mutex);
721 ret = ftrace_event_enable_disable(file, val); 738 file = event_file_data(filp);
739 if (likely(file))
740 ret = ftrace_event_enable_disable(file, val);
722 mutex_unlock(&event_mutex); 741 mutex_unlock(&event_mutex);
723 break; 742 break;
724 743
@@ -825,7 +844,7 @@ enum {
825 844
826static void *f_next(struct seq_file *m, void *v, loff_t *pos) 845static void *f_next(struct seq_file *m, void *v, loff_t *pos)
827{ 846{
828 struct ftrace_event_call *call = m->private; 847 struct ftrace_event_call *call = event_file_data(m->private);
829 struct list_head *common_head = &ftrace_common_fields; 848 struct list_head *common_head = &ftrace_common_fields;
830 struct list_head *head = trace_get_fields(call); 849 struct list_head *head = trace_get_fields(call);
831 struct list_head *node = v; 850 struct list_head *node = v;
@@ -857,7 +876,7 @@ static void *f_next(struct seq_file *m, void *v, loff_t *pos)
857 876
858static int f_show(struct seq_file *m, void *v) 877static int f_show(struct seq_file *m, void *v)
859{ 878{
860 struct ftrace_event_call *call = m->private; 879 struct ftrace_event_call *call = event_file_data(m->private);
861 struct ftrace_event_field *field; 880 struct ftrace_event_field *field;
862 const char *array_descriptor; 881 const char *array_descriptor;
863 882
@@ -910,6 +929,11 @@ static void *f_start(struct seq_file *m, loff_t *pos)
910 void *p = (void *)FORMAT_HEADER; 929 void *p = (void *)FORMAT_HEADER;
911 loff_t l = 0; 930 loff_t l = 0;
912 931
932 /* ->stop() is called even if ->start() fails */
933 mutex_lock(&event_mutex);
934 if (!event_file_data(m->private))
935 return ERR_PTR(-ENODEV);
936
913 while (l < *pos && p) 937 while (l < *pos && p)
914 p = f_next(m, p, &l); 938 p = f_next(m, p, &l);
915 939
@@ -918,6 +942,7 @@ static void *f_start(struct seq_file *m, loff_t *pos)
918 942
919static void f_stop(struct seq_file *m, void *p) 943static void f_stop(struct seq_file *m, void *p)
920{ 944{
945 mutex_unlock(&event_mutex);
921} 946}
922 947
923static const struct seq_operations trace_format_seq_ops = { 948static const struct seq_operations trace_format_seq_ops = {
@@ -929,7 +954,6 @@ static const struct seq_operations trace_format_seq_ops = {
929 954
930static int trace_format_open(struct inode *inode, struct file *file) 955static int trace_format_open(struct inode *inode, struct file *file)
931{ 956{
932 struct ftrace_event_call *call = inode->i_private;
933 struct seq_file *m; 957 struct seq_file *m;
934 int ret; 958 int ret;
935 959
@@ -938,7 +962,7 @@ static int trace_format_open(struct inode *inode, struct file *file)
938 return ret; 962 return ret;
939 963
940 m = file->private_data; 964 m = file->private_data;
941 m->private = call; 965 m->private = file;
942 966
943 return 0; 967 return 0;
944} 968}
@@ -946,14 +970,18 @@ static int trace_format_open(struct inode *inode, struct file *file)
946static ssize_t 970static ssize_t
947event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) 971event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
948{ 972{
949 struct ftrace_event_call *call = filp->private_data; 973 int id = (long)event_file_data(filp);
950 char buf[32]; 974 char buf[32];
951 int len; 975 int len;
952 976
953 if (*ppos) 977 if (*ppos)
954 return 0; 978 return 0;
955 979
956 len = sprintf(buf, "%d\n", call->event.type); 980 if (unlikely(!id))
981 return -ENODEV;
982
983 len = sprintf(buf, "%d\n", id);
984
957 return simple_read_from_buffer(ubuf, cnt, ppos, buf, len); 985 return simple_read_from_buffer(ubuf, cnt, ppos, buf, len);
958} 986}
959 987
@@ -961,21 +989,28 @@ static ssize_t
961event_filter_read(struct file *filp, char __user *ubuf, size_t cnt, 989event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
962 loff_t *ppos) 990 loff_t *ppos)
963{ 991{
964 struct ftrace_event_call *call = filp->private_data; 992 struct ftrace_event_call *call;
965 struct trace_seq *s; 993 struct trace_seq *s;
966 int r; 994 int r = -ENODEV;
967 995
968 if (*ppos) 996 if (*ppos)
969 return 0; 997 return 0;
970 998
971 s = kmalloc(sizeof(*s), GFP_KERNEL); 999 s = kmalloc(sizeof(*s), GFP_KERNEL);
1000
972 if (!s) 1001 if (!s)
973 return -ENOMEM; 1002 return -ENOMEM;
974 1003
975 trace_seq_init(s); 1004 trace_seq_init(s);
976 1005
977 print_event_filter(call, s); 1006 mutex_lock(&event_mutex);
978 r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len); 1007 call = event_file_data(filp);
1008 if (call)
1009 print_event_filter(call, s);
1010 mutex_unlock(&event_mutex);
1011
1012 if (call)
1013 r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);
979 1014
980 kfree(s); 1015 kfree(s);
981 1016
@@ -986,9 +1021,9 @@ static ssize_t
986event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, 1021event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
987 loff_t *ppos) 1022 loff_t *ppos)
988{ 1023{
989 struct ftrace_event_call *call = filp->private_data; 1024 struct ftrace_event_call *call;
990 char *buf; 1025 char *buf;
991 int err; 1026 int err = -ENODEV;
992 1027
993 if (cnt >= PAGE_SIZE) 1028 if (cnt >= PAGE_SIZE)
994 return -EINVAL; 1029 return -EINVAL;
@@ -1003,7 +1038,12 @@ event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
1003 } 1038 }
1004 buf[cnt] = '\0'; 1039 buf[cnt] = '\0';
1005 1040
1006 err = apply_event_filter(call, buf); 1041 mutex_lock(&event_mutex);
1042 call = event_file_data(filp);
1043 if (call)
1044 err = apply_event_filter(call, buf);
1045 mutex_unlock(&event_mutex);
1046
1007 free_page((unsigned long) buf); 1047 free_page((unsigned long) buf);
1008 if (err < 0) 1048 if (err < 0)
1009 return err; 1049 return err;
@@ -1225,10 +1265,9 @@ static const struct file_operations ftrace_set_event_fops = {
1225}; 1265};
1226 1266
1227static const struct file_operations ftrace_enable_fops = { 1267static const struct file_operations ftrace_enable_fops = {
1228 .open = tracing_open_generic_file, 1268 .open = tracing_open_generic,
1229 .read = event_enable_read, 1269 .read = event_enable_read,
1230 .write = event_enable_write, 1270 .write = event_enable_write,
1231 .release = tracing_release_generic_file,
1232 .llseek = default_llseek, 1271 .llseek = default_llseek,
1233}; 1272};
1234 1273
@@ -1240,7 +1279,6 @@ static const struct file_operations ftrace_event_format_fops = {
1240}; 1279};
1241 1280
1242static const struct file_operations ftrace_event_id_fops = { 1281static const struct file_operations ftrace_event_id_fops = {
1243 .open = tracing_open_generic,
1244 .read = event_id_read, 1282 .read = event_id_read,
1245 .llseek = default_llseek, 1283 .llseek = default_llseek,
1246}; 1284};
@@ -1488,8 +1526,8 @@ event_create_dir(struct dentry *parent,
1488 1526
1489#ifdef CONFIG_PERF_EVENTS 1527#ifdef CONFIG_PERF_EVENTS
1490 if (call->event.type && call->class->reg) 1528 if (call->event.type && call->class->reg)
1491 trace_create_file("id", 0444, file->dir, call, 1529 trace_create_file("id", 0444, file->dir,
1492 id); 1530 (void *)(long)call->event.type, id);
1493#endif 1531#endif
1494 1532
1495 /* 1533 /*
@@ -1514,33 +1552,16 @@ event_create_dir(struct dentry *parent,
1514 return 0; 1552 return 0;
1515} 1553}
1516 1554
1517static void remove_subsystem(struct ftrace_subsystem_dir *dir)
1518{
1519 if (!dir)
1520 return;
1521
1522 if (!--dir->nr_events) {
1523 debugfs_remove_recursive(dir->entry);
1524 list_del(&dir->list);
1525 __put_system_dir(dir);
1526 }
1527}
1528
1529static void remove_event_from_tracers(struct ftrace_event_call *call) 1555static void remove_event_from_tracers(struct ftrace_event_call *call)
1530{ 1556{
1531 struct ftrace_event_file *file; 1557 struct ftrace_event_file *file;
1532 struct trace_array *tr; 1558 struct trace_array *tr;
1533 1559
1534 do_for_each_event_file_safe(tr, file) { 1560 do_for_each_event_file_safe(tr, file) {
1535
1536 if (file->event_call != call) 1561 if (file->event_call != call)
1537 continue; 1562 continue;
1538 1563
1539 list_del(&file->list); 1564 remove_event_file_dir(file);
1540 debugfs_remove_recursive(file->dir);
1541 remove_subsystem(file->system);
1542 kmem_cache_free(file_cachep, file);
1543
1544 /* 1565 /*
1545 * The do_for_each_event_file_safe() is 1566 * The do_for_each_event_file_safe() is
1546 * a double loop. After finding the call for this 1567 * a double loop. After finding the call for this
@@ -1692,16 +1713,53 @@ static void __trace_remove_event_call(struct ftrace_event_call *call)
1692 destroy_preds(call); 1713 destroy_preds(call);
1693} 1714}
1694 1715
1716static int probe_remove_event_call(struct ftrace_event_call *call)
1717{
1718 struct trace_array *tr;
1719 struct ftrace_event_file *file;
1720
1721#ifdef CONFIG_PERF_EVENTS
1722 if (call->perf_refcount)
1723 return -EBUSY;
1724#endif
1725 do_for_each_event_file(tr, file) {
1726 if (file->event_call != call)
1727 continue;
1728 /*
1729 * We can't rely on ftrace_event_enable_disable(enable => 0)
1730 * we are going to do, FTRACE_EVENT_FL_SOFT_MODE can suppress
1731 * TRACE_REG_UNREGISTER.
1732 */
1733 if (file->flags & FTRACE_EVENT_FL_ENABLED)
1734 return -EBUSY;
1735 /*
1736 * The do_for_each_event_file_safe() is
1737 * a double loop. After finding the call for this
1738 * trace_array, we use break to jump to the next
1739 * trace_array.
1740 */
1741 break;
1742 } while_for_each_event_file();
1743
1744 __trace_remove_event_call(call);
1745
1746 return 0;
1747}
1748
1695/* Remove an event_call */ 1749/* Remove an event_call */
1696void trace_remove_event_call(struct ftrace_event_call *call) 1750int trace_remove_event_call(struct ftrace_event_call *call)
1697{ 1751{
1752 int ret;
1753
1698 mutex_lock(&trace_types_lock); 1754 mutex_lock(&trace_types_lock);
1699 mutex_lock(&event_mutex); 1755 mutex_lock(&event_mutex);
1700 down_write(&trace_event_sem); 1756 down_write(&trace_event_sem);
1701 __trace_remove_event_call(call); 1757 ret = probe_remove_event_call(call);
1702 up_write(&trace_event_sem); 1758 up_write(&trace_event_sem);
1703 mutex_unlock(&event_mutex); 1759 mutex_unlock(&event_mutex);
1704 mutex_unlock(&trace_types_lock); 1760 mutex_unlock(&trace_types_lock);
1761
1762 return ret;
1705} 1763}
1706 1764
1707#define for_each_event(event, start, end) \ 1765#define for_each_event(event, start, end) \
@@ -2270,12 +2328,8 @@ __trace_remove_event_dirs(struct trace_array *tr)
2270{ 2328{
2271 struct ftrace_event_file *file, *next; 2329 struct ftrace_event_file *file, *next;
2272 2330
2273 list_for_each_entry_safe(file, next, &tr->events, list) { 2331 list_for_each_entry_safe(file, next, &tr->events, list)
2274 list_del(&file->list); 2332 remove_event_file_dir(file);
2275 debugfs_remove_recursive(file->dir);
2276 remove_subsystem(file->system);
2277 kmem_cache_free(file_cachep, file);
2278 }
2279} 2333}
2280 2334
2281static void 2335static void
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 0c7b75a8acc8..97daa8cf958d 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -637,17 +637,15 @@ static void append_filter_err(struct filter_parse_state *ps,
637 free_page((unsigned long) buf); 637 free_page((unsigned long) buf);
638} 638}
639 639
640/* caller must hold event_mutex */
640void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s) 641void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s)
641{ 642{
642 struct event_filter *filter; 643 struct event_filter *filter = call->filter;
643 644
644 mutex_lock(&event_mutex);
645 filter = call->filter;
646 if (filter && filter->filter_string) 645 if (filter && filter->filter_string)
647 trace_seq_printf(s, "%s\n", filter->filter_string); 646 trace_seq_printf(s, "%s\n", filter->filter_string);
648 else 647 else
649 trace_seq_puts(s, "none\n"); 648 trace_seq_puts(s, "none\n");
650 mutex_unlock(&event_mutex);
651} 649}
652 650
653void print_subsystem_event_filter(struct event_subsystem *system, 651void print_subsystem_event_filter(struct event_subsystem *system,
@@ -1841,23 +1839,22 @@ static int create_system_filter(struct event_subsystem *system,
1841 return err; 1839 return err;
1842} 1840}
1843 1841
1842/* caller must hold event_mutex */
1844int apply_event_filter(struct ftrace_event_call *call, char *filter_string) 1843int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
1845{ 1844{
1846 struct event_filter *filter; 1845 struct event_filter *filter;
1847 int err = 0; 1846 int err;
1848
1849 mutex_lock(&event_mutex);
1850 1847
1851 if (!strcmp(strstrip(filter_string), "0")) { 1848 if (!strcmp(strstrip(filter_string), "0")) {
1852 filter_disable(call); 1849 filter_disable(call);
1853 filter = call->filter; 1850 filter = call->filter;
1854 if (!filter) 1851 if (!filter)
1855 goto out_unlock; 1852 return 0;
1856 RCU_INIT_POINTER(call->filter, NULL); 1853 RCU_INIT_POINTER(call->filter, NULL);
1857 /* Make sure the filter is not being used */ 1854 /* Make sure the filter is not being used */
1858 synchronize_sched(); 1855 synchronize_sched();
1859 __free_filter(filter); 1856 __free_filter(filter);
1860 goto out_unlock; 1857 return 0;
1861 } 1858 }
1862 1859
1863 err = create_filter(call, filter_string, true, &filter); 1860 err = create_filter(call, filter_string, true, &filter);
@@ -1884,8 +1881,6 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
1884 __free_filter(tmp); 1881 __free_filter(tmp);
1885 } 1882 }
1886 } 1883 }
1887out_unlock:
1888 mutex_unlock(&event_mutex);
1889 1884
1890 return err; 1885 return err;
1891} 1886}
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 3811487e7a7a..243f6834d026 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -95,7 +95,7 @@ static __kprobes bool trace_probe_is_on_module(struct trace_probe *tp)
95} 95}
96 96
97static int register_probe_event(struct trace_probe *tp); 97static int register_probe_event(struct trace_probe *tp);
98static void unregister_probe_event(struct trace_probe *tp); 98static int unregister_probe_event(struct trace_probe *tp);
99 99
100static DEFINE_MUTEX(probe_lock); 100static DEFINE_MUTEX(probe_lock);
101static LIST_HEAD(probe_list); 101static LIST_HEAD(probe_list);
@@ -351,9 +351,12 @@ static int unregister_trace_probe(struct trace_probe *tp)
351 if (trace_probe_is_enabled(tp)) 351 if (trace_probe_is_enabled(tp))
352 return -EBUSY; 352 return -EBUSY;
353 353
354 /* Will fail if probe is being used by ftrace or perf */
355 if (unregister_probe_event(tp))
356 return -EBUSY;
357
354 __unregister_trace_probe(tp); 358 __unregister_trace_probe(tp);
355 list_del(&tp->list); 359 list_del(&tp->list);
356 unregister_probe_event(tp);
357 360
358 return 0; 361 return 0;
359} 362}
@@ -632,7 +635,9 @@ static int release_all_trace_probes(void)
632 /* TODO: Use batch unregistration */ 635 /* TODO: Use batch unregistration */
633 while (!list_empty(&probe_list)) { 636 while (!list_empty(&probe_list)) {
634 tp = list_entry(probe_list.next, struct trace_probe, list); 637 tp = list_entry(probe_list.next, struct trace_probe, list);
635 unregister_trace_probe(tp); 638 ret = unregister_trace_probe(tp);
639 if (ret)
640 goto end;
636 free_trace_probe(tp); 641 free_trace_probe(tp);
637 } 642 }
638 643
@@ -1247,11 +1252,15 @@ static int register_probe_event(struct trace_probe *tp)
1247 return ret; 1252 return ret;
1248} 1253}
1249 1254
1250static void unregister_probe_event(struct trace_probe *tp) 1255static int unregister_probe_event(struct trace_probe *tp)
1251{ 1256{
1257 int ret;
1258
1252 /* tp->event is unregistered in trace_remove_event_call() */ 1259 /* tp->event is unregistered in trace_remove_event_call() */
1253 trace_remove_event_call(&tp->call); 1260 ret = trace_remove_event_call(&tp->call);
1254 kfree(tp->call.print_fmt); 1261 if (!ret)
1262 kfree(tp->call.print_fmt);
1263 return ret;
1255} 1264}
1256 1265
1257/* Make a debugfs interface for controlling probe points */ 1266/* Make a debugfs interface for controlling probe points */
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index a23d2d71188e..272261b5f94f 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -70,7 +70,7 @@ struct trace_uprobe {
70 (sizeof(struct probe_arg) * (n))) 70 (sizeof(struct probe_arg) * (n)))
71 71
72static int register_uprobe_event(struct trace_uprobe *tu); 72static int register_uprobe_event(struct trace_uprobe *tu);
73static void unregister_uprobe_event(struct trace_uprobe *tu); 73static int unregister_uprobe_event(struct trace_uprobe *tu);
74 74
75static DEFINE_MUTEX(uprobe_lock); 75static DEFINE_MUTEX(uprobe_lock);
76static LIST_HEAD(uprobe_list); 76static LIST_HEAD(uprobe_list);
@@ -164,11 +164,17 @@ static struct trace_uprobe *find_probe_event(const char *event, const char *grou
164} 164}
165 165
166/* Unregister a trace_uprobe and probe_event: call with locking uprobe_lock */ 166/* Unregister a trace_uprobe and probe_event: call with locking uprobe_lock */
167static void unregister_trace_uprobe(struct trace_uprobe *tu) 167static int unregister_trace_uprobe(struct trace_uprobe *tu)
168{ 168{
169 int ret;
170
171 ret = unregister_uprobe_event(tu);
172 if (ret)
173 return ret;
174
169 list_del(&tu->list); 175 list_del(&tu->list);
170 unregister_uprobe_event(tu);
171 free_trace_uprobe(tu); 176 free_trace_uprobe(tu);
177 return 0;
172} 178}
173 179
174/* Register a trace_uprobe and probe_event */ 180/* Register a trace_uprobe and probe_event */
@@ -181,9 +187,12 @@ static int register_trace_uprobe(struct trace_uprobe *tu)
181 187
182 /* register as an event */ 188 /* register as an event */
183 old_tp = find_probe_event(tu->call.name, tu->call.class->system); 189 old_tp = find_probe_event(tu->call.name, tu->call.class->system);
184 if (old_tp) 190 if (old_tp) {
185 /* delete old event */ 191 /* delete old event */
186 unregister_trace_uprobe(old_tp); 192 ret = unregister_trace_uprobe(old_tp);
193 if (ret)
194 goto end;
195 }
187 196
188 ret = register_uprobe_event(tu); 197 ret = register_uprobe_event(tu);
189 if (ret) { 198 if (ret) {
@@ -256,6 +265,8 @@ static int create_trace_uprobe(int argc, char **argv)
256 group = UPROBE_EVENT_SYSTEM; 265 group = UPROBE_EVENT_SYSTEM;
257 266
258 if (is_delete) { 267 if (is_delete) {
268 int ret;
269
259 if (!event) { 270 if (!event) {
260 pr_info("Delete command needs an event name.\n"); 271 pr_info("Delete command needs an event name.\n");
261 return -EINVAL; 272 return -EINVAL;
@@ -269,9 +280,9 @@ static int create_trace_uprobe(int argc, char **argv)
269 return -ENOENT; 280 return -ENOENT;
270 } 281 }
271 /* delete an event */ 282 /* delete an event */
272 unregister_trace_uprobe(tu); 283 ret = unregister_trace_uprobe(tu);
273 mutex_unlock(&uprobe_lock); 284 mutex_unlock(&uprobe_lock);
274 return 0; 285 return ret;
275 } 286 }
276 287
277 if (argc < 2) { 288 if (argc < 2) {
@@ -408,16 +419,20 @@ fail_address_parse:
408 return ret; 419 return ret;
409} 420}
410 421
411static void cleanup_all_probes(void) 422static int cleanup_all_probes(void)
412{ 423{
413 struct trace_uprobe *tu; 424 struct trace_uprobe *tu;
425 int ret = 0;
414 426
415 mutex_lock(&uprobe_lock); 427 mutex_lock(&uprobe_lock);
416 while (!list_empty(&uprobe_list)) { 428 while (!list_empty(&uprobe_list)) {
417 tu = list_entry(uprobe_list.next, struct trace_uprobe, list); 429 tu = list_entry(uprobe_list.next, struct trace_uprobe, list);
418 unregister_trace_uprobe(tu); 430 ret = unregister_trace_uprobe(tu);
431 if (ret)
432 break;
419 } 433 }
420 mutex_unlock(&uprobe_lock); 434 mutex_unlock(&uprobe_lock);
435 return ret;
421} 436}
422 437
423/* Probes listing interfaces */ 438/* Probes listing interfaces */
@@ -462,8 +477,13 @@ static const struct seq_operations probes_seq_op = {
462 477
463static int probes_open(struct inode *inode, struct file *file) 478static int probes_open(struct inode *inode, struct file *file)
464{ 479{
465 if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) 480 int ret;
466 cleanup_all_probes(); 481
482 if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) {
483 ret = cleanup_all_probes();
484 if (ret)
485 return ret;
486 }
467 487
468 return seq_open(file, &probes_seq_op); 488 return seq_open(file, &probes_seq_op);
469} 489}
@@ -968,12 +988,17 @@ static int register_uprobe_event(struct trace_uprobe *tu)
968 return ret; 988 return ret;
969} 989}
970 990
971static void unregister_uprobe_event(struct trace_uprobe *tu) 991static int unregister_uprobe_event(struct trace_uprobe *tu)
972{ 992{
993 int ret;
994
973 /* tu->event is unregistered in trace_remove_event_call() */ 995 /* tu->event is unregistered in trace_remove_event_call() */
974 trace_remove_event_call(&tu->call); 996 ret = trace_remove_event_call(&tu->call);
997 if (ret)
998 return ret;
975 kfree(tu->call.print_fmt); 999 kfree(tu->call.print_fmt);
976 tu->call.print_fmt = NULL; 1000 tu->call.print_fmt = NULL;
1001 return 0;
977} 1002}
978 1003
979/* Make a trace interface for controling probe points */ 1004/* Make a trace interface for controling probe points */
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index d8c30db06c5b..9064b919a406 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -62,6 +62,9 @@ int create_user_ns(struct cred *new)
62 kgid_t group = new->egid; 62 kgid_t group = new->egid;
63 int ret; 63 int ret;
64 64
65 if (parent_ns->level > 32)
66 return -EUSERS;
67
65 /* 68 /*
66 * Verify that we can not violate the policy of which files 69 * Verify that we can not violate the policy of which files
67 * may be accessed that is specified by the root directory, 70 * may be accessed that is specified by the root directory,
@@ -92,6 +95,7 @@ int create_user_ns(struct cred *new)
92 atomic_set(&ns->count, 1); 95 atomic_set(&ns->count, 1);
93 /* Leave the new->user_ns reference with the new user namespace. */ 96 /* Leave the new->user_ns reference with the new user namespace. */
94 ns->parent = parent_ns; 97 ns->parent = parent_ns;
98 ns->level = parent_ns->level + 1;
95 ns->owner = owner; 99 ns->owner = owner;
96 ns->group = group; 100 ns->group = group;
97 101
@@ -105,16 +109,21 @@ int create_user_ns(struct cred *new)
105int unshare_userns(unsigned long unshare_flags, struct cred **new_cred) 109int unshare_userns(unsigned long unshare_flags, struct cred **new_cred)
106{ 110{
107 struct cred *cred; 111 struct cred *cred;
112 int err = -ENOMEM;
108 113
109 if (!(unshare_flags & CLONE_NEWUSER)) 114 if (!(unshare_flags & CLONE_NEWUSER))
110 return 0; 115 return 0;
111 116
112 cred = prepare_creds(); 117 cred = prepare_creds();
113 if (!cred) 118 if (cred) {
114 return -ENOMEM; 119 err = create_user_ns(cred);
120 if (err)
121 put_cred(cred);
122 else
123 *new_cred = cred;
124 }
115 125
116 *new_cred = cred; 126 return err;
117 return create_user_ns(cred);
118} 127}
119 128
120void free_user_ns(struct user_namespace *ns) 129void free_user_ns(struct user_namespace *ns)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 0b72e816b8d0..7f5d4be22034 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2817,6 +2817,19 @@ already_gone:
2817 return false; 2817 return false;
2818} 2818}
2819 2819
2820static bool __flush_work(struct work_struct *work)
2821{
2822 struct wq_barrier barr;
2823
2824 if (start_flush_work(work, &barr)) {
2825 wait_for_completion(&barr.done);
2826 destroy_work_on_stack(&barr.work);
2827 return true;
2828 } else {
2829 return false;
2830 }
2831}
2832
2820/** 2833/**
2821 * flush_work - wait for a work to finish executing the last queueing instance 2834 * flush_work - wait for a work to finish executing the last queueing instance
2822 * @work: the work to flush 2835 * @work: the work to flush
@@ -2830,18 +2843,10 @@ already_gone:
2830 */ 2843 */
2831bool flush_work(struct work_struct *work) 2844bool flush_work(struct work_struct *work)
2832{ 2845{
2833 struct wq_barrier barr;
2834
2835 lock_map_acquire(&work->lockdep_map); 2846 lock_map_acquire(&work->lockdep_map);
2836 lock_map_release(&work->lockdep_map); 2847 lock_map_release(&work->lockdep_map);
2837 2848
2838 if (start_flush_work(work, &barr)) { 2849 return __flush_work(work);
2839 wait_for_completion(&barr.done);
2840 destroy_work_on_stack(&barr.work);
2841 return true;
2842 } else {
2843 return false;
2844 }
2845} 2850}
2846EXPORT_SYMBOL_GPL(flush_work); 2851EXPORT_SYMBOL_GPL(flush_work);
2847 2852
@@ -3411,6 +3416,12 @@ static void copy_workqueue_attrs(struct workqueue_attrs *to,
3411{ 3416{
3412 to->nice = from->nice; 3417 to->nice = from->nice;
3413 cpumask_copy(to->cpumask, from->cpumask); 3418 cpumask_copy(to->cpumask, from->cpumask);
3419 /*
3420 * Unlike hash and equality test, this function doesn't ignore
3421 * ->no_numa as it is used for both pool and wq attrs. Instead,
3422 * get_unbound_pool() explicitly clears ->no_numa after copying.
3423 */
3424 to->no_numa = from->no_numa;
3414} 3425}
3415 3426
3416/* hash value of the content of @attr */ 3427/* hash value of the content of @attr */
@@ -3578,6 +3589,12 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs)
3578 lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */ 3589 lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */
3579 copy_workqueue_attrs(pool->attrs, attrs); 3590 copy_workqueue_attrs(pool->attrs, attrs);
3580 3591
3592 /*
3593 * no_numa isn't a worker_pool attribute, always clear it. See
3594 * 'struct workqueue_attrs' comments for detail.
3595 */
3596 pool->attrs->no_numa = false;
3597
3581 /* if cpumask is contained inside a NUMA node, we belong to that node */ 3598 /* if cpumask is contained inside a NUMA node, we belong to that node */
3582 if (wq_numa_enabled) { 3599 if (wq_numa_enabled) {
3583 for_each_node(node) { 3600 for_each_node(node) {
@@ -4756,7 +4773,14 @@ long work_on_cpu(int cpu, long (*fn)(void *), void *arg)
4756 4773
4757 INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); 4774 INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn);
4758 schedule_work_on(cpu, &wfc.work); 4775 schedule_work_on(cpu, &wfc.work);
4759 flush_work(&wfc.work); 4776
4777 /*
4778 * The work item is on-stack and can't lead to deadlock through
4779 * flushing. Use __flush_work() to avoid spurious lockdep warnings
4780 * when work_on_cpu()s are nested.
4781 */
4782 __flush_work(&wfc.work);
4783
4760 return wfc.ret; 4784 return wfc.ret;
4761} 4785}
4762EXPORT_SYMBOL_GPL(work_on_cpu); 4786EXPORT_SYMBOL_GPL(work_on_cpu);
diff --git a/mm/slub.c b/mm/slub.c
index 2b02d666bf63..e3ba1f2cf60c 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1968,9 +1968,6 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
1968 int pages; 1968 int pages;
1969 int pobjects; 1969 int pobjects;
1970 1970
1971 if (!s->cpu_partial)
1972 return;
1973
1974 do { 1971 do {
1975 pages = 0; 1972 pages = 0;
1976 pobjects = 0; 1973 pobjects = 0;
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 74f6a704e374..ecbc4e3d83ad 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1660,6 +1660,10 @@ call_connect(struct rpc_task *task)
1660 task->tk_action = call_connect_status; 1660 task->tk_action = call_connect_status;
1661 if (task->tk_status < 0) 1661 if (task->tk_status < 0)
1662 return; 1662 return;
1663 if (task->tk_flags & RPC_TASK_NOCONNECT) {
1664 rpc_exit(task, -ENOTCONN);
1665 return;
1666 }
1663 xprt_connect(task); 1667 xprt_connect(task);
1664 } 1668 }
1665} 1669}
diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h
index 74d948f5d5a1..779742cfc1ff 100644
--- a/net/sunrpc/netns.h
+++ b/net/sunrpc/netns.h
@@ -23,6 +23,7 @@ struct sunrpc_net {
23 struct rpc_clnt *rpcb_local_clnt4; 23 struct rpc_clnt *rpcb_local_clnt4;
24 spinlock_t rpcb_clnt_lock; 24 spinlock_t rpcb_clnt_lock;
25 unsigned int rpcb_users; 25 unsigned int rpcb_users;
26 unsigned int rpcb_is_af_local : 1;
26 27
27 struct mutex gssp_lock; 28 struct mutex gssp_lock;
28 wait_queue_head_t gssp_wq; 29 wait_queue_head_t gssp_wq;
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 3df764dc330c..1891a1022c17 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -204,13 +204,15 @@ void rpcb_put_local(struct net *net)
204} 204}
205 205
206static void rpcb_set_local(struct net *net, struct rpc_clnt *clnt, 206static void rpcb_set_local(struct net *net, struct rpc_clnt *clnt,
207 struct rpc_clnt *clnt4) 207 struct rpc_clnt *clnt4,
208 bool is_af_local)
208{ 209{
209 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); 210 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
210 211
211 /* Protected by rpcb_create_local_mutex */ 212 /* Protected by rpcb_create_local_mutex */
212 sn->rpcb_local_clnt = clnt; 213 sn->rpcb_local_clnt = clnt;
213 sn->rpcb_local_clnt4 = clnt4; 214 sn->rpcb_local_clnt4 = clnt4;
215 sn->rpcb_is_af_local = is_af_local ? 1 : 0;
214 smp_wmb(); 216 smp_wmb();
215 sn->rpcb_users = 1; 217 sn->rpcb_users = 1;
216 dprintk("RPC: created new rpcb local clients (rpcb_local_clnt: " 218 dprintk("RPC: created new rpcb local clients (rpcb_local_clnt: "
@@ -238,6 +240,14 @@ static int rpcb_create_local_unix(struct net *net)
238 .program = &rpcb_program, 240 .program = &rpcb_program,
239 .version = RPCBVERS_2, 241 .version = RPCBVERS_2,
240 .authflavor = RPC_AUTH_NULL, 242 .authflavor = RPC_AUTH_NULL,
243 /*
244 * We turn off the idle timeout to prevent the kernel
245 * from automatically disconnecting the socket.
246 * Otherwise, we'd have to cache the mount namespace
247 * of the caller and somehow pass that to the socket
248 * reconnect code.
249 */
250 .flags = RPC_CLNT_CREATE_NO_IDLE_TIMEOUT,
241 }; 251 };
242 struct rpc_clnt *clnt, *clnt4; 252 struct rpc_clnt *clnt, *clnt4;
243 int result = 0; 253 int result = 0;
@@ -263,7 +273,7 @@ static int rpcb_create_local_unix(struct net *net)
263 clnt4 = NULL; 273 clnt4 = NULL;
264 } 274 }
265 275
266 rpcb_set_local(net, clnt, clnt4); 276 rpcb_set_local(net, clnt, clnt4, true);
267 277
268out: 278out:
269 return result; 279 return result;
@@ -315,7 +325,7 @@ static int rpcb_create_local_net(struct net *net)
315 clnt4 = NULL; 325 clnt4 = NULL;
316 } 326 }
317 327
318 rpcb_set_local(net, clnt, clnt4); 328 rpcb_set_local(net, clnt, clnt4, false);
319 329
320out: 330out:
321 return result; 331 return result;
@@ -376,13 +386,16 @@ static struct rpc_clnt *rpcb_create(struct net *net, const char *hostname,
376 return rpc_create(&args); 386 return rpc_create(&args);
377} 387}
378 388
379static int rpcb_register_call(struct rpc_clnt *clnt, struct rpc_message *msg) 389static int rpcb_register_call(struct sunrpc_net *sn, struct rpc_clnt *clnt, struct rpc_message *msg, bool is_set)
380{ 390{
381 int result, error = 0; 391 int flags = RPC_TASK_NOCONNECT;
392 int error, result = 0;
382 393
394 if (is_set || !sn->rpcb_is_af_local)
395 flags = RPC_TASK_SOFTCONN;
383 msg->rpc_resp = &result; 396 msg->rpc_resp = &result;
384 397
385 error = rpc_call_sync(clnt, msg, RPC_TASK_SOFTCONN); 398 error = rpc_call_sync(clnt, msg, flags);
386 if (error < 0) { 399 if (error < 0) {
387 dprintk("RPC: failed to contact local rpcbind " 400 dprintk("RPC: failed to contact local rpcbind "
388 "server (errno %d).\n", -error); 401 "server (errno %d).\n", -error);
@@ -439,16 +452,19 @@ int rpcb_register(struct net *net, u32 prog, u32 vers, int prot, unsigned short
439 .rpc_argp = &map, 452 .rpc_argp = &map,
440 }; 453 };
441 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); 454 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
455 bool is_set = false;
442 456
443 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " 457 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "
444 "rpcbind\n", (port ? "" : "un"), 458 "rpcbind\n", (port ? "" : "un"),
445 prog, vers, prot, port); 459 prog, vers, prot, port);
446 460
447 msg.rpc_proc = &rpcb_procedures2[RPCBPROC_UNSET]; 461 msg.rpc_proc = &rpcb_procedures2[RPCBPROC_UNSET];
448 if (port) 462 if (port != 0) {
449 msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET]; 463 msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET];
464 is_set = true;
465 }
450 466
451 return rpcb_register_call(sn->rpcb_local_clnt, &msg); 467 return rpcb_register_call(sn, sn->rpcb_local_clnt, &msg, is_set);
452} 468}
453 469
454/* 470/*
@@ -461,6 +477,7 @@ static int rpcb_register_inet4(struct sunrpc_net *sn,
461 const struct sockaddr_in *sin = (const struct sockaddr_in *)sap; 477 const struct sockaddr_in *sin = (const struct sockaddr_in *)sap;
462 struct rpcbind_args *map = msg->rpc_argp; 478 struct rpcbind_args *map = msg->rpc_argp;
463 unsigned short port = ntohs(sin->sin_port); 479 unsigned short port = ntohs(sin->sin_port);
480 bool is_set = false;
464 int result; 481 int result;
465 482
466 map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL); 483 map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL);
@@ -471,10 +488,12 @@ static int rpcb_register_inet4(struct sunrpc_net *sn,
471 map->r_addr, map->r_netid); 488 map->r_addr, map->r_netid);
472 489
473 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; 490 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET];
474 if (port) 491 if (port != 0) {
475 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; 492 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET];
493 is_set = true;
494 }
476 495
477 result = rpcb_register_call(sn->rpcb_local_clnt4, msg); 496 result = rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, is_set);
478 kfree(map->r_addr); 497 kfree(map->r_addr);
479 return result; 498 return result;
480} 499}
@@ -489,6 +508,7 @@ static int rpcb_register_inet6(struct sunrpc_net *sn,
489 const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sap; 508 const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sap;
490 struct rpcbind_args *map = msg->rpc_argp; 509 struct rpcbind_args *map = msg->rpc_argp;
491 unsigned short port = ntohs(sin6->sin6_port); 510 unsigned short port = ntohs(sin6->sin6_port);
511 bool is_set = false;
492 int result; 512 int result;
493 513
494 map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL); 514 map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL);
@@ -499,10 +519,12 @@ static int rpcb_register_inet6(struct sunrpc_net *sn,
499 map->r_addr, map->r_netid); 519 map->r_addr, map->r_netid);
500 520
501 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; 521 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET];
502 if (port) 522 if (port != 0) {
503 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; 523 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET];
524 is_set = true;
525 }
504 526
505 result = rpcb_register_call(sn->rpcb_local_clnt4, msg); 527 result = rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, is_set);
506 kfree(map->r_addr); 528 kfree(map->r_addr);
507 return result; 529 return result;
508} 530}
@@ -519,7 +541,7 @@ static int rpcb_unregister_all_protofamilies(struct sunrpc_net *sn,
519 map->r_addr = ""; 541 map->r_addr = "";
520 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; 542 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET];
521 543
522 return rpcb_register_call(sn->rpcb_local_clnt4, msg); 544 return rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, false);
523} 545}
524 546
525/** 547/**
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 3f7682a387b7..eefbd10e408f 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1998,12 +1998,11 @@ static void smk_ipv6_port_label(struct socket *sock, struct sockaddr *address)
1998 * 1998 *
1999 * Create or update the port list entry 1999 * Create or update the port list entry
2000 */ 2000 */
2001static int smk_ipv6_port_check(struct sock *sk, struct sockaddr *address, 2001static int smk_ipv6_port_check(struct sock *sk, struct sockaddr_in6 *address,
2002 int act) 2002 int act)
2003{ 2003{
2004 __be16 *bep; 2004 __be16 *bep;
2005 __be32 *be32p; 2005 __be32 *be32p;
2006 struct sockaddr_in6 *addr6;
2007 struct smk_port_label *spp; 2006 struct smk_port_label *spp;
2008 struct socket_smack *ssp = sk->sk_security; 2007 struct socket_smack *ssp = sk->sk_security;
2009 struct smack_known *skp; 2008 struct smack_known *skp;
@@ -2025,10 +2024,9 @@ static int smk_ipv6_port_check(struct sock *sk, struct sockaddr *address,
2025 /* 2024 /*
2026 * Get the IP address and port from the address. 2025 * Get the IP address and port from the address.
2027 */ 2026 */
2028 addr6 = (struct sockaddr_in6 *)address; 2027 port = ntohs(address->sin6_port);
2029 port = ntohs(addr6->sin6_port); 2028 bep = (__be16 *)(&address->sin6_addr);
2030 bep = (__be16 *)(&addr6->sin6_addr); 2029 be32p = (__be32 *)(&address->sin6_addr);
2031 be32p = (__be32 *)(&addr6->sin6_addr);
2032 2030
2033 /* 2031 /*
2034 * It's remote, so port lookup does no good. 2032 * It's remote, so port lookup does no good.
@@ -2060,9 +2058,9 @@ auditout:
2060 ad.a.u.net->family = sk->sk_family; 2058 ad.a.u.net->family = sk->sk_family;
2061 ad.a.u.net->dport = port; 2059 ad.a.u.net->dport = port;
2062 if (act == SMK_RECEIVING) 2060 if (act == SMK_RECEIVING)
2063 ad.a.u.net->v6info.saddr = addr6->sin6_addr; 2061 ad.a.u.net->v6info.saddr = address->sin6_addr;
2064 else 2062 else
2065 ad.a.u.net->v6info.daddr = addr6->sin6_addr; 2063 ad.a.u.net->v6info.daddr = address->sin6_addr;
2066#endif 2064#endif
2067 return smk_access(skp, object, MAY_WRITE, &ad); 2065 return smk_access(skp, object, MAY_WRITE, &ad);
2068} 2066}
@@ -2201,7 +2199,8 @@ static int smack_socket_connect(struct socket *sock, struct sockaddr *sap,
2201 case PF_INET6: 2199 case PF_INET6:
2202 if (addrlen < sizeof(struct sockaddr_in6)) 2200 if (addrlen < sizeof(struct sockaddr_in6))
2203 return -EINVAL; 2201 return -EINVAL;
2204 rc = smk_ipv6_port_check(sock->sk, sap, SMK_CONNECTING); 2202 rc = smk_ipv6_port_check(sock->sk, (struct sockaddr_in6 *)sap,
2203 SMK_CONNECTING);
2205 break; 2204 break;
2206 } 2205 }
2207 return rc; 2206 return rc;
@@ -3034,7 +3033,7 @@ static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg,
3034 int size) 3033 int size)
3035{ 3034{
3036 struct sockaddr_in *sip = (struct sockaddr_in *) msg->msg_name; 3035 struct sockaddr_in *sip = (struct sockaddr_in *) msg->msg_name;
3037 struct sockaddr *sap = (struct sockaddr *) msg->msg_name; 3036 struct sockaddr_in6 *sap = (struct sockaddr_in6 *) msg->msg_name;
3038 int rc = 0; 3037 int rc = 0;
3039 3038
3040 /* 3039 /*
@@ -3121,9 +3120,8 @@ static struct smack_known *smack_from_secattr(struct netlbl_lsm_secattr *sap,
3121 return smack_net_ambient; 3120 return smack_net_ambient;
3122} 3121}
3123 3122
3124static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr *sap) 3123static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr_in6 *sip)
3125{ 3124{
3126 struct sockaddr_in6 *sip = (struct sockaddr_in6 *)sap;
3127 u8 nexthdr; 3125 u8 nexthdr;
3128 int offset; 3126 int offset;
3129 int proto = -EINVAL; 3127 int proto = -EINVAL;
@@ -3181,7 +3179,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
3181 struct netlbl_lsm_secattr secattr; 3179 struct netlbl_lsm_secattr secattr;
3182 struct socket_smack *ssp = sk->sk_security; 3180 struct socket_smack *ssp = sk->sk_security;
3183 struct smack_known *skp; 3181 struct smack_known *skp;
3184 struct sockaddr sadd; 3182 struct sockaddr_in6 sadd;
3185 int rc = 0; 3183 int rc = 0;
3186 struct smk_audit_info ad; 3184 struct smk_audit_info ad;
3187#ifdef CONFIG_AUDIT 3185#ifdef CONFIG_AUDIT
diff --git a/sound/usb/6fire/comm.c b/sound/usb/6fire/comm.c
index 9e6e3ffd86bb..23452ee617e1 100644
--- a/sound/usb/6fire/comm.c
+++ b/sound/usb/6fire/comm.c
@@ -110,19 +110,37 @@ static int usb6fire_comm_send_buffer(u8 *buffer, struct usb_device *dev)
110static int usb6fire_comm_write8(struct comm_runtime *rt, u8 request, 110static int usb6fire_comm_write8(struct comm_runtime *rt, u8 request,
111 u8 reg, u8 value) 111 u8 reg, u8 value)
112{ 112{
113 u8 buffer[13]; /* 13: maximum length of message */ 113 u8 *buffer;
114 int ret;
115
116 /* 13: maximum length of message */
117 buffer = kmalloc(13, GFP_KERNEL);
118 if (!buffer)
119 return -ENOMEM;
114 120
115 usb6fire_comm_init_buffer(buffer, 0x00, request, reg, value, 0x00); 121 usb6fire_comm_init_buffer(buffer, 0x00, request, reg, value, 0x00);
116 return usb6fire_comm_send_buffer(buffer, rt->chip->dev); 122 ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev);
123
124 kfree(buffer);
125 return ret;
117} 126}
118 127
119static int usb6fire_comm_write16(struct comm_runtime *rt, u8 request, 128static int usb6fire_comm_write16(struct comm_runtime *rt, u8 request,
120 u8 reg, u8 vl, u8 vh) 129 u8 reg, u8 vl, u8 vh)
121{ 130{
122 u8 buffer[13]; /* 13: maximum length of message */ 131 u8 *buffer;
132 int ret;
133
134 /* 13: maximum length of message */
135 buffer = kmalloc(13, GFP_KERNEL);
136 if (!buffer)
137 return -ENOMEM;
123 138
124 usb6fire_comm_init_buffer(buffer, 0x00, request, reg, vl, vh); 139 usb6fire_comm_init_buffer(buffer, 0x00, request, reg, vl, vh);
125 return usb6fire_comm_send_buffer(buffer, rt->chip->dev); 140 ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev);
141
142 kfree(buffer);
143 return ret;
126} 144}
127 145
128int usb6fire_comm_init(struct sfire_chip *chip) 146int usb6fire_comm_init(struct sfire_chip *chip)
@@ -135,6 +153,12 @@ int usb6fire_comm_init(struct sfire_chip *chip)
135 if (!rt) 153 if (!rt)
136 return -ENOMEM; 154 return -ENOMEM;
137 155
156 rt->receiver_buffer = kzalloc(COMM_RECEIVER_BUFSIZE, GFP_KERNEL);
157 if (!rt->receiver_buffer) {
158 kfree(rt);
159 return -ENOMEM;
160 }
161
138 urb = &rt->receiver; 162 urb = &rt->receiver;
139 rt->serial = 1; 163 rt->serial = 1;
140 rt->chip = chip; 164 rt->chip = chip;
@@ -153,6 +177,7 @@ int usb6fire_comm_init(struct sfire_chip *chip)
153 urb->interval = 1; 177 urb->interval = 1;
154 ret = usb_submit_urb(urb, GFP_KERNEL); 178 ret = usb_submit_urb(urb, GFP_KERNEL);
155 if (ret < 0) { 179 if (ret < 0) {
180 kfree(rt->receiver_buffer);
156 kfree(rt); 181 kfree(rt);
157 snd_printk(KERN_ERR PREFIX "cannot create comm data receiver."); 182 snd_printk(KERN_ERR PREFIX "cannot create comm data receiver.");
158 return ret; 183 return ret;
@@ -171,6 +196,9 @@ void usb6fire_comm_abort(struct sfire_chip *chip)
171 196
172void usb6fire_comm_destroy(struct sfire_chip *chip) 197void usb6fire_comm_destroy(struct sfire_chip *chip)
173{ 198{
174 kfree(chip->comm); 199 struct comm_runtime *rt = chip->comm;
200
201 kfree(rt->receiver_buffer);
202 kfree(rt);
175 chip->comm = NULL; 203 chip->comm = NULL;
176} 204}
diff --git a/sound/usb/6fire/comm.h b/sound/usb/6fire/comm.h
index 6a0840b0dcff..780d5ed8e5d8 100644
--- a/sound/usb/6fire/comm.h
+++ b/sound/usb/6fire/comm.h
@@ -24,7 +24,7 @@ struct comm_runtime {
24 struct sfire_chip *chip; 24 struct sfire_chip *chip;
25 25
26 struct urb receiver; 26 struct urb receiver;
27 u8 receiver_buffer[COMM_RECEIVER_BUFSIZE]; 27 u8 *receiver_buffer;
28 28
29 u8 serial; /* urb serial */ 29 u8 serial; /* urb serial */
30 30
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 7a444b5501d9..659950e5b94f 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -591,17 +591,16 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep,
591 ep->stride = frame_bits >> 3; 591 ep->stride = frame_bits >> 3;
592 ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; 592 ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0;
593 593
594 /* calculate max. frequency */ 594 /* assume max. frequency is 25% higher than nominal */
595 if (ep->maxpacksize) { 595 ep->freqmax = ep->freqn + (ep->freqn >> 2);
596 maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3))
597 >> (16 - ep->datainterval);
598 /* but wMaxPacketSize might reduce this */
599 if (ep->maxpacksize && ep->maxpacksize < maxsize) {
596 /* whatever fits into a max. size packet */ 600 /* whatever fits into a max. size packet */
597 maxsize = ep->maxpacksize; 601 maxsize = ep->maxpacksize;
598 ep->freqmax = (maxsize / (frame_bits >> 3)) 602 ep->freqmax = (maxsize / (frame_bits >> 3))
599 << (16 - ep->datainterval); 603 << (16 - ep->datainterval);
600 } else {
601 /* no max. packet size: just take 25% higher than nominal */
602 ep->freqmax = ep->freqn + (ep->freqn >> 2);
603 maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3))
604 >> (16 - ep->datainterval);
605 } 604 }
606 605
607 if (ep->fill_max) 606 if (ep->fill_max)