Xilinx: clear data caches.
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/7 Xilinx: clear data caches.
This code is needed to boot without a boot loader.
Grant: I'm not sure where the right place to put this is. I'm assuming we'll actually need some boot code that is not generic? Also, note that there is a V4FX errata workaround in arch/ppc/boot/head.S, which probably also needs to get pulled to powerpc.
--- arch/powerpc/boot/raw-platform.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
arch/powerpc/boot/raw-platform.c +22 -0
@@ -24,6 +24,28 @@ void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) {u64 memsize64 = memsize[0 ]; +static const unsigned long line_size =32 ; +static const unsigned long congruence_classes =256 ; +unsigned long addr; +unsigned long dccr; + +/* +* Invalidate the data cache if the data cache is turned off. +* - The 405 core does not invalidate the data cache on power-up +* or reset but does turn off the data cache. We cannot assume +* that the cache contents are valid. +* - If the data cache is turned on this must have been done by +* a bootloader and we assume that the cache contents are +* valid. +*/ + __asm__("mfdccr %0" :"=r" (dccr)); +if (dccr ==0 ) { +for (addr =0 ; + addr < (congruence_classes * line_size); + addr += line_size) { + __asm__("dccci 0,%0" : :"b" (addr)); + } + }if (mem_size_cells ==2 ) { memsize64 <<=32 ;
Signature · 1 line
1.5.3.4
Quoted 8 lines · Stephen Neuendorffer
This code is needed to boot without a boot loader.
Grant: I'm not sure where the right place to put this is. I'm assuming we'll actually need some boot code that is not generic? Also, note that there is a V4FX errata workaround in
arch/ppc/boot/head.S, which probably also needs to get pulled to powerpc.Signed-off-by Stephen Neuendorffer <[email protected]>--- arch/powerpc/boot/raw-platform.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
This raw-platform.c file doesn't seem like a good place for code that is totally platform specific ...
Ben.
Quoted 33 lines
arch/powerpc/boot/raw-platform.c +22
-0@@ -24,6 +24,28 @@ void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) {u64 memsize64 = memsize[0 ]; +static const unsigned long line_size =32 ; +static const unsigned long congruence_classes =256 ; +unsigned long addr; +unsigned long dccr; + +/* +* Invalidate the data cache if the data cache is turned off. +* - The 405 core does not invalidate the data cache on power-up +* or reset but does turn off the data cache. We cannot assume +* that the cache contents are valid. +* - If the data cache is turned on this must have been done by +* a bootloader and we assume that the cache contents are +* valid. +*/ + __asm__("mfdccr %0" :"=r" (dccr)); +if (dccr ==0 ) { +for (addr =0 ; + addr < (congruence_classes * line_size); + addr += line_size) { + __asm__("dccci 0,%0" : :"b" (addr)); + } + }if (mem_size_cells ==2 ) { memsize64 <<=32 ;
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 4 lines · Stephen Neuendorffer
This code is needed to boot without a boot loader.
Grant: I'm not sure where the right place to put this is. I'm assuming we'll actually need some boot code that is not generic? Also, note that there is a V4FX errata workaround in
arch/ppc/boot/head.S, which probably also needs to get pulled to powerpc.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Stephen Neuendorffer <[email protected]>--- arch/powerpc/boot/raw-platform.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)This
raw-platform.cfile doesn't seem like a good place for code that is totally platform specific ...
Maybe best is to do that in asm ? The problem when you are in C code is that you may already have hit stale cache entries. "raw" platforms probably need to perform various CPU-specific initializations anyway, prior to entering C code, in a custom crt0.S, so that's probably the best place to do the cache clearing.
Ben.
Unfortunately, I think your right... The asm code seems so clean at the moment, I don't really want be the one to start tarnishing it with a bunch of little fixups.. :)
Steve
Quoted 40 lines
-----Original Message-----
From: Benjamin Herrenschmidt [mailto:[email protected]]=20
Sent: Thursday, December 13, 2007 4:10 PM
To: Stephen Neuendorffer
Cc: [email protected]; [email protected];=20 [email protected]; [email protected]
Subject: Re: [PATCH 2/7] [POWERPC] Xilinx: clear data caches. =20
=20Quoted 4 lines · Benjamin Herrenschmidt
Quoted 3 lines · Stephen Neuendorffer
This code is needed to boot without a boot loader. =20
Grant: I'm not sure where the right place to put this=20is. I'm assuming we'll actually need some boot code that is=20 not generic? Also, note that there is a V4FX errata=20 workaround in
arch/ppc/boot/head.S, which probably also needs=20 to get pulled to powerpc.Quoted 2 lines
Quoted 2 lines
=20
Signed-off-by: Stephen Neuendorffer=20Quoted 5 lines
Quoted 3 lines
--- arch/powerpc/boot/raw-platform.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)=20
Thisraw-platform.cfile doesn't seem like a good place for=20code that is
Quoted 1 line
totally platform specific ...
=20
Maybe best is to do that in asm ? The problem when you are in=20 C code is
that you may already have hit stale cache entries. "raw" platforms probably need to perform various CPU-specific initializations anyway, prior to entering C code, in a customcrt0.S, so that's probably the best place to do the cache clearing.
=20
Ben.
=20
=20
=20
Quoted 4 lines · Stephen Neuendorffer
Unfortunately, I think your right... The asm code seems so clean at the moment, I don't really want be the one to start tarnishing it with a bunch of little fixups.. :)
No problem, we can use a little shim that executes this stuff before going into crt0.S. I'm working on this right now.
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 6/7 Xilinx: Add correct compatible list for device tree bus bindings.
Includes both flavors of plb, opb, dcr, and a pseudo 'compound' bus for representing compound peripherals containing more than one logical device.
--- arch/powerpc/platforms/40x/virtex.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
arch/powerpc/platforms/40x/virtex.c +11 -1
@@ -15,12 +15,22 @@#include <asm/time.h> #include <asm/xilinx_intc.h> +static struct of_device_id xilinx_of_bus_ids[] = { + { .compatible ="xlnx,plb-v46-1.00.a" , }, + { .compatible ="xlnx,plb-v34-1.01.a" , }, + { .compatible ="xlnx,plb-v34-1.02.a" , }, + { .compatible ="xlnx,opb-v20-1.10.c" , }, + { .compatible ="xlnx,dcr-v29-1.00.a" , }, + { .compatible ="xlnx,compound" , }, + {}, +}; +static int __init virtex_device_probe (void ) {if (!machine_is (virtex))return 0 ; -of_platform_bus_probe (NULL ,NULL ,NULL ); +of_platform_bus_probe (NULL , xilinx_of_bus_ids,NULL );return 0 ; }
Signature · 1 line
1.5.3.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 7/7 Xilinx: Update booting-without-of.
This now better describes what the UBoot device tree generator actually does. In particular:
1) Nodes have a label derived from the device name, and a node name
derived from the device type.
2) Usage of compound nodes (representing more than one device in the same IP) which actually works. This requires having a valid compatible node, and all the other things that a bus normally has. I've chosen 'xlnx,compound' as the bus name to describe these compound nodes.
3) Uartlite requires a port-number property for the console to work.
In addition, I've clarified some of the language relating to how mhs nodes should be represent in the device tree.
--- Documentation/powerpc/booting-without-of.txt | 61 +++++++++++++++----------- 1 files changed, 36 insertions(+), 25 deletions(-)
Documentation/powerpc/booting-without-of.txt +36 -25
@@ -2276,7 +2276,7 @@ platforms are moved over to use the flattened-device-tree model. properties of the device node. In general, device nodes for IP-cores will take the following form: - (name)@(base-address) { + (name): (ip-core-name)@(base-address) { compatible = "xlnx,(ip-core-name)-(HW_VER)" [, (list of compatible devices), ...]; reg = <(baseaddr) (size)>;
@@ -2294,9 +2294,9 @@ platforms are moved over to use the flattened-device-tree model. dropped from the parameter name, the name is converted to lowercase and all underscore '_' characters are converted to dashes '-'. - (baseaddr): the C_BASEADDR parameter. + (baseaddr): the baseaddr parameter value (often named C_BASEADDR). (HW_VER): from the HW_VER parameter. - (size): equals C_HIGHADDR - C_BASEADDR + 1 + (size): the address range size (often C_HIGHADDR - C_BASEADDR + 1). Typically, the compatible list will include the exact IP core version followed by an older IP core version which implements the same
@@ -2326,12 +2326,13 @@ platforms are moved over to use the flattened-device-tree model. becomes the following device tree node: - opb-uartlite-0@ec100000 { + opb_uartlite_0: serial@ec100000 { device_type = "serial"; compatible = "xlnx,opb-uartlite-1.00.b"; reg = <ec100000 10000>; - interrupt-parent = <&opb-intc>; + interrupt-parent = <&opb_intc_0>; interrupts = <1 0>; // got this from the opb_intc parameters + port-number = <0>; current-speed = <d#115200>; // standard serial device prop clock-frequency = <d#50000000>; // standard serial device prop xlnx,data-bits = <8>;
@@ -2339,16 +2340,19 @@ platforms are moved over to use the flattened-device-tree model. xlnx,use-parity = <0>; }; - Some IP cores actually implement 2 or more logical devices. In this case, - the device should still describe the whole IP core with a single node - and add a child node for each logical device. The ranges property can - be used to translate from parent IP-core to the registers of each device. - (Note: this makes the assumption that both logical devices have the same - bus binding. If this is not true, then separate nodes should be used for - each logical device). The 'cell-index' property can be used to enumerate - logical devices within an IP core. For example, the following is the - system.mhs entry for the dual ps2 controller found on the ml403 reference - design. + Some IP cores actually implement 2 or more logical devices. In + this case, the device should still describe the whole IP core with + a single node and add a child node for each logical device. The + ranges property can be used to translate from parent IP-core to the + registers of each device. In addition, the parent node should be + compatible with the bus type 'xlnx,compound', and should contain + #address-cells and #size-cells, as with any other bus. (Note: this + makes the assumption that both logical devices have the same bus + binding. If this is not true, then separate nodes should be used + for each logical device). The 'cell-index' property can be used to + enumerate logical devices within an IP core. For example, the + following is the system.mhs entry for the dual ps2 controller found + on the ml403 reference design. BEGIN opb_ps2_dual_ref PARAMETER INSTANCE = opb_ps2_dual_ref_0
@@ -2370,21 +2374,24 @@ platforms are moved over to use the flattened-device-tree model. It would result in the following device tree nodes: - opb_ps2_dual_ref_0@a9000000 { + opb_ps2_dual_ref_0: opb-ps2-dual-ref@a9000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "xlnx,compound"; ranges = <0 a9000000 2000>; // If this device had extra parameters, then they would // go here. - ps2@0 { + opb-ps2-dual-ref@0 { compatible = "xlnx,opb-ps2-dual-ref-1.00.a"; reg = <0 40>; - interrupt-parent = <&opb-intc>; + interrupt-parent = <&opb_intc_0>; interrupts = <3 0>; cell-index = <0>; }; - ps2@1000 { + opb-ps2-dual-ref@1000 { compatible = "xlnx,opb-ps2-dual-ref-1.00.a"; reg = <1000 40>; - interrupt-parent = <&opb-intc>; + interrupt-parent = <&opb_intc_0>; interrupts = <3 0>; cell-index = <0>; };
@@ -2447,17 +2454,18 @@ platforms are moved over to use the flattened-device-tree model. Gives this device tree (some properties removed for clarity): - plb-v34-0 { + plb_v34 { #address-cells = <1>; #size-cells = <1>; + compatible = "xlnx,plb-v34-1.02.a"; device_type = "ibm,plb"; ranges; // 1:1 translation - plb-bram-if-cntrl-0@ffff0000 { + plb_bram_if_cntrl_0: plb-bram-if-cntrl@ffff0000 { reg = <ffff0000 10000>; } - opb-v20-0 { + opb_v20 { #address-cells = <1>; #size-cells = <1>; ranges = <20000000 20000000 20000000
@@ -2465,11 +2473,11 @@ platforms are moved over to use the flattened-device-tree model. 80000000 80000000 40000000 c0000000 c0000000 20000000>; - opb-uart16550-0@a0000000 { + opb_uart16550_0: opb-uart16550@a0000000 { reg = <a00000000 2000>; }; - opb-intc-0@d1000fc0 { + opb_intc_0: opb-intc@d1000fc0 { reg = <d1000fc0 20>; }; };
@@ -2513,6 +2521,9 @@ platforms are moved over to use the flattened-device-tree model. Requred properties: - current-speed : Baud rate of uartlite + Optional properties: + - port-number : unique ordinal index of the device. This + property is required for a console on uartlite. More devices will be defined as this spec matures.
Signature · 1 line
1.5.3.4
Re: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
Quoted 5 lines · Stephen Neuendorffer
This now better describes what the UBoot device tree generator actually does. In particular:
1) Nodes have a label derived from the device name, and a node name
derived from the device type.
2) Usage of compound nodes (representing more than one device in the same IP) which actually works. This requires having a valid compatible node, and all the other things that a bus normally has. I've chosen 'xlnx,compound' as the bus name to describe these compound nodes.
I'm not sure I like this xlnx,compound business, although maybe it's the best you can do.
Quoted 1 line
3) Uartlite requires a port-number property for the console to work.
Why? In general we try to avoid magical sequence numbers - cell-index should *only* be used when it's needed to index or program some shared register.
Signature · 4 lines
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
Re: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
Quoted 9 lines · David Gibson
Quoted 5 lines · Stephen Neuendorffer
This now better describes what the UBoot device tree generator actually does. In particular:
1) Nodes have a label derived from the device name, and a node name
derived from the device type.
2) Usage of compound nodes (representing more than one device in the same IP) which actually works. This requires having a valid compatible node, and all the other things that a bus normally has. I've chosen 'xlnx,compound' as the bus name to describe these compound nodes.I'm not sure I like this xlnx,compound business, although maybe it's the best you can do.
I'd prefer something like "xlnx,<ip-name>-group". "xlnx,compound" is a very bad idea because it will be reused for very different types of devices. What happens when a device appears that has both per-instance properties and 'top level' registers accessed by both devices?
Quoted 6 lines
Quoted 2 lines
3) Uartlite requires a port-number property for the console to work.
Why? In general we try to avoid magical sequence numbers - cell-index should *only* be used when it's needed to index or program some shared register.
Aliases is probably the correct construct for this. port-number was a bad idea and I never should have gone that direction.
Cheers,
g.
Signature · 4 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. [email protected] (403) 399-0195
RE: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
Compound devices that actually have their own shared registers should do something different. Likely they'll need some sort of data synchronization anyway. It seems that by far the common case here is to going to be to just have aggregation, and I don't see any reason that can't be handled by a common 'pseudo-bus'.
Steve
-----Original Message-----
From: [email protected] on behalf of Grant Likely
Sent: Sun 12/16/2007 8:30 PM
To: Stephen Neuendorffer; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
Quoted 9 lines · David Gibson
Quoted 5 lines · Stephen Neuendorffer
This now better describes what the UBoot device tree generator actually does. In particular:
1) Nodes have a label derived from the device name, and a node name
derived from the device type.
2) Usage of compound nodes (representing more than one device in the same IP) which actually works. This requires having a valid compatible node, and all the other things that a bus normally has. I've chosen 'xlnx,compound' as the bus name to describe these compound nodes.I'm not sure I like this xlnx,compound business, although maybe it's the best you can do.
I'd prefer something like "xlnx,<ip-name>-group". "xlnx,compound" is a very bad idea because it will be reused for very different types of devices. What happens when a device appears that has both per-instance properties and 'top level' registers accessed by both devices?
Re: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
In reply to Grant LikelyQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Grant" == Grant Likely <[email protected]> writes:
Hi,
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
3) Uartlite requires a port-number property for the console to work.
Why? In general we try to avoid magical sequence numbers - cell-index should *only* be used when it's needed to index or program some shared register.
Grant> Aliases is probably the correct construct for this. Grant> port-number was a bad idea and I never should have gone that Grant> direction.
Perhaps it would make more sense to add a _find_match_or_unused(port) like 8250.c and make the initialization order define the index instead of explicitly setting it?
Now we're at it - Why isn't the uartlite of glue handled by of_serial.c?
Signature · 1 line
Bye, Peter Korsgaard
Re: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
Quoted 10 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Grant" == Grant Likely <[email protected]> writes:
Hi,
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
3) Uartlite requires a port-number property for the console to work.
Why? In general we try to avoid magical sequence numbers - cell-index should *only* be used when it's needed to index or program some shared register.
Quoted 7 lines
Grant> Aliases is probably the correct construct for this. Grant> port-number was a bad idea and I never should have gone that Grant> direction.
Perhaps it would make more sense to add a
_find_match_or_unused(port)like 8250.c and make the initialization order define the index instead of explicitly setting it?
aliases I think is the better approach as it is an already established convention.
enumeration based on init order is fragile and there is no guarantee that order will not change in the future.
Quoted 2 lines
Now we're at it - Why isn't the uartlite of glue handled by
of_serial.c?
The of_serial.c glue is IMHO too complex for the uartlite case. I saw no advantage provided by the added complexity. (ulite_of_probe() is all of 12 lines of code).
Cheers,
g.
Signature · 4 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. [email protected] (403) 399-0195
Re: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
In reply to Stephen NeuendorfferQuoted 9 lines · Stephen Neuendorffer
This now better describes what the UBoot device tree generator actually does. In particular:
1) Nodes have a label derived from the device name, and a node name
derived from the device type.
2) Usage of compound nodes (representing more than one device in the same IP) which actually works. This requires having a valid compatible node, and all the other things that a bus normally has. I've chosen 'xlnx,compound' as the bus name to describe these compound nodes.
3) Uartlite requires a port-number property for the console to work.In addition, I've clarified some of the language relating to how mhs nodes should be represent in the device tree.
Thanks for the updates. Comments below.
Quoted 9 lines
--- Documentation/powerpc/booting-without-of.txt | 61 +++++++++++++++----------- 1 files changed, 36 insertions(+), 25 deletions(-)Documentation/powerpc/booting-without-of.txt +0
-0
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2279
Quoted 5 lines
Documentation/powerpc/booting-without-of.txt +1
-1@@ -2276,7 +2276,7 @@ platforms are moved over to use the flattened-device-tree model. properties of the device node. In general, device nodes for IP-cores will take the following form: - (name)@(base-address) { + (name): (ip-core-name)@(base-address) {
(name): (generic-name)@(base-address) {
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2299
Quoted 12 lines
Documentation/powerpc/booting-without-of.txt +2
-2compatible = "xlnx,(ip-core-name)-(HW_VER)" [, (list of compatible devices), ...]; reg = <(baseaddr) (size)>;@@ -2294,9 +2294,9 @@ platforms are moved over to use the flattened-device-tree model. dropped from the parameter name, the name is converted to lowercase and all underscore '_' characters are converted to dashes '-'. - (baseaddr): the C_BASEADDR parameter. + (baseaddr): the baseaddr parameter value (often named C_BASEADDR). (HW_VER): from the HW_VER parameter. - (size): equals C_HIGHADDR - C_BASEADDR + 1 + (size): the address range size (often C_HIGHADDR - C_BASEADDR + 1).
Ah, yes. Good clarification.
Quoted 53 lines
Documentation/powerpc/booting-without-of.txt +16
-12Typically, the compatible list will include the exact IP core version followed by an older IP core version which implements the same@@ -2326,12 +2326,13 @@ platforms are moved over to use the flattened-device-tree model. becomes the following device tree node: - opb-uartlite-0@ec100000 { + opb_uartlite_0: serial@ec100000 { device_type = "serial"; compatible = "xlnx,opb-uartlite-1.00.b"; reg = <ec100000 10000>; - interrupt-parent = <&opb-intc>; + interrupt-parent = <&opb_intc_0>; interrupts = <1 0>; // got this from the opb_intc parameters + port-number = <0>; current-speed = <d#115200>; // standard serial device prop clock-frequency = <d#50000000>; // standard serial device prop xlnx,data-bits = <8>;@@ -2339,16 +2340,19 @@ platforms are moved over to use the flattened-device-tree model. xlnx,use-parity = <0>; }; - Some IP cores actually implement 2 or more logical devices. In this case, - the device should still describe the whole IP core with a single node - and add a child node for each logical device. The ranges property can - be used to translate from parent IP-core to the registers of each device. - (Note: this makes the assumption that both logical devices have the same - bus binding. If this is not true, then separate nodes should be used for - each logical device). The 'cell-index' property can be used to enumerate - logical devices within an IP core. For example, the following is the - system.mhs entry for the dual ps2 controller found on the ml403 reference - design. + Some IP cores actually implement 2 or more logical devices. In + this case, the device should still describe the whole IP core with + a single node and add a child node for each logical device. The + ranges property can be used to translate from parent IP-core to the + registers of each device. In addition, the parent node should be + compatible with the bus type 'xlnx,compound', and should contain + #address-cells and #size-cells, as with any other bus. (Note: this + makes the assumption that both logical devices have the same bus + binding. If this is not true, then separate nodes should be used + for each logical device). The 'cell-index' property can be used to + enumerate logical devices within an IP core. For example, the + following is the system.mhs entry for the dual ps2 controller found + on the ml403 reference design. BEGIN opb_ps2_dual_ref PARAMETER INSTANCE = opb_ps2_dual_ref_0@@ -2370,21 +2374,24 @@ platforms are moved over to use the flattened-device-tree model. It would result in the following device tree nodes:
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2384
Quoted 10 lines
Documentation/powerpc/booting-without-of.txt +5
-2- opb_ps2_dual_ref_0@a9000000 { + opb_ps2_dual_ref_0: opb-ps2-dual-ref@a9000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "xlnx,compound"; ranges = <0 a9000000 2000>; // If this device had extra parameters, then they would // go here. - ps2@0 { + opb-ps2-dual-ref@0 {
According to the generic names recommendation, this should be either "keyboard@0" or "mouse@0", but of course the two interfaces are identical and EDK doesn't have any information about how they are used. Perhaps the node name should be: "ps2@0". David, thoughts?
Quoted 17 lines
Documentation/powerpc/booting-without-of.txt +3
-3compatible = "xlnx,opb-ps2-dual-ref-1.00.a"; reg = <0 40>; - interrupt-parent = <&opb-intc>; + interrupt-parent = <&opb_intc_0>; interrupts = <3 0>; cell-index = <0>; }; - ps2@1000 { + opb-ps2-dual-ref@1000 { compatible = "xlnx,opb-ps2-dual-ref-1.00.a"; reg = <1000 40>; - interrupt-parent = <&opb-intc>; + interrupt-parent = <&opb_intc_0>; interrupts = <3 0>; cell-index = <0>; };
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2457
Quoted 5 lines
Documentation/powerpc/booting-without-of.txt +1
-1@@ -2447,17 +2454,18 @@ platforms are moved over to use the flattened-device-tree model. Gives this device tree (some properties removed for clarity): - plb-v34-0 { + plb_v34 {
Steve, when I wrote this I was lazy and I didn't add the bus address. However, if we don't have the base address I think we'll end up with name collisions (especially in the MPMC case). So, based on generic names convention, this should probably simply be "plb@<baseaddr>".
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2464
Quoted 8 lines
Documentation/powerpc/booting-without-of.txt +2
-1#address-cells = <1>; #size-cells = <1>; + compatible = "xlnx,plb-v34-1.02.a"; device_type = "ibm,plb"; ranges; // 1:1 translation - plb-bram-if-cntrl-0@ffff0000 { + plb_bram_if_cntrl_0: plb-bram-if-cntrl@ffff0000 {
Node name should probably just be "bram@ffff0000" here.
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2468
Quoted 5 lines
Documentation/powerpc/booting-without-of.txt +1
-1reg = <ffff0000 10000>; } - opb-v20-0 { + opb_v20 {
opb@<baseaddr>
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2476
Quoted 9 lines
Documentation/powerpc/booting-without-of.txt +1
-1#address-cells = <1>; #size-cells = <1>; ranges = <20000000 20000000 20000000@@ -2465,11 +2473,11 @@ platforms are moved over to use the flattened-device-tree model. 80000000 80000000 40000000 c0000000 c0000000 20000000>; - opb-uart16550-0@a0000000 { + opb_uart16550_0: opb-uart16550@a0000000 {
serial@a0000000
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2480
Quoted 5 lines
Documentation/powerpc/booting-without-of.txt +1
-1reg = <a00000000 2000>; }; - opb-intc-0@d1000fc0 { + opb_intc_0: opb-intc@d1000fc0 {
interrupt-controller@d1000fc0
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2526
Quoted 10 lines
Documentation/powerpc/booting-without-of.txt +3
-0reg = <d1000fc0 20>; }; };@@ -2513,6 +2521,9 @@ platforms are moved over to use the flattened-device-tree model. Requred properties: - current-speed : Baud rate of uartlite + Optional properties: + - port-number : unique ordinal index of the device. This + property is required for a console on uartlite.
And has already been discussed, drop the port-number property. I'll rework the uartlite driver to use aliases instead.
Cheers,
g.
Signature · 4 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. [email protected] (403) 399-0195
RE: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
When the driver no longer requires the port number, it's easy to drop. Until then, I'll keep it in.
Also, I'm not so sure that moving to completely generic names is really worth the effort... All the 'semantically' interesting' information is already in the device tree somewhere else. In the limit, the node name could just be a randomly generated string. So now we have a matter of taste: what is the right amount of detail to put in so that someone who looks at the tree can easily understand what's going on, but not be overwhelmed? The xilinx ip name seems to usually do that almost as well as a 'generic name'. Anyway, you proved me wrong last time after a bunch of mulling it over, so maybe I'll just take your word for it and do it that way. :)
In other news, my computer seems to have died this morning, so productivity may be low. :)
Steve
________________________________
From: [email protected] on behalf of Grant Likely
Sent: Mon 12/17/2007 7:19 AM
To: Stephen Neuendorffer
Cc: [email protected]; [email protected]; [email protected]; David Gibson
Subject: Re: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2526
Quoted 10 lines
reg = <d1000fc0 20>; }; };Documentation/powerpc/booting-without-of.txt +3
-0@@ -2513,6 +2521,9 @@ platforms are moved over to use the flattened-device-tree model. Requred properties: - current-speed : Baud rate of uartlite + Optional properties: + - port-number : unique ordinal index of the device. This + property is required for a console on uartlite.
And has already been discussed, drop the port-number property. I'll rework the uartlite driver to use aliases instead.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
Re: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
Quoted 11 lines · Stephen Neuendorffer
When the driver no longer requires the port number, it's easy to drop. Until then, I'll keep it in.
Also, I'm not so sure that moving to completely generic names is really worth the effort... All the 'semantically' interesting' information is already in the device tree somewhere else. In the limit, the node name could just be a randomly generated string. So now we have a matter of
taste: what is the right amount of detail to put in so that someone who looks at the tree can easily understand what's going on, but not be overwhelmed?
True, but part of 'taste' is following the established OF conventions such as the generic names ( http://playground.sun.com/1275/practice/
). Those conventions come directly from the lessons learned by real open firmware over the years. It's okay to break convention; but only if you've got a *damn* *good* reason for doing so. :-)
Quoted 4 lines
The xilinx ip name seems to usually do that almost as well as
a 'generic name'. Anyway, you proved me wrong last time after a bunch of mulling it over, so maybe I'll just take your word for it and do it that way. :)
heh, And a big reason I'm arguing it is David, Segher and others
took me to task for making the same mistakes. :-)
Quoted 2 lines
In other news, my computer seems to have died this morning, so productivity may be low. :)
Fun. :-(
Cheers,
g.
Signature · 4 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. [email protected] (403) 399-0195
RE: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of.
In reply to Grant LikelyI've updated the generator based on the below feedback. I'll also send around the updated patch for this section briefly. Comments below.
Quoted 9 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Grant Likely
Sent: Monday, December 17, 2007 7:20 AM
To: Stephen Neuendorffer
Cc: [email protected]; [email protected]; linuxppc- [email protected]; David Gibson
Subject: Re: [PATCH 7/7] [POWERPC] Xilinx: Update booting-without-of. =20
Quoted 4 lines
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2279
Quoted 2 lines
Documentation/powerpc/booting-without-of.txt +1
-1- (name)@(base-address) { + (name): (ip-core-name)@(base-address) {=20
(name): (generic-name)@(base-address) {
In most cases it now does this. In the default case for ip which is not recognized, it falls back to the ip-core-name.
Quoted 7 lines
Review
Quoted 7 lines
(quoted diff) +4
-1- opb_ps2_dual_ref_0@a9000000 { + opb_ps2_dual_ref_0: opb-ps2-dual-ref@a9000000 { + #address-cells =3D <1>; + #size-cells =3D <1>; + compatible =3D "xlnx,compound"; ranges =3D <0 a9000000 2000>; // If this device had extra parameters, then they
would
Quoted 8 lines
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2384
Quoted 3 lines
// go here.Documentation/powerpc/booting-without-of.txt +1
-1- ps2@0 { + opb-ps2-dual-ref@0 {=20
According to the generic names recommendation, this should be either "keyboard@0" or "mouse@0", but of course the two interfaces are identical and EDK doesn't have any information about how they are used. Perhaps the node name should be: "ps2@0". David, thoughts?
I don't think keyboard or mouse really makes sense here. Went with ps2.
Quoted 7 lines
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2457
Quoted 2 lines
Documentation/powerpc/booting-without-of.txt +1
-1- plb-v34-0 { + plb_v34 {=20
Steve, when I wrote this I was lazy and I didn't add the bus address. However, if we don't have the base address I think we'll end up with name collisions (especially in the MPMC case). So, based on generic names convention, this should probably simply be "plb@<baseaddr>".
I wondered at one point if this would be a problem... in any event, you now get the baseaddress.
Quoted 10 lines
Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 2464
Quoted 8 lines
#address-cells =3D <1>; #size-cells =3D <1>;Documentation/powerpc/booting-without-of.txt +2
-1+ compatible =3D "xlnx,plb-v34-1.02.a"; device_type =3D "ibm,plb"; ranges; // 1:1 translation - plb-bram-if-cntrl-0@ffff0000 { + plb_bram_if_cntrl_0: plb-bram-if-cntrl@ffff0000 {=20
Node name should probably just be "bram@ffff0000" here.
What actually gets generated is a memory node at the toplevel, which is currently suppressed, since it appears that having disjoint memory locations doesn't work. If you have more than one 'real' memory controller, such as an plb_emc connected to flash, then you currently get the warning:
"Warning!: More than one memory found. Note that most platforms don't support non-contiguous memory maps!"
So, there is some divergence here, but I'm not too concerned about it since the way that such memory might get used is still up for discussion.
Also note that memory nodes which are not at the toplevel don't appear to be detected. Is this by intention or omission?
Obviously there is room for improvement here. Having a some way to leverage brams, in particular the dummy bram that you have to have at high memory in order to get the ppc to boot would be nice!
Steve
PATCH 5/7 Xilinx: Update compatible to use values generated by BSP generator.
In reply to a message not in the archiveMainly, this involves two changes:
1) xilinx->xlnx (recognized standard is to use the stock ticker)
2) In order to have the device tree focus on describing what the hardware is as exactly as possible, the compatible strings contain the full IP name and IP version.
--- arch/powerpc/platforms/40x/virtex.c | 2 +- drivers/block/xsysace.c | 4 ++- drivers/serial/uartlite.c | 42 +++++++++++++++++++++------------- drivers/video/xilinxfb.c | 2 +- 4 files changed, 31 insertions(+), 19 deletions(-)
arch/powerpc/platforms/40x/virtex.c +1 -1
@@ -30,7 +30,7 @@ static int __init virtex_probe(void) {unsigned long root =of_get_flat_dt_root (); -if (!of_flat_dt_is_compatible (root,"xilinx,virtex" )) +if (!of_flat_dt_is_compatible (root,"xlnx,virtex" ))return 0 ;return 1 ;
drivers/block/xsysace.c +3 -1
@@ -1208,7 +1208,9 @@ static int __devexit ace_of_remove(struct of_device *op)/* Match table for of_platform binding */ static struct of_device_id __devinit ace_of_match[] = { - { .compatible ="xilinx,xsysace" , }, + { .compatible ="xlnx,opb-sysace-1.00.b" , }, + { .compatible ="xlnx,opb-sysace-1.00.c" , }, + { .compatible ="xlnx,xps-sysace-1.00.a" , }, {}, };MODULE_DEVICE_TABLE (of, ace_of_match);
drivers/serial/uartlite.c +26 -16
65 lines not on this page · raw message
drivers/video/xilinxfb.c +1 -1
@@ -460,7 +460,7 @@ static int __devexit xilinxfb_of_remove(struct of_device *op)/* Match table for of_platform binding */ static struct of_device_id __devinit xilinxfb_of_match[] = { - { .compatible ="xilinx,ml300-fb" , }, + { .compatible ="xlnx,plb-tft-cntlr-ref-1.00.a" , }, {}, };MODULE_DEVICE_TABLE (of, xilinxfb_of_match);
Signature · 1 line
1.5.3.4
PATCH 4/7 Xilinx: update compatible list for interrupt controller
In reply to a message not in the archiveThese values now match what is generated by the uboot BSP generator.
--- arch/powerpc/sysdev/xilinx_intc.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
arch/powerpc/sysdev/xilinx_intc.c +7 -1
@@ -135,10 +135,16 @@ void __init xilinx_intc_init_tree(void)struct device_node *np;/* find top level interrupt controller */ -for_each_compatible_node (np,NULL ,"xilinx,intc" ) { +for_each_compatible_node (np,NULL ,"xlnx,opb-intc-1.00.c" ) {if (!of_get_property (np,"interrupts" ,NULL ))break ; } +if (!np) { +for_each_compatible_node (np,NULL ,"xlnx,xps-intc-1.00.a" ) { +if (!of_get_property (np,"interrupts" ,NULL )) +break ; + } + }/* xilinx interrupt controller needs to be top level */ BUG_ON (!np);
Signature · 1 line
1.5.3.4
PATCH 3/7 Xilinx: Uartlite: Make console output actually work.
In reply to a message not in the archiveFrom: Grant Likely <[email protected]>
Fixed to apply against 2.6.24-rc5, and remove DEBUG information.
--- drivers/serial/uartlite.c | 121 +++++++++++++++++++++++++++++---------------- 1 files changed, 79 insertions(+), 42 deletions(-)
drivers/serial/uartlite.c +79 -42
@@ -9,6 +9,8 @@* kind, whether express or implied. */ +#undef DEBUG +#include <linux/platform_device.h> #include <linux/module.h> #include <linux/console.h>
@@ -321,6 +323,49 @@ static struct uart_ops ulite_ops = { .verify_port = ulite_verify_port }; +/** +* ulite_get_port: Get the uart_port for a given port number and base addr +*/ +static struct uart_port *ulite_get_port (int id) +{ +struct uart_port *port; + +/* if id = -1; then scan for a free id and use that */ +if (id <0 ) { +for (id =0 ; id <ULITE_NR_UARTS ; id++) +if (ulite_ports[id].mapbase ==0 ) +break ; + } + +if ((id <0 ) || (id >=ULITE_NR_UARTS )) { +printk (KERN_WARNING "uartlite: invalid id: %i\n" , id); +return NULL ; + } + +/* The ID is valid, so get the address of the uart_port structure */ + port = &ulite_ports[id]; + +/* Is the structure is already initialized? */ +if (port->mapbase) +return port; + +/* At this point, we've got an empty uart_port struct, initialize it */ +spin_lock_init (&port->lock); + port->membase =NULL ; + port->fifosize =16 ; + port->regshift =2 ; + port->iotype =UPIO_MEM ; + port->iobase =1 ;/* mark port in use */ + port->ops = &ulite_ops; + port->irq =NO_IRQ ; + port->flags =UPF_BOOT_AUTOCONF ; + port->dev =NULL ; + port->type =PORT_UNKNOWN ; + port->line = id; + +return port; +} +/* --------------------------------------------------------------------- * Console driver operations */
@@ -376,7 +421,7 @@ static void ulite_console_write(struct console *co, const char *s, }#if defined(CONFIG_OF ) -static inline void __init ulite_console_of_find_device (int id) +static inline u32 __init ulite_console_of_find_device (int id) {struct device_node *np;struct resource res;
@@ -392,13 +437,14 @@ static inline void __init ulite_console_of_find_device(int id)if (rc)continue ; - ulite_ports[id].mapbase = res.start;of_node_put (np); - return; + return res.start+3; } + +return 0 ; }#else /* CONFIG_OF */ -static inline void __init ulite_console_of_find_device (int id) {/* do nothing */ } +static inline u32 __init ulite_console_of_find_device (int id) {return 0 ; }#endif /* CONFIG_OF */ static int __init ulite_console_setup (struct console *co,char *options)
@@ -408,25 +454,33 @@ static int __init ulite_console_setup(struct console *co, char *options)int bits =8 ;int parity ='n' ;int flow ='n' ; +u32 base; -if (co->index <0 || co->index >=ULITE_NR_UARTS ) -return -EINVAL ; +/* Find a matching uart port in the device tree */ + base =ulite_console_of_find_device (co->index); - port = &ulite_ports[co->index]; +/* Get the port structure */ + port =ulite_get_port (co->index); +if (!port) +return -ENODEV ; -/* Check if it is an OF device */ -if (!port->mapbase) -ulite_console_of_find_device (co->index); +/* was it initialized for this device? */ +if (base) { +if ((port->mapbase) && (port->mapbase != base)) { +pr_debug (KERN_DEBUG "ulite: addr mismatch; %x != %x\n" , + port->mapbase, base); +return -ENODEV ;/* port used by another device; bail */ + } + port->mapbase = base; + } -/* Do we have a device now? */ -if (!port->mapbase) { -pr_debug ("console on ttyUL%i not present\n" , co->index); +if (!port->mapbase)return -ENODEV ; - } -/* not initialized yet? */ +/* registers mapped yet? */ if (!port->membase) { -if (ulite_request_port (port)) + port->membase =ioremap (port->mapbase,ULITE_REGION ); +if (!port->membase)return -ENODEV ; }
@@ -488,39 +542,22 @@ static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq)struct uart_port *port;int rc; -/* if id = -1; then scan for a free id and use that */ -if (id <0 ) { -for (id =0 ; id <ULITE_NR_UARTS ; id++) -if (ulite_ports[id].mapbase ==0 ) -break ; - } -if (id <0 || id >=ULITE_NR_UARTS ) { -dev_err (dev,"%s%i too large\n" ,ULITE_NAME , id); -return -EINVAL ; + port =ulite_get_port (id); +if (!port) { +dev_err (dev,"Cannot get uart_port structure\n" ); +return -ENODEV ; } -if ((ulite_ports[id].mapbase) && (ulite_ports[id].mapbase != base)) { -dev_err (dev,"cannot assign to %s%i; it is already in use\n" , -ULITE_NAME , id); -return -EBUSY ; +/* was it initialized for this device? */ +if ((port->mapbase) && (port->mapbase != base)) { +pr_debug (KERN_DEBUG "ulite: addr mismatch; %x != %x\n" , + port->mapbase, base); +return -ENODEV ; } - port = &ulite_ports[id]; - -spin_lock_init (&port->lock); - port->fifosize =16 ; - port->regshift =2 ; - port->iotype =UPIO_MEM ; - port->iobase =1 ;/* mark port in use */ port->mapbase = base; - port->membase =NULL ; - port->ops = &ulite_ops; port->irq = irq; - port->flags =UPF_BOOT_AUTOCONF ; port->dev = dev; - port->type =PORT_UNKNOWN ; - port->line = id; -dev_set_drvdata (dev, port);/* Register the port */
Signature · 1 line
1.5.3.4