Skip to contentSkip to conversation

i2c: add i2c bus driver for amd navi gpu

PATCH Superseded Sanket Goswami 3 participants 11 messages Mar 9, 2021 – Mar 29, 2021

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: add i2c bus driver for amd navi gpu

Latest AMDGPU NAVI cards have USB Type-C interface which can be accessed over I2C. The Type-C controller has integrated designware i2c which is exposed as a PCI device to the AMD platform.

Also there exists couple of notable IP problems that are dealt as a workaround:
- I2C transactions work on a polling mode as IP does not generate interrupt.

- I2C reads commands are sent twice to address the IP issues.

---
 drivers/i2c/busses/i2c-designware-common.c |   3 +
 drivers/i2c/busses/i2c-designware-core.h   |   3 +
 drivers/i2c/busses/i2c-designware-master.c | 175 +++++++++++++++++++++
 drivers/i2c/busses/i2c-designware-pcidrv.c |  56 +++++++
 4 files changed, 237 insertions(+)
drivers/i2c/busses/i2c-designware-common.c +3 -0
index 3c19aada4b30..50883a70b482 100644
@@ -150,6 +150,9 @@ int i2c_dw_init_regmap(struct dw_i2c_dev *dev)
 	reg = readl(dev->base + DW_IC_COMP_TYPE);
 	i2c_dw_release_lock(dev);
 
+	if (dev->flags & AMD_NON_INTR_MODE)
+		map_cfg.max_register = AMD_UCSI_INTR_REG;
+
 	if (reg == swab32(DW_IC_COMP_TYPE_VALUE)) {
 		map_cfg.reg_read = dw_reg_read_swab;
 		map_cfg.reg_write = dw_reg_write_swab;
drivers/i2c/busses/i2c-designware-core.h +3 -0
index 85307cfa7109..0cce4144b9ac 100644
@@ -291,9 +291,12 @@ struct dw_i2c_dev {
 #define ACCESS_INTR_MASK	BIT(0)
 #define ACCESS_NO_IRQ_SUSPEND	BIT(1)
 
+#define AMD_NON_INTR_MODE	BIT(2)
 #define MODEL_MSCC_OCELOT	BIT(8)
 #define MODEL_BAIKAL_BT1	BIT(9)
 #define MODEL_MASK		GENMASK(11, 8)
+#define AMD_UCSI_INTR_EN	0xD
+#define AMD_UCSI_INTR_REG	0x474
 
 int i2c_dw_init_regmap(struct dw_i2c_dev *dev);
 u32 i2c_dw_scl_hcnt(u32 ic_clk, u32 tSYMBOL, u32 tf, int cond, int offset);
drivers/i2c/busses/i2c-designware-master.c +175 -0

211 lines not on this page · raw message

drivers/i2c/busses/i2c-designware-pcidrv.c +56 -0

103 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
Thank you for the patch! Perhaps something to improve:

Hi Sanket,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on v5.12-rc2 next-20210309]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sanket-Goswami/i2c-add-i2c-bus-driver-for-amd-navi-gpu/20210309-213535
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: powerpc64-randconfig-m031-20210309 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f1d0b9c128d45f6d55f3d3f864db2e7ebf42adc5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sanket-Goswami/i2c-add-i2c-bus-driver-for-amd-navi-gpu/20210309-213535 git checkout f1d0b9c128d45f6d55f3d3f864db2e7ebf42adc5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/i2c/busses/i2c-designware-master.c:899:5: warning: no previous prototype for 'amd_i2c_adap_quirk' [-Wmissing-prototypes]
     899 | int amd_i2c_adap_quirk(struct dw_i2c_dev *amdev)
         |     ^~~~~~~~~~~~~~~~~~

vim +/amd_i2c_adap_quirk +899 drivers/i2c/busses/i2c-designware-master.c

898

 > 899	int amd_i2c_adap_quirk(struct dw_i2c_dev *amdev)

900 {
901 struct i2c_adapter *amdap = &amdev->adapter;
902 int ret;
903
904 if (!(amdev->flags & AMD_NON_INTR_MODE))
905 return -ENODEV;
906
907 return i2c_add_numbered_adapter(amdap);
908
909 return ret;
910 }
911

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#2 lore raw
In reply to Sanket Goswami

On Tue, Mar 09, 2021 at 07:01:47PM +0530, Sanket Goswami wrote:

i2c: -> i2c: designware:
add i2c bus driver -> add a driver
amd -> AMD
gpu -> GPU

in the subject

Quoted 2 lines

Latest AMDGPU NAVI cards have USB Type-C interface which can be accessed over I2C.

I didn't get this. You mean that USB traffic over I²C? This sounds insane for a least. Maybe something else is there and description is not fully correct?

Quoted 1 line

The Type-C controller has integrated designware i2c which is

DesignWare

Quoted 8 lines

exposed as a PCI device to the AMD platform.

Also there exists couple of notable IP problems that are dealt as a workaround:
- I2C transactions work on a polling mode as IP does not generate interrupt.

- I2C reads commands are sent twice to address the IP issues.

Please, read this article: https://chris.beams.io/posts/git-commit/

...

Quoted 1 line

+#define AMD_UCSI_INTR_EN 0xD

Why it's capitalized?

...

Quoted 1 line

#include "i2c-designware-core.h"

+ Blank line

drivers/i2c/busses/i2c-designware-master.c line 26

Quoted 2 lines
drivers/i2c/busses/i2c-designware-master.c +2 -0
+#define AMD_TIMEOUT_MSEC_MIN	10000
+#define AMD_TIMEOUT_MSEC_MAX	11000

Use unit suffix in the definitions.

...

Quoted 1 line

+static void i2c_dw_configure_bus(struct dw_i2c_dev *i2cd)

Why all this is customized? Why FIFO can't be autodetected?

...

Quoted 3 lines

+/* Initiate and continue master read/write transaction with polling
+ * based transfer routine and write messages into the tx buffer.
+ */

Wrong multi-line comment style.

...

Quoted 1 line

+static int amd_i2c_dw_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num_msgs)

