Lines Matching full:fcb

238 	struct mx28_nand_fcb *fcb;  in mx28_nand_get_fcb()  local
245 fcb = malloc(nand_writesize); in mx28_nand_get_fcb()
246 if (!fcb) { in mx28_nand_get_fcb()
247 printf("MX28 NAND: Unable to allocate FCB\n"); in mx28_nand_get_fcb()
251 memset(fcb, 0, nand_writesize); in mx28_nand_get_fcb()
253 fcb->fingerprint = 0x20424346; in mx28_nand_get_fcb()
254 fcb->version = 0x01000000; in mx28_nand_get_fcb()
260 fcb->timing.data_setup = 80; in mx28_nand_get_fcb()
261 fcb->timing.data_hold = 60; in mx28_nand_get_fcb()
262 fcb->timing.address_setup = 25; in mx28_nand_get_fcb()
263 fcb->timing.dsample_time = 6; in mx28_nand_get_fcb()
265 fcb->page_data_size = nand_writesize; in mx28_nand_get_fcb()
266 fcb->total_page_size = nand_writesize + nand_oobsize; in mx28_nand_get_fcb()
267 fcb->sectors_per_block = nand_erasesize / nand_writesize; in mx28_nand_get_fcb()
269 fcb->num_ecc_blocks_per_page = (nand_writesize / 512) - 1; in mx28_nand_get_fcb()
270 fcb->ecc_block_0_size = 512; in mx28_nand_get_fcb()
271 fcb->ecc_block_n_size = 512; in mx28_nand_get_fcb()
272 fcb->metadata_bytes = 10; in mx28_nand_get_fcb()
273 fcb->ecc_block_n_ecc_type = mx28_nand_get_ecc_strength( in mx28_nand_get_fcb()
275 fcb->ecc_block_0_ecc_type = mx28_nand_get_ecc_strength( in mx28_nand_get_fcb()
277 if (fcb->ecc_block_n_ecc_type == 0) { in mx28_nand_get_fcb()
282 fcb->boot_patch = 0; in mx28_nand_get_fcb()
283 fcb->patch_sectors = 0; in mx28_nand_get_fcb()
285 fcb->badblock_marker_byte = mx28_nand_mark_byte_offset(); in mx28_nand_get_fcb()
286 fcb->badblock_marker_start_bit = mx28_nand_mark_bit_offset(); in mx28_nand_get_fcb()
287 fcb->bb_marker_physical_offset = nand_writesize; in mx28_nand_get_fcb()
299 fcb->firmware1_starting_sector = fw1_start_page; in mx28_nand_get_fcb()
300 fcb->firmware2_starting_sector = fw2_start_page; in mx28_nand_get_fcb()
301 fcb->sectors_in_firmware1 = bootstream_size_pages; in mx28_nand_get_fcb()
302 fcb->sectors_in_firmware2 = bootstream_size_pages; in mx28_nand_get_fcb()
304 fcb->dbbt_search_area_start_address = STRIDE_PAGES * STRIDE_COUNT; in mx28_nand_get_fcb()
306 return fcb; in mx28_nand_get_fcb()
309 free(fcb); in mx28_nand_get_fcb()
354 static uint8_t *mx28_nand_fcb_block(struct mx28_nand_fcb *fcb) in mx28_nand_fcb_block() argument
362 printf("MX28 NAND: Unable to allocate FCB block\n"); in mx28_nand_fcb_block()
368 /* Update the FCB checksum */ in mx28_nand_fcb_block()
369 fcb->checksum = mx28_nand_block_csum(((uint8_t *)fcb) + 4, 508); in mx28_nand_fcb_block()
371 /* Figure 12-11. in iMX28RM, rev. 1, says FCB is at offset 12 */ in mx28_nand_fcb_block()
372 memcpy(block + 12, fcb, sizeof(struct mx28_nand_fcb)); in mx28_nand_fcb_block()
384 static int mx28_nand_write_fcb(struct mx28_nand_fcb *fcb, uint8_t *buf) in mx28_nand_write_fcb() argument
391 fcbblock = mx28_nand_fcb_block(fcb); in mx28_nand_write_fcb()
419 static int mx28_nand_write_firmware(struct mx28_nand_fcb *fcb, int infd, in mx28_nand_write_firmware() argument
429 offset1 = fcb->firmware1_starting_sector * nand_writesize; in mx28_nand_write_firmware()
430 offset2 = fcb->firmware2_starting_sector * nand_writesize; in mx28_nand_write_firmware()
466 struct mx28_nand_fcb *fcb; in mx28_create_nand_image() local
483 fcb = mx28_nand_get_fcb(MAX_BOOTSTREAM_SIZE); in mx28_create_nand_image()
484 if (!fcb) { in mx28_create_nand_image()
485 printf("Unable to compile FCB\n"); in mx28_create_nand_image()
495 ret = mx28_nand_write_fcb(fcb, buf); in mx28_create_nand_image()
497 printf("Unable to write FCB to buffer\n"); in mx28_create_nand_image()
507 ret = mx28_nand_write_firmware(fcb, infd, buf); in mx28_create_nand_image()
524 free(fcb); in mx28_create_nand_image()