OLD | NEW |
1 /** | 1 /** |
2 * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. | 2 * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. |
3 * | 3 * |
4 * See file CREDITS for list of people who contributed to this | 4 * See file CREDITS for list of people who contributed to this |
5 * project. | 5 * project. |
6 * | 6 * |
7 * This program is free software; you can redistribute it and/or | 7 * This program is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU General Public License as | 8 * modify it under the terms of the GNU General Public License as |
9 * published by the Free Software Foundation; either version 2 of | 9 * published by the Free Software Foundation; either version 2 of |
10 * the License, or (at your option) any later version. | 10 * the License, or (at your option) any later version. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #define NV_MAX(a, b) (((a) > (b)) ? (a) : (b)) | 43 #define NV_MAX(a, b) (((a) > (b)) ? (a) : (b)) |
44 | 44 |
45 #define CASE_DEVICE_VALUE(prefix, id) \ | 45 #define CASE_DEVICE_VALUE(prefix, id) \ |
46 case token_##id: \ | 46 case token_##id: \ |
47 (void)context->bctlib.setdev_param(index, \ | 47 (void)context->bctlib.setdev_param(index, \ |
48 nvbct_lib_id_##prefix##_##id, \ | 48 nvbct_lib_id_##prefix##_##id, \ |
49 value, \ | 49 value, \ |
50 context->bct); \ | 50 context->bct); \ |
51 break | 51 break |
52 | 52 |
| 53 #define CASE_SDRAM_VALUE(id) \ |
| 54 case token_##id: \ |
| 55 (void)context->bctlib.set_sdram_params(index, \ |
| 56 nvbct_lib_id_sdram_##id, \ |
| 57 value, \ |
| 58 context->bct); \ |
| 59 break |
| 60 |
53 #define DEFAULT() \ | 61 #define DEFAULT() \ |
54 default: \ | 62 default: \ |
55 printf("Unexpected token %d at line %d\n", \ | 63 printf("Unexpected token %d at line %d\n", \ |
56 token, __LINE__); \ | 64 token, __LINE__); \ |
57 return 1 | 65 return 1 |
58 | 66 |
59 int | 67 int |
60 read_from_image(char *filename, | 68 read_from_image(char *filename, |
61 u_int32_t page_size, | 69 u_int32_t page_size, |
62 u_int8_t **image, | 70 u_int8_t **image, |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 445 |
438 switch (token) { | 446 switch (token) { |
439 CASE_DEVICE_VALUE(spiflash, clock_divider); | 447 CASE_DEVICE_VALUE(spiflash, clock_divider); |
440 CASE_DEVICE_VALUE(spiflash, clock_source); | 448 CASE_DEVICE_VALUE(spiflash, clock_source); |
441 CASE_DEVICE_VALUE(spiflash, read_command_type_fast); | 449 CASE_DEVICE_VALUE(spiflash, read_command_type_fast); |
442 DEFAULT(); | 450 DEFAULT(); |
443 } | 451 } |
444 | 452 |
445 return 0; | 453 return 0; |
446 } | 454 } |
| 455 |
| 456 int |
| 457 set_sdram_param(build_image_context *context, |
| 458 u_int32_t index, |
| 459 parse_token token, |
| 460 u_int32_t value) |
| 461 { |
| 462 u_int32_t num_sdram_sets; |
| 463 |
| 464 assert(context != NULL); |
| 465 assert(context->bct != NULL); |
| 466 |
| 467 // Update the number of SDRAM parameter sets. |
| 468 GET_VALUE(num_sdram_sets, &num_sdram_sets); |
| 469 num_sdram_sets = NV_MAX(num_sdram_sets, index + 1); |
| 470 SET_VALUE(num_sdram_sets, num_sdram_sets); |
| 471 |
| 472 switch (token) { |
| 473 |
| 474 CASE_SDRAM_VALUE(memory_type); |
| 475 CASE_SDRAM_VALUE(pllm_charge_pump_setup_ctrl); |
| 476 CASE_SDRAM_VALUE(pllm_loop_filter_setup_ctrl); |
| 477 CASE_SDRAM_VALUE(pllm_input_divider); |
| 478 CASE_SDRAM_VALUE(pllm_feedback_divider); |
| 479 CASE_SDRAM_VALUE(pllm_post_divider); |
| 480 CASE_SDRAM_VALUE(pllm_stable_time); |
| 481 CASE_SDRAM_VALUE(emc_clock_divider); |
| 482 CASE_SDRAM_VALUE(emc_auto_cal_interval); |
| 483 CASE_SDRAM_VALUE(emc_auto_cal_config); |
| 484 CASE_SDRAM_VALUE(emc_auto_cal_wait); |
| 485 CASE_SDRAM_VALUE(emc_pin_program_wait); |
| 486 CASE_SDRAM_VALUE(emc_rc); |
| 487 CASE_SDRAM_VALUE(emc_rfc); |
| 488 CASE_SDRAM_VALUE(emc_ras); |
| 489 CASE_SDRAM_VALUE(emc_rp); |
| 490 CASE_SDRAM_VALUE(emc_r2w); |
| 491 CASE_SDRAM_VALUE(emc_w2r); |
| 492 CASE_SDRAM_VALUE(emc_r2p); |
| 493 CASE_SDRAM_VALUE(emc_w2p); |
| 494 CASE_SDRAM_VALUE(emc_rd_rcd); |
| 495 CASE_SDRAM_VALUE(emc_wr_rcd); |
| 496 CASE_SDRAM_VALUE(emc_rrd); |
| 497 CASE_SDRAM_VALUE(emc_rext); |
| 498 CASE_SDRAM_VALUE(emc_wdv); |
| 499 CASE_SDRAM_VALUE(emc_quse); |
| 500 CASE_SDRAM_VALUE(emc_qrst); |
| 501 CASE_SDRAM_VALUE(emc_qsafe); |
| 502 CASE_SDRAM_VALUE(emc_rdv); |
| 503 CASE_SDRAM_VALUE(emc_refresh); |
| 504 CASE_SDRAM_VALUE(emc_burst_refresh_num); |
| 505 CASE_SDRAM_VALUE(emc_pdex2wr); |
| 506 CASE_SDRAM_VALUE(emc_pdex2rd); |
| 507 CASE_SDRAM_VALUE(emc_pchg2pden); |
| 508 CASE_SDRAM_VALUE(emc_act2pden); |
| 509 CASE_SDRAM_VALUE(emc_ar2pden); |
| 510 CASE_SDRAM_VALUE(emc_rw2pden); |
| 511 CASE_SDRAM_VALUE(emc_txsr); |
| 512 CASE_SDRAM_VALUE(emc_tcke); |
| 513 CASE_SDRAM_VALUE(emc_tfaw); |
| 514 CASE_SDRAM_VALUE(emc_trpab); |
| 515 CASE_SDRAM_VALUE(emc_tclkstable); |
| 516 CASE_SDRAM_VALUE(emc_tclkstop); |
| 517 CASE_SDRAM_VALUE(emc_trefbw); |
| 518 CASE_SDRAM_VALUE(emc_quse_extra); |
| 519 CASE_SDRAM_VALUE(emc_fbio_cfg1); |
| 520 CASE_SDRAM_VALUE(emc_fbio_dqsib_dly); |
| 521 CASE_SDRAM_VALUE(emc_fbio_dqsib_dly_msb); |
| 522 CASE_SDRAM_VALUE(emc_fbio_quse_dly); |
| 523 CASE_SDRAM_VALUE(emc_fbio_quse_dly_msb); |
| 524 CASE_SDRAM_VALUE(emc_fbio_cfg5); |
| 525 CASE_SDRAM_VALUE(emc_fbio_cfg6); |
| 526 CASE_SDRAM_VALUE(emc_fbio_spare); |
| 527 CASE_SDRAM_VALUE(emc_mrs); |
| 528 CASE_SDRAM_VALUE(emc_emrs); |
| 529 CASE_SDRAM_VALUE(emc_mrw1); |
| 530 CASE_SDRAM_VALUE(emc_mrw2); |
| 531 CASE_SDRAM_VALUE(emc_mrw3); |
| 532 CASE_SDRAM_VALUE(emc_mrw_reset_command); |
| 533 CASE_SDRAM_VALUE(emc_mrw_reset_ninit_wait); |
| 534 CASE_SDRAM_VALUE(emc_adr_cfg); |
| 535 CASE_SDRAM_VALUE(emc_adr_cfg1); |
| 536 CASE_SDRAM_VALUE(mc_emem_Cfg); |
| 537 CASE_SDRAM_VALUE(mc_lowlatency_config); |
| 538 CASE_SDRAM_VALUE(emc_cfg); |
| 539 CASE_SDRAM_VALUE(emc_cfg2); |
| 540 CASE_SDRAM_VALUE(emc_dbg); |
| 541 CASE_SDRAM_VALUE(ahb_arbitration_xbar_ctrl); |
| 542 CASE_SDRAM_VALUE(emc_cfg_dig_dll); |
| 543 CASE_SDRAM_VALUE(emc_dll_xform_dqs); |
| 544 CASE_SDRAM_VALUE(emc_dll_xform_quse); |
| 545 CASE_SDRAM_VALUE(warm_boot_wait); |
| 546 CASE_SDRAM_VALUE(emc_ctt_term_ctrl); |
| 547 CASE_SDRAM_VALUE(emc_odt_write); |
| 548 CASE_SDRAM_VALUE(emc_odt_read); |
| 549 CASE_SDRAM_VALUE(emc_zcal_ref_cnt); |
| 550 CASE_SDRAM_VALUE(emc_zcal_wait_cnt); |
| 551 CASE_SDRAM_VALUE(emc_zcal_mrw_cmd); |
| 552 CASE_SDRAM_VALUE(emc_mrs_reset_dll); |
| 553 CASE_SDRAM_VALUE(emc_mrw_zq_init_dev0); |
| 554 CASE_SDRAM_VALUE(emc_mrw_zq_init_dev1); |
| 555 CASE_SDRAM_VALUE(emc_mrw_zq_init_wait); |
| 556 CASE_SDRAM_VALUE(emc_mrs_reset_dll_wait); |
| 557 CASE_SDRAM_VALUE(emc_emrs_emr2); |
| 558 CASE_SDRAM_VALUE(emc_emrs_emr3); |
| 559 CASE_SDRAM_VALUE(emc_emrs_ddr2_dll_enable); |
| 560 CASE_SDRAM_VALUE(emc_mrs_ddr2_dll_reset); |
| 561 CASE_SDRAM_VALUE(emc_emrs_ddr2_ocd_calib); |
| 562 CASE_SDRAM_VALUE(emc_ddr2_wait); |
| 563 CASE_SDRAM_VALUE(emc_cfg_clktrim0); |
| 564 CASE_SDRAM_VALUE(emc_cfg_clktrim1); |
| 565 CASE_SDRAM_VALUE(emc_cfg_clktrim2); |
| 566 CASE_SDRAM_VALUE(pmc_ddr_pwr); |
| 567 CASE_SDRAM_VALUE(apb_misc_gp_xm2cfga_pad_ctrl); |
| 568 CASE_SDRAM_VALUE(apb_misc_gp_xm2cfgc_pad_ctrl); |
| 569 CASE_SDRAM_VALUE(apb_misc_gp_xm2cfgc_pad_ctrl2); |
| 570 CASE_SDRAM_VALUE(apb_misc_gp_xm2cfgd_pad_ctrl); |
| 571 CASE_SDRAM_VALUE(apb_misc_gp_xm2cfgd_pad_ctrl2); |
| 572 CASE_SDRAM_VALUE(apb_misc_gp_xm2clkcfg_Pad_ctrl); |
| 573 CASE_SDRAM_VALUE(apb_misc_gp_xm2comp_pad_ctrl); |
| 574 CASE_SDRAM_VALUE(apb_misc_gp_xm2vttgen_pad_ctrl); |
| 575 |
| 576 DEFAULT(); |
| 577 } |
| 578 return 0; |
| 579 } |
OLD | NEW |