[PATCH v2 4/4] at91: add support for sama7g5-ek board

Claudiu Beznea claudiu.beznea at microchip.com
Wed Feb 23 08:36:12 PST 2022


Add support for SAMA7G5-EK board.
Hardware:
- SoC: SAMA7G5
- RAM: Aliance Memory AS4C256M16D3LC (4 Gbit DDR3L)
- SD/MMC: 1 standard 4bit SD Card interface
- USB: 1 Micro-AB host/device, 1 Type-A host, 1 Type-C host
- CAN: 2 interfaces
- Ethernet: 10/100 port, 1Gbps port
- Wi-Fi/BT: 1 optional interface
- Audio: 1 SPDIF RX port, 1 SPDIF TX port, 4 digital microphones
- Camera: 1 RPi CSI camera interface
- Debug: 1 J-Link-OB + CDC, 1 JTAG
- LEDs: 1 RGB
- Buttons: 4 push buttons
- Expansions: 1 RPi Expansion connector, 2 mikroBUS connectors
- Power management: 1 power management IC, 1 power consumption
  measurement device

Signed-off-by: Claudiu Beznea <claudiu.beznea at microchip.com>
---
 package/boot/at91bootstrap/Makefile           |  9 ++-
 package/boot/uboot-at91/Makefile              |  9 ++-
 .../at91/base-files/etc/board.d/02_network    |  2 +-
 target/linux/at91/image/sama7.mk              | 57 +++++++++++++++++++
 target/linux/at91/image/uboot-env.txt         |  7 ++-
 5 files changed, 78 insertions(+), 6 deletions(-)
 create mode 100644 target/linux/at91/image/sama7.mk

diff --git a/package/boot/at91bootstrap/Makefile b/package/boot/at91bootstrap/Makefile
index 92dbf27a1ef5..72afefdffff2 100644
--- a/package/boot/at91bootstrap/Makefile
+++ b/package/boot/at91bootstrap/Makefile
@@ -172,6 +172,12 @@ define AT91Bootstrap/sama5d2_ptc_eksd_uboot
   BUILD_DEVICES:=microchip_sama5d2-ptc-ek
 endef
 
+define AT91Bootstrap/sama7g5eksd_uboot
+  TITLE:=AT91Bootstrap for SAMA7G5-EK (SDCard)
+  BUILD_SUBTARGET:=sama7
+  BUILD_DEVICES:=microchip_sama7g5-ek
+endef
+
 AT91BOOTSTRAP_TARGETS := \
 	at91sam9x5eknf_uboot \
 	at91sam9x5eksd_uboot \
@@ -192,7 +198,8 @@ AT91BOOTSTRAP_TARGETS := \
 	sama5d27_wlsom1_eksd_uboot \
 	sama5d27_wlsom1_ekdf_qspi_uboot \
 	sama5d2_ptc_eknf_uboot \
-	sama5d2_ptc_eksd_uboot
+	sama5d2_ptc_eksd_uboot \
+	sama7g5eksd_uboot
 
 define Build/Compile
 	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
diff --git a/package/boot/uboot-at91/Makefile b/package/boot/uboot-at91/Makefile
index 7052329ecd5e..ed69b8b06c8a 100644
--- a/package/boot/uboot-at91/Makefile
+++ b/package/boot/uboot-at91/Makefile
@@ -143,6 +143,12 @@ define U-Boot/sama5d2_ptc_ek_mmc
   BUILD_DEVICES:=microchip_sama5d2-ptc-ek
 endef
 
+define U-Boot/sama7g5ek_mmc1
+  NAME:=SAMA7G5-EK (SDCard)
+  BUILD_SUBTARGET:=sama7
+  BUILD_DEVICES:=microchip_sama7g5-ek
+endef
+
 UBOOT_TARGETS := \
 	at91sam9m10g45ek_nandflash \
 	at91sam9x5ek_nandflash \
@@ -162,7 +168,8 @@ UBOOT_TARGETS := \
 	sama5d27_wlsom1_ek_mmc \
 	sama5d27_wlsom1_ek_qspiflash \
 	sama5d2_ptc_ek_nandflash \
-	sama5d2_ptc_ek_mmc
+	sama5d2_ptc_ek_mmc \
+	sama7g5ek_mmc1
 
 define Build/Compile
 	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
diff --git a/target/linux/at91/base-files/etc/board.d/02_network b/target/linux/at91/base-files/etc/board.d/02_network
index 3e11f40b325b..857417c7fddc 100644
--- a/target/linux/at91/base-files/etc/board.d/02_network
+++ b/target/linux/at91/base-files/etc/board.d/02_network
@@ -8,7 +8,7 @@ board_config_update
 
 case "$(board_name)" in
 
-atmel,sama5d3-xplained)
+atmel,sama5d3-xplained|microchip,sama7g5ek)
 	ucidef_set_interfaces_lan_wan "eth0" "eth1"
 	;;
 
diff --git a/target/linux/at91/image/sama7.mk b/target/linux/at91/image/sama7.mk
new file mode 100644
index 000000000000..bf1704dfb337
--- /dev/null
+++ b/target/linux/at91/image/sama7.mk
@@ -0,0 +1,57 @@
+
+define Device/default-nand
+  BLOCKSIZE := 128k
+  PAGESIZE := 2048
+  SUBPAGESIZE := 2048
+  MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB -c 2048
+endef
+
+define Build/at91-sdcard
+  $(if $(findstring ext4,$@), \
+  rm -f $@.boot
+  mkfs.fat -C $@.boot $(FAT32_BLOCKS)
+
+  mcopy -i $@.boot \
+	$(KDIR)/$(DEVICE_NAME)-fit-zImage.itb \
+	::$(DEVICE_NAME)-fit.itb
+
+  mcopy -i $@.boot \
+	$(BIN_DIR)/u-boot-$(DEVICE_DTS:at91-%=%)_mmc1/u-boot.bin \
+	::u-boot.bin
+
+  mcopy -i $@.boot \
+	$(BIN_DIR)/at91bootstrap-$(DEVICE_DTS:at91-%=%)sd_uboot/at91bootstrap.bin \
+	::BOOT.bin
+
+  $(CP) uboot-env.txt $@-uboot-env.txt
+  sed -i '2d;3d' $@-uboot-env.txt
+  sed -i '2i board='"$(DEVICE_NAME)"'' $@-uboot-env.txt
+  sed -i '3i board_name='"$(firstword $(SUPPORTED_DEVICES))"'' $@-uboot-env.txt
+
+  mkenvimage -s 0x4000 -o $@-uboot.env $@-uboot-env.txt
+
+  mcopy -i $@.boot $@-uboot.env ::uboot.env
+
+  ./gen_at91_sdcard_img.sh \
+	$@.img \
+	$@.boot \
+	$(KDIR)/root.ext4 \
+	$(AT91_SD_BOOT_PARTSIZE) \
+	$(CONFIG_TARGET_ROOTFS_PARTSIZE)
+
+  gzip -nc9 $@.img > $@
+
+  rm -f $@.img $@.boot $@-uboot.env $@-uboot-env.txt)
+endef
+
+define Device/microchip_sama7g5-ek
+  $(Device/evaluation-dtb)
+  DEVICE_VENDOR := Microchip
+  DEVICE_MODEL := SAMA7G5-EK
+  DEVICE_DTS := at91-sama7g5ek
+  SUPPORTED_DEVICES := microchip,sama7g5ek
+  KERNEL_SIZE := 6144k
+  KERNEL_LOADADDR := 0x62000000
+  $(Device/evaluation-sdimage)
+endef
+TARGET_DEVICES += microchip_sama7g5-ek
diff --git a/target/linux/at91/image/uboot-env.txt b/target/linux/at91/image/uboot-env.txt
index 9cdccc9a2f1f..14f983d03920 100644
--- a/target/linux/at91/image/uboot-env.txt
+++ b/target/linux/at91/image/uboot-env.txt
@@ -4,10 +4,11 @@ board_name=atmel,at91sam9x25ek
 bootargs=console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4
 bootargsd2=console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait rootfstype=ext4
 bootargsxx=console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4
-bootcmd=run setbootargs; run fatload_mmc; bootm 0x21000000
+bootcmd=run setloadaddr; run setbootargs; run fatload_mmc; bootm ${loadaddr}
 bootdelay=1
-fatload_mmc=if test ${board_name} = atmel,sama5d2-xplained || test ${board_name} = atmel,sama5d27-som1-ek; then fatload mmc 1:1 0x21000000 ${board}-fit.itb; else fatload mmc 0:1 0x21000000 ${board}-fit.itb; fi
-setbootargs=if test ${board_name} = atmel,sama5d2-xplained || test ${board_name} = atmel,sama5d27-som1-ek; then setenv bootargs ${bootargsd2}; else setenv bootargs ${bootargsxx}; fi
+fatload_mmc=if test ${board_name} = atmel,sama5d2-xplained || test ${board_name} = atmel,sama5d27-som1-ek || test ${board_name} = microchip,sama7g5ek; then fatload mmc 1:1 ${loadaddr} ${board}-fit.itb; else fatload mmc 0:1 ${loadaddr} ${board}-fit.itb; fi
+setbootargs=if test ${board_name} = atmel,sama5d2-xplained || test ${board_name} = atmel,sama5d27-som1-ek || test ${board_name} = microchip,sama7g5ek; then setenv bootargs ${bootargsd2}; else setenv bootargs ${bootargsxx}; fi
+setloadaddr=if test ${board_name} = microchip,sama7g5ek; then setenv loadaddr 0x63000000; else setenv loadaddr 0x21000000; fi
 ethact=gmac0
 stderr=serial
 stdin=serial
-- 
2.33.0




More information about the openwrt-devel mailing list