xref: /freebsd/sys/arm/ti/ti_edma3.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1e53470feSOleksandr Tymoshenko /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3af3dc4a7SPedro F. Giffuni  *
4e53470feSOleksandr Tymoshenko  * Copyright (c) 2012 Damjan Marion <dmarion@Freebsd.org>
5e53470feSOleksandr Tymoshenko  * All rights reserved.
6e53470feSOleksandr Tymoshenko  *
7e53470feSOleksandr Tymoshenko  * Redistribution and use in source and binary forms, with or without
8e53470feSOleksandr Tymoshenko  * modification, are permitted provided that the following conditions
9e53470feSOleksandr Tymoshenko  * are met:
10e53470feSOleksandr Tymoshenko  * 1. Redistributions of source code must retain the above copyright
11e53470feSOleksandr Tymoshenko  *    notice, this list of conditions and the following disclaimer.
12e53470feSOleksandr Tymoshenko  * 2. Redistributions in binary form must reproduce the above copyright
13e53470feSOleksandr Tymoshenko  *    notice, this list of conditions and the following disclaimer in the
14e53470feSOleksandr Tymoshenko  *    documentation and/or other materials provided with the distribution.
15e53470feSOleksandr Tymoshenko  *
16e53470feSOleksandr Tymoshenko  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17e53470feSOleksandr Tymoshenko  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18e53470feSOleksandr Tymoshenko  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19e53470feSOleksandr Tymoshenko  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20e53470feSOleksandr Tymoshenko  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21e53470feSOleksandr Tymoshenko  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22e53470feSOleksandr Tymoshenko  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23e53470feSOleksandr Tymoshenko  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24e53470feSOleksandr Tymoshenko  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25e53470feSOleksandr Tymoshenko  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26e53470feSOleksandr Tymoshenko  * SUCH DAMAGE.
27e53470feSOleksandr Tymoshenko  */
28e53470feSOleksandr Tymoshenko 
29e53470feSOleksandr Tymoshenko #ifndef _TI_EDMA3_H_
30e53470feSOleksandr Tymoshenko #define _TI_EDMA3_H_
31e53470feSOleksandr Tymoshenko 
32e53470feSOleksandr Tymoshenko /* Direct Mapped EDMA3 Events */
33e53470feSOleksandr Tymoshenko #define TI_EDMA3_EVENT_SDTXEVT1			2
34e53470feSOleksandr Tymoshenko #define TI_EDMA3_EVENT_SDRXEVT1			3
35e53470feSOleksandr Tymoshenko #define TI_EDMA3_EVENT_SDTXEVT0			24
36e53470feSOleksandr Tymoshenko #define TI_EDMA3_EVENT_SDRXEVT0			25
37e53470feSOleksandr Tymoshenko 
38e53470feSOleksandr Tymoshenko struct ti_edma3cc_param_set {
39e53470feSOleksandr Tymoshenko 	struct {
40e53470feSOleksandr Tymoshenko 		uint32_t sam:1;		/* Source address mode */
41e53470feSOleksandr Tymoshenko 		uint32_t dam:1;		/* Destination address mode */
42e53470feSOleksandr Tymoshenko 		uint32_t syncdim:1;	/* Transfer synchronization dimension */
43e53470feSOleksandr Tymoshenko 		uint32_t static_set:1;	/* Static Set */
44e53470feSOleksandr Tymoshenko 		uint32_t :4;
45e53470feSOleksandr Tymoshenko 		uint32_t fwid:3;	/* FIFO Width */
46e53470feSOleksandr Tymoshenko 		uint32_t tccmode:1;	/* Transfer complete code mode */
47e53470feSOleksandr Tymoshenko 		uint32_t tcc:6;		/* Transfer complete code */
48e53470feSOleksandr Tymoshenko 		uint32_t :2;
49e53470feSOleksandr Tymoshenko 		uint32_t tcinten:1;	/* Transfer complete interrupt enable */
50e53470feSOleksandr Tymoshenko 		uint32_t itcinten:1;	/* Intermediate xfer completion intr. ena */
51e53470feSOleksandr Tymoshenko 		uint32_t tcchen:1;	/* Transfer complete chaining enable */
52e53470feSOleksandr Tymoshenko 		uint32_t itcchen:1;	/* Intermediate xfer completion chaining ena */
53e53470feSOleksandr Tymoshenko 		uint32_t privid:4;	/* Privilege identification */
54e53470feSOleksandr Tymoshenko 		uint32_t :3;
55e53470feSOleksandr Tymoshenko 		uint32_t priv:1;	/* Privilege level */
56e53470feSOleksandr Tymoshenko 	} opt;
57e53470feSOleksandr Tymoshenko 	uint32_t src;			/* Channel Source Address */
58e53470feSOleksandr Tymoshenko 	uint16_t acnt;			/* Count for 1st Dimension */
59e53470feSOleksandr Tymoshenko 	uint16_t bcnt;			/* Count for 2nd Dimension */
60e53470feSOleksandr Tymoshenko 	uint32_t dst;			/* Channel Destination Address */
61e53470feSOleksandr Tymoshenko 	int16_t srcbidx;		/* Source B Index */
62e53470feSOleksandr Tymoshenko 	int16_t dstbidx;		/* Destination B Index */
63e53470feSOleksandr Tymoshenko 	uint16_t link;			/* Link Address */
64e53470feSOleksandr Tymoshenko 	uint16_t bcntrld;		/* BCNT Reload */
65e53470feSOleksandr Tymoshenko 	int16_t srccidx;		/* Source C Index */
66e53470feSOleksandr Tymoshenko 	int16_t dstcidx;		/* Destination C Index */
67e53470feSOleksandr Tymoshenko 	uint16_t ccnt;			/* Count for 3rd Dimension */
68e53470feSOleksandr Tymoshenko 	uint16_t reserved;		/* Reserved */
69e53470feSOleksandr Tymoshenko };
70e53470feSOleksandr Tymoshenko 
71e53470feSOleksandr Tymoshenko void ti_edma3_init(unsigned int eqn);
72e53470feSOleksandr Tymoshenko int ti_edma3_request_dma_ch(unsigned int ch, unsigned int tccn, unsigned int eqn);
73e53470feSOleksandr Tymoshenko int ti_edma3_request_qdma_ch(unsigned int ch, unsigned int tccn, unsigned int eqn);
74e53470feSOleksandr Tymoshenko int ti_edma3_enable_transfer_manual(unsigned int ch);
75e53470feSOleksandr Tymoshenko int ti_edma3_enable_transfer_qdma(unsigned int ch);
76e53470feSOleksandr Tymoshenko int ti_edma3_enable_transfer_event(unsigned int ch);
77e53470feSOleksandr Tymoshenko 
78e53470feSOleksandr Tymoshenko void ti_edma3_param_write(unsigned int ch, struct ti_edma3cc_param_set *prs);
79e53470feSOleksandr Tymoshenko void ti_edma3_param_read(unsigned int ch, struct ti_edma3cc_param_set *prs);
80e53470feSOleksandr Tymoshenko 
81e53470feSOleksandr Tymoshenko #endif /* _TI_EDMA3_H_ */
82