Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • I2C Controller is enabled on I.MX8MP platform.

  • I2C Supports runtime power management is added (_PS0 and _PS3)

  • Base clock can be fetched through SCMI interface

  • through clock gating.

  • AML methods to get base clock rate through SCMI interface.

  • Supports pin muxing and configuration with ACPI pin resources

Changes

AML Code

Code Block
Device (I2C1)
{
  Name (_HID, "NXP0104")
  Name (_HRV, 0x1)
  Name (_UID, 0x1)
  Name (_CLK, 13)

  Method (_STA)
  {
    Return(0xf)
  }

  Name (_PRS, ResourceTemplate ()  // _PRS: Possible Resource Settings
  {
      Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 67 }
  })

  Method (_CRS, 0x0, NotSerialized)
  {
    Name ( RBUF, ResourceTemplate () {
      MEMORY32FIXED(ReadWrite, 0x30A20000, 0x14, )
      Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 67 }
    })
    Return(RBUF)
  }

  Method (_PS0, 0, NotSerialized)  // _PS0: Power State 0
  {
        SC07(_CLK, 1) // SCMI method for clock enable
  }

  Method (_PS3, 0, NotSerialized)  // _PS3: Power State 3
  {
        SC07(_CLK, 0) // SCMI interface for clock gating
  }

  Method(GCLK, 0, NotSerialized)
  {
      local0 = SC06(_CLK) // SCMI interface to get clock rate
      Return (local0)
  }

}

...

...

I2C

...

https://gitlab.com/LinaroLtd/clientpc/linux/-/merge_requests/3

GCLK evaluation method in Linux:

https://gitlab.com/LinaroLtd/clientpc/linux/-/merge_requests/5

Challenges

Base Clock Rate

I2C controller for the IMX platform needs to know the base clock rate for the controller to be to select configure the clock scaling factors in the controller. For the device tree, this can be specified through clock properties but for ACPI we have to add a device-specific method (_DSD) or a new control method (GCLK in above example) to fetch the clock rate.

A reference implementation can be found in following patches:

Linux I2C ACPI Binding

https://gitlab.com/LinaroLtd/clientpc/linux/-/merge_requests/3

GCLK evaluation method in Linux:

https://gitlab.com/LinaroLtd/clientpc/linux/-/merge_requests/5. There are few options available for ACPI

  • Hardcode in the kernel I2C IMX driver

    • There are many devices and drivers following this approach in the Linux kernel. This would work only for fixed clock frequencies.

  • clock-frequency properties in Device specific data (_DSD)

    • clock rate can be specified in ACPI table for the devices under _DSD object. This again works only for fixed clock frequencies

  • Device-specific methods to pass clock rate

    • A specific control method can be added for the devices to get the clock rate. This would work even for variable clock rates. The AML code above uses such a mechanism.

  • ClockInput Resources (Introduced in ACP 6.5)

    • This is not yet implemented in Linux kernel or ACPICA framework.