1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
4 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
7 int xudma_navss_psil_pair(struct udma_dev
*ud
, u32 src_thread
, u32 dst_thread
)
9 return navss_psil_pair(ud
, src_thread
, dst_thread
);
11 EXPORT_SYMBOL(xudma_navss_psil_pair
);
13 int xudma_navss_psil_unpair(struct udma_dev
*ud
, u32 src_thread
, u32 dst_thread
)
15 return navss_psil_unpair(ud
, src_thread
, dst_thread
);
17 EXPORT_SYMBOL(xudma_navss_psil_unpair
);
19 struct udma_dev
*of_xudma_dev_get(struct device_node
*np
, const char *property
)
21 struct device_node
*udma_node
= np
;
22 struct platform_device
*pdev
;
26 udma_node
= of_parse_phandle(np
, property
, 0);
28 pr_err("UDMA node is not found\n");
29 return ERR_PTR(-ENODEV
);
33 pdev
= of_find_device_by_node(udma_node
);
35 pr_debug("UDMA device not found\n");
36 return ERR_PTR(-EPROBE_DEFER
);
40 of_node_put(udma_node
);
42 ud
= platform_get_drvdata(pdev
);
44 pr_debug("UDMA has not been probed\n");
45 return ERR_PTR(-EPROBE_DEFER
);
50 EXPORT_SYMBOL(of_xudma_dev_get
);
52 u32
xudma_dev_get_psil_base(struct udma_dev
*ud
)
56 EXPORT_SYMBOL(xudma_dev_get_psil_base
);
58 struct udma_tisci_rm
*xudma_dev_get_tisci_rm(struct udma_dev
*ud
)
62 EXPORT_SYMBOL(xudma_dev_get_tisci_rm
);
64 int xudma_alloc_gp_rflow_range(struct udma_dev
*ud
, int from
, int cnt
)
66 return __udma_alloc_gp_rflow_range(ud
, from
, cnt
);
68 EXPORT_SYMBOL(xudma_alloc_gp_rflow_range
);
70 int xudma_free_gp_rflow_range(struct udma_dev
*ud
, int from
, int cnt
)
72 return __udma_free_gp_rflow_range(ud
, from
, cnt
);
74 EXPORT_SYMBOL(xudma_free_gp_rflow_range
);
76 bool xudma_rflow_is_gp(struct udma_dev
*ud
, int id
)
78 return !test_bit(id
, ud
->rflow_gp_map
);
80 EXPORT_SYMBOL(xudma_rflow_is_gp
);
82 #define XUDMA_GET_PUT_RESOURCE(res) \
83 struct udma_##res *xudma_##res##_get(struct udma_dev *ud, int id) \
85 return __udma_reserve_##res(ud, false, id); \
87 EXPORT_SYMBOL(xudma_##res##_get); \
89 void xudma_##res##_put(struct udma_dev *ud, struct udma_##res *p) \
91 clear_bit(p->id, ud->res##_map); \
93 EXPORT_SYMBOL(xudma_##res##_put)
94 XUDMA_GET_PUT_RESOURCE(tchan
);
95 XUDMA_GET_PUT_RESOURCE(rchan
);
97 struct udma_rflow
*xudma_rflow_get(struct udma_dev
*ud
, int id
)
99 return __udma_get_rflow(ud
, id
);
101 EXPORT_SYMBOL(xudma_rflow_get
);
103 void xudma_rflow_put(struct udma_dev
*ud
, struct udma_rflow
*p
)
105 __udma_put_rflow(ud
, p
);
107 EXPORT_SYMBOL(xudma_rflow_put
);
109 #define XUDMA_GET_RESOURCE_ID(res) \
110 int xudma_##res##_get_id(struct udma_##res *p) \
114 EXPORT_SYMBOL(xudma_##res##_get_id)
115 XUDMA_GET_RESOURCE_ID(tchan
);
116 XUDMA_GET_RESOURCE_ID(rchan
);
117 XUDMA_GET_RESOURCE_ID(rflow
);
119 /* Exported register access functions */
120 #define XUDMA_RT_IO_FUNCTIONS(res) \
121 u32 xudma_##res##rt_read(struct udma_##res *p, int reg) \
123 return udma_##res##rt_read(p, reg); \
125 EXPORT_SYMBOL(xudma_##res##rt_read); \
127 void xudma_##res##rt_write(struct udma_##res *p, int reg, u32 val) \
129 udma_##res##rt_write(p, reg, val); \
131 EXPORT_SYMBOL(xudma_##res##rt_write)
132 XUDMA_RT_IO_FUNCTIONS(tchan
);
133 XUDMA_RT_IO_FUNCTIONS(rchan
);