Skip to contentSkip to conversation

device_type/compatible cleanups

PATCH Superseded Anton Vorontsov 9 participants 17 messages Dec 19, 2007 2 messages not in the archive

Subsystems (5)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover device_type/compatible cleanups

Hi all,

Here are few cleanups purposed by David Gibson and Scott Wood:
http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

Patches are well split and bisect-able.

Scott, I didn't add "fsl,cpm-muram" stuff, it just doesn't make sense now: qe and cpm anyway using different code base.

Thanks,

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

Scott, I didn't add "fsl,cpm-muram" stuff, it just doesn't make sense now: qe and cpm anyway using different code base.

That should change.

-Scott

#4 lore raw

PATCH 1/4 qe_lib and users: get rid of device_type and model

In reply to Anton Vorontsov

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

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

---
 arch/powerpc/boot/dts/mpc832x_mds.dts |    6 +++---
 arch/powerpc/boot/dts/mpc832x_rdb.dts |    6 +++---
 arch/powerpc/boot/dts/mpc836x_mds.dts |    6 +++---
 arch/powerpc/boot/dts/mpc8568mds.dts  |    6 +++---
 arch/powerpc/sysdev/fsl_soc.c         |    2 +-
 arch/powerpc/sysdev/qe_lib/qe.c       |    7 ++++---
 6 files changed, 17 insertions(+), 16 deletions(-)
arch/powerpc/boot/dts/mpc832x_mds.dts +3 -3
index 26ac467..ef8cd1e 100644
@@ -175,18 +175,18 @@
 	qe@e0100000 {
 		#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";
 			ranges = <0 00010000 00004000>;
 
 			data-only@0 {
+				compatible = "fsl,qe-muram-data";
 				reg = <0 4000>;
 			};
 		};
arch/powerpc/boot/dts/mpc832x_rdb.dts +3 -3
index 10ff7aa..7c4f028 100644
@@ -165,18 +165,18 @@
 	qe@e0100000 {
 		#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";
 			ranges = <0 00010000 00004000>;
 
 			data-only@0 {
+				compatible = "fsl,qe-muram-data";
 				reg = <0 4000>;
 			};
 		};
arch/powerpc/boot/dts/mpc836x_mds.dts +3 -3
index fd841b2..5c73786 100644
@@ -206,18 +206,18 @@
 	qe@e0100000 {
 		#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";
+			device_type = "fsl,qe-muram";
 			ranges = <0 00010000 0000c000>;
 
 			data-only@0{
+				device_type = "fsl,qe-muram-data";
 				reg = <0 c000>;
 			};
 		};
arch/powerpc/boot/dts/mpc8568mds.dts +3 -3
index 5818a7c..7ad4b9f 100644
@@ -283,18 +283,18 @@
 	qe@e0080000 {
 		#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";
 			ranges = <0 00010000 0000c000>;
 
 			data-only@0{
+				compatible = "fsl,qe-muram-data";
 				reg = <0 c000>;
 			};
 		};
arch/powerpc/sysdev/fsl_soc.c +1 -1
index 4baad80..044dd7f 100644
@@ -1226,7 +1226,7 @@ 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, "soc");
 
arch/powerpc/sysdev/qe_lib/qe.c +4 -3
index 21e0106..4af71e1 100644
@@ -68,7 +68,7 @@ phys_addr_t get_qe_base(void)
 	if (qebase != -1)
 		return qebase;
 
-	qe = of_find_node_by_type(NULL, "qe");
+	qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
 	if (qe) {
 		unsigned int size;
 		const void *prop = of_get_property(qe, "reg", &size);
@@ -155,7 +155,7 @@ unsigned int get_brg_clk(void)
 	if (brg_clk)
 		return brg_clk;
 
-	qe = of_find_node_by_type(NULL, "qe");
+	qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
 	if (qe) {
 		unsigned int size;
 		const u32 *prop = of_get_property(qe, "brg-frequency", &size);
@@ -334,7 +334,8 @@ static void qe_muram_init(void)
 	/* XXX: This is a subset of the available muram. It
 	 * varies with the processor and the microcode patches activated.
 	 */
-	if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) {
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe-muram-data");
+	if (np) {
 		address = *of_get_address(np, 0, &size, &flags);
 		of_node_put(np);
 		rh_attach_region(&qe_muram_info, address, (int) size);
Signature · 1 line
1.5.2.2
#5 lore raw

PATCH 2/4 ucc_geth_mii and users: get rid of device_type

In reply to Anton Vorontsov

device_type property is bogus, better use proper compatible property.

Also change compatible 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/mpc8568mds.dts  |    2 +-
 drivers/net/ucc_geth_mii.c            |    3 +--
 5 files changed, 5 insertions(+), 9 deletions(-)
arch/powerpc/boot/dts/mpc832x_mds.dts +1 -2
index ef8cd1e..97757ed 100644
@@ -254,8 +254,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 7c4f028..b1c73f1 100644
@@ -235,8 +235,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 5c73786..330212d 100644
@@ -287,8 +287,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/mpc8568mds.dts +1 -1
index 7ad4b9f..c00aec9 100644
@@ -355,7 +355,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 +1 -2
index df884f0..de8ba1f 100644
@@ -253,8 +253,7 @@ int uec_mdio_remove(struct of_device *ofdev)
 
 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
#7 lore raw

PATCH 3/4 use brg-frequency for SPI in QE

In reply to a message not in the archive

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

---
 arch/powerpc/sysdev/fsl_soc.c |   18 +++++++++++-------
 drivers/spi/spi_mpc83xx.c     |    6 +-----
 2 files changed, 12 insertions(+), 12 deletions(-)
arch/powerpc/sysdev/fsl_soc.c +11 -7
index 044dd7f..3cf84d0 100644
@@ -1227,15 +1227,19 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
 
 	/* SPI controller is either clocked from QE or SoC clock */
 	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
-	if (!np)
+	if (np) {
+		sysclk = of_get_property(np, "brg-frequency", NULL);
+		if (!sysclk)
+			return -ENODEV;
+	} else {
 		np = of_find_node_by_type(NULL, "soc");
+		if (!np)
+			return -ENODEV;
 
-	if (!np)
-		return -ENODEV;
-
-	sysclk = of_get_property(np, "bus-frequency", NULL);
-	if (!sysclk)
-		return -ENODEV;
+		sysclk = of_get_property(np, "bus-frequency", NULL);
+		if (!sysclk)
+			return -ENODEV;
+	}
 
 	for (np = NULL, i = 1;
 	     (np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
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
#11 lore raw

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

In reply to Anton Vorontsov

Also rename "fsl_spi" to "fsl,spi".

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

---
 arch/powerpc/boot/dts/mpc8313erdb.dts    |    3 +--
 arch/powerpc/boot/dts/mpc832x_mds.dts    |    6 ++----
 arch/powerpc/boot/dts/mpc832x_rdb.dts    |    6 ++----
 arch/powerpc/boot/dts/mpc8349emitx.dts   |    3 +--
 arch/powerpc/boot/dts/mpc8349emitxgp.dts |    3 +--
 arch/powerpc/boot/dts/mpc834x_mds.dts    |    3 +--
 arch/powerpc/boot/dts/mpc836x_mds.dts    |    6 ++----
 arch/powerpc/boot/dts/mpc8568mds.dts     |    6 ++----
 arch/powerpc/sysdev/fsl_soc.c            |    2 +-
 9 files changed, 13 insertions(+), 25 deletions(-)
arch/powerpc/boot/dts/mpc8313erdb.dts +1 -2
index c5b6665..127cf57 100644
@@ -82,8 +82,7 @@
 		};
 
 		spi@7000 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <7000 1000>;
 			interrupts = <10 8>;
 			interrupt-parent = < &ipic >;
arch/powerpc/boot/dts/mpc832x_mds.dts +2 -4
index 97757ed..517e433 100644
@@ -192,8 +192,7 @@
 		};
 
 		spi@4c0 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <4c0 40>;
 			interrupts = <2>;
 			interrupt-parent = < &qeic >;
@@ -201,8 +200,7 @@
 		};
 
 		spi@500 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <500 40>;
 			interrupts = <1>;
 			interrupt-parent = < &qeic >;
arch/powerpc/boot/dts/mpc832x_rdb.dts +2 -4
index b1c73f1..a229fab 100644
@@ -182,8 +182,7 @@
 		};
 
 		spi@4c0 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <4c0 40>;
 			interrupts = <2>;
 			interrupt-parent = <&qeic>;
@@ -191,8 +190,7 @@
 		};
 
 		spi@500 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <500 40>;
 			interrupts = <1>;
 			interrupt-parent = <&qeic>;
arch/powerpc/boot/dts/mpc8349emitx.dts +1 -2
index e354f26..b89dbbf 100644
@@ -82,8 +82,7 @@
 		};
 
 		spi@7000 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <7000 1000>;
 			interrupts = <10 8>;
 			interrupt-parent = < &ipic >;
arch/powerpc/boot/dts/mpc8349emitxgp.dts +1 -2
index ebdf0b7..123c34e 100644
@@ -80,8 +80,7 @@
 		};
 
 		spi@7000 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <7000 1000>;
 			interrupts = <10 8>;
 			interrupt-parent = < &ipic >;
arch/powerpc/boot/dts/mpc834x_mds.dts +1 -2
index 0ba13eb..eb532f3 100644
@@ -93,8 +93,7 @@
 		};
 
 		spi@7000 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <7000 1000>;
 			interrupts = <10 8>;
 			interrupt-parent = < &ipic >;
arch/powerpc/boot/dts/mpc836x_mds.dts +2 -4
index 330212d..decbafe 100644
@@ -223,8 +223,7 @@
 		};
 
 		spi@4c0 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <4c0 40>;
 			interrupts = <2>;
 			interrupt-parent = < &qeic >;
@@ -232,8 +231,7 @@
 		};
 
 		spi@500 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <500 40>;
 			interrupts = <1>;
 			interrupt-parent = < &qeic >;
arch/powerpc/boot/dts/mpc8568mds.dts +2 -4
index c00aec9..2b79f8b 100644
@@ -300,8 +300,7 @@
 		};
 
 		spi@4c0 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <4c0 40>;
 			interrupts = <2>;
 			interrupt-parent = <&qeic>;
@@ -309,8 +308,7 @@
 		};
 
 		spi@500 {
-			device_type = "spi";
-			compatible = "fsl_spi";
+			compatible = "fsl,spi";
 			reg = <500 40>;
 			interrupts = <1>;
 			interrupt-parent = <&qeic>;
arch/powerpc/sysdev/fsl_soc.c +1 -1
index 3cf84d0..91bac51 100644
@@ -1242,7 +1242,7 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
 	}
 
 	for (np = NULL, i = 1;
-	     (np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
+	     (np = of_find_compatible_node(np, NULL, "fsl,spi")) != NULL;
 	     i++) {
 		int ret = 0;
 		unsigned int j;
Signature · 1 line
1.5.2.2
#2 lore raw
In reply to Scott Wood
Quoted 5 lines · Scott Wood
Quoted 2 lines · Anton Vorontsov

Scott, I didn't add "fsl,cpm-muram" stuff, it just doesn't make sense now: qe and cpm anyway using different code base.

That should change.

Sure. When that will change, then it will be sane to change the users, I think. ;-) Not the vice versa.

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

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

In reply to Anton Vorontsov
Quoted 6 lines · Anton Vorontsov

Also rename "fsl_spi" to "fsl,spi".

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

---

Quoted 10 lines
arch/powerpc/boot/dts/mpc8313erdb.dts    |    3 +--
arch/powerpc/boot/dts/mpc832x_mds.dts    |    6 ++----
arch/powerpc/boot/dts/mpc832x_rdb.dts    |    6 ++----
arch/powerpc/boot/dts/mpc8349emitx.dts   |    3 +--
arch/powerpc/boot/dts/mpc8349emitxgp.dts |    3 +--
arch/powerpc/boot/dts/mpc834x_mds.dts    |    3 +--
arch/powerpc/boot/dts/mpc836x_mds.dts    |    6 ++----
arch/powerpc/boot/dts/mpc8568mds.dts     |    6 ++----
arch/powerpc/sysdev/fsl_soc.c            |    2 +-
9 files changed, 13 insertions(+), 25 deletions(-)

can you add cell-index as well.

- k

#9 lore raw

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

In reply to a message not in the archive
Quoted 5 lines · Anton Vorontsov
arch/powerpc/sysdev/fsl_soc.c +0 -0
index 044dd7f..3cf84d0 100644

arch/powerpc/sysdev/fsl_soc.c int __init fsl_spi_init(struct spi_board_info *board_infos, · line 1234

Quoted 9 lines
arch/powerpc/sysdev/fsl_soc.c +5 -1
@@ -1227,15 +1227,19 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
 
 	/* SPI controller is either clocked from QE or SoC clock */
 	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
-	if (!np)
+	if (np) {
+		sysclk = of_get_property(np, "brg-frequency", NULL);
+		if (!sysclk)
+			return -ENODEV;
+	} else {

You should use get_brgfreq() instead (and fix the legacy match to find qe as well as soc nodes).

-Scott

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

#13 lore raw

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

In reply to Kumar Gala
Quoted 21 lines · Kumar Gala
Quoted 6 lines · Anton Vorontsov

Also rename "fsl_spi" to "fsl,spi".

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

---

Quoted 10 lines
arch/powerpc/boot/dts/mpc8313erdb.dts    |    3 +--
arch/powerpc/boot/dts/mpc832x_mds.dts    |    6 ++----
arch/powerpc/boot/dts/mpc832x_rdb.dts    |    6 ++----
arch/powerpc/boot/dts/mpc8349emitx.dts   |    3 +--
arch/powerpc/boot/dts/mpc8349emitxgp.dts |    3 +--
arch/powerpc/boot/dts/mpc834x_mds.dts    |    3 +--
arch/powerpc/boot/dts/mpc836x_mds.dts    |    6 ++----
arch/powerpc/boot/dts/mpc8568mds.dts     |    6 ++----
arch/powerpc/sysdev/fsl_soc.c            |    2 +-
9 files changed, 13 insertions(+), 25 deletions(-)
Quoted 1 line

can you add cell-index as well.

Sure. Will do tomorrow since here is night already. ;-)

Thanks,

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

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

In reply to Anton Vorontsov

arch/powerpc/sysdev/fsl_soc.c int __init fsl_spi_init(struct spi_board_info *board_infos, · line 1245

Quoted 10 lines · Anton Vorontsov
arch/powerpc/sysdev/fsl_soc.c +1 -1
index 3cf84d0..91bac51 100644
@@ -1242,7 +1242,7 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
 	}
 
 	for (np = NULL, i = 1;
-	     (np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
+	     (np = of_find_compatible_node(np, NULL, "fsl,spi")) != NULL;

Can you keep the original code around to look for older device trees that are wrong? Backwards compatibility is important. I don't want to have to update the device tree just because I update the kernel.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#3 lore raw
In reply to Anton Vorontsov
Quoted 8 lines · Anton Vorontsov
Quoted 4 lines · Scott Wood
Quoted 2 lines · Anton Vorontsov

Scott, I didn't add "fsl,cpm-muram" stuff, it just doesn't make sense now: qe and cpm anyway using different code base.

That should change.

Sure. When that will change, then it will be sane to change the users, I think. ;-) Not the vice versa.

The device tree should describe the hardware, not the degree of unnecessary code forking/duplication currently present in Linux.

-Scott

#15 lore raw

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

In reply to Timur Tabi
Quoted 10 lines · Timur Tabi
Quoted 8 lines · Anton Vorontsov
arch/powerpc/sysdev/fsl_soc.c +0 -0
index 3cf84d0..91bac51 100644
@@ -1242,7 +1242,7 @@ int __init fsl_spi_init(struct spi_board_info 
 *board_infos,
 	}
 
Quoted 7 lines

arch/powerpc/sysdev/fsl_soc.c int __init fsl_spi_init(struct spi_board_info *board_infos, · line 1245

Quoted 3 lines
arch/powerpc/sysdev/fsl_soc.c +1 -1
 	for (np = NULL, i = 1;
-	     (np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
+	     (np = of_find_compatible_node(np, NULL, "fsl,spi")) != NULL;

Can you keep the original code around to look for older device trees that are wrong? Backwards compatibility is important. I don't want to have to update the device tree just because I update the kernel.

I though about it. Is your device tree source out of tree? Otherwise it should be trivial to upgrade the dtb, instead of producing cruft in the kernel. I vote for less legacy code, but lets see what others will say. So far count is 1:1. ;-)

Thanks,

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

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

Quoted 4 lines · Anton Vorontsov

I though about it. Is your device tree source out of tree? Otherwise it should be trivial to upgrade the dtb, instead of producing cruft in the kernel. I vote for less legacy code, but lets see what others will say. So far count is 1:1. ;-)

I just want a transition period. Whenever I write code that works with changes in the device tree, I always maintain compatibility with the older versions, and I was under the impression that this is policy. If you update the device tree, you should update the kernel. The converse, however, should not be true.

It would be really annoying if you had to swap out your device tree if you want to work with different kernel versions.

Maybe if the device tree compiler were part of the kernel, and every time you built the kernel it also built the dtb, I could accept locking the device tree and kernel versions.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#17 lore raw

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

In reply to Anton Vorontsov
Quoted 19 lines · Anton Vorontsov
Quoted 10 lines · Timur Tabi
Quoted 8 lines · Anton Vorontsov
arch/powerpc/sysdev/fsl_soc.c +0 -0
index 3cf84d0..91bac51 100644
@@ -1242,7 +1242,7 @@ int __init fsl_spi_init(struct spi_board_info
 *board_infos,
    }
 
Quoted 7 lines

arch/powerpc/sysdev/fsl_soc.c int __init fsl_spi_init(struct spi_board_info *board_infos, · line 1245

Quoted 3 lines
arch/powerpc/sysdev/fsl_soc.c +1 -1
    for (np = NULL, i = 1;
-         (np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
+         (np = of_find_compatible_node(np, NULL, "fsl,spi")) != NULL;

Can you keep the original code around to look for older device trees that are wrong? Backwards compatibility is important. I don't want to have to update the device tree just because I update the kernel.

Quoted 4 lines

I though about it. Is your device tree source out of tree? Otherwise it should be trivial to upgrade the dtb, instead of producing cruft in the kernel. I vote for less legacy code, but lets see what others will say. So far count is 1:1. ;-)

I agree with Timur. Please keep the test for the older names. Some platforms have the dtb in the same sector as u-boot, making it more dangerous to reflash.

g.

Quoted 10 lines

--
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#10 lore raw

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

In reply to a message not in the archive

arch/powerpc/sysdev/fsl_soc.c int __init fsl_spi_init(struct spi_board_info *board_infos, · line 1233

Quoted 11 lines · On Wed, 19 Dec 2007 23:38:05 +0300 Anton Vorontsov…

+++ b/arch/powerpc/sysdev/fsl_soc.c

arch/powerpc/sysdev/fsl_soc.c +4 -1
@@ -1227,15 +1227,19 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
 
 	/* SPI controller is either clocked from QE or SoC clock */
 	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
-	if (!np)
+	if (np) {
+		sysclk = of_get_property(np, "brg-frequency", NULL);
+		if (!sysclk)
+			return -ENODEV;

You need an of_node_put(np) in the failing case.

Quoted 4 lines
arch/powerpc/sysdev/fsl_soc.c +3 -0
+	} else {
 		np = of_find_node_by_type(NULL, "soc");
+		if (!np)
+			return -ENODEV;

arch/powerpc/sysdev/fsl_soc.c int __init fsl_spi_init(struct spi_board_info *board_infos, · line 1241

Quoted 10 lines
arch/powerpc/sysdev/fsl_soc.c +3 -6
 
-	if (!np)
-		return -ENODEV;
-
-	sysclk = of_get_property(np, "bus-frequency", NULL);
-	if (!sysclk)
-		return -ENODEV;
+		sysclk = of_get_property(np, "bus-frequency", NULL);
+		if (!sysclk)
+			return -ENODEV;

And again.

arch/powerpc/sysdev/fsl_soc.c int __init fsl_spi_init(struct spi_board_info *board_infos, · line 1244

Quoted 3 lines
arch/powerpc/sysdev/fsl_soc.c +1 -0
+	}
 
 	for (np = NULL, i = 1;

There should be an of_node_put(np) before this as well.

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

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
spi-devel-general mailing list spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

#18 lore raw

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

In reply to Anton Vorontsov
Quoted 4 lines · Anton Vorontsov

I though about it. Is your device tree source out of tree? Otherwise it should be trivial to upgrade the dtb, instead of producing cruft in the kernel. I vote for less legacy code, but lets see what others will say. So far count is 1:1. ;-)

It's not just that. kexec:ing a new kernel from an older that has the old device tree breaks if you don't consider older device trees. Or you might have an old firmware with a flashed device tree that you need to keep compatibility with.

You should either fix up the "broken" (not latest and greatest) device trees in the wrapper before using them, or make sure that your code is still compatible with the old trees.

The fact that the device tree source code is distributed with the kernel isn't an excuse to break backwards compatibility with older versions.

-Olof