Merge tag 'iommu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[linux/fpc-iii.git] / include / memory / renesas-rpc-if.h
blob14cfd036268a2f5799baf100d89ff46605aa60cc
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Renesas RPC-IF core driver
5 * Copyright (C) 2018~2019 Renesas Solutions Corp.
6 * Copyright (C) 2019 Macronix International Co., Ltd.
7 * Copyright (C) 2019-2020 Cogent Embedded, Inc.
8 */
10 #ifndef __RENESAS_RPC_IF_H
11 #define __RENESAS_RPC_IF_H
13 #include <linux/pm_runtime.h>
14 #include <linux/types.h>
16 enum rpcif_data_dir {
17 RPCIF_NO_DATA,
18 RPCIF_DATA_IN,
19 RPCIF_DATA_OUT,
22 struct rpcif_op {
23 struct {
24 u8 buswidth;
25 u8 opcode;
26 bool ddr;
27 } cmd, ocmd;
29 struct {
30 u8 nbytes;
31 u8 buswidth;
32 bool ddr;
33 u64 val;
34 } addr;
36 struct {
37 u8 ncycles;
38 u8 buswidth;
39 } dummy;
41 struct {
42 u8 nbytes;
43 u8 buswidth;
44 bool ddr;
45 u32 val;
46 } option;
48 struct {
49 u8 buswidth;
50 unsigned int nbytes;
51 enum rpcif_data_dir dir;
52 bool ddr;
53 union {
54 void *in;
55 const void *out;
56 } buf;
57 } data;
60 struct rpcif {
61 struct device *dev;
62 void __iomem *dirmap;
63 struct regmap *regmap;
64 struct reset_control *rstc;
65 size_t size;
66 enum rpcif_data_dir dir;
67 u8 bus_size;
68 void *buffer;
69 u32 xferlen;
70 u32 smcr;
71 u32 smadr;
72 u32 command; /* DRCMR or SMCMR */
73 u32 option; /* DROPR or SMOPR */
74 u32 enable; /* DRENR or SMENR */
75 u32 dummy; /* DRDMCR or SMDMCR */
76 u32 ddr; /* DRDRENR or SMDRENR */
79 int rpcif_sw_init(struct rpcif *rpc, struct device *dev);
80 void rpcif_hw_init(struct rpcif *rpc, bool hyperflash);
81 void rpcif_prepare(struct rpcif *rpc, const struct rpcif_op *op, u64 *offs,
82 size_t *len);
83 int rpcif_manual_xfer(struct rpcif *rpc);
84 ssize_t rpcif_dirmap_read(struct rpcif *rpc, u64 offs, size_t len, void *buf);
86 static inline void rpcif_enable_rpm(struct rpcif *rpc)
88 pm_runtime_enable(rpc->dev);
91 static inline void rpcif_disable_rpm(struct rpcif *rpc)
93 pm_runtime_disable(rpc->dev);
96 #endif // __RENESAS_RPC_IF_H