xref: /linux/drivers/media/pci/cobalt/cobalt-omnitek.h (revision c13aca79ff3c4af5fd31a5b2743a90eba6e36a26)
1*6884db3cSHans Verkuil /* SPDX-License-Identifier: GPL-2.0-only */
285756a06SHans Verkuil /*
385756a06SHans Verkuil  *  Omnitek Scatter-Gather DMA Controller
485756a06SHans Verkuil  *
585756a06SHans Verkuil  *  Copyright 2012-2015 Cisco Systems, Inc. and/or its affiliates.
685756a06SHans Verkuil  *  All rights reserved.
785756a06SHans Verkuil  */
885756a06SHans Verkuil 
985756a06SHans Verkuil #ifndef COBALT_OMNITEK_H
1085756a06SHans Verkuil #define COBALT_OMNITEK_H
1185756a06SHans Verkuil 
1285756a06SHans Verkuil #include <linux/scatterlist.h>
1385756a06SHans Verkuil #include "cobalt-driver.h"
1485756a06SHans Verkuil 
1585756a06SHans Verkuil struct sg_dma_descriptor {
1685756a06SHans Verkuil 	u32 pci_l;
1785756a06SHans Verkuil 	u32 pci_h;
1885756a06SHans Verkuil 
1985756a06SHans Verkuil 	u32 local;
2085756a06SHans Verkuil 	u32 reserved0;
2185756a06SHans Verkuil 
2285756a06SHans Verkuil 	u32 next_l;
2385756a06SHans Verkuil 	u32 next_h;
2485756a06SHans Verkuil 
2585756a06SHans Verkuil 	u32 bytes;
2685756a06SHans Verkuil 	u32 reserved1;
2785756a06SHans Verkuil };
2885756a06SHans Verkuil 
2985756a06SHans Verkuil int omni_sg_dma_init(struct cobalt *cobalt);
3085756a06SHans Verkuil void omni_sg_dma_abort_channel(struct cobalt_stream *s);
3185756a06SHans Verkuil void omni_sg_dma_start(struct cobalt_stream *s, struct sg_dma_desc_info *desc);
3285756a06SHans Verkuil bool is_dma_done(struct cobalt_stream *s);
3385756a06SHans Verkuil 
3485756a06SHans Verkuil int descriptor_list_create(struct cobalt *cobalt,
3585756a06SHans Verkuil 	struct scatterlist *scatter_list, bool to_pci, unsigned sglen,
3685756a06SHans Verkuil 	unsigned size, unsigned width, unsigned stride,
3785756a06SHans Verkuil 	struct sg_dma_desc_info *desc);
3885756a06SHans Verkuil 
3985756a06SHans Verkuil void descriptor_list_chain(struct sg_dma_desc_info *this,
4085756a06SHans Verkuil 			   struct sg_dma_desc_info *next);
4185756a06SHans Verkuil void descriptor_list_loopback(struct sg_dma_desc_info *desc);
4285756a06SHans Verkuil void descriptor_list_end_of_chain(struct sg_dma_desc_info *desc);
4385756a06SHans Verkuil 
4485756a06SHans Verkuil void *descriptor_list_allocate(struct sg_dma_desc_info *desc, size_t bytes);
4585756a06SHans Verkuil void descriptor_list_free(struct sg_dma_desc_info *desc);
4685756a06SHans Verkuil 
4785756a06SHans Verkuil void descriptor_list_interrupt_enable(struct sg_dma_desc_info *desc);
4885756a06SHans Verkuil void descriptor_list_interrupt_disable(struct sg_dma_desc_info *desc);
4985756a06SHans Verkuil 
5085756a06SHans Verkuil #endif
51