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