Skip to contentSkip to conversation

Initial implementation of Intel MID watchdog driver

PATCH Superseded David Cohen 5 participants 44 messages Apr 8, 2014 – Apr 16, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Initial implementation of Intel MID watchdog driver

Hi,

This patch set is an initial implementation of a generic Intel MID watchdog driver.
It currently supports Intel Merrifield only, but will extend to other SoCs of MID family.

Br, David

--
David Cohen (2):
watchdog: add Intel MID watchdog driver support
x86: intel-mid: add watchdog platform code for Merrifield

 arch/x86/platform/intel-mid/device_libs/Makefile   |   1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  |  43 +++++
 drivers/watchdog/Kconfig                           |  12 ++
 drivers/watchdog/Makefile                          |   1 +
 drivers/watchdog/intel-mid_wdt.c                   | 209 +++++++++++++++++++++
 5 files changed, 266 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
Signature · 1 line
1.9.0
#1 lore raw

PATCH 1/2 watchdog: add Intel MID watchdog driver support

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

---
 drivers/watchdog/Kconfig         |  12 +++
 drivers/watchdog/Makefile        |   1 +
 drivers/watchdog/intel-mid_wdt.c | 209 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 222 insertions(+)
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
drivers/watchdog/Kconfig +12 -0
index 79d25894343a..4da09b8b2f11 100644
@@ -643,6 +643,18 @@ config INTEL_SCU_WATCHDOG
 
 	  To compile this driver as a module, choose M here.
 
+config INTEL_MID_WATCHDOG
+	bool "Intel MID SCU Watchdog Mobile Platforms"
+	depends on X86_INTEL_MID && WATCHDOG_CORE
+	---help---
+	  Watchdog timer driver built into the Intel SCU for Intel MID
+	  Platforms.
+
+	  This driver currently supports only the watchdog evolution
+	  implementation in SCU, available for Merrifield generation.
+
+	  To compile this driver as a module, choose M here.
+
 config ITCO_WDT
 	tristate "Intel TCO Timer/Watchdog"
 	depends on (X86 || IA64) && PCI
drivers/watchdog/Makefile +1 -0
index 985a66cda76f..b927e7496eb4 100644
@@ -113,6 +113,7 @@ obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o
 obj-$(CONFIG_MACHZ_WDT) += machzwd.o
 obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
 obj-$(CONFIG_INTEL_SCU_WATCHDOG) += intel_scu_watchdog.o
+obj-$(CONFIG_INTEL_MID_WATCHDOG) += intel-mid_wdt.o
 
 # M32R Architecture
 
drivers/watchdog/intel-mid_wdt.c new file +209 -0

209 lines not on this page · raw message

Signature · 1 line
1.9.0
#2 lore raw

Re: [PATCH 1/2] watchdog: add Intel MID watchdog driver support

Quoted 23 lines · David Cohen

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

---
 drivers/watchdog/Kconfig         |  12 +++
 drivers/watchdog/Makefile        |   1 +
 drivers/watchdog/intel-mid_wdt.c | 209 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 222 insertions(+)
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
drivers/watchdog/Kconfig +1 -0
index 79d25894343a..4da09b8b2f11 100644
@@ -643,6 +643,18 @@ config INTEL_SCU_WATCHDOG
 
 	  To compile this driver as a module, choose M here.
 
+config INTEL_MID_WATCHDOG

drivers/watchdog/Kconfig config INTEL_SCU_WATCHDOG · line 656

Quoted 10 lines
drivers/watchdog/Kconfig +10 -0
+	bool "Intel MID SCU Watchdog Mobile Platforms"
+	depends on X86_INTEL_MID && WATCHDOG_CORE
+	---help---
+	  Watchdog timer driver built into the Intel SCU for Intel MID
+	  Platforms.
+
+	  This driver currently supports only the watchdog evolution
+	  implementation in SCU, available for Merrifield generation.
+
+	  To compile this driver as a module, choose M here.

Does choosing M work when INTEL_MID_WATCHDOG is a bool? and why is INTEL_MID_WATCHDOG a bool?

Quoted 4 lines
drivers/watchdog/Kconfig +1 -0
+
 config ITCO_WDT
 	tristate "Intel TCO Timer/Watchdog"
 	depends on (X86 || IA64) && PCI
Signature · 1 line
~Randy
#3 lore raw

Re: [PATCH 1/2] watchdog: add Intel MID watchdog driver support

Quoted 23 lines · Randy Dunlap
Quoted 22 lines · David Cohen

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

---
 drivers/watchdog/Kconfig         |  12 +++
 drivers/watchdog/Makefile        |   1 +
 drivers/watchdog/intel-mid_wdt.c | 209 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 222 insertions(+)
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
drivers/watchdog/Kconfig +0 -0
index 79d25894343a..4da09b8b2f11 100644
@@ -643,6 +643,18 @@ config INTEL_SCU_WATCHDOG
 
 	  To compile this driver as a module, choose M here.
 
Quoted 14 lines

drivers/watchdog/Kconfig config INTEL_SCU_WATCHDOG · line 656

Quoted 11 lines
drivers/watchdog/Kconfig +11 -0
+config INTEL_MID_WATCHDOG
+	bool "Intel MID SCU Watchdog Mobile Platforms"
+	depends on X86_INTEL_MID && WATCHDOG_CORE
+	---help---
+	  Watchdog timer driver built into the Intel SCU for Intel MID
+	  Platforms.
+
+	  This driver currently supports only the watchdog evolution
+	  implementation in SCU, available for Merrifield generation.
+
+	  To compile this driver as a module, choose M here.

Does choosing M work when INTEL_MID_WATCHDOG is a bool? and why is INTEL_MID_WATCHDOG a bool?

The error here is the left over line from the template I used. There should be no mention about choosing M.
It's bool because the watchdog is started by default on fw. We need this driver probed during boot to pet/kick/ping asap. IMHO It makes not much sense to compile it as module.

Br, David

Quoted 9 lines
Quoted 5 lines
drivers/watchdog/Kconfig +1 -0
+
 config ITCO_WDT
 	tristate "Intel TCO Timer/Watchdog"
 	depends on (X86 || IA64) && PCI
Signature · 1 line
~Randy
maintainer
#4 lore raw

Re: [PATCH 1/2] watchdog: add Intel MID watchdog driver support

Quoted 39 lines · David Cohen
Quoted 23 lines · Randy Dunlap
Quoted 22 lines · David Cohen

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

---
  drivers/watchdog/Kconfig         |  12 +++
  drivers/watchdog/Makefile        |   1 +
  drivers/watchdog/intel-mid_wdt.c | 209 +++++++++++++++++++++++++++++++++++++++
  3 files changed, 222 insertions(+)

create mode 100644 drivers/watchdog/intel-mid_wdt.c

drivers/watchdog/Kconfig +0 -0
index 79d25894343a..4da09b8b2f11 100644
@@ -643,6 +643,18 @@ config INTEL_SCU_WATCHDOG
 
  	  To compile this driver as a module, choose M here.
 
Quoted 14 lines

drivers/watchdog/Kconfig config INTEL_SCU_WATCHDOG · line 656

Quoted 11 lines
drivers/watchdog/Kconfig +11 -0
+config INTEL_MID_WATCHDOG
+	bool "Intel MID SCU Watchdog Mobile Platforms"
+	depends on X86_INTEL_MID && WATCHDOG_CORE
+	---help---
+	  Watchdog timer driver built into the Intel SCU for Intel MID
+	  Platforms.
+
+	  This driver currently supports only the watchdog evolution
+	  implementation in SCU, available for Merrifield generation.
+
+	  To compile this driver as a module, choose M here.

Does choosing M work when INTEL_MID_WATCHDOG is a bool? and why is INTEL_MID_WATCHDOG a bool?

Quoted 6 lines

The error here is the left over line from the template I used. There should be no mention about choosing M.
It's bool because the watchdog is started by default on fw. We need this driver probed during boot to pet/kick/ping asap. IMHO It makes not much sense to compile it as module.

Is that true for your firmware, but for all users of the supported set of devices ?

The reason for having modules is to be able to load the driver only when needed, while using the same distribution for multiple platforms. So either you are forcing the driver to be loaded on every hardware which has it enabled, or you are limiting the scope of a distribution to one specific CPU. Neither seems desirable.

If _you_ want to build the driver into the kernel, you always can. But you have to have a better reason than that to enforce it on everyone else.

Guenter

#5 lore raw

Re: [PATCH 1/2] watchdog: add Intel MID watchdog driver support

Quoted 47 lines · Guenter Roeck
Quoted 39 lines · David Cohen
Quoted 23 lines · Randy Dunlap
Quoted 22 lines · David Cohen

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

---
 drivers/watchdog/Kconfig         |  12 +++
 drivers/watchdog/Makefile        |   1 +
 drivers/watchdog/intel-mid_wdt.c | 209 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 222 insertions(+)
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
drivers/watchdog/Kconfig +0 -0
index 79d25894343a..4da09b8b2f11 100644
@@ -643,6 +643,18 @@ config INTEL_SCU_WATCHDOG
 
 	  To compile this driver as a module, choose M here.
 
Quoted 14 lines

drivers/watchdog/Kconfig config INTEL_SCU_WATCHDOG · line 656

Quoted 11 lines
drivers/watchdog/Kconfig +11 -0
+config INTEL_MID_WATCHDOG
+	bool "Intel MID SCU Watchdog Mobile Platforms"
+	depends on X86_INTEL_MID && WATCHDOG_CORE
+	---help---
+	  Watchdog timer driver built into the Intel SCU for Intel MID
+	  Platforms.
+
+	  This driver currently supports only the watchdog evolution
+	  implementation in SCU, available for Merrifield generation.
+
+	  To compile this driver as a module, choose M here.

