From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/5] mx6cuboxi: Differentiate Cubox-i and Hummingboard
Date: Thu, 23 Apr 2015 17:17:35 +0200 [thread overview]
Message-ID: <55390D0F.9030008@denx.de> (raw)
In-Reply-To: <553903D2.70003@mail.bg>
Hi Nikolay,
On 23/04/2015 16:38, Nikolay Dimitrov wrote:
>
> As more and more board variants are supported by unified source files,
> functions like "is_specificboard()" are not scaling well - there's a
> repetitive code for extracting hw-specific info, and then there's the
> multiple functions that return true/false for each board variant.
ok - let's see what we can do. I have not thinking about it, because how
to get model / version is quite always very specific. Some boards as
this one are reading GPIOs, some other are reading from I2C / SPI, some
other ones check if some hardware is present.
>
> Here's one proposal how this can be simplified a bit:
>
> typedef enum
> {
> BOARD_ALPHA,
> BOARD_BRAVO,
> BOARD_CHARLIE,
> } model_t;
>
> /* Can be also named is_board_variant() or something like this */
> static bool is_board_model(model_t m)
> {
> /* ... Extract HW info */
>
> switch (m)
> {
> case BOARD_ALPHA:
> if (check for this board model)
> return true;
The check must be done in board code, because only the board knows the
details.
> break;
>
> /* do same for the other board models */
> /* ... */
> }
>
> return false;
> }
>
> Not sure whether such code can be shared between different boards, but
> can be a step towards unifying the handling of board models/variants.
>
Trying to get further and see if we can factorize it. Maybe not a lot.
We can also think that is_board_model() becomes get_board_model(), or we
generalize what was done in tqma6 with a sort of get_board_name().
Maybe we can factorize just a few code, but at least we could provide a
"standard" method without having all boards doing the same in different way.
> I'm perfectly fine with Fabio's code here, just using the occasion to
> share my idea.
Thanks - by sharing ideas we can improve code !
Best regards,
Stefano
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
next prev parent reply other threads:[~2015-04-23 15:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-23 3:57 [U-Boot] [PATCH 1/5] mx6cuboxi: Fix the defconfig name Fabio Estevam
2015-04-23 3:57 ` [U-Boot] [PATCH 2/5] mx6cuboxi: Prepare for multi SoC support Fabio Estevam
2015-04-23 6:14 ` Stefano Babic
2015-04-23 3:57 ` [U-Boot] [PATCH 3/5] mx6cuboxi: Introduce multi-SoC support Fabio Estevam
2015-04-23 6:16 ` Stefano Babic
2015-04-23 19:09 ` Tom Rini
2015-04-23 3:57 ` [U-Boot] [PATCH 4/5] mx6cuboxi: Differentiate Cubox-i and Hummingboard Fabio Estevam
2015-04-23 6:16 ` Stefano Babic
2015-04-23 14:38 ` Nikolay Dimitrov
2015-04-23 15:17 ` Stefano Babic [this message]
2015-04-23 3:57 ` [U-Boot] [PATCH 5/5] mx6cuboxi: Load the correct 'fdt_file' variable Fabio Estevam
2015-04-23 6:13 ` Stefano Babic
2015-04-23 17:18 ` Fabio Estevam
2015-04-23 18:26 ` Stefano Babic
2015-04-23 19:10 ` Tom Rini
2015-04-23 18:47 ` [U-Boot] [U-Boot, " Vagrant Cascadian
2015-04-23 6:14 ` [U-Boot] [PATCH 1/5] mx6cuboxi: Fix the defconfig name Stefano Babic
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=55390D0F.9030008@denx.de \
--to=sbabic@denx.de \
--cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.