Why do you need a custom function for that? Can it be generic and not AMD specific?

...

drivers/i2c/busses/i2c-designware-master.c static int i2c_dw_init_master(struct dw_i2c_dev *dev) · line 365

Quoted 3 lines
drivers/i2c/busses/i2c-designware-master.c +3 -0
+	/* Enable ucsi interrupt */
+	if (dev->flags & AMD_NON_INTR_MODE)
+		regmap_write(dev->map, AMD_UCSI_INTR_REG, AMD_UCSI_INTR_EN);

This is looks like a hack. Why is it here?

...

drivers/i2c/busses/i2c-designware-master.c i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) · line 621

Quoted 2 lines
drivers/i2c/busses/i2c-designware-master.c +2 -0
+	if (dev->flags & AMD_NON_INTR_MODE)
+		return amd_i2c_dw_master_xfer(adap, msgs, num);

Ditto.

...

drivers/i2c/busses/i2c-designware-master.c static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev) · line 902

Quoted 5 lines
drivers/i2c/busses/i2c-designware-master.c +4 -0
+int amd_i2c_adap_quirk(struct dw_i2c_dev *amdev)
+{
+	struct i2c_adapter *amdap = &amdev->adapter;
 
+	int ret;

See below.

drivers/i2c/busses/i2c-designware-master.c static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev) · line 909

Quoted 6 lines
drivers/i2c/busses/i2c-designware-master.c +5 -0
+	if (!(amdev->flags & AMD_NON_INTR_MODE))
+		return -ENODEV;
 
+	return i2c_add_numbered_adapter(amdap);
+
+	return ret;

What the second one does?

Quoted 1 line

+}

...

drivers/i2c/busses/i2c-designware-master.c int i2c_dw_probe_master(struct dw_i2c_dev *dev) · line 949

Quoted 2 lines
drivers/i2c/busses/i2c-designware-master.c +2 -0
+	ret = amd_i2c_adap_quirk(dev);
+	if (ret != -ENODEV)

This is ugly. Can we run quirk if and only if we have an AMD chip?

Quoted 1 line
(quoted diff) +1 -0
+		return ret;

...

Quoted 2 lines

#define DRIVER_NAME "i2c-designware-pci"
+#define AMD_CLK_RATE 100000

Add units.

...

drivers/i2c/busses/i2c-designware-pcidrv.c static struct dw_scl_sda_cfg hsw_config = { · line 88

Quoted 6 lines
drivers/i2c/busses/i2c-designware-pcidrv.c +6 -0
+/* NAVI-AMD HCNT/LCNT/SDA hold time */
+static struct dw_scl_sda_cfg navi_amd_config = {
+	.ss_hcnt = 0x1ae,
+	.ss_lcnt = 0x23a,
+	.sda_hold = 0x9,
+};

(1)

...

Quoted 9 lines
drivers/i2c/busses/i2c-designware-pcidrv.c +9 -0
+static int i2c_dw_populate_client(struct dw_i2c_dev *i2cd)
+{
+	struct i2c_board_info	*i2c_dw_ccgx_ucsi;
+	struct i2c_client	*ccgx_client;
+
+	i2c_dw_ccgx_ucsi = devm_kzalloc(i2cd->dev, sizeof(*i2c_dw_ccgx_ucsi), GFP_KERNEL);
+	if (!i2c_dw_ccgx_ucsi)
+		return -ENOMEM;
+

drivers/i2c/busses/i2c-designware-pcidrv.c static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) · line 139

Quoted 10 lines
drivers/i2c/busses/i2c-designware-pcidrv.c +10 -0
+	strscpy(i2c_dw_ccgx_ucsi->type, "ccgx-ucsi", sizeof(i2c_dw_ccgx_ucsi->type));
+	i2c_dw_ccgx_ucsi->addr = 0x08;
+	i2c_dw_ccgx_ucsi->irq = i2cd->irq;
+
+	ccgx_client = i2c_new_client_device(&i2cd->adapter, i2c_dw_ccgx_ucsi);
+	if (!ccgx_client)
+		return -ENODEV;
+
+	return 0;
+}

This is the same as in nVidia GPU I²C driver. Can you do a preparatory changes to deduplicate this?

Also why (1) and this can't be instantiated from ACPI / DT?

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

Hi Andy,

Quoted 50 lines · Andy Shevchenko

[CAUTION: External Email]

On Tue, Mar 09, 2021 at 07:01:47PM +0530, Sanket Goswami wrote:

i2c: -> i2c: designware:
add i2c bus driver -> add a driver
amd -> AMD
gpu -> GPU

in the subject

Quoted 2 lines

Latest AMDGPU NAVI cards have USB Type-C interface which can be accessed over I2C.

I didn't get this. You mean that USB traffic over I²C? This sounds insane for a least. Maybe something else is there and description is not fully correct?

Quoted 1 line

The Type-C controller has integrated designware i2c which is

DesignWare

Quoted 8 lines

exposed as a PCI device to the AMD platform.

Also there exists couple of notable IP problems that are dealt as a workaround:
- I2C transactions work on a polling mode as IP does not generate interrupt.

- I2C reads commands are sent twice to address the IP issues.

Please, read this article: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fchris.beams.io%2Fposts%2Fgit-commit%2F&data=04%7C01%7CSanket.Goswami%40amd.com%7C70d1c562d0c04fc2b76508d8e3074c97%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637508967775355658%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yLiOkOtqCwGQAJgpYast8cMfCY4I9R74ElWm9FDNFNQ%3D&reserved=0

...

Quoted 1 line

+#define AMD_UCSI_INTR_EN 0xD

Why it's capitalized?

...

Quoted 1 line

#include "i2c-designware-core.h"

+ Blank line

drivers/i2c/busses/i2c-designware-master.c line 26

Quoted 2 lines
drivers/i2c/busses/i2c-designware-master.c +2 -0
+#define AMD_TIMEOUT_MSEC_MIN 10000
+#define AMD_TIMEOUT_MSEC_MAX 11000

Use unit suffix in the definitions.

Quoted 5 lines

...

Quoted 1 line

+static void i2c_dw_configure_bus(struct dw_i2c_dev *i2cd)

Why all this is customized? Why FIFO can't be autodetected?

Addressed in v2.

Quoted 7 lines

...

Quoted 3 lines

+/* Initiate and continue master read/write transaction with polling
+ * based transfer routine and write messages into the tx buffer.
+ */

Quoted 8 lines

Wrong multi-line comment style.

...

Quoted 1 line

+static int amd_i2c_dw_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num_msgs)

Why do you need a custom function for that? Can it be generic and not AMD specific?

This function takes care of AMD Specific bus configuration for the transfer and also addresses the IP issue of i2c transactions hence it is kept as custom.

Quoted 8 lines

...

drivers/i2c/busses/i2c-designware-master.c static int i2c_dw_init_master(struct dw_i2c_dev *dev) · line 365

Quoted 3 lines
drivers/i2c/busses/i2c-designware-master.c +3 -0
+     /* Enable ucsi interrupt */
+     if (dev->flags & AMD_NON_INTR_MODE)
+             regmap_write(dev->map, AMD_UCSI_INTR_REG, AMD_UCSI_INTR_EN);

This is looks like a hack. Why is it here?

In order to enable the interrupt for UCSI i.e. AMD NAVI GPU card, it is mandatory to set the right value in specific register (offset:0x474) as per the hardware IP specification.

Quoted 7 lines

...

drivers/i2c/busses/i2c-designware-master.c i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) · line 621

Quoted 2 lines
drivers/i2c/busses/i2c-designware-master.c +2 -0
+     if (dev->flags & AMD_NON_INTR_MODE)
+             return amd_i2c_dw_master_xfer(adap, msgs, num);

Ditto.

Initiate I2C message transfer when AMD NAVI GPU card is enabled, As it is polling based transfer mechanism, which does not support interrupt based functionalities of existing DesignWare driver.

Quoted 64 lines

...

drivers/i2c/busses/i2c-designware-master.c static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev) · line 902

Quoted 5 lines
drivers/i2c/busses/i2c-designware-master.c +4 -0
+int amd_i2c_adap_quirk(struct dw_i2c_dev *amdev)
+{
+     struct i2c_adapter *amdap = &amdev->adapter;
 
+     int ret;

See below.

drivers/i2c/busses/i2c-designware-master.c static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev) · line 909

Quoted 6 lines
drivers/i2c/busses/i2c-designware-master.c +5 -0
+     if (!(amdev->flags & AMD_NON_INTR_MODE))
+             return -ENODEV;
 
+     return i2c_add_numbered_adapter(amdap);
+
+     return ret;

What the second one does?

Quoted 1 line

+}

...

drivers/i2c/busses/i2c-designware-master.c int i2c_dw_probe_master(struct dw_i2c_dev *dev) · line 949

Quoted 2 lines
drivers/i2c/busses/i2c-designware-master.c +2 -0
+     ret = amd_i2c_adap_quirk(dev);
+     if (ret != -ENODEV)

This is ugly. Can we run quirk if and only if we have an AMD chip?

Quoted 1 line

+ return ret;

...

Quoted 2 lines

#define DRIVER_NAME "i2c-designware-pci"
+#define AMD_CLK_RATE 100000

Add units.

...

drivers/i2c/busses/i2c-designware-pcidrv.c static struct dw_scl_sda_cfg hsw_config = { · line 88

Quoted 6 lines
drivers/i2c/busses/i2c-designware-pcidrv.c +6 -0
+/* NAVI-AMD HCNT/LCNT/SDA hold time */
+static struct dw_scl_sda_cfg navi_amd_config = {
+     .ss_hcnt = 0x1ae,
+     .ss_lcnt = 0x23a,
+     .sda_hold = 0x9,
+};

(1)

...

Quoted 14 lines
drivers/i2c/busses/i2c-designware-pcidrv.c +14 -0
+static int i2c_dw_populate_client(struct dw_i2c_dev *i2cd)
+{
+     struct i2c_board_info   *i2c_dw_ccgx_ucsi;
+     struct i2c_client       *ccgx_client;
+
+     i2c_dw_ccgx_ucsi = devm_kzalloc(i2cd->dev, sizeof(*i2c_dw_ccgx_ucsi), GFP_KERNEL);
+     if (!i2c_dw_ccgx_ucsi)
+             return -ENOMEM;
+
+     strscpy(i2c_dw_ccgx_ucsi->type, "ccgx-ucsi", sizeof(i2c_dw_ccgx_ucsi->type));
+     i2c_dw_ccgx_ucsi->addr = 0x08;
+     i2c_dw_ccgx_ucsi->irq = i2cd->irq;
+
+     ccgx_client = i2c_new_client_device(&i2cd->adapter, i2c_dw_ccgx_ucsi);
Quoted 8 lines

drivers/i2c/busses/i2c-designware-pcidrv.c static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) · line 139

Quoted 5 lines
drivers/i2c/busses/i2c-designware-pcidrv.c +5 -0
+     if (!ccgx_client)
+             return -ENODEV;
+
+     return 0;
+}

