From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] clk: sunxi: Rework MMC phase clocks
Date: Tue, 9 Dec 2014 11:53:05 +0100 [thread overview]
Message-ID: <20141209105305.GU8739@lukather> (raw)
In-Reply-To: <CAGb2v65Q17qacuV0bxWyCyweAPiUCwapqmiYCtYME6ONNN-Jug@mail.gmail.com>
Hi,
On Tue, Dec 09, 2014 at 12:53:35AM +0800, Chen-Yu Tsai wrote:
> On Mon, Dec 8, 2014 at 1:21 AM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Instead of having three different clocks for the main MMC clock and the two
> > phase sub-clocks, which involved having three different drivers sharing the
> > same register, rework it to have the same single driver registering three
> > different clocks.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> > drivers/clk/sunxi/clk-mod0.c | 129 ++++++++++++++++++++++---------------------
> > 1 file changed, 67 insertions(+), 62 deletions(-)
> >
> > diff --git a/drivers/clk/sunxi/clk-mod0.c b/drivers/clk/sunxi/clk-mod0.c
> > index 658d74f39451..24522c5b94ae 100644
> > --- a/drivers/clk/sunxi/clk-mod0.c
> > +++ b/drivers/clk/sunxi/clk-mod0.c
> > @@ -115,19 +115,17 @@ static void __init sun5i_a13_mbus_setup(struct device_node *node)
> > }
> > CLK_OF_DECLARE(sun5i_a13_mbus, "allwinner,sun5i-a13-mbus-clk", sun5i_a13_mbus_setup);
> >
> > -struct mmc_phase_data {
> > - u8 offset;
> > -};
> > -
> > struct mmc_phase {
> > struct clk_hw hw;
> > + u8 offset;
> > void __iomem *reg;
> > - struct mmc_phase_data *data;
> > spinlock_t *lock;
> > };
> >
> > #define to_mmc_phase(_hw) container_of(_hw, struct mmc_phase, hw)
> >
> > +static DEFINE_SPINLOCK(sun4i_a10_mmc_lock);
> > +
>
> I'd move this to just above the setup function.
> The get/set_phase callbacks don't need it.
Indeed.
> > + if (of_property_read_string_index(node, "clock-output-names",
> > + i, &init.name))
> > + init.name = node->name;
>
> You could assign first, then call of_property_read_string_index.
> It won't touch the string unless a valid string is found.
Well then, in the most likely case (where you have the property), you
would have two consecutive assignments, instead of a single one like
what's done here.
It seems more natural to do it that way.
>
> > +
> > + clk_data->clks[i] = clk_register(NULL, &phase->hw);
> > + if (IS_ERR(clk_data->clks[i]))
> > + continue;
>
> I'm a bit skeptical about partial success/failure, though I don't
> have a strong argument for or against it yet.
Yeah, I was also a bit skeptical about that part to be honest :)
I'll rework it to cleanup the clocks if it fails.
Thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141209/96392eac/attachment.sig>
next prev parent reply other threads:[~2014-12-09 10:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-07 17:21 [PATCH 0/4] clk: sunxi: mmc: Last bits of phase handling Maxime Ripard
2014-12-07 17:21 ` [PATCH 1/4] clk: sunxi: Rework MMC phase clocks Maxime Ripard
2014-12-08 16:53 ` Chen-Yu Tsai
2014-12-09 3:26 ` Chen-Yu Tsai
2014-12-09 10:53 ` Maxime Ripard [this message]
2014-12-07 17:21 ` [PATCH 2/4] ARM: sunxi: dt: Add sample and output mmc clocks Maxime Ripard
2014-12-07 17:21 ` [PATCH 3/4] mmc: sunxi: Convert MMC driver to the standard clock phase API Maxime Ripard
2014-12-07 17:21 ` [PATCH 4/4] clk: sunxi: Remove custom phase function Maxime Ripard
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=20141209105305.GU8739@lukather \
--to=maxime.ripard@free-electrons.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 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).