mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
clk: rockchip: rk3288: support driver build as tristate module
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Change-Id: If93da1b970a5932b7ed64a857ec3e178bf6ae755
This commit is contained in:
@@ -59,7 +59,7 @@ config CLK_RK322X
|
||||
Build the driver for RK322x Clock Driver.
|
||||
|
||||
config CLK_RK3288
|
||||
bool "Rockchip RK3288 clock controller support"
|
||||
tristate "Rockchip RK3288 clock controller support"
|
||||
depends on ARM || COMPILE_TEST
|
||||
default y
|
||||
help
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
#include <dt-bindings/clock/rk3288-cru.h>
|
||||
#include "clk.h"
|
||||
@@ -1012,3 +1014,55 @@ static void __init rk3288w_clk_init(struct device_node *np)
|
||||
rk3288_common_init(np, RK3288W_CRU);
|
||||
}
|
||||
CLK_OF_DECLARE(rk3288w_cru, "rockchip,rk3288w-cru", rk3288w_clk_init);
|
||||
|
||||
struct clk_rk3288_inits {
|
||||
void (*inits)(struct device_node *np);
|
||||
};
|
||||
|
||||
static const struct clk_rk3288_inits clk_rk3288_init = {
|
||||
.inits = rk3288_clk_init,
|
||||
};
|
||||
|
||||
static const struct clk_rk3288_inits clk_rk3288w_init = {
|
||||
.inits = rk3288w_clk_init,
|
||||
};
|
||||
|
||||
static const struct of_device_id clk_rk3288_match_table[] = {
|
||||
{
|
||||
.compatible = "rockchip,rk3288-cru",
|
||||
.data = &clk_rk3288_init,
|
||||
}, {
|
||||
.compatible = "rockchip,rk3288w-cru",
|
||||
.data = &clk_rk3288w_init,
|
||||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, clk_rk3288_match_table);
|
||||
|
||||
static int __init clk_rk3288_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
const struct of_device_id *match;
|
||||
const struct clk_rk3288_inits *init_data;
|
||||
|
||||
match = of_match_device(clk_rk3288_match_table, &pdev->dev);
|
||||
if (!match || !match->data)
|
||||
return -EINVAL;
|
||||
|
||||
init_data = match->data;
|
||||
if (init_data->inits)
|
||||
init_data->inits(np);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver clk_rk3288_driver = {
|
||||
.driver = {
|
||||
.name = "clk-rk3288",
|
||||
.of_match_table = clk_rk3288_match_table,
|
||||
},
|
||||
};
|
||||
builtin_platform_driver_probe(clk_rk3288_driver, clk_rk3288_probe);
|
||||
|
||||
MODULE_DESCRIPTION("Rockchip RK3288 Clock Driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
Reference in New Issue
Block a user