From patchwork Fri Mar 16 02:52:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 10286229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5570A602BD for ; Fri, 16 Mar 2018 03:07:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D43428C74 for ; Fri, 16 Mar 2018 03:07:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41FE528C7A; Fri, 16 Mar 2018 03:07:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A072228C74 for ; Fri, 16 Mar 2018 03:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=IunTmq6ve9WxobfZeo/d2WbiRlaExAx5MjjbJecGa4A=; b=fcIvO6EO23pXtuerdqZJPQ3GTT fZ/o5+VgOXYvNNiDgRCMmPe3WOLIj06j+OvZ4umoIaBrWJKjLGwSxOgJgiO73gJh4lz/fnboGVg6x XGZQT+tzxNtQ5O5JX0zDSqp+c5yKqR+KFksli613S0Jxs0/RhVUURfg9Wyj1NCwe0iZdo/iFLYWsA JZu+R3R+Il80AOpgs0O4LVanxxUgXPiu1YSZ4FSq4QdeoW5WQU8kMXULiXBO94IGR83sMJBXJCtoh cWQ1v8NzF56WTtJ6vbelLa+hURps8y4ieNAl24VEoS6bIqRduZJBeFCs3J2ZlZ9nRxMBD+yFA52jG fycgVCdA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewfi2-0002h3-UK; Fri, 16 Mar 2018 03:07:10 +0000 Received: from vern.gendns.com ([206.190.152.46]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewfVW-0007rk-4q for linux-arm-kernel@lists.infradead.org; Fri, 16 Mar 2018 02:54:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=c5xaGHL2PmXFpsQMyBOs93ScbmdyaL06ImSVauEP0BI=; b=yO/LzoPa1Tgvh22FeAe15LLKJ lEnZfza49OuREgDoUq13jeFAzzhV7XhaXoMqNPdXihMjcyyMo9l/DZxIDqVlAYE7U1DtXQXhJHF6x AdHmwRt3uCf/uSOUmmYxabhCAfgYC3A3YCFu1mcHCVQcxtnr+/hS683lwJtRbaQZw7SMppxAEZNV7 a49zMSXygRjbXFF/A/xFqIW2Xdg+MCpg/yzfnB8F/nWNMiLhX/H4c9YYxSZWHJcAJkjIz4gO3NEj+ nAhKNNA2UrKF6bxSbBf9FABmS7wR1xcEhiPgh4iUqjKxmv3BvjBJbud1WgRZIWhuRVDTNOmNH05L2 Ym5sTZ0pw==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:44986 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1ewfTT-002UlD-IS; Thu, 15 Mar 2018 22:52:07 -0400 From: David Lechner To: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v8 27/42] ARM: davinci: da8xx: add new USB PHY clock init using common clock framework Date: Thu, 15 Mar 2018 21:52:43 -0500 Message-Id: <1521168778-27236-28-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521168778-27236-1-git-send-email-david@lechnology.com> References: <1521168778-27236-1-git-send-email-david@lechnology.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180315_195414_796863_C808C7FC X-CRM114-Status: GOOD ( 11.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , David Lechner , Kevin Hilman , Stephen Boyd , Michael Turquette , Sekhar Nori , linux-kernel@vger.kernel.org, Bartosz Golaszewski , Rob Herring , Adam Ford MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds the new USB PHY clock init in mach-davinci/usb-da8xx.c using the new common clock framework drivers. The #ifdefs are needed to prevent compile errors until the entire ARCH_DAVINCI is converted. Signed-off-by: David Lechner --- v8 changes: - rebased on "ARM: davinci: DA8XX: fix oops in USB PHY driver due to stack allocated platform platform_data" v7 changes: - register platform device instead of registering clocks directly - USB PHY clocks now treated as single device instead of registering them separately v6 changes: - rename stuff to match changes in "clk: davinci: New driver for TI DA8XX USB PHY clocks" - take advantage of syscon lookup changes in "mfd: syscon: Add syscon_register() function" arch/arm/mach-davinci/board-da830-evm.c | 8 +++++++- arch/arm/mach-davinci/board-omapl138-hawk.c | 9 +++++++-- arch/arm/mach-davinci/da8xx-dt.c | 8 +++++++- arch/arm/mach-davinci/include/mach/da8xx.h | 1 + arch/arm/mach-davinci/usb-da8xx.c | 26 ++++++++++++++++++++++++-- 5 files changed, 46 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index 3973124..6e77c45 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -110,6 +110,12 @@ static __init void da830_evm_usb_init(void) { int ret; +#ifdef CONFIG_COMMON_CLK + ret = da8xx_register_usb_phy_clocks(); + if (ret) + pr_warn("%s: USB PHY CLK registration failed: %d\n", + __func__, ret); +#else /* USB_REFCLKIN is not used. */ ret = da8xx_register_usb20_phy_clk(false); if (ret) @@ -120,7 +126,7 @@ static __init void da830_evm_usb_init(void) if (ret) pr_warn("%s: USB 1.1 PHY CLK registration failed: %d\n", __func__, ret); - +#endif ret = da8xx_register_usb_phy(); if (ret) pr_warn("%s: USB PHY registration failed: %d\n", diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index eb09e33..6a866d2 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c @@ -231,7 +231,12 @@ static __init void omapl138_hawk_usb_init(void) pr_warn("%s: USB 1.1 PinMux setup failed: %d\n", __func__, ret); return; } - +#ifdef CONFIG_COMMON_CLK + ret = da8xx_register_usb_phy_clocks(); + if (ret) + pr_warn("%s: USB PHY CLK registration failed: %d\n", + __func__, ret); +#else ret = da8xx_register_usb20_phy_clk(false); if (ret) pr_warn("%s: USB 2.0 PHY CLK registration failed: %d\n", @@ -241,7 +246,7 @@ static __init void omapl138_hawk_usb_init(void) if (ret) pr_warn("%s: USB 1.1 PHY CLK registration failed: %d\n", __func__, ret); - +#endif ret = da8xx_register_usb_phy(); if (ret) pr_warn("%s: USB PHY registration failed: %d\n", diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index 91dd9cb..c4edf05 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c @@ -69,6 +69,12 @@ static void __init da850_init_machine(void) da850_register_clocks(); +#ifdef CONFIG_COMMON_CLK + ret = da8xx_register_usb_phy_clocks(); + if (ret) + pr_warn("%s: USB PHY CLK registration failed: %d\n", + __func__, ret); +#else ret = da8xx_register_usb20_phy_clk(false); if (ret) pr_warn("%s: registering USB 2.0 PHY clock failed: %d", @@ -77,7 +83,7 @@ static void __init da850_init_machine(void) if (ret) pr_warn("%s: registering USB 1.1 PHY clock failed: %d", __func__, ret); - +#endif ret = da850_register_sata_refclk(sata_refclkpn); if (ret) pr_warn("%s: registering SATA REFCLK failed: %d", diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 612e454..5d7b1de 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -106,6 +106,7 @@ int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); int da8xx_register_usb_refclkin(int rate); int da8xx_register_usb20_phy_clk(bool use_usb_refclkin); int da8xx_register_usb11_phy_clk(bool use_usb_refclkin); +int da8xx_register_usb_phy_clocks(void); int da850_register_sata_refclk(int rate); int da8xx_register_emac(void); int da8xx_register_uio_pruss(void); diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c index 67d634b..d0ba725 100644 --- a/arch/arm/mach-davinci/usb-da8xx.c +++ b/arch/arm/mach-davinci/usb-da8xx.c @@ -2,29 +2,35 @@ /* * DA8xx USB */ -#include +#include #include #include #include #include +#include #include +#include #include #include #include #include -#include #include #include #include #include +#ifndef CONFIG_COMMON_CLK +#include #include "clock.h" +#endif #define DA8XX_USB0_BASE 0x01e00000 #define DA8XX_USB1_BASE 0x01e25000 +#ifndef CONFIG_COMMON_CLK static struct clk *usb20_clk; +#endif static struct da8xx_usb_phy_platform_data da8xx_usb_phy_pdata; @@ -136,6 +142,7 @@ int __init da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata) return platform_device_register(&da8xx_usb11_device); } +#ifndef CONFIG_COMMON_CLK static struct clk usb_refclkin = { .name = "usb_refclkin", .set_rate = davinci_simple_set_rate, @@ -362,3 +369,18 @@ int __init da8xx_register_usb11_phy_clk(bool use_usb_refclkin) return ret; } +#endif +static struct platform_device da8xx_usb_phy_clks_device = { + .name = "da830-usb-phy-clks", + .id = -1, +}; + +int __init da8xx_register_usb_phy_clocks(void) +{ + struct da8xx_cfgchip_clk_platform_data pdata; + + pdata.cfgchip = da8xx_get_cfgchip(); + da8xx_usb_phy_clks_device.dev.platform_data = &pdata; + + return platform_device_register(&da8xx_usb_phy_clks_device); +}