From: Stephen Boyd <sboyd@kernel.org>
To: Michael Tretter <m.tretter@pengutronix.de>
Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
kernel@pengutronix.de,
Michael Turquette <mturquette@baylibre.com>,
Michal Simek <michal.simek@xilinx.com>,
Jolly Shah <jolly.shah@xilinx.com>
Subject: Re: [PATCH v3] clk: zynqmp: use structs for clk query responses
Date: Tue, 23 Apr 2019 10:38:42 -0700 [thread overview]
Message-ID: <155604112205.15276.6904109270991370948@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <20190423155418.5dc40c48@litschi.hi.pengutronix.de>
Quoting Michael Tretter (2019-04-23 06:54:18)
> On Fri, 19 Apr 2019 14:22:19 -0700, Stephen Boyd wrote:
> > Also, I was hoping to see the patch go further and make structures
> > instead of doing FIELD_GET on u32s. For example:
> >
> > #define CLK_PARENTS_ID GENMASK(15, 0)
> > #define CLK_PARENTS_FLAGS GENMASK(31, 16)
> >
> > This could be a struct of two u16 in them (and quite possibly __le16).
> >
> > u16 id;
> > u16 flags;
>
> The error codes also do not fit into this scheme. For example, if no
> further parents are available, the response will contain the value
> 0xFFFFFFFF in the response. The value may occur at any position in the
> parents array and should not be interpreted as a struct with two u16 in
> it, but should be seen as a single value on its own.
>
> Therefore, I think the abstraction using a u32[] and bitfields is better
> than defining a struct for unmarshalling the response.
We have union for that?
union {
struct resp {
u16 id;
u16 flags;
};
u32 error;
};
>
> >
> > with __packed on it. This one is weird though:
> >
> > #define CLK_ATTR_NODE_INDEX GENMASK(13, 0)
> > #define CLK_ATTR_NODE_TYPE GENMASK(19, 14)
> > #define CLK_ATTR_NODE_SUBCLASS GENMASK(25, 20)
> > #define CLK_ATTR_NODE_CLASS GENMASK(31, 26)
> >
> > The bits are really packed in there. I guess we can't win this one.
>
> Actually, the CLK_ATTR_NODE_INDEX is not a field in the response, but a
> field in the clock id. The driver needs to use the index from the query
> to set the index field in the clock id. Only the bits 2 and 0 in bits
> 13..0 carry actual meaning.
>
> Not sure if I should amend this patch or have a separate patch for
> that, because this is in fact an issue in the "drivers: clk: Update
> clock driver to handle clock attribute" patch.
>
I'd just send a follow-up patch if something is wrong.
prev parent reply other threads:[~2019-04-23 17:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 9:52 [PATCH v3] clk: zynqmp: use structs for clk query responses Michael Tretter
2019-04-18 20:01 ` Jolly Shah
2019-04-18 20:39 ` Stephen Boyd
2019-04-18 21:15 ` Jolly Shah
2019-04-18 22:02 ` Stephen Boyd
2019-04-19 16:59 ` Jolly Shah
2019-04-19 21:22 ` Stephen Boyd
2019-04-23 13:54 ` Michael Tretter
2019-04-23 17:38 ` Stephen Boyd [this message]
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=155604112205.15276.6904109270991370948@swboyd.mtv.corp.google.com \
--to=sboyd@kernel.org \
--cc=jolly.shah@xilinx.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=m.tretter@pengutronix.de \
--cc=michal.simek@xilinx.com \
--cc=mturquette@baylibre.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).