ARM: Add GXP I2C Support
[email protected]
maintainerv4 cover ARM: Add GXP I2C Support
From: Nick Hawkins <[email protected]>
The GXP SoC supports 10 I2C engines. Each I2C engine is completely independent and can function both as an I2C master and I2C slave. The I2C master can operate in a multi master environment. The engines support a scalable speed from 8kHZ to 1.5 Mhz.
---
Changes since v3:
*Switch engine variable to u32
*Disable IRQ on device remove with register write instead *Provided even greater description with the use of Phandle
Changes since v2:
*Disable IRQ on a device remove
*Remove use of I2C_CLASS_DEPRECATED
*Use i2c_parse_fw_timings instead of of_property_read_u32 *Remove redundant dev_err_probe as platform_get_irq already has one *Used __iomem instead of res->start to find physical address *Use BIT in gxp_i2c_irq_handler
*Made value u8 instead of u16 for u8 read
*Provided a better description of Phandle in yaml
Changes since v1:
*Removed yaml documentation of hpe,gxp-sysreg as it has been
applied to syscon.yaml
*Made i2cX a generic node name i2c in dts file
*Added status field to the dtsi and the dts for i2c bus *Removed unnecessary size-cells and address-cells from yaml *Removed phandle from hpe,sysreg-phandle
*Changed hpe,i2c-max-bus-freq to clock-frequency *Removed rogue tab in structure definition
*Removed use of __iomem *base local variables as it was
unnecessary
*Switched #if IS_ENABLED() -> if (IS_ENABLED()) inside
functions
*Removed use of pr_* functions
*Removed informational prints in register and unregister
functions
*Removed print from interrupt handler
*Removed informational prints from probe function *Switched dev_err -> dev_err_probe in probe function *Used the respective helper for mapping the resource to
__iomem
Nick Hawkins (5):
i2c: hpe: Add GXP SoC I2C Controller
dt-bindings: i2c: Add hpe,gxp-i2c
ARM: dts: hpe: Add I2C Topology
ARM: multi_v7_defconfig: add gxp i2c module
MAINTAINERS: Add HPE GXP I2C Support
.../devicetree/bindings/i2c/hpe,gxp-i2c.yaml | 59 ++ MAINTAINERS | 2 + arch/arm/boot/dts/hpe-bmc-dl360gen10.dts | 109 ++++ arch/arm/boot/dts/hpe-gxp.dtsi | 125 ++++ arch/arm/configs/multi_v7_defconfig | 1 + drivers/i2c/busses/Kconfig | 7 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-gxp.c | 603 ++++++++++++++++++ 8 files changed, 907 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/hpe,gxp-i2c.yaml create mode 100644 drivers/i2c/busses/i2c-gxp.c
Signature · 1 line
2.17.1
[email protected]
maintainerPATCH v4 1/5 i2c: hpe: Add GXP SoC I2C Controller
From: Nick Hawkins <[email protected]>
The GXP SoC supports 10 I2C engines. Each I2C engine is completely independent and can function both as an I2C master and I2C slave. The I2C master can operate in a multi master environment. The engines support a scalable speed from 8kHZ to 1.5 Mhz.
---
v4:
*Disable IRQ on device remove by register write
*Switch engine variable to u32
v3:
*Disable IRQ on device remove
*Remove use of I2C_CLASS_DEPRECATED
*Use i2c_parse_fw_timings instead of of_property_read_u32 *Remove redundant dev_err_probe as platform_get_irq already has one *Used __iomem instead of res->start to find physical address *Use BIT in gxp_i2c_irq_handler
*Made value u8 instead of u16
v2:
*Removed rogue tab in structure
*Removed use of __iomem base local variables as it was unnecessary *Switched #if IS_ENABLED() -> if (IS_ENABLED()) inside functions *Removed use of pr_* functions
*Removed informational prints in register and unregister functions *Removed print from interrupt handler
*No informational prints in probe function
*Switched dev_err for dev_err_probe in probe function *Use respective helper for mapping the resource to __iomem
--- drivers/i2c/busses/Kconfig | 7 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-gxp.c | 603 +++++++++++++++++++++++++++++++++++ 3 files changed, 611 insertions(+) create mode 100644 drivers/i2c/busses/i2c-gxp.c
drivers/i2c/busses/Kconfig +7 -0
@@ -1457,4 +1457,11 @@ config I2C_VIRTIO This driver can also be built as a module. If so, the module will be called i2c-virtio. +config I2C_GXP + tristate "GXP I2C Interface" + depends on ARCH_HPE_GXP || COMPILE_TEST + help + This enables support for GXP I2C interface. The I2C engines can be + either I2C master or I2C slaves. + endmenu
drivers/i2c/busses/Makefile +1 -0
@@ -127,6 +127,7 @@ obj-$(CONFIG_I2C_THUNDERX) += i2c-thunderx.o obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o obj-$(CONFIG_I2C_XLP9XX) += i2c-xlp9xx.o obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o +obj-$(CONFIG_I2C_GXP) += i2c-gxp.o # External I2C/SMBus adapter drivers obj-$(CONFIG_I2C_DIOLAN_U2C) += i2c-diolan-u2c.o
drivers/i2c/busses/i2c-gxp.c new file +603 -0
603 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v4 1/5] i2c: hpe: Add GXP SoC I2C Controller
Hi Nick,
Quoted 5 lines
drivers/i2c/busses/Kconfig +0
-0
drivers/i2c/busses/Kconfig config I2C_VIRTIO · line 1466
Quoted 10 lines
drivers/i2c/busses/Kconfig +7
-0@@ -1457,4 +1457,11 @@ config I2C_VIRTIO This driver can also be built as a module. If so, the module will be called i2c-virtio. +config I2C_GXP + tristate "GXP I2C Interface" + depends on ARCH_HPE_GXP || COMPILE_TEST + help + This enables support for GXP I2C interface. The I2C engines can be + either I2C master or I2C slaves. +
Shouldn't this be in the "I2C system bus drivers (mostly embedded / system-on-chip)" section? (alphabetically sorted)
drivers/i2c/busses/Kconfig config I2C_VIRTIO · line 1467
Quoted 1 line
drivers/i2c/busses/Kconfig +1
-0+static bool i2c_global_init_done;
Can't we avoid this static by checking if i2cg_map is NULL/non-NULL?
Quoted 39 lines
drivers/i2c/busses/Kconfig +39
-0+ +enum { + GXP_I2C_IDLE = 0, + GXP_I2C_ADDR_PHASE, + GXP_I2C_RDATA_PHASE, + GXP_I2C_WDATA_PHASE, + GXP_I2C_ADDR_NACK, + GXP_I2C_DATA_NACK, + GXP_I2C_ERROR, + GXP_I2C_COMP +}; + +struct gxp_i2c_drvdata { + struct device *dev; + void __iomem *base; + struct i2c_timings t; + u32 engine; + int irq; + struct completion completion; + struct i2c_adapter adapter; + struct i2c_msg *curr_msg; + int msgs_remaining; + int msgs_num; + u8 *buf; + size_t buf_remaining; + unsigned char state; + struct i2c_client *slave; + unsigned char stopped; +}; + +static struct regmap *i2cg_map; + +static void gxp_i2c_start(struct gxp_i2c_drvdata *drvdata) +{ + u16 value; + + drvdata->buf = drvdata->curr_msg->buf; + drvdata->buf_remaining = drvdata->curr_msg->len; +
drivers/i2c/busses/Kconfig config I2C_VIRTIO
Quoted 10 lines
drivers/i2c/busses/Kconfig +10
-0+ /* Note: Address in struct i2c_msg is 7 bits */ + value = drvdata->curr_msg->addr << 9; + + if (drvdata->curr_msg->flags & I2C_M_RD) { + /* Read */ + value |= 0x05; + } else { + /* Write */ + value |= 0x01; + }
I'd write it more concise as:
value |= drvdata->curr_msg->flags & I2C_M_RD ? 0x05 : 0x01;
But this is a matter of taste.
Quoted 18 lines
drivers/i2c/busses/Kconfig +18
-0+ + drvdata->state = GXP_I2C_ADDR_PHASE; + writew(value, drvdata->base + GXP_I2CMCMD); +} + +static int gxp_i2c_master_xfer(struct i2c_adapter *adapter, + struct i2c_msg *msgs, int num) +{ + int ret; + struct gxp_i2c_drvdata *drvdata = i2c_get_adapdata(adapter); + unsigned long time_left; + + drvdata->msgs_remaining = num; + drvdata->curr_msg = msgs; + drvdata->msgs_num = num; + reinit_completion(&drvdata->completion); + + gxp_i2c_start(drvdata);
drivers/i2c/busses/Kconfig
Quoted 10 lines
drivers/i2c/busses/Kconfig +10
-0+ + time_left = wait_for_completion_timeout(&drvdata->completion, + adapter->timeout); + ret = num - drvdata->msgs_remaining; + if (time_left == 0) { + switch (drvdata->state) { + case GXP_I2C_WDATA_PHASE: + dev_err(drvdata->dev, + "gxp_i2c_start:write Data phase timeout at msg[%d]\n", + ret);
Please don't write error message to the log on timeouts. They can happen. Think of an EEPROM which is busy because it needs to erase a page. Upper layers need to handle this correctly, the user doesn't need to know about it.
Quoted 16 lines
drivers/i2c/busses/Kconfig +16
-0+ break; + case GXP_I2C_RDATA_PHASE: + dev_err(drvdata->dev, + "gxp_i2c_start:read Data phase timeout at msg[%d]\n", + ret); + break; + case GXP_I2C_ADDR_PHASE: + dev_err(drvdata->dev, + "gxp_i2c_start:Addr phase timeout\n"); + break; + default: + dev_err(drvdata->dev, + "gxp_i2c_start:i2c transfer timeout state=%d\n", + drvdata->state); + break; + }
drivers/i2c/busses/Kconfig
Quoted 10 lines
drivers/i2c/busses/Kconfig +10
-0+ return -ETIMEDOUT; + } + + if (drvdata->state == GXP_I2C_ADDR_NACK) { + dev_err(drvdata->dev, + "gxp_i2c_start:No ACK for address phase\n"); + return -EIO; + } else if (drvdata->state == GXP_I2C_DATA_NACK) { + dev_err(drvdata->dev, "gxp_i2c_start:No ACK for data phase\n"); + return -EIO;
Same here for NACK. Otherwise i2cdetect will flood your logfile.
Quoted 18 lines
drivers/i2c/busses/Kconfig +18
-0+ } + + return ret; +} + +static u32 gxp_i2c_func(struct i2c_adapter *adap) +{ + if (IS_ENABLED(CONFIG_I2C_SLAVE)) + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SLAVE; + + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; +} + +#if IS_ENABLED(CONFIG_I2C_SLAVE) +static int gxp_i2c_reg_slave(struct i2c_client *slave) +{ + struct gxp_i2c_drvdata *drvdata = i2c_get_adapdata(slave->adapter); +
drivers/i2c/busses/Kconfig
Quoted 10 lines
drivers/i2c/busses/Kconfig +10
-0+ if (drvdata->slave) + return -EBUSY; + + if (slave->flags & I2C_CLIENT_TEN) + return -EAFNOSUPPORT; + + drvdata->slave = slave; + + writeb(slave->addr << 1, drvdata->base + GXP_I2COWNADR); + writeb(0x69, drvdata->base + GXP_I2CSCMD);
Does it make sense to have #defines for the magic values for I2CSCMD? BTW, is the datasheet public?
...
Quoted 4 lines
drivers/i2c/busses/Kconfig +4
-0+static void gxp_i2c_init(struct gxp_i2c_drvdata *drvdata) +{ + drvdata->state = GXP_I2C_IDLE; + writeb(2000000 / drvdata->t.bus_freq_hz,
drivers/i2c/busses/Kconfig
Quoted 10 lines
drivers/i2c/busses/Kconfig +10
-0+ drvdata->base + GXP_I2CFREQDIV); + writeb(0x32, drvdata->base + GXP_I2CFLTFAIR); + writeb(0x0a, drvdata->base + GXP_I2CTMOEDG); + writeb(0x00, drvdata->base + GXP_I2CCYCTIM); + writeb(0x00, drvdata->base + GXP_I2CSNPAA); + writeb(0x00, drvdata->base + GXP_I2CADVFEAT); + writeb(0xF0, drvdata->base + GXP_I2CSCMD); + writeb(0x80, drvdata->base + GXP_I2CMCMD); + writeb(0x00, drvdata->base + GXP_I2CEVTERR); + writeb(0x00, drvdata->base + GXP_I2COWNADR);
Also here, lots of magic values. Can we do something about it?
Quoted 26 lines
drivers/i2c/busses/Kconfig +26
-0+} + +static int gxp_i2c_probe(struct platform_device *pdev) +{ + struct gxp_i2c_drvdata *drvdata; + int rc; + struct i2c_adapter *adapter; + + if (!i2c_global_init_done) { + i2cg_map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, + "hpe,sysreg"); + if (IS_ERR(i2cg_map)) { + return dev_err_probe(&pdev->dev, IS_ERR(i2cg_map), + "failed to map i2cg_handle\n"); + } + + /* Disable interrupt */ + regmap_update_bits(i2cg_map, GXP_I2CINTEN, 0x00000FFF, 0); + i2c_global_init_done = true; + } + + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), + GFP_KERNEL); + if (!drvdata) + return -ENOMEM; +
drivers/i2c/busses/Kconfig
Quoted 10 lines
drivers/i2c/busses/Kconfig +10
-0+ platform_set_drvdata(pdev, drvdata); + drvdata->dev = &pdev->dev; + init_completion(&drvdata->completion); + + drvdata->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(drvdata->base)) + return PTR_ERR(drvdata->base); + + /* Use physical memory address to determine which I2C engine this is. */ + drvdata->engine = ((u32)drvdata->base & 0xf00) >> 8;
This breaks on my 64-bit test-build, so it will also fail with COMPILE_TEST.
drivers/i2c/busses/i2c-gxp.c: In function ‘gxp_i2c_probe’:drivers/i2c/busses/i2c-gxp.c:533:28: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
533 | drvdata->engine = ((u32)drvdata->base & 0xf00) >> 8;
The rest looks good to me.
Except for removing the hardcoded values, the other fixes should be fairly simple, I think. So, hardcoded values could be changed incrementally maybe. If this is possible at all. I still plan to have this driver in 6.3.
Happy hacking,
Wolfram
Hawkins, Nick
maintainerRe: [PATCH v4 1/5] i2c: hpe: Add GXP SoC I2C Controller
Quoted 2 lines
Does it make sense to have #defines for the magic values for I2CSCMD? BTW, is the datasheet public?
I will work on the defines and get rid of all the magic values. Unfortunately, there is no public spec available currently. Hopefully, we will have one someday though.
Quoted 11 lines
Quoted 2 lines
+ /* Use physical memory address to determine which I2C engine this is. */
+drvdata->engine= ((u32)drvdata->base &0xf00) >> 8;This breaks on my 64-bit test-build, so it will also fail with
COMPILE_TEST.
drivers/i2c/busses/i2c-gxp.c: In function ‘gxp_i2c_probe’:drivers/i2c/busses/i2c-gxp.c:533:28: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 533 |drvdata->engine= ((u32)drvdata->base &0xf00) >> 8;
I am currently unable to reproduce this error. I even set W=2. Would replacing (u32) with (unsigned long) resolve it?
Thanks,
-Nick Hawkins
Re: [PATCH v4 1/5] i2c: hpe: Add GXP SoC I2C Controller
Hi Nick,
Quoted 1 line
I will work on the defines and get rid of all the magic values.
Cool, thank you!
Quoted 2 lines
Unfortunately, there is no public spec available currently. Hopefully, we will have one someday though.
Then, the #defines are even more helpful!
Quoted 5 lines
Quoted 3 lines
drivers/i2c/busses/i2c-gxp.c: In function ‘gxp_i2c_probe’:drivers/i2c/busses/i2c-gxp.c:533:28: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 533 |drvdata->engine= ((u32)drvdata->base &0xf00) >> 8;I am currently unable to reproduce this error. I even set W=2.
Interesting. I have this version:
gcc (Debian 10.2.1-6) 10.2.1 20210110
Quoted 1 line
Would replacing (u32) with (unsigned long) resolve it?
Or size_t.
Happy hacking,
Wolfram
[email protected]
maintainerPATCH v4 2/5 dt-bindings: i2c: Add hpe,gxp-i2c
In reply to [email protected]From: Nick Hawkins <[email protected]>
Document compatibility string to support I2C controller in GXP.
---
v4:
*Provide even greater description with the use
of Phandle
*Reorder properties so they match the required
order
v3:
*Provide better description with use of Phandle
v2:
*Removed uneccessary size-cells and address-cells *Removed phandle from hpe,sysreg-phandle *Changed hpe,i2c-max-bus-freq to clock-frequency
--- .../devicetree/bindings/i2c/hpe,gxp-i2c.yaml | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/hpe,gxp-i2c.yaml
Documentation/devicetree/bindings/i2c/hpe,gxp-i2c.yaml new file +59 -0
@@ -0,0 +1,59 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/hpe,gxp-i2c.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: HPE GXP SoC I2C Controller + +maintainers: + - Nick Hawkins <[email protected]> + +allOf: + - $ref: /schemas/i2c/i2c-controller.yaml# + +properties: + compatible: + const: hpe,gxp-i2c + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clock-frequency: + default: 100000 + + hpe,sysreg: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Phandle to the global status and enable interrupt registers shared + between each I2C engine controller instance. It enables the I2C + engine controller to act as both a master or slave by being able to + arm and respond to interrupts from its engine. Each bit in the + registers represent the respective bit position. + +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false + +examples: + - | + i2c@2600 { + compatible = "hpe,gxp-i2c"; + reg = <0x2500 0x70>; + interrupts = <9>; + #address-cells = <1>; + #size-cells = <0>; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <10000>; + + eeprom@50 { + compatible = "atmel,24c128"; + reg = <0x50>; + }; + };
Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [PATCH v4 2/5] dt-bindings: i2c: Add hpe,gxp-i2c
Quoted 55 lines · On Wed, Jan 25, 2023 at 12:44:35PM -0600, [email protected] wrote:
From: Nick Hawkins <[email protected]>
Document compatibility string to support I2C controller in GXP.
Signed-off-by Nick Hawkins <[email protected]>---
v4:
*Provide even greater description with the use
of Phandle
*Reorder properties so they match the required
order
v3:
*Provide better description with use of Phandle
v2:
*Removed uneccessary size-cells and address-cells *Removed phandle from hpe,sysreg-phandle *Changed hpe,i2c-max-bus-freq to clock-frequency--- .../devicetree/bindings/i2c/hpe,gxp-i2c.yaml | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/hpe,gxp-i2c.yamlDocumentation/devicetree/bindings/i2c/hpe,gxp-i2c.yaml new file +25
-0@@ -0,0 +1,59 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/hpe,gxp-i2c.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: HPE GXP SoC I2C Controller + +maintainers: + - Nick Hawkins <[email protected]> + +allOf: + - $ref: /schemas/i2c/i2c-controller.yaml# + +properties: + compatible: + const: hpe,gxp-i2c + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clock-frequency:
Documentation/devicetree/bindings/i2c/hpe,gxp-i2c.yaml line 35
Quoted 10 lines
Documentation/devicetree/bindings/i2c/hpe,gxp-i2c.yaml new file +10
-0+ default: 100000 + + hpe,sysreg: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Phandle to the global status and enable interrupt registers shared + between each I2C engine controller instance. It enables the I2C + engine controller to act as both a master or slave by being able to + arm and respond to interrupts from its engine. Each bit in the + registers represent the respective bit position.
Each bit represents the bit position?
AIUI, each I2C instance has a bit in it needs to control. How does the driver know what instance (and therefore the correct bit)? Typically you would have a 2nd cell here with that information.
Quoted 27 lines
Documentation/devicetree/bindings/i2c/hpe,gxp-i2c.yaml new file +24
-0+ +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false + +examples: + - | + i2c@2600 { + compatible = "hpe,gxp-i2c"; + reg = <0x2500 0x70>; + interrupts = <9>; + #address-cells = <1>; + #size-cells = <0>; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <10000>; + + eeprom@50 { + compatible = "atmel,24c128"; + reg = <0x50>; + }; + };Signature · 1 line
2.17.1
Hawkins, Nick
maintainerRe: [PATCH v4 2/5] dt-bindings: i2c: Add hpe,gxp-i2c
Quoted 11 lines
Quoted 8 lines
+ hpe,sysreg:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description:
+ Phandle to the global status and enable interrupt registers shared
+ between each I2C engine controller instance. It enables the I2C
+ engine controller to act as both a master or slave by being able to
+ arm and respond to interrupts from its engine. Each bit in the
+ registers represent the respective bit position.Each bit represents the bit position?
Yes what I mean here is that bit 0 represents engine 0, bit 1 represents engine 1 and so on. I will reword this how you have below.
Quoted 3 lines
AIUI, each I2C instance has a bit in it needs to control. How does the driver know what instance (and therefore the correct bit)? Typically you would have a 2nd cell here with that information.
We are currently using the memory area designated reg to determine which engine we are on.
Here is a snippet from patch 1 of this patchset that introduces the driver:
/* Use physical memory address to determine which I2C engine this is. */
+ drvdata->engine = ((u32)drvdata->base & 0xf00) >> 8;
This works because each engine is 0x100 apart.
I would however like to conform to a standard to designate the engine. Is there an existing property I can leverage?
Thanks for your feedback,
-Nick Hawkins
Re: [PATCH v4 2/5] dt-bindings: i2c: Add hpe,gxp-i2c
Quoted 20 lines · Nick
Quoted 11 lines
Quoted 9 lines
+ hpe,sysreg:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description:
+ Phandle to the global status and enable interrupt registers shared
+ between each I2C engine controller instance. It enables the I2C
+ engine controller to act as both a master or slave by being able to
+ arm and respond to interrupts from its engine. Each bit in the
+ registers represent the respective bit position.Quoted 1 line
Each bit represents the bit position?
Yes what I mean here is that bit 0 represents engine 0, bit 1 represents engine 1 and so on. I will reword this how you have below.
Quoted 3 lines
AIUI, each I2C instance has a bit in it needs to control. How does the driver know what instance (and therefore the correct bit)? Typically you would have a 2nd cell here with that information.
Quoted 8 lines
We are currently using the memory area designated reg to determine which engine we are on.
Here is a snippet from patch 1 of this patchset that introduces the driver:
/* Use physical memory address to determine which I2C engine this is. */
+drvdata->engine= ((u32)drvdata->base &0xf00) >> 8;This works because each engine is
0x100apart.
Ah, that works fine then.
[email protected]
maintainerPATCH v4 3/5 ARM: dts: hpe: Add I2C Topology
In reply to [email protected]From: Nick Hawkins <[email protected]>
Add 9 I2C Engines, 2 MUXs, and a EEPROM to the device tree.
---
v4:
*No change
v3:
*No change
v2:
*Made i2cX a generic node name i2c in the dts
*Added status field to dtsi and dts for i2c bus
--- arch/arm/boot/dts/hpe-bmc-dl360gen10.dts | 109 ++++++++++++++++++++ arch/arm/boot/dts/hpe-gxp.dtsi | 125 +++++++++++++++++++++++ 2 files changed, 234 insertions(+)
arch/arm/boot/dts/hpe-bmc-dl360gen10.dts +109 -0
@@ -23,4 +23,113 @@ device_type = "memory"; reg = <0x40000000 0x20000000>; }; + + i2cmux@4 { + compatible = "i2c-mux-reg"; + i2c-parent = <&i2c4>; + reg = <0xd1000074 0x1>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@3 { + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@4 { + reg = <4>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; + + i2cmux@6 { + compatible = "i2c-mux-reg"; + i2c-parent = <&i2c6>; + reg = <0xd1000076 0x1>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@2 { + reg = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@3 { + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@4 { + reg = <4>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@5 { + reg = <5>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; +}; + +&i2c0 { + status = "okay"; +}; + +&i2c1 { + status = "okay"; +}; + +&i2c2 { + status = "okay"; + eeprom@50 { + compatible = "atmel,24c02"; + pagesize = <8>; + reg = <0x50>; + }; +}; + +&i2c3 { + status = "okay"; +}; + +&i2c4 { + status = "okay"; +}; + +&i2c5 { + status = "okay"; +}; + +&i2c6 { + status = "okay"; +}; + +&i2c7 { + status = "okay"; +}; + +&i2c8 { + status = "okay"; +}; + +&i2c9 { + status = "okay"; };
arch/arm/boot/dts/hpe-gxp.dtsi +125 -0
131 lines not on this page · raw message
Signature · 1 line
2.17.1
[email protected]
maintainerPATCH v4 4/5 ARM: multi_v7_defconfig: add gxp i2c module
In reply to [email protected]From: Nick Hawkins <[email protected]>
Add the CONFIG_I2C_GXP symbol to enable the GXP SoC I2C capabilities.
---
v4:
*No change
v3:
*No change
v2:
*No change
--- arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -411,6 +411,7 @@ CONFIG_I2C_DAVINCI=y CONFIG_I2C_DESIGNWARE_PLATFORM=y CONFIG_I2C_DIGICOLOR=m CONFIG_I2C_EMEV2=m +CONFIG_I2C_GXP=m CONFIG_I2C_IMX=y CONFIG_I2C_MESON=y CONFIG_I2C_MV64XXX=y
Signature · 1 line
2.17.1
[email protected]
maintainerPATCH v4 5/5 MAINTAINERS: Add HPE GXP I2C Support
In reply to [email protected]From: Nick Hawkins <[email protected]>
Add the I2C controller source and bindings.
---
v4:
*No change
v3:
*No change
v2:
*No change
--- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
@@ -2217,12 +2217,14 @@ M: Jean-Marie Verdun <[email protected]> M: Nick Hawkins <[email protected]> S: Maintained F: Documentation/devicetree/bindings/arm/hpe,gxp.yaml +F: Documentation/devicetree/bindings/i2c/hpe,gxp-i2c.yaml F: Documentation/devicetree/bindings/spi/hpe,gxp-spifi.yaml F: Documentation/devicetree/bindings/timer/hpe,gxp-timer.yaml F: arch/arm/boot/dts/hpe-bmc* F: arch/arm/boot/dts/hpe-gxp* F: arch/arm/mach-hpe/ F: drivers/clocksource/timer-gxp.c +F: drivers/i2c/busses/i2c-gxp.c F: drivers/spi/spi-gxp.c F: drivers/watchdog/gxp-wdt.c
Signature · 1 line
2.17.1
Re: [PATCH v4 5/5] MAINTAINERS: Add HPE GXP I2C Support
Quoted 5 lines · On Wed, Jan 25, 2023 at 12:44:38PM -0600, [email protected] wrote:
From: Nick Hawkins <[email protected]>
Add the I2C controller source and bindings.
Signed-off-by Nick Hawkins <[email protected]>
I assume this better goes via the arm-soc-tree as well to reduce merge conflicts, so:
Let me know if I should pick this instead. Will review the driver in the next days.
Hawkins, Nick
maintainerRe: [PATCH v4 5/5] MAINTAINERS: Add HPE GXP I2C Support
Quoted 2 lines
Let me know if I should pick this instead. Will review the driver in the next days.
Please include it. There may be warnings generated if MAINTAINERS does not list the files at the time of your commit.
Thank you,
-Nick Hawkins
Hawkins, Nick
maintainerRE: [PATCH v4 5/5] MAINTAINERS: Add HPE GXP I2C Support
Quoted 5 lines
Quoted 3 lines
Let me know if I should pick this instead. Will review the driver in the next days.
Please include it. There may be warnings generated if
MAINTAINERS
does not list the files at the time of your commit.
Quoted 3 lines
Thank you,
-Nick Hawkins
Greetings Wolfram,
Just a gentle reminder on this review.
Thank you for your time,
-Nick Hawkins