aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-03-13 19:08:06 -0400
committerOlof Johansson <olof@lixom.net>2012-03-13 19:08:06 -0400
commite3643b77de143c5548ec93abd8aa68f4123295ea (patch)
tree41981957bc93e8211fe55cd04b7cac47e74bc770
parent86ca5b6fef2bf1aa77a62f29d844400e4fed8dde (diff)
parent44b2cef5ae6da48523fa634230ca66107110a7dd (diff)
Merge branch 'next/cleanup-exynos-clock' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into next/cleanup
* 'next/cleanup-exynos-clock' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung: ARM: EXYNOS: Add clock register addresses for EXYNOS4X12 bus devfreq driver ARM: EXYNOS: add clock registers for exynos4x12-cpufreq PM / devfreq: update the name of EXYNOS clock registers that were omitted PM / devfreq: update the name of EXYNOS clock register ARM: EXYNOS: change the prefix S5P_ to EXYNOS4_ for clock ARM: EXYNOS: use static declaration on regarding clock ARM: EXYNOS: replace clock.c for other new EXYNOS SoCs (includes an update to v3.3-rc6)
-rw-r--r--MAINTAINERS6
-rw-r--r--Makefile2
-rw-r--r--arch/arm/mach-exynos/Makefile3
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.c1563
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.h30
-rw-r--r--arch/arm/mach-exynos/clock-exynos4210.c46
-rw-r--r--arch/arm/mach-exynos/clock-exynos4212.c30
-rw-r--r--arch/arm/mach-exynos/clock.c1564
-rw-r--r--arch/arm/mach-exynos/common.h9
-rw-r--r--arch/arm/mach-exynos/include/mach/exynos4-clock.h43
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-clock.h416
-rw-r--r--arch/arm/mach-exynos/pm.c40
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-lpc32xx/irq.c25
-rw-r--r--arch/arm/mach-lpc32xx/serial.c20
-rw-r--r--arch/arm/mach-mmp/aspenite.c1
-rw-r--r--arch/arm/mach-mmp/pxa168.c1
-rw-r--r--arch/arm/mach-mmp/tavorevb.c1
-rw-r--r--arch/arm/mach-omap1/board-innovator.c4
-rw-r--r--arch/arm/mach-omap2/Kconfig4
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c2
-rw-r--r--arch/arm/mach-omap2/common.h1
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c5
-rw-r--r--arch/arm/mach-omap2/gpmc-smsc911x.c52
-rw-r--r--arch/arm/mach-omap2/io.c1
-rw-r--r--arch/arm/mach-omap2/mailbox.c13
-rw-r--r--arch/arm/mach-omap2/omap4-common.c25
-rw-r--r--arch/arm/mach-omap2/pm.c3
-rw-r--r--arch/arm/mach-omap2/usb-host.c6
-rw-r--r--arch/arm/mach-pxa/hx4700.c25
-rw-r--r--arch/arm/mach-pxa/pxa25x.c1
-rw-r--r--arch/arm/mach-pxa/pxa27x.c1
-rw-r--r--arch/arm/mach-pxa/saarb.c1
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c3
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c5
-rw-r--r--arch/arm/plat-omap/common.c1
-rw-r--r--arch/arm/plat-omap/include/plat/omap-secure.h6
-rw-r--r--arch/openrisc/include/asm/ptrace.h8
-rw-r--r--arch/openrisc/kernel/init_task.c1
-rw-r--r--arch/openrisc/kernel/irq.c1
-rw-r--r--arch/openrisc/kernel/ptrace.c12
-rw-r--r--arch/parisc/Makefile4
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/include/asm/compat.h7
-rw-r--r--arch/s390/kernel/crash_dump.c1
-rw-r--r--arch/s390/kernel/process.c1
-rw-r--r--arch/s390/kernel/ptrace.c2
-rw-r--r--arch/s390/kernel/setup.c2
-rw-r--r--arch/s390/kernel/signal.c1
-rw-r--r--arch/s390/mm/fault.c1
-rw-r--r--arch/s390/mm/init.c30
-rw-r--r--arch/s390/mm/mmap.c2
-rw-r--r--arch/x86/include/asm/perf_event.h8
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c44
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c2
-rw-r--r--arch/x86/kernel/cpu/perf_event.h8
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c37
-rw-r--r--arch/x86/kernel/entry_64.S9
-rw-r--r--arch/x86/kernel/microcode_amd.c1
-rw-r--r--arch/x86/kvm/svm.c5
-rw-r--r--arch/x86/xen/enlighten.c6
-rw-r--r--arch/x86/xen/mmu.c8
-rw-r--r--block/partitions/ldm.c11
-rw-r--r--drivers/atm/solos-pci.c4
-rw-r--r--drivers/bluetooth/btusb.c4
-rw-r--r--drivers/crypto/mv_cesa.c1
-rw-r--r--drivers/devfreq/exynos4_bus.c230
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_connector.c16
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h4
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c27
-rw-r--r--drivers/gpu/drm/i915/intel_display.c15
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c14
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c25
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c2
-rw-r--r--drivers/hwmon/f75375s.c89
-rw-r--r--drivers/i2c/busses/i2c-mxs.c13
-rw-r--r--drivers/iommu/omap-iommu-debug.c59
-rw-r--r--drivers/iommu/omap-iommu.c3
-rw-r--r--drivers/net/can/sja1000/sja1000.c13
-rw-r--r--drivers/net/ethernet/atheros/atl1c/atl1c_main.c4
-rw-r--r--drivers/net/ethernet/broadcom/b44.c2
-rw-r--r--drivers/net/ethernet/broadcom/cnic.c6
-rw-r--r--drivers/net/ethernet/cisco/enic/cq_enet_desc.h2
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_pp.c2
-rw-r--r--drivers/net/ethernet/jme.c10
-rw-r--r--drivers/net/ethernet/jme.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/eq.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4.h2
-rw-r--r--drivers/net/ethernet/micrel/ks8851_mll.c2
-rw-r--r--drivers/net/ethernet/sfc/rx.c4
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c6
-rw-r--r--drivers/net/phy/icplus.c55
-rw-r--r--drivers/net/ppp/ppp_generic.c23
-rw-r--r--drivers/net/usb/cdc_ether.c7
-rw-r--r--drivers/net/usb/hso.c2
-rw-r--r--drivers/net/usb/zaurus.c12
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c2
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c8
-rw-r--r--drivers/parisc/iommu-helpers.h2
-rw-r--r--drivers/pcmcia/pxa2xx_base.c12
-rw-r--r--drivers/regulator/88pm8607.c6
-rw-r--r--drivers/s390/block/dasd_eckd.c2
-rw-r--r--drivers/s390/block/dasd_ioctl.c1
-rw-r--r--drivers/s390/char/fs3270.c1
-rw-r--r--drivers/s390/char/vmcp.c1
-rw-r--r--drivers/s390/cio/chsc_sch.c1
-rw-r--r--drivers/s390/scsi/zfcp_cfdc.c1
-rw-r--r--drivers/scsi/osd/osd_uld.c4
-rw-r--r--drivers/video/omap2/displays/Kconfig2
-rw-r--r--drivers/video/omap2/dss/apply.c6
-rw-r--r--drivers/video/omap2/dss/hdmi.c24
-rw-r--r--drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c9
-rw-r--r--drivers/video/via/hw.c4
-rw-r--r--drivers/virtio/virtio_balloon.c33
-rw-r--r--drivers/watchdog/Kconfig2
-rw-r--r--drivers/watchdog/booke_wdt.c6
-rw-r--r--drivers/watchdog/hpwdt.c5
-rw-r--r--drivers/watchdog/pnx4008_wdt.c2
-rw-r--r--drivers/watchdog/s3c2410_wdt.c57
-rw-r--r--fs/binfmt_elf.c2
-rw-r--r--fs/dcache.c13
-rw-r--r--fs/ecryptfs/miscdev.c2
-rw-r--r--fs/gfs2/glock.c14
-rw-r--r--fs/gfs2/inode.c5
-rw-r--r--fs/gfs2/ops_fstype.c5
-rw-r--r--fs/gfs2/rgrp.c13
-rw-r--r--fs/namei.c66
-rw-r--r--fs/ntfs/attrib.c6
-rw-r--r--fs/ntfs/mft.c6
-rw-r--r--fs/ntfs/super.c4
-rw-r--r--include/asm-generic/iomap.h2
-rw-r--r--include/asm-generic/pci_iomap.h2
-rw-r--r--include/drm/Kbuild1
-rw-r--r--include/drm/exynos_drm.h22
-rw-r--r--include/linux/compat.h4
-rw-r--r--include/linux/dcache.h21
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/netfilter_bridge/ebtables.h4
-rw-r--r--include/linux/regset.h10
-rw-r--r--include/linux/rtnetlink.h3
-rw-r--r--include/linux/skbuff.h10
-rw-r--r--include/net/bluetooth/bluetooth.h2
-rw-r--r--include/net/bluetooth/hci_core.h6
-rw-r--r--include/net/bluetooth/l2cap.h12
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/trace/events/sched.h50
-rw-r--r--kernel/events/hw_breakpoint.c4
-rw-r--r--kernel/irq/autoprobe.c4
-rw-r--r--kernel/irq/chip.c42
-rw-r--r--kernel/irq/internals.h2
-rw-r--r--kernel/irq/manage.c2
-rw-r--r--kernel/sched/core.c5
-rw-r--r--kernel/sched/fair.c2
-rw-r--r--mm/memblock.c6
-rw-r--r--net/atm/clip.c10
-rw-r--r--net/bluetooth/af_bluetooth.c12
-rw-r--r--net/bluetooth/hci_conn.c4
-rw-r--r--net/bluetooth/hci_core.c3
-rw-r--r--net/bluetooth/l2cap_core.c24
-rw-r--r--net/bluetooth/l2cap_sock.c4
-rw-r--r--net/bluetooth/rfcomm/core.c18
-rw-r--r--net/bluetooth/rfcomm/sock.c2
-rw-r--r--net/core/neighbour.c2
-rw-r--r--net/core/rtnetlink.c78
-rw-r--r--net/ipv4/ip_gre.c10
-rw-r--r--net/ipv4/ping.c1
-rw-r--r--net/ipv4/xfrm4_mode_beet.c5
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c6
-rw-r--r--net/ipv6/ip6mr.c4
-rw-r--r--net/ipv6/ndisc.c5
-rw-r--r--net/ipv6/xfrm6_mode_beet.c6
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c6
-rw-r--r--net/mac80211/debugfs_sta.c4
-rw-r--r--net/mac80211/rate.c2
-rw-r--r--net/mac80211/rate.h3
-rw-r--r--net/mac80211/sta_info.h2
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c2
-rw-r--r--net/netfilter/nf_conntrack_core.c38
-rw-r--r--net/netfilter/nf_conntrack_netlink.c46
-rw-r--r--net/netfilter/nf_queue.c40
-rw-r--r--net/netfilter/xt_TEE.c5
-rw-r--r--net/sched/sch_netem.c6
-rw-r--r--scripts/mod/file2alias.c35
-rw-r--r--sound/pci/azt3328.c3
-rw-r--r--sound/pci/hda/hda_codec.c12
-rw-r--r--sound/pci/hda/hda_codec.h3
-rw-r--r--sound/pci/hda/patch_cirrus.c4
-rw-r--r--sound/pci/hda/patch_conexant.c24
-rw-r--r--sound/pci/hda/patch_realtek.c8
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--sound/soc/imx/imx-ssi.c2
-rw-r--r--sound/soc/soc-dapm.c12
-rw-r--r--tools/perf/util/event.c1
-rw-r--r--tools/perf/util/evlist.c4
-rw-r--r--tools/perf/util/probe-event.c6
-rw-r--r--tools/perf/util/probe-finder.c12
-rwxr-xr-xtools/testing/ktest/ktest.pl8
201 files changed, 3309 insertions, 2582 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 75a9a5fc230a..4e41d5255d72 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3780,7 +3780,7 @@ F: Documentation/kdump/
3780 3780
3781KERNEL AUTOMOUNTER v4 (AUTOFS4) 3781KERNEL AUTOMOUNTER v4 (AUTOFS4)
3782M: Ian Kent <raven@themaw.net> 3782M: Ian Kent <raven@themaw.net>
3783L: autofs@linux.kernel.org 3783L: autofs@vger.kernel.org
3784S: Maintained 3784S: Maintained
3785F: fs/autofs4/ 3785F: fs/autofs4/
3786 3786
@@ -4685,7 +4685,7 @@ NTFS FILESYSTEM
4685M: Anton Altaparmakov <anton@tuxera.com> 4685M: Anton Altaparmakov <anton@tuxera.com>
4686L: linux-ntfs-dev@lists.sourceforge.net 4686L: linux-ntfs-dev@lists.sourceforge.net
4687W: http://www.tuxera.com/ 4687W: http://www.tuxera.com/
4688T: git git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs-2.6.git 4688T: git git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs.git
4689S: Supported 4689S: Supported
4690F: Documentation/filesystems/ntfs.txt 4690F: Documentation/filesystems/ntfs.txt
4691F: fs/ntfs/ 4691F: fs/ntfs/
@@ -7271,7 +7271,7 @@ WATCHDOG DEVICE DRIVERS
7271M: Wim Van Sebroeck <wim@iguana.be> 7271M: Wim Van Sebroeck <wim@iguana.be>
7272L: linux-watchdog@vger.kernel.org 7272L: linux-watchdog@vger.kernel.org
7273W: http://www.linux-watchdog.org/ 7273W: http://www.linux-watchdog.org/
7274T: git git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog.git 7274T: git git://www.linux-watchdog.org/linux-watchdog.git
7275S: Maintained 7275S: Maintained
7276F: Documentation/watchdog/ 7276F: Documentation/watchdog/
7277F: drivers/watchdog/ 7277F: drivers/watchdog/
diff --git a/Makefile b/Makefile
index b61a9638b6fc..66d13c917bc7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 3 2PATCHLEVEL = 3
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc5 4EXTRAVERSION = -rc6
5NAME = Saber-toothed Squirrel 5NAME = Saber-toothed Squirrel
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 5fc202cdfdb6..995e7cc02bec 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -12,7 +12,8 @@ obj- :=
12 12
13# Core 13# Core
14 14
15obj-$(CONFIG_ARCH_EXYNOS4) += common.o clock.o 15obj-$(CONFIG_ARCH_EXYNOS) += common.o
16obj-$(CONFIG_ARCH_EXYNOS4) += clock-exynos4.o
16obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o 17obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o
17obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o 18obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o
18 19
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c
new file mode 100644
index 000000000000..31b59e65463a
--- /dev/null
+++ b/arch/arm/mach-exynos/clock-exynos4.c
@@ -0,0 +1,1563 @@
1/*
2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS4 - Clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/io.h>
15#include <linux/syscore_ops.h>
16
17#include <plat/cpu-freq.h>
18#include <plat/clock.h>
19#include <plat/cpu.h>
20#include <plat/pll.h>
21#include <plat/s5p-clock.h>
22#include <plat/clock-clksrc.h>
23#include <plat/pm.h>
24
25#include <mach/map.h>
26#include <mach/regs-clock.h>
27#include <mach/sysmmu.h>
28
29#include "common.h"
30#include "clock-exynos4.h"
31
32#ifdef CONFIG_PM_SLEEP
33static struct sleep_save exynos4_clock_save[] = {
34 SAVE_ITEM(EXYNOS4_CLKDIV_LEFTBUS),
35 SAVE_ITEM(EXYNOS4_CLKGATE_IP_LEFTBUS),
36 SAVE_ITEM(EXYNOS4_CLKDIV_RIGHTBUS),
37 SAVE_ITEM(EXYNOS4_CLKGATE_IP_RIGHTBUS),
38 SAVE_ITEM(EXYNOS4_CLKSRC_TOP0),
39 SAVE_ITEM(EXYNOS4_CLKSRC_TOP1),
40 SAVE_ITEM(EXYNOS4_CLKSRC_CAM),
41 SAVE_ITEM(EXYNOS4_CLKSRC_TV),
42 SAVE_ITEM(EXYNOS4_CLKSRC_MFC),
43 SAVE_ITEM(EXYNOS4_CLKSRC_G3D),
44 SAVE_ITEM(EXYNOS4_CLKSRC_LCD0),
45 SAVE_ITEM(EXYNOS4_CLKSRC_MAUDIO),
46 SAVE_ITEM(EXYNOS4_CLKSRC_FSYS),
47 SAVE_ITEM(EXYNOS4_CLKSRC_PERIL0),
48 SAVE_ITEM(EXYNOS4_CLKSRC_PERIL1),
49 SAVE_ITEM(EXYNOS4_CLKDIV_CAM),
50 SAVE_ITEM(EXYNOS4_CLKDIV_TV),
51 SAVE_ITEM(EXYNOS4_CLKDIV_MFC),
52 SAVE_ITEM(EXYNOS4_CLKDIV_G3D),
53 SAVE_ITEM(EXYNOS4_CLKDIV_LCD0),
54 SAVE_ITEM(EXYNOS4_CLKDIV_MAUDIO),
55 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS0),
56 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS1),
57 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS2),
58 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS3),
59 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL0),
60 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL1),
61 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL2),
62 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL3),
63 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL4),
64 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL5),
65 SAVE_ITEM(EXYNOS4_CLKDIV_TOP),
66 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TOP),
67 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_CAM),
68 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TV),
69 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_LCD0),
70 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_MAUDIO),
71 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_FSYS),
72 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL0),
73 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL1),
74 SAVE_ITEM(EXYNOS4_CLKDIV2_RATIO),
75 SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCAM),
76 SAVE_ITEM(EXYNOS4_CLKGATE_IP_CAM),
77 SAVE_ITEM(EXYNOS4_CLKGATE_IP_TV),
78 SAVE_ITEM(EXYNOS4_CLKGATE_IP_MFC),
79 SAVE_ITEM(EXYNOS4_CLKGATE_IP_G3D),
80 SAVE_ITEM(EXYNOS4_CLKGATE_IP_LCD0),
81 SAVE_ITEM(EXYNOS4_CLKGATE_IP_FSYS),
82 SAVE_ITEM(EXYNOS4_CLKGATE_IP_GPS),
83 SAVE_ITEM(EXYNOS4_CLKGATE_IP_PERIL),
84 SAVE_ITEM(EXYNOS4_CLKGATE_BLOCK),
85 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_DMC),
86 SAVE_ITEM(EXYNOS4_CLKSRC_DMC),
87 SAVE_ITEM(EXYNOS4_CLKDIV_DMC0),
88 SAVE_ITEM(EXYNOS4_CLKDIV_DMC1),
89 SAVE_ITEM(EXYNOS4_CLKGATE_IP_DMC),
90 SAVE_ITEM(EXYNOS4_CLKSRC_CPU),
91 SAVE_ITEM(EXYNOS4_CLKDIV_CPU),
92 SAVE_ITEM(EXYNOS4_CLKDIV_CPU + 0x4),
93 SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCPU),
94 SAVE_ITEM(EXYNOS4_CLKGATE_IP_CPU),
95};
96#endif
97
98static struct clk exynos4_clk_sclk_hdmi27m = {
99 .name = "sclk_hdmi27m",
100 .rate = 27000000,
101};
102
103static struct clk exynos4_clk_sclk_hdmiphy = {
104 .name = "sclk_hdmiphy",
105};
106
107static struct clk exynos4_clk_sclk_usbphy0 = {
108 .name = "sclk_usbphy0",
109 .rate = 27000000,
110};
111
112static struct clk exynos4_clk_sclk_usbphy1 = {
113 .name = "sclk_usbphy1",
114};
115
116static struct clk dummy_apb_pclk = {
117 .name = "apb_pclk",
118 .id = -1,
119};
120
121static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
122{
123 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TOP, clk, enable);
124}
125
126static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
127{
128 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_CAM, clk, enable);
129}
130
131static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
132{
133 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_LCD0, clk, enable);
134}
135
136int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
137{
138 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_FSYS, clk, enable);
139}
140
141static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
142{
143 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL0, clk, enable);
144}
145
146static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
147{
148 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL1, clk, enable);
149}
150
151static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable)
152{
153 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_MFC, clk, enable);
154}
155
156static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
157{
158 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TV, clk, enable);
159}
160
161static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
162{
163 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_CAM, clk, enable);
164}
165
166static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable)
167{
168 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_TV, clk, enable);
169}
170
171static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
172{
173 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_IMAGE, clk, enable);
174}
175
176static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
177{
178 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_LCD0, clk, enable);
179}
180
181int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
182{
183 return s5p_gatectrl(EXYNOS4210_CLKGATE_IP_LCD1, clk, enable);
184}
185
186int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
187{
188 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_FSYS, clk, enable);
189}
190
191static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
192{
193 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIL, clk, enable);
194}
195
196static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
197{
198 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIR, clk, enable);
199}
200
201static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
202{
203 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
204}
205
206static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
207{
208 return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
209}
210
211/* Core list of CMU_CPU side */
212
213static struct clksrc_clk exynos4_clk_mout_apll = {
214 .clk = {
215 .name = "mout_apll",
216 },
217 .sources = &clk_src_apll,
218 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 0, .size = 1 },
219};
220
221static struct clksrc_clk exynos4_clk_sclk_apll = {
222 .clk = {
223 .name = "sclk_apll",
224 .parent = &exynos4_clk_mout_apll.clk,
225 },
226 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 24, .size = 3 },
227};
228
229static struct clksrc_clk exynos4_clk_mout_epll = {
230 .clk = {
231 .name = "mout_epll",
232 },
233 .sources = &clk_src_epll,
234 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 4, .size = 1 },
235};
236
237struct clksrc_clk exynos4_clk_mout_mpll = {
238 .clk = {
239 .name = "mout_mpll",
240 },
241 .sources = &clk_src_mpll,
242
243 /* reg_src will be added in each SoCs' clock */
244};
245
246static struct clk *exynos4_clkset_moutcore_list[] = {
247 [0] = &exynos4_clk_mout_apll.clk,
248 [1] = &exynos4_clk_mout_mpll.clk,
249};
250
251static struct clksrc_sources exynos4_clkset_moutcore = {
252 .sources = exynos4_clkset_moutcore_list,
253 .nr_sources = ARRAY_SIZE(exynos4_clkset_moutcore_list),
254};
255
256static struct clksrc_clk exynos4_clk_moutcore = {
257 .clk = {
258 .name = "moutcore",
259 },
260 .sources = &exynos4_clkset_moutcore,
261 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 16, .size = 1 },
262};
263
264static struct clksrc_clk exynos4_clk_coreclk = {
265 .clk = {
266 .name = "core_clk",
267 .parent = &exynos4_clk_moutcore.clk,
268 },
269 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 0, .size = 3 },
270};
271
272static struct clksrc_clk exynos4_clk_armclk = {
273 .clk = {
274 .name = "armclk",
275 .parent = &exynos4_clk_coreclk.clk,
276 },
277};
278
279static struct clksrc_clk exynos4_clk_aclk_corem0 = {
280 .clk = {
281 .name = "aclk_corem0",
282 .parent = &exynos4_clk_coreclk.clk,
283 },
284 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 },
285};
286
287static struct clksrc_clk exynos4_clk_aclk_cores = {
288 .clk = {
289 .name = "aclk_cores",
290 .parent = &exynos4_clk_coreclk.clk,
291 },
292 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 },
293};
294
295static struct clksrc_clk exynos4_clk_aclk_corem1 = {
296 .clk = {
297 .name = "aclk_corem1",
298 .parent = &exynos4_clk_coreclk.clk,
299 },
300 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 8, .size = 3 },
301};
302
303static struct clksrc_clk exynos4_clk_periphclk = {
304 .clk = {
305 .name = "periphclk",
306 .parent = &exynos4_clk_coreclk.clk,
307 },
308 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 12, .size = 3 },
309};
310
311/* Core list of CMU_CORE side */
312
313static struct clk *exynos4_clkset_corebus_list[] = {
314 [0] = &exynos4_clk_mout_mpll.clk,
315 [1] = &exynos4_clk_sclk_apll.clk,
316};
317
318struct clksrc_sources exynos4_clkset_mout_corebus = {
319 .sources = exynos4_clkset_corebus_list,
320 .nr_sources = ARRAY_SIZE(exynos4_clkset_corebus_list),
321};
322
323static struct clksrc_clk exynos4_clk_mout_corebus = {
324 .clk = {
325 .name = "mout_corebus",
326 },
327 .sources = &exynos4_clkset_mout_corebus,
328 .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 4, .size = 1 },
329};
330
331static struct clksrc_clk exynos4_clk_sclk_dmc = {
332 .clk = {
333 .name = "sclk_dmc",
334 .parent = &exynos4_clk_mout_corebus.clk,
335 },
336 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 12, .size = 3 },
337};
338
339static struct clksrc_clk exynos4_clk_aclk_cored = {
340 .clk = {
341 .name = "aclk_cored",
342 .parent = &exynos4_clk_sclk_dmc.clk,
343 },
344 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 16, .size = 3 },
345};
346
347static struct clksrc_clk exynos4_clk_aclk_corep = {
348 .clk = {
349 .name = "aclk_corep",
350 .parent = &exynos4_clk_aclk_cored.clk,
351 },
352 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 20, .size = 3 },
353};
354
355static struct clksrc_clk exynos4_clk_aclk_acp = {
356 .clk = {
357 .name = "aclk_acp",
358 .parent = &exynos4_clk_mout_corebus.clk,
359 },
360 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 0, .size = 3 },
361};
362
363static struct clksrc_clk exynos4_clk_pclk_acp = {
364 .clk = {
365 .name = "pclk_acp",
366 .parent = &exynos4_clk_aclk_acp.clk,
367 },
368 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 4, .size = 3 },
369};
370
371/* Core list of CMU_TOP side */
372
373struct clk *exynos4_clkset_aclk_top_list[] = {
374 [0] = &exynos4_clk_mout_mpll.clk,
375 [1] = &exynos4_clk_sclk_apll.clk,
376};
377
378static struct clksrc_sources exynos4_clkset_aclk = {
379 .sources = exynos4_clkset_aclk_top_list,
380 .nr_sources = ARRAY_SIZE(exynos4_clkset_aclk_top_list),
381};
382
383static struct clksrc_clk exynos4_clk_aclk_200 = {
384 .clk = {
385 .name = "aclk_200",
386 },
387 .sources = &exynos4_clkset_aclk,
388 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 12, .size = 1 },
389 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 0, .size = 3 },
390};
391
392static struct clksrc_clk exynos4_clk_aclk_100 = {
393 .clk = {
394 .name = "aclk_100",
395 },
396 .sources = &exynos4_clkset_aclk,
397 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 16, .size = 1 },
398 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 4, .size = 4 },
399};
400
401static struct clksrc_clk exynos4_clk_aclk_160 = {
402 .clk = {
403 .name = "aclk_160",
404 },
405 .sources = &exynos4_clkset_aclk,
406 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 20, .size = 1 },
407 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 8, .size = 3 },
408};
409
410struct clksrc_clk exynos4_clk_aclk_133 = {
411 .clk = {
412 .name = "aclk_133",
413 },
414 .sources = &exynos4_clkset_aclk,
415 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 24, .size = 1 },
416 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 12, .size = 3 },
417};
418
419static struct clk *exynos4_clkset_vpllsrc_list[] = {
420 [0] = &clk_fin_vpll,
421 [1] = &exynos4_clk_sclk_hdmi27m,
422};
423
424static struct clksrc_sources exynos4_clkset_vpllsrc = {
425 .sources = exynos4_clkset_vpllsrc_list,
426 .nr_sources = ARRAY_SIZE(exynos4_clkset_vpllsrc_list),
427};
428
429static struct clksrc_clk exynos4_clk_vpllsrc = {
430 .clk = {
431 .name = "vpll_src",
432 .enable = exynos4_clksrc_mask_top_ctrl,
433 .ctrlbit = (1 << 0),
434 },
435 .sources = &exynos4_clkset_vpllsrc,
436 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP1, .shift = 0, .size = 1 },
437};
438
439static struct clk *exynos4_clkset_sclk_vpll_list[] = {
440 [0] = &exynos4_clk_vpllsrc.clk,
441 [1] = &clk_fout_vpll,
442};
443
444static struct clksrc_sources exynos4_clkset_sclk_vpll = {
445 .sources = exynos4_clkset_sclk_vpll_list,
446 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_vpll_list),
447};
448
449static struct clksrc_clk exynos4_clk_sclk_vpll = {
450 .clk = {
451 .name = "sclk_vpll",
452 },
453 .sources = &exynos4_clkset_sclk_vpll,
454 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 8, .size = 1 },
455};
456
457static struct clk exynos4_init_clocks_off[] = {
458 {
459 .name = "timers",
460 .parent = &exynos4_clk_aclk_100.clk,
461 .enable = exynos4_clk_ip_peril_ctrl,
462 .ctrlbit = (1<<24),
463 }, {
464 .name = "csis",
465 .devname = "s5p-mipi-csis.0",
466 .enable = exynos4_clk_ip_cam_ctrl,
467 .ctrlbit = (1 << 4),
468 }, {
469 .name = "csis",
470 .devname = "s5p-mipi-csis.1",
471 .enable = exynos4_clk_ip_cam_ctrl,
472 .ctrlbit = (1 << 5),
473 }, {
474 .name = "fimc",
475 .devname = "exynos4-fimc.0",
476 .enable = exynos4_clk_ip_cam_ctrl,
477 .ctrlbit = (1 << 0),
478 }, {
479 .name = "fimc",
480 .devname = "exynos4-fimc.1",
481 .enable = exynos4_clk_ip_cam_ctrl,
482 .ctrlbit = (1 << 1),
483 }, {
484 .name = "fimc",
485 .devname = "exynos4-fimc.2",
486 .enable = exynos4_clk_ip_cam_ctrl,
487 .ctrlbit = (1 << 2),
488 }, {
489 .name = "fimc",
490 .devname = "exynos4-fimc.3",
491 .enable = exynos4_clk_ip_cam_ctrl,
492 .ctrlbit = (1 << 3),
493 }, {
494 .name = "fimd",
495 .devname = "exynos4-fb.0",
496 .enable = exynos4_clk_ip_lcd0_ctrl,
497 .ctrlbit = (1 << 0),
498 }, {
499 .name = "hsmmc",
500 .devname = "s3c-sdhci.0",
501 .parent = &exynos4_clk_aclk_133.clk,
502 .enable = exynos4_clk_ip_fsys_ctrl,
503 .ctrlbit = (1 << 5),
504 }, {
505 .name = "hsmmc",
506 .devname = "s3c-sdhci.1",
507 .parent = &exynos4_clk_aclk_133.clk,
508 .enable = exynos4_clk_ip_fsys_ctrl,
509 .ctrlbit = (1 << 6),
510 }, {
511 .name = "hsmmc",
512 .devname = "s3c-sdhci.2",
513 .parent = &exynos4_clk_aclk_133.clk,
514 .enable = exynos4_clk_ip_fsys_ctrl,
515 .ctrlbit = (1 << 7),
516 }, {
517 .name = "hsmmc",
518 .devname = "s3c-sdhci.3",
519 .parent = &exynos4_clk_aclk_133.clk,
520 .enable = exynos4_clk_ip_fsys_ctrl,
521 .ctrlbit = (1 << 8),
522 }, {
523 .name = "dwmmc",
524 .parent = &exynos4_clk_aclk_133.clk,
525 .enable = exynos4_clk_ip_fsys_ctrl,
526 .ctrlbit = (1 << 9),
527 }, {
528 .name = "dac",
529 .devname = "s5p-sdo",
530 .enable = exynos4_clk_ip_tv_ctrl,
531 .ctrlbit = (1 << 2),
532 }, {
533 .name = "mixer",
534 .devname = "s5p-mixer",
535 .enable = exynos4_clk_ip_tv_ctrl,
536 .ctrlbit = (1 << 1),
537 }, {
538 .name = "vp",
539 .devname = "s5p-mixer",
540 .enable = exynos4_clk_ip_tv_ctrl,
541 .ctrlbit = (1 << 0),
542 }, {
543 .name = "hdmi",
544 .devname = "exynos4-hdmi",
545 .enable = exynos4_clk_ip_tv_ctrl,
546 .ctrlbit = (1 << 3),
547 }, {
548 .name = "hdmiphy",
549 .devname = "exynos4-hdmi",
550 .enable = exynos4_clk_hdmiphy_ctrl,
551 .ctrlbit = (1 << 0),
552 }, {
553 .name = "dacphy",
554 .devname = "s5p-sdo",
555 .enable = exynos4_clk_dac_ctrl,
556 .ctrlbit = (1 << 0),
557 }, {
558 .name = "adc",
559 .enable = exynos4_clk_ip_peril_ctrl,
560 .ctrlbit = (1 << 15),
561 }, {
562 .name = "keypad",
563 .enable = exynos4_clk_ip_perir_ctrl,
564 .ctrlbit = (1 << 16),
565 }, {
566 .name = "rtc",
567 .enable = exynos4_clk_ip_perir_ctrl,
568 .ctrlbit = (1 << 15),
569 }, {
570 .name = "watchdog",
571 .parent = &exynos4_clk_aclk_100.clk,
572 .enable = exynos4_clk_ip_perir_ctrl,
573 .ctrlbit = (1 << 14),
574 }, {
575 .name = "usbhost",
576 .enable = exynos4_clk_ip_fsys_ctrl ,
577 .ctrlbit = (1 << 12),
578 }, {
579 .name = "otg",
580 .enable = exynos4_clk_ip_fsys_ctrl,
581 .ctrlbit = (1 << 13),
582 }, {
583 .name = "spi",
584 .devname = "s3c64xx-spi.0",
585 .enable = exynos4_clk_ip_peril_ctrl,
586 .ctrlbit = (1 << 16),
587 }, {
588 .name = "spi",
589 .devname = "s3c64xx-spi.1",
590 .enable = exynos4_clk_ip_peril_ctrl,
591 .ctrlbit = (1 << 17),
592 }, {
593 .name = "spi",
594 .devname = "s3c64xx-spi.2",
595 .enable = exynos4_clk_ip_peril_ctrl,
596 .ctrlbit = (1 << 18),
597 }, {
598 .name = "iis",
599 .devname = "samsung-i2s.0",
600 .enable = exynos4_clk_ip_peril_ctrl,
601 .ctrlbit = (1 << 19),
602 }, {
603 .name = "iis",
604 .devname = "samsung-i2s.1",
605 .enable = exynos4_clk_ip_peril_ctrl,
606 .ctrlbit = (1 << 20),
607 }, {
608 .name = "iis",
609 .devname = "samsung-i2s.2",
610 .enable = exynos4_clk_ip_peril_ctrl,
611 .ctrlbit = (1 << 21),
612 }, {
613 .name = "ac97",
614 .devname = "samsung-ac97",
615 .enable = exynos4_clk_ip_peril_ctrl,
616 .ctrlbit = (1 << 27),
617 }, {
618 .name = "fimg2d",
619 .enable = exynos4_clk_ip_image_ctrl,
620 .ctrlbit = (1 << 0),
621 }, {
622 .name = "mfc",
623 .devname = "s5p-mfc",
624 .enable = exynos4_clk_ip_mfc_ctrl,
625 .ctrlbit = (1 << 0),
626 }, {
627 .name = "i2c",
628 .devname = "s3c2440-i2c.0",
629 .parent = &exynos4_clk_aclk_100.clk,
630 .enable = exynos4_clk_ip_peril_ctrl,
631 .ctrlbit = (1 << 6),
632 }, {
633 .name = "i2c",
634 .devname = "s3c2440-i2c.1",
635 .parent = &exynos4_clk_aclk_100.clk,
636 .enable = exynos4_clk_ip_peril_ctrl,
637 .ctrlbit = (1 << 7),
638 }, {
639 .name = "i2c",
640 .devname = "s3c2440-i2c.2",
641 .parent = &exynos4_clk_aclk_100.clk,
642 .enable = exynos4_clk_ip_peril_ctrl,
643 .ctrlbit = (1 << 8),
644 }, {
645 .name = "i2c",
646 .devname = "s3c2440-i2c.3",
647 .parent = &exynos4_clk_aclk_100.clk,
648 .enable = exynos4_clk_ip_peril_ctrl,
649 .ctrlbit = (1 << 9),
650 }, {
651 .name = "i2c",
652 .devname = "s3c2440-i2c.4",
653 .parent = &exynos4_clk_aclk_100.clk,
654 .enable = exynos4_clk_ip_peril_ctrl,
655 .ctrlbit = (1 << 10),
656 }, {
657 .name = "i2c",
658 .devname = "s3c2440-i2c.5",
659 .parent = &exynos4_clk_aclk_100.clk,
660 .enable = exynos4_clk_ip_peril_ctrl,
661 .ctrlbit = (1 << 11),
662 }, {
663 .name = "i2c",
664 .devname = "s3c2440-i2c.6",
665 .parent = &exynos4_clk_aclk_100.clk,
666 .enable = exynos4_clk_ip_peril_ctrl,
667 .ctrlbit = (1 << 12),
668 }, {
669 .name = "i2c",
670 .devname = "s3c2440-i2c.7",
671 .parent = &exynos4_clk_aclk_100.clk,
672 .enable = exynos4_clk_ip_peril_ctrl,
673 .ctrlbit = (1 << 13),
674 }, {
675 .name = "i2c",
676 .devname = "s3c2440-hdmiphy-i2c",
677 .parent = &exynos4_clk_aclk_100.clk,
678 .enable = exynos4_clk_ip_peril_ctrl,
679 .ctrlbit = (1 << 14),
680 }, {
681 .name = "SYSMMU_MDMA",
682 .enable = exynos4_clk_ip_image_ctrl,
683 .ctrlbit = (1 << 5),
684 }, {
685 .name = "SYSMMU_FIMC0",
686 .enable = exynos4_clk_ip_cam_ctrl,
687 .ctrlbit = (1 << 7),
688 }, {
689 .name = "SYSMMU_FIMC1",
690 .enable = exynos4_clk_ip_cam_ctrl,
691 .ctrlbit = (1 << 8),
692 }, {
693 .name = "SYSMMU_FIMC2",
694 .enable = exynos4_clk_ip_cam_ctrl,
695 .ctrlbit = (1 << 9),
696 }, {
697 .name = "SYSMMU_FIMC3",
698 .enable = exynos4_clk_ip_cam_ctrl,
699 .ctrlbit = (1 << 10),
700 }, {
701 .name = "SYSMMU_JPEG",
702 .enable = exynos4_clk_ip_cam_ctrl,
703 .ctrlbit = (1 << 11),
704 }, {
705 .name = "SYSMMU_FIMD0",
706 .enable = exynos4_clk_ip_lcd0_ctrl,
707 .ctrlbit = (1 << 4),
708 }, {
709 .name = "SYSMMU_FIMD1",
710 .enable = exynos4_clk_ip_lcd1_ctrl,
711 .ctrlbit = (1 << 4),
712 }, {
713 .name = "SYSMMU_PCIe",
714 .enable = exynos4_clk_ip_fsys_ctrl,
715 .ctrlbit = (1 << 18),
716 }, {
717 .name = "SYSMMU_G2D",
718 .enable = exynos4_clk_ip_image_ctrl,
719 .ctrlbit = (1 << 3),
720 }, {
721 .name = "SYSMMU_ROTATOR",
722 .enable = exynos4_clk_ip_image_ctrl,
723 .ctrlbit = (1 << 4),
724 }, {
725 .name = "SYSMMU_TV",
726 .enable = exynos4_clk_ip_tv_ctrl,
727 .ctrlbit = (1 << 4),
728 }, {
729 .name = "SYSMMU_MFC_L",
730 .enable = exynos4_clk_ip_mfc_ctrl,
731 .ctrlbit = (1 << 1),
732 }, {
733 .name = "SYSMMU_MFC_R",
734 .enable = exynos4_clk_ip_mfc_ctrl,
735 .ctrlbit = (1 << 2),
736 }
737};
738
739static struct clk exynos4_init_clocks_on[] = {
740 {
741 .name = "uart",
742 .devname = "s5pv210-uart.0",
743 .enable = exynos4_clk_ip_peril_ctrl,
744 .ctrlbit = (1 << 0),
745 }, {
746 .name = "uart",
747 .devname = "s5pv210-uart.1",
748 .enable = exynos4_clk_ip_peril_ctrl,
749 .ctrlbit = (1 << 1),
750 }, {
751 .name = "uart",
752 .devname = "s5pv210-uart.2",
753 .enable = exynos4_clk_ip_peril_ctrl,
754 .ctrlbit = (1 << 2),
755 }, {
756 .name = "uart",
757 .devname = "s5pv210-uart.3",
758 .enable = exynos4_clk_ip_peril_ctrl,
759 .ctrlbit = (1 << 3),
760 }, {
761 .name = "uart",
762 .devname = "s5pv210-uart.4",
763 .enable = exynos4_clk_ip_peril_ctrl,
764 .ctrlbit = (1 << 4),
765 }, {
766 .name = "uart",
767 .devname = "s5pv210-uart.5",
768 .enable = exynos4_clk_ip_peril_ctrl,
769 .ctrlbit = (1 << 5),
770 }
771};
772
773static struct clk exynos4_clk_pdma0 = {
774 .name = "dma",
775 .devname = "dma-pl330.0",
776 .enable = exynos4_clk_ip_fsys_ctrl,
777 .ctrlbit = (1 << 0),
778};
779
780static struct clk exynos4_clk_pdma1 = {
781 .name = "dma",
782 .devname = "dma-pl330.1",
783 .enable = exynos4_clk_ip_fsys_ctrl,
784 .ctrlbit = (1 << 1),
785};
786
787struct clk *exynos4_clkset_group_list[] = {
788 [0] = &clk_ext_xtal_mux,
789 [1] = &clk_xusbxti,
790 [2] = &exynos4_clk_sclk_hdmi27m,
791 [3] = &exynos4_clk_sclk_usbphy0,
792 [4] = &exynos4_clk_sclk_usbphy1,
793 [5] = &exynos4_clk_sclk_hdmiphy,
794 [6] = &exynos4_clk_mout_mpll.clk,
795 [7] = &exynos4_clk_mout_epll.clk,
796 [8] = &exynos4_clk_sclk_vpll.clk,
797};
798
799struct clksrc_sources exynos4_clkset_group = {
800 .sources = exynos4_clkset_group_list,
801 .nr_sources = ARRAY_SIZE(exynos4_clkset_group_list),
802};
803
804static struct clk *exynos4_clkset_mout_g2d0_list[] = {
805 [0] = &exynos4_clk_mout_mpll.clk,
806 [1] = &exynos4_clk_sclk_apll.clk,
807};
808
809static struct clksrc_sources exynos4_clkset_mout_g2d0 = {
810 .sources = exynos4_clkset_mout_g2d0_list,
811 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d0_list),
812};
813
814static struct clksrc_clk exynos4_clk_mout_g2d0 = {
815 .clk = {
816 .name = "mout_g2d0",
817 },
818 .sources = &exynos4_clkset_mout_g2d0,
819 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 0, .size = 1 },
820};
821
822static struct clk *exynos4_clkset_mout_g2d1_list[] = {
823 [0] = &exynos4_clk_mout_epll.clk,
824 [1] = &exynos4_clk_sclk_vpll.clk,
825};
826
827static struct clksrc_sources exynos4_clkset_mout_g2d1 = {
828 .sources = exynos4_clkset_mout_g2d1_list,
829 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d1_list),
830};
831
832static struct clksrc_clk exynos4_clk_mout_g2d1 = {
833 .clk = {
834 .name = "mout_g2d1",
835 },
836 .sources = &exynos4_clkset_mout_g2d1,
837 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 4, .size = 1 },
838};
839
840static struct clk *exynos4_clkset_mout_g2d_list[] = {
841 [0] = &exynos4_clk_mout_g2d0.clk,
842 [1] = &exynos4_clk_mout_g2d1.clk,
843};
844
845static struct clksrc_sources exynos4_clkset_mout_g2d = {
846 .sources = exynos4_clkset_mout_g2d_list,
847 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d_list),
848};
849
850static struct clk *exynos4_clkset_mout_mfc0_list[] = {
851 [0] = &exynos4_clk_mout_mpll.clk,
852 [1] = &exynos4_clk_sclk_apll.clk,
853};
854
855static struct clksrc_sources exynos4_clkset_mout_mfc0 = {
856 .sources = exynos4_clkset_mout_mfc0_list,
857 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc0_list),
858};
859
860static struct clksrc_clk exynos4_clk_mout_mfc0 = {
861 .clk = {
862 .name = "mout_mfc0",
863 },
864 .sources = &exynos4_clkset_mout_mfc0,
865 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 0, .size = 1 },
866};
867
868static struct clk *exynos4_clkset_mout_mfc1_list[] = {
869 [0] = &exynos4_clk_mout_epll.clk,
870 [1] = &exynos4_clk_sclk_vpll.clk,
871};
872
873static struct clksrc_sources exynos4_clkset_mout_mfc1 = {
874 .sources = exynos4_clkset_mout_mfc1_list,
875 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc1_list),
876};
877
878static struct clksrc_clk exynos4_clk_mout_mfc1 = {
879 .clk = {
880 .name = "mout_mfc1",
881 },
882 .sources = &exynos4_clkset_mout_mfc1,
883 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 4, .size = 1 },
884};
885
886static struct clk *exynos4_clkset_mout_mfc_list[] = {
887 [0] = &exynos4_clk_mout_mfc0.clk,
888 [1] = &exynos4_clk_mout_mfc1.clk,
889};
890
891static struct clksrc_sources exynos4_clkset_mout_mfc = {
892 .sources = exynos4_clkset_mout_mfc_list,
893 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc_list),
894};
895
896static struct clk *exynos4_clkset_sclk_dac_list[] = {
897 [0] = &exynos4_clk_sclk_vpll.clk,
898 [1] = &exynos4_clk_sclk_hdmiphy,
899};
900
901static struct clksrc_sources exynos4_clkset_sclk_dac = {
902 .sources = exynos4_clkset_sclk_dac_list,
903 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_dac_list),
904};
905
906static struct clksrc_clk exynos4_clk_sclk_dac = {
907 .clk = {
908 .name = "sclk_dac",
909 .enable = exynos4_clksrc_mask_tv_ctrl,
910 .ctrlbit = (1 << 8),
911 },
912 .sources = &exynos4_clkset_sclk_dac,
913 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 8, .size = 1 },
914};
915
916static struct clksrc_clk exynos4_clk_sclk_pixel = {
917 .clk = {
918 .name = "sclk_pixel",
919 .parent = &exynos4_clk_sclk_vpll.clk,
920 },
921 .reg_div = { .reg = EXYNOS4_CLKDIV_TV, .shift = 0, .size = 4 },
922};
923
924static struct clk *exynos4_clkset_sclk_hdmi_list[] = {
925 [0] = &exynos4_clk_sclk_pixel.clk,
926 [1] = &exynos4_clk_sclk_hdmiphy,
927};
928
929static struct clksrc_sources exynos4_clkset_sclk_hdmi = {
930 .sources = exynos4_clkset_sclk_hdmi_list,
931 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_hdmi_list),
932};
933
934static struct clksrc_clk exynos4_clk_sclk_hdmi = {
935 .clk = {
936 .name = "sclk_hdmi",
937 .enable = exynos4_clksrc_mask_tv_ctrl,
938 .ctrlbit = (1 << 0),
939 },
940 .sources = &exynos4_clkset_sclk_hdmi,
941 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 0, .size = 1 },
942};
943
944static struct clk *exynos4_clkset_sclk_mixer_list[] = {
945 [0] = &exynos4_clk_sclk_dac.clk,
946 [1] = &exynos4_clk_sclk_hdmi.clk,
947};
948
949static struct clksrc_sources exynos4_clkset_sclk_mixer = {
950 .sources = exynos4_clkset_sclk_mixer_list,
951 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_mixer_list),
952};
953
954static struct clksrc_clk exynos4_clk_sclk_mixer = {
955 .clk = {
956 .name = "sclk_mixer",
957 .enable = exynos4_clksrc_mask_tv_ctrl,
958 .ctrlbit = (1 << 4),
959 },
960 .sources = &exynos4_clkset_sclk_mixer,
961 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 4, .size = 1 },
962};
963
964static struct clksrc_clk *exynos4_sclk_tv[] = {
965 &exynos4_clk_sclk_dac,
966 &exynos4_clk_sclk_pixel,
967 &exynos4_clk_sclk_hdmi,
968 &exynos4_clk_sclk_mixer,
969};
970
971static struct clksrc_clk exynos4_clk_dout_mmc0 = {
972 .clk = {
973 .name = "dout_mmc0",
974 },
975 .sources = &exynos4_clkset_group,
976 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 0, .size = 4 },
977 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 0, .size = 4 },
978};
979
980static struct clksrc_clk exynos4_clk_dout_mmc1 = {
981 .clk = {
982 .name = "dout_mmc1",
983 },
984 .sources = &exynos4_clkset_group,
985 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 4, .size = 4 },
986 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 16, .size = 4 },
987};
988
989static struct clksrc_clk exynos4_clk_dout_mmc2 = {
990 .clk = {
991 .name = "dout_mmc2",
992 },
993 .sources = &exynos4_clkset_group,
994 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 8, .size = 4 },
995 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 0, .size = 4 },
996};
997
998static struct clksrc_clk exynos4_clk_dout_mmc3 = {
999 .clk = {
1000 .name = "dout_mmc3",
1001 },
1002 .sources = &exynos4_clkset_group,
1003 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 12, .size = 4 },
1004 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 16, .size = 4 },
1005};
1006
1007static struct clksrc_clk exynos4_clk_dout_mmc4 = {
1008 .clk = {
1009 .name = "dout_mmc4",
1010 },
1011 .sources = &exynos4_clkset_group,
1012 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 16, .size = 4 },
1013 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 0, .size = 4 },
1014};
1015
1016static struct clksrc_clk exynos4_clksrcs[] = {
1017 {
1018 .clk = {
1019 .name = "sclk_pwm",
1020 .enable = exynos4_clksrc_mask_peril0_ctrl,
1021 .ctrlbit = (1 << 24),
1022 },
1023 .sources = &exynos4_clkset_group,
1024 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 24, .size = 4 },
1025 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL3, .shift = 0, .size = 4 },
1026 }, {
1027 .clk = {
1028 .name = "sclk_csis",
1029 .devname = "s5p-mipi-csis.0",
1030 .enable = exynos4_clksrc_mask_cam_ctrl,
1031 .ctrlbit = (1 << 24),
1032 },
1033 .sources = &exynos4_clkset_group,
1034 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 24, .size = 4 },
1035 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 24, .size = 4 },
1036 }, {
1037 .clk = {
1038 .name = "sclk_csis",
1039 .devname = "s5p-mipi-csis.1",
1040 .enable = exynos4_clksrc_mask_cam_ctrl,
1041 .ctrlbit = (1 << 28),
1042 },
1043 .sources = &exynos4_clkset_group,
1044 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 28, .size = 4 },
1045 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 28, .size = 4 },
1046 }, {
1047 .clk = {
1048 .name = "sclk_cam0",
1049 .enable = exynos4_clksrc_mask_cam_ctrl,
1050 .ctrlbit = (1 << 16),
1051 },
1052 .sources = &exynos4_clkset_group,
1053 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 16, .size = 4 },
1054 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 16, .size = 4 },
1055 }, {
1056 .clk = {
1057 .name = "sclk_cam1",
1058 .enable = exynos4_clksrc_mask_cam_ctrl,
1059 .ctrlbit = (1 << 20),
1060 },
1061 .sources = &exynos4_clkset_group,
1062 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 20, .size = 4 },
1063 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 20, .size = 4 },
1064 }, {
1065 .clk = {
1066 .name = "sclk_fimc",
1067 .devname = "exynos4-fimc.0",
1068 .enable = exynos4_clksrc_mask_cam_ctrl,
1069 .ctrlbit = (1 << 0),
1070 },
1071 .sources = &exynos4_clkset_group,
1072 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 0, .size = 4 },
1073 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 0, .size = 4 },
1074 }, {
1075 .clk = {
1076 .name = "sclk_fimc",
1077 .devname = "exynos4-fimc.1",
1078 .enable = exynos4_clksrc_mask_cam_ctrl,
1079 .ctrlbit = (1 << 4),
1080 },
1081 .sources = &exynos4_clkset_group,
1082 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 4, .size = 4 },
1083 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 4, .size = 4 },
1084 }, {
1085 .clk = {
1086 .name = "sclk_fimc",
1087 .devname = "exynos4-fimc.2",
1088 .enable = exynos4_clksrc_mask_cam_ctrl,
1089 .ctrlbit = (1 << 8),
1090 },
1091 .sources = &exynos4_clkset_group,
1092 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 8, .size = 4 },
1093 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 8, .size = 4 },
1094 }, {
1095 .clk = {
1096 .name = "sclk_fimc",
1097 .devname = "exynos4-fimc.3",
1098 .enable = exynos4_clksrc_mask_cam_ctrl,
1099 .ctrlbit = (1 << 12),
1100 },
1101 .sources = &exynos4_clkset_group,
1102 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 12, .size = 4 },
1103 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 12, .size = 4 },
1104 }, {
1105 .clk = {
1106 .name = "sclk_fimd",
1107 .devname = "exynos4-fb.0",
1108 .enable = exynos4_clksrc_mask_lcd0_ctrl,
1109 .ctrlbit = (1 << 0),
1110 },
1111 .sources = &exynos4_clkset_group,
1112 .reg_src = { .reg = EXYNOS4_CLKSRC_LCD0, .shift = 0, .size = 4 },
1113 .reg_div = { .reg = EXYNOS4_CLKDIV_LCD0, .shift = 0, .size = 4 },
1114 }, {
1115 .clk = {
1116 .name = "sclk_fimg2d",
1117 },
1118 .sources = &exynos4_clkset_mout_g2d,
1119 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 8, .size = 1 },
1120 .reg_div = { .reg = EXYNOS4_CLKDIV_IMAGE, .shift = 0, .size = 4 },
1121 }, {
1122 .clk = {
1123 .name = "sclk_mfc",
1124 .devname = "s5p-mfc",
1125 },
1126 .sources = &exynos4_clkset_mout_mfc,
1127 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 8, .size = 1 },
1128 .reg_div = { .reg = EXYNOS4_CLKDIV_MFC, .shift = 0, .size = 4 },
1129 }, {
1130 .clk = {
1131 .name = "sclk_dwmmc",
1132 .parent = &exynos4_clk_dout_mmc4.clk,
1133 .enable = exynos4_clksrc_mask_fsys_ctrl,
1134 .ctrlbit = (1 << 16),
1135 },
1136 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 8, .size = 8 },
1137 }
1138};
1139
1140static struct clksrc_clk exynos4_clk_sclk_uart0 = {
1141 .clk = {
1142 .name = "uclk1",
1143 .devname = "exynos4210-uart.0",
1144 .enable = exynos4_clksrc_mask_peril0_ctrl,
1145 .ctrlbit = (1 << 0),
1146 },
1147 .sources = &exynos4_clkset_group,
1148 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 0, .size = 4 },
1149 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 0, .size = 4 },
1150};
1151
1152static struct clksrc_clk exynos4_clk_sclk_uart1 = {
1153 .clk = {
1154 .name = "uclk1",
1155 .devname = "exynos4210-uart.1",
1156 .enable = exynos4_clksrc_mask_peril0_ctrl,
1157 .ctrlbit = (1 << 4),
1158 },
1159 .sources = &exynos4_clkset_group,
1160 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 4, .size = 4 },
1161 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 4, .size = 4 },
1162};
1163
1164static struct clksrc_clk exynos4_clk_sclk_uart2 = {
1165 .clk = {
1166 .name = "uclk1",
1167 .devname = "exynos4210-uart.2",
1168 .enable = exynos4_clksrc_mask_peril0_ctrl,
1169 .ctrlbit = (1 << 8),
1170 },
1171 .sources = &exynos4_clkset_group,
1172 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 8, .size = 4 },
1173 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 8, .size = 4 },
1174};
1175
1176static struct clksrc_clk exynos4_clk_sclk_uart3 = {
1177 .clk = {
1178 .name = "uclk1",
1179 .devname = "exynos4210-uart.3",
1180 .enable = exynos4_clksrc_mask_peril0_ctrl,
1181 .ctrlbit = (1 << 12),
1182 },
1183 .sources = &exynos4_clkset_group,
1184 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 12, .size = 4 },
1185 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 12, .size = 4 },
1186};
1187
1188static struct clksrc_clk exynos4_clk_sclk_mmc0 = {
1189 .clk = {
1190 .name = "sclk_mmc",
1191 .devname = "s3c-sdhci.0",
1192 .parent = &exynos4_clk_dout_mmc0.clk,
1193 .enable = exynos4_clksrc_mask_fsys_ctrl,
1194 .ctrlbit = (1 << 0),
1195 },
1196 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 8, .size = 8 },
1197};
1198
1199static struct clksrc_clk exynos4_clk_sclk_mmc1 = {
1200 .clk = {
1201 .name = "sclk_mmc",
1202 .devname = "s3c-sdhci.1",
1203 .parent = &exynos4_clk_dout_mmc1.clk,
1204 .enable = exynos4_clksrc_mask_fsys_ctrl,
1205 .ctrlbit = (1 << 4),
1206 },
1207 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 24, .size = 8 },
1208};
1209
1210static struct clksrc_clk exynos4_clk_sclk_mmc2 = {
1211 .clk = {
1212 .name = "sclk_mmc",
1213 .devname = "s3c-sdhci.2",
1214 .parent = &exynos4_clk_dout_mmc2.clk,
1215 .enable = exynos4_clksrc_mask_fsys_ctrl,
1216 .ctrlbit = (1 << 8),
1217 },
1218 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 8, .size = 8 },
1219};
1220
1221static struct clksrc_clk exynos4_clk_sclk_mmc3 = {
1222 .clk = {
1223 .name = "sclk_mmc",
1224 .devname = "s3c-sdhci.3",
1225 .parent = &exynos4_clk_dout_mmc3.clk,
1226 .enable = exynos4_clksrc_mask_fsys_ctrl,
1227 .ctrlbit = (1 << 12),
1228 },
1229 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1230};
1231
1232static struct clksrc_clk exynos4_clk_sclk_spi0 = {
1233 .clk = {
1234 .name = "sclk_spi",
1235 .devname = "s3c64xx-spi.0",
1236 .enable = exynos4_clksrc_mask_peril1_ctrl,
1237 .ctrlbit = (1 << 16),
1238 },
1239 .sources = &exynos4_clkset_group,
1240 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 16, .size = 4 },
1241 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 0, .size = 4 },
1242};
1243
1244static struct clksrc_clk exynos4_clk_sclk_spi1 = {
1245 .clk = {
1246 .name = "sclk_spi",
1247 .devname = "s3c64xx-spi.1",
1248 .enable = exynos4_clksrc_mask_peril1_ctrl,
1249 .ctrlbit = (1 << 20),
1250 },
1251 .sources = &exynos4_clkset_group,
1252 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 20, .size = 4 },
1253 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 16, .size = 4 },
1254};
1255
1256static struct clksrc_clk exynos4_clk_sclk_spi2 = {
1257 .clk = {
1258 .name = "sclk_spi",
1259 .devname = "s3c64xx-spi.2",
1260 .enable = exynos4_clksrc_mask_peril1_ctrl,
1261 .ctrlbit = (1 << 24),
1262 },
1263 .sources = &exynos4_clkset_group,
1264 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 24, .size = 4 },
1265 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 0, .size = 4 },
1266};
1267
1268/* Clock initialization code */
1269static struct clksrc_clk *exynos4_sysclks[] = {
1270 &exynos4_clk_mout_apll,
1271 &exynos4_clk_sclk_apll,
1272 &exynos4_clk_mout_epll,
1273 &exynos4_clk_mout_mpll,
1274 &exynos4_clk_moutcore,
1275 &exynos4_clk_coreclk,
1276 &exynos4_clk_armclk,
1277 &exynos4_clk_aclk_corem0,
1278 &exynos4_clk_aclk_cores,
1279 &exynos4_clk_aclk_corem1,
1280 &exynos4_clk_periphclk,
1281 &exynos4_clk_mout_corebus,
1282 &exynos4_clk_sclk_dmc,
1283 &exynos4_clk_aclk_cored,
1284 &exynos4_clk_aclk_corep,
1285 &exynos4_clk_aclk_acp,
1286 &exynos4_clk_pclk_acp,
1287 &exynos4_clk_vpllsrc,
1288 &exynos4_clk_sclk_vpll,
1289 &exynos4_clk_aclk_200,
1290 &exynos4_clk_aclk_100,
1291 &exynos4_clk_aclk_160,
1292 &exynos4_clk_aclk_133,
1293 &exynos4_clk_dout_mmc0,
1294 &exynos4_clk_dout_mmc1,
1295 &exynos4_clk_dout_mmc2,
1296 &exynos4_clk_dout_mmc3,
1297 &exynos4_clk_dout_mmc4,
1298 &exynos4_clk_mout_mfc0,
1299 &exynos4_clk_mout_mfc1,
1300};
1301
1302static struct clk *exynos4_clk_cdev[] = {
1303 &exynos4_clk_pdma0,
1304 &exynos4_clk_pdma1,
1305};
1306
1307static struct clksrc_clk *exynos4_clksrc_cdev[] = {
1308 &exynos4_clk_sclk_uart0,
1309 &exynos4_clk_sclk_uart1,
1310 &exynos4_clk_sclk_uart2,
1311 &exynos4_clk_sclk_uart3,
1312 &exynos4_clk_sclk_mmc0,
1313 &exynos4_clk_sclk_mmc1,
1314 &exynos4_clk_sclk_mmc2,
1315 &exynos4_clk_sclk_mmc3,
1316 &exynos4_clk_sclk_spi0,
1317 &exynos4_clk_sclk_spi1,
1318 &exynos4_clk_sclk_spi2,
1319
1320};
1321
1322static struct clk_lookup exynos4_clk_lookup[] = {
1323 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos4_clk_sclk_uart0.clk),
1324 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk),
1325 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk),
1326 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk),
1327 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk),
1328 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk),
1329 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk),
1330 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk),
1331 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0),
1332 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1),
1333 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk),
1334 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk),
1335 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk),
1336};
1337
1338static int xtal_rate;
1339
1340static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
1341{
1342 if (soc_is_exynos4210())
1343 return s5p_get_pll45xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0),
1344 pll_4508);
1345 else if (soc_is_exynos4212() || soc_is_exynos4412())
1346 return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0));
1347 else
1348 return 0;
1349}
1350
1351static struct clk_ops exynos4_fout_apll_ops = {
1352 .get_rate = exynos4_fout_apll_get_rate,
1353};
1354
1355static u32 exynos4_vpll_div[][8] = {
1356 { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
1357 { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
1358};
1359
1360static unsigned long exynos4_vpll_get_rate(struct clk *clk)
1361{
1362 return clk->rate;
1363}
1364
1365static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate)
1366{
1367 unsigned int vpll_con0, vpll_con1 = 0;
1368 unsigned int i;
1369
1370 /* Return if nothing changed */
1371 if (clk->rate == rate)
1372 return 0;
1373
1374 vpll_con0 = __raw_readl(EXYNOS4_VPLL_CON0);
1375 vpll_con0 &= ~(0x1 << 27 | \
1376 PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1377 PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1378 PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1379
1380 vpll_con1 = __raw_readl(EXYNOS4_VPLL_CON1);
1381 vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \
1382 PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \
1383 PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT);
1384
1385 for (i = 0; i < ARRAY_SIZE(exynos4_vpll_div); i++) {
1386 if (exynos4_vpll_div[i][0] == rate) {
1387 vpll_con0 |= exynos4_vpll_div[i][1] << PLL46XX_PDIV_SHIFT;
1388 vpll_con0 |= exynos4_vpll_div[i][2] << PLL46XX_MDIV_SHIFT;
1389 vpll_con0 |= exynos4_vpll_div[i][3] << PLL46XX_SDIV_SHIFT;
1390 vpll_con1 |= exynos4_vpll_div[i][4] << PLL46XX_KDIV_SHIFT;
1391 vpll_con1 |= exynos4_vpll_div[i][5] << PLL46XX_MFR_SHIFT;
1392 vpll_con1 |= exynos4_vpll_div[i][6] << PLL46XX_MRR_SHIFT;
1393 vpll_con0 |= exynos4_vpll_div[i][7] << 27;
1394 break;
1395 }
1396 }
1397
1398 if (i == ARRAY_SIZE(exynos4_vpll_div)) {
1399 printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n",
1400 __func__);
1401 return -EINVAL;
1402 }
1403
1404 __raw_writel(vpll_con0, EXYNOS4_VPLL_CON0);
1405 __raw_writel(vpll_con1, EXYNOS4_VPLL_CON1);
1406
1407 /* Wait for VPLL lock */
1408 while (!(__raw_readl(EXYNOS4_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT)))
1409 continue;
1410
1411 clk->rate = rate;
1412 return 0;
1413}
1414
1415static struct clk_ops exynos4_vpll_ops = {
1416 .get_rate = exynos4_vpll_get_rate,
1417 .set_rate = exynos4_vpll_set_rate,
1418};
1419
1420void __init_or_cpufreq exynos4_setup_clocks(void)
1421{
1422 struct clk *xtal_clk;
1423 unsigned long apll = 0;
1424 unsigned long mpll = 0;
1425 unsigned long epll = 0;
1426 unsigned long vpll = 0;
1427 unsigned long vpllsrc;
1428 unsigned long xtal;
1429 unsigned long armclk;
1430 unsigned long sclk_dmc;
1431 unsigned long aclk_200;
1432 unsigned long aclk_100;
1433 unsigned long aclk_160;
1434 unsigned long aclk_133;
1435 unsigned int ptr;
1436
1437 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1438
1439 xtal_clk = clk_get(NULL, "xtal");
1440 BUG_ON(IS_ERR(xtal_clk));
1441
1442 xtal = clk_get_rate(xtal_clk);
1443
1444 xtal_rate = xtal;
1445
1446 clk_put(xtal_clk);
1447
1448 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1449
1450 if (soc_is_exynos4210()) {
1451 apll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_APLL_CON0),
1452 pll_4508);
1453 mpll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0),
1454 pll_4508);
1455 epll = s5p_get_pll46xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0),
1456 __raw_readl(EXYNOS4_EPLL_CON1), pll_4600);
1457
1458 vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk);
1459 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0),
1460 __raw_readl(EXYNOS4_VPLL_CON1), pll_4650c);
1461 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
1462 apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_APLL_CON0));
1463 mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0));
1464 epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0),
1465 __raw_readl(EXYNOS4_EPLL_CON1));
1466
1467 vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk);
1468 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0),
1469 __raw_readl(EXYNOS4_VPLL_CON1));
1470 } else {
1471 /* nothing */
1472 }
1473
1474 clk_fout_apll.ops = &exynos4_fout_apll_ops;
1475 clk_fout_mpll.rate = mpll;
1476 clk_fout_epll.rate = epll;
1477 clk_fout_vpll.ops = &exynos4_vpll_ops;
1478 clk_fout_vpll.rate = vpll;
1479
1480 printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
1481 apll, mpll, epll, vpll);
1482
1483 armclk = clk_get_rate(&exynos4_clk_armclk.clk);
1484 sclk_dmc = clk_get_rate(&exynos4_clk_sclk_dmc.clk);
1485
1486 aclk_200 = clk_get_rate(&exynos4_clk_aclk_200.clk);
1487 aclk_100 = clk_get_rate(&exynos4_clk_aclk_100.clk);
1488 aclk_160 = clk_get_rate(&exynos4_clk_aclk_160.clk);
1489 aclk_133 = clk_get_rate(&exynos4_clk_aclk_133.clk);
1490
1491 printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
1492 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1493 armclk, sclk_dmc, aclk_200,
1494 aclk_100, aclk_160, aclk_133);
1495
1496 clk_f.rate = armclk;
1497 clk_h.rate = sclk_dmc;
1498 clk_p.rate = aclk_100;
1499
1500 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrcs); ptr++)
1501 s3c_set_clksrc(&exynos4_clksrcs[ptr], true);
1502}
1503
1504static struct clk *exynos4_clks[] __initdata = {
1505 &exynos4_clk_sclk_hdmi27m,
1506 &exynos4_clk_sclk_hdmiphy,
1507 &exynos4_clk_sclk_usbphy0,
1508 &exynos4_clk_sclk_usbphy1,
1509};
1510
1511#ifdef CONFIG_PM_SLEEP
1512static int exynos4_clock_suspend(void)
1513{
1514 s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1515 return 0;
1516}
1517
1518static void exynos4_clock_resume(void)
1519{
1520 s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1521}
1522
1523#else
1524#define exynos4_clock_suspend NULL
1525#define exynos4_clock_resume NULL
1526#endif
1527
1528static struct syscore_ops exynos4_clock_syscore_ops = {
1529 .suspend = exynos4_clock_suspend,
1530 .resume = exynos4_clock_resume,
1531};
1532
1533void __init exynos4_register_clocks(void)
1534{
1535 int ptr;
1536
1537 s3c24xx_register_clocks(exynos4_clks, ARRAY_SIZE(exynos4_clks));
1538
1539 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sysclks); ptr++)
1540 s3c_register_clksrc(exynos4_sysclks[ptr], 1);
1541
1542 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sclk_tv); ptr++)
1543 s3c_register_clksrc(exynos4_sclk_tv[ptr], 1);
1544
1545 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrc_cdev); ptr++)
1546 s3c_register_clksrc(exynos4_clksrc_cdev[ptr], 1);
1547
1548 s3c_register_clksrc(exynos4_clksrcs, ARRAY_SIZE(exynos4_clksrcs));
1549 s3c_register_clocks(exynos4_init_clocks_on, ARRAY_SIZE(exynos4_init_clocks_on));
1550
1551 s3c24xx_register_clocks(exynos4_clk_cdev, ARRAY_SIZE(exynos4_clk_cdev));
1552 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clk_cdev); ptr++)
1553 s3c_disable_clocks(exynos4_clk_cdev[ptr], 1);
1554
1555 s3c_register_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off));
1556 s3c_disable_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off));
1557 clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup));
1558
1559 register_syscore_ops(&exynos4_clock_syscore_ops);
1560 s3c24xx_register_clock(&dummy_apb_pclk);
1561
1562 s3c_pwmclk_init();
1563}
diff --git a/arch/arm/mach-exynos/clock-exynos4.h b/arch/arm/mach-exynos/clock-exynos4.h
new file mode 100644
index 000000000000..cb71c29c14d1
--- /dev/null
+++ b/arch/arm/mach-exynos/clock-exynos4.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Header file for exynos4 clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __ASM_ARCH_CLOCK_H
13#define __ASM_ARCH_CLOCK_H __FILE__
14
15#include <linux/clk.h>
16
17extern struct clksrc_clk exynos4_clk_aclk_133;
18extern struct clksrc_clk exynos4_clk_mout_mpll;
19
20extern struct clksrc_sources exynos4_clkset_mout_corebus;
21extern struct clksrc_sources exynos4_clkset_group;
22
23extern struct clk *exynos4_clkset_aclk_top_list[];
24extern struct clk *exynos4_clkset_group_list[];
25
26extern int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable);
27extern int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable);
28extern int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable);
29
30#endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/mach-exynos/clock-exynos4210.c b/arch/arm/mach-exynos/clock-exynos4210.c
index 54a92efcf5b1..3b131e4b6ef5 100644
--- a/arch/arm/mach-exynos/clock-exynos4210.c
+++ b/arch/arm/mach-exynos/clock-exynos4210.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-exynos4/clock-exynos4210.c 2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com 3 * http://www.samsung.com
6 * 4 *
7 * EXYNOS4210 - Clock support 5 * EXYNOS4210 - Clock support
@@ -28,20 +26,20 @@
28#include <mach/hardware.h> 26#include <mach/hardware.h>
29#include <mach/map.h> 27#include <mach/map.h>
30#include <mach/regs-clock.h> 28#include <mach/regs-clock.h>
31#include <mach/exynos4-clock.h>
32 29
33#include "common.h" 30#include "common.h"
31#include "clock-exynos4.h"
34 32
35#ifdef CONFIG_PM_SLEEP 33#ifdef CONFIG_PM_SLEEP
36static struct sleep_save exynos4210_clock_save[] = { 34static struct sleep_save exynos4210_clock_save[] = {
37 SAVE_ITEM(S5P_CLKSRC_IMAGE), 35 SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE),
38 SAVE_ITEM(S5P_CLKSRC_LCD1), 36 SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE),
39 SAVE_ITEM(S5P_CLKDIV_IMAGE), 37 SAVE_ITEM(EXYNOS4210_CLKSRC_LCD1),
40 SAVE_ITEM(S5P_CLKDIV_LCD1), 38 SAVE_ITEM(EXYNOS4210_CLKDIV_LCD1),
41 SAVE_ITEM(S5P_CLKSRC_MASK_LCD1), 39 SAVE_ITEM(EXYNOS4210_CLKSRC_MASK_LCD1),
42 SAVE_ITEM(S5P_CLKGATE_IP_IMAGE_4210), 40 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_IMAGE),
43 SAVE_ITEM(S5P_CLKGATE_IP_LCD1), 41 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_LCD1),
44 SAVE_ITEM(S5P_CLKGATE_IP_PERIR_4210), 42 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_PERIR),
45}; 43};
46#endif 44#endif
47 45
@@ -51,7 +49,7 @@ static struct clksrc_clk *sysclks[] = {
51 49
52static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable) 50static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable)
53{ 51{
54 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable); 52 return s5p_gatectrl(EXYNOS4210_CLKSRC_MASK_LCD1, clk, enable);
55} 53}
56 54
57static struct clksrc_clk clksrcs[] = { 55static struct clksrc_clk clksrcs[] = {
@@ -62,9 +60,9 @@ static struct clksrc_clk clksrcs[] = {
62 .enable = exynos4_clksrc_mask_fsys_ctrl, 60 .enable = exynos4_clksrc_mask_fsys_ctrl,
63 .ctrlbit = (1 << 24), 61 .ctrlbit = (1 << 24),
64 }, 62 },
65 .sources = &clkset_mout_corebus, 63 .sources = &exynos4_clkset_mout_corebus,
66 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 }, 64 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 24, .size = 1 },
67 .reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 }, 65 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS0, .shift = 20, .size = 4 },
68 }, { 66 }, {
69 .clk = { 67 .clk = {
70 .name = "sclk_fimd", 68 .name = "sclk_fimd",
@@ -72,9 +70,9 @@ static struct clksrc_clk clksrcs[] = {
72 .enable = exynos4_clksrc_mask_lcd1_ctrl, 70 .enable = exynos4_clksrc_mask_lcd1_ctrl,
73 .ctrlbit = (1 << 0), 71 .ctrlbit = (1 << 0),
74 }, 72 },
75 .sources = &clkset_group, 73 .sources = &exynos4_clkset_group,
76 .reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 }, 74 .reg_src = { .reg = EXYNOS4210_CLKSRC_LCD1, .shift = 0, .size = 4 },
77 .reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 }, 75 .reg_div = { .reg = EXYNOS4210_CLKDIV_LCD1, .shift = 0, .size = 4 },
78 }, 76 },
79}; 77};
80 78
@@ -82,13 +80,13 @@ static struct clk init_clocks_off[] = {
82 { 80 {
83 .name = "sataphy", 81 .name = "sataphy",
84 .id = -1, 82 .id = -1,
85 .parent = &clk_aclk_133.clk, 83 .parent = &exynos4_clk_aclk_133.clk,
86 .enable = exynos4_clk_ip_fsys_ctrl, 84 .enable = exynos4_clk_ip_fsys_ctrl,
87 .ctrlbit = (1 << 3), 85 .ctrlbit = (1 << 3),
88 }, { 86 }, {
89 .name = "sata", 87 .name = "sata",
90 .id = -1, 88 .id = -1,
91 .parent = &clk_aclk_133.clk, 89 .parent = &exynos4_clk_aclk_133.clk,
92 .enable = exynos4_clk_ip_fsys_ctrl, 90 .enable = exynos4_clk_ip_fsys_ctrl,
93 .ctrlbit = (1 << 10), 91 .ctrlbit = (1 << 10),
94 }, { 92 }, {
@@ -126,9 +124,9 @@ void __init exynos4210_register_clocks(void)
126{ 124{
127 int ptr; 125 int ptr;
128 126
129 clk_mout_mpll.reg_src.reg = S5P_CLKSRC_CPU; 127 exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_CPU;
130 clk_mout_mpll.reg_src.shift = 8; 128 exynos4_clk_mout_mpll.reg_src.shift = 8;
131 clk_mout_mpll.reg_src.size = 1; 129 exynos4_clk_mout_mpll.reg_src.size = 1;
132 130
133 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 131 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
134 s3c_register_clksrc(sysclks[ptr], 1); 132 s3c_register_clksrc(sysclks[ptr], 1);
diff --git a/arch/arm/mach-exynos/clock-exynos4212.c b/arch/arm/mach-exynos/clock-exynos4212.c
index 8e07ab13ff19..3ecc01e06f74 100644
--- a/arch/arm/mach-exynos/clock-exynos4212.c
+++ b/arch/arm/mach-exynos/clock-exynos4212.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-exynos4/clock-exynos4212.c 2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com 3 * http://www.samsung.com
6 * 4 *
7 * EXYNOS4212 - Clock support 5 * EXYNOS4212 - Clock support
@@ -28,22 +26,22 @@
28#include <mach/hardware.h> 26#include <mach/hardware.h>
29#include <mach/map.h> 27#include <mach/map.h>
30#include <mach/regs-clock.h> 28#include <mach/regs-clock.h>
31#include <mach/exynos4-clock.h>
32 29
33#include "common.h" 30#include "common.h"
31#include "clock-exynos4.h"
34 32
35#ifdef CONFIG_PM_SLEEP 33#ifdef CONFIG_PM_SLEEP
36static struct sleep_save exynos4212_clock_save[] = { 34static struct sleep_save exynos4212_clock_save[] = {
37 SAVE_ITEM(S5P_CLKSRC_IMAGE), 35 SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE),
38 SAVE_ITEM(S5P_CLKDIV_IMAGE), 36 SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE),
39 SAVE_ITEM(S5P_CLKGATE_IP_IMAGE_4212), 37 SAVE_ITEM(EXYNOS4212_CLKGATE_IP_IMAGE),
40 SAVE_ITEM(S5P_CLKGATE_IP_PERIR_4212), 38 SAVE_ITEM(EXYNOS4212_CLKGATE_IP_PERIR),
41}; 39};
42#endif 40#endif
43 41
44static struct clk *clk_src_mpll_user_list[] = { 42static struct clk *clk_src_mpll_user_list[] = {
45 [0] = &clk_fin_mpll, 43 [0] = &clk_fin_mpll,
46 [1] = &clk_mout_mpll.clk, 44 [1] = &exynos4_clk_mout_mpll.clk,
47}; 45};
48 46
49static struct clksrc_sources clk_src_mpll_user = { 47static struct clksrc_sources clk_src_mpll_user = {
@@ -56,7 +54,7 @@ static struct clksrc_clk clk_mout_mpll_user = {
56 .name = "mout_mpll_user", 54 .name = "mout_mpll_user",
57 }, 55 },
58 .sources = &clk_src_mpll_user, 56 .sources = &clk_src_mpll_user,
59 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 24, .size = 1 }, 57 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 24, .size = 1 },
60}; 58};
61 59
62static struct clksrc_clk *sysclks[] = { 60static struct clksrc_clk *sysclks[] = {
@@ -99,15 +97,15 @@ void __init exynos4212_register_clocks(void)
99 int ptr; 97 int ptr;
100 98
101 /* usbphy1 is removed */ 99 /* usbphy1 is removed */
102 clkset_group_list[4] = NULL; 100 exynos4_clkset_group_list[4] = NULL;
103 101
104 /* mout_mpll_user is used */ 102 /* mout_mpll_user is used */
105 clkset_group_list[6] = &clk_mout_mpll_user.clk; 103 exynos4_clkset_group_list[6] = &clk_mout_mpll_user.clk;
106 clkset_aclk_top_list[0] = &clk_mout_mpll_user.clk; 104 exynos4_clkset_aclk_top_list[0] = &clk_mout_mpll_user.clk;
107 105
108 clk_mout_mpll.reg_src.reg = S5P_CLKSRC_DMC; 106 exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_DMC;
109 clk_mout_mpll.reg_src.shift = 12; 107 exynos4_clk_mout_mpll.reg_src.shift = 12;
110 clk_mout_mpll.reg_src.size = 1; 108 exynos4_clk_mout_mpll.reg_src.size = 1;
111 109
112 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 110 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
113 s3c_register_clksrc(sysclks[ptr], 1); 111 s3c_register_clksrc(sysclks[ptr], 1);
diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c
deleted file mode 100644
index 200874e82dcd..000000000000
--- a/arch/arm/mach-exynos/clock.c
+++ /dev/null
@@ -1,1564 +0,0 @@
1/* linux/arch/arm/mach-exynos4/clock.c
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 - Clock support
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/kernel.h>
14#include <linux/err.h>
15#include <linux/io.h>
16#include <linux/syscore_ops.h>
17
18#include <plat/cpu-freq.h>
19#include <plat/clock.h>
20#include <plat/cpu.h>
21#include <plat/pll.h>
22#include <plat/s5p-clock.h>
23#include <plat/clock-clksrc.h>
24#include <plat/pm.h>
25
26#include <mach/map.h>
27#include <mach/regs-clock.h>
28#include <mach/sysmmu.h>
29#include <mach/exynos4-clock.h>
30
31#include "common.h"
32
33#ifdef CONFIG_PM_SLEEP
34static struct sleep_save exynos4_clock_save[] = {
35 SAVE_ITEM(S5P_CLKDIV_LEFTBUS),
36 SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS),
37 SAVE_ITEM(S5P_CLKDIV_RIGHTBUS),
38 SAVE_ITEM(S5P_CLKGATE_IP_RIGHTBUS),
39 SAVE_ITEM(S5P_CLKSRC_TOP0),
40 SAVE_ITEM(S5P_CLKSRC_TOP1),
41 SAVE_ITEM(S5P_CLKSRC_CAM),
42 SAVE_ITEM(S5P_CLKSRC_TV),
43 SAVE_ITEM(S5P_CLKSRC_MFC),
44 SAVE_ITEM(S5P_CLKSRC_G3D),
45 SAVE_ITEM(S5P_CLKSRC_LCD0),
46 SAVE_ITEM(S5P_CLKSRC_MAUDIO),
47 SAVE_ITEM(S5P_CLKSRC_FSYS),
48 SAVE_ITEM(S5P_CLKSRC_PERIL0),
49 SAVE_ITEM(S5P_CLKSRC_PERIL1),
50 SAVE_ITEM(S5P_CLKDIV_CAM),
51 SAVE_ITEM(S5P_CLKDIV_TV),
52 SAVE_ITEM(S5P_CLKDIV_MFC),
53 SAVE_ITEM(S5P_CLKDIV_G3D),
54 SAVE_ITEM(S5P_CLKDIV_LCD0),
55 SAVE_ITEM(S5P_CLKDIV_MAUDIO),
56 SAVE_ITEM(S5P_CLKDIV_FSYS0),
57 SAVE_ITEM(S5P_CLKDIV_FSYS1),
58 SAVE_ITEM(S5P_CLKDIV_FSYS2),
59 SAVE_ITEM(S5P_CLKDIV_FSYS3),
60 SAVE_ITEM(S5P_CLKDIV_PERIL0),
61 SAVE_ITEM(S5P_CLKDIV_PERIL1),
62 SAVE_ITEM(S5P_CLKDIV_PERIL2),
63 SAVE_ITEM(S5P_CLKDIV_PERIL3),
64 SAVE_ITEM(S5P_CLKDIV_PERIL4),
65 SAVE_ITEM(S5P_CLKDIV_PERIL5),
66 SAVE_ITEM(S5P_CLKDIV_TOP),
67 SAVE_ITEM(S5P_CLKSRC_MASK_TOP),
68 SAVE_ITEM(S5P_CLKSRC_MASK_CAM),
69 SAVE_ITEM(S5P_CLKSRC_MASK_TV),
70 SAVE_ITEM(S5P_CLKSRC_MASK_LCD0),
71 SAVE_ITEM(S5P_CLKSRC_MASK_MAUDIO),
72 SAVE_ITEM(S5P_CLKSRC_MASK_FSYS),
73 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL0),
74 SAVE_ITEM(S5P_CLKSRC_MASK_PERIL1),
75 SAVE_ITEM(S5P_CLKDIV2_RATIO),
76 SAVE_ITEM(S5P_CLKGATE_SCLKCAM),
77 SAVE_ITEM(S5P_CLKGATE_IP_CAM),
78 SAVE_ITEM(S5P_CLKGATE_IP_TV),
79 SAVE_ITEM(S5P_CLKGATE_IP_MFC),
80 SAVE_ITEM(S5P_CLKGATE_IP_G3D),
81 SAVE_ITEM(S5P_CLKGATE_IP_LCD0),
82 SAVE_ITEM(S5P_CLKGATE_IP_FSYS),
83 SAVE_ITEM(S5P_CLKGATE_IP_GPS),
84 SAVE_ITEM(S5P_CLKGATE_IP_PERIL),
85 SAVE_ITEM(S5P_CLKGATE_BLOCK),
86 SAVE_ITEM(S5P_CLKSRC_MASK_DMC),
87 SAVE_ITEM(S5P_CLKSRC_DMC),
88 SAVE_ITEM(S5P_CLKDIV_DMC0),
89 SAVE_ITEM(S5P_CLKDIV_DMC1),
90 SAVE_ITEM(S5P_CLKGATE_IP_DMC),
91 SAVE_ITEM(S5P_CLKSRC_CPU),
92 SAVE_ITEM(S5P_CLKDIV_CPU),
93 SAVE_ITEM(S5P_CLKDIV_CPU + 0x4),
94 SAVE_ITEM(S5P_CLKGATE_SCLKCPU),
95 SAVE_ITEM(S5P_CLKGATE_IP_CPU),
96};
97#endif
98
99struct clk clk_sclk_hdmi27m = {
100 .name = "sclk_hdmi27m",
101 .rate = 27000000,
102};
103
104struct clk clk_sclk_hdmiphy = {
105 .name = "sclk_hdmiphy",
106};
107
108struct clk clk_sclk_usbphy0 = {
109 .name = "sclk_usbphy0",
110 .rate = 27000000,
111};
112
113struct clk clk_sclk_usbphy1 = {
114 .name = "sclk_usbphy1",
115};
116
117static struct clk dummy_apb_pclk = {
118 .name = "apb_pclk",
119 .id = -1,
120};
121
122static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
123{
124 return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable);
125}
126
127static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
128{
129 return s5p_gatectrl(S5P_CLKSRC_MASK_CAM, clk, enable);
130}
131
132static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
133{
134 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable);
135}
136
137int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
138{
139 return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable);
140}
141
142static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
143{
144 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable);
145}
146
147static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
148{
149 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable);
150}
151
152static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable)
153{
154 return s5p_gatectrl(S5P_CLKGATE_IP_MFC, clk, enable);
155}
156
157static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
158{
159 return s5p_gatectrl(S5P_CLKSRC_MASK_TV, clk, enable);
160}
161
162static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
163{
164 return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
165}
166
167static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable)
168{
169 return s5p_gatectrl(S5P_CLKGATE_IP_TV, clk, enable);
170}
171
172static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
173{
174 return s5p_gatectrl(S5P_CLKGATE_IP_IMAGE, clk, enable);
175}
176
177static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
178{
179 return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable);
180}
181
182int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
183{
184 return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable);
185}
186
187int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
188{
189 return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable);
190}
191
192static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
193{
194 return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable);
195}
196
197static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
198{
199 return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
200}
201
202static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
203{
204 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
205}
206
207static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
208{
209 return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
210}
211
212/* Core list of CMU_CPU side */
213
214static struct clksrc_clk clk_mout_apll = {
215 .clk = {
216 .name = "mout_apll",
217 },
218 .sources = &clk_src_apll,
219 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 0, .size = 1 },
220};
221
222struct clksrc_clk clk_sclk_apll = {
223 .clk = {
224 .name = "sclk_apll",
225 .parent = &clk_mout_apll.clk,
226 },
227 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 24, .size = 3 },
228};
229
230struct clksrc_clk clk_mout_epll = {
231 .clk = {
232 .name = "mout_epll",
233 },
234 .sources = &clk_src_epll,
235 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 4, .size = 1 },
236};
237
238struct clksrc_clk clk_mout_mpll = {
239 .clk = {
240 .name = "mout_mpll",
241 },
242 .sources = &clk_src_mpll,
243
244 /* reg_src will be added in each SoCs' clock */
245};
246
247static struct clk *clkset_moutcore_list[] = {
248 [0] = &clk_mout_apll.clk,
249 [1] = &clk_mout_mpll.clk,
250};
251
252static struct clksrc_sources clkset_moutcore = {
253 .sources = clkset_moutcore_list,
254 .nr_sources = ARRAY_SIZE(clkset_moutcore_list),
255};
256
257static struct clksrc_clk clk_moutcore = {
258 .clk = {
259 .name = "moutcore",
260 },
261 .sources = &clkset_moutcore,
262 .reg_src = { .reg = S5P_CLKSRC_CPU, .shift = 16, .size = 1 },
263};
264
265static struct clksrc_clk clk_coreclk = {
266 .clk = {
267 .name = "core_clk",
268 .parent = &clk_moutcore.clk,
269 },
270 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 0, .size = 3 },
271};
272
273static struct clksrc_clk clk_armclk = {
274 .clk = {
275 .name = "armclk",
276 .parent = &clk_coreclk.clk,
277 },
278};
279
280static struct clksrc_clk clk_aclk_corem0 = {
281 .clk = {
282 .name = "aclk_corem0",
283 .parent = &clk_coreclk.clk,
284 },
285 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
286};
287
288static struct clksrc_clk clk_aclk_cores = {
289 .clk = {
290 .name = "aclk_cores",
291 .parent = &clk_coreclk.clk,
292 },
293 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 4, .size = 3 },
294};
295
296static struct clksrc_clk clk_aclk_corem1 = {
297 .clk = {
298 .name = "aclk_corem1",
299 .parent = &clk_coreclk.clk,
300 },
301 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 8, .size = 3 },
302};
303
304static struct clksrc_clk clk_periphclk = {
305 .clk = {
306 .name = "periphclk",
307 .parent = &clk_coreclk.clk,
308 },
309 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 },
310};
311
312/* Core list of CMU_CORE side */
313
314struct clk *clkset_corebus_list[] = {
315 [0] = &clk_mout_mpll.clk,
316 [1] = &clk_sclk_apll.clk,
317};
318
319struct clksrc_sources clkset_mout_corebus = {
320 .sources = clkset_corebus_list,
321 .nr_sources = ARRAY_SIZE(clkset_corebus_list),
322};
323
324static struct clksrc_clk clk_mout_corebus = {
325 .clk = {
326 .name = "mout_corebus",
327 },
328 .sources = &clkset_mout_corebus,
329 .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 },
330};
331
332static struct clksrc_clk clk_sclk_dmc = {
333 .clk = {
334 .name = "sclk_dmc",
335 .parent = &clk_mout_corebus.clk,
336 },
337 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 },
338};
339
340static struct clksrc_clk clk_aclk_cored = {
341 .clk = {
342 .name = "aclk_cored",
343 .parent = &clk_sclk_dmc.clk,
344 },
345 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 },
346};
347
348static struct clksrc_clk clk_aclk_corep = {
349 .clk = {
350 .name = "aclk_corep",
351 .parent = &clk_aclk_cored.clk,
352 },
353 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 },
354};
355
356static struct clksrc_clk clk_aclk_acp = {
357 .clk = {
358 .name = "aclk_acp",
359 .parent = &clk_mout_corebus.clk,
360 },
361 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 },
362};
363
364static struct clksrc_clk clk_pclk_acp = {
365 .clk = {
366 .name = "pclk_acp",
367 .parent = &clk_aclk_acp.clk,
368 },
369 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 },
370};
371
372/* Core list of CMU_TOP side */
373
374struct clk *clkset_aclk_top_list[] = {
375 [0] = &clk_mout_mpll.clk,
376 [1] = &clk_sclk_apll.clk,
377};
378
379struct clksrc_sources clkset_aclk = {
380 .sources = clkset_aclk_top_list,
381 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list),
382};
383
384static struct clksrc_clk clk_aclk_200 = {
385 .clk = {
386 .name = "aclk_200",
387 },
388 .sources = &clkset_aclk,
389 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 },
390 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 },
391};
392
393static struct clksrc_clk clk_aclk_100 = {
394 .clk = {
395 .name = "aclk_100",
396 },
397 .sources = &clkset_aclk,
398 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 },
399 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 },
400};
401
402static struct clksrc_clk clk_aclk_160 = {
403 .clk = {
404 .name = "aclk_160",
405 },
406 .sources = &clkset_aclk,
407 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 },
408 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 },
409};
410
411struct clksrc_clk clk_aclk_133 = {
412 .clk = {
413 .name = "aclk_133",
414 },
415 .sources = &clkset_aclk,
416 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 },
417 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 },
418};
419
420static struct clk *clkset_vpllsrc_list[] = {
421 [0] = &clk_fin_vpll,
422 [1] = &clk_sclk_hdmi27m,
423};
424
425static struct clksrc_sources clkset_vpllsrc = {
426 .sources = clkset_vpllsrc_list,
427 .nr_sources = ARRAY_SIZE(clkset_vpllsrc_list),
428};
429
430static struct clksrc_clk clk_vpllsrc = {
431 .clk = {
432 .name = "vpll_src",
433 .enable = exynos4_clksrc_mask_top_ctrl,
434 .ctrlbit = (1 << 0),
435 },
436 .sources = &clkset_vpllsrc,
437 .reg_src = { .reg = S5P_CLKSRC_TOP1, .shift = 0, .size = 1 },
438};
439
440static struct clk *clkset_sclk_vpll_list[] = {
441 [0] = &clk_vpllsrc.clk,
442 [1] = &clk_fout_vpll,
443};
444
445static struct clksrc_sources clkset_sclk_vpll = {
446 .sources = clkset_sclk_vpll_list,
447 .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list),
448};
449
450struct clksrc_clk clk_sclk_vpll = {
451 .clk = {
452 .name = "sclk_vpll",
453 },
454 .sources = &clkset_sclk_vpll,
455 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 },
456};
457
458static struct clk init_clocks_off[] = {
459 {
460 .name = "timers",
461 .parent = &clk_aclk_100.clk,
462 .enable = exynos4_clk_ip_peril_ctrl,
463 .ctrlbit = (1<<24),
464 }, {
465 .name = "csis",
466 .devname = "s5p-mipi-csis.0",
467 .enable = exynos4_clk_ip_cam_ctrl,
468 .ctrlbit = (1 << 4),
469 }, {
470 .name = "csis",
471 .devname = "s5p-mipi-csis.1",
472 .enable = exynos4_clk_ip_cam_ctrl,
473 .ctrlbit = (1 << 5),
474 }, {
475 .name = "fimc",
476 .devname = "exynos4-fimc.0",
477 .enable = exynos4_clk_ip_cam_ctrl,
478 .ctrlbit = (1 << 0),
479 }, {
480 .name = "fimc",
481 .devname = "exynos4-fimc.1",
482 .enable = exynos4_clk_ip_cam_ctrl,
483 .ctrlbit = (1 << 1),
484 }, {
485 .name = "fimc",
486 .devname = "exynos4-fimc.2",
487 .enable = exynos4_clk_ip_cam_ctrl,
488 .ctrlbit = (1 << 2),
489 }, {
490 .name = "fimc",
491 .devname = "exynos4-fimc.3",
492 .enable = exynos4_clk_ip_cam_ctrl,
493 .ctrlbit = (1 << 3),
494 }, {
495 .name = "fimd",
496 .devname = "exynos4-fb.0",
497 .enable = exynos4_clk_ip_lcd0_ctrl,
498 .ctrlbit = (1 << 0),
499 }, {
500 .name = "hsmmc",
501 .devname = "s3c-sdhci.0",
502 .parent = &clk_aclk_133.clk,
503 .enable = exynos4_clk_ip_fsys_ctrl,
504 .ctrlbit = (1 << 5),
505 }, {
506 .name = "hsmmc",
507 .devname = "s3c-sdhci.1",
508 .parent = &clk_aclk_133.clk,
509 .enable = exynos4_clk_ip_fsys_ctrl,
510 .ctrlbit = (1 << 6),
511 }, {
512 .name = "hsmmc",
513 .devname = "s3c-sdhci.2",
514 .parent = &clk_aclk_133.clk,
515 .enable = exynos4_clk_ip_fsys_ctrl,
516 .ctrlbit = (1 << 7),
517 }, {
518 .name = "hsmmc",
519 .devname = "s3c-sdhci.3",
520 .parent = &clk_aclk_133.clk,
521 .enable = exynos4_clk_ip_fsys_ctrl,
522 .ctrlbit = (1 << 8),
523 }, {
524 .name = "dwmmc",
525 .parent = &clk_aclk_133.clk,
526 .enable = exynos4_clk_ip_fsys_ctrl,
527 .ctrlbit = (1 << 9),
528 }, {
529 .name = "dac",
530 .devname = "s5p-sdo",
531 .enable = exynos4_clk_ip_tv_ctrl,
532 .ctrlbit = (1 << 2),
533 }, {
534 .name = "mixer",
535 .devname = "s5p-mixer",
536 .enable = exynos4_clk_ip_tv_ctrl,
537 .ctrlbit = (1 << 1),
538 }, {
539 .name = "vp",
540 .devname = "s5p-mixer",
541 .enable = exynos4_clk_ip_tv_ctrl,
542 .ctrlbit = (1 << 0),
543 }, {
544 .name = "hdmi",
545 .devname = "exynos4-hdmi",
546 .enable = exynos4_clk_ip_tv_ctrl,
547 .ctrlbit = (1 << 3),
548 }, {
549 .name = "hdmiphy",
550 .devname = "exynos4-hdmi",
551 .enable = exynos4_clk_hdmiphy_ctrl,
552 .ctrlbit = (1 << 0),
553 }, {
554 .name = "dacphy",
555 .devname = "s5p-sdo",
556 .enable = exynos4_clk_dac_ctrl,
557 .ctrlbit = (1 << 0),
558 }, {
559 .name = "adc",
560 .enable = exynos4_clk_ip_peril_ctrl,
561 .ctrlbit = (1 << 15),
562 }, {
563 .name = "keypad",
564 .enable = exynos4_clk_ip_perir_ctrl,
565 .ctrlbit = (1 << 16),
566 }, {
567 .name = "rtc",
568 .enable = exynos4_clk_ip_perir_ctrl,
569 .ctrlbit = (1 << 15),
570 }, {
571 .name = "watchdog",
572 .parent = &clk_aclk_100.clk,
573 .enable = exynos4_clk_ip_perir_ctrl,
574 .ctrlbit = (1 << 14),
575 }, {
576 .name = "usbhost",
577 .enable = exynos4_clk_ip_fsys_ctrl ,
578 .ctrlbit = (1 << 12),
579 }, {
580 .name = "otg",
581 .enable = exynos4_clk_ip_fsys_ctrl,
582 .ctrlbit = (1 << 13),
583 }, {
584 .name = "spi",
585 .devname = "s3c64xx-spi.0",
586 .enable = exynos4_clk_ip_peril_ctrl,
587 .ctrlbit = (1 << 16),
588 }, {
589 .name = "spi",
590 .devname = "s3c64xx-spi.1",
591 .enable = exynos4_clk_ip_peril_ctrl,
592 .ctrlbit = (1 << 17),
593 }, {
594 .name = "spi",
595 .devname = "s3c64xx-spi.2",
596 .enable = exynos4_clk_ip_peril_ctrl,
597 .ctrlbit = (1 << 18),
598 }, {
599 .name = "iis",
600 .devname = "samsung-i2s.0",
601 .enable = exynos4_clk_ip_peril_ctrl,
602 .ctrlbit = (1 << 19),
603 }, {
604 .name = "iis",
605 .devname = "samsung-i2s.1",
606 .enable = exynos4_clk_ip_peril_ctrl,
607 .ctrlbit = (1 << 20),
608 }, {
609 .name = "iis",
610 .devname = "samsung-i2s.2",
611 .enable = exynos4_clk_ip_peril_ctrl,
612 .ctrlbit = (1 << 21),
613 }, {
614 .name = "ac97",
615 .devname = "samsung-ac97",
616 .enable = exynos4_clk_ip_peril_ctrl,
617 .ctrlbit = (1 << 27),
618 }, {
619 .name = "fimg2d",
620 .enable = exynos4_clk_ip_image_ctrl,
621 .ctrlbit = (1 << 0),
622 }, {
623 .name = "mfc",
624 .devname = "s5p-mfc",
625 .enable = exynos4_clk_ip_mfc_ctrl,
626 .ctrlbit = (1 << 0),
627 }, {
628 .name = "i2c",
629 .devname = "s3c2440-i2c.0",
630 .parent = &clk_aclk_100.clk,
631 .enable = exynos4_clk_ip_peril_ctrl,
632 .ctrlbit = (1 << 6),
633 }, {
634 .name = "i2c",
635 .devname = "s3c2440-i2c.1",
636 .parent = &clk_aclk_100.clk,
637 .enable = exynos4_clk_ip_peril_ctrl,
638 .ctrlbit = (1 << 7),
639 }, {
640 .name = "i2c",
641 .devname = "s3c2440-i2c.2",
642 .parent = &clk_aclk_100.clk,
643 .enable = exynos4_clk_ip_peril_ctrl,
644 .ctrlbit = (1 << 8),
645 }, {
646 .name = "i2c",
647 .devname = "s3c2440-i2c.3",
648 .parent = &clk_aclk_100.clk,
649 .enable = exynos4_clk_ip_peril_ctrl,
650 .ctrlbit = (1 << 9),
651 }, {
652 .name = "i2c",
653 .devname = "s3c2440-i2c.4",
654 .parent = &clk_aclk_100.clk,
655 .enable = exynos4_clk_ip_peril_ctrl,
656 .ctrlbit = (1 << 10),
657 }, {
658 .name = "i2c",
659 .devname = "s3c2440-i2c.5",
660 .parent = &clk_aclk_100.clk,
661 .enable = exynos4_clk_ip_peril_ctrl,
662 .ctrlbit = (1 << 11),
663 }, {
664 .name = "i2c",
665 .devname = "s3c2440-i2c.6",
666 .parent = &clk_aclk_100.clk,
667 .enable = exynos4_clk_ip_peril_ctrl,
668 .ctrlbit = (1 << 12),
669 }, {
670 .name = "i2c",
671 .devname = "s3c2440-i2c.7",
672 .parent = &clk_aclk_100.clk,
673 .enable = exynos4_clk_ip_peril_ctrl,
674 .ctrlbit = (1 << 13),
675 }, {
676 .name = "i2c",
677 .devname = "s3c2440-hdmiphy-i2c",
678 .parent = &clk_aclk_100.clk,
679 .enable = exynos4_clk_ip_peril_ctrl,
680 .ctrlbit = (1 << 14),
681 }, {
682 .name = "SYSMMU_MDMA",
683 .enable = exynos4_clk_ip_image_ctrl,
684 .ctrlbit = (1 << 5),
685 }, {
686 .name = "SYSMMU_FIMC0",
687 .enable = exynos4_clk_ip_cam_ctrl,
688 .ctrlbit = (1 << 7),
689 }, {
690 .name = "SYSMMU_FIMC1",
691 .enable = exynos4_clk_ip_cam_ctrl,
692 .ctrlbit = (1 << 8),
693 }, {
694 .name = "SYSMMU_FIMC2",
695 .enable = exynos4_clk_ip_cam_ctrl,
696 .ctrlbit = (1 << 9),
697 }, {
698 .name = "SYSMMU_FIMC3",
699 .enable = exynos4_clk_ip_cam_ctrl,
700 .ctrlbit = (1 << 10),
701 }, {
702 .name = "SYSMMU_JPEG",
703 .enable = exynos4_clk_ip_cam_ctrl,
704 .ctrlbit = (1 << 11),
705 }, {
706 .name = "SYSMMU_FIMD0",
707 .enable = exynos4_clk_ip_lcd0_ctrl,
708 .ctrlbit = (1 << 4),
709 }, {
710 .name = "SYSMMU_FIMD1",
711 .enable = exynos4_clk_ip_lcd1_ctrl,
712 .ctrlbit = (1 << 4),
713 }, {
714 .name = "SYSMMU_PCIe",
715 .enable = exynos4_clk_ip_fsys_ctrl,
716 .ctrlbit = (1 << 18),
717 }, {
718 .name = "SYSMMU_G2D",
719 .enable = exynos4_clk_ip_image_ctrl,
720 .ctrlbit = (1 << 3),
721 }, {
722 .name = "SYSMMU_ROTATOR",
723 .enable = exynos4_clk_ip_image_ctrl,
724 .ctrlbit = (1 << 4),
725 }, {
726 .name = "SYSMMU_TV",
727 .enable = exynos4_clk_ip_tv_ctrl,
728 .ctrlbit = (1 << 4),
729 }, {
730 .name = "SYSMMU_MFC_L",
731 .enable = exynos4_clk_ip_mfc_ctrl,
732 .ctrlbit = (1 << 1),
733 }, {
734 .name = "SYSMMU_MFC_R",
735 .enable = exynos4_clk_ip_mfc_ctrl,
736 .ctrlbit = (1 << 2),
737 }
738};
739
740static struct clk init_clocks[] = {
741 {
742 .name = "uart",
743 .devname = "s5pv210-uart.0",
744 .enable = exynos4_clk_ip_peril_ctrl,
745 .ctrlbit = (1 << 0),
746 }, {
747 .name = "uart",
748 .devname = "s5pv210-uart.1",
749 .enable = exynos4_clk_ip_peril_ctrl,
750 .ctrlbit = (1 << 1),
751 }, {
752 .name = "uart",
753 .devname = "s5pv210-uart.2",
754 .enable = exynos4_clk_ip_peril_ctrl,
755 .ctrlbit = (1 << 2),
756 }, {
757 .name = "uart",
758 .devname = "s5pv210-uart.3",
759 .enable = exynos4_clk_ip_peril_ctrl,
760 .ctrlbit = (1 << 3),
761 }, {
762 .name = "uart",
763 .devname = "s5pv210-uart.4",
764 .enable = exynos4_clk_ip_peril_ctrl,
765 .ctrlbit = (1 << 4),
766 }, {
767 .name = "uart",
768 .devname = "s5pv210-uart.5",
769 .enable = exynos4_clk_ip_peril_ctrl,
770 .ctrlbit = (1 << 5),
771 }
772};
773
774static struct clk clk_pdma0 = {
775 .name = "dma",
776 .devname = "dma-pl330.0",
777 .enable = exynos4_clk_ip_fsys_ctrl,
778 .ctrlbit = (1 << 0),
779};
780
781static struct clk clk_pdma1 = {
782 .name = "dma",
783 .devname = "dma-pl330.1",
784 .enable = exynos4_clk_ip_fsys_ctrl,
785 .ctrlbit = (1 << 1),
786};
787
788struct clk *clkset_group_list[] = {
789 [0] = &clk_ext_xtal_mux,
790 [1] = &clk_xusbxti,
791 [2] = &clk_sclk_hdmi27m,
792 [3] = &clk_sclk_usbphy0,
793 [4] = &clk_sclk_usbphy1,
794 [5] = &clk_sclk_hdmiphy,
795 [6] = &clk_mout_mpll.clk,
796 [7] = &clk_mout_epll.clk,
797 [8] = &clk_sclk_vpll.clk,
798};
799
800struct clksrc_sources clkset_group = {
801 .sources = clkset_group_list,
802 .nr_sources = ARRAY_SIZE(clkset_group_list),
803};
804
805static struct clk *clkset_mout_g2d0_list[] = {
806 [0] = &clk_mout_mpll.clk,
807 [1] = &clk_sclk_apll.clk,
808};
809
810static struct clksrc_sources clkset_mout_g2d0 = {
811 .sources = clkset_mout_g2d0_list,
812 .nr_sources = ARRAY_SIZE(clkset_mout_g2d0_list),
813};
814
815static struct clksrc_clk clk_mout_g2d0 = {
816 .clk = {
817 .name = "mout_g2d0",
818 },
819 .sources = &clkset_mout_g2d0,
820 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 },
821};
822
823static struct clk *clkset_mout_g2d1_list[] = {
824 [0] = &clk_mout_epll.clk,
825 [1] = &clk_sclk_vpll.clk,
826};
827
828static struct clksrc_sources clkset_mout_g2d1 = {
829 .sources = clkset_mout_g2d1_list,
830 .nr_sources = ARRAY_SIZE(clkset_mout_g2d1_list),
831};
832
833static struct clksrc_clk clk_mout_g2d1 = {
834 .clk = {
835 .name = "mout_g2d1",
836 },
837 .sources = &clkset_mout_g2d1,
838 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 },
839};
840
841static struct clk *clkset_mout_g2d_list[] = {
842 [0] = &clk_mout_g2d0.clk,
843 [1] = &clk_mout_g2d1.clk,
844};
845
846static struct clksrc_sources clkset_mout_g2d = {
847 .sources = clkset_mout_g2d_list,
848 .nr_sources = ARRAY_SIZE(clkset_mout_g2d_list),
849};
850
851static struct clk *clkset_mout_mfc0_list[] = {
852 [0] = &clk_mout_mpll.clk,
853 [1] = &clk_sclk_apll.clk,
854};
855
856static struct clksrc_sources clkset_mout_mfc0 = {
857 .sources = clkset_mout_mfc0_list,
858 .nr_sources = ARRAY_SIZE(clkset_mout_mfc0_list),
859};
860
861static struct clksrc_clk clk_mout_mfc0 = {
862 .clk = {
863 .name = "mout_mfc0",
864 },
865 .sources = &clkset_mout_mfc0,
866 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 0, .size = 1 },
867};
868
869static struct clk *clkset_mout_mfc1_list[] = {
870 [0] = &clk_mout_epll.clk,
871 [1] = &clk_sclk_vpll.clk,
872};
873
874static struct clksrc_sources clkset_mout_mfc1 = {
875 .sources = clkset_mout_mfc1_list,
876 .nr_sources = ARRAY_SIZE(clkset_mout_mfc1_list),
877};
878
879static struct clksrc_clk clk_mout_mfc1 = {
880 .clk = {
881 .name = "mout_mfc1",
882 },
883 .sources = &clkset_mout_mfc1,
884 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 4, .size = 1 },
885};
886
887static struct clk *clkset_mout_mfc_list[] = {
888 [0] = &clk_mout_mfc0.clk,
889 [1] = &clk_mout_mfc1.clk,
890};
891
892static struct clksrc_sources clkset_mout_mfc = {
893 .sources = clkset_mout_mfc_list,
894 .nr_sources = ARRAY_SIZE(clkset_mout_mfc_list),
895};
896
897static struct clk *clkset_sclk_dac_list[] = {
898 [0] = &clk_sclk_vpll.clk,
899 [1] = &clk_sclk_hdmiphy,
900};
901
902static struct clksrc_sources clkset_sclk_dac = {
903 .sources = clkset_sclk_dac_list,
904 .nr_sources = ARRAY_SIZE(clkset_sclk_dac_list),
905};
906
907static struct clksrc_clk clk_sclk_dac = {
908 .clk = {
909 .name = "sclk_dac",
910 .enable = exynos4_clksrc_mask_tv_ctrl,
911 .ctrlbit = (1 << 8),
912 },
913 .sources = &clkset_sclk_dac,
914 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 8, .size = 1 },
915};
916
917static struct clksrc_clk clk_sclk_pixel = {
918 .clk = {
919 .name = "sclk_pixel",
920 .parent = &clk_sclk_vpll.clk,
921 },
922 .reg_div = { .reg = S5P_CLKDIV_TV, .shift = 0, .size = 4 },
923};
924
925static struct clk *clkset_sclk_hdmi_list[] = {
926 [0] = &clk_sclk_pixel.clk,
927 [1] = &clk_sclk_hdmiphy,
928};
929
930static struct clksrc_sources clkset_sclk_hdmi = {
931 .sources = clkset_sclk_hdmi_list,
932 .nr_sources = ARRAY_SIZE(clkset_sclk_hdmi_list),
933};
934
935static struct clksrc_clk clk_sclk_hdmi = {
936 .clk = {
937 .name = "sclk_hdmi",
938 .enable = exynos4_clksrc_mask_tv_ctrl,
939 .ctrlbit = (1 << 0),
940 },
941 .sources = &clkset_sclk_hdmi,
942 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 0, .size = 1 },
943};
944
945static struct clk *clkset_sclk_mixer_list[] = {
946 [0] = &clk_sclk_dac.clk,
947 [1] = &clk_sclk_hdmi.clk,
948};
949
950static struct clksrc_sources clkset_sclk_mixer = {
951 .sources = clkset_sclk_mixer_list,
952 .nr_sources = ARRAY_SIZE(clkset_sclk_mixer_list),
953};
954
955static struct clksrc_clk clk_sclk_mixer = {
956 .clk = {
957 .name = "sclk_mixer",
958 .enable = exynos4_clksrc_mask_tv_ctrl,
959 .ctrlbit = (1 << 4),
960 },
961 .sources = &clkset_sclk_mixer,
962 .reg_src = { .reg = S5P_CLKSRC_TV, .shift = 4, .size = 1 },
963};
964
965static struct clksrc_clk *sclk_tv[] = {
966 &clk_sclk_dac,
967 &clk_sclk_pixel,
968 &clk_sclk_hdmi,
969 &clk_sclk_mixer,
970};
971
972static struct clksrc_clk clk_dout_mmc0 = {
973 .clk = {
974 .name = "dout_mmc0",
975 },
976 .sources = &clkset_group,
977 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 },
978 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 0, .size = 4 },
979};
980
981static struct clksrc_clk clk_dout_mmc1 = {
982 .clk = {
983 .name = "dout_mmc1",
984 },
985 .sources = &clkset_group,
986 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 },
987 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 16, .size = 4 },
988};
989
990static struct clksrc_clk clk_dout_mmc2 = {
991 .clk = {
992 .name = "dout_mmc2",
993 },
994 .sources = &clkset_group,
995 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 },
996 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 0, .size = 4 },
997};
998
999static struct clksrc_clk clk_dout_mmc3 = {
1000 .clk = {
1001 .name = "dout_mmc3",
1002 },
1003 .sources = &clkset_group,
1004 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 },
1005 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 16, .size = 4 },
1006};
1007
1008static struct clksrc_clk clk_dout_mmc4 = {
1009 .clk = {
1010 .name = "dout_mmc4",
1011 },
1012 .sources = &clkset_group,
1013 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 },
1014 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 0, .size = 4 },
1015};
1016
1017static struct clksrc_clk clksrcs[] = {
1018 {
1019 .clk = {
1020 .name = "sclk_pwm",
1021 .enable = exynos4_clksrc_mask_peril0_ctrl,
1022 .ctrlbit = (1 << 24),
1023 },
1024 .sources = &clkset_group,
1025 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 },
1026 .reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 },
1027 }, {
1028 .clk = {
1029 .name = "sclk_csis",
1030 .devname = "s5p-mipi-csis.0",
1031 .enable = exynos4_clksrc_mask_cam_ctrl,
1032 .ctrlbit = (1 << 24),
1033 },
1034 .sources = &clkset_group,
1035 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 24, .size = 4 },
1036 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 24, .size = 4 },
1037 }, {
1038 .clk = {
1039 .name = "sclk_csis",
1040 .devname = "s5p-mipi-csis.1",
1041 .enable = exynos4_clksrc_mask_cam_ctrl,
1042 .ctrlbit = (1 << 28),
1043 },
1044 .sources = &clkset_group,
1045 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 28, .size = 4 },
1046 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 },
1047 }, {
1048 .clk = {
1049 .name = "sclk_cam0",
1050 .enable = exynos4_clksrc_mask_cam_ctrl,
1051 .ctrlbit = (1 << 16),
1052 },
1053 .sources = &clkset_group,
1054 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 16, .size = 4 },
1055 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 },
1056 }, {
1057 .clk = {
1058 .name = "sclk_cam1",
1059 .enable = exynos4_clksrc_mask_cam_ctrl,
1060 .ctrlbit = (1 << 20),
1061 },
1062 .sources = &clkset_group,
1063 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 20, .size = 4 },
1064 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 20, .size = 4 },
1065 }, {
1066 .clk = {
1067 .name = "sclk_fimc",
1068 .devname = "exynos4-fimc.0",
1069 .enable = exynos4_clksrc_mask_cam_ctrl,
1070 .ctrlbit = (1 << 0),
1071 },
1072 .sources = &clkset_group,
1073 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 0, .size = 4 },
1074 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 0, .size = 4 },
1075 }, {
1076 .clk = {
1077 .name = "sclk_fimc",
1078 .devname = "exynos4-fimc.1",
1079 .enable = exynos4_clksrc_mask_cam_ctrl,
1080 .ctrlbit = (1 << 4),
1081 },
1082 .sources = &clkset_group,
1083 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 4, .size = 4 },
1084 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 4, .size = 4 },
1085 }, {
1086 .clk = {
1087 .name = "sclk_fimc",
1088 .devname = "exynos4-fimc.2",
1089 .enable = exynos4_clksrc_mask_cam_ctrl,
1090 .ctrlbit = (1 << 8),
1091 },
1092 .sources = &clkset_group,
1093 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 8, .size = 4 },
1094 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 8, .size = 4 },
1095 }, {
1096 .clk = {
1097 .name = "sclk_fimc",
1098 .devname = "exynos4-fimc.3",
1099 .enable = exynos4_clksrc_mask_cam_ctrl,
1100 .ctrlbit = (1 << 12),
1101 },
1102 .sources = &clkset_group,
1103 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 12, .size = 4 },
1104 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 12, .size = 4 },
1105 }, {
1106 .clk = {
1107 .name = "sclk_fimd",
1108 .devname = "exynos4-fb.0",
1109 .enable = exynos4_clksrc_mask_lcd0_ctrl,
1110 .ctrlbit = (1 << 0),
1111 },
1112 .sources = &clkset_group,
1113 .reg_src = { .reg = S5P_CLKSRC_LCD0, .shift = 0, .size = 4 },
1114 .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 },
1115 }, {
1116 .clk = {
1117 .name = "sclk_fimg2d",
1118 },
1119 .sources = &clkset_mout_g2d,
1120 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 },
1121 .reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 },
1122 }, {
1123 .clk = {
1124 .name = "sclk_mfc",
1125 .devname = "s5p-mfc",
1126 },
1127 .sources = &clkset_mout_mfc,
1128 .reg_src = { .reg = S5P_CLKSRC_MFC, .shift = 8, .size = 1 },
1129 .reg_div = { .reg = S5P_CLKDIV_MFC, .shift = 0, .size = 4 },
1130 }, {
1131 .clk = {
1132 .name = "sclk_dwmmc",
1133 .parent = &clk_dout_mmc4.clk,
1134 .enable = exynos4_clksrc_mask_fsys_ctrl,
1135 .ctrlbit = (1 << 16),
1136 },
1137 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 8, .size = 8 },
1138 }
1139};
1140
1141static struct clksrc_clk clk_sclk_uart0 = {
1142 .clk = {
1143 .name = "uclk1",
1144 .devname = "exynos4210-uart.0",
1145 .enable = exynos4_clksrc_mask_peril0_ctrl,
1146 .ctrlbit = (1 << 0),
1147 },
1148 .sources = &clkset_group,
1149 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 0, .size = 4 },
1150 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 0, .size = 4 },
1151};
1152
1153static struct clksrc_clk clk_sclk_uart1 = {
1154 .clk = {
1155 .name = "uclk1",
1156 .devname = "exynos4210-uart.1",
1157 .enable = exynos4_clksrc_mask_peril0_ctrl,
1158 .ctrlbit = (1 << 4),
1159 },
1160 .sources = &clkset_group,
1161 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 4, .size = 4 },
1162 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 4, .size = 4 },
1163};
1164
1165static struct clksrc_clk clk_sclk_uart2 = {
1166 .clk = {
1167 .name = "uclk1",
1168 .devname = "exynos4210-uart.2",
1169 .enable = exynos4_clksrc_mask_peril0_ctrl,
1170 .ctrlbit = (1 << 8),
1171 },
1172 .sources = &clkset_group,
1173 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 8, .size = 4 },
1174 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 8, .size = 4 },
1175};
1176
1177static struct clksrc_clk clk_sclk_uart3 = {
1178 .clk = {
1179 .name = "uclk1",
1180 .devname = "exynos4210-uart.3",
1181 .enable = exynos4_clksrc_mask_peril0_ctrl,
1182 .ctrlbit = (1 << 12),
1183 },
1184 .sources = &clkset_group,
1185 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 12, .size = 4 },
1186 .reg_div = { .reg = S5P_CLKDIV_PERIL0, .shift = 12, .size = 4 },
1187};
1188
1189static struct clksrc_clk clk_sclk_mmc0 = {
1190 .clk = {
1191 .name = "sclk_mmc",
1192 .devname = "s3c-sdhci.0",
1193 .parent = &clk_dout_mmc0.clk,
1194 .enable = exynos4_clksrc_mask_fsys_ctrl,
1195 .ctrlbit = (1 << 0),
1196 },
1197 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 8, .size = 8 },
1198};
1199
1200static struct clksrc_clk clk_sclk_mmc1 = {
1201 .clk = {
1202 .name = "sclk_mmc",
1203 .devname = "s3c-sdhci.1",
1204 .parent = &clk_dout_mmc1.clk,
1205 .enable = exynos4_clksrc_mask_fsys_ctrl,
1206 .ctrlbit = (1 << 4),
1207 },
1208 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 24, .size = 8 },
1209};
1210
1211static struct clksrc_clk clk_sclk_mmc2 = {
1212 .clk = {
1213 .name = "sclk_mmc",
1214 .devname = "s3c-sdhci.2",
1215 .parent = &clk_dout_mmc2.clk,
1216 .enable = exynos4_clksrc_mask_fsys_ctrl,
1217 .ctrlbit = (1 << 8),
1218 },
1219 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 8, .size = 8 },
1220};
1221
1222static struct clksrc_clk clk_sclk_mmc3 = {
1223 .clk = {
1224 .name = "sclk_mmc",
1225 .devname = "s3c-sdhci.3",
1226 .parent = &clk_dout_mmc3.clk,
1227 .enable = exynos4_clksrc_mask_fsys_ctrl,
1228 .ctrlbit = (1 << 12),
1229 },
1230 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1231};
1232
1233static struct clksrc_clk clk_sclk_spi0 = {
1234 .clk = {
1235 .name = "sclk_spi",
1236 .devname = "s3c64xx-spi.0",
1237 .enable = exynos4_clksrc_mask_peril1_ctrl,
1238 .ctrlbit = (1 << 16),
1239 },
1240 .sources = &clkset_group,
1241 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 16, .size = 4 },
1242 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 0, .size = 4 },
1243};
1244
1245static struct clksrc_clk clk_sclk_spi1 = {
1246 .clk = {
1247 .name = "sclk_spi",
1248 .devname = "s3c64xx-spi.1",
1249 .enable = exynos4_clksrc_mask_peril1_ctrl,
1250 .ctrlbit = (1 << 20),
1251 },
1252 .sources = &clkset_group,
1253 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 20, .size = 4 },
1254 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 16, .size = 4 },
1255};
1256
1257static struct clksrc_clk clk_sclk_spi2 = {
1258 .clk = {
1259 .name = "sclk_spi",
1260 .devname = "s3c64xx-spi.2",
1261 .enable = exynos4_clksrc_mask_peril1_ctrl,
1262 .ctrlbit = (1 << 24),
1263 },
1264 .sources = &clkset_group,
1265 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 24, .size = 4 },
1266 .reg_div = { .reg = S5P_CLKDIV_PERIL2, .shift = 0, .size = 4 },
1267};
1268
1269/* Clock initialization code */
1270static struct clksrc_clk *sysclks[] = {
1271 &clk_mout_apll,
1272 &clk_sclk_apll,
1273 &clk_mout_epll,
1274 &clk_mout_mpll,
1275 &clk_moutcore,
1276 &clk_coreclk,
1277 &clk_armclk,
1278 &clk_aclk_corem0,
1279 &clk_aclk_cores,
1280 &clk_aclk_corem1,
1281 &clk_periphclk,
1282 &clk_mout_corebus,
1283 &clk_sclk_dmc,
1284 &clk_aclk_cored,
1285 &clk_aclk_corep,
1286 &clk_aclk_acp,
1287 &clk_pclk_acp,
1288 &clk_vpllsrc,
1289 &clk_sclk_vpll,
1290 &clk_aclk_200,
1291 &clk_aclk_100,
1292 &clk_aclk_160,
1293 &clk_aclk_133,
1294 &clk_dout_mmc0,
1295 &clk_dout_mmc1,
1296 &clk_dout_mmc2,
1297 &clk_dout_mmc3,
1298 &clk_dout_mmc4,
1299 &clk_mout_mfc0,
1300 &clk_mout_mfc1,
1301};
1302
1303static struct clk *clk_cdev[] = {
1304 &clk_pdma0,
1305 &clk_pdma1,
1306};
1307
1308static struct clksrc_clk *clksrc_cdev[] = {
1309 &clk_sclk_uart0,
1310 &clk_sclk_uart1,
1311 &clk_sclk_uart2,
1312 &clk_sclk_uart3,
1313 &clk_sclk_mmc0,
1314 &clk_sclk_mmc1,
1315 &clk_sclk_mmc2,
1316 &clk_sclk_mmc3,
1317 &clk_sclk_spi0,
1318 &clk_sclk_spi1,
1319 &clk_sclk_spi2,
1320
1321};
1322
1323static struct clk_lookup exynos4_clk_lookup[] = {
1324 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &clk_sclk_uart0.clk),
1325 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &clk_sclk_uart1.clk),
1326 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &clk_sclk_uart2.clk),
1327 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &clk_sclk_uart3.clk),
1328 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
1329 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
1330 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
1331 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk),
1332 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &clk_pdma0),
1333 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &clk_pdma1),
1334 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &clk_sclk_spi0.clk),
1335 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &clk_sclk_spi1.clk),
1336 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &clk_sclk_spi2.clk),
1337};
1338
1339static int xtal_rate;
1340
1341static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
1342{
1343 if (soc_is_exynos4210())
1344 return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0),
1345 pll_4508);
1346 else if (soc_is_exynos4212() || soc_is_exynos4412())
1347 return s5p_get_pll35xx(xtal_rate, __raw_readl(S5P_APLL_CON0));
1348 else
1349 return 0;
1350}
1351
1352static struct clk_ops exynos4_fout_apll_ops = {
1353 .get_rate = exynos4_fout_apll_get_rate,
1354};
1355
1356static u32 vpll_div[][8] = {
1357 { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
1358 { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
1359};
1360
1361static unsigned long exynos4_vpll_get_rate(struct clk *clk)
1362{
1363 return clk->rate;
1364}
1365
1366static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate)
1367{
1368 unsigned int vpll_con0, vpll_con1 = 0;
1369 unsigned int i;
1370
1371 /* Return if nothing changed */
1372 if (clk->rate == rate)
1373 return 0;
1374
1375 vpll_con0 = __raw_readl(S5P_VPLL_CON0);
1376 vpll_con0 &= ~(0x1 << 27 | \
1377 PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1378 PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1379 PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1380
1381 vpll_con1 = __raw_readl(S5P_VPLL_CON1);
1382 vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \
1383 PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \
1384 PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT);
1385
1386 for (i = 0; i < ARRAY_SIZE(vpll_div); i++) {
1387 if (vpll_div[i][0] == rate) {
1388 vpll_con0 |= vpll_div[i][1] << PLL46XX_PDIV_SHIFT;
1389 vpll_con0 |= vpll_div[i][2] << PLL46XX_MDIV_SHIFT;
1390 vpll_con0 |= vpll_div[i][3] << PLL46XX_SDIV_SHIFT;
1391 vpll_con1 |= vpll_div[i][4] << PLL46XX_KDIV_SHIFT;
1392 vpll_con1 |= vpll_div[i][5] << PLL46XX_MFR_SHIFT;
1393 vpll_con1 |= vpll_div[i][6] << PLL46XX_MRR_SHIFT;
1394 vpll_con0 |= vpll_div[i][7] << 27;
1395 break;
1396 }
1397 }
1398
1399 if (i == ARRAY_SIZE(vpll_div)) {
1400 printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n",
1401 __func__);
1402 return -EINVAL;
1403 }
1404
1405 __raw_writel(vpll_con0, S5P_VPLL_CON0);
1406 __raw_writel(vpll_con1, S5P_VPLL_CON1);
1407
1408 /* Wait for VPLL lock */
1409 while (!(__raw_readl(S5P_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT)))
1410 continue;
1411
1412 clk->rate = rate;
1413 return 0;
1414}
1415
1416static struct clk_ops exynos4_vpll_ops = {
1417 .get_rate = exynos4_vpll_get_rate,
1418 .set_rate = exynos4_vpll_set_rate,
1419};
1420
1421void __init_or_cpufreq exynos4_setup_clocks(void)
1422{
1423 struct clk *xtal_clk;
1424 unsigned long apll = 0;
1425 unsigned long mpll = 0;
1426 unsigned long epll = 0;
1427 unsigned long vpll = 0;
1428 unsigned long vpllsrc;
1429 unsigned long xtal;
1430 unsigned long armclk;
1431 unsigned long sclk_dmc;
1432 unsigned long aclk_200;
1433 unsigned long aclk_100;
1434 unsigned long aclk_160;
1435 unsigned long aclk_133;
1436 unsigned int ptr;
1437
1438 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1439
1440 xtal_clk = clk_get(NULL, "xtal");
1441 BUG_ON(IS_ERR(xtal_clk));
1442
1443 xtal = clk_get_rate(xtal_clk);
1444
1445 xtal_rate = xtal;
1446
1447 clk_put(xtal_clk);
1448
1449 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1450
1451 if (soc_is_exynos4210()) {
1452 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON0),
1453 pll_4508);
1454 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON0),
1455 pll_4508);
1456 epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON0),
1457 __raw_readl(S5P_EPLL_CON1), pll_4600);
1458
1459 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1460 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1461 __raw_readl(S5P_VPLL_CON1), pll_4650c);
1462 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
1463 apll = s5p_get_pll35xx(xtal, __raw_readl(S5P_APLL_CON0));
1464 mpll = s5p_get_pll35xx(xtal, __raw_readl(S5P_MPLL_CON0));
1465 epll = s5p_get_pll36xx(xtal, __raw_readl(S5P_EPLL_CON0),
1466 __raw_readl(S5P_EPLL_CON1));
1467
1468 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1469 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1470 __raw_readl(S5P_VPLL_CON1));
1471 } else {
1472 /* nothing */
1473 }
1474
1475 clk_fout_apll.ops = &exynos4_fout_apll_ops;
1476 clk_fout_mpll.rate = mpll;
1477 clk_fout_epll.rate = epll;
1478 clk_fout_vpll.ops = &exynos4_vpll_ops;
1479 clk_fout_vpll.rate = vpll;
1480
1481 printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
1482 apll, mpll, epll, vpll);
1483
1484 armclk = clk_get_rate(&clk_armclk.clk);
1485 sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk);
1486
1487 aclk_200 = clk_get_rate(&clk_aclk_200.clk);
1488 aclk_100 = clk_get_rate(&clk_aclk_100.clk);
1489 aclk_160 = clk_get_rate(&clk_aclk_160.clk);
1490 aclk_133 = clk_get_rate(&clk_aclk_133.clk);
1491
1492 printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
1493 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1494 armclk, sclk_dmc, aclk_200,
1495 aclk_100, aclk_160, aclk_133);
1496
1497 clk_f.rate = armclk;
1498 clk_h.rate = sclk_dmc;
1499 clk_p.rate = aclk_100;
1500
1501 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
1502 s3c_set_clksrc(&clksrcs[ptr], true);
1503}
1504
1505static struct clk *clks[] __initdata = {
1506 &clk_sclk_hdmi27m,
1507 &clk_sclk_hdmiphy,
1508 &clk_sclk_usbphy0,
1509 &clk_sclk_usbphy1,
1510};
1511
1512#ifdef CONFIG_PM_SLEEP
1513static int exynos4_clock_suspend(void)
1514{
1515 s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1516 return 0;
1517}
1518
1519static void exynos4_clock_resume(void)
1520{
1521 s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1522}
1523
1524#else
1525#define exynos4_clock_suspend NULL
1526#define exynos4_clock_resume NULL
1527#endif
1528
1529static struct syscore_ops exynos4_clock_syscore_ops = {
1530 .suspend = exynos4_clock_suspend,
1531 .resume = exynos4_clock_resume,
1532};
1533
1534void __init exynos4_register_clocks(void)
1535{
1536 int ptr;
1537
1538 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1539
1540 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1541 s3c_register_clksrc(sysclks[ptr], 1);
1542
1543 for (ptr = 0; ptr < ARRAY_SIZE(sclk_tv); ptr++)
1544 s3c_register_clksrc(sclk_tv[ptr], 1);
1545
1546 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
1547 s3c_register_clksrc(clksrc_cdev[ptr], 1);
1548
1549 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1550 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1551
1552 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
1553 for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++)
1554 s3c_disable_clocks(clk_cdev[ptr], 1);
1555
1556 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1557 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1558 clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup));
1559
1560 register_syscore_ops(&exynos4_clock_syscore_ops);
1561 s3c24xx_register_clock(&dummy_apb_pclk);
1562
1563 s3c_pwmclk_init();
1564}
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 1ac49de0f398..8c1efe692c20 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -15,12 +15,21 @@
15void exynos_init_io(struct map_desc *mach_desc, int size); 15void exynos_init_io(struct map_desc *mach_desc, int size);
16void exynos4_init_irq(void); 16void exynos4_init_irq(void);
17 17
18#ifdef CONFIG_ARCH_EXYNOS4
18void exynos4_register_clocks(void); 19void exynos4_register_clocks(void);
19void exynos4_setup_clocks(void); 20void exynos4_setup_clocks(void);
20 21
21void exynos4210_register_clocks(void); 22void exynos4210_register_clocks(void);
22void exynos4212_register_clocks(void); 23void exynos4212_register_clocks(void);
23 24
25#else
26#define exynos4_register_clocks()
27#define exynos4_setup_clocks()
28
29#define exynos4210_register_clocks()
30#define exynos4212_register_clocks()
31#endif
32
24void exynos4_restart(char mode, const char *cmd); 33void exynos4_restart(char mode, const char *cmd);
25 34
26extern struct sys_timer exynos4_timer; 35extern struct sys_timer exynos4_timer;
diff --git a/arch/arm/mach-exynos/include/mach/exynos4-clock.h b/arch/arm/mach-exynos/include/mach/exynos4-clock.h
deleted file mode 100644
index a07fcbf55251..000000000000
--- a/arch/arm/mach-exynos/include/mach/exynos4-clock.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/include/mach/exynos4-clock.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Header file for exynos4 clock support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_CLOCK_H
15#define __ASM_ARCH_CLOCK_H __FILE__
16
17#include <linux/clk.h>
18
19extern struct clk clk_sclk_hdmi27m;
20extern struct clk clk_sclk_usbphy0;
21extern struct clk clk_sclk_usbphy1;
22extern struct clk clk_sclk_hdmiphy;
23
24extern struct clksrc_clk clk_sclk_apll;
25extern struct clksrc_clk clk_mout_mpll;
26extern struct clksrc_clk clk_aclk_133;
27extern struct clksrc_clk clk_mout_epll;
28extern struct clksrc_clk clk_sclk_vpll;
29
30extern struct clk *clkset_corebus_list[];
31extern struct clksrc_sources clkset_mout_corebus;
32
33extern struct clk *clkset_aclk_top_list[];
34extern struct clksrc_sources clkset_aclk;
35
36extern struct clk *clkset_group_list[];
37extern struct clksrc_sources clkset_group;
38
39extern int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable);
40extern int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable);
41extern int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable);
42
43#endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-clock.h b/arch/arm/mach-exynos/include/mach/regs-clock.h
index 6c37ebe94829..1e4abd64a547 100644
--- a/arch/arm/mach-exynos/include/mach/regs-clock.h
+++ b/arch/arm/mach-exynos/include/mach/regs-clock.h
@@ -16,195 +16,247 @@
16#include <plat/cpu.h> 16#include <plat/cpu.h>
17#include <mach/map.h> 17#include <mach/map.h>
18 18
19#define S5P_CLKREG(x) (S5P_VA_CMU + (x)) 19#define EXYNOS_CLKREG(x) (S5P_VA_CMU + (x))
20 20
21#define S5P_CLKDIV_LEFTBUS S5P_CLKREG(0x04500) 21#define EXYNOS4_CLKDIV_LEFTBUS EXYNOS_CLKREG(0x04500)
22#define S5P_CLKDIV_STAT_LEFTBUS S5P_CLKREG(0x04600) 22#define EXYNOS4_CLKDIV_STAT_LEFTBUS EXYNOS_CLKREG(0x04600)
23#define S5P_CLKGATE_IP_LEFTBUS S5P_CLKREG(0x04800) 23#define EXYNOS4_CLKGATE_IP_LEFTBUS EXYNOS_CLKREG(0x04800)
24 24
25#define S5P_CLKDIV_RIGHTBUS S5P_CLKREG(0x08500) 25#define EXYNOS4_CLKDIV_RIGHTBUS EXYNOS_CLKREG(0x08500)
26#define S5P_CLKDIV_STAT_RIGHTBUS S5P_CLKREG(0x08600) 26#define EXYNOS4_CLKDIV_STAT_RIGHTBUS EXYNOS_CLKREG(0x08600)
27#define S5P_CLKGATE_IP_RIGHTBUS S5P_CLKREG(0x08800) 27#define EXYNOS4_CLKGATE_IP_RIGHTBUS EXYNOS_CLKREG(0x08800)
28 28
29#define S5P_EPLL_LOCK S5P_CLKREG(0x0C010) 29#define EXYNOS4_EPLL_LOCK EXYNOS_CLKREG(0x0C010)
30#define S5P_VPLL_LOCK S5P_CLKREG(0x0C020) 30#define EXYNOS4_VPLL_LOCK EXYNOS_CLKREG(0x0C020)
31 31
32#define S5P_EPLL_CON0 S5P_CLKREG(0x0C110) 32#define EXYNOS4_EPLL_CON0 EXYNOS_CLKREG(0x0C110)
33#define S5P_EPLL_CON1 S5P_CLKREG(0x0C114) 33#define EXYNOS4_EPLL_CON1 EXYNOS_CLKREG(0x0C114)
34#define S5P_VPLL_CON0 S5P_CLKREG(0x0C120) 34#define EXYNOS4_VPLL_CON0 EXYNOS_CLKREG(0x0C120)
35#define S5P_VPLL_CON1 S5P_CLKREG(0x0C124) 35#define EXYNOS4_VPLL_CON1 EXYNOS_CLKREG(0x0C124)
36 36
37#define S5P_CLKSRC_TOP0 S5P_CLKREG(0x0C210) 37#define EXYNOS4_CLKSRC_TOP0 EXYNOS_CLKREG(0x0C210)
38#define S5P_CLKSRC_TOP1 S5P_CLKREG(0x0C214) 38#define EXYNOS4_CLKSRC_TOP1 EXYNOS_CLKREG(0x0C214)
39#define S5P_CLKSRC_CAM S5P_CLKREG(0x0C220) 39#define EXYNOS4_CLKSRC_CAM EXYNOS_CLKREG(0x0C220)
40#define S5P_CLKSRC_TV S5P_CLKREG(0x0C224) 40#define EXYNOS4_CLKSRC_TV EXYNOS_CLKREG(0x0C224)
41#define S5P_CLKSRC_MFC S5P_CLKREG(0x0C228) 41#define EXYNOS4_CLKSRC_MFC EXYNOS_CLKREG(0x0C228)
42#define S5P_CLKSRC_G3D S5P_CLKREG(0x0C22C) 42#define EXYNOS4_CLKSRC_G3D EXYNOS_CLKREG(0x0C22C)
43#define S5P_CLKSRC_IMAGE S5P_CLKREG(0x0C230) 43#define EXYNOS4_CLKSRC_IMAGE EXYNOS_CLKREG(0x0C230)
44#define S5P_CLKSRC_LCD0 S5P_CLKREG(0x0C234) 44#define EXYNOS4_CLKSRC_LCD0 EXYNOS_CLKREG(0x0C234)
45#define S5P_CLKSRC_MAUDIO S5P_CLKREG(0x0C23C) 45#define EXYNOS4_CLKSRC_MAUDIO EXYNOS_CLKREG(0x0C23C)
46#define S5P_CLKSRC_FSYS S5P_CLKREG(0x0C240) 46#define EXYNOS4_CLKSRC_FSYS EXYNOS_CLKREG(0x0C240)
47#define S5P_CLKSRC_PERIL0 S5P_CLKREG(0x0C250) 47#define EXYNOS4_CLKSRC_PERIL0 EXYNOS_CLKREG(0x0C250)
48#define S5P_CLKSRC_PERIL1 S5P_CLKREG(0x0C254) 48#define EXYNOS4_CLKSRC_PERIL1 EXYNOS_CLKREG(0x0C254)
49 49
50#define S5P_CLKSRC_MASK_TOP S5P_CLKREG(0x0C310) 50#define EXYNOS4_CLKSRC_MASK_TOP EXYNOS_CLKREG(0x0C310)
51#define S5P_CLKSRC_MASK_CAM S5P_CLKREG(0x0C320) 51#define EXYNOS4_CLKSRC_MASK_CAM EXYNOS_CLKREG(0x0C320)
52#define S5P_CLKSRC_MASK_TV S5P_CLKREG(0x0C324) 52#define EXYNOS4_CLKSRC_MASK_TV EXYNOS_CLKREG(0x0C324)
53#define S5P_CLKSRC_MASK_LCD0 S5P_CLKREG(0x0C334) 53#define EXYNOS4_CLKSRC_MASK_LCD0 EXYNOS_CLKREG(0x0C334)
54#define S5P_CLKSRC_MASK_MAUDIO S5P_CLKREG(0x0C33C) 54#define EXYNOS4_CLKSRC_MASK_MAUDIO EXYNOS_CLKREG(0x0C33C)
55#define S5P_CLKSRC_MASK_FSYS S5P_CLKREG(0x0C340) 55#define EXYNOS4_CLKSRC_MASK_FSYS EXYNOS_CLKREG(0x0C340)
56#define S5P_CLKSRC_MASK_PERIL0 S5P_CLKREG(0x0C350) 56#define EXYNOS4_CLKSRC_MASK_PERIL0 EXYNOS_CLKREG(0x0C350)
57#define S5P_CLKSRC_MASK_PERIL1 S5P_CLKREG(0x0C354) 57#define EXYNOS4_CLKSRC_MASK_PERIL1 EXYNOS_CLKREG(0x0C354)
58 58
59#define S5P_CLKDIV_TOP S5P_CLKREG(0x0C510) 59#define EXYNOS4_CLKDIV_TOP EXYNOS_CLKREG(0x0C510)
60#define S5P_CLKDIV_CAM S5P_CLKREG(0x0C520) 60#define EXYNOS4_CLKDIV_CAM EXYNOS_CLKREG(0x0C520)
61#define S5P_CLKDIV_TV S5P_CLKREG(0x0C524) 61#define EXYNOS4_CLKDIV_TV EXYNOS_CLKREG(0x0C524)
62#define S5P_CLKDIV_MFC S5P_CLKREG(0x0C528) 62#define EXYNOS4_CLKDIV_MFC EXYNOS_CLKREG(0x0C528)
63#define S5P_CLKDIV_G3D S5P_CLKREG(0x0C52C) 63#define EXYNOS4_CLKDIV_G3D EXYNOS_CLKREG(0x0C52C)
64#define S5P_CLKDIV_IMAGE S5P_CLKREG(0x0C530) 64#define EXYNOS4_CLKDIV_IMAGE EXYNOS_CLKREG(0x0C530)
65#define S5P_CLKDIV_LCD0 S5P_CLKREG(0x0C534) 65#define EXYNOS4_CLKDIV_LCD0 EXYNOS_CLKREG(0x0C534)
66#define S5P_CLKDIV_MAUDIO S5P_CLKREG(0x0C53C) 66#define EXYNOS4_CLKDIV_MAUDIO EXYNOS_CLKREG(0x0C53C)
67#define S5P_CLKDIV_FSYS0 S5P_CLKREG(0x0C540) 67#define EXYNOS4_CLKDIV_FSYS0 EXYNOS_CLKREG(0x0C540)
68#define S5P_CLKDIV_FSYS1 S5P_CLKREG(0x0C544) 68#define EXYNOS4_CLKDIV_FSYS1 EXYNOS_CLKREG(0x0C544)
69#define S5P_CLKDIV_FSYS2 S5P_CLKREG(0x0C548) 69#define EXYNOS4_CLKDIV_FSYS2 EXYNOS_CLKREG(0x0C548)
70#define S5P_CLKDIV_FSYS3 S5P_CLKREG(0x0C54C) 70#define EXYNOS4_CLKDIV_FSYS3 EXYNOS_CLKREG(0x0C54C)
71#define S5P_CLKDIV_PERIL0 S5P_CLKREG(0x0C550) 71#define EXYNOS4_CLKDIV_PERIL0 EXYNOS_CLKREG(0x0C550)
72#define S5P_CLKDIV_PERIL1 S5P_CLKREG(0x0C554) 72#define EXYNOS4_CLKDIV_PERIL1 EXYNOS_CLKREG(0x0C554)
73#define S5P_CLKDIV_PERIL2 S5P_CLKREG(0x0C558) 73#define EXYNOS4_CLKDIV_PERIL2 EXYNOS_CLKREG(0x0C558)
74#define S5P_CLKDIV_PERIL3 S5P_CLKREG(0x0C55C) 74#define EXYNOS4_CLKDIV_PERIL3 EXYNOS_CLKREG(0x0C55C)
75#define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x0C560) 75#define EXYNOS4_CLKDIV_PERIL4 EXYNOS_CLKREG(0x0C560)
76#define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x0C564) 76#define EXYNOS4_CLKDIV_PERIL5 EXYNOS_CLKREG(0x0C564)
77#define S5P_CLKDIV2_RATIO S5P_CLKREG(0x0C580) 77#define EXYNOS4_CLKDIV2_RATIO EXYNOS_CLKREG(0x0C580)
78 78
79#define S5P_CLKDIV_STAT_TOP S5P_CLKREG(0x0C610) 79#define EXYNOS4_CLKDIV_STAT_TOP EXYNOS_CLKREG(0x0C610)
80 80#define EXYNOS4_CLKDIV_STAT_MFC EXYNOS_CLKREG(0x0C628)
81#define S5P_CLKGATE_SCLKCAM S5P_CLKREG(0x0C820) 81
82#define S5P_CLKGATE_IP_CAM S5P_CLKREG(0x0C920) 82#define EXYNOS4_CLKGATE_SCLKCAM EXYNOS_CLKREG(0x0C820)
83#define S5P_CLKGATE_IP_TV S5P_CLKREG(0x0C924) 83#define EXYNOS4_CLKGATE_IP_CAM EXYNOS_CLKREG(0x0C920)
84#define S5P_CLKGATE_IP_MFC S5P_CLKREG(0x0C928) 84#define EXYNOS4_CLKGATE_IP_TV EXYNOS_CLKREG(0x0C924)
85#define S5P_CLKGATE_IP_G3D S5P_CLKREG(0x0C92C) 85#define EXYNOS4_CLKGATE_IP_MFC EXYNOS_CLKREG(0x0C928)
86#define S5P_CLKGATE_IP_IMAGE (soc_is_exynos4210() ? \ 86#define EXYNOS4_CLKGATE_IP_G3D EXYNOS_CLKREG(0x0C92C)
87 S5P_CLKREG(0x0C930) : \ 87#define EXYNOS4_CLKGATE_IP_IMAGE (soc_is_exynos4210() ? \
88 S5P_CLKREG(0x04930)) 88 EXYNOS_CLKREG(0x0C930) : \
89#define S5P_CLKGATE_IP_IMAGE_4210 S5P_CLKREG(0x0C930) 89 EXYNOS_CLKREG(0x04930))
90#define S5P_CLKGATE_IP_IMAGE_4212 S5P_CLKREG(0x04930) 90#define EXYNOS4210_CLKGATE_IP_IMAGE EXYNOS_CLKREG(0x0C930)
91#define S5P_CLKGATE_IP_LCD0 S5P_CLKREG(0x0C934) 91#define EXYNOS4212_CLKGATE_IP_IMAGE EXYNOS_CLKREG(0x04930)
92#define S5P_CLKGATE_IP_FSYS S5P_CLKREG(0x0C940) 92#define EXYNOS4_CLKGATE_IP_LCD0 EXYNOS_CLKREG(0x0C934)
93#define S5P_CLKGATE_IP_GPS S5P_CLKREG(0x0C94C) 93#define EXYNOS4_CLKGATE_IP_FSYS EXYNOS_CLKREG(0x0C940)
94#define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x0C950) 94#define EXYNOS4_CLKGATE_IP_GPS EXYNOS_CLKREG(0x0C94C)
95#define S5P_CLKGATE_IP_PERIR (soc_is_exynos4210() ? \ 95#define EXYNOS4_CLKGATE_IP_PERIL EXYNOS_CLKREG(0x0C950)
96 S5P_CLKREG(0x0C960) : \ 96#define EXYNOS4_CLKGATE_IP_PERIR (soc_is_exynos4210() ? \
97 S5P_CLKREG(0x08960)) 97 EXYNOS_CLKREG(0x0C960) : \
98#define S5P_CLKGATE_IP_PERIR_4210 S5P_CLKREG(0x0C960) 98 EXYNOS_CLKREG(0x08960))
99#define S5P_CLKGATE_IP_PERIR_4212 S5P_CLKREG(0x08960) 99#define EXYNOS4210_CLKGATE_IP_PERIR EXYNOS_CLKREG(0x0C960)
100#define S5P_CLKGATE_BLOCK S5P_CLKREG(0x0C970) 100#define EXYNOS4212_CLKGATE_IP_PERIR EXYNOS_CLKREG(0x08960)
101 101#define EXYNOS4_CLKGATE_BLOCK EXYNOS_CLKREG(0x0C970)
102#define S5P_CLKSRC_MASK_DMC S5P_CLKREG(0x10300) 102
103#define S5P_CLKSRC_DMC S5P_CLKREG(0x10200) 103#define EXYNOS4_CLKSRC_MASK_DMC EXYNOS_CLKREG(0x10300)
104#define S5P_CLKDIV_DMC0 S5P_CLKREG(0x10500) 104#define EXYNOS4_CLKSRC_DMC EXYNOS_CLKREG(0x10200)
105#define S5P_CLKDIV_DMC1 S5P_CLKREG(0x10504) 105#define EXYNOS4_CLKDIV_DMC0 EXYNOS_CLKREG(0x10500)
106#define S5P_CLKDIV_STAT_DMC0 S5P_CLKREG(0x10600) 106#define EXYNOS4_CLKDIV_DMC1 EXYNOS_CLKREG(0x10504)
107#define S5P_CLKGATE_IP_DMC S5P_CLKREG(0x10900) 107#define EXYNOS4_CLKDIV_STAT_DMC0 EXYNOS_CLKREG(0x10600)
108 108#define EXYNOS4_CLKDIV_STAT_DMC1 EXYNOS_CLKREG(0x10604)
109#define S5P_APLL_LOCK S5P_CLKREG(0x14000) 109#define EXYNOS4_CLKGATE_IP_DMC EXYNOS_CLKREG(0x10900)
110#define S5P_MPLL_LOCK (soc_is_exynos4210() ? \ 110
111 S5P_CLKREG(0x14004) : \ 111#define EXYNOS4_DMC_PAUSE_CTRL EXYNOS_CLKREG(0x11094)
112 S5P_CLKREG(0x10008)) 112#define EXYNOS4_DMC_PAUSE_ENABLE (1 << 0)
113#define S5P_APLL_CON0 S5P_CLKREG(0x14100) 113
114#define S5P_APLL_CON1 S5P_CLKREG(0x14104) 114#define EXYNOS4_APLL_LOCK EXYNOS_CLKREG(0x14000)
115#define S5P_MPLL_CON0 (soc_is_exynos4210() ? \ 115#define EXYNOS4_MPLL_LOCK (soc_is_exynos4210() ? \
116 S5P_CLKREG(0x14108) : \ 116 EXYNOS_CLKREG(0x14004) : \
117 S5P_CLKREG(0x10108)) 117 EXYNOS_CLKREG(0x10008))
118#define S5P_MPLL_CON1 (soc_is_exynos4210() ? \ 118#define EXYNOS4_APLL_CON0 EXYNOS_CLKREG(0x14100)
119 S5P_CLKREG(0x1410C) : \ 119#define EXYNOS4_APLL_CON1 EXYNOS_CLKREG(0x14104)
120 S5P_CLKREG(0x1010C)) 120#define EXYNOS4_MPLL_CON0 (soc_is_exynos4210() ? \
121 121 EXYNOS_CLKREG(0x14108) : \
122#define S5P_CLKSRC_CPU S5P_CLKREG(0x14200) 122 EXYNOS_CLKREG(0x10108))
123#define S5P_CLKMUX_STATCPU S5P_CLKREG(0x14400) 123#define EXYNOS4_MPLL_CON1 (soc_is_exynos4210() ? \
124 124 EXYNOS_CLKREG(0x1410C) : \
125#define S5P_CLKDIV_CPU S5P_CLKREG(0x14500) 125 EXYNOS_CLKREG(0x1010C))
126#define S5P_CLKDIV_CPU1 S5P_CLKREG(0x14504) 126
127#define S5P_CLKDIV_STATCPU S5P_CLKREG(0x14600) 127#define EXYNOS4_CLKSRC_CPU EXYNOS_CLKREG(0x14200)
128#define S5P_CLKDIV_STATCPU1 S5P_CLKREG(0x14604) 128#define EXYNOS4_CLKMUX_STATCPU EXYNOS_CLKREG(0x14400)
129 129
130#define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x14800) 130#define EXYNOS4_CLKDIV_CPU EXYNOS_CLKREG(0x14500)
131#define S5P_CLKGATE_IP_CPU S5P_CLKREG(0x14900) 131#define EXYNOS4_CLKDIV_CPU1 EXYNOS_CLKREG(0x14504)
132 132#define EXYNOS4_CLKDIV_STATCPU EXYNOS_CLKREG(0x14600)
133#define S5P_APLL_LOCKTIME (0x1C20) /* 300us */ 133#define EXYNOS4_CLKDIV_STATCPU1 EXYNOS_CLKREG(0x14604)
134 134
135#define S5P_APLLCON0_ENABLE_SHIFT (31) 135#define EXYNOS4_CLKGATE_SCLKCPU EXYNOS_CLKREG(0x14800)
136#define S5P_APLLCON0_LOCKED_SHIFT (29) 136#define EXYNOS4_CLKGATE_IP_CPU EXYNOS_CLKREG(0x14900)
137#define S5P_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1) 137
138#define S5P_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1) 138#define EXYNOS4_APLL_LOCKTIME (0x1C20) /* 300us */
139 139
140#define S5P_EPLLCON0_ENABLE_SHIFT (31) 140#define EXYNOS4_APLLCON0_ENABLE_SHIFT (31)
141#define S5P_EPLLCON0_LOCKED_SHIFT (29) 141#define EXYNOS4_APLLCON0_LOCKED_SHIFT (29)
142 142#define EXYNOS4_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1)
143#define S5P_VPLLCON0_ENABLE_SHIFT (31) 143#define EXYNOS4_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1)
144#define S5P_VPLLCON0_LOCKED_SHIFT (29) 144
145 145#define EXYNOS4_EPLLCON0_ENABLE_SHIFT (31)
146#define S5P_CLKSRC_CPU_MUXCORE_SHIFT (16) 146#define EXYNOS4_EPLLCON0_LOCKED_SHIFT (29)
147#define S5P_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << S5P_CLKSRC_CPU_MUXCORE_SHIFT) 147
148 148#define EXYNOS4_VPLLCON0_ENABLE_SHIFT (31)
149#define S5P_CLKDIV_CPU0_CORE_SHIFT (0) 149#define EXYNOS4_VPLLCON0_LOCKED_SHIFT (29)
150#define S5P_CLKDIV_CPU0_CORE_MASK (0x7 << S5P_CLKDIV_CPU0_CORE_SHIFT) 150
151#define S5P_CLKDIV_CPU0_COREM0_SHIFT (4) 151#define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16)
152#define S5P_CLKDIV_CPU0_COREM0_MASK (0x7 << S5P_CLKDIV_CPU0_COREM0_SHIFT) 152#define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)
153#define S5P_CLKDIV_CPU0_COREM1_SHIFT (8) 153
154#define S5P_CLKDIV_CPU0_COREM1_MASK (0x7 << S5P_CLKDIV_CPU0_COREM1_SHIFT) 154#define EXYNOS4_CLKDIV_CPU0_CORE_SHIFT (0)
155#define S5P_CLKDIV_CPU0_PERIPH_SHIFT (12) 155#define EXYNOS4_CLKDIV_CPU0_CORE_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_CORE_SHIFT)
156#define S5P_CLKDIV_CPU0_PERIPH_MASK (0x7 << S5P_CLKDIV_CPU0_PERIPH_SHIFT) 156#define EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT (4)
157#define S5P_CLKDIV_CPU0_ATB_SHIFT (16) 157#define EXYNOS4_CLKDIV_CPU0_COREM0_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT)
158#define S5P_CLKDIV_CPU0_ATB_MASK (0x7 << S5P_CLKDIV_CPU0_ATB_SHIFT) 158#define EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT (8)
159#define S5P_CLKDIV_CPU0_PCLKDBG_SHIFT (20) 159#define EXYNOS4_CLKDIV_CPU0_COREM1_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT)
160#define S5P_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << S5P_CLKDIV_CPU0_PCLKDBG_SHIFT) 160#define EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT (12)
161#define S5P_CLKDIV_CPU0_APLL_SHIFT (24) 161#define EXYNOS4_CLKDIV_CPU0_PERIPH_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT)
162#define S5P_CLKDIV_CPU0_APLL_MASK (0x7 << S5P_CLKDIV_CPU0_APLL_SHIFT) 162#define EXYNOS4_CLKDIV_CPU0_ATB_SHIFT (16)
163 163#define EXYNOS4_CLKDIV_CPU0_ATB_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_ATB_SHIFT)
164#define S5P_CLKDIV_DMC0_ACP_SHIFT (0) 164#define EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT (20)
165#define S5P_CLKDIV_DMC0_ACP_MASK (0x7 << S5P_CLKDIV_DMC0_ACP_SHIFT) 165#define EXYNOS4_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT)
166#define S5P_CLKDIV_DMC0_ACPPCLK_SHIFT (4) 166#define EXYNOS4_CLKDIV_CPU0_APLL_SHIFT (24)
167#define S5P_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << S5P_CLKDIV_DMC0_ACPPCLK_SHIFT) 167#define EXYNOS4_CLKDIV_CPU0_APLL_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_APLL_SHIFT)
168#define S5P_CLKDIV_DMC0_DPHY_SHIFT (8) 168#define EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT 28
169#define S5P_CLKDIV_DMC0_DPHY_MASK (0x7 << S5P_CLKDIV_DMC0_DPHY_SHIFT) 169#define EXYNOS4_CLKDIV_CPU0_CORE2_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT)
170#define S5P_CLKDIV_DMC0_DMC_SHIFT (12) 170
171#define S5P_CLKDIV_DMC0_DMC_MASK (0x7 << S5P_CLKDIV_DMC0_DMC_SHIFT) 171#define EXYNOS4_CLKDIV_CPU1_COPY_SHIFT 0
172#define S5P_CLKDIV_DMC0_DMCD_SHIFT (16) 172#define EXYNOS4_CLKDIV_CPU1_COPY_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_COPY_SHIFT)
173#define S5P_CLKDIV_DMC0_DMCD_MASK (0x7 << S5P_CLKDIV_DMC0_DMCD_SHIFT) 173#define EXYNOS4_CLKDIV_CPU1_HPM_SHIFT 4
174#define S5P_CLKDIV_DMC0_DMCP_SHIFT (20) 174#define EXYNOS4_CLKDIV_CPU1_HPM_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_HPM_SHIFT)
175#define S5P_CLKDIV_DMC0_DMCP_MASK (0x7 << S5P_CLKDIV_DMC0_DMCP_SHIFT) 175#define EXYNOS4_CLKDIV_CPU1_CORES_SHIFT 8
176#define S5P_CLKDIV_DMC0_COPY2_SHIFT (24) 176#define EXYNOS4_CLKDIV_CPU1_CORES_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_CORES_SHIFT)
177#define S5P_CLKDIV_DMC0_COPY2_MASK (0x7 << S5P_CLKDIV_DMC0_COPY2_SHIFT) 177
178#define S5P_CLKDIV_DMC0_CORETI_SHIFT (28) 178#define EXYNOS4_CLKDIV_DMC0_ACP_SHIFT (0)
179#define S5P_CLKDIV_DMC0_CORETI_MASK (0x7 << S5P_CLKDIV_DMC0_CORETI_SHIFT) 179#define EXYNOS4_CLKDIV_DMC0_ACP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACP_SHIFT)
180 180#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT (4)
181#define S5P_CLKDIV_TOP_ACLK200_SHIFT (0) 181#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT)
182#define S5P_CLKDIV_TOP_ACLK200_MASK (0x7 << S5P_CLKDIV_TOP_ACLK200_SHIFT) 182#define EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT (8)
183#define S5P_CLKDIV_TOP_ACLK100_SHIFT (4) 183#define EXYNOS4_CLKDIV_DMC0_DPHY_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT)
184#define S5P_CLKDIV_TOP_ACLK100_MASK (0xf << S5P_CLKDIV_TOP_ACLK100_SHIFT) 184#define EXYNOS4_CLKDIV_DMC0_DMC_SHIFT (12)
185#define S5P_CLKDIV_TOP_ACLK160_SHIFT (8) 185#define EXYNOS4_CLKDIV_DMC0_DMC_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMC_SHIFT)
186#define S5P_CLKDIV_TOP_ACLK160_MASK (0x7 << S5P_CLKDIV_TOP_ACLK160_SHIFT) 186#define EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT (16)
187#define S5P_CLKDIV_TOP_ACLK133_SHIFT (12) 187#define EXYNOS4_CLKDIV_DMC0_DMCD_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT)
188#define S5P_CLKDIV_TOP_ACLK133_MASK (0x7 << S5P_CLKDIV_TOP_ACLK133_SHIFT) 188#define EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT (20)
189#define S5P_CLKDIV_TOP_ONENAND_SHIFT (16) 189#define EXYNOS4_CLKDIV_DMC0_DMCP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT)
190#define S5P_CLKDIV_TOP_ONENAND_MASK (0x7 << S5P_CLKDIV_TOP_ONENAND_SHIFT) 190#define EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT (24)
191 191#define EXYNOS4_CLKDIV_DMC0_COPY2_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT)
192#define S5P_CLKDIV_BUS_GDLR_SHIFT (0) 192#define EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT (28)
193#define S5P_CLKDIV_BUS_GDLR_MASK (0x7 << S5P_CLKDIV_BUS_GDLR_SHIFT) 193#define EXYNOS4_CLKDIV_DMC0_CORETI_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT)
194#define S5P_CLKDIV_BUS_GPLR_SHIFT (4) 194
195#define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT) 195#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT (0)
196#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_MASK (0xf << EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT)
197#define EXYNOS4_CLKDIV_DMC1_C2C_SHIFT (4)
198#define EXYNOS4_CLKDIV_DMC1_C2C_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2C_SHIFT)
199#define EXYNOS4_CLKDIV_DMC1_PWI_SHIFT (8)
200#define EXYNOS4_CLKDIV_DMC1_PWI_MASK (0xf << EXYNOS4_CLKDIV_DMC1_PWI_SHIFT)
201#define EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT (12)
202#define EXYNOS4_CLKDIV_DMC1_C2CACLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT)
203#define EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT (16)
204#define EXYNOS4_CLKDIV_DMC1_DVSEM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT)
205#define EXYNOS4_CLKDIV_DMC1_DPM_SHIFT (24)
206#define EXYNOS4_CLKDIV_DMC1_DPM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DPM_SHIFT)
207
208#define EXYNOS4_CLKDIV_MFC_SHIFT (0)
209#define EXYNOS4_CLKDIV_MFC_MASK (0x7 << EXYNOS4_CLKDIV_MFC_SHIFT)
210
211#define EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT (0)
212#define EXYNOS4_CLKDIV_TOP_ACLK200_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT)
213#define EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT (4)
214#define EXYNOS4_CLKDIV_TOP_ACLK100_MASK (0xF << EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT)
215#define EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT (8)
216#define EXYNOS4_CLKDIV_TOP_ACLK160_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT)
217#define EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT (12)
218#define EXYNOS4_CLKDIV_TOP_ACLK133_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT)
219#define EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT (16)
220#define EXYNOS4_CLKDIV_TOP_ONENAND_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT)
221#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT (20)
222#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT)
223#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT (24)
224#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT)
225
226#define EXYNOS4_CLKDIV_BUS_GDLR_SHIFT (0)
227#define EXYNOS4_CLKDIV_BUS_GDLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GDLR_SHIFT)
228#define EXYNOS4_CLKDIV_BUS_GPLR_SHIFT (4)
229#define EXYNOS4_CLKDIV_BUS_GPLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GPLR_SHIFT)
230
231#define EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT (0)
232#define EXYNOS4_CLKDIV_CAM_FIMC0_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT)
233#define EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT (4)
234#define EXYNOS4_CLKDIV_CAM_FIMC1_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT)
235#define EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT (8)
236#define EXYNOS4_CLKDIV_CAM_FIMC2_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT)
237#define EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT (12)
238#define EXYNOS4_CLKDIV_CAM_FIMC3_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT)
196 239
197/* Only for EXYNOS4210 */ 240/* Only for EXYNOS4210 */
198 241
199#define S5P_CLKSRC_LCD1 S5P_CLKREG(0x0C238) 242#define EXYNOS4210_CLKSRC_LCD1 EXYNOS_CLKREG(0x0C238)
200#define S5P_CLKSRC_MASK_LCD1 S5P_CLKREG(0x0C338) 243#define EXYNOS4210_CLKSRC_MASK_LCD1 EXYNOS_CLKREG(0x0C338)
201#define S5P_CLKDIV_LCD1 S5P_CLKREG(0x0C538) 244#define EXYNOS4210_CLKDIV_LCD1 EXYNOS_CLKREG(0x0C538)
202#define S5P_CLKGATE_IP_LCD1 S5P_CLKREG(0x0C938) 245#define EXYNOS4210_CLKGATE_IP_LCD1 EXYNOS_CLKREG(0x0C938)
246
247/* Only for EXYNOS4212 */
248
249#define EXYNOS4_CLKDIV_CAM1 EXYNOS_CLKREG(0x0C568)
250
251#define EXYNOS4_CLKDIV_STAT_CAM1 EXYNOS_CLKREG(0x0C668)
252
253#define EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT (0)
254#define EXYNOS4_CLKDIV_CAM1_JPEG_MASK (0xf << EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT)
203 255
204/* Compatibility defines and inclusion */ 256/* Compatibility defines and inclusion */
205 257
206#include <mach/regs-pmu.h> 258#include <mach/regs-pmu.h>
207 259
208#define S5P_EPLL_CON S5P_EPLL_CON0 260#define S5P_EPLL_CON EXYNOS4_EPLL_CON0
209 261
210#endif /* __ASM_ARCH_REGS_CLOCK_H */ 262#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index e19013051772..f105bd2b6765 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -38,29 +38,29 @@
38#include <mach/pmu.h> 38#include <mach/pmu.h>
39 39
40static struct sleep_save exynos4_set_clksrc[] = { 40static struct sleep_save exynos4_set_clksrc[] = {
41 { .reg = S5P_CLKSRC_MASK_TOP , .val = 0x00000001, }, 41 { .reg = EXYNOS4_CLKSRC_MASK_TOP , .val = 0x00000001, },
42 { .reg = S5P_CLKSRC_MASK_CAM , .val = 0x11111111, }, 42 { .reg = EXYNOS4_CLKSRC_MASK_CAM , .val = 0x11111111, },
43 { .reg = S5P_CLKSRC_MASK_TV , .val = 0x00000111, }, 43 { .reg = EXYNOS4_CLKSRC_MASK_TV , .val = 0x00000111, },
44 { .reg = S5P_CLKSRC_MASK_LCD0 , .val = 0x00001111, }, 44 { .reg = EXYNOS4_CLKSRC_MASK_LCD0 , .val = 0x00001111, },
45 { .reg = S5P_CLKSRC_MASK_MAUDIO , .val = 0x00000001, }, 45 { .reg = EXYNOS4_CLKSRC_MASK_MAUDIO , .val = 0x00000001, },
46 { .reg = S5P_CLKSRC_MASK_FSYS , .val = 0x01011111, }, 46 { .reg = EXYNOS4_CLKSRC_MASK_FSYS , .val = 0x01011111, },
47 { .reg = S5P_CLKSRC_MASK_PERIL0 , .val = 0x01111111, }, 47 { .reg = EXYNOS4_CLKSRC_MASK_PERIL0 , .val = 0x01111111, },
48 { .reg = S5P_CLKSRC_MASK_PERIL1 , .val = 0x01110111, }, 48 { .reg = EXYNOS4_CLKSRC_MASK_PERIL1 , .val = 0x01110111, },
49 { .reg = S5P_CLKSRC_MASK_DMC , .val = 0x00010000, }, 49 { .reg = EXYNOS4_CLKSRC_MASK_DMC , .val = 0x00010000, },
50}; 50};
51 51
52static struct sleep_save exynos4210_set_clksrc[] = { 52static struct sleep_save exynos4210_set_clksrc[] = {
53 { .reg = S5P_CLKSRC_MASK_LCD1 , .val = 0x00001111, }, 53 { .reg = EXYNOS4210_CLKSRC_MASK_LCD1 , .val = 0x00001111, },
54}; 54};
55 55
56static struct sleep_save exynos4_epll_save[] = { 56static struct sleep_save exynos4_epll_save[] = {
57 SAVE_ITEM(S5P_EPLL_CON0), 57 SAVE_ITEM(EXYNOS4_EPLL_CON0),
58 SAVE_ITEM(S5P_EPLL_CON1), 58 SAVE_ITEM(EXYNOS4_EPLL_CON1),
59}; 59};
60 60
61static struct sleep_save exynos4_vpll_save[] = { 61static struct sleep_save exynos4_vpll_save[] = {
62 SAVE_ITEM(S5P_VPLL_CON0), 62 SAVE_ITEM(EXYNOS4_VPLL_CON0),
63 SAVE_ITEM(S5P_VPLL_CON1), 63 SAVE_ITEM(EXYNOS4_VPLL_CON1),
64}; 64};
65 65
66static struct sleep_save exynos4_core_save[] = { 66static struct sleep_save exynos4_core_save[] = {
@@ -239,7 +239,7 @@ static void exynos4_restore_pll(void)
239 locktime = (3000 / pll_in_rate) * p_div; 239 locktime = (3000 / pll_in_rate) * p_div;
240 lockcnt = locktime * 10000 / (10000 / pll_in_rate); 240 lockcnt = locktime * 10000 / (10000 / pll_in_rate);
241 241
242 __raw_writel(lockcnt, S5P_EPLL_LOCK); 242 __raw_writel(lockcnt, EXYNOS4_EPLL_LOCK);
243 243
244 s3c_pm_do_restore_core(exynos4_epll_save, 244 s3c_pm_do_restore_core(exynos4_epll_save,
245 ARRAY_SIZE(exynos4_epll_save)); 245 ARRAY_SIZE(exynos4_epll_save));
@@ -257,7 +257,7 @@ static void exynos4_restore_pll(void)
257 locktime = 750; 257 locktime = 750;
258 lockcnt = locktime * 10000 / (10000 / pll_in_rate); 258 lockcnt = locktime * 10000 / (10000 / pll_in_rate);
259 259
260 __raw_writel(lockcnt, S5P_VPLL_LOCK); 260 __raw_writel(lockcnt, EXYNOS4_VPLL_LOCK);
261 261
262 s3c_pm_do_restore_core(exynos4_vpll_save, 262 s3c_pm_do_restore_core(exynos4_vpll_save,
263 ARRAY_SIZE(exynos4_vpll_save)); 263 ARRAY_SIZE(exynos4_vpll_save));
@@ -268,14 +268,14 @@ static void exynos4_restore_pll(void)
268 268
269 do { 269 do {
270 if (epll_wait) { 270 if (epll_wait) {
271 pll_con = __raw_readl(S5P_EPLL_CON0); 271 pll_con = __raw_readl(EXYNOS4_EPLL_CON0);
272 if (pll_con & (1 << S5P_EPLLCON0_LOCKED_SHIFT)) 272 if (pll_con & (1 << EXYNOS4_EPLLCON0_LOCKED_SHIFT))
273 epll_wait = 0; 273 epll_wait = 0;
274 } 274 }
275 275
276 if (vpll_wait) { 276 if (vpll_wait) {
277 pll_con = __raw_readl(S5P_VPLL_CON0); 277 pll_con = __raw_readl(EXYNOS4_VPLL_CON0);
278 if (pll_con & (1 << S5P_VPLLCON0_LOCKED_SHIFT)) 278 if (pll_con & (1 << EXYNOS4_VPLLCON0_LOCKED_SHIFT))
279 vpll_wait = 0; 279 vpll_wait = 0;
280 } 280 }
281 } while (epll_wait || vpll_wait); 281 } while (epll_wait || vpll_wait);
diff --git a/arch/arm/mach-lpc32xx/include/mach/irqs.h b/arch/arm/mach-lpc32xx/include/mach/irqs.h
index 2667f52e3b04..9e3b90df32e1 100644
--- a/arch/arm/mach-lpc32xx/include/mach/irqs.h
+++ b/arch/arm/mach-lpc32xx/include/mach/irqs.h
@@ -61,7 +61,7 @@
61 */ 61 */
62#define IRQ_LPC32XX_JTAG_COMM_TX LPC32XX_SIC1_IRQ(1) 62#define IRQ_LPC32XX_JTAG_COMM_TX LPC32XX_SIC1_IRQ(1)
63#define IRQ_LPC32XX_JTAG_COMM_RX LPC32XX_SIC1_IRQ(2) 63#define IRQ_LPC32XX_JTAG_COMM_RX LPC32XX_SIC1_IRQ(2)
64#define IRQ_LPC32XX_GPI_11 LPC32XX_SIC1_IRQ(4) 64#define IRQ_LPC32XX_GPI_28 LPC32XX_SIC1_IRQ(4)
65#define IRQ_LPC32XX_TS_P LPC32XX_SIC1_IRQ(6) 65#define IRQ_LPC32XX_TS_P LPC32XX_SIC1_IRQ(6)
66#define IRQ_LPC32XX_TS_IRQ LPC32XX_SIC1_IRQ(7) 66#define IRQ_LPC32XX_TS_IRQ LPC32XX_SIC1_IRQ(7)
67#define IRQ_LPC32XX_TS_AUX LPC32XX_SIC1_IRQ(8) 67#define IRQ_LPC32XX_TS_AUX LPC32XX_SIC1_IRQ(8)
diff --git a/arch/arm/mach-lpc32xx/irq.c b/arch/arm/mach-lpc32xx/irq.c
index 4eae566dfdc7..c74de01ab5b6 100644
--- a/arch/arm/mach-lpc32xx/irq.c
+++ b/arch/arm/mach-lpc32xx/irq.c
@@ -118,6 +118,10 @@ static const struct lpc32xx_event_info lpc32xx_events[NR_IRQS] = {
118 .event_group = &lpc32xx_event_pin_regs, 118 .event_group = &lpc32xx_event_pin_regs,
119 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT, 119 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT,
120 }, 120 },
121 [IRQ_LPC32XX_GPI_28] = {
122 .event_group = &lpc32xx_event_pin_regs,
123 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_28_BIT,
124 },
121 [IRQ_LPC32XX_GPIO_00] = { 125 [IRQ_LPC32XX_GPIO_00] = {
122 .event_group = &lpc32xx_event_int_regs, 126 .event_group = &lpc32xx_event_int_regs,
123 .mask = LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT, 127 .mask = LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT,
@@ -305,9 +309,18 @@ static int lpc32xx_irq_wake(struct irq_data *d, unsigned int state)
305 309
306 if (state) 310 if (state)
307 eventreg |= lpc32xx_events[d->irq].mask; 311 eventreg |= lpc32xx_events[d->irq].mask;
308 else 312 else {
309 eventreg &= ~lpc32xx_events[d->irq].mask; 313 eventreg &= ~lpc32xx_events[d->irq].mask;
310 314
315 /*
316 * When disabling the wakeup, clear the latched
317 * event
318 */
319 __raw_writel(lpc32xx_events[d->irq].mask,
320 lpc32xx_events[d->irq].
321 event_group->rawstat_reg);
322 }
323
311 __raw_writel(eventreg, 324 __raw_writel(eventreg,
312 lpc32xx_events[d->irq].event_group->enab_reg); 325 lpc32xx_events[d->irq].event_group->enab_reg);
313 326
@@ -380,13 +393,15 @@ void __init lpc32xx_init_irq(void)
380 393
381 /* Setup SIC1 */ 394 /* Setup SIC1 */
382 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC1_BASE)); 395 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC1_BASE));
383 __raw_writel(MIC_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC1_BASE)); 396 __raw_writel(SIC1_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC1_BASE));
384 __raw_writel(MIC_ATR_DEFAULT, LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC1_BASE)); 397 __raw_writel(SIC1_ATR_DEFAULT,
398 LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC1_BASE));
385 399
386 /* Setup SIC2 */ 400 /* Setup SIC2 */
387 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC2_BASE)); 401 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC2_BASE));
388 __raw_writel(MIC_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC2_BASE)); 402 __raw_writel(SIC2_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC2_BASE));
389 __raw_writel(MIC_ATR_DEFAULT, LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC2_BASE)); 403 __raw_writel(SIC2_ATR_DEFAULT,
404 LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC2_BASE));
390 405
391 /* Configure supported IRQ's */ 406 /* Configure supported IRQ's */
392 for (i = 0; i < NR_IRQS; i++) { 407 for (i = 0; i < NR_IRQS; i++) {
diff --git a/arch/arm/mach-lpc32xx/serial.c b/arch/arm/mach-lpc32xx/serial.c
index 429cfdbb2b3d..f2735281616a 100644
--- a/arch/arm/mach-lpc32xx/serial.c
+++ b/arch/arm/mach-lpc32xx/serial.c
@@ -88,6 +88,7 @@ struct uartinit {
88 char *uart_ck_name; 88 char *uart_ck_name;
89 u32 ck_mode_mask; 89 u32 ck_mode_mask;
90 void __iomem *pdiv_clk_reg; 90 void __iomem *pdiv_clk_reg;
91 resource_size_t mapbase;
91}; 92};
92 93
93static struct uartinit uartinit_data[] __initdata = { 94static struct uartinit uartinit_data[] __initdata = {
@@ -97,6 +98,7 @@ static struct uartinit uartinit_data[] __initdata = {
97 .ck_mode_mask = 98 .ck_mode_mask =
98 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 5), 99 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 5),
99 .pdiv_clk_reg = LPC32XX_CLKPWR_UART5_CLK_CTRL, 100 .pdiv_clk_reg = LPC32XX_CLKPWR_UART5_CLK_CTRL,
101 .mapbase = LPC32XX_UART5_BASE,
100 }, 102 },
101#endif 103#endif
102#ifdef CONFIG_ARCH_LPC32XX_UART3_SELECT 104#ifdef CONFIG_ARCH_LPC32XX_UART3_SELECT
@@ -105,6 +107,7 @@ static struct uartinit uartinit_data[] __initdata = {
105 .ck_mode_mask = 107 .ck_mode_mask =
106 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 3), 108 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 3),
107 .pdiv_clk_reg = LPC32XX_CLKPWR_UART3_CLK_CTRL, 109 .pdiv_clk_reg = LPC32XX_CLKPWR_UART3_CLK_CTRL,
110 .mapbase = LPC32XX_UART3_BASE,
108 }, 111 },
109#endif 112#endif
110#ifdef CONFIG_ARCH_LPC32XX_UART4_SELECT 113#ifdef CONFIG_ARCH_LPC32XX_UART4_SELECT
@@ -113,6 +116,7 @@ static struct uartinit uartinit_data[] __initdata = {
113 .ck_mode_mask = 116 .ck_mode_mask =
114 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 4), 117 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 4),
115 .pdiv_clk_reg = LPC32XX_CLKPWR_UART4_CLK_CTRL, 118 .pdiv_clk_reg = LPC32XX_CLKPWR_UART4_CLK_CTRL,
119 .mapbase = LPC32XX_UART4_BASE,
116 }, 120 },
117#endif 121#endif
118#ifdef CONFIG_ARCH_LPC32XX_UART6_SELECT 122#ifdef CONFIG_ARCH_LPC32XX_UART6_SELECT
@@ -121,6 +125,7 @@ static struct uartinit uartinit_data[] __initdata = {
121 .ck_mode_mask = 125 .ck_mode_mask =
122 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 6), 126 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 6),
123 .pdiv_clk_reg = LPC32XX_CLKPWR_UART6_CLK_CTRL, 127 .pdiv_clk_reg = LPC32XX_CLKPWR_UART6_CLK_CTRL,
128 .mapbase = LPC32XX_UART6_BASE,
124 }, 129 },
125#endif 130#endif
126}; 131};
@@ -165,11 +170,24 @@ void __init lpc32xx_serial_init(void)
165 170
166 /* pre-UART clock divider set to 1 */ 171 /* pre-UART clock divider set to 1 */
167 __raw_writel(0x0101, uartinit_data[i].pdiv_clk_reg); 172 __raw_writel(0x0101, uartinit_data[i].pdiv_clk_reg);
173
174 /*
175 * Force a flush of the RX FIFOs to work around a
176 * HW bug
177 */
178 puart = uartinit_data[i].mapbase;
179 __raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart));
180 __raw_writel(0x00, LPC32XX_UART_DLL_FIFO(puart));
181 j = LPC32XX_SUART_FIFO_SIZE;
182 while (j--)
183 tmp = __raw_readl(
184 LPC32XX_UART_DLL_FIFO(puart));
185 __raw_writel(0, LPC32XX_UART_IIR_FCR(puart));
168 } 186 }
169 187
170 /* This needs to be done after all UART clocks are setup */ 188 /* This needs to be done after all UART clocks are setup */
171 __raw_writel(clkmodes, LPC32XX_UARTCTL_CLKMODE); 189 __raw_writel(clkmodes, LPC32XX_UARTCTL_CLKMODE);
172 for (i = 0; i < ARRAY_SIZE(uartinit_data) - 1; i++) { 190 for (i = 0; i < ARRAY_SIZE(uartinit_data); i++) {
173 /* Force a flush of the RX FIFOs to work around a HW bug */ 191 /* Force a flush of the RX FIFOs to work around a HW bug */
174 puart = serial_std_platform_data[i].mapbase; 192 puart = serial_std_platform_data[i].mapbase;
175 __raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart)); 193 __raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart));
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 17cb76060125..3588a5584153 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -17,7 +17,6 @@
17#include <linux/mtd/partitions.h> 17#include <linux/mtd/partitions.h>
18#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/gpio.h>
21 20
22#include <asm/mach-types.h> 21#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 7bc17eaa12eb..ada1213982b4 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -24,7 +24,6 @@
24#include <mach/dma.h> 24#include <mach/dma.h>
25#include <mach/devices.h> 25#include <mach/devices.h>
26#include <mach/mfp.h> 26#include <mach/mfp.h>
27#include <linux/platform_device.h>
28#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
29#include <mach/pxa168.h> 28#include <mach/pxa168.h>
30 29
diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c
index 8e3b5af04a57..bc97170125bf 100644
--- a/arch/arm/mach-mmp/tavorevb.c
+++ b/arch/arm/mach-mmp/tavorevb.c
@@ -12,7 +12,6 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/smc91x.h> 14#include <linux/smc91x.h>
15#include <linux/gpio.h>
16 15
17#include <asm/mach-types.h> 16#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 289a6b82c5f7..74de3e39a10d 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -419,13 +419,13 @@ static void __init innovator_init(void)
419#ifdef CONFIG_ARCH_OMAP15XX 419#ifdef CONFIG_ARCH_OMAP15XX
420 if (cpu_is_omap1510()) { 420 if (cpu_is_omap1510()) {
421 omap1_usb_init(&innovator1510_usb_config); 421 omap1_usb_init(&innovator1510_usb_config);
422 innovator_config[1].data = &innovator1510_lcd_config; 422 innovator_config[0].data = &innovator1510_lcd_config;
423 } 423 }
424#endif 424#endif
425#ifdef CONFIG_ARCH_OMAP16XX 425#ifdef CONFIG_ARCH_OMAP16XX
426 if (cpu_is_omap1610()) { 426 if (cpu_is_omap1610()) {
427 omap1_usb_init(&h2_usb_config); 427 omap1_usb_init(&h2_usb_config);
428 innovator_config[1].data = &innovator1610_lcd_config; 428 innovator_config[0].data = &innovator1610_lcd_config;
429 } 429 }
430#endif 430#endif
431 omap_board_config = innovator_config; 431 omap_board_config = innovator_config;
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index d965da45160e..e20c8ab80b0e 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -364,8 +364,8 @@ config OMAP3_SDRC_AC_TIMING
364 going on could result in system crashes; 364 going on could result in system crashes;
365 365
366config OMAP4_ERRATA_I688 366config OMAP4_ERRATA_I688
367 bool "OMAP4 errata: Async Bridge Corruption (BROKEN)" 367 bool "OMAP4 errata: Async Bridge Corruption"
368 depends on ARCH_OMAP4 && BROKEN 368 depends on ARCH_OMAP4
369 select ARCH_HAS_BARRIERS 369 select ARCH_HAS_BARRIERS
370 help 370 help
371 If a data is stalled inside asynchronous bridge because of back 371 If a data is stalled inside asynchronous bridge because of back
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 6b77ad95981d..a659e198892b 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -381,7 +381,7 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
381 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI"); 381 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
382 382
383 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 383 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
384 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 384 gpio_leds[0].gpio = gpio + TWL4030_GPIO_MAX + 1;
385 385
386 platform_device_register(&leds_gpio); 386 platform_device_register(&leds_gpio);
387 387
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index f78ec4e6a5c7..4897ec02e798 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -132,6 +132,7 @@ void omap3_map_io(void);
132void am33xx_map_io(void); 132void am33xx_map_io(void);
133void omap4_map_io(void); 133void omap4_map_io(void);
134void ti81xx_map_io(void); 134void ti81xx_map_io(void);
135void omap_barriers_init(void);
135 136
136extern void __init omap_init_consistent_dma_size(void); 137extern void __init omap_init_consistent_dma_size(void);
137 138
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index cfdbb86bc84e..72e018b9b260 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -65,7 +65,6 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
65 struct timespec ts_preidle, ts_postidle, ts_idle; 65 struct timespec ts_preidle, ts_postidle, ts_idle;
66 u32 cpu1_state; 66 u32 cpu1_state;
67 int idle_time; 67 int idle_time;
68 int new_state_idx;
69 int cpu_id = smp_processor_id(); 68 int cpu_id = smp_processor_id();
70 69
71 /* Used to keep track of the total time in idle */ 70 /* Used to keep track of the total time in idle */
@@ -84,8 +83,8 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
84 */ 83 */
85 cpu1_state = pwrdm_read_pwrst(cpu1_pd); 84 cpu1_state = pwrdm_read_pwrst(cpu1_pd);
86 if (cpu1_state != PWRDM_POWER_OFF) { 85 if (cpu1_state != PWRDM_POWER_OFF) {
87 new_state_idx = drv->safe_state_index; 86 index = drv->safe_state_index;
88 cx = cpuidle_get_statedata(&dev->states_usage[new_state_idx]); 87 cx = cpuidle_get_statedata(&dev->states_usage[index]);
89 } 88 }
90 89
91 if (index > 0) 90 if (index > 0)
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
index 997033129d26..bbb870c04a5e 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -19,6 +19,8 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/smsc911x.h> 21#include <linux/smsc911x.h>
22#include <linux/regulator/fixed.h>
23#include <linux/regulator/machine.h>
22 24
23#include <plat/board.h> 25#include <plat/board.h>
24#include <plat/gpmc.h> 26#include <plat/gpmc.h>
@@ -42,6 +44,50 @@ static struct smsc911x_platform_config gpmc_smsc911x_config = {
42 .flags = SMSC911X_USE_16BIT, 44 .flags = SMSC911X_USE_16BIT,
43}; 45};
44 46
47static struct regulator_consumer_supply gpmc_smsc911x_supply[] = {
48 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
49 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
50};
51
52/* Generic regulator definition to satisfy smsc911x */
53static struct regulator_init_data gpmc_smsc911x_reg_init_data = {
54 .constraints = {
55 .min_uV = 3300000,
56 .max_uV = 3300000,
57 .valid_modes_mask = REGULATOR_MODE_NORMAL
58 | REGULATOR_MODE_STANDBY,
59 .valid_ops_mask = REGULATOR_CHANGE_MODE
60 | REGULATOR_CHANGE_STATUS,
61 },
62 .num_consumer_supplies = ARRAY_SIZE(gpmc_smsc911x_supply),
63 .consumer_supplies = gpmc_smsc911x_supply,
64};
65
66static struct fixed_voltage_config gpmc_smsc911x_fixed_reg_data = {
67 .supply_name = "gpmc_smsc911x",
68 .microvolts = 3300000,
69 .gpio = -EINVAL,
70 .startup_delay = 0,
71 .enable_high = 0,
72 .enabled_at_boot = 1,
73 .init_data = &gpmc_smsc911x_reg_init_data,
74};
75
76/*
77 * Platform device id of 42 is a temporary fix to avoid conflicts
78 * with other reg-fixed-voltage devices. The real fix should
79 * involve the driver core providing a way of dynamically
80 * assigning a unique id on registration for platform devices
81 * in the same name space.
82 */
83static struct platform_device gpmc_smsc911x_regulator = {
84 .name = "reg-fixed-voltage",
85 .id = 42,
86 .dev = {
87 .platform_data = &gpmc_smsc911x_fixed_reg_data,
88 },
89};
90
45/* 91/*
46 * Initialize smsc911x device connected to the GPMC. Note that we 92 * Initialize smsc911x device connected to the GPMC. Note that we
47 * assume that pin multiplexing is done in the board-*.c file, 93 * assume that pin multiplexing is done in the board-*.c file,
@@ -55,6 +101,12 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
55 101
56 gpmc_cfg = board_data; 102 gpmc_cfg = board_data;
57 103
104 ret = platform_device_register(&gpmc_smsc911x_regulator);
105 if (ret < 0) {
106 pr_err("Unable to register smsc911x regulators: %d\n", ret);
107 return;
108 }
109
58 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) { 110 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) {
59 pr_err("Failed to request GPMC mem region\n"); 111 pr_err("Failed to request GPMC mem region\n");
60 return; 112 return;
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 3203128eef7d..0b73d3153604 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -304,6 +304,7 @@ void __init omapam33xx_map_common_io(void)
304void __init omap44xx_map_common_io(void) 304void __init omap44xx_map_common_io(void)
305{ 305{
306 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 306 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
307 omap_barriers_init();
307} 308}
308#endif 309#endif
309 310
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 609ea2ded7e3..2cc1aa004b94 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -281,8 +281,16 @@ static struct omap_mbox mbox_iva_info = {
281 .ops = &omap2_mbox_ops, 281 .ops = &omap2_mbox_ops,
282 .priv = &omap2_mbox_iva_priv, 282 .priv = &omap2_mbox_iva_priv,
283}; 283};
284#endif
284 285
285struct omap_mbox *omap2_mboxes[] = { &mbox_dsp_info, &mbox_iva_info, NULL }; 286#ifdef CONFIG_ARCH_OMAP2
287struct omap_mbox *omap2_mboxes[] = {
288 &mbox_dsp_info,
289#ifdef CONFIG_SOC_OMAP2420
290 &mbox_iva_info,
291#endif
292 NULL
293};
286#endif 294#endif
287 295
288#if defined(CONFIG_ARCH_OMAP4) 296#if defined(CONFIG_ARCH_OMAP4)
@@ -412,7 +420,8 @@ static void __exit omap2_mbox_exit(void)
412 platform_driver_unregister(&omap2_mbox_driver); 420 platform_driver_unregister(&omap2_mbox_driver);
413} 421}
414 422
415module_init(omap2_mbox_init); 423/* must be ready before omap3isp is probed */
424subsys_initcall(omap2_mbox_init);
416module_exit(omap2_mbox_exit); 425module_exit(omap2_mbox_exit);
417 426
418MODULE_LICENSE("GPL v2"); 427MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 40a8fbc07e4b..ebc595091312 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -24,6 +24,7 @@
24 24
25#include <plat/irqs.h> 25#include <plat/irqs.h>
26#include <plat/sram.h> 26#include <plat/sram.h>
27#include <plat/omap-secure.h>
27 28
28#include <mach/hardware.h> 29#include <mach/hardware.h>
29#include <mach/omap-wakeupgen.h> 30#include <mach/omap-wakeupgen.h>
@@ -43,6 +44,9 @@ static void __iomem *sar_ram_base;
43 44
44void __iomem *dram_sync, *sram_sync; 45void __iomem *dram_sync, *sram_sync;
45 46
47static phys_addr_t paddr;
48static u32 size;
49
46void omap_bus_sync(void) 50void omap_bus_sync(void)
47{ 51{
48 if (dram_sync && sram_sync) { 52 if (dram_sync && sram_sync) {
@@ -52,18 +56,20 @@ void omap_bus_sync(void)
52 } 56 }
53} 57}
54 58
55static int __init omap_barriers_init(void) 59/* Steal one page physical memory for barrier implementation */
60int __init omap_barrier_reserve_memblock(void)
56{ 61{
57 struct map_desc dram_io_desc[1];
58 phys_addr_t paddr;
59 u32 size;
60
61 if (!cpu_is_omap44xx())
62 return -ENODEV;
63 62
64 size = ALIGN(PAGE_SIZE, SZ_1M); 63 size = ALIGN(PAGE_SIZE, SZ_1M);
65 paddr = arm_memblock_steal(size, SZ_1M); 64 paddr = arm_memblock_steal(size, SZ_1M);
66 65
66 return 0;
67}
68
69void __init omap_barriers_init(void)
70{
71 struct map_desc dram_io_desc[1];
72
67 dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA; 73 dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA;
68 dram_io_desc[0].pfn = __phys_to_pfn(paddr); 74 dram_io_desc[0].pfn = __phys_to_pfn(paddr);
69 dram_io_desc[0].length = size; 75 dram_io_desc[0].length = size;
@@ -75,9 +81,10 @@ static int __init omap_barriers_init(void)
75 pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n", 81 pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n",
76 (long long) paddr, dram_io_desc[0].virtual); 82 (long long) paddr, dram_io_desc[0].virtual);
77 83
78 return 0;
79} 84}
80core_initcall(omap_barriers_init); 85#else
86void __init omap_barriers_init(void)
87{}
81#endif 88#endif
82 89
83void __init gic_init_irq(void) 90void __init gic_init_irq(void)
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 28706696a341..d383f71b4867 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -189,14 +189,17 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
189 freq = clk->rate; 189 freq = clk->rate;
190 clk_put(clk); 190 clk_put(clk);
191 191
192 rcu_read_lock();
192 opp = opp_find_freq_ceil(dev, &freq); 193 opp = opp_find_freq_ceil(dev, &freq);
193 if (IS_ERR(opp)) { 194 if (IS_ERR(opp)) {
195 rcu_read_unlock();
194 pr_err("%s: unable to find boot up OPP for vdd_%s\n", 196 pr_err("%s: unable to find boot up OPP for vdd_%s\n",
195 __func__, vdd_name); 197 __func__, vdd_name);
196 goto exit; 198 goto exit;
197 } 199 }
198 200
199 bootup_volt = opp_get_voltage(opp); 201 bootup_volt = opp_get_voltage(opp);
202 rcu_read_unlock();
200 if (!bootup_volt) { 203 if (!bootup_volt) {
201 pr_err("%s: unable to find voltage corresponding " 204 pr_err("%s: unable to find voltage corresponding "
202 "to the bootup OPP for vdd_%s\n", __func__, vdd_name); 205 "to the bootup OPP for vdd_%s\n", __func__, vdd_name);
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 771dc781b746..f51348dafafd 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -486,7 +486,7 @@ static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
486void __init usbhs_init(const struct usbhs_omap_board_data *pdata) 486void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
487{ 487{
488 struct omap_hwmod *oh[2]; 488 struct omap_hwmod *oh[2];
489 struct omap_device *od; 489 struct platform_device *pdev;
490 int bus_id = -1; 490 int bus_id = -1;
491 int i; 491 int i;
492 492
@@ -522,11 +522,11 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
522 return; 522 return;
523 } 523 }
524 524
525 od = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2, 525 pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
526 (void *)&usbhs_data, sizeof(usbhs_data), 526 (void *)&usbhs_data, sizeof(usbhs_data),
527 omap_uhhtll_latency, 527 omap_uhhtll_latency,
528 ARRAY_SIZE(omap_uhhtll_latency), false); 528 ARRAY_SIZE(omap_uhhtll_latency), false);
529 if (IS_ERR(od)) { 529 if (IS_ERR(pdev)) {
530 pr_err("Could not build hwmod devices %s,%s\n", 530 pr_err("Could not build hwmod devices %s,%s\n",
531 USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME); 531 USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
532 return; 532 return;
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index fb9b62dcf4ca..208eef1c0485 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -45,6 +45,7 @@
45#include <mach/hx4700.h> 45#include <mach/hx4700.h>
46#include <mach/irda.h> 46#include <mach/irda.h>
47 47
48#include <sound/ak4641.h>
48#include <video/platform_lcd.h> 49#include <video/platform_lcd.h>
49#include <video/w100fb.h> 50#include <video/w100fb.h>
50 51
@@ -765,6 +766,28 @@ static struct i2c_board_info __initdata pi2c_board_info[] = {
765}; 766};
766 767
767/* 768/*
769 * Asahi Kasei AK4641 on I2C
770 */
771
772static struct ak4641_platform_data ak4641_info = {
773 .gpio_power = GPIO27_HX4700_CODEC_ON,
774 .gpio_npdn = GPIO109_HX4700_CODEC_nPDN,
775};
776
777static struct i2c_board_info i2c_board_info[] __initdata = {
778 {
779 I2C_BOARD_INFO("ak4641", 0x12),
780 .platform_data = &ak4641_info,
781 },
782};
783
784static struct platform_device audio = {
785 .name = "hx4700-audio",
786 .id = -1,
787};
788
789
790/*
768 * PCMCIA 791 * PCMCIA
769 */ 792 */
770 793
@@ -790,6 +813,7 @@ static struct platform_device *devices[] __initdata = {
790 &gpio_vbus, 813 &gpio_vbus,
791 &power_supply, 814 &power_supply,
792 &strataflash, 815 &strataflash,
816 &audio,
793 &pcmcia, 817 &pcmcia,
794}; 818};
795 819
@@ -827,6 +851,7 @@ static void __init hx4700_init(void)
827 pxa_set_ficp_info(&ficp_info); 851 pxa_set_ficp_info(&ficp_info);
828 pxa27x_set_i2c_power_info(NULL); 852 pxa27x_set_i2c_power_info(NULL);
829 pxa_set_i2c_info(NULL); 853 pxa_set_i2c_info(NULL);
854 i2c_register_board_info(0, ARRAY_AND_SIZE(i2c_board_info));
830 i2c_register_board_info(1, ARRAY_AND_SIZE(pi2c_board_info)); 855 i2c_register_board_info(1, ARRAY_AND_SIZE(pi2c_board_info));
831 pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); 856 pxa2xx_set_spi_info(2, &pxa_ssp2_master_info);
832 spi_register_board_info(ARRAY_AND_SIZE(tsc2046_board_info)); 857 spi_register_board_info(ARRAY_AND_SIZE(tsc2046_board_info));
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 91e4f6c03766..00d6eacab8e4 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -25,7 +25,6 @@
25#include <linux/suspend.h> 25#include <linux/suspend.h>
26#include <linux/syscore_ops.h> 26#include <linux/syscore_ops.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <linux/gpio.h>
29 28
30#include <asm/mach/map.h> 29#include <asm/mach/map.h>
31#include <asm/suspend.h> 30#include <asm/suspend.h>
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index aed6cbcf3866..c1673b3441d4 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -22,7 +22,6 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/i2c/pxa-i2c.h> 24#include <linux/i2c/pxa-i2c.h>
25#include <linux/gpio.h>
26 25
27#include <asm/mach/map.h> 26#include <asm/mach/map.h>
28#include <mach/hardware.h> 27#include <mach/hardware.h>
diff --git a/arch/arm/mach-pxa/saarb.c b/arch/arm/mach-pxa/saarb.c
index febc809ed5a6..5aded5e6148f 100644
--- a/arch/arm/mach-pxa/saarb.c
+++ b/arch/arm/mach-pxa/saarb.c
@@ -15,7 +15,6 @@
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/i2c/pxa-i2c.h> 16#include <linux/i2c/pxa-i2c.h>
17#include <linux/mfd/88pm860x.h> 17#include <linux/mfd/88pm860x.h>
18#include <linux/gpio.h>
19 18
20#include <asm/mach-types.h> 19#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 8d5168d253a9..30989baf7f2a 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -168,6 +168,7 @@ struct battery_thresh sharpsl_battery_levels_noac[] = {
168#define MAXCTRL_SEL_SH 4 168#define MAXCTRL_SEL_SH 4
169#define MAXCTRL_STR (1u << 7) 169#define MAXCTRL_STR (1u << 7)
170 170
171extern int max1111_read_channel(int);
171/* 172/*
172 * Read MAX1111 ADC 173 * Read MAX1111 ADC
173 */ 174 */
@@ -177,8 +178,6 @@ int sharpsl_pm_pxa_read_max1111(int channel)
177 if (machine_is_tosa()) 178 if (machine_is_tosa())
178 return 0; 179 return 0;
179 180
180 extern int max1111_read_channel(int);
181
182 /* max1111 accepts channels from 0-3, however, 181 /* max1111 accepts channels from 0-3, however,
183 * it is encoded from 0-7 here in the code. 182 * it is encoded from 0-7 here in the code.
184 */ 183 */
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 34cbdac51525..438f02fe122a 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -172,10 +172,9 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)
172static unsigned long spitz_charger_wakeup(void) 172static unsigned long spitz_charger_wakeup(void)
173{ 173{
174 unsigned long ret; 174 unsigned long ret;
175 ret = (!gpio_get_value(SPITZ_GPIO_KEY_INT) 175 ret = ((!gpio_get_value(SPITZ_GPIO_KEY_INT)
176 << GPIO_bit(SPITZ_GPIO_KEY_INT)) 176 << GPIO_bit(SPITZ_GPIO_KEY_INT))
177 | (!gpio_get_value(SPITZ_GPIO_SYNC) 177 | gpio_get_value(SPITZ_GPIO_SYNC));
178 << GPIO_bit(SPITZ_GPIO_SYNC));
179 return ret; 178 return ret;
180} 179}
181 180
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 06383b51e655..4de7d1e79e73 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -69,6 +69,7 @@ void __init omap_reserve(void)
69 omap_vram_reserve_sdram_memblock(); 69 omap_vram_reserve_sdram_memblock();
70 omap_dsp_reserve_sdram_memblock(); 70 omap_dsp_reserve_sdram_memblock();
71 omap_secure_ram_reserve_memblock(); 71 omap_secure_ram_reserve_memblock();
72 omap_barrier_reserve_memblock();
72} 73}
73 74
74void __init omap_init_consistent_dma_size(void) 75void __init omap_init_consistent_dma_size(void)
diff --git a/arch/arm/plat-omap/include/plat/omap-secure.h b/arch/arm/plat-omap/include/plat/omap-secure.h
index 3047ff923a63..8c7994ce9869 100644
--- a/arch/arm/plat-omap/include/plat/omap-secure.h
+++ b/arch/arm/plat-omap/include/plat/omap-secure.h
@@ -10,4 +10,10 @@ static inline void omap_secure_ram_reserve_memblock(void)
10{ } 10{ }
11#endif 11#endif
12 12
13#ifdef CONFIG_OMAP4_ERRATA_I688
14extern int omap_barrier_reserve_memblock(void);
15#else
16static inline void omap_barrier_reserve_memblock(void)
17{ }
18#endif
13#endif /* __OMAP_SECURE_H__ */ 19#endif /* __OMAP_SECURE_H__ */
diff --git a/arch/openrisc/include/asm/ptrace.h b/arch/openrisc/include/asm/ptrace.h
index 054537c5f9c9..e612ce4512c7 100644
--- a/arch/openrisc/include/asm/ptrace.h
+++ b/arch/openrisc/include/asm/ptrace.h
@@ -77,7 +77,6 @@ struct pt_regs {
77 long syscallno; /* Syscall number (used by strace) */ 77 long syscallno; /* Syscall number (used by strace) */
78 long dummy; /* Cheap alignment fix */ 78 long dummy; /* Cheap alignment fix */
79}; 79};
80#endif /* __ASSEMBLY__ */
81 80
82/* TODO: Rename this to REDZONE because that's what it is */ 81/* TODO: Rename this to REDZONE because that's what it is */
83#define STACK_FRAME_OVERHEAD 128 /* size of minimum stack frame */ 82#define STACK_FRAME_OVERHEAD 128 /* size of minimum stack frame */
@@ -87,6 +86,13 @@ struct pt_regs {
87#define user_stack_pointer(regs) ((unsigned long)(regs)->sp) 86#define user_stack_pointer(regs) ((unsigned long)(regs)->sp)
88#define profile_pc(regs) instruction_pointer(regs) 87#define profile_pc(regs) instruction_pointer(regs)
89 88
89static inline long regs_return_value(struct pt_regs *regs)
90{
91 return regs->gpr[11];
92}
93
94#endif /* __ASSEMBLY__ */
95
90/* 96/*
91 * Offsets used by 'ptrace' system call interface. 97 * Offsets used by 'ptrace' system call interface.
92 */ 98 */
diff --git a/arch/openrisc/kernel/init_task.c b/arch/openrisc/kernel/init_task.c
index 45744a384927..ca534082d5f3 100644
--- a/arch/openrisc/kernel/init_task.c
+++ b/arch/openrisc/kernel/init_task.c
@@ -17,6 +17,7 @@
17 17
18#include <linux/init_task.h> 18#include <linux/init_task.h>
19#include <linux/mqueue.h> 19#include <linux/mqueue.h>
20#include <linux/export.h>
20 21
21static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 22static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
22static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 23static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
diff --git a/arch/openrisc/kernel/irq.c b/arch/openrisc/kernel/irq.c
index 59b302338331..4bfead220956 100644
--- a/arch/openrisc/kernel/irq.c
+++ b/arch/openrisc/kernel/irq.c
@@ -23,6 +23,7 @@
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/seq_file.h> 24#include <linux/seq_file.h>
25#include <linux/kernel_stat.h> 25#include <linux/kernel_stat.h>
26#include <linux/export.h>
26 27
27#include <linux/irqflags.h> 28#include <linux/irqflags.h>
28 29
diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c
index 656b94beab89..7259047d5f9d 100644
--- a/arch/openrisc/kernel/ptrace.c
+++ b/arch/openrisc/kernel/ptrace.c
@@ -188,11 +188,9 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
188 */ 188 */
189 ret = -1L; 189 ret = -1L;
190 190
191 /* Are these regs right??? */ 191 audit_syscall_entry(audit_arch(), regs->syscallno,
192 if (unlikely(current->audit_context)) 192 regs->gpr[3], regs->gpr[4],
193 audit_syscall_entry(audit_arch(), regs->syscallno, 193 regs->gpr[5], regs->gpr[6]);
194 regs->gpr[3], regs->gpr[4],
195 regs->gpr[5], regs->gpr[6]);
196 194
197 return ret ? : regs->syscallno; 195 return ret ? : regs->syscallno;
198} 196}
@@ -201,9 +199,7 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
201{ 199{
202 int step; 200 int step;
203 201
204 if (unlikely(current->audit_context)) 202 audit_syscall_exit(regs);
205 audit_syscall_exit(AUDITSC_RESULT(regs->gpr[11]),
206 regs->gpr[11]);
207 203
208 step = test_thread_flag(TIF_SINGLESTEP); 204 step = test_thread_flag(TIF_SINGLESTEP);
209 if (step || test_thread_flag(TIF_SYSCALL_TRACE)) 205 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 55cca1dac431..19ab7b2ea1cd 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -31,7 +31,11 @@ ifdef CONFIG_64BIT
31UTS_MACHINE := parisc64 31UTS_MACHINE := parisc64
32CHECKFLAGS += -D__LP64__=1 -m64 32CHECKFLAGS += -D__LP64__=1 -m64
33WIDTH := 64 33WIDTH := 64
34
35# FIXME: if no default set, should really try to locate dynamically
36ifeq ($(CROSS_COMPILE),)
34CROSS_COMPILE := hppa64-linux-gnu- 37CROSS_COMPILE := hppa64-linux-gnu-
38endif
35else # 32-bit 39else # 32-bit
36WIDTH := 40WIDTH :=
37endif 41endif
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index d1727584230a..6d99a5fcc090 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -227,6 +227,9 @@ config COMPAT
227config SYSVIPC_COMPAT 227config SYSVIPC_COMPAT
228 def_bool y if COMPAT && SYSVIPC 228 def_bool y if COMPAT && SYSVIPC
229 229
230config KEYS_COMPAT
231 def_bool y if COMPAT && KEYS
232
230config AUDIT_ARCH 233config AUDIT_ARCH
231 def_bool y 234 def_bool y
232 235
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index 2e49748b27da..234f1d859cea 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -172,13 +172,6 @@ static inline int is_compat_task(void)
172 return is_32bit_task(); 172 return is_32bit_task();
173} 173}
174 174
175#else
176
177static inline int is_compat_task(void)
178{
179 return 0;
180}
181
182#endif 175#endif
183 176
184static inline void __user *arch_compat_alloc_user_space(long len) 177static inline void __user *arch_compat_alloc_user_space(long len)
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index 39f8fd4438fc..c383ce440d99 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -11,7 +11,6 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/gfp.h> 12#include <linux/gfp.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/crash_dump.h>
15#include <linux/bootmem.h> 14#include <linux/bootmem.h>
16#include <linux/elf.h> 15#include <linux/elf.h>
17#include <asm/ipl.h> 16#include <asm/ipl.h>
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 4261aa799774..e795933eb2cb 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -29,7 +29,6 @@
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/timer.h> 30#include <asm/timer.h>
31#include <asm/nmi.h> 31#include <asm/nmi.h>
32#include <asm/compat.h>
33#include <asm/smp.h> 32#include <asm/smp.h>
34#include "entry.h" 33#include "entry.h"
35 34
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 9d82ed4bcb27..61f95489d70c 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -20,8 +20,8 @@
20#include <linux/regset.h> 20#include <linux/regset.h>
21#include <linux/tracehook.h> 21#include <linux/tracehook.h>
22#include <linux/seccomp.h> 22#include <linux/seccomp.h>
23#include <linux/compat.h>
23#include <trace/syscall.h> 24#include <trace/syscall.h>
24#include <asm/compat.h>
25#include <asm/segment.h> 25#include <asm/segment.h>
26#include <asm/page.h> 26#include <asm/page.h>
27#include <asm/pgtable.h> 27#include <asm/pgtable.h>
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 354de0763eff..3b2efc81f34e 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -46,6 +46,7 @@
46#include <linux/kexec.h> 46#include <linux/kexec.h>
47#include <linux/crash_dump.h> 47#include <linux/crash_dump.h>
48#include <linux/memory.h> 48#include <linux/memory.h>
49#include <linux/compat.h>
49 50
50#include <asm/ipl.h> 51#include <asm/ipl.h>
51#include <asm/uaccess.h> 52#include <asm/uaccess.h>
@@ -59,7 +60,6 @@
59#include <asm/ptrace.h> 60#include <asm/ptrace.h>
60#include <asm/sections.h> 61#include <asm/sections.h>
61#include <asm/ebcdic.h> 62#include <asm/ebcdic.h>
62#include <asm/compat.h>
63#include <asm/kvm_virtio.h> 63#include <asm/kvm_virtio.h>
64#include <asm/diag.h> 64#include <asm/diag.h>
65 65
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index a8ba840294ff..2d421d90fada 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -30,7 +30,6 @@
30#include <asm/ucontext.h> 30#include <asm/ucontext.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32#include <asm/lowcore.h> 32#include <asm/lowcore.h>
33#include <asm/compat.h>
34#include "entry.h" 33#include "entry.h"
35 34
36#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 35#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 354dd39073ef..e8fcd928dc78 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -36,7 +36,6 @@
36#include <asm/pgtable.h> 36#include <asm/pgtable.h>
37#include <asm/irq.h> 37#include <asm/irq.h>
38#include <asm/mmu_context.h> 38#include <asm/mmu_context.h>
39#include <asm/compat.h>
40#include "../kernel/entry.h" 39#include "../kernel/entry.h"
41 40
42#ifndef CONFIG_64BIT 41#ifndef CONFIG_64BIT
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 5d633019d8f3..50236610de83 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -223,16 +223,38 @@ void free_initrd_mem(unsigned long start, unsigned long end)
223#ifdef CONFIG_MEMORY_HOTPLUG 223#ifdef CONFIG_MEMORY_HOTPLUG
224int arch_add_memory(int nid, u64 start, u64 size) 224int arch_add_memory(int nid, u64 start, u64 size)
225{ 225{
226 struct pglist_data *pgdat; 226 unsigned long zone_start_pfn, zone_end_pfn, nr_pages;
227 unsigned long start_pfn = PFN_DOWN(start);
228 unsigned long size_pages = PFN_DOWN(size);
227 struct zone *zone; 229 struct zone *zone;
228 int rc; 230 int rc;
229 231
230 pgdat = NODE_DATA(nid);
231 zone = pgdat->node_zones + ZONE_MOVABLE;
232 rc = vmem_add_mapping(start, size); 232 rc = vmem_add_mapping(start, size);
233 if (rc) 233 if (rc)
234 return rc; 234 return rc;
235 rc = __add_pages(nid, zone, PFN_DOWN(start), PFN_DOWN(size)); 235 for_each_zone(zone) {
236 if (zone_idx(zone) != ZONE_MOVABLE) {
237 /* Add range within existing zone limits */
238 zone_start_pfn = zone->zone_start_pfn;
239 zone_end_pfn = zone->zone_start_pfn +
240 zone->spanned_pages;
241 } else {
242 /* Add remaining range to ZONE_MOVABLE */
243 zone_start_pfn = start_pfn;
244 zone_end_pfn = start_pfn + size_pages;
245 }
246 if (start_pfn < zone_start_pfn || start_pfn >= zone_end_pfn)
247 continue;
248 nr_pages = (start_pfn + size_pages > zone_end_pfn) ?
249 zone_end_pfn - start_pfn : size_pages;
250 rc = __add_pages(nid, zone, start_pfn, nr_pages);
251 if (rc)
252 break;
253 start_pfn += nr_pages;
254 size_pages -= nr_pages;
255 if (!size_pages)
256 break;
257 }
236 if (rc) 258 if (rc)
237 vmem_remove_mapping(start, size); 259 vmem_remove_mapping(start, size);
238 return rc; 260 return rc;
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index f09c74881b7e..a0155c02e324 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -29,8 +29,8 @@
29#include <linux/mman.h> 29#include <linux/mman.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/random.h> 31#include <linux/random.h>
32#include <linux/compat.h>
32#include <asm/pgalloc.h> 33#include <asm/pgalloc.h>
33#include <asm/compat.h>
34 34
35static unsigned long stack_maxrandom_size(void) 35static unsigned long stack_maxrandom_size(void)
36{ 36{
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 096c975e099f..461ce432b1c2 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -242,4 +242,12 @@ static inline void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)
242static inline void perf_events_lapic_init(void) { } 242static inline void perf_events_lapic_init(void) { }
243#endif 243#endif
244 244
245#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
246 extern void amd_pmu_enable_virt(void);
247 extern void amd_pmu_disable_virt(void);
248#else
249 static inline void amd_pmu_enable_virt(void) { }
250 static inline void amd_pmu_disable_virt(void) { }
251#endif
252
245#endif /* _ASM_X86_PERF_EVENT_H */ 253#endif /* _ASM_X86_PERF_EVENT_H */
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 6b45e5e7a901..73d08ed98a64 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -326,8 +326,7 @@ static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb)
326 l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1; 326 l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1;
327} 327}
328 328
329static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, 329static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, int index)
330 int index)
331{ 330{
332 int node; 331 int node;
333 332
@@ -725,14 +724,16 @@ static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info);
725#define CPUID4_INFO_IDX(x, y) (&((per_cpu(ici_cpuid4_info, x))[y])) 724#define CPUID4_INFO_IDX(x, y) (&((per_cpu(ici_cpuid4_info, x))[y]))
726 725
727#ifdef CONFIG_SMP 726#ifdef CONFIG_SMP
728static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) 727
728static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index)
729{ 729{
730 struct _cpuid4_info *this_leaf, *sibling_leaf; 730 struct _cpuid4_info *this_leaf;
731 unsigned long num_threads_sharing; 731 int ret, i, sibling;
732 int index_msb, i, sibling;
733 struct cpuinfo_x86 *c = &cpu_data(cpu); 732 struct cpuinfo_x86 *c = &cpu_data(cpu);
734 733
735 if ((index == 3) && (c->x86_vendor == X86_VENDOR_AMD)) { 734 ret = 0;
735 if (index == 3) {
736 ret = 1;
736 for_each_cpu(i, cpu_llc_shared_mask(cpu)) { 737 for_each_cpu(i, cpu_llc_shared_mask(cpu)) {
737 if (!per_cpu(ici_cpuid4_info, i)) 738 if (!per_cpu(ici_cpuid4_info, i))
738 continue; 739 continue;
@@ -743,8 +744,35 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
743 set_bit(sibling, this_leaf->shared_cpu_map); 744 set_bit(sibling, this_leaf->shared_cpu_map);
744 } 745 }
745 } 746 }
746 return; 747 } else if ((c->x86 == 0x15) && ((index == 1) || (index == 2))) {
748 ret = 1;
749 for_each_cpu(i, cpu_sibling_mask(cpu)) {
750 if (!per_cpu(ici_cpuid4_info, i))
751 continue;
752 this_leaf = CPUID4_INFO_IDX(i, index);
753 for_each_cpu(sibling, cpu_sibling_mask(cpu)) {
754 if (!cpu_online(sibling))
755 continue;
756 set_bit(sibling, this_leaf->shared_cpu_map);
757 }
758 }
747 } 759 }
760
761 return ret;
762}
763
764static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
765{
766 struct _cpuid4_info *this_leaf, *sibling_leaf;
767 unsigned long num_threads_sharing;
768 int index_msb, i;
769 struct cpuinfo_x86 *c = &cpu_data(cpu);
770
771 if (c->x86_vendor == X86_VENDOR_AMD) {
772 if (cache_shared_amd_cpu_map_setup(cpu, index))
773 return;
774 }
775
748 this_leaf = CPUID4_INFO_IDX(cpu, index); 776 this_leaf = CPUID4_INFO_IDX(cpu, index);
749 num_threads_sharing = 1 + this_leaf->base.eax.split.num_threads_sharing; 777 num_threads_sharing = 1 + this_leaf->base.eax.split.num_threads_sharing;
750 778
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 786e76a86322..e4eeaaf58a47 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -528,6 +528,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
528 528
529 sprintf(name, "threshold_bank%i", bank); 529 sprintf(name, "threshold_bank%i", bank);
530 530
531#ifdef CONFIG_SMP
531 if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ 532 if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */
532 i = cpumask_first(cpu_llc_shared_mask(cpu)); 533 i = cpumask_first(cpu_llc_shared_mask(cpu));
533 534
@@ -553,6 +554,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
553 554
554 goto out; 555 goto out;
555 } 556 }
557#endif
556 558
557 b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL); 559 b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL);
558 if (!b) { 560 if (!b) {
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index 8944062f46e2..c30c807ddc72 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -147,7 +147,9 @@ struct cpu_hw_events {
147 /* 147 /*
148 * AMD specific bits 148 * AMD specific bits
149 */ 149 */
150 struct amd_nb *amd_nb; 150 struct amd_nb *amd_nb;
151 /* Inverted mask of bits to clear in the perf_ctr ctrl registers */
152 u64 perf_ctr_virt_mask;
151 153
152 void *kfree_on_online; 154 void *kfree_on_online;
153}; 155};
@@ -417,9 +419,11 @@ void x86_pmu_disable_all(void);
417static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, 419static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc,
418 u64 enable_mask) 420 u64 enable_mask)
419{ 421{
422 u64 disable_mask = __this_cpu_read(cpu_hw_events.perf_ctr_virt_mask);
423
420 if (hwc->extra_reg.reg) 424 if (hwc->extra_reg.reg)
421 wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config); 425 wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config);
422 wrmsrl(hwc->config_base, hwc->config | enable_mask); 426 wrmsrl(hwc->config_base, (hwc->config | enable_mask) & ~disable_mask);
423} 427}
424 428
425void x86_pmu_enable_all(int added); 429void x86_pmu_enable_all(int added);
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 0397b23be8e9..67250a52430b 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -1,4 +1,5 @@
1#include <linux/perf_event.h> 1#include <linux/perf_event.h>
2#include <linux/export.h>
2#include <linux/types.h> 3#include <linux/types.h>
3#include <linux/init.h> 4#include <linux/init.h>
4#include <linux/slab.h> 5#include <linux/slab.h>
@@ -357,7 +358,9 @@ static void amd_pmu_cpu_starting(int cpu)
357 struct amd_nb *nb; 358 struct amd_nb *nb;
358 int i, nb_id; 359 int i, nb_id;
359 360
360 if (boot_cpu_data.x86_max_cores < 2) 361 cpuc->perf_ctr_virt_mask = AMD_PERFMON_EVENTSEL_HOSTONLY;
362
363 if (boot_cpu_data.x86_max_cores < 2 || boot_cpu_data.x86 == 0x15)
361 return; 364 return;
362 365
363 nb_id = amd_get_nb_id(cpu); 366 nb_id = amd_get_nb_id(cpu);
@@ -587,9 +590,9 @@ static __initconst const struct x86_pmu amd_pmu_f15h = {
587 .put_event_constraints = amd_put_event_constraints, 590 .put_event_constraints = amd_put_event_constraints,
588 591
589 .cpu_prepare = amd_pmu_cpu_prepare, 592 .cpu_prepare = amd_pmu_cpu_prepare,
590 .cpu_starting = amd_pmu_cpu_starting,
591 .cpu_dead = amd_pmu_cpu_dead, 593 .cpu_dead = amd_pmu_cpu_dead,
592#endif 594#endif
595 .cpu_starting = amd_pmu_cpu_starting,
593}; 596};
594 597
595__init int amd_pmu_init(void) 598__init int amd_pmu_init(void)
@@ -621,3 +624,33 @@ __init int amd_pmu_init(void)
621 624
622 return 0; 625 return 0;
623} 626}
627
628void amd_pmu_enable_virt(void)
629{
630 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
631
632 cpuc->perf_ctr_virt_mask = 0;
633
634 /* Reload all events */
635 x86_pmu_disable_all();
636 x86_pmu_enable_all(0);
637}
638EXPORT_SYMBOL_GPL(amd_pmu_enable_virt);
639
640void amd_pmu_disable_virt(void)
641{
642 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
643
644 /*
645 * We only mask out the Host-only bit so that host-only counting works
646 * when SVM is disabled. If someone sets up a guest-only counter when
647 * SVM is disabled the Guest-only bits still gets set and the counter
648 * will not count anything.
649 */
650 cpuc->perf_ctr_virt_mask = AMD_PERFMON_EVENTSEL_HOSTONLY;
651
652 /* Reload all events */
653 x86_pmu_disable_all();
654 x86_pmu_enable_all(0);
655}
656EXPORT_SYMBOL_GPL(amd_pmu_disable_virt);
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 3fe8239fd8fb..1333d9851778 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1532,10 +1532,17 @@ ENTRY(nmi)
1532 pushq_cfi %rdx 1532 pushq_cfi %rdx
1533 1533
1534 /* 1534 /*
1535 * If %cs was not the kernel segment, then the NMI triggered in user
1536 * space, which means it is definitely not nested.
1537 */
1538 cmpl $__KERNEL_CS, 16(%rsp)
1539 jne first_nmi
1540
1541 /*
1535 * Check the special variable on the stack to see if NMIs are 1542 * Check the special variable on the stack to see if NMIs are
1536 * executing. 1543 * executing.
1537 */ 1544 */
1538 cmp $1, -8(%rsp) 1545 cmpl $1, -8(%rsp)
1539 je nested_nmi 1546 je nested_nmi
1540 1547
1541 /* 1548 /*
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index ac0417be9131..73465aab28f8 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -360,7 +360,6 @@ out:
360static enum ucode_state 360static enum ucode_state
361request_microcode_user(int cpu, const void __user *buf, size_t size) 361request_microcode_user(int cpu, const void __user *buf, size_t size)
362{ 362{
363 pr_info("AMD microcode update via /dev/cpu/microcode not supported\n");
364 return UCODE_ERROR; 363 return UCODE_ERROR;
365} 364}
366 365
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 5fa553babe56..e385214711cb 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -29,6 +29,7 @@
29#include <linux/ftrace_event.h> 29#include <linux/ftrace_event.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31 31
32#include <asm/perf_event.h>
32#include <asm/tlbflush.h> 33#include <asm/tlbflush.h>
33#include <asm/desc.h> 34#include <asm/desc.h>
34#include <asm/kvm_para.h> 35#include <asm/kvm_para.h>
@@ -575,6 +576,8 @@ static void svm_hardware_disable(void *garbage)
575 wrmsrl(MSR_AMD64_TSC_RATIO, TSC_RATIO_DEFAULT); 576 wrmsrl(MSR_AMD64_TSC_RATIO, TSC_RATIO_DEFAULT);
576 577
577 cpu_svm_disable(); 578 cpu_svm_disable();
579
580 amd_pmu_disable_virt();
578} 581}
579 582
580static int svm_hardware_enable(void *garbage) 583static int svm_hardware_enable(void *garbage)
@@ -622,6 +625,8 @@ static int svm_hardware_enable(void *garbage)
622 625
623 svm_init_erratum_383(); 626 svm_init_erratum_383();
624 627
628 amd_pmu_enable_virt();
629
625 return 0; 630 return 0;
626} 631}
627 632
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 12eb07bfb267..4172af8ceeb3 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1141,7 +1141,9 @@ asmlinkage void __init xen_start_kernel(void)
1141 1141
1142 /* Prevent unwanted bits from being set in PTEs. */ 1142 /* Prevent unwanted bits from being set in PTEs. */
1143 __supported_pte_mask &= ~_PAGE_GLOBAL; 1143 __supported_pte_mask &= ~_PAGE_GLOBAL;
1144#if 0
1144 if (!xen_initial_domain()) 1145 if (!xen_initial_domain())
1146#endif
1145 __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD); 1147 __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
1146 1148
1147 __supported_pte_mask |= _PAGE_IOMAP; 1149 __supported_pte_mask |= _PAGE_IOMAP;
@@ -1204,10 +1206,6 @@ asmlinkage void __init xen_start_kernel(void)
1204 1206
1205 pgd = (pgd_t *)xen_start_info->pt_base; 1207 pgd = (pgd_t *)xen_start_info->pt_base;
1206 1208
1207 if (!xen_initial_domain())
1208 __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
1209
1210 __supported_pte_mask |= _PAGE_IOMAP;
1211 /* Don't do the full vcpu_info placement stuff until we have a 1209 /* Don't do the full vcpu_info placement stuff until we have a
1212 possible map and a non-dummy shared_info. */ 1210 possible map and a non-dummy shared_info. */
1213 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; 1211 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 58a0e46c404d..95c1cf60c669 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -415,13 +415,13 @@ static pteval_t iomap_pte(pteval_t val)
415static pteval_t xen_pte_val(pte_t pte) 415static pteval_t xen_pte_val(pte_t pte)
416{ 416{
417 pteval_t pteval = pte.pte; 417 pteval_t pteval = pte.pte;
418 418#if 0
419 /* If this is a WC pte, convert back from Xen WC to Linux WC */ 419 /* If this is a WC pte, convert back from Xen WC to Linux WC */
420 if ((pteval & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) == _PAGE_PAT) { 420 if ((pteval & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) == _PAGE_PAT) {
421 WARN_ON(!pat_enabled); 421 WARN_ON(!pat_enabled);
422 pteval = (pteval & ~_PAGE_PAT) | _PAGE_PWT; 422 pteval = (pteval & ~_PAGE_PAT) | _PAGE_PWT;
423 } 423 }
424 424#endif
425 if (xen_initial_domain() && (pteval & _PAGE_IOMAP)) 425 if (xen_initial_domain() && (pteval & _PAGE_IOMAP))
426 return pteval; 426 return pteval;
427 427
@@ -463,7 +463,7 @@ void xen_set_pat(u64 pat)
463static pte_t xen_make_pte(pteval_t pte) 463static pte_t xen_make_pte(pteval_t pte)
464{ 464{
465 phys_addr_t addr = (pte & PTE_PFN_MASK); 465 phys_addr_t addr = (pte & PTE_PFN_MASK);
466 466#if 0
467 /* If Linux is trying to set a WC pte, then map to the Xen WC. 467 /* If Linux is trying to set a WC pte, then map to the Xen WC.
468 * If _PAGE_PAT is set, then it probably means it is really 468 * If _PAGE_PAT is set, then it probably means it is really
469 * _PAGE_PSE, so avoid fiddling with the PAT mapping and hope 469 * _PAGE_PSE, so avoid fiddling with the PAT mapping and hope
@@ -476,7 +476,7 @@ static pte_t xen_make_pte(pteval_t pte)
476 if ((pte & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT) 476 if ((pte & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT)
477 pte = (pte & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT; 477 pte = (pte & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT;
478 } 478 }
479 479#endif
480 /* 480 /*
481 * Unprivileged domains are allowed to do IOMAPpings for 481 * Unprivileged domains are allowed to do IOMAPpings for
482 * PCI passthrough, but not map ISA space. The ISA 482 * PCI passthrough, but not map ISA space. The ISA
diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c
index bd8ae788f689..e507cfbd044e 100644
--- a/block/partitions/ldm.c
+++ b/block/partitions/ldm.c
@@ -2,7 +2,7 @@
2 * ldm - Support for Windows Logical Disk Manager (Dynamic Disks) 2 * ldm - Support for Windows Logical Disk Manager (Dynamic Disks)
3 * 3 *
4 * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org> 4 * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org>
5 * Copyright (c) 2001-2007 Anton Altaparmakov 5 * Copyright (c) 2001-2012 Anton Altaparmakov
6 * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com> 6 * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com>
7 * 7 *
8 * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads 8 * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads
@@ -1341,20 +1341,17 @@ found:
1341 ldm_error("REC value (%d) exceeds NUM value (%d)", rec, f->num); 1341 ldm_error("REC value (%d) exceeds NUM value (%d)", rec, f->num);
1342 return false; 1342 return false;
1343 } 1343 }
1344
1345 if (f->map & (1 << rec)) { 1344 if (f->map & (1 << rec)) {
1346 ldm_error ("Duplicate VBLK, part %d.", rec); 1345 ldm_error ("Duplicate VBLK, part %d.", rec);
1347 f->map &= 0x7F; /* Mark the group as broken */ 1346 f->map &= 0x7F; /* Mark the group as broken */
1348 return false; 1347 return false;
1349 } 1348 }
1350
1351 f->map |= (1 << rec); 1349 f->map |= (1 << rec);
1352 1350 if (!rec)
1351 memcpy(f->data, data, VBLK_SIZE_HEAD);
1353 data += VBLK_SIZE_HEAD; 1352 data += VBLK_SIZE_HEAD;
1354 size -= VBLK_SIZE_HEAD; 1353 size -= VBLK_SIZE_HEAD;
1355 1354 memcpy(f->data + VBLK_SIZE_HEAD + rec * size, data, size);
1356 memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size);
1357
1358 return true; 1355 return true;
1359} 1356}
1360 1357
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 5d1d07645132..e8cd652d2017 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1206,9 +1206,9 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
1206 1206
1207 out_unmap_both: 1207 out_unmap_both:
1208 pci_set_drvdata(dev, NULL); 1208 pci_set_drvdata(dev, NULL);
1209 pci_iounmap(dev, card->config_regs);
1210 out_unmap_config:
1211 pci_iounmap(dev, card->buffers); 1209 pci_iounmap(dev, card->buffers);
1210 out_unmap_config:
1211 pci_iounmap(dev, card->config_regs);
1212 out_release_regions: 1212 out_release_regions:
1213 pci_release_regions(dev); 1213 pci_release_regions(dev);
1214 out: 1214 out:
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index f00f596c1029..789c9b579aea 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -102,6 +102,7 @@ static struct usb_device_id btusb_table[] = {
102 102
103 /* Broadcom BCM20702A0 */ 103 /* Broadcom BCM20702A0 */
104 { USB_DEVICE(0x0a5c, 0x21e3) }, 104 { USB_DEVICE(0x0a5c, 0x21e3) },
105 { USB_DEVICE(0x0a5c, 0x21f3) },
105 { USB_DEVICE(0x413c, 0x8197) }, 106 { USB_DEVICE(0x413c, 0x8197) },
106 107
107 { } /* Terminating entry */ 108 { } /* Terminating entry */
@@ -726,9 +727,6 @@ static int btusb_send_frame(struct sk_buff *skb)
726 usb_fill_bulk_urb(urb, data->udev, pipe, 727 usb_fill_bulk_urb(urb, data->udev, pipe,
727 skb->data, skb->len, btusb_tx_complete, skb); 728 skb->data, skb->len, btusb_tx_complete, skb);
728 729
729 if (skb->priority >= HCI_PRIO_MAX - 1)
730 urb->transfer_flags = URB_ISO_ASAP;
731
732 hdev->stat.acl_tx++; 730 hdev->stat.acl_tx++;
733 break; 731 break;
734 732
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c
index 597235a2f8f9..0d40cf66b3cc 100644
--- a/drivers/crypto/mv_cesa.c
+++ b/drivers/crypto/mv_cesa.c
@@ -714,6 +714,7 @@ static int mv_hash_final(struct ahash_request *req)
714{ 714{
715 struct mv_req_hash_ctx *ctx = ahash_request_ctx(req); 715 struct mv_req_hash_ctx *ctx = ahash_request_ctx(req);
716 716
717 ahash_request_set_crypt(req, NULL, req->result, 0);
717 mv_update_hash_req_ctx(ctx, 1, 0); 718 mv_update_hash_req_ctx(ctx, 1, 0);
718 return mv_handle_req(&req->base); 719 return mv_handle_req(&req->base);
719} 720}
diff --git a/drivers/devfreq/exynos4_bus.c b/drivers/devfreq/exynos4_bus.c
index 6460577d6701..cfaa98a00b9e 100644
--- a/drivers/devfreq/exynos4_bus.c
+++ b/drivers/devfreq/exynos4_bus.c
@@ -311,51 +311,51 @@ static int exynos4210_set_busclk(struct busfreq_data *data, struct opp *opp)
311 /* Change Divider - DMC0 */ 311 /* Change Divider - DMC0 */
312 tmp = data->dmc_divtable[index]; 312 tmp = data->dmc_divtable[index];
313 313
314 __raw_writel(tmp, S5P_CLKDIV_DMC0); 314 __raw_writel(tmp, EXYNOS4_CLKDIV_DMC0);
315 315
316 do { 316 do {
317 tmp = __raw_readl(S5P_CLKDIV_STAT_DMC0); 317 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_DMC0);
318 } while (tmp & 0x11111111); 318 } while (tmp & 0x11111111);
319 319
320 /* Change Divider - TOP */ 320 /* Change Divider - TOP */
321 tmp = data->top_divtable[index]; 321 tmp = data->top_divtable[index];
322 322
323 __raw_writel(tmp, S5P_CLKDIV_TOP); 323 __raw_writel(tmp, EXYNOS4_CLKDIV_TOP);
324 324
325 do { 325 do {
326 tmp = __raw_readl(S5P_CLKDIV_STAT_TOP); 326 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_TOP);
327 } while (tmp & 0x11111); 327 } while (tmp & 0x11111);
328 328
329 /* Change Divider - LEFTBUS */ 329 /* Change Divider - LEFTBUS */
330 tmp = __raw_readl(S5P_CLKDIV_LEFTBUS); 330 tmp = __raw_readl(EXYNOS4_CLKDIV_LEFTBUS);
331 331
332 tmp &= ~(S5P_CLKDIV_BUS_GDLR_MASK | S5P_CLKDIV_BUS_GPLR_MASK); 332 tmp &= ~(EXYNOS4_CLKDIV_BUS_GDLR_MASK | EXYNOS4_CLKDIV_BUS_GPLR_MASK);
333 333
334 tmp |= ((exynos4210_clkdiv_lr_bus[index][0] << 334 tmp |= ((exynos4210_clkdiv_lr_bus[index][0] <<
335 S5P_CLKDIV_BUS_GDLR_SHIFT) | 335 EXYNOS4_CLKDIV_BUS_GDLR_SHIFT) |
336 (exynos4210_clkdiv_lr_bus[index][1] << 336 (exynos4210_clkdiv_lr_bus[index][1] <<
337 S5P_CLKDIV_BUS_GPLR_SHIFT)); 337 EXYNOS4_CLKDIV_BUS_GPLR_SHIFT));
338 338
339 __raw_writel(tmp, S5P_CLKDIV_LEFTBUS); 339 __raw_writel(tmp, EXYNOS4_CLKDIV_LEFTBUS);
340 340
341 do { 341 do {
342 tmp = __raw_readl(S5P_CLKDIV_STAT_LEFTBUS); 342 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_LEFTBUS);
343 } while (tmp & 0x11); 343 } while (tmp & 0x11);
344 344
345 /* Change Divider - RIGHTBUS */ 345 /* Change Divider - RIGHTBUS */
346 tmp = __raw_readl(S5P_CLKDIV_RIGHTBUS); 346 tmp = __raw_readl(EXYNOS4_CLKDIV_RIGHTBUS);
347 347
348 tmp &= ~(S5P_CLKDIV_BUS_GDLR_MASK | S5P_CLKDIV_BUS_GPLR_MASK); 348 tmp &= ~(EXYNOS4_CLKDIV_BUS_GDLR_MASK | EXYNOS4_CLKDIV_BUS_GPLR_MASK);
349 349
350 tmp |= ((exynos4210_clkdiv_lr_bus[index][0] << 350 tmp |= ((exynos4210_clkdiv_lr_bus[index][0] <<
351 S5P_CLKDIV_BUS_GDLR_SHIFT) | 351 EXYNOS4_CLKDIV_BUS_GDLR_SHIFT) |
352 (exynos4210_clkdiv_lr_bus[index][1] << 352 (exynos4210_clkdiv_lr_bus[index][1] <<
353 S5P_CLKDIV_BUS_GPLR_SHIFT)); 353 EXYNOS4_CLKDIV_BUS_GPLR_SHIFT));
354 354
355 __raw_writel(tmp, S5P_CLKDIV_RIGHTBUS); 355 __raw_writel(tmp, EXYNOS4_CLKDIV_RIGHTBUS);
356 356
357 do { 357 do {
358 tmp = __raw_readl(S5P_CLKDIV_STAT_RIGHTBUS); 358 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_RIGHTBUS);
359 } while (tmp & 0x11); 359 } while (tmp & 0x11);
360 360
361 return 0; 361 return 0;
@@ -376,137 +376,137 @@ static int exynos4x12_set_busclk(struct busfreq_data *data, struct opp *opp)
376 /* Change Divider - DMC0 */ 376 /* Change Divider - DMC0 */
377 tmp = data->dmc_divtable[index]; 377 tmp = data->dmc_divtable[index];
378 378
379 __raw_writel(tmp, S5P_CLKDIV_DMC0); 379 __raw_writel(tmp, EXYNOS4_CLKDIV_DMC0);
380 380
381 do { 381 do {
382 tmp = __raw_readl(S5P_CLKDIV_STAT_DMC0); 382 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_DMC0);
383 } while (tmp & 0x11111111); 383 } while (tmp & 0x11111111);
384 384
385 /* Change Divider - DMC1 */ 385 /* Change Divider - DMC1 */
386 tmp = __raw_readl(S5P_CLKDIV_DMC1); 386 tmp = __raw_readl(EXYNOS4_CLKDIV_DMC1);
387 387
388 tmp &= ~(S5P_CLKDIV_DMC1_G2D_ACP_MASK | 388 tmp &= ~(EXYNOS4_CLKDIV_DMC1_G2D_ACP_MASK |
389 S5P_CLKDIV_DMC1_C2C_MASK | 389 EXYNOS4_CLKDIV_DMC1_C2C_MASK |
390 S5P_CLKDIV_DMC1_C2CACLK_MASK); 390 EXYNOS4_CLKDIV_DMC1_C2CACLK_MASK);
391 391
392 tmp |= ((exynos4x12_clkdiv_dmc1[index][0] << 392 tmp |= ((exynos4x12_clkdiv_dmc1[index][0] <<
393 S5P_CLKDIV_DMC1_G2D_ACP_SHIFT) | 393 EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT) |
394 (exynos4x12_clkdiv_dmc1[index][1] << 394 (exynos4x12_clkdiv_dmc1[index][1] <<
395 S5P_CLKDIV_DMC1_C2C_SHIFT) | 395 EXYNOS4_CLKDIV_DMC1_C2C_SHIFT) |
396 (exynos4x12_clkdiv_dmc1[index][2] << 396 (exynos4x12_clkdiv_dmc1[index][2] <<
397 S5P_CLKDIV_DMC1_C2CACLK_SHIFT)); 397 EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT));
398 398
399 __raw_writel(tmp, S5P_CLKDIV_DMC1); 399 __raw_writel(tmp, EXYNOS4_CLKDIV_DMC1);
400 400
401 do { 401 do {
402 tmp = __raw_readl(S5P_CLKDIV_STAT_DMC1); 402 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_DMC1);
403 } while (tmp & 0x111111); 403 } while (tmp & 0x111111);
404 404
405 /* Change Divider - TOP */ 405 /* Change Divider - TOP */
406 tmp = __raw_readl(S5P_CLKDIV_TOP); 406 tmp = __raw_readl(EXYNOS4_CLKDIV_TOP);
407 407
408 tmp &= ~(S5P_CLKDIV_TOP_ACLK266_GPS_MASK | 408 tmp &= ~(EXYNOS4_CLKDIV_TOP_ACLK266_GPS_MASK |
409 S5P_CLKDIV_TOP_ACLK100_MASK | 409 EXYNOS4_CLKDIV_TOP_ACLK100_MASK |
410 S5P_CLKDIV_TOP_ACLK160_MASK | 410 EXYNOS4_CLKDIV_TOP_ACLK160_MASK |
411 S5P_CLKDIV_TOP_ACLK133_MASK | 411 EXYNOS4_CLKDIV_TOP_ACLK133_MASK |
412 S5P_CLKDIV_TOP_ONENAND_MASK); 412 EXYNOS4_CLKDIV_TOP_ONENAND_MASK);
413 413
414 tmp |= ((exynos4x12_clkdiv_top[index][0] << 414 tmp |= ((exynos4x12_clkdiv_top[index][0] <<
415 S5P_CLKDIV_TOP_ACLK266_GPS_SHIFT) | 415 EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT) |
416 (exynos4x12_clkdiv_top[index][1] << 416 (exynos4x12_clkdiv_top[index][1] <<
417 S5P_CLKDIV_TOP_ACLK100_SHIFT) | 417 EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT) |
418 (exynos4x12_clkdiv_top[index][2] << 418 (exynos4x12_clkdiv_top[index][2] <<
419 S5P_CLKDIV_TOP_ACLK160_SHIFT) | 419 EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT) |
420 (exynos4x12_clkdiv_top[index][3] << 420 (exynos4x12_clkdiv_top[index][3] <<
421 S5P_CLKDIV_TOP_ACLK133_SHIFT) | 421 EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT) |
422 (exynos4x12_clkdiv_top[index][4] << 422 (exynos4x12_clkdiv_top[index][4] <<
423 S5P_CLKDIV_TOP_ONENAND_SHIFT)); 423 EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT));
424 424
425 __raw_writel(tmp, S5P_CLKDIV_TOP); 425 __raw_writel(tmp, EXYNOS4_CLKDIV_TOP);
426 426
427 do { 427 do {
428 tmp = __raw_readl(S5P_CLKDIV_STAT_TOP); 428 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_TOP);
429 } while (tmp & 0x11111); 429 } while (tmp & 0x11111);
430 430
431 /* Change Divider - LEFTBUS */ 431 /* Change Divider - LEFTBUS */
432 tmp = __raw_readl(S5P_CLKDIV_LEFTBUS); 432 tmp = __raw_readl(EXYNOS4_CLKDIV_LEFTBUS);
433 433
434 tmp &= ~(S5P_CLKDIV_BUS_GDLR_MASK | S5P_CLKDIV_BUS_GPLR_MASK); 434 tmp &= ~(EXYNOS4_CLKDIV_BUS_GDLR_MASK | EXYNOS4_CLKDIV_BUS_GPLR_MASK);
435 435
436 tmp |= ((exynos4x12_clkdiv_lr_bus[index][0] << 436 tmp |= ((exynos4x12_clkdiv_lr_bus[index][0] <<
437 S5P_CLKDIV_BUS_GDLR_SHIFT) | 437 EXYNOS4_CLKDIV_BUS_GDLR_SHIFT) |
438 (exynos4x12_clkdiv_lr_bus[index][1] << 438 (exynos4x12_clkdiv_lr_bus[index][1] <<
439 S5P_CLKDIV_BUS_GPLR_SHIFT)); 439 EXYNOS4_CLKDIV_BUS_GPLR_SHIFT));
440 440
441 __raw_writel(tmp, S5P_CLKDIV_LEFTBUS); 441 __raw_writel(tmp, EXYNOS4_CLKDIV_LEFTBUS);
442 442
443 do { 443 do {
444 tmp = __raw_readl(S5P_CLKDIV_STAT_LEFTBUS); 444 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_LEFTBUS);
445 } while (tmp & 0x11); 445 } while (tmp & 0x11);
446 446
447 /* Change Divider - RIGHTBUS */ 447 /* Change Divider - RIGHTBUS */
448 tmp = __raw_readl(S5P_CLKDIV_RIGHTBUS); 448 tmp = __raw_readl(EXYNOS4_CLKDIV_RIGHTBUS);
449 449
450 tmp &= ~(S5P_CLKDIV_BUS_GDLR_MASK | S5P_CLKDIV_BUS_GPLR_MASK); 450 tmp &= ~(EXYNOS4_CLKDIV_BUS_GDLR_MASK | EXYNOS4_CLKDIV_BUS_GPLR_MASK);
451 451
452 tmp |= ((exynos4x12_clkdiv_lr_bus[index][0] << 452 tmp |= ((exynos4x12_clkdiv_lr_bus[index][0] <<
453 S5P_CLKDIV_BUS_GDLR_SHIFT) | 453 EXYNOS4_CLKDIV_BUS_GDLR_SHIFT) |
454 (exynos4x12_clkdiv_lr_bus[index][1] << 454 (exynos4x12_clkdiv_lr_bus[index][1] <<
455 S5P_CLKDIV_BUS_GPLR_SHIFT)); 455 EXYNOS4_CLKDIV_BUS_GPLR_SHIFT));
456 456
457 __raw_writel(tmp, S5P_CLKDIV_RIGHTBUS); 457 __raw_writel(tmp, EXYNOS4_CLKDIV_RIGHTBUS);
458 458
459 do { 459 do {
460 tmp = __raw_readl(S5P_CLKDIV_STAT_RIGHTBUS); 460 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_RIGHTBUS);
461 } while (tmp & 0x11); 461 } while (tmp & 0x11);
462 462
463 /* Change Divider - MFC */ 463 /* Change Divider - MFC */
464 tmp = __raw_readl(S5P_CLKDIV_MFC); 464 tmp = __raw_readl(EXYNOS4_CLKDIV_MFC);
465 465
466 tmp &= ~(S5P_CLKDIV_MFC_MASK); 466 tmp &= ~(EXYNOS4_CLKDIV_MFC_MASK);
467 467
468 tmp |= ((exynos4x12_clkdiv_sclkip[index][0] << 468 tmp |= ((exynos4x12_clkdiv_sclkip[index][0] <<
469 S5P_CLKDIV_MFC_SHIFT)); 469 EXYNOS4_CLKDIV_MFC_SHIFT));
470 470
471 __raw_writel(tmp, S5P_CLKDIV_MFC); 471 __raw_writel(tmp, EXYNOS4_CLKDIV_MFC);
472 472
473 do { 473 do {
474 tmp = __raw_readl(S5P_CLKDIV_STAT_MFC); 474 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_MFC);
475 } while (tmp & 0x1); 475 } while (tmp & 0x1);
476 476
477 /* Change Divider - JPEG */ 477 /* Change Divider - JPEG */
478 tmp = __raw_readl(S5P_CLKDIV_CAM1); 478 tmp = __raw_readl(EXYNOS4_CLKDIV_CAM1);
479 479
480 tmp &= ~(S5P_CLKDIV_CAM1_JPEG_MASK); 480 tmp &= ~(EXYNOS4_CLKDIV_CAM1_JPEG_MASK);
481 481
482 tmp |= ((exynos4x12_clkdiv_sclkip[index][1] << 482 tmp |= ((exynos4x12_clkdiv_sclkip[index][1] <<
483 S5P_CLKDIV_CAM1_JPEG_SHIFT)); 483 EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT));
484 484
485 __raw_writel(tmp, S5P_CLKDIV_CAM1); 485 __raw_writel(tmp, EXYNOS4_CLKDIV_CAM1);
486 486
487 do { 487 do {
488 tmp = __raw_readl(S5P_CLKDIV_STAT_CAM1); 488 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_CAM1);
489 } while (tmp & 0x1); 489 } while (tmp & 0x1);
490 490
491 /* Change Divider - FIMC0~3 */ 491 /* Change Divider - FIMC0~3 */
492 tmp = __raw_readl(S5P_CLKDIV_CAM); 492 tmp = __raw_readl(EXYNOS4_CLKDIV_CAM);
493 493
494 tmp &= ~(S5P_CLKDIV_CAM_FIMC0_MASK | S5P_CLKDIV_CAM_FIMC1_MASK | 494 tmp &= ~(EXYNOS4_CLKDIV_CAM_FIMC0_MASK | EXYNOS4_CLKDIV_CAM_FIMC1_MASK |
495 S5P_CLKDIV_CAM_FIMC2_MASK | S5P_CLKDIV_CAM_FIMC3_MASK); 495 EXYNOS4_CLKDIV_CAM_FIMC2_MASK | EXYNOS4_CLKDIV_CAM_FIMC3_MASK);
496 496
497 tmp |= ((exynos4x12_clkdiv_sclkip[index][2] << 497 tmp |= ((exynos4x12_clkdiv_sclkip[index][2] <<
498 S5P_CLKDIV_CAM_FIMC0_SHIFT) | 498 EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT) |
499 (exynos4x12_clkdiv_sclkip[index][2] << 499 (exynos4x12_clkdiv_sclkip[index][2] <<
500 S5P_CLKDIV_CAM_FIMC1_SHIFT) | 500 EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT) |
501 (exynos4x12_clkdiv_sclkip[index][2] << 501 (exynos4x12_clkdiv_sclkip[index][2] <<
502 S5P_CLKDIV_CAM_FIMC2_SHIFT) | 502 EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT) |
503 (exynos4x12_clkdiv_sclkip[index][2] << 503 (exynos4x12_clkdiv_sclkip[index][2] <<
504 S5P_CLKDIV_CAM_FIMC3_SHIFT)); 504 EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT));
505 505
506 __raw_writel(tmp, S5P_CLKDIV_CAM); 506 __raw_writel(tmp, EXYNOS4_CLKDIV_CAM);
507 507
508 do { 508 do {
509 tmp = __raw_readl(S5P_CLKDIV_STAT_CAM1); 509 tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_CAM1);
510 } while (tmp & 0x1111); 510 } while (tmp & 0x1111);
511 511
512 return 0; 512 return 0;
@@ -760,55 +760,55 @@ static int exynos4210_init_tables(struct busfreq_data *data)
760 int mgrp; 760 int mgrp;
761 int i, err = 0; 761 int i, err = 0;
762 762
763 tmp = __raw_readl(S5P_CLKDIV_DMC0); 763 tmp = __raw_readl(EXYNOS4_CLKDIV_DMC0);
764 for (i = LV_0; i < EX4210_LV_NUM; i++) { 764 for (i = LV_0; i < EX4210_LV_NUM; i++) {
765 tmp &= ~(S5P_CLKDIV_DMC0_ACP_MASK | 765 tmp &= ~(EXYNOS4_CLKDIV_DMC0_ACP_MASK |
766 S5P_CLKDIV_DMC0_ACPPCLK_MASK | 766 EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK |
767 S5P_CLKDIV_DMC0_DPHY_MASK | 767 EXYNOS4_CLKDIV_DMC0_DPHY_MASK |
768 S5P_CLKDIV_DMC0_DMC_MASK | 768 EXYNOS4_CLKDIV_DMC0_DMC_MASK |
769 S5P_CLKDIV_DMC0_DMCD_MASK | 769 EXYNOS4_CLKDIV_DMC0_DMCD_MASK |
770 S5P_CLKDIV_DMC0_DMCP_MASK | 770 EXYNOS4_CLKDIV_DMC0_DMCP_MASK |
771 S5P_CLKDIV_DMC0_COPY2_MASK | 771 EXYNOS4_CLKDIV_DMC0_COPY2_MASK |
772 S5P_CLKDIV_DMC0_CORETI_MASK); 772 EXYNOS4_CLKDIV_DMC0_CORETI_MASK);
773 773
774 tmp |= ((exynos4210_clkdiv_dmc0[i][0] << 774 tmp |= ((exynos4210_clkdiv_dmc0[i][0] <<
775 S5P_CLKDIV_DMC0_ACP_SHIFT) | 775 EXYNOS4_CLKDIV_DMC0_ACP_SHIFT) |
776 (exynos4210_clkdiv_dmc0[i][1] << 776 (exynos4210_clkdiv_dmc0[i][1] <<
777 S5P_CLKDIV_DMC0_ACPPCLK_SHIFT) | 777 EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT) |
778 (exynos4210_clkdiv_dmc0[i][2] << 778 (exynos4210_clkdiv_dmc0[i][2] <<
779 S5P_CLKDIV_DMC0_DPHY_SHIFT) | 779 EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT) |
780 (exynos4210_clkdiv_dmc0[i][3] << 780 (exynos4210_clkdiv_dmc0[i][3] <<
781 S5P_CLKDIV_DMC0_DMC_SHIFT) | 781 EXYNOS4_CLKDIV_DMC0_DMC_SHIFT) |
782 (exynos4210_clkdiv_dmc0[i][4] << 782 (exynos4210_clkdiv_dmc0[i][4] <<
783 S5P_CLKDIV_DMC0_DMCD_SHIFT) | 783 EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT) |
784 (exynos4210_clkdiv_dmc0[i][5] << 784 (exynos4210_clkdiv_dmc0[i][5] <<
785 S5P_CLKDIV_DMC0_DMCP_SHIFT) | 785 EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT) |
786 (exynos4210_clkdiv_dmc0[i][6] << 786 (exynos4210_clkdiv_dmc0[i][6] <<
787 S5P_CLKDIV_DMC0_COPY2_SHIFT) | 787 EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT) |
788 (exynos4210_clkdiv_dmc0[i][7] << 788 (exynos4210_clkdiv_dmc0[i][7] <<
789 S5P_CLKDIV_DMC0_CORETI_SHIFT)); 789 EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT));
790 790
791 data->dmc_divtable[i] = tmp; 791 data->dmc_divtable[i] = tmp;
792 } 792 }
793 793
794 tmp = __raw_readl(S5P_CLKDIV_TOP); 794 tmp = __raw_readl(EXYNOS4_CLKDIV_TOP);
795 for (i = LV_0; i < EX4210_LV_NUM; i++) { 795 for (i = LV_0; i < EX4210_LV_NUM; i++) {
796 tmp &= ~(S5P_CLKDIV_TOP_ACLK200_MASK | 796 tmp &= ~(EXYNOS4_CLKDIV_TOP_ACLK200_MASK |
797 S5P_CLKDIV_TOP_ACLK100_MASK | 797 EXYNOS4_CLKDIV_TOP_ACLK100_MASK |
798 S5P_CLKDIV_TOP_ACLK160_MASK | 798 EXYNOS4_CLKDIV_TOP_ACLK160_MASK |
799 S5P_CLKDIV_TOP_ACLK133_MASK | 799 EXYNOS4_CLKDIV_TOP_ACLK133_MASK |
800 S5P_CLKDIV_TOP_ONENAND_MASK); 800 EXYNOS4_CLKDIV_TOP_ONENAND_MASK);
801 801
802 tmp |= ((exynos4210_clkdiv_top[i][0] << 802 tmp |= ((exynos4210_clkdiv_top[i][0] <<
803 S5P_CLKDIV_TOP_ACLK200_SHIFT) | 803 EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT) |
804 (exynos4210_clkdiv_top[i][1] << 804 (exynos4210_clkdiv_top[i][1] <<
805 S5P_CLKDIV_TOP_ACLK100_SHIFT) | 805 EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT) |
806 (exynos4210_clkdiv_top[i][2] << 806 (exynos4210_clkdiv_top[i][2] <<
807 S5P_CLKDIV_TOP_ACLK160_SHIFT) | 807 EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT) |
808 (exynos4210_clkdiv_top[i][3] << 808 (exynos4210_clkdiv_top[i][3] <<
809 S5P_CLKDIV_TOP_ACLK133_SHIFT) | 809 EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT) |
810 (exynos4210_clkdiv_top[i][4] << 810 (exynos4210_clkdiv_top[i][4] <<
811 S5P_CLKDIV_TOP_ONENAND_SHIFT)); 811 EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT));
812 812
813 data->top_divtable[i] = tmp; 813 data->top_divtable[i] = tmp;
814 } 814 }
@@ -868,32 +868,32 @@ static int exynos4x12_init_tables(struct busfreq_data *data)
868 int ret; 868 int ret;
869 869
870 /* Enable pause function for DREX2 DVFS */ 870 /* Enable pause function for DREX2 DVFS */
871 tmp = __raw_readl(S5P_DMC_PAUSE_CTRL); 871 tmp = __raw_readl(EXYNOS4_DMC_PAUSE_CTRL);
872 tmp |= DMC_PAUSE_ENABLE; 872 tmp |= EXYNOS4_DMC_PAUSE_ENABLE;
873 __raw_writel(tmp, S5P_DMC_PAUSE_CTRL); 873 __raw_writel(tmp, EXYNOS4_DMC_PAUSE_CTRL);
874 874
875 tmp = __raw_readl(S5P_CLKDIV_DMC0); 875 tmp = __raw_readl(EXYNOS4_CLKDIV_DMC0);
876 876
877 for (i = 0; i < EX4x12_LV_NUM; i++) { 877 for (i = 0; i < EX4x12_LV_NUM; i++) {
878 tmp &= ~(S5P_CLKDIV_DMC0_ACP_MASK | 878 tmp &= ~(EXYNOS4_CLKDIV_DMC0_ACP_MASK |
879 S5P_CLKDIV_DMC0_ACPPCLK_MASK | 879 EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK |
880 S5P_CLKDIV_DMC0_DPHY_MASK | 880 EXYNOS4_CLKDIV_DMC0_DPHY_MASK |
881 S5P_CLKDIV_DMC0_DMC_MASK | 881 EXYNOS4_CLKDIV_DMC0_DMC_MASK |
882 S5P_CLKDIV_DMC0_DMCD_MASK | 882 EXYNOS4_CLKDIV_DMC0_DMCD_MASK |
883 S5P_CLKDIV_DMC0_DMCP_MASK); 883 EXYNOS4_CLKDIV_DMC0_DMCP_MASK);
884 884
885 tmp |= ((exynos4x12_clkdiv_dmc0[i][0] << 885 tmp |= ((exynos4x12_clkdiv_dmc0[i][0] <<
886 S5P_CLKDIV_DMC0_ACP_SHIFT) | 886 EXYNOS4_CLKDIV_DMC0_ACP_SHIFT) |
887 (exynos4x12_clkdiv_dmc0[i][1] << 887 (exynos4x12_clkdiv_dmc0[i][1] <<
888 S5P_CLKDIV_DMC0_ACPPCLK_SHIFT) | 888 EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT) |
889 (exynos4x12_clkdiv_dmc0[i][2] << 889 (exynos4x12_clkdiv_dmc0[i][2] <<
890 S5P_CLKDIV_DMC0_DPHY_SHIFT) | 890 EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT) |
891 (exynos4x12_clkdiv_dmc0[i][3] << 891 (exynos4x12_clkdiv_dmc0[i][3] <<
892 S5P_CLKDIV_DMC0_DMC_SHIFT) | 892 EXYNOS4_CLKDIV_DMC0_DMC_SHIFT) |
893 (exynos4x12_clkdiv_dmc0[i][4] << 893 (exynos4x12_clkdiv_dmc0[i][4] <<
894 S5P_CLKDIV_DMC0_DMCD_SHIFT) | 894 EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT) |
895 (exynos4x12_clkdiv_dmc0[i][5] << 895 (exynos4x12_clkdiv_dmc0[i][5] <<
896 S5P_CLKDIV_DMC0_DMCP_SHIFT)); 896 EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT));
897 897
898 data->dmc_divtable[i] = tmp; 898 data->dmc_divtable[i] = tmp;
899 } 899 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index d620b0784257..618bd4d87d28 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -28,6 +28,7 @@
28#include "drmP.h" 28#include "drmP.h"
29#include "drm_crtc_helper.h" 29#include "drm_crtc_helper.h"
30 30
31#include <drm/exynos_drm.h>
31#include "exynos_drm_drv.h" 32#include "exynos_drm_drv.h"
32#include "exynos_drm_encoder.h" 33#include "exynos_drm_encoder.h"
33 34
@@ -44,8 +45,9 @@ struct exynos_drm_connector {
44/* convert exynos_video_timings to drm_display_mode */ 45/* convert exynos_video_timings to drm_display_mode */
45static inline void 46static inline void
46convert_to_display_mode(struct drm_display_mode *mode, 47convert_to_display_mode(struct drm_display_mode *mode,
47 struct fb_videomode *timing) 48 struct exynos_drm_panel_info *panel)
48{ 49{
50 struct fb_videomode *timing = &panel->timing;
49 DRM_DEBUG_KMS("%s\n", __FILE__); 51 DRM_DEBUG_KMS("%s\n", __FILE__);
50 52
51 mode->clock = timing->pixclock / 1000; 53 mode->clock = timing->pixclock / 1000;
@@ -60,6 +62,8 @@ convert_to_display_mode(struct drm_display_mode *mode,
60 mode->vsync_start = mode->vdisplay + timing->upper_margin; 62 mode->vsync_start = mode->vdisplay + timing->upper_margin;
61 mode->vsync_end = mode->vsync_start + timing->vsync_len; 63 mode->vsync_end = mode->vsync_start + timing->vsync_len;
62 mode->vtotal = mode->vsync_end + timing->lower_margin; 64 mode->vtotal = mode->vsync_end + timing->lower_margin;
65 mode->width_mm = panel->width_mm;
66 mode->height_mm = panel->height_mm;
63 67
64 if (timing->vmode & FB_VMODE_INTERLACED) 68 if (timing->vmode & FB_VMODE_INTERLACED)
65 mode->flags |= DRM_MODE_FLAG_INTERLACE; 69 mode->flags |= DRM_MODE_FLAG_INTERLACE;
@@ -148,16 +152,18 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)
148 connector->display_info.raw_edid = edid; 152 connector->display_info.raw_edid = edid;
149 } else { 153 } else {
150 struct drm_display_mode *mode = drm_mode_create(connector->dev); 154 struct drm_display_mode *mode = drm_mode_create(connector->dev);
151 struct fb_videomode *timing; 155 struct exynos_drm_panel_info *panel;
152 156
153 if (display_ops->get_timing) 157 if (display_ops->get_panel)
154 timing = display_ops->get_timing(manager->dev); 158 panel = display_ops->get_panel(manager->dev);
155 else { 159 else {
156 drm_mode_destroy(connector->dev, mode); 160 drm_mode_destroy(connector->dev, mode);
157 return 0; 161 return 0;
158 } 162 }
159 163
160 convert_to_display_mode(mode, timing); 164 convert_to_display_mode(mode, panel);
165 connector->display_info.width_mm = mode->width_mm;
166 connector->display_info.height_mm = mode->height_mm;
161 167
162 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; 168 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
163 drm_mode_set_name(mode); 169 drm_mode_set_name(mode);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index e685e1e33055..13540de90bfc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -136,7 +136,7 @@ struct exynos_drm_overlay {
136 * @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI. 136 * @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI.
137 * @is_connected: check for that display is connected or not. 137 * @is_connected: check for that display is connected or not.
138 * @get_edid: get edid modes from display driver. 138 * @get_edid: get edid modes from display driver.
139 * @get_timing: get timing object from display driver. 139 * @get_panel: get panel object from display driver.
140 * @check_timing: check if timing is valid or not. 140 * @check_timing: check if timing is valid or not.
141 * @power_on: display device on or off. 141 * @power_on: display device on or off.
142 */ 142 */
@@ -145,7 +145,7 @@ struct exynos_drm_display_ops {
145 bool (*is_connected)(struct device *dev); 145 bool (*is_connected)(struct device *dev);
146 int (*get_edid)(struct device *dev, struct drm_connector *connector, 146 int (*get_edid)(struct device *dev, struct drm_connector *connector,
147 u8 *edid, int len); 147 u8 *edid, int len);
148 void *(*get_timing)(struct device *dev); 148 void *(*get_panel)(struct device *dev);
149 int (*check_timing)(struct device *dev, void *timing); 149 int (*check_timing)(struct device *dev, void *timing);
150 int (*power_on)(struct device *dev, int mode); 150 int (*power_on)(struct device *dev, int mode);
151}; 151};
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 0dbb32bb18a3..360adf2bba04 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -89,7 +89,7 @@ struct fimd_context {
89 bool suspended; 89 bool suspended;
90 struct mutex lock; 90 struct mutex lock;
91 91
92 struct fb_videomode *timing; 92 struct exynos_drm_panel_info *panel;
93}; 93};
94 94
95static bool fimd_display_is_connected(struct device *dev) 95static bool fimd_display_is_connected(struct device *dev)
@@ -101,13 +101,13 @@ static bool fimd_display_is_connected(struct device *dev)
101 return true; 101 return true;
102} 102}
103 103
104static void *fimd_get_timing(struct device *dev) 104static void *fimd_get_panel(struct device *dev)
105{ 105{
106 struct fimd_context *ctx = get_fimd_context(dev); 106 struct fimd_context *ctx = get_fimd_context(dev);
107 107
108 DRM_DEBUG_KMS("%s\n", __FILE__); 108 DRM_DEBUG_KMS("%s\n", __FILE__);
109 109
110 return ctx->timing; 110 return ctx->panel;
111} 111}
112 112
113static int fimd_check_timing(struct device *dev, void *timing) 113static int fimd_check_timing(struct device *dev, void *timing)
@@ -131,7 +131,7 @@ static int fimd_display_power_on(struct device *dev, int mode)
131static struct exynos_drm_display_ops fimd_display_ops = { 131static struct exynos_drm_display_ops fimd_display_ops = {
132 .type = EXYNOS_DISPLAY_TYPE_LCD, 132 .type = EXYNOS_DISPLAY_TYPE_LCD,
133 .is_connected = fimd_display_is_connected, 133 .is_connected = fimd_display_is_connected,
134 .get_timing = fimd_get_timing, 134 .get_panel = fimd_get_panel,
135 .check_timing = fimd_check_timing, 135 .check_timing = fimd_check_timing,
136 .power_on = fimd_display_power_on, 136 .power_on = fimd_display_power_on,
137}; 137};
@@ -193,7 +193,8 @@ static void fimd_apply(struct device *subdrv_dev)
193static void fimd_commit(struct device *dev) 193static void fimd_commit(struct device *dev)
194{ 194{
195 struct fimd_context *ctx = get_fimd_context(dev); 195 struct fimd_context *ctx = get_fimd_context(dev);
196 struct fb_videomode *timing = ctx->timing; 196 struct exynos_drm_panel_info *panel = ctx->panel;
197 struct fb_videomode *timing = &panel->timing;
197 u32 val; 198 u32 val;
198 199
199 if (ctx->suspended) 200 if (ctx->suspended)
@@ -786,7 +787,7 @@ static int __devinit fimd_probe(struct platform_device *pdev)
786 struct fimd_context *ctx; 787 struct fimd_context *ctx;
787 struct exynos_drm_subdrv *subdrv; 788 struct exynos_drm_subdrv *subdrv;
788 struct exynos_drm_fimd_pdata *pdata; 789 struct exynos_drm_fimd_pdata *pdata;
789 struct fb_videomode *timing; 790 struct exynos_drm_panel_info *panel;
790 struct resource *res; 791 struct resource *res;
791 int win; 792 int win;
792 int ret = -EINVAL; 793 int ret = -EINVAL;
@@ -799,9 +800,9 @@ static int __devinit fimd_probe(struct platform_device *pdev)
799 return -EINVAL; 800 return -EINVAL;
800 } 801 }
801 802
802 timing = &pdata->timing; 803 panel = &pdata->panel;
803 if (!timing) { 804 if (!panel) {
804 dev_err(dev, "timing is null.\n"); 805 dev_err(dev, "panel is null.\n");
805 return -EINVAL; 806 return -EINVAL;
806 } 807 }
807 808
@@ -863,16 +864,16 @@ static int __devinit fimd_probe(struct platform_device *pdev)
863 goto err_req_irq; 864 goto err_req_irq;
864 } 865 }
865 866
866 ctx->clkdiv = fimd_calc_clkdiv(ctx, timing); 867 ctx->clkdiv = fimd_calc_clkdiv(ctx, &panel->timing);
867 ctx->vidcon0 = pdata->vidcon0; 868 ctx->vidcon0 = pdata->vidcon0;
868 ctx->vidcon1 = pdata->vidcon1; 869 ctx->vidcon1 = pdata->vidcon1;
869 ctx->default_win = pdata->default_win; 870 ctx->default_win = pdata->default_win;
870 ctx->timing = timing; 871 ctx->panel = panel;
871 872
872 timing->pixclock = clk_get_rate(ctx->lcd_clk) / ctx->clkdiv; 873 panel->timing.pixclock = clk_get_rate(ctx->lcd_clk) / ctx->clkdiv;
873 874
874 DRM_DEBUG_KMS("pixel clock = %d, clkdiv = %d\n", 875 DRM_DEBUG_KMS("pixel clock = %d, clkdiv = %d\n",
875 timing->pixclock, ctx->clkdiv); 876 panel->timing.pixclock, ctx->clkdiv);
876 877
877 subdrv = &ctx->subdrv; 878 subdrv = &ctx->subdrv;
878 879
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f425b23e3803..f851db7be2cc 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4680,8 +4680,17 @@ sandybridge_compute_sprite_srwm(struct drm_device *dev, int plane,
4680 4680
4681 crtc = intel_get_crtc_for_plane(dev, plane); 4681 crtc = intel_get_crtc_for_plane(dev, plane);
4682 clock = crtc->mode.clock; 4682 clock = crtc->mode.clock;
4683 if (!clock) {
4684 *sprite_wm = 0;
4685 return false;
4686 }
4683 4687
4684 line_time_us = (sprite_width * 1000) / clock; 4688 line_time_us = (sprite_width * 1000) / clock;
4689 if (!line_time_us) {
4690 *sprite_wm = 0;
4691 return false;
4692 }
4693
4685 line_count = (latency_ns / line_time_us + 1000) / 1000; 4694 line_count = (latency_ns / line_time_us + 1000) / 1000;
4686 line_size = sprite_width * pixel_size; 4695 line_size = sprite_width * pixel_size;
4687 4696
@@ -6175,7 +6184,7 @@ void intel_crtc_load_lut(struct drm_crtc *crtc)
6175 int i; 6184 int i;
6176 6185
6177 /* The clocks have to be on to load the palette. */ 6186 /* The clocks have to be on to load the palette. */
6178 if (!crtc->enabled) 6187 if (!crtc->enabled || !intel_crtc->active)
6179 return; 6188 return;
6180 6189
6181 /* use legacy palette for Ironlake */ 6190 /* use legacy palette for Ironlake */
@@ -6561,7 +6570,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev,
6561 mode_cmd.height = mode->vdisplay; 6570 mode_cmd.height = mode->vdisplay;
6562 mode_cmd.pitches[0] = intel_framebuffer_pitch_for_width(mode_cmd.width, 6571 mode_cmd.pitches[0] = intel_framebuffer_pitch_for_width(mode_cmd.width,
6563 bpp); 6572 bpp);
6564 mode_cmd.pixel_format = 0; 6573 mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth);
6565 6574
6566 return intel_framebuffer_create(dev, &mode_cmd, obj); 6575 return intel_framebuffer_create(dev, &mode_cmd, obj);
6567} 6576}
@@ -8185,7 +8194,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)
8185 8194
8186 if (intel_enable_rc6(dev_priv->dev)) 8195 if (intel_enable_rc6(dev_priv->dev))
8187 rc6_mask = GEN6_RC_CTL_RC6_ENABLE | 8196 rc6_mask = GEN6_RC_CTL_RC6_ENABLE |
8188 (IS_GEN7(dev_priv->dev)) ? GEN6_RC_CTL_RC6p_ENABLE : 0; 8197 ((IS_GEN7(dev_priv->dev)) ? GEN6_RC_CTL_RC6p_ENABLE : 0);
8189 8198
8190 I915_WRITE(GEN6_RC_CONTROL, 8199 I915_WRITE(GEN6_RC_CONTROL,
8191 rc6_mask | 8200 rc6_mask |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 1ab842c6032e..536191540b03 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -301,7 +301,7 @@ static int init_ring_common(struct intel_ring_buffer *ring)
301 301
302 I915_WRITE_CTL(ring, 302 I915_WRITE_CTL(ring,
303 ((ring->size - PAGE_SIZE) & RING_NR_PAGES) 303 ((ring->size - PAGE_SIZE) & RING_NR_PAGES)
304 | RING_REPORT_64K | RING_VALID); 304 | RING_VALID);
305 305
306 /* If the head is still not zero, the ring is dead */ 306 /* If the head is still not zero, the ring is dead */
307 if ((I915_READ_CTL(ring) & RING_VALID) == 0 || 307 if ((I915_READ_CTL(ring) & RING_VALID) == 0 ||
@@ -1132,18 +1132,6 @@ int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n)
1132 struct drm_device *dev = ring->dev; 1132 struct drm_device *dev = ring->dev;
1133 struct drm_i915_private *dev_priv = dev->dev_private; 1133 struct drm_i915_private *dev_priv = dev->dev_private;
1134 unsigned long end; 1134 unsigned long end;
1135 u32 head;
1136
1137 /* If the reported head position has wrapped or hasn't advanced,
1138 * fallback to the slow and accurate path.
1139 */
1140 head = intel_read_status_page(ring, 4);
1141 if (head > ring->head) {
1142 ring->head = head;
1143 ring->space = ring_space(ring);
1144 if (ring->space >= n)
1145 return 0;
1146 }
1147 1135
1148 trace_i915_ring_wait_begin(ring); 1136 trace_i915_ring_wait_begin(ring);
1149 if (drm_core_check_feature(dev, DRIVER_GEM)) 1137 if (drm_core_check_feature(dev, DRIVER_GEM))
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 38ce5d0427e3..387fcc9f03ef 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -1304,6 +1304,7 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx,
1304 h0 = G_038004_TEX_HEIGHT(word1) + 1; 1304 h0 = G_038004_TEX_HEIGHT(word1) + 1;
1305 d0 = G_038004_TEX_DEPTH(word1); 1305 d0 = G_038004_TEX_DEPTH(word1);
1306 nfaces = 1; 1306 nfaces = 1;
1307 array = 0;
1307 switch (G_038000_DIM(word0)) { 1308 switch (G_038000_DIM(word0)) {
1308 case V_038000_SQ_TEX_DIM_1D: 1309 case V_038000_SQ_TEX_DIM_1D:
1309 case V_038000_SQ_TEX_DIM_2D: 1310 case V_038000_SQ_TEX_DIM_2D:
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index e7cb3ab09243..8b3d8ed52ff6 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1117,13 +1117,23 @@ static int radeon_dp_get_modes(struct drm_connector *connector)
1117 (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { 1117 (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) {
1118 struct drm_display_mode *mode; 1118 struct drm_display_mode *mode;
1119 1119
1120 if (!radeon_dig_connector->edp_on) 1120 if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
1121 atombios_set_edp_panel_power(connector, 1121 if (!radeon_dig_connector->edp_on)
1122 ATOM_TRANSMITTER_ACTION_POWER_ON); 1122 atombios_set_edp_panel_power(connector,
1123 ret = radeon_ddc_get_modes(radeon_connector); 1123 ATOM_TRANSMITTER_ACTION_POWER_ON);
1124 if (!radeon_dig_connector->edp_on) 1124 ret = radeon_ddc_get_modes(radeon_connector);
1125 atombios_set_edp_panel_power(connector, 1125 if (!radeon_dig_connector->edp_on)
1126 ATOM_TRANSMITTER_ACTION_POWER_OFF); 1126 atombios_set_edp_panel_power(connector,
1127 ATOM_TRANSMITTER_ACTION_POWER_OFF);
1128 } else {
1129 /* need to setup ddc on the bridge */
1130 if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) !=
1131 ENCODER_OBJECT_ID_NONE) {
1132 if (encoder)
1133 radeon_atom_ext_encoder_setup_ddc(encoder);
1134 }
1135 ret = radeon_ddc_get_modes(radeon_connector);
1136 }
1127 1137
1128 if (ret > 0) { 1138 if (ret > 0) {
1129 if (encoder) { 1139 if (encoder) {
@@ -1134,7 +1144,6 @@ static int radeon_dp_get_modes(struct drm_connector *connector)
1134 return ret; 1144 return ret;
1135 } 1145 }
1136 1146
1137 encoder = radeon_best_single_encoder(connector);
1138 if (!encoder) 1147 if (!encoder)
1139 return 0; 1148 return 0;
1140 1149
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index 010dad8b66ae..c58a036233fb 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -597,13 +597,13 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev,
597 if (bo_va == NULL) 597 if (bo_va == NULL)
598 return 0; 598 return 0;
599 599
600 list_del(&bo_va->bo_list);
601 mutex_lock(&vm->mutex); 600 mutex_lock(&vm->mutex);
602 radeon_mutex_lock(&rdev->cs_mutex); 601 radeon_mutex_lock(&rdev->cs_mutex);
603 radeon_vm_bo_update_pte(rdev, vm, bo, NULL); 602 radeon_vm_bo_update_pte(rdev, vm, bo, NULL);
604 radeon_mutex_unlock(&rdev->cs_mutex); 603 radeon_mutex_unlock(&rdev->cs_mutex);
605 list_del(&bo_va->vm_list); 604 list_del(&bo_va->vm_list);
606 mutex_unlock(&vm->mutex); 605 mutex_unlock(&vm->mutex);
606 list_del(&bo_va->bo_list);
607 607
608 kfree(bo_va); 608 kfree(bo_va);
609 return 0; 609 return 0;
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 6bab2001ef3b..6aa5a9fad879 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -178,6 +178,16 @@ static inline void f75375_write16(struct i2c_client *client, u8 reg,
178 i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF)); 178 i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF));
179} 179}
180 180
181static void f75375_write_pwm(struct i2c_client *client, int nr)
182{
183 struct f75375_data *data = i2c_get_clientdata(client);
184 if (data->kind == f75387)
185 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->pwm[nr]);
186 else
187 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
188 data->pwm[nr]);
189}
190
181static struct f75375_data *f75375_update_device(struct device *dev) 191static struct f75375_data *f75375_update_device(struct device *dev)
182{ 192{
183 struct i2c_client *client = to_i2c_client(dev); 193 struct i2c_client *client = to_i2c_client(dev);
@@ -254,6 +264,36 @@ static inline u16 rpm_to_reg(int rpm)
254 return 1500000 / rpm; 264 return 1500000 / rpm;
255} 265}
256 266
267static bool duty_mode_enabled(u8 pwm_enable)
268{
269 switch (pwm_enable) {
270 case 0: /* Manual, duty mode (full speed) */
271 case 1: /* Manual, duty mode */
272 case 4: /* Auto, duty mode */
273 return true;
274 case 2: /* Auto, speed mode */
275 case 3: /* Manual, speed mode */
276 return false;
277 default:
278 BUG();
279 }
280}
281
282static bool auto_mode_enabled(u8 pwm_enable)
283{
284 switch (pwm_enable) {
285 case 0: /* Manual, duty mode (full speed) */
286 case 1: /* Manual, duty mode */
287 case 3: /* Manual, speed mode */
288 return false;
289 case 2: /* Auto, speed mode */
290 case 4: /* Auto, duty mode */
291 return true;
292 default:
293 BUG();
294 }
295}
296
257static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, 297static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
258 const char *buf, size_t count) 298 const char *buf, size_t count)
259{ 299{
@@ -287,6 +327,11 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *attr,
287 if (err < 0) 327 if (err < 0)
288 return err; 328 return err;
289 329
330 if (auto_mode_enabled(data->pwm_enable[nr]))
331 return -EINVAL;
332 if (data->kind == f75387 && duty_mode_enabled(data->pwm_enable[nr]))
333 return -EINVAL;
334
290 mutex_lock(&data->update_lock); 335 mutex_lock(&data->update_lock);
291 data->fan_target[nr] = rpm_to_reg(val); 336 data->fan_target[nr] = rpm_to_reg(val);
292 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->fan_target[nr]); 337 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->fan_target[nr]);
@@ -307,9 +352,13 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
307 if (err < 0) 352 if (err < 0)
308 return err; 353 return err;
309 354
355 if (auto_mode_enabled(data->pwm_enable[nr]) ||
356 !duty_mode_enabled(data->pwm_enable[nr]))
357 return -EINVAL;
358
310 mutex_lock(&data->update_lock); 359 mutex_lock(&data->update_lock);
311 data->pwm[nr] = SENSORS_LIMIT(val, 0, 255); 360 data->pwm[nr] = SENSORS_LIMIT(val, 0, 255);
312 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), data->pwm[nr]); 361 f75375_write_pwm(client, nr);
313 mutex_unlock(&data->update_lock); 362 mutex_unlock(&data->update_lock);
314 return count; 363 return count;
315} 364}
@@ -327,11 +376,15 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
327 struct f75375_data *data = i2c_get_clientdata(client); 376 struct f75375_data *data = i2c_get_clientdata(client);
328 u8 fanmode; 377 u8 fanmode;
329 378
330 if (val < 0 || val > 3) 379 if (val < 0 || val > 4)
331 return -EINVAL; 380 return -EINVAL;
332 381
333 fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); 382 fanmode = f75375_read8(client, F75375_REG_FAN_TIMER);
334 if (data->kind == f75387) { 383 if (data->kind == f75387) {
384 /* For now, deny dangerous toggling of duty mode */
385 if (duty_mode_enabled(data->pwm_enable[nr]) !=
386 duty_mode_enabled(val))
387 return -EOPNOTSUPP;
335 /* clear each fanX_mode bit before setting them properly */ 388 /* clear each fanX_mode bit before setting them properly */
336 fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr)); 389 fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr));
337 fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr)); 390 fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr));
@@ -345,12 +398,14 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
345 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 398 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
346 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); 399 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
347 break; 400 break;
348 case 2: /* AUTOMATIC*/ 401 case 2: /* Automatic, speed mode */
349 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
350 break; 402 break;
351 case 3: /* fan speed */ 403 case 3: /* fan speed */
352 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 404 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
353 break; 405 break;
406 case 4: /* Automatic, pwm */
407 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
408 break;
354 } 409 }
355 } else { 410 } else {
356 /* clear each fanX_mode bit before setting them properly */ 411 /* clear each fanX_mode bit before setting them properly */
@@ -368,14 +423,15 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
368 break; 423 break;
369 case 3: /* fan speed */ 424 case 3: /* fan speed */
370 break; 425 break;
426 case 4: /* Automatic pwm */
427 return -EINVAL;
371 } 428 }
372 } 429 }
373 430
374 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); 431 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode);
375 data->pwm_enable[nr] = val; 432 data->pwm_enable[nr] = val;
376 if (val == 0) 433 if (val == 0)
377 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), 434 f75375_write_pwm(client, nr);
378 data->pwm[nr]);
379 return 0; 435 return 0;
380} 436}
381 437
@@ -726,14 +782,17 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,
726 782
727 manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1); 783 manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1);
728 duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1); 784 duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1);
729 if (manu && duty) 785 if (!manu && duty)
730 /* speed */ 786 /* auto, pwm */
787 data->pwm_enable[nr] = 4;
788 else if (manu && !duty)
789 /* manual, speed */
731 data->pwm_enable[nr] = 3; 790 data->pwm_enable[nr] = 3;
732 else if (!manu && duty) 791 else if (!manu && !duty)
733 /* automatic */ 792 /* automatic, speed */
734 data->pwm_enable[nr] = 2; 793 data->pwm_enable[nr] = 2;
735 else 794 else
736 /* manual */ 795 /* manual, pwm */
737 data->pwm_enable[nr] = 1; 796 data->pwm_enable[nr] = 1;
738 } else { 797 } else {
739 if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr)))) 798 if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr))))
@@ -758,9 +817,11 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,
758 set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]); 817 set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]);
759 set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]); 818 set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]);
760 for (nr = 0; nr < 2; nr++) { 819 for (nr = 0; nr < 2; nr++) {
820 if (auto_mode_enabled(f75375s_pdata->pwm_enable[nr]) ||
821 !duty_mode_enabled(f75375s_pdata->pwm_enable[nr]))
822 continue;
761 data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255); 823 data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255);
762 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), 824 f75375_write_pwm(client, nr);
763 data->pwm[nr]);
764 } 825 }
765 826
766} 827}
@@ -787,7 +848,7 @@ static int f75375_probe(struct i2c_client *client,
787 if (err) 848 if (err)
788 goto exit_free; 849 goto exit_free;
789 850
790 if (data->kind == f75375) { 851 if (data->kind != f75373) {
791 err = sysfs_chmod_file(&client->dev.kobj, 852 err = sysfs_chmod_file(&client->dev.kobj,
792 &sensor_dev_attr_pwm1_mode.dev_attr.attr, 853 &sensor_dev_attr_pwm1_mode.dev_attr.attr,
793 S_IRUGO | S_IWUSR); 854 S_IRUGO | S_IWUSR);
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 7e78f7c87857..3d471d56bf15 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -72,6 +72,7 @@
72 72
73#define MXS_I2C_QUEUESTAT (0x70) 73#define MXS_I2C_QUEUESTAT (0x70)
74#define MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY 0x00002000 74#define MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY 0x00002000
75#define MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK 0x0000001F
75 76
76#define MXS_I2C_QUEUECMD (0x80) 77#define MXS_I2C_QUEUECMD (0x80)
77 78
@@ -219,14 +220,14 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg,
219 int ret; 220 int ret;
220 int flags; 221 int flags;
221 222
222 init_completion(&i2c->cmd_complete);
223
224 dev_dbg(i2c->dev, "addr: 0x%04x, len: %d, flags: 0x%x, stop: %d\n", 223 dev_dbg(i2c->dev, "addr: 0x%04x, len: %d, flags: 0x%x, stop: %d\n",
225 msg->addr, msg->len, msg->flags, stop); 224 msg->addr, msg->len, msg->flags, stop);
226 225
227 if (msg->len == 0) 226 if (msg->len == 0)
228 return -EINVAL; 227 return -EINVAL;
229 228
229 init_completion(&i2c->cmd_complete);
230
230 flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0; 231 flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0;
231 232
232 if (msg->flags & I2C_M_RD) 233 if (msg->flags & I2C_M_RD)
@@ -286,6 +287,7 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id)
286{ 287{
287 struct mxs_i2c_dev *i2c = dev_id; 288 struct mxs_i2c_dev *i2c = dev_id;
288 u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK; 289 u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK;
290 bool is_last_cmd;
289 291
290 if (!stat) 292 if (!stat)
291 return IRQ_NONE; 293 return IRQ_NONE;
@@ -300,9 +302,14 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id)
300 else 302 else
301 i2c->cmd_err = 0; 303 i2c->cmd_err = 0;
302 304
303 complete(&i2c->cmd_complete); 305 is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) &
306 MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0;
307
308 if (is_last_cmd || i2c->cmd_err)
309 complete(&i2c->cmd_complete);
304 310
305 writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR); 311 writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR);
312
306 return IRQ_HANDLED; 313 return IRQ_HANDLED;
307} 314}
308 315
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index 288da5c1499d..103dbd92e256 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -44,7 +44,8 @@ static ssize_t debug_read_ver(struct file *file, char __user *userbuf,
44static ssize_t debug_read_regs(struct file *file, char __user *userbuf, 44static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
45 size_t count, loff_t *ppos) 45 size_t count, loff_t *ppos)
46{ 46{
47 struct omap_iommu *obj = file->private_data; 47 struct device *dev = file->private_data;
48 struct omap_iommu *obj = dev_to_omap_iommu(dev);
48 char *p, *buf; 49 char *p, *buf;
49 ssize_t bytes; 50 ssize_t bytes;
50 51
@@ -67,7 +68,8 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
67static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, 68static ssize_t debug_read_tlb(struct file *file, char __user *userbuf,
68 size_t count, loff_t *ppos) 69 size_t count, loff_t *ppos)
69{ 70{
70 struct omap_iommu *obj = file->private_data; 71 struct device *dev = file->private_data;
72 struct omap_iommu *obj = dev_to_omap_iommu(dev);
71 char *p, *buf; 73 char *p, *buf;
72 ssize_t bytes, rest; 74 ssize_t bytes, rest;
73 75
@@ -97,7 +99,8 @@ static ssize_t debug_write_pagetable(struct file *file,
97 struct iotlb_entry e; 99 struct iotlb_entry e;
98 struct cr_regs cr; 100 struct cr_regs cr;
99 int err; 101 int err;
100 struct omap_iommu *obj = file->private_data; 102 struct device *dev = file->private_data;
103 struct omap_iommu *obj = dev_to_omap_iommu(dev);
101 char buf[MAXCOLUMN], *p = buf; 104 char buf[MAXCOLUMN], *p = buf;
102 105
103 count = min(count, sizeof(buf)); 106 count = min(count, sizeof(buf));
@@ -184,7 +187,8 @@ out:
184static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, 187static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf,
185 size_t count, loff_t *ppos) 188 size_t count, loff_t *ppos)
186{ 189{
187 struct omap_iommu *obj = file->private_data; 190 struct device *dev = file->private_data;
191 struct omap_iommu *obj = dev_to_omap_iommu(dev);
188 char *p, *buf; 192 char *p, *buf;
189 size_t bytes; 193 size_t bytes;
190 194
@@ -212,7 +216,8 @@ static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf,
212static ssize_t debug_read_mmap(struct file *file, char __user *userbuf, 216static ssize_t debug_read_mmap(struct file *file, char __user *userbuf,
213 size_t count, loff_t *ppos) 217 size_t count, loff_t *ppos)
214{ 218{
215 struct omap_iommu *obj = file->private_data; 219 struct device *dev = file->private_data;
220 struct omap_iommu *obj = dev_to_omap_iommu(dev);
216 char *p, *buf; 221 char *p, *buf;
217 struct iovm_struct *tmp; 222 struct iovm_struct *tmp;
218 int uninitialized_var(i); 223 int uninitialized_var(i);
@@ -254,7 +259,7 @@ static ssize_t debug_read_mmap(struct file *file, char __user *userbuf,
254static ssize_t debug_read_mem(struct file *file, char __user *userbuf, 259static ssize_t debug_read_mem(struct file *file, char __user *userbuf,
255 size_t count, loff_t *ppos) 260 size_t count, loff_t *ppos)
256{ 261{
257 struct omap_iommu *obj = file->private_data; 262 struct device *dev = file->private_data;
258 char *p, *buf; 263 char *p, *buf;
259 struct iovm_struct *area; 264 struct iovm_struct *area;
260 ssize_t bytes; 265 ssize_t bytes;
@@ -268,8 +273,8 @@ static ssize_t debug_read_mem(struct file *file, char __user *userbuf,
268 273
269 mutex_lock(&iommu_debug_lock); 274 mutex_lock(&iommu_debug_lock);
270 275
271 area = omap_find_iovm_area(obj, (u32)ppos); 276 area = omap_find_iovm_area(dev, (u32)ppos);
272 if (IS_ERR(area)) { 277 if (!area) {
273 bytes = -EINVAL; 278 bytes = -EINVAL;
274 goto err_out; 279 goto err_out;
275 } 280 }
@@ -287,7 +292,7 @@ err_out:
287static ssize_t debug_write_mem(struct file *file, const char __user *userbuf, 292static ssize_t debug_write_mem(struct file *file, const char __user *userbuf,
288 size_t count, loff_t *ppos) 293 size_t count, loff_t *ppos)
289{ 294{
290 struct omap_iommu *obj = file->private_data; 295 struct device *dev = file->private_data;
291 struct iovm_struct *area; 296 struct iovm_struct *area;
292 char *p, *buf; 297 char *p, *buf;
293 298
@@ -305,8 +310,8 @@ static ssize_t debug_write_mem(struct file *file, const char __user *userbuf,
305 goto err_out; 310 goto err_out;
306 } 311 }
307 312
308 area = omap_find_iovm_area(obj, (u32)ppos); 313 area = omap_find_iovm_area(dev, (u32)ppos);
309 if (IS_ERR(area)) { 314 if (!area) {
310 count = -EINVAL; 315 count = -EINVAL;
311 goto err_out; 316 goto err_out;
312 } 317 }
@@ -350,7 +355,7 @@ DEBUG_FOPS(mem);
350 { \ 355 { \
351 struct dentry *dent; \ 356 struct dentry *dent; \
352 dent = debugfs_create_file(#attr, mode, parent, \ 357 dent = debugfs_create_file(#attr, mode, parent, \
353 obj, &debug_##attr##_fops); \ 358 dev, &debug_##attr##_fops); \
354 if (!dent) \ 359 if (!dent) \
355 return -ENOMEM; \ 360 return -ENOMEM; \
356 } 361 }
@@ -362,20 +367,29 @@ static int iommu_debug_register(struct device *dev, void *data)
362{ 367{
363 struct platform_device *pdev = to_platform_device(dev); 368 struct platform_device *pdev = to_platform_device(dev);
364 struct omap_iommu *obj = platform_get_drvdata(pdev); 369 struct omap_iommu *obj = platform_get_drvdata(pdev);
370 struct omap_iommu_arch_data *arch_data;
365 struct dentry *d, *parent; 371 struct dentry *d, *parent;
366 372
367 if (!obj || !obj->dev) 373 if (!obj || !obj->dev)
368 return -EINVAL; 374 return -EINVAL;
369 375
376 arch_data = kzalloc(sizeof(*arch_data), GFP_KERNEL);
377 if (!arch_data)
378 return -ENOMEM;
379
380 arch_data->iommu_dev = obj;
381
382 dev->archdata.iommu = arch_data;
383
370 d = debugfs_create_dir(obj->name, iommu_debug_root); 384 d = debugfs_create_dir(obj->name, iommu_debug_root);
371 if (!d) 385 if (!d)
372 return -ENOMEM; 386 goto nomem;
373 parent = d; 387 parent = d;
374 388
375 d = debugfs_create_u8("nr_tlb_entries", 400, parent, 389 d = debugfs_create_u8("nr_tlb_entries", 400, parent,
376 (u8 *)&obj->nr_tlb_entries); 390 (u8 *)&obj->nr_tlb_entries);
377 if (!d) 391 if (!d)
378 return -ENOMEM; 392 goto nomem;
379 393
380 DEBUG_ADD_FILE_RO(ver); 394 DEBUG_ADD_FILE_RO(ver);
381 DEBUG_ADD_FILE_RO(regs); 395 DEBUG_ADD_FILE_RO(regs);
@@ -385,6 +399,22 @@ static int iommu_debug_register(struct device *dev, void *data)
385 DEBUG_ADD_FILE(mem); 399 DEBUG_ADD_FILE(mem);
386 400
387 return 0; 401 return 0;
402
403nomem:
404 kfree(arch_data);
405 return -ENOMEM;
406}
407
408static int iommu_debug_unregister(struct device *dev, void *data)
409{
410 if (!dev->archdata.iommu)
411 return 0;
412
413 kfree(dev->archdata.iommu);
414
415 dev->archdata.iommu = NULL;
416
417 return 0;
388} 418}
389 419
390static int __init iommu_debug_init(void) 420static int __init iommu_debug_init(void)
@@ -411,6 +441,7 @@ module_init(iommu_debug_init)
411static void __exit iommu_debugfs_exit(void) 441static void __exit iommu_debugfs_exit(void)
412{ 442{
413 debugfs_remove_recursive(iommu_debug_root); 443 debugfs_remove_recursive(iommu_debug_root);
444 omap_foreach_iommu_device(NULL, iommu_debug_unregister);
414} 445}
415module_exit(iommu_debugfs_exit) 446module_exit(iommu_debugfs_exit)
416 447
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index d8edd979d01b..6899dcd02dfa 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1223,7 +1223,8 @@ static int __init omap_iommu_init(void)
1223 1223
1224 return platform_driver_register(&omap_iommu_driver); 1224 return platform_driver_register(&omap_iommu_driver);
1225} 1225}
1226module_init(omap_iommu_init); 1226/* must be ready before omap3isp is probed */
1227subsys_initcall(omap_iommu_init);
1227 1228
1228static void __exit omap_iommu_exit(void) 1229static void __exit omap_iommu_exit(void)
1229{ 1230{
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index 04a3f1b756a8..192b0d118df4 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -95,11 +95,16 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val)
95 spin_unlock_irqrestore(&priv->cmdreg_lock, flags); 95 spin_unlock_irqrestore(&priv->cmdreg_lock, flags);
96} 96}
97 97
98static int sja1000_is_absent(struct sja1000_priv *priv)
99{
100 return (priv->read_reg(priv, REG_MOD) == 0xFF);
101}
102
98static int sja1000_probe_chip(struct net_device *dev) 103static int sja1000_probe_chip(struct net_device *dev)
99{ 104{
100 struct sja1000_priv *priv = netdev_priv(dev); 105 struct sja1000_priv *priv = netdev_priv(dev);
101 106
102 if (priv->reg_base && (priv->read_reg(priv, 0) == 0xFF)) { 107 if (priv->reg_base && sja1000_is_absent(priv)) {
103 printk(KERN_INFO "%s: probing @0x%lX failed\n", 108 printk(KERN_INFO "%s: probing @0x%lX failed\n",
104 DRV_NAME, dev->base_addr); 109 DRV_NAME, dev->base_addr);
105 return 0; 110 return 0;
@@ -493,6 +498,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
493 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { 498 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) {
494 n++; 499 n++;
495 status = priv->read_reg(priv, REG_SR); 500 status = priv->read_reg(priv, REG_SR);
501 /* check for absent controller due to hw unplug */
502 if (status == 0xFF && sja1000_is_absent(priv))
503 return IRQ_NONE;
496 504
497 if (isrc & IRQ_WUI) 505 if (isrc & IRQ_WUI)
498 dev_warn(dev->dev.parent, "wakeup interrupt\n"); 506 dev_warn(dev->dev.parent, "wakeup interrupt\n");
@@ -509,6 +517,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
509 while (status & SR_RBS) { 517 while (status & SR_RBS) {
510 sja1000_rx(dev); 518 sja1000_rx(dev);
511 status = priv->read_reg(priv, REG_SR); 519 status = priv->read_reg(priv, REG_SR);
520 /* check for absent controller */
521 if (status == 0xFF && sja1000_is_absent(priv))
522 return IRQ_NONE;
512 } 523 }
513 } 524 }
514 if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) { 525 if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) {
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index b8591246eb4c..1ff3c6df35a2 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -2244,10 +2244,6 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb,
2244 dev_info(&adapter->pdev->dev, "tx locked\n"); 2244 dev_info(&adapter->pdev->dev, "tx locked\n");
2245 return NETDEV_TX_LOCKED; 2245 return NETDEV_TX_LOCKED;
2246 } 2246 }
2247 if (skb->mark == 0x01)
2248 type = atl1c_trans_high;
2249 else
2250 type = atl1c_trans_normal;
2251 2247
2252 if (atl1c_tpd_avail(adapter, type) < tpd_req) { 2248 if (atl1c_tpd_avail(adapter, type) < tpd_req) {
2253 /* no enough descriptor, just stop queue */ 2249 /* no enough descriptor, just stop queue */
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 3fb66d09ece5..cab87456a34a 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -2339,7 +2339,7 @@ static inline int __init b44_pci_init(void)
2339 return err; 2339 return err;
2340} 2340}
2341 2341
2342static inline void __exit b44_pci_exit(void) 2342static inline void b44_pci_exit(void)
2343{ 2343{
2344#ifdef CONFIG_B44_PCI 2344#ifdef CONFIG_B44_PCI
2345 ssb_pcihost_unregister(&b44_pci_driver); 2345 ssb_pcihost_unregister(&b44_pci_driver);
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index dd3a0a232ea0..818a573669e6 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -3584,7 +3584,11 @@ static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr,
3584 fl6.flowi6_oif = dst_addr->sin6_scope_id; 3584 fl6.flowi6_oif = dst_addr->sin6_scope_id;
3585 3585
3586 *dst = ip6_route_output(&init_net, NULL, &fl6); 3586 *dst = ip6_route_output(&init_net, NULL, &fl6);
3587 if (*dst) 3587 if ((*dst)->error) {
3588 dst_release(*dst);
3589 *dst = NULL;
3590 return -ENETUNREACH;
3591 } else
3588 return 0; 3592 return 0;
3589#endif 3593#endif
3590 3594
diff --git a/drivers/net/ethernet/cisco/enic/cq_enet_desc.h b/drivers/net/ethernet/cisco/enic/cq_enet_desc.h
index c2c0680a1146..ac37cacc6136 100644
--- a/drivers/net/ethernet/cisco/enic/cq_enet_desc.h
+++ b/drivers/net/ethernet/cisco/enic/cq_enet_desc.h
@@ -157,7 +157,7 @@ static inline void cq_enet_rq_desc_dec(struct cq_enet_rq_desc *desc,
157 CQ_ENET_RQ_DESC_FCOE_FC_CRC_OK) ? 1 : 0; 157 CQ_ENET_RQ_DESC_FCOE_FC_CRC_OK) ? 1 : 0;
158 *fcoe_enc_error = (desc->flags & 158 *fcoe_enc_error = (desc->flags &
159 CQ_ENET_RQ_DESC_FCOE_ENC_ERROR) ? 1 : 0; 159 CQ_ENET_RQ_DESC_FCOE_ENC_ERROR) ? 1 : 0;
160 *fcoe_eof = (u8)((desc->checksum_fcoe >> 160 *fcoe_eof = (u8)((le16_to_cpu(desc->checksum_fcoe) >>
161 CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT) & 161 CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT) &
162 CQ_ENET_RQ_DESC_FCOE_EOF_MASK); 162 CQ_ENET_RQ_DESC_FCOE_EOF_MASK);
163 *checksum = 0; 163 *checksum = 0;
diff --git a/drivers/net/ethernet/cisco/enic/enic_pp.c b/drivers/net/ethernet/cisco/enic/enic_pp.c
index 22bf03a1829e..c347b6236f8f 100644
--- a/drivers/net/ethernet/cisco/enic/enic_pp.c
+++ b/drivers/net/ethernet/cisco/enic/enic_pp.c
@@ -72,7 +72,7 @@ static int enic_set_port_profile(struct enic *enic, int vf)
72 struct enic_port_profile *pp; 72 struct enic_port_profile *pp;
73 struct vic_provinfo *vp; 73 struct vic_provinfo *vp;
74 const u8 oui[3] = VIC_PROVINFO_CISCO_OUI; 74 const u8 oui[3] = VIC_PROVINFO_CISCO_OUI;
75 const u16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX); 75 const __be16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX);
76 char uuid_str[38]; 76 char uuid_str[38];
77 char client_mac_str[18]; 77 char client_mac_str[18];
78 u8 *client_mac; 78 u8 *client_mac;
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 27d651a80f3f..55cbf65512c3 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -2328,19 +2328,11 @@ jme_change_mtu(struct net_device *netdev, int new_mtu)
2328 ((new_mtu) < IPV6_MIN_MTU)) 2328 ((new_mtu) < IPV6_MIN_MTU))
2329 return -EINVAL; 2329 return -EINVAL;
2330 2330
2331 if (new_mtu > 4000) {
2332 jme->reg_rxcs &= ~RXCS_FIFOTHNP;
2333 jme->reg_rxcs |= RXCS_FIFOTHNP_64QW;
2334 jme_restart_rx_engine(jme);
2335 } else {
2336 jme->reg_rxcs &= ~RXCS_FIFOTHNP;
2337 jme->reg_rxcs |= RXCS_FIFOTHNP_128QW;
2338 jme_restart_rx_engine(jme);
2339 }
2340 2331
2341 netdev->mtu = new_mtu; 2332 netdev->mtu = new_mtu;
2342 netdev_update_features(netdev); 2333 netdev_update_features(netdev);
2343 2334
2335 jme_restart_rx_engine(jme);
2344 jme_reset_link(jme); 2336 jme_reset_link(jme);
2345 2337
2346 return 0; 2338 return 0;
diff --git a/drivers/net/ethernet/jme.h b/drivers/net/ethernet/jme.h
index 4304072bd3c5..3efc897c9913 100644
--- a/drivers/net/ethernet/jme.h
+++ b/drivers/net/ethernet/jme.h
@@ -730,7 +730,7 @@ enum jme_rxcs_values {
730 RXCS_RETRYCNT_60 = 0x00000F00, 730 RXCS_RETRYCNT_60 = 0x00000F00,
731 731
732 RXCS_DEFAULT = RXCS_FIFOTHTP_128T | 732 RXCS_DEFAULT = RXCS_FIFOTHTP_128T |
733 RXCS_FIFOTHNP_128QW | 733 RXCS_FIFOTHNP_16QW |
734 RXCS_DMAREQSZ_128B | 734 RXCS_DMAREQSZ_128B |
735 RXCS_RETRYGAP_256ns | 735 RXCS_RETRYGAP_256ns |
736 RXCS_RETRYCNT_32, 736 RXCS_RETRYCNT_32,
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 8fa41f3082cf..9129ace02560 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -1036,7 +1036,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
1036 struct mlx4_priv *priv = mlx4_priv(dev); 1036 struct mlx4_priv *priv = mlx4_priv(dev);
1037 int vec = 0, err = 0, i; 1037 int vec = 0, err = 0, i;
1038 1038
1039 spin_lock(&priv->msix_ctl.pool_lock); 1039 mutex_lock(&priv->msix_ctl.pool_lock);
1040 for (i = 0; !vec && i < dev->caps.comp_pool; i++) { 1040 for (i = 0; !vec && i < dev->caps.comp_pool; i++) {
1041 if (~priv->msix_ctl.pool_bm & 1ULL << i) { 1041 if (~priv->msix_ctl.pool_bm & 1ULL << i) {
1042 priv->msix_ctl.pool_bm |= 1ULL << i; 1042 priv->msix_ctl.pool_bm |= 1ULL << i;
@@ -1058,7 +1058,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
1058 eq_set_ci(&priv->eq_table.eq[vec], 1); 1058 eq_set_ci(&priv->eq_table.eq[vec], 1);
1059 } 1059 }
1060 } 1060 }
1061 spin_unlock(&priv->msix_ctl.pool_lock); 1061 mutex_unlock(&priv->msix_ctl.pool_lock);
1062 1062
1063 if (vec) { 1063 if (vec) {
1064 *vector = vec; 1064 *vector = vec;
@@ -1079,13 +1079,13 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec)
1079 if (likely(i >= 0)) { 1079 if (likely(i >= 0)) {
1080 /*sanity check , making sure were not trying to free irq's 1080 /*sanity check , making sure were not trying to free irq's
1081 Belonging to a legacy EQ*/ 1081 Belonging to a legacy EQ*/
1082 spin_lock(&priv->msix_ctl.pool_lock); 1082 mutex_lock(&priv->msix_ctl.pool_lock);
1083 if (priv->msix_ctl.pool_bm & 1ULL << i) { 1083 if (priv->msix_ctl.pool_bm & 1ULL << i) {
1084 free_irq(priv->eq_table.eq[vec].irq, 1084 free_irq(priv->eq_table.eq[vec].irq,
1085 &priv->eq_table.eq[vec]); 1085 &priv->eq_table.eq[vec]);
1086 priv->msix_ctl.pool_bm &= ~(1ULL << i); 1086 priv->msix_ctl.pool_bm &= ~(1ULL << i);
1087 } 1087 }
1088 spin_unlock(&priv->msix_ctl.pool_lock); 1088 mutex_unlock(&priv->msix_ctl.pool_lock);
1089 } 1089 }
1090 1090
1091} 1091}
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 678558b502fc..d498f049c74e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -531,15 +531,14 @@ int mlx4_change_port_types(struct mlx4_dev *dev,
531 for (port = 0; port < dev->caps.num_ports; port++) { 531 for (port = 0; port < dev->caps.num_ports; port++) {
532 /* Change the port type only if the new type is different 532 /* Change the port type only if the new type is different
533 * from the current, and not set to Auto */ 533 * from the current, and not set to Auto */
534 if (port_types[port] != dev->caps.port_type[port + 1]) { 534 if (port_types[port] != dev->caps.port_type[port + 1])
535 change = 1; 535 change = 1;
536 dev->caps.port_type[port + 1] = port_types[port];
537 }
538 } 536 }
539 if (change) { 537 if (change) {
540 mlx4_unregister_device(dev); 538 mlx4_unregister_device(dev);
541 for (port = 1; port <= dev->caps.num_ports; port++) { 539 for (port = 1; port <= dev->caps.num_ports; port++) {
542 mlx4_CLOSE_PORT(dev, port); 540 mlx4_CLOSE_PORT(dev, port);
541 dev->caps.port_type[port] = port_types[port - 1];
543 err = mlx4_SET_PORT(dev, port); 542 err = mlx4_SET_PORT(dev, port);
544 if (err) { 543 if (err) {
545 mlx4_err(dev, "Failed to set port %d, " 544 mlx4_err(dev, "Failed to set port %d, "
@@ -986,6 +985,9 @@ static int map_bf_area(struct mlx4_dev *dev)
986 resource_size_t bf_len; 985 resource_size_t bf_len;
987 int err = 0; 986 int err = 0;
988 987
988 if (!dev->caps.bf_reg_size)
989 return -ENXIO;
990
989 bf_start = pci_resource_start(dev->pdev, 2) + 991 bf_start = pci_resource_start(dev->pdev, 2) +
990 (dev->caps.num_uars << PAGE_SHIFT); 992 (dev->caps.num_uars << PAGE_SHIFT);
991 bf_len = pci_resource_len(dev->pdev, 2) - 993 bf_len = pci_resource_len(dev->pdev, 2) -
@@ -1825,7 +1827,7 @@ slave_start:
1825 goto err_master_mfunc; 1827 goto err_master_mfunc;
1826 1828
1827 priv->msix_ctl.pool_bm = 0; 1829 priv->msix_ctl.pool_bm = 0;
1828 spin_lock_init(&priv->msix_ctl.pool_lock); 1830 mutex_init(&priv->msix_ctl.pool_lock);
1829 1831
1830 mlx4_enable_msi_x(dev); 1832 mlx4_enable_msi_x(dev);
1831 if ((mlx4_is_mfunc(dev)) && 1833 if ((mlx4_is_mfunc(dev)) &&
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
index c92269f8c057..28f8251561f4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
@@ -697,7 +697,7 @@ struct mlx4_sense {
697 697
698struct mlx4_msix_ctl { 698struct mlx4_msix_ctl {
699 u64 pool_bm; 699 u64 pool_bm;
700 spinlock_t pool_lock; 700 struct mutex pool_lock;
701}; 701};
702 702
703struct mlx4_steer { 703struct mlx4_steer {
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index 231176fcd2ba..2784bc706f1e 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -1545,7 +1545,7 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
1545 1545
1546 netdev->irq = platform_get_irq(pdev, 0); 1546 netdev->irq = platform_get_irq(pdev, 0);
1547 1547
1548 if (netdev->irq < 0) { 1548 if ((int)netdev->irq < 0) {
1549 err = netdev->irq; 1549 err = netdev->irq;
1550 goto err_get_irq; 1550 goto err_get_irq;
1551 } 1551 }
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index aca349861767..fc52fca74193 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -156,11 +156,10 @@ static int efx_init_rx_buffers_skb(struct efx_rx_queue *rx_queue)
156 if (unlikely(!skb)) 156 if (unlikely(!skb))
157 return -ENOMEM; 157 return -ENOMEM;
158 158
159 /* Adjust the SKB for padding and checksum */ 159 /* Adjust the SKB for padding */
160 skb_reserve(skb, NET_IP_ALIGN); 160 skb_reserve(skb, NET_IP_ALIGN);
161 rx_buf->len = skb_len - NET_IP_ALIGN; 161 rx_buf->len = skb_len - NET_IP_ALIGN;
162 rx_buf->is_page = false; 162 rx_buf->is_page = false;
163 skb->ip_summed = CHECKSUM_UNNECESSARY;
164 163
165 rx_buf->dma_addr = pci_map_single(efx->pci_dev, 164 rx_buf->dma_addr = pci_map_single(efx->pci_dev,
166 skb->data, rx_buf->len, 165 skb->data, rx_buf->len,
@@ -496,6 +495,7 @@ static void efx_rx_packet_gro(struct efx_channel *channel,
496 495
497 EFX_BUG_ON_PARANOID(!checksummed); 496 EFX_BUG_ON_PARANOID(!checksummed);
498 rx_buf->u.skb = NULL; 497 rx_buf->u.skb = NULL;
498 skb->ip_summed = CHECKSUM_UNNECESSARY;
499 499
500 gro_result = napi_gro_receive(napi, skb); 500 gro_result = napi_gro_receive(napi, skb);
501 } 501 }
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 4fa0bcb25dfc..4b2f54565f64 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1009,7 +1009,7 @@ static void emac_rx_handler(void *token, int len, int status)
1009 int ret; 1009 int ret;
1010 1010
1011 /* free and bail if we are shutting down */ 1011 /* free and bail if we are shutting down */
1012 if (unlikely(!netif_running(ndev) || !netif_carrier_ok(ndev))) { 1012 if (unlikely(!netif_running(ndev))) {
1013 dev_kfree_skb_any(skb); 1013 dev_kfree_skb_any(skb);
1014 return; 1014 return;
1015 } 1015 }
@@ -1038,7 +1038,9 @@ static void emac_rx_handler(void *token, int len, int status)
1038recycle: 1038recycle:
1039 ret = cpdma_chan_submit(priv->rxchan, skb, skb->data, 1039 ret = cpdma_chan_submit(priv->rxchan, skb, skb->data,
1040 skb_tailroom(skb), GFP_KERNEL); 1040 skb_tailroom(skb), GFP_KERNEL);
1041 if (WARN_ON(ret < 0)) 1041
1042 WARN_ON(ret == -ENOMEM);
1043 if (unlikely(ret < 0))
1042 dev_kfree_skb_any(skb); 1044 dev_kfree_skb_any(skb);
1043} 1045}
1044 1046
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index c81f136ae670..0856e1b7a849 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -30,16 +30,16 @@
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32 32
33MODULE_DESCRIPTION("ICPlus IP175C/IP101A/IC1001 PHY drivers"); 33MODULE_DESCRIPTION("ICPlus IP175C/IP101A/IP101G/IC1001 PHY drivers");
34MODULE_AUTHOR("Michael Barkowski"); 34MODULE_AUTHOR("Michael Barkowski");
35MODULE_LICENSE("GPL"); 35MODULE_LICENSE("GPL");
36 36
37/* IP101A/IP1001 */ 37/* IP101A/G - IP1001 */
38#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ 38#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */
39#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ 39#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */
40#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ 40#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */
41#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ 41#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */
42#define IP101A_APS_ON 2 /* IP101A APS Mode bit */ 42#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */
43 43
44static int ip175c_config_init(struct phy_device *phydev) 44static int ip175c_config_init(struct phy_device *phydev)
45{ 45{
@@ -98,20 +98,24 @@ static int ip175c_config_init(struct phy_device *phydev)
98 98
99static int ip1xx_reset(struct phy_device *phydev) 99static int ip1xx_reset(struct phy_device *phydev)
100{ 100{
101 int err, bmcr; 101 int bmcr;
102 102
103 /* Software Reset PHY */ 103 /* Software Reset PHY */
104 bmcr = phy_read(phydev, MII_BMCR); 104 bmcr = phy_read(phydev, MII_BMCR);
105 if (bmcr < 0)
106 return bmcr;
105 bmcr |= BMCR_RESET; 107 bmcr |= BMCR_RESET;
106 err = phy_write(phydev, MII_BMCR, bmcr); 108 bmcr = phy_write(phydev, MII_BMCR, bmcr);
107 if (err < 0) 109 if (bmcr < 0)
108 return err; 110 return bmcr;
109 111
110 do { 112 do {
111 bmcr = phy_read(phydev, MII_BMCR); 113 bmcr = phy_read(phydev, MII_BMCR);
114 if (bmcr < 0)
115 return bmcr;
112 } while (bmcr & BMCR_RESET); 116 } while (bmcr & BMCR_RESET);
113 117
114 return err; 118 return 0;
115} 119}
116 120
117static int ip1001_config_init(struct phy_device *phydev) 121static int ip1001_config_init(struct phy_device *phydev)
@@ -124,7 +128,10 @@ static int ip1001_config_init(struct phy_device *phydev)
124 128
125 /* Enable Auto Power Saving mode */ 129 /* Enable Auto Power Saving mode */
126 c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2); 130 c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2);
131 if (c < 0)
132 return c;
127 c |= IP1001_APS_ON; 133 c |= IP1001_APS_ON;
134 c = phy_write(phydev, IP1001_SPEC_CTRL_STATUS_2, c);
128 if (c < 0) 135 if (c < 0)
129 return c; 136 return c;
130 137
@@ -132,14 +139,19 @@ static int ip1001_config_init(struct phy_device *phydev)
132 /* Additional delay (2ns) used to adjust RX clock phase 139 /* Additional delay (2ns) used to adjust RX clock phase
133 * at RGMII interface */ 140 * at RGMII interface */
134 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); 141 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
142 if (c < 0)
143 return c;
144
135 c |= IP1001_PHASE_SEL_MASK; 145 c |= IP1001_PHASE_SEL_MASK;
136 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); 146 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c);
147 if (c < 0)
148 return c;
137 } 149 }
138 150
139 return c; 151 return 0;
140} 152}
141 153
142static int ip101a_config_init(struct phy_device *phydev) 154static int ip101a_g_config_init(struct phy_device *phydev)
143{ 155{
144 int c; 156 int c;
145 157
@@ -149,7 +161,7 @@ static int ip101a_config_init(struct phy_device *phydev)
149 161
150 /* Enable Auto Power Saving mode */ 162 /* Enable Auto Power Saving mode */
151 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); 163 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
152 c |= IP101A_APS_ON; 164 c |= IP101A_G_APS_ON;
153 return c; 165 return c;
154} 166}
155 167
@@ -191,6 +203,7 @@ static struct phy_driver ip1001_driver = {
191 .phy_id_mask = 0x0ffffff0, 203 .phy_id_mask = 0x0ffffff0,
192 .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | 204 .features = PHY_GBIT_FEATURES | SUPPORTED_Pause |
193 SUPPORTED_Asym_Pause, 205 SUPPORTED_Asym_Pause,
206 .flags = PHY_HAS_INTERRUPT,
194 .config_init = &ip1001_config_init, 207 .config_init = &ip1001_config_init,
195 .config_aneg = &genphy_config_aneg, 208 .config_aneg = &genphy_config_aneg,
196 .read_status = &genphy_read_status, 209 .read_status = &genphy_read_status,
@@ -199,13 +212,14 @@ static struct phy_driver ip1001_driver = {
199 .driver = { .owner = THIS_MODULE,}, 212 .driver = { .owner = THIS_MODULE,},
200}; 213};
201 214
202static struct phy_driver ip101a_driver = { 215static struct phy_driver ip101a_g_driver = {
203 .phy_id = 0x02430c54, 216 .phy_id = 0x02430c54,
204 .name = "ICPlus IP101A", 217 .name = "ICPlus IP101A/G",
205 .phy_id_mask = 0x0ffffff0, 218 .phy_id_mask = 0x0ffffff0,
206 .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | 219 .features = PHY_BASIC_FEATURES | SUPPORTED_Pause |
207 SUPPORTED_Asym_Pause, 220 SUPPORTED_Asym_Pause,
208 .config_init = &ip101a_config_init, 221 .flags = PHY_HAS_INTERRUPT,
222 .config_init = &ip101a_g_config_init,
209 .config_aneg = &genphy_config_aneg, 223 .config_aneg = &genphy_config_aneg,
210 .read_status = &genphy_read_status, 224 .read_status = &genphy_read_status,
211 .suspend = genphy_suspend, 225 .suspend = genphy_suspend,
@@ -221,7 +235,7 @@ static int __init icplus_init(void)
221 if (ret < 0) 235 if (ret < 0)
222 return -ENODEV; 236 return -ENODEV;
223 237
224 ret = phy_driver_register(&ip101a_driver); 238 ret = phy_driver_register(&ip101a_g_driver);
225 if (ret < 0) 239 if (ret < 0)
226 return -ENODEV; 240 return -ENODEV;
227 241
@@ -231,7 +245,7 @@ static int __init icplus_init(void)
231static void __exit icplus_exit(void) 245static void __exit icplus_exit(void)
232{ 246{
233 phy_driver_unregister(&ip1001_driver); 247 phy_driver_unregister(&ip1001_driver);
234 phy_driver_unregister(&ip101a_driver); 248 phy_driver_unregister(&ip101a_g_driver);
235 phy_driver_unregister(&ip175c_driver); 249 phy_driver_unregister(&ip175c_driver);
236} 250}
237 251
@@ -241,6 +255,7 @@ module_exit(icplus_exit);
241static struct mdio_device_id __maybe_unused icplus_tbl[] = { 255static struct mdio_device_id __maybe_unused icplus_tbl[] = {
242 { 0x02430d80, 0x0ffffff0 }, 256 { 0x02430d80, 0x0ffffff0 },
243 { 0x02430d90, 0x0ffffff0 }, 257 { 0x02430d90, 0x0ffffff0 },
258 { 0x02430c54, 0x0ffffff0 },
244 { } 259 { }
245}; 260};
246 261
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index edfa15d2e795..486b4048850d 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -2024,14 +2024,22 @@ ppp_mp_reconstruct(struct ppp *ppp)
2024 continue; 2024 continue;
2025 } 2025 }
2026 if (PPP_MP_CB(p)->sequence != seq) { 2026 if (PPP_MP_CB(p)->sequence != seq) {
2027 u32 oldseq;
2027 /* Fragment `seq' is missing. If it is after 2028 /* Fragment `seq' is missing. If it is after
2028 minseq, it might arrive later, so stop here. */ 2029 minseq, it might arrive later, so stop here. */
2029 if (seq_after(seq, minseq)) 2030 if (seq_after(seq, minseq))
2030 break; 2031 break;
2031 /* Fragment `seq' is lost, keep going. */ 2032 /* Fragment `seq' is lost, keep going. */
2032 lost = 1; 2033 lost = 1;
2034 oldseq = seq;
2033 seq = seq_before(minseq, PPP_MP_CB(p)->sequence)? 2035 seq = seq_before(minseq, PPP_MP_CB(p)->sequence)?
2034 minseq + 1: PPP_MP_CB(p)->sequence; 2036 minseq + 1: PPP_MP_CB(p)->sequence;
2037
2038 if (ppp->debug & 1)
2039 netdev_printk(KERN_DEBUG, ppp->dev,
2040 "lost frag %u..%u\n",
2041 oldseq, seq-1);
2042
2035 goto again; 2043 goto again;
2036 } 2044 }
2037 2045
@@ -2076,6 +2084,10 @@ ppp_mp_reconstruct(struct ppp *ppp)
2076 struct sk_buff *tmp2; 2084 struct sk_buff *tmp2;
2077 2085
2078 skb_queue_reverse_walk_from_safe(list, p, tmp2) { 2086 skb_queue_reverse_walk_from_safe(list, p, tmp2) {
2087 if (ppp->debug & 1)
2088 netdev_printk(KERN_DEBUG, ppp->dev,
2089 "discarding frag %u\n",
2090 PPP_MP_CB(p)->sequence);
2079 __skb_unlink(p, list); 2091 __skb_unlink(p, list);
2080 kfree_skb(p); 2092 kfree_skb(p);
2081 } 2093 }
@@ -2091,6 +2103,17 @@ ppp_mp_reconstruct(struct ppp *ppp)
2091 /* If we have discarded any fragments, 2103 /* If we have discarded any fragments,
2092 signal a receive error. */ 2104 signal a receive error. */
2093 if (PPP_MP_CB(head)->sequence != ppp->nextseq) { 2105 if (PPP_MP_CB(head)->sequence != ppp->nextseq) {
2106 skb_queue_walk_safe(list, p, tmp) {
2107 if (p == head)
2108 break;
2109 if (ppp->debug & 1)
2110 netdev_printk(KERN_DEBUG, ppp->dev,
2111 "discarding frag %u\n",
2112 PPP_MP_CB(p)->sequence);
2113 __skb_unlink(p, list);
2114 kfree_skb(p);
2115 }
2116
2094 if (ppp->debug & 1) 2117 if (ppp->debug & 1)
2095 netdev_printk(KERN_DEBUG, ppp->dev, 2118 netdev_printk(KERN_DEBUG, ppp->dev,
2096 " missed pkts %u..%u\n", 2119 " missed pkts %u..%u\n",
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 41a61efc331e..90a30026a931 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -573,6 +573,13 @@ static const struct usb_device_id products [] = {
573 .driver_info = 0, 573 .driver_info = 0,
574}, 574},
575 575
576/* Logitech Harmony 900 - uses the pseudo-MDLM (BLAN) driver */
577{
578 USB_DEVICE_AND_INTERFACE_INFO(0x046d, 0xc11f, USB_CLASS_COMM,
579 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
580 .driver_info = 0,
581},
582
576/* 583/*
577 * WHITELIST!!! 584 * WHITELIST!!!
578 * 585 *
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 304fe78ff60e..e1324b4a0f66 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1632,7 +1632,7 @@ static int hso_get_count(struct tty_struct *tty,
1632 struct hso_serial *serial = get_serial_by_tty(tty); 1632 struct hso_serial *serial = get_serial_by_tty(tty);
1633 struct hso_tiocmget *tiocmget = serial->tiocmget; 1633 struct hso_tiocmget *tiocmget = serial->tiocmget;
1634 1634
1635 memset(&icount, 0, sizeof(struct serial_icounter_struct)); 1635 memset(icount, 0, sizeof(struct serial_icounter_struct));
1636 1636
1637 if (!tiocmget) 1637 if (!tiocmget)
1638 return -ENOENT; 1638 return -ENOENT;
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index f701d4127087..c3197ce0e2ad 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -316,6 +316,11 @@ static const struct usb_device_id products [] = {
316 ZAURUS_MASTER_INTERFACE, 316 ZAURUS_MASTER_INTERFACE,
317 .driver_info = ZAURUS_PXA_INFO, 317 .driver_info = ZAURUS_PXA_INFO,
318}, { 318}, {
319 /* C-750/C-760/C-860/SL-C3000 PDA in MDLM mode */
320 USB_DEVICE_AND_INTERFACE_INFO(0x04DD, 0x9031, USB_CLASS_COMM,
321 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
322 .driver_info = (unsigned long) &bogus_mdlm_info,
323}, {
319 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO 324 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
320 | USB_DEVICE_ID_MATCH_DEVICE, 325 | USB_DEVICE_ID_MATCH_DEVICE,
321 .idVendor = 0x04DD, 326 .idVendor = 0x04DD,
@@ -349,6 +354,13 @@ static const struct usb_device_id products [] = {
349 ZAURUS_MASTER_INTERFACE, 354 ZAURUS_MASTER_INTERFACE,
350 .driver_info = OLYMPUS_MXL_INFO, 355 .driver_info = OLYMPUS_MXL_INFO,
351}, 356},
357
358/* Logitech Harmony 900 - uses the pseudo-MDLM (BLAN) driver */
359{
360 USB_DEVICE_AND_INTERFACE_INFO(0x046d, 0xc11f, USB_CLASS_COMM,
361 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
362 .driver_info = (unsigned long) &bogus_mdlm_info,
363},
352 { }, // END 364 { }, // END
353}; 365};
354MODULE_DEVICE_TABLE(usb, products); 366MODULE_DEVICE_TABLE(usb, products);
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index de7fc345148a..3dcd3857a36c 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -843,8 +843,8 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
843 /* for simplicity, don't copy L4 headers */ 843 /* for simplicity, don't copy L4 headers */
844 ctx->l4_hdr_size = 0; 844 ctx->l4_hdr_size = 0;
845 } 845 }
846 ctx->copy_size = ctx->eth_ip_hdr_size + 846 ctx->copy_size = min(ctx->eth_ip_hdr_size +
847 ctx->l4_hdr_size; 847 ctx->l4_hdr_size, skb->len);
848 } else { 848 } else {
849 ctx->eth_ip_hdr_size = 0; 849 ctx->eth_ip_hdr_size = 0;
850 ctx->l4_hdr_size = 0; 850 ctx->l4_hdr_size = 0;
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 635b592ad961..a427a16bb739 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1346,7 +1346,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
1346 fc = hdr->frame_control; 1346 fc = hdr->frame_control;
1347 for (i = 0; i < sc->hw->max_rates; i++) { 1347 for (i = 0; i < sc->hw->max_rates; i++) {
1348 struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; 1348 struct ieee80211_tx_rate *rate = &tx_info->status.rates[i];
1349 if (!rate->count) 1349 if (rate->idx < 0 || !rate->count)
1350 break; 1350 break;
1351 1351
1352 final_ts_idx = i; 1352 final_ts_idx = i;
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index c3b6c4652cd6..5b2972b43b0e 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -841,7 +841,12 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
841 ret = mwifiex_set_rf_channel(priv, channel, 841 ret = mwifiex_set_rf_channel(priv, channel,
842 priv->adapter->channel_type); 842 priv->adapter->channel_type);
843 843
844 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */ 844 /* As this is new association, clear locally stored
845 * keys and security related flags */
846 priv->sec_info.wpa_enabled = false;
847 priv->sec_info.wpa2_enabled = false;
848 priv->wep_key_curr_index = 0;
849 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1);
845 850
846 if (mode == NL80211_IFTYPE_ADHOC) { 851 if (mode == NL80211_IFTYPE_ADHOC) {
847 /* "privacy" is set only for ad-hoc mode */ 852 /* "privacy" is set only for ad-hoc mode */
@@ -886,6 +891,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
886 dev_dbg(priv->adapter->dev, 891 dev_dbg(priv->adapter->dev,
887 "info: setting wep encryption" 892 "info: setting wep encryption"
888 " with key len %d\n", sme->key_len); 893 " with key len %d\n", sme->key_len);
894 priv->wep_key_curr_index = sme->key_idx;
889 ret = mwifiex_set_encode(priv, sme->key, sme->key_len, 895 ret = mwifiex_set_encode(priv, sme->key, sme->key_len,
890 sme->key_idx, 0); 896 sme->key_idx, 0);
891 } 897 }
diff --git a/drivers/parisc/iommu-helpers.h b/drivers/parisc/iommu-helpers.h
index a9c46cc2db37..8c33491b21fe 100644
--- a/drivers/parisc/iommu-helpers.h
+++ b/drivers/parisc/iommu-helpers.h
@@ -1,3 +1,5 @@
1#include <linux/prefetch.h>
2
1/** 3/**
2 * iommu_fill_pdir - Insert coalesced scatter/gather chunks into the I/O Pdir. 4 * iommu_fill_pdir - Insert coalesced scatter/gather chunks into the I/O Pdir.
3 * @ioc: The I/O Controller. 5 * @ioc: The I/O Controller.
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index a87e2728b2c3..64d433ec4fc6 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -328,21 +328,15 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
328 goto err1; 328 goto err1;
329 } 329 }
330 330
331 if (ret) { 331 pxa2xx_configure_sockets(&dev->dev);
332 while (--i >= 0) 332 dev_set_drvdata(&dev->dev, sinfo);
333 soc_pcmcia_remove_one(&sinfo->skt[i]);
334 kfree(sinfo);
335 clk_put(clk);
336 } else {
337 pxa2xx_configure_sockets(&dev->dev);
338 dev_set_drvdata(&dev->dev, sinfo);
339 }
340 333
341 return 0; 334 return 0;
342 335
343err1: 336err1:
344 while (--i >= 0) 337 while (--i >= 0)
345 soc_pcmcia_remove_one(&sinfo->skt[i]); 338 soc_pcmcia_remove_one(&sinfo->skt[i]);
339 clk_put(clk);
346 kfree(sinfo); 340 kfree(sinfo);
347err0: 341err0:
348 return ret; 342 return ret;
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index df33530cec4a..28b81ae4cf7f 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -196,7 +196,7 @@ static const unsigned int LDO12_suspend_table[] = {
196}; 196};
197 197
198static const unsigned int LDO13_table[] = { 198static const unsigned int LDO13_table[] = {
199 1300000, 1800000, 2000000, 2500000, 2800000, 3000000, 0, 0, 199 1200000, 1300000, 1800000, 2000000, 2500000, 2800000, 3000000, 0,
200}; 200};
201 201
202static const unsigned int LDO13_suspend_table[] = { 202static const unsigned int LDO13_suspend_table[] = {
@@ -389,10 +389,10 @@ static struct pm8607_regulator_info pm8607_regulator_info[] = {
389 PM8607_LDO( 7, LDO7, 0, 3, SUPPLIES_EN12, 1), 389 PM8607_LDO( 7, LDO7, 0, 3, SUPPLIES_EN12, 1),
390 PM8607_LDO( 8, LDO8, 0, 3, SUPPLIES_EN12, 2), 390 PM8607_LDO( 8, LDO8, 0, 3, SUPPLIES_EN12, 2),
391 PM8607_LDO( 9, LDO9, 0, 3, SUPPLIES_EN12, 3), 391 PM8607_LDO( 9, LDO9, 0, 3, SUPPLIES_EN12, 3),
392 PM8607_LDO(10, LDO10, 0, 3, SUPPLIES_EN12, 4), 392 PM8607_LDO(10, LDO10, 0, 4, SUPPLIES_EN12, 4),
393 PM8607_LDO(12, LDO12, 0, 4, SUPPLIES_EN12, 5), 393 PM8607_LDO(12, LDO12, 0, 4, SUPPLIES_EN12, 5),
394 PM8607_LDO(13, VIBRATOR_SET, 1, 3, VIBRATOR_SET, 0), 394 PM8607_LDO(13, VIBRATOR_SET, 1, 3, VIBRATOR_SET, 0),
395 PM8607_LDO(14, LDO14, 0, 4, SUPPLIES_EN12, 6), 395 PM8607_LDO(14, LDO14, 0, 3, SUPPLIES_EN12, 6),
396}; 396};
397 397
398static int __devinit pm8607_regulator_probe(struct platform_device *pdev) 398static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 70880be26015..2617b1ed4709 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -18,12 +18,12 @@
18#include <linux/hdreg.h> /* HDIO_GETGEO */ 18#include <linux/hdreg.h> /* HDIO_GETGEO */
19#include <linux/bio.h> 19#include <linux/bio.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/compat.h>
21#include <linux/init.h> 22#include <linux/init.h>
22 23
23#include <asm/debug.h> 24#include <asm/debug.h>
24#include <asm/idals.h> 25#include <asm/idals.h>
25#include <asm/ebcdic.h> 26#include <asm/ebcdic.h>
26#include <asm/compat.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/cio.h> 29#include <asm/cio.h>
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index f1a2016829fc..792c69e78fe2 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -13,6 +13,7 @@
13#define KMSG_COMPONENT "dasd" 13#define KMSG_COMPONENT "dasd"
14 14
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/compat.h>
16#include <linux/major.h> 17#include <linux/major.h>
17#include <linux/fs.h> 18#include <linux/fs.h>
18#include <linux/blkpg.h> 19#include <linux/blkpg.h>
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c
index e71298158f9e..911704571b9c 100644
--- a/drivers/s390/char/fs3270.c
+++ b/drivers/s390/char/fs3270.c
@@ -11,6 +11,7 @@
11#include <linux/console.h> 11#include <linux/console.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/compat.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/list.h> 16#include <linux/list.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c
index 75bde6a8b7dc..89c03e6b1c0c 100644
--- a/drivers/s390/char/vmcp.c
+++ b/drivers/s390/char/vmcp.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/compat.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/miscdevice.h> 18#include <linux/miscdevice.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c
index 0c87b0fc7714..8f9a1a384496 100644
--- a/drivers/s390/cio/chsc_sch.c
+++ b/drivers/s390/cio/chsc_sch.c
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/compat.h>
11#include <linux/device.h> 12#include <linux/device.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/uaccess.h> 14#include <linux/uaccess.h>
diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c
index 303dde09d294..fab2c2592a97 100644
--- a/drivers/s390/scsi/zfcp_cfdc.c
+++ b/drivers/s390/scsi/zfcp_cfdc.c
@@ -11,6 +11,7 @@
11#define KMSG_COMPONENT "zfcp" 11#define KMSG_COMPONENT "zfcp"
12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
13 13
14#include <linux/compat.h>
14#include <linux/slab.h> 15#include <linux/slab.h>
15#include <linux/types.h> 16#include <linux/types.h>
16#include <linux/miscdevice.h> 17#include <linux/miscdevice.h>
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index b31a8e3841d7..d4ed9eb52657 100644
--- a/drivers/scsi/osd/osd_uld.c
+++ b/drivers/scsi/osd/osd_uld.c
@@ -69,10 +69,10 @@
69#ifndef SCSI_OSD_MAJOR 69#ifndef SCSI_OSD_MAJOR
70# define SCSI_OSD_MAJOR 260 70# define SCSI_OSD_MAJOR 260
71#endif 71#endif
72#define SCSI_OSD_MAX_MINOR 64 72#define SCSI_OSD_MAX_MINOR MINORMASK
73 73
74static const char osd_name[] = "osd"; 74static const char osd_name[] = "osd";
75static const char *osd_version_string = "open-osd 0.2.0"; 75static const char *osd_version_string = "open-osd 0.2.1";
76 76
77MODULE_AUTHOR("Boaz Harrosh <bharrosh@panasas.com>"); 77MODULE_AUTHOR("Boaz Harrosh <bharrosh@panasas.com>");
78MODULE_DESCRIPTION("open-osd Upper-Layer-Driver osd.ko"); 78MODULE_DESCRIPTION("open-osd Upper-Layer-Driver osd.ko");
diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig
index 74d29b552901..408a9927be92 100644
--- a/drivers/video/omap2/displays/Kconfig
+++ b/drivers/video/omap2/displays/Kconfig
@@ -12,7 +12,7 @@ config PANEL_GENERIC_DPI
12 12
13config PANEL_DVI 13config PANEL_DVI
14 tristate "DVI output" 14 tristate "DVI output"
15 depends on OMAP2_DSS_DPI 15 depends on OMAP2_DSS_DPI && I2C
16 help 16 help
17 Driver for external monitors, connected via DVI. The driver uses i2c 17 Driver for external monitors, connected via DVI. The driver uses i2c
18 to read EDID information from the monitor. 18 to read EDID information from the monitor.
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 052dc874cd3d..87b3e25294cf 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -1276,6 +1276,9 @@ int dss_ovl_enable(struct omap_overlay *ovl)
1276 1276
1277 spin_unlock_irqrestore(&data_lock, flags); 1277 spin_unlock_irqrestore(&data_lock, flags);
1278 1278
1279 /* wait for overlay to be enabled */
1280 wait_pending_extra_info_updates();
1281
1279 mutex_unlock(&apply_lock); 1282 mutex_unlock(&apply_lock);
1280 1283
1281 return 0; 1284 return 0;
@@ -1313,6 +1316,9 @@ int dss_ovl_disable(struct omap_overlay *ovl)
1313 1316
1314 spin_unlock_irqrestore(&data_lock, flags); 1317 spin_unlock_irqrestore(&data_lock, flags);
1315 1318
1319 /* wait for the overlay to be disabled */
1320 wait_pending_extra_info_updates();
1321
1316 mutex_unlock(&apply_lock); 1322 mutex_unlock(&apply_lock);
1317 1323
1318 return 0; 1324 return 0;
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index d7aa3b056529..a36b934b2db4 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -165,9 +165,25 @@ static int hdmi_runtime_get(void)
165 165
166 DSSDBG("hdmi_runtime_get\n"); 166 DSSDBG("hdmi_runtime_get\n");
167 167
168 /*
169 * HACK: Add dss_runtime_get() to ensure DSS clock domain is enabled.
170 * This should be removed later.
171 */
172 r = dss_runtime_get();
173 if (r < 0)
174 goto err_get_dss;
175
168 r = pm_runtime_get_sync(&hdmi.pdev->dev); 176 r = pm_runtime_get_sync(&hdmi.pdev->dev);
169 WARN_ON(r < 0); 177 WARN_ON(r < 0);
170 return r < 0 ? r : 0; 178 if (r < 0)
179 goto err_get_hdmi;
180
181 return 0;
182
183err_get_hdmi:
184 dss_runtime_put();
185err_get_dss:
186 return r;
171} 187}
172 188
173static void hdmi_runtime_put(void) 189static void hdmi_runtime_put(void)
@@ -178,6 +194,12 @@ static void hdmi_runtime_put(void)
178 194
179 r = pm_runtime_put_sync(&hdmi.pdev->dev); 195 r = pm_runtime_put_sync(&hdmi.pdev->dev);
180 WARN_ON(r < 0); 196 WARN_ON(r < 0);
197
198 /*
199 * HACK: This is added to complement the dss_runtime_get() call in
200 * hdmi_runtime_get(). This should be removed later.
201 */
202 dss_runtime_put();
181} 203}
182 204
183int hdmi_init_display(struct omap_dss_device *dssdev) 205int hdmi_init_display(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 2d72334ca3da..6847a478b459 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -479,14 +479,7 @@ int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data,
479 479
480bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data) 480bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data)
481{ 481{
482 int r; 482 return gpio_get_value(ip_data->hpd_gpio);
483
484 void __iomem *base = hdmi_core_sys_base(ip_data);
485
486 /* HPD */
487 r = REG_GET(base, HDMI_CORE_SYS_SYS_STAT, 1, 1);
488
489 return r == 1;
490} 483}
491 484
492static void hdmi_core_init(struct hdmi_core_video_config *video_cfg, 485static void hdmi_core_init(struct hdmi_core_video_config *video_cfg,
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index d5aaca9cfa7e..8497727d66de 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1810,7 +1810,11 @@ static void hw_init(void)
1810 break; 1810 break;
1811 } 1811 }
1812 1812
1813 /* magic required on VX900 for correct modesetting on IGA1 */
1814 via_write_reg_mask(VIACR, 0x45, 0x00, 0x01);
1815
1813 /* probably this should go to the scaling code one day */ 1816 /* probably this should go to the scaling code one day */
1817 via_write_reg_mask(VIACR, 0xFD, 0, 0x80); /* VX900 hw scale on IGA2 */
1814 viafb_write_regx(scaling_parameters, ARRAY_SIZE(scaling_parameters)); 1818 viafb_write_regx(scaling_parameters, ARRAY_SIZE(scaling_parameters));
1815 1819
1816 /* Fill VPIT Parameters */ 1820 /* Fill VPIT Parameters */
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 95aeedf198f8..958e5129c601 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -367,29 +367,45 @@ static void __devexit virtballoon_remove(struct virtio_device *vdev)
367#ifdef CONFIG_PM 367#ifdef CONFIG_PM
368static int virtballoon_freeze(struct virtio_device *vdev) 368static int virtballoon_freeze(struct virtio_device *vdev)
369{ 369{
370 struct virtio_balloon *vb = vdev->priv;
371
370 /* 372 /*
371 * The kthread is already frozen by the PM core before this 373 * The kthread is already frozen by the PM core before this
372 * function is called. 374 * function is called.
373 */ 375 */
374 376
377 while (vb->num_pages)
378 leak_balloon(vb, vb->num_pages);
379 update_balloon_size(vb);
380
375 /* Ensure we don't get any more requests from the host */ 381 /* Ensure we don't get any more requests from the host */
376 vdev->config->reset(vdev); 382 vdev->config->reset(vdev);
377 vdev->config->del_vqs(vdev); 383 vdev->config->del_vqs(vdev);
378 return 0; 384 return 0;
379} 385}
380 386
387static int restore_common(struct virtio_device *vdev)
388{
389 struct virtio_balloon *vb = vdev->priv;
390 int ret;
391
392 ret = init_vqs(vdev->priv);
393 if (ret)
394 return ret;
395
396 fill_balloon(vb, towards_target(vb));
397 update_balloon_size(vb);
398 return 0;
399}
400
381static int virtballoon_thaw(struct virtio_device *vdev) 401static int virtballoon_thaw(struct virtio_device *vdev)
382{ 402{
383 return init_vqs(vdev->priv); 403 return restore_common(vdev);
384} 404}
385 405
386static int virtballoon_restore(struct virtio_device *vdev) 406static int virtballoon_restore(struct virtio_device *vdev)
387{ 407{
388 struct virtio_balloon *vb = vdev->priv; 408 struct virtio_balloon *vb = vdev->priv;
389 struct page *page, *page2;
390
391 /* We're starting from a clean slate */
392 vb->num_pages = 0;
393 409
394 /* 410 /*
395 * If a request wasn't complete at the time of freezing, this 411 * If a request wasn't complete at the time of freezing, this
@@ -397,12 +413,7 @@ static int virtballoon_restore(struct virtio_device *vdev)
397 */ 413 */
398 vb->need_stats_update = 0; 414 vb->need_stats_update = 0;
399 415
400 /* We don't have these pages in the balloon anymore! */ 416 return restore_common(vdev);
401 list_for_each_entry_safe(page, page2, &vb->pages, lru) {
402 list_del(&page->lru);
403 totalram_pages++;
404 }
405 return init_vqs(vdev->priv);
406} 417}
407#endif 418#endif
408 419
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 3aa52ba1398a..ee27f5733162 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1098,7 +1098,7 @@ config BOOKE_WDT_DEFAULT_TIMEOUT
1098 For Freescale Book-E processors, this is a number between 0 and 63. 1098 For Freescale Book-E processors, this is a number between 0 and 63.
1099 For other Book-E processors, this is a number between 0 and 3. 1099 For other Book-E processors, this is a number between 0 and 3.
1100 1100
1101 The value can be overidden by the wdt_period command-line parameter. 1101 The value can be overridden by the wdt_period command-line parameter.
1102 1102
1103# PPC64 Architecture 1103# PPC64 Architecture
1104 1104
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 337265b47305..7c0fdfca2646 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -198,9 +198,13 @@ static long booke_wdt_ioctl(struct file *file,
198 booke_wdt_period = tmp; 198 booke_wdt_period = tmp;
199#endif 199#endif
200 booke_wdt_set(); 200 booke_wdt_set();
201 return 0; 201 /* Fall */
202 case WDIOC_GETTIMEOUT: 202 case WDIOC_GETTIMEOUT:
203#ifdef CONFIG_FSL_BOOKE
204 return put_user(period_to_sec(booke_wdt_period), p);
205#else
203 return put_user(booke_wdt_period, p); 206 return put_user(booke_wdt_period, p);
207#endif
204 default: 208 default:
205 return -ENOTTY; 209 return -ENOTTY;
206 } 210 }
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 8464ea1c36a1..3c166d3f4e55 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -231,7 +231,7 @@ static int __devinit cru_detect(unsigned long map_entry,
231 231
232 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE; 232 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE;
233 233
234 set_memory_x((unsigned long)bios32_entrypoint, (2 * PAGE_SIZE)); 234 set_memory_x((unsigned long)bios32_map, 2);
235 asminline_call(&cmn_regs, bios32_entrypoint); 235 asminline_call(&cmn_regs, bios32_entrypoint);
236 236
237 if (cmn_regs.u1.ral != 0) { 237 if (cmn_regs.u1.ral != 0) {
@@ -250,7 +250,8 @@ static int __devinit cru_detect(unsigned long map_entry,
250 cru_rom_addr = 250 cru_rom_addr =
251 ioremap(cru_physical_address, cru_length); 251 ioremap(cru_physical_address, cru_length);
252 if (cru_rom_addr) { 252 if (cru_rom_addr) {
253 set_memory_x((unsigned long)cru_rom_addr, cru_length); 253 set_memory_x((unsigned long)cru_rom_addr & PAGE_MASK,
254 (cru_length + PAGE_SIZE - 1) >> PAGE_SHIFT);
254 retval = 0; 255 retval = 0;
255 } 256 }
256 } 257 }
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 8e210aafdfd0..dfae030a7ef2 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -264,7 +264,7 @@ static int __devinit pnx4008_wdt_probe(struct platform_device *pdev)
264 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 264 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
265 if (wdt_mem == NULL) { 265 if (wdt_mem == NULL) {
266 printk(KERN_INFO MODULE_NAME 266 printk(KERN_INFO MODULE_NAME
267 "failed to get memory region resouce\n"); 267 "failed to get memory region resource\n");
268 return -ENOENT; 268 return -ENOENT;
269 } 269 }
270 270
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 4bc3744e14e4..404172f02c9b 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -312,18 +312,26 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
312 dev = &pdev->dev; 312 dev = &pdev->dev;
313 wdt_dev = &pdev->dev; 313 wdt_dev = &pdev->dev;
314 314
315 /* get the memory region for the watchdog timer */
316
317 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 315 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
318 if (wdt_mem == NULL) { 316 if (wdt_mem == NULL) {
319 dev_err(dev, "no memory resource specified\n"); 317 dev_err(dev, "no memory resource specified\n");
320 return -ENOENT; 318 return -ENOENT;
321 } 319 }
322 320
321 wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
322 if (wdt_irq == NULL) {
323 dev_err(dev, "no irq resource specified\n");
324 ret = -ENOENT;
325 goto err;
326 }
327
328 /* get the memory region for the watchdog timer */
329
323 size = resource_size(wdt_mem); 330 size = resource_size(wdt_mem);
324 if (!request_mem_region(wdt_mem->start, size, pdev->name)) { 331 if (!request_mem_region(wdt_mem->start, size, pdev->name)) {
325 dev_err(dev, "failed to get memory region\n"); 332 dev_err(dev, "failed to get memory region\n");
326 return -EBUSY; 333 ret = -EBUSY;
334 goto err;
327 } 335 }
328 336
329 wdt_base = ioremap(wdt_mem->start, size); 337 wdt_base = ioremap(wdt_mem->start, size);
@@ -335,29 +343,17 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
335 343
336 DBG("probe: mapped wdt_base=%p\n", wdt_base); 344 DBG("probe: mapped wdt_base=%p\n", wdt_base);
337 345
338 wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
339 if (wdt_irq == NULL) {
340 dev_err(dev, "no irq resource specified\n");
341 ret = -ENOENT;
342 goto err_map;
343 }
344
345 ret = request_irq(wdt_irq->start, s3c2410wdt_irq, 0, pdev->name, pdev);
346 if (ret != 0) {
347 dev_err(dev, "failed to install irq (%d)\n", ret);
348 goto err_map;
349 }
350
351 wdt_clock = clk_get(&pdev->dev, "watchdog"); 346 wdt_clock = clk_get(&pdev->dev, "watchdog");
352 if (IS_ERR(wdt_clock)) { 347 if (IS_ERR(wdt_clock)) {
353 dev_err(dev, "failed to find watchdog clock source\n"); 348 dev_err(dev, "failed to find watchdog clock source\n");
354 ret = PTR_ERR(wdt_clock); 349 ret = PTR_ERR(wdt_clock);
355 goto err_irq; 350 goto err_map;
356 } 351 }
357 352
358 clk_enable(wdt_clock); 353 clk_enable(wdt_clock);
359 354
360 if (s3c2410wdt_cpufreq_register() < 0) { 355 ret = s3c2410wdt_cpufreq_register();
356 if (ret < 0) {
361 printk(KERN_ERR PFX "failed to register cpufreq\n"); 357 printk(KERN_ERR PFX "failed to register cpufreq\n");
362 goto err_clk; 358 goto err_clk;
363 } 359 }
@@ -378,12 +374,18 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
378 "cannot start\n"); 374 "cannot start\n");
379 } 375 }
380 376
377 ret = request_irq(wdt_irq->start, s3c2410wdt_irq, 0, pdev->name, pdev);
378 if (ret != 0) {
379 dev_err(dev, "failed to install irq (%d)\n", ret);
380 goto err_cpufreq;
381 }
382
381 watchdog_set_nowayout(&s3c2410_wdd, nowayout); 383 watchdog_set_nowayout(&s3c2410_wdd, nowayout);
382 384
383 ret = watchdog_register_device(&s3c2410_wdd); 385 ret = watchdog_register_device(&s3c2410_wdd);
384 if (ret) { 386 if (ret) {
385 dev_err(dev, "cannot register watchdog (%d)\n", ret); 387 dev_err(dev, "cannot register watchdog (%d)\n", ret);
386 goto err_cpufreq; 388 goto err_irq;
387 } 389 }
388 390
389 if (tmr_atboot && started == 0) { 391 if (tmr_atboot && started == 0) {
@@ -408,23 +410,26 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
408 410
409 return 0; 411 return 0;
410 412
413 err_irq:
414 free_irq(wdt_irq->start, pdev);
415
411 err_cpufreq: 416 err_cpufreq:
412 s3c2410wdt_cpufreq_deregister(); 417 s3c2410wdt_cpufreq_deregister();
413 418
414 err_clk: 419 err_clk:
415 clk_disable(wdt_clock); 420 clk_disable(wdt_clock);
416 clk_put(wdt_clock); 421 clk_put(wdt_clock);
417 422 wdt_clock = NULL;
418 err_irq:
419 free_irq(wdt_irq->start, pdev);
420 423
421 err_map: 424 err_map:
422 iounmap(wdt_base); 425 iounmap(wdt_base);
423 426
424 err_req: 427 err_req:
425 release_mem_region(wdt_mem->start, size); 428 release_mem_region(wdt_mem->start, size);
426 wdt_mem = NULL;
427 429
430 err:
431 wdt_irq = NULL;
432 wdt_mem = NULL;
428 return ret; 433 return ret;
429} 434}
430 435
@@ -432,18 +437,18 @@ static int __devexit s3c2410wdt_remove(struct platform_device *dev)
432{ 437{
433 watchdog_unregister_device(&s3c2410_wdd); 438 watchdog_unregister_device(&s3c2410_wdd);
434 439
440 free_irq(wdt_irq->start, dev);
441
435 s3c2410wdt_cpufreq_deregister(); 442 s3c2410wdt_cpufreq_deregister();
436 443
437 clk_disable(wdt_clock); 444 clk_disable(wdt_clock);
438 clk_put(wdt_clock); 445 clk_put(wdt_clock);
439 wdt_clock = NULL; 446 wdt_clock = NULL;
440 447
441 free_irq(wdt_irq->start, dev);
442 wdt_irq = NULL;
443
444 iounmap(wdt_base); 448 iounmap(wdt_base);
445 449
446 release_mem_region(wdt_mem->start, resource_size(wdt_mem)); 450 release_mem_region(wdt_mem->start, resource_size(wdt_mem));
451 wdt_irq = NULL;
447 wdt_mem = NULL; 452 wdt_mem = NULL;
448 return 0; 453 return 0;
449} 454}
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index bcb884e2d613..07d096c49920 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1421,7 +1421,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
1421 for (i = 1; i < view->n; ++i) { 1421 for (i = 1; i < view->n; ++i) {
1422 const struct user_regset *regset = &view->regsets[i]; 1422 const struct user_regset *regset = &view->regsets[i];
1423 do_thread_regset_writeback(t->task, regset); 1423 do_thread_regset_writeback(t->task, regset);
1424 if (regset->core_note_type && 1424 if (regset->core_note_type && regset->get &&
1425 (!regset->active || regset->active(t->task, regset))) { 1425 (!regset->active || regset->active(t->task, regset))) {
1426 int ret; 1426 int ret;
1427 size_t size = regset->n * regset->size; 1427 size_t size = regset->n * regset->size;
diff --git a/fs/dcache.c b/fs/dcache.c
index fe19ac13f75f..138be96e25b6 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -104,7 +104,7 @@ static unsigned int d_hash_shift __read_mostly;
104 104
105static struct hlist_bl_head *dentry_hashtable __read_mostly; 105static struct hlist_bl_head *dentry_hashtable __read_mostly;
106 106
107static inline struct hlist_bl_head *d_hash(struct dentry *parent, 107static inline struct hlist_bl_head *d_hash(const struct dentry *parent,
108 unsigned long hash) 108 unsigned long hash)
109{ 109{
110 hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; 110 hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES;
@@ -1717,8 +1717,9 @@ EXPORT_SYMBOL(d_add_ci);
1717 * child is looked up. Thus, an interlocking stepping of sequence lock checks 1717 * child is looked up. Thus, an interlocking stepping of sequence lock checks
1718 * is formed, giving integrity down the path walk. 1718 * is formed, giving integrity down the path walk.
1719 */ 1719 */
1720struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, 1720struct dentry *__d_lookup_rcu(const struct dentry *parent,
1721 unsigned *seq, struct inode **inode) 1721 const struct qstr *name,
1722 unsigned *seqp, struct inode **inode)
1722{ 1723{
1723 unsigned int len = name->len; 1724 unsigned int len = name->len;
1724 unsigned int hash = name->hash; 1725 unsigned int hash = name->hash;
@@ -1748,6 +1749,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name,
1748 * See Documentation/filesystems/path-lookup.txt for more details. 1749 * See Documentation/filesystems/path-lookup.txt for more details.
1749 */ 1750 */
1750 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { 1751 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) {
1752 unsigned seq;
1751 struct inode *i; 1753 struct inode *i;
1752 const char *tname; 1754 const char *tname;
1753 int tlen; 1755 int tlen;
@@ -1756,7 +1758,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name,
1756 continue; 1758 continue;
1757 1759
1758seqretry: 1760seqretry:
1759 *seq = read_seqcount_begin(&dentry->d_seq); 1761 seq = read_seqcount_begin(&dentry->d_seq);
1760 if (dentry->d_parent != parent) 1762 if (dentry->d_parent != parent)
1761 continue; 1763 continue;
1762 if (d_unhashed(dentry)) 1764 if (d_unhashed(dentry))
@@ -1771,7 +1773,7 @@ seqretry:
1771 * edge of memory when walking. If we could load this 1773 * edge of memory when walking. If we could load this
1772 * atomically some other way, we could drop this check. 1774 * atomically some other way, we could drop this check.
1773 */ 1775 */
1774 if (read_seqcount_retry(&dentry->d_seq, *seq)) 1776 if (read_seqcount_retry(&dentry->d_seq, seq))
1775 goto seqretry; 1777 goto seqretry;
1776 if (unlikely(parent->d_flags & DCACHE_OP_COMPARE)) { 1778 if (unlikely(parent->d_flags & DCACHE_OP_COMPARE)) {
1777 if (parent->d_op->d_compare(parent, *inode, 1779 if (parent->d_op->d_compare(parent, *inode,
@@ -1788,6 +1790,7 @@ seqretry:
1788 * order to do anything useful with the returned dentry 1790 * order to do anything useful with the returned dentry
1789 * anyway. 1791 * anyway.
1790 */ 1792 */
1793 *seqp = seq;
1791 *inode = i; 1794 *inode = i;
1792 return dentry; 1795 return dentry;
1793 } 1796 }
diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c
index 349209dc6a91..3a06f4043df4 100644
--- a/fs/ecryptfs/miscdev.c
+++ b/fs/ecryptfs/miscdev.c
@@ -429,7 +429,7 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf,
429 goto memdup; 429 goto memdup;
430 } else if (count < MIN_MSG_PKT_SIZE || count > MAX_MSG_PKT_SIZE) { 430 } else if (count < MIN_MSG_PKT_SIZE || count > MAX_MSG_PKT_SIZE) {
431 printk(KERN_WARNING "%s: Acceptable packet size range is " 431 printk(KERN_WARNING "%s: Acceptable packet size range is "
432 "[%d-%lu], but amount of data written is [%zu].", 432 "[%d-%zu], but amount of data written is [%zu].",
433 __func__, MIN_MSG_PKT_SIZE, MAX_MSG_PKT_SIZE, count); 433 __func__, MIN_MSG_PKT_SIZE, MAX_MSG_PKT_SIZE, count);
434 return -EINVAL; 434 return -EINVAL;
435 } 435 }
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 376816fcd040..351a3e797789 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -167,14 +167,19 @@ void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
167 spin_unlock(&lru_lock); 167 spin_unlock(&lru_lock);
168} 168}
169 169
170static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl) 170static void __gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
171{ 171{
172 spin_lock(&lru_lock);
173 if (!list_empty(&gl->gl_lru)) { 172 if (!list_empty(&gl->gl_lru)) {
174 list_del_init(&gl->gl_lru); 173 list_del_init(&gl->gl_lru);
175 atomic_dec(&lru_count); 174 atomic_dec(&lru_count);
176 clear_bit(GLF_LRU, &gl->gl_flags); 175 clear_bit(GLF_LRU, &gl->gl_flags);
177 } 176 }
177}
178
179static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
180{
181 spin_lock(&lru_lock);
182 __gfs2_glock_remove_from_lru(gl);
178 spin_unlock(&lru_lock); 183 spin_unlock(&lru_lock);
179} 184}
180 185
@@ -217,11 +222,12 @@ void gfs2_glock_put(struct gfs2_glock *gl)
217 struct gfs2_sbd *sdp = gl->gl_sbd; 222 struct gfs2_sbd *sdp = gl->gl_sbd;
218 struct address_space *mapping = gfs2_glock2aspace(gl); 223 struct address_space *mapping = gfs2_glock2aspace(gl);
219 224
220 if (atomic_dec_and_test(&gl->gl_ref)) { 225 if (atomic_dec_and_lock(&gl->gl_ref, &lru_lock)) {
226 __gfs2_glock_remove_from_lru(gl);
227 spin_unlock(&lru_lock);
221 spin_lock_bucket(gl->gl_hash); 228 spin_lock_bucket(gl->gl_hash);
222 hlist_bl_del_rcu(&gl->gl_list); 229 hlist_bl_del_rcu(&gl->gl_list);
223 spin_unlock_bucket(gl->gl_hash); 230 spin_unlock_bucket(gl->gl_hash);
224 gfs2_glock_remove_from_lru(gl);
225 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_holders)); 231 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_holders));
226 GLOCK_BUG_ON(gl, mapping && mapping->nrpages); 232 GLOCK_BUG_ON(gl, mapping && mapping->nrpages);
227 trace_gfs2_glock_put(gl); 233 trace_gfs2_glock_put(gl);
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index a7d611b93f0f..56987460cdae 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -391,10 +391,6 @@ static int alloc_dinode(struct gfs2_inode *dip, u64 *no_addr, u64 *generation)
391 int error; 391 int error;
392 int dblocks = 1; 392 int dblocks = 1;
393 393
394 error = gfs2_rindex_update(sdp);
395 if (error)
396 fs_warn(sdp, "rindex update returns %d\n", error);
397
398 error = gfs2_inplace_reserve(dip, RES_DINODE); 394 error = gfs2_inplace_reserve(dip, RES_DINODE);
399 if (error) 395 if (error)
400 goto out; 396 goto out;
@@ -1043,6 +1039,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
1043 rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr); 1039 rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr);
1044 if (!rgd) 1040 if (!rgd)
1045 goto out_inodes; 1041 goto out_inodes;
1042
1046 gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); 1043 gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2);
1047 1044
1048 1045
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 6aacf3f230a2..24f609c9ef91 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -800,6 +800,11 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
800 fs_err(sdp, "can't get quota file inode: %d\n", error); 800 fs_err(sdp, "can't get quota file inode: %d\n", error);
801 goto fail_rindex; 801 goto fail_rindex;
802 } 802 }
803
804 error = gfs2_rindex_update(sdp);
805 if (error)
806 goto fail_qinode;
807
803 return 0; 808 return 0;
804 809
805fail_qinode: 810fail_qinode:
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 981bfa32121a..49ada95209d0 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -683,16 +683,21 @@ int gfs2_rindex_update(struct gfs2_sbd *sdp)
683 struct gfs2_glock *gl = ip->i_gl; 683 struct gfs2_glock *gl = ip->i_gl;
684 struct gfs2_holder ri_gh; 684 struct gfs2_holder ri_gh;
685 int error = 0; 685 int error = 0;
686 int unlock_required = 0;
686 687
687 /* Read new copy from disk if we don't have the latest */ 688 /* Read new copy from disk if we don't have the latest */
688 if (!sdp->sd_rindex_uptodate) { 689 if (!sdp->sd_rindex_uptodate) {
689 mutex_lock(&sdp->sd_rindex_mutex); 690 mutex_lock(&sdp->sd_rindex_mutex);
690 error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &ri_gh); 691 if (!gfs2_glock_is_locked_by_me(gl)) {
691 if (error) 692 error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &ri_gh);
692 return error; 693 if (error)
694 return error;
695 unlock_required = 1;
696 }
693 if (!sdp->sd_rindex_uptodate) 697 if (!sdp->sd_rindex_uptodate)
694 error = gfs2_ri_update(ip); 698 error = gfs2_ri_update(ip);
695 gfs2_glock_dq_uninit(&ri_gh); 699 if (unlock_required)
700 gfs2_glock_dq_uninit(&ri_gh);
696 mutex_unlock(&sdp->sd_rindex_mutex); 701 mutex_unlock(&sdp->sd_rindex_mutex);
697 } 702 }
698 703
diff --git a/fs/namei.c b/fs/namei.c
index a780ea515c47..e2ba62820a0f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1374,6 +1374,34 @@ static inline int can_lookup(struct inode *inode)
1374 return 1; 1374 return 1;
1375} 1375}
1376 1376
1377unsigned int full_name_hash(const unsigned char *name, unsigned int len)
1378{
1379 unsigned long hash = init_name_hash();
1380 while (len--)
1381 hash = partial_name_hash(*name++, hash);
1382 return end_name_hash(hash);
1383}
1384EXPORT_SYMBOL(full_name_hash);
1385
1386/*
1387 * We know there's a real path component here of at least
1388 * one character.
1389 */
1390static inline unsigned long hash_name(const char *name, unsigned int *hashp)
1391{
1392 unsigned long hash = init_name_hash();
1393 unsigned long len = 0, c;
1394
1395 c = (unsigned char)*name;
1396 do {
1397 len++;
1398 hash = partial_name_hash(c, hash);
1399 c = (unsigned char)name[len];
1400 } while (c && c != '/');
1401 *hashp = end_name_hash(hash);
1402 return len;
1403}
1404
1377/* 1405/*
1378 * Name resolution. 1406 * Name resolution.
1379 * This is the basic name resolution function, turning a pathname into 1407 * This is the basic name resolution function, turning a pathname into
@@ -1394,31 +1422,22 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1394 1422
1395 /* At this point we know we have a real path component. */ 1423 /* At this point we know we have a real path component. */
1396 for(;;) { 1424 for(;;) {
1397 unsigned long hash;
1398 struct qstr this; 1425 struct qstr this;
1399 unsigned int c; 1426 long len;
1400 int type; 1427 int type;
1401 1428
1402 err = may_lookup(nd); 1429 err = may_lookup(nd);
1403 if (err) 1430 if (err)
1404 break; 1431 break;
1405 1432
1433 len = hash_name(name, &this.hash);
1406 this.name = name; 1434 this.name = name;
1407 c = *(const unsigned char *)name; 1435 this.len = len;
1408
1409 hash = init_name_hash();
1410 do {
1411 name++;
1412 hash = partial_name_hash(c, hash);
1413 c = *(const unsigned char *)name;
1414 } while (c && (c != '/'));
1415 this.len = name - (const char *) this.name;
1416 this.hash = end_name_hash(hash);
1417 1436
1418 type = LAST_NORM; 1437 type = LAST_NORM;
1419 if (this.name[0] == '.') switch (this.len) { 1438 if (name[0] == '.') switch (len) {
1420 case 2: 1439 case 2:
1421 if (this.name[1] == '.') { 1440 if (name[1] == '.') {
1422 type = LAST_DOTDOT; 1441 type = LAST_DOTDOT;
1423 nd->flags |= LOOKUP_JUMPED; 1442 nd->flags |= LOOKUP_JUMPED;
1424 } 1443 }
@@ -1437,12 +1456,18 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1437 } 1456 }
1438 } 1457 }
1439 1458
1440 /* remove trailing slashes? */ 1459 if (!name[len])
1441 if (!c)
1442 goto last_component; 1460 goto last_component;
1443 while (*++name == '/'); 1461 /*
1444 if (!*name) 1462 * If it wasn't NUL, we know it was '/'. Skip that
1463 * slash, and continue until no more slashes.
1464 */
1465 do {
1466 len++;
1467 } while (unlikely(name[len] == '/'));
1468 if (!name[len])
1445 goto last_component; 1469 goto last_component;
1470 name += len;
1446 1471
1447 err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW); 1472 err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW);
1448 if (err < 0) 1473 if (err < 0)
@@ -1775,24 +1800,21 @@ static struct dentry *lookup_hash(struct nameidata *nd)
1775struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) 1800struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
1776{ 1801{
1777 struct qstr this; 1802 struct qstr this;
1778 unsigned long hash;
1779 unsigned int c; 1803 unsigned int c;
1780 1804
1781 WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); 1805 WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex));
1782 1806
1783 this.name = name; 1807 this.name = name;
1784 this.len = len; 1808 this.len = len;
1809 this.hash = full_name_hash(name, len);
1785 if (!len) 1810 if (!len)
1786 return ERR_PTR(-EACCES); 1811 return ERR_PTR(-EACCES);
1787 1812
1788 hash = init_name_hash();
1789 while (len--) { 1813 while (len--) {
1790 c = *(const unsigned char *)name++; 1814 c = *(const unsigned char *)name++;
1791 if (c == '/' || c == '\0') 1815 if (c == '/' || c == '\0')
1792 return ERR_PTR(-EACCES); 1816 return ERR_PTR(-EACCES);
1793 hash = partial_name_hash(c, hash);
1794 } 1817 }
1795 this.hash = end_name_hash(hash);
1796 /* 1818 /*
1797 * See if the low-level filesystem might want 1819 * See if the low-level filesystem might want
1798 * to use its own hash.. 1820 * to use its own hash..
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index f14fde2b03d6..e0281992ddc3 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -1,7 +1,7 @@
1/** 1/**
2 * attrib.c - NTFS attribute operations. Part of the Linux-NTFS project. 2 * attrib.c - NTFS attribute operations. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2001-2007 Anton Altaparmakov 4 * Copyright (c) 2001-2012 Anton Altaparmakov and Tuxera Inc.
5 * Copyright (c) 2002 Richard Russon 5 * Copyright (c) 2002 Richard Russon
6 * 6 *
7 * This program/include file is free software; you can redistribute it and/or 7 * This program/include file is free software; you can redistribute it and/or
@@ -345,10 +345,10 @@ LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn,
345 unsigned long flags; 345 unsigned long flags;
346 bool is_retry = false; 346 bool is_retry = false;
347 347
348 BUG_ON(!ni);
348 ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, %s_locked.", 349 ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, %s_locked.",
349 ni->mft_no, (unsigned long long)vcn, 350 ni->mft_no, (unsigned long long)vcn,
350 write_locked ? "write" : "read"); 351 write_locked ? "write" : "read");
351 BUG_ON(!ni);
352 BUG_ON(!NInoNonResident(ni)); 352 BUG_ON(!NInoNonResident(ni));
353 BUG_ON(vcn < 0); 353 BUG_ON(vcn < 0);
354 if (!ni->runlist.rl) { 354 if (!ni->runlist.rl) {
@@ -469,9 +469,9 @@ runlist_element *ntfs_attr_find_vcn_nolock(ntfs_inode *ni, const VCN vcn,
469 int err = 0; 469 int err = 0;
470 bool is_retry = false; 470 bool is_retry = false;
471 471
472 BUG_ON(!ni);
472 ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, with%s ctx.", 473 ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, with%s ctx.",
473 ni->mft_no, (unsigned long long)vcn, ctx ? "" : "out"); 474 ni->mft_no, (unsigned long long)vcn, ctx ? "" : "out");
474 BUG_ON(!ni);
475 BUG_ON(!NInoNonResident(ni)); 475 BUG_ON(!NInoNonResident(ni));
476 BUG_ON(vcn < 0); 476 BUG_ON(vcn < 0);
477 if (!ni->runlist.rl) { 477 if (!ni->runlist.rl) {
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index 382857f9c7db..3014a36a255b 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -1,7 +1,7 @@
1/** 1/**
2 * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project. 2 * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2001-2011 Anton Altaparmakov and Tuxera Inc. 4 * Copyright (c) 2001-2012 Anton Altaparmakov and Tuxera Inc.
5 * Copyright (c) 2002 Richard Russon 5 * Copyright (c) 2002 Richard Russon
6 * 6 *
7 * This program/include file is free software; you can redistribute it and/or 7 * This program/include file is free software; you can redistribute it and/or
@@ -1367,7 +1367,7 @@ static int ntfs_mft_bitmap_extend_allocation_nolock(ntfs_volume *vol)
1367 ntfs_error(vol->sb, "Failed to merge runlists for mft " 1367 ntfs_error(vol->sb, "Failed to merge runlists for mft "
1368 "bitmap."); 1368 "bitmap.");
1369 if (ntfs_cluster_free_from_rl(vol, rl2)) { 1369 if (ntfs_cluster_free_from_rl(vol, rl2)) {
1370 ntfs_error(vol->sb, "Failed to dealocate " 1370 ntfs_error(vol->sb, "Failed to deallocate "
1371 "allocated cluster.%s", es); 1371 "allocated cluster.%s", es);
1372 NVolSetErrors(vol); 1372 NVolSetErrors(vol);
1373 } 1373 }
@@ -1805,7 +1805,7 @@ static int ntfs_mft_data_extend_allocation_nolock(ntfs_volume *vol)
1805 ntfs_error(vol->sb, "Failed to merge runlists for mft data " 1805 ntfs_error(vol->sb, "Failed to merge runlists for mft data "
1806 "attribute."); 1806 "attribute.");
1807 if (ntfs_cluster_free_from_rl(vol, rl2)) { 1807 if (ntfs_cluster_free_from_rl(vol, rl2)) {
1808 ntfs_error(vol->sb, "Failed to dealocate clusters " 1808 ntfs_error(vol->sb, "Failed to deallocate clusters "
1809 "from the mft data attribute.%s", es); 1809 "from the mft data attribute.%s", es);
1810 NVolSetErrors(vol); 1810 NVolSetErrors(vol);
1811 } 1811 }
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 5a4a8af5c406..f907611cca73 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * super.c - NTFS kernel super block handling. Part of the Linux-NTFS project. 2 * super.c - NTFS kernel super block handling. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2001-2011 Anton Altaparmakov and Tuxera Inc. 4 * Copyright (c) 2001-2012 Anton Altaparmakov and Tuxera Inc.
5 * Copyright (c) 2001,2002 Richard Russon 5 * Copyright (c) 2001,2002 Richard Russon
6 * 6 *
7 * This program/include file is free software; you can redistribute it and/or 7 * This program/include file is free software; you can redistribute it and/or
@@ -1239,7 +1239,6 @@ static int check_windows_hibernation_status(ntfs_volume *vol)
1239{ 1239{
1240 MFT_REF mref; 1240 MFT_REF mref;
1241 struct inode *vi; 1241 struct inode *vi;
1242 ntfs_inode *ni;
1243 struct page *page; 1242 struct page *page;
1244 u32 *kaddr, *kend; 1243 u32 *kaddr, *kend;
1245 ntfs_name *name = NULL; 1244 ntfs_name *name = NULL;
@@ -1290,7 +1289,6 @@ static int check_windows_hibernation_status(ntfs_volume *vol)
1290 "is not the system volume.", i_size_read(vi)); 1289 "is not the system volume.", i_size_read(vi));
1291 goto iput_out; 1290 goto iput_out;
1292 } 1291 }
1293 ni = NTFS_I(vi);
1294 page = ntfs_map_page(vi->i_mapping, 0); 1292 page = ntfs_map_page(vi->i_mapping, 0);
1295 if (IS_ERR(page)) { 1293 if (IS_ERR(page)) {
1296 ntfs_error(vol->sb, "Failed to read from hiberfil.sys."); 1294 ntfs_error(vol->sb, "Failed to read from hiberfil.sys.");
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 8a3d4fde2604..6afd7d6a9899 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -70,7 +70,7 @@ extern void ioport_unmap(void __iomem *);
70/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */ 70/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
71struct pci_dev; 71struct pci_dev;
72extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 72extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
73#else 73#elif defined(CONFIG_GENERIC_IOMAP)
74struct pci_dev; 74struct pci_dev;
75static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 75static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
76{ } 76{ }
diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h
index e58fcf891370..ce37349860fe 100644
--- a/include/asm-generic/pci_iomap.h
+++ b/include/asm-generic/pci_iomap.h
@@ -25,7 +25,7 @@ extern void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port,
25#define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr)) 25#define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
26#endif 26#endif
27 27
28#else 28#elif defined(CONFIG_GENERIC_PCI_IOMAP)
29static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) 29static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
30{ 30{
31 return NULL; 31 return NULL;
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index a5c0e10fd47d..1e38a19d68f6 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -2,6 +2,7 @@ header-y += drm.h
2header-y += drm_fourcc.h 2header-y += drm_fourcc.h
3header-y += drm_mode.h 3header-y += drm_mode.h
4header-y += drm_sarea.h 4header-y += drm_sarea.h
5header-y += exynos_drm.h
5header-y += i810_drm.h 6header-y += i810_drm.h
6header-y += i915_drm.h 7header-y += i915_drm.h
7header-y += mga_drm.h 8header-y += mga_drm.h
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 5e120f1c5cd9..1ed3aae893a5 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -97,15 +97,30 @@ struct drm_exynos_plane_set_zpos {
97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ 97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) 98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
99 99
100#ifdef __KERNEL__
101
100/** 102/**
101 * Platform Specific Structure for DRM based FIMD. 103 * A structure for lcd panel information.
102 * 104 *
103 * @timing: default video mode for initializing 105 * @timing: default video mode for initializing
106 * @width_mm: physical size of lcd width.
107 * @height_mm: physical size of lcd height.
108 */
109struct exynos_drm_panel_info {
110 struct fb_videomode timing;
111 u32 width_mm;
112 u32 height_mm;
113};
114
115/**
116 * Platform Specific Structure for DRM based FIMD.
117 *
118 * @panel: default panel info for initializing
104 * @default_win: default window layer number to be used for UI. 119 * @default_win: default window layer number to be used for UI.
105 * @bpp: default bit per pixel. 120 * @bpp: default bit per pixel.
106 */ 121 */
107struct exynos_drm_fimd_pdata { 122struct exynos_drm_fimd_pdata {
108 struct fb_videomode timing; 123 struct exynos_drm_panel_info panel;
109 u32 vidcon0; 124 u32 vidcon0;
110 u32 vidcon1; 125 u32 vidcon1;
111 unsigned int default_win; 126 unsigned int default_win;
@@ -139,4 +154,5 @@ struct exynos_drm_hdmi_pdata {
139 unsigned int bpp; 154 unsigned int bpp;
140}; 155};
141 156
142#endif 157#endif /* __KERNEL__ */
158#endif /* _EXYNOS_DRM_H_ */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 41c9f6515f46..7e05fcee75a1 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -561,5 +561,9 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
561 unsigned long liovcnt, const struct compat_iovec __user *rvec, 561 unsigned long liovcnt, const struct compat_iovec __user *rvec,
562 unsigned long riovcnt, unsigned long flags); 562 unsigned long riovcnt, unsigned long flags);
563 563
564#else
565
566#define is_compat_task() (0)
567
564#endif /* CONFIG_COMPAT */ 568#endif /* CONFIG_COMPAT */
565#endif /* _LINUX_COMPAT_H */ 569#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index d64a55b23afd..4270bedd2308 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -54,18 +54,17 @@ extern struct dentry_stat_t dentry_stat;
54static inline int dentry_cmp(const unsigned char *cs, size_t scount, 54static inline int dentry_cmp(const unsigned char *cs, size_t scount,
55 const unsigned char *ct, size_t tcount) 55 const unsigned char *ct, size_t tcount)
56{ 56{
57 int ret;
58 if (scount != tcount) 57 if (scount != tcount)
59 return 1; 58 return 1;
59
60 do { 60 do {
61 ret = (*cs != *ct); 61 if (*cs != *ct)
62 if (ret) 62 return 1;
63 break;
64 cs++; 63 cs++;
65 ct++; 64 ct++;
66 tcount--; 65 tcount--;
67 } while (tcount); 66 } while (tcount);
68 return ret; 67 return 0;
69} 68}
70 69
71/* Name hashing routines. Initial hash value */ 70/* Name hashing routines. Initial hash value */
@@ -89,14 +88,7 @@ static inline unsigned long end_name_hash(unsigned long hash)
89} 88}
90 89
91/* Compute the hash for a name string. */ 90/* Compute the hash for a name string. */
92static inline unsigned int 91extern unsigned int full_name_hash(const unsigned char *, unsigned int);
93full_name_hash(const unsigned char *name, unsigned int len)
94{
95 unsigned long hash = init_name_hash();
96 while (len--)
97 hash = partial_name_hash(*name++, hash);
98 return end_name_hash(hash);
99}
100 92
101/* 93/*
102 * Try to keep struct dentry aligned on 64 byte cachelines (this will 94 * Try to keep struct dentry aligned on 64 byte cachelines (this will
@@ -309,7 +301,8 @@ extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
309extern struct dentry *d_lookup(struct dentry *, struct qstr *); 301extern struct dentry *d_lookup(struct dentry *, struct qstr *);
310extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); 302extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
311extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 303extern struct dentry *__d_lookup(struct dentry *, struct qstr *);
312extern struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, 304extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
305 const struct qstr *name,
313 unsigned *seq, struct inode **inode); 306 unsigned *seq, struct inode **inode);
314 307
315/** 308/**
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c52d4b5f872a..4b24ff453aee 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -137,6 +137,7 @@ enum {
137 IFLA_AF_SPEC, 137 IFLA_AF_SPEC,
138 IFLA_GROUP, /* Group the device belongs to */ 138 IFLA_GROUP, /* Group the device belongs to */
139 IFLA_NET_NS_FD, 139 IFLA_NET_NS_FD,
140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */
140 __IFLA_MAX 141 __IFLA_MAX
141}; 142};
142 143
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 8797ed16feb2..4dd5bd6994a8 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -285,8 +285,8 @@ struct ebt_table {
285 struct module *me; 285 struct module *me;
286}; 286};
287 287
288#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \ 288#define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \
289 ~(__alignof__(struct ebt_replace)-1)) 289 ~(__alignof__(struct _xt_align)-1))
290extern struct ebt_table *ebt_register_table(struct net *net, 290extern struct ebt_table *ebt_register_table(struct net *net,
291 const struct ebt_table *table); 291 const struct ebt_table *table);
292extern void ebt_unregister_table(struct net *net, struct ebt_table *table); 292extern void ebt_unregister_table(struct net *net, struct ebt_table *table);
diff --git a/include/linux/regset.h b/include/linux/regset.h
index 8abee6556223..686f37327a49 100644
--- a/include/linux/regset.h
+++ b/include/linux/regset.h
@@ -335,8 +335,11 @@ static inline int copy_regset_to_user(struct task_struct *target,
335{ 335{
336 const struct user_regset *regset = &view->regsets[setno]; 336 const struct user_regset *regset = &view->regsets[setno];
337 337
338 if (!regset->get)
339 return -EOPNOTSUPP;
340
338 if (!access_ok(VERIFY_WRITE, data, size)) 341 if (!access_ok(VERIFY_WRITE, data, size))
339 return -EIO; 342 return -EFAULT;
340 343
341 return regset->get(target, regset, offset, size, NULL, data); 344 return regset->get(target, regset, offset, size, NULL, data);
342} 345}
@@ -358,8 +361,11 @@ static inline int copy_regset_from_user(struct task_struct *target,
358{ 361{
359 const struct user_regset *regset = &view->regsets[setno]; 362 const struct user_regset *regset = &view->regsets[setno];
360 363
364 if (!regset->set)
365 return -EOPNOTSUPP;
366
361 if (!access_ok(VERIFY_READ, data, size)) 367 if (!access_ok(VERIFY_READ, data, size))
362 return -EIO; 368 return -EFAULT;
363 369
364 return regset->set(target, regset, offset, size, NULL, data); 370 return regset->set(target, regset, offset, size, NULL, data);
365} 371}
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 8e872ead88b5..577592ea0ea0 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -602,6 +602,9 @@ struct tcamsg {
602#define TCA_ACT_TAB 1 /* attr type must be >=1 */ 602#define TCA_ACT_TAB 1 /* attr type must be >=1 */
603#define TCAA_MAX 1 603#define TCAA_MAX 1
604 604
605/* New extended info filters for IFLA_EXT_MASK */
606#define RTEXT_FILTER_VF (1 << 0)
607
605/* End of information exported to user level */ 608/* End of information exported to user level */
606 609
607#ifdef __KERNEL__ 610#ifdef __KERNEL__
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 50db9b04a552..ae86adee3746 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1465,6 +1465,16 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1465} 1465}
1466#endif /* NET_SKBUFF_DATA_USES_OFFSET */ 1466#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1467 1467
1468static inline void skb_mac_header_rebuild(struct sk_buff *skb)
1469{
1470 if (skb_mac_header_was_set(skb)) {
1471 const unsigned char *old_mac = skb_mac_header(skb);
1472
1473 skb_set_mac_header(skb, -skb->mac_len);
1474 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
1475 }
1476}
1477
1468static inline int skb_checksum_start_offset(const struct sk_buff *skb) 1478static inline int skb_checksum_start_offset(const struct sk_buff *skb)
1469{ 1479{
1470 return skb->csum_start - skb_headroom(skb); 1480 return skb->csum_start - skb_headroom(skb);
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index abaad6ed9b83..4a82ca0bb0b2 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -256,4 +256,6 @@ void l2cap_exit(void);
256int sco_init(void); 256int sco_init(void);
257void sco_exit(void); 257void sco_exit(void);
258 258
259void bt_sock_reclassify_lock(struct sock *sk, int proto);
260
259#endif /* __BLUETOOTH_H */ 261#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index ea9231f4935f..453893b3120e 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -540,7 +540,7 @@ void hci_conn_put_device(struct hci_conn *conn);
540static inline void hci_conn_hold(struct hci_conn *conn) 540static inline void hci_conn_hold(struct hci_conn *conn)
541{ 541{
542 atomic_inc(&conn->refcnt); 542 atomic_inc(&conn->refcnt);
543 cancel_delayed_work_sync(&conn->disc_work); 543 cancel_delayed_work(&conn->disc_work);
544} 544}
545 545
546static inline void hci_conn_put(struct hci_conn *conn) 546static inline void hci_conn_put(struct hci_conn *conn)
@@ -559,9 +559,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
559 } else { 559 } else {
560 timeo = msecs_to_jiffies(10); 560 timeo = msecs_to_jiffies(10);
561 } 561 }
562 cancel_delayed_work_sync(&conn->disc_work); 562 cancel_delayed_work(&conn->disc_work);
563 queue_delayed_work(conn->hdev->workqueue, 563 queue_delayed_work(conn->hdev->workqueue,
564 &conn->disc_work, jiffies + timeo); 564 &conn->disc_work, timeo);
565 } 565 }
566} 566}
567 567
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 68f589150692..b1664ed884e6 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -611,7 +611,7 @@ static inline void l2cap_set_timer(struct l2cap_chan *chan,
611{ 611{
612 BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout); 612 BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout);
613 613
614 if (!__cancel_delayed_work(work)) 614 if (!cancel_delayed_work(work))
615 l2cap_chan_hold(chan); 615 l2cap_chan_hold(chan);
616 schedule_delayed_work(work, timeout); 616 schedule_delayed_work(work, timeout);
617} 617}
@@ -619,20 +619,20 @@ static inline void l2cap_set_timer(struct l2cap_chan *chan,
619static inline void l2cap_clear_timer(struct l2cap_chan *chan, 619static inline void l2cap_clear_timer(struct l2cap_chan *chan,
620 struct delayed_work *work) 620 struct delayed_work *work)
621{ 621{
622 if (__cancel_delayed_work(work)) 622 if (cancel_delayed_work(work))
623 l2cap_chan_put(chan); 623 l2cap_chan_put(chan);
624} 624}
625 625
626#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) 626#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
627#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) 627#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
628#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ 628#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \
629 L2CAP_DEFAULT_RETRANS_TO); 629 msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
630#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) 630#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer)
631#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ 631#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \
632 L2CAP_DEFAULT_MONITOR_TO); 632 msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
633#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) 633#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer)
634#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ 634#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \
635 L2CAP_DEFAULT_ACK_TO); 635 msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
636#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) 636#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
637 637
638static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) 638static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
@@ -834,7 +834,7 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
834struct l2cap_chan *l2cap_chan_create(struct sock *sk); 834struct l2cap_chan *l2cap_chan_create(struct sock *sk);
835void l2cap_chan_close(struct l2cap_chan *chan, int reason); 835void l2cap_chan_close(struct l2cap_chan *chan, int reason);
836void l2cap_chan_destroy(struct l2cap_chan *chan); 836void l2cap_chan_destroy(struct l2cap_chan *chan);
837inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 837int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
838 bdaddr_t *dst); 838 bdaddr_t *dst);
839int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 839int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
840 u32 priority); 840 u32 priority);
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 8a2b0ae7dbd2..ab86036bbf0c 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -209,7 +209,7 @@ extern struct nf_conntrack_tuple_hash *
209__nf_conntrack_find(struct net *net, u16 zone, 209__nf_conntrack_find(struct net *net, u16 zone,
210 const struct nf_conntrack_tuple *tuple); 210 const struct nf_conntrack_tuple *tuple);
211 211
212extern void nf_conntrack_hash_insert(struct nf_conn *ct); 212extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);
213extern void nf_ct_delete_from_lists(struct nf_conn *ct); 213extern void nf_ct_delete_from_lists(struct nf_conn *ct);
214extern void nf_ct_insert_dying_list(struct nf_conn *ct); 214extern void nf_ct_insert_dying_list(struct nf_conn *ct);
215 215
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 678f1ffaf843..370293901971 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -6,7 +6,7 @@
6 6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); 7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); 8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9typedef u16 (*rtnl_calcit_func)(struct sk_buff *); 9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
10 10
11extern int __rtnl_register(int protocol, int msgtype, 11extern int __rtnl_register(int protocol, int msgtype,
12 rtnl_doit_func, rtnl_dumpit_func, 12 rtnl_doit_func, rtnl_dumpit_func,
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 6ba596b07a72..e33ed1bfa113 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -370,56 +370,6 @@ TRACE_EVENT(sched_stat_runtime,
370 (unsigned long long)__entry->vruntime) 370 (unsigned long long)__entry->vruntime)
371); 371);
372 372
373#ifdef CREATE_TRACE_POINTS
374static inline u64 trace_get_sleeptime(struct task_struct *tsk)
375{
376#ifdef CONFIG_SCHEDSTATS
377 u64 block, sleep;
378
379 block = tsk->se.statistics.block_start;
380 sleep = tsk->se.statistics.sleep_start;
381 tsk->se.statistics.block_start = 0;
382 tsk->se.statistics.sleep_start = 0;
383
384 return block ? block : sleep ? sleep : 0;
385#else
386 return 0;
387#endif
388}
389#endif
390
391/*
392 * Tracepoint for accounting sleeptime (time the task is sleeping
393 * or waiting for I/O).
394 */
395TRACE_EVENT(sched_stat_sleeptime,
396
397 TP_PROTO(struct task_struct *tsk, u64 now),
398
399 TP_ARGS(tsk, now),
400
401 TP_STRUCT__entry(
402 __array( char, comm, TASK_COMM_LEN )
403 __field( pid_t, pid )
404 __field( u64, sleeptime )
405 ),
406
407 TP_fast_assign(
408 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
409 __entry->pid = tsk->pid;
410 __entry->sleeptime = trace_get_sleeptime(tsk);
411 __entry->sleeptime = __entry->sleeptime ?
412 now - __entry->sleeptime : 0;
413 )
414 TP_perf_assign(
415 __perf_count(__entry->sleeptime);
416 ),
417
418 TP_printk("comm=%s pid=%d sleeptime=%Lu [ns]",
419 __entry->comm, __entry->pid,
420 (unsigned long long)__entry->sleeptime)
421);
422
423/* 373/*
424 * Tracepoint for showing priority inheritance modifying a tasks 374 * Tracepoint for showing priority inheritance modifying a tasks
425 * priority. 375 * priority.
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index b7971d6f38bf..ee706ce44aa0 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -651,10 +651,10 @@ int __init init_hw_breakpoint(void)
651 651
652 err_alloc: 652 err_alloc:
653 for_each_possible_cpu(err_cpu) { 653 for_each_possible_cpu(err_cpu) {
654 if (err_cpu == cpu)
655 break;
656 for (i = 0; i < TYPE_MAX; i++) 654 for (i = 0; i < TYPE_MAX; i++)
657 kfree(per_cpu(nr_task_bp_pinned[i], cpu)); 655 kfree(per_cpu(nr_task_bp_pinned[i], cpu));
656 if (err_cpu == cpu)
657 break;
658 } 658 }
659 659
660 return -ENOMEM; 660 return -ENOMEM;
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index 342d8f44e401..0119b9d467ae 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -53,7 +53,7 @@ unsigned long probe_irq_on(void)
53 if (desc->irq_data.chip->irq_set_type) 53 if (desc->irq_data.chip->irq_set_type)
54 desc->irq_data.chip->irq_set_type(&desc->irq_data, 54 desc->irq_data.chip->irq_set_type(&desc->irq_data,
55 IRQ_TYPE_PROBE); 55 IRQ_TYPE_PROBE);
56 irq_startup(desc); 56 irq_startup(desc, false);
57 } 57 }
58 raw_spin_unlock_irq(&desc->lock); 58 raw_spin_unlock_irq(&desc->lock);
59 } 59 }
@@ -70,7 +70,7 @@ unsigned long probe_irq_on(void)
70 raw_spin_lock_irq(&desc->lock); 70 raw_spin_lock_irq(&desc->lock);
71 if (!desc->action && irq_settings_can_probe(desc)) { 71 if (!desc->action && irq_settings_can_probe(desc)) {
72 desc->istate |= IRQS_AUTODETECT | IRQS_WAITING; 72 desc->istate |= IRQS_AUTODETECT | IRQS_WAITING;
73 if (irq_startup(desc)) 73 if (irq_startup(desc, false))
74 desc->istate |= IRQS_PENDING; 74 desc->istate |= IRQS_PENDING;
75 } 75 }
76 raw_spin_unlock_irq(&desc->lock); 76 raw_spin_unlock_irq(&desc->lock);
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index f7c543a801d9..fb7db75ee0c8 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -157,19 +157,22 @@ static void irq_state_set_masked(struct irq_desc *desc)
157 irqd_set(&desc->irq_data, IRQD_IRQ_MASKED); 157 irqd_set(&desc->irq_data, IRQD_IRQ_MASKED);
158} 158}
159 159
160int irq_startup(struct irq_desc *desc) 160int irq_startup(struct irq_desc *desc, bool resend)
161{ 161{
162 int ret = 0;
163
162 irq_state_clr_disabled(desc); 164 irq_state_clr_disabled(desc);
163 desc->depth = 0; 165 desc->depth = 0;
164 166
165 if (desc->irq_data.chip->irq_startup) { 167 if (desc->irq_data.chip->irq_startup) {
166 int ret = desc->irq_data.chip->irq_startup(&desc->irq_data); 168 ret = desc->irq_data.chip->irq_startup(&desc->irq_data);
167 irq_state_clr_masked(desc); 169 irq_state_clr_masked(desc);
168 return ret; 170 } else {
171 irq_enable(desc);
169 } 172 }
170 173 if (resend)
171 irq_enable(desc); 174 check_irq_resend(desc, desc->irq_data.irq);
172 return 0; 175 return ret;
173} 176}
174 177
175void irq_shutdown(struct irq_desc *desc) 178void irq_shutdown(struct irq_desc *desc)
@@ -330,6 +333,24 @@ out_unlock:
330} 333}
331EXPORT_SYMBOL_GPL(handle_simple_irq); 334EXPORT_SYMBOL_GPL(handle_simple_irq);
332 335
336/*
337 * Called unconditionally from handle_level_irq() and only for oneshot
338 * interrupts from handle_fasteoi_irq()
339 */
340static void cond_unmask_irq(struct irq_desc *desc)
341{
342 /*
343 * We need to unmask in the following cases:
344 * - Standard level irq (IRQF_ONESHOT is not set)
345 * - Oneshot irq which did not wake the thread (caused by a
346 * spurious interrupt or a primary handler handling it
347 * completely).
348 */
349 if (!irqd_irq_disabled(&desc->irq_data) &&
350 irqd_irq_masked(&desc->irq_data) && !desc->threads_oneshot)
351 unmask_irq(desc);
352}
353
333/** 354/**
334 * handle_level_irq - Level type irq handler 355 * handle_level_irq - Level type irq handler
335 * @irq: the interrupt number 356 * @irq: the interrupt number
@@ -362,8 +383,8 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
362 383
363 handle_irq_event(desc); 384 handle_irq_event(desc);
364 385
365 if (!irqd_irq_disabled(&desc->irq_data) && !(desc->istate & IRQS_ONESHOT)) 386 cond_unmask_irq(desc);
366 unmask_irq(desc); 387
367out_unlock: 388out_unlock:
368 raw_spin_unlock(&desc->lock); 389 raw_spin_unlock(&desc->lock);
369} 390}
@@ -417,6 +438,9 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
417 preflow_handler(desc); 438 preflow_handler(desc);
418 handle_irq_event(desc); 439 handle_irq_event(desc);
419 440
441 if (desc->istate & IRQS_ONESHOT)
442 cond_unmask_irq(desc);
443
420out_eoi: 444out_eoi:
421 desc->irq_data.chip->irq_eoi(&desc->irq_data); 445 desc->irq_data.chip->irq_eoi(&desc->irq_data);
422out_unlock: 446out_unlock:
@@ -625,7 +649,7 @@ __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
625 irq_settings_set_noprobe(desc); 649 irq_settings_set_noprobe(desc);
626 irq_settings_set_norequest(desc); 650 irq_settings_set_norequest(desc);
627 irq_settings_set_nothread(desc); 651 irq_settings_set_nothread(desc);
628 irq_startup(desc); 652 irq_startup(desc, true);
629 } 653 }
630out: 654out:
631 irq_put_desc_busunlock(desc, flags); 655 irq_put_desc_busunlock(desc, flags);
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index b7952316016a..40378ff877e7 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -67,7 +67,7 @@ extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
67extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp); 67extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
68extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume); 68extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
69 69
70extern int irq_startup(struct irq_desc *desc); 70extern int irq_startup(struct irq_desc *desc, bool resend);
71extern void irq_shutdown(struct irq_desc *desc); 71extern void irq_shutdown(struct irq_desc *desc);
72extern void irq_enable(struct irq_desc *desc); 72extern void irq_enable(struct irq_desc *desc);
73extern void irq_disable(struct irq_desc *desc); 73extern void irq_disable(struct irq_desc *desc);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index a9a9dbe49fea..32313c084442 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1027,7 +1027,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
1027 desc->istate |= IRQS_ONESHOT; 1027 desc->istate |= IRQS_ONESHOT;
1028 1028
1029 if (irq_settings_can_autoenable(desc)) 1029 if (irq_settings_can_autoenable(desc))
1030 irq_startup(desc); 1030 irq_startup(desc, true);
1031 else 1031 else
1032 /* Undo nested disables: */ 1032 /* Undo nested disables: */
1033 desc->depth = 1; 1033 desc->depth = 1;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5255c9d2e053..33a0676ea744 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1932,7 +1932,6 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)
1932 local_irq_enable(); 1932 local_irq_enable();
1933#endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */ 1933#endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */
1934 finish_lock_switch(rq, prev); 1934 finish_lock_switch(rq, prev);
1935 trace_sched_stat_sleeptime(current, rq->clock);
1936 1935
1937 fire_sched_in_preempt_notifiers(current); 1936 fire_sched_in_preempt_notifiers(current);
1938 if (mm) 1937 if (mm)
@@ -6729,7 +6728,7 @@ int __init sched_create_sysfs_power_savings_entries(struct device *dev)
6729static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action, 6728static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
6730 void *hcpu) 6729 void *hcpu)
6731{ 6730{
6732 switch (action & ~CPU_TASKS_FROZEN) { 6731 switch (action) {
6733 case CPU_ONLINE: 6732 case CPU_ONLINE:
6734 case CPU_DOWN_FAILED: 6733 case CPU_DOWN_FAILED:
6735 cpuset_update_active_cpus(); 6734 cpuset_update_active_cpus();
@@ -6742,7 +6741,7 @@ static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
6742static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action, 6741static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
6743 void *hcpu) 6742 void *hcpu)
6744{ 6743{
6745 switch (action & ~CPU_TASKS_FROZEN) { 6744 switch (action) {
6746 case CPU_DOWN_PREPARE: 6745 case CPU_DOWN_PREPARE:
6747 cpuset_update_active_cpus(); 6746 cpuset_update_active_cpus();
6748 return NOTIFY_OK; 6747 return NOTIFY_OK;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7c6414fc669d..aca16b843b7e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1003,6 +1003,7 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
1003 if (unlikely(delta > se->statistics.sleep_max)) 1003 if (unlikely(delta > se->statistics.sleep_max))
1004 se->statistics.sleep_max = delta; 1004 se->statistics.sleep_max = delta;
1005 1005
1006 se->statistics.sleep_start = 0;
1006 se->statistics.sum_sleep_runtime += delta; 1007 se->statistics.sum_sleep_runtime += delta;
1007 1008
1008 if (tsk) { 1009 if (tsk) {
@@ -1019,6 +1020,7 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
1019 if (unlikely(delta > se->statistics.block_max)) 1020 if (unlikely(delta > se->statistics.block_max))
1020 se->statistics.block_max = delta; 1021 se->statistics.block_max = delta;
1021 1022
1023 se->statistics.block_start = 0;
1022 se->statistics.sum_sleep_runtime += delta; 1024 se->statistics.sum_sleep_runtime += delta;
1023 1025
1024 if (tsk) { 1026 if (tsk) {
diff --git a/mm/memblock.c b/mm/memblock.c
index 77b5f227e1d8..99f285599501 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -99,9 +99,6 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start,
99 phys_addr_t this_start, this_end, cand; 99 phys_addr_t this_start, this_end, cand;
100 u64 i; 100 u64 i;
101 101
102 /* align @size to avoid excessive fragmentation on reserved array */
103 size = round_up(size, align);
104
105 /* pump up @end */ 102 /* pump up @end */
106 if (end == MEMBLOCK_ALLOC_ACCESSIBLE) 103 if (end == MEMBLOCK_ALLOC_ACCESSIBLE)
107 end = memblock.current_limit; 104 end = memblock.current_limit;
@@ -731,6 +728,9 @@ static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
731{ 728{
732 phys_addr_t found; 729 phys_addr_t found;
733 730
731 /* align @size to avoid excessive fragmentation on reserved array */
732 size = round_up(size, align);
733
734 found = memblock_find_in_range_node(0, max_addr, size, align, nid); 734 found = memblock_find_in_range_node(0, max_addr, size, align, nid);
735 if (found && !memblock_reserve(found, size)) 735 if (found && !memblock_reserve(found, size))
736 return found; 736 return found;
diff --git a/net/atm/clip.c b/net/atm/clip.c
index c12c2582457c..127fe70a1baa 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -46,8 +46,8 @@
46 46
47static struct net_device *clip_devs; 47static struct net_device *clip_devs;
48static struct atm_vcc *atmarpd; 48static struct atm_vcc *atmarpd;
49static struct neigh_table clip_tbl;
50static struct timer_list idle_timer; 49static struct timer_list idle_timer;
50static const struct neigh_ops clip_neigh_ops;
51 51
52static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip) 52static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip)
53{ 53{
@@ -123,6 +123,8 @@ static int neigh_check_cb(struct neighbour *n)
123 struct atmarp_entry *entry = neighbour_priv(n); 123 struct atmarp_entry *entry = neighbour_priv(n);
124 struct clip_vcc *cv; 124 struct clip_vcc *cv;
125 125
126 if (n->ops != &clip_neigh_ops)
127 return 0;
126 for (cv = entry->vccs; cv; cv = cv->next) { 128 for (cv = entry->vccs; cv; cv = cv->next) {
127 unsigned long exp = cv->last_use + cv->idle_timeout; 129 unsigned long exp = cv->last_use + cv->idle_timeout;
128 130
@@ -154,10 +156,10 @@ static int neigh_check_cb(struct neighbour *n)
154 156
155static void idle_timer_check(unsigned long dummy) 157static void idle_timer_check(unsigned long dummy)
156{ 158{
157 write_lock(&clip_tbl.lock); 159 write_lock(&arp_tbl.lock);
158 __neigh_for_each_release(&clip_tbl, neigh_check_cb); 160 __neigh_for_each_release(&arp_tbl, neigh_check_cb);
159 mod_timer(&idle_timer, jiffies + CLIP_CHECK_INTERVAL * HZ); 161 mod_timer(&idle_timer, jiffies + CLIP_CHECK_INTERVAL * HZ);
160 write_unlock(&clip_tbl.lock); 162 write_unlock(&arp_tbl.lock);
161} 163}
162 164
163static int clip_arp_rcv(struct sk_buff *skb) 165static int clip_arp_rcv(struct sk_buff *skb)
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index ef92864ac625..72eb187a5f60 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -71,19 +71,16 @@ static const char *const bt_slock_key_strings[BT_MAX_PROTO] = {
71 "slock-AF_BLUETOOTH-BTPROTO_AVDTP", 71 "slock-AF_BLUETOOTH-BTPROTO_AVDTP",
72}; 72};
73 73
74static inline void bt_sock_reclassify_lock(struct socket *sock, int proto) 74void bt_sock_reclassify_lock(struct sock *sk, int proto)
75{ 75{
76 struct sock *sk = sock->sk; 76 BUG_ON(!sk);
77
78 if (!sk)
79 return;
80
81 BUG_ON(sock_owned_by_user(sk)); 77 BUG_ON(sock_owned_by_user(sk));
82 78
83 sock_lock_init_class_and_name(sk, 79 sock_lock_init_class_and_name(sk,
84 bt_slock_key_strings[proto], &bt_slock_key[proto], 80 bt_slock_key_strings[proto], &bt_slock_key[proto],
85 bt_key_strings[proto], &bt_lock_key[proto]); 81 bt_key_strings[proto], &bt_lock_key[proto]);
86} 82}
83EXPORT_SYMBOL(bt_sock_reclassify_lock);
87 84
88int bt_sock_register(int proto, const struct net_proto_family *ops) 85int bt_sock_register(int proto, const struct net_proto_family *ops)
89{ 86{
@@ -145,7 +142,8 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto,
145 142
146 if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { 143 if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
147 err = bt_proto[proto]->create(net, sock, proto, kern); 144 err = bt_proto[proto]->create(net, sock, proto, kern);
148 bt_sock_reclassify_lock(sock, proto); 145 if (!err)
146 bt_sock_reclassify_lock(sock->sk, proto);
149 module_put(bt_proto[proto]->owner); 147 module_put(bt_proto[proto]->owner);
150 } 148 }
151 149
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 3db432473ad5..07bc69ed9498 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -635,6 +635,10 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
635 635
636 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { 636 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) {
637 struct hci_cp_auth_requested cp; 637 struct hci_cp_auth_requested cp;
638
639 /* encrypt must be pending if auth is also pending */
640 set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend);
641
638 cp.handle = cpu_to_le16(conn->handle); 642 cp.handle = cpu_to_le16(conn->handle);
639 hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, 643 hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED,
640 sizeof(cp), &cp); 644 sizeof(cp), &cp);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9de93714213a..5aeb62491198 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -640,7 +640,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
640 /* Reset device */ 640 /* Reset device */
641 skb_queue_purge(&hdev->cmd_q); 641 skb_queue_purge(&hdev->cmd_q);
642 atomic_set(&hdev->cmd_cnt, 1); 642 atomic_set(&hdev->cmd_cnt, 1);
643 if (!test_bit(HCI_RAW, &hdev->flags)) { 643 if (!test_bit(HCI_RAW, &hdev->flags) &&
644 test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
644 set_bit(HCI_INIT, &hdev->flags); 645 set_bit(HCI_INIT, &hdev->flags);
645 __hci_request(hdev, hci_reset_req, 0, 646 __hci_request(hdev, hci_reset_req, 0,
646 msecs_to_jiffies(250)); 647 msecs_to_jiffies(250));
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index faf0b11ac1d3..32d338c30e65 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1018,10 +1018,10 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
1018 hci_chan_del(conn->hchan); 1018 hci_chan_del(conn->hchan);
1019 1019
1020 if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) 1020 if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT)
1021 __cancel_delayed_work(&conn->info_timer); 1021 cancel_delayed_work_sync(&conn->info_timer);
1022 1022
1023 if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) { 1023 if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) {
1024 __cancel_delayed_work(&conn->security_timer); 1024 cancel_delayed_work_sync(&conn->security_timer);
1025 smp_chan_destroy(conn); 1025 smp_chan_destroy(conn);
1026 } 1026 }
1027 1027
@@ -1120,7 +1120,7 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm, bdaddr
1120 return c1; 1120 return c1;
1121} 1121}
1122 1122
1123inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, bdaddr_t *dst) 1123int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, bdaddr_t *dst)
1124{ 1124{
1125 struct sock *sk = chan->sk; 1125 struct sock *sk = chan->sk;
1126 bdaddr_t *src = &bt_sk(sk)->src; 1126 bdaddr_t *src = &bt_sk(sk)->src;
@@ -2574,7 +2574,7 @@ static inline int l2cap_command_rej(struct l2cap_conn *conn, struct l2cap_cmd_hd
2574 2574
2575 if ((conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) && 2575 if ((conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) &&
2576 cmd->ident == conn->info_ident) { 2576 cmd->ident == conn->info_ident) {
2577 __cancel_delayed_work(&conn->info_timer); 2577 cancel_delayed_work(&conn->info_timer);
2578 2578
2579 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE; 2579 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE;
2580 conn->info_ident = 0; 2580 conn->info_ident = 0;
@@ -2970,7 +2970,8 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
2970 2970
2971 default: 2971 default:
2972 sk->sk_err = ECONNRESET; 2972 sk->sk_err = ECONNRESET;
2973 __set_chan_timer(chan, L2CAP_DISC_REJ_TIMEOUT); 2973 __set_chan_timer(chan,
2974 msecs_to_jiffies(L2CAP_DISC_REJ_TIMEOUT));
2974 l2cap_send_disconn_req(conn, chan, ECONNRESET); 2975 l2cap_send_disconn_req(conn, chan, ECONNRESET);
2975 goto done; 2976 goto done;
2976 } 2977 }
@@ -3120,7 +3121,7 @@ static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cm
3120 conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE) 3121 conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE)
3121 return 0; 3122 return 0;
3122 3123
3123 __cancel_delayed_work(&conn->info_timer); 3124 cancel_delayed_work(&conn->info_timer);
3124 3125
3125 if (result != L2CAP_IR_SUCCESS) { 3126 if (result != L2CAP_IR_SUCCESS) {
3126 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE; 3127 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE;
@@ -4478,7 +4479,8 @@ static inline void l2cap_check_encryption(struct l2cap_chan *chan, u8 encrypt)
4478 if (encrypt == 0x00) { 4479 if (encrypt == 0x00) {
4479 if (chan->sec_level == BT_SECURITY_MEDIUM) { 4480 if (chan->sec_level == BT_SECURITY_MEDIUM) {
4480 __clear_chan_timer(chan); 4481 __clear_chan_timer(chan);
4481 __set_chan_timer(chan, L2CAP_ENC_TIMEOUT); 4482 __set_chan_timer(chan,
4483 msecs_to_jiffies(L2CAP_ENC_TIMEOUT));
4482 } else if (chan->sec_level == BT_SECURITY_HIGH) 4484 } else if (chan->sec_level == BT_SECURITY_HIGH)
4483 l2cap_chan_close(chan, ECONNREFUSED); 4485 l2cap_chan_close(chan, ECONNREFUSED);
4484 } else { 4486 } else {
@@ -4499,7 +4501,7 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4499 4501
4500 if (hcon->type == LE_LINK) { 4502 if (hcon->type == LE_LINK) {
4501 smp_distribute_keys(conn, 0); 4503 smp_distribute_keys(conn, 0);
4502 __cancel_delayed_work(&conn->security_timer); 4504 cancel_delayed_work(&conn->security_timer);
4503 } 4505 }
4504 4506
4505 rcu_read_lock(); 4507 rcu_read_lock();
@@ -4546,7 +4548,8 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4546 L2CAP_CONN_REQ, sizeof(req), &req); 4548 L2CAP_CONN_REQ, sizeof(req), &req);
4547 } else { 4549 } else {
4548 __clear_chan_timer(chan); 4550 __clear_chan_timer(chan);
4549 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); 4551 __set_chan_timer(chan,
4552 msecs_to_jiffies(L2CAP_DISC_TIMEOUT));
4550 } 4553 }
4551 } else if (chan->state == BT_CONNECT2) { 4554 } else if (chan->state == BT_CONNECT2) {
4552 struct l2cap_conn_rsp rsp; 4555 struct l2cap_conn_rsp rsp;
@@ -4566,7 +4569,8 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4566 } 4569 }
4567 } else { 4570 } else {
4568 l2cap_state_change(chan, BT_DISCONN); 4571 l2cap_state_change(chan, BT_DISCONN);
4569 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); 4572 __set_chan_timer(chan,
4573 msecs_to_jiffies(L2CAP_DISC_TIMEOUT));
4570 res = L2CAP_CR_SEC_BLOCK; 4574 res = L2CAP_CR_SEC_BLOCK;
4571 stat = L2CAP_CS_NO_INFO; 4575 stat = L2CAP_CS_NO_INFO;
4572 } 4576 }
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index c61d967012b2..401d9428ae4c 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -849,6 +849,8 @@ static struct l2cap_chan *l2cap_sock_new_connection_cb(void *data)
849 if (!sk) 849 if (!sk)
850 return NULL; 850 return NULL;
851 851
852 bt_sock_reclassify_lock(sk, BTPROTO_L2CAP);
853
852 l2cap_sock_init(sk, parent); 854 l2cap_sock_init(sk, parent);
853 855
854 return l2cap_pi(sk)->chan; 856 return l2cap_pi(sk)->chan;
@@ -1002,7 +1004,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int p
1002 INIT_LIST_HEAD(&bt_sk(sk)->accept_q); 1004 INIT_LIST_HEAD(&bt_sk(sk)->accept_q);
1003 1005
1004 sk->sk_destruct = l2cap_sock_destruct; 1006 sk->sk_destruct = l2cap_sock_destruct;
1005 sk->sk_sndtimeo = L2CAP_CONN_TIMEOUT; 1007 sk->sk_sndtimeo = msecs_to_jiffies(L2CAP_CONN_TIMEOUT);
1006 1008
1007 sock_reset_flag(sk, SOCK_ZAPPED); 1009 sock_reset_flag(sk, SOCK_ZAPPED);
1008 1010
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 501649bf5596..8a602388f1e7 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -1164,12 +1164,18 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci)
1164 break; 1164 break;
1165 1165
1166 case BT_DISCONN: 1166 case BT_DISCONN:
1167 /* When socket is closed and we are not RFCOMM 1167 /* rfcomm_session_put is called later so don't do
1168 * initiator rfcomm_process_rx already calls 1168 * anything here otherwise we will mess up the session
1169 * rfcomm_session_put() */ 1169 * reference counter:
1170 if (s->sock->sk->sk_state != BT_CLOSED) 1170 *
1171 if (list_empty(&s->dlcs)) 1171 * (a) when we are the initiator dlc_unlink will drive
1172 rfcomm_session_put(s); 1172 * the reference counter to 0 (there is no initial put
1173 * after session_add)
1174 *
1175 * (b) when we are not the initiator rfcomm_rx_process
1176 * will explicitly call put to balance the initial hold
1177 * done after session add.
1178 */
1173 break; 1179 break;
1174 } 1180 }
1175 } 1181 }
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index f066678faeee..22169c3f1482 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -956,6 +956,8 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc *
956 if (!sk) 956 if (!sk)
957 goto done; 957 goto done;
958 958
959 bt_sock_reclassify_lock(sk, BTPROTO_RFCOMM);
960
959 rfcomm_sock_init(sk, parent); 961 rfcomm_sock_init(sk, parent);
960 bacpy(&bt_sk(sk)->src, &src); 962 bacpy(&bt_sk(sk)->src, &src);
961 bacpy(&bt_sk(sk)->dst, &dst); 963 bacpy(&bt_sk(sk)->dst, &dst);
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index e287346e0934..2a83914b0277 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -826,6 +826,8 @@ next_elt:
826 write_unlock_bh(&tbl->lock); 826 write_unlock_bh(&tbl->lock);
827 cond_resched(); 827 cond_resched();
828 write_lock_bh(&tbl->lock); 828 write_lock_bh(&tbl->lock);
829 nht = rcu_dereference_protected(tbl->nht,
830 lockdep_is_held(&tbl->lock));
829 } 831 }
830 /* Cycle through all hash buckets every base_reachable_time/2 ticks. 832 /* Cycle through all hash buckets every base_reachable_time/2 ticks.
831 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2 833 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 65aebd450027..606a6e8f3671 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -60,7 +60,6 @@ struct rtnl_link {
60}; 60};
61 61
62static DEFINE_MUTEX(rtnl_mutex); 62static DEFINE_MUTEX(rtnl_mutex);
63static u16 min_ifinfo_dump_size;
64 63
65void rtnl_lock(void) 64void rtnl_lock(void)
66{ 65{
@@ -724,10 +723,11 @@ static void copy_rtnl_link_stats64(void *v, const struct rtnl_link_stats64 *b)
724} 723}
725 724
726/* All VF info */ 725/* All VF info */
727static inline int rtnl_vfinfo_size(const struct net_device *dev) 726static inline int rtnl_vfinfo_size(const struct net_device *dev,
727 u32 ext_filter_mask)
728{ 728{
729 if (dev->dev.parent && dev_is_pci(dev->dev.parent)) { 729 if (dev->dev.parent && dev_is_pci(dev->dev.parent) &&
730 730 (ext_filter_mask & RTEXT_FILTER_VF)) {
731 int num_vfs = dev_num_vf(dev->dev.parent); 731 int num_vfs = dev_num_vf(dev->dev.parent);
732 size_t size = nla_total_size(sizeof(struct nlattr)); 732 size_t size = nla_total_size(sizeof(struct nlattr));
733 size += nla_total_size(num_vfs * sizeof(struct nlattr)); 733 size += nla_total_size(num_vfs * sizeof(struct nlattr));
@@ -766,7 +766,8 @@ static size_t rtnl_port_size(const struct net_device *dev)
766 return port_self_size; 766 return port_self_size;
767} 767}
768 768
769static noinline size_t if_nlmsg_size(const struct net_device *dev) 769static noinline size_t if_nlmsg_size(const struct net_device *dev,
770 u32 ext_filter_mask)
770{ 771{
771 return NLMSG_ALIGN(sizeof(struct ifinfomsg)) 772 return NLMSG_ALIGN(sizeof(struct ifinfomsg))
772 + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ 773 + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */
@@ -784,8 +785,9 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev)
784 + nla_total_size(4) /* IFLA_MASTER */ 785 + nla_total_size(4) /* IFLA_MASTER */
785 + nla_total_size(1) /* IFLA_OPERSTATE */ 786 + nla_total_size(1) /* IFLA_OPERSTATE */
786 + nla_total_size(1) /* IFLA_LINKMODE */ 787 + nla_total_size(1) /* IFLA_LINKMODE */
787 + nla_total_size(4) /* IFLA_NUM_VF */ 788 + nla_total_size(ext_filter_mask
788 + rtnl_vfinfo_size(dev) /* IFLA_VFINFO_LIST */ 789 & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */
790 + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */
789 + rtnl_port_size(dev) /* IFLA_VF_PORTS + IFLA_PORT_SELF */ 791 + rtnl_port_size(dev) /* IFLA_VF_PORTS + IFLA_PORT_SELF */
790 + rtnl_link_get_size(dev) /* IFLA_LINKINFO */ 792 + rtnl_link_get_size(dev) /* IFLA_LINKINFO */
791 + rtnl_link_get_af_size(dev); /* IFLA_AF_SPEC */ 793 + rtnl_link_get_af_size(dev); /* IFLA_AF_SPEC */
@@ -868,7 +870,7 @@ static int rtnl_port_fill(struct sk_buff *skb, struct net_device *dev)
868 870
869static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, 871static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
870 int type, u32 pid, u32 seq, u32 change, 872 int type, u32 pid, u32 seq, u32 change,
871 unsigned int flags) 873 unsigned int flags, u32 ext_filter_mask)
872{ 874{
873 struct ifinfomsg *ifm; 875 struct ifinfomsg *ifm;
874 struct nlmsghdr *nlh; 876 struct nlmsghdr *nlh;
@@ -941,10 +943,11 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
941 goto nla_put_failure; 943 goto nla_put_failure;
942 copy_rtnl_link_stats64(nla_data(attr), stats); 944 copy_rtnl_link_stats64(nla_data(attr), stats);
943 945
944 if (dev->dev.parent) 946 if (dev->dev.parent && (ext_filter_mask & RTEXT_FILTER_VF))
945 NLA_PUT_U32(skb, IFLA_NUM_VF, dev_num_vf(dev->dev.parent)); 947 NLA_PUT_U32(skb, IFLA_NUM_VF, dev_num_vf(dev->dev.parent));
946 948
947 if (dev->netdev_ops->ndo_get_vf_config && dev->dev.parent) { 949 if (dev->netdev_ops->ndo_get_vf_config && dev->dev.parent
950 && (ext_filter_mask & RTEXT_FILTER_VF)) {
948 int i; 951 int i;
949 952
950 struct nlattr *vfinfo, *vf; 953 struct nlattr *vfinfo, *vf;
@@ -1048,6 +1051,8 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
1048 struct net_device *dev; 1051 struct net_device *dev;
1049 struct hlist_head *head; 1052 struct hlist_head *head;
1050 struct hlist_node *node; 1053 struct hlist_node *node;
1054 struct nlattr *tb[IFLA_MAX+1];
1055 u32 ext_filter_mask = 0;
1051 1056
1052 s_h = cb->args[0]; 1057 s_h = cb->args[0];
1053 s_idx = cb->args[1]; 1058 s_idx = cb->args[1];
@@ -1055,6 +1060,12 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
1055 rcu_read_lock(); 1060 rcu_read_lock();
1056 cb->seq = net->dev_base_seq; 1061 cb->seq = net->dev_base_seq;
1057 1062
1063 nlmsg_parse(cb->nlh, sizeof(struct rtgenmsg), tb, IFLA_MAX,
1064 ifla_policy);
1065
1066 if (tb[IFLA_EXT_MASK])
1067 ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]);
1068
1058 for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { 1069 for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) {
1059 idx = 0; 1070 idx = 0;
1060 head = &net->dev_index_head[h]; 1071 head = &net->dev_index_head[h];
@@ -1064,7 +1075,8 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
1064 if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK, 1075 if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
1065 NETLINK_CB(cb->skb).pid, 1076 NETLINK_CB(cb->skb).pid,
1066 cb->nlh->nlmsg_seq, 0, 1077 cb->nlh->nlmsg_seq, 0,
1067 NLM_F_MULTI) <= 0) 1078 NLM_F_MULTI,
1079 ext_filter_mask) <= 0)
1068 goto out; 1080 goto out;
1069 1081
1070 nl_dump_check_consistent(cb, nlmsg_hdr(skb)); 1082 nl_dump_check_consistent(cb, nlmsg_hdr(skb));
@@ -1100,6 +1112,7 @@ const struct nla_policy ifla_policy[IFLA_MAX+1] = {
1100 [IFLA_VF_PORTS] = { .type = NLA_NESTED }, 1112 [IFLA_VF_PORTS] = { .type = NLA_NESTED },
1101 [IFLA_PORT_SELF] = { .type = NLA_NESTED }, 1113 [IFLA_PORT_SELF] = { .type = NLA_NESTED },
1102 [IFLA_AF_SPEC] = { .type = NLA_NESTED }, 1114 [IFLA_AF_SPEC] = { .type = NLA_NESTED },
1115 [IFLA_EXT_MASK] = { .type = NLA_U32 },
1103}; 1116};
1104EXPORT_SYMBOL(ifla_policy); 1117EXPORT_SYMBOL(ifla_policy);
1105 1118
@@ -1509,8 +1522,6 @@ errout:
1509 1522
1510 if (send_addr_notify) 1523 if (send_addr_notify)
1511 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); 1524 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
1512 min_ifinfo_dump_size = max_t(u16, if_nlmsg_size(dev),
1513 min_ifinfo_dump_size);
1514 1525
1515 return err; 1526 return err;
1516} 1527}
@@ -1842,6 +1853,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1842 struct net_device *dev = NULL; 1853 struct net_device *dev = NULL;
1843 struct sk_buff *nskb; 1854 struct sk_buff *nskb;
1844 int err; 1855 int err;
1856 u32 ext_filter_mask = 0;
1845 1857
1846 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); 1858 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
1847 if (err < 0) 1859 if (err < 0)
@@ -1850,6 +1862,9 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1850 if (tb[IFLA_IFNAME]) 1862 if (tb[IFLA_IFNAME])
1851 nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ); 1863 nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
1852 1864
1865 if (tb[IFLA_EXT_MASK])
1866 ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]);
1867
1853 ifm = nlmsg_data(nlh); 1868 ifm = nlmsg_data(nlh);
1854 if (ifm->ifi_index > 0) 1869 if (ifm->ifi_index > 0)
1855 dev = __dev_get_by_index(net, ifm->ifi_index); 1870 dev = __dev_get_by_index(net, ifm->ifi_index);
@@ -1861,12 +1876,12 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1861 if (dev == NULL) 1876 if (dev == NULL)
1862 return -ENODEV; 1877 return -ENODEV;
1863 1878
1864 nskb = nlmsg_new(if_nlmsg_size(dev), GFP_KERNEL); 1879 nskb = nlmsg_new(if_nlmsg_size(dev, ext_filter_mask), GFP_KERNEL);
1865 if (nskb == NULL) 1880 if (nskb == NULL)
1866 return -ENOBUFS; 1881 return -ENOBUFS;
1867 1882
1868 err = rtnl_fill_ifinfo(nskb, dev, RTM_NEWLINK, NETLINK_CB(skb).pid, 1883 err = rtnl_fill_ifinfo(nskb, dev, RTM_NEWLINK, NETLINK_CB(skb).pid,
1869 nlh->nlmsg_seq, 0, 0); 1884 nlh->nlmsg_seq, 0, 0, ext_filter_mask);
1870 if (err < 0) { 1885 if (err < 0) {
1871 /* -EMSGSIZE implies BUG in if_nlmsg_size */ 1886 /* -EMSGSIZE implies BUG in if_nlmsg_size */
1872 WARN_ON(err == -EMSGSIZE); 1887 WARN_ON(err == -EMSGSIZE);
@@ -1877,8 +1892,31 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1877 return err; 1892 return err;
1878} 1893}
1879 1894
1880static u16 rtnl_calcit(struct sk_buff *skb) 1895static u16 rtnl_calcit(struct sk_buff *skb, struct nlmsghdr *nlh)
1881{ 1896{
1897 struct net *net = sock_net(skb->sk);
1898 struct net_device *dev;
1899 struct nlattr *tb[IFLA_MAX+1];
1900 u32 ext_filter_mask = 0;
1901 u16 min_ifinfo_dump_size = 0;
1902
1903 nlmsg_parse(nlh, sizeof(struct rtgenmsg), tb, IFLA_MAX, ifla_policy);
1904
1905 if (tb[IFLA_EXT_MASK])
1906 ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]);
1907
1908 if (!ext_filter_mask)
1909 return NLMSG_GOODSIZE;
1910 /*
1911 * traverse the list of net devices and compute the minimum
1912 * buffer size based upon the filter mask.
1913 */
1914 list_for_each_entry(dev, &net->dev_base_head, dev_list) {
1915 min_ifinfo_dump_size = max_t(u16, min_ifinfo_dump_size,
1916 if_nlmsg_size(dev,
1917 ext_filter_mask));
1918 }
1919
1882 return min_ifinfo_dump_size; 1920 return min_ifinfo_dump_size;
1883} 1921}
1884 1922
@@ -1913,13 +1951,11 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
1913 int err = -ENOBUFS; 1951 int err = -ENOBUFS;
1914 size_t if_info_size; 1952 size_t if_info_size;
1915 1953
1916 skb = nlmsg_new((if_info_size = if_nlmsg_size(dev)), GFP_KERNEL); 1954 skb = nlmsg_new((if_info_size = if_nlmsg_size(dev, 0)), GFP_KERNEL);
1917 if (skb == NULL) 1955 if (skb == NULL)
1918 goto errout; 1956 goto errout;
1919 1957
1920 min_ifinfo_dump_size = max_t(u16, if_info_size, min_ifinfo_dump_size); 1958 err = rtnl_fill_ifinfo(skb, dev, type, 0, 0, change, 0, 0);
1921
1922 err = rtnl_fill_ifinfo(skb, dev, type, 0, 0, change, 0);
1923 if (err < 0) { 1959 if (err < 0) {
1924 /* -EMSGSIZE implies BUG in if_nlmsg_size() */ 1960 /* -EMSGSIZE implies BUG in if_nlmsg_size() */
1925 WARN_ON(err == -EMSGSIZE); 1961 WARN_ON(err == -EMSGSIZE);
@@ -1977,7 +2013,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1977 return -EOPNOTSUPP; 2013 return -EOPNOTSUPP;
1978 calcit = rtnl_get_calcit(family, type); 2014 calcit = rtnl_get_calcit(family, type);
1979 if (calcit) 2015 if (calcit)
1980 min_dump_alloc = calcit(skb); 2016 min_dump_alloc = calcit(skb, nlh);
1981 2017
1982 __rtnl_unlock(); 2018 __rtnl_unlock();
1983 rtnl = net->rtnl; 2019 rtnl = net->rtnl;
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 6b3ca5ba4450..38673d2860e2 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -65,7 +65,7 @@
65 it is infeasible task. The most general solutions would be 65 it is infeasible task. The most general solutions would be
66 to keep skb->encapsulation counter (sort of local ttl), 66 to keep skb->encapsulation counter (sort of local ttl),
67 and silently drop packet when it expires. It is a good 67 and silently drop packet when it expires. It is a good
68 solution, but it supposes maintaing new variable in ALL 68 solution, but it supposes maintaining new variable in ALL
69 skb, even if no tunneling is used. 69 skb, even if no tunneling is used.
70 70
71 Current solution: xmit_recursion breaks dead loops. This is a percpu 71 Current solution: xmit_recursion breaks dead loops. This is a percpu
@@ -91,14 +91,14 @@
91 91
92 One of them is to parse packet trying to detect inner encapsulation 92 One of them is to parse packet trying to detect inner encapsulation
93 made by our node. It is difficult or even impossible, especially, 93 made by our node. It is difficult or even impossible, especially,
94 taking into account fragmentation. TO be short, tt is not solution at all. 94 taking into account fragmentation. TO be short, ttl is not solution at all.
95 95
96 Current solution: The solution was UNEXPECTEDLY SIMPLE. 96 Current solution: The solution was UNEXPECTEDLY SIMPLE.
97 We force DF flag on tunnels with preconfigured hop limit, 97 We force DF flag on tunnels with preconfigured hop limit,
98 that is ALL. :-) Well, it does not remove the problem completely, 98 that is ALL. :-) Well, it does not remove the problem completely,
99 but exponential growth of network traffic is changed to linear 99 but exponential growth of network traffic is changed to linear
100 (branches, that exceed pmtu are pruned) and tunnel mtu 100 (branches, that exceed pmtu are pruned) and tunnel mtu
101 fastly degrades to value <68, where looping stops. 101 rapidly degrades to value <68, where looping stops.
102 Yes, it is not good if there exists a router in the loop, 102 Yes, it is not good if there exists a router in the loop,
103 which does not force DF, even when encapsulating packets have DF set. 103 which does not force DF, even when encapsulating packets have DF set.
104 But it is not our problem! Nobody could accuse us, we made 104 But it is not our problem! Nobody could accuse us, we made
@@ -457,8 +457,8 @@ static void ipgre_err(struct sk_buff *skb, u32 info)
457 GRE tunnels with enabled checksum. Tell them "thank you". 457 GRE tunnels with enabled checksum. Tell them "thank you".
458 458
459 Well, I wonder, rfc1812 was written by Cisco employee, 459 Well, I wonder, rfc1812 was written by Cisco employee,
460 what the hell these idiots break standrads established 460 what the hell these idiots break standards established
461 by themself??? 461 by themselves???
462 */ 462 */
463 463
464 const struct iphdr *iph = (const struct iphdr *)skb->data; 464 const struct iphdr *iph = (const struct iphdr *)skb->data;
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index aea5a199c37a..b072386cee21 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -630,6 +630,7 @@ static int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
630 630
631 pr_debug("ping_recvmsg(sk=%p,sk->num=%u)\n", isk, isk->inet_num); 631 pr_debug("ping_recvmsg(sk=%p,sk->num=%u)\n", isk, isk->inet_num);
632 632
633 err = -EOPNOTSUPP;
633 if (flags & MSG_OOB) 634 if (flags & MSG_OOB)
634 goto out; 635 goto out;
635 636
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c
index 63418185f524..e3db3f915114 100644
--- a/net/ipv4/xfrm4_mode_beet.c
+++ b/net/ipv4/xfrm4_mode_beet.c
@@ -110,10 +110,7 @@ static int xfrm4_beet_input(struct xfrm_state *x, struct sk_buff *skb)
110 110
111 skb_push(skb, sizeof(*iph)); 111 skb_push(skb, sizeof(*iph));
112 skb_reset_network_header(skb); 112 skb_reset_network_header(skb);
113 113 skb_mac_header_rebuild(skb);
114 memmove(skb->data - skb->mac_len, skb_mac_header(skb),
115 skb->mac_len);
116 skb_set_mac_header(skb, -skb->mac_len);
117 114
118 xfrm4_beet_make_header(skb); 115 xfrm4_beet_make_header(skb);
119 116
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index 534972e114ac..ed4bf11ef9f4 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -66,7 +66,6 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
66 66
67static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) 67static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
68{ 68{
69 const unsigned char *old_mac;
70 int err = -EINVAL; 69 int err = -EINVAL;
71 70
72 if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPIP) 71 if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPIP)
@@ -84,10 +83,9 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
84 if (!(x->props.flags & XFRM_STATE_NOECN)) 83 if (!(x->props.flags & XFRM_STATE_NOECN))
85 ipip_ecn_decapsulate(skb); 84 ipip_ecn_decapsulate(skb);
86 85
87 old_mac = skb_mac_header(skb);
88 skb_set_mac_header(skb, -skb->mac_len);
89 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
90 skb_reset_network_header(skb); 86 skb_reset_network_header(skb);
87 skb_mac_header_rebuild(skb);
88
91 err = 0; 89 err = 0;
92 90
93out: 91out:
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index c7e95c8c579f..5aa3981a3922 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1926,8 +1926,10 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
1926 }; 1926 };
1927 1927
1928 dst = ip6_route_output(net, NULL, &fl6); 1928 dst = ip6_route_output(net, NULL, &fl6);
1929 if (!dst) 1929 if (dst->error) {
1930 dst_release(dst);
1930 goto out_free; 1931 goto out_free;
1932 }
1931 1933
1932 skb_dst_drop(skb); 1934 skb_dst_drop(skb);
1933 skb_dst_set(skb, dst); 1935 skb_dst_set(skb, dst);
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index d8f02ef88e59..c964958ac470 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1545,9 +1545,10 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1545 &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex); 1545 &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex);
1546 1546
1547 dst = ip6_route_output(net, NULL, &fl6); 1547 dst = ip6_route_output(net, NULL, &fl6);
1548 if (dst == NULL) 1548 if (dst->error) {
1549 dst_release(dst);
1549 return; 1550 return;
1550 1551 }
1551 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0); 1552 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
1552 if (IS_ERR(dst)) 1553 if (IS_ERR(dst))
1553 return; 1554 return;
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index a81ce9450750..9949a356d62c 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -80,7 +80,6 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
80static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb) 80static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
81{ 81{
82 struct ipv6hdr *ip6h; 82 struct ipv6hdr *ip6h;
83 const unsigned char *old_mac;
84 int size = sizeof(struct ipv6hdr); 83 int size = sizeof(struct ipv6hdr);
85 int err; 84 int err;
86 85
@@ -90,10 +89,7 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
90 89
91 __skb_push(skb, size); 90 __skb_push(skb, size);
92 skb_reset_network_header(skb); 91 skb_reset_network_header(skb);
93 92 skb_mac_header_rebuild(skb);
94 old_mac = skb_mac_header(skb);
95 skb_set_mac_header(skb, -skb->mac_len);
96 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
97 93
98 xfrm6_beet_make_header(skb); 94 xfrm6_beet_make_header(skb);
99 95
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index 261e6e6f487e..9f2095b19ad0 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -63,7 +63,6 @@ static int xfrm6_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
63static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) 63static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
64{ 64{
65 int err = -EINVAL; 65 int err = -EINVAL;
66 const unsigned char *old_mac;
67 66
68 if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPV6) 67 if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPV6)
69 goto out; 68 goto out;
@@ -80,10 +79,9 @@ static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
80 if (!(x->props.flags & XFRM_STATE_NOECN)) 79 if (!(x->props.flags & XFRM_STATE_NOECN))
81 ipip6_ecn_decapsulate(skb); 80 ipip6_ecn_decapsulate(skb);
82 81
83 old_mac = skb_mac_header(skb);
84 skb_set_mac_header(skb, -skb->mac_len);
85 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
86 skb_reset_network_header(skb); 82 skb_reset_network_header(skb);
83 skb_mac_header_rebuild(skb);
84
87 err = 0; 85 err = 0;
88 86
89out: 87out:
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 2406b3e7393f..d86217d56bd7 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -63,14 +63,14 @@ static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
63 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : "" 63 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
64 64
65 int res = scnprintf(buf, sizeof(buf), 65 int res = scnprintf(buf, sizeof(buf),
66 "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", 66 "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
67 TEST(AUTH), TEST(ASSOC), TEST(PS_STA), 67 TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
68 TEST(PS_DRIVER), TEST(AUTHORIZED), 68 TEST(PS_DRIVER), TEST(AUTHORIZED),
69 TEST(SHORT_PREAMBLE), 69 TEST(SHORT_PREAMBLE),
70 TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT), 70 TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
71 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL), 71 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
72 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER), 72 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
73 TEST(TDLS_PEER_AUTH)); 73 TEST(TDLS_PEER_AUTH), TEST(RATE_CONTROL));
74#undef TEST 74#undef TEST
75 return simple_read_from_buffer(userbuf, count, ppos, buf, res); 75 return simple_read_from_buffer(userbuf, count, ppos, buf, res);
76} 76}
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 5a5a7767d541..ad64f4d5271a 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -336,7 +336,7 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
336 int i; 336 int i;
337 u32 mask; 337 u32 mask;
338 338
339 if (sta) { 339 if (sta && test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) {
340 ista = &sta->sta; 340 ista = &sta->sta;
341 priv_sta = sta->rate_ctrl_priv; 341 priv_sta = sta->rate_ctrl_priv;
342 } 342 }
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index 168427b0ffdc..80cfc006dd74 100644
--- a/net/mac80211/rate.h
+++ b/net/mac80211/rate.h
@@ -41,7 +41,7 @@ static inline void rate_control_tx_status(struct ieee80211_local *local,
41 struct ieee80211_sta *ista = &sta->sta; 41 struct ieee80211_sta *ista = &sta->sta;
42 void *priv_sta = sta->rate_ctrl_priv; 42 void *priv_sta = sta->rate_ctrl_priv;
43 43
44 if (!ref) 44 if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
45 return; 45 return;
46 46
47 ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb); 47 ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
@@ -62,6 +62,7 @@ static inline void rate_control_rate_init(struct sta_info *sta)
62 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 62 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
63 63
64 ref->ops->rate_init(ref->priv, sband, ista, priv_sta); 64 ref->ops->rate_init(ref->priv, sband, ista, priv_sta);
65 set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
65} 66}
66 67
67static inline void rate_control_rate_update(struct ieee80211_local *local, 68static inline void rate_control_rate_update(struct ieee80211_local *local,
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 6f77f12dc3fc..bfed851d0d36 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -52,6 +52,7 @@
52 * @WLAN_STA_SP: Station is in a service period, so don't try to 52 * @WLAN_STA_SP: Station is in a service period, so don't try to
53 * reply to other uAPSD trigger frames or PS-Poll. 53 * reply to other uAPSD trigger frames or PS-Poll.
54 * @WLAN_STA_4ADDR_EVENT: 4-addr event was already sent for this frame. 54 * @WLAN_STA_4ADDR_EVENT: 4-addr event was already sent for this frame.
55 * @WLAN_STA_RATE_CONTROL: rate control was initialized for this station.
55 */ 56 */
56enum ieee80211_sta_info_flags { 57enum ieee80211_sta_info_flags {
57 WLAN_STA_AUTH, 58 WLAN_STA_AUTH,
@@ -71,6 +72,7 @@ enum ieee80211_sta_info_flags {
71 WLAN_STA_UAPSD, 72 WLAN_STA_UAPSD,
72 WLAN_STA_SP, 73 WLAN_STA_SP,
73 WLAN_STA_4ADDR_EVENT, 74 WLAN_STA_4ADDR_EVENT,
75 WLAN_STA_RATE_CONTROL,
74}; 76};
75 77
76enum ieee80211_sta_state { 78enum ieee80211_sta_state {
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 611c3359b94d..2555816e7788 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -232,6 +232,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
232 __be16 dport = 0; /* destination port to forward */ 232 __be16 dport = 0; /* destination port to forward */
233 unsigned int flags; 233 unsigned int flags;
234 struct ip_vs_conn_param param; 234 struct ip_vs_conn_param param;
235 const union nf_inet_addr fwmark = { .ip = htonl(svc->fwmark) };
235 union nf_inet_addr snet; /* source network of the client, 236 union nf_inet_addr snet; /* source network of the client,
236 after masking */ 237 after masking */
237 238
@@ -267,7 +268,6 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
267 { 268 {
268 int protocol = iph.protocol; 269 int protocol = iph.protocol;
269 const union nf_inet_addr *vaddr = &iph.daddr; 270 const union nf_inet_addr *vaddr = &iph.daddr;
270 const union nf_inet_addr fwmark = { .ip = htonl(svc->fwmark) };
271 __be16 vport = 0; 271 __be16 vport = 0;
272 272
273 if (dst_port == svc->port) { 273 if (dst_port == svc->port) {
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 76613f5a55c0..ed86a3be678e 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -404,19 +404,49 @@ static void __nf_conntrack_hash_insert(struct nf_conn *ct,
404 &net->ct.hash[repl_hash]); 404 &net->ct.hash[repl_hash]);
405} 405}
406 406
407void nf_conntrack_hash_insert(struct nf_conn *ct) 407int
408nf_conntrack_hash_check_insert(struct nf_conn *ct)
408{ 409{
409 struct net *net = nf_ct_net(ct); 410 struct net *net = nf_ct_net(ct);
410 unsigned int hash, repl_hash; 411 unsigned int hash, repl_hash;
412 struct nf_conntrack_tuple_hash *h;
413 struct hlist_nulls_node *n;
411 u16 zone; 414 u16 zone;
412 415
413 zone = nf_ct_zone(ct); 416 zone = nf_ct_zone(ct);
414 hash = hash_conntrack(net, zone, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); 417 hash = hash_conntrack(net, zone,
415 repl_hash = hash_conntrack(net, zone, &ct->tuplehash[IP_CT_DIR_REPLY].tuple); 418 &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
419 repl_hash = hash_conntrack(net, zone,
420 &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
421
422 spin_lock_bh(&nf_conntrack_lock);
416 423
424 /* See if there's one in the list already, including reverse */
425 hlist_nulls_for_each_entry(h, n, &net->ct.hash[hash], hnnode)
426 if (nf_ct_tuple_equal(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
427 &h->tuple) &&
428 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h)))
429 goto out;
430 hlist_nulls_for_each_entry(h, n, &net->ct.hash[repl_hash], hnnode)
431 if (nf_ct_tuple_equal(&ct->tuplehash[IP_CT_DIR_REPLY].tuple,
432 &h->tuple) &&
433 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h)))
434 goto out;
435
436 add_timer(&ct->timeout);
437 nf_conntrack_get(&ct->ct_general);
417 __nf_conntrack_hash_insert(ct, hash, repl_hash); 438 __nf_conntrack_hash_insert(ct, hash, repl_hash);
439 NF_CT_STAT_INC(net, insert);
440 spin_unlock_bh(&nf_conntrack_lock);
441
442 return 0;
443
444out:
445 NF_CT_STAT_INC(net, insert_failed);
446 spin_unlock_bh(&nf_conntrack_lock);
447 return -EEXIST;
418} 448}
419EXPORT_SYMBOL_GPL(nf_conntrack_hash_insert); 449EXPORT_SYMBOL_GPL(nf_conntrack_hash_check_insert);
420 450
421/* Confirm a connection given skb; places it in hash table */ 451/* Confirm a connection given skb; places it in hash table */
422int 452int
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 9307b033c0c9..30c9d4ca0218 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1367,15 +1367,12 @@ ctnetlink_create_conntrack(struct net *net, u16 zone,
1367 nf_ct_protonum(ct)); 1367 nf_ct_protonum(ct));
1368 if (helper == NULL) { 1368 if (helper == NULL) {
1369 rcu_read_unlock(); 1369 rcu_read_unlock();
1370 spin_unlock_bh(&nf_conntrack_lock);
1371#ifdef CONFIG_MODULES 1370#ifdef CONFIG_MODULES
1372 if (request_module("nfct-helper-%s", helpname) < 0) { 1371 if (request_module("nfct-helper-%s", helpname) < 0) {
1373 spin_lock_bh(&nf_conntrack_lock);
1374 err = -EOPNOTSUPP; 1372 err = -EOPNOTSUPP;
1375 goto err1; 1373 goto err1;
1376 } 1374 }
1377 1375
1378 spin_lock_bh(&nf_conntrack_lock);
1379 rcu_read_lock(); 1376 rcu_read_lock();
1380 helper = __nf_conntrack_helper_find(helpname, 1377 helper = __nf_conntrack_helper_find(helpname,
1381 nf_ct_l3num(ct), 1378 nf_ct_l3num(ct),
@@ -1468,8 +1465,10 @@ ctnetlink_create_conntrack(struct net *net, u16 zone,
1468 if (tstamp) 1465 if (tstamp)
1469 tstamp->start = ktime_to_ns(ktime_get_real()); 1466 tstamp->start = ktime_to_ns(ktime_get_real());
1470 1467
1471 add_timer(&ct->timeout); 1468 err = nf_conntrack_hash_check_insert(ct);
1472 nf_conntrack_hash_insert(ct); 1469 if (err < 0)
1470 goto err2;
1471
1473 rcu_read_unlock(); 1472 rcu_read_unlock();
1474 1473
1475 return ct; 1474 return ct;
@@ -1490,6 +1489,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1490 struct nf_conntrack_tuple otuple, rtuple; 1489 struct nf_conntrack_tuple otuple, rtuple;
1491 struct nf_conntrack_tuple_hash *h = NULL; 1490 struct nf_conntrack_tuple_hash *h = NULL;
1492 struct nfgenmsg *nfmsg = nlmsg_data(nlh); 1491 struct nfgenmsg *nfmsg = nlmsg_data(nlh);
1492 struct nf_conn *ct;
1493 u_int8_t u3 = nfmsg->nfgen_family; 1493 u_int8_t u3 = nfmsg->nfgen_family;
1494 u16 zone; 1494 u16 zone;
1495 int err; 1495 int err;
@@ -1510,27 +1510,22 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1510 return err; 1510 return err;
1511 } 1511 }
1512 1512
1513 spin_lock_bh(&nf_conntrack_lock);
1514 if (cda[CTA_TUPLE_ORIG]) 1513 if (cda[CTA_TUPLE_ORIG])
1515 h = __nf_conntrack_find(net, zone, &otuple); 1514 h = nf_conntrack_find_get(net, zone, &otuple);
1516 else if (cda[CTA_TUPLE_REPLY]) 1515 else if (cda[CTA_TUPLE_REPLY])
1517 h = __nf_conntrack_find(net, zone, &rtuple); 1516 h = nf_conntrack_find_get(net, zone, &rtuple);
1518 1517
1519 if (h == NULL) { 1518 if (h == NULL) {
1520 err = -ENOENT; 1519 err = -ENOENT;
1521 if (nlh->nlmsg_flags & NLM_F_CREATE) { 1520 if (nlh->nlmsg_flags & NLM_F_CREATE) {
1522 struct nf_conn *ct;
1523 enum ip_conntrack_events events; 1521 enum ip_conntrack_events events;
1524 1522
1525 ct = ctnetlink_create_conntrack(net, zone, cda, &otuple, 1523 ct = ctnetlink_create_conntrack(net, zone, cda, &otuple,
1526 &rtuple, u3); 1524 &rtuple, u3);
1527 if (IS_ERR(ct)) { 1525 if (IS_ERR(ct))
1528 err = PTR_ERR(ct); 1526 return PTR_ERR(ct);
1529 goto out_unlock; 1527
1530 }
1531 err = 0; 1528 err = 0;
1532 nf_conntrack_get(&ct->ct_general);
1533 spin_unlock_bh(&nf_conntrack_lock);
1534 if (test_bit(IPS_EXPECTED_BIT, &ct->status)) 1529 if (test_bit(IPS_EXPECTED_BIT, &ct->status))
1535 events = IPCT_RELATED; 1530 events = IPCT_RELATED;
1536 else 1531 else
@@ -1545,23 +1540,19 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1545 ct, NETLINK_CB(skb).pid, 1540 ct, NETLINK_CB(skb).pid,
1546 nlmsg_report(nlh)); 1541 nlmsg_report(nlh));
1547 nf_ct_put(ct); 1542 nf_ct_put(ct);
1548 } else 1543 }
1549 spin_unlock_bh(&nf_conntrack_lock);
1550 1544
1551 return err; 1545 return err;
1552 } 1546 }
1553 /* implicit 'else' */ 1547 /* implicit 'else' */
1554 1548
1555 /* We manipulate the conntrack inside the global conntrack table lock,
1556 * so there's no need to increase the refcount */
1557 err = -EEXIST; 1549 err = -EEXIST;
1550 ct = nf_ct_tuplehash_to_ctrack(h);
1558 if (!(nlh->nlmsg_flags & NLM_F_EXCL)) { 1551 if (!(nlh->nlmsg_flags & NLM_F_EXCL)) {
1559 struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h); 1552 spin_lock_bh(&nf_conntrack_lock);
1560
1561 err = ctnetlink_change_conntrack(ct, cda); 1553 err = ctnetlink_change_conntrack(ct, cda);
1554 spin_unlock_bh(&nf_conntrack_lock);
1562 if (err == 0) { 1555 if (err == 0) {
1563 nf_conntrack_get(&ct->ct_general);
1564 spin_unlock_bh(&nf_conntrack_lock);
1565 nf_conntrack_eventmask_report((1 << IPCT_REPLY) | 1556 nf_conntrack_eventmask_report((1 << IPCT_REPLY) |
1566 (1 << IPCT_ASSURED) | 1557 (1 << IPCT_ASSURED) |
1567 (1 << IPCT_HELPER) | 1558 (1 << IPCT_HELPER) |
@@ -1570,15 +1561,10 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1570 (1 << IPCT_MARK), 1561 (1 << IPCT_MARK),
1571 ct, NETLINK_CB(skb).pid, 1562 ct, NETLINK_CB(skb).pid,
1572 nlmsg_report(nlh)); 1563 nlmsg_report(nlh));
1573 nf_ct_put(ct); 1564 }
1574 } else
1575 spin_unlock_bh(&nf_conntrack_lock);
1576
1577 return err;
1578 } 1565 }
1579 1566
1580out_unlock: 1567 nf_ct_put(ct);
1581 spin_unlock_bh(&nf_conntrack_lock);
1582 return err; 1568 return err;
1583} 1569}
1584 1570
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index b3a7db678b8d..ce60cf0f6c11 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -203,6 +203,27 @@ err:
203 return status; 203 return status;
204} 204}
205 205
206#ifdef CONFIG_BRIDGE_NETFILTER
207/* When called from bridge netfilter, skb->data must point to MAC header
208 * before calling skb_gso_segment(). Else, original MAC header is lost
209 * and segmented skbs will be sent to wrong destination.
210 */
211static void nf_bridge_adjust_skb_data(struct sk_buff *skb)
212{
213 if (skb->nf_bridge)
214 __skb_push(skb, skb->network_header - skb->mac_header);
215}
216
217static void nf_bridge_adjust_segmented_data(struct sk_buff *skb)
218{
219 if (skb->nf_bridge)
220 __skb_pull(skb, skb->network_header - skb->mac_header);
221}
222#else
223#define nf_bridge_adjust_skb_data(s) do {} while (0)
224#define nf_bridge_adjust_segmented_data(s) do {} while (0)
225#endif
226
206int nf_queue(struct sk_buff *skb, 227int nf_queue(struct sk_buff *skb,
207 struct list_head *elem, 228 struct list_head *elem,
208 u_int8_t pf, unsigned int hook, 229 u_int8_t pf, unsigned int hook,
@@ -212,7 +233,7 @@ int nf_queue(struct sk_buff *skb,
212 unsigned int queuenum) 233 unsigned int queuenum)
213{ 234{
214 struct sk_buff *segs; 235 struct sk_buff *segs;
215 int err; 236 int err = -EINVAL;
216 unsigned int queued; 237 unsigned int queued;
217 238
218 if (!skb_is_gso(skb)) 239 if (!skb_is_gso(skb))
@@ -228,23 +249,25 @@ int nf_queue(struct sk_buff *skb,
228 break; 249 break;
229 } 250 }
230 251
252 nf_bridge_adjust_skb_data(skb);
231 segs = skb_gso_segment(skb, 0); 253 segs = skb_gso_segment(skb, 0);
232 /* Does not use PTR_ERR to limit the number of error codes that can be 254 /* Does not use PTR_ERR to limit the number of error codes that can be
233 * returned by nf_queue. For instance, callers rely on -ECANCELED to mean 255 * returned by nf_queue. For instance, callers rely on -ECANCELED to mean
234 * 'ignore this hook'. 256 * 'ignore this hook'.
235 */ 257 */
236 if (IS_ERR(segs)) 258 if (IS_ERR(segs))
237 return -EINVAL; 259 goto out_err;
238
239 queued = 0; 260 queued = 0;
240 err = 0; 261 err = 0;
241 do { 262 do {
242 struct sk_buff *nskb = segs->next; 263 struct sk_buff *nskb = segs->next;
243 264
244 segs->next = NULL; 265 segs->next = NULL;
245 if (err == 0) 266 if (err == 0) {
267 nf_bridge_adjust_segmented_data(segs);
246 err = __nf_queue(segs, elem, pf, hook, indev, 268 err = __nf_queue(segs, elem, pf, hook, indev,
247 outdev, okfn, queuenum); 269 outdev, okfn, queuenum);
270 }
248 if (err == 0) 271 if (err == 0)
249 queued++; 272 queued++;
250 else 273 else
@@ -252,11 +275,12 @@ int nf_queue(struct sk_buff *skb,
252 segs = nskb; 275 segs = nskb;
253 } while (segs); 276 } while (segs);
254 277
255 /* also free orig skb if only some segments were queued */ 278 if (queued) {
256 if (unlikely(err && queued))
257 err = 0;
258 if (err == 0)
259 kfree_skb(skb); 279 kfree_skb(skb);
280 return 0;
281 }
282 out_err:
283 nf_bridge_adjust_segmented_data(skb);
260 return err; 284 return err;
261} 285}
262 286
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index 3aae66facf9f..4d5057902839 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -152,9 +152,10 @@ tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info)
152 fl6.flowlabel = ((iph->flow_lbl[0] & 0xF) << 16) | 152 fl6.flowlabel = ((iph->flow_lbl[0] & 0xF) << 16) |
153 (iph->flow_lbl[1] << 8) | iph->flow_lbl[2]; 153 (iph->flow_lbl[1] << 8) | iph->flow_lbl[2];
154 dst = ip6_route_output(net, NULL, &fl6); 154 dst = ip6_route_output(net, NULL, &fl6);
155 if (dst == NULL) 155 if (dst->error) {
156 dst_release(dst);
156 return false; 157 return false;
157 158 }
158 skb_dst_drop(skb); 159 skb_dst_drop(skb);
159 skb_dst_set(skb, dst); 160 skb_dst_set(skb, dst);
160 skb->dev = dst->dev; 161 skb->dev = dst->dev;
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index e83d61ca78ca..5da548fa7ae9 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -501,9 +501,8 @@ tfifo_dequeue:
501 501
502 /* if more time remaining? */ 502 /* if more time remaining? */
503 if (cb->time_to_send <= psched_get_time()) { 503 if (cb->time_to_send <= psched_get_time()) {
504 skb = qdisc_dequeue_tail(sch); 504 __skb_unlink(skb, &sch->q);
505 if (unlikely(!skb)) 505 sch->qstats.backlog -= qdisc_pkt_len(skb);
506 goto qdisc_dequeue;
507 506
508#ifdef CONFIG_NET_CLS_ACT 507#ifdef CONFIG_NET_CLS_ACT
509 /* 508 /*
@@ -539,7 +538,6 @@ deliver:
539 qdisc_watchdog_schedule(&q->watchdog, cb->time_to_send); 538 qdisc_watchdog_schedule(&q->watchdog, cb->time_to_send);
540 } 539 }
541 540
542qdisc_dequeue:
543 if (q->qdisc) { 541 if (q->qdisc) {
544 skb = q->qdisc->ops->dequeue(q->qdisc); 542 skb = q->qdisc->ops->dequeue(q->qdisc);
545 if (skb) 543 if (skb)
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index d0de2a2c3a2d..b89efe6e4c85 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -46,11 +46,37 @@ struct devtable {
46 void *function; 46 void *function;
47}; 47};
48 48
49#define ___cat(a,b) a ## b
50#define __cat(a,b) ___cat(a,b)
51
52/* we need some special handling for this host tool running eventually on
53 * Darwin. The Mach-O section handling is a bit different than ELF section
54 * handling. The differnces in detail are:
55 * a) we have segments which have sections
56 * b) we need a API call to get the respective section symbols */
57#if defined(__MACH__)
58#include <mach-o/getsect.h>
59
60#define INIT_SECTION(name) do { \
61 unsigned long name ## _len; \
62 char *__cat(pstart_,name) = getsectdata("__TEXT", \
63 #name, &__cat(name,_len)); \
64 char *__cat(pstop_,name) = __cat(pstart_,name) + \
65 __cat(name, _len); \
66 __cat(__start_,name) = (void *)__cat(pstart_,name); \
67 __cat(__stop_,name) = (void *)__cat(pstop_,name); \
68 } while (0)
69#define SECTION(name) __attribute__((section("__TEXT, " #name)))
70
71struct devtable **__start___devtable, **__stop___devtable;
72#else
73#define INIT_SECTION(name) /* no-op for ELF */
74#define SECTION(name) __attribute__((section(#name)))
75
49/* We construct a table of pointers in an ELF section (pointers generally 76/* We construct a table of pointers in an ELF section (pointers generally
50 * go unpadded by gcc). ld creates boundary syms for us. */ 77 * go unpadded by gcc). ld creates boundary syms for us. */
51extern struct devtable *__start___devtable[], *__stop___devtable[]; 78extern struct devtable *__start___devtable[], *__stop___devtable[];
52#define ___cat(a,b) a ## b 79#endif /* __MACH__ */
53#define __cat(a,b) ___cat(a,b)
54 80
55#if __GNUC__ == 3 && __GNUC_MINOR__ < 3 81#if __GNUC__ == 3 && __GNUC_MINOR__ < 3
56# define __used __attribute__((__unused__)) 82# define __used __attribute__((__unused__))
@@ -65,8 +91,8 @@ extern struct devtable *__start___devtable[], *__stop___devtable[];
65 (type *)NULL, \ 91 (type *)NULL, \
66 (char *)NULL)), \ 92 (char *)NULL)), \
67 sizeof(type), (function) }; \ 93 sizeof(type), (function) }; \
68 static struct devtable *__attribute__((section("__devtable"))) \ 94 static struct devtable *SECTION(__devtable) __used \
69 __used __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__) 95 __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__)
70 96
71#define ADD(str, sep, cond, field) \ 97#define ADD(str, sep, cond, field) \
72do { \ 98do { \
@@ -1080,6 +1106,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1080 do_pnp_card_entries(symval, sym->st_size, mod); 1106 do_pnp_card_entries(symval, sym->st_size, mod);
1081 else { 1107 else {
1082 struct devtable **p; 1108 struct devtable **p;
1109 INIT_SECTION(__devtable);
1083 1110
1084 for (p = __start___devtable; p < __stop___devtable; p++) { 1111 for (p = __start___devtable; p < __stop___devtable; p++) {
1085 if (sym_is(name, namelen, (*p)->device_id)) { 1112 if (sym_is(name, namelen, (*p)->device_id)) {
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 95ffa6a9db6e..496f14c1a731 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -2684,10 +2684,9 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2684 err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); 2684 err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
2685 if (err < 0) 2685 if (err < 0)
2686 goto out_err; 2686 goto out_err;
2687 opl3->private_data = chip;
2687 } 2688 }
2688 2689
2689 opl3->private_data = chip;
2690
2691 sprintf(card->longname, "%s at 0x%lx, irq %i", 2690 sprintf(card->longname, "%s at 0x%lx, irq %i",
2692 card->shortname, chip->ctrl_io, chip->irq); 2691 card->shortname, chip->ctrl_io, chip->irq);
2693 2692
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index c2c65f63bf06..684307372d73 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1759,7 +1759,11 @@ static void put_vol_mute(struct hda_codec *codec, struct hda_amp_info *info,
1759 parm = ch ? AC_AMP_SET_RIGHT : AC_AMP_SET_LEFT; 1759 parm = ch ? AC_AMP_SET_RIGHT : AC_AMP_SET_LEFT;
1760 parm |= direction == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT; 1760 parm |= direction == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT;
1761 parm |= index << AC_AMP_SET_INDEX_SHIFT; 1761 parm |= index << AC_AMP_SET_INDEX_SHIFT;
1762 parm |= val; 1762 if ((val & HDA_AMP_MUTE) && !(info->amp_caps & AC_AMPCAP_MUTE) &&
1763 (info->amp_caps & AC_AMPCAP_MIN_MUTE))
1764 ; /* set the zero value as a fake mute */
1765 else
1766 parm |= val;
1763 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, parm); 1767 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, parm);
1764 info->vol[ch] = val; 1768 info->vol[ch] = val;
1765} 1769}
@@ -2026,7 +2030,7 @@ int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2026 val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT); 2030 val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT);
2027 val1 += ofs; 2031 val1 += ofs;
2028 val1 = ((int)val1) * ((int)val2); 2032 val1 = ((int)val1) * ((int)val2);
2029 if (min_mute) 2033 if (min_mute || (caps & AC_AMPCAP_MIN_MUTE))
2030 val2 |= TLV_DB_SCALE_MUTE; 2034 val2 |= TLV_DB_SCALE_MUTE;
2031 if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv)) 2035 if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv))
2032 return -EFAULT; 2036 return -EFAULT;
@@ -5114,7 +5118,7 @@ static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid,
5114 const char *pfx = "", *sfx = ""; 5118 const char *pfx = "", *sfx = "";
5115 5119
5116 /* handle as a speaker if it's a fixed line-out */ 5120 /* handle as a speaker if it's a fixed line-out */
5117 if (!strcmp(name, "Line-Out") && attr == INPUT_PIN_ATTR_INT) 5121 if (!strcmp(name, "Line Out") && attr == INPUT_PIN_ATTR_INT)
5118 name = "Speaker"; 5122 name = "Speaker";
5119 /* check the location */ 5123 /* check the location */
5120 switch (attr) { 5124 switch (attr) {
@@ -5173,7 +5177,7 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
5173 5177
5174 switch (get_defcfg_device(def_conf)) { 5178 switch (get_defcfg_device(def_conf)) {
5175 case AC_JACK_LINE_OUT: 5179 case AC_JACK_LINE_OUT:
5176 return fill_audio_out_name(codec, nid, cfg, "Line-Out", 5180 return fill_audio_out_name(codec, nid, cfg, "Line Out",
5177 label, maxlen, indexp); 5181 label, maxlen, indexp);
5178 case AC_JACK_SPEAKER: 5182 case AC_JACK_SPEAKER:
5179 return fill_audio_out_name(codec, nid, cfg, "Speaker", 5183 return fill_audio_out_name(codec, nid, cfg, "Speaker",
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index e9f71dc0d464..f0f1943a4b2c 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -298,6 +298,9 @@ enum {
298#define AC_AMPCAP_MUTE (1<<31) /* mute capable */ 298#define AC_AMPCAP_MUTE (1<<31) /* mute capable */
299#define AC_AMPCAP_MUTE_SHIFT 31 299#define AC_AMPCAP_MUTE_SHIFT 31
300 300
301/* driver-specific amp-caps: using bits 24-30 */
302#define AC_AMPCAP_MIN_MUTE (1 << 30) /* min-volume = mute */
303
301/* Connection list */ 304/* Connection list */
302#define AC_CLIST_LENGTH (0x7f<<0) 305#define AC_CLIST_LENGTH (0x7f<<0)
303#define AC_CLIST_LONG (1<<7) 306#define AC_CLIST_LONG (1<<7)
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index bc5a993d1146..c83ccdba1e5a 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -609,7 +609,7 @@ static int add_output(struct hda_codec *codec, hda_nid_t dac, int idx,
609 "Front Speaker", "Surround Speaker", "Bass Speaker" 609 "Front Speaker", "Surround Speaker", "Bass Speaker"
610 }; 610 };
611 static const char * const line_outs[] = { 611 static const char * const line_outs[] = {
612 "Front Line-Out", "Surround Line-Out", "Bass Line-Out" 612 "Front Line Out", "Surround Line Out", "Bass Line Out"
613 }; 613 };
614 614
615 fix_volume_caps(codec, dac); 615 fix_volume_caps(codec, dac);
@@ -635,7 +635,7 @@ static int add_output(struct hda_codec *codec, hda_nid_t dac, int idx,
635 if (num_ctls > 1) 635 if (num_ctls > 1)
636 name = line_outs[idx]; 636 name = line_outs[idx];
637 else 637 else
638 name = "Line-Out"; 638 name = "Line Out";
639 break; 639 break;
640 } 640 }
641 641
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index a7a5733aa4d2..d29d6d377904 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3482,7 +3482,7 @@ static int cx_automute_mode_info(struct snd_kcontrol *kcontrol,
3482 "Disabled", "Enabled" 3482 "Disabled", "Enabled"
3483 }; 3483 };
3484 static const char * const texts3[] = { 3484 static const char * const texts3[] = {
3485 "Disabled", "Speaker Only", "Line-Out+Speaker" 3485 "Disabled", "Speaker Only", "Line Out+Speaker"
3486 }; 3486 };
3487 const char * const *texts; 3487 const char * const *texts;
3488 3488
@@ -4079,7 +4079,8 @@ static int cx_auto_add_volume_idx(struct hda_codec *codec, const char *basename,
4079 err = snd_hda_ctl_add(codec, nid, kctl); 4079 err = snd_hda_ctl_add(codec, nid, kctl);
4080 if (err < 0) 4080 if (err < 0)
4081 return err; 4081 return err;
4082 if (!(query_amp_caps(codec, nid, hda_dir) & AC_AMPCAP_MUTE)) 4082 if (!(query_amp_caps(codec, nid, hda_dir) &
4083 (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)))
4083 break; 4084 break;
4084 } 4085 }
4085 return 0; 4086 return 0;
@@ -4379,6 +4380,22 @@ static const struct snd_pci_quirk cxt_fixups[] = {
4379 {} 4380 {}
4380}; 4381};
4381 4382
4383/* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches
4384 * can be created (bko#42825)
4385 */
4386static void add_cx5051_fake_mutes(struct hda_codec *codec)
4387{
4388 static hda_nid_t out_nids[] = {
4389 0x10, 0x11, 0
4390 };
4391 hda_nid_t *p;
4392
4393 for (p = out_nids; *p; p++)
4394 snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT,
4395 AC_AMPCAP_MIN_MUTE |
4396 query_amp_caps(codec, *p, HDA_OUTPUT));
4397}
4398
4382static int patch_conexant_auto(struct hda_codec *codec) 4399static int patch_conexant_auto(struct hda_codec *codec)
4383{ 4400{
4384 struct conexant_spec *spec; 4401 struct conexant_spec *spec;
@@ -4397,6 +4414,9 @@ static int patch_conexant_auto(struct hda_codec *codec)
4397 case 0x14f15045: 4414 case 0x14f15045:
4398 spec->single_adc_amp = 1; 4415 spec->single_adc_amp = 1;
4399 break; 4416 break;
4417 case 0x14f15051:
4418 add_cx5051_fake_mutes(codec);
4419 break;
4400 } 4420 }
4401 4421
4402 apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl); 4422 apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 3647baa9bfed..f286bb8fda13 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -802,7 +802,7 @@ static int alc_automute_mode_info(struct snd_kcontrol *kcontrol,
802 "Disabled", "Enabled" 802 "Disabled", "Enabled"
803 }; 803 };
804 static const char * const texts3[] = { 804 static const char * const texts3[] = {
805 "Disabled", "Speaker Only", "Line-Out+Speaker" 805 "Disabled", "Speaker Only", "Line Out+Speaker"
806 }; 806 };
807 const char * const *texts; 807 const char * const *texts;
808 808
@@ -1856,7 +1856,7 @@ static const char * const alc_slave_vols[] = {
1856 "Headphone Playback Volume", 1856 "Headphone Playback Volume",
1857 "Speaker Playback Volume", 1857 "Speaker Playback Volume",
1858 "Mono Playback Volume", 1858 "Mono Playback Volume",
1859 "Line-Out Playback Volume", 1859 "Line Out Playback Volume",
1860 "CLFE Playback Volume", 1860 "CLFE Playback Volume",
1861 "Bass Speaker Playback Volume", 1861 "Bass Speaker Playback Volume",
1862 "PCM Playback Volume", 1862 "PCM Playback Volume",
@@ -1873,7 +1873,7 @@ static const char * const alc_slave_sws[] = {
1873 "Speaker Playback Switch", 1873 "Speaker Playback Switch",
1874 "Mono Playback Switch", 1874 "Mono Playback Switch",
1875 "IEC958 Playback Switch", 1875 "IEC958 Playback Switch",
1876 "Line-Out Playback Switch", 1876 "Line Out Playback Switch",
1877 "CLFE Playback Switch", 1877 "CLFE Playback Switch",
1878 "Bass Speaker Playback Switch", 1878 "Bass Speaker Playback Switch",
1879 "PCM Playback Switch", 1879 "PCM Playback Switch",
@@ -3797,7 +3797,7 @@ static void alc_auto_init_input_src(struct hda_codec *codec)
3797 else 3797 else
3798 nums = spec->num_adc_nids; 3798 nums = spec->num_adc_nids;
3799 for (c = 0; c < nums; c++) 3799 for (c = 0; c < nums; c++)
3800 alc_mux_select(codec, 0, spec->cur_mux[c], true); 3800 alc_mux_select(codec, c, spec->cur_mux[c], true);
3801} 3801}
3802 3802
3803/* add mic boosts if needed */ 3803/* add mic boosts if needed */
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 6345df131a00..9dbb5735d778 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4629,7 +4629,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec)
4629 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; 4629 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN;
4630 if (no_hp_sensing(spec, i)) 4630 if (no_hp_sensing(spec, i))
4631 continue; 4631 continue;
4632 if (presence) 4632 if (1 /*presence*/)
4633 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); 4633 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4634#if 0 /* FIXME */ 4634#if 0 /* FIXME */
4635/* Resetting the pinctl like below may lead to (a sort of) regressions 4635/* Resetting the pinctl like below may lead to (a sort of) regressions
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
index 01d1f749cf02..b6adbed6e506 100644
--- a/sound/soc/imx/imx-ssi.c
+++ b/sound/soc/imx/imx-ssi.c
@@ -112,7 +112,7 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
112 break; 112 break;
113 case SND_SOC_DAIFMT_DSP_A: 113 case SND_SOC_DAIFMT_DSP_A:
114 /* data on rising edge of bclk, frame high 1clk before data */ 114 /* data on rising edge of bclk, frame high 1clk before data */
115 strcr |= SSI_STCR_TFSL | SSI_STCR_TEFS; 115 strcr |= SSI_STCR_TFSL | SSI_STCR_TXBIT0 | SSI_STCR_TEFS;
116 break; 116 break;
117 } 117 }
118 118
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1f55ded4047f..1315663c1c09 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3068,9 +3068,13 @@ static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm)
3068 * standby. 3068 * standby.
3069 */ 3069 */
3070 if (powerdown) { 3070 if (powerdown) {
3071 snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_PREPARE); 3071 if (dapm->bias_level == SND_SOC_BIAS_ON)
3072 snd_soc_dapm_set_bias_level(dapm,
3073 SND_SOC_BIAS_PREPARE);
3072 dapm_seq_run(dapm, &down_list, 0, false); 3074 dapm_seq_run(dapm, &down_list, 0, false);
3073 snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_STANDBY); 3075 if (dapm->bias_level == SND_SOC_BIAS_PREPARE)
3076 snd_soc_dapm_set_bias_level(dapm,
3077 SND_SOC_BIAS_STANDBY);
3074 } 3078 }
3075} 3079}
3076 3080
@@ -3083,7 +3087,9 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card)
3083 3087
3084 list_for_each_entry(codec, &card->codec_dev_list, list) { 3088 list_for_each_entry(codec, &card->codec_dev_list, list) {
3085 soc_dapm_shutdown_codec(&codec->dapm); 3089 soc_dapm_shutdown_codec(&codec->dapm);
3086 snd_soc_dapm_set_bias_level(&codec->dapm, SND_SOC_BIAS_OFF); 3090 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY)
3091 snd_soc_dapm_set_bias_level(&codec->dapm,
3092 SND_SOC_BIAS_OFF);
3087 } 3093 }
3088} 3094}
3089 3095
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 2044324b755a..2a6f33cd888c 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -74,6 +74,7 @@ static pid_t perf_event__get_comm_tgid(pid_t pid, char *comm, size_t len)
74 if (size >= len) 74 if (size >= len)
75 size = len - 1; 75 size = len - 1;
76 memcpy(comm, name, size); 76 memcpy(comm, name, size);
77 comm[size] = '\0';
77 78
78 } else if (memcmp(bf, "Tgid:", 5) == 0) { 79 } else if (memcmp(bf, "Tgid:", 5) == 0) {
79 char *tgids = bf + 5; 80 char *tgids = bf + 5;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 3f16e08a5c8d..ea32a061f1c8 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -349,6 +349,10 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
349 hlist_for_each_entry(sid, pos, head, node) 349 hlist_for_each_entry(sid, pos, head, node)
350 if (sid->id == id) 350 if (sid->id == id)
351 return sid->evsel; 351 return sid->evsel;
352
353 if (!perf_evlist__sample_id_all(evlist))
354 return list_entry(evlist->entries.next, struct perf_evsel, node);
355
352 return NULL; 356 return NULL;
353} 357}
354 358
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 29cb65459811..e33554a562b3 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1867,6 +1867,12 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
1867 tev->point.symbol); 1867 tev->point.symbol);
1868 ret = -ENOENT; 1868 ret = -ENOENT;
1869 goto error; 1869 goto error;
1870 } else if (tev->point.offset > sym->end - sym->start) {
1871 pr_warning("Offset specified is greater than size of %s\n",
1872 tev->point.symbol);
1873 ret = -ENOENT;
1874 goto error;
1875
1870 } 1876 }
1871 1877
1872 return 1; 1878 return 1;
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 5d732621a462..74bd2e63c4b4 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -672,7 +672,7 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf)
672static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr, 672static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr,
673 bool retprobe, struct probe_trace_point *tp) 673 bool retprobe, struct probe_trace_point *tp)
674{ 674{
675 Dwarf_Addr eaddr; 675 Dwarf_Addr eaddr, highaddr;
676 const char *name; 676 const char *name;
677 677
678 /* Copy the name of probe point */ 678 /* Copy the name of probe point */
@@ -683,6 +683,16 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr,
683 dwarf_diename(sp_die)); 683 dwarf_diename(sp_die));
684 return -ENOENT; 684 return -ENOENT;
685 } 685 }
686 if (dwarf_highpc(sp_die, &highaddr) != 0) {
687 pr_warning("Failed to get end address of %s\n",
688 dwarf_diename(sp_die));
689 return -ENOENT;
690 }
691 if (paddr > highaddr) {
692 pr_warning("Offset specified is greater than size of %s\n",
693 dwarf_diename(sp_die));
694 return -EINVAL;
695 }
686 tp->symbol = strdup(name); 696 tp->symbol = strdup(name);
687 if (tp->symbol == NULL) 697 if (tp->symbol == NULL)
688 return -ENOMEM; 698 return -ENOMEM;
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 62a134dc421a..9507c4b251a8 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -3244,9 +3244,11 @@ sub make_min_config {
3244 $in_bisect = 1; 3244 $in_bisect = 1;
3245 3245
3246 my $failed = 0; 3246 my $failed = 0;
3247 build "oldconfig"; 3247 build "oldconfig" or $failed = 1;
3248 start_monitor_and_boot or $failed = 1; 3248 if (!$failed) {
3249 end_monitor; 3249 start_monitor_and_boot or $failed = 1;
3250 end_monitor;
3251 }
3250 3252
3251 $in_bisect = 0; 3253 $in_bisect = 0;
3252 3254