From: Remi Pommarel <repk@triplefau.lt>
To: Martin Sperl <kernel@martin.sperl.org>
Cc: Mark Brown <broonie@kernel.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Arnd Bergmann <arnd@arndb.de>,
Stephen Warren <swarren@wwwdotorg.org>,
Lee Jones <lee@kernel.org>, Eric Anholt <eric@anholt.net>,
Russell King <linux@arm.linux.org.uk>,
Michael Turquette <mturquette@baylibre.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
linux-rpi-kernel@lists.infradead.org,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
linux-clk <linux-clk@vger.kernel.org>,
ALSA Development Mailing List <alsa-devel@alsa-project.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Matthias Reichl <hias@horus.com>,
lFlorian Meier <florian.meier@koalo.de>
Subject: Re: [PATCH 2/5] clk: bcm2835: enable management of PCM clock
Date: Sun, 10 Jan 2016 13:30:14 +0100 [thread overview]
Message-ID: <20160110123014.GA1764@cruxbox> (raw)
In-Reply-To: <39E8C95F-C7DC-46C3-B29A-93A865485942@martin.sperl.org>
On Sun, Jan 10, 2016 at 01:17:17PM +0100, Martin Sperl wrote:
> >
> > Presumably just making the code not rely on having a define for the
> > number of clocks would deal with the problem (eg, using ARRAY_SIZE
> > internally).
> ARRAY_SIZE would work fine, but the code is:
>
> #include <dt-bindings/clock/bcm2835.h>
> ...
> struct bcm2835_cprman {
> struct device *dev;
> void __iomem *regs;
> spinlock_t regs_lock;
> const char *osc_name;
>
> struct clk_onecell_data onecell;
> struct clk *clks[BCM2835_CLOCK_COUNT];
> };
> ...
> static int bcm2835_clk_probe(struct platform_device *pdev)
> {
> ...
> clks[BCM2835_PLLA_CORE] =
> bcm2835_register_pll_divider(cprman, &bcm2835_plla_core_data);
> ...
> clks[BCM2835_CLOCK_PCM] =
> bcm2835_register_clock(cprman, &bcm2835_clock_pcm_data);
> ...
> }
>
> So the Array size is defined by the dt-bindings.
>
> What you propose is a major change to the clock framework, so I would
> hope that Eric (the original author of this clock-driver) would address
> it.
>
> Maybe someone has a better idea for a pattern to use to achieve
> the required while maintaining “synchronization” between defines
> inside the dt-binding and the driver.
>
Why not just get rid of BCM2835_CLOCK_COUNT and use an internal clock
count ? Something like the patch attached at the end of the mail. This
has the downside to be more careful when adding a new clock.
If it is not ok, I could try to modify the clk driver to use Mark's
solution if you want.
Regards,
--
Remi
--------------------------------->8---------------------------------------
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 015e687..f558c5b 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -281,6 +281,8 @@
#define LOCK_TIMEOUT_NS 100000000
#define BCM2835_MAX_FB_RATE 1750000000u
+#define BCM2835_CLOCK_MAX BCM2835_CLOCK_PCM
+
struct bcm2835_cprman {
struct device *dev;
void __iomem *regs;
@@ -288,7 +290,7 @@ struct bcm2835_cprman {
const char *osc_name;
struct clk_onecell_data onecell;
- struct clk *clks[BCM2835_CLOCK_COUNT];
+ struct clk *clks[BCM2835_CLOCK_MAX + 1];
};
static inline void cprman_write(struct bcm2835_cprman *cprman, u32 reg, u32 val)
WARNING: multiple messages have this Message-ID (diff)
From: repk@triplefau.lt (Remi Pommarel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] clk: bcm2835: enable management of PCM clock
Date: Sun, 10 Jan 2016 13:30:14 +0100 [thread overview]
Message-ID: <20160110123014.GA1764@cruxbox> (raw)
In-Reply-To: <39E8C95F-C7DC-46C3-B29A-93A865485942@martin.sperl.org>
On Sun, Jan 10, 2016 at 01:17:17PM +0100, Martin Sperl wrote:
> >
> > Presumably just making the code not rely on having a define for the
> > number of clocks would deal with the problem (eg, using ARRAY_SIZE
> > internally).
> ARRAY_SIZE would work fine, but the code is:
>
> #include <dt-bindings/clock/bcm2835.h>
> ...
> struct bcm2835_cprman {
> struct device *dev;
> void __iomem *regs;
> spinlock_t regs_lock;
> const char *osc_name;
>
> struct clk_onecell_data onecell;
> struct clk *clks[BCM2835_CLOCK_COUNT];
> };
> ...
> static int bcm2835_clk_probe(struct platform_device *pdev)
> {
> ...
> clks[BCM2835_PLLA_CORE] =
> bcm2835_register_pll_divider(cprman, &bcm2835_plla_core_data);
> ...
> clks[BCM2835_CLOCK_PCM] =
> bcm2835_register_clock(cprman, &bcm2835_clock_pcm_data);
> ...
> }
>
> So the Array size is defined by the dt-bindings.
>
> What you propose is a major change to the clock framework, so I would
> hope that Eric (the original author of this clock-driver) would address
> it.
>
> Maybe someone has a better idea for a pattern to use to achieve
> the required while maintaining ?synchronization? between defines
> inside the dt-binding and the driver.
>
Why not just get rid of BCM2835_CLOCK_COUNT and use an internal clock
count ? Something like the patch attached at the end of the mail. This
has the downside to be more careful when adding a new clock.
If it is not ok, I could try to modify the clk driver to use Mark's
solution if you want.
Regards,
--
Remi
--------------------------------->8---------------------------------------
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 015e687..f558c5b 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -281,6 +281,8 @@
#define LOCK_TIMEOUT_NS 100000000
#define BCM2835_MAX_FB_RATE 1750000000u
+#define BCM2835_CLOCK_MAX BCM2835_CLOCK_PCM
+
struct bcm2835_cprman {
struct device *dev;
void __iomem *regs;
@@ -288,7 +290,7 @@ struct bcm2835_cprman {
const char *osc_name;
struct clk_onecell_data onecell;
- struct clk *clks[BCM2835_CLOCK_COUNT];
+ struct clk *clks[BCM2835_CLOCK_MAX + 1];
};
static inline void cprman_write(struct bcm2835_cprman *cprman, u32 reg, u32 val)
next prev parent reply other threads:[~2016-01-10 12:30 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-09 9:25 [PATCH 0/5] ASOC: bcm2835: move bcm2835-i2s to use clock framework kernel
2016-01-09 9:25 ` kernel at martin.sperl.org
[not found] ` <1452331558-2520-1-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2016-01-09 9:25 ` [PATCH 1/5] ASoC: bcm2835: cleanup includes by ordering them alphabetically kernel-TqfNSX0MhmxHKSADF0wUEw
2016-01-09 9:25 ` kernel at martin.sperl.org
2016-01-09 9:25 ` kernel
2016-01-09 9:25 ` [PATCH 2/5] clk: bcm2835: enable management of PCM clock kernel
2016-01-09 9:25 ` kernel at martin.sperl.org
2016-01-09 20:56 ` Arnd Bergmann
2016-01-09 20:56 ` Arnd Bergmann
2016-01-09 20:56 ` Arnd Bergmann
2016-01-10 9:30 ` Geert Uytterhoeven
2016-01-10 9:30 ` Geert Uytterhoeven
2016-01-10 9:30 ` Geert Uytterhoeven
2016-01-10 10:55 ` Martin Sperl
2016-01-10 10:55 ` Martin Sperl
2016-01-10 10:55 ` Martin Sperl
2016-01-10 11:58 ` Mark Brown
2016-01-10 11:58 ` Mark Brown
2016-01-10 12:17 ` Martin Sperl
2016-01-10 12:17 ` Martin Sperl
2016-01-10 12:17 ` Martin Sperl
2016-01-10 12:30 ` Remi Pommarel [this message]
2016-01-10 12:30 ` Remi Pommarel
2016-01-10 13:02 ` Geert Uytterhoeven
2016-01-10 13:02 ` Geert Uytterhoeven
2016-01-10 18:01 ` Martin Sperl
2016-01-10 18:01 ` Martin Sperl
2016-01-10 18:01 ` Martin Sperl
2016-01-10 18:56 ` Geert Uytterhoeven
2016-01-10 18:56 ` Geert Uytterhoeven
2016-01-10 19:07 ` Martin Sperl
2016-01-10 19:07 ` Martin Sperl
2016-01-10 19:07 ` Martin Sperl
[not found] ` <93C244A0-20B7-4E21-A183-E09F83CFE035-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2016-01-10 19:13 ` Geert Uytterhoeven
2016-01-10 19:13 ` Geert Uytterhoeven
2016-01-10 19:13 ` Geert Uytterhoeven
2016-01-11 13:38 ` Arnd Bergmann
2016-01-11 13:38 ` Arnd Bergmann
2016-01-11 13:38 ` Arnd Bergmann
2016-01-11 13:53 ` Martin Sperl
2016-01-11 13:53 ` Martin Sperl
2016-01-11 13:53 ` Martin Sperl
2016-01-09 9:25 ` [PATCH 3/5] ASoC: bcm2835: move to use the clock framework kernel
2016-01-09 9:25 ` kernel at martin.sperl.org
2016-01-09 9:25 ` [PATCH 4/5] ARM: bcm2835: I2S: use new register-range and " kernel
2016-01-09 9:25 ` kernel at martin.sperl.org
2016-01-09 9:25 ` [PATCH 5/5] dt-bindings: bsm2835: fix bindings documentation to use new " kernel
2016-01-09 9:25 ` kernel at martin.sperl.org
2016-01-09 22:45 ` Rob Herring
2016-01-09 22:45 ` Rob Herring
2016-01-10 11:05 ` Martin Sperl
2016-01-10 11:05 ` Martin Sperl
2016-01-10 11:05 ` Martin Sperl
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=20160110123014.GA1764@cruxbox \
--to=repk@triplefau.lt \
--cc=alsa-devel@alsa-project.org \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=eric@anholt.net \
--cc=florian.meier@koalo.de \
--cc=geert@linux-m68k.org \
--cc=hias@horus.com \
--cc=kernel@martin.sperl.org \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=mturquette@baylibre.com \
--cc=perex@perex.cz \
--cc=swarren@wwwdotorg.org \
--cc=tiwai@suse.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.