Skip to contentSkip to conversation

Conclusive KSTR-SAMA5D27 support

PATCH Superseded Artur Rojek 2 participants 5 messages Sep 26, 2023 – Oct 2, 2023

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Conclusive KSTR-SAMA5D27 support

Hi all,

this is v2 of the Conclusive KSTR-SAMA5D27 support series.

Patch [1/3] now also renames the EEPROM serial number function and moves its documentation from .c file to the .h. We should be fine doing that, as - to my knowledge - no other part of U-Boot seems to be using this symbol, as evidenced by the missing prototype.

Patch [2/3] is new. It is the direct result of moving i2c as a child of flexcom (see below).

Patch [3/3] now also addresses multiple dts issues. In particular, all node access is now being done through label references, unused nodes have been removed, and the i2c now goes explicitly through flexcom.

Artur Rojek (3):
common: add prototype & rename populate_serial_number()
arm: dts: at91: sama5: Add flexcom4 node
board: Add support for Conclusive KSTR-SAMA5D27

 arch/arm/dts/Makefile                         |   3 +
 arch/arm/dts/at91-kstr-sama5d27.dts           | 131 ++++++++++
 arch/arm/dts/sama5d2.dtsi                     |  20 ++
 arch/arm/mach-at91/Kconfig                    |  13 +
 board/conclusive/kstr-sama5d27/Kconfig        |  15 ++
 board/conclusive/kstr-sama5d27/MAINTAINERS    |   8 +
 board/conclusive/kstr-sama5d27/Makefile       |   5 +
 .../conclusive/kstr-sama5d27/kstr-sama5d27.c  | 234 ++++++++++++++++++
 cmd/tlv_eeprom.c                              |  14 +-
 configs/kstr_sama5d27_defconfig               |  80 ++++++
 include/configs/kstr-sama5d27.h               |  15 ++
 include/init.h                                |  14 ++
 12 files changed, 539 insertions(+), 13 deletions(-)
 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
Signature · 1 line
2.42.0
#1 lore raw

PATCH v2 1/3 common: add prototype & rename populate_serial_number()

Rename populate_serial_number() to a more descriptive eeprom_read_serial() and provide the missing function prototype.

This is useful for boards that wish to read their serial number from EEPROM at init.

---

v2: - rename the function
- move function documentation from .c file to the prototype location

 cmd/tlv_eeprom.c | 14 +-------------
 include/init.h   | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 13 deletions(-)
cmd/tlv_eeprom.c +1 -13
index 79796394c5c8..47c127ca4950 100644
@@ -1088,19 +1088,7 @@ int mac_read_from_eeprom(void)
 	return 0;
 }
 
-/**
- *  populate_serial_number - read the serial number from EEPROM
- *
- *  This function reads the serial number from the EEPROM and sets the
- *  appropriate environment variable.
- *
- *  The environment variable is only set if it has not been set
- *  already.  This ensures that any user-saved variables are never
- *  overwritten.
- *
- *  This function must be called after relocation.
- */
-int populate_serial_number(int devnum)
+int eeprom_read_serial(int devnum)
 {
 	char serialstr[257];
 	int eeprom_index;
include/init.h +14 -0
index 3bf30476a2e0..f18f3b9961d8 100644
@@ -283,6 +283,20 @@ void board_init_r(struct global_data *id, ulong dest_addr)
 int cpu_init_r(void);
 int last_stage_init(void);
 int mac_read_from_eeprom(void);
+
+/**
+ *  eeprom_read_serial - read the serial number from EEPROM
+ *
+ *  This function reads the serial number from the EEPROM and sets the
+ *  appropriate environment variable.
+ *
+ *  The environment variable is only set if it has not been set
+ *  already.  This ensures that any user-saved variables are never
+ *  overwritten.
+ *
+ *  This function must be called after relocation.
+ */
+int eeprom_read_serial(int devnum);
 int set_cpu_clk_info(void);
 int update_flash_size(int flash_size);
 int arch_early_init_r(void);
Signature · 1 line
2.42.0
Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] common: add prototype & rename populate_serial_number()

Quoted 8 lines · Artur Rojek

Rename populate_serial_number() to a more descriptive eeprom_read_serial() and provide the missing function prototype.

This is useful for boards that wish to read their serial number from EEPROM at init.

Quoted 8 lines

---

v2: - rename the function
- move function documentation from .c file to the prototype location

 cmd/tlv_eeprom.c | 14 +-------------
 include/init.h   | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 13 deletions(-)
#3 lore raw

PATCH v2 2/3 arm: dts: at91: sama5: Add flexcom4 node

In reply to Artur Rojek

Set up flexcom4 for Microchip SAMA5D27 SoC and prepare it for usage in I2C mode.

---

v2: new patch

 arch/arm/dts/sama5d2.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/dts/sama5d2.dtsi +20 -0
index dd6468ed96aa..819564fdd5bb 100644
@@ -781,6 +781,26 @@
 				status = "disabled";
 			};
 
+			flx4: flexcom@fc018000 {
+				compatible = "atmel,sama5d2-flexcom";
+				reg = <0xfc018000 0x200>;
+				clocks = <&flx4_clk>;
+				#address-cells = <1>;
+				#size-cells = <1>;
+				ranges = <0x0 0xfc018000 0x800>;
+				status = "disabled";
+
+				i2c6: i2c@600 {
+					compatible = "atmel,sama5d2-i2c";
+					reg = <0x600 0x200>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					clocks = <&flx4_clk>;
+					clock-names = "i2c6_clk";
+					status = "disabled";
+				};
+			};
+
 			aic: interrupt-controller@fc020000 {
 				#interrupt-cells = <3>;
 				compatible = "atmel,sama5d2-aic";
Signature · 1 line
2.42.0
#4 lore raw

PATCH v2 3/3 board: Add support for Conclusive KSTR-SAMA5D27

In reply to Artur Rojek

Introduce support for Conclusive KSTR-SAMA5D27 Single Board Computer.

---

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                    |  13 +
 board/conclusive/kstr-sama5d27/Kconfig        |  15 ++
 board/conclusive/kstr-sama5d27/MAINTAINERS    |   8 +
 board/conclusive/kstr-sama5d27/Makefile       |   5 +
 .../conclusive/kstr-sama5d27/kstr-sama5d27.c  | 234 ++++++++++++++++++
 configs/kstr_sama5d27_defconfig               |  80 ++++++
 include/configs/kstr-sama5d27.h               |  15 ++
 9 files changed, 504 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
arch/arm/dts/Makefile +3 -0
index 85fd5b1157b1..8e4d33c01912 100644
@@ -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
 
arch/arm/dts/at91-kstr-sama5d27.dts new file +131 -0

131 lines not on this page · raw message

arch/arm/mach-at91/Kconfig +13 -0
index 7c2e4ebbdb0f..9ab1a9339ee1 100644
@@ -204,6 +204,18 @@ config TARGET_SAMA5D27_WLSOM1_EK
 	  processor-based SAMA5D2 MPU with 2 Gbit LPDDR2-SDRAM
 	  in a single package.
 
+config TARGET_KSTR_SAMA5D27
+	bool "Conclusive KSTR-SAMA5D27 board"
+	select BOARD_EARLY_INIT_F
+	select SAMA5D2
+	select BOARD_LATE_INIT
+	help
+	  The KSTR-SAMA5D27 embeds SAMA5D27 SoC, together with
+	  256 MiB SDRAM, 10/100 Mbit/s Ethernet, 96 Mbit/s Wi-Fi b/g/n,
+	  Bluetooth 4.1 LE, USB OTG controller w/ type-C USB connector
+	  and stackable GPIO headers in an all-in-one SBC form factor:
+	  https://conclusive.pl/products/kstr-sama5d27-sbc/
+
 config TARGET_SAMA5D2_ICP
 	bool "SAMA5D2 Industrial Connectivity Platform (ICP)"
 	select SAMA5D2
@@ -352,6 +364,7 @@ source "board/atmel/sama5d4_xplained/Kconfig"
 source "board/atmel/sama5d4ek/Kconfig"
 source "board/bluewater/gurnard/Kconfig"
 source "board/calao/usb_a9263/Kconfig"
+source "board/conclusive/kstr-sama5d27/Kconfig"
 source "board/egnite/ethernut5/Kconfig"
 source "board/esd/meesc/Kconfig"
 source "board/gardena/smart-gateway-at91sam/Kconfig"
board/conclusive/kstr-sama5d27/Kconfig new file +15 -0
new file mode 100644
index 000000000000..572551cfda98
@@ -0,0 +1,15 @@
+if TARGET_KSTR_SAMA5D27
+
+config SYS_BOARD
+	default "kstr-sama5d27"
+
+config SYS_VENDOR
+	default "conclusive"
+
+config SYS_SOC
+	default "at91"
+
+config SYS_CONFIG_NAME
+	default "kstr-sama5d27"
+
+endif
board/conclusive/kstr-sama5d27/MAINTAINERS new file +8 -0
new file mode 100644
index 000000000000..cb1635cdd280
@@ -0,0 +1,8 @@
+CONCLUSIVE KSTR-SAMA5D27 BOARD
+M:	Jakub Klama <[email protected]>
+M:	Artur Rojek <[email protected]>
+S:	Maintained
+F:	board/conclusive/kstr-sama5d27
+F:	include/configs/kstr-sama5d27.h
+F:	configs/kstr_sama5d27_defconfig
+F:	arch/arm/dts/at91-kstr-sama5d27.dts
board/conclusive/kstr-sama5d27/Makefile new file +5 -0
new file mode 100644
index 000000000000..edf7d1c93441
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2019-2023 Conclusive Engineering Sp. z o. o.
+
+obj-y += kstr-sama5d27.o
board/conclusive/kstr-sama5d27/kstr-sama5d27.c new file +234 -0

234 lines not on this page · raw message

configs/kstr_sama5d27_defconfig new file +80 -0

80 lines not on this page · raw message

include/configs/kstr-sama5d27.h new file +15 -0
new file mode 100644
index 000000000000..772a073ba209
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2021-2023 Conclusive Engineering Sp. z o. o.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include "at91-sama5_common.h"
+
+/* SDRAM */
+#define CFG_SYS_SDRAM_BASE           0x20000000
+#define CFG_SYS_SDRAM_SIZE           0x10000000
+
+#endif
Signature · 1 line
2.42.0