Re: [PATCH] arm64: Add support for cisco craw64 ARMv8 SoCs

2021-03-31 Thread Arnd Bergmann
On Wed, Mar 31, 2021 at 7:57 PM Daniel Walker  wrote:
>
> On Wed, Mar 31, 2021 at 09:04:15AM +0200, Arnd Bergmann wrote:
> > On Wed, Mar 31, 2021 at 3:46 AM Daniel Walker  wrote:
> > > From: Ofer Licht 
> >
> > Thanks for the submission, it's always nice to see a new platform
>
>
> > > Define craw64 config, dts and Makefile for Cisco
> > > SoCs known as Craw.
> >
> > I'd like some more information about the platform, e.g. the target
> > market and maybe a link to the product information.
>
> Our SoC is produced as an internal product. So SoC specifications aren't
> widely available.
>
> Here is an example of a Cisco product which uses this SoC,
>
> https://www.cisco.com/c/en/us/products/collateral/switches/catalyst-9200-series-switches/nb-06-cat9200-ser-data-sheet-cte-en.html
>
> I suspect that's not really what your looking for tho.

No, that's pretty much exactly what I was looking for. Just put this one
sentence and the link into the patch description and it will be fine.

> >
> > The memory size is usually filled by the boot loader, just put an
> > empty node into the .dtsi file
>
> Arnd, I must regretfully inform you that Cisco has a deep dark addiction to
> bootloaders which, are, um, how do I say this diplomatically, um , brain dead.
>
> You have some other comments below related to moving things into the 
> bootloader,
> and I can look into it, but bootloader inflexibility is wide spread inside
> Cisco.

Ok, no worries. If the bootloader can do it right, you should do it, but
this part is not essential.

Arnd


Re: [PATCH] arm64: Add support for cisco craw64 ARMv8 SoCs

2021-03-31 Thread Daniel Walker
On Wed, Mar 31, 2021 at 09:04:15AM +0200, Arnd Bergmann wrote:
> On Wed, Mar 31, 2021 at 3:46 AM Daniel Walker  wrote:
> > From: Ofer Licht 
> 
> Thanks for the submission, it's always nice to see a new platform
 

> > Define craw64 config, dts and Makefile for Cisco
> > SoCs known as Craw.
> 
> I'd like some more information about the platform, e.g. the target
> market and maybe a link to the product information.

Our SoC is produced as an internal product. So SoC specifications aren't
widely available.

Here is an example of a Cisco product which uses this SoC,

https://www.cisco.com/c/en/us/products/collateral/switches/catalyst-9200-series-switches/nb-06-cat9200-ser-data-sheet-cte-en.html

I suspect that's not really what your looking for tho.

> > Cc: xe-linux-exter...@cisco.com
> > Signed-off-by: Ofer Licht 
> > Signed-off-by: Daniel Walker 
> > ---
> >  .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
> >  arch/arm64/Kconfig.platforms  |   5 +
> >  arch/arm64/boot/dts/Makefile  |   1 +
> >  arch/arm64/boot/dts/cisco/Makefile|   5 +
> >  .../arm64/boot/dts/cisco/craw64-dopplerg2.dts | 239 +++
> >  arch/arm64/boot/dts/cisco/craw64.dtsi | 392 ++
> >  arch/arm64/configs/defconfig  |   1 +
> 
> We have separate branches for dt, defconfig, and the rest, so it would be
> good to split this patch up a little more.
> 
> There should also be an entry in the top-level MAINTAINERS file.
> 
> > diff --git a/arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts 
> > b/arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts
> > new file mode 100644
> > index ..20ecc57b4e5c
> > --- /dev/null
> > +++ b/arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts
> > @@ -0,0 +1,239 @@
> > +/dts-v1/;
> > +
> > +#include "craw64.dtsi"
> > +
> > +/ {
> > +   model = "Cisco Craw64 on DopplerG 2.0";
> > +   compatible = "cisco,craw64-dopplerg2", "cisco,craw64";
> > +
> > +   memory {
> > +   device_type = "memory";
> > +   reg = <0x0 0x8000 0x0 0x8000>;
> > +   };
> 
> The memory size is usually filled by the boot loader, just put an
> empty node into the .dtsi file

Arnd, I must regretfully inform you that Cisco has a deep dark addiction to
bootloaders which, are, um, how do I say this diplomatically, um , brain dead.

You have some other comments below related to moving things into the bootloader,
and I can look into it, but bootloader inflexibility is wide spread inside
Cisco.

> 
> > +   doppler {
> > +   #address-cells = <2>;
> > +   #size-cells = <2>;
> > +   compatible = "simple-bus";
> > +   ranges;
> > +   };
> 
> What is this?
> 

It's a device, but the driver is not submitted. I can remove it along with the
other device driver binding we have where the drivers and bindings aren't 
submitted.

I'll do my best to fix the comments your given an resubmit.

Daniel


Re: [PATCH] arm64: Add support for cisco craw64 ARMv8 SoCs

2021-03-31 Thread Rob Herring
On Tue, 30 Mar 2021 18:46:02 -0700, Daniel Walker wrote:
> From: Ofer Licht 
> 
> Define craw64 config, dts and Makefile for Cisco
> SoCs known as Craw.
> 
> Cc: xe-linux-exter...@cisco.com
> Signed-off-by: Ofer Licht 
> Signed-off-by: Daniel Walker 
> ---
>  .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
>  arch/arm64/Kconfig.platforms  |   5 +
>  arch/arm64/boot/dts/Makefile  |   1 +
>  arch/arm64/boot/dts/cisco/Makefile|   5 +
>  .../arm64/boot/dts/cisco/craw64-dopplerg2.dts | 239 +++
>  arch/arm64/boot/dts/cisco/craw64.dtsi | 392 ++
>  arch/arm64/configs/defconfig  |   1 +
>  7 files changed, 645 insertions(+)
>  create mode 100644 arch/arm64/boot/dts/cisco/Makefile
>  create mode 100644 arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts
>  create mode 100644 arch/arm64/boot/dts/cisco/craw64.dtsi
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:
./Documentation/devicetree/bindings/vendor-prefixes.yaml:238:3: [error] 
duplication of key "^cisco,.*" in mapping (key-duplicates)

dtschema/dtc warnings/errors:
make[1]: *** Deleting file 
'Documentation/devicetree/bindings/vendor-prefixes.example.dts'
Traceback (most recent call last):
  File "/usr/local/bin/dt-extract-example", line 45, in 
binding = yaml.load(open(args.yamlfile, encoding='utf-8').read())
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/main.py", line 420, 
in load
return constructor.get_single_data()
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 111, in get_single_data
return self.construct_document(node)
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 121, in construct_document
for _dummy in generator:
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 714, in construct_yaml_map
value = self.construct_mapping(node)
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 435, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 253, in construct_mapping
if self.check_mapping_key(node, key_node, mapping, key, value):
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 284, in check_mapping_key
raise DuplicateKeyError(*args)
ruamel.yaml.constructor.DuplicateKeyError: while constructing a mapping
  in "", line 19, column 3
found duplicate key "^cisco,.*" with value "{}" (original value: "{}")
  in "", line 238, column 3

To suppress this check see:
http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys

Duplicate keys will become an error in future releases, and are errors
by default when using the new API.

make[1]: *** [Documentation/devicetree/bindings/Makefile:20: 
Documentation/devicetree/bindings/vendor-prefixes.example.dts] Error 1
make[1]: *** Waiting for unfinished jobs
Traceback (most recent call last):
  File "/usr/local/bin/dt-doc-validate", line 67, in 
ret = check_doc(f)
  File "/usr/local/bin/dt-doc-validate", line 25, in check_doc
testtree = dtschema.load(filename, line_number=line_number)
  File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 625, in 
load
return yaml.load(f.read())
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/main.py", line 420, 
in load
return constructor.get_single_data()
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 111, in get_single_data
return self.construct_document(node)
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 121, in construct_document
for _dummy in generator:
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 714, in construct_yaml_map
value = self.construct_mapping(node)
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 435, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 253, in construct_mapping
if self.check_mapping_key(node, key_node, mapping, key, value):
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", 
line 284, in check_mapping_key
raise DuplicateKeyError(*args)
ruamel.yaml.constructor.DuplicateKeyError: while constructing a mapping
  in "", line 19, column 3
found duplicate key "^cisco,.*" with value "{}" (original value: "{}")
  in "", line 238, column 3

To suppress this check see:
http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys

Duplicate keys will become an error in future releases, and are errors
by default when using the new API.

make[1]: *** Deleting file 
'Documentation/devicetree/bindings/processed-schema-examples.json'
Traceback (most recent call last

Re: [PATCH] arm64: Add support for cisco craw64 ARMv8 SoCs

2021-03-31 Thread Arnd Bergmann
On Wed, Mar 31, 2021 at 3:46 AM Daniel Walker  wrote:
> From: Ofer Licht 

Thanks for the submission, it's always nice to see a new platform

> Define craw64 config, dts and Makefile for Cisco
> SoCs known as Craw.

I'd like some more information about the platform, e.g. the target
market and maybe a link to the product information.

> Cc: xe-linux-exter...@cisco.com
> Signed-off-by: Ofer Licht 
> Signed-off-by: Daniel Walker 
> ---
>  .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
>  arch/arm64/Kconfig.platforms  |   5 +
>  arch/arm64/boot/dts/Makefile  |   1 +
>  arch/arm64/boot/dts/cisco/Makefile|   5 +
>  .../arm64/boot/dts/cisco/craw64-dopplerg2.dts | 239 +++
>  arch/arm64/boot/dts/cisco/craw64.dtsi | 392 ++
>  arch/arm64/configs/defconfig  |   1 +

We have separate branches for dt, defconfig, and the rest, so it would be
good to split this patch up a little more.

There should also be an entry in the top-level MAINTAINERS file.

> diff --git a/arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts 
> b/arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts
> new file mode 100644
> index ..20ecc57b4e5c
> --- /dev/null
> +++ b/arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts
> @@ -0,0 +1,239 @@
> +/dts-v1/;
> +
> +#include "craw64.dtsi"
> +
> +/ {
> +   model = "Cisco Craw64 on DopplerG 2.0";
> +   compatible = "cisco,craw64-dopplerg2", "cisco,craw64";
> +
> +   memory {
> +   device_type = "memory";
> +   reg = <0x0 0x8000 0x0 0x8000>;
> +   };

The memory size is usually filled by the boot loader, just put an
empty node into the .dtsi file

> +
> +   soc: soc {
> +   uart0: serial@23f8 {
> +   clock-frequency = <25000>;
> +   status = "ok";
> +   };
> +
> +   uart1: serial@23fc {
> +   clock-frequency = <25000>;
> +   status = "ok";
> +   };
> +
> +   spiclk: spiclk {
> +   clock-frequency = <25000>;
> +   };

The clock frequencies can also normally go into the .dtsi, as those
tend to be SoC specific rather than board specific.

> +   spi: spi@2400 {
> +   status="ok";
> +   flash: flash@0 {
> +   compatible = "micron,n25q128a13", 
> "jedec,spi-nor";
> +   #address-cells = <1>;
> +   #size-cells = <1>;
> +   spi-max-frequency = <800>;
> +   reg = <0>;
> +   partition@0 {
> +   label = "unused0";
> +   reg = <0x0 0x1>;
> +   read-only;
> +   };
> +   partition@1 {
> +   label = "brom";
> +   reg = <0x1 0x1>;
> +   };

The partitions in turn normally go into the bootloader, which
needs to know about them anyway, but might pick different
settings.

> +
> +   stmmaceth: stmmaceth {
> +   clock-frequency = <25000>;
> +   };
> +
> +   eth0: dwmac@282c {
> +   status = "ok";
> +   mdio-channel = <0>;
> +   };

There is no point in defining labels in the board specific file, as
nothing will reference them. If you define labels in the .dtsi file,
you might find it easier to refer to the nodes by those labels
rather than by the full path.

Both of the node names look wrong here. The name for an ethernet
device should be 'ethernet@282c000'.

> +   wd@28500200 {
> +   compatible = "cisco,craw-smgmt-wdt";
> +   reg = <0x28500200 0x140>;
> +   };

Similarly, the watchdog should be watchdog@28500200. I don't
see a binding document for a cisco,craw-smgmt-wdt, so please
drop this node until the binding has been accepted. You can
submit the binding together with the driver or the dts file (as
a separate patch), but I don't want to merge dt nodes without a
reviewed binding, as that has the risk of requiring incompatible
changes later.

> +
> +   doppler_i2c: bsp_i2c {
> +   compatible = "cisco,dplr-i2c";
> +   reg = <0x23f71000 0x10>;
> +   };
> +   };
> +   doppler {
> +   intrpt {
> +   compatible = "cisco,dplr_intrpt";

Same for both of these.

> +   reg = <0x0 0x2000 0x0 0x0FFF>;
> +   interrupts = ,
> +   ,
> +  

[PATCH] arm64: Add support for cisco craw64 ARMv8 SoCs

2021-03-30 Thread Daniel Walker
From: Ofer Licht 

Define craw64 config, dts and Makefile for Cisco
SoCs known as Craw.

Cc: xe-linux-exter...@cisco.com
Signed-off-by: Ofer Licht 
Signed-off-by: Daniel Walker 
---
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 arch/arm64/Kconfig.platforms  |   5 +
 arch/arm64/boot/dts/Makefile  |   1 +
 arch/arm64/boot/dts/cisco/Makefile|   5 +
 .../arm64/boot/dts/cisco/craw64-dopplerg2.dts | 239 +++
 arch/arm64/boot/dts/cisco/craw64.dtsi | 392 ++
 arch/arm64/configs/defconfig  |   1 +
 7 files changed, 645 insertions(+)
 create mode 100644 arch/arm64/boot/dts/cisco/Makefile
 create mode 100644 arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts
 create mode 100644 arch/arm64/boot/dts/cisco/craw64.dtsi

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml 
b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index f6064d84a424..10ac5fa4c3e7 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -229,6 +229,8 @@ patternProperties:
 description: Chuwi Innovation Ltd.
   "^ciaa,.*":
 description: Computadora Industrial Abierta Argentina
+  "^cisco,.*":
+description: Cisco Systems, Inc
   "^cirrus,.*":
 description: Cirrus Logic, Inc.
   "^cisco,.*":
diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index cdfd5fed457f..861f16ceec9d 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -91,6 +91,11 @@ config ARCH_BRCMSTB
help
  This enables support for Broadcom's ARMv8 Set Top Box SoCs
 
+config ARCH_CRAW64
+   bool "Cisco craw64 ARMv8 SoC Family"
+   help
+ This enables support for Cisco craw64 ARMv8 SoCs
+
 config ARCH_EXYNOS
bool "ARMv8 based Samsung Exynos SoC family"
select COMMON_CLK_SAMSUNG
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index f1173cd93594..10fbd54f4424 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -10,6 +10,7 @@ subdir-y += arm
 subdir-y += bitmain
 subdir-y += broadcom
 subdir-y += cavium
+subdir-y += cisco
 subdir-y += exynos
 subdir-y += freescale
 subdir-y += hisilicon
diff --git a/arch/arm64/boot/dts/cisco/Makefile 
b/arch/arm64/boot/dts/cisco/Makefile
new file mode 100644
index ..8503887f6a7d
--- /dev/null
+++ b/arch/arm64/boot/dts/cisco/Makefile
@@ -0,0 +1,5 @@
+dtb-$(CONFIG_ARCH_CRAW64) += craw64-dopplerg2.dtb
+
+always  := $(dtb-y)
+subdir-y:= $(dts-dirs)
+clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts 
b/arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts
new file mode 100644
index ..20ecc57b4e5c
--- /dev/null
+++ b/arch/arm64/boot/dts/cisco/craw64-dopplerg2.dts
@@ -0,0 +1,239 @@
+/dts-v1/;
+
+#include "craw64.dtsi"
+
+/ {
+   model = "Cisco Craw64 on DopplerG 2.0";
+   compatible = "cisco,craw64-dopplerg2", "cisco,craw64";
+
+   memory {
+   device_type = "memory";
+   reg = <0x0 0x8000 0x0 0x8000>;
+   };
+
+   soc: soc {
+   uart0: serial@23f8 {
+   clock-frequency = <25000>;
+   status = "ok";
+   };
+
+   uart1: serial@23fc {
+   clock-frequency = <25000>;
+   status = "ok";
+   };
+
+   spiclk: spiclk {
+   clock-frequency = <25000>;
+   };
+
+   spi: spi@2400 {
+   status="ok";
+   flash: flash@0 {
+   compatible = "micron,n25q128a13", 
"jedec,spi-nor";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   spi-max-frequency = <800>;
+   reg = <0>;
+   partition@0 {
+   label = "unused0";
+   reg = <0x0 0x1>;
+   read-only;
+   };
+   partition@1 {
+   label = "brom";
+   reg = <0x1 0x1>;
+   };
+   partition@2 {
+   label = "bromg";
+   reg = <0x2 0x1>;
+   read-only;
+   };
+   partition@3 {
+   label = "vb";
+   reg = <0x3 0x1>;
+   };
+   partition@4 {
+