Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 Marvell International Ltd. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * https://spdx.org/licenses |
| 6 | */ |
| 7 | |
| 8 | #include <platform.h> |
| 9 | #include <arch_helpers.h> |
| 10 | #include <mmio.h> |
| 11 | #include <debug.h> |
| 12 | #include <cache_llc.h> |
| 13 | |
| 14 | |
| 15 | #define CCU_HTC_ASET (MVEBU_CCU_BASE(MVEBU_AP0) + 0x264) |
| 16 | #define MVEBU_IO_AFFINITY (0xF00) |
| 17 | |
| 18 | |
| 19 | static void plat_enable_affinity(void) |
| 20 | { |
| 21 | int cluster_id; |
| 22 | int affinity; |
| 23 | |
| 24 | /* set CPU Affinity */ |
| 25 | cluster_id = plat_my_core_pos() / PLAT_MARVELL_CLUSTER_CORE_COUNT; |
| 26 | affinity = (MVEBU_IO_AFFINITY | (1 << cluster_id)); |
| 27 | mmio_write_32(CCU_HTC_ASET, affinity); |
| 28 | |
| 29 | /* set barier */ |
| 30 | isb(); |
| 31 | } |
| 32 | |
| 33 | void marvell_psci_arch_init(int die_index) |
| 34 | { |
| 35 | #if LLC_ENABLE |
| 36 | /* check if LLC is in exclusive mode |
| 37 | * as L2 is configured to UniqueClean eviction |
| 38 | * (in a8k reset handler) |
| 39 | */ |
| 40 | if (llc_is_exclusive(0) == 0) |
| 41 | ERROR("LLC should be configured to exclusice mode\n"); |
| 42 | #endif |
| 43 | |
| 44 | /* Enable Affinity */ |
| 45 | plat_enable_affinity(); |
| 46 | } |