[RFC PATCH 1/2] arm: rockchip-rk3568-evb: add hardware id detection

Sascha Hauer sha at pengutronix.de
Sat Jul 3 13:49:16 PDT 2021


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



More information about the barebox mailing list