All of lore.kernel.org
 help / color / mirror / Atom feed
From: sebastian.hesselbarth@gmail.com (Sebastian Hesselbarth)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/8] clk: berlin: add core clock driver for BG2/BG2CD
Date: Wed, 14 May 2014 13:48:14 +0200	[thread overview]
Message-ID: <537357FE.2050803@gmail.com> (raw)
In-Reply-To: <20140514114315.GJ29318@piout.net>

On 05/14/2014 01:43 PM, Alexandre Belloni wrote:
> On 11/05/2014 at 22:24:39 +0200, Sebastian Hesselbarth wrote :
>> This driver deals with the core clocks found on Marvell Berlin
>> BG2 and BG2CD. For the shared register dividers, make use of the
>> corresponding driver and add some single clock muxes and gates for
>> the rest.
>>
>> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
[...]
>> diff --git a/drivers/clk/berlin/bg2.c b/drivers/clk/berlin/bg2.c
>> new file mode 100644
>> index 000000000000..7fe04e11861b
>> --- /dev/null
>> +++ b/drivers/clk/berlin/bg2.c
>> @@ -0,0 +1,509 @@
>> +/*
>> + * Copyright (c) 2014 Marvell Technology Group Ltd.
>> + *
>> + * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>> + * Alexandre Belloni <alexandre.belloni@free-electrons.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms and conditions of the GNU General Public License,
>> + * version 2, as published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope it will be useful, but WITHOUT
>> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
>> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
>> + * more details.
>> + *
>> + * You should have received a copy of the GNU General Public License along with
>> + * this program.  If not, see <http://www.gnu.org/licenses/>.
>> + */
>> +
>> +#include <linux/clk.h>
>> +#include <linux/clk-provider.h>
>> +#include <linux/io.h>
>> +#include <linux/kernel.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/slab.h>
>> +
>> +#include "berlin2-div.h"
>> +
>> +/*
>> + * BG2/BG2CD SoCs have the following audio/video I/O units:
>> + *
>> + * audiohd: HDMI TX audio
>> + * audio0:  7.1ch TX
>> + * audio1:  2ch TX
>> + * audio2:  2ch RX
>> + * audio3:  SPDIF TX
>> + * video0:  HDMI video
>> + * video1:  Secondary video
>> + * video2:  SD auxiliary video
>> + *
>> + * There are no external audio clocks (ACLKI0, ACLKI1) and
>> + * only one external video clock (VCLKI0).
>> + *
>> + * Currently missing bits and pieces:
>> + * - audio_fast_pll is unknown
>> + * - audiohd_pll is unknown
>> + * - video0_pll is unknown
>> + * - audio[023], audiohd parent pll is assumed to be audio_fast_pll
>> + *
>> + */
>> +
>> +struct bg2_gate_data {
>> +	const char *name;
>> +	const char *parent_name;
>> +	u8 bit_idx;
>> +	unsigned long flags;
>> +};
>> +
>> +#define REG_CLKENABLE		0x00
>> +#define REG_CLKSELECT0		0x04
>> +#define REG_CLKSELECT1		0x08
>> +#define REG_CLKSELECT2		0x0c
>> +#define REG_CLKSELECT3		0x10
>> +#define REG_CLKSWITCH0		0x14
>> +#define REG_CLKSWITCH1		0x18
>> +
>> +enum {
>> +	/* clock divider cells */
>> +	SYS, CPU, DRMFIGO, CFG, GFX, ZSP, PERIF, PCUBE, VSCOPE, NFC_ECC,
>> +	VPP, APP, AUDIO0, AUDIO2, AUDIO3, AUDIO1,
>> +	/* clock gates */
>> +	GETH0, GETH1, SATA, AHBAPB, USB0, USB1, PBRIDGE, SDIO0, SDIO1,
>> +	NFC, SMEMC, AUDIOHD, VIDEO0, VIDEO1, VIDEO2,
>> +	MAX_CLKS
>> +};
>> +
>
> Shouldn't you reuse the CLKID_* that you are introducing in
> dt-bindings/clock/berlin2.h in a following patch there ?
> That would prevent inconsistencies.

I didn't follow the discussion of whether it is reasonable to
include dt-bindings/foo.h into driver code. But a quick git grep
reveals at least some drivers do it.

So, yes, if that is still valid, I fix it up to reuse the dt-binding
include here.

Sebastian

WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Antoine Tenart <antoine.tenart@free-electrons.com>,
	Mike Turquette <mturquette@linaro.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 6/8] clk: berlin: add core clock driver for BG2/BG2CD
Date: Wed, 14 May 2014 13:48:14 +0200	[thread overview]
Message-ID: <537357FE.2050803@gmail.com> (raw)
In-Reply-To: <20140514114315.GJ29318@piout.net>

On 05/14/2014 01:43 PM, Alexandre Belloni wrote:
> On 11/05/2014 at 22:24:39 +0200, Sebastian Hesselbarth wrote :
>> This driver deals with the core clocks found on Marvell Berlin
>> BG2 and BG2CD. For the shared register dividers, make use of the
>> corresponding driver and add some single clock muxes and gates for
>> the rest.
>>
>> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
[...]
>> diff --git a/drivers/clk/berlin/bg2.c b/drivers/clk/berlin/bg2.c
>> new file mode 100644
>> index 000000000000..7fe04e11861b
>> --- /dev/null
>> +++ b/drivers/clk/berlin/bg2.c
>> @@ -0,0 +1,509 @@
>> +/*
>> + * Copyright (c) 2014 Marvell Technology Group Ltd.
>> + *
>> + * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>> + * Alexandre Belloni <alexandre.belloni@free-electrons.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms and conditions of the GNU General Public License,
>> + * version 2, as published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope it will be useful, but WITHOUT
>> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
>> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
>> + * more details.
>> + *
>> + * You should have received a copy of the GNU General Public License along with
>> + * this program.  If not, see <http://www.gnu.org/licenses/>.
>> + */
>> +
>> +#include <linux/clk.h>
>> +#include <linux/clk-provider.h>
>> +#include <linux/io.h>
>> +#include <linux/kernel.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/slab.h>
>> +
>> +#include "berlin2-div.h"
>> +
>> +/*
>> + * BG2/BG2CD SoCs have the following audio/video I/O units:
>> + *
>> + * audiohd: HDMI TX audio
>> + * audio0:  7.1ch TX
>> + * audio1:  2ch TX
>> + * audio2:  2ch RX
>> + * audio3:  SPDIF TX
>> + * video0:  HDMI video
>> + * video1:  Secondary video
>> + * video2:  SD auxiliary video
>> + *
>> + * There are no external audio clocks (ACLKI0, ACLKI1) and
>> + * only one external video clock (VCLKI0).
>> + *
>> + * Currently missing bits and pieces:
>> + * - audio_fast_pll is unknown
>> + * - audiohd_pll is unknown
>> + * - video0_pll is unknown
>> + * - audio[023], audiohd parent pll is assumed to be audio_fast_pll
>> + *
>> + */
>> +
>> +struct bg2_gate_data {
>> +	const char *name;
>> +	const char *parent_name;
>> +	u8 bit_idx;
>> +	unsigned long flags;
>> +};
>> +
>> +#define REG_CLKENABLE		0x00
>> +#define REG_CLKSELECT0		0x04
>> +#define REG_CLKSELECT1		0x08
>> +#define REG_CLKSELECT2		0x0c
>> +#define REG_CLKSELECT3		0x10
>> +#define REG_CLKSWITCH0		0x14
>> +#define REG_CLKSWITCH1		0x18
>> +
>> +enum {
>> +	/* clock divider cells */
>> +	SYS, CPU, DRMFIGO, CFG, GFX, ZSP, PERIF, PCUBE, VSCOPE, NFC_ECC,
>> +	VPP, APP, AUDIO0, AUDIO2, AUDIO3, AUDIO1,
>> +	/* clock gates */
>> +	GETH0, GETH1, SATA, AHBAPB, USB0, USB1, PBRIDGE, SDIO0, SDIO1,
>> +	NFC, SMEMC, AUDIOHD, VIDEO0, VIDEO1, VIDEO2,
>> +	MAX_CLKS
>> +};
>> +
>
> Shouldn't you reuse the CLKID_* that you are introducing in
> dt-bindings/clock/berlin2.h in a following patch there ?
> That would prevent inconsistencies.

I didn't follow the discussion of whether it is reasonable to
include dt-bindings/foo.h into driver code. But a quick git grep
reveals at least some drivers do it.

So, yes, if that is still valid, I fix it up to reuse the dt-binding
include here.

Sebastian


  reply	other threads:[~2014-05-14 11:48 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-11 20:24 [PATCH 0/8] Marvell Berlin full clock support Sebastian Hesselbarth
2014-05-11 20:24 ` Sebastian Hesselbarth
2014-05-11 20:24 ` [PATCH 1/8] clk: add helper for unique DT clock names Sebastian Hesselbarth
2014-05-11 20:24   ` Sebastian Hesselbarth
2014-05-11 20:24   ` Sebastian Hesselbarth
2014-05-13 19:49   ` Mike Turquette
2014-05-13 19:49     ` Mike Turquette
2014-05-13 19:49     ` Mike Turquette
2014-05-13 20:19     ` Sebastian Hesselbarth
2014-05-13 20:19       ` Sebastian Hesselbarth
2014-05-13 20:19       ` Sebastian Hesselbarth
2014-05-13 20:51       ` Mike Turquette
2014-05-13 20:51         ` Mike Turquette
2014-05-13 21:25         ` Sebastian Hesselbarth
2014-05-13 21:25           ` Sebastian Hesselbarth
2014-05-13 21:25           ` Sebastian Hesselbarth
2014-05-11 20:24 ` [PATCH 2/8] clk: berlin: add clock binding docs for Marvell Berlin2 SoCs Sebastian Hesselbarth
2014-05-11 20:24   ` Sebastian Hesselbarth
2014-05-13  8:38   ` Sebastian Hesselbarth
2014-05-13  8:38     ` Sebastian Hesselbarth
2014-05-13  8:38     ` Sebastian Hesselbarth
2014-05-13 14:47   ` Alexandre Belloni
2014-05-13 14:47     ` Alexandre Belloni
2014-05-14 22:32   ` Mike Turquette
2014-05-14 22:32     ` Mike Turquette
2014-05-14 22:32     ` Mike Turquette
2014-05-14 23:17     ` Sebastian Hesselbarth
2014-05-14 23:17       ` Sebastian Hesselbarth
2014-05-14 23:17       ` Sebastian Hesselbarth
2014-05-15  4:41       ` Mike Turquette
2014-05-15  4:41         ` Mike Turquette
2014-05-15  6:53         ` Sebastian Hesselbarth
2014-05-15  6:53           ` Sebastian Hesselbarth
2014-05-15  8:34         ` Alexandre Belloni
2014-05-15  8:34           ` Alexandre Belloni
2014-05-11 20:24 ` [PATCH 3/8] clk: berlin: add driver for BG2x audio/video PLL Sebastian Hesselbarth
2014-05-11 20:24   ` Sebastian Hesselbarth
2014-05-11 20:24 ` [PATCH 4/8] clk: berlin: add driver for BG2x simple PLLs Sebastian Hesselbarth
2014-05-11 20:24   ` Sebastian Hesselbarth
2014-05-11 20:24 ` [PATCH 5/8] clk: berlin: add driver for BG2x complex divider cells Sebastian Hesselbarth
2014-05-11 20:24   ` Sebastian Hesselbarth
2014-05-13  8:40   ` Sebastian Hesselbarth
2014-05-13  8:40     ` Sebastian Hesselbarth
2014-05-11 20:24 ` [PATCH 6/8] clk: berlin: add core clock driver for BG2/BG2CD Sebastian Hesselbarth
2014-05-11 20:24   ` Sebastian Hesselbarth
2014-05-14 11:43   ` Alexandre Belloni
2014-05-14 11:43     ` Alexandre Belloni
2014-05-14 11:48     ` Sebastian Hesselbarth [this message]
2014-05-14 11:48       ` Sebastian Hesselbarth
2014-05-11 20:24 ` [PATCH 7/8] ARM: dts: berlin: convert BG2CD to DT clock nodes Sebastian Hesselbarth
2014-05-11 20:24   ` Sebastian Hesselbarth
2014-05-12 19:55   ` Sebastian Hesselbarth
2014-05-12 19:55     ` Sebastian Hesselbarth
2014-05-12 19:55     ` Sebastian Hesselbarth
2014-05-13  8:42   ` Sebastian Hesselbarth
2014-05-13  8:42     ` Sebastian Hesselbarth
2014-05-13  8:42     ` Sebastian Hesselbarth
2014-05-11 20:24 ` [PATCH 8/8] ARM: dts: berlin: convert BG2 " Sebastian Hesselbarth
2014-05-11 20:24   ` Sebastian Hesselbarth
2014-05-14 20:15 ` [PATCH v2 00/10] Marvell Berlin full clock support Sebastian Hesselbarth
2014-05-14 20:15   ` Sebastian Hesselbarth
2014-05-14 20:15   ` [PATCH v2 01/10] dt-binding: clk: add clock binding docs for Marvell Berlin2 SoCs Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-14 20:15   ` [PATCH v2 02/10] clk: berlin: add binding include for BG2/BG2CD clock ids Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-14 20:15   ` [PATCH v2 03/10] clk: berlin: add driver for BG2x audio/video PLL Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-14 20:15   ` [PATCH v2 04/10] clk: berlin: add driver for BG2x simple PLLs Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-14 20:15   ` [PATCH v2 05/10] clk: berlin: add driver for BG2x complex divider cells Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-15  7:56     ` Alexandre Belloni
2014-05-15  7:56       ` Alexandre Belloni
2014-05-14 20:15   ` [PATCH v2 06/10] clk: berlin: add core clock driver for BG2/BG2CD Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-15  8:09     ` Alexandre Belloni
2014-05-15  8:09       ` Alexandre Belloni
2014-05-15 15:43       ` Sebastian Hesselbarth
2014-05-15 15:43         ` Sebastian Hesselbarth
2014-05-15 16:55         ` Alexandre Belloni
2014-05-15 16:55           ` Alexandre Belloni
2014-05-14 20:15   ` [PATCH v2 07/10] clk: berlin: add core clock driver for BG2Q Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-15  7:46     ` Alexandre Belloni
2014-05-15  7:46       ` Alexandre Belloni
2014-05-14 20:15   ` [PATCH v2 08/10] ARM: dts: berlin: convert BG2CD to DT clock nodes Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-14 20:15   ` [PATCH v2 09/10] ARM: dts: berlin: convert BG2 " Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth
2014-05-14 20:15   ` [PATCH v2 10/10] ARM: dts: berlin: convert BG2Q " Sebastian Hesselbarth
2014-05-14 20:15     ` Sebastian Hesselbarth

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=537357FE.2050803@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.