This is the same as in nVidia GPU I²C driver. Can you do a preparatory changes to deduplicate this?

Addressed in v2.

Quoted 2 lines

Also why (1) and this can't be instantiated from ACPI / DT?

It is in line with the existing PCIe-based DesignWare driver, A similar approach is used by the various vendors.

Quoted 6 lines

--
With Best Regards,
Andy Shevchenko

Thanks,
Sanket

#4 lore raw
Quoted 2 lines · Sanket
Quoted 1 line · Andy Shevchenko

On Tue, Mar 09, 2021 at 07:01:47PM +0530, Sanket Goswami wrote:

...

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

+static int amd_i2c_dw_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num_msgs)

Why do you need a custom function for that? Can it be generic and not AMD specific?

This function takes care of AMD Specific bus configuration for the transfer and also addresses the IP issue of i2c transactions hence it is kept as custom.

Can you a bit elaborate this? IT would be nice to have a comment in the code explaining what is the difference with a generic approach.

...

Quoted 8 lines
Quoted 5 lines

drivers/i2c/busses/i2c-designware-master.c static int i2c_dw_init_master(struct dw_i2c_dev *dev) · line 365

Quoted 3 lines
drivers/i2c/busses/i2c-designware-master.c +3 -0
+     /* Enable ucsi interrupt */
+     if (dev->flags & AMD_NON_INTR_MODE)
+             regmap_write(dev->map, AMD_UCSI_INTR_REG, AMD_UCSI_INTR_EN);

This is looks like a hack. Why is it here?

In order to enable the interrupt for UCSI i.e. AMD NAVI GPU card, it is mandatory to set the right value in specific register (offset:0x474) as per the hardware IP specification.

Why it can not be done outside of this function?

...

Quoted 7 lines
Quoted 4 lines

drivers/i2c/busses/i2c-designware-master.c i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) · line 621

Quoted 2 lines
drivers/i2c/busses/i2c-designware-master.c +2 -0
+     if (dev->flags & AMD_NON_INTR_MODE)
+             return amd_i2c_dw_master_xfer(adap, msgs, num);

Ditto.

Initiate I2C message transfer when AMD NAVI GPU card is enabled, As it is polling based transfer mechanism, which does not support interrupt based functionalities of existing DesignWare driver.

Ditto.

And I think I already have told you that I prefer to see rather MODEL_ quirk.

...

Quoted 3 lines
Quoted 1 line

Also why (1) and this can't be instantiated from ACPI / DT?

It is in line with the existing PCIe-based DesignWare driver, A similar approach is used by the various vendors.

Here is no answer to the question. What prevents you to fix your ACPI tables or DT?

We already got rid of FIFO hard coded values, timings are harder to achieve, but we expect that new firmwares will provide values in the ACPI tables.

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

Hi Andy,

Quoted 10 lines · Andy Shevchenko

[CAUTION: External Email]

Quoted 2 lines · Sanket
Quoted 1 line · Andy Shevchenko

On Tue, Mar 09, 2021 at 07:01:47PM +0530, Sanket Goswami wrote:

...

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

+static int amd_i2c_dw_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num_msgs)

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Why do you need a custom function for that? Can it be generic and not AMD specific?

This function takes care of AMD Specific bus configuration for the transfer and also addresses the IP issue of i2c transactions hence it is kept as custom.

Can you a bit elaborate this? IT would be nice to have a comment in the code explaining what is the difference with a generic approach.

This will be addressed in v3.

Quoted 7 lines

...

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
drivers/i2c/busses/i2c-designware-master.c +3 -0
+     /* Enable ucsi interrupt */
+     if (dev->flags & AMD_NON_INTR_MODE)
+             regmap_write(dev->map, AMD_UCSI_INTR_REG, AMD_UCSI_INTR_EN);
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

This is looks like a hack. Why is it here?

In order to enable the interrupt for UCSI i.e. AMD NAVI GPU card, it is mandatory to set the right value in specific register (offset:0x474) as per the hardware IP specification.

Why it can not be done outside of this function?

This will be addressed in v3.

Quoted 6 lines

...

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
drivers/i2c/busses/i2c-designware-master.c +2 -0
+     if (dev->flags & AMD_NON_INTR_MODE)
+             return amd_i2c_dw_master_xfer(adap, msgs, num);
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Ditto.

Initiate I2C message transfer when AMD NAVI GPU card is enabled, As it is polling based transfer mechanism, which does not support interrupt based functionalities of existing DesignWare driver.

Ditto.

And I think I already have told you that I prefer to see rather MODEL_ quirk.

I did not find MODEL_ quirk reference in the PCI device tree, It is actually used in platform device tree which is completely different from our PCI based configuration, can you please provide some reference of MODEL_ quirk which will be part of the PCI device tree?

Quoted 4 lines

...

Quoted 1 line
Quoted 1 line

Also why (1) and this can't be instantiated from ACPI / DT?

Quoted 8 lines
Quoted 2 lines

It is in line with the existing PCIe-based DesignWare driver, A similar approach is used by the various vendors.

Here is no answer to the question. What prevents you to fix your ACPI tables or DT?

We already got rid of FIFO hard coded values, timings are harder to achieve, but we expect that new firmwares will provide values in the ACPI tables.

AMD NAVI GPU card is the PCI initiated driver, not ACPI initiated, and also It does not contain a corresponding ACPI match table. Moreover, AMD NAVI GPU based products are already in the commercial market hence going by this approach will break the functionalities for the same.

Quoted 6 lines

--
With Best Regards,
Andy Shevchenko

Thanks,
Sanket

#6 lore raw
Quoted 4 lines · Sanket
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Sanket
Quoted 1 line · Andy Shevchenko

On Tue, Mar 09, 2021 at 07:01:47PM +0530, Sanket Goswami wrote:

...

Quoted 6 lines
Quoted 1 line

And I think I already have told you that I prefer to see rather MODEL_ quirk.

I did not find MODEL_ quirk reference in the PCI device tree, It is actually used in platform device tree which is completely different from our PCI based configuration, can you please provide some reference of MODEL_ quirk which will be part of the PCI device tree?

I meant the name of new definition for quirk.

...

Quoted 11 lines
Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Also why (1) and this can't be instantiated from ACPI / DT?

It is in line with the existing PCIe-based DesignWare driver, A similar approach is used by the various vendors.

Here is no answer to the question. What prevents you to fix your ACPI tables or DT?

We already got rid of FIFO hard coded values, timings are harder to achieve, but we expect that new firmwares will provide values in the ACPI tables.

AMD NAVI GPU card is the PCI initiated driver, not ACPI initiated,

Which doesn't prevent to have an ACPI companion (via description in the tables).

Quoted 2 lines

and also
It does not contain a corresponding ACPI match table.

Yes, that's what should be done in the firmware.
At least for the new version of firmware consider to add proper data into the tables.

Quoted 3 lines

Moreover, AMD NAVI GPU
based products are already in the commercial market hence going by this approach will break the functionalities for the same.

This is quite bad and unfortunate. So, you have to elaborate this in the commit message.

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

Hi Andy,

Thanks for the review.

Quoted 10 lines · Andy Shevchenko

[CAUTION: External Email]

Quoted 4 lines · Sanket
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Sanket
Quoted 1 line · Andy Shevchenko

On Tue, Mar 09, 2021 at 07:01:47PM +0530, Sanket Goswami wrote:

...

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

And I think I already have told you that I prefer to see rather MODEL_ quirk.

I did not find MODEL_ quirk reference in the PCI device tree, It is actually used in platform device tree which is completely different from our PCI based configuration, can you please provide some reference of MODEL_ quirk which will be part of the PCI device tree?

I meant the name of new definition for quirk.

Can you please elaborate this? i am not able to comprehend.

Quoted 24 lines

...

Quoted 11 lines
Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Also why (1) and this can't be instantiated from ACPI / DT?

It is in line with the existing PCIe-based DesignWare driver, A similar approach is used by the various vendors.

Here is no answer to the question. What prevents you to fix your ACPI tables or DT?

We already got rid of FIFO hard coded values, timings are harder to achieve, but we expect that new firmwares will provide values in the ACPI tables.

AMD NAVI GPU card is the PCI initiated driver, not ACPI initiated,

Which doesn't prevent to have an ACPI companion (via description in the tables).

Quoted 2 lines

and also
It does not contain a corresponding ACPI match table.

Yes, that's what should be done in the firmware.
At least for the new version of firmware consider to add proper data into the tables.

Quoted 6 lines
Quoted 3 lines

