summaryrefslogtreecommitdiff
path: root/board/xilinx/ml300/sw_services
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-02-23 23:54:43 +0000
committerwdenk <wdenk>2004-02-23 23:54:43 +0000
commit028ab6b598b628326116acd88e0f35aa9f526d12 (patch)
tree0d54315bd92d713a405004b6e36fca8d2b7c53e3 /board/xilinx/ml300/sw_services
parent63e73c9a8ed5b32d9c4067ffaad953e9a8fe8f0a (diff)
downloadu-boot-imx-028ab6b598b628326116acd88e0f35aa9f526d12.zip
u-boot-imx-028ab6b598b628326116acd88e0f35aa9f526d12.tar.gz
u-boot-imx-028ab6b598b628326116acd88e0f35aa9f526d12.tar.bz2
* Patch by Peter Ryser, 20 Feb 2004:
Add support for the Xilinx ML300 platform * Patch by Stephan Linz, 17 Feb 2004: Fix watchdog support for NIOS * Patch by Josh Fryman, 16 Feb 2004: Fix byte-swapping for cfi_flash.c for different bus widths * Patch by Jon Diekema, 14 Jeb 2004: Remove duplicate "FPGA Support" notes from the README file
Diffstat (limited to 'board/xilinx/ml300/sw_services')
-rw-r--r--board/xilinx/ml300/sw_services/uboot_v1_00_a/data/Ltypes41
-rw-r--r--board/xilinx/ml300/sw_services/uboot_v1_00_a/data/uboot_v2_1_0.mld48
-rw-r--r--board/xilinx/ml300/sw_services/uboot_v1_00_a/data/uboot_v2_1_0.tcl298
3 files changed, 387 insertions, 0 deletions
diff --git a/board/xilinx/ml300/sw_services/uboot_v1_00_a/data/Ltypes b/board/xilinx/ml300/sw_services/uboot_v1_00_a/data/Ltypes
new file mode 100644
index 0000000..319b925
--- /dev/null
+++ b/board/xilinx/ml300/sw_services/uboot_v1_00_a/data/Ltypes
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+if[$
+# -ne 1 ]
+ then echo "usage: Ltypes filename" > &2 exit 2 fi FILE = "$1"
+#TMPFILE='mktemp "${FILE}.XXXXXX"' || exit 1
+ TMPFILE = $ {
+ FILE}
+
+ . ` date "+%s" ` touch $TMPFILE || exit 1
+# Change all the Xilinx types to Linux types and put the result into a temp file
+ sed
+ - e 's/\bXTRUE\b/TRUE/g'
+ - e 's/\bXFALSE\b/FALSE/g'
+ - e 's/\bXNULL\b/NULL/g'
+ - e 's/<asm/delay.h>/<asm\/delay.h>/g'
+ - e 's/\bXENV_USLEEP\b/udelay/g'
+ - e 's/\bXuint8\b/u8/g'
+ - e 's/\bXuint16\b/u16/g'
+ - e 's/\bXuint32\b/u32/g'
+ - e 's/\bXint8\b/s8/g'
+ - e 's/\bXint16\b/s16/g'
+ - e 's/\bXint32\b/s32/g' - e 's/\bXboolean\b/u32/g' "${FILE}" > "${TMPFILE}"
+# Overlay the original file with the temp file
+ mv "${TMPFILE}" "${FILE}"
+# Are we doing xbasic_types.h?
+ if["${FILE##*/}" = xbasic_types.h]
+ then
+# Remember as you're reading this that we've already gone through the prior
+# sed script. We need to do some other things to xbasic_types.h:
+# 1) Add ifndefs around TRUE and FALSE defines
+# 2) Remove definition of NULL as NULL
+# 3) Replace most of the primitive types section with a #include
+ sed - e '/u32 true/,/#define false/Ic\
+#ifndef TRUE\
+#define TRUE 1\
+#endif\
+#ifndef FALSE\
+#define FALSE 0\
+#endif' - e '/#define[[:space:]][[:space:]]*NULL[[:space:]][[:space:]]*NULL/d' - e '/typedef[[:space:]][[:space:]]*unsigned[[:space:]][[:space:]]*char[[:space:]][[:space:]]*u8/,/typedef[[:space:]][[:space:]]*unsigned[[:space:]][[:space:]]*long[[:space:]][[:space:]]*u32.*boolean/c\
+#include <linux/types.h>' "${FILE}" > "${TMPFILE}" mv "${TMPFILE}" "${FILE}" fi
diff --git a/board/xilinx/ml300/sw_services/uboot_v1_00_a/data/uboot_v2_1_0.mld b/board/xilinx/ml300/sw_services/uboot_v1_00_a/data/uboot_v2_1_0.mld
new file mode 100644
index 0000000..e1aa7fd
--- /dev/null
+++ b/board/xilinx/ml300/sw_services/uboot_v1_00_a/data/uboot_v2_1_0.mld
@@ -0,0 +1,48 @@
+# (c) Copyright 2004 Xilinx Inc.
+# Author: Xilinx, Inc.
+#
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+#
+# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
+# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
+# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
+# XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
+# FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING
+# ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
+# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
+# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
+# WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
+# CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
+# FITNESS FOR A PARTICULAR PURPOSE.
+#
+#
+# Xilinx hardware products are not intended for use in life support
+# appliances, devices, or systems. Use in such applications is
+# expressly prohibited.
+#
+#
+# (c) Copyright 2002-2004 Xilinx Inc.
+# All rights reserved.
+#
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 675 Mass Ave, Cambridge, MA 02139, USA.
+
+OPTION psf_version = 2.1;
+
+BEGIN LIBRARY uboot OPTION DRC = uboot_drc;
+
+BEGIN ARRAY connected_periphs PROPERTY desc = "Peripherals connected to U-Boot";
+PROPERTY size = 0;
+PARAM name = periph_name, desc = "Name of Peripheral connected", type = string;
+END ARRAY
+ PARAMETER name = TARGET_DIR, desc =
+ "Target Directory for U-Boot BSP", type = string;
+
+END LIBRARY
diff --git a/board/xilinx/ml300/sw_services/uboot_v1_00_a/data/uboot_v2_1_0.tcl b/board/xilinx/ml300/sw_services/uboot_v1_00_a/data/uboot_v2_1_0.tcl
new file mode 100644
index 0000000..8d939b4
--- /dev/null
+++ b/board/xilinx/ml300/sw_services/uboot_v1_00_a/data/uboot_v2_1_0.tcl
@@ -0,0 +1,298 @@
+#
+# Author: Xilinx, Inc.
+#
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+#
+# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
+# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
+# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
+# XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
+# FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING
+# ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
+# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
+# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
+# WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
+# CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
+# FITNESS FOR A PARTICULAR PURPOSE.
+#
+#
+# Xilinx hardware products are not intended for use in life support
+# appliances, devices, or systems. Use in such applications is
+# expressly prohibited.
+#
+#
+# (c) Copyright 2002-2004 Xilinx Inc.
+# All rights reserved.
+#
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# Globals
+lappend drvlist
+set ltypes "../../../sw_services/uboot_v1_00_a/data/Ltypes"
+
+proc uboot_drc {lib_handle} {
+ puts "U-Boot DRC..."
+}
+
+proc generate {libname} {
+
+ global drvlist
+
+ # Get list of peripherals connected to uboot
+ set conn_periphs [xget_handle $libname "ARRAY" "connected_periphs"]
+ #lappend drvlist
+ if {[string compare -nocase $conn_periphs ""] != 0} {
+ set conn_periphs_elems [xget_handle $conn_periphs "ELEMENTS" "*"]
+ # For each periph
+ foreach periph_elem $conn_periphs_elems {
+ set periph [xget_value $periph_elem "PARAMETER" "periph_name"]
+ # 1. Get driver
+ set drv [xget_swhandle $periph]
+ set posn [lsearch -exact $drvlist $drv]
+ if {$posn == -1} {
+ lappend drvlist $drv
+ }
+ }
+
+ set file_handle [xopen_include_file "xparameters.h"]
+ puts $file_handle "\n/******************************************************************/\n"
+ puts $file_handle "/* U-Boot Redefines */"
+ puts $file_handle "\n/******************************************************************/\n"
+ close $file_handle
+
+ foreach drv $drvlist {
+ set drvname [xget_value $drv "NAME"]
+
+ #Redefines xparameters.h
+ if {[string compare -nocase $drvname "uartns550"] == 0} {
+ xredefine_uartns550 $drv "xparameters.h"
+ } elseif {[string compare -nocase $drvname "emac"] == 0} {
+ xredefine_emac $drv "xparameters.h"
+ }
+ }
+ }
+
+ # define core_clock
+ xredefine_params $libname "xparameters.h" "CORE_CLOCK_FREQ_HZ"
+}
+
+proc xget_corefreq {} {
+ set processor [xget_processor]
+ set name [xget_value $processor "NAME"]
+ puts "procname : $name"
+ set processor_driver [xget_swhandle [xget_value $processor "NAME"]]
+ puts "procdrv : $processor_driver"
+ if {[string compare -nocase $processor_driver ""] != 0} {
+ set arg "CORE_CLOCK_FREQ_HZ"
+ #set retval [xget_value $processor_driver "PARAMETER" $arg]
+ set retval [xget_dname [xget_value $processor_driver "NAME"] $arg]
+ return $retval
+ }
+}
+
+# procedure that adds # defines to xparameters.h as XPAR_argument
+proc xredefine_params {handle file_name args} {
+
+ puts "xredfine ..."
+ # Open include file
+ set file_handle [xopen_include_file $file_name]
+ puts "args : $args"
+
+ foreach arg $args {
+ if {[string compare -nocase $arg "CORE_CLOCK_FREQ_HZ"] == 0} {
+ set value [xget_corefreq]
+ puts "corefreq : $value"
+ } else {
+ set value [xget_value $handle "PARAMETER" $arg]
+ puts "value : $value"
+ }
+
+ if {$value != ""} {
+ set value [xformat_addr_string $value $arg]
+ set name [string toupper $arg]
+ set name [format "XPAR_%s" $name]
+ puts $file_handle "#define $name $value"
+ }
+ }
+
+ puts $file_handle "\n/******************************************************************/\n"
+ close $file_handle
+}
+
+# uart redefines...
+proc xredefine_uartns550 {drvhandle file_name} {
+
+ xredefine_include_file $drvhandle $file_name "uartns550" "C_BASEADDR" "C_HIGHADDR" "CLOCK_HZ" "DEVICE_ID"
+
+}
+
+proc xredefine_emac {drvhandle file_name} {
+
+ xredefine_include_file $drvhandle $file_name "emac" "C_BASEADDR" "C_HIGHADDR" "C_DMA_PRESENT" "C_MII_EXIST" "C_ERR_COUNT_EXIST" "DEVICE_ID"
+
+}
+
+#######################
+
+proc xredefine_include_file {drv_handle file_name drv_string args} {
+
+ # Open include file
+ set file_handle [xopen_include_file $file_name]
+
+ # Get all peripherals connected to this driver
+ set periphs [xget_periphs $drv_handle]
+
+ set pname [format "XPAR_%s_" [string toupper $drv_string]]
+
+ # Print all parameters for all peripherals
+ set device_id 0
+ set sub_periphs 1
+ foreach periph $periphs {
+ puts "$periph : $drv_string : $sub_periphs"
+
+ for {set i 0} {$i < $sub_periphs} {incr i} {
+ foreach arg $args {
+ set name "${pname}${device_id}_"
+
+ if {[string compare -nocase "CLOCK_HZ" $arg] == 0} {
+ set xdrv_string [format "%s%s" "X" $drv_string]
+ set value [xget_dname $xdrv_string $arg]
+ set name "${name}CLOCK_FREQ_HZ"
+ } else {
+ if {[string match C_* $arg]} {
+ set name [format "%s%s" $name [string range $arg 2 end]]
+ } else {
+ set name "${name}${arg}"
+ }
+ set value [xget_name $periph $arg]
+ }
+
+ if {[string compare -nocase "uartns550" $drv_string] == 0} {
+ if {[string compare -nocase "C_BASEADDR" $arg] == 0} {
+ set value [format "(%s%s%s)" $value "+" "0x1000"]
+ }
+ }
+
+ puts $file_handle "#define $name $value"
+ if {[string compare -nocase "DEVICE_ID" $arg] == 0} {
+ incr device_id
+ }
+ }
+ }
+ }
+ puts $file_handle "\n/******************************************************************/\n"
+ close $file_handle
+}
+
+##################################################
+# procedure post_generate
+# This generates the drivers directory for uboot
+# and runs the ltypes script
+##################################################
+
+proc post_generate {lib_handle} {
+
+ global drvlist
+
+ # Create U-Boot tree structure
+ set pwd [pwd]
+ set common_dir "uboot/board/xilinx/common"
+ set xilinx_enet_dir "uboot/board/xilinx/xilinx_enet"
+ set ml300_dir "uboot/board/xilinx/ml300"
+
+ exec bash -c "mkdir -p $common_dir $xilinx_enet_dir $ml300_dir"
+
+ # Copy files for xilinx_ocp
+ xcopy_commonfiles
+
+ foreach drv $drvlist {
+ set drvname [xget_value $drv "NAME"]
+ set ver [xget_value $drv "PARAMETER" "DRIVER_VER"]
+ set ver [string map {. _} $ver]
+ set dirname [format "%s_v%s" $drvname $ver]
+
+ if {[string compare -nocase $drvname "emac"] == 0} {
+ xcopy_emac $drv $dirname
+ }
+ }
+
+ # Call Ltypes Script here
+ set uboot "uboot"
+ xltype_file $uboot
+
+ # Move xparameters.h around
+ exec bash -c "cp ../../include/xparameters.h $ml300_dir"
+
+ # copy the whole U-Boot BSP to its final destination
+ set value [xget_value $lib_handle "PARAMETER" TARGET_DIR]
+ puts "TARGET_DIR : $value"
+
+ if {$value != ""} {
+ if {[file isdirectory $value] == 0} {
+ exec bash -c "mkdir -p $value"
+ }
+ exec bash -c "cp -Rp uboot/* $value"
+ }
+}
+
+proc xcopy_commonfiles {} {
+
+ global drvlist
+
+ set common_dir "uboot/board/xilinx/common"
+
+ foreach drv $drvlist {
+ set depends [xget_value $drv "OPTION" "DEPENDS"]
+ foreach dep $depends {
+ puts "dep : $dep"
+ if {[file isdirectory "../$dep"] == 1} {
+ exec bash -c "cp -f ../$dep/src/*.c $common_dir"
+ exec bash -c "cp -f ../$dep/src/*.h $common_dir"
+ }
+ }
+ }
+
+}
+
+proc xcopy_emac {drv_handle dirname} {
+ set emac "board/xilinx/xilinx_enet"
+ xcopy_dir $dirname $emac
+}
+
+proc xcopy_dir {srcdir dstdir} {
+
+ set dstdirname [format "%s%s" "uboot/" $dstdir]
+ if {[file isdirectory "../$srcdir"] == 1} {
+ # Copy files from src to dst
+ exec bash -c "mkdir -p $dstdirname"
+ exec bash -c "cp -f ../$srcdir/src/*.c $dstdirname"
+ exec bash -c "cp -f ../$srcdir/src/*.h $dstdirname"
+ } else {
+ puts "$srcdir does not exist ..."
+ }
+}
+
+
+proc xltype_file {filename} {
+
+ global ltypes
+
+ puts $filename
+
+ if {[file isdirectory $filename]} {
+ foreach entry [glob -nocomplain [file join $filename *]] {
+ xltype_file $entry
+ }
+ } else {
+ exec bash -c "$ltypes $filename"
+ }
+
+}