mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: Michael Riesch <michael.riesch@wolfvision.net>,
	barebox@lists.infradead.org
Subject: Re: [RFC PATCH 1/2] arm: rockchip-rk3568-evb: add hardware id detection
Date: Sat, 3 Jul 2021 22:49:16 +0200	[thread overview]
Message-ID: <20210703204916.GA9782@pengutronix.de> (raw)
In-Reply-To: <d230f623-b7e8-faee-98c8-1526e2840425@pengutronix.de>

On Wed, Jun 30, 2021 at 12:17:59PM +0200, Ahmad Fatoum wrote:
> Hello Michael,
> 
> Trent already commented on the device tree overlay part.
> This commit here seems applicable regardless,
> so in case you want to resend it for upstream inclusion,
> some comments are inline.
> 
> 
> On 29.06.21 14:31, Michael Riesch wrote:
> > Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> 
> A short commit message here would be nice, e.g.:
> 
> The rk3568 EVB uses a voltage divider to ... etc.
> 
> > ---
> >  arch/arm/boards/rockchip-rk3568-evb/board.c | 36 +++++++++++++++++++++
> >  1 file changed, 36 insertions(+)
> > 
> > diff --git a/arch/arm/boards/rockchip-rk3568-evb/board.c b/arch/arm/boards/rockchip-rk3568-evb/board.c
> > index 57c24ed3c..ee8e1b979 100644
> > --- a/arch/arm/boards/rockchip-rk3568-evb/board.c
> > +++ b/arch/arm/boards/rockchip-rk3568-evb/board.c
> > @@ -2,6 +2,7 @@
> >  #include <common.h>
> >  #include <init.h>
> >  #include <mach/bbu.h>
> > +#include <aiodev.h>
> >  #include <bootsource.h>
> >  
> >  static int rk3568_evb_probe(struct device_d *dev)
> > @@ -34,3 +35,38 @@ 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_version(void)
> > +{
> 
> Once more 64-bit rockchip boards are added, they would all execute this
> initcall if this board is enabled. For this reason, you need a compatible
> check here.

Instead of a compatible check I'd prefer a

static bool machine_is_rk3568_evb;

Set it to true in the driver above and test for it in additional
initcalls.

Testing for a variable is cheaper in terms of binary size and runtime
penalty than compatible checks.

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-07-03 20:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 12:31 [RFC PATCH 0/2] Proof of concept device tree overlays Michael Riesch
2021-06-29 12:31 ` [RFC PATCH 1/2] arm: rockchip-rk3568-evb: add hardware id detection Michael Riesch
2021-06-30 10:17   ` Ahmad Fatoum
2021-07-01  7:19     ` Michael Riesch
2021-07-03 20:49     ` Sascha Hauer [this message]
2021-06-29 12:31 ` [RFC PATCH 2/2] arm: rockchip-rk3568-evb: apply dt overlay for evb7 Michael Riesch
2021-06-29 21:58   ` Trent Piepho
2021-06-30  9:18     ` Michael Riesch

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=20210703204916.GA9782@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=michael.riesch@wolfvision.net \
    --subject='Re: [RFC PATCH 1/2] arm: rockchip-rk3568-evb: add hardware id detection' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox