mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Michael Riesch <michael.riesch@wolfvision.net>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2] arm: rockchip-rk3568-evb: add hardware id detection
Date: Mon, 23 Aug 2021 16:11:00 +0200
Message-ID: <20210823141100.GB31210@pengutronix.de> (raw)
In-Reply-To: <20210705160457.7346-1-michael.riesch@wolfvision.net>

On Mon, Jul 05, 2021 at 06:04:57PM +0200, Michael Riesch wrote:
> The RK3568 EVB uses a voltage divider to determine the hardware ID of
> the board. At the moment, the voltage levels for seven EVB variants are
> defined. This commit adds a late_initcall to the board code that reads
> out the voltage and populates the hardware ID as environment variable.
> 
> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> ---
> v2:
> - add compatible check
> - return early in case the voltage cannot be read
> - populate hardware ID as environment variable
> 
>  arch/arm/boards/rockchip-rk3568-evb/board.c | 56 +++++++++++++++++++++
>  1 file changed, 56 insertions(+)
> 
> diff --git a/arch/arm/boards/rockchip-rk3568-evb/board.c b/arch/arm/boards/rockchip-rk3568-evb/board.c
> index 57c24ed3c..f8b257e57 100644
> --- a/arch/arm/boards/rockchip-rk3568-evb/board.c
> +++ b/arch/arm/boards/rockchip-rk3568-evb/board.c
> @@ -2,7 +2,13 @@
>  #include <common.h>
>  #include <init.h>
>  #include <mach/bbu.h>
> +#include <aiodev.h>
>  #include <bootsource.h>
> +#include <environment.h>
> +#include <globalvar.h>
> +#include <magicvar.h>
> +
> +static bool machine_is_rk3568_evb = false;
>  
>  static int rk3568_evb_probe(struct device_d *dev)
>  {
> @@ -11,6 +17,7 @@ static int rk3568_evb_probe(struct device_d *dev)
>  
>  	barebox_set_model("Rockchip RK3568 EVB");
>  	barebox_set_hostname("rk3568-evb");
> +	machine_is_rk3568_evb = true;
>  
>  	if (bootsource == BOOTSOURCE_MMC && instance == 1)
>  		of_device_enable_path("/chosen/environment-sd");
> @@ -34,3 +41,52 @@ static struct driver_d rk3568_evb_board_driver = {
>  	.of_compatible = rk3568_evb_of_match,
>  };
>  coredevice_platform_driver(rk3568_evb_board_driver);
> +
> +static int rk3568_evb_detect_hwid(void)
> +{
> +	int ret;
> +	int evb_hwid_voltage;
> +	struct aiochannel *evb_hwid_chan;
> +	char *evb_hwid;
> +
> +	if (!machine_is_rk3568_evb)
> +		return 0;
> +
> +	evb_hwid_chan = aiochannel_by_name("aiodev0.in_value1_mV");

This fails to link when CONFIG_AIODEV is disabled. I added an early
return at the top of this function to fix that.

Sascha

-- 
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 |

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


      parent reply	other threads:[~2021-08-23 14:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 16:04 Michael Riesch
2021-07-05 17:18 ` [PATCH] fixup! " Ahmad Fatoum
2021-07-05 17:18 ` [PATCH v2] " Ahmad Fatoum
2021-08-09 18:51 ` Sascha Hauer
2021-08-23 14:11 ` Sascha Hauer [this message]

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=20210823141100.GB31210@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=michael.riesch@wolfvision.net \
    /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

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git