* [PATCH 0/4] device_type/compatible cleanups @ 2007-12-19 20:34 Anton Vorontsov 2007-12-19 20:34 ` Scott Wood ` (4 more replies) 0 siblings, 5 replies; 19+ messages in thread From: Anton Vorontsov @ 2007-12-19 20:34 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev 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, -- Anton Vorontsov email: cbou@mail.ru backup email: ya-cbou@yandex.ru irc://irc.freenode.net/bd2 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/4] device_type/compatible cleanups 2007-12-19 20:34 [PATCH 0/4] device_type/compatible cleanups Anton Vorontsov @ 2007-12-19 20:34 ` Scott Wood 2007-12-19 20:48 ` Anton Vorontsov 2007-12-19 20:37 ` [PATCH 1/4] [POWERPC] qe_lib and users: get rid of device_type and model Anton Vorontsov ` (3 subsequent siblings) 4 siblings, 1 reply; 19+ messages in thread From: Scott Wood @ 2007-12-19 20:34 UTC (permalink / raw) To: avorontsov; +Cc: linuxppc-dev Anton Vorontsov wrote: > 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/4] device_type/compatible cleanups 2007-12-19 20:34 ` Scott Wood @ 2007-12-19 20:48 ` Anton Vorontsov 2007-12-19 21:07 ` Scott Wood 0 siblings, 1 reply; 19+ messages in thread From: Anton Vorontsov @ 2007-12-19 20:48 UTC (permalink / raw) To: Scott Wood; +Cc: linuxppc-dev On Wed, Dec 19, 2007 at 02:34:28PM -0600, Scott Wood wrote: > Anton Vorontsov wrote: > >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. -- Anton Vorontsov email: cbou@mail.ru backup email: ya-cbou@yandex.ru irc://irc.freenode.net/bd2 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/4] device_type/compatible cleanups 2007-12-19 20:48 ` Anton Vorontsov @ 2007-12-19 21:07 ` Scott Wood 0 siblings, 0 replies; 19+ messages in thread From: Scott Wood @ 2007-12-19 21:07 UTC (permalink / raw) To: avorontsov; +Cc: linuxppc-dev Anton Vorontsov wrote: > On Wed, Dec 19, 2007 at 02:34:28PM -0600, Scott Wood wrote: >> Anton Vorontsov wrote: >>> 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/4] [POWERPC] qe_lib and users: get rid of device_type and model 2007-12-19 20:34 [PATCH 0/4] device_type/compatible cleanups Anton Vorontsov 2007-12-19 20:34 ` Scott Wood @ 2007-12-19 20:37 ` Anton Vorontsov 2007-12-19 20:37 ` [PATCH 2/4] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type Anton Vorontsov ` (2 subsequent siblings) 4 siblings, 0 replies; 19+ messages in thread From: Anton Vorontsov @ 2007-12-19 20:37 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev 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 Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> --- 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(-) diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts index 26ac467..ef8cd1e 100644 --- a/arch/powerpc/boot/dts/mpc832x_mds.dts +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts @@ -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>; }; }; diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts index 10ff7aa..7c4f028 100644 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts @@ -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>; }; }; diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts index fd841b2..5c73786 100644 --- a/arch/powerpc/boot/dts/mpc836x_mds.dts +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts @@ -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>; }; }; diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts index 5818a7c..7ad4b9f 100644 --- a/arch/powerpc/boot/dts/mpc8568mds.dts +++ b/arch/powerpc/boot/dts/mpc8568mds.dts @@ -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>; }; }; diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 4baad80..044dd7f 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -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"); diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 21e0106..4af71e1 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c @@ -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); -- 1.5.2.2 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/4] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type 2007-12-19 20:34 [PATCH 0/4] device_type/compatible cleanups Anton Vorontsov 2007-12-19 20:34 ` Scott Wood 2007-12-19 20:37 ` [PATCH 1/4] [POWERPC] qe_lib and users: get rid of device_type and model Anton Vorontsov @ 2007-12-19 20:37 ` Anton Vorontsov 2007-12-19 20:38 ` [PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE Anton Vorontsov 2007-12-19 20:38 ` [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov 4 siblings, 0 replies; 19+ messages in thread From: Anton Vorontsov @ 2007-12-19 20:37 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev, Li Yang, Jeff Garzik, netdev 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 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/mpc8568mds.dts | 2 +- drivers/net/ucc_geth_mii.c | 3 +-- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts index ef8cd1e..97757ed 100644 --- a/arch/powerpc/boot/dts/mpc832x_mds.dts +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts @@ -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 >; diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts index 7c4f028..b1c73f1 100644 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts @@ -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>; diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts index 5c73786..330212d 100644 --- a/arch/powerpc/boot/dts/mpc836x_mds.dts +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts @@ -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 >; diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts index 7ad4b9f..c00aec9 100644 --- a/arch/powerpc/boot/dts/mpc8568mds.dts +++ b/arch/powerpc/boot/dts/mpc8568mds.dts @@ -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 */ diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c index df884f0..de8ba1f 100644 --- a/drivers/net/ucc_geth_mii.c +++ b/drivers/net/ucc_geth_mii.c @@ -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", }, {}, }; -- 1.5.2.2 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE 2007-12-19 20:34 [PATCH 0/4] device_type/compatible cleanups Anton Vorontsov ` (2 preceding siblings ...) 2007-12-19 20:37 ` [PATCH 2/4] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type Anton Vorontsov @ 2007-12-19 20:38 ` Anton Vorontsov 2007-12-19 20:58 ` Scott Wood 2007-12-19 23:27 ` Stephen Rothwell 2007-12-19 20:38 ` [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov 4 siblings, 2 replies; 19+ messages in thread From: Anton Vorontsov @ 2007-12-19 20:38 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev, spi-devel-general In case of QE we can use brg-frequency (which is qeclk/2). Thus no need to divide sysclk in the spi_mpc83xx. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> --- arch/powerpc/sysdev/fsl_soc.c | 18 +++++++++++------- drivers/spi/spi_mpc83xx.c | 6 +----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 044dd7f..3cf84d0 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -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; 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] 19+ messages in thread
* Re: [PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE 2007-12-19 20:38 ` [PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE Anton Vorontsov @ 2007-12-19 20:58 ` Scott Wood 2007-12-19 23:27 ` Stephen Rothwell 1 sibling, 0 replies; 19+ messages in thread From: Scott Wood @ 2007-12-19 20:58 UTC (permalink / raw) To: Anton Vorontsov; +Cc: linuxppc-dev, spi-devel-general Anton Vorontsov wrote: > diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c > index 044dd7f..3cf84d0 100644 > --- a/arch/powerpc/sysdev/fsl_soc.c > +++ b/arch/powerpc/sysdev/fsl_soc.c > @@ -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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE 2007-12-19 20:38 ` [PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE Anton Vorontsov 2007-12-19 20:58 ` Scott Wood @ 2007-12-19 23:27 ` Stephen Rothwell 1 sibling, 0 replies; 19+ messages in thread From: Stephen Rothwell @ 2007-12-19 23:27 UTC (permalink / raw) To: Anton Vorontsov; +Cc: linuxppc-dev, spi-devel-general [-- Attachment #1: Type: text/plain, Size: 1093 bytes --] On Wed, 19 Dec 2007 23:38:05 +0300 Anton Vorontsov <avorontsov@ru.mvista.com> wrote: > > +++ b/arch/powerpc/sysdev/fsl_soc.c > @@ -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. > + } 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; And again. > + } > > for (np = NULL, i = 1; There should be an of_node_put(np) before this as well. -- 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] 19+ messages in thread
* [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" 2007-12-19 20:34 [PATCH 0/4] device_type/compatible cleanups Anton Vorontsov ` (3 preceding siblings ...) 2007-12-19 20:38 ` [PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE Anton Vorontsov @ 2007-12-19 20:38 ` Anton Vorontsov 2007-12-19 20:54 ` Kumar Gala 2007-12-19 21:04 ` Timur Tabi 4 siblings, 2 replies; 19+ messages in thread From: Anton Vorontsov @ 2007-12-19 20:38 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev Also rename "fsl_spi" to "fsl,spi". Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> --- 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(-) diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts index c5b6665..127cf57 100644 --- a/arch/powerpc/boot/dts/mpc8313erdb.dts +++ b/arch/powerpc/boot/dts/mpc8313erdb.dts @@ -82,8 +82,7 @@ }; spi@7000 { - device_type = "spi"; - compatible = "fsl_spi"; + 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 97757ed..517e433 100644 --- a/arch/powerpc/boot/dts/mpc832x_mds.dts +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts @@ -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 >; diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts index b1c73f1..a229fab 100644 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts @@ -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>; diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts index e354f26..b89dbbf 100644 --- a/arch/powerpc/boot/dts/mpc8349emitx.dts +++ b/arch/powerpc/boot/dts/mpc8349emitx.dts @@ -82,8 +82,7 @@ }; spi@7000 { - device_type = "spi"; - compatible = "fsl_spi"; + 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 ebdf0b7..123c34e 100644 --- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts +++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts @@ -80,8 +80,7 @@ }; spi@7000 { - device_type = "spi"; - compatible = "fsl_spi"; + 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 0ba13eb..eb532f3 100644 --- a/arch/powerpc/boot/dts/mpc834x_mds.dts +++ b/arch/powerpc/boot/dts/mpc834x_mds.dts @@ -93,8 +93,7 @@ }; spi@7000 { - device_type = "spi"; - compatible = "fsl_spi"; + 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 330212d..decbafe 100644 --- a/arch/powerpc/boot/dts/mpc836x_mds.dts +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts @@ -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 >; diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts index c00aec9..2b79f8b 100644 --- a/arch/powerpc/boot/dts/mpc8568mds.dts +++ b/arch/powerpc/boot/dts/mpc8568mds.dts @@ -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>; diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 3cf84d0..91bac51 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -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; -- 1.5.2.2 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" 2007-12-19 20:38 ` [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov @ 2007-12-19 20:54 ` Kumar Gala 2007-12-19 21:02 ` Anton Vorontsov 2007-12-19 21:04 ` Timur Tabi 1 sibling, 1 reply; 19+ messages in thread From: Kumar Gala @ 2007-12-19 20:54 UTC (permalink / raw) To: Anton Vorontsov; +Cc: linuxppc-dev On Dec 19, 2007, at 2:38 PM, Anton Vorontsov wrote: > Also rename "fsl_spi" to "fsl,spi". > > Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html > > Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> > --- > 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" 2007-12-19 20:54 ` Kumar Gala @ 2007-12-19 21:02 ` Anton Vorontsov 0 siblings, 0 replies; 19+ messages in thread From: Anton Vorontsov @ 2007-12-19 21:02 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev On Wed, Dec 19, 2007 at 02:54:09PM -0600, Kumar Gala wrote: > > On Dec 19, 2007, at 2:38 PM, Anton Vorontsov wrote: > > >Also rename "fsl_spi" to "fsl,spi". > > > >Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html > > > >Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> > >--- > >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. Sure. Will do tomorrow since here is night already. ;-) Thanks, -- Anton Vorontsov email: cbou@mail.ru backup email: ya-cbou@yandex.ru irc://irc.freenode.net/bd2 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" 2007-12-19 20:38 ` [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov 2007-12-19 20:54 ` Kumar Gala @ 2007-12-19 21:04 ` Timur Tabi 2007-12-19 21:12 ` Anton Vorontsov 1 sibling, 1 reply; 19+ messages in thread From: Timur Tabi @ 2007-12-19 21:04 UTC (permalink / raw) To: Anton Vorontsov; +Cc: linuxppc-dev Anton Vorontsov wrote: > diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c > index 3cf84d0..91bac51 100644 > --- a/arch/powerpc/sysdev/fsl_soc.c > +++ b/arch/powerpc/sysdev/fsl_soc.c > @@ -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. -- Timur Tabi Linux kernel developer at Freescale ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" 2007-12-19 21:04 ` Timur Tabi @ 2007-12-19 21:12 ` Anton Vorontsov 2007-12-19 21:15 ` Timur Tabi ` (2 more replies) 0 siblings, 3 replies; 19+ messages in thread From: Anton Vorontsov @ 2007-12-19 21:12 UTC (permalink / raw) To: Timur Tabi; +Cc: linuxppc-dev On Wed, Dec 19, 2007 at 03:04:51PM -0600, Timur Tabi wrote: > Anton Vorontsov wrote: > > >diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c > >index 3cf84d0..91bac51 100644 > >--- a/arch/powerpc/sysdev/fsl_soc.c > >+++ b/arch/powerpc/sysdev/fsl_soc.c > >@@ -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. 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, -- Anton Vorontsov email: cbou@mail.ru backup email: ya-cbou@yandex.ru irc://irc.freenode.net/bd2 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" 2007-12-19 21:12 ` Anton Vorontsov @ 2007-12-19 21:15 ` Timur Tabi 2007-12-19 21:38 ` Grant Likely 2007-12-19 23:50 ` Olof Johansson 2 siblings, 0 replies; 19+ messages in thread From: Timur Tabi @ 2007-12-19 21:15 UTC (permalink / raw) To: avorontsov; +Cc: linuxppc-dev Anton Vorontsov wrote: > 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. -- Timur Tabi Linux kernel developer at Freescale ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" 2007-12-19 21:12 ` Anton Vorontsov 2007-12-19 21:15 ` Timur Tabi @ 2007-12-19 21:38 ` Grant Likely 2007-12-19 23:50 ` Olof Johansson 2 siblings, 0 replies; 19+ messages in thread From: Grant Likely @ 2007-12-19 21:38 UTC (permalink / raw) To: avorontsov; +Cc: linuxppc-dev, Timur Tabi On 12/19/07, Anton Vorontsov <avorontsov@ru.mvista.com> wrote: > On Wed, Dec 19, 2007 at 03:04:51PM -0600, Timur Tabi wrote: > > Anton Vorontsov wrote: > > > > >diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c > > >index 3cf84d0..91bac51 100644 > > >--- a/arch/powerpc/sysdev/fsl_soc.c > > >+++ b/arch/powerpc/sysdev/fsl_soc.c > > >@@ -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. > > 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. > -- > Anton Vorontsov > email: cbou@mail.ru > backup email: ya-cbou@yandex.ru > irc://irc.freenode.net/bd2 > _______________________________________________ > Linuxppc-dev mailing list > Linuxppc-dev@ozlabs.org > https://ozlabs.org/mailman/listinfo/linuxppc-dev > -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. grant.likely@secretlab.ca (403) 399-0195 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" 2007-12-19 21:12 ` Anton Vorontsov 2007-12-19 21:15 ` Timur Tabi 2007-12-19 21:38 ` Grant Likely @ 2007-12-19 23:50 ` Olof Johansson 2 siblings, 0 replies; 19+ messages in thread From: Olof Johansson @ 2007-12-19 23:50 UTC (permalink / raw) To: Anton Vorontsov; +Cc: linuxppc-dev, Timur Tabi On Thu, Dec 20, 2007 at 12:12:50AM +0300, Anton Vorontsov wrote: > 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 0/4] device_type/compatible cleanups @ 2007-12-21 20:18 Anton Vorontsov 2007-12-21 20:21 ` [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov 0 siblings, 1 reply; 19+ messages in thread From: Anton Vorontsov @ 2007-12-21 20:18 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev Hi all, Here is the third version (let's hope the last :-). 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. 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] 19+ messages in thread
* [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" 2007-12-21 20:18 [PATCH v3 0/4] device_type/compatible cleanups Anton Vorontsov @ 2007-12-21 20:21 ` Anton Vorontsov 0 siblings, 0 replies; 19+ messages in thread From: Anton Vorontsov @ 2007-12-21 20:21 UTC (permalink / raw) To: Kumar Gala; +Cc: 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> --- 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/mpc8568mds.dts | 8 ++-- arch/powerpc/sysdev/fsl_soc.c | 87 ++++++++++++++++++----------- 9 files changed, 78 insertions(+), 57 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts index c5b6665..a0492b6 100644 --- a/arch/powerpc/boot/dts/mpc8313erdb.dts +++ b/arch/powerpc/boot/dts/mpc8313erdb.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/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts index 8844d30..36ecd39 100644 --- a/arch/powerpc/boot/dts/mpc832x_mds.dts +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts @@ -193,8 +193,8 @@ }; spi@4c0 { - device_type = "spi"; - compatible = "fsl_spi"; + cell-index = <0>; + compatible = "fsl,spi"; reg = <4c0 40>; interrupts = <2>; interrupt-parent = < &qeic >; @@ -202,8 +202,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 a7a2e45..ce63b13 100644 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts @@ -183,8 +183,8 @@ }; spi@4c0 { - device_type = "spi"; - compatible = "fsl_spi"; + cell-index = <0>; + compatible = "fsl,spi"; reg = <4c0 40>; interrupts = <2>; interrupt-parent = <&qeic>; @@ -192,8 +192,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 e354f26..f8fc5f6 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 ebdf0b7..666650c 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 0ba13eb..6ed36a1 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 5f0b427..7801e66 100644 --- a/arch/powerpc/boot/dts/mpc836x_mds.dts +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts @@ -224,8 +224,8 @@ }; spi@4c0 { - device_type = "spi"; - compatible = "fsl_spi"; + cell-index = <0>; + compatible = "fsl,spi"; reg = <4c0 40>; interrupts = <2>; interrupt-parent = < &qeic >; @@ -233,8 +233,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/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts index ea70010..2a0ba5f 100644 --- a/arch/powerpc/boot/dts/mpc8568mds.dts +++ b/arch/powerpc/boot/dts/mpc8568mds.dts @@ -301,8 +301,8 @@ }; spi@4c0 { - device_type = "spi"; - compatible = "fsl_spi"; + cell-index = <0>; + compatible = "fsl,spi"; reg = <4c0 40>; interrupts = <2>; interrupt-parent = <&qeic>; @@ -310,8 +310,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 746f4c5..5676a8a 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -1226,39 +1226,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, "bus-frequency", &size); - if (!freq || size != sizeof(*freq)) { - 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]; @@ -1277,6 +1255,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; @@ -1287,7 +1269,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) @@ -1314,13 +1296,52 @@ 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 *prop; + + np = of_find_node_by_type(NULL, "soc"); + if (!np) + return -ENODEV; + + prop = of_get_property(np, "bus-frequency", NULL); + if (!prop) { + of_node_put(np); + return -ENODEV; + } + + sysclk = *prop; + 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] 19+ messages in thread
* [PATCH v4 0/4] device_type/compatible cleanups @ 2008-01-08 14:26 Anton Vorontsov 2008-01-08 14:30 ` [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov 0 siblings, 1 reply; 19+ messages in thread From: Anton Vorontsov @ 2008-01-08 14:26 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev Hi all, The fourth version follows... 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] 19+ messages in thread
* [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" 2008-01-08 14:26 [PATCH v4 0/4] device_type/compatible cleanups Anton Vorontsov @ 2008-01-08 14:30 ` Anton Vorontsov 0 siblings, 0 replies; 19+ messages in thread From: Anton Vorontsov @ 2008-01-08 14:30 UTC (permalink / raw) To: Kumar Gala; +Cc: 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/mpc8568mds.dts | 8 +- arch/powerpc/sysdev/fsl_soc.c | 94 ++++++++++++++++---------- 10 files changed, 86 insertions(+), 64 deletions(-) diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index ed0b92c..2b30611 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt @@ -1563,8 +1563,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 @@ -1577,8 +1577,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 c5b6665..a0492b6 100644 --- a/arch/powerpc/boot/dts/mpc8313erdb.dts +++ b/arch/powerpc/boot/dts/mpc8313erdb.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/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts index cf41194..cc99fb0 100644 --- a/arch/powerpc/boot/dts/mpc832x_mds.dts +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts @@ -193,8 +193,8 @@ }; spi@4c0 { - device_type = "spi"; - compatible = "fsl_spi"; + cell-index = <0>; + compatible = "fsl,spi"; reg = <4c0 40>; interrupts = <2>; interrupt-parent = < &qeic >; @@ -202,8 +202,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 09301c1..c0e5e93 100644 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts @@ -183,8 +183,8 @@ }; spi@4c0 { - device_type = "spi"; - compatible = "fsl_spi"; + cell-index = <0>; + compatible = "fsl,spi"; reg = <4c0 40>; interrupts = <2>; interrupt-parent = <&qeic>; @@ -192,8 +192,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 e354f26..f8fc5f6 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 ebdf0b7..666650c 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 0ba13eb..6ed36a1 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 3eb8f72..be7dfed 100644 --- a/arch/powerpc/boot/dts/mpc836x_mds.dts +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts @@ -224,8 +224,8 @@ }; spi@4c0 { - device_type = "spi"; - compatible = "fsl_spi"; + cell-index = <0>; + compatible = "fsl,spi"; reg = <4c0 40>; interrupts = <2>; interrupt-parent = < &qeic >; @@ -233,8 +233,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/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts index 2bc147f..84474cb 100644 --- a/arch/powerpc/boot/dts/mpc8568mds.dts +++ b/arch/powerpc/boot/dts/mpc8568mds.dts @@ -301,8 +301,8 @@ }; spi@4c0 { - device_type = "spi"; - compatible = "fsl_spi"; + cell-index = <0>; + compatible = "fsl,spi"; reg = <4c0 40>; interrupts = <2>; interrupt-parent = <&qeic>; @@ -310,8 +310,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 7b13876..cec1ab7 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -1226,42 +1226,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]; @@ -1280,6 +1255,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; @@ -1290,7 +1269,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) @@ -1317,13 +1296,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] 19+ messages in thread
end of thread, other threads:[~2008-01-08 14:30 UTC | newest] Thread overview: 19+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-12-19 20:34 [PATCH 0/4] device_type/compatible cleanups Anton Vorontsov 2007-12-19 20:34 ` Scott Wood 2007-12-19 20:48 ` Anton Vorontsov 2007-12-19 21:07 ` Scott Wood 2007-12-19 20:37 ` [PATCH 1/4] [POWERPC] qe_lib and users: get rid of device_type and model Anton Vorontsov 2007-12-19 20:37 ` [PATCH 2/4] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type Anton Vorontsov 2007-12-19 20:38 ` [PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE Anton Vorontsov 2007-12-19 20:58 ` Scott Wood 2007-12-19 23:27 ` Stephen Rothwell 2007-12-19 20:38 ` [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov 2007-12-19 20:54 ` Kumar Gala 2007-12-19 21:02 ` Anton Vorontsov 2007-12-19 21:04 ` Timur Tabi 2007-12-19 21:12 ` Anton Vorontsov 2007-12-19 21:15 ` Timur Tabi 2007-12-19 21:38 ` Grant Likely 2007-12-19 23:50 ` Olof Johansson -- strict thread matches above, loose matches on Subject: below -- 2007-12-21 20:18 [PATCH v3 0/4] device_type/compatible cleanups Anton Vorontsov 2007-12-21 20:21 ` [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov 2008-01-08 14:26 [PATCH v4 0/4] device_type/compatible cleanups Anton Vorontsov 2008-01-08 14:30 ` [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = "spi" Anton Vorontsov
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).