Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
Kumar Gala wrote: On Jun 4, 2008, at 4:43 AM, Wolfgang Grandegger wrote: David Gibson wrote: On Tue, Jun 03, 2008 at 09:33:12AM -0500, Kumar Gala wrote: On Jun 3, 2008, at 5:08 AM, Wolfgang Grandegger wrote: Kumar Gala wrote: On Jun 1, 2008, at 9:03 PM, David Gibson wrote: On Fri, May 30, 2008 at 08:49:45AM +0200, Wolfgang Grandegger wrote: [snip] You have a whole lot of 'cell-index' properties through both these trees, and they all look wrong. cell-index is a hack, which should be avoided wherever practical - it should only be used when the index is used to offset into some global register block, never simply to differentiate (use reg for that) or name the devices (use aliases for that). this is why FSL device tree's have cell-index. We have global control registers that need to know such things. Should I remove them or not? OF is still a mystery for me :-(. Don't remove them. Yes, they're ok, given this usage. I'm puzzled. Could someone point me to some real code where cell-index is used as a pointer into some global data. Sorry for my ignorance. http://ozlabs.org/pipermail/linuxppc-dev/2008-June/057254.html Yep, I saw that it's used for I2C (and SPI). But cell-index is also defined for network, serial and PCI nodes, which are also assigned via aliases. Wolfgang. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
I'm puzzled. Could someone point me to some real code where cell- index is used as a pointer into some global data. Sorry for my ignorance. http://ozlabs.org/pipermail/linuxppc-dev/2008-June/057254.html Yep, I saw that it's used for I2C (and SPI). But cell-index is also defined for network, serial and PCI nodes, which are also assigned via aliases. Some of this is for the future. There are other SoC registers (like on 85xx in GUTS) that need index information. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
Kumar Gala wrote: I'm puzzled. Could someone point me to some real code where cell-index is used as a pointer into some global data. Sorry for my ignorance. http://ozlabs.org/pipermail/linuxppc-dev/2008-June/057254.html Yep, I saw that it's used for I2C (and SPI). But cell-index is also defined for network, serial and PCI nodes, which are also assigned via aliases. Some of this is for the future. There are other SoC registers (like on 85xx in GUTS) that need index information. Ah, OK, Thanks. Wolfgang. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
On Thu, Jun 05, 2008 at 02:43:59AM -0500, Kumar Gala wrote: I'm puzzled. Could someone point me to some real code where cell- index is used as a pointer into some global data. Sorry for my ignorance. http://ozlabs.org/pipermail/linuxppc-dev/2008-June/057254.html Yep, I saw that it's used for I2C (and SPI). But cell-index is also defined for network, serial and PCI nodes, which are also assigned via aliases. Some of this is for the future. There are other SoC registers (like on 85xx in GUTS) that need index information. Likewise for 4xx (where the 'cell-index' notation originated), the index value is the number used throughout the user manual and (thereby) in power control registers and the like. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
David Gibson wrote: On Tue, Jun 03, 2008 at 09:33:12AM -0500, Kumar Gala wrote: On Jun 3, 2008, at 5:08 AM, Wolfgang Grandegger wrote: Kumar Gala wrote: On Jun 1, 2008, at 9:03 PM, David Gibson wrote: On Fri, May 30, 2008 at 08:49:45AM +0200, Wolfgang Grandegger wrote: [snip] You have a whole lot of 'cell-index' properties through both these trees, and they all look wrong. cell-index is a hack, which should be avoided wherever practical - it should only be used when the index is used to offset into some global register block, never simply to differentiate (use reg for that) or name the devices (use aliases for that). this is why FSL device tree's have cell-index. We have global control registers that need to know such things. Should I remove them or not? OF is still a mystery for me :-(. Don't remove them. Yes, they're ok, given this usage. I'm puzzled. Could someone point me to some real code where cell-index is used as a pointer into some global data. Sorry for my ignorance. Thanks. Wolfgang. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
On Jun 4, 2008, at 4:43 AM, Wolfgang Grandegger wrote: David Gibson wrote: On Tue, Jun 03, 2008 at 09:33:12AM -0500, Kumar Gala wrote: On Jun 3, 2008, at 5:08 AM, Wolfgang Grandegger wrote: Kumar Gala wrote: On Jun 1, 2008, at 9:03 PM, David Gibson wrote: On Fri, May 30, 2008 at 08:49:45AM +0200, Wolfgang Grandegger wrote: [snip] You have a whole lot of 'cell-index' properties through both these trees, and they all look wrong. cell-index is a hack, which should be avoided wherever practical - it should only be used when the index is used to offset into some global register block, never simply to differentiate (use reg for that) or name the devices (use aliases for that). this is why FSL device tree's have cell-index. We have global control registers that need to know such things. Should I remove them or not? OF is still a mystery for me :-(. Don't remove them. Yes, they're ok, given this usage. I'm puzzled. Could someone point me to some real code where cell-index is used as a pointer into some global data. Sorry for my ignorance. http://ozlabs.org/pipermail/linuxppc-dev/2008-June/057254.html - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
Kumar Gala wrote: On Jun 1, 2008, at 9:03 PM, David Gibson wrote: On Fri, May 30, 2008 at 08:49:45AM +0200, Wolfgang Grandegger wrote: This patch adds support for the TQM8548 modules from TQ-Components GmbH (http://www.tqc.de). [snip] index 000..d09250a --- /dev/null +++ b/arch/powerpc/boot/dts/tqm8548.dts @@ -0,0 +1,370 @@ +/* + * TQM8548 Device Tree Source + * + * Copyright 2006 Freescale Semiconductor Inc. + * Copyright 2008 Wolfgang Grandegger [EMAIL PROTECTED] + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +/dts-v1/; [snip] +[EMAIL PROTECTED] { +#address-cells = 1; +#size-cells = 0; +cell-index = 0; [...] +enet0: [EMAIL PROTECTED] { +cell-index = 0; [...] +serial0: [EMAIL PROTECTED] { +cell-index = 0; [...] +pci0: [EMAIL PROTECTED] { +cell-index = 0; You have a whole lot of 'cell-index' properties through both these trees, and they all look wrong. cell-index is a hack, which should be avoided wherever practical - it should only be used when the index is used to offset into some global register block, never simply to differentiate (use reg for that) or name the devices (use aliases for that). this is why FSL device tree's have cell-index. We have global control registers that need to know such things. Should I remove them or not? OF is still a mystery for me :-(. Wolfgang. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
On Jun 3, 2008, at 5:08 AM, Wolfgang Grandegger wrote: Kumar Gala wrote: On Jun 1, 2008, at 9:03 PM, David Gibson wrote: On Fri, May 30, 2008 at 08:49:45AM +0200, Wolfgang Grandegger wrote: This patch adds support for the TQM8548 modules from TQ-Components GmbH (http://www.tqc.de). [snip] index 000..d09250a --- /dev/null +++ b/arch/powerpc/boot/dts/tqm8548.dts @@ -0,0 +1,370 @@ +/* + * TQM8548 Device Tree Source + * + * Copyright 2006 Freescale Semiconductor Inc. + * Copyright 2008 Wolfgang Grandegger [EMAIL PROTECTED] + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +/dts-v1/; [snip] +[EMAIL PROTECTED] { +#address-cells = 1; +#size-cells = 0; +cell-index = 0; [...] +enet0: [EMAIL PROTECTED] { +cell-index = 0; [...] +serial0: [EMAIL PROTECTED] { +cell-index = 0; [...] +pci0: [EMAIL PROTECTED] { +cell-index = 0; You have a whole lot of 'cell-index' properties through both these trees, and they all look wrong. cell-index is a hack, which should be avoided wherever practical - it should only be used when the index is used to offset into some global register block, never simply to differentiate (use reg for that) or name the devices (use aliases for that). this is why FSL device tree's have cell-index. We have global control registers that need to know such things. Should I remove them or not? OF is still a mystery for me :-(. Don't remove them. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
On Tue, Jun 03, 2008 at 09:33:12AM -0500, Kumar Gala wrote: On Jun 3, 2008, at 5:08 AM, Wolfgang Grandegger wrote: Kumar Gala wrote: On Jun 1, 2008, at 9:03 PM, David Gibson wrote: On Fri, May 30, 2008 at 08:49:45AM +0200, Wolfgang Grandegger wrote: [snip] You have a whole lot of 'cell-index' properties through both these trees, and they all look wrong. cell-index is a hack, which should be avoided wherever practical - it should only be used when the index is used to offset into some global register block, never simply to differentiate (use reg for that) or name the devices (use aliases for that). this is why FSL device tree's have cell-index. We have global control registers that need to know such things. Should I remove them or not? OF is still a mystery for me :-(. Don't remove them. Yes, they're ok, given this usage. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
David Gibson wrote: On Fri, May 30, 2008 at 08:49:45AM +0200, Wolfgang Grandegger wrote: This patch adds support for the TQM8548 modules from TQ-Components GmbH (http://www.tqc.de). [snip] index 000..d09250a --- /dev/null +++ b/arch/powerpc/boot/dts/tqm8548.dts @@ -0,0 +1,370 @@ +/* + * TQM8548 Device Tree Source + * + * Copyright 2006 Freescale Semiconductor Inc. + * Copyright 2008 Wolfgang Grandegger [EMAIL PROTECTED] + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +/dts-v1/; [snip] +[EMAIL PROTECTED] { +#address-cells = 1; +#size-cells = 0; +cell-index = 0; [...] +enet0: [EMAIL PROTECTED] { +cell-index = 0; [...] +serial0: [EMAIL PROTECTED] { +cell-index = 0; [...] +pci0: [EMAIL PROTECTED] { +cell-index = 0; You have a whole lot of 'cell-index' properties through both these trees, and they all look wrong. cell-index is a hack, which should be avoided wherever practical - it should only be used when the index is used to offset into some global register block, never simply to differentiate (use reg for that) or name the devices (use aliases for that). OK, I can remove them from the TQM85*.dts files but I think the problem is more general. It seems to be frequently used for similar purposes, also in the code, at least in 2.6.26-rc4: $ cd linux-2.6/arch/powerpc/boot/dts $ grep -l 'cell-index' *.dts | wc -l 58 Wolfgang ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
On Jun 1, 2008, at 9:03 PM, David Gibson wrote: On Fri, May 30, 2008 at 08:49:45AM +0200, Wolfgang Grandegger wrote: This patch adds support for the TQM8548 modules from TQ-Components GmbH (http://www.tqc.de). [snip] index 000..d09250a --- /dev/null +++ b/arch/powerpc/boot/dts/tqm8548.dts @@ -0,0 +1,370 @@ +/* + * TQM8548 Device Tree Source + * + * Copyright 2006 Freescale Semiconductor Inc. + * Copyright 2008 Wolfgang Grandegger [EMAIL PROTECTED] + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +/dts-v1/; [snip] + [EMAIL PROTECTED] { + #address-cells = 1; + #size-cells = 0; + cell-index = 0; [...] + enet0: [EMAIL PROTECTED] { + cell-index = 0; [...] + serial0: [EMAIL PROTECTED] { + cell-index = 0; [...] + pci0: [EMAIL PROTECTED] { + cell-index = 0; You have a whole lot of 'cell-index' properties through both these trees, and they all look wrong. cell-index is a hack, which should be avoided wherever practical - it should only be used when the index is used to offset into some global register block, never simply to differentiate (use reg for that) or name the devices (use aliases for that). this is why FSL device tree's have cell-index. We have global control registers that need to know such things. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
On Fri, May 30, 2008 at 08:49:45AM +0200, Wolfgang Grandegger wrote: This patch adds support for the TQM8548 modules from TQ-Components GmbH (http://www.tqc.de). [snip] index 000..d09250a --- /dev/null +++ b/arch/powerpc/boot/dts/tqm8548.dts @@ -0,0 +1,370 @@ +/* + * TQM8548 Device Tree Source + * + * Copyright 2006 Freescale Semiconductor Inc. + * Copyright 2008 Wolfgang Grandegger [EMAIL PROTECTED] + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +/dts-v1/; [snip] + [EMAIL PROTECTED] { + #address-cells = 1; + #size-cells = 0; + cell-index = 0; [...] + enet0: [EMAIL PROTECTED] { + cell-index = 0; [...] + serial0: [EMAIL PROTECTED] { + cell-index = 0; [...] + pci0: [EMAIL PROTECTED] { + cell-index = 0; You have a whole lot of 'cell-index' properties through both these trees, and they all look wrong. cell-index is a hack, which should be avoided wherever practical - it should only be used when the index is used to offset into some global register block, never simply to differentiate (use reg for that) or name the devices (use aliases for that). -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
This patch adds support for the TQM8548 modules from TQ-Components GmbH (http://www.tqc.de). Signed-off-by: Wolfgang Grandegger [EMAIL PROTECTED] --- arch/powerpc/boot/Makefile |1 + arch/powerpc/boot/dts/tqm8548.dts | 370 + arch/powerpc/boot/wrapper |2 +- arch/powerpc/configs/85xx/tqm8548_defconfig | +++ arch/powerpc/platforms/85xx/Kconfig |8 + arch/powerpc/platforms/85xx/tqm85xx.c | 14 +- 6 files changed, 1503 insertions(+), 3 deletions(-) create mode 100644 arch/powerpc/boot/dts/tqm8548.dts create mode 100644 arch/powerpc/configs/85xx/tqm8548_defconfig diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index f5e0b2a..d5dc0c5 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -254,6 +254,7 @@ image-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \ cuImage.mpc8572ds image-$(CONFIG_TQM8540)+= cuImage.tqm8540 image-$(CONFIG_TQM8541)+= cuImage.tqm8541 +image-$(CONFIG_TQM8548)+= cuImage.tqm8548 image-$(CONFIG_TQM8555)+= cuImage.tqm8555 image-$(CONFIG_TQM8560)+= cuImage.tqm8560 image-$(CONFIG_SBC8548)+= cuImage.sbc8548 diff --git a/arch/powerpc/boot/dts/tqm8548.dts b/arch/powerpc/boot/dts/tqm8548.dts new file mode 100644 index 000..d09250a --- /dev/null +++ b/arch/powerpc/boot/dts/tqm8548.dts @@ -0,0 +1,370 @@ +/* + * TQM8548 Device Tree Source + * + * Copyright 2006 Freescale Semiconductor Inc. + * Copyright 2008 Wolfgang Grandegger [EMAIL PROTECTED] + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +/dts-v1/; + +/ { + model = tqm,8548; + compatible = tqm,8548, tqm,85xx; + #address-cells = 1; + #size-cells = 1; + + aliases { + ethernet0 = enet0; + ethernet1 = enet1; + ethernet2 = enet2; + ethernet3 = enet3; + + serial0 = serial0; + serial1 = serial1; + pci0 = pci0; + pci1 = pci1; + }; + + cpus { + #address-cells = 1; + #size-cells = 0; + + PowerPC,[EMAIL PROTECTED] { + device_type = cpu; + reg = 0; + d-cache-line-size = 32; // 32 bytes + i-cache-line-size = 32; // 32 bytes + d-cache-size = 0x8000;// L1, 32K + i-cache-size = 0x8000;// L1, 32K + timebase-frequency = 0; // from U-Boot + bus-frequency = 0;// from U-Boot + clock-frequency = 0; // from U-Boot + }; + }; + + memory { + device_type = memory; + reg = 0x 0x2000; + }; + + [EMAIL PROTECTED] { + #address-cells = 1; + #size-cells = 1; + device_type = soc; + ranges = 0x0 0xe000 0x10; + reg = 0xe000 0x1000; // CCSRBAR + bus-frequency = 0; + + [EMAIL PROTECTED] { + compatible = fsl,8548-memory-controller; + reg = 0x2000 0x1000; + interrupt-parent = mpic; + interrupts = 18 2; + }; + + [EMAIL PROTECTED] { + compatible = fsl,8548-l2-cache-controller; + reg = 0x2 0x1000; + cache-line-size = 32; // 32 bytes + cache-size = 0x8; // L2, 512K + interrupt-parent = mpic; + interrupts = 16 2; + }; + + [EMAIL PROTECTED] { + #address-cells = 1; + #size-cells = 0; + cell-index = 0; + compatible = fsl-i2c; + reg = 0x3000 0x100; + interrupts = 43 2; + interrupt-parent = mpic; + dfsrr; + }; + + [EMAIL PROTECTED] { + #address-cells = 1; + #size-cells = 0; + cell-index = 1; + compatible = fsl-i2c; + reg = 0x3100 0x100; + interrupts = 43 2; + interrupt-parent = mpic; + dfsrr; + }; + + [EMAIL PROTECTED] { +
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
Hi Wolfgang, On Fri, 30 May 2008 08:49:45 +0200 Wolfgang Grandegger [EMAIL PROTECTED] wrote: +++ b/arch/powerpc/platforms/85xx/tqm85xx.c @@ -120,8 +120,17 @@ static void __init tqm85xx_setup_arch(void) #endif #ifdef CONFIG_PCI - for_each_compatible_node(np, pci, fsl,mpc8540-pci) - fsl_add_bridge(np, 1); + for_each_node_by_type(np, pci) { + if (of_device_is_compatible(np, fsl,mpc8540-pci) || + of_device_is_compatible(np, fsl,mpc8548-pcie)) { + struct resource rsrc; + of_address_to_resource(np, 0, rsrc); What happens if of_address_to_resource fails? -- Cheers, Stephen Rothwell[EMAIL PROTECTED] http://www.canb.auug.org.au/~sfr/ pgpOzrHfWGv91.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
Stephen Rothwell wrote: Hi Wolfgang, On Fri, 30 May 2008 08:49:45 +0200 Wolfgang Grandegger [EMAIL PROTECTED] wrote: +++ b/arch/powerpc/platforms/85xx/tqm85xx.c @@ -120,8 +120,17 @@ static void __init tqm85xx_setup_arch(void) #endif #ifdef CONFIG_PCI -for_each_compatible_node(np, pci, fsl,mpc8540-pci) -fsl_add_bridge(np, 1); +for_each_node_by_type(np, pci) { +if (of_device_is_compatible(np, fsl,mpc8540-pci) || +of_device_is_compatible(np, fsl,mpc8548-pcie)) { +struct resource rsrc; +of_address_to_resource(np, 0, rsrc); What happens if of_address_to_resource fails? Checking the return code is missing, of course. Obviously a cut paste from a bad source (sbc8548.c). Will fix. Wolfgang. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/4] [POWERPC] 85xx: add board support for the TQM8548 modules
On Friday 30 May 2008, Wolfgang Grandegger wrote: #ifdef CONFIG_PCI - for_each_compatible_node(np, pci, fsl,mpc8540-pci) - fsl_add_bridge(np, 1); + for_each_node_by_type(np, pci) { + if (of_device_is_compatible(np, fsl,mpc8540-pci) || + of_device_is_compatible(np, fsl,mpc8548-pcie)) { + struct resource rsrc; + of_address_to_resource(np, 0, rsrc); + if ((rsrc.start 0xf) == 0x8000) + fsl_add_bridge(np, 1); + else + fsl_add_bridge(np, 0); + } + } #endif This looks like a very wrong to figure out what is a primary bridge. I do realize that you copied it from other places, but that doesn't make it better. Can't we change fsl_add_bridge to figure this out automatically? A much better heuristic should be to make a bridge primary if it has an ISA child bus. Does that work for all existing systems? Arnd ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev