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