From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 7/8] imx6: SPL support for iMX6 SabreSD
Date: Wed, 12 Nov 2014 11:13:01 +0100 [thread overview]
Message-ID: <546332AD.4060601@denx.de> (raw)
In-Reply-To: <CACUGKYPOosA5m=y9QN7=Ma1+gw3zBsX2LbmA0xGtor=5Tos3Rw@mail.gmail.com>
Hi John,
On 11/11/2014 18:15, John Tobias wrote:
>>>> You add a new entry point here (spl_board_mmc_init), but why cannot you
>>>> do this in the functions already supplied by SPL ? Why not in board_init_f ?
>>>
>>> When the spl_mmc_load_image function being called, it call
>>> mmc_initialize. By default, the mmc_initialize
>>> call board_mmc_init. By looking the said function, it initialize all mmc ports.
>>>
>>> While, in spl_board_mmc_init, only initialize the current mmc port.
>>
>> ok - but which is the issue by initializing all ports ? I mean, if
>> board_mmc_init initialize all ports including what you need in SPL,
>> which is the reason to exclude the other ones ?
>>
>
> When board_mmc_init initialize all ports, we can issue a command
> at uboot console to switch to different port.
> e.g:
>
> mmc dev 0 (e.g. SD4)
> mmc dev 1 (e.g. SD2)
> mmc dev 2 (e.g. SD3)
>
> We can also re-map which is index 0, 1 and 2 by re-arranging the contents of
>
> struct fsl_esdhc_cfg usdhc_cfg[3] = {
> {USDHC4_BASE_ADDR},
> {USDHC2_BASE_ADDR},
> {USDHC3_BASE_ADDR},
> };
>
> Assuming the bootstrap is configured to port 3 (USDHC3). The SPL image will
> call spl_mmc_load_image to load the uboot image. In order to do that,
> it will call
> the find_mmc_device(0), based on example above the index 0 is port 4, index 1
> is port 2 and index 2 is port 3. The find_mmc_device will return with errors
> because it couldn't initialize the said port.
>
> So by default, the user should switch back the bootstrap to port 4 in
> order to load the
> uboot correctly. Then, if the user really want to use the different
> ports, they have
> to change the arrangement of the contents of usdhc_cfg and compile the
> u-boot again.
>
> In spl_board_mmc_init function, it will read the bootstrap and configure it. The
> settings are passed to fsl_esdhc_initialize which is to be stored in
> index 0. So,
> find_mmc_device(0) could get a correct information.
>
> Then, switching to different bootstrap doesn't require to re-compile the image.
This is not enough for adding a new exported weak function, that reamins
undocumented, and does not avoid using #ifdef, only moved into
drivers/mmc/mmc.c.
We have other cases where the behavior is different between SPL and
U-Boot, and this is handled in board file using the same #ifdef
CONFIG_SPL_BUILD.
The question is: why do you need to change the API (as I said, it
remains undocumented) instead of doing :
int board_mmc_init(bd_t *bis) {
#ifdef CONFIG_SPL_BUILD
<initialization single port based on bootstrap>
#else
<instantiate all ports as usual>
#endif
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
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:[~2014-11-12 10:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-08 21:27 [U-Boot] [PATCH v3 0/8] *** iMX6 SabreSD SPL Support *** John Tobias
2014-11-08 21:27 ` [U-Boot] [PATCH v3 1/8] mmc: add spl_board_mmc_init John Tobias
2014-11-08 21:27 ` [U-Boot] [PATCH v3 2/8] mmc: imx6: call spl_board_mmc_init John Tobias
2014-11-08 21:27 ` [U-Boot] [PATCH v3 3/8] imx6: add spl on include header file John Tobias
2014-11-08 21:27 ` [U-Boot] [PATCH v3 4/8] imx6: add some flexibility for defining macros John Tobias
2014-11-09 21:24 ` Stefano Babic
2014-11-09 23:53 ` John Tobias
2014-11-11 8:28 ` Stefano Babic
2014-11-08 21:27 ` [U-Boot] [PATCH v3 5/8] imx6: add spl on board configuration John Tobias
2014-11-08 21:27 ` [U-Boot] [PATCH v3 6/8] imx6: add data configuration file for SPL John Tobias
2014-11-09 21:22 ` Stefano Babic
2014-11-09 23:55 ` John Tobias
2014-11-08 21:27 ` [U-Boot] [PATCH v3 7/8] imx6: SPL support for iMX6 SabreSD John Tobias
2014-11-09 21:16 ` Stefano Babic
2014-11-10 0:23 ` John Tobias
2014-11-11 8:44 ` Stefano Babic
2014-11-11 17:15 ` John Tobias
2014-11-12 10:13 ` Stefano Babic [this message]
2014-11-12 16:14 ` John Tobias
2014-11-08 21:27 ` [U-Boot] [PATCH v3 8/8] kconfig: imx6: add SUPPORT_SPL John Tobias
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=546332AD.4060601@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox