Grzegorz Jaszczyk | 65b9afa | 2019-04-12 16:53:49 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019 Marvell International Ltd. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * https://spdx.org/licenses |
| 6 | */ |
| 7 | |
| 8 | #include <a8k_plat_def.h> |
| 9 | #include <common/debug.h> |
| 10 | #include <lib/mmio.h> |
| 11 | #include <mvebu.h> |
| 12 | |
| 13 | /* CONFI REGISTERS */ |
| 14 | #define MG_CM3_CONFI_BASE(CP) (MVEBU_CP_REGS_BASE(CP) + 0x100000) |
| 15 | #define MG_CM3_CONFI_GLOB_CFG_REG(CP) (MG_CM3_CONFI_BASE(CP) + 0x2B500) |
| 16 | #define CM3_CPU_EN_BIT BIT(28) |
| 17 | #define MG_CM3_MG_INT_MFX_REG(CP) (MG_CM3_CONFI_BASE(CP) + 0x2B054) |
| 18 | #define CM3_SYS_RESET_BIT BIT(0) |
| 19 | |
| 20 | void mg_start_ap_fw(int cp_nr) |
| 21 | { |
| 22 | if (mmio_read_32(MG_CM3_CONFI_GLOB_CFG_REG(cp_nr)) & CM3_CPU_EN_BIT) { |
| 23 | VERBOSE("cm3 already running\n"); |
| 24 | return; /* cm3 already running */ |
| 25 | } |
| 26 | |
| 27 | mmio_setbits_32(MG_CM3_CONFI_GLOB_CFG_REG(cp_nr), CM3_CPU_EN_BIT); |
| 28 | mmio_setbits_32(MG_CM3_MG_INT_MFX_REG(cp_nr), CM3_SYS_RESET_BIT); |
| 29 | |
| 30 | /* TODO: add some routine for checking if ap process is running, if not |
| 31 | * disable cm3. |
| 32 | */ |
| 33 | } |