From: Jerome Brunet <jbrunet@baylibre.com>
To: Jian Hu <jian.hu@amlogic.com>, Neil Armstrong <narmstrong@baylibre.com>
Cc: Kevin Hilman <khilman@baylibre.com>,
"Rob Herring" <robh@kernel.org>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Qiufang Dai <qiufang.dai@amlogic.com>,
Jianxin Pan <jianxin.pan@amlogic.com>,
Victor Wan <victor.wan@amlogic.com>,
Chandle Zou <chandle.zou@amlogic.com>,
linux-clk@vger.kernel.org, linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/6] clk: meson: eeclk: refactor eeclk common driver to support A1
Date: Thu, 12 Dec 2019 11:19:59 +0100 [thread overview]
Message-ID: <1j7e31lub4.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <20191206074052.15557-4-jian.hu@amlogic.com>
On Fri 06 Dec 2019 at 08:40, Jian Hu <jian.hu@amlogic.com> wrote:
> Introduce a common probe function for A1 series, the way to get
> regmap is different between A1 series and the previous series.
> The register region is only for one clock driver, the function of
> meson_eeclkc_probe is not fit for A1, So it is necessary to
> introduce a new function.
Please drop this patch
#1 you are patching the EE driver for something that is no longer an EE
driver
#2 Let's get the basics right, you can move (re)factoring afterward
Your probe function is simple enough. Just properly write it in each
driver for now.
>
> Signed-off-by: Jian Hu <jian.hu@amlogic.com>
> ---
> drivers/clk/meson/meson-eeclk.c | 59 +++++++++++++++++++++++++++------
> drivers/clk/meson/meson-eeclk.h | 1 +
> 2 files changed, 50 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/clk/meson/meson-eeclk.c b/drivers/clk/meson/meson-eeclk.c
> index a7cb1e7aedc4..12ceb1caabd8 100644
> --- a/drivers/clk/meson/meson-eeclk.c
> +++ b/drivers/clk/meson/meson-eeclk.c
> @@ -13,25 +13,37 @@
> #include "clk-regmap.h"
> #include "meson-eeclk.h"
>
> -int meson_eeclkc_probe(struct platform_device *pdev)
> +static struct regmap_config clkc_regmap_config = {
> + .reg_bits = 32,
> + .val_bits = 32,
> + .reg_stride = 4,
> +};
> +
> +static struct regmap *meson_regmap_resource(struct platform_device *pdev)
> +{
> + struct resource *res;
> + void __iomem *base;
> + struct device *dev = &pdev->dev;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +
> + base = devm_ioremap_resource(dev, res);
> + if (IS_ERR(base))
> + return ERR_CAST(base);
> +
> + return devm_regmap_init_mmio(dev, base, &clkc_regmap_config);
> +}
> +
> +static int meson_common_probe(struct platform_device *pdev, struct regmap *map)
> {
> const struct meson_eeclkc_data *data;
> struct device *dev = &pdev->dev;
> - struct regmap *map;
> int ret, i;
>
> data = of_device_get_match_data(dev);
> if (!data)
> return -EINVAL;
>
> - /* Get the hhi system controller node */
> - map = syscon_node_to_regmap(of_get_parent(dev->of_node));
> - if (IS_ERR(map)) {
> - dev_err(dev,
> - "failed to get HHI regmap\n");
> - return PTR_ERR(map);
> - }
> -
> if (data->init_count)
> regmap_multi_reg_write(map, data->init_regs, data->init_count);
>
> @@ -54,3 +66,30 @@ int meson_eeclkc_probe(struct platform_device *pdev)
> return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
> data->hw_onecell_data);
> }
> +
> +int meson_eeclkc_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct regmap *map;
> +
> + /* Get the hhi system controller node */
> + map = syscon_node_to_regmap(of_get_parent(dev->of_node));
> + if (IS_ERR(map)) {
> + dev_err(dev,
> + "failed to get HHI regmap\n");
> + return PTR_ERR(map);
> + }
> +
> + return meson_common_probe(pdev, map);
> +}
> +
> +int meson_clkc_probe(struct platform_device *pdev)
> +{
> + struct regmap *map;
> +
> + map = meson_regmap_resource(pdev);
> + if (IS_ERR(map))
> + return PTR_ERR(map);
> +
> + return meson_common_probe(pdev, map);
> +}
> diff --git a/drivers/clk/meson/meson-eeclk.h b/drivers/clk/meson/meson-eeclk.h
> index 77316207bde1..a2e9ab3a4f6b 100644
> --- a/drivers/clk/meson/meson-eeclk.h
> +++ b/drivers/clk/meson/meson-eeclk.h
> @@ -21,5 +21,6 @@ struct meson_eeclkc_data {
> };
>
> int meson_eeclkc_probe(struct platform_device *pdev);
> +int meson_clkc_probe(struct platform_device *pdev);
>
> #endif /* __MESON_CLKC_H */
next prev parent reply other threads:[~2019-12-12 10:20 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 7:40 [PATCH v4 0/6] add Amlogic A1 clock controller driver Jian Hu
2019-12-06 7:40 ` [PATCH v4 1/6] dt-bindings: clock: meson: add A1 PLL clock controller bindings Jian Hu
2019-12-12 9:57 ` Jerome Brunet
2019-12-13 9:35 ` Jian Hu
2019-12-13 10:38 ` Maxime Ripard
2019-12-18 8:00 ` Jian Hu
2019-12-18 12:57 ` Maxime Ripard
2019-12-06 7:40 ` [PATCH v4 2/6] clk: meson: add support for A1 PLL clock ops Jian Hu
2019-12-12 10:16 ` Jerome Brunet
2019-12-17 8:41 ` Jian Hu
2019-12-17 9:29 ` Jerome Brunet
2019-12-18 8:37 ` Jian Hu
2019-12-20 7:03 ` Jian Hu
2019-12-06 7:40 ` [PATCH v4 3/6] clk: meson: eeclk: refactor eeclk common driver to support A1 Jian Hu
2019-12-12 10:19 ` Jerome Brunet [this message]
2019-12-17 9:36 ` Jian Hu
2019-12-06 7:40 ` [PATCH v4 4/6] clk: meson: a1: add support for Amlogic A1 PLL clock driver Jian Hu
2019-12-12 10:28 ` Jerome Brunet
2019-12-12 10:42 ` Jerome Brunet
2019-12-18 6:01 ` Jian Hu
2019-12-06 7:40 ` [PATCH v4 5/6] dt-bindings: clock: meson: add A1 peripheral clock controller bindings Jian Hu
2019-12-12 9:59 ` Jerome Brunet
2019-12-18 7:00 ` Jian Hu
2019-12-06 7:40 ` [PATCH v4 6/6] clk: meson: a1: add support for Amlogic A1 Peripheral clock driver Jian Hu
2019-12-12 11:01 ` Jerome Brunet
2019-12-18 7:20 ` Jian Hu
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=1j7e31lub4.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=chandle.zou@amlogic.com \
--cc=jian.hu@amlogic.com \
--cc=jianxin.pan@amlogic.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=mturquette@baylibre.com \
--cc=narmstrong@baylibre.com \
--cc=qiufang.dai@amlogic.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=victor.wan@amlogic.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).