cmd_df.c 612 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Command for accessing DataFlash.
  3. *
  4. * Copyright (C) 2008 Atmel Corporation
  5. */
  6. #include <common.h>
  7. #include <df.h>
  8. static int do_df(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  9. {
  10. const char *cmd;
  11. /* need at least two arguments */
  12. if (argc < 2)
  13. goto usage;
  14. cmd = argv[1];
  15. if (strcmp(cmd, "init") == 0) {
  16. df_init(0, 0, 1000000);
  17. return 0;
  18. }
  19. if (strcmp(cmd, "info") == 0) {
  20. df_show_info();
  21. return 0;
  22. }
  23. usage:
  24. return cmd_usage(cmdtp);
  25. }
  26. U_BOOT_CMD(
  27. sf, 2, 1, do_serial_flash,
  28. "Serial flash sub-system",
  29. "probe [bus:]cs - init flash device on given SPI bus and CS")