summaryrefslogtreecommitdiff
path: root/include/i2c.h
Commit message (Collapse)AuthorAgeLines
* dm: i2c: Add support for multiplexed I2C busesSimon Glass2015-08-05-0/+39
| | | | | | | | | | | | | | | | | Add a new I2C_MUX uclass. Devices in this class can multiplex between several I2C buses, selecting them one at a time for use by the system. The multiplexing mechanism is left to the driver to decide - it may be controlled by GPIOs, for example. The uclass supports only two methods: select() and deselect(). The current mux state is expected to be stored in the mux itself since it is the only thing that knows how to make things work. The mux can record the current state and then avoid switching unless it is necessary. So select() can be skipped if the mux is already in the correct state. Also deselect() can be made a nop if required. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: i2c: Add a function to transfer messagesSimon Glass2015-08-05-0/+13
| | | | | | | | | | | Sometimes it is useful to be able to transfer a raw I2C message. This happens when the chip address needs to be set manually, or when the data to be sent/received is in another buffer. Add a function to provide access to this. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* dm: i2c: Move definitions to the top of the header fileSimon Glass2015-08-05-43/+43
| | | | | | | | Move the flags and struct definitions higher in the file so that we can reference them with functions declared in the driver model section. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* dm: i2c: Correct comment nits in dm_i2c_reg_read/write()Simon Glass2015-08-05-0/+2
| | | | | | | Add documentation for the @dev parameter. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* dm: i2c: Add a message debug functionSimon Glass2015-08-05-0/+10
| | | | | | | Add a way to dump the contents of an I2C message for debugging purposes. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* dm: i2c: Add compatibility functions for dm_i2c_reg_read/write()Simon Glass2015-06-10-0/+6
| | | | | | | | Add the legacy i2c_reg_read/write() functions to the compatibility layer so that they can be used when CONFIG_DM_I2C_COMPAT is defined. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* dm: i2c: Add a function to find out the chip offset lengthSimon Glass2015-05-14-1/+8
| | | | | | | | We can currently set this but there is no API function to get it. Add one. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Heiko Schocher<hs@denx.de>
* dm: i2c: Add an explicit test mode to the sandbox I2C driverSimon Glass2015-05-05-0/+1
| | | | | | | | | At present this driver has a few test features. They are needed for running the driver model unit tests but are confusing and unnecessary if using sandbox at the command line. Add a flag to enable the test mode, and don't enable it by default. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: i2c: Add functions to read and write a registerSimon Glass2015-05-05-0/+21
| | | | | | | | Add driver model versions of the legacy functions to read and write a single byte register. These are a useful shortcut in many cases. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* dm: core: Add dev_get_uclass_priv() to access uclass private dataSimon Glass2015-04-16-4/+4
| | | | | | | | Add a convenience function to access the private data that a uclass stores for each of its devices. Convert over most existing uses for consistency and to provide an example for others. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: i2c: Make API accessible even without CONFIG_DMSimon Glass2015-02-12-4/+1
| | | | | | | | | | | | Make the driver model I2C API available always, even if driver model is not enabled. This allows for a 'soft' switch-over, where drivers can use the new structures in code which is compiled but not yet used. This makes migration easier in some cases. Fix up the existing drivers which define their own 'struct i2c_msg'. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* dm: i2c: Add a dm_ prefix to driver model bus speed functionsSimon Glass2015-02-12-4/+4
| | | | | | | | As with i2c_read() and i2c_write(), add a dm_ prefix to the driver model versions of these functions to avoid conflicts. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* dm: i2c: Add two more I2C init functions to the compatibility layerSimon Glass2015-01-29-1/+16
| | | | | | | | These functions are useful in case the board calls them. Also fix a missing parameter caused by applying the wrong patch (actually I failed to send v2 and applied v1 by mistake). Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: i2c: Move slave details to child platdataSimon Glass2015-01-29-2/+2
| | | | | | | | | | | | | | | | | At present we go through various contortions to store the I2C's chip address in its private data. This only exists when the chip is active so must be set up when it is probed. Until the device is probed we don't actually record what address it will appear on. However, now that we can support per-child platform data, we can use that instead. This allows us to set up the address when the child is bound, and avoid the messy contortions. Unfortunately this is a fairly large change and it seems to be difficult to break it down further. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* dm: i2c: Provide an offset length parameter where neededSimon Glass2015-01-29-2/+6
| | | | | | | | | | Rather than assuming that the chip offset length is 1, allow it to be provided. This allows chips that don't use the default offset length to be used (at present they are only supported by the command line 'i2c' command which sets the offset length explicitly). Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* dm: i2c: Add a compatbility layerSimon Glass2015-01-29-0/+59
| | | | | | | | | | | | | For boards which use multiple I2C devices, or for SOCs which support multiple boards, we might want to convert these to driver model at different times. At present this is difficult because we need to either use CONFIG_DM_I2C for a board or not. Add a compatibility layer which implements the old API, thus allowing a board to move to driver model for I2C without requiring that everything it uses is moved in the same commit. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: i2c: Rename driver model I2C functions to permit compatibilitySimon Glass2015-01-29-10/+9
| | | | | | | | | | | Add a dm_ prefix to driver model I2C functions so that we can keep the old ones around. This is a little unfortunate, but on reflection it is too difficult to change the API. We can undo this rename when most boards and drivers are converted to use driver model for I2C. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: i2c: Add a uclass for I2CSimon Glass2014-12-11-0/+352
| | | | | | | | | | | | | | The uclass implements the same operations as the current I2C framework but makes some changes to make it fit driver model better: - Remove the chip address from API calls - Remove the address length from API calls - Remove concept of 'current' I2C bus - Drop all existing init functions Acked-by: Heiko Schocher <hs@denx.de> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* OMAP24xx I2C: Add support for set-speedHannes Petermaier2014-02-20-0/+1
| | | | | | | | | | | | | | | Adds support for set-speed on the OMAP24xx I2C Adapter. Changes to omap24_i2c_write(...) for polling ARDY Bit from IRQ-Status. Otherwise on a subsequent call the transfer of last byte from the predecessor is aborted and therefore lost. For exmaple when i2c_write(...) is followed by a i2c_setspeed(...) (which has to deactivate and activate master for changing psc,...). Minor cosmetical changes. Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at> Cc: Heiko Schocher <hs@denx.de>
* i2c: switch from AT91 legacy to ATMEL legacyAndreas Bießmann2013-11-13-1/+1
| | | | | | | | Since the required API is gpio which is enclosed with CONFIG_ATMEL_LEGACY use that switch here. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Acked-by: Heiko Schocher <hs@denx.de>
* i2c: Zynq: Support for TI PCA9548 bus multiplexerMichael Burr2013-10-17-0/+2
| | | | | | | | (Interface is not quite the same as Phillips PCA9547.) Signed-off-by: Michael Burr <michael.burr@logicpd.com> Cc: Heiko Schocher <hs@denx.de> Cc: Michal Simek <monstr@monstr.eu>
* i2c:multibus:fix: Correct I2C_MULTI_BUS value when support for many buses is ↵Łukasz Majewski2013-08-20-1/+1
| | | | | | | | | | | | | | | | enabled The I2C_MULTI_BUS needs to be defined for correct I2C operation with many software emulated I2C controllers. This fix restores correct value of the I2C_MULTI_BUS changed by following commit: SHA1: 385c9ef5a7215b2b0c22836fee6c692dfc8559d7 i2c: add i2c_core and prepare for new multibus support Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Heiko Schocher <hs@denx.de>
* Merge branch 'master' of git://git.denx.de/u-boot-i2cTom Rini2013-07-24-28/+204
|\ | | | | | | | | | | | | | | | | | | | | The sandburst-specific i2c drivers have been deleted, conflict was just over the SPDX conversion. Conflicts: board/sandburst/common/ppc440gx_i2c.c board/sandburst/common/ppc440gx_i2c.h Signed-off-by: Tom Rini <trini@ti.com>
| * i2c, multibus: get rid of CONFIG_I2C_MUXHeiko Schocher2013-07-23-21/+0
| | | | | | | | | | | | | | | | | | | | | | CONFIG_I2C_MUX is replaced through the new i2c multibus/multiadapter framework, configured through CONFIG_SYS_I2C. As CONFIG_I2C_MUX is only used on the keymile boards, and they are now completely moved to the new framework, remove CONFIG_I2C_MUX. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Holger Brunck <holger.brunck@keymile.com> Tested-By: Holger Brunck <holger.brunck@keymile.com>
| * i2c, soft-i2c: switch to new multibus/multiadapter supportHeiko Schocher2013-07-23-0/+9
| | | | | | | | | | | | | | | | | | - added to soft_i2c driver new multibus/multiadpater support - adapted all config files, which uses this driver Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Stephen Warren <swarren@wwwdotorg.org>
| * i2c: common changes for multibus/multiadapter supportHeiko Schocher2013-07-23-9/+0
| | | | | | | | | | | | Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org> Cc: Henrik Nordström <henrik@henriknordstrom.net>
| * i2c: add i2c_core and prepare for new multibus supportHeiko Schocher2013-07-23-9/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This Patch introduce the new i2c_core file, which holds the I2C core functions, for the rework of the multibus/ multiadapter support. Also adds changes in i2c.h for the new I2C multibus/multiadapter support. This new support can be activated with the CONFIG_SYS_I2C define. Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Stephen Warren <swarren@wwwdotorg.org>
* | Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-17/+1
|/ | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* I2C: Driver changes for FDT supportRajeshwari Shinde2013-01-08-0/+26
| | | | | | | | | | Functions added to get the I2C bus number and reset I2C bus using FDT node. Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* i2c:soft:multi: Support for multiple soft I2C buses at Samsung boardsŁukasz Majewski2012-09-17-0/+12
| | | | | | | | | | | | | | | | | | Support for multiple soft I2C buses. Multibus I2C support is achieved by defining get_multi_{sda|scl}_pin functions to switch between multiple "soft" I2C buses. Common definition of I2C_X I2C buses is provided at <i2c.h>. TEST HW: Samsung's Exynos4210 evt.0.1 - Trats development board Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Heiko Schocher <hs@denx.de> Cc: Minkyu Kang <mk7.kang@samsung.com> Acked-by: Heiko Schocher <hs@denx.de>
* fix: error ATMEL_FIO_BASE undeclared, if use I2C_Soft on AT91esw@bus-elektronik.de2012-01-11-1/+1
| | | | | | | | * Since AT91 name schema was changed to ATMEL_BASE_xxx, I2C_SOFT on AT91 devices fails with 'error: ATMEL_FIO_BASE undeclared' * change ATMEL_PIO_BASE to ATMEL_BASE_PIOA will fix this Signed-off-by: Jens Scharsig <esw@bus-elektronik.de>
* GCC4.6: Squash warning in cmd_date.cMarek Vasut2011-10-27-9/+23
| | | | | | | | | | | cmd_date.c: In function ‘do_date’: cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used [-Wunused-but-set-variable] Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org>
* Revert "GCC4.6: Convert various empty macros to inline functions"Wolfgang Denk2011-10-04-4/+1
| | | | | | | | | | | | This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac. The commit causes build breakage for a number of boards. This results from the fact that now the arguments of debug() actually get referenced (even if there is hope that the compiler will optimize away the debug() call). The obvious fix to that probem (change the code to always declare the referenced variables and data structures) increases the code size, and was this rejected. So it was decided to revert this commit until a better solution is found.
* GCC4.6: Convert various empty macros to inline functionsMarek Vasut2011-10-01-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Fix the following gcc4.6 problems: cmd_date.c: In function ‘do_date’: cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used [-Wunused-but-set-variable] asix.c: In function ‘asix_init’: asix.c:317:6: warning: variable ‘rx_ctl’ set but not used [-Wunused-but-set-variable] usb.c: In function ‘usb_parse_config’: usb.c:331:17: warning: variable ‘ch’ set but not used [-Wunused-but-set-variable] usb.c: In function ‘usb_hub_port_connect_change’: usb.c:1123:29: warning: variable ‘portchange’ set but not used [-Wunused-but-set-variable] usb.c: In function ‘usb_hub_configure’: usb.c:1183:25: warning: variable ‘hubsts’ set but not used [-Wunused-but-set-variable] usb_storage.c: In function ‘usb_stor_CB_reset’: usb_storage.c:466:6: warning: variable ‘result’ set but not used [-Wunused-but-set-variable] Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
* i2c: add i2c deblock sequence before and after every mux configStefan Bigler2011-04-28-2/+0
| | | | | | | | | | | | | | | To make sure that the mux can be configured a deblocking sequence is done before the mux configuration. After the mux switch the new leaf of, the i2c tree must be again deblocked. Signed-off-by: Stefan Bigler <stefan.bigler@keymile.com> Acked-by: Heiko Schocher <hs@denx.de> cc: Wolfgang Denk <wd@denx.de> cc: Detlev Zundel <dzu@denx.de> cc: Prafulla Wadaskar <prafulla@marvell.com> cc: Valentin Longchamp <valentin.longchamp@keymile.com> cc: Holger Brunck <holger.brunck@keymile.com> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
* fsl_i2c: Added a callpoint for i2c_board_late_initRichard Retanubun2010-04-19-0/+3
| | | | | | | This patch adds a callpoint in i2c_init that allows board specific i2c board initialization (typically for i2c bus reset) that is called after i2c_init operations, allowing the i2c_board_late_init function to use the pre-configured i2c bus speed and slave address.
* i2c: made unused function i2c_mux_add_device staticFrans Meulenbroeks2010-03-29-2/+0
| | | | | | and removed it from the .h file Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
* convert common files to new SoC accessJens Scharsig2010-02-12-0/+5
| | | | | | | | * add's a warning to all files, which need update to new SoC access * convert common files in cpu/../at91 and a lot of drivers to use c stucture SoC access Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
* powerpc: updates for the keymile boardsHeiko Schocher2009-07-21-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - CONFIG_SYS_MAX_I2C_BUS changed to 1 We use only one I2C hardwarecontroller on this boards, so change the CONFIG_SYS_MAX_I2C_BUS to 1. - common: dont print errormsg if second IVM Block lacks. - 82xx, mgcoge: fix double mtdpart entry in environment - 82xx, mgcoge: activate on second Flash the second bank. - common: CONFIG_ENV_SIZE 0x4000 for all keymile boards - common: Change malloc size to 1MByte for all Keymile boards We need a bigger malloc area for the environment support (128k) on some Keymile boards (kmeter1) and the upcoming UBI support. Change it to 1MB for all Keymile boards to be on the save side. Also define CONFIG_SYS_64BIT_VSPRINTF which is needed for UBI/UBIFS support. - Add UBI support to all Keymile boards - change manner of writing "/localbus/ranges" node instead of writting the complete "/localbus/ranges" node before booting Linux, only update the ranges entries which gets dynamical detected (size of flashes). This is needed, because keymile adds in the DTS "/localbus/ranges" node entries, which u-boot must not overwrite/delete. - kmeter, mgcoge: define 2 seperate regions needed for the Intel P30 chips The Intel P30 chip has 2 non-identical chips on one die, so we need to define 2 seperate regions that are scanned by physmap_of independantly. - kmeter1: Add MTD concat support to Keymile boards - 82xx, mgcoge: add "unlock=yes" to default environment - added CONFIG_MTD_DEVICE to get in sync with mainline code Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
* i2c.h: Provide a default CONFIG_SYS_I2C_SLAVE valuePeter Tyser2009-06-12-3/+9
| | | | | | | | Many boards/controllers/drivers don't support an I2C slave interface, however CONFIG_SYS_I2C_SLAVE is used in common code so provide a default Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* i2c.h: drop i2c_reg_{read, write} hack for Blackfin partsMike Frysinger2009-02-12-14/+0
| | | | | | | The Blackfin i2c driver has been rewritten thus the special ifdefs in the common code are no longer needed. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* i2c: merge all i2c_reg_read() and i2c_reg_write() into inline functionsTimur Tabi2008-12-15-2/+60
| | | | | | | | | | All implementations of the functions i2c_reg_read() and i2c_reg_write() are identical. We can save space and simplify the code by converting these functions into inlines and putting them in i2c.h. Signed-off-by: Timur Tabi <timur@freescale.com> Acked-By: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* rename CFG_ macros to CONFIG_SYSJean-Christophe PLAGNIOL-VILLARD2008-10-18-11/+11
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* I2C: adding new "i2c bus" Command to the I2C Subsystem.Heiko Schocher2008-10-18-0/+23
| | | | | | | With this Command it is possible to add new I2C Busses, which are behind 1 .. n I2C Muxes. Details see README. Signed-off-by: Heiko Schocher <hs@denx.de>
* soft_i2c: prevent compiler warnings if driver does not use CPU Pins.Heiko Schocher2008-10-18-0/+9
| | | | | | | | | | | | | | | | | | | | | This patch fixes the following warnings, when using the soft_i2c driver using no CPU pins on MPC82xx or MPC8xx systems: soft_i2c.c: In function 'send_reset': soft_i2c.c:93: warning: unused variable 'immr' soft_i2c.c: In function 'send_start': soft_i2c.c:124: warning: unused variable 'immr' soft_i2c.c: In function 'send_stop': soft_i2c.c:146: warning: unused variable 'immr' soft_i2c.c: In function 'send_ack': soft_i2c.c:171: warning: unused variable 'immr' soft_i2c.c: In function 'write_byte': soft_i2c.c:196: warning: unused variable 'immr' soft_i2c.c: In function 'read_byte': soft_i2c.c:244: warning: unused variable 'immr' Signed-off-by: Heiko Schocher <hs@denx.de>
* Big white-space cleanup.Wolfgang Denk2008-05-21-4/+4
| | | | | | | | | | | This commit gets rid of a huge amount of silly white-space issues. Especially, all sequences of SPACEs followed by TAB characters get removed (unless they appear in print statements). Also remove all embedded "vim:" and "vi:" statements which hide indentation problems. Signed-off-by: Wolfgang Denk <wd@denx.de>
* [PATCH] I2C: Add missing default CFG_SPD_BUS_NUMMatthias Fuchs2007-03-08-0/+3
| | | | Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
* [PATCH] I2C: Add missing default CFG_RTC_BUS_NUM & CFG_DTT_BUS_NUMStefan Roese2007-03-01-0/+8
| | | | Signed-off-by: Stefan Roese <sr@denx.de>
* [PATCH] PPC4xx: Add support for multiple I2C bussesStefan Roese2007-02-20-0/+10
| | | | | | | | | | | | | | This patch adds support for multiple I2C busses on the PPC4xx platforms. Define CONFIG_I2C_MULTI_BUS in the board config file to make use of this feature. It also merges the 405 and 440 i2c header files into one common file 4xx_i2c.h. Also the 4xx i2c reset procedure is reworked since I experienced some problems with the first access on the 440SPe Katmai board. Signed-off-by: Stefan Roese <sr@denx.de>
* mpc83xx: Fix dual I2C support for the MPC8349ITX, MPC8349EMDS, TQM834x, and ↵Timur Tabi2006-11-03-4/+4
| | | | | | | | | MPC8360EMDS This patch also adds an improved I2C set_speed(), which handles all clock frequencies. Signed-off-by: Timur Tabi <timur@freescale.com>