[PATCH v2] earlycon: initialise baud field of earlycon device structure

2017-08-17 Thread Eugeniy Paltsev
For now baud field of earlycon structure device is't initialised at all
in of_setup_earlycon (in oppositе to register_earlycon).

So when I use stdout-path to point earlycon device
(like stdout-path = &serial or stdout-path = "serial:115200n8")
baud field of earlycon device structure remains uninitialised and
earlycon initialization is not performed correctly as
of_setup_earlycon is used.
When pass all arguments via bootargs
(like bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8")
initialization is performed correctly as register_earlycon is used.

So initialise baud field of earlycon device structure by value of
"current-speed" property from device tree or from options
(if they exist) when we use of_setup_earlycon

Signed-off-by: Eugeniy Paltsev 
---
Changes v1 -> v2:
 * Use standart property name "current-speed" instead of custom "baud"

NOTE:
I don't add parsing of the other standard options here because we don't
have any place to store them. When we parce and set options of the 'real'
uart device (using uart_parse_options + uart_set_options) we populate
ktermios structure an pass it to port->ops->set_termios callback of
uart_port structure. So it is processing by uart driver itself. But we don't
register such callbacks for earlycon. So we are only able to parse baud
value, which can be stored in baud field of earlycon_device structure.
 
 drivers/tty/serial/earlycon.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index c365154..93f15e2 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -240,6 +240,7 @@ int __init of_setup_earlycon(const struct earlycon_id 
*match,
 {
int err;
struct uart_port *port = &early_console_dev.port;
+   unsigned long baud;
const __be32 *val;
bool big_endian;
u64 addr;
@@ -282,7 +283,15 @@ int __init of_setup_earlycon(const struct earlycon_id 
*match,
}
}
 
+   val = of_get_flat_dt_prop(node, "current-speed", NULL);
+   if (val)
+   early_console_dev.baud = be32_to_cpu(*val);
+
if (options) {
+   err = kstrtoul(options, 10, &baud);
+   if (!err)
+   early_console_dev.baud = baud;
+
strlcpy(early_console_dev.options, options,
sizeof(early_console_dev.options));
}
-- 
2.9.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH v3 2/2] ARC: DTS: Add device-tree for Anarion-based development board

2017-08-17 Thread Alexey Brodkin
Hi Alexandru,

On Wed, 2017-08-16 at 15:15 -0700, Alexandru Gagniuc wrote:
> +#include "skeleton.dtsi"

Eugeniy already commented on that - most probably you'll end up
overriding most if not all entries from "skeleton.dtsi" so why
bother with it at all?

And I don't see any mention of your own memory node so I assume you rely on
the one from our skeleton.dtsi? The first question is if it really matches your 
setup?
I.e. 256 Mb mapped to 0x8000_. And even if that's the case what if we change
this to something else later?

IMHO having your own "memory" node makes some sens :)

> +
> + gmac0: ethernet@f201 {
> + compatible = "adaptrum,anarion-gmac", "snps,dwmac";
> + reg = <0xf201 0x4000>;
> +
> + interrupt-parent = <&core_intc>;

You already specified default INTC above, so you may just drop 
"interrupt-parent"
property from this node.

> +
> + gmac1: ethernet@f2014000 {
> + compatible = "adaptrum,anarion-gmac", "snps,dwmac";
> + reg = <0xf2014000 0x4000>, <0xf2018100 8>;
> +
> + interrupt-parent = <&core_intc>;

Ditto.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v3 2/2] ARC: DTS: Add device-tree for Anarion-based development board

2017-08-17 Thread Eugeniy Paltsev
On Thu, 2017-08-17 at 11:11 +, Eugeniy Paltsev wrote:
> Hi Alexandru,
> 
> On Wed, 2017-08-16 at 15:15 -0700, Alexandru Gagniuc wrote:
> > This is split into the SOC bindings, and the board dts. The Endor
> > board is currently an FPGA emulation. Once real, silicon arrives,
> > we
> > plan to remove Endor support.
> > 
> > Signed-off-by: Alexandru Gagniuc 
> > ---
> >  arch/arc/boot/dts/adaptrum_anarion.dtsi | 110
> > 
> >  arch/arc/boot/dts/adaptrum_anarion_fpga.dts |  51 +
> >  2 files changed, 161 insertions(+)
> >  create mode 100644 arch/arc/boot/dts/adaptrum_anarion.dtsi
> >  create mode 100644 arch/arc/boot/dts/adaptrum_anarion_fpga.dts
> > 
> > diff --git a/arch/arc/boot/dts/adaptrum_anarion.dtsi
> > b/arch/arc/boot/dts/adaptrum_anarion.dtsi
> > new file mode 100644
> > index 000..e177a24
> > --- /dev/null
> > +++ b/arch/arc/boot/dts/adaptrum_anarion.dtsi
> > @@ -0,0 +1,110 @@
> > +/*
> > + * Skeleton for Adaptrum Anarion SOC
> > + *
> > + * (C) Copyright 2017 Adaptrum, Inc.
> > + * Written by Alexandru Gagniuc  for
> > Adaptrum,
> > Inc.
> > + * Licensed under the GPLv2 or (at your option) any later version
> > + */
> > +
> > +/* This skeleton is based on the ARC700 CPU */
> > +#include "skeleton.dtsi"
> 
Perhaps it is better not to use skeleton.dtsi as we are planning to
get rid of it.

---
Little more explanation:

We faced with fact what we had to override almost all nodes defined in
skeleton.dtsi (and other skeletons files like skeleton_hs_idu.dtsi) for
our boards. Only the timers nodes are left not overridden.
So there is no much sense in skeletons files using and that's why we
are planning to get rid of it.

> -- 
>  Eugeniy Paltsev
> ___
> linux-snps-arc mailing list
> linux-snps-arc@lists.infradead.org 
-- 
 Eugeniy Paltsev
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH v3 2/2] ARC: DTS: Add device-tree for Anarion-based development board

2017-08-17 Thread Eugeniy Paltsev
Hi Alexandru,

On Wed, 2017-08-16 at 15:15 -0700, Alexandru Gagniuc wrote:
> This is split into the SOC bindings, and the board dts. The Endor
> board is currently an FPGA emulation. Once real, silicon arrives, we
> plan to remove Endor support.
> 
> Signed-off-by: Alexandru Gagniuc 
> ---
>  arch/arc/boot/dts/adaptrum_anarion.dtsi | 110
> 
>  arch/arc/boot/dts/adaptrum_anarion_fpga.dts |  51 +
>  2 files changed, 161 insertions(+)
>  create mode 100644 arch/arc/boot/dts/adaptrum_anarion.dtsi
>  create mode 100644 arch/arc/boot/dts/adaptrum_anarion_fpga.dts
> 
> diff --git a/arch/arc/boot/dts/adaptrum_anarion.dtsi
> b/arch/arc/boot/dts/adaptrum_anarion.dtsi
> new file mode 100644
> index 000..e177a24
> --- /dev/null
> +++ b/arch/arc/boot/dts/adaptrum_anarion.dtsi
> @@ -0,0 +1,110 @@
> +/*
> + * Skeleton for Adaptrum Anarion SOC
> + *
> + * (C) Copyright 2017 Adaptrum, Inc.
> + * Written by Alexandru Gagniuc  for Adaptrum,
> Inc.
> + * Licensed under the GPLv2 or (at your option) any later version
> + */
> +
> +/* This skeleton is based on the ARC700 CPU */
> +#include "skeleton.dtsi"

Perhaps it is better not to use skeleton.dtsi as we are planning to
get rid of it.

-- 
 Eugeniy Paltsev
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc