1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Omnitek Scatter-Gather DMA Controller
4  *
5  *  Copyright 2012-2015 Cisco Systems, Inc. and/or its affiliates.
6  *  All rights reserved.
7  */
8 
9 #ifndef COBALT_OMNITEK_H
10 #define COBALT_OMNITEK_H
11 
12 #include <linux/scatterlist.h>
13 #include "cobalt-driver.h"
14 
15 struct sg_dma_descriptor {
16 	u32 pci_l;
17 	u32 pci_h;
18 
19 	u32 local;
20 	u32 reserved0;
21 
22 	u32 next_l;
23 	u32 next_h;
24 
25 	u32 bytes;
26 	u32 reserved1;
27 };
28 
29 int omni_sg_dma_init(struct cobalt *cobalt);
30 void omni_sg_dma_abort_channel(struct cobalt_stream *s);
31 void omni_sg_dma_start(struct cobalt_stream *s, struct sg_dma_desc_info *desc);
32 bool is_dma_done(struct cobalt_stream *s);
33 
34 int descriptor_list_create(struct cobalt *cobalt,
35 	struct scatterlist *scatter_list, bool to_pci, unsigned sglen,
36 	unsigned size, unsigned width, unsigned stride,
37 	struct sg_dma_desc_info *desc);
38 
39 void descriptor_list_chain(struct sg_dma_desc_info *this,
40 			   struct sg_dma_desc_info *next);
41 void descriptor_list_loopback(struct sg_dma_desc_info *desc);
42 void descriptor_list_end_of_chain(struct sg_dma_desc_info *desc);
43 
44 void *descriptor_list_allocate(struct sg_dma_desc_info *desc, size_t bytes);
45 void descriptor_list_free(struct sg_dma_desc_info *desc);
46 
47 void descriptor_list_interrupt_enable(struct sg_dma_desc_info *desc);
48 void descriptor_list_interrupt_disable(struct sg_dma_desc_info *desc);
49 
50 #endif
51