summaryrefslogtreecommitdiff
path: root/drivers/i2c
AgeCommit message (Collapse)Author
2017-05-08Merge branch 'master' of git://git.denx.de/u-boot-sunxiTom Rini
2017-05-08aspeed: Add I2C Drivermaxims@google.com
Add Device Model based I2C driver for ast2500/ast2400 SoCs. The driver is very limited, it only supports master mode and synchronous byte-by-byte reads/writes, no DMA or Pool Buffers. Signed-off-by: Maxim Sloyko <maxims@google.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
2017-04-28sunxi: i2c: Add support for DM I2CJernej Skrabec
This commit adds support for DM I2C on sunxi platform. It can coexist with old style sunxi I2C driver, because it is still used in SPL and by some SoCs. Because sunxi platform doesn't yet support DM clk, reset and pinctrl driver, workaround is needed to enable clocks and set resets and pinctrls. This is done by calling i2c_init_board() in board_init(). This means that CONFIG_I2Cx_ENABLE options needs to be correctly set in order to use needed I2C controller. Commit is based on the previous patch made by Philipp Tomsich Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-04-18Merge git://git.denx.de/u-boot-fsl-qoriqTom Rini
2017-04-17armv7: ls1021a: Drop macro CONFIG_LS102XAYork Sun
Use CONFIG_ARCH_LS1021A instead. Signed-off-by: York Sun <york.sun@nxp.com>
2017-04-15rockchip: i2c: Enable i2c for rk3399eric.gao@rock-chips.com
To enable mipi display, we need to enable pmic rk808 first for lcd3v3 power,which use i2c0 to communicate with soc. So enable i2c0. Signed-off-by: Eric Gao <eric.gao@rock-chips.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-04-05i2c: Drop unused i2c_soft...() functionsSimon Glass
These are not used in U-Boot. Manual relocation fixup is used by blackfin but that is being removed. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-04-05Blackfin: RemoveTom Rini
The architecture is currently unmaintained, remove. Cc: Benjamin Matthews <mben12@gmail.com> Cc: Chong Huang <chuang@ucrobotics.com> Cc: Dimitar Penev <dpn@switchfin.org> Cc: Haitao Zhang <hzhang@ucrobotics.com> Cc: I-SYST Micromodule <support@i-syst.com> Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de> Cc: Marek Vasut <marex@denx.de> Cc: Martin Strubel <strubel@section5.ch> Cc: Peter Meerwald <devel@bct-electronic.com> Cc: Sonic Zhang <sonic.adi@gmail.com> Cc: Valentin Yakovenkov <yakovenkov@niistt.ru> Cc: Wojtek Skulski <info@skutek.com> Cc: Wojtek Skulski <skulski@pas.rochester.edu> Signed-off-by: Tom Rini <trini@konsulko.com>
2017-04-05rockchip: i2c: Add compatibles for Rockchip Cortex-A9 socsHeiko Stübner
The Cortex-A9 socs rk3066 and rk3188 share the IP but have their own compatible values, so add them to make the i2c on these platforms accessible. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Simon Glass <sjg@chromium.org>
2017-03-28i2c: Set default I2C bus numberLukasz Majewski
This patch allows using i2c commands (e.g. "i2c probe", "i2c md", etc) without the need to first select the bus number with e.g. "i2c dev 0". This is the "i2c" command behavior similar to the one from pre DM, where by default bus 0 was immediately accessible. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2017-03-28i2c: ti: Update method to calculate psc, sscl and ssch I2C parametersLukasz Majewski
This patch updates the way in which psc, sscl and ssch I2C parameters are calculated to be in sync with v4.9 Linux kernel SHA1: 69973b830859bc6529a7a0468ba0d80ee5117826 in the ./drivers/i2c/busses/i2c-omap.c The previous method was causing several issues: - The internal I2C frequency (after prescaler) was far above recommended one (7 - 12 MHz [*]) - the current approach brings better noise suppression (as stated in Linux commit: SHA1: 84bf2c868f3ca996e5bb) - The values calculated (psc, sscl and ssch) were far from optimal, which caused on the test platform (AM57xx) the I2C0 SCL signal low time (Fast Mode) of ~1.0us (the standard requires > 1.3 us). [*] for AM57xx TRM SPRUHZ6G, Table 24,7 "HS I2C Register Values for Maximum I2C Bit Rates in I2C F/S, I2C HS Modes" Signed-off-by: Lukasz Majewski <lukma@denx.de>
2017-03-28i2c: ti: Update SCLH and SCLL to be in sync with v4.9 Linux kernelLukasz Majewski
v4.9 Linux release: SHA1: 69973b830859bc6529a7a0468ba0d80ee5117826 in the ./drivers/i2c/busses/i2c-omap.c recommends to use SCLH=5 and SCLL=7 values. This patch sets them to default. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2017-03-28i2c: lpc32xx: Force consistent bus numberingLiam Beguin
Normally, this would probably be done by adding devicetree aliases to the main dtsi file for the lpc32xx and using bus->req_seq instead. Since we want to have consistent i2c numbering, we cannot force the bus->req_seq because. If for instance we have 3 buses numbered from 0 to 2 with i2c0 enabled, i2c1 disabled and i2c2 enabled; i2c2 can be selected using 'i2c dev 1' and 'i2c dev 2' commands because a bus can be probed using req_seq or seq interchangeably. Signed-off-by: Liam Beguin <lbeguin@tycoint.com> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
2017-03-28i2c: lpc32xx: Move definitions to header fileLiam Beguin
Since the lpc32xx i2c driver does not yet support the devicetree bindings, this structure is also needed by the board file as the hardware description is done there. Signed-off-by: Liam Beguin <lbeguin@tycoint.com> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
2017-03-28i2c: lpc32xx: Remove note for DM conversationSylvain Lemieux
Removed note in the LPC32xx I2C driver for DM conversation. Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
2017-03-28i2c: lpc32xx: Add DM for lpc32xx I2CLiam Beguin
Adding DM specific wrapper functions and definitions. Signed-off-by: Liam Beguin <lbeguin@tycoint.com> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
2017-03-28i2c: lpc32xx: Factor out i2c_adapter parameterLiam Beguin
This is part of the prep work for the migration to the driver model. It will enable the driver to support DM and non-DM configurations using the same functions. Signed-off-by: Liam Beguin <lbeguin@tycoint.com> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
2017-03-28i2c: lpc32xx: Prepare compatibility functionsLiam Beguin
This is part of the prep work for the migration to the driver model. Signed-off-by: Liam Beguin <lbeguin@tycoint.com> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
2017-03-28i2c: lpc32xx: Rename probe functionLiam Beguin
This is part of the prep work for the migration to the driver model. What used to be the probe function is now called probe_chip. Signed-off-by: Liam Beguin <lbeguin@tycoint.com> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
2017-03-17i2c: lpi2c: add lpi2c driver for i.MX7ULPPeng Fan
Add lpi2c driver for i.MX7ULP. Need to enable the two options to use this driver: CONFIG_DM_I2C=y CONFIG_SYS_I2C_IMX_LPI2C=y Signed-off-by: Peng Fan <peng.fan@nxp.com> Acked-by: Heiko Schocher <hs@denx.de> Cc: Stefano Babic <sbabic@denx.de>
2017-02-17fsl_i2c.c: Fix warning on gcc-6.xTom Rini
With gcc-6.x we see: drivers/i2c/fsl_i2c.c:86:3: warning: ‘fsl_i2c_speed_map’ defined but not used [-Wunused-const-variable=] The easy way to fix this is that since we only use fsl_i2c_speed_map at all on __M68K__ move the existing guards around slightly. Reported-by: Thomas Schaefer <Thomas.Schaefer@kontron.com> Signed-off-by: Tom Rini <trini@konsulko.com> Acked-by: Heiko Schocher <hs@denx.de>
2017-02-13i2c: sandbox: remove code snippet from Kconfig helpMasahiro Yamada
With the Kconfig re-sync with Linux 4.10, characters such as '}', ';' in Kconfig help message cause warnings: $ make defconfig *** Default configuration is based on 'sandbox_defconfig' drivers/i2c/Kconfig:132:warning: ignoring unsupported character '}' drivers/i2c/Kconfig:132:warning: ignoring unsupported character ';' Drop the Device Tree fragment from the help. Acked-by: Heiko Schocher <hs@denx.de> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-02-08dm: core: Replace of_offset with accessorSimon Glass
At present devices use a simple integer offset to record the device tree node associated with the device. In preparation for supporting a live device tree, which uses a node pointer instead, refactor existing code to access this field through an inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-01-29i2c: uniphier-f: use readl_poll_timeout() to poll registersMasahiro Yamada
The readl_poll_timeout() is a useful helper to poll registers and error out if the condition is not met. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-01-29i2c: uniphier(-f): remove unneeded #include <dm/root.h>Masahiro Yamada
This include is unnecessary for low-level drivers. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-01-18Merge branch 'master' of git://git.denx.de/u-boot-i2cTom Rini
2017-01-18Merge git://git.denx.de/u-boot-samsungTom Rini
2017-01-18i2c: i2c-cdns: No need for dedicated probe functionMoritz Fischer
The generic probe code in dm works, so get rid of the leftover cruft. Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Cc: Heiko Schocher <hs@denx.de> Cc: Michal Simek <michal.simek@xilinx.com> Cc: u-boot@lists.denx.de
2017-01-18i2c: i2c-cdns: Implement workaround for hold quirk of the rev 1.0Moritz Fischer
Revision 1.0 of this IP has a quirk where if during a long read transfer the transfer_size register will go to 0, the master will send a NACK to the slave prematurely. The way to work around this is to reprogram the transfer_size register mid-transfer when the only the receive fifo is known full, i.e. the I2C bus is known non-active. The workaround is based on the implementation in the linux-kernel. Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Cc: Heiko Schocher <hs@denx.de> Cc: Michal Simek <michal.simek@xilinx.com> Cc: u-boot@lists.denx.de
2017-01-18i2c: i2c-cdns: Reorder timeout loop for interrupt waitingMoritz Fischer
Reorder the timeout loop such that we first check if the condition is already true, and then call udelay() so if the condition is already true, break early. Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Cc: Heiko Schocher <hs@denx.de> Cc: Michal Simek <michal.simek@xilinx.com> Cc: u-boot@lists.denx.de
2017-01-18i2c: i2c-cdns: Detect unsupported sequences for rev 1.0Moritz Fischer
Revision 1.0 of this IP has a couple of issues, such as not supporting repeated start conditions for read transfers. So scan through the list of i2c messages for these conditions and report an error if they are attempted. This has been fixed for revision 1.4 of the IP, so only report the error when the IP can really not do it. Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Cc: Heiko Schocher <hs@denx.de> Cc: Michal Simek <michal.simek@xilinx.com> Cc: u-boot@lists.denx.de
2017-01-18i2c: mux: Allow muxes to work as children of i2c bus without i2c-parentMoritz Fischer
For mux check if the parent is already a device of UCLASS_I2C and if yes just use that. Otherwise see if someone specified an i2c-parent phandle. This mimics the behavior found in the Kernel, as it removes the requirement to explicitly specify a i2c-parent phandle. Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Cc: Heiko Schocher <hs@denx.de> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Michal Simek <michal.simek@xilinx.com> Cc: u-boot@lists.denx.de
2017-01-18i2c: Kconfig: Add SYS_I2C_S3C24X0 entryJaehoon Chung
Adding Kconfig for SYS_I2C_S3C24X0. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2017-01-18i2c: s3c24x0: fix the compiler error for exynos4Jaehoon Chung
If CONFIG_SYS_I2C_S3C24X0_SLAVE isn't defined, then complie error should be occurred. This patch is for preventing it. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2017-01-10i2c: cdns: Add additional compatible string for r1p14 of the IP.Moritz Fischer
Adding additional compatible string for version 1.4 of the IP block. Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Heiko Schocher <hs@denx.de> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2016-12-20Merge branch 'master' of git://git.denx.de/u-boot-i2cTom Rini
2016-12-19i2c: mv_i2c.c: Correct address endiannessBradley Bolen
0c0f719ad2f46c8566a56daee37ebdb7c078c3b1 accidentally changed the endianness of the i2c read and write addresses. This was noticable when accessing EEPROMs that use 2 byte addressing as the LSB was being sent first. Signed-off-by: Bradley Bolen <bradleybolen@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2016-12-16i2c: mxc: Make 'no gpio pinctrl state' print as debugJagan Teki
Some I2C bus devicetree nodes, doesn't require to have gpio pinctrl so replace the dev_info to debug so the print never comes on the console and for bus that uses gpio pinctrl anyway have dev_err. Before: ------ U-Boot> i2c dev 1 Setting bus to 1 i2c bus 1 at 0x21a4000, no gpio pinctrl state. After: ------ U-Boot> i2c dev 1 Setting bus to 1 Cc: Simon Glass <sjg@chromium.org> Cc: Heiko Schocher <hs@denx.de> Cc: Peng Fan <peng.fan@nxp.com> Cc: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Heiko Schocher <hs@denx.de>
2016-12-16i2c: mxc: Print hex instead of decimal for bus addressJagan Teki
Better to print the hex value for bus address instead of decimal, for more readbility on bus addressing. Before: ------ U-Boot> i2c dev 1 Setting bus to 1 i2c bus 1 at 35274752, no gpio pinctrl state. After: ------ U-Boot> i2c dev 1 Setting bus to 1 i2c bus 1 at 0x21a4000, no gpio pinctrl state. Cc: Simon Glass <sjg@chromium.org> Cc: Heiko Schocher <hs@denx.de> Cc: Peng Fan <peng.fan@nxp.com> Cc: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Heiko Schocher <hs@denx.de>
2016-12-16i2c: Kconfig: Add SYS_I2C_MXC entryJagan Teki
Added kconfig for SYS_I2C_MXC driver. Cc: Stefano Babic <sbabic@denx.de> Cc: Heiko Schocher <hs@denx.de> Cc: Matteo Lisi <matteo.lisi@engicam.com> Cc: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2016-12-05dm: i2c: Add a note to I2C drivers which need conversionSimon Glass
Maintainers need to be notified more directly of the need to convert these drivers. Add a note to the top each affected file. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
2016-12-05samsung: i2c: Split the high-speed I2C code into a new driverSimon Glass
Now that driver model is used for I2C on all boards, we can split the high-speed code into its own driver. There is virtually no common code, and this significantly reduces confusion. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
2016-12-05samsung: i2c: Drop old code from I2C driverSimon Glass
Now that all boards use DM_I2C we can drop the old code. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
2016-10-30sunxi: Rename CONFIG_SUNXI to CONFIG_ARCH_SUNXIJagan Teki
CONFIG_SUNXI -> CONFIG_ARCH_SUNXI and removed CONFIG_SUNIX from config_whitelist.txt Cc: Simon Glass <sjg@chromium.org> Cc: Ian Campbell <ijc@hellion.org.uk> Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-10-28Merge branch 'master' of git://git.denx.de/u-boot-atmelTom Rini
2016-10-28i2c: at91_i2c: Change error return -ENODEV to -EINVALWenyou Yang
Change the error return value -ENODEV from to -EINVAL for more reasonable. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2016-10-28i2c: at91_i2c: Remove unnecessary clock callingWenyou Yang
Due to the peripheral clock driver improvement, remove the unnecessary clock calling. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2016-10-24i2c: designware: Avoid overwriting the cmd_data registerMarek Vasut
Make sure the driver writes the cmd_data register only once per read transfer instead of doing so potentially repeatedly. In case the read transfer didn't finish quickly enough, the loop in the driver code would spin fast enough to write the same value into the cmd_data register again before re-checking whether the transfer completed, which would cause another spurious read transfer on the bus. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Stefan Roese <sr@denx.de> Cc: Alexey Brodkin <abrodkin@synopsys.com> Cc: Heiko Schocher <hs@denx.de> Cc: Dinh Nguyen <dinguyen@opensource.altera.com> Cc: Chin Liang See <clsee@altera.com>
2016-10-13libfdt: Bring in upstream stringlist functionsSimon Glass
These have now landed upstream. The naming is different and in one case the function signature has changed. Update the code to match. This applies the following upstream commits by Thierry Reding <treding@nvidia.com> : 604e61e fdt: Add functions to retrieve strings 8702bd1 fdt: Add a function to get the index of a string 2218387 fdt: Add a function to count strings Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-11x86: i2c: Fix cast of address to 32-bit valueSimon Glass
This gives a build warning on 64-bit x86. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>