From: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
To: Moritz Fischer <moritz.fischer@ettus.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, Kumar Gala <galak@codeaurora.org>,
Michal Simek <michal.simek@xilinx.com>,
linux@arm.linux.org.uk, devicetree@vger.kernel.org,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [RFCv2 3/3] reset: reset-zynq: Adding support for Xilinx Zynq reset controller.
Date: Tue, 28 Jul 2015 07:27:24 -0700 [thread overview]
Message-ID: <20150728142723.GS2650@xsjsorenbubuntu> (raw)
In-Reply-To: <CAAtXAHfgCnH1KPyPBBPHq-amr=npMmyYjs+D9jnB3F9qpD6dbA@mail.gmail.com>
On Tue, 2015-07-28 at 07:05AM -0700, Moritz Fischer wrote:
> Philip,
>
> thanks for your review :)
>
> On Tue, Jul 28, 2015 at 1:38 AM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> > Hi Moritz,
> >
> > Am Freitag, den 24.07.2015, 17:21 -0700 schrieb Moritz Fischer:
> >> This adds a reset controller driver to control the Xilinx Zynq
> >> SoC's various resets.
> >>
> >> Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
[...]
> >> +
> >> +/* Offsets into SLCR regmap */
> >> +#define SLCR_RST_CTRL_OFFSET 0x200 /* FPGA Software Reset Control */
> >
> > Maybe get this value from the reg property? I'm not sure if this is ever
> > expected to change.
> I don't think it's going to change. Is there a reason to only expose
> part of the resets?
I think all other users of the syscon (in the Zynq DT) use the 'reg' property
to retrieve an offset into the SLCR. We should probably do that here too and
remove the #define. Who knows, maybe this driver is reusable with some
modifications for the Zynq MPSoC.
> >
> >> +#define NBANKS 18
> >
> > reg = <0x200 0x50> says there are two more registers, are those not used?
>
> Should be 0x48, you're right. Michal had suggested 0x50, but the last
> two regs are not really resets.
> >
[...]
> >> +static int zynq_reset_status(struct reset_controller_dev *rcdev,
> >> + unsigned long id)
> >> +{
> >> + struct zynq_reset_data *priv = to_zynq_reset_data(rcdev);
> >> +
> >> + int bank = id / BITS_PER_LONG;
> >> + int offset = id % BITS_PER_LONG;
> >> + u32 reg;
> >> +
> >> + regmap_read(priv->slcr, SLCR_RST_CTRL_OFFSET + (bank * 4), ®);
> >> +
> >> + return !(reg & BIT(offset));
> >> +}
>
> Will change to:
> ret = regmap_read(priv->slcr, SLCR_RST_CTRL_OFFSET + (bank * 4), ®);
> if (ret)
> return ret;
> else
> return !!(reg & BIT(offset));
>
> the single '!' was a typo ...
You have an early return on error in the if-branch. No need for the
else.
>
> >
> > Do I understand this correctly, you write 1 to assert the reset, but the
> > register reads 0 while the reset is asserted and 1 otherwise?
> > Also note that reset_status may return negative ERRNO, so for offset ==
> > 31 you should not return (1<<31).
> >
> >> +static const struct reset_control_ops zynq_reset_ops = {
> >> + .assert = zynq_reset_assert,
> >> + .deassert = zynq_reset_deassert,
> >> + .status = zynq_reset_status,
> >> +};
> >> +
> >> +static int zynq_reset_probe(struct platform_device *pdev)
> >> +{
> >> + struct zynq_reset_data *priv;
> >> +
> >> + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> >> + if (!priv)
> >> + return -ENOMEM;
> >> + platform_set_drvdata(pdev, priv);
> >> +
> >> + priv->slcr = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
> >> + "syscon");
> >
> > I'd just use syscon_node_to_regmap(pdev->dev.of_node->parent) here,
> > which removes the need for the syscon phandle binding.
>
> See binding doc discussion. I don't have a strong preference either way,
> just tried to be consistent with the pinctrl node.
> We just need a decision one way or the other :)
I personally like the syscon handle better since it would make placing
the node more flexible, while this proposal forces some topology on the
DT. In both cases though, the syscon and this user are tightly coupled
and this driver depends on the syscon. I don't really mind either way -
I think.
Sören
prev parent reply other threads:[~2015-07-28 14:27 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-25 0:21 [RFCv2 0/3] Adding support for Zynq Reset Controller Moritz Fischer
2015-07-25 0:21 ` [RFCv2 1/3] docs: dts: Added documentation for Xilinx Zynq Reset Controller bindings Moritz Fischer
2015-07-27 5:09 ` Michal Simek
[not found] ` <55B5BD08.60802-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2015-07-28 4:55 ` Moritz Fischer
[not found] ` <CAAtXAHeWtXVe4c5z_6AxMS0CggA2pN57mNArJsKG9=QxWs-zRw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-28 5:41 ` Michal Simek
2015-07-28 2:58 ` Sören Brinkmann
2015-07-28 4:52 ` Moritz Fischer
2015-07-28 22:53 ` Sören Brinkmann
2015-07-29 6:14 ` Moritz Fischer
[not found] ` <CAAtXAHd8kG_FtKTW-2T2KToXesWgsgxkZ3vpXZ_oRjGCSfpFgw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-29 17:38 ` Sören Brinkmann
2015-07-30 14:37 ` Michal Simek
2015-07-28 8:05 ` Philipp Zabel
[not found] ` <1438070702.3193.4.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-07-28 8:25 ` Michal Simek
2015-07-28 13:57 ` Moritz Fischer
[not found] ` <CAAtXAHc=WTg3VHugKZ+SHnCA7OKXLLay-aOJyk9C9r+Z2MWwBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-28 15:16 ` Philipp Zabel
2015-07-25 0:21 ` [RFCv2 2/3] dts: zynq: Add devicetree entry for Xilinx Zynq reset controller Moritz Fischer
2015-07-27 6:56 ` Michal Simek
[not found] ` <55B5D62D.4010407-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2015-07-28 5:03 ` Moritz Fischer
2015-07-28 5:42 ` Michal Simek
[not found] ` <CAAtXAHepDRbiiznHnT3dLLLWS_VH2a9BhnNgZzDECx__QceEeg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-28 6:59 ` Nicolas Ferre
[not found] ` <55B72857.3020108-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2015-07-28 7:44 ` Michal Simek
2015-07-28 13:54 ` Moritz Fischer
2015-07-25 0:21 ` [RFCv2 3/3] reset: reset-zynq: Adding support " Moritz Fischer
[not found] ` <1437783682-13632-4-git-send-email-moritz.fischer-+aYTwkv1SeIAvxtiuMwx3w@public.gmane.org>
2015-07-27 5:14 ` Michal Simek
2015-07-27 7:12 ` Michal Simek
[not found] ` <55B5D9C2.60509-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2015-07-28 4:59 ` Moritz Fischer
2015-07-28 5:43 ` Michal Simek
2015-07-28 8:38 ` Philipp Zabel
[not found] ` <1438072680.3193.24.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-07-28 14:05 ` Moritz Fischer
2015-07-28 14:27 ` Sören Brinkmann [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=20150728142723.GS2650@xsjsorenbubuntu \
--to=soren.brinkmann@xilinx.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=michal.simek@xilinx.com \
--cc=moritz.fischer@ettus.com \
--cc=p.zabel@pengutronix.de \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.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).