|
7 | 7 | #include <env.h>
|
8 | 8 | #include <dm/device.h>
|
9 | 9 | #include <dm/uclass-internal.h>
|
10 |
| -#include <jffs2/jffs2.h> /* LEGACY */ |
11 | 10 | #include <linux/mtd/mtd.h>
|
12 | 11 | #include <linux/mtd/partitions.h>
|
13 | 12 | #include <mtd.h>
|
@@ -356,96 +355,3 @@ int mtd_probe_devices(void)
|
356 | 355 | return 0;
|
357 | 356 | }
|
358 | 357 | #endif /* defined(CONFIG_MTD_PARTITIONS) */
|
359 |
| - |
360 |
| -/* Legacy */ |
361 |
| - |
362 |
| -static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size, |
363 |
| - loff_t *maxsize, int devtype) |
364 |
| -{ |
365 |
| -#ifdef CONFIG_CMD_MTDPARTS |
366 |
| - struct mtd_device *dev; |
367 |
| - struct part_info *part; |
368 |
| - u8 pnum; |
369 |
| - int ret; |
370 |
| - |
371 |
| - ret = mtdparts_init(); |
372 |
| - if (ret) |
373 |
| - return ret; |
374 |
| - |
375 |
| - ret = find_dev_and_part(partname, &dev, &pnum, &part); |
376 |
| - if (ret) |
377 |
| - return ret; |
378 |
| - |
379 |
| - if (dev->id->type != devtype) { |
380 |
| - printf("not same typ %d != %d\n", dev->id->type, devtype); |
381 |
| - return -1; |
382 |
| - } |
383 |
| - |
384 |
| - *off = part->offset; |
385 |
| - *size = part->size; |
386 |
| - *maxsize = part->size; |
387 |
| - *idx = dev->id->num; |
388 |
| - |
389 |
| - return 0; |
390 |
| -#else |
391 |
| - puts("mtdparts support missing.\n"); |
392 |
| - return -1; |
393 |
| -#endif |
394 |
| -} |
395 |
| - |
396 |
| -int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size, |
397 |
| - loff_t *maxsize, int devtype, uint64_t chipsize) |
398 |
| -{ |
399 |
| - if (!str2off(arg, off)) |
400 |
| - return get_part(arg, idx, off, size, maxsize, devtype); |
401 |
| - |
402 |
| - if (*off >= chipsize) { |
403 |
| - puts("Offset exceeds device limit\n"); |
404 |
| - return -1; |
405 |
| - } |
406 |
| - |
407 |
| - *maxsize = chipsize - *off; |
408 |
| - *size = *maxsize; |
409 |
| - return 0; |
410 |
| -} |
411 |
| - |
412 |
| -int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off, |
413 |
| - loff_t *size, loff_t *maxsize, int devtype, |
414 |
| - uint64_t chipsize) |
415 |
| -{ |
416 |
| - int ret; |
417 |
| - |
418 |
| - if (argc == 0) { |
419 |
| - *off = 0; |
420 |
| - *size = chipsize; |
421 |
| - *maxsize = *size; |
422 |
| - goto print; |
423 |
| - } |
424 |
| - |
425 |
| - ret = mtd_arg_off(argv[0], idx, off, size, maxsize, devtype, |
426 |
| - chipsize); |
427 |
| - if (ret) |
428 |
| - return ret; |
429 |
| - |
430 |
| - if (argc == 1) |
431 |
| - goto print; |
432 |
| - |
433 |
| - if (!str2off(argv[1], size)) { |
434 |
| - printf("'%s' is not a number\n", argv[1]); |
435 |
| - return -1; |
436 |
| - } |
437 |
| - |
438 |
| - if (*size > *maxsize) { |
439 |
| - puts("Size exceeds partition or device limit\n"); |
440 |
| - return -1; |
441 |
| - } |
442 |
| - |
443 |
| -print: |
444 |
| - printf("device %d ", *idx); |
445 |
| - if (*size == chipsize) |
446 |
| - puts("whole chip\n"); |
447 |
| - else |
448 |
| - printf("offset 0x%llx, size 0x%llx\n", |
449 |
| - (unsigned long long)*off, (unsigned long long)*size); |
450 |
| - return 0; |
451 |
| -} |
0 commit comments