Re: [PATCH v4 4/4] board: Add support for Conclusive KSTR-SAMA5D27

2023-10-10 Thread Eugen Hristev

Hello Artur,

On 10/9/23 17:41, Artur Rojek wrote:

Introduce support for Conclusive KSTR-SAMA5D27 Single Board Computer.

Co-developed-by: Jakub Klama 
Signed-off-by: Jakub Klama 
Co-developed-by: Marcin Jabrzyk 
Signed-off-by: Marcin Jabrzyk 
Signed-off-by: Artur Rojek 
---

v4: - utilize EVT_SETTINGS_R in order to read MAC and serial number from
   EEPROM

v3: - use CONFIG_ID_EEPROM to read serial number
 - as side-effect of using CONFIG_ID_EEPROM, KSTR-SAMA5D27 now also
   correctly uses EEPROM embedded MAC addresses (overlooked in v1-v2)
 - use CONFIG_DISPLAY_BOARDINFO_LATE for printing the board model and
   serial number, and provide the required checkboard() call
 - drop CONFIG_BOARD_LATE_INIT, as not needed anymore
 - defconfig cleanup

v2: - remove redundant license text from at91-kstr-sama5d27.dts
 - when defining properties in .dts, reference nodes by labels
 - drop nodes for usb0 and pmic, as these aren't used by drivers
 - switch i2c to flexcom driver and make the necessary dts changes
 - sort includes in at91-kstr-sama5d27.dts alphabetically

  arch/arm/dts/Makefile |   3 +
  arch/arm/dts/at91-kstr-sama5d27.dts   | 131 ++
  arch/arm/mach-at91/Kconfig|  12 +
  board/conclusive/kstr-sama5d27/Kconfig|  15 ++
  board/conclusive/kstr-sama5d27/MAINTAINERS|   8 +
  board/conclusive/kstr-sama5d27/Makefile   |   5 +
  .../conclusive/kstr-sama5d27/kstr-sama5d27.c  | 239 ++
  configs/kstr_sama5d27_defconfig   |  73 ++
  include/configs/kstr-sama5d27.h   |  15 ++
  9 files changed, 501 insertions(+)
  create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts
  create mode 100644 board/conclusive/kstr-sama5d27/Kconfig
  create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS
  create mode 100644 board/conclusive/kstr-sama5d27/Makefile
  create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c
  create mode 100644 configs/kstr_sama5d27_defconfig
  create mode 100644 include/configs/kstr-sama5d27.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index bde2176ec7f6..c0f3525ed4d3 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1198,6 +1198,9 @@ dtb-$(CONFIG_TARGET_SAMA5D27_SOM1_EK) += \
  dtb-$(CONFIG_TARGET_SAMA5D27_WLSOM1_EK) += \
at91-sama5d27_wlsom1_ek.dtb
  
+dtb-$(CONFIG_TARGET_KSTR_SAMA5D27) += \

+   at91-kstr-sama5d27.dtb
+
  dtb-$(CONFIG_TARGET_SAMA5D2_ICP) += \
at91-sama5d2_icp.dtb
  
diff --git a/arch/arm/dts/at91-kstr-sama5d27.dts b/arch/arm/dts/at91-kstr-sama5d27.dts

