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

2017-08-16 Thread Eugeniy Paltsev
Hi Rob,

On Tue, 2017-08-15 at 14:26 -0500, Rob Herring wrote:
> On Tue, Aug 15, 2017 at 12:21 PM, Eugeniy Paltsev
>  wrote:
> > [snip]
> > @@ -282,7 +283,15 @@ int __init of_setup_earlycon(const struct
> > earlycon_id *match,
> > }
> > }
> > 
> > +   val = of_get_flat_dt_prop(node, "baud", NULL);
> 
> No, we already have a defined way to set the baud, we don't need a
> property in addition. Plus you didn't document it.

I guess by defined way to set the baud you mean setting baud after
device alias
in stdout-path property (like stdout-path = "serial:115200n8"), right?

The idea was to reuse "baud" property from serial node to set the
earlycon baud:

chosen {
...
stdout-path = 
};

serial: uart@... {
...
baud = <115200>;   /* Get baud from here */
};

> > +   if (val)
> > +   early_console_dev.baud = be32_to_cpu(*val);
> > +
> > if (options) {
> > +   err = kstrtoul(options, 10, );
> > +   if (!err)
> > +   early_console_dev.baud = baud;
> 
> This seems fine to do here, but then we should also parse the other
> standard options here too. And we should make sure we're not doing it
> twice.
I added only baud parsing here because we parse only baud from standard
options
when register_earlycon is used. (see parse_options function which is
called
from register_earlycon)

But I can add other standard options parsing here (probably using
uart_parse_options + uart_set_options). 
What do you think?

> > +
> > strlcpy(early_console_dev.options, options,
> > sizeof(early_console_dev.options));
> > }
> > --
> > 2.9.3
-- 
 Eugeniy Paltsev
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

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

2017-08-16 Thread Eugeniy Paltsev
On Wed, 2017-08-16 at 08:46 -0500, Rob Herring wrote:
> On Wed, Aug 16, 2017 at 6:52 AM, Eugeniy Paltsev
>  wrote:
> > Hi Rob,
> > 
> > On Tue, 2017-08-15 at 14:26 -0500, Rob Herring wrote:
> > > On Tue, Aug 15, 2017 at 12:21 PM, Eugeniy Paltsev
> > >  wrote:
> > > > [snip]
> > > > @@ -282,7 +283,15 @@ int __init of_setup_earlycon(const struct
> > > > earlycon_id *match,
> > > > }
> > > > }
> > > > 
> > > > +   val = of_get_flat_dt_prop(node, "baud", NULL);
> > > 
> > > No, we already have a defined way to set the baud, we don't need
> > > a
> > > property in addition. Plus you didn't document it.
> > 
> > I guess by defined way to set the baud you mean setting baud after
> > device alias
> > in stdout-path property (like stdout-path = "serial:115200n8"),
> > right?
> > 
> > The idea was to reuse "baud" property from serial node to set the
> > earlycon baud:
> > 
> > chosen {
> > ...
> > stdout-path = 
> > };
> > 
> > serial: uart@... {
> > ...
> > baud = <115200>;   /* Get baud from here */
> 
> "current-speed" is already defined for this purpose. If you want to
> add that, that's fine.
Ok, I'll add "current-speed".

> > };
> > 
> > > > +   if (val)
> > > > +   early_console_dev.baud = be32_to_cpu(*val);
> > > > +
> > > > if (options) {
> > > > +   err = kstrtoul(options, 10, );
> > > > +   if (!err)
> > > > +   early_console_dev.baud = baud;
> > > 
> > > This seems fine to do here, but then we should also parse the
> > > other
> > > standard options here too. And we should make sure we're not
> > > doing it
> > > twice.
> > 
> > I added only baud parsing here because we parse only baud from
> > standard
> > options
> > when register_earlycon is used. (see parse_options function which
> > is
> > called
> > from register_earlycon)
> > 
> > But I can add other standard options parsing here (probably using
> > uart_parse_options + uart_set_options).
> > What do you think?
> 
> That seems fine as long as consoles can still have their own options.
Ok.

Should I also add standard options parsing to register_earlycon?
(as we parse only baud from standard options in register_earlycon)

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

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

2017-08-16 Thread Rob Herring
On Wed, Aug 16, 2017 at 6:52 AM, Eugeniy Paltsev
 wrote:
> Hi Rob,
>
> On Tue, 2017-08-15 at 14:26 -0500, Rob Herring wrote:
>> On Tue, Aug 15, 2017 at 12:21 PM, Eugeniy Paltsev
>>  wrote:
>> > [snip]
>> > @@ -282,7 +283,15 @@ int __init of_setup_earlycon(const struct
>> > earlycon_id *match,
>> > }
>> > }
>> >
>> > +   val = of_get_flat_dt_prop(node, "baud", NULL);
>>
>> No, we already have a defined way to set the baud, we don't need a
>> property in addition. Plus you didn't document it.
>
> I guess by defined way to set the baud you mean setting baud after
> device alias
> in stdout-path property (like stdout-path = "serial:115200n8"), right?
>
> The idea was to reuse "baud" property from serial node to set the
> earlycon baud:
>
> chosen {
> ...
> stdout-path = 
> };
>
> serial: uart@... {
> ...
> baud = <115200>;   /* Get baud from here */

"current-speed" is already defined for this purpose. If you want to
add that, that's fine.

> };
>
>> > +   if (val)
>> > +   early_console_dev.baud = be32_to_cpu(*val);
>> > +
>> > if (options) {
>> > +   err = kstrtoul(options, 10, );
>> > +   if (!err)
>> > +   early_console_dev.baud = baud;
>>
>> This seems fine to do here, but then we should also parse the other
>> standard options here too. And we should make sure we're not doing it
>> twice.
> I added only baud parsing here because we parse only baud from standard
> options
> when register_earlycon is used. (see parse_options function which is
> called
> from register_earlycon)
>
> But I can add other standard options parsing here (probably using
> uart_parse_options + uart_set_options).
> What do you think?

That seems fine as long as consoles can still have their own options.

Rob

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


Re: Adding new ARC platforms (was Re: Handling stub code for new platforms)

2017-08-16 Thread Alexandru Gagniuc

On 08/13/2017 10:34 AM, Vineet Gupta wrote:

On 08/11/2017 10:55 PM, Alexandru Gagniuc wrote:

I was hoping to avoid the addition of extra source files for zero code
gain, though your proposal does work. However, since the platform
would be added unconditionally, would it make more sense to add the
.compatible = "adaptrum,anarion"


Actual Abilis TB10x is similar in terms of need for special platform
callbacks, but they do need Kconfig glue to pull in bunch of drivers,
your platform doesn't ?


I was planning to pull in optional drivers via '_defconfig' rather than 
Kconfig rules. I might need it to pull in the reset drivers, depending 
on how simple-reset turns out. I'll submit v3, and then we can look if 
it's a good idea or not to add to -nsim.


Alex



-Vineet


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


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

2017-08-16 Thread Alexandru Gagniuc
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"
+
+/ {
+   compatible = "adaptrum,anarion";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   soc {
+   compatible = "simple-bus";
+   device_type = "soc";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+   interrupt-parent = <_intc>;
+
+   core_intc: interrupt-controller {
+   compatible = "snps,arc700-intc";
+   interrupt-controller;
+   #interrupt-cells = <1>;
+   };
+
+   uart0: serial@f2202100 {
+   compatible = "ns16550";
+   reg = <0xf2202100 0x20>;
+   interrupts = <8>;
+   reg-shift = <2>;
+   reg-io-width = <4>;
+   clock-frequency = <19200>;
+   status = "disabled";
+   };
+
+   uart1: serial@f2202200 {
+   compatible = "ns16550";
+   reg = <0xf2202200 0x20>;
+   interrupts = <8>;
+   reg-shift = <2>;
+   reg-io-width = <4>;
+   clock-frequency = <19200>;
+   status = "disabled";
+   };
+
+   uart2: serial@f2202300 {
+   compatible = "ns16550";
+   reg = <0xf2202300 0x20>;
+   interrupts = <8>;
+   reg-shift = <2>;
+   reg-io-width = <4>;
+   clock-frequency = <19200>;
+   status = "disabled";
+   };
+
+   uart3: serial@f2202400 {
+   compatible = "ns16550";
+   reg = <0xf2202400 0x20>;
+   interrupts = <8>;
+   reg-shift = <2>;
+   reg-io-width = <4>;
+   clock-frequency = <19200>;
+   status = "disabled";
+   };
+
+   qspi: qspi@f200f000 {
+   compatible = "adaptrum,anarion-qspi";
+   reg = <0xf200f000 0x1000>,
+ <0x2000 0x0800>;
+
+   interrupts = <10>;
+   status = "disabled";
+   };
+
+   gmac0: ethernet@f201 {
+   compatible = "adaptrum,anarion-gmac", "snps,dwmac";
+   reg = <0xf201 0x4000>;
+
+   interrupt-parent = <_intc>;
+   interrupts = <20>;
+   interrupt-names = "macirq";
+
+   clocks = <_clk>;
+   clock-names = "stmmaceth";
+
+   snps,pbl = <32>;
+   status = "disabled";
+   };
+
+   gmac1: ethernet@f2014000 {
+   compatible = "adaptrum,anarion-gmac", "snps,dwmac";
+   reg = <0xf2014000 0x4000>, <0xf2018100 8>;
+
+   interrupt-parent = <_intc>;
+   interrupts = <21>;
+   interrupt-names = "macirq";
+
+   clocks = <_clk>;
+   clock-names = "stmmaceth";
+
+   snps,pbl = <32>;
+   status = "disabled";
+   };
+   };
+};
diff --git a/arch/arc/boot/dts/adaptrum_anarion_fpga.dts 
b/arch/arc/boot/dts/adaptrum_anarion_fpga.dts
new file mode 100644
index 000..6b2e22f
--- /dev/null
+++ b/arch/arc/boot/dts/adaptrum_anarion_fpga.dts
@@ -0,0 +1,51 @@
+/*
+ * Adaptrum Endor -- Anarion based FPGA emulation platform
+ *
+ * (C) Copyright 2017 Adaptrum, Inc.
+ * Written by Alexandru Gagniuc  for Adaptrum, Inc.
+ * Licensed under the GPLv2 or 

[PATCH v3 0/2] Add platform support for Adaptrum Anarion SOC

2017-08-16 Thread Alexandru Gagniuc
Changes since v2:
 * Changed compatible binding of uart[1-3] to "ns16550" (they are not DW UARTs)
 * Add support under plat-nsim instead of creating a new stub platform
 * Changed board model to "adaptrum,endor-fpga" to allow LEDE scripts to ID the 
board
 * Prefix compatible binding with 'arc-'

Changes since v1:
 * Updated CPU core clock to 24 MHz to match HW changes.

Alexandru Gagniuc (2):
  ARC: [plat-sim] Add .compatible property for Adaptrum Anarion SOC
  ARC: DTS: Add device-tree for Anarion-based development board

 arch/arc/boot/dts/adaptrum_anarion.dtsi | 110 
 arch/arc/boot/dts/adaptrum_anarion_fpga.dts |  51 +
 arch/arc/plat-sim/platform.c|   1 +
 3 files changed, 162 insertions(+)
 create mode 100644 arch/arc/boot/dts/adaptrum_anarion.dtsi
 create mode 100644 arch/arc/boot/dts/adaptrum_anarion_fpga.dts

-- 
2.9.3


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


[PATCH v3 1/2] ARC: [plat-sim] Add .compatible property for Adaptrum Anarion SOC

2017-08-16 Thread Alexandru Gagniuc
Anarion does not require any special configuration during early boot.
This is compatible with nsim, hence-why it is added here.

As development continues, should we need to add any drivers via
Kconfig, we can do that by adding and sourcing a "Kconfig.anarion".
This approach was chosen --as opposed to adding plat-anarion/--
because it doesn't add a bunch of extra files.

Signed-off-by: Alexandru Gagniuc 
---
 arch/arc/plat-sim/platform.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/plat-sim/platform.c b/arch/arc/plat-sim/platform.c
index 5cda56b..a5dbfab 100644
--- a/arch/arc/plat-sim/platform.c
+++ b/arch/arc/plat-sim/platform.c
@@ -21,6 +21,7 @@
 
 static const char *simulation_compat[] __initconst = {
 #ifdef CONFIG_ISA_ARCOMPACT
+   "adaptrum,arc-anarion",
"snps,nsim",
"snps,nsimosci",
 #else
-- 
2.9.3


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