Skip to contentSkip to conversation

powerpc/512x: update COMMON_CLK support for MPC5125

PATCH In review Gerhard Sittig 6 participants 12 messages Dec 10, 2013 – Dec 18, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover powerpc/512x: update COMMON_CLK support for MPC5125

this series improves the previously introduced common clock support for MPC512x such that SoC variants 5123 and 5125 get addressed appropriately (MPC5125 turned out to be rather different from MPC5121 than I perceived before -- there is much more than "just two FECs and no MBX")

thus this series depends on "add COMMON_CLK support for PowerPC MPC512x" (v6 sent in <[email protected]>, applicable on top of v3.13-rc1 or later, currently applied to mpc5xxx -next, available at git://git.denx.de/linux-2.6-agust.git next)

this series does not address the issue of outdated or missing device tree binding documentation for MPC512x peripherals -- that's the scope of a pending separate series

v1 initial submission (2013-12-10)
- enforce an even divider value for SDHC (on all MPC512x variants)
- tell 5121/5123/5125 SoC variants apart and only register the appropriate set of clock items (i.e. refuse to access unused and reserved bits, and support those components which are only found on MPC5125)
- update the MPC5125 "tower" board DTS (although the code still works in the absence of device tree clock specs)

the series passes 'checkpatch.pl --strict' except for two warnings which cannot get fixed because <linux/clk-provider.h> dictates the data type and "fixing" the warning would break the build

WARNING: static const char * array should probably be static const char * const #256: FILE: arch/powerpc/platforms/512x/clock-commonclk.c:500:
+static const char *parent_names_mux0_spdif[] = {

WARNING: static const char * array should probably be static const char * const #260: FILE: arch/powerpc/platforms/512x/clock-commonclk.c:504:
+static const char *parent_names_mux0_canin[] = {

total: 0 errors, 2 warnings, 0 checks, 495 lines checked

the series was build-tested, and was run-tested on the MPC5121 ADS board

Matteo, can you verify the crystal frequency in the DTS update, please? And that v3.13-rc kernels with v6 of the COMMON_CLK introduction for MPC512x plus this series for MPC5125 operate your peripherals, both with an updated device tree as well as with a former device tree that lacks clock specs? Thank you! Setting CONFIG_COMMON_CLK_DEBUG=y in your .config and eyeballing /sys/kernel/debug/clk/clk_summary will help you.

Gerhard Sittig (4):
powerpc/512x: clk: minor comment updates powerpc/512x: clk: enforce even SDHC divider values powerpc/512x: clk: support MPC5121/5123/5125 SoC variants powerpc/512x: dts: add MPC5125 clock specs

 arch/powerpc/boot/dts/mpc5125twr.dts          |   53 +++-
 arch/powerpc/include/asm/mpc5121.h            |    7 +-
 arch/powerpc/platforms/512x/clock-commonclk.c |  369 +++++++++++++++++++++----
 include/dt-bindings/clock/mpc512x-clock.h     |    9 +-
 4 files changed, 386 insertions(+), 52 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/4 powerpc/512x: clk: minor comment updates

adjust (expand on or move) a few comments,
add markers for easier navigation around helpers

---
 arch/powerpc/platforms/512x/clock-commonclk.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
arch/powerpc/platforms/512x/clock-commonclk.c +11 -3
index 189be4a4cb42..079eb1137260 100644
@@ -76,6 +76,8 @@ static struct clk_onecell_data clk_data;
 static struct mpc512x_ccm __iomem *clkregs;
 static DEFINE_SPINLOCK(clklock);
 
+/* common clk API wrappers {{{ */
+
 /* convenience wrappers around the common clk API */
 static inline struct clk *mpc512x_clk_fixed(const char *name, int rate)
 {
@@ -139,6 +141,8 @@ static inline struct clk *mpc512x_clk_muxed(const char *name,
 				reg, pos, len, muxflags, &clklock);
 }
 
+/* }}} common clk API wrappers */
+
 /* helper to isolate a bit field from a register */
 static inline int get_bit_field(uint32_t __iomem *reg, uint8_t pos, uint8_t len)
 {
@@ -308,6 +312,8 @@ static void mpc512x_clk_setup_ref_clock(struct device_node *np, int bus_freq,
 	}
 }
 
+/* MCLK helpers {{{ */
+
 /*
  * helper code for the MCLK subtree setup
  *
@@ -338,8 +344,8 @@ static void mpc512x_clk_setup_ref_clock(struct device_node *np, int bus_freq,
 
 /*
  * note that this declaration raises a checkpatch warning, but
- * it's the very data type which <linux/clk-provider.h> expects,
- * making this declaration pass checkpatch will break compilation
+ * it's the very data type dictated by <linux/clk-provider.h>,
+ * "fixing" this warning will break compilation
  */
 static const char *parent_names_mux0[] = {
 	"sys", "ref", "psc-mclk-in", "spdif-tx",
@@ -512,6 +518,8 @@ static void mpc512x_clk_setup_mclk(struct mclk_setup_data *entry, size_t idx)
 	}
 }
 
+/* }}} MCLK helpers */
+
 static void mpc512x_clk_setup_clock_tree(struct device_node *np, int busfreq)
 {
 	int sys_mul, sys_div, ips_div;
@@ -549,8 +557,8 @@ static void mpc512x_clk_setup_clock_tree(struct device_node *np, int busfreq)
 	clks[MPC512x_CLK_IPS] = mpc512x_clk_divtable("ips", "csb",
 						     &clkregs->scfr1, 23, 3,
 						     divtab_2346);
-
 	/* now setup anything below SYS and CSB and IPS */
+
 	clks[MPC512x_CLK_DDR_UG] = mpc512x_clk_factor("ddr-ug", "sys", 1, 2);
 	clks[MPC512x_CLK_SDHC_x4] = mpc512x_clk_factor("sdhc-x4", "csb", 4, 1);
 	clks[MPC512x_CLK_SDHC_UG] = mpc512x_clk_divider("sdhc-ug", "sdhc-x4", 0,
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/4 powerpc/512x: clk: enforce even SDHC divider values

In reply to Gerhard Sittig

the SDHC clock is derived from CSB with a fractional divider which can address "quarters"; the implementation multiplies CSB by 4 and divides it by the (integer) divider value

a bug in the clock domain synchronisation requires that only even divider values get setup; we achieve this by
- multiplying CSB by 2 only instead of 4
- registering with CCF the divider's bit field without bit0
- the divider's lowest bit remains clear as this is the reset value and later operations won't touch it

this change keeps fully utilizing common clock primitives (needs no additional support logic, and avoids an excessive divider table) and satisfies the hardware's constraint of only supporting even divider values

---
 arch/powerpc/platforms/512x/clock-commonclk.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
arch/powerpc/platforms/512x/clock-commonclk.c +14 -2
index 079eb1137260..b5190fcb81bb 100644
@@ -560,9 +560,21 @@ static void mpc512x_clk_setup_clock_tree(struct device_node *np, int busfreq)
 	/* now setup anything below SYS and CSB and IPS */
 
 	clks[MPC512x_CLK_DDR_UG] = mpc512x_clk_factor("ddr-ug", "sys", 1, 2);
-	clks[MPC512x_CLK_SDHC_x4] = mpc512x_clk_factor("sdhc-x4", "csb", 4, 1);
+
+	/*
+	 * the Reference Manual discusses that for SDHC only even divide
+	 * ratios are supported because clock domain synchronization
+	 * between 'per' and 'ipg' is broken;
+	 * keep the divider's bit 0 cleared (per reset value), and only
+	 * allow to setup the divider's bits 7:1, which results in that
+	 * only even divide ratios can get configured upon rate changes;
+	 * keep the "x4" name because this bit shift hack is an internal
+	 * implementation detail, the "fractional divider with quarters"
+	 * semantics remains
+	 */
+	clks[MPC512x_CLK_SDHC_x4] = mpc512x_clk_factor("sdhc-x4", "csb", 2, 1);
 	clks[MPC512x_CLK_SDHC_UG] = mpc512x_clk_divider("sdhc-ug", "sdhc-x4", 0,
-							&clkregs->scfr2, 0, 8,
+							&clkregs->scfr2, 1, 7,
 							CLK_DIVIDER_ONE_BASED);
 	clks[MPC512x_CLK_DIU_x4] = mpc512x_clk_factor("diu-x4", "csb", 4, 1);
 	clks[MPC512x_CLK_DIU_UG] = mpc512x_clk_divider("diu-ug", "diu-x4", 0,
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/4 powerpc/512x: clk: support MPC5121/5123/5125 SoC variants

In reply to Gerhard Sittig

improve the common clock support code for MPC512x

- expand the CCM register set declaration with MPC5125 related registers (which reside in the previously "reserved" area)
- tell the MPC5121, MPC5123, and MPC5125 SoC variants apart, and derive the availability of components and their clocks from the detected SoC (MBX, AXE, VIU, SPDIF, PATA, SATA, PCI, second FEC, second SDHC, number of PSC components, type of NAND flash controller, interpretation of the CPMF bitfield, PSC/CAN mux0 stage input clocks, output clocks on SoC pins)
- add backwards compatibility (allow operation against a device tree which lacks clock related specs) for MPC5125 FECs, too

telling SoC variants apart and adjusting the clock tree's generation occurs at runtime, a common generic binary supports all of the chips

the MPC5125 approach to the NFC clock (one register with two counters for the high and low periods of the clock) is not implemented, as there are no users and there is no common implementation which supports this kind of clock -- the new implementation would be unused and could not get verified, so it shall wait until there is demand

---
 arch/powerpc/include/asm/mpc5121.h            |    7 +-
 arch/powerpc/platforms/512x/clock-commonclk.c |  339 +++++++++++++++++++++----
 include/dt-bindings/clock/mpc512x-clock.h     |    9 +-
 3 files changed, 309 insertions(+), 46 deletions(-)
arch/powerpc/include/asm/mpc5121.h +6 -1
index 887d3d6133e3..4a69cd1d5041 100644
@@ -37,7 +37,12 @@ struct mpc512x_ccm {
 	u32	cccr;	/* CFM Clock Control Register */
 	u32	dccr;	/* DIU Clock Control Register */
 	u32	mscan_ccr[4];	/* MSCAN Clock Control Registers */
-	u8	res[0x98]; /* Reserved */
+	u32	out_ccr[4];	/* OUT CLK Configure Registers */
+	u32	rsv0[2];	/* Reserved */
+	u32	scfr3;		/* System Clock Frequency Register 3 */
+	u32	rsv1[3];	/* Reserved */
+	u32	spll_lock_cnt;	/* System PLL Lock Counter */
+	u8	res[0x6c];	/* Reserved */
 };
 
 /*
arch/powerpc/platforms/512x/clock-commonclk.c +295 -44

467 lines not on this page · raw message

include/dt-bindings/clock/mpc512x-clock.h +8 -1
index 9e81b3b99a32..4f94919327ce 100644
@@ -63,7 +63,14 @@
 #define MPC512x_CLK_PSC9		55
 #define MPC512x_CLK_PSC10		56
 #define MPC512x_CLK_PSC11		57
+#define MPC512x_CLK_SDHC2		58
+#define MPC512x_CLK_FEC2		59
+#define MPC512x_CLK_OUT0_CLK		60
+#define MPC512x_CLK_OUT1_CLK		61
+#define MPC512x_CLK_OUT2_CLK		62
+#define MPC512x_CLK_OUT3_CLK		63
+#define MPC512x_CLK_CAN_CLK_IN		64
 
-#define MPC512x_CLK_LAST_PUBLIC		57
+#define MPC512x_CLK_LAST_PUBLIC		64
 
 #endif
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/4 powerpc/512x: dts: add MPC5125 clock specs

In reply to Gerhard Sittig

add clock related specs to the MPC5125 "tower" board DTS
- add clock providers (crystal/oscillator, clock control module)
- add consumers (the CAN, SDHC, I2C, DIU, FEC, USB, PSC peripherals)

---
 arch/powerpc/boot/dts/mpc5125twr.dts |   53 +++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)
arch/powerpc/boot/dts/mpc5125twr.dts +52 -1
index 0a0fe92216ae..806479ffc607 100644
@@ -12,6 +12,8 @@
  * option) any later version.
  */
 
+#include <dt-bindings/clock/mpc512x-clock.h>
+
 /dts-v1/;
 
 / {
@@ -54,6 +56,17 @@
 		reg = <0x30000000 0x08000>;		// 32K at 0x30000000
 	};
 
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		osc: osc {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+			clock-frequency = <33000000>;
+		};
+	};
+
 	soc at 80000000 {
 		compatible = "fsl,mpc5121-immr";
 		#address-cells = <1>;
@@ -87,9 +100,12 @@
 			reg = <0xe00 0x100>;
 		};
 
-		clock at f00 {	// Clock control
+		clks: clock at f00 {	// Clock control
 			compatible = "fsl,mpc5121-clock";
 			reg = <0xf00 0x100>;
+			#clock-cells = <1>;
+			clocks = <&osc>;
+			clock-names = "osc";
 		};
 
 		pmc at 1000{  // Power Management Controller
@@ -114,18 +130,33 @@
 			compatible = "fsl,mpc5121-mscan";
 			interrupts = <12 0x8>;
 			reg = <0x1300 0x80>;
+			clocks = <&clks MPC512x_CLK_BDLC>,
+				 <&clks MPC512x_CLK_IPS>,
+				 <&clks MPC512x_CLK_SYS>,
+				 <&clks MPC512x_CLK_REF>,
+				 <&clks MPC512x_CLK_MSCAN0_MCLK>;
+			clock-names = "ipg", "ips", "sys", "ref", "mclk";
 		};
 
 		can at 1380 {
 			compatible = "fsl,mpc5121-mscan";
 			interrupts = <13 0x8>;
 			reg = <0x1380 0x80>;
+			clocks = <&clks MPC512x_CLK_BDLC>,
+				 <&clks MPC512x_CLK_IPS>,
+				 <&clks MPC512x_CLK_SYS>,
+				 <&clks MPC512x_CLK_REF>,
+				 <&clks MPC512x_CLK_MSCAN1_MCLK>;
+			clock-names = "ipg", "ips", "sys", "ref", "mclk";
 		};
 
 		sdhc at 1500 {
 			compatible = "fsl,mpc5121-sdhc";
 			interrupts = <8 0x8>;
 			reg = <0x1500 0x100>;
+			clocks = <&clks MPC512x_CLK_IPS>,
+				 <&clks MPC512x_CLK_SDHC>;
+			clock-names = "ipg", "per";
 		};
 
 		i2c at 1700 {
@@ -134,6 +165,8 @@
 			compatible = "fsl,mpc5121-i2c", "fsl-i2c";
 			reg = <0x1700 0x20>;
 			interrupts = <0x9 0x8>;
+			clocks = <&clks MPC512x_CLK_I2C>;
+			clock-names = "ipg";
 		};
 
 		i2c at 1720 {
@@ -142,6 +175,8 @@
 			compatible = "fsl,mpc5121-i2c", "fsl-i2c";
 			reg = <0x1720 0x20>;
 			interrupts = <0xa 0x8>;
+			clocks = <&clks MPC512x_CLK_I2C>;
+			clock-names = "ipg";
 		};
 
 		i2c at 1740 {
@@ -150,6 +185,8 @@
 			compatible = "fsl,mpc5121-i2c", "fsl-i2c";
 			reg = <0x1740 0x20>;
 			interrupts = <0xb 0x8>;
+			clocks = <&clks MPC512x_CLK_I2C>;
+			clock-names = "ipg";
 		};
 
 		i2ccontrol at 1760 {
@@ -161,6 +198,8 @@
 			compatible = "fsl,mpc5121-diu";
 			reg = <0x2100 0x100>;
 			interrupts = <64 0x8>;
+			clocks = <&clks MPC512x_CLK_DIU>;
+			clock-names = "ipg";
 		};
 
 		mdio at 2800 {
@@ -180,6 +219,8 @@
 			interrupts = <4 0x8>;
 			phy-handle = < &phy0 >;
 			phy-connection-type = "rmii";
+			clocks = <&clks MPC512x_CLK_FEC>;
+			clock-names = "per";
 		};
 
 		// IO control
@@ -196,6 +237,8 @@
 			interrupts = <43 0x8>;
 			dr_mode = "host";
 			phy_type = "ulpi";
+			clocks = <&clks MPC512x_CLK_USB1>;
+			clock-names = "ipg";
 		};
 
 		// 5125 PSCs are not 52xx or 5121 PSC compatible
@@ -206,6 +249,9 @@
 			interrupts = <40 0x8>;
 			fsl,rx-fifo-size = <16>;
 			fsl,tx-fifo-size = <16>;
+			clocks = <&clks MPC512x_CLK_PSC1>,
+				 <&clks MPC512x_CLK_PSC1_MCLK>;
+			clock-names = "ipg", "mclk";
 		};
 
 		// PSC9 uart1 aka ttyPSC1
@@ -215,12 +261,17 @@
 			interrupts = <40 0x8>;
 			fsl,rx-fifo-size = <16>;
 			fsl,tx-fifo-size = <16>;
+			clocks = <&clks MPC512x_CLK_PSC9>,
+				 <&clks MPC512x_CLK_PSC9_MCLK>;
+			clock-names = "ipg", "mclk";
 		};
 
 		pscfifo at 11f00 {
 			compatible = "fsl,mpc5121-psc-fifo";
 			reg = <0x11f00 0x100>;
 			interrupts = <40 0x8>;
+			clocks = <&clks MPC512x_CLK_PSC_FIFO>;
+			clock-names = "ipg";
 		};
 
 		dma at 14000 {
Signature · 1 line
1.7.10.4
#5 lore raw
In reply to Gerhard Sittig
Quoted 4 lines · Gerhard Sittig

this series improves the previously introduced common clock support for MPC512x such that SoC variants 5123 and 5125 get addressed appropriately (MPC5125 turned out to be rather different from MPC5121 than I perceived before -- there is much more than "just two FECs and no MBX")

Ohhh yesss..... welcome to hell! :-)

I report also these differences:

- I/O control module:
to do integration with linux pin-muxing subsystem

- GPIO module:
controller is the same of the mpc5121 but with these differences:
- 64 gpios divided in 2 banks
- input only gpios are numbers form 0 to 3 of the first bank I'm finishing to write the patch... when done I'll post in ML

- NFC: one of the biggest unsolved mystery
Is this ip-core used in others microcontrollers? Seems to be
used only in mpc5125!!!

Quoted 2 lines

Matteo, can you verify the crystal frequency in the DTS update, please?

Crystal frequency is ok: 33MHz.

Quoted 7 lines

And that v3.13-rc kernels with v6 of the COMMON_CLK introduction for MPC512x plus this series for MPC5125 operate your peripherals, both with an updated device tree as well as with a former device tree that lacks clock specs? Thank you! Setting CONFIG_COMMON_CLK_DEBUG=y in your .config and eyeballing /sys/kernel/debug/clk/clk_summary will help you.

I tested all on TWR board.

In DTS, for the moment, have to comment out this block:
- usb@3000 {

-            compatible = "fsl,mpc5121-usb2-dr";
-            reg = <0x3000 0x400>;
-            #address-cells = <1>;
-            #size-cells = <0>;
-            interrupts = <43 0x8>;
-            dr_mode = "host";
-            phy_type = "ulpi";
-            clocks = <&clks MPC512x_CLK_USB1>;
-            clock-names = "ipg";

- };
Because USB controller pinout is not initialized correctly and when system boot, causes a kernel panic.

For the rest, kernel works correctly. For MPC5125 the patches are OK.

I also check clk_summary and all clocks values are OK (except for NFC clock value).

I notice that there are missing clock like: gpio1, gpio2, fuse, dma, wdt, pmc, rtc. Is this OK or should be added?

Regards,

Matteo Facchinetti
Sirius Electronic Systems

#6 lore raw
Quoted 3 lines · Matteo Facchinetti

[...]
- NFC: one of the biggest unsolved mystery
Is this ip-core used in others microcontrollers? Seems to be used only in mpc5125!!!

I don't think that IP is used in any other FSL SoC. Scott can probably confirm this for us.

I did some digging on this NFC just to put enough things together that I can erase and flash firmware using BDI3000 that is read and executed properly when the boot flag is set.

Do you see any other anomalies with MPC5125 NFC ?

Thanks

Sinan Akman

#7 lore raw
Quoted 7 lines · Sinan Akman
Quoted 4 lines · Matteo Facchinetti

[...]
- NFC: one of the biggest unsolved mystery
Is this ip-core used in others microcontrollers? Seems to be used only in mpc5125!!!

I don't think that IP is used in any other FSL SoC. Scott can probably confirm this for us.

That's a different part of Freescale, so I don't know much about it, but it looks pretty similar to MXC NAND. Back when those drivers were submitted I tried to get the authors of each to work together to see if a common driver made sense, but I got little response.

-Scott

#8 lore raw
Quoted 5 lines · Scott Wood
Quoted 4 lines · Sinan Akman
Quoted 3 lines · Matteo Facchinetti

[...]
- NFC: one of the biggest unsolved mystery
Is this ip-core used in others microcontrollers? Seems to be used only in mpc5125!!!

Quoted 7 lines
Quoted 2 lines

I don't think that IP is used in any other FSL SoC. Scott can probably confirm this for us.

That's a different part of Freescale, so I don't know much about it, but it looks pretty similar to MXC NAND. Back when those drivers were submitted I tried to get the authors of each to work together to see if a common driver made sense, but I got little response.

OK Scott thanks for your comments. I am somewhat deep in 5125 NFC. I will
take a look at mxc nand and see how similar they are. Who is maintaining mxc nand ? I might spend some time and create some common components. But right now I am not familiar with mxc nand.

Thanks

Sinan Akman

#9 lore raw
In reply to Matteo Facchinetti
Quoted 10 lines · Matteo Facchinetti
Quoted 4 lines · Gerhard Sittig

this series improves the previously introduced common clock support for MPC512x such that SoC variants 5123 and 5125 get addressed appropriately (MPC5125 turned out to be rather different from MPC5121 than I perceived before -- there is much more than "just two FECs and no MBX")

Ohhh yesss..... welcome to hell! :-)

I report also these differences:

Quoted 8 lines

- I/O control module:
to do integration with linux pin-muxing subsystem

- GPIO module:
controller is the same of the mpc5121 but with these differences:
- 64 gpios divided in 2 banks
- input only gpios are numbers form 0 to 3 of the first bank I'm finishing to write the patch... when done I'll post in ML

Yes, I've seen the 2x 32bits thing on MPC5125. Can't tell whether one can just use two mpc8xxx-gpio nodes in the device tree and be done.

MPC5121 has just one 32bits GPIO bank. And four of those pins are "GPI only" as well. This may be identical to one of the two MPC5125 banks.

Quoted 7 lines

- NFC: one of the biggest unsolved mystery
Is this ip-core used in others microcontrollers? Seems to be
used only in mpc5125!!!

Quoted 2 lines

Matteo, can you verify the crystal frequency in the DTS update, please?

Crystal frequency is ok: 33MHz.

great

Quoted 8 lines
Quoted 7 lines

And that v3.13-rc kernels with v6 of the COMMON_CLK introduction for MPC512x plus this series for MPC5125 operate your peripherals, both with an updated device tree as well as with a former device tree that lacks clock specs? Thank you! Setting CONFIG_COMMON_CLK_DEBUG=y in your .config and eyeballing /sys/kernel/debug/clk/clk_summary will help you.

I tested all on TWR board.

Thank you! I think this qualifies as Tested-by: then. :)

