Commit Graph

20 Commits (a10d206ef1a83121ab7430cb196e0376a7145b22)

Author SHA1 Message Date
Magnus Damm ad33707417 i2c: sh_mobile: add device tree support
This patch enables DT support for the IIC driver
used on SH-based SoCs such as sh7722 and sh7724
among others as well as SH-Mobile SoCs such as
sh7367, sh7377, sh7372, sh73a0 and r8a7740.

Tested with out-of-tree DT support code on the
sh7372 Mackerel board.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-05-12 14:28:12 +02:00
Yong Zhang 4311051c35 i2c: irq: Remove IRQF_DISABLED
Since commit [c58543c8: genirq: Run irq handlers with interrupts disabled],
We run all interrupt handlers with interrupts disabled
and we even check and yell when an interrupt handler
returns with interrupts enabled (see commit [b738a50a:
genirq: Warn when handler enables interrupts]).

So now this flag is a NOOP and can be removed.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-10-29 09:55:45 +01:00
Ben Dooks 5bdfdfeed5 Merge branches 'for-2639/i2c-eg20t', 'for-2639/i2c-shmobile', 'for-2639/i2c-tegra' and 'for-2639/i2c-nomadik2' into for-linus/2640/i2c 2011-05-25 00:25:55 +01:00
Magnus Damm 81f8115305 i2c: i2c-sh_mobile bus speed platform data V2
Add support to the i2c-sh_mobile driver for setting
the I2C bus speed using platform data.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-05-11 07:08:13 +01:00
Magnus Damm 1082d5d29d i2c: i2c-sh_mobile clock string removal
Remove the clock string magic from the i2c-sh_mobile driver
now when all platforms support clkdev properly.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-05-11 07:08:13 +01:00
Guennadi Liakhovetski 7ef0c12a28 i2c: add a module alias to the sh-mobile driver
This patch enables I2C driver autoloading on sh-mobile systems.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Reviewed-by: Simon Horman <horms@verge.net.au>
Cc: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-04-18 18:44:54 +09:00
Paul Mundt bbcf6e8b66 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
	arch/sh/include/asm/Kbuild
	drivers/Makefile

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-08-16 13:32:24 +09:00
Magnus Damm 82b20d8bae i2c: i2c-sh_mobile irq rollback fix
Update the i2c-sh_mobile driver to properly free
interrupts. The function sh_mobile_i2c_hook_irqs()
is fixed so module both unload and load are working
as expected.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-08-04 16:10:34 +09:00
Magnus Damm 962b6032c8 i2c: i2c-sh_mobile support for new ICIC bits
Add support for a new version of the IIC block
found in the SH-Mobile ARM line of processors.

Prototype patch written by Nishimoto-san.
Tested on sh7377 and sh7372.

Signed-off-by: NISHIMOTO Hiroki <nishimoto.hiroki@renesas.com>
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-04-07 16:19:47 +09:00
Magnus Damm 12a55f2db7 i2c: i2c-sh_mobile register access code break out
Break out register access functions in the
i2c-sh_mobile driver. This update should not
change any driver logic.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-04-07 16:19:33 +09:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Alexey Dobriyan 471452104b const: constify remaining dev_pm_ops
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-15 08:53:25 -08:00
Magnus Damm f1a3b994f9 i2c: Runtime PM for SuperH Mobile I2C
This patch modifies the SuperH Mobile I2C driver to support
Runtime PM. These changes is all that is needed for proper
Runtime PM support in this driver. Driver callbacks for
Runtime PM are empty because the device registers are always
re-initialized after pm_runtime_get_sync().

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-23 18:03:19 +09:00
Magnus Damm ccb3bc16b4 i2c-sh_mobile: change module_init() to subsys_initcall()
Convert the i2c-sh_mobile i2c bus driver to use
subsys_initcall() instead of module_init().

This change makes the driver register a bit earlier which
together with earlier platform data moves the time for probe().
The earlier probe() makes it possible to use i2c_get_adapter()
and i2c_transfer() from device_initcall().

The same strategy is used by other i2c bus drivers such as
i2c-pxa.c and i2c-s3c2410.c.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
[ben-linux@fluff.org: minor subject updaye]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30 00:59:09 +01:00
Julia Lawall 593308259b i2c: Use resource_size
Use the function resource_size, which reduces the chance of introducing
off-by-one errors in calculating the resource size.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
struct resource *res;
@@

- (res->end - res->start) + 1
+ resource_size(res)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-15 00:03:56 +01:00
Jean Delvare 22e965c2ae i2c: Get rid of remaining bus_id access
Use dev_name(dev) instead of accessing dev.bus_id directly, as the
latter is going away soon.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
2009-01-07 14:29:16 +01:00
Magnus Damm a5616bd0f1 sh: sh_mobile i2c clock framework support
Add clock framework support to the sh_mobile i2c driver and
adjust the processor specific code accordingly.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22 18:42:51 +09:00
Magnus Damm bff4056c8b i2c: fix i2c-sh_mobile rx underrun
Fix receive path underrun in i2c-sh_mobile driver.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-11-13 15:37:07 +09:00
Magnus Damm 4eb00c9f92 i2c: fix i2c-sh_mobile timing issues
This patch teaches the i2c-sh_mobile driver to make use of wait irqs.
Without this patch only dte irqs are used which may lead to overruns
and cases of missing stop and extra bytes being read on the i2c bus.

Use of wait irqs forces the hardware to pause and wait until the cpu
is ready. Polling is also reworked in this patch to fix ms delay issues.

Verified with bus analyzer and tested on MigoR and AP325RXA boards.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-09-05 14:54:13 +09:00
Magnus Damm da672773d8 i2c: New driver for the SuperH Mobile I2C bus controller
This is V5 of the SuperH Mobile I2C Controller Driver. A simple Master
only driver for the I2C block included in processors such as sh7343,
sh7722 and sh7723. Tested on a sh7722 MigoR using a rs5c732b rtc.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-04-22 22:16:49 +02:00