Received: by 10.192.165.148 with SMTP id m20csp170578imm; Wed, 9 May 2018 10:35:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp/1/VmPd5RdyYoWg3ZjOliPj0rnBJMR91byAmptaz185lF3Q+F5Wro6NAIvf2BKJrDgrnd X-Received: by 2002:a65:414d:: with SMTP id x13-v6mr37348787pgp.223.1525887307921; Wed, 09 May 2018 10:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525887307; cv=none; d=google.com; s=arc-20160816; b=JQo1fxs+gk1TEfvstjJ6mH3J/tQ536J/u9+qCJZR/SR1R3Yw19zlWi1jEk0VBMzD7R aYLWrg6wRNkpWDummGCf5CXKUM+ER3/QmiyKpmTNJKpdyTRFw7Y9Q7g7eYKSL30ioNnY zHcixAH7Te4Oy6o6a7rRzFoKOznxAKBrnuipDmlNCWGdpS8ounCCZZ2LGwbvYoM9AqnG DY7KoBwdWVHgSLrvRKB2ULUQLfSYBePCnhR7UcukE5PGqWWMvcSKtvJ31YLnaTnkZx/U XKfXlkEtLOOXSm9NZvOMIc7aAXh0Ft28+OErJIaUllsvFHSLC2QdD9m0Khw9FNRguhxE X64A== 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=6jS1VVOunck0TC5XxIPo/pBtt3s8Jev1wS/q0ycpj+E=; b=1KNje9lzxysp9u9ZhG4eNfQ+PVDsuUIOUOQhMJB2AxCOD3mVuVz2zIZeVjHET9zELs HlnLStRRsdyiiT3afjJFadVMn61jOk07HRi8X9vnftPyHgB/PsNqJk9d1wBRwnI0YObJ D53D8Gi401s7DF8M3EfGuO24RsXsrlZajwv7QwKygEDKk0s8nxP3sfwyYp5e5G17MBBy U8PmQ0RN4pAz/2fAtizF9K7ZN/qoNC2KRU4AamOddntm8n2j332whsmKKitsP0Ksd+AO HnVTvFvhGcis9PINCASGPAqZIOuv0/VrvAT/p5XhXBsXMv3WcrNj7U7xOkWjUGieNmzf OPaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=bvQura0k; 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 n12-v6si22160154pgf.497.2018.05.09.10.34.53; Wed, 09 May 2018 10:35:07 -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; dkim=fail header.i=@lechnology.com header.s=default header.b=bvQura0k; 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 S935123AbeEIRde (ORCPT + 99 others); Wed, 9 May 2018 13:33:34 -0400 Received: from vern.gendns.com ([206.190.152.46]:51966 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935561AbeEIR1C (ORCPT ); Wed, 9 May 2018 13:27:02 -0400 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=6jS1VVOunck0TC5XxIPo/pBtt3s8Jev1wS/q0ycpj+E=; b=bvQura0kj9Jud4DJNWhEReQfN HUyHgjjrB9cEQxvgbKJBzlbhj+ANWIwJdLLO/jhO+8xusEyYhfF1knDER5FiK69Ap4x+7qIh4YjZt qR1zQlf/1xZGnUWS7IZIXlBppx8Ew124wBX81VQe3XEvTN83oJ86a67kolmlkUjE5VOpKe2UW8XTi nx4g2aGBGg2F+/fvLEQN1ePxfdwXK7yRQUff++tECIAYsg7v+Lbikuo++2dWc9UFs7L0yG79o2umk tqE4At6lo0hfVkHnJ502xg528R+lncX10wICtwRgnMkwItPygjqDhllILNZjxoZ5N4rSgquOgha1I 6hFCYfBoA==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:58616 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1fGSrd-00EzgW-Lu; Wed, 09 May 2018 13:26:53 -0400 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 v10 11/27] ARM: davinci: da8xx: add new USB PHY clock init using common clock framework Date: Wed, 9 May 2018 12:25:50 -0500 Message-Id: <20180509172606.29387-12-david@lechnology.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509172606.29387-1-david@lechnology.com> References: <20180509172606.29387-1-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 --- v10 changes: - none v9 changes: - none 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 74df37821abe..ccddbae951d6 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 7653e9425d44..949ca567e965 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c @@ -235,7 +235,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", @@ -245,7 +250,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 91dd9cb6d113..c4edf051ef9b 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 612e45437cec..5d7b1de9aa7e 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 50445f0e98de..c8d2f3075e69 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; @@ -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.17.0