mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
watchdog: bcm7038_wdt: Support platform data configuration
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> Link: https://lore.kernel.org/r/20211112224636.395101-4-f.fainelli@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
This commit is contained in:
committed by
Wim Van Sebroeck
parent
17fffe91ba
commit
d6b9c679bb
@@ -10,6 +10,7 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/platform_data/bcm7038_wdt.h>
|
||||||
#include <linux/pm.h>
|
#include <linux/pm.h>
|
||||||
#include <linux/watchdog.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)
|
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 device *dev = &pdev->dev;
|
||||||
struct bcm7038_watchdog *wdt;
|
struct bcm7038_watchdog *wdt;
|
||||||
|
const char *clk_name = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
|
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))
|
if (IS_ERR(wdt->base))
|
||||||
return PTR_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 unable to get clock, use default frequency */
|
||||||
if (!IS_ERR(wdt->clk)) {
|
if (!IS_ERR(wdt->clk)) {
|
||||||
err = clk_prepare_enable(wdt->clk);
|
err = clk_prepare_enable(wdt->clk);
|
||||||
|
|||||||
8
include/linux/platform_data/bcm7038_wdt.h
Normal file
8
include/linux/platform_data/bcm7038_wdt.h
Normal file
@@ -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 */
|
||||||
Reference in New Issue
Block a user