mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Pavel Pisa <pisa@cmp.felk.cvut.cz>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
	Rostislav Lisovy <lisovy@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/3] ARM: i.mx53: Parse Reset GPIO pin in FEC driver from Devicetree
Date: Tue, 5 Nov 2013 20:11:05 +0100	[thread overview]
Message-ID: <201311052011.05133.pisa@cmp.felk.cvut.cz> (raw)
In-Reply-To: <20131105161516.GI26639@ns203013.ovh.net>

Hello Jean-Christophe and Rosta,

On Tuesday 05 of November 2013 17:15:16 Jean-Christophe PLAGNIOL-VILLARD 
wrote:
> On 15:42 Tue 05 Nov     , Rostislav Lisovy wrote:
> > Signed-off-by: Rostislav Lisovy <lisovy@gmail.com>
> >
> > diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> > index 2f31352..6f883bf 100644
> > --- a/drivers/net/fec_imx.c
> > +++ b/drivers/net/fec_imx.c
> > @@ -671,6 +676,22 @@ static int fec_probe(struct device_d *dev)
> >
> >  	fec->regs = dev_request_mem_region(dev, 0);
> >
> > +#ifdef CONFIG_OFDEVICE
>
> use if (IS_ENABLED(CONFIG_OFDEVICE))
>
> so we can improve the code coverage
>
> > +	phy_reset = of_get_named_gpio(dev->device_node, "phy-reset-gpios", 0);

I have question if the missing definition of reset pin should/must lead
to whole ethernet interface removal/initialization abort.

I think, that there can be design where PHY reset is not controlled
by MCU pin (it is usually possible even reset device through MDIO)
and then it would be better to check if "phy-reset-gpios" is present
and if not then skip whole attempt to manipulate GPIO.
On the other hand if "phy-reset-gpios", it is required to configure it,
because default pin state can/should lead to PHY reset.

I.e.

if (IS_ENABLED(CONFIG_OFDEVICE))

  phy_reset = of_get_named_gpio(dev->device_node, "phy-reset-gpios", 0);

  if(phy_reset < 0) {
    print info ("\"phy-reset-gpios\" is not used for i.MX fec, skipping forced 
reset\n")
    
  } else {

> > +	if (!gpio_is_valid(phy_reset))
> > +		goto err_free;
> > +
> > +	ret = gpio_request(phy_reset, "phy-reset");
> > +	if (ret) {
> > +		pr_err("Can not request gpio %d (phy-reset): %d\n", phy_reset, ret);
> > +		goto err_free;
> > +	}
> > +
> > +	gpio_direction_output(phy_reset, 0);
>
> you need to check the return too
>
> > +	udelay(10);
> > +	gpio_set_value(phy_reset, 1);
  }
}
> > +
> >  	/* Reset chip. */
> >  	writel(FEC_ECNTRL_RESET, fec->regs + FEC_ECNTRL);
> >  	while(readl(fec->regs + FEC_ECNTRL) & 1) {

Best wishes,


                 Pavel


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-11-05 19:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 14:42 [PATCH 0/3] Support for Voipac X53-DMM-668 module and Voipac Baseboard Rostislav Lisovy
2013-11-05 14:42 ` [PATCH 1/3] ARM: dts: i.mx53: Internal keyboard controller + i2c pinmux Rostislav Lisovy
2013-11-05 14:42 ` [PATCH 2/3] ARM: i.mx53: Parse Reset GPIO pin in FEC driver from Devicetree Rostislav Lisovy
2013-11-05 16:15   ` Jean-Christophe PLAGNIOL-VILLARD
2013-11-05 19:11     ` Pavel Pisa [this message]
2013-11-06  8:39       ` Sascha Hauer
2013-11-05 14:42 ` [PATCH 3/3] ARM: i.mx53: Support for Voipac board. Device definition is read " Rostislav Lisovy
2013-11-08  8:42   ` Sascha Hauer
2013-11-09 22:14     ` Rostislav Lisovy
2013-11-11  9:54       ` Sascha Hauer
2013-11-12 22:57         ` Rostislav Lisovy
2013-11-12 22:46 [PATCH 0/3 v2] Support for Voipac X53-DMM-668 module and Voipac Baseboard Rostislav Lisovy
2013-11-12 22:46 ` [PATCH 2/3] ARM: i.mx53: Parse Reset GPIO pin in FEC driver from Devicetree Rostislav Lisovy
2013-11-13 10:35   ` Sascha Hauer
2013-11-20 21:22 [PATCH 0/3 v3] Support for Voipac X53-DMM-668 module and Voipac Baseboard Rostislav Lisovy
2013-11-20 21:22 ` [PATCH 2/3] ARM: i.mx53: Parse Reset GPIO pin in FEC driver from Devicetree Rostislav Lisovy
2013-11-22  7:09   ` Sascha Hauer
2013-11-22  9:34     ` Alexander Shiyan

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=201311052011.05133.pisa@cmp.felk.cvut.cz \
    --to=pisa@cmp.felk.cvut.cz \
    --cc=barebox@lists.infradead.org \
    --cc=lisovy@gmail.com \
    --cc=plagnioj@jcrosoft.com \
    /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