devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 07/11] watchdog: xilinx: Use of_property_read_u32
       [not found] <f298edd222c57b0ce1ebad3ae50c3f715406c631.1392101734.git.michal.simek@xilinx.com>
@ 2014-02-11  6:55 ` Michal Simek
       [not found]   ` <7aa6e41032ebad0ffb2e1df20beb4f00e38d29e2.1392101734.git.michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
  2014-02-11  6:55 ` [PATCH v2 09/11] watchdog: xilinx: Add missing binding Michal Simek
  1 sibling, 1 reply; 4+ messages in thread
From: Michal Simek @ 2014-02-11  6:55 UTC (permalink / raw)
  To: linux-kernel, monstr
  Cc: Guenter Roeck, Wim Van Sebroeck, Grant Likely, Rob Herring,
	linux-watchdog, linux-arm-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 2302 bytes --]

Use of_property_read_u32 functions to clean probe function.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2:
- Fix enable_once logic
- Change patch subject

 drivers/watchdog/of_xilinx_wdt.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
index c229cc4..bb03e5b 100644
--- a/drivers/watchdog/of_xilinx_wdt.c
+++ b/drivers/watchdog/of_xilinx_wdt.c
@@ -147,8 +147,7 @@ static u32 xwdt_selftest(struct xwdt_device *xdev)
 static int xwdt_probe(struct platform_device *pdev)
 {
 	int rc;
-	u32 *tmptr;
-	u32 *pfreq;
+	u32 pfreq, enable_once = 0;
 	struct resource *res;
 	struct xwdt_device *xdev;
 	bool no_timeout = false;
@@ -168,32 +167,29 @@ static int xwdt_probe(struct platform_device *pdev)
 	if (IS_ERR(xdev->base))
 		return PTR_ERR(xdev->base);

-	pfreq = (u32 *)of_get_property(pdev->dev.of_node,
-					"clock-frequency", NULL);
-
-	if (pfreq == NULL) {
+	rc = of_property_read_u32(pdev->dev.of_node, "clock-frequency", &pfreq);
+	if (rc) {
 		dev_warn(&pdev->dev,
 			 "The watchdog clock frequency cannot be obtained\n");
 		no_timeout = true;
 	}

-	tmptr = (u32 *)of_get_property(pdev->dev.of_node,
-					"xlnx,wdt-interval", NULL);
-	if (tmptr == NULL) {
+	rc = of_property_read_u32(pdev->dev.of_node, "xlnx,wdt-interval",
+				  &xdev->wdt_interval);
+	if (rc) {
 		dev_warn(&pdev->dev,
 			 "Parameter \"xlnx,wdt-interval\" not found\n");
 		no_timeout = true;
-	} else {
-		xdev->wdt_interval = *tmptr;
 	}

-	tmptr = (u32 *)of_get_property(pdev->dev.of_node,
-					"xlnx,wdt-enable-once", NULL);
-	if (tmptr == NULL) {
+	rc = of_property_read_u32(pdev->dev.of_node, "xlnx,wdt-enable-once",
+				  &enable_once);
+	if (rc)
 		dev_warn(&pdev->dev,
 			 "Parameter \"xlnx,wdt-enable-once\" not found\n");
+
+	if (enable_once)
 		watchdog_set_nowayout(xilinx_wdt_wdd, true);
-	}

 /*
  *  Twice of the 2^wdt_interval / freq  because the first wdt overflow is
@@ -201,7 +197,7 @@ static int xwdt_probe(struct platform_device *pdev)
  */
 	if (!no_timeout)
 		xilinx_wdt_wdd->timeout = 2 * ((1 << xdev->wdt_interval) /
-					  *pfreq);
+					  pfreq);

 	spin_lock_init(&xdev->spinlock);
 	watchdog_set_drvdata(xilinx_wdt_wdd, xdev);
--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* [PATCH v2 09/11] watchdog: xilinx: Add missing binding
       [not found] <f298edd222c57b0ce1ebad3ae50c3f715406c631.1392101734.git.michal.simek@xilinx.com>
  2014-02-11  6:55 ` [PATCH v2 07/11] watchdog: xilinx: Use of_property_read_u32 Michal Simek
@ 2014-02-11  6:55 ` Michal Simek
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Simek @ 2014-02-11  6:55 UTC (permalink / raw)
  To: linux-kernel, monstr
  Cc: Guenter Roeck, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Rob Landley, Arnd Bergmann, devicetree,
	linux-doc, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]

Document current driver binding.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---

Changes in v2: None

 .../devicetree/bindings/watchdog/of-xilinx-wdt.txt | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/of-xilinx-wdt.txt

diff --git a/Documentation/devicetree/bindings/watchdog/of-xilinx-wdt.txt b/Documentation/devicetree/bindings/watchdog/of-xilinx-wdt.txt
new file mode 100644
index 0000000..6d63782
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/of-xilinx-wdt.txt
@@ -0,0 +1,23 @@
+Xilinx AXI/PLB soft-core watchdog Device Tree Bindings
+---------------------------------------------------------
+
+Required properties:
+- compatible		: Should be "xlnx,xps-timebase-wdt-1.00.a" or
+			  "xlnx,xps-timebase-wdt-1.01.a".
+- reg			: Physical base address and size
+
+Optional properties:
+- clock-frequency	: Frequency of clock in Hz
+- xlnx,wdt-enable-once	: 0 - Watchdog can be restarted
+			  1 - Watchdog can be enabled just once
+- xlnx,wdt-interval	: Watchdog timeout interval in 2^<val> clock cycles,
+			  <val> is integer from 8 to 31.
+
+Example:
+axi-timebase-wdt@40100000 {
+	clock-frequency = <50000000>;
+	compatible = "xlnx,xps-timebase-wdt-1.00.a";
+	reg = <0x40100000 0x10000>;
+	xlnx,wdt-enable-once = <0x0>;
+	xlnx,wdt-interval = <0x1b>;
+} ;
--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH v2 07/11] watchdog: xilinx: Use of_property_read_u32
       [not found]   ` <7aa6e41032ebad0ffb2e1df20beb4f00e38d29e2.1392101734.git.michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2014-02-11 20:20     ` Guenter Roeck
  2014-02-12  8:13       ` Michal Simek
  0 siblings, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2014-02-11 20:20 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	monstr-pSz03upnqPeHXe+LvDLADg, Wim Van Sebroeck, Grant Likely,
	Rob Herring, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Tue, Feb 11, 2014 at 07:55:50AM +0100, Michal Simek wrote:
> Use of_property_read_u32 functions to clean probe function.
> 
> Signed-off-by: Michal Simek <michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
> ---
> 
[ ... ]

> +
> +	if (enable_once)
>  		watchdog_set_nowayout(xilinx_wdt_wdd, true);
> -	}

	watchdog_set_nowayout(xilinx_wdt_wdd, enable_once);

would probably do as well (the function checks the flag as well).

Nitpick, so

Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 07/11] watchdog: xilinx: Use of_property_read_u32
  2014-02-11 20:20     ` Guenter Roeck
@ 2014-02-12  8:13       ` Michal Simek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2014-02-12  8:13 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Michal Simek, linux-kernel, Wim Van Sebroeck, Grant Likely,
	Rob Herring, linux-watchdog, linux-arm-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 926 bytes --]

On 02/11/2014 09:20 PM, Guenter Roeck wrote:
> On Tue, Feb 11, 2014 at 07:55:50AM +0100, Michal Simek wrote:
>> Use of_property_read_u32 functions to clean probe function.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
> [ ... ]
> 
>> +
>> +	if (enable_once)
>>  		watchdog_set_nowayout(xilinx_wdt_wdd, true);
>> -	}
> 
> 	watchdog_set_nowayout(xilinx_wdt_wdd, enable_once);
> 
> would probably do as well (the function checks the flag as well).
> 
> Nitpick, so
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

I will change it and send v3.

Thanks,
Michal



-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

end of thread, other threads:[~2014-02-12  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <f298edd222c57b0ce1ebad3ae50c3f715406c631.1392101734.git.michal.simek@xilinx.com>
2014-02-11  6:55 ` [PATCH v2 07/11] watchdog: xilinx: Use of_property_read_u32 Michal Simek
     [not found]   ` <7aa6e41032ebad0ffb2e1df20beb4f00e38d29e2.1392101734.git.michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2014-02-11 20:20     ` Guenter Roeck
2014-02-12  8:13       ` Michal Simek
2014-02-11  6:55 ` [PATCH v2 09/11] watchdog: xilinx: Add missing binding Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).