mirror of
https://github.com/hno/allwinner-boot.git
synced 2025-05-08 19:36:43 +08:00
update dram drv
This commit is contained in:
parent
40f7fa97cd
commit
cc54a0cb54
@ -1,95 +1,95 @@
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* File : dram_i.h
|
||||
* By : Berg.Xing
|
||||
* Date : 2011-06-01
|
||||
* Descript: dram csp for AW1623 chipset;
|
||||
* Update : date auther ver notes
|
||||
* 2011-06-01 Berg 1.0 create file
|
||||
* 2011-07-01 Berg 1.1 add extern function description
|
||||
* 2011-08-05 Berg 1.2 add CPU_CFIG_REG in timer module
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
#ifndef __DRAM_I_H__
|
||||
#define __DRAM_I_H__
|
||||
|
||||
#define DRAMC_PHY_BASE 0x01c01000
|
||||
#define DRAMC_MEM_SIZE 0x400
|
||||
|
||||
#define SDR_CCR (DRAMC_PHY_BASE + 0x00)
|
||||
#define SDR_DCR (DRAMC_PHY_BASE + 0x04)
|
||||
#define SDR_IOCR (DRAMC_PHY_BASE + 0x08)
|
||||
#define SDR_CSR (DRAMC_PHY_BASE + 0x0c)
|
||||
#define SDR_DRR (DRAMC_PHY_BASE + 0x10)
|
||||
#define SDR_TPR0 (DRAMC_PHY_BASE + 0x14)
|
||||
#define SDR_TPR1 (DRAMC_PHY_BASE + 0x18)
|
||||
#define SDR_TPR2 (DRAMC_PHY_BASE + 0x1c)
|
||||
#define SDR_RSLR0 (DRAMC_PHY_BASE + 0x4c)
|
||||
#define SDR_RSLR1 (DRAMC_PHY_BASE + 0x50)
|
||||
#define SDR_RDQSGR (DRAMC_PHY_BASE + 0x5c)
|
||||
#define SDR_ODTCR (DRAMC_PHY_BASE + 0x98)
|
||||
#define SDR_DTR0 (DRAMC_PHY_BASE + 0x9c)
|
||||
#define SDR_DTR1 (DRAMC_PHY_BASE + 0xa0)
|
||||
#define SDR_DTAR (DRAMC_PHY_BASE + 0xa4)
|
||||
#define SDR_ZQCR0 (DRAMC_PHY_BASE + 0xa8)
|
||||
#define SDR_ZQCR1 (DRAMC_PHY_BASE + 0xac)
|
||||
#define SDR_ZQSR (DRAMC_PHY_BASE + 0xb0)
|
||||
#define SDR_IDCR (DRAMC_PHY_BASE + 0xb4)
|
||||
#define SDR_MR (DRAMC_PHY_BASE + 0x1f0)
|
||||
#define SDR_EMR (DRAMC_PHY_BASE + 0x1f4)
|
||||
#define SDR_EMR2 (DRAMC_PHY_BASE + 0x1f8)
|
||||
#define SDR_EMR3 (DRAMC_PHY_BASE + 0x1fc)
|
||||
#define SDR_DLLCR (DRAMC_PHY_BASE + 0x200)
|
||||
#define SDR_DLLCR0 (DRAMC_PHY_BASE + 0x204)
|
||||
#define SDR_DLLCR1 (DRAMC_PHY_BASE + 0x208)
|
||||
#define SDR_DLLCR2 (DRAMC_PHY_BASE + 0x20c)
|
||||
#define SDR_DLLCR3 (DRAMC_PHY_BASE + 0x210)
|
||||
#define SDR_DLLCR4 (DRAMC_PHY_BASE + 0x214)
|
||||
#define SDR_DQTR0 (DRAMC_PHY_BASE + 0x218)
|
||||
#define SDR_DQTR1 (DRAMC_PHY_BASE + 0x21c)
|
||||
#define SDR_DQTR2 (DRAMC_PHY_BASE + 0x220)
|
||||
#define SDR_DQTR3 (DRAMC_PHY_BASE + 0x224)
|
||||
#define SDR_DQSTR0 (DRAMC_PHY_BASE + 0x228)
|
||||
#define SDR_DQSTR1 (DRAMC_PHY_BASE + 0x22c)
|
||||
#define SDR_CR (DRAMC_PHY_BASE + 0x230)
|
||||
#define SDR_CFSR (DRAMC_PHY_BASE + 0x234)
|
||||
#define SDR_DPCR (DRAMC_PHY_BASE + 0x23c)
|
||||
#define SDR_APR (DRAMC_PHY_BASE + 0x240)
|
||||
#define SDR_LTR (DRAMC_PHY_BASE + 0x244)
|
||||
#define SDR_HPCR (DRAMC_PHY_BASE + 0x250)
|
||||
#define SDR_SCSR (DRAMC_PHY_BASE + 0x2e0)
|
||||
|
||||
|
||||
|
||||
#define mctl_read_w(n) (*((volatile unsigned int *)(n)))
|
||||
#define mctl_write_w(n,c) (*((volatile unsigned int *)(n)) = (c))
|
||||
|
||||
|
||||
//CCM register for dram
|
||||
#define DRAM_CCM_BASE 0x01c20000
|
||||
#define DRAM_CCM_MEMSIZE 0x400
|
||||
|
||||
#define DRAM_CCM_SDRAM_PLL_REG (DRAM_CCM_BASE + 0x20)
|
||||
#define DRAM_CCM_AHB_GATE_REG (DRAM_CCM_BASE + 0x60)
|
||||
#define DRAM_CCM_GPS_CLK_REG (DRAM_CCM_BASE + 0xd0)
|
||||
#define DRAM_CCM_SDRAM_CLK_REG (DRAM_CCM_BASE + 0x100)
|
||||
|
||||
//TIMER register for system
|
||||
#define DRAM_TIMER_BASE 0x01c20c00
|
||||
#define TIMER_CPU_CFG_REG (DRAM_TIMER_BASE + 0x13c)
|
||||
|
||||
|
||||
extern void DRAMC_clock_output_en(__u32 on);
|
||||
extern void DRAMC_set_autorefresh_cycle(__u32 clk);
|
||||
extern int DRAMC_scan_readpipe(void);
|
||||
extern unsigned DRAMC_get_dram_size(void);
|
||||
extern void mctl_delay(__u32 dly);
|
||||
|
||||
extern void mctl_itm_disable(void);
|
||||
extern void mctl_itm_enable(void);
|
||||
extern void mctl_enable_dll0(void);
|
||||
extern void mctl_enable_dllx(void);
|
||||
extern void mctl_disable_dll(void);
|
||||
|
||||
#endif //__DRAM_REG_H__
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* File : dram_i.h
|
||||
* By : Berg.Xing
|
||||
* Date : 2011-06-01
|
||||
* Descript: dram csp for AW1623 chipset;
|
||||
* Update : date auther ver notes
|
||||
* 2011-06-01 Berg 1.0 create file
|
||||
* 2011-07-01 Berg 1.1 add extern function description
|
||||
* 2011-08-05 Berg 1.2 add CPU_CFIG_REG in timer module
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
#ifndef __DRAM_I_H__
|
||||
#define __DRAM_I_H__
|
||||
|
||||
#define DRAMC_PHY_BASE 0x01c01000
|
||||
#define DRAMC_MEM_SIZE 0x400
|
||||
|
||||
#define SDR_CCR (DRAMC_PHY_BASE + 0x00)
|
||||
#define SDR_DCR (DRAMC_PHY_BASE + 0x04)
|
||||
#define SDR_IOCR (DRAMC_PHY_BASE + 0x08)
|
||||
#define SDR_CSR (DRAMC_PHY_BASE + 0x0c)
|
||||
#define SDR_DRR (DRAMC_PHY_BASE + 0x10)
|
||||
#define SDR_TPR0 (DRAMC_PHY_BASE + 0x14)
|
||||
#define SDR_TPR1 (DRAMC_PHY_BASE + 0x18)
|
||||
#define SDR_TPR2 (DRAMC_PHY_BASE + 0x1c)
|
||||
#define SDR_RSLR0 (DRAMC_PHY_BASE + 0x4c)
|
||||
#define SDR_RSLR1 (DRAMC_PHY_BASE + 0x50)
|
||||
#define SDR_RDQSGR (DRAMC_PHY_BASE + 0x5c)
|
||||
#define SDR_ODTCR (DRAMC_PHY_BASE + 0x98)
|
||||
#define SDR_DTR0 (DRAMC_PHY_BASE + 0x9c)
|
||||
#define SDR_DTR1 (DRAMC_PHY_BASE + 0xa0)
|
||||
#define SDR_DTAR (DRAMC_PHY_BASE + 0xa4)
|
||||
#define SDR_ZQCR0 (DRAMC_PHY_BASE + 0xa8)
|
||||
#define SDR_ZQCR1 (DRAMC_PHY_BASE + 0xac)
|
||||
#define SDR_ZQSR (DRAMC_PHY_BASE + 0xb0)
|
||||
#define SDR_IDCR (DRAMC_PHY_BASE + 0xb4)
|
||||
#define SDR_MR (DRAMC_PHY_BASE + 0x1f0)
|
||||
#define SDR_EMR (DRAMC_PHY_BASE + 0x1f4)
|
||||
#define SDR_EMR2 (DRAMC_PHY_BASE + 0x1f8)
|
||||
#define SDR_EMR3 (DRAMC_PHY_BASE + 0x1fc)
|
||||
#define SDR_DLLCR (DRAMC_PHY_BASE + 0x200)
|
||||
#define SDR_DLLCR0 (DRAMC_PHY_BASE + 0x204)
|
||||
#define SDR_DLLCR1 (DRAMC_PHY_BASE + 0x208)
|
||||
#define SDR_DLLCR2 (DRAMC_PHY_BASE + 0x20c)
|
||||
#define SDR_DLLCR3 (DRAMC_PHY_BASE + 0x210)
|
||||
#define SDR_DLLCR4 (DRAMC_PHY_BASE + 0x214)
|
||||
#define SDR_DQTR0 (DRAMC_PHY_BASE + 0x218)
|
||||
#define SDR_DQTR1 (DRAMC_PHY_BASE + 0x21c)
|
||||
#define SDR_DQTR2 (DRAMC_PHY_BASE + 0x220)
|
||||
#define SDR_DQTR3 (DRAMC_PHY_BASE + 0x224)
|
||||
#define SDR_DQSTR0 (DRAMC_PHY_BASE + 0x228)
|
||||
#define SDR_DQSTR1 (DRAMC_PHY_BASE + 0x22c)
|
||||
#define SDR_CR (DRAMC_PHY_BASE + 0x230)
|
||||
#define SDR_CFSR (DRAMC_PHY_BASE + 0x234)
|
||||
#define SDR_DPCR (DRAMC_PHY_BASE + 0x23c)
|
||||
#define SDR_APR (DRAMC_PHY_BASE + 0x240)
|
||||
#define SDR_LTR (DRAMC_PHY_BASE + 0x244)
|
||||
#define SDR_HPCR (DRAMC_PHY_BASE + 0x250)
|
||||
#define SDR_SCSR (DRAMC_PHY_BASE + 0x2e0)
|
||||
|
||||
|
||||
|
||||
#define mctl_read_w(n) (*((volatile unsigned int *)(n)))
|
||||
#define mctl_write_w(n,c) (*((volatile unsigned int *)(n)) = (c))
|
||||
|
||||
|
||||
//CCM register for dram
|
||||
#define DRAM_CCM_BASE 0x01c20000
|
||||
#define DRAM_CCM_MEMSIZE 0x400
|
||||
|
||||
#define DRAM_CCM_SDRAM_PLL_REG (DRAM_CCM_BASE + 0x20)
|
||||
#define DRAM_CCM_AHB_GATE_REG (DRAM_CCM_BASE + 0x60)
|
||||
#define DRAM_CCM_GPS_CLK_REG (DRAM_CCM_BASE + 0xd0)
|
||||
#define DRAM_CCM_SDRAM_CLK_REG (DRAM_CCM_BASE + 0x100)
|
||||
|
||||
//TIMER register for system
|
||||
#define DRAM_TIMER_BASE 0x01c20c00
|
||||
#define TIMER_CPU_CFG_REG (DRAM_TIMER_BASE + 0x13c)
|
||||
|
||||
|
||||
extern void DRAMC_clock_output_en(__u32 on);
|
||||
extern void DRAMC_set_autorefresh_cycle(__u32 clk);
|
||||
extern int DRAMC_scan_readpipe(void);
|
||||
extern unsigned DRAMC_get_dram_size(void);
|
||||
extern void mctl_delay(__u32 dly);
|
||||
|
||||
extern void mctl_itm_disable(void);
|
||||
extern void mctl_itm_enable(void);
|
||||
extern void mctl_enable_dll0(void);
|
||||
extern void mctl_enable_dllx(void);
|
||||
extern void mctl_disable_dll(void);
|
||||
|
||||
#endif //__DRAM_REG_H__
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,71 +1,71 @@
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* MELIS
|
||||
* the Easy Portable/Player Develop Kits
|
||||
* DRAM CSP Module
|
||||
*
|
||||
* (c) Copyright 2006-2010, Berg.Xing China
|
||||
* All Rights Reserved
|
||||
*
|
||||
* File : csp_dram_para.h
|
||||
* By : Berg.Xing
|
||||
* Version : v1.0
|
||||
* Date : 2010-12-2 13:24
|
||||
* Descript:
|
||||
* Update : date auther ver notes
|
||||
* 2010-12-2 13:24 Berg.Xing 1.0 build the file;
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
#ifndef __CSP_DRAM_PARA_H__
|
||||
#define __CSP_DRAM_PARA_H__
|
||||
|
||||
#define DRAM_PIN_DEV_ID (0)
|
||||
#define DRAM_PIN_LIST ((__u32 *)0)
|
||||
#define DRAM_PIN_NUMBER (0)
|
||||
|
||||
#define FPGA_51_TEST
|
||||
|
||||
/*
|
||||
#define T_WR 0x9
|
||||
#define T_WTR 0x7
|
||||
#define T_RTP 0x3
|
||||
#define T_RTW 0x6
|
||||
#define T_RAS 0xf
|
||||
#define T_RRD 0x4
|
||||
#define T_RC 0x14
|
||||
#define T_RCD 0x5
|
||||
#define T_CKE 0x3
|
||||
#define T_APD 0x8
|
||||
#define T_XP 0x2
|
||||
#define T_FAW 0xf
|
||||
#define T_XSR 0xc8
|
||||
#define T_RP 0x5
|
||||
*/
|
||||
|
||||
//==============================================================================
|
||||
// dram configuration parameter reference value
|
||||
//==============================================================================
|
||||
//DDR1_32B DDR1_32B_32Mx16 (DDR 32-bits bus by two 32Mx16 SDRAM chip)
|
||||
//DDR1_16B DDR1_16B_32Mx16
|
||||
//DDR2_32B DDR2_32B_64Mx16
|
||||
//DDR2_16B DDR2_16B_64Mx16
|
||||
//DDR3_32B DDR3_32B_128Mx16
|
||||
//DDR3_16B DDR3_32B_128Mx16
|
||||
|
||||
|
||||
//#ifdef DDR2_FPGA_S2C
|
||||
//DDR2 64Mx16 (128M Byte)
|
||||
#define MCTL_DDR_TYPE 2 //1: DDR, 2: DDR2, 3: DDR3
|
||||
#define MCTL_IO_WIDTH 8
|
||||
#define MCTL_CHIP_SIZE 1024 //unit in Mb
|
||||
#define MCTL_CAS 5
|
||||
#define MCTL_BANK_SIZE 8
|
||||
#define MCTL_COL_WIDTH 10
|
||||
#define MCTL_ROW_WIDTH 14
|
||||
#define MCTL_BUS_WIDTH 32
|
||||
#define DRAMC_ID 1 //0: DRAMC0, 1: DRAMC1
|
||||
//#endif
|
||||
|
||||
|
||||
#endif //__CSP_DRAM_PARA_H__
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* MELIS
|
||||
* the Easy Portable/Player Develop Kits
|
||||
* DRAM CSP Module
|
||||
*
|
||||
* (c) Copyright 2006-2010, Berg.Xing China
|
||||
* All Rights Reserved
|
||||
*
|
||||
* File : csp_dram_para.h
|
||||
* By : Berg.Xing
|
||||
* Version : v1.0
|
||||
* Date : 2010-12-2 13:24
|
||||
* Descript:
|
||||
* Update : date auther ver notes
|
||||
* 2010-12-2 13:24 Berg.Xing 1.0 build the file;
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
#ifndef __CSP_DRAM_PARA_H__
|
||||
#define __CSP_DRAM_PARA_H__
|
||||
|
||||
#define DRAM_PIN_DEV_ID (0)
|
||||
#define DRAM_PIN_LIST ((__u32 *)0)
|
||||
#define DRAM_PIN_NUMBER (0)
|
||||
|
||||
#define FPGA_51_TEST
|
||||
|
||||
/*
|
||||
#define T_WR 0x9
|
||||
#define T_WTR 0x7
|
||||
#define T_RTP 0x3
|
||||
#define T_RTW 0x6
|
||||
#define T_RAS 0xf
|
||||
#define T_RRD 0x4
|
||||
#define T_RC 0x14
|
||||
#define T_RCD 0x5
|
||||
#define T_CKE 0x3
|
||||
#define T_APD 0x8
|
||||
#define T_XP 0x2
|
||||
#define T_FAW 0xf
|
||||
#define T_XSR 0xc8
|
||||
#define T_RP 0x5
|
||||
*/
|
||||
|
||||
//==============================================================================
|
||||
// dram configuration parameter reference value
|
||||
//==============================================================================
|
||||
//DDR1_32B DDR1_32B_32Mx16 (DDR 32-bits bus by two 32Mx16 SDRAM chip)
|
||||
//DDR1_16B DDR1_16B_32Mx16
|
||||
//DDR2_32B DDR2_32B_64Mx16
|
||||
//DDR2_16B DDR2_16B_64Mx16
|
||||
//DDR3_32B DDR3_32B_128Mx16
|
||||
//DDR3_16B DDR3_32B_128Mx16
|
||||
|
||||
|
||||
//#ifdef DDR2_FPGA_S2C
|
||||
//DDR2 64Mx16 (128M Byte)
|
||||
#define MCTL_DDR_TYPE 2 //1: DDR, 2: DDR2, 3: DDR3
|
||||
#define MCTL_IO_WIDTH 8
|
||||
#define MCTL_CHIP_SIZE 1024 //unit in Mb
|
||||
#define MCTL_CAS 5
|
||||
#define MCTL_BANK_SIZE 8
|
||||
#define MCTL_COL_WIDTH 10
|
||||
#define MCTL_ROW_WIDTH 14
|
||||
#define MCTL_BUS_WIDTH 32
|
||||
#define DRAMC_ID 1 //0: DRAMC0, 1: DRAMC1
|
||||
//#endif
|
||||
|
||||
|
||||
#endif //__CSP_DRAM_PARA_H__
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user