Moreover, AMD NAVI GPU
based products are already in the commercial market hence going by this approach will break the functionalities for the same.

This is quite bad and unfortunate. So, you have to elaborate this in the commit message.

Sure, will take care of this as part of commit message of v3.

Quoted 6 lines

--
With Best Regards,
Andy Shevchenko

Thanks,
Sanket

#8 lore raw
Quoted 6 lines · Sanket
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Sanket
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Sanket
Quoted 1 line · Andy Shevchenko

On Tue, Mar 09, 2021 at 07:01:47PM +0530, Sanket Goswami wrote:

...

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

And I think I already have told you that I prefer to see rather MODEL_ quirk.

I did not find MODEL_ quirk reference in the PCI device tree, It is actually used in platform device tree which is completely different from our PCI based configuration, can you please provide some reference of MODEL_ quirk which will be part of the PCI device tree?

I meant the name of new definition for quirk.

Can you please elaborate this? i am not able to comprehend.

Define in the i2c-designware-core.h something like
#define MODEL_AMD_BLA_BLA_BLA BIT(FOO)

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw
In reply to Sanket Goswami
Thank you for the patch! Perhaps something to improve:

Hi Sanket,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on v5.12-rc2 next-20210309]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sanket-Goswami/i2c-add-i2c-bus-driver-for-amd-navi-gpu/20210309-213535
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: arm-randconfig-r033-20210308 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 820f508b08d7c94b2dd7847e9710d2bc36d3dd45)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/f1d0b9c128d45f6d55f3d3f864db2e7ebf42adc5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sanket-Goswami/i2c-add-i2c-bus-driver-for-amd-navi-gpu/20210309-213535 git checkout f1d0b9c128d45f6d55f3d3f864db2e7ebf42adc5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/i2c/busses/i2c-designware-master.c:899:5: warning: no previous prototype for function 'amd_i2c_adap_quirk' [-Wmissing-prototypes]
   int amd_i2c_adap_quirk(struct dw_i2c_dev *amdev)
       ^

drivers/i2c/busses/i2c-designware-master.c:899:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int amd_i2c_adap_quirk(struct dw_i2c_dev *amdev)
^
static
1 warning generated.

vim +/amd_i2c_adap_quirk +899 drivers/i2c/busses/i2c-designware-master.c

898

 > 899	int amd_i2c_adap_quirk(struct dw_i2c_dev *amdev)

900 {
901 struct i2c_adapter *amdap = &amdev->adapter;
902 int ret;
903
904 if (!(amdev->flags & AMD_NON_INTR_MODE))
905 return -ENODEV;
906
907 return i2c_add_numbered_adapter(amdap);
908
909 return ret;
910 }
911

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#10 lore raw
In reply to Sanket Goswami
Thank you for the patch! Perhaps something to improve:

Hi Sanket,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on v5.12-rc2 next-20210309]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sanket-Goswami/i2c-add-i2c-bus-driver-for-amd-navi-gpu/20210309-213535
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: riscv-randconfig-r003-20210309 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 820f508b08d7c94b2dd7847e9710d2bc36d3dd45)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/f1d0b9c128d45f6d55f3d3f864db2e7ebf42adc5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sanket-Goswami/i2c-add-i2c-bus-driver-for-amd-navi-gpu/20210309-213535 git checkout f1d0b9c128d45f6d55f3d3f864db2e7ebf42adc5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/i2c/busses/i2c-designware-master.c:899:5: warning: no previous prototype for function 'amd_i2c_adap_quirk' [-Wmissing-prototypes]
   int amd_i2c_adap_quirk(struct dw_i2c_dev *amdev)
       ^

drivers/i2c/busses/i2c-designware-master.c:899:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int amd_i2c_adap_quirk(struct dw_i2c_dev *amdev)
^
static
1 warning generated.

vim +/amd_i2c_adap_quirk +899 drivers/i2c/busses/i2c-designware-master.c

898

 > 899	int amd_i2c_adap_quirk(struct dw_i2c_dev *amdev)

900 {
901 struct i2c_adapter *amdap = &amdev->adapter;
902 int ret;
903
904 if (!(amdev->flags & AMD_NON_INTR_MODE))
905 return -ENODEV;
906
907 return i2c_add_numbered_adapter(amdap);
908
909 return ret;
910 }
911

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org