devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-kernel@vger.kernel.org, rafal@milecki.pl,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Rob Herring <robh+dt@kernel.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	"maintainer:BROADCOM BCM63XX ARM ARCHITECTURE" 
	<bcm-kernel-feedback-list@broadcom.com>,
	Justin Chen <justinpopo6@gmail.com>,
	"open list:WATCHDOG DEVICE DRIVERS"
	<linux-watchdog@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	"open list:MIPS" <linux-mips@vger.kernel.org>,
	"moderated list:BROADCOM BCM63XX ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/7] watchdog: bcm7038_wdt: Support platform data configuration
Date: Thu, 28 Oct 2021 11:18:42 -0700	[thread overview]
Message-ID: <20211028181842.GA705675@roeck-us.net> (raw)
In-Reply-To: <20211028172322.4021440-4-f.fainelli@gmail.com>

On Thu, Oct 28, 2021 at 10:23:18AM -0700, Florian Fainelli wrote:
> The BCM7038 watchdog driver needs to be able to obtain a specific clock
> name on BCM63xx platforms which is the "periph" clock ticking at 50MHz.
> make it possible to specify the clock name to obtain via platform data.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/bcm7038_wdt.c            | 8 +++++++-
>  include/linux/platform_data/bcm7038_wdt.h | 8 ++++++++
>  2 files changed, 15 insertions(+), 1 deletion(-)
>  create mode 100644 include/linux/platform_data/bcm7038_wdt.h
> 
> diff --git a/drivers/watchdog/bcm7038_wdt.c b/drivers/watchdog/bcm7038_wdt.c
> index acaaa0005d5b..506cd7ef9c77 100644
> --- a/drivers/watchdog/bcm7038_wdt.c
> +++ b/drivers/watchdog/bcm7038_wdt.c
> @@ -10,6 +10,7 @@
>  #include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
> +#include <linux/platform_data/bcm7038_wdt.h>
>  #include <linux/pm.h>
>  #include <linux/watchdog.h>
>  
> @@ -133,8 +134,10 @@ static void bcm7038_clk_disable_unprepare(void *data)
>  
>  static int bcm7038_wdt_probe(struct platform_device *pdev)
>  {
> +	struct bcm7038_wdt_platform_data *pdata = pdev->dev.platform_data;
>  	struct device *dev = &pdev->dev;
>  	struct bcm7038_watchdog *wdt;
> +	const char *clk_name = NULL;
>  	int err;
>  
>  	wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
> @@ -147,7 +150,10 @@ static int bcm7038_wdt_probe(struct platform_device *pdev)
>  	if (IS_ERR(wdt->base))
>  		return PTR_ERR(wdt->base);
>  
> -	wdt->clk = devm_clk_get(dev, NULL);
> +	if (pdata && pdata->clk_name)
> +		clk_name = pdata->clk_name;
> +
> +	wdt->clk = devm_clk_get(dev, clk_name);
>  	/* If unable to get clock, use default frequency */
>  	if (!IS_ERR(wdt->clk)) {
>  		err = clk_prepare_enable(wdt->clk);
> diff --git a/include/linux/platform_data/bcm7038_wdt.h b/include/linux/platform_data/bcm7038_wdt.h
> new file mode 100644
> index 000000000000..e18cfd9ec8f9
> --- /dev/null
> +++ b/include/linux/platform_data/bcm7038_wdt.h
> @@ -0,0 +1,8 @@
> +#ifndef __BCM7038_WDT_PDATA_H
> +#define __BCM7038_WDT_PDATA_H
> +
> +struct bcm7038_wdt_platform_data {
> +	const char *clk_name;
> +};
> +
> +#endif /* __BCM7038_WDT_PDATA_H */
> -- 
> 2.25.1
> 

  reply	other threads:[~2021-10-28 18:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 17:23 [PATCH 0/7] Removal of bcm63xx-wdt Florian Fainelli
2021-10-28 17:23 ` [PATCH 1/7] dt-bindings: watchdog: convert Broadcom's WDT to the json-schema Florian Fainelli
2021-10-28 17:23 ` [PATCH 2/7] dt-bindings: watchdog: Add BCM6345 compatible to BCM7038 binding Florian Fainelli
2021-10-29  2:15   ` Rob Herring
2021-10-28 17:23 ` [PATCH 3/7] watchdog: bcm7038_wdt: Support platform data configuration Florian Fainelli
2021-10-28 18:18   ` Guenter Roeck [this message]
2021-10-28 17:23 ` [PATCH 4/7] watchdog: Allow building BCM7038_WDT for BCM63XX Florian Fainelli
2021-10-28 18:18   ` Guenter Roeck
2021-10-28 17:23 ` [PATCH 5/7] watchdog: bcm7038_wdt: Add platform device id for bcm63xx-wdt Florian Fainelli
2021-10-28 18:19   ` Guenter Roeck
2021-10-29 12:37   ` Rafał Miłecki
2021-10-29 18:34     ` Florian Fainelli
2021-10-28 17:23 ` [PATCH 6/7] MIPS: BCM63XX: Provide platform data to watchdog device Florian Fainelli
2021-10-28 18:19   ` Guenter Roeck
2021-11-02 10:19   ` Thomas Bogendoerfer
2021-10-28 17:23 ` [PATCH 7/7] watchdog: Remove BCM63XX_WDT Florian Fainelli
2021-10-28 18:20   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211028181842.GA705675@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=justinpopo6@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=rafal@milecki.pl \
    --cc=robh+dt@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).