Received: by 10.223.185.116 with SMTP id b49csp4168574wrg; Mon, 19 Feb 2018 12:26:12 -0800 (PST) X-Google-Smtp-Source: AH8x225muTjGYLdW6BYckuClxCHAii8092trQNR85cz+lv2f/vVRafjkffE2cmsSeW6ou2ByJEUK X-Received: by 10.101.85.204 with SMTP id k12mr13554932pgs.40.1519071972537; Mon, 19 Feb 2018 12:26:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519071972; cv=none; d=google.com; s=arc-20160816; b=vATSSb0Lb4mbq9wPlfb0H8/mpPpez7sVc9K1JBSUHnX/N0+kB20zAtWbnAnWcI/q8k 05NfirNnN58K4So8X4mXdC1Ne29PHl9X2b8eymRXO5NWVIYKbn1vbWoB6AgtIYak+iWK 1KFUIl97Neclq+ToTPozPxc3Jh9YPGJI4/eAYyPQiQa6ooaT1FKOBoA4dCR2yXkI7SWJ VMR+3xgkl+bV1A8HRSEJxMcYIJ1QqZeBed2KaiVc6k4x1xHjLwJ8jmVL4PuhKW7KPiRI 8rat3oeqUKUAB8QA9API7UrU5R3TBnonuipSZA5umb27i3kCfD98INSAn40IZvFLhVsN lveA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=2AabN5gPDvuma5wbCHXDuAVBNIGyW0ij3zXM4hnrpT0=; b=QNIdkzlEyeHXOmw0L09Nyr4DZbCGXE/fj2GgDpUas0guu5Kh+HDXRZGu35Sl6qkfVO mcvVxxuljonnBKiJQDe6omvdnSDrkN6X8KmiSLwlF6N1mju8FQQVVCF8KG/8hA4XP+g9 lOPkOtlUHpjq2oSPcWy+pKvLpD/sGhV49dtmNxazX8CDRnTq5Ui2U8RD/TxOFXHfMKkj oxB8ZY27e0WTEVOydev8vmlqdp/oLm+roZ84aBVJYG7tgIBjr6ipM7EsZ62J9FMMPqP5 IROXCaPdjH2ZXk5K8sPq0JGoFypaPeV4zPf0W+xHGL06f9WGkZlu60wCRBil406jfxJy kKJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=XvOivauT; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3-v6si3495393plz.494.2018.02.19.12.25.58; Mon, 19 Feb 2018 12:26:12 -0800 (PST) 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; dkim=fail header.i=@lechnology.com header.s=default header.b=XvOivauT; 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 S932318AbeBSUY2 (ORCPT + 99 others); Mon, 19 Feb 2018 15:24:28 -0500 Received: from vern.gendns.com ([206.190.152.46]:58637 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932227AbeBSUXU (ORCPT ); Mon, 19 Feb 2018 15:23:20 -0500 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=2AabN5gPDvuma5wbCHXDuAVBNIGyW0ij3zXM4hnrpT0=; b=XvOivauT2XEKmPzPgwodn3sLP GgQNAkT17UEGOBehd1faPop71FoM3xbOf46bHMhp0O49zP+uuOcOC07erC92Hft6mJA+126/r1FXi PlEPyjKf+NpCajbySRJgGQ6nszcoCK5yciZ2KGlnDWa6L+065ACr28OT8vFcQwlPn6/YhQemKc5+x 9PRwBTRkQm81jRmvkwCu57IMZ0wsTHr6fbMt/QPjOcpYsXLYxoKEBSYVo6XE2DTKcfOYoVJZCJoWg NapfV9l2O+I+M6+OYSFZa5Y6rDV0Ax/sdNa5e6xoObbhWgm2sUUa37pGse5O0XTx5dpozcRrdLxcB zmMKjB8eg==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:48842 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1enrwk-003xBV-DE; Mon, 19 Feb 2018 15:21:58 -0500 From: David Lechner To: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland , Sekhar Nori , Kevin Hilman , Bartosz Golaszewski , Adam Ford , linux-kernel@vger.kernel.org, David Lechner Subject: [PATCH v7 27/42] ARM: davinci: da8xx: add new USB PHY clock init using common clock framework Date: Mon, 19 Feb 2018 14:21:48 -0600 Message-Id: <1519071723-31790-28-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519071723-31790-1-git-send-email-david@lechnology.com> References: <1519071723-31790-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 - vger.kernel.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: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 6a4e486..2a10cd8 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 4d89d86..d8cc63c 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 platform_device da8xx_usb_phy = { .name = "da8xx-usb-phy", @@ -134,6 +140,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, @@ -360,3 +367,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); +} -- 2.7.4