summaryrefslogtreecommitdiff
path: root/drivers/i2c/busses/i2c-eg20t.c
AgeCommit message (Collapse)Author
2016-09-21i2c-eg20t: fix race between i2c init and interrupt enableYadi.hu
the eg20t driver call request_irq() function before the pch_base_address, base address of i2c controller's register, is assigned an effective value. there is one possible scenario that an interrupt which isn't inside eg20t arrives immediately after request_irq() is executed when i2c controller shares an interrupt number with others. since the interrupt handler pch_i2c_handler() has already active as shared action, it will be called and read its own register to determine if this interrupt is from itself. At that moment, since base address of i2c registers is not remapped in kernel space yet,so the INT handler will access an illegal address and then a error occurs. Signed-off-by: Yadi.hu <yadi.hu@windriver.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
2015-12-03i2c: eg20t: set i2c_adapter->dev.of_nodePaul Burton
Set the I2C adapter devices of_node to that of the PCI device, such that I2C clients may be instantiated via device tree. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-11-07i2c: remove FSF addressWolfram Sang
We have a central copy of the GPL for that. Some addresses were already outdated. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
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-03-13i2c: remove DEFINE_PCI_DEVICE_TABLE macroJingoo Han
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro is not preferred. Signed-off-by: Jingoo Han <jg1.han@samsung.com> 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-17i2c: i2c-eg20t: do not print error message in syslog if no ACK receivedAndreas Werner
Using the i2c-eg20t driver and call i2cdetect or probe on the bus, the driver will print a lot of error messages if there was no ACK received. i2cdetect normally print a table with all the available devices. If there is no device on the address, the table will be empty. Currently with the i2c-eg20t driver, the table is not visible because the error messages destroy the table. Error message: pch_i2c_getack return -71 This patch prevent the driver to print the messages to syslog. The pch_i2c_wait_for_check_xfer function is the only one who is calling pch_i2c_getack, so we can delete the function and add the read to pch_i2c_wait_for_check_xfer. If no ACK is received, the Message will be printed as a dbg message. Fixed print message to be a one liner so we can grep for the error message. Tested on Intel Atom E6xx and Eg20t Chipset. Signed-off-by: Andreas Werner <wernerandy@gmx.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-02-21i2c: Remove unneeded xxx_set_drvdata(..., NULL) callsDoug Anderson
There is simply no reason to be manually setting the private driver data to NULL in the remove/fail to probe cases. This is just extra cruft code that can be removed. A few notes: * Nothing relies on drvdata being set to NULL. * The __device_release_driver() function eventually calls dev_set_drvdata(dev, NULL) anyway, so there's no need to do it twice. * I verified that there were no cases where xxx_get_drvdata() was being called in these drivers and checking for / relying on the NULL return value. This could be cleaned up kernel-wide but for now just take the baby step and remove from the i2c subsystem. Reported-by: Wolfram Sang <wsa@the-dreams.de> Reported-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Jean Delvare <khali@linux-fr.org> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Wolfram Sang <wolfram@the-dreams.de>
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-07-24i2c/busses: Use module_pci_driverAxel Lin
Convert the drivers in drivers/i2c/busses/* to usemodule_pci_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Olof Johansson <olof@lixom.net> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Tomoya MORINAGA <tomoya.rohm@gmail.com>
2012-05-12i2c: eg20t: don't use strcpy but strlcpyWolfram Sang
Signed-off-by: Wolfram Sang <wolfram@the-dreams.de> Cc: Tomoya MORINAGA <tomoya.rohm@gmail.com>
2012-05-12i2c: eg20t: remove unused functionWolfram Sang
cppcheck rightfully says: drivers/i2c/busses/i2c-eg20t.c:266: style: The function 'ktime_lt' is never used Signed-off-by: Wolfram Sang <wolfram@the-dreams.de> Cc: Tomoya MORINAGA <tomoya.rohm@gmail.com>
2012-05-12i2c: eg20t: pass on return value in i2c_xferWolfram Sang
smatch says: drivers/i2c/busses/i2c-eg20t.c:702 pch_i2c_xfer() info: why not propagate 'ret' from mutex_lock_interruptible() instead of -512? which is especially true since for -ENORESTARTSYS it is said in linux/errno.h "signal_pending() MUST be set" which is not done here. So just pass on the return value we got. Signed-off-by: Wolfram Sang <wolfram@the-dreams.de> Cc: Tomoya MORINAGA <tomoya.rohm@gmail.com>
2012-05-12i2c: eg20t: use NULL instead of 0Wolfram Sang
sparse rightfully says: drivers/i2c/busses/i2c-eg20t.c:990:59: warning: Using plain integer as NULL pointer Signed-off-by: Wolfram Sang <wolfram@the-dreams.de> Cc: Tomoya MORINAGA <tomoya.rohm@gmail.com>
2012-05-12i2c-eg20t: Merge two functionsTomoya MORINAGA
By previous patch, pch_i2c_wait_for_xfer_complete can be merged to pch_i2c_wait_for_check_xfer. Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-05-12i2c-eg20t: add helper function for xfer checkTomoya MORINAGA
Currently, there are the same code for xfer complete check processing. So, I add helper function pch_i2c_wait_for_check_xfer. Reported-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-05-12i2c-eg20t: Call init() when wait-event timeout occursTomoya MORINAGA
Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-04-22i2c-eg20t: Modify MODULE_AUTHOR's email addressTomoya MORINAGA
Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-04-22i2c-eg20t: change timeout value 50msec to 1000msecTomoya MORINAGA
Currently, during i2c works alone, wait-event timeout is not occurred. However, as CPU load increases, timeout occurs frequently. So, I modified like this patch. Modifying like this patch, I've never seen the timeout event with high load test. Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-03-07i2c-eg20t: Remove write-only variablesAlexander Stein
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-03-07i2c-eg20t: Rework pch_i2c_wait_for_bus_idle to reduce wait timeAlexander Stein
If you insert several i2c transfers, the driver might start the next one while the STOP bit of the previous transfer is still on the bus, marking the bus as busy. pch_i2c_wait_for_bus_idle does an msleep(20) delaying the next transfer by >=20ms. Reduce wait time by actively waiting 5 us once, then using usleep_range. Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Acked-by: Tomoya MORINAGA <tomoya.rohm@gmail.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-01-17i2c-eg20t: Change-company-name-OKI-SEMICONDUCTOR to LAPIS SemiconductorTomoya MORINAGA
On October 1 in 2011, OKI SEMICONDUCTOR Co., Ltd. changed the company name in to LAPIS Semiconductor Co., Ltd. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2012-01-17i2c-eg20t: Support new device LAPIS Semiconductor ML7831 IOHTomoya MORINAGA
ML7831 is companion chip for Intel Atom E6xx series. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2012-01-17i2c-eg20t: modified the setting of transfer rate.Toshiharu Okada
This patch modified the setting value of I2C Bus Transfer Rate Setting Counter regisrer. Signed-off-by: Toshiharu Okada <toshiharu-linux@dsn.okisemi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2012-01-17i2c-eg20t: use i2c_add_numbered_adapter to get a fixed bus numberFeng Tang
For EG20T and ML7213 IOH, the i2c controller numbers are fixed, using fixed bus number will make it much easier for platform code to use i2c_register_board_info() to register i2c devices. Signed-off-by: Feng Tang <feng.tang@intel.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2012-01-12i2c: Convert to DEFINE_PCI_DEVICE_TABLEAxel Lin
Convert static struct pci_device_id *[] to static DEFINE_PCI_DEVICE_TABLE tables. Use DEFINE_PCI_DEVICE_TABLE ensures we make the pci_device_id table const and marked as __devinitconst. This also fixes some warnings from checkpatch: e.g. WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #1096: FILE: i2c/busses/i2c-intel-mid.c:1096: +static struct pci_device_id intel_mid_i2c_ids[] = { Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Ben Dooks <ben-linux@fluff.org> Acked-by: Olof Johansson <olof@lixom.net> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Acked-by: Dirk Brandewie <dirk.brandewie@gmail.com> Cc: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Feng Tang <feng.tang@intel.com> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2011-12-18i2c-eg20t: correct the driver init order of pch_i2c_probe()Feng Tang
Before registering an adapter to i2c subsystem, we need make sure driver is ready for incoming i2c xfer, becasue the i2c_add_adapter() may trigger a i2c device driver's proble function which may start some real i2c xfer. I met this issue when integrating a TSC2007 i2c touch screen device with the i2c-eg20t driver. This patch will call request_irq() and hw init before calling i2c_add_adapter(). Signed-off-by: Feng Tang <feng.tang@intel.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-10-29i2c-eg20t: Add initialize processing in case i2c-error occursTomoya MORINAGA
In case disconnecting physical connection, need to initialize i2c device for retry access. This patch adds initialize process in case bus-idle fails and Lost arbitration. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-10-29i2c-eg20t: Fix flag setting issueTomoya MORINAGA
Currently, in case occurring abnormal event, internal flag variable(=pch_event_flag) is not reset. This patch fixes the issue. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-10-29i2c-eg20t: add stop sequence in case wait-event timeout occursTomoya MORINAGA
add stop sequence in case wait-event timeout in write processing. (read processing already had it) Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-10-29i2c-eg20t: Separate error processingTomoya MORINAGA
Error processing for NACK or wait-event must be precessed separately. So divide wait-event error processing into NACK-receiving and timeout. Add arbitration lost processing. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-10-29i2c-eg20t: Fix 10bit access issueTomoya MORINAGA
Reported-by: Jeffrey (Sheng-Hui) Chu <jeffchu@broadcom.com> Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-10-29i2c-eg20t: Modify returned value s32 to longTomoya MORINAGA
Type of wait_event_timeout is long not s32. This patch replaces s32 with long. Additionally, delete negative processing(ret < 0). Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-10-29i2c-eg20t: Fix bus-idle waiting issueTomoya MORINAGA
Currently, when checking whether bus is idle or not, if timeout occurs, this function always returns success(zero). This patch fixes the issue. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-07-26i2c-eg20t : Fix the issue of Combined R/W transfer modeTomoya MORINAGA
issue-1 In case combined transfer mode fails halfway, the processing must be stopped halfway. However currently, the processing is continued. This patch breaks the processing. issue-2 Currently, pch_i2c_xfer returns read/write size at that time. However pch_i2c_xfer must return the number of messages to be read/written. This patch modifies correctly. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-07-26i2c-eg20t : Support Combined R/W transfer modeTomoya MORINAGA
Currently, Combined R/W transfer mode is not supported. This patch enables Combined R/W transfer mode. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-05-11i2c-eg20t: Support new device ML7223 IOHTomoya MORINAGA
Support new device OKI SEMICONDUCTOR ML7223 IOH(Input/Output Hub). The ML7223 IOH is for MP(Media Phone) use. The ML7223 is companion chip for Intel Atom E6xx series. The ML7223 is completely compatible for Intel EG20T PCH. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-03-21Merge branches 'for-2639/i2c/i2c-ce4100-v6', 'for-2639/i2c/i2c-eg20t-v3' and ↵Ben Dooks
'for-2639/i2c/i2c-imx' into for-linus/2639/i2c-2
2011-03-08i2c-eg20t: include slab.h for memory allocationsWolfram Sang
Fixes (with v2.6.38-rc3/parisc/parisc-allmodconfig): src/drivers/i2c/busses/i2c-eg20t.c:720: error: implicit declaration of function 'kzalloc' src/drivers/i2c/busses/i2c-eg20t.c:790: error: implicit declaration of function 'kfree' Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-03-02i2c-eg20t: support new device OKI SEMICONDUCTOR ML7213 IOHTomoya MORINAGA
Support new device OKI SEMICONDUCTOR ML7213 IOH. The ML7213 which is for IVI(In-Vehicle Infotainment) is a companion chip for the Atom E6xx series and compatible with the Intel EG20T PCH. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2011-01-04i2c-eg20t: add driver for Intel EG20TTomoya MORINAGA
I2C driver for Intel EG20T PCH Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> Reviewed-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Qi Wang <qi.wang@intel.com> [ben-linux@fluff.org: reworded commit message] Signed-off-by: Ben Dooks <ben-linux@fluff.org>