Commit c422025c authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Vinod Koul
Browse files

dmaengine: dw: rename masters to reflect actual topology



The source and destination masters are reflecting buses or their layers to
where the different devices can be connected. The patch changes the master
names to reflect which one is related to which independently on the transfer
direction.

The outcome of the change is that the memory data width is now always limited
by a data width of the master which is dedicated to communicate to memory.

The patch will not break anything since all current users have the same data
width for all masters. Though it would be nice to revisit avr32 platforms to
check what is the actual hardware topology in use there. It seems that it has
one bus and two masters on it as stated by Table 8-2, that's why everything
works independently on the master in use. The purpose of the sequential patch
is to fix the driver for configuration of more than one bus.

The change is done in the assumption that src_master and dst_master are
reflecting a connection to the memory and peripheral correspondently on avr32
and otherwise on the rest.

Acked-by: default avatarHans-Christian Egtvedt <egtvedt@samfundet.no>
Acked-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 3fe6409c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -47,8 +47,8 @@ The four cells in order are:

1. A phandle pointing to the DMA controller
2. The DMA request line number
3. Source master for transfers on allocated channel
4. Destination master for transfers on allocated channel
3. Memory master for transfers on allocated channel
4. Peripheral master for transfers on allocated channel

Example:
	
+8 −8
Original line number Diff line number Diff line
@@ -1365,8 +1365,8 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
	slave->dma_dev = &dw_dmac0_device.dev;
	slave->src_id = 0;
	slave->dst_id = 1;
	slave->src_master = 1;
	slave->dst_master = 0;
	slave->m_master = 1;
	slave->p_master = 0;

	data->dma_slave = slave;
	data->dma_filter = at32_mci_dma_filter;
@@ -2061,16 +2061,16 @@ at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data,
	if (flags & AC97C_CAPTURE) {
		rx_dws->dma_dev = &dw_dmac0_device.dev;
		rx_dws->src_id = 3;
		rx_dws->src_master = 0;
		rx_dws->dst_master = 1;
		rx_dws->m_master = 0;
		rx_dws->p_master = 1;
	}

	/* Check if DMA slave interface for playback should be configured. */
	if (flags & AC97C_PLAYBACK) {
		tx_dws->dma_dev = &dw_dmac0_device.dev;
		tx_dws->dst_id = 4;
		tx_dws->src_master = 0;
		tx_dws->dst_master = 1;
		tx_dws->m_master = 0;
		tx_dws->p_master = 1;
	}

	if (platform_device_add_data(pdev, data,
@@ -2141,8 +2141,8 @@ at32_add_device_abdac(unsigned int id, struct atmel_abdac_pdata *data)

	dws->dma_dev = &dw_dmac0_device.dev;
	dws->dst_id = 2;
	dws->src_master = 0;
	dws->dst_master = 1;
	dws->m_master = 0;
	dws->p_master = 1;

	if (platform_device_add_data(pdev, data,
				sizeof(struct atmel_abdac_pdata)))
+2 −2
Original line number Diff line number Diff line
@@ -201,8 +201,8 @@ static struct sata_dwc_host_priv host_pvt;
static struct dw_dma_slave sata_dwc_dma_dws = {
	.src_id = 0,
	.dst_id = 0,
	.src_master = 0,
	.dst_master = 1,
	.m_master = 1,
	.p_master = 0,
};

/*
+9 −10
Original line number Diff line number Diff line
@@ -50,8 +50,8 @@
		 | DWC_CTLL_SRC_MSIZE(_smsize)			\
		 | DWC_CTLL_LLP_D_EN				\
		 | DWC_CTLL_LLP_S_EN				\
		 | DWC_CTLL_DMS(_dwc->dst_master)		\
		 | DWC_CTLL_SMS(_dwc->src_master));		\
		 | DWC_CTLL_DMS(_dwc->p_master)			\
		 | DWC_CTLL_SMS(_dwc->m_master));		\
	})

/*
@@ -709,8 +709,7 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,

	dwc->direction = DMA_MEM_TO_MEM;

	data_width = min_t(unsigned int, dw->data_width[dwc->src_master],
			   dw->data_width[dwc->dst_master]);
	data_width = dw->data_width[dwc->m_master];

	src_width = dst_width = min_t(unsigned int, data_width,
				      dwc_fast_ffs(src | dest | len));
@@ -802,7 +801,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
		ctllo |= sconfig->device_fc ? DWC_CTLL_FC(DW_DMA_FC_P_M2P) :
			DWC_CTLL_FC(DW_DMA_FC_D_M2P);

		data_width = dw->data_width[dwc->src_master];
		data_width = dw->data_width[dwc->m_master];

		for_each_sg(sgl, sg, sg_len, i) {
			struct dw_desc	*desc;
@@ -859,7 +858,7 @@ slave_sg_todev_fill_desc:
		ctllo |= sconfig->device_fc ? DWC_CTLL_FC(DW_DMA_FC_P_P2M) :
			DWC_CTLL_FC(DW_DMA_FC_D_P2M);

		data_width = dw->data_width[dwc->dst_master];
		data_width = dw->data_width[dwc->m_master];

		for_each_sg(sgl, sg, sg_len, i) {
			struct dw_desc	*desc;
@@ -937,8 +936,8 @@ bool dw_dma_filter(struct dma_chan *chan, void *param)
	dwc->src_id = dws->src_id;
	dwc->dst_id = dws->dst_id;

	dwc->src_master = dws->src_master;
	dwc->dst_master = dws->dst_master;
	dwc->m_master = dws->m_master;
	dwc->p_master = dws->p_master;

	return true;
}
@@ -1227,8 +1226,8 @@ static void dwc_free_chan_resources(struct dma_chan *chan)
	dwc->src_id = 0;
	dwc->dst_id = 0;

	dwc->src_master = 0;
	dwc->dst_master = 0;
	dwc->m_master = 0;
	dwc->p_master = 0;

	dwc->initialized = false;

+6 −6
Original line number Diff line number Diff line
@@ -42,13 +42,13 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,

	slave.src_id = dma_spec->args[0];
	slave.dst_id = dma_spec->args[0];
	slave.src_master = dma_spec->args[1];
	slave.dst_master = dma_spec->args[2];
	slave.m_master = dma_spec->args[1];
	slave.p_master = dma_spec->args[2];

	if (WARN_ON(slave.src_id >= DW_DMA_MAX_NR_REQUESTS ||
		    slave.dst_id >= DW_DMA_MAX_NR_REQUESTS ||
		    slave.src_master >= dw->nr_masters ||
		    slave.dst_master >= dw->nr_masters))
		    slave.m_master >= dw->nr_masters ||
		    slave.p_master >= dw->nr_masters))
		return NULL;

	dma_cap_zero(cap);
@@ -66,8 +66,8 @@ static bool dw_dma_acpi_filter(struct dma_chan *chan, void *param)
		.dma_dev = dma_spec->dev,
		.src_id = dma_spec->slave_id,
		.dst_id = dma_spec->slave_id,
		.src_master = 1,
		.dst_master = 0,
		.m_master = 0,
		.p_master = 1,
	};

	return dw_dma_filter(chan, &slave);
Loading