From patchwork Sat Jan 20 03:20:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 10176243 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 0E41E60386 for ; Sat, 20 Jan 2018 03:23:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05A5A26E1A for ; Sat, 20 Jan 2018 03:23:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED87928795; Sat, 20 Jan 2018 03:23:29 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 4662126E1A for ; Sat, 20 Jan 2018 03:23:29 +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=vhBaiCk8R9A7gJSm2Be6CHNYxwfDTWhXBdlH0aX6vlE=; b=ah3v81i30Wn3og1FTamrme/ae3 Bhdqhdw+lD7zfIF4IQhj8UE1BjVZ9Zr1sIzjlJfWY/al3sNPOVE6J9DYol16UqWQ0/7edGnOwkW9m uaH5dPWsjFxyX7//Sda1ZFaBoWJAIYWfGNkq9lD4Vv/nVcCfObWXCBCk818AfaqRouXxHkD8GD66J EZnWG9fc2dYPX+eoPPfkR7Qt3cl0n6iVxdj04pMnPp9BQCsSAlKF4LU46vLzNg8VSJJXgXoO8GX/A Udm1lgF/b+4FKtKMlumcoJlFY+D6Gq4Nh0fsswGTENBisKuSdSa2VLSSVUJ65zFBS0D/+cb3HRmwH x7tklP3g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ecjkd-0007Vy-Gb; Sat, 20 Jan 2018 03:23:27 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ecjkJ-0007F7-IB for linux-arm-kernel@bombadil.infradead.org; Sat, 20 Jan 2018 03:23:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=SG42mxaHtlJaXzne13EpU7/iAQNB7lodqi6RkYjMVt8=; b=l9Nox1k4VSdbGhuWIBZeALiZv 554HBBwzvKa1H7YnDV29rJZ9OWAwt6IqSt89P4ZL1pMTNMM83QruL1seYdJ7pScrrpyaku4hv1Sex EdOAlNe8fORDXjwIRtcvmkHogBUA3eOJ9fcHmIKbkpyIiaCAY5gCxhCJWi/g6SRuYyoFthgNYrr9h coHHGbNrQg2OTitbDfEAEUohiZmT6DInrzho5bG88OuVF4miHBBkBbEBtPYe275gvzc8mutR1mQeA k6BbzpYqWeVGAfIQqpsjgQBc+gfVU2Jed9P0IwcW3OENkx2W2ZoN25JW8sv3xIUMprTh664dBBZJU 63To+M3iw==; Received: from vern.gendns.com ([206.190.152.46]) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ecjkD-0002gB-0C for linux-arm-kernel@lists.infradead.org; Sat, 20 Jan 2018 03:23:05 +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=SG42mxaHtlJaXzne13EpU7/iAQNB7lodqi6RkYjMVt8=; b=qQZeSPiQiH2J1+gokxnC+hTFo 3tZTvKoqm/pdFkAHSAkF4zydnYnyj+ehEf7yiz+E9aZy/hrv75hfQcqOD4yy6WWelO9llhPuexYpf DDWaDnBZbxsYSQ/tgoftH7cp8mw8qqlBLFeTUanwEDB42ge6KibEwZJxlhsLVDEUIA+uH50noxIP3 pXtmWLXNCq8kd3f3vH95gNrtVdlTvffCdszrlxmDiLA9q6HxdKbJuSvNhEbe6LFj8o5I8mvuJUdCu seb9CIydKVXQOCCKuWkSxQvTzVx4gqfpenCJHbFOv6Ysm+hKTv13bsk3OV2FORbR3W4ET5/YCXx/y BxeegvBXQ==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:44372 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1ecji5-002FtH-7A; Fri, 19 Jan 2018 22:20:50 -0500 From: David Lechner To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/6] ARM: da8xx: Move CFGCHIP registration to init_time Date: Fri, 19 Jan 2018 21:20:23 -0600 Message-Id: <1516418424-28686-6-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516418424-28686-1-git-send-email-david@lechnology.com> References: <1516418424-28686-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-20180120_032301_206315_03899262 X-CRM114-Status: GOOD ( 19.93 ) 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: David Lechner , Arnd Bergmann , Kevin Hilman , Adam Ford , Sekhar Nori , linux-kernel@vger.kernel.org, Kishon Vijay Abraham I , Bartosz Golaszewski , Lee Jones 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 moves the registration of the CFGCHIP syscon device to the init_time callback. This is in preparation of moving to the common clock framework. There are a number of clocks in this syscon device so it will be needed at this point in boot to register the clocks. In da850.c also move the PLL unlock code to make use of the CFGCHIP regmap. It makes more sense to have it in init_time anyway since it is related to clocks. Signed-off-by: David Lechner --- arch/arm/mach-davinci/board-da830-evm.c | 4 ---- arch/arm/mach-davinci/board-da850-evm.c | 4 ---- arch/arm/mach-davinci/board-mityomapl138.c | 4 ---- arch/arm/mach-davinci/board-omapl138-hawk.c | 4 ---- arch/arm/mach-davinci/da830.c | 1 + arch/arm/mach-davinci/da850.c | 28 ++++++++++++---------------- arch/arm/mach-davinci/devices-da8xx.c | 29 ++++------------------------- arch/arm/mach-davinci/include/mach/da8xx.h | 3 ++- 8 files changed, 19 insertions(+), 58 deletions(-) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index 7adf009..3a1a86c 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -551,10 +551,6 @@ static __init void da830_evm_init(void) struct davinci_soc_info *soc_info = &davinci_soc_info; int ret; - ret = da8xx_register_cfgchip(); - if (ret) - pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret); - ret = da830_register_gpio(); if (ret) pr_warn("%s: GPIO init failed: %d\n", __func__, ret); diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index d9d423d..3063478 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -1334,10 +1334,6 @@ static __init void da850_evm_init(void) { int ret; - ret = da8xx_register_cfgchip(); - if (ret) - pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret); - ret = da850_register_gpio(); if (ret) pr_warn("%s: GPIO init failed: %d\n", __func__, ret); diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index f9a725a..d1c8548 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -502,10 +502,6 @@ static void __init mityomapl138_init(void) { int ret; - ret = da8xx_register_cfgchip(); - if (ret) - pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret); - /* for now, no special EDMA channels are reserved */ ret = da850_register_edma(NULL); if (ret) diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index bc8a747..e2ba9da 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c @@ -281,10 +281,6 @@ static __init void omapl138_hawk_init(void) { int ret; - ret = da8xx_register_cfgchip(); - if (ret) - pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret); - ret = da850_register_gpio(); if (ret) pr_warn("%s: GPIO init failed: %d\n", __func__, ret); diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c index 350d767..39de5a6 100644 --- a/arch/arm/mach-davinci/da830.c +++ b/arch/arm/mach-davinci/da830.c @@ -1223,6 +1223,7 @@ void __init da830_init(void) void __init da830_init_time(void) { + da8xx_register_cfgchip(); davinci_clk_init(da830_clks); davinci_timer_init(); } diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 34117e61..5c86d77 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include @@ -40,10 +42,6 @@ #define DA850_REF_FREQ 24000000 -#define CFGCHIP3_ASYNC3_CLKSRC BIT(4) -#define CFGCHIP3_PLL1_MASTER_LOCK BIT(5) -#define CFGCHIP0_PLL_MASTER_LOCK BIT(4) - static int da850_set_armrate(struct clk *clk, unsigned long rate); static int da850_round_armrate(struct clk *clk, unsigned long rate); static int da850_set_pll0rate(struct clk *clk, unsigned long armrate); @@ -1370,8 +1368,6 @@ static const struct davinci_soc_info davinci_soc_info_da850 = { void __init da850_init(void) { - unsigned int v; - davinci_common_init(&davinci_soc_info_da850); da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K); @@ -1381,20 +1377,20 @@ void __init da850_init(void) da8xx_syscfg1_base = ioremap(DA8XX_SYSCFG1_BASE, SZ_4K); if (WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module")) return; - - /* Unlock writing to PLL0 registers */ - v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG)); - v &= ~CFGCHIP0_PLL_MASTER_LOCK; - __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG)); - - /* Unlock writing to PLL1 registers */ - v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); - v &= ~CFGCHIP3_PLL1_MASTER_LOCK; - __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); } void __init da850_init_time(void) { + struct regmap *cfgchip; + + cfgchip = da8xx_register_cfgchip(); + if (WARN(IS_ERR(cfgchip), "failed to register CFGCHIP syscon")) + return; + + /* Unlock writing to PLL registers */ + regmap_write_bits(cfgchip, CFGCHIP(0), CFGCHIP0_PLL_MASTER_LOCK, 0); + regmap_write_bits(cfgchip, CFGCHIP(3), CFGCHIP3_PLL1_MASTER_LOCK, 0); + davinci_clk_init(da850_clks); davinci_timer_init(); } diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index fe5e15a..44cda0a 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c @@ -11,7 +11,7 @@ * (at your option) any later version. */ #include -#include +#include #include #include #include @@ -1105,29 +1105,8 @@ int __init da850_register_sata(unsigned long refclkpn) } #endif -static struct syscon_platform_data da8xx_cfgchip_platform_data = { - .label = "cfgchip", -}; - -static struct resource da8xx_cfgchip_resources[] = { - { - .start = DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP0_REG, - .end = DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP4_REG + 3, - .flags = IORESOURCE_MEM, - }, -}; - -static struct platform_device da8xx_cfgchip_device = { - .name = "syscon", - .id = -1, - .dev = { - .platform_data = &da8xx_cfgchip_platform_data, - }, - .num_resources = ARRAY_SIZE(da8xx_cfgchip_resources), - .resource = da8xx_cfgchip_resources, -}; - -int __init da8xx_register_cfgchip(void) +struct regmap * __init da8xx_register_cfgchip(void) { - return platform_device_register(&da8xx_cfgchip_device); + return syscon_register(DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP0_REG, + sizeof(u32) * 5, "ti,da830-cfgchip"); } diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 3481a0d..7a40ec7 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -125,7 +126,7 @@ void da8xx_rproc_reserve_cma(void); int da8xx_register_rproc(void); int da850_register_gpio(void); int da830_register_gpio(void); -int da8xx_register_cfgchip(void); +struct regmap *da8xx_register_cfgchip(void); extern struct platform_device da8xx_serial_device[]; extern struct emac_platform_data da8xx_emac_pdata;