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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > +++ 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;
+       }
+}






[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux