Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 2 | /* |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 3 | * Machine Specific Values for EXYNOS4012 based board |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 4 | * |
| 5 | * Copyright (C) 2011 Samsung Electronics |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _ORIGEN_SETUP_H |
| 9 | #define _ORIGEN_SETUP_H |
| 10 | |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 11 | #include <asm/arch/cpu.h> |
| 12 | |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 13 | /* Bus Configuration Register Address */ |
| 14 | #define ASYNC_CONFIG 0x10010350 |
| 15 | |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 16 | /* CLK_SRC_CPU */ |
| 17 | #define MUX_HPM_SEL_MOUTAPLL 0x0 |
| 18 | #define MUX_HPM_SEL_SCLKMPLL 0x1 |
| 19 | #define MUX_CORE_SEL_MOUTAPLL 0x0 |
| 20 | #define MUX_CORE_SEL_SCLKMPLL 0x1 |
| 21 | #define MUX_MPLL_SEL_FILPLL 0x0 |
| 22 | #define MUX_MPLL_SEL_MOUTMPLLFOUT 0x1 |
| 23 | #define MUX_APLL_SEL_FILPLL 0x0 |
| 24 | #define MUX_APLL_SEL_MOUTMPLLFOUT 0x1 |
| 25 | #define CLK_SRC_CPU_VAL ((MUX_HPM_SEL_MOUTAPLL << 20) \ |
| 26 | | (MUX_CORE_SEL_MOUTAPLL << 16) \ |
| 27 | | (MUX_MPLL_SEL_MOUTMPLLFOUT << 8)\ |
| 28 | | (MUX_APLL_SEL_MOUTMPLLFOUT << 0)) |
| 29 | |
| 30 | /* CLK_DIV_CPU0 */ |
| 31 | #define APLL_RATIO 0x0 |
| 32 | #define PCLK_DBG_RATIO 0x1 |
| 33 | #define ATB_RATIO 0x3 |
| 34 | #define PERIPH_RATIO 0x3 |
| 35 | #define COREM1_RATIO 0x7 |
| 36 | #define COREM0_RATIO 0x3 |
| 37 | #define CORE_RATIO 0x0 |
| 38 | #define CLK_DIV_CPU0_VAL ((APLL_RATIO << 24) \ |
| 39 | | (PCLK_DBG_RATIO << 20) \ |
| 40 | | (ATB_RATIO << 16) \ |
| 41 | | (PERIPH_RATIO << 12) \ |
| 42 | | (COREM1_RATIO << 8) \ |
| 43 | | (COREM0_RATIO << 4) \ |
| 44 | | (CORE_RATIO << 0)) |
| 45 | |
| 46 | /* CLK_DIV_CPU1 */ |
| 47 | #define HPM_RATIO 0x0 |
| 48 | #define COPY_RATIO 0x3 |
| 49 | #define CLK_DIV_CPU1_VAL ((HPM_RATIO << 4) | (COPY_RATIO)) |
| 50 | |
| 51 | /* CLK_SRC_DMC */ |
| 52 | #define MUX_PWI_SEL_XXTI 0x0 |
| 53 | #define MUX_PWI_SEL_XUSBXTI 0x1 |
| 54 | #define MUX_PWI_SEL_SCLK_HDMI24M 0x2 |
| 55 | #define MUX_PWI_SEL_SCLK_USBPHY0 0x3 |
| 56 | #define MUX_PWI_SEL_SCLK_USBPHY1 0x4 |
| 57 | #define MUX_PWI_SEL_SCLK_HDMIPHY 0x5 |
| 58 | #define MUX_PWI_SEL_SCLKMPLL 0x6 |
| 59 | #define MUX_PWI_SEL_SCLKEPLL 0x7 |
| 60 | #define MUX_PWI_SEL_SCLKVPLL 0x8 |
| 61 | #define MUX_DPHY_SEL_SCLKMPLL 0x0 |
| 62 | #define MUX_DPHY_SEL_SCLKAPLL 0x1 |
| 63 | #define MUX_DMC_BUS_SEL_SCLKMPLL 0x0 |
| 64 | #define MUX_DMC_BUS_SEL_SCLKAPLL 0x1 |
| 65 | #define CLK_SRC_DMC_VAL ((MUX_PWI_SEL_XUSBXTI << 16) \ |
| 66 | | (MUX_DPHY_SEL_SCLKMPLL << 8) \ |
| 67 | | (MUX_DMC_BUS_SEL_SCLKMPLL << 4)) |
| 68 | |
| 69 | /* CLK_DIV_DMC0 */ |
| 70 | #define CORE_TIMERS_RATIO 0x1 |
| 71 | #define COPY2_RATIO 0x3 |
| 72 | #define DMCP_RATIO 0x1 |
| 73 | #define DMCD_RATIO 0x1 |
| 74 | #define DMC_RATIO 0x1 |
| 75 | #define DPHY_RATIO 0x1 |
| 76 | #define ACP_PCLK_RATIO 0x1 |
| 77 | #define ACP_RATIO 0x3 |
| 78 | #define CLK_DIV_DMC0_VAL ((CORE_TIMERS_RATIO << 28) \ |
| 79 | | (COPY2_RATIO << 24) \ |
| 80 | | (DMCP_RATIO << 20) \ |
| 81 | | (DMCD_RATIO << 16) \ |
| 82 | | (DMC_RATIO << 12) \ |
| 83 | | (DPHY_RATIO << 8) \ |
| 84 | | (ACP_PCLK_RATIO << 4) \ |
| 85 | | (ACP_RATIO << 0)) |
| 86 | |
| 87 | /* CLK_DIV_DMC1 */ |
| 88 | #define DPM_RATIO 0x1 |
| 89 | #define DVSEM_RATIO 0x1 |
| 90 | #define PWI_RATIO 0x1 |
| 91 | #define CLK_DIV_DMC1_VAL ((DPM_RATIO << 24) \ |
| 92 | | (DVSEM_RATIO << 16) \ |
| 93 | | (PWI_RATIO << 8)) |
| 94 | |
| 95 | /* CLK_SRC_TOP0 */ |
| 96 | #define MUX_ONENAND_SEL_ACLK_133 0x0 |
| 97 | #define MUX_ONENAND_SEL_ACLK_160 0x1 |
| 98 | #define MUX_ACLK_133_SEL_SCLKMPLL 0x0 |
| 99 | #define MUX_ACLK_133_SEL_SCLKAPLL 0x1 |
| 100 | #define MUX_ACLK_160_SEL_SCLKMPLL 0x0 |
| 101 | #define MUX_ACLK_160_SEL_SCLKAPLL 0x1 |
| 102 | #define MUX_ACLK_100_SEL_SCLKMPLL 0x0 |
| 103 | #define MUX_ACLK_100_SEL_SCLKAPLL 0x1 |
| 104 | #define MUX_ACLK_200_SEL_SCLKMPLL 0x0 |
| 105 | #define MUX_ACLK_200_SEL_SCLKAPLL 0x1 |
| 106 | #define MUX_VPLL_SEL_FINPLL 0x0 |
| 107 | #define MUX_VPLL_SEL_FOUTVPLL 0x1 |
| 108 | #define MUX_EPLL_SEL_FINPLL 0x0 |
| 109 | #define MUX_EPLL_SEL_FOUTEPLL 0x1 |
| 110 | #define MUX_ONENAND_1_SEL_MOUTONENAND 0x0 |
| 111 | #define MUX_ONENAND_1_SEL_SCLKVPLL 0x1 |
| 112 | #define CLK_SRC_TOP0_VAL ((MUX_ONENAND_SEL_ACLK_133 << 28) \ |
| 113 | | (MUX_ACLK_133_SEL_SCLKMPLL << 24) \ |
| 114 | | (MUX_ACLK_160_SEL_SCLKMPLL << 20) \ |
| 115 | | (MUX_ACLK_100_SEL_SCLKMPLL << 16) \ |
| 116 | | (MUX_ACLK_200_SEL_SCLKMPLL << 12) \ |
| 117 | | (MUX_VPLL_SEL_FINPLL << 8) \ |
| 118 | | (MUX_EPLL_SEL_FINPLL << 4)\ |
| 119 | | (MUX_ONENAND_1_SEL_MOUTONENAND << 0)) |
| 120 | |
| 121 | /* CLK_SRC_TOP1 */ |
| 122 | #define VPLLSRC_SEL_FINPLL 0x0 |
| 123 | #define VPLLSRC_SEL_SCLKHDMI24M 0x1 |
| 124 | #define CLK_SRC_TOP1_VAL (VPLLSRC_SEL_FINPLL) |
| 125 | |
| 126 | /* CLK_DIV_TOP */ |
| 127 | #define ONENAND_RATIO 0x0 |
| 128 | #define ACLK_133_RATIO 0x5 |
| 129 | #define ACLK_160_RATIO 0x4 |
| 130 | #define ACLK_100_RATIO 0x7 |
| 131 | #define ACLK_200_RATIO 0x3 |
| 132 | #define CLK_DIV_TOP_VAL ((ONENAND_RATIO << 16) \ |
| 133 | | (ACLK_133_RATIO << 12)\ |
| 134 | | (ACLK_160_RATIO << 8) \ |
| 135 | | (ACLK_100_RATIO << 4) \ |
| 136 | | (ACLK_200_RATIO << 0)) |
| 137 | |
| 138 | /* CLK_SRC_LEFTBUS */ |
| 139 | #define MUX_GDL_SEL_SCLKMPLL 0x0 |
| 140 | #define MUX_GDL_SEL_SCLKAPLL 0x1 |
| 141 | #define CLK_SRC_LEFTBUS_VAL (MUX_GDL_SEL_SCLKMPLL) |
| 142 | |
| 143 | /* CLK_DIV_LEFTBUS */ |
| 144 | #define GPL_RATIO 0x1 |
| 145 | #define GDL_RATIO 0x3 |
| 146 | #define CLK_DIV_LEFTBUS_VAL ((GPL_RATIO << 4) | (GDL_RATIO)) |
| 147 | |
| 148 | /* CLK_SRC_RIGHTBUS */ |
| 149 | #define MUX_GDR_SEL_SCLKMPLL 0x0 |
| 150 | #define MUX_GDR_SEL_SCLKAPLL 0x1 |
| 151 | #define CLK_SRC_RIGHTBUS_VAL (MUX_GDR_SEL_SCLKMPLL) |
| 152 | |
| 153 | /* CLK_DIV_RIGHTBUS */ |
| 154 | #define GPR_RATIO 0x1 |
| 155 | #define GDR_RATIO 0x3 |
| 156 | #define CLK_DIV_RIGHTBUS_VAL ((GPR_RATIO << 4) | (GDR_RATIO)) |
| 157 | |
| 158 | /* CLK_SRS_FSYS: 6 = SCLKMPLL */ |
| 159 | #define SATA_SEL_SCLKMPLL 0 |
| 160 | #define SATA_SEL_SCLKAPLL 1 |
| 161 | |
| 162 | #define MMC_SEL_XXTI 0 |
| 163 | #define MMC_SEL_XUSBXTI 1 |
| 164 | #define MMC_SEL_SCLK_HDMI24M 2 |
| 165 | #define MMC_SEL_SCLK_USBPHY0 3 |
| 166 | #define MMC_SEL_SCLK_USBPHY1 4 |
| 167 | #define MMC_SEL_SCLK_HDMIPHY 5 |
| 168 | #define MMC_SEL_SCLKMPLL 6 |
| 169 | #define MMC_SEL_SCLKEPLL 7 |
| 170 | #define MMC_SEL_SCLKVPLL 8 |
| 171 | |
| 172 | #define MMCC0_SEL MMC_SEL_SCLKMPLL |
| 173 | #define MMCC1_SEL MMC_SEL_SCLKMPLL |
| 174 | #define MMCC2_SEL MMC_SEL_SCLKMPLL |
| 175 | #define MMCC3_SEL MMC_SEL_SCLKMPLL |
| 176 | #define MMCC4_SEL MMC_SEL_SCLKMPLL |
| 177 | #define CLK_SRC_FSYS_VAL ((SATA_SEL_SCLKMPLL << 24) \ |
| 178 | | (MMCC4_SEL << 16) \ |
| 179 | | (MMCC3_SEL << 12) \ |
| 180 | | (MMCC2_SEL << 8) \ |
| 181 | | (MMCC1_SEL << 4) \ |
| 182 | | (MMCC0_SEL << 0)) |
| 183 | |
| 184 | /* SCLK_MMC[0-4] = MOUTMMC[0-4]/(MMC[0-4]_RATIO + 1)/(MMC[0-4]_PRE_RATIO +1) */ |
| 185 | /* CLK_DIV_FSYS1 */ |
| 186 | #define MMC0_RATIO 0xF |
| 187 | #define MMC0_PRE_RATIO 0x0 |
| 188 | #define MMC1_RATIO 0xF |
| 189 | #define MMC1_PRE_RATIO 0x0 |
| 190 | #define CLK_DIV_FSYS1_VAL ((MMC1_PRE_RATIO << 24) \ |
| 191 | | (MMC1_RATIO << 16) \ |
| 192 | | (MMC0_PRE_RATIO << 8) \ |
| 193 | | (MMC0_RATIO << 0)) |
| 194 | |
| 195 | /* CLK_DIV_FSYS2 */ |
| 196 | #define MMC2_RATIO 0xF |
| 197 | #define MMC2_PRE_RATIO 0x0 |
| 198 | #define MMC3_RATIO 0xF |
| 199 | #define MMC3_PRE_RATIO 0x0 |
| 200 | #define CLK_DIV_FSYS2_VAL ((MMC3_PRE_RATIO << 24) \ |
| 201 | | (MMC3_RATIO << 16) \ |
| 202 | | (MMC2_PRE_RATIO << 8) \ |
| 203 | | (MMC2_RATIO << 0)) |
| 204 | |
| 205 | /* CLK_DIV_FSYS3 */ |
| 206 | #define MMC4_RATIO 0xF |
| 207 | #define MMC4_PRE_RATIO 0x0 |
| 208 | #define CLK_DIV_FSYS3_VAL ((MMC4_PRE_RATIO << 8) \ |
| 209 | | (MMC4_RATIO << 0)) |
| 210 | |
| 211 | /* CLK_SRC_PERIL0 */ |
| 212 | #define UART_SEL_XXTI 0 |
| 213 | #define UART_SEL_XUSBXTI 1 |
| 214 | #define UART_SEL_SCLK_HDMI24M 2 |
| 215 | #define UART_SEL_SCLK_USBPHY0 3 |
| 216 | #define UART_SEL_SCLK_USBPHY1 4 |
| 217 | #define UART_SEL_SCLK_HDMIPHY 5 |
| 218 | #define UART_SEL_SCLKMPLL 6 |
| 219 | #define UART_SEL_SCLKEPLL 7 |
| 220 | #define UART_SEL_SCLKVPLL 8 |
| 221 | |
| 222 | #define UART0_SEL UART_SEL_SCLKMPLL |
| 223 | #define UART1_SEL UART_SEL_SCLKMPLL |
| 224 | #define UART2_SEL UART_SEL_SCLKMPLL |
| 225 | #define UART3_SEL UART_SEL_SCLKMPLL |
| 226 | #define UART4_SEL UART_SEL_SCLKMPLL |
| 227 | #define CLK_SRC_PERIL0_VAL ((UART4_SEL << 16) \ |
| 228 | | (UART3_SEL << 12) \ |
| 229 | | (UART2_SEL << 8) \ |
| 230 | | (UART1_SEL << 4) \ |
| 231 | | (UART0_SEL << 0)) |
| 232 | |
| 233 | /* SCLK_UART[0-4] = MOUTUART[0-4]/(UART[0-4]_RATIO + 1) */ |
| 234 | /* CLK_DIV_PERIL0 */ |
| 235 | #define UART0_RATIO 7 |
| 236 | #define UART1_RATIO 7 |
| 237 | #define UART2_RATIO 7 |
| 238 | #define UART3_RATIO 7 |
| 239 | #define UART4_RATIO 7 |
| 240 | #define CLK_DIV_PERIL0_VAL ((UART4_RATIO << 16) \ |
| 241 | | (UART3_RATIO << 12) \ |
| 242 | | (UART2_RATIO << 8) \ |
| 243 | | (UART1_RATIO << 4) \ |
| 244 | | (UART0_RATIO << 0)) |
| 245 | |
Annamalai Lakshmanan | 59988c2 | 2012-08-30 20:33:58 +0000 | [diff] [blame] | 246 | /* Clock Source CAM/FIMC */ |
| 247 | /* CLK_SRC_CAM */ |
| 248 | #define CAM0_SEL_XUSBXTI 1 |
| 249 | #define CAM1_SEL_XUSBXTI 1 |
| 250 | #define CSIS0_SEL_XUSBXTI 1 |
| 251 | #define CSIS1_SEL_XUSBXTI 1 |
| 252 | |
| 253 | #define FIMC_SEL_SCLKMPLL 6 |
| 254 | #define FIMC0_LCLK_SEL FIMC_SEL_SCLKMPLL |
| 255 | #define FIMC1_LCLK_SEL FIMC_SEL_SCLKMPLL |
| 256 | #define FIMC2_LCLK_SEL FIMC_SEL_SCLKMPLL |
| 257 | #define FIMC3_LCLK_SEL FIMC_SEL_SCLKMPLL |
| 258 | |
| 259 | #define CLK_SRC_CAM_VAL ((CSIS1_SEL_XUSBXTI << 28) \ |
| 260 | | (CSIS0_SEL_XUSBXTI << 24) \ |
| 261 | | (CAM1_SEL_XUSBXTI << 20) \ |
| 262 | | (CAM0_SEL_XUSBXTI << 16) \ |
| 263 | | (FIMC3_LCLK_SEL << 12) \ |
| 264 | | (FIMC2_LCLK_SEL << 8) \ |
| 265 | | (FIMC1_LCLK_SEL << 4) \ |
| 266 | | (FIMC0_LCLK_SEL << 0)) |
| 267 | |
| 268 | /* SCLK CAM */ |
| 269 | /* CLK_DIV_CAM */ |
| 270 | #define FIMC0_LCLK_RATIO 4 |
| 271 | #define FIMC1_LCLK_RATIO 4 |
| 272 | #define FIMC2_LCLK_RATIO 4 |
| 273 | #define FIMC3_LCLK_RATIO 4 |
| 274 | #define CLK_DIV_CAM_VAL ((FIMC3_LCLK_RATIO << 12) \ |
| 275 | | (FIMC2_LCLK_RATIO << 8) \ |
| 276 | | (FIMC1_LCLK_RATIO << 4) \ |
| 277 | | (FIMC0_LCLK_RATIO << 0)) |
| 278 | |
| 279 | /* SCLK MFC */ |
| 280 | /* CLK_SRC_MFC */ |
| 281 | #define MFC_SEL_MPLL 0 |
| 282 | #define MOUTMFC_0 0 |
| 283 | #define MFC_SEL MOUTMFC_0 |
| 284 | #define MFC_0_SEL MFC_SEL_MPLL |
| 285 | #define CLK_SRC_MFC_VAL ((MFC_SEL << 8) | (MFC_0_SEL)) |
| 286 | |
| 287 | |
| 288 | /* CLK_DIV_MFC */ |
| 289 | #define MFC_RATIO 3 |
| 290 | #define CLK_DIV_MFC_VAL (MFC_RATIO) |
| 291 | |
| 292 | /* SCLK G3D */ |
| 293 | /* CLK_SRC_G3D */ |
| 294 | #define G3D_SEL_MPLL 0 |
| 295 | #define MOUTG3D_0 0 |
| 296 | #define G3D_SEL MOUTG3D_0 |
| 297 | #define G3D_0_SEL G3D_SEL_MPLL |
| 298 | #define CLK_SRC_G3D_VAL ((G3D_SEL << 8) | (G3D_0_SEL)) |
| 299 | |
| 300 | /* CLK_DIV_G3D */ |
| 301 | #define G3D_RATIO 1 |
| 302 | #define CLK_DIV_G3D_VAL (G3D_RATIO) |
| 303 | |
| 304 | /* SCLK LCD0 */ |
Chander Kashyap | 5fc569a | 2011-12-18 20:16:32 +0000 | [diff] [blame] | 305 | /* CLK_SRC_LCD0 */ |
| 306 | #define FIMD_SEL_SCLKMPLL 6 |
| 307 | #define MDNIE0_SEL_XUSBXTI 1 |
| 308 | #define MDNIE_PWM0_SEL_XUSBXTI 1 |
| 309 | #define MIPI0_SEL_XUSBXTI 1 |
| 310 | #define CLK_SRC_LCD0_VAL ((MIPI0_SEL_XUSBXTI << 12) \ |
| 311 | | (MDNIE_PWM0_SEL_XUSBXTI << 8) \ |
| 312 | | (MDNIE0_SEL_XUSBXTI << 4) \ |
| 313 | | (FIMD_SEL_SCLKMPLL << 0)) |
| 314 | |
Annamalai Lakshmanan | 59988c2 | 2012-08-30 20:33:58 +0000 | [diff] [blame] | 315 | /* CLK_DIV_LCD0 */ |
| 316 | #define FIMD0_RATIO 4 |
| 317 | #define CLK_DIV_LCD0_VAL (FIMD0_RATIO) |
| 318 | |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 319 | /* Required period to generate a stable clock output */ |
| 320 | /* PLL_LOCK_TIME */ |
| 321 | #define PLL_LOCKTIME 0x1C20 |
| 322 | |
| 323 | /* PLL Values */ |
| 324 | #define DISABLE 0 |
| 325 | #define ENABLE 1 |
| 326 | #define SET_PLL(mdiv, pdiv, sdiv) ((ENABLE << 31)\ |
| 327 | | (mdiv << 16) \ |
| 328 | | (pdiv << 8) \ |
| 329 | | (sdiv << 0)) |
| 330 | |
| 331 | /* APLL_CON0 */ |
| 332 | #define APLL_MDIV 0xFA |
| 333 | #define APLL_PDIV 0x6 |
| 334 | #define APLL_SDIV 0x1 |
| 335 | #define APLL_CON0_VAL SET_PLL(APLL_MDIV, APLL_PDIV, APLL_SDIV) |
| 336 | |
| 337 | /* APLL_CON1 */ |
| 338 | #define APLL_AFC_ENB 0x1 |
| 339 | #define APLL_AFC 0xC |
| 340 | #define APLL_CON1_VAL ((APLL_AFC_ENB << 31) | (APLL_AFC << 0)) |
| 341 | |
| 342 | /* MPLL_CON0 */ |
| 343 | #define MPLL_MDIV 0xC8 |
| 344 | #define MPLL_PDIV 0x6 |
| 345 | #define MPLL_SDIV 0x1 |
| 346 | #define MPLL_CON0_VAL SET_PLL(MPLL_MDIV, MPLL_PDIV, MPLL_SDIV) |
| 347 | |
| 348 | /* MPLL_CON1 */ |
| 349 | #define MPLL_AFC_ENB 0x0 |
| 350 | #define MPLL_AFC 0x1C |
| 351 | #define MPLL_CON1_VAL ((MPLL_AFC_ENB << 31) | (MPLL_AFC << 0)) |
| 352 | |
| 353 | /* EPLL_CON0 */ |
| 354 | #define EPLL_MDIV 0x30 |
| 355 | #define EPLL_PDIV 0x3 |
| 356 | #define EPLL_SDIV 0x2 |
| 357 | #define EPLL_CON0_VAL SET_PLL(EPLL_MDIV, EPLL_PDIV, EPLL_SDIV) |
| 358 | |
| 359 | /* EPLL_CON1 */ |
| 360 | #define EPLL_K 0x0 |
| 361 | #define EPLL_CON1_VAL (EPLL_K >> 0) |
| 362 | |
| 363 | /* VPLL_CON0 */ |
| 364 | #define VPLL_MDIV 0x35 |
| 365 | #define VPLL_PDIV 0x3 |
| 366 | #define VPLL_SDIV 0x2 |
| 367 | #define VPLL_CON0_VAL SET_PLL(VPLL_MDIV, VPLL_PDIV, VPLL_SDIV) |
| 368 | |
| 369 | /* VPLL_CON1 */ |
| 370 | #define VPLL_SSCG_EN DISABLE |
| 371 | #define VPLL_SEL_PF_DN_SPREAD 0x0 |
| 372 | #define VPLL_MRR 0x11 |
| 373 | #define VPLL_MFR 0x0 |
| 374 | #define VPLL_K 0x400 |
| 375 | #define VPLL_CON1_VAL ((VPLL_SSCG_EN << 31)\ |
| 376 | | (VPLL_SEL_PF_DN_SPREAD << 29) \ |
| 377 | | (VPLL_MRR << 24) \ |
| 378 | | (VPLL_MFR << 16) \ |
| 379 | | (VPLL_K << 0)) |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 380 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 381 | /* DMC */ |
| 382 | #define DIRECT_CMD_NOP 0x07000000 |
| 383 | #define DIRECT_CMD_ZQ 0x0a000000 |
| 384 | #define DIRECT_CMD_CHIP1_SHIFT (1 << 20) |
| 385 | #define MEM_TIMINGS_MSR_COUNT 4 |
| 386 | #define CTRL_START (1 << 0) |
| 387 | #define CTRL_DLL_ON (1 << 1) |
| 388 | #define AREF_EN (1 << 5) |
| 389 | #define DRV_TYPE (1 << 6) |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 390 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 391 | struct mem_timings { |
| 392 | unsigned direct_cmd_msr[MEM_TIMINGS_MSR_COUNT]; |
| 393 | unsigned timingref; |
| 394 | unsigned timingrow; |
| 395 | unsigned timingdata; |
| 396 | unsigned timingpower; |
| 397 | unsigned zqcontrol; |
| 398 | unsigned control0; |
| 399 | unsigned control1; |
| 400 | unsigned control2; |
| 401 | unsigned concontrol; |
| 402 | unsigned prechconfig; |
| 403 | unsigned memcontrol; |
| 404 | unsigned memconfig0; |
| 405 | unsigned memconfig1; |
| 406 | unsigned dll_resync; |
| 407 | unsigned dll_on; |
| 408 | }; |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 409 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 410 | /* MIU */ |
| 411 | /* MIU Config Register Offsets*/ |
| 412 | #define APB_SFR_INTERLEAVE_CONF_OFFSET 0x400 |
| 413 | #define APB_SFR_ARBRITATION_CONF_OFFSET 0xC00 |
| 414 | #define ABP_SFR_SLV_ADDRMAP_CONF_OFFSET 0x800 |
| 415 | #define ABP_SFR_INTERLEAVE_ADDRMAP_START_OFFSET 0x808 |
| 416 | #define ABP_SFR_INTERLEAVE_ADDRMAP_END_OFFSET 0x810 |
| 417 | #define ABP_SFR_SLV0_SINGLE_ADDRMAP_START_OFFSET 0x818 |
| 418 | #define ABP_SFR_SLV0_SINGLE_ADDRMAP_END_OFFSET 0x820 |
| 419 | #define ABP_SFR_SLV1_SINGLE_ADDRMAP_START_OFFSET 0x828 |
| 420 | #define ABP_SFR_SLV1_SINGLE_ADDRMAP_END_OFFSET 0x830 |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 421 | |
Tom Rini | 893cd41 | 2022-06-10 22:59:33 -0400 | [diff] [blame] | 422 | #ifdef CONFIG_TARGET_ORIGEN |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 423 | /* Interleave: 2Bit, Interleave_bit1: 0x15, Interleave_bit0: 0x7 */ |
| 424 | #define APB_SFR_INTERLEAVE_CONF_VAL 0x20001507 |
| 425 | #define APB_SFR_ARBRITATION_CONF_VAL 0x00000001 |
| 426 | #endif |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 427 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 428 | #define INTERLEAVE_ADDR_MAP_START_ADDR 0x40000000 |
| 429 | #define INTERLEAVE_ADDR_MAP_END_ADDR 0xbfffffff |
| 430 | #define INTERLEAVE_ADDR_MAP_EN 0x00000001 |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 431 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 432 | #ifdef CONFIG_MIU_1BIT_INTERLEAVED |
| 433 | /* Interleave_bit0: 0xC*/ |
| 434 | #define APB_SFR_INTERLEAVE_CONF_VAL 0x0000000c |
| 435 | #endif |
| 436 | #ifdef CONFIG_MIU_2BIT_INTERLEAVED |
| 437 | /* Interleave: 2Bit, Interleave_bit1: 0x15, Interleave_bit0: 0xc */ |
| 438 | #define APB_SFR_INTERLEAVE_CONF_VAL 0x2000150c |
| 439 | #endif |
| 440 | #define SLAVE0_SINGLE_ADDR_MAP_START_ADDR 0x40000000 |
| 441 | #define SLAVE0_SINGLE_ADDR_MAP_END_ADDR 0x7fffffff |
| 442 | #define SLAVE1_SINGLE_ADDR_MAP_START_ADDR 0x80000000 |
| 443 | #define SLAVE1_SINGLE_ADDR_MAP_END_ADDR 0xbfffffff |
| 444 | /* Enable SME0 and SME1*/ |
| 445 | #define APB_SFR_SLV_ADDR_MAP_CONF_VAL 0x00000006 |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 446 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 447 | #define FORCE_DLL_RESYNC 3 |
| 448 | #define DLL_CONTROL_ON 1 |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 449 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 450 | #define DIRECT_CMD1 0x00020000 |
| 451 | #define DIRECT_CMD2 0x00030000 |
| 452 | #define DIRECT_CMD3 0x00010002 |
| 453 | #define DIRECT_CMD4 0x00000328 |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 454 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 455 | #define CTRL_ZQ_MODE_NOTERM (0x1 << 0) |
| 456 | #define CTRL_ZQ_START (0x1 << 1) |
| 457 | #define CTRL_ZQ_DIV (0 << 4) |
| 458 | #define CTRL_ZQ_MODE_DDS (0x7 << 8) |
| 459 | #define CTRL_ZQ_MODE_TERM (0x2 << 11) |
| 460 | #define CTRL_ZQ_FORCE_IMPN (0x5 << 14) |
| 461 | #define CTRL_ZQ_FORCE_IMPP (0x6 << 17) |
| 462 | #define CTRL_DCC (0xE38 << 20) |
| 463 | #define ZQ_CONTROL_VAL (CTRL_ZQ_MODE_NOTERM | CTRL_ZQ_START\ |
| 464 | | CTRL_ZQ_DIV | CTRL_ZQ_MODE_DDS\ |
| 465 | | CTRL_ZQ_MODE_TERM | CTRL_ZQ_FORCE_IMPN\ |
| 466 | | CTRL_ZQ_FORCE_IMPP | CTRL_DCC) |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 467 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 468 | #define ASYNC (0 << 0) |
| 469 | #define CLK_RATIO (1 << 1) |
| 470 | #define DIV_PIPE (1 << 3) |
| 471 | #define AWR_ON (1 << 4) |
| 472 | #define AREF_DISABLE (0 << 5) |
| 473 | #define DRV_TYPE_DISABLE (0 << 6) |
| 474 | #define CHIP0_NOT_EMPTY (0 << 8) |
| 475 | #define CHIP1_NOT_EMPTY (0 << 9) |
| 476 | #define DQ_SWAP_DISABLE (0 << 10) |
| 477 | #define QOS_FAST_DISABLE (0 << 11) |
| 478 | #define RD_FETCH (0x3 << 12) |
| 479 | #define TIMEOUT_LEVEL0 (0xFFF << 16) |
| 480 | #define CONCONTROL_VAL (ASYNC | CLK_RATIO | DIV_PIPE | AWR_ON\ |
| 481 | | AREF_DISABLE | DRV_TYPE_DISABLE\ |
| 482 | | CHIP0_NOT_EMPTY | CHIP1_NOT_EMPTY\ |
| 483 | | DQ_SWAP_DISABLE | QOS_FAST_DISABLE\ |
| 484 | | RD_FETCH | TIMEOUT_LEVEL0) |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 485 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 486 | #define CLK_STOP_DISABLE (0 << 1) |
| 487 | #define DPWRDN_DISABLE (0 << 2) |
| 488 | #define DPWRDN_TYPE (0 << 3) |
| 489 | #define TP_DISABLE (0 << 4) |
| 490 | #define DSREF_DIABLE (0 << 5) |
| 491 | #define ADD_LAT_PALL (1 << 6) |
| 492 | #define MEM_TYPE_DDR3 (0x6 << 8) |
| 493 | #define MEM_WIDTH_32 (0x2 << 12) |
| 494 | #define NUM_CHIP_2 (1 << 16) |
| 495 | #define BL_8 (0x3 << 20) |
| 496 | #define MEMCONTROL_VAL (CLK_STOP_DISABLE | DPWRDN_DISABLE\ |
| 497 | | DPWRDN_TYPE | TP_DISABLE | DSREF_DIABLE\ |
| 498 | | ADD_LAT_PALL | MEM_TYPE_DDR3 | MEM_WIDTH_32\ |
| 499 | | NUM_CHIP_2 | BL_8) |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 500 | |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 501 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 502 | #define CHIP_BANK_8 (0x3 << 0) |
| 503 | #define CHIP_ROW_14 (0x2 << 4) |
| 504 | #define CHIP_COL_10 (0x3 << 8) |
| 505 | #define CHIP_MAP_INTERLEAVED (1 << 12) |
| 506 | #define CHIP_MASK (0xe0 << 16) |
| 507 | #ifdef CONFIG_MIU_LINEAR |
| 508 | #define CHIP0_BASE (0x40 << 24) |
| 509 | #define CHIP1_BASE (0x60 << 24) |
| 510 | #else |
| 511 | #define CHIP0_BASE (0x20 << 24) |
| 512 | #define CHIP1_BASE (0x40 << 24) |
| 513 | #endif |
| 514 | #define MEMCONFIG0_VAL (CHIP_BANK_8 | CHIP_ROW_14 | CHIP_COL_10\ |
| 515 | | CHIP_MAP_INTERLEAVED | CHIP_MASK | CHIP0_BASE) |
| 516 | #define MEMCONFIG1_VAL (CHIP_BANK_8 | CHIP_ROW_14 | CHIP_COL_10\ |
| 517 | | CHIP_MAP_INTERLEAVED | CHIP_MASK | CHIP1_BASE) |
Chander Kashyap | 0e7ab68 | 2011-08-18 22:37:19 +0000 | [diff] [blame] | 518 | |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 519 | #define TP_CNT (0xff << 24) |
| 520 | #define PRECHCONFIG TP_CNT |
| 521 | |
| 522 | #define CTRL_OFF (0 << 0) |
| 523 | #define CTRL_DLL_OFF (0 << 1) |
| 524 | #define CTRL_HALF (0 << 2) |
| 525 | #define CTRL_DFDQS (1 << 3) |
| 526 | #define DQS_DELAY (0 << 4) |
| 527 | #define CTRL_START_POINT (0x10 << 8) |
| 528 | #define CTRL_INC (0x10 << 16) |
| 529 | #define CTRL_FORCE (0x71 << 24) |
| 530 | #define CONTROL0_VAL (CTRL_OFF | CTRL_DLL_OFF | CTRL_HALF\ |
| 531 | | CTRL_DFDQS | DQS_DELAY | CTRL_START_POINT\ |
| 532 | | CTRL_INC | CTRL_FORCE) |
| 533 | |
| 534 | #define CTRL_SHIFTC (0x6 << 0) |
| 535 | #define CTRL_REF (8 << 4) |
| 536 | #define CTRL_SHGATE (1 << 29) |
| 537 | #define TERM_READ_EN (1 << 30) |
| 538 | #define TERM_WRITE_EN (1 << 31) |
| 539 | #define CONTROL1_VAL (CTRL_SHIFTC | CTRL_REF | CTRL_SHGATE\ |
| 540 | | TERM_READ_EN | TERM_WRITE_EN) |
| 541 | |
| 542 | #define CONTROL2_VAL 0x00000000 |
| 543 | |
Tom Rini | 893cd41 | 2022-06-10 22:59:33 -0400 | [diff] [blame] | 544 | #ifdef CONFIG_TARGET_ORIGEN |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 545 | #define TIMINGREF_VAL 0x000000BB |
| 546 | #define TIMINGROW_VAL 0x4046654f |
| 547 | #define TIMINGDATA_VAL 0x46400506 |
| 548 | #define TIMINGPOWER_VAL 0x52000A3C |
| 549 | #else |
| 550 | #define TIMINGREF_VAL 0x000000BC |
Rajeshwari Shinde | bed2442 | 2013-07-04 12:29:17 +0530 | [diff] [blame] | 551 | #define TIMINGROW_VAL 0x45430506 |
| 552 | #define TIMINGDATA_VAL 0x56500506 |
| 553 | #define TIMINGPOWER_VAL 0x5444033d |
| 554 | #endif |
| 555 | #endif |