Re: [PATCH 2/2] raspi: fixup additional vc created nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02.08.23 12:50, Denis Osterland-Heim wrote:
> From: Denis OSTERLAND-HEIM <denis.osterland@xxxxxxxxx>
> 
> The video core creates some additional nodes.
> This code takes over this values.
> The /hat node is only there if an raspi hat with EEPROM is detected.
> 
> Signed-off-by: Denis OSTERLAND-HEIM <denis.osterland@xxxxxxxxx>

Acked-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>

> ---
>  arch/arm/boards/raspberry-pi/rpi-common.c | 38 +++++++++++++++++------
>  1 file changed, 29 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c
> b/arch/arm/boards/raspberry-pi/rpi-common.c
> index 2f525e7d70..9c85c85d14 100644
> --- a/arch/arm/boards/raspberry-pi/rpi-common.c
> +++ b/arch/arm/boards/raspberry-pi/rpi-common.c
> @@ -264,19 +264,36 @@ static enum reset_src_type
> rpi_decode_pm_rsts(struct device_node *chosen,
>  
>  static int rpi_vc_fdt_fixup(struct device_node *root, void *data)
>  {
> -       const struct device_node *vc_chosen = data;
> -       struct device_node *chosen;
> +       const struct device_node *vc_node = data;
> +       struct device_node *node;
> +       struct property *pp;
>  
> -       chosen = of_create_node(root, "/chosen");
> -       if (!chosen)
> +       node = of_create_node(root, vc_node->full_name);
> +       if (!node)
>                 return -ENOMEM;
>  
> -       of_copy_property(vc_chosen, "overlay_prefix", chosen);
> -       of_copy_property(vc_chosen, "os_prefix", chosen);
> +       for_each_property_of_node(vc_node, pp)
> +               of_copy_property(vc_node, pp->name, node);
>  
>         return 0;
>  }
>  
> +static struct device_node *register_vc_fixup(struct device_node *root,
> const char *path)
> +{
> +       struct device_node *ret, *tmp;
> +
> +       ret = of_find_node_by_path_from(root, path);
> +       if (ret) {
> +               tmp = of_dup(ret);
> +               tmp->full_name = xstrdup(ret->full_name);
> +               of_register_fixup(rpi_vc_fdt_fixup, tmp);
> +       } else {
> +               pr_info("no '%s' node found in vc fdt\n", path);
> +       }
> +
> +       return ret;
> +}
> +
>  static u32 rpi_boot_mode, rpi_boot_part;
>  /* Extract useful information from the VideoCore FDT we got.
>   * Some parameters are defined here:
> @@ -300,14 +317,17 @@ static void rpi_vc_fdt_parse(struct device_node
> *root)
>                 free(str);
>         }
>  
> -       chosen = of_find_node_by_path_from(root, "/chosen");
> +       register_vc_fixup(root, "/system");
> +       register_vc_fixup(root, "/axi");
> +       register_vc_fixup(root, "/reserved-memory");
> +       register_vc_fixup(root, "/hat");
> +       register_vc_fixup(root, "/chosen/bootloader");
> +       chosen = register_vc_fixup(root, "/chosen");
>         if (!chosen) {
>                 pr_err("no '/chosen' node found in vc fdt\n");
>                 goto out;
>         }
>  
> -       of_register_fixup(rpi_vc_fdt_fixup, of_dup(chosen));
> -
>         bootloader = of_find_node_by_name(chosen, "bootloader");
>  
>         str = of_read_vc_string(chosen, "bootargs");

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux