Skip to contentSkip to conversation

Add ASPEED AST2600 I2C new controller driver

PATCH Superseded ryan_chen 1 participant 5 messages Apr 13, 2022 – Apr 25, 2022

Subsystems (4)

v2 of 12 Superseded Latest is v12 →

lore
Share & tools
lore

ryan_chen

author reviewer
#0 lore raw

v2 cover Add ASPEED AST2600 I2C new controller driver

This series add AST2600 i2c new register set driver. The i2c new register set have new clock divider option for more flexiable generation. And also have separate i2c master and slave register set for control.

v2:
-add i2c global ymal file commit
-rename file name from new to ast2600.
aspeed-i2c-new-global.c -> i2c-ast2600-global.c
aspeed-i2c-new-global.h -> i2c-ast2600-global.h
i2c-new-aspeed.c -> i2c-ast2600.c
-rename all driver function name to ast2600

ryan_chen (3):
dt-bindings: i2c-ast2600: Add bindings for AST2600 i2C global register
controller
dt-bindings: i2c-ast2600: Add bindings for AST2600 i2C driver i2c:aspeed:support ast2600 i2c new register mode driver

 .../i2c/aspeed,i2c-ast2600-global.ymal        |   44 +
 .../bindings/i2c/aspeed,i2c-ast2600.ymal      |   78 +
 drivers/i2c/busses/Kconfig                    |   11 +
 drivers/i2c/busses/Makefile                   |    1 +
 drivers/i2c/busses/i2c-ast2600-global.c       |   94 +
 drivers/i2c/busses/i2c-ast2600-global.h       |   19 +
 drivers/i2c/busses/i2c-ast2600.c              | 1706 +++++++++++++++++
 7 files changed, 1953 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/aspeed,i2c-ast2600-global.ymal
 create mode 100644 Documentation/devicetree/bindings/i2c/aspeed,i2c-ast2600.ymal
 create mode 100644 drivers/i2c/busses/i2c-ast2600-global.c
 create mode 100644 drivers/i2c/busses/i2c-ast2600-global.h
 create mode 100644 drivers/i2c/busses/i2c-ast2600.c
Signature · 1 line
2.17.1
author reviewer
#1 lore raw

PATCH v2 1/3 dt-bindings: i2c-ast2600: Add bindings for AST2600 i2C global register controller

AST2600 I2C global register controller, add bindings document to support driver of i2c global register set

---
 .../i2c/aspeed,i2c-ast2600-global.ymal        | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/aspeed,i2c-ast2600-global.ymal
Documentation/devicetree/bindings/i2c/aspeed,i2c-ast2600-global.ymal new file +44 -0
new file mode 100644
index 000000000000..d92a0878d03b
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/aspeed,i2c-ast2600-global.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: AST2600 I2C Global Register on the AST26XX SoCs Device Tree Bindings
+
+maintainers:
+  - Ryan Chen <[email protected]>
+
+allOf:
+  - $ref: /schemas/i2c/i2c-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - aspeed,ast2600-i2c-global
+
+  reg:
+    minItems: 1
+    items:
+      - description: address offset and range of bus
+      - description: address offset and range of bus buffer
+
+  resets:
+    maxItems: 1
+
+required:
+  - reg
+  - compatible
+  - resets
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/ast2600-clock.h>
+
+    i2c_gr: i2c-global-regs@0 {
+      compatible = "aspeed,ast2600-i2c-global", "syscon";
+      reg = <0x0 0x20>;
+      resets = <&syscon ASPEED_RESET_I2C>;
+    };
Signature · 1 line
2.17.1
author reviewer
#2 lore raw

PATCH v2 2/3 dt-bindings: i2c-ast2600: Add bindings for AST2600 i2C driver

In reply to ryan_chen

AST2600 support new register set for I2C controller, add bindings document to support driver of i2c new register mode controller

---
 .../bindings/i2c/aspeed,i2c-ast2600.ymal      | 78 +++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/aspeed,i2c-ast2600.ymal
Documentation/devicetree/bindings/i2c/aspeed,i2c-ast2600.ymal new file +78 -0
new file mode 100644
index 000000000000..7c75f5bac24f
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/aspeed,i2c-ast2600.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: AST2600 I2C Controller on the AST26XX SoCs Device Tree Bindings
+
+maintainers:
+  - Ryan Chen <[email protected]>
+
+allOf:
+  - $ref: /schemas/i2c/i2c-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - aspeed,ast2600-i2c
+
+  reg:
+    minItems: 1
+    items:
+      - description: address offset and range of bus
+      - description: address offset and range of bus buffer
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+    description:
+      root clock of bus, should reference the APB
+      clock in the second cell
+
+  resets:
+    maxItems: 1
+
+  bus-frequency:
+    minimum: 500
+    maximum: 2000000
+    default: 100000
+    description: frequency of the bus clock in Hz defaults to 100 kHz when not
+      specified
+
+  multi-master:
+    type: boolean
+    description:
+      states that there is another master active on this bus
+
+required:
+  - reg
+  - compatible
+  - clocks
+  - resets
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/ast2600-clock.h>
+
+    i2c_gr: i2c-global-regs@0 {
+      compatible = "aspeed,ast2600-i2c-global", "syscon";
+      reg = <0x0 0x20>;
+      resets = <&syscon ASPEED_RESET_I2C>;
+    };
+
+    i2c0: i2c-bus@80 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      #interrupt-cells = <1>;
+      compatible = "aspeed,ast2600-i2c-bus";
+      reg = <0x80 0x80>, <0xC00 0x20>;
+      clocks = <&syscon ASPEED_CLK_APB2>;
+      resets = <&syscon ASPEED_RESET_I2C>;
+      bus-frequency = <100000>;
+    };
Signature · 1 line
2.17.1
author reviewer
#3 lore raw

PATCH v2 3/3 i2c:aspeed:support ast2600 i2c new register mode driver

In reply to ryan_chen

Add i2c new register mode driver to support AST2600 i2c new register set. AST2600 i2c controller have legacy and new register mode. The new register mode have global register support 4 base clock for scl clock selection, and new clock divider mode. And i2c new register mode have separate register set to control i2c master and slave.

---
 drivers/i2c/busses/Kconfig              |   11 +
 drivers/i2c/busses/Makefile             |    1 +
 drivers/i2c/busses/i2c-ast2600-global.c |   94 ++
 drivers/i2c/busses/i2c-ast2600-global.h |   19 +
 drivers/i2c/busses/i2c-ast2600.c        | 1706 +++++++++++++++++++++++
 5 files changed, 1831 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-ast2600-global.c
 create mode 100644 drivers/i2c/busses/i2c-ast2600-global.h
 create mode 100644 drivers/i2c/busses/i2c-ast2600.c
drivers/i2c/busses/Kconfig +11 -0
index a1bae59208e3..c667200d7923 100644
@@ -387,6 +387,17 @@ config I2C_ALTERA
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-altera.
 
+config I2C_AST2600
+	tristate "Aspeed AST2600 I2C Controller"
+	depends on ARCH_ASPEED || MACH_ASPEED_G6 || COMPILE_TEST
+	select I2C_SMBUS
+	help
+	  If you say yes to this option, support will be included for the
+	  Aspeed I2C controller with new register set.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-new-aspeed.
+
 config I2C_ASPEED
 	tristate "Aspeed I2C Controller"
 	depends on ARCH_ASPEED || COMPILE_TEST
drivers/i2c/busses/Makefile +1 -0
index 479f60e4ee3d..00276d533288 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_I2C_POWERMAC)	+= i2c-powermac.o
 obj-$(CONFIG_I2C_ALTERA)	+= i2c-altera.o
 obj-$(CONFIG_I2C_AMD_MP2)	+= i2c-amd-mp2-pci.o i2c-amd-mp2-plat.o
 obj-$(CONFIG_I2C_ASPEED)	+= i2c-aspeed.o
