110a511ceSYann Gautier /* 210a511ceSYann Gautier * Copyright (c) 2017-2018, STMicroelectronics - All Rights Reserved 310a511ceSYann Gautier * 410a511ceSYann Gautier * SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause 510a511ceSYann Gautier */ 610a511ceSYann Gautier 7c3cf06f1SAntonio Nino Diaz #ifndef STM32MP1_DDR_REGS_H 8c3cf06f1SAntonio Nino Diaz #define STM32MP1_DDR_REGS_H 910a511ceSYann Gautier 10*09d40e0eSAntonio Nino Diaz #include <lib/utils_def.h> 1110a511ceSYann Gautier 1210a511ceSYann Gautier /* DDR3/LPDDR2/LPDDR3 Controller (DDRCTRL) registers */ 1310a511ceSYann Gautier struct stm32mp1_ddrctl { 1410a511ceSYann Gautier uint32_t mstr ; /* 0x0 Master */ 1510a511ceSYann Gautier uint32_t stat; /* 0x4 Operating Mode Status */ 1610a511ceSYann Gautier uint8_t reserved008[0x10 - 0x8]; 1710a511ceSYann Gautier uint32_t mrctrl0; /* 0x10 Control 0 */ 1810a511ceSYann Gautier uint32_t mrctrl1; /* 0x14 Control 1 */ 1910a511ceSYann Gautier uint32_t mrstat; /* 0x18 Status */ 2010a511ceSYann Gautier uint32_t reserved01c; /* 0x1c */ 2110a511ceSYann Gautier uint32_t derateen; /* 0x20 Temperature Derate Enable */ 2210a511ceSYann Gautier uint32_t derateint; /* 0x24 Temperature Derate Interval */ 2310a511ceSYann Gautier uint8_t reserved028[0x30 - 0x28]; 2410a511ceSYann Gautier uint32_t pwrctl; /* 0x30 Low Power Control */ 2510a511ceSYann Gautier uint32_t pwrtmg; /* 0x34 Low Power Timing */ 2610a511ceSYann Gautier uint32_t hwlpctl; /* 0x38 Hardware Low Power Control */ 2710a511ceSYann Gautier uint8_t reserved03c[0x50 - 0x3C]; 2810a511ceSYann Gautier uint32_t rfshctl0; /* 0x50 Refresh Control 0 */ 2910a511ceSYann Gautier uint32_t reserved054; /* 0x54 Refresh Control 1 */ 3010a511ceSYann Gautier uint32_t reserved058; /* 0x58 Refresh Control 2 */ 3110a511ceSYann Gautier uint32_t reserved05C; 3210a511ceSYann Gautier uint32_t rfshctl3; /* 0x60 Refresh Control 0 */ 3310a511ceSYann Gautier uint32_t rfshtmg; /* 0x64 Refresh Timing */ 3410a511ceSYann Gautier uint8_t reserved068[0xc0 - 0x68]; 3510a511ceSYann Gautier uint32_t crcparctl0; /* 0xc0 CRC Parity Control0 */ 3610a511ceSYann Gautier uint32_t reserved0c4; /* 0xc4 CRC Parity Control1 */ 3710a511ceSYann Gautier uint32_t reserved0c8; /* 0xc8 CRC Parity Control2 */ 3810a511ceSYann Gautier uint32_t crcparstat; /* 0xcc CRC Parity Status */ 3910a511ceSYann Gautier uint32_t init0; /* 0xd0 SDRAM Initialization 0 */ 4010a511ceSYann Gautier uint32_t init1; /* 0xd4 SDRAM Initialization 1 */ 4110a511ceSYann Gautier uint32_t init2; /* 0xd8 SDRAM Initialization 2 */ 4210a511ceSYann Gautier uint32_t init3; /* 0xdc SDRAM Initialization 3 */ 4310a511ceSYann Gautier uint32_t init4; /* 0xe0 SDRAM Initialization 4 */ 4410a511ceSYann Gautier uint32_t init5; /* 0xe4 SDRAM Initialization 5 */ 4510a511ceSYann Gautier uint32_t reserved0e8; 4610a511ceSYann Gautier uint32_t reserved0ec; 4710a511ceSYann Gautier uint32_t dimmctl; /* 0xf0 DIMM Control */ 4810a511ceSYann Gautier uint8_t reserved0f4[0x100 - 0xf4]; 4910a511ceSYann Gautier uint32_t dramtmg0; /* 0x100 SDRAM Timing 0 */ 5010a511ceSYann Gautier uint32_t dramtmg1; /* 0x104 SDRAM Timing 1 */ 5110a511ceSYann Gautier uint32_t dramtmg2; /* 0x108 SDRAM Timing 2 */ 5210a511ceSYann Gautier uint32_t dramtmg3; /* 0x10c SDRAM Timing 3 */ 5310a511ceSYann Gautier uint32_t dramtmg4; /* 0x110 SDRAM Timing 4 */ 5410a511ceSYann Gautier uint32_t dramtmg5; /* 0x114 SDRAM Timing 5 */ 5510a511ceSYann Gautier uint32_t dramtmg6; /* 0x118 SDRAM Timing 6 */ 5610a511ceSYann Gautier uint32_t dramtmg7; /* 0x11c SDRAM Timing 7 */ 5710a511ceSYann Gautier uint32_t dramtmg8; /* 0x120 SDRAM Timing 8 */ 5810a511ceSYann Gautier uint8_t reserved124[0x138 - 0x124]; 5910a511ceSYann Gautier uint32_t dramtmg14; /* 0x138 SDRAM Timing 14 */ 6010a511ceSYann Gautier uint32_t dramtmg15; /* 0x13C SDRAM Timing 15 */ 6110a511ceSYann Gautier uint8_t reserved140[0x180 - 0x140]; 6210a511ceSYann Gautier uint32_t zqctl0; /* 0x180 ZQ Control 0 */ 6310a511ceSYann Gautier uint32_t zqctl1; /* 0x184 ZQ Control 1 */ 6410a511ceSYann Gautier uint32_t zqctl2; /* 0x188 ZQ Control 2 */ 6510a511ceSYann Gautier uint32_t zqstat; /* 0x18c ZQ Status */ 6610a511ceSYann Gautier uint32_t dfitmg0; /* 0x190 DFI Timing 0 */ 6710a511ceSYann Gautier uint32_t dfitmg1; /* 0x194 DFI Timing 1 */ 6810a511ceSYann Gautier uint32_t dfilpcfg0; /* 0x198 DFI Low Power Configuration 0 */ 6910a511ceSYann Gautier uint32_t reserved19c; 7010a511ceSYann Gautier uint32_t dfiupd0; /* 0x1a0 DFI Update 0 */ 7110a511ceSYann Gautier uint32_t dfiupd1; /* 0x1a4 DFI Update 1 */ 7210a511ceSYann Gautier uint32_t dfiupd2; /* 0x1a8 DFI Update 2 */ 7310a511ceSYann Gautier uint32_t reserved1ac; 7410a511ceSYann Gautier uint32_t dfimisc; /* 0x1b0 DFI Miscellaneous Control */ 7510a511ceSYann Gautier uint8_t reserved1b4[0x1bc - 0x1b4]; 7610a511ceSYann Gautier uint32_t dfistat; /* 0x1bc DFI Miscellaneous Control */ 7710a511ceSYann Gautier uint8_t reserved1c0[0x1c4 - 0x1c0]; 7810a511ceSYann Gautier uint32_t dfiphymstr; /* 0x1c4 DFI PHY Master interface */ 7910a511ceSYann Gautier uint8_t reserved1c8[0x204 - 0x1c8]; 8010a511ceSYann Gautier uint32_t addrmap1; /* 0x204 Address Map 1 */ 8110a511ceSYann Gautier uint32_t addrmap2; /* 0x208 Address Map 2 */ 8210a511ceSYann Gautier uint32_t addrmap3; /* 0x20c Address Map 3 */ 8310a511ceSYann Gautier uint32_t addrmap4; /* 0x210 Address Map 4 */ 8410a511ceSYann Gautier uint32_t addrmap5; /* 0x214 Address Map 5 */ 8510a511ceSYann Gautier uint32_t addrmap6; /* 0x218 Address Map 6 */ 8610a511ceSYann Gautier uint8_t reserved21c[0x224 - 0x21c]; 8710a511ceSYann Gautier uint32_t addrmap9; /* 0x224 Address Map 9 */ 8810a511ceSYann Gautier uint32_t addrmap10; /* 0x228 Address Map 10 */ 8910a511ceSYann Gautier uint32_t addrmap11; /* 0x22C Address Map 11 */ 9010a511ceSYann Gautier uint8_t reserved230[0x240 - 0x230]; 9110a511ceSYann Gautier uint32_t odtcfg; /* 0x240 ODT Configuration */ 9210a511ceSYann Gautier uint32_t odtmap; /* 0x244 ODT/Rank Map */ 9310a511ceSYann Gautier uint8_t reserved248[0x250 - 0x248]; 9410a511ceSYann Gautier uint32_t sched; /* 0x250 Scheduler Control */ 9510a511ceSYann Gautier uint32_t sched1; /* 0x254 Scheduler Control 1 */ 9610a511ceSYann Gautier uint32_t reserved258; 9710a511ceSYann Gautier uint32_t perfhpr1; /* 0x25c High Priority Read CAM 1 */ 9810a511ceSYann Gautier uint32_t reserved260; 9910a511ceSYann Gautier uint32_t perflpr1; /* 0x264 Low Priority Read CAM 1 */ 10010a511ceSYann Gautier uint32_t reserved268; 10110a511ceSYann Gautier uint32_t perfwr1; /* 0x26c Write CAM 1 */ 10210a511ceSYann Gautier uint8_t reserved27c[0x300 - 0x270]; 10310a511ceSYann Gautier uint32_t dbg0; /* 0x300 Debug 0 */ 10410a511ceSYann Gautier uint32_t dbg1; /* 0x304 Debug 1 */ 10510a511ceSYann Gautier uint32_t dbgcam; /* 0x308 CAM Debug */ 10610a511ceSYann Gautier uint32_t dbgcmd; /* 0x30c Command Debug */ 10710a511ceSYann Gautier uint32_t dbgstat; /* 0x310 Status Debug */ 10810a511ceSYann Gautier uint8_t reserved314[0x320 - 0x314]; 10910a511ceSYann Gautier uint32_t swctl; /* 0x320 Software Programming Control Enable */ 11010a511ceSYann Gautier uint32_t swstat; /* 0x324 Software Programming Control Status */ 11110a511ceSYann Gautier uint8_t reserved328[0x36c - 0x328]; 11210a511ceSYann Gautier uint32_t poisoncfg; /* 0x36c AXI Poison Configuration Register */ 11310a511ceSYann Gautier uint32_t poisonstat; /* 0x370 AXI Poison Status Register */ 11410a511ceSYann Gautier uint8_t reserved374[0x3fc - 0x374]; 11510a511ceSYann Gautier 11610a511ceSYann Gautier /* Multi Port registers */ 11710a511ceSYann Gautier uint32_t pstat; /* 0x3fc Port Status */ 11810a511ceSYann Gautier uint32_t pccfg; /* 0x400 Port Common Configuration */ 11910a511ceSYann Gautier 12010a511ceSYann Gautier /* PORT 0 */ 12110a511ceSYann Gautier uint32_t pcfgr_0; /* 0x404 Configuration Read */ 12210a511ceSYann Gautier uint32_t pcfgw_0; /* 0x408 Configuration Write */ 12310a511ceSYann Gautier uint8_t reserved40c[0x490 - 0x40c]; 12410a511ceSYann Gautier uint32_t pctrl_0; /* 0x490 Port Control Register */ 12510a511ceSYann Gautier uint32_t pcfgqos0_0; /* 0x494 Read QoS Configuration 0 */ 12610a511ceSYann Gautier uint32_t pcfgqos1_0; /* 0x498 Read QoS Configuration 1 */ 12710a511ceSYann Gautier uint32_t pcfgwqos0_0; /* 0x49c Write QoS Configuration 0 */ 12810a511ceSYann Gautier uint32_t pcfgwqos1_0; /* 0x4a0 Write QoS Configuration 1 */ 12910a511ceSYann Gautier uint8_t reserved4a4[0x4b4 - 0x4a4]; 13010a511ceSYann Gautier 13110a511ceSYann Gautier /* PORT 1 */ 13210a511ceSYann Gautier uint32_t pcfgr_1; /* 0x4b4 Configuration Read */ 13310a511ceSYann Gautier uint32_t pcfgw_1; /* 0x4b8 Configuration Write */ 13410a511ceSYann Gautier uint8_t reserved4bc[0x540 - 0x4bc]; 13510a511ceSYann Gautier uint32_t pctrl_1; /* 0x540 Port 2 Control Register */ 13610a511ceSYann Gautier uint32_t pcfgqos0_1; /* 0x544 Read QoS Configuration 0 */ 13710a511ceSYann Gautier uint32_t pcfgqos1_1; /* 0x548 Read QoS Configuration 1 */ 13810a511ceSYann Gautier uint32_t pcfgwqos0_1; /* 0x54c Write QoS Configuration 0 */ 13910a511ceSYann Gautier uint32_t pcfgwqos1_1; /* 0x550 Write QoS Configuration 1 */ 14010a511ceSYann Gautier } __packed; 14110a511ceSYann Gautier 14210a511ceSYann Gautier /* DDR Physical Interface Control (DDRPHYC) registers*/ 14310a511ceSYann Gautier struct stm32mp1_ddrphy { 14410a511ceSYann Gautier uint32_t ridr; /* 0x00 R Revision Identification */ 14510a511ceSYann Gautier uint32_t pir; /* 0x04 R/W PHY Initialization */ 14610a511ceSYann Gautier uint32_t pgcr; /* 0x08 R/W PHY General Configuration */ 14710a511ceSYann Gautier uint32_t pgsr; /* 0x0C PHY General Status */ 14810a511ceSYann Gautier uint32_t dllgcr; /* 0x10 R/W DLL General Control */ 14910a511ceSYann Gautier uint32_t acdllcr; /* 0x14 R/W AC DLL Control */ 15010a511ceSYann Gautier uint32_t ptr0; /* 0x18 R/W PHY Timing 0 */ 15110a511ceSYann Gautier uint32_t ptr1; /* 0x1C R/W PHY Timing 1 */ 15210a511ceSYann Gautier uint32_t ptr2; /* 0x20 R/W PHY Timing 2 */ 15310a511ceSYann Gautier uint32_t aciocr; /* 0x24 AC I/O Configuration */ 15410a511ceSYann Gautier uint32_t dxccr; /* 0x28 DATX8 Common Configuration */ 15510a511ceSYann Gautier uint32_t dsgcr; /* 0x2C DDR System General Configuration */ 15610a511ceSYann Gautier uint32_t dcr; /* 0x30 DRAM Configuration */ 15710a511ceSYann Gautier uint32_t dtpr0; /* 0x34 DRAM Timing Parameters0 */ 15810a511ceSYann Gautier uint32_t dtpr1; /* 0x38 DRAM Timing Parameters1 */ 15910a511ceSYann Gautier uint32_t dtpr2; /* 0x3C DRAM Timing Parameters2 */ 16010a511ceSYann Gautier uint32_t mr0; /* 0x40 Mode 0 */ 16110a511ceSYann Gautier uint32_t mr1; /* 0x44 Mode 1 */ 16210a511ceSYann Gautier uint32_t mr2; /* 0x48 Mode 2 */ 16310a511ceSYann Gautier uint32_t mr3; /* 0x4C Mode 3 */ 16410a511ceSYann Gautier uint32_t odtcr; /* 0x50 ODT Configuration */ 16510a511ceSYann Gautier uint32_t dtar; /* 0x54 data training address */ 16610a511ceSYann Gautier uint32_t dtdr0; /* 0x58 */ 16710a511ceSYann Gautier uint32_t dtdr1; /* 0x5c */ 16810a511ceSYann Gautier uint8_t res1[0x0c0 - 0x060]; /* 0x60 */ 16910a511ceSYann Gautier uint32_t dcuar; /* 0xc0 Address */ 17010a511ceSYann Gautier uint32_t dcudr; /* 0xc4 DCU Data */ 17110a511ceSYann Gautier uint32_t dcurr; /* 0xc8 DCU Run */ 17210a511ceSYann Gautier uint32_t dculr; /* 0xcc DCU Loop */ 17310a511ceSYann Gautier uint32_t dcugcr; /* 0xd0 DCU General Configuration */ 17410a511ceSYann Gautier uint32_t dcutpr; /* 0xd4 DCU Timing Parameters */ 17510a511ceSYann Gautier uint32_t dcusr0; /* 0xd8 DCU Status 0 */ 17610a511ceSYann Gautier uint32_t dcusr1; /* 0xdc DCU Status 1 */ 17710a511ceSYann Gautier uint8_t res2[0x100 - 0xe0]; /* 0xe0 */ 17810a511ceSYann Gautier uint32_t bistrr; /* 0x100 BIST Run */ 17910a511ceSYann Gautier uint32_t bistmskr0; /* 0x104 BIST Mask 0 */ 18010a511ceSYann Gautier uint32_t bistmskr1; /* 0x108 BIST Mask 0 */ 18110a511ceSYann Gautier uint32_t bistwcr; /* 0x10c BIST Word Count */ 18210a511ceSYann Gautier uint32_t bistlsr; /* 0x110 BIST LFSR Seed */ 18310a511ceSYann Gautier uint32_t bistar0; /* 0x114 BIST Address 0 */ 18410a511ceSYann Gautier uint32_t bistar1; /* 0x118 BIST Address 1 */ 18510a511ceSYann Gautier uint32_t bistar2; /* 0x11c BIST Address 2 */ 18610a511ceSYann Gautier uint32_t bistupdr; /* 0x120 BIST User Data Pattern */ 18710a511ceSYann Gautier uint32_t bistgsr; /* 0x124 BIST General Status */ 18810a511ceSYann Gautier uint32_t bistwer; /* 0x128 BIST Word Error */ 18910a511ceSYann Gautier uint32_t bistber0; /* 0x12c BIST Bit Error 0 */ 19010a511ceSYann Gautier uint32_t bistber1; /* 0x130 BIST Bit Error 1 */ 19110a511ceSYann Gautier uint32_t bistber2; /* 0x134 BIST Bit Error 2 */ 19210a511ceSYann Gautier uint32_t bistwcsr; /* 0x138 BIST Word Count Status */ 19310a511ceSYann Gautier uint32_t bistfwr0; /* 0x13c BIST Fail Word 0 */ 19410a511ceSYann Gautier uint32_t bistfwr1; /* 0x140 BIST Fail Word 1 */ 19510a511ceSYann Gautier uint8_t res3[0x178 - 0x144]; /* 0x144 */ 19610a511ceSYann Gautier uint32_t gpr0; /* 0x178 General Purpose 0 (GPR0) */ 19710a511ceSYann Gautier uint32_t gpr1; /* 0x17C General Purpose 1 (GPR1) */ 19810a511ceSYann Gautier uint32_t zq0cr0; /* 0x180 zq 0 control 0 */ 19910a511ceSYann Gautier uint32_t zq0cr1; /* 0x184 zq 0 control 1 */ 20010a511ceSYann Gautier uint32_t zq0sr0; /* 0x188 zq 0 status 0 */ 20110a511ceSYann Gautier uint32_t zq0sr1; /* 0x18C zq 0 status 1 */ 20210a511ceSYann Gautier uint8_t res4[0x1C0 - 0x190]; /* 0x190 */ 20310a511ceSYann Gautier uint32_t dx0gcr; /* 0x1c0 Byte lane 0 General Configuration */ 20410a511ceSYann Gautier uint32_t dx0gsr0; /* 0x1c4 Byte lane 0 General Status 0 */ 20510a511ceSYann Gautier uint32_t dx0gsr1; /* 0x1c8 Byte lane 0 General Status 1 */ 20610a511ceSYann Gautier uint32_t dx0dllcr; /* 0x1cc Byte lane 0 DLL Control */ 20710a511ceSYann Gautier uint32_t dx0dqtr; /* 0x1d0 Byte lane 0 DQ Timing */ 20810a511ceSYann Gautier uint32_t dx0dqstr; /* 0x1d4 Byte lane 0 DQS Timing */ 20910a511ceSYann Gautier uint8_t res5[0x200 - 0x1d8]; /* 0x1d8 */ 21010a511ceSYann Gautier uint32_t dx1gcr; /* 0x200 Byte lane 1 General Configuration */ 21110a511ceSYann Gautier uint32_t dx1gsr0; /* 0x204 Byte lane 1 General Status 0 */ 21210a511ceSYann Gautier uint32_t dx1gsr1; /* 0x208 Byte lane 1 General Status 1 */ 21310a511ceSYann Gautier uint32_t dx1dllcr; /* 0x20c Byte lane 1 DLL Control */ 21410a511ceSYann Gautier uint32_t dx1dqtr; /* 0x210 Byte lane 1 DQ Timing */ 21510a511ceSYann Gautier uint32_t dx1dqstr; /* 0x214 Byte lane 1 QS Timing */ 21610a511ceSYann Gautier uint8_t res6[0x240 - 0x218]; /* 0x218 */ 21710a511ceSYann Gautier uint32_t dx2gcr; /* 0x240 Byte lane 2 General Configuration */ 21810a511ceSYann Gautier uint32_t dx2gsr0; /* 0x244 Byte lane 2 General Status 0 */ 21910a511ceSYann Gautier uint32_t dx2gsr1; /* 0x248 Byte lane 2 General Status 1 */ 22010a511ceSYann Gautier uint32_t dx2dllcr; /* 0x24c Byte lane 2 DLL Control */ 22110a511ceSYann Gautier uint32_t dx2dqtr; /* 0x250 Byte lane 2 DQ Timing */ 22210a511ceSYann Gautier uint32_t dx2dqstr; /* 0x254 Byte lane 2 QS Timing */ 22310a511ceSYann Gautier uint8_t res7[0x280 - 0x258]; /* 0x258 */ 22410a511ceSYann Gautier uint32_t dx3gcr; /* 0x280 Byte lane 3 General Configuration */ 22510a511ceSYann Gautier uint32_t dx3gsr0; /* 0x284 Byte lane 3 General Status 0 */ 22610a511ceSYann Gautier uint32_t dx3gsr1; /* 0x288 Byte lane 3 General Status 1 */ 22710a511ceSYann Gautier uint32_t dx3dllcr; /* 0x28c Byte lane 3 DLL Control */ 22810a511ceSYann Gautier uint32_t dx3dqtr; /* 0x290 Byte lane 3 DQ Timing */ 22910a511ceSYann Gautier uint32_t dx3dqstr; /* 0x294 Byte lane 3 QS Timing */ 23010a511ceSYann Gautier } __packed; 23110a511ceSYann Gautier 23210a511ceSYann Gautier /* DDR Controller registers offsets */ 23310a511ceSYann Gautier #define DDRCTRL_MSTR 0x000 23410a511ceSYann Gautier #define DDRCTRL_STAT 0x004 23510a511ceSYann Gautier #define DDRCTRL_MRCTRL0 0x010 23610a511ceSYann Gautier #define DDRCTRL_MRSTAT 0x018 23710a511ceSYann Gautier #define DDRCTRL_PWRCTL 0x030 23810a511ceSYann Gautier #define DDRCTRL_PWRTMG 0x034 23910a511ceSYann Gautier #define DDRCTRL_HWLPCTL 0x038 24010a511ceSYann Gautier #define DDRCTRL_RFSHCTL3 0x060 24110a511ceSYann Gautier #define DDRCTRL_RFSHTMG 0x064 24210a511ceSYann Gautier #define DDRCTRL_INIT0 0x0D0 24310a511ceSYann Gautier #define DDRCTRL_DFIMISC 0x1B0 24410a511ceSYann Gautier #define DDRCTRL_DBG1 0x304 24510a511ceSYann Gautier #define DDRCTRL_DBGCAM 0x308 24610a511ceSYann Gautier #define DDRCTRL_DBGCMD 0x30C 24710a511ceSYann Gautier #define DDRCTRL_DBGSTAT 0x310 24810a511ceSYann Gautier #define DDRCTRL_SWCTL 0x320 24910a511ceSYann Gautier #define DDRCTRL_SWSTAT 0x324 25010a511ceSYann Gautier #define DDRCTRL_PCTRL_0 0x490 25110a511ceSYann Gautier #define DDRCTRL_PCTRL_1 0x540 25210a511ceSYann Gautier 25310a511ceSYann Gautier /* DDR Controller Register fields */ 25410a511ceSYann Gautier #define DDRCTRL_MSTR_DDR3 BIT(0) 25510a511ceSYann Gautier #define DDRCTRL_MSTR_DATA_BUS_WIDTH_MASK GENMASK(13, 12) 25610a511ceSYann Gautier #define DDRCTRL_MSTR_DATA_BUS_WIDTH_FULL 0 25710a511ceSYann Gautier #define DDRCTRL_MSTR_DATA_BUS_WIDTH_HALF BIT(12) 25810a511ceSYann Gautier #define DDRCTRL_MSTR_DATA_BUS_WIDTH_QUARTER BIT(13) 25910a511ceSYann Gautier #define DDRCTRL_MSTR_DLL_OFF_MODE BIT(15) 26010a511ceSYann Gautier 26110a511ceSYann Gautier #define DDRCTRL_STAT_OPERATING_MODE_MASK GENMASK(2, 0) 26210a511ceSYann Gautier #define DDRCTRL_STAT_OPERATING_MODE_NORMAL BIT(0) 26310a511ceSYann Gautier #define DDRCTRL_STAT_OPERATING_MODE_SR (BIT(0) | BIT(1)) 26410a511ceSYann Gautier #define DDRCTRL_STAT_SELFREF_TYPE_MASK GENMASK(5, 4) 26510a511ceSYann Gautier #define DDRCTRL_STAT_SELFREF_TYPE_ASR (BIT(4) | BIT(5)) 26610a511ceSYann Gautier #define DDRCTRL_STAT_SELFREF_TYPE_SR BIT(5) 26710a511ceSYann Gautier 26810a511ceSYann Gautier #define DDRCTRL_MRCTRL0_MR_TYPE_WRITE U(0) 26910a511ceSYann Gautier /* Only one rank supported */ 27010a511ceSYann Gautier #define DDRCTRL_MRCTRL0_MR_RANK_SHIFT 4 27110a511ceSYann Gautier #define DDRCTRL_MRCTRL0_MR_RANK_ALL \ 27210a511ceSYann Gautier (0x1U << DDRCTRL_MRCTRL0_MR_RANK_SHIFT) 27310a511ceSYann Gautier #define DDRCTRL_MRCTRL0_MR_ADDR_SHIFT 12 27410a511ceSYann Gautier #define DDRCTRL_MRCTRL0_MR_ADDR_MASK GENMASK(15, 12) 27510a511ceSYann Gautier #define DDRCTRL_MRCTRL0_MR_WR BIT(31) 27610a511ceSYann Gautier 27710a511ceSYann Gautier #define DDRCTRL_MRSTAT_MR_WR_BUSY BIT(0) 27810a511ceSYann Gautier 27910a511ceSYann Gautier #define DDRCTRL_PWRCTL_SELFREF_EN BIT(0) 28010a511ceSYann Gautier #define DDRCTRL_PWRCTL_POWERDOWN_EN BIT(1) 28110a511ceSYann Gautier #define DDRCTRL_PWRCTL_EN_DFI_DRAM_CLK_DISABLE BIT(3) 28210a511ceSYann Gautier #define DDRCTRL_PWRCTL_SELFREF_SW BIT(5) 28310a511ceSYann Gautier 28410a511ceSYann Gautier #define DDRCTRL_PWRTMG_SELFREF_TO_X32_MASK GENMASK(19, 12) 28510a511ceSYann Gautier #define DDRCTRL_PWRTMG_SELFREF_TO_X32_0 BIT(16) 28610a511ceSYann Gautier 28710a511ceSYann Gautier #define DDRCTRL_RFSHCTL3_DIS_AUTO_REFRESH BIT(0) 28810a511ceSYann Gautier 28910a511ceSYann Gautier #define DDRCTRL_HWLPCTL_HW_LP_EN BIT(0) 29010a511ceSYann Gautier 29110a511ceSYann Gautier #define DDRCTRL_RFSHTMG_T_RFC_NOM_X1_X32_MASK GENMASK(27, 16) 29210a511ceSYann Gautier #define DDRCTRL_RFSHTMG_T_RFC_NOM_X1_X32_SHIFT 16 29310a511ceSYann Gautier 29410a511ceSYann Gautier #define DDRCTRL_INIT0_SKIP_DRAM_INIT_MASK GENMASK(31, 30) 29510a511ceSYann Gautier #define DDRCTRL_INIT0_SKIP_DRAM_INIT_NORMAL BIT(30) 29610a511ceSYann Gautier 29710a511ceSYann Gautier #define DDRCTRL_DFIMISC_DFI_INIT_COMPLETE_EN BIT(0) 29810a511ceSYann Gautier 29910a511ceSYann Gautier #define DDRCTRL_DBG1_DIS_HIF BIT(1) 30010a511ceSYann Gautier 30110a511ceSYann Gautier #define DDRCTRL_DBGCAM_WR_DATA_PIPELINE_EMPTY BIT(29) 30210a511ceSYann Gautier #define DDRCTRL_DBGCAM_RD_DATA_PIPELINE_EMPTY BIT(28) 30310a511ceSYann Gautier #define DDRCTRL_DBGCAM_DBG_WR_Q_EMPTY BIT(26) 30410a511ceSYann Gautier #define DDRCTRL_DBGCAM_DBG_LPR_Q_DEPTH GENMASK(12, 8) 30510a511ceSYann Gautier #define DDRCTRL_DBGCAM_DBG_HPR_Q_DEPTH GENMASK(4, 0) 30610a511ceSYann Gautier #define DDRCTRL_DBGCAM_DATA_PIPELINE_EMPTY \ 30710a511ceSYann Gautier (DDRCTRL_DBGCAM_WR_DATA_PIPELINE_EMPTY | \ 30810a511ceSYann Gautier DDRCTRL_DBGCAM_RD_DATA_PIPELINE_EMPTY) 30910a511ceSYann Gautier #define DDRCTRL_DBGCAM_DBG_Q_DEPTH \ 31010a511ceSYann Gautier (DDRCTRL_DBGCAM_DBG_WR_Q_EMPTY | \ 31110a511ceSYann Gautier DDRCTRL_DBGCAM_DBG_LPR_Q_DEPTH | \ 31210a511ceSYann Gautier DDRCTRL_DBGCAM_DBG_HPR_Q_DEPTH) 31310a511ceSYann Gautier 31410a511ceSYann Gautier #define DDRCTRL_DBGCMD_RANK0_REFRESH BIT(0) 31510a511ceSYann Gautier 31610a511ceSYann Gautier #define DDRCTRL_DBGSTAT_RANK0_REFRESH_BUSY BIT(0) 31710a511ceSYann Gautier 31810a511ceSYann Gautier #define DDRCTRL_SWCTL_SW_DONE BIT(0) 31910a511ceSYann Gautier 32010a511ceSYann Gautier #define DDRCTRL_SWSTAT_SW_DONE_ACK BIT(0) 32110a511ceSYann Gautier 32210a511ceSYann Gautier #define DDRCTRL_PCTRL_N_PORT_EN BIT(0) 32310a511ceSYann Gautier 32410a511ceSYann Gautier /* DDR PHY registers offsets */ 32510a511ceSYann Gautier #define DDRPHYC_PIR 0x004 32610a511ceSYann Gautier #define DDRPHYC_PGCR 0x008 32710a511ceSYann Gautier #define DDRPHYC_PGSR 0x00C 32810a511ceSYann Gautier #define DDRPHYC_DLLGCR 0x010 32910a511ceSYann Gautier #define DDRPHYC_ACDLLCR 0x014 33010a511ceSYann Gautier #define DDRPHYC_PTR0 0x018 33110a511ceSYann Gautier #define DDRPHYC_ACIOCR 0x024 33210a511ceSYann Gautier #define DDRPHYC_DXCCR 0x028 33310a511ceSYann Gautier #define DDRPHYC_DSGCR 0x02C 33410a511ceSYann Gautier #define DDRPHYC_ZQ0CR0 0x180 33510a511ceSYann Gautier #define DDRPHYC_DX0GCR 0x1C0 33610a511ceSYann Gautier #define DDRPHYC_DX0DLLCR 0x1CC 33710a511ceSYann Gautier #define DDRPHYC_DX1GCR 0x200 33810a511ceSYann Gautier #define DDRPHYC_DX1DLLCR 0x20C 33910a511ceSYann Gautier #define DDRPHYC_DX2GCR 0x240 34010a511ceSYann Gautier #define DDRPHYC_DX2DLLCR 0x24C 34110a511ceSYann Gautier #define DDRPHYC_DX3GCR 0x280 34210a511ceSYann Gautier #define DDRPHYC_DX3DLLCR 0x28C 34310a511ceSYann Gautier 34410a511ceSYann Gautier /* DDR PHY Register fields */ 34510a511ceSYann Gautier #define DDRPHYC_PIR_INIT BIT(0) 34610a511ceSYann Gautier #define DDRPHYC_PIR_DLLSRST BIT(1) 34710a511ceSYann Gautier #define DDRPHYC_PIR_DLLLOCK BIT(2) 34810a511ceSYann Gautier #define DDRPHYC_PIR_ZCAL BIT(3) 34910a511ceSYann Gautier #define DDRPHYC_PIR_ITMSRST BIT(4) 35010a511ceSYann Gautier #define DDRPHYC_PIR_DRAMRST BIT(5) 35110a511ceSYann Gautier #define DDRPHYC_PIR_DRAMINIT BIT(6) 35210a511ceSYann Gautier #define DDRPHYC_PIR_QSTRN BIT(7) 35310a511ceSYann Gautier #define DDRPHYC_PIR_ICPC BIT(16) 35410a511ceSYann Gautier #define DDRPHYC_PIR_ZCALBYP BIT(30) 35510a511ceSYann Gautier #define DDRPHYC_PIR_INITSTEPS_MASK GENMASK(31, 7) 35610a511ceSYann Gautier 35710a511ceSYann Gautier #define DDRPHYC_PGCR_DFTCMP BIT(2) 35810a511ceSYann Gautier #define DDRPHYC_PGCR_PDDISDX BIT(24) 35910a511ceSYann Gautier #define DDRPHYC_PGCR_RFSHDT_MASK GENMASK(28, 25) 36010a511ceSYann Gautier 36110a511ceSYann Gautier #define DDRPHYC_PGSR_IDONE BIT(0) 36210a511ceSYann Gautier #define DDRPHYC_PGSR_DTERR BIT(5) 36310a511ceSYann Gautier #define DDRPHYC_PGSR_DTIERR BIT(6) 36410a511ceSYann Gautier #define DDRPHYC_PGSR_DFTERR BIT(7) 36510a511ceSYann Gautier #define DDRPHYC_PGSR_RVERR BIT(8) 36610a511ceSYann Gautier #define DDRPHYC_PGSR_RVEIRR BIT(9) 36710a511ceSYann Gautier 36810a511ceSYann Gautier #define DDRPHYC_DLLGCR_BPS200 BIT(23) 36910a511ceSYann Gautier 37010a511ceSYann Gautier #define DDRPHYC_ACDLLCR_DLLDIS BIT(31) 37110a511ceSYann Gautier 37210a511ceSYann Gautier #define DDRPHYC_PTR0_TDLLSRST_OFFSET 0 37310a511ceSYann Gautier #define DDRPHYC_PTR0_TDLLSRST_MASK GENMASK(5, 0) 37410a511ceSYann Gautier #define DDRPHYC_PTR0_TDLLLOCK_OFFSET 6 37510a511ceSYann Gautier #define DDRPHYC_PTR0_TDLLLOCK_MASK GENMASK(17, 6) 37610a511ceSYann Gautier #define DDRPHYC_PTR0_TITMSRST_OFFSET 18 37710a511ceSYann Gautier #define DDRPHYC_PTR0_TITMSRST_MASK GENMASK(21, 18) 37810a511ceSYann Gautier 37910a511ceSYann Gautier #define DDRPHYC_ACIOCR_ACPDD BIT(3) 38010a511ceSYann Gautier #define DDRPHYC_ACIOCR_ACPDR BIT(4) 38110a511ceSYann Gautier #define DDRPHYC_ACIOCR_CKPDD_MASK GENMASK(10, 8) 38210a511ceSYann Gautier #define DDRPHYC_ACIOCR_CKPDD_0 BIT(8) 38310a511ceSYann Gautier #define DDRPHYC_ACIOCR_CKPDR_MASK GENMASK(13, 11) 38410a511ceSYann Gautier #define DDRPHYC_ACIOCR_CKPDR_0 BIT(11) 38510a511ceSYann Gautier #define DDRPHYC_ACIOCR_CSPDD_MASK GENMASK(21, 18) 38610a511ceSYann Gautier #define DDRPHYC_ACIOCR_CSPDD_0 BIT(18) 38710a511ceSYann Gautier #define DDRPHYC_ACIOCR_RSTPDD BIT(27) 38810a511ceSYann Gautier #define DDRPHYC_ACIOCR_RSTPDR BIT(28) 38910a511ceSYann Gautier 39010a511ceSYann Gautier #define DDRPHYC_DXCCR_DXPDD BIT(2) 39110a511ceSYann Gautier #define DDRPHYC_DXCCR_DXPDR BIT(3) 39210a511ceSYann Gautier 39310a511ceSYann Gautier #define DDRPHYC_DSGCR_CKEPDD_MASK GENMASK(19, 16) 39410a511ceSYann Gautier #define DDRPHYC_DSGCR_CKEPDD_0 BIT(16) 39510a511ceSYann Gautier #define DDRPHYC_DSGCR_ODTPDD_MASK GENMASK(23, 20) 39610a511ceSYann Gautier #define DDRPHYC_DSGCR_ODTPDD_0 BIT(20) 39710a511ceSYann Gautier #define DDRPHYC_DSGCR_NL2PD BIT(24) 39810a511ceSYann Gautier 39910a511ceSYann Gautier #define DDRPHYC_ZQ0CRN_ZDATA_MASK GENMASK(27, 0) 40010a511ceSYann Gautier #define DDRPHYC_ZQ0CRN_ZDATA_SHIFT 0 40110a511ceSYann Gautier #define DDRPHYC_ZQ0CRN_ZDEN BIT(28) 40210a511ceSYann Gautier #define DDRPHYC_ZQ0CRN_ZQPD BIT(31) 40310a511ceSYann Gautier 40410a511ceSYann Gautier #define DDRPHYC_DXNGCR_DXEN BIT(0) 40510a511ceSYann Gautier 40610a511ceSYann Gautier #define DDRPHYC_DXNDLLCR_DLLSRST BIT(30) 40710a511ceSYann Gautier #define DDRPHYC_DXNDLLCR_DLLDIS BIT(31) 40810a511ceSYann Gautier #define DDRPHYC_DXNDLLCR_SDPHASE_MASK GENMASK(17, 14) 40910a511ceSYann Gautier #define DDRPHYC_DXNDLLCR_SDPHASE_SHIFT 14 41010a511ceSYann Gautier 411c3cf06f1SAntonio Nino Diaz #endif /* STM32MP1_DDR_REGS_H */ 412