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]
Date:	Wed, 25 Mar 2015 10:51:53 +0100
From:	Holger Dengler <dengler@...utronix.de>
To:	linux-kernel@...r.kernel.org
Cc:	Peter Mahler <mahler@...ug.com>, Juergen Bubeck <bubeck@...ug.com>,
	Benedikt Spranger <b.spranger@...utronix.de>,
	Holger Dengler <dengler@...utronix.de>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Lee Jones <lee.jones@...aro.org>
Subject: [PATCH 04/11] mfd: flexcard: add clocksrc device

From: Benedikt Spranger <b.spranger@...utronix.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@...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 | 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

--
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