All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: u-boot@lists.denx.de
Subject: [PATCH 1/6] clk: meson: add minimal driver for g12a-ao clocks
Date: Tue, 15 Dec 2020 06:50:00 +0900	[thread overview]
Message-ID: <a7925cb2-3688-8f0f-fda2-8f777d862433@samsung.com> (raw)
In-Reply-To: <84d06ecc-70af-b5b1-6a4d-17b77a5679c7@baylibre.com>

On 12/15/20 3:53 AM, Neil Armstrong wrote:
> Hi,
> 
> On 14/12/2020 12:24, Marek Szyprowski wrote:
>> Add minimal driver AO clocks on meson G12A family. Only ADC related clocks
>> are supported.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Change-Id: I0c91848bc55493e19570db333e7da6020d687907
> 
> Please drop the Change-Ids
> 
>> ---
>>  drivers/clk/meson/Makefile  |  1 +
>>  drivers/clk/meson/g12a-ao.c | 83 +++++++++++++++++++++++++++++++++++++
>>  2 files changed, 84 insertions(+)
>>  create mode 100644 drivers/clk/meson/g12a-ao.c
>>
>> diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
>> index c873d6976fa..7204383e173 100644
>> --- a/drivers/clk/meson/Makefile
>> +++ b/drivers/clk/meson/Makefile
>> @@ -6,4 +6,5 @@
>>  obj-$(CONFIG_CLK_MESON_GX) += gxbb.o
>>  obj-$(CONFIG_CLK_MESON_AXG) += axg.o
>>  obj-$(CONFIG_CLK_MESON_G12A) += g12a.o
>> +obj-$(CONFIG_CLK_MESON_G12A) += g12a-ao.o
>>  
>> diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c
>> new file mode 100644
>> index 00000000000..7a0abea77c4
>> --- /dev/null
>> +++ b/drivers/clk/meson/g12a-ao.c
>> @@ -0,0 +1,83 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +
>> +#include <common.h>
>> +#include <log.h>
>> +#include <asm/io.h>
>> +#include <clk-uclass.h>
>> +#include <dm.h>
>> +#include <regmap.h>
>> +#include <syscon.h>
>> +#include <dt-bindings/clock/g12a-aoclkc.h>
>> +
>> +#include "clk_meson.h"
>> +
>> +struct meson_clk {
>> +	struct regmap *map;
>> +};
>> +
>> +#define AO_CLK_GATE0		0x4c
>> +#define AO_SAR_CLK		0x90
>> +
>> +static struct meson_gate gates[] = {
>> +	MESON_GATE(CLKID_AO_SAR_ADC, AO_CLK_GATE0, 8),
>> +	MESON_GATE(CLKID_AO_SAR_ADC_CLK, AO_SAR_CLK, 8),
>> +};
>> +
>> +static int meson_set_gate(struct clk *clk, bool on)
>> +{
>> +	struct meson_clk *priv = dev_get_priv(clk->dev);
>> +	struct meson_gate *gate;
>> +
>> +	if (clk->id >= ARRAY_SIZE(gates))
>> +		return -ENOENT;
>> +
>> +	gate = &gates[clk->id];
>> +
>> +	if (gate->reg == 0)
>> +		return 0;
>> +
>> +	regmap_update_bits(priv->map, gate->reg,
>> +			   BIT(gate->bit), on ? BIT(gate->bit) : 0);
>> +
>> +	return 0;
>> +}
>> +
>> +static int meson_clk_enable(struct clk *clk)
>> +{
>> +	return meson_set_gate(clk, true);
>> +}
>> +
>> +static int meson_clk_disable(struct clk *clk)
>> +{
>> +	return meson_set_gate(clk, false);
>> +}
>> +
>> +static int meson_clk_probe(struct udevice *dev)
>> +{
>> +	struct meson_clk *priv = dev_get_priv(dev);
>> +
>> +	priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
>> +	if (IS_ERR(priv->map))
>> +		return PTR_ERR(priv->map);
>> +
>> +	return 0;
>> +}
>> +
>> +static struct clk_ops meson_clk_ops = {
>> +	.disable	= meson_clk_disable,
>> +	.enable		= meson_clk_enable,
>> +};
>> +
>> +static const struct udevice_id meson_clk_ids[] = {
>> +	{ .compatible = "amlogic,meson-g12a-aoclkc" },
>> +	{ }
>> +};
>> +
>> +U_BOOT_DRIVER(meson_clk_axg) = {
>> +	.name		= "meson_clk_g12a_ao",
>> +	.id		= UCLASS_CLK,
>> +	.of_match	= meson_clk_ids,
>> +	.priv_auto_alloc_size = sizeof(struct meson_clk),
>> +	.ops		= &meson_clk_ops,
>> +	.probe		= meson_clk_probe,
>> +};
>>
> 
> very nice, thanks for addition !
> 
> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

> 

WARNING: multiple messages have this Message-ID (diff)
From: Jaehoon Chung <jh80.chung@samsung.com>
To: Neil Armstrong <narmstrong@baylibre.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	u-boot@lists.denx.de, u-boot-amlogic@groups.io
Cc: Lukasz Majewski <lukma@denx.de>,
	Philippe Reynes <philippe.reynes@softathome.com>,
	Simon Glass <sjg@chromium.org>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH 1/6] clk: meson: add minimal driver for g12a-ao clocks
Date: Tue, 15 Dec 2020 06:50:00 +0900	[thread overview]
Message-ID: <a7925cb2-3688-8f0f-fda2-8f777d862433@samsung.com> (raw)
In-Reply-To: <84d06ecc-70af-b5b1-6a4d-17b77a5679c7@baylibre.com>

On 12/15/20 3:53 AM, Neil Armstrong wrote:
> Hi,
> 
> On 14/12/2020 12:24, Marek Szyprowski wrote:
>> Add minimal driver AO clocks on meson G12A family. Only ADC related clocks
>> are supported.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Change-Id: I0c91848bc55493e19570db333e7da6020d687907
> 
> Please drop the Change-Ids
> 
>> ---
>>  drivers/clk/meson/Makefile  |  1 +
>>  drivers/clk/meson/g12a-ao.c | 83 +++++++++++++++++++++++++++++++++++++
>>  2 files changed, 84 insertions(+)
>>  create mode 100644 drivers/clk/meson/g12a-ao.c
>>
>> diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
>> index c873d6976fa..7204383e173 100644
>> --- a/drivers/clk/meson/Makefile
>> +++ b/drivers/clk/meson/Makefile
>> @@ -6,4 +6,5 @@
>>  obj-$(CONFIG_CLK_MESON_GX) += gxbb.o
>>  obj-$(CONFIG_CLK_MESON_AXG) += axg.o
>>  obj-$(CONFIG_CLK_MESON_G12A) += g12a.o
>> +obj-$(CONFIG_CLK_MESON_G12A) += g12a-ao.o
>>  
>> diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c
>> new file mode 100644
>> index 00000000000..7a0abea77c4
>> --- /dev/null
>> +++ b/drivers/clk/meson/g12a-ao.c
>> @@ -0,0 +1,83 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +
>> +#include <common.h>
>> +#include <log.h>
>> +#include <asm/io.h>
>> +#include <clk-uclass.h>
>> +#include <dm.h>
>> +#include <regmap.h>
>> +#include <syscon.h>
>> +#include <dt-bindings/clock/g12a-aoclkc.h>
>> +
>> +#include "clk_meson.h"
>> +
>> +struct meson_clk {
>> +	struct regmap *map;
>> +};
>> +
>> +#define AO_CLK_GATE0		0x4c
>> +#define AO_SAR_CLK		0x90
>> +
>> +static struct meson_gate gates[] = {
>> +	MESON_GATE(CLKID_AO_SAR_ADC, AO_CLK_GATE0, 8),
>> +	MESON_GATE(CLKID_AO_SAR_ADC_CLK, AO_SAR_CLK, 8),
>> +};
>> +
>> +static int meson_set_gate(struct clk *clk, bool on)
>> +{
>> +	struct meson_clk *priv = dev_get_priv(clk->dev);
>> +	struct meson_gate *gate;
>> +
>> +	if (clk->id >= ARRAY_SIZE(gates))
>> +		return -ENOENT;
>> +
>> +	gate = &gates[clk->id];
>> +
>> +	if (gate->reg == 0)
>> +		return 0;
>> +
>> +	regmap_update_bits(priv->map, gate->reg,
>> +			   BIT(gate->bit), on ? BIT(gate->bit) : 0);
>> +
>> +	return 0;
>> +}
>> +
>> +static int meson_clk_enable(struct clk *clk)
>> +{
>> +	return meson_set_gate(clk, true);
>> +}
>> +
>> +static int meson_clk_disable(struct clk *clk)
>> +{
>> +	return meson_set_gate(clk, false);
>> +}
>> +
>> +static int meson_clk_probe(struct udevice *dev)
>> +{
>> +	struct meson_clk *priv = dev_get_priv(dev);
>> +
>> +	priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
>> +	if (IS_ERR(priv->map))
>> +		return PTR_ERR(priv->map);
>> +
>> +	return 0;
>> +}
>> +
>> +static struct clk_ops meson_clk_ops = {
>> +	.disable	= meson_clk_disable,
>> +	.enable		= meson_clk_enable,
>> +};
>> +
>> +static const struct udevice_id meson_clk_ids[] = {
>> +	{ .compatible = "amlogic,meson-g12a-aoclkc" },
>> +	{ }
>> +};
>> +
>> +U_BOOT_DRIVER(meson_clk_axg) = {
>> +	.name		= "meson_clk_g12a_ao",
>> +	.id		= UCLASS_CLK,
>> +	.of_match	= meson_clk_ids,
>> +	.priv_auto_alloc_size = sizeof(struct meson_clk),
>> +	.ops		= &meson_clk_ops,
>> +	.probe		= meson_clk_probe,
>> +};
>>
> 
> very nice, thanks for addition !
> 
> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

> 


  reply	other threads:[~2020-12-14 21:50 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20201214112449eucas1p28f3ade12253fb8b60c1396c706a65220@eucas1p2.samsung.com>
2020-12-14 11:24 ` [PATCH 0/6] VIM3: add support for checking 'Function' button state Marek Szyprowski
2020-12-14 11:24   ` Marek Szyprowski
     [not found]   ` <CGME20201214112449eucas1p2ce0ef939e0d7f468e64be3555f29ea04@eucas1p2.samsung.com>
2020-12-14 11:24     ` [PATCH 1/6] clk: meson: add minimal driver for g12a-ao clocks Marek Szyprowski
2020-12-14 11:24       ` Marek Szyprowski
2020-12-14 18:53       ` Neil Armstrong
2020-12-14 18:53         ` Neil Armstrong
2020-12-14 21:50         ` Jaehoon Chung [this message]
2020-12-14 21:50           ` Jaehoon Chung
     [not found]   ` <CGME20201214112449eucas1p1ebcf51e2b91ed2bac7fc4d309a174499@eucas1p1.samsung.com>
2020-12-14 11:24     ` [PATCH 2/6] adc: meson-saradc: add G12A variant Marek Szyprowski
2020-12-14 11:24       ` Marek Szyprowski
2020-12-14 18:54       ` Neil Armstrong
2020-12-14 18:54         ` Neil Armstrong
2020-12-14 21:50         ` Jaehoon Chung
2020-12-14 21:50           ` Jaehoon Chung
     [not found]   ` <CGME20201214112450eucas1p1e7ad389bceaaf1082c9afdcb0733e9c0@eucas1p1.samsung.com>
2020-12-14 11:24     ` [PATCH 3/6] adc: meson-saradc: skip hardware init only if ADC is enabled Marek Szyprowski
2020-12-14 11:24       ` Marek Szyprowski
2020-12-14 18:54       ` Neil Armstrong
2020-12-14 18:54         ` Neil Armstrong
2020-12-14 21:50         ` Jaehoon Chung
2020-12-14 21:50           ` Jaehoon Chung
     [not found]   ` <CGME20201214112450eucas1p18b98479811b98d883196c72b0f6deebd@eucas1p1.samsung.com>
2020-12-14 11:24     ` [PATCH 4/6] button: add a simple ADC-based button driver Marek Szyprowski
2020-12-14 11:24       ` Marek Szyprowski
2020-12-19  2:28       ` Simon Glass
2020-12-19  2:28         ` Simon Glass
2020-12-21  9:33         ` Marek Szyprowski
2020-12-21  9:33           ` Marek Szyprowski
2020-12-21 16:46           ` Simon Glass
2020-12-21 16:46             ` Simon Glass
     [not found]   ` <CGME20201214112451eucas1p2ace7794301c6791761fd130c158f3d08@eucas1p2.samsung.com>
2020-12-14 11:24     ` [PATCH 5/6] cmd: button: store button state in the 'button' env Marek Szyprowski
2020-12-14 11:24       ` Marek Szyprowski
2020-12-19  2:28       ` Simon Glass
2020-12-19  2:28         ` Simon Glass
     [not found]   ` <CGME20201214112452eucas1p2ceb557dffa15ea073f922bf59afb8578@eucas1p2.samsung.com>
2020-12-14 11:24     ` [PATCH 6/6] configs: khadas-vim3: enable Function button support Marek Szyprowski
2020-12-14 11:24       ` Marek Szyprowski
2020-12-14 18:55       ` Neil Armstrong
2020-12-14 18:55         ` Neil Armstrong
2020-12-14 20:17         ` Marek Szyprowski
2020-12-14 20:17           ` Marek Szyprowski
2020-12-14 21:51         ` Jaehoon Chung
2020-12-14 21:51           ` Jaehoon Chung

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=a7925cb2-3688-8f0f-fda2-8f777d862433@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=u-boot@lists.denx.de \
    /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.