i2c: Add Loongson-2K0300 I2C controller support
Binbin Zhou
maintainerv6 cover i2c: Add Loongson-2K0300 I2C controller support
Hi all:
This patch set describes the I2C controller integrated the Loongson-2K0300 chip.
It has a significantly different design from the previous I2C controller(i2c-ls2x), such as support for master-slave transfer mode, and DMA transfers (implementation in progress), etc. Therefore, we try to name it i2c-ls2x-v2.
Thanks.
======
V6:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Update comment;
- Use regmap_get_device();
Link to V5:
https://lore.kernel.org/all/[email protected]/
V5:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Add time.h header file;
- Add the MHz suffix to parent_rate and freq;
- Define an iterator within the for loop, with its type being
`unsigned int`;
- Use dev_err_probe() in loongson2_i2c_adjust_bus_speed();
- i2c_adapter_set_node()->device_set_node().
Link to V4:
https://lore.kernel.org/all/[email protected]/
V4:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- The parent_rate parameter type should be unsigned long;
- Drop fallthrough and add missing break;
- device_set_node()->i2c_adapter_set_node();
- Use i2c_parse_fw_timings();
- Use i2c_t.bus_freq_hz instead of priv->speed;
- Sperate loongson2_i2c_handle_read() into loongson2_i2c_handle_read() and loongson2_i2c_handle_rx_done().
Link to V3:
https://lore.kernel.org/all/[email protected]/
V3:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Reorder header file follow IWYU principle;
- Better indentation and coding style;
- Use generic macro definitions;
- Amend *all* struct data types;
- Correct unreasonable variable type definitions;
- Refact loongson2_i2c_isr_error();
- of_property_read_u32()->device_property_read_u32();
- Remove meaningless blank lines and output.
Link to V2:
https://lore.kernel.org/all/[email protected]/
V2:
Patch (1/2):
- Add Acked-by tag from Conor, thanks.
Patch (2/2):
- Reorder the definitions of read() and write();
- Adjust the calculation method for bus speed.
Link to V1:
https://lore.kernel.org/all/[email protected]/
Binbin Zhou (2):
dt-bindings: i2c: loongson,ls2x: Add ls2k0300-i2c compatible
i2c: ls2x-v2: Add driver for Loongson-2K0300 I2C controller
.../bindings/i2c/loongson,ls2x-i2c.yaml | 4 + MAINTAINERS | 1 + drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ls2x-v2.c | 544 ++++++++++++++++++ 5 files changed, 560 insertions(+) create mode 100644 drivers/i2c/busses/i2c-ls2x-v2.c
base-commit: e9b13580b334040da0184a9f32106d808acd7fd5
Signature · 1 line
2.52.0
Binbin Zhou
maintainerPATCH v6 1/2 dt-bindings: i2c: loongson,ls2x: Add ls2k0300-i2c compatible
Add "loongson,ls2k0300-i2c" dedicated compatible for representing I2C of Loongson-2K0300 chip, because its HW integration is quiet different from others.
--- Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml +4 -0
@@ -16,6 +16,7 @@ properties: compatible: enum: - loongson,ls2k-i2c + - loongson,ls2k0300-i2c - loongson,ls7a-i2c reg:
@@ -24,6 +25,9 @@ properties: interrupts: maxItems: 1 + clocks: + maxItems: 1 + required: - compatible - reg
Signature · 1 line
2.52.0
Binbin Zhou
maintainerPATCH v6 2/2 i2c: ls2x-v2: Add driver for Loongson-2K0300 I2C controller
In reply to Binbin ZhouThis I2C module is integrated into the Loongson-2K0300 SoCs.
It provides multi-master functionality and controls all I2C bus-specific timing, protocols, arbitration, and timing. It supports both standard and fast modes.
--- MAINTAINERS | 1 + drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ls2x-v2.c | 544 +++++++++++++++++++++++++++++++ 4 files changed, 556 insertions(+) create mode 100644 drivers/i2c/busses/i2c-ls2x-v2.c
MAINTAINERS +1 -0
@@ -14954,6 +14954,7 @@ M: Binbin Zhou <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml +F: drivers/i2c/busses/i2c-ls2x-v2.c F: drivers/i2c/busses/i2c-ls2x.c LOONGSON PWM DRIVER
drivers/i2c/busses/Kconfig +10 -0
@@ -850,6 +850,16 @@ config I2C_LS2X This driver can also be built as a module. If so, the module will be called i2c-ls2x. +config I2C_LS2X_V2 + tristate "Loongson-2 Fast Speed I2C adapter" + depends on LOONGARCH || COMPILE_TEST + help + If you say yes to this option, support will be included for the + I2C interface on the Loongson-2K0300 SoCs. + + This driver can also be built as a module. If so, the module + will be called i2c-ls2x-v2. + config I2C_MLXBF tristate "Mellanox BlueField I2C controller" depends on (MELLANOX_PLATFORM && ARM64) || COMPILE_TEST
drivers/i2c/busses/Makefile +1 -0
@@ -80,6 +80,7 @@ obj-$(CONFIG_I2C_KEBA) += i2c-keba.o obj-$(CONFIG_I2C_KEMPLD) += i2c-kempld.o obj-$(CONFIG_I2C_LPC2K) += i2c-lpc2k.o obj-$(CONFIG_I2C_LS2X) += i2c-ls2x.o +obj-$(CONFIG_I2C_LS2X_V2) += i2c-ls2x-v2.o obj-$(CONFIG_I2C_MESON) += i2c-meson.o obj-$(CONFIG_I2C_MICROCHIP_CORE) += i2c-microchip-corei2c.o obj-$(CONFIG_I2C_MPC) += i2c-mpc.o
drivers/i2c/busses/i2c-ls2x-v2.c new file +544 -0
544 lines not on this page · raw message
Signature · 1 line
2.52.0
Re: [PATCH v6 2/2] i2c: ls2x-v2: Add driver for Loongson-2K0300 I2C controller
Quoted 5 lines · Binbin Zhou
This I2C module is integrated into the Loongson-2K0300 SoCs.
It provides multi-master functionality and controls all I2C bus-specific timing, protocols, arbitration, and timing. It supports both standard and fast modes.
Looks good enough to me,
Signature · 2 lines
With Best Regards, Andy Shevchenko
Andi Shyti
maintainerRe: [PATCH v6 2/2] i2c: ls2x-v2: Add driver for Loongson-2K0300 I2C controller
In reply to Binbin ZhouHi Binbin,
drivers/i2c/busses/Kconfig config I2C_LS2X · line 856
Quoted 4 lines
drivers/i2c/busses/Kconfig +4
-0+config I2C_LS2X_V2 + tristate "Loongson-2 Fast Speed I2C adapter" + depends on LOONGARCH || COMPILE_TEST + help
I'm getting a compile error here, I guess you also need REGMAP_MMIO here, right?
Andi
Re: [PATCH v6 2/2] i2c: ls2x-v2: Add driver for Loongson-2K0300 I2C controller
Hi Andi:
Thanks for your review.
Quoted 10 lines · Andi Shyti
Hi Binbin,
drivers/i2c/busses/Kconfig config I2C_LS2X · line 856
Quoted 4 lines
drivers/i2c/busses/Kconfig +4
-0+config I2C_LS2X_V2 + tristate "Loongson-2 Fast Speed I2C adapter" + depends on LOONGARCH || COMPILE_TEST + helpI'm getting a compile error here, I guess you also need
REGMAP_MMIOhere, right?
Yes, that is indeed necessary. I’ll double-check to see if there are any other omissions.
It seems my other driver has a similar omission as well. Thank you very much.
Quoted 2 lines
Andi
Signature · 2 lines
Thanks. Binbin
For the whole series:
Quoted 93 lines · Binbin Zhou
Hi all:
This patch set describes the I2C controller integrated the Loongson-2K0300 chip.
It has a significantly different design from the previous I2C controller(i2c-ls2x), such as support for master-slave transfer mode, and DMA transfers (implementation in progress), etc. Therefore, we try to name it i2c-ls2x-v2.
Thanks.
======
V6:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Update comment;
- Useregmap_get_device();Link to V5:
https://lore.kernel.org/all/[email protected]/V5:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Addtime.hheader file;
- Add theMHzsuffix toparent_rateandfreq;
- Define an iterator within the for loop, with its type being`unsigned int`;- Use
dev_err_probe()inloongson2_i2c_adjust_bus_speed();
- i2c_adapter_set_node()->device_set_node().Link to V4:
https://lore.kernel.org/all/[email protected]/V4:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Theparent_rateparameter type should beunsigned long;
- Drop fallthrough and add missing break;
- device_set_node()->i2c_adapter_set_node();
- Usei2c_parse_fw_timings();
- Use i2c_t.bus_freq_hz instead ofpriv->speed;
- Sperateloongson2_i2c_handle_read()intoloongson2_i2c_handle_read()andloongson2_i2c_handle_rx_done().Link to V3:
https://lore.kernel.org/all/[email protected]/V3:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Reorder header file follow IWYU principle;
- Better indentation and coding style;
- Use generic macro definitions;
- Amend *all* struct data types;
- Correct unreasonable variable type definitions;
- Refactloongson2_i2c_isr_error();
- of_property_read_u32()->device_property_read_u32();
- Remove meaningless blank lines and output.Link to V2:
https://lore.kernel.org/all/[email protected]/V2:
Patch (1/2):
- Add Acked-by tag from Conor, thanks.Patch (2/2):
- Reorder the definitions ofread()andwrite();
- Adjust the calculation method for bus speed.Link to V1:
https://lore.kernel.org/all/[email protected]/Binbin Zhou (2):
dt-bindings: i2c: loongson,ls2x: Add ls2k0300-i2c compatible
i2c: ls2x-v2: Add driver for Loongson-2K0300 I2C controller.../bindings/i2c/loongson,ls2x-i2c.yaml | 4 + MAINTAINERS | 1 + drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ls2x-v2.c | 544 ++++++++++++++++++ 5 files changed, 560 insertions(+) create mode 100644 drivers/i2c/busses/i2c-ls2x-v2.cbase-commit:
e9b13580b334040da0184a9f32106d808acd7fd5--
2.52.0
Hi all:
Quoted 20 lines · Binbin Zhou
Hi all:
This patch set describes the I2C controller integrated the Loongson-2K0300 chip.
It has a significantly different design from the previous I2C controller(i2c-ls2x), such as support for master-slave transfer mode, and DMA transfers (implementation in progress), etc. Therefore, we try to name it i2c-ls2x-v2.
Thanks.
======
V6:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Update comment;
- Useregmap_get_device();
Quoted 2 lines
Gentle ping.
Any comments about this patchset ?
Quoted 67 lines
V5:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Addtime.hheader file;
- Add theMHzsuffix toparent_rateandfreq;
- Define an iterator within the for loop, with its type being`unsigned int`;- Use
dev_err_probe()inloongson2_i2c_adjust_bus_speed();
- i2c_adapter_set_node()->device_set_node().Link to V4:
https://lore.kernel.org/all/[email protected]/V4:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Theparent_rateparameter type should beunsigned long;
- Drop fallthrough and add missing break;
- device_set_node()->i2c_adapter_set_node();
- Usei2c_parse_fw_timings();
- Use i2c_t.bus_freq_hz instead ofpriv->speed;
- Sperateloongson2_i2c_handle_read()intoloongson2_i2c_handle_read()andloongson2_i2c_handle_rx_done().Link to V3:
https://lore.kernel.org/all/[email protected]/V3:
- Rebase on linux-i2c/i2c-next;
Patch (2/2):
- Reorder header file follow IWYU principle;
- Better indentation and coding style;
- Use generic macro definitions;
- Amend *all* struct data types;
- Correct unreasonable variable type definitions;
- Refactloongson2_i2c_isr_error();
- of_property_read_u32()->device_property_read_u32();
- Remove meaningless blank lines and output.Link to V2:
https://lore.kernel.org/all/[email protected]/V2:
Patch (1/2):
- Add Acked-by tag from Conor, thanks.Patch (2/2):
- Reorder the definitions ofread()andwrite();
- Adjust the calculation method for bus speed.Link to V1:
https://lore.kernel.org/all/[email protected]/Binbin Zhou (2):
dt-bindings: i2c: loongson,ls2x: Add ls2k0300-i2c compatible
i2c: ls2x-v2: Add driver for Loongson-2K0300 I2C controller.../bindings/i2c/loongson,ls2x-i2c.yaml | 4 + MAINTAINERS | 1 + drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ls2x-v2.c | 544 ++++++++++++++++++ 5 files changed, 560 insertions(+) create mode 100644 drivers/i2c/busses/i2c-ls2x-v2.c
Quoted 4 lines
base-commit:
e9b13580b334040da0184a9f32106d808acd7fd5--
2.52.0
--
Thanks.
Binbin