From: Paul Mundt <lethal@linux-sh.org>
To: Bastian Hecht <hechtb@gmail.com>
Cc: linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 1/3] serial: sh-sci: Add OF support
Date: Mon, 25 Feb 2013 20:35:35 +0000 [thread overview]
Message-ID: <20130225203534.GB19670@linux-sh.org> (raw)
In-Reply-To: <1361819215-4115-1-git-send-email-hechtb+renesas@gmail.com>
On Mon, Feb 25, 2013 at 01:06:53PM -0600, Bastian Hecht wrote:
> We add the capabilty to probe Renesas SCI devices using Device Tree setup.
>
> Signed-off-by: Bastian Hecht <hechtb+renesas@gmail.com>
> ---
> Based on the topic/all+next branch from the 17th Feb. I couldn't rebase it on the current HEAD as the armadillo-reference code currently isn't in.
>
> changelog v2:
> - Renamed title to "Add OF support"
> - Removed fixed configurations from driver and added the following binding props:
> - renesas,scscr
> - renesas,scbrr-algo-id
> - renesas,autoconf
> - renesas,regtype
> See patch for descriptions
>
This looks much better, only a few minor nits.
> +Optional properties:
> +- renesas,autoconf : Set if device is capable of auto configuration
> +- renesas,regtype : Overwrite the register layout. Some legacy hardware versions
> + use a non-default register layout. Possible layouts are
> + 0 = SCIx_SH2_SCIF_FIFODATA_REGTYPE
> + 1 = SCIx_SH3_SCIF_REGTYPE
> + 2 = SCIx_SH4_SCIF_REGTYPE
> + 3 = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE
> + 4 = SCIx_SH4_SCIF_FIFODATA_REGTYPE
> + 5 = SCIx_SH7705_SCIF_REGTYPE
> +
Here I would still opt to provide the full regtype set, even for the
"standard" layouts, as it's quite possible that newer port-types will use
older layouts.
In this case you could keep 0 as the probe type (which would be the
default anyways, so effectively a no-op), and then do the upper bounding
via SCIx_NR_REGTYPES.
> +/* This array belongs to the DT binding definition "renesas,regtype" */
> +static const char sci_regtype_modes[] = {
> + SCIx_SH2_SCIF_FIFODATA_REGTYPE,
> + SCIx_SH3_SCIF_REGTYPE,
> + SCIx_SH4_SCIF_REGTYPE,
> + SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
> + SCIx_SH4_SCIF_FIFODATA_REGTYPE,
> + SCIx_SH7705_SCIF_REGTYPE
> +};
> +
At which point all of this can go away.
> +static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,
> + int *dev_id)
> +{
..
> + prop = of_get_property(np, "renesas,regtype", NULL);
> + if (prop) {
> + val = be32_to_cpup(prop);
> + if (val <= 0 || val >= ARRAY_SIZE(sci_regtype_modes)) {
> + dev_err(&pdev->dev, "invalid DT prop regtype\n");
> + return NULL;
> + }
> + p->regtype = sci_regtype_modes[be32_to_cpup(prop)];
> + }
> +
You can then compare against SCIx_PROBE_REGTYPE and SCIx_NR_REGTYPES, and
assign p->regtype the be32_to_cpup() value directly. Which will also make
it trivial to add new regtypes in the future, we would only need to
update the binding documentation.
next prev parent reply other threads:[~2013-02-25 20:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-25 18:07 [PATCH v2 1/3] serial: sh-sci: Add OF support Bastian Hecht
2013-02-25 18:07 ` [PATCH v2 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT Bastian Hecht
2013-02-25 18:13 ` [PATCH v2 2/3] ARM: mach-shmobile: r8a7740: Add DT names to clock list Bastian Hecht
2013-02-25 20:35 ` Paul Mundt [this message]
2013-02-26 15:09 ` [PATCH v2 1/3] serial: sh-sci: Add OF support Bastian Hecht
2013-02-27 8:04 ` Paul Mundt
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=20130225203534.GB19670@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=hechtb@gmail.com \
--cc=linux-serial@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.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