Wolfgang Denk | 72a087e | 2006-10-24 14:27:35 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Register definitions for SDRAM Controller |
| 3 | */ |
| 4 | #ifndef __ASM_AVR32_HSDRAMC1_H__ |
| 5 | #define __ASM_AVR32_HSDRAMC1_H__ |
| 6 | |
| 7 | /* HSDRAMC1 register offsets */ |
| 8 | #define HSDRAMC1_MR 0x0000 |
| 9 | #define HSDRAMC1_TR 0x0004 |
| 10 | #define HSDRAMC1_CR 0x0008 |
| 11 | #define HSDRAMC1_HSR 0x000c |
| 12 | #define HSDRAMC1_LPR 0x0010 |
| 13 | #define HSDRAMC1_IER 0x0014 |
| 14 | #define HSDRAMC1_IDR 0x0018 |
| 15 | #define HSDRAMC1_IMR 0x001c |
| 16 | #define HSDRAMC1_ISR 0x0020 |
| 17 | #define HSDRAMC1_MDR 0x0024 |
| 18 | #define HSDRAMC1_VERSION 0x00fc |
| 19 | |
| 20 | /* Bitfields in MR */ |
| 21 | #define HSDRAMC1_MODE_OFFSET 0 |
| 22 | #define HSDRAMC1_MODE_SIZE 3 |
| 23 | |
| 24 | /* Bitfields in TR */ |
| 25 | #define HSDRAMC1_COUNT_OFFSET 0 |
| 26 | #define HSDRAMC1_COUNT_SIZE 12 |
| 27 | |
| 28 | /* Bitfields in CR */ |
| 29 | #define HSDRAMC1_NC_OFFSET 0 |
| 30 | #define HSDRAMC1_NC_SIZE 2 |
| 31 | #define HSDRAMC1_NR_OFFSET 2 |
| 32 | #define HSDRAMC1_NR_SIZE 2 |
| 33 | #define HSDRAMC1_NB_OFFSET 4 |
| 34 | #define HSDRAMC1_NB_SIZE 1 |
| 35 | #define HSDRAMC1_CAS_OFFSET 5 |
| 36 | #define HSDRAMC1_CAS_SIZE 2 |
| 37 | #define HSDRAMC1_DBW_OFFSET 7 |
| 38 | #define HSDRAMC1_DBW_SIZE 1 |
| 39 | #define HSDRAMC1_TWR_OFFSET 8 |
| 40 | #define HSDRAMC1_TWR_SIZE 4 |
| 41 | #define HSDRAMC1_TRC_OFFSET 12 |
| 42 | #define HSDRAMC1_TRC_SIZE 4 |
| 43 | #define HSDRAMC1_TRP_OFFSET 16 |
| 44 | #define HSDRAMC1_TRP_SIZE 4 |
| 45 | #define HSDRAMC1_TRCD_OFFSET 20 |
| 46 | #define HSDRAMC1_TRCD_SIZE 4 |
| 47 | #define HSDRAMC1_TRAS_OFFSET 24 |
| 48 | #define HSDRAMC1_TRAS_SIZE 4 |
| 49 | #define HSDRAMC1_TXSR_OFFSET 28 |
| 50 | #define HSDRAMC1_TXSR_SIZE 4 |
| 51 | |
| 52 | /* Bitfields in HSR */ |
| 53 | #define HSDRAMC1_DA_OFFSET 0 |
| 54 | #define HSDRAMC1_DA_SIZE 1 |
| 55 | |
| 56 | /* Bitfields in LPR */ |
| 57 | #define HSDRAMC1_LPCB_OFFSET 0 |
| 58 | #define HSDRAMC1_LPCB_SIZE 2 |
| 59 | #define HSDRAMC1_PASR_OFFSET 4 |
| 60 | #define HSDRAMC1_PASR_SIZE 3 |
| 61 | #define HSDRAMC1_TCSR_OFFSET 8 |
| 62 | #define HSDRAMC1_TCSR_SIZE 2 |
| 63 | #define HSDRAMC1_DS_OFFSET 10 |
| 64 | #define HSDRAMC1_DS_SIZE 2 |
| 65 | #define HSDRAMC1_TIMEOUT_OFFSET 12 |
| 66 | #define HSDRAMC1_TIMEOUT_SIZE 2 |
| 67 | |
| 68 | /* Bitfields in IDR */ |
| 69 | #define HSDRAMC1_RES_OFFSET 0 |
| 70 | #define HSDRAMC1_RES_SIZE 1 |
| 71 | |
| 72 | /* Bitfields in MDR */ |
| 73 | #define HSDRAMC1_MD_OFFSET 0 |
| 74 | #define HSDRAMC1_MD_SIZE 2 |
| 75 | |
| 76 | /* Bitfields in VERSION */ |
| 77 | #define HSDRAMC1_VERSION_OFFSET 0 |
| 78 | #define HSDRAMC1_VERSION_SIZE 12 |
| 79 | #define HSDRAMC1_MFN_OFFSET 16 |
| 80 | #define HSDRAMC1_MFN_SIZE 3 |
| 81 | |
| 82 | /* Constants for MODE */ |
| 83 | #define HSDRAMC1_MODE_NORMAL 0 |
| 84 | #define HSDRAMC1_MODE_NOP 1 |
| 85 | #define HSDRAMC1_MODE_BANKS_PRECHARGE 2 |
| 86 | #define HSDRAMC1_MODE_LOAD_MODE 3 |
| 87 | #define HSDRAMC1_MODE_AUTO_REFRESH 4 |
| 88 | #define HSDRAMC1_MODE_EXT_LOAD_MODE 5 |
| 89 | #define HSDRAMC1_MODE_POWER_DOWN 6 |
| 90 | |
| 91 | /* Constants for NC */ |
| 92 | #define HSDRAMC1_NC_8_COLUMN_BITS 0 |
| 93 | #define HSDRAMC1_NC_9_COLUMN_BITS 1 |
| 94 | #define HSDRAMC1_NC_10_COLUMN_BITS 2 |
| 95 | #define HSDRAMC1_NC_11_COLUMN_BITS 3 |
| 96 | |
| 97 | /* Constants for NR */ |
| 98 | #define HSDRAMC1_NR_11_ROW_BITS 0 |
| 99 | #define HSDRAMC1_NR_12_ROW_BITS 1 |
| 100 | #define HSDRAMC1_NR_13_ROW_BITS 2 |
| 101 | |
| 102 | /* Constants for NB */ |
| 103 | #define HSDRAMC1_NB_TWO_BANKS 0 |
| 104 | #define HSDRAMC1_NB_FOUR_BANKS 1 |
| 105 | |
| 106 | /* Constants for CAS */ |
| 107 | #define HSDRAMC1_CAS_ONE_CYCLE 1 |
| 108 | #define HSDRAMC1_CAS_TWO_CYCLES 2 |
| 109 | |
| 110 | /* Constants for DBW */ |
| 111 | #define HSDRAMC1_DBW_32_BITS 0 |
| 112 | #define HSDRAMC1_DBW_16_BITS 1 |
| 113 | |
| 114 | /* Constants for TIMEOUT */ |
| 115 | #define HSDRAMC1_TIMEOUT_AFTER_END 0 |
| 116 | #define HSDRAMC1_TIMEOUT_64_CYC_AFTER_END 1 |
| 117 | #define HSDRAMC1_TIMEOUT_128_CYC_AFTER_END 2 |
| 118 | |
| 119 | /* Constants for MD */ |
| 120 | #define HSDRAMC1_MD_SDRAM 0 |
| 121 | #define HSDRAMC1_MD_LOW_POWER_SDRAM 1 |
| 122 | |
| 123 | /* Bit manipulation macros */ |
| 124 | #define HSDRAMC1_BIT(name) \ |
| 125 | (1 << HSDRAMC1_##name##_OFFSET) |
| 126 | #define HSDRAMC1_BF(name,value) \ |
| 127 | (((value) & ((1 << HSDRAMC1_##name##_SIZE) - 1)) \ |
| 128 | << HSDRAMC1_##name##_OFFSET) |
| 129 | #define HSDRAMC1_BFEXT(name,value) \ |
| 130 | (((value) >> HSDRAMC1_##name##_OFFSET) \ |
| 131 | & ((1 << HSDRAMC1_##name##_SIZE) - 1)) |
| 132 | #define HSDRAMC1_BFINS(name,value,old) \ |
| 133 | (((old) & ~(((1 << HSDRAMC1_##name##_SIZE) - 1) \ |
| 134 | << HSDRAMC1_##name##_OFFSET)) \ |
| 135 | | HSDRAMC1_BF(name,value)) |
| 136 | |
| 137 | /* Register access macros */ |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 138 | #define hsdramc1_readl(reg) \ |
| 139 | readl((void *)HSDRAMC_BASE + HSDRAMC1_##reg) |
| 140 | #define hsdramc1_writel(reg,value) \ |
| 141 | writel((value), (void *)HSDRAMC_BASE + HSDRAMC1_##reg) |
Wolfgang Denk | 72a087e | 2006-10-24 14:27:35 +0200 | [diff] [blame] | 142 | |
| 143 | #endif /* __ASM_AVR32_HSDRAMC1_H__ */ |