devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
To: Zubair Lutfullah Kakakhel
	<Zubair.Kakakhel-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org
Subject: Re: [PATCH_V3] dm9000: Add regulator and reset support to dm9000
Date: Tue, 06 Jan 2015 15:57:02 +0300	[thread overview]
Message-ID: <54ABDB9E.3070400@cogentembedded.com> (raw)
In-Reply-To: <1420542916-30169-1-git-send-email-Zubair.Kakakhel-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>

Hello.

On 1/6/2015 2:15 PM, Zubair Lutfullah Kakakhel wrote:

> In boards, the dm9000 chip's power and reset can be controlled by gpio.

> It makes sense to add them to the dm9000 driver and let dt be used to
> enable power and reset the phy.

> Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Paul Burton <paul.burton-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>

[...]

> diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
> index ef0bb58..246c89d 100644
> --- a/drivers/net/ethernet/davicom/dm9000.c
> +++ b/drivers/net/ethernet/davicom/dm9000.c
[...]
> @@ -1426,11 +1429,49 @@ dm9000_probe(struct platform_device *pdev)
>   	struct dm9000_plat_data *pdata = dev_get_platdata(&pdev->dev);
>   	struct board_info *db;	/* Point a board information structure */
>   	struct net_device *ndev;
> +	struct device *dev = &pdev->dev;
>   	const unsigned char *mac_src;
>   	int ret = 0;
>   	int iosize;
>   	int i;
>   	u32 id_val;
> +	int reset_gpios;
> +	enum of_gpio_flags flags;
> +	struct regulator *power;
> +
> +	power = devm_regulator_get(dev, "vcc");
> +	if (PTR_ERR(power) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;

    Line over-indented.

[...]
> +	reset_gpios = of_get_named_gpio_flags(dev->of_node, "reset-gpios", 0,
> +					      &flags);
> +	if (gpio_is_valid(reset_gpios)) {
> +		ret = devm_gpio_request_one(dev, reset_gpios, flags,
> +					    "dm9000_reset");
> +		if (ret) {
> +			dev_err(dev, "failed to request reset gpio %d: %d\n",
> +				reset_gpios, ret);
> +			return -ENODEV;
> +		}
> +
> +		gpio_direction_output(reset_gpios, 0);

    You could skip this call as devm_gpio_request_one() can handle that for you.

[...]

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2015-01-06 12:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-06 11:15 [PATCH_V3] dm9000: Add regulator and reset support to dm9000 Zubair Lutfullah Kakakhel
     [not found] ` <1420542916-30169-1-git-send-email-Zubair.Kakakhel-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-01-06 12:57   ` Sergei Shtylyov [this message]

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=54ABDB9E.3070400@cogentembedded.com \
    --to=sergei.shtylyov-m4dtvfq/zs1mrggop+s0pdbpr1lh4cv8@public.gmane.org \
    --cc=Zubair.Kakakhel-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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).