Does choosing M work when INTEL_MID_WATCHDOG is a bool? and why is INTEL_MID_WATCHDOG a bool?

Quoted 6 lines

The error here is the left over line from the template I used. There should be no mention about choosing M.
It's bool because the watchdog is started by default on fw. We need this driver probed during boot to pet/kick/ping asap. IMHO It makes not much sense to compile it as module.

Quoted 2 lines

Is that true for your firmware, but for all users of the supported set of devices ?

I don't think there is another fw to support same device. But...

Quoted 10 lines

The reason for having modules is to be able to load the driver only when needed, while using the same distribution for multiple platforms. So either you are forcing the driver to be loaded on every hardware which has it enabled, or you are limiting the scope of a distribution to one specific CPU. Neither seems desirable.

If _you_ want to build the driver into the kernel, you always can. But you have to have a better reason than that to enforce it on everyone else.

... when we're stuck so much time working with Android we forget there is life out there too. It really makes no sense "bool". I'll fix it in next version.

Br, David

Quoted 3 lines

Guenter

maintainer
#6 lore raw

Re: [PATCH 1/2] watchdog: add Intel MID watchdog driver support

In reply to David Cohen
Quoted 4 lines · David Cohen

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

How does this compare with the existing SCU watchdog driver (intel_scu_watchdog) ? The watchdog IPC message (0xf8) seems to be the same, so there must be at least some overlap. Would it be possible to have just one watchdog driver serving the different SCU based devices ?

Quoted 15 lines
---
  drivers/watchdog/Kconfig         |  12 +++
  drivers/watchdog/Makefile        |   1 +
  drivers/watchdog/intel-mid_wdt.c | 209 +++++++++++++++++++++++++++++++++++++++
  3 files changed, 222 insertions(+)

create mode 100644 drivers/watchdog/intel-mid_wdt.c

drivers/watchdog/Kconfig +0 -0
index 79d25894343a..4da09b8b2f11 100644

drivers/watchdog/Kconfig config INTEL_SCU_WATCHDOG · line 648

Quoted 6 lines
drivers/watchdog/Kconfig +3 -0
@@ -643,6 +643,18 @@ config INTEL_SCU_WATCHDOG
 
  	  To compile this driver as a module, choose M here.
 
+config INTEL_MID_WATCHDOG
+	bool "Intel MID SCU Watchdog Mobile Platforms"
+	depends on X86_INTEL_MID && WATCHDOG_CORE

All other watchdog drivers using the watchdog core use
select WATCHDOG_CORE

so this one should do the same.

Guenter

#7 lore raw

Re: [PATCH 1/2] watchdog: add Intel MID watchdog driver support

Quoted 11 lines · On Tue, 08 Apr 2014 17:17:34 -0700 Guenter Roeck <[email protected]> wrote:
Quoted 4 lines · David Cohen

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

How does this compare with the existing SCU watchdog driver (intel_scu_watchdog) ? The watchdog IPC message (0xf8) seems to be the same, so there must be at least some overlap. Would it be possible to have just one watchdog driver serving the different SCU based devices ?

There are enough differences that we'd end up with one spaghetti driver full of conditionals rather than two simple clean drivers.

Alan

#8 lore raw

PATCH 2/2 x86: intel-mid: add watchdog platform code for Merrifield

In reply to David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 43 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
1.9.0
#9 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 3 lines · On Tue, 8 Apr 2014 13:59:04 -0700 David Cohen <[email protected]>…

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

Before going too far down that path have you considered compiling in a devicetree instead ?

Alan

#10 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 9 lines · One Thousand Gnomes
Quoted 3 lines · On Tue, 8 Apr 2014 13:59:04 -0700 David Cohen <[email protected]>…

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

Before going too far down that path have you considered compiling in a devicetree instead ?

I'm getting curious: How can I use device-tree on x86(_64)?
Reading the dependencies from CONFIG_OF it can only be used on 32bit systems with some special hardware bases. So, how to use otherwise?

Best regards,
Alexander

Signature · 12 lines
Dipl.-Inf. Alexander Stein

SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Tel.: 03765 38600-1156
Fax: 03765 38600-4100
Email: [email protected]
Website: www.systec-electronic.com
 
Managing Director: Dipl.-Phys. Siegmar Schmidt
Commercial registry: Amtsgericht Chemnitz, HRB 28082
#11 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 3 lines

I'm getting curious: How can I use device-tree on x86(_64)?
Reading the dependencies from CONFIG_OF it can only be used on 32bit systems with some special hardware bases. So, how to use otherwise?

There isn't any fundamental thing tying device tree to a given architecture or 32bitness, it's just that sane PC architectures use ACPI to enumerate devices, and/or have a discoverable bus architecture.

Some of the phones don't so this now becoems a point of consideration. In fact it's already also used on CE4100 (which is an embedded media SoC found in some TV devices and set-top boxes) and on the OLPC (One laptop per child). There is no intrinsic reason it couldn't be used in other x86 special cases.

If its PC shaped however it probably has ACPI and ACPI and DT are not a 1:1 mapping. ACPI has method invocations, and various firmware provided interfaces such as the EC, Device tree is better at some other bits.

Converting the phones to embedded device tree rather than adding a billion little platform files on the other hand seems to me like a no-brainer.

Alan

#12 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 14 lines · One Thousand Gnomes
Quoted 3 lines

I'm getting curious: How can I use device-tree on x86(_64)?
Reading the dependencies from CONFIG_OF it can only be used on 32bit systems with some special hardware bases. So, how to use otherwise?

There isn't any fundamental thing tying device tree to a given architecture or 32bitness, it's just that sane PC architectures use ACPI to enumerate devices, and/or have a discoverable bus architecture.

Some of the phones don't so this now becoems a point of consideration. In fact it's already also used on CE4100 (which is an embedded media SoC found in some TV devices and set-top boxes) and on the OLPC (One laptop per child). There is no intrinsic reason it couldn't be used in other x86 special cases.

Quoted 3 lines

If its PC shaped however it probably has ACPI and ACPI and DT are not a 1:1 mapping. ACPI has method invocations, and various firmware provided interfaces such as the EC, Device tree is better at some other bits.

Yep, like SPI devices on embedded x86 hardware.

Quoted 3 lines

Converting the phones to embedded device tree rather than adding a billion little platform files on the other hand seems to me like a no-brainer.

I found http://thread.gmane.org/gmane.linux.drivers.devicetree/4475. Why didn't that get into mainline?

Best regards,
Alexander

Signature · 12 lines
Dipl.-Inf. Alexander Stein

SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Tel.: 03765 38600-1156
Fax: 03765 38600-4100
Email: [email protected]
Website: www.systec-electronic.com
 
Managing Director: Dipl.-Phys. Siegmar Schmidt
Commercial registry: Amtsgericht Chemnitz, HRB 28082
maintainer
#13 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 19 lines · Alexander Stein
Quoted 14 lines · One Thousand Gnomes
Quoted 3 lines

I'm getting curious: How can I use device-tree on x86(_64)?
Reading the dependencies from CONFIG_OF it can only be used on 32bit systems with some special hardware bases. So, how to use otherwise?

There isn't any fundamental thing tying device tree to a given architecture or 32bitness, it's just that sane PC architectures use ACPI to enumerate devices, and/or have a discoverable bus architecture.

Some of the phones don't so this now becoems a point of consideration. In fact it's already also used on CE4100 (which is an embedded media SoC found in some TV devices and set-top boxes) and on the OLPC (One laptop per child). There is no intrinsic reason it couldn't be used in other x86 special cases.

Quoted 3 lines

If its PC shaped however it probably has ACPI and ACPI and DT are not a 1:1 mapping. ACPI has method invocations, and various firmware provided interfaces such as the EC, Device tree is better at some other bits.

Quoted 8 lines

Yep, like SPI devices on embedded x86 hardware.

Quoted 3 lines

Converting the phones to embedded device tree rather than adding a billion little platform files on the other hand seems to me like a no-brainer.

I found http://thread.gmane.org/gmane.linux.drivers.devicetree/4475. Why didn't that get into mainline?

Isn't that patch set in mainline ?

We are working on a patch set to make DT support on x86 more widely available. Thierry Reding did some work on it a while ago. Some of it is upstream, other parts are available in
https://github.com/avionic-design/linux/commits/medatom/master

We'll see if and what will be accepted upstream.

Guenter

#14 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 22 lines · Guenter Roeck
Quoted 21 lines · Alexander Stein
Quoted 14 lines · One Thousand Gnomes
Quoted 3 lines

I'm getting curious: How can I use device-tree on x86(_64)?
Reading the dependencies from CONFIG_OF it can only be used on 32bit systems with some special hardware bases. So, how to use otherwise?

There isn't any fundamental thing tying device tree to a given architecture or 32bitness, it's just that sane PC architectures use ACPI to enumerate devices, and/or have a discoverable bus architecture.

Some of the phones don't so this now becoems a point of consideration. In fact it's already also used on CE4100 (which is an embedded media SoC found in some TV devices and set-top boxes) and on the OLPC (One laptop per child). There is no intrinsic reason it couldn't be used in other x86 special cases.

Quoted 3 lines

If its PC shaped however it probably has ACPI and ACPI and DT are not a 1:1 mapping. ACPI has method invocations, and various firmware provided interfaces such as the EC, Device tree is better at some other bits.

Yep, like SPI devices on embedded x86 hardware.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Converting the phones to embedded device tree rather than adding a billion little platform files on the other hand seems to me like a no-brainer.

I found http://thread.gmane.org/gmane.linux.drivers.devicetree/4475. Why didn't that get into mainline?

Isn't that patch set in mainline ?

Oh, I see that this patch didn't get included 1:1 as shown in that link. I only checked USE_OF in arch/x86/Kconfig which didn't get included that way :(

Quoted 6 lines

We are working on a patch set to make DT support on x86 more widely available. Thierry Reding did some work on it a while ago. Some of it is upstream, other parts are available in
https://github.com/avionic-design/linux/commits/medatom/master

We'll see if and what will be accepted upstream.

As far as I can see, CONFIG_OF is only selected if a specific hardware is enabled.

Regards,
Alexander

Signature · 12 lines
Dipl.-Inf. Alexander Stein

SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Tel.: 03765 38600-1156
Fax: 03765 38600-4100
Email: [email protected]
Website: www.systec-electronic.com
 
Managing Director: Dipl.-Phys. Siegmar Schmidt
Commercial registry: Amtsgericht Chemnitz, HRB 28082
maintainer
#15 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 34 lines · Alexander Stein
Quoted 22 lines · Guenter Roeck
Quoted 21 lines · Alexander Stein
Quoted 14 lines · One Thousand Gnomes
Quoted 3 lines

I'm getting curious: How can I use device-tree on x86(_64)?
Reading the dependencies from CONFIG_OF it can only be used on 32bit systems with some special hardware bases. So, how to use otherwise?

There isn't any fundamental thing tying device tree to a given architecture or 32bitness, it's just that sane PC architectures use ACPI to enumerate devices, and/or have a discoverable bus architecture.

Some of the phones don't so this now becoems a point of consideration. In fact it's already also used on CE4100 (which is an embedded media SoC found in some TV devices and set-top boxes) and on the OLPC (One laptop per child). There is no intrinsic reason it couldn't be used in other x86 special cases.

Quoted 3 lines

If its PC shaped however it probably has ACPI and ACPI and DT are not a 1:1 mapping. ACPI has method invocations, and various firmware provided interfaces such as the EC, Device tree is better at some other bits.

Yep, like SPI devices on embedded x86 hardware.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Converting the phones to embedded device tree rather than adding a billion little platform files on the other hand seems to me like a no-brainer.

I found http://thread.gmane.org/gmane.linux.drivers.devicetree/4475. Why didn't that get into mainline?

Isn't that patch set in mainline ?

Oh, I see that this patch didn't get included 1:1 as shown in that link. I only checked USE_OF in arch/x86/Kconfig which didn't get included that way :(

Quoted 9 lines
Quoted 6 lines

We are working on a patch set to make DT support on x86 more widely available. Thierry Reding did some work on it a while ago. Some of it is upstream, other parts are available in
https://github.com/avionic-design/linux/commits/medatom/master

We'll see if and what will be accepted upstream.

As far as I can see, CONFIG_OF is only selected if a specific hardware is enabled.

Correct, and I expect that won't change. Default on x86 platform is ACPI.

Guenter

#16 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

In reply to Alexander Stein
Quoted 3 lines
Quoted 1 line

We'll see if and what will be accepted upstream.

As far as I can see, CONFIG_OF is only selected if a specific hardware is enabled.

For conventional PC it makes no sense. For non conventional devices - well Kconfig is also convered by the GPL ;-)

Alan

#17 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

In reply to One Thousand Gnomes
Quoted 9 lines · One Thousand Gnomes
Quoted 3 lines · On Tue, 8 Apr 2014 13:59:04 -0700 David Cohen <[email protected]>…

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

Before going too far down that path have you considered compiling in a devicetree instead ?

This is the only device missing from SFI table I am aware of. The original implementation is to register the watchdog without a device/driver match. i.e. directly from the init call. Then the init call has a conditional check if it's Merrifield with intel_mid_identify_cpu() to avoid it being registered in !Merrifield platforms. But I want to lock this intel_mid_identify_cpu() inside intel_mid platform code, since it's too ugly to stay inside drivers.

If we figure out there's more devices missing from SFI table, then we could revisit here and consider another approach.

Br, David

Quoted 2 lines

Alan

maintainer
#18 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

In reply to David Cohen
Quoted 6 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---

Does it really make sense to have this as separate patch ?

It is quite common for watchdog (and many other) drivers to register the driver and instantiate the device. I think it would be better and more consistent to have both patches merged into one.

Thanks,
Guenter

#19 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 8 lines · Guenter Roeck
Quoted 6 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---

Quoted 6 lines

Does it really make sense to have this as separate patch ?

It is quite common for watchdog (and many other) drivers to register the driver and instantiate the device. I think it would be better and more consistent to have both patches merged into one.

Are you talking about to merge them without code changes or make the driver responsible for the device enumeration (by make the driver to allocate the device)?

If it's a simple merge, I'd say I don't like to mix drivers and arch patches.

If we're talking about moving the device registration to driver, I strongly disagree it would be better and more consistent. The way I sent the driver makes it less dependent of how the enumeration happens. If this device is added to SFI table, the driver would need no change.

Br, David

Quoted 3 lines

Thanks,
Guenter

maintainer
#20 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 20 lines · David Cohen
Quoted 8 lines · Guenter Roeck
Quoted 6 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---

Quoted 6 lines

Does it really make sense to have this as separate patch ?

It is quite common for watchdog (and many other) drivers to register the driver and instantiate the device. I think it would be better and more consistent to have both patches merged into one.

Are you talking about to merge them without code changes or make the driver responsible for the device enumeration (by make the driver to allocate the device)?

Quoted 8 lines

If it's a simple merge, I'd say I don't like to mix drivers and arch patches.

If we're talking about moving the device registration to driver, I strongly disagree it would be better and more consistent. The way I sent the driver makes it less dependent of how the enumeration happens. If this device is added to SFI table, the driver would need no change.

I don't see why that would be a problem. Guess we'll have to agree to disagree.

Guenter

#21 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 24 lines · Guenter Roeck
Quoted 23 lines · David Cohen
Quoted 8 lines · Guenter Roeck
Quoted 6 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---

Quoted 6 lines

Does it really make sense to have this as separate patch ?

It is quite common for watchdog (and many other) drivers to register the driver and instantiate the device. I think it would be better and more consistent to have both patches merged into one.

Are you talking about to merge them without code changes or make the driver responsible for the device enumeration (by make the driver to allocate the device)?

If it's a simple merge, I'd say I don't like to mix drivers and arch patches.

Quoted 7 lines
Quoted 5 lines

If we're talking about moving the device registration to driver, I strongly disagree it would be better and more consistent. The way I sent the driver makes it less dependent of how the enumeration happens. If this device is added to SFI table, the driver would need no change.

I don't see why that would be a problem. Guess we'll have to agree to disagree.

Sounds fine :)
If you're not too much against keeping the way it is, I'd like to send the v2 with 2 patches again.

Br, David

Quoted 2 lines

Guenter

maintainer
#22 lore raw

Re: [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 30 lines · David Cohen
Quoted 29 lines · Guenter Roeck
Quoted 28 lines · David Cohen
Quoted 8 lines · Guenter Roeck
Quoted 6 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---

Quoted 6 lines

Does it really make sense to have this as separate patch ?

It is quite common for watchdog (and many other) drivers to register the driver and instantiate the device. I think it would be better and more consistent to have both patches merged into one.

Are you talking about to merge them without code changes or make the driver responsible for the device enumeration (by make the driver to allocate the device)?

If it's a simple merge, I'd say I don't like to mix drivers and arch patches.

If we're talking about moving the device registration to driver, I strongly disagree it would be better and more consistent. The way I sent the driver makes it less dependent of how the enumeration happens. If this device is added to SFI table, the driver would need no change.

Quoted 7 lines
Quoted 2 lines

I don't see why that would be a problem. Guess we'll have to agree to disagree.

Sounds fine :)
If you're not too much against keeping the way it is, I'd like to send the v2 with 2 patches again.

Not my decision to make. I am not the watchdog maintainer.

Guenter

#23 lore raw

v2 cover Initial implementation of Intel MID watchdog driver

In reply to David Cohen

Hi,

This patch set is an initial implementation of a generic Intel MID watchdog driver.
It currently supports Intel Merrifield only, but will extend to other SoCs of MID family.

changes from v1 to v2:
- Fixed Kconfig entry as per Guenter Roeck suggestion

Br, David

--
David Cohen (2):
watchdog: add Intel MID watchdog driver support
x86: intel-mid: add watchdog platform code for Merrifield

 arch/x86/platform/intel-mid/device_libs/Makefile   |   1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  |  43 +++++
 drivers/watchdog/Kconfig                           |  13 ++
 drivers/watchdog/Makefile                          |   1 +
 drivers/watchdog/intel-mid_wdt.c                   | 209 +++++++++++++++++++++
 5 files changed, 267 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
Signature · 1 line
1.9.1
#24 lore raw

PATCH v2 1/2 watchdog: add Intel MID watchdog driver support

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

---
 drivers/watchdog/Kconfig         |  13 +++
 drivers/watchdog/Makefile        |   1 +
 drivers/watchdog/intel-mid_wdt.c | 209 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 223 insertions(+)
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
drivers/watchdog/Kconfig +13 -0
index 79d25894343a..0e110c37aa5c 100644
@@ -643,6 +643,19 @@ config INTEL_SCU_WATCHDOG
 
 	  To compile this driver as a module, choose M here.
 
+config INTEL_MID_WATCHDOG
+	tristate "Intel MID Watchdog Timer"
+	depends on X86_INTEL_MID
+	select WATCHDOG_CORE
+	---help---
+	  Watchdog timer driver built into the Intel SCU for Intel MID
+	  Platforms.
+
+	  This driver currently supports only the watchdog evolution
+	  implementation in SCU, available for Merrifield generation.
+
+	  To compile this driver as a module, choose M here.
+
 config ITCO_WDT
 	tristate "Intel TCO Timer/Watchdog"
 	depends on (X86 || IA64) && PCI
drivers/watchdog/Makefile +1 -0
index 985a66cda76f..b927e7496eb4 100644
@@ -113,6 +113,7 @@ obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o
 obj-$(CONFIG_MACHZ_WDT) += machzwd.o
 obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
 obj-$(CONFIG_INTEL_SCU_WATCHDOG) += intel_scu_watchdog.o
+obj-$(CONFIG_INTEL_MID_WATCHDOG) += intel-mid_wdt.o
 
 # M32R Architecture
 
drivers/watchdog/intel-mid_wdt.c new file +209 -0

209 lines not on this page · raw message

Signature · 1 line
1.9.1
#25 lore raw

PATCH v2 2/2 x86: intel-mid: add watchdog platform code for Merrifield

In reply to David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

Change-Id I920968649847577a0aa1ae0b26f2a3551f77d576
---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 43 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
1.9.1
#26 lore raw

v3 cover Initial implementation of Intel MID watchdog driver

In reply to David Cohen

Hi,

This patch set is an initial implementation of a generic Intel MID watchdog driver.
It currently supports Intel Merrifield only, but will extend to other SoCs of MID family.

changes from v2 to v3:
- Moved call of x86 platform symbols to wdt platform code to allow build the driver as module

changes from v1 to v2:
- Fixed Kconfig entry as per Guenter Roeck suggestion

Br, David

--
David Cohen (2):
watchdog: add Intel MID watchdog driver support
x86: intel-mid: add watchdog platform code for Merrifield

 arch/x86/platform/intel-mid/device_libs/Makefile   |   1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  |  63 +++++++
 drivers/watchdog/Kconfig                           |  13 ++
 drivers/watchdog/Makefile                          |   1 +
 drivers/watchdog/intel-mid_wdt.c                   | 187 +++++++++++++++++++++
 include/linux/intel-mid_wdt.h                      |  20 +++
 6 files changed, 285 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
 create mode 100644 include/linux/intel-mid_wdt.h
Signature · 1 line
1.9.1
#27 lore raw

PATCH v3 1/2 watchdog: add Intel MID watchdog driver support

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

---
 drivers/watchdog/Kconfig         |  13 +++
 drivers/watchdog/Makefile        |   1 +
 drivers/watchdog/intel-mid_wdt.c | 187 +++++++++++++++++++++++++++++++++++++++
 include/linux/intel-mid_wdt.h    |  20 +++++
 4 files changed, 221 insertions(+)
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
 create mode 100644 include/linux/intel-mid_wdt.h
drivers/watchdog/Kconfig +13 -0
index 79d25894343a..0e110c37aa5c 100644
@@ -643,6 +643,19 @@ config INTEL_SCU_WATCHDOG
 
 	  To compile this driver as a module, choose M here.
 
+config INTEL_MID_WATCHDOG
+	tristate "Intel MID Watchdog Timer"
+	depends on X86_INTEL_MID
+	select WATCHDOG_CORE
+	---help---
+	  Watchdog timer driver built into the Intel SCU for Intel MID
+	  Platforms.
+
+	  This driver currently supports only the watchdog evolution
+	  implementation in SCU, available for Merrifield generation.
+
+	  To compile this driver as a module, choose M here.
+
 config ITCO_WDT
 	tristate "Intel TCO Timer/Watchdog"
 	depends on (X86 || IA64) && PCI
drivers/watchdog/Makefile +1 -0
index 985a66cda76f..b927e7496eb4 100644
@@ -113,6 +113,7 @@ obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o
 obj-$(CONFIG_MACHZ_WDT) += machzwd.o
 obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
 obj-$(CONFIG_INTEL_SCU_WATCHDOG) += intel_scu_watchdog.o
+obj-$(CONFIG_INTEL_MID_WATCHDOG) += intel-mid_wdt.o
 
 # M32R Architecture
 
drivers/watchdog/intel-mid_wdt.c new file +187 -0

187 lines not on this page · raw message

include/linux/intel-mid_wdt.h new file +20 -0
new file mode 100644
index 000000000000..705dff1c62f8
@@ -0,0 +1,20 @@
+/*
+ *      intel-mid_wdt: generic Intel MID SCU watchdog driver
+ *
+ *      Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *      Contact: David Cohen <[email protected]>
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of version 2 of the GNU General
+ *      Public License as published by the Free Software Foundation.
+ */
+
+#ifndef __INTEL_MID_WDT_H__
+#define __INTEL_MID_WDT_H__
+
+struct intel_mid_wdt_pdata {
+	int irq;
+	int (*probe)(void);
+};
+
+#endif /*__INTEL_MID_WDT_H__*/
Signature · 1 line
1.9.1
maintainer
#28 lore raw

Re: [PATCH v3 1/2] watchdog: add Intel MID watchdog driver support

Quoted 5 lines · David Cohen

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

Quoted 7 lines
---
 drivers/watchdog/Kconfig         |  13 +++
 drivers/watchdog/Makefile        |   1 +
 drivers/watchdog/intel-mid_wdt.c | 187 +++++++++++++++++++++++++++++++++++++++
 include/linux/intel-mid_wdt.h    |  20 +++++

include/linux/platform_data/intel-mid_wdt.h ?

Quoted 94 lines
 4 files changed, 221 insertions(+)
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
 create mode 100644 include/linux/intel-mid_wdt.h
drivers/watchdog/Kconfig +13 -0
index 79d25894343a..0e110c37aa5c 100644
@@ -643,6 +643,19 @@ config INTEL_SCU_WATCHDOG
 
 	  To compile this driver as a module, choose M here.
 
+config INTEL_MID_WATCHDOG
+	tristate "Intel MID Watchdog Timer"
+	depends on X86_INTEL_MID
+	select WATCHDOG_CORE
+	---help---
+	  Watchdog timer driver built into the Intel SCU for Intel MID
+	  Platforms.
+
+	  This driver currently supports only the watchdog evolution
+	  implementation in SCU, available for Merrifield generation.
+
+	  To compile this driver as a module, choose M here.
+
 config ITCO_WDT
 	tristate "Intel TCO Timer/Watchdog"
 	depends on (X86 || IA64) && PCI
drivers/watchdog/Makefile +1 -0
index 985a66cda76f..b927e7496eb4 100644
@@ -113,6 +113,7 @@ obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o
 obj-$(CONFIG_MACHZ_WDT) += machzwd.o
 obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
 obj-$(CONFIG_INTEL_SCU_WATCHDOG) += intel_scu_watchdog.o
+obj-$(CONFIG_INTEL_MID_WATCHDOG) += intel-mid_wdt.o
 
 # M32R Architecture
 
drivers/watchdog/intel-mid_wdt.c new file +48 -0
new file mode 100644
index 000000000000..d8bf3c3cd2b7
@@ -0,0 +1,187 @@
+/*
+ *      intel-mid_wdt: generic Intel MID SCU watchdog driver
+ *
+ *      Platforms supported so far:
+ *      - Merrifield only
+ *
+ *      Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *      Contact: David Cohen <[email protected]>
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of version 2 of the GNU General
+ *      Public License as published by the Free Software Foundation.
+ */
+
+#include <linux/intel-mid_wdt.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/nmi.h>
+#include <linux/platform_device.h>
+#include <linux/watchdog.h>
+
+#include <asm/intel_scu_ipc.h>
+#include <asm/intel-mid.h>
+
+#define IPC_WATCHDOG 0xf8
+
+#define MID_WDT_PRETIMEOUT		15
+#define MID_WDT_TIMEOUT_MIN		(1 + MID_WDT_PRETIMEOUT)
+#define MID_WDT_TIMEOUT_MAX		170
+#define MID_WDT_DEFAULT_TIMEOUT		90
+
+/* SCU watchdog messages */
+enum {
+	SCU_WATCHDOG_START = 0,
+	SCU_WATCHDOG_STOP,
+	SCU_WATCHDOG_KEEPALIVE,
+};
+
+static inline int wdt_command(int sub, u32 *in, int inlen)
+{
+	return intel_scu_ipc_command(IPC_WATCHDOG, sub, in, inlen, NULL, 0);
+}
+
+static int wdt_start(struct watchdog_device *wd)
+{
+	int ret, in_size;
+	int timeout = wd->timeout;
+	struct ipc_wd_start {

drivers/watchdog/intel-mid_wdt.c line 58

Quoted 10 lines
drivers/watchdog/intel-mid_wdt.c new file +10 -0
+		u32 pretimeout;
+		u32 timeout;
+	} ipc_wd_start = { timeout - MID_WDT_PRETIMEOUT, timeout };
+
+	/*
+	 * SCU expects the input size for watchdog IPC to
+	 * be based on double-word
+	 */
+	in_size = (sizeof(ipc_wd_start) + 3) / 4;
+

DIV_ROUND_UP ?

Not sure how "double-word" matches the calculation. What is a "double-word" ? 4 bytes ?

drivers/watchdog/intel-mid_wdt.c line 63

Quoted 5 lines
drivers/watchdog/intel-mid_wdt.c new file +5 -0
+	ret = wdt_command(SCU_WATCHDOG_START, (u32 *)&ipc_wd_start, in_size);
+	if (ret) {
+		struct device *dev = watchdog_get_drvdata(wd);
+		dev_crit(dev, "error starting watchdog: %d\n", ret);
+		return -EIO;

I am quite sure sparse is going to complain about this ... Why not just return ret ? This would result in a more detailed error code/reason.

Quoted 4 lines
drivers/watchdog/intel-mid_wdt.c new file +4 -0
+	}
+
+	return 0;
+}

drivers/watchdog/intel-mid_wdt.c line 77

Quoted 10 lines
drivers/watchdog/intel-mid_wdt.c new file +10 -0
+
+static int wdt_ping(struct watchdog_device *wd)
+{
+	int ret;
+
+	ret = wdt_command(SCU_WATCHDOG_KEEPALIVE, NULL, 0);
+	if (ret) {
+		struct device *dev = watchdog_get_drvdata(wd);
+		dev_crit(dev, "Error executing keepalive: 0x%x\n", ret);
+		return -EIO;

Same here.

Quoted 4 lines
drivers/watchdog/intel-mid_wdt.c new file +4 -0
+	}
+
+	return 0;
+}

drivers/watchdog/intel-mid_wdt.c line 91

Quoted 10 lines
drivers/watchdog/intel-mid_wdt.c new file +10 -0
+
+static int wdt_stop(struct watchdog_device *wd)
+{
+	int ret;
+
+	ret = wdt_command(SCU_WATCHDOG_STOP, NULL, 0);
+	if (ret) {
+		struct device *dev = watchdog_get_drvdata(wd);
+		dev_crit(dev, "Error stopping watchdog: 0x%x\n", ret);
+		return -EIO;

Same here.

drivers/watchdog/intel-mid_wdt.c line 97

Quoted 6 lines
drivers/watchdog/intel-mid_wdt.c new file +6 -0
+	}
+
+	return 0;
+}
+
+static irqreturn_t mid_wdt_warning_irq(int irq, void *dev_id)

This isn't really a warning, so the function name is a bit misleading.

Quoted 22 lines
drivers/watchdog/intel-mid_wdt.c new file +22 -0
+{
+	panic("Kernel Watchdog");
+
+	/* This code should not be reached */
+	return IRQ_HANDLED;
+}
+
+static const struct watchdog_info mid_wdt_info = {
+	.identity = "Intel MID SCU watchdog",
+	.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
+};
+
+static const struct watchdog_ops mid_wdt_ops = {
+	.owner = THIS_MODULE,
+	.start = wdt_start,
+	.stop = wdt_stop,
+	.ping = wdt_ping,
+};
+
+static int mid_wdt_probe(struct platform_device *pdev)
+{
+	struct watchdog_device *wdt_dev;

drivers/watchdog/intel-mid_wdt.c line 129

Quoted 10 lines
drivers/watchdog/intel-mid_wdt.c new file +10 -0
+	struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
+	int ret;
+
+	if (!pdata) {
+		dev_err(&pdev->dev, "missing platform data\n");
+		return -EINVAL;
+	}
+
+	if (pdata->probe) {
+		ret = pdata->probe();

Sure you don't want to pass the platform device as parameter ? May not be needed today, but it might be better than to rely on the assumption that the called code gets it from a static variable or structure (if needed).

This would enable you, for example, to use dev_warn() instead of pr_warn() in the platform code.

Quoted 10 lines
drivers/watchdog/intel-mid_wdt.c new file +10 -0
+		if (ret)
+			return ret;
+	}
+
+	wdt_dev = devm_kzalloc(&pdev->dev, sizeof(*wdt_dev), GFP_KERNEL);
+	if (!wdt_dev)
+		return -ENOMEM;
+
+	wdt_dev->info = &mid_wdt_info;
+	wdt_dev->ops = &mid_wdt_ops;

drivers/watchdog/intel-mid_wdt.c line 149

Quoted 10 lines
drivers/watchdog/intel-mid_wdt.c new file +10 -0
+	wdt_dev->min_timeout = MID_WDT_TIMEOUT_MIN;
+	wdt_dev->max_timeout = MID_WDT_TIMEOUT_MAX;
+	wdt_dev->timeout = MID_WDT_DEFAULT_TIMEOUT;
+
+	watchdog_set_drvdata(wdt_dev, &pdev->dev);
+	platform_set_drvdata(pdev, wdt_dev);
+
+	ret = devm_request_irq(&pdev->dev, pdata->irq, mid_wdt_warning_irq,
+			       IRQF_SHARED | IRQF_NO_SUSPEND, "watchdog",
+			       wdt_dev);

If irq is mandatory, it might make sense to check if it is valid.

Quoted 72 lines
drivers/watchdog/intel-mid_wdt.c new file +38 -0
+	if (ret) {
+		dev_err(&pdev->dev, "error requesting warning irq %d\n",
+			pdata->irq);
+		return ret;
+	}
+
+	ret = watchdog_register_device(wdt_dev);
+	if (ret) {
+		dev_err(&pdev->dev, "error registering watchdog device\n");
+		return ret;
+	}
+
+	dev_info(&pdev->dev, "Intel MID watchdog device probed\n");
+
+	return 0;
+}
+
+static int mid_wdt_remove(struct platform_device *pdev)
+{
+	struct watchdog_device *wd = platform_get_drvdata(pdev);
+	watchdog_unregister_device(wd);
+	return 0;
+}
+
+static struct platform_driver mid_wdt_driver = {
+	.probe		= mid_wdt_probe,
+	.remove		= mid_wdt_remove,
+	.driver		= {
+		.owner	= THIS_MODULE,
+		.name	= "intel_mid_wdt",
+	},
+};
+
+module_platform_driver(mid_wdt_driver);
+
+MODULE_AUTHOR("David Cohen <[email protected]>");
+MODULE_DESCRIPTION("Watchdog Driver for Intel MID platform");
+MODULE_LICENSE("GPL");
include/linux/intel-mid_wdt.h new file +20 -0
new file mode 100644
index 000000000000..705dff1c62f8
@@ -0,0 +1,20 @@
+/*
+ *      intel-mid_wdt: generic Intel MID SCU watchdog driver
+ *
+ *      Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *      Contact: David Cohen <[email protected]>
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of version 2 of the GNU General
+ *      Public License as published by the Free Software Foundation.
+ */
+
+#ifndef __INTEL_MID_WDT_H__
+#define __INTEL_MID_WDT_H__
+
+struct intel_mid_wdt_pdata {
+	int irq;
+	int (*probe)(void);
+};
+
+#endif /*__INTEL_MID_WDT_H__*/
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#29 lore raw

Re: [PATCH v3 1/2] watchdog: add Intel MID watchdog driver support

Quoted 14 lines · Guenter Roeck
Quoted 5 lines · David Cohen

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

Quoted 7 lines
---
 drivers/watchdog/Kconfig         |  13 +++
 drivers/watchdog/Makefile        |   1 +
 drivers/watchdog/intel-mid_wdt.c | 187 +++++++++++++++++++++++++++++++++++++++
 include/linux/intel-mid_wdt.h    |  20 +++++
Quoted 1 line

include/linux/platform_data/intel-mid_wdt.h ?

Ack

Quoted 98 lines
Quoted 98 lines
 4 files changed, 221 insertions(+)
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
 create mode 100644 include/linux/intel-mid_wdt.h
drivers/watchdog/Kconfig +13 -0
index 79d25894343a..0e110c37aa5c 100644
@@ -643,6 +643,19 @@ config INTEL_SCU_WATCHDOG
 
 	  To compile this driver as a module, choose M here.
 
+config INTEL_MID_WATCHDOG
+	tristate "Intel MID Watchdog Timer"
+	depends on X86_INTEL_MID
+	select WATCHDOG_CORE
+	---help---
+	  Watchdog timer driver built into the Intel SCU for Intel MID
+	  Platforms.
+
+	  This driver currently supports only the watchdog evolution
+	  implementation in SCU, available for Merrifield generation.
+
+	  To compile this driver as a module, choose M here.
+
 config ITCO_WDT
 	tristate "Intel TCO Timer/Watchdog"
 	depends on (X86 || IA64) && PCI
drivers/watchdog/Makefile +1 -0
index 985a66cda76f..b927e7496eb4 100644
@@ -113,6 +113,7 @@ obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o
 obj-$(CONFIG_MACHZ_WDT) += machzwd.o
 obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
 obj-$(CONFIG_INTEL_SCU_WATCHDOG) += intel_scu_watchdog.o
+obj-$(CONFIG_INTEL_MID_WATCHDOG) += intel-mid_wdt.o
 
 # M32R Architecture
 
drivers/watchdog/intel-mid_wdt.c new file +51 -0
new file mode 100644
index 000000000000..d8bf3c3cd2b7
@@ -0,0 +1,187 @@
+/*
+ *      intel-mid_wdt: generic Intel MID SCU watchdog driver
+ *
+ *      Platforms supported so far:
+ *      - Merrifield only
+ *
+ *      Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *      Contact: David Cohen <[email protected]>
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of version 2 of the GNU General
+ *      Public License as published by the Free Software Foundation.
+ */
+
+#include <linux/intel-mid_wdt.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/nmi.h>
+#include <linux/platform_device.h>
+#include <linux/watchdog.h>
+
+#include <asm/intel_scu_ipc.h>
+#include <asm/intel-mid.h>
+
+#define IPC_WATCHDOG 0xf8
+
+#define MID_WDT_PRETIMEOUT		15
+#define MID_WDT_TIMEOUT_MIN		(1 + MID_WDT_PRETIMEOUT)
+#define MID_WDT_TIMEOUT_MAX		170
+#define MID_WDT_DEFAULT_TIMEOUT		90
+
+/* SCU watchdog messages */
+enum {
+	SCU_WATCHDOG_START = 0,
+	SCU_WATCHDOG_STOP,
+	SCU_WATCHDOG_KEEPALIVE,
+};
+
+static inline int wdt_command(int sub, u32 *in, int inlen)
+{
+	return intel_scu_ipc_command(IPC_WATCHDOG, sub, in, inlen, NULL, 0);
+}
+
+static int wdt_start(struct watchdog_device *wd)
+{
+	int ret, in_size;
+	int timeout = wd->timeout;
+	struct ipc_wd_start {
+		u32 pretimeout;
+		u32 timeout;
+	} ipc_wd_start = { timeout - MID_WDT_PRETIMEOUT, timeout };
Quoted 8 lines

drivers/watchdog/intel-mid_wdt.c line 58

Quoted 7 lines
drivers/watchdog/intel-mid_wdt.c new file +7 -0
+
+	/*
+	 * SCU expects the input size for watchdog IPC to
+	 * be based on double-word
+	 */
+	in_size = (sizeof(ipc_wd_start) + 3) / 4;
+

DIV_ROUND_UP ?

Ack

Quoted 4 lines

Not sure how "double-word" matches the calculation. What is a "double-word" ? 4 bytes ?

Quoted 9 lines

drivers/watchdog/intel-mid_wdt.c line 63

Quoted 5 lines
drivers/watchdog/intel-mid_wdt.c new file +5 -0
+	ret = wdt_command(SCU_WATCHDOG_START, (u32 *)&ipc_wd_start, in_size);
+	if (ret) {
+		struct device *dev = watchdog_get_drvdata(wd);
+		dev_crit(dev, "error starting watchdog: %d\n", ret);
+		return -EIO;

I am quite sure sparse is going to complain about this ... Why not just return ret ? This would result in a more detailed error code/reason.

wdt_command() may return errors != -EIO. But IMHO -EIO makes more sense whatever is the issue regarding to IPC in this scenario.
But I can return ret as per request. Same to cases below.

Quoted 35 lines
Quoted 5 lines
drivers/watchdog/intel-mid_wdt.c new file +4 -0
+	}
+
+	return 0;
+}

drivers/watchdog/intel-mid_wdt.c line 77

Quoted 10 lines
drivers/watchdog/intel-mid_wdt.c new file +10 -0
+
+static int wdt_ping(struct watchdog_device *wd)
+{
+	int ret;
+
+	ret = wdt_command(SCU_WATCHDOG_KEEPALIVE, NULL, 0);
+	if (ret) {
+		struct device *dev = watchdog_get_drvdata(wd);
+		dev_crit(dev, "Error executing keepalive: 0x%x\n", ret);
+		return -EIO;

Same here.

Quoted 4 lines
drivers/watchdog/intel-mid_wdt.c new file +4 -0
+	}
+
+	return 0;
+}

drivers/watchdog/intel-mid_wdt.c line 91

Quoted 10 lines
drivers/watchdog/intel-mid_wdt.c new file +10 -0
+
+static int wdt_stop(struct watchdog_device *wd)
+{
+	int ret;
+
+	ret = wdt_command(SCU_WATCHDOG_STOP, NULL, 0);
+	if (ret) {
+		struct device *dev = watchdog_get_drvdata(wd);
+		dev_crit(dev, "Error stopping watchdog: 0x%x\n", ret);
+		return -EIO;

Same here.

Quoted 8 lines

drivers/watchdog/intel-mid_wdt.c line 97

Quoted 6 lines
drivers/watchdog/intel-mid_wdt.c new file +6 -0
+	}
+
+	return 0;
+}
+
+static irqreturn_t mid_wdt_warning_irq(int irq, void *dev_id)

This isn't really a warning, so the function name is a bit misleading.

Ack

Quoted 38 lines
Quoted 23 lines
drivers/watchdog/intel-mid_wdt.c new file +22 -0
+{
+	panic("Kernel Watchdog");
+
+	/* This code should not be reached */
+	return IRQ_HANDLED;
+}
+
+static const struct watchdog_info mid_wdt_info = {
+	.identity = "Intel MID SCU watchdog",
+	.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
+};
+
+static const struct watchdog_ops mid_wdt_ops = {
+	.owner = THIS_MODULE,
+	.start = wdt_start,
+	.stop = wdt_stop,
+	.ping = wdt_ping,
+};
+
+static int mid_wdt_probe(struct platform_device *pdev)
+{
+	struct watchdog_device *wdt_dev;

drivers/watchdog/intel-mid_wdt.c line 129

Quoted 10 lines
drivers/watchdog/intel-mid_wdt.c new file +10 -0
+	struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
+	int ret;
+
+	if (!pdata) {
+		dev_err(&pdev->dev, "missing platform data\n");
+		return -EINVAL;
+	}
+
+	if (pdata->probe) {
+		ret = pdata->probe();

Sure you don't want to pass the platform device as parameter ? May not be needed today, but it might be better than to rely on the assumption that the called code gets it from a static variable or structure (if needed).

Quoted 2 lines

This would enable you, for example, to use dev_warn() instead of pr_warn() in the platform code.

Ack.

Quoted 15 lines
Quoted 15 lines
drivers/watchdog/intel-mid_wdt.c new file +14 -0
+		if (ret)
+			return ret;
+	}
+
+	wdt_dev = devm_kzalloc(&pdev->dev, sizeof(*wdt_dev), GFP_KERNEL);
+	if (!wdt_dev)
+		return -ENOMEM;
+
+	wdt_dev->info = &mid_wdt_info;
+	wdt_dev->ops = &mid_wdt_ops;
+	wdt_dev->min_timeout = MID_WDT_TIMEOUT_MIN;
+	wdt_dev->max_timeout = MID_WDT_TIMEOUT_MAX;
+	wdt_dev->timeout = MID_WDT_DEFAULT_TIMEOUT;
+
Quoted 8 lines

drivers/watchdog/intel-mid_wdt.c line 149

Quoted 6 lines
drivers/watchdog/intel-mid_wdt.c new file +6 -0
+	watchdog_set_drvdata(wdt_dev, &pdev->dev);
+	platform_set_drvdata(pdev, wdt_dev);
+
+	ret = devm_request_irq(&pdev->dev, pdata->irq, mid_wdt_warning_irq,
+			       IRQF_SHARED | IRQF_NO_SUSPEND, "watchdog",
+			       wdt_dev);

If irq is mandatory, it might make sense to check if it is valid.

I can add this extra sanity check.

Thanks for your review.

BR, David

Quoted 73 lines
Quoted 73 lines
drivers/watchdog/intel-mid_wdt.c new file +38 -0
+	if (ret) {
+		dev_err(&pdev->dev, "error requesting warning irq %d\n",
+			pdata->irq);
+		return ret;
+	}
+
+	ret = watchdog_register_device(wdt_dev);
+	if (ret) {
+		dev_err(&pdev->dev, "error registering watchdog device\n");
+		return ret;
+	}
+
+	dev_info(&pdev->dev, "Intel MID watchdog device probed\n");
+
+	return 0;
+}
+
+static int mid_wdt_remove(struct platform_device *pdev)
+{
+	struct watchdog_device *wd = platform_get_drvdata(pdev);
+	watchdog_unregister_device(wd);
+	return 0;
+}
+
+static struct platform_driver mid_wdt_driver = {
+	.probe		= mid_wdt_probe,
+	.remove		= mid_wdt_remove,
+	.driver		= {
+		.owner	= THIS_MODULE,
+		.name	= "intel_mid_wdt",
+	},
+};
+
+module_platform_driver(mid_wdt_driver);
+
+MODULE_AUTHOR("David Cohen <[email protected]>");
+MODULE_DESCRIPTION("Watchdog Driver for Intel MID platform");
+MODULE_LICENSE("GPL");
include/linux/intel-mid_wdt.h new file +20 -0
new file mode 100644
index 000000000000..705dff1c62f8
@@ -0,0 +1,20 @@
+/*
+ *      intel-mid_wdt: generic Intel MID SCU watchdog driver
+ *
+ *      Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *      Contact: David Cohen <[email protected]>
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of version 2 of the GNU General
+ *      Public License as published by the Free Software Foundation.
+ */
+
+#ifndef __INTEL_MID_WDT_H__
+#define __INTEL_MID_WDT_H__
+
+struct intel_mid_wdt_pdata {
+	int irq;
+	int (*probe)(void);
+};
+
+#endif /*__INTEL_MID_WDT_H__*/
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#30 lore raw

PATCH v3 2/2 x86: intel-mid: add watchdog platform code for Merrifield

In reply to David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 63 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#31 lore raw

