162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _SPARC64_CHMCTRL_H 362306a36Sopenharmony_ci#define _SPARC64_CHMCTRL_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci/* Cheetah memory controller programmable registers. */ 662306a36Sopenharmony_ci#define CHMCTRL_TCTRL1 0x00 /* Memory Timing Control I */ 762306a36Sopenharmony_ci#define CHMCTRL_TCTRL2 0x08 /* Memory Timing Control II */ 862306a36Sopenharmony_ci#define CHMCTRL_TCTRL3 0x38 /* Memory Timing Control III */ 962306a36Sopenharmony_ci#define CHMCTRL_TCTRL4 0x40 /* Memory Timing Control IV */ 1062306a36Sopenharmony_ci#define CHMCTRL_DECODE1 0x10 /* Memory Address Decode I */ 1162306a36Sopenharmony_ci#define CHMCTRL_DECODE2 0x18 /* Memory Address Decode II */ 1262306a36Sopenharmony_ci#define CHMCTRL_DECODE3 0x20 /* Memory Address Decode III */ 1362306a36Sopenharmony_ci#define CHMCTRL_DECODE4 0x28 /* Memory Address Decode IV */ 1462306a36Sopenharmony_ci#define CHMCTRL_MACTRL 0x30 /* Memory Address Control */ 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* Memory Timing Control I */ 1762306a36Sopenharmony_ci#define TCTRL1_SDRAMCTL_DLY 0xf000000000000000UL 1862306a36Sopenharmony_ci#define TCTRL1_SDRAMCTL_DLY_SHIFT 60 1962306a36Sopenharmony_ci#define TCTRL1_SDRAMCLK_DLY 0x0e00000000000000UL 2062306a36Sopenharmony_ci#define TCTRL1_SDRAMCLK_DLY_SHIFT 57 2162306a36Sopenharmony_ci#define TCTRL1_R 0x0100000000000000UL 2262306a36Sopenharmony_ci#define TCTRL1_R_SHIFT 56 2362306a36Sopenharmony_ci#define TCTRL1_AUTORFR_CYCLE 0x00fe000000000000UL 2462306a36Sopenharmony_ci#define TCTRL1_AUTORFR_CYCLE_SHIFT 49 2562306a36Sopenharmony_ci#define TCTRL1_RD_WAIT 0x0001f00000000000UL 2662306a36Sopenharmony_ci#define TCTRL1_RD_WAIT_SHIFT 44 2762306a36Sopenharmony_ci#define TCTRL1_PC_CYCLE 0x00000fc000000000UL 2862306a36Sopenharmony_ci#define TCTRL1_PC_CYCLE_SHIFT 38 2962306a36Sopenharmony_ci#define TCTRL1_WR_MORE_RAS_PW 0x0000003f00000000UL 3062306a36Sopenharmony_ci#define TCTRL1_WR_MORE_RAS_PW_SHIFT 32 3162306a36Sopenharmony_ci#define TCTRL1_RD_MORE_RAW_PW 0x00000000fc000000UL 3262306a36Sopenharmony_ci#define TCTRL1_RD_MORE_RAS_PW_SHIFT 26 3362306a36Sopenharmony_ci#define TCTRL1_ACT_WR_DLY 0x0000000003f00000UL 3462306a36Sopenharmony_ci#define TCTRL1_ACT_WR_DLY_SHIFT 20 3562306a36Sopenharmony_ci#define TCTRL1_ACT_RD_DLY 0x00000000000fc000UL 3662306a36Sopenharmony_ci#define TCTRL1_ACT_RD_DLY_SHIFT 14 3762306a36Sopenharmony_ci#define TCTRL1_BANK_PRESENT 0x0000000000003000UL 3862306a36Sopenharmony_ci#define TCTRL1_BANK_PRESENT_SHIFT 12 3962306a36Sopenharmony_ci#define TCTRL1_RFR_INT 0x0000000000000ff8UL 4062306a36Sopenharmony_ci#define TCTRL1_RFR_INT_SHIFT 3 4162306a36Sopenharmony_ci#define TCTRL1_SET_MODE_REG 0x0000000000000004UL 4262306a36Sopenharmony_ci#define TCTRL1_SET_MODE_REG_SHIFT 2 4362306a36Sopenharmony_ci#define TCTRL1_RFR_ENABLE 0x0000000000000002UL 4462306a36Sopenharmony_ci#define TCTRL1_RFR_ENABLE_SHIFT 1 4562306a36Sopenharmony_ci#define TCTRL1_PRECHG_ALL 0x0000000000000001UL 4662306a36Sopenharmony_ci#define TCTRL1_PRECHG_ALL_SHIFT 0 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci/* Memory Timing Control II */ 4962306a36Sopenharmony_ci#define TCTRL2_WR_MSEL_DLY 0xfc00000000000000UL 5062306a36Sopenharmony_ci#define TCTRL2_WR_MSEL_DLY_SHIFT 58 5162306a36Sopenharmony_ci#define TCTRL2_RD_MSEL_DLY 0x03f0000000000000UL 5262306a36Sopenharmony_ci#define TCTRL2_RD_MSEL_DLY_SHIFT 52 5362306a36Sopenharmony_ci#define TCTRL2_WRDATA_THLD 0x000c000000000000UL 5462306a36Sopenharmony_ci#define TCTRL2_WRDATA_THLD_SHIFT 50 5562306a36Sopenharmony_ci#define TCTRL2_RDWR_RD_TI_DLY 0x0003f00000000000UL 5662306a36Sopenharmony_ci#define TCTRL2_RDWR_RD_TI_DLY_SHIFT 44 5762306a36Sopenharmony_ci#define TCTRL2_AUTOPRECHG_ENBL 0x0000080000000000UL 5862306a36Sopenharmony_ci#define TCTRL2_AUTOPRECHG_ENBL_SHIFT 43 5962306a36Sopenharmony_ci#define TCTRL2_RDWR_PI_MORE_DLY 0x000007c000000000UL 6062306a36Sopenharmony_ci#define TCTRL2_RDWR_PI_MORE_DLY_SHIFT 38 6162306a36Sopenharmony_ci#define TCTRL2_RDWR_1_DLY 0x0000003f00000000UL 6262306a36Sopenharmony_ci#define TCTRL2_RDWR_1_DLY_SHIFT 32 6362306a36Sopenharmony_ci#define TCTRL2_WRWR_PI_MORE_DLY 0x00000000f8000000UL 6462306a36Sopenharmony_ci#define TCTRL2_WRWR_PI_MORE_DLY_SHIFT 27 6562306a36Sopenharmony_ci#define TCTRL2_WRWR_1_DLY 0x0000000007e00000UL 6662306a36Sopenharmony_ci#define TCTRL2_WRWR_1_DLY_SHIFT 21 6762306a36Sopenharmony_ci#define TCTRL2_RDWR_RD_PI_MORE_DLY 0x00000000001f0000UL 6862306a36Sopenharmony_ci#define TCTRL2_RDWR_RD_PI_MORE_DLY_SHIFT 16 6962306a36Sopenharmony_ci#define TCTRL2_R 0x0000000000008000UL 7062306a36Sopenharmony_ci#define TCTRL2_R_SHIFT 15 7162306a36Sopenharmony_ci#define TCTRL2_SDRAM_MODE_REG_DATA 0x0000000000007fffUL 7262306a36Sopenharmony_ci#define TCTRL2_SDRAM_MODE_REG_DATA_SHIFT 0 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci/* Memory Timing Control III */ 7562306a36Sopenharmony_ci#define TCTRL3_SDRAM_CTL_DLY 0xf000000000000000UL 7662306a36Sopenharmony_ci#define TCTRL3_SDRAM_CTL_DLY_SHIFT 60 7762306a36Sopenharmony_ci#define TCTRL3_SDRAM_CLK_DLY 0x0e00000000000000UL 7862306a36Sopenharmony_ci#define TCTRL3_SDRAM_CLK_DLY_SHIFT 57 7962306a36Sopenharmony_ci#define TCTRL3_R 0x0100000000000000UL 8062306a36Sopenharmony_ci#define TCTRL3_R_SHIFT 56 8162306a36Sopenharmony_ci#define TCTRL3_AUTO_RFR_CYCLE 0x00fe000000000000UL 8262306a36Sopenharmony_ci#define TCTRL3_AUTO_RFR_CYCLE_SHIFT 49 8362306a36Sopenharmony_ci#define TCTRL3_RD_WAIT 0x0001f00000000000UL 8462306a36Sopenharmony_ci#define TCTRL3_RD_WAIT_SHIFT 44 8562306a36Sopenharmony_ci#define TCTRL3_PC_CYCLE 0x00000fc000000000UL 8662306a36Sopenharmony_ci#define TCTRL3_PC_CYCLE_SHIFT 38 8762306a36Sopenharmony_ci#define TCTRL3_WR_MORE_RAW_PW 0x0000003f00000000UL 8862306a36Sopenharmony_ci#define TCTRL3_WR_MORE_RAW_PW_SHIFT 32 8962306a36Sopenharmony_ci#define TCTRL3_RD_MORE_RAW_PW 0x00000000fc000000UL 9062306a36Sopenharmony_ci#define TCTRL3_RD_MORE_RAW_PW_SHIFT 26 9162306a36Sopenharmony_ci#define TCTRL3_ACT_WR_DLY 0x0000000003f00000UL 9262306a36Sopenharmony_ci#define TCTRL3_ACT_WR_DLY_SHIFT 20 9362306a36Sopenharmony_ci#define TCTRL3_ACT_RD_DLY 0x00000000000fc000UL 9462306a36Sopenharmony_ci#define TCTRL3_ACT_RD_DLY_SHIFT 14 9562306a36Sopenharmony_ci#define TCTRL3_BANK_PRESENT 0x0000000000003000UL 9662306a36Sopenharmony_ci#define TCTRL3_BANK_PRESENT_SHIFT 12 9762306a36Sopenharmony_ci#define TCTRL3_RFR_INT 0x0000000000000ff8UL 9862306a36Sopenharmony_ci#define TCTRL3_RFR_INT_SHIFT 3 9962306a36Sopenharmony_ci#define TCTRL3_SET_MODE_REG 0x0000000000000004UL 10062306a36Sopenharmony_ci#define TCTRL3_SET_MODE_REG_SHIFT 2 10162306a36Sopenharmony_ci#define TCTRL3_RFR_ENABLE 0x0000000000000002UL 10262306a36Sopenharmony_ci#define TCTRL3_RFR_ENABLE_SHIFT 1 10362306a36Sopenharmony_ci#define TCTRL3_PRECHG_ALL 0x0000000000000001UL 10462306a36Sopenharmony_ci#define TCTRL3_PRECHG_ALL_SHIFT 0 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci/* Memory Timing Control IV */ 10762306a36Sopenharmony_ci#define TCTRL4_WR_MSEL_DLY 0xfc00000000000000UL 10862306a36Sopenharmony_ci#define TCTRL4_WR_MSEL_DLY_SHIFT 58 10962306a36Sopenharmony_ci#define TCTRL4_RD_MSEL_DLY 0x03f0000000000000UL 11062306a36Sopenharmony_ci#define TCTRL4_RD_MSEL_DLY_SHIFT 52 11162306a36Sopenharmony_ci#define TCTRL4_WRDATA_THLD 0x000c000000000000UL 11262306a36Sopenharmony_ci#define TCTRL4_WRDATA_THLD_SHIFT 50 11362306a36Sopenharmony_ci#define TCTRL4_RDWR_RD_RI_DLY 0x0003f00000000000UL 11462306a36Sopenharmony_ci#define TCTRL4_RDWR_RD_RI_DLY_SHIFT 44 11562306a36Sopenharmony_ci#define TCTRL4_AUTO_PRECHG_ENBL 0x0000080000000000UL 11662306a36Sopenharmony_ci#define TCTRL4_AUTO_PRECHG_ENBL_SHIFT 43 11762306a36Sopenharmony_ci#define TCTRL4_RD_WR_PI_MORE_DLY 0x000007c000000000UL 11862306a36Sopenharmony_ci#define TCTRL4_RD_WR_PI_MORE_DLY_SHIFT 38 11962306a36Sopenharmony_ci#define TCTRL4_RD_WR_TI_DLY 0x0000003f00000000UL 12062306a36Sopenharmony_ci#define TCTRL4_RD_WR_TI_DLY_SHIFT 32 12162306a36Sopenharmony_ci#define TCTRL4_WR_WR_PI_MORE_DLY 0x00000000f8000000UL 12262306a36Sopenharmony_ci#define TCTRL4_WR_WR_PI_MORE_DLY_SHIFT 27 12362306a36Sopenharmony_ci#define TCTRL4_WR_WR_TI_DLY 0x0000000007e00000UL 12462306a36Sopenharmony_ci#define TCTRL4_WR_WR_TI_DLY_SHIFT 21 12562306a36Sopenharmony_ci#define TCTRL4_RDWR_RD_PI_MORE_DLY 0x00000000001f000UL0 12662306a36Sopenharmony_ci#define TCTRL4_RDWR_RD_PI_MORE_DLY_SHIFT 16 12762306a36Sopenharmony_ci#define TCTRL4_R 0x0000000000008000UL 12862306a36Sopenharmony_ci#define TCTRL4_R_SHIFT 15 12962306a36Sopenharmony_ci#define TCTRL4_SDRAM_MODE_REG_DATA 0x0000000000007fffUL 13062306a36Sopenharmony_ci#define TCTRL4_SDRAM_MODE_REG_DATA_SHIFT 0 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci/* All 4 memory address decoding registers have the 13362306a36Sopenharmony_ci * same layout. 13462306a36Sopenharmony_ci */ 13562306a36Sopenharmony_ci#define MEM_DECODE_VALID 0x8000000000000000UL /* Valid */ 13662306a36Sopenharmony_ci#define MEM_DECODE_VALID_SHIFT 63 13762306a36Sopenharmony_ci#define MEM_DECODE_UK 0x001ffe0000000000UL /* Upper mask */ 13862306a36Sopenharmony_ci#define MEM_DECODE_UK_SHIFT 41 13962306a36Sopenharmony_ci#define MEM_DECODE_UM 0x0000001ffff00000UL /* Upper match */ 14062306a36Sopenharmony_ci#define MEM_DECODE_UM_SHIFT 20 14162306a36Sopenharmony_ci#define MEM_DECODE_LK 0x000000000003c000UL /* Lower mask */ 14262306a36Sopenharmony_ci#define MEM_DECODE_LK_SHIFT 14 14362306a36Sopenharmony_ci#define MEM_DECODE_LM 0x0000000000000f00UL /* Lower match */ 14462306a36Sopenharmony_ci#define MEM_DECODE_LM_SHIFT 8 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci#define PA_UPPER_BITS 0x000007fffc000000UL 14762306a36Sopenharmony_ci#define PA_UPPER_BITS_SHIFT 26 14862306a36Sopenharmony_ci#define PA_LOWER_BITS 0x00000000000003c0UL 14962306a36Sopenharmony_ci#define PA_LOWER_BITS_SHIFT 6 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci#define MACTRL_R0 0x8000000000000000UL 15262306a36Sopenharmony_ci#define MACTRL_R0_SHIFT 63 15362306a36Sopenharmony_ci#define MACTRL_ADDR_LE_PW 0x7000000000000000UL 15462306a36Sopenharmony_ci#define MACTRL_ADDR_LE_PW_SHIFT 60 15562306a36Sopenharmony_ci#define MACTRL_CMD_PW 0x0f00000000000000UL 15662306a36Sopenharmony_ci#define MACTRL_CMD_PW_SHIFT 56 15762306a36Sopenharmony_ci#define MACTRL_HALF_MODE_WR_MSEL_DLY 0x00fc000000000000UL 15862306a36Sopenharmony_ci#define MACTRL_HALF_MODE_WR_MSEL_DLY_SHIFT 50 15962306a36Sopenharmony_ci#define MACTRL_HALF_MODE_RD_MSEL_DLY 0x0003f00000000000UL 16062306a36Sopenharmony_ci#define MACTRL_HALF_MODE_RD_MSEL_DLY_SHIFT 44 16162306a36Sopenharmony_ci#define MACTRL_HALF_MODE_SDRAM_CTL_DLY 0x00000f0000000000UL 16262306a36Sopenharmony_ci#define MACTRL_HALF_MODE_SDRAM_CTL_DLY_SHIFT 40 16362306a36Sopenharmony_ci#define MACTRL_HALF_MODE_SDRAM_CLK_DLY 0x000000e000000000UL 16462306a36Sopenharmony_ci#define MACTRL_HALF_MODE_SDRAM_CLK_DLY_SHIFT 37 16562306a36Sopenharmony_ci#define MACTRL_R1 0x0000001000000000UL 16662306a36Sopenharmony_ci#define MACTRL_R1_SHIFT 36 16762306a36Sopenharmony_ci#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3 0x0000000f00000000UL 16862306a36Sopenharmony_ci#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3_SHIFT 32 16962306a36Sopenharmony_ci#define MACTRL_ENC_INTLV_B3 0x00000000f8000000UL 17062306a36Sopenharmony_ci#define MACTRL_ENC_INTLV_B3_SHIFT 27 17162306a36Sopenharmony_ci#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2 0x0000000007800000UL 17262306a36Sopenharmony_ci#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2_SHIFT 23 17362306a36Sopenharmony_ci#define MACTRL_ENC_INTLV_B2 0x00000000007c0000UL 17462306a36Sopenharmony_ci#define MACTRL_ENC_INTLV_B2_SHIFT 18 17562306a36Sopenharmony_ci#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1 0x000000000003c000UL 17662306a36Sopenharmony_ci#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1_SHIFT 14 17762306a36Sopenharmony_ci#define MACTRL_ENC_INTLV_B1 0x0000000000003e00UL 17862306a36Sopenharmony_ci#define MACTRL_ENC_INTLV_B1_SHIFT 9 17962306a36Sopenharmony_ci#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0 0x00000000000001e0UL 18062306a36Sopenharmony_ci#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0_SHIFT 5 18162306a36Sopenharmony_ci#define MACTRL_ENC_INTLV_B0 0x000000000000001fUL 18262306a36Sopenharmony_ci#define MACTRL_ENC_INTLV_B0_SHIFT 0 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci#endif /* _SPARC64_CHMCTRL_H */ 185