Commit 3b595da441cf38d1905684dea28767afeb732838

Authored by Rob Clark
Committed by Tom Rini
1 parent 0689eb7470

fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE

Similar to CONFIG_OF_BOARD, but in this case the fdt is still built by
u-boot build.  This allows the board to patch the fdt, etc.

In the specific case of dragonboard 410c, we pass the u-boot generated
fdt to the previous stage of bootloader (by embedding it in the
u-boot.img that is loaded by lk/aboot), which patches the fdt and passes
it back to u-boot.

Signed-off-by: Rob Clark <robdclark@gmail.com>
[trini: Update board_fdt_blob_setup #if check]
Signed-off-by: Tom Rini <trini@konsulko.com>

Showing 2 changed files with 25 additions and 13 deletions Side-by-side Diff

... ... @@ -990,7 +990,8 @@
990 990  
991 991 /**
992 992 * Board-specific FDT initialization. Returns the address to a device tree blob.
993   - * Called when CONFIG_OF_BOARD is defined.
  993 + * Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined
  994 + * and the board implements it.
994 995 */
995 996 void *board_fdt_blob_setup(void);
996 997  
... ... @@ -1272,6 +1272,28 @@
1272 1272 # endif
1273 1273 #endif
1274 1274  
  1275 +#if defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE)
  1276 +/*
  1277 + * For CONFIG_OF_SEPARATE, the board may optionally implement this to
  1278 + * provide and/or fixup the fdt.
  1279 + */
  1280 +__weak void *board_fdt_blob_setup(void)
  1281 +{
  1282 + void *fdt_blob = NULL;
  1283 +#ifdef CONFIG_SPL_BUILD
  1284 + /* FDT is at end of BSS unless it is in a different memory region */
  1285 + if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
  1286 + fdt_blob = (ulong *)&_image_binary_end;
  1287 + else
  1288 + fdt_blob = (ulong *)&__bss_end;
  1289 +#else
  1290 + /* FDT is at end of image */
  1291 + fdt_blob = (ulong *)&_end;
  1292 +#endif
  1293 + return fdt_blob;
  1294 +}
  1295 +#endif
  1296 +
1275 1297 int fdtdec_setup(void)
1276 1298 {
1277 1299 #if CONFIG_IS_ENABLED(OF_CONTROL)
... ... @@ -1285,18 +1307,7 @@
1285 1307 # else
1286 1308 gd->fdt_blob = __dtb_dt_begin;
1287 1309 # endif
1288   -# elif defined CONFIG_OF_SEPARATE
1289   -# ifdef CONFIG_SPL_BUILD
1290   - /* FDT is at end of BSS unless it is in a different memory region */
1291   - if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
1292   - gd->fdt_blob = (ulong *)&_image_binary_end;
1293   - else
1294   - gd->fdt_blob = (ulong *)&__bss_end;
1295   -# else
1296   - /* FDT is at end of image */
1297   - gd->fdt_blob = (ulong *)&_end;
1298   -# endif
1299   -# elif defined(CONFIG_OF_BOARD)
  1310 +# elif defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE)
1300 1311 /* Allow the board to override the fdt address. */
1301 1312 gd->fdt_blob = board_fdt_blob_setup();
1302 1313 # elif defined(CONFIG_OF_HOSTFILE)