From patchwork Tue Dec 4 10:30:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1007567 X-Patchwork-Delegate: lukma@denx.de 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="Y2XWGW/2"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 438JD84mVYz9s7W for ; Tue, 4 Dec 2018 21:35:36 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 5761AC21F68; Tue, 4 Dec 2018 10:31:52 +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=RCVD_IN_DNSWL_BLOCKED, 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 239FCC22189; Tue, 4 Dec 2018 10:31:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F0B0AC22111; Tue, 4 Dec 2018 10:31:13 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id EB44EC21DD9 for ; Tue, 4 Dec 2018 10:31:12 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id wB4AV86r088738; Tue, 4 Dec 2018 04:31:08 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1543919468; bh=NeBYGPuZrhAu+b2BN4iXuq3d8l/5r4EMJ4Ss2ys15Co=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Y2XWGW/2RQaztcfo/QqoAJUUacIo2aCOCtP5y7Lp+CqREw6CqRUSKC+p3R6f9ls8B hIVusaL3BKdqzbMf7pxhnoKUnFTGvViJYZOPSl8RIWw38uT1zb1Vbxbd+SMq4zBpZP 0PjdaWT8VHJGLtWmKqm34deRSBKBnNAcmNy6D8EU= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wB4AV83k003927 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Dec 2018 04:31:08 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 4 Dec 2018 04:31:08 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Tue, 4 Dec 2018 04:31:08 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id wB4AV77Z016687; Tue, 4 Dec 2018 04:31:07 -0600 From: Jean-Jacques Hiblot To: , , Date: Tue, 4 Dec 2018 11:30:49 +0100 Message-ID: <1543919461-10341-4-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543919461-10341-1-git-send-email-jjhiblot@ti.com> References: <1543919461-10341-1-git-send-email-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 v2 03/14] phy: omap_usb2: Add support for am437x 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" Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Tom Rini --- Changes in v2: None drivers/phy/omap-usb2-phy.c | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/drivers/phy/omap-usb2-phy.c b/drivers/phy/omap-usb2-phy.c index fd20e8c..be3bb0d 100644 --- a/drivers/phy/omap-usb2-phy.c +++ b/drivers/phy/omap-usb2-phy.c @@ -19,6 +19,11 @@ #define OMAP_DEV_PHY_PD BIT(0) #define OMAP_USB2_PHY_PD BIT(28) +#define AM437X_USB2_PHY_PD BIT(0) +#define AM437X_USB2_OTG_PD BIT(1) +#define AM437X_USB2_OTGVDET_EN BIT(19) +#define AM437X_USB2_OTGSESSEND_EN BIT(20) + #define USB2PHY_DISCON_BYP_LATCH BIT(31) #define USB2PHY_ANA_CONFIG1 (0x4c) @@ -60,6 +65,15 @@ static const struct usb_phy_data dra7x_usb2_phy2_data = { .power_off = OMAP_USB2_PHY_PD, }; +static const struct usb_phy_data am437x_usb2_data = { + .label = "am437x_usb2", + .flags = 0, + .mask = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD | + AM437X_USB2_OTGVDET_EN | AM437X_USB2_OTGSESSEND_EN, + .power_on = AM437X_USB2_OTGVDET_EN | AM437X_USB2_OTGSESSEND_EN, + .power_off = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD, +}; + static const struct udevice_id omap_usb2_id_table[] = { { .compatible = "ti,omap5-usb2", @@ -73,6 +87,10 @@ static const struct udevice_id omap_usb2_id_table[] = { .compatible = "ti,dra7x-usb2-phy2", .data = (ulong)&dra7x_usb2_phy2_data, }, + { + .compatible = "ti,am437x-usb2", + .data = (ulong)&am437x_usb2_data, + }, {}, }; @@ -170,20 +188,25 @@ int omap_usb2_phy_probe(struct udevice *dev) } regmap = syscon_regmap_lookup_by_phandle(dev, "syscon-phy-power"); - if (IS_ERR(regmap)) { - printf("can't get regmap (err %ld)\n", PTR_ERR(regmap)); - return PTR_ERR(regmap); + if (!IS_ERR(regmap)) { + priv->pwr_regmap = regmap; + rc = dev_read_u32_array(dev, "syscon-phy-power", tmp, 2); + if (rc) { + printf("couldn't get power reg. offset (err %d)\n", rc); + return rc; + } + priv->pwr_reg_offset = tmp[1]; + return 0; } - priv->pwr_regmap = regmap; - - rc = dev_read_u32_array(dev, "syscon-phy-power", tmp, 2); - if (rc) { - printf("couldn't get power reg. offset (err %d)\n", rc); - return rc; + regmap = syscon_regmap_lookup_by_phandle(dev, "ctrl-module"); + if (!IS_ERR(regmap)) { + priv->pwr_regmap = regmap; + priv->pwr_reg_offset = 0; + return 0; } - priv->pwr_reg_offset = tmp[1]; - return 0; + printf("can't get regmap (err %ld)\n", PTR_ERR(regmap)); + return PTR_ERR(regmap); } U_BOOT_DRIVER(omap_usb2_phy) = {