From patchwork Thu Jan 23 18:48:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 239994 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Thu, 23 Jan 2020 11:48:03 -0700 Subject: [PATCH v3 00/23] i2c: designware_ic2: Improvements to timing and general cleanup Message-ID: <20200123184826.116850-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 v3: - Fix the address of comp_param1 by adding a gap - Drop note about moving to driver model - Use ARRAY_SIZE() for i2c_specs bounds check - Add new patch with support for fast-plus speed - Add new patch to move dw_i2c_speed_config to header - Add new patch to separate out the speed calculation - Add new patch to do more in the probe() method Changes in v2: - Fix 'previde' typo - Add a few more clean-up patches for i2c Simon Glass (23): 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: designware_i2c: Add support for fast-plus speed i2c: designware_i2c: Move dw_i2c_speed_config to header i2c: designware_i2c: Separate out the speed calculation i2c: designware_i2c: Do more in the probe() method .../i2c/i2c-designware.txt | 73 +++++ drivers/i2c/ast_i2c.c | 2 +- drivers/i2c/ast_i2c.h | 2 - drivers/i2c/designware_i2c.c | 300 ++++++++++++++---- drivers/i2c/designware_i2c.h | 73 ++++- drivers/i2c/designware_i2c_pci.c | 4 +- drivers/i2c/exynos_hs_i2c.c | 5 +- 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 | 5 +- drivers/i2c/sandbox_i2c.c | 3 +- drivers/i2c/stm32f7_i2c.c | 43 +-- include/i2c.h | 26 ++ 24 files changed, 454 insertions(+), 161 deletions(-) create mode 100644 doc/device-tree-bindings/i2c/i2c-designware.txt