Merge branches 'clk-managed-registration', 'clk-spdx', 'clk-remove-basic' and 'clk-ops-const' into clk-next
- Make devm_of_clk_add_hw_provider() use parent dt node if necessary - Various SPDX taggings - Mark clk_ops const when possible * clk-managed-registration: clk: bd718x7: Initial support for ROHM bd71837/bd71847 PMIC clock clk: apcs-msm8916: simplify probe cleanup by using devm clk: clk-twl6040: Free of_provider at remove clk: rk808: use managed version of of_provider registration clk: clk-hi655x: Free of_provider at remove clk: of-provider: look at parent if registered device has no provider info clk: Add kerneldoc to managed of-provider interfaces * clk-spdx: clk: Tag basic clk types with SPDX clk: Tag clk core files with SPDX clk: bcm2835: Switch to SPDX identifier * clk-remove-basic: clk: Loongson1: Remove usage of CLK_IS_BASIC clk: samsung: s3c2410: Remove usage of CLK_IS_BASIC clk: versatile: sp810: Remove usage of CLK_IS_BASIC clk: hisilicon: Remove usage of CLK_IS_BASIC clk: h8300: Remove usage of CLK_IS_BASIC clk: axm5516: Remove usage of CLK_IS_BASIC clk: st: Remove usage of CLK_IS_BASIC clk: renesas: Remove usage of CLK_IS_BASIC * clk-ops-const: clk: s2mps11: constify clk_ops structure clk: pxa: constify clk_ops structures clk: pistachio: constify clk_ops structures clk: palmas: constify clk_ops structure clk: max77686: constify clk_ops structure
This commit is contained in:
commit
1a501c8def
@ -283,6 +283,13 @@ config COMMON_CLK_STM32H7
|
||||
---help---
|
||||
Support for stm32h7 SoC family clocks
|
||||
|
||||
config COMMON_CLK_BD718XX
|
||||
tristate "Clock driver for ROHM BD718x7 PMIC"
|
||||
depends on MFD_ROHM_BD718XX
|
||||
help
|
||||
This driver supports ROHM BD71837 and ROHM BD71847
|
||||
PMICs clock gates.
|
||||
|
||||
source "drivers/clk/actions/Kconfig"
|
||||
source "drivers/clk/bcm/Kconfig"
|
||||
source "drivers/clk/hisilicon/Kconfig"
|
||||
|
@ -21,6 +21,7 @@ endif
|
||||
obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o
|
||||
obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o
|
||||
obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o
|
||||
obj-$(CONFIG_COMMON_CLK_BD718XX) += clk-bd718x7.o
|
||||
obj-$(CONFIG_COMMON_CLK_CDCE706) += clk-cdce706.o
|
||||
obj-$(CONFIG_COMMON_CLK_CDCE925) += clk-cdce925.o
|
||||
obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o
|
||||
|
@ -1,15 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2015 Broadcom
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
|
@ -1,17 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010,2015 Broadcom
|
||||
* Copyright (C) 2012 Stephen Warren
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -311,7 +311,6 @@ static struct axxia_divclk clk_per_div = {
|
||||
"clk_sm1_pll"
|
||||
},
|
||||
.num_parents = 1,
|
||||
.flags = CLK_IS_BASIC,
|
||||
.ops = &axxia_divclk_ops,
|
||||
},
|
||||
.reg = 0x1000c,
|
||||
@ -326,7 +325,6 @@ static struct axxia_divclk clk_mmc_div = {
|
||||
"clk_sm1_pll"
|
||||
},
|
||||
.num_parents = 1,
|
||||
.flags = CLK_IS_BASIC,
|
||||
.ops = &axxia_divclk_ops,
|
||||
},
|
||||
.reg = 0x1000c,
|
||||
|
123
drivers/clk/clk-bd718x7.c
Normal file
123
drivers/clk/clk-bd718x7.c
Normal file
@ -0,0 +1,123 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Copyright (C) 2018 ROHM Semiconductors
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mfd/rohm-bd718x7.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
struct bd718xx_clk {
|
||||
struct clk_hw hw;
|
||||
u8 reg;
|
||||
u8 mask;
|
||||
struct platform_device *pdev;
|
||||
struct bd718xx *mfd;
|
||||
};
|
||||
|
||||
static int bd71837_clk_set(struct clk_hw *hw, int status)
|
||||
{
|
||||
struct bd718xx_clk *c = container_of(hw, struct bd718xx_clk, hw);
|
||||
|
||||
return regmap_update_bits(c->mfd->regmap, c->reg, c->mask, status);
|
||||
}
|
||||
|
||||
static void bd71837_clk_disable(struct clk_hw *hw)
|
||||
{
|
||||
int rv;
|
||||
struct bd718xx_clk *c = container_of(hw, struct bd718xx_clk, hw);
|
||||
|
||||
rv = bd71837_clk_set(hw, 0);
|
||||
if (rv)
|
||||
dev_dbg(&c->pdev->dev, "Failed to disable 32K clk (%d)\n", rv);
|
||||
}
|
||||
|
||||
static int bd71837_clk_enable(struct clk_hw *hw)
|
||||
{
|
||||
return bd71837_clk_set(hw, 1);
|
||||
}
|
||||
|
||||
static int bd71837_clk_is_enabled(struct clk_hw *hw)
|
||||
{
|
||||
int enabled;
|
||||
int rval;
|
||||
struct bd718xx_clk *c = container_of(hw, struct bd718xx_clk, hw);
|
||||
|
||||
rval = regmap_read(c->mfd->regmap, c->reg, &enabled);
|
||||
|
||||
if (rval)
|
||||
return rval;
|
||||
|
||||
return enabled & c->mask;
|
||||
}
|
||||
|
||||
static const struct clk_ops bd71837_clk_ops = {
|
||||
.prepare = &bd71837_clk_enable,
|
||||
.unprepare = &bd71837_clk_disable,
|
||||
.is_prepared = &bd71837_clk_is_enabled,
|
||||
};
|
||||
|
||||
static int bd71837_clk_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct bd718xx_clk *c;
|
||||
int rval = -ENOMEM;
|
||||
const char *parent_clk;
|
||||
struct device *parent = pdev->dev.parent;
|
||||
struct bd718xx *mfd = dev_get_drvdata(parent);
|
||||
struct clk_init_data init = {
|
||||
.name = "bd718xx-32k-out",
|
||||
.ops = &bd71837_clk_ops,
|
||||
};
|
||||
|
||||
c = devm_kzalloc(&pdev->dev, sizeof(*c), GFP_KERNEL);
|
||||
if (!c)
|
||||
return -ENOMEM;
|
||||
|
||||
init.num_parents = 1;
|
||||
parent_clk = of_clk_get_parent_name(parent->of_node, 0);
|
||||
|
||||
init.parent_names = &parent_clk;
|
||||
if (!parent_clk) {
|
||||
dev_err(&pdev->dev, "No parent clk found\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
c->reg = BD718XX_REG_OUT32K;
|
||||
c->mask = BD718XX_OUT32K_EN;
|
||||
c->mfd = mfd;
|
||||
c->pdev = pdev;
|
||||
c->hw.init = &init;
|
||||
|
||||
of_property_read_string_index(parent->of_node,
|
||||
"clock-output-names", 0, &init.name);
|
||||
|
||||
rval = devm_clk_hw_register(&pdev->dev, &c->hw);
|
||||
if (rval) {
|
||||
dev_err(&pdev->dev, "failed to register 32K clk");
|
||||
return rval;
|
||||
}
|
||||
rval = devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_simple_get,
|
||||
&c->hw);
|
||||
if (rval)
|
||||
dev_err(&pdev->dev, "adding clk provider failed\n");
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
static struct platform_driver bd71837_clk = {
|
||||
.driver = {
|
||||
.name = "bd718xx-clk",
|
||||
},
|
||||
.probe = bd71837_clk_probe,
|
||||
};
|
||||
|
||||
module_platform_driver(bd71837_clk);
|
||||
|
||||
MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");
|
||||
MODULE_DESCRIPTION("BD71837 chip clk driver");
|
||||
MODULE_LICENSE("GPL");
|
@ -1,19 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright 2017 NXP
|
||||
*
|
||||
* Dong Aisheng <aisheng.dong@nxp.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
|
@ -1,17 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (c) 2013 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
|
@ -1,10 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2014 Samsung Electronics Co., Ltd.
|
||||
* Sylwester Nawrocki <s.nawrocki@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
|
@ -1,9 +1,4 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/clk.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/export.h>
|
||||
|
@ -1,12 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2011 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
|
||||
* Copyright (C) 2011 Richard Zhao, Linaro <richard.zhao@linaro.org>
|
||||
* Copyright (C) 2011-2012 Mike Turquette, Linaro Ltd <mturquette@linaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Adjustable divider clock implementation
|
||||
*/
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2011 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Standard functionality for the common clock API.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/clk-provider.h>
|
||||
|
@ -1,11 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2010-2011 Canonical Ltd <jeremy.kerr@canonical.com>
|
||||
* Copyright (C) 2011-2012 Mike Turquette, Linaro Ltd <mturquette@linaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Fixed rate clock implementation
|
||||
*/
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2014 Intel Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Adjustable fractional divider clock implementation.
|
||||
* Output rate = (m / n) * parent_rate.
|
||||
* Uses rational best approximation algorithm.
|
||||
|
@ -1,11 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2010-2011 Canonical Ltd <jeremy.kerr@canonical.com>
|
||||
* Copyright (C) 2011-2012 Mike Turquette, Linaro Ltd <mturquette@linaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Gated clock implementation
|
||||
*/
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2013 - 2014 Texas Instruments Incorporated - http://www.ti.com
|
||||
*
|
||||
@ -5,10 +6,6 @@
|
||||
* Jyri Sarha <jsarha@ti.com>
|
||||
* Sergej Sawazki <ce3a@gmx.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Gpio controlled clock implementation
|
||||
*/
|
||||
|
||||
|
@ -107,8 +107,8 @@ static int hi655x_clk_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return of_clk_add_hw_provider(parent->of_node, of_clk_hw_simple_get,
|
||||
&hi655x_clk->clk_hw);
|
||||
return devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_simple_get,
|
||||
&hi655x_clk->clk_hw);
|
||||
}
|
||||
|
||||
static struct platform_driver hi655x_clk_driver = {
|
||||
|
@ -137,7 +137,7 @@ static unsigned long max77686_recalc_rate(struct clk_hw *hw,
|
||||
return 32768;
|
||||
}
|
||||
|
||||
static struct clk_ops max77686_clk_ops = {
|
||||
static const struct clk_ops max77686_clk_ops = {
|
||||
.prepare = max77686_clk_prepare,
|
||||
.unprepare = max77686_clk_unprepare,
|
||||
.is_prepared = max77686_clk_is_prepared,
|
||||
|
@ -1,9 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2015 Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/bitops.h>
|
||||
|
@ -1,12 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2011 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
|
||||
* Copyright (C) 2011 Richard Zhao, Linaro <richard.zhao@linaro.org>
|
||||
* Copyright (C) 2011-2012 Mike Turquette, Linaro Ltd <mturquette@linaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Simple multiplexer clock implementation
|
||||
*/
|
||||
|
||||
|
@ -115,7 +115,7 @@ static int palmas_clks_is_prepared(struct clk_hw *hw)
|
||||
return !!(val & cinfo->clk_desc->enable_mask);
|
||||
}
|
||||
|
||||
static struct clk_ops palmas_clks_ops = {
|
||||
static const struct clk_ops palmas_clks_ops = {
|
||||
.prepare = palmas_clks_prepare,
|
||||
.unprepare = palmas_clks_unprepare,
|
||||
.is_prepared = palmas_clks_is_prepared,
|
||||
|
@ -138,23 +138,12 @@ static int rk808_clkout_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_rk808_get, rk808_clkout);
|
||||
}
|
||||
|
||||
static int rk808_clkout_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
|
||||
struct i2c_client *client = rk808->i2c;
|
||||
struct device_node *node = client->dev.of_node;
|
||||
|
||||
of_clk_del_provider(node);
|
||||
|
||||
return 0;
|
||||
return devm_of_clk_add_hw_provider(&pdev->dev, of_clk_rk808_get,
|
||||
rk808_clkout);
|
||||
}
|
||||
|
||||
static struct platform_driver rk808_clkout_driver = {
|
||||
.probe = rk808_clkout_probe,
|
||||
.remove = rk808_clkout_remove,
|
||||
.driver = {
|
||||
.name = "rk808-clkout",
|
||||
},
|
||||
|
@ -71,7 +71,7 @@ static unsigned long s2mps11_clk_recalc_rate(struct clk_hw *hw,
|
||||
return 32768;
|
||||
}
|
||||
|
||||
static struct clk_ops s2mps11_clk_ops = {
|
||||
static const struct clk_ops s2mps11_clk_ops = {
|
||||
.prepare = s2mps11_clk_prepare,
|
||||
.unprepare = s2mps11_clk_unprepare,
|
||||
.is_prepared = s2mps11_clk_is_prepared,
|
||||
|
@ -108,9 +108,8 @@ static int twl6040_pdmclk_probe(struct platform_device *pdev)
|
||||
|
||||
platform_set_drvdata(pdev, clkdata);
|
||||
|
||||
return of_clk_add_hw_provider(pdev->dev.parent->of_node,
|
||||
of_clk_hw_simple_get,
|
||||
&clkdata->pdmclk_hw);
|
||||
return devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_simple_get,
|
||||
&clkdata->pdmclk_hw);
|
||||
}
|
||||
|
||||
static struct platform_driver twl6040_pdmclk_driver = {
|
||||
|
@ -1,11 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2010-2011 Canonical Ltd <jeremy.kerr@canonical.com>
|
||||
* Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Standard functionality for the common clock API. See Documentation/driver-api/clk.rst
|
||||
*/
|
||||
|
||||
@ -3893,6 +3890,39 @@ static void devm_of_clk_release_provider(struct device *dev, void *res)
|
||||
of_clk_del_provider(*(struct device_node **)res);
|
||||
}
|
||||
|
||||
/*
|
||||
* We allow a child device to use its parent device as the clock provider node
|
||||
* for cases like MFD sub-devices where the child device driver wants to use
|
||||
* devm_*() APIs but not list the device in DT as a sub-node.
|
||||
*/
|
||||
static struct device_node *get_clk_provider_node(struct device *dev)
|
||||
{
|
||||
struct device_node *np, *parent_np;
|
||||
|
||||
np = dev->of_node;
|
||||
parent_np = dev->parent ? dev->parent->of_node : NULL;
|
||||
|
||||
if (!of_find_property(np, "#clock-cells", NULL))
|
||||
if (of_find_property(parent_np, "#clock-cells", NULL))
|
||||
np = parent_np;
|
||||
|
||||
return np;
|
||||
}
|
||||
|
||||
/**
|
||||
* devm_of_clk_add_hw_provider() - Managed clk provider node registration
|
||||
* @dev: Device acting as the clock provider (used for DT node and lifetime)
|
||||
* @get: callback for decoding clk_hw
|
||||
* @data: context pointer for @get callback
|
||||
*
|
||||
* Registers clock provider for given device's node. If the device has no DT
|
||||
* node or if the device node lacks of clock provider information (#clock-cells)
|
||||
* then the parent device's node is scanned for this information. If parent node
|
||||
* has the #clock-cells then it is used in registration. Provider is
|
||||
* automatically released at device exit.
|
||||
*
|
||||
* Return: 0 on success or an errno on failure.
|
||||
*/
|
||||
int devm_of_clk_add_hw_provider(struct device *dev,
|
||||
struct clk_hw *(*get)(struct of_phandle_args *clkspec,
|
||||
void *data),
|
||||
@ -3906,7 +3936,7 @@ int devm_of_clk_add_hw_provider(struct device *dev,
|
||||
if (!ptr)
|
||||
return -ENOMEM;
|
||||
|
||||
np = dev->of_node;
|
||||
np = get_clk_provider_node(dev);
|
||||
ret = of_clk_add_hw_provider(np, get, data);
|
||||
if (!ret) {
|
||||
*ptr = np;
|
||||
@ -3950,12 +3980,17 @@ static int devm_clk_provider_match(struct device *dev, void *res, void *data)
|
||||
return *np == data;
|
||||
}
|
||||
|
||||
/**
|
||||
* devm_of_clk_del_provider() - Remove clock provider registered using devm
|
||||
* @dev: Device to whose lifetime the clock provider was bound
|
||||
*/
|
||||
void devm_of_clk_del_provider(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
struct device_node *np = get_clk_provider_node(dev);
|
||||
|
||||
ret = devres_release(dev, devm_of_clk_release_provider,
|
||||
devm_clk_provider_match, dev->of_node);
|
||||
devm_clk_provider_match, np);
|
||||
|
||||
WARN_ON(ret);
|
||||
}
|
||||
|
@ -1,12 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* linux/drivers/clk/clk.h
|
||||
*
|
||||
* Copyright (C) 2013 Samsung Electronics Co., Ltd.
|
||||
* Sylwester Nawrocki <s.nawrocki@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
struct clk_hw;
|
||||
|
@ -117,7 +117,7 @@ static void __init h8s2678_pll_clk_setup(struct device_node *node)
|
||||
parent_name = of_clk_get_parent_name(node, 0);
|
||||
init.name = clk_name;
|
||||
init.ops = &pll_ops;
|
||||
init.flags = CLK_IS_BASIC;
|
||||
init.flags = 0;
|
||||
init.parent_names = &parent_name;
|
||||
init.num_parents = 1;
|
||||
pll_clock->hw.init = &init;
|
||||
|
@ -435,7 +435,7 @@ static struct clk *hisi_register_clk_mmc(struct hisi_mmc_clock *mmc_clk,
|
||||
|
||||
init.name = mmc_clk->name;
|
||||
init.ops = &clk_mmc_ops;
|
||||
init.flags = mmc_clk->flags | CLK_IS_BASIC;
|
||||
init.flags = mmc_clk->flags;
|
||||
init.parent_names = (mmc_clk->parent_name ? &mmc_clk->parent_name : NULL);
|
||||
init.num_parents = (mmc_clk->parent_name ? 1 : 0);
|
||||
mclk->hw.init = &init;
|
||||
|
@ -103,7 +103,7 @@ struct clk *clk_register_hisi_phase(struct device *dev,
|
||||
|
||||
init.name = clks->name;
|
||||
init.ops = &clk_phase_ops;
|
||||
init.flags = clks->flags | CLK_IS_BASIC;
|
||||
init.flags = clks->flags;
|
||||
init.parent_names = clks->parent_names ? &clks->parent_names : NULL;
|
||||
init.num_parents = clks->parent_names ? 1 : 0;
|
||||
|
||||
|
@ -274,7 +274,7 @@ hix5hd2_clk_register_complex(struct hix5hd2_complex_clock *clks, int nums,
|
||||
else
|
||||
init.ops = &clk_complex_ops;
|
||||
|
||||
init.flags = CLK_IS_BASIC;
|
||||
init.flags = 0;
|
||||
init.parent_names =
|
||||
(clks[i].parent_name ? &clks[i].parent_name : NULL);
|
||||
init.num_parents = (clks[i].parent_name ? 1 : 0);
|
||||
|
@ -110,7 +110,7 @@ struct clk *hisi_register_clkgate_sep(struct device *dev, const char *name,
|
||||
|
||||
init.name = name;
|
||||
init.ops = &clkgate_separated_ops;
|
||||
init.flags = flags | CLK_IS_BASIC;
|
||||
init.flags = flags;
|
||||
init.parent_names = (parent_name ? &parent_name : NULL);
|
||||
init.num_parents = (parent_name ? 1 : 0);
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "clk.h"
|
||||
|
||||
struct clk_hw *__init clk_hw_register_pll(struct device *dev,
|
||||
const char *name,
|
||||
const char *parent_name,
|
||||
@ -27,9 +29,9 @@ struct clk_hw *__init clk_hw_register_pll(struct device *dev,
|
||||
|
||||
init.name = name;
|
||||
init.ops = ops;
|
||||
init.flags = flags | CLK_IS_BASIC;
|
||||
init.parent_names = (parent_name ? &parent_name : NULL);
|
||||
init.num_parents = (parent_name ? 1 : 0);
|
||||
init.flags = flags;
|
||||
init.parent_names = parent_name ? &parent_name : NULL;
|
||||
init.num_parents = parent_name ? 1 : 0;
|
||||
hw->init = &init;
|
||||
|
||||
/* register the clock */
|
||||
|
@ -298,7 +298,7 @@ static unsigned long pll_gf40lp_frac_recalc_rate(struct clk_hw *hw,
|
||||
return rate;
|
||||
}
|
||||
|
||||
static struct clk_ops pll_gf40lp_frac_ops = {
|
||||
static const struct clk_ops pll_gf40lp_frac_ops = {
|
||||
.enable = pll_gf40lp_frac_enable,
|
||||
.disable = pll_gf40lp_frac_disable,
|
||||
.is_enabled = pll_gf40lp_frac_is_enabled,
|
||||
@ -307,7 +307,7 @@ static struct clk_ops pll_gf40lp_frac_ops = {
|
||||
.set_rate = pll_gf40lp_frac_set_rate,
|
||||
};
|
||||
|
||||
static struct clk_ops pll_gf40lp_frac_fixed_ops = {
|
||||
static const struct clk_ops pll_gf40lp_frac_fixed_ops = {
|
||||
.enable = pll_gf40lp_frac_enable,
|
||||
.disable = pll_gf40lp_frac_disable,
|
||||
.is_enabled = pll_gf40lp_frac_is_enabled,
|
||||
@ -430,7 +430,7 @@ static unsigned long pll_gf40lp_laint_recalc_rate(struct clk_hw *hw,
|
||||
return rate;
|
||||
}
|
||||
|
||||
static struct clk_ops pll_gf40lp_laint_ops = {
|
||||
static const struct clk_ops pll_gf40lp_laint_ops = {
|
||||
.enable = pll_gf40lp_laint_enable,
|
||||
.disable = pll_gf40lp_laint_disable,
|
||||
.is_enabled = pll_gf40lp_laint_is_enabled,
|
||||
@ -439,7 +439,7 @@ static struct clk_ops pll_gf40lp_laint_ops = {
|
||||
.set_rate = pll_gf40lp_laint_set_rate,
|
||||
};
|
||||
|
||||
static struct clk_ops pll_gf40lp_laint_fixed_ops = {
|
||||
static const struct clk_ops pll_gf40lp_laint_fixed_ops = {
|
||||
.enable = pll_gf40lp_laint_enable,
|
||||
.disable = pll_gf40lp_laint_disable,
|
||||
.is_enabled = pll_gf40lp_laint_is_enabled,
|
||||
|
@ -70,7 +70,7 @@ static unsigned long cken_recalc_rate(struct clk_hw *hw,
|
||||
return clk_fixed_factor_ops.recalc_rate(&fix->hw, parent_rate);
|
||||
}
|
||||
|
||||
static struct clk_ops cken_rate_ops = {
|
||||
static const struct clk_ops cken_rate_ops = {
|
||||
.recalc_rate = cken_recalc_rate,
|
||||
};
|
||||
|
||||
@ -83,7 +83,7 @@ static u8 cken_get_parent(struct clk_hw *hw)
|
||||
return pclk->is_in_low_power() ? 0 : 1;
|
||||
}
|
||||
|
||||
static struct clk_ops cken_mux_ops = {
|
||||
static const struct clk_ops cken_mux_ops = {
|
||||
.get_parent = cken_get_parent,
|
||||
.set_parent = dummy_clk_set_parent,
|
||||
};
|
||||
|
@ -96,8 +96,8 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = of_clk_add_hw_provider(parent->of_node, of_clk_hw_simple_get,
|
||||
&a53cc->clkr.hw);
|
||||
ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get,
|
||||
&a53cc->clkr.hw);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to add clock provider: %d\n", ret);
|
||||
goto err;
|
||||
@ -115,10 +115,8 @@ err:
|
||||
static int qcom_apcs_msm8916_clk_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_regmap_mux_div *a53cc = platform_get_drvdata(pdev);
|
||||
struct device *parent = pdev->dev.parent;
|
||||
|
||||
clk_notifier_unregister(a53cc->pclk, &a53cc->clk_nb);
|
||||
of_clk_del_provider(parent->of_node);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ struct clk * __init cpg_div6_register(const char *name,
|
||||
/* Register the clock. */
|
||||
init.name = name;
|
||||
init.ops = &cpg_div6_clock_ops;
|
||||
init.flags = CLK_IS_BASIC;
|
||||
init.flags = 0;
|
||||
init.parent_names = parent_names;
|
||||
init.num_parents = valid_parents;
|
||||
|
||||
|
@ -158,7 +158,7 @@ static struct clk * __init cpg_mstp_clock_register(const char *name,
|
||||
|
||||
init.name = name;
|
||||
init.ops = &cpg_mstp_clock_ops;
|
||||
init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
/* INTC-SYS is the module clock of the GIC, and must not be disabled */
|
||||
if (!strcmp(name, "intc-sys")) {
|
||||
pr_debug("MSTP %s setting CLK_IS_CRITICAL\n", name);
|
||||
|
@ -424,7 +424,7 @@ r9a06g032_register_gate(struct r9a06g032_priv *clocks,
|
||||
|
||||
init.name = desc->name;
|
||||
init.ops = &r9a06g032_clk_gate_ops;
|
||||
init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = parent_name ? &parent_name : NULL;
|
||||
init.num_parents = parent_name ? 1 : 0;
|
||||
|
||||
@ -595,7 +595,7 @@ r9a06g032_register_div(struct r9a06g032_priv *clocks,
|
||||
|
||||
init.name = desc->name;
|
||||
init.ops = &r9a06g032_clk_div_ops;
|
||||
init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = parent_name ? &parent_name : NULL;
|
||||
init.num_parents = parent_name ? 1 : 0;
|
||||
|
||||
@ -683,7 +683,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks,
|
||||
|
||||
init.name = desc->name;
|
||||
init.ops = &clk_bitselect_ops;
|
||||
init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = names;
|
||||
init.num_parents = 2;
|
||||
|
||||
@ -777,7 +777,7 @@ r9a06g032_register_dualgate(struct r9a06g032_priv *clocks,
|
||||
|
||||
init.name = desc->name;
|
||||
init.ops = &r9a06g032_clk_dualgate_ops;
|
||||
init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = &parent_name;
|
||||
init.num_parents = 1;
|
||||
g->hw.init = &init;
|
||||
|
@ -368,7 +368,7 @@ static struct clk * __init cpg_sd_clk_register(const struct cpg_core_clk *core,
|
||||
|
||||
init.name = core->name;
|
||||
init.ops = &cpg_sd_clock_ops;
|
||||
init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = &parent_name;
|
||||
init.num_parents = 1;
|
||||
|
||||
|
@ -412,7 +412,7 @@ static void __init cpg_mssr_register_mod_clk(const struct mssr_mod_clk *mod,
|
||||
|
||||
init.name = mod->name;
|
||||
init.ops = &cpg_mstp_clock_ops;
|
||||
init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
for (i = 0; i < info->num_crit_mod_clks; i++)
|
||||
if (id == info->crit_mod_clks[i]) {
|
||||
dev_dbg(dev, "MSTP %s setting CLK_IS_CRITICAL\n",
|
||||
|
@ -105,7 +105,7 @@ static struct clk_hw *s3c24xx_register_clkout(struct device *dev,
|
||||
|
||||
init.name = name;
|
||||
init.ops = &s3c24xx_clkout_ops;
|
||||
init.flags = CLK_IS_BASIC;
|
||||
init.flags = 0;
|
||||
init.parent_names = parent_names;
|
||||
init.num_parents = num_parents;
|
||||
|
||||
|
@ -210,7 +210,7 @@ static struct clk *clk_register_flexgen(const char *name,
|
||||
|
||||
init.name = name;
|
||||
init.ops = &flexgen_ops;
|
||||
init.flags = CLK_IS_BASIC | CLK_GET_RATE_NOCACHE | flexgen_flags;
|
||||
init.flags = CLK_GET_RATE_NOCACHE | flexgen_flags;
|
||||
init.parent_names = parent_names;
|
||||
init.num_parents = num_parents;
|
||||
|
||||
|
@ -404,7 +404,7 @@ static struct clk * __init st_clk_register_quadfs_pll(
|
||||
|
||||
init.name = name;
|
||||
init.ops = quadfs->pll_ops;
|
||||
init.flags = CLK_IS_BASIC | CLK_GET_RATE_NOCACHE;
|
||||
init.flags = CLK_GET_RATE_NOCACHE;
|
||||
init.parent_names = &parent_name;
|
||||
init.num_parents = 1;
|
||||
|
||||
@ -843,7 +843,7 @@ static struct clk * __init st_clk_register_quadfs_fsynth(
|
||||
|
||||
init.name = name;
|
||||
init.ops = &st_quadfs_ops;
|
||||
init.flags = flags | CLK_GET_RATE_NOCACHE | CLK_IS_BASIC;
|
||||
init.flags = flags | CLK_GET_RATE_NOCACHE;
|
||||
init.parent_names = &parent_name;
|
||||
init.num_parents = 1;
|
||||
|
||||
|
@ -613,7 +613,7 @@ static struct clk * __init clkgen_pll_register(const char *parent_name,
|
||||
init.name = clk_name;
|
||||
init.ops = pll_data->ops;
|
||||
|
||||
init.flags = pll_flags | CLK_IS_BASIC | CLK_GET_RATE_NOCACHE;
|
||||
init.flags = pll_flags | CLK_GET_RATE_NOCACHE;
|
||||
init.parent_names = &parent_name;
|
||||
init.num_parents = 1;
|
||||
|
||||
|
@ -111,7 +111,7 @@ static void __init clk_sp810_of_setup(struct device_node *node)
|
||||
|
||||
init.name = name;
|
||||
init.ops = &clk_sp810_timerclken_ops;
|
||||
init.flags = CLK_IS_BASIC;
|
||||
init.flags = 0;
|
||||
init.parent_names = parent_names;
|
||||
init.num_parents = num;
|
||||
|
||||
|
@ -1,14 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2015 Broadcom Corporation
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
||||
* kind, whether express or implied; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define BCM2835_AUX_CLOCK_UART 0
|
||||
|
@ -1,14 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2015 Broadcom Corporation
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
||||
* kind, whether express or implied; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define BCM2835_PLLA 0
|
||||
|
@ -1,12 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* linux/include/linux/clk-provider.h
|
||||
*
|
||||
* Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com>
|
||||
* Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef __LINUX_CLK_PROVIDER_H
|
||||
#define __LINUX_CLK_PROVIDER_H
|
||||
|
@ -1,10 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2014 Samsung Electronics Co., Ltd.
|
||||
* Sylwester Nawrocki <s.nawrocki@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
|
Loading…
Reference in New Issue
Block a user