Received: by 10.223.185.116 with SMTP id b49csp4167834wrg; Mon, 19 Feb 2018 12:25:14 -0800 (PST) X-Google-Smtp-Source: AH8x227bS3GromfE7tj0HxdDgrzBLbyQeVfTjiWxjz9GK4dPtzkfV8tWwLBCpfw3JdSqCTe52Piz X-Received: by 2002:a17:902:62:: with SMTP id 89-v6mr15307283pla.178.1519071914018; Mon, 19 Feb 2018 12:25:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519071913; cv=none; d=google.com; s=arc-20160816; b=UqSWCONjKCswg/hZSJIajSbSfNj1l3qFJL/Gq5iwkFv195cb8XOz38FcgkfHSH8E5k 5qjzyLUwWuviDB7ojxYA6x67l73mYKSZsSVVhBmQgeeyrmU0MAeME6pH/spOvTk2HGZk 1v60Cbbx/knZtoAdgKsfrLZdsfdujvN5mw8gDu1R5Nn5yu/kfYSeIJ6mhJ7UevpRuROO /xhdWhsdJiCjET57RArYcreOlQsrCm37wGZuiFmz1oI9KzzNmlaXcWghLW4ZGEIMCY67 pV/dowBU5SWuORrZbmoPKG6PMT4tDkNscJ0dFQXXaMZHptJkVRDoTVmkT1rabugtKgPb eTLA== 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=XEYSN60oP1LVR+AVTjTtQMAoOlIMB2Z5MzGGNowgW7U=; b=Lggk5wjkyX9VTl8gywhsStISyiGbo684CQJkwS4c2V3U7ZaPIv1IncUST9NKn17Kq2 BLQifRZk0Uq3x7htCHjDern+OqXKQVSTPjvCoJjipdbybEOlPqU2xTUaspkTTfWbZSnb AeZ4FxKwGwPl7HHFBJmQhhvhy0hxyaDlaDb9ypMZIugmp9W/Z80YhmdntlsTq1Hyo86I e9MyHZXNskD6Xs6K7YV0KiyTKmdNBBtIGJYVPVgRIVSNqbsngBT4LmcPfGrpeqlFR+q6 ZYs+hioRuC3KpfIrH1sNdYfhTIj7Nc9ZZ6GpwawG3kjYe0QvnFuk34ObokM4j6bPEjxI MWgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=Ey5iWAbR; 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 43-v6si4985754plb.548.2018.02.19.12.24.59; Mon, 19 Feb 2018 12:25:13 -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=Ey5iWAbR; 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 S932261AbeBSUXX (ORCPT + 99 others); Mon, 19 Feb 2018 15:23:23 -0500 Received: from vern.gendns.com ([206.190.152.46]:58604 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932215AbeBSUXN (ORCPT ); Mon, 19 Feb 2018 15:23:13 -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=XEYSN60oP1LVR+AVTjTtQMAoOlIMB2Z5MzGGNowgW7U=; b=Ey5iWAbR/fpxdOirtDYcJaX3+ lGKjyXbMigFAXQcCUeZjJbC+YqSVHzPP+rD+G0BdracgfoMVwCboQLi0LLWjY2p9yPpB6ikteVVLB zbpteHXX1OkKOfHQLSl9lUKzjQ1iYXNhbaz4KSFYjK/LoinI+Vj0ZKD2LXd9JA0vJVZWVaZeYQn75 xmq+Bmmzjn+ZIlRYa7Ed/8xpIOrsEwLfE/WmlvvY7dCG3QX6xCxfZALKLyGXtYfN8hDCYxxM+ciwQ rY7UomV/IPngF2SDHs48PcrKBxMIs1xjvyb1kRlI04yJ4MhbJ0MvmS9BxsCLFdoYVE0bYcXjd5QYm 51f9vPD1g==; 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 1enrwe-003xBV-Kf; Mon, 19 Feb 2018 15:21:52 -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 23/42] ARM: davinci: dm355: add new clock init using common clock framework Date: Mon, 19 Feb 2018 14:21:44 -0600 Message-Id: <1519071723-31790-24-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/dm355.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-dm355-evm.c | 2 + arch/arm/mach-davinci/board-dm355-leopard.c | 2 + arch/arm/mach-davinci/davinci.h | 1 + arch/arm/mach-davinci/dm355.c | 88 +++++++++++++++++++++++++---- 4 files changed, 81 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c index 9ef24513..711f723 100644 --- a/arch/arm/mach-davinci/board-dm355-evm.c +++ b/arch/arm/mach-davinci/board-dm355-evm.c @@ -384,6 +384,8 @@ static __init void dm355_evm_init(void) struct clk *aemif; int ret; + dm355_register_clocks(); + ret = dm355_gpio_register(); if (ret) pr_warn("%s: GPIO init failed: %d\n", __func__, ret); diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c index 3ebc89d..f46b185 100644 --- a/arch/arm/mach-davinci/board-dm355-leopard.c +++ b/arch/arm/mach-davinci/board-dm355-leopard.c @@ -233,6 +233,8 @@ static __init void dm355_leopard_init(void) struct clk *aemif; int ret; + dm355_register_clocks(); + ret = dm355_gpio_register(); if (ret) pr_warn("%s: GPIO init failed: %d\n", __func__, ret); diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h index 270cef8..6b6abf0a 100644 --- a/arch/arm/mach-davinci/davinci.h +++ b/arch/arm/mach-davinci/davinci.h @@ -84,6 +84,7 @@ int davinci_init_wdt(void); /* DM355 function declarations */ void dm355_init(void); void dm355_init_time(void); +void dm355_register_clocks(void); void dm355_init_spi0(unsigned chipselect_mask, const struct spi_board_info *info, unsigned len); void dm355_init_asp1(u32 evt_enable); diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index 0da7516..f53e07a 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c @@ -8,31 +8,34 @@ * 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 +#include #include -#include "psc.h" -#include #include -#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 #define DM355_UART2_BASE (IO_PHYS + 0x206000) #define DM355_OSD_BASE (IO_PHYS + 0x70200) @@ -43,6 +46,7 @@ */ #define DM355_REF_FREQ 24000000 /* 24 or 36 MHz */ +#ifndef CONFIG_COMMON_CLK static struct pll_data pll1_data = { .num = 1, .phys_base = DAVINCI_PLL1_BASE, @@ -382,7 +386,7 @@ static struct clk_lookup dm355_clks[] = { CLK(NULL, "usb", &usb_clk), CLK(NULL, NULL, NULL), }; - +#endif /*----------------------------------------------------------------------*/ static u64 dm355_spi0_dma_mask = DMA_BIT_MASK(32); @@ -1046,8 +1050,68 @@ void __init dm355_init(void) void __init dm355_init_time(void) { +#ifdef CONFIG_COMMON_CLK + struct clk *clk; + + clk = clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM355_REF_FREQ); + + davinci_timer_init(clk); +#else davinci_clk_init(dm355_clks); davinci_timer_init(&timer0_clk); +#endif +} + +static struct resource dm355_pll1_resources[] = { + { + .start = DAVINCI_PLL1_BASE, + .end = DAVINCI_PLL1_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device dm355_pll1_device = { + .name = "dm355-pll1", + .id = -1, + .resource = dm355_pll1_resources, + .num_resources = ARRAY_SIZE(dm355_pll1_resources), +}; + +static struct resource dm355_pll2_resources[] = { + { + .start = DAVINCI_PLL2_BASE, + .end = DAVINCI_PLL2_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device dm355_pll2_device = { + .name = "dm355-pll2", + .id = -1, + .resource = dm355_pll2_resources, + .num_resources = ARRAY_SIZE(dm355_pll2_resources), +}; + +static struct resource dm355_psc_resources[] = { + { + .start = DAVINCI_PWR_SLEEP_CNTRL_BASE, + .end = DAVINCI_PWR_SLEEP_CNTRL_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device dm355_psc_device = { + .name = "dm355-psc", + .id = -1, + .resource = dm355_psc_resources, + .num_resources = ARRAY_SIZE(dm355_psc_resources), +}; + +void __init dm355_register_clocks(void) +{ + platform_device_register(&dm355_pll1_device); + platform_device_register(&dm355_pll2_device); + platform_device_register(&dm355_psc_device); } int __init dm355_init_video(struct vpfe_config *vpfe_cfg, -- 2.7.4