]> git.ipfire.org Git - people/ms/u-boot.git/blame - common/cmd_mp.c
NAND: rearrange ONFI revision checking, add ONFI 2.3
[people/ms/u-boot.git] / common / cmd_mp.c
CommitLineData
ec2b74ff 1/*
0e870980 2 * Copyright 2008-2009 Freescale Semiconductor, Inc.
ec2b74ff
KG
3 *
4 * See file CREDITS for list of people who contributed to this
5 * project.
6 *
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.
11 *
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.
16 *
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,
20 * MA 02111-1307 USA
21 */
22
23#include <common.h>
24#include <command.h>
25
26int
54841ab5 27cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ec2b74ff 28{
79679d80 29 unsigned long cpuid;
ec2b74ff 30
47e26b1b
WD
31 if (argc < 3)
32 return cmd_usage(cmdtp);
ec2b74ff
KG
33
34 cpuid = simple_strtoul(argv[1], NULL, 10);
0e870980 35 if (cpuid >= cpu_numcores()) {
348753d4 36 printf ("Core num: %lu is out of range[0..%d]\n",
0e870980 37 cpuid, cpu_numcores() - 1);
ec2b74ff
KG
38 return 1;
39 }
40
41
42 if (argc == 3) {
47e26b1b 43 if (strncmp(argv[2], "reset", 5) == 0)
ec2b74ff 44 cpu_reset(cpuid);
47e26b1b 45 else if (strncmp(argv[2], "status", 6) == 0)
ec2b74ff 46 cpu_status(cpuid);
47e26b1b 47 else if (strncmp(argv[2], "disable", 7) == 0)
4194b366 48 return cpu_disable(cpuid);
47e26b1b
WD
49 else
50 return cmd_usage(cmdtp);
51
ec2b74ff
KG
52 return 0;
53 }
54
55 /* 4 or greater, make sure its release */
47e26b1b
WD
56 if (strncmp(argv[2], "release", 7) != 0)
57 return cmd_usage(cmdtp);
ec2b74ff 58
47e26b1b
WD
59 if (cpu_release(cpuid, argc - 3, argv + 3))
60 return cmd_usage(cmdtp);
ec2b74ff
KG
61
62 return 0;
63}
64
65#ifdef CONFIG_PPC
66#define CPU_ARCH_HELP \
79679d80 67 " [args] : <pir> <r3> <r6>\n" \
ec2b74ff
KG
68 " pir - processor id (if writeable)\n" \
69 " r3 - value for gpr 3\n" \
ec2b74ff 70 " r6 - value for gpr 6\n" \
ec2b74ff
KG
71 "\n" \
72 " Use '-' for any arg if you want the default value.\n" \
79679d80 73 " Default for r3 is <num> and r6 is 0\n" \
ec2b74ff 74 "\n" \
79679d80 75 " When cpu <num> is released r4 and r5 = 0.\n" \
a89c33db 76 " r7 will contain the size of the initial mapped area"
ec2b74ff
KG
77#endif
78
79U_BOOT_CMD(
6d0f6bcf 80 cpu, CONFIG_SYS_MAXARGS, 1, cpu_cmd,
2fb2604d 81 "Multiprocessor CPU boot manipulation and release",
ec2b74ff
KG
82 "<num> reset - Reset cpu <num>\n"
83 "cpu <num> status - Status of cpu <num>\n"
4194b366 84 "cpu <num> disable - Disable cpu <num>\n"
a89c33db 85 "cpu <num> release <addr> [args] - Release cpu <num> at <addr> with [args]"
ec2b74ff 86#ifdef CPU_ARCH_HELP
a89c33db 87 "\n"
ec2b74ff
KG
88 CPU_ARCH_HELP
89#endif
a89c33db 90);