3 * Wolfgang Grandegger, DENX Software Engineering, wg@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
16 #if defined(CONFIG_CMD_BSP)
19 * Command led: controls the various LEDs 0..11 on the PN62 card.
21 int do_led(cmd_tbl_t * cmdtp, int flag, int argc, char *const argv[])
23 unsigned int number, function;
26 return cmd_usage(cmdtp);
28 number = simple_strtoul(argv[1], NULL, 10);
29 if (number > PN62_LED_MAX)
32 function = simple_strtoul(argv[2], NULL, 16);
33 set_led(number, function);
38 "set LED 0..11 on the PN62 board",
40 " - set 'i'th LED to function 'fun'"
44 * Command loadpci: loads a image over PCI.
46 #define CMD_MOVE_WINDOW 0x1
47 #define CMD_BOOT_IMAGE 0x2
49 int do_loadpci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
52 ulong addr = 0, count = 0;
56 /* pre-set load_addr */
57 if ((s = getenv("loadaddr")) != NULL) {
58 addr = simple_strtoul(s, NULL, 16);
65 addr = simple_strtoul(argv[1], NULL, 16);
68 return cmd_usage(cmdtp);
71 printf ("## Ready for image download ...\n");
73 show_startup_phase(12);
77 i2155x_write_scrapad(BOOT_PROTO, BOOT_PROTO_READY);
79 /* Toggle status LEDs */
80 cmd = (count / 200) % 4; /* downscale */
81 set_led(4, cmd == 0 ? LED_1 : LED_0);
82 set_led(5, cmd == 1 ? LED_1 : LED_0);
83 set_led(6, cmd == 2 ? LED_1 : LED_0);
84 set_led(7, cmd == 3 ? LED_1 : LED_0);
88 cmd = i2155x_read_scrapad(BOOT_CMD);
90 if (cmd == BOOT_CMD_MOVE) {
91 off = i2155x_read_scrapad(BOOT_DATA);
93 i2155x_set_bar_base(3, off);
94 printf ("## BAR3 Addr moved = 0x%08x\n", off);
95 i2155x_write_scrapad(BOOT_CMD, ~cmd);
96 show_startup_phase(13);
98 else if (cmd == BOOT_CMD_BOOT) {
104 i2155x_write_scrapad(BOOT_CMD, ~cmd);
105 show_startup_phase(14);
109 /* Abort if ctrl-c was pressed */
117 /* Repoint to the default shared memory */
118 i2155x_set_bar_base(3, PN62_SMEM_DEFAULT);
121 printf ("## Start Addr = 0x%08lx\n", addr);
123 show_startup_phase(15);
125 /* Loading ok, check if we should attempt an auto-start */
126 if (((s = getenv("autostart")) != NULL) && (strcmp(s,"yes") == 0)) {
128 local_args[0] = argv[0];
129 local_args[1] = NULL;
131 printf ("Automatic boot of image at addr 0x%08lX ...\n",
133 rcode = do_bootm (cmdtp, 0, 1, local_args);
140 loadpci, 2, 1, do_loadpci,
141 "load binary file over PCI",
143 " - load binary file over PCI to address 'addr'"