* [PATCH] hw/ppc: e500: Add missing #address-cells and #size-cells in the eTSEC node
@ 2021-02-18 14:58 Bin Meng
2021-02-18 22:51 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Bin Meng @ 2021-02-18 14:58 UTC (permalink / raw)
To: David Gibson, Greg Kurz, qemu-devel, qemu-ppc; +Cc: Bin Meng
From: Bin Meng <bin.meng@windriver.com>
Per devicetree spec v0.3 [1] chapter 2.3.5:
The #address-cells and #size-cells properties are not inherited
from ancestors in the devicetree. They shall be explicitly defined.
If missing, a client program should assume a default value of 2
for #address-cells, and a value of 1 for #size-cells.
These properties are currently missing, causing the <reg> property
to be incorrectly parsed using the default values.
[1] https://github.com/devicetree-org/devicetree-specification/releases/download/v0.3/devicetree-specification-v0.3.pdf
Fixes: fdfb7f2cdb2d ("e500: Add support for eTSEC in device tree")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
hw/ppc/e500.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 01517a6..c84a021 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -236,6 +236,8 @@ static int create_devtree_etsec(SysBusDevice *sbdev, PlatformDevtreeData *data)
qemu_fdt_setprop_string(fdt, node, "model", "eTSEC");
qemu_fdt_setprop(fdt, node, "local-mac-address", etsec->conf.macaddr.a, 6);
qemu_fdt_setprop_cells(fdt, node, "fixed-link", 0, 1, 1000, 0, 0);
+ qemu_fdt_setprop_cells(fdt, node, "#size-cells", 1);
+ qemu_fdt_setprop_cells(fdt, node, "#address-cells", 1);
qemu_fdt_add_subnode(fdt, group);
qemu_fdt_setprop_cells(fdt, group, "reg", mmio0, 0x1000);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hw/ppc: e500: Add missing #address-cells and #size-cells in the eTSEC node
2021-02-18 14:58 [PATCH] hw/ppc: e500: Add missing #address-cells and #size-cells in the eTSEC node Bin Meng
@ 2021-02-18 22:51 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2021-02-18 22:51 UTC (permalink / raw)
To: Bin Meng; +Cc: Bin Meng, qemu-ppc, Greg Kurz, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1891 bytes --]
On Thu, Feb 18, 2021 at 10:58:39PM +0800, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
>
> Per devicetree spec v0.3 [1] chapter 2.3.5:
>
> The #address-cells and #size-cells properties are not inherited
> from ancestors in the devicetree. They shall be explicitly defined.
> If missing, a client program should assume a default value of 2
> for #address-cells, and a value of 1 for #size-cells.
>
> These properties are currently missing, causing the <reg> property
> to be incorrectly parsed using the default values.
Well, specifically the reg property of the queue-group subnode, rather
than the etsec node itself.
Applied to ppc-for-6.0.
>
> [1] https://github.com/devicetree-org/devicetree-specification/releases/download/v0.3/devicetree-specification-v0.3.pdf
>
> Fixes: fdfb7f2cdb2d ("e500: Add support for eTSEC in device tree")
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
> hw/ppc/e500.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index 01517a6..c84a021 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -236,6 +236,8 @@ static int create_devtree_etsec(SysBusDevice *sbdev, PlatformDevtreeData *data)
> qemu_fdt_setprop_string(fdt, node, "model", "eTSEC");
> qemu_fdt_setprop(fdt, node, "local-mac-address", etsec->conf.macaddr.a, 6);
> qemu_fdt_setprop_cells(fdt, node, "fixed-link", 0, 1, 1000, 0, 0);
> + qemu_fdt_setprop_cells(fdt, node, "#size-cells", 1);
> + qemu_fdt_setprop_cells(fdt, node, "#address-cells", 1);
>
> qemu_fdt_add_subnode(fdt, group);
> qemu_fdt_setprop_cells(fdt, group, "reg", mmio0, 0x1000);
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-18 23:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-18 14:58 [PATCH] hw/ppc: e500: Add missing #address-cells and #size-cells in the eTSEC node Bin Meng
2021-02-18 22:51 ` David Gibson
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).