162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Driver for the Synopsys DesignWare DMA Controller
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2007 Atmel Corporation
662306a36Sopenharmony_ci * Copyright (C) 2010-2011 ST Microelectronics
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#ifndef _PLATFORM_DATA_DMA_DW_H
962306a36Sopenharmony_ci#define _PLATFORM_DATA_DMA_DW_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/bits.h>
1262306a36Sopenharmony_ci#include <linux/types.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define DW_DMA_MAX_NR_MASTERS	4
1562306a36Sopenharmony_ci#define DW_DMA_MAX_NR_CHANNELS	8
1662306a36Sopenharmony_ci#define DW_DMA_MIN_BURST	1
1762306a36Sopenharmony_ci#define DW_DMA_MAX_BURST	256
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_cistruct device;
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/**
2262306a36Sopenharmony_ci * struct dw_dma_slave - Controller-specific information about a slave
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci * @dma_dev:	required DMA master device
2562306a36Sopenharmony_ci * @src_id:	src request line
2662306a36Sopenharmony_ci * @dst_id:	dst request line
2762306a36Sopenharmony_ci * @m_master:	memory master for transfers on allocated channel
2862306a36Sopenharmony_ci * @p_master:	peripheral master for transfers on allocated channel
2962306a36Sopenharmony_ci * @channels:	mask of the channels permitted for allocation (zero value means any)
3062306a36Sopenharmony_ci * @hs_polarity:set active low polarity of handshake interface
3162306a36Sopenharmony_ci */
3262306a36Sopenharmony_cistruct dw_dma_slave {
3362306a36Sopenharmony_ci	struct device		*dma_dev;
3462306a36Sopenharmony_ci	u8			src_id;
3562306a36Sopenharmony_ci	u8			dst_id;
3662306a36Sopenharmony_ci	u8			m_master;
3762306a36Sopenharmony_ci	u8			p_master;
3862306a36Sopenharmony_ci	u8			channels;
3962306a36Sopenharmony_ci	bool			hs_polarity;
4062306a36Sopenharmony_ci};
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci/**
4362306a36Sopenharmony_ci * struct dw_dma_platform_data - Controller configuration parameters
4462306a36Sopenharmony_ci * @nr_masters: Number of AHB masters supported by the controller
4562306a36Sopenharmony_ci * @nr_channels: Number of channels supported by hardware (max 8)
4662306a36Sopenharmony_ci * @chan_allocation_order: Allocate channels starting from 0 or 7
4762306a36Sopenharmony_ci * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0.
4862306a36Sopenharmony_ci * @block_size: Maximum block size supported by the controller
4962306a36Sopenharmony_ci * @data_width: Maximum data width supported by hardware per AHB master
5062306a36Sopenharmony_ci *		(in bytes, power of 2)
5162306a36Sopenharmony_ci * @multi_block: Multi block transfers supported by hardware per channel.
5262306a36Sopenharmony_ci * @max_burst: Maximum value of burst transaction size supported by hardware
5362306a36Sopenharmony_ci *	       per channel (in units of CTL.SRC_TR_WIDTH/CTL.DST_TR_WIDTH).
5462306a36Sopenharmony_ci * @protctl: Protection control signals setting per channel.
5562306a36Sopenharmony_ci * @quirks: Optional platform quirks.
5662306a36Sopenharmony_ci */
5762306a36Sopenharmony_cistruct dw_dma_platform_data {
5862306a36Sopenharmony_ci	u32		nr_masters;
5962306a36Sopenharmony_ci	u32		nr_channels;
6062306a36Sopenharmony_ci#define CHAN_ALLOCATION_ASCENDING	0	/* zero to seven */
6162306a36Sopenharmony_ci#define CHAN_ALLOCATION_DESCENDING	1	/* seven to zero */
6262306a36Sopenharmony_ci	u32		chan_allocation_order;
6362306a36Sopenharmony_ci#define CHAN_PRIORITY_ASCENDING		0	/* chan0 highest */
6462306a36Sopenharmony_ci#define CHAN_PRIORITY_DESCENDING	1	/* chan7 highest */
6562306a36Sopenharmony_ci	u32		chan_priority;
6662306a36Sopenharmony_ci	u32		block_size;
6762306a36Sopenharmony_ci	u32		data_width[DW_DMA_MAX_NR_MASTERS];
6862306a36Sopenharmony_ci	u32		multi_block[DW_DMA_MAX_NR_CHANNELS];
6962306a36Sopenharmony_ci	u32		max_burst[DW_DMA_MAX_NR_CHANNELS];
7062306a36Sopenharmony_ci#define CHAN_PROTCTL_PRIVILEGED		BIT(0)
7162306a36Sopenharmony_ci#define CHAN_PROTCTL_BUFFERABLE		BIT(1)
7262306a36Sopenharmony_ci#define CHAN_PROTCTL_CACHEABLE		BIT(2)
7362306a36Sopenharmony_ci#define CHAN_PROTCTL_MASK		GENMASK(2, 0)
7462306a36Sopenharmony_ci	u32		protctl;
7562306a36Sopenharmony_ci#define DW_DMA_QUIRK_XBAR_PRESENT	BIT(0)
7662306a36Sopenharmony_ci	u32		quirks;
7762306a36Sopenharmony_ci};
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci#endif /* _PLATFORM_DATA_DMA_DW_H */
80