public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, balbi@ti.com,
	linux-usb@vger.kernel.org, linux-crypto@vger.kernel.org,
	davem@davemloft.net, herbert@gondor.hengli.com.au, arnd@arndb.de,
	linus.walleij@stericsson.com, srinidhi.kasagar@stericsson.com,
	Dan Williams <djbw@fb.com>,
	Per Forlin <per.forlin@stericsson.com>,
	Rabin Vincent <rabin@rab.in>
Subject: Re: [PATCH 36/39] dmaengine: ste_dma40: Allow memcpy channels to be configured from DT
Date: Thu, 16 May 2013 10:35:49 +0530	[thread overview]
Message-ID: <20130516050549.GE27639@intel.com> (raw)
In-Reply-To: <1368611522-9984-37-git-send-email-lee.jones@linaro.org>

On Wed, May 15, 2013 at 10:51:59AM +0100, Lee Jones wrote:
> At this moment in time the memcpy channels which can be used by the D40
> are fixed, as each supported platform in Mainline uses the same ones.
> However, platforms do exist which don't follow this convention, so
> these will need to be tailored. Fortunately, these platforms will be DT
> only, so this change has very little impact on platform data.
> 
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <djbw@fb.com>
> Cc: Per Forlin <per.forlin@stericsson.com>
> Cc: Rabin Vincent <rabin@rab.in>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>

> ---
>  .../devicetree/bindings/dma/ste-dma40.txt          |    2 +
>  drivers/dma/ste_dma40.c                            |   40 ++++++++++++++++----
>  include/linux/platform_data/dma-ste-dma40.h        |    2 +
>  3 files changed, 36 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/ste-dma40.txt b/Documentation/devicetree/bindings/dma/ste-dma40.txt
> index 2679a87..aa272d8 100644
> --- a/Documentation/devicetree/bindings/dma/ste-dma40.txt
> +++ b/Documentation/devicetree/bindings/dma/ste-dma40.txt
> @@ -6,6 +6,7 @@ Required properties:
>  - reg-names: Names of the above areas to use during resource look-up
>  - interrupt: Should contain the DMAC interrupt number
>  - #dma-cells: must be <3>
> +- memcpy-channels: Channels to be used for memcpy
>  
>  Optional properties:
>  - dma-channels: Number of channels supported by hardware - if not present
> @@ -21,6 +22,7 @@ Example:
>  		interrupts = <0 25 0x4>;
>  
>  		#dma-cells = <2>;
> +		memcpy-channels  = <56 57 58 59 60>;
>  		dma-channels = <8>;
>  	};
>  
> diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
> index 76c255f..ae462d3 100644
> --- a/drivers/dma/ste_dma40.c
> +++ b/drivers/dma/ste_dma40.c
> @@ -58,6 +58,8 @@
>  #define D40_ALLOC_PHY		BIT(30)
>  #define D40_ALLOC_LOG_FREE	0
>  
> +#define D40_MEMCPY_MAX_CHANS	8
> +
>  /* Reserved event lines for memcpy only. */
>  #define DB8500_DMA_MEMCPY_EV_0	51
>  #define DB8500_DMA_MEMCPY_EV_1	56
> @@ -522,6 +524,8 @@ struct d40_gen_dmac {
>   * @phy_start: Physical memory start of the DMA registers.
>   * @phy_size: Size of the DMA register map.
>   * @irq: The IRQ number.
> + * @num_memcpy_chans: The number of channels used for memcpy (mem-to-mem
> + * transfers).
>   * @num_phy_chans: The number of physical channels. Read from HW. This
>   * is the number of available channels for this driver, not counting "Secure
>   * mode" allocated physical channels.
> @@ -565,6 +569,7 @@ struct d40_base {
>  	phys_addr_t			  phy_start;
>  	resource_size_t			  phy_size;
>  	int				  irq;
> +	int				  num_memcpy_chans;
>  	int				  num_phy_chans;
>  	int				  num_log_chans;
>  	struct device_dma_parameters	  dma_parms;
> @@ -2938,7 +2943,7 @@ static int __init d40_dmaengine_init(struct d40_base *base,
>  	}
>  
>  	d40_chan_init(base, &base->dma_memcpy, base->log_chans,
> -		      base->num_log_chans, ARRAY_SIZE(dma40_memcpy_channels));
> +		      base->num_log_chans, base->num_memcpy_chans);
>  
>  	dma_cap_zero(base->dma_memcpy.cap_mask);
>  	dma_cap_set(DMA_MEMCPY, base->dma_memcpy.cap_mask);
> @@ -3139,6 +3144,7 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
>  	struct d40_base *base = NULL;
>  	int num_log_chans = 0;
>  	int num_phy_chans;
> +	int num_memcpy_chans;
>  	int clk_ret = -EINVAL;
>  	int i;
>  	u32 pid;
> @@ -3209,6 +3215,12 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
>  	else
>  		num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4;
>  
> +	/* The number of channels used for memcpy */
> +	if (plat_data->num_of_memcpy_chans)
> +		num_memcpy_chans = plat_data->num_of_memcpy_chans;
> +	else
> +		num_memcpy_chans = ARRAY_SIZE(dma40_memcpy_channels);
> +
>  	num_log_chans = num_phy_chans * D40_MAX_LOG_CHAN_PER_PHY;
>  
>  	dev_info(&pdev->dev,
> @@ -3216,7 +3228,7 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
>  		 rev, res->start, num_phy_chans, num_log_chans);
>  
>  	base = kzalloc(ALIGN(sizeof(struct d40_base), 4) +
> -		       (num_phy_chans + num_log_chans + ARRAY_SIZE(dma40_memcpy_channels)) *
> +		       (num_phy_chans + num_log_chans + num_memcpy_chans) *
>  		       sizeof(struct d40_chan), GFP_KERNEL);
>  
>  	if (base == NULL) {
> @@ -3226,6 +3238,7 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
>  
>  	base->rev = rev;
>  	base->clk = clk;
> +	base->num_memcpy_chans = num_memcpy_chans;
>  	base->num_phy_chans = num_phy_chans;
>  	base->num_log_chans = num_log_chans;
>  	base->phy_start = res->start;
> @@ -3469,12 +3482,8 @@ static int __init d40_of_probe(struct platform_device *pdev,
>  			       struct device_node *np)
>  {
>  	struct stedma40_platform_data *pdata;
> -
> -	/*
> -	 * FIXME: Fill in this routine as more support is added.
> -	 * First platform enabled (u8500) doens't need any extra
> -	 * properties to run, so this is fairly sparce currently.
> -	 */
> +	int num_memcpy = 0;
> +	const const __be32 *list;
>  
>  	pdata = devm_kzalloc(&pdev->dev,
>  			     sizeof(struct stedma40_platform_data),
> @@ -3482,6 +3491,21 @@ static int __init d40_of_probe(struct platform_device *pdev,
>  	if (!pdata)
>  		return -ENOMEM;
>  
> +	list = of_get_property(np, "memcpy-channels", &num_memcpy);
> +	num_memcpy /= sizeof(*list);
> +
> +	if (num_memcpy > D40_MEMCPY_MAX_CHANS || num_memcpy <= 0) {
> +		d40_err(&pdev->dev,
> +			"Invalid number of memcpy channels specified (%d)\n",
> +			num_memcpy);
> +		return -EINVAL;
> +	}
> +	pdata->num_of_memcpy_chans = num_memcpy;
> +
> +	of_property_read_u32_array(np, "memcpy-channels",
> +				   dma40_memcpy_channels,
> +				   num_memcpy);
> +
>  	pdev->dev.platform_data = pdata;
>  
>  	return 0;
> diff --git a/include/linux/platform_data/dma-ste-dma40.h b/include/linux/platform_data/dma-ste-dma40.h
> index ceba6dc..1bb9b18 100644
> --- a/include/linux/platform_data/dma-ste-dma40.h
> +++ b/include/linux/platform_data/dma-ste-dma40.h
> @@ -132,6 +132,7 @@ struct stedma40_chan_cfg {
>   * @num_of_soft_lli_chans: The number of channels that needs to be configured
>   * to use SoftLLI.
>   * @use_esram_lcla: flag for mapping the lcla into esram region
> + * @num_of_memcpy_chans: The number of channels reserved for memcpy.
>   * @num_of_phy_chans: The number of physical channels implemented in HW.
>   * 0 means reading the number of channels from DMA HW but this is only valid
>   * for 'multiple of 4' channels, like 8.
> @@ -141,6 +142,7 @@ struct stedma40_platform_data {
>  	int				*soft_lli_chans;
>  	int				 num_of_soft_lli_chans;
>  	bool				 use_esram_lcla;
> +	int				 num_of_memcpy_chans;
>  	int				 num_of_phy_chans;
>  };
>  
> -- 
> 1.7.10.4
> 

  reply	other threads:[~2013-05-16  5:41 UTC|newest]

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15  9:51 [PATCH 00/39] Continuation of DMA changes in ux500 based drivers Lee Jones
2013-05-15  9:51 ` [PATCH 01/39] dmaengine: ste_dma40: Separate Logical Global Interrupt Mask (GIM) unmasking Lee Jones
2013-05-15 16:29   ` Linus Walleij
2013-05-16  6:35     ` Vinod Koul
2013-05-16  7:26       ` Lee Jones
2013-05-15  9:51 ` [PATCH 02/39] dmaengine: ste_dma40: Remove unnecessary call to d40_phy_cfg() Lee Jones
2013-05-15 16:33   ` Linus Walleij
2013-05-16  6:35   ` Vinod Koul
2013-05-16  7:25     ` Lee Jones
2013-05-16  9:40       ` Vinod Koul
2013-05-16 10:59         ` Lee Jones
2013-05-20 12:01           ` Linus Walleij
2013-05-15  9:51 ` [PATCH 03/39] dmaengine: ste_dma40: Don't configure runtime configurable setup during allocate Lee Jones
2013-05-15 16:44   ` Linus Walleij
2013-05-16  6:36   ` Vinod Koul
2013-05-15  9:51 ` [PATCH 04/39] ARM: ux500: Stop passing UART's platform data for Device Tree boots Lee Jones
2013-05-15 16:48   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 05/39] ARM: ux500: Stop passing MMC's " Lee Jones
2013-05-15 16:50   ` Linus Walleij
2013-06-10  9:15     ` Lee Jones
2013-06-11  9:31       ` Linus Walleij
2013-05-15  9:51 ` [PATCH 06/39] ARM: ux500: Move SDI (MMC) and UART devices under more descriptive heading Lee Jones
2013-05-15 16:51   ` Linus Walleij
2013-06-10  9:17     ` Lee Jones
2013-06-11  9:40       ` Linus Walleij
2013-05-15  9:51 ` [PATCH 07/39] dmaengine: ste_dma40: Only use addresses passed as configuration information Lee Jones
2013-05-15 16:54   ` Linus Walleij
2013-05-16  6:40   ` Vinod Koul
2013-05-15  9:51 ` [PATCH 08/39] dmaengine: ste_dma40: Remove redundant address fetching function Lee Jones
2013-05-15 16:56   ` Linus Walleij
2013-05-16  6:41   ` Vinod Koul
2013-05-15  9:51 ` [PATCH 09/39] ARM: ux500: Remove DMA address look-up table Lee Jones
2013-05-15 17:03   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 10/39] dmaengine: ste_dma40: Correct copy/paste error Lee Jones
2013-05-15 17:04   ` Linus Walleij
2013-05-16  6:42   ` Vinod Koul
2013-05-15  9:51 ` [PATCH 11/39] ARM: ux500: Remove unnecessary attributes from DMA channel request pdata Lee Jones
2013-05-15 17:05   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 12/39] crypto: ux500/hash - Prepare clock before enabling it Lee Jones
2013-05-15 17:07   ` Linus Walleij
2013-05-16  6:53     ` Lee Jones
2013-05-16  7:00       ` Herbert Xu
2013-05-20 12:05   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 13/39] crypto: ux500/hash - Set DMA configuration though dma_slave_config() Lee Jones
2013-05-15 17:09   ` Linus Walleij
2013-05-16  7:01   ` Herbert Xu
2013-05-20 12:06   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 14/39] ARM: ux500: Stop passing Hash DMA channel config information though pdata Lee Jones
2013-05-20 12:09   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 15/39] crypto: ux500/cryp - Prepare clock before enabling it Lee Jones
2013-05-15 17:11   ` Linus Walleij
2013-05-16  7:01   ` Herbert Xu
2013-05-20 12:10   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 16/39] crypto: ux500/cryp - Set DMA configuration though dma_slave_config() Lee Jones
2013-05-16  7:01   ` Herbert Xu
2013-05-20 12:12   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 17/39] ARM: ux500: Stop passing Cryp DMA channel config information though pdata Lee Jones
2013-05-15  9:51 ` [PATCH 18/39] crypto: ux500/[cryp|hash] - Show successful start-up in the bootlog Lee Jones
2013-05-16  7:02   ` Herbert Xu
2013-05-20 12:15   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 19/39] ARM: ux500: Register Cyrp and Hash platform drivers on Snowball Lee Jones
2013-05-20 12:17   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 20/39] usb: musb: ux500: move channel number knowledge into the driver Lee Jones
2013-05-15 17:18   ` Linus Walleij
2013-05-15 20:14     ` Fabio Baltieri
2013-05-17  6:35       ` Linus Walleij
2013-05-28 16:27     ` Felipe Balbi
2013-05-28 16:48       ` Lee Jones
2013-05-29 11:57       ` Linus Walleij
2013-05-20 12:19   ` Linus Walleij
2013-05-29 17:57   ` Felipe Balbi
2013-05-30  7:48     ` Linus Walleij
2013-05-30  8:12       ` Lee Jones
2013-05-30 19:06         ` Felipe Balbi
2013-05-30  7:44   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 21/39] usb: musb: ux500: move the MUSB HDRC configuration " Lee Jones
2013-05-30  8:30   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 22/39] usb: musb: ux500: take the dma_mask from coherent_dma_mask Lee Jones
2013-05-30  8:32   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 23/39] usb: musb: ux500: harden checks for platform data Lee Jones
2013-05-30  8:34   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 24/39] usb: musb: ux500: attempt to find channels by name before using pdata Lee Jones
2013-05-30  8:35   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 25/39] usb: musb: ux500: add device tree probing support Lee Jones
2013-05-30  8:38   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 26/39] ARM: ux500: Add an auxdata entry for MUSB for clock-name look-up Lee Jones
2013-05-30  8:42   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 27/39] ARM: ux500: Remove ux500-musb platform registation when booting with DT Lee Jones
2013-05-30  8:44   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 28/39] ARM: ux500: Remove empty function u8500_of_init_devices() Lee Jones
2013-05-30  8:45   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 29/39] dmaengine: ste_dma40: Use the BIT macro to replace ugly '(1 << x)'s Lee Jones
2013-05-30  8:47   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 30/39] ARM: ux500: Replace ST-E's home-brew DMA direction definition with the generic one Lee Jones
2013-05-30  8:52   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 31/39] dmaengine: ste_dma40: Replace ST-E's home-brew DMA direction defs with generic ones Lee Jones
2013-05-16  5:17   ` Vinod Koul
2013-05-16  7:06     ` Lee Jones
2013-05-16  6:43       ` Vinod Koul
2013-05-30  8:54   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 32/39] ARM: ux500: Remove recently unused stedma40_xfer_dir enums Lee Jones
2013-05-30  8:56   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 33/39] dmaengine: ste_dma40_ll: Use the BIT macro to replace ugly '(1 << x)'s Lee Jones
2013-05-16  5:13   ` Vinod Koul
2013-05-30  8:58   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 34/39] dmaengine: ste_dma40: Convert data_width from register bit format to value Lee Jones
2013-05-16  6:32   ` Vinod Koul
2013-05-16  7:35     ` Lee Jones
2013-05-16  9:41       ` Vinod Koul
2013-05-30  9:01   ` Linus Walleij
2013-05-15  9:51 ` [PATCH 35/39] dmaengine: ste_dma40_ll: Replace meaningless register set with comment Lee Jones
2013-05-16  5:18   ` Vinod Koul
2013-05-16  6:58     ` Lee Jones
2013-05-30  9:04   ` Linus Walleij
2013-05-30 17:56     ` Vinod Koul
2013-05-15  9:51 ` [PATCH 36/39] dmaengine: ste_dma40: Allow memcpy channels to be configured from DT Lee Jones
2013-05-16  5:05   ` Vinod Koul [this message]
2013-05-30  9:06   ` Linus Walleij
2013-05-15  9:52 ` [PATCH 37/39] ARM: ux500: Stop passing DMA platform data though AUXDATA Lee Jones
2013-05-30  9:12   ` Linus Walleij
2013-05-15  9:52 ` [PATCH 38/39] dmaengine: ste_dma40: Fetch the number of physical channels from DT Lee Jones
2013-05-16  6:34   ` Vinod Koul
2013-05-30  9:15   ` Linus Walleij
2013-05-15  9:52 ` [PATCH 39/39] dmaengine: ste_dma40: Fetch disabled " Lee Jones
2013-05-16  6:08   ` Vinod Koul
2013-05-30  9:16   ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130516050549.GE27639@intel.com \
    --to=vinod.koul@intel.com \
    --cc=arnd@arndb.de \
    --cc=balbi@ti.com \
    --cc=davem@davemloft.net \
    --cc=djbw@fb.com \
    --cc=herbert@gondor.hengli.com.au \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=per.forlin@stericsson.com \
    --cc=rabin@rab.in \
    --cc=srinidhi.kasagar@stericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox