linux/drivers/dma/sf-pdma/sf-pdma.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * SiFive FU540 Platform DMA driver
 * Copyright (C) 2019 SiFive
 *
 * Based partially on:
 * - drivers/dma/fsl-edma.c
 * - drivers/dma/dw-edma/
 * - drivers/dma/pxa-dma.c
 *
 * See the following sources for further documentation:
 * - Chapter 12 "Platform DMA Engine (PDMA)" of
 *   SiFive FU540-C000 v1.0
 *   https://static.dev.sifive.com/FU540-C000-v1.0.pdf
 */
#include <linux/module.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/mod_devicetable.h>
#include <linux/dma-mapping.h>
#include <linux/of.h>
#include <linux/of_dma.h>
#include <linux/slab.h>

#include "sf-pdma.h"

#define PDMA_QUIRK_NO_STRICT_ORDERING

#ifndef readq
static inline unsigned long long readq(void __iomem *addr)
{
	return readl(addr) | (((unsigned long long)readl(addr + 4)) << 32LL);
}
#endif

#ifndef writeq
static inline void writeq(unsigned long long v, void __iomem *addr)
{
	writel(lower_32_bits(v), addr);
	writel(upper_32_bits(v), addr + 4);
}
#endif

static inline struct sf_pdma_chan *to_sf_pdma_chan(struct dma_chan *dchan)
{}

static inline struct sf_pdma_desc *to_sf_pdma_desc(struct virt_dma_desc *vd)
{}

static struct sf_pdma_desc *sf_pdma_alloc_desc(struct sf_pdma_chan *chan)
{}

static void sf_pdma_fill_desc(struct sf_pdma_desc *desc,
			      u64 dst, u64 src, u64 size)
{}

static void sf_pdma_disclaim_chan(struct sf_pdma_chan *chan)
{}

static struct dma_async_tx_descriptor *
sf_pdma_prep_dma_memcpy(struct dma_chan *dchan,	dma_addr_t dest, dma_addr_t src,
			size_t len, unsigned long flags)
{}

static int sf_pdma_slave_config(struct dma_chan *dchan,
				struct dma_slave_config *cfg)
{}

static int sf_pdma_alloc_chan_resources(struct dma_chan *dchan)
{}

static void sf_pdma_disable_request(struct sf_pdma_chan *chan)
{}

static void sf_pdma_free_chan_resources(struct dma_chan *dchan)
{}

static size_t sf_pdma_desc_residue(struct sf_pdma_chan *chan,
				   dma_cookie_t cookie)
{}

static enum dma_status
sf_pdma_tx_status(struct dma_chan *dchan,
		  dma_cookie_t cookie,
		  struct dma_tx_state *txstate)
{}

static int sf_pdma_terminate_all(struct dma_chan *dchan)
{}

static void sf_pdma_enable_request(struct sf_pdma_chan *chan)
{}

static struct sf_pdma_desc *sf_pdma_get_first_pending_desc(struct sf_pdma_chan *chan)
{}

static void sf_pdma_xfer_desc(struct sf_pdma_chan *chan)
{}

static void sf_pdma_issue_pending(struct dma_chan *dchan)
{}

static void sf_pdma_free_desc(struct virt_dma_desc *vdesc)
{}

static void sf_pdma_donebh_tasklet(struct tasklet_struct *t)
{}

static void sf_pdma_errbh_tasklet(struct tasklet_struct *t)
{}

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

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

/**
 * sf_pdma_irq_init() - Init PDMA IRQ Handlers
 * @pdev: pointer of platform_device
 * @pdma: pointer of PDMA engine. Caller should check NULL
 *
 * Initialize DONE and ERROR interrupt handler for 4 channels. Caller should
 * make sure the pointer passed in are non-NULL. This function should be called
 * only one time during the device probe.
 *
 * Context: Any context.
 *
 * Return:
 * * 0		- OK to init all IRQ handlers
 * * -EINVAL	- Fail to request IRQ
 */
static int sf_pdma_irq_init(struct platform_device *pdev, struct sf_pdma *pdma)
{}

/**
 * sf_pdma_setup_chans() - Init settings of each channel
 * @pdma: pointer of PDMA engine. Caller should check NULL
 *
 * Initialize all data structure and register base. Caller should make sure
 * the pointer passed in are non-NULL. This function should be called only
 * one time during the device probe.
 *
 * Context: Any context.
 *
 * Return: none
 */
static void sf_pdma_setup_chans(struct sf_pdma *pdma)
{}

static int sf_pdma_probe(struct platform_device *pdev)
{}

static void sf_pdma_remove(struct platform_device *pdev)
{}

static const struct sf_pdma_driver_platdata mpfs_pdma =;

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

static struct platform_driver sf_pdma_driver =;

static int __init sf_pdma_init(void)
{}

static void __exit sf_pdma_exit(void)
{}

/* do early init */
subsys_initcall(sf_pdma_init);
module_exit(sf_pdma_exit);

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