Haavard Skinnemoen | d255bb0 | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Command for accessing DataFlash. |
| 3 | * |
| 4 | * Copyright (C) 2008 Atmel Corporation |
| 5 | */ |
| 6 | #include <common.h> |
| 7 | #include <df.h> |
| 8 | |
| 9 | static int do_df(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 10 | { |
| 11 | const char *cmd; |
| 12 | |
| 13 | /* need at least two arguments */ |
| 14 | if (argc < 2) |
| 15 | goto usage; |
| 16 | |
| 17 | cmd = argv[1]; |
| 18 | |
| 19 | if (strcmp(cmd, "init") == 0) { |
| 20 | df_init(0, 0, 1000000); |
| 21 | return 0; |
| 22 | } |
| 23 | |
| 24 | if (strcmp(cmd, "info") == 0) { |
| 25 | df_show_info(); |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | usage: |
Peter Tyser | 62c3ae7 | 2009-01-27 18:03:10 -0600 | [diff] [blame] | 30 | cmd_usage(cmdtp); |
Haavard Skinnemoen | d255bb0 | 2008-05-16 11:10:31 +0200 | [diff] [blame] | 31 | return 1; |
| 32 | } |
| 33 | |
| 34 | U_BOOT_CMD( |
| 35 | sf, 2, 1, do_serial_flash, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 36 | "Serial flash sub-system", |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 37 | "probe [bus:]cs - init flash device on given SPI bus and CS") |