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