mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dale Farnsworth" <dale@farnsworth.org>
To: Wim Van Sebroeck <wim@iguana.be>, linux-kernel@vger.kernel.org
Subject: [PATCH 03/11] mv64x60_wdt: Add arch/powerpc platform support
Date: Tue, 24 Jul 2007 11:12:24 -0700	[thread overview]
Message-ID: <20070724181224.GC27445@xyzzy.farnsworth.org> (raw)
In-Reply-To: <20070724180738.GA27445@xyzzy.farnsworth.org>

Add support for arch/powerpc, specifically for  the prpmc2800 platform.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
 arch/powerpc/boot/dts/prpmc2800.dts |    6 ++
 arch/powerpc/sysdev/mv64x60_dev.c   |   64 ++++++++++++++++++++++++++
 drivers/char/watchdog/mv64x60_wdt.c |    2 
 include/asm-ppc/mv64x60.h           |    8 ---
 include/linux/mv643xx.h             |    8 +++
 5 files changed, 79 insertions(+), 9 deletions(-)

Index: linux-2.6-powerpc-wdt/arch/powerpc/boot/dts/prpmc2800.dts
===================================================================
--- linux-2.6-powerpc-wdt.orig/arch/powerpc/boot/dts/prpmc2800.dts	2007-07-20 16:41:08.000000000 +0000
+++ linux-2.6-powerpc-wdt/arch/powerpc/boot/dts/prpmc2800.dts	2007-07-20 16:42:09.000000000 +0000
@@ -207,6 +207,12 @@
 			interrupt-parent = <&/mv64x60/pic>;
 		};
 
+		wdt@b410 {			/* watchdog timer */
+			compatible = "marvell,mv64x60-wdt";
+			reg = <b410 8>;
+			timeout = <a>;		/* wdt timeout in seconds */
+		};
+
 		i2c@c000 {
 			device_type = "i2c";
 			compatible = "marvell,mv64x60-i2c";
Index: linux-2.6-powerpc-wdt/arch/powerpc/sysdev/mv64x60_dev.c
===================================================================
--- linux-2.6-powerpc-wdt.orig/arch/powerpc/sysdev/mv64x60_dev.c	2007-07-20 16:41:08.000000000 +0000
+++ linux-2.6-powerpc-wdt/arch/powerpc/sysdev/mv64x60_dev.c	2007-07-20 16:45:26.000000000 +0000
@@ -390,6 +390,61 @@ error:
 	return err;
 }
 
