summaryrefslogtreecommitdiff
path: root/drivers/i2c/busses/i2c-rcar.c
AgeCommit message (Collapse)Author
2014-09-02i2c: rcar: fix MNR interrupt handlingSergei Shtylyov
Sometimes the MNR and MST interrupts happen simultaneously (stop automatically follows NACK, according to the manuals) and in such case the ID_NACK flag isn't set since the MST interrupt handling precedes MNR and all interrupts are cleared and disabled then, so that MNR interrupt is never noticed -- this causes NACK'ed transfers to be falsely reported as successful. Exchanging MNR and MST handlers fixes this issue, however the MNR bit somehow gets set again even after being explicitly cleared, so I decided to completely suppress handling of all disabled interrupts (which is a good thing anyway)... Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Cc: stable@vger.kernel.org Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-07-16i2c: i2c-rcar: Drop class based scanning to improve bootup timeWolfram Sang
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. While we are here, remove the indentation for the array setup because such things always break after some time. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-02i2c: remove unnecessary OOM messagesJingoo Han
The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message. For example, k.alloc and v.alloc failures use dump_stack(). Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Felipe Balbi <balbi@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: update copyright and license informationWolfram Sang
Make clear that the driver is GPL v2 only. Remove FSF address. Remove filename in comment. Update copyright information. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: janitorial cleanup after refactoringWolfram Sang
Remove some obvious comments, remove some superfluous debug output (the error code carries the same information), some white space fixing... Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: reuse status bits as enable bitsWolfram Sang
Status register and enable register are identical regarding their layout. Use the bit definitions for both. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: remove spinlockWolfram Sang
The i2c core has per-adapter locks, so no need to protect again. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: refactor status bit handlingWolfram Sang
The old macros made it harder to see what was actually happening. Replace them with something more readable. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: refactor setting up msgWolfram Sang
Setting up a read or write message is similar enough to be done in one function. Also, move a helper function into the new function since it is only used here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: check bus free before first messageWolfram Sang
We should always check if the bus is free, independently if it is a read or write. It should be done before the first message, though. After that, we ourselves keep the bus busy. Remove a 'ret' assignment which only silenced a build warning. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: refactor irq state machineWolfram Sang
Remove the seperate functions and use designated constants. As readable but less overhead. Actually, this is even more readable since the old function used a mix of "=" and "|=". Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: refactor bus state machineWolfram Sang
Remove the seperate functions and use designated constants. As readable but less overhead. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: no need to store irq numberWolfram Sang
We use devm, so irq number is only needed during probe. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: not everything needs to be a functionWolfram Sang
Very basic operations, just called once, can also go to the caller. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-01i2c: rcar: add compatibles for additional SoCWolfram Sang
Signed-off-by: Wolfram Sang <wsa@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-05-14i2c: rcar: bail out on zero length transfersWolfram Sang
This hardware does not support zero length transfers. Instead, the driver does one (random) byte transfers currently with undefined results for the slaves. We now bail out. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
2014-03-05i2c: i2c-rcar: deprecate class based instantiationWolfram Sang
Warn users that class based instantiation is going away soon in favour of more robust probing and faster bootup times. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-02-26i2c: rcar: add compatible entry for r8a7791Wolfram Sang
While we are here, also brush up the devicetree binding documentation. The example was an inappropriate copy from the sh_mobile driver. Signed-off-by: Wolfram Sang <wsa@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-01-26i2c: rcar: fix NACK error codeBen Dooks
The response to a bus NACK is to return -ENXIO instead of the -EREMOTEIO being currently returned by the driver. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-01-26i2c: rcar: use devm_clk_get to ensure clock is properly ref-countedBen Dooks
The current i2c-rcar driver does clk_get() without a corresponding clk_put(). Add the clk to the driver private data and then get it with the devm functions so that it is released when the driver is unbound. Note, we do not call clk_prepare_enable() at this point due to the very possible magic that is being done by the pm_runtime system underneath the driver. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-01-26i2c: rcar: do not print error if device nacks transferBen Dooks
The i2c-rcar driver currently prints an error message if the master_xfer callback fails. However if the bus is being probed then lots of NAKs will be generated, causing the output of a number of errors printed. To solve this, disable the print if the error is not -EREMOTEIO. An example of running i2cdetect: 10: i2c-rcar e6530000.i2c: error -121 : 15 -- i2c-rcar e6530000.i2c: error -121 : 15 -- 12 i2c-rcar e6530000.i2c: error -121 : 15 -- i2c-rcar e6530000.i2c: error -121 : 15 -- i2c-rcar e6530000.i2c: error -121 : 15 -- i2c-rcar e6530000.i2c: error -121 : 15 -- i2c-rcar e6530000.i2c: error -121 : 15 -- i2c-rcar e6530000.i2c: error -121 : 15 Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-01-24i2c: delete non-required instances of include <linux/init.h>Paul Gortmaker
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-11-01i2c: rcar: fixup rcar type namingKuninori Morimoto
b720423a2627f045133bec39a31fe2bc0dab86f3 (i2c: rcar: add rcar-H2 support) added R-Car H2 support on i2c-rcar. The R-Car I2C type is based on SoC generation (Gen1 = E1/M1/H1, Gen2 = E2/M2/H2), but added naming was H1/H2 instead of Gen1/Gen2. Gen1/Gen2 is better naming on this driver. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-09-30i2c: rcar: use per-device clockGuennadi Liakhovetski
Using the same clock for all device instances is non-portable and obtaining clock references by an ID without using a device pointer is discouraged. This is also not needed, because on platforms, where this driver is used, suitable clocks are available for the I2C controllers, that are children of the peripheral clock and just pass its rate 1-to-1 to controllers. This patch switches the driver to obtain references to correct clocks. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-09-30i2c: rcar: fix clk_get() error handlingGuennadi Liakhovetski
When clk_get() fails, it returns an error code, not a NULL. This patch fixes such an error handling bug. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-09-30i2c: rcar: add Device Tree supportGuennadi Liakhovetski
This patch adds Device Tree support to the i2c-rcar driver and respective documentation. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-09-30i2c: rcar: get clock rate only once and simplify calculationGuennadi Liakhovetski
There is no need to repeatedly query clock frequency, where it is not expected to change. The complete loop can also trivially be replaced with a simple division. A further loop below the one, being simplified, could also be replaced, but that would get more complicated. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-09-30i2c: rcar: (cosmetic) remove superfluous parenthesisGuennadi Liakhovetski
A recent patch added even more superfluous parenthesis to those, which already were there. Remove them again. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-09-04i2c: rcar: add rcar-H2 supportNguyen Viet Dung
This patch modify I2C driver of rcar-H1 to usable on both rcar-H1 and rcar-H2. Signed-off-by: Nguyen Viet Dung <nv-dung@jinso.co.jp> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-08-19i2c: use dev_get_platdata()Jingoo Han
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-06-12drivers/i2c/busses: don't check resource with devm_ioremap_resourceWolfram Sang
devm_ioremap_resource does sanity checks on the given resource. No need to duplicate this in the driver. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-01-24i2c: Convert to devm_ioremap_resource()Thierry Reding
Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling. devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-12-22i2c: remove __dev* attributes from subsystemBill Pemberton
CONFIG_HOTPLUG is going away as an option. As result the __dev* markings will be going away. Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Acked-by: Peter Korsgaard <peter.korsgaard@barco.com> (for ocores and mux-gpio) Acked-by: Havard Skinnemoen <hskinnemoen@gmail.com> (for i2c-gpio) Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn> (for puf3) Acked-by: Barry Song <baohua.song@csr.com> (for sirf) Reviewed-by: Jean Delvare <khali@linux-fr.org> [wsa: Fixed "foo* bar" flaws while we are here] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-11-13i2c: rcar: fix section mismatchWolfram Sang
Give the driver struct a name according to the 'standard' to fix: WARNING: vmlinux.o(.data+0x11798): Section mismatch in reference from the variable rcar_i2c_drv to the function .devinit.text:rcar_i2c_probe() ... WARNING: vmlinux.o(.data+0x1179c): Section mismatch in reference from the variable rcar_i2c_drv to the function .devexit.text:rcar_i2c_remove() Reported-by: Simon Horman <horms@verge.net.au> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
2012-11-13i2c: rcar: used devm_request_and_ioremap() instead of devm_ioremap()Kuninori Morimoto
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-10-08i2c: add Renesas R-Car I2C driverKuninori Morimoto
R-Car I2C is similar with SH7760 I2C. But the SH7760 I2C driver had many workaround operations, since H/W had bugs. Thus, it was pointless to keep compatible between SH7760 and R-Car I2C drivers. This patch creates new Renesas R-Car I2C driver. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>