Skip to content

i2c: ls2x: Add support for the Loongson-2K/LS7A I2C controller

Binbin Zhou linux-devicetree linux-i2c loongarch 13 versions – Applied

Status from this message: Applied to for-next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 posting 2/27 patches 8 repliesIn review
  2. v11 Latest3 patches 3 repliesApplied
  3. v104 patches 4 repliesApplied
Earlier versions · 10
VersionPostedPatchesRepliesStatus
v2 posting 2/27 patches12 repliesSuperseded
v94 patches1 replySuperseded
v84 patches7 repliesSuperseded
v74 patches3 repliesSuperseded
v64 patches3 repliesSuperseded
v54 patches7 repliesSuperseded
v45 patches12 repliesApplied
v3 posting 1/25 patches17 repliesSuperseded
v2 posting 1/24 patches4 repliesSuperseded
v15 patches7 repliesSuperseded

Changes in v11 from the cover letter

- Drop patch #1 "i2c: gpio: Add support on ACPI-based system", since it has been applied yet.
- patch(2/3)
- module_platform_driver() replaces subsys_initcall().

Patches in v11 Applied

#Subject and filesSizeRepliesApplied
1/3dt-bindings: i2c: Add Loongson LS2X I2C controllerDocumentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml+51 -01 reply
2/3i2c: ls2x: Add driver for Loongson-2K/LS7A I2C controllerdrivers/i2c/busses/Kconfig drivers/i2c/busses/Makefile drivers/i2c/busses/i2c-ls2x.c+382 -02 replies
3/3LoongArch: Enable LS2X I2C in loongson3_defconfigarch/loongarch/configs/loongson3_defconfig+1 -00 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchKrzysztof KozlowskiAndy Shevchenko
1/3R-b
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v11 thread

Cover letter [PATCH V11 0/3] i2c: ls2x: Add support for the Loongson-2K/LS7A I2C controller

Hi all:

This patch series adds support for the I2C module found on various Loongson systems with the Loongson-2K SoC or the Loongson LS7A bridge chip.

For now, the I2C driver is suitable for DT-based or ACPI-based systems.

I have tested on Loongson-3A5000LA+LS7A1000/LS7A2000, Loongson-2K1000LA and Loongson-2K0500.

Thanks.

Changes since V10:
- Drop patch #1 "i2c: gpio: Add support on ACPI-based system", since it has been applied yet.
- patch(2/3)
- module_platform_driver() replaces subsys_initcall().

Changes since V9:
- patch (1/4)
- dev->of_node replaced by dev_fwnode() in i2c_gpio_probe();
- Add device_set_node();
- Add Tested-by tag.
- patch (3/4)
- Add Reviewed-by tag.

Changes since V8:
- patch (3/4)
- Refactor the error handling process of the ls2x_i2c_xfer_one();
- Split comment and code.

Changes since V7:
- patch (3/4)
- I2C_LS2X should be added to the Kconfig/Makefile in Latin alphabetical order.
- To avoid repeated type conversions, 'struct ls2x_i2c_priv *priv' replaces 'struct i2c_adapter *adap' as a function parameter, e.g. ls2x_i2c_start();
- Refactor ls2x_i2c_stop() with readb_poll_timeout(), mainly with LS2X_SR_BUSY to indicate the status (success/timeout) of the stop command;
- Remove extra parentheses;
- For consistency, the variable 'r' in ls2x_i2c_probe() is renamed to

    'ret'.

Changes since V6:
- patch (1/4)
- Add Reviewed-by tag.
- patch (3/4)
- GPL-2.0 -> GPL-2.0-only;
- Add property.h;
- writew() should be used to operate I2C_LS2X_PRER, and drop the

    suffix of I2C_LS2X_PRER_LO/I2C_LS2X_PRER_HI;
  - Drop ls2x_i2c_priv->dev, for it can be completely replaced by
    'adapter.dev.parent';
  - Reasonable return value handling in ls2x_i2c_xfer_one();
  - Dropping the I2C_M_STOP flag judgment, the stop parameter of
    ls2x_i2c_xfer_one() represents the last msg;

- Add comments for subsys_initcall();
- Code formatting, such as dropping unnecessary blank lines.

Changes since V5:
- patch (1/4)
- Add property.h.
- patch (3/4)
- Put the ls2x_i2c_reginit() in front of irq requst;
- Refact ls2x_i2c_adjust_bus_speed: discard the magic value of the divider register and LS2X_I2C_FREQ_STD is used to calculate the frequency;
- Drop useless parameters: priv->suspended, and also disable I2C

    interrupts during suspend;
  - Drop ls2x_i2c_remove(), for the adapter will be auto deleted on
    driver detach;

- Drop MODULE_ALIAS;
- Code formatting, such as alignment.

Thanks Andy for your comments.

Changes since V4:
- patch (1/4)
- Drop unneeded headers: of.h;
- xxx_props -> xxx_properties.
- patch (2/4)
- Add interrupt headers to fix syntax error found by Rob.
- patch (3/4)
- Drop atmoic loop in ls2x_i2c_master_xfer(), I have tested it on the

    appropriate environment with no problems;
  - Define the corresponding bits in I2C_LS2X_CTR to avoid magic
    numbers;
  - dev_get_drvdata() is used to get ls2x_i2c_priv() in
    ls2x_i2c_suspend();

- i2c_add_adapter() -> devm_i2c_add_adapter();
- SET_SYSTEM_SLEEP_PM_OPS() -> DEFINE_RUNTIME_DEV_PM_OPS();
- Code formatting, such as alignment.

Details: https://lore.kernel.org/all/Y4e%[email protected]/

Changes since V3:
- Addressed all review comments from v3
- Change the changelog text to make it clearer (1/5);
- Fix some minor bugs, such as formatting issues (2/5);
- Fix some formatting issues (3/5);
- Deep refactoring of code for clarity (4/5).
Details: https://lore.kernel.org/all/[email protected]/

Thanks to all for their suggestions.

Changes since V2:
- Addressed all review comments from v2
- Drop of_match_ptr() in i2c-gpio to avoid potential unused warnings

    (1/5);
  - Introduce i2c_gpio_get_props() function as the generic interface
    to get i2c-gpio props from DT or ACPI table (2/5);

- Refact ls2x i2c code, similar to removing excessive goto tags (4/5).

Thanks to Andy and Mika for their suggestions.

Changes since V1:
- Remove the function of getting the static i2c bus number from ACPI "_UID";
- Fix build warning from kernel test robot.

Binbin Zhou (3):
dt-bindings: i2c: Add Loongson LS2X I2C controller
i2c: ls2x: Add driver for Loongson-2K/LS7A I2C controller
LoongArch: Enable LS2X I2C in loongson3_defconfig

 .../bindings/i2c/loongson,ls2x-i2c.yaml       |  51 +++
 arch/loongarch/configs/loongson3_defconfig    |   1 +
 drivers/i2c/busses/Kconfig                    |  11 +
 drivers/i2c/busses/Makefile                   |   1 +
 drivers/i2c/busses/i2c-ls2x.c                 | 370 ++++++++++++++++++
 5 files changed, 434 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml
 create mode 100644 drivers/i2c/busses/i2c-ls2x.c
Signature · 1 line
2.39.0