Re: [PATCH v3] soc: renesas: rcar-rst: Add support to set rproc boot address

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

 



Hi Julien,

On Tue, Oct 12, 2021 at 2:12 PM Julien Massot <julien.massot@xxxxxxx> wrote:
> R-Car Gen3 SoC series has a realtime processor, the boot
> address of this processor can be set thanks to CR7BAR register
> of the reset module.
>
> Export this function so that it's possible to set the boot
> address from a remoteproc driver.
>
> Also drop the __initdata qualifier on rcar_rst_base,
> since we will use this address later than init time.
>
> Signed-off-by: Julien Massot <julien.massot@xxxxxxx>
> ---
>
> Change since v2:
> - Reordered rcar_rst_set_gen3_rproc_boot_addr and variable to avoid forward declaration
> - Turned const struct rst_config structs back to __initconst
> - Check for 256KiB boundary and not 4KiB
> - Rephrase comment about boot address on Gen 3

Thanks for the update!

> --- a/drivers/soc/renesas/rcar-rst.c
> +++ b/drivers/soc/renesas/rcar-rst.c

> @@ -19,9 +25,30 @@ static int rcar_rst_enable_wdt_reset(void __iomem *base)
>         return 0;
>  }
>
> +/*
> + * Most of the R-Car Gen3 SoCs have an ARM Realtime Core.
> + * Firmware boot address has to be set in CR7BAR before
> + * starting the realtime core.
> + * Boot address must be aligned on a 256k boundary.
> + */
> +static int rcar_rst_set_gen3_rproc_boot_addr(u32 boot_addr)

phys_addr_t?

> +{
> +       if (boot_addr % SZ_256K) {
> +               pr_warn("Invalid boot address for CR7 processor,"
> +                      "should be aligned on 256KiB got %x\n", boot_addr);

Please don't split printed messages, for easier searching.

> +               return -EINVAL;
> +       }
> +
> +       iowrite32(boot_addr, rcar_rst_base + CR7BAR);
> +       iowrite32(boot_addr | CR7BAREN, rcar_rst_base + CR7BAR);
> +
> +       return 0;
> +}
> +
>  struct rst_config {
>         unsigned int modemr;            /* Mode Monitoring Register Offset */
>         int (*configure)(void __iomem *base);   /* Platform specific config */
> +       int (*set_rproc_boot_addr)(u32 boot_addr);

phys_addr_t

>  };
>
>  static const struct rst_config rcar_rst_gen1 __initconst = {

> @@ -130,3 +157,12 @@ int __init rcar_rst_read_mode_pins(u32 *mode)
>         *mode = saved_mode;
>         return 0;
>  }
> +
> +int rcar_rst_set_rproc_boot_addr(u32 boot_addr)

phys_addr_t

> +{
> +       if (!rcar_rst_set_rproc_boot_addr_func)
> +               return -EIO;
> +
> +       return rcar_rst_set_rproc_boot_addr_func(boot_addr);
> +}
> +EXPORT_SYMBOL(rcar_rst_set_rproc_boot_addr);

EXPORT_SYMBOL_GPL?

Do you have a public user of this code, too?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux