From patchwork Wed Apr 3 08:45:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 15839 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7B01623E21 for ; Wed, 3 Apr 2013 08:47:23 +0000 (UTC) Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by fiordland.canonical.com (Postfix) with ESMTP id 1CD4AA18484 for ; Wed, 3 Apr 2013 08:47:23 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id o13sf2101938qaj.8 for ; Wed, 03 Apr 2013 01:47:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=r02iUiD7/N5vaZD4UDk36jSb9I9qPDAqjQrMKJDWbIY=; b=XBrpSp5gfmQtTsdJTiyaf7hQuTibS229/OIy4Tu+UEhru9m12vyeQrc4UZRqNyZfHl OiYKpbGMQ4BkXocH40F+hy1br715oKFTobIZYJIQDJDAgynDTlxzFdzOkw/MrS3fHAF+ aZm1b2Gnv2Wgyjv0bIhBUvJberCF9BcWMcXxAM0S94bHogVBv2nxuMVh/xZMX+meMTkM 7unA//VSUS8jO0tP9sx+HPF1/0TFW/q/wJQPdrFBDOf7U1Pljbfyi+l+j0LD7WAnJZFH QiYK8o35L0tldlPGn+BQS/S1WzHKyioMsNO2hG+JlIjVKUVFByI6rxS7Nt+IjURCLoRC csBA== X-Received: by 10.224.18.132 with SMTP id w4mr706619qaa.1.1364978842663; Wed, 03 Apr 2013 01:47:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.47.113 with SMTP id c17ls838227qen.0.gmail; Wed, 03 Apr 2013 01:47:22 -0700 (PDT) X-Received: by 10.52.70.108 with SMTP id l12mr441467vdu.40.1364978842443; Wed, 03 Apr 2013 01:47:22 -0700 (PDT) Received: from mail-vb0-x230.google.com (mail-vb0-x230.google.com [2607:f8b0:400c:c02::230]) by mx.google.com with ESMTPS id a6si4247183vcx.84.2013.04.03.01.47.22 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 01:47:22 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::230; Received: by mail-vb0-f48.google.com with SMTP id p13so261652vbe.35 for ; Wed, 03 Apr 2013 01:47:22 -0700 (PDT) X-Received: by 10.58.29.101 with SMTP id j5mr516493veh.26.1364978842303; Wed, 03 Apr 2013 01:47:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.4.204 with SMTP id cg12csp160627ved; Wed, 3 Apr 2013 01:47:21 -0700 (PDT) X-Received: by 10.14.207.200 with SMTP id n48mr1963226eeo.4.1364978840499; Wed, 03 Apr 2013 01:47:20 -0700 (PDT) Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by mx.google.com with ESMTPS id d42si7605627eep.62.2013.04.03.01.47.20 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 01:47:20 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.43 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=74.125.83.43; Received: by mail-ee0-f43.google.com with SMTP id e50so583091eek.16 for ; Wed, 03 Apr 2013 01:47:20 -0700 (PDT) X-Received: by 10.14.200.137 with SMTP id z9mr1852290een.20.1364978839914; Wed, 03 Apr 2013 01:47:19 -0700 (PDT) Received: from localhost ([2a01:2003:1:1e91:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id s3sm6908188eem.4.2013.04.03.01.47.13 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Apr 2013 01:47:19 -0700 (PDT) From: Fabio Baltieri To: Felipe Balbi Cc: Linus Walleij , Praveena Nadahally , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Fabio Baltieri Subject: [PATCH 05/12] usb: phy: ab8500-usb: add regulator support Date: Wed, 3 Apr 2013 10:45:06 +0200 Message-Id: <1364978713-19612-6-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1364978713-19612-1-git-send-email-fabio.baltieri@linaro.org> References: <1364978713-19612-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQlJZSziFYQmCAE7JntaIP5n/Wfo176CXsENJ+usfM9ZJJ4qDIZsRnMPY0UYPNXkZQAGztF2 X-Original-Sender: fabio.baltieri@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add initial regulator support to ab8500-usb by introducing necessary devm_regulator_get(). Acked-by: Linus Walleij Signed-off-by: Fabio Baltieri --- drivers/usb/phy/phy-ab8500-usb.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 1fd0780..4caa820 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c @@ -32,6 +32,7 @@ #include #include #include +#include /* Bank AB8500_SYS_CTRL2_BLOCK */ #define AB8500_MAIN_WD_CTRL_REG 0x01 @@ -126,6 +127,9 @@ struct ab8500_usb { struct work_struct phy_dis_work; unsigned long link_status_wait; enum ab8500_usb_mode mode; + struct regulator *v_ape; + struct regulator *v_musb; + struct regulator *v_ulpi; int previous_link_status_state; }; @@ -589,6 +593,34 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) return 0; } +static int ab8500_usb_regulator_get(struct ab8500_usb *ab) +{ + int err; + + ab->v_ape = devm_regulator_get(ab->dev, "v-ape"); + if (IS_ERR(ab->v_ape)) { + dev_err(ab->dev, "Could not get v-ape supply\n"); + err = PTR_ERR(ab->v_ape); + return err; + } + + ab->v_ulpi = devm_regulator_get(ab->dev, "vddulpivio18"); + if (IS_ERR(ab->v_ulpi)) { + dev_err(ab->dev, "Could not get vddulpivio18 supply\n"); + err = PTR_ERR(ab->v_ulpi); + return err; + } + + ab->v_musb = devm_regulator_get(ab->dev, "musb_1v8"); + if (IS_ERR(ab->v_musb)) { + dev_err(ab->dev, "Could not get musb_1v8 supply\n"); + err = PTR_ERR(ab->v_musb); + return err; + } + + return 0; +} + static int ab8500_usb_irq_setup(struct platform_device *pdev, struct ab8500_usb *ab) { @@ -686,6 +718,10 @@ static int ab8500_usb_probe(struct platform_device *pdev) /* all: Disable phy when called from set_host and set_peripheral */ INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work); + err = ab8500_usb_regulator_get(ab); + if (err) + return err; + err = ab8500_usb_irq_setup(pdev, ab); if (err < 0) return err;