Re: [PATCH v4 8/8] i2c: designware: Add doorbell support for Skyrim

From: Jarkko Nikula
Date: Mon Mar 13 2023 - 06:29:59 EST


On 3/10/23 23:19, Mario Limonciello wrote:
Skyrim and later platform don't use the platform feature mailbox for
communication for I2C arbitration, they rely upon ringing a doorbell.

Detect the platform by the device ID of the root port and choose the
appropriate method.

Link: https://lore.kernel.org/linux-i2c/20220916131854.687371-3-jsd@xxxxxxxxxxxx/
Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
---
v3->v4:
* Adjust to use PCI device ID and function pointers instead
v2->v3:
* Use CPU ID rather than ACPI ID, this will be pushed to a later patch
v1->v2:
* New patch
---
drivers/i2c/busses/i2c-designware-amdpsp.c | 40 ++++++++++++++++------
1 file changed, 30 insertions(+), 10 deletions(-)

...

@@ -276,6 +289,13 @@ int i2c_dw_amdpsp_probe_lock_support(struct dw_i2c_dev *dev)
if (psp_i2c_dev)
return -EEXIST;
+ /* Cezanne uses platform mailbox, Skyrim and later use doorbell */
+ rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
+ if (rdev->device == 0x1630)
+ _psp_send_i2c_req = psp_send_i2c_req_cezanne;
+ else
+ _psp_send_i2c_req = psp_send_i2c_req_skyrim;
+

Is there any possibility pci_get_domain_bus_and_slot() returns NULL? Or is 00:00.0 always present?