#include <linux/bitfield.h>
#include <linux/clk-provider.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <dt-bindings/clock/microchip,lan966x.h>
#define GCK_ENA …
#define GCK_SRC_SEL …
#define GCK_PRESCALER …
#define DIV_MAX …
static const char *clk_names[N_CLOCKS] = …;
struct lan966x_gck { … };
#define to_lan966x_gck(hw) …
static const struct clk_parent_data lan966x_gck_pdata[] = …;
static struct clk_init_data init = …;
struct clk_gate_soc_desc { … };
static const struct clk_gate_soc_desc clk_gate_desc[] = …;
static DEFINE_SPINLOCK(clk_gate_lock);
static void __iomem *base;
static int lan966x_gck_enable(struct clk_hw *hw)
{ … }
static void lan966x_gck_disable(struct clk_hw *hw)
{ … }
static int lan966x_gck_set_rate(struct clk_hw *hw,
unsigned long rate,
unsigned long parent_rate)
{ … }
static unsigned long lan966x_gck_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{ … }
static int lan966x_gck_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
static u8 lan966x_gck_get_parent(struct clk_hw *hw)
{ … }
static int lan966x_gck_set_parent(struct clk_hw *hw, u8 index)
{ … }
static const struct clk_ops lan966x_gck_ops = …;
static struct clk_hw *lan966x_gck_clk_register(struct device *dev, int i)
{
struct lan966x_gck *priv;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return ERR_PTR(-ENOMEM);
priv->reg = base + (i * 4);
priv->hw.init = &init;
ret = devm_clk_hw_register(dev, &priv->hw);
if (ret)
return ERR_PTR(ret);
return &priv->hw;
};
static int lan966x_gate_clk_register(struct device *dev,
struct clk_hw_onecell_data *hw_data,
void __iomem *gate_base)
{ … }
static int lan966x_clk_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id lan966x_clk_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, lan966x_clk_dt_ids);
static struct platform_driver lan966x_clk_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;