blob: 4562cef0455e901b5e3778e63f95f4d9e8fc252e [file] [log] [blame]
Johan RUDHOLMa8bfde72012-02-12 11:46:44 -05001/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public
4 * License v2 as published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 * General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public
12 * License along with this program; if not, write to the
13 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
14 * Boston, MA 021110-1307, USA.
15 */
16
17#include <stdio.h>
18#include <stdlib.h>
19#include <string.h>
20#include <sys/ioctl.h>
21#include <sys/types.h>
22#include <dirent.h>
23#include <sys/stat.h>
24#include <unistd.h>
25#include <fcntl.h>
26#include <libgen.h>
27#include <limits.h>
Johan RUDHOLMa8bfde72012-02-12 11:46:44 -050028#include <ctype.h>
29
30#include "mmc.h"
31#include "mmc_cmds.h"
32
33int read_extcsd(int fd, __u8 *ext_csd)
34{
35 int ret = 0;
36 struct mmc_ioc_cmd idata;
37 memset(&idata, 0, sizeof(idata));
38 memset(ext_csd, 0, sizeof(__u8) * 512);
39 idata.write_flag = 0;
40 idata.opcode = MMC_SEND_EXT_CSD;
41 idata.arg = 0;
42 idata.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
43 idata.blksz = 512;
44 idata.blocks = 1;
45 mmc_ioc_cmd_set_data(idata, ext_csd);
46
47 ret = ioctl(fd, MMC_IOC_CMD, &idata);
48 if (ret)
49 perror("ioctl");
50
51 return ret;
52}
53
54int write_extcsd_value(int fd, __u8 index, __u8 value)
55{
56 int ret = 0;
57 struct mmc_ioc_cmd idata;
58
59 memset(&idata, 0, sizeof(idata));
60 idata.write_flag = 1;
61 idata.opcode = MMC_SWITCH;
62 idata.arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) |
63 (index << 16) |
64 (value << 8) |
65 EXT_CSD_CMD_SET_NORMAL;
66 idata.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
67
68 ret = ioctl(fd, MMC_IOC_CMD, &idata);
69 if (ret)
70 perror("ioctl");
71
72 return ret;
73}
74
Chris Ballb9c7a172012-02-20 12:34:25 -050075void print_writeprotect_status(__u8 *ext_csd)
76{
77 __u8 reg;
78 __u8 ext_csd_rev = ext_csd[192];
79
80 /* A43: reserved [174:0] */
81 if (ext_csd_rev >= 5) {
82 printf("Boot write protection status registers"
83 " [BOOT_WP_STATUS]: 0x%02x\n", ext_csd[174]);
84
85 reg = ext_csd[EXT_CSD_BOOT_WP];
86 printf("Boot Area Write protection [BOOT_WP]: 0x%02x\n", reg);
87 printf(" Power ro locking: ");
88 if (reg & EXT_CSD_BOOT_WP_B_PWR_WP_DIS)
89 printf("not possible\n");
90 else
91 printf("possible\n");
92
93 printf(" Permanent ro locking: ");
94 if (reg & EXT_CSD_BOOT_WP_B_PERM_WP_DIS)
95 printf("not possible\n");
96 else
97 printf("possible\n");
98
99 printf(" ro lock status: ");
100 if (reg & EXT_CSD_BOOT_WP_B_PWR_WP_EN)
101 printf("locked until next power on\n");
102 else if (reg & EXT_CSD_BOOT_WP_B_PERM_WP_EN)
103 printf("locked permanently\n");
104 else
105 printf("not locked\n");
106 }
107}
108
109int do_writeprotect_get(int nargs, char **argv)
110{
111 __u8 ext_csd[512];
112 int fd, ret;
113 char *device;
114
115 CHECK(nargs != 2, "Usage: mmc </path/to/mmcblkX>\n", exit(1));
116
117 device = argv[1];
118
119 fd = open(device, O_RDWR);
120 if (fd < 0) {
121 perror("open");
122 exit(1);
123 }
124
125 ret = read_extcsd(fd, ext_csd);
126 if (ret) {
127 fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
128 exit(1);
129 }
130
131 print_writeprotect_status(ext_csd);
132
133 return ret;
134}
135
136int do_writeprotect_set(int nargs, char **argv)
137{
138 __u8 ext_csd[512], value;
139 int fd, ret;
140 char *device;
141
142 CHECK(nargs != 2, "Usage: mmc </path/to/mmcblkX>\n", exit(1));
143
144 device = argv[1];
145
146 fd = open(device, O_RDWR);
147 if (fd < 0) {
148 perror("open");
149 exit(1);
150 }
151
152 ret = read_extcsd(fd, ext_csd);
153 if (ret) {
154 fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
155 exit(1);
156 }
157
158 value = ext_csd[EXT_CSD_BOOT_WP] |
159 EXT_CSD_BOOT_WP_B_PWR_WP_EN;
160 ret = write_extcsd_value(fd, EXT_CSD_BOOT_WP, value);
161 if (ret) {
162 fprintf(stderr, "Could not write 0x%02x to "
163 "EXT_CSD[%d] in %s\n",
164 value, EXT_CSD_BOOT_WP, device);
165 exit(1);
166 }
167
168 return ret;
169}
170
Johan RUDHOLMa8bfde72012-02-12 11:46:44 -0500171int do_read_extcsd(int nargs, char **argv)
172{
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100173 __u8 ext_csd[512], ext_csd_rev, reg;
Johan RUDHOLMa8bfde72012-02-12 11:46:44 -0500174 int fd, ret;
175 char *device;
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100176 const char *str;
Johan RUDHOLMa8bfde72012-02-12 11:46:44 -0500177
178 CHECK(nargs != 2, "Usage: mmc </path/to/mmcblkX>\n", exit(1));
179
180 device = argv[1];
181
182 fd = open(device, O_RDWR);
183 if (fd < 0) {
184 perror("open");
185 exit(1);
186 }
187
188 ret = read_extcsd(fd, ext_csd);
189 if (ret) {
190 fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
191 exit(1);
192 }
193
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100194 ext_csd_rev = ext_csd[192];
195
196 switch (ext_csd_rev) {
197 case 6:
198 str = "4.5";
199 break;
200 case 5:
201 str = "4.41";
202 break;
203 case 3:
204 str = "4.3";
205 break;
206 case 2:
207 str = "4.2";
208 break;
209 case 1:
210 str = "4.1";
211 break;
212 case 0:
213 str = "4.0";
214 break;
215 default:
216 goto out_free;
217 }
218 printf("=============================================\n");
219 printf(" Extended CSD rev 1.%d (MMC %s)\n", ext_csd_rev, str);
220 printf("=============================================\n\n");
221
222 if (ext_csd_rev < 3)
223 goto out_free; /* No ext_csd */
224
225 /* Parse the Extended CSD registers.
226 * Reserved bit should be read as "0" in case of spec older
227 * than A441.
228 */
229 reg = ext_csd[EXT_CSD_S_CMD_SET];
230 printf("Card Supported Command sets [S_CMD_SET: 0x%02x]\n", reg);
231 if (!reg)
Chris Ballb9c7a172012-02-20 12:34:25 -0500232 printf(" - Standard MMC command sets\n");
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100233
234 reg = ext_csd[EXT_CSD_HPI_FEATURE];
235 printf("HPI Features [HPI_FEATURE: 0x%02x]: ", reg);
236 if (reg & EXT_CSD_HPI_SUPP) {
237 if (reg & EXT_CSD_HPI_IMPL)
Chris Ballb9c7a172012-02-20 12:34:25 -0500238 printf("implementation based on CMD12\n");
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100239 else
240 printf("implementation based on CMD13\n");
241 }
242
243 printf("Background operations support [BKOPS_SUPPORT: 0x%02x]\n",
244 ext_csd[502]);
245
246 if (ext_csd_rev >= 6) {
247 printf("Max Packet Read Cmd [MAX_PACKED_READS: 0x%02x]\n",
248 ext_csd[501]);
249 printf("Max Packet Write Cmd [MAX_PACKED_WRITES: 0x%02x]\n",
250 ext_csd[500]);
251 printf("Data TAG support [DATA_TAG_SUPPORT: 0x%02x]\n",
252 ext_csd[499]);
253
254 printf("Data TAG Unit Size [TAG_UNIT_SIZE: 0x%02x]\n",
255 ext_csd[498]);
256 printf("Tag Resources Size [TAG_RES_SIZE: 0x%02x]\n",
257 ext_csd[497]);
258 printf("Context Management Capabilities"
259 " [CONTEXT_CAPABILITIES: 0x%02x]\n", ext_csd[496]);
260 printf("Large Unit Size [LARGE_UNIT_SIZE_M1: 0x%02x]\n",
261 ext_csd[495]);
262 printf("Extended partition attribute support"
263 " [EXT_SUPPORT: 0x%02x]\n", ext_csd[494]);
264 printf("Generic CMD6 Timer [GENERIC_CMD6_TIME: 0x%02x]\n",
265 ext_csd[248]);
266 printf("Power off notification [POWER_OFF_LONG_TIME: 0x%02x]\n",
267 ext_csd[247]);
268 printf("Cache Size [CACHE_SIZE] is %d KiB\n",
269 ext_csd[249] << 0 | (ext_csd[250] << 8) |
270 (ext_csd[251] << 16) | (ext_csd[252] << 24));
271 }
272
273 /* A441: Reserved [501:247]
274 A43: reserved [246:229] */
275 if (ext_csd_rev >= 5) {
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100276 printf("Background operations status"
Chris Ballb9c7a172012-02-20 12:34:25 -0500277 " [BKOPS_STATUS: 0x%02x]\n", ext_csd[246]);
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100278
279 /* CORRECTLY_PRG_SECTORS_NUM [245:242] TODO */
280
281 printf("1st Initialisation Time after programmed sector"
282 " [INI_TIMEOUT_AP: 0x%02x]\n", ext_csd[241]);
283
284 /* A441: reserved [240] */
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100285 printf("Power class for 52MHz, DDR at 3.6V"
286 " [PWR_CL_DDR_52_360: 0x%02x]\n", ext_csd[239]);
287 printf("Power class for 52MHz, DDR at 1.95V"
288 " [PWR_CL_DDR_52_195: 0x%02x]\n", ext_csd[238]);
289
290 /* A441: reserved [237-236] */
291
292 if (ext_csd_rev >= 6) {
293 printf("Power class for 200MHz at 3.6V"
294 " [PWR_CL_200_360: 0x%02x]\n", ext_csd[237]);
295 printf("Power class for 200MHz, at 1.95V"
296 " [PWR_CL_200_195: 0x%02x]\n", ext_csd[236]);
297 }
Chris Ballb9c7a172012-02-20 12:34:25 -0500298 printf("Minimum Performance for 8bit at 52MHz in DDR mode:\n");
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100299 printf(" [MIN_PERF_DDR_W_8_52: 0x%02x]\n", ext_csd[235]);
300 printf(" [MIN_PERF_DDR_R_8_52: 0x%02x]\n", ext_csd[234]);
301 /* A441: reserved [233] */
302 printf("TRIM Multiplier [TRIM_MULT: 0x%02x]\n", ext_csd[232]);
303 printf("Secure Feature support [SEC_FEATURE_SUPPORT: 0x%02x]\n",
304 ext_csd[231]);
305 }
306 if (ext_csd_rev == 5) { /* Obsolete in 4.5 */
307 printf("Secure Erase Multiplier [SEC_ERASE_MULT: 0x%02x]\n",
308 ext_csd[230]);
309 printf("Secure TRIM Multiplier [SEC_TRIM_MULT: 0x%02x]\n",
310 ext_csd[229]);
311 }
312 reg = ext_csd[EXT_CSD_BOOT_INFO];
313 printf("Boot Information [BOOT_INFO: 0x%02x]\n", reg);
314 if (reg & EXT_CSD_BOOT_INFO_ALT)
315 printf(" Device supports alternative boot method\n");
316 if (reg & EXT_CSD_BOOT_INFO_DDR_DDR)
317 printf(" Device supports dual data rate during boot\n");
318 if (reg & EXT_CSD_BOOT_INFO_HS_MODE)
319 printf(" Device supports high speed timing during boot\n");
320
321 /* A441/A43: reserved [227] */
322 printf("Boot partition size [BOOT_SIZE_MULTI: 0x%02x]\n", ext_csd[226]);
323 printf("Access size [ACC_SIZE: 0x%02x]\n", ext_csd[225]);
324 printf("High-capacity erase unit size [HC_ERASE_GRP_SIZE: 0x%02x]\n",
325 ext_csd[224]);
326 printf("High-capacity erase timeout [ERASE_TIMEOUT_MULT: 0x%02x]\n",
327 ext_csd[223]);
328 printf("Reliable write sector count [REL_WR_SEC_C: 0x%02x]\n",
329 ext_csd[222]);
330 printf("High-capacity W protect group size [HC_WP_GRP_SIZE: 0x%02x]\n",
331 ext_csd[221]);
332 printf("Sleep current (VCC) [S_C_VCC: 0x%02x]\n", ext_csd[220]);
333 printf("Sleep current (VCCQ) [S_C_VCCQ: 0x%02x]\n", ext_csd[219]);
334 /* A441/A43: reserved [218] */
335 printf("Sleep/awake timeout [S_A_TIMEOUT: 0x%02x]\n", ext_csd[217]);
336 /* A441/A43: reserved [216] */
337 printf("Sector Count [SEC_COUNT: 0x%08x]\n", (ext_csd[215] << 24) |
338 (ext_csd[214] << 16) | (ext_csd[213] << 8) |
339 ext_csd[212]);
340 /* A441/A43: reserved [211] */
341 printf("Minimum Write Performance for 8bit:\n");
342 printf(" [MIN_PERF_W_8_52: 0x%02x]\n", ext_csd[210]);
343 printf(" [MIN_PERF_R_8_52: 0x%02x]\n", ext_csd[209]);
344 printf(" [MIN_PERF_W_8_26_4_52: 0x%02x]\n", ext_csd[208]);
345 printf(" [MIN_PERF_R_8_26_4_52: 0x%02x]\n", ext_csd[207]);
346 printf("Minimum Write Performance for 4bit:\n");
347 printf(" [MIN_PERF_W_4_26: 0x%02x]\n", ext_csd[206]);
348 printf(" [MIN_PERF_R_4_26: 0x%02x]\n", ext_csd[205]);
349 /* A441/A43: reserved [204] */
350 printf("Power classes registers:\n");
351 printf(" [PWR_CL_26_360: 0x%02x]\n", ext_csd[203]);
352 printf(" [PWR_CL_52_360: 0x%02x]\n", ext_csd[202]);
353 printf(" [PWR_CL_26_195: 0x%02x]\n", ext_csd[201]);
354 printf(" [PWR_CL_52_195: 0x%02x]\n", ext_csd[200]);
355
356 /* A43: reserved [199:198] */
357 if (ext_csd_rev >= 5) {
358 printf("Partition switching timing "
359 "[PARTITION_SWITCH_TIME: 0x%02x]\n", ext_csd[199]);
360 printf("Out-of-interrupt busy timing"
361 " [OUT_OF_INTERRUPT_TIME: 0x%02x]\n", ext_csd[198]);
362 }
363
364 /* A441/A43: reserved [197] [195] [193] [190] [188]
365 * [186] [184] [182] [180] [176] */
366
367 if (ext_csd_rev >= 6)
368 printf("I/O Driver Strength [DRIVER_STRENGTH: 0x%02x]\n",
369 ext_csd[197]);
370
371 printf("Card Type [CARD_TYPE: 0x%02x]\n", ext_csd[196]);
372 /* DEVICE_TYPE in A45 */
373 switch (reg) {
374 case 5:
375 printf("HS200 Single Data Rate eMMC @200MHz 1.2VI/O\n");
376 break;
377 case 4:
378 printf("HS200 Single Data Rate eMMC @200MHz 1.8VI/O\n");
379 break;
380 case 3:
381 printf("HS Dual Data Rate eMMC @52MHz 1.2VI/O\n");
382
383 break;
384 case 2:
385 printf("HS Dual Data Rate eMMC @52MHz 1.8V or 3VI/O\n");
386 break;
387 case 1:
388 printf("HS eMMC @52MHz - at rated device voltage(s)\n");
389 break;
390 case 0:
391 printf("HS eMMC @26MHz - at rated device voltage(s)\n");
392 break;
393 }
394 printf("CSD structure version [CSD_STRUCTURE: 0x%02x]\n", ext_csd[194]);
395 /* ext_csd_rev = ext_csd[192] (already done!!!) */
396 printf("Command set [CMD_SET: 0x%02x]\n", ext_csd[191]);
397 printf("Command set revision [CMD_SET_REV: 0x%02x]\n", ext_csd[189]);
398 printf("Power class [POWER_CLASS: 0x%02x]\n", ext_csd[187]);
399 printf("High-speed interface timing [HS_TIMING: 0x%02x]\n",
400 ext_csd[185]);
401 /* bus_width: ext_csd[183] not readable */
402 printf("Erased memory content [ERASED_MEM_CONT: 0x%02x]\n",
403 ext_csd[181]);
404 reg = ext_csd[EXT_CSD_BOOT_CFG];
405 printf("Boot configuration bytes [PARTITION_CONFIG: 0x%02x]\n", reg);
406 switch (reg & EXT_CSD_BOOT_CFG_EN) {
407 case 0x0:
408 printf(" Not boot enable\n");
409 break;
410 case 0x1:
411 printf(" Boot Partition 1 enabled\n");
412 break;
413 case 0x2:
414 printf(" Boot Partition 2 enabled\n");
415 break;
416 case 0x7:
417 printf(" User Area Enabled for boot\n");
418 break;
419 }
420 switch (reg & EXT_CSD_BOOT_CFG_ACC) {
421 case 0x0:
422 printf(" No access to boot partition\n");
423 break;
424 case 0x1:
425 printf(" R/W Boot Partition 1\n");
426 break;
427 case 0x2:
428 printf(" R/W Boot Partition 2\n");
429 break;
430 default:
431 printf(" Access to General Purpuse partition %d\n",
432 (reg & EXT_CSD_BOOT_CFG_ACC) - 3);
433 break;
434 }
435
436 printf("Boot config protection [BOOT_CONFIG_PROT: 0x%02x]\n",
437 ext_csd[178]);
438 printf("Boot bus Conditions [BOOT_BUS_CONDITIONS: 0x%02x]\n",
439 ext_csd[177]);
440 printf("High-density erase group definition"
441 " [ERASE_GROUP_DEF: 0x%02x]\n", ext_csd[175]);
442
Chris Ballb9c7a172012-02-20 12:34:25 -0500443 print_writeprotect_status(ext_csd);
444
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100445 if (ext_csd_rev >= 5) {
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100446 /* A441]: reserved [172] */
447 printf("User area write protection register"
448 " [USER_WP]: 0x%02x\n", ext_csd[171]);
449 /* A441]: reserved [170] */
450 printf("FW configuration [FW_CONFIG]: 0x%02x\n", ext_csd[169]);
451 printf("RPMB Size [RPMB_SIZE_MULT]: 0x%02x\n", ext_csd[168]);
452 printf("Write reliability setting register"
453 " [WR_REL_SET]: 0x%02x\n", ext_csd[167]);
454 printf("Write reliability parameter register"
455 " [WR_REL_PARAM]: 0x%02x\n", ext_csd[166]);
456 /* sanitize_start ext_csd[165]]: not readable
457 * bkops_start ext_csd[164]]: only writable */
458 printf("Enable background operations handshake"
459 " [BKOPS_EN]: 0x%02x\n", ext_csd[163]);
460 printf("H/W reset function"
461 " [RST_N_FUNCTION]: 0x%02x\n", ext_csd[162]);
462 printf("HPI management [HPI_MGMT]: 0x%02x\n", ext_csd[161]);
463 reg = ext_csd[160];
464 printf("Partitioning Support [PARTITIONING_SUPPORT]: 0x%02x\n",
465 reg);
466 if (reg & 0x1)
467 printf(" Device support partitioning feature\n");
468 else
469 printf(" Device NOT support partitioning feature\n");
470 if (reg & 0x2)
471 printf(" Device can have enhanced tech.\n");
472 else
473 printf(" Device cannot have enhanced tech.\n");
474
475 printf("Max Enhanced Area Size [MAX_ENH_SIZE_MULT]: 0x%06x\n",
476 (ext_csd[159] << 16) | (ext_csd[158] << 8) |
477 ext_csd[157]);
478 printf("Partitions attribute [PARTITIONS_ATTRIBUTE]: 0x%02x\n",
479 ext_csd[156]);
480 printf("Partitioning Setting"
481 " [PARTITION_SETTING_COMPLETED]: 0x%02x\n",
482 ext_csd[155]);
483 printf("General Purpose Partition Size\n"
484 " [GP_SIZE_MULT_4]: 0x%06x\n", (ext_csd[154] << 16) |
485 (ext_csd[153] << 8) | ext_csd[152]);
486 printf(" [GP_SIZE_MULT_3]: 0x%06x\n", (ext_csd[151] << 16) |
487 (ext_csd[150] << 8) | ext_csd[149]);
488 printf(" [GP_SIZE_MULT_2]: 0x%06x\n", (ext_csd[148] << 16) |
489 (ext_csd[147] << 8) | ext_csd[146]);
490 printf(" [GP_SIZE_MULT_1]: 0x%06x\n", (ext_csd[145] << 16) |
491 (ext_csd[144] << 8) | ext_csd[143]);
492
493 printf("Enhanced User Data Area Size"
494 " [ENH_SIZE_MULT]: 0x%06x\n", (ext_csd[142] << 16) |
495 (ext_csd[141] << 8) | ext_csd[140]);
496 printf("Enhanced User Data Start Address"
497 " [ENH_START_ADDR]: 0x%06x\n", (ext_csd[139] << 16) |
498 (ext_csd[138] << 8) | ext_csd[137]);
499
500 /* A441]: reserved [135] */
501 printf("Bad Block Management mode"
502 " [SEC_BAD_BLK_MGMNT]: 0x%02x\n", ext_csd[134]);
503 /* A441: reserved [133:0] */
504 }
505 /* B45 */
506 if (ext_csd_rev >= 6) {
507 int j;
508 /* tcase_support ext_csd[132] not readable */
509 printf("Periodic Wake-up [PERIODIC_WAKEUP]: 0x%02x\n",
510 ext_csd[131]);
511 printf("Program CID/CSD in DDR mode support"
512 " [PROGRAM_CID_CSD_DDR_SUPPORT]: 0x%02x\n",
513 ext_csd[130]);
514
515 for (j = 127; j >= 64; j--)
516 printf("Vendor Specific Fields"
517 " [VENDOR_SPECIFIC_FIELD[%d]]: 0x%02x\n",
518 j, ext_csd[j]);
519
520 printf("Native sector size [NATIVE_SECTOR_SIZE]: 0x%02x\n",
521 ext_csd[63]);
522 printf("Sector size emulation [USE_NATIVE_SECTOR]: 0x%02x\n",
523 ext_csd[62]);
524 printf("Sector size [DATA_SECTOR_SIZE]: 0x%02x\n", ext_csd[61]);
525 printf("1st initialization after disabling sector"
526 " size emulation [INI_TIMEOUT_EMU]: 0x%02x\n",
527 ext_csd[60]);
528 printf("Class 6 commands control [CLASS_6_CTRL]: 0x%02x\n",
529 ext_csd[59]);
530 printf("Number of addressed group to be Released"
531 "[DYNCAP_NEEDED]: 0x%02x\n", ext_csd[58]);
532 printf("Exception events control"
533 " [EXCEPTION_EVENTS_CTRL]: 0x%04x\n",
534 (ext_csd[57] << 8) | ext_csd[56]);
535 printf("Exception events status"
536 "[EXCEPTION_EVENTS_STATUS]: 0x%04x\n",
537 (ext_csd[55] << 8) | ext_csd[54]);
538 printf("Extended Partitions Attribute"
539 " [EXT_PARTITIONS_ATTRIBUTE]: 0x%04x\n",
540 (ext_csd[53] << 8) | ext_csd[52]);
541
542 for (j = 51; j >= 37; j--)
543 printf("Context configuration"
544 " [CONTEXT_CONF[%d]]: 0x%02x\n", j, ext_csd[j]);
545
546 printf("Packed command status"
547 " [PACKED_COMMAND_STATUS]: 0x%02x\n", ext_csd[36]);
548 printf("Packed command failure index"
549 " [PACKED_FAILURE_INDEX]: 0x%02x\n", ext_csd[35]);
550 printf("Power Off Notification"
551 " [POWER_OFF_NOTIFICATION]: 0x%02x\n", ext_csd[34]);
Chris Ballb9c7a172012-02-20 12:34:25 -0500552 printf("Control to turn the Cache ON/OFF" " [CACHE_CTRL]: 0x%02x\n", ext_csd[33]);
Giuseppe CAVALLAROa5bf4a22012-02-20 09:45:29 +0100553 /* flush_cache ext_csd[32] not readable */
554 /*Reserved [31:0] */
555 }
556
557out_free:
Johan RUDHOLMa8bfde72012-02-12 11:46:44 -0500558 return ret;
559}