* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: boot_mcuctl_init_b4wmr.s
* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* For the avoidance of doubt, and except that if any non-GPL license
* choice is available it will apply instead, Sun elects to use only
* the General Public License version 2 (GPLv2) at this time for any
* software where a choice of GPL license versions is made
* available with the language indicating that GPLv2 or any later version
* may be used, or where a choice of which version of the GPL is applied is
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* ========== Copyright Header End ============================================
#define DRAM_REFRESH_FREQ_DATA 0x0000000000000a28
#define RAS2RAS_DIF_BANK_DELAY_DATA 0x0000000000000003
#define RAS2RAS_SAME_BANK_DELAY_DATA 0x0000000000000013
#define RAS2CAS_DELAY_DATA 0x0000000000000004
#define INTREAD2PCHG_DELAY_DATA 0x0000000000000003
#define ACT2PCHG_DELAY_DATA 0x000000000000000f
#define PCHG_CMD_PERIOD_DATA 0x0000000000000004
#define WRI_RECOVERY_PERIOD_DATA 0x0000000000000005
#define ARFSH2ACT_PERIOD_DATA 0x0000000000000019
#define FOUR_ACTIVE_WINDOW_DATA 0x000000000000000d
#define INTWRI2READ_DELAY_DATA 0x0000000000000003
! %l6 contains the base address of CSR space in MCU0
! %g0-%g3 contains the offset for MCU0-MCU3.
setx 0x8400000000, %l7, %l6
sethi %hi(0x00001000), %g1
sethi %hi(0x00002000), %g2
sethi %hi(0x00003000), %g3
mcuctl_init_b4wmr__DRAM_REFRESH_FREQ:
! Set DRAM Refresh Freq. Reg.
mov DRAM_REFRESH_FREQ_DATA ,%l3
! Set RAS to RAS Diff Bank Delay Reg.
mcuctl_init_b4wmr__RAS2RAS_DIF_BANK_DELAY:
mov RAS2RAS_DIF_BANK_DELAY_DATA ,%l3
! Set RAS to RAS Same Bank Delay Reg.
mcuctl_init_b4wmr__RAS2RAS_SAME_BANK_DELAY:
mov RAS2RAS_SAME_BANK_DELAY_DATA ,%l3
! Set RAS to CAS Delay Reg.
mcuctl_init_b4wmr__RAS2CAS_DELAY:
mov RAS2CAS_DELAY_DATA ,%l3
! Set Int. Read to Precharge Delay Reg.
mcuctl_init_b4wmr__INTREAD2PCHG_DELAY:
mov INTREAD2PCHG_DELAY_DATA ,%l3
! Set Active to Precharge Delay Reg.
mcuctl_init_b4wmr__ACT2PCHG_DELAY:
mov ACT2PCHG_DELAY_DATA ,%l3
! Set Precharge Cmd Period Reg.
mcuctl_init_b4wmr__PCHG_CMD_PERIOD:
mov PCHG_CMD_PERIOD_DATA ,%l3
! Set Write Recovery Period Reg.
mcuctl_init_b4wmr__WRI_RECOVERY_PERIOD:
mov WRI_RECOVERY_PERIOD_DATA ,%l3
! Set Auto RFSH to Active Period Reg.
mcuctl_init_b4wmr__ARFSH2ACT_PERIOD:
mov ARFSH2ACT_PERIOD_DATA ,%l3
! Set Four Active Window Reg.
mcuctl_init_b4wmr__FOUR_ACTIVE_WINDOW:
mov FOUR_ACTIVE_WINDOW_DATA ,%l3
! Set Int. Write to Read Delay Reg.
mcuctl_init_b4wmr__INTWRI2READ_DELAY:
mov INTWRI2READ_DELAY_DATA ,%l3
!!moved code from hboot_mcu
setx 0x8400000000, %l7, %l6
sethi %hi(0x00001000), %g1
sethi %hi(0x00002000), %g2
sethi %hi(0x00003000), %g3
add %l6, 0x1a0, %l0 ! DRAM_DIMM_INIT_REG
mov 3, %l3 ! Set CKE enable to 1 to assert CKE high to the DIMMs
stx %l3, [%l0+%g0] ! (per conversation with Rashid)
! Memory Density Type : 256 Mb, 512 Mb, 1 Gb, 2 Gb
#if defined(DIMM_SIZE_1G)
mcuctl_init_b4wmr__DIMM_SIZE_1G:
add %l6, 0x008, %l0 ! DRAM_RAS_ADDR_WIDTH_REG
#if defined(DIMM_SIZE_512)
mcuctl_init_b4wmr__DIMM_SIZE_512:
add %l6, 0x128, %l0 ! 8_BANK_REG
#if defined(DIMM_SIZE_256)
mcuctl_init_b4wmr__DIMM_SIZE_256:
! MEMORY CONFIGURATION SETUP
#define CAS_LATENCY VARY_CAS_LATENCY
mcuctl_init_b4wmr__SNG_CHANNEL:
add %l6, 0x148, %l0 ! SINGLE_CHANNEL_MODE_REG
!! HIGH ADDR / SINGLE RANK
#if !defined(RANK_LOW) && !defined(STACK_DIMM)
mcuctl_init_b4wmr__RANK_HIGH__SINGLE_RANK:
add %l6, 0x140, %l0 ! DRAM_SEL_LO_ADDR_BITS_REG
add %l6, 0x108, %l0 ! DRAM_DIMM_STACK_REG
#if defined(FBDIMMS_1) || defined(FBDIMMS_2) || defined(FBDIMMS_4) || defined(FBDIMMS_8)
add %l6, 0x218, %l0 ! DRAM_DIMM_PRESENT_REG
add %l6, 0x800, %l0 ! FBD_CHANNEL_STATE_REG
#if !defined(RANK_LOW) && defined(STACK_DIMM)
mcuctl_init_b4wmr__RANK_HIGH__STACK_DIMM:
add %l6, 0x140, %l0 ! DRAM_SEL_LO_ADDR_BITS_REG
add %l6, 0x108, %l0 ! DRAM_DIMM_STACK_REG
#if defined(FBDIMMS_1) || defined(FBDIMMS_2) || defined(FBDIMMS_4) || defined(FBDIMMS_8)
add %l6, 0x218, %l0 ! DRAM_DIMM_PRESENT_REG
add %l6, 0x800, %l0 ! FBD_CHANNEL_STATE_REG
!! LOW ADDR / SINGLE RANK
#if defined(RANK_LOW) && !defined(STACK_DIMM)
mcuctl_init_b4wmr__RANK_LOW__SINGLE_RANK:
add %l6, 0x140, %l0 ! DRAM_SEL_LO_ADDR_BITS_REG
add %l6, 0x108, %l0 ! DRAM_DIMM_STACK_REG
#if defined(FBDIMMS_1) || defined(FBDIMMS_2) || defined(FBDIMMS_4) || defined(FBDIMMS_6) || defined(FBDIMMS_8)
add %l6, 0x218, %l0 ! DRAM_DIMM_PRESENT_REG
add %l6, 0x800, %l0 ! FBD_CHANNEL_STATE_REG
#if defined(RANK_LOW) && defined(STACK_DIMM)
mcuctl_init_b4wmr__RANK_LOW__STACK_DIMM:
add %l6, 0x140, %l0 ! DRAM_SEL_LO_ADDR_BITS_REG
add %l6, 0x108, %l0 ! DRAM_DIMM_STACK_REG
#if defined(FBDIMMS_1) || defined(FBDIMMS_2) || defined(FBDIMMS_4) || defined(FBDIMMS_6) || defined(FBDIMMS_8)
add %l6, 0x218, %l0 ! DRAM_DIMM_PRESENT_REG
add %l6, 0x800, %l0 ! FBD_CHANNEL_STATE_REG
mcuctl_init_b4wmr__DRAM_SCRUB_ENABLE:
mcuctl_init_b4wmr__DRAM_SCRUB_FREQ:
!!! Program same values as in mcu_mem_config.v
mcuctl_init_b4wmr__ddr2_533_ras_reg_init:
add %l6, 0x0b0, %l0 ! DRAM_TRAS_REG
! add %l6, 0x0b8, %l0 ! DRAM_TRP_REG - same as POR value
! add %l6, 0x0a8, %l0 ! DRAM_TRTP_REG - same as POR value
mcuctl_init_b4wmr__ddr2_533_rc_reg_init:
add %l6, 0x088, %l0 ! DRAM_TRC_REG
! add %l6, 0x090, %l0 ! DRAM_TRCD_REG - same as POR value
mcuctl_init_b4wmr__ddr2_533_rfc_reg_init:
add %l6, 0x0c8, %l0 ! DRAM_TRFC_REG
mcuctl_init_b4wmr__ddr2_533_wr_reg_init:
add %l6, 0x0c0, %l0 ! DRAM_TWR_REG
mcuctl_init_b4wmr__ddr2_533_iwtr_reg_init:
add %l6, 0x0e0, %l0 ! DRAM_TIWTR_REG
mcuctl_init_b4wmr__ddr2_533_rtw_reg_init:
add %l6, 0x0a0, %l0 ! DRAM_TRTW_REG
mcuctl_init_b4wmr__ddr2_533_rrd_reg_init:
add %l6, 0x080, %l0 ! DRAM_TRRD_REG
mcuctl_init_b4wmr__ddr2_533_faw_reg_init:
add %l6, 0x0d8, %l0 ! missing from mcu_defines.h
#else // end of #ifdef DDR2_533
mcuctl_init_b4wmr__ddr2_667_ras_reg_init:
add %l6, 0x0b0, %l0 ! DRAM_TRAS_REG
mcuctl_init_b4wmr__ddr2_667_rp_reg_init:
add %l6, 0x0b8, %l0 ! DRAM_TRP_REG
mcuctl_init_b4wmr__ddr2_667_rtp_reg_init:
add %l6, 0x0a8, %l0 ! DRAM_TRTP_REG
mcuctl_init_b4wmr__ddr2_667_ref_reg_init:
add %l6, 0x020, %l0 ! DRAM_REFRESH_FREQ_REG
mcuctl_init_b4wmr__ddr2_667_rc_reg_init:
add %l6, 0x088, %l0 ! DRAM_TRC_REG
mcuctl_init_b4wmr__ddr2_667_rcd_reg_init:
add %l6, 0x090, %l0 ! DRAM_TRCD_REG
mcuctl_init_b4wmr__ddr2_667_rfc_reg_init:
add %l6, 0x0c8, %l0 ! DRAM_TRFC_REG
mcuctl_init_b4wmr__ddr2_667_wr_reg_init:
add %l6, 0x0c0, %l0 ! DRAM_TWR_REG
mcuctl_init_b4wmr__ddr2_667_iwtr_reg_init:
add %l6, 0x0e0, %l0 ! DRAM_TIWTR_REG
mcuctl_init_b4wmr__ddr2_667_rtw_reg_init:
add %l6, 0x0a0, %l0 ! DRAM_TRTW_REG
mcuctl_init_b4wmr__ddr2_667_rrd_reg_init:
add %l6, 0x080, %l0 ! DRAM_TRRD_REG
mcuctl_init_b4wmr__ddr2_667_faw_reg_init:
add %l6, 0x0d8, %l0 ! missing from mcu_defines.h
#endif // end of !#ifdef DDR2_533
mcuctl_init_b4wmr__DRAM_CAS_LAT_REG: