Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2009 |
| 4 | * Marvell Semiconductor <www.marvell.com> |
| 5 | * Written-by: Prafulla Wadaskar <prafulla@marvell.com> |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <config.h> |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 9 | #include <common.h> |
Lei Wen | 298ae91 | 2011-10-18 20:11:42 +0530 | [diff] [blame] | 10 | #include <asm/io.h> |
| 11 | #include <asm/arch/cpu.h> |
Stefan Roese | c243784 | 2014-10-22 12:13:06 +0200 | [diff] [blame] | 12 | #include <asm/arch/soc.h> |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 13 | |
Stefan Roese | eb083e5 | 2015-12-21 13:56:33 +0100 | [diff] [blame] | 14 | #if defined(CONFIG_ARCH_MVEBU) |
| 15 | /* Use common XOR definitions for A3x and AXP */ |
Stefan Roese | f3345e6 | 2015-08-06 14:43:13 +0200 | [diff] [blame] | 16 | #include "../../../drivers/ddr/marvell/axp/xor.h" |
| 17 | #include "../../../drivers/ddr/marvell/axp/xor_regs.h" |
Stefan Roese | 7a96ee9 | 2015-08-03 13:15:31 +0200 | [diff] [blame] | 18 | #endif |
Stefan Roese | 7a96ee9 | 2015-08-03 13:15:31 +0200 | [diff] [blame] | 19 | |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 20 | DECLARE_GLOBAL_DATA_PTR; |
| 21 | |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 22 | struct sdram_bank { |
Holger Brunck | 67393fc | 2012-07-20 02:34:24 +0000 | [diff] [blame] | 23 | u32 win_bar; |
| 24 | u32 win_sz; |
| 25 | }; |
| 26 | |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 27 | struct sdram_addr_dec { |
| 28 | struct sdram_bank sdram_bank[4]; |
Holger Brunck | 67393fc | 2012-07-20 02:34:24 +0000 | [diff] [blame] | 29 | }; |
| 30 | |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 31 | #define REG_CPUCS_WIN_ENABLE (1 << 0) |
| 32 | #define REG_CPUCS_WIN_WR_PROTECT (1 << 1) |
| 33 | #define REG_CPUCS_WIN_WIN0_CS(x) (((x) & 0x3) << 2) |
| 34 | #define REG_CPUCS_WIN_SIZE(x) (((x) & 0xff) << 24) |
Gerlando Falauto | ac935e2 | 2012-07-20 02:34:25 +0000 | [diff] [blame] | 35 | |
Stefan Roese | 10fa44b | 2018-10-22 14:21:17 +0200 | [diff] [blame] | 36 | #ifndef MVEBU_SDRAM_SIZE_MAX |
| 37 | #define MVEBU_SDRAM_SIZE_MAX 0xc0000000 |
| 38 | #endif |
Stefan Roese | 420abea | 2015-08-10 15:11:27 +0200 | [diff] [blame] | 39 | |
Stefan Roese | f3345e6 | 2015-08-06 14:43:13 +0200 | [diff] [blame] | 40 | #define SCRUB_MAGIC 0xbeefdead |
| 41 | |
| 42 | #define SCRB_XOR_UNIT 0 |
| 43 | #define SCRB_XOR_CHAN 1 |
| 44 | #define SCRB_XOR_WIN 0 |
| 45 | |
| 46 | #define XEBARX_BASE_OFFS 16 |
| 47 | |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 48 | /* |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 49 | * mvebu_sdram_bar - reads SDRAM Base Address Register |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 50 | */ |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 51 | u32 mvebu_sdram_bar(enum memory_bank bank) |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 52 | { |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 53 | struct sdram_addr_dec *base = |
| 54 | (struct sdram_addr_dec *)MVEBU_SDRAM_BASE; |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 55 | u32 result = 0; |
Holger Brunck | 67393fc | 2012-07-20 02:34:24 +0000 | [diff] [blame] | 56 | u32 enable = 0x01 & readl(&base->sdram_bank[bank].win_sz); |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 57 | |
| 58 | if ((!enable) || (bank > BANK3)) |
| 59 | return 0; |
| 60 | |
Holger Brunck | 67393fc | 2012-07-20 02:34:24 +0000 | [diff] [blame] | 61 | result = readl(&base->sdram_bank[bank].win_bar); |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 62 | return result; |
| 63 | } |
| 64 | |
| 65 | /* |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 66 | * mvebu_sdram_bs_set - writes SDRAM Bank size |
Gerlando Falauto | ac935e2 | 2012-07-20 02:34:25 +0000 | [diff] [blame] | 67 | */ |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 68 | static void mvebu_sdram_bs_set(enum memory_bank bank, u32 size) |
Gerlando Falauto | ac935e2 | 2012-07-20 02:34:25 +0000 | [diff] [blame] | 69 | { |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 70 | struct sdram_addr_dec *base = |
| 71 | (struct sdram_addr_dec *)MVEBU_SDRAM_BASE; |
Gerlando Falauto | ac935e2 | 2012-07-20 02:34:25 +0000 | [diff] [blame] | 72 | /* Read current register value */ |
| 73 | u32 reg = readl(&base->sdram_bank[bank].win_sz); |
| 74 | |
| 75 | /* Clear window size */ |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 76 | reg &= ~REG_CPUCS_WIN_SIZE(0xFF); |
Gerlando Falauto | ac935e2 | 2012-07-20 02:34:25 +0000 | [diff] [blame] | 77 | |
| 78 | /* Set new window size */ |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 79 | reg |= REG_CPUCS_WIN_SIZE((size - 1) >> 24); |
Gerlando Falauto | ac935e2 | 2012-07-20 02:34:25 +0000 | [diff] [blame] | 80 | |
| 81 | writel(reg, &base->sdram_bank[bank].win_sz); |
| 82 | } |
| 83 | |
| 84 | /* |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 85 | * mvebu_sdram_bs - reads SDRAM Bank size |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 86 | */ |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 87 | u32 mvebu_sdram_bs(enum memory_bank bank) |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 88 | { |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 89 | struct sdram_addr_dec *base = |
| 90 | (struct sdram_addr_dec *)MVEBU_SDRAM_BASE; |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 91 | u32 result = 0; |
Holger Brunck | 67393fc | 2012-07-20 02:34:24 +0000 | [diff] [blame] | 92 | u32 enable = 0x01 & readl(&base->sdram_bank[bank].win_sz); |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 93 | |
| 94 | if ((!enable) || (bank > BANK3)) |
| 95 | return 0; |
Holger Brunck | 67393fc | 2012-07-20 02:34:24 +0000 | [diff] [blame] | 96 | result = 0xff000000 & readl(&base->sdram_bank[bank].win_sz); |
Prafulla Wadaskar | a09bbe5 | 2009-06-20 11:01:53 +0200 | [diff] [blame] | 97 | result += 0x01000000; |
| 98 | return result; |
| 99 | } |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 100 | |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 101 | void mvebu_sdram_size_adjust(enum memory_bank bank) |
Gerlando Falauto | ea32b7e | 2012-07-25 06:23:48 +0000 | [diff] [blame] | 102 | { |
| 103 | u32 size; |
| 104 | |
| 105 | /* probe currently equipped RAM size */ |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 106 | size = get_ram_size((void *)mvebu_sdram_bar(bank), |
| 107 | mvebu_sdram_bs(bank)); |
Gerlando Falauto | ea32b7e | 2012-07-25 06:23:48 +0000 | [diff] [blame] | 108 | |
| 109 | /* adjust SDRAM window size accordingly */ |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 110 | mvebu_sdram_bs_set(bank, size); |
Gerlando Falauto | ea32b7e | 2012-07-25 06:23:48 +0000 | [diff] [blame] | 111 | } |
| 112 | |
Stefan Roese | eb083e5 | 2015-12-21 13:56:33 +0100 | [diff] [blame] | 113 | #if defined(CONFIG_ARCH_MVEBU) |
Stefan Roese | f3345e6 | 2015-08-06 14:43:13 +0200 | [diff] [blame] | 114 | static u32 xor_ctrl_save; |
| 115 | static u32 xor_base_save; |
| 116 | static u32 xor_mask_save; |
| 117 | |
| 118 | static void mv_xor_init2(u32 cs) |
| 119 | { |
| 120 | u32 reg, base, size, base2; |
| 121 | u32 bank_attr[4] = { 0xe00, 0xd00, 0xb00, 0x700 }; |
| 122 | |
| 123 | xor_ctrl_save = reg_read(XOR_WINDOW_CTRL_REG(SCRB_XOR_UNIT, |
| 124 | SCRB_XOR_CHAN)); |
| 125 | xor_base_save = reg_read(XOR_BASE_ADDR_REG(SCRB_XOR_UNIT, |
| 126 | SCRB_XOR_WIN)); |
| 127 | xor_mask_save = reg_read(XOR_SIZE_MASK_REG(SCRB_XOR_UNIT, |
| 128 | SCRB_XOR_WIN)); |
| 129 | |
| 130 | /* Enable Window x for each CS */ |
| 131 | reg = 0x1; |
| 132 | reg |= (0x3 << 16); |
| 133 | reg_write(XOR_WINDOW_CTRL_REG(SCRB_XOR_UNIT, SCRB_XOR_CHAN), reg); |
| 134 | |
| 135 | base = 0; |
| 136 | size = mvebu_sdram_bs(cs) - 1; |
| 137 | if (size) { |
| 138 | base2 = ((base / (64 << 10)) << XEBARX_BASE_OFFS) | |
| 139 | bank_attr[cs]; |
| 140 | reg_write(XOR_BASE_ADDR_REG(SCRB_XOR_UNIT, SCRB_XOR_WIN), |
| 141 | base2); |
| 142 | |
| 143 | base += size + 1; |
| 144 | size = (size / (64 << 10)) << 16; |
| 145 | /* Window x - size - 256 MB */ |
| 146 | reg_write(XOR_SIZE_MASK_REG(SCRB_XOR_UNIT, SCRB_XOR_WIN), size); |
| 147 | } |
| 148 | |
| 149 | mv_xor_hal_init(0); |
| 150 | |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | static void mv_xor_finish2(void) |
| 155 | { |
| 156 | reg_write(XOR_WINDOW_CTRL_REG(SCRB_XOR_UNIT, SCRB_XOR_CHAN), |
| 157 | xor_ctrl_save); |
| 158 | reg_write(XOR_BASE_ADDR_REG(SCRB_XOR_UNIT, SCRB_XOR_WIN), |
| 159 | xor_base_save); |
| 160 | reg_write(XOR_SIZE_MASK_REG(SCRB_XOR_UNIT, SCRB_XOR_WIN), |
| 161 | xor_mask_save); |
| 162 | } |
| 163 | |
| 164 | static void dram_ecc_scrubbing(void) |
| 165 | { |
| 166 | int cs; |
| 167 | u32 size, temp; |
| 168 | u32 total_mem = 0; |
| 169 | u64 total; |
| 170 | u32 start_addr; |
| 171 | |
| 172 | /* |
| 173 | * The DDR training code from the bin_hdr / SPL already |
| 174 | * scrubbed the DDR till 0x1000000. And the main U-Boot |
| 175 | * is loaded to an address < 0x1000000. So we need to |
| 176 | * skip this range to not re-scrub this area again. |
| 177 | */ |
| 178 | temp = reg_read(REG_SDRAM_CONFIG_ADDR); |
| 179 | temp |= (1 << REG_SDRAM_CONFIG_IERR_OFFS); |
| 180 | reg_write(REG_SDRAM_CONFIG_ADDR, temp); |
| 181 | |
| 182 | for (cs = 0; cs < CONFIG_NR_DRAM_BANKS; cs++) { |
Chris Packham | 50df87f | 2017-09-23 04:50:31 +1200 | [diff] [blame] | 183 | size = mvebu_sdram_bs(cs); |
Stefan Roese | f3345e6 | 2015-08-06 14:43:13 +0200 | [diff] [blame] | 184 | if (size == 0) |
| 185 | continue; |
| 186 | |
Chris Packham | 50df87f | 2017-09-23 04:50:31 +1200 | [diff] [blame] | 187 | total = (u64)size; |
Stefan Roese | f3345e6 | 2015-08-06 14:43:13 +0200 | [diff] [blame] | 188 | total_mem += (u32)(total / (1 << 30)); |
| 189 | start_addr = 0; |
| 190 | mv_xor_init2(cs); |
| 191 | |
| 192 | /* Skip first 16 MiB */ |
| 193 | if (0 == cs) { |
| 194 | start_addr = 0x1000000; |
| 195 | size -= start_addr; |
| 196 | } |
| 197 | |
Chris Packham | 50df87f | 2017-09-23 04:50:31 +1200 | [diff] [blame] | 198 | mv_xor_mem_init(SCRB_XOR_CHAN, start_addr, size - 1, |
Stefan Roese | f3345e6 | 2015-08-06 14:43:13 +0200 | [diff] [blame] | 199 | SCRUB_MAGIC, SCRUB_MAGIC); |
| 200 | |
| 201 | /* Wait for previous transfer completion */ |
| 202 | while (mv_xor_state_get(SCRB_XOR_CHAN) != MV_IDLE) |
| 203 | ; |
| 204 | |
| 205 | mv_xor_finish2(); |
| 206 | } |
| 207 | |
| 208 | temp = reg_read(REG_SDRAM_CONFIG_ADDR); |
| 209 | temp &= ~(1 << REG_SDRAM_CONFIG_IERR_OFFS); |
| 210 | reg_write(REG_SDRAM_CONFIG_ADDR, temp); |
| 211 | } |
| 212 | |
| 213 | static int ecc_enabled(void) |
| 214 | { |
| 215 | if (reg_read(REG_SDRAM_CONFIG_ADDR) & (1 << REG_SDRAM_CONFIG_ECC_OFFS)) |
| 216 | return 1; |
| 217 | |
| 218 | return 0; |
| 219 | } |
Joshua Scott | 2e161b9 | 2017-09-04 17:38:32 +1200 | [diff] [blame] | 220 | |
| 221 | /* Return the width of the DRAM bus, or 0 for unknown. */ |
| 222 | static int bus_width(void) |
| 223 | { |
| 224 | int full_width = 0; |
| 225 | |
| 226 | if (reg_read(REG_SDRAM_CONFIG_ADDR) & (1 << REG_SDRAM_CONFIG_WIDTH_OFFS)) |
| 227 | full_width = 1; |
| 228 | |
| 229 | switch (mvebu_soc_family()) { |
| 230 | case MVEBU_SOC_AXP: |
| 231 | return full_width ? 64 : 32; |
| 232 | break; |
| 233 | case MVEBU_SOC_A375: |
| 234 | case MVEBU_SOC_A38X: |
| 235 | case MVEBU_SOC_MSYS: |
| 236 | return full_width ? 32 : 16; |
| 237 | default: |
| 238 | return 0; |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | static int cycle_mode(void) |
| 243 | { |
| 244 | int val = reg_read(REG_DUNIT_CTRL_LOW_ADDR); |
| 245 | |
| 246 | return (val >> REG_DUNIT_CTRL_LOW_2T_OFFS) & REG_DUNIT_CTRL_LOW_2T_MASK; |
| 247 | } |
| 248 | |
Stefan Roese | f3345e6 | 2015-08-06 14:43:13 +0200 | [diff] [blame] | 249 | #else |
| 250 | static void dram_ecc_scrubbing(void) |
| 251 | { |
| 252 | } |
| 253 | |
| 254 | static int ecc_enabled(void) |
| 255 | { |
| 256 | return 0; |
| 257 | } |
| 258 | #endif |
| 259 | |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 260 | int dram_init(void) |
| 261 | { |
Stefan Roese | 420abea | 2015-08-10 15:11:27 +0200 | [diff] [blame] | 262 | u64 size = 0; |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 263 | int i; |
| 264 | |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 265 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 266 | /* |
| 267 | * It is assumed that all memory banks are consecutive |
| 268 | * and without gaps. |
| 269 | * If the gap is found, ram_size will be reported for |
| 270 | * consecutive memory only |
| 271 | */ |
Stefan Roese | 420abea | 2015-08-10 15:11:27 +0200 | [diff] [blame] | 272 | if (mvebu_sdram_bar(i) != size) |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 273 | break; |
| 274 | |
Stefan Roese | 2cc5fad | 2014-10-22 12:13:05 +0200 | [diff] [blame] | 275 | /* |
| 276 | * Don't report more than 3GiB of SDRAM, otherwise there is no |
| 277 | * address space left for the internal registers etc. |
| 278 | */ |
Stefan Roese | 420abea | 2015-08-10 15:11:27 +0200 | [diff] [blame] | 279 | size += mvebu_sdram_bs(i); |
Stefan Roese | 10fa44b | 2018-10-22 14:21:17 +0200 | [diff] [blame] | 280 | if (size > MVEBU_SDRAM_SIZE_MAX) |
| 281 | size = MVEBU_SDRAM_SIZE_MAX; |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 282 | } |
Tanmay Upadhyay | 9a5ff78 | 2010-10-28 20:06:22 +0530 | [diff] [blame] | 283 | |
Stefan Roese | f3345e6 | 2015-08-06 14:43:13 +0200 | [diff] [blame] | 284 | if (ecc_enabled()) |
| 285 | dram_ecc_scrubbing(); |
| 286 | |
Stefan Roese | 420abea | 2015-08-10 15:11:27 +0200 | [diff] [blame] | 287 | gd->ram_size = size; |
| 288 | |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 289 | return 0; |
| 290 | } |
| 291 | |
| 292 | /* |
| 293 | * If this function is not defined here, |
| 294 | * board.c alters dram bank zero configuration defined above. |
| 295 | */ |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 296 | int dram_init_banksize(void) |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 297 | { |
Stefan Roese | 420abea | 2015-08-10 15:11:27 +0200 | [diff] [blame] | 298 | u64 size = 0; |
| 299 | int i; |
| 300 | |
| 301 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 302 | gd->bd->bi_dram[i].start = mvebu_sdram_bar(i); |
| 303 | gd->bd->bi_dram[i].size = mvebu_sdram_bs(i); |
| 304 | |
| 305 | /* Clip the banksize to 1GiB if it exceeds the max size */ |
| 306 | size += gd->bd->bi_dram[i].size; |
Stefan Roese | 10fa44b | 2018-10-22 14:21:17 +0200 | [diff] [blame] | 307 | if (size > MVEBU_SDRAM_SIZE_MAX) |
Stefan Roese | 420abea | 2015-08-10 15:11:27 +0200 | [diff] [blame] | 308 | mvebu_sdram_bs_set(i, 0x40000000); |
| 309 | } |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 310 | |
| 311 | return 0; |
Prafulla Wadaskar | f8e4262 | 2010-09-30 19:33:19 +0530 | [diff] [blame] | 312 | } |
Stefan Roese | 7a96ee9 | 2015-08-03 13:15:31 +0200 | [diff] [blame] | 313 | |
Stefan Roese | eb083e5 | 2015-12-21 13:56:33 +0100 | [diff] [blame] | 314 | #if defined(CONFIG_ARCH_MVEBU) |
Stefan Roese | 7a96ee9 | 2015-08-03 13:15:31 +0200 | [diff] [blame] | 315 | void board_add_ram_info(int use_default) |
| 316 | { |
Stefan Roese | 2a539c8 | 2015-12-21 12:36:40 +0100 | [diff] [blame] | 317 | struct sar_freq_modes sar_freq; |
Joshua Scott | 2e161b9 | 2017-09-04 17:38:32 +1200 | [diff] [blame] | 318 | int mode; |
| 319 | int width; |
Stefan Roese | 2a539c8 | 2015-12-21 12:36:40 +0100 | [diff] [blame] | 320 | |
| 321 | get_sar_freq(&sar_freq); |
| 322 | printf(" (%d MHz, ", sar_freq.d_clk); |
| 323 | |
Joshua Scott | 2e161b9 | 2017-09-04 17:38:32 +1200 | [diff] [blame] | 324 | width = bus_width(); |
| 325 | if (width) |
| 326 | printf("%d-bit, ", width); |
| 327 | |
| 328 | mode = cycle_mode(); |
| 329 | /* Mode 0 = Single cycle |
| 330 | * Mode 1 = Two cycles (2T) |
| 331 | * Mode 2 = Three cycles (3T) |
| 332 | */ |
| 333 | if (mode == 1) |
| 334 | printf("2T, "); |
| 335 | if (mode == 2) |
| 336 | printf("3T, "); |
| 337 | |
Stefan Roese | f3345e6 | 2015-08-06 14:43:13 +0200 | [diff] [blame] | 338 | if (ecc_enabled()) |
Stefan Roese | 2a539c8 | 2015-12-21 12:36:40 +0100 | [diff] [blame] | 339 | printf("ECC"); |
Stefan Roese | 7a96ee9 | 2015-08-03 13:15:31 +0200 | [diff] [blame] | 340 | else |
Stefan Roese | 2a539c8 | 2015-12-21 12:36:40 +0100 | [diff] [blame] | 341 | printf("ECC not"); |
Stefan Roese | 7a96ee9 | 2015-08-03 13:15:31 +0200 | [diff] [blame] | 342 | printf(" enabled)"); |
| 343 | } |
Stefan Roese | 2a539c8 | 2015-12-21 12:36:40 +0100 | [diff] [blame] | 344 | #endif |