From patchwork Wed Jun 1 07:52:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 68982 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2387278qge; Wed, 1 Jun 2016 00:53:04 -0700 (PDT) X-Received: by 10.98.89.207 with SMTP id k76mr5998019pfj.166.1464767584113; Wed, 01 Jun 2016 00:53:04 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si40379674pfa.147.2016.06.01.00.53.03; Wed, 01 Jun 2016 00:53:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757523AbcFAHxA (ORCPT + 30 others); Wed, 1 Jun 2016 03:53:00 -0400 Received: from arroyo.ext.ti.com ([198.47.19.12]:48221 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752370AbcFAHw7 (ORCPT ); Wed, 1 Jun 2016 03:52:59 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id u517qvKg000816; Wed, 1 Jun 2016 02:52:57 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u517qveu031162; Wed, 1 Jun 2016 02:52:57 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Wed, 1 Jun 2016 02:52:57 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u517qs9l008344; Wed, 1 Jun 2016 02:52:55 -0500 Subject: [PATCH v2] phy: ti-pipe3: Program the DPLL even if it was already locked To: References: <1463574486-30438-1-git-send-email-rogerq@ti.com> CC: , , , , , , , "Nori, Sekhar" From: Roger Quadros Message-ID: <574E9456.1010409@ti.com> Date: Wed, 1 Jun 2016 10:52:54 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <1463574486-30438-1-git-send-email-rogerq@ti.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If bootloader has set a wrong DPLL then we must trash those values and re-program it anyways. This fixes USB3 devices not being enumerated on Beagleboard-x15 if usb was started in u-boot. (e.g. v2016.05) We don't re-program SATA DPLL if it is locked as it was causing SATA failures if device was hotpluged after boot. This might be due to i818 "SATA PHY Reset Required Following SATA PLL Unlock". Signed-off-by: Roger Quadros --- v2: - updated commit message. fixed board name and added SATA DPLL errata details. drivers/phy/phy-ti-pipe3.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 0a477d2..bf46844 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c @@ -293,11 +293,18 @@ static int ti_pipe3_init(struct phy *x) ret = ti_pipe3_dpll_wait_lock(phy); } - /* Program the DPLL only if not locked */ + /* SATA has issues if re-programmed when locked */ val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS); - if (!(val & PLL_LOCK)) - if (ti_pipe3_dpll_program(phy)) - return -EINVAL; + if ((val & PLL_LOCK) && of_device_is_compatible(phy->dev->of_node, + "ti,phy-pipe3-sata")) + return ret; + + /* Program the DPLL */ + ret = ti_pipe3_dpll_program(phy); + if (ret) { + ti_pipe3_disable_clocks(phy); + return -EINVAL; + } return ret; }