Lines Matching full:fcb

239 	struct mx28_nand_fcb *fcb;  in mx28_nand_get_fcb()  local
246 fcb = malloc(nand_writesize); in mx28_nand_get_fcb()
247 if (!fcb) { in mx28_nand_get_fcb()
248 printf("MX28 NAND: Unable to allocate FCB\n"); in mx28_nand_get_fcb()
252 memset(fcb, 0, nand_writesize); in mx28_nand_get_fcb()
254 fcb->fingerprint = 0x20424346; in mx28_nand_get_fcb()
255 fcb->version = 0x01000000; in mx28_nand_get_fcb()
261 fcb->timing.data_setup = 80; in mx28_nand_get_fcb()
262 fcb->timing.data_hold = 60; in mx28_nand_get_fcb()
263 fcb->timing.address_setup = 25; in mx28_nand_get_fcb()
264 fcb->timing.dsample_time = 6; in mx28_nand_get_fcb()
266 fcb->page_data_size = nand_writesize; in mx28_nand_get_fcb()
267 fcb->total_page_size = nand_writesize + nand_oobsize; in mx28_nand_get_fcb()
268 fcb->sectors_per_block = nand_erasesize / nand_writesize; in mx28_nand_get_fcb()
270 fcb->num_ecc_blocks_per_page = (nand_writesize / 512) - 1; in mx28_nand_get_fcb()
271 fcb->ecc_block_0_size = 512; in mx28_nand_get_fcb()
272 fcb->ecc_block_n_size = 512; in mx28_nand_get_fcb()
273 fcb->metadata_bytes = 10; in mx28_nand_get_fcb()
274 fcb->ecc_block_n_ecc_type = mx28_nand_get_ecc_strength( in mx28_nand_get_fcb()
276 fcb->ecc_block_0_ecc_type = mx28_nand_get_ecc_strength( in mx28_nand_get_fcb()
278 if (fcb->ecc_block_n_ecc_type == 0) { in mx28_nand_get_fcb()
283 fcb->boot_patch = 0; in mx28_nand_get_fcb()
284 fcb->patch_sectors = 0; in mx28_nand_get_fcb()
286 fcb->badblock_marker_byte = mx28_nand_mark_byte_offset(); in mx28_nand_get_fcb()
287 fcb->badblock_marker_start_bit = mx28_nand_mark_bit_offset(); in mx28_nand_get_fcb()
288 fcb->bb_marker_physical_offset = nand_writesize; in mx28_nand_get_fcb()
300 fcb->firmware1_starting_sector = fw1_start_page; in mx28_nand_get_fcb()
301 fcb->firmware2_starting_sector = fw2_start_page; in mx28_nand_get_fcb()
302 fcb->sectors_in_firmware1 = bootstream_size_pages; in mx28_nand_get_fcb()
303 fcb->sectors_in_firmware2 = bootstream_size_pages; in mx28_nand_get_fcb()
305 fcb->dbbt_search_area_start_address = STRIDE_PAGES * STRIDE_COUNT; in mx28_nand_get_fcb()
307 return fcb; in mx28_nand_get_fcb()
310 free(fcb); in mx28_nand_get_fcb()
355 static uint8_t *mx28_nand_fcb_block(struct mx28_nand_fcb *fcb) in mx28_nand_fcb_block() argument
363 printf("MX28 NAND: Unable to allocate FCB block\n"); in mx28_nand_fcb_block()
369 /* Update the FCB checksum */ in mx28_nand_fcb_block()
370 fcb->checksum = mx28_nand_block_csum(((uint8_t *)fcb) + 4, 508); in mx28_nand_fcb_block()
372 /* Figure 12-11. in iMX28RM, rev. 1, says FCB is at offset 12 */ in mx28_nand_fcb_block()
373 memcpy(block + 12, fcb, sizeof(struct mx28_nand_fcb)); in mx28_nand_fcb_block()
385 static int mx28_nand_write_fcb(struct mx28_nand_fcb *fcb, uint8_t *buf) in mx28_nand_write_fcb() argument
392 fcbblock = mx28_nand_fcb_block(fcb); in mx28_nand_write_fcb()
420 static int mx28_nand_write_firmware(struct mx28_nand_fcb *fcb, int infd, in mx28_nand_write_firmware() argument
430 offset1 = fcb->firmware1_starting_sector * nand_writesize; in mx28_nand_write_firmware()
431 offset2 = fcb->firmware2_starting_sector * nand_writesize; in mx28_nand_write_firmware()
467 struct mx28_nand_fcb *fcb; in mx28_create_nand_image() local
484 fcb = mx28_nand_get_fcb(MAX_BOOTSTREAM_SIZE); in mx28_create_nand_image()
485 if (!fcb) { in mx28_create_nand_image()
486 printf("Unable to compile FCB\n"); in mx28_create_nand_image()
496 ret = mx28_nand_write_fcb(fcb, buf); in mx28_create_nand_image()
498 printf("Unable to write FCB to buffer\n"); in mx28_create_nand_image()
508 ret = mx28_nand_write_firmware(fcb, infd, buf); in mx28_create_nand_image()
525 free(fcb); in mx28_create_nand_image()