aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/8250
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2013-04-10 09:58:30 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-11 16:21:17 -0400
commit94b2b47cf68ce4633a1dbe9d221617404b5de03b (patch)
tree246f2395cb9aee1f2170ffdd7dc819a8a503c8ec /drivers/tty/serial/8250
parentaea02e87f6076f2a29d537829503e1344e92a3b8 (diff)
serial: 8250_dw: Let ACPI code extract the DMA client info
The new ACPI DMA helpers in dmaengine API can take care of extracting all the necessary information regarding DMA. The driver does not need to do this separately any more. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/8250')
-rw-r--r--drivers/tty/serial/8250/8250_dw.c75
1 files changed, 9 insertions, 66 deletions
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index de7a1869c82c..09aaea2d3a6c 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -163,66 +163,10 @@ static int dw8250_probe_of(struct uart_port *p)
163} 163}
164 164
165#ifdef CONFIG_ACPI 165#ifdef CONFIG_ACPI
166static bool dw8250_acpi_dma_filter(struct dma_chan *chan, void *parm) 166static int dw8250_probe_acpi(struct uart_8250_port *up)
167{
168 return chan->chan_id == *(int *)parm;
169}
170
171static acpi_status
172dw8250_acpi_walk_resource(struct acpi_resource *res, void *data)
173{
174 struct uart_port *p = data;
175 struct uart_8250_port *port;
176 struct uart_8250_dma *dma;
177 struct acpi_resource_fixed_dma *fixed_dma;
178 struct dma_slave_config *slave;
179
180 port = container_of(p, struct uart_8250_port, port);
181
182 switch (res->type) {
183 case ACPI_RESOURCE_TYPE_FIXED_DMA:
184 fixed_dma = &res->data.fixed_dma;
185
186 /* TX comes first */
187 if (!port->dma) {
188 dma = devm_kzalloc(p->dev, sizeof(*dma), GFP_KERNEL);
189 if (!dma)
190 return AE_NO_MEMORY;
191
192 port->dma = dma;
193 slave = &dma->txconf;
194
195 slave->direction = DMA_MEM_TO_DEV;
196 slave->dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
197 slave->slave_id = fixed_dma->request_lines;
198 slave->dst_maxburst = port->tx_loadsz / 4;
199
200 dma->tx_chan_id = fixed_dma->channels;
201 dma->tx_param = &dma->tx_chan_id;
202 dma->fn = dw8250_acpi_dma_filter;
203 } else {
204 dma = port->dma;
205 slave = &dma->rxconf;
206
207 slave->direction = DMA_DEV_TO_MEM;
208 slave->src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
209 slave->slave_id = fixed_dma->request_lines;
210 slave->src_maxburst = p->fifosize / 4;
211
212 dma->rx_chan_id = fixed_dma->channels;
213 dma->rx_param = &dma->rx_chan_id;
214 }
215
216 break;
217 }
218
219 return AE_OK;
220}
221
222static int dw8250_probe_acpi(struct uart_port *p)
223{ 167{
224 const struct acpi_device_id *id; 168 const struct acpi_device_id *id;
225 acpi_status status; 169 struct uart_port *p = &up->port;
226 170
227 id = acpi_match_device(p->dev->driver->acpi_match_table, p->dev); 171 id = acpi_match_device(p->dev->driver->acpi_match_table, p->dev);
228 if (!id) 172 if (!id)
@@ -236,13 +180,12 @@ static int dw8250_probe_acpi(struct uart_port *p)
236 if (!p->uartclk) 180 if (!p->uartclk)
237 p->uartclk = (unsigned int)id->driver_data; 181 p->uartclk = (unsigned int)id->driver_data;
238 182
239 status = acpi_walk_resources(ACPI_HANDLE(p->dev), METHOD_NAME__CRS, 183 up->dma = devm_kzalloc(p->dev, sizeof(*up->dma), GFP_KERNEL);
240 dw8250_acpi_walk_resource, p); 184 if (!up->dma)
241 if (ACPI_FAILURE(status)) { 185 return -ENOMEM;
242 dev_err_ratelimited(p->dev, "%s failed \"%s\"\n", __func__, 186
243 acpi_format_exception(status)); 187 up->dma->rxconf.src_maxburst = p->fifosize / 4;
244 return -ENODEV; 188 up->dma->txconf.dst_maxburst = p->fifosize / 4;
245 }
246 189
247 return 0; 190 return 0;
248} 191}
@@ -329,7 +272,7 @@ static int dw8250_probe(struct platform_device *pdev)
329 if (err) 272 if (err)
330 return err; 273 return err;
331 } else if (ACPI_HANDLE(&pdev->dev)) { 274 } else if (ACPI_HANDLE(&pdev->dev)) {
332 err = dw8250_probe_acpi(&uart.port); 275 err = dw8250_probe_acpi(&uart);
333 if (err) 276 if (err)
334 return err; 277 return err;
335 } else { 278 } else {