linux/drivers/dma/mediatek/mtk-uart-apdma.c

// SPDX-License-Identifier: GPL-2.0
/*
 * MediaTek UART APDMA driver.
 *
 * Copyright (c) 2019 MediaTek Inc.
 * Author: Long Cheng <[email protected]>
 */

#include <linux/clk.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/of_dma.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/spinlock.h>

#include "../virt-dma.h"

/* The default number of virtual channel */
#define MTK_UART_APDMA_NR_VCHANS

#define VFF_EN_B
#define VFF_STOP_B
#define VFF_FLUSH_B
#define VFF_4G_EN_B
/* rx valid size >=  vff thre */
#define VFF_RX_INT_EN_B
/* tx left size >= vff thre */
#define VFF_TX_INT_EN_B
#define VFF_WARM_RST_B
#define VFF_RX_INT_CLR_B
#define VFF_TX_INT_CLR_B
#define VFF_STOP_CLR_B
#define VFF_EN_CLR_B
#define VFF_INT_EN_CLR_B
#define VFF_4G_SUPPORT_CLR_B

/*
 * interrupt trigger level for tx
 * if threshold is n, no polling is required to start tx.
 * otherwise need polling VFF_FLUSH.
 */
#define VFF_TX_THRE(n)
/* interrupt trigger level for rx */
#define VFF_RX_THRE(n)

#define VFF_RING_SIZE
/* invert this bit when wrap ring head again */
#define VFF_RING_WRAP

#define VFF_INT_FLAG
#define VFF_INT_EN
#define VFF_EN
#define VFF_RST
#define VFF_STOP
#define VFF_FLUSH
#define VFF_ADDR
#define VFF_LEN
#define VFF_THRE
#define VFF_WPT
#define VFF_RPT
/* TX: the buffer size HW can read. RX: the buffer size SW can read. */
#define VFF_VALID_SIZE
/* TX: the buffer size SW can write. RX: the buffer size HW can write. */
#define VFF_LEFT_SIZE
#define VFF_DEBUG_STATUS
#define VFF_4G_SUPPORT

struct mtk_uart_apdmadev {};

struct mtk_uart_apdma_desc {};

struct mtk_chan {};

static inline struct mtk_uart_apdmadev *
to_mtk_uart_apdma_dev(struct dma_device *d)
{}

static inline struct mtk_chan *to_mtk_uart_apdma_chan(struct dma_chan *c)
{}

static inline struct mtk_uart_apdma_desc *to_mtk_uart_apdma_desc
	(struct dma_async_tx_descriptor *t)
{}

static void mtk_uart_apdma_write(struct mtk_chan *c,
			       unsigned int reg, unsigned int val)
{}

static unsigned int mtk_uart_apdma_read(struct mtk_chan *c, unsigned int reg)
{}

static void mtk_uart_apdma_desc_free(struct virt_dma_desc *vd)
{}

static void mtk_uart_apdma_start_tx(struct mtk_chan *c)
{}

static void mtk_uart_apdma_start_rx(struct mtk_chan *c)
{}

static void mtk_uart_apdma_tx_handler(struct mtk_chan *c)
{}

static void mtk_uart_apdma_rx_handler(struct mtk_chan *c)
{}

static void mtk_uart_apdma_chan_complete_handler(struct mtk_chan *c)
{}

static irqreturn_t mtk_uart_apdma_irq_handler(int irq, void *dev_id)
{}

static int mtk_uart_apdma_alloc_chan_resources(struct dma_chan *chan)
{}

static void mtk_uart_apdma_free_chan_resources(struct dma_chan *chan)
{}

static enum dma_status mtk_uart_apdma_tx_status(struct dma_chan *chan,
					 dma_cookie_t cookie,
					 struct dma_tx_state *txstate)
{}

/*
 * dmaengine_prep_slave_single will call the function. and sglen is 1.
 * 8250 uart using one ring buffer, and deal with one sg.
 */
static struct dma_async_tx_descriptor *mtk_uart_apdma_prep_slave_sg
	(struct dma_chan *chan, struct scatterlist *sgl,
	unsigned int sglen, enum dma_transfer_direction dir,
	unsigned long tx_flags, void *context)
{}

static void mtk_uart_apdma_issue_pending(struct dma_chan *chan)
{}

static int mtk_uart_apdma_slave_config(struct dma_chan *chan,
				   struct dma_slave_config *config)
{}

static int mtk_uart_apdma_terminate_all(struct dma_chan *chan)
{}

static int mtk_uart_apdma_device_pause(struct dma_chan *chan)
{}

static void mtk_uart_apdma_free(struct mtk_uart_apdmadev *mtkd)
{}

static const struct of_device_id mtk_uart_apdma_match[] =;
MODULE_DEVICE_TABLE(of, mtk_uart_apdma_match);

static int mtk_uart_apdma_probe(struct platform_device *pdev)
{}

static void mtk_uart_apdma_remove(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
static int mtk_uart_apdma_suspend(struct device *dev)
{}

static int mtk_uart_apdma_resume(struct device *dev)
{}
#endif /* CONFIG_PM_SLEEP */

#ifdef CONFIG_PM
static int mtk_uart_apdma_runtime_suspend(struct device *dev)
{}

static int mtk_uart_apdma_runtime_resume(struct device *dev)
{}
#endif /* CONFIG_PM */

static const struct dev_pm_ops mtk_uart_apdma_pm_ops =;

static struct platform_driver mtk_uart_apdma_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();