1 From c70f2ebb350da20af1a0ed4b7960b8e5a1952713 Mon Sep 17 00:00:00 2001
2 From: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
3 Date: Thu, 20 Feb 2014 11:51:31 -0500
4 Subject: [PATCH] board: add to sockit a working preloader design
7 board/altera/socfpga_cyclone5/build.h | 2 +-
8 board/altera/socfpga_cyclone5/iocsr_config.c | 314 ++++++++++-----------
9 board/altera/socfpga_cyclone5/pinmux_config.c | 32 +--
10 board/altera/socfpga_cyclone5/pinmux_config.h | 8 +-
11 board/altera/socfpga_cyclone5/sdram/sdram_config.h | 14 +-
12 .../altera/socfpga_cyclone5/sdram/sequencer_auto.h | 16 +-
13 .../sdram/sequencer_auto_ac_init.c | 16 +-
14 .../socfpga_cyclone5/sdram/sequencer_defines.h | 34 +--
15 8 files changed, 218 insertions(+), 218 deletions(-)
17 diff --git a/board/altera/socfpga_cyclone5/build.h b/board/altera/socfpga_cyclone5/build.h
18 index e5d9c3c..a369015 100644
19 --- a/board/altera/socfpga_cyclone5/build.h
20 +++ b/board/altera/socfpga_cyclone5/build.h
22 * Handoff files must provide user option whether to
23 * enable watchdog during preloader execution phase
25 -#define CONFIG_PRELOADER_WATCHDOG_ENABLE (0)
26 +#define CONFIG_PRELOADER_WATCHDOG_ENABLE (1)
29 * Handoff files must provide user option whether to enable
30 diff --git a/board/altera/socfpga_cyclone5/iocsr_config.c b/board/altera/socfpga_cyclone5/iocsr_config.c
31 index fa663e1..90fc154 100644
32 --- a/board/altera/socfpga_cyclone5/iocsr_config.c
33 +++ b/board/altera/socfpga_cyclone5/iocsr_config.c
34 @@ -7,113 +7,113 @@ const unsigned long iocsr_scan_chain0_table[((CONFIG_HPS_IOCSR_SCANCHAIN0_LENGTH
72 const unsigned long iocsr_scan_chain1_table[((CONFIG_HPS_IOCSR_SCANCHAIN1_LENGTH / 32) + 1)] = {
161 const unsigned long iocsr_scan_chain2_table[((CONFIG_HPS_IOCSR_SCANCHAIN2_LENGTH / 32) + 1)] = {
214 @@ -170,14 +170,14 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
235 @@ -244,15 +244,15 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
257 @@ -273,7 +273,7 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
266 @@ -301,7 +301,7 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
275 @@ -321,15 +321,15 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
295 @@ -347,7 +347,7 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
304 @@ -375,7 +375,7 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
313 @@ -395,15 +395,15 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
334 @@ -421,7 +421,7 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
343 @@ -449,7 +449,7 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
352 @@ -469,15 +469,15 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
372 @@ -495,7 +495,7 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
381 @@ -523,7 +523,7 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
390 @@ -543,15 +543,15 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
410 @@ -567,80 +567,80 @@ const unsigned long iocsr_scan_chain3_table[((CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH
545 diff --git a/board/altera/socfpga_cyclone5/pinmux_config.c b/board/altera/socfpga_cyclone5/pinmux_config.c
546 index 730067e..cfd74cd 100644
547 --- a/board/altera/socfpga_cyclone5/pinmux_config.c
548 +++ b/board/altera/socfpga_cyclone5/pinmux_config.c
549 @@ -23,7 +23,7 @@ unsigned long sys_mgr_init_table[CONFIG_HPS_PINMUX_NUM] = {
558 @@ -34,25 +34,25 @@ unsigned long sys_mgr_init_table[CONFIG_HPS_PINMUX_NUM] = {
562 - 3, /* GENERALIO0 */
563 - 3, /* GENERALIO1 */
564 - 3, /* GENERALIO2 */
565 - 3, /* GENERALIO3 */
566 - 3, /* GENERALIO4 */
567 - 3, /* GENERALIO5 */
568 - 3, /* GENERALIO6 */
569 - 3, /* GENERALIO7 */
570 - 3, /* GENERALIO8 */
571 + 0, /* GENERALIO0 */
572 + 1, /* GENERALIO1 */
573 + 1, /* GENERALIO2 */
574 + 1, /* GENERALIO3 */
575 + 1, /* GENERALIO4 */
576 + 0, /* GENERALIO5 */
577 + 0, /* GENERALIO6 */
578 + 0, /* GENERALIO7 */
579 + 0, /* GENERALIO8 */
584 - 2, /* GENERALIO13 */
585 - 2, /* GENERALIO14 */
586 - 3, /* GENERALIO15 */
587 - 3, /* GENERALIO16 */
588 - 2, /* GENERALIO17 */
589 - 2, /* GENERALIO18 */
590 + 0, /* GENERALIO13 */
591 + 0, /* GENERALIO14 */
592 + 1, /* GENERALIO15 */
593 + 1, /* GENERALIO16 */
594 + 1, /* GENERALIO17 */
595 + 1, /* GENERALIO18 */
599 diff --git a/board/altera/socfpga_cyclone5/pinmux_config.h b/board/altera/socfpga_cyclone5/pinmux_config.h
600 index fb483ab..64c750a 100644
601 --- a/board/altera/socfpga_cyclone5/pinmux_config.h
602 +++ b/board/altera/socfpga_cyclone5/pinmux_config.h
604 #define CONFIG_HPS_UART0 (1)
605 #define CONFIG_HPS_UART1 (0)
606 #define CONFIG_HPS_TRACE (0)
607 -#define CONFIG_HPS_I2C0 (1)
608 -#define CONFIG_HPS_I2C1 (0)
609 +#define CONFIG_HPS_I2C0 (0)
610 +#define CONFIG_HPS_I2C1 (1)
611 #define CONFIG_HPS_I2C2 (0)
612 #define CONFIG_HPS_I2C3 (0)
613 #define CONFIG_HPS_SPIM0 (1)
614 -#define CONFIG_HPS_SPIM1 (0)
615 +#define CONFIG_HPS_SPIM1 (1)
616 #define CONFIG_HPS_SPIS0 (0)
617 #define CONFIG_HPS_SPIS1 (0)
618 -#define CONFIG_HPS_CAN0 (1)
619 +#define CONFIG_HPS_CAN0 (0)
620 #define CONFIG_HPS_CAN1 (0)
622 #define CONFIG_HPS_SDMMC_BUSWIDTH (4)
623 diff --git a/board/altera/socfpga_cyclone5/sdram/sdram_config.h b/board/altera/socfpga_cyclone5/sdram/sdram_config.h
624 index b90d6f3..dd027ef 100755
625 --- a/board/altera/socfpga_cyclone5/sdram/sdram_config.h
626 +++ b/board/altera/socfpga_cyclone5/sdram/sdram_config.h
628 #define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_MEMTYPE (2)
629 #define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_MEMBL (8)
630 #define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_ADDRORDER (0)
631 -#define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_ECCEN (1)
632 -#define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_ECCCORREN (1)
633 +#define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_ECCEN (0)
634 +#define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_ECCCORREN (0)
635 #define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_REORDEREN (1)
636 #define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_STARVELIMIT (10)
637 #define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_DQSTRKEN (0)
638 #define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_NODMPINS (0)
639 -#define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TCWL (6)
640 +#define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TCWL (8)
641 #define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_AL (0)
642 -#define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TCL (7)
643 -#define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TRRD (4)
644 +#define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TCL (11)
645 +#define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TRRD (3)
646 #define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TFAW (12)
647 #define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING1_TRFC (104)
648 #define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING2_IF_TREFI (3120)
650 #define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING2_IF_TRP (6)
651 #define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING2_IF_TWR (6)
652 #define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING2_IF_TWTR (4)
653 -#define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING3_TRTP (4)
654 +#define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING3_TRTP (3)
655 #define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING3_TRAS (14)
656 #define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING3_TRC (20)
657 #define CONFIG_HPS_SDR_CTRLCFG_DRAMTIMING3_TMRD (4)
659 #define CONFIG_HPS_SDR_CTRLCFG_DRAMADDRW_ROWBITS (15)
660 #define CONFIG_HPS_SDR_CTRLCFG_DRAMADDRW_BANKBITS (3)
661 #define CONFIG_HPS_SDR_CTRLCFG_DRAMADDRW_CSBITS (1)
662 -#define CONFIG_HPS_SDR_CTRLCFG_DRAMIFWIDTH_IFWIDTH (40)
663 +#define CONFIG_HPS_SDR_CTRLCFG_DRAMIFWIDTH_IFWIDTH (32)
664 #define CONFIG_HPS_SDR_CTRLCFG_DRAMDEVWIDTH_DEVWIDTH (8)
665 #define CONFIG_HPS_SDR_CTRLCFG_DRAMINTR_INTREN (0)
666 #define CONFIG_HPS_SDR_CTRLCFG_STATICCFG_MEMBL (2)
667 diff --git a/board/altera/socfpga_cyclone5/sdram/sequencer_auto.h b/board/altera/socfpga_cyclone5/sdram/sequencer_auto.h
668 index e8c5484..919676d 100644
669 --- a/board/altera/socfpga_cyclone5/sdram/sequencer_auto.h
670 +++ b/board/altera/socfpga_cyclone5/sdram/sequencer_auto.h
672 #define __RW_MGR_ac_read_en 0x21
673 #define __RW_MGR_ac_mrs3_mirr 0x0C
674 #define __RW_MGR_ac_mrs2 0x05
675 -#define __RW_MGR_CONTENT_ac_mrs1 0x10090044
676 +#define __RW_MGR_CONTENT_ac_mrs1 0x10090006
677 #define __RW_MGR_CONTENT_ac_mrs3 0x100B0000
678 #define __RW_MGR_CONTENT_ac_write_bank_0_col_0_nodata_wl_1 0x18980000
679 #define __RW_MGR_CONTENT_ac_act_1 0x106B0000
681 #define __RW_MGR_CONTENT_ac_init_reset_0_cke_0 0x20700000
682 #define __RW_MGR_CONTENT_ac_read_bank_0_1_norden 0x10580008
683 #define __RW_MGR_CONTENT_ac_pre_all 0x10280400
684 -#define __RW_MGR_CONTENT_ac_mrs0_user 0x10080431
685 -#define __RW_MGR_CONTENT_ac_mrs0_dll_reset 0x10080530
686 +#define __RW_MGR_CONTENT_ac_mrs0_user 0x10080471
687 +#define __RW_MGR_CONTENT_ac_mrs0_dll_reset 0x10080570
688 #define __RW_MGR_CONTENT_ac_read_bank_0_0 0x13580000
689 #define __RW_MGR_CONTENT_ac_write_bank_0_col_1 0x1C980008
690 #define __RW_MGR_CONTENT_ac_read_bank_0_1 0x13580008
692 #define __RW_MGR_CONTENT_ac_write_bank_1_col_1 0x1C9B0008
693 #define __RW_MGR_CONTENT_ac_write_bank_0_col_0 0x1C980000
694 #define __RW_MGR_CONTENT_ac_read_bank_1_0 0x135B0000
695 -#define __RW_MGR_CONTENT_ac_mrs1_mirr 0x100A0024
696 +#define __RW_MGR_CONTENT_ac_mrs1_mirr 0x100A0006
697 #define __RW_MGR_CONTENT_ac_read_bank_1_1 0x135B0008
698 #define __RW_MGR_CONTENT_ac_des_odt_1 0x38780000
699 -#define __RW_MGR_CONTENT_ac_mrs0_dll_reset_mirr 0x100804C8
700 +#define __RW_MGR_CONTENT_ac_mrs0_dll_reset_mirr 0x100804E8
701 #define __RW_MGR_CONTENT_ac_zqcl 0x10380400
702 #define __RW_MGR_CONTENT_ac_write_predata 0x38F80000
703 -#define __RW_MGR_CONTENT_ac_mrs0_user_mirr 0x10080449
704 +#define __RW_MGR_CONTENT_ac_mrs0_user_mirr 0x10080469
705 #define __RW_MGR_CONTENT_ac_ref 0x10480000
706 #define __RW_MGR_CONTENT_ac_nop 0x30780000
707 #define __RW_MGR_CONTENT_ac_rdimm 0x10780000
708 -#define __RW_MGR_CONTENT_ac_mrs2_mirr 0x10090010
709 +#define __RW_MGR_CONTENT_ac_mrs2_mirr 0x10090218
710 #define __RW_MGR_CONTENT_ac_write_bank_0_col_0_nodata 0x18180000
711 #define __RW_MGR_CONTENT_ac_read_en 0x33780000
712 #define __RW_MGR_CONTENT_ac_mrs3_mirr 0x100B0000
713 -#define __RW_MGR_CONTENT_ac_mrs2 0x100A0008
714 +#define __RW_MGR_CONTENT_ac_mrs2 0x100A0218
716 #define __RW_MGR_READ_B2B_WAIT2 0x6A
717 #define __RW_MGR_LFSR_WR_RD_BANK_0_WAIT 0x31
718 diff --git a/board/altera/socfpga_cyclone5/sdram/sequencer_auto_ac_init.c b/board/altera/socfpga_cyclone5/sdram/sequencer_auto_ac_init.c
719 index e16efa1..20b4ca1 100644
720 --- a/board/altera/socfpga_cyclone5/sdram/sequencer_auto_ac_init.c
721 +++ b/board/altera/socfpga_cyclone5/sdram/sequencer_auto_ac_init.c
722 @@ -6,16 +6,16 @@ const alt_u32 ac_rom_init[36] =
747 diff --git a/board/altera/socfpga_cyclone5/sdram/sequencer_defines.h b/board/altera/socfpga_cyclone5/sdram/sequencer_defines.h
748 index 52faf3f..b85b85c 100644
749 --- a/board/altera/socfpga_cyclone5/sdram/sequencer_defines.h
750 +++ b/board/altera/socfpga_cyclone5/sdram/sequencer_defines.h
752 #ifndef _SEQUENCER_DEFINES_H_
753 #define _SEQUENCER_DEFINES_H_
755 -#define AC_ROM_MR1_MIRR 0000000100100
756 +#define AC_ROM_MR1_MIRR 0000000000110
757 #define AC_ROM_MR1_OCD_ENABLE
758 -#define AC_ROM_MR2_MIRR 0000000010000
759 +#define AC_ROM_MR2_MIRR 0001000011000
760 #define AC_ROM_MR3_MIRR 0000000000000
761 #define AC_ROM_MR0_CALIB
762 -#define AC_ROM_MR0_DLL_RESET_MIRR 0010011001000
763 -#define AC_ROM_MR0_DLL_RESET 0010100110000
764 -#define AC_ROM_MR0_MIRR 0010001001001
765 -#define AC_ROM_MR0 0010000110001
766 -#define AC_ROM_MR1 0000001000100
767 -#define AC_ROM_MR2 0000000001000
768 +#define AC_ROM_MR0_DLL_RESET_MIRR 0010011101000
769 +#define AC_ROM_MR0_DLL_RESET 0010101110000
770 +#define AC_ROM_MR0_MIRR 0010001101001
771 +#define AC_ROM_MR0 0010001110001
772 +#define AC_ROM_MR1 0000000000110
773 +#define AC_ROM_MR2 0001000011000
774 #define AC_ROM_MR3 0000000000000
775 #define AFI_CLK_FREQ 401
776 #define AFI_RATE_RATIO 1
779 -#define AVL_CLK_FREQ 67
780 +#define AVL_CLK_FREQ 81
783 #define CALIBRATE_BIT_SLIPS 0
784 -#define CALIB_LFIFO_OFFSET 7
785 -#define CALIB_VFIFO_OFFSET 5
786 +#define CALIB_LFIFO_OFFSET 11
787 +#define CALIB_VFIFO_OFFSET 9
792 #define RW_MGR_MEM_CHIP_SELECT_WIDTH 1
793 #define RW_MGR_MEM_CLK_EN_WIDTH 1
794 #define RW_MGR_MEM_CONTROL_WIDTH 1
795 -#define RW_MGR_MEM_DATA_MASK_WIDTH 5
796 -#define RW_MGR_MEM_DATA_WIDTH 40
797 +#define RW_MGR_MEM_DATA_MASK_WIDTH 4
798 +#define RW_MGR_MEM_DATA_WIDTH 32
799 #define RW_MGR_MEM_DQ_PER_READ_DQS 8
800 #define RW_MGR_MEM_DQ_PER_WRITE_DQS 8
801 -#define RW_MGR_MEM_IF_READ_DQS_WIDTH 5
802 -#define RW_MGR_MEM_IF_WRITE_DQS_WIDTH 5
803 +#define RW_MGR_MEM_IF_READ_DQS_WIDTH 4
804 +#define RW_MGR_MEM_IF_WRITE_DQS_WIDTH 4
805 #define RW_MGR_MEM_NUMBER_OF_CS_PER_DIMM 1
806 #define RW_MGR_MEM_NUMBER_OF_RANKS 1
807 #define RW_MGR_MEM_ODT_WIDTH 1
808 #define RW_MGR_MEM_VIRTUAL_GROUPS_PER_READ_DQS 1
809 #define RW_MGR_MEM_VIRTUAL_GROUPS_PER_WRITE_DQS 1
810 #define RW_MGR_MR0_BL 1
811 -#define RW_MGR_MR0_CAS_LATENCY 3
812 -#define RW_MGR_TRUE_MEM_DATA_MASK_WIDTH 5
813 +#define RW_MGR_MR0_CAS_LATENCY 7
814 +#define RW_MGR_TRUE_MEM_DATA_MASK_WIDTH 4
815 #define RW_MGR_WRITE_TO_DEBUG_READ 1.0
816 #define SKEW_CALIBRATION 0
817 #define STATIC_FULL_CALIBRATION 1