| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#include <common/debug.h> |
| 9 |
#include <common/runtime_svc.h> |
| 10 |
#include <lib/smccc.h> |
| 11 |
|
| 12 |
#include <marvell_plat_priv.h> |
| 13 |
#include <plat_marvell.h> |
| 14 |
|
| 15 |
#include "comphy/phy-comphy-3700.h" |
| 16 |
|
| 17 |
|
| 18 |
#define MV_SIP_COMPHY_POWER_ON 0x82000001 |
| 19 |
#define MV_SIP_COMPHY_POWER_OFF 0x82000002 |
| 20 |
#define MV_SIP_COMPHY_PLL_LOCK 0x82000003 |
| 21 |
|
| 22 |
|
| 23 |
#define MV_SIP_DRAM_SIZE 0x82000010 |
| 24 |
|
| 25 |
|
| 26 |
#define is_comphy_fid(fid) \ |
| 27 |
((fid) >= MV_SIP_COMPHY_POWER_ON && (fid) <= MV_SIP_COMPHY_PLL_LOCK) |
| 28 |
|
| 29 |
uintptr_t mrvl_sip_smc_handler(uint32_t smc_fid, |
| 30 |
u_register_t x1, |
| 31 |
u_register_t x2, |
| 32 |
u_register_t x3, |
| 33 |
u_register_t x4, |
| 34 |
void *cookie, |
| 35 |
void *handle, |
| 36 |
u_register_t flags) |
| 37 |
{ |
| 38 |
u_register_t ret; |
| 39 |
|
| 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); |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
switch (smc_fid) { |
| 51 |
|
| 52 |
case MV_SIP_COMPHY_POWER_ON: |
| 53 |
|
| 54 |
ret = mvebu_3700_comphy_power_on(x1, x2); |
| 55 |
SMC_RET1(handle, ret); |
| 56 |
case MV_SIP_COMPHY_POWER_OFF: |
| 57 |
|
| 58 |
ret = mvebu_3700_comphy_power_off(x1, x2); |
| 59 |
SMC_RET1(handle, ret); |
| 60 |
case MV_SIP_COMPHY_PLL_LOCK: |
| 61 |
|
| 62 |
ret = mvebu_3700_comphy_is_pll_locked(x1, x2); |
| 63 |
SMC_RET1(handle, ret); |
| 64 |
|
| 65 |
case MV_SIP_DRAM_SIZE: |
| 66 |
|
| 67 |
ret = mvebu_get_dram_size(MVEBU_REGS_BASE); |
| 68 |
SMC_RET1(handle, ret); |
| 69 |
|
| 70 |
default: |
| 71 |
ERROR("%s: unhandled SMC (0x%x)\n", __func__, smc_fid); |
| 72 |
SMC_RET1(handle, SMC_UNK); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
DECLARE_RT_SVC( |
| 78 |
marvell_sip_svc, |
| 79 |
OEN_SIP_START, |
| 80 |
OEN_SIP_END, |
| 81 |
SMC_TYPE_FAST, |
| 82 |
NULL, |
| 83 |
mrvl_sip_smc_handler |
| 84 |
); |