mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 2/2] ARM: nxp-imx8mq-evk: add barebox and env partitions
Date: Tue, 6 Nov 2018 13:14:41 -0800	[thread overview]
Message-ID: <CAHQ1cqHXjSTqwBPv_NQoUJdg0dFdSUQtjoPau-TR5CxoMmFQNg@mail.gmail.com> (raw)
In-Reply-To: <20181106174254.21371-2-l.stach@pengutronix.de>

On Tue, Nov 6, 2018 at 9:43 AM Lucas Stach <l.stach@pengutronix.de> wrote:
>
> So we can have a persistent env and a bit safer barebox update. Also
> switch the environment and update default depending on the bootsource,
> as this is really helpful on an eval board where one might want to
> have totally different systems on eMMC and SD card.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  arch/arm/boards/nxp-imx8mq-evk/board.c | 20 +++++++++++---
>  arch/arm/dts/imx8mq-evk.dts            | 37 ++++++++++++++++++++++++++
>  2 files changed, 54 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/boards/nxp-imx8mq-evk/board.c b/arch/arm/boards/nxp-imx8mq-evk/board.c
> index 7918b5fb3e36..299d056e2777 100644
> --- a/arch/arm/boards/nxp-imx8mq-evk/board.c
> +++ b/arch/arm/boards/nxp-imx8mq-evk/board.c
> @@ -17,11 +17,12 @@
>   *
>   */
>
> +#include <asm/memory.h>
> +#include <bootsource.h>
>  #include <common.h>
>  #include <init.h>
> -#include <asm/memory.h>
> -#include <linux/sizes.h>
>  #include <linux/phy.h>
> +#include <linux/sizes.h>
>  #include <mach/bbu.h>
>
>  #include <envfs.h>
> @@ -47,12 +48,25 @@ static int ar8031_phy_fixup(struct phy_device *phydev)
>
>  static int nxp_imx8mq_evk_init(void)
>  {
> +       int flags;
> +
>         if (!of_machine_is_compatible("fsl,imx8mq-evk"))
>                 return 0;
>
>         barebox_set_hostname("imx8mq-evk");
>
> -       imx8mq_bbu_internal_mmc_register_handler("eMMC", "/dev/mmc0", 0);
> +       flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
> +       imx8mq_bbu_internal_mmc_register_handler("eMMC",
> +                                                "/dev/mmc0.barebox", flags);
> +
> +       flags = bootsource_get_instance() == 1 ? BBU_HANDLER_FLAG_DEFAULT : 0;
> +       imx8mq_bbu_internal_mmc_register_handler("SD",
> +                                                "/dev/mmc1.barebox", flags);
> +
> +       if (bootsource_get_instance() == 0)
> +               of_device_enable_path("/chosen/environment-emmc");
> +       else
> +               of_device_enable_path("/chosen/environment-sd");

Optionally, you can probably simplify this to:

switch (bootsource_get_instance()) {
case 0:
    flags_emmc = BBU_HANDLER_FLAG_DEFAULT;
    flags_sd = 0;
    environment_path = "/chosen/envirnoment-emmc";
    break;
case 1:
    flags_emmc = 0;
    flags_sd = BBU_HANDLER_FLAGDEFAULT;
    environment_path = "/chosen/envirnoment-sd";
    break;
}

imx8mq_bbu_internal_mmc_register_handler("eMMC",
                                                "/dev/mmc0.barebox", flags_mmc);

imx8mq_bbu_internal_mmc_register_handler("SD",
                                               "/dev/mmc1.barebox", flags_sd);

of_device_enable_path(environment_path);

Thanks,
Andrey Smirnov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-11-06 21:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 17:42 [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF Lucas Stach
2018-11-06 17:42 ` [PATCH 2/2] ARM: nxp-imx8mq-evk: add barebox and env partitions Lucas Stach
2018-11-06 21:14   ` Andrey Smirnov [this message]
2018-11-06 20:57 ` [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF Andrey Smirnov
2018-11-07 12:02   ` Lucas Stach
2018-11-09  7:24 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHQ1cqHXjSTqwBPv_NQoUJdg0dFdSUQtjoPau-TR5CxoMmFQNg@mail.gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=l.stach@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox