uboot/arch/arm/include/asm/arch-sunxi/dram_sun8i_a23.h
<<
>>
Prefs
   1/*
   2 * Sun8i platform dram controller register and constant defines
   3 *
   4 * (C) Copyright 2007-2013
   5 * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
   6 * CPL <cplanxy@allwinnertech.com>
   7 * Jerry Wang <wangflord@allwinnertech.com>
   8 *
   9 * (C) Copyright 2014 Hans de Goede <hdegoede@redhat.com>
  10 *
  11 * SPDX-License-Identifier:     GPL-2.0+
  12 */
  13
  14#ifndef _SUNXI_DRAM_SUN8I_H
  15#define _SUNXI_DRAM_SUN8I_H
  16
  17struct dram_para {
  18        u32 clock;
  19        u32 type;
  20        u32 zq;
  21        u32 odt_en;
  22        s32 odt_correction;
  23        u32 para1;
  24        u32 para2;
  25        u32 mr0;
  26        u32 mr1;
  27        u32 mr2;
  28        u32 mr3;
  29        u32 tpr0;
  30        u32 tpr1;
  31        u32 tpr2;
  32        u32 tpr3;
  33        u32 tpr4;
  34        u32 tpr5;
  35        u32 tpr6;
  36        u32 tpr7;
  37        u32 tpr8;
  38        u32 tpr9;
  39        u32 tpr10;
  40        u32 tpr11;
  41        u32 tpr12;
  42        u32 tpr13;
  43};
  44
  45struct sunxi_mctl_com_reg {
  46        u32 cr;                 /* 0x00 */
  47        u32 ccr;                /* 0x04 controller configuration register */
  48        u32 dbgcr;              /* 0x08 */
  49        u8 res0[0x4];           /* 0x0c */
  50        u32 mcr0_0;             /* 0x10 */
  51        u32 mcr1_0;             /* 0x14 */
  52        u32 mcr0_1;             /* 0x18 */
  53        u32 mcr1_1;             /* 0x1c */
  54        u32 mcr0_2;             /* 0x20 */
  55        u32 mcr1_2;             /* 0x24 */
  56        u32 mcr0_3;             /* 0x28 */
  57        u32 mcr1_3;             /* 0x2c */
  58        u32 mcr0_4;             /* 0x30 */
  59        u32 mcr1_4;             /* 0x34 */
  60        u32 mcr0_5;             /* 0x38 */
  61        u32 mcr1_5;             /* 0x3c */
  62        u32 mcr0_6;             /* 0x40 */
  63        u32 mcr1_6;             /* 0x44 */
  64        u32 mcr0_7;             /* 0x48 */
  65        u32 mcr1_7;             /* 0x4c */
  66        u32 mcr0_8;             /* 0x50 */
  67        u32 mcr1_8;             /* 0x54 */
  68        u32 mcr0_9;             /* 0x58 */
  69        u32 mcr1_9;             /* 0x5c */
  70        u32 mcr0_10;            /* 0x60 */
  71        u32 mcr1_10;            /* 0x64 */
  72        u32 mcr0_11;            /* 0x68 */
  73        u32 mcr1_11;            /* 0x6c */
  74        u32 mcr0_12;            /* 0x70 */
  75        u32 mcr1_12;            /* 0x74 */
  76        u32 mcr0_13;            /* 0x78 */
  77        u32 mcr1_13;            /* 0x7c */
  78        u32 mcr0_14;            /* 0x80 */
  79        u32 mcr1_14;            /* 0x84 */
  80        u32 mcr0_15;            /* 0x88 */
  81        u32 mcr1_15;            /* 0x8c */
  82        u32 bwcr;               /* 0x90 */
  83        u32 maer;               /* 0x94 */
  84        u8 res1[0x4];           /* 0x98 */
  85        u32 mcgcr;              /* 0x9c */
  86        u32 bwctr;              /* 0xa0 */
  87        u8 res2[0x4];           /* 0xa4 */
  88        u32 swonr;              /* 0xa8 */
  89        u32 swoffr;             /* 0xac */
  90};
  91
  92struct sunxi_mctl_ctl_reg {
  93        u32 mstr;               /* 0x00 */
  94        u32 statr;              /* 0x04 */
  95        u8 res0[0x08];          /* 0x08 */
  96        u32 mrctrl0;            /* 0x10 */
  97        u32 mrctrl1;            /* 0x14 */
  98        u32 mrstatr;            /* 0x18 */
  99        u8 res1[0x04];          /* 0x1c */
 100        u32 derateen;           /* 0x20 */
 101        u32 deratenint;         /* 0x24 */
 102        u8 res2[0x08];          /* 0x28 */
 103        u32 pwrctl;             /* 0x30 */
 104        u32 pwrtmg;             /* 0x34 */
 105        u8 res3[0x18];          /* 0x38 */
 106        u32 rfshctl0;           /* 0x50 */
 107        u32 rfshctl1;           /* 0x54 */
 108        u8 res4[0x8];           /* 0x58 */
 109        u32 rfshctl3;           /* 0x60 */
 110        u32 rfshtmg;            /* 0x64 */
 111        u8 res6[0x68];          /* 0x68 */
 112        u32 init0;              /* 0xd0 */
 113        u32 init1;              /* 0xd4 */
 114        u32 init2;              /* 0xd8 */
 115        u32 init3;              /* 0xdc */
 116        u32 init4;              /* 0xe0 */
 117        u32 init5;              /* 0xe4 */
 118        u8 res7[0x0c];          /* 0xe8 */
 119        u32 rankctl;            /* 0xf4 */
 120        u8 res8[0x08];          /* 0xf8 */
 121        u32 dramtmg0;           /* 0x100 */
 122        u32 dramtmg1;           /* 0x104 */
 123        u32 dramtmg2;           /* 0x108 */
 124        u32 dramtmg3;           /* 0x10c */
 125        u32 dramtmg4;           /* 0x110 */
 126        u32 dramtmg5;           /* 0x114 */
 127        u32 dramtmg6;           /* 0x118 */
 128        u32 dramtmg7;           /* 0x11c */
 129        u32 dramtmg8;           /* 0x120 */
 130        u8 res9[0x5c];          /* 0x124 */
 131        u32 zqctl0;             /* 0x180 */
 132        u32 zqctl1;             /* 0x184 */
 133        u32 zqctl2;             /* 0x188 */
 134        u32 zqstat;             /* 0x18c */
 135        u32 pitmg0;             /* 0x190 */
 136        u32 pitmg1;             /* 0x194 */
 137        u32 plpcfg0;            /* 0x198 */
 138        u8 res10[0x04];         /* 0x19c */
 139        u32 upd0;               /* 0x1a0 */
 140        u32 upd1;               /* 0x1a4 */
 141        u32 upd2;               /* 0x1a8 */
 142        u32 upd3;               /* 0x1ac */
 143        u32 pimisc;             /* 0x1b0 */
 144        u8 res11[0x1c];         /* 0x1b4 */
 145        u32 trainctl0;          /* 0x1d0 */
 146        u32 trainctl1;          /* 0x1d4 */
 147        u32 trainctl2;          /* 0x1d8 */
 148        u32 trainstat;          /* 0x1dc */
 149        u8 res12[0x60];         /* 0x1e0 */
 150        u32 odtcfg;             /* 0x240 */
 151        u32 odtmap;             /* 0x244 */
 152        u8 res13[0x08];         /* 0x248 */
 153        u32 sched;              /* 0x250 */
 154        u8 res14[0x04];         /* 0x254 */
 155        u32 perfshpr0;          /* 0x258 */
 156        u32 perfshpr1;          /* 0x25c */
 157        u32 perflpr0;           /* 0x260 */
 158        u32 perflpr1;           /* 0x264 */
 159        u32 perfwr0;            /* 0x268 */
 160        u32 perfwr1;            /* 0x26c */
 161};
 162
 163struct sunxi_mctl_phy_reg {
 164        u8 res0[0x04];          /* 0x00 */
 165        u32 pir;                /* 0x04 */
 166        u32 pgcr0;              /* 0x08 phy general configuration register */
 167        u32 pgcr1;              /* 0x0c phy general configuration register */
 168        u32 pgsr0;              /* 0x10 */
 169        u32 pgsr1;              /* 0x14 */
 170        u32 dllgcr;             /* 0x18 */
 171        u32 ptr0;               /* 0x1c */
 172        u32 ptr1;               /* 0x20 */
 173        u32 ptr2;               /* 0x24 */
 174        u32 ptr3;               /* 0x28 */
 175        u32 ptr4;               /* 0x2c */
 176        u32 acmdlr;             /* 0x30 */
 177        u32 acbdlr;             /* 0x34 */
 178        u32 aciocr;             /* 0x38 */
 179        u32 dxccr;              /* 0x3c DATX8 common configuration register */
 180        u32 dsgcr;              /* 0x40 dram system general config register */
 181        u32 dcr;                /* 0x44 */
 182        u32 dtpr0;              /* 0x48 dram timing parameters register 0 */
 183        u32 dtpr1;              /* 0x4c dram timing parameters register 1 */
 184        u32 dtpr2;              /* 0x50 dram timing parameters register 2 */
 185        u32 mr0;                /* 0x54 mode register 0 */
 186        u32 mr1;                /* 0x58 mode register 1 */
 187        u32 mr2;                /* 0x5c mode register 2 */
 188        u32 mr3;                /* 0x60 mode register 3 */
 189        u32 odtcr;              /* 0x64 */
 190        u32 dtcr;               /* 0x68 */
 191        u32 dtar0;              /* 0x6c data training address register 0 */
 192        u32 dtar1;              /* 0x70 data training address register 1 */
 193        u32 dtar2;              /* 0x74 data training address register 2 */
 194        u32 dtar3;              /* 0x78 data training address register 3 */
 195        u32 dtdr0;              /* 0x7c */
 196        u32 dtdr1;              /* 0x80 */
 197        u32 dtedr0;             /* 0x84 */
 198        u32 dtedr1;             /* 0x88 */
 199        u32 pgcr2;              /* 0x8c */
 200        u8 res1[0x70];          /* 0x90 */
 201        u32 bistrr;             /* 0x100 */
 202        u32 bistwcr;            /* 0x104 */
 203        u32 bistmskr0;          /* 0x108 */
 204        u32 bistmskr1;          /* 0x10c */
 205        u32 bistmskr2;          /* 0x110 */
 206        u32 bistlsr;            /* 0x114 */
 207        u32 bistar0;            /* 0x118 */
 208        u32 bistar1;            /* 0x11c */
 209        u32 bistar2;            /* 0x120 */
 210        u32 bistupdr;           /* 0x124 */
 211        u32 bistgsr;            /* 0x128 */
 212        u32 bistwer;            /* 0x12c */
 213        u32 bistber0;           /* 0x130 */
 214        u32 bistber1;           /* 0x134 */
 215        u32 bistber2;           /* 0x138 */
 216        u32 bistber3;           /* 0x13c */
 217        u32 bistwcsr;           /* 0x140 */
 218        u32 bistfwr0;           /* 0x144 */
 219        u32 bistfwr1;           /* 0x148 */
 220        u32 bistfwr2;           /* 0x14c */
 221        u8 res2[0x30];          /* 0x150 */
 222        u32 zqcr0;              /* 0x180 zq control register 0 */
 223        u32 zqcr1;              /* 0x184 zq control register 1 */
 224        u32 zqsr0;              /* 0x188 zq status register 0 */
 225        u32 zqsr1;              /* 0x18c zq status register 1 */
 226        u32 zqcr2;              /* 0x190 zq control register 2 */
 227        u8 res3[0x2c];          /* 0x194 */
 228        u32 dx0gcr;             /* 0x1c0 */
 229        u32 dx0gsr0;            /* 0x1c4 */
 230        u32 dx0gsr1;            /* 0x1c8 */
 231        u32 dx0bdlr0;           /* 0x1cc */
 232        u32 dx0bdlr1;           /* 0x1d0 */
 233        u32 dx0bdlr2;           /* 0x1d4 */
 234        u32 dx0bdlr3;           /* 0x1d8 */
 235        u32 dx0bdlr4;           /* 0x1dc */
 236        u32 dx0lcdlr0;          /* 0x1e0 */
 237        u32 dx0lcdlr1;          /* 0x1e4 */
 238        u32 dx0lcdlr2;          /* 0x1e8 */
 239        u32 dx0mdlr;            /* 0x1ec */
 240        u32 dx0gtr;             /* 0x1f0 */
 241        u32 dx0gsr2;            /* 0x1f4 */
 242        u8 res4[0x08];          /* 0x1f8 */
 243        u32 dx1gcr;             /* 0x200 */
 244        u32 dx1gsr0;            /* 0x204 */
 245        u32 dx1gsr1;            /* 0x208 */
 246        u32 dx1bdlr0;           /* 0x20c */
 247        u32 dx1bdlr1;           /* 0x210 */
 248        u32 dx1bdlr2;           /* 0x214 */
 249        u32 dx1bdlr3;           /* 0x218 */
 250        u32 dx1bdlr4;           /* 0x21c */
 251        u32 dx1lcdlr0;          /* 0x220 */
 252        u32 dx1lcdlr1;          /* 0x224 */
 253        u32 dx1lcdlr2;          /* 0x228 */
 254        u32 dx1mdlr;            /* 0x22c */
 255        u32 dx1gtr;             /* 0x230 */
 256        u32 dx1gsr2;            /* 0x234 */
 257};
 258
 259/*
 260 * DRAM common (sunxi_mctl_com_reg) register constants.
 261 */
 262#define MCTL_CR_ROW_MASK                (0xf << 4)
 263#define MCTL_CR_ROW(x)                  (((x) - 1) << 4)
 264#define MCTL_CR_PAGE_SIZE_MASK          (0xf << 8)
 265#define MCTL_CR_PAGE_SIZE(x)            ((x) << 8)
 266
 267#endif /* _SUNXI_DRAM_SUN8I_H */
 268