All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerhard Sittig <gsi@denx.de>
To: linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	Anatolij Gustschin <agust@denx.de>,
	Mike Turquette <mturquette@linaro.org>
Cc: Scott Wood <scottwood@freescale.com>,
	Gerhard Sittig <gsi@denx.de>, Detlev Zundel <dzu@denx.de>
Subject: [PATCH v5 17/17] clk: mpc512x: remove migration support workarounds
Date: Mon, 18 Nov 2013 00:06:17 +0100	[thread overview]
Message-ID: <1384729577-7336-18-git-send-email-gsi@denx.de> (raw)
In-Reply-To: <1384729577-7336-1-git-send-email-gsi@denx.de>

this change removes workarounds which have become obsolete after
migration to common clock support has completed
- remove clkdev registration calls (compatibility clock item aliases)
  after all peripheral drivers were adjusted for device tree based
  clock lookup
- remove pre-enable workarounds after all peripheral drivers were
  adjusted to acquire their respective clock items

workarounds for these clock items get removed:  FEC (ethernet), I2C,
PSC (UART, SPI), PSC FIFO, USB, NFC (NAND flash), VIU (video capture),
BDLC (CAN), CAN MCLK, DIU (video output)

these clkdev registered names won't be provided any longer by the
MPC512x platform's clock driver:  "psc%d_mclk", "mscan%d_mclk",
"usb%d_clk", "nfc_clk", "viu_clk", "sys_clk", "ref_clk"

the pre-enable workaround for PCI remains, but depends on the presence
of PCI related device tree nodes (disables the PCI clock in the absence
of PCI nodes, keeps the PCI clock enabled in the presence of nodes) --
moving clock acquisition into the peripheral driver isn't possible for
PCI because its initialization takes place before the platform clock
driver gets initialized, thus the clock provider isn't available then

Cc: Mike Turquette <mturquette@linaro.org>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Gerhard Sittig <gsi@denx.de>
---
 arch/powerpc/platforms/512x/clock-commonclk.c |   50 ++++++++-----------------
 1 file changed, 16 insertions(+), 34 deletions(-)

diff --git a/arch/powerpc/platforms/512x/clock-commonclk.c b/arch/powerpc/platforms/512x/clock-commonclk.c
index c1faf3a9ea1f..b1fbdcbc68b7 100644
--- a/arch/powerpc/platforms/512x/clock-commonclk.c
+++ b/arch/powerpc/platforms/512x/clock-commonclk.c
@@ -695,46 +695,28 @@ static void mpc5121_clk_register_of_provider(struct device_node *np)
  */
 static void mpc5121_clk_provide_migration_support(void)
 {
-	int idx;
-	char name[32];
-
-	/*
-	 * provide "pre-CCF" alias clock names for peripheral drivers
-	 * which have not yet been adjusted to do OF based clock lookups
-	 */
-	clk_register_clkdev(clks[MPC512x_CLK_REF], "ref_clk", NULL);
-	clk_register_clkdev(clks[MPC512x_CLK_SYS], "sys_clk", NULL);
-	clk_register_clkdev(clks[MPC512x_CLK_VIU], "viu_clk", NULL);
-	clk_register_clkdev(clks[MPC512x_CLK_NFC], "nfc_clk", NULL);
-	clk_register_clkdev(clks[MPC512x_CLK_USB1], "usb1_clk", NULL);
-	clk_register_clkdev(clks[MPC512x_CLK_USB2], "usb2_clk", NULL);
-	for (idx = 0; idx < NR_PSCS; idx++) {
-		snprintf(name, sizeof(name), "psc%d_mclk", idx);
-		clk_register_clkdev(clks[MPC512x_CLK_PSC0_MCLK + idx],
-				    name, NULL);
-	}
-	for (idx = 0; idx < NR_MSCANS; idx++) {
-		snprintf(name, sizeof(name), "mscan%d_mclk", idx);
-		clk_register_clkdev(clks[MPC512x_CLK_MSCAN0_MCLK + idx],
-				    name, NULL);
-	}
-	clk_register_clkdev(clks[MPC512x_CLK_SPDIF_MCLK], "spdif_mclk", NULL);
 
 	/*
 	 * pre-enable those clock items which are not yet appropriately
 	 * acquired by their peripheral driver
+	 *
+	 * the PCI clock cannot get acquired by its peripheral driver,
+	 * because for this platform the driver won't probe(), instead
+	 * initialization is done from within the .setup_arch() routine
+	 * at a point in time where the clock provider has not been
+	 * setup yet and thus isn't available yet
+	 *
+	 * so we "pre-enable" the clock here, to not have the clock
+	 * subsystem automatically disable this item in a late init call
+	 *
+	 * this PCI clock pre-enable workaround only applies when there
+	 * are device tree nodes for PCI and thus the peripheral driver
+	 * has attached to bridges, otherwise the PCI clock remains
+	 * unused and so it gets disabled
 	 */
-	clk_prepare_enable(clks[MPC512x_CLK_PSC_FIFO]);
 	clk_prepare_enable(clks[MPC512x_CLK_PSC3_MCLK]);/* serial console */
-	clk_prepare_enable(clks[MPC512x_CLK_FEC]);	/* network, NFS */
-	clk_prepare_enable(clks[MPC512x_CLK_DIU]);	/* display */
-	clk_prepare_enable(clks[MPC512x_CLK_I2C]);	/* I2C */
-	for (idx = 0; idx < NR_PSCS; idx++)		/* PSC ipg */
-		clk_prepare_enable(clks[MPC512x_CLK_PSC0 + idx]);
-	clk_prepare_enable(clks[MPC512x_CLK_BDLC]);	/* MSCAN ipg */
-	for (idx = 0; idx < NR_MSCANS; idx++)		/* MSCAN mclk */
-		clk_prepare_enable(clks[MPC512x_CLK_MSCAN0_MCLK + idx]);
-	clk_prepare_enable(clks[MPC512x_CLK_PCI]);	/* PCI */
+	if (of_find_compatible_node(NULL, "pci", "fsl,mpc5121-pci"))
+		clk_prepare_enable(clks[MPC512x_CLK_PCI]);
 }
 
 /*
-- 
1.7.10.4

WARNING: multiple messages have this Message-ID (diff)
From: gsi@denx.de (Gerhard Sittig)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 17/17] clk: mpc512x: remove migration support workarounds
Date: Mon, 18 Nov 2013 00:06:17 +0100	[thread overview]
Message-ID: <1384729577-7336-18-git-send-email-gsi@denx.de> (raw)
In-Reply-To: <1384729577-7336-1-git-send-email-gsi@denx.de>

this change removes workarounds which have become obsolete after
migration to common clock support has completed
- remove clkdev registration calls (compatibility clock item aliases)
  after all peripheral drivers were adjusted for device tree based
  clock lookup
- remove pre-enable workarounds after all peripheral drivers were
  adjusted to acquire their respective clock items

workarounds for these clock items get removed:  FEC (ethernet), I2C,
PSC (UART, SPI), PSC FIFO, USB, NFC (NAND flash), VIU (video capture),
BDLC (CAN), CAN MCLK, DIU (video output)

these clkdev registered names won't be provided any longer by the
MPC512x platform's clock driver:  "psc%d_mclk", "mscan%d_mclk",
"usb%d_clk", "nfc_clk", "viu_clk", "sys_clk", "ref_clk"

the pre-enable workaround for PCI remains, but depends on the presence
of PCI related device tree nodes (disables the PCI clock in the absence
of PCI nodes, keeps the PCI clock enabled in the presence of nodes) --
moving clock acquisition into the peripheral driver isn't possible for
PCI because its initialization takes place before the platform clock
driver gets initialized, thus the clock provider isn't available then

Cc: Mike Turquette <mturquette@linaro.org>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linuxppc-dev at lists.ozlabs.org
Signed-off-by: Gerhard Sittig <gsi@denx.de>
---
 arch/powerpc/platforms/512x/clock-commonclk.c |   50 ++++++++-----------------
 1 file changed, 16 insertions(+), 34 deletions(-)

diff --git a/arch/powerpc/platforms/512x/clock-commonclk.c b/arch/powerpc/platforms/512x/clock-commonclk.c
index c1faf3a9ea1f..b1fbdcbc68b7 100644
--- a/arch/powerpc/platforms/512x/clock-commonclk.c
+++ b/arch/powerpc/platforms/512x/clock-commonclk.c
@@ -695,46 +695,28 @@ static void mpc5121_clk_register_of_provider(struct device_node *np)
  */
 static void mpc5121_clk_provide_migration_support(void)
 {
-	int idx;
-	char name[32];
-
-	/*
-	 * provide "pre-CCF" alias clock names for peripheral drivers
-	 * which have not yet been adjusted to do OF based clock lookups
-	 */
-	clk_register_clkdev(clks[MPC512x_CLK_REF], "ref_clk", NULL);
-	clk_register_clkdev(clks[MPC512x_CLK_SYS], "sys_clk", NULL);
-	clk_register_clkdev(clks[MPC512x_CLK_VIU], "viu_clk", NULL);
-	clk_register_clkdev(clks[MPC512x_CLK_NFC], "nfc_clk", NULL);
-	clk_register_clkdev(clks[MPC512x_CLK_USB1], "usb1_clk", NULL);
-	clk_register_clkdev(clks[MPC512x_CLK_USB2], "usb2_clk", NULL);
-	for (idx = 0; idx < NR_PSCS; idx++) {
-		snprintf(name, sizeof(name), "psc%d_mclk", idx);
-		clk_register_clkdev(clks[MPC512x_CLK_PSC0_MCLK + idx],
-				    name, NULL);
-	}
-	for (idx = 0; idx < NR_MSCANS; idx++) {
-		snprintf(name, sizeof(name), "mscan%d_mclk", idx);
-		clk_register_clkdev(clks[MPC512x_CLK_MSCAN0_MCLK + idx],
-				    name, NULL);
-	}
-	clk_register_clkdev(clks[MPC512x_CLK_SPDIF_MCLK], "spdif_mclk", NULL);
 
 	/*
 	 * pre-enable those clock items which are not yet appropriately
 	 * acquired by their peripheral driver
+	 *
+	 * the PCI clock cannot get acquired by its peripheral driver,
+	 * because for this platform the driver won't probe(), instead
+	 * initialization is done from within the .setup_arch() routine
+	 *@a point in time where the clock provider has not been
+	 * setup yet and thus isn't available yet
+	 *
+	 * so we "pre-enable" the clock here, to not have the clock
+	 * subsystem automatically disable this item in a late init call
+	 *
+	 * this PCI clock pre-enable workaround only applies when there
+	 * are device tree nodes for PCI and thus the peripheral driver
+	 * has attached to bridges, otherwise the PCI clock remains
+	 * unused and so it gets disabled
 	 */
-	clk_prepare_enable(clks[MPC512x_CLK_PSC_FIFO]);
 	clk_prepare_enable(clks[MPC512x_CLK_PSC3_MCLK]);/* serial console */
-	clk_prepare_enable(clks[MPC512x_CLK_FEC]);	/* network, NFS */
-	clk_prepare_enable(clks[MPC512x_CLK_DIU]);	/* display */
-	clk_prepare_enable(clks[MPC512x_CLK_I2C]);	/* I2C */
-	for (idx = 0; idx < NR_PSCS; idx++)		/* PSC ipg */
-		clk_prepare_enable(clks[MPC512x_CLK_PSC0 + idx]);
-	clk_prepare_enable(clks[MPC512x_CLK_BDLC]);	/* MSCAN ipg */
-	for (idx = 0; idx < NR_MSCANS; idx++)		/* MSCAN mclk */
-		clk_prepare_enable(clks[MPC512x_CLK_MSCAN0_MCLK + idx]);
-	clk_prepare_enable(clks[MPC512x_CLK_PCI]);	/* PCI */
+	if (of_find_compatible_node(NULL, "pci", "fsl,mpc5121-pci"))
+		clk_prepare_enable(clks[MPC512x_CLK_PCI]);
 }
 
 /*
-- 
1.7.10.4

  parent reply	other threads:[~2013-11-17 23:09 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-17 23:06 [PATCH v5 00/17] add COMMON_CLK support for PowerPC MPC512x Gerhard Sittig
2013-11-17 23:06 ` Gerhard Sittig
2013-11-17 23:06 ` Gerhard Sittig
2013-11-17 23:06 ` Gerhard Sittig
2013-11-17 23:06 ` Gerhard Sittig
2013-11-17 23:06 ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 01/17] powerpc/fsl-pci: improve clock API use Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-19 22:41   ` Scott Wood
2013-11-19 22:41     ` Scott Wood
2013-11-21  9:21     ` Gerhard Sittig
2013-11-21  9:21       ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 04/17] clk: mpc512x: introduce COMMON_CLK for MPC512x (disabled) Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 05/17] clk: mpc512x: add backwards compat to the CCF code Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 07/17] clk: mpc5xxx: switch to COMMON_CLK, retire PPC_CLOCK Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
     [not found] ` <1384729577-7336-1-git-send-email-gsi-ynQEQJNshbs@public.gmane.org>
2013-11-17 23:06   ` [PATCH v5 02/17] dts: mpc512x: introduce dt-bindings/clock/ header Gerhard Sittig
2013-11-17 23:06     ` Gerhard Sittig
2013-11-17 23:06     ` Gerhard Sittig
2013-11-17 23:06   ` [PATCH v5 03/17] dts: mpc512x: add clock related device tree specs Gerhard Sittig
2013-11-17 23:06     ` Gerhard Sittig
2013-11-17 23:06     ` Gerhard Sittig
2013-11-17 23:06   ` [PATCH v5 06/17] dts: mpc512x: add clock specs for client lookups Gerhard Sittig
2013-11-17 23:06     ` Gerhard Sittig
2013-11-17 23:06     ` Gerhard Sittig
2013-11-17 23:06   ` [PATCH v5 08/17] spi: mpc512x: adjust to OF based clock lookup Gerhard Sittig
2013-11-17 23:06     ` Gerhard Sittig
2013-11-17 23:06     ` Gerhard Sittig
2013-11-25 17:30     ` Mark Brown
2013-11-25 17:30       ` Mark Brown
2013-11-25 17:30       ` Mark Brown
     [not found]       ` <20131125173008.GQ14725-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-11-25 19:06         ` Gerhard Sittig
2013-11-25 19:06           ` Gerhard Sittig
2013-11-25 19:06           ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 09/17] serial: mpc512x: adjust for " Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 10/17] serial: mpc512x: setup the PSC FIFO clock as well Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 11/17] USB: fsl-mph-dr-of: adjust for OF based clock lookup Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 12/17] mtd: mpc5121_nfc: " Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 13/17] [media] fsl-viu: " Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 14/17] net: can: mscan: adjust to common clock support for mpc512x Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 15/17] net: can: mscan: remove non-CCF code for MPC512x Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06 ` [PATCH v5 16/17] powerpc/mpc512x: improve DIU related clock setup Gerhard Sittig
2013-11-17 23:06   ` Gerhard Sittig
2013-11-17 23:06 ` Gerhard Sittig [this message]
2013-11-17 23:06   ` [PATCH v5 17/17] clk: mpc512x: remove migration support workarounds Gerhard Sittig
2013-11-24 18:39 ` [PATCH v5 00/17] add COMMON_CLK support for PowerPC MPC512x Gerhard Sittig
2013-11-24 18:39   ` Gerhard Sittig
2013-11-24 18:39   ` Gerhard Sittig
2013-11-24 18:39   ` Gerhard Sittig
2013-11-24 18:39   ` Gerhard Sittig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384729577-7336-18-git-send-email-gsi@denx.de \
    --to=gsi@denx.de \
    --cc=agust@denx.de \
    --cc=dzu@denx.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mturquette@linaro.org \
    --cc=scottwood@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.