Skip to contentSkip to conversation

xilinx-bsp: handle more xilinx targets

PATCH NAK Adrian Alonso 2 participants 2 messages Jul 30, 2010 – Jul 31, 2010 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/10 xilinx-bsp: handle more xilinx targets

* Rewrite for handling most xilinx platforms
* Add helper functions for configuring the target board
* User must add in local.conf:
TARGET_ARCH = "powerpc" | "microblaze"
XILINX_BOARD = "ml401" | "ml403" | "ml410" | "ml507" | "ml510" whit this varibales u-boot and the linux kernel gets configured for a selected board.

---
 classes/xilinx-bsp.bbclass |  109 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 87 insertions(+), 22 deletions(-)
classes/xilinx-bsp.bbclass +87 -22
index d32c60e..35f7108 100644
@@ -14,6 +14,47 @@
 #Xilinx ML403
 #Xilinx ML507
 #More to come soon ;)
+#oenote "ML403 board setup"
+# Treat this as legacy substitution find when xparatemer was deprecated in favor of dts
+#cp -pPR ${XILINX_BSP_PATH}/ppc405_0/libsrc/linux_2_6_v1_00_a/linux/arch/ppc/platforms/4xx/xparameters/xparameters_ml40x.h \
+#${S}/arch/ppc/platforms/4xx/xparameters/xparameters_ml403.h
+
+def map_target(a, d):
+	import re
+	board = bb.data.getVar('XILINX_BOARD', d, 1)
+
+	if re.match('powerpc', a):
+		cpu = bb.data.getVar('TARGET_CPU', d, 1)
+		return 'ppc' + cpu + '-' + board
+	else:
+		return 'system'
+
+
+def uboot_machine(a, d):
+	import re
+
+	board = bb.data.getVar('XILINX_BOARD', d, 1)
+
+	if board in ['ml300', 'ml401', 'ml405', 'ml507']:
+		return board + '_config'
+	elif re.match('powerpc', a):
+		return 'xilinx-ppc' + bb.data.getVar('TARGET_CPU', d, 1) + '-generic_config'
+	else:
+		return 'microblaze-generic_config'
+
+def uboot_target(a, d):
+	import re
+
+	board = bb.data.getVar('XILINX_BOARD', d, 1)
+	target = bb.data.getVar('TARGET_CPU', d, 1) + '-generic'
+
+	if board in ['ml300', 'ml401', 'ml405', 'ml507']:
+		return board
+	elif re.match('powerpc', a):
+		return 'ppc' + target
+	else:
+		return target
+
 
 do_configure_prepend() {
 
@@ -21,27 +62,47 @@ do_configure_prepend() {
 #now depending on the board type and arch do what is nessesary
 
 if [ -n "${XILINX_BSP_PATH}" ]; then
-	case "${XILINX_BOARD}" in
-		ml403 | ML403)
-			oenote "ML403 board setup"
-			cp -pPR ${XILINX_BSP_PATH}/ppc405_0/libsrc/linux_2_6_v1_00_a/linux/arch/ppc/platforms/4xx/xparameters/xparameters_ml40x.h \
-                ${S}/arch/ppc/platforms/4xx/xparameters/xparameters_ml403.h
-		;;
-		ml507 | ML507)
-			oenote "Xilinx ML507 board setup"
+	if [ -n "${XILINX_BOARD}" ]; then
+		if [ -d "${S}/arch/${TARGET_ARCH}/boot" ]; then
 			dts=`find "${XILINX_BSP_PATH}" -name *.dts -print`
-			if [ -n "$dts" ]; then
-				oenote "Replacing device tree with ${dts}"
-				cp -pP ${dts} ${S}/arch/powerpc/boot/dts/virtex440-ml507.dts
+			if [ -e "$dts" ]; then
+				oenote "Replacing device tree to match hardware model"
+				if [ "${TARGET_ARCH}" == "powerpc" ]; then
+					cp -pP ${dts} ${S}/arch/powerpc/boot/dts/virtex${TARGET_BOARD}.dts
+				else
+					cp -pP ${dts} ${S}/arch/microblaze/platform/generic/${TARGET_BOARD}.dts
+				fi
 			else
-				oenote "Device tree not found in project dir"
+				oefatal "No device tree found, missing hardware ref design?"
+				exit 1
 			fi
-		;;
-		*)
-			oefatal "! Unknow Xilinx board ! Exit ..."
-			exit 1
-		;;
-	esac
+		elif [ -d "${S}/board/xilinx" ]; then
+			oenote "Replacing xparameters header to match hardware model"
+			#xparam=`find "${XILINX_BSP_PATH}" -name xparameters.h -print`
+			if [ "${TARGET_ARCH}" == "powerpc" ]; then
+				xparam="${XILINX_BSP_PATH}/ppc${TARGET_CPU}_0/include/xparameters.h"
+				cpu="PPC`echo ${TARGET_CPU} | tr '[:lower:]' '[:upper:]'`"
+			else
+				xparam="${XILINX_BSP_PATH}/${TARGET_CPU}_0/include/xparameters.h"
+				cpu=`echo ${TARGET_CPU} | tr '[:lower:]' '[:upper:]'`
+			fi
+			if [ -e "$xparam" ]; then
+				cp ${xparam} ${S}/board/xilinx/${UBOOT_TARGET}
+				echo "/*** Cannonical definitions ***/
+#define XPAR_PLB_CLOCK_FREQ_HZ XPAR_PROC_BUS_0_FREQ_HZ
+#define XPAR_CORE_CLOCK_FREQ_HZ XPAR_CPU_${cpu}_CORE_CLOCK_FREQ_HZ
+#ifndef XPAR_DDR2_SDRAM_MEM_BASEADDR
+# define XPAR_DDR2_SDRAM_MEM_BASEADDR XPAR_DDR_SDRAM_MPMC_BASEADDR
+#endif
+#define XPAR_PCI_0_CLOCK_FREQ_HZ    0" >> ${S}/board/xilinx/${UBOOT_TARGET}/xparameters.h
+			else
+				oefatal "No xparameters header file found, missing hardware ref design?"
+			fi
+		fi
+	else
+		oefatal "XILINX_BOARD not defined ! Exit"
+		exit 1
+	fi
 else
 	oefatal "XILINX_BSP_PATH not defined ! Exit"
 	exit 1
@@ -49,7 +110,11 @@ fi
 
 }
 
-
-
-
-
+do_deploy_prepend() {
+# Install u-boot elf image
+if [ -d "${XILINX_BSP_PATH}" ]; then
+	if [ -e "${S}/u-boot" ]; then
+		install ${S}/u-boot ${XILINX_BSP_PATH}
+	fi
+fi
+}
Signature · 1 line
1.7.2
#1 lore raw

Dear Adrian,

somehow your MUA is broken. It is setting the following lines in the mail header, which in my opinion is wrong for “thread starting” message.

In-Reply-To: <[email protected]>
References: <[email protected]>

I checked with other patches sent to the list list and they do not do this as far as I can see.

Am Freitag, den 30.07.2010, 10:42 -0500 schrieb Adrian Alonso:

I think the preferred subject line is.

xilinx-bsp.bbclass: Rewrite to handle xilinx »enter new models«

Quoted 6 lines

* Rewrite for handling most xilinx platforms
* Add helper functions for configuring the target board
* User must add in local.conf:
TARGET_ARCH = "powerpc" | "microblaze"
XILINX_BOARD = "ml401" | "ml403" | "ml410" | "ml507" | "ml510" whit this varibales u-boot and the linux kernel gets configured

s/whit/with/
s/varibales/variables/

Quoted 12 lines

for a selected board.

---
 classes/xilinx-bsp.bbclass |  109 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 87 insertions(+), 22 deletions(-)
classes/xilinx-bsp.bbclass +0 -0
index d32c60e..35f7108 100644

classes/xilinx-bsp.bbclass line 20

Quoted 7 lines
classes/xilinx-bsp.bbclass +4 -0
@@ -14,6 +14,47 @@
 #Xilinx ML403
 #Xilinx ML507
 #More to come soon ;)
+#oenote "ML403 board setup"
+# Treat this as legacy substitution find when xparatemer was deprecated in favor of dts
+#cp -pPR ${XILINX_BSP_PATH}/ppc405_0/libsrc/linux_2_6_v1_00_a/linux/arch/ppc/platforms/4xx/xparameters/xparameters_ml40x.h \
+#${S}/arch/ppc/platforms/4xx/xparameters/xparameters_ml403.h

Is the commented stuff needed?

