2 * Copyright (C) 2018 Marvell International Ltd.
4 * SPDX-License-Identifier: BSD-3-Clause
5 * https://spdx.org/licenses
8 #include <common/debug.h>
9 #include <common/runtime_svc.h>
10 #include <lib/smccc.h>
12 #include <marvell_plat_priv.h>
13 #include <plat_marvell.h>
15 #include "comphy/phy-comphy-3700.h"
17 /* Comphy related FID's */
18 #define MV_SIP_COMPHY_POWER_ON 0x82000001
19 #define MV_SIP_COMPHY_POWER_OFF 0x82000002
20 #define MV_SIP_COMPHY_PLL_LOCK 0x82000003
22 /* Miscellaneous FID's' */
23 #define MV_SIP_DRAM_SIZE 0x82000010
25 /* This macro is used to identify COMPHY related calls from SMC function ID */
26 #define is_comphy_fid(fid) \
27 ((fid) >= MV_SIP_COMPHY_POWER_ON && (fid) <= MV_SIP_COMPHY_PLL_LOCK)
29 uintptr_t mrvl_sip_smc_handler(uint32_t smc_fid
,
40 VERBOSE("%s: got SMC (0x%x) x1 0x%lx, x2 0x%lx\n",
41 __func__
, smc_fid
, x1
, x2
);
42 if (is_comphy_fid(smc_fid
)) {
43 if (x1
>= MAX_LANE_NR
) {
44 ERROR("%s: Wrong smc (0x%x) lane nr: %lx\n",
45 __func__
, smc_fid
, x2
);
46 SMC_RET1(handle
, SMC_UNK
);
51 /* Comphy related FID's */
52 case MV_SIP_COMPHY_POWER_ON
:
53 /* x1: comphy_index, x2: comphy_mode */
54 ret
= mvebu_3700_comphy_power_on(x1
, x2
);
55 SMC_RET1(handle
, ret
);
56 case MV_SIP_COMPHY_POWER_OFF
:
57 /* x1: comphy_index, x2: comphy_mode */
58 ret
= mvebu_3700_comphy_power_off(x1
, x2
);
59 SMC_RET1(handle
, ret
);
60 case MV_SIP_COMPHY_PLL_LOCK
:
61 /* x1: comphy_index, x2: comphy_mode */
62 ret
= mvebu_3700_comphy_is_pll_locked(x1
, x2
);
63 SMC_RET1(handle
, ret
);
64 /* Miscellaneous FID's' */
65 case MV_SIP_DRAM_SIZE
:
66 /* x1: ap_base_addr */
67 ret
= mvebu_get_dram_size(MVEBU_REGS_BASE
);
68 SMC_RET1(handle
, ret
);
71 ERROR("%s: unhandled SMC (0x%x)\n", __func__
, smc_fid
);
72 SMC_RET1(handle
, SMC_UNK
);
76 /* Define a runtime service descriptor for fast SMC calls */