Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932865Ab3CLLZx (ORCPT ); Tue, 12 Mar 2013 07:25:53 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:53377 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755280Ab3CLLZu (ORCPT ); Tue, 12 Mar 2013 07:25:50 -0400 From: Roger Quadros To: CC: , , , , , , , Subject: [PATCH 8/8] USB: phy: nop: Defer probe if device needs VCC/RESET Date: Tue, 12 Mar 2013 13:24:26 +0200 Message-ID: <1363087466-32444-9-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1363087466-32444-1-git-send-email-rogerq@ti.com> References: <1363087466-32444-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2374 Lines: 71 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 Acked-by: Felipe Balbi --- drivers/usb/otg/nop-usb-xceiv.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index b26b1c2..2b10cc9 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c @@ -147,6 +147,8 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev) enum usb_phy_type type = USB_PHY_TYPE_USB2; int err; u32 clk_rate = 0; + bool needs_vcc = false; + bool needs_reset = false; nop = devm_kzalloc(&pdev->dev, sizeof(*nop), GFP_KERNEL); if (!nop) @@ -163,9 +165,14 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev) if (of_property_read_u32(node, "clock-frequency", &clk_rate)) clk_rate = 0; + needs_vcc = of_property_read_bool(node, "vcc-supply"); + needs_reset = of_property_read_bool(node, "reset-supply"); + } else if (pdata) { type = pdata->type; clk_rate = pdata->clk_rate; + needs_vcc = pdata->needs_vcc; + needs_reset = pdata->needs_reset; } nop->clk = devm_clk_get(&pdev->dev, "main_clk"); @@ -194,12 +201,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 (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 (needs_reset) + return -EPROBE_DEFER; } nop->dev = &pdev->dev; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/