From patchwork Thu Jun 26 14:22:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 32558 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 317E32066E for ; Thu, 26 Jun 2014 14:22:56 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id i13sf7114823veh.3 for ; Thu, 26 Jun 2014 07:22:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=daUUzI67cxyS+x11vFCjbLWdXJaHOY/63DuBNOFRraM=; b=Sq2xcsuaOdIpuOF6hBvhqZrNyhp/SfaPE2SlpvkpsXZ2HzvGVD6ZONbW+xquS1Jsdu uSE+pQR2SaKhdAA7myyU+4Na3ieVQfXkZpBUC3t3PJg1E9OBqKiN8SvE61Zzxzvznweo SU2DzMJpFAvfutSlFutAq+vGMLhu/brNGVIAuCCukDrYVP1CAznYfRTDz+YJJ5ylFy7H ckppXiSd0l8C/do7tlHzJoqCTrfAtIk/hBW5mXD5xal+OmvE+BzOm+4vCbYeOPzRNHl/ gFn2wHklj4zkS85seLLxdan+pP1kHtljHcitDK0eyQMd4oQxdnU6/ez5qE2e2qPia08/ hhsQ== X-Gm-Message-State: ALoCoQnzmt5SAUvqJR8uI+xVqbW6qnpJ0Y49UVs6Qotoknq3LLPhDGUWlZYbe4UsW+7AAUH9x6S5 X-Received: by 10.58.160.72 with SMTP id xi8mr8614462veb.15.1403792575979; Thu, 26 Jun 2014 07:22:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.136 with SMTP id 8ls219143qgp.33.gmail; Thu, 26 Jun 2014 07:22:55 -0700 (PDT) X-Received: by 10.58.118.168 with SMTP id kn8mr1782127veb.44.1403792575877; Thu, 26 Jun 2014 07:22:55 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id xs1si4462834vec.64.2014.06.26.07.22.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 07:22:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ij19so3597128vcb.37 for ; Thu, 26 Jun 2014 07:22:55 -0700 (PDT) X-Received: by 10.52.253.131 with SMTP id aa3mr7426926vdd.25.1403792575784; Thu, 26 Jun 2014 07:22:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp33981vcb; Thu, 26 Jun 2014 07:22:54 -0700 (PDT) X-Received: by 10.68.135.195 with SMTP id pu3mr22112893pbb.10.1403792574532; Thu, 26 Jun 2014 07:22:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id py12si10092806pab.17.2014.06.26.07.22.53; Thu, 26 Jun 2014 07:22:53 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755973AbaFZOWl (ORCPT + 27 others); Thu, 26 Jun 2014 10:22:41 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:36783 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751759AbaFZOWi (ORCPT ); Thu, 26 Jun 2014 10:22:38 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5QEMaFv016382; Thu, 26 Jun 2014 09:22:36 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5QEMa3d023329; Thu, 26 Jun 2014 09:22:36 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Thu, 26 Jun 2014 09:22:35 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5QEMWc1021871; Thu, 26 Jun 2014 09:22:32 -0500 Message-ID: <53AC2CA7.30800@ti.com> Date: Thu, 26 Jun 2014 17:22:31 +0300 From: Roger Quadros User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Tony Lindgren , Nishanth Menon , "Kristo, Tero" CC: , , , , , , Subject: Re: [PATCH] ARM: DRA7-evm: Enable SATA PHY and USB PHY power supplies References: <1403700996-27105-1-git-send-email-rogerq@ti.com> <53AB4CE0.6020705@ti.com> <20140626073115.GD28884@atomide.com> <53ABE9AD.1000100@ti.com> In-Reply-To: <53ABE9AD.1000100@ti.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: rogerq@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , +Tero On 06/26/2014 12:36 PM, Roger Quadros wrote: > On 06/26/2014 10:31 AM, Tony Lindgren wrote: >> * Nishanth Menon [140625 15:29]: >>> On 06/25/2014 07:56 AM, Roger Quadros wrote: >>>> The SATA and USB PHYs need the 1.8V and 3.3V supplies. >>>> The PHY drivers/framework don't yet support regulator >>>> supply so we have to keep these regulators always-on till >>>> then. >>>> >>>> Signed-off-by: Roger Quadros >>>> --- >>>> arch/arm/boot/dts/dra7-evm.dts | 2 ++ >>>> 1 file changed, 2 insertions(+) >>>> >>>> diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts >>>> index 4adc280..99a1f79 100644 >>>> --- a/arch/arm/boot/dts/dra7-evm.dts >>>> +++ b/arch/arm/boot/dts/dra7-evm.dts >>>> @@ -241,6 +241,7 @@ >>>> regulator-min-microvolt = <1800000>; >>>> regulator-max-microvolt = <1800000>; >>>> regulator-boot-on; >>>> + regulator-always-on; >>>> }; >>>> >>>> ldo9_reg: ldo9 { >>>> @@ -266,6 +267,7 @@ >>>> regulator-min-microvolt = <3300000>; >>>> regulator-max-microvolt = <3300000>; >>>> regulator-boot-on; >>>> + regulator-always-on; >>>> }; >>>> }; >>>> }; >>>> >>> >>> Why not fix phy driver/framework as needed? the trouble is people >>> always forget to remove always-on... who actually audits old logs and >>> fixes stuff back up? >> >> Yes I agree let's not play with the regulator-always-on unless >> absolutely necessary. >> > Agreed. PHY framework must deal with this. Till then USB, SATA and most likely PCIe as well will not work on DRA7-evm. > I tried the below patch to enable the relevant regulators in the PHY drivers but still couldn't manage to get USB to work. The same 1.8V regulator is used to supply 3 pins -vdda_usb1: DPLL_USB and HS_USB1 analog supply -vdda_usb2: HS_USB2 analog supply -vdda_usb3: DPLL_USB_OTG_SS and USB3.0 Rx/Tx analog supply It seems that the regulator auto disable kicks in before the phy driver enables the regulator thus causing some kind of malfunction. I'm not sure whether this is due to DPLL_USB supply glitch or HS_USB1 analog supply glitch. In any case, the DPLL_USB (clock driver?) needs to enable the 1.8V regulator in addition to the HS_USB PHY driver to prevent this supply glitch. Tero, any suggestions about this? If we are not concerned about disabling DPLL_USB anytime then the regulator might just as well be always-on. Alternatively can we place a regulator_get(), regulator_enable() in drivers/clk/ti/dpll.c? cheers, -roger diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts index 4adc280..23379ab 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts @@ -495,3 +495,11 @@ }; }; }; + +&usb2_phy1 { + vdda3v3-supply = <&ldousb_reg>; +}; + +&usb3_phy1 { + vdda1v8-supply = <&ldo3_reg>; +}; diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 7007c11..bb1a768 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -30,6 +30,7 @@ #include #include #include +#include #define USB2PHY_DISCON_BYP_LATCH (1 << 31) #define USB2PHY_ANA_CONFIG1 0x4c @@ -107,6 +108,18 @@ static int omap_usb_power_off(struct phy *x) omap_control_phy_power(phy->control_dev, 0); + if (phy->pwr) { + int ret; + + ret = regulator_disable(phy->pwr); + if (ret) { + dev_err(phy->dev, "failed to disable regulator\n"); + return ret; + } else { + dev_info(phy->dev, "disabled regulator\n"); + } + } + return 0; } @@ -114,6 +127,18 @@ static int omap_usb_power_on(struct phy *x) { struct omap_usb *phy = phy_get_drvdata(x); + if (phy->pwr) { + int ret; + + ret = regulator_enable(phy->pwr); + if (ret) { + dev_err(phy->dev, "failed to enable regulator\n"); + return ret; + } else { + dev_info(phy->dev, "enabled regulator\n"); + } + } + omap_control_phy_power(phy->control_dev, 1); return 0; @@ -253,6 +278,14 @@ static int omap_usb2_probe(struct platform_device *pdev) phy->control_dev = &control_pdev->dev; omap_control_phy_power(phy->control_dev, 0); + /* phy-supply */ + phy->pwr = devm_regulator_get_optional(phy->dev, "vdda3v3"); + if (IS_ERR(phy->pwr)) { + if (PTR_ERR(phy->pwr) == -EPROBE_DEFER) + return -EPROBE_DEFER; + phy->pwr = NULL; + } + otg->set_host = omap_usb_set_host; otg->set_peripheral = omap_usb_set_peripheral; if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS) diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 5913676..1b46b0b 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c @@ -28,6 +28,7 @@ #include #include #include +#include #define PLL_STATUS 0x00000004 #define PLL_GO 0x00000008 @@ -81,6 +82,7 @@ struct ti_pipe3 { struct clk *sys_clk; struct clk *refclk; struct pipe3_dpll_map *dpll_map; + struct regulator *pwr_dpll; }; static struct pipe3_dpll_map dpll_map_usb[] = { @@ -215,6 +217,17 @@ static int ti_pipe3_init(struct phy *x) u32 val; int ret = 0; + /* Enable DPLL regulator */ + if (phy->pwr_dpll) { + ret = regulator_enable(phy->pwr_dpll); + if (ret) { + dev_err(phy->dev, "failed to enable regulator\n"); + return ret; + } else { + dev_info(phy->dev, "enabled regulator\n"); + } + } + /* Bring it out of IDLE if it is IDLE */ val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2); if (val & PLL_IDLE) { @@ -262,6 +275,18 @@ static int ti_pipe3_exit(struct phy *x) return -EBUSY; } + /* Disable DPLL regulator */ + if (phy->pwr_dpll) { + int ret; + + ret = regulator_disable(phy->pwr_dpll); + if (ret) { + dev_err(phy->dev, "failed to disable regulator\n"); + return ret; + } else { + dev_info(phy->dev, "disabled regulator\n"); + } + } return 0; } static struct phy_ops ops = { @@ -308,7 +333,15 @@ static int ti_pipe3_probe(struct platform_device *pdev) if (IS_ERR(phy->pll_ctrl_base)) return PTR_ERR(phy->pll_ctrl_base); - phy->dev = &pdev->dev; + phy->dev = &pdev->dev; + + /* dpll-supply */ + phy->pwr_dpll = devm_regulator_get_optional(phy->dev, "vdda1v8"); + if (IS_ERR(phy->pwr_dpll)) { + if (PTR_ERR(phy->pwr_dpll) == -EPROBE_DEFER) + return -EPROBE_DEFER; + phy->pwr_dpll = NULL; + } if (!of_device_is_compatible(node, "ti,phy-pipe3-sata")) { diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h index dc2c541..e2c46df 100644 --- a/include/linux/phy/omap_usb.h +++ b/include/linux/phy/omap_usb.h @@ -40,6 +40,7 @@ struct omap_usb { struct clk *wkupclk; struct clk *optclk; u8 flags; + struct regulator *pwr; }; struct usb_phy_data {