Skip to contentSkip to conversation

i2c: Enabling use of aspeed-i2c with ACPI

RFC PATCH In review Jonathan Cameron 2 participants 15 messages May 31, 2023 – Jun 1, 2023

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v3 cover i2c: Enabling use of aspeed-i2c with ACPI

v3:
- More improvements from Andy, called out in the individual patches.

Obviously I am sending this much quicker than would normally make sense.

Whilst Andy was kind enough to provide review I never really expected anyone to look at these in depth, I just needed them public so I could tell people to use them. However I don't want to loose the improvements from Andy's review.

Hence still RFC though if people like the first 6 patches, they may be worth picking up anyway.

I'm planning to forget about these entirely for a few weeks at least and work on the other parts of the stack this enables and a general huge backlog of things I've been ignoring.

From the school of dirty hacks we do to prove something works, enable work to proceed elsewhere:

MCTP over I2C from ACPI emulated hosts (both x86 and ARM64).

The first 6 patches might be suitable for upstream inclusion, the last one - though I hope we can move to Niyas' work on ACPI clock management once that is ready.

Why do this crazy thing?

Ultimately we want a standards based way to use the CXL Fabric Management API FM-API. In real systems that is likely to be driven from a separate 'host' such as a BMC, but for test purposes it is convenient to be able to do that from an QEMU emulated machine that is also capable of using the CXL kernel stack.

That CXL kernel stack is currently ACPI only (and people care about x86 for some reason). One of the defined interfaces over which FM-API commands can be issued is MCTP.

The kernel MCTP stack has upstream drivers for MCTP over I2C. Upstream QEMU emulates the Aspeed I2C controller with the necessary two way support. There are patches on list adding the MCTP parts
https://lore.kernel.org/qemu-devel/[email protected]/
and I've ported an earlier CXL FMAPI EP emulator over to that.

ACPI has a 'magic' HID of PRP0001 which allows the use of a device tree binding (mostly) with an ACPI DSDT entry. A suitable chunk is something like

(dumped from a working x86 setup)

    Device (MCTP)
    {
        Name (_HID, "PRP0001")  // _HID: Hardware ID
        Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
            Package (0x03)
            {
                Package (0x02)
                {
                     "compatible",
                     "aspeed,ast2600-i2c-bus"
                },
                Package (0x02)
                {
                    "bus-frequency",
                    0x00061A80
                },
                Package (0x02)
                {
                    "mctp-controller",
                    One
                }
            }
        })
        Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
        {
            QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
                0x0000000000000000, // Granularity
                0x00000004800FC080, // Range Minimum
                0x00000004800FC0FF, // Range Maximum
                0x0000000000000000, // Translation Offset
                0x0000000000000080, // Length
                ,, , AddressRangeMemory, TypeStatic)
            Interrupt (ResourceConsumer, Level, ActiveHigh, Shared, ,, )
            {
                0x00000007,
            }
        })
    }
    Device (MCTS)
    {
        Name (_HID, "PRP0001")  // _HID: Hardware ID
        Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
        {
            I2cSerialBusV2 (0x0050, DeviceInitiated, 0x000186A0,
                AddressingMode7Bit, "\\_SB.MCTP",
                0x00, ResourceProducer, , Exclusive,
                )
        })
        Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
            Package (0x01)
            {
                Package (0x02)
                {
                    "compatible",
                    "mctp-i2c-controller"
                }
            }
        })
    }

QEMU patches will follow soon and will include documentation on how to actually poke this to do something useful. I'll post a reply to this with the link when posted.

Cc Niyas Sait <[email protected]>
Cc Klaus Jensen <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Jeremy Kerr <[email protected]>
Cc Matt Johnston <[email protected]>
Cc Shesha Bhushan Sreenivasamurthy <[email protected]>

Jonathan Cameron (7):
i2c: acpi: set slave mode flag
i2c: aspeed: Use platform_get_irq() instead of opencoding
i2c: aspeed: Don't report error when optional dt bus-frequency not
supplied
i2c: aspeed: use a function pointer type def for clk_reg_val callback
i2c: aspeed: switch to generic fw properties.
i2c: aspeed: Set the fwnode for the adap->dev
HACK: i2c: aspeed: Comment clock out and make reset optional

 drivers/i2c/busses/i2c-aspeed.c | 48 +++++++++++++++------------------
 drivers/i2c/i2c-core-acpi.c     |  3 +++
 2 files changed, 25 insertions(+), 26 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

RFC PATCH v3 1/7 i2c: acpi: set slave mode flag

If the GenericSerialBusConnection includes the General Flag for slave mode set it during parsing.

---
v2: Picked up tag.

---
 drivers/i2c/i2c-core-acpi.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/i2c/i2c-core-acpi.c +3 -0
index d6037a328669..7dda5eab9645 100644
@@ -125,6 +125,9 @@ static int i2c_acpi_fill_info(struct acpi_resource *ares, void *data)
 	if (sb->access_mode == ACPI_I2C_10BIT_MODE)
 		info->flags |= I2C_CLIENT_TEN;
 
+	if (sb->slave_mode)
+		info->flags |= I2C_CLIENT_SLAVE;
+
 	return 1;
 }
 
Signature · 1 line
2.39.2
#2 lore raw

RFC PATCH v3 2/7 i2c: aspeed: Use platform_get_irq() instead of opencoding

In reply to Jonathan Cameron

A cleanup in its own right.
This has the handy side effect of working for ACPI FW as well (unlike fwnode_irq_get() which works for ARM64 but not x86 ACPI)

---
v3: Fix it's -> its in description.

---
 drivers/i2c/busses/i2c-aspeed.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-aspeed.c +4 -2
index d3c99c5b3247..21a2f139f445 100644
@@ -19,7 +19,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
-#include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/reset.h>
@@ -1043,7 +1042,10 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
 	if (ret < 0)
 		return ret;
 
-	irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
 	ret = devm_request_irq(&pdev->dev, irq, aspeed_i2c_bus_irq,
 			       0, dev_name(&pdev->dev), bus);
 	if (ret < 0)
Signature · 1 line
2.39.2
Reviewed-by on v3 2/7
#3 lore raw

Re: [RFC PATCH v3 2/7] i2c: aspeed: Use platform_get_irq() instead of opencoding

Quoted 4 lines · Jonathan Cameron

A cleanup in its own right.
This has the handy side effect of working for ACPI FW as well (unlike fwnode_irq_get() which works for ARM64 but not x86 ACPI)

Hadn't I provided a tag?
Anyway,

Quoted 35 lines

---
v3: Fix it's -> its in description.

---
 drivers/i2c/busses/i2c-aspeed.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-aspeed.c +4 -3
index d3c99c5b3247..21a2f139f445 100644
@@ -19,7 +19,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
-#include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/reset.h>
@@ -1043,7 +1042,10 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
        if (ret < 0)
                return ret;
 
-       irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0)
+               return irq;
+
        ret = devm_request_irq(&pdev->dev, irq, aspeed_i2c_bus_irq,
                               0, dev_name(&pdev->dev), bus);
        if (ret < 0)
--

2.39.2

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

RFC PATCH v3 3/7 i2c: aspeed: Don't report error when optional dt bus-frequency not supplied

In reply to Jonathan Cameron

The bindings have this property as optional with a default of 100kHz. As such the driver should not be printing an error message if it is not supplied.

---
 drivers/i2c/busses/i2c-aspeed.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-aspeed.c +3 -7
index 21a2f139f445..4363bfe06f9b 100644
@@ -1003,13 +1003,9 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
 	}
 	reset_control_deassert(bus->rst);
 
-	ret = of_property_read_u32(pdev->dev.of_node,
-				   "bus-frequency", &bus->bus_frequency);
-	if (ret < 0) {
-		dev_err(&pdev->dev,
-			"Could not read bus-frequency property\n");
-		bus->bus_frequency = I2C_MAX_STANDARD_MODE_FREQ;
-	}
+	bus->bus_frequency = I2C_MAX_STANDARD_MODE_FREQ;
+	of_property_read_u32(pdev->dev.of_node,
+			     "bus-frequency", &bus->bus_frequency);
 
 	match = of_match_node(aspeed_i2c_bus_of_table, pdev->dev.of_node);
 	if (!match)
Signature · 1 line
2.39.2
#5 lore raw

RFC PATCH v3 4/7 i2c: aspeed: use a function pointer type def for clk_reg_val callback

In reply to Jonathan Cameron

Rather than having to define the parameter types of this function in multiple places, use a single typedef.

---
v3: New patch to switch to a function pointer as suggested by Andy.

---
 drivers/i2c/busses/i2c-aspeed.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-aspeed.c +4 -4
index 4363bfe06f9b..be93de56f7e4 100644
@@ -137,6 +137,8 @@ enum aspeed_i2c_slave_state {
 	ASPEED_I2C_SLAVE_STOP,
 };
 
+typedef u32 (*aspeed_get_clk_reg_val_cb)(struct device *dev, u32 divisor);
+
 struct aspeed_i2c_bus {
 	struct i2c_adapter		adap;
 	struct device			*dev;
@@ -145,8 +147,7 @@ struct aspeed_i2c_bus {
 	/* Synchronizes I/O mem access to base. */
 	spinlock_t			lock;
 	struct completion		cmd_complete;
-	u32				(*get_clk_reg_val)(struct device *dev,
-							   u32 divisor);
+	aspeed_get_clk_reg_val_cb	get_clk_reg_val;
 	unsigned long			parent_clk_frequency;
 	u32				bus_frequency;
 	/* Transaction state. */
@@ -1011,8 +1012,7 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
 	if (!match)
 		bus->get_clk_reg_val = aspeed_i2c_24xx_get_clk_reg_val;
 	else
-		bus->get_clk_reg_val = (u32 (*)(struct device *, u32))
-				match->data;
+		bus->get_clk_reg_val = (aspeed_get_clk_reg_val_cb)(match->data);
 
 	/* Initialize the I2C adapter */
 	spin_lock_init(&bus->lock);
Signature · 1 line
2.39.2
Reviewed-by on v3 4/7
#6 lore raw

Re: [RFC PATCH v3 4/7] i2c: aspeed: use a function pointer type def for clk_reg_val callback

Quoted 3 lines · Jonathan Cameron

Rather than having to define the parameter types of this function in multiple places, use a single typedef.

Suggested-by then?

Quoted 44 lines

---
v3: New patch to switch to a function pointer as suggested by Andy.

---
 drivers/i2c/busses/i2c-aspeed.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-aspeed.c +4 -5
index 4363bfe06f9b..be93de56f7e4 100644
@@ -137,6 +137,8 @@ enum aspeed_i2c_slave_state {
        ASPEED_I2C_SLAVE_STOP,
 };
 
+typedef u32 (*aspeed_get_clk_reg_val_cb)(struct device *dev, u32 divisor);
+
 struct aspeed_i2c_bus {
        struct i2c_adapter              adap;
        struct device                   *dev;
@@ -145,8 +147,7 @@ struct aspeed_i2c_bus {
        /* Synchronizes I/O mem access to base. */
        spinlock_t                      lock;
        struct completion               cmd_complete;
-       u32                             (*get_clk_reg_val)(struct device *dev,
-                                                          u32 divisor);
+       aspeed_get_clk_reg_val_cb       get_clk_reg_val;
        unsigned long                   parent_clk_frequency;
        u32                             bus_frequency;
        /* Transaction state. */
@@ -1011,8 +1012,7 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
        if (!match)
                bus->get_clk_reg_val = aspeed_i2c_24xx_get_clk_reg_val;
        else
-               bus->get_clk_reg_val = (u32 (*)(struct device *, u32))
-                               match->data;
+               bus->get_clk_reg_val = (aspeed_get_clk_reg_val_cb)(match->data);
 
        /* Initialize the I2C adapter */
        spin_lock_init(&bus->lock);
--

2.39.2

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw

Re: [RFC PATCH v3 4/7] i2c: aspeed: use a function pointer type def for clk_reg_val callback

Quoted 8 lines · On Wed, 31 May 2023 20:42:15 +0300 Andy Shevchenko <[email protected]>…
Quoted 3 lines · Jonathan Cameron

Rather than having to define the parameter types of this function in multiple places, use a single typedef.

Suggested-by then?

Good point.

Hopefully Wolfram uses b4 and that will get picked up automatically.

Quoted 48 lines
Quoted 44 lines

---
v3: New patch to switch to a function pointer as suggested by Andy.

---
 drivers/i2c/busses/i2c-aspeed.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-aspeed.c +4 -5
index 4363bfe06f9b..be93de56f7e4 100644
@@ -137,6 +137,8 @@ enum aspeed_i2c_slave_state {
        ASPEED_I2C_SLAVE_STOP,
 };
 
+typedef u32 (*aspeed_get_clk_reg_val_cb)(struct device *dev, u32 divisor);
+
 struct aspeed_i2c_bus {
        struct i2c_adapter              adap;
        struct device                   *dev;
@@ -145,8 +147,7 @@ struct aspeed_i2c_bus {
        /* Synchronizes I/O mem access to base. */
        spinlock_t                      lock;
        struct completion               cmd_complete;
-       u32                             (*get_clk_reg_val)(struct device *dev,
-                                                          u32 divisor);
+       aspeed_get_clk_reg_val_cb       get_clk_reg_val;
        unsigned long                   parent_clk_frequency;
        u32                             bus_frequency;
        /* Transaction state. */
@@ -1011,8 +1012,7 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
        if (!match)
                bus->get_clk_reg_val = aspeed_i2c_24xx_get_clk_reg_val;
        else
-               bus->get_clk_reg_val = (u32 (*)(struct device *, u32))
-                               match->data;
+               bus->get_clk_reg_val = (aspeed_get_clk_reg_val_cb)(match->data);
 
        /* Initialize the I2C adapter */
        spin_lock_init(&bus->lock);
--

2.39.2

#8 lore raw

RFC PATCH v3 5/7 i2c: aspeed: switch to generic fw properties.

In reply to Jonathan Cameron

Moving over to generic firmware properties allows this driver to get closer to working out of the box with both device tree and other firmware options, such as ACPI via PRP0001.

Tested only via QEMU emulation.

---
v3:
- Use a typedef for the function pointer type as introduced in precusor patch

---
 drivers/i2c/busses/i2c-aspeed.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/i2c/busses/i2c-aspeed.c +6 -9
index be93de56f7e4..992d64acd38d 100644
@@ -18,9 +18,8 @@
 #include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/of_address.h>
-#include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/reset.h>
 #include <linux/slab.h>
 
@@ -976,7 +975,6 @@ MODULE_DEVICE_TABLE(of, aspeed_i2c_bus_of_table);
 
 static int aspeed_i2c_probe_bus(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct aspeed_i2c_bus *bus;
 	struct clk *parent_clk;
 	int irq, ret;
@@ -1005,14 +1003,13 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
 	reset_control_deassert(bus->rst);
 
 	bus->bus_frequency = I2C_MAX_STANDARD_MODE_FREQ;
-	of_property_read_u32(pdev->dev.of_node,
-			     "bus-frequency", &bus->bus_frequency);
+	device_property_read_u32(&pdev->dev,
+				 "bus-frequency", &bus->bus_frequency);
 
-	match = of_match_node(aspeed_i2c_bus_of_table, pdev->dev.of_node);
-	if (!match)
+	bus->get_clk_reg_val =
+		(aspeed_get_clk_reg_val_cb)device_get_match_data(&pdev->dev);
+	if (!bus->get_clk_reg_val)
 		bus->get_clk_reg_val = aspeed_i2c_24xx_get_clk_reg_val;
-	else
-		bus->get_clk_reg_val = (aspeed_get_clk_reg_val_cb)(match->data);
 
 	/* Initialize the I2C adapter */
 	spin_lock_init(&bus->lock);
Signature · 1 line
2.39.2
#9 lore raw

Re: [RFC PATCH v3 5/7] i2c: aspeed: switch to generic fw properties.

Quoted 6 lines · Jonathan Cameron

Moving over to generic firmware properties allows this driver to get closer to working out of the box with both device tree and other firmware options, such as ACPI via PRP0001.

Tested only via QEMU emulation.

...

Quoted 3 lines

static int aspeed_i2c_probe_bus(struct platform_device *pdev) {
- const struct of_device_id *match;

With

  struct device *dev = &pdev->dev;

...

drivers/i2c/busses/i2c-aspeed.c static int aspeed_i2c_probe_bus(struct platform_device *pdev) · line 1007

Quoted 2 lines
drivers/i2c/busses/i2c-aspeed.c +2 -0
+       device_property_read_u32(&pdev->dev,
+                                "bus-frequency", &bus->bus_frequency);

This can take one or both parameters on one line.

...

drivers/i2c/busses/i2c-aspeed.c static int aspeed_i2c_probe_bus(struct platform_device *pdev) · line 1010

Quoted 2 lines
drivers/i2c/busses/i2c-aspeed.c +2 -0
+       bus->get_clk_reg_val =
+               (aspeed_get_clk_reg_val_cb)device_get_match_data(&pdev->dev);

This one as well I believe.

Also others, but it can be done in a separate patch.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#10 lore raw

Re: [RFC PATCH v3 5/7] i2c: aspeed: switch to generic fw properties.

Quoted 26 lines · On Wed, 31 May 2023 20:45:08 +0300 Andy Shevchenko <[email protected]>…
Quoted 6 lines · Jonathan Cameron

Moving over to generic firmware properties allows this driver to get closer to working out of the box with both device tree and other firmware options, such as ACPI via PRP0001.

Tested only via QEMU emulation.

...

Quoted 3 lines

static int aspeed_i2c_probe_bus(struct platform_device *pdev) {
- const struct of_device_id *match;

With

  struct device *dev = &pdev->dev;

...

drivers/i2c/busses/i2c-aspeed.c static int aspeed_i2c_probe_bus(struct platform_device *pdev) · line 1007

Quoted 2 lines
drivers/i2c/busses/i2c-aspeed.c +2 -0
+       device_property_read_u32(&pdev->dev,
+                                "bus-frequency", &bus->bus_frequency);  

This can take one or both parameters on one line.

Quoted 9 lines

...

drivers/i2c/busses/i2c-aspeed.c static int aspeed_i2c_probe_bus(struct platform_device *pdev) · line 1010

Quoted 2 lines
drivers/i2c/busses/i2c-aspeed.c +2 -0
+       bus->get_clk_reg_val =
+               (aspeed_get_clk_reg_val_cb)device_get_match_data(&pdev->dev);  

This one as well I believe.

Also others, but it can be done in a separate patch.

I thought about it, but decided out of scope for this set. I'm not aiming for too much general tidying!

Jonathan

#11 lore raw

RFC PATCH v3 6/7 i2c: aspeed: Set the fwnode for the adap->dev

In reply to Jonathan Cameron

This is needed for the bus matching used for ACPI based i2c client registration.

---
 drivers/i2c/busses/i2c-aspeed.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-aspeed.c +2 -1
index 992d64acd38d..e262b06e224b 100644
@@ -1018,7 +1018,6 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
 	bus->adap.retries = 0;
 	bus->adap.algo = &aspeed_i2c_algo;
 	bus->adap.dev.parent = &pdev->dev;
-	bus->adap.dev.of_node = pdev->dev.of_node;
 	strscpy(bus->adap.name, pdev->name, sizeof(bus->adap.name));
 	i2c_set_adapdata(&bus->adap, bus);
 
@@ -1044,6 +1043,8 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
 	if (ret < 0)
 		return ret;
 
+	device_set_node(&bus->adap.dev, dev_fwnode(&pdev->dev));
+
 	ret = i2c_add_adapter(&bus->adap);
 	if (ret < 0)
 		return ret;
Signature · 1 line
2.39.2
#12 lore raw

Re: [RFC PATCH v3 6/7] i2c: aspeed: Set the fwnode for the adap->dev

Quoted 3 lines · Jonathan Cameron

This is needed for the bus matching used for ACPI based i2c client registration.

Btw, this patch like maybe others (e.g., patch 1) can be sent already as non-RFC and applied independently on the goal of the entire series.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#13 lore raw

Re: [RFC PATCH v3 6/7] i2c: aspeed: Set the fwnode for the adap->dev

Quoted 9 lines · On Wed, 31 May 2023 20:46:42 +0300 Andy Shevchenko <[email protected]>…
Quoted 3 lines · Jonathan Cameron

This is needed for the bus matching used for ACPI based i2c client registration.

Btw, this patch like maybe others (e.g., patch 1) can be sent already as non-RFC and applied independently on the goal of the entire series.

True but then I have to reference two sets of precursors for
what I care about for now. Now this is fairly stable, I'll circle back to post these as a separate set - I can carry on referencing the RFC from the QEMU side of things (and blog post etc I should write on this...)

Jonathan

#14 lore raw

RFC PATCH v3 7/7 HACK: i2c: aspeed: Comment clock out and make reset optional

In reply to Jonathan Cameron

Needs tidying up - hopefully can do clock right
using on going work from Niyas
https://linaro.atlassian.net/wiki/spaces/CLIENTPC/pages/28832333867/ACPI+Clock+Management

ACPI does not provide an equivalent reset deassert / assert. _RST doesn't fit that model, so for now make the reset optional.

---
v3: Keeping this as an obvious hack rather than moving to something
that works in the interest of not putting a stop gap solution in place.

---
 drivers/i2c/busses/i2c-aspeed.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-aspeed.c +6 -6
index e262b06e224b..e29e7effd911 100644
@@ -987,14 +987,14 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
 	if (IS_ERR(bus->base))
 		return PTR_ERR(bus->base);
 
-	parent_clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(parent_clk))
-		return PTR_ERR(parent_clk);
-	bus->parent_clk_frequency = clk_get_rate(parent_clk);
+	//	parent_clk = devm_clk_get(&pdev->dev, NULL);
+	//	if (IS_ERR(parent_clk))//
+	//		return PTR_ERR(parent_clk);
+	bus->parent_clk_frequency = 1000000;//clk_get_rate(parent_clk);
 	/* We just need the clock rate, we don't actually use the clk object. */
-	devm_clk_put(&pdev->dev, parent_clk);
+	//devm_clk_put(&pdev->dev, parent_clk);
 
-	bus->rst = devm_reset_control_get_shared(&pdev->dev, NULL);
+	bus->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
 	if (IS_ERR(bus->rst)) {
 		dev_err(&pdev->dev,
 			"missing or invalid reset controller device tree entry\n");
Signature · 1 line
2.39.2