Quoted 15 lines

In DTS, for the moment, have to comment out this block:

(quoted diff) +0 -11
-        usb@3000 {
-            compatible = "fsl,mpc5121-usb2-dr";
-            reg = <0x3000 0x400>;
-            #address-cells = <1>;
-            #size-cells = <0>;
-            interrupts = <43 0x8>;
-            dr_mode = "host";
-            phy_type = "ulpi";
-            clocks = <&clks MPC512x_CLK_USB1>;
-            clock-names = "ipg";
-        };

Because USB controller pinout is not initialized correctly and when system boot, causes a kernel panic.

Quoted 4 lines

For the rest, kernel works correctly. For MPC5125 the patches are OK.

I also check clk_summary and all clocks values are OK (except for NFC clock value).

Since there is no user of the NFC block yet, I did not implement the driver for the clock item. The list of clocks in debugfs should completely lack an NFC entry since nothing was registered with the CCF subsystem.

Quoted 3 lines

I notice that there are missing clock like: gpio1, gpio2, fuse, dma, wdt, pmc, rtc.
Is this OK or should be added?

Are there registers for those clock items? Haven't seen any when flipping through the RM's clocks chapter. If there's no (software controllable) gate or divider, then there's no clock item in need of software support.

virtually yours
Gerhard Sittig

Signature · 3 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email protected]
maintainer Applied
#10 lore raw

cover powerpc/512x: update COMMON_CLK support for MPC5125

In reply to Gerhard Sittig

On Tue, 10 Dec 2013 14:11:33 +0100
Gerhard Sittig <[email protected]> wrote:
...

Quoted 11 lines

Gerhard Sittig (4):
powerpc/512x: clk: minor comment updates powerpc/512x: clk: enforce even SDHC divider values powerpc/512x: clk: support MPC5121/5123/5125 SoC variants powerpc/512x: dts: add MPC5125 clock specs

 arch/powerpc/boot/dts/mpc5125twr.dts          |   53 +++-
 arch/powerpc/include/asm/mpc5121.h            |    7 +-
 arch/powerpc/platforms/512x/clock-commonclk.c |  369 +++++++++++++++++++++----
 include/dt-bindings/clock/mpc512x-clock.h     |    9 +-
 4 files changed, 386 insertions(+), 52 deletions(-)

Applied this series to mpc5xxx next. Thanks!

Anatolij

#11 lore raw

cover powerpc/512x: update COMMON_CLK support for MPC5125

In reply to Gerhard Sittig

Quoting Gerhard Sittig (2013-12-10 05:11:33)

Quoted 5 lines

this series improves the previously introduced common clock support for MPC512x such that SoC variants 5123 and 5125 get addressed appropriately (MPC5125 turned out to be rather different from MPC5121 than I perceived before -- there is much more than "just two FECs and no MBX")

Quoted 8 lines

thus this series depends on "add COMMON_CLK support for PowerPC MPC512x" (v6 sent in <[email protected]>, applicable on top of v3.13-rc1 or later, currently applied to mpc5xxx -next, available at git://git.denx.de/linux-2.6-agust.git next)

this series does not address the issue of outdated or missing device tree binding documentation for MPC512x peripherals -- that's the scope of a pending separate series

For the three clock patches:

Quoted 48 lines

v1 initial submission (2013-12-10)
- enforce an even divider value for SDHC (on all MPC512x variants)
- tell 5121/5123/5125 SoC variants apart and only register the appropriate set of clock items (i.e. refuse to access unused and reserved bits, and support those components which are only found on MPC5125)
- update the MPC5125 "tower" board DTS (although the code still works in the absence of device tree clock specs)

the series passes 'checkpatch.pl --strict' except for two warnings which cannot get fixed because <linux/clk-provider.h> dictates the data type and "fixing" the warning would break the build

WARNING: static const char * array should probably be static const char * const #256: FILE: arch/powerpc/platforms/512x/clock-commonclk.c:500:
+static const char *parent_names_mux0_spdif[] = {

WARNING: static const char * array should probably be static const char * const #260: FILE: arch/powerpc/platforms/512x/clock-commonclk.c:504:
+static const char *parent_names_mux0_canin[] = {

total: 0 errors, 2 warnings, 0 checks, 495 lines checked

the series was build-tested, and was run-tested on the MPC5121 ADS board

Matteo, can you verify the crystal frequency in the DTS update, please? And that v3.13-rc kernels with v6 of the COMMON_CLK introduction for MPC512x plus this series for MPC5125 operate your peripherals, both with an updated device tree as well as with a former device tree that lacks clock specs? Thank you! Setting CONFIG_COMMON_CLK_DEBUG=y in your .config and eyeballing /sys/kernel/debug/clk/clk_summary will help you.

Gerhard Sittig (4):
powerpc/512x: clk: minor comment updates powerpc/512x: clk: enforce even SDHC divider values powerpc/512x: clk: support MPC5121/5123/5125 SoC variants powerpc/512x: dts: add MPC5125 clock specs

 arch/powerpc/boot/dts/mpc5125twr.dts          |   53 +++-
 arch/powerpc/include/asm/mpc5121.h            |    7 +-
 arch/powerpc/platforms/512x/clock-commonclk.c |  369 +++++++++++++++++++++----
 include/dt-bindings/clock/mpc512x-clock.h     |    9 +-
 4 files changed, 386 insertions(+), 52 deletions(-)
Signature · 1 line
1.7.10.4