xref: /openbmc/linux/include/linux/soc/mediatek/mtk-cmdq.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1576f1b4bSHoulong Wei /* SPDX-License-Identifier: GPL-2.0 */
2576f1b4bSHoulong Wei /*
3576f1b4bSHoulong Wei  * Copyright (c) 2018 MediaTek Inc.
4576f1b4bSHoulong Wei  *
5576f1b4bSHoulong Wei  */
6576f1b4bSHoulong Wei 
7576f1b4bSHoulong Wei #ifndef __MTK_CMDQ_H__
8576f1b4bSHoulong Wei #define __MTK_CMDQ_H__
9576f1b4bSHoulong Wei 
10576f1b4bSHoulong Wei #include <linux/mailbox_client.h>
11576f1b4bSHoulong Wei #include <linux/mailbox/mtk-cmdq-mailbox.h>
12576f1b4bSHoulong Wei #include <linux/timer.h>
13576f1b4bSHoulong Wei 
145f6e560cSDennis YC Hsieh #define CMDQ_ADDR_HIGH(addr)	((u32)(((addr) >> 16) & GENMASK(31, 0)))
155f6e560cSDennis YC Hsieh #define CMDQ_ADDR_LOW(addr)	((u16)(addr) | BIT(1))
16576f1b4bSHoulong Wei 
17576f1b4bSHoulong Wei struct cmdq_pkt;
18576f1b4bSHoulong Wei 
19d412f18cSBibby Hsieh struct cmdq_client_reg {
20d412f18cSBibby Hsieh 	u8 subsys;
21d412f18cSBibby Hsieh 	u16 offset;
22d412f18cSBibby Hsieh 	u16 size;
23d412f18cSBibby Hsieh };
24d412f18cSBibby Hsieh 
25576f1b4bSHoulong Wei struct cmdq_client {
26576f1b4bSHoulong Wei 	struct mbox_client client;
27576f1b4bSHoulong Wei 	struct mbox_chan *chan;
28576f1b4bSHoulong Wei };
29576f1b4bSHoulong Wei 
30*eb0d8623SAngeloGioacchino Del Regno #if IS_ENABLED(CONFIG_MTK_CMDQ)
31*eb0d8623SAngeloGioacchino Del Regno 
32576f1b4bSHoulong Wei /**
33d412f18cSBibby Hsieh  * cmdq_dev_get_client_reg() - parse cmdq client reg from the device
34d412f18cSBibby Hsieh  *			       node of CMDQ client
35d412f18cSBibby Hsieh  * @dev:	device of CMDQ mailbox client
36d412f18cSBibby Hsieh  * @client_reg: CMDQ client reg pointer
37d412f18cSBibby Hsieh  * @idx:	the index of desired reg
38d412f18cSBibby Hsieh  *
39d412f18cSBibby Hsieh  * Return: 0 for success; else the error code is returned
40d412f18cSBibby Hsieh  *
41d412f18cSBibby Hsieh  * Help CMDQ client parsing the cmdq client reg
42d412f18cSBibby Hsieh  * from the device node of CMDQ client.
43d412f18cSBibby Hsieh  */
44d412f18cSBibby Hsieh int cmdq_dev_get_client_reg(struct device *dev,
45d412f18cSBibby Hsieh 			    struct cmdq_client_reg *client_reg, int idx);
46d412f18cSBibby Hsieh 
47d412f18cSBibby Hsieh /**
48576f1b4bSHoulong Wei  * cmdq_mbox_create() - create CMDQ mailbox client and channel
49576f1b4bSHoulong Wei  * @dev:	device of CMDQ mailbox client
50576f1b4bSHoulong Wei  * @index:	index of CMDQ mailbox channel
51576f1b4bSHoulong Wei  *
52576f1b4bSHoulong Wei  * Return: CMDQ mailbox client pointer
53576f1b4bSHoulong Wei  */
54a69dcdfcSChun-Kuang Hu struct cmdq_client *cmdq_mbox_create(struct device *dev, int index);
55576f1b4bSHoulong Wei 
56576f1b4bSHoulong Wei /**
57576f1b4bSHoulong Wei  * cmdq_mbox_destroy() - destroy CMDQ mailbox client and channel
58576f1b4bSHoulong Wei  * @client:	the CMDQ mailbox client
59576f1b4bSHoulong Wei  */
60576f1b4bSHoulong Wei void cmdq_mbox_destroy(struct cmdq_client *client);
61576f1b4bSHoulong Wei 
62576f1b4bSHoulong Wei /**
63576f1b4bSHoulong Wei  * cmdq_pkt_create() - create a CMDQ packet
64576f1b4bSHoulong Wei  * @client:	the CMDQ mailbox client
65576f1b4bSHoulong Wei  * @size:	required CMDQ buffer size
66576f1b4bSHoulong Wei  *
67576f1b4bSHoulong Wei  * Return: CMDQ packet pointer
68576f1b4bSHoulong Wei  */
69576f1b4bSHoulong Wei struct cmdq_pkt *cmdq_pkt_create(struct cmdq_client *client, size_t size);
70576f1b4bSHoulong Wei 
71576f1b4bSHoulong Wei /**
72576f1b4bSHoulong Wei  * cmdq_pkt_destroy() - destroy the CMDQ packet
73576f1b4bSHoulong Wei  * @pkt:	the CMDQ packet
74576f1b4bSHoulong Wei  */
75576f1b4bSHoulong Wei void cmdq_pkt_destroy(struct cmdq_pkt *pkt);
76576f1b4bSHoulong Wei 
77576f1b4bSHoulong Wei /**
78576f1b4bSHoulong Wei  * cmdq_pkt_write() - append write command to the CMDQ packet
79576f1b4bSHoulong Wei  * @pkt:	the CMDQ packet
80576f1b4bSHoulong Wei  * @subsys:	the CMDQ sub system code
81576f1b4bSHoulong Wei  * @offset:	register offset from CMDQ sub system
821a92f989SBibby Hsieh  * @value:	the specified target register value
83576f1b4bSHoulong Wei  *
84576f1b4bSHoulong Wei  * Return: 0 for success; else the error code is returned
85576f1b4bSHoulong Wei  */
86556030f0SBibby Hsieh int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value);
87576f1b4bSHoulong Wei 
88576f1b4bSHoulong Wei /**
89576f1b4bSHoulong Wei  * cmdq_pkt_write_mask() - append write command with mask to the CMDQ packet
90576f1b4bSHoulong Wei  * @pkt:	the CMDQ packet
91576f1b4bSHoulong Wei  * @subsys:	the CMDQ sub system code
92576f1b4bSHoulong Wei  * @offset:	register offset from CMDQ sub system
931a92f989SBibby Hsieh  * @value:	the specified target register value
94576f1b4bSHoulong Wei  * @mask:	the specified target register mask
95576f1b4bSHoulong Wei  *
96576f1b4bSHoulong Wei  * Return: 0 for success; else the error code is returned
97576f1b4bSHoulong Wei  */
98556030f0SBibby Hsieh int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys,
99556030f0SBibby Hsieh 			u16 offset, u32 value, u32 mask);
100576f1b4bSHoulong Wei 
101d3b04aabSDennis YC Hsieh /*
102d3b04aabSDennis YC Hsieh  * cmdq_pkt_read_s() - append read_s command to the CMDQ packet
103d3b04aabSDennis YC Hsieh  * @pkt:	the CMDQ packet
104d3b04aabSDennis YC Hsieh  * @high_addr_reg_idx:	internal register ID which contains high address of pa
105d3b04aabSDennis YC Hsieh  * @addr_low:	low address of pa
106d3b04aabSDennis YC Hsieh  * @reg_idx:	the CMDQ internal register ID to cache read data
107d3b04aabSDennis YC Hsieh  *
108d3b04aabSDennis YC Hsieh  * Return: 0 for success; else the error code is returned
109d3b04aabSDennis YC Hsieh  */
110d3b04aabSDennis YC Hsieh int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, u16 addr_low,
111d3b04aabSDennis YC Hsieh 		    u16 reg_idx);
112d3b04aabSDennis YC Hsieh 
113576f1b4bSHoulong Wei /**
1145f6e560cSDennis YC Hsieh  * cmdq_pkt_write_s() - append write_s command to the CMDQ packet
1155f6e560cSDennis YC Hsieh  * @pkt:	the CMDQ packet
1165f6e560cSDennis YC Hsieh  * @high_addr_reg_idx:	internal register ID which contains high address of pa
1175f6e560cSDennis YC Hsieh  * @addr_low:	low address of pa
1185f6e560cSDennis YC Hsieh  * @src_reg_idx:	the CMDQ internal register ID which cache source value
1195f6e560cSDennis YC Hsieh  *
1205f6e560cSDennis YC Hsieh  * Return: 0 for success; else the error code is returned
1215f6e560cSDennis YC Hsieh  *
1225f6e560cSDennis YC Hsieh  * Support write value to physical address without subsys. Use CMDQ_ADDR_HIGH()
1235f6e560cSDennis YC Hsieh  * to get high address and call cmdq_pkt_assign() to assign value into internal
1245f6e560cSDennis YC Hsieh  * reg. Also use CMDQ_ADDR_LOW() to get low address for addr_low parameter when
1255f6e560cSDennis YC Hsieh  * call to this function.
1265f6e560cSDennis YC Hsieh  */
1275f6e560cSDennis YC Hsieh int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
1285f6e560cSDennis YC Hsieh 		     u16 addr_low, u16 src_reg_idx);
1295f6e560cSDennis YC Hsieh 
1305f6e560cSDennis YC Hsieh /**
13111c7842dSDennis YC Hsieh  * cmdq_pkt_write_s_mask() - append write_s with mask command to the CMDQ packet
13211c7842dSDennis YC Hsieh  * @pkt:	the CMDQ packet
13311c7842dSDennis YC Hsieh  * @high_addr_reg_idx:	internal register ID which contains high address of pa
13411c7842dSDennis YC Hsieh  * @addr_low:	low address of pa
13511c7842dSDennis YC Hsieh  * @src_reg_idx:	the CMDQ internal register ID which cache source value
13611c7842dSDennis YC Hsieh  * @mask:	the specified target address mask, use U32_MAX if no need
13711c7842dSDennis YC Hsieh  *
13811c7842dSDennis YC Hsieh  * Return: 0 for success; else the error code is returned
13911c7842dSDennis YC Hsieh  *
14011c7842dSDennis YC Hsieh  * Support write value to physical address without subsys. Use CMDQ_ADDR_HIGH()
14111c7842dSDennis YC Hsieh  * to get high address and call cmdq_pkt_assign() to assign value into internal
14211c7842dSDennis YC Hsieh  * reg. Also use CMDQ_ADDR_LOW() to get low address for addr_low parameter when
14311c7842dSDennis YC Hsieh  * call to this function.
14411c7842dSDennis YC Hsieh  */
14511c7842dSDennis YC Hsieh int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
14611c7842dSDennis YC Hsieh 			  u16 addr_low, u16 src_reg_idx, u32 mask);
14711c7842dSDennis YC Hsieh 
14811c7842dSDennis YC Hsieh /**
1491af43fceSDennis YC Hsieh  * cmdq_pkt_write_s_value() - append write_s command to the CMDQ packet which
1501af43fceSDennis YC Hsieh  *			      write value to a physical address
1511af43fceSDennis YC Hsieh  * @pkt:	the CMDQ packet
1521af43fceSDennis YC Hsieh  * @high_addr_reg_idx:	internal register ID which contains high address of pa
1531af43fceSDennis YC Hsieh  * @addr_low:	low address of pa
1541af43fceSDennis YC Hsieh  * @value:	the specified target value
1551af43fceSDennis YC Hsieh  *
1561af43fceSDennis YC Hsieh  * Return: 0 for success; else the error code is returned
1571af43fceSDennis YC Hsieh  */
1581af43fceSDennis YC Hsieh int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
1591af43fceSDennis YC Hsieh 			   u16 addr_low, u32 value);
1601af43fceSDennis YC Hsieh 
1611af43fceSDennis YC Hsieh /**
16288a2ffc4SDennis YC Hsieh  * cmdq_pkt_write_s_mask_value() - append write_s command with mask to the CMDQ
16388a2ffc4SDennis YC Hsieh  *				   packet which write value to a physical
16488a2ffc4SDennis YC Hsieh  *				   address
16588a2ffc4SDennis YC Hsieh  * @pkt:	the CMDQ packet
16688a2ffc4SDennis YC Hsieh  * @high_addr_reg_idx:	internal register ID which contains high address of pa
16788a2ffc4SDennis YC Hsieh  * @addr_low:	low address of pa
16888a2ffc4SDennis YC Hsieh  * @value:	the specified target value
16988a2ffc4SDennis YC Hsieh  * @mask:	the specified target mask
17088a2ffc4SDennis YC Hsieh  *
17188a2ffc4SDennis YC Hsieh  * Return: 0 for success; else the error code is returned
17288a2ffc4SDennis YC Hsieh  */
17388a2ffc4SDennis YC Hsieh int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
17488a2ffc4SDennis YC Hsieh 				u16 addr_low, u32 value, u32 mask);
17588a2ffc4SDennis YC Hsieh 
17688a2ffc4SDennis YC Hsieh /**
177576f1b4bSHoulong Wei  * cmdq_pkt_wfe() - append wait for event command to the CMDQ packet
178576f1b4bSHoulong Wei  * @pkt:	the CMDQ packet
17923c22299SDennis YC Hsieh  * @event:	the desired event type to wait
18023c22299SDennis YC Hsieh  * @clear:	clear event or not after event arrive
181576f1b4bSHoulong Wei  *
182576f1b4bSHoulong Wei  * Return: 0 for success; else the error code is returned
183576f1b4bSHoulong Wei  */
18423c22299SDennis YC Hsieh int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear);
185576f1b4bSHoulong Wei 
186576f1b4bSHoulong Wei /**
187576f1b4bSHoulong Wei  * cmdq_pkt_clear_event() - append clear event command to the CMDQ packet
188576f1b4bSHoulong Wei  * @pkt:	the CMDQ packet
189576f1b4bSHoulong Wei  * @event:	the desired event to be cleared
190576f1b4bSHoulong Wei  *
191576f1b4bSHoulong Wei  * Return: 0 for success; else the error code is returned
192576f1b4bSHoulong Wei  */
193556030f0SBibby Hsieh int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event);
194576f1b4bSHoulong Wei 
195576f1b4bSHoulong Wei /**
1967de796caSDennis YC Hsieh  * cmdq_pkt_set_event() - append set event command to the CMDQ packet
1977de796caSDennis YC Hsieh  * @pkt:	the CMDQ packet
1987de796caSDennis YC Hsieh  * @event:	the desired event to be set
1997de796caSDennis YC Hsieh  *
2007de796caSDennis YC Hsieh  * Return: 0 for success; else the error code is returned
2017de796caSDennis YC Hsieh  */
2027de796caSDennis YC Hsieh int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event);
2037de796caSDennis YC Hsieh 
2047de796caSDennis YC Hsieh /**
205b2ff2356SBibby Hsieh  * cmdq_pkt_poll() - Append polling command to the CMDQ packet, ask GCE to
206b2ff2356SBibby Hsieh  *		     execute an instruction that wait for a specified
207b2ff2356SBibby Hsieh  *		     hardware register to check for the value w/o mask.
208b2ff2356SBibby Hsieh  *		     All GCE hardware threads will be blocked by this
209b2ff2356SBibby Hsieh  *		     instruction.
210b2ff2356SBibby Hsieh  * @pkt:	the CMDQ packet
211b2ff2356SBibby Hsieh  * @subsys:	the CMDQ sub system code
212b2ff2356SBibby Hsieh  * @offset:	register offset from CMDQ sub system
213b2ff2356SBibby Hsieh  * @value:	the specified target register value
214b2ff2356SBibby Hsieh  *
215b2ff2356SBibby Hsieh  * Return: 0 for success; else the error code is returned
216b2ff2356SBibby Hsieh  */
217b2ff2356SBibby Hsieh int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys,
218b2ff2356SBibby Hsieh 		  u16 offset, u32 value);
219b2ff2356SBibby Hsieh 
220b2ff2356SBibby Hsieh /**
221b2ff2356SBibby Hsieh  * cmdq_pkt_poll_mask() - Append polling command to the CMDQ packet, ask GCE to
222b2ff2356SBibby Hsieh  *		          execute an instruction that wait for a specified
223b2ff2356SBibby Hsieh  *		          hardware register to check for the value w/ mask.
224b2ff2356SBibby Hsieh  *		          All GCE hardware threads will be blocked by this
225b2ff2356SBibby Hsieh  *		          instruction.
226b2ff2356SBibby Hsieh  * @pkt:	the CMDQ packet
227b2ff2356SBibby Hsieh  * @subsys:	the CMDQ sub system code
228b2ff2356SBibby Hsieh  * @offset:	register offset from CMDQ sub system
229b2ff2356SBibby Hsieh  * @value:	the specified target register value
230b2ff2356SBibby Hsieh  * @mask:	the specified target register mask
231b2ff2356SBibby Hsieh  *
232b2ff2356SBibby Hsieh  * Return: 0 for success; else the error code is returned
233b2ff2356SBibby Hsieh  */
234b2ff2356SBibby Hsieh int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys,
235b2ff2356SBibby Hsieh 		       u16 offset, u32 value, u32 mask);
236613c2e2cSDennis YC Hsieh 
237613c2e2cSDennis YC Hsieh /**
238613c2e2cSDennis YC Hsieh  * cmdq_pkt_assign() - Append logic assign command to the CMDQ packet, ask GCE
239613c2e2cSDennis YC Hsieh  *		       to execute an instruction that set a constant value into
240613c2e2cSDennis YC Hsieh  *		       internal register and use as value, mask or address in
241613c2e2cSDennis YC Hsieh  *		       read/write instruction.
242613c2e2cSDennis YC Hsieh  * @pkt:	the CMDQ packet
243613c2e2cSDennis YC Hsieh  * @reg_idx:	the CMDQ internal register ID
244613c2e2cSDennis YC Hsieh  * @value:	the specified value
245613c2e2cSDennis YC Hsieh  *
246613c2e2cSDennis YC Hsieh  * Return: 0 for success; else the error code is returned
247613c2e2cSDennis YC Hsieh  */
248613c2e2cSDennis YC Hsieh int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value);
249613c2e2cSDennis YC Hsieh 
250b2ff2356SBibby Hsieh /**
251946f1792SDennis YC Hsieh  * cmdq_pkt_jump() - Append jump command to the CMDQ packet, ask GCE
252946f1792SDennis YC Hsieh  *		     to execute an instruction that change current thread PC to
253946f1792SDennis YC Hsieh  *		     a physical address which should contains more instruction.
254946f1792SDennis YC Hsieh  * @pkt:        the CMDQ packet
255946f1792SDennis YC Hsieh  * @addr:       physical address of target instruction buffer
256946f1792SDennis YC Hsieh  *
257946f1792SDennis YC Hsieh  * Return: 0 for success; else the error code is returned
258946f1792SDennis YC Hsieh  */
259946f1792SDennis YC Hsieh int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr);
260946f1792SDennis YC Hsieh 
261946f1792SDennis YC Hsieh /**
26299581858SDennis YC Hsieh  * cmdq_pkt_finalize() - Append EOC and jump command to pkt.
26399581858SDennis YC Hsieh  * @pkt:	the CMDQ packet
26499581858SDennis YC Hsieh  *
26599581858SDennis YC Hsieh  * Return: 0 for success; else the error code is returned
26699581858SDennis YC Hsieh  */
26799581858SDennis YC Hsieh int cmdq_pkt_finalize(struct cmdq_pkt *pkt);
26899581858SDennis YC Hsieh 
26999581858SDennis YC Hsieh /**
270576f1b4bSHoulong Wei  * cmdq_pkt_flush_async() - trigger CMDQ to asynchronously execute the CMDQ
271576f1b4bSHoulong Wei  *                          packet and call back at the end of done packet
272576f1b4bSHoulong Wei  * @pkt:	the CMDQ packet
273576f1b4bSHoulong Wei  *
274576f1b4bSHoulong Wei  * Return: 0 for success; else the error code is returned
275576f1b4bSHoulong Wei  *
276576f1b4bSHoulong Wei  * Trigger CMDQ to asynchronously execute the CMDQ packet and call back
277576f1b4bSHoulong Wei  * at the end of done packet. Note that this is an ASYNC function. When the
278576f1b4bSHoulong Wei  * function returned, it may or may not be finished.
279576f1b4bSHoulong Wei  */
2805252c1c5SChun-Kuang Hu int cmdq_pkt_flush_async(struct cmdq_pkt *pkt);
281576f1b4bSHoulong Wei 
282*eb0d8623SAngeloGioacchino Del Regno #else /* IS_ENABLED(CONFIG_MTK_CMDQ) */
283*eb0d8623SAngeloGioacchino Del Regno 
cmdq_dev_get_client_reg(struct device * dev,struct cmdq_client_reg * client_reg,int idx)284*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_dev_get_client_reg(struct device *dev,
285*eb0d8623SAngeloGioacchino Del Regno 					  struct cmdq_client_reg *client_reg, int idx)
286*eb0d8623SAngeloGioacchino Del Regno {
287*eb0d8623SAngeloGioacchino Del Regno 	return -ENODEV;
288*eb0d8623SAngeloGioacchino Del Regno }
289*eb0d8623SAngeloGioacchino Del Regno 
cmdq_mbox_create(struct device * dev,int index)290*eb0d8623SAngeloGioacchino Del Regno static inline struct cmdq_client *cmdq_mbox_create(struct device *dev, int index)
291*eb0d8623SAngeloGioacchino Del Regno {
292*eb0d8623SAngeloGioacchino Del Regno 	return ERR_PTR(-EINVAL);
293*eb0d8623SAngeloGioacchino Del Regno }
294*eb0d8623SAngeloGioacchino Del Regno 
cmdq_mbox_destroy(struct cmdq_client * client)295*eb0d8623SAngeloGioacchino Del Regno static inline void cmdq_mbox_destroy(struct cmdq_client *client) { }
296*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_create(struct cmdq_client * client,size_t size)297*eb0d8623SAngeloGioacchino Del Regno static inline  struct cmdq_pkt *cmdq_pkt_create(struct cmdq_client *client, size_t size)
298*eb0d8623SAngeloGioacchino Del Regno {
299*eb0d8623SAngeloGioacchino Del Regno 	return ERR_PTR(-EINVAL);
300*eb0d8623SAngeloGioacchino Del Regno }
301*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_destroy(struct cmdq_pkt * pkt)302*eb0d8623SAngeloGioacchino Del Regno static inline void cmdq_pkt_destroy(struct cmdq_pkt *pkt) { }
303*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_write(struct cmdq_pkt * pkt,u8 subsys,u16 offset,u32 value)304*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value)
305*eb0d8623SAngeloGioacchino Del Regno {
306*eb0d8623SAngeloGioacchino Del Regno 	return -ENOENT;
307*eb0d8623SAngeloGioacchino Del Regno }
308*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_write_mask(struct cmdq_pkt * pkt,u8 subsys,u16 offset,u32 value,u32 mask)309*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys,
310*eb0d8623SAngeloGioacchino Del Regno 				      u16 offset, u32 value, u32 mask)
311*eb0d8623SAngeloGioacchino Del Regno {
312*eb0d8623SAngeloGioacchino Del Regno 	return -ENOENT;
313*eb0d8623SAngeloGioacchino Del Regno }
314*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_read_s(struct cmdq_pkt * pkt,u16 high_addr_reg_idx,u16 addr_low,u16 reg_idx)315*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
316*eb0d8623SAngeloGioacchino Del Regno 				  u16 addr_low, u16 reg_idx)
317*eb0d8623SAngeloGioacchino Del Regno {
318*eb0d8623SAngeloGioacchino Del Regno 	return -ENOENT;
319*eb0d8623SAngeloGioacchino Del Regno }
320*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_write_s(struct cmdq_pkt * pkt,u16 high_addr_reg_idx,u16 addr_low,u16 src_reg_idx)321*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
322*eb0d8623SAngeloGioacchino Del Regno 				   u16 addr_low, u16 src_reg_idx)
323*eb0d8623SAngeloGioacchino Del Regno {
324*eb0d8623SAngeloGioacchino Del Regno 	return -ENOENT;
325*eb0d8623SAngeloGioacchino Del Regno }
326*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_write_s_mask(struct cmdq_pkt * pkt,u16 high_addr_reg_idx,u16 addr_low,u16 src_reg_idx,u32 mask)327*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
328*eb0d8623SAngeloGioacchino Del Regno 					u16 addr_low, u16 src_reg_idx, u32 mask)
329*eb0d8623SAngeloGioacchino Del Regno {
330*eb0d8623SAngeloGioacchino Del Regno 	return -ENOENT;
331*eb0d8623SAngeloGioacchino Del Regno }
332*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_write_s_value(struct cmdq_pkt * pkt,u8 high_addr_reg_idx,u16 addr_low,u32 value)333*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
334*eb0d8623SAngeloGioacchino Del Regno 					 u16 addr_low, u32 value)
335*eb0d8623SAngeloGioacchino Del Regno {
336*eb0d8623SAngeloGioacchino Del Regno 	return -ENOENT;
337*eb0d8623SAngeloGioacchino Del Regno }
338*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_write_s_mask_value(struct cmdq_pkt * pkt,u8 high_addr_reg_idx,u16 addr_low,u32 value,u32 mask)339*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
340*eb0d8623SAngeloGioacchino Del Regno 					      u16 addr_low, u32 value, u32 mask)
341*eb0d8623SAngeloGioacchino Del Regno {
342*eb0d8623SAngeloGioacchino Del Regno 	return -ENOENT;
343*eb0d8623SAngeloGioacchino Del Regno }
344*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_wfe(struct cmdq_pkt * pkt,u16 event,bool clear)345*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear)
346*eb0d8623SAngeloGioacchino Del Regno {
347*eb0d8623SAngeloGioacchino Del Regno 	return -EINVAL;
348*eb0d8623SAngeloGioacchino Del Regno }
349*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_clear_event(struct cmdq_pkt * pkt,u16 event)350*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event)
351*eb0d8623SAngeloGioacchino Del Regno {
352*eb0d8623SAngeloGioacchino Del Regno 	return -EINVAL;
353*eb0d8623SAngeloGioacchino Del Regno }
354*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_set_event(struct cmdq_pkt * pkt,u16 event)355*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event)
356*eb0d8623SAngeloGioacchino Del Regno {
357*eb0d8623SAngeloGioacchino Del Regno 	return -EINVAL;
358*eb0d8623SAngeloGioacchino Del Regno }
359*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_poll(struct cmdq_pkt * pkt,u8 subsys,u16 offset,u32 value)360*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys,
361*eb0d8623SAngeloGioacchino Del Regno 				u16 offset, u32 value)
362*eb0d8623SAngeloGioacchino Del Regno {
363*eb0d8623SAngeloGioacchino Del Regno 	return -EINVAL;
364*eb0d8623SAngeloGioacchino Del Regno }
365*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_poll_mask(struct cmdq_pkt * pkt,u8 subsys,u16 offset,u32 value,u32 mask)366*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys,
367*eb0d8623SAngeloGioacchino Del Regno 				     u16 offset, u32 value, u32 mask)
368*eb0d8623SAngeloGioacchino Del Regno {
369*eb0d8623SAngeloGioacchino Del Regno 	return -EINVAL;
370*eb0d8623SAngeloGioacchino Del Regno }
371*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_assign(struct cmdq_pkt * pkt,u16 reg_idx,u32 value)372*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value)
373*eb0d8623SAngeloGioacchino Del Regno {
374*eb0d8623SAngeloGioacchino Del Regno 	return -EINVAL;
375*eb0d8623SAngeloGioacchino Del Regno }
376*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_jump(struct cmdq_pkt * pkt,dma_addr_t addr)377*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr)
378*eb0d8623SAngeloGioacchino Del Regno {
379*eb0d8623SAngeloGioacchino Del Regno 	return -EINVAL;
380*eb0d8623SAngeloGioacchino Del Regno }
381*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_finalize(struct cmdq_pkt * pkt)382*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
383*eb0d8623SAngeloGioacchino Del Regno {
384*eb0d8623SAngeloGioacchino Del Regno 	return -EINVAL;
385*eb0d8623SAngeloGioacchino Del Regno }
386*eb0d8623SAngeloGioacchino Del Regno 
cmdq_pkt_flush_async(struct cmdq_pkt * pkt)387*eb0d8623SAngeloGioacchino Del Regno static inline int cmdq_pkt_flush_async(struct cmdq_pkt *pkt)
388*eb0d8623SAngeloGioacchino Del Regno {
389*eb0d8623SAngeloGioacchino Del Regno 	return -EINVAL;
390*eb0d8623SAngeloGioacchino Del Regno }
391*eb0d8623SAngeloGioacchino Del Regno 
392*eb0d8623SAngeloGioacchino Del Regno #endif /* IS_ENABLED(CONFIG_MTK_CMDQ) */
393*eb0d8623SAngeloGioacchino Del Regno 
394576f1b4bSHoulong Wei #endif	/* __MTK_CMDQ_H__ */
395