From patchwork Fri Jan 3 22:26:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 239064 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Fri, 3 Jan 2020 15:26:31 -0700 Subject: [PATCH v2 00/19] i2c: designware_ic2: Improvements to timing and general cleanup Message-ID: <20200103222650.32592-1-sjg@chromium.org> This series updates the Designware I2C driver to support reading its timing from the device tree and handling it in units of nanoseconds instead of clock cycles. A new function converts from nanoseconds to the units used by the I2C controller and makes sure that the requested bus speed is not exceeded. This is more accurate than the existing method. The series includes a few smaller clean-ups in the same driver. In addition the v2 series adds enums for i2c speed and updates drivers to use them. There is currently an existing configuration method used just for a few x86 boards (Baytrail). This method is retained but it should be removed in favour of using the device tree. I have not done this in this series since I am not sure of the timings to use. Changes in v2: - Fix 'previde' typo - Add a few more clean-up patches for i2c Simon Glass (19): i2c: designware_i2c: Add more registers i2c: designware_i2c: Don't allow changing IC_CLK i2c: designware_i2c: Include clk.h in the header file i2c: designware_i2c: Rename 'max' speed to 'high' speed i2c: designware_i2c: Use an enum for selected speed mode i2c: designware_i2c: Use an accurate bus clock instead of MHz i2c: designware_i2c: Bring in the binding file i2c: designware_i2c: Read device-tree properties i2c: designware_i2c: Drop scl_sda_cfg parameter i2c: designware_i2c: Put hold config in a struct i2c: designware_i2c: Rewrite timing calculation i2c: designware_i2c: Add spike supression i2c: Add enums for i2c speed and address size i2c: ast_i2c: Update to use standard enums for speed i2c: designware_i2c: Update to use standard enums for speed i2c: kona_i2c: Update to use standard enums for speed i2c: omap: Update to use standard enums for speed i2c: stm32: Update to use standard enums for speed i2c: Update drivers to use enum for speed .../i2c/i2c-designware.txt | 73 +++++ drivers/i2c/ast_i2c.c | 2 +- drivers/i2c/ast_i2c.h | 2 - drivers/i2c/designware_i2c.c | 265 ++++++++++++++---- drivers/i2c/designware_i2c.h | 50 ++-- drivers/i2c/designware_i2c_pci.c | 4 +- drivers/i2c/exynos_hs_i2c.c | 4 +- drivers/i2c/fsl_i2c.c | 3 +- drivers/i2c/i2c-cdns.c | 2 +- drivers/i2c/i2c-uclass.c | 12 +- drivers/i2c/i2c-uniphier-f.c | 2 +- drivers/i2c/i2c-uniphier.c | 2 +- drivers/i2c/imx_lpi2c.c | 8 +- drivers/i2c/kona_i2c.c | 28 +- drivers/i2c/mv_i2c.c | 4 +- drivers/i2c/mvtwsi.c | 5 +- drivers/i2c/omap24xx_i2c.c | 5 +- drivers/i2c/omap24xx_i2c.h | 4 - drivers/i2c/rcar_i2c.c | 2 +- drivers/i2c/rcar_iic.c | 2 +- drivers/i2c/s3c24x0_i2c.c | 4 +- drivers/i2c/sandbox_i2c.c | 3 +- drivers/i2c/stm32f7_i2c.c | 43 ++- include/i2c.h | 26 ++ 24 files changed, 410 insertions(+), 145 deletions(-) create mode 100644 doc/device-tree-bindings/i2c/i2c-designware.txt