18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Definitions for the DDR registers 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright 2002 Ryan Holm <ryan.holmQVist@idt.com> 58c2ecf20Sopenharmony_ci * Copyright 2008 Florian Fainelli <florian@openwrt.org> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 88c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License as published by the 98c2ecf20Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 108c2ecf20Sopenharmony_ci * option) any later version. 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 138c2ecf20Sopenharmony_ci * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 148c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 158c2ecf20Sopenharmony_ci * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 168c2ecf20Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 178c2ecf20Sopenharmony_ci * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 188c2ecf20Sopenharmony_ci * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 198c2ecf20Sopenharmony_ci * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 208c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 218c2ecf20Sopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 228c2ecf20Sopenharmony_ci * 238c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along 248c2ecf20Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc., 258c2ecf20Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#ifndef _ASM_RC32434_DDR_H_ 308c2ecf20Sopenharmony_ci#define _ASM_RC32434_DDR_H_ 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#include <asm/mach-rc32434/rb.h> 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/* DDR register structure */ 358c2ecf20Sopenharmony_cistruct ddr_ram { 368c2ecf20Sopenharmony_ci u32 ddrbase; 378c2ecf20Sopenharmony_ci u32 ddrmask; 388c2ecf20Sopenharmony_ci u32 res1; 398c2ecf20Sopenharmony_ci u32 res2; 408c2ecf20Sopenharmony_ci u32 ddrc; 418c2ecf20Sopenharmony_ci u32 ddrabase; 428c2ecf20Sopenharmony_ci u32 ddramask; 438c2ecf20Sopenharmony_ci u32 ddramap; 448c2ecf20Sopenharmony_ci u32 ddrcust; 458c2ecf20Sopenharmony_ci u32 ddrrdc; 468c2ecf20Sopenharmony_ci u32 ddrspare; 478c2ecf20Sopenharmony_ci}; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define DDR0_PHYS_ADDR 0x18018000 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* DDR banks masks */ 528c2ecf20Sopenharmony_ci#define DDR_MASK 0xffff0000 538c2ecf20Sopenharmony_ci#define DDR0_BASE_MSK DDR_MASK 548c2ecf20Sopenharmony_ci#define DDR1_BASE_MSK DDR_MASK 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* DDR bank0 registers */ 578c2ecf20Sopenharmony_ci#define RC32434_DDR0_ATA_BIT 5 588c2ecf20Sopenharmony_ci#define RC32434_DDR0_ATA_MSK 0x000000E0 598c2ecf20Sopenharmony_ci#define RC32434_DDR0_DBW_BIT 8 608c2ecf20Sopenharmony_ci#define RC32434_DDR0_DBW_MSK 0x00000100 618c2ecf20Sopenharmony_ci#define RC32434_DDR0_WR_BIT 9 628c2ecf20Sopenharmony_ci#define RC32434_DDR0_WR_MSK 0x00000600 638c2ecf20Sopenharmony_ci#define RC32434_DDR0_PS_BIT 11 648c2ecf20Sopenharmony_ci#define RC32434_DDR0_PS_MSK 0x00001800 658c2ecf20Sopenharmony_ci#define RC32434_DDR0_DTYPE_BIT 13 668c2ecf20Sopenharmony_ci#define RC32434_DDR0_DTYPE_MSK 0x0000e000 678c2ecf20Sopenharmony_ci#define RC32434_DDR0_RFC_BIT 16 688c2ecf20Sopenharmony_ci#define RC32434_DDR0_RFC_MSK 0x000f0000 698c2ecf20Sopenharmony_ci#define RC32434_DDR0_RP_BIT 20 708c2ecf20Sopenharmony_ci#define RC32434_DDR0_RP_MSK 0x00300000 718c2ecf20Sopenharmony_ci#define RC32434_DDR0_AP_BIT 22 728c2ecf20Sopenharmony_ci#define RC32434_DDR0_AP_MSK 0x00400000 738c2ecf20Sopenharmony_ci#define RC32434_DDR0_RCD_BIT 23 748c2ecf20Sopenharmony_ci#define RC32434_DDR0_RCD_MSK 0x01800000 758c2ecf20Sopenharmony_ci#define RC32434_DDR0_CL_BIT 25 768c2ecf20Sopenharmony_ci#define RC32434_DDR0_CL_MSK 0x06000000 778c2ecf20Sopenharmony_ci#define RC32434_DDR0_DBM_BIT 27 788c2ecf20Sopenharmony_ci#define RC32434_DDR0_DBM_MSK 0x08000000 798c2ecf20Sopenharmony_ci#define RC32434_DDR0_SDS_BIT 28 808c2ecf20Sopenharmony_ci#define RC32434_DDR0_SDS_MSK 0x10000000 818c2ecf20Sopenharmony_ci#define RC32434_DDR0_ATP_BIT 29 828c2ecf20Sopenharmony_ci#define RC32434_DDR0_ATP_MSK 0x60000000 838c2ecf20Sopenharmony_ci#define RC32434_DDR0_RE_BIT 31 848c2ecf20Sopenharmony_ci#define RC32434_DDR0_RE_MSK 0x80000000 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci/* DDR bank C registers */ 878c2ecf20Sopenharmony_ci#define RC32434_DDRC_MSK(x) BIT_TO_MASK(x) 888c2ecf20Sopenharmony_ci#define RC32434_DDRC_CES_BIT 0 898c2ecf20Sopenharmony_ci#define RC32434_DDRC_ACE_BIT 1 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci/* Custom DDR bank registers */ 928c2ecf20Sopenharmony_ci#define RC32434_DCST_MSK(x) BIT_TO_MASK(x) 938c2ecf20Sopenharmony_ci#define RC32434_DCST_CS_BIT 0 948c2ecf20Sopenharmony_ci#define RC32434_DCST_CS_MSK 0x00000003 958c2ecf20Sopenharmony_ci#define RC32434_DCST_WE_BIT 2 968c2ecf20Sopenharmony_ci#define RC32434_DCST_RAS_BIT 3 978c2ecf20Sopenharmony_ci#define RC32434_DCST_CAS_BIT 4 988c2ecf20Sopenharmony_ci#define RC32434_DSCT_CKE_BIT 5 998c2ecf20Sopenharmony_ci#define RC32434_DSCT_BA_BIT 6 1008c2ecf20Sopenharmony_ci#define RC32434_DSCT_BA_MSK 0x000000c0 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci/* DDR QSC registers */ 1038c2ecf20Sopenharmony_ci#define RC32434_QSC_DM_BIT 0 1048c2ecf20Sopenharmony_ci#define RC32434_QSC_DM_MSK 0x00000003 1058c2ecf20Sopenharmony_ci#define RC32434_QSC_DQSBS_BIT 2 1068c2ecf20Sopenharmony_ci#define RC32434_QSC_DQSBS_MSK 0x000000fc 1078c2ecf20Sopenharmony_ci#define RC32434_QSC_DB_BIT 8 1088c2ecf20Sopenharmony_ci#define RC32434_QSC_DB_MSK 0x00000100 1098c2ecf20Sopenharmony_ci#define RC32434_QSC_DBSP_BIT 9 1108c2ecf20Sopenharmony_ci#define RC32434_QSC_DBSP_MSK 0x01fffe00 1118c2ecf20Sopenharmony_ci#define RC32434_QSC_BDP_BIT 25 1128c2ecf20Sopenharmony_ci#define RC32434_QSC_BDP_MSK 0x7e000000 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci/* DDR LLC registers */ 1158c2ecf20Sopenharmony_ci#define RC32434_LLC_EAO_BIT 0 1168c2ecf20Sopenharmony_ci#define RC32434_LLC_EAO_MSK 0x00000001 1178c2ecf20Sopenharmony_ci#define RC32434_LLC_EO_BIT 1 1188c2ecf20Sopenharmony_ci#define RC32434_LLC_EO_MSK 0x0000003e 1198c2ecf20Sopenharmony_ci#define RC32434_LLC_FS_BIT 6 1208c2ecf20Sopenharmony_ci#define RC32434_LLC_FS_MSK 0x000000c0 1218c2ecf20Sopenharmony_ci#define RC32434_LLC_AS_BIT 8 1228c2ecf20Sopenharmony_ci#define RC32434_LLC_AS_MSK 0x00000700 1238c2ecf20Sopenharmony_ci#define RC32434_LLC_SP_BIT 11 1248c2ecf20Sopenharmony_ci#define RC32434_LLC_SP_MSK 0x001ff800 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci/* DDR LLFC registers */ 1278c2ecf20Sopenharmony_ci#define RC32434_LLFC_MSK(x) BIT_TO_MASK(x) 1288c2ecf20Sopenharmony_ci#define RC32434_LLFC_MEN_BIT 0 1298c2ecf20Sopenharmony_ci#define RC32434_LLFC_EAN_BIT 1 1308c2ecf20Sopenharmony_ci#define RC32434_LLFC_FF_BIT 2 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci/* DDR DLLTA registers */ 1338c2ecf20Sopenharmony_ci#define RC32434_DLLTA_ADDR_BIT 2 1348c2ecf20Sopenharmony_ci#define RC32434_DLLTA_ADDR_MSK 0xfffffffc 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci/* DDR DLLED registers */ 1378c2ecf20Sopenharmony_ci#define RC32434_DLLED_MSK(x) BIT_TO_MASK(x) 1388c2ecf20Sopenharmony_ci#define RC32434_DLLED_DBE_BIT 0 1398c2ecf20Sopenharmony_ci#define RC32434_DLLED_DTE_BIT 1 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci#endif /* _ASM_RC32434_DDR_H_ */ 142