All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Mark Rutland <mark.rutland@arm.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Wen He <wen.he_1@nxp.com>,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-devel@linux.nxdi.nxp.com, linux-kernel@vger.kernel.org
Cc: leoyang.li@nxp.com, liviu.dudau@arm.com, Wen He <wen.he_1@nxp.com>
Subject: Re: [v2 2/3] clk: ls1028a: Add clock driver for Display output interface
Date: Fri, 16 Aug 2019 10:46:23 -0700	[thread overview]
Message-ID: <20190816174624.115FC205F4@mail.kernel.org> (raw)
In-Reply-To: <20190815101613.22872-2-wen.he_1@nxp.com>

Quoting Wen He (2019-08-15 03:16:12)
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index 801fa1cd0321..3c95d8ec31d4 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -223,6 +223,16 @@ config CLK_QORIQ
>           This adds the clock driver support for Freescale QorIQ platforms
>           using common clock framework.
>  
> +config CLK_LS1028A_PLLDIG
> +        bool "Clock driver for LS1028A Display output"
> +       depends on (ARCH_LAYERSCAPE || COMPILE_TEST) && OF

Where is the OF dependency to build anything? Doesn't this still compile
without CONFIG_OF set?

> +       default ARCH_LAYERSCAPE
> +        help
> +          This driver support the Display output interfaces(LCD, DPHY) pixel clocks
> +          of the QorIQ Layerscape LS1028A, as implemented TSMC CLN28HPM PLL. Not all
> +          features of the PLL are currently supported by the driver. By default,
> +          configured bypass mode with this PLL.

These lines look sort of long. Are they under 80 columns?

> +
>  config COMMON_CLK_XGENE
>         bool "Clock driver for APM XGene SoC"
>         default ARCH_XGENE
> diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> index 0cad76021297..c8e22a764c4d 100644
> --- a/drivers/clk/Makefile
> +++ b/drivers/clk/Makefile
> @@ -44,6 +44,7 @@ obj-$(CONFIG_COMMON_CLK_OXNAS)                += clk-oxnas.o
>  obj-$(CONFIG_COMMON_CLK_PALMAS)                += clk-palmas.o
>  obj-$(CONFIG_COMMON_CLK_PWM)           += clk-pwm.o
>  obj-$(CONFIG_CLK_QORIQ)                        += clk-qoriq.o
> +obj-$(CONFIG_CLK_LS1028A_PLLDIG)       += clk-plldig.o
>  obj-$(CONFIG_COMMON_CLK_RK808)         += clk-rk808.o
>  obj-$(CONFIG_COMMON_CLK_HI655X)                += clk-hi655x.o
>  obj-$(CONFIG_COMMON_CLK_S2MPS11)       += clk-s2mps11.o
> diff --git a/drivers/clk/clk-plldig.c b/drivers/clk/clk-plldig.c
> new file mode 100644
> index 000000000000..60988b0ea20a
> --- /dev/null
> +++ b/drivers/clk/clk-plldig.c
> @@ -0,0 +1,278 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright 2019 NXP
> +
> +/*
> + * Clock driver for LS1028A Display output interfaces(LCD, DPHY).
> + */
> +
> +#include <linux/clk-provider.h>
> +#include <linux/device.h>
> +#include <linux/module.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/iopoll.h>
> +#include <linux/of.h>
[...]
> +
> +static int plldig_clk_probe(struct platform_device *pdev)
> +{
> +       struct clk_plldig *data;
> +       struct resource *mem;
> +       const char *parent_name;
> +       struct clk_init_data init = {};
> +       struct device *dev = &pdev->dev;
> +       int ret;
> +
> +       data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> +       if (!data)
> +               return -ENOMEM;
> +
> +       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       data->regs = devm_ioremap_resource(dev, mem);
> +       if (IS_ERR(data->regs))
> +               return PTR_ERR(data->regs);
> +
> +       init.name = dev->of_node->name;
> +       init.ops = &plldig_clk_ops;
> +       parent_name = of_clk_get_parent_name(dev->of_node, 0);
> +       init.parent_names = &parent_name;

Can you use the new way of specifying clk parents with the parent_data
member of clk_init?

> +       init.num_parents = 1;
> +
> +       data->hw.init = &init;
> +       data->dev = dev;
> +
> +       ret = devm_clk_hw_register(dev, &data->hw);
> +       if (ret) {
> +               dev_err(dev, "failed to register %s clock\n", init.name);
> +               return ret;
> +       }
> +
> +       return of_clk_add_hw_provider(dev->of_node, of_clk_hw_simple_get,

Use devm? So that driver remove frees this.

> +                       &data->hw);
> +}
> +
> +static int plldig_clk_remove(struct platform_device *pdev)
> +{
> +       of_clk_del_provider(pdev->dev.of_node);
> +       return 0;
> +}
> +
> +static const struct of_device_id plldig_clk_id[] = {
> +       { .compatible = "fsl,ls1028a-plldig", .data = NULL},
> +       { }
> +};

Add a MODULE_DEVICE_TABLE(of, plldig_clk_id) here.

> +
> +static struct platform_driver plldig_clk_driver = {
> +       .driver = {
> +               .name = "plldig-clock",
> +               .of_match_table = plldig_clk_id,
> +       },
> +       .probe = plldig_clk_probe,
> +       .remove = plldig_clk_remove,
> +};
> +module_platform_driver(plldig_clk_driver);
> +
> +MODULE_LICENSE("GPL v2");
> +MODULE_AUTHOR("Wen He <wen.he_1@nxp.com>");
> +MODULE_DESCRIPTION("LS1028A Display output interface pixel clock driver");
> +MODULE_ALIAS("platform:ls1028a-plldig");

Drop MODULE_ALIAS, it's not useful.


WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@kernel.org>
To: Mark Rutland <mark.rutland@arm.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-devel@linux.nxdi.nxp.com, linux-kernel@vger.kernel.org
Cc: leoyang.li@nxp.com, liviu.dudau@arm.com, Wen He <wen.he_1@nxp.com>
Subject: Re: [v2 2/3] clk: ls1028a: Add clock driver for Display output interface
Date: Fri, 16 Aug 2019 10:46:23 -0700	[thread overview]
Message-ID: <20190816174624.115FC205F4@mail.kernel.org> (raw)
In-Reply-To: <20190815101613.22872-2-wen.he_1@nxp.com>

Quoting Wen He (2019-08-15 03:16:12)
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index 801fa1cd0321..3c95d8ec31d4 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -223,6 +223,16 @@ config CLK_QORIQ
>           This adds the clock driver support for Freescale QorIQ platforms
>           using common clock framework.
>  
> +config CLK_LS1028A_PLLDIG
> +        bool "Clock driver for LS1028A Display output"
> +       depends on (ARCH_LAYERSCAPE || COMPILE_TEST) && OF

Where is the OF dependency to build anything? Doesn't this still compile
without CONFIG_OF set?

> +       default ARCH_LAYERSCAPE
> +        help
> +          This driver support the Display output interfaces(LCD, DPHY) pixel clocks
> +          of the QorIQ Layerscape LS1028A, as implemented TSMC CLN28HPM PLL. Not all
> +          features of the PLL are currently supported by the driver. By default,
> +          configured bypass mode with this PLL.

These lines look sort of long. Are they under 80 columns?

