Skip to contentSkip to conversation

device_type/compatible cleanups

PATCH Applied Anton Vorontsov 5 participants 27 messages Jan 24, 2008 – Feb 6, 2008

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

v5 cover device_type/compatible cleanups

Hi all,

This is v5. It's tested on MPC8360E-RDK and MPC8568E-MDS.

Here is diffstat summary:

 Documentation/powerpc/booting-without-of.txt   |   26 +--
 arch/powerpc/boot/dts/mpc832x_mds.dts          |   11 -
 arch/powerpc/boot/dts/mpc832x_rdb.dts          |   11 -
 arch/powerpc/boot/dts/mpc836x_mds.dts          |   11 -
 arch/powerpc/boot/dts/mpc836x_rdk.dts          |   10 -
 arch/powerpc/boot/dts/mpc8568mds.dts           |   10 -
 arch/powerpc/sysdev/fsl_soc.c                  |  191 +++++++++++++++----------
 b/Documentation/powerpc/booting-without-of.txt |   11 -
 b/arch/powerpc/boot/dts/mpc8313erdb.dts        |    4
 b/arch/powerpc/boot/dts/mpc832x_mds.dts        |    9 -
 b/arch/powerpc/boot/dts/mpc832x_rdb.dts        |   10 -
 b/arch/powerpc/boot/dts/mpc8349emitx.dts       |    4
 b/arch/powerpc/boot/dts/mpc8349emitxgp.dts     |    4
 b/arch/powerpc/boot/dts/mpc834x_mds.dts        |    4
 b/arch/powerpc/boot/dts/mpc836x_mds.dts        |   10 -
 b/arch/powerpc/boot/dts/mpc836x_rdk.dts        |    1
 b/arch/powerpc/boot/dts/mpc8568mds.dts         |   10 -
 b/arch/powerpc/kernel/legacy_serial.c          |    3
 b/arch/powerpc/platforms/83xx/mpc832x_mds.c    |   11 -
 b/arch/powerpc/platforms/83xx/mpc832x_rdb.c    |   11 -
 b/arch/powerpc/platforms/83xx/mpc836x_mds.c    |   11 -
 b/arch/powerpc/platforms/85xx/mpc85xx_mds.c    |   32 ++--
 b/arch/powerpc/sysdev/fsl_soc.c                |    5
 b/arch/powerpc/sysdev/qe_lib/qe.c              |   64 +++++---
 b/drivers/net/ucc_geth_mii.c                   |    4
 b/drivers/spi/spi_mpc83xx.c                    |   10 -
 26 files changed, 284 insertions(+), 204 deletions(-)

Changes since v4:
- Now I'm not removing device_type = "qe", because I realized that there was a period of time (month or so?) where libfdt-enabled u-boots were searching for it;
- new patch that prepares the code for device_type = "soc" removal from the device trees. We can't remove it now, because of backward compatibility. Though, MPC8360E-RDK is exception here.

Changes since v3:
- Thanks to reviewers, few glitches found and fixed;
- New conversion: device_type = "qeic" to compatible = "fsl,qe-ic";
- Documentation updated.

Changes since v2:
- SPI conversion fixed and actually tested on MPC8323E-RDB to not break anything;
- Few more users of device_type = "qe" converted to compatible = "fsl,qe";
- Got Ack on SPI part from David Brownell.

Changes since v1:
- Device tree lookup changes should be backward compatible with older dtbs;
- Few of_put_node() cleanups;
- cell-index property added to spi nodes;
- cpm-muram{,-data} added as an addition to qe-muram{,-data}.

Thanks,

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
#1 lore raw

PATCH v5 1/5 qe_lib and users: get rid of most device_types and model

Now we're searching for "fsl,qe", "fsl,qe-muram", "fsl,qe-muram-data" and "fsl,qe-ic".

Unfortunately it's still impossible to remove device_type = "qe" from the existing device trees (except for MPC8360E-RDK), because older u-boots are looking for it.

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

---
 Documentation/powerpc/booting-without-of.txt |   11 +++--
 arch/powerpc/boot/dts/mpc832x_mds.dts        |    9 ++--
 arch/powerpc/boot/dts/mpc832x_rdb.dts        |   10 +++--
 arch/powerpc/boot/dts/mpc836x_mds.dts        |   10 +++--
 arch/powerpc/boot/dts/mpc836x_rdk.dts        |    1 -
 arch/powerpc/boot/dts/mpc8568mds.dts         |   10 +++--
 arch/powerpc/platforms/83xx/mpc832x_mds.c    |   11 +++--
 arch/powerpc/platforms/83xx/mpc832x_rdb.c    |   11 +++--
 arch/powerpc/platforms/83xx/mpc836x_mds.c    |   11 +++--
 arch/powerpc/platforms/85xx/mpc85xx_mds.c    |   32 ++++++++-----
 arch/powerpc/sysdev/fsl_soc.c                |    5 ++-
 arch/powerpc/sysdev/qe_lib/qe.c              |   63 ++++++++++++++++++--------
 12 files changed, 117 insertions(+), 67 deletions(-)
Documentation/powerpc/booting-without-of.txt +6 -5
index da98154..f9545b0 100644
@@ -1543,7 +1543,7 @@ platforms are moved over to use the flattened-device-tree model.
    i) Root QE device
 
    Required properties:
-   - device_type : should be "qe";
+   - compatible : should be "fsl,qe";
    - model : precise model of the QE, Can be "QE", "CPM", or "CPM2"
    - reg : offset and length of the device registers.
    - bus-frequency : the clock frequency for QUICC Engine.
@@ -1557,8 +1557,7 @@ platforms are moved over to use the flattened-device-tree model.
 		#address-cells = <1>;
 		#size-cells = <1>;
 		#interrupt-cells = <2>;
-		device_type = "qe";
-		model = "QE";
+		compatible = "fsl,qe";
 		ranges = <0 e0100000 00100000>;
 		reg = <e0100000 480>;
 		brg-frequency = <0>;
@@ -1781,7 +1780,7 @@ platforms are moved over to use the flattened-device-tree model.
    vii) Multi-User RAM (MURAM)
 
    Required properties:
-   - device_type : should be "muram".
+   - compatible : should be "fsl,qe-muram", "fsl,cpm-muram".
    - mode : the could be "host" or "slave".
    - ranges : Should be defined as specified in 1) to describe the
       translation of MURAM addresses.
@@ -1791,10 +1790,12 @@ platforms are moved over to use the flattened-device-tree model.
    Example:
 
 	muram@10000 {
-		device_type = "muram";
+		compatible = "fsl,qe-muram", "fsl,cpm-muram";
 		ranges = <0 00010000 0000c000>;
 
 		data-only@0{
+			compatible = "fsl,qe-muram-data",
+				     "fsl,cpm-muram-data";
 			reg = <0 c000>;
 		};
 	};
arch/powerpc/boot/dts/mpc832x_mds.dts +5 -4
index 6902524..e300df4 100644
@@ -206,17 +206,18 @@
 		#size-cells = <1>;
 		device_type = "qe";
 		compatible = "fsl,qe";
-		model = "QE";
 		ranges = <0 e0100000 00100000>;
 		reg = <e0100000 480>;
 		brg-frequency = <0>;
 		bus-frequency = <BCD3D80>;
 
 		muram@10000 {
-			device_type = "muram";
+			compatible = "fsl,qe-muram", "fsl,cpm-muram";
 			ranges = <0 00010000 00004000>;
 
 			data-only@0 {
+				compatible = "fsl,qe-muram-data",
+					     "fsl,cpm-muram-data";
 				reg = <0 4000>;
 			};
 		};
@@ -320,9 +321,9 @@
 			};
 		};
 
-		qeic: qeic@80 {
+		qeic: interrupt-controller@80 {
 			interrupt-controller;
-			device_type = "qeic";
+			compatible = "fsl,qe-ic";
 			#address-cells = <0>;
 			#interrupt-cells = <1>;
 			reg = <80 80>;
arch/powerpc/boot/dts/mpc832x_rdb.dts +6 -4
index 10ff7aa..4d5cfd3 100644
@@ -166,17 +166,19 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 		device_type = "qe";
-		model = "QE";
+		compatible = "fsl,qe";
 		ranges = <0 e0100000 00100000>;
 		reg = <e0100000 480>;
 		brg-frequency = <0>;
 		bus-frequency = <BCD3D80>;
 
 		muram@10000 {
-			device_type = "muram";
+			compatible = "fsl,qe-muram", "fsl,cpm-muram";
 			ranges = <0 00010000 00004000>;
 
 			data-only@0 {
+				compatible = "fsl,qe-muram-data",
+					     "fsl,cpm-muram-data";
 				reg = <0 4000>;
 			};
 		};
@@ -252,9 +254,9 @@
 			};
 		};
 
-		qeic:qeic@80 {
+		qeic:interrupt-controller@80 {
 			interrupt-controller;
-			device_type = "qeic";
+			compatible = "fsl,qe-ic";
 			#address-cells = <0>;
 			#interrupt-cells = <1>;
 			reg = <80 80>;
arch/powerpc/boot/dts/mpc836x_mds.dts +6 -4
index 2181d2c..9a2581b 100644
@@ -207,17 +207,19 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 		device_type = "qe";
-		model = "QE";
+		compatible = "fsl,qe";
 		ranges = <0 e0100000 00100000>;
 		reg = <e0100000 480>;
 		brg-frequency = <0>;
 		bus-frequency = <179A7B00>;
 
 		muram@10000 {
-			device_type = "muram";
+			compatible = "fsl,qe-muram", "fsl,cpm-muram";
 			ranges = <0 00010000 0000c000>;
 
 			data-only@0{
+				compatible = "fsl,qe-muram-data",
+					     "fsl,cpm-muram-data";
 				reg = <0 c000>;
 			};
 		};
@@ -303,9 +305,9 @@
 			};
 		};
 
-		qeic: qeic@80 {
+		qeic: interrupt-controller@80 {
 			interrupt-controller;
-			device_type = "qeic";
+			compatible = "fsl,qe-ic";
 			#address-cells = <0>;
 			#interrupt-cells = <1>;
 			reg = <80 80>;
arch/powerpc/boot/dts/mpc836x_rdk.dts +0 -1
index b8f87ac..e244619 100644
@@ -145,7 +145,6 @@
 	qe@e0100000 {
 		#address-cells = <1>;
 		#size-cells = <1>;
-		device_type = "qe";
 		compatible = "fsl,qe";
 		ranges = <0 0xe0100000 0x100000>;
 		reg = <0xe0100000 0x480>;
arch/powerpc/boot/dts/mpc8568mds.dts +6 -4
index 5818a7c..04f5c6f 100644
@@ -284,17 +284,19 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 		device_type = "qe";
-		model = "QE";
+		compatible = "fsl,qe";
 		ranges = <0 e0080000 00040000>;
 		reg = <e0080000 480>;
 		brg-frequency = <0>;
 		bus-frequency = <179A7B00>;
 
 		muram@10000 {
-			device_type = "muram";
+			compatible = "fsl,qe-muram", "fsl,cpm-muram";
 			ranges = <0 00010000 0000c000>;
 
 			data-only@0{
+				compatible = "fsl,qe-muram-data",
+					     "fsl,cpm-muram-data";
 				reg = <0 c000>;
 			};
 		};
@@ -385,9 +387,9 @@
 			};
 		};
 
-		qeic: qeic@80 {
+		qeic: interrupt-controller@80 {
 			interrupt-controller;
-			device_type = "qeic";
+			compatible = "fsl,qe-ic";
 			#address-cells = <0>;
 			#interrupt-cells = <1>;
 			reg = <80 80>;
arch/powerpc/platforms/83xx/mpc832x_mds.c +7 -4
index dbdd4ad..6dbc6ea 100644
@@ -105,6 +105,7 @@ static struct of_device_id mpc832x_ids[] = {
 	{ .type = "soc", },
 	{ .compatible = "soc", },
 	{ .type = "qe", },
+	{ .compatible = "fsl,qe", },
 	{},
 };
 
@@ -134,10 +135,12 @@ static void __init mpc832x_sys_init_IRQ(void)
 	of_node_put(np);
 
 #ifdef CONFIG_QUICC_ENGINE
-	np = of_find_node_by_type(NULL, "qeic");
-	if (!np)
-		return;
-
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
+	if (!np) {
+		np = of_find_node_by_type(NULL, "qeic");
+		if (!np)
+			return;
+	}
 	qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
 	of_node_put(np);
 #endif				/* CONFIG_QUICC_ENGINE */
arch/powerpc/platforms/83xx/mpc832x_rdb.c +7 -4
index 5fddd22..9f0fd88 100644
@@ -115,6 +115,7 @@ static struct of_device_id mpc832x_ids[] = {
 	{ .type = "soc", },
 	{ .compatible = "soc", },
 	{ .type = "qe", },
+	{ .compatible = "fsl,qe", },
 	{},
 };
 
@@ -145,10 +146,12 @@ void __init mpc832x_rdb_init_IRQ(void)
 	of_node_put(np);
 
 #ifdef CONFIG_QUICC_ENGINE
-	np = of_find_node_by_type(NULL, "qeic");
-	if (!np)
-		return;
-
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
+	if (!np) {
+		np = of_find_node_by_type(NULL, "qeic");
+		if (!np)
+			return;
+	}
 	qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
 	of_node_put(np);
 #endif				/* CONFIG_QUICC_ENGINE */
arch/powerpc/platforms/83xx/mpc836x_mds.c +7 -4
index db491ec..c2e5de6 100644
@@ -136,6 +136,7 @@ static struct of_device_id mpc836x_ids[] = {
 	{ .type = "soc", },
 	{ .compatible = "soc", },
 	{ .type = "qe", },
+	{ .compatible = "fsl,qe", },
 	{},
 };
 
@@ -165,10 +166,12 @@ static void __init mpc836x_mds_init_IRQ(void)
 	of_node_put(np);
 
 #ifdef CONFIG_QUICC_ENGINE
-	np = of_find_node_by_type(NULL, "qeic");
-	if (!np)
-		return;
-
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
+	if (!np) {
+		np = of_find_node_by_type(NULL, "qeic");
+		if (!np)
+			return;
+	}
 	qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
 	of_node_put(np);
 #endif				/* CONFIG_QUICC_ENGINE */
arch/powerpc/platforms/85xx/mpc85xx_mds.c +19 -13
index 4fdf5ab..25f8bc7 100644
@@ -94,21 +94,25 @@ static void __init mpc85xx_mds_setup_arch(void)
 #endif
 
 #ifdef CONFIG_QUICC_ENGINE
-	if ((np = of_find_node_by_name(NULL, "qe")) != NULL) {
-		qe_reset();
-		of_node_put(np);
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!np) {
+		np = of_find_node_by_name(NULL, "qe");
+		if (!np)
+			return;
 	}
 
-	if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) {
-		struct device_node *ucc = NULL;
+	qe_reset();
+	of_node_put(np);
+
+	np = of_find_node_by_name(NULL, "par_io");
+	if (np) {
+		struct device_node *ucc;
 
 		par_io_init(np);
 		of_node_put(np);
 
-		for ( ;(ucc = of_find_node_by_name(ucc, "ucc")) != NULL;)
+		for_each_node_by_name(ucc, "ucc")
 			par_io_of_config(ucc);
-
-		of_node_put(ucc);
 	}
 
 	if (bcsr_regs) {
@@ -131,7 +135,6 @@ static void __init mpc85xx_mds_setup_arch(void)
 
 		iounmap(bcsr_regs);
 	}
-
 #endif	/* CONFIG_QUICC_ENGINE */
 }
 
@@ -139,6 +142,7 @@ static struct of_device_id mpc85xx_ids[] = {
 	{ .type = "soc", },
 	{ .compatible = "soc", },
 	{ .type = "qe", },
+	{ .compatible = "fsl,qe", },
 	{},
 };
 
@@ -176,10 +180,12 @@ static void __init mpc85xx_mds_pic_init(void)
 	mpic_init(mpic);
 
 #ifdef CONFIG_QUICC_ENGINE
-	np = of_find_node_by_type(NULL, "qeic");
-	if (!np)
-		return;
-
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
+	if (!np) {
+		np = of_find_node_by_type(NULL, "qeic");
+		if (!np)
+			return;
+	}
 	qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);
 	of_node_put(np);
 #endif				/* CONFIG_QUICC_ENGINE */
arch/powerpc/sysdev/fsl_soc.c +4 -1
index f2c0988..26f7d83 100644
@@ -1276,7 +1276,10 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
 	const u32 *sysclk;
 
 	/* SPI controller is either clocked from QE or SoC clock */
-	np = of_find_node_by_type(NULL, "qe");
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!np)
+		np = of_find_node_by_type(NULL, "qe");
+
 	if (!np)
 		np = of_find_node_by_type(NULL, "soc");
 
