summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSteffen Trumtrar <s.trumtrar@pengutronix.de>2017-04-28 16:41:41 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-05-03 13:51:22 +0200
commitd5c8bc3ff1a795cb9ef44abd518f5dae6f9000fa (patch)
treea3dbd48b1feef91687bd75e9227870debbbbf9cb /scripts
parentdb3feb61d19060a0589f3906a8a081bebd934ace (diff)
downloadbarebox-d5c8bc3ff1a795cb9ef44abd518f5dae6f9000fa.tar.gz
barebox-d5c8bc3ff1a795cb9ef44abd518f5dae6f9000fa.tar.xz
ARM: socfpga: add arria10 support
Arria10 is a SoC + FPGA like the Cyclone5 SoCFPGA that is already supported in barebox. Both a the same in some parts, but totaly different in others. Most of the hardware blocks are the same in the SoC parts. The OCRAM is larger on the Arria10 and the SDRAM controller is different. The serial core only supports 32bit accesses (different to the 8bit accesses on the Cyclone5). As Arria10 has 256KB of OCRAM, it is possible to fit a larger barebox (and/or use PBL) instead of the two stage bootprocess used on the Cyclone5 and its 64KB OCRAM. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/socfpga_xml_to_config.sh117
1 files changed, 117 insertions, 0 deletions
diff --git a/scripts/socfpga_xml_to_config.sh b/scripts/socfpga_xml_to_config.sh
new file mode 100755
index 0000000000..7e22ebb9e8
--- /dev/null
+++ b/scripts/socfpga_xml_to_config.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+## TODO:
+## - read in mpuclk and nocclk, must be calculated by hand at the moment
+## - read in cfg_dedicated_io_*, must be calculated by hand at the moment
+
+if [ "$#" -lt "2" ]
+then
+ echo "USAGE: $0 <boarddir> <HPS.xml>"
+ exit 1
+fi
+
+dir=$1
+xml=$2
+
+pll_config() {
+ local src
+ local tgt
+ src=$1
+ tgt=$2
+
+ MAINPLL=`grep mainpll "$src" | \
+ sed -e 's/^.*mainpllgrp\.//g' | \
+ sed -e 's/\./_/g' | \
+ sed -e "s/' value/ /g" | \
+ sed -e "s/'/ /g" | \
+ sed -e "s# />#,#g" | \
+ sed -e "s/^/\t./g" |
+ sort`
+
+ # FIXME: Find solution
+ MAINPLL_FIXME=".mpuclk = FIXME,
+ .nocclk = FIXME,"
+
+ PERPLL=`grep perpll "$src" | \
+ sed -e 's/^.*perpllgrp\.//g' | \
+ sed -e 's/\./_/g' | \
+ sed -e "s/' value/ /g" | \
+ sed -e "s/'/ /g" | \
+ sed -e "s# />#,#g" | \
+ sed -e "s/^/\t./g" |
+ sort`
+
+ echo "#include <mach/arria10-clock-manager.h>" > $tgt
+ echo >> $tgt
+ echo "static struct arria10_mainpll_cfg mainpll_cfg = {" >> $tgt
+ echo "$MAINPLL" >> $tgt
+ echo "$MAINPLL_FIXME" >> $tgt
+ echo "};" >> $tgt
+ echo >> $tgt
+ echo "static struct arria10_perpll_cfg perpll_cfg = {" >> $tgt
+ echo "$PERPLL" >> $tgt
+ echo "};" >> $tgt
+
+ dos2unix $tgt
+}
+
+pinmux_config() {
+ local src
+ local tgt
+ src=$1
+ tgt=$2
+
+ SHARED=`grep pinmux_shared "$src" | \
+ sed -e 's/^.*pinmux_/[arria10_pinmux_/g' | \
+ sed -e "s/\.sel' value='/] = /g" | \
+ sed -e "s/' \/>/,/g"`
+
+ DEDICATED=`grep pinmux_dedicated "$src" | \
+ sed -e 's/^.*pinmux_/[arria10_pinmux_/g' | \
+ sed -e "s/\.sel' value='/] = /g" | \
+ sed -e "s/' \/>/,/g"`
+
+ # FIXME: Either find solution how to parse these values too or replace
+ # script with something that goes more in the direction of a programming
+ # language
+ DEDICATED_FIXME="[arria10_pincfg_dedicated_io_bank] = FIXME,
+ [arria10_pincfg_dedicated_io_1] = FIXME,
+ [arria10_pincfg_dedicated_io_2] = FIXME,
+ [arria10_pincfg_dedicated_io_3] = FIXME,
+ [arria10_pincfg_dedicated_io_4] = FIXME,
+ [arria10_pincfg_dedicated_io_5] = FIXME,
+ [arria10_pincfg_dedicated_io_6] = FIXME,
+ [arria10_pincfg_dedicated_io_7] = FIXME,
+ [arria10_pincfg_dedicated_io_8] = FIXME,
+ [arria10_pincfg_dedicated_io_9] = FIXME,
+ [arria10_pincfg_dedicated_io_10] = FIXME,
+ [arria10_pincfg_dedicated_io_11] = FIXME,
+ [arria10_pincfg_dedicated_io_12] = FIXME,
+ [arria10_pincfg_dedicated_io_13] = FIXME,
+ [arria10_pincfg_dedicated_io_14] = FIXME,
+ [arria10_pincfg_dedicated_io_15] = FIXME,
+ [arria10_pincfg_dedicated_io_16] = FIXME,
+ [arria10_pincfg_dedicated_io_17] = FIXME"
+
+ FPGA=`grep _fpga_interface_grp "$src" | \
+ grep -v -e usb -e pll_clock_out | \
+ sed -e 's/^.*pinmux_/[arria10_pinmux_/g' | \
+ sed -e "s/\.sel' value='/] = /g" | \
+ sed -e "s/' \/>/,/g"`
+
+ echo "#include <mach/arria10-pinmux.h>" > $tgt
+ echo >> $tgt
+ echo "static uint32_t pinmux[] = {" >> $tgt
+ echo "$SHARED" >> $tgt
+ echo "$DEDICATED" >> $tgt
+ echo "$DEDICATED_FIXME" >> $tgt
+ echo "$FPGA" >> $tgt
+ echo "};" >> $tgt
+ echo >> $tgt
+
+ dos2unix $tgt
+}
+
+pll_config $xml $dir/pll-config-arria10.c
+
+pinmux_config $xml $dir/pinmux-config-arria10.c