> +
>  config COMMON_CLK_XGENE
>         bool "Clock driver for APM XGene SoC"
>         default ARCH_XGENE
> diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> index 0cad76021297..c8e22a764c4d 100644
> --- a/drivers/clk/Makefile
> +++ b/drivers/clk/Makefile
> @@ -44,6 +44,7 @@ obj-$(CONFIG_COMMON_CLK_OXNAS)                += clk-oxnas.o
>  obj-$(CONFIG_COMMON_CLK_PALMAS)                += clk-palmas.o
>  obj-$(CONFIG_COMMON_CLK_PWM)           += clk-pwm.o
>  obj-$(CONFIG_CLK_QORIQ)                        += clk-qoriq.o
> +obj-$(CONFIG_CLK_LS1028A_PLLDIG)       += clk-plldig.o
>  obj-$(CONFIG_COMMON_CLK_RK808)         += clk-rk808.o
>  obj-$(CONFIG_COMMON_CLK_HI655X)                += clk-hi655x.o
>  obj-$(CONFIG_COMMON_CLK_S2MPS11)       += clk-s2mps11.o
> diff --git a/drivers/clk/clk-plldig.c b/drivers/clk/clk-plldig.c
> new file mode 100644
> index 000000000000..60988b0ea20a
> --- /dev/null
> +++ b/drivers/clk/clk-plldig.c
> @@ -0,0 +1,278 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright 2019 NXP
> +
> +/*
> + * Clock driver for LS1028A Display output interfaces(LCD, DPHY).
> + */
> +
> +#include <linux/clk-provider.h>
> +#include <linux/device.h>
> +#include <linux/module.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/iopoll.h>
> +#include <linux/of.h>
[...]
> +
> +static int plldig_clk_probe(struct platform_device *pdev)
> +{
> +       struct clk_plldig *data;
> +       struct resource *mem;
> +       const char *parent_name;
> +       struct clk_init_data init = {};
> +       struct device *dev = &pdev->dev;
> +       int ret;
> +
> +       data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> +       if (!data)
> +               return -ENOMEM;
> +
> +       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       data->regs = devm_ioremap_resource(dev, mem);
> +       if (IS_ERR(data->regs))
> +               return PTR_ERR(data->regs);
> +
> +       init.name = dev->of_node->name;
> +       init.ops = &plldig_clk_ops;
> +       parent_name = of_clk_get_parent_name(dev->of_node, 0);
> +       init.parent_names = &parent_name;

Can you use the new way of specifying clk parents with the parent_data
member of clk_init?

> +       init.num_parents = 1;
> +
> +       data->hw.init = &init;
> +       data->dev = dev;
> +
> +       ret = devm_clk_hw_register(dev, &data->hw);
> +       if (ret) {
> +               dev_err(dev, "failed to register %s clock\n", init.name);
> +               return ret;
> +       }
> +
> +       return of_clk_add_hw_provider(dev->of_node, of_clk_hw_simple_get,

Use devm? So that driver remove frees this.

> +                       &data->hw);
> +}
> +
> +static int plldig_clk_remove(struct platform_device *pdev)
> +{
> +       of_clk_del_provider(pdev->dev.of_node);
> +       return 0;
> +}
> +
> +static const struct of_device_id plldig_clk_id[] = {
> +       { .compatible = "fsl,ls1028a-plldig", .data = NULL},
> +       { }
> +};

Add a MODULE_DEVICE_TABLE(of, plldig_clk_id) here.

> +
> +static struct platform_driver plldig_clk_driver = {
> +       .driver = {
> +               .name = "plldig-clock",
> +               .of_match_table = plldig_clk_id,
> +       },
> +       .probe = plldig_clk_probe,
> +       .remove = plldig_clk_remove,
> +};
> +module_platform_driver(plldig_clk_driver);
> +
> +MODULE_LICENSE("GPL v2");
> +MODULE_AUTHOR("Wen He <wen.he_1@nxp.com>");
> +MODULE_DESCRIPTION("LS1028A Display output interface pixel clock driver");
> +MODULE_ALIAS("platform:ls1028a-plldig");

Drop MODULE_ALIAS, it's not useful.

  reply	other threads:[~2019-08-16 17:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 10:16 [v2 1/3] dt/bindings: clk: Add YAML schemas for LS1028A Display Clock bindings Wen He
2019-08-15 10:16 ` [v2 2/3] clk: ls1028a: Add clock driver for Display output interface Wen He
2019-08-16 17:46   ` Stephen Boyd [this message]
2019-08-16 17:46     ` Stephen Boyd
2019-08-19  7:30     ` [EXT] " Wen He
2019-08-19 18:29       ` Stephen Boyd
2019-08-20  2:24         ` Wen He
2019-09-16 18:32           ` Stephen Boyd
2019-08-15 10:16 ` [v2 3/3] arm64: dts: ls1028a: Add properties node for Display output pixel clock Wen He
2019-08-15 13:49 ` [v2 1/3] dt/bindings: clk: Add YAML schemas for LS1028A Display Clock bindings Rob Herring
2019-08-16 17:47 ` Stephen Boyd
2019-08-16 17:47   ` Stephen Boyd
2019-08-19  2:14   ` [EXT] " Wen He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190816174624.115FC205F4@mail.kernel.org \
    --to=sboyd@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-devel@linux.nxdi.nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=wen.he_1@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.