1
0
Fork 0
Commit Graph

116 Commits (351c8a09b00b5c51c8f58b016fffe51f87e2d820)

Author SHA1 Message Date
Stephen Warren 68fb669554 i2c: tegra: Support DVC controller in device tree
One of the Tegra I2C blocks is inside the DVC (Digital Voltage Controller)
block. This block is identical to the rest of the I2C blocks, except that
it only supports master mode, it has registers moved around, and it needs
some extra init to get it into I2C mode.  The register moves are handled
by i2c_readl and i2c_writel

This patch adds a new compatible value for controllers of this "DVC"
type; I figured that this approach was reasonable, as opposed to adding
an is-dvc property under the existing compatible value, since the HW
truly is different.

v2: Call of_device_is_compatible() to determine is_dvc, instead of storing
the flag in tegra_i2c_of_match[]'s .data field.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
2011-12-19 17:54:20 -08:00
Stephen Warren 92891da11a i2c: tegra: Add __devinit/exit to probe/remove
This fixes some section mismatch build warnings.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
2011-12-19 17:54:20 -08:00
Linus Torvalds 32aaeffbd4 Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
* 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
  Revert "tracing: Include module.h in define_trace.h"
  irq: don't put module.h into irq.h for tracking irqgen modules.
  bluetooth: macroize two small inlines to avoid module.h
  ip_vs.h: fix implicit use of module_get/module_put from module.h
  nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
  include: replace linux/module.h with "struct module" wherever possible
  include: convert various register fcns to macros to avoid include chaining
  crypto.h: remove unused crypto_tfm_alg_modname() inline
  uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
  pm_runtime.h: explicitly requires notifier.h
  linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
  miscdevice.h: fix up implicit use of lists and types
  stop_machine.h: fix implicit use of smp.h for smp_processor_id
  of: fix implicit use of errno.h in include/linux/of.h
  of_platform.h: delete needless include <linux/module.h>
  acpi: remove module.h include from platform/aclinux.h
  miscdevice.h: delete unnecessary inclusion of module.h
  device_cgroup.h: delete needless include <linux/module.h>
  net: sch_generic remove redundant use of <linux/module.h>
  net: inet_timewait_sock doesnt need <linux/module.h>
  ...

Fix up trivial conflicts (other header files, and  removal of the ab3550 mfd driver) in
 - drivers/media/dvb/frontends/dibx000_common.c
 - drivers/media/video/{mt9m111.c,ov6650.c}
 - drivers/mfd/ab3550-core.c
 - include/linux/dmaengine.h
2011-11-06 19:44:47 -08:00
Paul Gortmaker 93cf5d75b9 i2c: Add module.h to modular files prev. implicitly getting it
These files use interfaces from linux/module.h, so they must
include that file to avoid build errors when the implicit
presence of module.h is removed.

[with i2c-pxa-pci.c fix from Randy Dunlap <rdunlap@xenotime.net>]

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:31:29 -04:00
Olof Johansson f533c61e19 i2c-tegra: __iomem annotation fix
drivers/i2c/busses/i2c-tegra.c:585:7: warning: incorrect type in assignment (different address spaces)
drivers/i2c/busses/i2c-tegra.c:585:7:    expected void *base
drivers/i2c/busses/i2c-tegra.c:585:7:    got void [noderef] <asn:2>*
drivers/i2c/busses/i2c-tegra.c:619:16: warning: incorrect type in assignment (different address spaces)
drivers/i2c/busses/i2c-tegra.c:619:16:    expected void [noderef] <asn:2>*base
drivers/i2c/busses/i2c-tegra.c:619:16:    got void *base
drivers/i2c/busses/i2c-tegra.c:689:10: warning: incorrect type in argument 1 (different address spaces)
drivers/i2c/busses/i2c-tegra.c:689:10:    expected void volatile [noderef] <asn:2>*addr
drivers/i2c/busses/i2c-tegra.c:689:10:    got void *base

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by; Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-10-29 11:11:23 +01:00
Doug Anderson 96219c3a25 i2c-tegra: fix possible race condition after tx
In tegra_i2c_fill_tx_fifo, once we have finished pushing all the bytes
to the I2C hardware controller, the interrupt might happen before we
have updated i2c_dev->msg_buf_remaining at the end of the function.
Then, in tegra_i2c_isr, we will call again tegra_i2c_fill_tx_fifo
triggering weird behaviour. This has been shown to happen under real
conditions.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-09-07 00:13:40 +01:00
Mike Rapoport 048e29cff9 i2c-tegra: add I2C_FUNC_SMBUS_EMUL
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-09-07 00:13:34 +01:00
John Bonesio 406bd18a7a i2c-tegra: Add of_match_table
This patch was intended to be part of 7ca2d1a105a239e300b937e9c41a10a4bd08f569
"i2c: Tegra: Add DeviceTree support". However, an early version of that patch,
which was missing a chunk, was applied to next-i2c. This change is that
missing chunk.

Signed-off-by: John Bonesio <bones@secretlab.ca>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-09-07 00:11:46 +01:00
John Bonesio 5c470f39ee i2c: Tegra: Add DeviceTree support
This patch modifies the tegra i2c driver so that it can be initiailized
using the device tree along with the devices connected to the i2c bus.

Signed-off-by: John Bonesio <bones@secretlab.ca>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: OIof Johansson <olof@lixom.net>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-07-27 00:02:28 +01:00
Stephen Warren 5afa9d3578 i2c: tegra: Assign unused slave address
On Tegra, we should always use the "new" I2C slave controller, to avoid
issues with the old controller. This was implemented in commit 65a1a0a
"i2c: tegra: Enable new slave mode."

There is currently no driver for the Tegra I2C slave controller upstream.
Additionally, the controller cannot be completely disabled. Instead, we
need to:

a) Set I2C_SL_CNFG_NACK to make the controller automatically NACK any
incoming transactions.

b) The controller's definition of NACK isn't identical to the I2C
protocol's definition. Specifically, it will perform a standard NACK, but
*also* continue to hold the clock line low in expectation of receiving
more data. This can hang the bus, or at least cause transaction timeouts,
if something starts a transaction that matches the controller's slave
address. Since the default address is 0x00, the general call address,
this does occur in practice.

To avoid this, we explicitly program a slave address that is reserved for
future expansion. For current boards, this guarantees the address will
never be used. If a future board ever needs to use this address, we can
add platform data to determine a board-specific safe address. 0xfc is
picked by this patch.

This patch is based on a change previously posted by: Wei Ni <wni@nvidia.com>
http://www.spinics.net/lists/linux-i2c/msg05437.html
In turned based on internal changes by: Bharat Nihalani <bnihalani@nvidia.com>

A semantically equivalent change has been contained in the various
ChromeOS kernels for a while.

I tested this change on top of 3.0-rc2 on Harmony, and interacted with
the WM8903 I2C-based audio codec.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-06-27 23:03:42 +01:00
Jay Cheng 40abcf7723 i2c: tegra: Add de-bounce cycles.
This enables debouncing of the I2C lines. The debounce period is
2 * the debounce register field value, in terms of the I2C block's main
clock. The Tegra TRM indicates that a setting yielding >50nS is
desirable. Hence, a setting of 2 => 4 clocks @ 72MHz => ~55nS.

Signed-off-by: Ken Radtke <kradtke@nvidia.com>
[swarren: Added commit description body,
 Fixed 80-column limit, Reverted file permission change]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-05-11 06:45:50 +01:00
Erik Gilling 2078cf3b22 i2c: tegra: fix repeated start handling
A repeated start should be used for all but the last msg in an xfer.  The
NOSTART flag is for skipping the START frame (addr/rw)

Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-05-11 06:45:50 +01:00
Todd Poynor cb63c62d8e i2c: tegra: recover from spurious interrupt storm
Re-init the I2C controller when an IRQ arrives with no
I2C_INT_STATUS bits set to indicate why the interrupt was sent.
Storms of such mystery interrupts are infrequently seen.

Dump some more status when these interrupts arrive.  Set an error
for the current request and wake up the requester (rather than
timing out the request or possibly silently ignoring the interrupts).

If the I2C block is inside the DVC, also ACK the DVC I2C transfer
done interrupt in the ISR error return path, as is done for the
normal return path.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
[swarren: Fix minor checkpatch whitespace issue, commit tag]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-05-11 06:45:50 +01:00
Kenneth Waters 65a1a0ace5 i2c: tegra: Enable new slave mode.
For Tegra i2c controller to function properly new slave mode must be
enabled.

swarren notes:

In particular, I found this was needed when working on enabling the
Tegra audio driver on the Seaboard board. There are two different PCB
layouts for this board; a "clamshell" version, which works just fine
without this change, and the original non-clamshell version, which needs
this change in order for I2C to operate correctly. Without it, I2C
probing fails for some devices, e.g. with:

wm8903 0-001a: Device with ID register 0 is not a WM8903
wm8903 0-001a: asoc: failed to probe CODEC wm8903.0-001a: -19
asoc: failed to instantiate card tegra-wm8903: -19
ALSA device list:
  No soundcards found.

Signed-off-by: Rakesh Iyer <riyer@nvidia.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-05-11 06:45:08 +01:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Colin Cross db811ca0f4 i2c: tegra: Add i2c support
Adds I2C bus driver for nVidia Tegra SoCs.  Tegra includes 4 I2C
controllers, one of which is inside the Dynamic Voltage Controller
and has a slightly different register map.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-02-23 00:53:26 +00:00