+obj-$(CONFIG_I2C_AST2600)	+= i2c-ast2600-global.o i2c-ast2600.o
 obj-$(CONFIG_I2C_AT91)		+= i2c-at91.o
 i2c-at91-objs			:= i2c-at91-core.o i2c-at91-master.o
 ifeq ($(CONFIG_I2C_AT91_SLAVE_EXPERIMENTAL),y)
drivers/i2c/busses/i2c-ast2600-global.c new file +94 -0

94 lines not on this page · raw message

drivers/i2c/busses/i2c-ast2600-global.h new file +19 -0
new file mode 100644
index 000000000000..c2c55971f32a
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef I2C_AST2600_GLOBAL_H
+#define I2C_AST2600_GLOBAL_H
+
+#include <linux/bits.h>
+
+#define AST2600_I2CG_ISR			0x00
+#define AST2600_I2CG_SLAVE_ISR		0x04
+#define AST2600_I2CG_OWNER		0x08
+#define AST2600_I2CG_CTRL		0x0C
+#define AST2600_I2CG_CLK_DIV_CTRL	0x10
+
+#define AST2600_I2CG_SLAVE_PKT_NAK	BIT(4)
+#define AST2600_I2CG_M_S_SEPARATE_INTR	BIT(3)
+#define AST2600_I2CG_CTRL_NEW_REG	BIT(2)
+#define AST2600_I2CG_CTRL_NEW_CLK_DIV	BIT(1)
+
+#endif /* I2C_AST2600_GLOBAL_H */
drivers/i2c/busses/i2c-ast2600.c new file +1706 -0

1,706 lines not on this page · raw message

Signature · 1 line
2.17.1
author reviewer
#4 lore raw
In reply to ryan_chen

Hello Joel, Andrew,
Will you have available review this patch series?

Ryan

Quoted 45 lines

-----Original Message-----
From: Ryan Chen <[email protected]>
Sent: Wednesday, April 13, 2022 6:18 PM
To: Ryan Chen <[email protected]>; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; Joel Stanley <[email protected]>; Andrew Jeffery <[email protected]>; [email protected]; [email protected]
Cc: BMC-SW <[email protected]>
Subject: [PATCH v2 0/3] Add ASPEED AST2600 I2C new controller driver

This series add AST2600 i2c new register set driver. The i2c new register set have new clock divider option for more flexiable generation.
And also have separate i2c master and slave register set for control.

v2:

(quoted diff) +0 -2
-add i2c global ymal file commit
-rename file name from new to ast2600.
 aspeed-i2c-new-global.c -> i2c-ast2600-global.c  aspeed-i2c-new-global.h ->

i2c-ast2600-global.h i2c-new-aspeed.c -> i2c-ast2600.c -rename all driver function name to ast2600

ryan_chen (3):
dt-bindings: i2c-ast2600: Add bindings for AST2600 i2C global register
controller
dt-bindings: i2c-ast2600: Add bindings for AST2600 i2C driver i2c:aspeed:support ast2600 i2c new register mode driver

 .../i2c/aspeed,i2c-ast2600-global.ymal        |   44 +
 .../bindings/i2c/aspeed,i2c-ast2600.ymal      |   78 +
 drivers/i2c/busses/Kconfig                    |   11 +
 drivers/i2c/busses/Makefile                   |    1 +
 drivers/i2c/busses/i2c-ast2600-global.c       |   94 +
 drivers/i2c/busses/i2c-ast2600-global.h       |   19 +
 drivers/i2c/busses/i2c-ast2600.c              | 1706 +++++++++++++++++
 7 files changed, 1953 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/i2c/aspeed,i2c-ast2600-global.ymal
 create mode 100644
Documentation/devicetree/bindings/i2c/aspeed,i2c-ast2600.ymal
 create mode 100644 drivers/i2c/busses/i2c-ast2600-global.c
 create mode 100644 drivers/i2c/busses/i2c-ast2600-global.h
 create mode 100644 drivers/i2c/busses/i2c-ast2600.c

--
2.17.1