Subject: Re: [RFC PATCH net-next v6 2/9] i2c: designware: Add driver support for Wangxun 10Gb NIC

From: [email-masked]
Date: Fri, 5 May 2023 21:48:01 +0300

Fri, May 05, 2023 at 03:42:21PM +0800, Jiawen Wu kirjoitti:
> Wangxun 10Gb ethernet chip is connected to Designware I2C, to communicate
> with SFP.
> 
> Introduce the property "wx,i2c-snps-model" to match device data for Wangxun
> in software node case. Since IO resource was mapped on the ethernet driver,
> add a model quirk to get regmap from parent device.
> 
> The exists IP limitations are dealt as workarounds:
> - IP does not support interrupt mode, it works on polling mode.
> - Additionally set FIFO depth address the chip issue.

Thank you, almost there!

...

> +static int txgbe_i2c_request_regs(struct dw_i2c_dev *dev)
> +{

> +	struct platform_device *pdev = to_platform_device(dev->dev);
> +
> +	dev->map = dev_get_regmap(pdev->dev.parent, NULL);

No need to jump to a platform device.

	dev->map = dev_get_regmap(dev->dev.parent, NULL);

should suffice.

> +	if (!dev->map)
> +		return -ENODEV;
> +
> +	return 0;
> +}

...

>  	dev->flags = (uintptr_t)device_get_match_data(&pdev->dev);
> +	device_property_read_u32(&pdev->dev, "wx,i2c-snps-model", &dev->flags);

I believe in your case it should be named something like
"linux,i2c-synopsys-platform". But in any case this I leave
to the more experienced people.

Also I'm not sure this proprty should have a proority over
driver data.

-- 
With Best Regards,
Andy Shevchenko