From: Simon Horman <horms@verge.net.au>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH/RFC] ARM: shmobile: Koelsch DT serial integration prototype
Date: Wed, 23 Apr 2014 00:46:35 +0000 [thread overview]
Message-ID: <20140423004635.GE5738@verge.net.au> (raw)
In-Reply-To: <20140421013114.3236.90868.sendpatchset@w520>
On Mon, Apr 21, 2014 at 10:56:41AM +0200, Geert Uytterhoeven wrote:
> Hi Magnus,
>
> On Mon, Apr 21, 2014 at 3:31 AM, Magnus Damm <magnus.damm@gmail.com> wrote:
> > A simple serial port integration prototype that happens to
> > target Koelsch. Written to propose how to move one step closer
> > to integrate DT support for serial ports on mach-shmobile.
>
> [...]
>
> > 1) It enables serial ports in the board specific DTS
> > -> Nothing special here, except perhaps the preserved device order
>
> Good, thanks!
>
> > 2) It extends the existing platform device registration code
> > -> When the existing C board code calls to add serial platform devices
> > then we check if DT platform devices exist in the DTB. If so then
> > we disable the serial DT devices and stick with platform devices.
>
> Is there any specific reason why you chose this solution, over the alternative
> approach of not registering the platform devices if the corresponding serial
> devices are present in DT?
My understanding is that the motivation is to avoid changing the run-time
behaviour due to internal infrastructure changes: specifically to avoid
changing the names of serial port devices.
> > The combination of 1) and 2) allows us to use the same DTB regardless
> > if C board code is compiled in or not. Also migration becomes easy
> > and forgiving, if for instance the user only updates the kernel and
> > uses the old DTB then the board code will keep on working even though
> > serial devices may not be present in the DTS.
>
> Very well!
>
> > --- 0001/arch/arm/mach-shmobile/setup-r8a7791.c
> > +++ work/arch/arm/mach-shmobile/setup-r8a7791.c 2014-04-17 16:32:32.000000000 +0900
> > @@ -94,7 +94,9 @@ static struct plat_sci_port scif##index#
> > static struct resource scif##index##_resources[] = { \
> > DEFINE_RES_MEM(baseaddr, 0x100), \
> > DEFINE_RES_IRQ(irq), \
> > -}
> > +}; \
> > + \
> > +static struct property scif##index##_property
>
> This is static, as the property's lifecycle dictates it to stay alive...
>
> > #define R8A7791_SCIF(index, baseaddr, irq) \
> > __R8A7791_SCIF(PORT_SCIF, index, baseaddr, irq)
> > @@ -121,7 +123,30 @@ R8A7791_SCIFA(12, 0xe6c70000, gic_spi(29
> > R8A7791_SCIFA(13, 0xe6c78000, gic_spi(30)); /* SCIFA4 */
> > R8A7791_SCIFA(14, 0xe6c80000, gic_spi(31)); /* SCIFA5 */
> >
> > +static void serial_disable_dt(struct resource *res, struct property *prop)
> > +{
> > + struct device_node *np;
> > + char str[17];
> > + char *disabled = "disabled";
>
> ... while this is a local variable on the stack, with limited lifetime.
> So that should be:
>
> static char disabled[] = "disabled";
>
> > + snprintf(str, ARRAY_SIZE(str), "/serial@%08x",
> > + (unsigned int)res->start);
> > +
> > + np = of_find_node_by_path(str);
> > + if (np) {
> > + if (of_device_is_available(np)) {
> > + prop->name = "status";
> > + prop->length = strlen(disabled) + 1;
>
> Or "sizeof(disabled)", after changing to a static array.
>
> > + prop->value = disabled;
> > + of_update_property(np, prop);
> > + printk("xxx disabled %s\n", str);
>
> pr_info(), drop the "xxx ", capitalize "Disabled".
>
> > + }
> > + of_node_put(np);
> > + }
> > +}
> > +
> > #define r8a7791_register_scif(index) \
> > + serial_disable_dt(scif##index##_resources, &scif##index##_property); \
> > platform_device_register_resndata(&platform_bus, "sh-sci", index, \
> > scif##index##_resources, \
> > ARRAY_SIZE(scif##index##_resources), \
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2014-04-23 0:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 1:31 [PATCH/RFC] ARM: shmobile: Koelsch DT serial integration prototype Magnus Damm
2014-04-21 8:56 ` Geert Uytterhoeven
2014-04-21 9:50 ` Laurent Pinchart
2014-04-21 10:22 ` Geert Uytterhoeven
2014-04-21 21:09 ` Laurent Pinchart
2014-04-21 21:26 ` Geert Uytterhoeven
2014-04-23 0:46 ` Simon Horman [this message]
2014-04-23 2:01 ` Magnus Damm
2014-04-23 2:07 ` Magnus Damm
2014-04-23 12:00 ` Laurent Pinchart
2014-04-23 12:22 ` Magnus Damm
2014-04-23 13:36 ` Magnus Damm
2014-04-23 22:18 ` Sergei Shtylyov
2014-04-24 0:49 ` Simon Horman
2014-04-24 5:45 ` Magnus Damm
2014-04-24 7:03 ` Geert Uytterhoeven
2014-04-24 18:48 ` Sergei Shtylyov
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=20140423004635.GE5738@verge.net.au \
--to=horms@verge.net.au \
--cc=linux-sh@vger.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 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.