linux/drivers/dma/sh/usb-dmac.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Renesas USB DMA Controller Driver
 *
 * Copyright (C) 2015 Renesas Electronics Corporation
 *
 * based on rcar-dmac.c
 * Copyright (C) 2014 Renesas Electronics Inc.
 * Author: Laurent Pinchart <[email protected]>
 */

#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_dma.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/spinlock.h>

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

/*
 * struct usb_dmac_sg - Descriptor for a hardware transfer
 * @mem_addr: memory address
 * @size: transfer size in bytes
 */
struct usb_dmac_sg {};

/*
 * struct usb_dmac_desc - USB DMA Transfer Descriptor
 * @vd: base virtual channel DMA transaction descriptor
 * @direction: direction of the DMA transfer
 * @sg_allocated_len: length of allocated sg
 * @sg_len: length of sg
 * @sg_index: index of sg
 * @residue: residue after the DMAC completed a transfer
 * @node: node for desc_got and desc_freed
 * @done_cookie: cookie after the DMAC completed a transfer
 * @sg: information for the transfer
 */
struct usb_dmac_desc {};

#define to_usb_dmac_desc(vd)

/*
 * struct usb_dmac_chan - USB DMA Controller Channel
 * @vc: base virtual DMA channel object
 * @iomem: channel I/O memory base
 * @index: index of this channel in the controller
 * @irq: irq number of this channel
 * @desc: the current descriptor
 * @descs_allocated: number of descriptors allocated
 * @desc_got: got descriptors
 * @desc_freed: freed descriptors after the DMAC completed a transfer
 */
struct usb_dmac_chan {};

#define to_usb_dmac_chan(c)

/*
 * struct usb_dmac - USB DMA Controller
 * @engine: base DMA engine object
 * @dev: the hardware device
 * @iomem: remapped I/O memory base
 * @n_channels: number of available channels
 * @channels: array of DMAC channels
 */
struct usb_dmac {};

#define to_usb_dmac(d)

/* -----------------------------------------------------------------------------
 * Registers
 */

#define USB_DMAC_CHAN_OFFSET(i)

#define USB_DMASWR
#define USB_DMASWR_SWR
#define USB_DMAOR
#define USB_DMAOR_AE
#define USB_DMAOR_DME

#define USB_DMASAR
#define USB_DMADAR
#define USB_DMATCR
#define USB_DMATCR_MASK
#define USB_DMACHCR
#define USB_DMACHCR_FTE
#define USB_DMACHCR_NULLE
#define USB_DMACHCR_NULL
#define USB_DMACHCR_TS_8B
#define USB_DMACHCR_TS_16B
#define USB_DMACHCR_TS_32B
#define USB_DMACHCR_IE
#define USB_DMACHCR_SP
#define USB_DMACHCR_TE
#define USB_DMACHCR_DE
#define USB_DMATEND

/* Hardcode the xfer_shift to 5 (32bytes) */
#define USB_DMAC_XFER_SHIFT
#define USB_DMAC_XFER_SIZE
#define USB_DMAC_CHCR_TS
#define USB_DMAC_SLAVE_BUSWIDTH

/* for descriptors */
#define USB_DMAC_INITIAL_NR_DESC
#define USB_DMAC_INITIAL_NR_SG

/* -----------------------------------------------------------------------------
 * Device access
 */

static void usb_dmac_write(struct usb_dmac *dmac, u32 reg, u32 data)
{}

static u32 usb_dmac_read(struct usb_dmac *dmac, u32 reg)
{}

static u32 usb_dmac_chan_read(struct usb_dmac_chan *chan, u32 reg)
{}

static void usb_dmac_chan_write(struct usb_dmac_chan *chan, u32 reg, u32 data)
{}

/* -----------------------------------------------------------------------------
 * Initialization and configuration
 */

static bool usb_dmac_chan_is_busy(struct usb_dmac_chan *chan)
{}

