From patchwork Thu Jun 27 11:02:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1123280 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="qZn+7ULv"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45ZHHf593xz9s8m for ; Thu, 27 Jun 2019 21:10:22 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 679ADC21E08; Thu, 27 Jun 2019 11:04:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 67DDCC21D74; Thu, 27 Jun 2019 11:03:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6DFDDC21E02; Thu, 27 Jun 2019 11:03:24 +0000 (UTC) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lists.denx.de (Postfix) with ESMTPS id 14FBFC21E26 for ; Thu, 27 Jun 2019 11:03:20 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5RB3Hwa063325; Thu, 27 Jun 2019 06:03:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1561633397; bh=tNZWlMVA9pbmWsDEKnQX/w7ykZW/fBpFxatfG/FQdUI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=qZn+7ULv0dhh7Ve0J6o2a+hRd7bSe1O8RxAstkfXvhUwvxAAaO/HX0i/gM/azWJHj CyFLrvl0EMLFu1wSoTZ7S+eyT2a1sEcGZr3yKfef8OGphOzQPb+h6SFofnbrDWQJs0 K4E+K0GHCE7+68bhFTSxhZH5TSaXXJYSYYPYrIkw= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5RB3Hvw037681 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 27 Jun 2019 06:03:17 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 27 Jun 2019 06:03:16 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 27 Jun 2019 06:03:16 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5RB3GJp103211; Thu, 27 Jun 2019 06:03:16 -0500 From: Jean-Jacques Hiblot To: , Date: Thu, 27 Jun 2019 13:02:49 +0200 Message-ID: <20190627110251.2591-17-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190627110251.2591-1-jjhiblot@ti.com> References: <20190627110251.2591-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Joe Hershberger , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 16/18] phy: keystone-usb: handle the transition of the USB power domain X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" There is no proper power domain support for the keystone platforms. However we need to turn off the USB domains before jumping to linux or it fail to boot (observed with k2e and k2l platforms). This can be done in the PHY driver as it is dedicated only to the keystone platforms and matches the required on/off sequence. Signed-off-by: Jean-Jacques Hiblot --- Changes in v3: None Changes in v2: None drivers/phy/keystone-usb-phy.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/phy/keystone-usb-phy.c b/drivers/phy/keystone-usb-phy.c index e8146cabfa..14ac6bbbb2 100644 --- a/drivers/phy/keystone-usb-phy.c +++ b/drivers/phy/keystone-usb-phy.c @@ -9,6 +9,7 @@ #include #include #include +#include /* USB PHY control register offsets */ #define USB_PHY_CTL_UTMI 0x0000 @@ -22,15 +23,25 @@ #define PHY_REF_SSP_EN BIT(29) struct keystone_usb_phy { + u32 psc_domain; void __iomem *reg; }; static int keystone_usb_init(struct phy *phy) { u32 val; + int rc; struct udevice *dev = phy->dev; struct keystone_usb_phy *keystone = dev_get_priv(dev); + /* Release USB from reset */ + rc = psc_enable_module(keystone->psc_domain); + if (rc) { + debug("Cannot enable USB module"); + return -rc; + } + mdelay(10); + /* * VBUSVLDEXTSEL has a default value of 1 in BootCfg but shouldn't. * It should always be cleared because our USB PHY has an onchip VBUS @@ -72,13 +83,24 @@ static int keystone_usb_power_off(struct phy *phy) static int keystone_usb_exit(struct phy *phy) { + struct udevice *dev = phy->dev; + struct keystone_usb_phy *keystone = dev_get_priv(dev); + + if (psc_disable_module(keystone->psc_domain)) + debug("failed to disable USB module!\n"); + return 0; } static int keystone_usb_phy_probe(struct udevice *dev) { + int rc; struct keystone_usb_phy *keystone = dev_get_priv(dev); + rc = dev_read_u32(dev, "psc-domain", &keystone->psc_domain); + if (rc) + return rc; + keystone->reg = dev_remap_addr_index(dev, 0); if (!keystone->reg) { pr_err("unable to remap usb phy\n");