Quoted 49 lines
classes/xilinx-bsp.bbclass +36 -6
+def map_target(a, d):
+	import re
+	board = bb.data.getVar('XILINX_BOARD', d, 1)
+
+	if re.match('powerpc', a):
+		cpu = bb.data.getVar('TARGET_CPU', d, 1)
+		return 'ppc' + cpu + '-' + board
+	else:
+		return 'system'
+
+
+def uboot_machine(a, d):
+	import re
+
+	board = bb.data.getVar('XILINX_BOARD', d, 1)
+
+	if board in ['ml300', 'ml401', 'ml405', 'ml507']:
+		return board + '_config'
+	elif re.match('powerpc', a):
+		return 'xilinx-ppc' + bb.data.getVar('TARGET_CPU', d, 1) + '-generic_config'
+	else:
+		return 'microblaze-generic_config'
+
+def uboot_target(a, d):
+	import re
+
+	board = bb.data.getVar('XILINX_BOARD', d, 1)
+	target = bb.data.getVar('TARGET_CPU', d, 1) + '-generic'
+
+	if board in ['ml300', 'ml401', 'ml405', 'ml507']:
+		return board
+	elif re.match('powerpc', a):
+		return 'ppc' + target
+	else:
+		return target
+
 
 do_configure_prepend() {
 
@@ -21,27 +62,47 @@ do_configure_prepend() {
 #now depending on the board type and arch do what is nessesary
 
 if [ -n "${XILINX_BSP_PATH}" ]; then
-	case "${XILINX_BOARD}" in
-		ml403 | ML403)
-			oenote "ML403 board setup"
-			cp -pPR ${XILINX_BSP_PATH}/ppc405_0/libsrc/linux_2_6_v1_00_a/linux/arch/ppc/platforms/4xx/xparameters/xparameters_ml40x.h \
-                ${S}/arch/ppc/platforms/4xx/xparameters/xparameters_ml403.h
-		;;

classes/xilinx-bsp.bbclass do_configure_prepend() { · line 69

Quoted 10 lines
classes/xilinx-bsp.bbclass +4 -5
-		ml507 | ML507)
-			oenote "Xilinx ML507 board setup"
+	if [ -n "${XILINX_BOARD}" ]; then
+		if [ -d "${S}/arch/${TARGET_ARCH}/boot" ]; then
 			dts=`find "${XILINX_BSP_PATH}" -name *.dts -print`
-			if [ -n "$dts" ]; then
-				oenote "Replacing device tree with ${dts}"
-				cp -pP ${dts} ${S}/arch/powerpc/boot/dts/virtex440-ml507.dts
+			if [ -e "$dts" ]; then
+				oenote "Replacing device tree to match hardware model"

If you care, you could add full stops at the end of sentences.

Quoted 9 lines
classes/xilinx-bsp.bbclass +7 -1
+				if [ "${TARGET_ARCH}" == "powerpc" ]; then
+					cp -pP ${dts} ${S}/arch/powerpc/boot/dts/virtex${TARGET_BOARD}.dts
+				else
+					cp -pP ${dts} ${S}/arch/microblaze/platform/generic/${TARGET_BOARD}.dts
+				fi
 			else
-				oenote "Device tree not found in project dir"
+				oefatal "No device tree found, missing hardware ref design?"
+				exit 1

classes/xilinx-bsp.bbclass do_configure_prepend() { · line 81

Quoted 10 lines
classes/xilinx-bsp.bbclass +3 -6
 			fi
-		;;
-		*)
-			oefatal "! Unknow Xilinx board ! Exit ..."
-			exit 1
-		;;
-	esac
+		elif [ -d "${S}/board/xilinx" ]; then
+			oenote "Replacing xparameters header to match hardware model"
+			#xparam=`find "${XILINX_BSP_PATH}" -name xparameters.h -print`

Can this commented line be removed?

Quoted 33 lines
classes/xilinx-bsp.bbclass +24 -2
+			if [ "${TARGET_ARCH}" == "powerpc" ]; then
+				xparam="${XILINX_BSP_PATH}/ppc${TARGET_CPU}_0/include/xparameters.h"
+				cpu="PPC`echo ${TARGET_CPU} | tr '[:lower:]' '[:upper:]'`"
+			else
+				xparam="${XILINX_BSP_PATH}/${TARGET_CPU}_0/include/xparameters.h"
+				cpu=`echo ${TARGET_CPU} | tr '[:lower:]' '[:upper:]'`
+			fi
+			if [ -e "$xparam" ]; then
+				cp ${xparam} ${S}/board/xilinx/${UBOOT_TARGET}
+				echo "/*** Cannonical definitions ***/
+#define XPAR_PLB_CLOCK_FREQ_HZ XPAR_PROC_BUS_0_FREQ_HZ
+#define XPAR_CORE_CLOCK_FREQ_HZ XPAR_CPU_${cpu}_CORE_CLOCK_FREQ_HZ
+#ifndef XPAR_DDR2_SDRAM_MEM_BASEADDR
+# define XPAR_DDR2_SDRAM_MEM_BASEADDR XPAR_DDR_SDRAM_MPMC_BASEADDR
+#endif
+#define XPAR_PCI_0_CLOCK_FREQ_HZ    0" >> ${S}/board/xilinx/${UBOOT_TARGET}/xparameters.h
+			else
+				oefatal "No xparameters header file found, missing hardware ref design?"
+			fi
+		fi
+	else
+		oefatal "XILINX_BOARD not defined ! Exit"
+		exit 1
+	fi
 else
 	oefatal "XILINX_BSP_PATH not defined ! Exit"
 	exit 1
@@ -49,7 +110,11 @@ fi
 
 }
 
-
-

classes/xilinx-bsp.bbclass fi · line 120

Quoted 10 lines
classes/xilinx-bsp.bbclass +8 -2
-
-
+do_deploy_prepend() {
+# Install u-boot elf image
+if [ -d "${XILINX_BSP_PATH}" ]; then
+	if [ -e "${S}/u-boot" ]; then
+		install ${S}/u-boot ${XILINX_BSP_PATH}
+	fi
+fi
+}

Thanks,

Paul