Ye Li | 0c00d03 | 2021-08-07 16:00:41 +0800 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright 2020 NXP |
| 4 | * |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <hang.h> |
| 9 | #include <malloc.h> |
| 10 | #include <asm/io.h> |
| 11 | #include <dm.h> |
| 12 | #include <asm/arch/s400_api.h> |
| 13 | #include <misc.h> |
| 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
| 17 | int ahab_release_rdc(u8 core_id) |
| 18 | { |
| 19 | struct udevice *dev = gd->arch.s400_dev; |
| 20 | int size = sizeof(struct imx8ulp_s400_msg); |
| 21 | struct imx8ulp_s400_msg msg; |
| 22 | int ret; |
| 23 | |
| 24 | if (!dev) { |
| 25 | printf("s400 dev is not initialized\n"); |
| 26 | return -ENODEV; |
| 27 | } |
| 28 | |
| 29 | msg.version = AHAB_VERSION; |
| 30 | msg.tag = AHAB_CMD_TAG; |
| 31 | msg.size = 2; |
| 32 | msg.command = AHAB_RELEASE_RDC_REQ_CID; |
| 33 | msg.data[0] = core_id; |
| 34 | |
| 35 | ret = misc_call(dev, false, &msg, size, &msg, size); |
| 36 | if (ret) |
| 37 | printf("Error: %s: ret %d, core id %u, response 0x%x\n", |
| 38 | __func__, ret, core_id, msg.data[0]); |
| 39 | |
| 40 | return ret; |
| 41 | } |