Re: [PATCH v3 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 4 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

argh ... does this really belong into the commit log ?

Quoted 26 lines
---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 63 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +4 -0
new file mode 100644
index 000000000000..653242110d57
@@ -0,0 +1,63 @@
+/*
+ * platform_wdt.c: Watchdog platform library file
+ *
+ * (C) Copyright 2014 Intel Corporation

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 14

Quoted 10 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +10 -0
+ * Author: David Cohen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/intel-mid_wdt.h>
	/platform_data/...
Quoted 6 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +6 -0
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <asm/intel-mid.h>
+
+#define TANGIER_EXT_TIMER0_MSI 15
+

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 30

Quoted 10 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +10 -0
+static struct platform_device wdt_dev = {
+	.name = "intel_mid_wdt",
+	.id = -1,
+};
+
+static int tangier_probe(void)
+{
+	int ioapic;
+	struct io_apic_irq_attr irq_attr;
+
				= { };

would ensure that there are no un-initialized variables if the structure definition ever changes.

Or just pre-initialize the entire structure as much as possible.

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 38

Quoted 8 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +8 -0
+	ioapic = mp_find_ioapic(TANGIER_EXT_TIMER0_MSI);
+	if (ioapic >= 0) {
+		irq_attr.ioapic = ioapic;
+		irq_attr.ioapic_pin = TANGIER_EXT_TIMER0_MSI;
+		irq_attr.trigger = 1;
+		irq_attr.polarity = 0; /* Active high */
+		io_apic_set_pci_routing(NULL, TANGIER_EXT_TIMER0_MSI,
+					&irq_attr);

No need for an error check ? I understand no one else does, but why does the function return an error if no one cares about it ?

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 41

Quoted 3 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +3 -0
+	} else {
+		pr_warn("intel_mid_wdt: can not find interrupt %d in ioapic\n",
+			TANGIER_EXT_TIMER0_MSI);

As mentioned earlier, I think it would pake sense to pass struct platform_device * as argument and use dev_warn.

It would also enable you to use the irq passed from the parameter instead of checking for the hard-coded define.

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 42

Quoted 1 line
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +1 -0
+		return -EINVAL;

Why not return the error returned by mp_find_ioapic() ?

Quoted 29 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +21 -0
+	}
+
+	return 0;
+}
+
+static struct intel_mid_wdt_pdata tangier_pdata = {
+	.irq = TANGIER_EXT_TIMER0_MSI,
+	.probe = tangier_probe,
+};
+
+static int __init register_mid_wdt(void)
+{
+	if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) {
+		wdt_dev.dev.platform_data = &tangier_pdata;
+		return platform_device_register(&wdt_dev);
+	}
+
+	return -ENODEV;
+}
+
+rootfs_initcall(register_mid_wdt);
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#32 lore raw

Re: [PATCH v3 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 6 lines · Guenter Roeck
Quoted 4 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

argh ... does this really belong into the commit log ?

Yes. It means: "this developer was forced to do this ugly thing due to fw-related sloppiness".

Quoted 31 lines
Quoted 31 lines
---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 63 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +8 -0
new file mode 100644
index 000000000000..653242110d57
@@ -0,0 +1,63 @@
+/*
+ * platform_wdt.c: Watchdog platform library file
+ *
+ * (C) Copyright 2014 Intel Corporation
+ * Author: David Cohen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
Quoted 8 lines

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 14

Quoted 6 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +6 -0
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/intel-mid_wdt.h>
	/platform_data/...

Ack

Quoted 18 lines
Quoted 7 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +6 -0
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <asm/intel-mid.h>
+
+#define TANGIER_EXT_TIMER0_MSI 15
+

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 30

Quoted 10 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +10 -0
+static struct platform_device wdt_dev = {
+	.name = "intel_mid_wdt",
+	.id = -1,
+};
+
+static int tangier_probe(void)
+{
+	int ioapic;
+	struct io_apic_irq_attr irq_attr;
+
				= { };
Quoted 4 lines

would ensure that there are no un-initialized variables if the structure definition ever changes.

Or just pre-initialize the entire structure as much as possible.

The first suggestion seems better.

Quoted 12 lines

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 38

Quoted 9 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +8 -0
+	ioapic = mp_find_ioapic(TANGIER_EXT_TIMER0_MSI);
+	if (ioapic >= 0) {
+		irq_attr.ioapic = ioapic;
+		irq_attr.ioapic_pin = TANGIER_EXT_TIMER0_MSI;
+		irq_attr.trigger = 1;
+		irq_attr.polarity = 0; /* Active high */
+		io_apic_set_pci_routing(NULL, TANGIER_EXT_TIMER0_MSI,
+					&irq_attr);

No need for an error check ? I understand no one else does, but why does the function return an error if no one cares about it ?

That's an interesting question. But whatever is the answer, I believe checking the error makes more sense. I'll change it.

Quoted 10 lines

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 41

Quoted 4 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +3 -0
+	} else {
+		pr_warn("intel_mid_wdt: can not find interrupt %d in ioapic\n",
+			TANGIER_EXT_TIMER0_MSI);

As mentioned earlier, I think it would pake sense to pass struct platform_device * as argument and use dev_warn.

It would also enable you to use the irq passed from the parameter instead of checking for the hard-coded define.

Ack.

Quoted 4 lines

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 42

Quoted 2 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +1 -0
+		return -EINVAL;

Why not return the error returned by mp_find_ioapic() ?

My intention was to ensure in this scenario we got the wrong IRQ. But it perhaps makes more sense to keep the original error.

Thanks again for the review.

Br, David

Quoted 30 lines
Quoted 30 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +21 -0
+	}
+
+	return 0;
+}
+
+static struct intel_mid_wdt_pdata tangier_pdata = {
+	.irq = TANGIER_EXT_TIMER0_MSI,
+	.probe = tangier_probe,
+};
+
+static int __init register_mid_wdt(void)
+{
+	if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) {
+		wdt_dev.dev.platform_data = &tangier_pdata;
+		return platform_device_register(&wdt_dev);
+	}
+
+	return -ENODEV;
+}
+
+rootfs_initcall(register_mid_wdt);
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#33 lore raw

v4 cover Initial implementation of Intel MID watchdog driver

In reply to David Cohen

Hi,

This patch set is an initial implementation of a generic Intel MID watchdog driver.
It currently supports Intel Merrifield only, but will extend to other SoCs of MID family.

changes from v3 to v4:
- Addressed comments from Guenter Roeck

Br, David

--
David Cohen (2):
watchdog: add Intel MID watchdog driver support
x86: intel-mid: add watchdog platform code for Merrifield

 arch/x86/platform/intel-mid/device_libs/Makefile   |   1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  |  66 ++++++++
 drivers/watchdog/Kconfig                           |  13 ++
 drivers/watchdog/Makefile                          |   1 +
 drivers/watchdog/intel-mid_wdt.c                   | 184 +++++++++++++++++++++
 include/linux/platform_data/intel-mid_wdt.h        |  22 +++
 6 files changed, 287 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
 create mode 100644 include/linux/platform_data/intel-mid_wdt.h
Signature · 1 line
1.9.1
#34 lore raw

PATCH v4 1/2 watchdog: add Intel MID watchdog driver support

Add initial Intel MID watchdog driver support.

This driver is an initial implementation of generic Intel MID watchdog driver. Currently it supports Intel Merrifield platform.

---
 drivers/watchdog/Kconfig                    |  13 ++
 drivers/watchdog/Makefile                   |   1 +
 drivers/watchdog/intel-mid_wdt.c            | 184 ++++++++++++++++++++++++++++
 include/linux/platform_data/intel-mid_wdt.h |  22 ++++
 4 files changed, 220 insertions(+)
 create mode 100644 drivers/watchdog/intel-mid_wdt.c
 create mode 100644 include/linux/platform_data/intel-mid_wdt.h
drivers/watchdog/Kconfig +13 -0
index 79d25894343a..0e110c37aa5c 100644
@@ -643,6 +643,19 @@ config INTEL_SCU_WATCHDOG
 
 	  To compile this driver as a module, choose M here.
 
+config INTEL_MID_WATCHDOG
+	tristate "Intel MID Watchdog Timer"
+	depends on X86_INTEL_MID
+	select WATCHDOG_CORE
+	---help---
+	  Watchdog timer driver built into the Intel SCU for Intel MID
+	  Platforms.
+
+	  This driver currently supports only the watchdog evolution
+	  implementation in SCU, available for Merrifield generation.
+
+	  To compile this driver as a module, choose M here.
+
 config ITCO_WDT
 	tristate "Intel TCO Timer/Watchdog"
 	depends on (X86 || IA64) && PCI
drivers/watchdog/Makefile +1 -0
index 985a66cda76f..b927e7496eb4 100644
@@ -113,6 +113,7 @@ obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o
 obj-$(CONFIG_MACHZ_WDT) += machzwd.o
 obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
 obj-$(CONFIG_INTEL_SCU_WATCHDOG) += intel_scu_watchdog.o
+obj-$(CONFIG_INTEL_MID_WATCHDOG) += intel-mid_wdt.o
 
 # M32R Architecture
 
drivers/watchdog/intel-mid_wdt.c new file +184 -0

184 lines not on this page · raw message

include/linux/platform_data/intel-mid_wdt.h new file +22 -0
new file mode 100644
index 000000000000..b98253466ace
@@ -0,0 +1,22 @@
+/*
+ *      intel-mid_wdt: generic Intel MID SCU watchdog driver
+ *
+ *      Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *      Contact: David Cohen <[email protected]>
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of version 2 of the GNU General
+ *      Public License as published by the Free Software Foundation.
+ */
+
+#ifndef __INTEL_MID_WDT_H__
+#define __INTEL_MID_WDT_H__
+
+#include <linux/platform_device.h>
+
+struct intel_mid_wdt_pdata {
+	int irq;
+	int (*probe)(struct platform_device *pdev);
+};
+
+#endif /*__INTEL_MID_WDT_H__*/
Signature · 1 line
1.9.1
#36 lore raw

PATCH v4 2/2 x86: intel-mid: add watchdog platform code for Merrifield

In reply to David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 66 ++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
1.9.1
#37 lore raw

Re: [PATCH v4 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 47 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 66 ++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +21 -0
new file mode 100644
index 000000000000..4b0434b54aff
@@ -0,0 +1,66 @@
+/*
+ * platform_wdt.c: Watchdog platform library file
+ *
+ * (C) Copyright 2014 Intel Corporation
+ * Author: David Cohen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/intel-mid_wdt.h>
+#include <asm/intel-mid.h>
+
+#define TANGIER_EXT_TIMER0_MSI 15
+
+static struct platform_device wdt_dev = {

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 31

Quoted 10 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +10 -0
+	.name = "intel_mid_wdt",
+	.id = -1,
+};
+
+static int tangier_probe(struct platform_device *pdev)
+{
+	int ioapic;
+	struct io_apic_irq_attr irq_attr = { 0 };
+
+	ioapic = mp_find_ioapic(TANGIER_EXT_TIMER0_MSI);

Forgot remove this hardcoded irq number. I'll send v4.1 of this patch.

BR, David

Quoted 38 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +35 -0
+	if (ioapic >= 0) {
+		int ret;
+		irq_attr.ioapic = ioapic;
+		irq_attr.ioapic_pin = TANGIER_EXT_TIMER0_MSI;
+		irq_attr.trigger = 1;
+		irq_attr.polarity = 0; /* Active high */
+		ret = io_apic_set_pci_routing(NULL, TANGIER_EXT_TIMER0_MSI,
+					      &irq_attr);
+		if (ret)
+			return ret;
+	} else {
+		dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n",
+			 TANGIER_EXT_TIMER0_MSI);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static struct intel_mid_wdt_pdata tangier_pdata = {
+	.irq = TANGIER_EXT_TIMER0_MSI,
+	.probe = tangier_probe,
+};
+
+static int __init register_mid_wdt(void)
+{
+	if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) {
+		wdt_dev.dev.platform_data = &tangier_pdata;
+		return platform_device_register(&wdt_dev);
+	}
+
+	return -ENODEV;
+}
+
+rootfs_initcall(register_mid_wdt);
Signature · 1 line
1.9.1
maintainer
#38 lore raw

Re: [PATCH v4 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 63 lines · David Cohen
Quoted 47 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 66 ++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +21 -0
new file mode 100644
index 000000000000..4b0434b54aff
@@ -0,0 +1,66 @@
+/*
+ * platform_wdt.c: Watchdog platform library file
+ *
+ * (C) Copyright 2014 Intel Corporation
+ * Author: David Cohen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/intel-mid_wdt.h>
+#include <asm/intel-mid.h>
+
+#define TANGIER_EXT_TIMER0_MSI 15
+
+static struct platform_device wdt_dev = {

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 31

Quoted 10 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +10 -0
+	.name = "intel_mid_wdt",
+	.id = -1,
+};
+
+static int tangier_probe(struct platform_device *pdev)
+{
+	int ioapic;
+	struct io_apic_irq_attr irq_attr = { 0 };
+
+	ioapic = mp_find_ioapic(TANGIER_EXT_TIMER0_MSI);

Forgot remove this hardcoded irq number. I'll send v4.1 of this patch.

BR, David

Quoted 8 lines

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 39

Quoted 8 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +8 -0
+	if (ioapic >= 0) {
+		int ret;
+		irq_attr.ioapic = ioapic;
+		irq_attr.ioapic_pin = TANGIER_EXT_TIMER0_MSI;
+		irq_attr.trigger = 1;
+		irq_attr.polarity = 0; /* Active high */
+		ret = io_apic_set_pci_routing(NULL, TANGIER_EXT_TIMER0_MSI,
+					      &irq_attr);

Here is another one, just in case you missed it.

Guenter

#39 lore raw

Re: [PATCH v4 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 64 lines · Guenter Roeck
Quoted 63 lines · David Cohen
Quoted 47 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 66 ++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +21 -0
new file mode 100644
index 000000000000..4b0434b54aff
@@ -0,0 +1,66 @@
+/*
+ * platform_wdt.c: Watchdog platform library file
+ *
+ * (C) Copyright 2014 Intel Corporation
+ * Author: David Cohen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/intel-mid_wdt.h>
+#include <asm/intel-mid.h>
+
+#define TANGIER_EXT_TIMER0_MSI 15
+
+static struct platform_device wdt_dev = {

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 31

Quoted 10 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +10 -0
+	.name = "intel_mid_wdt",
+	.id = -1,
+};
+
+static int tangier_probe(struct platform_device *pdev)
+{
+	int ioapic;
+	struct io_apic_irq_attr irq_attr = { 0 };
+
+	ioapic = mp_find_ioapic(TANGIER_EXT_TIMER0_MSI);

Forgot remove this hardcoded irq number. I'll send v4.1 of this patch.

BR, David

Quoted 10 lines
Quoted 8 lines

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 39

Quoted 8 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +8 -0
+	if (ioapic >= 0) {
+		int ret;
+		irq_attr.ioapic = ioapic;
+		irq_attr.ioapic_pin = TANGIER_EXT_TIMER0_MSI;
+		irq_attr.trigger = 1;
+		irq_attr.polarity = 0; /* Active high */
+		ret = io_apic_set_pci_routing(NULL, TANGIER_EXT_TIMER0_MSI,
+					      &irq_attr);

Here is another one, just in case you missed it.

This one I didn't miss. I checked and it returns dummy error code (-1). Better to keep the hardcoded value.

Br, David

Quoted 2 lines

Guenter

maintainer
#40 lore raw

Re: [PATCH v4 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 76 lines · David Cohen
Quoted 64 lines · Guenter Roeck
Quoted 63 lines · David Cohen
Quoted 47 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 66 ++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +21 -0
new file mode 100644
index 000000000000..4b0434b54aff
@@ -0,0 +1,66 @@
+/*
+ * platform_wdt.c: Watchdog platform library file
+ *
+ * (C) Copyright 2014 Intel Corporation
+ * Author: David Cohen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/intel-mid_wdt.h>
+#include <asm/intel-mid.h>
+
+#define TANGIER_EXT_TIMER0_MSI 15
+
+static struct platform_device wdt_dev = {

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 31

Quoted 10 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +10 -0
+	.name = "intel_mid_wdt",
+	.id = -1,
+};
+
+static int tangier_probe(struct platform_device *pdev)
+{
+	int ioapic;
+	struct io_apic_irq_attr irq_attr = { 0 };
+
+	ioapic = mp_find_ioapic(TANGIER_EXT_TIMER0_MSI);

Forgot remove this hardcoded irq number. I'll send v4.1 of this patch.

BR, David

Quoted 10 lines
Quoted 8 lines

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 39

Quoted 8 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +8 -0
+	if (ioapic >= 0) {
+		int ret;
+		irq_attr.ioapic = ioapic;
+		irq_attr.ioapic_pin = TANGIER_EXT_TIMER0_MSI;
+		irq_attr.trigger = 1;
+		irq_attr.polarity = 0; /* Active high */
+		ret = io_apic_set_pci_routing(NULL, TANGIER_EXT_TIMER0_MSI,
+					      &irq_attr);

Here is another one, just in case you missed it.

Quoted 3 lines

This one I didn't miss. I checked and it returns dummy error code (-1). Better to keep the hardcoded value.

Thanks for letting me know (guess the idea is for mp_find_ioapic to return "invalid irq"), but I meant the second hard-coded irq....

Guenter

#41 lore raw

Re: [PATCH v4 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 77 lines · Guenter Roeck
Quoted 76 lines · David Cohen
Quoted 74 lines · Guenter Roeck
Quoted 63 lines · David Cohen
Quoted 47 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 66 ++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +21 -0
new file mode 100644
index 000000000000..4b0434b54aff
@@ -0,0 +1,66 @@
+/*
+ * platform_wdt.c: Watchdog platform library file
+ *
+ * (C) Copyright 2014 Intel Corporation
+ * Author: David Cohen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/intel-mid_wdt.h>
+#include <asm/intel-mid.h>
+
+#define TANGIER_EXT_TIMER0_MSI 15
+
+static struct platform_device wdt_dev = {

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 31

Quoted 10 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +10 -0
+	.name = "intel_mid_wdt",
+	.id = -1,
+};
+
+static int tangier_probe(struct platform_device *pdev)
+{
+	int ioapic;
+	struct io_apic_irq_attr irq_attr = { 0 };
+
+	ioapic = mp_find_ioapic(TANGIER_EXT_TIMER0_MSI);

Forgot remove this hardcoded irq number. I'll send v4.1 of this patch.

BR, David

Quoted 8 lines

arch/x86/platform/intel-mid/device_libs/platform_wdt.c line 39

Quoted 8 lines
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +8 -0
+	if (ioapic >= 0) {
+		int ret;
+		irq_attr.ioapic = ioapic;
+		irq_attr.ioapic_pin = TANGIER_EXT_TIMER0_MSI;
+		irq_attr.trigger = 1;
+		irq_attr.polarity = 0; /* Active high */
+		ret = io_apic_set_pci_routing(NULL, TANGIER_EXT_TIMER0_MSI,
+					      &irq_attr);

Here is another one, just in case you missed it.

Quoted 5 lines
Quoted 3 lines

This one I didn't miss. I checked and it returns dummy error code (-1). Better to keep the hardcoded value.

Thanks for letting me know (guess the idea is for mp_find_ioapic to return "invalid irq"), but I meant the second hard-coded irq....

Hm :)
I am aware about that one. I just tried to be a bit lazy when replying.

Thanks,

David

Quoted 2 lines

Guenter

#42 lore raw

PATCH 2/2 x86: intel-mid: add watchdog platform code for Merrifield

In reply to David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).

---

changes from v4 to v4.1:
- dropped hardcoded irq value on mrfl_probe() function in favor or pdata's irq value.
--

 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../platform/intel-mid/device_libs/platform_wdt.c  | 71 ++++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
arch/x86/platform/intel-mid/device_libs/Makefile +1 -0
index 097e7a7940d8..af9307f2cc28 100644
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
arch/x86/platform/intel-mid/device_libs/platform_wdt.c new file +71 -0

71 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer Reviewed-by on v1 2/2
#43 lore raw

Re: [PATCH v4.1 2/2] x86: intel-mid: add watchdog platform code for Merrifield

Quoted 5 lines · David Cohen

This patch adds platform code for Intel Merrifield.
Since the watchdog is not part of SFI table, we have no other option but to manually register watchdog's platform device (argh!).