blob: d0ff5c5c41d7ef4d9cc64983064d22cd0d8756bf [file] [log] [blame]
Peng Fan0c830d32018-10-18 14:28:07 +02001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright 2018 NXP
4 */
5
6#ifndef _SC_SCI_H
7#define _SC_SCI_H
8
9#include <asm/arch/sci/types.h>
10#include <asm/arch/sci/svc/misc/api.h>
11#include <asm/arch/sci/svc/pad/api.h>
12#include <asm/arch/sci/svc/pm/api.h>
13#include <asm/arch/sci/svc/rm/api.h>
14#include <asm/arch/sci/rpc.h>
15#include <dt-bindings/soc/imx_rsrc.h>
16#include <linux/errno.h>
17
18static inline int sc_err_to_linux(sc_err_t err)
19{
20 int ret;
21
22 switch (err) {
23 case SC_ERR_NONE:
24 return 0;
25 case SC_ERR_VERSION:
26 case SC_ERR_CONFIG:
27 case SC_ERR_PARM:
28 ret = -EINVAL;
29 break;
30 case SC_ERR_NOACCESS:
31 case SC_ERR_LOCKED:
32 case SC_ERR_UNAVAILABLE:
33 ret = -EACCES;
34 break;
35 case SC_ERR_NOTFOUND:
36 case SC_ERR_NOPOWER:
37 ret = -ENODEV;
38 break;
39 case SC_ERR_IPC:
40 ret = -EIO;
41 break;
42 case SC_ERR_BUSY:
43 ret = -EBUSY;
44 break;
45 case SC_ERR_FAIL:
46 ret = -EIO;
47 break;
48 default:
49 ret = 0;
50 break;
51 }
52
53 debug("%s %d %d\n", __func__, err, ret);
54
55 return ret;
56}
57
58#endif