Re: [PATCH v3 2/3] clk: lan966x: Add lan966x SoC clock driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Kavyasree Kotagiri (2021-09-09 00:39:46)
> diff --git a/drivers/clk/clk-lan966x.c b/drivers/clk/clk-lan966x.c
> new file mode 100644
> index 000000000000..4492be90cecf
> --- /dev/null
> +++ b/drivers/clk/clk-lan966x.c
> @@ -0,0 +1,235 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Microchip LAN966x SoC Clock driver.
> + *
> + * Copyright (C) 2021 Microchip Technology, Inc. and its subsidiaries
> + *
> + * Author: Kavyasree Kotagiri <kavyasree.kotagiri@xxxxxxxxxxxxx>
> + */
> +
> +#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>
[...]
> +
> +static int lan966x_clk_probe(struct platform_device *pdev)
> +{
> +       struct clk_hw_onecell_data *hw_data;
> +       struct device *dev = &pdev->dev;
> +       const char *parent_names[3];
> +       int i, ret;
> +
> +       hw_data = devm_kzalloc(dev, sizeof(*hw_data), GFP_KERNEL);
> +       if (!hw_data)
> +               return -ENOMEM;
> +
> +       base = devm_platform_ioremap_resource(pdev, 0);
> +       if (IS_ERR(base))
> +               return PTR_ERR(base);
> +
> +       init.ops = &lan966x_gck_ops;
> +       init.num_parents = 3;
> +
> +       for (i = 0; i < init.num_parents; ++i) {
> +               parent_names[i] = of_clk_get_parent_name(pdev->dev.of_node, i);

Please use clk_parent_data instead of of_clk_get_parent_name().

> +               if (!parent_names[i])
> +                       return -EINVAL;
> +       }
> +
> +       init.parent_names = parent_names;
> +       hw_data->num = N_CLOCKS;
> +
> +       for (i = 0; i < N_CLOCKS; i++) {
> +               init.name = clk_names[i];
> +               hw_data->hws[i] = lan966x_gck_clk_register(dev, i);
> +               if (IS_ERR(hw_data->hws[i])) {
> +                       dev_err(dev, "failed to register %s clock\n",
> +                               init.name);
> +                       return ret;

return PTR_ERR(hw_data->hws[i]);

> +               }
> +       }
> +
> +       return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, hw_data);
> +}
> +
> +static const struct of_device_id lan966x_clk_dt_ids[] = {
> +       { .compatible = "microchip,lan966x-gck", },
> +       { }
> +};




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux