Openembedded Devel Discussions
 help / color / mirror / Atom feed
From: Adrian Alonso <aalonso00@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: [PATCH 6/9] xilinx-bsp: handle more xilinx targets
Date: Mon, 12 Jul 2010 14:45:47 -0500	[thread overview]
Message-ID: <1278963950-2587-6-git-send-email-aalonso00@gmail.com> (raw)
In-Reply-To: <1278963950-2587-1-git-send-email-aalonso00@gmail.com>

* 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.

Signed-off-by: Adrian Alonso <aalonso00@gmail.com>
---
 classes/xilinx-bsp.bbclass |  109 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 87 insertions(+), 22 deletions(-)

diff --git a/classes/xilinx-bsp.bbclass b/classes/xilinx-bsp.bbclass
index d32c60e..77e7faa 100644
--- a/classes/xilinx-bsp.bbclass
+++ b/classes/xilinx-bsp.bbclass
@@ -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
+				oefatal "No device tree found, missing hardware ref design?"
+				exit 1
+			fi
+		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
-				oenote "Device tree not found in project dir"
+				oefatal "No xparameters header file found, missing hardware ref design?"
 			fi
-		;;
-		*)
-			oefatal "! Unknow Xilinx board ! Exit ..."
-			exit 1
-		;;
-	esac
+		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
+}
-- 
1.7.1.1




  parent reply	other threads:[~2010-07-12 19:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12 19:45 [PATCH 1/9] xilinx-virtex4: new file Adrian Alonso
2010-07-12 19:45 ` [PATCH 2/9] xilinx-virtex5: " Adrian Alonso
2010-07-13  6:11   ` Frans Meulenbroeks
2010-07-12 19:45 ` [PATCH 3/9] linux-xilinx: new files Adrian Alonso
2010-07-13  6:12   ` Frans Meulenbroeks
2010-07-14 21:07     ` Frans Meulenbroeks
2010-07-14 21:19       ` Adrian Alonso
2010-07-16 16:45         ` Adrian Alonso
2010-07-12 19:45 ` [PATCH 4/9] xilinx-linux: new kernel recipe Adrian Alonso
2010-07-13  6:10   ` Frans Meulenbroeks
2010-07-12 19:45 ` [PATCH 5/9] u-boot-xilinx: new file Adrian Alonso
2010-07-12 19:45 ` Adrian Alonso [this message]
2010-07-12 19:45 ` [PATCH 7/9] xserver-kdrive-common: xilinx virtex5 support Adrian Alonso
2010-07-14 21:12   ` Frans Meulenbroeks
2010-07-15  7:08   ` Marcin Juszkiewicz
2010-07-16 15:30     ` Adrian Alonso
2010-07-12 19:45 ` [PATCH 8/9] xorg-xserver-conf: virtex5 machine support Adrian Alonso
2010-07-12 19:45 ` [PATCH 9/9] glibc: fix LD_LIBRARY_PATH Adrian Alonso
2010-07-14 21:08   ` Frans Meulenbroeks
2010-07-13  6:01 ` [PATCH 1/9] xilinx-virtex4: new file Frans Meulenbroeks
2010-07-13 16:00   ` Adrian Alonso
2010-07-13 20:46     ` Frans Meulenbroeks
2010-07-13 22:52       ` Adrian Alonso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1278963950-2587-6-git-send-email-aalonso00@gmail.com \
    --to=aalonso00@gmail.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox