Received: by 10.223.176.5 with SMTP id f5csp888924wra; Fri, 9 Feb 2018 08:49:48 -0800 (PST) X-Google-Smtp-Source: AH8x227gh/r3cWd3FjICWiRxv+WZRVLZHcdxWGn1PM9PQrtEuCJoNzExJR9kiPPeX0+ALms2NLzQ X-Received: by 10.98.254.21 with SMTP id z21mr3492013pfh.48.1518194988068; Fri, 09 Feb 2018 08:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518194988; cv=none; d=google.com; s=arc-20160816; b=LB4YLA3n3zjLXY3TEXYuMrOSTw0Ph/WtyYqPc2/Osza8qqsmYV2tSQzSgZdA7JlIq+ 1g2//eUY3N9w7JkM4/VoBuKwP4Iz3e83tNMa8nvvRD95yE1TYy97vAz5mlGhlDIdqcPc FJ98dr45YDZ2CeQYdp6x8orN53Syo3QsKszzKbpkMv685bIj7b1SqFd7Xyc2gam13Ft0 ptFCq+uAP7vWKNsDY7oNpUb+JR3P9ZYpl3wANxMkvaQOAlReSo6zFBlHx09Lvx9Ne0HZ z+DRpRfu7O9BdCyzcvkwoYmqtYsPWJ9Q+RynCZ6izioiTo9xV0owwf1U0lMTp0hcESSZ 8aCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=j9jJyHGKi+abTvPtkND+K0SoCKm5aevEoCAv9tGYSVw=; b=Gp/lS1H0KlG+OdZZvDr2nlAuUVtCJ1XmbNs0L4pTPreiv+vzhF1UmguX/ZXVFk6crt W16MVjfNfV6p01Ms4tJdWuCvLJvUZobso8kdyamP9y7pSvaVXtEEkYXigOLJol1UvEft 6Ul8AtgV7On+wBSVpfcHkOkZwCzVp5BBp0Adodh4jG4xsCtOwuZhQT0QMqY1dMKRPCNl diblt5rtObG8RFh+qlDuNVpUH9k5oRE5MnWjCqqaGUmTjKn0omaYY7vslwu1t5OtpPyR 5X70o7bToisDGfBh/rYBsnUoQ76MANgeVvt4lxkUaK6hafUEt1bsMAC44o+OUzMHxOpf j/ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=xXfLilrs; 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 y4si1516443pgp.800.2018.02.09.08.49.32; Fri, 09 Feb 2018 08:49:48 -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=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=xXfLilrs; 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 S1751166AbeBIQsx (ORCPT + 99 others); Fri, 9 Feb 2018 11:48:53 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:37562 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751029AbeBIQsv (ORCPT ); Fri, 9 Feb 2018 11:48:51 -0500 Received: by mail-ot0-f195.google.com with SMTP id e64so8285605ote.4 for ; Fri, 09 Feb 2018 08:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=j9jJyHGKi+abTvPtkND+K0SoCKm5aevEoCAv9tGYSVw=; b=xXfLilrs2QUxq7PJIKM3bLAn56WMSv/92CNtiv0RBQEm6sAqcSU2i0YqYvZ4UxHB2c pXFMLxTi1gF9dzmFM2/Lzrsv9qM5S7EKYR+NDfQR5I5Zucr1oENTrOAcI0Evj4LEU9T5 axVlVad6+v2JRY0NlSRY1ArZMA4k76PCoh6fYijpLmCRNZhgtJui+4WuUSLhRDox6evb 6Sy2OuWxqtdYvHYFyr3J015JdJC94y7Qd0rKOlK4dpYSPPpzMZRGLknkcUBzti6v9ro7 HpefNCKyfQCFlBtKi4tBv9QAynHSbThFu5j2tBFnCedL0+GPFGbMMjjz4yYHyxQ78oXU 9/zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=j9jJyHGKi+abTvPtkND+K0SoCKm5aevEoCAv9tGYSVw=; b=Uc5zrf2rhkgn3m7ffS43gvvjitwm0d3a2AECtYqM42lgN5SxM1H0rbg8VsPcNT/7Ub 89WxdNEECY75B0f1BiqaDo7hi4Y+8HGu91NYeIApDb3ixTCI5UUdGwUh6JlSwcxfcGX8 wg0oBQQG1l0E0tHH7Rm85nMNIWTiFZc1rDw9bqfjbo1f5BhOH2JfqbJJVsZABeNQFVac 1xNSIzbM6ZOmSNpayKHqirDXq8JEP1S/fmbcwHtNK3jC935fE0OS31De/FM+1PGx5AJG dE82llBJC6TNLEqbHmjdPLn3iIjKCIw0sUcGNTkoUSAr6z3RWTw3JRZDdaRL/renB2VH DaNA== X-Gm-Message-State: APf1xPBcjELf5lmHF2sb7AgBB58PVj8/nK7zg0Q5xFkoeWFZMAHig7Ds DEKIVxL84obJHuhSZER1MOhr4LcyLuhOKE+WcucpSg== X-Received: by 10.157.34.194 with SMTP id y60mr2867716ota.346.1518194931056; Fri, 09 Feb 2018 08:48:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.35.132 with HTTP; Fri, 9 Feb 2018 08:48:20 -0800 (PST) In-Reply-To: References: <1515377863-20358-1-git-send-email-david@lechnology.com> <1515377863-20358-13-git-send-email-david@lechnology.com> From: Michael Turquette Date: Fri, 9 Feb 2018 08:48:20 -0800 Message-ID: Subject: Re: [PATCH v5 12/44] clk: davinci: Add platform information for TI DA850 PSC To: Bartosz Golaszewski Cc: David Lechner , linux-clk , devicetree , Linux ARM , Stephen Boyd , Rob Herring , Mark Rutland , Sekhar Nori , Kevin Hilman , Adam Ford , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bartosz, all, On Fri, Feb 9, 2018 at 8:22 AM, Bartosz Golaszewski wrote: > 2018-01-08 3:17 GMT+01:00 David Lechner : >> This adds platform-specific declarations for the PSC clocks on TI DA850/ >> OMAP-L138/AM18XX SoCs. >> >> Signed-off-by: David Lechner >> --- >> drivers/clk/davinci/Makefile | 1 + >> drivers/clk/davinci/psc-da850.c | 117 ++++++++++++++++++++++++++++++++++++++++ >> include/linux/clk/davinci.h | 1 + >> 3 files changed, 119 insertions(+) >> create mode 100644 drivers/clk/davinci/psc-da850.c >> >> diff --git a/drivers/clk/davinci/Makefile b/drivers/clk/davinci/Makefile >> index fb14c8c..aef0390 100644 >> --- a/drivers/clk/davinci/Makefile >> +++ b/drivers/clk/davinci/Makefile >> @@ -11,4 +11,5 @@ obj-$(CONFIG_ARCH_DAVINCI_DM646x) += pll-dm646x.o >> >> obj-y += psc.o >> obj-$(CONFIG_ARCH_DAVINCI_DA830) += psc-da830.o >> +obj-$(CONFIG_ARCH_DAVINCI_DA850) += psc-da850.o >> endif >> diff --git a/drivers/clk/davinci/psc-da850.c b/drivers/clk/davinci/psc-da850.c >> new file mode 100644 >> index 0000000..3b4583d >> --- /dev/null >> +++ b/drivers/clk/davinci/psc-da850.c >> @@ -0,0 +1,117 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * PSC clock descriptions for TI DA850/OMAP-L138/AM18XX >> + * >> + * Copyright (C) 2017 David Lechner >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include "psc.h" >> + >> +static const struct davinci_psc_clk_info da850_psc0_info[] __initconst = { >> + LPSC(0, 0, tpcc0, pll0_sysclk2, LPSC_ALWAYS_ENABLED), >> + LPSC(1, 0, tptc0, pll0_sysclk2, LPSC_ALWAYS_ENABLED), >> + LPSC(2, 0, tptc1, pll0_sysclk2, LPSC_ALWAYS_ENABLED), >> + LPSC(3, 0, aemif, pll0_sysclk3, 0), >> + LPSC(4, 0, spi0, pll0_sysclk2, 0), >> + LPSC(5, 0, mmcsd0, pll0_sysclk2, 0), >> + LPSC(6, 0, aintc, pll0_sysclk4, LPSC_ALWAYS_ENABLED), >> + LPSC(7, 0, arm_rom, pll0_sysclk2, LPSC_ALWAYS_ENABLED), >> + LPSC(9, 0, uart0, pll0_sysclk2, 0), >> + LPSC(13, 0, pruss, pll0_sysclk2, 0), >> + LPSC(14, 0, arm, pll0_sysclk6, LPSC_ALWAYS_ENABLED), >> + LPSC(15, 1, dsp, pll0_sysclk1, LPSC_FORCE | LPSC_LOCAL_RESET), >> + { } >> +}; >> + >> +static const struct davinci_psc_clk_info da850_psc1_info[] __initconst = { >> + LPSC(0, 0, tpcc1, pll0_sysclk2, LPSC_ALWAYS_ENABLED), >> + LPSC(1, 0, usb0, pll0_sysclk2, 0), >> + LPSC(2, 0, usb1, pll0_sysclk4, 0), >> + LPSC(3, 0, gpio, pll0_sysclk4, 0), >> + LPSC(5, 0, emac, pll0_sysclk4, 0), >> + LPSC(6, 0, emif3, pll0_sysclk5, LPSC_ALWAYS_ENABLED), >> + LPSC(7, 0, mcasp0, async3, 0), >> + LPSC(8, 0, sata, pll0_sysclk2, LPSC_FORCE), >> + LPSC(9, 0, vpif, pll0_sysclk2, 0), >> + LPSC(10, 0, spi1, async3, 0), >> + LPSC(11, 0, i2c1, pll0_sysclk4, 0), >> + LPSC(12, 0, uart1, async3, 0), >> + LPSC(13, 0, uart2, async3, 0), >> + LPSC(14, 0, mcbsp0, async3, 0), >> + LPSC(15, 0, mcbsp1, async3, 0), >> + LPSC(16, 0, lcdc, pll0_sysclk2, 0), >> + LPSC(17, 0, ehrpwm, async3, 0), >> + LPSC(18, 0, mmcsd1, pll0_sysclk2, 0), >> + LPSC(20, 0, ecap, async3, 0), >> + LPSC(21, 0, tptc2, pll0_sysclk2, LPSC_ALWAYS_ENABLED), >> + { } >> +}; >> + >> +void __init da850_psc_clk_init(void __iomem *psc0, void __iomem *psc1) >> +{ >> + struct clk_onecell_data *clk_data; >> + >> + clk_data = davinci_psc_register_clocks(psc0, da850_psc0_info, 16); >> + if (!clk_data) >> + return; >> + >> + clk_register_clkdev(clk_data->clks[3], NULL, "ti-aemif"); >> + clk_register_clkdev(clk_data->clks[3], "aemif", "davinci-nand.0"); >> + clk_register_clkdev(clk_data->clks[4], NULL, "spi_davinci.0"); >> + clk_register_clkdev(clk_data->clks[5], NULL, "da830-mmc.0"); >> + clk_register_clkdev(clk_data->clks[9], NULL, "serial8250.0"); >> + clk_register_clkdev(clk_data->clks[14], "arm", NULL); >> + clk_register_clkdev(clk_data->clks[15], NULL, "davinci-rproc.0"); >> + >> + clk_free_onecell_data(clk_data); >> + >> + clk_data = davinci_psc_register_clocks(psc1, da850_psc1_info, 32); >> + if (!clk_data) >> + return; >> + >> + clk_register_clkdev(clk_data->clks[1], "usb20_psc_clk", NULL); >> + clk_register_clkdev(clk_data->clks[1], NULL, "musb-da8xx"); >> + clk_register_clkdev(clk_data->clks[1], NULL, "cppi41-dmaengine"); >> + clk_register_clkdev(clk_data->clks[2], NULL, "ohci-da8xx"); >> + clk_register_clkdev(clk_data->clks[3], "gpio", NULL); >> + clk_register_clkdev(clk_data->clks[5], NULL, "davinci_emac.1"); >> + clk_register_clkdev(clk_data->clks[5], "fck", "davinci_mdio.0"); >> + clk_register_clkdev(clk_data->clks[7], NULL, "davinci-mcasp.0"); >> + clk_register_clkdev(clk_data->clks[8], "fck", "ahci_da850"); >> + clk_register_clkdev(clk_data->clks[9], NULL, "vpif"); >> + clk_register_clkdev(clk_data->clks[10], NULL, "spi_davinci.1"); >> + clk_register_clkdev(clk_data->clks[11], NULL, "i2c_davinci.2"); >> + clk_register_clkdev(clk_data->clks[12], NULL, "serial8250.1"); >> + clk_register_clkdev(clk_data->clks[13], NULL, "serial8250.2"); >> + clk_register_clkdev(clk_data->clks[14], NULL, "davinci-mcbsp.0"); >> + clk_register_clkdev(clk_data->clks[15], NULL, "davinci-mcbsp.1"); >> + clk_register_clkdev(clk_data->clks[16], "fck", "da8xx_lcdc.0"); >> + clk_register_clkdev(clk_data->clks[17], "fck", "ehrpwm.0"); >> + clk_register_clkdev(clk_data->clks[17], "fck", "ehrpwm.1"); >> + clk_register_clkdev(clk_data->clks[18], NULL, "da830-mmc.1"); >> + clk_register_clkdev(clk_data->clks[20], "fck", "ecap.0"); >> + clk_register_clkdev(clk_data->clks[20], "fck", "ecap.1"); >> + clk_register_clkdev(clk_data->clks[20], "fck", "ecap.2"); >> + >> + clk_free_onecell_data(clk_data); >> +} >> + >> +#ifdef CONFIG_OF >> +static void __init of_da850_psc0_clk_init(struct device_node *node) >> +{ >> + of_davinci_psc_clk_init(node, da850_psc0_info, 16); >> +} >> +CLK_OF_DECLARE(da850_psc0_clk, "ti,da850-psc0", of_da850_psc0_clk_init); >> + >> +static void __init of_da850_psc1_clk_init(struct device_node *node) >> +{ >> + of_davinci_psc_clk_init(node, da850_psc1_info, 32); >> +} >> +CLK_OF_DECLARE(da850_psc1_clk, "ti,da850-psc1", of_da850_psc1_clk_init); >> +#endif >> diff --git a/include/linux/clk/davinci.h b/include/linux/clk/davinci.h >> index 3ec8100..3d8bdfa 100644 >> --- a/include/linux/clk/davinci.h >> +++ b/include/linux/clk/davinci.h >> @@ -17,5 +17,6 @@ void dm644x_pll_clk_init(void __iomem *pll1, void __iomem *pll2); >> void dm646x_pll_clk_init(void __iomem *pll1, void __iomem *pll2); >> >> void da830_psc_clk_init(void __iomem *psc0, void __iomem *psc1); >> +void da850_psc_clk_init(void __iomem *psc0, void __iomem *psc1); >> >> #endif /* __LINUX_CLK_DAVINCI_H__ */ >> -- >> 2.7.4 >> > > Hi David, > > I've been working on moving the genpd code from its own driver to the > psc one. I couldn't get the system to boot though and problems > happened very early in the boot sequence. I struggled to figure out > what's happening, but eventually I noticed that psc uses > CLK_OF_DECLARE() to initialize clocks. The functions registered this > way are called very early in the boot sequence, way before > late_initcall() in which the genpd framework is initialized. This of > course makes it impossible to register genpd at the same time we > register PSCs. > > Mike, Stephen - it would be great if you could confirm, but I believe > the clock framework now only accepts clock drivers which create real > platform drivers, in which case this series would need to be modified. You are correct. All new uses of CLK_OF_DECLARE are met with high suspicion, and all new drivers should be platform drivers. There are cases when CLK_OF_DECLARE is necessary (sometimes temporarily while things are reworked), but it seems this is not the case for this driver based on your testing of the platform driver approach. Please use the platform driver approach instead. Thanks, Mike > > David: FYI I quickly converted the functions in psc-da850.c to actual > probe callbacks and it worked just fine on a da850-lcdk board. > > Best regards, > Bartosz Golaszewski