mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Denis OSTERLAND <denis.osterland@diehl.com>
To: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: [PATCH 2/2] i.MX: HABv4: always print HAB status at boot time
Date: Mon, 3 Dec 2018 10:17:35 +0000	[thread overview]
Message-ID: <1543832254.4674.4.camel@diehl.com> (raw)
In-Reply-To: <20181125225952.16159-2-r.hieber@pengutronix.de>

Am Sonntag, den 25.11.2018, 23:59 +0100 schrieb Roland Hieber:
> Currently, board code needs to call habv4_get_status() explicitely, but
> there is no reason that it cannot be called automatically at startup
> when HABv4 is enabled. This way the call cannot be forgotten and we can
> make sure to report all potentially occuring HAB warnings and errors.
This fully fits my needs.
Tested on i.MX6.
> 
> Signed-off-by: Roland Hieber <r.hieber@pengutronix.de>
Acked-by: Denis Osterland <Denis Osterland@diehl.com>
> ---
>  drivers/hab/habv3.c |  4 ++++
>  drivers/hab/habv4.c | 41 +++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+)
> 
> diff --git a/drivers/hab/habv3.c b/drivers/hab/habv3.c
> index 82ae245f8a..c190c78d40 100644
> --- a/drivers/hab/habv3.c
> +++ b/drivers/hab/habv3.c
> @@ -78,5 +78,9 @@ int imx_habv3_get_status(uint32_t status)
>  
>  int imx25_hab_get_status(void)
>  {
> +	if (!cpu_is_mx25()) {
> +		return 0;
> +	}
>  	return imx_habv3_get_status(readl(IOMEM(0x780018d4)));
>  }
> +postmmu_initcall(imx25_hab_get_status);
> diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
> index e64f34870e..09f598631b 100644
> --- a/drivers/hab/habv4.c
> +++ b/drivers/hab/habv4.c
> @@ -20,6 +20,7 @@
>  
>  #include <common.h>
>  #include <hab.h>
> +#include <init.h>
>  #include <types.h>
>  
>  #include <mach/generic.h>
> @@ -500,9 +501,49 @@ int imx6_hab_get_status(void)
>  	return -EINVAL;
>  }
>  
> +static int init_imx6_hab_get_status(void)
> +{
> +	int ret = 0;
> +
> +	if (!cpu_is_mx6())
> +		/* can happen in multi-image builds and is not an error */
> +		return 0;
> +
> +	ret = imx6_hab_get_status();
> +
> +	/* nobody will check the return value if there were HAB errors, but the
> +	 * initcall will fail spectaculously with a strange error message. */
> +	if (ret == -EPERM)
> +		return 0;
> +	return ret;
> +}
> +/* need to run before MMU setup because i.MX6 ROM code is mapped near 0x0,
> + * which will no longer be accessible when the MMU sets the zero page to
> + * faulting. */
> +postconsole_initcall(init_imx6_hab_get_status);
> +
>  int imx28_hab_get_status(void)
>  {
>  	const struct habv4_rvt *rvt = (void *)HABV4_RVT_IMX28;
>  
>  	return habv4_get_status(rvt);
>  }
> +
> +static int init_imx28_hab_get_status(void)
> +{
> +	int ret = 0;
> +
> +	if (!cpu_is_mx28())
> +		/* can happen in multi-image builds and is not an error */
> +		return 0;
> +
> +	ret = imx28_hab_get_status();
> +
> +	/* nobody will check the return value if there were HAB errors, but the
> +	 * initcall will fail spectaculously with a strange error message. */
> +	if (ret == -EPERM)
> +		return 0;
> +	return ret;
> +}
> +/* i.MX28 ROM code can be run after MMU setup to make use of caching */
> +postmmu_initcall(init_imx28_hab_get_status);

Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht
Nürnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by
mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited. 
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-12-03 10:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-25 22:59 [PATCH 1/2] drivers: caam: add RNG software self-test Roland Hieber
2018-11-25 22:59 ` [PATCH 2/2] i.MX: HABv4: always print HAB status at boot time Roland Hieber
2018-11-26  7:56   ` Denis OSTERLAND
2018-12-03 10:17   ` Denis OSTERLAND [this message]
2018-11-26  9:01 ` [PATCH 1/2] drivers: caam: add RNG software self-test Sascha Hauer
2018-11-26 10:53   ` Roland Hieber
2018-11-29 14:11     ` Roland Hieber
2018-12-03  7:45       ` Sascha Hauer
2018-12-03  9:41         ` Roland Hieber
2018-11-29 10:17   ` Roland Hieber

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=1543832254.4674.4.camel@diehl.com \
    --to=denis.osterland@diehl.com \
    --cc=barebox@lists.infradead.org \
    /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