Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dct port 0222 #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 30 additions & 18 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2014 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
Expand Down Expand Up @@ -37,7 +37,17 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
Expand Down Expand Up @@ -103,16 +113,12 @@ POST_UNINSTALL = :
@BUILD_DSP_FALSE@@BUILD_NAT_TRUE@am__append_3 = xrp-linux-native
@BUILD_EXAMPLE_TRUE@am__append_4 = xrp-example
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) README \
autoconf/compile autoconf/depcomp autoconf/install-sh \
autoconf/missing $(top_srcdir)/autoconf/compile \
$(top_srcdir)/autoconf/install-sh \
$(top_srcdir)/autoconf/missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
Expand Down Expand Up @@ -174,6 +180,10 @@ ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = xrp-dsp xrp-linux-sim xrp-linux-native xrp-example
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/compile \
$(top_srcdir)/autoconf/install-sh \
$(top_srcdir)/autoconf/missing README autoconf/compile \
autoconf/depcomp autoconf/install-sh autoconf/missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
Expand Down Expand Up @@ -303,6 +313,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
Expand Down Expand Up @@ -331,7 +342,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
Expand Down Expand Up @@ -538,15 +548,15 @@ dist-xz: distdir
$(am__post_remove_distdir)

dist-tarZ: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)

dist-shar: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__post_remove_distdir)
Expand Down Expand Up @@ -582,17 +592,17 @@ distcheck: dist
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_inst
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=.. --prefix="$$dc_install_base" \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
Expand Down Expand Up @@ -766,6 +776,8 @@ uninstall-am:
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags tags-am uninstall uninstall-am

.PRECIOUS: Makefile


# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
Expand Down
102 changes: 102 additions & 0 deletions README.xrp_porting
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
This README file defines what I have experimented so far w.r.t. porting xrp driver.

Charles Qi 2/22/2018

1. clone XRP git repo
=======================
The DCT flow is built around git. To make changes to XRP code base, I forked the XRP
github repo to [email protected]:zhengstake/xrp.git and created a branch dct_port_0222.

The local repo can be referenced from DCT flow by creating symbolic links to .git under
feeds/packages:
lede/feeds/sdip/sdip-xrp-application/git-src <local xrp repo>/.git
lede/feeds/sdip/sdip-xrp-driver/git-src <local xrp repo>/.git

2. Code change
=======================
So far there are two main modifications.
under xrp-kernel, I have created xrp_hw_dct.c and xrp_hw_dct_dsp_interface.h for the
low level driver. The generic driver is not touched. The main changes are how the
MMIO field related to DSP control, IRQ handling are mapped and communicated.

Unlike the simple HW driver, the DCT platform control regsisters are more spread out and
shared by many modules. Fields within the registers are also interleaved for different DSPs.
Please refer to DCT Platform PG for details:
a. the reset and runstall registgers are in SCU DSP control
b. the host <-> DSP IPI interrupts are in DSP control

Currently on the host side, the acccess to the two MMIO regions are down through syscon regmap,
consistent with the existing IVP driver. Additionally, a device_mmio_base and offset to
IRQ control registers are defined in dts. DSP reset, runstall and IRQ send, ack routines are
modified in xrp_hw_dct.c.

The new HW driver uses the cma binding, defining a shared reserve memory region in DDR for
ARM <=> DSP communication and data sharing. the 'reg' field in dts is not used. xrp_init_cma
in xrp_main.c is called by the HW driver at probe.

reset and runstall are not used by Xtensa DSP code. So only DSP control base is included in
xrp_hw_dct_sync_data structure as device_mmio_base.

On DSP side, a low level driver is derived from the simple driver. The code is under test-xrp/xrp_dsp_hw_dct.c.
The DCT platform uses a set of registers to control interrupts between ARM and DSP. These are
documented in the PG. The offset and bit locations of the registers are defined in dts and
passed to DSP in xrp_hw_dct_sync_data. Currently only set and clear registers are used to control IRQ singaling.
Further modification may be needed to include usage of mask registers.

3.XRP driver and IVP driver co-existance
============================================
The DCT platform uses an low level IVP driver to allow ARM host and Vision DSP to communicate.
Existing image/vision demos utilizes V4L2 streaming framework on top of IVP driver to
send video frames to DSP for processing. Then displays the processed frames.

We'd like to preserve the IVP driver and V4L2 framework while integrate the XRP function.
The best approach is to integrate low-level HW driver function into the IVP driver. Then allow
both XRP generic driver and whatever on top of the XRP to communicate through the IVP driver.
This is considered a TBD Phase 2 effort.

For initial integration, the plan is to split the 4 DSPs, two for IVP driver + V4L2, the other two
for XRP generic + HW driver.

The split is shown in xrp-example/sdip-xrp.dtsi.

The sdip-xrp.dtsi should be copied to
ede/build_dir/target-aarch64_cortex-a53+neon-vfpv4_musl-1.1.16/linux-sdip_sdip64/linux-4.9.47/arch/arm64/boot/dts/dct

and included in sdip-v2.dts.

The Linux target should be rebuild to utilize this new dts.


4. Integration of host side code to DCT flow
============================================

with help from Ralph, the latest XRP kernel module and host app have been integrated
into DCT flow. The package can be pulled for git server:

./scripts/feeds update sdip
./scripts/feeds install -a -p sdip
make menuconfig
make -j8

Note: make menuconfig is used to select XRP driver and app under Xtensa tab.

You can clean and compile these two modules with:
make package/sdip-xrp-application/clean V=s make package/sdip-xrp-application/compile V=s
make package/sdip-xrp-driver/clean V=s make package/sdip-xrp-driver/compile V=s

If you setup the git-src symbolic link properly, you will be able to see the local code
being picked up under
lede/build_dir/target-aarch64_cortex-a53+neon-vfpv4_musl-1.1.16/sdip-xrp-application-2018-02-15
lede/build_dir/target-aarch64_cortex-a53+neon-vfpv4_musl-1.1.16/linux-sdip_sdip64/sdip-xrp-driver-2018-02-15

respectively.

5. Integration of DSP side code to DCT flow
============================================
Xtensa side of XRP framework and driver code are integrated under
lede/build_dir/target-aarch64_cortex-a53+neon-vfpv4_musl-1.1.16/sdip-xtensa-2017-06-08/test-xrp.

I created a cmake based flow to build the driver and framework into a sigle elf, using the LSP designed for
any test demos.

The test_xrp directory is copied into dct_port_0222 branch just for completeness.
Loading