Skip to contentSkip to conversation

couple questions re: special processing in image_setup_libfdt() for keystone

U-Boot Robert P. J. Day 1 participant 1 message May 22, 2016

lore
Share & tools
lore
#0 lore raw

i note that, at the bottom of the image_setup_libfdt() routine in
common/image-fdt.c, there is some special processing for a particular SoC:

  #if defined(CONFIG_SOC_KEYSTONE)
        if (IMAGE_OF_BOARD_SETUP)
                ft_board_setup_ex(blob, gd->bd);
  #endif

first, it seems kind of ... tacky to have a general support routine like that contain a snippet of S0C-specific code. i do understand what it does, as described in fdt-support.h:

/*
* The keystone2 SOC requires all 32 bit aliased addresses to be converted
* to their 36 physical format. This has to happen after all fdt nodes
* are added or modified by the image_setup_libfdt(). The ft_board_setup_ex()
* called at the end of the image_setup_libfdt() is to do that convertion. */
void ft_board_setup_ex(void *blob, bd_t *bd);

but why not just support a general-purpose routine like, say, ft_board_setup_post(), that *anyone* can define if they need it and get rid of that conditional, just in case someone else might want something similar down the road?

(an alternative would be to just fold that fixup into
ft_verify_fdt() in that one case, which is already guaranteed to be called.)

and a more specific question about that particular bit of code -- as
you see above, the explanation is that the keystone SoC needs some special fixup if the fdt is modified in that routine. but is it not possible that the fdt might be modified by something *other* than calling ft_board_setup()?

put another way, would it not be safer to replace this:

  #if defined(CONFIG_SOC_KEYSTONE)
        if (IMAGE_OF_BOARD_SETUP)
                ft_board_setup_ex(blob, gd->bd);
  #endif

with this:

  #if defined(CONFIG_SOC_KEYSTONE)
                ft_board_setup_ex(blob, gd->bd);
  #endif

just to play it safe?

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================