arch/powerpc/sysdev/qe_lib/qe.c +44 -19

95 lines not on this page · raw message

Signature · 1 line
1.5.2.2
Applied
#2 lore raw

Re: [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model

Quoted 10 lines · Anton Vorontsov

Now we're searching for "fsl,qe", "fsl,qe-muram", "fsl,qe-muram-data" and "fsl,qe-ic".

Unfortunately it's still impossible to remove device_type = "qe" from the existing device trees (except for MPC8360E-RDK), because older u-boots are looking for it.

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

Quoted 15 lines
---
 Documentation/powerpc/booting-without-of.txt |   11 +++--
 arch/powerpc/boot/dts/mpc832x_mds.dts        |    9 ++--
 arch/powerpc/boot/dts/mpc832x_rdb.dts        |   10 +++--
 arch/powerpc/boot/dts/mpc836x_mds.dts        |   10 +++--
 arch/powerpc/boot/dts/mpc836x_rdk.dts        |    1 -
 arch/powerpc/boot/dts/mpc8568mds.dts         |   10 +++--
 arch/powerpc/platforms/83xx/mpc832x_mds.c    |   11 +++--
 arch/powerpc/platforms/83xx/mpc832x_rdb.c    |   11 +++--
 arch/powerpc/platforms/83xx/mpc836x_mds.c    |   11 +++--
 arch/powerpc/platforms/85xx/mpc85xx_mds.c    |   32 ++++++++-----
 arch/powerpc/sysdev/fsl_soc.c                |    5 ++-
 arch/powerpc/sysdev/qe_lib/qe.c              |   63 ++++++++++++++++++--------
 12 files changed, 117 insertions(+), 67 deletions(-)

applied, however _rdk will need fixing.

- k

#3 lore raw

Re: [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model

In reply to Anton Vorontsov

Hi Anton,

I know this is late, but a couple of comments anyway.

Quoted 18 lines · On Thu, 24 Jan 2008 18:39:59 +0300 Anton Vorontsov <[email protected]>…

+++ b/arch/powerpc/sysdev/qe_lib/qe.c

arch/powerpc/sysdev/qe_lib/qe.c +2 -6
@@ -65,17 +65,22 @@ static phys_addr_t qebase = -1;
 phys_addr_t get_qe_base(void)
 {
 	struct device_node *qe;
+	unsigned int size;
+	const void *prop;
 
 	if (qebase != -1)
 		return qebase;
 
-	qe = of_find_node_by_type(NULL, "qe");
-	if (qe) {
-		unsigned int size;
-		const void *prop = of_get_property(qe, "reg", &size);
-		qebase = of_translate_address(qe, prop);
-		of_node_put(qe);

arch/powerpc/sysdev/qe_lib/qe.c static phys_addr_t qebase = -1; · line 82

Quoted 10 lines
arch/powerpc/sysdev/qe_lib/qe.c +9 -1
-	};
+	qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!qe) {
+		qe = of_find_node_by_type(NULL, "qe");
+		if (!qe)
+			return qebase;
+	}
+
+	prop = of_get_property(qe, "reg", &size);
+	qebase = of_translate_address(qe, prop);

If you don't care about the returned length (argument three to of_get_property), you can just pass NULL (and dispense with "size"). Also, what happens if prop is NULL?

Quoted 17 lines
arch/powerpc/sysdev/qe_lib/qe.c +3 -7
@@ -153,16 +158,26 @@ static unsigned int brg_clk = 0;
 unsigned int get_brg_clk(void)
 {
 	struct device_node *qe;
+	unsigned int size;
+	const u32 *prop;
+
 	if (brg_clk)
 		return brg_clk;
 
-	qe = of_find_node_by_type(NULL, "qe");
-	if (qe) {
-		unsigned int size;
-		const u32 *prop = of_get_property(qe, "brg-frequency", &size);
-		brg_clk = *prop;
-		of_node_put(qe);
-	};

arch/powerpc/sysdev/qe_lib/qe.c static unsigned int brg_clk = 0; · line 176

Quoted 10 lines
arch/powerpc/sysdev/qe_lib/qe.c +10 -0
+	qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!qe) {
+		qe = of_find_node_by_type(NULL, "qe");
+		if (!qe)
+			return brg_clk;
+	}
+
+	prop = of_get_property(qe, "brg-frequency", &size);
+	if (!prop || size != sizeof(*prop))
+		return brg_clk;

You need an of_node_put(qe) before the return ...

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#4 lore raw

PATCH 1/1 qe_lib: fix few fluffy negligences (was: Re: [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model)

Quoted 29 lines · Stephen Rothwell

Hi Anton,

I know this is late, but a couple of comments anyway.

Quoted 24 lines · On Thu, 24 Jan 2008 18:39:59 +0300 Anton Vorontsov <[email protected]>…

+++ b/arch/powerpc/sysdev/qe_lib/qe.c

(quoted diff) +7 -7
@@ -65,17 +65,22 @@ static phys_addr_t qebase = -1;
 phys_addr_t get_qe_base(void)
 {
 	struct device_node *qe;
+	unsigned int size;
+	const void *prop;
 
 	if (qebase != -1)
 		return qebase;
 
-	qe = of_find_node_by_type(NULL, "qe");
-	if (qe) {
-		unsigned int size;
-		const void *prop = of_get_property(qe, "reg", &size);
-		qebase = of_translate_address(qe, prop);
-		of_node_put(qe);
-	};
+	qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!qe) {
+		qe = of_find_node_by_type(NULL, "qe");
+		if (!qe)
+			return qebase;
Quoted 8 lines

Review static phys_addr_t qebase = -1; · line 82

Quoted 4 lines
(quoted diff) +4 -0
+	}
+
+	prop = of_get_property(qe, "reg", &size);
+	qebase = of_translate_address(qe, prop);

If you don't care about the returned length (argument three to of_get_property), you can just pass NULL (and dispense with "size"). Also, what happens if prop is NULL?

All this was in the old code already, I just didn't fix that.

Quoted 21 lines
Quoted 21 lines
(quoted diff) +7 -7
@@ -153,16 +158,26 @@ static unsigned int brg_clk = 0;
 unsigned int get_brg_clk(void)
 {
 	struct device_node *qe;
+	unsigned int size;
+	const u32 *prop;
+
 	if (brg_clk)
 		return brg_clk;
 
-	qe = of_find_node_by_type(NULL, "qe");
-	if (qe) {
-		unsigned int size;
-		const u32 *prop = of_get_property(qe, "brg-frequency", &size);
-		brg_clk = *prop;
-		of_node_put(qe);
-	};
+	qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!qe) {
+		qe = of_find_node_by_type(NULL, "qe");
+		if (!qe)
Quoted 8 lines

Review static unsigned int brg_clk = 0; · line 176

Quoted 6 lines
(quoted diff) +6 -0
+			return brg_clk;
+	}
+
+	prop = of_get_property(qe, "brg-frequency", &size);
+	if (!prop || size != sizeof(*prop))
+		return brg_clk;

You need an of_node_put(qe) before the return ...

This is new. :-) Thanks.

- - - -
From: Anton Vorontsov <[email protected]>
Subject: [POWERPC] qe_lib: fix few fluffy negligences

One is intoduced by me (of_node_put() absence) and another was present already (not checking for NULL).

Found by Stephen Rothwell.

---
 arch/powerpc/sysdev/qe_lib/qe.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
arch/powerpc/sysdev/qe_lib/qe.c +5 -5
index 5ef844d..6efbd5e 100644
@@ -66,7 +66,7 @@ phys_addr_t get_qe_base(void)
 {
 	struct device_node *qe;
 	unsigned int size;
-	const void *prop;
+	const u32 *prop;
 
 	if (qebase != -1)
 		return qebase;
@@ -79,7 +79,8 @@ phys_addr_t get_qe_base(void)
 	}
 
 	prop = of_get_property(qe, "reg", &size);
-	qebase = of_translate_address(qe, prop);
+	if (prop && size >= sizeof(*prop))
+		qebase = of_translate_address(qe, prop);
 	of_node_put(qe);
 
 	return qebase;
@@ -172,10 +173,9 @@ unsigned int get_brg_clk(void)
 	}
 
 	prop = of_get_property(qe, "brg-frequency", &size);
-	if (!prop || size != sizeof(*prop))
-		return brg_clk;
+	if (prop && size == sizeof(*prop))
+		brg_clk = *prop;
 
-	brg_clk = *prop;
 	of_node_put(qe);
 
 	return brg_clk;
Signature · 1 line
1.5.2.2
Acked-by on v1 1/1
#5 lore raw

Re: [PATCH] [POWERPC] qe_lib: fix few fluffy negligences (was: Re: [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model)

Quoted 8 lines · On Mon, 4 Feb 2008 16:46:17 +0300 Anton Vorontsov <[email protected]>…
Quoted 4 lines · Stephen Rothwell

If you don't care about the returned length (argument three to of_get_property), you can just pass NULL (and dispense with "size"). Also, what happens if prop is NULL?

All this was in the old code already, I just didn't fix that.

I appreciate that, but it did need fixing.

Quoted 10 lines

- - - -
From: Anton Vorontsov <[email protected]>
Subject: [POWERPC] qe_lib: fix few fluffy negligences

One is intoduced by me (of_node_put() absence) and another was present already (not checking for NULL).

Found by Stephen Rothwell.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
Applied
#6 lore raw

Re: [PATCH] [POWERPC] qe_lib: fix few fluffy negligences (was: Re: [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model)

In reply to Anton Vorontsov
Quoted 7 lines

From: Anton Vorontsov <[email protected]>
Subject: [POWERPC] qe_lib: fix few fluffy negligences

One is intoduced by me (of_node_put() absence) and another was present already (not checking for NULL).

Quoted 6 lines

Found by Stephen Rothwell.

---
arch/powerpc/sysdev/qe_lib/qe.c | 10 +++++-----

1 files changed, 5 insertions(+), 5 deletions(-)

applied.

- k

#7 lore raw

PATCH v5 2/5 ucc_geth_mii and users: get rid of device_type

In reply to Anton Vorontsov

device_type property is bogus, thus use proper compatible.

Also change compatible property to "fsl,ucc-mdio".

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

---
 arch/powerpc/boot/dts/mpc832x_mds.dts |    3 +--
 arch/powerpc/boot/dts/mpc832x_rdb.dts |    3 +--
 arch/powerpc/boot/dts/mpc836x_mds.dts |    3 +--
 arch/powerpc/boot/dts/mpc836x_rdk.dts |    3 +--
 arch/powerpc/boot/dts/mpc8568mds.dts  |    2 +-
 drivers/net/ucc_geth_mii.c            |    3 +++
 6 files changed, 8 insertions(+), 9 deletions(-)
arch/powerpc/boot/dts/mpc832x_mds.dts +1 -2
index e300df4..1bb75ef 100644
@@ -304,8 +304,7 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 			reg = <2320 18>;
-			device_type = "mdio";
-			compatible = "ucc_geth_phy";
+			compatible = "fsl,ucc-mdio";
 
 			phy3: ethernet-phy@03 {
 				interrupt-parent = < &ipic >;
arch/powerpc/boot/dts/mpc832x_rdb.dts +1 -2
index 4d5cfd3..f6a8633 100644
@@ -237,8 +237,7 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 			reg = <3120 18>;
-			device_type = "mdio";
-			compatible = "ucc_geth_phy";
+			compatible = "fsl,ucc-mdio";
 
 			phy00:ethernet-phy@00 {
 				interrupt-parent = <&pic>;
arch/powerpc/boot/dts/mpc836x_mds.dts +1 -2
index 9a2581b..fa98bdf 100644
@@ -288,8 +288,7 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 			reg = <2120 18>;
-			device_type = "mdio";
-			compatible = "ucc_geth_phy";
+			compatible = "fsl,ucc-mdio";
 
 			phy0: ethernet-phy@00 {
 				interrupt-parent = < &ipic >;
arch/powerpc/boot/dts/mpc836x_rdk.dts +1 -2
index e244619..e299442 100644
@@ -251,8 +251,7 @@
 		mdio@2120 {
 			#address-cells = <1>;
 			#size-cells = <0>;
-			device_type = "mdio";
-			compatible = "fsl,ucc-mdio", "ucc_geth_phy";
+			compatible = "fsl,ucc-mdio";
 			reg = <0x2120 0x18>;
 
 			phy1: ethernet-phy@1 {
arch/powerpc/boot/dts/mpc8568mds.dts +1 -1
index 04f5c6f..692d5bd 100644
@@ -357,7 +357,7 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 			reg = <2120 18>;
-			compatible = "ucc_geth_phy";
+			compatible = "fsl,ucc-mdio";
 
 			/* These are the same PHYs as on
 			 * gianfar's MDIO bus */
drivers/net/ucc_geth_mii.c +3 -0
index df884f0..e3ba14a 100644
@@ -256,6 +256,9 @@ static struct of_device_id uec_mdio_match[] = {
 		.type = "mdio",
 		.compatible = "ucc_geth_phy",
 	},
+	{
+		.compatible = "fsl,ucc-mdio",
+	},
 	{},
 };
 
Signature · 1 line
1.5.2.2
#8 lore raw

Re: [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type

Quoted 7 lines · Anton Vorontsov

device_type property is bogus, thus use proper compatible.

Also change compatible property to "fsl,ucc-mdio".

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

can we look at using "fsl,gianfar-mdio" ? Meaning my understanding the programming model for the UCC mdio is identical to gianfar MDIO programming.

- k

#9 lore raw

Re: [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type

Quoted 7 lines · Kumar Gala
Quoted 4 lines · Anton Vorontsov

device_type property is bogus, thus use proper compatible.

Also change compatible property to "fsl,ucc-mdio".

Quoted 7 lines
Quoted 3 lines

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

can we look at using "fsl,gianfar-mdio" ? Meaning my understanding the programming model for the UCC mdio is identical to gianfar MDIO programming.

I didn't look much into gianfar mii driver, so I can't tell.

Would "fsl,ucc-mdio", "fsl,gianfar-mdio" work for us? That way we'll match on "fsl,ucc-mdio" today, and "fsl,gianfar-mdio" when/if drivers are merged?

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
Applied
#10 lore raw

Re: [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type

In reply to Anton Vorontsov
Quoted 7 lines · Anton Vorontsov

device_type property is bogus, thus use proper compatible.

Also change compatible property to "fsl,ucc-mdio".

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

Quoted 9 lines
---
 arch/powerpc/boot/dts/mpc832x_mds.dts |    3 +--
 arch/powerpc/boot/dts/mpc832x_rdb.dts |    3 +--
 arch/powerpc/boot/dts/mpc836x_mds.dts |    3 +--
 arch/powerpc/boot/dts/mpc836x_rdk.dts |    3 +--
 arch/powerpc/boot/dts/mpc8568mds.dts  |    2 +-
 drivers/net/ucc_geth_mii.c            |    3 +++
 6 files changed, 8 insertions(+), 9 deletions(-)

applied. (same comment about rdk)

- k

#11 lore raw

PATCH v5 3/5 use brg-frequency for SPI in QE

In reply to Anton Vorontsov

In case of QE we can use brg-frequency (which is qeclk/2). Thus no need to divide sysclk in the spi_mpc83xx.

This patch also adds code to use get_brgfreq() on QE chips.

---
 arch/powerpc/sysdev/fsl_soc.c |   44 ++++++++++++++++++++++++++++------------
 drivers/spi/spi_mpc83xx.c     |    6 +----
 2 files changed, 32 insertions(+), 18 deletions(-)
arch/powerpc/sysdev/fsl_soc.c +31 -13
index 26f7d83..f4473ad 100644
@@ -75,7 +75,7 @@ phys_addr_t get_immrbase(void)
 
 EXPORT_SYMBOL(get_immrbase);
 
-#if defined(CONFIG_CPM2) || defined(CONFIG_8xx)
+#if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx)
 
 static u32 brgfreq = -1;
 
@@ -100,11 +100,21 @@ u32 get_brgfreq(void)
 
 	/* Legacy device binding -- will go away when no users are left. */
 	node = of_find_node_by_type(NULL, "cpm");
+	if (!node)
+		node = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!node)
+		node = of_find_node_by_type(NULL, "qe");
+
 	if (node) {
 		prop = of_get_property(node, "brg-frequency", &size);
 		if (prop && size == 4)
 			brgfreq = *prop;
 
+		if (brgfreq == -1 || brgfreq == 0) {
+			prop = of_get_property(node, "bus-frequency", &size);
+			if (prop && size == 4)
+				brgfreq = *prop / 2;
+		}
 		of_node_put(node);
 	}
 
@@ -1273,22 +1283,30 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
 {
 	struct device_node *np;
 	unsigned int i;
-	const u32 *sysclk;
+	u32 sysclk;
 
 	/* SPI controller is either clocked from QE or SoC clock */
-	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
-	if (!np)
-		np = of_find_node_by_type(NULL, "qe");
+	sysclk = get_brgfreq();
+	if (sysclk == -1) {
+		const u32 *freq;
+		int size;
 
-	if (!np)
 		np = of_find_node_by_type(NULL, "soc");
+		if (!np)
+			return -ENODEV;
+
+		freq = of_get_property(np, "clock-frequency", &size);
+		if (!freq || size != sizeof(*freq) || *freq == 0) {
+			freq = of_get_property(np, "bus-frequency", &size);
+			if (!freq || size != sizeof(*freq) || *freq == 0) {
+				of_node_put(np);
+				return -ENODEV;
+			}
+		}
 
-	if (!np)
-		return -ENODEV;
-
-	sysclk = of_get_property(np, "bus-frequency", NULL);
-	if (!sysclk)
-		return -ENODEV;
+		sysclk = *freq;
+		of_node_put(np);
+	}
 
 	for (np = NULL, i = 1;
 	     (np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
@@ -1305,7 +1323,7 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
 
 		memset(res, 0, sizeof(res));
 
-		pdata.sysclk = *sysclk;
+		pdata.sysclk = sysclk;
 
 		prop = of_get_property(np, "reg", NULL);
 		if (!prop)
drivers/spi/spi_mpc83xx.c +1 -5
index 4580b9c..04f7cd9 100644
@@ -436,11 +436,7 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
 	mpc83xx_spi->qe_mode = pdata->qe_mode;
 	mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
 	mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;
-
-	if (mpc83xx_spi->qe_mode)
-		mpc83xx_spi->spibrg = pdata->sysclk / 2;
-	else
-		mpc83xx_spi->spibrg = pdata->sysclk;
+	mpc83xx_spi->spibrg = pdata->sysclk;
 
 	mpc83xx_spi->rx_shift = 0;
 	mpc83xx_spi->tx_shift = 0;
Signature · 1 line
1.5.2.2
Applied
#12 lore raw

Re: [PATCH 3/5] [POWERPC][SPI] use brg-frequency for SPI in QE

Quoted 12 lines · Anton Vorontsov

In case of QE we can use brg-frequency (which is qeclk/2). Thus no need to divide sysclk in the spi_mpc83xx.

This patch also adds code to use get_brgfreq() on QE chips.

---
 arch/powerpc/sysdev/fsl_soc.c |   44 ++++++++++++++++++++++++++++------------
 drivers/spi/spi_mpc83xx.c     |    6 +----
 2 files changed, 32 insertions(+), 18 deletions(-)

applied

- k

#13 lore raw

PATCH v5 4/5 fsl_spi_init and users: stop using device_type = "spi"

In reply to Anton Vorontsov

Also:
- rename "fsl_spi" to "fsl,spi";
- add and use cell-index property, if found;
- split probing code out of fsl_spi_init, thus we can call it for legacy device_type probing and new "compatible" probing.

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

---
 Documentation/powerpc/booting-without-of.txt |    8 +-
 arch/powerpc/boot/dts/mpc8313erdb.dts        |    4 +-
 arch/powerpc/boot/dts/mpc832x_mds.dts        |    8 +-
 arch/powerpc/boot/dts/mpc832x_rdb.dts        |    8 +-
 arch/powerpc/boot/dts/mpc8349emitx.dts       |    4 +-
 arch/powerpc/boot/dts/mpc8349emitxgp.dts     |    4 +-
 arch/powerpc/boot/dts/mpc834x_mds.dts        |    4 +-
 arch/powerpc/boot/dts/mpc836x_mds.dts        |    8 +-
 arch/powerpc/boot/dts/mpc836x_rdk.dts        |    6 +-
 arch/powerpc/boot/dts/mpc8568mds.dts         |    8 +-
 arch/powerpc/sysdev/fsl_soc.c                |   94 ++++++++++++++++----------
 11 files changed, 88 insertions(+), 68 deletions(-)
Documentation/powerpc/booting-without-of.txt +4 -4
index f9545b0..bedfdd0 100644
@@ -1568,8 +1568,8 @@ platforms are moved over to use the flattened-device-tree model.
    ii) SPI (Serial Peripheral Interface)
 
    Required properties:
-   - device_type : should be "spi".
-   - compatible : should be "fsl_spi".
+   - cell-index : SPI controller index.
+   - compatible : should be "fsl,spi".
    - mode : the SPI operation mode, it can be "cpu" or "cpu-qe".
    - reg : Offset and length of the register set for the device
    - interrupts : <a b> where a is the interrupt number and b is a
@@ -1582,8 +1582,8 @@ platforms are moved over to use the flattened-device-tree model.
 
    Example:
 	spi@4c0 {
-		device_type = "spi";
-		compatible = "fsl_spi";
+		cell-index = <0>;
+		compatible = "fsl,spi";
 		reg = <4c0 40>;
 		interrupts = <82 0>;
 		interrupt-parent = <700>;
arch/powerpc/boot/dts/mpc8313erdb.dts +2 -2
index 9bcf2c9..20a03f5 100644
@@ -130,8 +130,8 @@
 		};
 
 		spi@7000 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <0>;
+			compatible = "fsl,spi";
 			reg = <7000 1000>;
 			interrupts = <10 8>;
 			interrupt-parent = < &ipic >;
arch/powerpc/boot/dts/mpc832x_mds.dts +4 -4
index 1bb75ef..15bb345 100644
@@ -223,8 +223,8 @@
 		};
 
 		spi@4c0 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <0>;
+			compatible = "fsl,spi";
 			reg = <4c0 40>;
 			interrupts = <2>;
 			interrupt-parent = < &qeic >;
@@ -232,8 +232,8 @@
 		};
 
 		spi@500 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <1>;
+			compatible = "fsl,spi";
 			reg = <500 40>;
 			interrupts = <1>;
 			interrupt-parent = < &qeic >;
arch/powerpc/boot/dts/mpc832x_rdb.dts +4 -4
index f6a8633..f086fac 100644
@@ -184,8 +184,8 @@
 		};
 
 		spi@4c0 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <0>;
+			compatible = "fsl,spi";
 			reg = <4c0 40>;
 			interrupts = <2>;
 			interrupt-parent = <&qeic>;
@@ -193,8 +193,8 @@
 		};
 
 		spi@500 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <1>;
+			compatible = "fsl,spi";
 			reg = <500 40>;
 			interrupts = <1>;
 			interrupt-parent = <&qeic>;
arch/powerpc/boot/dts/mpc8349emitx.dts +2 -2
index 04b8da4..4a4ddea 100644
@@ -82,8 +82,8 @@
 		};
 
 		spi@7000 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <0>;
+			compatible = "fsl,spi";
 			reg = <7000 1000>;
 			interrupts = <10 8>;
 			interrupt-parent = < &ipic >;
arch/powerpc/boot/dts/mpc8349emitxgp.dts +2 -2
index a06ff92..79983d7 100644
@@ -80,8 +80,8 @@
 		};
 
 		spi@7000 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <0>;
+			compatible = "fsl,spi";
 			reg = <7000 1000>;
 			interrupts = <10 8>;
 			interrupt-parent = < &ipic >;
arch/powerpc/boot/dts/mpc834x_mds.dts +2 -2
index 4120e92..1736e03 100644
@@ -93,8 +93,8 @@
 		};
 
 		spi@7000 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <0>;
+			compatible = "fsl,spi";
 			reg = <7000 1000>;
 			interrupts = <10 8>;
 			interrupt-parent = < &ipic >;
arch/powerpc/boot/dts/mpc836x_mds.dts +4 -4
index fa98bdf..d3b8262 100644
@@ -225,8 +225,8 @@
 		};
 
 		spi@4c0 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <0>;
+			compatible = "fsl,spi";
 			reg = <4c0 40>;
 			interrupts = <2>;
 			interrupt-parent = < &qeic >;
@@ -234,8 +234,8 @@
 		};
 
 		spi@500 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <1>;
+			compatible = "fsl,spi";
 			reg = <500 40>;
 			interrupts = <1>;
 			interrupt-parent = < &qeic >;
arch/powerpc/boot/dts/mpc836x_rdk.dts +2 -4
index e299442..6efa5b7 100644
@@ -165,9 +165,8 @@
 		};
 
 		spi@4c0 {
-			device_type = "spi";
 			cell-index = <0>;
-			compatible = "fsl,spi", "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <0x4c0 0x40>;
 			interrupts = <2>;
 			interrupt-parent = <&qeic>;
@@ -175,9 +174,8 @@
 		};
 
 		spi@500 {
-			device_type = "spi";
 			cell-index = <1>;
-			compatible = "fsl,spi", "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <0x500 0x40>;
 			interrupts = <1>;
 			interrupt-parent = <&qeic>;
arch/powerpc/boot/dts/mpc8568mds.dts +4 -4
index 692d5bd..c929fba 100644
@@ -302,8 +302,8 @@
 		};
 
 		spi@4c0 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <0>;
+			compatible = "fsl,spi";
 			reg = <4c0 40>;
 			interrupts = <2>;
 			interrupt-parent = <&qeic>;
@@ -311,8 +311,8 @@
 		};
 
 		spi@500 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			cell-index = <1>;
+			compatible = "fsl,spi";
 			reg = <500 40>;
 			interrupts = <1>;
 			interrupt-parent = <&qeic>;
arch/powerpc/sysdev/fsl_soc.c +58 -36

126 lines not on this page · raw message

Signature · 1 line
1.5.2.2
Applied
#14 lore raw

Re: [PATCH 4/5] [POWERPC] fsl_spi_init and users: stop using device_type = "spi"

Quoted 9 lines · Anton Vorontsov

Also:
- rename "fsl_spi" to "fsl,spi";
- add and use cell-index property, if found;
- split probing code out of fsl_spi_init, thus we can call it for legacy device_type probing and new "compatible" probing.

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

Quoted 14 lines
---
 Documentation/powerpc/booting-without-of.txt |    8 +-
 arch/powerpc/boot/dts/mpc8313erdb.dts        |    4 +-
 arch/powerpc/boot/dts/mpc832x_mds.dts        |    8 +-
 arch/powerpc/boot/dts/mpc832x_rdb.dts        |    8 +-
 arch/powerpc/boot/dts/mpc8349emitx.dts       |    4 +-
 arch/powerpc/boot/dts/mpc8349emitxgp.dts     |    4 +-
 arch/powerpc/boot/dts/mpc834x_mds.dts        |    4 +-
 arch/powerpc/boot/dts/mpc836x_mds.dts        |    8 +-
 arch/powerpc/boot/dts/mpc836x_rdk.dts        |    6 +-
 arch/powerpc/boot/dts/mpc8568mds.dts         |    8 +-
 arch/powerpc/sysdev/fsl_soc.c                |   94 ++++++++++++++++----------
 11 files changed, 88 insertions(+), 68 deletions(-)

applied. (sans _rdk)

- k

#15 lore raw

PATCH v5 5/5 fsl_soc, legacy_serial: add support for "soc" compatible matching

In reply to Anton Vorontsov

We'll match on "soc" compatible for generic code, and "fsl,soc" for fsl specific code.

Unfortunately it's still impossible to remove device_type = "soc" from the existing device tree, because older u-boots are looking for it.

Neither we can remove model number from the soc name to heal arch/powerpc/boot/cuboot-85xx.c, because then dts'es will be incompatible with older u-boots again.

So, just one machine converted so far: MPC8360E-RDK. It's new machine so we don't care about backward compatibility yet.

---

I know, this patch will conflict with the legacy serial rework[1]. It's okay though, if [1] will hit galak/powerpc.git first, I'll simply rebase that patch.

[1] http://ozlabs.org/pipermail/linuxppc-dev/2008-January/050096.html

 Documentation/powerpc/booting-without-of.txt |   18 ++++------
 arch/powerpc/boot/dts/mpc836x_rdk.dts        |    1 -
 arch/powerpc/kernel/legacy_serial.c          |    3 +-
 arch/powerpc/sysdev/fsl_soc.c                |   51 +++++++++++++++-----------
 4 files changed, 39 insertions(+), 34 deletions(-)
Documentation/powerpc/booting-without-of.txt +7 -11
index bedfdd0..a3b6e2a 100644
@@ -32,7 +32,7 @@ Table of Contents
       c) The /cpus/* nodes
       d) the /memory node(s)
       e) The /chosen node
-      f) the /soc<SOCname> node
+      f) the /soc node
 
   IV - "dtc", the device tree compiler
 
@@ -960,20 +960,16 @@ compatibility.
   under /chosen called interrupt-controller which had a phandle value
   that pointed to the main interrupt controller)
 
-  f) the /soc<SOCname> node
+  f) the /soc node
 
   This node is used to represent a system-on-a-chip (SOC) and must be
   present if the processor is a SOC. The top-level soc node contains
-  information that is global to all devices on the SOC. The node name
-  should contain a unit address for the SOC, which is the base address
-  of the memory-mapped register set for the SOC. The name of an soc
-  node should start with "soc", and the remainder of the name should
-  represent the part number for the soc.  For example, the MPC8540's
-  soc node would be called "soc8540".
+  information that is global to all devices on the SOC. The name of an
+  soc node should be "soc".
 
   Required properties:
 
-    - device_type : Should be "soc"
+    - compatible : Should be "cpu-specific-soc", "soc".
     - ranges : Should be defined as specified in 1) to describe the
       translation of SOC addresses for memory mapped SOC registers.
     - bus-frequency: Contains the bus frequency for the SOC node.
@@ -2713,11 +2709,11 @@ Note that the #address-cells and #size-cells for the SoC node
 in this example have been explicitly listed; these are likely
 not necessary as they are usually the same as the root node.
 
-	soc8540@e0000000 {
+	soc@e0000000 {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		#interrupt-cells = <2>;
-		device_type = "soc";
+		compatible = "fsl,mpc8540-soc", "fsl,soc", "soc";
 		ranges = <00000000 e0000000 00100000>
 		reg = <e0000000 00003000>;
 		bus-frequency = <0>;
arch/powerpc/boot/dts/mpc836x_rdk.dts +0 -1
index 6efa5b7..ef739ee 100644
@@ -58,7 +58,6 @@
 	soc@e0000000 {
 		#address-cells = <1>;
 		#size-cells = <1>;
-		device_type = "soc";
 		compatible = "fsl,mpc8360-soc", "fsl,soc", "soc";
 		ranges = <0 0xe0000000 0x100000>;
 		reg = <0xe0000000 0x200>;
arch/powerpc/kernel/legacy_serial.c +2 -1
index 4bfff88..c99d0ae 100644
@@ -309,7 +309,8 @@ void __init find_legacy_serial_ports(void)
 	/* First fill our array with SOC ports */
 	for_each_compatible_node(np, "serial", "ns16550") {
 		struct device_node *soc = of_get_parent(np);
-		if (soc && !strcmp(soc->type, "soc")) {
+		if (soc && (!strcmp(soc->type, "soc") ||
+				of_device_is_compatible(soc, "soc"))) {
 			index = add_legacy_soc_port(np, np);
 			if (index >= 0 && np == stdout)
 				legacy_serial_console = index;
arch/powerpc/sysdev/fsl_soc.c +30 -21

77 lines not on this page · raw message

Signature · 1 line
1.5.2.2
#16 lore raw

Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching

Quoted 21 lines · Anton Vorontsov

We'll match on "soc" compatible for generic code, and "fsl,soc" for fsl specific code.

Unfortunately it's still impossible to remove device_type = "soc" from the existing device tree, because older u-boots are looking for it.

Neither we can remove model number from the soc name to heal arch/powerpc/boot/cuboot-85xx.c, because then dts'es will be incompatible with older u-boots again.

So, just one machine converted so far: MPC8360E-RDK. It's new machine so we don't care about backward compatibility yet.

---

I know, this patch will conflict with the legacy serial rework[1]. It's okay though, if [1] will hit galak/powerpc.git first, I'll simply rebase that patch.

Quoted 8 lines

[1] http://ozlabs.org/pipermail/linuxppc-dev/2008-January/050096.html

Documentation/powerpc/booting-without-of.txt |   18 ++++------
arch/powerpc/boot/dts/mpc836x_rdk.dts        |    1 -
arch/powerpc/kernel/legacy_serial.c          |    3 +-
arch/powerpc/sysdev/fsl_soc.c                |   51 ++++++++++++++ 
+-----------
4 files changed, 39 insertions(+), 34 deletions(-)

this needs a bit more discussion. "fsl,soc" is terrible describe. I think we want some generic for the compat that implies 'soc register space'.

- k

#17 lore raw

Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching

Quoted 26 lines · Kumar Gala
Quoted 23 lines · Anton Vorontsov

We'll match on "soc" compatible for generic code, and "fsl,soc" for fsl specific code.

Unfortunately it's still impossible to remove device_type = "soc" from the existing device tree, because older u-boots are looking for it.

Neither we can remove model number from the soc name to heal arch/powerpc/boot/cuboot-85xx.c, because then dts'es will be incompatible with older u-boots again.

So, just one machine converted so far: MPC8360E-RDK. It's new machine so we don't care about backward compatibility yet.

---

I know, this patch will conflict with the legacy serial rework[1]. It's okay though, if [1] will hit galak/powerpc.git first, I'll simply rebase that patch.

[1] http://ozlabs.org/pipermail/linuxppc-dev/2008-January/050096.html

Quoted 8 lines
Quoted 6 lines
Documentation/powerpc/booting-without-of.txt |   18 ++++------
arch/powerpc/boot/dts/mpc836x_rdk.dts        |    1 -
arch/powerpc/kernel/legacy_serial.c          |    3 +-
arch/powerpc/sysdev/fsl_soc.c                |   51 ++++++++++++++ 
+-----------
4 files changed, 39 insertions(+), 34 deletions(-)

this needs a bit more discussion.

Ok.

Quoted 3 lines

"fsl,soc" is terrible describe. I
think we want some generic for the compat that implies 'soc register space'.

My thinking:

Freescale soc register space: "fsl,soc"
generic soc device: "soc" (or maybe "linux,soc" better?)

I know, Scott Wood is pushing "xxxx-immr" thing forward... but I don't like that name because SOC isn't only device with the Internal Memory Mapped Registers. (Think of QE placed outside of "soc"/"immr" node).

Though, "soc" by itself is fully unfortunate name. QE is the part of SOC too, as we used to call it when speaking of hardware. But logically we divide things for "core soc" and "core soc's companion/communication/offload modules", i.e. QE/CPMs/...

We can remove that ambiguity by moving QE/CPMs nodes inside the soc node. Then indeed -immr would be the best compatible for the "soc" node.

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
#18 lore raw

Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching

On Fri, Jan 25, 2008 at 08:13:55PM +0300, Anton Vorontsov wrote:
[...]

Quoted 10 lines

My thinking:

Freescale soc register space: "fsl,soc"
generic soc device: "soc" (or maybe "linux,soc" better?)

I know, Scott Wood is pushing "xxxx-immr" thing forward... but I don't like that name because SOC isn't only device with the Internal Memory Mapped Registers. (Think of QE placed outside of "soc"/"immr" node).

Quoted 8 lines

Though, "soc" by itself is fully unfortunate name. QE is the part of SOC too, as we used to call it when speaking of hardware. But logically we divide things for "core soc" and "core soc's companion/communication/offload modules", i.e. QE/CPMs/...

We can remove that ambiguity by moving QE/CPMs nodes inside the soc node. Then indeed -immr would be the best compatible for the "soc" node.

Oh, and yes, I'm aware that CPM's IMMRs are relocatable, and that's [most probably] why we have CPMs outside of soc node. So, my point is that that -immr name is too vague, so in my opinion we should avoid using it.

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
#19 lore raw

Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching

In reply to Anton Vorontsov
Quoted 6 lines · Anton Vorontsov

Freescale soc register space: "fsl,soc"
generic soc device: "soc" (or maybe "linux,soc" better?)

I know, Scott Wood is pushing "xxxx-immr" thing forward... but I don't like that name because SOC isn't only device with the Internal Memory Mapped Registers.

If you look in the manual for xxxx, you'll find something called "Internal Memory Mapped Registers". Thus, the name xxxx-immr.

Quoted 1 line

(Think of QE placed outside of "soc"/"immr" node).

When is the QE ever placed outside the soc/immr/ccsr node? The QE registers are part of the IMMR/CCSR.

-Scott

#20 lore raw

Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching

Quoted 10 lines · Scott Wood
Quoted 6 lines · Anton Vorontsov

Freescale soc register space: "fsl,soc"
generic soc device: "soc" (or maybe "linux,soc" better?)

I know, Scott Wood is pushing "xxxx-immr" thing forward... but I don't like that name because SOC isn't only device with the Internal Memory Mapped Registers.

If you look in the manual for xxxx, you'll find something called "Internal Memory Mapped Registers". Thus, the name xxxx-immr.

Theory.

Quoted 4 lines
Quoted 1 line

(Think of QE placed outside of "soc"/"immr" node).

When is the QE ever placed outside the soc/immr/ccsr node? The QE registers are part of the IMMR/CCSR.

Practice.

$ grep qe@ arch/powerpc/boot/dts/*
arch/powerpc/boot/dts/mpc832x_mds.dts:  qe@e0100000 {
arch/powerpc/boot/dts/mpc832x_rdb.dts:  qe@e0100000 {
arch/powerpc/boot/dts/mpc836x_mds.dts:  qe@e0100000 {
arch/powerpc/boot/dts/mpc8568mds.dts:   qe@e0080000 {

^^^ if the practice is wrong, then we should fix it, and then -immr would be the good name indeed (just as I've said previously).

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
#21 lore raw

Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching

Quoted 8 lines · Anton Vorontsov
$ grep qe@ arch/powerpc/boot/dts/*
arch/powerpc/boot/dts/mpc832x_mds.dts:  qe@e0100000 {
arch/powerpc/boot/dts/mpc832x_rdb.dts:  qe@e0100000 {
arch/powerpc/boot/dts/mpc836x_mds.dts:  qe@e0100000 {
arch/powerpc/boot/dts/mpc8568mds.dts:   qe@e0080000 {

^^^ if the practice is wrong, then we should fix it, and then -immr would be the good name indeed (just as I've said previously).

It's wrong, and we should fix it. It would make sense if the QE block were relocatable separately from IMMR (but even if it were, the QE compatible should be fsl,xxxx-qe or similar, so no conflict with fsl,xxxx-immr) -- but it isn't, at least on the 8323 and 8360 (I don't have an 8568 manual handy).

-Scott

#22 lore raw

Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching

Quoted 11 lines · Scott Wood
Quoted 8 lines · Anton Vorontsov
$ grep qe@ arch/powerpc/boot/dts/*
arch/powerpc/boot/dts/mpc832x_mds.dts:  qe@e0100000 {
arch/powerpc/boot/dts/mpc832x_rdb.dts:  qe@e0100000 {
arch/powerpc/boot/dts/mpc836x_mds.dts:  qe@e0100000 {
arch/powerpc/boot/dts/mpc8568mds.dts:   qe@e0080000 {

^^^ if the practice is wrong, then we should fix it, and then -immr would be the good name indeed (just as I've said previously).

It's wrong, and we should fix it.

Ok, good. I'll fix that for at least new RDK board. Though, fixing other boards would be not trivial because of backward compatibility and such. I'll also use -immr for RDK.

Quoted 5 lines

It would make sense if the QE block
were relocatable separately from IMMR (but even if it were, the QE compatible should be fsl,xxxx-qe or similar, so no conflict with fsl,xxxx-immr) -- but it isn't, at least on the 8323 and 8360 (I don't have an 8568 manual handy).

Nobody have an MPC8568E manual handy. :-P I've just looked there.. no QE isn't relocatable.

Oh, and I lied regarding CPM being relocatable. It isn't, at least CPM2 and at least on MPC8555E. What a pity.

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
#23 lore raw
In reply to Anton Vorontsov

On Thu, Jan 24, 2008 at 06:18:50PM +0300, Anton Vorontsov wrote:
[..]

Quoted 19 lines
 Documentation/powerpc/booting-without-of.txt   |   26 +--
 arch/powerpc/boot/dts/mpc832x_mds.dts          |   11 -
 arch/powerpc/boot/dts/mpc832x_rdb.dts          |   11 -
 arch/powerpc/boot/dts/mpc836x_mds.dts          |   11 -
 arch/powerpc/boot/dts/mpc836x_rdk.dts          |   10 -
 arch/powerpc/boot/dts/mpc8568mds.dts           |   10 -
 arch/powerpc/sysdev/fsl_soc.c                  |  191 +++++++++++++++----------
 b/Documentation/powerpc/booting-without-of.txt |   11 -
 b/arch/powerpc/boot/dts/mpc8313erdb.dts        |    4
 b/arch/powerpc/boot/dts/mpc832x_mds.dts        |    9 -
 b/arch/powerpc/boot/dts/mpc832x_rdb.dts        |   10 -
 b/arch/powerpc/boot/dts/mpc8349emitx.dts       |    4
 b/arch/powerpc/boot/dts/mpc8349emitxgp.dts     |    4
 b/arch/powerpc/boot/dts/mpc834x_mds.dts        |    4
 b/arch/powerpc/boot/dts/mpc836x_mds.dts        |   10 -
 b/arch/powerpc/boot/dts/mpc836x_rdk.dts        |    1
 b/arch/powerpc/boot/dts/mpc8568mds.dts         |   10 -
 b/arch/powerpc/kernel/legacy_serial.c          |    3
 b/arch/powerpc/platforms/83xx/mpc832x_mds.c    |   11 -
Quoted 8 lines
 b/arch/powerpc/platforms/83xx/mpc832x_rdb.c    |   11 -
 b/arch/powerpc/platforms/83xx/mpc836x_mds.c    |   11 -
 b/arch/powerpc/platforms/85xx/mpc85xx_mds.c    |   32 ++--
 b/arch/powerpc/sysdev/fsl_soc.c                |    5
 b/arch/powerpc/sysdev/qe_lib/qe.c              |   64 +++++---
 b/drivers/net/ucc_geth_mii.c                   |    4
 b/drivers/spi/spi_mpc83xx.c                    |   10 -
 26 files changed, 284 insertions(+), 204 deletions(-)

Heh. git-format-patch --stdout -5 | diffstat doesn't work correctly. Once I've already stumbled against this, but obviously forgot.

Here is correct diffstat summary:

 Documentation/powerpc/booting-without-of.txt |   37 +++----
 arch/powerpc/boot/dts/mpc8313erdb.dts        |    4
 arch/powerpc/boot/dts/mpc832x_mds.dts        |   20 +--
 arch/powerpc/boot/dts/mpc832x_rdb.dts        |   21 ++-
 arch/powerpc/boot/dts/mpc8349emitx.dts       |    4
 arch/powerpc/boot/dts/mpc8349emitxgp.dts     |    4
 arch/powerpc/boot/dts/mpc834x_mds.dts        |    4
 arch/powerpc/boot/dts/mpc836x_mds.dts        |   21 ++-
 arch/powerpc/boot/dts/mpc836x_rdk.dts        |   11 --
 arch/powerpc/boot/dts/mpc8568mds.dts         |   20 ++-
 arch/powerpc/kernel/legacy_serial.c          |    3
 arch/powerpc/platforms/83xx/mpc832x_mds.c    |   11 +-
 arch/powerpc/platforms/83xx/mpc832x_rdb.c    |   11 +-
 arch/powerpc/platforms/83xx/mpc836x_mds.c    |   11 +-
 arch/powerpc/platforms/85xx/mpc85xx_mds.c    |   32 +++---
 arch/powerpc/sysdev/fsl_soc.c                |  142 ++++++++++++++++++---------
 arch/powerpc/sysdev/qe_lib/qe.c              |   63 ++++++++---
 drivers/net/ucc_geth_mii.c                   |    3
 drivers/spi/spi_mpc83xx.c                    |    6 -
 19 files changed, 258 insertions(+), 170 deletions(-)
Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
#24 lore raw
Quoted 3 lines

Heh. git-format-patch --stdout -5 | diffstat doesn't work correctly. Once I've already stumbled against this, but obviously forgot.

Might try:

   git diff --stat HEAD~4

or such!

Enjoy,
jdl

#25 lore raw

[PATCH 6/5] [POWERPC] get rid of `model = "UCC"' in the ucc nodes

In reply to Anton Vorontsov

It isn't used anywhere, so remove it. If we'll ever need something like this, we'll use compatible property instead.

---

New cleanup in this series...

 Documentation/powerpc/booting-without-of.txt |    1 -
 arch/powerpc/boot/dts/mpc832x_mds.dts        |    3 ---
 arch/powerpc/boot/dts/mpc832x_rdb.dts        |    2 --
 arch/powerpc/boot/dts/mpc836x_mds.dts        |    2 --
 arch/powerpc/boot/dts/mpc8568mds.dts         |    2 --
 5 files changed, 0 insertions(+), 10 deletions(-)
Documentation/powerpc/booting-without-of.txt +0 -1
index a3b6e2a..ab9f0bf 100644
@@ -1675,7 +1675,6 @@ platforms are moved over to use the flattened-device-tree model.
 	ucc@2000 {
 		device_type = "network";
 		compatible = "ucc_geth";
-		model = "UCC";
 		device-id = <1>;
 		reg = <2000 200>;
 		interrupts = <a0 0>;
arch/powerpc/boot/dts/mpc832x_mds.dts +0 -3
index 15bb345..c60ebf7 100644
@@ -251,7 +251,6 @@
 		enet0: ucc@2200 {
 			device_type = "network";
 			compatible = "ucc_geth";
-			model = "UCC";
 			cell-index = <3>;
 			device-id = <3>;
 			reg = <2200 200>;
@@ -267,7 +266,6 @@
 		enet1: ucc@3200 {
 			device_type = "network";
 			compatible = "ucc_geth";
-			model = "UCC";
 			cell-index = <4>;
 			device-id = <4>;
 			reg = <3200 200>;
@@ -283,7 +281,6 @@
 		ucc@2400 {
 			device_type = "serial";
 			compatible = "ucc_uart";
-			model = "UCC";
 			device-id = <5>;	/* The UCC number, 1-7*/
 			port-number = <0>;	/* Which ttyQEx device */
 			soft-uart;		/* We need Soft-UART */
arch/powerpc/boot/dts/mpc832x_rdb.dts +0 -2
index f086fac..60461be 100644
@@ -204,7 +204,6 @@
 		enet0: ucc@3000 {
 			device_type = "network";
 			compatible = "ucc_geth";
-			model = "UCC";
 			cell-index = <2>;
 			device-id = <2>;
 			reg = <3000 200>;
@@ -220,7 +219,6 @@
 		enet1: ucc@2200 {
 			device_type = "network";
 			compatible = "ucc_geth";
-			model = "UCC";
 			cell-index = <3>;
 			device-id = <3>;
 			reg = <2200 200>;
arch/powerpc/boot/dts/mpc836x_mds.dts +0 -2
index d3b8262..e2b20f7 100644
@@ -253,7 +253,6 @@
 		enet0: ucc@2000 {
 			device_type = "network";
 			compatible = "ucc_geth";
-			model = "UCC";
 			cell-index = <1>;
 			device-id = <1>;
 			reg = <2000 200>;
@@ -270,7 +269,6 @@
 		enet1: ucc@3000 {
 			device_type = "network";
 			compatible = "ucc_geth";
-			model = "UCC";
 			cell-index = <2>;
 			device-id = <2>;
 			reg = <3000 200>;
arch/powerpc/boot/dts/mpc8568mds.dts +0 -2
index c929fba..e136410 100644
@@ -322,7 +322,6 @@
 		enet2: ucc@2000 {
 			device_type = "network";
 			compatible = "ucc_geth";
-			model = "UCC";
 			cell-index = <1>;
 			device-id = <1>;
 			reg = <2000 200>;
@@ -339,7 +338,6 @@
 		enet3: ucc@3000 {
 			device_type = "network";
 			compatible = "ucc_geth";
-			model = "UCC";
 			cell-index = <2>;
 			device-id = <2>;
 			reg = <3000 200>;
Signature · 1 line
1.5.2.2
#26 lore raw

Re: [PATCH 6/5] [POWERPC] get rid of `model = "UCC"' in the ucc nodes

Quoted 25 lines · Anton Vorontsov

It isn't used anywhere, so remove it. If we'll ever need something like this, we'll use compatible property instead.

---

New cleanup in this series...

Documentation/powerpc/booting-without-of.txt |    1 -
arch/powerpc/boot/dts/mpc832x_mds.dts        |    3 ---
arch/powerpc/boot/dts/mpc832x_rdb.dts        |    2 --
arch/powerpc/boot/dts/mpc836x_mds.dts        |    2 --
arch/powerpc/boot/dts/mpc8568mds.dts         |    2 --
5 files changed, 0 insertions(+), 10 deletions(-)
Documentation/powerpc/booting-without-of.txt +0 -0
index a3b6e2a..ab9f0bf 100644
@@ -1675,7 +1675,6 @@ platforms are moved over to use the flattened- 

device-tree model.

	ucc@2000 {
		device_type = "network";
		compatible = "ucc_geth";
Documentation/powerpc/booting-without-of.txt +0 -1
-		model = "UCC";
Quoted 1 line
		device-id = <1>;

can device-id be changed to cell-index?

- k