mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 20:16:02 +07:00
6ed5f8e45d
This platform driver has a OF device ID table but the OF module alias information is not created so module autoloading won't work. Signed-off-by: Luis de Bethencourt <luis@debethencourt.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
69 lines
1.8 KiB
C
69 lines
1.8 KiB
C
/*
|
|
* Copyright (C) 2014 Chen-Yu Tsai
|
|
* Author: Chen-Yu Tsai <wens@csie.org>
|
|
*
|
|
* Allwinner A23 APB0 clock driver
|
|
*
|
|
* License Terms: GNU General Public License v2
|
|
*
|
|
* Based on clk-sun6i-apb0.c
|
|
* Allwinner A31 APB0 clock driver
|
|
*
|
|
* Copyright (C) 2014 Free Electrons
|
|
* Author: Boris BREZILLON <boris.brezillon@free-electrons.com>
|
|
*
|
|
*/
|
|
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/module.h>
|
|
#include <linux/of.h>
|
|
#include <linux/platform_device.h>
|
|
|
|
static int sun8i_a23_apb0_clk_probe(struct platform_device *pdev)
|
|
{
|
|
struct device_node *np = pdev->dev.of_node;
|
|
const char *clk_name = np->name;
|
|
const char *clk_parent;
|
|
struct resource *r;
|
|
void __iomem *reg;
|
|
struct clk *clk;
|
|
|
|
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
reg = devm_ioremap_resource(&pdev->dev, r);
|
|
if (IS_ERR(reg))
|
|
return PTR_ERR(reg);
|
|
|
|
clk_parent = of_clk_get_parent_name(np, 0);
|
|
if (!clk_parent)
|
|
return -EINVAL;
|
|
|
|
of_property_read_string(np, "clock-output-names", &clk_name);
|
|
|
|
/* The A23 APB0 clock is a standard 2 bit wide divider clock */
|
|
clk = clk_register_divider(&pdev->dev, clk_name, clk_parent, 0, reg,
|
|
0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL);
|
|
if (IS_ERR(clk))
|
|
return PTR_ERR(clk);
|
|
|
|
return of_clk_add_provider(np, of_clk_src_simple_get, clk);
|
|
}
|
|
|
|
static const struct of_device_id sun8i_a23_apb0_clk_dt_ids[] = {
|
|
{ .compatible = "allwinner,sun8i-a23-apb0-clk" },
|
|
{ /* sentinel */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, sun8i_a23_apb0_clk_dt_ids);
|
|
|
|
static struct platform_driver sun8i_a23_apb0_clk_driver = {
|
|
.driver = {
|
|
.name = "sun8i-a23-apb0-clk",
|
|
.of_match_table = sun8i_a23_apb0_clk_dt_ids,
|
|
},
|
|
.probe = sun8i_a23_apb0_clk_probe,
|
|
};
|
|
module_platform_driver(sun8i_a23_apb0_clk_driver);
|
|
|
|
MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>");
|
|
MODULE_DESCRIPTION("Allwinner A23 APB0 clock Driver");
|
|
MODULE_LICENSE("GPL v2");
|