+/*
+ * Create mv64x60_wdt platform devices
+ */
+static int __init mv64x60_wdt_device_setup(struct device_node *np, int id)
+{
+	struct resource r;
+	struct platform_device *pdev;
+	struct mv64x60_wdt_pdata pdata;
+	const unsigned int *prop;
+	int err;
+
+	err = of_address_to_resource(np, 0, &r);
+	if (err)
+		return err;
+
+	memset(&pdata, 0, sizeof(pdata));
+
+	prop = of_get_property(np, "timeout", NULL);
+	if (!prop)
+		return -ENODEV;
+	pdata.timeout = *prop;
+
+	np = of_get_parent(np);
+	if (!np)
+		return -ENODEV;
+
+	prop = of_get_property(np, "clock-frequency", NULL);
+	of_node_put(np);
+	if (!prop)
+		return -ENODEV;
+	pdata.bus_clk = *prop / 1000000; /* wdt driver wants freq in MHz */
+
+	pdev = platform_device_alloc(MV64x60_WDT_NAME, id);
+	if (!pdev)
+		return -ENOMEM;
+
+	err = platform_device_add_resources(pdev, &r, 1);
+	if (err)
+		goto error;
+
+	err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
+	if (err)
+		goto error;
+
+	err = platform_device_add(pdev);
+	if (err)
+		goto error;
+
+	return 0;
+
+error:
+	platform_device_put(pdev);
+	return err;
+}
+
 static int __init mv64x60_device_setup(void)
 {
 	struct device_node *np = NULL;
@@ -414,6 +469,15 @@ static int __init mv64x60_device_setup(v
 		if ((err = mv64x60_i2c_device_setup(np, id)))
 			goto error;
 
+	/* support up to one watchdog timer */
+	np = of_find_compatible_node(np, NULL, "marvell,mv64x60-wdt");
+	if (np) {
+		if ((err = mv64x60_wdt_device_setup(np, id)))
+			goto error;
+		of_node_put(np);
+	}
+
+
 	return 0;
 
 error:
Index: linux-2.6-powerpc-wdt/drivers/char/watchdog/mv64x60_wdt.c
===================================================================
--- linux-2.6-powerpc-wdt.orig/drivers/char/watchdog/mv64x60_wdt.c	2007-07-20 16:41:37.000000000 +0000
+++ linux-2.6-powerpc-wdt/drivers/char/watchdog/mv64x60_wdt.c	2007-07-20 16:48:00.000000000 +0000
@@ -23,7 +23,7 @@
 #include <linux/watchdog.h>
 #include <linux/platform_device.h>
 
-#include <asm/mv64x60.h>
+#include <linux/mv643xx.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
Index: linux-2.6-powerpc-wdt/include/asm-ppc/mv64x60.h
===================================================================
--- linux-2.6-powerpc-wdt.orig/include/asm-ppc/mv64x60.h	2007-07-20 16:41:11.000000000 +0000
+++ linux-2.6-powerpc-wdt/include/asm-ppc/mv64x60.h	2007-07-20 16:42:09.000000000 +0000
@@ -120,14 +120,6 @@ extern spinlock_t mv64x60_lock;
 
 #define	MV64x60_64BIT_WIN_COUNT			24
 
-/* Watchdog Platform Device, Driver Data */
-#define	MV64x60_WDT_NAME			"mv64x60_wdt"
-
-struct mv64x60_wdt_pdata {
-	int	timeout;	/* watchdog expiry in seconds, default 10 */
-	int	bus_clk;	/* bus clock in MHz, default 133 */
-};
-
 /*
  * Define a structure that's used to pass in config information to the
  * core routines.
Index: linux-2.6-powerpc-wdt/include/linux/mv643xx.h
===================================================================
--- linux-2.6-powerpc-wdt.orig/include/linux/mv643xx.h	2007-07-20 16:41:08.000000000 +0000
+++ linux-2.6-powerpc-wdt/include/linux/mv643xx.h	2007-07-20 16:42:09.000000000 +0000
@@ -1306,4 +1306,12 @@ struct mv643xx_eth_platform_data {
 	u8		mac_addr[6];	/* mac address if non-zero*/
 };
 
+/* Watchdog Platform Device, Driver Data */
+#define	MV64x60_WDT_NAME			"mv64x60_wdt"
+
+struct mv64x60_wdt_pdata {
+	int	timeout;	/* watchdog expiry in seconds, default 10 */
+	int	bus_clk;	/* bus clock in MHz, default 133 */
+};
+
 #endif /* __ASM_MV643XX_H */


  parent reply	other threads:[~2007-07-24 18:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-24 18:07 [PATCH 01/11] mv64x60_wdt: set up platform_device in platform code Dale Farnsworth
2007-07-24 18:09 ` [PATCH 02/11] mv64x60_wdt: Get register address from platform data Dale Farnsworth
2007-07-24 18:12 ` Dale Farnsworth [this message]
2007-07-24 18:13 ` [PATCH 04/11] mv64x60_wdt: Check return value of nonseekable_open Dale Farnsworth
2007-07-24 18:14 ` [PATCH 05/11] mv64x60_wdt: Fix WDIOC_GETTIMEOUT return value Dale Farnsworth
2007-07-24 18:15 ` [PATCH 06/11] mv64x60_wdt: Support for WDIOC_SETTIMEOUT ioctl Dale Farnsworth
2007-07-24 18:16 ` [PATCH 07/11] mv64x60_wdt: Add WDIOC_SETOPTIONS ioctl support Dale Farnsworth
2007-07-24 18:17 ` [PATCH 08/11] mv64x60_wdt: Add a module parameter to change nowayout setting Dale Farnsworth
2007-07-24 18:18 ` [PATCH 09/11] mv64x60_wdt: Support the WDIOF_MAGICCLOSE feature Dale Farnsworth
2007-07-24 18:19 ` [PATCH 10/11] mv64x60_wdt: disable watchdog timer when driver is probed Dale Farnsworth
2007-07-24 18:20 ` [PATCH 11/11] mv64x60_wdt_cleanup_low_level_wdt_code.patch Dale Farnsworth
2007-07-24 18:31   ` [PATCH 11/11, corrected] mv64x60_wdt: Rework the timeout register manipulation Dale Farnsworth

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=20070724181224.GC27445@xyzzy.farnsworth.org \
    --to=dale@farnsworth.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wim@iguana.be \
    /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

Powered by JetHome