Patchwork [17/25] PPC: e500: dt: create mpic node dynamically

login
register
mail settings
Submitter Alexander Graf
Date May 30, 2012, 11 a.m.
Message ID <1338375646-15064-18-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/161936/
State New
Headers show

Comments

Alexander Graf - May 30, 2012, 11 a.m.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/ppce500_mpc8544ds.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
Scott Wood - May 31, 2012, 10:10 p.m.
On 05/30/2012 06:00 AM, Alexander Graf wrote:
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  hw/ppce500_mpc8544ds.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
> index 493ad6e..3d073dd 100644
> --- a/hw/ppce500_mpc8544ds.c
> +++ b/hw/ppce500_mpc8544ds.c
> @@ -83,6 +83,8 @@ static int mpc8544_load_device_tree(CPUPPCState *env,
>      char soc[128];
>      char ser0[128];
>      char ser1[128];
> +    char mpic[128];
> +    uint32_t mpic_ph;
>  
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
>      if (!filename) {
> @@ -199,6 +201,20 @@ static int mpc8544_load_device_tree(CPUPPCState *env,
>      /* XXX should contain a reasonable value */
>      qemu_devtree_setprop_cell(fdt, soc, "bus-frequency", 0);
>  
> +    sprintf(mpic, "%s/pic@%x", soc,
> +            MPC8544_MPIC_REGS_BASE - MPC8544_CCSRBAR_BASE);
> +    qemu_devtree_add_subnode(fdt, mpic);
> +    qemu_devtree_setprop_string(fdt, mpic, "device_type", "open-pic");
> +    qemu_devtree_setprop_string(fdt, mpic, "compatible", "chrp,open-pic");
> +    qemu_devtree_setprop_cell2(fdt, mpic, "reg", MPC8544_MPIC_REGS_BASE -
> +                               MPC8544_CCSRBAR_BASE, 0x40000);
> +    qemu_devtree_setprop_cell(fdt, mpic, "#address-cells", 0);
> +    qemu_devtree_setprop_cell(fdt, mpic, "#interrupt-cells", 2);
> +    mpic_ph = qemu_devtree_alloc_phandle(fdt);
> +    qemu_devtree_setprop_cell(fdt, mpic, "phandle", mpic_ph);
> +    qemu_devtree_setprop_cell(fdt, mpic, "linux,phandle", mpic_ph);
> +    qemu_devtree_setprop(fdt, mpic, "interrupt-controller", NULL, 0);

Please make this look like arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi in
current kernels.

-Scott

Patch

diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
index 493ad6e..3d073dd 100644
--- a/hw/ppce500_mpc8544ds.c
+++ b/hw/ppce500_mpc8544ds.c
@@ -83,6 +83,8 @@  static int mpc8544_load_device_tree(CPUPPCState *env,
     char soc[128];
     char ser0[128];
     char ser1[128];
+    char mpic[128];
+    uint32_t mpic_ph;
 
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
     if (!filename) {
@@ -199,6 +201,20 @@  static int mpc8544_load_device_tree(CPUPPCState *env,
     /* XXX should contain a reasonable value */
     qemu_devtree_setprop_cell(fdt, soc, "bus-frequency", 0);
 
+    sprintf(mpic, "%s/pic@%x", soc,
+            MPC8544_MPIC_REGS_BASE - MPC8544_CCSRBAR_BASE);
+    qemu_devtree_add_subnode(fdt, mpic);
+    qemu_devtree_setprop_string(fdt, mpic, "device_type", "open-pic");
+    qemu_devtree_setprop_string(fdt, mpic, "compatible", "chrp,open-pic");
+    qemu_devtree_setprop_cell2(fdt, mpic, "reg", MPC8544_MPIC_REGS_BASE -
+                               MPC8544_CCSRBAR_BASE, 0x40000);
+    qemu_devtree_setprop_cell(fdt, mpic, "#address-cells", 0);
+    qemu_devtree_setprop_cell(fdt, mpic, "#interrupt-cells", 2);
+    mpic_ph = qemu_devtree_alloc_phandle(fdt);
+    qemu_devtree_setprop_cell(fdt, mpic, "phandle", mpic_ph);
+    qemu_devtree_setprop_cell(fdt, mpic, "linux,phandle", mpic_ph);
+    qemu_devtree_setprop(fdt, mpic, "interrupt-controller", NULL, 0);
+
     /*
      * We have to generate ser1 first, because Linux takes the first
      * device it finds in the dt as serial output device. And we generate