3 * Wolfgang Grandegger, DENX Software Engineering, wg@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 #if defined(CONFIG_CMD_BSP)
34 extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
37 * Command led: controls the various LEDs 0..11 on the PN62 card.
39 int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
41 unsigned int number, function;
47 number = simple_strtoul(argv[1], NULL, 10);
48 if (number > PN62_LED_MAX)
50 function = simple_strtoul(argv[2], NULL, 16);
51 set_led (number, function);
56 "set LED 0..11 on the PN62 board",
58 " - set 'i'th LED to function 'fun'\n"
62 * Command loadpci: loads a image over PCI.
64 #define CMD_MOVE_WINDOW 0x1
65 #define CMD_BOOT_IMAGE 0x2
67 int do_loadpci (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
70 ulong addr = 0, count = 0;
74 /* pre-set load_addr */
75 if ((s = getenv("loadaddr")) != NULL) {
76 addr = simple_strtoul(s, NULL, 16);
83 addr = simple_strtoul(argv[1], NULL, 16);
90 printf ("## Ready for image download ...\n");
92 show_startup_phase(12);
96 i2155x_write_scrapad(BOOT_PROTO, BOOT_PROTO_READY);
98 /* Toggle status LEDs */
99 cmd = (count / 200) % 4; /* downscale */
100 set_led(4, cmd == 0 ? LED_1 : LED_0);
101 set_led(5, cmd == 1 ? LED_1 : LED_0);
102 set_led(6, cmd == 2 ? LED_1 : LED_0);
103 set_led(7, cmd == 3 ? LED_1 : LED_0);
107 cmd = i2155x_read_scrapad(BOOT_CMD);
109 if (cmd == BOOT_CMD_MOVE) {
110 off = i2155x_read_scrapad(BOOT_DATA);
112 i2155x_set_bar_base(3, off);
113 printf ("## BAR3 Addr moved = 0x%08x\n", off);
114 i2155x_write_scrapad(BOOT_CMD, ~cmd);
115 show_startup_phase(13);
117 else if (cmd == BOOT_CMD_BOOT) {
123 i2155x_write_scrapad(BOOT_CMD, ~cmd);
124 show_startup_phase(14);
128 /* Abort if ctrl-c was pressed */
136 /* Repoint to the default shared memory */
137 i2155x_set_bar_base(3, PN62_SMEM_DEFAULT);
140 printf ("## Start Addr = 0x%08lx\n", addr);
142 show_startup_phase(15);
144 /* Loading ok, check if we should attempt an auto-start */
145 if (((s = getenv("autostart")) != NULL) && (strcmp(s,"yes") == 0)) {
147 local_args[0] = argv[0];
148 local_args[1] = NULL;
150 printf ("Automatic boot of image at addr 0x%08lX ...\n",
152 rcode = do_bootm (cmdtp, 0, 1, local_args);
159 if (((s = getenv("autoscript")) != NULL) && (strcmp(s,"yes") == 0)) {
160 printf ("Running "source" command at addr 0x%08lX",
163 s = getenv ("autoscript_uname");
165 printf (":%s ...\n", s);
169 rcode = source (load_addr, s);
177 loadpci, 2, 1, do_loadpci,
178 "load binary file over PCI",
180 " - load binary file over PCI to address 'addr'\n"