Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Soeren Moch | c12737c | 2018-01-28 12:26:34 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2017 Soeren Moch <smoch@web.de> |
Soeren Moch | c12737c | 2018-01-28 12:26:34 +0100 | [diff] [blame] | 4 | */ |
| 5 | |
Soeren Moch | c12737c | 2018-01-28 12:26:34 +0100 | [diff] [blame] | 6 | #include "asm/arch/crm_regs.h" |
| 7 | #include "asm/arch/iomux.h" |
| 8 | #include "asm/arch/mx6-ddr.h" |
| 9 | |
| 10 | /* image version 2 for imx6 */ |
| 11 | IMAGE_VERSION 2 |
| 12 | BOOT_FROM sd |
| 13 | |
| 14 | /* set the default clock gates to save power */ |
| 15 | DATA 4, CCM_CCGR0, 0x00C03F3F |
| 16 | DATA 4, CCM_CCGR1, 0x0030FC03 |
| 17 | DATA 4, CCM_CCGR2, 0x0FFFC000 |
| 18 | DATA 4, CCM_CCGR3, 0x3FF00000 |
| 19 | DATA 4, CCM_CCGR4, 0x00FFF300 |
| 20 | DATA 4, CCM_CCGR5, 0x0F0000C3 |
| 21 | DATA 4, CCM_CCGR6, 0x000003FF |
| 22 | /* set CKO1 (used as AUDIO_MCLK) to ahb_clk_root/8 = 16.5 MHz */ |
| 23 | DATA 4, CCM_CCOSR, 0x000000fb |
| 24 | |
| 25 | /* enable AXI cache for VDOA/VPU/IPU */ |
| 26 | DATA 4, MX6_IOMUXC_GPR4, 0xF00000CF |
| 27 | /* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */ |
| 28 | DATA 4, MX6_IOMUXC_GPR6, 0x77177717 |
| 29 | DATA 4, MX6_IOMUXC_GPR7, 0x77177717 |
| 30 | |
| 31 | |
| 32 | /* |
| 33 | * DDR3/DDR3L settings |
| 34 | * use default 40 Ohm pad drive strength, no odt |
| 35 | * 4x256Mx16 DDR3L-1066 7-7-7 |
| 36 | */ |
| 37 | |
| 38 | /* disable dq pullup */ |
| 39 | DATA 4, MX6_IOM_GRP_DDRPKE, 0x00000000 |
| 40 | /* disable dqs pullup */ |
| 41 | DATA 4, MX6_IOM_DRAM_SDQS0, 0x00000030 |
| 42 | DATA 4, MX6_IOM_DRAM_SDQS1, 0x00000030 |
| 43 | DATA 4, MX6_IOM_DRAM_SDQS2, 0x00000030 |
| 44 | DATA 4, MX6_IOM_DRAM_SDQS3, 0x00000030 |
| 45 | DATA 4, MX6_IOM_DRAM_SDQS4, 0x00000030 |
| 46 | DATA 4, MX6_IOM_DRAM_SDQS5, 0x00000030 |
| 47 | DATA 4, MX6_IOM_DRAM_SDQS6, 0x00000030 |
| 48 | DATA 4, MX6_IOM_DRAM_SDQS7, 0x00000030 |
| 49 | /* set ddr input mode for dq signals */ |
| 50 | DATA 4, MX6_IOM_GRP_DDRMODE, 0x00020000 |
| 51 | /* set ddr input mode for dqs signals */ |
| 52 | DATA 4, MX6_IOM_DDRMODE_CTL, 0x00020000 |
| 53 | /* set pad calibration type to DDR3 */ |
| 54 | DATA 4, MX6_IOM_GRP_DDR_TYPE, 0x000C0000 |
| 55 | /* ZQ calibration */ |
| 56 | DATA 4, MX6_MMDC_P0_MPZQHWCTRL, 0xA1390003 |
| 57 | /* dqs write delay */ |
| 58 | DATA 4, MX6_MMDC_P0_MPWLDECTRL0, 0x001f001f |
| 59 | DATA 4, MX6_MMDC_P0_MPWLDECTRL1, 0x001f001f |
| 60 | DATA 4, MX6_MMDC_P1_MPWLDECTRL0, 0x001f001f |
| 61 | DATA 4, MX6_MMDC_P1_MPWLDECTRL1, 0x001f001f |
| 62 | /* dqs read delay */ |
| 63 | DATA 4, MX6_MMDC_P0_MPRDDQBY0DL, 0x33333333 |
| 64 | DATA 4, MX6_MMDC_P0_MPRDDQBY1DL, 0x33333333 |
| 65 | DATA 4, MX6_MMDC_P0_MPRDDQBY2DL, 0x33333333 |
| 66 | DATA 4, MX6_MMDC_P0_MPRDDQBY3DL, 0x33333333 |
| 67 | DATA 4, MX6_MMDC_P1_MPRDDQBY0DL, 0x33333333 |
| 68 | DATA 4, MX6_MMDC_P1_MPRDDQBY1DL, 0x33333333 |
| 69 | DATA 4, MX6_MMDC_P1_MPRDDQBY2DL, 0x33333333 |
| 70 | DATA 4, MX6_MMDC_P1_MPRDDQBY3DL, 0x33333333 |
| 71 | /* dqs read gating control */ |
| 72 | DATA 4, MX6_MMDC_P0_MPDGCTRL0, 0x43000300 |
| 73 | DATA 4, MX6_MMDC_P0_MPDGCTRL1, 0x03000300 |
| 74 | DATA 4, MX6_MMDC_P1_MPDGCTRL0, 0x43000300 |
| 75 | DATA 4, MX6_MMDC_P1_MPDGCTRL1, 0x03000300 |
| 76 | /* start delay line calibration */ |
| 77 | DATA 4, MX6_MMDC_P0_MPMUR0, 0x00000800 |
| 78 | /* tRFC=0x89+1,tXS=0x8e+1,tXP=3+1,tXPDLL=0xc+1,tFAW=0x17+1,tCL=0x4+3 */ |
| 79 | DATA 4, MX6_MMDC_P0_MDCFG0, 0x898E7974 |
| 80 | /* tRCD=6+1,tRP=6+1,tRC=0x1a+1,tRAS=0x13+1,tRPA=tRP+1,tWR=7+1,tMRD=0xb+1,tCWL=4+2 */ |
| 81 | DATA 4, MX6_MMDC_P0_MDCFG1, 0xDB538F64 |
| 82 | /* tDLLK=0x1ff+1,tRTP=3+1,tWTR=3+1,tRRD=3+1 */ |
| 83 | DATA 4, MX6_MMDC_P0_MDCFG2, 0x01FF00DB |
| 84 | /* RTW_SAME=2,WTR_DIFF=3,WTW_DIFF=3,RTW_DIFF=2,RTR_DIFF=2 */ |
| 85 | DATA 4, MX6_MMDC_P0_MDRWD, 0x000026D2 |
| 86 | /* tXPR=0x8e+1,SDE2RST=0x10-2,RST2CKE=0x23-2 */ |
| 87 | DATA 4, MX6_MMDC_P0_MDOR, 0x008E1023 |
| 88 | /* ODT timing */ |
| 89 | DATA 4, MX6_MMDC_P0_MDOTC, 0x09444040 |
| 90 | /* read odt settings, 120 Ohm */ |
| 91 | DATA 4, MX6_MMDC_P0_MPODTCTRL, 0x00011117 |
| 92 | DATA 4, MX6_MMDC_P1_MPODTCTRL, 0x00011117 |
| 93 | /* cs0, 15-bit row, 10-bit column, BL 8, 64-bit bus */ |
| 94 | DATA 4, MX6_MMDC_P0_MDCTL, 0x841A0000 |
| 95 | /* interleaved bank access (row/bank/col), 5 cycles additional read delay */ |
| 96 | DATA 4, MX6_MMDC_P0_MDMISC, 0x00001740 |
| 97 | /* 2GiByte RAM at cs0 */ |
| 98 | DATA 4, MX6_MMDC_P0_MDASP, 0x00000047 |
| 99 | /* load mode registers of external ddr chips */ |
| 100 | DATA 4, MX6_MMDC_P0_MDSCR, 0x19308030 |
| 101 | DATA 4, MX6_MMDC_P0_MDSCR, 0x00428031 |
| 102 | DATA 4, MX6_MMDC_P0_MDSCR, 0x04088032 |
| 103 | DATA 4, MX6_MMDC_P0_MDSCR, 0x00008033 |
| 104 | /* externel chip ZQ calibration */ |
| 105 | DATA 4, MX6_MMDC_P0_MDSCR, 0x04008040 |
| 106 | /* configure and start refreshes, 8 refresh commands at 32 kHz */ |
| 107 | DATA 4, MX6_MMDC_P0_MDREF, 0x00007800 |
| 108 | /* tCKE=2+1,tCKSRX=6,tCKSE=6, active power down after 256 cycles (setting 5) */ |
| 109 | DATA 4, MX6_MMDC_P0_MDPDC, 0x00025576 |
| 110 | /* set automatic self refresh */ |
| 111 | DATA 4, MX6_MMDC_P0_MAPSR, 0x00011006 |
| 112 | /* controller configuration finished */ |
| 113 | DATA 4, MX6_MMDC_P0_MDSCR, 0x00000000 |