static u32 usb_dmac_calc_tend(u32 size)
{}

/* This function is already held by vc.lock */
static void usb_dmac_chan_start_sg(struct usb_dmac_chan *chan,
				   unsigned int index)
{}

/* This function is already held by vc.lock */
static void usb_dmac_chan_start_desc(struct usb_dmac_chan *chan)
{}

static int usb_dmac_init(struct usb_dmac *dmac)
{}

/* -----------------------------------------------------------------------------
 * Descriptors allocation and free
 */
static int usb_dmac_desc_alloc(struct usb_dmac_chan *chan, unsigned int sg_len,
			       gfp_t gfp)
{}

static void usb_dmac_desc_free(struct usb_dmac_chan *chan)
{}

static struct usb_dmac_desc *usb_dmac_desc_get(struct usb_dmac_chan *chan,
					       unsigned int sg_len, gfp_t gfp)
{}

static void usb_dmac_desc_put(struct usb_dmac_chan *chan,
			      struct usb_dmac_desc *desc)
{}

/* -----------------------------------------------------------------------------
 * Stop and reset
 */

static void usb_dmac_soft_reset(struct usb_dmac_chan *uchan)
{}

static void usb_dmac_chan_halt(struct usb_dmac_chan *chan)
{}

static void usb_dmac_stop(struct usb_dmac *dmac)
{}

/* -----------------------------------------------------------------------------
 * DMA engine operations
 */

static int usb_dmac_alloc_chan_resources(struct dma_chan *chan)
{}

static void usb_dmac_free_chan_resources(struct dma_chan *chan)
{}

static struct dma_async_tx_descriptor *
usb_dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
		       unsigned int sg_len, enum dma_transfer_direction dir,
		       unsigned long dma_flags, void *context)
{}

static int usb_dmac_chan_terminate_all(struct dma_chan *chan)
{}

static unsigned int usb_dmac_get_current_residue(struct usb_dmac_chan *chan,
						 struct usb_dmac_desc *desc,
						 unsigned int sg_index)
{}

static u32 usb_dmac_chan_get_residue_if_complete(struct usb_dmac_chan *chan,
						 dma_cookie_t cookie)
{}

static u32 usb_dmac_chan_get_residue(struct usb_dmac_chan *chan,
				     dma_cookie_t cookie)
{}

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

static void usb_dmac_issue_pending(struct dma_chan *chan)
{}

static void usb_dmac_virt_desc_free(struct virt_dma_desc *vd)
{}

/* -----------------------------------------------------------------------------
 * IRQ handling
 */

static void usb_dmac_isr_transfer_end(struct usb_dmac_chan *chan)
{}

static irqreturn_t usb_dmac_isr_channel(int irq, void *dev)
{}

/* -----------------------------------------------------------------------------
 * OF xlate and channel filter
 */

static bool usb_dmac_chan_filter(struct dma_chan *chan, void *arg)
{}

static struct dma_chan *usb_dmac_of_xlate(struct of_phandle_args *dma_spec,
					  struct of_dma *ofdma)
{}

/* -----------------------------------------------------------------------------
 * Power management
 */

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

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

static const struct dev_pm_ops usb_dmac_pm =;

/* -----------------------------------------------------------------------------
 * Probe and remove
 */

static int usb_dmac_chan_probe(struct usb_dmac *dmac,
			       struct usb_dmac_chan *uchan,
			       u8 index)
{}

static int usb_dmac_parse_of(struct device *dev, struct usb_dmac *dmac)
{}

static int usb_dmac_probe(struct platform_device *pdev)
{}

static void usb_dmac_chan_remove(struct usb_dmac *dmac,
				 struct usb_dmac_chan *uchan)
{}

static void usb_dmac_remove(struct platform_device *pdev)
{}

static void usb_dmac_shutdown(struct platform_device *pdev)
{}

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

static struct platform_driver usb_dmac_driver =;

module_platform_driver();

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