aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/dma/amba-pl08x.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 1c9f712520d6..c7f7b82f6155 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1117,13 +1117,14 @@ static const struct burst_table burst_sizes[] = {
1117 }, 1117 },
1118}; 1118};
1119 1119
1120static void dma_set_runtime_config(struct dma_chan *chan, 1120static int dma_set_runtime_config(struct dma_chan *chan,
1121 struct dma_slave_config *config) 1121 struct dma_slave_config *config)
1122{ 1122{
1123 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); 1123 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
1124 struct pl08x_driver_data *pl08x = plchan->host; 1124 struct pl08x_driver_data *pl08x = plchan->host;
1125 struct pl08x_channel_data *cd = plchan->cd; 1125 struct pl08x_channel_data *cd = plchan->cd;
1126 enum dma_slave_buswidth addr_width; 1126 enum dma_slave_buswidth addr_width;
1127 dma_addr_t addr;
1127 u32 maxburst; 1128 u32 maxburst;
1128 u32 cctl = 0; 1129 u32 cctl = 0;
1129 int i; 1130 int i;
@@ -1131,17 +1132,17 @@ static void dma_set_runtime_config(struct dma_chan *chan,
1131 /* Transfer direction */ 1132 /* Transfer direction */
1132 plchan->runtime_direction = config->direction; 1133 plchan->runtime_direction = config->direction;
1133 if (config->direction == DMA_TO_DEVICE) { 1134 if (config->direction == DMA_TO_DEVICE) {
1134 plchan->runtime_addr = config->dst_addr; 1135 addr = config->dst_addr;
1135 addr_width = config->dst_addr_width; 1136 addr_width = config->dst_addr_width;
1136 maxburst = config->dst_maxburst; 1137 maxburst = config->dst_maxburst;
1137 } else if (config->direction == DMA_FROM_DEVICE) { 1138 } else if (config->direction == DMA_FROM_DEVICE) {
1138 plchan->runtime_addr = config->src_addr; 1139 addr = config->src_addr;
1139 addr_width = config->src_addr_width; 1140 addr_width = config->src_addr_width;
1140 maxburst = config->src_maxburst; 1141 maxburst = config->src_maxburst;
1141 } else { 1142 } else {
1142 dev_err(&pl08x->adev->dev, 1143 dev_err(&pl08x->adev->dev,
1143 "bad runtime_config: alien transfer direction\n"); 1144 "bad runtime_config: alien transfer direction\n");
1144 return; 1145 return -EINVAL;
1145 } 1146 }
1146 1147
1147 switch (addr_width) { 1148 switch (addr_width) {
@@ -1160,7 +1161,7 @@ static void dma_set_runtime_config(struct dma_chan *chan,
1160 default: 1161 default:
1161 dev_err(&pl08x->adev->dev, 1162 dev_err(&pl08x->adev->dev,
1162 "bad runtime_config: alien address width\n"); 1163 "bad runtime_config: alien address width\n");
1163 return; 1164 return -EINVAL;
1164 } 1165 }
1165 1166
1166 /* 1167 /*
@@ -1179,6 +1180,8 @@ static void dma_set_runtime_config(struct dma_chan *chan,
1179 cctl |= burst_sizes[i].reg; 1180 cctl |= burst_sizes[i].reg;
1180 } 1181 }
1181 1182
1183 plchan->runtime_addr = addr;
1184
1182 /* Modify the default channel data to fit PrimeCell request */ 1185 /* Modify the default channel data to fit PrimeCell request */
1183 cd->cctl = cctl; 1186 cd->cctl = cctl;
1184 1187
@@ -1190,6 +1193,8 @@ static void dma_set_runtime_config(struct dma_chan *chan,
1190 addr_width, 1193 addr_width,
1191 maxburst, 1194 maxburst,
1192 cctl); 1195 cctl);
1196
1197 return 0;
1193} 1198}
1194 1199
1195/* 1200/*
@@ -1452,10 +1457,8 @@ static int pl08x_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
1452 1457
1453 /* Controls applicable to inactive channels */ 1458 /* Controls applicable to inactive channels */
1454 if (cmd == DMA_SLAVE_CONFIG) { 1459 if (cmd == DMA_SLAVE_CONFIG) {
1455 dma_set_runtime_config(chan, 1460 return dma_set_runtime_config(chan,
1456 (struct dma_slave_config *) 1461 (struct dma_slave_config *)arg);
1457 arg);
1458 return 0;
1459 } 1462 }
1460 1463
1461 /* 1464 /*