aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/Changes43
-rw-r--r--Documentation/CodingStyle4
-rw-r--r--Documentation/cgroups/blkio-controller.txt12
-rw-r--r--Documentation/feature-removal-schedule.txt22
-rw-r--r--Documentation/filesystems/caching/netfs-api.txt16
-rw-r--r--Documentation/kernel-parameters.txt2
-rw-r--r--Documentation/laptops/thinkpad-acpi.txt5
-rw-r--r--Documentation/spinlocks.txt45
-rw-r--r--MAINTAINERS15
-rw-r--r--Makefile2
-rw-r--r--arch/arm/Kconfig8
-rw-r--r--arch/arm/common/dmabounce.c2
-rw-r--r--arch/arm/kernel/perf_event.c6
-rw-r--r--arch/arm/kernel/setup.c2
-rw-r--r--arch/arm/kernel/smp_twd.c2
-rw-r--r--arch/arm/mach-ep93xx/core.c4
-rw-r--r--arch/arm/mach-exynos4/Kconfig4
-rw-r--r--arch/arm/mach-exynos4/clock.c177
-rw-r--r--arch/arm/mach-exynos4/cpu.c6
-rw-r--r--arch/arm/mach-exynos4/dev-audio.c2
-rw-r--r--arch/arm/mach-exynos4/headsmp.S2
-rw-r--r--arch/arm/mach-exynos4/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-exynos4/mach-smdkc210.c16
-rw-r--r--arch/arm/mach-exynos4/mach-smdkv310.c24
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c8
-rw-r--r--arch/arm/mach-omap1/gpio15xx.c4
-rw-r--r--arch/arm/mach-omap1/gpio16xx.c10
-rw-r--r--arch/arm/mach-omap1/gpio7xx.c14
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c2
-rw-r--r--arch/arm/mach-s3c2412/clock.c36
-rw-r--r--arch/arm/mach-s3c2416/clock.c10
-rw-r--r--arch/arm/mach-s3c2440/clock.c3
-rw-r--r--arch/arm/mach-s3c2440/mach-mini2440.c2
-rw-r--r--arch/arm/mach-s3c2443/clock.c16
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig1
-rw-r--r--arch/arm/mach-s3c64xx/clock.c86
-rw-r--r--arch/arm/mach-s3c64xx/dev-onenand1.c10
-rw-r--r--arch/arm/mach-s3c64xx/dev-spi.c2
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/regs-fb.h21
-rw-r--r--arch/arm/mach-s3c64xx/mach-anw6410.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-hmt.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-mini6410.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-ncp.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-real6410.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq5.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq7.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c43
-rw-r--r--arch/arm/mach-s3c64xx/setup-fb-24bpp.c1
-rw-r--r--arch/arm/mach-s5p64x0/Kconfig2
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6440.c74
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6450.c68
-rw-r--r--arch/arm/mach-s5p64x0/dev-spi.c4
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6440.c54
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6450.c54
-rw-r--r--arch/arm/mach-s5pc100/Kconfig1
-rw-r--r--arch/arm/mach-s5pc100/clock.c200
-rw-r--r--arch/arm/mach-s5pc100/dev-spi.c4
-rw-r--r--arch/arm/mach-s5pc100/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-fb.h105
-rw-r--r--arch/arm/mach-s5pc100/mach-smdkc100.c57
-rw-r--r--arch/arm/mach-s5pc100/setup-fb-24bpp.c1
-rw-r--r--arch/arm/mach-s5pv210/Kconfig1
-rw-r--r--arch/arm/mach-s5pv210/clock.c167
-rw-r--r--arch/arm/mach-s5pv210/dev-spi.c2
-rw-r--r--arch/arm/mach-s5pv210/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-fb.h21
-rw-r--r--arch/arm/mach-s5pv210/mach-aquila.c2
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c2
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c56
-rw-r--r--arch/arm/mach-s5pv210/setup-fb-24bpp.c1
-rw-r--r--arch/arm/mach-vt8500/irq.c21
-rw-r--r--arch/arm/mm/cache-l2x0.c19
-rw-r--r--arch/arm/mm/mmu.c5
-rw-r--r--arch/arm/mm/nommu.c4
-rw-r--r--arch/arm/plat-s3c24xx/clock-dclk.c4
-rw-r--r--arch/arm/plat-s3c24xx/devs.c38
-rw-r--r--arch/arm/plat-s3c24xx/dma.c12
-rw-r--r--arch/arm/plat-s3c24xx/include/mach/clkdev.h7
-rw-r--r--arch/arm/plat-s3c24xx/s3c2410-clock.c21
-rw-r--r--arch/arm/plat-s3c24xx/s3c2443-clock.c39
-rw-r--r--arch/arm/plat-s5p/clock.c35
-rw-r--r--arch/arm/plat-s5p/include/plat/s5p-clock.h5
-rw-r--r--arch/arm/plat-s5p/s5p-time.c33
-rw-r--r--arch/arm/plat-samsung/Kconfig6
-rw-r--r--arch/arm/plat-samsung/Makefile1
-rw-r--r--arch/arm/plat-samsung/clock.c98
-rw-r--r--arch/arm/plat-samsung/dev-backlight.c149
-rw-r--r--arch/arm/plat-samsung/dev-fb.c14
-rw-r--r--arch/arm/plat-samsung/dev-hwmon.c14
-rw-r--r--arch/arm/plat-samsung/dev-i2c0.c14
-rw-r--r--arch/arm/plat-samsung/dev-i2c1.c24
-rw-r--r--arch/arm/plat-samsung/dev-i2c2.c24
-rw-r--r--arch/arm/plat-samsung/dev-i2c3.c24
-rw-r--r--arch/arm/plat-samsung/dev-i2c4.c24
-rw-r--r--arch/arm/plat-samsung/dev-i2c5.c24
-rw-r--r--arch/arm/plat-samsung/dev-i2c6.c24
-rw-r--r--arch/arm/plat-samsung/dev-i2c7.c24
-rw-r--r--arch/arm/plat-samsung/dev-nand.c9
-rw-r--r--arch/arm/plat-samsung/dev-ts.c14
-rw-r--r--arch/arm/plat-samsung/dev-usb.c9
-rw-r--r--arch/arm/plat-samsung/include/plat/backlight.h26
-rw-r--r--arch/arm/plat-samsung/include/plat/clock.h3
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h6
-rw-r--r--arch/arm/plat-samsung/include/plat/iic.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c64xx-spi.h2
-rw-r--r--arch/arm/plat-samsung/pwm-clock.c10
-rw-r--r--arch/arm/plat-samsung/time.c2
-rw-r--r--arch/x86/include/asm/mmzone_32.h2
-rw-r--r--arch/x86/kernel/acpi/realmode/wakeup.S14
-rw-r--r--arch/x86/kernel/acpi/realmode/wakeup.h6
-rw-r--r--arch/x86/kernel/acpi/sleep.c6
-rw-r--r--arch/x86/kernel/reboot.c8
-rw-r--r--arch/x86/oprofile/nmi_int.c14
-rw-r--r--arch/x86/pci/xen.c56
-rw-r--r--arch/x86/platform/efi/efi.c3
-rw-r--r--block/cfq-iosched.c8
-rw-r--r--drivers/base/syscore.c8
-rw-r--r--drivers/block/drbd/drbd_actlog.c2
-rw-r--r--drivers/block/drbd/drbd_bitmap.c37
-rw-r--r--drivers/block/drbd/drbd_receiver.c6
-rw-r--r--drivers/block/drbd/drbd_worker.c7
-rw-r--r--drivers/cpufreq/acpi-cpufreq.c2
-rw-r--r--drivers/firewire/ohci.c6
-rw-r--r--drivers/gpio/langwell_gpio.c2
-rw-r--r--drivers/gpio/tps65910-gpio.c2
-rw-r--r--drivers/gpu/drm/drm_crtc.c3
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c160
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h4
-rw-r--r--drivers/gpu/drm/radeon/ni.c1
-rw-r--r--drivers/gpu/drm/radeon/r600.c1
-rw-r--r--drivers/gpu/drm/radeon/r600d.h2
-rw-r--r--drivers/gpu/drm/radeon/rv770.c1
-rw-r--r--drivers/hwmon/lm95241.c22
-rw-r--r--drivers/hwmon/pmbus.c11
-rw-r--r--drivers/i2c/busses/i2c-bfin-twi.c8
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c7
-rw-r--r--drivers/i2c/busses/i2c-tegra.c8
-rw-r--r--drivers/input/keyboard/pmic8xxx-keypad.c3
-rw-r--r--drivers/input/misc/pmic8xxx-pwrkey.c3
-rw-r--r--drivers/leds/leds-pca9532.c2
-rw-r--r--drivers/media/rc/fintek-cir.c5
-rw-r--r--drivers/media/rc/imon.c19
-rw-r--r--drivers/media/rc/ir-raw.c4
-rw-r--r--drivers/media/rc/ite-cir.c12
-rw-r--r--drivers/media/rc/ite-cir.h3
-rw-r--r--drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c58
-rw-r--r--drivers/media/rc/lirc_dev.c37
-rw-r--r--drivers/media/rc/mceusb.c80
-rw-r--r--drivers/media/rc/nuvoton-cir.c2
-rw-r--r--drivers/media/rc/nuvoton-cir.h1
-rw-r--r--drivers/media/rc/rc-main.c48
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c2
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c8
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c8
-rw-r--r--drivers/media/video/m5mols/m5mols.h57
-rw-r--r--drivers/media/video/m5mols/m5mols_capture.c22
-rw-r--r--drivers/media/video/m5mols/m5mols_controls.c6
-rw-r--r--drivers/media/video/m5mols/m5mols_core.c144
-rw-r--r--drivers/media/video/m5mols/m5mols_reg.h21
-rw-r--r--drivers/media/video/msp3400-driver.c12
-rw-r--r--drivers/media/video/mx1_camera.c10
-rw-r--r--drivers/media/video/omap/omap_vout.c18
-rw-r--r--drivers/media/video/omap/omap_voutlib.c6
-rw-r--r--drivers/media/video/omap3isp/isp.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c4
-rw-r--r--drivers/media/video/pwc/pwc-ctrl.c2
-rw-r--r--drivers/media/video/pwc/pwc-if.c152
-rw-r--r--drivers/media/video/pwc/pwc.h4
-rw-r--r--drivers/media/video/s5p-fimc/fimc-capture.c21
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.c28
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.h29
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c2
-rw-r--r--drivers/media/video/tuner-core.c229
-rw-r--r--drivers/media/video/uvc/uvc_entity.c34
-rw-r--r--drivers/media/video/uvc/uvc_queue.c2
-rw-r--r--drivers/media/video/uvc/uvc_video.c4
-rw-r--r--drivers/media/video/v4l2-dev.c39
-rw-r--r--drivers/media/video/v4l2-ioctl.c18
-rw-r--r--drivers/media/video/videobuf2-core.c14
-rw-r--r--drivers/media/video/videobuf2-dma-sg.c2
-rw-r--r--drivers/mfd/Kconfig3
-rw-r--r--drivers/mfd/Makefile1
-rw-r--r--drivers/mfd/asic3.c1
-rw-r--r--drivers/mfd/htc-pasic3.c1
-rw-r--r--drivers/mfd/omap-usb-host.c131
-rw-r--r--drivers/mfd/tps65911-comparator.c2
-rw-r--r--drivers/mmc/host/mmci.c2
-rw-r--r--drivers/mmc/host/mmci.h5
-rw-r--r--drivers/net/8139too.c1
-rw-r--r--drivers/net/bna/bnad.c7
-rw-r--r--drivers/net/greth.c7
-rw-r--r--drivers/net/hamradio/6pack.c4
-rw-r--r--drivers/net/hamradio/mkiss.c4
-rw-r--r--drivers/net/natsemi.c3
-rw-r--r--drivers/net/qlge/qlge.h3
-rw-r--r--drivers/net/qlge/qlge_main.c40
-rw-r--r--drivers/net/sh_eth.c6
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c138
-rw-r--r--drivers/net/vmxnet3/vmxnet3_int.h5
-rw-r--r--drivers/net/wireless/ath/ath5k/desc.c3
-rw-r--r--drivers/net/wireless/ath/ath5k/eeprom.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-2000.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c25
-rw-r--r--drivers/pci/pci.c2
-rw-r--r--drivers/pci/pci.h2
-rw-r--r--drivers/pci/setup-bus.c15
-rw-r--r--drivers/platform/x86/acer-wmi.c47
-rw-r--r--drivers/platform/x86/asus-wmi.c1
-rw-r--r--drivers/platform/x86/compal-laptop.c4
-rw-r--r--drivers/platform/x86/dell-laptop.c30
-rw-r--r--drivers/platform/x86/hp-wmi.c11
-rw-r--r--drivers/platform/x86/intel_oaktrail.c1
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c72
-rw-r--r--drivers/regulator/db8500-prcmu.c14
-rw-r--r--drivers/regulator/max8952.c2
-rw-r--r--drivers/regulator/max8997.c55
-rw-r--r--drivers/spi/spi_s3c64xx.c4
-rw-r--r--drivers/staging/lirc/lirc_imon.c10
-rw-r--r--drivers/staging/lirc/lirc_serial.c44
-rw-r--r--drivers/staging/lirc/lirc_sir.c11
-rw-r--r--drivers/staging/lirc/lirc_zilog.c4
-rw-r--r--drivers/tty/serial/s3c2410.c2
-rw-r--r--drivers/tty/serial/s3c2412.c2
-rw-r--r--drivers/tty/serial/s3c2440.c2
-rw-r--r--drivers/tty/serial/s3c6400.c2
-rw-r--r--drivers/tty/serial/s5pv210.c7
-rw-r--r--drivers/tty/serial/samsung.c9
-rw-r--r--drivers/tty/serial/samsung.h19
-rw-r--r--drivers/usb/core/message.c11
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c36
-rw-r--r--drivers/w1/masters/ds1wm.c5
-rw-r--r--fs/binfmt_elf_fdpic.c1
-rw-r--r--fs/btrfs/ctree.h5
-rw-r--r--fs/btrfs/inode.c12
-rw-r--r--fs/btrfs/super.c6
-rw-r--r--fs/btrfs/volumes.c3
-rw-r--r--fs/ceph/file.c14
-rw-r--r--fs/cifs/cifsfs.c8
-rw-r--r--fs/cifs/cifsproto.h6
-rw-r--r--fs/cifs/connect.c116
-rw-r--r--fs/cifs/fscache.c1
-rw-r--r--fs/fscache/page.c44
-rw-r--r--fs/hfsplus/super.c2
-rw-r--r--fs/hfsplus/wrapper.c7
-rw-r--r--fs/locks.c30
-rw-r--r--fs/nfs/fscache.c8
-rw-r--r--fs/xfs/xfs_inode_item.c14
-rw-r--r--fs/xfs/xfs_trans.c4
-rw-r--r--include/linux/drbd_limits.h4
-rw-r--r--include/linux/fscache.h21
-rw-r--r--include/linux/mfd/ds1wm.h7
-rw-r--r--include/linux/sched.h2
-rw-r--r--include/media/lirc_dev.h2
-rw-r--r--include/media/m5mols.h4
-rw-r--r--include/media/v4l2-subdev.h10
-rw-r--r--include/net/cfg80211.h2
-rw-r--r--include/net/dst.h1
-rw-r--r--kernel/jump_label.c14
-rw-r--r--kernel/power/snapshot.c6
-rw-r--r--kernel/resource.c116
-rw-r--r--kernel/sched.c9
-rw-r--r--lib/debugobjects.c2
-rw-r--r--mm/memcontrol.c140
-rw-r--r--mm/memory.c1
-rw-r--r--mm/nommu.c9
-rw-r--r--mm/vmscan.c59
-rw-r--r--net/8021q/vlan_dev.c5
-rw-r--r--net/bridge/br_device.c4
-rw-r--r--net/bridge/br_input.c6
-rw-r--r--net/ceph/osd_client.c10
-rw-r--r--net/core/dst.c6
-rw-r--r--net/ipv4/af_inet.c4
-rw-r--r--net/ipv4/ip_output.c2
-rw-r--r--net/ipv4/tcp.c10
-rw-r--r--net/ipv4/udp.c10
-rw-r--r--net/ipv4/xfrm4_output.c7
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/ipv6/route.c25
-rw-r--r--net/mac80211/wpa.c8
-rw-r--r--net/sctp/protocol.c11
-rw-r--r--net/sctp/socket.c23
-rw-r--r--net/wireless/nl80211.c3
-rw-r--r--net/xfrm/xfrm_policy.c6
-rw-r--r--sound/pci/hda/patch_realtek.c33
-rw-r--r--sound/soc/blackfin/bf5xx-i2s-pcm.c13
-rw-r--r--sound/soc/codecs/ak4642.c2
-rw-r--r--sound/soc/codecs/tlv320aic26.c14
-rw-r--r--sound/soc/codecs/tlv320aic3x.c9
-rw-r--r--sound/soc/codecs/wm8731.c29
-rw-r--r--sound/soc/codecs/wm8994.c2
-rw-r--r--sound/soc/soc-core.c5
-rw-r--r--sound/soc/tegra/tegra_i2s.c6
299 files changed, 2969 insertions, 2834 deletions
diff --git a/Documentation/Changes b/Documentation/Changes
index 5f4828a034e3..b17580885273 100644
--- a/Documentation/Changes
+++ b/Documentation/Changes
@@ -2,13 +2,7 @@ Intro
2===== 2=====
3 3
4This document is designed to provide a list of the minimum levels of 4This document is designed to provide a list of the minimum levels of
5software necessary to run the 2.6 kernels, as well as provide brief 5software necessary to run the 3.0 kernels.
6instructions regarding any other "Gotchas" users may encounter when
7trying life on the Bleeding Edge. If upgrading from a pre-2.4.x
8kernel, please consult the Changes file included with 2.4.x kernels for
9additional information; most of that information will not be repeated
10here. Basically, this document assumes that your system is already
11functional and running at least 2.4.x kernels.
12 6
13This document is originally based on my "Changes" file for 2.0.x kernels 7This document is originally based on my "Changes" file for 2.0.x kernels
14and therefore owes credit to the same people as that file (Jared Mauch, 8and therefore owes credit to the same people as that file (Jared Mauch,
@@ -22,11 +16,10 @@ Upgrade to at *least* these software revisions before thinking you've
22encountered a bug! If you're unsure what version you're currently 16encountered a bug! If you're unsure what version you're currently
23running, the suggested command should tell you. 17running, the suggested command should tell you.
24 18
25Again, keep in mind that this list assumes you are already 19Again, keep in mind that this list assumes you are already functionally
26functionally running a Linux 2.4 kernel. Also, not all tools are 20running a Linux kernel. Also, not all tools are necessary on all
27necessary on all systems; obviously, if you don't have any ISDN 21systems; obviously, if you don't have any ISDN hardware, for example,
28hardware, for example, you probably needn't concern yourself with 22you probably needn't concern yourself with isdn4k-utils.
29isdn4k-utils.
30 23
31o Gnu C 3.2 # gcc --version 24o Gnu C 3.2 # gcc --version
32o Gnu make 3.80 # make --version 25o Gnu make 3.80 # make --version
@@ -114,12 +107,12 @@ Ksymoops
114 107
115If the unthinkable happens and your kernel oopses, you may need the 108If the unthinkable happens and your kernel oopses, you may need the
116ksymoops tool to decode it, but in most cases you don't. 109ksymoops tool to decode it, but in most cases you don't.
117In the 2.6 kernel it is generally preferred to build the kernel with 110It is generally preferred to build the kernel with CONFIG_KALLSYMS so
118CONFIG_KALLSYMS so that it produces readable dumps that can be used as-is 111that it produces readable dumps that can be used as-is (this also
119(this also produces better output than ksymoops). 112produces better output than ksymoops). If for some reason your kernel
120If for some reason your kernel is not build with CONFIG_KALLSYMS and 113is not build with CONFIG_KALLSYMS and you have no way to rebuild and
121you have no way to rebuild and reproduce the Oops with that option, then 114reproduce the Oops with that option, then you can still decode that Oops
122you can still decode that Oops with ksymoops. 115with ksymoops.
123 116
124Module-Init-Tools 117Module-Init-Tools
125----------------- 118-----------------
@@ -261,8 +254,8 @@ needs to be recompiled or (preferably) upgraded.
261NFS-utils 254NFS-utils
262--------- 255---------
263 256
264In 2.4 and earlier kernels, the nfs server needed to know about any 257In ancient (2.4 and earlier) kernels, the nfs server needed to know
265client that expected to be able to access files via NFS. This 258about any client that expected to be able to access files via NFS. This
266information would be given to the kernel by "mountd" when the client 259information would be given to the kernel by "mountd" when the client
267mounted the filesystem, or by "exportfs" at system startup. exportfs 260mounted the filesystem, or by "exportfs" at system startup. exportfs
268would take information about active clients from /var/lib/nfs/rmtab. 261would take information about active clients from /var/lib/nfs/rmtab.
@@ -272,11 +265,11 @@ which is not always easy, particularly when trying to implement
272fail-over. Even when the system is working well, rmtab suffers from 265fail-over. Even when the system is working well, rmtab suffers from
273getting lots of old entries that never get removed. 266getting lots of old entries that never get removed.
274 267
275With 2.6 we have the option of having the kernel tell mountd when it 268With modern kernels we have the option of having the kernel tell mountd
276gets a request from an unknown host, and mountd can give appropriate 269when it gets a request from an unknown host, and mountd can give
277export information to the kernel. This removes the dependency on 270appropriate export information to the kernel. This removes the
278rmtab and means that the kernel only needs to know about currently 271dependency on rmtab and means that the kernel only needs to know about
279active clients. 272currently active clients.
280 273
281To enable this new functionality, you need to: 274To enable this new functionality, you need to:
282 275
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 58b0bf917834..fa6e25b94a54 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -680,8 +680,8 @@ ones already enabled by DEBUG.
680 Chapter 14: Allocating memory 680 Chapter 14: Allocating memory
681 681
682The kernel provides the following general purpose memory allocators: 682The kernel provides the following general purpose memory allocators:
683kmalloc(), kzalloc(), kcalloc(), and vmalloc(). Please refer to the API 683kmalloc(), kzalloc(), kcalloc(), vmalloc(), and vzalloc(). Please refer to
684documentation for further information about them. 684the API documentation for further information about them.
685 685
686The preferred form for passing a size of a struct is the following: 686The preferred form for passing a size of a struct is the following:
687 687
diff --git a/Documentation/cgroups/blkio-controller.txt b/Documentation/cgroups/blkio-controller.txt
index cd45c8ea7463..84f0a15fc210 100644
--- a/Documentation/cgroups/blkio-controller.txt
+++ b/Documentation/cgroups/blkio-controller.txt
@@ -77,7 +77,7 @@ Throttling/Upper Limit policy
77- Specify a bandwidth rate on particular device for root group. The format 77- Specify a bandwidth rate on particular device for root group. The format
78 for policy is "<major>:<minor> <byes_per_second>". 78 for policy is "<major>:<minor> <byes_per_second>".
79 79
80 echo "8:16 1048576" > /sys/fs/cgroup/blkio/blkio.read_bps_device 80 echo "8:16 1048576" > /sys/fs/cgroup/blkio/blkio.throttle.read_bps_device
81 81
82 Above will put a limit of 1MB/second on reads happening for root group 82 Above will put a limit of 1MB/second on reads happening for root group
83 on device having major/minor number 8:16. 83 on device having major/minor number 8:16.
@@ -90,7 +90,7 @@ Throttling/Upper Limit policy
90 1024+0 records out 90 1024+0 records out
91 4194304 bytes (4.2 MB) copied, 4.0001 s, 1.0 MB/s 91 4194304 bytes (4.2 MB) copied, 4.0001 s, 1.0 MB/s
92 92
93 Limits for writes can be put using blkio.write_bps_device file. 93 Limits for writes can be put using blkio.throttle.write_bps_device file.
94 94
95Hierarchical Cgroups 95Hierarchical Cgroups
96==================== 96====================
@@ -286,28 +286,28 @@ Throttling/Upper limit policy files
286 specified in bytes per second. Rules are per deivce. Following is 286 specified in bytes per second. Rules are per deivce. Following is
287 the format. 287 the format.
288 288
289 echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.read_bps_device 289 echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.throttle.read_bps_device
290 290
291- blkio.throttle.write_bps_device 291- blkio.throttle.write_bps_device
292 - Specifies upper limit on WRITE rate to the device. IO rate is 292 - Specifies upper limit on WRITE rate to the device. IO rate is
293 specified in bytes per second. Rules are per deivce. Following is 293 specified in bytes per second. Rules are per deivce. Following is
294 the format. 294 the format.
295 295
296 echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.write_bps_device 296 echo "<major>:<minor> <rate_bytes_per_second>" > /cgrp/blkio.throttle.write_bps_device
297 297
298- blkio.throttle.read_iops_device 298- blkio.throttle.read_iops_device
299 - Specifies upper limit on READ rate from the device. IO rate is 299 - Specifies upper limit on READ rate from the device. IO rate is
300 specified in IO per second. Rules are per deivce. Following is 300 specified in IO per second. Rules are per deivce. Following is
301 the format. 301 the format.
302 302
303 echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.read_iops_device 303 echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.throttle.read_iops_device
304 304
305- blkio.throttle.write_iops_device 305- blkio.throttle.write_iops_device
306 - Specifies upper limit on WRITE rate to the device. IO rate is 306 - Specifies upper limit on WRITE rate to the device. IO rate is
307 specified in io per second. Rules are per deivce. Following is 307 specified in io per second. Rules are per deivce. Following is
308 the format. 308 the format.
309 309
310 echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.write_iops_device 310 echo "<major>:<minor> <rate_io_per_second>" > /cgrp/blkio.throttle.write_iops_device
311 311
312Note: If both BW and IOPS rules are specified for a device, then IO is 312Note: If both BW and IOPS rules are specified for a device, then IO is
313 subjectd to both the constraints. 313 subjectd to both the constraints.
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 72e238465b0b..b1c921c27519 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -583,3 +583,25 @@ Why: Superseded by the UVCIOC_CTRL_QUERY ioctl.
583Who: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 583Who: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
584 584
585---------------------------- 585----------------------------
586
587What: For VIDIOC_S_FREQUENCY the type field must match the device node's type.
588 If not, return -EINVAL.
589When: 3.2
590Why: It makes no sense to switch the tuner to radio mode by calling
591 VIDIOC_S_FREQUENCY on a video node, or to switch the tuner to tv mode by
592 calling VIDIOC_S_FREQUENCY on a radio node. This is the first step of a
593 move to more consistent handling of tv and radio tuners.
594Who: Hans Verkuil <hans.verkuil@cisco.com>
595
596----------------------------
597
598What: Opening a radio device node will no longer automatically switch the
599 tuner mode from tv to radio.
600When: 3.3
601Why: Just opening a V4L device should not change the state of the hardware
602 like that. It's very unexpected and against the V4L spec. Instead, you
603 switch to radio mode by calling VIDIOC_S_FREQUENCY. This is the second
604 and last step of the move to consistent handling of tv and radio tuners.
605Who: Hans Verkuil <hans.verkuil@cisco.com>
606
607----------------------------
diff --git a/Documentation/filesystems/caching/netfs-api.txt b/Documentation/filesystems/caching/netfs-api.txt
index a167ab876c35..7cc6bf2871eb 100644
--- a/Documentation/filesystems/caching/netfs-api.txt
+++ b/Documentation/filesystems/caching/netfs-api.txt
@@ -673,6 +673,22 @@ storage request to complete, or it may attempt to cancel the storage request -
673in which case the page will not be stored in the cache this time. 673in which case the page will not be stored in the cache this time.
674 674
675 675
676BULK INODE PAGE UNCACHE
677-----------------------
678
679A convenience routine is provided to perform an uncache on all the pages
680attached to an inode. This assumes that the pages on the inode correspond on a
6811:1 basis with the pages in the cache.
682
683 void fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
684 struct inode *inode);
685
686This takes the netfs cookie that the pages were cached with and the inode that
687the pages are attached to. This function will wait for pages to finish being
688written to the cache and for the cache to finish with the page generally. No
689error is returned.
690
691
676========================== 692==========================
677INDEX AND DATA FILE UPDATE 693INDEX AND DATA FILE UPDATE
678========================== 694==========================
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index fd248a318211..aa47be71df4c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2015,6 +2015,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2015 the default. 2015 the default.
2016 off: Turn ECRC off 2016 off: Turn ECRC off
2017 on: Turn ECRC on. 2017 on: Turn ECRC on.
2018 realloc reallocate PCI resources if allocations done by BIOS
2019 are erroneous.
2018 2020
2019 pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power 2021 pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power
2020 Management. 2022 Management.
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
index 1565eefd6fd5..61815483efa3 100644
--- a/Documentation/laptops/thinkpad-acpi.txt
+++ b/Documentation/laptops/thinkpad-acpi.txt
@@ -534,6 +534,8 @@ Events that are never propagated by the driver:
5340x2404 System is waking up from hibernation to undock 5340x2404 System is waking up from hibernation to undock
5350x2405 System is waking up from hibernation to eject bay 5350x2405 System is waking up from hibernation to eject bay
5360x5010 Brightness level changed/control event 5360x5010 Brightness level changed/control event
5370x6000 KEYBOARD: Numlock key pressed
5380x6005 KEYBOARD: Fn key pressed (TO BE VERIFIED)
537 539
538Events that are propagated by the driver to userspace: 540Events that are propagated by the driver to userspace:
539 541
@@ -545,6 +547,8 @@ Events that are propagated by the driver to userspace:
5450x3006 Bay hotplug request (hint to power up SATA link when 5470x3006 Bay hotplug request (hint to power up SATA link when
546 the optical drive tray is ejected) 548 the optical drive tray is ejected)
5470x4003 Undocked (see 0x2x04), can sleep again 5490x4003 Undocked (see 0x2x04), can sleep again
5500x4010 Docked into hotplug port replicator (non-ACPI dock)
5510x4011 Undocked from hotplug port replicator (non-ACPI dock)
5480x500B Tablet pen inserted into its storage bay 5520x500B Tablet pen inserted into its storage bay
5490x500C Tablet pen removed from its storage bay 5530x500C Tablet pen removed from its storage bay
5500x6011 ALARM: battery is too hot 5540x6011 ALARM: battery is too hot
@@ -552,6 +556,7 @@ Events that are propagated by the driver to userspace:
5520x6021 ALARM: a sensor is too hot 5560x6021 ALARM: a sensor is too hot
5530x6022 ALARM: a sensor is extremely hot 5570x6022 ALARM: a sensor is extremely hot
5540x6030 System thermal table changed 5580x6030 System thermal table changed
5590x6040 Nvidia Optimus/AC adapter related (TO BE VERIFIED)
555 560
556Battery nearly empty alarms are a last resort attempt to get the 561Battery nearly empty alarms are a last resort attempt to get the
557operating system to hibernate or shutdown cleanly (0x2313), or shutdown 562operating system to hibernate or shutdown cleanly (0x2313), or shutdown
diff --git a/Documentation/spinlocks.txt b/Documentation/spinlocks.txt
index 2e3c64b1a6a5..9dbe885ecd8d 100644
--- a/Documentation/spinlocks.txt
+++ b/Documentation/spinlocks.txt
@@ -13,18 +13,8 @@ static DEFINE_SPINLOCK(xxx_lock);
13The above is always safe. It will disable interrupts _locally_, but the 13The above is always safe. It will disable interrupts _locally_, but the
14spinlock itself will guarantee the global lock, so it will guarantee that 14spinlock itself will guarantee the global lock, so it will guarantee that
15there is only one thread-of-control within the region(s) protected by that 15there is only one thread-of-control within the region(s) protected by that
16lock. This works well even under UP. The above sequence under UP 16lock. This works well even under UP also, so the code does _not_ need to
17essentially is just the same as doing 17worry about UP vs SMP issues: the spinlocks work correctly under both.
18
19 unsigned long flags;
20
21 save_flags(flags); cli();
22 ... critical section ...
23 restore_flags(flags);
24
25so the code does _not_ need to worry about UP vs SMP issues: the spinlocks
26work correctly under both (and spinlocks are actually more efficient on
27architectures that allow doing the "save_flags + cli" in one operation).
28 18
29 NOTE! Implications of spin_locks for memory are further described in: 19 NOTE! Implications of spin_locks for memory are further described in:
30 20
@@ -36,27 +26,7 @@ The above is usually pretty simple (you usually need and want only one
36spinlock for most things - using more than one spinlock can make things a 26spinlock for most things - using more than one spinlock can make things a
37lot more complex and even slower and is usually worth it only for 27lot more complex and even slower and is usually worth it only for
38sequences that you _know_ need to be split up: avoid it at all cost if you 28sequences that you _know_ need to be split up: avoid it at all cost if you
39aren't sure). HOWEVER, it _does_ mean that if you have some code that does 29aren't sure).
40
41 cli();
42 .. critical section ..
43 sti();
44
45and another sequence that does
46
47 spin_lock_irqsave(flags);
48 .. critical section ..
49 spin_unlock_irqrestore(flags);
50
51then they are NOT mutually exclusive, and the critical regions can happen
52at the same time on two different CPU's. That's fine per se, but the
53critical regions had better be critical for different things (ie they
54can't stomp on each other).
55
56The above is a problem mainly if you end up mixing code - for example the
57routines in ll_rw_block() tend to use cli/sti to protect the atomicity of
58their actions, and if a driver uses spinlocks instead then you should
59think about issues like the above.
60 30
61This is really the only really hard part about spinlocks: once you start 31This is really the only really hard part about spinlocks: once you start
62using spinlocks they tend to expand to areas you might not have noticed 32using spinlocks they tend to expand to areas you might not have noticed
@@ -120,11 +90,10 @@ Lesson 3: spinlocks revisited.
120 90
121The single spin-lock primitives above are by no means the only ones. They 91The single spin-lock primitives above are by no means the only ones. They
122are the most safe ones, and the ones that work under all circumstances, 92are the most safe ones, and the ones that work under all circumstances,
123but partly _because_ they are safe they are also fairly slow. They are 93but partly _because_ they are safe they are also fairly slow. They are slower
124much faster than a generic global cli/sti pair, but slower than they'd 94than they'd need to be, because they do have to disable interrupts
125need to be, because they do have to disable interrupts (which is just a 95(which is just a single instruction on a x86, but it's an expensive one -
126single instruction on a x86, but it's an expensive one - and on other 96and on other architectures it can be worse).
127architectures it can be worse).
128 97
129If you have a case where you have to protect a data structure across 98If you have a case where you have to protect a data structure across
130several CPU's and you want to use spinlocks you can potentially use 99several CPU's and you want to use spinlocks you can potentially use
diff --git a/MAINTAINERS b/MAINTAINERS
index ae563fad2271..187282da9213 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -594,6 +594,16 @@ S: Maintained
594F: arch/arm/lib/floppydma.S 594F: arch/arm/lib/floppydma.S
595F: arch/arm/include/asm/floppy.h 595F: arch/arm/include/asm/floppy.h
596 596
597ARM PMU PROFILING AND DEBUGGING
598M: Will Deacon <will.deacon@arm.com>
599S: Maintained
600F: arch/arm/kernel/perf_event*
601F: arch/arm/oprofile/common.c
602F: arch/arm/kernel/pmu.c
603F: arch/arm/include/asm/pmu.h
604F: arch/arm/kernel/hw_breakpoint.c
605F: arch/arm/include/asm/hw_breakpoint.h
606
597ARM PORT 607ARM PORT
598M: Russell King <linux@arm.linux.org.uk> 608M: Russell King <linux@arm.linux.org.uk>
599L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 609L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -2197,7 +2207,7 @@ F: drivers/acpi/dock.c
2197DOCUMENTATION 2207DOCUMENTATION
2198M: Randy Dunlap <rdunlap@xenotime.net> 2208M: Randy Dunlap <rdunlap@xenotime.net>
2199L: linux-doc@vger.kernel.org 2209L: linux-doc@vger.kernel.org
2200T: quilt oss.oracle.com/~rdunlap/kernel-doc-patches/current/ 2210T: quilt http://userweb.kernel.org/~rdunlap/kernel-doc-patches/current/
2201S: Maintained 2211S: Maintained
2202F: Documentation/ 2212F: Documentation/
2203 2213
@@ -4982,7 +4992,7 @@ F: drivers/power/power_supply*
4982 4992
4983PNP SUPPORT 4993PNP SUPPORT
4984M: Adam Belay <abelay@mit.edu> 4994M: Adam Belay <abelay@mit.edu>
4985M: Bjorn Helgaas <bjorn.helgaas@hp.com> 4995M: Bjorn Helgaas <bhelgaas@google.com>
4986S: Maintained 4996S: Maintained
4987F: drivers/pnp/ 4997F: drivers/pnp/
4988 4998
@@ -6733,6 +6743,7 @@ F: fs/fat/
6733VIDEOBUF2 FRAMEWORK 6743VIDEOBUF2 FRAMEWORK
6734M: Pawel Osciak <pawel@osciak.com> 6744M: Pawel Osciak <pawel@osciak.com>
6735M: Marek Szyprowski <m.szyprowski@samsung.com> 6745M: Marek Szyprowski <m.szyprowski@samsung.com>
6746M: Kyungmin Park <kyungmin.park@samsung.com>
6736L: linux-media@vger.kernel.org 6747L: linux-media@vger.kernel.org
6737S: Maintained 6748S: Maintained
6738F: drivers/media/video/videobuf2-* 6749F: drivers/media/video/videobuf2-*
diff --git a/Makefile b/Makefile
index 86f47a0ddc79..60d91f76c2fd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 0 2PATCHLEVEL = 0
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc7
5NAME = Sneaky Weasel 5NAME = Sneaky Weasel
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c1795c952bfe..476074fdb402 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -682,6 +682,7 @@ config ARCH_S3C2410
682 select GENERIC_GPIO 682 select GENERIC_GPIO
683 select ARCH_HAS_CPUFREQ 683 select ARCH_HAS_CPUFREQ
684 select HAVE_CLK 684 select HAVE_CLK
685 select CLKDEV_LOOKUP
685 select ARCH_USES_GETTIMEOFFSET 686 select ARCH_USES_GETTIMEOFFSET
686 select HAVE_S3C2410_I2C if I2C 687 select HAVE_S3C2410_I2C if I2C
687 help 688 help
@@ -699,6 +700,7 @@ config ARCH_S3C64XX
699 select CPU_V6 700 select CPU_V6
700 select ARM_VIC 701 select ARM_VIC
701 select HAVE_CLK 702 select HAVE_CLK
703 select CLKDEV_LOOKUP
702 select NO_IOPORT 704 select NO_IOPORT
703 select ARCH_USES_GETTIMEOFFSET 705 select ARCH_USES_GETTIMEOFFSET
704 select ARCH_HAS_CPUFREQ 706 select ARCH_HAS_CPUFREQ
@@ -723,6 +725,8 @@ config ARCH_S5P64X0
723 select CPU_V6 725 select CPU_V6
724 select GENERIC_GPIO 726 select GENERIC_GPIO
725 select HAVE_CLK 727 select HAVE_CLK
728 select CLKDEV_LOOKUP
729 select CLKSRC_MMIO
726 select HAVE_S3C2410_WATCHDOG if WATCHDOG 730 select HAVE_S3C2410_WATCHDOG if WATCHDOG
727 select GENERIC_CLOCKEVENTS 731 select GENERIC_CLOCKEVENTS
728 select HAVE_SCHED_CLOCK 732 select HAVE_SCHED_CLOCK
@@ -736,6 +740,7 @@ config ARCH_S5PC100
736 bool "Samsung S5PC100" 740 bool "Samsung S5PC100"
737 select GENERIC_GPIO 741 select GENERIC_GPIO
738 select HAVE_CLK 742 select HAVE_CLK
743 select CLKDEV_LOOKUP
739 select CPU_V7 744 select CPU_V7
740 select ARM_L1_CACHE_SHIFT_6 745 select ARM_L1_CACHE_SHIFT_6
741 select ARCH_USES_GETTIMEOFFSET 746 select ARCH_USES_GETTIMEOFFSET
@@ -751,6 +756,8 @@ config ARCH_S5PV210
751 select ARCH_SPARSEMEM_ENABLE 756 select ARCH_SPARSEMEM_ENABLE
752 select GENERIC_GPIO 757 select GENERIC_GPIO
753 select HAVE_CLK 758 select HAVE_CLK
759 select CLKDEV_LOOKUP
760 select CLKSRC_MMIO
754 select ARM_L1_CACHE_SHIFT_6 761 select ARM_L1_CACHE_SHIFT_6
755 select ARCH_HAS_CPUFREQ 762 select ARCH_HAS_CPUFREQ
756 select GENERIC_CLOCKEVENTS 763 select GENERIC_CLOCKEVENTS
@@ -767,6 +774,7 @@ config ARCH_EXYNOS4
767 select ARCH_SPARSEMEM_ENABLE 774 select ARCH_SPARSEMEM_ENABLE
768 select GENERIC_GPIO 775 select GENERIC_GPIO
769 select HAVE_CLK 776 select HAVE_CLK
777 select CLKDEV_LOOKUP
770 select ARCH_HAS_CPUFREQ 778 select ARCH_HAS_CPUFREQ
771 select GENERIC_CLOCKEVENTS 779 select GENERIC_CLOCKEVENTS
772 select HAVE_S3C_RTC if RTC_CLASS 780 select HAVE_S3C_RTC if RTC_CLASS
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index e5681636626f..841df7d21c2f 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -255,7 +255,7 @@ static inline dma_addr_t map_single(struct device *dev, void *ptr, size_t size,
255 if (buf == 0) { 255 if (buf == 0) {
256 dev_err(dev, "%s: unable to map unsafe buffer %p!\n", 256 dev_err(dev, "%s: unable to map unsafe buffer %p!\n",
257 __func__, ptr); 257 __func__, ptr);
258 return 0; 258 return ~0;
259 } 259 }
260 260
261 dev_dbg(dev, 261 dev_dbg(dev,
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index d53c0abc4dd3..2b5b1421596c 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -583,7 +583,7 @@ static int armpmu_event_init(struct perf_event *event)
583static void armpmu_enable(struct pmu *pmu) 583static void armpmu_enable(struct pmu *pmu)
584{ 584{
585 /* Enable all of the perf events on hardware. */ 585 /* Enable all of the perf events on hardware. */
586 int idx; 586 int idx, enabled = 0;
587 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 587 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
588 588
589 if (!armpmu) 589 if (!armpmu)
@@ -596,9 +596,11 @@ static void armpmu_enable(struct pmu *pmu)
596 continue; 596 continue;
597 597
598 armpmu->enable(&event->hw, idx); 598 armpmu->enable(&event->hw, idx);
599 enabled = 1;
599 } 600 }
600 601
601 armpmu->start(); 602 if (enabled)
603 armpmu->start();
602} 604}
603 605
604static void armpmu_disable(struct pmu *pmu) 606static void armpmu_disable(struct pmu *pmu)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index ed11fb08b05a..acbb447ac6b5 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -73,6 +73,7 @@ __setup("fpe=", fpe_setup);
73#endif 73#endif
74 74
75extern void paging_init(struct machine_desc *desc); 75extern void paging_init(struct machine_desc *desc);
76extern void sanity_check_meminfo(void);
76extern void reboot_setup(char *str); 77extern void reboot_setup(char *str);
77 78
78unsigned int processor_id; 79unsigned int processor_id;
@@ -900,6 +901,7 @@ void __init setup_arch(char **cmdline_p)
900 901
901 parse_early_param(); 902 parse_early_param();
902 903
904 sanity_check_meminfo();
903 arm_memblock_init(&meminfo, mdesc); 905 arm_memblock_init(&meminfo, mdesc);
904 906
905 paging_init(mdesc); 907 paging_init(mdesc);
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 60636f499cb3..2c277d40cee6 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -115,7 +115,7 @@ static void __cpuinit twd_calibrate_rate(void)
115 twd_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5); 115 twd_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5);
116 116
117 printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000, 117 printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000,
118 (twd_timer_rate / 1000000) % 100); 118 (twd_timer_rate / 10000) % 100);
119 } 119 }
120} 120}
121 121
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 1d4b65fd673e..6659a0d137a3 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -251,9 +251,9 @@ static void ep93xx_uart_set_mctrl(struct amba_device *dev,
251 unsigned int mcr; 251 unsigned int mcr;
252 252
253 mcr = 0; 253 mcr = 0;
254 if (!(mctrl & TIOCM_RTS)) 254 if (mctrl & TIOCM_RTS)
255 mcr |= 2; 255 mcr |= 2;
256 if (!(mctrl & TIOCM_DTR)) 256 if (mctrl & TIOCM_DTR)
257 mcr |= 1; 257 mcr |= 1;
258 258
259 __raw_writel(mcr, base + EP93XX_UART_MCR_OFFSET); 259 __raw_writel(mcr, base + EP93XX_UART_MCR_OFFSET);
diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index 1435fc31c4b2..ae433a052df6 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -110,6 +110,8 @@ config MACH_SMDKC210
110 select S3C_DEV_HSMMC1 110 select S3C_DEV_HSMMC1
111 select S3C_DEV_HSMMC2 111 select S3C_DEV_HSMMC2
112 select S3C_DEV_HSMMC3 112 select S3C_DEV_HSMMC3
113 select SAMSUNG_DEV_PWM
114 select SAMSUNG_DEV_BACKLIGHT
113 select EXYNOS4_DEV_PD 115 select EXYNOS4_DEV_PD
114 select EXYNOS4_DEV_SYSMMU 116 select EXYNOS4_DEV_SYSMMU
115 select EXYNOS4_SETUP_I2C1 117 select EXYNOS4_SETUP_I2C1
@@ -127,8 +129,10 @@ config MACH_SMDKV310
127 select S3C_DEV_HSMMC1 129 select S3C_DEV_HSMMC1
128 select S3C_DEV_HSMMC2 130 select S3C_DEV_HSMMC2
129 select S3C_DEV_HSMMC3 131 select S3C_DEV_HSMMC3
132 select SAMSUNG_DEV_BACKLIGHT
130 select SAMSUNG_DEV_KEYPAD 133 select SAMSUNG_DEV_KEYPAD
131 select EXYNOS4_DEV_PD 134 select EXYNOS4_DEV_PD
135 select SAMSUNG_DEV_PWM
132 select EXYNOS4_DEV_SYSMMU 136 select EXYNOS4_DEV_SYSMMU
133 select EXYNOS4_SETUP_I2C1 137 select EXYNOS4_SETUP_I2C1
134 select EXYNOS4_SETUP_KEYPAD 138 select EXYNOS4_SETUP_KEYPAD
diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 871f9d508fde..66494f28bbef 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -27,24 +27,20 @@
27 27
28static struct clk clk_sclk_hdmi27m = { 28static struct clk clk_sclk_hdmi27m = {
29 .name = "sclk_hdmi27m", 29 .name = "sclk_hdmi27m",
30 .id = -1,
31 .rate = 27000000, 30 .rate = 27000000,
32}; 31};
33 32
34static struct clk clk_sclk_hdmiphy = { 33static struct clk clk_sclk_hdmiphy = {
35 .name = "sclk_hdmiphy", 34 .name = "sclk_hdmiphy",
36 .id = -1,
37}; 35};
38 36
39static struct clk clk_sclk_usbphy0 = { 37static struct clk clk_sclk_usbphy0 = {
40 .name = "sclk_usbphy0", 38 .name = "sclk_usbphy0",
41 .id = -1,
42 .rate = 27000000, 39 .rate = 27000000,
43}; 40};
44 41
45static struct clk clk_sclk_usbphy1 = { 42static struct clk clk_sclk_usbphy1 = {
46 .name = "sclk_usbphy1", 43 .name = "sclk_usbphy1",
47 .id = -1,
48}; 44};
49 45
50static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable) 46static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
@@ -132,7 +128,6 @@ static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
132static struct clksrc_clk clk_mout_apll = { 128static struct clksrc_clk clk_mout_apll = {
133 .clk = { 129 .clk = {
134 .name = "mout_apll", 130 .name = "mout_apll",
135 .id = -1,
136 }, 131 },
137 .sources = &clk_src_apll, 132 .sources = &clk_src_apll,
138 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 }, 133 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 },
@@ -141,7 +136,6 @@ static struct clksrc_clk clk_mout_apll = {
141static struct clksrc_clk clk_sclk_apll = { 136static struct clksrc_clk clk_sclk_apll = {
142 .clk = { 137 .clk = {
143 .name = "sclk_apll", 138 .name = "sclk_apll",
144 .id = -1,
145 .parent = &clk_mout_apll.clk, 139 .parent = &clk_mout_apll.clk,
146 }, 140 },
147 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 }, 141 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 },
@@ -150,7 +144,6 @@ static struct clksrc_clk clk_sclk_apll = {
150static struct clksrc_clk clk_mout_epll = { 144static struct clksrc_clk clk_mout_epll = {
151 .clk = { 145 .clk = {
152 .name = "mout_epll", 146 .name = "mout_epll",
153 .id = -1,
154 }, 147 },
155 .sources = &clk_src_epll, 148 .sources = &clk_src_epll,
156 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 }, 149 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 },
@@ -159,7 +152,6 @@ static struct clksrc_clk clk_mout_epll = {
159static struct clksrc_clk clk_mout_mpll = { 152static struct clksrc_clk clk_mout_mpll = {
160 .clk = { 153 .clk = {
161 .name = "mout_mpll", 154 .name = "mout_mpll",
162 .id = -1,
163 }, 155 },
164 .sources = &clk_src_mpll, 156 .sources = &clk_src_mpll,
165 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 8, .size = 1 }, 157 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 8, .size = 1 },
@@ -178,7 +170,6 @@ static struct clksrc_sources clkset_moutcore = {
178static struct clksrc_clk clk_moutcore = { 170static struct clksrc_clk clk_moutcore = {
179 .clk = { 171 .clk = {
180 .name = "moutcore", 172 .name = "moutcore",
181 .id = -1,
182 }, 173 },
183 .sources = &clkset_moutcore, 174 .sources = &clkset_moutcore,
184 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 }, 175 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 },
@@ -187,7 +178,6 @@ static struct clksrc_clk clk_moutcore = {
187static struct clksrc_clk clk_coreclk = { 178static struct clksrc_clk clk_coreclk = {
188 .clk = { 179 .clk = {
189 .name = "core_clk", 180 .name = "core_clk",
190 .id = -1,
191 .parent = &clk_moutcore.clk, 181 .parent = &clk_moutcore.clk,
192 }, 182 },
193 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 }, 183 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 },
@@ -196,7 +186,6 @@ static struct clksrc_clk clk_coreclk = {
196static struct clksrc_clk clk_armclk = { 186static struct clksrc_clk clk_armclk = {
197 .clk = { 187 .clk = {
198 .name = "armclk", 188 .name = "armclk",
199 .id = -1,
200 .parent = &clk_coreclk.clk, 189 .parent = &clk_coreclk.clk,
201 }, 190 },
202}; 191};
@@ -204,7 +193,6 @@ static struct clksrc_clk clk_armclk = {
204static struct clksrc_clk clk_aclk_corem0 = { 193static struct clksrc_clk clk_aclk_corem0 = {
205 .clk = { 194 .clk = {
206 .name = "aclk_corem0", 195 .name = "aclk_corem0",
207 .id = -1,
208 .parent = &clk_coreclk.clk, 196 .parent = &clk_coreclk.clk,
209 }, 197 },
210 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 }, 198 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
@@ -213,7 +201,6 @@ static struct clksrc_clk clk_aclk_corem0 = {
213static struct clksrc_clk clk_aclk_cores = { 201static struct clksrc_clk clk_aclk_cores = {
214 .clk = { 202 .clk = {
215 .name = "aclk_cores", 203 .name = "aclk_cores",
216 .id = -1,
217 .parent = &clk_coreclk.clk, 204 .parent = &clk_coreclk.clk,
218 }, 205 },
219 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 }, 206 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
@@ -222,7 +209,6 @@ static struct clksrc_clk clk_aclk_cores = {
222static struct clksrc_clk clk_aclk_corem1 = { 209static struct clksrc_clk clk_aclk_corem1 = {
223 .clk = { 210 .clk = {
224 .name = "aclk_corem1", 211 .name = "aclk_corem1",
225 .id = -1,
226 .parent = &clk_coreclk.clk, 212 .parent = &clk_coreclk.clk,
227 }, 213 },
228 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 }, 214 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 },
@@ -231,7 +217,6 @@ static struct clksrc_clk clk_aclk_corem1 = {
231static struct clksrc_clk clk_periphclk = { 217static struct clksrc_clk clk_periphclk = {
232 .clk = { 218 .clk = {
233 .name = "periphclk", 219 .name = "periphclk",
234 .id = -1,
235 .parent = &clk_coreclk.clk, 220 .parent = &clk_coreclk.clk,
236 }, 221 },
237 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 }, 222 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 },
@@ -252,7 +237,6 @@ static struct clksrc_sources clkset_mout_corebus = {
252static struct clksrc_clk clk_mout_corebus = { 237static struct clksrc_clk clk_mout_corebus = {
253 .clk = { 238 .clk = {
254 .name = "mout_corebus", 239 .name = "mout_corebus",
255 .id = -1,
256 }, 240 },
257 .sources = &clkset_mout_corebus, 241 .sources = &clkset_mout_corebus,
258 .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 }, 242 .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 },
@@ -261,7 +245,6 @@ static struct clksrc_clk clk_mout_corebus = {
261static struct clksrc_clk clk_sclk_dmc = { 245static struct clksrc_clk clk_sclk_dmc = {
262 .clk = { 246 .clk = {
263 .name = "sclk_dmc", 247 .name = "sclk_dmc",
264 .id = -1,
265 .parent = &clk_mout_corebus.clk, 248 .parent = &clk_mout_corebus.clk,
266 }, 249 },
267 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 }, 250 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 },
@@ -270,7 +253,6 @@ static struct clksrc_clk clk_sclk_dmc = {
270static struct clksrc_clk clk_aclk_cored = { 253static struct clksrc_clk clk_aclk_cored = {
271 .clk = { 254 .clk = {
272 .name = "aclk_cored", 255 .name = "aclk_cored",
273 .id = -1,
274 .parent = &clk_sclk_dmc.clk, 256 .parent = &clk_sclk_dmc.clk,
275 }, 257 },
276 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 }, 258 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 },
@@ -279,7 +261,6 @@ static struct clksrc_clk clk_aclk_cored = {
279static struct clksrc_clk clk_aclk_corep = { 261static struct clksrc_clk clk_aclk_corep = {
280 .clk = { 262 .clk = {
281 .name = "aclk_corep", 263 .name = "aclk_corep",
282 .id = -1,
283 .parent = &clk_aclk_cored.clk, 264 .parent = &clk_aclk_cored.clk,
284 }, 265 },
285 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 }, 266 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 },
@@ -288,7 +269,6 @@ static struct clksrc_clk clk_aclk_corep = {
288static struct clksrc_clk clk_aclk_acp = { 269static struct clksrc_clk clk_aclk_acp = {
289 .clk = { 270 .clk = {
290 .name = "aclk_acp", 271 .name = "aclk_acp",
291 .id = -1,
292 .parent = &clk_mout_corebus.clk, 272 .parent = &clk_mout_corebus.clk,
293 }, 273 },
294 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 }, 274 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 },
@@ -297,7 +277,6 @@ static struct clksrc_clk clk_aclk_acp = {
297static struct clksrc_clk clk_pclk_acp = { 277static struct clksrc_clk clk_pclk_acp = {
298 .clk = { 278 .clk = {
299 .name = "pclk_acp", 279 .name = "pclk_acp",
300 .id = -1,
301 .parent = &clk_aclk_acp.clk, 280 .parent = &clk_aclk_acp.clk,
302 }, 281 },
303 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 }, 282 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 },
@@ -318,7 +297,6 @@ static struct clksrc_sources clkset_aclk = {
318static struct clksrc_clk clk_aclk_200 = { 297static struct clksrc_clk clk_aclk_200 = {
319 .clk = { 298 .clk = {
320 .name = "aclk_200", 299 .name = "aclk_200",
321 .id = -1,
322 }, 300 },
323 .sources = &clkset_aclk, 301 .sources = &clkset_aclk,
324 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 }, 302 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 },
@@ -328,7 +306,6 @@ static struct clksrc_clk clk_aclk_200 = {
328static struct clksrc_clk clk_aclk_100 = { 306static struct clksrc_clk clk_aclk_100 = {
329 .clk = { 307 .clk = {
330 .name = "aclk_100", 308 .name = "aclk_100",
331 .id = -1,
332 }, 309 },
333 .sources = &clkset_aclk, 310 .sources = &clkset_aclk,
334 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 }, 311 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 },
@@ -338,7 +315,6 @@ static struct clksrc_clk clk_aclk_100 = {
338static struct clksrc_clk clk_aclk_160 = { 315static struct clksrc_clk clk_aclk_160 = {
339 .clk = { 316 .clk = {
340 .name = "aclk_160", 317 .name = "aclk_160",
341 .id = -1,
342 }, 318 },
343 .sources = &clkset_aclk, 319 .sources = &clkset_aclk,
344 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 }, 320 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 },
@@ -348,7 +324,6 @@ static struct clksrc_clk clk_aclk_160 = {
348static struct clksrc_clk clk_aclk_133 = { 324static struct clksrc_clk clk_aclk_133 = {
349 .clk = { 325 .clk = {
350 .name = "aclk_133", 326 .name = "aclk_133",
351 .id = -1,
352 }, 327 },
353 .sources = &clkset_aclk, 328 .sources = &clkset_aclk,
354 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 }, 329 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 },
@@ -368,7 +343,6 @@ static struct clksrc_sources clkset_vpllsrc = {
368static struct clksrc_clk clk_vpllsrc = { 343static struct clksrc_clk clk_vpllsrc = {
369 .clk = { 344 .clk = {
370 .name = "vpll_src", 345 .name = "vpll_src",
371 .id = -1,
372 .enable = exynos4_clksrc_mask_top_ctrl, 346 .enable = exynos4_clksrc_mask_top_ctrl,
373 .ctrlbit = (1 << 0), 347 .ctrlbit = (1 << 0),
374 }, 348 },
@@ -389,7 +363,6 @@ static struct clksrc_sources clkset_sclk_vpll = {
389static struct clksrc_clk clk_sclk_vpll = { 363static struct clksrc_clk clk_sclk_vpll = {
390 .clk = { 364 .clk = {
391 .name = "sclk_vpll", 365 .name = "sclk_vpll",
392 .id = -1,
393 }, 366 },
394 .sources = &clkset_sclk_vpll, 367 .sources = &clkset_sclk_vpll,
395 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 }, 368 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 },
@@ -398,161 +371,151 @@ static struct clksrc_clk clk_sclk_vpll = {
398static struct clk init_clocks_off[] = { 371static struct clk init_clocks_off[] = {
399 { 372 {
400 .name = "timers", 373 .name = "timers",
401 .id = -1,
402 .parent = &clk_aclk_100.clk, 374 .parent = &clk_aclk_100.clk,
403 .enable = exynos4_clk_ip_peril_ctrl, 375 .enable = exynos4_clk_ip_peril_ctrl,
404 .ctrlbit = (1<<24), 376 .ctrlbit = (1<<24),
405 }, { 377 }, {
406 .name = "csis", 378 .name = "csis",
407 .id = 0, 379 .devname = "s5p-mipi-csis.0",
408 .enable = exynos4_clk_ip_cam_ctrl, 380 .enable = exynos4_clk_ip_cam_ctrl,
409 .ctrlbit = (1 << 4), 381 .ctrlbit = (1 << 4),
410 }, { 382 }, {
411 .name = "csis", 383 .name = "csis",
412 .id = 1, 384 .devname = "s5p-mipi-csis.1",
413 .enable = exynos4_clk_ip_cam_ctrl, 385 .enable = exynos4_clk_ip_cam_ctrl,
414 .ctrlbit = (1 << 5), 386 .ctrlbit = (1 << 5),
415 }, { 387 }, {
416 .name = "fimc", 388 .name = "fimc",
417 .id = 0, 389 .devname = "exynos4-fimc.0",
418 .enable = exynos4_clk_ip_cam_ctrl, 390 .enable = exynos4_clk_ip_cam_ctrl,
419 .ctrlbit = (1 << 0), 391 .ctrlbit = (1 << 0),
420 }, { 392 }, {
421 .name = "fimc", 393 .name = "fimc",
422 .id = 1, 394 .devname = "exynos4-fimc.1",
423 .enable = exynos4_clk_ip_cam_ctrl, 395 .enable = exynos4_clk_ip_cam_ctrl,
424 .ctrlbit = (1 << 1), 396 .ctrlbit = (1 << 1),
425 }, { 397 }, {
426 .name = "fimc", 398 .name = "fimc",
427 .id = 2, 399 .devname = "exynos4-fimc.2",
428 .enable = exynos4_clk_ip_cam_ctrl, 400 .enable = exynos4_clk_ip_cam_ctrl,
429 .ctrlbit = (1 << 2), 401 .ctrlbit = (1 << 2),
430 }, { 402 }, {
431 .name = "fimc", 403 .name = "fimc",
432 .id = 3, 404 .devname = "exynos4-fimc.3",
433 .enable = exynos4_clk_ip_cam_ctrl, 405 .enable = exynos4_clk_ip_cam_ctrl,
434 .ctrlbit = (1 << 3), 406 .ctrlbit = (1 << 3),
435 }, { 407 }, {
436 .name = "fimd", 408 .name = "fimd",
437 .id = 0, 409 .devname = "exynos4-fb.0",
438 .enable = exynos4_clk_ip_lcd0_ctrl, 410 .enable = exynos4_clk_ip_lcd0_ctrl,
439 .ctrlbit = (1 << 0), 411 .ctrlbit = (1 << 0),
440 }, { 412 }, {
441 .name = "fimd", 413 .name = "fimd",
442 .id = 1, 414 .devname = "exynos4-fb.1",
443 .enable = exynos4_clk_ip_lcd1_ctrl, 415 .enable = exynos4_clk_ip_lcd1_ctrl,
444 .ctrlbit = (1 << 0), 416 .ctrlbit = (1 << 0),
445 }, { 417 }, {
446 .name = "sataphy", 418 .name = "sataphy",
447 .id = -1,
448 .parent = &clk_aclk_133.clk, 419 .parent = &clk_aclk_133.clk,
449 .enable = exynos4_clk_ip_fsys_ctrl, 420 .enable = exynos4_clk_ip_fsys_ctrl,
450 .ctrlbit = (1 << 3), 421 .ctrlbit = (1 << 3),
451 }, { 422 }, {
452 .name = "hsmmc", 423 .name = "hsmmc",
453 .id = 0, 424 .devname = "s3c-sdhci.0",
454 .parent = &clk_aclk_133.clk, 425 .parent = &clk_aclk_133.clk,
455 .enable = exynos4_clk_ip_fsys_ctrl, 426 .enable = exynos4_clk_ip_fsys_ctrl,
456 .ctrlbit = (1 << 5), 427 .ctrlbit = (1 << 5),
457 }, { 428 }, {
458 .name = "hsmmc", 429 .name = "hsmmc",
459 .id = 1, 430 .devname = "s3c-sdhci.1",
460 .parent = &clk_aclk_133.clk, 431 .parent = &clk_aclk_133.clk,
461 .enable = exynos4_clk_ip_fsys_ctrl, 432 .enable = exynos4_clk_ip_fsys_ctrl,
462 .ctrlbit = (1 << 6), 433 .ctrlbit = (1 << 6),
463 }, { 434 }, {
464 .name = "hsmmc", 435 .name = "hsmmc",
465 .id = 2, 436 .devname = "s3c-sdhci.2",
466 .parent = &clk_aclk_133.clk, 437 .parent = &clk_aclk_133.clk,
467 .enable = exynos4_clk_ip_fsys_ctrl, 438 .enable = exynos4_clk_ip_fsys_ctrl,
468 .ctrlbit = (1 << 7), 439 .ctrlbit = (1 << 7),
469 }, { 440 }, {
470 .name = "hsmmc", 441 .name = "hsmmc",
471 .id = 3, 442 .devname = "s3c-sdhci.3",
472 .parent = &clk_aclk_133.clk, 443 .parent = &clk_aclk_133.clk,
473 .enable = exynos4_clk_ip_fsys_ctrl, 444 .enable = exynos4_clk_ip_fsys_ctrl,
474 .ctrlbit = (1 << 8), 445 .ctrlbit = (1 << 8),
475 }, { 446 }, {
476 .name = "hsmmc", 447 .name = "dwmmc",
477 .id = 4,
478 .parent = &clk_aclk_133.clk, 448 .parent = &clk_aclk_133.clk,
479 .enable = exynos4_clk_ip_fsys_ctrl, 449 .enable = exynos4_clk_ip_fsys_ctrl,
480 .ctrlbit = (1 << 9), 450 .ctrlbit = (1 << 9),
481 }, { 451 }, {
482 .name = "sata", 452 .name = "sata",
483 .id = -1,
484 .parent = &clk_aclk_133.clk, 453 .parent = &clk_aclk_133.clk,
485 .enable = exynos4_clk_ip_fsys_ctrl, 454 .enable = exynos4_clk_ip_fsys_ctrl,
486 .ctrlbit = (1 << 10), 455 .ctrlbit = (1 << 10),
487 }, { 456 }, {
488 .name = "pdma", 457 .name = "pdma",
489 .id = 0, 458 .devname = "s3c-pl330.0",
490 .enable = exynos4_clk_ip_fsys_ctrl, 459 .enable = exynos4_clk_ip_fsys_ctrl,
491 .ctrlbit = (1 << 0), 460 .ctrlbit = (1 << 0),
492 }, { 461 }, {
493 .name = "pdma", 462 .name = "pdma",
494 .id = 1, 463 .devname = "s3c-pl330.1",
495 .enable = exynos4_clk_ip_fsys_ctrl, 464 .enable = exynos4_clk_ip_fsys_ctrl,
496 .ctrlbit = (1 << 1), 465 .ctrlbit = (1 << 1),
497 }, { 466 }, {
498 .name = "adc", 467 .name = "adc",
499 .id = -1,
500 .enable = exynos4_clk_ip_peril_ctrl, 468 .enable = exynos4_clk_ip_peril_ctrl,
501 .ctrlbit = (1 << 15), 469 .ctrlbit = (1 << 15),
502 }, { 470 }, {
503 .name = "keypad", 471 .name = "keypad",
504 .id = -1,
505 .enable = exynos4_clk_ip_perir_ctrl, 472 .enable = exynos4_clk_ip_perir_ctrl,
506 .ctrlbit = (1 << 16), 473 .ctrlbit = (1 << 16),
507 }, { 474 }, {
508 .name = "rtc", 475 .name = "rtc",
509 .id = -1,
510 .enable = exynos4_clk_ip_perir_ctrl, 476 .enable = exynos4_clk_ip_perir_ctrl,
511 .ctrlbit = (1 << 15), 477 .ctrlbit = (1 << 15),
512 }, { 478 }, {
513 .name = "watchdog", 479 .name = "watchdog",
514 .id = -1,
515 .parent = &clk_aclk_100.clk, 480 .parent = &clk_aclk_100.clk,
516 .enable = exynos4_clk_ip_perir_ctrl, 481 .enable = exynos4_clk_ip_perir_ctrl,
517 .ctrlbit = (1 << 14), 482 .ctrlbit = (1 << 14),
518 }, { 483 }, {
519 .name = "usbhost", 484 .name = "usbhost",
520 .id = -1,
521 .enable = exynos4_clk_ip_fsys_ctrl , 485 .enable = exynos4_clk_ip_fsys_ctrl ,
522 .ctrlbit = (1 << 12), 486 .ctrlbit = (1 << 12),
523 }, { 487 }, {
524 .name = "otg", 488 .name = "otg",
525 .id = -1,
526 .enable = exynos4_clk_ip_fsys_ctrl, 489 .enable = exynos4_clk_ip_fsys_ctrl,
527 .ctrlbit = (1 << 13), 490 .ctrlbit = (1 << 13),
528 }, { 491 }, {
529 .name = "spi", 492 .name = "spi",
530 .id = 0, 493 .devname = "s3c64xx-spi.0",
531 .enable = exynos4_clk_ip_peril_ctrl, 494 .enable = exynos4_clk_ip_peril_ctrl,
532 .ctrlbit = (1 << 16), 495 .ctrlbit = (1 << 16),
533 }, { 496 }, {
534 .name = "spi", 497 .name = "spi",
535 .id = 1, 498 .devname = "s3c64xx-spi.1",
536 .enable = exynos4_clk_ip_peril_ctrl, 499 .enable = exynos4_clk_ip_peril_ctrl,
537 .ctrlbit = (1 << 17), 500 .ctrlbit = (1 << 17),
538 }, { 501 }, {
539 .name = "spi", 502 .name = "spi",
540 .id = 2, 503 .devname = "s3c64xx-spi.2",
541 .enable = exynos4_clk_ip_peril_ctrl, 504 .enable = exynos4_clk_ip_peril_ctrl,
542 .ctrlbit = (1 << 18), 505 .ctrlbit = (1 << 18),
543 }, { 506 }, {
544 .name = "iis", 507 .name = "iis",
545 .id = 0, 508 .devname = "samsung-i2s.0",
546 .enable = exynos4_clk_ip_peril_ctrl, 509 .enable = exynos4_clk_ip_peril_ctrl,
547 .ctrlbit = (1 << 19), 510 .ctrlbit = (1 << 19),
548 }, { 511 }, {
549 .name = "iis", 512 .name = "iis",
550 .id = 1, 513 .devname = "samsung-i2s.1",
551 .enable = exynos4_clk_ip_peril_ctrl, 514 .enable = exynos4_clk_ip_peril_ctrl,
552 .ctrlbit = (1 << 20), 515 .ctrlbit = (1 << 20),
553 }, { 516 }, {
554 .name = "iis", 517 .name = "iis",
555 .id = 2, 518 .devname = "samsung-i2s.2",
556 .enable = exynos4_clk_ip_peril_ctrl, 519 .enable = exynos4_clk_ip_peril_ctrl,
557 .ctrlbit = (1 << 21), 520 .ctrlbit = (1 << 21),
558 }, { 521 }, {
@@ -562,125 +525,110 @@ static struct clk init_clocks_off[] = {
562 .ctrlbit = (1 << 27), 525 .ctrlbit = (1 << 27),
563 }, { 526 }, {
564 .name = "fimg2d", 527 .name = "fimg2d",
565 .id = -1,
566 .enable = exynos4_clk_ip_image_ctrl, 528 .enable = exynos4_clk_ip_image_ctrl,
567 .ctrlbit = (1 << 0), 529 .ctrlbit = (1 << 0),
568 }, { 530 }, {
569 .name = "i2c", 531 .name = "i2c",
570 .id = 0, 532 .devname = "s3c2440-i2c.0",
571 .parent = &clk_aclk_100.clk, 533 .parent = &clk_aclk_100.clk,
572 .enable = exynos4_clk_ip_peril_ctrl, 534 .enable = exynos4_clk_ip_peril_ctrl,
573 .ctrlbit = (1 << 6), 535 .ctrlbit = (1 << 6),
574 }, { 536 }, {
575 .name = "i2c", 537 .name = "i2c",
576 .id = 1, 538 .devname = "s3c2440-i2c.1",
577 .parent = &clk_aclk_100.clk, 539 .parent = &clk_aclk_100.clk,
578 .enable = exynos4_clk_ip_peril_ctrl, 540 .enable = exynos4_clk_ip_peril_ctrl,
579 .ctrlbit = (1 << 7), 541 .ctrlbit = (1 << 7),
580 }, { 542 }, {
581 .name = "i2c", 543 .name = "i2c",
582 .id = 2, 544 .devname = "s3c2440-i2c.2",
583 .parent = &clk_aclk_100.clk, 545 .parent = &clk_aclk_100.clk,
584 .enable = exynos4_clk_ip_peril_ctrl, 546 .enable = exynos4_clk_ip_peril_ctrl,
585 .ctrlbit = (1 << 8), 547 .ctrlbit = (1 << 8),
586 }, { 548 }, {
587 .name = "i2c", 549 .name = "i2c",
588 .id = 3, 550 .devname = "s3c2440-i2c.3",
589 .parent = &clk_aclk_100.clk, 551 .parent = &clk_aclk_100.clk,
590 .enable = exynos4_clk_ip_peril_ctrl, 552 .enable = exynos4_clk_ip_peril_ctrl,
591 .ctrlbit = (1 << 9), 553 .ctrlbit = (1 << 9),
592 }, { 554 }, {
593 .name = "i2c", 555 .name = "i2c",
594 .id = 4, 556 .devname = "s3c2440-i2c.4",
595 .parent = &clk_aclk_100.clk, 557 .parent = &clk_aclk_100.clk,
596 .enable = exynos4_clk_ip_peril_ctrl, 558 .enable = exynos4_clk_ip_peril_ctrl,
597 .ctrlbit = (1 << 10), 559 .ctrlbit = (1 << 10),
598 }, { 560 }, {
599 .name = "i2c", 561 .name = "i2c",
600 .id = 5, 562 .devname = "s3c2440-i2c.5",
601 .parent = &clk_aclk_100.clk, 563 .parent = &clk_aclk_100.clk,
602 .enable = exynos4_clk_ip_peril_ctrl, 564 .enable = exynos4_clk_ip_peril_ctrl,
603 .ctrlbit = (1 << 11), 565 .ctrlbit = (1 << 11),
604 }, { 566 }, {
605 .name = "i2c", 567 .name = "i2c",
606 .id = 6, 568 .devname = "s3c2440-i2c.6",
607 .parent = &clk_aclk_100.clk, 569 .parent = &clk_aclk_100.clk,
608 .enable = exynos4_clk_ip_peril_ctrl, 570 .enable = exynos4_clk_ip_peril_ctrl,
609 .ctrlbit = (1 << 12), 571 .ctrlbit = (1 << 12),
610 }, { 572 }, {
611 .name = "i2c", 573 .name = "i2c",
612 .id = 7, 574 .devname = "s3c2440-i2c.7",
613 .parent = &clk_aclk_100.clk, 575 .parent = &clk_aclk_100.clk,
614 .enable = exynos4_clk_ip_peril_ctrl, 576 .enable = exynos4_clk_ip_peril_ctrl,
615 .ctrlbit = (1 << 13), 577 .ctrlbit = (1 << 13),
616 }, { 578 }, {
617 .name = "SYSMMU_MDMA", 579 .name = "SYSMMU_MDMA",
618 .id = -1,
619 .enable = exynos4_clk_ip_image_ctrl, 580 .enable = exynos4_clk_ip_image_ctrl,
620 .ctrlbit = (1 << 5), 581 .ctrlbit = (1 << 5),
621 }, { 582 }, {
622 .name = "SYSMMU_FIMC0", 583 .name = "SYSMMU_FIMC0",
623 .id = -1,
624 .enable = exynos4_clk_ip_cam_ctrl, 584 .enable = exynos4_clk_ip_cam_ctrl,
625 .ctrlbit = (1 << 7), 585 .ctrlbit = (1 << 7),
626 }, { 586 }, {
627 .name = "SYSMMU_FIMC1", 587 .name = "SYSMMU_FIMC1",
628 .id = -1,
629 .enable = exynos4_clk_ip_cam_ctrl, 588 .enable = exynos4_clk_ip_cam_ctrl,
630 .ctrlbit = (1 << 8), 589 .ctrlbit = (1 << 8),
631 }, { 590 }, {
632 .name = "SYSMMU_FIMC2", 591 .name = "SYSMMU_FIMC2",
633 .id = -1,
634 .enable = exynos4_clk_ip_cam_ctrl, 592 .enable = exynos4_clk_ip_cam_ctrl,
635 .ctrlbit = (1 << 9), 593 .ctrlbit = (1 << 9),
636 }, { 594 }, {
637 .name = "SYSMMU_FIMC3", 595 .name = "SYSMMU_FIMC3",
638 .id = -1,
639 .enable = exynos4_clk_ip_cam_ctrl, 596 .enable = exynos4_clk_ip_cam_ctrl,
640 .ctrlbit = (1 << 10), 597 .ctrlbit = (1 << 10),
641 }, { 598 }, {
642 .name = "SYSMMU_JPEG", 599 .name = "SYSMMU_JPEG",
643 .id = -1,
644 .enable = exynos4_clk_ip_cam_ctrl, 600 .enable = exynos4_clk_ip_cam_ctrl,
645 .ctrlbit = (1 << 11), 601 .ctrlbit = (1 << 11),
646 }, { 602 }, {
647 .name = "SYSMMU_FIMD0", 603 .name = "SYSMMU_FIMD0",
648 .id = -1,
649 .enable = exynos4_clk_ip_lcd0_ctrl, 604 .enable = exynos4_clk_ip_lcd0_ctrl,
650 .ctrlbit = (1 << 4), 605 .ctrlbit = (1 << 4),
651 }, { 606 }, {
652 .name = "SYSMMU_FIMD1", 607 .name = "SYSMMU_FIMD1",
653 .id = -1,
654 .enable = exynos4_clk_ip_lcd1_ctrl, 608 .enable = exynos4_clk_ip_lcd1_ctrl,
655 .ctrlbit = (1 << 4), 609 .ctrlbit = (1 << 4),
656 }, { 610 }, {
657 .name = "SYSMMU_PCIe", 611 .name = "SYSMMU_PCIe",
658 .id = -1,
659 .enable = exynos4_clk_ip_fsys_ctrl, 612 .enable = exynos4_clk_ip_fsys_ctrl,
660 .ctrlbit = (1 << 18), 613 .ctrlbit = (1 << 18),
661 }, { 614 }, {
662 .name = "SYSMMU_G2D", 615 .name = "SYSMMU_G2D",
663 .id = -1,
664 .enable = exynos4_clk_ip_image_ctrl, 616 .enable = exynos4_clk_ip_image_ctrl,
665 .ctrlbit = (1 << 3), 617 .ctrlbit = (1 << 3),
666 }, { 618 }, {
667 .name = "SYSMMU_ROTATOR", 619 .name = "SYSMMU_ROTATOR",
668 .id = -1,
669 .enable = exynos4_clk_ip_image_ctrl, 620 .enable = exynos4_clk_ip_image_ctrl,
670 .ctrlbit = (1 << 4), 621 .ctrlbit = (1 << 4),
671 }, { 622 }, {
672 .name = "SYSMMU_TV", 623 .name = "SYSMMU_TV",
673 .id = -1,
674 .enable = exynos4_clk_ip_tv_ctrl, 624 .enable = exynos4_clk_ip_tv_ctrl,
675 .ctrlbit = (1 << 4), 625 .ctrlbit = (1 << 4),
676 }, { 626 }, {
677 .name = "SYSMMU_MFC_L", 627 .name = "SYSMMU_MFC_L",
678 .id = -1,
679 .enable = exynos4_clk_ip_mfc_ctrl, 628 .enable = exynos4_clk_ip_mfc_ctrl,
680 .ctrlbit = (1 << 1), 629 .ctrlbit = (1 << 1),
681 }, { 630 }, {
682 .name = "SYSMMU_MFC_R", 631 .name = "SYSMMU_MFC_R",
683 .id = -1,
684 .enable = exynos4_clk_ip_mfc_ctrl, 632 .enable = exynos4_clk_ip_mfc_ctrl,
685 .ctrlbit = (1 << 2), 633 .ctrlbit = (1 << 2),
686 } 634 }
@@ -689,32 +637,32 @@ static struct clk init_clocks_off[] = {
689static struct clk init_clocks[] = { 637static struct clk init_clocks[] = {
690 { 638 {
691 .name = "uart", 639 .name = "uart",
692 .id = 0, 640 .devname = "s5pv210-uart.0",
693 .enable = exynos4_clk_ip_peril_ctrl, 641 .enable = exynos4_clk_ip_peril_ctrl,
694 .ctrlbit = (1 << 0), 642 .ctrlbit = (1 << 0),
695 }, { 643 }, {
696 .name = "uart", 644 .name = "uart",
697 .id = 1, 645 .devname = "s5pv210-uart.1",
698 .enable = exynos4_clk_ip_peril_ctrl, 646 .enable = exynos4_clk_ip_peril_ctrl,
699 .ctrlbit = (1 << 1), 647 .ctrlbit = (1 << 1),
700 }, { 648 }, {
701 .name = "uart", 649 .name = "uart",
702 .id = 2, 650 .devname = "s5pv210-uart.2",
703 .enable = exynos4_clk_ip_peril_ctrl, 651 .enable = exynos4_clk_ip_peril_ctrl,
704 .ctrlbit = (1 << 2), 652 .ctrlbit = (1 << 2),
705 }, { 653 }, {
706 .name = "uart", 654 .name = "uart",
707 .id = 3, 655 .devname = "s5pv210-uart.3",
708 .enable = exynos4_clk_ip_peril_ctrl, 656 .enable = exynos4_clk_ip_peril_ctrl,
709 .ctrlbit = (1 << 3), 657 .ctrlbit = (1 << 3),
710 }, { 658 }, {
711 .name = "uart", 659 .name = "uart",
712 .id = 4, 660 .devname = "s5pv210-uart.4",
713 .enable = exynos4_clk_ip_peril_ctrl, 661 .enable = exynos4_clk_ip_peril_ctrl,
714 .ctrlbit = (1 << 4), 662 .ctrlbit = (1 << 4),
715 }, { 663 }, {
716 .name = "uart", 664 .name = "uart",
717 .id = 5, 665 .devname = "s5pv210-uart.5",
718 .enable = exynos4_clk_ip_peril_ctrl, 666 .enable = exynos4_clk_ip_peril_ctrl,
719 .ctrlbit = (1 << 5), 667 .ctrlbit = (1 << 5),
720 } 668 }
@@ -750,7 +698,6 @@ static struct clksrc_sources clkset_mout_g2d0 = {
750static struct clksrc_clk clk_mout_g2d0 = { 698static struct clksrc_clk clk_mout_g2d0 = {
751 .clk = { 699 .clk = {
752 .name = "mout_g2d0", 700 .name = "mout_g2d0",
753 .id = -1,
754 }, 701 },
755 .sources = &clkset_mout_g2d0, 702 .sources = &clkset_mout_g2d0,
756 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 }, 703 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 },
@@ -769,7 +716,6 @@ static struct clksrc_sources clkset_mout_g2d1 = {
769static struct clksrc_clk clk_mout_g2d1 = { 716static struct clksrc_clk clk_mout_g2d1 = {
770 .clk = { 717 .clk = {
771 .name = "mout_g2d1", 718 .name = "mout_g2d1",
772 .id = -1,
773 }, 719 },
774 .sources = &clkset_mout_g2d1, 720 .sources = &clkset_mout_g2d1,
775 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 }, 721 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 },
@@ -788,7 +734,6 @@ static struct clksrc_sources clkset_mout_g2d = {
788static struct clksrc_clk clk_dout_mmc0 = { 734static struct clksrc_clk clk_dout_mmc0 = {
789 .clk = { 735 .clk = {
790 .name = "dout_mmc0", 736 .name = "dout_mmc0",
791 .id = -1,
792 }, 737 },
793 .sources = &clkset_group, 738 .sources = &clkset_group,
794 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 }, 739 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 },
@@ -798,7 +743,6 @@ static struct clksrc_clk clk_dout_mmc0 = {
798static struct clksrc_clk clk_dout_mmc1 = { 743static struct clksrc_clk clk_dout_mmc1 = {
799 .clk = { 744 .clk = {
800 .name = "dout_mmc1", 745 .name = "dout_mmc1",
801 .id = -1,
802 }, 746 },
803 .sources = &clkset_group, 747 .sources = &clkset_group,
804 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 }, 748 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 },
@@ -808,7 +752,6 @@ static struct clksrc_clk clk_dout_mmc1 = {
808static struct clksrc_clk clk_dout_mmc2 = { 752static struct clksrc_clk clk_dout_mmc2 = {
809 .clk = { 753 .clk = {
810 .name = "dout_mmc2", 754 .name = "dout_mmc2",
811 .id = -1,
812 }, 755 },
813 .sources = &clkset_group, 756 .sources = &clkset_group,
814 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 }, 757 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 },
@@ -818,7 +761,6 @@ static struct clksrc_clk clk_dout_mmc2 = {
818static struct clksrc_clk clk_dout_mmc3 = { 761static struct clksrc_clk clk_dout_mmc3 = {
819 .clk = { 762 .clk = {
820 .name = "dout_mmc3", 763 .name = "dout_mmc3",
821 .id = -1,
822 }, 764 },
823 .sources = &clkset_group, 765 .sources = &clkset_group,
824 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 }, 766 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 },
@@ -828,7 +770,6 @@ static struct clksrc_clk clk_dout_mmc3 = {
828static struct clksrc_clk clk_dout_mmc4 = { 770static struct clksrc_clk clk_dout_mmc4 = {
829 .clk = { 771 .clk = {
830 .name = "dout_mmc4", 772 .name = "dout_mmc4",
831 .id = -1,
832 }, 773 },
833 .sources = &clkset_group, 774 .sources = &clkset_group,
834 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 }, 775 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 },
@@ -839,7 +780,7 @@ static struct clksrc_clk clksrcs[] = {
839 { 780 {
840 .clk = { 781 .clk = {
841 .name = "uclk1", 782 .name = "uclk1",
842 .id = 0, 783 .devname = "s5pv210-uart.0",
843 .enable = exynos4_clksrc_mask_peril0_ctrl, 784 .enable = exynos4_clksrc_mask_peril0_ctrl,
844 .ctrlbit = (1 << 0), 785 .ctrlbit = (1 << 0),
845 }, 786 },
@@ -849,7 +790,7 @@ static struct clksrc_clk clksrcs[] = {
849 }, { 790 }, {
850 .clk = { 791 .clk = {
851 .name = "uclk1", 792 .name = "uclk1",
852 .id = 1, 793 .devname = "s5pv210-uart.1",
853 .enable = exynos4_clksrc_mask_peril0_ctrl, 794 .enable = exynos4_clksrc_mask_peril0_ctrl,
854 .ctrlbit = (1 << 4), 795 .ctrlbit = (1 << 4),
855 }, 796 },
@@ -859,7 +800,7 @@ static struct clksrc_clk clksrcs[] = {
859 }, { 800 }, {
860 .clk = { 801 .clk = {
861 .name = "uclk1", 802 .name = "uclk1",
862 .id = 2, 803 .devname = "s5pv210-uart.2",
863 .enable = exynos4_clksrc_mask_peril0_ctrl, 804 .enable = exynos4_clksrc_mask_peril0_ctrl,
864 .ctrlbit = (1 << 8), 805 .ctrlbit = (1 << 8),
865 }, 806 },
@@ -869,7 +810,7 @@ static struct clksrc_clk clksrcs[] = {
869 }, { 810 }, {
870 .clk = { 811 .clk = {
871 .name = "uclk1", 812 .name = "uclk1",
872 .id = 3, 813 .devname = "s5pv210-uart.3",
873 .enable = exynos4_clksrc_mask_peril0_ctrl, 814 .enable = exynos4_clksrc_mask_peril0_ctrl,
874 .ctrlbit = (1 << 12), 815 .ctrlbit = (1 << 12),
875 }, 816 },
@@ -879,7 +820,6 @@ static struct clksrc_clk clksrcs[] = {
879 }, { 820 }, {
880 .clk = { 821 .clk = {
881 .name = "sclk_pwm", 822 .name = "sclk_pwm",
882 .id = -1,
883 .enable = exynos4_clksrc_mask_peril0_ctrl, 823 .enable = exynos4_clksrc_mask_peril0_ctrl,
884 .ctrlbit = (1 << 24), 824 .ctrlbit = (1 << 24),
885 }, 825 },
@@ -889,7 +829,7 @@ static struct clksrc_clk clksrcs[] = {
889 }, { 829 }, {
890 .clk = { 830 .clk = {
891 .name = "sclk_csis", 831 .name = "sclk_csis",
892 .id = 0, 832 .devname = "s5p-mipi-csis.0",
893 .enable = exynos4_clksrc_mask_cam_ctrl, 833 .enable = exynos4_clksrc_mask_cam_ctrl,
894 .ctrlbit = (1 << 24), 834 .ctrlbit = (1 << 24),
895 }, 835 },
@@ -899,7 +839,7 @@ static struct clksrc_clk clksrcs[] = {
899 }, { 839 }, {
900 .clk = { 840 .clk = {
901 .name = "sclk_csis", 841 .name = "sclk_csis",
902 .id = 1, 842 .devname = "s5p-mipi-csis.1",
903 .enable = exynos4_clksrc_mask_cam_ctrl, 843 .enable = exynos4_clksrc_mask_cam_ctrl,
904 .ctrlbit = (1 << 28), 844 .ctrlbit = (1 << 28),
905 }, 845 },
@@ -909,7 +849,7 @@ static struct clksrc_clk clksrcs[] = {
909 }, { 849 }, {
910 .clk = { 850 .clk = {
911 .name = "sclk_cam", 851 .name = "sclk_cam",
912 .id = 0, 852 .devname = "exynos4-fimc.0",
913 .enable = exynos4_clksrc_mask_cam_ctrl, 853 .enable = exynos4_clksrc_mask_cam_ctrl,
914 .ctrlbit = (1 << 16), 854 .ctrlbit = (1 << 16),
915 }, 855 },
@@ -919,7 +859,7 @@ static struct clksrc_clk clksrcs[] = {
919 }, { 859 }, {
920 .clk = { 860 .clk = {
921 .name = "sclk_cam", 861 .name = "sclk_cam",
922 .id = 1, 862 .devname = "exynos4-fimc.1",
923 .enable = exynos4_clksrc_mask_cam_ctrl, 863 .enable = exynos4_clksrc_mask_cam_ctrl,
924 .ctrlbit = (1 << 20), 864 .ctrlbit = (1 << 20),
925 }, 865 },
@@ -929,7 +869,7 @@ static struct clksrc_clk clksrcs[] = {
929 }, { 869 }, {
930 .clk = { 870 .clk = {
931 .name = "sclk_fimc", 871 .name = "sclk_fimc",
932 .id = 0, 872 .devname = "exynos4-fimc.0",
933 .enable = exynos4_clksrc_mask_cam_ctrl, 873 .enable = exynos4_clksrc_mask_cam_ctrl,
934 .ctrlbit = (1 << 0), 874 .ctrlbit = (1 << 0),
935 }, 875 },
@@ -939,7 +879,7 @@ static struct clksrc_clk clksrcs[] = {
939 }, { 879 }, {
940 .clk = { 880 .clk = {
941 .name = "sclk_fimc", 881 .name = "sclk_fimc",
942 .id = 1, 882 .devname = "exynos4-fimc.1",
943 .enable = exynos4_clksrc_mask_cam_ctrl, 883 .enable = exynos4_clksrc_mask_cam_ctrl,
944 .ctrlbit = (1 << 4), 884 .ctrlbit = (1 << 4),
945 }, 885 },
@@ -949,7 +889,7 @@ static struct clksrc_clk clksrcs[] = {
949 }, { 889 }, {
950 .clk = { 890 .clk = {
951 .name = "sclk_fimc", 891 .name = "sclk_fimc",
952 .id = 2, 892 .devname = "exynos4-fimc.2",
953 .enable = exynos4_clksrc_mask_cam_ctrl, 893 .enable = exynos4_clksrc_mask_cam_ctrl,
954 .ctrlbit = (1 << 8), 894 .ctrlbit = (1 << 8),
955 }, 895 },
@@ -959,7 +899,7 @@ static struct clksrc_clk clksrcs[] = {
959 }, { 899 }, {
960 .clk = { 900 .clk = {
961 .name = "sclk_fimc", 901 .name = "sclk_fimc",
962 .id = 3, 902 .devname = "exynos4-fimc.3",
963 .enable = exynos4_clksrc_mask_cam_ctrl, 903 .enable = exynos4_clksrc_mask_cam_ctrl,
964 .ctrlbit = (1 << 12), 904 .ctrlbit = (1 << 12),
965 }, 905 },
@@ -969,7 +909,7 @@ static struct clksrc_clk clksrcs[] = {
969 }, { 909 }, {
970 .clk = { 910 .clk = {
971 .name = "sclk_fimd", 911 .name = "sclk_fimd",
972 .id = 0, 912 .devname = "exynos4-fb.0",
973 .enable = exynos4_clksrc_mask_lcd0_ctrl, 913 .enable = exynos4_clksrc_mask_lcd0_ctrl,
974 .ctrlbit = (1 << 0), 914 .ctrlbit = (1 << 0),
975 }, 915 },
@@ -979,7 +919,7 @@ static struct clksrc_clk clksrcs[] = {
979 }, { 919 }, {
980 .clk = { 920 .clk = {
981 .name = "sclk_fimd", 921 .name = "sclk_fimd",
982 .id = 1, 922 .devname = "exynos4-fb.1",
983 .enable = exynos4_clksrc_mask_lcd1_ctrl, 923 .enable = exynos4_clksrc_mask_lcd1_ctrl,
984 .ctrlbit = (1 << 0), 924 .ctrlbit = (1 << 0),
985 }, 925 },
@@ -989,7 +929,6 @@ static struct clksrc_clk clksrcs[] = {
989 }, { 929 }, {
990 .clk = { 930 .clk = {
991 .name = "sclk_sata", 931 .name = "sclk_sata",
992 .id = -1,
993 .enable = exynos4_clksrc_mask_fsys_ctrl, 932 .enable = exynos4_clksrc_mask_fsys_ctrl,
994 .ctrlbit = (1 << 24), 933 .ctrlbit = (1 << 24),
995 }, 934 },
@@ -999,7 +938,7 @@ static struct clksrc_clk clksrcs[] = {
999 }, { 938 }, {
1000 .clk = { 939 .clk = {
1001 .name = "sclk_spi", 940 .name = "sclk_spi",
1002 .id = 0, 941 .devname = "s3c64xx-spi.0",
1003 .enable = exynos4_clksrc_mask_peril1_ctrl, 942 .enable = exynos4_clksrc_mask_peril1_ctrl,
1004 .ctrlbit = (1 << 16), 943 .ctrlbit = (1 << 16),
1005 }, 944 },
@@ -1009,7 +948,7 @@ static struct clksrc_clk clksrcs[] = {
1009 }, { 948 }, {
1010 .clk = { 949 .clk = {
1011 .name = "sclk_spi", 950 .name = "sclk_spi",
1012 .id = 1, 951 .devname = "s3c64xx-spi.1",
1013 .enable = exynos4_clksrc_mask_peril1_ctrl, 952 .enable = exynos4_clksrc_mask_peril1_ctrl,
1014 .ctrlbit = (1 << 20), 953 .ctrlbit = (1 << 20),
1015 }, 954 },
@@ -1019,7 +958,7 @@ static struct clksrc_clk clksrcs[] = {
1019 }, { 958 }, {
1020 .clk = { 959 .clk = {
1021 .name = "sclk_spi", 960 .name = "sclk_spi",
1022 .id = 2, 961 .devname = "s3c64xx-spi.2",
1023 .enable = exynos4_clksrc_mask_peril1_ctrl, 962 .enable = exynos4_clksrc_mask_peril1_ctrl,
1024 .ctrlbit = (1 << 24), 963 .ctrlbit = (1 << 24),
1025 }, 964 },
@@ -1029,7 +968,6 @@ static struct clksrc_clk clksrcs[] = {
1029 }, { 968 }, {
1030 .clk = { 969 .clk = {
1031 .name = "sclk_fimg2d", 970 .name = "sclk_fimg2d",
1032 .id = -1,
1033 }, 971 },
1034 .sources = &clkset_mout_g2d, 972 .sources = &clkset_mout_g2d,
1035 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 }, 973 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 },
@@ -1037,7 +975,7 @@ static struct clksrc_clk clksrcs[] = {
1037 }, { 975 }, {
1038 .clk = { 976 .clk = {
1039 .name = "sclk_mmc", 977 .name = "sclk_mmc",
1040 .id = 0, 978 .devname = "s3c-sdhci.0",
1041 .parent = &clk_dout_mmc0.clk, 979 .parent = &clk_dout_mmc0.clk,
1042 .enable = exynos4_clksrc_mask_fsys_ctrl, 980 .enable = exynos4_clksrc_mask_fsys_ctrl,
1043 .ctrlbit = (1 << 0), 981 .ctrlbit = (1 << 0),
@@ -1046,7 +984,7 @@ static struct clksrc_clk clksrcs[] = {
1046 }, { 984 }, {
1047 .clk = { 985 .clk = {
1048 .name = "sclk_mmc", 986 .name = "sclk_mmc",
1049 .id = 1, 987 .devname = "s3c-sdhci.1",
1050 .parent = &clk_dout_mmc1.clk, 988 .parent = &clk_dout_mmc1.clk,
1051 .enable = exynos4_clksrc_mask_fsys_ctrl, 989 .enable = exynos4_clksrc_mask_fsys_ctrl,
1052 .ctrlbit = (1 << 4), 990 .ctrlbit = (1 << 4),
@@ -1055,7 +993,7 @@ static struct clksrc_clk clksrcs[] = {
1055 }, { 993 }, {
1056 .clk = { 994 .clk = {
1057 .name = "sclk_mmc", 995 .name = "sclk_mmc",
1058 .id = 2, 996 .devname = "s3c-sdhci.2",
1059 .parent = &clk_dout_mmc2.clk, 997 .parent = &clk_dout_mmc2.clk,
1060 .enable = exynos4_clksrc_mask_fsys_ctrl, 998 .enable = exynos4_clksrc_mask_fsys_ctrl,
1061 .ctrlbit = (1 << 8), 999 .ctrlbit = (1 << 8),
@@ -1064,7 +1002,7 @@ static struct clksrc_clk clksrcs[] = {
1064 }, { 1002 }, {
1065 .clk = { 1003 .clk = {
1066 .name = "sclk_mmc", 1004 .name = "sclk_mmc",
1067 .id = 3, 1005 .devname = "s3c-sdhci.3",
1068 .parent = &clk_dout_mmc3.clk, 1006 .parent = &clk_dout_mmc3.clk,
1069 .enable = exynos4_clksrc_mask_fsys_ctrl, 1007 .enable = exynos4_clksrc_mask_fsys_ctrl,
1070 .ctrlbit = (1 << 12), 1008 .ctrlbit = (1 << 12),
@@ -1072,8 +1010,7 @@ static struct clksrc_clk clksrcs[] = {
1072 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 }, 1010 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1073 }, { 1011 }, {
1074 .clk = { 1012 .clk = {
1075 .name = "sclk_mmc", 1013 .name = "sclk_dwmmc",
1076 .id = 4,
1077 .parent = &clk_dout_mmc4.clk, 1014 .parent = &clk_dout_mmc4.clk,
1078 .enable = exynos4_clksrc_mask_fsys_ctrl, 1015 .enable = exynos4_clksrc_mask_fsys_ctrl,
1079 .ctrlbit = (1 << 16), 1016 .ctrlbit = (1 << 16),
diff --git a/arch/arm/mach-exynos4/cpu.c b/arch/arm/mach-exynos4/cpu.c
index 9babe4473e88..bfd621460abf 100644
--- a/arch/arm/mach-exynos4/cpu.c
+++ b/arch/arm/mach-exynos4/cpu.c
@@ -23,6 +23,7 @@
23#include <plat/sdhci.h> 23#include <plat/sdhci.h>
24#include <plat/devs.h> 24#include <plat/devs.h>
25#include <plat/fimc-core.h> 25#include <plat/fimc-core.h>
26#include <plat/iic-core.h>
26 27
27#include <mach/regs-irq.h> 28#include <mach/regs-irq.h>
28 29
@@ -132,6 +133,11 @@ void __init exynos4_map_io(void)
132 s3c_fimc_setname(1, "exynos4-fimc"); 133 s3c_fimc_setname(1, "exynos4-fimc");
133 s3c_fimc_setname(2, "exynos4-fimc"); 134 s3c_fimc_setname(2, "exynos4-fimc");
134 s3c_fimc_setname(3, "exynos4-fimc"); 135 s3c_fimc_setname(3, "exynos4-fimc");
136
137 /* The I2C bus controllers are directly compatible with s3c2440 */
138 s3c_i2c0_setname("s3c2440-i2c");
139 s3c_i2c1_setname("s3c2440-i2c");
140 s3c_i2c2_setname("s3c2440-i2c");
135} 141}
136 142
137void __init exynos4_init_clocks(int xtal) 143void __init exynos4_init_clocks(int xtal)
diff --git a/arch/arm/mach-exynos4/dev-audio.c b/arch/arm/mach-exynos4/dev-audio.c
index 1eed5f9f7bd3..983069a53239 100644
--- a/arch/arm/mach-exynos4/dev-audio.c
+++ b/arch/arm/mach-exynos4/dev-audio.c
@@ -330,7 +330,7 @@ struct platform_device exynos4_device_ac97 = {
330 330
331static int exynos4_spdif_cfg_gpio(struct platform_device *pdev) 331static int exynos4_spdif_cfg_gpio(struct platform_device *pdev)
332{ 332{
333 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 2, S3C_GPIO_SFN(3)); 333 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 2, S3C_GPIO_SFN(4));
334 334
335 return 0; 335 return 0;
336} 336}
diff --git a/arch/arm/mach-exynos4/headsmp.S b/arch/arm/mach-exynos4/headsmp.S
index 6c6cfc50c46b..3cdeb3647542 100644
--- a/arch/arm/mach-exynos4/headsmp.S
+++ b/arch/arm/mach-exynos4/headsmp.S
@@ -13,7 +13,7 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/init.h> 14#include <linux/init.h>
15 15
16 __INIT 16 __CPUINIT
17 17
18/* 18/*
19 * exynos4 specific entry point for secondary CPUs. This provides 19 * exynos4 specific entry point for secondary CPUs. This provides
diff --git a/arch/arm/mach-exynos4/include/mach/clkdev.h b/arch/arm/mach-exynos4/include/mach/clkdev.h
new file mode 100644
index 000000000000..7dffa83d23ff
--- /dev/null
+++ b/arch/arm/mach-exynos4/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __MACH_CLKDEV_H__
2#define __MACH_CLKDEV_H__
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do {} while (0)
6
7#endif
diff --git a/arch/arm/mach-exynos4/mach-smdkc210.c b/arch/arm/mach-exynos4/mach-smdkc210.c
index e645f7a955f0..f606ea75bf43 100644
--- a/arch/arm/mach-exynos4/mach-smdkc210.c
+++ b/arch/arm/mach-exynos4/mach-smdkc210.c
@@ -15,6 +15,7 @@
15#include <linux/smsc911x.h> 15#include <linux/smsc911x.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/pwm_backlight.h>
18 19
19#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
@@ -27,6 +28,8 @@
27#include <plat/sdhci.h> 28#include <plat/sdhci.h>
28#include <plat/iic.h> 29#include <plat/iic.h>
29#include <plat/pd.h> 30#include <plat/pd.h>
31#include <plat/gpio-cfg.h>
32#include <plat/backlight.h>
30 33
31#include <mach/map.h> 34#include <mach/map.h>
32 35
@@ -191,6 +194,17 @@ static void __init smdkc210_smsc911x_init(void)
191 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1); 194 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
192} 195}
193 196
197/* LCD Backlight data */
198static struct samsung_bl_gpio_info smdkc210_bl_gpio_info = {
199 .no = EXYNOS4_GPD0(1),
200 .func = S3C_GPIO_SFN(2),
201};
202
203static struct platform_pwm_backlight_data smdkc210_bl_data = {
204 .pwm_id = 1,
205 .pwm_period_ns = 1000,
206};
207
194static void __init smdkc210_map_io(void) 208static void __init smdkc210_map_io(void)
195{ 209{
196 s5p_init_io(NULL, 0, S5P_VA_CHIPID); 210 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
@@ -210,6 +224,8 @@ static void __init smdkc210_machine_init(void)
210 s3c_sdhci2_set_platdata(&smdkc210_hsmmc2_pdata); 224 s3c_sdhci2_set_platdata(&smdkc210_hsmmc2_pdata);
211 s3c_sdhci3_set_platdata(&smdkc210_hsmmc3_pdata); 225 s3c_sdhci3_set_platdata(&smdkc210_hsmmc3_pdata);
212 226
227 samsung_bl_set(&smdkc210_bl_gpio_info, &smdkc210_bl_data);
228
213 platform_add_devices(smdkc210_devices, ARRAY_SIZE(smdkc210_devices)); 229 platform_add_devices(smdkc210_devices, ARRAY_SIZE(smdkc210_devices));
214} 230}
215 231
diff --git a/arch/arm/mach-exynos4/mach-smdkv310.c b/arch/arm/mach-exynos4/mach-smdkv310.c
index 152676471b67..df1107828abd 100644
--- a/arch/arm/mach-exynos4/mach-smdkv310.c
+++ b/arch/arm/mach-exynos4/mach-smdkv310.c
@@ -16,6 +16,7 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/pwm_backlight.h>
19 20
20#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
@@ -29,6 +30,8 @@
29#include <plat/sdhci.h> 30#include <plat/sdhci.h>
30#include <plat/iic.h> 31#include <plat/iic.h>
31#include <plat/pd.h> 32#include <plat/pd.h>
33#include <plat/gpio-cfg.h>
34#include <plat/backlight.h>
32 35
33#include <mach/map.h> 36#include <mach/map.h>
34 37
@@ -78,9 +81,7 @@ static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
78}; 81};
79 82
80static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = { 83static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = {
81 .cd_type = S3C_SDHCI_CD_GPIO, 84 .cd_type = S3C_SDHCI_CD_INTERNAL,
82 .ext_cd_gpio = EXYNOS4_GPK0(2),
83 .ext_cd_gpio_invert = 1,
84 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, 85 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
85#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT 86#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
86 .max_width = 8, 87 .max_width = 8,
@@ -96,9 +97,7 @@ static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
96}; 97};
97 98
98static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = { 99static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
99 .cd_type = S3C_SDHCI_CD_GPIO, 100 .cd_type = S3C_SDHCI_CD_INTERNAL,
100 .ext_cd_gpio = EXYNOS4_GPK2(2),
101 .ext_cd_gpio_invert = 1,
102 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, 101 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
103#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT 102#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
104 .max_width = 8, 103 .max_width = 8,
@@ -213,6 +212,17 @@ static void __init smdkv310_smsc911x_init(void)
213 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1); 212 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
214} 213}
215 214
215/* LCD Backlight data */
216static struct samsung_bl_gpio_info smdkv310_bl_gpio_info = {
217 .no = EXYNOS4_GPD0(1),
218 .func = S3C_GPIO_SFN(2),
219};
220
221static struct platform_pwm_backlight_data smdkv310_bl_data = {
222 .pwm_id = 1,
223 .pwm_period_ns = 1000,
224};
225
216static void __init smdkv310_map_io(void) 226static void __init smdkv310_map_io(void)
217{ 227{
218 s5p_init_io(NULL, 0, S5P_VA_CHIPID); 228 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
@@ -234,6 +244,8 @@ static void __init smdkv310_machine_init(void)
234 244
235 samsung_keypad_set_platdata(&smdkv310_keypad_data); 245 samsung_keypad_set_platdata(&smdkv310_keypad_data);
236 246
247 samsung_bl_set(&smdkv310_bl_gpio_info, &smdkv310_bl_data);
248
237 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices)); 249 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
238} 250}
239 251
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index f1ac7fbf54a9..312ea6b0409d 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -215,7 +215,7 @@ static struct omap_kp_platform_data ams_delta_kp_data __initdata = {
215 .delay = 9, 215 .delay = 9,
216}; 216};
217 217
218static struct platform_device ams_delta_kp_device __initdata = { 218static struct platform_device ams_delta_kp_device = {
219 .name = "omap-keypad", 219 .name = "omap-keypad",
220 .id = -1, 220 .id = -1,
221 .dev = { 221 .dev = {
@@ -225,12 +225,12 @@ static struct platform_device ams_delta_kp_device __initdata = {
225 .resource = ams_delta_kp_resources, 225 .resource = ams_delta_kp_resources,
226}; 226};
227 227
228static struct platform_device ams_delta_lcd_device __initdata = { 228static struct platform_device ams_delta_lcd_device = {
229 .name = "lcd_ams_delta", 229 .name = "lcd_ams_delta",
230 .id = -1, 230 .id = -1,
231}; 231};
232 232
233static struct platform_device ams_delta_led_device __initdata = { 233static struct platform_device ams_delta_led_device = {
234 .name = "ams-delta-led", 234 .name = "ams-delta-led",
235 .id = -1 235 .id = -1
236}; 236};
@@ -267,7 +267,7 @@ static struct soc_camera_link ams_delta_iclink = {
267 .power = ams_delta_camera_power, 267 .power = ams_delta_camera_power,
268}; 268};
269 269
270static struct platform_device ams_delta_camera_device __initdata = { 270static struct platform_device ams_delta_camera_device = {
271 .name = "soc-camera-pdrv", 271 .name = "soc-camera-pdrv",
272 .id = 0, 272 .id = 0,
273 .dev = { 273 .dev = {
diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
index 04c4b04cf54e..364137c2042c 100644
--- a/arch/arm/mach-omap1/gpio15xx.c
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -41,7 +41,7 @@ static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
41 .bank_stride = 1, 41 .bank_stride = 1,
42}; 42};
43 43
44static struct __initdata platform_device omap15xx_mpu_gpio = { 44static struct platform_device omap15xx_mpu_gpio = {
45 .name = "omap_gpio", 45 .name = "omap_gpio",
46 .id = 0, 46 .id = 0,
47 .dev = { 47 .dev = {
@@ -70,7 +70,7 @@ static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
70 .bank_width = 16, 70 .bank_width = 16,
71}; 71};
72 72
73static struct __initdata platform_device omap15xx_gpio = { 73static struct platform_device omap15xx_gpio = {
74 .name = "omap_gpio", 74 .name = "omap_gpio",
75 .id = 1, 75 .id = 1,
76 .dev = { 76 .dev = {
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
index 5dd0d4c82b24..293a246e2824 100644
--- a/arch/arm/mach-omap1/gpio16xx.c
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -44,7 +44,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
44 .bank_stride = 1, 44 .bank_stride = 1,
45}; 45};
46 46
47static struct __initdata platform_device omap16xx_mpu_gpio = { 47static struct platform_device omap16xx_mpu_gpio = {
48 .name = "omap_gpio", 48 .name = "omap_gpio",
49 .id = 0, 49 .id = 0,
50 .dev = { 50 .dev = {
@@ -73,7 +73,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
73 .bank_width = 16, 73 .bank_width = 16,
74}; 74};
75 75
76static struct __initdata platform_device omap16xx_gpio1 = { 76static struct platform_device omap16xx_gpio1 = {
77 .name = "omap_gpio", 77 .name = "omap_gpio",
78 .id = 1, 78 .id = 1,
79 .dev = { 79 .dev = {
@@ -102,7 +102,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = {
102 .bank_width = 16, 102 .bank_width = 16,
103}; 103};
104 104
105static struct __initdata platform_device omap16xx_gpio2 = { 105static struct platform_device omap16xx_gpio2 = {
106 .name = "omap_gpio", 106 .name = "omap_gpio",
107 .id = 2, 107 .id = 2,
108 .dev = { 108 .dev = {
@@ -131,7 +131,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = {
131 .bank_width = 16, 131 .bank_width = 16,
132}; 132};
133 133
134static struct __initdata platform_device omap16xx_gpio3 = { 134static struct platform_device omap16xx_gpio3 = {
135 .name = "omap_gpio", 135 .name = "omap_gpio",
136 .id = 3, 136 .id = 3,
137 .dev = { 137 .dev = {
@@ -160,7 +160,7 @@ static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = {
160 .bank_width = 16, 160 .bank_width = 16,
161}; 161};
162 162
163static struct __initdata platform_device omap16xx_gpio4 = { 163static struct platform_device omap16xx_gpio4 = {
164 .name = "omap_gpio", 164 .name = "omap_gpio",
165 .id = 4, 165 .id = 4,
166 .dev = { 166 .dev = {
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
index 1204c8b871af..c6ad248d63a6 100644
--- a/arch/arm/mach-omap1/gpio7xx.c
+++ b/arch/arm/mach-omap1/gpio7xx.c
@@ -46,7 +46,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
46 .bank_stride = 2, 46 .bank_stride = 2,
47}; 47};
48 48
49static struct __initdata platform_device omap7xx_mpu_gpio = { 49static struct platform_device omap7xx_mpu_gpio = {
50 .name = "omap_gpio", 50 .name = "omap_gpio",
51 .id = 0, 51 .id = 0,
52 .dev = { 52 .dev = {
@@ -75,7 +75,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
75 .bank_width = 32, 75 .bank_width = 32,
76}; 76};
77 77
78static struct __initdata platform_device omap7xx_gpio1 = { 78static struct platform_device omap7xx_gpio1 = {
79 .name = "omap_gpio", 79 .name = "omap_gpio",
80 .id = 1, 80 .id = 1,
81 .dev = { 81 .dev = {
@@ -104,7 +104,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = {
104 .bank_width = 32, 104 .bank_width = 32,
105}; 105};
106 106
107static struct __initdata platform_device omap7xx_gpio2 = { 107static struct platform_device omap7xx_gpio2 = {
108 .name = "omap_gpio", 108 .name = "omap_gpio",
109 .id = 2, 109 .id = 2,
110 .dev = { 110 .dev = {
@@ -133,7 +133,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = {
133 .bank_width = 32, 133 .bank_width = 32,
134}; 134};
135 135
136static struct __initdata platform_device omap7xx_gpio3 = { 136static struct platform_device omap7xx_gpio3 = {
137 .name = "omap_gpio", 137 .name = "omap_gpio",
138 .id = 3, 138 .id = 3,
139 .dev = { 139 .dev = {
@@ -162,7 +162,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = {
162 .bank_width = 32, 162 .bank_width = 32,
163}; 163};
164 164
165static struct __initdata platform_device omap7xx_gpio4 = { 165static struct platform_device omap7xx_gpio4 = {
166 .name = "omap_gpio", 166 .name = "omap_gpio",
167 .id = 4, 167 .id = 4,
168 .dev = { 168 .dev = {
@@ -191,7 +191,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = {
191 .bank_width = 32, 191 .bank_width = 32,
192}; 192};
193 193
194static struct __initdata platform_device omap7xx_gpio5 = { 194static struct platform_device omap7xx_gpio5 = {
195 .name = "omap_gpio", 195 .name = "omap_gpio",
196 .id = 5, 196 .id = 5,
197 .dev = { 197 .dev = {
@@ -220,7 +220,7 @@ static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = {
220 .bank_width = 32, 220 .bank_width = 32,
221}; 221};
222 222
223static struct __initdata platform_device omap7xx_gpio6 = { 223static struct platform_device omap7xx_gpio6 = {
224 .name = "omap_gpio", 224 .name = "omap_gpio",
225 .id = 6, 225 .id = 6,
226 .dev = { 226 .dev = {
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 6140290721a0..bdb24db36004 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -538,7 +538,7 @@ static struct radio_si4713_platform_data rx51_si4713_data __initdata_or_module =
538 .subdev_board_info = &rx51_si4713_board_info, 538 .subdev_board_info = &rx51_si4713_board_info,
539}; 539};
540 540
541static struct platform_device rx51_si4713_dev __initdata_or_module = { 541static struct platform_device rx51_si4713_dev = {
542 .name = "radio-si4713", 542 .name = "radio-si4713",
543 .id = -1, 543 .id = -1,
544 .dev = { 544 .dev = {
diff --git a/arch/arm/mach-s3c2412/clock.c b/arch/arm/mach-s3c2412/clock.c
index 0c0505b025cb..140711db6c89 100644
--- a/arch/arm/mach-s3c2412/clock.c
+++ b/arch/arm/mach-s3c2412/clock.c
@@ -95,12 +95,10 @@ static int s3c2412_upll_enable(struct clk *clk, int enable)
95 95
96static struct clk clk_erefclk = { 96static struct clk clk_erefclk = {
97 .name = "erefclk", 97 .name = "erefclk",
98 .id = -1,
99}; 98};
100 99
101static struct clk clk_urefclk = { 100static struct clk clk_urefclk = {
102 .name = "urefclk", 101 .name = "urefclk",
103 .id = -1,
104}; 102};
105 103
106static int s3c2412_setparent_usysclk(struct clk *clk, struct clk *parent) 104static int s3c2412_setparent_usysclk(struct clk *clk, struct clk *parent)
@@ -122,7 +120,6 @@ static int s3c2412_setparent_usysclk(struct clk *clk, struct clk *parent)
122 120
123static struct clk clk_usysclk = { 121static struct clk clk_usysclk = {
124 .name = "usysclk", 122 .name = "usysclk",
125 .id = -1,
126 .parent = &clk_xtal, 123 .parent = &clk_xtal,
127 .ops = &(struct clk_ops) { 124 .ops = &(struct clk_ops) {
128 .set_parent = s3c2412_setparent_usysclk, 125 .set_parent = s3c2412_setparent_usysclk,
@@ -132,13 +129,11 @@ static struct clk clk_usysclk = {
132static struct clk clk_mrefclk = { 129static struct clk clk_mrefclk = {
133 .name = "mrefclk", 130 .name = "mrefclk",
134 .parent = &clk_xtal, 131 .parent = &clk_xtal,
135 .id = -1,
136}; 132};
137 133
138static struct clk clk_mdivclk = { 134static struct clk clk_mdivclk = {
139 .name = "mdivclk", 135 .name = "mdivclk",
140 .parent = &clk_xtal, 136 .parent = &clk_xtal,
141 .id = -1,
142}; 137};
143 138
144static int s3c2412_setparent_usbsrc(struct clk *clk, struct clk *parent) 139static int s3c2412_setparent_usbsrc(struct clk *clk, struct clk *parent)
@@ -200,7 +195,6 @@ static int s3c2412_setrate_usbsrc(struct clk *clk, unsigned long rate)
200 195
201static struct clk clk_usbsrc = { 196static struct clk clk_usbsrc = {
202 .name = "usbsrc", 197 .name = "usbsrc",
203 .id = -1,
204 .ops = &(struct clk_ops) { 198 .ops = &(struct clk_ops) {
205 .get_rate = s3c2412_getrate_usbsrc, 199 .get_rate = s3c2412_getrate_usbsrc,
206 .set_rate = s3c2412_setrate_usbsrc, 200 .set_rate = s3c2412_setrate_usbsrc,
@@ -228,7 +222,6 @@ static int s3c2412_setparent_msysclk(struct clk *clk, struct clk *parent)
228 222
229static struct clk clk_msysclk = { 223static struct clk clk_msysclk = {
230 .name = "msysclk", 224 .name = "msysclk",
231 .id = -1,
232 .ops = &(struct clk_ops) { 225 .ops = &(struct clk_ops) {
233 .set_parent = s3c2412_setparent_msysclk, 226 .set_parent = s3c2412_setparent_msysclk,
234 }, 227 },
@@ -268,7 +261,6 @@ static int s3c2412_setparent_armclk(struct clk *clk, struct clk *parent)
268 261
269static struct clk clk_armclk = { 262static struct clk clk_armclk = {
270 .name = "armclk", 263 .name = "armclk",
271 .id = -1,
272 .parent = &clk_msysclk, 264 .parent = &clk_msysclk,
273 .ops = &(struct clk_ops) { 265 .ops = &(struct clk_ops) {
274 .set_parent = s3c2412_setparent_armclk, 266 .set_parent = s3c2412_setparent_armclk,
@@ -344,7 +336,6 @@ static int s3c2412_setrate_uart(struct clk *clk, unsigned long rate)
344 336
345static struct clk clk_uart = { 337static struct clk clk_uart = {
346 .name = "uartclk", 338 .name = "uartclk",
347 .id = -1,
348 .ops = &(struct clk_ops) { 339 .ops = &(struct clk_ops) {
349 .get_rate = s3c2412_getrate_uart, 340 .get_rate = s3c2412_getrate_uart,
350 .set_rate = s3c2412_setrate_uart, 341 .set_rate = s3c2412_setrate_uart,
@@ -397,7 +388,6 @@ static int s3c2412_setrate_i2s(struct clk *clk, unsigned long rate)
397 388
398static struct clk clk_i2s = { 389static struct clk clk_i2s = {
399 .name = "i2sclk", 390 .name = "i2sclk",
400 .id = -1,
401 .ops = &(struct clk_ops) { 391 .ops = &(struct clk_ops) {
402 .get_rate = s3c2412_getrate_i2s, 392 .get_rate = s3c2412_getrate_i2s,
403 .set_rate = s3c2412_setrate_i2s, 393 .set_rate = s3c2412_setrate_i2s,
@@ -449,7 +439,6 @@ static int s3c2412_setrate_cam(struct clk *clk, unsigned long rate)
449 439
450static struct clk clk_cam = { 440static struct clk clk_cam = {
451 .name = "camif-upll", /* same as 2440 name */ 441 .name = "camif-upll", /* same as 2440 name */
452 .id = -1,
453 .ops = &(struct clk_ops) { 442 .ops = &(struct clk_ops) {
454 .get_rate = s3c2412_getrate_cam, 443 .get_rate = s3c2412_getrate_cam,
455 .set_rate = s3c2412_setrate_cam, 444 .set_rate = s3c2412_setrate_cam,
@@ -463,37 +452,31 @@ static struct clk clk_cam = {
463static struct clk init_clocks_disable[] = { 452static struct clk init_clocks_disable[] = {
464 { 453 {
465 .name = "nand", 454 .name = "nand",
466 .id = -1,
467 .parent = &clk_h, 455 .parent = &clk_h,
468 .enable = s3c2412_clkcon_enable, 456 .enable = s3c2412_clkcon_enable,
469 .ctrlbit = S3C2412_CLKCON_NAND, 457 .ctrlbit = S3C2412_CLKCON_NAND,
470 }, { 458 }, {
471 .name = "sdi", 459 .name = "sdi",
472 .id = -1,
473 .parent = &clk_p, 460 .parent = &clk_p,
474 .enable = s3c2412_clkcon_enable, 461 .enable = s3c2412_clkcon_enable,
475 .ctrlbit = S3C2412_CLKCON_SDI, 462 .ctrlbit = S3C2412_CLKCON_SDI,
476 }, { 463 }, {
477 .name = "adc", 464 .name = "adc",
478 .id = -1,
479 .parent = &clk_p, 465 .parent = &clk_p,
480 .enable = s3c2412_clkcon_enable, 466 .enable = s3c2412_clkcon_enable,
481 .ctrlbit = S3C2412_CLKCON_ADC, 467 .ctrlbit = S3C2412_CLKCON_ADC,
482 }, { 468 }, {
483 .name = "i2c", 469 .name = "i2c",
484 .id = -1,
485 .parent = &clk_p, 470 .parent = &clk_p,
486 .enable = s3c2412_clkcon_enable, 471 .enable = s3c2412_clkcon_enable,
487 .ctrlbit = S3C2412_CLKCON_IIC, 472 .ctrlbit = S3C2412_CLKCON_IIC,
488 }, { 473 }, {
489 .name = "iis", 474 .name = "iis",
490 .id = -1,
491 .parent = &clk_p, 475 .parent = &clk_p,
492 .enable = s3c2412_clkcon_enable, 476 .enable = s3c2412_clkcon_enable,
493 .ctrlbit = S3C2412_CLKCON_IIS, 477 .ctrlbit = S3C2412_CLKCON_IIS,
494 }, { 478 }, {
495 .name = "spi", 479 .name = "spi",
496 .id = -1,
497 .parent = &clk_p, 480 .parent = &clk_p,
498 .enable = s3c2412_clkcon_enable, 481 .enable = s3c2412_clkcon_enable,
499 .ctrlbit = S3C2412_CLKCON_SPI, 482 .ctrlbit = S3C2412_CLKCON_SPI,
@@ -503,96 +486,83 @@ static struct clk init_clocks_disable[] = {
503static struct clk init_clocks[] = { 486static struct clk init_clocks[] = {
504 { 487 {
505 .name = "dma", 488 .name = "dma",
506 .id = 0,
507 .parent = &clk_h, 489 .parent = &clk_h,
508 .enable = s3c2412_clkcon_enable, 490 .enable = s3c2412_clkcon_enable,
509 .ctrlbit = S3C2412_CLKCON_DMA0, 491 .ctrlbit = S3C2412_CLKCON_DMA0,
510 }, { 492 }, {
511 .name = "dma", 493 .name = "dma",
512 .id = 1,
513 .parent = &clk_h, 494 .parent = &clk_h,
514 .enable = s3c2412_clkcon_enable, 495 .enable = s3c2412_clkcon_enable,
515 .ctrlbit = S3C2412_CLKCON_DMA1, 496 .ctrlbit = S3C2412_CLKCON_DMA1,
516 }, { 497 }, {
517 .name = "dma", 498 .name = "dma",
518 .id = 2,
519 .parent = &clk_h, 499 .parent = &clk_h,
520 .enable = s3c2412_clkcon_enable, 500 .enable = s3c2412_clkcon_enable,
521 .ctrlbit = S3C2412_CLKCON_DMA2, 501 .ctrlbit = S3C2412_CLKCON_DMA2,
522 }, { 502 }, {
523 .name = "dma", 503 .name = "dma",
524 .id = 3,
525 .parent = &clk_h, 504 .parent = &clk_h,
526 .enable = s3c2412_clkcon_enable, 505 .enable = s3c2412_clkcon_enable,
527 .ctrlbit = S3C2412_CLKCON_DMA3, 506 .ctrlbit = S3C2412_CLKCON_DMA3,
528 }, { 507 }, {
529 .name = "lcd", 508 .name = "lcd",
530 .id = -1,
531 .parent = &clk_h, 509 .parent = &clk_h,
532 .enable = s3c2412_clkcon_enable, 510 .enable = s3c2412_clkcon_enable,
533 .ctrlbit = S3C2412_CLKCON_LCDC, 511 .ctrlbit = S3C2412_CLKCON_LCDC,
534 }, { 512 }, {
535 .name = "gpio", 513 .name = "gpio",
536 .id = -1,
537 .parent = &clk_p, 514 .parent = &clk_p,
538 .enable = s3c2412_clkcon_enable, 515 .enable = s3c2412_clkcon_enable,
539 .ctrlbit = S3C2412_CLKCON_GPIO, 516 .ctrlbit = S3C2412_CLKCON_GPIO,
540 }, { 517 }, {
541 .name = "usb-host", 518 .name = "usb-host",
542 .id = -1,
543 .parent = &clk_h, 519 .parent = &clk_h,
544 .enable = s3c2412_clkcon_enable, 520 .enable = s3c2412_clkcon_enable,
545 .ctrlbit = S3C2412_CLKCON_USBH, 521 .ctrlbit = S3C2412_CLKCON_USBH,
546 }, { 522 }, {
547 .name = "usb-device", 523 .name = "usb-device",
548 .id = -1,
549 .parent = &clk_h, 524 .parent = &clk_h,
550 .enable = s3c2412_clkcon_enable, 525 .enable = s3c2412_clkcon_enable,
551 .ctrlbit = S3C2412_CLKCON_USBD, 526 .ctrlbit = S3C2412_CLKCON_USBD,
552 }, { 527 }, {
553 .name = "timers", 528 .name = "timers",
554 .id = -1,
555 .parent = &clk_p, 529 .parent = &clk_p,
556 .enable = s3c2412_clkcon_enable, 530 .enable = s3c2412_clkcon_enable,
557 .ctrlbit = S3C2412_CLKCON_PWMT, 531 .ctrlbit = S3C2412_CLKCON_PWMT,
558 }, { 532 }, {
559 .name = "uart", 533 .name = "uart",
560 .id = 0, 534 .devname = "s3c2412-uart.0",
561 .parent = &clk_p, 535 .parent = &clk_p,
562 .enable = s3c2412_clkcon_enable, 536 .enable = s3c2412_clkcon_enable,
563 .ctrlbit = S3C2412_CLKCON_UART0, 537 .ctrlbit = S3C2412_CLKCON_UART0,
564 }, { 538 }, {
565 .name = "uart", 539 .name = "uart",
566 .id = 1, 540 .devname = "s3c2412-uart.1",
567 .parent = &clk_p, 541 .parent = &clk_p,
568 .enable = s3c2412_clkcon_enable, 542 .enable = s3c2412_clkcon_enable,
569 .ctrlbit = S3C2412_CLKCON_UART1, 543 .ctrlbit = S3C2412_CLKCON_UART1,
570 }, { 544 }, {
571 .name = "uart", 545 .name = "uart",
572 .id = 2, 546 .devname = "s3c2412-uart.2",
573 .parent = &clk_p, 547 .parent = &clk_p,
574 .enable = s3c2412_clkcon_enable, 548 .enable = s3c2412_clkcon_enable,
575 .ctrlbit = S3C2412_CLKCON_UART2, 549 .ctrlbit = S3C2412_CLKCON_UART2,
576 }, { 550 }, {
577 .name = "rtc", 551 .name = "rtc",
578 .id = -1,
579 .parent = &clk_p, 552 .parent = &clk_p,
580 .enable = s3c2412_clkcon_enable, 553 .enable = s3c2412_clkcon_enable,
581 .ctrlbit = S3C2412_CLKCON_RTC, 554 .ctrlbit = S3C2412_CLKCON_RTC,
582 }, { 555 }, {
583 .name = "watchdog", 556 .name = "watchdog",
584 .id = -1,
585 .parent = &clk_p, 557 .parent = &clk_p,
586 .ctrlbit = 0, 558 .ctrlbit = 0,
587 }, { 559 }, {
588 .name = "usb-bus-gadget", 560 .name = "usb-bus-gadget",
589 .id = -1,
590 .parent = &clk_usb_bus, 561 .parent = &clk_usb_bus,
591 .enable = s3c2412_clkcon_enable, 562 .enable = s3c2412_clkcon_enable,
592 .ctrlbit = S3C2412_CLKCON_USB_DEV48, 563 .ctrlbit = S3C2412_CLKCON_USB_DEV48,
593 }, { 564 }, {
594 .name = "usb-bus-host", 565 .name = "usb-bus-host",
595 .id = -1,
596 .parent = &clk_usb_bus, 566 .parent = &clk_usb_bus,
597 .enable = s3c2412_clkcon_enable, 567 .enable = s3c2412_clkcon_enable,
598 .ctrlbit = S3C2412_CLKCON_USB_HOST48, 568 .ctrlbit = S3C2412_CLKCON_USB_HOST48,
diff --git a/arch/arm/mach-s3c2416/clock.c b/arch/arm/mach-s3c2416/clock.c
index 3b02d8506e25..21a5e81f0ab5 100644
--- a/arch/arm/mach-s3c2416/clock.c
+++ b/arch/arm/mach-s3c2416/clock.c
@@ -42,7 +42,7 @@ static struct clksrc_clk hsmmc_div[] = {
42 [0] = { 42 [0] = {
43 .clk = { 43 .clk = {
44 .name = "hsmmc-div", 44 .name = "hsmmc-div",
45 .id = 0, 45 .devname = "s3c-sdhci.0",
46 .parent = &clk_esysclk.clk, 46 .parent = &clk_esysclk.clk,
47 }, 47 },
48 .reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 }, 48 .reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 },
@@ -50,7 +50,7 @@ static struct clksrc_clk hsmmc_div[] = {
50 [1] = { 50 [1] = {
51 .clk = { 51 .clk = {
52 .name = "hsmmc-div", 52 .name = "hsmmc-div",
53 .id = 1, 53 .devname = "s3c-sdhci.1",
54 .parent = &clk_esysclk.clk, 54 .parent = &clk_esysclk.clk,
55 }, 55 },
56 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 }, 56 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
@@ -60,8 +60,8 @@ static struct clksrc_clk hsmmc_div[] = {
60static struct clksrc_clk hsmmc_mux[] = { 60static struct clksrc_clk hsmmc_mux[] = {
61 [0] = { 61 [0] = {
62 .clk = { 62 .clk = {
63 .id = 0,
64 .name = "hsmmc-if", 63 .name = "hsmmc-if",
64 .devname = "s3c-sdhci.0",
65 .ctrlbit = (1 << 6), 65 .ctrlbit = (1 << 6),
66 .enable = s3c2443_clkcon_enable_s, 66 .enable = s3c2443_clkcon_enable_s,
67 }, 67 },
@@ -76,8 +76,8 @@ static struct clksrc_clk hsmmc_mux[] = {
76 }, 76 },
77 [1] = { 77 [1] = {
78 .clk = { 78 .clk = {
79 .id = 1,
80 .name = "hsmmc-if", 79 .name = "hsmmc-if",
80 .devname = "s3c-sdhci.1",
81 .ctrlbit = (1 << 12), 81 .ctrlbit = (1 << 12),
82 .enable = s3c2443_clkcon_enable_s, 82 .enable = s3c2443_clkcon_enable_s,
83 }, 83 },
@@ -94,7 +94,7 @@ static struct clksrc_clk hsmmc_mux[] = {
94 94
95static struct clk hsmmc0_clk = { 95static struct clk hsmmc0_clk = {
96 .name = "hsmmc", 96 .name = "hsmmc",
97 .id = 0, 97 .devname = "s3c-sdhci.0",
98 .parent = &clk_h, 98 .parent = &clk_h,
99 .enable = s3c2443_clkcon_enable_h, 99 .enable = s3c2443_clkcon_enable_h,
100 .ctrlbit = S3C2416_HCLKCON_HSMMC0, 100 .ctrlbit = S3C2416_HCLKCON_HSMMC0,
diff --git a/arch/arm/mach-s3c2440/clock.c b/arch/arm/mach-s3c2440/clock.c
index 3dc2426e2345..554e0d3ec70b 100644
--- a/arch/arm/mach-s3c2440/clock.c
+++ b/arch/arm/mach-s3c2440/clock.c
@@ -90,14 +90,12 @@ static int s3c2440_camif_upll_setrate(struct clk *clk, unsigned long rate)
90 90
91static struct clk s3c2440_clk_cam = { 91static struct clk s3c2440_clk_cam = {
92 .name = "camif", 92 .name = "camif",
93 .id = -1,
94 .enable = s3c2410_clkcon_enable, 93 .enable = s3c2410_clkcon_enable,
95 .ctrlbit = S3C2440_CLKCON_CAMERA, 94 .ctrlbit = S3C2440_CLKCON_CAMERA,
96}; 95};
97 96
98static struct clk s3c2440_clk_cam_upll = { 97static struct clk s3c2440_clk_cam_upll = {
99 .name = "camif-upll", 98 .name = "camif-upll",
100 .id = -1,
101 .ops = &(struct clk_ops) { 99 .ops = &(struct clk_ops) {
102 .set_rate = s3c2440_camif_upll_setrate, 100 .set_rate = s3c2440_camif_upll_setrate,
103 .round_rate = s3c2440_camif_upll_round, 101 .round_rate = s3c2440_camif_upll_round,
@@ -106,7 +104,6 @@ static struct clk s3c2440_clk_cam_upll = {
106 104
107static struct clk s3c2440_clk_ac97 = { 105static struct clk s3c2440_clk_ac97 = {
108 .name = "ac97", 106 .name = "ac97",
109 .id = -1,
110 .enable = s3c2410_clkcon_enable, 107 .enable = s3c2410_clkcon_enable,
111 .ctrlbit = S3C2440_CLKCON_CAMERA, 108 .ctrlbit = S3C2440_CLKCON_CAMERA,
112}; 109};
diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
index dd3120df09fe..fc2dc0b3d4fe 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -552,7 +552,7 @@ struct mini2440_features_t {
552 struct platform_device *optional[8]; 552 struct platform_device *optional[8];
553}; 553};
554 554
555static void mini2440_parse_features( 555static void __init mini2440_parse_features(
556 struct mini2440_features_t * features, 556 struct mini2440_features_t * features,
557 const char * features_str ) 557 const char * features_str )
558{ 558{
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index f4ec6d5715c8..a1a7176675b9 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -59,7 +59,6 @@
59 59
60static struct clk clk_i2s_ext = { 60static struct clk clk_i2s_ext = {
61 .name = "i2s-ext", 61 .name = "i2s-ext",
62 .id = -1,
63}; 62};
64 63
65/* armdiv 64/* armdiv
@@ -139,7 +138,6 @@ static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate)
139 138
140static struct clk clk_armdiv = { 139static struct clk clk_armdiv = {
141 .name = "armdiv", 140 .name = "armdiv",
142 .id = -1,
143 .parent = &clk_msysclk.clk, 141 .parent = &clk_msysclk.clk,
144 .ops = &(struct clk_ops) { 142 .ops = &(struct clk_ops) {
145 .round_rate = s3c2443_armclk_roundrate, 143 .round_rate = s3c2443_armclk_roundrate,
@@ -160,7 +158,6 @@ static struct clk *clk_arm_sources[] = {
160static struct clksrc_clk clk_arm = { 158static struct clksrc_clk clk_arm = {
161 .clk = { 159 .clk = {
162 .name = "armclk", 160 .name = "armclk",
163 .id = -1,
164 }, 161 },
165 .sources = &(struct clksrc_sources) { 162 .sources = &(struct clksrc_sources) {
166 .sources = clk_arm_sources, 163 .sources = clk_arm_sources,
@@ -177,7 +174,6 @@ static struct clksrc_clk clk_arm = {
177static struct clksrc_clk clk_hsspi = { 174static struct clksrc_clk clk_hsspi = {
178 .clk = { 175 .clk = {
179 .name = "hsspi", 176 .name = "hsspi",
180 .id = -1,
181 .parent = &clk_esysclk.clk, 177 .parent = &clk_esysclk.clk,
182 .ctrlbit = S3C2443_SCLKCON_HSSPICLK, 178 .ctrlbit = S3C2443_SCLKCON_HSSPICLK,
183 .enable = s3c2443_clkcon_enable_s, 179 .enable = s3c2443_clkcon_enable_s,
@@ -196,7 +192,7 @@ static struct clksrc_clk clk_hsspi = {
196static struct clksrc_clk clk_hsmmc_div = { 192static struct clksrc_clk clk_hsmmc_div = {
197 .clk = { 193 .clk = {
198 .name = "hsmmc-div", 194 .name = "hsmmc-div",
199 .id = 1, 195 .devname = "s3c-sdhci.1",
200 .parent = &clk_esysclk.clk, 196 .parent = &clk_esysclk.clk,
201 }, 197 },
202 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 }, 198 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
@@ -231,7 +227,7 @@ static int s3c2443_enable_hsmmc(struct clk *clk, int enable)
231 227
232static struct clk clk_hsmmc = { 228static struct clk clk_hsmmc = {
233 .name = "hsmmc-if", 229 .name = "hsmmc-if",
234 .id = 1, 230 .devname = "s3c-sdhci.1",
235 .parent = &clk_hsmmc_div.clk, 231 .parent = &clk_hsmmc_div.clk,
236 .enable = s3c2443_enable_hsmmc, 232 .enable = s3c2443_enable_hsmmc,
237 .ops = &(struct clk_ops) { 233 .ops = &(struct clk_ops) {
@@ -248,7 +244,6 @@ static struct clk clk_hsmmc = {
248static struct clksrc_clk clk_i2s_eplldiv = { 244static struct clksrc_clk clk_i2s_eplldiv = {
249 .clk = { 245 .clk = {
250 .name = "i2s-eplldiv", 246 .name = "i2s-eplldiv",
251 .id = -1,
252 .parent = &clk_esysclk.clk, 247 .parent = &clk_esysclk.clk,
253 }, 248 },
254 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 12, }, 249 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 12, },
@@ -271,7 +266,6 @@ struct clk *clk_i2s_srclist[] = {
271static struct clksrc_clk clk_i2s = { 266static struct clksrc_clk clk_i2s = {
272 .clk = { 267 .clk = {
273 .name = "i2s-if", 268 .name = "i2s-if",
274 .id = -1,
275 .ctrlbit = S3C2443_SCLKCON_I2SCLK, 269 .ctrlbit = S3C2443_SCLKCON_I2SCLK,
276 .enable = s3c2443_clkcon_enable_s, 270 .enable = s3c2443_clkcon_enable_s,
277 271
@@ -288,25 +282,23 @@ static struct clksrc_clk clk_i2s = {
288static struct clk init_clocks_off[] = { 282static struct clk init_clocks_off[] = {
289 { 283 {
290 .name = "sdi", 284 .name = "sdi",
291 .id = -1,
292 .parent = &clk_p, 285 .parent = &clk_p,
293 .enable = s3c2443_clkcon_enable_p, 286 .enable = s3c2443_clkcon_enable_p,
294 .ctrlbit = S3C2443_PCLKCON_SDI, 287 .ctrlbit = S3C2443_PCLKCON_SDI,
295 }, { 288 }, {
296 .name = "iis", 289 .name = "iis",
297 .id = -1,
298 .parent = &clk_p, 290 .parent = &clk_p,
299 .enable = s3c2443_clkcon_enable_p, 291 .enable = s3c2443_clkcon_enable_p,
300 .ctrlbit = S3C2443_PCLKCON_IIS, 292 .ctrlbit = S3C2443_PCLKCON_IIS,
301 }, { 293 }, {
302 .name = "spi", 294 .name = "spi",
303 .id = 0, 295 .devname = "s3c2410-spi.0",
304 .parent = &clk_p, 296 .parent = &clk_p,
305 .enable = s3c2443_clkcon_enable_p, 297 .enable = s3c2443_clkcon_enable_p,
306 .ctrlbit = S3C2443_PCLKCON_SPI0, 298 .ctrlbit = S3C2443_PCLKCON_SPI0,
307 }, { 299 }, {
308 .name = "spi", 300 .name = "spi",
309 .id = 1, 301 .devname = "s3c2410-spi.1",
310 .parent = &clk_p, 302 .parent = &clk_p,
311 .enable = s3c2443_clkcon_enable_p, 303 .enable = s3c2443_clkcon_enable_p,
312 .ctrlbit = S3C2443_PCLKCON_SPI1, 304 .ctrlbit = S3C2443_PCLKCON_SPI1,
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index e4177e22557b..fdc89fc3b464 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -142,6 +142,7 @@ config MACH_SMDK6410
142 select S3C_DEV_USB_HOST 142 select S3C_DEV_USB_HOST
143 select S3C_DEV_USB_HSOTG 143 select S3C_DEV_USB_HSOTG
144 select S3C_DEV_WDT 144 select S3C_DEV_WDT
145 select SAMSUNG_DEV_BACKLIGHT
145 select SAMSUNG_DEV_KEYPAD 146 select SAMSUNG_DEV_KEYPAD
146 select SAMSUNG_DEV_PWM 147 select SAMSUNG_DEV_PWM
147 select HAVE_S3C2410_WATCHDOG if WATCHDOG 148 select HAVE_S3C2410_WATCHDOG if WATCHDOG
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c
index fdfc4d5e37a1..8cf39e33579e 100644
--- a/arch/arm/mach-s3c64xx/clock.c
+++ b/arch/arm/mach-s3c64xx/clock.c
@@ -39,7 +39,6 @@
39 39
40static struct clk clk_ext_xtal_mux = { 40static struct clk clk_ext_xtal_mux = {
41 .name = "ext_xtal", 41 .name = "ext_xtal",
42 .id = -1,
43}; 42};
44 43
45#define clk_fin_apll clk_ext_xtal_mux 44#define clk_fin_apll clk_ext_xtal_mux
@@ -51,13 +50,11 @@ static struct clk clk_ext_xtal_mux = {
51 50
52struct clk clk_h2 = { 51struct clk clk_h2 = {
53 .name = "hclk2", 52 .name = "hclk2",
54 .id = -1,
55 .rate = 0, 53 .rate = 0,
56}; 54};
57 55
58struct clk clk_27m = { 56struct clk clk_27m = {
59 .name = "clk_27m", 57 .name = "clk_27m",
60 .id = -1,
61 .rate = 27000000, 58 .rate = 27000000,
62}; 59};
63 60
@@ -83,14 +80,12 @@ static int clk_48m_ctrl(struct clk *clk, int enable)
83 80
84struct clk clk_48m = { 81struct clk clk_48m = {
85 .name = "clk_48m", 82 .name = "clk_48m",
86 .id = -1,
87 .rate = 48000000, 83 .rate = 48000000,
88 .enable = clk_48m_ctrl, 84 .enable = clk_48m_ctrl,
89}; 85};
90 86
91struct clk clk_xusbxti = { 87struct clk clk_xusbxti = {
92 .name = "xusbxti", 88 .name = "xusbxti",
93 .id = -1,
94 .rate = 48000000, 89 .rate = 48000000,
95}; 90};
96 91
@@ -130,109 +125,101 @@ int s3c64xx_sclk_ctrl(struct clk *clk, int enable)
130static struct clk init_clocks_off[] = { 125static struct clk init_clocks_off[] = {
131 { 126 {
132 .name = "nand", 127 .name = "nand",
133 .id = -1,
134 .parent = &clk_h, 128 .parent = &clk_h,
135 }, { 129 }, {
136 .name = "rtc", 130 .name = "rtc",
137 .id = -1,
138 .parent = &clk_p, 131 .parent = &clk_p,
139 .enable = s3c64xx_pclk_ctrl, 132 .enable = s3c64xx_pclk_ctrl,
140 .ctrlbit = S3C_CLKCON_PCLK_RTC, 133 .ctrlbit = S3C_CLKCON_PCLK_RTC,
141 }, { 134 }, {
142 .name = "adc", 135 .name = "adc",
143 .id = -1,
144 .parent = &clk_p, 136 .parent = &clk_p,
145 .enable = s3c64xx_pclk_ctrl, 137 .enable = s3c64xx_pclk_ctrl,
146 .ctrlbit = S3C_CLKCON_PCLK_TSADC, 138 .ctrlbit = S3C_CLKCON_PCLK_TSADC,
147 }, { 139 }, {
148 .name = "i2c", 140 .name = "i2c",
149 .id = -1,
150 .parent = &clk_p, 141 .parent = &clk_p,
151 .enable = s3c64xx_pclk_ctrl, 142 .enable = s3c64xx_pclk_ctrl,
152 .ctrlbit = S3C_CLKCON_PCLK_IIC, 143 .ctrlbit = S3C_CLKCON_PCLK_IIC,
153 }, { 144 }, {
154 .name = "i2c", 145 .name = "i2c",
155 .id = 1, 146 .devname = "s3c2440-i2c.1",
156 .parent = &clk_p, 147 .parent = &clk_p,
157 .enable = s3c64xx_pclk_ctrl, 148 .enable = s3c64xx_pclk_ctrl,
158 .ctrlbit = S3C6410_CLKCON_PCLK_I2C1, 149 .ctrlbit = S3C6410_CLKCON_PCLK_I2C1,
159 }, { 150 }, {
160 .name = "iis", 151 .name = "iis",
161 .id = 0, 152 .devname = "samsung-i2s.0",
162 .parent = &clk_p, 153 .parent = &clk_p,
163 .enable = s3c64xx_pclk_ctrl, 154 .enable = s3c64xx_pclk_ctrl,
164 .ctrlbit = S3C_CLKCON_PCLK_IIS0, 155 .ctrlbit = S3C_CLKCON_PCLK_IIS0,
165 }, { 156 }, {
166 .name = "iis", 157 .name = "iis",
167 .id = 1, 158 .devname = "samsung-i2s.1",
168 .parent = &clk_p, 159 .parent = &clk_p,
169 .enable = s3c64xx_pclk_ctrl, 160 .enable = s3c64xx_pclk_ctrl,
170 .ctrlbit = S3C_CLKCON_PCLK_IIS1, 161 .ctrlbit = S3C_CLKCON_PCLK_IIS1,
171 }, { 162 }, {
172#ifdef CONFIG_CPU_S3C6410 163#ifdef CONFIG_CPU_S3C6410
173 .name = "iis", 164 .name = "iis",
174 .id = -1, /* There's only one IISv4 port */
175 .parent = &clk_p, 165 .parent = &clk_p,
176 .enable = s3c64xx_pclk_ctrl, 166 .enable = s3c64xx_pclk_ctrl,
177 .ctrlbit = S3C6410_CLKCON_PCLK_IIS2, 167 .ctrlbit = S3C6410_CLKCON_PCLK_IIS2,
178 }, { 168 }, {
179#endif 169#endif
180 .name = "keypad", 170 .name = "keypad",
181 .id = -1,
182 .parent = &clk_p, 171 .parent = &clk_p,
183 .enable = s3c64xx_pclk_ctrl, 172 .enable = s3c64xx_pclk_ctrl,
184 .ctrlbit = S3C_CLKCON_PCLK_KEYPAD, 173 .ctrlbit = S3C_CLKCON_PCLK_KEYPAD,
185 }, { 174 }, {
186 .name = "spi", 175 .name = "spi",
187 .id = 0, 176 .devname = "s3c64xx-spi.0",
188 .parent = &clk_p, 177 .parent = &clk_p,
189 .enable = s3c64xx_pclk_ctrl, 178 .enable = s3c64xx_pclk_ctrl,
190 .ctrlbit = S3C_CLKCON_PCLK_SPI0, 179 .ctrlbit = S3C_CLKCON_PCLK_SPI0,
191 }, { 180 }, {
192 .name = "spi", 181 .name = "spi",
193 .id = 1, 182 .devname = "s3c64xx-spi.1",
194 .parent = &clk_p, 183 .parent = &clk_p,
195 .enable = s3c64xx_pclk_ctrl, 184 .enable = s3c64xx_pclk_ctrl,
196 .ctrlbit = S3C_CLKCON_PCLK_SPI1, 185 .ctrlbit = S3C_CLKCON_PCLK_SPI1,
197 }, { 186 }, {
198 .name = "spi_48m", 187 .name = "spi_48m",
199 .id = 0, 188 .devname = "s3c64xx-spi.0",
200 .parent = &clk_48m, 189 .parent = &clk_48m,
201 .enable = s3c64xx_sclk_ctrl, 190 .enable = s3c64xx_sclk_ctrl,
202 .ctrlbit = S3C_CLKCON_SCLK_SPI0_48, 191 .ctrlbit = S3C_CLKCON_SCLK_SPI0_48,
203 }, { 192 }, {
204 .name = "spi_48m", 193 .name = "spi_48m",
205 .id = 1, 194 .devname = "s3c64xx-spi.1",
206 .parent = &clk_48m, 195 .parent = &clk_48m,
207 .enable = s3c64xx_sclk_ctrl, 196 .enable = s3c64xx_sclk_ctrl,
208 .ctrlbit = S3C_CLKCON_SCLK_SPI1_48, 197 .ctrlbit = S3C_CLKCON_SCLK_SPI1_48,
209 }, { 198 }, {
210 .name = "48m", 199 .name = "48m",
211 .id = 0, 200 .devname = "s3c-sdhci.0",
212 .parent = &clk_48m, 201 .parent = &clk_48m,
213 .enable = s3c64xx_sclk_ctrl, 202 .enable = s3c64xx_sclk_ctrl,
214 .ctrlbit = S3C_CLKCON_SCLK_MMC0_48, 203 .ctrlbit = S3C_CLKCON_SCLK_MMC0_48,
215 }, { 204 }, {
216 .name = "48m", 205 .name = "48m",
217 .id = 1, 206 .devname = "s3c-sdhci.1",
218 .parent = &clk_48m, 207 .parent = &clk_48m,
219 .enable = s3c64xx_sclk_ctrl, 208 .enable = s3c64xx_sclk_ctrl,
220 .ctrlbit = S3C_CLKCON_SCLK_MMC1_48, 209 .ctrlbit = S3C_CLKCON_SCLK_MMC1_48,
221 }, { 210 }, {
222 .name = "48m", 211 .name = "48m",
223 .id = 2, 212 .devname = "s3c-sdhci.2",
224 .parent = &clk_48m, 213 .parent = &clk_48m,
225 .enable = s3c64xx_sclk_ctrl, 214 .enable = s3c64xx_sclk_ctrl,
226 .ctrlbit = S3C_CLKCON_SCLK_MMC2_48, 215 .ctrlbit = S3C_CLKCON_SCLK_MMC2_48,
227 }, { 216 }, {
228 .name = "dma0", 217 .name = "dma0",
229 .id = -1,
230 .parent = &clk_h, 218 .parent = &clk_h,
231 .enable = s3c64xx_hclk_ctrl, 219 .enable = s3c64xx_hclk_ctrl,
232 .ctrlbit = S3C_CLKCON_HCLK_DMA0, 220 .ctrlbit = S3C_CLKCON_HCLK_DMA0,
233 }, { 221 }, {
234 .name = "dma1", 222 .name = "dma1",
235 .id = -1,
236 .parent = &clk_h, 223 .parent = &clk_h,
237 .enable = s3c64xx_hclk_ctrl, 224 .enable = s3c64xx_hclk_ctrl,
238 .ctrlbit = S3C_CLKCON_HCLK_DMA1, 225 .ctrlbit = S3C_CLKCON_HCLK_DMA1,
@@ -242,89 +229,81 @@ static struct clk init_clocks_off[] = {
242static struct clk init_clocks[] = { 229static struct clk init_clocks[] = {
243 { 230 {
244 .name = "lcd", 231 .name = "lcd",
245 .id = -1,
246 .parent = &clk_h, 232 .parent = &clk_h,
247 .enable = s3c64xx_hclk_ctrl, 233 .enable = s3c64xx_hclk_ctrl,
248 .ctrlbit = S3C_CLKCON_HCLK_LCD, 234 .ctrlbit = S3C_CLKCON_HCLK_LCD,
249 }, { 235 }, {
250 .name = "gpio", 236 .name = "gpio",
251 .id = -1,
252 .parent = &clk_p, 237 .parent = &clk_p,
253 .enable = s3c64xx_pclk_ctrl, 238 .enable = s3c64xx_pclk_ctrl,
254 .ctrlbit = S3C_CLKCON_PCLK_GPIO, 239 .ctrlbit = S3C_CLKCON_PCLK_GPIO,
255 }, { 240 }, {
256 .name = "usb-host", 241 .name = "usb-host",
257 .id = -1,
258 .parent = &clk_h, 242 .parent = &clk_h,
259 .enable = s3c64xx_hclk_ctrl, 243 .enable = s3c64xx_hclk_ctrl,
260 .ctrlbit = S3C_CLKCON_HCLK_UHOST, 244 .ctrlbit = S3C_CLKCON_HCLK_UHOST,
261 }, { 245 }, {
262 .name = "hsmmc", 246 .name = "hsmmc",
263 .id = 0, 247 .devname = "s3c-sdhci.0",
264 .parent = &clk_h, 248 .parent = &clk_h,
265 .enable = s3c64xx_hclk_ctrl, 249 .enable = s3c64xx_hclk_ctrl,
266 .ctrlbit = S3C_CLKCON_HCLK_HSMMC0, 250 .ctrlbit = S3C_CLKCON_HCLK_HSMMC0,
267 }, { 251 }, {
268 .name = "hsmmc", 252 .name = "hsmmc",
269 .id = 1, 253 .devname = "s3c-sdhci.1",
270 .parent = &clk_h, 254 .parent = &clk_h,
271 .enable = s3c64xx_hclk_ctrl, 255 .enable = s3c64xx_hclk_ctrl,
272 .ctrlbit = S3C_CLKCON_HCLK_HSMMC1, 256 .ctrlbit = S3C_CLKCON_HCLK_HSMMC1,
273 }, { 257 }, {
274 .name = "hsmmc", 258 .name = "hsmmc",
275 .id = 2, 259 .devname = "s3c-sdhci.2",
276 .parent = &clk_h, 260 .parent = &clk_h,
277 .enable = s3c64xx_hclk_ctrl, 261 .enable = s3c64xx_hclk_ctrl,
278 .ctrlbit = S3C_CLKCON_HCLK_HSMMC2, 262 .ctrlbit = S3C_CLKCON_HCLK_HSMMC2,
279 }, { 263 }, {
280 .name = "otg", 264 .name = "otg",
281 .id = -1,
282 .parent = &clk_h, 265 .parent = &clk_h,
283 .enable = s3c64xx_hclk_ctrl, 266 .enable = s3c64xx_hclk_ctrl,
284 .ctrlbit = S3C_CLKCON_HCLK_USB, 267 .ctrlbit = S3C_CLKCON_HCLK_USB,
285 }, { 268 }, {
286 .name = "timers", 269 .name = "timers",
287 .id = -1,
288 .parent = &clk_p, 270 .parent = &clk_p,
289 .enable = s3c64xx_pclk_ctrl, 271 .enable = s3c64xx_pclk_ctrl,
290 .ctrlbit = S3C_CLKCON_PCLK_PWM, 272 .ctrlbit = S3C_CLKCON_PCLK_PWM,
291 }, { 273 }, {
292 .name = "uart", 274 .name = "uart",
293 .id = 0, 275 .devname = "s3c6400-uart.0",
294 .parent = &clk_p, 276 .parent = &clk_p,
295 .enable = s3c64xx_pclk_ctrl, 277 .enable = s3c64xx_pclk_ctrl,
296 .ctrlbit = S3C_CLKCON_PCLK_UART0, 278 .ctrlbit = S3C_CLKCON_PCLK_UART0,
297 }, { 279 }, {
298 .name = "uart", 280 .name = "uart",
299 .id = 1, 281 .devname = "s3c6400-uart.1",
300 .parent = &clk_p, 282 .parent = &clk_p,
301 .enable = s3c64xx_pclk_ctrl, 283 .enable = s3c64xx_pclk_ctrl,
302 .ctrlbit = S3C_CLKCON_PCLK_UART1, 284 .ctrlbit = S3C_CLKCON_PCLK_UART1,
303 }, { 285 }, {
304 .name = "uart", 286 .name = "uart",
305 .id = 2, 287 .devname = "s3c6400-uart.2",
306 .parent = &clk_p, 288 .parent = &clk_p,
307 .enable = s3c64xx_pclk_ctrl, 289 .enable = s3c64xx_pclk_ctrl,
308 .ctrlbit = S3C_CLKCON_PCLK_UART2, 290 .ctrlbit = S3C_CLKCON_PCLK_UART2,
309 }, { 291 }, {
310 .name = "uart", 292 .name = "uart",
311 .id = 3, 293 .devname = "s3c6400-uart.3",
312 .parent = &clk_p, 294 .parent = &clk_p,
313 .enable = s3c64xx_pclk_ctrl, 295 .enable = s3c64xx_pclk_ctrl,
314 .ctrlbit = S3C_CLKCON_PCLK_UART3, 296 .ctrlbit = S3C_CLKCON_PCLK_UART3,
315 }, { 297 }, {
316 .name = "watchdog", 298 .name = "watchdog",
317 .id = -1,
318 .parent = &clk_p, 299 .parent = &clk_p,
319 .ctrlbit = S3C_CLKCON_PCLK_WDT, 300 .ctrlbit = S3C_CLKCON_PCLK_WDT,
320 }, { 301 }, {
321 .name = "ac97", 302 .name = "ac97",
322 .id = -1,
323 .parent = &clk_p, 303 .parent = &clk_p,
324 .ctrlbit = S3C_CLKCON_PCLK_AC97, 304 .ctrlbit = S3C_CLKCON_PCLK_AC97,
325 }, { 305 }, {
326 .name = "cfcon", 306 .name = "cfcon",
327 .id = -1,
328 .parent = &clk_h, 307 .parent = &clk_h,
329 .enable = s3c64xx_hclk_ctrl, 308 .enable = s3c64xx_hclk_ctrl,
330 .ctrlbit = S3C_CLKCON_HCLK_IHOST, 309 .ctrlbit = S3C_CLKCON_HCLK_IHOST,
@@ -334,7 +313,6 @@ static struct clk init_clocks[] = {
334 313
335static struct clk clk_fout_apll = { 314static struct clk clk_fout_apll = {
336 .name = "fout_apll", 315 .name = "fout_apll",
337 .id = -1,
338}; 316};
339 317
340static struct clk *clk_src_apll_list[] = { 318static struct clk *clk_src_apll_list[] = {
@@ -350,7 +328,6 @@ static struct clksrc_sources clk_src_apll = {
350static struct clksrc_clk clk_mout_apll = { 328static struct clksrc_clk clk_mout_apll = {
351 .clk = { 329 .clk = {
352 .name = "mout_apll", 330 .name = "mout_apll",
353 .id = -1,
354 }, 331 },
355 .reg_src = { .reg = S3C_CLK_SRC, .shift = 0, .size = 1 }, 332 .reg_src = { .reg = S3C_CLK_SRC, .shift = 0, .size = 1 },
356 .sources = &clk_src_apll, 333 .sources = &clk_src_apll,
@@ -369,7 +346,6 @@ static struct clksrc_sources clk_src_epll = {
369static struct clksrc_clk clk_mout_epll = { 346static struct clksrc_clk clk_mout_epll = {
370 .clk = { 347 .clk = {
371 .name = "mout_epll", 348 .name = "mout_epll",
372 .id = -1,
373 }, 349 },
374 .reg_src = { .reg = S3C_CLK_SRC, .shift = 2, .size = 1 }, 350 .reg_src = { .reg = S3C_CLK_SRC, .shift = 2, .size = 1 },
375 .sources = &clk_src_epll, 351 .sources = &clk_src_epll,
@@ -388,7 +364,6 @@ static struct clksrc_sources clk_src_mpll = {
388static struct clksrc_clk clk_mout_mpll = { 364static struct clksrc_clk clk_mout_mpll = {
389 .clk = { 365 .clk = {
390 .name = "mout_mpll", 366 .name = "mout_mpll",
391 .id = -1,
392 }, 367 },
393 .reg_src = { .reg = S3C_CLK_SRC, .shift = 1, .size = 1 }, 368 .reg_src = { .reg = S3C_CLK_SRC, .shift = 1, .size = 1 },
394 .sources = &clk_src_mpll, 369 .sources = &clk_src_mpll,
@@ -446,7 +421,6 @@ static int s3c64xx_clk_arm_set_rate(struct clk *clk, unsigned long rate)
446 421
447static struct clk clk_arm = { 422static struct clk clk_arm = {
448 .name = "armclk", 423 .name = "armclk",
449 .id = -1,
450 .parent = &clk_mout_apll.clk, 424 .parent = &clk_mout_apll.clk,
451 .ops = &(struct clk_ops) { 425 .ops = &(struct clk_ops) {
452 .get_rate = s3c64xx_clk_arm_get_rate, 426 .get_rate = s3c64xx_clk_arm_get_rate,
@@ -473,7 +447,6 @@ static struct clk_ops clk_dout_ops = {
473 447
474static struct clk clk_dout_mpll = { 448static struct clk clk_dout_mpll = {
475 .name = "dout_mpll", 449 .name = "dout_mpll",
476 .id = -1,
477 .parent = &clk_mout_mpll.clk, 450 .parent = &clk_mout_mpll.clk,
478 .ops = &clk_dout_ops, 451 .ops = &clk_dout_ops,
479}; 452};
@@ -540,22 +513,18 @@ static struct clksrc_sources clkset_uhost = {
540 513
541static struct clk clk_iis_cd0 = { 514static struct clk clk_iis_cd0 = {
542 .name = "iis_cdclk0", 515 .name = "iis_cdclk0",
543 .id = -1,
544}; 516};
545 517
546static struct clk clk_iis_cd1 = { 518static struct clk clk_iis_cd1 = {
547 .name = "iis_cdclk1", 519 .name = "iis_cdclk1",
548 .id = -1,
549}; 520};
550 521
551static struct clk clk_iisv4_cd = { 522static struct clk clk_iisv4_cd = {
552 .name = "iis_cdclk_v4", 523 .name = "iis_cdclk_v4",
553 .id = -1,
554}; 524};
555 525
556static struct clk clk_pcm_cd = { 526static struct clk clk_pcm_cd = {
557 .name = "pcm_cdclk", 527 .name = "pcm_cdclk",
558 .id = -1,
559}; 528};
560 529
561static struct clk *clkset_audio0_list[] = { 530static struct clk *clkset_audio0_list[] = {
@@ -610,7 +579,7 @@ static struct clksrc_clk clksrcs[] = {
610 { 579 {
611 .clk = { 580 .clk = {
612 .name = "mmc_bus", 581 .name = "mmc_bus",
613 .id = 0, 582 .devname = "s3c-sdhci.0",
614 .ctrlbit = S3C_CLKCON_SCLK_MMC0, 583 .ctrlbit = S3C_CLKCON_SCLK_MMC0,
615 .enable = s3c64xx_sclk_ctrl, 584 .enable = s3c64xx_sclk_ctrl,
616 }, 585 },
@@ -620,7 +589,7 @@ static struct clksrc_clk clksrcs[] = {
620 }, { 589 }, {
621 .clk = { 590 .clk = {
622 .name = "mmc_bus", 591 .name = "mmc_bus",
623 .id = 1, 592 .devname = "s3c-sdhci.1",
624 .ctrlbit = S3C_CLKCON_SCLK_MMC1, 593 .ctrlbit = S3C_CLKCON_SCLK_MMC1,
625 .enable = s3c64xx_sclk_ctrl, 594 .enable = s3c64xx_sclk_ctrl,
626 }, 595 },
@@ -630,7 +599,7 @@ static struct clksrc_clk clksrcs[] = {
630 }, { 599 }, {
631 .clk = { 600 .clk = {
632 .name = "mmc_bus", 601 .name = "mmc_bus",
633 .id = 2, 602 .devname = "s3c-sdhci.2",
634 .ctrlbit = S3C_CLKCON_SCLK_MMC2, 603 .ctrlbit = S3C_CLKCON_SCLK_MMC2,
635 .enable = s3c64xx_sclk_ctrl, 604 .enable = s3c64xx_sclk_ctrl,
636 }, 605 },
@@ -640,7 +609,6 @@ static struct clksrc_clk clksrcs[] = {
640 }, { 609 }, {
641 .clk = { 610 .clk = {
642 .name = "usb-bus-host", 611 .name = "usb-bus-host",
643 .id = -1,
644 .ctrlbit = S3C_CLKCON_SCLK_UHOST, 612 .ctrlbit = S3C_CLKCON_SCLK_UHOST,
645 .enable = s3c64xx_sclk_ctrl, 613 .enable = s3c64xx_sclk_ctrl,
646 }, 614 },
@@ -650,7 +618,6 @@ static struct clksrc_clk clksrcs[] = {
650 }, { 618 }, {
651 .clk = { 619 .clk = {
652 .name = "uclk1", 620 .name = "uclk1",
653 .id = -1,
654 .ctrlbit = S3C_CLKCON_SCLK_UART, 621 .ctrlbit = S3C_CLKCON_SCLK_UART,
655 .enable = s3c64xx_sclk_ctrl, 622 .enable = s3c64xx_sclk_ctrl,
656 }, 623 },
@@ -661,7 +628,7 @@ static struct clksrc_clk clksrcs[] = {
661/* Where does UCLK0 come from? */ 628/* Where does UCLK0 come from? */
662 .clk = { 629 .clk = {
663 .name = "spi-bus", 630 .name = "spi-bus",
664 .id = 0, 631 .devname = "s3c64xx-spi.0",
665 .ctrlbit = S3C_CLKCON_SCLK_SPI0, 632 .ctrlbit = S3C_CLKCON_SCLK_SPI0,
666 .enable = s3c64xx_sclk_ctrl, 633 .enable = s3c64xx_sclk_ctrl,
667 }, 634 },
@@ -671,8 +638,7 @@ static struct clksrc_clk clksrcs[] = {
671 }, { 638 }, {
672 .clk = { 639 .clk = {
673 .name = "spi-bus", 640 .name = "spi-bus",
674 .id = 1, 641 .devname = "s3c64xx-spi.1",
675 .ctrlbit = S3C_CLKCON_SCLK_SPI1,
676 .enable = s3c64xx_sclk_ctrl, 642 .enable = s3c64xx_sclk_ctrl,
677 }, 643 },
678 .reg_src = { .reg = S3C_CLK_SRC, .shift = 16, .size = 2 }, 644 .reg_src = { .reg = S3C_CLK_SRC, .shift = 16, .size = 2 },
@@ -681,7 +647,7 @@ static struct clksrc_clk clksrcs[] = {
681 }, { 647 }, {
682 .clk = { 648 .clk = {
683 .name = "audio-bus", 649 .name = "audio-bus",
684 .id = 0, 650 .devname = "samsung-i2s.0",
685 .ctrlbit = S3C_CLKCON_SCLK_AUDIO0, 651 .ctrlbit = S3C_CLKCON_SCLK_AUDIO0,
686 .enable = s3c64xx_sclk_ctrl, 652 .enable = s3c64xx_sclk_ctrl,
687 }, 653 },
@@ -691,7 +657,7 @@ static struct clksrc_clk clksrcs[] = {
691 }, { 657 }, {
692 .clk = { 658 .clk = {
693 .name = "audio-bus", 659 .name = "audio-bus",
694 .id = 1, 660 .devname = "samsung-i2s.1",
695 .ctrlbit = S3C_CLKCON_SCLK_AUDIO1, 661 .ctrlbit = S3C_CLKCON_SCLK_AUDIO1,
696 .enable = s3c64xx_sclk_ctrl, 662 .enable = s3c64xx_sclk_ctrl,
697 }, 663 },
@@ -701,7 +667,7 @@ static struct clksrc_clk clksrcs[] = {
701 }, { 667 }, {
702 .clk = { 668 .clk = {
703 .name = "audio-bus", 669 .name = "audio-bus",
704 .id = 2, 670 .devname = "samsung-i2s.2",
705 .ctrlbit = S3C6410_CLKCON_SCLK_AUDIO2, 671 .ctrlbit = S3C6410_CLKCON_SCLK_AUDIO2,
706 .enable = s3c64xx_sclk_ctrl, 672 .enable = s3c64xx_sclk_ctrl,
707 }, 673 },
@@ -711,7 +677,6 @@ static struct clksrc_clk clksrcs[] = {
711 }, { 677 }, {
712 .clk = { 678 .clk = {
713 .name = "irda-bus", 679 .name = "irda-bus",
714 .id = 0,
715 .ctrlbit = S3C_CLKCON_SCLK_IRDA, 680 .ctrlbit = S3C_CLKCON_SCLK_IRDA,
716 .enable = s3c64xx_sclk_ctrl, 681 .enable = s3c64xx_sclk_ctrl,
717 }, 682 },
@@ -721,7 +686,6 @@ static struct clksrc_clk clksrcs[] = {
721 }, { 686 }, {
722 .clk = { 687 .clk = {
723 .name = "camera", 688 .name = "camera",
724 .id = -1,
725 .ctrlbit = S3C_CLKCON_SCLK_CAM, 689 .ctrlbit = S3C_CLKCON_SCLK_CAM,
726 .enable = s3c64xx_sclk_ctrl, 690 .enable = s3c64xx_sclk_ctrl,
727 }, 691 },
diff --git a/arch/arm/mach-s3c64xx/dev-onenand1.c b/arch/arm/mach-s3c64xx/dev-onenand1.c
index 92ffd5bac104..999f9e17a1e4 100644
--- a/arch/arm/mach-s3c64xx/dev-onenand1.c
+++ b/arch/arm/mach-s3c64xx/dev-onenand1.c
@@ -19,6 +19,8 @@
19#include <mach/irqs.h> 19#include <mach/irqs.h>
20#include <mach/map.h> 20#include <mach/map.h>
21 21
22#include <plat/devs.h>
23
22static struct resource s3c64xx_onenand1_resources[] = { 24static struct resource s3c64xx_onenand1_resources[] = {
23 [0] = { 25 [0] = {
24 .start = S3C64XX_PA_ONENAND1, 26 .start = S3C64XX_PA_ONENAND1,
@@ -46,10 +48,6 @@ struct platform_device s3c64xx_device_onenand1 = {
46 48
47void s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata) 49void s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata)
48{ 50{
49 struct onenand_platform_data *pd; 51 s3c_set_platdata(pdata, sizeof(struct onenand_platform_data),
50 52 &s3c64xx_device_onenand1);
51 pd = kmemdup(pdata, sizeof(struct onenand_platform_data), GFP_KERNEL);
52 if (!pd)
53 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
54 s3c64xx_device_onenand1.dev.platform_data = pd;
55} 53}
diff --git a/arch/arm/mach-s3c64xx/dev-spi.c b/arch/arm/mach-s3c64xx/dev-spi.c
index 82db072cb836..5e6b42089eb4 100644
--- a/arch/arm/mach-s3c64xx/dev-spi.c
+++ b/arch/arm/mach-s3c64xx/dev-spi.c
@@ -88,6 +88,7 @@ static struct s3c64xx_spi_info s3c64xx_spi0_pdata = {
88 .cfg_gpio = s3c64xx_spi_cfg_gpio, 88 .cfg_gpio = s3c64xx_spi_cfg_gpio,
89 .fifo_lvl_mask = 0x7f, 89 .fifo_lvl_mask = 0x7f,
90 .rx_lvl_offset = 13, 90 .rx_lvl_offset = 13,
91 .tx_st_done = 21,
91}; 92};
92 93
93static u64 spi_dmamask = DMA_BIT_MASK(32); 94static u64 spi_dmamask = DMA_BIT_MASK(32);
@@ -132,6 +133,7 @@ static struct s3c64xx_spi_info s3c64xx_spi1_pdata = {
132 .cfg_gpio = s3c64xx_spi_cfg_gpio, 133 .cfg_gpio = s3c64xx_spi_cfg_gpio,
133 .fifo_lvl_mask = 0x7f, 134 .fifo_lvl_mask = 0x7f,
134 .rx_lvl_offset = 13, 135 .rx_lvl_offset = 13,
136 .tx_st_done = 21,
135}; 137};
136 138
137struct platform_device s3c64xx_device_spi1 = { 139struct platform_device s3c64xx_device_spi1 = {
diff --git a/arch/arm/mach-s3c64xx/include/mach/clkdev.h b/arch/arm/mach-s3c64xx/include/mach/clkdev.h
new file mode 100644
index 000000000000..7dffa83d23ff
--- /dev/null
+++ b/arch/arm/mach-s3c64xx/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __MACH_CLKDEV_H__
2#define __MACH_CLKDEV_H__
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do {} while (0)
6
7#endif
diff --git a/arch/arm/mach-s3c64xx/include/mach/regs-fb.h b/arch/arm/mach-s3c64xx/include/mach/regs-fb.h
deleted file mode 100644
index a06ee0af9a4b..000000000000
--- a/arch/arm/mach-s3c64xx/include/mach/regs-fb.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright 2008 Openmoko, Inc.
3 * Copyright 2008 Simtec Electronics
4 * Copyright 2009 Samsung Electronics Co.
5 *
6 * Pawel Osciak <p.osciak@samsung.com>
7 * Based on plat-s3c/include/plat/regs-fb.h by Ben Dooks <ben@simtec.co.uk>
8 *
9 * Framebuffer register definitions for Samsung S3C64xx.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#ifndef __ASM_ARCH_MACH_REGS_FB_H
17#define __ASM_ARCH_MACH_REGS_FB_H __FILE__
18
19#include <plat/regs-fb-v4.h>
20
21#endif /* __ASM_ARCH_MACH_REGS_FB_H */
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index a53cf149476e..cb8864327ac4 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -35,7 +35,6 @@
35#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
36 36
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/regs-fb.h>
39#include <mach/map.h> 38#include <mach/map.h>
40 39
41#include <asm/irq.h> 40#include <asm/irq.h>
@@ -44,6 +43,7 @@
44#include <plat/regs-serial.h> 43#include <plat/regs-serial.h>
45#include <plat/iic.h> 44#include <plat/iic.h>
46#include <plat/fb.h> 45#include <plat/fb.h>
46#include <plat/regs-fb-v4.h>
47 47
48#include <mach/s3c6410.h> 48#include <mach/s3c6410.h>
49#include <plat/clock.h> 49#include <plat/clock.h>
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index b2639582caca..b3d93cc8dde0 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -27,7 +27,6 @@
27#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/regs-fb.h>
31#include <mach/map.h> 30#include <mach/map.h>
32 31
33#include <asm/irq.h> 32#include <asm/irq.h>
@@ -42,6 +41,7 @@
42#include <plat/clock.h> 41#include <plat/clock.h>
43#include <plat/devs.h> 42#include <plat/devs.h>
44#include <plat/cpu.h> 43#include <plat/cpu.h>
44#include <plat/regs-fb-v4.h>
45 45
46#define UCON S3C2410_UCON_DEFAULT 46#define UCON S3C2410_UCON_DEFAULT
47#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE) 47#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index 89f35e02e883..527f49bd1b57 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -29,7 +29,6 @@
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30 30
31#include <mach/map.h> 31#include <mach/map.h>
32#include <mach/regs-fb.h>
33#include <mach/regs-gpio.h> 32#include <mach/regs-gpio.h>
34#include <mach/regs-modem.h> 33#include <mach/regs-modem.h>
35#include <mach/regs-srom.h> 34#include <mach/regs-srom.h>
@@ -42,6 +41,7 @@
42#include <plat/nand.h> 41#include <plat/nand.h>
43#include <plat/regs-serial.h> 42#include <plat/regs-serial.h>
44#include <plat/ts.h> 43#include <plat/ts.h>
44#include <plat/regs-fb-v4.h>
45 45
46#include <video/platform_lcd.h> 46#include <video/platform_lcd.h>
47 47
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index c4986498cd12..01c6857c5b63 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -30,7 +30,6 @@
30#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
31 31
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/regs-fb.h>
34#include <mach/map.h> 33#include <mach/map.h>
35 34
36#include <asm/irq.h> 35#include <asm/irq.h>
@@ -44,6 +43,7 @@
44#include <plat/clock.h> 43#include <plat/clock.h>
45#include <plat/devs.h> 44#include <plat/devs.h>
46#include <plat/cpu.h> 45#include <plat/cpu.h>
46#include <plat/regs-fb-v4.h>
47 47
48#define UCON S3C2410_UCON_DEFAULT 48#define UCON S3C2410_UCON_DEFAULT
49#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE 49#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 4957ab0a0d4a..95b04b1729e3 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -30,7 +30,6 @@
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31 31
32#include <mach/map.h> 32#include <mach/map.h>
33#include <mach/regs-fb.h>
34#include <mach/regs-gpio.h> 33#include <mach/regs-gpio.h>
35#include <mach/regs-modem.h> 34#include <mach/regs-modem.h>
36#include <mach/regs-srom.h> 35#include <mach/regs-srom.h>
@@ -43,6 +42,7 @@
43#include <plat/nand.h> 42#include <plat/nand.h>
44#include <plat/regs-serial.h> 43#include <plat/regs-serial.h>
45#include <plat/ts.h> 44#include <plat/ts.h>
45#include <plat/regs-fb-v4.h>
46 46
47#include <video/platform_lcd.h> 47#include <video/platform_lcd.h>
48 48
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 3a3e5acde523..342e8dfddf8b 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -21,7 +21,6 @@
21#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
22 22
23#include <mach/map.h> 23#include <mach/map.h>
24#include <mach/regs-fb.h>
25#include <mach/regs-gpio.h> 24#include <mach/regs-gpio.h>
26#include <mach/s3c6410.h> 25#include <mach/s3c6410.h>
27 26
@@ -29,6 +28,7 @@
29#include <plat/devs.h> 28#include <plat/devs.h>
30#include <plat/fb.h> 29#include <plat/fb.h>
31#include <plat/gpio-cfg.h> 30#include <plat/gpio-cfg.h>
31#include <plat/regs-fb-v4.h>
32 32
33#include "mach-smartq.h" 33#include "mach-smartq.h"
34 34
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index e65375877d53..57963977da8e 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -21,7 +21,6 @@
21#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
22 22
23#include <mach/map.h> 23#include <mach/map.h>
24#include <mach/regs-fb.h>
25#include <mach/regs-gpio.h> 24#include <mach/regs-gpio.h>
26#include <mach/s3c6410.h> 25#include <mach/s3c6410.h>
27 26
@@ -29,6 +28,7 @@
29#include <plat/devs.h> 28#include <plat/devs.h>
30#include <plat/fb.h> 29#include <plat/fb.h>
31#include <plat/gpio-cfg.h> 30#include <plat/gpio-cfg.h>
31#include <plat/regs-fb-v4.h>
32 32
33#include "mach-smartq.h" 33#include "mach-smartq.h"
34 34
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index 2c0353a80906..ecbea92bf83b 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -48,7 +48,6 @@
48#include <asm/mach/irq.h> 48#include <asm/mach/irq.h>
49 49
50#include <mach/hardware.h> 50#include <mach/hardware.h>
51#include <mach/regs-fb.h>
52#include <mach/map.h> 51#include <mach/map.h>
53 52
54#include <asm/irq.h> 53#include <asm/irq.h>
@@ -71,6 +70,8 @@
71#include <plat/adc.h> 70#include <plat/adc.h>
72#include <plat/ts.h> 71#include <plat/ts.h>
73#include <plat/keypad.h> 72#include <plat/keypad.h>
73#include <plat/backlight.h>
74#include <plat/regs-fb-v4.h>
74 75
75#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK 76#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
76#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB 77#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
@@ -209,17 +210,9 @@ static struct platform_device smdk6410_smsc911x = {
209}; 210};
210 211
211#ifdef CONFIG_REGULATOR 212#ifdef CONFIG_REGULATOR
212static struct regulator_consumer_supply smdk6410_b_pwr_5v_consumers[] = { 213static struct regulator_consumer_supply smdk6410_b_pwr_5v_consumers[] __initdata = {
213 { 214 REGULATOR_SUPPLY("PVDD", "0-001b"),
214 /* WM8580 */ 215 REGULATOR_SUPPLY("AVDD", "0-001b"),
215 .supply = "PVDD",
216 .dev_name = "0-001b",
217 },
218 {
219 /* WM8580 */
220 .supply = "AVDD",
221 .dev_name = "0-001b",
222 },
223}; 216};
224 217
225static struct regulator_init_data smdk6410_b_pwr_5v_data = { 218static struct regulator_init_data smdk6410_b_pwr_5v_data = {
@@ -337,16 +330,12 @@ static struct platform_device *smdk6410_devices[] __initdata = {
337 &s3c_device_rtc, 330 &s3c_device_rtc,
338 &s3c_device_ts, 331 &s3c_device_ts,
339 &s3c_device_wdt, 332 &s3c_device_wdt,
340 &s3c_device_timer[1],
341 &smdk6410_backlight_device,
342}; 333};
343 334
344#ifdef CONFIG_REGULATOR 335#ifdef CONFIG_REGULATOR
345/* ARM core */ 336/* ARM core */
346static struct regulator_consumer_supply smdk6410_vddarm_consumers[] = { 337static struct regulator_consumer_supply smdk6410_vddarm_consumers[] = {
347 { 338 REGULATOR_SUPPLY("vddarm", NULL),
348 .supply = "vddarm",
349 }
350}; 339};
351 340
352/* VDDARM, BUCK1 on J5 */ 341/* VDDARM, BUCK1 on J5 */
@@ -484,11 +473,7 @@ static struct regulator_init_data wm8350_dcdc3_data = {
484 473
485/* USB, EXT, PCM, ADC/DAC, USB, MMC */ 474/* USB, EXT, PCM, ADC/DAC, USB, MMC */
486static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = { 475static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = {
487 { 476 REGULATOR_SUPPLY("DVDD", "0-001b"),
488 /* WM8580 */
489 .supply = "DVDD",
490 .dev_name = "0-001b",
491 },
492}; 477};
493 478
494static struct regulator_init_data wm8350_dcdc4_data = { 479static struct regulator_init_data wm8350_dcdc4_data = {
@@ -599,7 +584,7 @@ static struct regulator_init_data wm1192_dcdc3 = {
599}; 584};
600 585
601static struct regulator_consumer_supply wm1192_ldo1_consumers[] = { 586static struct regulator_consumer_supply wm1192_ldo1_consumers[] = {
602 { .supply = "DVDD", .dev_name = "0-001b", }, /* WM8580 */ 587 REGULATOR_SUPPLY("DVDD", "0-001b"), /* WM8580 */
603}; 588};
604 589
605static struct regulator_init_data wm1192_ldo1 = { 590static struct regulator_init_data wm1192_ldo1 = {
@@ -679,6 +664,16 @@ static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
679 .oversampling_shift = 2, 664 .oversampling_shift = 2,
680}; 665};
681 666
667/* LCD Backlight data */
668static struct samsung_bl_gpio_info smdk6410_bl_gpio_info = {
669 .no = S3C64XX_GPF(15),
670 .func = S3C_GPIO_SFN(2),
671};
672
673static struct platform_pwm_backlight_data smdk6410_bl_data = {
674 .pwm_id = 1,
675};
676
682static void __init smdk6410_map_io(void) 677static void __init smdk6410_map_io(void)
683{ 678{
684 u32 tmp; 679 u32 tmp;
@@ -740,6 +735,8 @@ static void __init smdk6410_machine_init(void)
740 735
741 s3c_ide_set_platdata(&smdk6410_ide_pdata); 736 s3c_ide_set_platdata(&smdk6410_ide_pdata);
742 737
738 samsung_bl_set(&smdk6410_bl_gpio_info, &smdk6410_bl_data);
739
743 platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices)); 740 platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
744} 741}
745 742
diff --git a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c
index 8f3091182f9c..83d2afb79e9f 100644
--- a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c
+++ b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c
@@ -17,7 +17,6 @@
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19 19
20#include <mach/regs-fb.h>
21#include <plat/fb.h> 20#include <plat/fb.h>
22#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
23 22
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index 017af4c4293c..65c7518dad7f 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -36,6 +36,7 @@ config MACH_SMDK6440
36 select S3C_DEV_WDT 36 select S3C_DEV_WDT
37 select S3C64XX_DEV_SPI 37 select S3C64XX_DEV_SPI
38 select SAMSUNG_DEV_ADC 38 select SAMSUNG_DEV_ADC
39 select SAMSUNG_DEV_BACKLIGHT
39 select SAMSUNG_DEV_PWM 40 select SAMSUNG_DEV_PWM
40 select SAMSUNG_DEV_TS 41 select SAMSUNG_DEV_TS
41 select S5P64X0_SETUP_I2C1 42 select S5P64X0_SETUP_I2C1
@@ -50,6 +51,7 @@ config MACH_SMDK6450
50 select S3C_DEV_WDT 51 select S3C_DEV_WDT
51 select S3C64XX_DEV_SPI 52 select S3C64XX_DEV_SPI
52 select SAMSUNG_DEV_ADC 53 select SAMSUNG_DEV_ADC
54 select SAMSUNG_DEV_BACKLIGHT
53 select SAMSUNG_DEV_PWM 55 select SAMSUNG_DEV_PWM
54 select SAMSUNG_DEV_TS 56 select SAMSUNG_DEV_TS
55 select S5P64X0_SETUP_I2C1 57 select S5P64X0_SETUP_I2C1
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c
index 9f12c2ebf416..0e9cd3092dd2 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6440.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c
@@ -95,7 +95,6 @@ static struct clk_ops s5p6440_epll_ops = {
95static struct clksrc_clk clk_hclk = { 95static struct clksrc_clk clk_hclk = {
96 .clk = { 96 .clk = {
97 .name = "clk_hclk", 97 .name = "clk_hclk",
98 .id = -1,
99 .parent = &clk_armclk.clk, 98 .parent = &clk_armclk.clk,
100 }, 99 },
101 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 8, .size = 4 }, 100 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 8, .size = 4 },
@@ -104,7 +103,6 @@ static struct clksrc_clk clk_hclk = {
104static struct clksrc_clk clk_pclk = { 103static struct clksrc_clk clk_pclk = {
105 .clk = { 104 .clk = {
106 .name = "clk_pclk", 105 .name = "clk_pclk",
107 .id = -1,
108 .parent = &clk_hclk.clk, 106 .parent = &clk_hclk.clk,
109 }, 107 },
110 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 }, 108 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 },
@@ -112,7 +110,6 @@ static struct clksrc_clk clk_pclk = {
112static struct clksrc_clk clk_hclk_low = { 110static struct clksrc_clk clk_hclk_low = {
113 .clk = { 111 .clk = {
114 .name = "clk_hclk_low", 112 .name = "clk_hclk_low",
115 .id = -1,
116 }, 113 },
117 .sources = &clkset_hclk_low, 114 .sources = &clkset_hclk_low,
118 .reg_src = { .reg = S5P64X0_SYS_OTHERS, .shift = 6, .size = 1 }, 115 .reg_src = { .reg = S5P64X0_SYS_OTHERS, .shift = 6, .size = 1 },
@@ -122,7 +119,6 @@ static struct clksrc_clk clk_hclk_low = {
122static struct clksrc_clk clk_pclk_low = { 119static struct clksrc_clk clk_pclk_low = {
123 .clk = { 120 .clk = {
124 .name = "clk_pclk_low", 121 .name = "clk_pclk_low",
125 .id = -1,
126 .parent = &clk_hclk_low.clk, 122 .parent = &clk_hclk_low.clk,
127 }, 123 },
128 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 }, 124 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 },
@@ -136,187 +132,167 @@ static struct clksrc_clk clk_pclk_low = {
136static struct clk init_clocks_off[] = { 132static struct clk init_clocks_off[] = {
137 { 133 {
138 .name = "nand", 134 .name = "nand",
139 .id = -1,
140 .parent = &clk_hclk.clk, 135 .parent = &clk_hclk.clk,
141 .enable = s5p64x0_mem_ctrl, 136 .enable = s5p64x0_mem_ctrl,
142 .ctrlbit = (1 << 2), 137 .ctrlbit = (1 << 2),
143 }, { 138 }, {
144 .name = "post", 139 .name = "post",
145 .id = -1,
146 .parent = &clk_hclk_low.clk, 140 .parent = &clk_hclk_low.clk,
147 .enable = s5p64x0_hclk0_ctrl, 141 .enable = s5p64x0_hclk0_ctrl,
148 .ctrlbit = (1 << 5) 142 .ctrlbit = (1 << 5)
149 }, { 143 }, {
150 .name = "2d", 144 .name = "2d",
151 .id = -1,
152 .parent = &clk_hclk.clk, 145 .parent = &clk_hclk.clk,
153 .enable = s5p64x0_hclk0_ctrl, 146 .enable = s5p64x0_hclk0_ctrl,
154 .ctrlbit = (1 << 8), 147 .ctrlbit = (1 << 8),
155 }, { 148 }, {
156 .name = "pdma", 149 .name = "pdma",
157 .id = -1,
158 .parent = &clk_hclk_low.clk, 150 .parent = &clk_hclk_low.clk,
159 .enable = s5p64x0_hclk0_ctrl, 151 .enable = s5p64x0_hclk0_ctrl,
160 .ctrlbit = (1 << 12), 152 .ctrlbit = (1 << 12),
161 }, { 153 }, {
162 .name = "hsmmc", 154 .name = "hsmmc",
163 .id = 0, 155 .devname = "s3c-sdhci.0",
164 .parent = &clk_hclk_low.clk, 156 .parent = &clk_hclk_low.clk,
165 .enable = s5p64x0_hclk0_ctrl, 157 .enable = s5p64x0_hclk0_ctrl,
166 .ctrlbit = (1 << 17), 158 .ctrlbit = (1 << 17),
167 }, { 159 }, {
168 .name = "hsmmc", 160 .name = "hsmmc",
169 .id = 1, 161 .devname = "s3c-sdhci.1",
170 .parent = &clk_hclk_low.clk, 162 .parent = &clk_hclk_low.clk,
171 .enable = s5p64x0_hclk0_ctrl, 163 .enable = s5p64x0_hclk0_ctrl,
172 .ctrlbit = (1 << 18), 164 .ctrlbit = (1 << 18),
173 }, { 165 }, {
174 .name = "hsmmc", 166 .name = "hsmmc",
175 .id = 2, 167 .devname = "s3c-sdhci.2",
176 .parent = &clk_hclk_low.clk, 168 .parent = &clk_hclk_low.clk,
177 .enable = s5p64x0_hclk0_ctrl, 169 .enable = s5p64x0_hclk0_ctrl,
178 .ctrlbit = (1 << 19), 170 .ctrlbit = (1 << 19),
179 }, { 171 }, {
180 .name = "otg", 172 .name = "otg",
181 .id = -1,
182 .parent = &clk_hclk_low.clk, 173 .parent = &clk_hclk_low.clk,
183 .enable = s5p64x0_hclk0_ctrl, 174 .enable = s5p64x0_hclk0_ctrl,
184 .ctrlbit = (1 << 20) 175 .ctrlbit = (1 << 20)
185 }, { 176 }, {
186 .name = "irom", 177 .name = "irom",
187 .id = -1,
188 .parent = &clk_hclk.clk, 178 .parent = &clk_hclk.clk,
189 .enable = s5p64x0_hclk0_ctrl, 179 .enable = s5p64x0_hclk0_ctrl,
190 .ctrlbit = (1 << 25), 180 .ctrlbit = (1 << 25),
191 }, { 181 }, {
192 .name = "lcd", 182 .name = "lcd",
193 .id = -1,
194 .parent = &clk_hclk_low.clk, 183 .parent = &clk_hclk_low.clk,
195 .enable = s5p64x0_hclk1_ctrl, 184 .enable = s5p64x0_hclk1_ctrl,
196 .ctrlbit = (1 << 1), 185 .ctrlbit = (1 << 1),
197 }, { 186 }, {
198 .name = "hclk_fimgvg", 187 .name = "hclk_fimgvg",
199 .id = -1,
200 .parent = &clk_hclk.clk, 188 .parent = &clk_hclk.clk,
201 .enable = s5p64x0_hclk1_ctrl, 189 .enable = s5p64x0_hclk1_ctrl,
202 .ctrlbit = (1 << 2), 190 .ctrlbit = (1 << 2),
203 }, { 191 }, {
204 .name = "tsi", 192 .name = "tsi",
205 .id = -1,
206 .parent = &clk_hclk_low.clk, 193 .parent = &clk_hclk_low.clk,
207 .enable = s5p64x0_hclk1_ctrl, 194 .enable = s5p64x0_hclk1_ctrl,
208 .ctrlbit = (1 << 0), 195 .ctrlbit = (1 << 0),
209 }, { 196 }, {
210 .name = "watchdog", 197 .name = "watchdog",
211 .id = -1,
212 .parent = &clk_pclk_low.clk, 198 .parent = &clk_pclk_low.clk,
213 .enable = s5p64x0_pclk_ctrl, 199 .enable = s5p64x0_pclk_ctrl,
214 .ctrlbit = (1 << 5), 200 .ctrlbit = (1 << 5),
215 }, { 201 }, {
216 .name = "rtc", 202 .name = "rtc",
217 .id = -1,
218 .parent = &clk_pclk_low.clk, 203 .parent = &clk_pclk_low.clk,
219 .enable = s5p64x0_pclk_ctrl, 204 .enable = s5p64x0_pclk_ctrl,
220 .ctrlbit = (1 << 6), 205 .ctrlbit = (1 << 6),
221 }, { 206 }, {
222 .name = "timers", 207 .name = "timers",
223 .id = -1,
224 .parent = &clk_pclk_low.clk, 208 .parent = &clk_pclk_low.clk,
225 .enable = s5p64x0_pclk_ctrl, 209 .enable = s5p64x0_pclk_ctrl,
226 .ctrlbit = (1 << 7), 210 .ctrlbit = (1 << 7),
227 }, { 211 }, {
228 .name = "pcm", 212 .name = "pcm",
229 .id = -1,
230 .parent = &clk_pclk_low.clk, 213 .parent = &clk_pclk_low.clk,
231 .enable = s5p64x0_pclk_ctrl, 214 .enable = s5p64x0_pclk_ctrl,
232 .ctrlbit = (1 << 8), 215 .ctrlbit = (1 << 8),
233 }, { 216 }, {
234 .name = "adc", 217 .name = "adc",
235 .id = -1,
236 .parent = &clk_pclk_low.clk, 218 .parent = &clk_pclk_low.clk,
237 .enable = s5p64x0_pclk_ctrl, 219 .enable = s5p64x0_pclk_ctrl,
238 .ctrlbit = (1 << 12), 220 .ctrlbit = (1 << 12),
239 }, { 221 }, {
240 .name = "i2c", 222 .name = "i2c",
241 .id = -1,
242 .parent = &clk_pclk_low.clk, 223 .parent = &clk_pclk_low.clk,
243 .enable = s5p64x0_pclk_ctrl, 224 .enable = s5p64x0_pclk_ctrl,
244 .ctrlbit = (1 << 17), 225 .ctrlbit = (1 << 17),
245 }, { 226 }, {
246 .name = "spi", 227 .name = "spi",
247 .id = 0, 228 .devname = "s3c64xx-spi.0",
248 .parent = &clk_pclk_low.clk, 229 .parent = &clk_pclk_low.clk,
249 .enable = s5p64x0_pclk_ctrl, 230 .enable = s5p64x0_pclk_ctrl,
250 .ctrlbit = (1 << 21), 231 .ctrlbit = (1 << 21),
251 }, { 232 }, {
252 .name = "spi", 233 .name = "spi",
253 .id = 1, 234 .devname = "s3c64xx-spi.1",
254 .parent = &clk_pclk_low.clk, 235 .parent = &clk_pclk_low.clk,
255 .enable = s5p64x0_pclk_ctrl, 236 .enable = s5p64x0_pclk_ctrl,
256 .ctrlbit = (1 << 22), 237 .ctrlbit = (1 << 22),
257 }, { 238 }, {
258 .name = "gps", 239 .name = "gps",
259 .id = -1,
260 .parent = &clk_pclk_low.clk, 240 .parent = &clk_pclk_low.clk,
261 .enable = s5p64x0_pclk_ctrl, 241 .enable = s5p64x0_pclk_ctrl,
262 .ctrlbit = (1 << 25), 242 .ctrlbit = (1 << 25),
263 }, { 243 }, {
264 .name = "iis", 244 .name = "iis",
265 .id = 0, 245 .devname = "samsung-i2s.0",
266 .parent = &clk_pclk_low.clk, 246 .parent = &clk_pclk_low.clk,
267 .enable = s5p64x0_pclk_ctrl, 247 .enable = s5p64x0_pclk_ctrl,
268 .ctrlbit = (1 << 26), 248 .ctrlbit = (1 << 26),
269 }, { 249 }, {
270 .name = "dsim", 250 .name = "dsim",
271 .id = -1,
272 .parent = &clk_pclk_low.clk, 251 .parent = &clk_pclk_low.clk,
273 .enable = s5p64x0_pclk_ctrl, 252 .enable = s5p64x0_pclk_ctrl,
274 .ctrlbit = (1 << 28), 253 .ctrlbit = (1 << 28),
275 }, { 254 }, {
276 .name = "etm", 255 .name = "etm",
277 .id = -1,
278 .parent = &clk_pclk.clk, 256 .parent = &clk_pclk.clk,
279 .enable = s5p64x0_pclk_ctrl, 257 .enable = s5p64x0_pclk_ctrl,
280 .ctrlbit = (1 << 29), 258 .ctrlbit = (1 << 29),
281 }, { 259 }, {
282 .name = "dmc0", 260 .name = "dmc0",
283 .id = -1,
284 .parent = &clk_pclk.clk, 261 .parent = &clk_pclk.clk,
285 .enable = s5p64x0_pclk_ctrl, 262 .enable = s5p64x0_pclk_ctrl,
286 .ctrlbit = (1 << 30), 263 .ctrlbit = (1 << 30),
287 }, { 264 }, {
288 .name = "pclk_fimgvg", 265 .name = "pclk_fimgvg",
289 .id = -1,
290 .parent = &clk_pclk.clk, 266 .parent = &clk_pclk.clk,
291 .enable = s5p64x0_pclk_ctrl, 267 .enable = s5p64x0_pclk_ctrl,
292 .ctrlbit = (1 << 31), 268 .ctrlbit = (1 << 31),
293 }, { 269 }, {
294 .name = "sclk_spi_48", 270 .name = "sclk_spi_48",
295 .id = 0, 271 .devname = "s3c64xx-spi.0",
296 .parent = &clk_48m, 272 .parent = &clk_48m,
297 .enable = s5p64x0_sclk_ctrl, 273 .enable = s5p64x0_sclk_ctrl,
298 .ctrlbit = (1 << 22), 274 .ctrlbit = (1 << 22),
299 }, { 275 }, {
300 .name = "sclk_spi_48", 276 .name = "sclk_spi_48",
301 .id = 1, 277 .devname = "s3c64xx-spi.1",
302 .parent = &clk_48m, 278 .parent = &clk_48m,
303 .enable = s5p64x0_sclk_ctrl, 279 .enable = s5p64x0_sclk_ctrl,
304 .ctrlbit = (1 << 23), 280 .ctrlbit = (1 << 23),
305 }, { 281 }, {
306 .name = "mmc_48m", 282 .name = "mmc_48m",
307 .id = 0, 283 .devname = "s3c-sdhci.0",
308 .parent = &clk_48m, 284 .parent = &clk_48m,
309 .enable = s5p64x0_sclk_ctrl, 285 .enable = s5p64x0_sclk_ctrl,
310 .ctrlbit = (1 << 27), 286 .ctrlbit = (1 << 27),
311 }, { 287 }, {
312 .name = "mmc_48m", 288 .name = "mmc_48m",
313 .id = 1, 289 .devname = "s3c-sdhci.1",
314 .parent = &clk_48m, 290 .parent = &clk_48m,
315 .enable = s5p64x0_sclk_ctrl, 291 .enable = s5p64x0_sclk_ctrl,
316 .ctrlbit = (1 << 28), 292 .ctrlbit = (1 << 28),
317 }, { 293 }, {
318 .name = "mmc_48m", 294 .name = "mmc_48m",
319 .id = 2, 295 .devname = "s3c-sdhci.2",
320 .parent = &clk_48m, 296 .parent = &clk_48m,
321 .enable = s5p64x0_sclk_ctrl, 297 .enable = s5p64x0_sclk_ctrl,
322 .ctrlbit = (1 << 29), 298 .ctrlbit = (1 << 29),
@@ -329,43 +305,40 @@ static struct clk init_clocks_off[] = {
329static struct clk init_clocks[] = { 305static struct clk init_clocks[] = {
330 { 306 {
331 .name = "intc", 307 .name = "intc",
332 .id = -1,
333 .parent = &clk_hclk.clk, 308 .parent = &clk_hclk.clk,
334 .enable = s5p64x0_hclk0_ctrl, 309 .enable = s5p64x0_hclk0_ctrl,
335 .ctrlbit = (1 << 1), 310 .ctrlbit = (1 << 1),
336 }, { 311 }, {
337 .name = "mem", 312 .name = "mem",
338 .id = -1,
339 .parent = &clk_hclk.clk, 313 .parent = &clk_hclk.clk,
340 .enable = s5p64x0_hclk0_ctrl, 314 .enable = s5p64x0_hclk0_ctrl,
341 .ctrlbit = (1 << 21), 315 .ctrlbit = (1 << 21),
342 }, { 316 }, {
343 .name = "uart", 317 .name = "uart",
344 .id = 0, 318 .devname = "s3c6400-uart.0",
345 .parent = &clk_pclk_low.clk, 319 .parent = &clk_pclk_low.clk,
346 .enable = s5p64x0_pclk_ctrl, 320 .enable = s5p64x0_pclk_ctrl,
347 .ctrlbit = (1 << 1), 321 .ctrlbit = (1 << 1),
348 }, { 322 }, {
349 .name = "uart", 323 .name = "uart",
350 .id = 1, 324 .devname = "s3c6400-uart.1",
351 .parent = &clk_pclk_low.clk, 325 .parent = &clk_pclk_low.clk,
352 .enable = s5p64x0_pclk_ctrl, 326 .enable = s5p64x0_pclk_ctrl,
353 .ctrlbit = (1 << 2), 327 .ctrlbit = (1 << 2),
354 }, { 328 }, {
355 .name = "uart", 329 .name = "uart",
356 .id = 2, 330 .devname = "s3c6400-uart.2",
357 .parent = &clk_pclk_low.clk, 331 .parent = &clk_pclk_low.clk,
358 .enable = s5p64x0_pclk_ctrl, 332 .enable = s5p64x0_pclk_ctrl,
359 .ctrlbit = (1 << 3), 333 .ctrlbit = (1 << 3),
360 }, { 334 }, {
361 .name = "uart", 335 .name = "uart",
362 .id = 3, 336 .devname = "s3c6400-uart.3",
363 .parent = &clk_pclk_low.clk, 337 .parent = &clk_pclk_low.clk,
364 .enable = s5p64x0_pclk_ctrl, 338 .enable = s5p64x0_pclk_ctrl,
365 .ctrlbit = (1 << 4), 339 .ctrlbit = (1 << 4),
366 }, { 340 }, {
367 .name = "gpio", 341 .name = "gpio",
368 .id = -1,
369 .parent = &clk_pclk_low.clk, 342 .parent = &clk_pclk_low.clk,
370 .enable = s5p64x0_pclk_ctrl, 343 .enable = s5p64x0_pclk_ctrl,
371 .ctrlbit = (1 << 18), 344 .ctrlbit = (1 << 18),
@@ -374,12 +347,10 @@ static struct clk init_clocks[] = {
374 347
375static struct clk clk_iis_cd_v40 = { 348static struct clk clk_iis_cd_v40 = {
376 .name = "iis_cdclk_v40", 349 .name = "iis_cdclk_v40",
377 .id = -1,
378}; 350};
379 351
380static struct clk clk_pcm_cd = { 352static struct clk clk_pcm_cd = {
381 .name = "pcm_cdclk", 353 .name = "pcm_cdclk",
382 .id = -1,
383}; 354};
384 355
385static struct clk *clkset_group1_list[] = { 356static struct clk *clkset_group1_list[] = {
@@ -420,7 +391,7 @@ static struct clksrc_clk clksrcs[] = {
420 { 391 {
421 .clk = { 392 .clk = {
422 .name = "sclk_mmc", 393 .name = "sclk_mmc",
423 .id = 0, 394 .devname = "s3c-sdhci.0",
424 .ctrlbit = (1 << 24), 395 .ctrlbit = (1 << 24),
425 .enable = s5p64x0_sclk_ctrl, 396 .enable = s5p64x0_sclk_ctrl,
426 }, 397 },
@@ -430,7 +401,7 @@ static struct clksrc_clk clksrcs[] = {
430 }, { 401 }, {
431 .clk = { 402 .clk = {
432 .name = "sclk_mmc", 403 .name = "sclk_mmc",
433 .id = 1, 404 .devname = "s3c-sdhci.1",
434 .ctrlbit = (1 << 25), 405 .ctrlbit = (1 << 25),
435 .enable = s5p64x0_sclk_ctrl, 406 .enable = s5p64x0_sclk_ctrl,
436 }, 407 },
@@ -440,7 +411,7 @@ static struct clksrc_clk clksrcs[] = {
440 }, { 411 }, {
441 .clk = { 412 .clk = {
442 .name = "sclk_mmc", 413 .name = "sclk_mmc",
443 .id = 2, 414 .devname = "s3c-sdhci.2",
444 .ctrlbit = (1 << 26), 415 .ctrlbit = (1 << 26),
445 .enable = s5p64x0_sclk_ctrl, 416 .enable = s5p64x0_sclk_ctrl,
446 }, 417 },
@@ -450,7 +421,6 @@ static struct clksrc_clk clksrcs[] = {
450 }, { 421 }, {
451 .clk = { 422 .clk = {
452 .name = "uclk1", 423 .name = "uclk1",
453 .id = -1,
454 .ctrlbit = (1 << 5), 424 .ctrlbit = (1 << 5),
455 .enable = s5p64x0_sclk_ctrl, 425 .enable = s5p64x0_sclk_ctrl,
456 }, 426 },
@@ -460,7 +430,7 @@ static struct clksrc_clk clksrcs[] = {
460 }, { 430 }, {
461 .clk = { 431 .clk = {
462 .name = "sclk_spi", 432 .name = "sclk_spi",
463 .id = 0, 433 .devname = "s3c64xx-spi.0",
464 .ctrlbit = (1 << 20), 434 .ctrlbit = (1 << 20),
465 .enable = s5p64x0_sclk_ctrl, 435 .enable = s5p64x0_sclk_ctrl,
466 }, 436 },
@@ -470,7 +440,7 @@ static struct clksrc_clk clksrcs[] = {
470 }, { 440 }, {
471 .clk = { 441 .clk = {
472 .name = "sclk_spi", 442 .name = "sclk_spi",
473 .id = 1, 443 .devname = "s3c64xx-spi.1",
474 .ctrlbit = (1 << 21), 444 .ctrlbit = (1 << 21),
475 .enable = s5p64x0_sclk_ctrl, 445 .enable = s5p64x0_sclk_ctrl,
476 }, 446 },
@@ -480,7 +450,6 @@ static struct clksrc_clk clksrcs[] = {
480 }, { 450 }, {
481 .clk = { 451 .clk = {
482 .name = "sclk_post", 452 .name = "sclk_post",
483 .id = -1,
484 .ctrlbit = (1 << 10), 453 .ctrlbit = (1 << 10),
485 .enable = s5p64x0_sclk_ctrl, 454 .enable = s5p64x0_sclk_ctrl,
486 }, 455 },
@@ -490,7 +459,6 @@ static struct clksrc_clk clksrcs[] = {
490 }, { 459 }, {
491 .clk = { 460 .clk = {
492 .name = "sclk_dispcon", 461 .name = "sclk_dispcon",
493 .id = -1,
494 .ctrlbit = (1 << 1), 462 .ctrlbit = (1 << 1),
495 .enable = s5p64x0_sclk1_ctrl, 463 .enable = s5p64x0_sclk1_ctrl,
496 }, 464 },
@@ -500,7 +468,6 @@ static struct clksrc_clk clksrcs[] = {
500 }, { 468 }, {
501 .clk = { 469 .clk = {
502 .name = "sclk_fimgvg", 470 .name = "sclk_fimgvg",
503 .id = -1,
504 .ctrlbit = (1 << 2), 471 .ctrlbit = (1 << 2),
505 .enable = s5p64x0_sclk1_ctrl, 472 .enable = s5p64x0_sclk1_ctrl,
506 }, 473 },
@@ -510,7 +477,6 @@ static struct clksrc_clk clksrcs[] = {
510 }, { 477 }, {
511 .clk = { 478 .clk = {
512 .name = "sclk_audio2", 479 .name = "sclk_audio2",
513 .id = -1,
514 .ctrlbit = (1 << 11), 480 .ctrlbit = (1 << 11),
515 .enable = s5p64x0_sclk_ctrl, 481 .enable = s5p64x0_sclk_ctrl,
516 }, 482 },
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c
index 4eec457ddccc..d9dc16cde109 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6450.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c
@@ -36,7 +36,6 @@
36static struct clksrc_clk clk_mout_dpll = { 36static struct clksrc_clk clk_mout_dpll = {
37 .clk = { 37 .clk = {
38 .name = "mout_dpll", 38 .name = "mout_dpll",
39 .id = -1,
40 }, 39 },
41 .sources = &clk_src_dpll, 40 .sources = &clk_src_dpll,
42 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 5, .size = 1 }, 41 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 5, .size = 1 },
@@ -96,7 +95,6 @@ static struct clk_ops s5p6450_epll_ops = {
96static struct clksrc_clk clk_dout_epll = { 95static struct clksrc_clk clk_dout_epll = {
97 .clk = { 96 .clk = {
98 .name = "dout_epll", 97 .name = "dout_epll",
99 .id = -1,
100 .parent = &clk_mout_epll.clk, 98 .parent = &clk_mout_epll.clk,
101 }, 99 },
102 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 24, .size = 4 }, 100 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 24, .size = 4 },
@@ -105,7 +103,6 @@ static struct clksrc_clk clk_dout_epll = {
105static struct clksrc_clk clk_mout_hclk_sel = { 103static struct clksrc_clk clk_mout_hclk_sel = {
106 .clk = { 104 .clk = {
107 .name = "mout_hclk_sel", 105 .name = "mout_hclk_sel",
108 .id = -1,
109 }, 106 },
110 .sources = &clkset_hclk_low, 107 .sources = &clkset_hclk_low,
111 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 15, .size = 1 }, 108 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 15, .size = 1 },
@@ -124,7 +121,6 @@ static struct clksrc_sources clkset_hclk = {
124static struct clksrc_clk clk_hclk = { 121static struct clksrc_clk clk_hclk = {
125 .clk = { 122 .clk = {
126 .name = "clk_hclk", 123 .name = "clk_hclk",
127 .id = -1,
128 }, 124 },
129 .sources = &clkset_hclk, 125 .sources = &clkset_hclk,
130 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 14, .size = 1 }, 126 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 14, .size = 1 },
@@ -134,7 +130,6 @@ static struct clksrc_clk clk_hclk = {
134static struct clksrc_clk clk_pclk = { 130static struct clksrc_clk clk_pclk = {
135 .clk = { 131 .clk = {
136 .name = "clk_pclk", 132 .name = "clk_pclk",
137 .id = -1,
138 .parent = &clk_hclk.clk, 133 .parent = &clk_hclk.clk,
139 }, 134 },
140 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 }, 135 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 },
@@ -142,7 +137,6 @@ static struct clksrc_clk clk_pclk = {
142static struct clksrc_clk clk_dout_pwm_ratio0 = { 137static struct clksrc_clk clk_dout_pwm_ratio0 = {
143 .clk = { 138 .clk = {
144 .name = "clk_dout_pwm_ratio0", 139 .name = "clk_dout_pwm_ratio0",
145 .id = -1,
146 .parent = &clk_mout_hclk_sel.clk, 140 .parent = &clk_mout_hclk_sel.clk,
147 }, 141 },
148 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 16, .size = 4 }, 142 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 16, .size = 4 },
@@ -151,7 +145,6 @@ static struct clksrc_clk clk_dout_pwm_ratio0 = {
151static struct clksrc_clk clk_pclk_to_wdt_pwm = { 145static struct clksrc_clk clk_pclk_to_wdt_pwm = {
152 .clk = { 146 .clk = {
153 .name = "clk_pclk_to_wdt_pwm", 147 .name = "clk_pclk_to_wdt_pwm",
154 .id = -1,
155 .parent = &clk_dout_pwm_ratio0.clk, 148 .parent = &clk_dout_pwm_ratio0.clk,
156 }, 149 },
157 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 20, .size = 4 }, 150 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 20, .size = 4 },
@@ -160,7 +153,6 @@ static struct clksrc_clk clk_pclk_to_wdt_pwm = {
160static struct clksrc_clk clk_hclk_low = { 153static struct clksrc_clk clk_hclk_low = {
161 .clk = { 154 .clk = {
162 .name = "clk_hclk_low", 155 .name = "clk_hclk_low",
163 .id = -1,
164 }, 156 },
165 .sources = &clkset_hclk_low, 157 .sources = &clkset_hclk_low,
166 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 6, .size = 1 }, 158 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 6, .size = 1 },
@@ -170,7 +162,6 @@ static struct clksrc_clk clk_hclk_low = {
170static struct clksrc_clk clk_pclk_low = { 162static struct clksrc_clk clk_pclk_low = {
171 .clk = { 163 .clk = {
172 .name = "clk_pclk_low", 164 .name = "clk_pclk_low",
173 .id = -1,
174 .parent = &clk_hclk_low.clk, 165 .parent = &clk_hclk_low.clk,
175 }, 166 },
176 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 }, 167 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 },
@@ -184,109 +175,101 @@ static struct clksrc_clk clk_pclk_low = {
184static struct clk init_clocks_off[] = { 175static struct clk init_clocks_off[] = {
185 { 176 {
186 .name = "usbhost", 177 .name = "usbhost",
187 .id = -1,
188 .parent = &clk_hclk_low.clk, 178 .parent = &clk_hclk_low.clk,
189 .enable = s5p64x0_hclk0_ctrl, 179 .enable = s5p64x0_hclk0_ctrl,
190 .ctrlbit = (1 << 3), 180 .ctrlbit = (1 << 3),
191 }, { 181 }, {
192 .name = "pdma", 182 .name = "pdma",
193 .id = -1,
194 .parent = &clk_hclk_low.clk, 183 .parent = &clk_hclk_low.clk,
195 .enable = s5p64x0_hclk0_ctrl, 184 .enable = s5p64x0_hclk0_ctrl,
196 .ctrlbit = (1 << 12), 185 .ctrlbit = (1 << 12),
197 }, { 186 }, {
198 .name = "hsmmc", 187 .name = "hsmmc",
199 .id = 0, 188 .devname = "s3c-sdhci.0",
200 .parent = &clk_hclk_low.clk, 189 .parent = &clk_hclk_low.clk,
201 .enable = s5p64x0_hclk0_ctrl, 190 .enable = s5p64x0_hclk0_ctrl,
202 .ctrlbit = (1 << 17), 191 .ctrlbit = (1 << 17),
203 }, { 192 }, {
204 .name = "hsmmc", 193 .name = "hsmmc",
205 .id = 1, 194 .devname = "s3c-sdhci.1",
206 .parent = &clk_hclk_low.clk, 195 .parent = &clk_hclk_low.clk,
207 .enable = s5p64x0_hclk0_ctrl, 196 .enable = s5p64x0_hclk0_ctrl,
208 .ctrlbit = (1 << 18), 197 .ctrlbit = (1 << 18),
209 }, { 198 }, {
210 .name = "hsmmc", 199 .name = "hsmmc",
211 .id = 2, 200 .devname = "s3c-sdhci.2",
212 .parent = &clk_hclk_low.clk, 201 .parent = &clk_hclk_low.clk,
213 .enable = s5p64x0_hclk0_ctrl, 202 .enable = s5p64x0_hclk0_ctrl,
214 .ctrlbit = (1 << 19), 203 .ctrlbit = (1 << 19),
215 }, { 204 }, {
216 .name = "usbotg", 205 .name = "usbotg",
217 .id = -1,
218 .parent = &clk_hclk_low.clk, 206 .parent = &clk_hclk_low.clk,
219 .enable = s5p64x0_hclk0_ctrl, 207 .enable = s5p64x0_hclk0_ctrl,
220 .ctrlbit = (1 << 20), 208 .ctrlbit = (1 << 20),
221 }, { 209 }, {
222 .name = "lcd", 210 .name = "lcd",
223 .id = -1,
224 .parent = &clk_h, 211 .parent = &clk_h,
225 .enable = s5p64x0_hclk1_ctrl, 212 .enable = s5p64x0_hclk1_ctrl,
226 .ctrlbit = (1 << 1), 213 .ctrlbit = (1 << 1),
227 }, { 214 }, {
228 .name = "watchdog", 215 .name = "watchdog",
229 .id = -1,
230 .parent = &clk_pclk_low.clk, 216 .parent = &clk_pclk_low.clk,
231 .enable = s5p64x0_pclk_ctrl, 217 .enable = s5p64x0_pclk_ctrl,
232 .ctrlbit = (1 << 5), 218 .ctrlbit = (1 << 5),
233 }, { 219 }, {
234 .name = "rtc", 220 .name = "rtc",
235 .id = -1,
236 .parent = &clk_pclk_low.clk, 221 .parent = &clk_pclk_low.clk,
237 .enable = s5p64x0_pclk_ctrl, 222 .enable = s5p64x0_pclk_ctrl,
238 .ctrlbit = (1 << 6), 223 .ctrlbit = (1 << 6),
239 }, { 224 }, {
240 .name = "adc", 225 .name = "adc",
241 .id = -1,
242 .parent = &clk_pclk_low.clk, 226 .parent = &clk_pclk_low.clk,
243 .enable = s5p64x0_pclk_ctrl, 227 .enable = s5p64x0_pclk_ctrl,
244 .ctrlbit = (1 << 12), 228 .ctrlbit = (1 << 12),
245 }, { 229 }, {
246 .name = "i2c", 230 .name = "i2c",
247 .id = 0, 231 .devname = "s3c2440-i2c.0",
248 .parent = &clk_pclk_low.clk, 232 .parent = &clk_pclk_low.clk,
249 .enable = s5p64x0_pclk_ctrl, 233 .enable = s5p64x0_pclk_ctrl,
250 .ctrlbit = (1 << 17), 234 .ctrlbit = (1 << 17),
251 }, { 235 }, {
252 .name = "spi", 236 .name = "spi",
253 .id = 0, 237 .devname = "s3c64xx-spi.0",
254 .parent = &clk_pclk_low.clk, 238 .parent = &clk_pclk_low.clk,
255 .enable = s5p64x0_pclk_ctrl, 239 .enable = s5p64x0_pclk_ctrl,
256 .ctrlbit = (1 << 21), 240 .ctrlbit = (1 << 21),
257 }, { 241 }, {
258 .name = "spi", 242 .name = "spi",
259 .id = 1, 243 .devname = "s3c64xx-spi.1",
260 .parent = &clk_pclk_low.clk, 244 .parent = &clk_pclk_low.clk,
261 .enable = s5p64x0_pclk_ctrl, 245 .enable = s5p64x0_pclk_ctrl,
262 .ctrlbit = (1 << 22), 246 .ctrlbit = (1 << 22),
263 }, { 247 }, {
264 .name = "iis", 248 .name = "iis",
265 .id = 0, 249 .devname = "samsung-i2s.0",
266 .parent = &clk_pclk_low.clk, 250 .parent = &clk_pclk_low.clk,
267 .enable = s5p64x0_pclk_ctrl, 251 .enable = s5p64x0_pclk_ctrl,
268 .ctrlbit = (1 << 26), 252 .ctrlbit = (1 << 26),
269 }, { 253 }, {
270 .name = "iis", 254 .name = "iis",
271 .id = 1, 255 .devname = "samsung-i2s.1",
272 .parent = &clk_pclk_low.clk, 256 .parent = &clk_pclk_low.clk,
273 .enable = s5p64x0_pclk_ctrl, 257 .enable = s5p64x0_pclk_ctrl,
274 .ctrlbit = (1 << 15), 258 .ctrlbit = (1 << 15),
275 }, { 259 }, {
276 .name = "iis", 260 .name = "iis",
277 .id = 2, 261 .devname = "samsung-i2s.2",
278 .parent = &clk_pclk_low.clk, 262 .parent = &clk_pclk_low.clk,
279 .enable = s5p64x0_pclk_ctrl, 263 .enable = s5p64x0_pclk_ctrl,
280 .ctrlbit = (1 << 16), 264 .ctrlbit = (1 << 16),
281 }, { 265 }, {
282 .name = "i2c", 266 .name = "i2c",
283 .id = 1, 267 .devname = "s3c2440-i2c.1",
284 .parent = &clk_pclk_low.clk, 268 .parent = &clk_pclk_low.clk,
285 .enable = s5p64x0_pclk_ctrl, 269 .enable = s5p64x0_pclk_ctrl,
286 .ctrlbit = (1 << 27), 270 .ctrlbit = (1 << 27),
287 }, { 271 }, {
288 .name = "dmc0", 272 .name = "dmc0",
289 .id = -1,
290 .parent = &clk_pclk.clk, 273 .parent = &clk_pclk.clk,
291 .enable = s5p64x0_pclk_ctrl, 274 .enable = s5p64x0_pclk_ctrl,
292 .ctrlbit = (1 << 30), 275 .ctrlbit = (1 << 30),
@@ -299,49 +282,45 @@ static struct clk init_clocks_off[] = {
299static struct clk init_clocks[] = { 282static struct clk init_clocks[] = {
300 { 283 {
301 .name = "intc", 284 .name = "intc",
302 .id = -1,
303 .parent = &clk_hclk.clk, 285 .parent = &clk_hclk.clk,
304 .enable = s5p64x0_hclk0_ctrl, 286 .enable = s5p64x0_hclk0_ctrl,
305 .ctrlbit = (1 << 1), 287 .ctrlbit = (1 << 1),
306 }, { 288 }, {
307 .name = "mem", 289 .name = "mem",
308 .id = -1,
309 .parent = &clk_hclk.clk, 290 .parent = &clk_hclk.clk,
310 .enable = s5p64x0_hclk0_ctrl, 291 .enable = s5p64x0_hclk0_ctrl,
311 .ctrlbit = (1 << 21), 292 .ctrlbit = (1 << 21),
312 }, { 293 }, {
313 .name = "uart", 294 .name = "uart",
314 .id = 0, 295 .devname = "s3c6400-uart.0",
315 .parent = &clk_pclk_low.clk, 296 .parent = &clk_pclk_low.clk,
316 .enable = s5p64x0_pclk_ctrl, 297 .enable = s5p64x0_pclk_ctrl,
317 .ctrlbit = (1 << 1), 298 .ctrlbit = (1 << 1),
318 }, { 299 }, {
319 .name = "uart", 300 .name = "uart",
320 .id = 1, 301 .devname = "s3c6400-uart.1",
321 .parent = &clk_pclk_low.clk, 302 .parent = &clk_pclk_low.clk,
322 .enable = s5p64x0_pclk_ctrl, 303 .enable = s5p64x0_pclk_ctrl,
323 .ctrlbit = (1 << 2), 304 .ctrlbit = (1 << 2),
324 }, { 305 }, {
325 .name = "uart", 306 .name = "uart",
326 .id = 2, 307 .devname = "s3c6400-uart.2",
327 .parent = &clk_pclk_low.clk, 308 .parent = &clk_pclk_low.clk,
328 .enable = s5p64x0_pclk_ctrl, 309 .enable = s5p64x0_pclk_ctrl,
329 .ctrlbit = (1 << 3), 310 .ctrlbit = (1 << 3),
330 }, { 311 }, {
331 .name = "uart", 312 .name = "uart",
332 .id = 3, 313 .devname = "s3c6400-uart.3",
333 .parent = &clk_pclk_low.clk, 314 .parent = &clk_pclk_low.clk,
334 .enable = s5p64x0_pclk_ctrl, 315 .enable = s5p64x0_pclk_ctrl,
335 .ctrlbit = (1 << 4), 316 .ctrlbit = (1 << 4),
336 }, { 317 }, {
337 .name = "timers", 318 .name = "timers",
338 .id = -1,
339 .parent = &clk_pclk_to_wdt_pwm.clk, 319 .parent = &clk_pclk_to_wdt_pwm.clk,
340 .enable = s5p64x0_pclk_ctrl, 320 .enable = s5p64x0_pclk_ctrl,
341 .ctrlbit = (1 << 7), 321 .ctrlbit = (1 << 7),
342 }, { 322 }, {
343 .name = "gpio", 323 .name = "gpio",
344 .id = -1,
345 .parent = &clk_pclk_low.clk, 324 .parent = &clk_pclk_low.clk,
346 .enable = s5p64x0_pclk_ctrl, 325 .enable = s5p64x0_pclk_ctrl,
347 .ctrlbit = (1 << 18), 326 .ctrlbit = (1 << 18),
@@ -421,7 +400,6 @@ static struct clksrc_sources clkset_sclk_audio0 = {
421static struct clksrc_clk clk_sclk_audio0 = { 400static struct clksrc_clk clk_sclk_audio0 = {
422 .clk = { 401 .clk = {
423 .name = "audio-bus", 402 .name = "audio-bus",
424 .id = -1,
425 .enable = s5p64x0_sclk_ctrl, 403 .enable = s5p64x0_sclk_ctrl,
426 .ctrlbit = (1 << 8), 404 .ctrlbit = (1 << 8),
427 .parent = &clk_dout_epll.clk, 405 .parent = &clk_dout_epll.clk,
@@ -435,7 +413,7 @@ static struct clksrc_clk clksrcs[] = {
435 { 413 {
436 .clk = { 414 .clk = {
437 .name = "sclk_mmc", 415 .name = "sclk_mmc",
438 .id = 0, 416 .devname = "s3c-sdhci.0",
439 .ctrlbit = (1 << 24), 417 .ctrlbit = (1 << 24),
440 .enable = s5p64x0_sclk_ctrl, 418 .enable = s5p64x0_sclk_ctrl,
441 }, 419 },
@@ -445,7 +423,7 @@ static struct clksrc_clk clksrcs[] = {
445 }, { 423 }, {
446 .clk = { 424 .clk = {
447 .name = "sclk_mmc", 425 .name = "sclk_mmc",
448 .id = 1, 426 .devname = "s3c-sdhci.1",
449 .ctrlbit = (1 << 25), 427 .ctrlbit = (1 << 25),
450 .enable = s5p64x0_sclk_ctrl, 428 .enable = s5p64x0_sclk_ctrl,
451 }, 429 },
@@ -455,7 +433,7 @@ static struct clksrc_clk clksrcs[] = {
455 }, { 433 }, {
456 .clk = { 434 .clk = {
457 .name = "sclk_mmc", 435 .name = "sclk_mmc",
458 .id = 2, 436 .devname = "s3c-sdhci.2",
459 .ctrlbit = (1 << 26), 437 .ctrlbit = (1 << 26),
460 .enable = s5p64x0_sclk_ctrl, 438 .enable = s5p64x0_sclk_ctrl,
461 }, 439 },
@@ -465,7 +443,6 @@ static struct clksrc_clk clksrcs[] = {
465 }, { 443 }, {
466 .clk = { 444 .clk = {
467 .name = "uclk1", 445 .name = "uclk1",
468 .id = -1,
469 .ctrlbit = (1 << 5), 446 .ctrlbit = (1 << 5),
470 .enable = s5p64x0_sclk_ctrl, 447 .enable = s5p64x0_sclk_ctrl,
471 }, 448 },
@@ -475,7 +452,7 @@ static struct clksrc_clk clksrcs[] = {
475 }, { 452 }, {
476 .clk = { 453 .clk = {
477 .name = "sclk_spi", 454 .name = "sclk_spi",
478 .id = 0, 455 .devname = "s3c64xx-spi.0",
479 .ctrlbit = (1 << 20), 456 .ctrlbit = (1 << 20),
480 .enable = s5p64x0_sclk_ctrl, 457 .enable = s5p64x0_sclk_ctrl,
481 }, 458 },
@@ -485,7 +462,7 @@ static struct clksrc_clk clksrcs[] = {
485 }, { 462 }, {
486 .clk = { 463 .clk = {
487 .name = "sclk_spi", 464 .name = "sclk_spi",
488 .id = 1, 465 .devname = "s3c64xx-spi.1",
489 .ctrlbit = (1 << 21), 466 .ctrlbit = (1 << 21),
490 .enable = s5p64x0_sclk_ctrl, 467 .enable = s5p64x0_sclk_ctrl,
491 }, 468 },
@@ -495,7 +472,6 @@ static struct clksrc_clk clksrcs[] = {
495 }, { 472 }, {
496 .clk = { 473 .clk = {
497 .name = "sclk_fimc", 474 .name = "sclk_fimc",
498 .id = -1,
499 .ctrlbit = (1 << 10), 475 .ctrlbit = (1 << 10),
500 .enable = s5p64x0_sclk_ctrl, 476 .enable = s5p64x0_sclk_ctrl,
501 }, 477 },
@@ -505,7 +481,6 @@ static struct clksrc_clk clksrcs[] = {
505 }, { 481 }, {
506 .clk = { 482 .clk = {
507 .name = "aclk_mali", 483 .name = "aclk_mali",
508 .id = -1,
509 .ctrlbit = (1 << 2), 484 .ctrlbit = (1 << 2),
510 .enable = s5p64x0_sclk1_ctrl, 485 .enable = s5p64x0_sclk1_ctrl,
511 }, 486 },
@@ -515,7 +490,6 @@ static struct clksrc_clk clksrcs[] = {
515 }, { 490 }, {
516 .clk = { 491 .clk = {
517 .name = "sclk_2d", 492 .name = "sclk_2d",
518 .id = -1,
519 .ctrlbit = (1 << 12), 493 .ctrlbit = (1 << 12),
520 .enable = s5p64x0_sclk_ctrl, 494 .enable = s5p64x0_sclk_ctrl,
521 }, 495 },
@@ -525,7 +499,6 @@ static struct clksrc_clk clksrcs[] = {
525 }, { 499 }, {
526 .clk = { 500 .clk = {
527 .name = "sclk_usi", 501 .name = "sclk_usi",
528 .id = -1,
529 .ctrlbit = (1 << 7), 502 .ctrlbit = (1 << 7),
530 .enable = s5p64x0_sclk_ctrl, 503 .enable = s5p64x0_sclk_ctrl,
531 }, 504 },
@@ -535,7 +508,6 @@ static struct clksrc_clk clksrcs[] = {
535 }, { 508 }, {
536 .clk = { 509 .clk = {
537 .name = "sclk_camif", 510 .name = "sclk_camif",
538 .id = -1,
539 .ctrlbit = (1 << 6), 511 .ctrlbit = (1 << 6),
540 .enable = s5p64x0_sclk_ctrl, 512 .enable = s5p64x0_sclk_ctrl,
541 }, 513 },
@@ -545,7 +517,6 @@ static struct clksrc_clk clksrcs[] = {
545 }, { 517 }, {
546 .clk = { 518 .clk = {
547 .name = "sclk_dispcon", 519 .name = "sclk_dispcon",
548 .id = -1,
549 .ctrlbit = (1 << 1), 520 .ctrlbit = (1 << 1),
550 .enable = s5p64x0_sclk1_ctrl, 521 .enable = s5p64x0_sclk1_ctrl,
551 }, 522 },
@@ -555,7 +526,6 @@ static struct clksrc_clk clksrcs[] = {
555 }, { 526 }, {
556 .clk = { 527 .clk = {
557 .name = "sclk_hsmmc44", 528 .name = "sclk_hsmmc44",
558 .id = -1,
559 .ctrlbit = (1 << 30), 529 .ctrlbit = (1 << 30),
560 .enable = s5p64x0_sclk_ctrl, 530 .enable = s5p64x0_sclk_ctrl,
561 }, 531 },
diff --git a/arch/arm/mach-s5p64x0/dev-spi.c b/arch/arm/mach-s5p64x0/dev-spi.c
index e78ee18c76e3..ac825e826326 100644
--- a/arch/arm/mach-s5p64x0/dev-spi.c
+++ b/arch/arm/mach-s5p64x0/dev-spi.c
@@ -112,12 +112,14 @@ static struct s3c64xx_spi_info s5p6440_spi0_pdata = {
112 .cfg_gpio = s5p6440_spi_cfg_gpio, 112 .cfg_gpio = s5p6440_spi_cfg_gpio,
113 .fifo_lvl_mask = 0x1ff, 113 .fifo_lvl_mask = 0x1ff,
114 .rx_lvl_offset = 15, 114 .rx_lvl_offset = 15,
115 .tx_st_done = 25,
115}; 116};
116 117
117static struct s3c64xx_spi_info s5p6450_spi0_pdata = { 118static struct s3c64xx_spi_info s5p6450_spi0_pdata = {
118 .cfg_gpio = s5p6450_spi_cfg_gpio, 119 .cfg_gpio = s5p6450_spi_cfg_gpio,
119 .fifo_lvl_mask = 0x1ff, 120 .fifo_lvl_mask = 0x1ff,
120 .rx_lvl_offset = 15, 121 .rx_lvl_offset = 15,
122 .tx_st_done = 25,
121}; 123};
122 124
123static u64 spi_dmamask = DMA_BIT_MASK(32); 125static u64 spi_dmamask = DMA_BIT_MASK(32);
@@ -160,12 +162,14 @@ static struct s3c64xx_spi_info s5p6440_spi1_pdata = {
160 .cfg_gpio = s5p6440_spi_cfg_gpio, 162 .cfg_gpio = s5p6440_spi_cfg_gpio,
161 .fifo_lvl_mask = 0x7f, 163 .fifo_lvl_mask = 0x7f,
162 .rx_lvl_offset = 15, 164 .rx_lvl_offset = 15,
165 .tx_st_done = 25,
163}; 166};
164 167
165static struct s3c64xx_spi_info s5p6450_spi1_pdata = { 168static struct s3c64xx_spi_info s5p6450_spi1_pdata = {
166 .cfg_gpio = s5p6450_spi_cfg_gpio, 169 .cfg_gpio = s5p6450_spi_cfg_gpio,
167 .fifo_lvl_mask = 0x7f, 170 .fifo_lvl_mask = 0x7f,
168 .rx_lvl_offset = 15, 171 .rx_lvl_offset = 15,
172 .tx_st_done = 25,
169}; 173};
170 174
171struct platform_device s5p64x0_device_spi1 = { 175struct platform_device s5p64x0_device_spi1 = {
diff --git a/arch/arm/mach-s5p64x0/include/mach/clkdev.h b/arch/arm/mach-s5p64x0/include/mach/clkdev.h
new file mode 100644
index 000000000000..7dffa83d23ff
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __MACH_CLKDEV_H__
2#define __MACH_CLKDEV_H__
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do {} while (0)
6
7#endif
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 2d559f10fd47..346f8dfa6f35 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -46,6 +46,7 @@
46#include <plat/adc.h> 46#include <plat/adc.h>
47#include <plat/ts.h> 47#include <plat/ts.h>
48#include <plat/s5p-time.h> 48#include <plat/s5p-time.h>
49#include <plat/backlight.h>
49 50
50#define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 51#define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
51 S3C2410_UCON_RXILEVEL | \ 52 S3C2410_UCON_RXILEVEL | \
@@ -91,45 +92,6 @@ static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
91 }, 92 },
92}; 93};
93 94
94static int smdk6440_backlight_init(struct device *dev)
95{
96 int ret;
97
98 ret = gpio_request(S5P6440_GPF(15), "Backlight");
99 if (ret) {
100 printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
101 return ret;
102 }
103
104 /* Configure GPIO pin with S5P6440_GPF15_PWM_TOUT1 */
105 s3c_gpio_cfgpin(S5P6440_GPF(15), S3C_GPIO_SFN(2));
106
107 return 0;
108}
109
110static void smdk6440_backlight_exit(struct device *dev)
111{
112 s3c_gpio_cfgpin(S5P6440_GPF(15), S3C_GPIO_OUTPUT);
113 gpio_free(S5P6440_GPF(15));
114}
115
116static struct platform_pwm_backlight_data smdk6440_backlight_data = {
117 .pwm_id = 1,
118 .max_brightness = 255,
119 .dft_brightness = 255,
120 .pwm_period_ns = 78770,
121 .init = smdk6440_backlight_init,
122 .exit = smdk6440_backlight_exit,
123};
124
125static struct platform_device smdk6440_backlight_device = {
126 .name = "pwm-backlight",
127 .dev = {
128 .parent = &s3c_device_timer[1].dev,
129 .platform_data = &smdk6440_backlight_data,
130 },
131};
132
133static struct platform_device *smdk6440_devices[] __initdata = { 95static struct platform_device *smdk6440_devices[] __initdata = {
134 &s3c_device_adc, 96 &s3c_device_adc,
135 &s3c_device_rtc, 97 &s3c_device_rtc,
@@ -139,8 +101,6 @@ static struct platform_device *smdk6440_devices[] __initdata = {
139 &s3c_device_wdt, 101 &s3c_device_wdt,
140 &samsung_asoc_dma, 102 &samsung_asoc_dma,
141 &s5p6440_device_iis, 103 &s5p6440_device_iis,
142 &s3c_device_timer[1],
143 &smdk6440_backlight_device,
144}; 104};
145 105
146static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = { 106static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
@@ -175,6 +135,16 @@ static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
175 .oversampling_shift = 2, 135 .oversampling_shift = 2,
176}; 136};
177 137
138/* LCD Backlight data */
139static struct samsung_bl_gpio_info smdk6440_bl_gpio_info = {
140 .no = S5P6440_GPF(15),
141 .func = S3C_GPIO_SFN(2),
142};
143
144static struct platform_pwm_backlight_data smdk6440_bl_data = {
145 .pwm_id = 1,
146};
147
178static void __init smdk6440_map_io(void) 148static void __init smdk6440_map_io(void)
179{ 149{
180 s5p_init_io(NULL, 0, S5P64X0_SYS_ID); 150 s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
@@ -194,6 +164,8 @@ static void __init smdk6440_machine_init(void)
194 i2c_register_board_info(1, smdk6440_i2c_devs1, 164 i2c_register_board_info(1, smdk6440_i2c_devs1,
195 ARRAY_SIZE(smdk6440_i2c_devs1)); 165 ARRAY_SIZE(smdk6440_i2c_devs1));
196 166
167 samsung_bl_set(&smdk6440_bl_gpio_info, &smdk6440_bl_data);
168
197 platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices)); 169 platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
198} 170}
199 171
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index d19c4690ee97..33f2adf8f3fe 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -46,6 +46,7 @@
46#include <plat/adc.h> 46#include <plat/adc.h>
47#include <plat/ts.h> 47#include <plat/ts.h>
48#include <plat/s5p-time.h> 48#include <plat/s5p-time.h>
49#include <plat/backlight.h>
49 50
50#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 51#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
51 S3C2410_UCON_RXILEVEL | \ 52 S3C2410_UCON_RXILEVEL | \
@@ -109,45 +110,6 @@ static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
109#endif 110#endif
110}; 111};
111 112
112static int smdk6450_backlight_init(struct device *dev)
113{
114 int ret;
115
116 ret = gpio_request(S5P6450_GPF(15), "Backlight");
117 if (ret) {
118 printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
119 return ret;
120 }
121
122 /* Configure GPIO pin with S5P6450_GPF15_PWM_TOUT1 */
123 s3c_gpio_cfgpin(S5P6450_GPF(15), S3C_GPIO_SFN(2));
124
125 return 0;
126}
127
128static void smdk6450_backlight_exit(struct device *dev)
129{
130 s3c_gpio_cfgpin(S5P6450_GPF(15), S3C_GPIO_OUTPUT);
131 gpio_free(S5P6450_GPF(15));
132}
133
134static struct platform_pwm_backlight_data smdk6450_backlight_data = {
135 .pwm_id = 1,
136 .max_brightness = 255,
137 .dft_brightness = 255,
138 .pwm_period_ns = 78770,
139 .init = smdk6450_backlight_init,
140 .exit = smdk6450_backlight_exit,
141};
142
143static struct platform_device smdk6450_backlight_device = {
144 .name = "pwm-backlight",
145 .dev = {
146 .parent = &s3c_device_timer[1].dev,
147 .platform_data = &smdk6450_backlight_data,
148 },
149};
150
151static struct platform_device *smdk6450_devices[] __initdata = { 113static struct platform_device *smdk6450_devices[] __initdata = {
152 &s3c_device_adc, 114 &s3c_device_adc,
153 &s3c_device_rtc, 115 &s3c_device_rtc,
@@ -157,8 +119,6 @@ static struct platform_device *smdk6450_devices[] __initdata = {
157 &s3c_device_wdt, 119 &s3c_device_wdt,
158 &samsung_asoc_dma, 120 &samsung_asoc_dma,
159 &s5p6450_device_iis0, 121 &s5p6450_device_iis0,
160 &s3c_device_timer[1],
161 &smdk6450_backlight_device,
162 /* s5p6450_device_spi0 will be added */ 122 /* s5p6450_device_spi0 will be added */
163}; 123};
164 124
@@ -194,6 +154,16 @@ static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
194 .oversampling_shift = 2, 154 .oversampling_shift = 2,
195}; 155};
196 156
157/* LCD Backlight data */
158static struct samsung_bl_gpio_info smdk6450_bl_gpio_info = {
159 .no = S5P6450_GPF(15),
160 .func = S3C_GPIO_SFN(2),
161};
162
163static struct platform_pwm_backlight_data smdk6450_bl_data = {
164 .pwm_id = 1,
165};
166
197static void __init smdk6450_map_io(void) 167static void __init smdk6450_map_io(void)
198{ 168{
199 s5p_init_io(NULL, 0, S5P64X0_SYS_ID); 169 s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
@@ -213,6 +183,8 @@ static void __init smdk6450_machine_init(void)
213 i2c_register_board_info(1, smdk6450_i2c_devs1, 183 i2c_register_board_info(1, smdk6450_i2c_devs1,
214 ARRAY_SIZE(smdk6450_i2c_devs1)); 184 ARRAY_SIZE(smdk6450_i2c_devs1));
215 185
186 samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data);
187
216 platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices)); 188 platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
217} 189}
218 190
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index 608722ff4f28..e8a33c4b054c 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -56,6 +56,7 @@ config MACH_SMDKC100
56 select S3C_DEV_RTC 56 select S3C_DEV_RTC
57 select S3C_DEV_WDT 57 select S3C_DEV_WDT
58 select SAMSUNG_DEV_ADC 58 select SAMSUNG_DEV_ADC
59 select SAMSUNG_DEV_BACKLIGHT
59 select SAMSUNG_DEV_IDE 60 select SAMSUNG_DEV_IDE
60 select SAMSUNG_DEV_KEYPAD 61 select SAMSUNG_DEV_KEYPAD
61 select SAMSUNG_DEV_PWM 62 select SAMSUNG_DEV_PWM
diff --git a/arch/arm/mach-s5pc100/clock.c b/arch/arm/mach-s5pc100/clock.c
index 0305e9b8282d..ff5cbb30de5b 100644
--- a/arch/arm/mach-s5pc100/clock.c
+++ b/arch/arm/mach-s5pc100/clock.c
@@ -31,7 +31,6 @@
31 31
32static struct clk s5p_clk_otgphy = { 32static struct clk s5p_clk_otgphy = {
33 .name = "otg_phy", 33 .name = "otg_phy",
34 .id = -1,
35}; 34};
36 35
37static struct clk *clk_src_mout_href_list[] = { 36static struct clk *clk_src_mout_href_list[] = {
@@ -47,7 +46,6 @@ static struct clksrc_sources clk_src_mout_href = {
47static struct clksrc_clk clk_mout_href = { 46static struct clksrc_clk clk_mout_href = {
48 .clk = { 47 .clk = {
49 .name = "mout_href", 48 .name = "mout_href",
50 .id = -1,
51 }, 49 },
52 .sources = &clk_src_mout_href, 50 .sources = &clk_src_mout_href,
53 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 }, 51 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 },
@@ -66,7 +64,6 @@ static struct clksrc_sources clk_src_mout_48m = {
66static struct clksrc_clk clk_mout_48m = { 64static struct clksrc_clk clk_mout_48m = {
67 .clk = { 65 .clk = {
68 .name = "mout_48m", 66 .name = "mout_48m",
69 .id = -1,
70 }, 67 },
71 .sources = &clk_src_mout_48m, 68 .sources = &clk_src_mout_48m,
72 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 24, .size = 1 }, 69 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 24, .size = 1 },
@@ -75,7 +72,6 @@ static struct clksrc_clk clk_mout_48m = {
75static struct clksrc_clk clk_mout_mpll = { 72static struct clksrc_clk clk_mout_mpll = {
76 .clk = { 73 .clk = {
77 .name = "mout_mpll", 74 .name = "mout_mpll",
78 .id = -1,
79 }, 75 },
80 .sources = &clk_src_mpll, 76 .sources = &clk_src_mpll,
81 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 }, 77 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 },
@@ -85,7 +81,6 @@ static struct clksrc_clk clk_mout_mpll = {
85static struct clksrc_clk clk_mout_apll = { 81static struct clksrc_clk clk_mout_apll = {
86 .clk = { 82 .clk = {
87 .name = "mout_apll", 83 .name = "mout_apll",
88 .id = -1,
89 }, 84 },
90 .sources = &clk_src_apll, 85 .sources = &clk_src_apll,
91 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 }, 86 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 },
@@ -94,7 +89,6 @@ static struct clksrc_clk clk_mout_apll = {
94static struct clksrc_clk clk_mout_epll = { 89static struct clksrc_clk clk_mout_epll = {
95 .clk = { 90 .clk = {
96 .name = "mout_epll", 91 .name = "mout_epll",
97 .id = -1,
98 }, 92 },
99 .sources = &clk_src_epll, 93 .sources = &clk_src_epll,
100 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 }, 94 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 },
@@ -112,7 +106,6 @@ static struct clksrc_sources clk_src_mout_hpll = {
112static struct clksrc_clk clk_mout_hpll = { 106static struct clksrc_clk clk_mout_hpll = {
113 .clk = { 107 .clk = {
114 .name = "mout_hpll", 108 .name = "mout_hpll",
115 .id = -1,
116 }, 109 },
117 .sources = &clk_src_mout_hpll, 110 .sources = &clk_src_mout_hpll,
118 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 }, 111 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 },
@@ -121,7 +114,6 @@ static struct clksrc_clk clk_mout_hpll = {
121static struct clksrc_clk clk_div_apll = { 114static struct clksrc_clk clk_div_apll = {
122 .clk = { 115 .clk = {
123 .name = "div_apll", 116 .name = "div_apll",
124 .id = -1,
125 .parent = &clk_mout_apll.clk, 117 .parent = &clk_mout_apll.clk,
126 }, 118 },
127 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 1 }, 119 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 1 },
@@ -130,7 +122,6 @@ static struct clksrc_clk clk_div_apll = {
130static struct clksrc_clk clk_div_arm = { 122static struct clksrc_clk clk_div_arm = {
131 .clk = { 123 .clk = {
132 .name = "div_arm", 124 .name = "div_arm",
133 .id = -1,
134 .parent = &clk_div_apll.clk, 125 .parent = &clk_div_apll.clk,
135 }, 126 },
136 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 }, 127 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 },
@@ -139,7 +130,6 @@ static struct clksrc_clk clk_div_arm = {
139static struct clksrc_clk clk_div_d0_bus = { 130static struct clksrc_clk clk_div_d0_bus = {
140 .clk = { 131 .clk = {
141 .name = "div_d0_bus", 132 .name = "div_d0_bus",
142 .id = -1,
143 .parent = &clk_div_arm.clk, 133 .parent = &clk_div_arm.clk,
144 }, 134 },
145 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 }, 135 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 },
@@ -148,7 +138,6 @@ static struct clksrc_clk clk_div_d0_bus = {
148static struct clksrc_clk clk_div_pclkd0 = { 138static struct clksrc_clk clk_div_pclkd0 = {
149 .clk = { 139 .clk = {
150 .name = "div_pclkd0", 140 .name = "div_pclkd0",
151 .id = -1,
152 .parent = &clk_div_d0_bus.clk, 141 .parent = &clk_div_d0_bus.clk,
153 }, 142 },
154 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 }, 143 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 },
@@ -157,7 +146,6 @@ static struct clksrc_clk clk_div_pclkd0 = {
157static struct clksrc_clk clk_div_secss = { 146static struct clksrc_clk clk_div_secss = {
158 .clk = { 147 .clk = {
159 .name = "div_secss", 148 .name = "div_secss",
160 .id = -1,
161 .parent = &clk_div_d0_bus.clk, 149 .parent = &clk_div_d0_bus.clk,
162 }, 150 },
163 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 3 }, 151 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 3 },
@@ -166,7 +154,6 @@ static struct clksrc_clk clk_div_secss = {
166static struct clksrc_clk clk_div_apll2 = { 154static struct clksrc_clk clk_div_apll2 = {
167 .clk = { 155 .clk = {
168 .name = "div_apll2", 156 .name = "div_apll2",
169 .id = -1,
170 .parent = &clk_mout_apll.clk, 157 .parent = &clk_mout_apll.clk,
171 }, 158 },
172 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 3 }, 159 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 3 },
@@ -185,7 +172,6 @@ struct clksrc_sources clk_src_mout_am = {
185static struct clksrc_clk clk_mout_am = { 172static struct clksrc_clk clk_mout_am = {
186 .clk = { 173 .clk = {
187 .name = "mout_am", 174 .name = "mout_am",
188 .id = -1,
189 }, 175 },
190 .sources = &clk_src_mout_am, 176 .sources = &clk_src_mout_am,
191 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 }, 177 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 },
@@ -194,7 +180,6 @@ static struct clksrc_clk clk_mout_am = {
194static struct clksrc_clk clk_div_d1_bus = { 180static struct clksrc_clk clk_div_d1_bus = {
195 .clk = { 181 .clk = {
196 .name = "div_d1_bus", 182 .name = "div_d1_bus",
197 .id = -1,
198 .parent = &clk_mout_am.clk, 183 .parent = &clk_mout_am.clk,
199 }, 184 },
200 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 3 }, 185 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 3 },
@@ -203,7 +188,6 @@ static struct clksrc_clk clk_div_d1_bus = {
203static struct clksrc_clk clk_div_mpll2 = { 188static struct clksrc_clk clk_div_mpll2 = {
204 .clk = { 189 .clk = {
205 .name = "div_mpll2", 190 .name = "div_mpll2",
206 .id = -1,
207 .parent = &clk_mout_am.clk, 191 .parent = &clk_mout_am.clk,
208 }, 192 },
209 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 8, .size = 1 }, 193 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 8, .size = 1 },
@@ -212,7 +196,6 @@ static struct clksrc_clk clk_div_mpll2 = {
212static struct clksrc_clk clk_div_mpll = { 196static struct clksrc_clk clk_div_mpll = {
213 .clk = { 197 .clk = {
214 .name = "div_mpll", 198 .name = "div_mpll",
215 .id = -1,
216 .parent = &clk_mout_am.clk, 199 .parent = &clk_mout_am.clk,
217 }, 200 },
218 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 4, .size = 2 }, 201 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 4, .size = 2 },
@@ -231,7 +214,6 @@ struct clksrc_sources clk_src_mout_onenand = {
231static struct clksrc_clk clk_mout_onenand = { 214static struct clksrc_clk clk_mout_onenand = {
232 .clk = { 215 .clk = {
233 .name = "mout_onenand", 216 .name = "mout_onenand",
234 .id = -1,
235 }, 217 },
236 .sources = &clk_src_mout_onenand, 218 .sources = &clk_src_mout_onenand,
237 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 }, 219 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 },
@@ -240,7 +222,6 @@ static struct clksrc_clk clk_mout_onenand = {
240static struct clksrc_clk clk_div_onenand = { 222static struct clksrc_clk clk_div_onenand = {
241 .clk = { 223 .clk = {
242 .name = "div_onenand", 224 .name = "div_onenand",
243 .id = -1,
244 .parent = &clk_mout_onenand.clk, 225 .parent = &clk_mout_onenand.clk,
245 }, 226 },
246 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 20, .size = 2 }, 227 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 20, .size = 2 },
@@ -249,7 +230,6 @@ static struct clksrc_clk clk_div_onenand = {
249static struct clksrc_clk clk_div_pclkd1 = { 230static struct clksrc_clk clk_div_pclkd1 = {
250 .clk = { 231 .clk = {
251 .name = "div_pclkd1", 232 .name = "div_pclkd1",
252 .id = -1,
253 .parent = &clk_div_d1_bus.clk, 233 .parent = &clk_div_d1_bus.clk,
254 }, 234 },
255 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 16, .size = 3 }, 235 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 16, .size = 3 },
@@ -258,7 +238,6 @@ static struct clksrc_clk clk_div_pclkd1 = {
258static struct clksrc_clk clk_div_cam = { 238static struct clksrc_clk clk_div_cam = {
259 .clk = { 239 .clk = {
260 .name = "div_cam", 240 .name = "div_cam",
261 .id = -1,
262 .parent = &clk_div_mpll2.clk, 241 .parent = &clk_div_mpll2.clk,
263 }, 242 },
264 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 24, .size = 5 }, 243 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 24, .size = 5 },
@@ -267,7 +246,6 @@ static struct clksrc_clk clk_div_cam = {
267static struct clksrc_clk clk_div_hdmi = { 246static struct clksrc_clk clk_div_hdmi = {
268 .clk = { 247 .clk = {
269 .name = "div_hdmi", 248 .name = "div_hdmi",
270 .id = -1,
271 .parent = &clk_mout_hpll.clk, 249 .parent = &clk_mout_hpll.clk,
272 }, 250 },
273 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 28, .size = 4 }, 251 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 28, .size = 4 },
@@ -399,367 +377,329 @@ static int s5pc100_sclk1_ctrl(struct clk *clk, int enable)
399static struct clk init_clocks_off[] = { 377static struct clk init_clocks_off[] = {
400 { 378 {
401 .name = "cssys", 379 .name = "cssys",
402 .id = -1,
403 .parent = &clk_div_d0_bus.clk, 380 .parent = &clk_div_d0_bus.clk,
404 .enable = s5pc100_d0_0_ctrl, 381 .enable = s5pc100_d0_0_ctrl,
405 .ctrlbit = (1 << 6), 382 .ctrlbit = (1 << 6),
406 }, { 383 }, {
407 .name = "secss", 384 .name = "secss",
408 .id = -1,
409 .parent = &clk_div_d0_bus.clk, 385 .parent = &clk_div_d0_bus.clk,
410 .enable = s5pc100_d0_0_ctrl, 386 .enable = s5pc100_d0_0_ctrl,
411 .ctrlbit = (1 << 5), 387 .ctrlbit = (1 << 5),
412 }, { 388 }, {
413 .name = "g2d", 389 .name = "g2d",
414 .id = -1,
415 .parent = &clk_div_d0_bus.clk, 390 .parent = &clk_div_d0_bus.clk,
416 .enable = s5pc100_d0_0_ctrl, 391 .enable = s5pc100_d0_0_ctrl,
417 .ctrlbit = (1 << 4), 392 .ctrlbit = (1 << 4),
418 }, { 393 }, {
419 .name = "mdma", 394 .name = "mdma",
420 .id = -1,
421 .parent = &clk_div_d0_bus.clk, 395 .parent = &clk_div_d0_bus.clk,
422 .enable = s5pc100_d0_0_ctrl, 396 .enable = s5pc100_d0_0_ctrl,
423 .ctrlbit = (1 << 3), 397 .ctrlbit = (1 << 3),
424 }, { 398 }, {
425 .name = "cfcon", 399 .name = "cfcon",
426 .id = -1,
427 .parent = &clk_div_d0_bus.clk, 400 .parent = &clk_div_d0_bus.clk,
428 .enable = s5pc100_d0_0_ctrl, 401 .enable = s5pc100_d0_0_ctrl,
429 .ctrlbit = (1 << 2), 402 .ctrlbit = (1 << 2),
430 }, { 403 }, {
431 .name = "nfcon", 404 .name = "nfcon",
432 .id = -1,
433 .parent = &clk_div_d0_bus.clk, 405 .parent = &clk_div_d0_bus.clk,
434 .enable = s5pc100_d0_1_ctrl, 406 .enable = s5pc100_d0_1_ctrl,
435 .ctrlbit = (1 << 3), 407 .ctrlbit = (1 << 3),
436 }, { 408 }, {
437 .name = "onenandc", 409 .name = "onenandc",
438 .id = -1,
439 .parent = &clk_div_d0_bus.clk, 410 .parent = &clk_div_d0_bus.clk,
440 .enable = s5pc100_d0_1_ctrl, 411 .enable = s5pc100_d0_1_ctrl,
441 .ctrlbit = (1 << 2), 412 .ctrlbit = (1 << 2),
442 }, { 413 }, {
443 .name = "sdm", 414 .name = "sdm",
444 .id = -1,
445 .parent = &clk_div_d0_bus.clk, 415 .parent = &clk_div_d0_bus.clk,
446 .enable = s5pc100_d0_2_ctrl, 416 .enable = s5pc100_d0_2_ctrl,
447 .ctrlbit = (1 << 2), 417 .ctrlbit = (1 << 2),
448 }, { 418 }, {
449 .name = "seckey", 419 .name = "seckey",
450 .id = -1,
451 .parent = &clk_div_d0_bus.clk, 420 .parent = &clk_div_d0_bus.clk,
452 .enable = s5pc100_d0_2_ctrl, 421 .enable = s5pc100_d0_2_ctrl,
453 .ctrlbit = (1 << 1), 422 .ctrlbit = (1 << 1),
454 }, { 423 }, {
455 .name = "hsmmc", 424 .name = "hsmmc",
456 .id = 2, 425 .devname = "s3c-sdhci.2",
457 .parent = &clk_div_d1_bus.clk, 426 .parent = &clk_div_d1_bus.clk,
458 .enable = s5pc100_d1_0_ctrl, 427 .enable = s5pc100_d1_0_ctrl,
459 .ctrlbit = (1 << 7), 428 .ctrlbit = (1 << 7),
460 }, { 429 }, {
461 .name = "hsmmc", 430 .name = "hsmmc",
462 .id = 1, 431 .devname = "s3c-sdhci.1",
463 .parent = &clk_div_d1_bus.clk, 432 .parent = &clk_div_d1_bus.clk,
464 .enable = s5pc100_d1_0_ctrl, 433 .enable = s5pc100_d1_0_ctrl,
465 .ctrlbit = (1 << 6), 434 .ctrlbit = (1 << 6),
466 }, { 435 }, {
467 .name = "hsmmc", 436 .name = "hsmmc",
468 .id = 0, 437 .devname = "s3c-sdhci.0",
469 .parent = &clk_div_d1_bus.clk, 438 .parent = &clk_div_d1_bus.clk,
470 .enable = s5pc100_d1_0_ctrl, 439 .enable = s5pc100_d1_0_ctrl,
471 .ctrlbit = (1 << 5), 440 .ctrlbit = (1 << 5),
472 }, { 441 }, {
473 .name = "modemif", 442 .name = "modemif",
474 .id = -1,
475 .parent = &clk_div_d1_bus.clk, 443 .parent = &clk_div_d1_bus.clk,
476 .enable = s5pc100_d1_0_ctrl, 444 .enable = s5pc100_d1_0_ctrl,
477 .ctrlbit = (1 << 4), 445 .ctrlbit = (1 << 4),
478 }, { 446 }, {
479 .name = "otg", 447 .name = "otg",
480 .id = -1,
481 .parent = &clk_div_d1_bus.clk, 448 .parent = &clk_div_d1_bus.clk,
482 .enable = s5pc100_d1_0_ctrl, 449 .enable = s5pc100_d1_0_ctrl,
483 .ctrlbit = (1 << 3), 450 .ctrlbit = (1 << 3),
484 }, { 451 }, {
485 .name = "usbhost", 452 .name = "usbhost",
486 .id = -1,
487 .parent = &clk_div_d1_bus.clk, 453 .parent = &clk_div_d1_bus.clk,
488 .enable = s5pc100_d1_0_ctrl, 454 .enable = s5pc100_d1_0_ctrl,
489 .ctrlbit = (1 << 2), 455 .ctrlbit = (1 << 2),
490 }, { 456 }, {
491 .name = "pdma", 457 .name = "pdma",
492 .id = 1, 458 .devname = "s3c-pl330.1",
493 .parent = &clk_div_d1_bus.clk, 459 .parent = &clk_div_d1_bus.clk,
494 .enable = s5pc100_d1_0_ctrl, 460 .enable = s5pc100_d1_0_ctrl,
495 .ctrlbit = (1 << 1), 461 .ctrlbit = (1 << 1),
496 }, { 462 }, {
497 .name = "pdma", 463 .name = "pdma",
498 .id = 0, 464 .devname = "s3c-pl330.0",
499 .parent = &clk_div_d1_bus.clk, 465 .parent = &clk_div_d1_bus.clk,
500 .enable = s5pc100_d1_0_ctrl, 466 .enable = s5pc100_d1_0_ctrl,
501 .ctrlbit = (1 << 0), 467 .ctrlbit = (1 << 0),
502 }, { 468 }, {
503 .name = "lcd", 469 .name = "lcd",
504 .id = -1,
505 .parent = &clk_div_d1_bus.clk, 470 .parent = &clk_div_d1_bus.clk,
506 .enable = s5pc100_d1_1_ctrl, 471 .enable = s5pc100_d1_1_ctrl,
507 .ctrlbit = (1 << 0), 472 .ctrlbit = (1 << 0),
508 }, { 473 }, {
509 .name = "rotator", 474 .name = "rotator",
510 .id = -1,
511 .parent = &clk_div_d1_bus.clk, 475 .parent = &clk_div_d1_bus.clk,
512 .enable = s5pc100_d1_1_ctrl, 476 .enable = s5pc100_d1_1_ctrl,
513 .ctrlbit = (1 << 1), 477 .ctrlbit = (1 << 1),
514 }, { 478 }, {
515 .name = "fimc", 479 .name = "fimc",
516 .id = 0, 480 .devname = "s5p-fimc.0",
517 .parent = &clk_div_d1_bus.clk, 481 .parent = &clk_div_d1_bus.clk,
518 .enable = s5pc100_d1_1_ctrl, 482 .enable = s5pc100_d1_1_ctrl,
519 .ctrlbit = (1 << 2), 483 .ctrlbit = (1 << 2),
520 }, { 484 }, {
521 .name = "fimc", 485 .name = "fimc",
522 .id = 1, 486 .devname = "s5p-fimc.1",
523 .parent = &clk_div_d1_bus.clk, 487 .parent = &clk_div_d1_bus.clk,
524 .enable = s5pc100_d1_1_ctrl, 488 .enable = s5pc100_d1_1_ctrl,
525 .ctrlbit = (1 << 3), 489 .ctrlbit = (1 << 3),
526 }, { 490 }, {
527 .name = "fimc", 491 .name = "fimc",
528 .id = 2, 492 .devname = "s5p-fimc.2",
529 .parent = &clk_div_d1_bus.clk,
530 .enable = s5pc100_d1_1_ctrl, 493 .enable = s5pc100_d1_1_ctrl,
531 .ctrlbit = (1 << 4), 494 .ctrlbit = (1 << 4),
532 }, { 495 }, {
533 .name = "jpeg", 496 .name = "jpeg",
534 .id = -1,
535 .parent = &clk_div_d1_bus.clk, 497 .parent = &clk_div_d1_bus.clk,
536 .enable = s5pc100_d1_1_ctrl, 498 .enable = s5pc100_d1_1_ctrl,
537 .ctrlbit = (1 << 5), 499 .ctrlbit = (1 << 5),
538 }, { 500 }, {
539 .name = "mipi-dsim", 501 .name = "mipi-dsim",
540 .id = -1,
541 .parent = &clk_div_d1_bus.clk, 502 .parent = &clk_div_d1_bus.clk,
542 .enable = s5pc100_d1_1_ctrl, 503 .enable = s5pc100_d1_1_ctrl,
543 .ctrlbit = (1 << 6), 504 .ctrlbit = (1 << 6),
544 }, { 505 }, {
545 .name = "mipi-csis", 506 .name = "mipi-csis",
546 .id = -1,
547 .parent = &clk_div_d1_bus.clk, 507 .parent = &clk_div_d1_bus.clk,
548 .enable = s5pc100_d1_1_ctrl, 508 .enable = s5pc100_d1_1_ctrl,
549 .ctrlbit = (1 << 7), 509 .ctrlbit = (1 << 7),
550 }, { 510 }, {
551 .name = "g3d", 511 .name = "g3d",
552 .id = 0,
553 .parent = &clk_div_d1_bus.clk, 512 .parent = &clk_div_d1_bus.clk,
554 .enable = s5pc100_d1_0_ctrl, 513 .enable = s5pc100_d1_0_ctrl,
555 .ctrlbit = (1 << 8), 514 .ctrlbit = (1 << 8),
556 }, { 515 }, {
557 .name = "tv", 516 .name = "tv",
558 .id = -1,
559 .parent = &clk_div_d1_bus.clk, 517 .parent = &clk_div_d1_bus.clk,
560 .enable = s5pc100_d1_2_ctrl, 518 .enable = s5pc100_d1_2_ctrl,
561 .ctrlbit = (1 << 0), 519 .ctrlbit = (1 << 0),
562 }, { 520 }, {
563 .name = "vp", 521 .name = "vp",
564 .id = -1,
565 .parent = &clk_div_d1_bus.clk, 522 .parent = &clk_div_d1_bus.clk,
566 .enable = s5pc100_d1_2_ctrl, 523 .enable = s5pc100_d1_2_ctrl,
567 .ctrlbit = (1 << 1), 524 .ctrlbit = (1 << 1),
568 }, { 525 }, {
569 .name = "mixer", 526 .name = "mixer",
570 .id = -1,
571 .parent = &clk_div_d1_bus.clk, 527 .parent = &clk_div_d1_bus.clk,
572 .enable = s5pc100_d1_2_ctrl, 528 .enable = s5pc100_d1_2_ctrl,
573 .ctrlbit = (1 << 2), 529 .ctrlbit = (1 << 2),
574 }, { 530 }, {
575 .name = "hdmi", 531 .name = "hdmi",
576 .id = -1,
577 .parent = &clk_div_d1_bus.clk, 532 .parent = &clk_div_d1_bus.clk,
578 .enable = s5pc100_d1_2_ctrl, 533 .enable = s5pc100_d1_2_ctrl,
579 .ctrlbit = (1 << 3), 534 .ctrlbit = (1 << 3),
580 }, { 535 }, {
581 .name = "mfc", 536 .name = "mfc",
582 .id = -1,
583 .parent = &clk_div_d1_bus.clk, 537 .parent = &clk_div_d1_bus.clk,
584 .enable = s5pc100_d1_2_ctrl, 538 .enable = s5pc100_d1_2_ctrl,
585 .ctrlbit = (1 << 4), 539 .ctrlbit = (1 << 4),
586 }, { 540 }, {
587 .name = "apc", 541 .name = "apc",
588 .id = -1,
589 .parent = &clk_div_d1_bus.clk, 542 .parent = &clk_div_d1_bus.clk,
590 .enable = s5pc100_d1_3_ctrl, 543 .enable = s5pc100_d1_3_ctrl,
591 .ctrlbit = (1 << 2), 544 .ctrlbit = (1 << 2),
592 }, { 545 }, {
593 .name = "iec", 546 .name = "iec",
594 .id = -1,
595 .parent = &clk_div_d1_bus.clk, 547 .parent = &clk_div_d1_bus.clk,
596 .enable = s5pc100_d1_3_ctrl, 548 .enable = s5pc100_d1_3_ctrl,
597 .ctrlbit = (1 << 3), 549 .ctrlbit = (1 << 3),
598 }, { 550 }, {
599 .name = "systimer", 551 .name = "systimer",
600 .id = -1,
601 .parent = &clk_div_d1_bus.clk, 552 .parent = &clk_div_d1_bus.clk,
602 .enable = s5pc100_d1_3_ctrl, 553 .enable = s5pc100_d1_3_ctrl,
603 .ctrlbit = (1 << 7), 554 .ctrlbit = (1 << 7),
604 }, { 555 }, {
605 .name = "watchdog", 556 .name = "watchdog",
606 .id = -1,
607 .parent = &clk_div_d1_bus.clk, 557 .parent = &clk_div_d1_bus.clk,
608 .enable = s5pc100_d1_3_ctrl, 558 .enable = s5pc100_d1_3_ctrl,
609 .ctrlbit = (1 << 8), 559 .ctrlbit = (1 << 8),
610 }, { 560 }, {
611 .name = "rtc", 561 .name = "rtc",
612 .id = -1,
613 .parent = &clk_div_d1_bus.clk, 562 .parent = &clk_div_d1_bus.clk,
614 .enable = s5pc100_d1_3_ctrl, 563 .enable = s5pc100_d1_3_ctrl,
615 .ctrlbit = (1 << 9), 564 .ctrlbit = (1 << 9),
616 }, { 565 }, {
617 .name = "i2c", 566 .name = "i2c",
618 .id = 0, 567 .devname = "s3c2440-i2c.0",
619 .parent = &clk_div_d1_bus.clk, 568 .parent = &clk_div_d1_bus.clk,
620 .enable = s5pc100_d1_4_ctrl, 569 .enable = s5pc100_d1_4_ctrl,
621 .ctrlbit = (1 << 4), 570 .ctrlbit = (1 << 4),
622 }, { 571 }, {
623 .name = "i2c", 572 .name = "i2c",
624 .id = 1, 573 .devname = "s3c2440-i2c.1",
625 .parent = &clk_div_d1_bus.clk, 574 .parent = &clk_div_d1_bus.clk,
626 .enable = s5pc100_d1_4_ctrl, 575 .enable = s5pc100_d1_4_ctrl,
627 .ctrlbit = (1 << 5), 576 .ctrlbit = (1 << 5),
628 }, { 577 }, {
629 .name = "spi", 578 .name = "spi",
630 .id = 0, 579 .devname = "s3c64xx-spi.0",
631 .parent = &clk_div_d1_bus.clk, 580 .parent = &clk_div_d1_bus.clk,
632 .enable = s5pc100_d1_4_ctrl, 581 .enable = s5pc100_d1_4_ctrl,
633 .ctrlbit = (1 << 6), 582 .ctrlbit = (1 << 6),
634 }, { 583 }, {
635 .name = "spi", 584 .name = "spi",
636 .id = 1, 585 .devname = "s3c64xx-spi.1",
637 .parent = &clk_div_d1_bus.clk, 586 .parent = &clk_div_d1_bus.clk,
638 .enable = s5pc100_d1_4_ctrl, 587 .enable = s5pc100_d1_4_ctrl,
639 .ctrlbit = (1 << 7), 588 .ctrlbit = (1 << 7),
640 }, { 589 }, {
641 .name = "spi", 590 .name = "spi",
642 .id = 2, 591 .devname = "s3c64xx-spi.2",
643 .parent = &clk_div_d1_bus.clk, 592 .parent = &clk_div_d1_bus.clk,
644 .enable = s5pc100_d1_4_ctrl, 593 .enable = s5pc100_d1_4_ctrl,
645 .ctrlbit = (1 << 8), 594 .ctrlbit = (1 << 8),
646 }, { 595 }, {
647 .name = "irda", 596 .name = "irda",
648 .id = -1,
649 .parent = &clk_div_d1_bus.clk, 597 .parent = &clk_div_d1_bus.clk,
650 .enable = s5pc100_d1_4_ctrl, 598 .enable = s5pc100_d1_4_ctrl,
651 .ctrlbit = (1 << 9), 599 .ctrlbit = (1 << 9),
652 }, { 600 }, {
653 .name = "ccan", 601 .name = "ccan",
654 .id = 0,
655 .parent = &clk_div_d1_bus.clk, 602 .parent = &clk_div_d1_bus.clk,
656 .enable = s5pc100_d1_4_ctrl, 603 .enable = s5pc100_d1_4_ctrl,
657 .ctrlbit = (1 << 10), 604 .ctrlbit = (1 << 10),
658 }, { 605 }, {
659 .name = "ccan", 606 .name = "ccan",
660 .id = 1,
661 .parent = &clk_div_d1_bus.clk, 607 .parent = &clk_div_d1_bus.clk,
662 .enable = s5pc100_d1_4_ctrl, 608 .enable = s5pc100_d1_4_ctrl,
663 .ctrlbit = (1 << 11), 609 .ctrlbit = (1 << 11),
664 }, { 610 }, {
665 .name = "hsitx", 611 .name = "hsitx",
666 .id = -1,
667 .parent = &clk_div_d1_bus.clk, 612 .parent = &clk_div_d1_bus.clk,
668 .enable = s5pc100_d1_4_ctrl, 613 .enable = s5pc100_d1_4_ctrl,
669 .ctrlbit = (1 << 12), 614 .ctrlbit = (1 << 12),
670 }, { 615 }, {
671 .name = "hsirx", 616 .name = "hsirx",
672 .id = -1,
673 .parent = &clk_div_d1_bus.clk, 617 .parent = &clk_div_d1_bus.clk,
674 .enable = s5pc100_d1_4_ctrl, 618 .enable = s5pc100_d1_4_ctrl,
675 .ctrlbit = (1 << 13), 619 .ctrlbit = (1 << 13),
676 }, { 620 }, {
677 .name = "iis", 621 .name = "iis",
678 .id = 0, 622 .devname = "samsung-i2s.0",
679 .parent = &clk_div_pclkd1.clk, 623 .parent = &clk_div_pclkd1.clk,
680 .enable = s5pc100_d1_5_ctrl, 624 .enable = s5pc100_d1_5_ctrl,
681 .ctrlbit = (1 << 0), 625 .ctrlbit = (1 << 0),
682 }, { 626 }, {
683 .name = "iis", 627 .name = "iis",
684 .id = 1, 628 .devname = "samsung-i2s.1",
685 .parent = &clk_div_pclkd1.clk, 629 .parent = &clk_div_pclkd1.clk,
686 .enable = s5pc100_d1_5_ctrl, 630 .enable = s5pc100_d1_5_ctrl,
687 .ctrlbit = (1 << 1), 631 .ctrlbit = (1 << 1),
688 }, { 632 }, {
689 .name = "iis", 633 .name = "iis",
690 .id = 2, 634 .devname = "samsung-i2s.2",
691 .parent = &clk_div_pclkd1.clk, 635 .parent = &clk_div_pclkd1.clk,
692 .enable = s5pc100_d1_5_ctrl, 636 .enable = s5pc100_d1_5_ctrl,
693 .ctrlbit = (1 << 2), 637 .ctrlbit = (1 << 2),
694 }, { 638 }, {
695 .name = "ac97", 639 .name = "ac97",
696 .id = -1,
697 .parent = &clk_div_pclkd1.clk, 640 .parent = &clk_div_pclkd1.clk,
698 .enable = s5pc100_d1_5_ctrl, 641 .enable = s5pc100_d1_5_ctrl,
699 .ctrlbit = (1 << 3), 642 .ctrlbit = (1 << 3),
700 }, { 643 }, {
701 .name = "pcm", 644 .name = "pcm",
702 .id = 0, 645 .devname = "samsung-pcm.0",
703 .parent = &clk_div_pclkd1.clk, 646 .parent = &clk_div_pclkd1.clk,
704 .enable = s5pc100_d1_5_ctrl, 647 .enable = s5pc100_d1_5_ctrl,
705 .ctrlbit = (1 << 4), 648 .ctrlbit = (1 << 4),
706 }, { 649 }, {
707 .name = "pcm", 650 .name = "pcm",
708 .id = 1, 651 .devname = "samsung-pcm.1",
709 .parent = &clk_div_pclkd1.clk, 652 .parent = &clk_div_pclkd1.clk,
710 .enable = s5pc100_d1_5_ctrl, 653 .enable = s5pc100_d1_5_ctrl,
711 .ctrlbit = (1 << 5), 654 .ctrlbit = (1 << 5),
712 }, { 655 }, {
713 .name = "spdif", 656 .name = "spdif",
714 .id = -1,
715 .parent = &clk_div_pclkd1.clk, 657 .parent = &clk_div_pclkd1.clk,
716 .enable = s5pc100_d1_5_ctrl, 658 .enable = s5pc100_d1_5_ctrl,
717 .ctrlbit = (1 << 6), 659 .ctrlbit = (1 << 6),
718 }, { 660 }, {
719 .name = "adc", 661 .name = "adc",
720 .id = -1,
721 .parent = &clk_div_pclkd1.clk, 662 .parent = &clk_div_pclkd1.clk,
722 .enable = s5pc100_d1_5_ctrl, 663 .enable = s5pc100_d1_5_ctrl,
723 .ctrlbit = (1 << 7), 664 .ctrlbit = (1 << 7),
724 }, { 665 }, {
725 .name = "keypad", 666 .name = "keypad",
726 .id = -1,
727 .parent = &clk_div_pclkd1.clk, 667 .parent = &clk_div_pclkd1.clk,
728 .enable = s5pc100_d1_5_ctrl, 668 .enable = s5pc100_d1_5_ctrl,
729 .ctrlbit = (1 << 8), 669 .ctrlbit = (1 << 8),
730 }, { 670 }, {
731 .name = "spi_48m", 671 .name = "spi_48m",
732 .id = 0, 672 .devname = "s3c64xx-spi.0",
733 .parent = &clk_mout_48m.clk, 673 .parent = &clk_mout_48m.clk,
734 .enable = s5pc100_sclk0_ctrl, 674 .enable = s5pc100_sclk0_ctrl,
735 .ctrlbit = (1 << 7), 675 .ctrlbit = (1 << 7),
736 }, { 676 }, {
737 .name = "spi_48m", 677 .name = "spi_48m",
738 .id = 1, 678 .devname = "s3c64xx-spi.1",
739 .parent = &clk_mout_48m.clk, 679 .parent = &clk_mout_48m.clk,
740 .enable = s5pc100_sclk0_ctrl, 680 .enable = s5pc100_sclk0_ctrl,
741 .ctrlbit = (1 << 8), 681 .ctrlbit = (1 << 8),
742 }, { 682 }, {
743 .name = "spi_48m", 683 .name = "spi_48m",
744 .id = 2, 684 .devname = "s3c64xx-spi.2",
745 .parent = &clk_mout_48m.clk, 685 .parent = &clk_mout_48m.clk,
746 .enable = s5pc100_sclk0_ctrl, 686 .enable = s5pc100_sclk0_ctrl,
747 .ctrlbit = (1 << 9), 687 .ctrlbit = (1 << 9),
748 }, { 688 }, {
749 .name = "mmc_48m", 689 .name = "mmc_48m",
750 .id = 0, 690 .devname = "s3c-sdhci.0",
751 .parent = &clk_mout_48m.clk, 691 .parent = &clk_mout_48m.clk,
752 .enable = s5pc100_sclk0_ctrl, 692 .enable = s5pc100_sclk0_ctrl,
753 .ctrlbit = (1 << 15), 693 .ctrlbit = (1 << 15),
754 }, { 694 }, {
755 .name = "mmc_48m", 695 .name = "mmc_48m",
756 .id = 1, 696 .devname = "s3c-sdhci.1",
757 .parent = &clk_mout_48m.clk, 697 .parent = &clk_mout_48m.clk,
758 .enable = s5pc100_sclk0_ctrl, 698 .enable = s5pc100_sclk0_ctrl,
759 .ctrlbit = (1 << 16), 699 .ctrlbit = (1 << 16),
760 }, { 700 }, {
761 .name = "mmc_48m", 701 .name = "mmc_48m",
762 .id = 2, 702 .devname = "s3c-sdhci.2",
763 .parent = &clk_mout_48m.clk, 703 .parent = &clk_mout_48m.clk,
764 .enable = s5pc100_sclk0_ctrl, 704 .enable = s5pc100_sclk0_ctrl,
765 .ctrlbit = (1 << 17), 705 .ctrlbit = (1 << 17),
@@ -768,33 +708,27 @@ static struct clk init_clocks_off[] = {
768 708
769static struct clk clk_vclk54m = { 709static struct clk clk_vclk54m = {
770 .name = "vclk_54m", 710 .name = "vclk_54m",
771 .id = -1,
772 .rate = 54000000, 711 .rate = 54000000,
773}; 712};
774 713
775static struct clk clk_i2scdclk0 = { 714static struct clk clk_i2scdclk0 = {
776 .name = "i2s_cdclk0", 715 .name = "i2s_cdclk0",
777 .id = -1,
778}; 716};
779 717
780static struct clk clk_i2scdclk1 = { 718static struct clk clk_i2scdclk1 = {
781 .name = "i2s_cdclk1", 719 .name = "i2s_cdclk1",
782 .id = -1,
783}; 720};
784 721
785static struct clk clk_i2scdclk2 = { 722static struct clk clk_i2scdclk2 = {
786 .name = "i2s_cdclk2", 723 .name = "i2s_cdclk2",
787 .id = -1,
788}; 724};
789 725
790static struct clk clk_pcmcdclk0 = { 726static struct clk clk_pcmcdclk0 = {
791 .name = "pcm_cdclk0", 727 .name = "pcm_cdclk0",
792 .id = -1,
793}; 728};
794 729
795static struct clk clk_pcmcdclk1 = { 730static struct clk clk_pcmcdclk1 = {
796 .name = "pcm_cdclk1", 731 .name = "pcm_cdclk1",
797 .id = -1,
798}; 732};
799 733
800static struct clk *clk_src_group1_list[] = { 734static struct clk *clk_src_group1_list[] = {
@@ -836,7 +770,7 @@ struct clksrc_sources clk_src_group3 = {
836static struct clksrc_clk clk_sclk_audio0 = { 770static struct clksrc_clk clk_sclk_audio0 = {
837 .clk = { 771 .clk = {
838 .name = "sclk_audio", 772 .name = "sclk_audio",
839 .id = 0, 773 .devname = "samsung-pcm.0",
840 .ctrlbit = (1 << 8), 774 .ctrlbit = (1 << 8),
841 .enable = s5pc100_sclk1_ctrl, 775 .enable = s5pc100_sclk1_ctrl,
842 }, 776 },
@@ -862,7 +796,7 @@ struct clksrc_sources clk_src_group4 = {
862static struct clksrc_clk clk_sclk_audio1 = { 796static struct clksrc_clk clk_sclk_audio1 = {
863 .clk = { 797 .clk = {
864 .name = "sclk_audio", 798 .name = "sclk_audio",
865 .id = 1, 799 .devname = "samsung-pcm.1",
866 .ctrlbit = (1 << 9), 800 .ctrlbit = (1 << 9),
867 .enable = s5pc100_sclk1_ctrl, 801 .enable = s5pc100_sclk1_ctrl,
868 }, 802 },
@@ -887,7 +821,7 @@ struct clksrc_sources clk_src_group5 = {
887static struct clksrc_clk clk_sclk_audio2 = { 821static struct clksrc_clk clk_sclk_audio2 = {
888 .clk = { 822 .clk = {
889 .name = "sclk_audio", 823 .name = "sclk_audio",
890 .id = 2, 824 .devname = "samsung-pcm.2",
891 .ctrlbit = (1 << 10), 825 .ctrlbit = (1 << 10),
892 .enable = s5pc100_sclk1_ctrl, 826 .enable = s5pc100_sclk1_ctrl,
893 }, 827 },
@@ -976,48 +910,12 @@ struct clksrc_sources clk_src_sclk_spdif = {
976 .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list), 910 .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list),
977}; 911};
978 912
979static int s5pc100_spdif_set_rate(struct clk *clk, unsigned long rate)
980{
981 struct clk *pclk;
982 int ret;
983
984 pclk = clk_get_parent(clk);
985 if (IS_ERR(pclk))
986 return -EINVAL;
987
988 ret = pclk->ops->set_rate(pclk, rate);
989 clk_put(pclk);
990
991 return ret;
992}
993
994static unsigned long s5pc100_spdif_get_rate(struct clk *clk)
995{
996 struct clk *pclk;
997 int rate;
998
999 pclk = clk_get_parent(clk);
1000 if (IS_ERR(pclk))
1001 return -EINVAL;
1002
1003 rate = pclk->ops->get_rate(clk);
1004 clk_put(pclk);
1005
1006 return rate;
1007}
1008
1009static struct clk_ops s5pc100_sclk_spdif_ops = {
1010 .set_rate = s5pc100_spdif_set_rate,
1011 .get_rate = s5pc100_spdif_get_rate,
1012};
1013
1014static struct clksrc_clk clk_sclk_spdif = { 913static struct clksrc_clk clk_sclk_spdif = {
1015 .clk = { 914 .clk = {
1016 .name = "sclk_spdif", 915 .name = "sclk_spdif",
1017 .id = -1,
1018 .ctrlbit = (1 << 11), 916 .ctrlbit = (1 << 11),
1019 .enable = s5pc100_sclk1_ctrl, 917 .enable = s5pc100_sclk1_ctrl,
1020 .ops = &s5pc100_sclk_spdif_ops, 918 .ops = &s5p_sclk_spdif_ops,
1021 }, 919 },
1022 .sources = &clk_src_sclk_spdif, 920 .sources = &clk_src_sclk_spdif,
1023 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 24, .size = 2 }, 921 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 24, .size = 2 },
@@ -1027,7 +925,7 @@ static struct clksrc_clk clksrcs[] = {
1027 { 925 {
1028 .clk = { 926 .clk = {
1029 .name = "sclk_spi", 927 .name = "sclk_spi",
1030 .id = 0, 928 .devname = "s3c64xx-spi.0",
1031 .ctrlbit = (1 << 4), 929 .ctrlbit = (1 << 4),
1032 .enable = s5pc100_sclk0_ctrl, 930 .enable = s5pc100_sclk0_ctrl,
1033 931
@@ -1038,7 +936,7 @@ static struct clksrc_clk clksrcs[] = {
1038 }, { 936 }, {
1039 .clk = { 937 .clk = {
1040 .name = "sclk_spi", 938 .name = "sclk_spi",
1041 .id = 1, 939 .devname = "s3c64xx-spi.1",
1042 .ctrlbit = (1 << 5), 940 .ctrlbit = (1 << 5),
1043 .enable = s5pc100_sclk0_ctrl, 941 .enable = s5pc100_sclk0_ctrl,
1044 942
@@ -1049,7 +947,7 @@ static struct clksrc_clk clksrcs[] = {
1049 }, { 947 }, {
1050 .clk = { 948 .clk = {
1051 .name = "sclk_spi", 949 .name = "sclk_spi",
1052 .id = 2, 950 .devname = "s3c64xx-spi.2",
1053 .ctrlbit = (1 << 6), 951 .ctrlbit = (1 << 6),
1054 .enable = s5pc100_sclk0_ctrl, 952 .enable = s5pc100_sclk0_ctrl,
1055 953
@@ -1060,7 +958,6 @@ static struct clksrc_clk clksrcs[] = {
1060 }, { 958 }, {
1061 .clk = { 959 .clk = {
1062 .name = "uclk1", 960 .name = "uclk1",
1063 .id = -1,
1064 .ctrlbit = (1 << 3), 961 .ctrlbit = (1 << 3),
1065 .enable = s5pc100_sclk0_ctrl, 962 .enable = s5pc100_sclk0_ctrl,
1066 963
@@ -1071,7 +968,6 @@ static struct clksrc_clk clksrcs[] = {
1071 }, { 968 }, {
1072 .clk = { 969 .clk = {
1073 .name = "sclk_mixer", 970 .name = "sclk_mixer",
1074 .id = -1,
1075 .ctrlbit = (1 << 6), 971 .ctrlbit = (1 << 6),
1076 .enable = s5pc100_sclk0_ctrl, 972 .enable = s5pc100_sclk0_ctrl,
1077 973
@@ -1081,7 +977,6 @@ static struct clksrc_clk clksrcs[] = {
1081 }, { 977 }, {
1082 .clk = { 978 .clk = {
1083 .name = "sclk_lcd", 979 .name = "sclk_lcd",
1084 .id = -1,
1085 .ctrlbit = (1 << 0), 980 .ctrlbit = (1 << 0),
1086 .enable = s5pc100_sclk1_ctrl, 981 .enable = s5pc100_sclk1_ctrl,
1087 982
@@ -1092,7 +987,7 @@ static struct clksrc_clk clksrcs[] = {
1092 }, { 987 }, {
1093 .clk = { 988 .clk = {
1094 .name = "sclk_fimc", 989 .name = "sclk_fimc",
1095 .id = 0, 990 .devname = "s5p-fimc.0",
1096 .ctrlbit = (1 << 1), 991 .ctrlbit = (1 << 1),
1097 .enable = s5pc100_sclk1_ctrl, 992 .enable = s5pc100_sclk1_ctrl,
1098 993
@@ -1103,7 +998,7 @@ static struct clksrc_clk clksrcs[] = {
1103 }, { 998 }, {
1104 .clk = { 999 .clk = {
1105 .name = "sclk_fimc", 1000 .name = "sclk_fimc",
1106 .id = 1, 1001 .devname = "s5p-fimc.1",
1107 .ctrlbit = (1 << 2), 1002 .ctrlbit = (1 << 2),
1108 .enable = s5pc100_sclk1_ctrl, 1003 .enable = s5pc100_sclk1_ctrl,
1109 1004
@@ -1114,7 +1009,7 @@ static struct clksrc_clk clksrcs[] = {
1114 }, { 1009 }, {
1115 .clk = { 1010 .clk = {
1116 .name = "sclk_fimc", 1011 .name = "sclk_fimc",
1117 .id = 2, 1012 .devname = "s5p-fimc.2",
1118 .ctrlbit = (1 << 3), 1013 .ctrlbit = (1 << 3),
1119 .enable = s5pc100_sclk1_ctrl, 1014 .enable = s5pc100_sclk1_ctrl,
1120 1015
@@ -1125,7 +1020,7 @@ static struct clksrc_clk clksrcs[] = {
1125 }, { 1020 }, {
1126 .clk = { 1021 .clk = {
1127 .name = "sclk_mmc", 1022 .name = "sclk_mmc",
1128 .id = 0, 1023 .devname = "s3c-sdhci.0",
1129 .ctrlbit = (1 << 12), 1024 .ctrlbit = (1 << 12),
1130 .enable = s5pc100_sclk1_ctrl, 1025 .enable = s5pc100_sclk1_ctrl,
1131 1026
@@ -1136,7 +1031,7 @@ static struct clksrc_clk clksrcs[] = {
1136 }, { 1031 }, {
1137 .clk = { 1032 .clk = {
1138 .name = "sclk_mmc", 1033 .name = "sclk_mmc",
1139 .id = 1, 1034 .devname = "s3c-sdhci.1",
1140 .ctrlbit = (1 << 13), 1035 .ctrlbit = (1 << 13),
1141 .enable = s5pc100_sclk1_ctrl, 1036 .enable = s5pc100_sclk1_ctrl,
1142 1037
@@ -1147,7 +1042,7 @@ static struct clksrc_clk clksrcs[] = {
1147 }, { 1042 }, {
1148 .clk = { 1043 .clk = {
1149 .name = "sclk_mmc", 1044 .name = "sclk_mmc",
1150 .id = 2, 1045 .devname = "s3c-sdhci.2",
1151 .ctrlbit = (1 << 14), 1046 .ctrlbit = (1 << 14),
1152 .enable = s5pc100_sclk1_ctrl, 1047 .enable = s5pc100_sclk1_ctrl,
1153 1048
@@ -1158,7 +1053,6 @@ static struct clksrc_clk clksrcs[] = {
1158 }, { 1053 }, {
1159 .clk = { 1054 .clk = {
1160 .name = "sclk_irda", 1055 .name = "sclk_irda",
1161 .id = 2,
1162 .ctrlbit = (1 << 10), 1056 .ctrlbit = (1 << 10),
1163 .enable = s5pc100_sclk0_ctrl, 1057 .enable = s5pc100_sclk0_ctrl,
1164 1058
@@ -1169,7 +1063,6 @@ static struct clksrc_clk clksrcs[] = {
1169 }, { 1063 }, {
1170 .clk = { 1064 .clk = {
1171 .name = "sclk_irda", 1065 .name = "sclk_irda",
1172 .id = -1,
1173 .ctrlbit = (1 << 10), 1066 .ctrlbit = (1 << 10),
1174 .enable = s5pc100_sclk0_ctrl, 1067 .enable = s5pc100_sclk0_ctrl,
1175 1068
@@ -1180,7 +1073,6 @@ static struct clksrc_clk clksrcs[] = {
1180 }, { 1073 }, {
1181 .clk = { 1074 .clk = {
1182 .name = "sclk_pwi", 1075 .name = "sclk_pwi",
1183 .id = -1,
1184 .ctrlbit = (1 << 1), 1076 .ctrlbit = (1 << 1),
1185 .enable = s5pc100_sclk0_ctrl, 1077 .enable = s5pc100_sclk0_ctrl,
1186 1078
@@ -1191,7 +1083,6 @@ static struct clksrc_clk clksrcs[] = {
1191 }, { 1083 }, {
1192 .clk = { 1084 .clk = {
1193 .name = "sclk_uhost", 1085 .name = "sclk_uhost",
1194 .id = -1,
1195 .ctrlbit = (1 << 11), 1086 .ctrlbit = (1 << 11),
1196 .enable = s5pc100_sclk0_ctrl, 1087 .enable = s5pc100_sclk0_ctrl,
1197 1088
@@ -1291,79 +1182,70 @@ void __init_or_cpufreq s5pc100_setup_clocks(void)
1291static struct clk init_clocks[] = { 1182static struct clk init_clocks[] = {
1292 { 1183 {
1293 .name = "tzic", 1184 .name = "tzic",
1294 .id = -1,
1295 .parent = &clk_div_d0_bus.clk, 1185 .parent = &clk_div_d0_bus.clk,
1296 .enable = s5pc100_d0_0_ctrl, 1186 .enable = s5pc100_d0_0_ctrl,
1297 .ctrlbit = (1 << 1), 1187 .ctrlbit = (1 << 1),
1298 }, { 1188 }, {
1299 .name = "intc", 1189 .name = "intc",
1300 .id = -1,
1301 .parent = &clk_div_d0_bus.clk, 1190 .parent = &clk_div_d0_bus.clk,
1302 .enable = s5pc100_d0_0_ctrl, 1191 .enable = s5pc100_d0_0_ctrl,
1303 .ctrlbit = (1 << 0), 1192 .ctrlbit = (1 << 0),
1304 }, { 1193 }, {
1305 .name = "ebi", 1194 .name = "ebi",
1306 .id = -1,
1307 .parent = &clk_div_d0_bus.clk, 1195 .parent = &clk_div_d0_bus.clk,
1308 .enable = s5pc100_d0_1_ctrl, 1196 .enable = s5pc100_d0_1_ctrl,
1309 .ctrlbit = (1 << 5), 1197 .ctrlbit = (1 << 5),
1310 }, { 1198 }, {
1311 .name = "intmem", 1199 .name = "intmem",
1312 .id = -1,
1313 .parent = &clk_div_d0_bus.clk, 1200 .parent = &clk_div_d0_bus.clk,
1314 .enable = s5pc100_d0_1_ctrl, 1201 .enable = s5pc100_d0_1_ctrl,
1315 .ctrlbit = (1 << 4), 1202 .ctrlbit = (1 << 4),
1316 }, { 1203 }, {
1317 .name = "sromc", 1204 .name = "sromc",
1318 .id = -1,
1319 .parent = &clk_div_d0_bus.clk, 1205 .parent = &clk_div_d0_bus.clk,
1320 .enable = s5pc100_d0_1_ctrl, 1206 .enable = s5pc100_d0_1_ctrl,
1321 .ctrlbit = (1 << 1), 1207 .ctrlbit = (1 << 1),
1322 }, { 1208 }, {
1323 .name = "dmc", 1209 .name = "dmc",
1324 .id = -1,
1325 .parent = &clk_div_d0_bus.clk, 1210 .parent = &clk_div_d0_bus.clk,
1326 .enable = s5pc100_d0_1_ctrl, 1211 .enable = s5pc100_d0_1_ctrl,
1327 .ctrlbit = (1 << 0), 1212 .ctrlbit = (1 << 0),
1328 }, { 1213 }, {
1329 .name = "chipid", 1214 .name = "chipid",
1330 .id = -1,
1331 .parent = &clk_div_d0_bus.clk, 1215 .parent = &clk_div_d0_bus.clk,
1332 .enable = s5pc100_d0_1_ctrl, 1216 .enable = s5pc100_d0_1_ctrl,
1333 .ctrlbit = (1 << 0), 1217 .ctrlbit = (1 << 0),
1334 }, { 1218 }, {
1335 .name = "gpio", 1219 .name = "gpio",
1336 .id = -1,
1337 .parent = &clk_div_d1_bus.clk, 1220 .parent = &clk_div_d1_bus.clk,
1338 .enable = s5pc100_d1_3_ctrl, 1221 .enable = s5pc100_d1_3_ctrl,
1339 .ctrlbit = (1 << 1), 1222 .ctrlbit = (1 << 1),
1340 }, { 1223 }, {
1341 .name = "uart", 1224 .name = "uart",
1342 .id = 0, 1225 .devname = "s3c6400-uart.0",
1343 .parent = &clk_div_d1_bus.clk, 1226 .parent = &clk_div_d1_bus.clk,
1344 .enable = s5pc100_d1_4_ctrl, 1227 .enable = s5pc100_d1_4_ctrl,
1345 .ctrlbit = (1 << 0), 1228 .ctrlbit = (1 << 0),
1346 }, { 1229 }, {
1347 .name = "uart", 1230 .name = "uart",
1348 .id = 1, 1231 .devname = "s3c6400-uart.1",
1349 .parent = &clk_div_d1_bus.clk, 1232 .parent = &clk_div_d1_bus.clk,
1350 .enable = s5pc100_d1_4_ctrl, 1233 .enable = s5pc100_d1_4_ctrl,
1351 .ctrlbit = (1 << 1), 1234 .ctrlbit = (1 << 1),
1352 }, { 1235 }, {
1353 .name = "uart", 1236 .name = "uart",
1354 .id = 2, 1237 .devname = "s3c6400-uart.2",
1355 .parent = &clk_div_d1_bus.clk, 1238 .parent = &clk_div_d1_bus.clk,
1356 .enable = s5pc100_d1_4_ctrl, 1239 .enable = s5pc100_d1_4_ctrl,
1357 .ctrlbit = (1 << 2), 1240 .ctrlbit = (1 << 2),
1358 }, { 1241 }, {
1359 .name = "uart", 1242 .name = "uart",
1360 .id = 3, 1243 .devname = "s3c6400-uart.3",
1361 .parent = &clk_div_d1_bus.clk, 1244 .parent = &clk_div_d1_bus.clk,
1362 .enable = s5pc100_d1_4_ctrl, 1245 .enable = s5pc100_d1_4_ctrl,
1363 .ctrlbit = (1 << 3), 1246 .ctrlbit = (1 << 3),
1364 }, { 1247 }, {
1365 .name = "timers", 1248 .name = "timers",
1366 .id = -1,
1367 .parent = &clk_div_d1_bus.clk, 1249 .parent = &clk_div_d1_bus.clk,
1368 .enable = s5pc100_d1_3_ctrl, 1250 .enable = s5pc100_d1_3_ctrl,
1369 .ctrlbit = (1 << 6), 1251 .ctrlbit = (1 << 6),
diff --git a/arch/arm/mach-s5pc100/dev-spi.c b/arch/arm/mach-s5pc100/dev-spi.c
index 57b19794d9bb..e5d6c4dceb56 100644
--- a/arch/arm/mach-s5pc100/dev-spi.c
+++ b/arch/arm/mach-s5pc100/dev-spi.c
@@ -15,6 +15,7 @@
15#include <mach/dma.h> 15#include <mach/dma.h>
16#include <mach/map.h> 16#include <mach/map.h>
17#include <mach/spi-clocks.h> 17#include <mach/spi-clocks.h>
18#include <mach/irqs.h>
18 19
19#include <plat/s3c64xx-spi.h> 20#include <plat/s3c64xx-spi.h>
20#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
@@ -90,6 +91,7 @@ static struct s3c64xx_spi_info s5pc100_spi0_pdata = {
90 .fifo_lvl_mask = 0x7f, 91 .fifo_lvl_mask = 0x7f,
91 .rx_lvl_offset = 13, 92 .rx_lvl_offset = 13,
92 .high_speed = 1, 93 .high_speed = 1,
94 .tx_st_done = 21,
93}; 95};
94 96
95static u64 spi_dmamask = DMA_BIT_MASK(32); 97static u64 spi_dmamask = DMA_BIT_MASK(32);
@@ -134,6 +136,7 @@ static struct s3c64xx_spi_info s5pc100_spi1_pdata = {
134 .fifo_lvl_mask = 0x7f, 136 .fifo_lvl_mask = 0x7f,
135 .rx_lvl_offset = 13, 137 .rx_lvl_offset = 13,
136 .high_speed = 1, 138 .high_speed = 1,
139 .tx_st_done = 21,
137}; 140};
138 141
139struct platform_device s5pc100_device_spi1 = { 142struct platform_device s5pc100_device_spi1 = {
@@ -176,6 +179,7 @@ static struct s3c64xx_spi_info s5pc100_spi2_pdata = {
176 .fifo_lvl_mask = 0x7f, 179 .fifo_lvl_mask = 0x7f,
177 .rx_lvl_offset = 13, 180 .rx_lvl_offset = 13,
178 .high_speed = 1, 181 .high_speed = 1,
182 .tx_st_done = 21,
179}; 183};
180 184
181struct platform_device s5pc100_device_spi2 = { 185struct platform_device s5pc100_device_spi2 = {
diff --git a/arch/arm/mach-s5pc100/include/mach/clkdev.h b/arch/arm/mach-s5pc100/include/mach/clkdev.h
new file mode 100644
index 000000000000..7dffa83d23ff
--- /dev/null
+++ b/arch/arm/mach-s5pc100/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __MACH_CLKDEV_H__
2#define __MACH_CLKDEV_H__
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do {} while (0)
6
7#endif
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-fb.h b/arch/arm/mach-s5pc100/include/mach/regs-fb.h
deleted file mode 100644
index 07aa4d6054fe..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/regs-fb.h
+++ /dev/null
@@ -1,105 +0,0 @@
1/* arch/arm/mach-s5pc100/include/mach/regs-fb.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Pawel Osciak <p.osciak@samsung.com>
5 *
6 * Framebuffer register definitions for Samsung S5PC100.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_FB_H
14#define __ASM_ARCH_REGS_FB_H __FILE__
15
16#include <plat/regs-fb-v4.h>
17
18/* VP1 interface timing control */
19#define VP1CON0 (0x118)
20#define VP1_RATECON_EN (1 << 31)
21#define VP1_CLKRATE_MASK (0xff)
22
23#define VP1CON1 (0x11c)
24#define VP1_VTREGCON_EN (1 << 31)
25#define VP1_VBPD_MASK (0xfff)
26#define VP1_VBPD_SHIFT (16)
27
28
29#define WPALCON_H (0x19c)
30#define WPALCON_L (0x1a0)
31
32/* Palette control for WPAL0 and WPAL1 is the same as in S3C64xx, but
33 * different for WPAL2-4
34 */
35/* In WPALCON_L (aka WPALCON) */
36#define WPALCON_W1PAL_32BPP_A888 (0x7 << 3)
37#define WPALCON_W0PAL_32BPP_A888 (0x7 << 0)
38
39/* To set W2PAL-W4PAL consist of one bit from WPALCON_L and two from WPALCON_H,
40 * e.g. W2PAL[2..0] is made of (WPALCON_H[10..9], WPALCON_L[6]).
41 */
42#define WPALCON_L_WxPAL_L_MASK (0x1)
43#define WPALCON_L_W2PAL_L_SHIFT (6)
44#define WPALCON_L_W3PAL_L_SHIFT (7)
45#define WPALCON_L_W4PAL_L_SHIFT (8)
46
47#define WPALCON_L_WxPAL_H_MASK (0x3)
48#define WPALCON_H_W2PAL_H_SHIFT (9)
49#define WPALCON_H_W3PAL_H_SHIFT (13)
50#define WPALCON_H_W4PAL_H_SHIFT (17)
51
52/* Per-window alpha value registers */
53/* For window 0 8-bit alpha values are in VIDW0ALPHAx,
54 * for windows 1-4 alpha values consist of two parts, the 4 low bits are
55 * taken from VIDWxALPHAx and 4 high bits are from VIDOSDxC,
56 * e.g. WIN1_ALPHA0_B[7..0] = (VIDOSD1C[3..0], VIDW1ALPHA0[3..0])
57 */
58#define VIDWxALPHA0(_win) (0x200 + (_win * 8))
59#define VIDWxALPHA1(_win) (0x204 + (_win * 8))
60
61/* Only for window 0 in VIDW0ALPHAx. */
62#define VIDW0ALPHAx_R(_x) ((_x) << 16)
63#define VIDW0ALPHAx_R_MASK (0xff << 16)
64#define VIDW0ALPHAx_R_SHIFT (16)
65#define VIDW0ALPHAx_G(_x) ((_x) << 8)
66#define VIDW0ALPHAx_G_MASK (0xff << 8)
67#define VIDW0ALPHAx_G_SHIFT (8)
68#define VIDW0ALPHAx_B(_x) ((_x) << 0)
69#define VIDW0ALPHAx_B_MASK (0xff << 0)
70#define VIDW0ALPHAx_B_SHIFT (0)
71
72/* Low 4 bits of alpha0-1 for windows 1-4 */
73#define VIDW14ALPHAx_R_L(_x) ((_x) << 16)
74#define VIDW14ALPHAx_R_L_MASK (0xf << 16)
75#define VIDW14ALPHAx_R_L_SHIFT (16)
76#define VIDW14ALPHAx_G_L(_x) ((_x) << 8)
77#define VIDW14ALPHAx_G_L_MASK (0xf << 8)
78#define VIDW14ALPHAx_G_L_SHIFT (8)
79#define VIDW14ALPHAx_B_L(_x) ((_x) << 0)
80#define VIDW14ALPHAx_B_L_MASK (0xf << 0)
81#define VIDW14ALPHAx_B_L_SHIFT (0)
82
83
84/* Per-window blending equation control registers */
85#define BLENDEQx(_win) (0x244 + ((_win) * 4))
86#define BLENDEQ1 (0x244)
87#define BLENDEQ2 (0x248)
88#define BLENDEQ3 (0x24c)
89#define BLENDEQ4 (0x250)
90
91#define BLENDEQx_Q_FUNC(_x) ((_x) << 18)
92#define BLENDEQx_Q_FUNC_MASK (0xf << 18)
93#define BLENDEQx_P_FUNC(_x) ((_x) << 12)
94#define BLENDEQx_P_FUNC_MASK (0xf << 12)
95#define BLENDEQx_B_FUNC(_x) ((_x) << 6)
96#define BLENDEQx_B_FUNC_MASK (0xf << 6)
97#define BLENDEQx_A_FUNC(_x) ((_x) << 0)
98#define BLENDEQx_A_FUNC_MASK (0xf << 0)
99
100#define BLENDCON (0x260)
101#define BLENDCON_8BIT_ALPHA (1 << 0)
102
103
104#endif /* __ASM_ARCH_REGS_FB_H */
105
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 0525cb3ef406..227d8908aab6 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -29,7 +29,6 @@
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30 30
31#include <mach/map.h> 31#include <mach/map.h>
32#include <mach/regs-fb.h>
33#include <mach/regs-gpio.h> 32#include <mach/regs-gpio.h>
34 33
35#include <video/platform_lcd.h> 34#include <video/platform_lcd.h>
@@ -51,6 +50,8 @@
51#include <plat/keypad.h> 50#include <plat/keypad.h>
52#include <plat/ts.h> 51#include <plat/ts.h>
53#include <plat/audio.h> 52#include <plat/audio.h>
53#include <plat/backlight.h>
54#include <plat/regs-fb-v4.h>
54 55
55/* Following are default values for UCON, ULCON and UFCON UART registers */ 56/* Following are default values for UCON, ULCON and UFCON UART registers */
56#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 57#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -179,45 +180,6 @@ static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = {
179 .cols = 8, 180 .cols = 8,
180}; 181};
181 182
182static int smdkc100_backlight_init(struct device *dev)
183{
184 int ret;
185
186 ret = gpio_request(S5PC100_GPD(0), "Backlight");
187 if (ret) {
188 printk(KERN_ERR "failed to request GPF for PWM-OUT0\n");
189 return ret;
190 }
191
192 /* Configure GPIO pin with S5PC100_GPD_TOUT_0 */
193 s3c_gpio_cfgpin(S5PC100_GPD(0), S3C_GPIO_SFN(2));
194
195 return 0;
196}
197
198static void smdkc100_backlight_exit(struct device *dev)
199{
200 s3c_gpio_cfgpin(S5PC100_GPD(0), S3C_GPIO_OUTPUT);
201 gpio_free(S5PC100_GPD(0));
202}
203
204static struct platform_pwm_backlight_data smdkc100_backlight_data = {
205 .pwm_id = 0,
206 .max_brightness = 255,
207 .dft_brightness = 255,
208 .pwm_period_ns = 78770,
209 .init = smdkc100_backlight_init,
210 .exit = smdkc100_backlight_exit,
211};
212
213static struct platform_device smdkc100_backlight_device = {
214 .name = "pwm-backlight",
215 .dev = {
216 .parent = &s3c_device_timer[0].dev,
217 .platform_data = &smdkc100_backlight_data,
218 },
219};
220
221static struct platform_device *smdkc100_devices[] __initdata = { 183static struct platform_device *smdkc100_devices[] __initdata = {
222 &s3c_device_adc, 184 &s3c_device_adc,
223 &s3c_device_cfcon, 185 &s3c_device_cfcon,
@@ -239,8 +201,6 @@ static struct platform_device *smdkc100_devices[] __initdata = {
239 &s5p_device_fimc1, 201 &s5p_device_fimc1,
240 &s5p_device_fimc2, 202 &s5p_device_fimc2,
241 &s5pc100_device_spdif, 203 &s5pc100_device_spdif,
242 &s3c_device_timer[0],
243 &smdkc100_backlight_device,
244}; 204};
245 205
246static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { 206static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
@@ -249,6 +209,16 @@ static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
249 .oversampling_shift = 2, 209 .oversampling_shift = 2,
250}; 210};
251 211
212/* LCD Backlight data */
213static struct samsung_bl_gpio_info smdkc100_bl_gpio_info = {
214 .no = S5PC100_GPD(0),
215 .func = S3C_GPIO_SFN(2),
216};
217
218static struct platform_pwm_backlight_data smdkc100_bl_data = {
219 .pwm_id = 0,
220};
221
252static void __init smdkc100_map_io(void) 222static void __init smdkc100_map_io(void)
253{ 223{
254 s5p_init_io(NULL, 0, S5P_VA_CHIPID); 224 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
@@ -276,6 +246,9 @@ static void __init smdkc100_machine_init(void)
276 /* LCD init */ 246 /* LCD init */
277 gpio_request(S5PC100_GPH0(6), "GPH0"); 247 gpio_request(S5PC100_GPH0(6), "GPH0");
278 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0); 248 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
249
250 samsung_bl_set(&smdkc100_bl_gpio_info, &smdkc100_bl_data);
251
279 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices)); 252 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
280} 253}
281 254
diff --git a/arch/arm/mach-s5pc100/setup-fb-24bpp.c b/arch/arm/mach-s5pc100/setup-fb-24bpp.c
index d31c0f3fe222..8978e4cf9ed5 100644
--- a/arch/arm/mach-s5pc100/setup-fb-24bpp.c
+++ b/arch/arm/mach-s5pc100/setup-fb-24bpp.c
@@ -15,7 +15,6 @@
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17 17
18#include <mach/regs-fb.h>
19#include <mach/map.h> 18#include <mach/map.h>
20#include <plat/fb.h> 19#include <plat/fb.h>
21#include <plat/gpio-cfg.h> 20#include <plat/gpio-cfg.h>
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 37b5a97594a5..79bb3a0314ef 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -134,6 +134,7 @@ config MACH_SMDKV210
134 select S3C_DEV_RTC 134 select S3C_DEV_RTC
135 select S3C_DEV_WDT 135 select S3C_DEV_WDT
136 select SAMSUNG_DEV_ADC 136 select SAMSUNG_DEV_ADC
137 select SAMSUNG_DEV_BACKLIGHT
137 select SAMSUNG_DEV_IDE 138 select SAMSUNG_DEV_IDE
138 select SAMSUNG_DEV_KEYPAD 139 select SAMSUNG_DEV_KEYPAD
139 select SAMSUNG_DEV_PWM 140 select SAMSUNG_DEV_PWM
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index 2d599499cefe..ae72f87eab15 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -36,7 +36,6 @@ static unsigned long xtal;
36static struct clksrc_clk clk_mout_apll = { 36static struct clksrc_clk clk_mout_apll = {
37 .clk = { 37 .clk = {
38 .name = "mout_apll", 38 .name = "mout_apll",
39 .id = -1,
40 }, 39 },
41 .sources = &clk_src_apll, 40 .sources = &clk_src_apll,
42 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 }, 41 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 },
@@ -45,7 +44,6 @@ static struct clksrc_clk clk_mout_apll = {
45static struct clksrc_clk clk_mout_epll = { 44static struct clksrc_clk clk_mout_epll = {
46 .clk = { 45 .clk = {
47 .name = "mout_epll", 46 .name = "mout_epll",
48 .id = -1,
49 }, 47 },
50 .sources = &clk_src_epll, 48 .sources = &clk_src_epll,
51 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 }, 49 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 },
@@ -54,7 +52,6 @@ static struct clksrc_clk clk_mout_epll = {
54static struct clksrc_clk clk_mout_mpll = { 52static struct clksrc_clk clk_mout_mpll = {
55 .clk = { 53 .clk = {
56 .name = "mout_mpll", 54 .name = "mout_mpll",
57 .id = -1,
58 }, 55 },
59 .sources = &clk_src_mpll, 56 .sources = &clk_src_mpll,
60 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 }, 57 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 },
@@ -73,7 +70,6 @@ static struct clksrc_sources clkset_armclk = {
73static struct clksrc_clk clk_armclk = { 70static struct clksrc_clk clk_armclk = {
74 .clk = { 71 .clk = {
75 .name = "armclk", 72 .name = "armclk",
76 .id = -1,
77 }, 73 },
78 .sources = &clkset_armclk, 74 .sources = &clkset_armclk,
79 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 }, 75 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 },
@@ -83,7 +79,6 @@ static struct clksrc_clk clk_armclk = {
83static struct clksrc_clk clk_hclk_msys = { 79static struct clksrc_clk clk_hclk_msys = {
84 .clk = { 80 .clk = {
85 .name = "hclk_msys", 81 .name = "hclk_msys",
86 .id = -1,
87 .parent = &clk_armclk.clk, 82 .parent = &clk_armclk.clk,
88 }, 83 },
89 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 }, 84 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 },
@@ -92,7 +87,6 @@ static struct clksrc_clk clk_hclk_msys = {
92static struct clksrc_clk clk_pclk_msys = { 87static struct clksrc_clk clk_pclk_msys = {
93 .clk = { 88 .clk = {
94 .name = "pclk_msys", 89 .name = "pclk_msys",
95 .id = -1,
96 .parent = &clk_hclk_msys.clk, 90 .parent = &clk_hclk_msys.clk,
97 }, 91 },
98 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 }, 92 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 },
@@ -101,7 +95,6 @@ static struct clksrc_clk clk_pclk_msys = {
101static struct clksrc_clk clk_sclk_a2m = { 95static struct clksrc_clk clk_sclk_a2m = {
102 .clk = { 96 .clk = {
103 .name = "sclk_a2m", 97 .name = "sclk_a2m",
104 .id = -1,
105 .parent = &clk_mout_apll.clk, 98 .parent = &clk_mout_apll.clk,
106 }, 99 },
107 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 }, 100 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 },
@@ -120,7 +113,6 @@ static struct clksrc_sources clkset_hclk_sys = {
120static struct clksrc_clk clk_hclk_dsys = { 113static struct clksrc_clk clk_hclk_dsys = {
121 .clk = { 114 .clk = {
122 .name = "hclk_dsys", 115 .name = "hclk_dsys",
123 .id = -1,
124 }, 116 },
125 .sources = &clkset_hclk_sys, 117 .sources = &clkset_hclk_sys,
126 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 }, 118 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 },
@@ -130,7 +122,6 @@ static struct clksrc_clk clk_hclk_dsys = {
130static struct clksrc_clk clk_pclk_dsys = { 122static struct clksrc_clk clk_pclk_dsys = {
131 .clk = { 123 .clk = {
132 .name = "pclk_dsys", 124 .name = "pclk_dsys",
133 .id = -1,
134 .parent = &clk_hclk_dsys.clk, 125 .parent = &clk_hclk_dsys.clk,
135 }, 126 },
136 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 20, .size = 3 }, 127 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 20, .size = 3 },
@@ -139,7 +130,6 @@ static struct clksrc_clk clk_pclk_dsys = {
139static struct clksrc_clk clk_hclk_psys = { 130static struct clksrc_clk clk_hclk_psys = {
140 .clk = { 131 .clk = {
141 .name = "hclk_psys", 132 .name = "hclk_psys",
142 .id = -1,
143 }, 133 },
144 .sources = &clkset_hclk_sys, 134 .sources = &clkset_hclk_sys,
145 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 }, 135 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 },
@@ -149,7 +139,6 @@ static struct clksrc_clk clk_hclk_psys = {
149static struct clksrc_clk clk_pclk_psys = { 139static struct clksrc_clk clk_pclk_psys = {
150 .clk = { 140 .clk = {
151 .name = "pclk_psys", 141 .name = "pclk_psys",
152 .id = -1,
153 .parent = &clk_hclk_psys.clk, 142 .parent = &clk_hclk_psys.clk,
154 }, 143 },
155 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 28, .size = 3 }, 144 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 28, .size = 3 },
@@ -187,38 +176,31 @@ static int s5pv210_clk_mask1_ctrl(struct clk *clk, int enable)
187 176
188static struct clk clk_sclk_hdmi27m = { 177static struct clk clk_sclk_hdmi27m = {
189 .name = "sclk_hdmi27m", 178 .name = "sclk_hdmi27m",
190 .id = -1,
191 .rate = 27000000, 179 .rate = 27000000,
192}; 180};
193 181
194static struct clk clk_sclk_hdmiphy = { 182static struct clk clk_sclk_hdmiphy = {
195 .name = "sclk_hdmiphy", 183 .name = "sclk_hdmiphy",
196 .id = -1,
197}; 184};
198 185
199static struct clk clk_sclk_usbphy0 = { 186static struct clk clk_sclk_usbphy0 = {
200 .name = "sclk_usbphy0", 187 .name = "sclk_usbphy0",
201 .id = -1,
202}; 188};
203 189
204static struct clk clk_sclk_usbphy1 = { 190static struct clk clk_sclk_usbphy1 = {
205 .name = "sclk_usbphy1", 191 .name = "sclk_usbphy1",
206 .id = -1,
207}; 192};
208 193
209static struct clk clk_pcmcdclk0 = { 194static struct clk clk_pcmcdclk0 = {
210 .name = "pcmcdclk", 195 .name = "pcmcdclk",
211 .id = -1,
212}; 196};
213 197
214static struct clk clk_pcmcdclk1 = { 198static struct clk clk_pcmcdclk1 = {
215 .name = "pcmcdclk", 199 .name = "pcmcdclk",
216 .id = -1,
217}; 200};
218 201
219static struct clk clk_pcmcdclk2 = { 202static struct clk clk_pcmcdclk2 = {
220 .name = "pcmcdclk", 203 .name = "pcmcdclk",
221 .id = -1,
222}; 204};
223 205
224static struct clk *clkset_vpllsrc_list[] = { 206static struct clk *clkset_vpllsrc_list[] = {
@@ -234,7 +216,6 @@ static struct clksrc_sources clkset_vpllsrc = {
234static struct clksrc_clk clk_vpllsrc = { 216static struct clksrc_clk clk_vpllsrc = {
235 .clk = { 217 .clk = {
236 .name = "vpll_src", 218 .name = "vpll_src",
237 .id = -1,
238 .enable = s5pv210_clk_mask0_ctrl, 219 .enable = s5pv210_clk_mask0_ctrl,
239 .ctrlbit = (1 << 7), 220 .ctrlbit = (1 << 7),
240 }, 221 },
@@ -255,7 +236,6 @@ static struct clksrc_sources clkset_sclk_vpll = {
255static struct clksrc_clk clk_sclk_vpll = { 236static struct clksrc_clk clk_sclk_vpll = {
256 .clk = { 237 .clk = {
257 .name = "sclk_vpll", 238 .name = "sclk_vpll",
258 .id = -1,
259 }, 239 },
260 .sources = &clkset_sclk_vpll, 240 .sources = &clkset_sclk_vpll,
261 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 }, 241 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 },
@@ -276,7 +256,6 @@ static struct clksrc_sources clkset_moutdmc0src = {
276static struct clksrc_clk clk_mout_dmc0 = { 256static struct clksrc_clk clk_mout_dmc0 = {
277 .clk = { 257 .clk = {
278 .name = "mout_dmc0", 258 .name = "mout_dmc0",
279 .id = -1,
280 }, 259 },
281 .sources = &clkset_moutdmc0src, 260 .sources = &clkset_moutdmc0src,
282 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 }, 261 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 },
@@ -285,7 +264,6 @@ static struct clksrc_clk clk_mout_dmc0 = {
285static struct clksrc_clk clk_sclk_dmc0 = { 264static struct clksrc_clk clk_sclk_dmc0 = {
286 .clk = { 265 .clk = {
287 .name = "sclk_dmc0", 266 .name = "sclk_dmc0",
288 .id = -1,
289 .parent = &clk_mout_dmc0.clk, 267 .parent = &clk_mout_dmc0.clk,
290 }, 268 },
291 .reg_div = { .reg = S5P_CLK_DIV6, .shift = 28, .size = 4 }, 269 .reg_div = { .reg = S5P_CLK_DIV6, .shift = 28, .size = 4 },
@@ -312,181 +290,169 @@ static struct clk_ops clk_fout_apll_ops = {
312static struct clk init_clocks_off[] = { 290static struct clk init_clocks_off[] = {
313 { 291 {
314 .name = "pdma", 292 .name = "pdma",
315 .id = 0, 293 .devname = "s3c-pl330.0",
316 .parent = &clk_hclk_psys.clk, 294 .parent = &clk_hclk_psys.clk,
317 .enable = s5pv210_clk_ip0_ctrl, 295 .enable = s5pv210_clk_ip0_ctrl,
318 .ctrlbit = (1 << 3), 296 .ctrlbit = (1 << 3),
319 }, { 297 }, {
320 .name = "pdma", 298 .name = "pdma",
321 .id = 1, 299 .devname = "s3c-pl330.1",
322 .parent = &clk_hclk_psys.clk, 300 .parent = &clk_hclk_psys.clk,
323 .enable = s5pv210_clk_ip0_ctrl, 301 .enable = s5pv210_clk_ip0_ctrl,
324 .ctrlbit = (1 << 4), 302 .ctrlbit = (1 << 4),
325 }, { 303 }, {
326 .name = "rot", 304 .name = "rot",
327 .id = -1,
328 .parent = &clk_hclk_dsys.clk, 305 .parent = &clk_hclk_dsys.clk,
329 .enable = s5pv210_clk_ip0_ctrl, 306 .enable = s5pv210_clk_ip0_ctrl,
330 .ctrlbit = (1<<29), 307 .ctrlbit = (1<<29),
331 }, { 308 }, {
332 .name = "fimc", 309 .name = "fimc",
333 .id = 0, 310 .devname = "s5pv210-fimc.0",
334 .parent = &clk_hclk_dsys.clk, 311 .parent = &clk_hclk_dsys.clk,
335 .enable = s5pv210_clk_ip0_ctrl, 312 .enable = s5pv210_clk_ip0_ctrl,
336 .ctrlbit = (1 << 24), 313 .ctrlbit = (1 << 24),
337 }, { 314 }, {
338 .name = "fimc", 315 .name = "fimc",
339 .id = 1, 316 .devname = "s5pv210-fimc.1",
340 .parent = &clk_hclk_dsys.clk, 317 .parent = &clk_hclk_dsys.clk,
341 .enable = s5pv210_clk_ip0_ctrl, 318 .enable = s5pv210_clk_ip0_ctrl,
342 .ctrlbit = (1 << 25), 319 .ctrlbit = (1 << 25),
343 }, { 320 }, {
344 .name = "fimc", 321 .name = "fimc",
345 .id = 2, 322 .devname = "s5pv210-fimc.2",
346 .parent = &clk_hclk_dsys.clk, 323 .parent = &clk_hclk_dsys.clk,
347 .enable = s5pv210_clk_ip0_ctrl, 324 .enable = s5pv210_clk_ip0_ctrl,
348 .ctrlbit = (1 << 26), 325 .ctrlbit = (1 << 26),
349 }, { 326 }, {
350 .name = "otg", 327 .name = "otg",
351 .id = -1,
352 .parent = &clk_hclk_psys.clk, 328 .parent = &clk_hclk_psys.clk,
353 .enable = s5pv210_clk_ip1_ctrl, 329 .enable = s5pv210_clk_ip1_ctrl,
354 .ctrlbit = (1<<16), 330 .ctrlbit = (1<<16),
355 }, { 331 }, {
356 .name = "usb-host", 332 .name = "usb-host",
357 .id = -1,
358 .parent = &clk_hclk_psys.clk, 333 .parent = &clk_hclk_psys.clk,
359 .enable = s5pv210_clk_ip1_ctrl, 334 .enable = s5pv210_clk_ip1_ctrl,
360 .ctrlbit = (1<<17), 335 .ctrlbit = (1<<17),
361 }, { 336 }, {
362 .name = "lcd", 337 .name = "lcd",
363 .id = -1,
364 .parent = &clk_hclk_dsys.clk, 338 .parent = &clk_hclk_dsys.clk,
365 .enable = s5pv210_clk_ip1_ctrl, 339 .enable = s5pv210_clk_ip1_ctrl,
366 .ctrlbit = (1<<0), 340 .ctrlbit = (1<<0),
367 }, { 341 }, {
368 .name = "cfcon", 342 .name = "cfcon",
369 .id = 0,
370 .parent = &clk_hclk_psys.clk, 343 .parent = &clk_hclk_psys.clk,
371 .enable = s5pv210_clk_ip1_ctrl, 344 .enable = s5pv210_clk_ip1_ctrl,
372 .ctrlbit = (1<<25), 345 .ctrlbit = (1<<25),
373 }, { 346 }, {
374 .name = "hsmmc", 347 .name = "hsmmc",
375 .id = 0, 348 .devname = "s3c-sdhci.0",
376 .parent = &clk_hclk_psys.clk, 349 .parent = &clk_hclk_psys.clk,
377 .enable = s5pv210_clk_ip2_ctrl, 350 .enable = s5pv210_clk_ip2_ctrl,
378 .ctrlbit = (1<<16), 351 .ctrlbit = (1<<16),
379 }, { 352 }, {
380 .name = "hsmmc", 353 .name = "hsmmc",
381 .id = 1, 354 .devname = "s3c-sdhci.1",
382 .parent = &clk_hclk_psys.clk, 355 .parent = &clk_hclk_psys.clk,
383 .enable = s5pv210_clk_ip2_ctrl, 356 .enable = s5pv210_clk_ip2_ctrl,
384 .ctrlbit = (1<<17), 357 .ctrlbit = (1<<17),
385 }, { 358 }, {
386 .name = "hsmmc", 359 .name = "hsmmc",
387 .id = 2, 360 .devname = "s3c-sdhci.2",
388 .parent = &clk_hclk_psys.clk, 361 .parent = &clk_hclk_psys.clk,
389 .enable = s5pv210_clk_ip2_ctrl, 362 .enable = s5pv210_clk_ip2_ctrl,
390 .ctrlbit = (1<<18), 363 .ctrlbit = (1<<18),
391 }, { 364 }, {
392 .name = "hsmmc", 365 .name = "hsmmc",
393 .id = 3, 366 .devname = "s3c-sdhci.3",
394 .parent = &clk_hclk_psys.clk, 367 .parent = &clk_hclk_psys.clk,
395 .enable = s5pv210_clk_ip2_ctrl, 368 .enable = s5pv210_clk_ip2_ctrl,
396 .ctrlbit = (1<<19), 369 .ctrlbit = (1<<19),
397 }, { 370 }, {
398 .name = "systimer", 371 .name = "systimer",
399 .id = -1,
400 .parent = &clk_pclk_psys.clk, 372 .parent = &clk_pclk_psys.clk,
401 .enable = s5pv210_clk_ip3_ctrl, 373 .enable = s5pv210_clk_ip3_ctrl,
402 .ctrlbit = (1<<16), 374 .ctrlbit = (1<<16),
403 }, { 375 }, {
404 .name = "watchdog", 376 .name = "watchdog",
405 .id = -1,
406 .parent = &clk_pclk_psys.clk, 377 .parent = &clk_pclk_psys.clk,
407 .enable = s5pv210_clk_ip3_ctrl, 378 .enable = s5pv210_clk_ip3_ctrl,
408 .ctrlbit = (1<<22), 379 .ctrlbit = (1<<22),
409 }, { 380 }, {
410 .name = "rtc", 381 .name = "rtc",
411 .id = -1,
412 .parent = &clk_pclk_psys.clk, 382 .parent = &clk_pclk_psys.clk,
413 .enable = s5pv210_clk_ip3_ctrl, 383 .enable = s5pv210_clk_ip3_ctrl,
414 .ctrlbit = (1<<15), 384 .ctrlbit = (1<<15),
415 }, { 385 }, {
416 .name = "i2c", 386 .name = "i2c",
417 .id = 0, 387 .devname = "s3c2440-i2c.0",
418 .parent = &clk_pclk_psys.clk, 388 .parent = &clk_pclk_psys.clk,
419 .enable = s5pv210_clk_ip3_ctrl, 389 .enable = s5pv210_clk_ip3_ctrl,
420 .ctrlbit = (1<<7), 390 .ctrlbit = (1<<7),
421 }, { 391 }, {
422 .name = "i2c", 392 .name = "i2c",
423 .id = 1, 393 .devname = "s3c2440-i2c.1",
424 .parent = &clk_pclk_psys.clk, 394 .parent = &clk_pclk_psys.clk,
425 .enable = s5pv210_clk_ip3_ctrl, 395 .enable = s5pv210_clk_ip3_ctrl,
426 .ctrlbit = (1 << 10), 396 .ctrlbit = (1 << 10),
427 }, { 397 }, {
428 .name = "i2c", 398 .name = "i2c",
429 .id = 2, 399 .devname = "s3c2440-i2c.2",
430 .parent = &clk_pclk_psys.clk, 400 .parent = &clk_pclk_psys.clk,
431 .enable = s5pv210_clk_ip3_ctrl, 401 .enable = s5pv210_clk_ip3_ctrl,
432 .ctrlbit = (1<<9), 402 .ctrlbit = (1<<9),
433 }, { 403 }, {
434 .name = "spi", 404 .name = "spi",
435 .id = 0, 405 .devname = "s3c64xx-spi.0",
436 .parent = &clk_pclk_psys.clk, 406 .parent = &clk_pclk_psys.clk,
437 .enable = s5pv210_clk_ip3_ctrl, 407 .enable = s5pv210_clk_ip3_ctrl,
438 .ctrlbit = (1<<12), 408 .ctrlbit = (1<<12),
439 }, { 409 }, {
440 .name = "spi", 410 .name = "spi",
441 .id = 1, 411 .devname = "s3c64xx-spi.1",
442 .parent = &clk_pclk_psys.clk, 412 .parent = &clk_pclk_psys.clk,
443 .enable = s5pv210_clk_ip3_ctrl, 413 .enable = s5pv210_clk_ip3_ctrl,
444 .ctrlbit = (1<<13), 414 .ctrlbit = (1<<13),
445 }, { 415 }, {
446 .name = "spi", 416 .name = "spi",
447 .id = 2, 417 .devname = "s3c64xx-spi.2",
448 .parent = &clk_pclk_psys.clk, 418 .parent = &clk_pclk_psys.clk,
449 .enable = s5pv210_clk_ip3_ctrl, 419 .enable = s5pv210_clk_ip3_ctrl,
450 .ctrlbit = (1<<14), 420 .ctrlbit = (1<<14),
451 }, { 421 }, {
452 .name = "timers", 422 .name = "timers",
453 .id = -1,
454 .parent = &clk_pclk_psys.clk, 423 .parent = &clk_pclk_psys.clk,
455 .enable = s5pv210_clk_ip3_ctrl, 424 .enable = s5pv210_clk_ip3_ctrl,
456 .ctrlbit = (1<<23), 425 .ctrlbit = (1<<23),
457 }, { 426 }, {
458 .name = "adc", 427 .name = "adc",
459 .id = -1,
460 .parent = &clk_pclk_psys.clk, 428 .parent = &clk_pclk_psys.clk,
461 .enable = s5pv210_clk_ip3_ctrl, 429 .enable = s5pv210_clk_ip3_ctrl,
462 .ctrlbit = (1<<24), 430 .ctrlbit = (1<<24),
463 }, { 431 }, {
464 .name = "keypad", 432 .name = "keypad",
465 .id = -1,
466 .parent = &clk_pclk_psys.clk, 433 .parent = &clk_pclk_psys.clk,
467 .enable = s5pv210_clk_ip3_ctrl, 434 .enable = s5pv210_clk_ip3_ctrl,
468 .ctrlbit = (1<<21), 435 .ctrlbit = (1<<21),
469 }, { 436 }, {
470 .name = "iis", 437 .name = "iis",
471 .id = 0, 438 .devname = "samsung-i2s.0",
472 .parent = &clk_p, 439 .parent = &clk_p,
473 .enable = s5pv210_clk_ip3_ctrl, 440 .enable = s5pv210_clk_ip3_ctrl,
474 .ctrlbit = (1<<4), 441 .ctrlbit = (1<<4),
475 }, { 442 }, {
476 .name = "iis", 443 .name = "iis",
477 .id = 1, 444 .devname = "samsung-i2s.1",
478 .parent = &clk_p, 445 .parent = &clk_p,
479 .enable = s5pv210_clk_ip3_ctrl, 446 .enable = s5pv210_clk_ip3_ctrl,
480 .ctrlbit = (1 << 5), 447 .ctrlbit = (1 << 5),
481 }, { 448 }, {
482 .name = "iis", 449 .name = "iis",
483 .id = 2, 450 .devname = "samsung-i2s.2",
484 .parent = &clk_p, 451 .parent = &clk_p,
485 .enable = s5pv210_clk_ip3_ctrl, 452 .enable = s5pv210_clk_ip3_ctrl,
486 .ctrlbit = (1 << 6), 453 .ctrlbit = (1 << 6),
487 }, { 454 }, {
488 .name = "spdif", 455 .name = "spdif",
489 .id = -1,
490 .parent = &clk_p, 456 .parent = &clk_p,
491 .enable = s5pv210_clk_ip3_ctrl, 457 .enable = s5pv210_clk_ip3_ctrl,
492 .ctrlbit = (1 << 0), 458 .ctrlbit = (1 << 0),
@@ -496,38 +462,36 @@ static struct clk init_clocks_off[] = {
496static struct clk init_clocks[] = { 462static struct clk init_clocks[] = {
497 { 463 {
498 .name = "hclk_imem", 464 .name = "hclk_imem",
499 .id = -1,
500 .parent = &clk_hclk_msys.clk, 465 .parent = &clk_hclk_msys.clk,
501 .ctrlbit = (1 << 5), 466 .ctrlbit = (1 << 5),
502 .enable = s5pv210_clk_ip0_ctrl, 467 .enable = s5pv210_clk_ip0_ctrl,
503 .ops = &clk_hclk_imem_ops, 468 .ops = &clk_hclk_imem_ops,
504 }, { 469 }, {
505 .name = "uart", 470 .name = "uart",
506 .id = 0, 471 .devname = "s5pv210-uart.0",
507 .parent = &clk_pclk_psys.clk, 472 .parent = &clk_pclk_psys.clk,
508 .enable = s5pv210_clk_ip3_ctrl, 473 .enable = s5pv210_clk_ip3_ctrl,
509 .ctrlbit = (1 << 17), 474 .ctrlbit = (1 << 17),
510 }, { 475 }, {
511 .name = "uart", 476 .name = "uart",
512 .id = 1, 477 .devname = "s5pv210-uart.1",
513 .parent = &clk_pclk_psys.clk, 478 .parent = &clk_pclk_psys.clk,
514 .enable = s5pv210_clk_ip3_ctrl, 479 .enable = s5pv210_clk_ip3_ctrl,
515 .ctrlbit = (1 << 18), 480 .ctrlbit = (1 << 18),
516 }, { 481 }, {
517 .name = "uart", 482 .name = "uart",
518 .id = 2, 483 .devname = "s5pv210-uart.2",
519 .parent = &clk_pclk_psys.clk, 484 .parent = &clk_pclk_psys.clk,
520 .enable = s5pv210_clk_ip3_ctrl, 485 .enable = s5pv210_clk_ip3_ctrl,
521 .ctrlbit = (1 << 19), 486 .ctrlbit = (1 << 19),
522 }, { 487 }, {
523 .name = "uart", 488 .name = "uart",
524 .id = 3, 489 .devname = "s5pv210-uart.3",
525 .parent = &clk_pclk_psys.clk, 490 .parent = &clk_pclk_psys.clk,
526 .enable = s5pv210_clk_ip3_ctrl, 491 .enable = s5pv210_clk_ip3_ctrl,
527 .ctrlbit = (1 << 20), 492 .ctrlbit = (1 << 20),
528 }, { 493 }, {
529 .name = "sromc", 494 .name = "sromc",
530 .id = -1,
531 .parent = &clk_hclk_psys.clk, 495 .parent = &clk_hclk_psys.clk,
532 .enable = s5pv210_clk_ip1_ctrl, 496 .enable = s5pv210_clk_ip1_ctrl,
533 .ctrlbit = (1 << 26), 497 .ctrlbit = (1 << 26),
@@ -579,7 +543,6 @@ static struct clksrc_sources clkset_sclk_dac = {
579static struct clksrc_clk clk_sclk_dac = { 543static struct clksrc_clk clk_sclk_dac = {
580 .clk = { 544 .clk = {
581 .name = "sclk_dac", 545 .name = "sclk_dac",
582 .id = -1,
583 .enable = s5pv210_clk_mask0_ctrl, 546 .enable = s5pv210_clk_mask0_ctrl,
584 .ctrlbit = (1 << 2), 547 .ctrlbit = (1 << 2),
585 }, 548 },
@@ -590,7 +553,6 @@ static struct clksrc_clk clk_sclk_dac = {
590static struct clksrc_clk clk_sclk_pixel = { 553static struct clksrc_clk clk_sclk_pixel = {
591 .clk = { 554 .clk = {
592 .name = "sclk_pixel", 555 .name = "sclk_pixel",
593 .id = -1,
594 .parent = &clk_sclk_vpll.clk, 556 .parent = &clk_sclk_vpll.clk,
595 }, 557 },
596 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 4}, 558 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 4},
@@ -609,7 +571,6 @@ static struct clksrc_sources clkset_sclk_hdmi = {
609static struct clksrc_clk clk_sclk_hdmi = { 571static struct clksrc_clk clk_sclk_hdmi = {
610 .clk = { 572 .clk = {
611 .name = "sclk_hdmi", 573 .name = "sclk_hdmi",
612 .id = -1,
613 .enable = s5pv210_clk_mask0_ctrl, 574 .enable = s5pv210_clk_mask0_ctrl,
614 .ctrlbit = (1 << 0), 575 .ctrlbit = (1 << 0),
615 }, 576 },
@@ -647,7 +608,7 @@ static struct clksrc_sources clkset_sclk_audio0 = {
647static struct clksrc_clk clk_sclk_audio0 = { 608static struct clksrc_clk clk_sclk_audio0 = {
648 .clk = { 609 .clk = {
649 .name = "sclk_audio", 610 .name = "sclk_audio",
650 .id = 0, 611 .devname = "soc-audio.0",
651 .enable = s5pv210_clk_mask0_ctrl, 612 .enable = s5pv210_clk_mask0_ctrl,
652 .ctrlbit = (1 << 24), 613 .ctrlbit = (1 << 24),
653 }, 614 },
@@ -676,7 +637,7 @@ static struct clksrc_sources clkset_sclk_audio1 = {
676static struct clksrc_clk clk_sclk_audio1 = { 637static struct clksrc_clk clk_sclk_audio1 = {
677 .clk = { 638 .clk = {
678 .name = "sclk_audio", 639 .name = "sclk_audio",
679 .id = 1, 640 .devname = "soc-audio.1",
680 .enable = s5pv210_clk_mask0_ctrl, 641 .enable = s5pv210_clk_mask0_ctrl,
681 .ctrlbit = (1 << 25), 642 .ctrlbit = (1 << 25),
682 }, 643 },
@@ -705,7 +666,7 @@ static struct clksrc_sources clkset_sclk_audio2 = {
705static struct clksrc_clk clk_sclk_audio2 = { 666static struct clksrc_clk clk_sclk_audio2 = {
706 .clk = { 667 .clk = {
707 .name = "sclk_audio", 668 .name = "sclk_audio",
708 .id = 2, 669 .devname = "soc-audio.2",
709 .enable = s5pv210_clk_mask0_ctrl, 670 .enable = s5pv210_clk_mask0_ctrl,
710 .ctrlbit = (1 << 26), 671 .ctrlbit = (1 << 26),
711 }, 672 },
@@ -725,48 +686,12 @@ static struct clksrc_sources clkset_sclk_spdif = {
725 .nr_sources = ARRAY_SIZE(clkset_sclk_spdif_list), 686 .nr_sources = ARRAY_SIZE(clkset_sclk_spdif_list),
726}; 687};
727 688
728static int s5pv210_spdif_set_rate(struct clk *clk, unsigned long rate)
729{
730 struct clk *pclk;
731 int ret;
732
733 pclk = clk_get_parent(clk);
734 if (IS_ERR(pclk))
735 return -EINVAL;
736
737 ret = pclk->ops->set_rate(pclk, rate);
738 clk_put(pclk);
739
740 return ret;
741}
742
743static unsigned long s5pv210_spdif_get_rate(struct clk *clk)
744{
745 struct clk *pclk;
746 int rate;
747
748 pclk = clk_get_parent(clk);
749 if (IS_ERR(pclk))
750 return -EINVAL;
751
752 rate = pclk->ops->get_rate(clk);
753 clk_put(pclk);
754
755 return rate;
756}
757
758static struct clk_ops s5pv210_sclk_spdif_ops = {
759 .set_rate = s5pv210_spdif_set_rate,
760 .get_rate = s5pv210_spdif_get_rate,
761};
762
763static struct clksrc_clk clk_sclk_spdif = { 689static struct clksrc_clk clk_sclk_spdif = {
764 .clk = { 690 .clk = {
765 .name = "sclk_spdif", 691 .name = "sclk_spdif",
766 .id = -1,
767 .enable = s5pv210_clk_mask0_ctrl, 692 .enable = s5pv210_clk_mask0_ctrl,
768 .ctrlbit = (1 << 27), 693 .ctrlbit = (1 << 27),
769 .ops = &s5pv210_sclk_spdif_ops, 694 .ops = &s5p_sclk_spdif_ops,
770 }, 695 },
771 .sources = &clkset_sclk_spdif, 696 .sources = &clkset_sclk_spdif,
772 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 12, .size = 2 }, 697 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 12, .size = 2 },
@@ -793,7 +718,6 @@ static struct clksrc_clk clksrcs[] = {
793 { 718 {
794 .clk = { 719 .clk = {
795 .name = "sclk_dmc", 720 .name = "sclk_dmc",
796 .id = -1,
797 }, 721 },
798 .sources = &clkset_group1, 722 .sources = &clkset_group1,
799 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 }, 723 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 },
@@ -801,7 +725,6 @@ static struct clksrc_clk clksrcs[] = {
801 }, { 725 }, {
802 .clk = { 726 .clk = {
803 .name = "sclk_onenand", 727 .name = "sclk_onenand",
804 .id = -1,
805 }, 728 },
806 .sources = &clkset_sclk_onenand, 729 .sources = &clkset_sclk_onenand,
807 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 28, .size = 1 }, 730 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 28, .size = 1 },
@@ -809,7 +732,7 @@ static struct clksrc_clk clksrcs[] = {
809 }, { 732 }, {
810 .clk = { 733 .clk = {
811 .name = "uclk1", 734 .name = "uclk1",
812 .id = 0, 735 .devname = "s5pv210-uart.0",
813 .enable = s5pv210_clk_mask0_ctrl, 736 .enable = s5pv210_clk_mask0_ctrl,
814 .ctrlbit = (1 << 12), 737 .ctrlbit = (1 << 12),
815 }, 738 },
@@ -819,7 +742,7 @@ static struct clksrc_clk clksrcs[] = {
819 }, { 742 }, {
820 .clk = { 743 .clk = {
821 .name = "uclk1", 744 .name = "uclk1",
822 .id = 1, 745 .devname = "s5pv210-uart.1",
823 .enable = s5pv210_clk_mask0_ctrl, 746 .enable = s5pv210_clk_mask0_ctrl,
824 .ctrlbit = (1 << 13), 747 .ctrlbit = (1 << 13),
825 }, 748 },
@@ -829,7 +752,7 @@ static struct clksrc_clk clksrcs[] = {
829 }, { 752 }, {
830 .clk = { 753 .clk = {
831 .name = "uclk1", 754 .name = "uclk1",
832 .id = 2, 755 .devname = "s5pv210-uart.2",
833 .enable = s5pv210_clk_mask0_ctrl, 756 .enable = s5pv210_clk_mask0_ctrl,
834 .ctrlbit = (1 << 14), 757 .ctrlbit = (1 << 14),
835 }, 758 },
@@ -839,7 +762,7 @@ static struct clksrc_clk clksrcs[] = {
839 }, { 762 }, {
840 .clk = { 763 .clk = {
841 .name = "uclk1", 764 .name = "uclk1",
842 .id = 3, 765 .devname = "s5pv210-uart.3",
843 .enable = s5pv210_clk_mask0_ctrl, 766 .enable = s5pv210_clk_mask0_ctrl,
844 .ctrlbit = (1 << 15), 767 .ctrlbit = (1 << 15),
845 }, 768 },
@@ -849,7 +772,6 @@ static struct clksrc_clk clksrcs[] = {
849 }, { 772 }, {
850 .clk = { 773 .clk = {
851 .name = "sclk_mixer", 774 .name = "sclk_mixer",
852 .id = -1,
853 .enable = s5pv210_clk_mask0_ctrl, 775 .enable = s5pv210_clk_mask0_ctrl,
854 .ctrlbit = (1 << 1), 776 .ctrlbit = (1 << 1),
855 }, 777 },
@@ -858,7 +780,7 @@ static struct clksrc_clk clksrcs[] = {
858 }, { 780 }, {
859 .clk = { 781 .clk = {
860 .name = "sclk_fimc", 782 .name = "sclk_fimc",
861 .id = 0, 783 .devname = "s5pv210-fimc.0",
862 .enable = s5pv210_clk_mask1_ctrl, 784 .enable = s5pv210_clk_mask1_ctrl,
863 .ctrlbit = (1 << 2), 785 .ctrlbit = (1 << 2),
864 }, 786 },
@@ -868,7 +790,7 @@ static struct clksrc_clk clksrcs[] = {
868 }, { 790 }, {
869 .clk = { 791 .clk = {
870 .name = "sclk_fimc", 792 .name = "sclk_fimc",
871 .id = 1, 793 .devname = "s5pv210-fimc.1",
872 .enable = s5pv210_clk_mask1_ctrl, 794 .enable = s5pv210_clk_mask1_ctrl,
873 .ctrlbit = (1 << 3), 795 .ctrlbit = (1 << 3),
874 }, 796 },
@@ -878,7 +800,7 @@ static struct clksrc_clk clksrcs[] = {
878 }, { 800 }, {
879 .clk = { 801 .clk = {
880 .name = "sclk_fimc", 802 .name = "sclk_fimc",
881 .id = 2, 803 .devname = "s5pv210-fimc.2",
882 .enable = s5pv210_clk_mask1_ctrl, 804 .enable = s5pv210_clk_mask1_ctrl,
883 .ctrlbit = (1 << 4), 805 .ctrlbit = (1 << 4),
884 }, 806 },
@@ -888,7 +810,7 @@ static struct clksrc_clk clksrcs[] = {
888 }, { 810 }, {
889 .clk = { 811 .clk = {
890 .name = "sclk_cam", 812 .name = "sclk_cam",
891 .id = 0, 813 .devname = "s5pv210-fimc.0",
892 .enable = s5pv210_clk_mask0_ctrl, 814 .enable = s5pv210_clk_mask0_ctrl,
893 .ctrlbit = (1 << 3), 815 .ctrlbit = (1 << 3),
894 }, 816 },
@@ -898,7 +820,7 @@ static struct clksrc_clk clksrcs[] = {
898 }, { 820 }, {
899 .clk = { 821 .clk = {
900 .name = "sclk_cam", 822 .name = "sclk_cam",
901 .id = 1, 823 .devname = "s5pv210-fimc.1",
902 .enable = s5pv210_clk_mask0_ctrl, 824 .enable = s5pv210_clk_mask0_ctrl,
903 .ctrlbit = (1 << 4), 825 .ctrlbit = (1 << 4),
904 }, 826 },
@@ -908,7 +830,6 @@ static struct clksrc_clk clksrcs[] = {
908 }, { 830 }, {
909 .clk = { 831 .clk = {
910 .name = "sclk_fimd", 832 .name = "sclk_fimd",
911 .id = -1,
912 .enable = s5pv210_clk_mask0_ctrl, 833 .enable = s5pv210_clk_mask0_ctrl,
913 .ctrlbit = (1 << 5), 834 .ctrlbit = (1 << 5),
914 }, 835 },
@@ -918,7 +839,7 @@ static struct clksrc_clk clksrcs[] = {
918 }, { 839 }, {
919 .clk = { 840 .clk = {
920 .name = "sclk_mmc", 841 .name = "sclk_mmc",
921 .id = 0, 842 .devname = "s3c-sdhci.0",
922 .enable = s5pv210_clk_mask0_ctrl, 843 .enable = s5pv210_clk_mask0_ctrl,
923 .ctrlbit = (1 << 8), 844 .ctrlbit = (1 << 8),
924 }, 845 },
@@ -928,7 +849,7 @@ static struct clksrc_clk clksrcs[] = {
928 }, { 849 }, {
929 .clk = { 850 .clk = {
930 .name = "sclk_mmc", 851 .name = "sclk_mmc",
931 .id = 1, 852 .devname = "s3c-sdhci.1",
932 .enable = s5pv210_clk_mask0_ctrl, 853 .enable = s5pv210_clk_mask0_ctrl,
933 .ctrlbit = (1 << 9), 854 .ctrlbit = (1 << 9),
934 }, 855 },
@@ -938,7 +859,7 @@ static struct clksrc_clk clksrcs[] = {
938 }, { 859 }, {
939 .clk = { 860 .clk = {
940 .name = "sclk_mmc", 861 .name = "sclk_mmc",
941 .id = 2, 862 .devname = "s3c-sdhci.2",
942 .enable = s5pv210_clk_mask0_ctrl, 863 .enable = s5pv210_clk_mask0_ctrl,
943 .ctrlbit = (1 << 10), 864 .ctrlbit = (1 << 10),
944 }, 865 },
@@ -948,7 +869,7 @@ static struct clksrc_clk clksrcs[] = {
948 }, { 869 }, {
949 .clk = { 870 .clk = {
950 .name = "sclk_mmc", 871 .name = "sclk_mmc",
951 .id = 3, 872 .devname = "s3c-sdhci.3",
952 .enable = s5pv210_clk_mask0_ctrl, 873 .enable = s5pv210_clk_mask0_ctrl,
953 .ctrlbit = (1 << 11), 874 .ctrlbit = (1 << 11),
954 }, 875 },
@@ -958,7 +879,6 @@ static struct clksrc_clk clksrcs[] = {
958 }, { 879 }, {
959 .clk = { 880 .clk = {
960 .name = "sclk_mfc", 881 .name = "sclk_mfc",
961 .id = -1,
962 .enable = s5pv210_clk_ip0_ctrl, 882 .enable = s5pv210_clk_ip0_ctrl,
963 .ctrlbit = (1 << 16), 883 .ctrlbit = (1 << 16),
964 }, 884 },
@@ -968,7 +888,6 @@ static struct clksrc_clk clksrcs[] = {
968 }, { 888 }, {
969 .clk = { 889 .clk = {
970 .name = "sclk_g2d", 890 .name = "sclk_g2d",
971 .id = -1,
972 .enable = s5pv210_clk_ip0_ctrl, 891 .enable = s5pv210_clk_ip0_ctrl,
973 .ctrlbit = (1 << 12), 892 .ctrlbit = (1 << 12),
974 }, 893 },
@@ -978,7 +897,6 @@ static struct clksrc_clk clksrcs[] = {
978 }, { 897 }, {
979 .clk = { 898 .clk = {
980 .name = "sclk_g3d", 899 .name = "sclk_g3d",
981 .id = -1,
982 .enable = s5pv210_clk_ip0_ctrl, 900 .enable = s5pv210_clk_ip0_ctrl,
983 .ctrlbit = (1 << 8), 901 .ctrlbit = (1 << 8),
984 }, 902 },
@@ -988,7 +906,6 @@ static struct clksrc_clk clksrcs[] = {
988 }, { 906 }, {
989 .clk = { 907 .clk = {
990 .name = "sclk_csis", 908 .name = "sclk_csis",
991 .id = -1,
992 .enable = s5pv210_clk_mask0_ctrl, 909 .enable = s5pv210_clk_mask0_ctrl,
993 .ctrlbit = (1 << 6), 910 .ctrlbit = (1 << 6),
994 }, 911 },
@@ -998,7 +915,7 @@ static struct clksrc_clk clksrcs[] = {
998 }, { 915 }, {
999 .clk = { 916 .clk = {
1000 .name = "sclk_spi", 917 .name = "sclk_spi",
1001 .id = 0, 918 .devname = "s3c64xx-spi.0",
1002 .enable = s5pv210_clk_mask0_ctrl, 919 .enable = s5pv210_clk_mask0_ctrl,
1003 .ctrlbit = (1 << 16), 920 .ctrlbit = (1 << 16),
1004 }, 921 },
@@ -1008,7 +925,7 @@ static struct clksrc_clk clksrcs[] = {
1008 }, { 925 }, {
1009 .clk = { 926 .clk = {
1010 .name = "sclk_spi", 927 .name = "sclk_spi",
1011 .id = 1, 928 .devname = "s3c64xx-spi.1",
1012 .enable = s5pv210_clk_mask0_ctrl, 929 .enable = s5pv210_clk_mask0_ctrl,
1013 .ctrlbit = (1 << 17), 930 .ctrlbit = (1 << 17),
1014 }, 931 },
@@ -1018,7 +935,6 @@ static struct clksrc_clk clksrcs[] = {
1018 }, { 935 }, {
1019 .clk = { 936 .clk = {
1020 .name = "sclk_pwi", 937 .name = "sclk_pwi",
1021 .id = -1,
1022 .enable = s5pv210_clk_mask0_ctrl, 938 .enable = s5pv210_clk_mask0_ctrl,
1023 .ctrlbit = (1 << 29), 939 .ctrlbit = (1 << 29),
1024 }, 940 },
@@ -1028,7 +944,6 @@ static struct clksrc_clk clksrcs[] = {
1028 }, { 944 }, {
1029 .clk = { 945 .clk = {
1030 .name = "sclk_pwm", 946 .name = "sclk_pwm",
1031 .id = -1,
1032 .enable = s5pv210_clk_mask0_ctrl, 947 .enable = s5pv210_clk_mask0_ctrl,
1033 .ctrlbit = (1 << 19), 948 .ctrlbit = (1 << 19),
1034 }, 949 },
diff --git a/arch/arm/mach-s5pv210/dev-spi.c b/arch/arm/mach-s5pv210/dev-spi.c
index e3249a47e3b1..eaf9a7bff7a0 100644
--- a/arch/arm/mach-s5pv210/dev-spi.c
+++ b/arch/arm/mach-s5pv210/dev-spi.c
@@ -85,6 +85,7 @@ static struct s3c64xx_spi_info s5pv210_spi0_pdata = {
85 .fifo_lvl_mask = 0x1ff, 85 .fifo_lvl_mask = 0x1ff,
86 .rx_lvl_offset = 15, 86 .rx_lvl_offset = 15,
87 .high_speed = 1, 87 .high_speed = 1,
88 .tx_st_done = 25,
88}; 89};
89 90
90static u64 spi_dmamask = DMA_BIT_MASK(32); 91static u64 spi_dmamask = DMA_BIT_MASK(32);
@@ -129,6 +130,7 @@ static struct s3c64xx_spi_info s5pv210_spi1_pdata = {
129 .fifo_lvl_mask = 0x7f, 130 .fifo_lvl_mask = 0x7f,
130 .rx_lvl_offset = 15, 131 .rx_lvl_offset = 15,
131 .high_speed = 1, 132 .high_speed = 1,
133 .tx_st_done = 25,
132}; 134};
133 135
134struct platform_device s5pv210_device_spi1 = { 136struct platform_device s5pv210_device_spi1 = {
diff --git a/arch/arm/mach-s5pv210/include/mach/clkdev.h b/arch/arm/mach-s5pv210/include/mach/clkdev.h
new file mode 100644
index 000000000000..7dffa83d23ff
--- /dev/null
+++ b/arch/arm/mach-s5pv210/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __MACH_CLKDEV_H__
2#define __MACH_CLKDEV_H__
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do {} while (0)
6
7#endif
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-fb.h b/arch/arm/mach-s5pv210/include/mach/regs-fb.h
deleted file mode 100644
index 60d992989bdc..000000000000
--- a/arch/arm/mach-s5pv210/include/mach/regs-fb.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
3 *
4 * Dummy framebuffer to allow build for the moment.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef __ASM_ARCH_MACH_REGS_FB_H
12#define __ASM_ARCH_MACH_REGS_FB_H __FILE__
13
14#include <plat/regs-fb-v4.h>
15
16static inline unsigned int s3c_fb_pal_reg(unsigned int window, int reg)
17{
18 return 0x2400 + (window * 256 *4 ) + reg;
19}
20
21#endif /* __ASM_ARCH_MACH_REGS_FB_H */
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index 4e1d8ff5ae59..509627f25111 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -29,7 +29,6 @@
29 29
30#include <mach/map.h> 30#include <mach/map.h>
31#include <mach/regs-clock.h> 31#include <mach/regs-clock.h>
32#include <mach/regs-fb.h>
33 32
34#include <plat/gpio-cfg.h> 33#include <plat/gpio-cfg.h>
35#include <plat/regs-serial.h> 34#include <plat/regs-serial.h>
@@ -40,6 +39,7 @@
40#include <plat/fimc-core.h> 39#include <plat/fimc-core.h>
41#include <plat/sdhci.h> 40#include <plat/sdhci.h>
42#include <plat/s5p-time.h> 41#include <plat/s5p-time.h>
42#include <plat/regs-fb-v4.h>
43 43
44/* Following are default values for UCON, ULCON and UFCON UART registers */ 44/* Following are default values for UCON, ULCON and UFCON UART registers */
45#define AQUILA_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 45#define AQUILA_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 31d5aa769753..e0c4d06b9db6 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -34,7 +34,6 @@
34 34
35#include <mach/map.h> 35#include <mach/map.h>
36#include <mach/regs-clock.h> 36#include <mach/regs-clock.h>
37#include <mach/regs-fb.h>
38 37
39#include <plat/gpio-cfg.h> 38#include <plat/gpio-cfg.h>
40#include <plat/regs-serial.h> 39#include <plat/regs-serial.h>
@@ -47,6 +46,7 @@
47#include <plat/sdhci.h> 46#include <plat/sdhci.h>
48#include <plat/clock.h> 47#include <plat/clock.h>
49#include <plat/s5p-time.h> 48#include <plat/s5p-time.h>
49#include <plat/regs-fb-v4.h>
50 50
51/* Following are default values for UCON, ULCON and UFCON UART registers */ 51/* Following are default values for UCON, ULCON and UFCON UART registers */
52#define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 52#define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index c6a9e86c2d5c..ef20f922249d 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -29,7 +29,6 @@
29 29
30#include <mach/map.h> 30#include <mach/map.h>
31#include <mach/regs-clock.h> 31#include <mach/regs-clock.h>
32#include <mach/regs-fb.h>
33 32
34#include <plat/regs-serial.h> 33#include <plat/regs-serial.h>
35#include <plat/regs-srom.h> 34#include <plat/regs-srom.h>
@@ -45,6 +44,8 @@
45#include <plat/pm.h> 44#include <plat/pm.h>
46#include <plat/fb.h> 45#include <plat/fb.h>
47#include <plat/s5p-time.h> 46#include <plat/s5p-time.h>
47#include <plat/backlight.h>
48#include <plat/regs-fb-v4.h>
48 49
49/* Following are default values for UCON, ULCON and UFCON UART registers */ 50/* Following are default values for UCON, ULCON and UFCON UART registers */
50#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 51#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -210,45 +211,6 @@ static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = {
210 .setup_gpio = s5pv210_fb_gpio_setup_24bpp, 211 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
211}; 212};
212 213
213static int smdkv210_backlight_init(struct device *dev)
214{
215 int ret;
216
217 ret = gpio_request(S5PV210_GPD0(3), "Backlight");
218 if (ret) {
219 printk(KERN_ERR "failed to request GPD for PWM-OUT 3\n");
220 return ret;
221 }
222
223 /* Configure GPIO pin with S5PV210_GPD_0_3_TOUT_3 */
224 s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_SFN(2));
225
226 return 0;
227}
228
229static void smdkv210_backlight_exit(struct device *dev)
230{
231 s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_OUTPUT);
232 gpio_free(S5PV210_GPD0(3));
233}
234
235static struct platform_pwm_backlight_data smdkv210_backlight_data = {
236 .pwm_id = 3,
237 .max_brightness = 255,
238 .dft_brightness = 255,
239 .pwm_period_ns = 78770,
240 .init = smdkv210_backlight_init,
241 .exit = smdkv210_backlight_exit,
242};
243
244static struct platform_device smdkv210_backlight_device = {
245 .name = "pwm-backlight",
246 .dev = {
247 .parent = &s3c_device_timer[3].dev,
248 .platform_data = &smdkv210_backlight_data,
249 },
250};
251
252static struct platform_device *smdkv210_devices[] __initdata = { 214static struct platform_device *smdkv210_devices[] __initdata = {
253 &s3c_device_adc, 215 &s3c_device_adc,
254 &s3c_device_cfcon, 216 &s3c_device_cfcon,
@@ -270,8 +232,6 @@ static struct platform_device *smdkv210_devices[] __initdata = {
270 &samsung_device_keypad, 232 &samsung_device_keypad,
271 &smdkv210_dm9000, 233 &smdkv210_dm9000,
272 &smdkv210_lcd_lte480wv, 234 &smdkv210_lcd_lte480wv,
273 &s3c_device_timer[3],
274 &smdkv210_backlight_device,
275}; 235};
276 236
277static void __init smdkv210_dm9000_init(void) 237static void __init smdkv210_dm9000_init(void)
@@ -310,6 +270,16 @@ static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
310 .oversampling_shift = 2, 270 .oversampling_shift = 2,
311}; 271};
312 272
273/* LCD Backlight data */
274static struct samsung_bl_gpio_info smdkv210_bl_gpio_info = {
275 .no = S5PV210_GPD0(3),
276 .func = S3C_GPIO_SFN(2),
277};
278
279static struct platform_pwm_backlight_data smdkv210_bl_data = {
280 .pwm_id = 3,
281};
282
313static void __init smdkv210_map_io(void) 283static void __init smdkv210_map_io(void)
314{ 284{
315 s5p_init_io(NULL, 0, S5P_VA_CHIPID); 285 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
@@ -341,6 +311,8 @@ static void __init smdkv210_machine_init(void)
341 311
342 s3c_fb_set_platdata(&smdkv210_lcd0_pdata); 312 s3c_fb_set_platdata(&smdkv210_lcd0_pdata);
343 313
314 samsung_bl_set(&smdkv210_bl_gpio_info, &smdkv210_bl_data);
315
344 platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices)); 316 platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices));
345} 317}
346 318
diff --git a/arch/arm/mach-s5pv210/setup-fb-24bpp.c b/arch/arm/mach-s5pv210/setup-fb-24bpp.c
index e932ebfac56d..55103c8220b3 100644
--- a/arch/arm/mach-s5pv210/setup-fb-24bpp.c
+++ b/arch/arm/mach-s5pv210/setup-fb-24bpp.c
@@ -15,7 +15,6 @@
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17 17
18#include <mach/regs-fb.h>
19#include <mach/map.h> 18#include <mach/map.h>
20#include <plat/fb.h> 19#include <plat/fb.h>
21#include <mach/regs-clock.h> 20#include <mach/regs-clock.h>
diff --git a/arch/arm/mach-vt8500/irq.c b/arch/arm/mach-vt8500/irq.c
index 245140c0df10..642de0408f25 100644
--- a/arch/arm/mach-vt8500/irq.c
+++ b/arch/arm/mach-vt8500/irq.c
@@ -39,9 +39,10 @@
39static void __iomem *ic_regbase; 39static void __iomem *ic_regbase;
40static void __iomem *sic_regbase; 40static void __iomem *sic_regbase;
41 41
42static void vt8500_irq_mask(unsigned int irq) 42static void vt8500_irq_mask(struct irq_data *d)
43{ 43{
44 void __iomem *base = ic_regbase; 44 void __iomem *base = ic_regbase;
45 unsigned irq = d->irq;
45 u8 edge; 46 u8 edge;
46 47
47 if (irq >= 64) { 48 if (irq >= 64) {
@@ -64,9 +65,10 @@ static void vt8500_irq_mask(unsigned int irq)
64 } 65 }
65} 66}
66 67
67static void vt8500_irq_unmask(unsigned int irq) 68static void vt8500_irq_unmask(struct irq_data *d)
68{ 69{
69 void __iomem *base = ic_regbase; 70 void __iomem *base = ic_regbase;
71 unsigned irq = d->irq;
70 u8 dctr; 72 u8 dctr;
71 73
72 if (irq >= 64) { 74 if (irq >= 64) {
@@ -78,10 +80,11 @@ static void vt8500_irq_unmask(unsigned int irq)
78 writeb(dctr, base + VT8500_IC_DCTR + irq); 80 writeb(dctr, base + VT8500_IC_DCTR + irq);
79} 81}
80 82
81static int vt8500_irq_set_type(unsigned int irq, unsigned int flow_type) 83static int vt8500_irq_set_type(struct irq_data *d, unsigned int flow_type)
82{ 84{
83 void __iomem *base = ic_regbase; 85 void __iomem *base = ic_regbase;
84 unsigned int orig_irq = irq; 86 unsigned irq = d->irq;
87 unsigned orig_irq = irq;
85 u8 dctr; 88 u8 dctr;
86 89
87 if (irq >= 64) { 90 if (irq >= 64) {
@@ -114,11 +117,11 @@ static int vt8500_irq_set_type(unsigned int irq, unsigned int flow_type)
114} 117}
115 118
116static struct irq_chip vt8500_irq_chip = { 119static struct irq_chip vt8500_irq_chip = {
117 .name = "vt8500", 120 .name = "vt8500",
118 .ack = vt8500_irq_mask, 121 .irq_ack = vt8500_irq_mask,
119 .mask = vt8500_irq_mask, 122 .irq_mask = vt8500_irq_mask,
120 .unmask = vt8500_irq_unmask, 123 .irq_unmask = vt8500_irq_unmask,
121 .set_type = vt8500_irq_set_type, 124 .irq_set_type = vt8500_irq_set_type,
122}; 125};
123 126
124void __init vt8500_init_irq(void) 127void __init vt8500_init_irq(void)
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index ef59099a5463..44c086710d2b 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -120,17 +120,22 @@ static void l2x0_cache_sync(void)
120 spin_unlock_irqrestore(&l2x0_lock, flags); 120 spin_unlock_irqrestore(&l2x0_lock, flags);
121} 121}
122 122
123static void l2x0_flush_all(void) 123static void __l2x0_flush_all(void)
124{ 124{
125 unsigned long flags;
126
127 /* clean all ways */
128 spin_lock_irqsave(&l2x0_lock, flags);
129 debug_writel(0x03); 125 debug_writel(0x03);
130 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_INV_WAY); 126 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_INV_WAY);
131 cache_wait_way(l2x0_base + L2X0_CLEAN_INV_WAY, l2x0_way_mask); 127 cache_wait_way(l2x0_base + L2X0_CLEAN_INV_WAY, l2x0_way_mask);
132 cache_sync(); 128 cache_sync();
133 debug_writel(0x00); 129 debug_writel(0x00);
130}
131
132static void l2x0_flush_all(void)
133{
134 unsigned long flags;
135
136 /* clean all ways */
137 spin_lock_irqsave(&l2x0_lock, flags);
138 __l2x0_flush_all();
134 spin_unlock_irqrestore(&l2x0_lock, flags); 139 spin_unlock_irqrestore(&l2x0_lock, flags);
135} 140}
136 141
@@ -266,7 +271,9 @@ static void l2x0_disable(void)
266 unsigned long flags; 271 unsigned long flags;
267 272
268 spin_lock_irqsave(&l2x0_lock, flags); 273 spin_lock_irqsave(&l2x0_lock, flags);
269 writel(0, l2x0_base + L2X0_CTRL); 274 __l2x0_flush_all();
275 writel_relaxed(0, l2x0_base + L2X0_CTRL);
276 dsb();
270 spin_unlock_irqrestore(&l2x0_lock, flags); 277 spin_unlock_irqrestore(&l2x0_lock, flags);
271} 278}
272 279
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 9d9e736c2b4f..594d677b92c8 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -759,7 +759,7 @@ early_param("vmalloc", early_vmalloc);
759 759
760static phys_addr_t lowmem_limit __initdata = 0; 760static phys_addr_t lowmem_limit __initdata = 0;
761 761
762static void __init sanity_check_meminfo(void) 762void __init sanity_check_meminfo(void)
763{ 763{
764 int i, j, highmem = 0; 764 int i, j, highmem = 0;
765 765
@@ -1032,8 +1032,9 @@ void __init paging_init(struct machine_desc *mdesc)
1032{ 1032{
1033 void *zero_page; 1033 void *zero_page;
1034 1034
1035 memblock_set_current_limit(lowmem_limit);
1036
1035 build_mem_type_table(); 1037 build_mem_type_table();
1036 sanity_check_meminfo();
1037 prepare_page_table(); 1038 prepare_page_table();
1038 map_lowmem(); 1039 map_lowmem();
1039 devicemaps_init(mdesc); 1040 devicemaps_init(mdesc);
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 687d02319a41..941a98c9e8aa 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -27,6 +27,10 @@ void __init arm_mm_memblock_reserve(void)
27 memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE); 27 memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
28} 28}
29 29
30void __init sanity_check_meminfo(void)
31{
32}
33
30/* 34/*
31 * paging_init() sets up the page tables, initialises the zone memory 35 * paging_init() sets up the page tables, initialises the zone memory
32 * maps, and sets up the zero page, bad page and bad page tables. 36 * maps, and sets up the zero page, bad page and bad page tables.
diff --git a/arch/arm/plat-s3c24xx/clock-dclk.c b/arch/arm/plat-s3c24xx/clock-dclk.c
index cf97caafe56b..f95d3268ae1f 100644
--- a/arch/arm/plat-s3c24xx/clock-dclk.c
+++ b/arch/arm/plat-s3c24xx/clock-dclk.c
@@ -169,7 +169,6 @@ static struct clk_ops dclk_ops = {
169 169
170struct clk s3c24xx_dclk0 = { 170struct clk s3c24xx_dclk0 = {
171 .name = "dclk0", 171 .name = "dclk0",
172 .id = -1,
173 .ctrlbit = S3C2410_DCLKCON_DCLK0EN, 172 .ctrlbit = S3C2410_DCLKCON_DCLK0EN,
174 .enable = s3c24xx_dclk_enable, 173 .enable = s3c24xx_dclk_enable,
175 .ops = &dclk_ops, 174 .ops = &dclk_ops,
@@ -177,7 +176,6 @@ struct clk s3c24xx_dclk0 = {
177 176
178struct clk s3c24xx_dclk1 = { 177struct clk s3c24xx_dclk1 = {
179 .name = "dclk1", 178 .name = "dclk1",
180 .id = -1,
181 .ctrlbit = S3C2410_DCLKCON_DCLK1EN, 179 .ctrlbit = S3C2410_DCLKCON_DCLK1EN,
182 .enable = s3c24xx_dclk_enable, 180 .enable = s3c24xx_dclk_enable,
183 .ops = &dclk_ops, 181 .ops = &dclk_ops,
@@ -189,12 +187,10 @@ static struct clk_ops clkout_ops = {
189 187
190struct clk s3c24xx_clkout0 = { 188struct clk s3c24xx_clkout0 = {
191 .name = "clkout0", 189 .name = "clkout0",
192 .id = -1,
193 .ops = &clkout_ops, 190 .ops = &clkout_ops,
194}; 191};
195 192
196struct clk s3c24xx_clkout1 = { 193struct clk s3c24xx_clkout1 = {
197 .name = "clkout1", 194 .name = "clkout1",
198 .id = -1,
199 .ops = &clkout_ops, 195 .ops = &clkout_ops,
200}; 196};
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c
index 73667994518a..a76bf2df3333 100644
--- a/arch/arm/plat-s3c24xx/devs.c
+++ b/arch/arm/plat-s3c24xx/devs.c
@@ -150,9 +150,8 @@ void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
150{ 150{
151 struct s3c2410fb_mach_info *npd; 151 struct s3c2410fb_mach_info *npd;
152 152
153 npd = kmemdup(pd, sizeof(*npd), GFP_KERNEL); 153 npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_lcd);
154 if (npd) { 154 if (npd) {
155 s3c_device_lcd.dev.platform_data = npd;
156 npd->displays = kmemdup(pd->displays, 155 npd->displays = kmemdup(pd->displays,
157 sizeof(struct s3c2410fb_display) * npd->num_displays, 156 sizeof(struct s3c2410fb_display) * npd->num_displays,
158 GFP_KERNEL); 157 GFP_KERNEL);
@@ -188,12 +187,10 @@ struct platform_device s3c_device_ts = {
188}; 187};
189EXPORT_SYMBOL(s3c_device_ts); 188EXPORT_SYMBOL(s3c_device_ts);
190 189
191static struct s3c2410_ts_mach_info s3c2410ts_info;
192
193void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info) 190void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
194{ 191{
195 memcpy(&s3c2410ts_info, hard_s3c2410ts_info, sizeof(struct s3c2410_ts_mach_info)); 192 s3c_set_platdata(hard_s3c2410ts_info,
196 s3c_device_ts.dev.platform_data = &s3c2410ts_info; 193 sizeof(struct s3c2410_ts_mach_info), &s3c_device_ts);
197} 194}
198 195
199/* USB Device (Gadget)*/ 196/* USB Device (Gadget)*/
@@ -223,15 +220,7 @@ EXPORT_SYMBOL(s3c_device_usbgadget);
223 220
224void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd) 221void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
225{ 222{
226 struct s3c2410_udc_mach_info *npd; 223 s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usbgadget);
227
228 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
229 if (npd) {
230 memcpy(npd, pd, sizeof(*npd));
231 s3c_device_usbgadget.dev.platform_data = npd;
232 } else {
233 printk(KERN_ERR "no memory for udc platform data\n");
234 }
235} 224}
236 225
237/* USB High Speed 2.0 Device (Gadget) */ 226/* USB High Speed 2.0 Device (Gadget) */
@@ -263,15 +252,7 @@ struct platform_device s3c_device_usb_hsudc = {
263 252
264void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd) 253void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
265{ 254{
266 struct s3c24xx_hsudc_platdata *npd; 255 s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc);
267
268 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
269 if (npd) {
270 memcpy(npd, pd, sizeof(*npd));
271 s3c_device_usb_hsudc.dev.platform_data = npd;
272 } else {
273 printk(KERN_ERR "no memory for udc platform data\n");
274 }
275} 256}
276 257
277/* IIS */ 258/* IIS */
@@ -383,13 +364,8 @@ EXPORT_SYMBOL(s3c_device_sdi);
383 364
384void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata) 365void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
385{ 366{
386 struct s3c24xx_mci_pdata *npd; 367 s3c_set_platdata(pdata, sizeof(struct s3c24xx_mci_pdata),
387 368 &s3c_device_sdi);
388 npd = kmemdup(pdata, sizeof(struct s3c24xx_mci_pdata), GFP_KERNEL);
389 if (!npd)
390 printk(KERN_ERR "%s: no memory to copy pdata", __func__);
391
392 s3c_device_sdi.dev.platform_data = npd;
393} 369}
394 370
395 371
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 2abf9660bc6c..a79a8ccd25f6 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -1027,17 +1027,13 @@ int s3c2410_dma_config(unsigned int channel,
1027 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 1027 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
1028 unsigned int dcon; 1028 unsigned int dcon;
1029 1029
1030 pr_debug("%s: chan=%d, xfer_unit=%d, dcon=%08x\n", 1030 pr_debug("%s: chan=%d, xfer_unit=%d\n", __func__, channel, xferunit);
1031 __func__, channel, xferunit, dcon);
1032 1031
1033 if (chan == NULL) 1032 if (chan == NULL)
1034 return -EINVAL; 1033 return -EINVAL;
1035 1034
1036 pr_debug("%s: Initial dcon is %08x\n", __func__, dcon);
1037
1038 dcon = chan->dcon & dma_sel.dcon_mask; 1035 dcon = chan->dcon & dma_sel.dcon_mask;
1039 1036 pr_debug("%s: dcon is %08x\n", __func__, dcon);
1040 pr_debug("%s: New dcon is %08x\n", __func__, dcon);
1041 1037
1042 switch (chan->req_ch) { 1038 switch (chan->req_ch) {
1043 case DMACH_I2S_IN: 1039 case DMACH_I2S_IN:
@@ -1235,7 +1231,7 @@ static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp)
1235 /* restore channel's hardware configuration */ 1231 /* restore channel's hardware configuration */
1236 1232
1237 if (!cp->in_use) 1233 if (!cp->in_use)
1238 return 0; 1234 return;
1239 1235
1240 printk(KERN_INFO "dma%d: restoring configuration\n", cp->number); 1236 printk(KERN_INFO "dma%d: restoring configuration\n", cp->number);
1241 1237
@@ -1246,8 +1242,6 @@ static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp)
1246 1242
1247 if (cp->map != NULL) 1243 if (cp->map != NULL)
1248 dma_sel.select(cp, cp->map); 1244 dma_sel.select(cp, cp->map);
1249
1250 return 0;
1251} 1245}
1252 1246
1253static void s3c2410_dma_resume(void) 1247static void s3c2410_dma_resume(void)
diff --git a/arch/arm/plat-s3c24xx/include/mach/clkdev.h b/arch/arm/plat-s3c24xx/include/mach/clkdev.h
new file mode 100644
index 000000000000..7dffa83d23ff
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __MACH_CLKDEV_H__
2#define __MACH_CLKDEV_H__
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do {} while (0)
6
7#endif
diff --git a/arch/arm/plat-s3c24xx/s3c2410-clock.c b/arch/arm/plat-s3c24xx/s3c2410-clock.c
index 9ecc5d913679..def76aa3825a 100644
--- a/arch/arm/plat-s3c24xx/s3c2410-clock.c
+++ b/arch/arm/plat-s3c24xx/s3c2410-clock.c
@@ -90,37 +90,31 @@ static int s3c2410_upll_enable(struct clk *clk, int enable)
90static struct clk init_clocks_off[] = { 90static struct clk init_clocks_off[] = {
91 { 91 {
92 .name = "nand", 92 .name = "nand",
93 .id = -1,
94 .parent = &clk_h, 93 .parent = &clk_h,
95 .enable = s3c2410_clkcon_enable, 94 .enable = s3c2410_clkcon_enable,
96 .ctrlbit = S3C2410_CLKCON_NAND, 95 .ctrlbit = S3C2410_CLKCON_NAND,
97 }, { 96 }, {
98 .name = "sdi", 97 .name = "sdi",
99 .id = -1,
100 .parent = &clk_p, 98 .parent = &clk_p,
101 .enable = s3c2410_clkcon_enable, 99 .enable = s3c2410_clkcon_enable,
102 .ctrlbit = S3C2410_CLKCON_SDI, 100 .ctrlbit = S3C2410_CLKCON_SDI,
103 }, { 101 }, {
104 .name = "adc", 102 .name = "adc",
105 .id = -1,
106 .parent = &clk_p, 103 .parent = &clk_p,
107 .enable = s3c2410_clkcon_enable, 104 .enable = s3c2410_clkcon_enable,
108 .ctrlbit = S3C2410_CLKCON_ADC, 105 .ctrlbit = S3C2410_CLKCON_ADC,
109 }, { 106 }, {
110 .name = "i2c", 107 .name = "i2c",
111 .id = -1,
112 .parent = &clk_p, 108 .parent = &clk_p,
113 .enable = s3c2410_clkcon_enable, 109 .enable = s3c2410_clkcon_enable,
114 .ctrlbit = S3C2410_CLKCON_IIC, 110 .ctrlbit = S3C2410_CLKCON_IIC,
115 }, { 111 }, {
116 .name = "iis", 112 .name = "iis",
117 .id = -1,
118 .parent = &clk_p, 113 .parent = &clk_p,
119 .enable = s3c2410_clkcon_enable, 114 .enable = s3c2410_clkcon_enable,
120 .ctrlbit = S3C2410_CLKCON_IIS, 115 .ctrlbit = S3C2410_CLKCON_IIS,
121 }, { 116 }, {
122 .name = "spi", 117 .name = "spi",
123 .id = -1,
124 .parent = &clk_p, 118 .parent = &clk_p,
125 .enable = s3c2410_clkcon_enable, 119 .enable = s3c2410_clkcon_enable,
126 .ctrlbit = S3C2410_CLKCON_SPI, 120 .ctrlbit = S3C2410_CLKCON_SPI,
@@ -130,70 +124,61 @@ static struct clk init_clocks_off[] = {
130static struct clk init_clocks[] = { 124static struct clk init_clocks[] = {
131 { 125 {
132 .name = "lcd", 126 .name = "lcd",
133 .id = -1,
134 .parent = &clk_h, 127 .parent = &clk_h,
135 .enable = s3c2410_clkcon_enable, 128 .enable = s3c2410_clkcon_enable,
136 .ctrlbit = S3C2410_CLKCON_LCDC, 129 .ctrlbit = S3C2410_CLKCON_LCDC,
137 }, { 130 }, {
138 .name = "gpio", 131 .name = "gpio",
139 .id = -1,
140 .parent = &clk_p, 132 .parent = &clk_p,
141 .enable = s3c2410_clkcon_enable, 133 .enable = s3c2410_clkcon_enable,
142 .ctrlbit = S3C2410_CLKCON_GPIO, 134 .ctrlbit = S3C2410_CLKCON_GPIO,
143 }, { 135 }, {
144 .name = "usb-host", 136 .name = "usb-host",
145 .id = -1,
146 .parent = &clk_h, 137 .parent = &clk_h,
147 .enable = s3c2410_clkcon_enable, 138 .enable = s3c2410_clkcon_enable,
148 .ctrlbit = S3C2410_CLKCON_USBH, 139 .ctrlbit = S3C2410_CLKCON_USBH,
149 }, { 140 }, {
150 .name = "usb-device", 141 .name = "usb-device",
151 .id = -1,
152 .parent = &clk_h, 142 .parent = &clk_h,
153 .enable = s3c2410_clkcon_enable, 143 .enable = s3c2410_clkcon_enable,
154 .ctrlbit = S3C2410_CLKCON_USBD, 144 .ctrlbit = S3C2410_CLKCON_USBD,
155 }, { 145 }, {
156 .name = "timers", 146 .name = "timers",
157 .id = -1,
158 .parent = &clk_p, 147 .parent = &clk_p,
159 .enable = s3c2410_clkcon_enable, 148 .enable = s3c2410_clkcon_enable,
160 .ctrlbit = S3C2410_CLKCON_PWMT, 149 .ctrlbit = S3C2410_CLKCON_PWMT,
161 }, { 150 }, {
162 .name = "uart", 151 .name = "uart",
163 .id = 0, 152 .devname = "s3c2410-uart.0",
164 .parent = &clk_p, 153 .parent = &clk_p,
165 .enable = s3c2410_clkcon_enable, 154 .enable = s3c2410_clkcon_enable,
166 .ctrlbit = S3C2410_CLKCON_UART0, 155 .ctrlbit = S3C2410_CLKCON_UART0,
167 }, { 156 }, {
168 .name = "uart", 157 .name = "uart",
169 .id = 1, 158 .devname = "s3c2410-uart.1",
170 .parent = &clk_p, 159 .parent = &clk_p,
171 .enable = s3c2410_clkcon_enable, 160 .enable = s3c2410_clkcon_enable,
172 .ctrlbit = S3C2410_CLKCON_UART1, 161 .ctrlbit = S3C2410_CLKCON_UART1,
173 }, { 162 }, {
174 .name = "uart", 163 .name = "uart",
175 .id = 2, 164 .devname = "s3c2410-uart.2",
176 .parent = &clk_p, 165 .parent = &clk_p,
177 .enable = s3c2410_clkcon_enable, 166 .enable = s3c2410_clkcon_enable,
178 .ctrlbit = S3C2410_CLKCON_UART2, 167 .ctrlbit = S3C2410_CLKCON_UART2,
179 }, { 168 }, {
180 .name = "rtc", 169 .name = "rtc",
181 .id = -1,
182 .parent = &clk_p, 170 .parent = &clk_p,
183 .enable = s3c2410_clkcon_enable, 171 .enable = s3c2410_clkcon_enable,
184 .ctrlbit = S3C2410_CLKCON_RTC, 172 .ctrlbit = S3C2410_CLKCON_RTC,
185 }, { 173 }, {
186 .name = "watchdog", 174 .name = "watchdog",
187 .id = -1,
188 .parent = &clk_p, 175 .parent = &clk_p,
189 .ctrlbit = 0, 176 .ctrlbit = 0,
190 }, { 177 }, {
191 .name = "usb-bus-host", 178 .name = "usb-bus-host",
192 .id = -1,
193 .parent = &clk_usb_bus, 179 .parent = &clk_usb_bus,
194 }, { 180 }, {
195 .name = "usb-bus-gadget", 181 .name = "usb-bus-gadget",
196 .id = -1,
197 .parent = &clk_usb_bus, 182 .parent = &clk_usb_bus,
198 }, 183 },
199}; 184};
diff --git a/arch/arm/plat-s3c24xx/s3c2443-clock.c b/arch/arm/plat-s3c24xx/s3c2443-clock.c
index 82f2d4a39291..59552c0ea5fb 100644
--- a/arch/arm/plat-s3c24xx/s3c2443-clock.c
+++ b/arch/arm/plat-s3c24xx/s3c2443-clock.c
@@ -56,7 +56,6 @@ int s3c2443_clkcon_enable_s(struct clk *clk, int enable)
56struct clk clk_mpllref = { 56struct clk clk_mpllref = {
57 .name = "mpllref", 57 .name = "mpllref",
58 .parent = &clk_xtal, 58 .parent = &clk_xtal,
59 .id = -1,
60}; 59};
61 60
62static struct clk *clk_epllref_sources[] = { 61static struct clk *clk_epllref_sources[] = {
@@ -69,7 +68,6 @@ static struct clk *clk_epllref_sources[] = {
69struct clksrc_clk clk_epllref = { 68struct clksrc_clk clk_epllref = {
70 .clk = { 69 .clk = {
71 .name = "epllref", 70 .name = "epllref",
72 .id = -1,
73 }, 71 },
74 .sources = &(struct clksrc_sources) { 72 .sources = &(struct clksrc_sources) {
75 .sources = clk_epllref_sources, 73 .sources = clk_epllref_sources,
@@ -92,7 +90,6 @@ struct clksrc_clk clk_esysclk = {
92 .clk = { 90 .clk = {
93 .name = "esysclk", 91 .name = "esysclk",
94 .parent = &clk_epll, 92 .parent = &clk_epll,
95 .id = -1,
96 }, 93 },
97 .sources = &(struct clksrc_sources) { 94 .sources = &(struct clksrc_sources) {
98 .sources = clk_sysclk_sources, 95 .sources = clk_sysclk_sources,
@@ -115,7 +112,6 @@ static unsigned long s3c2443_getrate_mdivclk(struct clk *clk)
115static struct clk clk_mdivclk = { 112static struct clk clk_mdivclk = {
116 .name = "mdivclk", 113 .name = "mdivclk",
117 .parent = &clk_mpllref, 114 .parent = &clk_mpllref,
118 .id = -1,
119 .ops = &(struct clk_ops) { 115 .ops = &(struct clk_ops) {
120 .get_rate = s3c2443_getrate_mdivclk, 116 .get_rate = s3c2443_getrate_mdivclk,
121 }, 117 },
@@ -132,7 +128,6 @@ struct clksrc_clk clk_msysclk = {
132 .clk = { 128 .clk = {
133 .name = "msysclk", 129 .name = "msysclk",
134 .parent = &clk_xtal, 130 .parent = &clk_xtal,
135 .id = -1,
136 }, 131 },
137 .sources = &(struct clksrc_sources) { 132 .sources = &(struct clksrc_sources) {
138 .sources = clk_msysclk_sources, 133 .sources = clk_msysclk_sources,
@@ -159,7 +154,6 @@ static unsigned long s3c2443_prediv_getrate(struct clk *clk)
159 154
160static struct clk clk_prediv = { 155static struct clk clk_prediv = {
161 .name = "prediv", 156 .name = "prediv",
162 .id = -1,
163 .parent = &clk_msysclk.clk, 157 .parent = &clk_msysclk.clk,
164 .ops = &(struct clk_ops) { 158 .ops = &(struct clk_ops) {
165 .get_rate = s3c2443_prediv_getrate, 159 .get_rate = s3c2443_prediv_getrate,
@@ -174,7 +168,6 @@ static struct clk clk_prediv = {
174static struct clksrc_clk clk_usb_bus_host = { 168static struct clksrc_clk clk_usb_bus_host = {
175 .clk = { 169 .clk = {
176 .name = "usb-bus-host-parent", 170 .name = "usb-bus-host-parent",
177 .id = -1,
178 .parent = &clk_esysclk.clk, 171 .parent = &clk_esysclk.clk,
179 .ctrlbit = S3C2443_SCLKCON_USBHOST, 172 .ctrlbit = S3C2443_SCLKCON_USBHOST,
180 .enable = s3c2443_clkcon_enable_s, 173 .enable = s3c2443_clkcon_enable_s,
@@ -189,7 +182,6 @@ static struct clksrc_clk clksrc_clks[] = {
189 /* ART baud-rate clock sourced from esysclk via a divisor */ 182 /* ART baud-rate clock sourced from esysclk via a divisor */
190 .clk = { 183 .clk = {
191 .name = "uartclk", 184 .name = "uartclk",
192 .id = -1,
193 .parent = &clk_esysclk.clk, 185 .parent = &clk_esysclk.clk,
194 }, 186 },
195 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 8 }, 187 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 8 },
@@ -197,7 +189,6 @@ static struct clksrc_clk clksrc_clks[] = {
197 /* camera interface bus-clock, divided down from esysclk */ 189 /* camera interface bus-clock, divided down from esysclk */
198 .clk = { 190 .clk = {
199 .name = "camif-upll", /* same as 2440 name */ 191 .name = "camif-upll", /* same as 2440 name */
200 .id = -1,
201 .parent = &clk_esysclk.clk, 192 .parent = &clk_esysclk.clk,
202 .ctrlbit = S3C2443_SCLKCON_CAMCLK, 193 .ctrlbit = S3C2443_SCLKCON_CAMCLK,
203 .enable = s3c2443_clkcon_enable_s, 194 .enable = s3c2443_clkcon_enable_s,
@@ -206,7 +197,6 @@ static struct clksrc_clk clksrc_clks[] = {
206 }, { 197 }, {
207 .clk = { 198 .clk = {
208 .name = "display-if", 199 .name = "display-if",
209 .id = -1,
210 .parent = &clk_esysclk.clk, 200 .parent = &clk_esysclk.clk,
211 .ctrlbit = S3C2443_SCLKCON_DISPCLK, 201 .ctrlbit = S3C2443_SCLKCON_DISPCLK,
212 .enable = s3c2443_clkcon_enable_s, 202 .enable = s3c2443_clkcon_enable_s,
@@ -219,13 +209,11 @@ static struct clksrc_clk clksrc_clks[] = {
219static struct clk init_clocks_off[] = { 209static struct clk init_clocks_off[] = {
220 { 210 {
221 .name = "adc", 211 .name = "adc",
222 .id = -1,
223 .parent = &clk_p, 212 .parent = &clk_p,
224 .enable = s3c2443_clkcon_enable_p, 213 .enable = s3c2443_clkcon_enable_p,
225 .ctrlbit = S3C2443_PCLKCON_ADC, 214 .ctrlbit = S3C2443_PCLKCON_ADC,
226 }, { 215 }, {
227 .name = "i2c", 216 .name = "i2c",
228 .id = -1,
229 .parent = &clk_p, 217 .parent = &clk_p,
230 .enable = s3c2443_clkcon_enable_p, 218 .enable = s3c2443_clkcon_enable_p,
231 .ctrlbit = S3C2443_PCLKCON_IIC, 219 .ctrlbit = S3C2443_PCLKCON_IIC,
@@ -235,136 +223,117 @@ static struct clk init_clocks_off[] = {
235static struct clk init_clocks[] = { 223static struct clk init_clocks[] = {
236 { 224 {
237 .name = "dma", 225 .name = "dma",
238 .id = 0,
239 .parent = &clk_h, 226 .parent = &clk_h,
240 .enable = s3c2443_clkcon_enable_h, 227 .enable = s3c2443_clkcon_enable_h,
241 .ctrlbit = S3C2443_HCLKCON_DMA0, 228 .ctrlbit = S3C2443_HCLKCON_DMA0,
242 }, { 229 }, {
243 .name = "dma", 230 .name = "dma",
244 .id = 1,
245 .parent = &clk_h, 231 .parent = &clk_h,
246 .enable = s3c2443_clkcon_enable_h, 232 .enable = s3c2443_clkcon_enable_h,
247 .ctrlbit = S3C2443_HCLKCON_DMA1, 233 .ctrlbit = S3C2443_HCLKCON_DMA1,
248 }, { 234 }, {
249 .name = "dma", 235 .name = "dma",
250 .id = 2,
251 .parent = &clk_h, 236 .parent = &clk_h,
252 .enable = s3c2443_clkcon_enable_h, 237 .enable = s3c2443_clkcon_enable_h,
253 .ctrlbit = S3C2443_HCLKCON_DMA2, 238 .ctrlbit = S3C2443_HCLKCON_DMA2,
254 }, { 239 }, {
255 .name = "dma", 240 .name = "dma",
256 .id = 3,
257 .parent = &clk_h, 241 .parent = &clk_h,
258 .enable = s3c2443_clkcon_enable_h, 242 .enable = s3c2443_clkcon_enable_h,
259 .ctrlbit = S3C2443_HCLKCON_DMA3, 243 .ctrlbit = S3C2443_HCLKCON_DMA3,
260 }, { 244 }, {
261 .name = "dma", 245 .name = "dma",
262 .id = 4,
263 .parent = &clk_h, 246 .parent = &clk_h,
264 .enable = s3c2443_clkcon_enable_h, 247 .enable = s3c2443_clkcon_enable_h,
265 .ctrlbit = S3C2443_HCLKCON_DMA4, 248 .ctrlbit = S3C2443_HCLKCON_DMA4,
266 }, { 249 }, {
267 .name = "dma", 250 .name = "dma",
268 .id = 5,
269 .parent = &clk_h, 251 .parent = &clk_h,
270 .enable = s3c2443_clkcon_enable_h, 252 .enable = s3c2443_clkcon_enable_h,
271 .ctrlbit = S3C2443_HCLKCON_DMA5, 253 .ctrlbit = S3C2443_HCLKCON_DMA5,
272 }, { 254 }, {
273 .name = "hsmmc", 255 .name = "hsmmc",
274 .id = 1,
275 .parent = &clk_h, 256 .parent = &clk_h,
276 .enable = s3c2443_clkcon_enable_h, 257 .enable = s3c2443_clkcon_enable_h,
277 .ctrlbit = S3C2443_HCLKCON_HSMMC, 258 .ctrlbit = S3C2443_HCLKCON_HSMMC,
278 }, { 259 }, {
279 .name = "gpio", 260 .name = "gpio",
280 .id = -1,
281 .parent = &clk_p, 261 .parent = &clk_p,
282 .enable = s3c2443_clkcon_enable_p, 262 .enable = s3c2443_clkcon_enable_p,
283 .ctrlbit = S3C2443_PCLKCON_GPIO, 263 .ctrlbit = S3C2443_PCLKCON_GPIO,
284 }, { 264 }, {
285 .name = "usb-host", 265 .name = "usb-host",
286 .id = -1,
287 .parent = &clk_h, 266 .parent = &clk_h,
288 .enable = s3c2443_clkcon_enable_h, 267 .enable = s3c2443_clkcon_enable_h,
289 .ctrlbit = S3C2443_HCLKCON_USBH, 268 .ctrlbit = S3C2443_HCLKCON_USBH,
290 }, { 269 }, {
291 .name = "usb-device", 270 .name = "usb-device",
292 .id = -1,
293 .parent = &clk_h, 271 .parent = &clk_h,
294 .enable = s3c2443_clkcon_enable_h, 272 .enable = s3c2443_clkcon_enable_h,
295 .ctrlbit = S3C2443_HCLKCON_USBD, 273 .ctrlbit = S3C2443_HCLKCON_USBD,
296 }, { 274 }, {
297 .name = "lcd", 275 .name = "lcd",
298 .id = -1,
299 .parent = &clk_h, 276 .parent = &clk_h,
300 .enable = s3c2443_clkcon_enable_h, 277 .enable = s3c2443_clkcon_enable_h,
301 .ctrlbit = S3C2443_HCLKCON_LCDC, 278 .ctrlbit = S3C2443_HCLKCON_LCDC,
302 279
303 }, { 280 }, {
304 .name = "timers", 281 .name = "timers",
305 .id = -1,
306 .parent = &clk_p, 282 .parent = &clk_p,
307 .enable = s3c2443_clkcon_enable_p, 283 .enable = s3c2443_clkcon_enable_p,
308 .ctrlbit = S3C2443_PCLKCON_PWMT, 284 .ctrlbit = S3C2443_PCLKCON_PWMT,
309 }, { 285 }, {
310 .name = "cfc", 286 .name = "cfc",
311 .id = -1,
312 .parent = &clk_h, 287 .parent = &clk_h,
313 .enable = s3c2443_clkcon_enable_h, 288 .enable = s3c2443_clkcon_enable_h,
314 .ctrlbit = S3C2443_HCLKCON_CFC, 289 .ctrlbit = S3C2443_HCLKCON_CFC,
315 }, { 290 }, {
316 .name = "ssmc", 291 .name = "ssmc",
317 .id = -1,
318 .parent = &clk_h, 292 .parent = &clk_h,
319 .enable = s3c2443_clkcon_enable_h, 293 .enable = s3c2443_clkcon_enable_h,
320 .ctrlbit = S3C2443_HCLKCON_SSMC, 294 .ctrlbit = S3C2443_HCLKCON_SSMC,
321 }, { 295 }, {
322 .name = "uart", 296 .name = "uart",
323 .id = 0, 297 .devname = "s3c2440-uart.0",
324 .parent = &clk_p, 298 .parent = &clk_p,
325 .enable = s3c2443_clkcon_enable_p, 299 .enable = s3c2443_clkcon_enable_p,
326 .ctrlbit = S3C2443_PCLKCON_UART0, 300 .ctrlbit = S3C2443_PCLKCON_UART0,
327 }, { 301 }, {
328 .name = "uart", 302 .name = "uart",
329 .id = 1, 303 .devname = "s3c2440-uart.1",
330 .parent = &clk_p, 304 .parent = &clk_p,
331 .enable = s3c2443_clkcon_enable_p, 305 .enable = s3c2443_clkcon_enable_p,
332 .ctrlbit = S3C2443_PCLKCON_UART1, 306 .ctrlbit = S3C2443_PCLKCON_UART1,
333 }, { 307 }, {
334 .name = "uart", 308 .name = "uart",
335 .id = 2, 309 .devname = "s3c2440-uart.2",
336 .parent = &clk_p, 310 .parent = &clk_p,
337 .enable = s3c2443_clkcon_enable_p, 311 .enable = s3c2443_clkcon_enable_p,
338 .ctrlbit = S3C2443_PCLKCON_UART2, 312 .ctrlbit = S3C2443_PCLKCON_UART2,
339 }, { 313 }, {
340 .name = "uart", 314 .name = "uart",
341 .id = 3, 315 .devname = "s3c2440-uart.3",
342 .parent = &clk_p, 316 .parent = &clk_p,
343 .enable = s3c2443_clkcon_enable_p, 317 .enable = s3c2443_clkcon_enable_p,
344 .ctrlbit = S3C2443_PCLKCON_UART3, 318 .ctrlbit = S3C2443_PCLKCON_UART3,
345 }, { 319 }, {
346 .name = "rtc", 320 .name = "rtc",
347 .id = -1,
348 .parent = &clk_p, 321 .parent = &clk_p,
349 .enable = s3c2443_clkcon_enable_p, 322 .enable = s3c2443_clkcon_enable_p,
350 .ctrlbit = S3C2443_PCLKCON_RTC, 323 .ctrlbit = S3C2443_PCLKCON_RTC,
351 }, { 324 }, {
352 .name = "watchdog", 325 .name = "watchdog",
353 .id = -1,
354 .parent = &clk_p, 326 .parent = &clk_p,
355 .ctrlbit = S3C2443_PCLKCON_WDT, 327 .ctrlbit = S3C2443_PCLKCON_WDT,
356 }, { 328 }, {
357 .name = "ac97", 329 .name = "ac97",
358 .id = -1,
359 .parent = &clk_p, 330 .parent = &clk_p,
360 .ctrlbit = S3C2443_PCLKCON_AC97, 331 .ctrlbit = S3C2443_PCLKCON_AC97,
361 }, { 332 }, {
362 .name = "nand", 333 .name = "nand",
363 .id = -1,
364 .parent = &clk_h, 334 .parent = &clk_h,
365 }, { 335 }, {
366 .name = "usb-bus-host", 336 .name = "usb-bus-host",
367 .id = -1,
368 .parent = &clk_usb_bus_host.clk, 337 .parent = &clk_usb_bus_host.clk,
369 } 338 }
370}; 339};
diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c
index 8d081d968c58..02af235298e2 100644
--- a/arch/arm/plat-s5p/clock.c
+++ b/arch/arm/plat-s5p/clock.c
@@ -168,6 +168,41 @@ unsigned long s5p_epll_get_rate(struct clk *clk)
168 return clk->rate; 168 return clk->rate;
169} 169}
170 170
171int s5p_spdif_set_rate(struct clk *clk, unsigned long rate)
172{
173 struct clk *pclk;
174 int ret;
175
176 pclk = clk_get_parent(clk);
177 if (IS_ERR(pclk))
178 return -EINVAL;
179
180 ret = pclk->ops->set_rate(pclk, rate);
181 clk_put(pclk);
182
183 return ret;
184}
185
186unsigned long s5p_spdif_get_rate(struct clk *clk)
187{
188 struct clk *pclk;
189 int rate;
190
191 pclk = clk_get_parent(clk);
192 if (IS_ERR(pclk))
193 return -EINVAL;
194
195 rate = pclk->ops->get_rate(clk);
196 clk_put(pclk);
197
198 return rate;
199}
200
201struct clk_ops s5p_sclk_spdif_ops = {
202 .set_rate = s5p_spdif_set_rate,
203 .get_rate = s5p_spdif_get_rate,
204};
205
171static struct clk *s5p_clks[] __initdata = { 206static struct clk *s5p_clks[] __initdata = {
172 &clk_ext_xtal_mux, 207 &clk_ext_xtal_mux,
173 &clk_48m, 208 &clk_48m,
diff --git a/arch/arm/plat-s5p/include/plat/s5p-clock.h b/arch/arm/plat-s5p/include/plat/s5p-clock.h
index 2b6dcff8ab2b..769b5bdfb046 100644
--- a/arch/arm/plat-s5p/include/plat/s5p-clock.h
+++ b/arch/arm/plat-s5p/include/plat/s5p-clock.h
@@ -47,4 +47,9 @@ extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable);
47extern int s5p_epll_enable(struct clk *clk, int enable); 47extern int s5p_epll_enable(struct clk *clk, int enable);
48extern unsigned long s5p_epll_get_rate(struct clk *clk); 48extern unsigned long s5p_epll_get_rate(struct clk *clk);
49 49
50/* SPDIF clk operations common for S5PC100/V210/C110 and Exynos4 */
51extern int s5p_spdif_set_rate(struct clk *clk, unsigned long rate);
52extern unsigned long s5p_spdif_get_rate(struct clk *clk);
53
54extern struct clk_ops s5p_sclk_spdif_ops;
50#endif /* __ASM_PLAT_S5P_CLOCK_H */ 55#endif /* __ASM_PLAT_S5P_CLOCK_H */
diff --git a/arch/arm/plat-s5p/s5p-time.c b/arch/arm/plat-s5p/s5p-time.c
index 899a8cc011ff..c833e7b57599 100644
--- a/arch/arm/plat-s5p/s5p-time.c
+++ b/arch/arm/plat-s5p/s5p-time.c
@@ -314,13 +314,6 @@ static void __iomem *s5p_timer_reg(void)
314 return S3C_TIMERREG(offset); 314 return S3C_TIMERREG(offset);
315} 315}
316 316
317static cycle_t s5p_timer_read(struct clocksource *cs)
318{
319 void __iomem *reg = s5p_timer_reg();
320
321 return (cycle_t) (reg ? ~__raw_readl(reg) : 0);
322}
323
324/* 317/*
325 * Override the global weak sched_clock symbol with this 318 * Override the global weak sched_clock symbol with this
326 * local implementation which uses the clocksource to get some 319 * local implementation which uses the clocksource to get some
@@ -350,14 +343,6 @@ static void notrace s5p_update_sched_clock(void)
350 update_sched_clock(&cd, ~__raw_readl(reg), (u32)~0); 343 update_sched_clock(&cd, ~__raw_readl(reg), (u32)~0);
351} 344}
352 345
353struct clocksource time_clocksource = {
354 .name = "s5p_clocksource_timer",
355 .rating = 250,
356 .read = s5p_timer_read,
357 .mask = CLOCKSOURCE_MASK(32),
358 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
359};
360
361static void __init s5p_clocksource_init(void) 346static void __init s5p_clocksource_init(void)
362{ 347{
363 unsigned long pclk; 348 unsigned long pclk;
@@ -370,13 +355,14 @@ static void __init s5p_clocksource_init(void)
370 355
371 clock_rate = clk_get_rate(tin_source); 356 clock_rate = clk_get_rate(tin_source);
372 357
373 init_sched_clock(&cd, s5p_update_sched_clock, 32, clock_rate);
374
375 s5p_time_setup(timer_source.source_id, TCNT_MAX); 358 s5p_time_setup(timer_source.source_id, TCNT_MAX);
376 s5p_time_start(timer_source.source_id, PERIODIC); 359 s5p_time_start(timer_source.source_id, PERIODIC);
377 360
378 if (clocksource_register_hz(&time_clocksource, clock_rate)) 361 init_sched_clock(&cd, s5p_update_sched_clock, 32, clock_rate);
379 panic("%s: can't register clocksource\n", time_clocksource.name); 362
363 if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
364 clock_rate, 250, 32, clocksource_mmio_readl_down))
365 panic("s5p_clocksource_timer: can't register clocksource\n");
380} 366}
381 367
382static void __init s5p_timer_resources(void) 368static void __init s5p_timer_resources(void)
@@ -384,6 +370,7 @@ static void __init s5p_timer_resources(void)
384 370
385 unsigned long event_id = timer_source.event_id; 371 unsigned long event_id = timer_source.event_id;
386 unsigned long source_id = timer_source.source_id; 372 unsigned long source_id = timer_source.source_id;
373 char devname[15];
387 374
388 timerclk = clk_get(NULL, "timers"); 375 timerclk = clk_get(NULL, "timers");
389 if (IS_ERR(timerclk)) 376 if (IS_ERR(timerclk))
@@ -391,6 +378,10 @@ static void __init s5p_timer_resources(void)
391 378
392 clk_enable(timerclk); 379 clk_enable(timerclk);
393 380
381 sprintf(devname, "s3c24xx-pwm.%lu", event_id);
382 s3c_device_timer[event_id].id = event_id;
383 s3c_device_timer[event_id].dev.init_name = devname;
384
394 tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin"); 385 tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
395 if (IS_ERR(tin_event)) 386 if (IS_ERR(tin_event))
396 panic("failed to get pwm-tin clock for event timer"); 387 panic("failed to get pwm-tin clock for event timer");
@@ -401,6 +392,10 @@ static void __init s5p_timer_resources(void)
401 392
402 clk_enable(tin_event); 393 clk_enable(tin_event);
403 394
395 sprintf(devname, "s3c24xx-pwm.%lu", source_id);
396 s3c_device_timer[source_id].id = source_id;
397 s3c_device_timer[source_id].dev.init_name = devname;
398
404 tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin"); 399 tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
405 if (IS_ERR(tin_source)) 400 if (IS_ERR(tin_source))
406 panic("failed to get pwm-tin clock for source timer"); 401 panic("failed to get pwm-tin clock for source timer");
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 4d79519d19a4..b3e10659e4b8 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -280,6 +280,12 @@ config SAMSUNG_DEV_PWM
280 help 280 help
281 Compile in platform device definition for PWM Timer 281 Compile in platform device definition for PWM Timer
282 282
283config SAMSUNG_DEV_BACKLIGHT
284 bool
285 depends on SAMSUNG_DEV_PWM
286 help
287 Compile in platform device definition LCD backlight with PWM Timer
288
283config S3C24XX_PWM 289config S3C24XX_PWM
284 bool "PWM device support" 290 bool "PWM device support"
285 select HAVE_PWM 291 select HAVE_PWM
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 53eb15b0a07d..853764ba8cc5 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_SAMSUNG_DEV_IDE) += dev-ide.o
59obj-$(CONFIG_SAMSUNG_DEV_TS) += dev-ts.o 59obj-$(CONFIG_SAMSUNG_DEV_TS) += dev-ts.o
60obj-$(CONFIG_SAMSUNG_DEV_KEYPAD) += dev-keypad.o 60obj-$(CONFIG_SAMSUNG_DEV_KEYPAD) += dev-keypad.o
61obj-$(CONFIG_SAMSUNG_DEV_PWM) += dev-pwm.o 61obj-$(CONFIG_SAMSUNG_DEV_PWM) += dev-pwm.o
62obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o
62 63
63# DMA support 64# DMA support
64 65
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index 772892826ffc..aecf9e90d4fc 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -71,74 +71,6 @@ static int clk_null_enable(struct clk *clk, int enable)
71 return 0; 71 return 0;
72} 72}
73 73
74static int dev_is_s3c_uart(struct device *dev)
75{
76 struct platform_device **pdev = s3c24xx_uart_devs;
77 int i;
78 for (i = 0; i < ARRAY_SIZE(s3c24xx_uart_devs); i++, pdev++)
79 if (*pdev && dev == &(*pdev)->dev)
80 return 1;
81 return 0;
82}
83
84/*
85 * Serial drivers call get_clock() very early, before platform bus
86 * has been set up, this requires a special check to let them get
87 * a proper clock
88 */
89
90static int dev_is_platform_device(struct device *dev)
91{
92 return dev->bus == &platform_bus_type ||
93 (dev->bus == NULL && dev_is_s3c_uart(dev));
94}
95
96/* Clock API calls */
97
98struct clk *clk_get(struct device *dev, const char *id)
99{
100 struct clk *p;
101 struct clk *clk = ERR_PTR(-ENOENT);
102 int idno;
103
104 if (dev == NULL || !dev_is_platform_device(dev))
105 idno = -1;
106 else
107 idno = to_platform_device(dev)->id;
108
109 spin_lock(&clocks_lock);
110
111 list_for_each_entry(p, &clocks, list) {
112 if (p->id == idno &&
113 strcmp(id, p->name) == 0 &&
114 try_module_get(p->owner)) {
115 clk = p;
116 break;
117 }
118 }
119
120 /* check for the case where a device was supplied, but the
121 * clock that was being searched for is not device specific */
122
123 if (IS_ERR(clk)) {
124 list_for_each_entry(p, &clocks, list) {
125 if (p->id == -1 && strcmp(id, p->name) == 0 &&
126 try_module_get(p->owner)) {
127 clk = p;
128 break;
129 }
130 }
131 }
132
133 spin_unlock(&clocks_lock);
134 return clk;
135}
136
137void clk_put(struct clk *clk)
138{
139 module_put(clk->owner);
140}
141
142int clk_enable(struct clk *clk) 74int clk_enable(struct clk *clk)
143{ 75{
144 if (IS_ERR(clk) || clk == NULL) 76 if (IS_ERR(clk) || clk == NULL)
@@ -241,8 +173,6 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
241 return ret; 173 return ret;
242} 174}
243 175
244EXPORT_SYMBOL(clk_get);
245EXPORT_SYMBOL(clk_put);
246EXPORT_SYMBOL(clk_enable); 176EXPORT_SYMBOL(clk_enable);
247EXPORT_SYMBOL(clk_disable); 177EXPORT_SYMBOL(clk_disable);
248EXPORT_SYMBOL(clk_get_rate); 178EXPORT_SYMBOL(clk_get_rate);
@@ -265,7 +195,6 @@ struct clk_ops clk_ops_def_setrate = {
265 195
266struct clk clk_xtal = { 196struct clk clk_xtal = {
267 .name = "xtal", 197 .name = "xtal",
268 .id = -1,
269 .rate = 0, 198 .rate = 0,
270 .parent = NULL, 199 .parent = NULL,
271 .ctrlbit = 0, 200 .ctrlbit = 0,
@@ -273,30 +202,25 @@ struct clk clk_xtal = {
273 202
274struct clk clk_ext = { 203struct clk clk_ext = {
275 .name = "ext", 204 .name = "ext",
276 .id = -1,
277}; 205};
278 206
279struct clk clk_epll = { 207struct clk clk_epll = {
280 .name = "epll", 208 .name = "epll",
281 .id = -1,
282}; 209};
283 210
284struct clk clk_mpll = { 211struct clk clk_mpll = {
285 .name = "mpll", 212 .name = "mpll",
286 .id = -1,
287 .ops = &clk_ops_def_setrate, 213 .ops = &clk_ops_def_setrate,
288}; 214};
289 215
290struct clk clk_upll = { 216struct clk clk_upll = {
291 .name = "upll", 217 .name = "upll",
292 .id = -1,
293 .parent = NULL, 218 .parent = NULL,
294 .ctrlbit = 0, 219 .ctrlbit = 0,
295}; 220};
296 221
297struct clk clk_f = { 222struct clk clk_f = {
298 .name = "fclk", 223 .name = "fclk",
299 .id = -1,
300 .rate = 0, 224 .rate = 0,
301 .parent = &clk_mpll, 225 .parent = &clk_mpll,
302 .ctrlbit = 0, 226 .ctrlbit = 0,
@@ -304,7 +228,6 @@ struct clk clk_f = {
304 228
305struct clk clk_h = { 229struct clk clk_h = {
306 .name = "hclk", 230 .name = "hclk",
307 .id = -1,
308 .rate = 0, 231 .rate = 0,
309 .parent = NULL, 232 .parent = NULL,
310 .ctrlbit = 0, 233 .ctrlbit = 0,
@@ -313,7 +236,6 @@ struct clk clk_h = {
313 236
314struct clk clk_p = { 237struct clk clk_p = {
315 .name = "pclk", 238 .name = "pclk",
316 .id = -1,
317 .rate = 0, 239 .rate = 0,
318 .parent = NULL, 240 .parent = NULL,
319 .ctrlbit = 0, 241 .ctrlbit = 0,
@@ -322,7 +244,6 @@ struct clk clk_p = {
322 244
323struct clk clk_usb_bus = { 245struct clk clk_usb_bus = {
324 .name = "usb-bus", 246 .name = "usb-bus",
325 .id = -1,
326 .rate = 0, 247 .rate = 0,
327 .parent = &clk_upll, 248 .parent = &clk_upll,
328}; 249};
@@ -330,7 +251,6 @@ struct clk clk_usb_bus = {
330 251
331struct clk s3c24xx_uclk = { 252struct clk s3c24xx_uclk = {
332 .name = "uclk", 253 .name = "uclk",
333 .id = -1,
334}; 254};
335 255
336/* initialise the clock system */ 256/* initialise the clock system */
@@ -346,14 +266,11 @@ int s3c24xx_register_clock(struct clk *clk)
346 if (clk->enable == NULL) 266 if (clk->enable == NULL)
347 clk->enable = clk_null_enable; 267 clk->enable = clk_null_enable;
348 268
349 /* add to the list of available clocks */ 269 /* fill up the clk_lookup structure and register it*/
350 270 clk->lookup.dev_id = clk->devname;
351 /* Quick check to see if this clock has already been registered. */ 271 clk->lookup.con_id = clk->name;
352 BUG_ON(clk->list.prev != clk->list.next); 272 clk->lookup.clk = clk;
353 273 clkdev_add(&clk->lookup);
354 spin_lock(&clocks_lock);
355 list_add(&clk->list, &clocks);
356 spin_unlock(&clocks_lock);
357 274
358 return 0; 275 return 0;
359} 276}
@@ -463,10 +380,7 @@ static int clk_debugfs_register_one(struct clk *c)
463 char s[255]; 380 char s[255];
464 char *p = s; 381 char *p = s;
465 382
466 p += sprintf(p, "%s", c->name); 383 p += sprintf(p, "%s", c->devname);
467
468 if (c->id >= 0)
469 sprintf(p, ":%d", c->id);
470 384
471 d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root); 385 d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
472 if (!d) 386 if (!d)
diff --git a/arch/arm/plat-samsung/dev-backlight.c b/arch/arm/plat-samsung/dev-backlight.c
new file mode 100644
index 000000000000..3cedd4c407af
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-backlight.c
@@ -0,0 +1,149 @@
1/* linux/arch/arm/plat-samsung/dev-backlight.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Common infrastructure for PWM Backlight for Samsung boards
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/gpio.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/pwm_backlight.h>
17
18#include <plat/devs.h>
19#include <plat/gpio-cfg.h>
20#include <plat/backlight.h>
21
22static int samsung_bl_init(struct device *dev)
23{
24 int ret = 0;
25 struct platform_device *timer_dev =
26 container_of(dev->parent, struct platform_device, dev);
27 struct samsung_bl_gpio_info *bl_gpio_info =
28 timer_dev->dev.platform_data;
29
30 ret = gpio_request(bl_gpio_info->no, "Backlight");
31 if (ret) {
32 printk(KERN_ERR "failed to request GPIO for LCD Backlight\n");
33 return ret;
34 }
35
36 /* Configure GPIO pin with specific GPIO function for PWM timer */
37 s3c_gpio_cfgpin(bl_gpio_info->no, bl_gpio_info->func);
38
39 return 0;
40}
41
42static void samsung_bl_exit(struct device *dev)
43{
44 struct platform_device *timer_dev =
45 container_of(dev->parent, struct platform_device, dev);
46 struct samsung_bl_gpio_info *bl_gpio_info =
47 timer_dev->dev.platform_data;
48
49 s3c_gpio_cfgpin(bl_gpio_info->no, S3C_GPIO_OUTPUT);
50 gpio_free(bl_gpio_info->no);
51}
52
53/* Initialize few important fields of platform_pwm_backlight_data
54 * structure with default values. These fields can be overridden by
55 * board-specific values sent from machine file.
56 * For ease of operation, these fields are initialized with values
57 * used by most samsung boards.
58 * Users has the option of sending info about other parameters
59 * for their specific boards
60 */
61
62static struct platform_pwm_backlight_data samsung_dfl_bl_data __initdata = {
63 .max_brightness = 255,
64 .dft_brightness = 255,
65 .pwm_period_ns = 78770,
66 .init = samsung_bl_init,
67 .exit = samsung_bl_exit,
68};
69
70static struct platform_device samsung_dfl_bl_device __initdata = {
71 .name = "pwm-backlight",
72};
73
74/* samsung_bl_set - Set board specific data (if any) provided by user for
75 * PWM Backlight control and register specific PWM and backlight device.
76 * @gpio_info: structure containing GPIO info for PWM timer
77 * @bl_data: structure containing Backlight control data
78 */
79void samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
80 struct platform_pwm_backlight_data *bl_data)
81{
82 int ret = 0;
83 struct platform_device *samsung_bl_device;
84 struct platform_pwm_backlight_data *samsung_bl_data;
85
86 samsung_bl_device = kmemdup(&samsung_dfl_bl_device,
87 sizeof(struct platform_device), GFP_KERNEL);
88 if (!samsung_bl_device) {
89 printk(KERN_ERR "%s: no memory for platform dev\n", __func__);
90 return;
91 }
92
93 samsung_bl_data = s3c_set_platdata(&samsung_dfl_bl_data,
94 sizeof(struct platform_pwm_backlight_data), samsung_bl_device);
95 if (!samsung_bl_data) {
96 printk(KERN_ERR "%s: no memory for platform dev\n", __func__);
97 goto err_data;
98 }
99
100 /* Copy board specific data provided by user */
101 samsung_bl_data->pwm_id = bl_data->pwm_id;
102 samsung_bl_device->dev.parent =
103 &s3c_device_timer[samsung_bl_data->pwm_id].dev;
104
105 if (bl_data->max_brightness)
106 samsung_bl_data->max_brightness = bl_data->max_brightness;
107 if (bl_data->dft_brightness)
108 samsung_bl_data->dft_brightness = bl_data->dft_brightness;
109 if (bl_data->lth_brightness)
110 samsung_bl_data->lth_brightness = bl_data->lth_brightness;
111 if (bl_data->pwm_period_ns)
112 samsung_bl_data->pwm_period_ns = bl_data->pwm_period_ns;
113 if (bl_data->init)
114 samsung_bl_data->init = bl_data->init;
115 if (bl_data->notify)
116 samsung_bl_data->notify = bl_data->notify;
117 if (bl_data->exit)
118 samsung_bl_data->exit = bl_data->exit;
119 if (bl_data->check_fb)
120 samsung_bl_data->check_fb = bl_data->check_fb;
121
122 /* Keep the GPIO info for future use */
123 s3c_device_timer[samsung_bl_data->pwm_id].dev.platform_data = gpio_info;
124
125 /* Register the specific PWM timer dev for Backlight control */
126 ret = platform_device_register(
127 &s3c_device_timer[samsung_bl_data->pwm_id]);
128 if (ret) {
129 printk(KERN_ERR "failed to register pwm timer for backlight: %d\n", ret);
130 goto err_plat_reg1;
131 }
132
133 /* Register the Backlight dev */
134 ret = platform_device_register(samsung_bl_device);
135 if (ret) {
136 printk(KERN_ERR "failed to register backlight device: %d\n", ret);
137 goto err_plat_reg2;
138 }
139
140 return;
141
142err_plat_reg2:
143 platform_device_unregister(&s3c_device_timer[samsung_bl_data->pwm_id]);
144err_plat_reg1:
145 kfree(samsung_bl_data);
146err_data:
147 kfree(samsung_bl_device);
148 return;
149}
diff --git a/arch/arm/plat-samsung/dev-fb.c b/arch/arm/plat-samsung/dev-fb.c
index bf60204c6297..49a1362fd25b 100644
--- a/arch/arm/plat-samsung/dev-fb.c
+++ b/arch/arm/plat-samsung/dev-fb.c
@@ -58,16 +58,6 @@ struct platform_device s3c_device_fb = {
58 58
59void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd) 59void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd)
60{ 60{
61 struct s3c_fb_platdata *npd; 61 s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
62 62 &s3c_device_fb);
63 if (!pd) {
64 printk(KERN_ERR "%s: no platform data\n", __func__);
65 return;
66 }
67
68 npd = kmemdup(pd, sizeof(struct s3c_fb_platdata), GFP_KERNEL);
69 if (!npd)
70 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
71
72 s3c_device_fb.dev.platform_data = npd;
73} 63}
diff --git a/arch/arm/plat-samsung/dev-hwmon.c b/arch/arm/plat-samsung/dev-hwmon.c
index b3ffb9587250..c91a79ce8f39 100644
--- a/arch/arm/plat-samsung/dev-hwmon.c
+++ b/arch/arm/plat-samsung/dev-hwmon.c
@@ -27,16 +27,6 @@ struct platform_device s3c_device_hwmon = {
27 27
28void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd) 28void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd)
29{ 29{
30 struct s3c_hwmon_pdata *npd; 30 s3c_set_platdata(pd, sizeof(struct s3c_hwmon_pdata),
31 31 &s3c_device_hwmon);
32 if (!pd) {
33 printk(KERN_ERR "%s: no platform data\n", __func__);
34 return;
35 }
36
37 npd = kmemdup(pd, sizeof(struct s3c_hwmon_pdata), GFP_KERNEL);
38 if (!npd)
39 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
40
41 s3c_device_hwmon.dev.platform_data = npd;
42} 32}
diff --git a/arch/arm/plat-samsung/dev-i2c0.c b/arch/arm/plat-samsung/dev-i2c0.c
index 3a601c16f03c..f8251f5098bd 100644
--- a/arch/arm/plat-samsung/dev-i2c0.c
+++ b/arch/arm/plat-samsung/dev-i2c0.c
@@ -48,7 +48,7 @@ struct platform_device s3c_device_i2c0 = {
48 .resource = s3c_i2c_resource, 48 .resource = s3c_i2c_resource,
49}; 49};
50 50
51static struct s3c2410_platform_i2c default_i2c_data0 __initdata = { 51struct s3c2410_platform_i2c default_i2c_data __initdata = {
52 .flags = 0, 52 .flags = 0,
53 .slave_addr = 0x10, 53 .slave_addr = 0x10,
54 .frequency = 100*1000, 54 .frequency = 100*1000,
@@ -60,13 +60,11 @@ void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
60 struct s3c2410_platform_i2c *npd; 60 struct s3c2410_platform_i2c *npd;
61 61
62 if (!pd) 62 if (!pd)
63 pd = &default_i2c_data0; 63 pd = &default_i2c_data;
64 64
65 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL); 65 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
66 if (!npd) 66 &s3c_device_i2c0);
67 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
68 else if (!npd->cfg_gpio)
69 npd->cfg_gpio = s3c_i2c0_cfg_gpio;
70 67
71 s3c_device_i2c0.dev.platform_data = npd; 68 if (!npd->cfg_gpio)
69 npd->cfg_gpio = s3c_i2c0_cfg_gpio;
72} 70}
diff --git a/arch/arm/plat-samsung/dev-i2c1.c b/arch/arm/plat-samsung/dev-i2c1.c
index 858ee2a0414c..3b7c7bec1cf9 100644
--- a/arch/arm/plat-samsung/dev-i2c1.c
+++ b/arch/arm/plat-samsung/dev-i2c1.c
@@ -44,26 +44,18 @@ struct platform_device s3c_device_i2c1 = {
44 .resource = s3c_i2c_resource, 44 .resource = s3c_i2c_resource,
45}; 45};
46 46
47static struct s3c2410_platform_i2c default_i2c_data1 __initdata = {
48 .flags = 0,
49 .bus_num = 1,
50 .slave_addr = 0x10,
51 .frequency = 100*1000,
52 .sda_delay = 100,
53};
54
55void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd) 47void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
56{ 48{
57 struct s3c2410_platform_i2c *npd; 49 struct s3c2410_platform_i2c *npd;
58 50
59 if (!pd) 51 if (!pd) {
60 pd = &default_i2c_data1; 52 pd = &default_i2c_data;
53 pd->bus_num = 1;
54 }
61 55
62 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL); 56 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
63 if (!npd) 57 &s3c_device_i2c1);
64 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
65 else if (!npd->cfg_gpio)
66 npd->cfg_gpio = s3c_i2c1_cfg_gpio;
67 58
68 s3c_device_i2c1.dev.platform_data = npd; 59 if (!npd->cfg_gpio)
60 npd->cfg_gpio = s3c_i2c1_cfg_gpio;
69} 61}
diff --git a/arch/arm/plat-samsung/dev-i2c2.c b/arch/arm/plat-samsung/dev-i2c2.c
index ff4ba69b6830..07e9fd0b1b8b 100644
--- a/arch/arm/plat-samsung/dev-i2c2.c
+++ b/arch/arm/plat-samsung/dev-i2c2.c
@@ -45,26 +45,18 @@ struct platform_device s3c_device_i2c2 = {
45 .resource = s3c_i2c_resource, 45 .resource = s3c_i2c_resource,
46}; 46};
47 47
48static struct s3c2410_platform_i2c default_i2c_data2 __initdata = {
49 .flags = 0,
50 .bus_num = 2,
51 .slave_addr = 0x10,
52 .frequency = 100*1000,
53 .sda_delay = 100,
54};
55
56void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd) 48void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd)
57{ 49{
58 struct s3c2410_platform_i2c *npd; 50 struct s3c2410_platform_i2c *npd;
59 51
60 if (!pd) 52 if (!pd) {
61 pd = &default_i2c_data2; 53 pd = &default_i2c_data;
54 pd->bus_num = 2;
55 }
62 56
63 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL); 57 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
64 if (!npd) 58 &s3c_device_i2c2);
65 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
66 else if (!npd->cfg_gpio)
67 npd->cfg_gpio = s3c_i2c2_cfg_gpio;
68 59
69 s3c_device_i2c2.dev.platform_data = npd; 60 if (!npd->cfg_gpio)
61 npd->cfg_gpio = s3c_i2c2_cfg_gpio;
70} 62}
diff --git a/arch/arm/plat-samsung/dev-i2c3.c b/arch/arm/plat-samsung/dev-i2c3.c
index 8586a10014b7..d48efa93c6e7 100644
--- a/arch/arm/plat-samsung/dev-i2c3.c
+++ b/arch/arm/plat-samsung/dev-i2c3.c
@@ -43,26 +43,18 @@ struct platform_device s3c_device_i2c3 = {
43 .resource = s3c_i2c_resource, 43 .resource = s3c_i2c_resource,
44}; 44};
45 45
46static struct s3c2410_platform_i2c default_i2c_data3 __initdata = {
47 .flags = 0,
48 .bus_num = 3,
49 .slave_addr = 0x10,
50 .frequency = 100*1000,
51 .sda_delay = 100,
52};
53
54void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd) 46void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd)
55{ 47{
56 struct s3c2410_platform_i2c *npd; 48 struct s3c2410_platform_i2c *npd;
57 49
58 if (!pd) 50 if (!pd) {
59 pd = &default_i2c_data3; 51 pd = &default_i2c_data;
52 pd->bus_num = 3;
53 }
60 54
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL); 55 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
62 if (!npd) 56 &s3c_device_i2c3);
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c3_cfg_gpio;
66 57
67 s3c_device_i2c3.dev.platform_data = npd; 58 if (!npd->cfg_gpio)
59 npd->cfg_gpio = s3c_i2c3_cfg_gpio;
68} 60}
diff --git a/arch/arm/plat-samsung/dev-i2c4.c b/arch/arm/plat-samsung/dev-i2c4.c
index df2159e2daa6..07e26444efe6 100644
--- a/arch/arm/plat-samsung/dev-i2c4.c
+++ b/arch/arm/plat-samsung/dev-i2c4.c
@@ -43,26 +43,18 @@ struct platform_device s3c_device_i2c4 = {
43 .resource = s3c_i2c_resource, 43 .resource = s3c_i2c_resource,
44}; 44};
45 45
46static struct s3c2410_platform_i2c default_i2c_data4 __initdata = {
47 .flags = 0,
48 .bus_num = 4,
49 .slave_addr = 0x10,
50 .frequency = 100*1000,
51 .sda_delay = 100,
52};
53
54void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd) 46void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd)
55{ 47{
56 struct s3c2410_platform_i2c *npd; 48 struct s3c2410_platform_i2c *npd;
57 49
58 if (!pd) 50 if (!pd) {
59 pd = &default_i2c_data4; 51 pd = &default_i2c_data;
52 pd->bus_num = 4;
53 }
60 54
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL); 55 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
62 if (!npd) 56 &s3c_device_i2c4);
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c4_cfg_gpio;
66 57
67 s3c_device_i2c4.dev.platform_data = npd; 58 if (!npd->cfg_gpio)
59 npd->cfg_gpio = s3c_i2c4_cfg_gpio;
68} 60}
diff --git a/arch/arm/plat-samsung/dev-i2c5.c b/arch/arm/plat-samsung/dev-i2c5.c
index 0499c2c3877b..f49655784563 100644
--- a/arch/arm/plat-samsung/dev-i2c5.c
+++ b/arch/arm/plat-samsung/dev-i2c5.c
@@ -43,26 +43,18 @@ struct platform_device s3c_device_i2c5 = {
43 .resource = s3c_i2c_resource, 43 .resource = s3c_i2c_resource,
44}; 44};
45 45
46static struct s3c2410_platform_i2c default_i2c_data5 __initdata = {
47 .flags = 0,
48 .bus_num = 5,
49 .slave_addr = 0x10,
50 .frequency = 100*1000,
51 .sda_delay = 100,
52};
53
54void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd) 46void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd)
55{ 47{
56 struct s3c2410_platform_i2c *npd; 48 struct s3c2410_platform_i2c *npd;
57 49
58 if (!pd) 50 if (!pd) {
59 pd = &default_i2c_data5; 51 pd = &default_i2c_data;
52 pd->bus_num = 5;
53 }
60 54
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL); 55 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
62 if (!npd) 56 &s3c_device_i2c5);
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c5_cfg_gpio;
66 57
67 s3c_device_i2c5.dev.platform_data = npd; 58 if (!npd->cfg_gpio)
59 npd->cfg_gpio = s3c_i2c5_cfg_gpio;
68} 60}
diff --git a/arch/arm/plat-samsung/dev-i2c6.c b/arch/arm/plat-samsung/dev-i2c6.c
index 4083108908a8..141d799944e2 100644
--- a/arch/arm/plat-samsung/dev-i2c6.c
+++ b/arch/arm/plat-samsung/dev-i2c6.c
@@ -43,26 +43,18 @@ struct platform_device s3c_device_i2c6 = {
43 .resource = s3c_i2c_resource, 43 .resource = s3c_i2c_resource,
44}; 44};
45 45
46static struct s3c2410_platform_i2c default_i2c_data6 __initdata = {
47 .flags = 0,
48 .bus_num = 6,
49 .slave_addr = 0x10,
50 .frequency = 100*1000,
51 .sda_delay = 100,
52};
53
54void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd) 46void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd)
55{ 47{
56 struct s3c2410_platform_i2c *npd; 48 struct s3c2410_platform_i2c *npd;
57 49
58 if (!pd) 50 if (!pd) {
59 pd = &default_i2c_data6; 51 pd = &default_i2c_data;
52 pd->bus_num = 6;
53 }
60 54
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL); 55 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
62 if (!npd) 56 &s3c_device_i2c6);
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c6_cfg_gpio;
66 57
67 s3c_device_i2c6.dev.platform_data = npd; 58 if (!npd->cfg_gpio)
59 npd->cfg_gpio = s3c_i2c6_cfg_gpio;
68} 60}
diff --git a/arch/arm/plat-samsung/dev-i2c7.c b/arch/arm/plat-samsung/dev-i2c7.c
index 1182451d7dce..9dddcd1665b5 100644
--- a/arch/arm/plat-samsung/dev-i2c7.c
+++ b/arch/arm/plat-samsung/dev-i2c7.c
@@ -43,26 +43,18 @@ struct platform_device s3c_device_i2c7 = {
43 .resource = s3c_i2c_resource, 43 .resource = s3c_i2c_resource,
44}; 44};
45 45
46static struct s3c2410_platform_i2c default_i2c_data7 __initdata = {
47 .flags = 0,
48 .bus_num = 7,
49 .slave_addr = 0x10,
50 .frequency = 100*1000,
51 .sda_delay = 100,
52};
53
54void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd) 46void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
55{ 47{
56 struct s3c2410_platform_i2c *npd; 48 struct s3c2410_platform_i2c *npd;
57 49
58 if (!pd) 50 if (!pd) {
59 pd = &default_i2c_data7; 51 pd = &default_i2c_data;
52 pd->bus_num = 7;
53 }
60 54
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL); 55 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
62 if (!npd) 56 &s3c_device_i2c7);
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c7_cfg_gpio;
66 57
67 s3c_device_i2c7.dev.platform_data = npd; 58 if (!npd->cfg_gpio)
59 npd->cfg_gpio = s3c_i2c7_cfg_gpio;
68} 60}
diff --git a/arch/arm/plat-samsung/dev-nand.c b/arch/arm/plat-samsung/dev-nand.c
index 6927ae8fd118..b8e30ec6ac26 100644
--- a/arch/arm/plat-samsung/dev-nand.c
+++ b/arch/arm/plat-samsung/dev-nand.c
@@ -91,11 +91,10 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
91 * time then there is little chance the system is going to run. 91 * time then there is little chance the system is going to run.
92 */ 92 */
93 93
94 npd = kmemdup(nand, sizeof(struct s3c2410_platform_nand), GFP_KERNEL); 94 npd = s3c_set_platdata(nand, sizeof(struct s3c2410_platform_nand),
95 if (!npd) { 95 &s3c_device_nand);
96 printk(KERN_ERR "%s: failed copying platform data\n", __func__); 96 if (!npd)
97 return; 97 return;
98 }
99 98
100 /* now see if we need to copy any of the nand set data */ 99 /* now see if we need to copy any of the nand set data */
101 100
@@ -123,6 +122,4 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
123 to++; 122 to++;
124 } 123 }
125 } 124 }
126
127 s3c_device_nand.dev.platform_data = npd;
128} 125}
diff --git a/arch/arm/plat-samsung/dev-ts.c b/arch/arm/plat-samsung/dev-ts.c
index 3e4bd8147bf4..82543f0248ac 100644
--- a/arch/arm/plat-samsung/dev-ts.c
+++ b/arch/arm/plat-samsung/dev-ts.c
@@ -45,16 +45,6 @@ struct platform_device s3c_device_ts = {
45 45
46void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd) 46void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
47{ 47{
48 struct s3c2410_ts_mach_info *npd; 48 s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info),
49 49 &s3c_device_ts);
50 if (!pd) {
51 printk(KERN_ERR "%s: no platform data\n", __func__);
52 return;
53 }
54
55 npd = kmemdup(pd, sizeof(struct s3c2410_ts_mach_info), GFP_KERNEL);
56 if (!npd)
57 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
58
59 s3c_device_ts.dev.platform_data = npd;
60} 50}
diff --git a/arch/arm/plat-samsung/dev-usb.c b/arch/arm/plat-samsung/dev-usb.c
index 0e0a3bf5c982..33fbaa967700 100644
--- a/arch/arm/plat-samsung/dev-usb.c
+++ b/arch/arm/plat-samsung/dev-usb.c
@@ -60,11 +60,6 @@ EXPORT_SYMBOL(s3c_device_ohci);
60 */ 60 */
61void __init s3c_ohci_set_platdata(struct s3c2410_hcd_info *info) 61void __init s3c_ohci_set_platdata(struct s3c2410_hcd_info *info)
62{ 62{
63 struct s3c2410_hcd_info *npd; 63 s3c_set_platdata(info, sizeof(struct s3c2410_hcd_info),
64 64 &s3c_device_ohci);
65 npd = kmemdup(info, sizeof(struct s3c2410_hcd_info), GFP_KERNEL);
66 if (!npd)
67 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
68
69 s3c_device_ohci.dev.platform_data = npd;
70} 65}
diff --git a/arch/arm/plat-samsung/include/plat/backlight.h b/arch/arm/plat-samsung/include/plat/backlight.h
new file mode 100644
index 000000000000..51d8da846a62
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/backlight.h
@@ -0,0 +1,26 @@
1/* linux/arch/arm/plat-samsung/include/plat/backlight.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_PLAT_BACKLIGHT_H
12#define __ASM_PLAT_BACKLIGHT_H __FILE__
13
14/* samsung_bl_gpio_info - GPIO info for PWM Backlight control
15 * @no: GPIO number for PWM timer out
16 * @func: Special function of GPIO line for PWM timer
17 */
18struct samsung_bl_gpio_info {
19 int no;
20 int func;
21};
22
23extern void samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
24 struct platform_pwm_backlight_data *bl_data);
25
26#endif /* __ASM_PLAT_BACKLIGHT_H */
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h
index 983c578b8276..87d5b38a86fb 100644
--- a/arch/arm/plat-samsung/include/plat/clock.h
+++ b/arch/arm/plat-samsung/include/plat/clock.h
@@ -10,6 +10,7 @@
10*/ 10*/
11 11
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/clkdev.h>
13 14
14struct clk; 15struct clk;
15 16
@@ -40,6 +41,7 @@ struct clk {
40 struct module *owner; 41 struct module *owner;
41 struct clk *parent; 42 struct clk *parent;
42 const char *name; 43 const char *name;
44 const char *devname;
43 int id; 45 int id;
44 int usage; 46 int usage;
45 unsigned long rate; 47 unsigned long rate;
@@ -47,6 +49,7 @@ struct clk {
47 49
48 struct clk_ops *ops; 50 struct clk_ops *ops;
49 int (*enable)(struct clk *, int enable); 51 int (*enable)(struct clk *, int enable);
52 struct clk_lookup lookup;
50#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) 53#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
51 struct dentry *dent; /* For visible tree hierarchy */ 54 struct dentry *dent; /* For visible tree hierarchy */
52#endif 55#endif
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index 4af108ff4112..e3b31c26ac3e 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -12,6 +12,10 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14*/ 14*/
15
16#ifndef __PLAT_DEVS_H
17#define __PLAT_DEVS_H __FILE__
18
15#include <linux/platform_device.h> 19#include <linux/platform_device.h>
16 20
17struct s3c24xx_uart_resources { 21struct s3c24xx_uart_resources {
@@ -159,3 +163,5 @@ extern struct platform_device s3c_device_ac97;
159 */ 163 */
160extern void *s3c_set_platdata(void *pd, size_t pdsize, 164extern void *s3c_set_platdata(void *pd, size_t pdsize,
161 struct platform_device *pdev); 165 struct platform_device *pdev);
166
167#endif /* __PLAT_DEVS_H */
diff --git a/arch/arm/plat-samsung/include/plat/iic.h b/arch/arm/plat-samsung/include/plat/iic.h
index 1543da8f85c1..56b0059439e1 100644
--- a/arch/arm/plat-samsung/include/plat/iic.h
+++ b/arch/arm/plat-samsung/include/plat/iic.h
@@ -71,4 +71,6 @@ extern void s3c_i2c5_cfg_gpio(struct platform_device *dev);
71extern void s3c_i2c6_cfg_gpio(struct platform_device *dev); 71extern void s3c_i2c6_cfg_gpio(struct platform_device *dev);
72extern void s3c_i2c7_cfg_gpio(struct platform_device *dev); 72extern void s3c_i2c7_cfg_gpio(struct platform_device *dev);
73 73
74extern struct s3c2410_platform_i2c default_i2c_data;
75
74#endif /* __ASM_ARCH_IIC_H */ 76#endif /* __ASM_ARCH_IIC_H */
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
index 0ffe34a21554..4c16fa3621bb 100644
--- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
+++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
@@ -39,6 +39,7 @@ struct s3c64xx_spi_csinfo {
39 * @fifo_lvl_mask: All tx fifo_lvl fields start at offset-6 39 * @fifo_lvl_mask: All tx fifo_lvl fields start at offset-6
40 * @rx_lvl_offset: Depends on tx fifo_lvl field and bus number 40 * @rx_lvl_offset: Depends on tx fifo_lvl field and bus number
41 * @high_speed: If the controller supports HIGH_SPEED_EN bit 41 * @high_speed: If the controller supports HIGH_SPEED_EN bit
42 * @tx_st_done: Depends on tx fifo_lvl field
42 */ 43 */
43struct s3c64xx_spi_info { 44struct s3c64xx_spi_info {
44 int src_clk_nr; 45 int src_clk_nr;
@@ -53,6 +54,7 @@ struct s3c64xx_spi_info {
53 int fifo_lvl_mask; 54 int fifo_lvl_mask;
54 int rx_lvl_offset; 55 int rx_lvl_offset;
55 int high_speed; 56 int high_speed;
57 int tx_st_done;
56}; 58};
57 59
58/** 60/**
diff --git a/arch/arm/plat-samsung/pwm-clock.c b/arch/arm/plat-samsung/pwm-clock.c
index 46c9381e083b..f1bba88ed2f5 100644
--- a/arch/arm/plat-samsung/pwm-clock.c
+++ b/arch/arm/plat-samsung/pwm-clock.c
@@ -268,6 +268,7 @@ static struct pwm_tdiv_clk clk_timer_tdiv[] = {
268 [0] = { 268 [0] = {
269 .clk = { 269 .clk = {
270 .name = "pwm-tdiv", 270 .name = "pwm-tdiv",
271 .devname = "s3c24xx-pwm.0",
271 .ops = &clk_tdiv_ops, 272 .ops = &clk_tdiv_ops,
272 .parent = &clk_timer_scaler[0], 273 .parent = &clk_timer_scaler[0],
273 }, 274 },
@@ -275,6 +276,7 @@ static struct pwm_tdiv_clk clk_timer_tdiv[] = {
275 [1] = { 276 [1] = {
276 .clk = { 277 .clk = {
277 .name = "pwm-tdiv", 278 .name = "pwm-tdiv",
279 .devname = "s3c24xx-pwm.1",
278 .ops = &clk_tdiv_ops, 280 .ops = &clk_tdiv_ops,
279 .parent = &clk_timer_scaler[0], 281 .parent = &clk_timer_scaler[0],
280 } 282 }
@@ -282,6 +284,7 @@ static struct pwm_tdiv_clk clk_timer_tdiv[] = {
282 [2] = { 284 [2] = {
283 .clk = { 285 .clk = {
284 .name = "pwm-tdiv", 286 .name = "pwm-tdiv",
287 .devname = "s3c24xx-pwm.2",
285 .ops = &clk_tdiv_ops, 288 .ops = &clk_tdiv_ops,
286 .parent = &clk_timer_scaler[1], 289 .parent = &clk_timer_scaler[1],
287 }, 290 },
@@ -289,6 +292,7 @@ static struct pwm_tdiv_clk clk_timer_tdiv[] = {
289 [3] = { 292 [3] = {
290 .clk = { 293 .clk = {
291 .name = "pwm-tdiv", 294 .name = "pwm-tdiv",
295 .devname = "s3c24xx-pwm.3",
292 .ops = &clk_tdiv_ops, 296 .ops = &clk_tdiv_ops,
293 .parent = &clk_timer_scaler[1], 297 .parent = &clk_timer_scaler[1],
294 }, 298 },
@@ -296,6 +300,7 @@ static struct pwm_tdiv_clk clk_timer_tdiv[] = {
296 [4] = { 300 [4] = {
297 .clk = { 301 .clk = {
298 .name = "pwm-tdiv", 302 .name = "pwm-tdiv",
303 .devname = "s3c24xx-pwm.4",
299 .ops = &clk_tdiv_ops, 304 .ops = &clk_tdiv_ops,
300 .parent = &clk_timer_scaler[1], 305 .parent = &clk_timer_scaler[1],
301 }, 306 },
@@ -361,26 +366,31 @@ static struct clk_ops clk_tin_ops = {
361static struct clk clk_tin[] = { 366static struct clk clk_tin[] = {
362 [0] = { 367 [0] = {
363 .name = "pwm-tin", 368 .name = "pwm-tin",
369 .devname = "s3c24xx-pwm.0",
364 .id = 0, 370 .id = 0,
365 .ops = &clk_tin_ops, 371 .ops = &clk_tin_ops,
366 }, 372 },
367 [1] = { 373 [1] = {
368 .name = "pwm-tin", 374 .name = "pwm-tin",
375 .devname = "s3c24xx-pwm.1",
369 .id = 1, 376 .id = 1,
370 .ops = &clk_tin_ops, 377 .ops = &clk_tin_ops,
371 }, 378 },
372 [2] = { 379 [2] = {
373 .name = "pwm-tin", 380 .name = "pwm-tin",
381 .devname = "s3c24xx-pwm.2",
374 .id = 2, 382 .id = 2,
375 .ops = &clk_tin_ops, 383 .ops = &clk_tin_ops,
376 }, 384 },
377 [3] = { 385 [3] = {
378 .name = "pwm-tin", 386 .name = "pwm-tin",
387 .devname = "s3c24xx-pwm.3",
379 .id = 3, 388 .id = 3,
380 .ops = &clk_tin_ops, 389 .ops = &clk_tin_ops,
381 }, 390 },
382 [4] = { 391 [4] = {
383 .name = "pwm-tin", 392 .name = "pwm-tin",
393 .devname = "s3c24xx-pwm.4",
384 .id = 4, 394 .id = 4,
385 .ops = &clk_tin_ops, 395 .ops = &clk_tin_ops,
386 }, 396 },
diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
index 2231d80ad817..e3bb806bbafe 100644
--- a/arch/arm/plat-samsung/time.c
+++ b/arch/arm/plat-samsung/time.c
@@ -259,6 +259,8 @@ static void __init s3c2410_timer_resources(void)
259 clk_enable(timerclk); 259 clk_enable(timerclk);
260 260
261 if (!use_tclk1_12()) { 261 if (!use_tclk1_12()) {
262 tmpdev.id = 4;
263 tmpdev.dev.init_name = "s3c24xx-pwm.4";
262 tin = clk_get(&tmpdev.dev, "pwm-tin"); 264 tin = clk_get(&tmpdev.dev, "pwm-tin");
263 if (IS_ERR(tin)) 265 if (IS_ERR(tin))
264 panic("failed to get pwm-tin clock for system timer"); 266 panic("failed to get pwm-tin clock for system timer");
diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h
index 224e8c5eb307..ffa037f28d39 100644
--- a/arch/x86/include/asm/mmzone_32.h
+++ b/arch/x86/include/asm/mmzone_32.h
@@ -57,6 +57,8 @@ static inline int pfn_valid(int pfn)
57 return 0; 57 return 0;
58} 58}
59 59
60#define early_pfn_valid(pfn) pfn_valid((pfn))
61
60#endif /* CONFIG_DISCONTIGMEM */ 62#endif /* CONFIG_DISCONTIGMEM */
61 63
62#ifdef CONFIG_NEED_MULTIPLE_NODES 64#ifdef CONFIG_NEED_MULTIPLE_NODES
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.S b/arch/x86/kernel/acpi/realmode/wakeup.S
index ead21b663117..b4fd836e4053 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.S
@@ -28,6 +28,8 @@ pmode_cr3: .long 0 /* Saved %cr3 */
28pmode_cr4: .long 0 /* Saved %cr4 */ 28pmode_cr4: .long 0 /* Saved %cr4 */
29pmode_efer: .quad 0 /* Saved EFER */ 29pmode_efer: .quad 0 /* Saved EFER */
30pmode_gdt: .quad 0 30pmode_gdt: .quad 0
31pmode_misc_en: .quad 0 /* Saved MISC_ENABLE MSR */
32pmode_behavior: .long 0 /* Wakeup behavior flags */
31realmode_flags: .long 0 33realmode_flags: .long 0
32real_magic: .long 0 34real_magic: .long 0
33trampoline_segment: .word 0 35trampoline_segment: .word 0
@@ -91,6 +93,18 @@ wakeup_code:
91 /* Call the C code */ 93 /* Call the C code */
92 calll main 94 calll main
93 95
96 /* Restore MISC_ENABLE before entering protected mode, in case
97 BIOS decided to clear XD_DISABLE during S3. */
98 movl pmode_behavior, %eax
99 btl $WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE, %eax
100 jnc 1f
101
102 movl pmode_misc_en, %eax
103 movl pmode_misc_en + 4, %edx
104 movl $MSR_IA32_MISC_ENABLE, %ecx
105 wrmsr
1061:
107
94 /* Do any other stuff... */ 108 /* Do any other stuff... */
95 109
96#ifndef CONFIG_64BIT 110#ifndef CONFIG_64BIT
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.h b/arch/x86/kernel/acpi/realmode/wakeup.h
index e1828c07e79c..97a29e1430e3 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.h
+++ b/arch/x86/kernel/acpi/realmode/wakeup.h
@@ -21,6 +21,9 @@ struct wakeup_header {
21 u32 pmode_efer_low; /* Protected mode EFER */ 21 u32 pmode_efer_low; /* Protected mode EFER */
22 u32 pmode_efer_high; 22 u32 pmode_efer_high;
23 u64 pmode_gdt; 23 u64 pmode_gdt;
24 u32 pmode_misc_en_low; /* Protected mode MISC_ENABLE */
25 u32 pmode_misc_en_high;
26 u32 pmode_behavior; /* Wakeup routine behavior flags */
24 u32 realmode_flags; 27 u32 realmode_flags;
25 u32 real_magic; 28 u32 real_magic;
26 u16 trampoline_segment; /* segment with trampoline code, 64-bit only */ 29 u16 trampoline_segment; /* segment with trampoline code, 64-bit only */
@@ -39,4 +42,7 @@ extern struct wakeup_header wakeup_header;
39#define WAKEUP_HEADER_SIGNATURE 0x51ee1111 42#define WAKEUP_HEADER_SIGNATURE 0x51ee1111
40#define WAKEUP_END_SIGNATURE 0x65a22c82 43#define WAKEUP_END_SIGNATURE 0x65a22c82
41 44
45/* Wakeup behavior bits */
46#define WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE 0
47
42#endif /* ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H */ 48#endif /* ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H */
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 18a857ba7a25..103b6ab368d3 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -77,6 +77,12 @@ int acpi_suspend_lowlevel(void)
77 77
78 header->pmode_cr0 = read_cr0(); 78 header->pmode_cr0 = read_cr0();
79 header->pmode_cr4 = read_cr4_safe(); 79 header->pmode_cr4 = read_cr4_safe();
80 header->pmode_behavior = 0;
81 if (!rdmsr_safe(MSR_IA32_MISC_ENABLE,
82 &header->pmode_misc_en_low,
83 &header->pmode_misc_en_high))
84 header->pmode_behavior |=
85 (1 << WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE);
80 header->realmode_flags = acpi_realmode_flags; 86 header->realmode_flags = acpi_realmode_flags;
81 header->real_magic = 0x12345678; 87 header->real_magic = 0x12345678;
82 88
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 0c016f727695..4f0d46fefa7f 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -294,6 +294,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
294 DMI_MATCH(DMI_BOARD_NAME, "VersaLogic Menlow board"), 294 DMI_MATCH(DMI_BOARD_NAME, "VersaLogic Menlow board"),
295 }, 295 },
296 }, 296 },
297 { /* Handle reboot issue on Acer Aspire one */
298 .callback = set_bios_reboot,
299 .ident = "Acer Aspire One A110",
300 .matches = {
301 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
302 DMI_MATCH(DMI_PRODUCT_NAME, "AOA110"),
303 },
304 },
297 { } 305 { }
298}; 306};
299 307
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index cf9750004a08..68894fdc034b 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -112,8 +112,10 @@ static void nmi_cpu_start(void *dummy)
112static int nmi_start(void) 112static int nmi_start(void)
113{ 113{
114 get_online_cpus(); 114 get_online_cpus();
115 on_each_cpu(nmi_cpu_start, NULL, 1);
116 ctr_running = 1; 115 ctr_running = 1;
116 /* make ctr_running visible to the nmi handler: */
117 smp_mb();
118 on_each_cpu(nmi_cpu_start, NULL, 1);
117 put_online_cpus(); 119 put_online_cpus();
118 return 0; 120 return 0;
119} 121}
@@ -504,15 +506,18 @@ static int nmi_setup(void)
504 506
505 nmi_enabled = 0; 507 nmi_enabled = 0;
506 ctr_running = 0; 508 ctr_running = 0;
507 barrier(); 509 /* make variables visible to the nmi handler: */
510 smp_mb();
508 err = register_die_notifier(&profile_exceptions_nb); 511 err = register_die_notifier(&profile_exceptions_nb);
509 if (err) 512 if (err)
510 goto fail; 513 goto fail;
511 514
512 get_online_cpus(); 515 get_online_cpus();
513 register_cpu_notifier(&oprofile_cpu_nb); 516 register_cpu_notifier(&oprofile_cpu_nb);
514 on_each_cpu(nmi_cpu_setup, NULL, 1);
515 nmi_enabled = 1; 517 nmi_enabled = 1;
518 /* make nmi_enabled visible to the nmi handler: */
519 smp_mb();
520 on_each_cpu(nmi_cpu_setup, NULL, 1);
516 put_online_cpus(); 521 put_online_cpus();
517 522
518 return 0; 523 return 0;
@@ -531,7 +536,8 @@ static void nmi_shutdown(void)
531 nmi_enabled = 0; 536 nmi_enabled = 0;
532 ctr_running = 0; 537 ctr_running = 0;
533 put_online_cpus(); 538 put_online_cpus();
534 barrier(); 539 /* make variables visible to the nmi handler: */
540 smp_mb();
535 unregister_die_notifier(&profile_exceptions_nb); 541 unregister_die_notifier(&profile_exceptions_nb);
536 msrs = &get_cpu_var(cpu_msrs); 542 msrs = &get_cpu_var(cpu_msrs);
537 model->shutdown(msrs); 543 model->shutdown(msrs);
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index fe008309ffec..f567965c0620 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -327,13 +327,12 @@ int __init pci_xen_hvm_init(void)
327} 327}
328 328
329#ifdef CONFIG_XEN_DOM0 329#ifdef CONFIG_XEN_DOM0
330static int xen_register_pirq(u32 gsi, int triggering) 330static int xen_register_pirq(u32 gsi, int gsi_override, int triggering)
331{ 331{
332 int rc, pirq, irq = -1; 332 int rc, pirq, irq = -1;
333 struct physdev_map_pirq map_irq; 333 struct physdev_map_pirq map_irq;
334 int shareable = 0; 334 int shareable = 0;
335 char *name; 335 char *name;
336 bool gsi_override = false;
337 336
338 if (!xen_pv_domain()) 337 if (!xen_pv_domain())
339 return -1; 338 return -1;
@@ -345,31 +344,12 @@ static int xen_register_pirq(u32 gsi, int triggering)
345 shareable = 1; 344 shareable = 1;
346 name = "ioapic-level"; 345 name = "ioapic-level";
347 } 346 }
348
349 pirq = xen_allocate_pirq_gsi(gsi); 347 pirq = xen_allocate_pirq_gsi(gsi);
350 if (pirq < 0) 348 if (pirq < 0)
351 goto out; 349 goto out;
352 350
353 /* Before we bind the GSI to a Linux IRQ, check whether 351 if (gsi_override >= 0)
354 * we need to override it with bus_irq (IRQ) value. Usually for 352 irq = xen_bind_pirq_gsi_to_irq(gsi_override, pirq, shareable, name);
355 * IRQs below IRQ_LEGACY_IRQ this holds IRQ == GSI, as so:
356 * ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 low level)
357 * but there are oddballs where the IRQ != GSI:
358 * ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 20 low level)
359 * which ends up being: gsi_to_irq[9] == 20
360 * (which is what acpi_gsi_to_irq ends up calling when starting the
361 * the ACPI interpreter and keels over since IRQ 9 has not been
362 * setup as we had setup IRQ 20 for it).
363 */
364 if (gsi == acpi_sci_override_gsi) {
365 /* Check whether the GSI != IRQ */
366 acpi_gsi_to_irq(gsi, &irq);
367 if (irq != gsi)
368 /* Bugger, we MUST have that IRQ. */
369 gsi_override = true;
370 }
371 if (gsi_override)
372 irq = xen_bind_pirq_gsi_to_irq(irq, pirq, shareable, name);
373 else 353 else
374 irq = xen_bind_pirq_gsi_to_irq(gsi, pirq, shareable, name); 354 irq = xen_bind_pirq_gsi_to_irq(gsi, pirq, shareable, name);
375 if (irq < 0) 355 if (irq < 0)
@@ -392,7 +372,7 @@ out:
392 return irq; 372 return irq;
393} 373}
394 374
395static int xen_register_gsi(u32 gsi, int triggering, int polarity) 375static int xen_register_gsi(u32 gsi, int gsi_override, int triggering, int polarity)
396{ 376{
397 int rc, irq; 377 int rc, irq;
398 struct physdev_setup_gsi setup_gsi; 378 struct physdev_setup_gsi setup_gsi;
@@ -403,7 +383,7 @@ static int xen_register_gsi(u32 gsi, int triggering, int polarity)
403 printk(KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n", 383 printk(KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n",
404 gsi, triggering, polarity); 384 gsi, triggering, polarity);
405 385
406 irq = xen_register_pirq(gsi, triggering); 386 irq = xen_register_pirq(gsi, gsi_override, triggering);
407 387
408 setup_gsi.gsi = gsi; 388 setup_gsi.gsi = gsi;
409 setup_gsi.triggering = (triggering == ACPI_EDGE_SENSITIVE ? 0 : 1); 389 setup_gsi.triggering = (triggering == ACPI_EDGE_SENSITIVE ? 0 : 1);
@@ -425,6 +405,8 @@ static __init void xen_setup_acpi_sci(void)
425 int rc; 405 int rc;
426 int trigger, polarity; 406 int trigger, polarity;
427 int gsi = acpi_sci_override_gsi; 407 int gsi = acpi_sci_override_gsi;
408 int irq = -1;
409 int gsi_override = -1;
428 410
429 if (!gsi) 411 if (!gsi)
430 return; 412 return;
@@ -441,7 +423,25 @@ static __init void xen_setup_acpi_sci(void)
441 printk(KERN_INFO "xen: sci override: global_irq=%d trigger=%d " 423 printk(KERN_INFO "xen: sci override: global_irq=%d trigger=%d "
442 "polarity=%d\n", gsi, trigger, polarity); 424 "polarity=%d\n", gsi, trigger, polarity);
443 425
444 gsi = xen_register_gsi(gsi, trigger, polarity); 426 /* Before we bind the GSI to a Linux IRQ, check whether
427 * we need to override it with bus_irq (IRQ) value. Usually for
428 * IRQs below IRQ_LEGACY_IRQ this holds IRQ == GSI, as so:
429 * ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 low level)
430 * but there are oddballs where the IRQ != GSI:
431 * ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 20 low level)
432 * which ends up being: gsi_to_irq[9] == 20
433 * (which is what acpi_gsi_to_irq ends up calling when starting the
434 * the ACPI interpreter and keels over since IRQ 9 has not been
435 * setup as we had setup IRQ 20 for it).
436 */
437 /* Check whether the GSI != IRQ */
438 if (acpi_gsi_to_irq(gsi, &irq) == 0) {
439 if (irq >= 0 && irq != gsi)
440 /* Bugger, we MUST have that IRQ. */
441 gsi_override = irq;
442 }
443
444 gsi = xen_register_gsi(gsi, gsi_override, trigger, polarity);
445 printk(KERN_INFO "xen: acpi sci %d\n", gsi); 445 printk(KERN_INFO "xen: acpi sci %d\n", gsi);
446 446
447 return; 447 return;
@@ -450,7 +450,7 @@ static __init void xen_setup_acpi_sci(void)
450static int acpi_register_gsi_xen(struct device *dev, u32 gsi, 450static int acpi_register_gsi_xen(struct device *dev, u32 gsi,
451 int trigger, int polarity) 451 int trigger, int polarity)
452{ 452{
453 return xen_register_gsi(gsi, trigger, polarity); 453 return xen_register_gsi(gsi, -1 /* no GSI override */, trigger, polarity);
454} 454}
455 455
456static int __init pci_xen_initial_domain(void) 456static int __init pci_xen_initial_domain(void)
@@ -489,7 +489,7 @@ void __init xen_setup_pirqs(void)
489 if (acpi_get_override_irq(irq, &trigger, &polarity) == -1) 489 if (acpi_get_override_irq(irq, &trigger, &polarity) == -1)
490 continue; 490 continue;
491 491
492 xen_register_pirq(irq, 492 xen_register_pirq(irq, -1 /* no GSI override */,
493 trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE); 493 trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE);
494 } 494 }
495} 495}
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 474356b98ede..899e393d8e73 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -504,9 +504,6 @@ void __init efi_init(void)
504 x86_platform.set_wallclock = efi_set_rtc_mmss; 504 x86_platform.set_wallclock = efi_set_rtc_mmss;
505#endif 505#endif
506 506
507 /* Setup for EFI runtime service */
508 reboot_type = BOOT_EFI;
509
510#if EFI_DEBUG 507#if EFI_DEBUG
511 print_efi_memmap(); 508 print_efi_memmap();
512#endif 509#endif
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index f3799432676d..ae21919f15e1 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2773,11 +2773,14 @@ static void __cfq_exit_single_io_context(struct cfq_data *cfqd,
2773 smp_wmb(); 2773 smp_wmb();
2774 cic->key = cfqd_dead_key(cfqd); 2774 cic->key = cfqd_dead_key(cfqd);
2775 2775
2776 rcu_read_lock();
2776 if (rcu_dereference(ioc->ioc_data) == cic) { 2777 if (rcu_dereference(ioc->ioc_data) == cic) {
2778 rcu_read_unlock();
2777 spin_lock(&ioc->lock); 2779 spin_lock(&ioc->lock);
2778 rcu_assign_pointer(ioc->ioc_data, NULL); 2780 rcu_assign_pointer(ioc->ioc_data, NULL);
2779 spin_unlock(&ioc->lock); 2781 spin_unlock(&ioc->lock);
2780 } 2782 } else
2783 rcu_read_unlock();
2781 2784
2782 if (cic->cfqq[BLK_RW_ASYNC]) { 2785 if (cic->cfqq[BLK_RW_ASYNC]) {
2783 cfq_exit_cfqq(cfqd, cic->cfqq[BLK_RW_ASYNC]); 2786 cfq_exit_cfqq(cfqd, cic->cfqq[BLK_RW_ASYNC]);
@@ -3084,7 +3087,8 @@ cfq_drop_dead_cic(struct cfq_data *cfqd, struct io_context *ioc,
3084 3087
3085 spin_lock_irqsave(&ioc->lock, flags); 3088 spin_lock_irqsave(&ioc->lock, flags);
3086 3089
3087 BUG_ON(ioc->ioc_data == cic); 3090 BUG_ON(rcu_dereference_check(ioc->ioc_data,
3091 lockdep_is_held(&ioc->lock)) == cic);
3088 3092
3089 radix_tree_delete(&ioc->radix_root, cfqd->cic_index); 3093 radix_tree_delete(&ioc->radix_root, cfqd->cic_index);
3090 hlist_del_rcu(&cic->cic_list); 3094 hlist_del_rcu(&cic->cic_list);
diff --git a/drivers/base/syscore.c b/drivers/base/syscore.c
index c126db3cb7d1..e8d11b6630ee 100644
--- a/drivers/base/syscore.c
+++ b/drivers/base/syscore.c
@@ -9,6 +9,7 @@
9#include <linux/syscore_ops.h> 9#include <linux/syscore_ops.h>
10#include <linux/mutex.h> 10#include <linux/mutex.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/interrupt.h>
12 13
13static LIST_HEAD(syscore_ops_list); 14static LIST_HEAD(syscore_ops_list);
14static DEFINE_MUTEX(syscore_ops_lock); 15static DEFINE_MUTEX(syscore_ops_lock);
@@ -48,6 +49,13 @@ int syscore_suspend(void)
48 struct syscore_ops *ops; 49 struct syscore_ops *ops;
49 int ret = 0; 50 int ret = 0;
50 51
52 pr_debug("Checking wakeup interrupts\n");
53
54 /* Return error code if there are any wakeup interrupts pending. */
55 ret = check_wakeup_irqs();
56 if (ret)
57 return ret;
58
51 WARN_ONCE(!irqs_disabled(), 59 WARN_ONCE(!irqs_disabled(),
52 "Interrupts enabled before system core suspend.\n"); 60 "Interrupts enabled before system core suspend.\n");
53 61
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c
index 09ef9a878ef0..cf0e63dd97da 100644
--- a/drivers/block/drbd/drbd_actlog.c
+++ b/drivers/block/drbd/drbd_actlog.c
@@ -79,7 +79,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
79 md_io.error = 0; 79 md_io.error = 0;
80 80
81 if ((rw & WRITE) && !test_bit(MD_NO_FUA, &mdev->flags)) 81 if ((rw & WRITE) && !test_bit(MD_NO_FUA, &mdev->flags))
82 rw |= REQ_FUA; 82 rw |= REQ_FUA | REQ_FLUSH;
83 rw |= REQ_SYNC; 83 rw |= REQ_SYNC;
84 84
85 bio = bio_alloc(GFP_NOIO, 1); 85 bio = bio_alloc(GFP_NOIO, 1);
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c
index f440a02dfdb1..7b976296b564 100644
--- a/drivers/block/drbd/drbd_bitmap.c
+++ b/drivers/block/drbd/drbd_bitmap.c
@@ -112,9 +112,6 @@ struct drbd_bitmap {
112 struct task_struct *bm_task; 112 struct task_struct *bm_task;
113}; 113};
114 114
115static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
116 unsigned long e, int val, const enum km_type km);
117
118#define bm_print_lock_info(m) __bm_print_lock_info(m, __func__) 115#define bm_print_lock_info(m) __bm_print_lock_info(m, __func__)
119static void __bm_print_lock_info(struct drbd_conf *mdev, const char *func) 116static void __bm_print_lock_info(struct drbd_conf *mdev, const char *func)
120{ 117{
@@ -994,6 +991,9 @@ static void bm_page_io_async(struct bm_aio_ctx *ctx, int page_nr, int rw) __must
994 bio_endio(bio, -EIO); 991 bio_endio(bio, -EIO);
995 } else { 992 } else {
996 submit_bio(rw, bio); 993 submit_bio(rw, bio);
994 /* this should not count as user activity and cause the
995 * resync to throttle -- see drbd_rs_should_slow_down(). */
996 atomic_add(len >> 9, &mdev->rs_sect_ev);
997 } 997 }
998} 998}
999 999
@@ -1256,7 +1256,7 @@ unsigned long _drbd_bm_find_next_zero(struct drbd_conf *mdev, unsigned long bm_f
1256 * expected to be called for only a few bits (e - s about BITS_PER_LONG). 1256 * expected to be called for only a few bits (e - s about BITS_PER_LONG).
1257 * Must hold bitmap lock already. */ 1257 * Must hold bitmap lock already. */
1258static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s, 1258static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
1259 unsigned long e, int val, const enum km_type km) 1259 unsigned long e, int val)
1260{ 1260{
1261 struct drbd_bitmap *b = mdev->bitmap; 1261 struct drbd_bitmap *b = mdev->bitmap;
1262 unsigned long *p_addr = NULL; 1262 unsigned long *p_addr = NULL;
@@ -1274,14 +1274,14 @@ static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
1274 unsigned int page_nr = bm_bit_to_page_idx(b, bitnr); 1274 unsigned int page_nr = bm_bit_to_page_idx(b, bitnr);
1275 if (page_nr != last_page_nr) { 1275 if (page_nr != last_page_nr) {
1276 if (p_addr) 1276 if (p_addr)
1277 __bm_unmap(p_addr, km); 1277 __bm_unmap(p_addr, KM_IRQ1);
1278 if (c < 0) 1278 if (c < 0)
1279 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]); 1279 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]);
1280 else if (c > 0) 1280 else if (c > 0)
1281 bm_set_page_need_writeout(b->bm_pages[last_page_nr]); 1281 bm_set_page_need_writeout(b->bm_pages[last_page_nr]);
1282 changed_total += c; 1282 changed_total += c;
1283 c = 0; 1283 c = 0;
1284 p_addr = __bm_map_pidx(b, page_nr, km); 1284 p_addr = __bm_map_pidx(b, page_nr, KM_IRQ1);
1285 last_page_nr = page_nr; 1285 last_page_nr = page_nr;
1286 } 1286 }
1287 if (val) 1287 if (val)
@@ -1290,7 +1290,7 @@ static int __bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
1290 c -= (0 != __test_and_clear_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr)); 1290 c -= (0 != __test_and_clear_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr));
1291 } 1291 }
1292 if (p_addr) 1292 if (p_addr)
1293 __bm_unmap(p_addr, km); 1293 __bm_unmap(p_addr, KM_IRQ1);
1294 if (c < 0) 1294 if (c < 0)
1295 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]); 1295 bm_set_page_lazy_writeout(b->bm_pages[last_page_nr]);
1296 else if (c > 0) 1296 else if (c > 0)
@@ -1318,7 +1318,7 @@ static int bm_change_bits_to(struct drbd_conf *mdev, const unsigned long s,
1318 if ((val ? BM_DONT_SET : BM_DONT_CLEAR) & b->bm_flags) 1318 if ((val ? BM_DONT_SET : BM_DONT_CLEAR) & b->bm_flags)
1319 bm_print_lock_info(mdev); 1319 bm_print_lock_info(mdev);
1320 1320
1321 c = __bm_change_bits_to(mdev, s, e, val, KM_IRQ1); 1321 c = __bm_change_bits_to(mdev, s, e, val);
1322 1322
1323 spin_unlock_irqrestore(&b->bm_lock, flags); 1323 spin_unlock_irqrestore(&b->bm_lock, flags);
1324 return c; 1324 return c;
@@ -1343,16 +1343,17 @@ static inline void bm_set_full_words_within_one_page(struct drbd_bitmap *b,
1343{ 1343{
1344 int i; 1344 int i;
1345 int bits; 1345 int bits;
1346 unsigned long *paddr = kmap_atomic(b->bm_pages[page_nr], KM_USER0); 1346 unsigned long *paddr = kmap_atomic(b->bm_pages[page_nr], KM_IRQ1);
1347 for (i = first_word; i < last_word; i++) { 1347 for (i = first_word; i < last_word; i++) {
1348 bits = hweight_long(paddr[i]); 1348 bits = hweight_long(paddr[i]);
1349 paddr[i] = ~0UL; 1349 paddr[i] = ~0UL;
1350 b->bm_set += BITS_PER_LONG - bits; 1350 b->bm_set += BITS_PER_LONG - bits;
1351 } 1351 }
1352 kunmap_atomic(paddr, KM_USER0); 1352 kunmap_atomic(paddr, KM_IRQ1);
1353} 1353}
1354 1354
1355/* Same thing as drbd_bm_set_bits, but without taking the spin_lock_irqsave. 1355/* Same thing as drbd_bm_set_bits,
1356 * but more efficient for a large bit range.
1356 * You must first drbd_bm_lock(). 1357 * You must first drbd_bm_lock().
1357 * Can be called to set the whole bitmap in one go. 1358 * Can be called to set the whole bitmap in one go.
1358 * Sets bits from s to e _inclusive_. */ 1359 * Sets bits from s to e _inclusive_. */
@@ -1366,6 +1367,7 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi
1366 * Do not use memset, because we must account for changes, 1367 * Do not use memset, because we must account for changes,
1367 * so we need to loop over the words with hweight() anyways. 1368 * so we need to loop over the words with hweight() anyways.
1368 */ 1369 */
1370 struct drbd_bitmap *b = mdev->bitmap;
1369 unsigned long sl = ALIGN(s,BITS_PER_LONG); 1371 unsigned long sl = ALIGN(s,BITS_PER_LONG);
1370 unsigned long el = (e+1) & ~((unsigned long)BITS_PER_LONG-1); 1372 unsigned long el = (e+1) & ~((unsigned long)BITS_PER_LONG-1);
1371 int first_page; 1373 int first_page;
@@ -1376,15 +1378,19 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi
1376 1378
1377 if (e - s <= 3*BITS_PER_LONG) { 1379 if (e - s <= 3*BITS_PER_LONG) {
1378 /* don't bother; el and sl may even be wrong. */ 1380 /* don't bother; el and sl may even be wrong. */
1379 __bm_change_bits_to(mdev, s, e, 1, KM_USER0); 1381 spin_lock_irq(&b->bm_lock);
1382 __bm_change_bits_to(mdev, s, e, 1);
1383 spin_unlock_irq(&b->bm_lock);
1380 return; 1384 return;
1381 } 1385 }
1382 1386
1383 /* difference is large enough that we can trust sl and el */ 1387 /* difference is large enough that we can trust sl and el */
1384 1388
1389 spin_lock_irq(&b->bm_lock);
1390
1385 /* bits filling the current long */ 1391 /* bits filling the current long */
1386 if (sl) 1392 if (sl)
1387 __bm_change_bits_to(mdev, s, sl-1, 1, KM_USER0); 1393 __bm_change_bits_to(mdev, s, sl-1, 1);
1388 1394
1389 first_page = sl >> (3 + PAGE_SHIFT); 1395 first_page = sl >> (3 + PAGE_SHIFT);
1390 last_page = el >> (3 + PAGE_SHIFT); 1396 last_page = el >> (3 + PAGE_SHIFT);
@@ -1397,8 +1403,10 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi
1397 /* first and full pages, unless first page == last page */ 1403 /* first and full pages, unless first page == last page */
1398 for (page_nr = first_page; page_nr < last_page; page_nr++) { 1404 for (page_nr = first_page; page_nr < last_page; page_nr++) {
1399 bm_set_full_words_within_one_page(mdev->bitmap, page_nr, first_word, last_word); 1405 bm_set_full_words_within_one_page(mdev->bitmap, page_nr, first_word, last_word);
1406 spin_unlock_irq(&b->bm_lock);
1400 cond_resched(); 1407 cond_resched();
1401 first_word = 0; 1408 first_word = 0;
1409 spin_lock_irq(&b->bm_lock);
1402 } 1410 }
1403 1411
1404 /* last page (respectively only page, for first page == last page) */ 1412 /* last page (respectively only page, for first page == last page) */
@@ -1411,7 +1419,8 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi
1411 * it would trigger an assert in __bm_change_bits_to() 1419 * it would trigger an assert in __bm_change_bits_to()
1412 */ 1420 */
1413 if (el <= e) 1421 if (el <= e)
1414 __bm_change_bits_to(mdev, el, e, 1, KM_USER0); 1422 __bm_change_bits_to(mdev, el, e, 1);
1423 spin_unlock_irq(&b->bm_lock);
1415} 1424}
1416 1425
1417/* returns bit state 1426/* returns bit state
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 25d32c5aa50a..43beaca53179 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4602,6 +4602,11 @@ int drbd_asender(struct drbd_thread *thi)
4602 dev_err(DEV, "meta connection shut down by peer.\n"); 4602 dev_err(DEV, "meta connection shut down by peer.\n");
4603 goto reconnect; 4603 goto reconnect;
4604 } else if (rv == -EAGAIN) { 4604 } else if (rv == -EAGAIN) {
4605 /* If the data socket received something meanwhile,
4606 * that is good enough: peer is still alive. */
4607 if (time_after(mdev->last_received,
4608 jiffies - mdev->meta.socket->sk->sk_rcvtimeo))
4609 continue;
4605 if (ping_timeout_active) { 4610 if (ping_timeout_active) {
4606 dev_err(DEV, "PingAck did not arrive in time.\n"); 4611 dev_err(DEV, "PingAck did not arrive in time.\n");
4607 goto reconnect; 4612 goto reconnect;
@@ -4637,6 +4642,7 @@ int drbd_asender(struct drbd_thread *thi)
4637 goto reconnect; 4642 goto reconnect;
4638 } 4643 }
4639 if (received == expect) { 4644 if (received == expect) {
4645 mdev->last_received = jiffies;
4640 D_ASSERT(cmd != NULL); 4646 D_ASSERT(cmd != NULL);
4641 if (!cmd->process(mdev, h)) 4647 if (!cmd->process(mdev, h))
4642 goto reconnect; 4648 goto reconnect;
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 4d76b06b6b20..4d3e6f6213ba 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -536,12 +536,7 @@ static int w_make_resync_request(struct drbd_conf *mdev,
536 return 1; 536 return 1;
537 } 537 }
538 538
539 /* starting with drbd 8.3.8, we can handle multi-bio EEs, 539 max_bio_size = queue_max_hw_sectors(mdev->rq_queue) << 9;
540 * if it should be necessary */
541 max_bio_size =
542 mdev->agreed_pro_version < 94 ? queue_max_hw_sectors(mdev->rq_queue) << 9 :
543 mdev->agreed_pro_version < 95 ? DRBD_MAX_SIZE_H80_PACKET : DRBD_MAX_BIO_SIZE;
544
545 number = drbd_rs_number_requests(mdev); 540 number = drbd_rs_number_requests(mdev);
546 if (number == 0) 541 if (number == 0)
547 goto requeue; 542 goto requeue;
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 4e04e1274388..596d5dd32f41 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -759,7 +759,7 @@ static void __exit acpi_cpufreq_exit(void)
759 759
760 cpufreq_unregister_driver(&acpi_cpufreq_driver); 760 cpufreq_unregister_driver(&acpi_cpufreq_driver);
761 761
762 free_percpu(acpi_perf_data); 762 free_acpi_perf_data();
763} 763}
764 764
765module_param(acpi_pstate_strict, uint, 0644); 765module_param(acpi_pstate_strict, uint, 0644);
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 438e6c831170..ebb897329c1e 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -264,6 +264,7 @@ static char ohci_driver_name[] = KBUILD_MODNAME;
264#define PCI_DEVICE_ID_AGERE_FW643 0x5901 264#define PCI_DEVICE_ID_AGERE_FW643 0x5901
265#define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 265#define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380
266#define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 266#define PCI_DEVICE_ID_TI_TSB12LV22 0x8009
267#define PCI_VENDOR_ID_PINNACLE_SYSTEMS 0x11bd
267 268
268#define QUIRK_CYCLE_TIMER 1 269#define QUIRK_CYCLE_TIMER 1
269#define QUIRK_RESET_PACKET 2 270#define QUIRK_RESET_PACKET 2
@@ -3190,6 +3191,11 @@ static int __devinit pci_probe(struct pci_dev *dev,
3190 int i, err; 3191 int i, err;
3191 size_t size; 3192 size_t size;
3192 3193
3194 if (dev->vendor == PCI_VENDOR_ID_PINNACLE_SYSTEMS) {
3195 dev_err(&dev->dev, "Pinnacle MovieBoard is not yet supported\n");
3196 return -ENOSYS;
3197 }
3198
3193 ohci = kzalloc(sizeof(*ohci), GFP_KERNEL); 3199 ohci = kzalloc(sizeof(*ohci), GFP_KERNEL);
3194 if (ohci == NULL) { 3200 if (ohci == NULL) {
3195 err = -ENOMEM; 3201 err = -ENOMEM;
diff --git a/drivers/gpio/langwell_gpio.c b/drivers/gpio/langwell_gpio.c
index bd6571e0097a..644ba1255d3c 100644
--- a/drivers/gpio/langwell_gpio.c
+++ b/drivers/gpio/langwell_gpio.c
@@ -223,7 +223,7 @@ static void lnw_irq_handler(unsigned irq, struct irq_desc *desc)
223 gedr = gpio_reg(&lnw->chip, base, GEDR); 223 gedr = gpio_reg(&lnw->chip, base, GEDR);
224 pending = readl(gedr); 224 pending = readl(gedr);
225 while (pending) { 225 while (pending) {
226 gpio = __ffs(pending) - 1; 226 gpio = __ffs(pending);
227 mask = BIT(gpio); 227 mask = BIT(gpio);
228 pending &= ~mask; 228 pending &= ~mask;
229 /* Clear before handling so we can't lose an edge */ 229 /* Clear before handling so we can't lose an edge */
diff --git a/drivers/gpio/tps65910-gpio.c b/drivers/gpio/tps65910-gpio.c
index 8d1ddfdd63eb..15097ca616d6 100644
--- a/drivers/gpio/tps65910-gpio.c
+++ b/drivers/gpio/tps65910-gpio.c
@@ -81,8 +81,10 @@ void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base)
81 switch(tps65910_chip_id(tps65910)) { 81 switch(tps65910_chip_id(tps65910)) {
82 case TPS65910: 82 case TPS65910:
83 tps65910->gpio.ngpio = 6; 83 tps65910->gpio.ngpio = 6;
84 break;
84 case TPS65911: 85 case TPS65911:
85 tps65910->gpio.ngpio = 9; 86 tps65910->gpio.ngpio = 9;
87 break;
86 default: 88 default:
87 return; 89 return;
88 } 90 }
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 21058e6ad2b8..82db18506662 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -886,9 +886,6 @@ int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group)
886 total_objects += dev->mode_config.num_connector; 886 total_objects += dev->mode_config.num_connector;
887 total_objects += dev->mode_config.num_encoder; 887 total_objects += dev->mode_config.num_encoder;
888 888
889 if (total_objects == 0)
890 return -EINVAL;
891
892 group->id_list = kzalloc(total_objects * sizeof(uint32_t), GFP_KERNEL); 889 group->id_list = kzalloc(total_objects * sizeof(uint32_t), GFP_KERNEL);
893 if (!group->id_list) 890 if (!group->id_list)
894 return -ENOMEM; 891 return -ENOMEM;
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index e8a5ffb0124d..660f96401a05 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -985,17 +985,19 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav
985{ 985{
986 save->vga_control[0] = RREG32(D1VGA_CONTROL); 986 save->vga_control[0] = RREG32(D1VGA_CONTROL);
987 save->vga_control[1] = RREG32(D2VGA_CONTROL); 987 save->vga_control[1] = RREG32(D2VGA_CONTROL);
988 save->vga_control[2] = RREG32(EVERGREEN_D3VGA_CONTROL);
989 save->vga_control[3] = RREG32(EVERGREEN_D4VGA_CONTROL);
990 save->vga_control[4] = RREG32(EVERGREEN_D5VGA_CONTROL);
991 save->vga_control[5] = RREG32(EVERGREEN_D6VGA_CONTROL);
992 save->vga_render_control = RREG32(VGA_RENDER_CONTROL); 988 save->vga_render_control = RREG32(VGA_RENDER_CONTROL);
993 save->vga_hdp_control = RREG32(VGA_HDP_CONTROL); 989 save->vga_hdp_control = RREG32(VGA_HDP_CONTROL);
994 save->crtc_control[0] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET); 990 save->crtc_control[0] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET);
995 save->crtc_control[1] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET); 991 save->crtc_control[1] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET);
996 if (!(rdev->flags & RADEON_IS_IGP)) { 992 if (rdev->num_crtc >= 4) {
993 save->vga_control[2] = RREG32(EVERGREEN_D3VGA_CONTROL);
994 save->vga_control[3] = RREG32(EVERGREEN_D4VGA_CONTROL);
997 save->crtc_control[2] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET); 995 save->crtc_control[2] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET);
998 save->crtc_control[3] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET); 996 save->crtc_control[3] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET);
997 }
998 if (rdev->num_crtc >= 6) {
999 save->vga_control[4] = RREG32(EVERGREEN_D5VGA_CONTROL);
1000 save->vga_control[5] = RREG32(EVERGREEN_D6VGA_CONTROL);
999 save->crtc_control[4] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET); 1001 save->crtc_control[4] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET);
1000 save->crtc_control[5] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET); 1002 save->crtc_control[5] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET);
1001 } 1003 }
@@ -1004,35 +1006,45 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav
1004 WREG32(VGA_RENDER_CONTROL, 0); 1006 WREG32(VGA_RENDER_CONTROL, 0);
1005 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 1); 1007 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 1);
1006 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 1); 1008 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 1);
1007 if (!(rdev->flags & RADEON_IS_IGP)) { 1009 if (rdev->num_crtc >= 4) {
1008 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 1); 1010 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 1);
1009 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 1); 1011 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 1);
1012 }
1013 if (rdev->num_crtc >= 6) {
1010 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 1); 1014 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 1);
1011 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 1); 1015 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 1);
1012 } 1016 }
1013 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); 1017 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
1014 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); 1018 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
1015 if (!(rdev->flags & RADEON_IS_IGP)) { 1019 if (rdev->num_crtc >= 4) {
1016 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); 1020 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, 0);
1017 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); 1021 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, 0);
1022 }
1023 if (rdev->num_crtc >= 6) {
1018 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, 0); 1024 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, 0);
1019 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); 1025 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
1020 } 1026 }
1021 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); 1027 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
1022 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); 1028 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
1023 if (!(rdev->flags & RADEON_IS_IGP)) { 1029 if (rdev->num_crtc >= 4) {
1024 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); 1030 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0);
1025 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); 1031 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0);
1032 }
1033 if (rdev->num_crtc >= 6) {
1026 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0); 1034 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0);
1027 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); 1035 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
1028 } 1036 }
1029 1037
1030 WREG32(D1VGA_CONTROL, 0); 1038 WREG32(D1VGA_CONTROL, 0);
1031 WREG32(D2VGA_CONTROL, 0); 1039 WREG32(D2VGA_CONTROL, 0);
1032 WREG32(EVERGREEN_D3VGA_CONTROL, 0); 1040 if (rdev->num_crtc >= 4) {
1033 WREG32(EVERGREEN_D4VGA_CONTROL, 0); 1041 WREG32(EVERGREEN_D3VGA_CONTROL, 0);
1034 WREG32(EVERGREEN_D5VGA_CONTROL, 0); 1042 WREG32(EVERGREEN_D4VGA_CONTROL, 0);
1035 WREG32(EVERGREEN_D6VGA_CONTROL, 0); 1043 }
1044 if (rdev->num_crtc >= 6) {
1045 WREG32(EVERGREEN_D5VGA_CONTROL, 0);
1046 WREG32(EVERGREEN_D6VGA_CONTROL, 0);
1047 }
1036} 1048}
1037 1049
1038void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *save) 1050void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *save)
@@ -1055,7 +1067,7 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s
1055 WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + EVERGREEN_CRTC1_REGISTER_OFFSET, 1067 WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + EVERGREEN_CRTC1_REGISTER_OFFSET,
1056 (u32)rdev->mc.vram_start); 1068 (u32)rdev->mc.vram_start);
1057 1069
1058 if (!(rdev->flags & RADEON_IS_IGP)) { 1070 if (rdev->num_crtc >= 4) {
1059 WREG32(EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH + EVERGREEN_CRTC2_REGISTER_OFFSET, 1071 WREG32(EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH + EVERGREEN_CRTC2_REGISTER_OFFSET,
1060 upper_32_bits(rdev->mc.vram_start)); 1072 upper_32_bits(rdev->mc.vram_start));
1061 WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH + EVERGREEN_CRTC2_REGISTER_OFFSET, 1073 WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH + EVERGREEN_CRTC2_REGISTER_OFFSET,
@@ -1073,7 +1085,8 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s
1073 (u32)rdev->mc.vram_start); 1085 (u32)rdev->mc.vram_start);
1074 WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + EVERGREEN_CRTC3_REGISTER_OFFSET, 1086 WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + EVERGREEN_CRTC3_REGISTER_OFFSET,
1075 (u32)rdev->mc.vram_start); 1087 (u32)rdev->mc.vram_start);
1076 1088 }
1089 if (rdev->num_crtc >= 6) {
1077 WREG32(EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH + EVERGREEN_CRTC4_REGISTER_OFFSET, 1090 WREG32(EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH + EVERGREEN_CRTC4_REGISTER_OFFSET,
1078 upper_32_bits(rdev->mc.vram_start)); 1091 upper_32_bits(rdev->mc.vram_start));
1079 WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH + EVERGREEN_CRTC4_REGISTER_OFFSET, 1092 WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH + EVERGREEN_CRTC4_REGISTER_OFFSET,
@@ -1101,31 +1114,41 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s
1101 /* Restore video state */ 1114 /* Restore video state */
1102 WREG32(D1VGA_CONTROL, save->vga_control[0]); 1115 WREG32(D1VGA_CONTROL, save->vga_control[0]);
1103 WREG32(D2VGA_CONTROL, save->vga_control[1]); 1116 WREG32(D2VGA_CONTROL, save->vga_control[1]);
1104 WREG32(EVERGREEN_D3VGA_CONTROL, save->vga_control[2]); 1117 if (rdev->num_crtc >= 4) {
1105 WREG32(EVERGREEN_D4VGA_CONTROL, save->vga_control[3]); 1118 WREG32(EVERGREEN_D3VGA_CONTROL, save->vga_control[2]);
1106 WREG32(EVERGREEN_D5VGA_CONTROL, save->vga_control[4]); 1119 WREG32(EVERGREEN_D4VGA_CONTROL, save->vga_control[3]);
1107 WREG32(EVERGREEN_D6VGA_CONTROL, save->vga_control[5]); 1120 }
1121 if (rdev->num_crtc >= 6) {
1122 WREG32(EVERGREEN_D5VGA_CONTROL, save->vga_control[4]);
1123 WREG32(EVERGREEN_D6VGA_CONTROL, save->vga_control[5]);
1124 }
1108 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 1); 1125 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 1);
1109 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 1); 1126 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 1);
1110 if (!(rdev->flags & RADEON_IS_IGP)) { 1127 if (rdev->num_crtc >= 4) {
1111 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 1); 1128 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 1);
1112 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 1); 1129 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 1);
1130 }
1131 if (rdev->num_crtc >= 6) {
1113 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 1); 1132 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 1);
1114 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 1); 1133 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 1);
1115 } 1134 }
1116 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, save->crtc_control[0]); 1135 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, save->crtc_control[0]);
1117 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, save->crtc_control[1]); 1136 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, save->crtc_control[1]);
1118 if (!(rdev->flags & RADEON_IS_IGP)) { 1137 if (rdev->num_crtc >= 4) {
1119 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, save->crtc_control[2]); 1138 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, save->crtc_control[2]);
1120 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, save->crtc_control[3]); 1139 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, save->crtc_control[3]);
1140 }
1141 if (rdev->num_crtc >= 6) {
1121 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, save->crtc_control[4]); 1142 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, save->crtc_control[4]);
1122 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, save->crtc_control[5]); 1143 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, save->crtc_control[5]);
1123 } 1144 }
1124 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); 1145 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
1125 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); 1146 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
1126 if (!(rdev->flags & RADEON_IS_IGP)) { 1147 if (rdev->num_crtc >= 4) {
1127 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); 1148 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0);
1128 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); 1149 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0);
1150 }
1151 if (rdev->num_crtc >= 6) {
1129 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0); 1152 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0);
1130 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); 1153 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
1131 } 1154 }
@@ -2417,18 +2440,22 @@ void evergreen_disable_interrupt_state(struct radeon_device *rdev)
2417 WREG32(GRBM_INT_CNTL, 0); 2440 WREG32(GRBM_INT_CNTL, 0);
2418 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); 2441 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
2419 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); 2442 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
2420 if (!(rdev->flags & RADEON_IS_IGP)) { 2443 if (rdev->num_crtc >= 4) {
2421 WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); 2444 WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0);
2422 WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); 2445 WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0);
2446 }
2447 if (rdev->num_crtc >= 6) {
2423 WREG32(INT_MASK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0); 2448 WREG32(INT_MASK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0);
2424 WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); 2449 WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
2425 } 2450 }
2426 2451
2427 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); 2452 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
2428 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); 2453 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
2429 if (!(rdev->flags & RADEON_IS_IGP)) { 2454 if (rdev->num_crtc >= 4) {
2430 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); 2455 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, 0);
2431 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); 2456 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, 0);
2457 }
2458 if (rdev->num_crtc >= 6) {
2432 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, 0); 2459 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, 0);
2433 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); 2460 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
2434 } 2461 }
@@ -2547,19 +2574,25 @@ int evergreen_irq_set(struct radeon_device *rdev)
2547 2574
2548 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, crtc1); 2575 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, crtc1);
2549 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, crtc2); 2576 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, crtc2);
2550 if (!(rdev->flags & RADEON_IS_IGP)) { 2577 if (rdev->num_crtc >= 4) {
2551 WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, crtc3); 2578 WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, crtc3);
2552 WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, crtc4); 2579 WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, crtc4);
2580 }
2581 if (rdev->num_crtc >= 6) {
2553 WREG32(INT_MASK + EVERGREEN_CRTC4_REGISTER_OFFSET, crtc5); 2582 WREG32(INT_MASK + EVERGREEN_CRTC4_REGISTER_OFFSET, crtc5);
2554 WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, crtc6); 2583 WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, crtc6);
2555 } 2584 }
2556 2585
2557 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, grph1); 2586 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, grph1);
2558 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, grph2); 2587 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, grph2);
2559 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, grph3); 2588 if (rdev->num_crtc >= 4) {
2560 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, grph4); 2589 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, grph3);
2561 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, grph5); 2590 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, grph4);
2562 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, grph6); 2591 }
2592 if (rdev->num_crtc >= 6) {
2593 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, grph5);
2594 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, grph6);
2595 }
2563 2596
2564 WREG32(DC_HPD1_INT_CONTROL, hpd1); 2597 WREG32(DC_HPD1_INT_CONTROL, hpd1);
2565 WREG32(DC_HPD2_INT_CONTROL, hpd2); 2598 WREG32(DC_HPD2_INT_CONTROL, hpd2);
@@ -2583,53 +2616,57 @@ static inline void evergreen_irq_ack(struct radeon_device *rdev)
2583 rdev->irq.stat_regs.evergreen.disp_int_cont5 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE5); 2616 rdev->irq.stat_regs.evergreen.disp_int_cont5 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE5);
2584 rdev->irq.stat_regs.evergreen.d1grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET); 2617 rdev->irq.stat_regs.evergreen.d1grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET);
2585 rdev->irq.stat_regs.evergreen.d2grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET); 2618 rdev->irq.stat_regs.evergreen.d2grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET);
2586 rdev->irq.stat_regs.evergreen.d3grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET); 2619 if (rdev->num_crtc >= 4) {
2587 rdev->irq.stat_regs.evergreen.d4grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET); 2620 rdev->irq.stat_regs.evergreen.d3grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET);
2588 rdev->irq.stat_regs.evergreen.d5grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET); 2621 rdev->irq.stat_regs.evergreen.d4grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET);
2589 rdev->irq.stat_regs.evergreen.d6grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET); 2622 }
2623 if (rdev->num_crtc >= 6) {
2624 rdev->irq.stat_regs.evergreen.d5grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET);
2625 rdev->irq.stat_regs.evergreen.d6grph_int = RREG32(GRPH_INT_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET);
2626 }
2590 2627
2591 if (rdev->irq.stat_regs.evergreen.d1grph_int & GRPH_PFLIP_INT_OCCURRED) 2628 if (rdev->irq.stat_regs.evergreen.d1grph_int & GRPH_PFLIP_INT_OCCURRED)
2592 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR); 2629 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR);
2593 if (rdev->irq.stat_regs.evergreen.d2grph_int & GRPH_PFLIP_INT_OCCURRED) 2630 if (rdev->irq.stat_regs.evergreen.d2grph_int & GRPH_PFLIP_INT_OCCURRED)
2594 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR); 2631 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR);
2595 if (rdev->irq.stat_regs.evergreen.d3grph_int & GRPH_PFLIP_INT_OCCURRED)
2596 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR);
2597 if (rdev->irq.stat_regs.evergreen.d4grph_int & GRPH_PFLIP_INT_OCCURRED)
2598 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR);
2599 if (rdev->irq.stat_regs.evergreen.d5grph_int & GRPH_PFLIP_INT_OCCURRED)
2600 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR);
2601 if (rdev->irq.stat_regs.evergreen.d6grph_int & GRPH_PFLIP_INT_OCCURRED)
2602 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR);
2603
2604 if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT) 2632 if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT)
2605 WREG32(VBLANK_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET, VBLANK_ACK); 2633 WREG32(VBLANK_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET, VBLANK_ACK);
2606 if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VLINE_INTERRUPT) 2634 if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VLINE_INTERRUPT)
2607 WREG32(VLINE_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET, VLINE_ACK); 2635 WREG32(VLINE_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET, VLINE_ACK);
2608
2609 if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT) 2636 if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT)
2610 WREG32(VBLANK_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET, VBLANK_ACK); 2637 WREG32(VBLANK_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET, VBLANK_ACK);
2611 if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VLINE_INTERRUPT) 2638 if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VLINE_INTERRUPT)
2612 WREG32(VLINE_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET, VLINE_ACK); 2639 WREG32(VLINE_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET, VLINE_ACK);
2613 2640
2614 if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT) 2641 if (rdev->num_crtc >= 4) {
2615 WREG32(VBLANK_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET, VBLANK_ACK); 2642 if (rdev->irq.stat_regs.evergreen.d3grph_int & GRPH_PFLIP_INT_OCCURRED)
2616 if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VLINE_INTERRUPT) 2643 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR);
2617 WREG32(VLINE_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET, VLINE_ACK); 2644 if (rdev->irq.stat_regs.evergreen.d4grph_int & GRPH_PFLIP_INT_OCCURRED)
2618 2645 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR);
2619 if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT) 2646 if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT)
2620 WREG32(VBLANK_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET, VBLANK_ACK); 2647 WREG32(VBLANK_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET, VBLANK_ACK);
2621 if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VLINE_INTERRUPT) 2648 if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VLINE_INTERRUPT)
2622 WREG32(VLINE_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET, VLINE_ACK); 2649 WREG32(VLINE_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET, VLINE_ACK);
2623 2650 if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT)
2624 if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT) 2651 WREG32(VBLANK_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET, VBLANK_ACK);
2625 WREG32(VBLANK_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET, VBLANK_ACK); 2652 if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VLINE_INTERRUPT)
2626 if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VLINE_INTERRUPT) 2653 WREG32(VLINE_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET, VLINE_ACK);
2627 WREG32(VLINE_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET, VLINE_ACK); 2654 }
2628 2655
2629 if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT) 2656 if (rdev->num_crtc >= 6) {
2630 WREG32(VBLANK_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET, VBLANK_ACK); 2657 if (rdev->irq.stat_regs.evergreen.d5grph_int & GRPH_PFLIP_INT_OCCURRED)
2631 if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VLINE_INTERRUPT) 2658 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR);
2632 WREG32(VLINE_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET, VLINE_ACK); 2659 if (rdev->irq.stat_regs.evergreen.d6grph_int & GRPH_PFLIP_INT_OCCURRED)
2660 WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET, GRPH_PFLIP_INT_CLEAR);
2661 if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT)
2662 WREG32(VBLANK_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET, VBLANK_ACK);
2663 if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VLINE_INTERRUPT)
2664 WREG32(VLINE_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET, VLINE_ACK);
2665 if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT)
2666 WREG32(VBLANK_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET, VBLANK_ACK);
2667 if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VLINE_INTERRUPT)
2668 WREG32(VLINE_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET, VLINE_ACK);
2669 }
2633 2670
2634 if (rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_INTERRUPT) { 2671 if (rdev->irq.stat_regs.evergreen.disp_int & DC_HPD1_INTERRUPT) {
2635 tmp = RREG32(DC_HPD1_INT_CONTROL); 2672 tmp = RREG32(DC_HPD1_INT_CONTROL);
@@ -3237,6 +3274,7 @@ void evergreen_fini(struct radeon_device *rdev)
3237 r700_cp_fini(rdev); 3274 r700_cp_fini(rdev);
3238 r600_irq_fini(rdev); 3275 r600_irq_fini(rdev);
3239 radeon_wb_fini(rdev); 3276 radeon_wb_fini(rdev);
3277 radeon_ib_pool_fini(rdev);
3240 radeon_irq_kms_fini(rdev); 3278 radeon_irq_kms_fini(rdev);
3241 evergreen_pcie_gart_fini(rdev); 3279 evergreen_pcie_gart_fini(rdev);
3242 radeon_gem_fini(rdev); 3280 radeon_gem_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index 1636e3449825..b7b2714f0b32 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -466,7 +466,7 @@
466#define IH_RB_WPTR_ADDR_LO 0x3e14 466#define IH_RB_WPTR_ADDR_LO 0x3e14
467#define IH_CNTL 0x3e18 467#define IH_CNTL 0x3e18
468# define ENABLE_INTR (1 << 0) 468# define ENABLE_INTR (1 << 0)
469# define IH_MC_SWAP(x) ((x) << 2) 469# define IH_MC_SWAP(x) ((x) << 1)
470# define IH_MC_SWAP_NONE 0 470# define IH_MC_SWAP_NONE 0
471# define IH_MC_SWAP_16BIT 1 471# define IH_MC_SWAP_16BIT 1
472# define IH_MC_SWAP_32BIT 2 472# define IH_MC_SWAP_32BIT 2
@@ -547,7 +547,7 @@
547# define LB_D5_VBLANK_INTERRUPT (1 << 3) 547# define LB_D5_VBLANK_INTERRUPT (1 << 3)
548# define DC_HPD5_INTERRUPT (1 << 17) 548# define DC_HPD5_INTERRUPT (1 << 17)
549# define DC_HPD5_RX_INTERRUPT (1 << 18) 549# define DC_HPD5_RX_INTERRUPT (1 << 18)
550#define DISP_INTERRUPT_STATUS_CONTINUE5 0x6050 550#define DISP_INTERRUPT_STATUS_CONTINUE5 0x6150
551# define LB_D6_VLINE_INTERRUPT (1 << 2) 551# define LB_D6_VLINE_INTERRUPT (1 << 2)
552# define LB_D6_VBLANK_INTERRUPT (1 << 3) 552# define LB_D6_VBLANK_INTERRUPT (1 << 3)
553# define DC_HPD6_INTERRUPT (1 << 17) 553# define DC_HPD6_INTERRUPT (1 << 17)
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 16caafeadf5e..559dbd412906 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1581,6 +1581,7 @@ void cayman_fini(struct radeon_device *rdev)
1581 cayman_cp_fini(rdev); 1581 cayman_cp_fini(rdev);
1582 r600_irq_fini(rdev); 1582 r600_irq_fini(rdev);
1583 radeon_wb_fini(rdev); 1583 radeon_wb_fini(rdev);
1584 radeon_ib_pool_fini(rdev);
1584 radeon_irq_kms_fini(rdev); 1585 radeon_irq_kms_fini(rdev);
1585 cayman_pcie_gart_fini(rdev); 1586 cayman_pcie_gart_fini(rdev);
1586 radeon_gem_fini(rdev); 1587 radeon_gem_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index f79d2ccb6755..bc54b26cb32f 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2628,6 +2628,7 @@ void r600_fini(struct radeon_device *rdev)
2628 r600_cp_fini(rdev); 2628 r600_cp_fini(rdev);
2629 r600_irq_fini(rdev); 2629 r600_irq_fini(rdev);
2630 radeon_wb_fini(rdev); 2630 radeon_wb_fini(rdev);
2631 radeon_ib_pool_fini(rdev);
2631 radeon_irq_kms_fini(rdev); 2632 radeon_irq_kms_fini(rdev);
2632 r600_pcie_gart_fini(rdev); 2633 r600_pcie_gart_fini(rdev);
2633 radeon_agp_fini(rdev); 2634 radeon_agp_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index f140a0d5cb54..0245ae6c204e 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -536,7 +536,7 @@
536#define IH_RB_WPTR_ADDR_LO 0x3e14 536#define IH_RB_WPTR_ADDR_LO 0x3e14
537#define IH_CNTL 0x3e18 537#define IH_CNTL 0x3e18
538# define ENABLE_INTR (1 << 0) 538# define ENABLE_INTR (1 << 0)
539# define IH_MC_SWAP(x) ((x) << 2) 539# define IH_MC_SWAP(x) ((x) << 1)
540# define IH_MC_SWAP_NONE 0 540# define IH_MC_SWAP_NONE 0
541# define IH_MC_SWAP_16BIT 1 541# define IH_MC_SWAP_16BIT 1
542# define IH_MC_SWAP_32BIT 2 542# define IH_MC_SWAP_32BIT 2
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 8bb347d23ca6..4de51891aa6d 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -1368,6 +1368,7 @@ void rv770_fini(struct radeon_device *rdev)
1368 r700_cp_fini(rdev); 1368 r700_cp_fini(rdev);
1369 r600_irq_fini(rdev); 1369 r600_irq_fini(rdev);
1370 radeon_wb_fini(rdev); 1370 radeon_wb_fini(rdev);
1371 radeon_ib_pool_fini(rdev);
1371 radeon_irq_kms_fini(rdev); 1372 radeon_irq_kms_fini(rdev);
1372 rv770_pcie_gart_fini(rdev); 1373 rv770_pcie_gart_fini(rdev);
1373 rv770_vram_scratch_fini(rdev); 1374 rv770_vram_scratch_fini(rdev);
diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c
index 1a6dfb6df1e7..d3b464b74ced 100644
--- a/drivers/hwmon/lm95241.c
+++ b/drivers/hwmon/lm95241.c
@@ -98,11 +98,16 @@ struct lm95241_data {
98}; 98};
99 99
100/* Conversions */ 100/* Conversions */
101static int TempFromReg(u8 val_h, u8 val_l) 101static int temp_from_reg_signed(u8 val_h, u8 val_l)
102{ 102{
103 if (val_h & 0x80) 103 s16 val_hl = (val_h << 8) | val_l;
104 return val_h - 0x100; 104 return val_hl * 1000 / 256;
105 return val_h * 1000 + val_l * 1000 / 256; 105}
106
107static int temp_from_reg_unsigned(u8 val_h, u8 val_l)
108{
109 u16 val_hl = (val_h << 8) | val_l;
110 return val_hl * 1000 / 256;
106} 111}
107 112
108static struct lm95241_data *lm95241_update_device(struct device *dev) 113static struct lm95241_data *lm95241_update_device(struct device *dev)
@@ -135,10 +140,13 @@ static ssize_t show_input(struct device *dev, struct device_attribute *attr,
135 char *buf) 140 char *buf)
136{ 141{
137 struct lm95241_data *data = lm95241_update_device(dev); 142 struct lm95241_data *data = lm95241_update_device(dev);
143 int index = to_sensor_dev_attr(attr)->index;
138 144
139 return snprintf(buf, PAGE_SIZE - 1, "%d\n", 145 return snprintf(buf, PAGE_SIZE - 1, "%d\n",
140 TempFromReg(data->temp[to_sensor_dev_attr(attr)->index], 146 index == 0 || (data->config & (1 << (index / 2))) ?
141 data->temp[to_sensor_dev_attr(attr)->index + 1])); 147 temp_from_reg_signed(data->temp[index], data->temp[index + 1]) :
148 temp_from_reg_unsigned(data->temp[index],
149 data->temp[index + 1]));
142} 150}
143 151
144static ssize_t show_type(struct device *dev, struct device_attribute *attr, 152static ssize_t show_type(struct device *dev, struct device_attribute *attr,
@@ -339,7 +347,7 @@ static int lm95241_detect(struct i2c_client *new_client,
339 if ((i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID) 347 if ((i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID)
340 == MANUFACTURER_ID) 348 == MANUFACTURER_ID)
341 && (i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID) 349 && (i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID)
342 >= DEFAULT_REVISION)) { 350 == DEFAULT_REVISION)) {
343 name = DEVNAME; 351 name = DEVNAME;
344 } else { 352 } else {
345 dev_dbg(&adapter->dev, "LM95241 detection failed at 0x%02x\n", 353 dev_dbg(&adapter->dev, "LM95241 detection failed at 0x%02x\n",
diff --git a/drivers/hwmon/pmbus.c b/drivers/hwmon/pmbus.c
index 931d940923ae..9b1f0c37ef77 100644
--- a/drivers/hwmon/pmbus.c
+++ b/drivers/hwmon/pmbus.c
@@ -59,16 +59,17 @@ static void pmbus_find_sensor_groups(struct i2c_client *client,
59 if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34)) 59 if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34))
60 info->func[0] |= PMBUS_HAVE_STATUS_FAN34; 60 info->func[0] |= PMBUS_HAVE_STATUS_FAN34;
61 } 61 }
62 if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) { 62 if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1))
63 info->func[0] |= PMBUS_HAVE_TEMP; 63 info->func[0] |= PMBUS_HAVE_TEMP;
64 if (pmbus_check_byte_register(client, 0,
65 PMBUS_STATUS_TEMPERATURE))
66 info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
67 }
68 if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2)) 64 if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2))
69 info->func[0] |= PMBUS_HAVE_TEMP2; 65 info->func[0] |= PMBUS_HAVE_TEMP2;
70 if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3)) 66 if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3))
71 info->func[0] |= PMBUS_HAVE_TEMP3; 67 info->func[0] |= PMBUS_HAVE_TEMP3;
68 if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2
69 | PMBUS_HAVE_TEMP3)
70 && pmbus_check_byte_register(client, 0,
71 PMBUS_STATUS_TEMPERATURE))
72 info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
72 73
73 /* Sensors detected on all pages */ 74 /* Sensors detected on all pages */
74 for (page = 0; page < info->pages; page++) { 75 for (page = 0; page < info->pages; page++) {
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index 52b545a795f2..cbc98aea5b09 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -193,7 +193,13 @@ static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface,
193 return; 193 return;
194 } 194 }
195 if (twi_int_status & MCOMP) { 195 if (twi_int_status & MCOMP) {
196 if (iface->cur_mode == TWI_I2C_MODE_COMBINED) { 196 if ((read_MASTER_CTL(iface) & MEN) == 0 &&
197 (iface->cur_mode == TWI_I2C_MODE_REPEAT ||
198 iface->cur_mode == TWI_I2C_MODE_COMBINED)) {
199 iface->result = -1;
200 write_INT_MASK(iface, 0);
201 write_MASTER_CTL(iface, 0);
202 } else if (iface->cur_mode == TWI_I2C_MODE_COMBINED) {
197 if (iface->readNum == 0) { 203 if (iface->readNum == 0) {
198 /* set the read number to 1 and ask for manual 204 /* set the read number to 1 and ask for manual
199 * stop in block combine mode 205 * stop in block combine mode
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 6c00c107ebf3..f84a63c6dd97 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -248,12 +248,12 @@ static inline int is_msgend(struct s3c24xx_i2c *i2c)
248 return i2c->msg_ptr >= i2c->msg->len; 248 return i2c->msg_ptr >= i2c->msg->len;
249} 249}
250 250
251/* i2s_s3c_irq_nextbyte 251/* i2c_s3c_irq_nextbyte
252 * 252 *
253 * process an interrupt and work out what to do 253 * process an interrupt and work out what to do
254 */ 254 */
255 255
256static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat) 256static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
257{ 257{
258 unsigned long tmp; 258 unsigned long tmp;
259 unsigned char byte; 259 unsigned char byte;
@@ -264,7 +264,6 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
264 case STATE_IDLE: 264 case STATE_IDLE:
265 dev_err(i2c->dev, "%s: called in STATE_IDLE\n", __func__); 265 dev_err(i2c->dev, "%s: called in STATE_IDLE\n", __func__);
266 goto out; 266 goto out;
267 break;
268 267
269 case STATE_STOP: 268 case STATE_STOP:
270 dev_err(i2c->dev, "%s: called in STATE_STOP\n", __func__); 269 dev_err(i2c->dev, "%s: called in STATE_STOP\n", __func__);
@@ -444,7 +443,7 @@ static irqreturn_t s3c24xx_i2c_irq(int irqno, void *dev_id)
444 /* pretty much this leaves us with the fact that we've 443 /* pretty much this leaves us with the fact that we've
445 * transmitted or received whatever byte we last sent */ 444 * transmitted or received whatever byte we last sent */
446 445
447 i2s_s3c_irq_nextbyte(i2c, status); 446 i2c_s3c_irq_nextbyte(i2c, status);
448 447
449 out: 448 out:
450 return IRQ_HANDLED; 449 return IRQ_HANDLED;
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 4d9319665e32..fb3b4f8f8152 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -40,8 +40,10 @@
40#define I2C_CNFG_NEW_MASTER_FSM (1<<11) 40#define I2C_CNFG_NEW_MASTER_FSM (1<<11)
41#define I2C_STATUS 0x01C 41#define I2C_STATUS 0x01C
42#define I2C_SL_CNFG 0x020 42#define I2C_SL_CNFG 0x020
43#define I2C_SL_CNFG_NACK (1<<1)
43#define I2C_SL_CNFG_NEWSL (1<<2) 44#define I2C_SL_CNFG_NEWSL (1<<2)
44#define I2C_SL_ADDR1 0x02c 45#define I2C_SL_ADDR1 0x02c
46#define I2C_SL_ADDR2 0x030
45#define I2C_TX_FIFO 0x050 47#define I2C_TX_FIFO 0x050
46#define I2C_RX_FIFO 0x054 48#define I2C_RX_FIFO 0x054
47#define I2C_PACKET_TRANSFER_STATUS 0x058 49#define I2C_PACKET_TRANSFER_STATUS 0x058
@@ -337,7 +339,11 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
337 339
338 if (!i2c_dev->is_dvc) { 340 if (!i2c_dev->is_dvc) {
339 u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG); 341 u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG);
340 i2c_writel(i2c_dev, sl_cfg | I2C_SL_CNFG_NEWSL, I2C_SL_CNFG); 342 sl_cfg |= I2C_SL_CNFG_NACK | I2C_SL_CNFG_NEWSL;
343 i2c_writel(i2c_dev, sl_cfg, I2C_SL_CNFG);
344 i2c_writel(i2c_dev, 0xfc, I2C_SL_ADDR1);
345 i2c_writel(i2c_dev, 0x00, I2C_SL_ADDR2);
346
341 } 347 }
342 348
343 val = 7 << I2C_FIFO_CONTROL_TX_TRIG_SHIFT | 349 val = 7 << I2C_FIFO_CONTROL_TX_TRIG_SHIFT |
diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
index 40b02ae96f86..6229c3e8e78b 100644
--- a/drivers/input/keyboard/pmic8xxx-keypad.c
+++ b/drivers/input/keyboard/pmic8xxx-keypad.c
@@ -520,7 +520,8 @@ static void pmic8xxx_kp_close(struct input_dev *dev)
520 */ 520 */
521static int __devinit pmic8xxx_kp_probe(struct platform_device *pdev) 521static int __devinit pmic8xxx_kp_probe(struct platform_device *pdev)
522{ 522{
523 const struct pm8xxx_keypad_platform_data *pdata = mfd_get_data(pdev); 523 const struct pm8xxx_keypad_platform_data *pdata =
524 dev_get_platdata(&pdev->dev);
524 const struct matrix_keymap_data *keymap_data; 525 const struct matrix_keymap_data *keymap_data;
525 struct pmic8xxx_kp *kp; 526 struct pmic8xxx_kp *kp;
526 int rc; 527 int rc;
diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c
index 97e07e786e41..b3cfb9c71e66 100644
--- a/drivers/input/misc/pmic8xxx-pwrkey.c
+++ b/drivers/input/misc/pmic8xxx-pwrkey.c
@@ -90,7 +90,8 @@ static int __devinit pmic8xxx_pwrkey_probe(struct platform_device *pdev)
90 unsigned int delay; 90 unsigned int delay;
91 u8 pon_cntl; 91 u8 pon_cntl;
92 struct pmic8xxx_pwrkey *pwrkey; 92 struct pmic8xxx_pwrkey *pwrkey;
93 const struct pm8xxx_pwrkey_platform_data *pdata = mfd_get_data(pdev); 93 const struct pm8xxx_pwrkey_platform_data *pdata =
94 dev_get_platdata(&pdev->dev);
94 95
95 if (!pdata) { 96 if (!pdata) {
96 dev_err(&pdev->dev, "power key platform data not supplied\n"); 97 dev_err(&pdev->dev, "power key platform data not supplied\n");
diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index d8d3a1e910a1..a2c874623e35 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -88,7 +88,7 @@ static const struct pca9532_chip_info pca9532_chip_info_tbl[] = {
88 88
89static struct i2c_driver pca9532_driver = { 89static struct i2c_driver pca9532_driver = {
90 .driver = { 90 .driver = {
91 .name = "pca953x", 91 .name = "leds-pca953x",
92 }, 92 },
93 .probe = pca9532_probe, 93 .probe = pca9532_probe,
94 .remove = pca9532_remove, 94 .remove = pca9532_remove,
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
index 8fa539dde1b4..7f7079b12f23 100644
--- a/drivers/media/rc/fintek-cir.c
+++ b/drivers/media/rc/fintek-cir.c
@@ -597,12 +597,17 @@ static void __devexit fintek_remove(struct pnp_dev *pdev)
597static int fintek_suspend(struct pnp_dev *pdev, pm_message_t state) 597static int fintek_suspend(struct pnp_dev *pdev, pm_message_t state)
598{ 598{
599 struct fintek_dev *fintek = pnp_get_drvdata(pdev); 599 struct fintek_dev *fintek = pnp_get_drvdata(pdev);
600 unsigned long flags;
600 601
601 fit_dbg("%s called", __func__); 602 fit_dbg("%s called", __func__);
602 603
604 spin_lock_irqsave(&fintek->fintek_lock, flags);
605
603 /* disable all CIR interrupts */ 606 /* disable all CIR interrupts */
604 fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS); 607 fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS);
605 608
609 spin_unlock_irqrestore(&fintek->fintek_lock, flags);
610
606 fintek_config_mode_enable(fintek); 611 fintek_config_mode_enable(fintek);
607 612
608 /* disable cir logical dev */ 613 /* disable cir logical dev */
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 3f3c70716268..6bc35eeb653b 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -307,6 +307,14 @@ static const struct {
307 /* 0xffdc iMON MCE VFD */ 307 /* 0xffdc iMON MCE VFD */
308 { 0x00010000ffffffeell, KEY_VOLUMEUP }, 308 { 0x00010000ffffffeell, KEY_VOLUMEUP },
309 { 0x01000000ffffffeell, KEY_VOLUMEDOWN }, 309 { 0x01000000ffffffeell, KEY_VOLUMEDOWN },
310 { 0x00000001ffffffeell, KEY_MUTE },
311 { 0x0000000fffffffeell, KEY_MEDIA },
312 { 0x00000012ffffffeell, KEY_UP },
313 { 0x00000013ffffffeell, KEY_DOWN },
314 { 0x00000014ffffffeell, KEY_LEFT },
315 { 0x00000015ffffffeell, KEY_RIGHT },
316 { 0x00000016ffffffeell, KEY_ENTER },
317 { 0x00000017ffffffeell, KEY_ESC },
310 /* iMON Knob values */ 318 /* iMON Knob values */
311 { 0x000100ffffffffeell, KEY_VOLUMEUP }, 319 { 0x000100ffffffffeell, KEY_VOLUMEUP },
312 { 0x010000ffffffffeell, KEY_VOLUMEDOWN }, 320 { 0x010000ffffffffeell, KEY_VOLUMEDOWN },
@@ -1582,16 +1590,16 @@ static void imon_incoming_packet(struct imon_context *ictx,
1582 /* Only panel type events left to process now */ 1590 /* Only panel type events left to process now */
1583 spin_lock_irqsave(&ictx->kc_lock, flags); 1591 spin_lock_irqsave(&ictx->kc_lock, flags);
1584 1592
1593 do_gettimeofday(&t);
1585 /* KEY_MUTE repeats from knob need to be suppressed */ 1594 /* KEY_MUTE repeats from knob need to be suppressed */
1586 if (ictx->kc == KEY_MUTE && ictx->kc == ictx->last_keycode) { 1595 if (ictx->kc == KEY_MUTE && ictx->kc == ictx->last_keycode) {
1587 do_gettimeofday(&t);
1588 msec = tv2int(&t, &prev_time); 1596 msec = tv2int(&t, &prev_time);
1589 prev_time = t;
1590 if (msec < ictx->idev->rep[REP_DELAY]) { 1597 if (msec < ictx->idev->rep[REP_DELAY]) {
1591 spin_unlock_irqrestore(&ictx->kc_lock, flags); 1598 spin_unlock_irqrestore(&ictx->kc_lock, flags);
1592 return; 1599 return;
1593 } 1600 }
1594 } 1601 }
1602 prev_time = t;
1595 kc = ictx->kc; 1603 kc = ictx->kc;
1596 1604
1597 spin_unlock_irqrestore(&ictx->kc_lock, flags); 1605 spin_unlock_irqrestore(&ictx->kc_lock, flags);
@@ -1603,7 +1611,9 @@ static void imon_incoming_packet(struct imon_context *ictx,
1603 input_report_key(ictx->idev, kc, 0); 1611 input_report_key(ictx->idev, kc, 0);
1604 input_sync(ictx->idev); 1612 input_sync(ictx->idev);
1605 1613
1614 spin_lock_irqsave(&ictx->kc_lock, flags);
1606 ictx->last_keycode = kc; 1615 ictx->last_keycode = kc;
1616 spin_unlock_irqrestore(&ictx->kc_lock, flags);
1607 1617
1608 return; 1618 return;
1609 1619
@@ -1740,6 +1750,8 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1740 detected_display_type = IMON_DISPLAY_TYPE_VFD; 1750 detected_display_type = IMON_DISPLAY_TYPE_VFD;
1741 break; 1751 break;
1742 /* iMON VFD, MCE IR */ 1752 /* iMON VFD, MCE IR */
1753 case 0x46:
1754 case 0x7e:
1743 case 0x9e: 1755 case 0x9e:
1744 dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR"); 1756 dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR");
1745 detected_display_type = IMON_DISPLAY_TYPE_VFD; 1757 detected_display_type = IMON_DISPLAY_TYPE_VFD;
@@ -1755,6 +1767,9 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1755 dev_info(ictx->dev, "Unknown 0xffdc device, " 1767 dev_info(ictx->dev, "Unknown 0xffdc device, "
1756 "defaulting to VFD and iMON IR"); 1768 "defaulting to VFD and iMON IR");
1757 detected_display_type = IMON_DISPLAY_TYPE_VFD; 1769 detected_display_type = IMON_DISPLAY_TYPE_VFD;
1770 /* We don't know which one it is, allow user to set the
1771 * RC6 one from userspace if OTHER wasn't correct. */
1772 allowed_protos |= RC_TYPE_RC6;
1758 break; 1773 break;
1759 } 1774 }
1760 1775
diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c
index 11c19d8d0ee0..423ed45d6c55 100644
--- a/drivers/media/rc/ir-raw.c
+++ b/drivers/media/rc/ir-raw.c
@@ -114,18 +114,20 @@ int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type)
114 s64 delta; /* ns */ 114 s64 delta; /* ns */
115 DEFINE_IR_RAW_EVENT(ev); 115 DEFINE_IR_RAW_EVENT(ev);
116 int rc = 0; 116 int rc = 0;
117 int delay;
117 118
118 if (!dev->raw) 119 if (!dev->raw)
119 return -EINVAL; 120 return -EINVAL;
120 121
121 now = ktime_get(); 122 now = ktime_get();
122 delta = ktime_to_ns(ktime_sub(now, dev->raw->last_event)); 123 delta = ktime_to_ns(ktime_sub(now, dev->raw->last_event));
124 delay = MS_TO_NS(dev->input_dev->rep[REP_DELAY]);
123 125
124 /* Check for a long duration since last event or if we're 126 /* Check for a long duration since last event or if we're
125 * being called for the first time, note that delta can't 127 * being called for the first time, note that delta can't
126 * possibly be negative. 128 * possibly be negative.
127 */ 129 */
128 if (delta > IR_MAX_DURATION || !dev->raw->last_type) 130 if (delta > delay || !dev->raw->last_type)
129 type |= IR_START_EVENT; 131 type |= IR_START_EVENT;
130 else 132 else
131 ev.duration = delta; 133 ev.duration = delta;
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index e716b931cf7e..ecd3d0280768 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -1347,6 +1347,7 @@ static const struct ite_dev_params ite_dev_descs[] = {
1347 { /* 0: ITE8704 */ 1347 { /* 0: ITE8704 */
1348 .model = "ITE8704 CIR transceiver", 1348 .model = "ITE8704 CIR transceiver",
1349 .io_region_size = IT87_IOREG_LENGTH, 1349 .io_region_size = IT87_IOREG_LENGTH,
1350 .io_rsrc_no = 0,
1350 .hw_tx_capable = true, 1351 .hw_tx_capable = true,
1351 .sample_period = (u32) (1000000000ULL / 115200), 1352 .sample_period = (u32) (1000000000ULL / 115200),
1352 .tx_carrier_freq = 38000, 1353 .tx_carrier_freq = 38000,
@@ -1371,6 +1372,7 @@ static const struct ite_dev_params ite_dev_descs[] = {
1371 { /* 1: ITE8713 */ 1372 { /* 1: ITE8713 */
1372 .model = "ITE8713 CIR transceiver", 1373 .model = "ITE8713 CIR transceiver",
1373 .io_region_size = IT87_IOREG_LENGTH, 1374 .io_region_size = IT87_IOREG_LENGTH,
1375 .io_rsrc_no = 0,
1374 .hw_tx_capable = true, 1376 .hw_tx_capable = true,
1375 .sample_period = (u32) (1000000000ULL / 115200), 1377 .sample_period = (u32) (1000000000ULL / 115200),
1376 .tx_carrier_freq = 38000, 1378 .tx_carrier_freq = 38000,
@@ -1395,6 +1397,7 @@ static const struct ite_dev_params ite_dev_descs[] = {
1395 { /* 2: ITE8708 */ 1397 { /* 2: ITE8708 */
1396 .model = "ITE8708 CIR transceiver", 1398 .model = "ITE8708 CIR transceiver",
1397 .io_region_size = IT8708_IOREG_LENGTH, 1399 .io_region_size = IT8708_IOREG_LENGTH,
1400 .io_rsrc_no = 0,
1398 .hw_tx_capable = true, 1401 .hw_tx_capable = true,
1399 .sample_period = (u32) (1000000000ULL / 115200), 1402 .sample_period = (u32) (1000000000ULL / 115200),
1400 .tx_carrier_freq = 38000, 1403 .tx_carrier_freq = 38000,
@@ -1420,6 +1423,7 @@ static const struct ite_dev_params ite_dev_descs[] = {
1420 { /* 3: ITE8709 */ 1423 { /* 3: ITE8709 */
1421 .model = "ITE8709 CIR transceiver", 1424 .model = "ITE8709 CIR transceiver",
1422 .io_region_size = IT8709_IOREG_LENGTH, 1425 .io_region_size = IT8709_IOREG_LENGTH,
1426 .io_rsrc_no = 2,
1423 .hw_tx_capable = true, 1427 .hw_tx_capable = true,
1424 .sample_period = (u32) (1000000000ULL / 115200), 1428 .sample_period = (u32) (1000000000ULL / 115200),
1425 .tx_carrier_freq = 38000, 1429 .tx_carrier_freq = 38000,
@@ -1461,6 +1465,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1461 struct rc_dev *rdev = NULL; 1465 struct rc_dev *rdev = NULL;
1462 int ret = -ENOMEM; 1466 int ret = -ENOMEM;
1463 int model_no; 1467 int model_no;
1468 int io_rsrc_no;
1464 1469
1465 ite_dbg("%s called", __func__); 1470 ite_dbg("%s called", __func__);
1466 1471
@@ -1490,10 +1495,11 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1490 1495
1491 /* get the description for the device */ 1496 /* get the description for the device */
1492 dev_desc = &ite_dev_descs[model_no]; 1497 dev_desc = &ite_dev_descs[model_no];
1498 io_rsrc_no = dev_desc->io_rsrc_no;
1493 1499
1494 /* validate pnp resources */ 1500 /* validate pnp resources */
1495 if (!pnp_port_valid(pdev, 0) || 1501 if (!pnp_port_valid(pdev, io_rsrc_no) ||
1496 pnp_port_len(pdev, 0) != dev_desc->io_region_size) { 1502 pnp_port_len(pdev, io_rsrc_no) != dev_desc->io_region_size) {
1497 dev_err(&pdev->dev, "IR PNP Port not valid!\n"); 1503 dev_err(&pdev->dev, "IR PNP Port not valid!\n");
1498 goto failure; 1504 goto failure;
1499 } 1505 }
@@ -1504,7 +1510,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1504 } 1510 }
1505 1511
1506 /* store resource values */ 1512 /* store resource values */
1507 itdev->cir_addr = pnp_port_start(pdev, 0); 1513 itdev->cir_addr = pnp_port_start(pdev, io_rsrc_no);
1508 itdev->cir_irq = pnp_irq(pdev, 0); 1514 itdev->cir_irq = pnp_irq(pdev, 0);
1509 1515
1510 /* initialize spinlocks */ 1516 /* initialize spinlocks */
diff --git a/drivers/media/rc/ite-cir.h b/drivers/media/rc/ite-cir.h
index 16a19f5fd718..aa899a0b9750 100644
--- a/drivers/media/rc/ite-cir.h
+++ b/drivers/media/rc/ite-cir.h
@@ -57,6 +57,9 @@ struct ite_dev_params {
57 /* size of the I/O region */ 57 /* size of the I/O region */
58 int io_region_size; 58 int io_region_size;
59 59
60 /* IR pnp I/O resource number */
61 int io_rsrc_no;
62
60 /* true if the hardware supports transmission */ 63 /* true if the hardware supports transmission */
61 bool hw_tx_capable; 64 bool hw_tx_capable;
62 65
diff --git a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c
index bb10ffe086b4..8d558ae63456 100644
--- a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c
+++ b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c
@@ -15,43 +15,39 @@
15/* Pinnacle PCTV HD 800i mini remote */ 15/* Pinnacle PCTV HD 800i mini remote */
16 16
17static struct rc_map_table pinnacle_pctv_hd[] = { 17static struct rc_map_table pinnacle_pctv_hd[] = {
18 18 /* Key codes for the tiny Pinnacle remote*/
19 { 0x0f, KEY_1 }, 19 { 0x0700, KEY_MUTE },
20 { 0x15, KEY_2 }, 20 { 0x0701, KEY_MENU }, /* Pinnacle logo */
21 { 0x10, KEY_3 }, 21 { 0x0739, KEY_POWER },
22 { 0x18, KEY_4 }, 22 { 0x0703, KEY_VOLUMEUP },
23 { 0x1b, KEY_5 }, 23 { 0x0709, KEY_VOLUMEDOWN },
24 { 0x1e, KEY_6 }, 24 { 0x0706, KEY_CHANNELUP },
25 { 0x11, KEY_7 }, 25 { 0x070c, KEY_CHANNELDOWN },
26 { 0x21, KEY_8 }, 26 { 0x070f, KEY_1 },
27 { 0x12, KEY_9 }, 27 { 0x0715, KEY_2 },
28 { 0x27, KEY_0 }, 28 { 0x0710, KEY_3 },
29 29 { 0x0718, KEY_4 },
30 { 0x24, KEY_ZOOM }, 30 { 0x071b, KEY_5 },
31 { 0x2a, KEY_SUBTITLE }, 31 { 0x071e, KEY_6 },
32 32 { 0x0711, KEY_7 },
33 { 0x00, KEY_MUTE }, 33 { 0x0721, KEY_8 },
34 { 0x01, KEY_ENTER }, /* Pinnacle Logo */ 34 { 0x0712, KEY_9 },
35 { 0x39, KEY_POWER }, 35 { 0x0727, KEY_0 },
36 36 { 0x0724, KEY_ZOOM }, /* 'Square' key */
37 { 0x03, KEY_VOLUMEUP }, 37 { 0x072a, KEY_SUBTITLE }, /* 'T' key */
38 { 0x09, KEY_VOLUMEDOWN }, 38 { 0x072d, KEY_REWIND },
39 { 0x06, KEY_CHANNELUP }, 39 { 0x0730, KEY_PLAYPAUSE },
40 { 0x0c, KEY_CHANNELDOWN }, 40 { 0x0733, KEY_FASTFORWARD },
41 41 { 0x0736, KEY_RECORD },
42 { 0x2d, KEY_REWIND }, 42 { 0x073c, KEY_STOP },
43 { 0x30, KEY_PLAYPAUSE }, 43 { 0x073f, KEY_HELP }, /* '?' key */
44 { 0x33, KEY_FASTFORWARD },
45 { 0x3c, KEY_STOP },
46 { 0x36, KEY_RECORD },
47 { 0x3f, KEY_EPG }, /* Labeled "?" */
48}; 44};
49 45
50static struct rc_map_list pinnacle_pctv_hd_map = { 46static struct rc_map_list pinnacle_pctv_hd_map = {
51 .map = { 47 .map = {
52 .scan = pinnacle_pctv_hd, 48 .scan = pinnacle_pctv_hd,
53 .size = ARRAY_SIZE(pinnacle_pctv_hd), 49 .size = ARRAY_SIZE(pinnacle_pctv_hd),
54 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ 50 .rc_type = RC_TYPE_RC5,
55 .name = RC_MAP_PINNACLE_PCTV_HD, 51 .name = RC_MAP_PINNACLE_PCTV_HD,
56 } 52 }
57}; 53};
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index fd237ab120bb..27997a9ceb0d 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -55,6 +55,8 @@ struct irctl {
55 struct lirc_buffer *buf; 55 struct lirc_buffer *buf;
56 unsigned int chunk_size; 56 unsigned int chunk_size;
57 57
58 struct cdev *cdev;
59
58 struct task_struct *task; 60 struct task_struct *task;
59 long jiffies_to_wait; 61 long jiffies_to_wait;
60}; 62};
@@ -62,7 +64,6 @@ struct irctl {
62static DEFINE_MUTEX(lirc_dev_lock); 64static DEFINE_MUTEX(lirc_dev_lock);
63 65
64static struct irctl *irctls[MAX_IRCTL_DEVICES]; 66static struct irctl *irctls[MAX_IRCTL_DEVICES];
65static struct cdev cdevs[MAX_IRCTL_DEVICES];
66 67
67/* Only used for sysfs but defined to void otherwise */ 68/* Only used for sysfs but defined to void otherwise */
68static struct class *lirc_class; 69static struct class *lirc_class;
@@ -167,9 +168,13 @@ static struct file_operations lirc_dev_fops = {
167 168
168static int lirc_cdev_add(struct irctl *ir) 169static int lirc_cdev_add(struct irctl *ir)
169{ 170{
170 int retval; 171 int retval = -ENOMEM;
171 struct lirc_driver *d = &ir->d; 172 struct lirc_driver *d = &ir->d;
172 struct cdev *cdev = &cdevs[d->minor]; 173 struct cdev *cdev;
174
175 cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
176 if (!cdev)
177 goto err_out;
173 178
174 if (d->fops) { 179 if (d->fops) {
175 cdev_init(cdev, d->fops); 180 cdev_init(cdev, d->fops);
@@ -180,12 +185,20 @@ static int lirc_cdev_add(struct irctl *ir)
180 } 185 }
181 retval = kobject_set_name(&cdev->kobj, "lirc%d", d->minor); 186 retval = kobject_set_name(&cdev->kobj, "lirc%d", d->minor);
182 if (retval) 187 if (retval)
183 return retval; 188 goto err_out;
184 189
185 retval = cdev_add(cdev, MKDEV(MAJOR(lirc_base_dev), d->minor), 1); 190 retval = cdev_add(cdev, MKDEV(MAJOR(lirc_base_dev), d->minor), 1);
186 if (retval) 191 if (retval) {
187 kobject_put(&cdev->kobj); 192 kobject_put(&cdev->kobj);
193 goto err_out;
194 }
195
196 ir->cdev = cdev;
197
198 return 0;
188 199
200err_out:
201 kfree(cdev);
189 return retval; 202 return retval;
190} 203}
191 204
@@ -214,7 +227,7 @@ int lirc_register_driver(struct lirc_driver *d)
214 if (MAX_IRCTL_DEVICES <= d->minor) { 227 if (MAX_IRCTL_DEVICES <= d->minor) {
215 dev_err(d->dev, "lirc_dev: lirc_register_driver: " 228 dev_err(d->dev, "lirc_dev: lirc_register_driver: "
216 "\"minor\" must be between 0 and %d (%d)!\n", 229 "\"minor\" must be between 0 and %d (%d)!\n",
217 MAX_IRCTL_DEVICES-1, d->minor); 230 MAX_IRCTL_DEVICES - 1, d->minor);
218 err = -EBADRQC; 231 err = -EBADRQC;
219 goto out; 232 goto out;
220 } 233 }
@@ -369,7 +382,7 @@ int lirc_unregister_driver(int minor)
369 382
370 if (minor < 0 || minor >= MAX_IRCTL_DEVICES) { 383 if (minor < 0 || minor >= MAX_IRCTL_DEVICES) {
371 printk(KERN_ERR "lirc_dev: %s: minor (%d) must be between " 384 printk(KERN_ERR "lirc_dev: %s: minor (%d) must be between "
372 "0 and %d!\n", __func__, minor, MAX_IRCTL_DEVICES-1); 385 "0 and %d!\n", __func__, minor, MAX_IRCTL_DEVICES - 1);
373 return -EBADRQC; 386 return -EBADRQC;
374 } 387 }
375 388
@@ -380,7 +393,7 @@ int lirc_unregister_driver(int minor)
380 return -ENOENT; 393 return -ENOENT;
381 } 394 }
382 395
383 cdev = &cdevs[minor]; 396 cdev = ir->cdev;
384 397
385 mutex_lock(&lirc_dev_lock); 398 mutex_lock(&lirc_dev_lock);
386 399
@@ -410,6 +423,7 @@ int lirc_unregister_driver(int minor)
410 } else { 423 } else {
411 lirc_irctl_cleanup(ir); 424 lirc_irctl_cleanup(ir);
412 cdev_del(cdev); 425 cdev_del(cdev);
426 kfree(cdev);
413 kfree(ir); 427 kfree(ir);
414 irctls[minor] = NULL; 428 irctls[minor] = NULL;
415 } 429 }
@@ -453,7 +467,7 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file)
453 goto error; 467 goto error;
454 } 468 }
455 469
456 cdev = &cdevs[iminor(inode)]; 470 cdev = ir->cdev;
457 if (try_module_get(cdev->owner)) { 471 if (try_module_get(cdev->owner)) {
458 ir->open++; 472 ir->open++;
459 retval = ir->d.set_use_inc(ir->d.data); 473 retval = ir->d.set_use_inc(ir->d.data);
@@ -484,13 +498,15 @@ EXPORT_SYMBOL(lirc_dev_fop_open);
484int lirc_dev_fop_close(struct inode *inode, struct file *file) 498int lirc_dev_fop_close(struct inode *inode, struct file *file)
485{ 499{
486 struct irctl *ir = irctls[iminor(inode)]; 500 struct irctl *ir = irctls[iminor(inode)];
487 struct cdev *cdev = &cdevs[iminor(inode)]; 501 struct cdev *cdev;
488 502
489 if (!ir) { 503 if (!ir) {
490 printk(KERN_ERR "%s: called with invalid irctl\n", __func__); 504 printk(KERN_ERR "%s: called with invalid irctl\n", __func__);
491 return -EINVAL; 505 return -EINVAL;
492 } 506 }
493 507
508 cdev = ir->cdev;
509
494 dev_dbg(ir->d.dev, LOGHEAD "close called\n", ir->d.name, ir->d.minor); 510 dev_dbg(ir->d.dev, LOGHEAD "close called\n", ir->d.name, ir->d.minor);
495 511
496 WARN_ON(mutex_lock_killable(&lirc_dev_lock)); 512 WARN_ON(mutex_lock_killable(&lirc_dev_lock));
@@ -503,6 +519,7 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file)
503 lirc_irctl_cleanup(ir); 519 lirc_irctl_cleanup(ir);
504 cdev_del(cdev); 520 cdev_del(cdev);
505 irctls[ir->d.minor] = NULL; 521 irctls[ir->d.minor] = NULL;
522 kfree(cdev);
506 kfree(ir); 523 kfree(ir);
507 } 524 }
508 525
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index ad927fcaa020..06dfe0957b5e 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -108,6 +108,12 @@ static int debug = 1;
108static int debug; 108static int debug;
109#endif 109#endif
110 110
111#define mce_dbg(dev, fmt, ...) \
112 do { \
113 if (debug) \
114 dev_info(dev, fmt, ## __VA_ARGS__); \
115 } while (0)
116
111/* general constants */ 117/* general constants */
112#define SEND_FLAG_IN_PROGRESS 1 118#define SEND_FLAG_IN_PROGRESS 1
113#define SEND_FLAG_COMPLETE 2 119#define SEND_FLAG_COMPLETE 2
@@ -246,6 +252,9 @@ static struct usb_device_id mceusb_dev_table[] = {
246 .driver_info = MCE_GEN2_TX_INV }, 252 .driver_info = MCE_GEN2_TX_INV },
247 /* SMK eHome Infrared Transceiver */ 253 /* SMK eHome Infrared Transceiver */
248 { USB_DEVICE(VENDOR_SMK, 0x0338) }, 254 { USB_DEVICE(VENDOR_SMK, 0x0338) },
255 /* SMK/I-O Data GV-MC7/RCKIT Receiver */
256 { USB_DEVICE(VENDOR_SMK, 0x0353),
257 .driver_info = MCE_GEN2_NO_TX },
249 /* Tatung eHome Infrared Transceiver */ 258 /* Tatung eHome Infrared Transceiver */
250 { USB_DEVICE(VENDOR_TATUNG, 0x9150) }, 259 { USB_DEVICE(VENDOR_TATUNG, 0x9150) },
251 /* Shuttle eHome Infrared Transceiver */ 260 /* Shuttle eHome Infrared Transceiver */
@@ -606,12 +615,15 @@ static void mce_async_callback(struct urb *urb, struct pt_regs *regs)
606 if (ir) { 615 if (ir) {
607 len = urb->actual_length; 616 len = urb->actual_length;
608 617
609 dev_dbg(ir->dev, "callback called (status=%d len=%d)\n", 618 mce_dbg(ir->dev, "callback called (status=%d len=%d)\n",
610 urb->status, len); 619 urb->status, len);
611 620
612 mceusb_dev_printdata(ir, urb->transfer_buffer, 0, len, true); 621 mceusb_dev_printdata(ir, urb->transfer_buffer, 0, len, true);
613 } 622 }
614 623
624 /* the transfer buffer and urb were allocated in mce_request_packet */
625 kfree(urb->transfer_buffer);
626 usb_free_urb(urb);
615} 627}
616 628
617/* request incoming or send outgoing usb packet - used to initialize remote */ 629/* request incoming or send outgoing usb packet - used to initialize remote */
@@ -655,17 +667,17 @@ static void mce_request_packet(struct mceusb_dev *ir, unsigned char *data,
655 return; 667 return;
656 } 668 }
657 669
658 dev_dbg(dev, "receive request called (size=%#x)\n", size); 670 mce_dbg(dev, "receive request called (size=%#x)\n", size);
659 671
660 async_urb->transfer_buffer_length = size; 672 async_urb->transfer_buffer_length = size;
661 async_urb->dev = ir->usbdev; 673 async_urb->dev = ir->usbdev;
662 674
663 res = usb_submit_urb(async_urb, GFP_ATOMIC); 675 res = usb_submit_urb(async_urb, GFP_ATOMIC);
664 if (res) { 676 if (res) {
665 dev_dbg(dev, "receive request FAILED! (res=%d)\n", res); 677 mce_dbg(dev, "receive request FAILED! (res=%d)\n", res);
666 return; 678 return;
667 } 679 }
668 dev_dbg(dev, "receive request complete (res=%d)\n", res); 680 mce_dbg(dev, "receive request complete (res=%d)\n", res);
669} 681}
670 682
671static void mce_async_out(struct mceusb_dev *ir, unsigned char *data, int size) 683static void mce_async_out(struct mceusb_dev *ir, unsigned char *data, int size)
@@ -673,9 +685,9 @@ static void mce_async_out(struct mceusb_dev *ir, unsigned char *data, int size)
673 mce_request_packet(ir, data, size, MCEUSB_TX); 685 mce_request_packet(ir, data, size, MCEUSB_TX);
674} 686}
675 687
676static void mce_sync_in(struct mceusb_dev *ir, unsigned char *data, int size) 688static void mce_flush_rx_buffer(struct mceusb_dev *ir, int size)
677{ 689{
678 mce_request_packet(ir, data, size, MCEUSB_RX); 690 mce_request_packet(ir, NULL, size, MCEUSB_RX);
679} 691}
680 692
681/* Send data out the IR blaster port(s) */ 693/* Send data out the IR blaster port(s) */
@@ -794,7 +806,7 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier)
794 ir->carrier = carrier; 806 ir->carrier = carrier;
795 cmdbuf[2] = MCE_CMD_SIG_END; 807 cmdbuf[2] = MCE_CMD_SIG_END;
796 cmdbuf[3] = MCE_IRDATA_TRAILER; 808 cmdbuf[3] = MCE_IRDATA_TRAILER;
797 dev_dbg(ir->dev, "%s: disabling carrier " 809 mce_dbg(ir->dev, "%s: disabling carrier "
798 "modulation\n", __func__); 810 "modulation\n", __func__);
799 mce_async_out(ir, cmdbuf, sizeof(cmdbuf)); 811 mce_async_out(ir, cmdbuf, sizeof(cmdbuf));
800 return carrier; 812 return carrier;
@@ -806,7 +818,7 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier)
806 ir->carrier = carrier; 818 ir->carrier = carrier;
807 cmdbuf[2] = prescaler; 819 cmdbuf[2] = prescaler;
808 cmdbuf[3] = divisor; 820 cmdbuf[3] = divisor;
809 dev_dbg(ir->dev, "%s: requesting %u HZ " 821 mce_dbg(ir->dev, "%s: requesting %u HZ "
810 "carrier\n", __func__, carrier); 822 "carrier\n", __func__, carrier);
811 823
812 /* Transmit new carrier to mce device */ 824 /* Transmit new carrier to mce device */
@@ -879,7 +891,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
879 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) 891 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK)
880 * US_TO_NS(MCE_TIME_UNIT); 892 * US_TO_NS(MCE_TIME_UNIT);
881 893
882 dev_dbg(ir->dev, "Storing %s with duration %d\n", 894 mce_dbg(ir->dev, "Storing %s with duration %d\n",
883 rawir.pulse ? "pulse" : "space", 895 rawir.pulse ? "pulse" : "space",
884 rawir.duration); 896 rawir.duration);
885 897
@@ -911,7 +923,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
911 if (ir->parser_state != CMD_HEADER && !ir->rem) 923 if (ir->parser_state != CMD_HEADER && !ir->rem)
912 ir->parser_state = CMD_HEADER; 924 ir->parser_state = CMD_HEADER;
913 } 925 }
914 dev_dbg(ir->dev, "processed IR data, calling ir_raw_event_handle\n"); 926 mce_dbg(ir->dev, "processed IR data, calling ir_raw_event_handle\n");
915 ir_raw_event_handle(ir->rc); 927 ir_raw_event_handle(ir->rc);
916} 928}
917 929
@@ -933,7 +945,7 @@ static void mceusb_dev_recv(struct urb *urb, struct pt_regs *regs)
933 945
934 if (ir->send_flags == RECV_FLAG_IN_PROGRESS) { 946 if (ir->send_flags == RECV_FLAG_IN_PROGRESS) {
935 ir->send_flags = SEND_FLAG_COMPLETE; 947 ir->send_flags = SEND_FLAG_COMPLETE;
936 dev_dbg(ir->dev, "setup answer received %d bytes\n", 948 mce_dbg(ir->dev, "setup answer received %d bytes\n",
937 buf_len); 949 buf_len);
938 } 950 }
939 951
@@ -951,7 +963,7 @@ static void mceusb_dev_recv(struct urb *urb, struct pt_regs *regs)
951 963
952 case -EPIPE: 964 case -EPIPE:
953 default: 965 default:
954 dev_dbg(ir->dev, "Error: urb status = %d\n", urb->status); 966 mce_dbg(ir->dev, "Error: urb status = %d\n", urb->status);
955 break; 967 break;
956 } 968 }
957 969
@@ -961,7 +973,6 @@ static void mceusb_dev_recv(struct urb *urb, struct pt_regs *regs)
961static void mceusb_gen1_init(struct mceusb_dev *ir) 973static void mceusb_gen1_init(struct mceusb_dev *ir)
962{ 974{
963 int ret; 975 int ret;
964 int maxp = ir->len_in;
965 struct device *dev = ir->dev; 976 struct device *dev = ir->dev;
966 char *data; 977 char *data;
967 978
@@ -978,8 +989,8 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
978 ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), 989 ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0),
979 USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, 990 USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0,
980 data, USB_CTRL_MSG_SZ, HZ * 3); 991 data, USB_CTRL_MSG_SZ, HZ * 3);
981 dev_dbg(dev, "%s - ret = %d\n", __func__, ret); 992 mce_dbg(dev, "%s - ret = %d\n", __func__, ret);
982 dev_dbg(dev, "%s - data[0] = %d, data[1] = %d\n", 993 mce_dbg(dev, "%s - data[0] = %d, data[1] = %d\n",
983 __func__, data[0], data[1]); 994 __func__, data[0], data[1]);
984 995
985 /* set feature: bit rate 38400 bps */ 996 /* set feature: bit rate 38400 bps */
@@ -987,71 +998,56 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
987 USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, 998 USB_REQ_SET_FEATURE, USB_TYPE_VENDOR,
988 0xc04e, 0x0000, NULL, 0, HZ * 3); 999 0xc04e, 0x0000, NULL, 0, HZ * 3);
989 1000
990 dev_dbg(dev, "%s - ret = %d\n", __func__, ret); 1001 mce_dbg(dev, "%s - ret = %d\n", __func__, ret);
991 1002
992 /* bRequest 4: set char length to 8 bits */ 1003 /* bRequest 4: set char length to 8 bits */
993 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 1004 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
994 4, USB_TYPE_VENDOR, 1005 4, USB_TYPE_VENDOR,
995 0x0808, 0x0000, NULL, 0, HZ * 3); 1006 0x0808, 0x0000, NULL, 0, HZ * 3);
996 dev_dbg(dev, "%s - retB = %d\n", __func__, ret); 1007 mce_dbg(dev, "%s - retB = %d\n", __func__, ret);
997 1008
998 /* bRequest 2: set handshaking to use DTR/DSR */ 1009 /* bRequest 2: set handshaking to use DTR/DSR */
999 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 1010 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
1000 2, USB_TYPE_VENDOR, 1011 2, USB_TYPE_VENDOR,
1001 0x0000, 0x0100, NULL, 0, HZ * 3); 1012 0x0000, 0x0100, NULL, 0, HZ * 3);
1002 dev_dbg(dev, "%s - retC = %d\n", __func__, ret); 1013 mce_dbg(dev, "%s - retC = %d\n", __func__, ret);
1003 1014
1004 /* device reset */ 1015 /* device reset */
1005 mce_async_out(ir, DEVICE_RESET, sizeof(DEVICE_RESET)); 1016 mce_async_out(ir, DEVICE_RESET, sizeof(DEVICE_RESET));
1006 mce_sync_in(ir, NULL, maxp);
1007 1017
1008 /* get hw/sw revision? */ 1018 /* get hw/sw revision? */
1009 mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION)); 1019 mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION));
1010 mce_sync_in(ir, NULL, maxp);
1011 1020
1012 kfree(data); 1021 kfree(data);
1013}; 1022};
1014 1023
1015static void mceusb_gen2_init(struct mceusb_dev *ir) 1024static void mceusb_gen2_init(struct mceusb_dev *ir)
1016{ 1025{
1017 int maxp = ir->len_in;
1018
1019 /* device reset */ 1026 /* device reset */
1020 mce_async_out(ir, DEVICE_RESET, sizeof(DEVICE_RESET)); 1027 mce_async_out(ir, DEVICE_RESET, sizeof(DEVICE_RESET));
1021 mce_sync_in(ir, NULL, maxp);
1022 1028
1023 /* get hw/sw revision? */ 1029 /* get hw/sw revision? */
1024 mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION)); 1030 mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION));
1025 mce_sync_in(ir, NULL, maxp);
1026 1031
1027 /* unknown what the next two actually return... */ 1032 /* unknown what the next two actually return... */
1028 mce_async_out(ir, GET_UNKNOWN, sizeof(GET_UNKNOWN)); 1033 mce_async_out(ir, GET_UNKNOWN, sizeof(GET_UNKNOWN));
1029 mce_sync_in(ir, NULL, maxp);
1030 mce_async_out(ir, GET_UNKNOWN2, sizeof(GET_UNKNOWN2)); 1034 mce_async_out(ir, GET_UNKNOWN2, sizeof(GET_UNKNOWN2));
1031 mce_sync_in(ir, NULL, maxp);
1032} 1035}
1033 1036
1034static void mceusb_get_parameters(struct mceusb_dev *ir) 1037static void mceusb_get_parameters(struct mceusb_dev *ir)
1035{ 1038{
1036 int maxp = ir->len_in;
1037
1038 /* get the carrier and frequency */ 1039 /* get the carrier and frequency */
1039 mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); 1040 mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ));
1040 mce_sync_in(ir, NULL, maxp);
1041 1041
1042 if (!ir->flags.no_tx) { 1042 if (!ir->flags.no_tx)
1043 /* get the transmitter bitmask */ 1043 /* get the transmitter bitmask */
1044 mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); 1044 mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK));
1045 mce_sync_in(ir, NULL, maxp);
1046 }
1047 1045
1048 /* get receiver timeout value */ 1046 /* get receiver timeout value */
1049 mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); 1047 mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT));
1050 mce_sync_in(ir, NULL, maxp);
1051 1048
1052 /* get receiver sensor setting */ 1049 /* get receiver sensor setting */
1053 mce_async_out(ir, GET_RX_SENSOR, sizeof(GET_RX_SENSOR)); 1050 mce_async_out(ir, GET_RX_SENSOR, sizeof(GET_RX_SENSOR));
1054 mce_sync_in(ir, NULL, maxp);
1055} 1051}
1056 1052
1057static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) 1053static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
@@ -1122,7 +1118,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
1122 bool tx_mask_normal; 1118 bool tx_mask_normal;
1123 int ir_intfnum; 1119 int ir_intfnum;
1124 1120
1125 dev_dbg(&intf->dev, "%s called\n", __func__); 1121 mce_dbg(&intf->dev, "%s called\n", __func__);
1126 1122
1127 idesc = intf->cur_altsetting; 1123 idesc = intf->cur_altsetting;
1128 1124
@@ -1150,7 +1146,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
1150 ep_in = ep; 1146 ep_in = ep;
1151 ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; 1147 ep_in->bmAttributes = USB_ENDPOINT_XFER_INT;
1152 ep_in->bInterval = 1; 1148 ep_in->bInterval = 1;
1153 dev_dbg(&intf->dev, "acceptable inbound endpoint " 1149 mce_dbg(&intf->dev, "acceptable inbound endpoint "
1154 "found\n"); 1150 "found\n");
1155 } 1151 }
1156 1152
@@ -1165,12 +1161,12 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
1165 ep_out = ep; 1161 ep_out = ep;
1166 ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; 1162 ep_out->bmAttributes = USB_ENDPOINT_XFER_INT;
1167 ep_out->bInterval = 1; 1163 ep_out->bInterval = 1;
1168 dev_dbg(&intf->dev, "acceptable outbound endpoint " 1164 mce_dbg(&intf->dev, "acceptable outbound endpoint "
1169 "found\n"); 1165 "found\n");
1170 } 1166 }
1171 } 1167 }
1172 if (ep_in == NULL) { 1168 if (ep_in == NULL) {
1173 dev_dbg(&intf->dev, "inbound and/or endpoint not found\n"); 1169 mce_dbg(&intf->dev, "inbound and/or endpoint not found\n");
1174 return -ENODEV; 1170 return -ENODEV;
1175 } 1171 }
1176 1172
@@ -1215,16 +1211,16 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
1215 if (!ir->rc) 1211 if (!ir->rc)
1216 goto rc_dev_fail; 1212 goto rc_dev_fail;
1217 1213
1218 /* flush buffers on the device */
1219 mce_sync_in(ir, NULL, maxp);
1220 mce_sync_in(ir, NULL, maxp);
1221
1222 /* wire up inbound data handler */ 1214 /* wire up inbound data handler */
1223 usb_fill_int_urb(ir->urb_in, dev, pipe, ir->buf_in, 1215 usb_fill_int_urb(ir->urb_in, dev, pipe, ir->buf_in,
1224 maxp, (usb_complete_t) mceusb_dev_recv, ir, ep_in->bInterval); 1216 maxp, (usb_complete_t) mceusb_dev_recv, ir, ep_in->bInterval);
1225 ir->urb_in->transfer_dma = ir->dma_in; 1217 ir->urb_in->transfer_dma = ir->dma_in;
1226 ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 1218 ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1227 1219
1220 /* flush buffers on the device */
1221 mce_dbg(&intf->dev, "Flushing receive buffers\n");
1222 mce_flush_rx_buffer(ir, maxp);
1223
1228 /* initialize device */ 1224 /* initialize device */
1229 if (ir->flags.microsoft_gen1) 1225 if (ir->flags.microsoft_gen1)
1230 mceusb_gen1_init(ir); 1226 mceusb_gen1_init(ir);
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index bf3060ea6107..565f24c20d77 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -991,7 +991,6 @@ static int nvt_open(struct rc_dev *dev)
991 unsigned long flags; 991 unsigned long flags;
992 992
993 spin_lock_irqsave(&nvt->nvt_lock, flags); 993 spin_lock_irqsave(&nvt->nvt_lock, flags);
994 nvt->in_use = true;
995 nvt_enable_cir(nvt); 994 nvt_enable_cir(nvt);
996 spin_unlock_irqrestore(&nvt->nvt_lock, flags); 995 spin_unlock_irqrestore(&nvt->nvt_lock, flags);
997 996
@@ -1004,7 +1003,6 @@ static void nvt_close(struct rc_dev *dev)
1004 unsigned long flags; 1003 unsigned long flags;
1005 1004
1006 spin_lock_irqsave(&nvt->nvt_lock, flags); 1005 spin_lock_irqsave(&nvt->nvt_lock, flags);
1007 nvt->in_use = false;
1008 nvt_disable_cir(nvt); 1006 nvt_disable_cir(nvt);
1009 spin_unlock_irqrestore(&nvt->nvt_lock, flags); 1007 spin_unlock_irqrestore(&nvt->nvt_lock, flags);
1010} 1008}
diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h
index 379795d61ea7..1241fc89a36c 100644
--- a/drivers/media/rc/nuvoton-cir.h
+++ b/drivers/media/rc/nuvoton-cir.h
@@ -70,7 +70,6 @@ struct nvt_dev {
70 struct ir_raw_event rawir; 70 struct ir_raw_event rawir;
71 71
72 spinlock_t nvt_lock; 72 spinlock_t nvt_lock;
73 bool in_use;
74 73
75 /* for rx */ 74 /* for rx */
76 u8 buf[RX_BUF_LEN]; 75 u8 buf[RX_BUF_LEN];
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index f57cd5677ac2..3186ac7c2c10 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -522,18 +522,20 @@ EXPORT_SYMBOL_GPL(rc_g_keycode_from_table);
522/** 522/**
523 * ir_do_keyup() - internal function to signal the release of a keypress 523 * ir_do_keyup() - internal function to signal the release of a keypress
524 * @dev: the struct rc_dev descriptor of the device 524 * @dev: the struct rc_dev descriptor of the device
525 * @sync: whether or not to call input_sync
525 * 526 *
526 * This function is used internally to release a keypress, it must be 527 * This function is used internally to release a keypress, it must be
527 * called with keylock held. 528 * called with keylock held.
528 */ 529 */
529static void ir_do_keyup(struct rc_dev *dev) 530static void ir_do_keyup(struct rc_dev *dev, bool sync)
530{ 531{
531 if (!dev->keypressed) 532 if (!dev->keypressed)
532 return; 533 return;
533 534
534 IR_dprintk(1, "keyup key 0x%04x\n", dev->last_keycode); 535 IR_dprintk(1, "keyup key 0x%04x\n", dev->last_keycode);
535 input_report_key(dev->input_dev, dev->last_keycode, 0); 536 input_report_key(dev->input_dev, dev->last_keycode, 0);
536 input_sync(dev->input_dev); 537 if (sync)
538 input_sync(dev->input_dev);
537 dev->keypressed = false; 539 dev->keypressed = false;
538} 540}
539 541
@@ -549,7 +551,7 @@ void rc_keyup(struct rc_dev *dev)
549 unsigned long flags; 551 unsigned long flags;
550 552
551 spin_lock_irqsave(&dev->keylock, flags); 553 spin_lock_irqsave(&dev->keylock, flags);
552 ir_do_keyup(dev); 554 ir_do_keyup(dev, true);
553 spin_unlock_irqrestore(&dev->keylock, flags); 555 spin_unlock_irqrestore(&dev->keylock, flags);
554} 556}
555EXPORT_SYMBOL_GPL(rc_keyup); 557EXPORT_SYMBOL_GPL(rc_keyup);
@@ -578,7 +580,7 @@ static void ir_timer_keyup(unsigned long cookie)
578 */ 580 */
579 spin_lock_irqsave(&dev->keylock, flags); 581 spin_lock_irqsave(&dev->keylock, flags);
580 if (time_is_before_eq_jiffies(dev->keyup_jiffies)) 582 if (time_is_before_eq_jiffies(dev->keyup_jiffies))
581 ir_do_keyup(dev); 583 ir_do_keyup(dev, true);
582 spin_unlock_irqrestore(&dev->keylock, flags); 584 spin_unlock_irqrestore(&dev->keylock, flags);
583} 585}
584 586
@@ -597,6 +599,7 @@ void rc_repeat(struct rc_dev *dev)
597 spin_lock_irqsave(&dev->keylock, flags); 599 spin_lock_irqsave(&dev->keylock, flags);
598 600
599 input_event(dev->input_dev, EV_MSC, MSC_SCAN, dev->last_scancode); 601 input_event(dev->input_dev, EV_MSC, MSC_SCAN, dev->last_scancode);
602 input_sync(dev->input_dev);
600 603
601 if (!dev->keypressed) 604 if (!dev->keypressed)
602 goto out; 605 goto out;
@@ -622,29 +625,28 @@ EXPORT_SYMBOL_GPL(rc_repeat);
622static void ir_do_keydown(struct rc_dev *dev, int scancode, 625static void ir_do_keydown(struct rc_dev *dev, int scancode,
623 u32 keycode, u8 toggle) 626 u32 keycode, u8 toggle)
624{ 627{
625 input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode); 628 bool new_event = !dev->keypressed ||
626 629 dev->last_scancode != scancode ||
627 /* Repeat event? */ 630 dev->last_toggle != toggle;
628 if (dev->keypressed &&
629 dev->last_scancode == scancode &&
630 dev->last_toggle == toggle)
631 return;
632 631
633 /* Release old keypress */ 632 if (new_event && dev->keypressed)
634 ir_do_keyup(dev); 633 ir_do_keyup(dev, false);
635 634
636 dev->last_scancode = scancode; 635 input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode);
637 dev->last_toggle = toggle;
638 dev->last_keycode = keycode;
639 636
640 if (keycode == KEY_RESERVED) 637 if (new_event && keycode != KEY_RESERVED) {
641 return; 638 /* Register a keypress */
639 dev->keypressed = true;
640 dev->last_scancode = scancode;
641 dev->last_toggle = toggle;
642 dev->last_keycode = keycode;
643
644 IR_dprintk(1, "%s: key down event, "
645 "key 0x%04x, scancode 0x%04x\n",
646 dev->input_name, keycode, scancode);
647 input_report_key(dev->input_dev, keycode, 1);
648 }
642 649
643 /* Register a keypress */
644 dev->keypressed = true;
645 IR_dprintk(1, "%s: key down event, key 0x%04x, scancode 0x%04x\n",
646 dev->input_name, keycode, scancode);
647 input_report_key(dev->input_dev, dev->last_keycode, 1);
648 input_sync(dev->input_dev); 650 input_sync(dev->input_dev);
649} 651}
650 652
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index a97cf2750bd9..834a48394bce 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3474,7 +3474,7 @@ static int radio_s_tuner(struct file *file, void *priv,
3474 if (0 != t->index) 3474 if (0 != t->index)
3475 return -EINVAL; 3475 return -EINVAL;
3476 3476
3477 bttv_call_all(btv, tuner, g_tuner, t); 3477 bttv_call_all(btv, tuner, s_tuner, t);
3478 return 0; 3478 return 0;
3479} 3479}
3480 3480
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index 1933d4d11bf2..e80134f52ef5 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -695,14 +695,10 @@ static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
695 695
696 cx18_call_all(cx, tuner, g_tuner, vt); 696 cx18_call_all(cx, tuner, g_tuner, vt);
697 697
698 if (test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) { 698 if (vt->type == V4L2_TUNER_RADIO)
699 strlcpy(vt->name, "cx18 Radio Tuner", sizeof(vt->name)); 699 strlcpy(vt->name, "cx18 Radio Tuner", sizeof(vt->name));
700 vt->type = V4L2_TUNER_RADIO; 700 else
701 } else {
702 strlcpy(vt->name, "cx18 TV Tuner", sizeof(vt->name)); 701 strlcpy(vt->name, "cx18 TV Tuner", sizeof(vt->name));
703 vt->type = V4L2_TUNER_ANALOG_TV;
704 }
705
706 return 0; 702 return 0;
707} 703}
708 704
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index f9e347dae739..120c7d8e0895 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -1184,14 +1184,10 @@ static int ivtv_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
1184 1184
1185 ivtv_call_all(itv, tuner, g_tuner, vt); 1185 ivtv_call_all(itv, tuner, g_tuner, vt);
1186 1186
1187 if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) { 1187 if (vt->type == V4L2_TUNER_RADIO)
1188 strlcpy(vt->name, "ivtv Radio Tuner", sizeof(vt->name)); 1188 strlcpy(vt->name, "ivtv Radio Tuner", sizeof(vt->name));
1189 vt->type = V4L2_TUNER_RADIO; 1189 else
1190 } else {
1191 strlcpy(vt->name, "ivtv TV Tuner", sizeof(vt->name)); 1190 strlcpy(vt->name, "ivtv TV Tuner", sizeof(vt->name));
1192 vt->type = V4L2_TUNER_ANALOG_TV;
1193 }
1194
1195 return 0; 1191 return 0;
1196} 1192}
1197 1193
diff --git a/drivers/media/video/m5mols/m5mols.h b/drivers/media/video/m5mols/m5mols.h
index 10b55c854487..89d09a8914f8 100644
--- a/drivers/media/video/m5mols/m5mols.h
+++ b/drivers/media/video/m5mols/m5mols.h
@@ -2,10 +2,10 @@
2 * Header for M-5MOLS 8M Pixel camera sensor with ISP 2 * Header for M-5MOLS 8M Pixel camera sensor with ISP
3 * 3 *
4 * Copyright (C) 2011 Samsung Electronics Co., Ltd. 4 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
5 * Author: HeungJun Kim, riverful.kim@samsung.com 5 * Author: HeungJun Kim <riverful.kim@samsung.com>
6 * 6 *
7 * Copyright (C) 2009 Samsung Electronics Co., Ltd. 7 * Copyright (C) 2009 Samsung Electronics Co., Ltd.
8 * Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com 8 * Author: Dongsoo Nathaniel Kim <dongsoo45.kim@samsung.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -106,23 +106,23 @@ struct m5mols_capture {
106 * The each value according to each scenemode is recommended in the documents. 106 * The each value according to each scenemode is recommended in the documents.
107 */ 107 */
108struct m5mols_scenemode { 108struct m5mols_scenemode {
109 u32 metering; 109 u8 metering;
110 u32 ev_bias; 110 u8 ev_bias;
111 u32 wb_mode; 111 u8 wb_mode;
112 u32 wb_preset; 112 u8 wb_preset;
113 u32 chroma_en; 113 u8 chroma_en;
114 u32 chroma_lvl; 114 u8 chroma_lvl;
115 u32 edge_en; 115 u8 edge_en;
116 u32 edge_lvl; 116 u8 edge_lvl;
117 u32 af_range; 117 u8 af_range;
118 u32 fd_mode; 118 u8 fd_mode;
119 u32 mcc; 119 u8 mcc;
120 u32 light; 120 u8 light;
121 u32 flash; 121 u8 flash;
122 u32 tone; 122 u8 tone;
123 u32 iso; 123 u8 iso;
124 u32 capt_mode; 124 u8 capt_mode;
125 u32 wdr; 125 u8 wdr;
126}; 126};
127 127
128/** 128/**
@@ -154,7 +154,6 @@ struct m5mols_version {
154 u8 str[VERSION_STRING_SIZE]; 154 u8 str[VERSION_STRING_SIZE];
155 u8 af; 155 u8 af;
156}; 156};
157#define VERSION_SIZE sizeof(struct m5mols_version)
158 157
159/** 158/**
160 * struct m5mols_info - M-5MOLS driver data structure 159 * struct m5mols_info - M-5MOLS driver data structure
@@ -216,9 +215,9 @@ struct m5mols_info {
216 bool lock_ae; 215 bool lock_ae;
217 bool lock_awb; 216 bool lock_awb;
218 u8 resolution; 217 u8 resolution;
219 u32 interrupt; 218 u8 interrupt;
220 u32 mode; 219 u8 mode;
221 u32 mode_save; 220 u8 mode_save;
222 int (*set_power)(struct device *dev, int on); 221 int (*set_power)(struct device *dev, int on);
223}; 222};
224 223
@@ -256,9 +255,11 @@ struct m5mols_info {
256 * +-------+---+----------+-----+------+------+------+------+ 255 * +-------+---+----------+-----+------+------+------+------+
257 * - d[0..3]: according to size1 256 * - d[0..3]: according to size1
258 */ 257 */
259int m5mols_read(struct v4l2_subdev *sd, u32 reg_comb, u32 *val); 258int m5mols_read_u8(struct v4l2_subdev *sd, u32 reg_comb, u8 *val);
259int m5mols_read_u16(struct v4l2_subdev *sd, u32 reg_comb, u16 *val);
260int m5mols_read_u32(struct v4l2_subdev *sd, u32 reg_comb, u32 *val);
260int m5mols_write(struct v4l2_subdev *sd, u32 reg_comb, u32 val); 261int m5mols_write(struct v4l2_subdev *sd, u32 reg_comb, u32 val);
261int m5mols_busy(struct v4l2_subdev *sd, u8 category, u8 cmd, u32 value); 262int m5mols_busy(struct v4l2_subdev *sd, u8 category, u8 cmd, u8 value);
262 263
263/* 264/*
264 * Mode operation of the M-5MOLS 265 * Mode operation of the M-5MOLS
@@ -280,12 +281,12 @@ int m5mols_busy(struct v4l2_subdev *sd, u8 category, u8 cmd, u32 value);
280 * The available executing order between each modes are as follows: 281 * The available executing order between each modes are as follows:
281 * PARAMETER <---> MONITOR <---> CAPTURE 282 * PARAMETER <---> MONITOR <---> CAPTURE
282 */ 283 */
283int m5mols_mode(struct m5mols_info *info, u32 mode); 284int m5mols_mode(struct m5mols_info *info, u8 mode);
284 285
285int m5mols_enable_interrupt(struct v4l2_subdev *sd, u32 reg); 286int m5mols_enable_interrupt(struct v4l2_subdev *sd, u8 reg);
286int m5mols_sync_controls(struct m5mols_info *info); 287int m5mols_sync_controls(struct m5mols_info *info);
287int m5mols_start_capture(struct m5mols_info *info); 288int m5mols_start_capture(struct m5mols_info *info);
288int m5mols_do_scenemode(struct m5mols_info *info, u32 mode); 289int m5mols_do_scenemode(struct m5mols_info *info, u8 mode);
289int m5mols_lock_3a(struct m5mols_info *info, bool lock); 290int m5mols_lock_3a(struct m5mols_info *info, bool lock);
290int m5mols_set_ctrl(struct v4l2_ctrl *ctrl); 291int m5mols_set_ctrl(struct v4l2_ctrl *ctrl);
291 292
diff --git a/drivers/media/video/m5mols/m5mols_capture.c b/drivers/media/video/m5mols/m5mols_capture.c
index d71a3903b60f..d9471928369d 100644
--- a/drivers/media/video/m5mols/m5mols_capture.c
+++ b/drivers/media/video/m5mols/m5mols_capture.c
@@ -2,10 +2,10 @@
2 * The Capture code for Fujitsu M-5MOLS ISP 2 * The Capture code for Fujitsu M-5MOLS ISP
3 * 3 *
4 * Copyright (C) 2011 Samsung Electronics Co., Ltd. 4 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
5 * Author: HeungJun Kim, riverful.kim@samsung.com 5 * Author: HeungJun Kim <riverful.kim@samsung.com>
6 * 6 *
7 * Copyright (C) 2009 Samsung Electronics Co., Ltd. 7 * Copyright (C) 2009 Samsung Electronics Co., Ltd.
8 * Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com 8 * Author: Dongsoo Nathaniel Kim <dongsoo45.kim@samsung.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -58,9 +58,9 @@ static int m5mols_read_rational(struct v4l2_subdev *sd, u32 addr_num,
58{ 58{
59 u32 num, den; 59 u32 num, den;
60 60
61 int ret = m5mols_read(sd, addr_num, &num); 61 int ret = m5mols_read_u32(sd, addr_num, &num);
62 if (!ret) 62 if (!ret)
63 ret = m5mols_read(sd, addr_den, &den); 63 ret = m5mols_read_u32(sd, addr_den, &den);
64 if (ret) 64 if (ret)
65 return ret; 65 return ret;
66 *val = den == 0 ? 0 : num / den; 66 *val = den == 0 ? 0 : num / den;
@@ -99,20 +99,20 @@ static int m5mols_capture_info(struct m5mols_info *info)
99 if (ret) 99 if (ret)
100 return ret; 100 return ret;
101 101
102 ret = m5mols_read(sd, EXIF_INFO_ISO, (u32 *)&exif->iso_speed); 102 ret = m5mols_read_u16(sd, EXIF_INFO_ISO, &exif->iso_speed);
103 if (!ret) 103 if (!ret)
104 ret = m5mols_read(sd, EXIF_INFO_FLASH, (u32 *)&exif->flash); 104 ret = m5mols_read_u16(sd, EXIF_INFO_FLASH, &exif->flash);
105 if (!ret) 105 if (!ret)
106 ret = m5mols_read(sd, EXIF_INFO_SDR, (u32 *)&exif->sdr); 106 ret = m5mols_read_u16(sd, EXIF_INFO_SDR, &exif->sdr);
107 if (!ret) 107 if (!ret)
108 ret = m5mols_read(sd, EXIF_INFO_QVAL, (u32 *)&exif->qval); 108 ret = m5mols_read_u16(sd, EXIF_INFO_QVAL, &exif->qval);
109 if (ret) 109 if (ret)
110 return ret; 110 return ret;
111 111
112 if (!ret) 112 if (!ret)
113 ret = m5mols_read(sd, CAPC_IMAGE_SIZE, &info->cap.main); 113 ret = m5mols_read_u32(sd, CAPC_IMAGE_SIZE, &info->cap.main);
114 if (!ret) 114 if (!ret)
115 ret = m5mols_read(sd, CAPC_THUMB_SIZE, &info->cap.thumb); 115 ret = m5mols_read_u32(sd, CAPC_THUMB_SIZE, &info->cap.thumb);
116 if (!ret) 116 if (!ret)
117 info->cap.total = info->cap.main + info->cap.thumb; 117 info->cap.total = info->cap.main + info->cap.thumb;
118 118
@@ -122,7 +122,7 @@ static int m5mols_capture_info(struct m5mols_info *info)
122int m5mols_start_capture(struct m5mols_info *info) 122int m5mols_start_capture(struct m5mols_info *info)
123{ 123{
124 struct v4l2_subdev *sd = &info->sd; 124 struct v4l2_subdev *sd = &info->sd;
125 u32 resolution = info->resolution; 125 u8 resolution = info->resolution;
126 int timeout; 126 int timeout;
127 int ret; 127 int ret;
128 128
diff --git a/drivers/media/video/m5mols/m5mols_controls.c b/drivers/media/video/m5mols/m5mols_controls.c
index 817c16fec368..d135d20d09cf 100644
--- a/drivers/media/video/m5mols/m5mols_controls.c
+++ b/drivers/media/video/m5mols/m5mols_controls.c
@@ -2,10 +2,10 @@
2 * Controls for M-5MOLS 8M Pixel camera sensor with ISP 2 * Controls for M-5MOLS 8M Pixel camera sensor with ISP
3 * 3 *
4 * Copyright (C) 2011 Samsung Electronics Co., Ltd. 4 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
5 * Author: HeungJun Kim, riverful.kim@samsung.com 5 * Author: HeungJun Kim <riverful.kim@samsung.com>
6 * 6 *
7 * Copyright (C) 2009 Samsung Electronics Co., Ltd. 7 * Copyright (C) 2009 Samsung Electronics Co., Ltd.
8 * Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com 8 * Author: Dongsoo Nathaniel Kim <dongsoo45.kim@samsung.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -130,7 +130,7 @@ static struct m5mols_scenemode m5mols_default_scenemode[] = {
130 * 130 *
131 * WARNING: The execution order is important. Do not change the order. 131 * WARNING: The execution order is important. Do not change the order.
132 */ 132 */
133int m5mols_do_scenemode(struct m5mols_info *info, u32 mode) 133int m5mols_do_scenemode(struct m5mols_info *info, u8 mode)
134{ 134{
135 struct v4l2_subdev *sd = &info->sd; 135 struct v4l2_subdev *sd = &info->sd;
136 struct m5mols_scenemode scenemode = m5mols_default_scenemode[mode]; 136 struct m5mols_scenemode scenemode = m5mols_default_scenemode[mode];
diff --git a/drivers/media/video/m5mols/m5mols_core.c b/drivers/media/video/m5mols/m5mols_core.c
index 76eac26e84ae..43c68f51c5ce 100644
--- a/drivers/media/video/m5mols/m5mols_core.c
+++ b/drivers/media/video/m5mols/m5mols_core.c
@@ -2,10 +2,10 @@
2 * Driver for M-5MOLS 8M Pixel camera sensor with ISP 2 * Driver for M-5MOLS 8M Pixel camera sensor with ISP
3 * 3 *
4 * Copyright (C) 2011 Samsung Electronics Co., Ltd. 4 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
5 * Author: HeungJun Kim, riverful.kim@samsung.com 5 * Author: HeungJun Kim <riverful.kim@samsung.com>
6 * 6 *
7 * Copyright (C) 2009 Samsung Electronics Co., Ltd. 7 * Copyright (C) 2009 Samsung Electronics Co., Ltd.
8 * Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com 8 * Author: Dongsoo Nathaniel Kim <dongsoo45.kim@samsung.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -133,13 +133,13 @@ static u32 m5mols_swap_byte(u8 *data, u8 length)
133/** 133/**
134 * m5mols_read - I2C read function 134 * m5mols_read - I2C read function
135 * @reg: combination of size, category and command for the I2C packet 135 * @reg: combination of size, category and command for the I2C packet
136 * @size: desired size of I2C packet
136 * @val: read value 137 * @val: read value
137 */ 138 */
138int m5mols_read(struct v4l2_subdev *sd, u32 reg, u32 *val) 139static int m5mols_read(struct v4l2_subdev *sd, u32 size, u32 reg, u32 *val)
139{ 140{
140 struct i2c_client *client = v4l2_get_subdevdata(sd); 141 struct i2c_client *client = v4l2_get_subdevdata(sd);
141 u8 rbuf[M5MOLS_I2C_MAX_SIZE + 1]; 142 u8 rbuf[M5MOLS_I2C_MAX_SIZE + 1];
142 u8 size = I2C_SIZE(reg);
143 u8 category = I2C_CATEGORY(reg); 143 u8 category = I2C_CATEGORY(reg);
144 u8 cmd = I2C_COMMAND(reg); 144 u8 cmd = I2C_COMMAND(reg);
145 struct i2c_msg msg[2]; 145 struct i2c_msg msg[2];
@@ -149,11 +149,6 @@ int m5mols_read(struct v4l2_subdev *sd, u32 reg, u32 *val)
149 if (!client->adapter) 149 if (!client->adapter)
150 return -ENODEV; 150 return -ENODEV;
151 151
152 if (size != 1 && size != 2 && size != 4) {
153 v4l2_err(sd, "Wrong data size\n");
154 return -EINVAL;
155 }
156
157 msg[0].addr = client->addr; 152 msg[0].addr = client->addr;
158 msg[0].flags = 0; 153 msg[0].flags = 0;
159 msg[0].len = 5; 154 msg[0].len = 5;
@@ -184,6 +179,52 @@ int m5mols_read(struct v4l2_subdev *sd, u32 reg, u32 *val)
184 return 0; 179 return 0;
185} 180}
186 181
182int m5mols_read_u8(struct v4l2_subdev *sd, u32 reg, u8 *val)
183{
184 u32 val_32;
185 int ret;
186
187 if (I2C_SIZE(reg) != 1) {
188 v4l2_err(sd, "Wrong data size\n");
189 return -EINVAL;
190 }
191
192 ret = m5mols_read(sd, I2C_SIZE(reg), reg, &val_32);
193 if (ret)
194 return ret;
195
196 *val = (u8)val_32;
197 return ret;
198}
199
200int m5mols_read_u16(struct v4l2_subdev *sd, u32 reg, u16 *val)
201{
202 u32 val_32;
203 int ret;
204
205 if (I2C_SIZE(reg) != 2) {
206 v4l2_err(sd, "Wrong data size\n");
207 return -EINVAL;
208 }
209
210 ret = m5mols_read(sd, I2C_SIZE(reg), reg, &val_32);
211 if (ret)
212 return ret;
213
214 *val = (u16)val_32;
215 return ret;
216}
217
218int m5mols_read_u32(struct v4l2_subdev *sd, u32 reg, u32 *val)
219{
220 if (I2C_SIZE(reg) != 4) {
221 v4l2_err(sd, "Wrong data size\n");
222 return -EINVAL;
223 }
224
225 return m5mols_read(sd, I2C_SIZE(reg), reg, val);
226}
227
187/** 228/**
188 * m5mols_write - I2C command write function 229 * m5mols_write - I2C command write function
189 * @reg: combination of size, category and command for the I2C packet 230 * @reg: combination of size, category and command for the I2C packet
@@ -231,13 +272,14 @@ int m5mols_write(struct v4l2_subdev *sd, u32 reg, u32 val)
231 return 0; 272 return 0;
232} 273}
233 274
234int m5mols_busy(struct v4l2_subdev *sd, u8 category, u8 cmd, u32 mask) 275int m5mols_busy(struct v4l2_subdev *sd, u8 category, u8 cmd, u8 mask)
235{ 276{
236 u32 busy, i; 277 u8 busy;
278 int i;
237 int ret; 279 int ret;
238 280
239 for (i = 0; i < M5MOLS_I2C_CHECK_RETRY; i++) { 281 for (i = 0; i < M5MOLS_I2C_CHECK_RETRY; i++) {
240 ret = m5mols_read(sd, I2C_REG(category, cmd, 1), &busy); 282 ret = m5mols_read_u8(sd, I2C_REG(category, cmd, 1), &busy);
241 if (ret < 0) 283 if (ret < 0)
242 return ret; 284 return ret;
243 if ((busy & mask) == mask) 285 if ((busy & mask) == mask)
@@ -252,14 +294,14 @@ int m5mols_busy(struct v4l2_subdev *sd, u8 category, u8 cmd, u32 mask)
252 * Before writing desired interrupt value the INT_FACTOR register should 294 * Before writing desired interrupt value the INT_FACTOR register should
253 * be read to clear pending interrupts. 295 * be read to clear pending interrupts.
254 */ 296 */
255int m5mols_enable_interrupt(struct v4l2_subdev *sd, u32 reg) 297int m5mols_enable_interrupt(struct v4l2_subdev *sd, u8 reg)
256{ 298{
257 struct m5mols_info *info = to_m5mols(sd); 299 struct m5mols_info *info = to_m5mols(sd);
258 u32 mask = is_available_af(info) ? REG_INT_AF : 0; 300 u8 mask = is_available_af(info) ? REG_INT_AF : 0;
259 u32 dummy; 301 u8 dummy;
260 int ret; 302 int ret;
261 303
262 ret = m5mols_read(sd, SYSTEM_INT_FACTOR, &dummy); 304 ret = m5mols_read_u8(sd, SYSTEM_INT_FACTOR, &dummy);
263 if (!ret) 305 if (!ret)
264 ret = m5mols_write(sd, SYSTEM_INT_ENABLE, reg & ~mask); 306 ret = m5mols_write(sd, SYSTEM_INT_ENABLE, reg & ~mask);
265 return ret; 307 return ret;
@@ -271,7 +313,7 @@ int m5mols_enable_interrupt(struct v4l2_subdev *sd, u32 reg)
271 * It always accompanies a little delay changing the M-5MOLS mode, so it is 313 * It always accompanies a little delay changing the M-5MOLS mode, so it is
272 * needed checking current busy status to guarantee right mode. 314 * needed checking current busy status to guarantee right mode.
273 */ 315 */
274static int m5mols_reg_mode(struct v4l2_subdev *sd, u32 mode) 316static int m5mols_reg_mode(struct v4l2_subdev *sd, u8 mode)
275{ 317{
276 int ret = m5mols_write(sd, SYSTEM_SYSMODE, mode); 318 int ret = m5mols_write(sd, SYSTEM_SYSMODE, mode);
277 319
@@ -286,16 +328,16 @@ static int m5mols_reg_mode(struct v4l2_subdev *sd, u32 mode)
286 * can be guaranteed only when the sensor is operating in mode which which 328 * can be guaranteed only when the sensor is operating in mode which which
287 * a command belongs to. 329 * a command belongs to.
288 */ 330 */
289int m5mols_mode(struct m5mols_info *info, u32 mode) 331int m5mols_mode(struct m5mols_info *info, u8 mode)
290{ 332{
291 struct v4l2_subdev *sd = &info->sd; 333 struct v4l2_subdev *sd = &info->sd;
292 int ret = -EINVAL; 334 int ret = -EINVAL;
293 u32 reg; 335 u8 reg;
294 336
295 if (mode < REG_PARAMETER && mode > REG_CAPTURE) 337 if (mode < REG_PARAMETER && mode > REG_CAPTURE)
296 return ret; 338 return ret;
297 339
298 ret = m5mols_read(sd, SYSTEM_SYSMODE, &reg); 340 ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, &reg);
299 if ((!ret && reg == mode) || ret) 341 if ((!ret && reg == mode) || ret)
300 return ret; 342 return ret;
301 343
@@ -344,41 +386,37 @@ int m5mols_mode(struct m5mols_info *info, u32 mode)
344static int m5mols_get_version(struct v4l2_subdev *sd) 386static int m5mols_get_version(struct v4l2_subdev *sd)
345{ 387{
346 struct m5mols_info *info = to_m5mols(sd); 388 struct m5mols_info *info = to_m5mols(sd);
347 union { 389 struct m5mols_version *ver = &info->ver;
348 struct m5mols_version ver; 390 u8 *str = ver->str;
349 u8 bytes[VERSION_SIZE]; 391 int i;
350 } version;
351 u32 *value;
352 u8 cmd = CAT0_VER_CUSTOMER;
353 int ret; 392 int ret;
354 393
355 do { 394 ret = m5mols_read_u8(sd, SYSTEM_VER_CUSTOMER, &ver->customer);
356 value = (u32 *)&version.bytes[cmd]; 395 if (!ret)
357 ret = m5mols_read(sd, SYSTEM_CMD(cmd), value); 396 ret = m5mols_read_u8(sd, SYSTEM_VER_PROJECT, &ver->project);
358 if (ret) 397 if (!ret)
359 return ret; 398 ret = m5mols_read_u16(sd, SYSTEM_VER_FIRMWARE, &ver->fw);
360 } while (cmd++ != CAT0_VER_AWB); 399 if (!ret)
400 ret = m5mols_read_u16(sd, SYSTEM_VER_HARDWARE, &ver->hw);
401 if (!ret)
402 ret = m5mols_read_u16(sd, SYSTEM_VER_PARAMETER, &ver->param);
403 if (!ret)
404 ret = m5mols_read_u16(sd, SYSTEM_VER_AWB, &ver->awb);
405 if (!ret)
406 ret = m5mols_read_u8(sd, AF_VERSION, &ver->af);
407 if (ret)
408 return ret;
361 409
362 do { 410 for (i = 0; i < VERSION_STRING_SIZE; i++) {
363 value = (u32 *)&version.bytes[cmd]; 411 ret = m5mols_read_u8(sd, SYSTEM_VER_STRING, &str[i]);
364 ret = m5mols_read(sd, SYSTEM_VER_STRING, value);
365 if (ret) 412 if (ret)
366 return ret; 413 return ret;
367 if (cmd >= VERSION_SIZE - 1) 414 }
368 return -EINVAL;
369 } while (version.bytes[cmd++]);
370
371 value = (u32 *)&version.bytes[cmd];
372 ret = m5mols_read(sd, AF_VERSION, value);
373 if (ret)
374 return ret;
375 415
376 /* store version information swapped for being readable */ 416 ver->fw = be16_to_cpu(ver->fw);
377 info->ver = version.ver; 417 ver->hw = be16_to_cpu(ver->hw);
378 info->ver.fw = be16_to_cpu(info->ver.fw); 418 ver->param = be16_to_cpu(ver->param);
379 info->ver.hw = be16_to_cpu(info->ver.hw); 419 ver->awb = be16_to_cpu(ver->awb);
380 info->ver.param = be16_to_cpu(info->ver.param);
381 info->ver.awb = be16_to_cpu(info->ver.awb);
382 420
383 v4l2_info(sd, "Manufacturer\t[%s]\n", 421 v4l2_info(sd, "Manufacturer\t[%s]\n",
384 is_manufacturer(info, REG_SAMSUNG_ELECTRO) ? 422 is_manufacturer(info, REG_SAMSUNG_ELECTRO) ?
@@ -722,7 +760,7 @@ static int m5mols_init_controls(struct m5mols_info *info)
722 int ret; 760 int ret;
723 761
724 /* Determine value's range & step of controls for various FW version */ 762 /* Determine value's range & step of controls for various FW version */
725 ret = m5mols_read(sd, AE_MAX_GAIN_MON, (u32 *)&max_exposure); 763 ret = m5mols_read_u16(sd, AE_MAX_GAIN_MON, &max_exposure);
726 if (!ret) 764 if (!ret)
727 step_zoom = is_manufacturer(info, REG_SAMSUNG_OPTICS) ? 31 : 1; 765 step_zoom = is_manufacturer(info, REG_SAMSUNG_OPTICS) ? 31 : 1;
728 if (ret) 766 if (ret)
@@ -842,18 +880,18 @@ static void m5mols_irq_work(struct work_struct *work)
842 struct m5mols_info *info = 880 struct m5mols_info *info =
843 container_of(work, struct m5mols_info, work_irq); 881 container_of(work, struct m5mols_info, work_irq);
844 struct v4l2_subdev *sd = &info->sd; 882 struct v4l2_subdev *sd = &info->sd;
845 u32 reg; 883 u8 reg;
846 int ret; 884 int ret;
847 885
848 if (!is_powered(info) || 886 if (!is_powered(info) ||
849 m5mols_read(sd, SYSTEM_INT_FACTOR, &info->interrupt)) 887 m5mols_read_u8(sd, SYSTEM_INT_FACTOR, &info->interrupt))
850 return; 888 return;
851 889
852 switch (info->interrupt & REG_INT_MASK) { 890 switch (info->interrupt & REG_INT_MASK) {
853 case REG_INT_AF: 891 case REG_INT_AF:
854 if (!is_available_af(info)) 892 if (!is_available_af(info))
855 break; 893 break;
856 ret = m5mols_read(sd, AF_STATUS, &reg); 894 ret = m5mols_read_u8(sd, AF_STATUS, &reg);
857 v4l2_dbg(2, m5mols_debug, sd, "AF %s\n", 895 v4l2_dbg(2, m5mols_debug, sd, "AF %s\n",
858 reg == REG_AF_FAIL ? "Failed" : 896 reg == REG_AF_FAIL ? "Failed" :
859 reg == REG_AF_SUCCESS ? "Success" : 897 reg == REG_AF_SUCCESS ? "Success" :
diff --git a/drivers/media/video/m5mols/m5mols_reg.h b/drivers/media/video/m5mols/m5mols_reg.h
index b83e36fc6ac6..c755bd6edfe9 100644
--- a/drivers/media/video/m5mols/m5mols_reg.h
+++ b/drivers/media/video/m5mols/m5mols_reg.h
@@ -2,10 +2,10 @@
2 * Register map for M-5MOLS 8M Pixel camera sensor with ISP 2 * Register map for M-5MOLS 8M Pixel camera sensor with ISP
3 * 3 *
4 * Copyright (C) 2011 Samsung Electronics Co., Ltd. 4 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
5 * Author: HeungJun Kim, riverful.kim@samsung.com 5 * Author: HeungJun Kim <riverful.kim@samsung.com>
6 * 6 *
7 * Copyright (C) 2009 Samsung Electronics Co., Ltd. 7 * Copyright (C) 2009 Samsung Electronics Co., Ltd.
8 * Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com 8 * Author: Dongsoo Nathaniel Kim <dongsoo45.kim@samsung.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -56,13 +56,24 @@
56 * more specific contents, see definition if file m5mols.h. 56 * more specific contents, see definition if file m5mols.h.
57 */ 57 */
58#define CAT0_VER_CUSTOMER 0x00 /* customer version */ 58#define CAT0_VER_CUSTOMER 0x00 /* customer version */
59#define CAT0_VER_AWB 0x09 /* Auto WB version */ 59#define CAT0_VER_PROJECT 0x01 /* project version */
60#define CAT0_VER_FIRMWARE 0x02 /* Firmware version */
61#define CAT0_VER_HARDWARE 0x04 /* Hardware version */
62#define CAT0_VER_PARAMETER 0x06 /* Parameter version */
63#define CAT0_VER_AWB 0x08 /* Auto WB version */
60#define CAT0_VER_STRING 0x0a /* string including M-5MOLS */ 64#define CAT0_VER_STRING 0x0a /* string including M-5MOLS */
61#define CAT0_SYSMODE 0x0b /* SYSTEM mode register */ 65#define CAT0_SYSMODE 0x0b /* SYSTEM mode register */
62#define CAT0_STATUS 0x0c /* SYSTEM mode status register */ 66#define CAT0_STATUS 0x0c /* SYSTEM mode status register */
63#define CAT0_INT_FACTOR 0x10 /* interrupt pending register */ 67#define CAT0_INT_FACTOR 0x10 /* interrupt pending register */
64#define CAT0_INT_ENABLE 0x11 /* interrupt enable register */ 68#define CAT0_INT_ENABLE 0x11 /* interrupt enable register */
65 69
70#define SYSTEM_VER_CUSTOMER I2C_REG(CAT_SYSTEM, CAT0_VER_CUSTOMER, 1)
71#define SYSTEM_VER_PROJECT I2C_REG(CAT_SYSTEM, CAT0_VER_PROJECT, 1)
72#define SYSTEM_VER_FIRMWARE I2C_REG(CAT_SYSTEM, CAT0_VER_FIRMWARE, 2)
73#define SYSTEM_VER_HARDWARE I2C_REG(CAT_SYSTEM, CAT0_VER_HARDWARE, 2)
74#define SYSTEM_VER_PARAMETER I2C_REG(CAT_SYSTEM, CAT0_VER_PARAMETER, 2)
75#define SYSTEM_VER_AWB I2C_REG(CAT_SYSTEM, CAT0_VER_AWB, 2)
76
66#define SYSTEM_SYSMODE I2C_REG(CAT_SYSTEM, CAT0_SYSMODE, 1) 77#define SYSTEM_SYSMODE I2C_REG(CAT_SYSTEM, CAT0_SYSMODE, 1)
67#define REG_SYSINIT 0x00 /* SYSTEM mode */ 78#define REG_SYSINIT 0x00 /* SYSTEM mode */
68#define REG_PARAMETER 0x01 /* PARAMETER mode */ 79#define REG_PARAMETER 0x01 /* PARAMETER mode */
@@ -382,8 +393,8 @@
382#define REG_CAP_START_MAIN 0x01 393#define REG_CAP_START_MAIN 0x01
383#define REG_CAP_START_THUMB 0x03 394#define REG_CAP_START_THUMB 0x03
384 395
385#define CAPC_IMAGE_SIZE I2C_REG(CAT_CAPT_CTRL, CATC_CAP_IMAGE_SIZE, 1) 396#define CAPC_IMAGE_SIZE I2C_REG(CAT_CAPT_CTRL, CATC_CAP_IMAGE_SIZE, 4)
386#define CAPC_THUMB_SIZE I2C_REG(CAT_CAPT_CTRL, CATC_CAP_THUMB_SIZE, 1) 397#define CAPC_THUMB_SIZE I2C_REG(CAT_CAPT_CTRL, CATC_CAP_THUMB_SIZE, 4)
387 398
388/* 399/*
389 * Category F - Flash 400 * Category F - Flash
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index de5d481b0328..c43c81f5f978 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -480,12 +480,14 @@ static int msp_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
480 struct msp_state *state = to_state(sd); 480 struct msp_state *state = to_state(sd);
481 struct i2c_client *client = v4l2_get_subdevdata(sd); 481 struct i2c_client *client = v4l2_get_subdevdata(sd);
482 482
483 if (state->radio) 483 if (vt->type != V4L2_TUNER_ANALOG_TV)
484 return 0; 484 return 0;
485 if (state->opmode == OPMODE_AUTOSELECT) 485 if (!state->radio) {
486 msp_detect_stereo(client); 486 if (state->opmode == OPMODE_AUTOSELECT)
487 vt->audmode = state->audmode; 487 msp_detect_stereo(client);
488 vt->rxsubchans = state->rxsubchans; 488 vt->rxsubchans = state->rxsubchans;
489 }
490 vt->audmode = state->audmode;
489 vt->capability |= V4L2_TUNER_CAP_STEREO | 491 vt->capability |= V4L2_TUNER_CAP_STEREO |
490 V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2; 492 V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2;
491 return 0; 493 return 0;
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c
index bc0c23a1009c..63f8a0cc33d8 100644
--- a/drivers/media/video/mx1_camera.c
+++ b/drivers/media/video/mx1_camera.c
@@ -444,12 +444,9 @@ static int mx1_camera_add_device(struct soc_camera_device *icd)
444{ 444{
445 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 445 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
446 struct mx1_camera_dev *pcdev = ici->priv; 446 struct mx1_camera_dev *pcdev = ici->priv;
447 int ret;
448 447
449 if (pcdev->icd) { 448 if (pcdev->icd)
450 ret = -EBUSY; 449 return -EBUSY;
451 goto ebusy;
452 }
453 450
454 dev_info(icd->dev.parent, "MX1 Camera driver attached to camera %d\n", 451 dev_info(icd->dev.parent, "MX1 Camera driver attached to camera %d\n",
455 icd->devnum); 452 icd->devnum);
@@ -458,8 +455,7 @@ static int mx1_camera_add_device(struct soc_camera_device *icd)
458 455
459 pcdev->icd = icd; 456 pcdev->icd = icd;
460 457
461ebusy: 458 return 0;
462 return ret;
463} 459}
464 460
465static void mx1_camera_remove_device(struct soc_camera_device *icd) 461static void mx1_camera_remove_device(struct soc_camera_device *icd)
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index 4ada9be1d430..4d07c5844402 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -982,6 +982,14 @@ static int omap_vout_buffer_setup(struct videobuf_queue *q, unsigned int *count,
982 startindex = (vout->vid == OMAP_VIDEO1) ? 982 startindex = (vout->vid == OMAP_VIDEO1) ?
983 video1_numbuffers : video2_numbuffers; 983 video1_numbuffers : video2_numbuffers;
984 984
985 /* Check the size of the buffer */
986 if (*size > vout->buffer_size) {
987 v4l2_err(&vout->vid_dev->v4l2_dev,
988 "buffer allocation mismatch [%u] [%u]\n",
989 *size, vout->buffer_size);
990 return -ENOMEM;
991 }
992
985 for (i = startindex; i < *count; i++) { 993 for (i = startindex; i < *count; i++) {
986 vout->buffer_size = *size; 994 vout->buffer_size = *size;
987 995
@@ -1228,6 +1236,14 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
1228 (vma->vm_pgoff << PAGE_SHIFT)); 1236 (vma->vm_pgoff << PAGE_SHIFT));
1229 return -EINVAL; 1237 return -EINVAL;
1230 } 1238 }
1239 /* Check the size of the buffer */
1240 if (size > vout->buffer_size) {
1241 v4l2_err(&vout->vid_dev->v4l2_dev,
1242 "insufficient memory [%lu] [%u]\n",
1243 size, vout->buffer_size);
1244 return -ENOMEM;
1245 }
1246
1231 q->bufs[i]->baddr = vma->vm_start; 1247 q->bufs[i]->baddr = vma->vm_start;
1232 1248
1233 vma->vm_flags |= VM_RESERVED; 1249 vma->vm_flags |= VM_RESERVED;
@@ -2391,7 +2407,7 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev)
2391 /* Register the Video device with V4L2 2407 /* Register the Video device with V4L2
2392 */ 2408 */
2393 vfd = vout->vfd; 2409 vfd = vout->vfd;
2394 if (video_register_device(vfd, VFL_TYPE_GRABBER, k + 1) < 0) { 2410 if (video_register_device(vfd, VFL_TYPE_GRABBER, -1) < 0) {
2395 dev_err(&pdev->dev, ": Could not register " 2411 dev_err(&pdev->dev, ": Could not register "
2396 "Video for Linux device\n"); 2412 "Video for Linux device\n");
2397 vfd->minor = -1; 2413 vfd->minor = -1;
diff --git a/drivers/media/video/omap/omap_voutlib.c b/drivers/media/video/omap/omap_voutlib.c
index 2aa6a76c5e59..8ae74817a110 100644
--- a/drivers/media/video/omap/omap_voutlib.c
+++ b/drivers/media/video/omap/omap_voutlib.c
@@ -193,7 +193,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
193 return -EINVAL; 193 return -EINVAL;
194 194
195 if (cpu_is_omap24xx()) { 195 if (cpu_is_omap24xx()) {
196 if (crop->height != win->w.height) { 196 if (try_crop.height != win->w.height) {
197 /* If we're resizing vertically, we can't support a 197 /* If we're resizing vertically, we can't support a
198 * crop width wider than 768 pixels. 198 * crop width wider than 768 pixels.
199 */ 199 */
@@ -202,7 +202,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
202 } 202 }
203 } 203 }
204 /* vertical resizing */ 204 /* vertical resizing */
205 vresize = (1024 * crop->height) / win->w.height; 205 vresize = (1024 * try_crop.height) / win->w.height;
206 if (cpu_is_omap24xx() && (vresize > 2048)) 206 if (cpu_is_omap24xx() && (vresize > 2048))
207 vresize = 2048; 207 vresize = 2048;
208 else if (cpu_is_omap34xx() && (vresize > 4096)) 208 else if (cpu_is_omap34xx() && (vresize > 4096))
@@ -221,7 +221,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
221 try_crop.height = 2; 221 try_crop.height = 2;
222 } 222 }
223 /* horizontal resizing */ 223 /* horizontal resizing */
224 hresize = (1024 * crop->width) / win->w.width; 224 hresize = (1024 * try_crop.width) / win->w.width;
225 if (cpu_is_omap24xx() && (hresize > 2048)) 225 if (cpu_is_omap24xx() && (hresize > 2048))
226 hresize = 2048; 226 hresize = 2048;
227 else if (cpu_is_omap34xx() && (hresize > 4096)) 227 else if (cpu_is_omap34xx() && (hresize > 4096))
diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c
index c9fd04ee70a8..94b6ed89e195 100644
--- a/drivers/media/video/omap3isp/isp.c
+++ b/drivers/media/video/omap3isp/isp.c
@@ -1748,7 +1748,7 @@ static int isp_register_entities(struct isp_device *isp)
1748 goto done; 1748 goto done;
1749 1749
1750 /* Register external entities */ 1750 /* Register external entities */
1751 for (subdevs = pdata->subdevs; subdevs->subdevs; ++subdevs) { 1751 for (subdevs = pdata->subdevs; subdevs && subdevs->subdevs; ++subdevs) {
1752 struct v4l2_subdev *sensor; 1752 struct v4l2_subdev *sensor;
1753 struct media_entity *input; 1753 struct media_entity *input;
1754 unsigned int flags; 1754 unsigned int flags;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 9d0dd08f57f8..e98d38212791 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -3046,6 +3046,8 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
3046 if (hdw->input_dirty || hdw->audiomode_dirty || hdw->force_dirty) { 3046 if (hdw->input_dirty || hdw->audiomode_dirty || hdw->force_dirty) {
3047 struct v4l2_tuner vt; 3047 struct v4l2_tuner vt;
3048 memset(&vt, 0, sizeof(vt)); 3048 memset(&vt, 0, sizeof(vt));
3049 vt.type = (hdw->input_val == PVR2_CVAL_INPUT_RADIO) ?
3050 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
3049 vt.audmode = hdw->audiomode_val; 3051 vt.audmode = hdw->audiomode_val;
3050 v4l2_device_call_all(&hdw->v4l2_dev, 0, tuner, s_tuner, &vt); 3052 v4l2_device_call_all(&hdw->v4l2_dev, 0, tuner, s_tuner, &vt);
3051 } 3053 }
@@ -5171,6 +5173,8 @@ void pvr2_hdw_status_poll(struct pvr2_hdw *hdw)
5171{ 5173{
5172 struct v4l2_tuner *vtp = &hdw->tuner_signal_info; 5174 struct v4l2_tuner *vtp = &hdw->tuner_signal_info;
5173 memset(vtp, 0, sizeof(*vtp)); 5175 memset(vtp, 0, sizeof(*vtp));
5176 vtp->type = (hdw->input_val == PVR2_CVAL_INPUT_RADIO) ?
5177 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
5174 hdw->tuner_signal_stale = 0; 5178 hdw->tuner_signal_stale = 0;
5175 /* Note: There apparently is no replacement for VIDIOC_CROPCAP 5179 /* Note: There apparently is no replacement for VIDIOC_CROPCAP
5176 using v4l2-subdev - therefore we can't support that AT ALL right 5180 using v4l2-subdev - therefore we can't support that AT ALL right
diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c
index 1593f8deb810..760b4de13adf 100644
--- a/drivers/media/video/pwc/pwc-ctrl.c
+++ b/drivers/media/video/pwc/pwc-ctrl.c
@@ -1414,7 +1414,7 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
1414 { 1414 {
1415 ARG_DEF(struct pwc_probe, probe) 1415 ARG_DEF(struct pwc_probe, probe)
1416 1416
1417 strcpy(ARGR(probe).name, pdev->vdev->name); 1417 strcpy(ARGR(probe).name, pdev->vdev.name);
1418 ARGR(probe).type = pdev->type; 1418 ARGR(probe).type = pdev->type;
1419 ARG_OUT(probe) 1419 ARG_OUT(probe)
1420 break; 1420 break;
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index 356cd42b593b..b0bde5a87c8a 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -40,7 +40,7 @@
40 Oh yes, convention: to disctinguish between all the various pointers to 40 Oh yes, convention: to disctinguish between all the various pointers to
41 device-structures, I use these names for the pointer variables: 41 device-structures, I use these names for the pointer variables:
42 udev: struct usb_device * 42 udev: struct usb_device *
43 vdev: struct video_device * 43 vdev: struct video_device (member of pwc_dev)
44 pdev: struct pwc_devive * 44 pdev: struct pwc_devive *
45*/ 45*/
46 46
@@ -152,6 +152,7 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf,
152 size_t count, loff_t *ppos); 152 size_t count, loff_t *ppos);
153static unsigned int pwc_video_poll(struct file *file, poll_table *wait); 153static unsigned int pwc_video_poll(struct file *file, poll_table *wait);
154static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma); 154static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma);
155static void pwc_video_release(struct video_device *vfd);
155 156
156static const struct v4l2_file_operations pwc_fops = { 157static const struct v4l2_file_operations pwc_fops = {
157 .owner = THIS_MODULE, 158 .owner = THIS_MODULE,
@@ -164,42 +165,12 @@ static const struct v4l2_file_operations pwc_fops = {
164}; 165};
165static struct video_device pwc_template = { 166static struct video_device pwc_template = {
166 .name = "Philips Webcam", /* Filled in later */ 167 .name = "Philips Webcam", /* Filled in later */
167 .release = video_device_release, 168 .release = pwc_video_release,
168 .fops = &pwc_fops, 169 .fops = &pwc_fops,
170 .ioctl_ops = &pwc_ioctl_ops,
169}; 171};
170 172
171/***************************************************************************/ 173/***************************************************************************/
172
173/* Okay, this is some magic that I worked out and the reasoning behind it...
174
175 The biggest problem with any USB device is of course: "what to do
176 when the user unplugs the device while it is in use by an application?"
177 We have several options:
178 1) Curse them with the 7 plagues when they do (requires divine intervention)
179 2) Tell them not to (won't work: they'll do it anyway)
180 3) Oops the kernel (this will have a negative effect on a user's uptime)
181 4) Do something sensible.
182
183 Of course, we go for option 4.
184
185 It happens that this device will be linked to two times, once from
186 usb_device and once from the video_device in their respective 'private'
187 pointers. This is done when the device is probed() and all initialization
188 succeeded. The pwc_device struct links back to both structures.
189
190 When a device is unplugged while in use it will be removed from the
191 list of known USB devices; I also de-register it as a V4L device, but
192 unfortunately I can't free the memory since the struct is still in use
193 by the file descriptor. This free-ing is then deferend until the first
194 opportunity. Crude, but it works.
195
196 A small 'advantage' is that if a user unplugs the cam and plugs it back
197 in, it should get assigned the same video device minor, but unfortunately
198 it's non-trivial to re-link the cam back to the video device... (that
199 would surely be magic! :))
200*/
201
202/***************************************************************************/
203/* Private functions */ 174/* Private functions */
204 175
205/* Here we want the physical address of the memory. 176/* Here we want the physical address of the memory.
@@ -1016,16 +987,15 @@ static ssize_t show_snapshot_button_status(struct device *class_dev,
1016static DEVICE_ATTR(button, S_IRUGO | S_IWUSR, show_snapshot_button_status, 987static DEVICE_ATTR(button, S_IRUGO | S_IWUSR, show_snapshot_button_status,
1017 NULL); 988 NULL);
1018 989
1019static int pwc_create_sysfs_files(struct video_device *vdev) 990static int pwc_create_sysfs_files(struct pwc_device *pdev)
1020{ 991{
1021 struct pwc_device *pdev = video_get_drvdata(vdev);
1022 int rc; 992 int rc;
1023 993
1024 rc = device_create_file(&vdev->dev, &dev_attr_button); 994 rc = device_create_file(&pdev->vdev.dev, &dev_attr_button);
1025 if (rc) 995 if (rc)
1026 goto err; 996 goto err;
1027 if (pdev->features & FEATURE_MOTOR_PANTILT) { 997 if (pdev->features & FEATURE_MOTOR_PANTILT) {
1028 rc = device_create_file(&vdev->dev, &dev_attr_pan_tilt); 998 rc = device_create_file(&pdev->vdev.dev, &dev_attr_pan_tilt);
1029 if (rc) 999 if (rc)
1030 goto err_button; 1000 goto err_button;
1031 } 1001 }
@@ -1033,19 +1003,17 @@ static int pwc_create_sysfs_files(struct video_device *vdev)
1033 return 0; 1003 return 0;
1034 1004
1035err_button: 1005err_button:
1036 device_remove_file(&vdev->dev, &dev_attr_button); 1006 device_remove_file(&pdev->vdev.dev, &dev_attr_button);
1037err: 1007err:
1038 PWC_ERROR("Could not create sysfs files.\n"); 1008 PWC_ERROR("Could not create sysfs files.\n");
1039 return rc; 1009 return rc;
1040} 1010}
1041 1011
1042static void pwc_remove_sysfs_files(struct video_device *vdev) 1012static void pwc_remove_sysfs_files(struct pwc_device *pdev)
1043{ 1013{
1044 struct pwc_device *pdev = video_get_drvdata(vdev);
1045
1046 if (pdev->features & FEATURE_MOTOR_PANTILT) 1014 if (pdev->features & FEATURE_MOTOR_PANTILT)
1047 device_remove_file(&vdev->dev, &dev_attr_pan_tilt); 1015 device_remove_file(&pdev->vdev.dev, &dev_attr_pan_tilt);
1048 device_remove_file(&vdev->dev, &dev_attr_button); 1016 device_remove_file(&pdev->vdev.dev, &dev_attr_button);
1049} 1017}
1050 1018
1051#ifdef CONFIG_USB_PWC_DEBUG 1019#ifdef CONFIG_USB_PWC_DEBUG
@@ -1106,7 +1074,7 @@ static int pwc_video_open(struct file *file)
1106 if (ret >= 0) 1074 if (ret >= 0)
1107 { 1075 {
1108 PWC_DEBUG_OPEN("This %s camera is equipped with a %s (%d).\n", 1076 PWC_DEBUG_OPEN("This %s camera is equipped with a %s (%d).\n",
1109 pdev->vdev->name, 1077 pdev->vdev.name,
1110 pwc_sensor_type_to_string(i), i); 1078 pwc_sensor_type_to_string(i), i);
1111 } 1079 }
1112 } 1080 }
@@ -1180,16 +1148,15 @@ static int pwc_video_open(struct file *file)
1180 return 0; 1148 return 0;
1181} 1149}
1182 1150
1183 1151static void pwc_video_release(struct video_device *vfd)
1184static void pwc_cleanup(struct pwc_device *pdev)
1185{ 1152{
1186 pwc_remove_sysfs_files(pdev->vdev); 1153 struct pwc_device *pdev = container_of(vfd, struct pwc_device, vdev);
1187 video_unregister_device(pdev->vdev); 1154 int hint;
1188 1155
1189#ifdef CONFIG_USB_PWC_INPUT_EVDEV 1156 /* search device_hint[] table if we occupy a slot, by any chance */
1190 if (pdev->button_dev) 1157 for (hint = 0; hint < MAX_DEV_HINTS; hint++)
1191 input_unregister_device(pdev->button_dev); 1158 if (device_hint[hint].pdev == pdev)
1192#endif 1159 device_hint[hint].pdev = NULL;
1193 1160
1194 kfree(pdev); 1161 kfree(pdev);
1195} 1162}
@@ -1199,7 +1166,7 @@ static int pwc_video_close(struct file *file)
1199{ 1166{
1200 struct video_device *vdev = file->private_data; 1167 struct video_device *vdev = file->private_data;
1201 struct pwc_device *pdev; 1168 struct pwc_device *pdev;
1202 int i, hint; 1169 int i;
1203 1170
1204 PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); 1171 PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev);
1205 1172
@@ -1234,12 +1201,6 @@ static int pwc_video_close(struct file *file)
1234 } 1201 }
1235 pdev->vopen--; 1202 pdev->vopen--;
1236 PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", pdev->vopen); 1203 PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", pdev->vopen);
1237 } else {
1238 pwc_cleanup(pdev);
1239 /* search device_hint[] table if we occupy a slot, by any chance */
1240 for (hint = 0; hint < MAX_DEV_HINTS; hint++)
1241 if (device_hint[hint].pdev == pdev)
1242 device_hint[hint].pdev = NULL;
1243 } 1204 }
1244 1205
1245 return 0; 1206 return 0;
@@ -1715,19 +1676,12 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1715 init_waitqueue_head(&pdev->frameq); 1676 init_waitqueue_head(&pdev->frameq);
1716 pdev->vcompression = pwc_preferred_compression; 1677 pdev->vcompression = pwc_preferred_compression;
1717 1678
1718 /* Allocate video_device structure */ 1679 /* Init video_device structure */
1719 pdev->vdev = video_device_alloc(); 1680 memcpy(&pdev->vdev, &pwc_template, sizeof(pwc_template));
1720 if (!pdev->vdev) { 1681 pdev->vdev.parent = &intf->dev;
1721 PWC_ERROR("Err, cannot allocate video_device struture. Failing probe."); 1682 pdev->vdev.lock = &pdev->modlock;
1722 rc = -ENOMEM; 1683 strcpy(pdev->vdev.name, name);
1723 goto err_free_mem; 1684 video_set_drvdata(&pdev->vdev, pdev);
1724 }
1725 memcpy(pdev->vdev, &pwc_template, sizeof(pwc_template));
1726 pdev->vdev->parent = &intf->dev;
1727 pdev->vdev->lock = &pdev->modlock;
1728 pdev->vdev->ioctl_ops = &pwc_ioctl_ops;
1729 strcpy(pdev->vdev->name, name);
1730 video_set_drvdata(pdev->vdev, pdev);
1731 1685
1732 pdev->release = le16_to_cpu(udev->descriptor.bcdDevice); 1686 pdev->release = le16_to_cpu(udev->descriptor.bcdDevice);
1733 PWC_DEBUG_PROBE("Release: %04x\n", pdev->release); 1687 PWC_DEBUG_PROBE("Release: %04x\n", pdev->release);
@@ -1746,8 +1700,6 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1746 } 1700 }
1747 } 1701 }
1748 1702
1749 pdev->vdev->release = video_device_release;
1750
1751 /* occupy slot */ 1703 /* occupy slot */
1752 if (hint < MAX_DEV_HINTS) 1704 if (hint < MAX_DEV_HINTS)
1753 device_hint[hint].pdev = pdev; 1705 device_hint[hint].pdev = pdev;
@@ -1759,16 +1711,16 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1759 pwc_set_leds(pdev, 0, 0); 1711 pwc_set_leds(pdev, 0, 0);
1760 pwc_camera_power(pdev, 0); 1712 pwc_camera_power(pdev, 0);
1761 1713
1762 rc = video_register_device(pdev->vdev, VFL_TYPE_GRABBER, video_nr); 1714 rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, video_nr);
1763 if (rc < 0) { 1715 if (rc < 0) {
1764 PWC_ERROR("Failed to register as video device (%d).\n", rc); 1716 PWC_ERROR("Failed to register as video device (%d).\n", rc);
1765 goto err_video_release; 1717 goto err_free_mem;
1766 } 1718 }
1767 rc = pwc_create_sysfs_files(pdev->vdev); 1719 rc = pwc_create_sysfs_files(pdev);
1768 if (rc) 1720 if (rc)
1769 goto err_video_unreg; 1721 goto err_video_unreg;
1770 1722
1771 PWC_INFO("Registered as %s.\n", video_device_node_name(pdev->vdev)); 1723 PWC_INFO("Registered as %s.\n", video_device_node_name(&pdev->vdev));
1772 1724
1773#ifdef CONFIG_USB_PWC_INPUT_EVDEV 1725#ifdef CONFIG_USB_PWC_INPUT_EVDEV
1774 /* register webcam snapshot button input device */ 1726 /* register webcam snapshot button input device */
@@ -1776,7 +1728,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1776 if (!pdev->button_dev) { 1728 if (!pdev->button_dev) {
1777 PWC_ERROR("Err, insufficient memory for webcam snapshot button device."); 1729 PWC_ERROR("Err, insufficient memory for webcam snapshot button device.");
1778 rc = -ENOMEM; 1730 rc = -ENOMEM;
1779 pwc_remove_sysfs_files(pdev->vdev); 1731 pwc_remove_sysfs_files(pdev);
1780 goto err_video_unreg; 1732 goto err_video_unreg;
1781 } 1733 }
1782 1734
@@ -1794,7 +1746,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1794 if (rc) { 1746 if (rc) {
1795 input_free_device(pdev->button_dev); 1747 input_free_device(pdev->button_dev);
1796 pdev->button_dev = NULL; 1748 pdev->button_dev = NULL;
1797 pwc_remove_sysfs_files(pdev->vdev); 1749 pwc_remove_sysfs_files(pdev);
1798 goto err_video_unreg; 1750 goto err_video_unreg;
1799 } 1751 }
1800#endif 1752#endif
@@ -1804,10 +1756,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1804err_video_unreg: 1756err_video_unreg:
1805 if (hint < MAX_DEV_HINTS) 1757 if (hint < MAX_DEV_HINTS)
1806 device_hint[hint].pdev = NULL; 1758 device_hint[hint].pdev = NULL;
1807 video_unregister_device(pdev->vdev); 1759 video_unregister_device(&pdev->vdev);
1808 pdev->vdev = NULL; /* So we don't try to release it below */
1809err_video_release:
1810 video_device_release(pdev->vdev);
1811err_free_mem: 1760err_free_mem:
1812 kfree(pdev); 1761 kfree(pdev);
1813 return rc; 1762 return rc;
@@ -1816,10 +1765,8 @@ err_free_mem:
1816/* The user yanked out the cable... */ 1765/* The user yanked out the cable... */
1817static void usb_pwc_disconnect(struct usb_interface *intf) 1766static void usb_pwc_disconnect(struct usb_interface *intf)
1818{ 1767{
1819 struct pwc_device *pdev; 1768 struct pwc_device *pdev = usb_get_intfdata(intf);
1820 int hint;
1821 1769
1822 pdev = usb_get_intfdata (intf);
1823 mutex_lock(&pdev->modlock); 1770 mutex_lock(&pdev->modlock);
1824 usb_set_intfdata (intf, NULL); 1771 usb_set_intfdata (intf, NULL);
1825 if (pdev == NULL) { 1772 if (pdev == NULL) {
@@ -1836,30 +1783,25 @@ static void usb_pwc_disconnect(struct usb_interface *intf)
1836 } 1783 }
1837 1784
1838 /* We got unplugged; this is signalled by an EPIPE error code */ 1785 /* We got unplugged; this is signalled by an EPIPE error code */
1839 if (pdev->vopen) { 1786 pdev->error_status = EPIPE;
1840 PWC_INFO("Disconnected while webcam is in use!\n"); 1787 pdev->unplugged = 1;
1841 pdev->error_status = EPIPE;
1842 }
1843 1788
1844 /* Alert waiting processes */ 1789 /* Alert waiting processes */
1845 wake_up_interruptible(&pdev->frameq); 1790 wake_up_interruptible(&pdev->frameq);
1846 /* Wait until device is closed */
1847 if (pdev->vopen) {
1848 pdev->unplugged = 1;
1849 pwc_iso_stop(pdev);
1850 } else {
1851 /* Device is closed, so we can safely unregister it */
1852 PWC_DEBUG_PROBE("Unregistering video device in disconnect().\n");
1853 1791
1854disconnect_out: 1792 /* No need to keep the urbs around after disconnection */
1855 /* search device_hint[] table if we occupy a slot, by any chance */ 1793 pwc_isoc_cleanup(pdev);
1856 for (hint = 0; hint < MAX_DEV_HINTS; hint++)
1857 if (device_hint[hint].pdev == pdev)
1858 device_hint[hint].pdev = NULL;
1859 }
1860 1794
1795disconnect_out:
1861 mutex_unlock(&pdev->modlock); 1796 mutex_unlock(&pdev->modlock);
1862 pwc_cleanup(pdev); 1797
1798 pwc_remove_sysfs_files(pdev);
1799 video_unregister_device(&pdev->vdev);
1800
1801#ifdef CONFIG_USB_PWC_INPUT_EVDEV
1802 if (pdev->button_dev)
1803 input_unregister_device(pdev->button_dev);
1804#endif
1863} 1805}
1864 1806
1865 1807
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h
index e947766337d6..083f8b15df73 100644
--- a/drivers/media/video/pwc/pwc.h
+++ b/drivers/media/video/pwc/pwc.h
@@ -162,9 +162,9 @@ struct pwc_imgbuf
162 162
163struct pwc_device 163struct pwc_device
164{ 164{
165 struct video_device *vdev; 165 struct video_device vdev;
166 166
167 /* Pointer to our usb_device */ 167 /* Pointer to our usb_device, may be NULL after unplug */
168 struct usb_device *udev; 168 struct usb_device *udev;
169 169
170 int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ 170 int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c
index d142b40ea64e..81b4a826ee5e 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Samsung S5P SoC series camera interface (camera capture) driver 2 * Samsung S5P/EXYNOS4 SoC series camera interface (camera capture) driver
3 * 3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd 4 * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd.
5 * Author: Sylwester Nawrocki, <s.nawrocki@samsung.com> 5 * Author: Sylwester Nawrocki, <s.nawrocki@samsung.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -262,12 +262,7 @@ static unsigned int get_plane_size(struct fimc_frame *fr, unsigned int plane)
262{ 262{
263 if (!fr || plane >= fr->fmt->memplanes) 263 if (!fr || plane >= fr->fmt->memplanes)
264 return 0; 264 return 0;
265
266 dbg("%s: w: %d. h: %d. depth[%d]: %d",
267 __func__, fr->width, fr->height, plane, fr->fmt->depth[plane]);
268
269 return fr->f_width * fr->f_height * fr->fmt->depth[plane] / 8; 265 return fr->f_width * fr->f_height * fr->fmt->depth[plane] / 8;
270
271} 266}
272 267
273static int queue_setup(struct vb2_queue *vq, unsigned int *num_buffers, 268static int queue_setup(struct vb2_queue *vq, unsigned int *num_buffers,
@@ -283,24 +278,14 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *num_buffers,
283 278
284 *num_planes = fmt->memplanes; 279 *num_planes = fmt->memplanes;
285 280
286 dbg("%s, buffer count=%d, plane count=%d",
287 __func__, *num_buffers, *num_planes);
288
289 for (i = 0; i < fmt->memplanes; i++) { 281 for (i = 0; i < fmt->memplanes; i++) {
290 sizes[i] = get_plane_size(&ctx->d_frame, i); 282 sizes[i] = get_plane_size(&ctx->d_frame, i);
291 dbg("plane: %u, plane_size: %lu", i, sizes[i]);
292 allocators[i] = ctx->fimc_dev->alloc_ctx; 283 allocators[i] = ctx->fimc_dev->alloc_ctx;
293 } 284 }
294 285
295 return 0; 286 return 0;
296} 287}
297 288
298static int buffer_init(struct vb2_buffer *vb)
299{
300 /* TODO: */
301 return 0;
302}
303
304static int buffer_prepare(struct vb2_buffer *vb) 289static int buffer_prepare(struct vb2_buffer *vb)
305{ 290{
306 struct vb2_queue *vq = vb->vb2_queue; 291 struct vb2_queue *vq = vb->vb2_queue;
@@ -380,7 +365,6 @@ static struct vb2_ops fimc_capture_qops = {
380 .queue_setup = queue_setup, 365 .queue_setup = queue_setup,
381 .buf_prepare = buffer_prepare, 366 .buf_prepare = buffer_prepare,
382 .buf_queue = buffer_queue, 367 .buf_queue = buffer_queue,
383 .buf_init = buffer_init,
384 .wait_prepare = fimc_unlock, 368 .wait_prepare = fimc_unlock,
385 .wait_finish = fimc_lock, 369 .wait_finish = fimc_lock,
386 .start_streaming = start_streaming, 370 .start_streaming = start_streaming,
@@ -903,6 +887,7 @@ err_vd_reg:
903err_v4l2_reg: 887err_v4l2_reg:
904 v4l2_device_unregister(v4l2_dev); 888 v4l2_device_unregister(v4l2_dev);
905err_info: 889err_info:
890 kfree(ctx);
906 dev_err(&fimc->pdev->dev, "failed to install\n"); 891 dev_err(&fimc->pdev->dev, "failed to install\n");
907 return ret; 892 return ret;
908} 893}
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index dc91a8511af6..bdf19ada9172 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -1,9 +1,8 @@
1/* 1/*
2 * S5P camera interface (video postprocessor) driver 2 * Samsung S5P/EXYNOS4 SoC series camera interface (video postprocessor) driver
3 * 3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd 4 * Copyright (C) 2010-2011 Samsung Electronics Co., Ltd.
5 * 5 * Contact: Sylwester Nawrocki, <s.nawrocki@samsung.com>
6 * Sylwester Nawrocki, <s.nawrocki@samsung.com>
7 * 6 *
8 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published 8 * it under the terms of the GNU General Public License as published
@@ -42,7 +41,6 @@ static struct fimc_fmt fimc_formats[] = {
42 .color = S5P_FIMC_RGB565, 41 .color = S5P_FIMC_RGB565,
43 .memplanes = 1, 42 .memplanes = 1,
44 .colplanes = 1, 43 .colplanes = 1,
45 .mbus_code = V4L2_MBUS_FMT_RGB565_2X8_BE,
46 .flags = FMT_FLAGS_M2M, 44 .flags = FMT_FLAGS_M2M,
47 }, { 45 }, {
48 .name = "BGR666", 46 .name = "BGR666",
@@ -232,11 +230,7 @@ static int fimc_get_scaler_factor(u32 src, u32 tar, u32 *ratio, u32 *shift)
232 return 0; 230 return 0;
233 } 231 }
234 } 232 }
235
236 *shift = 0, *ratio = 1; 233 *shift = 0, *ratio = 1;
237
238 dbg("s: %d, t: %d, shift: %d, ratio: %d",
239 src, tar, *shift, *ratio);
240 return 0; 234 return 0;
241} 235}
242 236
@@ -268,10 +262,8 @@ int fimc_set_scaler_info(struct fimc_ctx *ctx)
268 err("invalid source size: %d x %d", sx, sy); 262 err("invalid source size: %d x %d", sx, sy);
269 return -EINVAL; 263 return -EINVAL;
270 } 264 }
271
272 sc->real_width = sx; 265 sc->real_width = sx;
273 sc->real_height = sy; 266 sc->real_height = sy;
274 dbg("sx= %d, sy= %d, tx= %d, ty= %d", sx, sy, tx, ty);
275 267
276 ret = fimc_get_scaler_factor(sx, tx, &sc->pre_hratio, &sc->hfactor); 268 ret = fimc_get_scaler_factor(sx, tx, &sc->pre_hratio, &sc->hfactor);
277 if (ret) 269 if (ret)
@@ -711,22 +703,18 @@ static int fimc_queue_setup(struct vb2_queue *vq, unsigned int *num_buffers,
711 f = ctx_get_frame(ctx, vq->type); 703 f = ctx_get_frame(ctx, vq->type);
712 if (IS_ERR(f)) 704 if (IS_ERR(f))
713 return PTR_ERR(f); 705 return PTR_ERR(f);
714
715 /* 706 /*
716 * Return number of non-contigous planes (plane buffers) 707 * Return number of non-contigous planes (plane buffers)
717 * depending on the configured color format. 708 * depending on the configured color format.
718 */ 709 */
719 if (f->fmt) 710 if (!f->fmt)
720 *num_planes = f->fmt->memplanes; 711 return -EINVAL;
721 712
713 *num_planes = f->fmt->memplanes;
722 for (i = 0; i < f->fmt->memplanes; i++) { 714 for (i = 0; i < f->fmt->memplanes; i++) {
723 sizes[i] = (f->width * f->height * f->fmt->depth[i]) >> 3; 715 sizes[i] = (f->f_width * f->f_height * f->fmt->depth[i]) / 8;
724 allocators[i] = ctx->fimc_dev->alloc_ctx; 716 allocators[i] = ctx->fimc_dev->alloc_ctx;
725 } 717 }
726
727 if (*num_buffers == 0)
728 *num_buffers = 1;
729
730 return 0; 718 return 0;
731} 719}
732 720
@@ -852,7 +840,7 @@ struct fimc_fmt *find_format(struct v4l2_format *f, unsigned int mask)
852 840
853 for (i = 0; i < ARRAY_SIZE(fimc_formats); ++i) { 841 for (i = 0; i < ARRAY_SIZE(fimc_formats); ++i) {
854 fmt = &fimc_formats[i]; 842 fmt = &fimc_formats[i];
855 if (fmt->fourcc == f->fmt.pix.pixelformat && 843 if (fmt->fourcc == f->fmt.pix_mp.pixelformat &&
856 (fmt->flags & mask)) 844 (fmt->flags & mask))
857 break; 845 break;
858 } 846 }
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h
index 3beb1e5320ce..1f70772daaf0 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.h
+++ b/drivers/media/video/s5p-fimc/fimc-core.h
@@ -1,7 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010 Samsung Electronics 2 * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd.
3 *
4 * Sylwester Nawrocki, <s.nawrocki@samsung.com>
5 * 3 *
6 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
@@ -135,9 +133,10 @@ enum fimc_color_fmt {
135 * @name: format description 133 * @name: format description
136 * @fourcc: the fourcc code for this format, 0 if not applicable 134 * @fourcc: the fourcc code for this format, 0 if not applicable
137 * @color: the corresponding fimc_color_fmt 135 * @color: the corresponding fimc_color_fmt
138 * @depth: per plane driver's private 'number of bits per pixel'
139 * @memplanes: number of physically non-contiguous data planes 136 * @memplanes: number of physically non-contiguous data planes
140 * @colplanes: number of physically contiguous data planes 137 * @colplanes: number of physically contiguous data planes
138 * @depth: per plane driver's private 'number of bits per pixel'
139 * @flags: flags indicating which operation mode format applies to
141 */ 140 */
142struct fimc_fmt { 141struct fimc_fmt {
143 enum v4l2_mbus_pixelcode mbus_code; 142 enum v4l2_mbus_pixelcode mbus_code;
@@ -171,7 +170,7 @@ struct fimc_dma_offset {
171}; 170};
172 171
173/** 172/**
174 * struct fimc_effect - the configuration data for the "Arbitrary" image effect 173 * struct fimc_effect - color effect information
175 * @type: effect type 174 * @type: effect type
176 * @pat_cb: cr value when type is "arbitrary" 175 * @pat_cb: cr value when type is "arbitrary"
177 * @pat_cr: cr value when type is "arbitrary" 176 * @pat_cr: cr value when type is "arbitrary"
@@ -184,7 +183,6 @@ struct fimc_effect {
184 183
185/** 184/**
186 * struct fimc_scaler - the configuration data for FIMC inetrnal scaler 185 * struct fimc_scaler - the configuration data for FIMC inetrnal scaler
187 *
188 * @scaleup_h: flag indicating scaling up horizontally 186 * @scaleup_h: flag indicating scaling up horizontally
189 * @scaleup_v: flag indicating scaling up vertically 187 * @scaleup_v: flag indicating scaling up vertically
190 * @copy_mode: flag indicating transparent DMA transfer (no scaling 188 * @copy_mode: flag indicating transparent DMA transfer (no scaling
@@ -220,7 +218,6 @@ struct fimc_scaler {
220 218
221/** 219/**
222 * struct fimc_addr - the FIMC physical address set for DMA 220 * struct fimc_addr - the FIMC physical address set for DMA
223 *
224 * @y: luminance plane physical address 221 * @y: luminance plane physical address
225 * @cb: Cb plane physical address 222 * @cb: Cb plane physical address
226 * @cr: Cr plane physical address 223 * @cr: Cr plane physical address
@@ -234,6 +231,7 @@ struct fimc_addr {
234/** 231/**
235 * struct fimc_vid_buffer - the driver's video buffer 232 * struct fimc_vid_buffer - the driver's video buffer
236 * @vb: v4l videobuf buffer 233 * @vb: v4l videobuf buffer
234 * @list: linked list structure for buffer queue
237 * @paddr: precalculated physical address set 235 * @paddr: precalculated physical address set
238 * @index: buffer index for the output DMA engine 236 * @index: buffer index for the output DMA engine
239 */ 237 */
@@ -254,11 +252,10 @@ struct fimc_vid_buffer {
254 * @offs_v: image vertical pixel offset 252 * @offs_v: image vertical pixel offset
255 * @width: image pixel width 253 * @width: image pixel width
256 * @height: image pixel weight 254 * @height: image pixel weight
257 * @paddr: image frame buffer physical addresses
258 * @buf_cnt: number of buffers depending on a color format
259 * @payload: image size in bytes (w x h x bpp) 255 * @payload: image size in bytes (w x h x bpp)
260 * @color: color format 256 * @paddr: image frame buffer physical addresses
261 * @dma_offset: DMA offset in bytes 257 * @dma_offset: DMA offset in bytes
258 * @fmt: fimc color format pointer
262 */ 259 */
263struct fimc_frame { 260struct fimc_frame {
264 u32 f_width; 261 u32 f_width;
@@ -390,21 +387,22 @@ struct fimc_ctx;
390 387
391/** 388/**
392 * struct fimc_dev - abstraction for FIMC entity 389 * struct fimc_dev - abstraction for FIMC entity
393 *
394 * @slock: the spinlock protecting this data structure 390 * @slock: the spinlock protecting this data structure
395 * @lock: the mutex protecting this data structure 391 * @lock: the mutex protecting this data structure
396 * @pdev: pointer to the FIMC platform device 392 * @pdev: pointer to the FIMC platform device
397 * @pdata: pointer to the device platform data 393 * @pdata: pointer to the device platform data
394 * @variant: the IP variant information
398 * @id: FIMC device index (0..FIMC_MAX_DEVS) 395 * @id: FIMC device index (0..FIMC_MAX_DEVS)
399 * @num_clocks: the number of clocks managed by this device instance 396 * @num_clocks: the number of clocks managed by this device instance
400 * @clock[]: the clocks required for FIMC operation 397 * @clock: clocks required for FIMC operation
401 * @regs: the mapped hardware registers 398 * @regs: the mapped hardware registers
402 * @regs_res: the resource claimed for IO registers 399 * @regs_res: the resource claimed for IO registers
403 * @irq: interrupt number of the FIMC subdevice 400 * @irq: FIMC interrupt number
404 * @irq_queue: 401 * @irq_queue: interrupt handler waitqueue
405 * @m2m: memory-to-memory V4L2 device information 402 * @m2m: memory-to-memory V4L2 device information
406 * @vid_cap: camera capture device information 403 * @vid_cap: camera capture device information
407 * @state: flags used to synchronize m2m and capture mode operation 404 * @state: flags used to synchronize m2m and capture mode operation
405 * @alloc_ctx: videobuf2 memory allocator context
408 */ 406 */
409struct fimc_dev { 407struct fimc_dev {
410 spinlock_t slock; 408 spinlock_t slock;
@@ -427,8 +425,7 @@ struct fimc_dev {
427 425
428/** 426/**
429 * fimc_ctx - the device context data 427 * fimc_ctx - the device context data
430 * 428 * @slock: spinlock protecting this data structure
431 * @lock: mutex protecting this data structure
432 * @s_frame: source frame properties 429 * @s_frame: source frame properties
433 * @d_frame: destination frame properties 430 * @d_frame: destination frame properties
434 * @out_order_1p: output 1-plane YCBCR order 431 * @out_order_1p: output 1-plane YCBCR order
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index ff6c0e97563e..d4ee24bf6928 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -963,7 +963,7 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev)
963 * to work with other protocols. 963 * to work with other protocols.
964 */ 964 */
965 if (!ir->active) { 965 if (!ir->active) {
966 timeout = jiffies + jiffies_to_msecs(15); 966 timeout = jiffies + msecs_to_jiffies(15);
967 mod_timer(&ir->timer, timeout); 967 mod_timer(&ir->timer, timeout);
968 ir->active = true; 968 ir->active = true;
969 } 969 }
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 9363ed91a4cb..cfa9f7efe93d 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -724,19 +724,15 @@ static inline int check_mode(struct tuner *t, enum v4l2_tuner_type mode)
724} 724}
725 725
726/** 726/**
727 * set_mode_freq - Switch tuner to other mode. 727 * set_mode - Switch tuner to other mode.
728 * @client: struct i2c_client pointer
729 * @t: a pointer to the module's internal struct_tuner 728 * @t: a pointer to the module's internal struct_tuner
730 * @mode: enum v4l2_type (radio or TV) 729 * @mode: enum v4l2_type (radio or TV)
731 * @freq: frequency to set (0 means to use the previous one)
732 * 730 *
733 * If tuner doesn't support the needed mode (radio or TV), prints a 731 * If tuner doesn't support the needed mode (radio or TV), prints a
734 * debug message and returns -EINVAL, changing its state to standby. 732 * debug message and returns -EINVAL, changing its state to standby.
735 * Otherwise, changes the state and sets frequency to the last value, if 733 * Otherwise, changes the mode and returns 0.
736 * the tuner can sleep or if it supports both Radio and TV.
737 */ 734 */
738static int set_mode_freq(struct i2c_client *client, struct tuner *t, 735static int set_mode(struct tuner *t, enum v4l2_tuner_type mode)
739 enum v4l2_tuner_type mode, unsigned int freq)
740{ 736{
741 struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops; 737 struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
742 738
@@ -752,17 +748,27 @@ static int set_mode_freq(struct i2c_client *client, struct tuner *t,
752 t->mode = mode; 748 t->mode = mode;
753 tuner_dbg("Changing to mode %d\n", mode); 749 tuner_dbg("Changing to mode %d\n", mode);
754 } 750 }
751 return 0;
752}
753
754/**
755 * set_freq - Set the tuner to the desired frequency.
756 * @t: a pointer to the module's internal struct_tuner
757 * @freq: frequency to set (0 means to use the current frequency)
758 */
759static void set_freq(struct tuner *t, unsigned int freq)
760{
761 struct i2c_client *client = v4l2_get_subdevdata(&t->sd);
762
755 if (t->mode == V4L2_TUNER_RADIO) { 763 if (t->mode == V4L2_TUNER_RADIO) {
756 if (freq) 764 if (!freq)
757 t->radio_freq = freq; 765 freq = t->radio_freq;
758 set_radio_freq(client, t->radio_freq); 766 set_radio_freq(client, freq);
759 } else { 767 } else {
760 if (freq) 768 if (!freq)
761 t->tv_freq = freq; 769 freq = t->tv_freq;
762 set_tv_freq(client, t->tv_freq); 770 set_tv_freq(client, freq);
763 } 771 }
764
765 return 0;
766} 772}
767 773
768/* 774/*
@@ -817,7 +823,8 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
817/** 823/**
818 * tuner_fixup_std - force a given video standard variant 824 * tuner_fixup_std - force a given video standard variant
819 * 825 *
820 * @t: tuner internal struct 826 * @t: tuner internal struct
827 * @std: TV standard
821 * 828 *
822 * A few devices or drivers have problem to detect some standard variations. 829 * A few devices or drivers have problem to detect some standard variations.
823 * On other operational systems, the drivers generally have a per-country 830 * On other operational systems, the drivers generally have a per-country
@@ -827,57 +834,39 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
827 * to distinguish all video standard variations, a modprobe parameter can 834 * to distinguish all video standard variations, a modprobe parameter can
828 * be used to force a video standard match. 835 * be used to force a video standard match.
829 */ 836 */
830static int tuner_fixup_std(struct tuner *t) 837static v4l2_std_id tuner_fixup_std(struct tuner *t, v4l2_std_id std)
831{ 838{
832 if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) { 839 if (pal[0] != '-' && (std & V4L2_STD_PAL) == V4L2_STD_PAL) {
833 switch (pal[0]) { 840 switch (pal[0]) {
834 case '6': 841 case '6':
835 tuner_dbg("insmod fixup: PAL => PAL-60\n"); 842 return V4L2_STD_PAL_60;
836 t->std = V4L2_STD_PAL_60;
837 break;
838 case 'b': 843 case 'b':
839 case 'B': 844 case 'B':
840 case 'g': 845 case 'g':
841 case 'G': 846 case 'G':
842 tuner_dbg("insmod fixup: PAL => PAL-BG\n"); 847 return V4L2_STD_PAL_BG;
843 t->std = V4L2_STD_PAL_BG;
844 break;
845 case 'i': 848 case 'i':
846 case 'I': 849 case 'I':
847 tuner_dbg("insmod fixup: PAL => PAL-I\n"); 850 return V4L2_STD_PAL_I;
848 t->std = V4L2_STD_PAL_I;
849 break;
850 case 'd': 851 case 'd':
851 case 'D': 852 case 'D':
852 case 'k': 853 case 'k':
853 case 'K': 854 case 'K':
854 tuner_dbg("insmod fixup: PAL => PAL-DK\n"); 855 return V4L2_STD_PAL_DK;
855 t->std = V4L2_STD_PAL_DK;
856 break;
857 case 'M': 856 case 'M':
858 case 'm': 857 case 'm':
859 tuner_dbg("insmod fixup: PAL => PAL-M\n"); 858 return V4L2_STD_PAL_M;
860 t->std = V4L2_STD_PAL_M;
861 break;
862 case 'N': 859 case 'N':
863 case 'n': 860 case 'n':
864 if (pal[1] == 'c' || pal[1] == 'C') { 861 if (pal[1] == 'c' || pal[1] == 'C')
865 tuner_dbg("insmod fixup: PAL => PAL-Nc\n"); 862 return V4L2_STD_PAL_Nc;
866 t->std = V4L2_STD_PAL_Nc; 863 return V4L2_STD_PAL_N;
867 } else {
868 tuner_dbg("insmod fixup: PAL => PAL-N\n");
869 t->std = V4L2_STD_PAL_N;
870 }
871 break;
872 case '-':
873 /* default parameter, do nothing */
874 break;
875 default: 864 default:
876 tuner_warn("pal= argument not recognised\n"); 865 tuner_warn("pal= argument not recognised\n");
877 break; 866 break;
878 } 867 }
879 } 868 }
880 if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { 869 if (secam[0] != '-' && (std & V4L2_STD_SECAM) == V4L2_STD_SECAM) {
881 switch (secam[0]) { 870 switch (secam[0]) {
882 case 'b': 871 case 'b':
883 case 'B': 872 case 'B':
@@ -885,63 +874,42 @@ static int tuner_fixup_std(struct tuner *t)
885 case 'G': 874 case 'G':
886 case 'h': 875 case 'h':
887 case 'H': 876 case 'H':
888 tuner_dbg("insmod fixup: SECAM => SECAM-BGH\n"); 877 return V4L2_STD_SECAM_B |
889 t->std = V4L2_STD_SECAM_B | 878 V4L2_STD_SECAM_G |
890 V4L2_STD_SECAM_G | 879 V4L2_STD_SECAM_H;
891 V4L2_STD_SECAM_H;
892 break;
893 case 'd': 880 case 'd':
894 case 'D': 881 case 'D':
895 case 'k': 882 case 'k':
896 case 'K': 883 case 'K':
897 tuner_dbg("insmod fixup: SECAM => SECAM-DK\n"); 884 return V4L2_STD_SECAM_DK;
898 t->std = V4L2_STD_SECAM_DK;
899 break;
900 case 'l': 885 case 'l':
901 case 'L': 886 case 'L':
902 if ((secam[1] == 'C') || (secam[1] == 'c')) { 887 if ((secam[1] == 'C') || (secam[1] == 'c'))
903 tuner_dbg("insmod fixup: SECAM => SECAM-L'\n"); 888 return V4L2_STD_SECAM_LC;
904 t->std = V4L2_STD_SECAM_LC; 889 return V4L2_STD_SECAM_L;
905 } else {
906 tuner_dbg("insmod fixup: SECAM => SECAM-L\n");
907 t->std = V4L2_STD_SECAM_L;
908 }
909 break;
910 case '-':
911 /* default parameter, do nothing */
912 break;
913 default: 890 default:
914 tuner_warn("secam= argument not recognised\n"); 891 tuner_warn("secam= argument not recognised\n");
915 break; 892 break;
916 } 893 }
917 } 894 }
918 895
919 if ((t->std & V4L2_STD_NTSC) == V4L2_STD_NTSC) { 896 if (ntsc[0] != '-' && (std & V4L2_STD_NTSC) == V4L2_STD_NTSC) {
920 switch (ntsc[0]) { 897 switch (ntsc[0]) {
921 case 'm': 898 case 'm':
922 case 'M': 899 case 'M':
923 tuner_dbg("insmod fixup: NTSC => NTSC-M\n"); 900 return V4L2_STD_NTSC_M;
924 t->std = V4L2_STD_NTSC_M;
925 break;
926 case 'j': 901 case 'j':
927 case 'J': 902 case 'J':
928 tuner_dbg("insmod fixup: NTSC => NTSC_M_JP\n"); 903 return V4L2_STD_NTSC_M_JP;
929 t->std = V4L2_STD_NTSC_M_JP;
930 break;
931 case 'k': 904 case 'k':
932 case 'K': 905 case 'K':
933 tuner_dbg("insmod fixup: NTSC => NTSC_M_KR\n"); 906 return V4L2_STD_NTSC_M_KR;
934 t->std = V4L2_STD_NTSC_M_KR;
935 break;
936 case '-':
937 /* default parameter, do nothing */
938 break;
939 default: 907 default:
940 tuner_info("ntsc= argument not recognised\n"); 908 tuner_info("ntsc= argument not recognised\n");
941 break; 909 break;
942 } 910 }
943 } 911 }
944 return 0; 912 return std;
945} 913}
946 914
947/* 915/*
@@ -1058,10 +1026,9 @@ static void tuner_status(struct dvb_frontend *fe)
1058static int tuner_s_radio(struct v4l2_subdev *sd) 1026static int tuner_s_radio(struct v4l2_subdev *sd)
1059{ 1027{
1060 struct tuner *t = to_tuner(sd); 1028 struct tuner *t = to_tuner(sd);
1061 struct i2c_client *client = v4l2_get_subdevdata(sd);
1062 1029
1063 if (set_mode_freq(client, t, V4L2_TUNER_RADIO, 0) == -EINVAL) 1030 if (set_mode(t, V4L2_TUNER_RADIO) == 0)
1064 return 0; 1031 set_freq(t, 0);
1065 return 0; 1032 return 0;
1066} 1033}
1067 1034
@@ -1072,16 +1039,20 @@ static int tuner_s_radio(struct v4l2_subdev *sd)
1072/** 1039/**
1073 * tuner_s_power - controls the power state of the tuner 1040 * tuner_s_power - controls the power state of the tuner
1074 * @sd: pointer to struct v4l2_subdev 1041 * @sd: pointer to struct v4l2_subdev
1075 * @on: a zero value puts the tuner to sleep 1042 * @on: a zero value puts the tuner to sleep, non-zero wakes it up
1076 */ 1043 */
1077static int tuner_s_power(struct v4l2_subdev *sd, int on) 1044static int tuner_s_power(struct v4l2_subdev *sd, int on)
1078{ 1045{
1079 struct tuner *t = to_tuner(sd); 1046 struct tuner *t = to_tuner(sd);
1080 struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops; 1047 struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
1081 1048
1082 /* FIXME: Why this function don't wake the tuner if on != 0 ? */ 1049 if (on) {
1083 if (on) 1050 if (t->standby && set_mode(t, t->mode) == 0) {
1051 tuner_dbg("Waking up tuner\n");
1052 set_freq(t, 0);
1053 }
1084 return 0; 1054 return 0;
1055 }
1085 1056
1086 tuner_dbg("Putting tuner to sleep\n"); 1057 tuner_dbg("Putting tuner to sleep\n");
1087 t->standby = true; 1058 t->standby = true;
@@ -1093,28 +1064,36 @@ static int tuner_s_power(struct v4l2_subdev *sd, int on)
1093static int tuner_s_std(struct v4l2_subdev *sd, v4l2_std_id std) 1064static int tuner_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
1094{ 1065{
1095 struct tuner *t = to_tuner(sd); 1066 struct tuner *t = to_tuner(sd);
1096 struct i2c_client *client = v4l2_get_subdevdata(sd);
1097 1067
1098 if (set_mode_freq(client, t, V4L2_TUNER_ANALOG_TV, 0) == -EINVAL) 1068 if (set_mode(t, V4L2_TUNER_ANALOG_TV))
1099 return 0; 1069 return 0;
1100 1070
1101 t->std = std; 1071 t->std = tuner_fixup_std(t, std);
1102 tuner_fixup_std(t); 1072 if (t->std != std)
1103 1073 tuner_dbg("Fixup standard %llx to %llx\n", std, t->std);
1074 set_freq(t, 0);
1104 return 0; 1075 return 0;
1105} 1076}
1106 1077
1107static int tuner_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f) 1078static int tuner_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
1108{ 1079{
1109 struct tuner *t = to_tuner(sd); 1080 struct tuner *t = to_tuner(sd);
1110 struct i2c_client *client = v4l2_get_subdevdata(sd);
1111
1112 if (set_mode_freq(client, t, f->type, f->frequency) == -EINVAL)
1113 return 0;
1114 1081
1082 if (set_mode(t, f->type) == 0)
1083 set_freq(t, f->frequency);
1115 return 0; 1084 return 0;
1116} 1085}
1117 1086
1087/**
1088 * tuner_g_frequency - Get the tuned frequency for the tuner
1089 * @sd: pointer to struct v4l2_subdev
1090 * @f: pointer to struct v4l2_frequency
1091 *
1092 * At return, the structure f will be filled with tuner frequency
1093 * if the tuner matches the f->type.
1094 * Note: f->type should be initialized before calling it.
1095 * This is done by either video_ioctl2 or by the bridge driver.
1096 */
1118static int tuner_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f) 1097static int tuner_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
1119{ 1098{
1120 struct tuner *t = to_tuner(sd); 1099 struct tuner *t = to_tuner(sd);
@@ -1122,8 +1101,7 @@ static int tuner_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
1122 1101
1123 if (check_mode(t, f->type) == -EINVAL) 1102 if (check_mode(t, f->type) == -EINVAL)
1124 return 0; 1103 return 0;
1125 f->type = t->mode; 1104 if (f->type == t->mode && fe_tuner_ops->get_frequency && !t->standby) {
1126 if (fe_tuner_ops->get_frequency && !t->standby) {
1127 u32 abs_freq; 1105 u32 abs_freq;
1128 1106
1129 fe_tuner_ops->get_frequency(&t->fe, &abs_freq); 1107 fe_tuner_ops->get_frequency(&t->fe, &abs_freq);
@@ -1131,12 +1109,22 @@ static int tuner_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
1131 DIV_ROUND_CLOSEST(abs_freq * 2, 125) : 1109 DIV_ROUND_CLOSEST(abs_freq * 2, 125) :
1132 DIV_ROUND_CLOSEST(abs_freq, 62500); 1110 DIV_ROUND_CLOSEST(abs_freq, 62500);
1133 } else { 1111 } else {
1134 f->frequency = (V4L2_TUNER_RADIO == t->mode) ? 1112 f->frequency = (V4L2_TUNER_RADIO == f->type) ?
1135 t->radio_freq : t->tv_freq; 1113 t->radio_freq : t->tv_freq;
1136 } 1114 }
1137 return 0; 1115 return 0;
1138} 1116}
1139 1117
1118/**
1119 * tuner_g_tuner - Fill in tuner information
1120 * @sd: pointer to struct v4l2_subdev
1121 * @vt: pointer to struct v4l2_tuner
1122 *
1123 * At return, the structure vt will be filled with tuner information
1124 * if the tuner matches vt->type.
1125 * Note: vt->type should be initialized before calling it.
1126 * This is done by either video_ioctl2 or by the bridge driver.
1127 */
1140static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) 1128static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
1141{ 1129{
1142 struct tuner *t = to_tuner(sd); 1130 struct tuner *t = to_tuner(sd);
@@ -1145,48 +1133,58 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
1145 1133
1146 if (check_mode(t, vt->type) == -EINVAL) 1134 if (check_mode(t, vt->type) == -EINVAL)
1147 return 0; 1135 return 0;
1148 vt->type = t->mode; 1136 if (vt->type == t->mode && analog_ops->get_afc)
1149 if (analog_ops->get_afc)
1150 vt->afc = analog_ops->get_afc(&t->fe); 1137 vt->afc = analog_ops->get_afc(&t->fe);
1151 if (t->mode == V4L2_TUNER_ANALOG_TV) 1138 if (vt->type == V4L2_TUNER_ANALOG_TV)
1152 vt->capability |= V4L2_TUNER_CAP_NORM; 1139 vt->capability |= V4L2_TUNER_CAP_NORM;
1153 if (t->mode != V4L2_TUNER_RADIO) { 1140 if (vt->type != V4L2_TUNER_RADIO) {
1154 vt->rangelow = tv_range[0] * 16; 1141 vt->rangelow = tv_range[0] * 16;
1155 vt->rangehigh = tv_range[1] * 16; 1142 vt->rangehigh = tv_range[1] * 16;
1156 return 0; 1143 return 0;
1157 } 1144 }
1158 1145
1159 /* radio mode */ 1146 /* radio mode */
1160 vt->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; 1147 if (vt->type == t->mode) {
1161 if (fe_tuner_ops->get_status) { 1148 vt->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
1162 u32 tuner_status; 1149 if (fe_tuner_ops->get_status) {
1163 1150 u32 tuner_status;
1164 fe_tuner_ops->get_status(&t->fe, &tuner_status); 1151
1165 vt->rxsubchans = 1152 fe_tuner_ops->get_status(&t->fe, &tuner_status);
1166 (tuner_status & TUNER_STATUS_STEREO) ? 1153 vt->rxsubchans =
1167 V4L2_TUNER_SUB_STEREO : 1154 (tuner_status & TUNER_STATUS_STEREO) ?
1168 V4L2_TUNER_SUB_MONO; 1155 V4L2_TUNER_SUB_STEREO :
1156 V4L2_TUNER_SUB_MONO;
1157 }
1158 if (analog_ops->has_signal)
1159 vt->signal = analog_ops->has_signal(&t->fe);
1160 vt->audmode = t->audmode;
1169 } 1161 }
1170 if (analog_ops->has_signal)
1171 vt->signal = analog_ops->has_signal(&t->fe);
1172 vt->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; 1162 vt->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
1173 vt->audmode = t->audmode;
1174 vt->rangelow = radio_range[0] * 16000; 1163 vt->rangelow = radio_range[0] * 16000;
1175 vt->rangehigh = radio_range[1] * 16000; 1164 vt->rangehigh = radio_range[1] * 16000;
1176 1165
1177 return 0; 1166 return 0;
1178} 1167}
1179 1168
1169/**
1170 * tuner_s_tuner - Set the tuner's audio mode
1171 * @sd: pointer to struct v4l2_subdev
1172 * @vt: pointer to struct v4l2_tuner
1173 *
1174 * Sets the audio mode if the tuner matches vt->type.
1175 * Note: vt->type should be initialized before calling it.
1176 * This is done by either video_ioctl2 or by the bridge driver.
1177 */
1180static int tuner_s_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) 1178static int tuner_s_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
1181{ 1179{
1182 struct tuner *t = to_tuner(sd); 1180 struct tuner *t = to_tuner(sd);
1183 struct i2c_client *client = v4l2_get_subdevdata(sd);
1184 1181
1185 if (set_mode_freq(client, t, vt->type, 0) == -EINVAL) 1182 if (set_mode(t, vt->type))
1186 return 0; 1183 return 0;
1187 1184
1188 if (t->mode == V4L2_TUNER_RADIO) 1185 if (t->mode == V4L2_TUNER_RADIO)
1189 t->audmode = vt->audmode; 1186 t->audmode = vt->audmode;
1187 set_freq(t, 0);
1190 1188
1191 return 0; 1189 return 0;
1192} 1190}
@@ -1221,7 +1219,8 @@ static int tuner_resume(struct i2c_client *c)
1221 tuner_dbg("resume\n"); 1219 tuner_dbg("resume\n");
1222 1220
1223 if (!t->standby) 1221 if (!t->standby)
1224 set_mode_freq(c, t, t->type, 0); 1222 if (set_mode(t, t->mode) == 0)
1223 set_freq(t, 0);
1225 1224
1226 return 0; 1225 return 0;
1227} 1226}
diff --git a/drivers/media/video/uvc/uvc_entity.c b/drivers/media/video/uvc/uvc_entity.c
index c3ab0c813be2..48fea373c25a 100644
--- a/drivers/media/video/uvc/uvc_entity.c
+++ b/drivers/media/video/uvc/uvc_entity.c
@@ -27,14 +27,20 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
27 struct uvc_entity *entity) 27 struct uvc_entity *entity)
28{ 28{
29 const u32 flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE; 29 const u32 flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE;
30 struct uvc_entity *remote; 30 struct media_entity *sink;
31 unsigned int i; 31 unsigned int i;
32 u8 remote_pad; 32 int ret;
33 int ret = 0; 33
34 sink = (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
35 ? (entity->vdev ? &entity->vdev->entity : NULL)
36 : &entity->subdev.entity;
37 if (sink == NULL)
38 return 0;
34 39
35 for (i = 0; i < entity->num_pads; ++i) { 40 for (i = 0; i < entity->num_pads; ++i) {
36 struct media_entity *source; 41 struct media_entity *source;
37 struct media_entity *sink; 42 struct uvc_entity *remote;
43 u8 remote_pad;
38 44
39 if (!(entity->pads[i].flags & MEDIA_PAD_FL_SINK)) 45 if (!(entity->pads[i].flags & MEDIA_PAD_FL_SINK))
40 continue; 46 continue;
@@ -43,10 +49,11 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
43 if (remote == NULL) 49 if (remote == NULL)
44 return -EINVAL; 50 return -EINVAL;
45 51
46 source = (UVC_ENTITY_TYPE(remote) == UVC_TT_STREAMING) 52 source = (UVC_ENTITY_TYPE(remote) != UVC_TT_STREAMING)
47 ? &remote->vdev->entity : &remote->subdev.entity; 53 ? (remote->vdev ? &remote->vdev->entity : NULL)
48 sink = (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING) 54 : &remote->subdev.entity;
49 ? &entity->vdev->entity : &entity->subdev.entity; 55 if (source == NULL)
56 continue;
50 57
51 remote_pad = remote->num_pads - 1; 58 remote_pad = remote->num_pads - 1;
52 ret = media_entity_create_link(source, remote_pad, 59 ret = media_entity_create_link(source, remote_pad,
@@ -55,11 +62,10 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
55 return ret; 62 return ret;
56 } 63 }
57 64
58 if (UVC_ENTITY_TYPE(entity) != UVC_TT_STREAMING) 65 if (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
59 ret = v4l2_device_register_subdev(&chain->dev->vdev, 66 return 0;
60 &entity->subdev);
61 67
62 return ret; 68 return v4l2_device_register_subdev(&chain->dev->vdev, &entity->subdev);
63} 69}
64 70
65static struct v4l2_subdev_ops uvc_subdev_ops = { 71static struct v4l2_subdev_ops uvc_subdev_ops = {
@@ -84,9 +90,11 @@ static int uvc_mc_init_entity(struct uvc_entity *entity)
84 90
85 ret = media_entity_init(&entity->subdev.entity, 91 ret = media_entity_init(&entity->subdev.entity,
86 entity->num_pads, entity->pads, 0); 92 entity->num_pads, entity->pads, 0);
87 } else 93 } else if (entity->vdev != NULL) {
88 ret = media_entity_init(&entity->vdev->entity, 94 ret = media_entity_init(&entity->vdev->entity,
89 entity->num_pads, entity->pads, 0); 95 entity->num_pads, entity->pads, 0);
96 } else
97 ret = 0;
90 98
91 return ret; 99 return ret;
92} 100}
diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c
index 109a06384a8f..f90ce9fce539 100644
--- a/drivers/media/video/uvc/uvc_queue.c
+++ b/drivers/media/video/uvc/uvc_queue.c
@@ -104,6 +104,8 @@ static int __uvc_free_buffers(struct uvc_video_queue *queue)
104 } 104 }
105 105
106 if (queue->count) { 106 if (queue->count) {
107 uvc_queue_cancel(queue, 0);
108 INIT_LIST_HEAD(&queue->mainqueue);
107 vfree(queue->mem); 109 vfree(queue->mem);
108 queue->count = 0; 110 queue->count = 0;
109 } 111 }
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
index fc766b9f24c5..49994793cc77 100644
--- a/drivers/media/video/uvc/uvc_video.c
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -1255,8 +1255,10 @@ int uvc_video_enable(struct uvc_streaming *stream, int enable)
1255 1255
1256 /* Commit the streaming parameters. */ 1256 /* Commit the streaming parameters. */
1257 ret = uvc_commit_video(stream, &stream->ctrl); 1257 ret = uvc_commit_video(stream, &stream->ctrl);
1258 if (ret < 0) 1258 if (ret < 0) {
1259 uvc_queue_enable(&stream->queue, 0);
1259 return ret; 1260 return ret;
1261 }
1260 1262
1261 return uvc_init_video(stream, GFP_KERNEL); 1263 return uvc_init_video(stream, GFP_KERNEL);
1262} 1264}
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 19d5ae293780..06f14008b346 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -167,6 +167,12 @@ static void v4l2_device_release(struct device *cd)
167 167
168 mutex_unlock(&videodev_lock); 168 mutex_unlock(&videodev_lock);
169 169
170#if defined(CONFIG_MEDIA_CONTROLLER)
171 if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
172 vdev->vfl_type != VFL_TYPE_SUBDEV)
173 media_device_unregister_entity(&vdev->entity);
174#endif
175
170 /* Release video_device and perform other 176 /* Release video_device and perform other
171 cleanups as needed. */ 177 cleanups as needed. */
172 vdev->release(vdev); 178 vdev->release(vdev);
@@ -389,9 +395,6 @@ static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm)
389static int v4l2_open(struct inode *inode, struct file *filp) 395static int v4l2_open(struct inode *inode, struct file *filp)
390{ 396{
391 struct video_device *vdev; 397 struct video_device *vdev;
392#if defined(CONFIG_MEDIA_CONTROLLER)
393 struct media_entity *entity = NULL;
394#endif
395 int ret = 0; 398 int ret = 0;
396 399
397 /* Check if the video device is available */ 400 /* Check if the video device is available */
@@ -405,17 +408,6 @@ static int v4l2_open(struct inode *inode, struct file *filp)
405 /* and increase the device refcount */ 408 /* and increase the device refcount */
406 video_get(vdev); 409 video_get(vdev);
407 mutex_unlock(&videodev_lock); 410 mutex_unlock(&videodev_lock);
408#if defined(CONFIG_MEDIA_CONTROLLER)
409 if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
410 vdev->vfl_type != VFL_TYPE_SUBDEV) {
411 entity = media_entity_get(&vdev->entity);
412 if (!entity) {
413 ret = -EBUSY;
414 video_put(vdev);
415 return ret;
416 }
417 }
418#endif
419 if (vdev->fops->open) { 411 if (vdev->fops->open) {
420 if (vdev->lock && mutex_lock_interruptible(vdev->lock)) { 412 if (vdev->lock && mutex_lock_interruptible(vdev->lock)) {
421 ret = -ERESTARTSYS; 413 ret = -ERESTARTSYS;
@@ -431,14 +423,8 @@ static int v4l2_open(struct inode *inode, struct file *filp)
431 423
432err: 424err:
433 /* decrease the refcount in case of an error */ 425 /* decrease the refcount in case of an error */
434 if (ret) { 426 if (ret)
435#if defined(CONFIG_MEDIA_CONTROLLER)
436 if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
437 vdev->vfl_type != VFL_TYPE_SUBDEV)
438 media_entity_put(entity);
439#endif
440 video_put(vdev); 427 video_put(vdev);
441 }
442 return ret; 428 return ret;
443} 429}
444 430
@@ -455,11 +441,6 @@ static int v4l2_release(struct inode *inode, struct file *filp)
455 if (vdev->lock) 441 if (vdev->lock)
456 mutex_unlock(vdev->lock); 442 mutex_unlock(vdev->lock);
457 } 443 }
458#if defined(CONFIG_MEDIA_CONTROLLER)
459 if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
460 vdev->vfl_type != VFL_TYPE_SUBDEV)
461 media_entity_put(&vdev->entity);
462#endif
463 /* decrease the refcount unconditionally since the release() 444 /* decrease the refcount unconditionally since the release()
464 return value is ignored. */ 445 return value is ignored. */
465 video_put(vdev); 446 video_put(vdev);
@@ -754,12 +735,6 @@ void video_unregister_device(struct video_device *vdev)
754 if (!vdev || !video_is_registered(vdev)) 735 if (!vdev || !video_is_registered(vdev))
755 return; 736 return;
756 737
757#if defined(CONFIG_MEDIA_CONTROLLER)
758 if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
759 vdev->vfl_type != VFL_TYPE_SUBDEV)
760 media_device_unregister_entity(&vdev->entity);
761#endif
762
763 mutex_lock(&videodev_lock); 738 mutex_lock(&videodev_lock);
764 /* This must be in a critical section to prevent a race with v4l2_open. 739 /* This must be in a critical section to prevent a race with v4l2_open.
765 * Once this bit has been cleared video_get may never be called again. 740 * Once this bit has been cleared video_get may never be called again.
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 506edcc2ddeb..69e8c6ffcc49 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -1822,6 +1822,8 @@ static long __video_do_ioctl(struct file *file,
1822 if (!ops->vidioc_g_tuner) 1822 if (!ops->vidioc_g_tuner)
1823 break; 1823 break;
1824 1824
1825 p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
1826 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1825 ret = ops->vidioc_g_tuner(file, fh, p); 1827 ret = ops->vidioc_g_tuner(file, fh, p);
1826 if (!ret) 1828 if (!ret)
1827 dbgarg(cmd, "index=%d, name=%s, type=%d, " 1829 dbgarg(cmd, "index=%d, name=%s, type=%d, "
@@ -1840,6 +1842,8 @@ static long __video_do_ioctl(struct file *file,
1840 1842
1841 if (!ops->vidioc_s_tuner) 1843 if (!ops->vidioc_s_tuner)
1842 break; 1844 break;
1845 p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
1846 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1843 dbgarg(cmd, "index=%d, name=%s, type=%d, " 1847 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1844 "capability=0x%x, rangelow=%d, " 1848 "capability=0x%x, rangelow=%d, "
1845 "rangehigh=%d, signal=%d, afc=%d, " 1849 "rangehigh=%d, signal=%d, afc=%d, "
@@ -1858,6 +1862,8 @@ static long __video_do_ioctl(struct file *file,
1858 if (!ops->vidioc_g_frequency) 1862 if (!ops->vidioc_g_frequency)
1859 break; 1863 break;
1860 1864
1865 p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
1866 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1861 ret = ops->vidioc_g_frequency(file, fh, p); 1867 ret = ops->vidioc_g_frequency(file, fh, p);
1862 if (!ret) 1868 if (!ret)
1863 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n", 1869 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
@@ -1940,13 +1946,19 @@ static long __video_do_ioctl(struct file *file,
1940 case VIDIOC_S_HW_FREQ_SEEK: 1946 case VIDIOC_S_HW_FREQ_SEEK:
1941 { 1947 {
1942 struct v4l2_hw_freq_seek *p = arg; 1948 struct v4l2_hw_freq_seek *p = arg;
1949 enum v4l2_tuner_type type;
1943 1950
1944 if (!ops->vidioc_s_hw_freq_seek) 1951 if (!ops->vidioc_s_hw_freq_seek)
1945 break; 1952 break;
1953 type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
1954 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1946 dbgarg(cmd, 1955 dbgarg(cmd,
1947 "tuner=%d, type=%d, seek_upward=%d, wrap_around=%d\n", 1956 "tuner=%u, type=%u, seek_upward=%u, wrap_around=%u, spacing=%u\n",
1948 p->tuner, p->type, p->seek_upward, p->wrap_around); 1957 p->tuner, p->type, p->seek_upward, p->wrap_around, p->spacing);
1949 ret = ops->vidioc_s_hw_freq_seek(file, fh, p); 1958 if (p->type != type)
1959 ret = -EINVAL;
1960 else
1961 ret = ops->vidioc_s_hw_freq_seek(file, fh, p);
1950 break; 1962 break;
1951 } 1963 }
1952 case VIDIOC_ENUM_FRAMESIZES: 1964 case VIDIOC_ENUM_FRAMESIZES:
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c
index 6ba1461d51ef..3015e6000946 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -492,13 +492,6 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
492 return -EINVAL; 492 return -EINVAL;
493 } 493 }
494 494
495 /*
496 * If the same number of buffers and memory access method is requested
497 * then return immediately.
498 */
499 if (q->memory == req->memory && req->count == q->num_buffers)
500 return 0;
501
502 if (req->count == 0 || q->num_buffers != 0 || q->memory != req->memory) { 495 if (req->count == 0 || q->num_buffers != 0 || q->memory != req->memory) {
503 /* 496 /*
504 * We already have buffers allocated, so first check if they 497 * We already have buffers allocated, so first check if they
@@ -539,9 +532,9 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
539 /* Finally, allocate buffers and video memory */ 532 /* Finally, allocate buffers and video memory */
540 ret = __vb2_queue_alloc(q, req->memory, num_buffers, num_planes, 533 ret = __vb2_queue_alloc(q, req->memory, num_buffers, num_planes,
541 plane_sizes); 534 plane_sizes);
542 if (ret < 0) { 535 if (ret == 0) {
543 dprintk(1, "Memory allocation failed with error: %d\n", ret); 536 dprintk(1, "Memory allocation failed\n");
544 return ret; 537 return -ENOMEM;
545 } 538 }
546 539
547 /* 540 /*
@@ -1196,6 +1189,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
1196 * has not already dequeued before initiating cancel. 1189 * has not already dequeued before initiating cancel.
1197 */ 1190 */
1198 INIT_LIST_HEAD(&q->done_list); 1191 INIT_LIST_HEAD(&q->done_list);
1192 atomic_set(&q->queued_count, 0);
1199 wake_up_all(&q->done_wq); 1193 wake_up_all(&q->done_wq);
1200 1194
1201 /* 1195 /*
diff --git a/drivers/media/video/videobuf2-dma-sg.c b/drivers/media/video/videobuf2-dma-sg.c
index b2d9485aac75..10a20d9509d9 100644
--- a/drivers/media/video/videobuf2-dma-sg.c
+++ b/drivers/media/video/videobuf2-dma-sg.c
@@ -62,7 +62,7 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size)
62 goto fail_pages_array_alloc; 62 goto fail_pages_array_alloc;
63 63
64 for (i = 0; i < buf->sg_desc.num_pages; ++i) { 64 for (i = 0; i < buf->sg_desc.num_pages; ++i) {
65 buf->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO); 65 buf->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN);
66 if (NULL == buf->pages[i]) 66 if (NULL == buf->pages[i])
67 goto fail_pages_alloc; 67 goto fail_pages_alloc;
68 sg_set_page(&buf->sg_desc.sglist[i], 68 sg_set_page(&buf->sg_desc.sglist[i],
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 0f09c057e796..6ca938a6bf94 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -728,6 +728,9 @@ config MFD_TPS65910
728 if you say yes here you get support for the TPS65910 series of 728 if you say yes here you get support for the TPS65910 series of
729 Power Management chips. 729 Power Management chips.
730 730
731config TPS65911_COMPARATOR
732 tristate
733
731endif # MFD_SUPPORT 734endif # MFD_SUPPORT
732 735
733menu "Multimedia Capabilities Port drivers" 736menu "Multimedia Capabilities Port drivers"
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index efe3cc33ed92..d7d47d2a4c76 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -94,3 +94,4 @@ obj-$(CONFIG_MFD_OMAP_USB_HOST) += omap-usb-host.o
94obj-$(CONFIG_MFD_PM8921_CORE) += pm8921-core.o 94obj-$(CONFIG_MFD_PM8921_CORE) += pm8921-core.o
95obj-$(CONFIG_MFD_PM8XXX_IRQ) += pm8xxx-irq.o 95obj-$(CONFIG_MFD_PM8XXX_IRQ) += pm8xxx-irq.o
96obj-$(CONFIG_MFD_TPS65910) += tps65910.o tps65910-irq.o 96obj-$(CONFIG_MFD_TPS65910) += tps65910.o tps65910-irq.o
97obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index c27fd1fc3b86..c71ae09430c5 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -619,6 +619,7 @@ static void asic3_clk_disable(struct asic3 *asic, struct asic3_clk *clk)
619/* MFD cells (SPI, PWM, LED, DS1WM, MMC) */ 619/* MFD cells (SPI, PWM, LED, DS1WM, MMC) */
620static struct ds1wm_driver_data ds1wm_pdata = { 620static struct ds1wm_driver_data ds1wm_pdata = {
621 .active_high = 1, 621 .active_high = 1,
622 .reset_recover_delay = 1,
622}; 623};
623 624
624static struct resource ds1wm_resources[] = { 625static struct resource ds1wm_resources[] = {
diff --git a/drivers/mfd/htc-pasic3.c b/drivers/mfd/htc-pasic3.c
index 2808bd125d13..04c7093d6499 100644
--- a/drivers/mfd/htc-pasic3.c
+++ b/drivers/mfd/htc-pasic3.c
@@ -99,6 +99,7 @@ static int ds1wm_disable(struct platform_device *pdev)
99 99
100static struct ds1wm_driver_data ds1wm_pdata = { 100static struct ds1wm_driver_data ds1wm_pdata = {
101 .active_high = 0, 101 .active_high = 0,
102 .reset_recover_delay = 1,
102}; 103};
103 104
104static struct resource ds1wm_resources[] __initdata = { 105static struct resource ds1wm_resources[] __initdata = {
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 855219526ccb..1717144fe7f4 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -26,7 +26,6 @@
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <plat/usb.h> 28#include <plat/usb.h>
29#include <linux/pm_runtime.h>
30 29
31#define USBHS_DRIVER_NAME "usbhs-omap" 30#define USBHS_DRIVER_NAME "usbhs-omap"
32#define OMAP_EHCI_DEVICE "ehci-omap" 31#define OMAP_EHCI_DEVICE "ehci-omap"
@@ -147,6 +146,9 @@
147 146
148 147
149struct usbhs_hcd_omap { 148struct usbhs_hcd_omap {
149 struct clk *usbhost_ick;
150 struct clk *usbhost_hs_fck;
151 struct clk *usbhost_fs_fck;
150 struct clk *xclk60mhsp1_ck; 152 struct clk *xclk60mhsp1_ck;
151 struct clk *xclk60mhsp2_ck; 153 struct clk *xclk60mhsp2_ck;
152 struct clk *utmi_p1_fck; 154 struct clk *utmi_p1_fck;
@@ -156,6 +158,8 @@ struct usbhs_hcd_omap {
156 struct clk *usbhost_p2_fck; 158 struct clk *usbhost_p2_fck;
157 struct clk *usbtll_p2_fck; 159 struct clk *usbtll_p2_fck;
158 struct clk *init_60m_fclk; 160 struct clk *init_60m_fclk;
161 struct clk *usbtll_fck;
162 struct clk *usbtll_ick;
159 163
160 void __iomem *uhh_base; 164 void __iomem *uhh_base;
161 void __iomem *tll_base; 165 void __iomem *tll_base;
@@ -349,13 +353,46 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
349 omap->platdata.ehci_data = pdata->ehci_data; 353 omap->platdata.ehci_data = pdata->ehci_data;
350 omap->platdata.ohci_data = pdata->ohci_data; 354 omap->platdata.ohci_data = pdata->ohci_data;
351 355
352 pm_runtime_enable(&pdev->dev); 356 omap->usbhost_ick = clk_get(dev, "usbhost_ick");
357 if (IS_ERR(omap->usbhost_ick)) {
358 ret = PTR_ERR(omap->usbhost_ick);
359 dev_err(dev, "usbhost_ick failed error:%d\n", ret);
360 goto err_end;
361 }
362
363 omap->usbhost_hs_fck = clk_get(dev, "hs_fck");
364 if (IS_ERR(omap->usbhost_hs_fck)) {
365 ret = PTR_ERR(omap->usbhost_hs_fck);
366 dev_err(dev, "usbhost_hs_fck failed error:%d\n", ret);
367 goto err_usbhost_ick;
368 }
369
370 omap->usbhost_fs_fck = clk_get(dev, "fs_fck");
371 if (IS_ERR(omap->usbhost_fs_fck)) {
372 ret = PTR_ERR(omap->usbhost_fs_fck);
373 dev_err(dev, "usbhost_fs_fck failed error:%d\n", ret);
374 goto err_usbhost_hs_fck;
375 }
376
377 omap->usbtll_fck = clk_get(dev, "usbtll_fck");
378 if (IS_ERR(omap->usbtll_fck)) {
379 ret = PTR_ERR(omap->usbtll_fck);
380 dev_err(dev, "usbtll_fck failed error:%d\n", ret);
381 goto err_usbhost_fs_fck;
382 }
383
384 omap->usbtll_ick = clk_get(dev, "usbtll_ick");
385 if (IS_ERR(omap->usbtll_ick)) {
386 ret = PTR_ERR(omap->usbtll_ick);
387 dev_err(dev, "usbtll_ick failed error:%d\n", ret);
388 goto err_usbtll_fck;
389 }
353 390
354 omap->utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk"); 391 omap->utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
355 if (IS_ERR(omap->utmi_p1_fck)) { 392 if (IS_ERR(omap->utmi_p1_fck)) {
356 ret = PTR_ERR(omap->utmi_p1_fck); 393 ret = PTR_ERR(omap->utmi_p1_fck);
357 dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret); 394 dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
358 goto err_end; 395 goto err_usbtll_ick;
359 } 396 }
360 397
361 omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck"); 398 omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
@@ -485,8 +522,22 @@ err_xclk60mhsp1_ck:
485err_utmi_p1_fck: 522err_utmi_p1_fck:
486 clk_put(omap->utmi_p1_fck); 523 clk_put(omap->utmi_p1_fck);
487 524
525err_usbtll_ick:
526 clk_put(omap->usbtll_ick);
527
528err_usbtll_fck:
529 clk_put(omap->usbtll_fck);
530
531err_usbhost_fs_fck:
532 clk_put(omap->usbhost_fs_fck);
533
534err_usbhost_hs_fck:
535 clk_put(omap->usbhost_hs_fck);
536
537err_usbhost_ick:
538 clk_put(omap->usbhost_ick);
539
488err_end: 540err_end:
489 pm_runtime_disable(&pdev->dev);
490 kfree(omap); 541 kfree(omap);
491 542
492end_probe: 543end_probe:
@@ -520,7 +571,11 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev)
520 clk_put(omap->utmi_p2_fck); 571 clk_put(omap->utmi_p2_fck);
521 clk_put(omap->xclk60mhsp1_ck); 572 clk_put(omap->xclk60mhsp1_ck);
522 clk_put(omap->utmi_p1_fck); 573 clk_put(omap->utmi_p1_fck);
523 pm_runtime_disable(&pdev->dev); 574 clk_put(omap->usbtll_ick);
575 clk_put(omap->usbtll_fck);
576 clk_put(omap->usbhost_fs_fck);
577 clk_put(omap->usbhost_hs_fck);
578 clk_put(omap->usbhost_ick);
524 kfree(omap); 579 kfree(omap);
525 580
526 return 0; 581 return 0;
@@ -640,6 +695,7 @@ static int usbhs_enable(struct device *dev)
640 struct usbhs_omap_platform_data *pdata = &omap->platdata; 695 struct usbhs_omap_platform_data *pdata = &omap->platdata;
641 unsigned long flags = 0; 696 unsigned long flags = 0;
642 int ret = 0; 697 int ret = 0;
698 unsigned long timeout;
643 unsigned reg; 699 unsigned reg;
644 700
645 dev_dbg(dev, "starting TI HSUSB Controller\n"); 701 dev_dbg(dev, "starting TI HSUSB Controller\n");
@@ -652,7 +708,11 @@ static int usbhs_enable(struct device *dev)
652 if (omap->count > 0) 708 if (omap->count > 0)
653 goto end_count; 709 goto end_count;
654 710
655 pm_runtime_get_sync(dev); 711 clk_enable(omap->usbhost_ick);
712 clk_enable(omap->usbhost_hs_fck);
713 clk_enable(omap->usbhost_fs_fck);
714 clk_enable(omap->usbtll_fck);
715 clk_enable(omap->usbtll_ick);
656 716
657 if (pdata->ehci_data->phy_reset) { 717 if (pdata->ehci_data->phy_reset) {
658 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) { 718 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) {
@@ -676,6 +736,50 @@ static int usbhs_enable(struct device *dev)
676 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); 736 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
677 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); 737 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev);
678 738
739 /* perform TLL soft reset, and wait until reset is complete */
740 usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
741 OMAP_USBTLL_SYSCONFIG_SOFTRESET);
742
743 /* Wait for TLL reset to complete */
744 timeout = jiffies + msecs_to_jiffies(1000);
745 while (!(usbhs_read(omap->tll_base, OMAP_USBTLL_SYSSTATUS)
746 & OMAP_USBTLL_SYSSTATUS_RESETDONE)) {
747 cpu_relax();
748
749 if (time_after(jiffies, timeout)) {
750 dev_dbg(dev, "operation timed out\n");
751 ret = -EINVAL;
752 goto err_tll;
753 }
754 }
755
756 dev_dbg(dev, "TLL RESET DONE\n");
757
758 /* (1<<3) = no idle mode only for initial debugging */
759 usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
760 OMAP_USBTLL_SYSCONFIG_ENAWAKEUP |
761 OMAP_USBTLL_SYSCONFIG_SIDLEMODE |
762 OMAP_USBTLL_SYSCONFIG_AUTOIDLE);
763
764 /* Put UHH in NoIdle/NoStandby mode */
765 reg = usbhs_read(omap->uhh_base, OMAP_UHH_SYSCONFIG);
766 if (is_omap_usbhs_rev1(omap)) {
767 reg |= (OMAP_UHH_SYSCONFIG_ENAWAKEUP
768 | OMAP_UHH_SYSCONFIG_SIDLEMODE
769 | OMAP_UHH_SYSCONFIG_CACTIVITY
770 | OMAP_UHH_SYSCONFIG_MIDLEMODE);
771 reg &= ~OMAP_UHH_SYSCONFIG_AUTOIDLE;
772
773
774 } else if (is_omap_usbhs_rev2(omap)) {
775 reg &= ~OMAP4_UHH_SYSCONFIG_IDLEMODE_CLEAR;
776 reg |= OMAP4_UHH_SYSCONFIG_NOIDLE;
777 reg &= ~OMAP4_UHH_SYSCONFIG_STDBYMODE_CLEAR;
778 reg |= OMAP4_UHH_SYSCONFIG_NOSTDBY;
779 }
780
781 usbhs_write(omap->uhh_base, OMAP_UHH_SYSCONFIG, reg);
782
679 reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG); 783 reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG);
680 /* setup ULPI bypass and burst configurations */ 784 /* setup ULPI bypass and burst configurations */
681 reg |= (OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN 785 reg |= (OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN
@@ -815,8 +919,6 @@ end_count:
815 return 0; 919 return 0;
816 920
817err_tll: 921err_tll:
818 pm_runtime_put_sync(dev);
819 spin_unlock_irqrestore(&omap->lock, flags);
820 if (pdata->ehci_data->phy_reset) { 922 if (pdata->ehci_data->phy_reset) {
821 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) 923 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
822 gpio_free(pdata->ehci_data->reset_gpio_port[0]); 924 gpio_free(pdata->ehci_data->reset_gpio_port[0]);
@@ -824,6 +926,13 @@ err_tll:
824 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) 926 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
825 gpio_free(pdata->ehci_data->reset_gpio_port[1]); 927 gpio_free(pdata->ehci_data->reset_gpio_port[1]);
826 } 928 }
929
930 clk_disable(omap->usbtll_ick);
931 clk_disable(omap->usbtll_fck);
932 clk_disable(omap->usbhost_fs_fck);
933 clk_disable(omap->usbhost_hs_fck);
934 clk_disable(omap->usbhost_ick);
935 spin_unlock_irqrestore(&omap->lock, flags);
827 return ret; 936 return ret;
828} 937}
829 938
@@ -896,7 +1005,11 @@ static void usbhs_disable(struct device *dev)
896 clk_disable(omap->utmi_p1_fck); 1005 clk_disable(omap->utmi_p1_fck);
897 } 1006 }
898 1007
899 pm_runtime_put_sync(dev); 1008 clk_disable(omap->usbtll_ick);
1009 clk_disable(omap->usbtll_fck);
1010 clk_disable(omap->usbhost_fs_fck);
1011 clk_disable(omap->usbhost_hs_fck);
1012 clk_disable(omap->usbhost_ick);
900 1013
901 /* The gpio_free migh sleep; so unlock the spinlock */ 1014 /* The gpio_free migh sleep; so unlock the spinlock */
902 spin_unlock_irqrestore(&omap->lock, flags); 1015 spin_unlock_irqrestore(&omap->lock, flags);
diff --git a/drivers/mfd/tps65911-comparator.c b/drivers/mfd/tps65911-comparator.c
index 3d2dc56a3d40..283ac6759757 100644
--- a/drivers/mfd/tps65911-comparator.c
+++ b/drivers/mfd/tps65911-comparator.c
@@ -125,7 +125,7 @@ static DEVICE_ATTR(comp2_threshold, S_IRUGO, comp_threshold_show, NULL);
125static __devinit int tps65911_comparator_probe(struct platform_device *pdev) 125static __devinit int tps65911_comparator_probe(struct platform_device *pdev)
126{ 126{
127 struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); 127 struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent);
128 struct tps65910_platform_data *pdata = dev_get_platdata(tps65910->dev); 128 struct tps65910_board *pdata = dev_get_platdata(tps65910->dev);
129 int ret; 129 int ret;
130 130
131 ret = comp_threshold_set(tps65910, COMP1, pdata->vmbch_threshold); 131 ret = comp_threshold_set(tps65910, COMP1, pdata->vmbch_threshold);
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 7721de942c69..fe140724a02e 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -582,6 +582,8 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
582 data->error = -EILSEQ; 582 data->error = -EILSEQ;
583 } else if (status & MCI_DATATIMEOUT) { 583 } else if (status & MCI_DATATIMEOUT) {
584 data->error = -ETIMEDOUT; 584 data->error = -ETIMEDOUT;
585 } else if (status & MCI_STARTBITERR) {
586 data->error = -ECOMM;
585 } else if (status & MCI_TXUNDERRUN) { 587 } else if (status & MCI_TXUNDERRUN) {
586 data->error = -EIO; 588 data->error = -EIO;
587 } else if (status & MCI_RXOVERRUN) { 589 } else if (status & MCI_RXOVERRUN) {
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index bb32e21c09db..2164e8c6476c 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -86,6 +86,7 @@
86#define MCI_CMDRESPEND (1 << 6) 86#define MCI_CMDRESPEND (1 << 6)
87#define MCI_CMDSENT (1 << 7) 87#define MCI_CMDSENT (1 << 7)
88#define MCI_DATAEND (1 << 8) 88#define MCI_DATAEND (1 << 8)
89#define MCI_STARTBITERR (1 << 9)
89#define MCI_DATABLOCKEND (1 << 10) 90#define MCI_DATABLOCKEND (1 << 10)
90#define MCI_CMDACTIVE (1 << 11) 91#define MCI_CMDACTIVE (1 << 11)
91#define MCI_TXACTIVE (1 << 12) 92#define MCI_TXACTIVE (1 << 12)
@@ -112,6 +113,7 @@
112#define MCI_CMDRESPENDCLR (1 << 6) 113#define MCI_CMDRESPENDCLR (1 << 6)
113#define MCI_CMDSENTCLR (1 << 7) 114#define MCI_CMDSENTCLR (1 << 7)
114#define MCI_DATAENDCLR (1 << 8) 115#define MCI_DATAENDCLR (1 << 8)
116#define MCI_STARTBITERRCLR (1 << 9)
115#define MCI_DATABLOCKENDCLR (1 << 10) 117#define MCI_DATABLOCKENDCLR (1 << 10)
116/* Extended status bits for the ST Micro variants */ 118/* Extended status bits for the ST Micro variants */
117#define MCI_ST_SDIOITC (1 << 22) 119#define MCI_ST_SDIOITC (1 << 22)
@@ -127,6 +129,7 @@
127#define MCI_CMDRESPENDMASK (1 << 6) 129#define MCI_CMDRESPENDMASK (1 << 6)
128#define MCI_CMDSENTMASK (1 << 7) 130#define MCI_CMDSENTMASK (1 << 7)
129#define MCI_DATAENDMASK (1 << 8) 131#define MCI_DATAENDMASK (1 << 8)
132#define MCI_STARTBITERRMASK (1 << 9)
130#define MCI_DATABLOCKENDMASK (1 << 10) 133#define MCI_DATABLOCKENDMASK (1 << 10)
131#define MCI_CMDACTIVEMASK (1 << 11) 134#define MCI_CMDACTIVEMASK (1 << 11)
132#define MCI_TXACTIVEMASK (1 << 12) 135#define MCI_TXACTIVEMASK (1 << 12)
@@ -150,7 +153,7 @@
150#define MCI_IRQENABLE \ 153#define MCI_IRQENABLE \
151 (MCI_CMDCRCFAILMASK|MCI_DATACRCFAILMASK|MCI_CMDTIMEOUTMASK| \ 154 (MCI_CMDCRCFAILMASK|MCI_DATACRCFAILMASK|MCI_CMDTIMEOUTMASK| \
152 MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ 155 MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \
153 MCI_CMDRESPENDMASK|MCI_CMDSENTMASK) 156 MCI_CMDRESPENDMASK|MCI_CMDSENTMASK|MCI_STARTBITERRMASK)
154 157
155/* These interrupts are directed to IRQ1 when two IRQ lines are available */ 158/* These interrupts are directed to IRQ1 when two IRQ lines are available */
156#define MCI_IRQ1MASK \ 159#define MCI_IRQ1MASK \
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 98517a373473..e3bad8247fd1 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -992,6 +992,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
992 * features 992 * features
993 */ 993 */
994 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA; 994 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
995 dev->vlan_features = dev->features;
995 996
996 dev->irq = pdev->irq; 997 dev->irq = pdev->irq;
997 998
diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c
index 7d25a97d33f6..44e219c910da 100644
--- a/drivers/net/bna/bnad.c
+++ b/drivers/net/bna/bnad.c
@@ -1111,7 +1111,7 @@ bnad_mbox_irq_alloc(struct bnad *bnad,
1111 struct bna_intr_info *intr_info) 1111 struct bna_intr_info *intr_info)
1112{ 1112{
1113 int err = 0; 1113 int err = 0;
1114 unsigned long flags; 1114 unsigned long irq_flags = 0, flags;
1115 u32 irq; 1115 u32 irq;
1116 irq_handler_t irq_handler; 1116 irq_handler_t irq_handler;
1117 1117
@@ -1125,18 +1125,17 @@ bnad_mbox_irq_alloc(struct bnad *bnad,
1125 if (bnad->cfg_flags & BNAD_CF_MSIX) { 1125 if (bnad->cfg_flags & BNAD_CF_MSIX) {
1126 irq_handler = (irq_handler_t)bnad_msix_mbox_handler; 1126 irq_handler = (irq_handler_t)bnad_msix_mbox_handler;
1127 irq = bnad->msix_table[bnad->msix_num - 1].vector; 1127 irq = bnad->msix_table[bnad->msix_num - 1].vector;
1128 flags = 0;
1129 intr_info->intr_type = BNA_INTR_T_MSIX; 1128 intr_info->intr_type = BNA_INTR_T_MSIX;
1130 intr_info->idl[0].vector = bnad->msix_num - 1; 1129 intr_info->idl[0].vector = bnad->msix_num - 1;
1131 } else { 1130 } else {
1132 irq_handler = (irq_handler_t)bnad_isr; 1131 irq_handler = (irq_handler_t)bnad_isr;
1133 irq = bnad->pcidev->irq; 1132 irq = bnad->pcidev->irq;
1134 flags = IRQF_SHARED; 1133 irq_flags = IRQF_SHARED;
1135 intr_info->intr_type = BNA_INTR_T_INTX; 1134 intr_info->intr_type = BNA_INTR_T_INTX;
1136 /* intr_info->idl.vector = 0 ? */ 1135 /* intr_info->idl.vector = 0 ? */
1137 } 1136 }
1138 spin_unlock_irqrestore(&bnad->bna_lock, flags); 1137 spin_unlock_irqrestore(&bnad->bna_lock, flags);
1139 1138 flags = irq_flags;
1140 sprintf(bnad->mbox_irq_name, "%s", BNAD_NAME); 1139 sprintf(bnad->mbox_irq_name, "%s", BNAD_NAME);
1141 1140
1142 /* 1141 /*
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index f181304a7ab6..672f096fe090 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -1015,11 +1015,10 @@ static int greth_set_mac_add(struct net_device *dev, void *p)
1015 return -EINVAL; 1015 return -EINVAL;
1016 1016
1017 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); 1017 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
1018 GRETH_REGSAVE(regs->esa_msb, dev->dev_addr[0] << 8 | dev->dev_addr[1]);
1019 GRETH_REGSAVE(regs->esa_lsb, dev->dev_addr[2] << 24 | dev->dev_addr[3] << 16 |
1020 dev->dev_addr[4] << 8 | dev->dev_addr[5]);
1018 1021
1019 GRETH_REGSAVE(regs->esa_msb, addr->sa_data[0] << 8 | addr->sa_data[1]);
1020 GRETH_REGSAVE(regs->esa_lsb,
1021 addr->sa_data[2] << 24 | addr->
1022 sa_data[3] << 16 | addr->sa_data[4] << 8 | addr->sa_data[5]);
1023 return 0; 1022 return 0;
1024} 1023}
1025 1024
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 3e5d0b6b6516..0d283781bc5e 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -692,10 +692,10 @@ static void sixpack_close(struct tty_struct *tty)
692{ 692{
693 struct sixpack *sp; 693 struct sixpack *sp;
694 694
695 write_lock(&disc_data_lock); 695 write_lock_bh(&disc_data_lock);
696 sp = tty->disc_data; 696 sp = tty->disc_data;
697 tty->disc_data = NULL; 697 tty->disc_data = NULL;
698 write_unlock(&disc_data_lock); 698 write_unlock_bh(&disc_data_lock);
699 if (!sp) 699 if (!sp)
700 return; 700 return;
701 701
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 4c628393c8b1..bc02968cee16 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -813,10 +813,10 @@ static void mkiss_close(struct tty_struct *tty)
813{ 813{
814 struct mkiss *ax; 814 struct mkiss *ax;
815 815
816 write_lock(&disc_data_lock); 816 write_lock_bh(&disc_data_lock);
817 ax = tty->disc_data; 817 ax = tty->disc_data;
818 tty->disc_data = NULL; 818 tty->disc_data = NULL;
819 write_unlock(&disc_data_lock); 819 write_unlock_bh(&disc_data_lock);
820 820
821 if (!ax) 821 if (!ax)
822 return; 822 return;
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index b78be088c4ad..8f8b65af9ed5 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2360,7 +2360,8 @@ static void netdev_rx(struct net_device *dev, int *work_done, int work_to_do)
2360 PCI_DMA_FROMDEVICE); 2360 PCI_DMA_FROMDEVICE);
2361 } else { 2361 } else {
2362 pci_unmap_single(np->pci_dev, np->rx_dma[entry], 2362 pci_unmap_single(np->pci_dev, np->rx_dma[entry],
2363 buflen, PCI_DMA_FROMDEVICE); 2363 buflen + NATSEMI_PADDING,
2364 PCI_DMA_FROMDEVICE);
2364 skb_put(skb = np->rx_skbuff[entry], pkt_len); 2365 skb_put(skb = np->rx_skbuff[entry], pkt_len);
2365 np->rx_skbuff[entry] = NULL; 2366 np->rx_skbuff[entry] = NULL;
2366 } 2367 }
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h
index d32850715f5c..ca306fd5f588 100644
--- a/drivers/net/qlge/qlge.h
+++ b/drivers/net/qlge/qlge.h
@@ -16,7 +16,7 @@
16 */ 16 */
17#define DRV_NAME "qlge" 17#define DRV_NAME "qlge"
18#define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver " 18#define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver "
19#define DRV_VERSION "v1.00.00.27.00.00-01" 19#define DRV_VERSION "v1.00.00.29.00.00-01"
20 20
21#define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */ 21#define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */
22 22
@@ -1996,6 +1996,7 @@ enum {
1996 QL_LB_LINK_UP = 10, 1996 QL_LB_LINK_UP = 10,
1997 QL_FRC_COREDUMP = 11, 1997 QL_FRC_COREDUMP = 11,
1998 QL_EEH_FATAL = 12, 1998 QL_EEH_FATAL = 12,
1999 QL_ASIC_RECOVERY = 14, /* We are in ascic recovery. */
1999}; 2000};
2000 2001
2001/* link_status bit definitions */ 2002/* link_status bit definitions */
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 930ae45457bb..6b4ff970972b 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -2152,6 +2152,10 @@ void ql_queue_asic_error(struct ql_adapter *qdev)
2152 * thread 2152 * thread
2153 */ 2153 */
2154 clear_bit(QL_ADAPTER_UP, &qdev->flags); 2154 clear_bit(QL_ADAPTER_UP, &qdev->flags);
2155 /* Set asic recovery bit to indicate reset process that we are
2156 * in fatal error recovery process rather than normal close
2157 */
2158 set_bit(QL_ASIC_RECOVERY, &qdev->flags);
2155 queue_delayed_work(qdev->workqueue, &qdev->asic_reset_work, 0); 2159 queue_delayed_work(qdev->workqueue, &qdev->asic_reset_work, 0);
2156} 2160}
2157 2161
@@ -2166,23 +2170,20 @@ static void ql_process_chip_ae_intr(struct ql_adapter *qdev,
2166 return; 2170 return;
2167 2171
2168 case CAM_LOOKUP_ERR_EVENT: 2172 case CAM_LOOKUP_ERR_EVENT:
2169 netif_err(qdev, link, qdev->ndev, 2173 netdev_err(qdev->ndev, "Multiple CAM hits lookup occurred.\n");
2170 "Multiple CAM hits lookup occurred.\n"); 2174 netdev_err(qdev->ndev, "This event shouldn't occur.\n");
2171 netif_err(qdev, drv, qdev->ndev,
2172 "This event shouldn't occur.\n");
2173 ql_queue_asic_error(qdev); 2175 ql_queue_asic_error(qdev);
2174 return; 2176 return;
2175 2177
2176 case SOFT_ECC_ERROR_EVENT: 2178 case SOFT_ECC_ERROR_EVENT:
2177 netif_err(qdev, rx_err, qdev->ndev, 2179 netdev_err(qdev->ndev, "Soft ECC error detected.\n");
2178 "Soft ECC error detected.\n");
2179 ql_queue_asic_error(qdev); 2180 ql_queue_asic_error(qdev);
2180 break; 2181 break;
2181 2182
2182 case PCI_ERR_ANON_BUF_RD: 2183 case PCI_ERR_ANON_BUF_RD:
2183 netif_err(qdev, rx_err, qdev->ndev, 2184 netdev_err(qdev->ndev, "PCI error occurred when reading "
2184 "PCI error occurred when reading anonymous buffers from rx_ring %d.\n", 2185 "anonymous buffers from rx_ring %d.\n",
2185 ib_ae_rsp->q_id); 2186 ib_ae_rsp->q_id);
2186 ql_queue_asic_error(qdev); 2187 ql_queue_asic_error(qdev);
2187 break; 2188 break;
2188 2189
@@ -2437,11 +2438,10 @@ static irqreturn_t qlge_isr(int irq, void *dev_id)
2437 */ 2438 */
2438 if (var & STS_FE) { 2439 if (var & STS_FE) {
2439 ql_queue_asic_error(qdev); 2440 ql_queue_asic_error(qdev);
2440 netif_err(qdev, intr, qdev->ndev, 2441 netdev_err(qdev->ndev, "Got fatal error, STS = %x.\n", var);
2441 "Got fatal error, STS = %x.\n", var);
2442 var = ql_read32(qdev, ERR_STS); 2442 var = ql_read32(qdev, ERR_STS);
2443 netif_err(qdev, intr, qdev->ndev, 2443 netdev_err(qdev->ndev, "Resetting chip. "
2444 "Resetting chip. Error Status Register = 0x%x\n", var); 2444 "Error Status Register = 0x%x\n", var);
2445 return IRQ_HANDLED; 2445 return IRQ_HANDLED;
2446 } 2446 }
2447 2447
@@ -3818,11 +3818,17 @@ static int ql_adapter_reset(struct ql_adapter *qdev)
3818 end_jiffies = jiffies + 3818 end_jiffies = jiffies +
3819 max((unsigned long)1, usecs_to_jiffies(30)); 3819 max((unsigned long)1, usecs_to_jiffies(30));
3820 3820
3821 /* Stop management traffic. */ 3821 /* Check if bit is set then skip the mailbox command and
3822 ql_mb_set_mgmnt_traffic_ctl(qdev, MB_SET_MPI_TFK_STOP); 3822 * clear the bit, else we are in normal reset process.
3823 */
3824 if (!test_bit(QL_ASIC_RECOVERY, &qdev->flags)) {
3825 /* Stop management traffic. */
3826 ql_mb_set_mgmnt_traffic_ctl(qdev, MB_SET_MPI_TFK_STOP);
3823 3827
3824 /* Wait for the NIC and MGMNT FIFOs to empty. */ 3828 /* Wait for the NIC and MGMNT FIFOs to empty. */
3825 ql_wait_fifo_empty(qdev); 3829 ql_wait_fifo_empty(qdev);
3830 } else
3831 clear_bit(QL_ASIC_RECOVERY, &qdev->flags);
3826 3832
3827 ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); 3833 ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR);
3828 3834
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 8a72a979ee71..1f3f7b4dd638 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -140,6 +140,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
140 .tpauser = 1, 140 .tpauser = 1,
141 .hw_swap = 1, 141 .hw_swap = 1,
142 .no_ade = 1, 142 .no_ade = 1,
143 .rpadir = 1,
144 .rpadir_value = 2 << 16,
143}; 145};
144 146
145#define SH_GIGA_ETH_BASE 0xfee00000 147#define SH_GIGA_ETH_BASE 0xfee00000
@@ -1184,8 +1186,8 @@ static void sh_eth_adjust_link(struct net_device *ndev)
1184 mdp->cd->set_rate(ndev); 1186 mdp->cd->set_rate(ndev);
1185 } 1187 }
1186 if (mdp->link == PHY_DOWN) { 1188 if (mdp->link == PHY_DOWN) {
1187 sh_eth_write(ndev, (sh_eth_read(ndev, ECMR) & ~ECMR_TXF) 1189 sh_eth_write(ndev,
1188 | ECMR_DM, ECMR); 1190 (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR);
1189 new_state = 1; 1191 new_state = 1;
1190 mdp->link = phydev->link; 1192 mdp->link = phydev->link;
1191 } 1193 }
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index fa6e2ac7475a..67402350d0df 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -575,7 +575,7 @@ vmxnet3_rq_alloc_rx_buf(struct vmxnet3_rx_queue *rq, u32 ring_idx,
575 struct vmxnet3_cmd_ring *ring = &rq->rx_ring[ring_idx]; 575 struct vmxnet3_cmd_ring *ring = &rq->rx_ring[ring_idx];
576 u32 val; 576 u32 val;
577 577
578 while (num_allocated < num_to_alloc) { 578 while (num_allocated <= num_to_alloc) {
579 struct vmxnet3_rx_buf_info *rbi; 579 struct vmxnet3_rx_buf_info *rbi;
580 union Vmxnet3_GenericDesc *gd; 580 union Vmxnet3_GenericDesc *gd;
581 581
@@ -621,9 +621,15 @@ vmxnet3_rq_alloc_rx_buf(struct vmxnet3_rx_queue *rq, u32 ring_idx,
621 621
622 BUG_ON(rbi->dma_addr == 0); 622 BUG_ON(rbi->dma_addr == 0);
623 gd->rxd.addr = cpu_to_le64(rbi->dma_addr); 623 gd->rxd.addr = cpu_to_le64(rbi->dma_addr);
624 gd->dword[2] = cpu_to_le32((ring->gen << VMXNET3_RXD_GEN_SHIFT) 624 gd->dword[2] = cpu_to_le32((!ring->gen << VMXNET3_RXD_GEN_SHIFT)
625 | val | rbi->len); 625 | val | rbi->len);
626 626
627 /* Fill the last buffer but dont mark it ready, or else the
628 * device will think that the queue is full */
629 if (num_allocated == num_to_alloc)
630 break;
631
632 gd->dword[2] |= cpu_to_le32(ring->gen << VMXNET3_RXD_GEN_SHIFT);
627 num_allocated++; 633 num_allocated++;
628 vmxnet3_cmd_ring_adv_next2fill(ring); 634 vmxnet3_cmd_ring_adv_next2fill(ring);
629 } 635 }
@@ -1140,6 +1146,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
1140 VMXNET3_REG_RXPROD, VMXNET3_REG_RXPROD2 1146 VMXNET3_REG_RXPROD, VMXNET3_REG_RXPROD2
1141 }; 1147 };
1142 u32 num_rxd = 0; 1148 u32 num_rxd = 0;
1149 bool skip_page_frags = false;
1143 struct Vmxnet3_RxCompDesc *rcd; 1150 struct Vmxnet3_RxCompDesc *rcd;
1144 struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx; 1151 struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx;
1145#ifdef __BIG_ENDIAN_BITFIELD 1152#ifdef __BIG_ENDIAN_BITFIELD
@@ -1150,11 +1157,12 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
1150 &rxComp); 1157 &rxComp);
1151 while (rcd->gen == rq->comp_ring.gen) { 1158 while (rcd->gen == rq->comp_ring.gen) {
1152 struct vmxnet3_rx_buf_info *rbi; 1159 struct vmxnet3_rx_buf_info *rbi;
1153 struct sk_buff *skb; 1160 struct sk_buff *skb, *new_skb = NULL;
1161 struct page *new_page = NULL;
1154 int num_to_alloc; 1162 int num_to_alloc;
1155 struct Vmxnet3_RxDesc *rxd; 1163 struct Vmxnet3_RxDesc *rxd;
1156 u32 idx, ring_idx; 1164 u32 idx, ring_idx;
1157 1165 struct vmxnet3_cmd_ring *ring = NULL;
1158 if (num_rxd >= quota) { 1166 if (num_rxd >= quota) {
1159 /* we may stop even before we see the EOP desc of 1167 /* we may stop even before we see the EOP desc of
1160 * the current pkt 1168 * the current pkt
@@ -1165,6 +1173,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
1165 BUG_ON(rcd->rqID != rq->qid && rcd->rqID != rq->qid2); 1173 BUG_ON(rcd->rqID != rq->qid && rcd->rqID != rq->qid2);
1166 idx = rcd->rxdIdx; 1174 idx = rcd->rxdIdx;
1167 ring_idx = rcd->rqID < adapter->num_rx_queues ? 0 : 1; 1175 ring_idx = rcd->rqID < adapter->num_rx_queues ? 0 : 1;
1176 ring = rq->rx_ring + ring_idx;
1168 vmxnet3_getRxDesc(rxd, &rq->rx_ring[ring_idx].base[idx].rxd, 1177 vmxnet3_getRxDesc(rxd, &rq->rx_ring[ring_idx].base[idx].rxd,
1169 &rxCmdDesc); 1178 &rxCmdDesc);
1170 rbi = rq->buf_info[ring_idx] + idx; 1179 rbi = rq->buf_info[ring_idx] + idx;
@@ -1193,37 +1202,80 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
1193 goto rcd_done; 1202 goto rcd_done;
1194 } 1203 }
1195 1204
1205 skip_page_frags = false;
1196 ctx->skb = rbi->skb; 1206 ctx->skb = rbi->skb;
1197 rbi->skb = NULL; 1207 new_skb = dev_alloc_skb(rbi->len + NET_IP_ALIGN);
1208 if (new_skb == NULL) {
1209 /* Skb allocation failed, do not handover this
1210 * skb to stack. Reuse it. Drop the existing pkt
1211 */
1212 rq->stats.rx_buf_alloc_failure++;
1213 ctx->skb = NULL;
1214 rq->stats.drop_total++;
1215 skip_page_frags = true;
1216 goto rcd_done;
1217 }
1198 1218
1199 pci_unmap_single(adapter->pdev, rbi->dma_addr, rbi->len, 1219 pci_unmap_single(adapter->pdev, rbi->dma_addr, rbi->len,
1200 PCI_DMA_FROMDEVICE); 1220 PCI_DMA_FROMDEVICE);
1201 1221
1202 skb_put(ctx->skb, rcd->len); 1222 skb_put(ctx->skb, rcd->len);
1223
1224 /* Immediate refill */
1225 new_skb->dev = adapter->netdev;
1226 skb_reserve(new_skb, NET_IP_ALIGN);
1227 rbi->skb = new_skb;
1228 rbi->dma_addr = pci_map_single(adapter->pdev,
1229 rbi->skb->data, rbi->len,
1230 PCI_DMA_FROMDEVICE);
1231 rxd->addr = cpu_to_le64(rbi->dma_addr);
1232 rxd->len = rbi->len;
1233
1203 } else { 1234 } else {
1204 BUG_ON(ctx->skb == NULL); 1235 BUG_ON(ctx->skb == NULL && !skip_page_frags);
1236
1205 /* non SOP buffer must be type 1 in most cases */ 1237 /* non SOP buffer must be type 1 in most cases */
1206 if (rbi->buf_type == VMXNET3_RX_BUF_PAGE) { 1238 BUG_ON(rbi->buf_type != VMXNET3_RX_BUF_PAGE);
1207 BUG_ON(rxd->btype != VMXNET3_RXD_BTYPE_BODY); 1239 BUG_ON(rxd->btype != VMXNET3_RXD_BTYPE_BODY);
1208 1240
1209 if (rcd->len) { 1241 /* If an sop buffer was dropped, skip all
1210 pci_unmap_page(adapter->pdev, 1242 * following non-sop fragments. They will be reused.
1211 rbi->dma_addr, rbi->len, 1243 */
1212 PCI_DMA_FROMDEVICE); 1244 if (skip_page_frags)
1245 goto rcd_done;
1213 1246
1214 vmxnet3_append_frag(ctx->skb, rcd, rbi); 1247 new_page = alloc_page(GFP_ATOMIC);
1215 rbi->page = NULL; 1248 if (unlikely(new_page == NULL)) {
1216 } 1249 /* Replacement page frag could not be allocated.
1217 } else { 1250 * Reuse this page. Drop the pkt and free the
1218 /* 1251 * skb which contained this page as a frag. Skip
1219 * The only time a non-SOP buffer is type 0 is 1252 * processing all the following non-sop frags.
1220 * when it's EOP and error flag is raised, which
1221 * has already been handled.
1222 */ 1253 */
1223 BUG_ON(true); 1254 rq->stats.rx_buf_alloc_failure++;
1255 dev_kfree_skb(ctx->skb);
1256 ctx->skb = NULL;
1257 skip_page_frags = true;
1258 goto rcd_done;
1259 }
1260
1261 if (rcd->len) {
1262 pci_unmap_page(adapter->pdev,
1263 rbi->dma_addr, rbi->len,
1264 PCI_DMA_FROMDEVICE);
1265
1266 vmxnet3_append_frag(ctx->skb, rcd, rbi);
1224 } 1267 }
1268
1269 /* Immediate refill */
1270 rbi->page = new_page;
1271 rbi->dma_addr = pci_map_page(adapter->pdev, rbi->page,
1272 0, PAGE_SIZE,
1273 PCI_DMA_FROMDEVICE);
1274 rxd->addr = cpu_to_le64(rbi->dma_addr);
1275 rxd->len = rbi->len;
1225 } 1276 }
1226 1277
1278
1227 skb = ctx->skb; 1279 skb = ctx->skb;
1228 if (rcd->eop) { 1280 if (rcd->eop) {
1229 skb->len += skb->data_len; 1281 skb->len += skb->data_len;
@@ -1244,26 +1296,27 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
1244 } 1296 }
1245 1297
1246rcd_done: 1298rcd_done:
1247 /* device may skip some rx descs */ 1299 /* device may have skipped some rx descs */
1248 rq->rx_ring[ring_idx].next2comp = idx; 1300 ring->next2comp = idx;
1249 VMXNET3_INC_RING_IDX_ONLY(rq->rx_ring[ring_idx].next2comp, 1301 num_to_alloc = vmxnet3_cmd_ring_desc_avail(ring);
1250 rq->rx_ring[ring_idx].size); 1302 ring = rq->rx_ring + ring_idx;
1251 1303 while (num_to_alloc) {
1252 /* refill rx buffers frequently to avoid starving the h/w */ 1304 vmxnet3_getRxDesc(rxd, &ring->base[ring->next2fill].rxd,
1253 num_to_alloc = vmxnet3_cmd_ring_desc_avail(rq->rx_ring + 1305 &rxCmdDesc);
1254 ring_idx); 1306 BUG_ON(!rxd->addr);
1255 if (unlikely(num_to_alloc > VMXNET3_RX_ALLOC_THRESHOLD(rq, 1307
1256 ring_idx, adapter))) { 1308 /* Recv desc is ready to be used by the device */
1257 vmxnet3_rq_alloc_rx_buf(rq, ring_idx, num_to_alloc, 1309 rxd->gen = ring->gen;
1258 adapter); 1310 vmxnet3_cmd_ring_adv_next2fill(ring);
1259 1311 num_to_alloc--;
1260 /* if needed, update the register */ 1312 }
1261 if (unlikely(rq->shared->updateRxProd)) { 1313
1262 VMXNET3_WRITE_BAR0_REG(adapter, 1314 /* if needed, update the register */
1263 rxprod_reg[ring_idx] + rq->qid * 8, 1315 if (unlikely(rq->shared->updateRxProd)) {
1264 rq->rx_ring[ring_idx].next2fill); 1316 VMXNET3_WRITE_BAR0_REG(adapter,
1265 rq->uncommitted[ring_idx] = 0; 1317 rxprod_reg[ring_idx] + rq->qid * 8,
1266 } 1318 ring->next2fill);
1319 rq->uncommitted[ring_idx] = 0;
1267 } 1320 }
1268 1321
1269 vmxnet3_comp_ring_adv_next2proc(&rq->comp_ring); 1322 vmxnet3_comp_ring_adv_next2proc(&rq->comp_ring);
@@ -2894,6 +2947,7 @@ vmxnet3_probe_device(struct pci_dev *pdev,
2894 else 2947 else
2895#endif 2948#endif
2896 num_rx_queues = 1; 2949 num_rx_queues = 1;
2950 num_rx_queues = rounddown_pow_of_two(num_rx_queues);
2897 2951
2898 if (enable_mq) 2952 if (enable_mq)
2899 num_tx_queues = min(VMXNET3_DEVICE_MAX_TX_QUEUES, 2953 num_tx_queues = min(VMXNET3_DEVICE_MAX_TX_QUEUES,
@@ -2901,6 +2955,7 @@ vmxnet3_probe_device(struct pci_dev *pdev,
2901 else 2955 else
2902 num_tx_queues = 1; 2956 num_tx_queues = 1;
2903 2957
2958 num_tx_queues = rounddown_pow_of_two(num_tx_queues);
2904 netdev = alloc_etherdev_mq(sizeof(struct vmxnet3_adapter), 2959 netdev = alloc_etherdev_mq(sizeof(struct vmxnet3_adapter),
2905 max(num_tx_queues, num_rx_queues)); 2960 max(num_tx_queues, num_rx_queues));
2906 printk(KERN_INFO "# of Tx queues : %d, # of Rx queues : %d\n", 2961 printk(KERN_INFO "# of Tx queues : %d, # of Rx queues : %d\n",
@@ -3085,6 +3140,7 @@ vmxnet3_remove_device(struct pci_dev *pdev)
3085 else 3140 else
3086#endif 3141#endif
3087 num_rx_queues = 1; 3142 num_rx_queues = 1;
3143 num_rx_queues = rounddown_pow_of_two(num_rx_queues);
3088 3144
3089 cancel_work_sync(&adapter->work); 3145 cancel_work_sync(&adapter->work);
3090 3146
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index f50d36fdf405..e08d75e3f170 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -55,6 +55,7 @@
55#include <linux/if_vlan.h> 55#include <linux/if_vlan.h>
56#include <linux/if_arp.h> 56#include <linux/if_arp.h>
57#include <linux/inetdevice.h> 57#include <linux/inetdevice.h>
58#include <linux/log2.h>
58 59
59#include "vmxnet3_defs.h" 60#include "vmxnet3_defs.h"
60 61
@@ -68,10 +69,10 @@
68/* 69/*
69 * Version numbers 70 * Version numbers
70 */ 71 */
71#define VMXNET3_DRIVER_VERSION_STRING "1.1.9.0-k" 72#define VMXNET3_DRIVER_VERSION_STRING "1.1.18.0-k"
72 73
73/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ 74/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
74#define VMXNET3_DRIVER_VERSION_NUM 0x01010900 75#define VMXNET3_DRIVER_VERSION_NUM 0x01011200
75 76
76#if defined(CONFIG_PCI_MSI) 77#if defined(CONFIG_PCI_MSI)
77 /* RSS only makes sense if MSI-X is supported. */ 78 /* RSS only makes sense if MSI-X is supported. */
diff --git a/drivers/net/wireless/ath/ath5k/desc.c b/drivers/net/wireless/ath/ath5k/desc.c
index 62172d585723..f82383b3ed30 100644
--- a/drivers/net/wireless/ath/ath5k/desc.c
+++ b/drivers/net/wireless/ath/ath5k/desc.c
@@ -107,10 +107,13 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
107 case AR5K_PKT_TYPE_BEACON: 107 case AR5K_PKT_TYPE_BEACON:
108 case AR5K_PKT_TYPE_PROBE_RESP: 108 case AR5K_PKT_TYPE_PROBE_RESP:
109 frame_type = AR5K_AR5210_TX_DESC_FRAME_TYPE_NO_DELAY; 109 frame_type = AR5K_AR5210_TX_DESC_FRAME_TYPE_NO_DELAY;
110 break;
110 case AR5K_PKT_TYPE_PIFS: 111 case AR5K_PKT_TYPE_PIFS:
111 frame_type = AR5K_AR5210_TX_DESC_FRAME_TYPE_PIFS; 112 frame_type = AR5K_AR5210_TX_DESC_FRAME_TYPE_PIFS;
113 break;
112 default: 114 default:
113 frame_type = type; 115 frame_type = type;
116 break;
114 } 117 }
115 118
116 tx_ctl->tx_control_0 |= 119 tx_ctl->tx_control_0 |=
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
index 1fef84f87c78..392771f93759 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -691,14 +691,12 @@ ath5k_eeprom_free_pcal_info(struct ath5k_hw *ah, int mode)
691 if (!chinfo[pier].pd_curves) 691 if (!chinfo[pier].pd_curves)
692 continue; 692 continue;
693 693
694 for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) { 694 for (pdg = 0; pdg < AR5K_EEPROM_N_PD_CURVES; pdg++) {
695 struct ath5k_pdgain_info *pd = 695 struct ath5k_pdgain_info *pd =
696 &chinfo[pier].pd_curves[pdg]; 696 &chinfo[pier].pd_curves[pdg];
697 697
698 if (pd != NULL) { 698 kfree(pd->pd_step);
699 kfree(pd->pd_step); 699 kfree(pd->pd_pwr);
700 kfree(pd->pd_pwr);
701 }
702 } 700 }
703 701
704 kfree(chinfo[pier].pd_curves); 702 kfree(chinfo[pier].pd_curves);
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index b8cbfc707213..3bad0b2cf9a3 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -278,6 +278,12 @@ static int ath_pci_suspend(struct device *device)
278 278
279 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); 279 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
280 280
281 /* The device has to be moved to FULLSLEEP forcibly.
282 * Otherwise the chip never moved to full sleep,
283 * when no interface is up.
284 */
285 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP);
286
281 return 0; 287 return 0;
282} 288}
283 289
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 61d4a11f566b..2a88e73bb39c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -36,6 +36,7 @@
36#include <net/mac80211.h> 36#include <net/mac80211.h>
37#include <linux/etherdevice.h> 37#include <linux/etherdevice.h>
38#include <asm/unaligned.h> 38#include <asm/unaligned.h>
39#include <linux/stringify.h>
39 40
40#include "iwl-eeprom.h" 41#include "iwl-eeprom.h"
41#include "iwl-dev.h" 42#include "iwl-dev.h"
@@ -55,10 +56,10 @@
55#define IWL100_UCODE_API_MIN 5 56#define IWL100_UCODE_API_MIN 5
56 57
57#define IWL1000_FW_PRE "iwlwifi-1000-" 58#define IWL1000_FW_PRE "iwlwifi-1000-"
58#define IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE #api ".ucode" 59#define IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE __stringify(api) ".ucode"
59 60
60#define IWL100_FW_PRE "iwlwifi-100-" 61#define IWL100_FW_PRE "iwlwifi-100-"
61#define IWL100_MODULE_FIRMWARE(api) IWL100_FW_PRE #api ".ucode" 62#define IWL100_MODULE_FIRMWARE(api) IWL100_FW_PRE __stringify(api) ".ucode"
62 63
63 64
64/* 65/*
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index 2282279cffc4..3df76f53a41b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -36,6 +36,7 @@
36#include <net/mac80211.h> 36#include <net/mac80211.h>
37#include <linux/etherdevice.h> 37#include <linux/etherdevice.h>
38#include <asm/unaligned.h> 38#include <asm/unaligned.h>
39#include <linux/stringify.h>
39 40
40#include "iwl-eeprom.h" 41#include "iwl-eeprom.h"
41#include "iwl-dev.h" 42#include "iwl-dev.h"
@@ -58,13 +59,13 @@
58#define IWL105_UCODE_API_MIN 5 59#define IWL105_UCODE_API_MIN 5
59 60
60#define IWL2030_FW_PRE "iwlwifi-2030-" 61#define IWL2030_FW_PRE "iwlwifi-2030-"
61#define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE #api ".ucode" 62#define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE __stringify(api) ".ucode"
62 63
63#define IWL2000_FW_PRE "iwlwifi-2000-" 64#define IWL2000_FW_PRE "iwlwifi-2000-"
64#define IWL2000_MODULE_FIRMWARE(api) IWL2000_FW_PRE #api ".ucode" 65#define IWL2000_MODULE_FIRMWARE(api) IWL2000_FW_PRE __stringify(api) ".ucode"
65 66
66#define IWL105_FW_PRE "iwlwifi-105-" 67#define IWL105_FW_PRE "iwlwifi-105-"
67#define IWL105_MODULE_FIRMWARE(api) IWL105_FW_PRE #api ".ucode" 68#define IWL105_MODULE_FIRMWARE(api) IWL105_FW_PRE __stringify(api) ".ucode"
68 69
69static void iwl2000_set_ct_threshold(struct iwl_priv *priv) 70static void iwl2000_set_ct_threshold(struct iwl_priv *priv)
70{ 71{
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index f99f9c193352..e816c27db794 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -37,6 +37,7 @@
37#include <net/mac80211.h> 37#include <net/mac80211.h>
38#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
39#include <asm/unaligned.h> 39#include <asm/unaligned.h>
40#include <linux/stringify.h>
40 41
41#include "iwl-eeprom.h" 42#include "iwl-eeprom.h"
42#include "iwl-dev.h" 43#include "iwl-dev.h"
@@ -57,10 +58,10 @@
57#define IWL5150_UCODE_API_MIN 1 58#define IWL5150_UCODE_API_MIN 1
58 59
59#define IWL5000_FW_PRE "iwlwifi-5000-" 60#define IWL5000_FW_PRE "iwlwifi-5000-"
60#define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE #api ".ucode" 61#define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode"
61 62
62#define IWL5150_FW_PRE "iwlwifi-5150-" 63#define IWL5150_FW_PRE "iwlwifi-5150-"
63#define IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE #api ".ucode" 64#define IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE __stringify(api) ".ucode"
64 65
65/* NIC configuration for 5000 series */ 66/* NIC configuration for 5000 series */
66static void iwl5000_nic_config(struct iwl_priv *priv) 67static void iwl5000_nic_config(struct iwl_priv *priv)
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index fbe565c816e3..5b150bc70b06 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -36,6 +36,7 @@
36#include <net/mac80211.h> 36#include <net/mac80211.h>
37#include <linux/etherdevice.h> 37#include <linux/etherdevice.h>
38#include <asm/unaligned.h> 38#include <asm/unaligned.h>
39#include <linux/stringify.h>
39 40
40#include "iwl-eeprom.h" 41#include "iwl-eeprom.h"
41#include "iwl-dev.h" 42#include "iwl-dev.h"
@@ -58,16 +59,16 @@
58#define IWL6000G2_UCODE_API_MIN 4 59#define IWL6000G2_UCODE_API_MIN 4
59 60
60#define IWL6000_FW_PRE "iwlwifi-6000-" 61#define IWL6000_FW_PRE "iwlwifi-6000-"
61#define IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode" 62#define IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE __stringify(api) ".ucode"
62 63
63#define IWL6050_FW_PRE "iwlwifi-6050-" 64#define IWL6050_FW_PRE "iwlwifi-6050-"
64#define IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode" 65#define IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE __stringify(api) ".ucode"
65 66
66#define IWL6005_FW_PRE "iwlwifi-6000g2a-" 67#define IWL6005_FW_PRE "iwlwifi-6000g2a-"
67#define IWL6005_MODULE_FIRMWARE(api) IWL6005_FW_PRE #api ".ucode" 68#define IWL6005_MODULE_FIRMWARE(api) IWL6005_FW_PRE __stringify(api) ".ucode"
68 69
69#define IWL6030_FW_PRE "iwlwifi-6000g2b-" 70#define IWL6030_FW_PRE "iwlwifi-6000g2b-"
70#define IWL6030_MODULE_FIRMWARE(api) IWL6030_FW_PRE #api ".ucode" 71#define IWL6030_MODULE_FIRMWARE(api) IWL6030_FW_PRE __stringify(api) ".ucode"
71 72
72static void iwl6000_set_ct_threshold(struct iwl_priv *priv) 73static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
73{ 74{
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 213c80c6a668..45cc51c9c93e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1763,6 +1763,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1763 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1763 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
1764 struct iwl_rxon_context *bss_ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1764 struct iwl_rxon_context *bss_ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1765 struct iwl_rxon_context *tmp; 1765 struct iwl_rxon_context *tmp;
1766 enum nl80211_iftype newviftype = newtype;
1766 u32 interface_modes; 1767 u32 interface_modes;
1767 int err; 1768 int err;
1768 1769
@@ -1818,7 +1819,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1818 1819
1819 /* success */ 1820 /* success */
1820 iwl_teardown_interface(priv, vif, true); 1821 iwl_teardown_interface(priv, vif, true);
1821 vif->type = newtype; 1822 vif->type = newviftype;
1822 vif->p2p = newp2p; 1823 vif->p2p = newp2p;
1823 err = iwl_setup_interface(priv, ctx); 1824 err = iwl_setup_interface(priv, ctx);
1824 WARN_ON(err); 1825 WARN_ON(err);
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 686e176b5ebd..137dba95b1ad 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -126,7 +126,7 @@ static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd)
126} 126}
127 127
128static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, 128static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta,
129 struct iwl_tfd *tfd) 129 struct iwl_tfd *tfd, int dma_dir)
130{ 130{
131 struct pci_dev *dev = priv->pci_dev; 131 struct pci_dev *dev = priv->pci_dev;
132 int i; 132 int i;
@@ -151,7 +151,7 @@ static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta,
151 /* Unmap chunks, if any. */ 151 /* Unmap chunks, if any. */
152 for (i = 1; i < num_tbs; i++) 152 for (i = 1; i < num_tbs; i++)
153 pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i), 153 pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i),
154 iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE); 154 iwl_tfd_tb_get_len(tfd, i), dma_dir);
155} 155}
156 156
157/** 157/**
@@ -167,7 +167,8 @@ void iwlagn_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
167 struct iwl_tfd *tfd_tmp = txq->tfds; 167 struct iwl_tfd *tfd_tmp = txq->tfds;
168 int index = txq->q.read_ptr; 168 int index = txq->q.read_ptr;
169 169
170 iwlagn_unmap_tfd(priv, &txq->meta[index], &tfd_tmp[index]); 170 iwlagn_unmap_tfd(priv, &txq->meta[index], &tfd_tmp[index],
171 PCI_DMA_TODEVICE);
171 172
172 /* free SKB */ 173 /* free SKB */
173 if (txq->txb) { 174 if (txq->txb) {
@@ -310,9 +311,7 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv)
310 i = get_cmd_index(q, q->read_ptr); 311 i = get_cmd_index(q, q->read_ptr);
311 312
312 if (txq->meta[i].flags & CMD_MAPPED) { 313 if (txq->meta[i].flags & CMD_MAPPED) {
313 pci_unmap_single(priv->pci_dev, 314 iwlagn_unmap_tfd(priv, &txq->meta[i], &txq->tfds[i],
314 dma_unmap_addr(&txq->meta[i], mapping),
315 dma_unmap_len(&txq->meta[i], len),
316 PCI_DMA_BIDIRECTIONAL); 315 PCI_DMA_BIDIRECTIONAL);
317 txq->meta[i].flags = 0; 316 txq->meta[i].flags = 0;
318 } 317 }
@@ -535,12 +534,7 @@ out_free_arrays:
535void iwl_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq, 534void iwl_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq,
536 int slots_num, u32 txq_id) 535 int slots_num, u32 txq_id)
537{ 536{
538 int actual_slots = slots_num; 537 memset(txq->meta, 0, sizeof(struct iwl_cmd_meta) * slots_num);
539
540 if (txq_id == priv->cmd_queue)
541 actual_slots++;
542
543 memset(txq->meta, 0, sizeof(struct iwl_cmd_meta) * actual_slots);
544 538
545 txq->need_update = 0; 539 txq->need_update = 0;
546 540
@@ -700,10 +694,11 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
700 if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) 694 if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY))
701 continue; 695 continue;
702 phys_addr = pci_map_single(priv->pci_dev, (void *)cmd->data[i], 696 phys_addr = pci_map_single(priv->pci_dev, (void *)cmd->data[i],
703 cmd->len[i], PCI_DMA_TODEVICE); 697 cmd->len[i], PCI_DMA_BIDIRECTIONAL);
704 if (pci_dma_mapping_error(priv->pci_dev, phys_addr)) { 698 if (pci_dma_mapping_error(priv->pci_dev, phys_addr)) {
705 iwlagn_unmap_tfd(priv, out_meta, 699 iwlagn_unmap_tfd(priv, out_meta,
706 &txq->tfds[q->write_ptr]); 700 &txq->tfds[q->write_ptr],
701 PCI_DMA_BIDIRECTIONAL);
707 idx = -ENOMEM; 702 idx = -ENOMEM;
708 goto out; 703 goto out;
709 } 704 }
@@ -807,7 +802,7 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
807 cmd = txq->cmd[cmd_index]; 802 cmd = txq->cmd[cmd_index];
808 meta = &txq->meta[cmd_index]; 803 meta = &txq->meta[cmd_index];
809 804
810 iwlagn_unmap_tfd(priv, meta, &txq->tfds[index]); 805 iwlagn_unmap_tfd(priv, meta, &txq->tfds[index], PCI_DMA_BIDIRECTIONAL);
811 806
812 /* Input error checking is done when commands are added to queue. */ 807 /* Input error checking is done when commands are added to queue. */
813 if (meta->flags & CMD_WANT_SKB) { 808 if (meta->flags & CMD_WANT_SKB) {
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 2c5b9b991279..692671b11667 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3483,6 +3483,8 @@ static int __init pci_setup(char *str)
3483 pci_no_msi(); 3483 pci_no_msi();
3484 } else if (!strcmp(str, "noaer")) { 3484 } else if (!strcmp(str, "noaer")) {
3485 pci_no_aer(); 3485 pci_no_aer();
3486 } else if (!strncmp(str, "realloc", 7)) {
3487 pci_realloc();
3486 } else if (!strcmp(str, "nodomains")) { 3488 } else if (!strcmp(str, "nodomains")) {
3487 pci_no_domains(); 3489 pci_no_domains();
3488 } else if (!strncmp(str, "cbiosize=", 9)) { 3490 } else if (!strncmp(str, "cbiosize=", 9)) {
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 731e20265ace..3a39bf1f1e2c 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -146,6 +146,8 @@ static inline void pci_no_msi(void) { }
146static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } 146static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
147#endif 147#endif
148 148
149extern void pci_realloc(void);
150
149static inline int pci_no_d1d2(struct pci_dev *dev) 151static inline int pci_no_d1d2(struct pci_dev *dev)
150{ 152{
151 unsigned int parent_dstates = 0; 153 unsigned int parent_dstates = 0;
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 1e9e5a5b8c81..9995842e45b5 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -47,6 +47,13 @@ struct resource_list_x {
47 (head)->next = NULL; \ 47 (head)->next = NULL; \
48} while (0) 48} while (0)
49 49
50int pci_realloc_enable = 0;
51#define pci_realloc_enabled() pci_realloc_enable
52void pci_realloc(void)
53{
54 pci_realloc_enable = 1;
55}
56
50/** 57/**
51 * add_to_list() - add a new resource tracker to the list 58 * add_to_list() - add a new resource tracker to the list
52 * @head: Head of the list 59 * @head: Head of the list
@@ -1025,6 +1032,7 @@ static int __init pci_get_max_depth(void)
1025 return depth; 1032 return depth;
1026} 1033}
1027 1034
1035
1028/* 1036/*
1029 * first try will not touch pci bridge res 1037 * first try will not touch pci bridge res
1030 * second and later try will clear small leaf bridge res 1038 * second and later try will clear small leaf bridge res
@@ -1068,6 +1076,13 @@ again:
1068 /* any device complain? */ 1076 /* any device complain? */
1069 if (!head.next) 1077 if (!head.next)
1070 goto enable_and_dump; 1078 goto enable_and_dump;
1079
1080 /* don't realloc if asked to do so */
1081 if (!pci_realloc_enabled()) {
1082 free_list(resource_list_x, &head);
1083 goto enable_and_dump;
1084 }
1085
1071 failed_type = 0; 1086 failed_type = 0;
1072 for (list = head.next; list;) { 1087 for (list = head.next; list;) {
1073 failed_type |= list->flags; 1088 failed_type |= list->flags;
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 005417bd429e..e1c4938b301b 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1156,9 +1156,9 @@ static acpi_status wmid3_set_device_status(u32 value, u16 device)
1156 struct wmid3_gds_input_param params = { 1156 struct wmid3_gds_input_param params = {
1157 .function_num = 0x1, 1157 .function_num = 0x1,
1158 .hotkey_number = 0x01, 1158 .hotkey_number = 0x01,
1159 .devices = ACER_WMID3_GDS_WIRELESS & 1159 .devices = ACER_WMID3_GDS_WIRELESS |
1160 ACER_WMID3_GDS_THREEG & 1160 ACER_WMID3_GDS_THREEG |
1161 ACER_WMID3_GDS_WIMAX & 1161 ACER_WMID3_GDS_WIMAX |
1162 ACER_WMID3_GDS_BLUETOOTH, 1162 ACER_WMID3_GDS_BLUETOOTH,
1163 }; 1163 };
1164 struct acpi_buffer input = { 1164 struct acpi_buffer input = {
@@ -1445,6 +1445,8 @@ static void acer_wmi_notify(u32 value, void *context)
1445 union acpi_object *obj; 1445 union acpi_object *obj;
1446 struct event_return_value return_value; 1446 struct event_return_value return_value;
1447 acpi_status status; 1447 acpi_status status;
1448 u16 device_state;
1449 const struct key_entry *key;
1448 1450
1449 status = wmi_get_event_data(value, &response); 1451 status = wmi_get_event_data(value, &response);
1450 if (status != AE_OK) { 1452 if (status != AE_OK) {
@@ -1472,23 +1474,32 @@ static void acer_wmi_notify(u32 value, void *context)
1472 1474
1473 switch (return_value.function) { 1475 switch (return_value.function) {
1474 case WMID_HOTKEY_EVENT: 1476 case WMID_HOTKEY_EVENT:
1475 if (return_value.device_state) { 1477 device_state = return_value.device_state;
1476 u16 device_state = return_value.device_state; 1478 pr_debug("device state: 0x%x\n", device_state);
1477 pr_debug("device state: 0x%x\n", device_state); 1479
1478 if (has_cap(ACER_CAP_WIRELESS)) 1480 key = sparse_keymap_entry_from_scancode(acer_wmi_input_dev,
1479 rfkill_set_sw_state(wireless_rfkill, 1481 return_value.key_num);
1480 !(device_state & ACER_WMID3_GDS_WIRELESS)); 1482 if (!key) {
1481 if (has_cap(ACER_CAP_BLUETOOTH))
1482 rfkill_set_sw_state(bluetooth_rfkill,
1483 !(device_state & ACER_WMID3_GDS_BLUETOOTH));
1484 if (has_cap(ACER_CAP_THREEG))
1485 rfkill_set_sw_state(threeg_rfkill,
1486 !(device_state & ACER_WMID3_GDS_THREEG));
1487 }
1488 if (!sparse_keymap_report_event(acer_wmi_input_dev,
1489 return_value.key_num, 1, true))
1490 pr_warn("Unknown key number - 0x%x\n", 1483 pr_warn("Unknown key number - 0x%x\n",
1491 return_value.key_num); 1484 return_value.key_num);
1485 } else {
1486 switch (key->keycode) {
1487 case KEY_WLAN:
1488 case KEY_BLUETOOTH:
1489 if (has_cap(ACER_CAP_WIRELESS))
1490 rfkill_set_sw_state(wireless_rfkill,
1491 !(device_state & ACER_WMID3_GDS_WIRELESS));
1492 if (has_cap(ACER_CAP_THREEG))
1493 rfkill_set_sw_state(threeg_rfkill,
1494 !(device_state & ACER_WMID3_GDS_THREEG));
1495 if (has_cap(ACER_CAP_BLUETOOTH))
1496 rfkill_set_sw_state(bluetooth_rfkill,
1497 !(device_state & ACER_WMID3_GDS_BLUETOOTH));
1498 break;
1499 }
1500 sparse_keymap_report_entry(acer_wmi_input_dev, key,
1501 1, true);
1502 }
1492 break; 1503 break;
1493 default: 1504 default:
1494 pr_warn("Unknown function number - %d - %d\n", 1505 pr_warn("Unknown function number - %d - %d\n",
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 00460cb9587b..3c7857c71a23 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1025,6 +1025,7 @@ static int asus_wmi_backlight_init(struct asus_wmi *asus)
1025 return power; 1025 return power;
1026 1026
1027 memset(&props, 0, sizeof(struct backlight_properties)); 1027 memset(&props, 0, sizeof(struct backlight_properties));
1028 props.type = BACKLIGHT_PLATFORM;
1028 props.max_brightness = max; 1029 props.max_brightness = max;
1029 bd = backlight_device_register(asus->driver->name, 1030 bd = backlight_device_register(asus->driver->name,
1030 &asus->platform_device->dev, asus, 1031 &asus->platform_device->dev, asus,
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 3f204fde1b02..8877b836d27c 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -1030,8 +1030,10 @@ static int __devinit compal_probe(struct platform_device *pdev)
1030 initialize_fan_control_data(data); 1030 initialize_fan_control_data(data);
1031 1031
1032 err = sysfs_create_group(&pdev->dev.kobj, &compal_attribute_group); 1032 err = sysfs_create_group(&pdev->dev.kobj, &compal_attribute_group);
1033 if (err) 1033 if (err) {
1034 kfree(data);
1034 return err; 1035 return err;
1036 }
1035 1037
1036 data->hwmon_dev = hwmon_device_register(&pdev->dev); 1038 data->hwmon_dev = hwmon_device_register(&pdev->dev);
1037 if (IS_ERR(data->hwmon_dev)) { 1039 if (IS_ERR(data->hwmon_dev)) {
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index d3841de6a8cf..e39ab1d3ed87 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -292,12 +292,9 @@ static int dell_rfkill_set(void *data, bool blocked)
292 dell_send_request(buffer, 17, 11); 292 dell_send_request(buffer, 17, 11);
293 293
294 /* If the hardware switch controls this radio, and the hardware 294 /* If the hardware switch controls this radio, and the hardware
295 switch is disabled, don't allow changing the software state. 295 switch is disabled, don't allow changing the software state */
296 If the hardware switch is reported as not supported, always
297 fire the SMI to toggle the killswitch. */
298 if ((hwswitch_state & BIT(hwswitch_bit)) && 296 if ((hwswitch_state & BIT(hwswitch_bit)) &&
299 !(buffer->output[1] & BIT(16)) && 297 !(buffer->output[1] & BIT(16))) {
300 (buffer->output[1] & BIT(0))) {
301 ret = -EINVAL; 298 ret = -EINVAL;
302 goto out; 299 goto out;
303 } 300 }
@@ -403,23 +400,6 @@ static const struct file_operations dell_debugfs_fops = {
403 400
404static void dell_update_rfkill(struct work_struct *ignored) 401static void dell_update_rfkill(struct work_struct *ignored)
405{ 402{
406 int status;
407
408 get_buffer();
409 dell_send_request(buffer, 17, 11);
410 status = buffer->output[1];
411 release_buffer();
412
413 /* if hardware rfkill is not supported, set it explicitly */
414 if (!(status & BIT(0))) {
415 if (wifi_rfkill)
416 dell_rfkill_set((void *)1, !((status & BIT(17)) >> 17));
417 if (bluetooth_rfkill)
418 dell_rfkill_set((void *)2, !((status & BIT(18)) >> 18));
419 if (wwan_rfkill)
420 dell_rfkill_set((void *)3, !((status & BIT(19)) >> 19));
421 }
422
423 if (wifi_rfkill) 403 if (wifi_rfkill)
424 dell_rfkill_query(wifi_rfkill, (void *)1); 404 dell_rfkill_query(wifi_rfkill, (void *)1);
425 if (bluetooth_rfkill) 405 if (bluetooth_rfkill)
@@ -560,11 +540,11 @@ static int dell_get_intensity(struct backlight_device *bd)
560 else 540 else
561 dell_send_request(buffer, 0, 1); 541 dell_send_request(buffer, 0, 1);
562 542
543 ret = buffer->output[1];
544
563out: 545out:
564 release_buffer(); 546 release_buffer();
565 if (ret) 547 return ret;
566 return ret;
567 return buffer->output[1];
568} 548}
569 549
570static const struct backlight_ops dell_ops = { 550static const struct backlight_ops dell_ops = {
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index f94017bcdd6e..e2faa3cbb792 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -207,6 +207,7 @@ static int hp_wmi_perform_query(int query, int write, void *buffer,
207 }; 207 };
208 struct acpi_buffer input = { sizeof(struct bios_args), &args }; 208 struct acpi_buffer input = { sizeof(struct bios_args), &args };
209 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; 209 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
210 u32 rc;
210 211
211 if (WARN_ON(insize > sizeof(args.data))) 212 if (WARN_ON(insize > sizeof(args.data)))
212 return -EINVAL; 213 return -EINVAL;
@@ -224,13 +225,13 @@ static int hp_wmi_perform_query(int query, int write, void *buffer,
224 } 225 }
225 226
226 bios_return = (struct bios_return *)obj->buffer.pointer; 227 bios_return = (struct bios_return *)obj->buffer.pointer;
228 rc = bios_return->return_code;
227 229
228 if (bios_return->return_code) { 230 if (rc) {
229 if (bios_return->return_code != HPWMI_RET_UNKNOWN_CMDTYPE) 231 if (rc != HPWMI_RET_UNKNOWN_CMDTYPE)
230 pr_warn("query 0x%x returned error 0x%x\n", 232 pr_warn("query 0x%x returned error 0x%x\n", query, rc);
231 query, bios_return->return_code);
232 kfree(obj); 233 kfree(obj);
233 return bios_return->return_code; 234 return rc;
234 } 235 }
235 236
236 if (!outsize) { 237 if (!outsize) {
diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c
index e936364a609d..7f88c7923fc6 100644
--- a/drivers/platform/x86/intel_oaktrail.c
+++ b/drivers/platform/x86/intel_oaktrail.c
@@ -250,6 +250,7 @@ static int oaktrail_backlight_init(void)
250 struct backlight_properties props; 250 struct backlight_properties props;
251 251
252 memset(&props, 0, sizeof(struct backlight_properties)); 252 memset(&props, 0, sizeof(struct backlight_properties));
253 props.type = BACKLIGHT_PLATFORM;
253 props.max_brightness = OT_EC_BL_BRIGHTNESS_MAX; 254 props.max_brightness = OT_EC_BL_BRIGHTNESS_MAX;
254 bd = backlight_device_register(DRIVER_NAME, 255 bd = backlight_device_register(DRIVER_NAME,
255 &oaktrail_device->dev, NULL, 256 &oaktrail_device->dev, NULL,
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 77f6e707a2a9..26c5b117df22 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -184,6 +184,10 @@ enum tpacpi_hkey_event_t {
184 184
185 /* Misc bay events */ 185 /* Misc bay events */
186 TP_HKEY_EV_OPTDRV_EJ = 0x3006, /* opt. drive tray ejected */ 186 TP_HKEY_EV_OPTDRV_EJ = 0x3006, /* opt. drive tray ejected */
187 TP_HKEY_EV_HOTPLUG_DOCK = 0x4010, /* docked into hotplug dock
188 or port replicator */
189 TP_HKEY_EV_HOTPLUG_UNDOCK = 0x4011, /* undocked from hotplug
190 dock or port replicator */
187 191
188 /* User-interface events */ 192 /* User-interface events */
189 TP_HKEY_EV_LID_CLOSE = 0x5001, /* laptop lid closed */ 193 TP_HKEY_EV_LID_CLOSE = 0x5001, /* laptop lid closed */
@@ -194,6 +198,10 @@ enum tpacpi_hkey_event_t {
194 TP_HKEY_EV_PEN_REMOVED = 0x500c, /* tablet pen removed */ 198 TP_HKEY_EV_PEN_REMOVED = 0x500c, /* tablet pen removed */
195 TP_HKEY_EV_BRGHT_CHANGED = 0x5010, /* backlight control event */ 199 TP_HKEY_EV_BRGHT_CHANGED = 0x5010, /* backlight control event */
196 200
201 /* Key-related user-interface events */
202 TP_HKEY_EV_KEY_NUMLOCK = 0x6000, /* NumLock key pressed */
203 TP_HKEY_EV_KEY_FN = 0x6005, /* Fn key pressed? E420 */
204
197 /* Thermal events */ 205 /* Thermal events */
198 TP_HKEY_EV_ALARM_BAT_HOT = 0x6011, /* battery too hot */ 206 TP_HKEY_EV_ALARM_BAT_HOT = 0x6011, /* battery too hot */
199 TP_HKEY_EV_ALARM_BAT_XHOT = 0x6012, /* battery critically hot */ 207 TP_HKEY_EV_ALARM_BAT_XHOT = 0x6012, /* battery critically hot */
@@ -201,6 +209,10 @@ enum tpacpi_hkey_event_t {
201 TP_HKEY_EV_ALARM_SENSOR_XHOT = 0x6022, /* sensor critically hot */ 209 TP_HKEY_EV_ALARM_SENSOR_XHOT = 0x6022, /* sensor critically hot */
202 TP_HKEY_EV_THM_TABLE_CHANGED = 0x6030, /* thermal table changed */ 210 TP_HKEY_EV_THM_TABLE_CHANGED = 0x6030, /* thermal table changed */
203 211
212 TP_HKEY_EV_UNK_6040 = 0x6040, /* Related to AC change?
213 some sort of APM hint,
214 W520 */
215
204 /* Misc */ 216 /* Misc */
205 TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */ 217 TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */
206}; 218};
@@ -3513,6 +3525,34 @@ static bool hotkey_notify_wakeup(const u32 hkey,
3513 return true; 3525 return true;
3514} 3526}
3515 3527
3528static bool hotkey_notify_dockevent(const u32 hkey,
3529 bool *send_acpi_ev,
3530 bool *ignore_acpi_ev)
3531{
3532 /* 0x4000-0x4FFF: dock-related events */
3533 *send_acpi_ev = true;
3534 *ignore_acpi_ev = false;
3535
3536 switch (hkey) {
3537 case TP_HKEY_EV_UNDOCK_ACK:
3538 /* ACPI undock operation completed after wakeup */
3539 hotkey_autosleep_ack = 1;
3540 pr_info("undocked\n");
3541 hotkey_wakeup_hotunplug_complete_notify_change();
3542 return true;
3543
3544 case TP_HKEY_EV_HOTPLUG_DOCK: /* docked to port replicator */
3545 pr_info("docked into hotplug port replicator\n");
3546 return true;
3547 case TP_HKEY_EV_HOTPLUG_UNDOCK: /* undocked from port replicator */
3548 pr_info("undocked from hotplug port replicator\n");
3549 return true;
3550
3551 default:
3552 return false;
3553 }
3554}
3555
3516static bool hotkey_notify_usrevent(const u32 hkey, 3556static bool hotkey_notify_usrevent(const u32 hkey,
3517 bool *send_acpi_ev, 3557 bool *send_acpi_ev,
3518 bool *ignore_acpi_ev) 3558 bool *ignore_acpi_ev)
@@ -3547,13 +3587,13 @@ static bool hotkey_notify_usrevent(const u32 hkey,
3547 3587
3548static void thermal_dump_all_sensors(void); 3588static void thermal_dump_all_sensors(void);
3549 3589
3550static bool hotkey_notify_thermal(const u32 hkey, 3590static bool hotkey_notify_6xxx(const u32 hkey,
3551 bool *send_acpi_ev, 3591 bool *send_acpi_ev,
3552 bool *ignore_acpi_ev) 3592 bool *ignore_acpi_ev)
3553{ 3593{
3554 bool known = true; 3594 bool known = true;
3555 3595
3556 /* 0x6000-0x6FFF: thermal alarms */ 3596 /* 0x6000-0x6FFF: thermal alarms/notices and keyboard events */
3557 *send_acpi_ev = true; 3597 *send_acpi_ev = true;
3558 *ignore_acpi_ev = false; 3598 *ignore_acpi_ev = false;
3559 3599
@@ -3582,8 +3622,17 @@ static bool hotkey_notify_thermal(const u32 hkey,
3582 "a sensor reports something is extremely hot!\n"); 3622 "a sensor reports something is extremely hot!\n");
3583 /* recommended action: immediate sleep/hibernate */ 3623 /* recommended action: immediate sleep/hibernate */
3584 break; 3624 break;
3625
3626 case TP_HKEY_EV_KEY_NUMLOCK:
3627 case TP_HKEY_EV_KEY_FN:
3628 /* key press events, we just ignore them as long as the EC
3629 * is still reporting them in the normal keyboard stream */
3630 *send_acpi_ev = false;
3631 *ignore_acpi_ev = true;
3632 return true;
3633
3585 default: 3634 default:
3586 pr_alert("THERMAL ALERT: unknown thermal alarm received\n"); 3635 pr_warn("unknown possible thermal alarm or keyboard event received\n");
3587 known = false; 3636 known = false;
3588 } 3637 }
3589 3638
@@ -3652,15 +3701,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
3652 } 3701 }
3653 break; 3702 break;
3654 case 4: 3703 case 4:
3655 /* 0x4000-0x4FFF: dock-related wakeups */ 3704 /* 0x4000-0x4FFF: dock-related events */
3656 if (hkey == TP_HKEY_EV_UNDOCK_ACK) { 3705 known_ev = hotkey_notify_dockevent(hkey, &send_acpi_ev,
3657 hotkey_autosleep_ack = 1; 3706 &ignore_acpi_ev);
3658 pr_info("undocked\n");
3659 hotkey_wakeup_hotunplug_complete_notify_change();
3660 known_ev = true;
3661 } else {
3662 known_ev = false;
3663 }
3664 break; 3707 break;
3665 case 5: 3708 case 5:
3666 /* 0x5000-0x5FFF: human interface helpers */ 3709 /* 0x5000-0x5FFF: human interface helpers */
@@ -3668,8 +3711,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
3668 &ignore_acpi_ev); 3711 &ignore_acpi_ev);
3669 break; 3712 break;
3670 case 6: 3713 case 6:
3671 /* 0x6000-0x6FFF: thermal alarms */ 3714 /* 0x6000-0x6FFF: thermal alarms/notices and
3672 known_ev = hotkey_notify_thermal(hkey, &send_acpi_ev, 3715 * keyboard events */
3716 known_ev = hotkey_notify_6xxx(hkey, &send_acpi_ev,
3673 &ignore_acpi_ev); 3717 &ignore_acpi_ev);
3674 break; 3718 break;
3675 case 7: 3719 case 7:
diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c
index e5f7b8fe51f4..2bb8f451cc06 100644
--- a/drivers/regulator/db8500-prcmu.c
+++ b/drivers/regulator/db8500-prcmu.c
@@ -266,7 +266,7 @@ static struct regulator_ops db8500_regulator_switch_ops = {
266 * Regulator information 266 * Regulator information
267 */ 267 */
268static struct db8500_regulator_info 268static struct db8500_regulator_info
269 db8500_regulator_info[DB8500_NUM_REGULATORS] = { 269db8500_regulator_info[DB8500_NUM_REGULATORS] = {
270 [DB8500_REGULATOR_VAPE] = { 270 [DB8500_REGULATOR_VAPE] = {
271 .desc = { 271 .desc = {
272 .name = "db8500-vape", 272 .name = "db8500-vape",
@@ -492,11 +492,9 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)
492 info->desc.name, err); 492 info->desc.name, err);
493 493
494 /* if failing, unregister all earlier regulators */ 494 /* if failing, unregister all earlier regulators */
495 i--; 495 while (--i >= 0) {
496 while (i >= 0) {
497 info = &db8500_regulator_info[i]; 496 info = &db8500_regulator_info[i];
498 regulator_unregister(info->rdev); 497 regulator_unregister(info->rdev);
499 i--;
500 } 498 }
501 return err; 499 return err;
502 } 500 }
@@ -536,13 +534,7 @@ static struct platform_driver db8500_regulator_driver = {
536 534
537static int __init db8500_regulator_init(void) 535static int __init db8500_regulator_init(void)
538{ 536{
539 int ret; 537 return platform_driver_register(&db8500_regulator_driver);
540
541 ret = platform_driver_register(&db8500_regulator_driver);
542 if (ret < 0)
543 return -ENODEV;
544
545 return 0;
546} 538}
547 539
548static void __exit db8500_regulator_exit(void) 540static void __exit db8500_regulator_exit(void)
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index daff7fd0e95c..486ed8141fcd 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -139,7 +139,7 @@ static int max8952_set_voltage(struct regulator_dev *rdev,
139 s8 vid = -1, i; 139 s8 vid = -1, i;
140 140
141 if (!gpio_is_valid(max8952->pdata->gpio_vid0) || 141 if (!gpio_is_valid(max8952->pdata->gpio_vid0) ||
142 !gpio_is_valid(max8952->pdata->gpio_vid0)) { 142 !gpio_is_valid(max8952->pdata->gpio_vid1)) {
143 /* DVS not supported */ 143 /* DVS not supported */
144 return -EPERM; 144 return -EPERM;
145 } 145 }
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index 10d5a1d9768e..ad6628ca94f4 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -39,25 +39,28 @@ struct max8997_data {
39 struct regulator_dev **rdev; 39 struct regulator_dev **rdev;
40 int ramp_delay; /* in mV/us */ 40 int ramp_delay; /* in mV/us */
41 41
42 bool buck1_gpiodvs;
43 bool buck2_gpiodvs;
44 bool buck5_gpiodvs;
42 u8 buck1_vol[8]; 45 u8 buck1_vol[8];
43 u8 buck2_vol[8]; 46 u8 buck2_vol[8];
44 u8 buck5_vol[8]; 47 u8 buck5_vol[8];
48 int buck125_gpios[3];
45 int buck125_gpioindex; 49 int buck125_gpioindex;
50 bool ignore_gpiodvs_side_effect;
46 51
47 u8 saved_states[MAX8997_REG_MAX]; 52 u8 saved_states[MAX8997_REG_MAX];
48}; 53};
49 54
50static inline void max8997_set_gpio(struct max8997_data *max8997) 55static inline void max8997_set_gpio(struct max8997_data *max8997)
51{ 56{
52 struct max8997_platform_data *pdata =
53 dev_get_platdata(max8997->iodev->dev);
54 int set3 = (max8997->buck125_gpioindex) & 0x1; 57 int set3 = (max8997->buck125_gpioindex) & 0x1;
55 int set2 = ((max8997->buck125_gpioindex) >> 1) & 0x1; 58 int set2 = ((max8997->buck125_gpioindex) >> 1) & 0x1;
56 int set1 = ((max8997->buck125_gpioindex) >> 2) & 0x1; 59 int set1 = ((max8997->buck125_gpioindex) >> 2) & 0x1;
57 60
58 gpio_set_value(pdata->buck125_gpios[0], set1); 61 gpio_set_value(max8997->buck125_gpios[0], set1);
59 gpio_set_value(pdata->buck125_gpios[1], set2); 62 gpio_set_value(max8997->buck125_gpios[1], set2);
60 gpio_set_value(pdata->buck125_gpios[2], set3); 63 gpio_set_value(max8997->buck125_gpios[2], set3);
61} 64}
62 65
63struct voltage_map_desc { 66struct voltage_map_desc {
@@ -380,8 +383,6 @@ static int max8997_get_voltage_register(struct regulator_dev *rdev,
380static int max8997_get_voltage(struct regulator_dev *rdev) 383static int max8997_get_voltage(struct regulator_dev *rdev)
381{ 384{
382 struct max8997_data *max8997 = rdev_get_drvdata(rdev); 385 struct max8997_data *max8997 = rdev_get_drvdata(rdev);
383 struct max8997_platform_data *pdata =
384 dev_get_platdata(max8997->iodev->dev);
385 struct i2c_client *i2c = max8997->iodev->i2c; 386 struct i2c_client *i2c = max8997->iodev->i2c;
386 int reg, shift, mask, ret; 387 int reg, shift, mask, ret;
387 int rid = max8997_get_rid(rdev); 388 int rid = max8997_get_rid(rdev);
@@ -391,9 +392,9 @@ static int max8997_get_voltage(struct regulator_dev *rdev)
391 if (ret) 392 if (ret)
392 return ret; 393 return ret;
393 394
394 if ((rid == MAX8997_BUCK1 && pdata->buck1_gpiodvs) || 395 if ((rid == MAX8997_BUCK1 && max8997->buck1_gpiodvs) ||
395 (rid == MAX8997_BUCK2 && pdata->buck2_gpiodvs) || 396 (rid == MAX8997_BUCK2 && max8997->buck2_gpiodvs) ||
396 (rid == MAX8997_BUCK5 && pdata->buck5_gpiodvs)) 397 (rid == MAX8997_BUCK5 && max8997->buck5_gpiodvs))
397 reg += max8997->buck125_gpioindex; 398 reg += max8997->buck125_gpioindex;
398 399
399 ret = max8997_read_reg(i2c, reg, &val); 400 ret = max8997_read_reg(i2c, reg, &val);
@@ -543,7 +544,8 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
543 rid == MAX8997_BUCK4 || rid == MAX8997_BUCK5) { 544 rid == MAX8997_BUCK4 || rid == MAX8997_BUCK5) {
544 /* If the voltage is increasing */ 545 /* If the voltage is increasing */
545 if (org < i) 546 if (org < i)
546 udelay(desc->step * (i - org) / max8997->ramp_delay); 547 udelay(DIV_ROUND_UP(desc->step * (i - org),
548 max8997->ramp_delay));
547 } 549 }
548 550
549 return ret; 551 return ret;
@@ -561,8 +563,6 @@ static int max8997_assess_side_effect(struct regulator_dev *rdev,
561 u8 new_val, int *best) 563 u8 new_val, int *best)
562{ 564{
563 struct max8997_data *max8997 = rdev_get_drvdata(rdev); 565 struct max8997_data *max8997 = rdev_get_drvdata(rdev);
564 struct max8997_platform_data *pdata =
565 dev_get_platdata(max8997->iodev->dev);
566 int rid = max8997_get_rid(rdev); 566 int rid = max8997_get_rid(rdev);
567 u8 *buckx_val[3]; 567 u8 *buckx_val[3];
568 bool buckx_gpiodvs[3]; 568 bool buckx_gpiodvs[3];
@@ -589,9 +589,9 @@ static int max8997_assess_side_effect(struct regulator_dev *rdev,
589 buckx_val[0] = max8997->buck1_vol; 589 buckx_val[0] = max8997->buck1_vol;
590 buckx_val[1] = max8997->buck2_vol; 590 buckx_val[1] = max8997->buck2_vol;
591 buckx_val[2] = max8997->buck5_vol; 591 buckx_val[2] = max8997->buck5_vol;
592 buckx_gpiodvs[0] = pdata->buck1_gpiodvs; 592 buckx_gpiodvs[0] = max8997->buck1_gpiodvs;
593 buckx_gpiodvs[1] = pdata->buck2_gpiodvs; 593 buckx_gpiodvs[1] = max8997->buck2_gpiodvs;
594 buckx_gpiodvs[2] = pdata->buck5_gpiodvs; 594 buckx_gpiodvs[2] = max8997->buck5_gpiodvs;
595 595
596 for (i = 0; i < 8; i++) { 596 for (i = 0; i < 8; i++) {
597 int others; 597 int others;
@@ -640,8 +640,6 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
640 int min_uV, int max_uV, unsigned *selector) 640 int min_uV, int max_uV, unsigned *selector)
641{ 641{
642 struct max8997_data *max8997 = rdev_get_drvdata(rdev); 642 struct max8997_data *max8997 = rdev_get_drvdata(rdev);
643 struct max8997_platform_data *pdata =
644 dev_get_platdata(max8997->iodev->dev);
645 int rid = max8997_get_rid(rdev); 643 int rid = max8997_get_rid(rdev);
646 const struct voltage_map_desc *desc; 644 const struct voltage_map_desc *desc;
647 int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg; 645 int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg;
@@ -653,15 +651,15 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
653 651
654 switch (rid) { 652 switch (rid) {
655 case MAX8997_BUCK1: 653 case MAX8997_BUCK1:
656 if (pdata->buck1_gpiodvs) 654 if (max8997->buck1_gpiodvs)
657 gpio_dvs_mode = true; 655 gpio_dvs_mode = true;
658 break; 656 break;
659 case MAX8997_BUCK2: 657 case MAX8997_BUCK2:
660 if (pdata->buck2_gpiodvs) 658 if (max8997->buck2_gpiodvs)
661 gpio_dvs_mode = true; 659 gpio_dvs_mode = true;
662 break; 660 break;
663 case MAX8997_BUCK5: 661 case MAX8997_BUCK5:
664 if (pdata->buck5_gpiodvs) 662 if (max8997->buck5_gpiodvs)
665 gpio_dvs_mode = true; 663 gpio_dvs_mode = true;
666 break; 664 break;
667 } 665 }
@@ -695,7 +693,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
695 new_idx = tmp_idx; 693 new_idx = tmp_idx;
696 new_val = tmp_val; 694 new_val = tmp_val;
697 695
698 if (pdata->ignore_gpiodvs_side_effect == false) 696 if (max8997->ignore_gpiodvs_side_effect == false)
699 return -EINVAL; 697 return -EINVAL;
700 698
701 dev_warn(&rdev->dev, "MAX8997 GPIO-DVS Side Effect Warning: GPIO SET:" 699 dev_warn(&rdev->dev, "MAX8997 GPIO-DVS Side Effect Warning: GPIO SET:"
@@ -993,6 +991,11 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
993 i2c = max8997->iodev->i2c; 991 i2c = max8997->iodev->i2c;
994 992
995 max8997->buck125_gpioindex = pdata->buck125_default_idx; 993 max8997->buck125_gpioindex = pdata->buck125_default_idx;
994 max8997->buck1_gpiodvs = pdata->buck1_gpiodvs;
995 max8997->buck2_gpiodvs = pdata->buck2_gpiodvs;
996 max8997->buck5_gpiodvs = pdata->buck5_gpiodvs;
997 memcpy(max8997->buck125_gpios, pdata->buck125_gpios, sizeof(int) * 3);
998 max8997->ignore_gpiodvs_side_effect = pdata->ignore_gpiodvs_side_effect;
996 999
997 for (i = 0; i < 8; i++) { 1000 for (i = 0; i < 8; i++) {
998 max8997->buck1_vol[i] = ret = 1001 max8997->buck1_vol[i] = ret =
@@ -1124,6 +1127,10 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
1124 0x3f); 1127 0x3f);
1125 } 1128 }
1126 1129
1130 /* Misc Settings */
1131 max8997->ramp_delay = 10; /* set 10mV/us, which is the default */
1132 max8997_write_reg(i2c, MAX8997_REG_BUCKRAMP, (0xf << 4) | 0x9);
1133
1127 for (i = 0; i < pdata->num_regulators; i++) { 1134 for (i = 0; i < pdata->num_regulators; i++) {
1128 const struct voltage_map_desc *desc; 1135 const struct voltage_map_desc *desc;
1129 int id = pdata->regulators[i].id; 1136 int id = pdata->regulators[i].id;
@@ -1148,10 +1155,6 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
1148 } 1155 }
1149 } 1156 }
1150 1157
1151 /* Misc Settings */
1152 max8997->ramp_delay = 10; /* set 10mV/us, which is the default */
1153 max8997_write_reg(i2c, MAX8997_REG_BUCKRAMP, (0xf << 4) | 0x9);
1154
1155 return 0; 1158 return 0;
1156err: 1159err:
1157 for (i = 0; i < max8997->num_regulators; i++) 1160 for (i = 0; i < max8997->num_regulators; i++)
diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
index 795828b90f45..8945e201e42e 100644
--- a/drivers/spi/spi_s3c64xx.c
+++ b/drivers/spi/spi_s3c64xx.c
@@ -116,9 +116,7 @@
116 (((i)->fifo_lvl_mask + 1))) \ 116 (((i)->fifo_lvl_mask + 1))) \
117 ? 1 : 0) 117 ? 1 : 0)
118 118
119#define S3C64XX_SPI_ST_TX_DONE(v, i) ((((v) >> (i)->rx_lvl_offset) & \ 119#define S3C64XX_SPI_ST_TX_DONE(v, i) (((v) & (1 << (i)->tx_st_done)) ? 1 : 0)
120 (((i)->fifo_lvl_mask + 1) << 1)) \
121 ? 1 : 0)
122#define TX_FIFO_LVL(v, i) (((v) >> 6) & (i)->fifo_lvl_mask) 120#define TX_FIFO_LVL(v, i) (((v) >> 6) & (i)->fifo_lvl_mask)
123#define RX_FIFO_LVL(v, i) (((v) >> (i)->rx_lvl_offset) & (i)->fifo_lvl_mask) 121#define RX_FIFO_LVL(v, i) (((v) >> (i)->rx_lvl_offset) & (i)->fifo_lvl_mask)
124 122
diff --git a/drivers/staging/lirc/lirc_imon.c b/drivers/staging/lirc/lirc_imon.c
index 4039eda2a15b..4a9e563f40fa 100644
--- a/drivers/staging/lirc/lirc_imon.c
+++ b/drivers/staging/lirc/lirc_imon.c
@@ -672,8 +672,6 @@ static void imon_incoming_packet(struct imon_context *context,
672static void usb_rx_callback(struct urb *urb) 672static void usb_rx_callback(struct urb *urb)
673{ 673{
674 struct imon_context *context; 674 struct imon_context *context;
675 unsigned char *buf;
676 int len;
677 int intfnum = 0; 675 int intfnum = 0;
678 676
679 if (!urb) 677 if (!urb)
@@ -683,9 +681,6 @@ static void usb_rx_callback(struct urb *urb)
683 if (!context) 681 if (!context)
684 return; 682 return;
685 683
686 buf = urb->transfer_buffer;
687 len = urb->actual_length;
688
689 switch (urb->status) { 684 switch (urb->status) {
690 case -ENOENT: /* usbcore unlink successful! */ 685 case -ENOENT: /* usbcore unlink successful! */
691 return; 686 return;
@@ -728,7 +723,6 @@ static int imon_probe(struct usb_interface *interface,
728 int ir_ep_found = 0; 723 int ir_ep_found = 0;
729 int alloc_status = 0; 724 int alloc_status = 0;
730 int vfd_proto_6p = 0; 725 int vfd_proto_6p = 0;
731 int code_length;
732 struct imon_context *context = NULL; 726 struct imon_context *context = NULL;
733 int i; 727 int i;
734 u16 vendor, product; 728 u16 vendor, product;
@@ -749,8 +743,6 @@ static int imon_probe(struct usb_interface *interface,
749 else 743 else
750 context->display = 1; 744 context->display = 1;
751 745
752 code_length = BUF_CHUNK_SIZE * 8;
753
754 usbdev = usb_get_dev(interface_to_usbdev(interface)); 746 usbdev = usb_get_dev(interface_to_usbdev(interface));
755 iface_desc = interface->cur_altsetting; 747 iface_desc = interface->cur_altsetting;
756 num_endpts = iface_desc->desc.bNumEndpoints; 748 num_endpts = iface_desc->desc.bNumEndpoints;
@@ -856,7 +848,7 @@ static int imon_probe(struct usb_interface *interface,
856 848
857 strcpy(driver->name, MOD_NAME); 849 strcpy(driver->name, MOD_NAME);
858 driver->minor = -1; 850 driver->minor = -1;
859 driver->code_length = sizeof(int) * 8; 851 driver->code_length = BUF_CHUNK_SIZE * 8;
860 driver->sample_rate = 0; 852 driver->sample_rate = 0;
861 driver->features = LIRC_CAN_REC_MODE2; 853 driver->features = LIRC_CAN_REC_MODE2;
862 driver->data = context; 854 driver->data = context;
diff --git a/drivers/staging/lirc/lirc_serial.c b/drivers/staging/lirc/lirc_serial.c
index 4a3cca03224a..805df913bb6e 100644
--- a/drivers/staging/lirc/lirc_serial.c
+++ b/drivers/staging/lirc/lirc_serial.c
@@ -838,7 +838,23 @@ static int hardware_init_port(void)
838 838
839static int init_port(void) 839static int init_port(void)
840{ 840{
841 int i, nlow, nhigh; 841 int i, nlow, nhigh, result;
842
843 result = request_irq(irq, irq_handler,
844 IRQF_DISABLED | (share_irq ? IRQF_SHARED : 0),
845 LIRC_DRIVER_NAME, (void *)&hardware);
846
847 switch (result) {
848 case -EBUSY:
849 printk(KERN_ERR LIRC_DRIVER_NAME ": IRQ %d busy\n", irq);
850 return -EBUSY;
851 case -EINVAL:
852 printk(KERN_ERR LIRC_DRIVER_NAME
853 ": Bad irq number or handler\n");
854 return -EINVAL;
855 default:
856 break;
857 };
842 858
843 /* Reserve io region. */ 859 /* Reserve io region. */
844 /* 860 /*
@@ -893,34 +909,17 @@ static int init_port(void)
893 printk(KERN_INFO LIRC_DRIVER_NAME ": Manually using active " 909 printk(KERN_INFO LIRC_DRIVER_NAME ": Manually using active "
894 "%s receiver\n", sense ? "low" : "high"); 910 "%s receiver\n", sense ? "low" : "high");
895 911
912 dprintk("Interrupt %d, port %04x obtained\n", irq, io);
896 return 0; 913 return 0;
897} 914}
898 915
899static int set_use_inc(void *data) 916static int set_use_inc(void *data)
900{ 917{
901 int result;
902 unsigned long flags; 918 unsigned long flags;
903 919
904 /* initialize timestamp */ 920 /* initialize timestamp */
905 do_gettimeofday(&lasttv); 921 do_gettimeofday(&lasttv);
906 922
907 result = request_irq(irq, irq_handler,
908 IRQF_DISABLED | (share_irq ? IRQF_SHARED : 0),
909 LIRC_DRIVER_NAME, (void *)&hardware);
910
911 switch (result) {
912 case -EBUSY:
913 printk(KERN_ERR LIRC_DRIVER_NAME ": IRQ %d busy\n", irq);
914 return -EBUSY;
915 case -EINVAL:
916 printk(KERN_ERR LIRC_DRIVER_NAME
917 ": Bad irq number or handler\n");
918 return -EINVAL;
919 default:
920 dprintk("Interrupt %d, port %04x obtained\n", irq, io);
921 break;
922 }
923
924 spin_lock_irqsave(&hardware[type].lock, flags); 923 spin_lock_irqsave(&hardware[type].lock, flags);
925 924
926 /* Set DLAB 0. */ 925 /* Set DLAB 0. */
@@ -945,10 +944,6 @@ static void set_use_dec(void *data)
945 soutp(UART_IER, sinp(UART_IER) & 944 soutp(UART_IER, sinp(UART_IER) &
946 (~(UART_IER_MSI|UART_IER_RLSI|UART_IER_THRI|UART_IER_RDI))); 945 (~(UART_IER_MSI|UART_IER_RLSI|UART_IER_THRI|UART_IER_RDI)));
947 spin_unlock_irqrestore(&hardware[type].lock, flags); 946 spin_unlock_irqrestore(&hardware[type].lock, flags);
948
949 free_irq(irq, (void *)&hardware);
950
951 dprintk("freed IRQ %d\n", irq);
952} 947}
953 948
954static ssize_t lirc_write(struct file *file, const char *buf, 949static ssize_t lirc_write(struct file *file, const char *buf,
@@ -1256,6 +1251,9 @@ exit_serial_exit:
1256static void __exit lirc_serial_exit_module(void) 1251static void __exit lirc_serial_exit_module(void)
1257{ 1252{
1258 lirc_serial_exit(); 1253 lirc_serial_exit();
1254
1255 free_irq(irq, (void *)&hardware);
1256
1259 if (iommap != 0) 1257 if (iommap != 0)
1260 release_mem_region(iommap, 8 << ioshift); 1258 release_mem_region(iommap, 8 << ioshift);
1261 else 1259 else
diff --git a/drivers/staging/lirc/lirc_sir.c b/drivers/staging/lirc/lirc_sir.c
index a7b46f24f24e..0d3864594b12 100644
--- a/drivers/staging/lirc/lirc_sir.c
+++ b/drivers/staging/lirc/lirc_sir.c
@@ -739,23 +739,16 @@ static void send_space(unsigned long len)
739static void send_pulse(unsigned long len) 739static void send_pulse(unsigned long len)
740{ 740{
741 long bytes_out = len / TIME_CONST; 741 long bytes_out = len / TIME_CONST;
742 long time_left;
743 742
744 time_left = (long)len - (long)bytes_out * (long)TIME_CONST; 743 if (bytes_out == 0)
745 if (bytes_out == 0) {
746 bytes_out++; 744 bytes_out++;
747 time_left = 0; 745
748 }
749 while (bytes_out--) { 746 while (bytes_out--) {
750 outb(PULSE, io + UART_TX); 747 outb(PULSE, io + UART_TX);
751 /* FIXME treba seriozne cakanie z char/serial.c */ 748 /* FIXME treba seriozne cakanie z char/serial.c */
752 while (!(inb(io + UART_LSR) & UART_LSR_THRE)) 749 while (!(inb(io + UART_LSR) & UART_LSR_THRE))
753 ; 750 ;
754 } 751 }
755#if 0
756 if (time_left > 0)
757 safe_udelay(time_left);
758#endif
759} 752}
760#endif 753#endif
761 754
diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c
index dd6a57c3c3a3..4e051f6b52db 100644
--- a/drivers/staging/lirc/lirc_zilog.c
+++ b/drivers/staging/lirc/lirc_zilog.c
@@ -475,14 +475,14 @@ static int lirc_thread(void *arg)
475 dprintk("poll thread started\n"); 475 dprintk("poll thread started\n");
476 476
477 while (!kthread_should_stop()) { 477 while (!kthread_should_stop()) {
478 set_current_state(TASK_INTERRUPTIBLE);
479
478 /* if device not opened, we can sleep half a second */ 480 /* if device not opened, we can sleep half a second */
479 if (atomic_read(&ir->open_count) == 0) { 481 if (atomic_read(&ir->open_count) == 0) {
480 schedule_timeout(HZ/2); 482 schedule_timeout(HZ/2);
481 continue; 483 continue;
482 } 484 }
483 485
484 set_current_state(TASK_INTERRUPTIBLE);
485
486 /* 486 /*
487 * This is ~113*2 + 24 + jitter (2*repeat gap + code length). 487 * This is ~113*2 + 24 + jitter (2*repeat gap + code length).
488 * We use this interval as the chip resets every time you poll 488 * We use this interval as the chip resets every time you poll
diff --git a/drivers/tty/serial/s3c2410.c b/drivers/tty/serial/s3c2410.c
index bffe6ff9b158..b1d7e7c1849d 100644
--- a/drivers/tty/serial/s3c2410.c
+++ b/drivers/tty/serial/s3c2410.c
@@ -96,8 +96,6 @@ static struct platform_driver s3c2410_serial_driver = {
96 }, 96 },
97}; 97};
98 98
99s3c24xx_console_init(&s3c2410_serial_driver, &s3c2410_uart_inf);
100
101static int __init s3c2410_serial_init(void) 99static int __init s3c2410_serial_init(void)
102{ 100{
103 return s3c24xx_serial_init(&s3c2410_serial_driver, &s3c2410_uart_inf); 101 return s3c24xx_serial_init(&s3c2410_serial_driver, &s3c2410_uart_inf);
diff --git a/drivers/tty/serial/s3c2412.c b/drivers/tty/serial/s3c2412.c
index 7e2b9504a687..2234bf9ced45 100644
--- a/drivers/tty/serial/s3c2412.c
+++ b/drivers/tty/serial/s3c2412.c
@@ -130,8 +130,6 @@ static struct platform_driver s3c2412_serial_driver = {
130 }, 130 },
131}; 131};
132 132
133s3c24xx_console_init(&s3c2412_serial_driver, &s3c2412_uart_inf);
134
135static inline int s3c2412_serial_init(void) 133static inline int s3c2412_serial_init(void)
136{ 134{
137 return s3c24xx_serial_init(&s3c2412_serial_driver, &s3c2412_uart_inf); 135 return s3c24xx_serial_init(&s3c2412_serial_driver, &s3c2412_uart_inf);
diff --git a/drivers/tty/serial/s3c2440.c b/drivers/tty/serial/s3c2440.c
index 9e10d415d5fd..1d0c324b813f 100644
--- a/drivers/tty/serial/s3c2440.c
+++ b/drivers/tty/serial/s3c2440.c
@@ -159,8 +159,6 @@ static struct platform_driver s3c2440_serial_driver = {
159 }, 159 },
160}; 160};
161 161
162s3c24xx_console_init(&s3c2440_serial_driver, &s3c2440_uart_inf);
163
164static int __init s3c2440_serial_init(void) 162static int __init s3c2440_serial_init(void)
165{ 163{
166 return s3c24xx_serial_init(&s3c2440_serial_driver, &s3c2440_uart_inf); 164 return s3c24xx_serial_init(&s3c2440_serial_driver, &s3c2440_uart_inf);
diff --git a/drivers/tty/serial/s3c6400.c b/drivers/tty/serial/s3c6400.c
index ded26c42ff37..e2f6913d84d5 100644
--- a/drivers/tty/serial/s3c6400.c
+++ b/drivers/tty/serial/s3c6400.c
@@ -130,8 +130,6 @@ static struct platform_driver s3c6400_serial_driver = {
130 }, 130 },
131}; 131};
132 132
133s3c24xx_console_init(&s3c6400_serial_driver, &s3c6400_uart_inf);
134
135static int __init s3c6400_serial_init(void) 133static int __init s3c6400_serial_init(void)
136{ 134{
137 return s3c24xx_serial_init(&s3c6400_serial_driver, &s3c6400_uart_inf); 135 return s3c24xx_serial_init(&s3c6400_serial_driver, &s3c6400_uart_inf);
diff --git a/drivers/tty/serial/s5pv210.c b/drivers/tty/serial/s5pv210.c
index dd194dc80ee9..8dd160c96e87 100644
--- a/drivers/tty/serial/s5pv210.c
+++ b/drivers/tty/serial/s5pv210.c
@@ -135,13 +135,6 @@ static struct platform_driver s5p_serial_driver = {
135 }, 135 },
136}; 136};
137 137
138static int __init s5pv210_serial_console_init(void)
139{
140 return s3c24xx_serial_initconsole(&s5p_serial_driver, s5p_uart_inf);
141}
142
143console_initcall(s5pv210_serial_console_init);
144
145static int __init s5p_serial_init(void) 138static int __init s5p_serial_init(void)
146{ 139{
147 return s3c24xx_serial_init(&s5p_serial_driver, *s5p_uart_inf); 140 return s3c24xx_serial_init(&s5p_serial_driver, *s5p_uart_inf);
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index f66f64829303..7ead42104c67 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1416,10 +1416,8 @@ s3c24xx_serial_console_setup(struct console *co, char *options)
1416 1416
1417 /* is the port configured? */ 1417 /* is the port configured? */
1418 1418
1419 if (port->mapbase == 0x0) { 1419 if (port->mapbase == 0x0)
1420 co->index = 0; 1420 return -ENODEV;
1421 port = &s3c24xx_serial_ports[co->index].port;
1422 }
1423 1421
1424 cons_uart = port; 1422 cons_uart = port;
1425 1423
@@ -1451,7 +1449,8 @@ static struct console s3c24xx_serial_console = {
1451 .flags = CON_PRINTBUFFER, 1449 .flags = CON_PRINTBUFFER,
1452 .index = -1, 1450 .index = -1,
1453 .write = s3c24xx_serial_console_write, 1451 .write = s3c24xx_serial_console_write,
1454 .setup = s3c24xx_serial_console_setup 1452 .setup = s3c24xx_serial_console_setup,
1453 .data = &s3c24xx_uart_drv,
1455}; 1454};
1456 1455
1457int s3c24xx_serial_initconsole(struct platform_driver *drv, 1456int s3c24xx_serial_initconsole(struct platform_driver *drv,
diff --git a/drivers/tty/serial/samsung.h b/drivers/tty/serial/samsung.h
index 5b098cd76040..a69d9a54be94 100644
--- a/drivers/tty/serial/samsung.h
+++ b/drivers/tty/serial/samsung.h
@@ -79,25 +79,6 @@ extern int s3c24xx_serial_initconsole(struct platform_driver *drv,
79extern int s3c24xx_serial_init(struct platform_driver *drv, 79extern int s3c24xx_serial_init(struct platform_driver *drv,
80 struct s3c24xx_uart_info *info); 80 struct s3c24xx_uart_info *info);
81 81
82#ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
83
84#define s3c24xx_console_init(__drv, __inf) \
85static int __init s3c_serial_console_init(void) \
86{ \
87 struct s3c24xx_uart_info *uinfo[CONFIG_SERIAL_SAMSUNG_UARTS]; \
88 int i; \
89 \
90 for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++) \
91 uinfo[i] = __inf; \
92 return s3c24xx_serial_initconsole(__drv, uinfo); \
93} \
94 \
95console_initcall(s3c_serial_console_init)
96
97#else
98#define s3c24xx_console_init(drv, inf) extern void no_console(void)
99#endif
100
101#ifdef CONFIG_SERIAL_SAMSUNG_DEBUG 82#ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
102 83
103extern void printascii(const char *); 84extern void printascii(const char *);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 64c7ab4702df..0b5ec234c787 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1147,6 +1147,14 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1147 * any drivers bound to them (a key side effect) 1147 * any drivers bound to them (a key side effect)
1148 */ 1148 */
1149 if (dev->actconfig) { 1149 if (dev->actconfig) {
1150 /*
1151 * FIXME: In order to avoid self-deadlock involving the
1152 * bandwidth_mutex, we have to mark all the interfaces
1153 * before unregistering any of them.
1154 */
1155 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++)
1156 dev->actconfig->interface[i]->unregistering = 1;
1157
1150 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { 1158 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
1151 struct usb_interface *interface; 1159 struct usb_interface *interface;
1152 1160
@@ -1156,7 +1164,6 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1156 continue; 1164 continue;
1157 dev_dbg(&dev->dev, "unregistering interface %s\n", 1165 dev_dbg(&dev->dev, "unregistering interface %s\n",
1158 dev_name(&interface->dev)); 1166 dev_name(&interface->dev));
1159 interface->unregistering = 1;
1160 remove_intf_ep_devs(interface); 1167 remove_intf_ep_devs(interface);
1161 device_del(&interface->dev); 1168 device_del(&interface->dev);
1162 } 1169 }
@@ -1286,6 +1293,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1286 interface); 1293 interface);
1287 return -EINVAL; 1294 return -EINVAL;
1288 } 1295 }
1296 if (iface->unregistering)
1297 return -ENODEV;
1289 1298
1290 alt = usb_altnum_to_altsetting(iface, alternate); 1299 alt = usb_altnum_to_altsetting(iface, alternate);
1291 if (!alt) { 1300 if (!alt) {
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 2cd9a60c7f3a..4e4833168087 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -46,7 +46,6 @@
46#include <asm/system.h> 46#include <asm/system.h>
47#include <asm/unaligned.h> 47#include <asm/unaligned.h>
48#include <asm/dma.h> 48#include <asm/dma.h>
49#include <asm/cacheflush.h>
50 49
51#include "fsl_usb2_udc.h" 50#include "fsl_usb2_udc.h"
52 51
@@ -118,6 +117,17 @@ static void (*_fsl_writel)(u32 v, unsigned __iomem *p);
118#define fsl_readl(p) (*_fsl_readl)((p)) 117#define fsl_readl(p) (*_fsl_readl)((p))
119#define fsl_writel(v, p) (*_fsl_writel)((v), (p)) 118#define fsl_writel(v, p) (*_fsl_writel)((v), (p))
120 119
120static inline void fsl_set_accessors(struct fsl_usb2_platform_data *pdata)
121{
122 if (pdata->big_endian_mmio) {
123 _fsl_readl = _fsl_readl_be;
124 _fsl_writel = _fsl_writel_be;
125 } else {
126 _fsl_readl = _fsl_readl_le;
127 _fsl_writel = _fsl_writel_le;
128 }
129}
130
121static inline u32 cpu_to_hc32(const u32 x) 131static inline u32 cpu_to_hc32(const u32 x)
122{ 132{
123 return udc_controller->pdata->big_endian_desc 133 return udc_controller->pdata->big_endian_desc
@@ -132,6 +142,8 @@ static inline u32 hc32_to_cpu(const u32 x)
132 : le32_to_cpu((__force __le32)x); 142 : le32_to_cpu((__force __le32)x);
133} 143}
134#else /* !CONFIG_PPC32 */ 144#else /* !CONFIG_PPC32 */
145static inline void fsl_set_accessors(struct fsl_usb2_platform_data *pdata) {}
146
135#define fsl_readl(addr) readl(addr) 147#define fsl_readl(addr) readl(addr)
136#define fsl_writel(val32, addr) writel(val32, addr) 148#define fsl_writel(val32, addr) writel(val32, addr)
137#define cpu_to_hc32(x) cpu_to_le32(x) 149#define cpu_to_hc32(x) cpu_to_le32(x)
@@ -1277,6 +1289,11 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
1277 req->req.complete = NULL; 1289 req->req.complete = NULL;
1278 req->dtd_count = 0; 1290 req->dtd_count = 0;
1279 1291
1292 req->req.dma = dma_map_single(ep->udc->gadget.dev.parent,
1293 req->req.buf, req->req.length,
1294 ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
1295 req->mapped = 1;
1296
1280 if (fsl_req_to_dtd(req) == 0) 1297 if (fsl_req_to_dtd(req) == 0)
1281 fsl_queue_td(ep, req); 1298 fsl_queue_td(ep, req);
1282 else 1299 else
@@ -1348,9 +1365,6 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
1348 /* Fill in the reqest structure */ 1365 /* Fill in the reqest structure */
1349 *((u16 *) req->req.buf) = cpu_to_le16(tmp); 1366 *((u16 *) req->req.buf) = cpu_to_le16(tmp);
1350 1367
1351 /* flush cache for the req buffer */
1352 flush_dcache_range((u32)req->req.buf, (u32)req->req.buf + 8);
1353
1354 req->ep = ep; 1368 req->ep = ep;
1355 req->req.length = 2; 1369 req->req.length = 2;
1356 req->req.status = -EINPROGRESS; 1370 req->req.status = -EINPROGRESS;
@@ -1358,6 +1372,11 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
1358 req->req.complete = NULL; 1372 req->req.complete = NULL;
1359 req->dtd_count = 0; 1373 req->dtd_count = 0;
1360 1374
1375 req->req.dma = dma_map_single(ep->udc->gadget.dev.parent,
1376 req->req.buf, req->req.length,
1377 ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
1378 req->mapped = 1;
1379
1361 /* prime the data phase */ 1380 /* prime the data phase */
1362 if ((fsl_req_to_dtd(req) == 0)) 1381 if ((fsl_req_to_dtd(req) == 0))
1363 fsl_queue_td(ep, req); 1382 fsl_queue_td(ep, req);
@@ -2354,7 +2373,6 @@ static int __init struct_udc_setup(struct fsl_udc *udc,
2354 struct fsl_req, req); 2373 struct fsl_req, req);
2355 /* allocate a small amount of memory to get valid address */ 2374 /* allocate a small amount of memory to get valid address */
2356 udc->status_req->req.buf = kmalloc(8, GFP_KERNEL); 2375 udc->status_req->req.buf = kmalloc(8, GFP_KERNEL);
2357 udc->status_req->req.dma = virt_to_phys(udc->status_req->req.buf);
2358 2376
2359 udc->resume_state = USB_STATE_NOTATTACHED; 2377 udc->resume_state = USB_STATE_NOTATTACHED;
2360 udc->usb_state = USB_STATE_POWERED; 2378 udc->usb_state = USB_STATE_POWERED;
@@ -2470,13 +2488,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
2470 } 2488 }
2471 2489
2472 /* Set accessors only after pdata->init() ! */ 2490 /* Set accessors only after pdata->init() ! */
2473 if (pdata->big_endian_mmio) { 2491 fsl_set_accessors(pdata);
2474 _fsl_readl = _fsl_readl_be;
2475 _fsl_writel = _fsl_writel_be;
2476 } else {
2477 _fsl_readl = _fsl_readl_le;
2478 _fsl_writel = _fsl_writel_le;
2479 }
2480 2492
2481#ifndef CONFIG_ARCH_MXC 2493#ifndef CONFIG_ARCH_MXC
2482 if (pdata->have_sysif_regs) 2494 if (pdata->have_sysif_regs)
diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
index ad57593d224a..a0c8965c1a79 100644
--- a/drivers/w1/masters/ds1wm.c
+++ b/drivers/w1/masters/ds1wm.c
@@ -109,6 +109,7 @@ struct ds1wm_data {
109 /* byte to write that makes all intr disabled, */ 109 /* byte to write that makes all intr disabled, */
110 /* considering active_state (IAS) (optimization) */ 110 /* considering active_state (IAS) (optimization) */
111 u8 int_en_reg_none; 111 u8 int_en_reg_none;
112 unsigned int reset_recover_delay; /* see ds1wm.h */
112}; 113};
113 114
114static inline void ds1wm_write_register(struct ds1wm_data *ds1wm_data, u32 reg, 115static inline void ds1wm_write_register(struct ds1wm_data *ds1wm_data, u32 reg,
@@ -187,6 +188,9 @@ static int ds1wm_reset(struct ds1wm_data *ds1wm_data)
187 return 1; 188 return 1;
188 } 189 }
189 190
191 if (ds1wm_data->reset_recover_delay)
192 msleep(ds1wm_data->reset_recover_delay);
193
190 return 0; 194 return 0;
191} 195}
192 196
@@ -490,6 +494,7 @@ static int ds1wm_probe(struct platform_device *pdev)
490 } 494 }
491 ds1wm_data->irq = res->start; 495 ds1wm_data->irq = res->start;
492 ds1wm_data->int_en_reg_none = (plat->active_high ? DS1WM_INTEN_IAS : 0); 496 ds1wm_data->int_en_reg_none = (plat->active_high ? DS1WM_INTEN_IAS : 0);
497 ds1wm_data->reset_recover_delay = plat->reset_recover_delay;
493 498
494 if (res->flags & IORESOURCE_IRQ_HIGHEDGE) 499 if (res->flags & IORESOURCE_IRQ_HIGHEDGE)
495 irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_RISING); 500 irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_RISING);
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 63039ed9576f..2bc5dc644b4c 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1864,6 +1864,7 @@ cleanup:
1864 kfree(psinfo); 1864 kfree(psinfo);
1865 kfree(notes); 1865 kfree(notes);
1866 kfree(fpu); 1866 kfree(fpu);
1867 kfree(shdr4extnum);
1867#ifdef ELF_CORE_COPY_XFPREGS 1868#ifdef ELF_CORE_COPY_XFPREGS
1868 kfree(xfpu); 1869 kfree(xfpu);
1869#endif 1870#endif
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index f30ac05dbda7..3b859a3e6a0e 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1335,6 +1335,11 @@ struct btrfs_ioctl_defrag_range_args {
1335 */ 1335 */
1336#define BTRFS_STRING_ITEM_KEY 253 1336#define BTRFS_STRING_ITEM_KEY 253
1337 1337
1338/*
1339 * Flags for mount options.
1340 *
1341 * Note: don't forget to add new options to btrfs_show_options()
1342 */
1338#define BTRFS_MOUNT_NODATASUM (1 << 0) 1343#define BTRFS_MOUNT_NODATASUM (1 << 0)
1339#define BTRFS_MOUNT_NODATACOW (1 << 1) 1344#define BTRFS_MOUNT_NODATACOW (1 << 1)
1340#define BTRFS_MOUNT_NOBARRIER (1 << 2) 1345#define BTRFS_MOUNT_NOBARRIER (1 << 2)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d340f63d8f07..3601f0aebddf 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2678,12 +2678,14 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans,
2678 int ret; 2678 int ret;
2679 2679
2680 /* 2680 /*
2681 * If root is tree root, it means this inode is used to 2681 * If the inode is a free space inode, we can deadlock during commit
2682 * store free space information. And these inodes are updated 2682 * if we put it into the delayed code.
2683 * when committing the transaction, so they needn't delaye to 2683 *
2684 * be updated, or deadlock will occured. 2684 * The data relocation inode should also be directly updated
2685 * without delay
2685 */ 2686 */
2686 if (!is_free_space_inode(root, inode)) { 2687 if (!is_free_space_inode(root, inode)
2688 && root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID) {
2687 ret = btrfs_delayed_update_inode(trans, root, inode); 2689 ret = btrfs_delayed_update_inode(trans, root, inode);
2688 if (!ret) 2690 if (!ret)
2689 btrfs_set_inode_last_trans(trans, inode); 2691 btrfs_set_inode_last_trans(trans, inode);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 0bb4ebbb71b7..15634d4648d7 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -723,6 +723,12 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
723 seq_puts(seq, ",clear_cache"); 723 seq_puts(seq, ",clear_cache");
724 if (btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED)) 724 if (btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED))
725 seq_puts(seq, ",user_subvol_rm_allowed"); 725 seq_puts(seq, ",user_subvol_rm_allowed");
726 if (btrfs_test_opt(root, ENOSPC_DEBUG))
727 seq_puts(seq, ",enospc_debug");
728 if (btrfs_test_opt(root, AUTO_DEFRAG))
729 seq_puts(seq, ",autodefrag");
730 if (btrfs_test_opt(root, INODE_MAP_CACHE))
731 seq_puts(seq, ",inode_cache");
726 return 0; 732 return 0;
727} 733}
728 734
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 1efa56e18f9b..19450bc53632 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2098,7 +2098,8 @@ int btrfs_balance(struct btrfs_root *dev_root)
2098 chunk_root->root_key.objectid, 2098 chunk_root->root_key.objectid,
2099 found_key.objectid, 2099 found_key.objectid,
2100 found_key.offset); 2100 found_key.offset);
2101 BUG_ON(ret && ret != -ENOSPC); 2101 if (ret && ret != -ENOSPC)
2102 goto error;
2102 key.offset = found_key.offset - 1; 2103 key.offset = found_key.offset - 1;
2103 } 2104 }
2104 ret = 0; 2105 ret = 0;
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 9542f07d0b93..4698a5c553dc 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -290,7 +290,6 @@ static int striped_read(struct inode *inode,
290 struct ceph_inode_info *ci = ceph_inode(inode); 290 struct ceph_inode_info *ci = ceph_inode(inode);
291 u64 pos, this_len; 291 u64 pos, this_len;
292 int io_align, page_align; 292 int io_align, page_align;
293 int page_off = off & ~PAGE_CACHE_MASK; /* first byte's offset in page */
294 int left, pages_left; 293 int left, pages_left;
295 int read; 294 int read;
296 struct page **page_pos; 295 struct page **page_pos;
@@ -326,12 +325,11 @@ more:
326 ret, hit_stripe ? " HITSTRIPE" : "", was_short ? " SHORT" : ""); 325 ret, hit_stripe ? " HITSTRIPE" : "", was_short ? " SHORT" : "");
327 326
328 if (ret > 0) { 327 if (ret > 0) {
329 int didpages = 328 int didpages = (page_align + ret) >> PAGE_CACHE_SHIFT;
330 ((pos & ~PAGE_CACHE_MASK) + ret) >> PAGE_CACHE_SHIFT;
331 329
332 if (read < pos - off) { 330 if (read < pos - off) {
333 dout(" zero gap %llu to %llu\n", off + read, pos); 331 dout(" zero gap %llu to %llu\n", off + read, pos);
334 ceph_zero_page_vector_range(page_off + read, 332 ceph_zero_page_vector_range(page_align + read,
335 pos - off - read, pages); 333 pos - off - read, pages);
336 } 334 }
337 pos += ret; 335 pos += ret;
@@ -356,7 +354,7 @@ more:
356 left = inode->i_size - pos; 354 left = inode->i_size - pos;
357 355
358 dout("zero tail %d\n", left); 356 dout("zero tail %d\n", left);
359 ceph_zero_page_vector_range(page_off + read, left, 357 ceph_zero_page_vector_range(page_align + read, left,
360 pages); 358 pages);
361 read += left; 359 read += left;
362 } 360 }
@@ -478,9 +476,6 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
478 else 476 else
479 pos = *offset; 477 pos = *offset;
480 478
481 io_align = pos & ~PAGE_MASK;
482 buf_align = (unsigned long)data & ~PAGE_MASK;
483
484 ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + left); 479 ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + left);
485 if (ret < 0) 480 if (ret < 0)
486 return ret; 481 return ret;
@@ -504,6 +499,8 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
504 * boundary. this isn't atomic, unfortunately. :( 499 * boundary. this isn't atomic, unfortunately. :(
505 */ 500 */
506more: 501more:
502 io_align = pos & ~PAGE_MASK;
503 buf_align = (unsigned long)data & ~PAGE_MASK;
507 len = left; 504 len = left;
508 if (file->f_flags & O_DIRECT) { 505 if (file->f_flags & O_DIRECT) {
509 /* write from beginning of first page, regardless of 506 /* write from beginning of first page, regardless of
@@ -593,6 +590,7 @@ out:
593 pos += len; 590 pos += len;
594 written += len; 591 written += len;
595 left -= len; 592 left -= len;
593 data += written;
596 if (left) 594 if (left)
597 goto more; 595 goto more;
598 596
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 35f9154615fa..3e2989976297 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -649,9 +649,9 @@ cifs_do_mount(struct file_system_type *fs_type,
649 649
650 cFYI(1, "Devname: %s flags: %d ", dev_name, flags); 650 cFYI(1, "Devname: %s flags: %d ", dev_name, flags);
651 651
652 rc = cifs_setup_volume_info(&volume_info, (char *)data, dev_name); 652 volume_info = cifs_get_volume_info((char *)data, dev_name);
653 if (rc) 653 if (IS_ERR(volume_info))
654 return ERR_PTR(rc); 654 return ERR_CAST(volume_info);
655 655
656 cifs_sb = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL); 656 cifs_sb = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL);
657 if (cifs_sb == NULL) { 657 if (cifs_sb == NULL) {
@@ -713,7 +713,7 @@ cifs_do_mount(struct file_system_type *fs_type,
713out_super: 713out_super:
714 deactivate_locked_super(sb); 714 deactivate_locked_super(sb);
715out: 715out:
716 cifs_cleanup_volume_info(&volume_info); 716 cifs_cleanup_volume_info(volume_info);
717 return root; 717 return root;
718 718
719out_mountdata: 719out_mountdata:
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 257f312ede42..8df28e925e5b 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -154,9 +154,9 @@ extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
154extern void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, 154extern void cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
155 struct cifs_sb_info *cifs_sb); 155 struct cifs_sb_info *cifs_sb);
156extern int cifs_match_super(struct super_block *, void *); 156extern int cifs_match_super(struct super_block *, void *);
157extern void cifs_cleanup_volume_info(struct smb_vol **pvolume_info); 157extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info);
158extern int cifs_setup_volume_info(struct smb_vol **pvolume_info, 158extern struct smb_vol *cifs_get_volume_info(char *mount_data,
159 char *mount_data, const char *devname); 159 const char *devname);
160extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *); 160extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *);
161extern void cifs_umount(struct cifs_sb_info *); 161extern void cifs_umount(struct cifs_sb_info *);
162extern void cifs_dfs_release_automount_timer(void); 162extern void cifs_dfs_release_automount_timer(void);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index c8cb83ef6f6f..dbd669cc5bc7 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -65,6 +65,8 @@ static int ip_connect(struct TCP_Server_Info *server);
65static int generic_ip_connect(struct TCP_Server_Info *server); 65static int generic_ip_connect(struct TCP_Server_Info *server);
66static void tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink); 66static void tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink);
67static void cifs_prune_tlinks(struct work_struct *work); 67static void cifs_prune_tlinks(struct work_struct *work);
68static int cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
69 const char *devname);
68 70
69/* 71/*
70 * cifs tcp session reconnection 72 * cifs tcp session reconnection
@@ -2240,8 +2242,8 @@ cifs_match_super(struct super_block *sb, void *data)
2240 2242
2241 rc = compare_mount_options(sb, mnt_data); 2243 rc = compare_mount_options(sb, mnt_data);
2242out: 2244out:
2243 cifs_put_tlink(tlink);
2244 spin_unlock(&cifs_tcp_ses_lock); 2245 spin_unlock(&cifs_tcp_ses_lock);
2246 cifs_put_tlink(tlink);
2245 return rc; 2247 return rc;
2246} 2248}
2247 2249
@@ -2830,15 +2832,9 @@ is_path_accessible(int xid, struct cifs_tcon *tcon,
2830 return rc; 2832 return rc;
2831} 2833}
2832 2834
2833void 2835static void
2834cifs_cleanup_volume_info(struct smb_vol **pvolume_info) 2836cleanup_volume_info_contents(struct smb_vol *volume_info)
2835{ 2837{
2836 struct smb_vol *volume_info;
2837
2838 if (!pvolume_info || !*pvolume_info)
2839 return;
2840
2841 volume_info = *pvolume_info;
2842 kfree(volume_info->username); 2838 kfree(volume_info->username);
2843 kzfree(volume_info->password); 2839 kzfree(volume_info->password);
2844 kfree(volume_info->UNC); 2840 kfree(volume_info->UNC);
@@ -2846,28 +2842,44 @@ cifs_cleanup_volume_info(struct smb_vol **pvolume_info)
2846 kfree(volume_info->domainname); 2842 kfree(volume_info->domainname);
2847 kfree(volume_info->iocharset); 2843 kfree(volume_info->iocharset);
2848 kfree(volume_info->prepath); 2844 kfree(volume_info->prepath);
2845}
2846
2847void
2848cifs_cleanup_volume_info(struct smb_vol *volume_info)
2849{
2850 if (!volume_info)
2851 return;
2852 cleanup_volume_info_contents(volume_info);
2849 kfree(volume_info); 2853 kfree(volume_info);
2850 *pvolume_info = NULL;
2851 return;
2852} 2854}
2853 2855
2856
2854#ifdef CONFIG_CIFS_DFS_UPCALL 2857#ifdef CONFIG_CIFS_DFS_UPCALL
2855/* build_path_to_root returns full path to root when 2858/* build_path_to_root returns full path to root when
2856 * we do not have an exiting connection (tcon) */ 2859 * we do not have an exiting connection (tcon) */
2857static char * 2860static char *
2858build_unc_path_to_root(const struct smb_vol *volume_info, 2861build_unc_path_to_root(const struct smb_vol *vol,
2859 const struct cifs_sb_info *cifs_sb) 2862 const struct cifs_sb_info *cifs_sb)
2860{ 2863{
2861 char *full_path; 2864 char *full_path, *pos;
2865 unsigned int pplen = vol->prepath ? strlen(vol->prepath) : 0;
2866 unsigned int unc_len = strnlen(vol->UNC, MAX_TREE_SIZE + 1);
2862 2867
2863 int unc_len = strnlen(volume_info->UNC, MAX_TREE_SIZE + 1); 2868 full_path = kmalloc(unc_len + pplen + 1, GFP_KERNEL);
2864 full_path = kmalloc(unc_len + 1, GFP_KERNEL);
2865 if (full_path == NULL) 2869 if (full_path == NULL)
2866 return ERR_PTR(-ENOMEM); 2870 return ERR_PTR(-ENOMEM);
2867 2871
2868 strncpy(full_path, volume_info->UNC, unc_len); 2872 strncpy(full_path, vol->UNC, unc_len);
2869 full_path[unc_len] = 0; /* add trailing null */ 2873 pos = full_path + unc_len;
2874
2875 if (pplen) {
2876 strncpy(pos, vol->prepath, pplen);
2877 pos += pplen;
2878 }
2879
2880 *pos = '\0'; /* add trailing null */
2870 convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb)); 2881 convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb));
2882 cFYI(1, "%s: full_path=%s", __func__, full_path);
2871 return full_path; 2883 return full_path;
2872} 2884}
2873 2885
@@ -2910,15 +2922,18 @@ expand_dfs_referral(int xid, struct cifs_ses *pSesInfo,
2910 &fake_devname); 2922 &fake_devname);
2911 2923
2912 free_dfs_info_array(referrals, num_referrals); 2924 free_dfs_info_array(referrals, num_referrals);
2913 kfree(fake_devname);
2914
2915 if (cifs_sb->mountdata != NULL)
2916 kfree(cifs_sb->mountdata);
2917 2925
2918 if (IS_ERR(mdata)) { 2926 if (IS_ERR(mdata)) {
2919 rc = PTR_ERR(mdata); 2927 rc = PTR_ERR(mdata);
2920 mdata = NULL; 2928 mdata = NULL;
2929 } else {
2930 cleanup_volume_info_contents(volume_info);
2931 memset(volume_info, '\0', sizeof(*volume_info));
2932 rc = cifs_setup_volume_info(volume_info, mdata,
2933 fake_devname);
2921 } 2934 }
2935 kfree(fake_devname);
2936 kfree(cifs_sb->mountdata);
2922 cifs_sb->mountdata = mdata; 2937 cifs_sb->mountdata = mdata;
2923 } 2938 }
2924 kfree(full_path); 2939 kfree(full_path);
@@ -2926,33 +2941,20 @@ expand_dfs_referral(int xid, struct cifs_ses *pSesInfo,
2926} 2941}
2927#endif 2942#endif
2928 2943
2929int cifs_setup_volume_info(struct smb_vol **pvolume_info, char *mount_data, 2944static int
2930 const char *devname) 2945cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
2946 const char *devname)
2931{ 2947{
2932 struct smb_vol *volume_info;
2933 int rc = 0; 2948 int rc = 0;
2934 2949
2935 *pvolume_info = NULL; 2950 if (cifs_parse_mount_options(mount_data, devname, volume_info))
2936 2951 return -EINVAL;
2937 volume_info = kzalloc(sizeof(struct smb_vol), GFP_KERNEL);
2938 if (!volume_info) {
2939 rc = -ENOMEM;
2940 goto out;
2941 }
2942
2943 if (cifs_parse_mount_options(mount_data, devname,
2944 volume_info)) {
2945 rc = -EINVAL;
2946 goto out;
2947 }
2948 2952
2949 if (volume_info->nullauth) { 2953 if (volume_info->nullauth) {
2950 cFYI(1, "null user"); 2954 cFYI(1, "null user");
2951 volume_info->username = kzalloc(1, GFP_KERNEL); 2955 volume_info->username = kzalloc(1, GFP_KERNEL);
2952 if (volume_info->username == NULL) { 2956 if (volume_info->username == NULL)
2953 rc = -ENOMEM; 2957 return -ENOMEM;
2954 goto out;
2955 }
2956 } else if (volume_info->username) { 2958 } else if (volume_info->username) {
2957 /* BB fixme parse for domain name here */ 2959 /* BB fixme parse for domain name here */
2958 cFYI(1, "Username: %s", volume_info->username); 2960 cFYI(1, "Username: %s", volume_info->username);
@@ -2960,8 +2962,7 @@ int cifs_setup_volume_info(struct smb_vol **pvolume_info, char *mount_data,
2960 cifserror("No username specified"); 2962 cifserror("No username specified");
2961 /* In userspace mount helper we can get user name from alternate 2963 /* In userspace mount helper we can get user name from alternate
2962 locations such as env variables and files on disk */ 2964 locations such as env variables and files on disk */
2963 rc = -EINVAL; 2965 return -EINVAL;
2964 goto out;
2965 } 2966 }
2966 2967
2967 /* this is needed for ASCII cp to Unicode converts */ 2968 /* this is needed for ASCII cp to Unicode converts */
@@ -2973,18 +2974,32 @@ int cifs_setup_volume_info(struct smb_vol **pvolume_info, char *mount_data,
2973 if (volume_info->local_nls == NULL) { 2974 if (volume_info->local_nls == NULL) {
2974 cERROR(1, "CIFS mount error: iocharset %s not found", 2975 cERROR(1, "CIFS mount error: iocharset %s not found",
2975 volume_info->iocharset); 2976 volume_info->iocharset);
2976 rc = -ELIBACC; 2977 return -ELIBACC;
2977 goto out;
2978 } 2978 }
2979 } 2979 }
2980 2980
2981 *pvolume_info = volume_info;
2982 return rc;
2983out:
2984 cifs_cleanup_volume_info(&volume_info);
2985 return rc; 2981 return rc;
2986} 2982}
2987 2983
2984struct smb_vol *
2985cifs_get_volume_info(char *mount_data, const char *devname)
2986{
2987 int rc;
2988 struct smb_vol *volume_info;
2989
2990 volume_info = kzalloc(sizeof(struct smb_vol), GFP_KERNEL);
2991 if (!volume_info)
2992 return ERR_PTR(-ENOMEM);
2993
2994 rc = cifs_setup_volume_info(volume_info, mount_data, devname);
2995 if (rc) {
2996 cifs_cleanup_volume_info(volume_info);
2997 volume_info = ERR_PTR(rc);
2998 }
2999
3000 return volume_info;
3001}
3002
2988int 3003int
2989cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) 3004cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
2990{ 3005{
@@ -2997,6 +3012,7 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
2997 struct tcon_link *tlink; 3012 struct tcon_link *tlink;
2998#ifdef CONFIG_CIFS_DFS_UPCALL 3013#ifdef CONFIG_CIFS_DFS_UPCALL
2999 int referral_walks_count = 0; 3014 int referral_walks_count = 0;
3015#endif
3000 3016
3001 rc = bdi_setup_and_register(&cifs_sb->bdi, "cifs", BDI_CAP_MAP_COPY); 3017 rc = bdi_setup_and_register(&cifs_sb->bdi, "cifs", BDI_CAP_MAP_COPY);
3002 if (rc) 3018 if (rc)
@@ -3004,6 +3020,7 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
3004 3020
3005 cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages; 3021 cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
3006 3022
3023#ifdef CONFIG_CIFS_DFS_UPCALL
3007try_mount_again: 3024try_mount_again:
3008 /* cleanup activities if we're chasing a referral */ 3025 /* cleanup activities if we're chasing a referral */
3009 if (referral_walks_count) { 3026 if (referral_walks_count) {
@@ -3012,7 +3029,6 @@ try_mount_again:
3012 else if (pSesInfo) 3029 else if (pSesInfo)
3013 cifs_put_smb_ses(pSesInfo); 3030 cifs_put_smb_ses(pSesInfo);
3014 3031
3015 cifs_cleanup_volume_info(&volume_info);
3016 FreeXid(xid); 3032 FreeXid(xid);
3017 } 3033 }
3018#endif 3034#endif
diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c
index 816696621ec9..42e5363b4102 100644
--- a/fs/cifs/fscache.c
+++ b/fs/cifs/fscache.c
@@ -92,6 +92,7 @@ static void cifs_fscache_disable_inode_cookie(struct inode *inode)
92 92
93 if (cifsi->fscache) { 93 if (cifsi->fscache) {
94 cFYI(1, "%s: (0x%p)", __func__, cifsi->fscache); 94 cFYI(1, "%s: (0x%p)", __func__, cifsi->fscache);
95 fscache_uncache_all_inode_pages(cifsi->fscache, inode);
95 fscache_relinquish_cookie(cifsi->fscache, 1); 96 fscache_relinquish_cookie(cifsi->fscache, 1);
96 cifsi->fscache = NULL; 97 cifsi->fscache = NULL;
97 } 98 }
diff --git a/fs/fscache/page.c b/fs/fscache/page.c
index a2a5d19ece6a..2f343b4d7a7d 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -954,3 +954,47 @@ void fscache_mark_pages_cached(struct fscache_retrieval *op,
954 pagevec_reinit(pagevec); 954 pagevec_reinit(pagevec);
955} 955}
956EXPORT_SYMBOL(fscache_mark_pages_cached); 956EXPORT_SYMBOL(fscache_mark_pages_cached);
957
958/*
959 * Uncache all the pages in an inode that are marked PG_fscache, assuming them
960 * to be associated with the given cookie.
961 */
962void __fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
963 struct inode *inode)
964{
965 struct address_space *mapping = inode->i_mapping;
966 struct pagevec pvec;
967 pgoff_t next;
968 int i;
969
970 _enter("%p,%p", cookie, inode);
971
972 if (!mapping || mapping->nrpages == 0) {
973 _leave(" [no pages]");
974 return;
975 }
976
977 pagevec_init(&pvec, 0);
978 next = 0;
979 while (next <= (loff_t)-1 &&
980 pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)
981 ) {
982 for (i = 0; i < pagevec_count(&pvec); i++) {
983 struct page *page = pvec.pages[i];
984 pgoff_t page_index = page->index;
985
986 ASSERTCMP(page_index, >=, next);
987 next = page_index + 1;
988
989 if (PageFsCache(page)) {
990 __fscache_wait_on_page_write(cookie, page);
991 __fscache_uncache_page(cookie, page);
992 }
993 }
994 pagevec_release(&pvec);
995 cond_resched();
996 }
997
998 _leave("");
999}
1000EXPORT_SYMBOL(__fscache_uncache_all_inode_pages);
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index b49b55584c84..84a47b709f51 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -500,7 +500,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
500out_put_hidden_dir: 500out_put_hidden_dir:
501 iput(sbi->hidden_dir); 501 iput(sbi->hidden_dir);
502out_put_root: 502out_put_root:
503 iput(sbi->alloc_file); 503 iput(root);
504out_put_alloc_file: 504out_put_alloc_file:
505 iput(sbi->alloc_file); 505 iput(sbi->alloc_file);
506out_close_cat_tree: 506out_close_cat_tree:
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
index 3031d81f5f0f..4ac88ff79aa6 100644
--- a/fs/hfsplus/wrapper.c
+++ b/fs/hfsplus/wrapper.c
@@ -36,6 +36,7 @@ int hfsplus_submit_bio(struct block_device *bdev, sector_t sector,
36{ 36{
37 DECLARE_COMPLETION_ONSTACK(wait); 37 DECLARE_COMPLETION_ONSTACK(wait);
38 struct bio *bio; 38 struct bio *bio;
39 int ret = 0;
39 40
40 bio = bio_alloc(GFP_NOIO, 1); 41 bio = bio_alloc(GFP_NOIO, 1);
41 bio->bi_sector = sector; 42 bio->bi_sector = sector;
@@ -54,8 +55,10 @@ int hfsplus_submit_bio(struct block_device *bdev, sector_t sector,
54 wait_for_completion(&wait); 55 wait_for_completion(&wait);
55 56
56 if (!bio_flagged(bio, BIO_UPTODATE)) 57 if (!bio_flagged(bio, BIO_UPTODATE))
57 return -EIO; 58 ret = -EIO;
58 return 0; 59
60 bio_put(bio);
61 return ret;
59} 62}
60 63
61static int hfsplus_read_mdb(void *bufptr, struct hfsplus_wd *wd) 64static int hfsplus_read_mdb(void *bufptr, struct hfsplus_wd *wd)
diff --git a/fs/locks.c b/fs/locks.c
index 0a4f50dfadfb..b286539d547a 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -160,10 +160,28 @@ EXPORT_SYMBOL_GPL(unlock_flocks);
160 160
161static struct kmem_cache *filelock_cache __read_mostly; 161static struct kmem_cache *filelock_cache __read_mostly;
162 162
163static void locks_init_lock_always(struct file_lock *fl)
164{
165 fl->fl_next = NULL;
166 fl->fl_fasync = NULL;
167 fl->fl_owner = NULL;
168 fl->fl_pid = 0;
169 fl->fl_nspid = NULL;
170 fl->fl_file = NULL;
171 fl->fl_flags = 0;
172 fl->fl_type = 0;
173 fl->fl_start = fl->fl_end = 0;
174}
175
163/* Allocate an empty lock structure. */ 176/* Allocate an empty lock structure. */
164struct file_lock *locks_alloc_lock(void) 177struct file_lock *locks_alloc_lock(void)
165{ 178{
166 return kmem_cache_alloc(filelock_cache, GFP_KERNEL); 179 struct file_lock *fl = kmem_cache_alloc(filelock_cache, GFP_KERNEL);
180
181 if (fl)
182 locks_init_lock_always(fl);
183
184 return fl;
167} 185}
168EXPORT_SYMBOL_GPL(locks_alloc_lock); 186EXPORT_SYMBOL_GPL(locks_alloc_lock);
169 187
@@ -200,17 +218,9 @@ void locks_init_lock(struct file_lock *fl)
200 INIT_LIST_HEAD(&fl->fl_link); 218 INIT_LIST_HEAD(&fl->fl_link);
201 INIT_LIST_HEAD(&fl->fl_block); 219 INIT_LIST_HEAD(&fl->fl_block);
202 init_waitqueue_head(&fl->fl_wait); 220 init_waitqueue_head(&fl->fl_wait);
203 fl->fl_next = NULL;
204 fl->fl_fasync = NULL;
205 fl->fl_owner = NULL;
206 fl->fl_pid = 0;
207 fl->fl_nspid = NULL;
208 fl->fl_file = NULL;
209 fl->fl_flags = 0;
210 fl->fl_type = 0;
211 fl->fl_start = fl->fl_end = 0;
212 fl->fl_ops = NULL; 221 fl->fl_ops = NULL;
213 fl->fl_lmops = NULL; 222 fl->fl_lmops = NULL;
223 locks_init_lock_always(fl);
214} 224}
215 225
216EXPORT_SYMBOL(locks_init_lock); 226EXPORT_SYMBOL(locks_init_lock);
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index ce153a6b3aec..419119c371bf 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -259,12 +259,10 @@ static void nfs_fscache_disable_inode_cookie(struct inode *inode)
259 dfprintk(FSCACHE, 259 dfprintk(FSCACHE,
260 "NFS: nfsi 0x%p turning cache off\n", NFS_I(inode)); 260 "NFS: nfsi 0x%p turning cache off\n", NFS_I(inode));
261 261
262 /* Need to invalidate any mapped pages that were read in before 262 /* Need to uncache any pages attached to this inode that
263 * turning off the cache. 263 * fscache knows about before turning off the cache.
264 */ 264 */
265 if (inode->i_mapping && inode->i_mapping->nrpages) 265 fscache_uncache_all_inode_pages(NFS_I(inode)->fscache, inode);
266 invalidate_inode_pages2(inode->i_mapping);
267
268 nfs_fscache_zap_inode_cookie(inode); 266 nfs_fscache_zap_inode_cookie(inode);
269 } 267 }
270} 268}
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 09983a3344a5..b1e88d56069c 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -681,15 +681,15 @@ xfs_inode_item_unlock(
681 * where the cluster buffer may be unpinned before the inode is inserted into 681 * where the cluster buffer may be unpinned before the inode is inserted into
682 * the AIL during transaction committed processing. If the buffer is unpinned 682 * the AIL during transaction committed processing. If the buffer is unpinned
683 * before the inode item has been committed and inserted, then it is possible 683 * before the inode item has been committed and inserted, then it is possible
684 * for the buffer to be written and IO completions before the inode is inserted 684 * for the buffer to be written and IO completes before the inode is inserted
685 * into the AIL. In that case, we'd be inserting a clean, stale inode into the 685 * into the AIL. In that case, we'd be inserting a clean, stale inode into the
686 * AIL which will never get removed. It will, however, get reclaimed which 686 * AIL which will never get removed. It will, however, get reclaimed which
687 * triggers an assert in xfs_inode_free() complaining about freein an inode 687 * triggers an assert in xfs_inode_free() complaining about freein an inode
688 * still in the AIL. 688 * still in the AIL.
689 * 689 *
690 * To avoid this, return a lower LSN than the one passed in so that the 690 * To avoid this, just unpin the inode directly and return a LSN of -1 so the
691 * transaction committed code will not move the inode forward in the AIL but 691 * transaction committed code knows that it does not need to do any further
692 * will still unpin it properly. 692 * processing on the item.
693 */ 693 */
694STATIC xfs_lsn_t 694STATIC xfs_lsn_t
695xfs_inode_item_committed( 695xfs_inode_item_committed(
@@ -699,8 +699,10 @@ xfs_inode_item_committed(
699 struct xfs_inode_log_item *iip = INODE_ITEM(lip); 699 struct xfs_inode_log_item *iip = INODE_ITEM(lip);
700 struct xfs_inode *ip = iip->ili_inode; 700 struct xfs_inode *ip = iip->ili_inode;
701 701
702 if (xfs_iflags_test(ip, XFS_ISTALE)) 702 if (xfs_iflags_test(ip, XFS_ISTALE)) {
703 return lsn - 1; 703 xfs_inode_item_unpin(lip, 0);
704 return -1;
705 }
704 return lsn; 706 return lsn;
705} 707}
706 708
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 7c7bc2b786bd..c83f63b33aae 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -1361,7 +1361,7 @@ xfs_trans_item_committed(
1361 lip->li_flags |= XFS_LI_ABORTED; 1361 lip->li_flags |= XFS_LI_ABORTED;
1362 item_lsn = IOP_COMMITTED(lip, commit_lsn); 1362 item_lsn = IOP_COMMITTED(lip, commit_lsn);
1363 1363
1364 /* If the committed routine returns -1, item has been freed. */ 1364 /* item_lsn of -1 means the item needs no further processing */
1365 if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0) 1365 if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0)
1366 return; 1366 return;
1367 1367
@@ -1474,7 +1474,7 @@ xfs_trans_committed_bulk(
1474 lip->li_flags |= XFS_LI_ABORTED; 1474 lip->li_flags |= XFS_LI_ABORTED;
1475 item_lsn = IOP_COMMITTED(lip, commit_lsn); 1475 item_lsn = IOP_COMMITTED(lip, commit_lsn);
1476 1476
1477 /* item_lsn of -1 means the item was freed */ 1477 /* item_lsn of -1 means the item needs no further processing */
1478 if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0) 1478 if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0)
1479 continue; 1479 continue;
1480 1480
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 246f576c981d..447c36752385 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -117,10 +117,10 @@
117/* drbdsetup XY resize -d Z 117/* drbdsetup XY resize -d Z
118 * you are free to reduce the device size to nothing, if you want to. 118 * you are free to reduce the device size to nothing, if you want to.
119 * the upper limit with 64bit kernel, enough ram and flexible meta data 119 * the upper limit with 64bit kernel, enough ram and flexible meta data
120 * is 16 TB, currently. */ 120 * is 1 PiB, currently. */
121/* DRBD_MAX_SECTORS */ 121/* DRBD_MAX_SECTORS */
122#define DRBD_DISK_SIZE_SECT_MIN 0 122#define DRBD_DISK_SIZE_SECT_MIN 0
123#define DRBD_DISK_SIZE_SECT_MAX (16 * (2LLU << 30)) 123#define DRBD_DISK_SIZE_SECT_MAX (1 * (2LLU << 40))
124#define DRBD_DISK_SIZE_SECT_DEF 0 /* = disabled = no user size... */ 124#define DRBD_DISK_SIZE_SECT_DEF 0 /* = disabled = no user size... */
125 125
126#define DRBD_ON_IO_ERROR_DEF EP_PASS_ON 126#define DRBD_ON_IO_ERROR_DEF EP_PASS_ON
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 7c4d72f5581f..9ec20dec3353 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -204,6 +204,8 @@ extern bool __fscache_check_page_write(struct fscache_cookie *, struct page *);
204extern void __fscache_wait_on_page_write(struct fscache_cookie *, struct page *); 204extern void __fscache_wait_on_page_write(struct fscache_cookie *, struct page *);
205extern bool __fscache_maybe_release_page(struct fscache_cookie *, struct page *, 205extern bool __fscache_maybe_release_page(struct fscache_cookie *, struct page *,
206 gfp_t); 206 gfp_t);
207extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *,
208 struct inode *);
207 209
208/** 210/**
209 * fscache_register_netfs - Register a filesystem as desiring caching services 211 * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -643,4 +645,23 @@ bool fscache_maybe_release_page(struct fscache_cookie *cookie,
643 return false; 645 return false;
644} 646}
645 647
648/**
649 * fscache_uncache_all_inode_pages - Uncache all an inode's pages
650 * @cookie: The cookie representing the inode's cache object.
651 * @inode: The inode to uncache pages from.
652 *
653 * Uncache all the pages in an inode that are marked PG_fscache, assuming them
654 * to be associated with the given cookie.
655 *
656 * This function may sleep. It will wait for pages that are being written out
657 * and will wait whilst the PG_fscache mark is removed by the cache.
658 */
659static inline
660void fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
661 struct inode *inode)
662{
663 if (fscache_cookie_valid(cookie))
664 __fscache_uncache_all_inode_pages(cookie, inode);
665}
666
646#endif /* _LINUX_FSCACHE_H */ 667#endif /* _LINUX_FSCACHE_H */
diff --git a/include/linux/mfd/ds1wm.h b/include/linux/mfd/ds1wm.h
index be469a357cbb..38a372a0e285 100644
--- a/include/linux/mfd/ds1wm.h
+++ b/include/linux/mfd/ds1wm.h
@@ -3,4 +3,11 @@
3struct ds1wm_driver_data { 3struct ds1wm_driver_data {
4 int active_high; 4 int active_high;
5 int clock_rate; 5 int clock_rate;
6 /* in milliseconds, the amount of time to */
7 /* sleep following a reset pulse. Zero */
8 /* should work if your bus devices recover*/
9 /* time respects the 1-wire spec since the*/
10 /* ds1wm implements the precise timings of*/
11 /* a reset pulse/presence detect sequence.*/
12 unsigned int reset_recover_delay;
6}; 13};
diff --git a/include/linux/sched.h b/include/linux/sched.h
index a837b20ba190..496770a96487 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -808,7 +808,7 @@ enum cpu_idle_type {
808 * when BITS_PER_LONG <= 32 are pretty high and the returns do not justify the 808 * when BITS_PER_LONG <= 32 are pretty high and the returns do not justify the
809 * increased costs. 809 * increased costs.
810 */ 810 */
811#if BITS_PER_LONG > 32 811#if 0 /* BITS_PER_LONG > 32 -- currently broken: it increases power usage under light load */
812# define SCHED_LOAD_RESOLUTION 10 812# define SCHED_LOAD_RESOLUTION 10
813# define scale_load(w) ((w) << SCHED_LOAD_RESOLUTION) 813# define scale_load(w) ((w) << SCHED_LOAD_RESOLUTION)
814# define scale_load_down(w) ((w) >> SCHED_LOAD_RESOLUTION) 814# define scale_load_down(w) ((w) >> SCHED_LOAD_RESOLUTION)
diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h
index 630e702c9511..168dd0b1bae2 100644
--- a/include/media/lirc_dev.h
+++ b/include/media/lirc_dev.h
@@ -9,7 +9,7 @@
9#ifndef _LINUX_LIRC_DEV_H 9#ifndef _LINUX_LIRC_DEV_H
10#define _LINUX_LIRC_DEV_H 10#define _LINUX_LIRC_DEV_H
11 11
12#define MAX_IRCTL_DEVICES 4 12#define MAX_IRCTL_DEVICES 8
13#define BUFLEN 16 13#define BUFLEN 16
14 14
15#define mod(n, div) ((n) % (div)) 15#define mod(n, div) ((n) % (div))
diff --git a/include/media/m5mols.h b/include/media/m5mols.h
index 2d7e7ca2313d..aac2c0e06d5e 100644
--- a/include/media/m5mols.h
+++ b/include/media/m5mols.h
@@ -2,10 +2,10 @@
2 * Driver header for M-5MOLS 8M Pixel camera sensor with ISP 2 * Driver header for M-5MOLS 8M Pixel camera sensor with ISP
3 * 3 *
4 * Copyright (C) 2011 Samsung Electronics Co., Ltd. 4 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
5 * Author: HeungJun Kim, riverful.kim@samsung.com 5 * Author: HeungJun Kim <riverful.kim@samsung.com>
6 * 6 *
7 * Copyright (C) 2009 Samsung Electronics Co., Ltd. 7 * Copyright (C) 2009 Samsung Electronics Co., Ltd.
8 * Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com 8 * Author: Dongsoo Nathaniel Kim <dongsoo45.kim@samsung.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 1562c4ff3a65..2884e3e69cb1 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -173,16 +173,20 @@ struct v4l2_subdev_core_ops {
173 struct v4l2_event_subscription *sub); 173 struct v4l2_event_subscription *sub);
174}; 174};
175 175
176/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. 176/* s_radio: v4l device was opened in radio mode.
177 177
178 s_radio: v4l device was opened in Radio mode, to be replaced by s_mode. 178 g_frequency: freq->type must be filled in. Normally done by video_ioctl2
179 or the bridge driver.
180
181 g_tuner:
182 s_tuner: vt->type must be filled in. Normally done by video_ioctl2 or the
183 bridge driver.
179 184
180 s_type_addr: sets tuner type and its I2C addr. 185 s_type_addr: sets tuner type and its I2C addr.
181 186
182 s_config: sets tda9887 specific stuff, like port1, port2 and qss 187 s_config: sets tda9887 specific stuff, like port1, port2 and qss
183 */ 188 */
184struct v4l2_subdev_tuner_ops { 189struct v4l2_subdev_tuner_ops {
185 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
186 int (*s_radio)(struct v4l2_subdev *sd); 190 int (*s_radio)(struct v4l2_subdev *sd);
187 int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); 191 int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
188 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); 192 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0589f554788a..396e8fc8910e 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2688,7 +2688,7 @@ void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
2688 * @dev: network device 2688 * @dev: network device
2689 * @addr: The source MAC address of the frame 2689 * @addr: The source MAC address of the frame
2690 * @key_type: The key type that the received frame used 2690 * @key_type: The key type that the received frame used
2691 * @key_id: Key identifier (0..3) 2691 * @key_id: Key identifier (0..3). Can be -1 if missing.
2692 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 2692 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
2693 * @gfp: allocation flags 2693 * @gfp: allocation flags
2694 * 2694 *
diff --git a/include/net/dst.h b/include/net/dst.h
index 7d15d238b6ec..e12ddfb9eb16 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -77,6 +77,7 @@ struct dst_entry {
77#define DST_NOPOLICY 0x0004 77#define DST_NOPOLICY 0x0004
78#define DST_NOHASH 0x0008 78#define DST_NOHASH 0x0008
79#define DST_NOCACHE 0x0010 79#define DST_NOCACHE 0x0010
80#define DST_NOCOUNT 0x0020
80 union { 81 union {
81 struct dst_entry *next; 82 struct dst_entry *next;
82 struct rtable __rcu *rt_next; 83 struct rtable __rcu *rt_next;
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index fa27e750dbc0..a8ce45097f3d 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -375,15 +375,19 @@ int jump_label_text_reserved(void *start, void *end)
375 375
376static void jump_label_update(struct jump_label_key *key, int enable) 376static void jump_label_update(struct jump_label_key *key, int enable)
377{ 377{
378 struct jump_entry *entry = key->entries; 378 struct jump_entry *entry = key->entries, *stop = __stop___jump_table;
379
380 /* if there are no users, entry can be NULL */
381 if (entry)
382 __jump_label_update(key, entry, __stop___jump_table, enable);
383 379
384#ifdef CONFIG_MODULES 380#ifdef CONFIG_MODULES
381 struct module *mod = __module_address((jump_label_t)key);
382
385 __jump_label_mod_update(key, enable); 383 __jump_label_mod_update(key, enable);
384
385 if (mod)
386 stop = mod->jump_entries + mod->num_jump_entries;
386#endif 387#endif
388 /* if there are no users, entry can be NULL */
389 if (entry)
390 __jump_label_update(key, entry, stop, enable);
387} 391}
388 392
389#endif 393#endif
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index ace55889f702..06efa54f93d6 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1211,7 +1211,11 @@ static void free_unnecessary_pages(void)
1211 to_free_highmem = alloc_highmem - save; 1211 to_free_highmem = alloc_highmem - save;
1212 } else { 1212 } else {
1213 to_free_highmem = 0; 1213 to_free_highmem = 0;
1214 to_free_normal -= save - alloc_highmem; 1214 save -= alloc_highmem;
1215 if (to_free_normal > save)
1216 to_free_normal -= save;
1217 else
1218 to_free_normal = 0;
1215 } 1219 }
1216 1220
1217 memory_bm_position_reset(&copy_bm); 1221 memory_bm_position_reset(&copy_bm);
diff --git a/kernel/resource.c b/kernel/resource.c
index 798e2fae2a06..3ff40178dce7 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -38,6 +38,14 @@ struct resource iomem_resource = {
38}; 38};
39EXPORT_SYMBOL(iomem_resource); 39EXPORT_SYMBOL(iomem_resource);
40 40
41/* constraints to be met while allocating resources */
42struct resource_constraint {
43 resource_size_t min, max, align;
44 resource_size_t (*alignf)(void *, const struct resource *,
45 resource_size_t, resource_size_t);
46 void *alignf_data;
47};
48
41static DEFINE_RWLOCK(resource_lock); 49static DEFINE_RWLOCK(resource_lock);
42 50
43static void *r_next(struct seq_file *m, void *v, loff_t *pos) 51static void *r_next(struct seq_file *m, void *v, loff_t *pos)
@@ -384,16 +392,13 @@ static bool resource_contains(struct resource *res1, struct resource *res2)
384} 392}
385 393
386/* 394/*
387 * Find empty slot in the resource tree given range and alignment. 395 * Find empty slot in the resource tree with the given range and
396 * alignment constraints
388 */ 397 */
389static int find_resource(struct resource *root, struct resource *new, 398static int __find_resource(struct resource *root, struct resource *old,
390 resource_size_t size, resource_size_t min, 399 struct resource *new,
391 resource_size_t max, resource_size_t align, 400 resource_size_t size,
392 resource_size_t (*alignf)(void *, 401 struct resource_constraint *constraint)
393 const struct resource *,
394 resource_size_t,
395 resource_size_t),
396 void *alignf_data)
397{ 402{
398 struct resource *this = root->child; 403 struct resource *this = root->child;
399 struct resource tmp = *new, avail, alloc; 404 struct resource tmp = *new, avail, alloc;
@@ -404,25 +409,26 @@ static int find_resource(struct resource *root, struct resource *new,
404 * Skip past an allocated resource that starts at 0, since the assignment 409 * Skip past an allocated resource that starts at 0, since the assignment
405 * of this->start - 1 to tmp->end below would cause an underflow. 410 * of this->start - 1 to tmp->end below would cause an underflow.
406 */ 411 */
407 if (this && this->start == 0) { 412 if (this && this->start == root->start) {
408 tmp.start = this->end + 1; 413 tmp.start = (this == old) ? old->start : this->end + 1;
409 this = this->sibling; 414 this = this->sibling;
410 } 415 }
411 for(;;) { 416 for(;;) {
412 if (this) 417 if (this)
413 tmp.end = this->start - 1; 418 tmp.end = (this == old) ? this->end : this->start - 1;
414 else 419 else
415 tmp.end = root->end; 420 tmp.end = root->end;
416 421
417 resource_clip(&tmp, min, max); 422 resource_clip(&tmp, constraint->min, constraint->max);
418 arch_remove_reservations(&tmp); 423 arch_remove_reservations(&tmp);
419 424
420 /* Check for overflow after ALIGN() */ 425 /* Check for overflow after ALIGN() */
421 avail = *new; 426 avail = *new;
422 avail.start = ALIGN(tmp.start, align); 427 avail.start = ALIGN(tmp.start, constraint->align);
423 avail.end = tmp.end; 428 avail.end = tmp.end;
424 if (avail.start >= tmp.start) { 429 if (avail.start >= tmp.start) {
425 alloc.start = alignf(alignf_data, &avail, size, align); 430 alloc.start = constraint->alignf(constraint->alignf_data, &avail,
431 size, constraint->align);
426 alloc.end = alloc.start + size - 1; 432 alloc.end = alloc.start + size - 1;
427 if (resource_contains(&avail, &alloc)) { 433 if (resource_contains(&avail, &alloc)) {
428 new->start = alloc.start; 434 new->start = alloc.start;
@@ -432,14 +438,75 @@ static int find_resource(struct resource *root, struct resource *new,
432 } 438 }
433 if (!this) 439 if (!this)
434 break; 440 break;
435 tmp.start = this->end + 1; 441 if (this != old)
442 tmp.start = this->end + 1;
436 this = this->sibling; 443 this = this->sibling;
437 } 444 }
438 return -EBUSY; 445 return -EBUSY;
439} 446}
440 447
448/*
449 * Find empty slot in the resource tree given range and alignment.
450 */
451static int find_resource(struct resource *root, struct resource *new,
452 resource_size_t size,
453 struct resource_constraint *constraint)
454{
455 return __find_resource(root, NULL, new, size, constraint);
456}
457
441/** 458/**
442 * allocate_resource - allocate empty slot in the resource tree given range & alignment 459 * reallocate_resource - allocate a slot in the resource tree given range & alignment.
460 * The resource will be relocated if the new size cannot be reallocated in the
461 * current location.
462 *
463 * @root: root resource descriptor
464 * @old: resource descriptor desired by caller
465 * @newsize: new size of the resource descriptor
466 * @constraint: the size and alignment constraints to be met.
467 */
468int reallocate_resource(struct resource *root, struct resource *old,
469 resource_size_t newsize,
470 struct resource_constraint *constraint)
471{
472 int err=0;
473 struct resource new = *old;
474 struct resource *conflict;
475
476 write_lock(&resource_lock);
477
478 if ((err = __find_resource(root, old, &new, newsize, constraint)))
479 goto out;
480
481 if (resource_contains(&new, old)) {
482 old->start = new.start;
483 old->end = new.end;
484 goto out;
485 }
486
487 if (old->child) {
488 err = -EBUSY;
489 goto out;
490 }
491
492 if (resource_contains(old, &new)) {
493 old->start = new.start;
494 old->end = new.end;
495 } else {
496 __release_resource(old);
497 *old = new;
498 conflict = __request_resource(root, old);
499 BUG_ON(conflict);
500 }
501out:
502 write_unlock(&resource_lock);
503 return err;
504}
505
506
507/**
508 * allocate_resource - allocate empty slot in the resource tree given range & alignment.
509 * The resource will be reallocated with a new size if it was already allocated
443 * @root: root resource descriptor 510 * @root: root resource descriptor
444 * @new: resource descriptor desired by caller 511 * @new: resource descriptor desired by caller
445 * @size: requested resource region size 512 * @size: requested resource region size
@@ -459,12 +526,25 @@ int allocate_resource(struct resource *root, struct resource *new,
459 void *alignf_data) 526 void *alignf_data)
460{ 527{
461 int err; 528 int err;
529 struct resource_constraint constraint;
462 530
463 if (!alignf) 531 if (!alignf)
464 alignf = simple_align_resource; 532 alignf = simple_align_resource;
465 533
534 constraint.min = min;
535 constraint.max = max;
536 constraint.align = align;
537 constraint.alignf = alignf;
538 constraint.alignf_data = alignf_data;
539
540 if ( new->parent ) {
541 /* resource is already allocated, try reallocating with
542 the new constraints */
543 return reallocate_resource(root, new, size, &constraint);
544 }
545
466 write_lock(&resource_lock); 546 write_lock(&resource_lock);
467 err = find_resource(root, new, size, min, max, align, alignf, alignf_data); 547 err = find_resource(root, new, size, &constraint);
468 if (err >= 0 && __request_resource(root, new)) 548 if (err >= 0 && __request_resource(root, new))
469 err = -EBUSY; 549 err = -EBUSY;
470 write_unlock(&resource_lock); 550 write_unlock(&resource_lock);
diff --git a/kernel/sched.c b/kernel/sched.c
index 3f2e502d609b..9769c756ad66 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -292,8 +292,8 @@ static DEFINE_SPINLOCK(task_group_lock);
292 * (The default weight is 1024 - so there's no practical 292 * (The default weight is 1024 - so there's no practical
293 * limitation from this.) 293 * limitation from this.)
294 */ 294 */
295#define MIN_SHARES 2 295#define MIN_SHARES (1UL << 1)
296#define MAX_SHARES (1UL << (18 + SCHED_LOAD_RESOLUTION)) 296#define MAX_SHARES (1UL << 18)
297 297
298static int root_task_group_load = ROOT_TASK_GROUP_LOAD; 298static int root_task_group_load = ROOT_TASK_GROUP_LOAD;
299#endif 299#endif
@@ -8450,10 +8450,7 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares)
8450 if (!tg->se[0]) 8450 if (!tg->se[0])
8451 return -EINVAL; 8451 return -EINVAL;
8452 8452
8453 if (shares < MIN_SHARES) 8453 shares = clamp(shares, scale_load(MIN_SHARES), scale_load(MAX_SHARES));
8454 shares = MIN_SHARES;
8455 else if (shares > MAX_SHARES)
8456 shares = MAX_SHARES;
8457 8454
8458 mutex_lock(&shares_mutex); 8455 mutex_lock(&shares_mutex);
8459 if (tg->shares == shares) 8456 if (tg->shares == shares)
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 9d86e45086f5..a78b7c6e042c 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -198,7 +198,7 @@ static void free_object(struct debug_obj *obj)
198 * initialized: 198 * initialized:
199 */ 199 */
200 if (obj_pool_free > ODEBUG_POOL_SIZE && obj_cache) 200 if (obj_pool_free > ODEBUG_POOL_SIZE && obj_cache)
201 sched = !work_pending(&debug_obj_work); 201 sched = keventd_up() && !work_pending(&debug_obj_work);
202 hlist_add_head(&obj->node, &obj_pool); 202 hlist_add_head(&obj->node, &obj_pool);
203 obj_pool_free++; 203 obj_pool_free++;
204 obj_pool_used--; 204 obj_pool_used--;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ddffc74cdebe..e013b8e57d25 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -108,10 +108,12 @@ enum mem_cgroup_events_index {
108enum mem_cgroup_events_target { 108enum mem_cgroup_events_target {
109 MEM_CGROUP_TARGET_THRESH, 109 MEM_CGROUP_TARGET_THRESH,
110 MEM_CGROUP_TARGET_SOFTLIMIT, 110 MEM_CGROUP_TARGET_SOFTLIMIT,
111 MEM_CGROUP_TARGET_NUMAINFO,
111 MEM_CGROUP_NTARGETS, 112 MEM_CGROUP_NTARGETS,
112}; 113};
113#define THRESHOLDS_EVENTS_TARGET (128) 114#define THRESHOLDS_EVENTS_TARGET (128)
114#define SOFTLIMIT_EVENTS_TARGET (1024) 115#define SOFTLIMIT_EVENTS_TARGET (1024)
116#define NUMAINFO_EVENTS_TARGET (1024)
115 117
116struct mem_cgroup_stat_cpu { 118struct mem_cgroup_stat_cpu {
117 long count[MEM_CGROUP_STAT_NSTATS]; 119 long count[MEM_CGROUP_STAT_NSTATS];
@@ -237,7 +239,8 @@ struct mem_cgroup {
237 int last_scanned_node; 239 int last_scanned_node;
238#if MAX_NUMNODES > 1 240#if MAX_NUMNODES > 1
239 nodemask_t scan_nodes; 241 nodemask_t scan_nodes;
240 unsigned long next_scan_node_update; 242 atomic_t numainfo_events;
243 atomic_t numainfo_updating;
241#endif 244#endif
242 /* 245 /*
243 * Should the accounting and control be hierarchical, per subtree? 246 * Should the accounting and control be hierarchical, per subtree?
@@ -577,15 +580,6 @@ static long mem_cgroup_read_stat(struct mem_cgroup *mem,
577 return val; 580 return val;
578} 581}
579 582
580static long mem_cgroup_local_usage(struct mem_cgroup *mem)
581{
582 long ret;
583
584 ret = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_RSS);
585 ret += mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_CACHE);
586 return ret;
587}
588
589static void mem_cgroup_swap_statistics(struct mem_cgroup *mem, 583static void mem_cgroup_swap_statistics(struct mem_cgroup *mem,
590 bool charge) 584 bool charge)
591{ 585{
@@ -689,6 +683,9 @@ static void __mem_cgroup_target_update(struct mem_cgroup *mem, int target)
689 case MEM_CGROUP_TARGET_SOFTLIMIT: 683 case MEM_CGROUP_TARGET_SOFTLIMIT:
690 next = val + SOFTLIMIT_EVENTS_TARGET; 684 next = val + SOFTLIMIT_EVENTS_TARGET;
691 break; 685 break;
686 case MEM_CGROUP_TARGET_NUMAINFO:
687 next = val + NUMAINFO_EVENTS_TARGET;
688 break;
692 default: 689 default:
693 return; 690 return;
694 } 691 }
@@ -707,11 +704,19 @@ static void memcg_check_events(struct mem_cgroup *mem, struct page *page)
707 mem_cgroup_threshold(mem); 704 mem_cgroup_threshold(mem);
708 __mem_cgroup_target_update(mem, MEM_CGROUP_TARGET_THRESH); 705 __mem_cgroup_target_update(mem, MEM_CGROUP_TARGET_THRESH);
709 if (unlikely(__memcg_event_check(mem, 706 if (unlikely(__memcg_event_check(mem,
710 MEM_CGROUP_TARGET_SOFTLIMIT))){ 707 MEM_CGROUP_TARGET_SOFTLIMIT))) {
711 mem_cgroup_update_tree(mem, page); 708 mem_cgroup_update_tree(mem, page);
712 __mem_cgroup_target_update(mem, 709 __mem_cgroup_target_update(mem,
713 MEM_CGROUP_TARGET_SOFTLIMIT); 710 MEM_CGROUP_TARGET_SOFTLIMIT);
711 }
712#if MAX_NUMNODES > 1
713 if (unlikely(__memcg_event_check(mem,
714 MEM_CGROUP_TARGET_NUMAINFO))) {
715 atomic_inc(&mem->numainfo_events);
716 __mem_cgroup_target_update(mem,
717 MEM_CGROUP_TARGET_NUMAINFO);
714 } 718 }
719#endif
715 } 720 }
716} 721}
717 722
@@ -1129,7 +1134,6 @@ unsigned long mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg,
1129 return MEM_CGROUP_ZSTAT(mz, lru); 1134 return MEM_CGROUP_ZSTAT(mz, lru);
1130} 1135}
1131 1136
1132#ifdef CONFIG_NUMA
1133static unsigned long mem_cgroup_node_nr_file_lru_pages(struct mem_cgroup *memcg, 1137static unsigned long mem_cgroup_node_nr_file_lru_pages(struct mem_cgroup *memcg,
1134 int nid) 1138 int nid)
1135{ 1139{
@@ -1141,6 +1145,17 @@ static unsigned long mem_cgroup_node_nr_file_lru_pages(struct mem_cgroup *memcg,
1141 return ret; 1145 return ret;
1142} 1146}
1143 1147
1148static unsigned long mem_cgroup_node_nr_anon_lru_pages(struct mem_cgroup *memcg,
1149 int nid)
1150{
1151 unsigned long ret;
1152
1153 ret = mem_cgroup_get_zonestat_node(memcg, nid, LRU_INACTIVE_ANON) +
1154 mem_cgroup_get_zonestat_node(memcg, nid, LRU_ACTIVE_ANON);
1155 return ret;
1156}
1157
1158#if MAX_NUMNODES > 1
1144static unsigned long mem_cgroup_nr_file_lru_pages(struct mem_cgroup *memcg) 1159static unsigned long mem_cgroup_nr_file_lru_pages(struct mem_cgroup *memcg)
1145{ 1160{
1146 u64 total = 0; 1161 u64 total = 0;
@@ -1152,17 +1167,6 @@ static unsigned long mem_cgroup_nr_file_lru_pages(struct mem_cgroup *memcg)
1152 return total; 1167 return total;
1153} 1168}
1154 1169
1155static unsigned long mem_cgroup_node_nr_anon_lru_pages(struct mem_cgroup *memcg,
1156 int nid)
1157{
1158 unsigned long ret;
1159
1160 ret = mem_cgroup_get_zonestat_node(memcg, nid, LRU_INACTIVE_ANON) +
1161 mem_cgroup_get_zonestat_node(memcg, nid, LRU_ACTIVE_ANON);
1162
1163 return ret;
1164}
1165
1166static unsigned long mem_cgroup_nr_anon_lru_pages(struct mem_cgroup *memcg) 1170static unsigned long mem_cgroup_nr_anon_lru_pages(struct mem_cgroup *memcg)
1167{ 1171{
1168 u64 total = 0; 1172 u64 total = 0;
@@ -1559,6 +1563,28 @@ mem_cgroup_select_victim(struct mem_cgroup *root_mem)
1559 return ret; 1563 return ret;
1560} 1564}
1561 1565
1566/**
1567 * test_mem_cgroup_node_reclaimable
1568 * @mem: the target memcg
1569 * @nid: the node ID to be checked.
1570 * @noswap : specify true here if the user wants flle only information.
1571 *
1572 * This function returns whether the specified memcg contains any
1573 * reclaimable pages on a node. Returns true if there are any reclaimable
1574 * pages in the node.
1575 */
1576static bool test_mem_cgroup_node_reclaimable(struct mem_cgroup *mem,
1577 int nid, bool noswap)
1578{
1579 if (mem_cgroup_node_nr_file_lru_pages(mem, nid))
1580 return true;
1581 if (noswap || !total_swap_pages)
1582 return false;
1583 if (mem_cgroup_node_nr_anon_lru_pages(mem, nid))
1584 return true;
1585 return false;
1586
1587}
1562#if MAX_NUMNODES > 1 1588#if MAX_NUMNODES > 1
1563 1589
1564/* 1590/*
@@ -1570,26 +1596,26 @@ mem_cgroup_select_victim(struct mem_cgroup *root_mem)
1570static void mem_cgroup_may_update_nodemask(struct mem_cgroup *mem) 1596static void mem_cgroup_may_update_nodemask(struct mem_cgroup *mem)
1571{ 1597{
1572 int nid; 1598 int nid;
1573 1599 /*
1574 if (time_after(mem->next_scan_node_update, jiffies)) 1600 * numainfo_events > 0 means there was at least NUMAINFO_EVENTS_TARGET
1601 * pagein/pageout changes since the last update.
1602 */
1603 if (!atomic_read(&mem->numainfo_events))
1604 return;
1605 if (atomic_inc_return(&mem->numainfo_updating) > 1)
1575 return; 1606 return;
1576 1607
1577 mem->next_scan_node_update = jiffies + 10*HZ;
1578 /* make a nodemask where this memcg uses memory from */ 1608 /* make a nodemask where this memcg uses memory from */
1579 mem->scan_nodes = node_states[N_HIGH_MEMORY]; 1609 mem->scan_nodes = node_states[N_HIGH_MEMORY];
1580 1610
1581 for_each_node_mask(nid, node_states[N_HIGH_MEMORY]) { 1611 for_each_node_mask(nid, node_states[N_HIGH_MEMORY]) {
1582 1612
1583 if (mem_cgroup_get_zonestat_node(mem, nid, LRU_INACTIVE_FILE) || 1613 if (!test_mem_cgroup_node_reclaimable(mem, nid, false))
1584 mem_cgroup_get_zonestat_node(mem, nid, LRU_ACTIVE_FILE)) 1614 node_clear(nid, mem->scan_nodes);
1585 continue;
1586
1587 if (total_swap_pages &&
1588 (mem_cgroup_get_zonestat_node(mem, nid, LRU_INACTIVE_ANON) ||
1589 mem_cgroup_get_zonestat_node(mem, nid, LRU_ACTIVE_ANON)))
1590 continue;
1591 node_clear(nid, mem->scan_nodes);
1592 } 1615 }
1616
1617 atomic_set(&mem->numainfo_events, 0);
1618 atomic_set(&mem->numainfo_updating, 0);
1593} 1619}
1594 1620
1595/* 1621/*
@@ -1627,11 +1653,51 @@ int mem_cgroup_select_victim_node(struct mem_cgroup *mem)
1627 return node; 1653 return node;
1628} 1654}
1629 1655
1656/*
1657 * Check all nodes whether it contains reclaimable pages or not.
1658 * For quick scan, we make use of scan_nodes. This will allow us to skip
1659 * unused nodes. But scan_nodes is lazily updated and may not cotain
1660 * enough new information. We need to do double check.
1661 */
1662bool mem_cgroup_reclaimable(struct mem_cgroup *mem, bool noswap)
1663{
1664 int nid;
1665
1666 /*
1667 * quick check...making use of scan_node.
1668 * We can skip unused nodes.
1669 */
1670 if (!nodes_empty(mem->scan_nodes)) {
1671 for (nid = first_node(mem->scan_nodes);
1672 nid < MAX_NUMNODES;
1673 nid = next_node(nid, mem->scan_nodes)) {
1674
1675 if (test_mem_cgroup_node_reclaimable(mem, nid, noswap))
1676 return true;
1677 }
1678 }
1679 /*
1680 * Check rest of nodes.
1681 */
1682 for_each_node_state(nid, N_HIGH_MEMORY) {
1683 if (node_isset(nid, mem->scan_nodes))
1684 continue;
1685 if (test_mem_cgroup_node_reclaimable(mem, nid, noswap))
1686 return true;
1687 }
1688 return false;
1689}
1690
1630#else 1691#else
1631int mem_cgroup_select_victim_node(struct mem_cgroup *mem) 1692int mem_cgroup_select_victim_node(struct mem_cgroup *mem)
1632{ 1693{
1633 return 0; 1694 return 0;
1634} 1695}
1696
1697bool mem_cgroup_reclaimable(struct mem_cgroup *mem, bool noswap)
1698{
1699 return test_mem_cgroup_node_reclaimable(mem, 0, noswap);
1700}
1635#endif 1701#endif
1636 1702
1637/* 1703/*
@@ -1702,7 +1768,7 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
1702 } 1768 }
1703 } 1769 }
1704 } 1770 }
1705 if (!mem_cgroup_local_usage(victim)) { 1771 if (!mem_cgroup_reclaimable(victim, noswap)) {
1706 /* this cgroup's local usage == 0 */ 1772 /* this cgroup's local usage == 0 */
1707 css_put(&victim->css); 1773 css_put(&victim->css);
1708 continue; 1774 continue;
diff --git a/mm/memory.c b/mm/memory.c
index 40b7531ee8ba..9b8a01d941cb 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -305,6 +305,7 @@ int __tlb_remove_page(struct mmu_gather *tlb, struct page *page)
305 if (batch->nr == batch->max) { 305 if (batch->nr == batch->max) {
306 if (!tlb_next_batch(tlb)) 306 if (!tlb_next_batch(tlb))
307 return 0; 307 return 0;
308 batch = tlb->active;
308 } 309 }
309 VM_BUG_ON(batch->nr > batch->max); 310 VM_BUG_ON(batch->nr > batch->max);
310 311
diff --git a/mm/nommu.c b/mm/nommu.c
index 1fd0c51b10a6..9edc897a3970 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1813,10 +1813,13 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
1813 return NULL; 1813 return NULL;
1814} 1814}
1815 1815
1816int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, 1816int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
1817 unsigned long to, unsigned long size, pgprot_t prot) 1817 unsigned long pfn, unsigned long size, pgprot_t prot)
1818{ 1818{
1819 vma->vm_start = vma->vm_pgoff << PAGE_SHIFT; 1819 if (addr != (pfn << PAGE_SHIFT))
1820 return -EINVAL;
1821
1822 vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
1820 return 0; 1823 return 0;
1821} 1824}
1822EXPORT_SYMBOL(remap_pfn_range); 1825EXPORT_SYMBOL(remap_pfn_range);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4f49535d4cd3..5ed24b94c5e6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2326,7 +2326,7 @@ static bool sleeping_prematurely(pg_data_t *pgdat, int order, long remaining,
2326 return true; 2326 return true;
2327 2327
2328 /* Check the watermark levels */ 2328 /* Check the watermark levels */
2329 for (i = 0; i < pgdat->nr_zones; i++) { 2329 for (i = 0; i <= classzone_idx; i++) {
2330 struct zone *zone = pgdat->node_zones + i; 2330 struct zone *zone = pgdat->node_zones + i;
2331 2331
2332 if (!populated_zone(zone)) 2332 if (!populated_zone(zone))
@@ -2344,7 +2344,7 @@ static bool sleeping_prematurely(pg_data_t *pgdat, int order, long remaining,
2344 } 2344 }
2345 2345
2346 if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone), 2346 if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone),
2347 classzone_idx, 0)) 2347 i, 0))
2348 all_zones_ok = false; 2348 all_zones_ok = false;
2349 else 2349 else
2350 balanced += zone->present_pages; 2350 balanced += zone->present_pages;
@@ -2451,7 +2451,6 @@ loop_again:
2451 if (!zone_watermark_ok_safe(zone, order, 2451 if (!zone_watermark_ok_safe(zone, order,
2452 high_wmark_pages(zone), 0, 0)) { 2452 high_wmark_pages(zone), 0, 0)) {
2453 end_zone = i; 2453 end_zone = i;
2454 *classzone_idx = i;
2455 break; 2454 break;
2456 } 2455 }
2457 } 2456 }
@@ -2510,18 +2509,18 @@ loop_again:
2510 KSWAPD_ZONE_BALANCE_GAP_RATIO); 2509 KSWAPD_ZONE_BALANCE_GAP_RATIO);
2511 if (!zone_watermark_ok_safe(zone, order, 2510 if (!zone_watermark_ok_safe(zone, order,
2512 high_wmark_pages(zone) + balance_gap, 2511 high_wmark_pages(zone) + balance_gap,
2513 end_zone, 0)) 2512 end_zone, 0)) {
2514 shrink_zone(priority, zone, &sc); 2513 shrink_zone(priority, zone, &sc);
2515 reclaim_state->reclaimed_slab = 0;
2516 nr_slab = shrink_slab(&shrink, sc.nr_scanned, lru_pages);
2517 sc.nr_reclaimed += reclaim_state->reclaimed_slab;
2518 total_scanned += sc.nr_scanned;
2519 2514
2520 if (zone->all_unreclaimable) 2515 reclaim_state->reclaimed_slab = 0;
2521 continue; 2516 nr_slab = shrink_slab(&shrink, sc.nr_scanned, lru_pages);
2522 if (nr_slab == 0 && 2517 sc.nr_reclaimed += reclaim_state->reclaimed_slab;
2523 !zone_reclaimable(zone)) 2518 total_scanned += sc.nr_scanned;
2524 zone->all_unreclaimable = 1; 2519
2520 if (nr_slab == 0 && !zone_reclaimable(zone))
2521 zone->all_unreclaimable = 1;
2522 }
2523
2525 /* 2524 /*
2526 * If we've done a decent amount of scanning and 2525 * If we've done a decent amount of scanning and
2527 * the reclaim ratio is low, start doing writepage 2526 * the reclaim ratio is low, start doing writepage
@@ -2531,6 +2530,12 @@ loop_again:
2531 total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2) 2530 total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2)
2532 sc.may_writepage = 1; 2531 sc.may_writepage = 1;
2533 2532
2533 if (zone->all_unreclaimable) {
2534 if (end_zone && end_zone == i)
2535 end_zone--;
2536 continue;
2537 }
2538
2534 if (!zone_watermark_ok_safe(zone, order, 2539 if (!zone_watermark_ok_safe(zone, order,
2535 high_wmark_pages(zone), end_zone, 0)) { 2540 high_wmark_pages(zone), end_zone, 0)) {
2536 all_zones_ok = 0; 2541 all_zones_ok = 0;
@@ -2709,8 +2714,8 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order, int classzone_idx)
2709 */ 2714 */
2710static int kswapd(void *p) 2715static int kswapd(void *p)
2711{ 2716{
2712 unsigned long order; 2717 unsigned long order, new_order;
2713 int classzone_idx; 2718 int classzone_idx, new_classzone_idx;
2714 pg_data_t *pgdat = (pg_data_t*)p; 2719 pg_data_t *pgdat = (pg_data_t*)p;
2715 struct task_struct *tsk = current; 2720 struct task_struct *tsk = current;
2716 2721
@@ -2740,17 +2745,23 @@ static int kswapd(void *p)
2740 tsk->flags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; 2745 tsk->flags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
2741 set_freezable(); 2746 set_freezable();
2742 2747
2743 order = 0; 2748 order = new_order = 0;
2744 classzone_idx = MAX_NR_ZONES - 1; 2749 classzone_idx = new_classzone_idx = pgdat->nr_zones - 1;
2745 for ( ; ; ) { 2750 for ( ; ; ) {
2746 unsigned long new_order;
2747 int new_classzone_idx;
2748 int ret; 2751 int ret;
2749 2752
2750 new_order = pgdat->kswapd_max_order; 2753 /*
2751 new_classzone_idx = pgdat->classzone_idx; 2754 * If the last balance_pgdat was unsuccessful it's unlikely a
2752 pgdat->kswapd_max_order = 0; 2755 * new request of a similar or harder type will succeed soon
2753 pgdat->classzone_idx = MAX_NR_ZONES - 1; 2756 * so consider going to sleep on the basis we reclaimed at
2757 */
2758 if (classzone_idx >= new_classzone_idx && order == new_order) {
2759 new_order = pgdat->kswapd_max_order;
2760 new_classzone_idx = pgdat->classzone_idx;
2761 pgdat->kswapd_max_order = 0;
2762 pgdat->classzone_idx = pgdat->nr_zones - 1;
2763 }
2764
2754 if (order < new_order || classzone_idx > new_classzone_idx) { 2765 if (order < new_order || classzone_idx > new_classzone_idx) {
2755 /* 2766 /*
2756 * Don't sleep if someone wants a larger 'order' 2767 * Don't sleep if someone wants a larger 'order'
@@ -2763,7 +2774,7 @@ static int kswapd(void *p)
2763 order = pgdat->kswapd_max_order; 2774 order = pgdat->kswapd_max_order;
2764 classzone_idx = pgdat->classzone_idx; 2775 classzone_idx = pgdat->classzone_idx;
2765 pgdat->kswapd_max_order = 0; 2776 pgdat->kswapd_max_order = 0;
2766 pgdat->classzone_idx = MAX_NR_ZONES - 1; 2777 pgdat->classzone_idx = pgdat->nr_zones - 1;
2767 } 2778 }
2768 2779
2769 ret = try_to_freeze(); 2780 ret = try_to_freeze();
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 7ea5cf9ea08a..86bff9b1ac47 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -586,9 +586,14 @@ static void vlan_dev_uninit(struct net_device *dev)
586static u32 vlan_dev_fix_features(struct net_device *dev, u32 features) 586static u32 vlan_dev_fix_features(struct net_device *dev, u32 features)
587{ 587{
588 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 588 struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
589 u32 old_features = features;
589 590
590 features &= real_dev->features; 591 features &= real_dev->features;
591 features &= real_dev->vlan_features; 592 features &= real_dev->vlan_features;
593
594 if (old_features & NETIF_F_SOFT_FEATURES)
595 features |= old_features & NETIF_F_SOFT_FEATURES;
596
592 if (dev_ethtool_get_rx_csum(real_dev)) 597 if (dev_ethtool_get_rx_csum(real_dev))
593 features |= NETIF_F_RXCSUM; 598 features |= NETIF_F_RXCSUM;
594 features |= NETIF_F_LLTX; 599 features |= NETIF_F_LLTX;
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index c188c803c09c..32b8f9f7f79e 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -49,7 +49,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
49 skb_pull(skb, ETH_HLEN); 49 skb_pull(skb, ETH_HLEN);
50 50
51 rcu_read_lock(); 51 rcu_read_lock();
52 if (is_multicast_ether_addr(dest)) { 52 if (is_broadcast_ether_addr(dest))
53 br_flood_deliver(br, skb);
54 else if (is_multicast_ether_addr(dest)) {
53 if (unlikely(netpoll_tx_running(dev))) { 55 if (unlikely(netpoll_tx_running(dev))) {
54 br_flood_deliver(br, skb); 56 br_flood_deliver(br, skb);
55 goto out; 57 goto out;
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index f3ac1e858ee1..f06ee39c73fd 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -60,7 +60,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
60 br = p->br; 60 br = p->br;
61 br_fdb_update(br, p, eth_hdr(skb)->h_source); 61 br_fdb_update(br, p, eth_hdr(skb)->h_source);
62 62
63 if (is_multicast_ether_addr(dest) && 63 if (!is_broadcast_ether_addr(dest) && is_multicast_ether_addr(dest) &&
64 br_multicast_rcv(br, p, skb)) 64 br_multicast_rcv(br, p, skb))
65 goto drop; 65 goto drop;
66 66
@@ -77,7 +77,9 @@ int br_handle_frame_finish(struct sk_buff *skb)
77 77
78 dst = NULL; 78 dst = NULL;
79 79
80 if (is_multicast_ether_addr(dest)) { 80 if (is_broadcast_ether_addr(dest))
81 skb2 = skb;
82 else if (is_multicast_ether_addr(dest)) {
81 mdst = br_mdb_get(br, skb); 83 mdst = br_mdb_get(br, skb);
82 if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) { 84 if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) {
83 if ((mdst && mdst->mglist) || 85 if ((mdst && mdst->mglist) ||
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 9cb627a4073a..7330c2757c0c 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -477,8 +477,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
477 calc_layout(osdc, vino, layout, off, plen, req, ops); 477 calc_layout(osdc, vino, layout, off, plen, req, ops);
478 req->r_file_layout = *layout; /* keep a copy */ 478 req->r_file_layout = *layout; /* keep a copy */
479 479
480 /* in case it differs from natural alignment that calc_layout 480 /* in case it differs from natural (file) alignment that
481 filled in for us */ 481 calc_layout filled in for us */
482 req->r_num_pages = calc_pages_for(page_align, *plen);
482 req->r_page_alignment = page_align; 483 req->r_page_alignment = page_align;
483 484
484 ceph_osdc_build_request(req, off, plen, ops, 485 ceph_osdc_build_request(req, off, plen, ops,
@@ -2027,8 +2028,9 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
2027 int want = calc_pages_for(req->r_page_alignment, data_len); 2028 int want = calc_pages_for(req->r_page_alignment, data_len);
2028 2029
2029 if (unlikely(req->r_num_pages < want)) { 2030 if (unlikely(req->r_num_pages < want)) {
2030 pr_warning("tid %lld reply %d > expected %d pages\n", 2031 pr_warning("tid %lld reply has %d bytes %d pages, we"
2031 tid, want, m->nr_pages); 2032 " had only %d pages ready\n", tid, data_len,
2033 want, req->r_num_pages);
2032 *skip = 1; 2034 *skip = 1;
2033 ceph_msg_put(m); 2035 ceph_msg_put(m);
2034 m = NULL; 2036 m = NULL;
diff --git a/net/core/dst.c b/net/core/dst.c
index 9ccca038444f..6135f3671692 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -190,7 +190,8 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
190 dst->lastuse = jiffies; 190 dst->lastuse = jiffies;
191 dst->flags = flags; 191 dst->flags = flags;
192 dst->next = NULL; 192 dst->next = NULL;
193 dst_entries_add(ops, 1); 193 if (!(flags & DST_NOCOUNT))
194 dst_entries_add(ops, 1);
194 return dst; 195 return dst;
195} 196}
196EXPORT_SYMBOL(dst_alloc); 197EXPORT_SYMBOL(dst_alloc);
@@ -243,7 +244,8 @@ again:
243 neigh_release(neigh); 244 neigh_release(neigh);
244 } 245 }
245 246
246 dst_entries_add(dst->ops, -1); 247 if (!(dst->flags & DST_NOCOUNT))
248 dst_entries_add(dst->ops, -1);
247 249
248 if (dst->ops->destroy) 250 if (dst->ops->destroy)
249 dst->ops->destroy(dst); 251 dst->ops->destroy(dst);
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index eae1f676f870..ef1528af7abf 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -465,8 +465,10 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
465 if (addr_len < sizeof(struct sockaddr_in)) 465 if (addr_len < sizeof(struct sockaddr_in))
466 goto out; 466 goto out;
467 467
468 if (addr->sin_family != AF_INET) 468 if (addr->sin_family != AF_INET) {
469 err = -EAFNOSUPPORT;
469 goto out; 470 goto out;
471 }
470 472
471 chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr); 473 chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
472 474
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 4a7e16b5d3f3..84f26e8e6c60 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -828,7 +828,7 @@ static int __ip_append_data(struct sock *sk,
828 cork->length += length; 828 cork->length += length;
829 if (((length > mtu) || (skb && skb_is_gso(skb))) && 829 if (((length > mtu) || (skb && skb_is_gso(skb))) &&
830 (sk->sk_protocol == IPPROTO_UDP) && 830 (sk->sk_protocol == IPPROTO_UDP) &&
831 (rt->dst.dev->features & NETIF_F_UFO)) { 831 (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) {
832 err = ip_ufo_append_data(sk, queue, getfrag, from, length, 832 err = ip_ufo_append_data(sk, queue, getfrag, from, length,
833 hh_len, fragheaderlen, transhdrlen, 833 hh_len, fragheaderlen, transhdrlen,
834 mtu, flags); 834 mtu, flags);
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 054a59d21eb0..46febcacb729 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3220,7 +3220,7 @@ __setup("thash_entries=", set_thash_entries);
3220void __init tcp_init(void) 3220void __init tcp_init(void)
3221{ 3221{
3222 struct sk_buff *skb = NULL; 3222 struct sk_buff *skb = NULL;
3223 unsigned long nr_pages, limit; 3223 unsigned long limit;
3224 int i, max_share, cnt; 3224 int i, max_share, cnt;
3225 unsigned long jiffy = jiffies; 3225 unsigned long jiffy = jiffies;
3226 3226
@@ -3277,13 +3277,7 @@ void __init tcp_init(void)
3277 sysctl_tcp_max_orphans = cnt / 2; 3277 sysctl_tcp_max_orphans = cnt / 2;
3278 sysctl_max_syn_backlog = max(128, cnt / 256); 3278 sysctl_max_syn_backlog = max(128, cnt / 256);
3279 3279
3280 /* Set the pressure threshold to be a fraction of global memory that 3280 limit = nr_free_buffer_pages() / 8;
3281 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
3282 * memory, with a floor of 128 pages.
3283 */
3284 nr_pages = totalram_pages - totalhigh_pages;
3285 limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
3286 limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
3287 limit = max(limit, 128UL); 3281 limit = max(limit, 128UL);
3288 sysctl_tcp_mem[0] = limit / 4 * 3; 3282 sysctl_tcp_mem[0] = limit / 4 * 3;
3289 sysctl_tcp_mem[1] = limit; 3283 sysctl_tcp_mem[1] = limit;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 48cd88e62553..198f75b7bdd3 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2209,16 +2209,10 @@ void __init udp_table_init(struct udp_table *table, const char *name)
2209 2209
2210void __init udp_init(void) 2210void __init udp_init(void)
2211{ 2211{
2212 unsigned long nr_pages, limit; 2212 unsigned long limit;
2213 2213
2214 udp_table_init(&udp_table, "UDP"); 2214 udp_table_init(&udp_table, "UDP");
2215 /* Set the pressure threshold up by the same strategy of TCP. It is a 2215 limit = nr_free_buffer_pages() / 8;
2216 * fraction of global memory that is up to 1/2 at 256 MB, decreasing
2217 * toward zero with the amount of memory, with a floor of 128 pages.
2218 */
2219 nr_pages = totalram_pages - totalhigh_pages;
2220 limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
2221 limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
2222 limit = max(limit, 128UL); 2216 limit = max(limit, 128UL);
2223 sysctl_udp_mem[0] = limit / 4 * 3; 2217 sysctl_udp_mem[0] = limit / 4 * 3;
2224 sysctl_udp_mem[1] = limit; 2218 sysctl_udp_mem[1] = limit;
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
index 2d51840e53a1..327a617d594c 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -32,7 +32,12 @@ static int xfrm4_tunnel_check_size(struct sk_buff *skb)
32 dst = skb_dst(skb); 32 dst = skb_dst(skb);
33 mtu = dst_mtu(dst); 33 mtu = dst_mtu(dst);
34 if (skb->len > mtu) { 34 if (skb->len > mtu) {
35 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); 35 if (skb->sk)
36 ip_local_error(skb->sk, EMSGSIZE, ip_hdr(skb)->daddr,
37 inet_sk(skb->sk)->inet_dport, mtu);
38 else
39 icmp_send(skb, ICMP_DEST_UNREACH,
40 ICMP_FRAG_NEEDED, htonl(mtu));
36 ret = -EMSGSIZE; 41 ret = -EMSGSIZE;
37 } 42 }
38out: 43out:
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index d450a2f9fc06..3b5669a2582d 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -274,7 +274,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
274 return -EINVAL; 274 return -EINVAL;
275 275
276 if (addr->sin6_family != AF_INET6) 276 if (addr->sin6_family != AF_INET6)
277 return -EINVAL; 277 return -EAFNOSUPPORT;
278 278
279 addr_type = ipv6_addr_type(&addr->sin6_addr); 279 addr_type = ipv6_addr_type(&addr->sin6_addr);
280 if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM) 280 if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index de2b1decd786..0ef1f086feb8 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -228,9 +228,10 @@ static struct rt6_info ip6_blk_hole_entry_template = {
228 228
229/* allocate dst with ip6_dst_ops */ 229/* allocate dst with ip6_dst_ops */
230static inline struct rt6_info *ip6_dst_alloc(struct dst_ops *ops, 230static inline struct rt6_info *ip6_dst_alloc(struct dst_ops *ops,
231 struct net_device *dev) 231 struct net_device *dev,
232 int flags)
232{ 233{
233 struct rt6_info *rt = dst_alloc(ops, dev, 0, 0, 0); 234 struct rt6_info *rt = dst_alloc(ops, dev, 0, 0, flags);
234 235
235 memset(&rt->rt6i_table, 0, sizeof(*rt) - sizeof(struct dst_entry)); 236 memset(&rt->rt6i_table, 0, sizeof(*rt) - sizeof(struct dst_entry));
236 237
@@ -1042,7 +1043,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
1042 if (unlikely(idev == NULL)) 1043 if (unlikely(idev == NULL))
1043 return NULL; 1044 return NULL;
1044 1045
1045 rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, dev); 1046 rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, dev, 0);
1046 if (unlikely(rt == NULL)) { 1047 if (unlikely(rt == NULL)) {
1047 in6_dev_put(idev); 1048 in6_dev_put(idev);
1048 goto out; 1049 goto out;
@@ -1062,14 +1063,6 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
1062 dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255); 1063 dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255);
1063 rt->dst.output = ip6_output; 1064 rt->dst.output = ip6_output;
1064 1065
1065#if 0 /* there's no chance to use these for ndisc */
1066 rt->dst.flags = ipv6_addr_type(addr) & IPV6_ADDR_UNICAST
1067 ? DST_HOST
1068 : 0;
1069 ipv6_addr_copy(&rt->rt6i_dst.addr, addr);
1070 rt->rt6i_dst.plen = 128;
1071#endif
1072
1073 spin_lock_bh(&icmp6_dst_lock); 1066 spin_lock_bh(&icmp6_dst_lock);
1074 rt->dst.next = icmp6_dst_gc_list; 1067 rt->dst.next = icmp6_dst_gc_list;
1075 icmp6_dst_gc_list = &rt->dst; 1068 icmp6_dst_gc_list = &rt->dst;
@@ -1214,7 +1207,7 @@ int ip6_route_add(struct fib6_config *cfg)
1214 goto out; 1207 goto out;
1215 } 1208 }
1216 1209
1217 rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, NULL); 1210 rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, NULL, DST_NOCOUNT);
1218 1211
1219 if (rt == NULL) { 1212 if (rt == NULL) {
1220 err = -ENOMEM; 1213 err = -ENOMEM;
@@ -1244,7 +1237,7 @@ int ip6_route_add(struct fib6_config *cfg)
1244 ipv6_addr_prefix(&rt->rt6i_dst.addr, &cfg->fc_dst, cfg->fc_dst_len); 1237 ipv6_addr_prefix(&rt->rt6i_dst.addr, &cfg->fc_dst, cfg->fc_dst_len);
1245 rt->rt6i_dst.plen = cfg->fc_dst_len; 1238 rt->rt6i_dst.plen = cfg->fc_dst_len;
1246 if (rt->rt6i_dst.plen == 128) 1239 if (rt->rt6i_dst.plen == 128)
1247 rt->dst.flags = DST_HOST; 1240 rt->dst.flags |= DST_HOST;
1248 1241
1249#ifdef CONFIG_IPV6_SUBTREES 1242#ifdef CONFIG_IPV6_SUBTREES
1250 ipv6_addr_prefix(&rt->rt6i_src.addr, &cfg->fc_src, cfg->fc_src_len); 1243 ipv6_addr_prefix(&rt->rt6i_src.addr, &cfg->fc_src, cfg->fc_src_len);
@@ -1734,7 +1727,7 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort)
1734{ 1727{
1735 struct net *net = dev_net(ort->rt6i_dev); 1728 struct net *net = dev_net(ort->rt6i_dev);
1736 struct rt6_info *rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, 1729 struct rt6_info *rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops,
1737 ort->dst.dev); 1730 ort->dst.dev, 0);
1738 1731
1739 if (rt) { 1732 if (rt) {
1740 rt->dst.input = ort->dst.input; 1733 rt->dst.input = ort->dst.input;
@@ -2013,7 +2006,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
2013{ 2006{
2014 struct net *net = dev_net(idev->dev); 2007 struct net *net = dev_net(idev->dev);
2015 struct rt6_info *rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, 2008 struct rt6_info *rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops,
2016 net->loopback_dev); 2009 net->loopback_dev, 0);
2017 struct neighbour *neigh; 2010 struct neighbour *neigh;
2018 2011
2019 if (rt == NULL) { 2012 if (rt == NULL) {
@@ -2025,7 +2018,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
2025 2018
2026 in6_dev_hold(idev); 2019 in6_dev_hold(idev);
2027 2020
2028 rt->dst.flags = DST_HOST; 2021 rt->dst.flags |= DST_HOST;
2029 rt->dst.input = ip6_input; 2022 rt->dst.input = ip6_input;
2030 rt->dst.output = ip6_output; 2023 rt->dst.output = ip6_output;
2031 rt->rt6i_idev = idev; 2024 rt->rt6i_idev = idev;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 9dc3b5f26e80..d91c1a26630d 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -154,7 +154,13 @@ update_iv:
154 return RX_CONTINUE; 154 return RX_CONTINUE;
155 155
156mic_fail: 156mic_fail:
157 mac80211_ev_michael_mic_failure(rx->sdata, rx->key->conf.keyidx, 157 /*
158 * In some cases the key can be unset - e.g. a multicast packet, in
159 * a driver that supports HW encryption. Send up the key idx only if
160 * the key is set.
161 */
162 mac80211_ev_michael_mic_failure(rx->sdata,
163 rx->key ? rx->key->conf.keyidx : -1,
158 (void *) skb->data, NULL, GFP_ATOMIC); 164 (void *) skb->data, NULL, GFP_ATOMIC);
159 return RX_DROP_UNUSABLE; 165 return RX_DROP_UNUSABLE;
160} 166}
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 67380a29e2e9..207175b2f40a 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1058,7 +1058,6 @@ SCTP_STATIC __init int sctp_init(void)
1058 int status = -EINVAL; 1058 int status = -EINVAL;
1059 unsigned long goal; 1059 unsigned long goal;
1060 unsigned long limit; 1060 unsigned long limit;
1061 unsigned long nr_pages;
1062 int max_share; 1061 int max_share;
1063 int order; 1062 int order;
1064 1063
@@ -1148,15 +1147,7 @@ SCTP_STATIC __init int sctp_init(void)
1148 /* Initialize handle used for association ids. */ 1147 /* Initialize handle used for association ids. */
1149 idr_init(&sctp_assocs_id); 1148 idr_init(&sctp_assocs_id);
1150 1149
1151 /* Set the pressure threshold to be a fraction of global memory that 1150 limit = nr_free_buffer_pages() / 8;
1152 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
1153 * memory, with a floor of 128 pages.
1154 * Note this initializes the data in sctpv6_prot too
1155 * Unabashedly stolen from tcp_init
1156 */
1157 nr_pages = totalram_pages - totalhigh_pages;
1158 limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
1159 limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
1160 limit = max(limit, 128UL); 1151 limit = max(limit, 128UL);
1161 sysctl_sctp_mem[0] = limit / 4 * 3; 1152 sysctl_sctp_mem[0] = limit / 4 * 3;
1162 sysctl_sctp_mem[1] = limit; 1153 sysctl_sctp_mem[1] = limit;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6766913a53e6..08c6238802de 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2073,10 +2073,33 @@ static int sctp_setsockopt_disable_fragments(struct sock *sk,
2073static int sctp_setsockopt_events(struct sock *sk, char __user *optval, 2073static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
2074 unsigned int optlen) 2074 unsigned int optlen)
2075{ 2075{
2076 struct sctp_association *asoc;
2077 struct sctp_ulpevent *event;
2078
2076 if (optlen > sizeof(struct sctp_event_subscribe)) 2079 if (optlen > sizeof(struct sctp_event_subscribe))
2077 return -EINVAL; 2080 return -EINVAL;
2078 if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen)) 2081 if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen))
2079 return -EFAULT; 2082 return -EFAULT;
2083
2084 /*
2085 * At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT,
2086 * if there is no data to be sent or retransmit, the stack will
2087 * immediately send up this notification.
2088 */
2089 if (sctp_ulpevent_type_enabled(SCTP_SENDER_DRY_EVENT,
2090 &sctp_sk(sk)->subscribe)) {
2091 asoc = sctp_id2assoc(sk, 0);
2092
2093 if (asoc && sctp_outq_is_empty(&asoc->outqueue)) {
2094 event = sctp_ulpevent_make_sender_dry_event(asoc,
2095 GFP_ATOMIC);
2096 if (!event)
2097 return -ENOMEM;
2098
2099 sctp_ulpq_tail_event(&asoc->ulpq, event);
2100 }
2101 }
2102
2080 return 0; 2103 return 0;
2081} 2104}
2082 2105
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 98fa8eb6cc4b..f07602d7bf68 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6463,7 +6463,8 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
6463 if (addr) 6463 if (addr)
6464 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); 6464 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
6465 NLA_PUT_U32(msg, NL80211_ATTR_KEY_TYPE, key_type); 6465 NLA_PUT_U32(msg, NL80211_ATTR_KEY_TYPE, key_type);
6466 NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_id); 6466 if (key_id != -1)
6467 NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_id);
6467 if (tsc) 6468 if (tsc)
6468 NLA_PUT(msg, NL80211_ATTR_KEY_SEQ, 6, tsc); 6469 NLA_PUT(msg, NL80211_ATTR_KEY_SEQ, 6, tsc);
6469 6470
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 9bec2e8a838c..5ce74a385525 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -50,7 +50,7 @@ static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family);
50static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo); 50static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo);
51static void xfrm_init_pmtu(struct dst_entry *dst); 51static void xfrm_init_pmtu(struct dst_entry *dst);
52static int stale_bundle(struct dst_entry *dst); 52static int stale_bundle(struct dst_entry *dst);
53static int xfrm_bundle_ok(struct xfrm_dst *xdst, int family); 53static int xfrm_bundle_ok(struct xfrm_dst *xdst);
54 54
55 55
56static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol, 56static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
@@ -2241,7 +2241,7 @@ static struct dst_entry *xfrm_dst_check(struct dst_entry *dst, u32 cookie)
2241 2241
2242static int stale_bundle(struct dst_entry *dst) 2242static int stale_bundle(struct dst_entry *dst)
2243{ 2243{
2244 return !xfrm_bundle_ok((struct xfrm_dst *)dst, AF_UNSPEC); 2244 return !xfrm_bundle_ok((struct xfrm_dst *)dst);
2245} 2245}
2246 2246
2247void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev) 2247void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev)
@@ -2313,7 +2313,7 @@ static void xfrm_init_pmtu(struct dst_entry *dst)
2313 * still valid. 2313 * still valid.
2314 */ 2314 */
2315 2315
2316static int xfrm_bundle_ok(struct xfrm_dst *first, int family) 2316static int xfrm_bundle_ok(struct xfrm_dst *first)
2317{ 2317{
2318 struct dst_entry *dst = &first->u.dst; 2318 struct dst_entry *dst = &first->u.dst;
2319 struct xfrm_dst *last; 2319 struct xfrm_dst *last;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d21191dcfe88..b48fb43b5448 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2715,17 +2715,30 @@ typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2715 2715
2716static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, 2716static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2717 struct snd_ctl_elem_value *ucontrol, 2717 struct snd_ctl_elem_value *ucontrol,
2718 getput_call_t func) 2718 getput_call_t func, bool check_adc_switch)
2719{ 2719{
2720 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2720 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2721 struct alc_spec *spec = codec->spec; 2721 struct alc_spec *spec = codec->spec;
2722 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 2722 int i, err = 0;
2723 int err;
2724 2723
2725 mutex_lock(&codec->control_mutex); 2724 mutex_lock(&codec->control_mutex);
2726 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], 2725 if (check_adc_switch && spec->dual_adc_switch) {
2727 3, 0, HDA_INPUT); 2726 for (i = 0; i < spec->num_adc_nids; i++) {
2728 err = func(kcontrol, ucontrol); 2727 kcontrol->private_value =
2728 HDA_COMPOSE_AMP_VAL(spec->adc_nids[i],
2729 3, 0, HDA_INPUT);
2730 err = func(kcontrol, ucontrol);
2731 if (err < 0)
2732 goto error;
2733 }
2734 } else {
2735 i = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2736 kcontrol->private_value =
2737 HDA_COMPOSE_AMP_VAL(spec->adc_nids[i],
2738 3, 0, HDA_INPUT);
2739 err = func(kcontrol, ucontrol);
2740 }
2741 error:
2729 mutex_unlock(&codec->control_mutex); 2742 mutex_unlock(&codec->control_mutex);
2730 return err; 2743 return err;
2731} 2744}
@@ -2734,14 +2747,14 @@ static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2734 struct snd_ctl_elem_value *ucontrol) 2747 struct snd_ctl_elem_value *ucontrol)
2735{ 2748{
2736 return alc_cap_getput_caller(kcontrol, ucontrol, 2749 return alc_cap_getput_caller(kcontrol, ucontrol,
2737 snd_hda_mixer_amp_volume_get); 2750 snd_hda_mixer_amp_volume_get, false);
2738} 2751}
2739 2752
2740static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, 2753static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2741 struct snd_ctl_elem_value *ucontrol) 2754 struct snd_ctl_elem_value *ucontrol)
2742{ 2755{
2743 return alc_cap_getput_caller(kcontrol, ucontrol, 2756 return alc_cap_getput_caller(kcontrol, ucontrol,
2744 snd_hda_mixer_amp_volume_put); 2757 snd_hda_mixer_amp_volume_put, true);
2745} 2758}
2746 2759
2747/* capture mixer elements */ 2760/* capture mixer elements */
@@ -2751,14 +2764,14 @@ static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2751 struct snd_ctl_elem_value *ucontrol) 2764 struct snd_ctl_elem_value *ucontrol)
2752{ 2765{
2753 return alc_cap_getput_caller(kcontrol, ucontrol, 2766 return alc_cap_getput_caller(kcontrol, ucontrol,
2754 snd_hda_mixer_amp_switch_get); 2767 snd_hda_mixer_amp_switch_get, false);
2755} 2768}
2756 2769
2757static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, 2770static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2758 struct snd_ctl_elem_value *ucontrol) 2771 struct snd_ctl_elem_value *ucontrol)
2759{ 2772{
2760 return alc_cap_getput_caller(kcontrol, ucontrol, 2773 return alc_cap_getput_caller(kcontrol, ucontrol,
2761 snd_hda_mixer_amp_switch_put); 2774 snd_hda_mixer_amp_switch_put, true);
2762} 2775}
2763 2776
2764#define _DEFINE_CAPMIX(num) \ 2777#define _DEFINE_CAPMIX(num) \
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c
index b5101efd1c87..f1fd95bb6416 100644
--- a/sound/soc/blackfin/bf5xx-i2s-pcm.c
+++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c
@@ -138,11 +138,20 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream)
138 pr_debug("%s enter\n", __func__); 138 pr_debug("%s enter\n", __func__);
139 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 139 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
140 diff = sport_curr_offset_tx(sport); 140 diff = sport_curr_offset_tx(sport);
141 frames = bytes_to_frames(substream->runtime, diff);
142 } else { 141 } else {
143 diff = sport_curr_offset_rx(sport); 142 diff = sport_curr_offset_rx(sport);
144 frames = bytes_to_frames(substream->runtime, diff);
145 } 143 }
144
145 /*
146 * TX at least can report one frame beyond the end of the
147 * buffer if we hit the wraparound case - clamp to within the
148 * buffer as the ALSA APIs require.
149 */
150 if (diff == snd_pcm_lib_buffer_bytes(substream))
151 diff = 0;
152
153 frames = bytes_to_frames(substream->runtime, diff);
154
146 return frames; 155 return frames;
147} 156}
148 157
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index 4be0570e3f1f..65f46047b1cb 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -357,7 +357,7 @@ static int ak4642_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
357 default: 357 default:
358 return -EINVAL; 358 return -EINVAL;
359 } 359 }
360 snd_soc_update_bits(codec, PW_MGMT2, MS, data); 360 snd_soc_update_bits(codec, PW_MGMT2, MS | MCKO | PMPLL, data);
361 snd_soc_update_bits(codec, MD_CTL1, BCKO_MASK, bcko); 361 snd_soc_update_bits(codec, MD_CTL1, BCKO_MASK, bcko);
362 362
363 /* format type */ 363 /* format type */
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
index e2a7608d3944..7859bdcc93db 100644
--- a/sound/soc/codecs/tlv320aic26.c
+++ b/sound/soc/codecs/tlv320aic26.c
@@ -161,10 +161,18 @@ static int aic26_hw_params(struct snd_pcm_substream *substream,
161 dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL; 161 dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL;
162 } 162 }
163 163
164 /* Configure PLL */ 164 /**
165 * Configure PLL
166 * fsref = (mclk * PLLM) / 2048
167 * where PLLM = J.DDDD (DDDD register ranges from 0 to 9999, decimal)
168 */
165 pval = 1; 169 pval = 1;
166 jval = (fsref == 44100) ? 7 : 8; 170 /* compute J portion of multiplier */
167 dval = (fsref == 44100) ? 5264 : 1920; 171 jval = fsref / (aic26->mclk / 2048);
172 /* compute fractional DDDD component of multiplier */
173 dval = fsref - (jval * (aic26->mclk / 2048));
174 dval = (10000 * dval) / (aic26->mclk / 2048);
175 dev_dbg(&aic26->spi->dev, "Setting PLLM to %d.%04d\n", jval, dval);
168 qval = 0; 176 qval = 0;
169 reg = 0x8000 | qval << 11 | pval << 8 | jval << 2; 177 reg = 0x8000 | qval << 11 | pval << 8 | jval << 2;
170 aic26_reg_write(codec, AIC26_REG_PLL_PROG1, reg); 178 aic26_reg_write(codec, AIC26_REG_PLL_PROG1, reg);
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index c3d96fc8c267..789453d44ec5 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1114,12 +1114,19 @@ static int aic3x_set_power(struct snd_soc_codec *codec, int power)
1114 1114
1115 /* Sync reg_cache with the hardware */ 1115 /* Sync reg_cache with the hardware */
1116 codec->cache_only = 0; 1116 codec->cache_only = 0;
1117 for (i = 0; i < ARRAY_SIZE(aic3x_reg); i++) 1117 for (i = AIC3X_SAMPLE_RATE_SEL_REG; i < ARRAY_SIZE(aic3x_reg); i++)
1118 snd_soc_write(codec, i, cache[i]); 1118 snd_soc_write(codec, i, cache[i]);
1119 if (aic3x->model == AIC3X_MODEL_3007) 1119 if (aic3x->model == AIC3X_MODEL_3007)
1120 aic3x_init_3007(codec); 1120 aic3x_init_3007(codec);
1121 codec->cache_sync = 0; 1121 codec->cache_sync = 0;
1122 } else { 1122 } else {
1123 /*
1124 * Do soft reset to this codec instance in order to clear
1125 * possible VDD leakage currents in case the supply regulators
1126 * remain on
1127 */
1128 snd_soc_write(codec, AIC3X_RESET, SOFT_RESET);
1129 codec->cache_sync = 1;
1123 aic3x->power = 0; 1130 aic3x->power = 0;
1124 /* HW writes are needless when bias is off */ 1131 /* HW writes are needless when bias is off */
1125 codec->cache_only = 1; 1132 codec->cache_only = 1;
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 2dc964b55e4f..76b4361e9b80 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -175,6 +175,7 @@ static const struct snd_kcontrol_new wm8731_input_mux_controls =
175SOC_DAPM_ENUM("Input Select", wm8731_insel_enum); 175SOC_DAPM_ENUM("Input Select", wm8731_insel_enum);
176 176
177static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { 177static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = {
178SND_SOC_DAPM_SUPPLY("ACTIVE",WM8731_ACTIVE, 0, 0, NULL, 0),
178SND_SOC_DAPM_SUPPLY("OSC", WM8731_PWR, 5, 1, NULL, 0), 179SND_SOC_DAPM_SUPPLY("OSC", WM8731_PWR, 5, 1, NULL, 0),
179SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PWR, 4, 1, 180SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PWR, 4, 1,
180 &wm8731_output_mixer_controls[0], 181 &wm8731_output_mixer_controls[0],
@@ -204,6 +205,8 @@ static int wm8731_check_osc(struct snd_soc_dapm_widget *source,
204static const struct snd_soc_dapm_route wm8731_intercon[] = { 205static const struct snd_soc_dapm_route wm8731_intercon[] = {
205 {"DAC", NULL, "OSC", wm8731_check_osc}, 206 {"DAC", NULL, "OSC", wm8731_check_osc},
206 {"ADC", NULL, "OSC", wm8731_check_osc}, 207 {"ADC", NULL, "OSC", wm8731_check_osc},
208 {"DAC", NULL, "ACTIVE"},
209 {"ADC", NULL, "ACTIVE"},
207 210
208 /* output mixer */ 211 /* output mixer */
209 {"Output Mixer", "Line Bypass Switch", "Line Input"}, 212 {"Output Mixer", "Line Bypass Switch", "Line Input"},
@@ -315,29 +318,6 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream,
315 return 0; 318 return 0;
316} 319}
317 320
318static int wm8731_pcm_prepare(struct snd_pcm_substream *substream,
319 struct snd_soc_dai *dai)
320{
321 struct snd_soc_codec *codec = dai->codec;
322
323 /* set active */
324 snd_soc_write(codec, WM8731_ACTIVE, 0x0001);
325
326 return 0;
327}
328
329static void wm8731_shutdown(struct snd_pcm_substream *substream,
330 struct snd_soc_dai *dai)
331{
332 struct snd_soc_codec *codec = dai->codec;
333
334 /* deactivate */
335 if (!codec->active) {
336 udelay(50);
337 snd_soc_write(codec, WM8731_ACTIVE, 0x0);
338 }
339}
340
341static int wm8731_mute(struct snd_soc_dai *dai, int mute) 321static int wm8731_mute(struct snd_soc_dai *dai, int mute)
342{ 322{
343 struct snd_soc_codec *codec = dai->codec; 323 struct snd_soc_codec *codec = dai->codec;
@@ -480,7 +460,6 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
480 snd_soc_write(codec, WM8731_PWR, reg | 0x0040); 460 snd_soc_write(codec, WM8731_PWR, reg | 0x0040);
481 break; 461 break;
482 case SND_SOC_BIAS_OFF: 462 case SND_SOC_BIAS_OFF:
483 snd_soc_write(codec, WM8731_ACTIVE, 0x0);
484 snd_soc_write(codec, WM8731_PWR, 0xffff); 463 snd_soc_write(codec, WM8731_PWR, 0xffff);
485 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), 464 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies),
486 wm8731->supplies); 465 wm8731->supplies);
@@ -496,9 +475,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
496 SNDRV_PCM_FMTBIT_S24_LE) 475 SNDRV_PCM_FMTBIT_S24_LE)
497 476
498static struct snd_soc_dai_ops wm8731_dai_ops = { 477static struct snd_soc_dai_ops wm8731_dai_ops = {
499 .prepare = wm8731_pcm_prepare,
500 .hw_params = wm8731_hw_params, 478 .hw_params = wm8731_hw_params,
501 .shutdown = wm8731_shutdown,
502 .digital_mute = wm8731_mute, 479 .digital_mute = wm8731_mute,
503 .set_sysclk = wm8731_set_dai_sysclk, 480 .set_sysclk = wm8731_set_dai_sysclk,
504 .set_fmt = wm8731_set_dai_fmt, 481 .set_fmt = wm8731_set_dai_fmt,
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 970a95c5360b..c2fc0356c2a4 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -1713,6 +1713,8 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src,
1713 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_1 + reg_offset, 1713 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_1 + reg_offset,
1714 WM8994_FLL1_ENA | WM8994_FLL1_FRAC, 1714 WM8994_FLL1_ENA | WM8994_FLL1_FRAC,
1715 reg); 1715 reg);
1716
1717 msleep(5);
1716 } 1718 }
1717 1719
1718 wm8994->fll[id].in = freq_in; 1720 wm8994->fll[id].in = freq_in;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d75043ed7fc0..b194be09e74d 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1929,8 +1929,9 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
1929 "%s", card->name); 1929 "%s", card->name);
1930 snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), 1930 snprintf(card->snd_card->longname, sizeof(card->snd_card->longname),
1931 "%s", card->long_name ? card->long_name : card->name); 1931 "%s", card->long_name ? card->long_name : card->name);
1932 snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), 1932 if (card->driver_name)
1933 "%s", card->driver_name ? card->driver_name : card->name); 1933 strlcpy(card->snd_card->driver, card->driver_name,
1934 sizeof(card->snd_card->driver));
1934 1935
1935 if (card->late_probe) { 1936 if (card->late_probe) {
1936 ret = card->late_probe(card); 1937 ret = card->late_probe(card);
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c
index 6b817e20548c..95f03c10b4f7 100644
--- a/sound/soc/tegra/tegra_i2s.c
+++ b/sound/soc/tegra/tegra_i2s.c
@@ -222,12 +222,18 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream,
222 if (i2sclock % (2 * srate)) 222 if (i2sclock % (2 * srate))
223 reg |= TEGRA_I2S_TIMING_NON_SYM_ENABLE; 223 reg |= TEGRA_I2S_TIMING_NON_SYM_ENABLE;
224 224
225 if (!i2s->clk_refs)
226 clk_enable(i2s->clk_i2s);
227
225 tegra_i2s_write(i2s, TEGRA_I2S_TIMING, reg); 228 tegra_i2s_write(i2s, TEGRA_I2S_TIMING, reg);
226 229
227 tegra_i2s_write(i2s, TEGRA_I2S_FIFO_SCR, 230 tegra_i2s_write(i2s, TEGRA_I2S_FIFO_SCR,
228 TEGRA_I2S_FIFO_SCR_FIFO2_ATN_LVL_FOUR_SLOTS | 231 TEGRA_I2S_FIFO_SCR_FIFO2_ATN_LVL_FOUR_SLOTS |
229 TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_FOUR_SLOTS); 232 TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_FOUR_SLOTS);
230 233
234 if (!i2s->clk_refs)
235 clk_disable(i2s->clk_i2s);
236
231 return 0; 237 return 0;
232} 238}
233 239