linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v3 0/7] i2c: Enabling use of aspeed-i2c with ACPI
@ 2023-05-31 10:05 Jonathan Cameron
  2023-05-31 10:05 ` [RFC PATCH v3 1/7] i2c: acpi: set slave mode flag Jonathan Cameron
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Jonathan Cameron @ 2023-05-31 10:05 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Niyas Sait, Klaus Jensen, Andy Shevchenko,
	linux-acpi, Jeremy Kerr, Matt Johnston,
	Shesha Bhushan Sreenivasamurthy, linux-cxl, linuxarm,
	Viacheslav A . Dubeyko

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/20230425063540.46143-2-its@irrelevant.dk/
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 <niyas.sait@linaro.org>
Cc: Klaus Jensen <its@irrelevant.dk>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>
Cc: Matt Johnston <matt@codeconstruct.com.au>
Cc: Shesha Bhushan Sreenivasamurthy <sheshas@marvell.com>

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(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-06-01  9:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31 10:05 [RFC PATCH v3 0/7] i2c: Enabling use of aspeed-i2c with ACPI Jonathan Cameron
2023-05-31 10:05 ` [RFC PATCH v3 1/7] i2c: acpi: set slave mode flag Jonathan Cameron
2023-05-31 10:05 ` [RFC PATCH v3 2/7] i2c: aspeed: Use platform_get_irq() instead of opencoding Jonathan Cameron
2023-05-31 17:41   ` Andy Shevchenko
2023-05-31 10:05 ` [RFC PATCH v3 3/7] i2c: aspeed: Don't report error when optional dt bus-frequency not supplied Jonathan Cameron
2023-05-31 10:05 ` [RFC PATCH v3 4/7] i2c: aspeed: use a function pointer type def for clk_reg_val callback Jonathan Cameron
2023-05-31 17:42   ` Andy Shevchenko
2023-06-01  9:07     ` Jonathan Cameron
2023-05-31 10:05 ` [RFC PATCH v3 5/7] i2c: aspeed: switch to generic fw properties Jonathan Cameron
2023-05-31 17:45   ` Andy Shevchenko
2023-06-01  9:08     ` Jonathan Cameron
2023-05-31 10:05 ` [RFC PATCH v3 6/7] i2c: aspeed: Set the fwnode for the adap->dev Jonathan Cameron
2023-05-31 17:46   ` Andy Shevchenko
2023-06-01  9:10     ` Jonathan Cameron
2023-05-31 10:06 ` [RFC PATCH v3 7/7] HACK: i2c: aspeed: Comment clock out and make reset optional Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).