Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1691299 > unrolled thread

Re: [PATCH v2 2/3] dmaengine: qcom: bam_dma: wrapper functions for command descriptor

Started byVinod Koul <vinod.koul@intel.com>
First post2017-07-19 12:10 +0200
Last post2017-07-19 13:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 2/3] dmaengine: qcom: bam_dma: wrapper functions for  command descriptor Vinod Koul <vinod.koul@intel.com> - 2017-07-19 12:10 +0200
    Re: [PATCH v2 2/3] dmaengine: qcom: bam_dma: wrapper functions for  command descriptor Abhishek Sahu <absahu@codeaurora.org> - 2017-07-19 13:40 +0200

#1691299 — Re: [PATCH v2 2/3] dmaengine: qcom: bam_dma: wrapper functions for command descriptor

FromVinod Koul <vinod.koul@intel.com>
Date2017-07-19 12:10 +0200
SubjectRe: [PATCH v2 2/3] dmaengine: qcom: bam_dma: wrapper functions for command descriptor
Message-ID<u4U5C-74z-77@gated-at.bofh.it>
On Mon, Jun 26, 2017 at 06:19:28PM +0530, Abhishek Sahu wrote:
> QCOM BAM also supports command descriptor which allows the SW to
> create descriptors of type command which does not generate any
> data transmissions but configures registers in the peripheral.
> In command descriptor the 32bit address point to the start of
> the command block which holds the command elements and the
> 16bit size define the size of the command block.
> 
> Each Command Element is structured by 4 words:
>     Write command: address + cmd
>                    register data
>                    register mask
>                    reserved
> 
>     Read command: address + cmd
>                   read data result address,
>                   reserved
>                   reserved
> 
> This patch creates a new header file for BAM driver which contains the
> structures and wrapper functions for command descriptor. This file will
> be used by different QCOM peripheral drivers for forming the command
> descriptor
> 
> Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
> ---
>  include/linux/dma/qcom_bam_dma.h | 79 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 79 insertions(+)
>  create mode 100644 include/linux/dma/qcom_bam_dma.h
> 
> diff --git a/include/linux/dma/qcom_bam_dma.h b/include/linux/dma/qcom_bam_dma.h
> new file mode 100644
> index 0000000..077d43a
> --- /dev/null
> +++ b/include/linux/dma/qcom_bam_dma.h
> @@ -0,0 +1,79 @@
> +/*
> + * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef _QCOM_BAM_DMA_H
> +#define _QCOM_BAM_DMA_H
> +
> +#include <asm/byteorder.h>
> +
> +/*
> + * This data type corresponds to the native Command Element
> + * supported by BAM DMA Engine.
> + *
> + * @cmd_and_addr - upper 8 bits command and lower 24 bits register address.
> + * @data - for write command: content to be written into peripheral register.
> + *	   for read command: dest addr to write peripheral register value.
> + * @mask - register mask.
> + * @reserved - for future usage.
> + *
> + */
> +struct bam_cmd_element {
> +	__le32 cmd_and_addr;
> +	__le32 data;
> +	__le32 mask;
> +	__le32 reserved;
> +};
> +
> +/*
> + * This enum indicates the command type in a command element
> + */
> +enum bam_command_type {
> +	BAM_WRITE_COMMAND = 0,
> +	BAM_READ_COMMAND,
> +};
> +
> +/*
> + * prep_bam_ce_le32 - Wrapper function to prepare a single BAM command
> + * element with the data already in le32 format.
> + *
> + * @bam_ce: bam command element
> + * @addr: target address
> + * @cmd: BAM command
> + * @data: actual data for write and dest addr for read in le32
> + */
> +static inline void
> +bam_prep_ce_le32(struct bam_cmd_element *bam_ce, u32 addr,
> +		 enum bam_command_type cmd, __le32 data)
> +{
> +	bam_ce->cmd_and_addr =
> +		cpu_to_le32((addr & 0xffffff) | ((cmd & 0xff) << 24));
> +	bam_ce->data = data;
> +	bam_ce->mask = cpu_to_le32(0xffffffff);
> +}

Is this being used by clients?

> +
> +/*
> + * bam_prep_ce - Wrapper function to prepare a single BAM command element
> + * with the data.
> + *
> + * @bam_ce: BAM command element
> + * @addr: target address
> + * @cmd: BAM command
> + * @data: actual data for write and dest addr for read
> + */
> +static inline void
> +bam_prep_ce(struct bam_cmd_element *bam_ce, u32 addr,
> +	    enum bam_command_type cmd, u32 data)
> +{
> +	bam_prep_ce_le32(bam_ce, addr, cmd, cpu_to_le32(data));
> +}
> +#endif
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
> 

-- 
~Vinod

[toc] | [next] | [standalone]


#1691572

FromAbhishek Sahu <absahu@codeaurora.org>
Date2017-07-19 13:40 +0200
Message-ID<u4VuH-7V9-45@gated-at.bofh.it>
In reply to#1691299
On 2017-07-19 15:39, Vinod Koul wrote:
> On Mon, Jun 26, 2017 at 06:19:28PM +0530, Abhishek Sahu wrote:
>> QCOM BAM also supports command descriptor which allows the SW to
>> create descriptors of type command which does not generate any
>> data transmissions but configures registers in the peripheral.
>> In command descriptor the 32bit address point to the start of
>> the command block which holds the command elements and the
>> 16bit size define the size of the command block.
>> 
>> Each Command Element is structured by 4 words:
>>     Write command: address + cmd
>>                    register data
>>                    register mask
>>                    reserved
>> 
>>     Read command: address + cmd
>>                   read data result address,
>>                   reserved
>>                   reserved
>> 
>> This patch creates a new header file for BAM driver which contains the
>> structures and wrapper functions for command descriptor. This file 
>> will
>> be used by different QCOM peripheral drivers for forming the command
>> descriptor
>> 
>> Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
>> ---
>>  include/linux/dma/qcom_bam_dma.h | 79 
>> ++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 79 insertions(+)
>>  create mode 100644 include/linux/dma/qcom_bam_dma.h
>> 
>> diff --git a/include/linux/dma/qcom_bam_dma.h 
>> b/include/linux/dma/qcom_bam_dma.h
>> new file mode 100644
>> index 0000000..077d43a
>> --- /dev/null
>> +++ b/include/linux/dma/qcom_bam_dma.h
>> @@ -0,0 +1,79 @@
>> +/*
>> + * Copyright (c) 2016-2017, The Linux Foundation. All rights 
>> reserved.
>> + *
>> + * This software is licensed under the terms of the GNU General 
>> Public
>> + * License version 2, as published by the Free Software Foundation, 
>> and
>> + * may be copied, distributed, and modified under those terms.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + */
>> +
>> +#ifndef _QCOM_BAM_DMA_H
>> +#define _QCOM_BAM_DMA_H
>> +
>> +#include <asm/byteorder.h>
>> +
>> +/*
>> + * This data type corresponds to the native Command Element
>> + * supported by BAM DMA Engine.
>> + *
>> + * @cmd_and_addr - upper 8 bits command and lower 24 bits register 
>> address.
>> + * @data - for write command: content to be written into peripheral 
>> register.
>> + *	   for read command: dest addr to write peripheral register value.
>> + * @mask - register mask.
>> + * @reserved - for future usage.
>> + *
>> + */
>> +struct bam_cmd_element {
>> +	__le32 cmd_and_addr;
>> +	__le32 data;
>> +	__le32 mask;
>> +	__le32 reserved;
>> +};
>> +
>> +/*
>> + * This enum indicates the command type in a command element
>> + */
>> +enum bam_command_type {
>> +	BAM_WRITE_COMMAND = 0,
>> +	BAM_READ_COMMAND,
>> +};
>> +
>> +/*
>> + * prep_bam_ce_le32 - Wrapper function to prepare a single BAM 
>> command
>> + * element with the data already in le32 format.
>> + *
>> + * @bam_ce: bam command element
>> + * @addr: target address
>> + * @cmd: BAM command
>> + * @data: actual data for write and dest addr for read in le32
>> + */
>> +static inline void
>> +bam_prep_ce_le32(struct bam_cmd_element *bam_ce, u32 addr,
>> +		 enum bam_command_type cmd, __le32 data)
>> +{
>> +	bam_ce->cmd_and_addr =
>> +		cpu_to_le32((addr & 0xffffff) | ((cmd & 0xff) << 24));
>> +	bam_ce->data = data;
>> +	bam_ce->mask = cpu_to_le32(0xffffffff);
>> +}
> 
> Is this being used by clients?
> 

  Yes Vinod. This wrapper function will be called by clients.
  NAND driver will call this function for reading/writing
  registers from BAM DMA.

  Following is the NAND client driver patch
  http://www.spinics.net/lists/devicetree/msg183713.html

>> +
>> +/*
>> + * bam_prep_ce - Wrapper function to prepare a single BAM command 
>> element
>> + * with the data.
>> + *
>> + * @bam_ce: BAM command element
>> + * @addr: target address
>> + * @cmd: BAM command
>> + * @data: actual data for write and dest addr for read
>> + */
>> +static inline void
>> +bam_prep_ce(struct bam_cmd_element *bam_ce, u32 addr,
>> +	    enum bam_command_type cmd, u32 data)
>> +{
>> +	bam_prep_ce_le32(bam_ce, addr, cmd, cpu_to_le32(data));
>> +}
>> +#endif
>> --
>> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
>> member of Code Aurora Forum, hosted by The Linux Foundation
>> 

-- 
Abhishek Sahu

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web