* [PATCH v5 0/5] device_type/compatible cleanups
@ 2008-01-24 15:18 Anton Vorontsov
2008-01-24 15:39 ` [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model Anton Vorontsov
` (6 more replies)
0 siblings, 7 replies; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-24 15:18 UTC (permalink / raw)
To: linuxppc-dev
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,
--
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model
2008-01-24 15:18 [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
@ 2008-01-24 15:39 ` Anton Vorontsov
2008-01-25 21:19 ` Kumar Gala
2008-02-04 13:13 ` Stephen Rothwell
2008-01-24 15:40 ` [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type Anton Vorontsov
` (5 subsequent siblings)
6 siblings, 2 replies; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-24 15:39 UTC (permalink / raw)
To: linuxppc-dev
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
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
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(-)
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index da98154..f9545b0 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -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>;
};
};
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 6902524..e300df4 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 10ff7aa..4d5cfd3 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 2181d2c..9a2581b 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts b/arch/powerpc/boot/dts/mpc836x_rdk.dts
index b8f87ac..e244619 100644
--- a/arch/powerpc/boot/dts/mpc836x_rdk.dts
+++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 5818a7c..04f5c6f 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -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>;
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index dbdd4ad..6dbc6ea 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -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 */
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index 5fddd22..9f0fd88 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -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 */
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index db491ec..c2e5de6 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -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 */
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 4fdf5ab..25f8bc7 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -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 */
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index f2c0988..26f7d83 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -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");
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 3925eae..5ef844d 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -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;
+ }
+
+ prop = of_get_property(qe, "reg", &size);
+ qebase = of_translate_address(qe, prop);
+ of_node_put(qe);
return qebase;
}
@@ -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)
+ return brg_clk;
+ }
+
+ prop = of_get_property(qe, "brg-frequency", &size);
+ if (!prop || size != sizeof(*prop))
+ return brg_clk;
+
+ brg_clk = *prop;
+ of_node_put(qe);
+
return brg_clk;
}
@@ -322,7 +337,7 @@ static rh_info_t qe_muram_info;
static void qe_muram_init(void)
{
struct device_node *np;
- u32 address;
+ const u32 *address;
u64 size;
unsigned int flags;
@@ -335,11 +350,21 @@ 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) {
- address = *of_get_address(np, 0, &size, &flags);
- of_node_put(np);
- rh_attach_region(&qe_muram_info, address, (int) size);
+ np = of_find_compatible_node(NULL, NULL, "fsl,qe-muram-data");
+ if (!np) {
+ np = of_find_node_by_name(NULL, "data-only");
+ if (!np) {
+ WARN_ON(1);
+ return;
+ }
}
+
+ address = of_get_address(np, 0, &size, &flags);
+ WARN_ON(!address);
+
+ of_node_put(np);
+ if (address)
+ rh_attach_region(&qe_muram_info, *address, (int)size);
}
/* This function returns an index into the MURAM area.
--
1.5.2.2
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type
2008-01-24 15:18 [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
2008-01-24 15:39 ` [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model Anton Vorontsov
@ 2008-01-24 15:40 ` Anton Vorontsov
2008-01-24 15:52 ` Kumar Gala
2008-01-25 21:20 ` Kumar Gala
2008-01-24 15:40 ` [PATCH 3/5] [POWERPC][SPI] use brg-frequency for SPI in QE Anton Vorontsov
` (4 subsequent siblings)
6 siblings, 2 replies; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-24 15:40 UTC (permalink / raw)
To: linuxppc-dev
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
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
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(-)
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index e300df4..1bb75ef 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -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 >;
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 4d5cfd3..f6a8633 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 9a2581b..fa98bdf 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -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 >;
diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts b/arch/powerpc/boot/dts/mpc836x_rdk.dts
index e244619..e299442 100644
--- a/arch/powerpc/boot/dts/mpc836x_rdk.dts
+++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts
@@ -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 {
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 04f5c6f..692d5bd 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -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 */
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index df884f0..e3ba14a 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -256,6 +256,9 @@ static struct of_device_id uec_mdio_match[] = {
.type = "mdio",
.compatible = "ucc_geth_phy",
},
+ {
+ .compatible = "fsl,ucc-mdio",
+ },
{},
};
--
1.5.2.2
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 3/5] [POWERPC][SPI] use brg-frequency for SPI in QE
2008-01-24 15:18 [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
2008-01-24 15:39 ` [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model Anton Vorontsov
2008-01-24 15:40 ` [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type Anton Vorontsov
@ 2008-01-24 15:40 ` Anton Vorontsov
2008-01-25 21:20 ` Kumar Gala
2008-01-24 15:40 ` [PATCH 4/5] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov
` (3 subsequent siblings)
6 siblings, 1 reply; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-24 15:40 UTC (permalink / raw)
To: linuxppc-dev
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.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
---
arch/powerpc/sysdev/fsl_soc.c | 44 ++++++++++++++++++++++++++++------------
drivers/spi/spi_mpc83xx.c | 6 +----
2 files changed, 32 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 26f7d83..f4473ad 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -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)
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 4580b9c..04f7cd9 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -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;
--
1.5.2.2
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 4/5] [POWERPC] fsl_spi_init and users: stop using device_type = "spi"
2008-01-24 15:18 [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
` (2 preceding siblings ...)
2008-01-24 15:40 ` [PATCH 3/5] [POWERPC][SPI] use brg-frequency for SPI in QE Anton Vorontsov
@ 2008-01-24 15:40 ` Anton Vorontsov
2008-01-25 21:20 ` Kumar Gala
2008-01-24 15:40 ` [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching Anton Vorontsov
` (2 subsequent siblings)
6 siblings, 1 reply; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-24 15:40 UTC (permalink / raw)
To: linuxppc-dev
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
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
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(-)
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index f9545b0..bedfdd0 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts
index 9bcf2c9..20a03f5 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -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 >;
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 1bb75ef..15bb345 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -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 >;
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index f6a8633..f086fac 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 04b8da4..4a4ddea 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -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 >;
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index a06ff92..79983d7 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -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 >;
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index 4120e92..1736e03 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -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 >;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index fa98bdf..d3b8262 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -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 >;
diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts b/arch/powerpc/boot/dts/mpc836x_rdk.dts
index e299442..6efa5b7 100644
--- a/arch/powerpc/boot/dts/mpc836x_rdk.dts
+++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 692d5bd..c929fba 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -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>;
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index f4473ad..e75fd44 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -1276,42 +1276,17 @@ arch_initcall(cpm_smc_uart_of_init);
#endif /* CONFIG_8xx */
#endif /* CONFIG_PPC_CPM_NEW_BINDING */
-int __init fsl_spi_init(struct spi_board_info *board_infos,
- unsigned int num_board_infos,
- void (*activate_cs)(u8 cs, u8 polarity),
- void (*deactivate_cs)(u8 cs, u8 polarity))
+static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk,
+ struct spi_board_info *board_infos,
+ unsigned int num_board_infos,
+ void (*activate_cs)(u8 cs, u8 polarity),
+ void (*deactivate_cs)(u8 cs, u8 polarity))
{
struct device_node *np;
- unsigned int i;
- u32 sysclk;
-
- /* SPI controller is either clocked from QE or SoC clock */
- sysclk = get_brgfreq();
- if (sysclk == -1) {
- const u32 *freq;
- int size;
-
- 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;
- }
- }
-
- sysclk = *freq;
- of_node_put(np);
- }
+ unsigned int i = 0;
- for (np = NULL, i = 1;
- (np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL;
- i++) {
- int ret = 0;
+ for_each_compatible_node(np, type, compatible) {
+ int ret;
unsigned int j;
const void *prop;
struct resource res[2];
@@ -1330,6 +1305,10 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
goto err;
pdata.bus_num = *(u32 *)prop;
+ prop = of_get_property(np, "cell-index", NULL);
+ if (prop)
+ i = *(u32 *)prop;
+
prop = of_get_property(np, "mode", NULL);
if (prop && !strcmp(prop, "cpu-qe"))
pdata.qe_mode = 1;
@@ -1340,7 +1319,7 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
}
if (!pdata.max_chipselect)
- goto err;
+ continue;
ret = of_address_to_resource(np, 0, &res[0]);
if (ret)
@@ -1367,13 +1346,56 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
if (ret)
goto unreg;
- continue;
+ goto next;
unreg:
platform_device_del(pdev);
err:
- continue;
+ pr_err("%s: registration failed\n", np->full_name);
+next:
+ i++;
}
+ return i;
+}
+
+int __init fsl_spi_init(struct spi_board_info *board_infos,
+ unsigned int num_board_infos,
+ void (*activate_cs)(u8 cs, u8 polarity),
+ void (*deactivate_cs)(u8 cs, u8 polarity))
+{
+ u32 sysclk;
+ int ret;
+
+ /* SPI controller is either clocked from QE or SoC clock */
+ sysclk = get_brgfreq();
+ if (sysclk == -1) {
+ struct device_node *np;
+ const u32 *freq;
+ int size;
+
+ 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;
+ }
+ }
+
+ sysclk = *freq;
+ of_node_put(np);
+ }
+
+ ret = of_fsl_spi_probe(NULL, "fsl,spi", sysclk, board_infos,
+ num_board_infos, activate_cs, deactivate_cs);
+ if (!ret)
+ of_fsl_spi_probe("spi", "fsl_spi", sysclk, board_infos,
+ num_board_infos, activate_cs, deactivate_cs);
+
return spi_register_board_info(board_infos, num_board_infos);
}
--
1.5.2.2
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching
2008-01-24 15:18 [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
` (3 preceding siblings ...)
2008-01-24 15:40 ` [PATCH 4/5] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov
@ 2008-01-24 15:40 ` Anton Vorontsov
2008-01-25 16:35 ` Kumar Gala
2008-01-24 17:35 ` [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
2008-01-25 14:37 ` [PATCH 6/5] [POWERPC] get rid of `model = "UCC"' in the ucc nodes Anton Vorontsov
6 siblings, 1 reply; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-24 15:40 UTC (permalink / raw)
To: linuxppc-dev
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.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
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(-)
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index bedfdd0..a3b6e2a 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts b/arch/powerpc/boot/dts/mpc836x_rdk.dts
index 6efa5b7..ef739ee 100644
--- a/arch/powerpc/boot/dts/mpc836x_rdk.dts
+++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts
@@ -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>;
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 4bfff88..c99d0ae 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -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;
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index e75fd44..96851ae 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -48,27 +48,31 @@ static phys_addr_t immrbase = -1;
phys_addr_t get_immrbase(void)
{
struct device_node *soc;
+ int size;
+ u32 naddr;
+ const u32 *prop;
if (immrbase != -1)
return immrbase;
- soc = of_find_node_by_type(NULL, "soc");
- if (soc) {
- int size;
- u32 naddr;
- const u32 *prop = of_get_property(soc, "#address-cells", &size);
+ soc = of_find_compatible_node(NULL, NULL, "fsl,soc");
+ if (!soc) {
+ soc = of_find_node_by_type(NULL, "soc");
+ if (!soc)
+ return immrbase;
+ }
- if (prop && size == 4)
- naddr = *prop;
- else
- naddr = 2;
+ prop = of_get_property(soc, "#address-cells", &size);
+ if (prop && size == 4)
+ naddr = *prop;
+ else
+ naddr = 2;
- prop = of_get_property(soc, "ranges", &size);
- if (prop)
- immrbase = of_translate_address(soc, prop + naddr);
+ prop = of_get_property(soc, "ranges", &size);
+ if (prop)
+ immrbase = of_translate_address(soc, prop + naddr);
- of_node_put(soc);
- }
+ of_node_put(soc);
return immrbase;
}
@@ -528,11 +532,13 @@ static int __init mpc83xx_wdt_init(void)
goto nodev;
}
- soc = of_find_node_by_type(NULL, "soc");
-
+ soc = of_find_compatible_node(NULL, NULL, "fsl,soc");
if (!soc) {
- ret = -ENODEV;
- goto nosoc;
+ soc = of_find_node_by_type(NULL, "soc");
+ if (!soc) {
+ ret = -ENODEV;
+ goto nosoc;
+ }
}
freq = of_get_property(soc, "bus-frequency", NULL);
@@ -1373,9 +1379,12 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
const u32 *freq;
int size;
- np = of_find_node_by_type(NULL, "soc");
- if (!np)
- return -ENODEV;
+ np = of_find_compatible_node(NULL, NULL, "fsl,soc");
+ 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) {
--
1.5.2.2
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type
2008-01-24 15:40 ` [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type Anton Vorontsov
@ 2008-01-24 15:52 ` Kumar Gala
2008-01-24 16:11 ` Anton Vorontsov
2008-01-25 21:20 ` Kumar Gala
1 sibling, 1 reply; 27+ messages in thread
From: Kumar Gala @ 2008-01-24 15:52 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev list
On Jan 24, 2008, at 9:40 AM, Anton Vorontsov wrote:
> 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
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type
2008-01-24 15:52 ` Kumar Gala
@ 2008-01-24 16:11 ` Anton Vorontsov
0 siblings, 0 replies; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-24 16:11 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev list
On Thu, Jan 24, 2008 at 09:52:14AM -0600, Kumar Gala wrote:
>
> On Jan 24, 2008, at 9:40 AM, Anton Vorontsov wrote:
>
> >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
> >
> >Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
>
> 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?
--
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v5 0/5] device_type/compatible cleanups
2008-01-24 15:18 [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
` (4 preceding siblings ...)
2008-01-24 15:40 ` [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching Anton Vorontsov
@ 2008-01-24 17:35 ` Anton Vorontsov
2008-01-24 18:26 ` Jon Loeliger
2008-01-25 14:37 ` [PATCH 6/5] [POWERPC] get rid of `model = "UCC"' in the ucc nodes Anton Vorontsov
6 siblings, 1 reply; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-24 17:35 UTC (permalink / raw)
To: linuxppc-dev
On Thu, Jan 24, 2008 at 06:18:50PM +0300, Anton Vorontsov wrote:
[..]
> 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(-)
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(-)
--
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v5 0/5] device_type/compatible cleanups
2008-01-24 17:35 ` [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
@ 2008-01-24 18:26 ` Jon Loeliger
0 siblings, 0 replies; 27+ messages in thread
From: Jon Loeliger @ 2008-01-24 18:26 UTC (permalink / raw)
To: avorontsov; +Cc: linuxppc-dev
> 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
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 6/5] [POWERPC] get rid of `model = "UCC"' in the ucc nodes
2008-01-24 15:18 [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
` (5 preceding siblings ...)
2008-01-24 17:35 ` [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
@ 2008-01-25 14:37 ` Anton Vorontsov
2008-01-25 16:33 ` Kumar Gala
6 siblings, 1 reply; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-25 14:37 UTC (permalink / raw)
To: linuxppc-dev
It isn't used anywhere, so remove it. If we'll ever need something
like this, we'll use compatible property instead.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
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(-)
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index a3b6e2a..ab9f0bf 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 15bb345..c60ebf7 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -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 */
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index f086fac..60461be 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index d3b8262..e2b20f7 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -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>;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index c929fba..e136410 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -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>;
--
1.5.2.2
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 6/5] [POWERPC] get rid of `model = "UCC"' in the ucc nodes
2008-01-25 14:37 ` [PATCH 6/5] [POWERPC] get rid of `model = "UCC"' in the ucc nodes Anton Vorontsov
@ 2008-01-25 16:33 ` Kumar Gala
0 siblings, 0 replies; 27+ messages in thread
From: Kumar Gala @ 2008-01-25 16:33 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev
On Jan 25, 2008, at 8:37 AM, Anton Vorontsov wrote:
> It isn't used anywhere, so remove it. If we'll ever need something
> like this, we'll use compatible property instead.
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
>
> 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(-)
>
> diff --git a/Documentation/powerpc/booting-without-of.txt b/
> Documentation/powerpc/booting-without-of.txt
> index a3b6e2a..ab9f0bf 100644
> --- a/Documentation/powerpc/booting-without-of.txt
> +++ b/Documentation/powerpc/booting-without-of.txt
> @@ -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>;
can device-id be changed to cell-index?
- k
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching
2008-01-24 15:40 ` [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching Anton Vorontsov
@ 2008-01-25 16:35 ` Kumar Gala
2008-01-25 17:13 ` Anton Vorontsov
0 siblings, 1 reply; 27+ messages in thread
From: Kumar Gala @ 2008-01-25 16:35 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: Scott Wood, linuxppc-dev list, Yoder Stuart
On Jan 24, 2008, at 9:40 AM, Anton Vorontsov wrote:
> 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.
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
>
> 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(-)
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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching
2008-01-25 16:35 ` Kumar Gala
@ 2008-01-25 17:13 ` Anton Vorontsov
2008-01-25 17:26 ` Anton Vorontsov
2008-01-25 18:17 ` Scott Wood
0 siblings, 2 replies; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-25 17:13 UTC (permalink / raw)
To: Kumar Gala; +Cc: Scott Wood, linuxppc-dev list, Yoder Stuart
On Fri, Jan 25, 2008 at 10:35:06AM -0600, Kumar Gala wrote:
>
> On Jan 24, 2008, at 9:40 AM, Anton Vorontsov wrote:
>
> >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.
> >
> >Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> >---
> >
> >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(-)
>
> this needs a bit more discussion.
Ok.
> "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.
--
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching
2008-01-25 17:13 ` Anton Vorontsov
@ 2008-01-25 17:26 ` Anton Vorontsov
2008-01-25 18:17 ` Scott Wood
1 sibling, 0 replies; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-25 17:26 UTC (permalink / raw)
To: Kumar Gala; +Cc: Scott Wood, linuxppc-dev list, Yoder Stuart
On Fri, Jan 25, 2008 at 08:13:55PM +0300, Anton Vorontsov wrote:
[...]
> 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.
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.
--
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching
2008-01-25 17:13 ` Anton Vorontsov
2008-01-25 17:26 ` Anton Vorontsov
@ 2008-01-25 18:17 ` Scott Wood
2008-01-25 18:53 ` Anton Vorontsov
1 sibling, 1 reply; 27+ messages in thread
From: Scott Wood @ 2008-01-25 18:17 UTC (permalink / raw)
To: avorontsov; +Cc: linuxppc-dev list, Yoder Stuart
Anton Vorontsov wrote:
> 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.
>(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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching
2008-01-25 18:17 ` Scott Wood
@ 2008-01-25 18:53 ` Anton Vorontsov
2008-01-25 19:03 ` Scott Wood
0 siblings, 1 reply; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-25 18:53 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev list, Yoder Stuart
On Fri, Jan 25, 2008 at 12:17:19PM -0600, Scott Wood wrote:
> Anton Vorontsov wrote:
> >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.
> >(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).
--
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching
2008-01-25 18:53 ` Anton Vorontsov
@ 2008-01-25 19:03 ` Scott Wood
2008-01-25 19:18 ` Anton Vorontsov
0 siblings, 1 reply; 27+ messages in thread
From: Scott Wood @ 2008-01-25 19:03 UTC (permalink / raw)
To: avorontsov; +Cc: linuxppc-dev list, Yoder Stuart
Anton Vorontsov wrote:
> $ 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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching
2008-01-25 19:03 ` Scott Wood
@ 2008-01-25 19:18 ` Anton Vorontsov
0 siblings, 0 replies; 27+ messages in thread
From: Anton Vorontsov @ 2008-01-25 19:18 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev list, Yoder Stuart
On Fri, Jan 25, 2008 at 01:03:28PM -0600, Scott Wood wrote:
> Anton Vorontsov wrote:
> >$ 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.
> 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.
--
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model
2008-01-24 15:39 ` [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model Anton Vorontsov
@ 2008-01-25 21:19 ` Kumar Gala
2008-02-04 13:13 ` Stephen Rothwell
1 sibling, 0 replies; 27+ messages in thread
From: Kumar Gala @ 2008-01-25 21:19 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev
On Thu, 24 Jan 2008, Anton Vorontsov wrote:
> 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
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> 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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type
2008-01-24 15:40 ` [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type Anton Vorontsov
2008-01-24 15:52 ` Kumar Gala
@ 2008-01-25 21:20 ` Kumar Gala
1 sibling, 0 replies; 27+ messages in thread
From: Kumar Gala @ 2008-01-25 21:20 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev, Jeff Garzik, netdev
On Thu, 24 Jan 2008, Anton Vorontsov wrote:
> 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
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> 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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 3/5] [POWERPC][SPI] use brg-frequency for SPI in QE
2008-01-24 15:40 ` [PATCH 3/5] [POWERPC][SPI] use brg-frequency for SPI in QE Anton Vorontsov
@ 2008-01-25 21:20 ` Kumar Gala
0 siblings, 0 replies; 27+ messages in thread
From: Kumar Gala @ 2008-01-25 21:20 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev
On Thu, 24 Jan 2008, Anton Vorontsov wrote:
> 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.
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> Acked-by: David Brownell <dbrownell@users.sourceforge.net>
> ---
> arch/powerpc/sysdev/fsl_soc.c | 44 ++++++++++++++++++++++++++++------------
> drivers/spi/spi_mpc83xx.c | 6 +----
> 2 files changed, 32 insertions(+), 18 deletions(-)
>
applied
- k
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 4/5] [POWERPC] fsl_spi_init and users: stop using device_type = "spi"
2008-01-24 15:40 ` [PATCH 4/5] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov
@ 2008-01-25 21:20 ` Kumar Gala
0 siblings, 0 replies; 27+ messages in thread
From: Kumar Gala @ 2008-01-25 21:20 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev
On Thu, 24 Jan 2008, Anton Vorontsov wrote:
> 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
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> 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
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model
2008-01-24 15:39 ` [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model Anton Vorontsov
2008-01-25 21:19 ` Kumar Gala
@ 2008-02-04 13:13 ` Stephen Rothwell
2008-02-04 13:46 ` [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) Anton Vorontsov
1 sibling, 1 reply; 27+ messages in thread
From: Stephen Rothwell @ 2008-02-04 13:13 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]
Hi Anton,
I know this is late, but a couple of comments anyway.
On Thu, 24 Jan 2008 18:39:59 +0300 Anton Vorontsov <avorontsov@ru.mvista.com> wrote:
>
> +++ b/arch/powerpc/sysdev/qe_lib/qe.c
> @@ -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;
> + }
> +
> + 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?
> @@ -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)
> + 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 ...
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* [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)
2008-02-04 13:13 ` Stephen Rothwell
@ 2008-02-04 13:46 ` Anton Vorontsov
2008-02-04 14:48 ` Stephen Rothwell
2008-02-06 6:04 ` Kumar Gala
0 siblings, 2 replies; 27+ messages in thread
From: Anton Vorontsov @ 2008-02-04 13:46 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev
On Tue, Feb 05, 2008 at 12:13:18AM +1100, Stephen Rothwell wrote:
> Hi Anton,
>
> I know this is late, but a couple of comments anyway.
>
> On Thu, 24 Jan 2008 18:39:59 +0300 Anton Vorontsov <avorontsov@ru.mvista.com> wrote:
> >
> > +++ b/arch/powerpc/sysdev/qe_lib/qe.c
> > @@ -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;
> > + }
> > +
> > + 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.
> > @@ -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)
> > + 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 <avorontsov@ru.mvista.com>
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.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/sysdev/qe_lib/qe.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 5ef844d..6efbd5e 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -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;
--
1.5.2.2
^ permalink raw reply related [flat|nested] 27+ messages in thread
* 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)
2008-02-04 13:46 ` [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) Anton Vorontsov
@ 2008-02-04 14:48 ` Stephen Rothwell
2008-02-06 6:04 ` Kumar Gala
1 sibling, 0 replies; 27+ messages in thread
From: Stephen Rothwell @ 2008-02-04 14:48 UTC (permalink / raw)
To: avorontsov; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 958 bytes --]
On Mon, 4 Feb 2008 16:46:17 +0300 Anton Vorontsov <avorontsov@ru.mvista.com> wrote:
>
> On Tue, Feb 05, 2008 at 12:13:18AM +1100, Stephen Rothwell wrote:
> >
> > 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.
> - - - -
> From: Anton Vorontsov <avorontsov@ru.mvista.com>
> 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.
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* 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)
2008-02-04 13:46 ` [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) Anton Vorontsov
2008-02-04 14:48 ` Stephen Rothwell
@ 2008-02-06 6:04 ` Kumar Gala
1 sibling, 0 replies; 27+ messages in thread
From: Kumar Gala @ 2008-02-06 6:04 UTC (permalink / raw)
To: avorontsov; +Cc: Stephen Rothwell, linuxppc-dev
>
> From: Anton Vorontsov <avorontsov@ru.mvista.com>
> 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.
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> arch/powerpc/sysdev/qe_lib/qe.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
applied.
- k
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2008-02-06 6:05 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-24 15:18 [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
2008-01-24 15:39 ` [PATCH 1/5] [POWERPC] qe_lib and users: get rid of most device_types and model Anton Vorontsov
2008-01-25 21:19 ` Kumar Gala
2008-02-04 13:13 ` Stephen Rothwell
2008-02-04 13:46 ` [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) Anton Vorontsov
2008-02-04 14:48 ` Stephen Rothwell
2008-02-06 6:04 ` Kumar Gala
2008-01-24 15:40 ` [PATCH 2/5] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type Anton Vorontsov
2008-01-24 15:52 ` Kumar Gala
2008-01-24 16:11 ` Anton Vorontsov
2008-01-25 21:20 ` Kumar Gala
2008-01-24 15:40 ` [PATCH 3/5] [POWERPC][SPI] use brg-frequency for SPI in QE Anton Vorontsov
2008-01-25 21:20 ` Kumar Gala
2008-01-24 15:40 ` [PATCH 4/5] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov
2008-01-25 21:20 ` Kumar Gala
2008-01-24 15:40 ` [PATCH 5/5] [POWERPC] fsl_soc, legacy_serial: add support for "soc" compatible matching Anton Vorontsov
2008-01-25 16:35 ` Kumar Gala
2008-01-25 17:13 ` Anton Vorontsov
2008-01-25 17:26 ` Anton Vorontsov
2008-01-25 18:17 ` Scott Wood
2008-01-25 18:53 ` Anton Vorontsov
2008-01-25 19:03 ` Scott Wood
2008-01-25 19:18 ` Anton Vorontsov
2008-01-24 17:35 ` [PATCH v5 0/5] device_type/compatible cleanups Anton Vorontsov
2008-01-24 18:26 ` Jon Loeliger
2008-01-25 14:37 ` [PATCH 6/5] [POWERPC] get rid of `model = "UCC"' in the ucc nodes Anton Vorontsov
2008-01-25 16:33 ` Kumar Gala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).