All of lore.kernel.org
 help / color / mirror / Atom feed
From: kishon <kishon-l0cyMroinI0@public.gmane.org>
To: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	balbi-l0cyMroinI0@public.gmane.org,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 02/13] USB: phy: nop: Defer probe if device needs VCC/RESET
Date: Tue, 5 Feb 2013 11:24:29 +0530	[thread overview]
Message-ID: <51109E95.3000307@ti.com> (raw)
In-Reply-To: <1359993540-20780-3-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>

On Monday 04 February 2013 09:28 PM, Roger Quadros wrote:
> Add 2 flags, needs_vcc and needs_reset to platform data.
> If the flag is set and the regulator couldn't be found
> then we bail out with -EPROBE_DEFER.
>
> For device tree boot we depend on presensce of vcc-supply/
> reset-supply properties to decide if we should bail out
> with -EPROBE_DEFER or just continue in case the regulator
> can't be found.
>
> This is required for proper functionality in cases where the
> regulator is needed but is probed later than the PHY device.
>
> Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> ---
>   drivers/usb/otg/nop-usb-xceiv.c   |    8 ++++++++
>   include/linux/usb/nop-usb-xceiv.h |    4 ++++
>   2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
> index adbb7ab..7860e7569 100644
> --- a/drivers/usb/otg/nop-usb-xceiv.c
> +++ b/drivers/usb/otg/nop-usb-xceiv.c
> @@ -147,6 +147,10 @@ static void nop_xeiv_get_dt_pdata(struct device *dev,
>
>   	if (!of_property_read_u32(node, "clock-frequency", &clk_rate))
>   		pdata->clk_rate = clk_rate;
> +	if (of_property_read_bool(node, "vcc-supply"))
> +		pdata->needs_vcc = true;
This can be written as..
pdata->needs_vcc = of_property_read_bool(node, "vcc-supply");

> +	if (of_property_read_bool(node, "reset-supply"))
> +		pdata->needs_reset = true;
same here..
>   }
>
>   static int nop_usb_xceiv_probe(struct platform_device *pdev)
> @@ -205,12 +209,16 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
>   	if (IS_ERR(nop->vcc)) {
>   		dev_dbg(&pdev->dev, "Error getting vcc regulator: %ld\n",
>   					PTR_ERR(nop->vcc));
> +		if (pdata->needs_vcc)
> +			return -EPROBE_DEFER;
>   	}
>
>   	nop->reset = devm_regulator_get(&pdev->dev, "reset");
>   	if (IS_ERR(nop->reset)) {
>   		dev_dbg(&pdev->dev, "Error getting reset regulator: %ld\n",
>   					PTR_ERR(nop->reset));
> +		if (pdata->needs_reset)
> +			return -EPROBE_DEFER;
>   	}
>
>   	nop->dev		= &pdev->dev;
> diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h
> index 3265b61..148d351 100644
> --- a/include/linux/usb/nop-usb-xceiv.h
> +++ b/include/linux/usb/nop-usb-xceiv.h
> @@ -6,6 +6,10 @@
>   struct nop_usb_xceiv_platform_data {
>   	enum usb_phy_type type;
>   	unsigned long clk_rate;
> +
> +	/* if set fails with -EPROBE_DEFER if can't get regulator */
> +	unsigned int needs_vcc:1;
> +	unsigned int needs_reset:1;

how about u8 here?

Thanks
Kishon

WARNING: multiple messages have this Message-ID (diff)
From: kishon@ti.com (kishon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/13] USB: phy: nop: Defer probe if device needs VCC/RESET
Date: Tue, 5 Feb 2013 11:24:29 +0530	[thread overview]
Message-ID: <51109E95.3000307@ti.com> (raw)
In-Reply-To: <1359993540-20780-3-git-send-email-rogerq@ti.com>

On Monday 04 February 2013 09:28 PM, Roger Quadros wrote:
> Add 2 flags, needs_vcc and needs_reset to platform data.
> If the flag is set and the regulator couldn't be found
> then we bail out with -EPROBE_DEFER.
>
> For device tree boot we depend on presensce of vcc-supply/
> reset-supply properties to decide if we should bail out
> with -EPROBE_DEFER or just continue in case the regulator
> can't be found.
>
> This is required for proper functionality in cases where the
> regulator is needed but is probed later than the PHY device.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>   drivers/usb/otg/nop-usb-xceiv.c   |    8 ++++++++
>   include/linux/usb/nop-usb-xceiv.h |    4 ++++
>   2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
> index adbb7ab..7860e7569 100644
> --- a/drivers/usb/otg/nop-usb-xceiv.c
> +++ b/drivers/usb/otg/nop-usb-xceiv.c
> @@ -147,6 +147,10 @@ static void nop_xeiv_get_dt_pdata(struct device *dev,
>
>   	if (!of_property_read_u32(node, "clock-frequency", &clk_rate))
>   		pdata->clk_rate = clk_rate;
> +	if (of_property_read_bool(node, "vcc-supply"))
> +		pdata->needs_vcc = true;
This can be written as..
pdata->needs_vcc = of_property_read_bool(node, "vcc-supply");

> +	if (of_property_read_bool(node, "reset-supply"))
> +		pdata->needs_reset = true;
same here..
>   }
>
>   static int nop_usb_xceiv_probe(struct platform_device *pdev)
> @@ -205,12 +209,16 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
>   	if (IS_ERR(nop->vcc)) {
>   		dev_dbg(&pdev->dev, "Error getting vcc regulator: %ld\n",
>   					PTR_ERR(nop->vcc));
> +		if (pdata->needs_vcc)
> +			return -EPROBE_DEFER;
>   	}
>
>   	nop->reset = devm_regulator_get(&pdev->dev, "reset");
>   	if (IS_ERR(nop->reset)) {
>   		dev_dbg(&pdev->dev, "Error getting reset regulator: %ld\n",
>   					PTR_ERR(nop->reset));
> +		if (pdata->needs_reset)
> +			return -EPROBE_DEFER;
>   	}
>
>   	nop->dev		= &pdev->dev;
> diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h
> index 3265b61..148d351 100644
> --- a/include/linux/usb/nop-usb-xceiv.h
> +++ b/include/linux/usb/nop-usb-xceiv.h
> @@ -6,6 +6,10 @@
>   struct nop_usb_xceiv_platform_data {
>   	enum usb_phy_type type;
>   	unsigned long clk_rate;
> +
> +	/* if set fails with -EPROBE_DEFER if can't get regulator */
> +	unsigned int needs_vcc:1;
> +	unsigned int needs_reset:1;

how about u8 here?

Thanks
Kishon

  parent reply	other threads:[~2013-02-05  5:54 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 15:58 [PATCH 00/13] Device tree support for OMAP HS USB Host Roger Quadros
2013-02-04 15:58 ` Roger Quadros
2013-02-04 15:58 ` [PATCH 01/13] usb: phy: nop: Add device tree support and binding information Roger Quadros
2013-02-04 15:58   ` Roger Quadros
2013-02-05  7:26   ` Felipe Balbi
2013-02-05  7:26     ` Felipe Balbi
2013-02-05  8:30     ` Roger Quadros
2013-02-05  8:30       ` Roger Quadros
     [not found]       ` <5110C339.7080109-l0cyMroinI0@public.gmane.org>
2013-02-05  9:07         ` Felipe Balbi
2013-02-05  9:07           ` Felipe Balbi
     [not found]     ` <20130205072637.GA32118-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2013-03-11 15:52       ` Marc Kleine-Budde
2013-03-11 15:52         ` Marc Kleine-Budde
     [not found]         ` <513DFDD7.7000801-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-12  9:09           ` Roger Quadros
2013-03-12  9:09             ` Roger Quadros
2013-03-08 10:46   ` Marc Kleine-Budde
2013-03-08 10:46     ` Marc Kleine-Budde
2013-03-08 15:04     ` Roger Quadros
2013-03-08 15:04       ` Roger Quadros
     [not found]     ` <5139C174.7030401-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-08 15:45       ` Marc Kleine-Budde
2013-03-08 15:45         ` Marc Kleine-Budde
     [not found]         ` <513A079A.1020106-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-11  8:40           ` Roger Quadros
2013-03-11  8:40             ` Roger Quadros
2013-03-11 15:53             ` Marc Kleine-Budde
2013-03-11 15:53               ` Marc Kleine-Budde
     [not found] ` <1359993540-20780-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-02-04 15:58   ` [PATCH 02/13] USB: phy: nop: Defer probe if device needs VCC/RESET Roger Quadros
2013-02-04 15:58     ` Roger Quadros
     [not found]     ` <1359993540-20780-3-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-02-05  5:54       ` kishon [this message]
2013-02-05  5:54         ` kishon
2013-02-05  8:44         ` Roger Quadros
2013-02-05  8:44           ` Roger Quadros
2013-02-05  9:09           ` Felipe Balbi
2013-02-05  9:09             ` Felipe Balbi
2013-02-05  9:43             ` Roger Quadros
2013-02-05  9:43               ` Roger Quadros
     [not found]               ` <5110D45A.3040007-l0cyMroinI0@public.gmane.org>
2013-03-11 15:58                 ` Marc Kleine-Budde
2013-03-11 15:58                   ` Marc Kleine-Budde
2013-03-12  9:10                   ` Roger Quadros
2013-03-12  9:10                     ` Roger Quadros
2013-02-04 15:58   ` [PATCH 03/13] mfd: omap-usb-tll: move configuration code to omap_tll_init() Roger Quadros
2013-02-04 15:58     ` Roger Quadros
2013-02-04 15:58   ` [PATCH 04/13] mfd: omap-usb-tll: Add device tree support Roger Quadros
2013-02-04 15:58     ` Roger Quadros
2013-02-05  6:04     ` kishon
2013-02-05  6:04       ` kishon
     [not found]       ` <5110A0DF.7050609-l0cyMroinI0@public.gmane.org>
2013-02-05  8:46         ` Roger Quadros
2013-02-05  8:46           ` Roger Quadros
2013-02-04 15:58   ` [PATCH 09/13] mfd: omap-usb-host: Add device tree support and binding information Roger Quadros
2013-02-04 15:58     ` Roger Quadros
     [not found]     ` <1359993540-20780-10-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-02-05  6:16       ` kishon
2013-02-05  6:16         ` kishon
     [not found]         ` <5110A3C6.6040808-l0cyMroinI0@public.gmane.org>
2013-02-05  8:50           ` Roger Quadros
2013-02-05  8:50             ` Roger Quadros
2013-02-05 10:58           ` Roger Quadros
2013-02-05 10:58             ` Roger Quadros
     [not found]             ` <5110E5C4.1000501-l0cyMroinI0@public.gmane.org>
2013-02-05 12:11               ` kishon
2013-02-05 12:11                 ` kishon
2013-02-05 12:27                 ` Roger Quadros
2013-02-05 12:27                   ` Roger Quadros
2013-02-05 14:20       ` Mark Rutland
2013-02-05 14:20         ` Mark Rutland
2013-02-05 14:42         ` Roger Quadros
2013-02-05 14:42           ` Roger Quadros
2013-02-05 16:11           ` Mark Rutland
2013-02-05 16:11             ` Mark Rutland
     [not found]             ` <20130205161141.GD26842-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2013-02-06  8:56               ` Roger Quadros
2013-02-06  8:56                 ` Roger Quadros
2013-02-04 15:59   ` [PATCH 13/13] ARM: dts: omap3-beagle: Add USB Host support Roger Quadros
2013-02-04 15:59     ` Roger Quadros
2013-02-04 15:58 ` [PATCH 05/13] USB: ehci-omap: Get platform resources by index rather than by name Roger Quadros
2013-02-04 15:58   ` Roger Quadros
2013-02-04 21:12   ` Alan Stern
2013-02-04 21:12     ` Alan Stern
2013-02-04 15:58 ` [PATCH 06/13] USB: ohci-omap3: " Roger Quadros
2013-02-04 15:58   ` Roger Quadros
2013-02-04 21:12   ` Alan Stern
2013-02-04 21:12     ` Alan Stern
2013-02-04 15:58 ` [PATCH 07/13] USB: ohci-omap3: Add device tree support and binding information Roger Quadros
2013-02-04 15:58   ` Roger Quadros
     [not found]   ` <1359993540-20780-8-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-02-04 21:14     ` Alan Stern
2013-02-04 21:14       ` Alan Stern
2013-02-04 15:58 ` [PATCH 08/13] USB: ehci-omap: " Roger Quadros
2013-02-04 15:58   ` Roger Quadros
2013-02-04 21:15   ` Alan Stern
2013-02-04 21:15     ` Alan Stern
2013-02-05 12:33   ` Mark Rutland
2013-02-05 12:33     ` Mark Rutland
     [not found]     ` <20130205123346.GB26842-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2013-02-05 12:46       ` Roger Quadros
2013-02-05 12:46         ` Roger Quadros
2013-02-04 15:58 ` [PATCH 10/13] ARM: dts: OMAP4: Add HS USB Host IP nodes Roger Quadros
2013-02-04 15:58   ` Roger Quadros
     [not found]   ` <1359993540-20780-11-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-02-05  6:24     ` kishon
2013-02-05  6:24       ` kishon
2013-02-05  8:54       ` Roger Quadros
2013-02-05  8:54         ` Roger Quadros
     [not found]         ` <5110C8CE.2020606-l0cyMroinI0@public.gmane.org>
2013-02-05  8:57           ` kishon
2013-02-05  8:57             ` kishon
2013-02-05  7:41   ` Felipe Balbi
2013-02-05  7:41     ` Felipe Balbi
2013-02-05  8:57     ` Roger Quadros
2013-02-05  8:57       ` Roger Quadros
2013-02-04 15:58 ` [PATCH 11/13] ARM: dts: omap4-panda: Add USB Host support Roger Quadros
2013-02-04 15:58   ` Roger Quadros
     [not found]   ` <1359993540-20780-12-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-02-05  9:34     ` how to specify an OMAP clock in device tree? Roger Quadros
     [not found]       ` <5110D229.1000808-l0cyMroinI0@public.gmane.org>
2013-02-05 11:15         ` Rajendra Nayak
2013-02-05 11:15           ` Rajendra Nayak
2013-02-05 13:46           ` Roger Quadros
2013-02-05 13:46             ` Roger Quadros
     [not found]             ` <51110D4B.50904-l0cyMroinI0@public.gmane.org>
2013-02-05 14:13               ` Rajendra Nayak
2013-02-05 14:13                 ` Rajendra Nayak
2013-02-05 14:18                 ` Roger Quadros
2013-02-05 14:18                   ` Roger Quadros
2013-02-05 14:21                   ` Rajendra Nayak
2013-02-05 14:21                     ` Rajendra Nayak
2013-02-05 14:29                     ` Roger Quadros
2013-02-05 14:29                       ` Roger Quadros
     [not found]                       ` <51111739.2050805-l0cyMroinI0@public.gmane.org>
2013-02-05 14:36                         ` Rajendra Nayak
2013-02-05 14:36                           ` Rajendra Nayak
2013-02-05 14:52                           ` Roger Quadros
2013-02-05 14:52                             ` Roger Quadros
2013-02-06 10:21                             ` Rajendra Nayak
2013-02-06 10:21                               ` Rajendra Nayak
     [not found]                               ` <51122EC0.3040804-l0cyMroinI0@public.gmane.org>
2013-02-06 10:39                                 ` Roger Quadros
2013-02-06 10:39                                   ` Roger Quadros
2013-02-04 15:58 ` [PATCH 12/13] ARM: dts: OMAP3: Add HS USB Host IP nodes Roger Quadros
2013-02-04 15:58   ` Roger Quadros
2013-02-05 11:25 ` [PATCH 00/13] Device tree support for OMAP HS USB Host Rajendra Nayak
2013-02-05 11:25   ` Rajendra Nayak
     [not found]   ` <5110EC0D.40609-l0cyMroinI0@public.gmane.org>
2013-02-05 11:32     ` Roger Quadros
2013-02-05 11:32       ` Roger Quadros

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=51109E95.3000307@ti.com \
    --to=kishon-l0cymroini0@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rogerq-l0cyMroinI0@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.