RE: [PATCH net-next v3 2/8] i2c: designware: Add driver support for Wangxun 10Gb NIC

Jiawen Wu
2023-04-20T10:54:11Z

> > --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> > +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
>
> > +static void dw_i2c_get_plat_data(struct dw_i2c_dev *dev)
> > +{
> > + struct platform_device *pdev = to_platform_device(dev->dev);
> > + struct dw_i2c_platform_data *pdata;
> > +
> > + pdata = dev_get_platdata(&pdev->dev);
> > + if (!pdata)
> > + return;
> > +
> > + dev->flags |= pdata->flags;
> > + dev->base = pdata->base;
> > +
> > + if (pdata->ss_hcnt && pdata->ss_lcnt) {
> > + dev->ss_hcnt = pdata->ss_hcnt;
> > + dev->ss_lcnt = pdata->ss_lcnt;
> > + } else {
> > + dev->ss_hcnt = 6;
> > + dev->ss_lcnt = 8;
> > + }
> > +
> > + if (pdata->fs_hcnt && pdata->fs_lcnt) {
> > + dev->fs_hcnt = pdata->fs_hcnt;
> > + dev->fs_lcnt = pdata->fs_lcnt;
> > + } else {
> > + dev->fs_hcnt = 6;
> > + dev->fs_lcnt = 8;
> > + }
> > +}
> > +
> > static const struct dmi_system_id dw_i2c_hwmon_class_dmi[] = {
> > {
> > .ident = "Qtechnology QT5222",
> > @@ -282,6 +314,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
> > dev->irq = irq;
> > platform_set_drvdata(pdev, dev);
> >
> > + dw_i2c_get_plat_data(dev);
> > +
> Instead of this added code would it be possible to use generic timing
> parameters which can come either from firmware or code? Those are
> handled already here by the call to i2c_parse_fw_timings().
>
> Then drivers/i2c/busses/i2c-designware-master.c:
> i2c_dw_set_timings_master() takes care of calculating Designware
> specific hcnt/lcnt timing parameters from those generic values.
>

I am confused about why fs_hcnt/fs_lcnt must be set when I use the
standard mode?