Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 18 Nov 2013 23:50:07 +0000 (15:50 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 18 Nov 2013 23:50:07 +0000 (15:50 -0800)
Pull i2c changes from Wolfram Sang:
 - new drivers for exynos5, bcm kona, and st micro
 - bigger overhauls for drivers mxs and rcar
 - typical driver bugfixes, cleanups, improvements
 - got rid of the superfluous 'driver' member in i2c_client struct This
   touches a few drivers in other subsystems.  All acked.

* 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (38 commits)
  i2c: bcm-kona: fix error return code in bcm_kona_i2c_probe()
  i2c: i2c-eg20t: do not print error message in syslog if no ACK received
  i2c: bcm-kona: Introduce Broadcom I2C Driver
  i2c: cbus-gpio: Fix device tree binding
  i2c: wmt: add missing clk_disable_unprepare() on error
  i2c: designware: add new ACPI IDs
  i2c: i801: Add Device IDs for Intel Wildcat Point-LP PCH
  i2c: exynos5: Remove incorrect clk_disable_unprepare
  i2c: i2c-st: Add ST I2C controller
  i2c: exynos5: add High Speed I2C controller driver
  i2c: rcar: fixup rcar type naming
  i2c: scmi: remove some bogus NULL checks
  i2c: sh_mobile & rcar: Enable the driver on all ARM platforms
  i2c: sh_mobile: Convert to clk_prepare/unprepare
  i2c: mux: gpio: use reg value for i2c_add_mux_adapter
  i2c: mux: gpio: use gpio_set_value_cansleep()
  i2c: Include linux/of.h header
  i2c: mxs: Fix PIO mode on i.MX23
  i2c: mxs: Rework the PIO mode operation
  i2c: mxs: distinguish i.MX23 and i.MX28 based I2C controller
  ...

25 files changed:
1  2 
MAINTAINERS
arch/arm/mach-at91/board-sam9263ek.c
arch/arm/mach-davinci/board-da830-evm.c
arch/arm/mach-davinci/board-da850-evm.c
arch/arm/mach-davinci/board-dm365-evm.c
arch/arm/mach-davinci/board-dm644x-evm.c
arch/arm/mach-davinci/board-dm646x-evm.c
arch/arm/mach-imx/mach-pcm037.c
drivers/gpu/drm/nouveau/core/subdev/therm/ic.c
drivers/i2c/busses/i2c-bcm-kona.c
drivers/i2c/busses/i2c-davinci.c
drivers/i2c/busses/i2c-designware-platdrv.c
drivers/i2c/busses/i2c-exynos5.c
drivers/i2c/busses/i2c-mxs.c
drivers/i2c/busses/i2c-st.c
drivers/i2c/busses/i2c-wmt.c
drivers/i2c/i2c-core.c
drivers/i2c/muxes/i2c-arb-gpio-challenge.c
drivers/i2c/muxes/i2c-mux-gpio.c
drivers/i2c/muxes/i2c-mux-pinctrl.c
drivers/media/i2c/s5c73m3/s5c73m3-core.c
drivers/media/v4l2-core/tuner-core.c
drivers/misc/eeprom/at24.c
include/media/v4l2-common.h
sound/soc/fsl/imx-wm8962.c

diff --combined MAINTAINERS
index a3715fbcc22f2a22dff1eae7e83f910818dae5cb,b9d19a7f3144cf3a4fc7f57dd57e96e30c54dfbc..0e598aeed5398551362b582d314995c3a47eaf9b
@@@ -237,11 -237,11 +237,11 @@@ F:      drivers/platform/x86/acer-wmi.
  
  ACPI
  M:    Len Brown <lenb@kernel.org>
 -M:    Rafael J. Wysocki <rjw@sisk.pl>
 +M:    Rafael J. Wysocki <rjw@rjwysocki.net>
  L:    linux-acpi@vger.kernel.org
 -W:    http://www.lesswatts.org/projects/acpi/
 -Q:    http://patchwork.kernel.org/project/linux-acpi/list/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
 +W:    https://01.org/linux-acpi
 +Q:    https://patchwork.kernel.org/project/linux-acpi/list/
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
  S:    Supported
  F:    drivers/acpi/
  F:    drivers/pnp/pnpacpi/
@@@ -253,38 -253,24 +253,38 @@@ F:      drivers/pci/*acpi
  F:    drivers/pci/*/*acpi*
  F:    drivers/pci/*/*/*acpi*
  
 +ACPI COMPONENT ARCHITECTURE (ACPICA)
 +M:    Robert Moore <robert.moore@intel.com>
 +M:    Lv Zheng <lv.zheng@intel.com>
 +M:    Rafael J. Wysocki <rafael.j.wysocki@intel.com>
 +L:    linux-acpi@vger.kernel.org
 +L:    devel@acpica.org
 +W:    https://acpica.org/
 +W:    https://github.com/acpica/acpica/
 +Q:    https://patchwork.kernel.org/project/linux-acpi/list/
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
 +S:    Supported
 +F:    drivers/acpi/acpica/
 +F:    include/acpi/
 +
  ACPI FAN DRIVER
  M:    Zhang Rui <rui.zhang@intel.com>
  L:    linux-acpi@vger.kernel.org
 -W:    http://www.lesswatts.org/projects/acpi/
 +W:    https://01.org/linux-acpi
  S:    Supported
  F:    drivers/acpi/fan.c
  
  ACPI THERMAL DRIVER
  M:    Zhang Rui <rui.zhang@intel.com>
  L:    linux-acpi@vger.kernel.org
 -W:    http://www.lesswatts.org/projects/acpi/
 +W:    https://01.org/linux-acpi
  S:    Supported
  F:    drivers/acpi/*thermal*
  
  ACPI VIDEO DRIVER
  M:    Zhang Rui <rui.zhang@intel.com>
  L:    linux-acpi@vger.kernel.org
 -W:    http://www.lesswatts.org/projects/acpi/
 +W:    https://01.org/linux-acpi
  S:    Supported
  F:    drivers/acpi/video.c
  
@@@ -777,10 -763,6 +777,10 @@@ W:       http://maxim.org.za/at91_26.htm
  W:    http://www.linux4sam.org
  S:    Supported
  F:    arch/arm/mach-at91/
 +F:    arch/arm/boot/dts/at91*.dts
 +F:    arch/arm/boot/dts/at91*.dtsi
 +F:    arch/arm/boot/dts/sama*.dts
 +F:    arch/arm/boot/dts/sama*.dtsi
  
  ARM/CALXEDA HIGHBANK ARCHITECTURE
  M:    Rob Herring <rob.herring@calxeda.com>
@@@ -842,21 -824,15 +842,21 @@@ S:      Maintaine
  F:    arch/arm/mach-gemini/
  
  ARM/CSR SIRFPRIMA2 MACHINE SUPPORT
 -M:    Barry Song <baohua.song@csr.com>
 +M:    Barry Song <baohua@kernel.org>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/baohua/linux.git
  S:    Maintained
  F:    arch/arm/mach-prima2/
 +F:    drivers/clk/clk-prima2.c
 +F:    drivers/clocksource/timer-prima2.c
 +F:    drivers/clocksource/timer-marco.c
  F:    drivers/dma/sirf-dma.c
  F:    drivers/i2c/busses/i2c-sirf.c
 +F:    drivers/input/misc/sirfsoc-onkey.c
 +F:    drivers/irqchip/irq-sirfsoc.c
  F:    drivers/mmc/host/sdhci-sirf.c
  F:    drivers/pinctrl/sirf/
 +F:    drivers/rtc/rtc-sirfsoc.c
  F:    drivers/spi/spi-sirf.c
  
  ARM/EBSA110 MACHINE SUPPORT
@@@ -947,7 -923,7 +947,7 @@@ M: Javier Martinez Canillas <javier@dow
  L:    linux-omap@vger.kernel.org
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 -F:    arch/arm/mach-omap2/board-igep0020.c
 +F:    arch/arm/boot/dts/omap3-igep*
  
  ARM/INCOME PXA270 SUPPORT
  M:    Marek Vasut <marek.vasut@gmail.com>
@@@ -1027,7 -1003,6 +1027,7 @@@ ARM/Marvell Armada 370 and Armada XP SO
  M:    Jason Cooper <jason@lakedaemon.net>
  M:    Andrew Lunn <andrew@lunn.ch>
  M:    Gregory Clement <gregory.clement@free-electrons.com>
 +M:    Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-mvebu/
  ARM/Marvell Dove/Kirkwood/MV78xx0/Orion SOC support
  M:    Jason Cooper <jason@lakedaemon.net>
  M:    Andrew Lunn <andrew@lunn.ch>
 +M:    Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-dove/
@@@ -1070,6 -1044,7 +1070,6 @@@ S:      Maintaine
  ARM/NOMADIK ARCHITECTURE
  M:    Alessandro Rubini <rubini@unipv.it>
  M:    Linus Walleij <linus.walleij@linaro.org>
 -M:    STEricsson <STEricsson_nomadik_linux@list.st.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-nomadik/
@@@ -1167,12 -1142,10 +1167,12 @@@ F:   drivers/net/ethernet/i825xx/ether1
  F:    drivers/net/ethernet/seeq/ether3*
  F:    drivers/scsi/arm/
  
 -ARM/SHARK MACHINE SUPPORT
 -M:    Alexander Schulz <alex@shark-linux.de>
 -W:    http://www.shark-linux.de/shark.html
 +ARM/Rockchip SoC support
 +M:    Heiko Stuebner <heiko@sntech.de>
 +L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 +F:    arch/arm/mach-rockchip/
 +F:    drivers/*/*rockchip*
  
  ARM/SAMSUNG ARM ARCHITECTURES
  M:    Ben Dooks <ben-linux@fluff.org>
@@@ -1181,8 -1154,6 +1181,8 @@@ L:      linux-arm-kernel@lists.infradead.or
  L:    linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
  W:    http://www.fluff.org/ben/linux/
  S:    Maintained
 +F:    arch/arm/boot/dts/s3c*
 +F:    arch/arm/boot/dts/exynos*
  F:    arch/arm/plat-samsung/
  F:    arch/arm/mach-s3c24*/
  F:    arch/arm/mach-s3c64xx/
@@@ -1425,7 -1396,7 +1425,7 @@@ M:      Wolfram Sang <wsa@the-dreams.de
  L:    linux-i2c@vger.kernel.org
  S:    Maintained
  F:    drivers/misc/eeprom/at24.c
- F:    include/linux/i2c/at24.h
+ F:    include/linux/platform_data/at24.h
  
  ATA OVER ETHERNET (AOE) DRIVER
  M:    "Ed L. Cashin" <ecashin@coraid.com>
@@@ -1674,15 -1645,16 +1674,15 @@@ S:   Maintaine
  F:    drivers/net/wireless/b43legacy/
  
  BACKLIGHT CLASS/SUBSYSTEM
 -M:    Richard Purdie <rpurdie@rpsys.net>
  M:    Jingoo Han <jg1.han@samsung.com>
  S:    Maintained
  F:    drivers/video/backlight/
  F:    include/linux/backlight.h
  
  BATMAN ADVANCED
 -M:    Marek Lindner <lindner_marek@yahoo.de>
 -M:    Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
 -M:    Antonio Quartulli <ordex@autistici.org>
 +M:    Marek Lindner <mareklindner@neomailbox.ch>
 +M:    Simon Wunderlich <sw@simonwunderlich.de>
 +M:    Antonio Quartulli <antonio@meshcoding.com>
  L:    b.a.t.m.a.n@lists.open-mesh.org
  W:    http://www.open-mesh.org/
  S:    Maintained
@@@ -1813,7 -1785,6 +1813,7 @@@ F:      include/net/bluetooth
  
  BONDING DRIVER
  M:    Jay Vosburgh <fubar@us.ibm.com>
 +M:    Veaceslav Falico <vfalico@redhat.com>
  M:    Andy Gospodarek <andy@greyhouse.net>
  L:    netdev@vger.kernel.org
  W:    http://sourceforge.net/projects/bonding/
@@@ -1835,7 -1806,7 +1835,7 @@@ F:      drivers/net/ethernet/broadcom/bnx2.
  F:    drivers/net/ethernet/broadcom/bnx2_*
  
  BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER
 -M:    Eilon Greenstein <eilong@broadcom.com>
 +M:    Ariel Elior <ariele@broadcom.com>
  L:    netdev@vger.kernel.org
  S:    Supported
  F:    drivers/net/ethernet/broadcom/bnx2x/
@@@ -1880,7 -1851,7 +1880,7 @@@ S:      Supporte
  F:    drivers/net/wireless/brcm80211/
  
  BROADCOM BNX2FC 10 GIGABIT FCOE DRIVER
 -M:    Bhanu Prakash Gollapudi <bprakash@broadcom.com>
 +M:    Eddie Wai <eddie.wai@broadcom.com>
  L:    linux-scsi@vger.kernel.org
  S:    Supported
  F:    drivers/scsi/bnx2fc/
@@@ -2323,7 -2294,7 +2323,7 @@@ S:      Maintaine
  F:    drivers/net/ethernet/ti/cpmac.c
  
  CPU FREQUENCY DRIVERS
 -M:    Rafael J. Wysocki <rjw@sisk.pl>
 +M:    Rafael J. Wysocki <rjw@rjwysocki.net>
  M:    Viresh Kumar <viresh.kumar@linaro.org>
  L:    cpufreq@vger.kernel.org
  L:    linux-pm@vger.kernel.org
@@@ -2354,7 -2325,7 +2354,7 @@@ S:      Maintaine
  F:      drivers/cpuidle/cpuidle-big_little.c
  
  CPUIDLE DRIVERS
 -M:    Rafael J. Wysocki <rjw@sisk.pl>
 +M:    Rafael J. Wysocki <rjw@rjwysocki.net>
  M:    Daniel Lezcano <daniel.lezcano@linaro.org>
  L:    linux-pm@vger.kernel.org
  S:    Maintained
@@@ -2385,7 -2356,7 +2385,7 @@@ F:      kernel/cpuset.
  
  CRAMFS FILESYSTEM
  W:    http://sourceforge.net/projects/cramfs/
 -S:    Orphan
 +S:    Orphan / Obsolete
  F:    Documentation/filesystems/cramfs.txt
  F:    fs/cramfs/
  
@@@ -2660,7 -2631,6 +2660,7 @@@ M:      dm-devel@redhat.co
  L:    dm-devel@redhat.com
  W:    http://sources.redhat.com/dm
  Q:    http://patchwork.kernel.org/project/dm-devel/list/
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
  T:    quilt http://people.redhat.com/agk/patches/linux/editing/
  S:    Maintained
  F:    Documentation/device-mapper/
@@@ -2742,8 -2712,6 +2742,8 @@@ T:      git git://git.linaro.org/people/sumi
  DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
  M:    Vinod Koul <vinod.koul@intel.com>
  M:    Dan Williams <dan.j.williams@intel.com>
 +L:    dmaengine@vger.kernel.org
 +Q:    https://patchwork.kernel.org/project/linux-dmaengine/list/
  S:    Supported
  F:    drivers/dma/
  F:    include/linux/dma*
@@@ -2847,10 -2815,8 +2847,10 @@@ M:    Terje Bergström <tbergstrom@nvidia.
  L:    dri-devel@lists.freedesktop.org
  L:    linux-tegra@vger.kernel.org
  T:    git git://anongit.freedesktop.org/tegra/linux.git
 -S:    Maintained
 +S:    Supported
 +F:    drivers/gpu/drm/tegra/
  F:    drivers/gpu/host1x/
 +F:    include/linux/host1x.h
  F:    include/uapi/drm/tegra_drm.h
  F:    Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt
  
@@@ -3063,14 -3029,6 +3063,14 @@@ W:    bluesmoke.sourceforge.ne
  S:    Maintained
  F:    drivers/edac/amd64_edac*
  
 +EDAC-CALXEDA
 +M:    Doug Thompson <dougthompson@xmission.com>
 +M:    Robert Richter <rric@kernel.org>
 +L:    linux-edac@vger.kernel.org
 +W:    bluesmoke.sourceforge.net
 +S:    Maintained
 +F:    drivers/edac/highbank*
 +
  EDAC-CAVIUM
  M:    Ralf Baechle <ralf@linux-mips.org>
  M:    David Daney <david.daney@cavium.com>
@@@ -3152,13 -3110,6 +3152,13 @@@ W:    bluesmoke.sourceforge.ne
  S:    Maintained
  F:    drivers/edac/i82975x_edac.c
  
 +EDAC-MPC85XX
 +M:    Johannes Thumshirn <johannes.thumshirn@men.de>
 +L:    linux-edac@vger.kernel.org
 +W:    bluesmoke.sourceforge.net
 +S:    Maintained
 +F:    drivers/edac/mpc85xx_edac.[ch]
 +
  EDAC-PASEMI
  M:    Egor Martovetsky <egor@pasemi.com>
  L:    linux-edac@vger.kernel.org
@@@ -3596,7 -3547,7 +3596,7 @@@ F:      fs/freevxfs
  
  FREEZER
  M:    Pavel Machek <pavel@ucw.cz>
 -M:    "Rafael J. Wysocki" <rjw@sisk.pl>
 +M:    "Rafael J. Wysocki" <rjw@rjwysocki.net>
  L:    linux-pm@vger.kernel.org
  S:    Supported
  F:    Documentation/power/freezing-of-tasks.txt
@@@ -3667,12 -3618,6 +3667,12 @@@ L:    linux-scsi@vger.kernel.or
  S:    Odd Fixes (e.g., new signatures)
  F:    drivers/scsi/fdomain.*
  
 +GCOV BASED KERNEL PROFILING
 +M:    Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
 +S:    Maintained
 +F:    kernel/gcov/
 +F:    Documentation/gcov.txt
 +
  GDT SCSI DISK ARRAY CONTROLLER DRIVER
  M:    Achim Leubner <achim_leubner@adaptec.com>
  L:    linux-scsi@vger.kernel.org
@@@ -3722,14 -3667,6 +3722,14 @@@ S:    Maintaine
  F:    include/asm-generic/
  F:    include/uapi/asm-generic/
  
 +GENERIC PHY FRAMEWORK
 +M:    Kishon Vijay Abraham I <kishon@ti.com>
 +L:    linux-kernel@vger.kernel.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git
 +S:    Supported
 +F:    drivers/phy/
 +F:    include/linux/phy/
 +
  GENERIC UIO DRIVER FOR PCI DEVICES
  M:    "Michael S. Tsirkin" <mst@redhat.com>
  L:    kvm@vger.kernel.org
@@@ -3946,7 -3883,7 +3946,7 @@@ F:      drivers/video/hgafb.
  
  HIBERNATION (aka Software Suspend, aka swsusp)
  M:    Pavel Machek <pavel@ucw.cz>
 -M:    "Rafael J. Wysocki" <rjw@sisk.pl>
 +M:    "Rafael J. Wysocki" <rjw@rjwysocki.net>
  L:    linux-pm@vger.kernel.org
  S:    Supported
  F:    arch/x86/power/
@@@ -4271,7 -4208,7 +4271,7 @@@ S:      Maintaine
  F:    drivers/media/rc/iguanair.c
  
  IIO SUBSYSTEM AND DRIVERS
 -M:    Jonathan Cameron <jic23@cam.ac.uk>
 +M:    Jonathan Cameron <jic23@kernel.org>
  L:    linux-iio@vger.kernel.org
  S:    Maintained
  F:    drivers/iio/
@@@ -4396,7 -4333,7 +4396,7 @@@ F:      drivers/video/i810
  INTEL MENLOW THERMAL DRIVER
  M:    Sujith Thomas <sujith.thomas@intel.com>
  L:    platform-driver-x86@vger.kernel.org
 -W:    http://www.lesswatts.org/projects/acpi/
 +W:    https://01.org/linux-acpi
  S:    Supported
  F:    drivers/platform/x86/intel_menlow.c
  
@@@ -4408,10 -4345,7 +4408,10 @@@ F:    arch/x86/kernel/microcode_intel.
  
  INTEL I/OAT DMA DRIVER
  M:    Dan Williams <dan.j.williams@intel.com>
 -S:    Maintained
 +M:    Dave Jiang <dave.jiang@intel.com>
 +L:    dmaengine@vger.kernel.org
 +Q:    https://patchwork.kernel.org/project/linux-dmaengine/list/
 +S:    Supported
  F:    drivers/dma/ioat*
  
  INTEL IOMMU (VT-d)
@@@ -4470,12 -4404,6 +4470,12 @@@ F:    Documentation/networking/ixgbevf.tx
  F:    Documentation/networking/i40e.txt
  F:    drivers/net/ethernet/intel/
  
 +INTEL-MID GPIO DRIVER
 +M:    David Cohen <david.a.cohen@linux.intel.com>
 +L:    linux-gpio@vger.kernel.org
 +S:    Maintained
 +F:    drivers/gpio/gpio-intel-mid.c
 +
  INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT
  M:    Stanislav Yakovlev <stas.yakovlev@gmail.com>
  L:    linux-wireless@vger.kernel.org
@@@ -4542,13 -4470,6 +4542,13 @@@ L:    linux-serial@vger.kernel.or
  S:    Maintained
  F:    drivers/tty/serial/ioc3_serial.c
  
 +IOMMU DRIVERS
 +M:    Joerg Roedel <joro@8bytes.org>
 +L:    iommu@lists.linux-foundation.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
 +S:    Maintained
 +F:    drivers/iommu/
 +
  IP MASQUERADING
  M:    Juanjo Ciarlante <jjciarla@raiz.uncu.edu.ar>
  S:    Maintained
@@@ -4814,18 -4735,10 +4814,18 @@@ S:   Maintaine
  F:    Documentation/hwmon/k8temp
  F:    drivers/hwmon/k8temp.c
  
 +KTAP
 +M:    Jovi Zhangwei <jovi.zhangwei@gmail.com>
 +W:    http://www.ktap.org
 +L:    ktap@freelists.org
 +S:    Maintained
 +F:    drivers/staging/ktap/
 +
  KCONFIG
 -M:    Michal Marek <mmarek@suse.cz>
 +M:    "Yann E. MORIN" <yann.morin.1998@free.fr>
  L:    linux-kbuild@vger.kernel.org
 -S:    Odd Fixes
 +T:    git://gitorious.org/linux-kconfig/linux-kconfig
 +S:    Maintained
  F:    Documentation/kbuild/kconfig-language.txt
  F:    scripts/kconfig/
  
@@@ -4888,8 -4801,7 +4888,8 @@@ KERNEL VIRTUAL MACHINE (KVM
  M:    Gleb Natapov <gleb@redhat.com>
  M:    Paolo Bonzini <pbonzini@redhat.com>
  L:    kvm@vger.kernel.org
 -W:    http://linux-kvm.org
 +W:    http://www.linux-kvm.org
 +T:    git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
  S:    Supported
  F:    Documentation/*/kvm*.txt
  F:    Documentation/virtual/kvm/
@@@ -5229,7 -5141,6 +5229,7 @@@ M:      Jean Delvare <khali@linux-fr.org
  L:    lm-sensors@lm-sensors.org
  S:    Maintained
  F:    Documentation/hwmon/lm90
 +F:    Documentation/devicetree/bindings/hwmon/lm90.txt
  F:    drivers/hwmon/lm90.c
  
  LM95234 HARDWARE MONITOR DRIVER
@@@ -5408,7 -5319,7 +5408,7 @@@ S:      Orpha
  F:    drivers/net/wireless/libertas/
  
  MARVELL MV643XX ETHERNET DRIVER
 -M:    Lennert Buytenhek <buytenh@wantstofly.org>
 +M:    Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
  L:    netdev@vger.kernel.org
  S:    Maintained
  F:    drivers/net/ethernet/marvell/mv643xx_eth.*
@@@ -6164,12 -6075,6 +6164,12 @@@ L:    linux-omap@vger.kernel.or
  S:    Maintained
  F:    drivers/gpio/gpio-omap.c
  
 +OMAP/NEWFLOW NANOBONE MACHINE SUPPORT
 +M:    Mark Jackson <mpfj@newflow.co.uk>
 +L:    linux-omap@vger.kernel.org
 +S:    Maintained
 +F:    arch/arm/boot/dts/am335x-nano.dts
 +
  OMFS FILESYSTEM
  M:    Bob Copeland <me@bobcopeland.com>
  L:    linux-karma-devel@lists.sourceforge.net
@@@ -6446,7 -6351,6 +6446,7 @@@ S:      Supporte
  F:    Documentation/PCI/
  F:    drivers/pci/
  F:    include/linux/pci*
 +F:    arch/x86/pci/
  
  PCI DRIVER FOR NVIDIA TEGRA
  M:    Thierry Reding <thierry.reding@gmail.com>
@@@ -6455,12 -6359,6 +6455,12 @@@ S:    Supporte
  F:    Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt
  F:    drivers/pci/host/pci-tegra.c
  
 +PCI DRIVER FOR SAMSUNG EXYNOS
 +M:    Jingoo Han <jg1.han@samsung.com>
 +L:    linux-pci@vger.kernel.org
 +S:    Maintained
 +F:    drivers/pci/host/pci-exynos.c
 +
  PCMCIA SUBSYSTEM
  P:    Linux PCMCIA Team
  L:    linux-pcmcia@lists.infradead.org
@@@ -6799,7 -6697,8 +6799,7 @@@ PWM SUBSYSTE
  M:    Thierry Reding <thierry.reding@gmail.com>
  L:    linux-pwm@vger.kernel.org
  S:    Maintained
 -W:    http://gitorious.org/linux-pwm
 -T:    git git://gitorious.org/linux-pwm/linux-pwm.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm.git
  F:    Documentation/pwm.txt
  F:    Documentation/devicetree/bindings/pwm/
  F:    include/linux/pwm.h
@@@ -6930,14 -6829,6 +6930,14 @@@ L:    linux-hexagon@vger.kernel.or
  S:    Supported
  F:    arch/hexagon/
  
 +QUALCOMM WCN36XX WIRELESS DRIVER
 +M:    Eugene Krasnikov <k.eugene.e@gmail.com>
 +L:    wcn36xx@lists.infradead.org
 +W:    http://wireless.kernel.org/en/users/Drivers/wcn36xx
 +T:    git git://github.com/KrasnikovEugene/wcn36xx.git
 +S:    Supported
 +F:    drivers/net/wireless/ath/wcn36xx/
 +
  QUICKCAM PARALLEL PORT WEBCAMS
  M:    Hans Verkuil <hverkuil@xs4all.nl>
  L:    linux-media@vger.kernel.org
@@@ -7025,7 -6916,7 +7025,7 @@@ M:      "Paul E. McKenney" <paulmck@linux.vn
  S:    Supported
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
  F:    Documentation/RCU/torture.txt
 -F:    kernel/rcutorture.c
 +F:    kernel/rcu/torture.c
  
  RDC R-321X SoC
  M:    Florian Fainelli <florian@openwrt.org>
@@@ -7052,9 -6943,8 +7052,9 @@@ T:      git git://git.kernel.org/pub/scm/lin
  F:    Documentation/RCU/
  X:    Documentation/RCU/torture.txt
  F:    include/linux/rcu*
 -F:    kernel/rcu*
 -X:    kernel/rcutorture.c
 +X:    include/linux/srcu.h
 +F:    kernel/rcu/
 +X:    kernel/rcu/torture.c
  
  REAL TIME CLOCK (RTC) SUBSYSTEM
  M:    Alessandro Zummo <a.zummo@towertech.it>
@@@ -7367,7 -7257,7 +7367,7 @@@ S:      Odd Fixe
  F:    drivers/media/usb/tlg2300/
  
  SC1200 WDT DRIVER
 -M:    Zwane Mwaikambo <zwane@arm.linux.org.uk>
 +M:    Zwane Mwaikambo <zwanem@gmail.com>
  S:    Maintained
  F:    drivers/watchdog/sc1200wdt.c
  
@@@ -7379,13 -7269,11 +7379,13 @@@ S:   Maintaine
  F:    kernel/sched/
  F:    include/linux/sched.h
  F:    include/uapi/linux/sched.h
 +F:    kernel/wait.c
 +F:    include/linux/wait.h
  
  SCORE ARCHITECTURE
 -M:    Chen Liqin <liqin.chen@sunplusct.com>
 +M:    Chen Liqin <liqin.linux@gmail.com>
  M:    Lennox Wu <lennox.wu@gmail.com>
 -W:    http://www.sunplusct.com
 +W:    http://www.sunplus.com
  S:    Supported
  F:    arch/score/
  
@@@ -7743,8 -7631,8 +7743,8 @@@ M:      "Paul E. McKenney" <paulmck@linux.vn
  W:    http://www.rdrop.com/users/paulmck/RCU/
  S:    Supported
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 -F:    include/linux/srcu*
 -F:    kernel/srcu*
 +F:    include/linux/srcu.h
 +F:    kernel/rcu/srcu.c
  
  SMACK SECURITY MODULE
  M:    Casey Schaufler <casey@schaufler-ca.com>
@@@ -7915,13 -7803,6 +7915,13 @@@ F:    Documentation/sound/alsa/soc
  F:    sound/soc/
  F:    include/sound/soc*
  
 +SOUND - DMAENGINE HELPERS
 +M:    Lars-Peter Clausen <lars@metafoo.de>
 +S:    Supported
 +F:    include/sound/dmaengine_pcm.h
 +F:    sound/core/pcm_dmaengine.c
 +F:    sound/soc/soc-generic-dmaengine-pcm.c
 +
  SPARC + UltraSPARC (sparc/sparc64)
  M:    "David S. Miller" <davem@davemloft.net>
  L:    sparclinux@vger.kernel.org
@@@ -8079,7 -7960,7 +8079,7 @@@ S:      Maintaine
  F:    drivers/staging/media/go7007/
  
  STAGING - INDUSTRIAL IO
 -M:    Jonathan Cameron <jic23@cam.ac.uk>
 +M:    Jonathan Cameron <jic23@kernel.org>
  L:    linux-iio@vger.kernel.org
  S:    Odd Fixes
  F:    drivers/staging/iio/
@@@ -8201,7 -8082,7 +8201,7 @@@ F:      drivers/sh
  SUSPEND TO RAM
  M:    Len Brown <len.brown@intel.com>
  M:    Pavel Machek <pavel@ucw.cz>
 -M:    "Rafael J. Wysocki" <rjw@sisk.pl>
 +M:    "Rafael J. Wysocki" <rjw@rjwysocki.net>
  L:    linux-pm@vger.kernel.org
  S:    Supported
  F:    Documentation/power/
@@@ -8394,72 -8275,14 +8394,72 @@@ L:   linux-media@vger.kernel.or
  S:    Maintained
  F:    drivers/media/rc/ttusbir.c
  
 -TEGRA SUPPORT
 +TEGRA ARCHITECTURE SUPPORT
  M:    Stephen Warren <swarren@wwwdotorg.org>
 +M:    Thierry Reding <thierry.reding@gmail.com>
  L:    linux-tegra@vger.kernel.org
  Q:    http://patchwork.ozlabs.org/project/linux-tegra/list/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra.git
  S:    Supported
  N:    [^a-z]tegra
  
 +TEGRA ASOC DRIVER
 +M:    Stephen Warren <swarren@wwwdotorg.org>
 +S:    Supported
 +F:    sound/soc/tegra/
 +
 +TEGRA CLOCK DRIVER
 +M:    Peter De Schrijver <pdeschrijver@nvidia.com>
 +M:    Prashant Gaikwad <pgaikwad@nvidia.com>
 +S:    Supported
 +F:    drivers/clk/tegra/
 +
 +TEGRA DMA DRIVER
 +M:    Laxman Dewangan <ldewangan@nvidia.com>
 +S:    Supported
 +F:    drivers/dma/tegra20-apb-dma.c
 +
 +TEGRA GPIO DRIVER
 +M:    Stephen Warren <swarren@wwwdotorg.org>
 +S:    Supported
 +F:    drivers/gpio/gpio-tegra.c
 +
 +TEGRA I2C DRIVER
 +M:    Laxman Dewangan <ldewangan@nvidia.com>
 +S:    Supported
 +F:    drivers/i2c/busses/i2c-tegra.c
 +
 +TEGRA IOMMU DRIVERS
 +M:    Hiroshi Doyu <hdoyu@nvidia.com>
 +S:    Supported
 +F:    drivers/iommu/tegra*
 +
 +TEGRA KBC DRIVER
 +M:    Rakesh Iyer <riyer@nvidia.com>
 +M:    Laxman Dewangan <ldewangan@nvidia.com>
 +S:    Supported
 +F:    drivers/input/keyboard/tegra-kbc.c
 +
 +TEGRA PINCTRL DRIVER
 +M:    Stephen Warren <swarren@wwwdotorg.org>
 +S:    Supported
 +F:    drivers/pinctrl/pinctrl-tegra*
 +
 +TEGRA PWM DRIVER
 +M:    Thierry Reding <thierry.reding@gmail.com>
 +S:    Supported
 +F:    drivers/pwm/pwm-tegra.c
 +
 +TEGRA SERIAL DRIVER
 +M:    Laxman Dewangan <ldewangan@nvidia.com>
 +S:    Supported
 +F:    drivers/tty/serial/serial-tegra.c
 +
 +TEGRA SPI DRIVER
 +M:    Laxman Dewangan <ldewangan@nvidia.com>
 +S:    Supported
 +F:    drivers/spi/spi-tegra*
 +
  TEHUTI ETHERNET DRIVER
  M:    Andy Gospodarek <andy@greyhouse.net>
  L:    netdev@vger.kernel.org
@@@ -8760,6 -8583,14 +8760,6 @@@ S:     Maintaine
  F:    arch/m68k/*/*_no.*
  F:    arch/m68k/include/asm/*_no.*
  
 -UCLINUX FOR RENESAS H8/300 (H8300)
 -M:    Yoshinori Sato <ysato@users.sourceforge.jp>
 -W:    http://uclinux-h8.sourceforge.jp/
 -S:    Supported
 -F:    arch/h8300/
 -F:    drivers/ide/ide-h8300.c
 -F:    drivers/net/ethernet/8390/ne-h8300.c
 -
  UDF FILESYSTEM
  M:    Jan Kara <jack@suse.cz>
  S:    Maintained
@@@ -8987,14 -8818,61 +8987,14 @@@ W:   http://pegasus2.sourceforge.net
  S:    Maintained
  F:    drivers/net/usb/rtl8150.c
  
 -USB SERIAL BELKIN F5U103 DRIVER
 -M:    William Greathouse <wgreathouse@smva.com>
 -L:    linux-usb@vger.kernel.org
 -S:    Maintained
 -F:    drivers/usb/serial/belkin_sa.*
 -
 -USB SERIAL CYPRESS M8 DRIVER
 -M:    Lonnie Mendez <dignome@gmail.com>
 +USB SERIAL SUBSYSTEM
 +M:    Johan Hovold <jhovold@gmail.com>
  L:    linux-usb@vger.kernel.org
  S:    Maintained
 -W:    http://geocities.com/i0xox0i
 -W:    http://firstlight.net/cvs
 -F:    drivers/usb/serial/cypress_m8.*
 -
 -USB SERIAL CYBERJACK DRIVER
 -M:    Matthias Bruestle and Harald Welte <support@reiner-sct.com>
 -W:    http://www.reiner-sct.de/support/treiber_cyberjack.php
 -S:    Maintained
 -F:    drivers/usb/serial/cyberjack.c
 -
 -USB SERIAL DIGI ACCELEPORT DRIVER
 -M:    Peter Berger <pberger@brimson.com>
 -M:    Al Borchers <alborchers@steinerpoint.com>
 -L:    linux-usb@vger.kernel.org
 -S:    Maintained
 -F:    drivers/usb/serial/digi_acceleport.c
 -
 -USB SERIAL DRIVER
 -M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -L:    linux-usb@vger.kernel.org
 -S:    Supported
  F:    Documentation/usb/usb-serial.txt
 -F:    drivers/usb/serial/generic.c
 -F:    drivers/usb/serial/usb-serial.c
 +F:    drivers/usb/serial/
  F:    include/linux/usb/serial.h
  
 -USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER
 -M:    Gary Brubaker <xavyer@ix.netcom.com>
 -L:    linux-usb@vger.kernel.org
 -S:    Maintained
 -F:    drivers/usb/serial/empeg.c
 -
 -USB SERIAL KEYSPAN DRIVER
 -M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -L:    linux-usb@vger.kernel.org
 -S:    Maintained
 -F:    drivers/usb/serial/*keyspan*
 -
 -USB SERIAL WHITEHEAT DRIVER
 -M:    Support Department <support@connecttech.com>
 -L:    linux-usb@vger.kernel.org
 -W:    http://www.connecttech.com
 -S:    Supported
 -F:    drivers/usb/serial/whiteheat*
 -
  USB SMSC75XX ETHERNET DRIVER
  M:    Steve Glendinning <steve.glendinning@shawell.net>
  L:    netdev@vger.kernel.org
@@@ -9500,7 -9378,6 +9500,7 @@@ F:      arch/arm64/include/asm/xen
  
  XEN NETWORK BACKEND DRIVER
  M:    Ian Campbell <ian.campbell@citrix.com>
 +M:    Wei Liu <wei.liu2@citrix.com>
  L:    xen-devel@lists.xenproject.org (moderated for non-subscribers)
  L:    netdev@vger.kernel.org
  S:    Supported
index 8b4942cbb6d9a62ffdb1f88e9676670817b7a107,947e134ac4c3996700a6b075d24ab5afbeb2dc3f..2f931915c80c8d2f9a6c9059cf2e6eb07d2093a7
@@@ -27,7 -27,7 +27,7 @@@
  #include <linux/platform_device.h>
  #include <linux/spi/spi.h>
  #include <linux/spi/ads7846.h>
- #include <linux/i2c/at24.h>
+ #include <linux/platform_data/at24.h>
  #include <linux/fb.h>
  #include <linux/gpio_keys.h>
  #include <linux/input.h>
@@@ -275,13 -275,13 +275,13 @@@ static struct fb_monspecs at91fb_defaul
                                        | ATMEL_LCDC_DISTYPE_TFT \
                                        | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
  
 -static void at91_lcdc_power_control(int on)
 +static void at91_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
  {
        at91_set_gpio_value(AT91_PIN_PA30, on);
  }
  
  /* Driver datas */
 -static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
 +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
        .lcdcon_is_backlight            = true,
        .default_bpp                    = 16,
        .default_dmacon                 = ATMEL_LCDC_DMAEN,
  };
  
  #else
 -static struct atmel_lcdfb_info __initdata ek_lcdc_data;
 +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
  #endif
  
  
index 40f15f133c55c3646d5eeac3ef3eec7764cae760,66b5b3cb53768630812e0ef61429644ecdb7373e..d1f45af7a530e9abc33d794fcc6cf52010cfc52b
  #include <linux/platform_device.h>
  #include <linux/i2c.h>
  #include <linux/i2c/pcf857x.h>
- #include <linux/i2c/at24.h>
+ #include <linux/platform_data/at24.h>
  #include <linux/mtd/mtd.h>
  #include <linux/mtd/partitions.h>
  #include <linux/spi/spi.h>
  #include <linux/spi/flash.h>
 +#include <linux/platform_data/gpio-davinci.h>
 +#include <linux/platform_data/mtd-davinci.h>
 +#include <linux/platform_data/mtd-davinci-aemif.h>
 +#include <linux/platform_data/spi-davinci.h>
 +#include <linux/platform_data/usb-davinci.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  
 +#include <mach/common.h>
  #include <mach/cp_intc.h>
  #include <mach/mux.h>
 -#include <linux/platform_data/mtd-davinci.h>
  #include <mach/da8xx.h>
 -#include <linux/platform_data/usb-davinci.h>
 -#include <linux/platform_data/mtd-davinci-aemif.h>
 -#include <linux/platform_data/spi-davinci.h>
  
  #define DA830_EVM_PHY_ID              ""
  /*
@@@ -76,7 -74,7 +76,7 @@@ static int da830_evm_usb_ocic_notify(da
        if (handler != NULL) {
                da830_evm_usb_ocic_handler = handler;
  
 -              error = request_irq(irq, da830_evm_usb_ocic_irq, IRQF_DISABLED |
 +              error = request_irq(irq, da830_evm_usb_ocic_irq,
                                    IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
                                    "OHCI over-current indicator", NULL);
                if (error)
@@@ -593,10 -591,6 +593,10 @@@ static __init void da830_evm_init(void
        struct davinci_soc_info *soc_info = &davinci_soc_info;
        int ret;
  
 +      ret = da830_register_gpio();
 +      if (ret)
 +              pr_warn("da830_evm_init: GPIO init failed: %d\n", ret);
 +
        ret = da830_register_edma(da830_edma_rsv);
        if (ret)
                pr_warning("da830_evm_init: edma registration failed: %d\n",
index df16cb88a26b643814af5385affb94a7a8220882,f25a569b000989120d758245f01929c1cb7ff461..e0af0eccde8fbe0d9f54abaeb339ee974db4c2d2
@@@ -18,7 -18,7 +18,7 @@@
  #include <linux/init.h>
  #include <linux/kernel.h>
  #include <linux/i2c.h>
- #include <linux/i2c/at24.h>
+ #include <linux/platform_data/at24.h>
  #include <linux/platform_data/pca953x.h>
  #include <linux/input.h>
  #include <linux/input/tps6507x-ts.h>
@@@ -28,7 -28,6 +28,7 @@@
  #include <linux/mtd/partitions.h>
  #include <linux/mtd/physmap.h>
  #include <linux/platform_device.h>
 +#include <linux/platform_data/gpio-davinci.h>
  #include <linux/platform_data/mtd-davinci.h>
  #include <linux/platform_data/mtd-davinci-aemif.h>
  #include <linux/platform_data/spi-davinci.h>
@@@ -39,7 -38,6 +39,7 @@@
  #include <linux/spi/flash.h>
  #include <linux/wl12xx.h>
  
 +#include <mach/common.h>
  #include <mach/cp_intc.h>
  #include <mach/da8xx.h>
  #include <mach/mux.h>
@@@ -1439,10 -1437,6 +1439,10 @@@ static __init void da850_evm_init(void
  {
        int ret;
  
 +      ret = da850_register_gpio();
 +      if (ret)
 +              pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
 +
        ret = pmic_tps65070_init();
        if (ret)
                pr_warn("%s: TPS65070 PMIC init failed: %d\n", __func__, ret);
index f4a6c18912ea50abaac233fedf26cef69af06724,30ee81fac9256590dd6f4e4bd479d8509bebd22e..e08a8684ead2fed54938bcfeaaac7fe3b5b0efb2
@@@ -18,7 -18,7 +18,7 @@@
  #include <linux/i2c.h>
  #include <linux/io.h>
  #include <linux/clk.h>
- #include <linux/i2c/at24.h>
+ #include <linux/platform_data/at24.h>
  #include <linux/leds.h>
  #include <linux/mtd/mtd.h>
  #include <linux/mtd/partitions.h>
@@@ -176,7 -176,7 +176,7 @@@ static struct at24_platform_data eeprom
        .context        = (void *)0x7f00,
  };
  
 -static struct snd_platform_data dm365_evm_snd_data = {
 +static struct snd_platform_data dm365_evm_snd_data __maybe_unused = {
        .asp_chan_q = EVENTQ_3,
  };
  
@@@ -743,12 -743,6 +743,12 @@@ static struct spi_board_info dm365_evm_
  
  static __init void dm365_evm_init(void)
  {
 +      int ret;
 +
 +      ret = dm365_gpio_register();
 +      if (ret)
 +              pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
 +
        evm_init_i2c();
        davinci_serial_init(dm365_serial_device);
  
index 9cc32c283b8b90af050de90411a9b1d168b3b050,f21fde9dce007a6dcc249d0e3458572b8b16977c..987605b78556f9e8fa16b1e9b1b278ad0abe4d1c
@@@ -15,7 -15,7 +15,7 @@@
  #include <linux/gpio.h>
  #include <linux/i2c.h>
  #include <linux/i2c/pcf857x.h>
- #include <linux/i2c/at24.h>
+ #include <linux/platform_data/at24.h>
  #include <linux/mtd/mtd.h>
  #include <linux/mtd/nand.h>
  #include <linux/mtd/partitions.h>
@@@ -754,14 -754,9 +754,14 @@@ static int davinci_phy_fixup(struct phy
  
  static __init void davinci_evm_init(void)
  {
 +      int ret;
        struct clk *aemif_clk;
        struct davinci_soc_info *soc_info = &davinci_soc_info;
  
 +      ret = dm644x_gpio_register();
 +      if (ret)
 +              pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
 +
        aemif_clk = clk_get(NULL, "aemif");
        clk_prepare_enable(aemif_clk);
  
index 44b20191a9fed5359ed0b24344e0aeb15430d210,db2df32da6a887d4042d810c525b1cf9e59c8753..13d0801fd6b170e155dfe3d4cf8c069522c4baf7
@@@ -22,7 -22,7 +22,7 @@@
  #include <linux/gpio.h>
  #include <linux/platform_device.h>
  #include <linux/i2c.h>
- #include <linux/i2c/at24.h>
+ #include <linux/platform_data/at24.h>
  #include <linux/i2c/pcf857x.h>
  
  #include <media/tvp514x.h>
  #include <linux/mtd/partitions.h>
  #include <linux/clk.h>
  #include <linux/export.h>
 +#include <linux/platform_data/gpio-davinci.h>
 +#include <linux/platform_data/i2c-davinci.h>
 +#include <linux/platform_data/mtd-davinci.h>
 +#include <linux/platform_data/mtd-davinci-aemif.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  
  #include <mach/common.h>
 +#include <mach/irqs.h>
  #include <mach/serial.h>
 -#include <linux/platform_data/i2c-davinci.h>
 -#include <linux/platform_data/mtd-davinci.h>
  #include <mach/clock.h>
  #include <mach/cdce949.h>
 -#include <linux/platform_data/mtd-davinci-aemif.h>
  
  #include "davinci.h"
  #include "clock.h"
@@@ -788,13 -786,8 +788,13 @@@ static struct edma_rsv_info dm646x_edma
  
  static __init void evm_init(void)
  {
 +      int ret;
        struct davinci_soc_info *soc_info = &davinci_soc_info;
  
 +      ret = dm646x_gpio_register();
 +      if (ret)
 +              pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
 +
        evm_init_i2c();
        davinci_serial_init(dm646x_serial_device);
        dm646x_init_mcasp0(&dm646x_evm_snd_data[0]);
index 45303bd629022d66ef167d0830f5c6088c5c44d8,20cc53f4cee1f1372c619925d0fe74e47eafd075..639a3dfb00923317871724f1848ace2d9c7e0125
@@@ -23,7 -23,7 +23,7 @@@
  #include <linux/smsc911x.h>
  #include <linux/interrupt.h>
  #include <linux/i2c.h>
- #include <linux/i2c/at24.h>
+ #include <linux/platform_data/at24.h>
  #include <linux/delay.h>
  #include <linux/spi/spi.h>
  #include <linux/irq.h>
@@@ -371,7 -371,8 +371,7 @@@ static int pcm970_sdhc1_init(struct dev
  #endif
  
        ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), detect_irq,
 -                      IRQF_DISABLED | IRQF_TRIGGER_FALLING,
 -                              "sdhc-detect", data);
 +                      IRQF_TRIGGER_FALLING, "sdhc-detect", data);
        if (ret)
                goto err_gpio_free_2;
  
index 13b850076443a82e30e8cf081c25c615e73bb9ac,eae939d3fc1a262b4d0a7277e6d2d242eed99a6b..e44ed7b93c6d88db3826a6c6dcb13efd5429385a
@@@ -41,7 -41,8 +41,8 @@@ probe_monitoring_device(struct nouveau_
        if (!client)
                return false;
  
-       if (!client->driver || client->driver->detect(client, info)) {
+       if (!client->dev.driver ||
+           to_i2c_driver(client->dev.driver)->detect(client, info)) {
                i2c_unregister_device(client);
                return false;
        }
        return true;
  }
  
 -static struct i2c_board_info
 +static struct nouveau_i2c_board_info
  nv_board_infos[] = {
 -      { I2C_BOARD_INFO("w83l785ts", 0x2d) },
 -      { I2C_BOARD_INFO("w83781d", 0x2d) },
 -      { I2C_BOARD_INFO("adt7473", 0x2e) },
 -      { I2C_BOARD_INFO("adt7473", 0x2d) },
 -      { I2C_BOARD_INFO("adt7473", 0x2c) },
 -      { I2C_BOARD_INFO("f75375", 0x2e) },
 -      { I2C_BOARD_INFO("lm99", 0x4c) },
 -      { I2C_BOARD_INFO("lm90", 0x4c) },
 -      { I2C_BOARD_INFO("lm90", 0x4d) },
 -      { I2C_BOARD_INFO("adm1021", 0x18) },
 -      { I2C_BOARD_INFO("adm1021", 0x19) },
 -      { I2C_BOARD_INFO("adm1021", 0x1a) },
 -      { I2C_BOARD_INFO("adm1021", 0x29) },
 -      { I2C_BOARD_INFO("adm1021", 0x2a) },
 -      { I2C_BOARD_INFO("adm1021", 0x2b) },
 -      { I2C_BOARD_INFO("adm1021", 0x4c) },
 -      { I2C_BOARD_INFO("adm1021", 0x4d) },
 -      { I2C_BOARD_INFO("adm1021", 0x4e) },
 -      { I2C_BOARD_INFO("lm63", 0x18) },
 -      { I2C_BOARD_INFO("lm63", 0x4e) },
 +      { { I2C_BOARD_INFO("w83l785ts", 0x2d) }, 0 },
 +      { { I2C_BOARD_INFO("w83781d", 0x2d) }, 0  },
 +      { { I2C_BOARD_INFO("adt7473", 0x2e) }, 20  },
 +      { { I2C_BOARD_INFO("adt7473", 0x2d) }, 20  },
 +      { { I2C_BOARD_INFO("adt7473", 0x2c) }, 20  },
 +      { { I2C_BOARD_INFO("f75375", 0x2e) }, 0  },
 +      { { I2C_BOARD_INFO("lm99", 0x4c) }, 0  },
 +      { { I2C_BOARD_INFO("lm90", 0x4c) }, 0  },
 +      { { I2C_BOARD_INFO("lm90", 0x4d) }, 0  },
 +      { { I2C_BOARD_INFO("adm1021", 0x18) }, 0  },
 +      { { I2C_BOARD_INFO("adm1021", 0x19) }, 0  },
 +      { { I2C_BOARD_INFO("adm1021", 0x1a) }, 0  },
 +      { { I2C_BOARD_INFO("adm1021", 0x29) }, 0  },
 +      { { I2C_BOARD_INFO("adm1021", 0x2a) }, 0  },
 +      { { I2C_BOARD_INFO("adm1021", 0x2b) }, 0  },
 +      { { I2C_BOARD_INFO("adm1021", 0x4c) }, 0  },
 +      { { I2C_BOARD_INFO("adm1021", 0x4d) }, 0  },
 +      { { I2C_BOARD_INFO("adm1021", 0x4e) }, 0  },
 +      { { I2C_BOARD_INFO("lm63", 0x18) }, 0  },
 +      { { I2C_BOARD_INFO("lm63", 0x4e) }, 0  },
        { }
  };
  
@@@ -89,9 -90,9 +90,9 @@@ nouveau_therm_ic_ctor(struct nouveau_th
        struct nvbios_extdev_func extdev_entry;
  
        if (!nvbios_extdev_find(bios, NVBIOS_EXTDEV_LM89, &extdev_entry)) {
 -              struct i2c_board_info board[] = {
 -                      { I2C_BOARD_INFO("lm90", extdev_entry.addr >> 1) },
 -                      { }
 +              struct nouveau_i2c_board_info board[] = {
 +                { { I2C_BOARD_INFO("lm90", extdev_entry.addr >> 1) }, 0},
 +                { }
                };
  
                i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
        }
  
        if (!nvbios_extdev_find(bios, NVBIOS_EXTDEV_ADT7473, &extdev_entry)) {
 -              struct i2c_board_info board[] = {
 -                      { I2C_BOARD_INFO("adt7473", extdev_entry.addr >> 1) },
 -                      { }
 +              struct nouveau_i2c_board_info board[] = {
 +                { { I2C_BOARD_INFO("adt7473", extdev_entry.addr >> 1) }, 20 },
 +                { }
                };
  
                i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
index 0000000000000000000000000000000000000000,eb1ce6e4523a291bb8a808379556780c9e666725..036cf03aeb612a7c62641c65e94552eb6c09af04
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,909 +1,909 @@@
 -      INIT_COMPLETION(dev->done);
+ /*
+  * Copyright (C) 2013 Broadcom Corporation
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License as
+  * published by the Free Software Foundation version 2.
+  *
+  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+  * kind, whether express or implied; without even the implied warranty
+  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  */
+ #include <linux/device.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/sched.h>
+ #include <linux/i2c.h>
+ #include <linux/interrupt.h>
+ #include <linux/platform_device.h>
+ #include <linux/clk.h>
+ #include <linux/io.h>
+ #include <linux/clk.h>
+ #include <linux/slab.h>
+ /* Hardware register offsets and field defintions */
+ #define CS_OFFSET                             0x00000020
+ #define CS_ACK_SHIFT                          3
+ #define CS_ACK_MASK                           0x00000008
+ #define CS_ACK_CMD_GEN_START                  0x00000000
+ #define CS_ACK_CMD_GEN_RESTART                        0x00000001
+ #define CS_CMD_SHIFT                          1
+ #define CS_CMD_CMD_NO_ACTION                  0x00000000
+ #define CS_CMD_CMD_START_RESTART              0x00000001
+ #define CS_CMD_CMD_STOP                               0x00000002
+ #define CS_EN_SHIFT                           0
+ #define CS_EN_CMD_ENABLE_BSC                  0x00000001
+ #define TIM_OFFSET                            0x00000024
+ #define TIM_PRESCALE_SHIFT                    6
+ #define TIM_P_SHIFT                           3
+ #define TIM_NO_DIV_SHIFT                      2
+ #define TIM_DIV_SHIFT                         0
+ #define DAT_OFFSET                            0x00000028
+ #define TOUT_OFFSET                           0x0000002c
+ #define TXFCR_OFFSET                          0x0000003c
+ #define TXFCR_FIFO_FLUSH_MASK                 0x00000080
+ #define TXFCR_FIFO_EN_MASK                    0x00000040
+ #define IER_OFFSET                            0x00000044
+ #define IER_READ_COMPLETE_INT_MASK            0x00000010
+ #define IER_I2C_INT_EN_MASK                   0x00000008
+ #define IER_FIFO_INT_EN_MASK                  0x00000002
+ #define IER_NOACK_EN_MASK                     0x00000001
+ #define ISR_OFFSET                            0x00000048
+ #define ISR_RESERVED_MASK                     0xffffff60
+ #define ISR_CMDBUSY_MASK                      0x00000080
+ #define ISR_READ_COMPLETE_MASK                        0x00000010
+ #define ISR_SES_DONE_MASK                     0x00000008
+ #define ISR_ERR_MASK                          0x00000004
+ #define ISR_TXFIFOEMPTY_MASK                  0x00000002
+ #define ISR_NOACK_MASK                                0x00000001
+ #define CLKEN_OFFSET                          0x0000004C
+ #define CLKEN_AUTOSENSE_OFF_MASK              0x00000080
+ #define CLKEN_M_SHIFT                         4
+ #define CLKEN_N_SHIFT                         1
+ #define CLKEN_CLKEN_MASK                      0x00000001
+ #define FIFO_STATUS_OFFSET                    0x00000054
+ #define FIFO_STATUS_RXFIFO_EMPTY_MASK         0x00000004
+ #define FIFO_STATUS_TXFIFO_EMPTY_MASK         0x00000010
+ #define HSTIM_OFFSET                          0x00000058
+ #define HSTIM_HS_MODE_MASK                    0x00008000
+ #define HSTIM_HS_HOLD_SHIFT                   10
+ #define HSTIM_HS_HIGH_PHASE_SHIFT             5
+ #define HSTIM_HS_SETUP_SHIFT                  0
+ #define PADCTL_OFFSET                         0x0000005c
+ #define PADCTL_PAD_OUT_EN_MASK                        0x00000004
+ #define RXFCR_OFFSET                          0x00000068
+ #define RXFCR_NACK_EN_SHIFT                   7
+ #define RXFCR_READ_COUNT_SHIFT                        0
+ #define RXFIFORDOUT_OFFSET                    0x0000006c
+ /* Locally used constants */
+ #define MAX_RX_FIFO_SIZE              64U /* bytes */
+ #define MAX_TX_FIFO_SIZE              64U /* bytes */
+ #define STD_EXT_CLK_FREQ              13000000UL
+ #define HS_EXT_CLK_FREQ                       104000000UL
+ #define MASTERCODE                    0x08 /* Mastercodes are 0000_1xxxb */
+ #define I2C_TIMEOUT                   100 /* msecs */
+ /* Operations that can be commanded to the controller */
+ enum bcm_kona_cmd_t {
+       BCM_CMD_NOACTION = 0,
+       BCM_CMD_START,
+       BCM_CMD_RESTART,
+       BCM_CMD_STOP,
+ };
+ enum bus_speed_index {
+       BCM_SPD_100K = 0,
+       BCM_SPD_400K,
+       BCM_SPD_1MHZ,
+ };
+ enum hs_bus_speed_index {
+       BCM_SPD_3P4MHZ = 0,
+ };
+ /* Internal divider settings for standard mode, fast mode and fast mode plus */
+ struct bus_speed_cfg {
+       uint8_t time_m;         /* Number of cycles for setup time */
+       uint8_t time_n;         /* Number of cycles for hold time */
+       uint8_t prescale;       /* Prescale divider */
+       uint8_t time_p;         /* Timing coefficient */
+       uint8_t no_div;         /* Disable clock divider */
+       uint8_t time_div;       /* Post-prescale divider */
+ };
+ /* Internal divider settings for high-speed mode */
+ struct hs_bus_speed_cfg {
+       uint8_t hs_hold;        /* Number of clock cycles SCL stays low until
+                                  the end of bit period */
+       uint8_t hs_high_phase;  /* Number of clock cycles SCL stays high
+                                  before it falls */
+       uint8_t hs_setup;       /* Number of clock cycles SCL stays low
+                                  before it rises  */
+       uint8_t prescale;       /* Prescale divider */
+       uint8_t time_p;         /* Timing coefficient */
+       uint8_t no_div;         /* Disable clock divider */
+       uint8_t time_div;       /* Post-prescale divider */
+ };
+ static const struct bus_speed_cfg std_cfg_table[] = {
+       [BCM_SPD_100K] = {0x01, 0x01, 0x03, 0x06, 0x00, 0x02},
+       [BCM_SPD_400K] = {0x05, 0x01, 0x03, 0x05, 0x01, 0x02},
+       [BCM_SPD_1MHZ] = {0x01, 0x01, 0x03, 0x01, 0x01, 0x03},
+ };
+ static const struct hs_bus_speed_cfg hs_cfg_table[] = {
+       [BCM_SPD_3P4MHZ] = {0x01, 0x08, 0x14, 0x00, 0x06, 0x01, 0x00},
+ };
+ struct bcm_kona_i2c_dev {
+       struct device *device;
+       void __iomem *base;
+       int irq;
+       struct clk *external_clk;
+       struct i2c_adapter adapter;
+       struct completion done;
+       const struct bus_speed_cfg *std_cfg;
+       const struct hs_bus_speed_cfg *hs_cfg;
+ };
+ static void bcm_kona_i2c_send_cmd_to_ctrl(struct bcm_kona_i2c_dev *dev,
+                                         enum bcm_kona_cmd_t cmd)
+ {
+       dev_dbg(dev->device, "%s, %d\n", __func__, cmd);
+       switch (cmd) {
+       case BCM_CMD_NOACTION:
+               writel((CS_CMD_CMD_NO_ACTION << CS_CMD_SHIFT) |
+                      (CS_EN_CMD_ENABLE_BSC << CS_EN_SHIFT),
+                      dev->base + CS_OFFSET);
+               break;
+       case BCM_CMD_START:
+               writel((CS_ACK_CMD_GEN_START << CS_ACK_SHIFT) |
+                      (CS_CMD_CMD_START_RESTART << CS_CMD_SHIFT) |
+                      (CS_EN_CMD_ENABLE_BSC << CS_EN_SHIFT),
+                      dev->base + CS_OFFSET);
+               break;
+       case BCM_CMD_RESTART:
+               writel((CS_ACK_CMD_GEN_RESTART << CS_ACK_SHIFT) |
+                      (CS_CMD_CMD_START_RESTART << CS_CMD_SHIFT) |
+                      (CS_EN_CMD_ENABLE_BSC << CS_EN_SHIFT),
+                      dev->base + CS_OFFSET);
+               break;
+       case BCM_CMD_STOP:
+               writel((CS_CMD_CMD_STOP << CS_CMD_SHIFT) |
+                      (CS_EN_CMD_ENABLE_BSC << CS_EN_SHIFT),
+                      dev->base + CS_OFFSET);
+               break;
+       default:
+               dev_err(dev->device, "Unknown command %d\n", cmd);
+       }
+ }
+ static void bcm_kona_i2c_enable_clock(struct bcm_kona_i2c_dev *dev)
+ {
+       writel(readl(dev->base + CLKEN_OFFSET) | CLKEN_CLKEN_MASK,
+              dev->base + CLKEN_OFFSET);
+ }
+ static void bcm_kona_i2c_disable_clock(struct bcm_kona_i2c_dev *dev)
+ {
+       writel(readl(dev->base + CLKEN_OFFSET) & ~CLKEN_CLKEN_MASK,
+              dev->base + CLKEN_OFFSET);
+ }
+ static irqreturn_t bcm_kona_i2c_isr(int irq, void *devid)
+ {
+       struct bcm_kona_i2c_dev *dev = devid;
+       uint32_t status = readl(dev->base + ISR_OFFSET);
+       if ((status & ~ISR_RESERVED_MASK) == 0)
+               return IRQ_NONE;
+       /* Must flush the TX FIFO when NAK detected */
+       if (status & ISR_NOACK_MASK)
+               writel(TXFCR_FIFO_FLUSH_MASK | TXFCR_FIFO_EN_MASK,
+                      dev->base + TXFCR_OFFSET);
+       writel(status & ~ISR_RESERVED_MASK, dev->base + ISR_OFFSET);
+       complete_all(&dev->done);
+       return IRQ_HANDLED;
+ }
+ /* Wait for ISR_CMDBUSY_MASK to go low before writing to CS, DAT, or RCD */
+ static int bcm_kona_i2c_wait_if_busy(struct bcm_kona_i2c_dev *dev)
+ {
+       unsigned long timeout = jiffies + msecs_to_jiffies(I2C_TIMEOUT);
+       while (readl(dev->base + ISR_OFFSET) & ISR_CMDBUSY_MASK)
+               if (time_after(jiffies, timeout)) {
+                       dev_err(dev->device, "CMDBUSY timeout\n");
+                       return -ETIMEDOUT;
+               }
+       return 0;
+ }
+ /* Send command to I2C bus */
+ static int bcm_kona_send_i2c_cmd(struct bcm_kona_i2c_dev *dev,
+                                enum bcm_kona_cmd_t cmd)
+ {
+       int rc;
+       unsigned long time_left = msecs_to_jiffies(I2C_TIMEOUT);
+       /* Make sure the hardware is ready */
+       rc = bcm_kona_i2c_wait_if_busy(dev);
+       if (rc < 0)
+               return rc;
+       /* Unmask the session done interrupt */
+       writel(IER_I2C_INT_EN_MASK, dev->base + IER_OFFSET);
+       /* Mark as incomplete before sending the command */
 -      INIT_COMPLETION(dev->done);
++      reinit_completion(&dev->done);
+       /* Send the command */
+       bcm_kona_i2c_send_cmd_to_ctrl(dev, cmd);
+       /* Wait for transaction to finish or timeout */
+       time_left = wait_for_completion_timeout(&dev->done, time_left);
+       /* Mask all interrupts */
+       writel(0, dev->base + IER_OFFSET);
+       if (!time_left) {
+               dev_err(dev->device, "controller timed out\n");
+               rc = -ETIMEDOUT;
+       }
+       /* Clear command */
+       bcm_kona_i2c_send_cmd_to_ctrl(dev, BCM_CMD_NOACTION);
+       return rc;
+ }
+ /* Read a single RX FIFO worth of data from the i2c bus */
+ static int bcm_kona_i2c_read_fifo_single(struct bcm_kona_i2c_dev *dev,
+                                        uint8_t *buf, unsigned int len,
+                                        unsigned int last_byte_nak)
+ {
+       unsigned long time_left = msecs_to_jiffies(I2C_TIMEOUT);
+       /* Mark as incomplete before starting the RX FIFO */
 -      INIT_COMPLETION(dev->done);
++      reinit_completion(&dev->done);
+       /* Unmask the read complete interrupt */
+       writel(IER_READ_COMPLETE_INT_MASK, dev->base + IER_OFFSET);
+       /* Start the RX FIFO */
+       writel((last_byte_nak << RXFCR_NACK_EN_SHIFT) |
+              (len << RXFCR_READ_COUNT_SHIFT),
+               dev->base + RXFCR_OFFSET);
+       /* Wait for FIFO read to complete */
+       time_left = wait_for_completion_timeout(&dev->done, time_left);
+       /* Mask all interrupts */
+       writel(0, dev->base + IER_OFFSET);
+       if (!time_left) {
+               dev_err(dev->device, "RX FIFO time out\n");
+               return -EREMOTEIO;
+       }
+       /* Read data from FIFO */
+       for (; len > 0; len--, buf++)
+               *buf = readl(dev->base + RXFIFORDOUT_OFFSET);
+       return 0;
+ }
+ /* Read any amount of data using the RX FIFO from the i2c bus */
+ static int bcm_kona_i2c_read_fifo(struct bcm_kona_i2c_dev *dev,
+                                 struct i2c_msg *msg)
+ {
+       unsigned int bytes_to_read = MAX_RX_FIFO_SIZE;
+       unsigned int last_byte_nak = 0;
+       unsigned int bytes_read = 0;
+       int rc;
+       uint8_t *tmp_buf = msg->buf;
+       while (bytes_read < msg->len) {
+               if (msg->len - bytes_read <= MAX_RX_FIFO_SIZE) {
+                       last_byte_nak = 1; /* NAK last byte of transfer */
+                       bytes_to_read = msg->len - bytes_read;
+               }
+               rc = bcm_kona_i2c_read_fifo_single(dev, tmp_buf, bytes_to_read,
+                                                  last_byte_nak);
+               if (rc < 0)
+                       return -EREMOTEIO;
+               bytes_read += bytes_to_read;
+               tmp_buf += bytes_to_read;
+       }
+       return 0;
+ }
+ /* Write a single byte of data to the i2c bus */
+ static int bcm_kona_i2c_write_byte(struct bcm_kona_i2c_dev *dev, uint8_t data,
+                                  unsigned int nak_expected)
+ {
+       int rc;
+       unsigned long time_left = msecs_to_jiffies(I2C_TIMEOUT);
+       unsigned int nak_received;
+       /* Make sure the hardware is ready */
+       rc = bcm_kona_i2c_wait_if_busy(dev);
+       if (rc < 0)
+               return rc;
+       /* Clear pending session done interrupt */
+       writel(ISR_SES_DONE_MASK, dev->base + ISR_OFFSET);
+       /* Unmask the session done interrupt */
+       writel(IER_I2C_INT_EN_MASK, dev->base + IER_OFFSET);
+       /* Mark as incomplete before sending the data */
 -      INIT_COMPLETION(dev->done);
++      reinit_completion(&dev->done);
+       /* Send one byte of data */
+       writel(data, dev->base + DAT_OFFSET);
+       /* Wait for byte to be written */
+       time_left = wait_for_completion_timeout(&dev->done, time_left);
+       /* Mask all interrupts */
+       writel(0, dev->base + IER_OFFSET);
+       if (!time_left) {
+               dev_dbg(dev->device, "controller timed out\n");
+               return -ETIMEDOUT;
+       }
+       nak_received = readl(dev->base + CS_OFFSET) & CS_ACK_MASK ? 1 : 0;
+       if (nak_received ^ nak_expected) {
+               dev_dbg(dev->device, "unexpected NAK/ACK\n");
+               return -EREMOTEIO;
+       }
+       return 0;
+ }
+ /* Write a single TX FIFO worth of data to the i2c bus */
+ static int bcm_kona_i2c_write_fifo_single(struct bcm_kona_i2c_dev *dev,
+                                         uint8_t *buf, unsigned int len)
+ {
+       int k;
+       unsigned long time_left = msecs_to_jiffies(I2C_TIMEOUT);
+       unsigned int fifo_status;
+       /* Mark as incomplete before sending data to the TX FIFO */
++      reinit_completion(&dev->done);
+       /* Unmask the fifo empty and nak interrupt */
+       writel(IER_FIFO_INT_EN_MASK | IER_NOACK_EN_MASK,
+              dev->base + IER_OFFSET);
+       /* Disable IRQ to load a FIFO worth of data without interruption */
+       disable_irq(dev->irq);
+       /* Write data into FIFO */
+       for (k = 0; k < len; k++)
+               writel(buf[k], (dev->base + DAT_OFFSET));
+       /* Enable IRQ now that data has been loaded */
+       enable_irq(dev->irq);
+       /* Wait for FIFO to empty */
+       do {
+               time_left = wait_for_completion_timeout(&dev->done, time_left);
+               fifo_status = readl(dev->base + FIFO_STATUS_OFFSET);
+       } while (time_left && !(fifo_status & FIFO_STATUS_TXFIFO_EMPTY_MASK));
+       /* Mask all interrupts */
+       writel(0, dev->base + IER_OFFSET);
+       /* Check if there was a NAK */
+       if (readl(dev->base + CS_OFFSET) & CS_ACK_MASK) {
+               dev_err(dev->device, "unexpected NAK\n");
+               return -EREMOTEIO;
+       }
+       /* Check if a timeout occured */
+       if (!time_left) {
+               dev_err(dev->device, "completion timed out\n");
+               return -EREMOTEIO;
+       }
+       return 0;
+ }
+ /* Write any amount of data using TX FIFO to the i2c bus */
+ static int bcm_kona_i2c_write_fifo(struct bcm_kona_i2c_dev *dev,
+                                  struct i2c_msg *msg)
+ {
+       unsigned int bytes_to_write = MAX_TX_FIFO_SIZE;
+       unsigned int bytes_written = 0;
+       int rc;
+       uint8_t *tmp_buf = msg->buf;
+       while (bytes_written < msg->len) {
+               if (msg->len - bytes_written <= MAX_TX_FIFO_SIZE)
+                       bytes_to_write = msg->len - bytes_written;
+               rc = bcm_kona_i2c_write_fifo_single(dev, tmp_buf,
+                                                   bytes_to_write);
+               if (rc < 0)
+                       return -EREMOTEIO;
+               bytes_written += bytes_to_write;
+               tmp_buf += bytes_to_write;
+       }
+       return 0;
+ }
+ /* Send i2c address */
+ static int bcm_kona_i2c_do_addr(struct bcm_kona_i2c_dev *dev,
+                                    struct i2c_msg *msg)
+ {
+       unsigned char addr;
+       if (msg->flags & I2C_M_TEN) {
+               /* First byte is 11110XX0 where XX is upper 2 bits */
+               addr = 0xF0 | ((msg->addr & 0x300) >> 7);
+               if (bcm_kona_i2c_write_byte(dev, addr, 0) < 0)
+                       return -EREMOTEIO;
+               /* Second byte is the remaining 8 bits */
+               addr = msg->addr & 0xFF;
+               if (bcm_kona_i2c_write_byte(dev, addr, 0) < 0)
+                       return -EREMOTEIO;
+               if (msg->flags & I2C_M_RD) {
+                       /* For read, send restart command */
+                       if (bcm_kona_send_i2c_cmd(dev, BCM_CMD_RESTART) < 0)
+                               return -EREMOTEIO;
+                       /* Then re-send the first byte with the read bit set */
+                       addr = 0xF0 | ((msg->addr & 0x300) >> 7) | 0x01;
+                       if (bcm_kona_i2c_write_byte(dev, addr, 0) < 0)
+                               return -EREMOTEIO;
+               }
+       } else {
+               addr = msg->addr << 1;
+               if (msg->flags & I2C_M_RD)
+                       addr |= 1;
+               if (bcm_kona_i2c_write_byte(dev, addr, 0) < 0)
+                       return -EREMOTEIO;
+       }
+       return 0;
+ }
+ static void bcm_kona_i2c_enable_autosense(struct bcm_kona_i2c_dev *dev)
+ {
+       writel(readl(dev->base + CLKEN_OFFSET) & ~CLKEN_AUTOSENSE_OFF_MASK,
+              dev->base + CLKEN_OFFSET);
+ }
+ static void bcm_kona_i2c_config_timing(struct bcm_kona_i2c_dev *dev)
+ {
+       writel(readl(dev->base + HSTIM_OFFSET) & ~HSTIM_HS_MODE_MASK,
+              dev->base + HSTIM_OFFSET);
+       writel((dev->std_cfg->prescale << TIM_PRESCALE_SHIFT) |
+              (dev->std_cfg->time_p << TIM_P_SHIFT) |
+              (dev->std_cfg->no_div << TIM_NO_DIV_SHIFT) |
+              (dev->std_cfg->time_div  << TIM_DIV_SHIFT),
+              dev->base + TIM_OFFSET);
+       writel((dev->std_cfg->time_m << CLKEN_M_SHIFT) |
+              (dev->std_cfg->time_n << CLKEN_N_SHIFT) |
+              CLKEN_CLKEN_MASK,
+              dev->base + CLKEN_OFFSET);
+ }
+ static void bcm_kona_i2c_config_timing_hs(struct bcm_kona_i2c_dev *dev)
+ {
+       writel((dev->hs_cfg->prescale << TIM_PRESCALE_SHIFT) |
+              (dev->hs_cfg->time_p << TIM_P_SHIFT) |
+              (dev->hs_cfg->no_div << TIM_NO_DIV_SHIFT) |
+              (dev->hs_cfg->time_div << TIM_DIV_SHIFT),
+              dev->base + TIM_OFFSET);
+       writel((dev->hs_cfg->hs_hold << HSTIM_HS_HOLD_SHIFT) |
+              (dev->hs_cfg->hs_high_phase << HSTIM_HS_HIGH_PHASE_SHIFT) |
+              (dev->hs_cfg->hs_setup << HSTIM_HS_SETUP_SHIFT),
+              dev->base + HSTIM_OFFSET);
+       writel(readl(dev->base + HSTIM_OFFSET) | HSTIM_HS_MODE_MASK,
+              dev->base + HSTIM_OFFSET);
+ }
+ static int bcm_kona_i2c_switch_to_hs(struct bcm_kona_i2c_dev *dev)
+ {
+       int rc;
+       /* Send mastercode at standard speed */
+       rc = bcm_kona_i2c_write_byte(dev, MASTERCODE, 1);
+       if (rc < 0) {
+               pr_err("High speed handshake failed\n");
+               return rc;
+       }
+       /* Configure external clock to higher frequency */
+       rc = clk_set_rate(dev->external_clk, HS_EXT_CLK_FREQ);
+       if (rc) {
+               dev_err(dev->device, "%s: clk_set_rate returned %d\n",
+                       __func__, rc);
+               return rc;
+       }
+       /* Reconfigure internal dividers */
+       bcm_kona_i2c_config_timing_hs(dev);
+       /* Send a restart command */
+       rc = bcm_kona_send_i2c_cmd(dev, BCM_CMD_RESTART);
+       if (rc < 0)
+               dev_err(dev->device, "High speed restart command failed\n");
+       return rc;
+ }
+ static int bcm_kona_i2c_switch_to_std(struct bcm_kona_i2c_dev *dev)
+ {
+       int rc;
+       /* Reconfigure internal dividers */
+       bcm_kona_i2c_config_timing(dev);
+       /* Configure external clock to lower frequency */
+       rc = clk_set_rate(dev->external_clk, STD_EXT_CLK_FREQ);
+       if (rc) {
+               dev_err(dev->device, "%s: clk_set_rate returned %d\n",
+                       __func__, rc);
+       }
+       return rc;
+ }
+ /* Master transfer function */
+ static int bcm_kona_i2c_xfer(struct i2c_adapter *adapter,
+                            struct i2c_msg msgs[], int num)
+ {
+       struct bcm_kona_i2c_dev *dev = i2c_get_adapdata(adapter);
+       struct i2c_msg *pmsg;
+       int rc = 0;
+       int i;
+       rc = clk_prepare_enable(dev->external_clk);
+       if (rc) {
+               dev_err(dev->device, "%s: peri clock enable failed. err %d\n",
+                       __func__, rc);
+               return rc;
+       }
+       /* Enable pad output */
+       writel(0, dev->base + PADCTL_OFFSET);
+       /* Enable internal clocks */
+       bcm_kona_i2c_enable_clock(dev);
+       /* Send start command */
+       rc = bcm_kona_send_i2c_cmd(dev, BCM_CMD_START);
+       if (rc < 0) {
+               dev_err(dev->device, "Start command failed rc = %d\n", rc);
+               goto xfer_disable_pad;
+       }
+       /* Switch to high speed if applicable */
+       if (dev->hs_cfg) {
+               rc = bcm_kona_i2c_switch_to_hs(dev);
+               if (rc < 0)
+                       goto xfer_send_stop;
+       }
+       /* Loop through all messages */
+       for (i = 0; i < num; i++) {
+               pmsg = &msgs[i];
+               /* Send restart for subsequent messages */
+               if ((i != 0) && ((pmsg->flags & I2C_M_NOSTART) == 0)) {
+                       rc = bcm_kona_send_i2c_cmd(dev, BCM_CMD_RESTART);
+                       if (rc < 0) {
+                               dev_err(dev->device,
+                                       "restart cmd failed rc = %d\n", rc);
+                                       goto xfer_send_stop;
+                       }
+               }
+               /* Send slave address */
+               if (!(pmsg->flags & I2C_M_NOSTART)) {
+                       rc = bcm_kona_i2c_do_addr(dev, pmsg);
+                       if (rc < 0) {
+                               dev_err(dev->device,
+                                       "NAK from addr %2.2x msg#%d rc = %d\n",
+                                       pmsg->addr, i, rc);
+                               goto xfer_send_stop;
+                       }
+               }
+               /* Perform data transfer */
+               if (pmsg->flags & I2C_M_RD) {
+                       rc = bcm_kona_i2c_read_fifo(dev, pmsg);
+                       if (rc < 0) {
+                               dev_err(dev->device, "read failure\n");
+                               goto xfer_send_stop;
+                       }
+               } else {
+                       rc = bcm_kona_i2c_write_fifo(dev, pmsg);
+                       if (rc < 0) {
+                               dev_err(dev->device, "write failure");
+                               goto xfer_send_stop;
+                       }
+               }
+       }
+       rc = num;
+ xfer_send_stop:
+       /* Send a STOP command */
+       bcm_kona_send_i2c_cmd(dev, BCM_CMD_STOP);
+       /* Return from high speed if applicable */
+       if (dev->hs_cfg) {
+               int hs_rc = bcm_kona_i2c_switch_to_std(dev);
+               if (hs_rc)
+                       rc = hs_rc;
+       }
+ xfer_disable_pad:
+       /* Disable pad output */
+       writel(PADCTL_PAD_OUT_EN_MASK, dev->base + PADCTL_OFFSET);
+       /* Stop internal clock */
+       bcm_kona_i2c_disable_clock(dev);
+       clk_disable_unprepare(dev->external_clk);
+       return rc;
+ }
+ static uint32_t bcm_kona_i2c_functionality(struct i2c_adapter *adap)
+ {
+       return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR |
+           I2C_FUNC_NOSTART;
+ }
+ static const struct i2c_algorithm bcm_algo = {
+       .master_xfer = bcm_kona_i2c_xfer,
+       .functionality = bcm_kona_i2c_functionality,
+ };
+ static int bcm_kona_i2c_assign_bus_speed(struct bcm_kona_i2c_dev *dev)
+ {
+       unsigned int bus_speed;
+       int ret = of_property_read_u32(dev->device->of_node, "clock-frequency",
+                                      &bus_speed);
+       if (ret < 0) {
+               dev_err(dev->device, "missing clock-frequency property\n");
+               return -ENODEV;
+       }
+       switch (bus_speed) {
+       case 100000:
+               dev->std_cfg = &std_cfg_table[BCM_SPD_100K];
+               break;
+       case 400000:
+               dev->std_cfg = &std_cfg_table[BCM_SPD_400K];
+               break;
+       case 1000000:
+               dev->std_cfg = &std_cfg_table[BCM_SPD_1MHZ];
+               break;
+       case 3400000:
+               /* Send mastercode at 100k */
+               dev->std_cfg = &std_cfg_table[BCM_SPD_100K];
+               dev->hs_cfg = &hs_cfg_table[BCM_SPD_3P4MHZ];
+               break;
+       default:
+               pr_err("%d hz bus speed not supported\n", bus_speed);
+               pr_err("Valid speeds are 100khz, 400khz, 1mhz, and 3.4mhz\n");
+               return -EINVAL;
+       }
+       return 0;
+ }
+ static int bcm_kona_i2c_probe(struct platform_device *pdev)
+ {
+       int rc = 0;
+       struct bcm_kona_i2c_dev *dev;
+       struct i2c_adapter *adap;
+       struct resource *iomem;
+       /* Allocate memory for private data structure */
+       dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
+       if (!dev)
+               return -ENOMEM;
+       platform_set_drvdata(pdev, dev);
+       dev->device = &pdev->dev;
+       init_completion(&dev->done);
+       /* Map hardware registers */
+       iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       dev->base = devm_ioremap_resource(dev->device, iomem);
+       if (IS_ERR(dev->base))
+               return -ENOMEM;
+       /* Get and enable external clock */
+       dev->external_clk = devm_clk_get(dev->device, NULL);
+       if (IS_ERR(dev->external_clk)) {
+               dev_err(dev->device, "couldn't get clock\n");
+               return -ENODEV;
+       }
+       rc = clk_set_rate(dev->external_clk, STD_EXT_CLK_FREQ);
+       if (rc) {
+               dev_err(dev->device, "%s: clk_set_rate returned %d\n",
+                       __func__, rc);
+               return rc;
+       }
+       rc = clk_prepare_enable(dev->external_clk);
+       if (rc) {
+               dev_err(dev->device, "couldn't enable clock\n");
+               return rc;
+       }
+       /* Parse bus speed */
+       rc = bcm_kona_i2c_assign_bus_speed(dev);
+       if (rc)
+               goto probe_disable_clk;
+       /* Enable internal clocks */
+       bcm_kona_i2c_enable_clock(dev);
+       /* Configure internal dividers */
+       bcm_kona_i2c_config_timing(dev);
+       /* Disable timeout */
+       writel(0, dev->base + TOUT_OFFSET);
+       /* Enable autosense */
+       bcm_kona_i2c_enable_autosense(dev);
+       /* Enable TX FIFO */
+       writel(TXFCR_FIFO_FLUSH_MASK | TXFCR_FIFO_EN_MASK,
+              dev->base + TXFCR_OFFSET);
+       /* Mask all interrupts */
+       writel(0, dev->base + IER_OFFSET);
+       /* Clear all pending interrupts */
+       writel(ISR_CMDBUSY_MASK |
+              ISR_READ_COMPLETE_MASK |
+              ISR_SES_DONE_MASK |
+              ISR_ERR_MASK |
+              ISR_TXFIFOEMPTY_MASK |
+              ISR_NOACK_MASK,
+              dev->base + ISR_OFFSET);
+       /* Get the interrupt number */
+       dev->irq = platform_get_irq(pdev, 0);
+       if (dev->irq < 0) {
+               dev_err(dev->device, "no irq resource\n");
+               rc = -ENODEV;
+               goto probe_disable_clk;
+       }
+       /* register the ISR handler */
+       rc = devm_request_irq(&pdev->dev, dev->irq, bcm_kona_i2c_isr,
+                             IRQF_SHARED, pdev->name, dev);
+       if (rc) {
+               dev_err(dev->device, "failed to request irq %i\n", dev->irq);
+               goto probe_disable_clk;
+       }
+       /* Enable the controller but leave it idle */
+       bcm_kona_i2c_send_cmd_to_ctrl(dev, BCM_CMD_NOACTION);
+       /* Disable pad output */
+       writel(PADCTL_PAD_OUT_EN_MASK, dev->base + PADCTL_OFFSET);
+       /* Disable internal clock */
+       bcm_kona_i2c_disable_clock(dev);
+       /* Disable external clock */
+       clk_disable_unprepare(dev->external_clk);
+       /* Add the i2c adapter */
+       adap = &dev->adapter;
+       i2c_set_adapdata(adap, dev);
+       adap->owner = THIS_MODULE;
+       strlcpy(adap->name, "Broadcom I2C adapter", sizeof(adap->name));
+       adap->algo = &bcm_algo;
+       adap->dev.parent = &pdev->dev;
+       adap->dev.of_node = pdev->dev.of_node;
+       rc = i2c_add_adapter(adap);
+       if (rc) {
+               dev_err(dev->device, "failed to add adapter\n");
+               return rc;
+       }
+       dev_info(dev->device, "device registered successfully\n");
+       return 0;
+ probe_disable_clk:
+       bcm_kona_i2c_disable_clock(dev);
+       clk_disable_unprepare(dev->external_clk);
+       return rc;
+ }
+ static int bcm_kona_i2c_remove(struct platform_device *pdev)
+ {
+       struct bcm_kona_i2c_dev *dev = platform_get_drvdata(pdev);
+       i2c_del_adapter(&dev->adapter);
+       return 0;
+ }
+ static const struct of_device_id bcm_kona_i2c_of_match[] = {
+       {.compatible = "brcm,kona-i2c",},
+       {},
+ };
+ MODULE_DEVICE_TABLE(of, kona_i2c_of_match);
+ static struct platform_driver bcm_kona_i2c_driver = {
+       .driver = {
+                  .name = "bcm-kona-i2c",
+                  .owner = THIS_MODULE,
+                  .of_match_table = bcm_kona_i2c_of_match,
+                  },
+       .probe = bcm_kona_i2c_probe,
+       .remove = bcm_kona_i2c_remove,
+ };
+ module_platform_driver(bcm_kona_i2c_driver);
+ MODULE_AUTHOR("Tim Kryger <tkryger@broadcom.com>");
+ MODULE_DESCRIPTION("Broadcom Kona I2C Driver");
+ MODULE_LICENSE("GPL v2");
index 960dec61c64ecc582472a149e37253a3f3e3b3bf,85e8ad6056c4abce8f02bab4afc2e0a9a1cc0e15..ff05d9fef4a8ee22f40c981bd11e90e9ad24e51e
@@@ -323,7 -323,7 +323,7 @@@ i2c_davinci_xfer_msg(struct i2c_adapte
  
        davinci_i2c_write_reg(dev, DAVINCI_I2C_CNT_REG, dev->buf_len);
  
 -      INIT_COMPLETION(dev->cmd_complete);
 +      reinit_completion(&dev->cmd_complete);
        dev->cmd_err = 0;
  
        /* Take I2C out of reset and configure it as master */
@@@ -795,7 -795,7 +795,7 @@@ static struct platform_driver davinci_i
                .name   = "i2c_davinci",
                .owner  = THIS_MODULE,
                .pm     = davinci_i2c_pm_ops,
-               .of_match_table = of_match_ptr(davinci_i2c_of_match),
+               .of_match_table = davinci_i2c_of_match,
        },
  };
  
index 0aa01136f8d955148d984ac00e06ffb9e8ce1196,c4ca1aae98d40135a7bbccc6cec2fb0ba452fd1d..d0bdac0498cebafe3def932006c1380cfc318c1f
@@@ -103,6 -103,8 +103,8 @@@ static int dw_i2c_acpi_configure(struc
  static const struct acpi_device_id dw_i2c_acpi_match[] = {
        { "INT33C2", 0 },
        { "INT33C3", 0 },
+       { "INT3432", 0 },
+       { "INT3433", 0 },
        { "80860F41", 0 },
        { }
  };
@@@ -270,8 -272,7 +272,8 @@@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_
  MODULE_ALIAS("platform:i2c_designware");
  
  static struct platform_driver dw_i2c_driver = {
 -      .remove         = dw_i2c_remove,
 +      .probe = dw_i2c_probe,
 +      .remove = dw_i2c_remove,
        .driver         = {
                .name   = "i2c_designware",
                .owner  = THIS_MODULE,
  
  static int __init dw_i2c_init_driver(void)
  {
 -      return platform_driver_probe(&dw_i2c_driver, dw_i2c_probe);
 +      return platform_driver_register(&dw_i2c_driver);
  }
  subsys_initcall(dw_i2c_init_driver);
  
index 0000000000000000000000000000000000000000,da39ff0deab52d78044fb30a077a250f1aa30b47..c1ef228095b5d456608c6b155144a4ec29d9d49e
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,769 +1,769 @@@
 -      INIT_COMPLETION(i2c->msg_complete);
+ /**
+  * i2c-exynos5.c - Samsung Exynos5 I2C Controller Driver
+  *
+  * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License version 2 as
+  * published by the Free Software Foundation.
+ */
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/i2c.h>
+ #include <linux/init.h>
+ #include <linux/time.h>
+ #include <linux/interrupt.h>
+ #include <linux/delay.h>
+ #include <linux/errno.h>
+ #include <linux/err.h>
+ #include <linux/platform_device.h>
+ #include <linux/clk.h>
+ #include <linux/slab.h>
+ #include <linux/io.h>
+ #include <linux/of_address.h>
+ #include <linux/of_irq.h>
+ #include <linux/spinlock.h>
+ /*
+  * HSI2C controller from Samsung supports 2 modes of operation
+  * 1. Auto mode: Where in master automatically controls the whole transaction
+  * 2. Manual mode: Software controls the transaction by issuing commands
+  *    START, READ, WRITE, STOP, RESTART in I2C_MANUAL_CMD register.
+  *
+  * Operation mode can be selected by setting AUTO_MODE bit in I2C_CONF register
+  *
+  * Special bits are available for both modes of operation to set commands
+  * and for checking transfer status
+  */
+ /* Register Map */
+ #define HSI2C_CTL             0x00
+ #define HSI2C_FIFO_CTL                0x04
+ #define HSI2C_TRAILIG_CTL     0x08
+ #define HSI2C_CLK_CTL         0x0C
+ #define HSI2C_CLK_SLOT                0x10
+ #define HSI2C_INT_ENABLE      0x20
+ #define HSI2C_INT_STATUS      0x24
+ #define HSI2C_ERR_STATUS      0x2C
+ #define HSI2C_FIFO_STATUS     0x30
+ #define HSI2C_TX_DATA         0x34
+ #define HSI2C_RX_DATA         0x38
+ #define HSI2C_CONF            0x40
+ #define HSI2C_AUTO_CONF               0x44
+ #define HSI2C_TIMEOUT         0x48
+ #define HSI2C_MANUAL_CMD      0x4C
+ #define HSI2C_TRANS_STATUS    0x50
+ #define HSI2C_TIMING_HS1      0x54
+ #define HSI2C_TIMING_HS2      0x58
+ #define HSI2C_TIMING_HS3      0x5C
+ #define HSI2C_TIMING_FS1      0x60
+ #define HSI2C_TIMING_FS2      0x64
+ #define HSI2C_TIMING_FS3      0x68
+ #define HSI2C_TIMING_SLA      0x6C
+ #define HSI2C_ADDR            0x70
+ /* I2C_CTL Register bits */
+ #define HSI2C_FUNC_MODE_I2C                   (1u << 0)
+ #define HSI2C_MASTER                          (1u << 3)
+ #define HSI2C_RXCHON                          (1u << 6)
+ #define HSI2C_TXCHON                          (1u << 7)
+ #define HSI2C_SW_RST                          (1u << 31)
+ /* I2C_FIFO_CTL Register bits */
+ #define HSI2C_RXFIFO_EN                               (1u << 0)
+ #define HSI2C_TXFIFO_EN                               (1u << 1)
+ #define HSI2C_RXFIFO_TRIGGER_LEVEL(x)         ((x) << 4)
+ #define HSI2C_TXFIFO_TRIGGER_LEVEL(x)         ((x) << 16)
+ /* As per user manual FIFO max depth is 64bytes */
+ #define HSI2C_FIFO_MAX                                0x40
+ /* default trigger levels for Tx and Rx FIFOs */
+ #define HSI2C_DEF_TXFIFO_LVL                  (HSI2C_FIFO_MAX - 0x30)
+ #define HSI2C_DEF_RXFIFO_LVL                  (HSI2C_FIFO_MAX - 0x10)
+ /* I2C_TRAILING_CTL Register bits */
+ #define HSI2C_TRAILING_COUNT                  (0xf)
+ /* I2C_INT_EN Register bits */
+ #define HSI2C_INT_TX_ALMOSTEMPTY_EN           (1u << 0)
+ #define HSI2C_INT_RX_ALMOSTFULL_EN            (1u << 1)
+ #define HSI2C_INT_TRAILING_EN                 (1u << 6)
+ #define HSI2C_INT_I2C_EN                      (1u << 9)
+ /* I2C_INT_STAT Register bits */
+ #define HSI2C_INT_TX_ALMOSTEMPTY              (1u << 0)
+ #define HSI2C_INT_RX_ALMOSTFULL                       (1u << 1)
+ #define HSI2C_INT_TX_UNDERRUN                 (1u << 2)
+ #define HSI2C_INT_TX_OVERRUN                  (1u << 3)
+ #define HSI2C_INT_RX_UNDERRUN                 (1u << 4)
+ #define HSI2C_INT_RX_OVERRUN                  (1u << 5)
+ #define HSI2C_INT_TRAILING                    (1u << 6)
+ #define HSI2C_INT_I2C                         (1u << 9)
+ /* I2C_FIFO_STAT Register bits */
+ #define HSI2C_RX_FIFO_EMPTY                   (1u << 24)
+ #define HSI2C_RX_FIFO_FULL                    (1u << 23)
+ #define HSI2C_RX_FIFO_LVL(x)                  ((x >> 16) & 0x7f)
+ #define HSI2C_TX_FIFO_EMPTY                   (1u << 8)
+ #define HSI2C_TX_FIFO_FULL                    (1u << 7)
+ #define HSI2C_TX_FIFO_LVL(x)                  ((x >> 0) & 0x7f)
+ /* I2C_CONF Register bits */
+ #define HSI2C_AUTO_MODE                               (1u << 31)
+ #define HSI2C_10BIT_ADDR_MODE                 (1u << 30)
+ #define HSI2C_HS_MODE                         (1u << 29)
+ /* I2C_AUTO_CONF Register bits */
+ #define HSI2C_READ_WRITE                      (1u << 16)
+ #define HSI2C_STOP_AFTER_TRANS                        (1u << 17)
+ #define HSI2C_MASTER_RUN                      (1u << 31)
+ /* I2C_TIMEOUT Register bits */
+ #define HSI2C_TIMEOUT_EN                      (1u << 31)
+ #define HSI2C_TIMEOUT_MASK                    0xff
+ /* I2C_TRANS_STATUS register bits */
+ #define HSI2C_MASTER_BUSY                     (1u << 17)
+ #define HSI2C_SLAVE_BUSY                      (1u << 16)
+ #define HSI2C_TIMEOUT_AUTO                    (1u << 4)
+ #define HSI2C_NO_DEV                          (1u << 3)
+ #define HSI2C_NO_DEV_ACK                      (1u << 2)
+ #define HSI2C_TRANS_ABORT                     (1u << 1)
+ #define HSI2C_TRANS_DONE                      (1u << 0)
+ /* I2C_ADDR register bits */
+ #define HSI2C_SLV_ADDR_SLV(x)                 ((x & 0x3ff) << 0)
+ #define HSI2C_SLV_ADDR_MAS(x)                 ((x & 0x3ff) << 10)
+ #define HSI2C_MASTER_ID(x)                    ((x & 0xff) << 24)
+ #define MASTER_ID(x)                          ((x & 0x7) + 0x08)
+ /*
+  * Controller operating frequency, timing values for operation
+  * are calculated against this frequency
+  */
+ #define HSI2C_HS_TX_CLOCK     1000000
+ #define HSI2C_FS_TX_CLOCK     100000
+ #define HSI2C_HIGH_SPD                1
+ #define HSI2C_FAST_SPD                0
+ #define EXYNOS5_I2C_TIMEOUT (msecs_to_jiffies(1000))
+ struct exynos5_i2c {
+       struct i2c_adapter      adap;
+       unsigned int            suspended:1;
+       struct i2c_msg          *msg;
+       struct completion       msg_complete;
+       unsigned int            msg_ptr;
+       unsigned int            irq;
+       void __iomem            *regs;
+       struct clk              *clk;
+       struct device           *dev;
+       int                     state;
+       spinlock_t              lock;           /* IRQ synchronization */
+       /*
+        * Since the TRANS_DONE bit is cleared on read, and we may read it
+        * either during an IRQ or after a transaction, keep track of its
+        * state here.
+        */
+       int                     trans_done;
+       /* Controller operating frequency */
+       unsigned int            fs_clock;
+       unsigned int            hs_clock;
+       /*
+        * HSI2C Controller can operate in
+        * 1. High speed upto 3.4Mbps
+        * 2. Fast speed upto 1Mbps
+        */
+       int                     speed_mode;
+ };
+ static const struct of_device_id exynos5_i2c_match[] = {
+       { .compatible = "samsung,exynos5-hsi2c" },
+       {},
+ };
+ MODULE_DEVICE_TABLE(of, exynos5_i2c_match);
+ static void exynos5_i2c_clr_pend_irq(struct exynos5_i2c *i2c)
+ {
+       writel(readl(i2c->regs + HSI2C_INT_STATUS),
+                               i2c->regs + HSI2C_INT_STATUS);
+ }
+ /*
+  * exynos5_i2c_set_timing: updates the registers with appropriate
+  * timing values calculated
+  *
+  * Returns 0 on success, -EINVAL if the cycle length cannot
+  * be calculated.
+  */
+ static int exynos5_i2c_set_timing(struct exynos5_i2c *i2c, int mode)
+ {
+       u32 i2c_timing_s1;
+       u32 i2c_timing_s2;
+       u32 i2c_timing_s3;
+       u32 i2c_timing_sla;
+       unsigned int t_start_su, t_start_hd;
+       unsigned int t_stop_su;
+       unsigned int t_data_su, t_data_hd;
+       unsigned int t_scl_l, t_scl_h;
+       unsigned int t_sr_release;
+       unsigned int t_ftl_cycle;
+       unsigned int clkin = clk_get_rate(i2c->clk);
+       unsigned int div, utemp0 = 0, utemp1 = 0, clk_cycle;
+       unsigned int op_clk = (mode == HSI2C_HIGH_SPD) ?
+                               i2c->hs_clock : i2c->fs_clock;
+       /*
+        * FPCLK / FI2C =
+        * (CLK_DIV + 1) * (TSCLK_L + TSCLK_H + 2) + 8 + 2 * FLT_CYCLE
+        * utemp0 = (CLK_DIV + 1) * (TSCLK_L + TSCLK_H + 2)
+        * utemp1 = (TSCLK_L + TSCLK_H + 2)
+        */
+       t_ftl_cycle = (readl(i2c->regs + HSI2C_CONF) >> 16) & 0x7;
+       utemp0 = (clkin / op_clk) - 8 - 2 * t_ftl_cycle;
+       /* CLK_DIV max is 256 */
+       for (div = 0; div < 256; div++) {
+               utemp1 = utemp0 / (div + 1);
+               /*
+                * SCL_L and SCL_H each has max value of 255
+                * Hence, For the clk_cycle to the have right value
+                * utemp1 has to be less then 512 and more than 4.
+                */
+               if ((utemp1 < 512) && (utemp1 > 4)) {
+                       clk_cycle = utemp1 - 2;
+                       break;
+               } else if (div == 255) {
+                       dev_warn(i2c->dev, "Failed to calculate divisor");
+                       return -EINVAL;
+               }
+       }
+       t_scl_l = clk_cycle / 2;
+       t_scl_h = clk_cycle / 2;
+       t_start_su = t_scl_l;
+       t_start_hd = t_scl_l;
+       t_stop_su = t_scl_l;
+       t_data_su = t_scl_l / 2;
+       t_data_hd = t_scl_l / 2;
+       t_sr_release = clk_cycle;
+       i2c_timing_s1 = t_start_su << 24 | t_start_hd << 16 | t_stop_su << 8;
+       i2c_timing_s2 = t_data_su << 24 | t_scl_l << 8 | t_scl_h << 0;
+       i2c_timing_s3 = div << 16 | t_sr_release << 0;
+       i2c_timing_sla = t_data_hd << 0;
+       dev_dbg(i2c->dev, "tSTART_SU: %X, tSTART_HD: %X, tSTOP_SU: %X\n",
+               t_start_su, t_start_hd, t_stop_su);
+       dev_dbg(i2c->dev, "tDATA_SU: %X, tSCL_L: %X, tSCL_H: %X\n",
+               t_data_su, t_scl_l, t_scl_h);
+       dev_dbg(i2c->dev, "nClkDiv: %X, tSR_RELEASE: %X\n",
+               div, t_sr_release);
+       dev_dbg(i2c->dev, "tDATA_HD: %X\n", t_data_hd);
+       if (mode == HSI2C_HIGH_SPD) {
+               writel(i2c_timing_s1, i2c->regs + HSI2C_TIMING_HS1);
+               writel(i2c_timing_s2, i2c->regs + HSI2C_TIMING_HS2);
+               writel(i2c_timing_s3, i2c->regs + HSI2C_TIMING_HS3);
+       } else {
+               writel(i2c_timing_s1, i2c->regs + HSI2C_TIMING_FS1);
+               writel(i2c_timing_s2, i2c->regs + HSI2C_TIMING_FS2);
+               writel(i2c_timing_s3, i2c->regs + HSI2C_TIMING_FS3);
+       }
+       writel(i2c_timing_sla, i2c->regs + HSI2C_TIMING_SLA);
+       return 0;
+ }
+ static int exynos5_hsi2c_clock_setup(struct exynos5_i2c *i2c)
+ {
+       /*
+        * Configure the Fast speed timing values
+        * Even the High Speed mode initially starts with Fast mode
+        */
+       if (exynos5_i2c_set_timing(i2c, HSI2C_FAST_SPD)) {
+               dev_err(i2c->dev, "HSI2C FS Clock set up failed\n");
+               return -EINVAL;
+       }
+       /* configure the High speed timing values */
+       if (i2c->speed_mode == HSI2C_HIGH_SPD) {
+               if (exynos5_i2c_set_timing(i2c, HSI2C_HIGH_SPD)) {
+                       dev_err(i2c->dev, "HSI2C HS Clock set up failed\n");
+                       return -EINVAL;
+               }
+       }
+       return 0;
+ }
+ /*
+  * exynos5_i2c_init: configures the controller for I2C functionality
+  * Programs I2C controller for Master mode operation
+  */
+ static void exynos5_i2c_init(struct exynos5_i2c *i2c)
+ {
+       u32 i2c_conf = readl(i2c->regs + HSI2C_CONF);
+       u32 i2c_timeout = readl(i2c->regs + HSI2C_TIMEOUT);
+       /* Clear to disable Timeout */
+       i2c_timeout &= ~HSI2C_TIMEOUT_EN;
+       writel(i2c_timeout, i2c->regs + HSI2C_TIMEOUT);
+       writel((HSI2C_FUNC_MODE_I2C | HSI2C_MASTER),
+                                       i2c->regs + HSI2C_CTL);
+       writel(HSI2C_TRAILING_COUNT, i2c->regs + HSI2C_TRAILIG_CTL);
+       if (i2c->speed_mode == HSI2C_HIGH_SPD) {
+               writel(HSI2C_MASTER_ID(MASTER_ID(i2c->adap.nr)),
+                                       i2c->regs + HSI2C_ADDR);
+               i2c_conf |= HSI2C_HS_MODE;
+       }
+       writel(i2c_conf | HSI2C_AUTO_MODE, i2c->regs + HSI2C_CONF);
+ }
+ static void exynos5_i2c_reset(struct exynos5_i2c *i2c)
+ {
+       u32 i2c_ctl;
+       /* Set and clear the bit for reset */
+       i2c_ctl = readl(i2c->regs + HSI2C_CTL);
+       i2c_ctl |= HSI2C_SW_RST;
+       writel(i2c_ctl, i2c->regs + HSI2C_CTL);
+       i2c_ctl = readl(i2c->regs + HSI2C_CTL);
+       i2c_ctl &= ~HSI2C_SW_RST;
+       writel(i2c_ctl, i2c->regs + HSI2C_CTL);
+       /* We don't expect calculations to fail during the run */
+       exynos5_hsi2c_clock_setup(i2c);
+       /* Initialize the configure registers */
+       exynos5_i2c_init(i2c);
+ }
+ /*
+  * exynos5_i2c_irq: top level IRQ servicing routine
+  *
+  * INT_STATUS registers gives the interrupt details. Further,
+  * FIFO_STATUS or TRANS_STATUS registers are to be check for detailed
+  * state of the bus.
+  */
+ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id)
+ {
+       struct exynos5_i2c *i2c = dev_id;
+       u32 fifo_level, int_status, fifo_status, trans_status;
+       unsigned char byte;
+       int len = 0;
+       i2c->state = -EINVAL;
+       spin_lock(&i2c->lock);
+       int_status = readl(i2c->regs + HSI2C_INT_STATUS);
+       writel(int_status, i2c->regs + HSI2C_INT_STATUS);
+       fifo_status = readl(i2c->regs + HSI2C_FIFO_STATUS);
+       /* handle interrupt related to the transfer status */
+       if (int_status & HSI2C_INT_I2C) {
+               trans_status = readl(i2c->regs + HSI2C_TRANS_STATUS);
+               if (trans_status & HSI2C_NO_DEV_ACK) {
+                       dev_dbg(i2c->dev, "No ACK from device\n");
+                       i2c->state = -ENXIO;
+                       goto stop;
+               } else if (trans_status & HSI2C_NO_DEV) {
+                       dev_dbg(i2c->dev, "No device\n");
+                       i2c->state = -ENXIO;
+                       goto stop;
+               } else if (trans_status & HSI2C_TRANS_ABORT) {
+                       dev_dbg(i2c->dev, "Deal with arbitration lose\n");
+                       i2c->state = -EAGAIN;
+                       goto stop;
+               } else if (trans_status & HSI2C_TIMEOUT_AUTO) {
+                       dev_dbg(i2c->dev, "Accessing device timed out\n");
+                       i2c->state = -EAGAIN;
+                       goto stop;
+               } else if (trans_status & HSI2C_TRANS_DONE) {
+                       i2c->trans_done = 1;
+                       i2c->state = 0;
+               }
+       }
+       if ((i2c->msg->flags & I2C_M_RD) && (int_status &
+                       (HSI2C_INT_TRAILING | HSI2C_INT_RX_ALMOSTFULL))) {
+               fifo_status = readl(i2c->regs + HSI2C_FIFO_STATUS);
+               fifo_level = HSI2C_RX_FIFO_LVL(fifo_status);
+               len = min(fifo_level, i2c->msg->len - i2c->msg_ptr);
+               while (len > 0) {
+                       byte = (unsigned char)
+                               readl(i2c->regs + HSI2C_RX_DATA);
+                       i2c->msg->buf[i2c->msg_ptr++] = byte;
+                       len--;
+               }
+               i2c->state = 0;
+       } else if (int_status & HSI2C_INT_TX_ALMOSTEMPTY) {
+               fifo_status = readl(i2c->regs + HSI2C_FIFO_STATUS);
+               fifo_level = HSI2C_TX_FIFO_LVL(fifo_status);
+               len = HSI2C_FIFO_MAX - fifo_level;
+               if (len > (i2c->msg->len - i2c->msg_ptr))
+                       len = i2c->msg->len - i2c->msg_ptr;
+               while (len > 0) {
+                       byte = i2c->msg->buf[i2c->msg_ptr++];
+                       writel(byte, i2c->regs + HSI2C_TX_DATA);
+                       len--;
+               }
+               i2c->state = 0;
+       }
+  stop:
+       if ((i2c->trans_done && (i2c->msg->len == i2c->msg_ptr)) ||
+           (i2c->state < 0)) {
+               writel(0, i2c->regs + HSI2C_INT_ENABLE);
+               exynos5_i2c_clr_pend_irq(i2c);
+               complete(&i2c->msg_complete);
+       }
+       spin_unlock(&i2c->lock);
+       return IRQ_HANDLED;
+ }
+ /*
+  * exynos5_i2c_wait_bus_idle
+  *
+  * Wait for the bus to go idle, indicated by the MASTER_BUSY bit being
+  * cleared.
+  *
+  * Returns -EBUSY if the bus cannot be bought to idle
+  */
+ static int exynos5_i2c_wait_bus_idle(struct exynos5_i2c *i2c)
+ {
+       unsigned long stop_time;
+       u32 trans_status;
+       /* wait for 100 milli seconds for the bus to be idle */
+       stop_time = jiffies + msecs_to_jiffies(100) + 1;
+       do {
+               trans_status = readl(i2c->regs + HSI2C_TRANS_STATUS);
+               if (!(trans_status & HSI2C_MASTER_BUSY))
+                       return 0;
+               usleep_range(50, 200);
+       } while (time_before(jiffies, stop_time));
+       return -EBUSY;
+ }
+ /*
+  * exynos5_i2c_message_start: Configures the bus and starts the xfer
+  * i2c: struct exynos5_i2c pointer for the current bus
+  * stop: Enables stop after transfer if set. Set for last transfer of
+  *       in the list of messages.
+  *
+  * Configures the bus for read/write function
+  * Sets chip address to talk to, message length to be sent.
+  * Enables appropriate interrupts and sends start xfer command.
+  */
+ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop)
+ {
+       u32 i2c_ctl;
+       u32 int_en = HSI2C_INT_I2C_EN;
+       u32 i2c_auto_conf = 0;
+       u32 fifo_ctl;
+       unsigned long flags;
+       i2c_ctl = readl(i2c->regs + HSI2C_CTL);
+       i2c_ctl &= ~(HSI2C_TXCHON | HSI2C_RXCHON);
+       fifo_ctl = HSI2C_RXFIFO_EN | HSI2C_TXFIFO_EN;
+       if (i2c->msg->flags & I2C_M_RD) {
+               i2c_ctl |= HSI2C_RXCHON;
+               i2c_auto_conf = HSI2C_READ_WRITE;
+               fifo_ctl |= HSI2C_RXFIFO_TRIGGER_LEVEL(HSI2C_DEF_TXFIFO_LVL);
+               int_en |= (HSI2C_INT_RX_ALMOSTFULL_EN |
+                       HSI2C_INT_TRAILING_EN);
+       } else {
+               i2c_ctl |= HSI2C_TXCHON;
+               fifo_ctl |= HSI2C_TXFIFO_TRIGGER_LEVEL(HSI2C_DEF_RXFIFO_LVL);
+               int_en |= HSI2C_INT_TX_ALMOSTEMPTY_EN;
+       }
+       writel(HSI2C_SLV_ADDR_MAS(i2c->msg->addr), i2c->regs + HSI2C_ADDR);
+       writel(fifo_ctl, i2c->regs + HSI2C_FIFO_CTL);
+       writel(i2c_ctl, i2c->regs + HSI2C_CTL);
+       /*
+        * Enable interrupts before starting the transfer so that we don't
+        * miss any INT_I2C interrupts.
+        */
+       spin_lock_irqsave(&i2c->lock, flags);
+       writel(int_en, i2c->regs + HSI2C_INT_ENABLE);
+       if (stop == 1)
+               i2c_auto_conf |= HSI2C_STOP_AFTER_TRANS;
+       i2c_auto_conf |= i2c->msg->len;
+       i2c_auto_conf |= HSI2C_MASTER_RUN;
+       writel(i2c_auto_conf, i2c->regs + HSI2C_AUTO_CONF);
+       spin_unlock_irqrestore(&i2c->lock, flags);
+ }
+ static int exynos5_i2c_xfer_msg(struct exynos5_i2c *i2c,
+                             struct i2c_msg *msgs, int stop)
+ {
+       unsigned long timeout;
+       int ret;
+       i2c->msg = msgs;
+       i2c->msg_ptr = 0;
+       i2c->trans_done = 0;
++      reinit_completion(&i2c->msg_complete);
+       exynos5_i2c_message_start(i2c, stop);
+       timeout = wait_for_completion_timeout(&i2c->msg_complete,
+                                             EXYNOS5_I2C_TIMEOUT);
+       if (timeout == 0)
+               ret = -ETIMEDOUT;
+       else
+               ret = i2c->state;
+       /*
+        * If this is the last message to be transfered (stop == 1)
+        * Then check if the bus can be brought back to idle.
+        */
+       if (ret == 0 && stop)
+               ret = exynos5_i2c_wait_bus_idle(i2c);
+       if (ret < 0) {
+               exynos5_i2c_reset(i2c);
+               if (ret == -ETIMEDOUT)
+                       dev_warn(i2c->dev, "%s timeout\n",
+                                (msgs->flags & I2C_M_RD) ? "rx" : "tx");
+       }
+       /* Return the state as in interrupt routine */
+       return ret;
+ }
+ static int exynos5_i2c_xfer(struct i2c_adapter *adap,
+                       struct i2c_msg *msgs, int num)
+ {
+       struct exynos5_i2c *i2c = (struct exynos5_i2c *)adap->algo_data;
+       int i = 0, ret = 0, stop = 0;
+       if (i2c->suspended) {
+               dev_err(i2c->dev, "HS-I2C is not initialzed.\n");
+               return -EIO;
+       }
+       clk_prepare_enable(i2c->clk);
+       for (i = 0; i < num; i++, msgs++) {
+               stop = (i == num - 1);
+               ret = exynos5_i2c_xfer_msg(i2c, msgs, stop);
+               if (ret < 0)
+                       goto out;
+       }
+       if (i == num) {
+               ret = num;
+       } else {
+               /* Only one message, cannot access the device */
+               if (i == 1)
+                       ret = -EREMOTEIO;
+               else
+                       ret = i;
+               dev_warn(i2c->dev, "xfer message failed\n");
+       }
+  out:
+       clk_disable_unprepare(i2c->clk);
+       return ret;
+ }
+ static u32 exynos5_i2c_func(struct i2c_adapter *adap)
+ {
+       return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
+ }
+ static const struct i2c_algorithm exynos5_i2c_algorithm = {
+       .master_xfer            = exynos5_i2c_xfer,
+       .functionality          = exynos5_i2c_func,
+ };
+ static int exynos5_i2c_probe(struct platform_device *pdev)
+ {
+       struct device_node *np = pdev->dev.of_node;
+       struct exynos5_i2c *i2c;
+       struct resource *mem;
+       unsigned int op_clock;
+       int ret;
+       i2c = devm_kzalloc(&pdev->dev, sizeof(struct exynos5_i2c), GFP_KERNEL);
+       if (!i2c) {
+               dev_err(&pdev->dev, "no memory for state\n");
+               return -ENOMEM;
+       }
+       if (of_property_read_u32(np, "clock-frequency", &op_clock)) {
+               i2c->speed_mode = HSI2C_FAST_SPD;
+               i2c->fs_clock = HSI2C_FS_TX_CLOCK;
+       } else {
+               if (op_clock >= HSI2C_HS_TX_CLOCK) {
+                       i2c->speed_mode = HSI2C_HIGH_SPD;
+                       i2c->fs_clock = HSI2C_FS_TX_CLOCK;
+                       i2c->hs_clock = op_clock;
+               } else {
+                       i2c->speed_mode = HSI2C_FAST_SPD;
+                       i2c->fs_clock = op_clock;
+               }
+       }
+       strlcpy(i2c->adap.name, "exynos5-i2c", sizeof(i2c->adap.name));
+       i2c->adap.owner   = THIS_MODULE;
+       i2c->adap.algo    = &exynos5_i2c_algorithm;
+       i2c->adap.retries = 3;
+       i2c->dev = &pdev->dev;
+       i2c->clk = devm_clk_get(&pdev->dev, "hsi2c");
+       if (IS_ERR(i2c->clk)) {
+               dev_err(&pdev->dev, "cannot get clock\n");
+               return -ENOENT;
+       }
+       clk_prepare_enable(i2c->clk);
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       i2c->regs = devm_ioremap_resource(&pdev->dev, mem);
+       if (IS_ERR(i2c->regs)) {
+               ret = PTR_ERR(i2c->regs);
+               goto err_clk;
+       }
+       i2c->adap.dev.of_node = np;
+       i2c->adap.algo_data = i2c;
+       i2c->adap.dev.parent = &pdev->dev;
+       /* Clear pending interrupts from u-boot or misc causes */
+       exynos5_i2c_clr_pend_irq(i2c);
+       spin_lock_init(&i2c->lock);
+       init_completion(&i2c->msg_complete);
+       i2c->irq = ret = platform_get_irq(pdev, 0);
+       if (ret <= 0) {
+               dev_err(&pdev->dev, "cannot find HS-I2C IRQ\n");
+               ret = -EINVAL;
+               goto err_clk;
+       }
+       ret = devm_request_irq(&pdev->dev, i2c->irq, exynos5_i2c_irq,
+                               IRQF_NO_SUSPEND | IRQF_ONESHOT,
+                               dev_name(&pdev->dev), i2c);
+       if (ret != 0) {
+               dev_err(&pdev->dev, "cannot request HS-I2C IRQ %d\n", i2c->irq);
+               goto err_clk;
+       }
+       ret = exynos5_hsi2c_clock_setup(i2c);
+       if (ret)
+               goto err_clk;
+       exynos5_i2c_init(i2c);
+       ret = i2c_add_adapter(&i2c->adap);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "failed to add bus to i2c core\n");
+               goto err_clk;
+       }
+       platform_set_drvdata(pdev, i2c);
+  err_clk:
+       clk_disable_unprepare(i2c->clk);
+       return ret;
+ }
+ static int exynos5_i2c_remove(struct platform_device *pdev)
+ {
+       struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
+       i2c_del_adapter(&i2c->adap);
+       return 0;
+ }
+ static int exynos5_i2c_suspend_noirq(struct device *dev)
+ {
+       struct platform_device *pdev = to_platform_device(dev);
+       struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
+       i2c->suspended = 1;
+       return 0;
+ }
+ static int exynos5_i2c_resume_noirq(struct device *dev)
+ {
+       struct platform_device *pdev = to_platform_device(dev);
+       struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
+       int ret = 0;
+       clk_prepare_enable(i2c->clk);
+       ret = exynos5_hsi2c_clock_setup(i2c);
+       if (ret) {
+               clk_disable_unprepare(i2c->clk);
+               return ret;
+       }
+       exynos5_i2c_init(i2c);
+       clk_disable_unprepare(i2c->clk);
+       i2c->suspended = 0;
+       return 0;
+ }
+ static SIMPLE_DEV_PM_OPS(exynos5_i2c_dev_pm_ops, exynos5_i2c_suspend_noirq,
+                        exynos5_i2c_resume_noirq);
+ static struct platform_driver exynos5_i2c_driver = {
+       .probe          = exynos5_i2c_probe,
+       .remove         = exynos5_i2c_remove,
+       .driver         = {
+               .owner  = THIS_MODULE,
+               .name   = "exynos5-hsi2c",
+               .pm     = &exynos5_i2c_dev_pm_ops,
+               .of_match_table = exynos5_i2c_match,
+       },
+ };
+ module_platform_driver(exynos5_i2c_driver);
+ MODULE_DESCRIPTION("Exynos5 HS-I2C Bus driver");
+ MODULE_AUTHOR("Naveen Krishna Chatradhi, <ch.naveen@samsung.com>");
+ MODULE_AUTHOR("Taekgyun Ko, <taeggyun.ko@samsung.com>");
+ MODULE_LICENSE("GPL v2");
index 3aedd86a64682dcb775a040210a980c6f5679e12,0c74038b1eb84f5b3333fe8b427968ebb2410d30..0cde4e6ab2b2f127c450088c88f3775d337c6f6a
@@@ -1,6 -1,7 +1,7 @@@
  /*
   * Freescale MXS I2C bus driver
   *
+  * Copyright (C) 2012-2013 Marek Vasut <marex@denx.de>
   * Copyright (C) 2011-2012 Wolfram Sang, Pengutronix e.K.
   *
   * based on a (non-working) driver which was:
  
  #define MXS_I2C_CTRL0         (0x00)
  #define MXS_I2C_CTRL0_SET     (0x04)
+ #define MXS_I2C_CTRL0_CLR     (0x08)
  
  #define MXS_I2C_CTRL0_SFTRST                  0x80000000
  #define MXS_I2C_CTRL0_RUN                     0x20000000
  #define MXS_I2C_CTRL0_SEND_NAK_ON_LAST                0x02000000
+ #define MXS_I2C_CTRL0_PIO_MODE                        0x01000000
  #define MXS_I2C_CTRL0_RETAIN_CLOCK            0x00200000
  #define MXS_I2C_CTRL0_POST_SEND_STOP          0x00100000
  #define MXS_I2C_CTRL0_PRE_SEND_START          0x00080000
  #define MXS_I2C_CTRL1_SLAVE_IRQ                       0x01
  
  #define MXS_I2C_STAT          (0x50)
+ #define MXS_I2C_STAT_GOT_A_NAK                        0x10000000
  #define MXS_I2C_STAT_BUS_BUSY                 0x00000800
  #define MXS_I2C_STAT_CLK_GEN_BUSY             0x00000400
  
- #define MXS_I2C_DATA          (0xa0)
+ #define MXS_I2C_DATA(i2c)     ((i2c->dev_type == MXS_I2C_V1) ? 0x60 : 0xa0)
  
- #define MXS_I2C_DEBUG0                (0xb0)
- #define MXS_I2C_DEBUG0_CLR    (0xb8)
+ #define MXS_I2C_DEBUG0_CLR(i2c)       ((i2c->dev_type == MXS_I2C_V1) ? 0x78 : 0xb8)
  
  #define MXS_I2C_DEBUG0_DMAREQ 0x80000000
  
  #define MXS_CMD_I2C_READ      (MXS_I2C_CTRL0_SEND_NAK_ON_LAST | \
                                 MXS_I2C_CTRL0_MASTER_MODE)
  
+ enum mxs_i2c_devtype {
+       MXS_I2C_UNKNOWN = 0,
+       MXS_I2C_V1,
+       MXS_I2C_V2,
+ };
  /**
   * struct mxs_i2c_dev - per device, private MXS-I2C data
   *
   * @dev: driver model device node
+  * @dev_type: distinguish i.MX23/i.MX28 features
   * @regs: IO registers pointer
   * @cmd_complete: completion object for transaction wait
   * @cmd_err: error code for last transaction
   */
  struct mxs_i2c_dev {
        struct device *dev;
+       enum mxs_i2c_devtype dev_type;
        void __iomem *regs;
        struct completion cmd_complete;
        int cmd_err;
@@@ -291,48 -302,11 +302,11 @@@ write_init_pio_fail
        return -EINVAL;
  }
  
