LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.19] enable watchdog device on mpc834x platforms
@ 2006-12-14 10:41 Pieter-Jan Busschaert
  2006-12-14 15:41 ` Kumar Gala
  0 siblings, 1 reply; 3+ messages in thread
From: Pieter-Jan Busschaert @ 2006-12-14 10:41 UTC (permalink / raw)
  To: linuxppc-embedded

This patch adds the watchdog device for all mpc834x platforms. It
should be used with the mpc83xx_wdt driver which is already present in
the kernel.

Patch is made against a clean 2.6.19 kernel.

Signed-off-by: Pieter-Jan Busschaert
<pieterjan.busschaert+ppcembedded@gmail.com>

---
 arch/ppc/syslib/mpc83xx_devices.c |   17 ++++++++++++++++
 arch/ppc/syslib/mpc83xx_sys.c     |   40 ++++++++++++++++++++++----------------
 include/asm-ppc/mpc83xx.h         |    1
 include/linux/fsl_devices.h       |    4 +++
 4 files changed, 46 insertions(+), 16 deletions(-)

Index: linux-2.6.19/arch/ppc/syslib/mpc83xx_devices.c
===================================================================
--- linux-2.6.19.orig/arch/ppc/syslib/mpc83xx_devices.c
+++ linux-2.6.19/arch/ppc/syslib/mpc83xx_devices.c
@@ -64,6 +64,10 @@
 	{ },
 };

+static struct fsl_mpc83xx_wdt_platform_data mpc83xx_wdt_pdata = {
+	.freq		= 400000000,
+};
+
 struct platform_device ppc_sys_platform_devices[] = {
 	[MPC83xx_TSEC1] = {
 		.name = "fsl-gianfar",
@@ -232,6 +236,19 @@
 			},
 		},
 	},
+	[MPC83xx_WDT] = {
+		.name = "mpc83xx_wdt",
+		.id = 0,
+		.dev.platform_data = &mpc83xx_wdt_pdata,
+		.num_resources = 1,
+		.resource = (struct resource[]) {
+			{
+				.start	= 0x00200,
+				.end	= 0x002ff,
+				.flags	= IORESOURCE_MEM,
+			},
+		},
+	},
 };

 static int __init mach_mpc83xx_fixup(struct platform_device *pdev)
Index: linux-2.6.19/arch/ppc/syslib/mpc83xx_sys.c
===================================================================
--- linux-2.6.19.orig/arch/ppc/syslib/mpc83xx_sys.c
+++ linux-2.6.19/arch/ppc/syslib/mpc83xx_sys.c
@@ -22,96 +22,104 @@
 		.ppc_sys_name	= "8349E",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80500000,
-		.num_devices	= 9,
+		.num_devices	= 10,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
 			MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
-			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
+			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO,
+			MPC83xx_WDT
 		},
 	},
 	{
 		.ppc_sys_name	= "8349",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80510000,
-		.num_devices	= 8,
+		.num_devices	= 9,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
 			MPC83xx_IIC2, MPC83xx_DUART,
-			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
+			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO,
+			MPC83xx_WDT
 		},
 	},
 	{
 		.ppc_sys_name	= "8347E",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80520000,
-		.num_devices	= 9,
+		.num_devices	= 10,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
 			MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
-			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
+			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO,
+			MPC83xx_WDT
 		},
 	},
 	{
 		.ppc_sys_name	= "8347",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80530000,
-		.num_devices	= 8,
+		.num_devices	= 9,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
 			MPC83xx_IIC2, MPC83xx_DUART,
-			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
+			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO,
+			MPC83xx_WDT
 		},
 	},
 	{
 		.ppc_sys_name	= "8347E",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80540000,
-		.num_devices	= 9,
+		.num_devices	= 10,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
 			MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
-			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
+			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO,
+			MPC83xx_WDT
 		},
 	},
 	{
 		.ppc_sys_name	= "8347",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80550000,
-		.num_devices	= 8,
+		.num_devices	= 9,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
 			MPC83xx_IIC2, MPC83xx_DUART,
-			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
+			MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO,
+			MPC83xx_WDT
 		},
 	},
 	{
 		.ppc_sys_name	= "8343E",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80560000,
-		.num_devices	= 8,
+		.num_devices	= 9,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
 			MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
-			MPC83xx_USB2_DR, MPC83xx_MDIO
+			MPC83xx_USB2_DR, MPC83xx_MDIO,
+			MPC83xx_WDT
 		},
 	},
 	{
 		.ppc_sys_name	= "8343",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80570000,
-		.num_devices	= 7,
+		.num_devices	= 8,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
 			MPC83xx_IIC2, MPC83xx_DUART,
-			MPC83xx_USB2_DR, MPC83xx_MDIO
+			MPC83xx_USB2_DR, MPC83xx_MDIO,
+			MPC83xx_WDT
 		},
 	},
 	{	/* default match */
Index: linux-2.6.19/include/asm-ppc/mpc83xx.h
===================================================================
--- linux-2.6.19.orig/include/asm-ppc/mpc83xx.h
+++ linux-2.6.19/include/asm-ppc/mpc83xx.h
@@ -107,6 +107,7 @@
 	MPC83xx_USB2_DR,
 	MPC83xx_USB2_MPH,
 	MPC83xx_MDIO,
+	MPC83xx_WDT,
 	NUM_PPC_SYS_DEVS,
 };

Index: linux-2.6.19/include/linux/fsl_devices.h
===================================================================
--- linux-2.6.19.orig/include/linux/fsl_devices.h
+++ linux-2.6.19/include/linux/fsl_devices.h
@@ -119,6 +119,10 @@
 	u32	sysclk;
 };

+struct fsl_mpc83xx_wdt_platform_data {
+	unsigned int	freq;
+};
+
 /* Ethernet interface (phy management and speed)
 */
 enum enet_interface {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.6.19] enable watchdog device on mpc834x platforms
  2006-12-14 10:41 [PATCH 2.6.19] enable watchdog device on mpc834x platforms Pieter-Jan Busschaert
@ 2006-12-14 15:41 ` Kumar Gala
       [not found]   ` <950a36fb0612140801x39de08c2gd3ad5ce9ba04f900@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Kumar Gala @ 2006-12-14 15:41 UTC (permalink / raw)
  To: Pieter-Jan Busschaert; +Cc: linuxppc-embedded


On Dec 14, 2006, at 4:41 AM, Pieter-Jan Busschaert wrote:

> This patch adds the watchdog device for all mpc834x platforms. It
> should be used with the mpc83xx_wdt driver which is already present in
> the kernel.
>
> Patch is made against a clean 2.6.19 kernel.
>
> Signed-off-by: Pieter-Jan Busschaert
> <pieterjan.busschaert+ppcembedded@gmail.com>

Two things about this patch:
1. We've actively avoid taking non-bug fix patches to arch/ppc as we  
try to move people over to arch/powerpc.
2. You can't hard code freq in the platform data like that.  It's  
expected to be the bus frequency the device is running at.

- kumar

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.6.19] enable watchdog device on mpc834x platforms
       [not found]   ` <950a36fb0612140801x39de08c2gd3ad5ce9ba04f900@mail.gmail.com>
@ 2006-12-14 16:05     ` Kumar Gala
  0 siblings, 0 replies; 3+ messages in thread
From: Kumar Gala @ 2006-12-14 16:05 UTC (permalink / raw)
  To: Pieter-Jan Busschaert; +Cc: linuxppc-embedded@ozlabs.org ((((E-Mail))))


On Dec 14, 2006, at 10:01 AM, Pieter-Jan Busschaert wrote:

>> Two things about this patch:
>> 1. We've actively avoid taking non-bug fix patches to arch/ppc as we
>> try to move people over to arch/powerpc.
>> 2. You can't hard code freq in the platform data like that.  It's
>> expected to be the bus frequency the device is running at.
>
> The frequency is only used once in the driver to printk the
> watchdog-timeout in seconds. It doesn't affect the functionallity in
> any way. I looked at ways to get the cpu frequency dynamically in
> there, but didn't find a simple way to do it.

It does, in that the drive reports it on a WDIOC_GETTIMEOUT to user  
space.  (See how we use timeout_sec).

> But, because of your first comment, I suppose this patch will never
> enter the linux kernel, even if I get the frequency dynamically?

Most likely, but its still good to have the patches on the list for  
people to pull if they need them.

- k

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-12-14 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-14 10:41 [PATCH 2.6.19] enable watchdog device on mpc834x platforms Pieter-Jan Busschaert
2006-12-14 15:41 ` Kumar Gala
     [not found]   ` <950a36fb0612140801x39de08c2gd3ad5ce9ba04f900@mail.gmail.com>
2006-12-14 16:05     ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox