image-fdt.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (c) 2013, Google Inc.
  4. *
  5. * (C) Copyright 2008 Semihalf
  6. *
  7. * (C) Copyright 2000-2006
  8. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  9. */
  10. #include <common.h>
  11. #include <fdt_support.h>
  12. #include <fdtdec.h>
  13. #include <env.h>
  14. #include <errno.h>
  15. #include <image.h>
  16. #include <lmb.h>
  17. #include <log.h>
  18. #include <malloc.h>
  19. #include <asm/global_data.h>
  20. #include <linux/libfdt.h>
  21. #include <mapmem.h>
  22. #include <asm/io.h>
  23. #include <tee/optee.h>
  24. #ifndef CONFIG_SYS_FDT_PAD
  25. #define CONFIG_SYS_FDT_PAD 0x3000
  26. #endif
  27. /* adding a ramdisk needs 0x44 bytes in version 2008.10 */
  28. #define FDT_RAMDISK_OVERHEAD 0x80
  29. DECLARE_GLOBAL_DATA_PTR;
  30. static void fdt_error(const char *msg)
  31. {
  32. puts("ERROR: ");
  33. puts(msg);
  34. puts(" - must RESET the board to recover.\n");
  35. }
  36. #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
  37. static const image_header_t *image_get_fdt(ulong fdt_addr)
  38. {
  39. const image_header_t *fdt_hdr = map_sysmem(fdt_addr, 0);
  40. image_print_contents(fdt_hdr);
  41. puts(" Verifying Checksum ... ");
  42. if (!image_check_hcrc(fdt_hdr)) {
  43. fdt_error("fdt header checksum invalid");
  44. return NULL;
  45. }
  46. if (!image_check_dcrc(fdt_hdr)) {
  47. fdt_error("fdt checksum invalid");
  48. return NULL;
  49. }
  50. puts("OK\n");
  51. if (!image_check_type(fdt_hdr, IH_TYPE_FLATDT)) {
  52. fdt_error("uImage is not a fdt");
  53. return NULL;
  54. }
  55. if (image_get_comp(fdt_hdr) != IH_COMP_NONE) {
  56. fdt_error("uImage is compressed");
  57. return NULL;
  58. }
  59. if (fdt_check_header((void *)image_get_data(fdt_hdr)) != 0) {
  60. fdt_error("uImage data is not a fdt");
  61. return NULL;
  62. }
  63. return fdt_hdr;
  64. }
  65. #endif
  66. static void boot_fdt_reserve_region(struct lmb *lmb, uint64_t addr,
  67. uint64_t size, enum lmb_flags flags)
  68. {
  69. long ret;
  70. ret = lmb_reserve_flags(lmb, addr, size, flags);
  71. if (ret >= 0) {
  72. debug(" reserving fdt memory region: addr=%llx size=%llx flags=%x\n",
  73. (unsigned long long)addr,
  74. (unsigned long long)size, flags);
  75. } else {
  76. puts("ERROR: reserving fdt memory region failed ");
  77. printf("(addr=%llx size=%llx flags=%x)\n",
  78. (unsigned long long)addr,
  79. (unsigned long long)size, flags);
  80. }
  81. }
  82. /**
  83. * boot_fdt_add_mem_rsv_regions - Mark the memreserve and reserved-memory
  84. * sections as unusable
  85. * @lmb: pointer to lmb handle, will be used for memory mgmt
  86. * @fdt_blob: pointer to fdt blob base address
  87. *
  88. * Adds the and reserved-memorymemreserve regions in the dtb to the lmb block.
  89. * Adding the memreserve regions prevents u-boot from using them to store the
  90. * initrd or the fdt blob.
  91. */
  92. void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob)
  93. {
  94. uint64_t addr, size;
  95. int i, total, ret;
  96. int nodeoffset, subnode;
  97. struct fdt_resource res;
  98. enum lmb_flags flags;
  99. if (fdt_check_header(fdt_blob) != 0)
  100. return;
  101. /* process memreserve sections */
  102. total = fdt_num_mem_rsv(fdt_blob);
  103. for (i = 0; i < total; i++) {
  104. if (fdt_get_mem_rsv(fdt_blob, i, &addr, &size) != 0)
  105. continue;
  106. boot_fdt_reserve_region(lmb, addr, size, LMB_NONE);
  107. }
  108. /* process reserved-memory */
  109. nodeoffset = fdt_subnode_offset(fdt_blob, 0, "reserved-memory");
  110. if (nodeoffset >= 0) {
  111. subnode = fdt_first_subnode(fdt_blob, nodeoffset);
  112. while (subnode >= 0) {
  113. /* check if this subnode has a reg property */
  114. ret = fdt_get_resource(fdt_blob, subnode, "reg", 0,
  115. &res);
  116. if (!ret && fdtdec_get_is_enabled(fdt_blob, subnode)) {
  117. flags = LMB_NONE;
  118. if (fdtdec_get_bool(fdt_blob, subnode,
  119. "no-map"))
  120. flags = LMB_NOMAP;
  121. addr = res.start;
  122. size = res.end - res.start + 1;
  123. boot_fdt_reserve_region(lmb, addr, size, flags);
  124. }
  125. subnode = fdt_next_subnode(fdt_blob, subnode);
  126. }
  127. }
  128. }
  129. /**
  130. * boot_relocate_fdt - relocate flat device tree
  131. * @lmb: pointer to lmb handle, will be used for memory mgmt
  132. * @of_flat_tree: pointer to a char* variable, will hold fdt start address
  133. * @of_size: pointer to a ulong variable, will hold fdt length
  134. *
  135. * boot_relocate_fdt() allocates a region of memory within the bootmap and
  136. * relocates the of_flat_tree into that region, even if the fdt is already in
  137. * the bootmap. It also expands the size of the fdt by CONFIG_SYS_FDT_PAD
  138. * bytes.
  139. *
  140. * of_flat_tree and of_size are set to final (after relocation) values
  141. *
  142. * returns:
  143. * 0 - success
  144. * 1 - failure
  145. */
  146. int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
  147. {
  148. void *fdt_blob = *of_flat_tree;
  149. void *of_start = NULL;
  150. char *fdt_high;
  151. ulong of_len = 0;
  152. int err;
  153. int disable_relocation = 0;
  154. /* nothing to do */
  155. if (*of_size == 0)
  156. return 0;
  157. if (fdt_check_header(fdt_blob) != 0) {
  158. fdt_error("image is not a fdt");
  159. goto error;
  160. }
  161. /* position on a 4K boundary before the alloc_current */
  162. /* Pad the FDT by a specified amount */
  163. of_len = *of_size + CONFIG_SYS_FDT_PAD;
  164. /* If fdt_high is set use it to select the relocation address */
  165. fdt_high = env_get("fdt_high");
  166. if (fdt_high) {
  167. void *desired_addr = (void *)hextoul(fdt_high, NULL);
  168. if (((ulong) desired_addr) == ~0UL) {
  169. /* All ones means use fdt in place */
  170. of_start = fdt_blob;
  171. lmb_reserve(lmb, (ulong)of_start, of_len);
  172. disable_relocation = 1;
  173. } else if (desired_addr) {
  174. of_start =
  175. (void *)(ulong) lmb_alloc_base(lmb, of_len, 0x1000,
  176. (ulong)desired_addr);
  177. if (of_start == NULL) {
  178. puts("Failed using fdt_high value for Device Tree");
  179. goto error;
  180. }
  181. } else {
  182. of_start =
  183. (void *)(ulong) lmb_alloc(lmb, of_len, 0x1000);
  184. }
  185. } else {
  186. of_start =
  187. (void *)(ulong) lmb_alloc_base(lmb, of_len, 0x1000,
  188. env_get_bootm_mapsize()
  189. + env_get_bootm_low());
  190. }
  191. if (of_start == NULL) {
  192. puts("device tree - allocation error\n");
  193. goto error;
  194. }
  195. if (disable_relocation) {
  196. /*
  197. * We assume there is space after the existing fdt to use
  198. * for padding
  199. */
  200. fdt_set_totalsize(of_start, of_len);
  201. printf(" Using Device Tree in place at %p, end %p\n",
  202. of_start, of_start + of_len - 1);
  203. } else {
  204. debug("## device tree at %p ... %p (len=%ld [0x%lX])\n",
  205. fdt_blob, fdt_blob + *of_size - 1, of_len, of_len);
  206. printf(" Loading Device Tree to %p, end %p ... ",
  207. of_start, of_start + of_len - 1);
  208. err = fdt_open_into(fdt_blob, of_start, of_len);
  209. if (err != 0) {
  210. fdt_error("fdt move failed");
  211. goto error;
  212. }
  213. puts("OK\n");
  214. }
  215. *of_flat_tree = of_start;
  216. *of_size = of_len;
  217. if (CONFIG_IS_ENABLED(CMD_FDT))
  218. set_working_fdt_addr(map_to_sysmem(*of_flat_tree));
  219. return 0;
  220. error:
  221. return 1;
  222. }
  223. /**
  224. * boot_get_fdt - main fdt handling routine
  225. * @argc: command argument count
  226. * @argv: command argument list
  227. * @arch: architecture (IH_ARCH_...)
  228. * @images: pointer to the bootm images structure
  229. * @of_flat_tree: pointer to a char* variable, will hold fdt start address
  230. * @of_size: pointer to a ulong variable, will hold fdt length
  231. *
  232. * boot_get_fdt() is responsible for finding a valid flat device tree image.
  233. * Curently supported are the following ramdisk sources:
  234. * - multicomponent kernel/ramdisk image,
  235. * - commandline provided address of decicated ramdisk image.
  236. *
  237. * returns:
  238. * 0, if fdt image was found and valid, or skipped
  239. * of_flat_tree and of_size are set to fdt start address and length if
  240. * fdt image is found and valid
  241. *
  242. * 1, if fdt image is found but corrupted
  243. * of_flat_tree and of_size are set to 0 if no fdt exists
  244. */
  245. int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
  246. bootm_headers_t *images, char **of_flat_tree, ulong *of_size)
  247. {
  248. #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
  249. const image_header_t *fdt_hdr;
  250. ulong load, load_end;
  251. ulong image_start, image_data, image_end;
  252. #endif
  253. ulong img_addr;
  254. ulong fdt_addr;
  255. char *fdt_blob = NULL;
  256. void *buf;
  257. #if CONFIG_IS_ENABLED(FIT)
  258. const char *fit_uname_config = images->fit_uname_cfg;
  259. const char *fit_uname_fdt = NULL;
  260. ulong default_addr;
  261. int fdt_noffset;
  262. #endif
  263. const char *select = NULL;
  264. *of_flat_tree = NULL;
  265. *of_size = 0;
  266. img_addr = (argc == 0) ? image_load_addr :
  267. hextoul(argv[0], NULL);
  268. buf = map_sysmem(img_addr, 0);
  269. if (argc > 2)
  270. select = argv[2];
  271. if (select || genimg_has_config(images)) {
  272. #if CONFIG_IS_ENABLED(FIT)
  273. if (select) {
  274. /*
  275. * If the FDT blob comes from the FIT image and the
  276. * FIT image address is omitted in the command line
  277. * argument, try to use ramdisk or os FIT image
  278. * address or default load address.
  279. */
  280. if (images->fit_uname_rd)
  281. default_addr = (ulong)images->fit_hdr_rd;
  282. else if (images->fit_uname_os)
  283. default_addr = (ulong)images->fit_hdr_os;
  284. else
  285. default_addr = image_load_addr;
  286. if (fit_parse_conf(select, default_addr,
  287. &fdt_addr, &fit_uname_config)) {
  288. debug("* fdt: config '%s' from image at 0x%08lx\n",
  289. fit_uname_config, fdt_addr);
  290. } else if (fit_parse_subimage(select, default_addr,
  291. &fdt_addr, &fit_uname_fdt)) {
  292. debug("* fdt: subimage '%s' from image at 0x%08lx\n",
  293. fit_uname_fdt, fdt_addr);
  294. } else
  295. #endif
  296. {
  297. fdt_addr = hextoul(select, NULL);
  298. debug("* fdt: cmdline image address = 0x%08lx\n",
  299. fdt_addr);
  300. }
  301. #if CONFIG_IS_ENABLED(FIT)
  302. } else {
  303. /* use FIT configuration provided in first bootm
  304. * command argument
  305. */
  306. fdt_addr = map_to_sysmem(images->fit_hdr_os);
  307. fdt_noffset = fit_get_node_from_config(images,
  308. FIT_FDT_PROP,
  309. fdt_addr);
  310. if (fdt_noffset == -ENOENT)
  311. return 0;
  312. else if (fdt_noffset < 0)
  313. return 1;
  314. }
  315. #endif
  316. debug("## Checking for 'FDT'/'FDT Image' at %08lx\n",
  317. fdt_addr);
  318. /*
  319. * Check if there is an FDT image at the
  320. * address provided in the second bootm argument
  321. * check image type, for FIT images get a FIT node.
  322. */
  323. buf = map_sysmem(fdt_addr, 0);
  324. switch (genimg_get_format(buf)) {
  325. #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
  326. case IMAGE_FORMAT_LEGACY:
  327. /* verify fdt_addr points to a valid image header */
  328. printf("## Flattened Device Tree from Legacy Image at %08lx\n",
  329. fdt_addr);
  330. fdt_hdr = image_get_fdt(fdt_addr);
  331. if (!fdt_hdr)
  332. goto no_fdt;
  333. /*
  334. * move image data to the load address,
  335. * make sure we don't overwrite initial image
  336. */
  337. image_start = (ulong)fdt_hdr;
  338. image_data = (ulong)image_get_data(fdt_hdr);
  339. image_end = image_get_image_end(fdt_hdr);
  340. load = image_get_load(fdt_hdr);
  341. load_end = load + image_get_data_size(fdt_hdr);
  342. if (load == image_start ||
  343. load == image_data) {
  344. fdt_addr = load;
  345. break;
  346. }
  347. if ((load < image_end) && (load_end > image_start)) {
  348. fdt_error("fdt overwritten");
  349. goto error;
  350. }
  351. debug(" Loading FDT from 0x%08lx to 0x%08lx\n",
  352. image_data, load);
  353. memmove((void *)load,
  354. (void *)image_data,
  355. image_get_data_size(fdt_hdr));
  356. fdt_addr = load;
  357. break;
  358. #endif
  359. case IMAGE_FORMAT_FIT:
  360. /*
  361. * This case will catch both: new uImage format
  362. * (libfdt based) and raw FDT blob (also libfdt
  363. * based).
  364. */
  365. #if CONFIG_IS_ENABLED(FIT)
  366. /* check FDT blob vs FIT blob */
  367. if (!fit_check_format(buf, IMAGE_SIZE_INVAL)) {
  368. ulong load, len;
  369. fdt_noffset = boot_get_fdt_fit(images,
  370. fdt_addr, &fit_uname_fdt,
  371. &fit_uname_config,
  372. arch, &load, &len);
  373. if (fdt_noffset < 0)
  374. goto error;
  375. images->fit_hdr_fdt = map_sysmem(fdt_addr, 0);
  376. images->fit_uname_fdt = fit_uname_fdt;
  377. images->fit_noffset_fdt = fdt_noffset;
  378. fdt_addr = load;
  379. break;
  380. } else
  381. #endif
  382. {
  383. /*
  384. * FDT blob
  385. */
  386. debug("* fdt: raw FDT blob\n");
  387. printf("## Flattened Device Tree blob at %08lx\n",
  388. (long)fdt_addr);
  389. }
  390. break;
  391. default:
  392. puts("ERROR: Did not find a cmdline Flattened Device Tree\n");
  393. goto error;
  394. }
  395. printf(" Booting using the fdt blob at %#08lx\n", fdt_addr);
  396. fdt_blob = map_sysmem(fdt_addr, 0);
  397. } else if (images->legacy_hdr_valid &&
  398. image_check_type(&images->legacy_hdr_os_copy,
  399. IH_TYPE_MULTI)) {
  400. ulong fdt_data, fdt_len;
  401. /*
  402. * Now check if we have a legacy multi-component image,
  403. * get second entry data start address and len.
  404. */
  405. printf("## Flattened Device Tree from multi component Image at %08lX\n",
  406. (ulong)images->legacy_hdr_os);
  407. image_multi_getimg(images->legacy_hdr_os, 2, &fdt_data,
  408. &fdt_len);
  409. if (fdt_len) {
  410. fdt_blob = (char *)fdt_data;
  411. printf(" Booting using the fdt at 0x%p\n", fdt_blob);
  412. if (fdt_check_header(fdt_blob) != 0) {
  413. fdt_error("image is not a fdt");
  414. goto error;
  415. }
  416. if (fdt_totalsize(fdt_blob) != fdt_len) {
  417. fdt_error("fdt size != image size");
  418. goto error;
  419. }
  420. } else {
  421. debug("## No Flattened Device Tree\n");
  422. goto no_fdt;
  423. }
  424. #ifdef CONFIG_ANDROID_BOOT_IMAGE
  425. } else if (genimg_get_format(buf) == IMAGE_FORMAT_ANDROID) {
  426. struct andr_img_hdr *hdr = buf;
  427. ulong fdt_data, fdt_len;
  428. u32 fdt_size, dtb_idx;
  429. /*
  430. * Firstly check if this android boot image has dtb field.
  431. */
  432. dtb_idx = (u32)env_get_ulong("adtb_idx", 10, 0);
  433. if (android_image_get_dtb_by_index((ulong)hdr, dtb_idx, &fdt_addr, &fdt_size)) {
  434. fdt_blob = (char *)map_sysmem(fdt_addr, 0);
  435. if (fdt_check_header(fdt_blob))
  436. goto no_fdt;
  437. debug("## Using FDT in Android image dtb area with idx %u\n", dtb_idx);
  438. } else if (!android_image_get_second(hdr, &fdt_data, &fdt_len) &&
  439. !fdt_check_header((char *)fdt_data)) {
  440. fdt_blob = (char *)fdt_data;
  441. if (fdt_totalsize(fdt_blob) != fdt_len)
  442. goto error;
  443. debug("## Using FDT in Android image second area\n");
  444. } else {
  445. fdt_addr = env_get_hex("fdtaddr", 0);
  446. if (!fdt_addr)
  447. goto no_fdt;
  448. fdt_blob = map_sysmem(fdt_addr, 0);
  449. if (fdt_check_header(fdt_blob))
  450. goto no_fdt;
  451. debug("## Using FDT at ${fdtaddr}=Ox%lx\n", fdt_addr);
  452. }
  453. #endif
  454. } else {
  455. debug("## No Flattened Device Tree\n");
  456. goto no_fdt;
  457. }
  458. *of_flat_tree = fdt_blob;
  459. *of_size = fdt_totalsize(fdt_blob);
  460. debug(" of_flat_tree at 0x%08lx size 0x%08lx\n",
  461. (ulong)*of_flat_tree, *of_size);
  462. return 0;
  463. no_fdt:
  464. debug("Continuing to boot without FDT\n");
  465. return 0;
  466. error:
  467. return 1;
  468. }
  469. /*
  470. * Verify the device tree.
  471. *
  472. * This function is called after all device tree fix-ups have been enacted,
  473. * so that the final device tree can be verified. The definition of "verified"
  474. * is up to the specific implementation. However, it generally means that the
  475. * addresses of some of the devices in the device tree are compared with the
  476. * actual addresses at which U-Boot has placed them.
  477. *
  478. * Returns 1 on success, 0 on failure. If 0 is returned, U-Boot will halt the
  479. * boot process.
  480. */
  481. __weak int ft_verify_fdt(void *fdt)
  482. {
  483. return 1;
  484. }
  485. __weak int arch_fixup_fdt(void *blob)
  486. {
  487. return 0;
  488. }
  489. int image_setup_libfdt(bootm_headers_t *images, void *blob,
  490. int of_size, struct lmb *lmb)
  491. {
  492. ulong *initrd_start = &images->initrd_start;
  493. ulong *initrd_end = &images->initrd_end;
  494. int ret = -EPERM;
  495. int fdt_ret;
  496. if (fdt_root(blob) < 0) {
  497. printf("ERROR: root node setup failed\n");
  498. goto err;
  499. }
  500. if (fdt_chosen(blob) < 0) {
  501. printf("ERROR: /chosen node create failed\n");
  502. goto err;
  503. }
  504. if (arch_fixup_fdt(blob) < 0) {
  505. printf("ERROR: arch-specific fdt fixup failed\n");
  506. goto err;
  507. }
  508. fdt_ret = optee_copy_fdt_nodes(blob);
  509. if (fdt_ret) {
  510. printf("ERROR: transfer of optee nodes to new fdt failed: %s\n",
  511. fdt_strerror(fdt_ret));
  512. goto err;
  513. }
  514. /* Update ethernet nodes */
  515. fdt_fixup_ethernet(blob);
  516. #if CONFIG_IS_ENABLED(CMD_PSTORE)
  517. /* Append PStore configuration */
  518. fdt_fixup_pstore(blob);
  519. #endif
  520. if (IMAGE_OF_BOARD_SETUP) {
  521. const char *skip_board_fixup;
  522. skip_board_fixup = env_get("skip_board_fixup");
  523. if (skip_board_fixup && ((int)simple_strtol(skip_board_fixup, NULL, 10) == 1)) {
  524. printf("skip board fdt fixup\n");
  525. } else {
  526. fdt_ret = ft_board_setup(blob, gd->bd);
  527. if (fdt_ret) {
  528. printf("ERROR: board-specific fdt fixup failed: %s\n",
  529. fdt_strerror(fdt_ret));
  530. goto err;
  531. }
  532. }
  533. }
  534. if (IMAGE_OF_SYSTEM_SETUP) {
  535. fdt_ret = ft_system_setup(blob, gd->bd);
  536. if (fdt_ret) {
  537. printf("ERROR: system-specific fdt fixup failed: %s\n",
  538. fdt_strerror(fdt_ret));
  539. goto err;
  540. }
  541. }
  542. /* Delete the old LMB reservation */
  543. if (lmb)
  544. lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
  545. (phys_size_t)fdt_totalsize(blob));
  546. ret = fdt_shrink_to_minimum(blob, 0);
  547. if (ret < 0)
  548. goto err;
  549. of_size = ret;
  550. if (*initrd_start && *initrd_end) {
  551. of_size += FDT_RAMDISK_OVERHEAD;
  552. fdt_set_totalsize(blob, of_size);
  553. }
  554. /* Create a new LMB reservation */
  555. if (lmb)
  556. lmb_reserve(lmb, (ulong)blob, of_size);
  557. fdt_initrd(blob, *initrd_start, *initrd_end);
  558. if (!ft_verify_fdt(blob))
  559. goto err;
  560. #if defined(CONFIG_SOC_KEYSTONE)
  561. if (IMAGE_OF_BOARD_SETUP)
  562. ft_board_setup_ex(blob, gd->bd);
  563. #endif
  564. return 0;
  565. err:
  566. printf(" - must RESET the board to recover.\n\n");
  567. return ret;
  568. }