- static int mxs_i2c_pio_wait_dmareq(struct mxs_i2c_dev *i2c)
+ static int mxs_i2c_pio_wait_xfer_end(struct mxs_i2c_dev *i2c)
  {
        unsigned long timeout = jiffies + msecs_to_jiffies(1000);
  
-       while (!(readl(i2c->regs + MXS_I2C_DEBUG0) &
-               MXS_I2C_DEBUG0_DMAREQ)) {
-               if (time_after(jiffies, timeout))
-                       return -ETIMEDOUT;
-               cond_resched();
-       }
-       return 0;
- }
- static int mxs_i2c_pio_wait_cplt(struct mxs_i2c_dev *i2c, int last)
- {
-       unsigned long timeout = jiffies + msecs_to_jiffies(1000);
-       /*
-        * We do not use interrupts in the PIO mode. Due to the
-        * maximum transfer length being 8 bytes in PIO mode, the
-        * overhead of interrupt would be too large and this would
-        * neglect the gain from using the PIO mode.
-        */
-       while (!(readl(i2c->regs + MXS_I2C_CTRL1) &
-               MXS_I2C_CTRL1_DATA_ENGINE_CMPLT_IRQ)) {
-               if (time_after(jiffies, timeout))
-                       return -ETIMEDOUT;
-               cond_resched();
-       }
-       writel(MXS_I2C_CTRL1_DATA_ENGINE_CMPLT_IRQ,
-               i2c->regs + MXS_I2C_CTRL1_CLR);
-       /*
-        * When ending a transfer with a stop, we have to wait for the bus to
-        * go idle before we report the transfer as completed. Otherwise the
-        * start of the next transfer may race with the end of the current one.
-        */
-       while (last && (readl(i2c->regs + MXS_I2C_STAT) &
-                       (MXS_I2C_STAT_BUS_BUSY | MXS_I2C_STAT_CLK_GEN_BUSY))) {
+       while (readl(i2c->regs + MXS_I2C_CTRL0) & MXS_I2C_CTRL0_RUN) {
                if (time_after(jiffies, timeout))
                        return -ETIMEDOUT;
                cond_resched();
@@@ -370,106 -344,215 +344,215 @@@ static void mxs_i2c_pio_trigger_cmd(str
        writel(reg, i2c->regs + MXS_I2C_CTRL0);
  }
  
+ /*
+  * Start WRITE transaction on the I2C bus. By studying i.MX23 datasheet,
+  * CTRL0::PIO_MODE bit description clarifies the order in which the registers
+  * must be written during PIO mode operation. First, the CTRL0 register has
+  * to be programmed with all the necessary bits but the RUN bit. Then the
+  * payload has to be written into the DATA register. Finally, the transmission
+  * is executed by setting the RUN bit in CTRL0.
+  */
+ static void mxs_i2c_pio_trigger_write_cmd(struct mxs_i2c_dev *i2c, u32 cmd,
+                                         u32 data)
+ {
+       writel(cmd, i2c->regs + MXS_I2C_CTRL0);
+       if (i2c->dev_type == MXS_I2C_V1)
+               writel(MXS_I2C_CTRL0_PIO_MODE, i2c->regs + MXS_I2C_CTRL0_SET);
+       writel(data, i2c->regs + MXS_I2C_DATA(i2c));
+       writel(MXS_I2C_CTRL0_RUN, i2c->regs + MXS_I2C_CTRL0_SET);
+ }
  static int mxs_i2c_pio_setup_xfer(struct i2c_adapter *adap,
                        struct i2c_msg *msg, uint32_t flags)
  {
        struct mxs_i2c_dev *i2c = i2c_get_adapdata(adap);
        uint32_t addr_data = msg->addr << 1;
        uint32_t data = 0;
-       int i, shifts_left, ret;
+       int i, ret, xlen = 0, xmit = 0;
+       uint32_t start;
  
        /* Mute IRQs coming from this block. */
        writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_CLR);
  
+       /*
+        * MX23 idea:
+        * - Enable CTRL0::PIO_MODE (1 << 24)
+        * - Enable CTRL1::ACK_MODE (1 << 27)
+        *
+        * WARNING! The MX23 is broken in some way, even if it claims
+        * to support PIO, when we try to transfer any amount of data
+        * that is not aligned to 4 bytes, the DMA engine will have
+        * bits in DEBUG1::DMA_BYTES_ENABLES still set even after the
+        * transfer. This in turn will mess up the next transfer as
+        * the block it emit one byte write onto the bus terminated
+        * with a NAK+STOP. A possible workaround is to reset the IP
+        * block after every PIO transmission, which might just work.
+        *
+        * NOTE: The CTRL0::PIO_MODE description is important, since
+        * it outlines how the PIO mode is really supposed to work.
+        */
        if (msg->flags & I2C_M_RD) {
+               /*
+                * PIO READ transfer:
+                *
+                * This transfer MUST be limited to 4 bytes maximum. It is not
+                * possible to transfer more than four bytes via PIO, since we
+                * can not in any way make sure we can read the data from the
+                * DATA register fast enough. Besides, the RX FIFO is only four
+                * bytes deep, thus we can only really read up to four bytes at
+                * time. Finally, there is no bit indicating us that new data
+                * arrived at the FIFO and can thus be fetched from the DATA
+                * register.
+                */
+               BUG_ON(msg->len > 4);
                addr_data |= I2C_SMBUS_READ;
  
                /* SELECT command. */
-               mxs_i2c_pio_trigger_cmd(i2c, MXS_CMD_I2C_SELECT);
-               ret = mxs_i2c_pio_wait_dmareq(i2c);
-               if (ret)
-                       return ret;
-               writel(addr_data, i2c->regs + MXS_I2C_DATA);
-               writel(MXS_I2C_DEBUG0_DMAREQ, i2c->regs + MXS_I2C_DEBUG0_CLR);
+               mxs_i2c_pio_trigger_write_cmd(i2c, MXS_CMD_I2C_SELECT,
+                                             addr_data);
  
-               ret = mxs_i2c_pio_wait_cplt(i2c, 0);
-               if (ret)
-                       return ret;
-               if (mxs_i2c_pio_check_error_state(i2c))
+               ret = mxs_i2c_pio_wait_xfer_end(i2c);
+               if (ret) {
+                       dev_err(i2c->dev,
+                               "PIO: Failed to send SELECT command!\n");
                        goto cleanup;
+               }
  
                /* READ command. */
                mxs_i2c_pio_trigger_cmd(i2c,
                                        MXS_CMD_I2C_READ | flags |
                                        MXS_I2C_CTRL0_XFER_COUNT(msg->len));
  
+               ret = mxs_i2c_pio_wait_xfer_end(i2c);
+               if (ret) {
+                       dev_err(i2c->dev,
+                               "PIO: Failed to send SELECT command!\n");
+                       goto cleanup;
+               }
+               data = readl(i2c->regs + MXS_I2C_DATA(i2c));
                for (i = 0; i < msg->len; i++) {
-                       if ((i & 3) == 0) {
-                               ret = mxs_i2c_pio_wait_dmareq(i2c);
-                               if (ret)
-                                       return ret;
-                               data = readl(i2c->regs + MXS_I2C_DATA);
-                               writel(MXS_I2C_DEBUG0_DMAREQ,
-                                      i2c->regs + MXS_I2C_DEBUG0_CLR);
-                       }
                        msg->buf[i] = data & 0xff;
                        data >>= 8;
                }
        } else {
+               /*
+                * PIO WRITE transfer:
+                *
+                * The code below implements clock stretching to circumvent
+                * the possibility of kernel not being able to supply data
+                * fast enough. It is possible to transfer arbitrary amount
+                * of data using PIO write.
+                */
                addr_data |= I2C_SMBUS_WRITE;
  
-               /* WRITE command. */
-               mxs_i2c_pio_trigger_cmd(i2c,
-                                       MXS_CMD_I2C_WRITE | flags |
-                                       MXS_I2C_CTRL0_XFER_COUNT(msg->len + 1));
                /*
                 * The LSB of data buffer is the first byte blasted across
                 * the bus. Higher order bytes follow. Thus the following
                 * filling schematic.
                 */
                data = addr_data << 24;
+               /* Start the transfer with START condition. */
+               start = MXS_I2C_CTRL0_PRE_SEND_START;
+               /* If the transfer is long, use clock stretching. */
+               if (msg->len > 3)
+                       start |= MXS_I2C_CTRL0_RETAIN_CLOCK;
                for (i = 0; i < msg->len; i++) {
                        data >>= 8;
                        data |= (msg->buf[i] << 24);
-                       if ((i & 3) == 2) {
-                               ret = mxs_i2c_pio_wait_dmareq(i2c);
-                               if (ret)
-                                       return ret;
-                               writel(data, i2c->regs + MXS_I2C_DATA);
-                               writel(MXS_I2C_DEBUG0_DMAREQ,
-                                      i2c->regs + MXS_I2C_DEBUG0_CLR);
+                       xmit = 0;
+                       /* This is the last transfer of the message. */
+                       if (i + 1 == msg->len) {
+                               /* Add optional STOP flag. */
+                               start |= flags;
+                               /* Remove RETAIN_CLOCK bit. */
+                               start &= ~MXS_I2C_CTRL0_RETAIN_CLOCK;
+                               xmit = 1;
                        }
-               }
  
-               shifts_left = 24 - (i & 3) * 8;
-               if (shifts_left) {
-                       data >>= shifts_left;
-                       ret = mxs_i2c_pio_wait_dmareq(i2c);
-                       if (ret)
-                               return ret;
-                       writel(data, i2c->regs + MXS_I2C_DATA);
+                       /* Four bytes are ready in the "data" variable. */
+                       if ((i & 3) == 2)
+                               xmit = 1;
+                       /* Nothing interesting happened, continue stuffing. */
+                       if (!xmit)
+                               continue;
+                       /*
+                        * Compute the size of the transfer and shift the
+                        * data accordingly.
+                        *
+                        * i = (4k + 0) .... xlen = 2
+                        * i = (4k + 1) .... xlen = 3
+                        * i = (4k + 2) .... xlen = 4
+                        * i = (4k + 3) .... xlen = 1
+                        */
+                       if ((i % 4) == 3)
+                               xlen = 1;
+                       else
+                               xlen = (i % 4) + 2;
+                       data >>= (4 - xlen) * 8;
+                       dev_dbg(i2c->dev,
+                               "PIO: len=%i pos=%i total=%i [W%s%s%s]\n",
+                               xlen, i, msg->len,
+                               start & MXS_I2C_CTRL0_PRE_SEND_START ? "S" : "",
+                               start & MXS_I2C_CTRL0_POST_SEND_STOP ? "E" : "",
+                               start & MXS_I2C_CTRL0_RETAIN_CLOCK ? "C" : "");
                        writel(MXS_I2C_DEBUG0_DMAREQ,
-                              i2c->regs + MXS_I2C_DEBUG0_CLR);
+                              i2c->regs + MXS_I2C_DEBUG0_CLR(i2c));
+                       mxs_i2c_pio_trigger_write_cmd(i2c,
+                               start | MXS_I2C_CTRL0_MASTER_MODE |
+                               MXS_I2C_CTRL0_DIRECTION |
+                               MXS_I2C_CTRL0_XFER_COUNT(xlen), data);
+                       /* The START condition is sent only once. */
+                       start &= ~MXS_I2C_CTRL0_PRE_SEND_START;
+                       /* Wait for the end of the transfer. */
+                       ret = mxs_i2c_pio_wait_xfer_end(i2c);
+                       if (ret) {
+                               dev_err(i2c->dev,
+                                       "PIO: Failed to finish WRITE cmd!\n");
+                               break;
+                       }
+                       /* Check NAK here. */
+                       ret = readl(i2c->regs + MXS_I2C_STAT) &
+                                   MXS_I2C_STAT_GOT_A_NAK;
+                       if (ret) {
+                               ret = -ENXIO;
+                               goto cleanup;
+                       }
                }
        }
  
-       ret = mxs_i2c_pio_wait_cplt(i2c, flags & MXS_I2C_CTRL0_POST_SEND_STOP);
-       if (ret)
-               return ret;
        /* make sure we capture any occurred error into cmd_err */
-       mxs_i2c_pio_check_error_state(i2c);
+       ret = mxs_i2c_pio_check_error_state(i2c);
  
  cleanup:
        /* Clear any dangling IRQs and re-enable interrupts. */
        writel(MXS_I2C_IRQ_MASK, i2c->regs + MXS_I2C_CTRL1_CLR);
        writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET);
  
-       return 0;
+       /* Clear the PIO_MODE on i.MX23 */
+       if (i2c->dev_type == MXS_I2C_V1)
+               writel(MXS_I2C_CTRL0_PIO_MODE, i2c->regs + MXS_I2C_CTRL0_CLR);
+       return ret;
  }
  
  /*
@@@ -479,8 -562,9 +562,9 @@@ static int mxs_i2c_xfer_msg(struct i2c_
                                int stop)
  {
        struct mxs_i2c_dev *i2c = i2c_get_adapdata(adap);
-       int ret, err;
+       int ret;
        int flags;
+       int use_pio = 0;
  
        flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0;
  
                return -EINVAL;
  
        /*
-        * The current boundary to select between PIO/DMA transfer method
-        * is set to 8 bytes, transfers shorter than 8 bytes are transfered
-        * using PIO mode while longer transfers use DMA. The 8 byte border is
-        * based on this empirical measurement and a lot of previous frobbing.
+        * The MX28 I2C IP block can only do PIO READ for transfer of to up
+        * 4 bytes of length. The write transfer is not limited as it can use
+        * clock stretching to avoid FIFO underruns.
         */
+       if ((msg->flags & I2C_M_RD) && (msg->len <= 4))
+               use_pio = 1;
+       if (!(msg->flags & I2C_M_RD) && (msg->len < 7))
+               use_pio = 1;
        i2c->cmd_err = 0;
-       if (0) {        /* disable PIO mode until a proper fix is made */
+       if (use_pio) {
                ret = mxs_i2c_pio_setup_xfer(adap, msg, flags);
-               if (ret) {
-                       err = mxs_i2c_reset(i2c);
-                       if (err)
-                               return err;
-               }
+               /* No need to reset the block if NAK was received. */
+               if (ret && (ret != -ENXIO))
+                       mxs_i2c_reset(i2c);
        } else {
 -              INIT_COMPLETION(i2c->cmd_complete);
 +              reinit_completion(&i2c->cmd_complete);
                ret = mxs_i2c_dma_setup_xfer(adap, msg, flags);
                if (ret)
                        return ret;
                                                msecs_to_jiffies(1000));
                if (ret == 0)
                        goto timeout;
+               ret = i2c->cmd_err;
        }
  
-       if (i2c->cmd_err == -ENXIO) {
+       if (ret == -ENXIO) {
                /*
                 * If the transfer fails with a NAK from the slave the
                 * controller halts until it gets told to return to idle state.
                       i2c->regs + MXS_I2C_CTRL1_SET);
        }
  
-       ret = i2c->cmd_err;
+       /*
+        * WARNING!
+        * The i.MX23 is strange. After each and every operation, it's I2C IP
+        * block must be reset, otherwise the IP block will misbehave. This can
+        * be observed on the bus by the block sending out one single byte onto
+        * the bus. In case such an error happens, bit 27 will be set in the
+        * DEBUG0 register. This bit is not documented in the i.MX23 datasheet
+        * and is marked as "TBD" instead. To reset this bit to a correct state,
+        * reset the whole block. Since the block reset does not take long, do
+        * reset the block after every transfer to play safe.
+        */
+       if (i2c->dev_type == MXS_I2C_V1)
+               mxs_i2c_reset(i2c);
  
        dev_dbg(i2c->dev, "Done with err=%d\n", ret);
  
@@@ -680,8 -780,28 +780,28 @@@ static int mxs_i2c_get_ofdata(struct mx
        return 0;
  }
  
+ static struct platform_device_id mxs_i2c_devtype[] = {
+       {
+               .name = "imx23-i2c",
+               .driver_data = MXS_I2C_V1,
+       }, {
+               .name = "imx28-i2c",
+               .driver_data = MXS_I2C_V2,
+       }, { /* sentinel */ }
+ };
+ MODULE_DEVICE_TABLE(platform, mxs_i2c_devtype);
+ static const struct of_device_id mxs_i2c_dt_ids[] = {
+       { .compatible = "fsl,imx23-i2c", .data = &mxs_i2c_devtype[0], },
+       { .compatible = "fsl,imx28-i2c", .data = &mxs_i2c_devtype[1], },
+       { /* sentinel */ }
+ };
+ MODULE_DEVICE_TABLE(of, mxs_i2c_dt_ids);
  static int mxs_i2c_probe(struct platform_device *pdev)
  {
+       const struct of_device_id *of_id =
+                               of_match_device(mxs_i2c_dt_ids, &pdev->dev);
        struct device *dev = &pdev->dev;
        struct mxs_i2c_dev *i2c;
        struct i2c_adapter *adap;
        if (!i2c)
                return -ENOMEM;
  
+       if (of_id) {
+               const struct platform_device_id *device_id = of_id->data;
+               i2c->dev_type = device_id->driver_data;
+       }
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        irq = platform_get_irq(pdev, 0);
  
@@@ -768,25 -893,18 +893,19 @@@ static int mxs_i2c_remove(struct platfo
        return 0;
  }
  
- static const struct of_device_id mxs_i2c_dt_ids[] = {
-       { .compatible = "fsl,imx28-i2c", },
-       { /* sentinel */ }
- };
- MODULE_DEVICE_TABLE(of, mxs_i2c_dt_ids);
  static struct platform_driver mxs_i2c_driver = {
        .driver = {
                   .name = DRIVER_NAME,
                   .owner = THIS_MODULE,
                   .of_match_table = mxs_i2c_dt_ids,
                   },
 +      .probe = mxs_i2c_probe,
        .remove = mxs_i2c_remove,
  };
  
  static int __init mxs_i2c_init(void)
  {
 -      return platform_driver_probe(&mxs_i2c_driver, mxs_i2c_probe);
 +      return platform_driver_register(&mxs_i2c_driver);
  }
  subsys_initcall(mxs_i2c_init);
  
@@@ -796,6 -914,7 +915,7 @@@ static void __exit mxs_i2c_exit(void
  }
  module_exit(mxs_i2c_exit);
  
+ MODULE_AUTHOR("Marek Vasut <marex@denx.de>");
  MODULE_AUTHOR("Wolfram Sang <w.sang@pengutronix.de>");
  MODULE_DESCRIPTION("MXS I2C Bus Driver");
  MODULE_LICENSE("GPL");
index 0000000000000000000000000000000000000000,fa57c5e57efa9983d097d0ce2937d8b8d5b3f459..9cf715d695515e61fde96d27afe4c650f55c4095
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,872 +1,872 @@@
 -      INIT_COMPLETION(i2c_dev->complete);
+ /*
+  * Copyright (C) 2013 STMicroelectronics
+  *
+  * I2C master mode controller driver, used in STMicroelectronics devices.
+  *
+  * Author: Maxime Coquelin <maxime.coquelin@st.com>
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License version 2, as
+  * published by the Free Software Foundation.
+  */
+ #include <linux/module.h>
+ #include <linux/platform_device.h>
+ #include <linux/i2c.h>
+ #include <linux/clk.h>
+ #include <linux/io.h>
+ #include <linux/delay.h>
+ #include <linux/interrupt.h>
+ #include <linux/err.h>
+ #include <linux/of.h>
+ #include <linux/of_address.h>
+ #include <linux/of_irq.h>
+ /* SSC registers */
+ #define SSC_BRG                               0x000
+ #define SSC_TBUF                      0x004
+ #define SSC_RBUF                      0x008
+ #define SSC_CTL                               0x00C
+ #define SSC_IEN                               0x010
+ #define SSC_STA                               0x014
+ #define SSC_I2C                               0x018
+ #define SSC_SLAD                      0x01C
+ #define SSC_REP_START_HOLD            0x020
+ #define SSC_START_HOLD                        0x024
+ #define SSC_REP_START_SETUP           0x028
+ #define SSC_DATA_SETUP                        0x02C
+ #define SSC_STOP_SETUP                        0x030
+ #define SSC_BUS_FREE                  0x034
+ #define SSC_TX_FSTAT                  0x038
+ #define SSC_RX_FSTAT                  0x03C
+ #define SSC_PRE_SCALER_BRG            0x040
+ #define SSC_CLR                               0x080
+ #define SSC_NOISE_SUPP_WIDTH          0x100
+ #define SSC_PRSCALER                  0x104
+ #define SSC_NOISE_SUPP_WIDTH_DATAOUT  0x108
+ #define SSC_PRSCALER_DATAOUT          0x10c
+ /* SSC Control */
+ #define SSC_CTL_DATA_WIDTH_9          0x8
+ #define SSC_CTL_DATA_WIDTH_MSK                0xf
+ #define SSC_CTL_BM                    0xf
+ #define SSC_CTL_HB                    BIT(4)
+ #define SSC_CTL_PH                    BIT(5)
+ #define SSC_CTL_PO                    BIT(6)
+ #define SSC_CTL_SR                    BIT(7)
+ #define SSC_CTL_MS                    BIT(8)
+ #define SSC_CTL_EN                    BIT(9)
+ #define SSC_CTL_LPB                   BIT(10)
+ #define SSC_CTL_EN_TX_FIFO            BIT(11)
+ #define SSC_CTL_EN_RX_FIFO            BIT(12)
+ #define SSC_CTL_EN_CLST_RX            BIT(13)
+ /* SSC Interrupt Enable */
+ #define SSC_IEN_RIEN                  BIT(0)
+ #define SSC_IEN_TIEN                  BIT(1)
+ #define SSC_IEN_TEEN                  BIT(2)
+ #define SSC_IEN_REEN                  BIT(3)
+ #define SSC_IEN_PEEN                  BIT(4)
+ #define SSC_IEN_AASEN                 BIT(6)
+ #define SSC_IEN_STOPEN                        BIT(7)
+ #define SSC_IEN_ARBLEN                        BIT(8)
+ #define SSC_IEN_NACKEN                        BIT(10)
+ #define SSC_IEN_REPSTRTEN             BIT(11)
+ #define SSC_IEN_TX_FIFO_HALF          BIT(12)
+ #define SSC_IEN_RX_FIFO_HALF_FULL     BIT(14)
+ /* SSC Status */
+ #define SSC_STA_RIR                   BIT(0)
+ #define SSC_STA_TIR                   BIT(1)
+ #define SSC_STA_TE                    BIT(2)
+ #define SSC_STA_RE                    BIT(3)
+ #define SSC_STA_PE                    BIT(4)
+ #define SSC_STA_CLST                  BIT(5)
+ #define SSC_STA_AAS                   BIT(6)
+ #define SSC_STA_STOP                  BIT(7)
+ #define SSC_STA_ARBL                  BIT(8)
+ #define SSC_STA_BUSY                  BIT(9)
+ #define SSC_STA_NACK                  BIT(10)
+ #define SSC_STA_REPSTRT                       BIT(11)
+ #define SSC_STA_TX_FIFO_HALF          BIT(12)
+ #define SSC_STA_TX_FIFO_FULL          BIT(13)
+ #define SSC_STA_RX_FIFO_HALF          BIT(14)
+ /* SSC I2C Control */
+ #define SSC_I2C_I2CM                  BIT(0)
+ #define SSC_I2C_STRTG                 BIT(1)
+ #define SSC_I2C_STOPG                 BIT(2)
+ #define SSC_I2C_ACKG                  BIT(3)
+ #define SSC_I2C_AD10                  BIT(4)
+ #define SSC_I2C_TXENB                 BIT(5)
+ #define SSC_I2C_REPSTRTG              BIT(11)
+ #define SSC_I2C_SLAVE_DISABLE         BIT(12)
+ /* SSC Tx FIFO Status */
+ #define SSC_TX_FSTAT_STATUS           0x07
+ /* SSC Rx FIFO Status */
+ #define SSC_RX_FSTAT_STATUS           0x07
+ /* SSC Clear bit operation */
+ #define SSC_CLR_SSCAAS                        BIT(6)
+ #define SSC_CLR_SSCSTOP                       BIT(7)
+ #define SSC_CLR_SSCARBL                       BIT(8)
+ #define SSC_CLR_NACK                  BIT(10)
+ #define SSC_CLR_REPSTRT                       BIT(11)
+ /* SSC Clock Prescaler */
+ #define SSC_PRSC_VALUE                        0x0f
+ #define SSC_TXFIFO_SIZE                       0x8
+ #define SSC_RXFIFO_SIZE                       0x8
+ enum st_i2c_mode {
+       I2C_MODE_STANDARD,
+       I2C_MODE_FAST,
+       I2C_MODE_END,
+ };
+ /**
+  * struct st_i2c_timings - per-Mode tuning parameters
+  * @rate: I2C bus rate
+  * @rep_start_hold: I2C repeated start hold time requirement
+  * @rep_start_setup: I2C repeated start set up time requirement
+  * @start_hold: I2C start hold time requirement
+  * @data_setup_time: I2C data set up time requirement
+  * @stop_setup_time: I2C stop set up time requirement
+  * @bus_free_time: I2C bus free time requirement
+  * @sda_pulse_min_limit: I2C SDA pulse mini width limit
+  */
+ struct st_i2c_timings {
+       u32 rate;
+       u32 rep_start_hold;
+       u32 rep_start_setup;
+       u32 start_hold;
+       u32 data_setup_time;
+       u32 stop_setup_time;
+       u32 bus_free_time;
+       u32 sda_pulse_min_limit;
+ };
+ /**
+  * struct st_i2c_client - client specific data
+  * @addr: 8-bit slave addr, including r/w bit
+  * @count: number of bytes to be transfered
+  * @xfered: number of bytes already transferred
+  * @buf: data buffer
+  * @result: result of the transfer
+  * @stop: last I2C msg to be sent, i.e. STOP to be generated
+  */
+ struct st_i2c_client {
+       u8      addr;
+       u32     count;
+       u32     xfered;
+       u8      *buf;
+       int     result;
+       bool    stop;
+ };
+ /**
+  * struct st_i2c_dev - private data of the controller
+  * @adap: I2C adapter for this controller
+  * @dev: device for this controller
+  * @base: virtual memory area
+  * @complete: completion of I2C message
+  * @irq: interrupt line for th controller
+  * @clk: hw ssc block clock
+  * @mode: I2C mode of the controller. Standard or Fast only supported
+  * @scl_min_width_us: SCL line minimum pulse width in us
+  * @sda_min_width_us: SDA line minimum pulse width in us
+  * @client: I2C transfert information
+  * @busy: I2C transfer on-going
+  */
+ struct st_i2c_dev {
+       struct i2c_adapter      adap;
+       struct device           *dev;
+       void __iomem            *base;
+       struct completion       complete;
+       int                     irq;
+       struct clk              *clk;
+       int                     mode;
+       u32                     scl_min_width_us;
+       u32                     sda_min_width_us;
+       struct st_i2c_client    client;
+       bool                    busy;
+ };
+ static inline void st_i2c_set_bits(void __iomem *reg, u32 mask)
+ {
+       writel_relaxed(readl_relaxed(reg) | mask, reg);
+ }
+ static inline void st_i2c_clr_bits(void __iomem *reg, u32 mask)
+ {
+       writel_relaxed(readl_relaxed(reg) & ~mask, reg);
+ }
+ /* From I2C Specifications v0.5 */
+ static struct st_i2c_timings i2c_timings[] = {
+       [I2C_MODE_STANDARD] = {
+               .rate                   = 100000,
+               .rep_start_hold         = 4000,
+               .rep_start_setup        = 4700,
+               .start_hold             = 4000,
+               .data_setup_time        = 250,
+               .stop_setup_time        = 4000,
+               .bus_free_time          = 4700,
+       },
+       [I2C_MODE_FAST] = {
+               .rate                   = 400000,
+               .rep_start_hold         = 600,
+               .rep_start_setup        = 600,
+               .start_hold             = 600,
+               .data_setup_time        = 100,
+               .stop_setup_time        = 600,
+               .bus_free_time          = 1300,
+       },
+ };
+ static void st_i2c_flush_rx_fifo(struct st_i2c_dev *i2c_dev)
+ {
+       int count, i;
+       /*
+        * Counter only counts up to 7 but fifo size is 8...
+        * When fifo is full, counter is 0 and RIR bit of status register is
+        * set
+        */
+       if (readl_relaxed(i2c_dev->base + SSC_STA) & SSC_STA_RIR)
+               count = SSC_RXFIFO_SIZE;
+       else
+               count = readl_relaxed(i2c_dev->base + SSC_RX_FSTAT) &
+                       SSC_RX_FSTAT_STATUS;
+       for (i = 0; i < count; i++)
+               readl_relaxed(i2c_dev->base + SSC_RBUF);
+ }
+ static void st_i2c_soft_reset(struct st_i2c_dev *i2c_dev)
+ {
+       /*
+        * FIFO needs to be emptied before reseting the IP,
+        * else the controller raises a BUSY error.
+        */
+       st_i2c_flush_rx_fifo(i2c_dev);
+       st_i2c_set_bits(i2c_dev->base + SSC_CTL, SSC_CTL_SR);
+       st_i2c_clr_bits(i2c_dev->base + SSC_CTL, SSC_CTL_SR);
+ }
+ /**
+  * st_i2c_hw_config() - Prepare SSC block, calculate and apply tuning timings
+  * @i2c_dev: Controller's private data
+  */
+ static void st_i2c_hw_config(struct st_i2c_dev *i2c_dev)
+ {
+       unsigned long rate;
+       u32 val, ns_per_clk;
+       struct st_i2c_timings *t = &i2c_timings[i2c_dev->mode];
+       st_i2c_soft_reset(i2c_dev);
+       val = SSC_CLR_REPSTRT | SSC_CLR_NACK | SSC_CLR_SSCARBL |
+               SSC_CLR_SSCAAS | SSC_CLR_SSCSTOP;
+       writel_relaxed(val, i2c_dev->base + SSC_CLR);
+       /* SSC Control register setup */
+       val = SSC_CTL_PO | SSC_CTL_PH | SSC_CTL_HB | SSC_CTL_DATA_WIDTH_9;
+       writel_relaxed(val, i2c_dev->base + SSC_CTL);
+       rate = clk_get_rate(i2c_dev->clk);
+       ns_per_clk = 1000000000 / rate;
+       /* Baudrate */
+       val = rate / (2 * t->rate);
+       writel_relaxed(val, i2c_dev->base + SSC_BRG);
+       /* Pre-scaler baudrate */
+       writel_relaxed(1, i2c_dev->base + SSC_PRE_SCALER_BRG);
+       /* Enable I2C mode */
+       writel_relaxed(SSC_I2C_I2CM, i2c_dev->base + SSC_I2C);
+       /* Repeated start hold time */
+       val = t->rep_start_hold / ns_per_clk;
+       writel_relaxed(val, i2c_dev->base + SSC_REP_START_HOLD);
+       /* Repeated start set up time */
+       val = t->rep_start_setup / ns_per_clk;
+       writel_relaxed(val, i2c_dev->base + SSC_REP_START_SETUP);
+       /* Start hold time */
+       val = t->start_hold / ns_per_clk;
+       writel_relaxed(val, i2c_dev->base + SSC_START_HOLD);
+       /* Data set up time */
+       val = t->data_setup_time / ns_per_clk;
+       writel_relaxed(val, i2c_dev->base + SSC_DATA_SETUP);
+       /* Stop set up time */
+       val = t->stop_setup_time / ns_per_clk;
+       writel_relaxed(val, i2c_dev->base + SSC_STOP_SETUP);
+       /* Bus free time */
+       val = t->bus_free_time / ns_per_clk;
+       writel_relaxed(val, i2c_dev->base + SSC_BUS_FREE);
+       /* Prescalers set up */
+       val = rate / 10000000;
+       writel_relaxed(val, i2c_dev->base + SSC_PRSCALER);
+       writel_relaxed(val, i2c_dev->base + SSC_PRSCALER_DATAOUT);
+       /* Noise suppression witdh */
+       val = i2c_dev->scl_min_width_us * rate / 100000000;
+       writel_relaxed(val, i2c_dev->base + SSC_NOISE_SUPP_WIDTH);
+       /* Noise suppression max output data delay width */
+       val = i2c_dev->sda_min_width_us * rate / 100000000;
+       writel_relaxed(val, i2c_dev->base + SSC_NOISE_SUPP_WIDTH_DATAOUT);
+ }
+ static int st_i2c_wait_free_bus(struct st_i2c_dev *i2c_dev)
+ {
+       u32 sta;
+       int i;
+       for (i = 0; i < 10; i++) {
+               sta = readl_relaxed(i2c_dev->base + SSC_STA);
+               if (!(sta & SSC_STA_BUSY))
+                       return 0;
+               usleep_range(2000, 4000);
+       }
+       dev_err(i2c_dev->dev, "bus not free (status = 0x%08x)\n", sta);
+       return -EBUSY;
+ }
+ /**
+  * st_i2c_write_tx_fifo() - Write a byte in the Tx FIFO
+  * @i2c_dev: Controller's private data
+  * @byte: Data to write in the Tx FIFO
+  */
+ static inline void st_i2c_write_tx_fifo(struct st_i2c_dev *i2c_dev, u8 byte)
+ {
+       u16 tbuf = byte << 1;
+       writel_relaxed(tbuf | 1, i2c_dev->base + SSC_TBUF);
+ }
+ /**
+  * st_i2c_wr_fill_tx_fifo() - Fill the Tx FIFO in write mode
+  * @i2c_dev: Controller's private data
+  *
+  * This functions fills the Tx FIFO with I2C transfert buffer when
+  * in write mode.
+  */
+ static void st_i2c_wr_fill_tx_fifo(struct st_i2c_dev *i2c_dev)
+ {
+       struct st_i2c_client *c = &i2c_dev->client;
+       u32 tx_fstat, sta;
+       int i;
+       sta = readl_relaxed(i2c_dev->base + SSC_STA);
+       if (sta & SSC_STA_TX_FIFO_FULL)
+               return;
+       tx_fstat = readl_relaxed(i2c_dev->base + SSC_TX_FSTAT);
+       tx_fstat &= SSC_TX_FSTAT_STATUS;
+       if (c->count < (SSC_TXFIFO_SIZE - tx_fstat))
+               i = c->count;
+       else
+               i = SSC_TXFIFO_SIZE - tx_fstat;
+       for (; i > 0; i--, c->count--, c->buf++)
+               st_i2c_write_tx_fifo(i2c_dev, *c->buf);
+ }
+ /**
+  * st_i2c_rd_fill_tx_fifo() - Fill the Tx FIFO in read mode
+  * @i2c_dev: Controller's private data
+  *
+  * This functions fills the Tx FIFO with fixed pattern when
+  * in read mode to trigger clock.
+  */
+ static void st_i2c_rd_fill_tx_fifo(struct st_i2c_dev *i2c_dev, int max)
+ {
+       struct st_i2c_client *c = &i2c_dev->client;
+       u32 tx_fstat, sta;
+       int i;
+       sta = readl_relaxed(i2c_dev->base + SSC_STA);
+       if (sta & SSC_STA_TX_FIFO_FULL)
+               return;
+       tx_fstat = readl_relaxed(i2c_dev->base + SSC_TX_FSTAT);
+       tx_fstat &= SSC_TX_FSTAT_STATUS;
+       if (max < (SSC_TXFIFO_SIZE - tx_fstat))
+               i = max;
+       else
+               i = SSC_TXFIFO_SIZE - tx_fstat;
+       for (; i > 0; i--, c->xfered++)
+               st_i2c_write_tx_fifo(i2c_dev, 0xff);
+ }
+ static void st_i2c_read_rx_fifo(struct st_i2c_dev *i2c_dev)
+ {
+       struct st_i2c_client *c = &i2c_dev->client;
+       u32 i, sta;
+       u16 rbuf;
+       sta = readl_relaxed(i2c_dev->base + SSC_STA);
+       if (sta & SSC_STA_RIR) {
+               i = SSC_RXFIFO_SIZE;
+       } else {
+               i = readl_relaxed(i2c_dev->base + SSC_RX_FSTAT);
+               i &= SSC_RX_FSTAT_STATUS;
+       }
+       for (; (i > 0) && (c->count > 0); i--, c->count--) {
+               rbuf = readl_relaxed(i2c_dev->base + SSC_RBUF) >> 1;
+               *c->buf++ = (u8)rbuf & 0xff;
+       }
+       if (i) {
+               dev_err(i2c_dev->dev, "Unexpected %d bytes in rx fifo\n", i);
+               st_i2c_flush_rx_fifo(i2c_dev);
+       }
+ }
+ /**
+  * st_i2c_terminate_xfer() - Send either STOP or REPSTART condition
+  * @i2c_dev: Controller's private data
+  */
+ static void st_i2c_terminate_xfer(struct st_i2c_dev *i2c_dev)
+ {
+       struct st_i2c_client *c = &i2c_dev->client;
+       st_i2c_clr_bits(i2c_dev->base + SSC_IEN, SSC_IEN_TEEN);
+       st_i2c_clr_bits(i2c_dev->base + SSC_I2C, SSC_I2C_STRTG);
+       if (c->stop) {
+               st_i2c_set_bits(i2c_dev->base + SSC_IEN, SSC_IEN_STOPEN);
+               st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_STOPG);
+       } else {
+               st_i2c_set_bits(i2c_dev->base + SSC_IEN, SSC_IEN_REPSTRTEN);
+               st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_REPSTRTG);
+       }
+ }
+ /**
+  * st_i2c_handle_write() - Handle FIFO empty interrupt in case of write
+  * @i2c_dev: Controller's private data
+  */
+ static void st_i2c_handle_write(struct st_i2c_dev *i2c_dev)
+ {
+       struct st_i2c_client *c = &i2c_dev->client;
+       st_i2c_flush_rx_fifo(i2c_dev);
+       if (!c->count)
+               /* End of xfer, send stop or repstart */
+               st_i2c_terminate_xfer(i2c_dev);
+       else
+               st_i2c_wr_fill_tx_fifo(i2c_dev);
+ }
+ /**
+  * st_i2c_handle_write() - Handle FIFO enmpty interrupt in case of read
+  * @i2c_dev: Controller's private data
+  */
+ static void st_i2c_handle_read(struct st_i2c_dev *i2c_dev)
+ {
+       struct st_i2c_client *c = &i2c_dev->client;
+       u32 ien;
+       /* Trash the address read back */
+       if (!c->xfered) {
+               readl_relaxed(i2c_dev->base + SSC_RBUF);
+               st_i2c_clr_bits(i2c_dev->base + SSC_I2C, SSC_I2C_TXENB);
+       } else {
+               st_i2c_read_rx_fifo(i2c_dev);
+       }
+       if (!c->count) {
+               /* End of xfer, send stop or repstart */
+               st_i2c_terminate_xfer(i2c_dev);
+       } else if (c->count == 1) {
+               /* Penultimate byte to xfer, disable ACK gen. */
+               st_i2c_clr_bits(i2c_dev->base + SSC_I2C, SSC_I2C_ACKG);
+               /* Last received byte is to be handled by NACK interrupt */
+               ien = SSC_IEN_NACKEN | SSC_IEN_ARBLEN;
+               writel_relaxed(ien, i2c_dev->base + SSC_IEN);
+               st_i2c_rd_fill_tx_fifo(i2c_dev, c->count);
+       } else {
+               st_i2c_rd_fill_tx_fifo(i2c_dev, c->count - 1);
+       }
+ }
+ /**
+  * st_i2c_isr() - Interrupt routine
+  * @irq: interrupt number
+  * @data: Controller's private data
+  */
+ static irqreturn_t st_i2c_isr_thread(int irq, void *data)
+ {
+       struct st_i2c_dev *i2c_dev = data;
+       struct st_i2c_client *c = &i2c_dev->client;
+       u32 sta, ien;
+       int it;
+       ien = readl_relaxed(i2c_dev->base + SSC_IEN);
+       sta = readl_relaxed(i2c_dev->base + SSC_STA);
+       /* Use __fls() to check error bits first */
+       it = __fls(sta & ien);
+       if (it < 0) {
+               dev_dbg(i2c_dev->dev, "spurious it (sta=0x%04x, ien=0x%04x)\n",
+                               sta, ien);
+               return IRQ_NONE;
+       }
+       switch (1 << it) {
+       case SSC_STA_TE:
+               if (c->addr & I2C_M_RD)
+                       st_i2c_handle_read(i2c_dev);
+               else
+                       st_i2c_handle_write(i2c_dev);
+               break;
+       case SSC_STA_STOP:
+       case SSC_STA_REPSTRT:
+               writel_relaxed(0, i2c_dev->base + SSC_IEN);
+               complete(&i2c_dev->complete);
+               break;
+       case SSC_STA_NACK:
+               writel_relaxed(SSC_CLR_NACK, i2c_dev->base + SSC_CLR);
+               /* Last received byte handled by NACK interrupt */
+               if ((c->addr & I2C_M_RD) && (c->count == 1) && (c->xfered)) {
+                       st_i2c_handle_read(i2c_dev);
+                       break;
+               }
+               it = SSC_IEN_STOPEN | SSC_IEN_ARBLEN;
+               writel_relaxed(it, i2c_dev->base + SSC_IEN);
+               st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_STOPG);
+               c->result = -EIO;
+               break;
+       case SSC_STA_ARBL:
+               writel_relaxed(SSC_CLR_SSCARBL, i2c_dev->base + SSC_CLR);
+               it = SSC_IEN_STOPEN | SSC_IEN_ARBLEN;
+               writel_relaxed(it, i2c_dev->base + SSC_IEN);
+               st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_STOPG);
+               c->result = -EIO;
+               break;
+       default:
+               dev_err(i2c_dev->dev,
+                               "it %d unhandled (sta=0x%04x)\n", it, sta);
+       }
+       /*
+        * Read IEN register to ensure interrupt mask write is effective
+        * before re-enabling interrupt at GIC level, and thus avoid spurious
+        * interrupts.
+        */
+       readl(i2c_dev->base + SSC_IEN);
+       return IRQ_HANDLED;
+ }
+ /**
+  * st_i2c_xfer_msg() - Transfer a single I2C message
+  * @i2c_dev: Controller's private data
+  * @msg: I2C message to transfer
+  * @is_first: first message of the sequence
+  * @is_last: last message of the sequence
+  */
+ static int st_i2c_xfer_msg(struct st_i2c_dev *i2c_dev, struct i2c_msg *msg,
+                           bool is_first, bool is_last)
+ {
+       struct st_i2c_client *c = &i2c_dev->client;
+       u32 ctl, i2c, it;
+       unsigned long timeout;
+       int ret;
+       c->addr         = (u8)(msg->addr << 1);
+       c->addr         |= (msg->flags & I2C_M_RD);
+       c->buf          = msg->buf;
+       c->count        = msg->len;
+       c->xfered       = 0;
+       c->result       = 0;
+       c->stop         = is_last;
++      reinit_completion(&i2c_dev->complete);
+       ctl = SSC_CTL_EN | SSC_CTL_MS | SSC_CTL_EN_RX_FIFO | SSC_CTL_EN_TX_FIFO;
+       st_i2c_set_bits(i2c_dev->base + SSC_CTL, ctl);
+       i2c = SSC_I2C_TXENB;
+       if (c->addr & I2C_M_RD)
+               i2c |= SSC_I2C_ACKG;
+       st_i2c_set_bits(i2c_dev->base + SSC_I2C, i2c);
+       /* Write slave address */
+       st_i2c_write_tx_fifo(i2c_dev, c->addr);
+       /* Pre-fill Tx fifo with data in case of write */
+       if (!(c->addr & I2C_M_RD))
+               st_i2c_wr_fill_tx_fifo(i2c_dev);
+       it = SSC_IEN_NACKEN | SSC_IEN_TEEN | SSC_IEN_ARBLEN;
+       writel_relaxed(it, i2c_dev->base + SSC_IEN);
+       if (is_first) {
+               ret = st_i2c_wait_free_bus(i2c_dev);
+               if (ret)
+                       return ret;
+               st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_STRTG);
+       }
+       timeout = wait_for_completion_timeout(&i2c_dev->complete,
+                       i2c_dev->adap.timeout);
+       ret = c->result;
+       if (!timeout) {
+               dev_err(i2c_dev->dev, "Write to slave 0x%x timed out\n",
+                               c->addr);
+               ret = -ETIMEDOUT;
+       }
+       i2c = SSC_I2C_STOPG | SSC_I2C_REPSTRTG;
+       st_i2c_clr_bits(i2c_dev->base + SSC_I2C, i2c);
+       writel_relaxed(SSC_CLR_SSCSTOP | SSC_CLR_REPSTRT,
+                       i2c_dev->base + SSC_CLR);
+       return ret;
+ }
+ /**
+  * st_i2c_xfer() - Transfer a single I2C message
+  * @i2c_adap: Adapter pointer to the controller
+  * @msgs: Pointer to data to be written.
+  * @num: Number of messages to be executed
+  */
+ static int st_i2c_xfer(struct i2c_adapter *i2c_adap,
+                       struct i2c_msg msgs[], int num)
+ {
+       struct st_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap);
+       int ret, i;
+       i2c_dev->busy = true;
+       ret = clk_prepare_enable(i2c_dev->clk);
+       if (ret) {
+               dev_err(i2c_dev->dev, "Failed to prepare_enable clock\n");
+               return ret;
+       }
+       pinctrl_pm_select_default_state(i2c_dev->dev);
+       st_i2c_hw_config(i2c_dev);
+       for (i = 0; (i < num) && !ret; i++)
+               ret = st_i2c_xfer_msg(i2c_dev, &msgs[i], i == 0, i == num - 1);
+       pinctrl_pm_select_idle_state(i2c_dev->dev);
+       clk_disable_unprepare(i2c_dev->clk);
+       i2c_dev->busy = false;
+       return (ret < 0) ? ret : i;
+ }
+ #ifdef CONFIG_PM_SLEEP
+ static int st_i2c_suspend(struct device *dev)
+ {
+       struct platform_device *pdev =
+               container_of(dev, struct platform_device, dev);
+       struct st_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
+       if (i2c_dev->busy)
+               return -EBUSY;
+       pinctrl_pm_select_sleep_state(dev);
+       return 0;
+ }
+ static int st_i2c_resume(struct device *dev)
+ {
+       pinctrl_pm_select_default_state(dev);
+       /* Go in idle state if available */
+       pinctrl_pm_select_idle_state(dev);
+       return 0;
+ }
+ static SIMPLE_DEV_PM_OPS(st_i2c_pm, st_i2c_suspend, st_i2c_resume);
+ #define ST_I2C_PM     (&st_i2c_pm)
+ #else
+ #define ST_I2C_PM     NULL
+ #endif
+ static u32 st_i2c_func(struct i2c_adapter *adap)
+ {
+       return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
+ }
+ static struct i2c_algorithm st_i2c_algo = {
+       .master_xfer = st_i2c_xfer,
+       .functionality = st_i2c_func,
+ };
+ static int st_i2c_of_get_deglitch(struct device_node *np,
+               struct st_i2c_dev *i2c_dev)
+ {
+       int ret;
+       ret = of_property_read_u32(np, "st,i2c-min-scl-pulse-width-us",
+                       &i2c_dev->scl_min_width_us);
+       if ((ret == -ENODATA) || (ret == -EOVERFLOW)) {
+               dev_err(i2c_dev->dev, "st,i2c-min-scl-pulse-width-us invalid\n");
+               return ret;
+       }
+       ret = of_property_read_u32(np, "st,i2c-min-sda-pulse-width-us",
+                       &i2c_dev->sda_min_width_us);
+       if ((ret == -ENODATA) || (ret == -EOVERFLOW)) {
+               dev_err(i2c_dev->dev, "st,i2c-min-sda-pulse-width-us invalid\n");
+               return ret;
+       }
+       return 0;
+ }
+ static int st_i2c_probe(struct platform_device *pdev)
+ {
+       struct device_node *np = pdev->dev.of_node;
+       struct st_i2c_dev *i2c_dev;
+       struct resource *res;
+       u32 clk_rate;
+       struct i2c_adapter *adap;
+       int ret;
+       i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL);
+       if (!i2c_dev)
+               return -ENOMEM;
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       i2c_dev->base = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(i2c_dev->base))
+               return PTR_ERR(i2c_dev->base);
+       i2c_dev->irq = irq_of_parse_and_map(np, 0);
+       if (!i2c_dev->irq) {
+               dev_err(&pdev->dev, "IRQ missing or invalid\n");
+               return -EINVAL;
+       }
+       i2c_dev->clk = of_clk_get_by_name(np, "ssc");
+       if (IS_ERR(i2c_dev->clk)) {
+               dev_err(&pdev->dev, "Unable to request clock\n");
+               return PTR_ERR(i2c_dev->clk);
+       }
+       i2c_dev->mode = I2C_MODE_STANDARD;
+       ret = of_property_read_u32(np, "clock-frequency", &clk_rate);
+       if ((!ret) && (clk_rate == 400000))
+               i2c_dev->mode = I2C_MODE_FAST;
+       i2c_dev->dev = &pdev->dev;
+       ret = devm_request_threaded_irq(&pdev->dev, i2c_dev->irq,
+                       NULL, st_i2c_isr_thread,
+                       IRQF_ONESHOT, pdev->name, i2c_dev);
+       if (ret) {
+               dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq);
+               return ret;
+       }
+       pinctrl_pm_select_default_state(i2c_dev->dev);
+       /* In case idle state available, select it */
+       pinctrl_pm_select_idle_state(i2c_dev->dev);
+       ret = st_i2c_of_get_deglitch(np, i2c_dev);
+       if (ret)
+               return ret;
+       adap = &i2c_dev->adap;
+       i2c_set_adapdata(adap, i2c_dev);
+       snprintf(adap->name, sizeof(adap->name), "ST I2C(0x%x)", res->start);
+       adap->owner = THIS_MODULE;
+       adap->timeout = 2 * HZ;
+       adap->retries = 0;
+       adap->algo = &st_i2c_algo;
+       adap->dev.parent = &pdev->dev;
+       adap->dev.of_node = pdev->dev.of_node;
+       init_completion(&i2c_dev->complete);
+       ret = i2c_add_adapter(adap);
+       if (ret) {
+               dev_err(&pdev->dev, "Failed to add adapter\n");
+               return ret;
+       }
+       platform_set_drvdata(pdev, i2c_dev);
+       dev_info(i2c_dev->dev, "%s initialized\n", adap->name);
+       return 0;
+ }
+ static int st_i2c_remove(struct platform_device *pdev)
+ {
+       struct st_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
+       i2c_del_adapter(&i2c_dev->adap);
+       return 0;
+ }
+ static struct of_device_id st_i2c_match[] = {
+       { .compatible = "st,comms-ssc-i2c", },
+       { .compatible = "st,comms-ssc4-i2c", },
+       {},
+ };
+ MODULE_DEVICE_TABLE(of, st_i2c_match);
+ static struct platform_driver st_i2c_driver = {
+       .driver = {
+               .name = "st-i2c",
+               .owner = THIS_MODULE,
+               .of_match_table = st_i2c_match,
+               .pm = ST_I2C_PM,
+       },
+       .probe = st_i2c_probe,
+       .remove = st_i2c_remove,
+ };
+ module_platform_driver(st_i2c_driver);
+ MODULE_AUTHOR("Maxime Coquelin <maxime.coquelin@st.com>");
+ MODULE_DESCRIPTION("STMicroelectronics I2C driver");
+ MODULE_LICENSE("GPL v2");
index 31395fa8121db6644a4379f2b578e419759380f5,4bf9507cd1a1e3ebc7b7b22e6ab776d097cde3ae..2c8a3e4f900890e11f3fd1f14c0e15aa78d2ecce
@@@ -158,7 -158,7 +158,7 @@@ static int wmt_i2c_write(struct i2c_ada
                writew(val, i2c_dev->base + REG_CR);
        }
  
 -      INIT_COMPLETION(i2c_dev->complete);
 +      reinit_completion(&i2c_dev->complete);
  
        if (i2c_dev->mode == I2C_MODE_STANDARD)
                tcr_val = TCR_STANDARD_MODE;
@@@ -247,7 -247,7 +247,7 @@@ static int wmt_i2c_read(struct i2c_adap
                writew(val, i2c_dev->base + REG_CR);
        }
  
 -      INIT_COMPLETION(i2c_dev->complete);
 +      reinit_completion(&i2c_dev->complete);
  
        if (i2c_dev->mode == I2C_MODE_STANDARD)
                tcr_val = TCR_STANDARD_MODE;
@@@ -349,6 -349,7 +349,7 @@@ static int wmt_i2c_reset_hardware(struc
        err = clk_set_rate(i2c_dev->clk, 20000000);
        if (err) {
                dev_err(i2c_dev->dev, "failed to set clock = 20Mhz\n");
+               clk_disable_unprepare(i2c_dev->clk);
                return err;
        }
  
diff --combined drivers/i2c/i2c-core.c
index 75ba8608383e4b1d26e65a389f099f7028e7b733,430c001b3f1e6e0bbca7b372b340241a9a9b558a..5923cfa390c86de6528559c229ace0a4b39b402c
@@@ -248,19 -248,16 +248,18 @@@ static int i2c_device_probe(struct devi
        driver = to_i2c_driver(dev->driver);
        if (!driver->probe || !driver->id_table)
                return -ENODEV;
-       client->driver = driver;
        if (!device_can_wakeup(&client->dev))
                device_init_wakeup(&client->dev,
                                        client->flags & I2C_CLIENT_WAKE);
        dev_dbg(dev, "probe\n");
  
 +      acpi_dev_pm_attach(&client->dev, true);
        status = driver->probe(client, i2c_match_id(driver->id_table, client));
 -      if (status)
 +      if (status) {
-               client->driver = NULL;
                i2c_set_clientdata(client, NULL);
 -
 +              acpi_dev_pm_detach(&client->dev, true);
 +      }
        return status;
  }
  
@@@ -281,11 -278,9 +280,9 @@@ static int i2c_device_remove(struct dev
                dev->driver = NULL;
                status = 0;
        }
-       if (status == 0) {
-               client->driver = NULL;
+       if (status == 0)
                i2c_set_clientdata(client, NULL);
-       }
 -
 +      acpi_dev_pm_detach(&client->dev, true);
        return status;
  }
  
@@@ -1114,10 -1109,8 +1111,10 @@@ static acpi_status acpi_i2c_add_device(
        if (ret < 0 || !info.addr)
                return AE_OK;
  
 +      adev->power.flags.ignore_parent = true;
        strlcpy(info.type, dev_name(&adev->dev), sizeof(info.type));
        if (!i2c_new_device(adapter, &info)) {
 +              adev->power.flags.ignore_parent = false;
                dev_err(&adapter->dev,
                        "failed to add I2C device %s from ACPI\n",
                        dev_name(&adev->dev));
@@@ -1139,9 -1132,6 +1136,9 @@@ static void acpi_i2c_register_devices(s
        acpi_handle handle;
        acpi_status status;
  
 +      if (!adap->dev.parent)
 +              return;
 +
        handle = ACPI_HANDLE(adap->dev.parent);
        if (!handle)
                return;
@@@ -1614,9 -1604,14 +1611,14 @@@ static int i2c_cmd(struct device *dev, 
  {
        struct i2c_client       *client = i2c_verify_client(dev);
        struct i2c_cmd_arg      *arg = _arg;
+       struct i2c_driver       *driver;
+       if (!client || !client->dev.driver)
+               return 0;
  
-       if (client && client->driver && client->driver->command)
-               client->driver->command(client, arg->cmd, arg->arg);
+       driver = to_i2c_driver(client->dev.driver);
+       if (driver->command)
+               driver->command(client, arg->cmd, arg->arg);
        return 0;
  }
  
index 928656e241ddc0873613dd7a5b786be4f0e5250e,cb9af93eeb5b74acdc8a8bb27a5d8da3cfb37cf3..c58e093b6032480a316c1725db5f6879842cd2ef
@@@ -200,7 -200,7 +200,7 @@@ static int i2c_arbitrator_probe(struct 
        arb->parent = of_find_i2c_adapter_by_node(parent_np);
        if (!arb->parent) {
                dev_err(dev, "Cannot find parent bus\n");
 -              return -EINVAL;
 +              return -EPROBE_DEFER;
        }
  
        /* Actually add the mux adapter */
@@@ -238,7 -238,7 +238,7 @@@ static struct platform_driver i2c_arbit
        .driver = {
                .owner  = THIS_MODULE,
                .name   = "i2c-arb-gpio-challenge",
-               .of_match_table = of_match_ptr(i2c_arbitrator_of_match),
+               .of_match_table = i2c_arbitrator_of_match,
        },
  };
  
index a764da777f08027da102e244556f9bb424b59494,3d12e859e7487dd3f0bd4cebab5ddb901d9ceed9..8a8c56f4b026d6a22e54941e9959ea633b42c321
@@@ -30,15 -30,15 +30,15 @@@ static void i2c_mux_gpio_set(const stru
        int i;
  
        for (i = 0; i < mux->data.n_gpios; i++)
-               gpio_set_value(mux->gpio_base + mux->data.gpios[i],
-                              val & (1 << i));
+               gpio_set_value_cansleep(mux->gpio_base + mux->data.gpios[i],
+                                       val & (1 << i));
  }
  
  static int i2c_mux_gpio_select(struct i2c_adapter *adap, void *data, u32 chan)
  {
        struct gpiomux *mux = data;
  
-       i2c_mux_gpio_set(mux, mux->data.values[chan]);
+       i2c_mux_gpio_set(mux, chan);
  
        return 0;
  }
@@@ -66,7 -66,7 +66,7 @@@ static int i2c_mux_gpio_probe_dt(struc
        struct device_node *adapter_np, *child;
        struct i2c_adapter *adapter;
        unsigned *values, *gpios;
 -      int i = 0;
 +      int i = 0, ret;
  
        if (!np)
                return -ENODEV;
@@@ -79,7 -79,7 +79,7 @@@
        adapter = of_find_i2c_adapter_by_node(adapter_np);
        if (!adapter) {
                dev_err(&pdev->dev, "Cannot find parent bus\n");
 -              return -ENODEV;
 +              return -EPROBE_DEFER;
        }
        mux->data.parent = i2c_adapter_id(adapter);
        put_device(&adapter->dev);
                return -ENOMEM;
        }
  
 -      for (i = 0; i < mux->data.n_gpios; i++)
 -              gpios[i] = of_get_named_gpio(np, "mux-gpios", i);
 +      for (i = 0; i < mux->data.n_gpios; i++) {
 +              ret = of_get_named_gpio(np, "mux-gpios", i);
 +              if (ret < 0)
 +                      return ret;
 +              gpios[i] = ret;
 +      }
  
        mux->data.gpios = gpios;
  
@@@ -181,7 -177,7 +181,7 @@@ static int i2c_mux_gpio_probe(struct pl
        if (!parent) {
                dev_err(&pdev->dev, "Parent adapter (%d) not found\n",
                        mux->data.parent);
 -              return -ENODEV;
 +              return -EPROBE_DEFER;
        }
  
        mux->parent = parent;
                unsigned int class = mux->data.classes ? mux->data.classes[i] : 0;
  
                mux->adap[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, nr,
-                                                  i, class,
+                                                  mux->data.values[i], class,
                                                   i2c_mux_gpio_select, deselect);
                if (!mux->adap[i]) {
                        ret = -ENODEV;
@@@ -283,7 -279,7 +283,7 @@@ static struct platform_driver i2c_mux_g
        .driver = {
                .owner  = THIS_MODULE,
                .name   = "i2c-mux-gpio",
-               .of_match_table = of_match_ptr(i2c_mux_gpio_of_match),
+               .of_match_table = i2c_mux_gpio_of_match,
        },
  };
  
index 68a37157377df12797b1b122ca4568d121559112,b3d0574ead4ec4c171e5494afa425ca904295486..d7978dc4ad0b075a03b842bc93b52a61c952ae70
@@@ -24,6 -24,7 +24,7 @@@
  #include <linux/i2c-mux-pinctrl.h>
  #include <linux/platform_device.h>
  #include <linux/slab.h>
+ #include <linux/of.h>
  
  struct i2c_mux_pinctrl {
        struct device *dev;
@@@ -113,7 -114,7 +114,7 @@@ static int i2c_mux_pinctrl_parse_dt(str
        adapter = of_find_i2c_adapter_by_node(adapter_np);
        if (!adapter) {
                dev_err(mux->dev, "Cannot find parent bus\n");
 -              return -ENODEV;
 +              return -EPROBE_DEFER;
        }
        mux->pdata->parent_bus_num = i2c_adapter_id(adapter);
        put_device(&adapter->dev);
@@@ -211,7 -212,7 +212,7 @@@ static int i2c_mux_pinctrl_probe(struc
        if (!mux->parent) {
                dev_err(&pdev->dev, "Parent adapter (%d) not found\n",
                        mux->pdata->parent_bus_num);
 -              ret = -ENODEV;
 +              ret = -EPROBE_DEFER;
                goto err;
        }
  
index 31f40b3420497497fece6df8a6ea05b5d7e4edf7,1083890ac5a9fa198195ad931f8943f1b67fa340..6fec9384d86e4877d5b750a9f9a9ceec53e06bde
@@@ -1581,7 -1581,7 +1581,7 @@@ static int s5c73m3_probe(struct i2c_cli
        oif_sd = &state->oif_sd;
  
        v4l2_subdev_init(sd, &s5c73m3_subdev_ops);
-       sd->owner = client->driver->driver.owner;
+       sd->owner = client->dev.driver->owner;
        v4l2_set_subdevdata(sd, state);
        strlcpy(sd->name, "S5C73M3", sizeof(sd->name));
  
        if (ret < 0)
                goto out_err;
  
 -      v4l2_info(sd, "%s: completed succesfully\n", __func__);
 +      v4l2_info(sd, "%s: completed successfully\n", __func__);
        return 0;
  
  out_err:
index 4b8a9a39d7f45f0896a92665f298f168d45d51f8,4133af01774a3226413c73fbaa02f41aa789e1d6..20c09229a08ed7063cc05a02a30909c3c7fe7bd6
@@@ -43,7 -43,7 +43,7 @@@
  
  #define UNSET (-1U)
  
- #define PREFIX (t->i2c->driver->driver.name)
+ #define PREFIX (t->i2c->dev.driver->name)
  
  /*
   * Driver modprobe parameters
@@@ -247,7 -247,7 +247,7 @@@ static const struct analog_demod_ops tu
  /**
   * set_type - Sets the tuner type for a given device
   *
 - * @c:                        i2c_client descriptoy
 + * @c:                        i2c_client descriptor
   * @type:             type of the tuner (e. g. tuner number)
   * @new_mode_mask:    Indicates if tuner supports TV and/or Radio
   * @new_config:               an optional parameter used by a few tuners to adjust
@@@ -452,7 -452,7 +452,7 @@@ static void set_type(struct i2c_client 
        }
  
        tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
-                 c->adapter->name, c->driver->driver.name, c->addr << 1, type,
+                 c->adapter->name, c->dev.driver->name, c->addr << 1, type,
                  t->mode_mask);
        return;
  
@@@ -556,7 -556,7 +556,7 @@@ static void tuner_lookup(struct i2c_ada
                int mode_mask;
  
                if (pos->i2c->adapter != adap ||
-                   strcmp(pos->i2c->driver->driver.name, "tuner"))
+                   strcmp(pos->i2c->dev.driver->name, "tuner"))
                        continue;
  
                mode_mask = pos->mode_mask;
index 94b8a33243192d4217c54442424bc91e1dbd936c,4ef01ab67853289ba7c1db81e5d7ec5464333401..d87f77f790d67fb49019cf94c69e346f50c89b28
@@@ -22,7 -22,7 +22,7 @@@
  #include <linux/jiffies.h>
  #include <linux/of.h>
  #include <linux/i2c.h>
- #include <linux/i2c/at24.h>
+ #include <linux/platform_data/at24.h>
  
  /*
   * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable.
@@@ -428,9 -428,6 +428,9 @@@ static ssize_t at24_bin_write(struct fi
  {
        struct at24_data *at24;
  
 +      if (unlikely(off >= attr->size))
 +              return -EFBIG;
 +
        at24 = dev_get_drvdata(container_of(kobj, struct device, kobj));
        return at24_write(at24, buf, off, count);
  }
index b87692c0b042da1bed67a12b83064f096da09830,a707529841e27d92e2bfe1abfda2b5f0b81b1560..48f974866f13fe2fd2362ed0c87ccd8c29d59811
@@@ -35,7 -35,7 +35,7 @@@
        printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg)
  
  #define v4l_client_printk(level, client, fmt, arg...)                     \
-       v4l_printk(level, (client)->driver->driver.name, (client)->adapter, \
+       v4l_printk(level, (client)->dev.driver->name, (client)->adapter, \
                   (client)->addr, fmt , ## arg)
  
  #define v4l_err(client, fmt, arg...) \
@@@ -86,7 -86,7 +86,7 @@@ int v4l2_ctrl_check(struct v4l2_ext_con
                const char * const *menu_items);
  const char *v4l2_ctrl_get_name(u32 id);
  const char * const *v4l2_ctrl_get_menu(u32 id);
 -const s64 const *v4l2_ctrl_get_int_menu(u32 id, u32 *len);
 +const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len);
  int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
  int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
                struct v4l2_queryctrl *qctrl, const char * const *menu_items);
index 361f94f09b11565239b3edba824053b9bbd94e70,cd106aa39984f32152281a80ea7812837ea789d0..61e48852b9e8bd21b26eec98cca4fc9ba0eea145
@@@ -215,7 -215,7 +215,7 @@@ static int imx_wm8962_probe(struct plat
                goto fail;
        }
        codec_dev = of_find_i2c_device_by_node(codec_np);
-       if (!codec_dev || !codec_dev->driver) {
+       if (!codec_dev || !codec_dev->dev.driver) {
                dev_err(&pdev->dev, "failed to find codec platform device\n");
                ret = -EINVAL;
                goto fail;
        data->card.late_probe = imx_wm8962_late_probe;
        data->card.set_bias_level = imx_wm8962_set_bias_level;
  
 -      ret = snd_soc_register_card(&data->card);
 +      ret = devm_snd_soc_register_card(&pdev->dev, &data->card);
        if (ret) {
                dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
                goto clk_fail;
        return 0;
  
  clk_fail:
 -      if (!IS_ERR(data->codec_clk))
 -              clk_disable_unprepare(data->codec_clk);
 +      clk_disable_unprepare(data->codec_clk);
  fail:
        if (ssi_np)
                of_node_put(ssi_np);
@@@ -295,6 -296,7 +295,6 @@@ static int imx_wm8962_remove(struct pla
  
        if (!IS_ERR(data->codec_clk))
                clk_disable_unprepare(data->codec_clk);
 -      snd_soc_unregister_card(&data->card);
  
        return 0;
  }
@@@ -309,7 -311,6 +309,7 @@@ static struct platform_driver imx_wm896
        .driver = {
                .name = "imx-wm8962",
                .owner = THIS_MODULE,
 +              .pm = &snd_soc_pm_ops,
                .of_match_table = imx_wm8962_dt_ids,
        },
        .probe = imx_wm8962_probe,