linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jiawen Wu" <jiawenwu@trustnetic.com>
To: <andy.shevchenko@gmail.com>
Cc: <netdev@vger.kernel.org>, <jarkko.nikula@linux.intel.com>,
	<andriy.shevchenko@linux.intel.com>,
	<mika.westerberg@linux.intel.com>, <jsd@semihalf.com>,
	<andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
	<linux-i2c@vger.kernel.org>, <linux-gpio@vger.kernel.org>,
	<mengyuanlou@net-swift.com>
Subject: RE: [RFC PATCH net-next v5 2/9] i2c: designware: Add driver support for Wangxun 10Gb NIC
Date: Thu, 27 Apr 2023 10:15:10 +0800	[thread overview]
Message-ID: <013a01d978ae$182104c0$48630e40$@trustnetic.com> (raw)
In-Reply-To: <ZElCHGho-szyySGC@surfacebook>

On Wednesday, April 26, 2023 11:45 PM, andy.shevchenko@gmail.com wrote:
> Wed, Apr 26, 2023 at 03:14:27PM +0800, Jiawen Wu kirjoitti:
> > Wangxun 10Gb ethernet chip is connected to Designware I2C, to communicate
> > with SFP.
> >
> > Introduce the property "i2c-dw-flags" to match device data for software
> > node case. Since IO resource was mapped on the ethernet driver, add a model
> > quirk to get resource from platform info.
> >
> > 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.
> 
> Thanks for an update, my comments below.
> 
> ...
> 
> >  		goto done_nolock;
> >  	}
> >
> > +	if ((dev->flags & MODEL_MASK) == MODEL_WANGXUN_SP) {
> > +		ret = txgbe_i2c_dw_xfer_quirk(adap, msgs, num);
> > +		goto done_nolock;
> > +	}
> 
> 	switch (dev->flags & MODEL_MASK) {
> 	case AMD:
> 		...
> 	case WANGXUN:
> 		...
> 	default:
> 		break;
> 	}
> 
> ...
> 
> > +static int txgbe_i2c_request_regs(struct dw_i2c_dev *dev)
> > +{
> > +	struct platform_device *pdev = to_platform_device(dev->dev);
> > +	struct resource *r;
> > +
> > +	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +	if (!r)
> > +		return -ENODEV;
> > +
> > +	dev->base = devm_ioremap(&pdev->dev, r->start, resource_size(r));
> > +
> > +	return PTR_ERR_OR_ZERO(dev->base);
> > +}
> 
> Redundant. See below.
> 
> ...
> 
> >  	case MODEL_BAIKAL_BT1:
> >  		ret = bt1_i2c_request_regs(dev);
> >  		break;
> > +	case MODEL_WANGXUN_SP:
> > +		ret = txgbe_i2c_request_regs(dev);
> 
> How is it different to...
> 
> > +		break;
> >  	default:
> >  		dev->base = devm_platform_ioremap_resource(pdev, 0);
> 
> ...this one?
> 

devm_platform_ioremap_resource() has one more devm_request_mem_region()
operation than devm_ioremap(). By my test, this memory cannot be re-requested,
only re-mapped.

> ...
> 
> >  	dev->flags = (uintptr_t)device_get_match_data(&pdev->dev);
> 
> > +	if (!dev->flags)
> 
> No need to check this. Just define priorities (I would go with above to be
> higher priority).
> 
> > +		device_property_read_u32(&pdev->dev, "i2c-dw-flags", &dev->flags);
> 
> Needs to be added to the Device Tree bindings I believe.
> 
> But wait, don't we have other ways to detect your hardware at probe time and
> initialize flags respectively?
> 

I2C is connected to our NIC chip with no PCI ID, so I register a platform device for it.
Please see the 4/9 patch. Software nodes are used to pass the device structure but
no DT and ACPI. I haven't found another way to initialize flags yet, other than the
platform data used in the previous patch (it seems to be an obsolete way).

> --
> With Best Regards,
> Andy Shevchenko
> 
> 
> 


  reply	other threads:[~2023-04-27  2:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26  7:14 [RFC PATCH net-next v5 0/9] TXGBE PHYLINK support Jiawen Wu
2023-04-26  7:14 ` [RFC PATCH net-next v5 1/9] net: txgbe: Add software nodes to support phylink Jiawen Wu
2023-04-28 20:47   ` Simon Horman
2023-04-26  7:14 ` [RFC PATCH net-next v5 2/9] i2c: designware: Add driver support for Wangxun 10Gb NIC Jiawen Wu
2023-04-26 15:45   ` andy.shevchenko
2023-04-27  2:15     ` Jiawen Wu [this message]
2023-04-27  5:57       ` Andy Shevchenko
2023-04-27  6:56         ` Jiawen Wu
2023-04-27 10:42           ` Andy Shevchenko
2023-04-27  7:25         ` Jiawen Wu
2023-04-26  7:14 ` [RFC PATCH net-next v5 3/9] net: txgbe: Register fixed rate clock Jiawen Wu
2023-04-26  7:14 ` [RFC PATCH net-next v5 4/9] net: txgbe: Register I2C platform device Jiawen Wu
2023-04-26 16:19   ` andy.shevchenko
2023-04-26  7:14 ` [RFC PATCH net-next v5 5/9] net: txgbe: Add SFP module identify Jiawen Wu
2023-04-26  7:14 ` [RFC PATCH net-next v5 6/9] net: txgbe: Support GPIO to SFP socket Jiawen Wu
2023-04-26  7:14 ` [RFC PATCH net-next v5 7/9] net: pcs: Add 10GBASE-R mode for Synopsys Designware XPCS Jiawen Wu
2023-05-02  8:03   ` Russell King (Oracle)
2023-04-26  7:14 ` [RFC PATCH net-next v5 8/9] net: txgbe: Implement phylink pcs Jiawen Wu
2023-04-26  7:14 ` [RFC PATCH net-next v5 9/9] net: txgbe: Support phylink MAC layer Jiawen Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='013a01d978ae$182104c0$48630e40$@trustnetic.com' \
    --to=jiawenwu@trustnetic.com \
    --cc=andrew@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jsd@semihalf.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mengyuanlou@net-swift.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).