bangzheng.liu | acb070d | 2024-01-15 14:05:04 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
| 2 | /* |
| 3 | * Copyright (c) 2019 Amlogic, Inc. All rights reserved. |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <command.h> |
| 8 | #include <asm/amlogic/arch/bl31_apis.h> |
| 9 | #include <serial.h> |
| 10 | |
| 11 | static int do_remapset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| 12 | { |
| 13 | int ret = 0; |
| 14 | int dspid = 0; |
bangzheng.liu | 9b28510 | 2024-06-11 15:30:27 +0800 | [diff] [blame] | 15 | int id = 0; |
bangzheng.liu | acb070d | 2024-01-15 14:05:04 +0800 | [diff] [blame] | 16 | int addr_0 = 0; |
| 17 | int addr_1 = 0; |
| 18 | int reg_sel = 0; |
| 19 | |
| 20 | dspid = simple_strtoul(argv[1], NULL, 16); |
| 21 | addr_0 = simple_strtoul(argv[2], NULL, 16); |
| 22 | addr_1 = simple_strtoul(argv[3], NULL, 16); |
| 23 | reg_sel = simple_strtoul(argv[4], NULL, 16); |
| 24 | |
bangzheng.liu | 9b28510 | 2024-06-11 15:30:27 +0800 | [diff] [blame] | 25 | id = PACK_SMC_SUBID_ID(HIFI_DSP_REMAP, dspid); |
| 26 | remap_set(id, addr_0, addr_1, reg_sel); |
bangzheng.liu | acb070d | 2024-01-15 14:05:04 +0800 | [diff] [blame] | 27 | |
| 28 | return ret; |
| 29 | } |
| 30 | |
| 31 | U_BOOT_CMD( |
| 32 | remapset, 5, 1, do_remapset, |
| 33 | "do_remapset the address will be mapped", |
| 34 | "\narg[0]: cmd\n" |
| 35 | "arg[1]: dspid \n" |
| 36 | "arg[2]: load address!\n" |
| 37 | "arg[3]: target address!\n" |
| 38 | "arg[4]: register type select: 0: 16-bit 1: 18-bit 2: 20-bit !\n" |
| 39 | ); |
| 40 | |