]>
git.ipfire.org Git - people/ms/u-boot.git/blob - arch/arm/imx-common/cmd_bmode.c
ddc14b099e6cdd4e46dbfe83bd0f1025bcebd0f9
2 * Copyright (C) 2012 Boundary Devices Inc.
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 #include <asm/errno.h>
25 #include <asm/imx-common/boot_mode.h>
29 static const struct boot_mode
*modes
[2];
31 static const struct boot_mode
*search_modes(char *arg
)
35 for (i
= 0; i
< ARRAY_SIZE(modes
); i
++) {
36 const struct boot_mode
*p
= modes
[i
];
39 if (!strcmp(p
->name
, arg
))
48 static int create_usage(char *dest
)
53 for (i
= 0; i
< ARRAY_SIZE(modes
); i
++) {
54 const struct boot_mode
*p
= modes
[i
];
57 int len
= strlen(p
->name
);
59 memcpy(dest
, p
->name
, len
);
69 memcpy(dest
- 1, " [noreset]", 11); /* include trailing 0 */
74 static int do_boot_mode(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
77 const struct boot_mode
*p
;
78 int reset_requested
= 1;
82 p
= search_modes(argv
[1]);
86 if (strcmp(argv
[2], "noreset"))
91 boot_mode_apply(p
->cfg_val
);
92 if (reset_requested
&& p
->cfg_val
)
93 do_reset(NULL
, 0, 0, NULL
);
98 bmode
, 3, 0, do_boot_mode
,
102 void add_board_boot_modes(const struct boot_mode
*p
)
107 cmd_tbl_t
*entry
= ll_entry_get(cmd_tbl_t
, bmode
, cmd
);
115 modes
[1] = soc_boot_modes
;
116 size
= create_usage(NULL
);