summaryrefslogtreecommitdiff
path: root/common/cmd_bl40.c
blob: e1e0a7c7d07a6a6e2fa10e2d1f8e980002dc5f1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * common/cmd_reboot.c
 *
 * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#include <common.h>
#include <command.h>
#include <asm/arch/mailbox.h>
#define LOADER_BL40_ADDR 0x20000000
static int do_load_send_bl40(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	unsigned long addr, length;

	if (argc <= 1) {
		printf("plese input bl40 args: addrss and size !\n");
		return CMD_RET_USAGE;
	}

	addr = simple_strtoul(argv[1], NULL, 16);
	length = simple_strtoul(argv[2], NULL, 16);
	if (addr < LOADER_BL40_ADDR) {
		printf("LOAD bl40 addr must greater than or equal to 0x20000000!\n");
		return CMD_RET_USAGE;
	}

	printf("bl40 start address:0x%lx,size:0x%lx\n",addr, length);
	bl40_wait_unlock();
	return send_bl40(addr, length);
}

U_BOOT_CMD(
	ld_bl40,	3,	1,	do_load_send_bl40,
	"load bl40 and run bl40.bin from bl33",
	"load bl40 format:\n"
	"	ld_bl40 address size!\n"
	"	load bl40 address must greater than or equal to 0x20000000!\n"
);