[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1481674313-30378-4-git-send-email-dengler@linutronix.de>
Date: Wed, 14 Dec 2016 01:11:44 +0100
From: Holger Dengler <dengler@...utronix.de>
To: Lee Jones <lee.jones@...aro.org>, Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Vinod Koul <vinod.koul@...el.com>
Cc: linux-kernel@...r.kernel.org, dmaengine@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
Sebastian Siewior <bigeasy@...utronix.de>,
Juergen Bubeck <bubeck@...ug.com>,
Peter Mahler <mahler@...ug.com>,
Holger Dengler <dengler@...utronix.de>,
Benedikt Spranger <b.spranger@...utronix.de>
Subject: [PATCH 03/12] mfd: flexcard: add posix clock mfd-cell
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: Benedikt Spranger <b.spranger@...utronix.de>
Signed-off-by: Holger Dengler <dengler@...utronix.de>
cc: Lee Jones <lee.jones@...aro.org>
---
drivers/mfd/flexcard_core.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/drivers/mfd/flexcard_core.c b/drivers/mfd/flexcard_core.c
index 2ee9089..73eb726 100644
--- a/drivers/mfd/flexcard_core.c
+++ b/drivers/mfd/flexcard_core.c
@@ -28,11 +28,32 @@
#define FLEXCARD_CONF_START 0x000
#define FLEXCARD_CONF_SIZE 0x13F
+#define FLEXCARD_CLKRST_START 0x144
+#define FLEXCARD_CLKRST_SIZE 0x3
#define FLEXCARD_NF_START 0x170
#define FLEXCARD_NF_SIZE 0x7
+#define FLEXCARD_CLK_START 0x700
+#define FLEXCARD_CLK_SIZE 0x13
static DEFINE_IDA(flexcard_ida);
+static struct resource flexcard_clk_res[] = {
+ DEFINE_RES_MEM_NAMED(FLEXCARD_CLK_START,
+ FLEXCARD_CLK_SIZE,
+ "flexcard-clock"),
+ DEFINE_RES_MEM_NAMED(FLEXCARD_CLKRST_START,
+ FLEXCARD_CLKRST_SIZE,
+ "flexcard-clock-reset"),
+};
+
+static struct mfd_cell flexcard_clk_dev[] = {
+ {
+ .name = "flexcard-clock",
+ .num_resources = ARRAY_SIZE(flexcard_clk_res),
+ .resources = flexcard_clk_res,
+ },
+};
+
static struct resource flexcard_misc_res[] = {
DEFINE_RES_MEM_NAMED(FLEXCARD_CONF_START,
FLEXCARD_CONF_SIZE,
@@ -55,6 +76,19 @@ enum flexcard_cell_id {
FLEXCARD_CELL_FLEXRAY,
};
+static int flexcard_clk_setup(struct flexcard_device *priv)
+{
+ struct pci_dev *pdev = priv->pdev;
+
+ flexcard_clk_dev[0].id = priv->cardnr;
+ flexcard_clk_res[0].parent = &pdev->resource[0];
+ flexcard_clk_res[1].parent = &pdev->resource[0];
+
+ return mfd_add_devices(&pdev->dev, 0, flexcard_clk_dev,
+ ARRAY_SIZE(flexcard_clk_dev),
+ &pdev->resource[0], 0, NULL);
+}
+
static int flexcard_misc_setup(struct flexcard_device *priv)
{
struct pci_dev *pdev = priv->pdev;
@@ -220,6 +254,12 @@ static int flexcard_probe(struct pci_dev *pdev,
goto out_mfd_dev_remove;
}
+ ret = flexcard_clk_setup(priv);
+ if (ret) {
+ dev_err(&pdev->dev, "unable to register clksrc: %d\n", ret);
+ goto out_mfd_dev_remove;
+ }
+
dev_info(&pdev->dev, "HW %02x.%02x.%02x FW %02x.%02x.%02x\n",
hw_ver.ver.maj, hw_ver.ver.min, hw_ver.ver.dev,
fw_ver.ver.maj, fw_ver.ver.min, fw_ver.ver.dev);
--
2.1.4
Powered by blists - more mailing lists