Hello Heiko,

Thanks for your review.

> Both Captain and Edge-V seem to be identical from a component point
> of view, so should likely share the same dts, or is there some major
> difference coming later?

This is the first patch to support Khadas Edge/Edge-V/Captain board, so I just add basic dts nodes.

For Captain has more peripherals then Edge-V, so the dts will be different in the future, but it is the same now.


Heiko Stuebner <heiko@sntech.de> 于2019年6月4日周二 下午10:08写道:
Hi Nick,

devicetrees look mostly good, with a bit of "bookkeeping" issues and
some small nits below.

Am Dienstag, 28. Mai 2019, 11:21:07 CEST schrieb xieqinick@gmail.com:
> From: Nick <nick@khadas.com>

Can you provide a full name (first-+surename) for patch from and Signed-off
lines please?


> Add devicetree support for Khadas Edge/Edge-V/Captain boards.
> Khadas Edge is an expandable Rockchip RK3399 board with goldfinger.
> Khadas Captain is the carrier board for Khadas Edge.
> Khadas Edge-V is a Khadas VIM form factor Rockchip RK3399 board.
>
> Signed-off-by: Nick <nick@khadas.com>
> ---
>  arch/arm64/boot/dts/rockchip/Makefile              |   3 +
>  .../boot/dts/rockchip/rk3399-khadas-captain.dts    |  27 +
>  .../boot/dts/rockchip/rk3399-khadas-edge-v.dts     |  28 +

when adding boards, please also make sure to add entries to
        Documentation/devicetree/bindings/arm/rockchip.yaml

Take a look at the "FriendlyElec NanoPi4 series boards" for an
example on how to add a family of boards like your Edge/Captain.


> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-captain.dts b/arch/arm64/boot/dts/rockchip/rk3399-khadas-captain.dts
> new file mode 100644
> index 0000000..85eb51c
> --- /dev/null
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-captain.dts
> @@ -0,0 +1,27 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2019 Shenzhen Wesion Technology Co., Ltd.
> + * (https://www.khadas.com)
> + */
> +
> +/dts-v1/;
> +#include "rk3399-khadas-edge.dtsi"
> +
> +/ {
> +     model = "Khadas Captain";
> +     compatible = "khadas,captain", "rockchip,rk3399";
> +};
> +
> +&gmac {
> +     status = "okay";
> +};
> +
> +&pcie_phy {
> +     status = "okay";
> +};
> +
> +&pcie0 {
> +     ep-gpios = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
> +     num-lanes = <4>;
> +     status = "okay";
> +};
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge-v.dts b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge-v.dts
> new file mode 100644
> index 0000000..396b7f4
> --- /dev/null
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge-v.dts
> @@ -0,0 +1,28 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2019 Shenzhen Wesion Technology Co., Ltd.
> + * (https://www.khadas.com)
> + */
> +
> +/dts-v1/;
> +#include "rk3399-khadas-edge.dtsi"
> +
> +/ {
> +     model = "Khadas Edge-V";
> +     compatible = "khadas,edge-v", "rockchip,rk3399";
> +};
> +
> +&gmac {
> +     status = "okay";
> +};
> +
> +&pcie_phy {
> +     status = "okay";
> +};
> +
> +&pcie0 {
> +     ep-gpios = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
> +     num-lanes = <4>;
> +     status = "okay";
> +};
> +

Both Captain and Edge-V seem to be identical from a component point
of view, so should likely share the same dts, or is there some major
difference coming later?

For the time being you can represent the individual boards like:

        model = "Khadas Edge-V/Captain";
        compatible = "khadas,edge-v", "khadas,edge-captain", "rockchip,rk3399";

Also to show that it's Edge+Captain baseboard, maybe you want to
change the name like shown above (see rk3399-puma-haikou for a similar
setup).


> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dts b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dts
> new file mode 100644
> index 0000000..f0d5bae
> --- /dev/null
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dts
> @@ -0,0 +1,17 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2019 Shenzhen Wesion Technology Co., Ltd.
> + * (https://www.khadas.com)
> + */
> +
> +/dts-v1/;
> +#include "rk3399-khadas-edge.dtsi"
> +
> +/ {
> +     model = "Khadas Edge";
> +     compatible = "khadas,edge", "rockchip,rk3399";
> +};
> +
> +&gmac {
> +     status = "disabled";

the Edge-V/Captain boards do enable the gmac, so you shouldn't need
a special disable here. Just keep it disabled in the edge.dtsi
[aka it comes in the disabled state from rk3399.dtsi already].

> +};
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi
> new file mode 100644
> index 0000000..872b535
> --- /dev/null
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi
> @@ -0,0 +1,795 @@

[...]

> +&gmac {
> +     assigned-clocks = <&cru SCLK_RMII_SRC>;
> +     assigned-clock-parents = <&clkin_gmac>;
> +     clock_in_out = "input";
> +     phy-supply = <&vcc_lan>;
> +     phy-mode = "rgmii";
> +     pinctrl-names = "default";
> +     pinctrl-0 = <&rgmii_pins>;
> +     snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
> +     snps,reset-active-low;
> +     snps,reset-delays-us = <0 10000 50000>;
> +     tx_delay = <0x28>;
> +     rx_delay = <0x11>;
> +     status = "disabled";

status is disabled coming from rk3399.dtsi, so there is no need
to "re-disable" it here.

> +};
> +

[...]

> +&sdio0 {
> +     /* WiFi & BT combo module Ampak AP6356S */
> +     bus-width = <4>;
> +     cap-sdio-irq;
> +     cap-sd-highspeed;
> +     keep-power-in-suspend;
> +     mmc-pwrseq = <&sdio_pwrseq>;
> +     non-removable;
> +     num-slots = <1>;

num-slots is not needed anymore

> +     pinctrl-names = "default";
> +     pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
> +     sd-uhs-sdr104;
> +
> +     /* Power supply */

drop that comment and blank line please. Properties called
*-supply already tell you that they are power supplies :-) .


Heiko