Re: [PATCH 3/3] ARM: dts: microchip: sama7g54_curiosity: Add initial device tree of the board

From: Krzysztof Kozlowski
Date: Tue Feb 13 2024 - 07:16:52 EST


On 13/02/2024 09:56, Mihai Sain wrote:
> Add initial device tree of the SAMA7G54 Curiosity board.
>
> Signed-off-by: Mihai Sain <mihai.sain@xxxxxxxxxxxxx>
> ---
> arch/arm/boot/dts/microchip/Makefile | 4 +-
> .../dts/microchip/at91-sama7g54_curiosity.dts | 491 ++++++++++++++++++
> 2 files changed, 494 insertions(+), 1 deletion(-)
> create mode 100644 arch/arm/boot/dts/microchip/at91-sama7g54_curiosity.dts
>
> diff --git a/arch/arm/boot/dts/microchip/Makefile b/arch/arm/boot/dts/microchip/Makefile
> index efde9546c8f4..29b2a788748f 100644
> --- a/arch/arm/boot/dts/microchip/Makefile
> +++ b/arch/arm/boot/dts/microchip/Makefile
> @@ -12,6 +12,7 @@ DTC_FLAGS_at91-sama5d3_eds := -@
> DTC_FLAGS_at91-sama5d3_xplained := -@
> DTC_FLAGS_at91-sama5d4_xplained := -@
> DTC_FLAGS_at91-sama7g5ek := -@
> +DTC_FLAGS_at91-sama7g54_curiosity := -@
> dtb-$(CONFIG_SOC_AT91RM9200) += \
> at91rm9200ek.dtb \
> mpa1600.dtb
> @@ -87,7 +88,8 @@ dtb-$(CONFIG_SOC_SAM_V7) += \
> at91-sama5d4ek.dtb \
> at91-vinco.dtb
> dtb-$(CONFIG_SOC_SAMA7G5) += \
> - at91-sama7g5ek.dtb
> + at91-sama7g5ek.dtb \
> + at91-sama7g54_curiosity.dtb
>
> dtb-$(CONFIG_SOC_LAN966) += \
> lan966x-kontron-kswitch-d10-mmt-6g-2gs.dtb \
> diff --git a/arch/arm/boot/dts/microchip/at91-sama7g54_curiosity.dts b/arch/arm/boot/dts/microchip/at91-sama7g54_curiosity.dts
> new file mode 100644
> index 000000000000..c2955a170658
> --- /dev/null
> +++ b/arch/arm/boot/dts/microchip/at91-sama7g54_curiosity.dts
> @@ -0,0 +1,491 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * at91-sama7g54_curiosity.dts - Device Tree file for SAMA7G54 Curiosity Board
> + *
> + * Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
> + *
> + * Author: Mihai Sain <mihai.sain@xxxxxxxxxxxxx>
> + *
> + */
> +/dts-v1/;
> +#include "sama7g5-pinfunc.h"
> +#include "sama7g5.dtsi"
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/mfd/atmel-flexcom.h>
> +#include <dt-bindings/pinctrl/at91.h>
> +
> +/ {
> + model = "Microchip SAMA7G54 Curiosity";
> + compatible = "microchip,sama7g54-curiosity", "microchip,sama7g5", "microchip,sama7";
> +
> + chosen {
> + bootargs = "console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait";

What if user wants root from other place? What if mmc number changes,
which is actually happening all the time (hint: use partuuid)? Drop
root, it's not that helpful.

You also do not need console, so drop entire bootargs.


> + stdout-path = "serial0:115200n8";
> + };
> +
> + aliases {
> + serial0 = &uart3;
> + i2c0 = &i2c10;
> + };
> +
> + clocks {
> + slow_xtal {

No underscores in node names. Generic node names, so at least generic
prefix or suffix. Anyway you should override your properties via
phandle/label style.


> + clock-frequency = <32768>;
> + };
> +
> + main_xtal {
> + clock-frequency = <24000000>;
> + };
> + };
> +
> + gpio-keys {
> + compatible = "gpio-keys";
> +
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_key_gpio_default>;
> +
> + button-user {
> + label = "user-button";
> + gpios = <&pioA PIN_PD19 GPIO_ACTIVE_LOW>;
> + linux,code = <KEY_PROG1>;
> + wakeup-source;
> + };
> + };
> +
> + leds {
> + compatible = "gpio-leds";
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_led_gpio_default>;
> + status = "okay";

Why do you need it? Was it disabled anywhere?

> +
> + led-red {
> + label = "red";

Use color and function instead.

> + gpios = <&pioA PIN_PD13 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + led-green {
> + label = "green";

Use color and function instead.

> + gpios = <&pioA PIN_PD14 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + led-blue {
> + label = "blue";

Use color and function instead.

> + gpios = <&pioA PIN_PB15 GPIO_ACTIVE_HIGH>;
> + linux,default-trigger = "heartbeat";
> + };
> + };
> +
> + memory@60000000 {
> + device_type = "memory";
> + reg = <0x60000000 0x10000000>; // 256 MiB DDR3L-1066 16-bit
> + };
> +};
> +
> +&adc {
> + vddana-supply = <&vddout25>;
> + vref-supply = <&vddout25>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_mikrobus1_an_default &pinctrl_mikrobus2_an_default>;
> + status = "okay";
> +};
> +
> +&cpu0 {
> + cpu-supply = <&vddcpu>;
> +};
> +
> +&dma0 {
> + status = "okay";
> +};
> +
> +&dma1 {
> + status = "okay";
> +};
> +
> +&dma2 {
> + status = "okay";
> +};
> +
> +&ebi {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_nand_default>;
> + status = "okay";
> +
> + nand_controller: nand-controller {
> + status = "okay";
> +
> + nand@3 {
> + reg = <0x3 0x0 0x800000>;
> + atmel,rb = <0>;
> + nand-bus-width = <8>;
> + nand-ecc-mode = "hw";
> + nand-ecc-strength = <8>;
> + nand-ecc-step-size = <512>;
> + nand-on-flash-bbt;
> + label = "nand";
> + status = "okay";

Was it disabled anywhere?

> +
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + at91bootstrap@0 {
> + label = "nand: at91bootstrap";
> + reg = <0x0 0x40000>;
> + };
> +
> + bootloader@40000 {
> + label = "nand: u-boot";
> + reg = <0x40000 0x100000>;
> + };
> +
> + bootloaderenv@140000 {
> + label = "nand: u-boot env";
> + reg = <0x140000 0x40000>;
> + };
> +
> + dtb@180000 {
> + label = "nand: device tree";
> + reg = <0x180000 0x80000>;
> + };
> +
> + kernel@200000 {
> + label = "nand: kernel";
> + reg = <0x200000 0x600000>;
> + };
> +
> + rootfs@800000 {
> + label = "nand: rootfs";
> + reg = <0x800000 0x1f800000>;
> + };
> + };
> + };
> + };
> +};
> +
> +&flx3 {
> + atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
> + status = "okay";
> +
> + uart3: serial@200 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_flx3_default>;
> + status = "okay";
> + };
> +};
> +
> +&flx10 {
> + atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
> + status = "okay";
> +
> + i2c10: i2c@600 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_flx10_default>;
> + i2c-analog-filter;
> + i2c-digital-filter;
> + i2c-digital-filter-width-ns = <35>;
> + status = "okay";
> +
> + adc@1f {
> + compatible = "microchip,pac1934";
> + reg = <0x1f>;
> + };
> +
> + eeprom@51 {
> + compatible = "atmel,24c02";
> + reg = <0x51>;
> + pagesize = <16>;
> + size = <256>;
> + status = "okay";

Was it disabled anywhere?

> + };
> +
> + mcp16502@5b {

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation


> + compatible = "microchip,mcp16502";
> + reg = <0x5b>;
> + status = "okay";

Was it disabled anywhere?

> +
> + regulators {
> + vdd_3v3: VDD_IO {
> + regulator-name = "VDD_IO";
> + regulator-min-microvolt = <3300000>;
> + regulator-max-microvolt = <3300000>;
> + regulator-initial-mode = <2>;
> + regulator-allowed-modes = <2>, <4>;
> + regulator-always-on;
> +
> + regulator-state-standby {
> + regulator-on-in-suspend;
> + regulator-suspend-microvolt = <3300000>;
> + regulator-mode = <4>;
> + };
> +
> + regulator-state-mem {
> + regulator-off-in-suspend;
> + regulator-mode = <4>;
> + };
> + };
> +
> + vddioddr: VDD_DDR {
> + regulator-name = "VDD_DDR";
> + regulator-min-microvolt = <1350000>;
> + regulator-max-microvolt = <1350000>;
> + regulator-initial-mode = <2>;
> + regulator-allowed-modes = <2>, <4>;
> + regulator-always-on;
> +
> + regulator-state-standby {
> + regulator-on-in-suspend;
> + regulator-suspend-microvolt = <1350000>;
> + regulator-mode = <4>;
> + };
> +
> + regulator-state-mem {
> + regulator-on-in-suspend;
> + regulator-suspend-microvolt = <1350000>;
> + regulator-mode = <4>;
> + };
> + };
> +
> + vddcore: VDD_CORE {
> + regulator-name = "VDD_CORE";
> + regulator-min-microvolt = <1150000>;
> + regulator-max-microvolt = <1150000>;
> + regulator-initial-mode = <2>;
> + regulator-allowed-modes = <2>, <4>;
> + regulator-always-on;
> +
> + regulator-state-standby {
> + regulator-on-in-suspend;
> + regulator-suspend-voltage = <1150000>;
> + regulator-mode = <4>;
> + };
> +
> + regulator-state-mem {
> + regulator-off-in-suspend;
> + regulator-mode = <4>;
> + };
> + };
> +
> + vddcpu: VDD_OTHER {
> + regulator-name = "VDD_OTHER";
> + regulator-min-microvolt = <1050000>;
> + regulator-max-microvolt = <1250000>;
> + regulator-initial-mode = <2>;
> + regulator-allowed-modes = <2>, <4>;
> + regulator-ramp-delay = <3125>;
> + regulator-always-on;
> +
> + regulator-state-standby {
> + regulator-on-in-suspend;
> + regulator-suspend-voltage = <1050000>;
> + regulator-mode = <4>;
> + };
> +
> + regulator-state-mem {
> + regulator-off-in-suspend;
> + regulator-mode = <4>;
> + };
> + };
> +
> + vldo1: LDO1 {
> + regulator-name = "LDO1";
> + regulator-min-microvolt = <1800000>;
> + regulator-max-microvolt = <1800000>;
> + regulator-always-on;
> +
> + regulator-state-standby {
> + regulator-suspend-voltage = <1800000>;
> + regulator-on-in-suspend;
> + };
> +
> + regulator-state-mem {
> + regulator-off-in-suspend;
> + };
> + };
> +
> + vldo2: LDO2 {
> + regulator-name = "LDO2";
> + regulator-min-microvolt = <3300000>;
> + regulator-max-microvolt = <3300000>;
> + regulator-always-on;
> +
> + regulator-state-standby {
> + regulator-suspend-voltage = <3300000>;
> + regulator-on-in-suspend;
> + };
> +
> + regulator-state-mem {
> + regulator-off-in-suspend;
> + };
> + };
> + };
> + };
> + };
> +};
> +
> +&qspi1 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_qspi1_default>;
> + status = "okay";
> +
> + flash@0 {
> + compatible = "jedec,spi-nor";
> + reg = <0x0>;
> + spi-max-frequency = <100000000>;
> + spi-tx-bus-width = <4>;
> + spi-rx-bus-width = <4>;
> + m25p,fast-read;
> + status = "okay";

Was it disabled anywhere?



Best regards,
Krzysztof