Received: by 10.223.185.116 with SMTP id b49csp4167957wrg; Mon, 19 Feb 2018 12:25:22 -0800 (PST) X-Google-Smtp-Source: AH8x225X/Vsik/5HfQy247oeraf10OJwieBl/FvKc9FVoQfWyQU8xpSIO1+Lb9wbiJJxl6qIRvBv X-Received: by 10.101.98.201 with SMTP id m9mr1107721pgv.100.1519071922856; Mon, 19 Feb 2018 12:25:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519071922; cv=none; d=google.com; s=arc-20160816; b=DvIFcAfrZFjpMffh7LlDycE04i9eRHEJZdwvcnSwKDVrVA0hHYSvVN+MK2BzBYnMoV RUa5c6NjNHEcG6iYR0zG4GBKm7O+8YpUmTrppwney1mC0VrAyxaREkI5P9zh+1SF2Pe4 fI9WSYpgfVwEWQE5tljxfpLAYf9AM3CMGES5TELRsqVKR8/gXvtuLbtPCrIShaEAJMyv 14qIydmec+QaXBJs606FCPGR081cz8g8JG+eRse/+Xlscg+RbfgGVbPUEwbhnxCq3F19 Dxt8cVocVihBdQmJy5Xcn4CWRlXARswwzNjEcPegvw1Sl1AjLxcK3bUTngwYlJU0tN1L apfg== 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=kHg4m/KRccIGJjG/cbuLrdyZjJT8U1zbjx7B5ULPPWM=; b=CzcaCnTrFAFFA3D8foQVZ/cVdyhx7BAd2gKnuRywP76NvbZBO0llfPfeT9YFzIWm6N dttrDtD5QZQlPRyN0kn4FxME+yN9sF9rxiFylm5I91DLGuOIJT/JklFIFEU6FLM/1TD9 v5Z4kkeB3NIpTX21GXUmqYY+ydxs96kBCBGv93IBpQauIqw/zArwBZO1Z+nztjFyFuTd Vi/fJvjcrDkhXozMqJcKvdwRvNE9ML6LquqLP6uexM8h9B78N7OUyJTKQwxl8pj2gHzj ch9POdQu8jVqAE/JHto7aXM0fBRTglP3ivDkRqHcWrh3fRu2sPcTz7PNiwHGCXZvDa5W G1SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=XoGOsI1/; 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 v4-v6si1560496plz.143.2018.02.19.12.25.08; Mon, 19 Feb 2018 12:25:22 -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=XoGOsI1/; 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 S932242AbeBSUXV (ORCPT + 99 others); Mon, 19 Feb 2018 15:23:21 -0500 Received: from vern.gendns.com ([206.190.152.46]:58618 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932222AbeBSUXQ (ORCPT ); Mon, 19 Feb 2018 15:23:16 -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=kHg4m/KRccIGJjG/cbuLrdyZjJT8U1zbjx7B5ULPPWM=; b=XoGOsI1/i6RP9kYm2BTsJj/pF Kq9Fy3MWUehs93Ddvs3z/5CQrLCpwRBiphnAi3EoKxkA+7gI/JmnZEZ9T9gCOfvnDjAxb9rvE13aX LUvKPYrATIsH9H9UJ8CJH3oGFk8VpVIgRk+g44r3YmXqGjMdr1GI5wiNvuSpJpUGHP2jobS3w0p6j VPPvBjFYC4XTCzNNud/VOd7uGSDjdLco03ZObBSx1JEmB3I03xOimhnNDRdLySAMy+bsPP2UnkJD7 rWiyUcOO1fwVcfAC5CQlI4Hnynb68w5cNPA9Q92DC2NGBYp3gtm8INtqCrQIoPaZ4sKY1gbpfbqMp r1l0f1RUg==; 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 1enrwh-003xBV-JH; Mon, 19 Feb 2018 15:21:55 -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 25/42] ARM: davinci: dm644x: add new clock init using common clock framework Date: Mon, 19 Feb 2018 14:21:46 -0600 Message-Id: <1519071723-31790-26-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 board-specific clock init in mach-davinci/dm644x.c using the new common clock framework drivers. The #ifdefs are needed to prevent compile errors until the entire ARCH_DAVINCI is converted. Also clean up the #includes since we are adding some here. Signed-off-by: David Lechner --- v7 changes: - add clock platform device declarations - register platform devices instead of registering clocks directly - add davinci prefix to commit description v6 changes: - add blank lines between function calls arch/arm/mach-davinci/board-dm644x-evm.c | 2 + arch/arm/mach-davinci/board-neuros-osd2.c | 2 + arch/arm/mach-davinci/board-sffsdr.c | 2 + arch/arm/mach-davinci/davinci.h | 1 + arch/arm/mach-davinci/dm644x.c | 83 +++++++++++++++++++++++++++---- 5 files changed, 81 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index 95b55aa..91c7525 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -768,6 +768,8 @@ static __init void davinci_evm_init(void) struct clk *aemif_clk; struct davinci_soc_info *soc_info = &davinci_soc_info; + dm644x_register_clocks(); + ret = dm644x_gpio_register(); if (ret) pr_warn("%s: GPIO init failed: %d\n", __func__, ret); diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c index f287577..ae17d3e 100644 --- a/arch/arm/mach-davinci/board-neuros-osd2.c +++ b/arch/arm/mach-davinci/board-neuros-osd2.c @@ -174,6 +174,8 @@ static __init void davinci_ntosd2_init(void) struct clk *aemif_clk; struct davinci_soc_info *soc_info = &davinci_soc_info; + dm644x_register_clocks(); + ret = dm644x_gpio_register(); if (ret) pr_warn("%s: GPIO init failed: %d\n", __func__, ret); diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c index 2922da9..933cc08 100644 --- a/arch/arm/mach-davinci/board-sffsdr.c +++ b/arch/arm/mach-davinci/board-sffsdr.c @@ -134,6 +134,8 @@ static __init void davinci_sffsdr_init(void) { struct davinci_soc_info *soc_info = &davinci_soc_info; + dm644x_register_clocks(); + platform_add_devices(davinci_sffsdr_devices, ARRAY_SIZE(davinci_sffsdr_devices)); sffsdr_init_i2c(); diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h index c865226..2861a6f 100644 --- a/arch/arm/mach-davinci/davinci.h +++ b/arch/arm/mach-davinci/davinci.h @@ -107,6 +107,7 @@ int dm365_gpio_register(void); /* DM644x function declarations */ void dm644x_init(void); void dm644x_init_time(void); +void dm644x_register_clocks(void); void dm644x_init_asp(void); int dm644x_init_video(struct vpfe_config *, struct vpbe_config *); int dm644x_gpio_register(void); diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 71a16fc..64f5193 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c @@ -8,28 +8,31 @@ * is licensed "as is" without any warranty of any kind, whether express * or implied. */ -#include -#include -#include +#include #include -#include +#include #include #include +#include +#include #include +#include #include #include -#include "psc.h" #include -#include #include -#include +#include +#include "asp.h" #include "davinci.h" -#include "clock.h" #include "mux.h" -#include "asp.h" + +#ifndef CONFIG_COMMON_CLK +#include "clock.h" +#include "psc.h" +#endif /* * Device specific clocks @@ -43,6 +46,7 @@ #define DM644X_EMAC_CNTRL_RAM_OFFSET 0x2000 #define DM644X_EMAC_CNTRL_RAM_SIZE 0x2000 +#ifndef CONFIG_COMMON_CLK static struct pll_data pll1_data = { .num = 1, .phys_base = DAVINCI_PLL1_BASE, @@ -326,6 +330,7 @@ static struct clk_lookup dm644x_clks[] = { CLK("davinci-wdt", NULL, &timer2_clk), CLK(NULL, NULL, NULL), }; +#endif static struct emac_platform_data dm644x_emac_pdata = { .ctrl_reg_offset = DM644X_EMAC_CNTRL_OFFSET, @@ -934,8 +939,68 @@ void __init dm644x_init(void) void __init dm644x_init_time(void) { +#ifdef CONFIG_COMMON_CLK + struct clk *clk; + + clk = clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM644X_REF_FREQ); + + davinci_timer_init(clk); +#else davinci_clk_init(dm644x_clks); davinci_timer_init(&timer0_clk); +#endif +} + +static struct resource dm644x_pll1_resources[] = { + { + .start = DAVINCI_PLL1_BASE, + .end = DAVINCI_PLL1_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device dm644x_pll1_device = { + .name = "dm644x-pll1", + .id = -1, + .resource = dm644x_pll1_resources, + .num_resources = ARRAY_SIZE(dm644x_pll1_resources), +}; + +static struct resource dm644x_pll2_resources[] = { + { + .start = DAVINCI_PLL2_BASE, + .end = DAVINCI_PLL2_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device dm644x_pll2_device = { + .name = "dm644x-pll2", + .id = -1, + .resource = dm644x_pll2_resources, + .num_resources = ARRAY_SIZE(dm644x_pll2_resources), +}; + +static struct resource dm644x_psc_resources[] = { + { + .start = DAVINCI_PWR_SLEEP_CNTRL_BASE, + .end = DAVINCI_PWR_SLEEP_CNTRL_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device dm644x_psc_device = { + .name = "dm644x-psc", + .id = -1, + .resource = dm644x_psc_resources, + .num_resources = ARRAY_SIZE(dm644x_psc_resources), +}; + +void __init dm644x_register_clocks(void) +{ + platform_device_register(&dm644x_pll1_device); + platform_device_register(&dm644x_pll2_device); + platform_device_register(&dm644x_psc_device); } int __init dm644x_init_video(struct vpfe_config *vpfe_cfg, -- 2.7.4