1*77b55e8cSThomas Abraham /* 2*77b55e8cSThomas Abraham * Machine Specific Values for SMDK5250 board based on EXYNOS5 3*77b55e8cSThomas Abraham * 4*77b55e8cSThomas Abraham * Copyright (C) 2012 Samsung Electronics 5*77b55e8cSThomas Abraham * 6*77b55e8cSThomas Abraham * SPDX-License-Identifier: GPL-2.0+ 7*77b55e8cSThomas Abraham */ 8*77b55e8cSThomas Abraham 9*77b55e8cSThomas Abraham #ifndef _SMDK5250_SETUP_H 10*77b55e8cSThomas Abraham #define _SMDK5250_SETUP_H 11*77b55e8cSThomas Abraham 12*77b55e8cSThomas Abraham #include <config.h> 13*77b55e8cSThomas Abraham #include <asm/arch/dmc.h> 14*77b55e8cSThomas Abraham 15*77b55e8cSThomas Abraham #define NOT_AVAILABLE 0 16*77b55e8cSThomas Abraham #define DATA_MASK 0xFFFFF 17*77b55e8cSThomas Abraham 18*77b55e8cSThomas Abraham #define ENABLE_BIT 0x1 19*77b55e8cSThomas Abraham #define DISABLE_BIT 0x0 20*77b55e8cSThomas Abraham #define CA_SWAP_EN (1 << 0) 21*77b55e8cSThomas Abraham 22*77b55e8cSThomas Abraham /* Set PLL */ 23*77b55e8cSThomas Abraham #define set_pll(mdiv, pdiv, sdiv) (1<<31 | mdiv<<16 | pdiv<<8 | sdiv) 24*77b55e8cSThomas Abraham 25*77b55e8cSThomas Abraham /* MEMCONTROL register bit fields */ 26*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_CLK_STOP_DISABLE (0 << 0) 27*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_DPWRDN_DISABLE (0 << 1) 28*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_DPWRDN_ACTIVE_PRECHARGE (0 << 2) 29*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_TP_DISABLE (0 << 4) 30*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_DSREF_DISABLE (0 << 5) 31*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_DSREF_ENABLE (1 << 5) 32*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_ADD_LAT_PALL_CYCLE(x) (x << 6) 33*77b55e8cSThomas Abraham 34*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_MEM_TYPE_LPDDR3 (7 << 8) 35*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_MEM_TYPE_DDR3 (6 << 8) 36*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_MEM_TYPE_LPDDR2 (5 << 8) 37*77b55e8cSThomas Abraham 38*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_MEM_WIDTH_32BIT (2 << 12) 39*77b55e8cSThomas Abraham 40*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_NUM_CHIP_1 (0 << 16) 41*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_NUM_CHIP_2 (1 << 16) 42*77b55e8cSThomas Abraham 43*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_BL_8 (3 << 20) 44*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_BL_4 (2 << 20) 45*77b55e8cSThomas Abraham 46*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_PZQ_DISABLE (0 << 24) 47*77b55e8cSThomas Abraham 48*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_MRR_BYTE_7_0 (0 << 25) 49*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_MRR_BYTE_15_8 (1 << 25) 50*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_MRR_BYTE_23_16 (2 << 25) 51*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_MRR_BYTE_31_24 (3 << 25) 52*77b55e8cSThomas Abraham 53*77b55e8cSThomas Abraham /* MEMCONFIG0 register bit fields */ 54*77b55e8cSThomas Abraham #define DMC_MEMCONFIGX_CHIP_MAP_INTERLEAVED (1 << 12) 55*77b55e8cSThomas Abraham #define DMC_MEMCONFIG_CHIP_MAP_SPLIT (2 << 12) 56*77b55e8cSThomas Abraham #define DMC_MEMCONFIGX_CHIP_COL_10 (3 << 8) 57*77b55e8cSThomas Abraham #define DMC_MEMCONFIGX_CHIP_ROW_14 (2 << 4) 58*77b55e8cSThomas Abraham #define DMC_MEMCONFIGX_CHIP_ROW_15 (3 << 4) 59*77b55e8cSThomas Abraham #define DMC_MEMCONFIGX_CHIP_BANK_8 (3 << 0) 60*77b55e8cSThomas Abraham 61*77b55e8cSThomas Abraham #define DMC_MEMBASECONFIGX_CHIP_BASE(x) (x << 16) 62*77b55e8cSThomas Abraham #define DMC_MEMBASECONFIGX_CHIP_MASK(x) (x << 0) 63*77b55e8cSThomas Abraham #define DMC_MEMBASECONFIG_VAL(x) ( \ 64*77b55e8cSThomas Abraham DMC_MEMBASECONFIGX_CHIP_BASE(x) | \ 65*77b55e8cSThomas Abraham DMC_MEMBASECONFIGX_CHIP_MASK(0x780) \ 66*77b55e8cSThomas Abraham ) 67*77b55e8cSThomas Abraham 68*77b55e8cSThomas Abraham /* 69*77b55e8cSThomas Abraham * As we use channel interleaving, therefore value of the base address 70*77b55e8cSThomas Abraham * register must be set as half of the bus base address 71*77b55e8cSThomas Abraham * RAM start addess is 0x2000_0000 which means chip_base is 0x20, so 72*77b55e8cSThomas Abraham * we need to set half 0x10 to the membaseconfigx registers 73*77b55e8cSThomas Abraham * see exynos5420 UM section 17.17.3.21 for more. 74*77b55e8cSThomas Abraham */ 75*77b55e8cSThomas Abraham #define DMC_CHIP_BASE_0 0x10 76*77b55e8cSThomas Abraham #define DMC_CHIP_BASE_1 0x50 77*77b55e8cSThomas Abraham #define DMC_CHIP_MASK 0x7C0 78*77b55e8cSThomas Abraham 79*77b55e8cSThomas Abraham #define DMC_MEMBASECONFIG0_VAL DMC_MEMBASECONFIG_VAL(0x40) 80*77b55e8cSThomas Abraham #define DMC_MEMBASECONFIG1_VAL DMC_MEMBASECONFIG_VAL(0x80) 81*77b55e8cSThomas Abraham 82*77b55e8cSThomas Abraham #define DMC_PRECHCONFIG_VAL 0xFF000000 83*77b55e8cSThomas Abraham #define DMC_PWRDNCONFIG_VAL 0xFFFF00FF 84*77b55e8cSThomas Abraham 85*77b55e8cSThomas Abraham #define DMC_CONCONTROL_RESET_VAL 0x0FFF0000 86*77b55e8cSThomas Abraham #define DFI_INIT_START (1 << 28) 87*77b55e8cSThomas Abraham #define EMPTY (1 << 8) 88*77b55e8cSThomas Abraham #define AREF_EN (1 << 5) 89*77b55e8cSThomas Abraham 90*77b55e8cSThomas Abraham #define DFI_INIT_COMPLETE_CHO (1 << 2) 91*77b55e8cSThomas Abraham #define DFI_INIT_COMPLETE_CH1 (1 << 3) 92*77b55e8cSThomas Abraham 93*77b55e8cSThomas Abraham #define RDLVL_COMPLETE_CHO (1 << 14) 94*77b55e8cSThomas Abraham #define RDLVL_COMPLETE_CH1 (1 << 15) 95*77b55e8cSThomas Abraham 96*77b55e8cSThomas Abraham #define CLK_STOP_EN (1 << 0) 97*77b55e8cSThomas Abraham #define DPWRDN_EN (1 << 1) 98*77b55e8cSThomas Abraham #define DSREF_EN (1 << 5) 99*77b55e8cSThomas Abraham 100*77b55e8cSThomas Abraham /* COJCONTROL register bit fields */ 101*77b55e8cSThomas Abraham #define DMC_CONCONTROL_IO_PD_CON_DISABLE (0 << 3) 102*77b55e8cSThomas Abraham #define DMC_CONCONTROL_IO_PD_CON_ENABLE (1 << 3) 103*77b55e8cSThomas Abraham #define DMC_CONCONTROL_AREF_EN_DISABLE (0 << 5) 104*77b55e8cSThomas Abraham #define DMC_CONCONTROL_AREF_EN_ENABLE (1 << 5) 105*77b55e8cSThomas Abraham #define DMC_CONCONTROL_EMPTY_DISABLE (0 << 8) 106*77b55e8cSThomas Abraham #define DMC_CONCONTROL_EMPTY_ENABLE (1 << 8) 107*77b55e8cSThomas Abraham #define DMC_CONCONTROL_RD_FETCH_DISABLE (0x0 << 12) 108*77b55e8cSThomas Abraham #define DMC_CONCONTROL_TIMEOUT_LEVEL0 (0xFFF << 16) 109*77b55e8cSThomas Abraham #define DMC_CONCONTROL_DFI_INIT_START_DISABLE (0 << 28) 110*77b55e8cSThomas Abraham 111*77b55e8cSThomas Abraham #define DMC_CONCONTROL_VAL 0x1FFF2101 112*77b55e8cSThomas Abraham 113*77b55e8cSThomas Abraham #define DREX_CONCONTROL_VAL DMC_CONCONTROL_VAL \ 114*77b55e8cSThomas Abraham | DMC_CONCONTROL_AREF_EN_ENABLE \ 115*77b55e8cSThomas Abraham | DMC_CONCONTROL_IO_PD_CON_ENABLE 116*77b55e8cSThomas Abraham 117*77b55e8cSThomas Abraham #define DMC_CONCONTROL_IO_PD_CON(x) (x << 6) 118*77b55e8cSThomas Abraham 119*77b55e8cSThomas Abraham /* CLK_DIV_CPU1 */ 120*77b55e8cSThomas Abraham #define HPM_RATIO 0x2 121*77b55e8cSThomas Abraham #define COPY_RATIO 0x0 122*77b55e8cSThomas Abraham 123*77b55e8cSThomas Abraham /* CLK_DIV_CPU1 = 0x00000003 */ 124*77b55e8cSThomas Abraham #define CLK_DIV_CPU1_VAL ((HPM_RATIO << 4) \ 125*77b55e8cSThomas Abraham | (COPY_RATIO)) 126*77b55e8cSThomas Abraham 127*77b55e8cSThomas Abraham /* CLK_SRC_CORE0 */ 128*77b55e8cSThomas Abraham #define CLK_SRC_CORE0_VAL 0x00000000 129*77b55e8cSThomas Abraham 130*77b55e8cSThomas Abraham /* CLK_SRC_CORE1 */ 131*77b55e8cSThomas Abraham #define CLK_SRC_CORE1_VAL 0x100 132*77b55e8cSThomas Abraham 133*77b55e8cSThomas Abraham /* CLK_DIV_CORE0 */ 134*77b55e8cSThomas Abraham #define CLK_DIV_CORE0_VAL 0x00120000 135*77b55e8cSThomas Abraham 136*77b55e8cSThomas Abraham /* CLK_DIV_CORE1 */ 137*77b55e8cSThomas Abraham #define CLK_DIV_CORE1_VAL 0x07070700 138*77b55e8cSThomas Abraham 139*77b55e8cSThomas Abraham /* CLK_DIV_SYSRGT */ 140*77b55e8cSThomas Abraham #define CLK_DIV_SYSRGT_VAL 0x00000111 141*77b55e8cSThomas Abraham 142*77b55e8cSThomas Abraham /* CLK_DIV_ACP */ 143*77b55e8cSThomas Abraham #define CLK_DIV_ACP_VAL 0x12 144*77b55e8cSThomas Abraham 145*77b55e8cSThomas Abraham /* CLK_DIV_SYSLFT */ 146*77b55e8cSThomas Abraham #define CLK_DIV_SYSLFT_VAL 0x00000311 147*77b55e8cSThomas Abraham 148*77b55e8cSThomas Abraham #define MUX_APLL_SEL_MASK (1 << 0) 149*77b55e8cSThomas Abraham #define MUX_MPLL_SEL_MASK (1 << 8) 150*77b55e8cSThomas Abraham #define MPLL_SEL_MOUT_MPLLFOUT (2 << 8) 151*77b55e8cSThomas Abraham #define MUX_CPLL_SEL_MASK (1 << 8) 152*77b55e8cSThomas Abraham #define MUX_EPLL_SEL_MASK (1 << 12) 153*77b55e8cSThomas Abraham #define MUX_VPLL_SEL_MASK (1 << 16) 154*77b55e8cSThomas Abraham #define MUX_GPLL_SEL_MASK (1 << 28) 155*77b55e8cSThomas Abraham #define MUX_BPLL_SEL_MASK (1 << 0) 156*77b55e8cSThomas Abraham #define MUX_HPM_SEL_MASK (1 << 20) 157*77b55e8cSThomas Abraham #define HPM_SEL_SCLK_MPLL (1 << 21) 158*77b55e8cSThomas Abraham #define PLL_LOCKED (1 << 29) 159*77b55e8cSThomas Abraham #define APLL_CON0_LOCKED (1 << 29) 160*77b55e8cSThomas Abraham #define MPLL_CON0_LOCKED (1 << 29) 161*77b55e8cSThomas Abraham #define BPLL_CON0_LOCKED (1 << 29) 162*77b55e8cSThomas Abraham #define CPLL_CON0_LOCKED (1 << 29) 163*77b55e8cSThomas Abraham #define EPLL_CON0_LOCKED (1 << 29) 164*77b55e8cSThomas Abraham #define GPLL_CON0_LOCKED (1 << 29) 165*77b55e8cSThomas Abraham #define VPLL_CON0_LOCKED (1 << 29) 166*77b55e8cSThomas Abraham #define CLK_REG_DISABLE 0x0 167*77b55e8cSThomas Abraham #define TOP2_VAL 0x0110000 168*77b55e8cSThomas Abraham 169*77b55e8cSThomas Abraham /* SCLK_SRC_ISP - set SPI0/1 to 6 = SCLK_MPLL_USER */ 170*77b55e8cSThomas Abraham #define SPI0_ISP_SEL 6 171*77b55e8cSThomas Abraham #define SPI1_ISP_SEL 6 172*77b55e8cSThomas Abraham #define SCLK_SRC_ISP_VAL (SPI1_ISP_SEL << 4) \ 173*77b55e8cSThomas Abraham | (SPI0_ISP_SEL << 0) 174*77b55e8cSThomas Abraham 175*77b55e8cSThomas Abraham /* SCLK_DIV_ISP - set SPI0/1 to 0xf = divide by 16 */ 176*77b55e8cSThomas Abraham #define SPI0_ISP_RATIO 0xf 177*77b55e8cSThomas Abraham #define SPI1_ISP_RATIO 0xf 178*77b55e8cSThomas Abraham #define SCLK_DIV_ISP_VAL (SPI1_ISP_RATIO << 12) \ 179*77b55e8cSThomas Abraham | (SPI0_ISP_RATIO << 0) 180*77b55e8cSThomas Abraham 181*77b55e8cSThomas Abraham /* CLK_DIV_FSYS2 */ 182*77b55e8cSThomas Abraham #define MMC2_RATIO_MASK 0xf 183*77b55e8cSThomas Abraham #define MMC2_RATIO_VAL 0x3 184*77b55e8cSThomas Abraham #define MMC2_RATIO_OFFSET 0 185*77b55e8cSThomas Abraham 186*77b55e8cSThomas Abraham #define MMC2_PRE_RATIO_MASK 0xff 187*77b55e8cSThomas Abraham #define MMC2_PRE_RATIO_VAL 0x9 188*77b55e8cSThomas Abraham #define MMC2_PRE_RATIO_OFFSET 8 189*77b55e8cSThomas Abraham 190*77b55e8cSThomas Abraham #define MMC3_RATIO_MASK 0xf 191*77b55e8cSThomas Abraham #define MMC3_RATIO_VAL 0x1 192*77b55e8cSThomas Abraham #define MMC3_RATIO_OFFSET 16 193*77b55e8cSThomas Abraham 194*77b55e8cSThomas Abraham #define MMC3_PRE_RATIO_MASK 0xff 195*77b55e8cSThomas Abraham #define MMC3_PRE_RATIO_VAL 0x0 196*77b55e8cSThomas Abraham #define MMC3_PRE_RATIO_OFFSET 24 197*77b55e8cSThomas Abraham 198*77b55e8cSThomas Abraham /* CLK_SRC_LEX */ 199*77b55e8cSThomas Abraham #define CLK_SRC_LEX_VAL 0x0 200*77b55e8cSThomas Abraham 201*77b55e8cSThomas Abraham /* CLK_DIV_LEX */ 202*77b55e8cSThomas Abraham #define CLK_DIV_LEX_VAL 0x10 203*77b55e8cSThomas Abraham 204*77b55e8cSThomas Abraham /* CLK_DIV_R0X */ 205*77b55e8cSThomas Abraham #define CLK_DIV_R0X_VAL 0x10 206*77b55e8cSThomas Abraham 207*77b55e8cSThomas Abraham /* CLK_DIV_L0X */ 208*77b55e8cSThomas Abraham #define CLK_DIV_R1X_VAL 0x10 209*77b55e8cSThomas Abraham 210*77b55e8cSThomas Abraham /* CLK_DIV_ISP2 */ 211*77b55e8cSThomas Abraham #define CLK_DIV_ISP2_VAL 0x1 212*77b55e8cSThomas Abraham 213*77b55e8cSThomas Abraham /* CLK_SRC_KFC */ 214*77b55e8cSThomas Abraham #define SRC_KFC_HPM_SEL (1 << 15) 215*77b55e8cSThomas Abraham 216*77b55e8cSThomas Abraham /* CLK_SRC_KFC */ 217*77b55e8cSThomas Abraham #define CLK_SRC_KFC_VAL 0x00008001 218*77b55e8cSThomas Abraham 219*77b55e8cSThomas Abraham /* CLK_DIV_KFC */ 220*77b55e8cSThomas Abraham #define CLK_DIV_KFC_VAL 0x03300110 221*77b55e8cSThomas Abraham 222*77b55e8cSThomas Abraham /* CLK_DIV2_RATIO */ 223*77b55e8cSThomas Abraham #define CLK_DIV2_RATIO 0x10111150 224*77b55e8cSThomas Abraham 225*77b55e8cSThomas Abraham /* CLK_DIV4_RATIO */ 226*77b55e8cSThomas Abraham #define CLK_DIV4_RATIO 0x00000003 227*77b55e8cSThomas Abraham 228*77b55e8cSThomas Abraham /* CLK_DIV_G2D */ 229*77b55e8cSThomas Abraham #define CLK_DIV_G2D 0x00000010 230*77b55e8cSThomas Abraham 231*77b55e8cSThomas Abraham /* 232*77b55e8cSThomas Abraham * DIV_DISP1_0 233*77b55e8cSThomas Abraham * For DP, divisor should be 2 234*77b55e8cSThomas Abraham */ 235*77b55e8cSThomas Abraham #define CLK_DIV_DISP1_0_FIMD1 (2 << 0) 236*77b55e8cSThomas Abraham 237*77b55e8cSThomas Abraham /* CLK_GATE_IP_DISP1 */ 238*77b55e8cSThomas Abraham #define CLK_GATE_DP1_ALLOW (1 << 4) 239*77b55e8cSThomas Abraham 240*77b55e8cSThomas Abraham /* AUDIO CLK SEL */ 241*77b55e8cSThomas Abraham #define AUDIO0_SEL_EPLL (0x6 << 28) 242*77b55e8cSThomas Abraham #define AUDIO0_RATIO 0x5 243*77b55e8cSThomas Abraham #define PCM0_RATIO 0x3 244*77b55e8cSThomas Abraham #define DIV_MAU_VAL (PCM0_RATIO << 24 | AUDIO0_RATIO << 20) 245*77b55e8cSThomas Abraham 246*77b55e8cSThomas Abraham /* CLK_SRC_CDREX */ 247*77b55e8cSThomas Abraham #define MUX_MCLK_CDR_MSPLL (1 << 4) 248*77b55e8cSThomas Abraham #define MUX_BPLL_SEL_FOUTBPLL (1 << 0) 249*77b55e8cSThomas Abraham #define BPLL_SEL_MASK 0x7 250*77b55e8cSThomas Abraham #define FOUTBPLL 2 251*77b55e8cSThomas Abraham 252*77b55e8cSThomas Abraham #define DDR3PHY_CTRL_PHY_RESET (1 << 0) 253*77b55e8cSThomas Abraham #define DDR3PHY_CTRL_PHY_RESET_OFF (0 << 0) 254*77b55e8cSThomas Abraham 255*77b55e8cSThomas Abraham #define PHY_CON0_RESET_VAL 0x17020a40 256*77b55e8cSThomas Abraham #define P0_CMD_EN (1 << 14) 257*77b55e8cSThomas Abraham #define BYTE_RDLVL_EN (1 << 13) 258*77b55e8cSThomas Abraham #define CTRL_SHGATE (1 << 8) 259*77b55e8cSThomas Abraham 260*77b55e8cSThomas Abraham #define PHY_CON1_RESET_VAL 0x09210100 261*77b55e8cSThomas Abraham #define RDLVL_PASS_ADJ_VAL 0x6 262*77b55e8cSThomas Abraham #define RDLVL_PASS_ADJ_OFFSET 16 263*77b55e8cSThomas Abraham #define CTRL_GATEDURADJ_MASK (0xf << 20) 264*77b55e8cSThomas Abraham #define READ_LEVELLING_DDR3 0x0100 265*77b55e8cSThomas Abraham 266*77b55e8cSThomas Abraham #define PHY_CON2_RESET_VAL 0x00010004 267*77b55e8cSThomas Abraham #define INIT_DESKEW_EN (1 << 6) 268*77b55e8cSThomas Abraham #define DLL_DESKEW_EN (1 << 12) 269*77b55e8cSThomas Abraham #define RDLVL_GATE_EN (1 << 24) 270*77b55e8cSThomas Abraham #define RDLVL_EN (1 << 25) 271*77b55e8cSThomas Abraham #define RDLVL_INCR_ADJ (0x1 << 16) 272*77b55e8cSThomas Abraham 273*77b55e8cSThomas Abraham /* DREX_PAUSE */ 274*77b55e8cSThomas Abraham #define DREX_PAUSE_EN (1 << 0) 275*77b55e8cSThomas Abraham 276*77b55e8cSThomas Abraham #define BYPASS_EN (1 << 22) 277*77b55e8cSThomas Abraham 278*77b55e8cSThomas Abraham /* MEMMORY VAL */ 279*77b55e8cSThomas Abraham #define PHY_CON0_VAL 0x17021A00 280*77b55e8cSThomas Abraham 281*77b55e8cSThomas Abraham #define PHY_CON12_RESET_VAL 0x10100070 282*77b55e8cSThomas Abraham #define PHY_CON12_VAL 0x10107F50 283*77b55e8cSThomas Abraham #define CTRL_START (1 << 6) 284*77b55e8cSThomas Abraham #define CTRL_DLL_ON (1 << 5) 285*77b55e8cSThomas Abraham #define CTRL_LOCK_COARSE_OFFSET 10 286*77b55e8cSThomas Abraham #define CTRL_LOCK_COARSE_MASK (0x7F << CTRL_LOCK_COARSE_OFFSET) 287*77b55e8cSThomas Abraham #define CTRL_LOCK_COARSE(x) (((x) & CTRL_LOCK_COARSE_MASK) >> \ 288*77b55e8cSThomas Abraham CTRL_LOCK_COARSE_OFFSET) 289*77b55e8cSThomas Abraham #define CTRL_FORCE_MASK (0x7F << 8) 290*77b55e8cSThomas Abraham #define CTRL_FINE_LOCKED 0x7 291*77b55e8cSThomas Abraham 292*77b55e8cSThomas Abraham #define CTRL_OFFSETD_RESET_VAL 0x8 293*77b55e8cSThomas Abraham #define CTRL_OFFSETD_VAL 0x7F 294*77b55e8cSThomas Abraham 295*77b55e8cSThomas Abraham #define CTRL_OFFSETR0 0x7F 296*77b55e8cSThomas Abraham #define CTRL_OFFSETR1 0x7F 297*77b55e8cSThomas Abraham #define CTRL_OFFSETR2 0x7F 298*77b55e8cSThomas Abraham #define CTRL_OFFSETR3 0x7F 299*77b55e8cSThomas Abraham #define PHY_CON4_VAL (CTRL_OFFSETR0 << 0 | \ 300*77b55e8cSThomas Abraham CTRL_OFFSETR1 << 8 | \ 301*77b55e8cSThomas Abraham CTRL_OFFSETR2 << 16 | \ 302*77b55e8cSThomas Abraham CTRL_OFFSETR3 << 24) 303*77b55e8cSThomas Abraham #define PHY_CON4_RESET_VAL 0x08080808 304*77b55e8cSThomas Abraham 305*77b55e8cSThomas Abraham #define CTRL_OFFSETW0 0x7F 306*77b55e8cSThomas Abraham #define CTRL_OFFSETW1 0x7F 307*77b55e8cSThomas Abraham #define CTRL_OFFSETW2 0x7F 308*77b55e8cSThomas Abraham #define CTRL_OFFSETW3 0x7F 309*77b55e8cSThomas Abraham #define PHY_CON6_VAL (CTRL_OFFSETW0 << 0 | \ 310*77b55e8cSThomas Abraham CTRL_OFFSETW1 << 8 | \ 311*77b55e8cSThomas Abraham CTRL_OFFSETW2 << 16 | \ 312*77b55e8cSThomas Abraham CTRL_OFFSETW3 << 24) 313*77b55e8cSThomas Abraham #define PHY_CON6_RESET_VAL 0x08080808 314*77b55e8cSThomas Abraham 315*77b55e8cSThomas Abraham #define PHY_CON14_RESET_VAL 0x001F0000 316*77b55e8cSThomas Abraham #define CTRL_PULLD_DQS 0xF 317*77b55e8cSThomas Abraham #define CTRL_PULLD_DQS_OFFSET 0 318*77b55e8cSThomas Abraham 319*77b55e8cSThomas Abraham /* ZQ Configurations */ 320*77b55e8cSThomas Abraham #define PHY_CON16_RESET_VAL 0x08000304 321*77b55e8cSThomas Abraham 322*77b55e8cSThomas Abraham #define ZQ_CLK_EN (1 << 27) 323*77b55e8cSThomas Abraham #define ZQ_CLK_DIV_EN (1 << 18) 324*77b55e8cSThomas Abraham #define ZQ_MANUAL_STR (1 << 1) 325*77b55e8cSThomas Abraham #define ZQ_DONE (1 << 0) 326*77b55e8cSThomas Abraham #define ZQ_MODE_DDS_OFFSET 24 327*77b55e8cSThomas Abraham 328*77b55e8cSThomas Abraham #define CTRL_RDLVL_GATE_ENABLE 1 329*77b55e8cSThomas Abraham #define CTRL_RDLVL_GATE_DISABLE 0 330*77b55e8cSThomas Abraham #define CTRL_RDLVL_DATA_ENABLE 2 331*77b55e8cSThomas Abraham 332*77b55e8cSThomas Abraham /* Direct Command */ 333*77b55e8cSThomas Abraham #define DIRECT_CMD_NOP 0x07000000 334*77b55e8cSThomas Abraham #define DIRECT_CMD_PALL 0x01000000 335*77b55e8cSThomas Abraham #define DIRECT_CMD_ZQINIT 0x0a000000 336*77b55e8cSThomas Abraham #define DIRECT_CMD_CHANNEL_SHIFT 28 337*77b55e8cSThomas Abraham #define DIRECT_CMD_CHIP_SHIFT 20 338*77b55e8cSThomas Abraham #define DIRECT_CMD_BANK_SHIFT 16 339*77b55e8cSThomas Abraham #define DIRECT_CMD_REFA (5 << 24) 340*77b55e8cSThomas Abraham #define DIRECT_CMD_MRS1 0x71C00 341*77b55e8cSThomas Abraham #define DIRECT_CMD_MRS2 0x10BFC 342*77b55e8cSThomas Abraham #define DIRECT_CMD_MRS3 0x0050C 343*77b55e8cSThomas Abraham #define DIRECT_CMD_MRS4 0x00868 344*77b55e8cSThomas Abraham #define DIRECT_CMD_MRS5 0x00C04 345*77b55e8cSThomas Abraham 346*77b55e8cSThomas Abraham /* Drive Strength */ 347*77b55e8cSThomas Abraham #define IMPEDANCE_48_OHM 4 348*77b55e8cSThomas Abraham #define IMPEDANCE_40_OHM 5 349*77b55e8cSThomas Abraham #define IMPEDANCE_34_OHM 6 350*77b55e8cSThomas Abraham #define IMPEDANCE_30_OHM 7 351*77b55e8cSThomas Abraham #define PHY_CON39_VAL_48_OHM 0x09240924 352*77b55e8cSThomas Abraham #define PHY_CON39_VAL_40_OHM 0x0B6D0B6D 353*77b55e8cSThomas Abraham #define PHY_CON39_VAL_34_OHM 0x0DB60DB6 354*77b55e8cSThomas Abraham #define PHY_CON39_VAL_30_OHM 0x0FFF0FFF 355*77b55e8cSThomas Abraham 356*77b55e8cSThomas Abraham #define CTRL_BSTLEN_OFFSET 8 357*77b55e8cSThomas Abraham #define CTRL_RDLAT_OFFSET 0 358*77b55e8cSThomas Abraham 359*77b55e8cSThomas Abraham #define CMD_DEFAULT_LPDDR3 0xF 360*77b55e8cSThomas Abraham #define CMD_DEFUALT_OFFSET 0 361*77b55e8cSThomas Abraham #define T_WRDATA_EN 0x7 362*77b55e8cSThomas Abraham #define T_WRDATA_EN_DDR3 0x8 363*77b55e8cSThomas Abraham #define T_WRDATA_EN_OFFSET 16 364*77b55e8cSThomas Abraham #define T_WRDATA_EN_MASK 0x1f 365*77b55e8cSThomas Abraham 366*77b55e8cSThomas Abraham #define PHY_CON31_VAL 0x0C183060 367*77b55e8cSThomas Abraham #define PHY_CON32_VAL 0x60C18306 368*77b55e8cSThomas Abraham #define PHY_CON33_VAL 0x00000030 369*77b55e8cSThomas Abraham 370*77b55e8cSThomas Abraham #define PHY_CON31_RESET_VAL 0x0 371*77b55e8cSThomas Abraham #define PHY_CON32_RESET_VAL 0x0 372*77b55e8cSThomas Abraham #define PHY_CON33_RESET_VAL 0x0 373*77b55e8cSThomas Abraham 374*77b55e8cSThomas Abraham #define SL_DLL_DYN_CON_EN (1 << 1) 375*77b55e8cSThomas Abraham #define FP_RESYNC (1 << 3) 376*77b55e8cSThomas Abraham #define CTRL_START (1 << 6) 377*77b55e8cSThomas Abraham 378*77b55e8cSThomas Abraham #define DMC_AREF_EN (1 << 5) 379*77b55e8cSThomas Abraham #define DMC_CONCONTROL_EMPTY (1 << 8) 380*77b55e8cSThomas Abraham #define DFI_INIT_START (1 << 28) 381*77b55e8cSThomas Abraham 382*77b55e8cSThomas Abraham #define DMC_MEMCONTROL_VAL 0x00312700 383*77b55e8cSThomas Abraham #define CLK_STOP_EN (1 << 0) 384*77b55e8cSThomas Abraham #define DPWRDN_EN (1 << 1) 385*77b55e8cSThomas Abraham #define DSREF_EN (1 << 5) 386*77b55e8cSThomas Abraham 387*77b55e8cSThomas Abraham #define MEMBASECONFIG_CHIP_MASK_VAL 0x7E0 388*77b55e8cSThomas Abraham #define MEMBASECONFIG_CHIP_MASK_OFFSET 0 389*77b55e8cSThomas Abraham #define MEMBASECONFIG0_CHIP_BASE_VAL 0x20 390*77b55e8cSThomas Abraham #define MEMBASECONFIG1_CHIP_BASE_VAL 0x40 391*77b55e8cSThomas Abraham #define CHIP_BASE_OFFSET 16 392*77b55e8cSThomas Abraham 393*77b55e8cSThomas Abraham #define MEMCONFIG_VAL 0x1323 394*77b55e8cSThomas Abraham #define PRECHCONFIG_DEFAULT_VAL 0xFF000000 395*77b55e8cSThomas Abraham #define PWRDNCONFIG_DEFAULT_VAL 0xFFFF00FF 396*77b55e8cSThomas Abraham 397*77b55e8cSThomas Abraham #define TIMINGAREF_VAL 0x5d 398*77b55e8cSThomas Abraham #define TIMINGROW_VAL 0x345A8692 399*77b55e8cSThomas Abraham #define TIMINGDATA_VAL 0x3630065C 400*77b55e8cSThomas Abraham #define TIMINGPOWER_VAL 0x50380336 401*77b55e8cSThomas Abraham #define DFI_INIT_COMPLETE (1 << 3) 402*77b55e8cSThomas Abraham 403*77b55e8cSThomas Abraham #define BRBRSVCONTROL_VAL 0x00000033 404*77b55e8cSThomas Abraham #define BRBRSVCONFIG_VAL 0x88778877 405*77b55e8cSThomas Abraham 406*77b55e8cSThomas Abraham /* Clock Gating Control (CGCONTROL) register */ 407*77b55e8cSThomas Abraham #define MEMIF_CG_EN (1 << 3) /* Memory interface clock gating */ 408*77b55e8cSThomas Abraham #define SCG_CG_EN (1 << 2) /* Scheduler clock gating */ 409*77b55e8cSThomas Abraham #define BUSIF_WR_CG_EN (1 << 1) /* Bus interface write channel clock gating */ 410*77b55e8cSThomas Abraham #define BUSIF_RD_CG_EN (1 << 0) /* Bus interface read channel clock gating */ 411*77b55e8cSThomas Abraham #define DMC_INTERNAL_CG (MEMIF_CG_EN | SCG_CG_EN | \ 412*77b55e8cSThomas Abraham BUSIF_WR_CG_EN | BUSIF_RD_CG_EN) 413*77b55e8cSThomas Abraham 414*77b55e8cSThomas Abraham /* DMC PHY Control0 register */ 415*77b55e8cSThomas Abraham #define PHY_CONTROL0_RESET_VAL 0x0 416*77b55e8cSThomas Abraham #define MEM_TERM_EN (1 << 31) /* Termination enable for memory */ 417*77b55e8cSThomas Abraham #define PHY_TERM_EN (1 << 30) /* Termination enable for PHY */ 418*77b55e8cSThomas Abraham #define DMC_CTRL_SHGATE (1 << 29) /* Duration of DQS gating signal */ 419*77b55e8cSThomas Abraham #define FP_RSYNC (1 << 3) /* Force DLL resyncronization */ 420*77b55e8cSThomas Abraham 421*77b55e8cSThomas Abraham /* Driver strength for CK, CKE, CS & CA */ 422*77b55e8cSThomas Abraham #define IMP_OUTPUT_DRV_40_OHM 0x5 423*77b55e8cSThomas Abraham #define IMP_OUTPUT_DRV_30_OHM 0x7 424*77b55e8cSThomas Abraham #define DA_3_DS_OFFSET 25 425*77b55e8cSThomas Abraham #define DA_2_DS_OFFSET 22 426*77b55e8cSThomas Abraham #define DA_1_DS_OFFSET 19 427*77b55e8cSThomas Abraham #define DA_0_DS_OFFSET 16 428*77b55e8cSThomas Abraham #define CA_CK_DRVR_DS_OFFSET 9 429*77b55e8cSThomas Abraham #define CA_CKE_DRVR_DS_OFFSET 6 430*77b55e8cSThomas Abraham #define CA_CS_DRVR_DS_OFFSET 3 431*77b55e8cSThomas Abraham #define CA_ADR_DRVR_DS_OFFSET 0 432*77b55e8cSThomas Abraham 433*77b55e8cSThomas Abraham #define PHY_CON42_CTRL_BSTLEN_SHIFT 8 434*77b55e8cSThomas Abraham #define PHY_CON42_CTRL_RDLAT_SHIFT 0 435*77b55e8cSThomas Abraham 436*77b55e8cSThomas Abraham /* 437*77b55e8cSThomas Abraham * Definitions that differ with SoC's. 438*77b55e8cSThomas Abraham * Below is the part defining macros for Exynos5250. 439*77b55e8cSThomas Abraham * Else part introduces macros for Exynos5420. 440*77b55e8cSThomas Abraham */ 441*77b55e8cSThomas Abraham #ifndef CONFIG_EXYNOS5420 442*77b55e8cSThomas Abraham 443*77b55e8cSThomas Abraham /* APLL_CON1 */ 444*77b55e8cSThomas Abraham #define APLL_CON1_VAL (0x00203800) 445*77b55e8cSThomas Abraham 446*77b55e8cSThomas Abraham /* MPLL_CON1 */ 447*77b55e8cSThomas Abraham #define MPLL_CON1_VAL (0x00203800) 448*77b55e8cSThomas Abraham 449*77b55e8cSThomas Abraham /* CPLL_CON1 */ 450*77b55e8cSThomas Abraham #define CPLL_CON1_VAL (0x00203800) 451*77b55e8cSThomas Abraham 452*77b55e8cSThomas Abraham /* DPLL_CON1 */ 453*77b55e8cSThomas Abraham #define DPLL_CON1_VAL (NOT_AVAILABLE) 454*77b55e8cSThomas Abraham 455*77b55e8cSThomas Abraham /* GPLL_CON1 */ 456*77b55e8cSThomas Abraham #define GPLL_CON1_VAL (0x00203800) 457*77b55e8cSThomas Abraham 458*77b55e8cSThomas Abraham /* EPLL_CON1, CON2 */ 459*77b55e8cSThomas Abraham #define EPLL_CON1_VAL 0x00000000 460*77b55e8cSThomas Abraham #define EPLL_CON2_VAL 0x00000080 461*77b55e8cSThomas Abraham 462*77b55e8cSThomas Abraham /* VPLL_CON1, CON2 */ 463*77b55e8cSThomas Abraham #define VPLL_CON1_VAL 0x00000000 464*77b55e8cSThomas Abraham #define VPLL_CON2_VAL 0x00000080 465*77b55e8cSThomas Abraham 466*77b55e8cSThomas Abraham /* RPLL_CON1, CON2 */ 467*77b55e8cSThomas Abraham #define RPLL_CON1_VAL NOT_AVAILABLE 468*77b55e8cSThomas Abraham #define RPLL_CON2_VAL NOT_AVAILABLE 469*77b55e8cSThomas Abraham 470*77b55e8cSThomas Abraham /* BPLL_CON1 */ 471*77b55e8cSThomas Abraham #define BPLL_CON1_VAL 0x00203800 472*77b55e8cSThomas Abraham 473*77b55e8cSThomas Abraham /* SPLL_CON1 */ 474*77b55e8cSThomas Abraham #define SPLL_CON1_VAL NOT_AVAILABLE 475*77b55e8cSThomas Abraham 476*77b55e8cSThomas Abraham /* IPLL_CON1 */ 477*77b55e8cSThomas Abraham #define IPLL_CON1_VAL NOT_AVAILABLE 478*77b55e8cSThomas Abraham 479*77b55e8cSThomas Abraham /* KPLL_CON1 */ 480*77b55e8cSThomas Abraham #define KPLL_CON1_VAL NOT_AVAILABLE 481*77b55e8cSThomas Abraham 482*77b55e8cSThomas Abraham /* CLK_SRC_ISP */ 483*77b55e8cSThomas Abraham #define CLK_SRC_ISP_VAL NOT_AVAILABLE 484*77b55e8cSThomas Abraham #define CLK_DIV_ISP0_VAL 0x31 485*77b55e8cSThomas Abraham #define CLK_DIV_ISP1_VAL 0x0 486*77b55e8cSThomas Abraham 487*77b55e8cSThomas Abraham /* CLK_FSYS */ 488*77b55e8cSThomas Abraham #define CLK_SRC_FSYS0_VAL 0x66666 489*77b55e8cSThomas Abraham #define CLK_DIV_FSYS0_VAL 0x0BB00000 490*77b55e8cSThomas Abraham #define CLK_DIV_FSYS1_VAL NOT_AVAILABLE 491*77b55e8cSThomas Abraham #define CLK_DIV_FSYS2_VAL NOT_AVAILABLE 492*77b55e8cSThomas Abraham 493*77b55e8cSThomas Abraham /* CLK_SRC_CPU */ 494*77b55e8cSThomas Abraham /* 0 = MOUTAPLL, 1 = SCLKMPLL */ 495*77b55e8cSThomas Abraham #define MUX_HPM_SEL 0 496*77b55e8cSThomas Abraham #define MUX_CPU_SEL 0 497*77b55e8cSThomas Abraham #define MUX_APLL_SEL 1 498*77b55e8cSThomas Abraham 499*77b55e8cSThomas Abraham #define CLK_SRC_CPU_VAL ((MUX_HPM_SEL << 20) \ 500*77b55e8cSThomas Abraham | (MUX_CPU_SEL << 16) \ 501*77b55e8cSThomas Abraham | (MUX_APLL_SEL)) 502*77b55e8cSThomas Abraham 503*77b55e8cSThomas Abraham /* CLK_SRC_CDREX */ 504*77b55e8cSThomas Abraham #define CLK_SRC_CDREX_VAL 0x1 505*77b55e8cSThomas Abraham 506*77b55e8cSThomas Abraham /* CLK_DIV_CDREX */ 507*77b55e8cSThomas Abraham #define CLK_DIV_CDREX0_VAL NOT_AVAILABLE 508*77b55e8cSThomas Abraham #define CLK_DIV_CDREX1_VAL NOT_AVAILABLE 509*77b55e8cSThomas Abraham 510*77b55e8cSThomas Abraham /* CLK_DIV_CPU0_VAL */ 511*77b55e8cSThomas Abraham #define CLK_DIV_CPU0_VAL NOT_AVAILABLE 512*77b55e8cSThomas Abraham 513*77b55e8cSThomas Abraham #define MCLK_CDREX2_RATIO 0x0 514*77b55e8cSThomas Abraham #define ACLK_EFCON_RATIO 0x1 515*77b55e8cSThomas Abraham #define MCLK_DPHY_RATIO 0x1 516*77b55e8cSThomas Abraham #define MCLK_CDREX_RATIO 0x1 517*77b55e8cSThomas Abraham #define ACLK_C2C_200_RATIO 0x1 518*77b55e8cSThomas Abraham #define C2C_CLK_400_RATIO 0x1 519*77b55e8cSThomas Abraham #define PCLK_CDREX_RATIO 0x1 520*77b55e8cSThomas Abraham #define ACLK_CDREX_RATIO 0x1 521*77b55e8cSThomas Abraham 522*77b55e8cSThomas Abraham #define CLK_DIV_CDREX_VAL ((MCLK_DPHY_RATIO << 24) \ 523*77b55e8cSThomas Abraham | (C2C_CLK_400_RATIO << 6) \ 524*77b55e8cSThomas Abraham | (PCLK_CDREX_RATIO << 4) \ 525*77b55e8cSThomas Abraham | (ACLK_CDREX_RATIO)) 526*77b55e8cSThomas Abraham 527*77b55e8cSThomas Abraham /* CLK_SRC_TOP0 */ 528*77b55e8cSThomas Abraham #define MUX_ACLK_300_GSCL_SEL 0x0 529*77b55e8cSThomas Abraham #define MUX_ACLK_300_GSCL_MID_SEL 0x0 530*77b55e8cSThomas Abraham #define MUX_ACLK_400_G3D_MID_SEL 0x0 531*77b55e8cSThomas Abraham #define MUX_ACLK_333_SEL 0x0 532*77b55e8cSThomas Abraham #define MUX_ACLK_300_DISP1_SEL 0x0 533*77b55e8cSThomas Abraham #define MUX_ACLK_300_DISP1_MID_SEL 0x0 534*77b55e8cSThomas Abraham #define MUX_ACLK_200_SEL 0x0 535*77b55e8cSThomas Abraham #define MUX_ACLK_166_SEL 0x0 536*77b55e8cSThomas Abraham #define CLK_SRC_TOP0_VAL ((MUX_ACLK_300_GSCL_SEL << 25) \ 537*77b55e8cSThomas Abraham | (MUX_ACLK_300_GSCL_MID_SEL << 24) \ 538*77b55e8cSThomas Abraham | (MUX_ACLK_400_G3D_MID_SEL << 20) \ 539*77b55e8cSThomas Abraham | (MUX_ACLK_333_SEL << 16) \ 540*77b55e8cSThomas Abraham | (MUX_ACLK_300_DISP1_SEL << 15) \ 541*77b55e8cSThomas Abraham | (MUX_ACLK_300_DISP1_MID_SEL << 14) \ 542*77b55e8cSThomas Abraham | (MUX_ACLK_200_SEL << 12) \ 543*77b55e8cSThomas Abraham | (MUX_ACLK_166_SEL << 8)) 544*77b55e8cSThomas Abraham 545*77b55e8cSThomas Abraham /* CLK_SRC_TOP1 */ 546*77b55e8cSThomas Abraham #define MUX_ACLK_400_G3D_SEL 0x1 547*77b55e8cSThomas Abraham #define MUX_ACLK_400_ISP_SEL 0x0 548*77b55e8cSThomas Abraham #define MUX_ACLK_400_IOP_SEL 0x0 549*77b55e8cSThomas Abraham #define MUX_ACLK_MIPI_HSI_TXBASE_SEL 0x0 550*77b55e8cSThomas Abraham #define MUX_ACLK_300_GSCL_MID1_SEL 0x0 551*77b55e8cSThomas Abraham #define MUX_ACLK_300_DISP1_MID1_SEL 0x0 552*77b55e8cSThomas Abraham #define CLK_SRC_TOP1_VAL ((MUX_ACLK_400_G3D_SEL << 28) \ 553*77b55e8cSThomas Abraham |(MUX_ACLK_400_ISP_SEL << 24) \ 554*77b55e8cSThomas Abraham |(MUX_ACLK_400_IOP_SEL << 20) \ 555*77b55e8cSThomas Abraham |(MUX_ACLK_MIPI_HSI_TXBASE_SEL << 16) \ 556*77b55e8cSThomas Abraham |(MUX_ACLK_300_GSCL_MID1_SEL << 12) \ 557*77b55e8cSThomas Abraham |(MUX_ACLK_300_DISP1_MID1_SEL << 8)) 558*77b55e8cSThomas Abraham 559*77b55e8cSThomas Abraham /* CLK_SRC_TOP2 */ 560*77b55e8cSThomas Abraham #define MUX_GPLL_SEL 0x1 561*77b55e8cSThomas Abraham #define MUX_BPLL_USER_SEL 0x0 562*77b55e8cSThomas Abraham #define MUX_MPLL_USER_SEL 0x0 563*77b55e8cSThomas Abraham #define MUX_VPLL_SEL 0x1 564*77b55e8cSThomas Abraham #define MUX_EPLL_SEL 0x1 565*77b55e8cSThomas Abraham #define MUX_CPLL_SEL 0x1 566*77b55e8cSThomas Abraham #define VPLLSRC_SEL 0x0 567*77b55e8cSThomas Abraham #define CLK_SRC_TOP2_VAL ((MUX_GPLL_SEL << 28) \ 568*77b55e8cSThomas Abraham | (MUX_BPLL_USER_SEL << 24) \ 569*77b55e8cSThomas Abraham | (MUX_MPLL_USER_SEL << 20) \ 570*77b55e8cSThomas Abraham | (MUX_VPLL_SEL << 16) \ 571*77b55e8cSThomas Abraham | (MUX_EPLL_SEL << 12) \ 572*77b55e8cSThomas Abraham | (MUX_CPLL_SEL << 8) \ 573*77b55e8cSThomas Abraham | (VPLLSRC_SEL)) 574*77b55e8cSThomas Abraham /* CLK_SRC_TOP3 */ 575*77b55e8cSThomas Abraham #define MUX_ACLK_333_SUB_SEL 0x1 576*77b55e8cSThomas Abraham #define MUX_ACLK_400_SUB_SEL 0x1 577*77b55e8cSThomas Abraham #define MUX_ACLK_266_ISP_SUB_SEL 0x1 578*77b55e8cSThomas Abraham #define MUX_ACLK_266_GPS_SUB_SEL 0x0 579*77b55e8cSThomas Abraham #define MUX_ACLK_300_GSCL_SUB_SEL 0x1 580*77b55e8cSThomas Abraham #define MUX_ACLK_266_GSCL_SUB_SEL 0x1 581*77b55e8cSThomas Abraham #define MUX_ACLK_300_DISP1_SUB_SEL 0x1 582*77b55e8cSThomas Abraham #define MUX_ACLK_200_DISP1_SUB_SEL 0x1 583*77b55e8cSThomas Abraham #define CLK_SRC_TOP3_VAL ((MUX_ACLK_333_SUB_SEL << 24) \ 584*77b55e8cSThomas Abraham | (MUX_ACLK_400_SUB_SEL << 20) \ 585*77b55e8cSThomas Abraham | (MUX_ACLK_266_ISP_SUB_SEL << 16) \ 586*77b55e8cSThomas Abraham | (MUX_ACLK_266_GPS_SUB_SEL << 12) \ 587*77b55e8cSThomas Abraham | (MUX_ACLK_300_GSCL_SUB_SEL << 10) \ 588*77b55e8cSThomas Abraham | (MUX_ACLK_266_GSCL_SUB_SEL << 8) \ 589*77b55e8cSThomas Abraham | (MUX_ACLK_300_DISP1_SUB_SEL << 6) \ 590*77b55e8cSThomas Abraham | (MUX_ACLK_200_DISP1_SUB_SEL << 4)) 591*77b55e8cSThomas Abraham 592*77b55e8cSThomas Abraham #define CLK_SRC_TOP4_VAL NOT_AVAILABLE 593*77b55e8cSThomas Abraham #define CLK_SRC_TOP5_VAL NOT_AVAILABLE 594*77b55e8cSThomas Abraham #define CLK_SRC_TOP6_VAL NOT_AVAILABLE 595*77b55e8cSThomas Abraham #define CLK_SRC_TOP7_VAL NOT_AVAILABLE 596*77b55e8cSThomas Abraham 597*77b55e8cSThomas Abraham /* CLK_DIV_TOP0 */ 598*77b55e8cSThomas Abraham #define ACLK_300_DISP1_RATIO 0x2 599*77b55e8cSThomas Abraham #define ACLK_400_G3D_RATIO 0x0 600*77b55e8cSThomas Abraham #define ACLK_333_RATIO 0x0 601*77b55e8cSThomas Abraham #define ACLK_266_RATIO 0x2 602*77b55e8cSThomas Abraham #define ACLK_200_RATIO 0x3 603*77b55e8cSThomas Abraham #define ACLK_166_RATIO 0x1 604*77b55e8cSThomas Abraham #define ACLK_133_RATIO 0x1 605*77b55e8cSThomas Abraham #define ACLK_66_RATIO 0x5 606*77b55e8cSThomas Abraham 607*77b55e8cSThomas Abraham #define CLK_DIV_TOP0_VAL ((ACLK_300_DISP1_RATIO << 28) \ 608*77b55e8cSThomas Abraham | (ACLK_400_G3D_RATIO << 24) \ 609*77b55e8cSThomas Abraham | (ACLK_333_RATIO << 20) \ 610*77b55e8cSThomas Abraham | (ACLK_266_RATIO << 16) \ 611*77b55e8cSThomas Abraham | (ACLK_200_RATIO << 12) \ 612*77b55e8cSThomas Abraham | (ACLK_166_RATIO << 8) \ 613*77b55e8cSThomas Abraham | (ACLK_133_RATIO << 4) \ 614*77b55e8cSThomas Abraham | (ACLK_66_RATIO)) 615*77b55e8cSThomas Abraham 616*77b55e8cSThomas Abraham /* CLK_DIV_TOP1 */ 617*77b55e8cSThomas Abraham #define ACLK_MIPI_HSI_TX_BASE_RATIO 0x3 618*77b55e8cSThomas Abraham #define ACLK_66_PRE_RATIO 0x1 619*77b55e8cSThomas Abraham #define ACLK_400_ISP_RATIO 0x1 620*77b55e8cSThomas Abraham #define ACLK_400_IOP_RATIO 0x1 621*77b55e8cSThomas Abraham #define ACLK_300_GSCL_RATIO 0x2 622*77b55e8cSThomas Abraham 623*77b55e8cSThomas Abraham #define CLK_DIV_TOP1_VAL ((ACLK_MIPI_HSI_TX_BASE_RATIO << 28) \ 624*77b55e8cSThomas Abraham | (ACLK_66_PRE_RATIO << 24) \ 625*77b55e8cSThomas Abraham | (ACLK_400_ISP_RATIO << 20) \ 626*77b55e8cSThomas Abraham | (ACLK_400_IOP_RATIO << 16) \ 627*77b55e8cSThomas Abraham | (ACLK_300_GSCL_RATIO << 12)) 628*77b55e8cSThomas Abraham 629*77b55e8cSThomas Abraham #define CLK_DIV_TOP2_VAL NOT_AVAILABLE 630*77b55e8cSThomas Abraham 631*77b55e8cSThomas Abraham /* PLL Lock Value Factor */ 632*77b55e8cSThomas Abraham #define PLL_LOCK_FACTOR 250 633*77b55e8cSThomas Abraham #define PLL_X_LOCK_FACTOR 3000 634*77b55e8cSThomas Abraham 635*77b55e8cSThomas Abraham /* CLK_SRC_PERIC0 */ 636*77b55e8cSThomas Abraham #define PWM_SEL 6 637*77b55e8cSThomas Abraham #define UART3_SEL 6 638*77b55e8cSThomas Abraham #define UART2_SEL 6 639*77b55e8cSThomas Abraham #define UART1_SEL 6 640*77b55e8cSThomas Abraham #define UART0_SEL 6 641*77b55e8cSThomas Abraham /* SRC_CLOCK = SCLK_MPLL */ 642*77b55e8cSThomas Abraham #define CLK_SRC_PERIC0_VAL ((PWM_SEL << 24) \ 643*77b55e8cSThomas Abraham | (UART3_SEL << 12) \ 644*77b55e8cSThomas Abraham | (UART2_SEL << 8) \ 645*77b55e8cSThomas Abraham | (UART1_SEL << 4) \ 646*77b55e8cSThomas Abraham | (UART0_SEL)) 647*77b55e8cSThomas Abraham 648*77b55e8cSThomas Abraham /* CLK_SRC_PERIC1 */ 649*77b55e8cSThomas Abraham /* SRC_CLOCK = SCLK_MPLL */ 650*77b55e8cSThomas Abraham #define SPI0_SEL 6 651*77b55e8cSThomas Abraham #define SPI1_SEL 6 652*77b55e8cSThomas Abraham #define SPI2_SEL 6 653*77b55e8cSThomas Abraham #define CLK_SRC_PERIC1_VAL ((SPI2_SEL << 24) \ 654*77b55e8cSThomas Abraham | (SPI1_SEL << 20) \ 655*77b55e8cSThomas Abraham | (SPI0_SEL << 16)) 656*77b55e8cSThomas Abraham 657*77b55e8cSThomas Abraham /* CLK_DIV_PERIL0 */ 658*77b55e8cSThomas Abraham #define UART5_RATIO 7 659*77b55e8cSThomas Abraham #define UART4_RATIO 7 660*77b55e8cSThomas Abraham #define UART3_RATIO 7 661*77b55e8cSThomas Abraham #define UART2_RATIO 7 662*77b55e8cSThomas Abraham #define UART1_RATIO 7 663*77b55e8cSThomas Abraham #define UART0_RATIO 7 664*77b55e8cSThomas Abraham 665*77b55e8cSThomas Abraham #define CLK_DIV_PERIC0_VAL ((UART3_RATIO << 12) \ 666*77b55e8cSThomas Abraham | (UART2_RATIO << 8) \ 667*77b55e8cSThomas Abraham | (UART1_RATIO << 4) \ 668*77b55e8cSThomas Abraham | (UART0_RATIO)) 669*77b55e8cSThomas Abraham /* CLK_DIV_PERIC1 */ 670*77b55e8cSThomas Abraham #define SPI1_RATIO 0x7 671*77b55e8cSThomas Abraham #define SPI0_RATIO 0xf 672*77b55e8cSThomas Abraham #define SPI1_SUB_RATIO 0x0 673*77b55e8cSThomas Abraham #define SPI0_SUB_RATIO 0x0 674*77b55e8cSThomas Abraham #define CLK_DIV_PERIC1_VAL ((SPI1_SUB_RATIO << 24) \ 675*77b55e8cSThomas Abraham | ((SPI1_RATIO << 16) \ 676*77b55e8cSThomas Abraham | (SPI0_SUB_RATIO << 8) \ 677*77b55e8cSThomas Abraham | (SPI0_RATIO << 0))) 678*77b55e8cSThomas Abraham 679*77b55e8cSThomas Abraham /* CLK_DIV_PERIC2 */ 680*77b55e8cSThomas Abraham #define SPI2_RATIO 0xf 681*77b55e8cSThomas Abraham #define SPI2_SUB_RATIO 0x0 682*77b55e8cSThomas Abraham #define CLK_DIV_PERIC2_VAL ((SPI2_SUB_RATIO << 8) \ 683*77b55e8cSThomas Abraham | (SPI2_RATIO << 0)) 684*77b55e8cSThomas Abraham 685*77b55e8cSThomas Abraham /* CLK_DIV_PERIC3 */ 686*77b55e8cSThomas Abraham #define PWM_RATIO 8 687*77b55e8cSThomas Abraham #define CLK_DIV_PERIC3_VAL (PWM_RATIO << 0) 688*77b55e8cSThomas Abraham 689*77b55e8cSThomas Abraham 690*77b55e8cSThomas Abraham /* CLK_DIV_PERIC4 */ 691*77b55e8cSThomas Abraham #define CLK_DIV_PERIC4_VAL NOT_AVAILABLE 692*77b55e8cSThomas Abraham 693*77b55e8cSThomas Abraham /* CLK_SRC_DISP1_0 */ 694*77b55e8cSThomas Abraham #define CLK_SRC_DISP1_0_VAL 0x6 695*77b55e8cSThomas Abraham #define CLK_DIV_DISP1_0_VAL NOT_AVAILABLE 696*77b55e8cSThomas Abraham 697*77b55e8cSThomas Abraham #define APLL_FOUT (1 << 0) 698*77b55e8cSThomas Abraham #define KPLL_FOUT NOT_AVAILABLE 699*77b55e8cSThomas Abraham 700*77b55e8cSThomas Abraham #define CLK_DIV_CPERI1_VAL NOT_AVAILABLE 701*77b55e8cSThomas Abraham 702*77b55e8cSThomas Abraham #else 703*77b55e8cSThomas Abraham 704*77b55e8cSThomas Abraham #define CPU_CONFIG_STATUS_OFFSET 0x80 705*77b55e8cSThomas Abraham #define CPU_RST_FLAG_VAL 0xFCBA0D10 706*77b55e8cSThomas Abraham #define PAD_RETENTION_DRAM_COREBLK_VAL 0x10000000 707*77b55e8cSThomas Abraham 708*77b55e8cSThomas Abraham /* APLL_CON1 */ 709*77b55e8cSThomas Abraham #define APLL_CON1_VAL (0x0020F300) 710*77b55e8cSThomas Abraham 711*77b55e8cSThomas Abraham /* MPLL_CON1 */ 712*77b55e8cSThomas Abraham #define MPLL_CON1_VAL (0x0020F300) 713*77b55e8cSThomas Abraham 714*77b55e8cSThomas Abraham 715*77b55e8cSThomas Abraham /* CPLL_CON1 */ 716*77b55e8cSThomas Abraham #define CPLL_CON1_VAL 0x0020f300 717*77b55e8cSThomas Abraham 718*77b55e8cSThomas Abraham /* DPLL_CON1 */ 719*77b55e8cSThomas Abraham #define DPLL_CON1_VAL (0x0020F300) 720*77b55e8cSThomas Abraham 721*77b55e8cSThomas Abraham /* GPLL_CON1 */ 722*77b55e8cSThomas Abraham #define GPLL_CON1_VAL (NOT_AVAILABLE) 723*77b55e8cSThomas Abraham 724*77b55e8cSThomas Abraham 725*77b55e8cSThomas Abraham /* EPLL_CON1, CON2 */ 726*77b55e8cSThomas Abraham #define EPLL_CON1_VAL 0x00000000 727*77b55e8cSThomas Abraham #define EPLL_CON2_VAL 0x00000080 728*77b55e8cSThomas Abraham 729*77b55e8cSThomas Abraham /* VPLL_CON1, CON2 */ 730*77b55e8cSThomas Abraham #define VPLL_CON1_VAL 0x0020f300 731*77b55e8cSThomas Abraham #define VPLL_CON2_VAL NOT_AVAILABLE 732*77b55e8cSThomas Abraham 733*77b55e8cSThomas Abraham /* RPLL_CON1, CON2 */ 734*77b55e8cSThomas Abraham #define RPLL_CON1_VAL 0x00000000 735*77b55e8cSThomas Abraham #define RPLL_CON2_VAL 0x00000080 736*77b55e8cSThomas Abraham 737*77b55e8cSThomas Abraham /* BPLL_CON1 */ 738*77b55e8cSThomas Abraham #define BPLL_CON1_VAL 0x0020f300 739*77b55e8cSThomas Abraham 740*77b55e8cSThomas Abraham /* SPLL_CON1 */ 741*77b55e8cSThomas Abraham #define SPLL_CON1_VAL 0x0020f300 742*77b55e8cSThomas Abraham 743*77b55e8cSThomas Abraham /* IPLL_CON1 */ 744*77b55e8cSThomas Abraham #define IPLL_CON1_VAL 0x00000080 745*77b55e8cSThomas Abraham 746*77b55e8cSThomas Abraham /* KPLL_CON1 */ 747*77b55e8cSThomas Abraham #define KPLL_CON1_VAL 0x200000 748*77b55e8cSThomas Abraham 749*77b55e8cSThomas Abraham /* CLK_SRC_ISP */ 750*77b55e8cSThomas Abraham #define CLK_SRC_ISP_VAL 0x33366000 751*77b55e8cSThomas Abraham #define CLK_DIV_ISP0_VAL 0x13131300 752*77b55e8cSThomas Abraham #define CLK_DIV_ISP1_VAL 0xbb110202 753*77b55e8cSThomas Abraham 754*77b55e8cSThomas Abraham 755*77b55e8cSThomas Abraham /* CLK_FSYS */ 756*77b55e8cSThomas Abraham #define CLK_SRC_FSYS0_VAL 0x33033300 757*77b55e8cSThomas Abraham #define CLK_DIV_FSYS0_VAL 0x0 758*77b55e8cSThomas Abraham #define CLK_DIV_FSYS1_VAL 0x04f13c4f 759*77b55e8cSThomas Abraham #define CLK_DIV_FSYS2_VAL 0x041d0000 760*77b55e8cSThomas Abraham 761*77b55e8cSThomas Abraham /* CLK_SRC_CPU */ 762*77b55e8cSThomas Abraham /* 0 = MOUTAPLL, 1 = SCLKMPLL */ 763*77b55e8cSThomas Abraham #define MUX_HPM_SEL 1 764*77b55e8cSThomas Abraham #define MUX_CPU_SEL 0 765*77b55e8cSThomas Abraham #define MUX_APLL_SEL 1 766*77b55e8cSThomas Abraham 767*77b55e8cSThomas Abraham #define CLK_SRC_CPU_VAL ((MUX_HPM_SEL << 20) \ 768*77b55e8cSThomas Abraham | (MUX_CPU_SEL << 16) \ 769*77b55e8cSThomas Abraham | (MUX_APLL_SEL)) 770*77b55e8cSThomas Abraham 771*77b55e8cSThomas Abraham /* CLK_SRC_CDREX */ 772*77b55e8cSThomas Abraham #define CLK_SRC_CDREX_VAL 0x00000011 773*77b55e8cSThomas Abraham 774*77b55e8cSThomas Abraham /* CLK_DIV_CDREX */ 775*77b55e8cSThomas Abraham #define CLK_DIV_CDREX0_VAL 0x30010100 776*77b55e8cSThomas Abraham #define CLK_DIV_CDREX1_VAL 0x300 777*77b55e8cSThomas Abraham 778*77b55e8cSThomas Abraham #define CLK_DIV_CDREX_VAL 0x17010100 779*77b55e8cSThomas Abraham 780*77b55e8cSThomas Abraham /* CLK_DIV_CPU0_VAL */ 781*77b55e8cSThomas Abraham #define CLK_DIV_CPU0_VAL 0x01440020 782*77b55e8cSThomas Abraham 783*77b55e8cSThomas Abraham /* CLK_SRC_TOP */ 784*77b55e8cSThomas Abraham #define CLK_SRC_TOP0_VAL 0x12221222 785*77b55e8cSThomas Abraham #define CLK_SRC_TOP1_VAL 0x00100200 786*77b55e8cSThomas Abraham #define CLK_SRC_TOP2_VAL 0x11101000 787*77b55e8cSThomas Abraham #define CLK_SRC_TOP3_VAL 0x11111111 788*77b55e8cSThomas Abraham #define CLK_SRC_TOP4_VAL 0x11110111 789*77b55e8cSThomas Abraham #define CLK_SRC_TOP5_VAL 0x11111101 790*77b55e8cSThomas Abraham #define CLK_SRC_TOP6_VAL 0x11110111 791*77b55e8cSThomas Abraham #define CLK_SRC_TOP7_VAL 0x00022200 792*77b55e8cSThomas Abraham 793*77b55e8cSThomas Abraham /* CLK_DIV_TOP */ 794*77b55e8cSThomas Abraham #define CLK_DIV_TOP0_VAL 0x23712311 795*77b55e8cSThomas Abraham #define CLK_DIV_TOP1_VAL 0x13100B00 796*77b55e8cSThomas Abraham #define CLK_DIV_TOP2_VAL 0x11101100 797*77b55e8cSThomas Abraham 798*77b55e8cSThomas Abraham /* PLL Lock Value Factor */ 799*77b55e8cSThomas Abraham #define PLL_LOCK_FACTOR 200 800*77b55e8cSThomas Abraham #define PLL_X_LOCK_FACTOR 3000 801*77b55e8cSThomas Abraham 802*77b55e8cSThomas Abraham /* CLK_SRC_PERIC0 */ 803*77b55e8cSThomas Abraham #define SPDIF_SEL 1 804*77b55e8cSThomas Abraham #define PWM_SEL 3 805*77b55e8cSThomas Abraham #define UART4_SEL 3 806*77b55e8cSThomas Abraham #define UART3_SEL 3 807*77b55e8cSThomas Abraham #define UART2_SEL 3 808*77b55e8cSThomas Abraham #define UART1_SEL 3 809*77b55e8cSThomas Abraham #define UART0_SEL 3 810*77b55e8cSThomas Abraham /* SRC_CLOCK = SCLK_RPLL */ 811*77b55e8cSThomas Abraham #define CLK_SRC_PERIC0_VAL ((SPDIF_SEL << 28) \ 812*77b55e8cSThomas Abraham | (PWM_SEL << 24) \ 813*77b55e8cSThomas Abraham | (UART4_SEL << 20) \ 814*77b55e8cSThomas Abraham | (UART3_SEL << 16) \ 815*77b55e8cSThomas Abraham | (UART2_SEL << 12) \ 816*77b55e8cSThomas Abraham | (UART1_SEL << 8) \ 817*77b55e8cSThomas Abraham | (UART0_SEL << 4)) 818*77b55e8cSThomas Abraham 819*77b55e8cSThomas Abraham /* CLK_SRC_PERIC1 */ 820*77b55e8cSThomas Abraham /* SRC_CLOCK = SCLK_EPLL */ 821*77b55e8cSThomas Abraham #define SPI0_SEL 6 822*77b55e8cSThomas Abraham #define SPI1_SEL 6 823*77b55e8cSThomas Abraham #define SPI2_SEL 6 824*77b55e8cSThomas Abraham #define AUDIO0_SEL 6 825*77b55e8cSThomas Abraham #define AUDIO1_SEL 6 826*77b55e8cSThomas Abraham #define AUDIO2_SEL 6 827*77b55e8cSThomas Abraham #define CLK_SRC_PERIC1_VAL ((SPI2_SEL << 28) \ 828*77b55e8cSThomas Abraham | (SPI1_SEL << 24) \ 829*77b55e8cSThomas Abraham | (SPI0_SEL << 20) \ 830*77b55e8cSThomas Abraham | (AUDIO2_SEL << 16) \ 831*77b55e8cSThomas Abraham | (AUDIO2_SEL << 12) \ 832*77b55e8cSThomas Abraham | (AUDIO2_SEL << 8)) 833*77b55e8cSThomas Abraham 834*77b55e8cSThomas Abraham /* CLK_DIV_PERIC0 */ 835*77b55e8cSThomas Abraham #define PWM_RATIO 8 836*77b55e8cSThomas Abraham #define UART4_RATIO 9 837*77b55e8cSThomas Abraham #define UART3_RATIO 9 838*77b55e8cSThomas Abraham #define UART2_RATIO 9 839*77b55e8cSThomas Abraham #define UART1_RATIO 9 840*77b55e8cSThomas Abraham #define UART0_RATIO 9 841*77b55e8cSThomas Abraham 842*77b55e8cSThomas Abraham #define CLK_DIV_PERIC0_VAL ((PWM_RATIO << 28) \ 843*77b55e8cSThomas Abraham | (UART4_RATIO << 24) \ 844*77b55e8cSThomas Abraham | (UART3_RATIO << 20) \ 845*77b55e8cSThomas Abraham | (UART2_RATIO << 16) \ 846*77b55e8cSThomas Abraham | (UART1_RATIO << 12) \ 847*77b55e8cSThomas Abraham | (UART0_RATIO << 8)) 848*77b55e8cSThomas Abraham /* CLK_DIV_PERIC1 */ 849*77b55e8cSThomas Abraham #define SPI2_RATIO 0x1 850*77b55e8cSThomas Abraham #define SPI1_RATIO 0x1 851*77b55e8cSThomas Abraham #define SPI0_RATIO 0x1 852*77b55e8cSThomas Abraham #define CLK_DIV_PERIC1_VAL ((SPI2_RATIO << 28) \ 853*77b55e8cSThomas Abraham | (SPI1_RATIO << 24) \ 854*77b55e8cSThomas Abraham | (SPI0_RATIO << 20)) 855*77b55e8cSThomas Abraham 856*77b55e8cSThomas Abraham /* CLK_DIV_PERIC2 */ 857*77b55e8cSThomas Abraham #define PCM2_RATIO 0x3 858*77b55e8cSThomas Abraham #define PCM1_RATIO 0x3 859*77b55e8cSThomas Abraham #define CLK_DIV_PERIC2_VAL ((PCM2_RATIO << 24) \ 860*77b55e8cSThomas Abraham | (PCM1_RATIO << 16)) 861*77b55e8cSThomas Abraham 862*77b55e8cSThomas Abraham /* CLK_DIV_PERIC3 */ 863*77b55e8cSThomas Abraham #define AUDIO2_RATIO 0x5 864*77b55e8cSThomas Abraham #define AUDIO1_RATIO 0x5 865*77b55e8cSThomas Abraham #define AUDIO0_RATIO 0x5 866*77b55e8cSThomas Abraham #define CLK_DIV_PERIC3_VAL ((AUDIO2_RATIO << 28) \ 867*77b55e8cSThomas Abraham | (AUDIO1_RATIO << 24) \ 868*77b55e8cSThomas Abraham | (AUDIO0_RATIO << 20)) 869*77b55e8cSThomas Abraham 870*77b55e8cSThomas Abraham /* CLK_DIV_PERIC4 */ 871*77b55e8cSThomas Abraham #define SPI2_PRE_RATIO 0x2 872*77b55e8cSThomas Abraham #define SPI1_PRE_RATIO 0x2 873*77b55e8cSThomas Abraham #define SPI0_PRE_RATIO 0x2 874*77b55e8cSThomas Abraham #define CLK_DIV_PERIC4_VAL ((SPI2_PRE_RATIO << 24) \ 875*77b55e8cSThomas Abraham | (SPI1_PRE_RATIO << 16) \ 876*77b55e8cSThomas Abraham | (SPI0_PRE_RATIO << 8)) 877*77b55e8cSThomas Abraham 878*77b55e8cSThomas Abraham /* CLK_SRC_DISP1_0 */ 879*77b55e8cSThomas Abraham #define CLK_SRC_DISP1_0_VAL 0x10666600 880*77b55e8cSThomas Abraham #define CLK_DIV_DISP1_0_VAL 0x01050211 881*77b55e8cSThomas Abraham 882*77b55e8cSThomas Abraham #define APLL_FOUT (1 << 0) 883*77b55e8cSThomas Abraham #define KPLL_FOUT (1 << 0) 884*77b55e8cSThomas Abraham 885*77b55e8cSThomas Abraham #define CLK_DIV_CPERI1_VAL 0x3f3f0000 886*77b55e8cSThomas Abraham #endif 887*77b55e8cSThomas Abraham 888*77b55e8cSThomas Abraham struct mem_timings; 889*77b55e8cSThomas Abraham 890*77b55e8cSThomas Abraham /* Errors that we can encourter in low-level setup */ 891*77b55e8cSThomas Abraham enum { 892*77b55e8cSThomas Abraham SETUP_ERR_OK, 893*77b55e8cSThomas Abraham SETUP_ERR_RDLV_COMPLETE_TIMEOUT = -1, 894*77b55e8cSThomas Abraham SETUP_ERR_ZQ_CALIBRATION_FAILURE = -2, 895*77b55e8cSThomas Abraham }; 896*77b55e8cSThomas Abraham 897*77b55e8cSThomas Abraham /* 898*77b55e8cSThomas Abraham * Memory variant specific initialization code for DDR3 899*77b55e8cSThomas Abraham * 900*77b55e8cSThomas Abraham * @param mem Memory timings for this memory type. 901*77b55e8cSThomas Abraham * @param reset Reset DDR PHY during initialization. 902*77b55e8cSThomas Abraham * @return 0 if ok, SETUP_ERR_... if there is a problem 903*77b55e8cSThomas Abraham */ 904*77b55e8cSThomas Abraham int ddr3_mem_ctrl_init(struct mem_timings *mem, int reset); 905*77b55e8cSThomas Abraham 906*77b55e8cSThomas Abraham /* Memory variant specific initialization code for LPDDR3 */ 907*77b55e8cSThomas Abraham void lpddr3_mem_ctrl_init(void); 908*77b55e8cSThomas Abraham 909*77b55e8cSThomas Abraham /* 910*77b55e8cSThomas Abraham * Configure ZQ I/O interface 911*77b55e8cSThomas Abraham * 912*77b55e8cSThomas Abraham * @param mem Memory timings for this memory type. 913*77b55e8cSThomas Abraham * @param phy0_con16 Register address for dmc_phy0->phy_con16 914*77b55e8cSThomas Abraham * @param phy1_con16 Register address for dmc_phy1->phy_con16 915*77b55e8cSThomas Abraham * @param phy0_con17 Register address for dmc_phy0->phy_con17 916*77b55e8cSThomas Abraham * @param phy1_con17 Register address for dmc_phy1->phy_con17 917*77b55e8cSThomas Abraham * @return 0 if ok, -1 on error 918*77b55e8cSThomas Abraham */ 919*77b55e8cSThomas Abraham int dmc_config_zq(struct mem_timings *mem, uint32_t *phy0_con16, 920*77b55e8cSThomas Abraham uint32_t *phy1_con16, uint32_t *phy0_con17, 921*77b55e8cSThomas Abraham uint32_t *phy1_con17); 922*77b55e8cSThomas Abraham /* 923*77b55e8cSThomas Abraham * Send NOP and MRS/EMRS Direct commands 924*77b55e8cSThomas Abraham * 925*77b55e8cSThomas Abraham * @param mem Memory timings for this memory type. 926*77b55e8cSThomas Abraham * @param directcmd Register address for dmc_phy->directcmd 927*77b55e8cSThomas Abraham */ 928*77b55e8cSThomas Abraham void dmc_config_mrs(struct mem_timings *mem, uint32_t *directcmd); 929*77b55e8cSThomas Abraham 930*77b55e8cSThomas Abraham /* 931*77b55e8cSThomas Abraham * Send PALL Direct commands 932*77b55e8cSThomas Abraham * 933*77b55e8cSThomas Abraham * @param mem Memory timings for this memory type. 934*77b55e8cSThomas Abraham * @param directcmd Register address for dmc_phy->directcmd 935*77b55e8cSThomas Abraham */ 936*77b55e8cSThomas Abraham void dmc_config_prech(struct mem_timings *mem, uint32_t *directcmd); 937*77b55e8cSThomas Abraham 938*77b55e8cSThomas Abraham /* 939*77b55e8cSThomas Abraham * Reset the DLL. This function is common between DDR3 and LPDDR2. 940*77b55e8cSThomas Abraham * However, the reset value is different. So we are passing a flag 941*77b55e8cSThomas Abraham * ddr_mode to distinguish between LPDDR2 and DDR3. 942*77b55e8cSThomas Abraham * 943*77b55e8cSThomas Abraham * @param phycontrol0 Register address for dmc_phy->phycontrol0 944*77b55e8cSThomas Abraham * @param ddr_mode Type of DDR memory 945*77b55e8cSThomas Abraham */ 946*77b55e8cSThomas Abraham void update_reset_dll(uint32_t *phycontrol0, enum ddr_mode); 947*77b55e8cSThomas Abraham #endif 948