[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <003801d97655$f2dc4580$d894d080$@trustnetic.com>
Date: Mon, 24 Apr 2023 10:39:10 +0800
From: Jiawen Wu <jiawenwu@...stnetic.com>
To: "'Andy Shevchenko'" <andriy.shevchenko@...ux.intel.com>,
<jarkko.nikula@...ux.intel.com>
Cc: <netdev@...r.kernel.org>, <andrew@...n.ch>,
<linux@...linux.org.uk>, <olteanv@...il.com>,
<hkallweit1@...il.com>, <linux-i2c@...r.kernel.org>,
<linux-gpio@...r.kernel.org>, <mengyuanlou@...-swift.com>
Subject: RE: [PATCH net-next v4 2/8] i2c: designware: Add driver support for Wangxun 10Gb NIC
> > +++ b/include/linux/platform_data/i2c-dw.h
>
> No way we need this in a new code.
>
> > +struct dw_i2c_platform_data {
> > + void __iomem *base;
>
> You should use regmap.
>
> > + unsigned int flags;
> > + unsigned int ss_hcnt;
> > + unsigned int ss_lcnt;
> > + unsigned int fs_hcnt;
> > + unsigned int fs_lcnt;
>
> No, use device properties.
>
> > +};
>
> --
> With Best Regards,
> Andy Shevchenko
>
Is it acceptable to add such a function into dw_i2c_plat_probe()?
Otherwise I really can't find a way to get these parameters without DT and ACPI.
+static void i2c_dw_parse_property(struct dw_i2c_dev *dev)
+{
+ if (!is_software_node(dev_fwnode(dev->dev)))
+ return;
+
+ if (!dev->flags)
+ device_property_read_u32(dev->dev, "dw-i2c-flags", &dev->flags);
+
+ device_property_read_u16(dev->dev, "i2c-ss-scl-hcnt", &dev->ss_hcnt);
+ device_property_read_u16(dev->dev, "i2c-ss-scl-lcnt", &dev->ss_lcnt);
+ device_property_read_u16(dev->dev, "i2c-fs-scl-hcnt", &dev->fs_hcnt);
+ device_property_read_u16(dev->dev, "i2c-fs-scl-lcnt", &dev->fs_lcnt);
+
+ if (!dev->ss_hcnt || !dev->ss_lcnt) {
+ dev->ss_hcnt = 6;
+ dev->ss_lcnt = 8;
+ }
+ if (!dev->fs_hcnt || !dev->fs_lcnt) {
+ dev->fs_hcnt = 6;
+ dev->fs_lcnt = 8;
+ }
+}
Powered by blists - more mailing lists