linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Holger Dengler <dengler@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Peter Mahler <mahler@xkrug.com>,
	Juergen Bubeck <bubeck@xkrug.com>,
	Benedikt Spranger <b.spranger@linutronix.de>,
	Samuel Ortiz <sameo@linux.intel.com>
Subject: Re: [PATCH 08/11] mfd: flexcard: add DMA device
Date: Mon, 30 Mar 2015 09:59:29 +0100	[thread overview]
Message-ID: <20150330085929.GS457@x1> (raw)
In-Reply-To: <1427277120-16924-9-git-send-email-dengler@linutronix.de>

On Wed, 25 Mar 2015, Holger Dengler wrote:

> From: Benedikt Spranger <b.spranger@linutronix.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@linutronix.de>
> Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
> cc: Samuel Ortiz <sameo@linux.intel.com>
> cc: Lee Jones <lee.jones@linaro.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

  reply	other threads:[~2015-03-30  8:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25  9:51 [PATCH 00/11] Eberspaecher Flexcard PMC II base support Holger Dengler
2015-03-25  9:51 ` [PATCH 01/11] mfd: Eberspaecher Flexcard PMC II Carrier Board support Holger Dengler
2015-03-30  7:57   ` Lee Jones
2015-03-25  9:51 ` [PATCH 02/11] mfd: flexcard: add flexcard core device Holger Dengler
2015-03-30  8:06   ` Lee Jones
2015-03-25  9:51 ` [PATCH 03/11] mfd: flexcard: add device attributes Holger Dengler
2015-03-30  8:15   ` Lee Jones
2015-03-25  9:51 ` [PATCH 04/11] mfd: flexcard: add clocksrc device Holger Dengler
2015-03-30  8:30   ` Lee Jones
2015-03-25  9:51 ` [PATCH 05/11] mfd: flexcard: add interrupt support Holger Dengler
2015-03-30  8:46   ` Lee Jones
2015-03-25  9:51 ` [PATCH 06/11] mfd: flexcard: add DMA interrupt domain Holger Dengler
2015-03-30  8:50   ` Lee Jones
2015-03-25  9:51 ` [PATCH 07/11] mfd: flexcard: add UIO IRQ devices Holger Dengler
2015-03-30  8:57   ` Lee Jones
2015-03-25  9:51 ` [PATCH 08/11] mfd: flexcard: add DMA device Holger Dengler
2015-03-30  8:59   ` Lee Jones [this message]
2015-03-25  9:51 ` [PATCH 09/11] mfd: flexcard: add DMA ringbuffer demux driver Holger Dengler
2015-03-30  9:02   ` Lee Jones
2015-03-25  9:51 ` [PATCH 10/11] clocksource: flexcard: Add basic timestamp counter support Holger Dengler
2015-03-26  9:41   ` Daniel Lezcano
2015-03-26 11:01     ` Holger Dengler
2015-03-26 16:34       ` John Stultz
2015-03-27 12:27         ` Holger Dengler
2015-03-25  9:52 ` [PATCH 11/11] clocksource: flexcard: Support timestamp trigger selection Holger Dengler

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=20150330085929.GS457@x1 \
    --to=lee.jones@linaro.org \
    --cc=b.spranger@linutronix.de \
    --cc=bubeck@xkrug.com \
    --cc=dengler@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mahler@xkrug.com \
    --cc=sameo@linux.intel.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;
as well as URLs for NNTP newsgroup(s).