Commit 26c3dc41d88e7c3cf247b67a736472ecf54cc093

Authored by Aurelien Jacquiot
Committed by Hongmei Gou
1 parent e313352352

soc: ti: add knav_dma_get_flow() to retrieve flow of given channel

Some devices using packet DMA (e.g. PA, SRIO) need to configure additional
hw registers based on flow Ids. Add a function to retrieve this flow
Id from a given channel for a DMA client. While at it, also fix some typos.

Signed-off-by: Aurelien Jacquiot <a-jacquiot@ti.com>
Signed-off-by: Murali Karicheri <m-karicheri@ti.com>

Showing 2 changed files with 25 additions and 2 deletions Side-by-side Diff

drivers/soc/ti/knav_dma.c
... ... @@ -401,7 +401,7 @@
401 401  
402 402 if (of_parse_phandle_with_fixed_args(np, "ti,navigator-dmas",
403 403 1, index, &args)) {
404   - dev_err(kdev->dev, "Missing the pahndle args name %s\n", name);
  404 + dev_err(kdev->dev, "Missing the phandle args name %s\n", name);
405 405 return -ENODEV;
406 406 }
407 407  
... ... @@ -414,6 +414,28 @@
414 414 }
415 415  
416 416 /**
  417 + * knav_dma_get_flow() - retrieve flow Id from a given channel handle
  418 + * @channel dma channel handle
  419 + *
  420 + * Returns corresponding flow Id on success or -EINVAL in case of error
  421 + */
  422 +int knav_dma_get_flow(void *channel)
  423 +{
  424 + struct knav_dma_chan *chan = channel;
  425 +
  426 + if (!chan)
  427 + return -EINVAL;
  428 +
  429 + if (!kdev) {
  430 + pr_err("keystone-navigator-dma driver not registered\n");
  431 + return -EINVAL;
  432 + }
  433 +
  434 + return chan->flow;
  435 +}
  436 +EXPORT_SYMBOL_GPL(knav_dma_get_flow);
  437 +
  438 +/**
417 439 * knav_dma_open_channel() - try to setup an exclusive slave channel
418 440 * @dev: pointer to client device structure
419 441 * @name: slave channel name
... ... @@ -442,7 +464,7 @@
442 464 }
443 465  
444 466 dev_dbg(kdev->dev, "initializing %s channel %d from DMA %s\n",
445   - config->direction == DMA_MEM_TO_DEV ? "transmit" :
  467 + config->direction == DMA_MEM_TO_DEV ? "transmit" :
446 468 config->direction == DMA_DEV_TO_MEM ? "receive" :
447 469 "unknown", chan_num, instance);
448 470  
include/linux/soc/ti/knav_dma.h
... ... @@ -162,6 +162,7 @@
162 162 struct knav_dma_cfg *config);
163 163 void knav_dma_close_channel(void *channel);
164 164 bool knav_dma_device_ready(void);
  165 +int knav_dma_get_flow(void *channel);
165 166 #else
166 167 static inline void *knav_dma_open_channel(struct device *dev, const char *name,
167 168 struct knav_dma_cfg *config)