[PATCH 5/6] net: Add driver for Armada 370/XP 10/100/1000 Mbps network controller

Ezequiel Garcia ezequiel.garcia at free-electrons.com
Thu Jul 31 06:43:39 PDT 2014


On 31 Jul 07:42 AM, Sascha Hauer wrote:
> On Tue, Jul 29, 2014 at 05:45:00PM -0300, Ezequiel Garcia wrote:
> > +
> > +static int mvneta_probe(struct device_d *dev)
> > +{
> > +	struct mvneta_port *priv;
> > +	int ret;
> > +
> > +	priv = xzalloc(sizeof(*priv));
> > +
> > +	priv->reg = dev_get_mem_region(dev, 0);
> 
> Any special reason to use dev_get_mem_region() here? Normally you should
> use dev_request_mem_region() which allocates the resource for exclusive
> use. dev_get_mem_region() should only be used in very special cases.
> 

Yes, there's a reason for it. The ethernet unit on these SoCs have a register
for the MDIO. Since it's the same for Kirkwood, Armada 370/XP and Armada 375,
the MDIO is handled by a different driver (mvmdio), so it can be shared among
the ethernet drivers.

This comes with a little price, though: we can't request the region on either
mvmdio or the ethernet driver, for the former is within the latter.

> Please check the return value.
> 

Sure, I will.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com



More information about the barebox mailing list