paul@33 | 1 | /* |
paul@33 | 2 | * Common SDRAM configuration |
paul@33 | 3 | * |
paul@33 | 4 | * Copyright (C) 2009 Qi Hardware Inc. |
paul@33 | 5 | * Authors: Xiangfu Liu <xiangfu@openmobilefree.net> |
paul@33 | 6 | * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk> |
paul@33 | 7 | * |
paul@33 | 8 | * This program is free software; you can redistribute it and/or |
paul@33 | 9 | * modify it under the terms of the GNU General Public License |
paul@33 | 10 | * as published by the Free Software Foundation; either version |
paul@33 | 11 | * 3 of the License, or (at your option) any later version. |
paul@33 | 12 | * |
paul@33 | 13 | * This program is distributed in the hope that it will be useful, |
paul@33 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@33 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@33 | 16 | * GNU General Public License for more details. |
paul@33 | 17 | * |
paul@33 | 18 | * You should have received a copy of the GNU General Public License |
paul@33 | 19 | * along with this program; if not, write to the Free Software |
paul@33 | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@33 | 21 | * Boston, MA 02110-1301, USA |
paul@33 | 22 | */ |
paul@33 | 23 | |
paul@33 | 24 | #ifndef __SDRAM_H__ |
paul@33 | 25 | #define __SDRAM_H__ |
paul@33 | 26 | |
paul@33 | 27 | /* virt_to_phys() from u-boot/arch/mips/include/asm/addrspace.h |
paul@33 | 28 | via u-boot/arch/mips/include/asm/io.h */ |
paul@33 | 29 | /* #define virt_to_phys(n) (((int) n) & 0x1fffffff) */ |
paul@33 | 30 | #define virt_to_phys(n) ((int) n) |
paul@33 | 31 | |
paul@33 | 32 | /* |
paul@33 | 33 | * RAM configuration |
paul@33 | 34 | */ |
paul@33 | 35 | #define CONFIG_SYS_SDRAM_BASE 0x80000000 |
paul@33 | 36 | |
paul@33 | 37 | /* |
paul@33 | 38 | * SDRAM configuration (timings in ns) |
paul@33 | 39 | */ |
paul@56 | 40 | #ifdef CONFIG_CPU_JZ4730_MINIPC |
paul@56 | 41 | #define SDRAM_BW16 0 /* Data bus width: 0-32bit, 1-16bit */ |
paul@56 | 42 | #else |
paul@56 | 43 | #define SDRAM_BW16 1 /* Data bus width: 0-32bit, 1-16bit */ |
paul@56 | 44 | #endif |
paul@56 | 45 | |
paul@56 | 46 | #define SDRAM_BANK4 1 /* Banks each chip: 0-2bank, 1-4bank */ |
paul@56 | 47 | #define SDRAM_ROW 13 /* Row address: 11 to 13 */ |
paul@56 | 48 | #define SDRAM_COL 9 /* Column address: 8 to 12 */ |
paul@56 | 49 | #define SDRAM_CASL 2 /* CAS latency: 2 or 3 */ |
paul@56 | 50 | #define SDRAM_TRAS 45 /* RAS# Active Time */ |
paul@56 | 51 | #define SDRAM_RCD 20 /* RAS# to CAS# Delay */ |
paul@56 | 52 | #define SDRAM_TPC 20 /* RAS# Precharge Time */ |
paul@56 | 53 | #define SDRAM_TRWL 7 /* Write Latency Time */ |
paul@56 | 54 | |
paul@56 | 55 | #ifdef CONFIG_CPU_JZ4730_MINIPC |
paul@56 | 56 | #define SDRAM_TREF 7812 /* Refresh period: 8192 cycles/64ms */ |
paul@56 | 57 | #else |
paul@56 | 58 | #define SDRAM_TREF 15625 /* Refresh period: 8192 cycles/64ms */ |
paul@56 | 59 | #endif |
paul@33 | 60 | |
paul@33 | 61 | #define SDRAM_ROW0 11 /* Row address minimum */ |
paul@33 | 62 | #define SDRAM_COL0 8 /* Column address minimum */ |
paul@33 | 63 | #define SDRAM_BANK40 0 /* Bank minimum */ |
paul@33 | 64 | |
paul@33 | 65 | /* |
paul@33 | 66 | * Cache configuration |
paul@33 | 67 | */ |
paul@33 | 68 | #define CONFIG_SYS_DCACHE_SIZE 16384 |
paul@33 | 69 | #define CONFIG_SYS_ICACHE_SIZE 16384 |
paul@33 | 70 | #define CONFIG_SYS_CACHELINE_SIZE 32 |
paul@33 | 71 | |
paul@33 | 72 | /* |
paul@33 | 73 | * Memory configuration |
paul@33 | 74 | */ |
paul@33 | 75 | #define KSEG0 0x80000000 |
paul@33 | 76 | #define PAGE_SIZE 4096 |
paul@33 | 77 | |
paul@33 | 78 | #endif /* __SDRAM_H__ */ |