summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-03-09 08:30:38 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-09 08:30:38 +0100
commit5544581e98d09c7c9008f9cac8cd25dbb6a14d6e (patch)
treef2b86a43e02a96a0d9d0630980fab8476d9bf3f4 /scripts
parent55ab01c7ff16e5fcb2d91870d0ab84399512ee3f (diff)
parent458480f0a8ad479d54262c94b3729d43c67b0fa4 (diff)
downloadbarebox-5544581e98d09c7c9008f9cac8cd25dbb6a14d6e.tar.gz
barebox-5544581e98d09c7c9008f9cac8cd25dbb6a14d6e.tar.xz
Merge branch 'for-next/socfpga'
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/misc/altera_sequencer.cocci93
-rwxr-xr-xscripts/socfpga_get_sequencer3
-rwxr-xr-xscripts/socfpga_import_preloader69
3 files changed, 165 insertions, 0 deletions
diff --git a/scripts/coccinelle/misc/altera_sequencer.cocci b/scripts/coccinelle/misc/altera_sequencer.cocci
new file mode 100644
index 0000000000..9fea239c0c
--- /dev/null
+++ b/scripts/coccinelle/misc/altera_sequencer.cocci
@@ -0,0 +1,93 @@
+@r_shadow@
+@@
+
+- ...curr_shadow_reg = 0;
+
+@r_out2_delay@
+type T;
+@@
+
+- T scc_mgr_apply_group_dq_out2_delay(...)
+- {
+- ...
+- }
+
+@r_oct_out2@
+type T;
+@@
+- T scc_mgr_apply_group_dqs_io_and_oct_out2(...)
+- {
+- ...
+- }
+
+@r_oct_out2_gradual@
+type T;
+@@
+
+- T scc_mgr_set_group_dqs_io_and_oct_out2_gradual(...)
+- {
+- ...
+- }
+
+@r_eye_diag@
+type T;
+@@
+
+- T rw_mgr_mem_calibrate_eye_diag_aid(...)
+- {
+- ...
+- }
+
+@r_full_test@
+type T;
+@@
+
+- T rw_mgr_mem_calibrate_full_test(...)
+- {
+- ...
+- }
+
+@r_user_init_cal_req@
+@@
+
+- static void user_init_cal_req (...)
+- {
+- ...
+- }
+
+@r_tcl@
+@@
+
+- TCLRPT_SET(...);
+
+@r_bfm@
+@@
+
+- BFM_STAGE(...);
+
+@r_trace@
+@@
+
+- TRACE_FUNC(...);
+
+@r_assert@
+@@
+
+- ALTERA_ASSERT(...);
+
+@r_if@
+@@
+
+- if (...) {}
+
+@r_if_else@
+@@
+
+- if (...) {
+- } else {
+- }
+
+@r_for@
+@@
+
+- for (...;...;...) {}
diff --git a/scripts/socfpga_get_sequencer b/scripts/socfpga_get_sequencer
index de12b35b5d..5e4eb2d0c4 100755
--- a/scripts/socfpga_get_sequencer
+++ b/scripts/socfpga_get_sequencer
@@ -46,6 +46,9 @@ copy_source() {
echo " Automated readability fixup..."
indent -npro -kr -i8 -ts8 -sob -l100 -ss -ncs -cp1 -il0 $tgt
+
+ echo " Running coccinelle cleanups..."
+ spatch -sp_file scripts/coccinelle/misc/altera_sequencer.cocci -in_place arch/arm/mach-socfpga/include/mach
}
copy_source ${ubootsrc}/board/altera/socfpga/sdram/sequencer.c arch/arm/mach-socfpga/include/mach/sequencer.c
diff --git a/scripts/socfpga_import_preloader b/scripts/socfpga_import_preloader
new file mode 100755
index 0000000000..b08262cb6c
--- /dev/null
+++ b/scripts/socfpga_import_preloader
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+if [ "$#" -lt "2" ]
+then
+ echo "USAGE: $0 <SPL_GENERATED_DIR> <ISW_HANDOFF> <BOARD_DIRECTORY>"
+ echo "EXAMPLE: $0 ~/cv_soc_devkit_ghrd/software/spl_bsp/generated ~/cv_soc_devkit_ghrd/hps_isw_handoff/soc_system_hps_0/ arch/arm/boards/altera-socdk"
+ exit 1
+fi
+
+splroot=$1
+handoff=$2
+boardroot=$3
+bareboxsrc=.
+
+cd ${bareboxsrc}
+
+copy_source() {
+ local src
+ local tgt
+ src=$1
+ tgt=$2
+
+ echo "Merging source code $src to $tgt"
+
+ cp $src $tgt
+
+ unifdef -D HCX_COMPAT_MODE=1 -D ENABLE_INST_ROM_WRITE=1 $tgt -o $tgt
+
+ echo " Fixing extern/static keywords..."
+ # Statify all global variables with missing static keyword
+ sed -i 's/^const /static const /g' $tgt
+ sed -i 's/^unsigned long sys_mgr_init_table/static unsigned long sys_mgr_init_table/g' $tgt
+
+ echo " Remove unused defines..."
+ sed -i 's/\[CONFIG_HPS_PINMUX_NUM\]/\[\]/g' $tgt
+
+ echo " Translating altera int types..."
+ # Replace altera types
+ sed -i 's/alt_u32/uint32_t/g' $tgt
+ sed -i 's/alt_u16/uint16_t/g' $tgt
+ sed -i 's/alt_16/int16_t/g' $tgt
+ sed -i 's/alt_32/int32_t/g' $tgt
+ sed -i 's/alt_u8/uint8_t/g' $tgt
+ sed -i 's/alt_8/int8_t/g' $tgt
+ sed -i 's/#include "alt_types.h"//g' $tgt
+
+ echo " Fixing include pathes..."
+ # Fix include pathes
+ sed -i 's/#include <iocsr_config_cyclone5.h>/#include <mach\/scan-manager.h>/g' $tgt
+ sed -i 's/#include <pinmux_config.h>/#include <common.h>/g' $tgt
+ sed -i 's/#include "sequencer_auto.h"//g' $tgt
+ sed -i 's/#include "sequencer_defines.h"//g' $tgt
+
+ echo " Automated readability fixup..."
+ indent -npro -kr -i8 -ts8 -sob -l100 -ss -ncs -cp1 -il0 $tgt
+ sed -i 's/ $//g' $tgt
+}
+
+copy_source ${splroot}/iocsr_config_cyclone5.c ${boardroot}/iocsr_config_cyclone5.c
+copy_source ${splroot}/pinmux_config_cyclone5.c ${boardroot}/pinmux_config.c
+copy_source ${splroot}/pll_config.h ${boardroot}/pll_config.h
+copy_source ${splroot}/sdram/sdram_config.h ${boardroot}/sdram_config.h
+
+copy_source ${handoff}/sequencer_auto.h ${boardroot}/sequencer_auto.h
+copy_source ${handoff}/sequencer_auto_ac_init.c ${boardroot}/sequencer_auto_ac_init.c
+copy_source ${handoff}/sequencer_auto_inst_init.c ${boardroot}/sequencer_auto_inst_init.c
+copy_source ${handoff}/sequencer_defines.h ${boardroot}/sequencer_defines.h
+
+echo "DONE"