linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Holger Dengler <dengler@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Peter Mahler <mahler@xkrug.com>,
	Juergen Bubeck <bubeck@xkrug.com>,
	Benedikt Spranger <b.spranger@linutronix.de>,
	Holger Dengler <dengler@linutronix.de>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 04/11] mfd: flexcard: add clocksrc device
Date: Wed, 25 Mar 2015 10:51:53 +0100	[thread overview]
Message-ID: <1427277120-16924-5-git-send-email-dengler@linutronix.de> (raw)
In-Reply-To: <1427277120-16924-1-git-send-email-dengler@linutronix.de>

From: Benedikt Spranger <b.spranger@linutronix.de>

The Flexcard offers a Flexray network synchronized counter with a
selectable resolution of 1us, 100ns or 10ns. Add an appropriate MFD-cell
to use the counter.

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 | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/drivers/mfd/flexcard/core.c b/drivers/mfd/flexcard/core.c
index 6477019..c73ae5c 100644
--- a/drivers/mfd/flexcard/core.c
+++ b/drivers/mfd/flexcard/core.c
@@ -28,6 +28,29 @@ static DEFINE_IDA(flexcard_ida);
 
 static const char drv_name[] = "flexcard";
 
+static struct resource flexcard_clk_res[] = {
+	{
+		.name   = "flexcard-clksrc",
+		.start  = 0x700,
+		.end    = 0x713,
+		.flags  = IORESOURCE_MEM,
+	}, {
+		.name   = "flexcard-reset",
+		.start  = 0x144,
+		.end    = 0x147,
+		.flags  = IORESOURCE_MEM,
+	},
+};
+
+static struct mfd_cell flexcard_clk_dev[] = {
+	{
+		.id = 0,
+		.name = "flexcard-clksrc",
+		.num_resources = ARRAY_SIZE(flexcard_clk_res),
+		.resources = flexcard_clk_res,
+	},
+};
+
 static int flexcard_tiny_can(struct flexcard_device *priv,
 			     int idx, int id, u32 offset)
 {
@@ -111,6 +134,21 @@ static int flexcard_tiny_probe(struct flexcard_device *priv)
 	return mfd_add_devices(&pdev->dev, 0, priv->cells, nr, NULL, 0, NULL);
 }
 
+static int flexcard_clk_setup(struct flexcard_device *priv)
+{
+	struct pci_dev *pdev = priv->pdev;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(flexcard_clk_res); i++)
+		flexcard_clk_res[i].parent = &pdev->resource[0];
+
+	flexcard_clk_dev[0].id = priv->cardnr;
+
+	return mfd_add_devices(&pdev->dev, 0, flexcard_clk_dev,
+			       ARRAY_SIZE(flexcard_clk_dev),
+			       &pdev->resource[0], 0, NULL);
+}
+
 static int flexcard_misc_open(struct inode *inode, struct file *filp)
 {
 	struct flexcard_device *priv =
@@ -233,6 +271,12 @@ static int flexcard_probe(struct pci_dev *pdev,
 		goto out_unmap;
 	}
 
+	ret = flexcard_clk_setup(priv);
+	if (ret) {
+		dev_err(&pdev->dev, "unable to register clksrc: %d\n", ret);
+		goto out_remove;
+	}
+
 	ret = misc_register(&priv->dev);
 	if (ret) {
 		dev_err(&pdev->dev, "unable to register miscdevice: %d\n", ret);
-- 
2.1.4


  parent reply	other threads:[~2015-03-25  9:52 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 ` Holger Dengler [this message]
2015-03-30  8:30   ` [PATCH 04/11] mfd: flexcard: add clocksrc device 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
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=1427277120-16924-5-git-send-email-dengler@linutronix.de \
    --to=dengler@linutronix.de \
    --cc=b.spranger@linutronix.de \
    --cc=bubeck@xkrug.com \
    --cc=lee.jones@linaro.org \
    --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).