Re: Re: [PATCH 0/0] (proposed?) Add ACPI binding to Rockchip RK3xxx I2C bus

From: Shimrra Shai
Date: Mon Mar 25 2024 - 05:16:23 EST


Hey Jonathan,

Since I haven't heard a reply from you so far, and I've also done some more
research on the ClockInput options and stuff I'm soon going to ask the
firmware developers to commit the following updated ACPI bindings unless I
get comment there is still something wrong with them. I'm posting about it
here because this is going to have to be the base for any revisions to
these kernel patches I propose later and so I really want to make sure I
get both "sides" of this right (i.e. both the firmware and kernel). If I
don't hear back within a few days I'm going to just send this as-is and
see if it gets accepted by the firmware team.

Note also that the kernel CRU driver currently won't be able to do anything
with all the info in the CRU binding right now, but the UEFI firmware also
pre-initializes the unit so it isn't super necessary I think, I just
thought to add the binding so it can be referenced elsewhere in the tables.
I believe this is the "proper" way from comparing the descriptions of the
ClockInput tag and "clocks" DTB option; the DTB clocks options all
reference the CRU (which makes sense from description of the physical
hardware itself), so I am fairly confident this is "best", but if anyone
objects on this side I still want to hear it as soon as possible.

ACPI binding for the CRU:

Device (CRU_) {
/* coining a new _HID is unnecessary so long as compatible string exists */
Name (_CID, "PRP0001")
Name (_UID, 0)
Name (_CCA, 0)

Method (_CRS, 0x0, Serialized) {
Name (RBUF, ResourceTemplate() {
Memory32Fixed (ReadWrite, 0xfd7c0000, 0x5c000)
ClockInput (1100000000, 1, Hz, Fixed, "CLK0", 0)
ClockInput (786432000, 1, Hz, Fixed, "CLK1", 0)
ClockInput (850000000, 1, Hz, Fixed, "CLK2", 0)
ClockInput (1188000000, 1, Hz, Fixed, "CLK3", 0)
ClockInput (702000000, 1, Hz, Fixed, "CLK4", 0)
ClockInput (400000000, 1, Hz, Fixed, "CLK5", 0)
ClockInput (500000000, 1, Hz, Fixed, "CLK6", 0)
ClockInput (800000000, 1, Hz, Fixed, "CLK7", 0)
ClockInput (100000000, 1, Hz, Fixed, "CLK8", 0)
ClockInput (400000000, 1, Hz, Fixed, "CLK9", 0)
ClockInput (100000000, 1, Hz, Fixed, "CLKA", 0)
ClockInput (200000000, 1, Hz, Fixed, "CLKB", 0)
ClockInput (500000000, 1, Hz, Fixed, "CLKC", 0)
ClockInput (375000000, 1, Hz, Fixed, "CLKD", 0)
ClockInput (150000000, 1, Hz, Fixed, "CLKE", 0)
ClockInput (200000000, 1, Hz, Fixed, "CLKF", 0)
})
Return (RBUF)
}

Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package (2) { "compatible", "rockchip,rk3588-cru" },
}
})

// PLL_PPLL
Device (CLK0) {
Name (_ADR, 0x0)
}

// PLL_AUPLL
Device (CLK1) {
Name (_ADR, 0x1)
}

// PLL_NPLL
Device (CLK2) {
Name (_ADR, 0x2)
}

// PLL_GPLL
Device (CLK3) {
Name (_ADR, 0x3)
}

// ACLK_CENTER_ROOT
Device (CLK4) {
Name (_ADR, 0x4)
}

// HCLK_CENTER_ROOT
Device (CLK5) {
Name (_ADR, 0x5)
}

// ACLK_CENTER_LOW_ROOT
Device (CLK6) {
Name (_ADR, 0x6)
}

// ACLK_TOP_ROOT
Device (CLK7) {
Name (_ADR, 0x7)
}

// PCLK_TOP_ROOT
Device (CLK8) {
Name (_ADR, 0x8)
}

// ACLK_LOW_TOP_ROOT
Device (CLK9) {
Name (_ADR, 0x9)
}

// PCLK_PMU0_ROOT
Device (CLKA) {
Name (_ADR, 0xa)
}

// HCLK_PMU_CM0_ROOT
Device (CLKB) {
Name (_ADR, 0xb)
}

// ACLK_VOP
Device (CLKC) {
Name (_ADR, 0xc)
}

// ACLK_BUS_ROOT
Device (CLKD) {
Name (_ADR, 0xd)
}

// CLK_150M_SRC
Device (CLKE) {
Name (_ADR, 0xe)
}

// CLK_GPU
Device (CLKF) {
Name (_ADR, 0xf)
}
}

ACPI bindings for I2C (I2C1 as example):

Device (I2C1) {
Name (_HID, "RKCP3001")
/* _CID is no longer required */
Name (_UID, 1)
Name (_CCA, 0)

Method (_CRS, 0x0, Serialized) {
Name (RBUF, ResourceTemplate() {
Memory32Fixed (ReadWrite, 0xfea90000, 0x1000)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 350 }
ClockInput (198000000, 1, Hz, Fixed, "\_SB_.CRU_", PCLK_I2C1)
ClockInput (198000000, 1, Hz, Fixed, "\_SB_.CRU_", BCLK_I2C1)
})
Return (RBUF)
}
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package (2) { "#address-cells", 1 },
Package (2) { "#size-cells", 0 },
}
})
}

---
Shimmy