lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150330085929.GS457@x1>
Date:	Mon, 30 Mar 2015 09:59:29 +0100
From:	Lee Jones <lee.jones@...aro.org>
To:	Holger Dengler <dengler@...utronix.de>
Cc:	linux-kernel@...r.kernel.org, Peter Mahler <mahler@...ug.com>,
	Juergen Bubeck <bubeck@...ug.com>,
	Benedikt Spranger <b.spranger@...utronix.de>,
	Samuel Ortiz <sameo@...ux.intel.com>
Subject: Re: [PATCH 08/11] mfd: flexcard: add DMA device

On Wed, 25 Mar 2015, Holger Dengler wrote:

> From: Benedikt Spranger <b.spranger@...utronix.de>
> 
> The Flexcard interface design split packet receive and transmit. All
> received packets and card status information are multiplexed with a
> Flexcard specific protocol and handled through a DMA capable ringbuffer.
> The TX path has to poke each available component separate.
> 
> Add a platform device for the DMA receive channel.
> 
> Signed-off-by: Holger Dengler <dengler@...utronix.de>
> Signed-off-by: Benedikt Spranger <b.spranger@...utronix.de>
> cc: Samuel Ortiz <sameo@...ux.intel.com>
> cc: Lee Jones <lee.jones@...aro.org>
> ---
>  drivers/mfd/flexcard/core.c     | 60 +++++++++++++++++++++++++++++++++++++++++
>  drivers/mfd/flexcard/flexcard.h |  5 ++++
>  2 files changed, 65 insertions(+)
> 
> diff --git a/drivers/mfd/flexcard/core.c b/drivers/mfd/flexcard/core.c
> index cd06854..39d1d4d 100644
> --- a/drivers/mfd/flexcard/core.c
> +++ b/drivers/mfd/flexcard/core.c
> @@ -52,6 +52,34 @@ static struct mfd_cell flexcard_clk_dev[] = {
>  	},
>  };
>  
> +static struct resource flexcard_dma_res[] = {
> +	{
> +		.name   = "flexcard-dma",
> +		.start  = 0x500,
> +		.end    = 0x580,

Better to define these.

> +		.flags  = IORESOURCE_MEM,
> +	}, {
> +		.name   = "flexcard-dma",
> +		.start  = FLEXCARD_DMA_IRQ_CBL,
> +		.end    = FLEXCARD_DMA_IRQ_CBL,
> +		.flags  = IORESOURCE_IRQ,
> +	}, {
> +		.name   = "flexcard-dma",
> +		.start  = FLEXCARD_DMA_IRQ_CO,
> +		.end    = FLEXCARD_DMA_IRQ_CO,
> +		.flags  = IORESOURCE_IRQ,
> +	},
> +};
> +
> +static struct mfd_cell flexcard_dma_dev[] = {
> +	{
> +		.id = 0,

Why do you need this for a single device?

> +		.name = "flexcard-dma",
> +		.num_resources = ARRAY_SIZE(flexcard_dma_res),
> +		.resources = flexcard_dma_res,
> +	},
> +};
> +
>  irq_res(CC1CCYS);
>  irq_res(CC2CCYS);
>  irq_res(CC3CCYS);
> @@ -187,6 +215,32 @@ static int flexcard_clk_setup(struct flexcard_device *priv)
>  			       &pdev->resource[0], 0, NULL);
>  }
>  
> +static int flexcard_add_dma(struct flexcard_device *priv)
> +{
> +	struct pci_dev *pdev = priv->pdev;
> +
> +	/* check for a DMA capable firmware version*/
> +	if (priv->conf->fc_fw_ver.maj < DMA_MIN_FW_MAJOR)
> +		goto out;
> +
> +	if (priv->conf->fc_fw_ver.maj == DMA_MIN_FW_MAJOR) {
> +		if (priv->conf->fc_fw_ver.min < DMA_MIN_FW_MINOR)
> +			goto out;
> +		if ((priv->conf->fc_fw_ver.min == DMA_MIN_FW_MINOR) &&
> +		    (priv->conf->fc_fw_ver.dev < DMA_MIN_FW_UPDATE))
> +			goto out;
> +	}
> +
> +	return mfd_add_devices(&pdev->dev, 0, flexcard_dma_dev,
> +			       ARRAY_SIZE(flexcard_dma_dev),
> +			       &pdev->resource[0], 0, priv->dma_domain);
> +

Another call?

> +out:
> +	dev_info(&pdev->dev, "Firmware is not DMA capable\n");
> +
> +	return 0;
> +}
> +
>  static int flexcard_add_uio(struct flexcard_device *priv)
>  {
>  	struct pci_dev *pdev = priv->pdev;
> @@ -330,6 +384,12 @@ static int flexcard_probe(struct pci_dev *pdev,
>  		goto out_remove;
>  	}
>  
> +	ret = flexcard_add_dma(priv);
> +	if (ret) {
> +		dev_err(&pdev->dev, "unable to add DMA device: %d", ret);
> +		goto out_remove;
> +	}
> +
>  	ret = flexcard_add_uio(priv);
>  	if (ret) {
>  		dev_err(&pdev->dev, "unable to add irq UIO devices: %d", ret);
> diff --git a/drivers/mfd/flexcard/flexcard.h b/drivers/mfd/flexcard/flexcard.h
> index 0d05f78..ee6b773 100644
> --- a/drivers/mfd/flexcard/flexcard.h
> +++ b/drivers/mfd/flexcard/flexcard.h
> @@ -1,6 +1,11 @@
>  #ifndef __FLEXCARD_H
>  #define  __FLEXCARD_H
>  
> +/* The first FW Version supporting DMA is 6.4.0 */
> +#define DMA_MIN_FW_MAJOR	6
> +#define DMA_MIN_FW_MINOR	4
> +#define DMA_MIN_FW_UPDATE	0
> +
>  int flexcard_misc_add_attrs(struct device *dev);
>  void flexcard_misc_del_attrs(struct device *dev);
>  int flexcard_setup_irq(struct pci_dev *pdev);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