new file mode 100644
index ..fe9ec7e5bbc3
--- /dev/null
+++ b/arch/arm/dts/at91-kstr-sama5d27.dts
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: GPL-2.0+ OR X11
+/*
+ * at91-kstr-sama5d27.dts - Device Tree file for Conclusive KSTR-SAMA5D27 board
+ *
+ *  Copyright (C) 2019-2023 Conclusive Engineering Sp. z o. o.
+ *
+ */
+/dts-v1/;
+
+#include "sama5d2.dtsi"
+#include "sama5d2-pinfunc.h"
+#include 
+#include 
+#include 
+
+/ {
+   model = "Conclusive KSTR-SAMA5D27";
+   compatible = "conclusive,kstr-sama5d27", "atmel,sama5d2", "atmel,sama5";
+
+   chosen {
+   bootph-all;
+   stdout-path = &uart1;
+   };
+};
+
+&main_xtal {
+   clock-frequency = <1200>;
+};
+
+&sdmmc0 {
+   bus-width = <4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_sdmmc0_cmd_dat_default 
&pinctrl_sdmmc0_ck_cd_default>;
+   status = "okay";
+   bootph-all;


Can you create a separate file named at91-kstr-sama5d27-u-boot.dtsi ( 
which is automatically included by the Makefile) which would contain the 
bootph properties


(Have a look at arch/arm/dts/at91-sama5d29_curiosity-u-boot.dtsi for 
example )


In theory we would like the board dts file to be identical with Linux ( 
as much as possible if not identical ), and have specific U-boot props 
in such a separate file.




+};
+
+&uart1 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_uart1_default>;
+   status = "okay";
+   bootph-all;
+};
+
+&macb0 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>;
+   phy-mode = "rmii";
+   status = "okay";
+
+   ethernet-phy@0 {
+   reg = <0x0>;
+   reset-gpios = <&pioA 44 GPIO_ACTIVE_LOW>;
+   };
+};
+
+&flx4 {
+   atmel,flexcom-mode = ;
+   status = "okay";
+};
+
+&i2c6 {
+   clock-frequency = <10>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_flx4_i2c>;
+   status = "okay";


Which bus number (in Uboot) is this i2c6 being assigned to ?
Would it be better , and/or more predictable to add an alias to the 
desired bus number in DT ?

e.g. aliases { i2c2 = &i2c6; }


Thanks,
Eugen


+
+   eeprom: eeprom@50 {
+   compatible = "microchip,24c32", "atmel,24c32";
+   reg = <0x50>;
+   

[PATCH v4 4/4] board: Add support for Conclusive KSTR-SAMA5D27

2023-10-09 Thread Artur Rojek
Introduce support for Conclusive KSTR-SAMA5D27 Single Board Computer.

Co-developed-by: Jakub Klama 
Signed-off-by: Jakub Klama 
Co-developed-by: Marcin Jabrzyk 
Signed-off-by: Marcin Jabrzyk 
Signed-off-by: Artur Rojek 
---

v4: - utilize EVT_SETTINGS_R in order to read MAC and serial number from
  EEPROM

v3: - use CONFIG_ID_EEPROM to read serial number 
- as side-effect of using CONFIG_ID_EEPROM, KSTR-SAMA5D27 now also
  correctly uses EEPROM embedded MAC addresses (overlooked in v1-v2)
- use CONFIG_DISPLAY_BOARDINFO_LATE for printing the board model and
  serial number, and provide the required checkboard() call 
- drop CONFIG_BOARD_LATE_INIT, as not needed anymore
- defconfig cleanup

v2: - remove redundant license text from at91-kstr-sama5d27.dts
- when defining properties in .dts, reference nodes by labels
- drop nodes for usb0 and pmic, as these aren't used by drivers 
- switch i2c to flexcom driver and make the necessary dts changes
- sort includes in at91-kstr-sama5d27.dts alphabetically

 arch/arm/dts/Makefile |   3 +
 arch/arm/dts/at91-kstr-sama5d27.dts   | 131 ++
 arch/arm/mach-at91/Kconfig|  12 +
 board/conclusive/kstr-sama5d27/Kconfig|  15 ++
 board/conclusive/kstr-sama5d27/MAINTAINERS|   8 +
 board/conclusive/kstr-sama5d27/Makefile   |   5 +
 .../conclusive/kstr-sama5d27/kstr-sama5d27.c  | 239 ++
 configs/kstr_sama5d27_defconfig   |  73 ++
 include/configs/kstr-sama5d27.h   |  15 ++
 9 files changed, 501 insertions(+)
 create mode 100644 arch/arm/dts/at91-kstr-sama5d27.dts
 create mode 100644 board/conclusive/kstr-sama5d27/Kconfig
 create mode 100644 board/conclusive/kstr-sama5d27/MAINTAINERS
 create mode 100644 board/conclusive/kstr-sama5d27/Makefile
 create mode 100644 board/conclusive/kstr-sama5d27/kstr-sama5d27.c
 create mode 100644 configs/kstr_sama5d27_defconfig
 create mode 100644 include/configs/kstr-sama5d27.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index bde2176ec7f6..c0f3525ed4d3 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1198,6 +1198,9 @@ dtb-$(CONFIG_TARGET_SAMA5D27_SOM1_EK) += \
 dtb-$(CONFIG_TARGET_SAMA5D27_WLSOM1_EK) += \
at91-sama5d27_wlsom1_ek.dtb
 
+dtb-$(CONFIG_TARGET_KSTR_SAMA5D27) += \
+   at91-kstr-sama5d27.dtb
+
 dtb-$(CONFIG_TARGET_SAMA5D2_ICP) += \
at91-sama5d2_icp.dtb
 
diff --git a/arch/arm/dts/at91-kstr-sama5d27.dts 
b/arch/arm/dts/at91-kstr-sama5d27.dts
new file mode 100644
index ..fe9ec7e5bbc3
--- /dev/null
+++ b/arch/arm/dts/at91-kstr-sama5d27.dts
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: GPL-2.0+ OR X11
+/*
+ * at91-kstr-sama5d27.dts - Device Tree file for Conclusive KSTR-SAMA5D27 board
+ *
+ *  Copyright (C) 2019-2023 Conclusive Engineering Sp. z o. o.
+ *
+ */
+/dts-v1/;
+
+#include "sama5d2.dtsi"
+#include "sama5d2-pinfunc.h"
+#include 
+#include 
+#include 
+
+/ {
+   model = "Conclusive KSTR-SAMA5D27";
+   compatible = "conclusive,kstr-sama5d27", "atmel,sama5d2", "atmel,sama5";
+
+   chosen {
+   bootph-all;
+   stdout-path = &uart1;
+   };
+};
+
+&main_xtal {
+   clock-frequency = <1200>;
+};
+
+&sdmmc0 {
+   bus-width = <4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_sdmmc0_cmd_dat_default 
&pinctrl_sdmmc0_ck_cd_default>;
+   status = "okay";
+   bootph-all;
+};
+
+&uart1 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_uart1_default>;
+   status = "okay";
+   bootph-all;
+};
+
+&macb0 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>;
+   phy-mode = "rmii";
+   status = "okay";
+
+   ethernet-phy@0 {
+   reg = <0x0>;
+   reset-gpios = <&pioA 44 GPIO_ACTIVE_LOW>;
+   };
+};
+
+&flx4 {
+   atmel,flexcom-mode = ;
+   status = "okay";
+};
+
+&i2c6 {
+   clock-frequency = <10>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_flx4_i2c>;
+   status = "okay";
+
+   eeprom: eeprom@50 {
+   compatible = "microchip,24c32", "atmel,24c32";
+   reg = <0x50>;
+   read-only;
+   pagesize = <32>;
+   status = "okay";
+   };
+};
+
+&pioA {
+   pinctrl {
+   pinctrl_uart1_default: uart1_default {
+   pinmux = ,
+;
+   bias-disable;
+   bootph-all;
+   };
+
+   pinctrl_macb0_phy_irq: macb0_phy_irq {
+   pinmux = ;
+   bias-disable;
+   bootph-all;
+   };
+
+   pinctrl_macb0_rmii: macb0_rmii {
+   pinmux = ,
+,
+,
+