From 289fbd4f83543451323d6ce275fad1b5a85b61f1 Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Thu, 14 Sep 2017 09:21:52 +0300 Subject: Initial commit for ADAS boards support in 2.23.0 --- meta-rcar-gen3-adas/conf/layer.conf | 75 ++++++++++++++++++++++ meta-rcar-gen3-adas/conf/machine/eagle.conf | 35 ++++++++++ .../conf/machine/include/r8a7797.inc | 3 + .../conf/machine/include/tune-cortexa53.inc | 18 ++++++ meta-rcar-gen3-adas/conf/machine/v3msk.conf | 35 ++++++++++ 5 files changed, 166 insertions(+) create mode 100644 meta-rcar-gen3-adas/conf/layer.conf create mode 100644 meta-rcar-gen3-adas/conf/machine/eagle.conf create mode 100644 meta-rcar-gen3-adas/conf/machine/include/r8a7797.inc create mode 100644 meta-rcar-gen3-adas/conf/machine/include/tune-cortexa53.inc create mode 100644 meta-rcar-gen3-adas/conf/machine/v3msk.conf (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/layer.conf b/meta-rcar-gen3-adas/conf/layer.conf new file mode 100644 index 0000000..83d0c94 --- /dev/null +++ b/meta-rcar-gen3-adas/conf/layer.conf @@ -0,0 +1,75 @@ +# We have a conf and classes directory, append to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have a recipes directory, add to BBFILES +BBFILES += " \ + ${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend \ +" + +BBFILE_COLLECTIONS += "rcar-gen3-adas" +BBFILE_PATTERN_rcar-gen3-adas := "^${LAYERDIR}/" +BBFILE_PRIORITY_rcar-gen3-adas = "7" + +# Custom packages +IMAGE_INSTALL_append_rcar-gen3 = " \ + kernel-modules \ + kernel-devicetree \ + can-utils \ + libsocketcan \ + iproute2 \ + spidev-dbg \ + e2fsprogs \ + e2fsprogs-tune2fs \ + ethtool \ + pciutils \ + usbutils \ + util-linux \ + mtd-utils \ + capture \ + v4l2-fw \ + iperf \ + bonnie++ \ + lmbench \ + strace \ + libpcap \ + eglibc-utils \ + ldd \ + procps \ + can-utils libsocketcan \ + rsync \ + mm-init \ + iio-utils \ + pulseaudio-server \ + pulseaudio-misc \ + pulseaudio-module-cli \ + pulseaudio-module-remap-sink \ + pulseaudio-module-remap-source \ + gstreamer1.0-plugins-good-pulse \ + gdbserver \ +" + +# Radio packages +IMAGE_INSTALL_append_rcar-gen3 += " \ + si-tools \ + linux-firmware-wl18xx \ + wireless-tools \ + ti-bt \ + ti-bt-firmware \ + bluez5 \ + bluez5-testtools \ + pulseaudio-module-bluez5-device \ + pulseaudio-module-bluez5-discover \ + pulseaudio-module-bluetooth-discover \ + pulseaudio-module-bluetooth-policy \ + ofono \ + ofono-tests \ +" + +DISTRO_FEATURES_remove="x11" +DISTRO_FEATURES_append = " surroundview " +DISTRO_FEATURES_append = " opencv-sdk " + +IMAGE_INSTALL_remove = "gtk+3-demo clutter-1.0-examples" + +EXTRA_IMAGE_FEATURES_append_rcar-gen3 = " eclipse-debug" diff --git a/meta-rcar-gen3-adas/conf/machine/eagle.conf b/meta-rcar-gen3-adas/conf/machine/eagle.conf new file mode 100644 index 0000000..02e2a45 --- /dev/null +++ b/meta-rcar-gen3-adas/conf/machine/eagle.conf @@ -0,0 +1,35 @@ +#@TYPE: Machine +#@NAME: Eagle machine +#@DESCRIPTION: Machine configuration for running Eagle + +DEFAULTTUNE ?= "cortexa53" +require conf/machine/include/tune-cortexa53.inc +require conf/machine/include/${SOC_FAMILY}.inc + +# 32BIT package install (default is disable) +# This variables can be used only in multilib. +USE_32BIT_PKGS ?= "0" +USE_32BIT_WAYLAND ?= "0" +USE_32BIT_MMP ?= "0" + +MACHINE_FEATURES = "" + +KERNEL_IMAGETYPE = "Image" +IMAGE_FSTYPES = "tar.bz2 ext4 cpio.gz" + +SERIAL_CONSOLE = "115200 ttySC0" + +# Configuration for kernel +PREFERRED_PROVIDER_virtual/kernel = "linux-renesas" +KERNEL_DEVICETREE = "renesas/r8a7797-eagle.dtb" + +# u-boot +PREFERRED_VERSION_u-boot = "v2015.04%" +EXTRA_IMAGEDEPENDS += " u-boot" +UBOOT_MACHINE = "r8a7797_eagle_defconfig" + +# libdrm +PREFERRED_VERSION_libdrm = "2.4.68" + +# Add variable to Build Configuration in build log +BUILDCFG_VARS_append = " SOC_FAMILY" diff --git a/meta-rcar-gen3-adas/conf/machine/include/r8a7797.inc b/meta-rcar-gen3-adas/conf/machine/include/r8a7797.inc new file mode 100644 index 0000000..e2cc4ac --- /dev/null +++ b/meta-rcar-gen3-adas/conf/machine/include/r8a7797.inc @@ -0,0 +1,3 @@ +SOC_FAMILY =. "rcar-gen3:" +require conf/machine/include/soc-family.inc +LINUXLIBCVERSION = "4.9" diff --git a/meta-rcar-gen3-adas/conf/machine/include/tune-cortexa53.inc b/meta-rcar-gen3-adas/conf/machine/include/tune-cortexa53.inc new file mode 100644 index 0000000..ebf2c4f --- /dev/null +++ b/meta-rcar-gen3-adas/conf/machine/include/tune-cortexa53.inc @@ -0,0 +1,18 @@ +DEFAULTTUNE ?= "cortexa53" +require conf/machine/include/arm/arch-armv8.inc + +TUNEVALID[cortexa53] = "Enable Cortex-A53 specific processor optimizations" +TUNECONFLICTS[aarch64] = "armv4 armv5 armv6 armv7 armv7a" + +TUNE_CCARGS .= "${@bb.utils.contains("TUNE_FEATURES", "aarch64", " -march=armv8-a", "" ,d)}" + +MACHINEOVERRIDES =. "${@bb.utils.contains("TUNE_FEATURES", "cortexa53", "cortexa53:", "" ,d)}" + +TUNE_CCARGS .= "${@bb.utils.contains("TUNE_FEATURES", "cortexa53", " -mtune=cortex-a53", "", d)}" + +# Little Endian base configs +AVAILTUNES += "cortexa53" +ARMPKGARCH_tune-cortexa53 = "cortexa53" +TUNE_FEATURES_tune-cortexa53 = "${TUNE_FEATURES_tune-aarch64} cortexa53" +PACKAGE_EXTRA_ARCHS_tune-cortexa53 = "${PACKAGE_EXTRA_ARCHS_tune-aarch64} cortexa53" +BASE_LIB_tune-cortexa53 = "lib64" diff --git a/meta-rcar-gen3-adas/conf/machine/v3msk.conf b/meta-rcar-gen3-adas/conf/machine/v3msk.conf new file mode 100644 index 0000000..a86470e --- /dev/null +++ b/meta-rcar-gen3-adas/conf/machine/v3msk.conf @@ -0,0 +1,35 @@ +#@TYPE: Machine +#@NAME: V3MSK machine +#@DESCRIPTION: Machine configuration for running V3MSK + +DEFAULTTUNE ?= "cortexa53" +require conf/machine/include/tune-cortexa53.inc +require conf/machine/include/${SOC_FAMILY}.inc + +# 32BIT package install (default is disable) +# This variables can be used only in multilib. +USE_32BIT_PKGS ?= "0" +USE_32BIT_WAYLAND ?= "0" +USE_32BIT_MMP ?= "0" + +MACHINE_FEATURES = "" + +KERNEL_IMAGETYPE = "Image" +IMAGE_FSTYPES = "tar.bz2 ext4 cpio.gz" + +SERIAL_CONSOLE = "115200 ttySC0" + +# Configuration for kernel +PREFERRED_PROVIDER_virtual/kernel = "linux-renesas" +KERNEL_DEVICETREE = "renesas/r8a7797-v3msk.dtb" + +# u-boot +PREFERRED_VERSION_u-boot = "v2015.04%" +EXTRA_IMAGEDEPENDS += " u-boot" +UBOOT_MACHINE = "r8a7797_eagle_defconfig" + +# libdrm +PREFERRED_VERSION_libdrm = "2.4.68" + +# Add variable to Build Configuration in build log +BUILDCFG_VARS_append = " SOC_FAMILY" -- cgit 1.2.3-korg From 1188bae340037667e958665fede72fd40d9a60b8 Mon Sep 17 00:00:00 2001 From: Grigory Kletsko Date: Fri, 18 Aug 2017 12:20:31 +0300 Subject: Add opencv 3.2 and use it by default --- meta-rcar-gen3-adas/conf/layer.conf | 2 + .../packagegroups/packagegroup-rcar-gen3-adas.bb | 7 - ...01-3rdparty-ippicv-Use-pre-downloaded-ipp.patch | 28 ++++ .../0001-Revert-cuda-fix-fp16-compilation.patch | 27 ++++ .../opencv/opencv/fixpkgconfig.patch | 29 ++++ .../opencv/opencv/uselocalxfeatures.patch | 12 ++ .../opencv/opencv/useoeprotobuf.patch | 13 ++ .../recipes-graphics/opencv/opencv_3.2.bb | 176 +++++++++++++++++++++ .../recipes-support/libiio/libiio.inc | 2 +- 9 files changed, 288 insertions(+), 8 deletions(-) create mode 100644 meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch create mode 100644 meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-Revert-cuda-fix-fp16-compilation.patch create mode 100644 meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/fixpkgconfig.patch create mode 100644 meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/uselocalxfeatures.patch create mode 100644 meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/useoeprotobuf.patch create mode 100644 meta-rcar-gen3-adas/recipes-graphics/opencv/opencv_3.2.bb (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/layer.conf b/meta-rcar-gen3-adas/conf/layer.conf index 83d0c94..31e8f34 100644 --- a/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-rcar-gen3-adas/conf/layer.conf @@ -73,3 +73,5 @@ DISTRO_FEATURES_append = " opencv-sdk " IMAGE_INSTALL_remove = "gtk+3-demo clutter-1.0-examples" EXTRA_IMAGE_FEATURES_append_rcar-gen3 = " eclipse-debug" + +PREFERRED_VERSION_opencv = "3.2%" diff --git a/meta-rcar-gen3-adas/recipes-core/packagegroups/packagegroup-rcar-gen3-adas.bb b/meta-rcar-gen3-adas/recipes-core/packagegroups/packagegroup-rcar-gen3-adas.bb index 25f1954..b497c79 100644 --- a/meta-rcar-gen3-adas/recipes-core/packagegroups/packagegroup-rcar-gen3-adas.bb +++ b/meta-rcar-gen3-adas/recipes-core/packagegroups/packagegroup-rcar-gen3-adas.bb @@ -24,25 +24,18 @@ RDEPENDS_packagegroup-opencv-sdk = '${@ " \ opencv-apps \ opencv-samples \ opencv-dbg \ - opencv-staticdev \ - python-opencv \ libopencv-calib3d \ - libopencv-contrib \ libopencv-core \ libopencv-features2d \ libopencv-flann \ - libopencv-gpu \ libopencv-highgui \ libopencv-imgproc \ - libopencv-legacy \ libopencv-ml \ - libopencv-nonfree \ libopencv-objdetect \ libopencv-photo \ libopencv-stitching \ libopencv-superres \ libopencv-video \ libopencv-videostab \ - libopencv-ocl \ gstreamer1.0-plugins-base-app \ " if 'opencv-sdk' in '${DISTRO_FEATURES}' else ""}' diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch new file mode 100644 index 0000000..1077d05 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch @@ -0,0 +1,28 @@ +From 049f931207631aa54af55a2917318d032b2ef3fa Mon Sep 17 00:00:00 2001 +From: Ricardo Ribalda Delgado +Date: Thu, 31 Mar 2016 00:20:15 +0200 +Subject: [PATCH] 3rdparty/ippicv: Use pre-downloaded ipp + +Signed-off-by: Ricardo Ribalda Delgado +--- + 3rdparty/ippicv/downloader.cmake | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/3rdparty/ippicv/downloader.cmake b/3rdparty/ippicv/downloader.cmake +index a6016dbe10bc..af4062c8e95e 100644 +--- a/3rdparty/ippicv/downloader.cmake ++++ b/3rdparty/ippicv/downloader.cmake +@@ -31,8 +31,10 @@ function(_icv_downloader) + return() # Not supported + endif() + ++ if(NOT DEFINED OPENCV_ICV_PATH) + set(OPENCV_ICV_UNPACK_PATH "${CMAKE_BINARY_DIR}/3rdparty/ippicv") + set(OPENCV_ICV_PATH "${OPENCV_ICV_UNPACK_PATH}${OPENCV_ICV_PACKAGE_SUBDIR}") ++ endif() + + if(DEFINED OPENCV_ICV_PACKAGE_DOWNLOADED + AND OPENCV_ICV_PACKAGE_DOWNLOADED STREQUAL OPENCV_ICV_PACKAGE_HASH +-- +2.8.0.rc3 + diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-Revert-cuda-fix-fp16-compilation.patch b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-Revert-cuda-fix-fp16-compilation.patch new file mode 100644 index 0000000..507d796 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-Revert-cuda-fix-fp16-compilation.patch @@ -0,0 +1,27 @@ +From 69f9707678190f6a0948a547dce948251f972676 Mon Sep 17 00:00:00 2001 +From: Randy MacLeod +Date: Wed, 26 Apr 2017 14:57:30 -0400 +Subject: [PATCH 1/2] Revert "cuda: fix fp16 compilation" + +This reverts commit 12e00827be40576b686ea4438a6e6ef85208743d. +--- + modules/core/include/opencv2/core/cvdef.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h +index 699b166..efc24ca 100644 +--- a/modules/core/include/opencv2/core/cvdef.h ++++ b/modules/core/include/opencv2/core/cvdef.h +@@ -303,8 +303,7 @@ enum CpuFeatures { + #define CV_2PI 6.283185307179586476925286766559 + #define CV_LOG2 0.69314718055994530941723212145818 + +-#if defined __ARM_FP16_FORMAT_IEEE \ +- && !defined __CUDACC__ ++#if defined (__ARM_FP16_FORMAT_IEEE) + # define CV_FP16_TYPE 1 + #else + # define CV_FP16_TYPE 0 +-- +2.9.3 + diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/fixpkgconfig.patch b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/fixpkgconfig.patch new file mode 100644 index 0000000..3aeda7d --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/fixpkgconfig.patch @@ -0,0 +1,29 @@ +diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake +index b8cb8777c06b..75281ee964fd 100644 +--- a/cmake/OpenCVGenPkgconfig.cmake ++++ b/cmake/OpenCVGenPkgconfig.cmake +@@ -27,7 +27,7 @@ macro(fix_prefix lst isown) + get_filename_component(libdir "${item}" PATH) + get_filename_component(libname "${item}" NAME_WE) + string(REGEX REPLACE "^lib(.*)" "\\1" libname "${libname}") +- list(APPEND _lst "-L${libdir}" "-l${libname}") ++ list(APPEND _lst "-l${libname}") + else() + list(APPEND _lst "-l${item}") + endif() +@@ -66,10 +66,14 @@ ocv_list_unique(_3rdparty) + + set(OPENCV_PC_LIBS + "-L\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}" ++ "-L\${exec_prefix}/${OPENCV_3P_LIB_INSTALL_PATH}" + "${_modules}" + ) + if (BUILD_SHARED_LIBS) +- set(OPENCV_PC_LIBS_PRIVATE "${_extra}") ++ set(OPENCV_PC_LIBS_PRIVATE ++ "-L\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}" ++ "${_extra}" ++ ) + else() + set(OPENCV_PC_LIBS_PRIVATE + "-L\${exec_prefix}/${OPENCV_3P_LIB_INSTALL_PATH}" diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/uselocalxfeatures.patch b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/uselocalxfeatures.patch new file mode 100644 index 0000000..a2db48d --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/uselocalxfeatures.patch @@ -0,0 +1,12 @@ +diff --git a/modules/xfeatures2d/CMakeLists.txt b/modules/xfeatures2d/CMakeLists.txt +index f295bddaed66..6086e75ec37b 100644 +--- a/modules/xfeatures2d/CMakeLists.txt ++++ b/modules/xfeatures2d/CMakeLists.txt +@@ -1,5 +1,5 @@ + set(the_description "Contributed/Experimental Algorithms for Salient 2D Features Detection") + ocv_define_module(xfeatures2d opencv_core opencv_imgproc opencv_features2d opencv_calib3d opencv_shape opencv_highgui opencv_videoio opencv_ml + OPTIONAL opencv_cudaarithm WRAP python java) +-include(cmake/download_vgg.cmake) +-include(cmake/download_boostdesc.cmake) ++#include(cmake/download_vgg.cmake) ++#include(cmake/download_boostdesc.cmake) diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/useoeprotobuf.patch b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/useoeprotobuf.patch new file mode 100644 index 0000000..3068bd4 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/useoeprotobuf.patch @@ -0,0 +1,13 @@ +diff --git a/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake b/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake +index eb2a729cc2eb..8717736484de 100644 +--- a/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake ++++ b/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake +@@ -24,7 +24,7 @@ if(NOT BUILD_PROTOBUF AND NOT (DEFINED PROTOBUF_INCLUDE_DIR AND DEFINED PROTOBUF + find_package(Protobuf QUIET) + endif() + +-if(PROTOBUF_FOUND) ++if(PROTOBUF_FOUND OR (DEFINED PROTOBUF_INCLUDE_DIR AND DEFINED PROTOBUF_LIBRARIES)) + # nothing + else() + include(${CMAKE_CURRENT_LIST_DIR}/download_protobuf.cmake) diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv_3.2.bb b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv_3.2.bb new file mode 100644 index 0000000..a5ef014 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv_3.2.bb @@ -0,0 +1,176 @@ +SUMMARY = "Opencv : The Open Computer Vision Library" +HOMEPAGE = "http://opencv.org/" +SECTION = "libs" + +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=2b2f8752cc5edf504d283107d033f544" + +ARM_INSTRUCTION_SET_armv4 = "arm" +ARM_INSTRUCTION_SET_armv5 = "arm" + +DEPENDS = "libtool swig-native bzip2 zlib glib-2.0" + +#DEPENDS = "libwebp" + +SRCREV_opencv = "70bbf17b133496bd7d54d034b0f94bd869e0e810" +SRCREV_contrib = "86342522b0eb2b16fa851c020cc4e0fef4e010b7" +SRCREV_ipp = "81a676001ca8075ada498583e4166079e5744668" +SRCREV_bootdesc = "34e4206aef44d50e6bbcd0ab06354b52e7466d26" +SRCREV_vgg = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d" +IPP_MD5 = "808b791a6eac9ed78d32a7666804320e" + +SRCREV_FORMAT = "opencv" +SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \ + git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib \ + git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20151201;destsuffix=ipp;name=ipp \ + git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=bootdesc;name=bootdesc \ + git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=vgg;name=vgg \ + file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \ + file://fixpkgconfig.patch \ + file://uselocalxfeatures.patch;patchdir=../contrib/ \ + file://useoeprotobuf.patch;patchdir=../contrib/ \ + file://0001-Revert-cuda-fix-fp16-compilation.patch \ +" +# file://0002-Revert-check-FP16-build-condition-correctly.patch \ +# + +PV = "3.2+git${SRCPV}" + +S = "${WORKDIR}/git" + +do_unpack_extra() { + tar xzf ${WORKDIR}/ipp/ippicv/ippicv_linux_20151201.tgz -C ${WORKDIR} + cp ${WORKDIR}/vgg/*.i ${WORKDIR}/contrib/modules/xfeatures2d/src + cp ${WORKDIR}/bootdesc/*.i ${WORKDIR}/contrib/modules/xfeatures2d/src +} +addtask unpack_extra after do_unpack before do_patch + +EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${WORKDIR}/contrib/modules \ + -DWITH_1394=OFF \ + -DCMAKE_SKIP_RPATH=ON \ + -DOPENCV_ICV_PACKAGE_DOWNLOADED=${IPP_MD5} \ + -DOPENCV_ICV_PATH=${WORKDIR}/ippicv_lnx \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1", "", d)} \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1", "", d)} \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.2", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1 -DENABLE_SSE42=1", "", d)} \ + ${@base_conditional("libdir", "/usr/lib64", "-DLIB_SUFFIX=64", "", d)} \ + ${@base_conditional("libdir", "/usr/lib32", "-DLIB_SUFFIX=32", "", d)} \ +" +EXTRA_OECMAKE_append_x86 = " -DX86=ON" + +PACKAGECONFIG ??= "eigen jpeg png tiff v4l libv4l gstreamer samples tbb \ + ${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \ + ${@bb.utils.contains("LICENSE_FLAGS_WHITELIST", "commercial", "libav", "", d)} \ + ${@bb.utils.contains("DISTRO_FEATURES", "qt5", "qt5", "", d)}" + +PACKAGECONFIG[amdblas] = "-DWITH_OPENCLAMDBLAS=ON,-DWITH_OPENCLAMDBLAS=OFF,libclamdblas," +PACKAGECONFIG[amdfft] = "-DWITH_OPENCLAMDFFT=ON,-DWITH_OPENCLAMDFFT=OFF,libclamdfft," +PACKAGECONFIG[dnn] = "-DBUILD_opencv_dnn=ON -DUPDATE_PROTO_FILES=ON -DBUILD_PROTOBUF=OFF,-DBUILD_opencv_dnn=OFF,lapack protobuf protobuf-native," +PACKAGECONFIG[eigen] = "-DWITH_EIGEN=ON,-DWITH_EIGEN=OFF,libeigen gflags glog," +PACKAGECONFIG[freetype] = "-DBUILD_opencv_freetype=ON,-DBUILD_opencv_freetype=OFF,freetype," +PACKAGECONFIG[gphoto2] = "-DWITH_GPHOTO2=ON,-DWITH_GPHOTO2=OFF,libgphoto2," +PACKAGECONFIG[gstreamer] = "-DWITH_GSTREAMER=ON,-DWITH_GSTREAMER=OFF,gstreamer1.0 gstreamer1.0-plugins-base," +PACKAGECONFIG[gtk] = "-DWITH_GTK=ON,-DWITH_GTK=OFF,gtk+3," +PACKAGECONFIG[jasper] = "-DWITH_JASPER=ON,-DWITH_JASPER=OFF,jasper," +PACKAGECONFIG[java] = "-DJAVA_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native fastjar-native openjdk-8-native," +PACKAGECONFIG[jpeg] = "-DWITH_JPEG=ON,-DWITH_JPEG=OFF,jpeg," +PACKAGECONFIG[libav] = "-DWITH_FFMPEG=ON,-DWITH_FFMPEG=OFF,libav," +PACKAGECONFIG[libv4l] = "-DWITH_LIBV4L=ON,-DWITH_LIBV4L=OFF,v4l-utils," +PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,opencl-headers virtual/opencl-icd," +PACKAGECONFIG[oracle-java] = "-DJAVA_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${ORACLE_JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native oracle-jse-jdk oracle-jse-jdk-native," +PACKAGECONFIG[png] = "-DWITH_PNG=ON,-DWITH_PNG=OFF,libpng," +PACKAGECONFIG[python2] = "-DPYTHON2_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python-numpy," +PACKAGECONFIG[python3] = "-DPYTHON3_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python3-numpy," +PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,," +PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb," +PACKAGECONFIG[text] = "-DBUILD_opencv_text=ON,-DBUILD_opencv_text=OFF,tesseract," +PACKAGECONFIG[tiff] = "-DWITH_TIFF=ON,-DWITH_TIFF=OFF,tiff," +PACKAGECONFIG[v4l] = "-DWITH_V4L=ON,-DWITH_V4L=OFF,v4l-utils," +PACKAGECONFIG[qt5] = "-DWITH_QT=ON,-DWITH_QT=OFF,qtbase," + +inherit pkgconfig cmake ${@bb.utils.contains( 'DISTRO_FEATURES', 'qt5', 'cmake_qt5','', d)} + +inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'distutils3-base', '', d)} +inherit ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'distutils-base', '', d)} + +export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}" +export PYTHON="${STAGING_BINDIR_NATIVE}/${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3', 'python', d)}" +export ORACLE_JAVA_HOME="${STAGING_DIR_NATIVE}/usr/bin/java" +export JAVA_HOME="${STAGING_DIR_NATIVE}/usr/lib/jvm/openjdk-8-native" +export ANT_DIR="${STAGING_DIR_NATIVE}/usr/share/ant/" + +TARGET_CC_ARCH += "-I${S}/include " + +PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'samples', '${PN}-samples', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'oracle-java', '${PN}-java', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'java', '${PN}-java', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'python-${BPN}', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-${BPN}', '', d)} \ + ${PN}-apps" + +python populate_packages_prepend () { + cv_libdir = d.expand('${libdir}') + do_split_packages(d, cv_libdir, '^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True) + do_split_packages(d, cv_libdir, '^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev') + do_split_packages(d, cv_libdir, '^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev') + do_split_packages(d, cv_libdir, '^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True) + + pn = d.getVar('PN', 1) + metapkg = pn + '-dev' + d.setVar('ALLOW_EMPTY_' + metapkg, "1") + blacklist = [ metapkg ] + metapkg_rdepends = [ ] + packages = d.getVar('PACKAGES', 1).split() + for pkg in packages[1:]: + if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'): + metapkg_rdepends.append(pkg) + d.setVar('RRECOMMENDS_' + metapkg, ' '.join(metapkg_rdepends)) + + metapkg = pn + blacklist = [ metapkg ] + metapkg_rdepends = [ ] + for pkg in packages[1:]: + if not pkg in blacklist and not pkg in metapkg_rdepends and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-doc') and not pkg.endswith('-locale') and not pkg.endswith('-staticdev'): + metapkg_rdepends.append(pkg) + d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends)) + +} + +PACKAGES_DYNAMIC += "^libopencv-.*" + +FILES_${PN} = "" +FILES_${PN}-dbg += "${datadir}/OpenCV/java/.debug/* ${datadir}/OpenCV/samples/bin/.debug/*" +FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig ${datadir}/OpenCV/*.cmake" +FILES_${PN}-staticdev += "${datadir}/OpenCV/3rdparty/lib/*.a" +FILES_${PN}-apps = "${bindir}/* ${datadir}/OpenCV" +FILES_${PN}-java = "${datadir}/OpenCV/java" +FILES_${PN}-samples = "${datadir}/OpenCV/samples/" + +INSANE_SKIP_${PN}-java = "libdir" +INSANE_SKIP_${PN}-dbg = "libdir" + +ALLOW_EMPTY_${PN} = "1" + +SUMMARY_python-opencv = "Python bindings to opencv" +FILES_python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*" +RDEPENDS_python-opencv = "python-core python-numpy" + +SUMMARY_python3-opencv = "Python bindings to opencv" +FILES_python3-opencv = "${PYTHON_SITEPACKAGES_DIR}/*" +RDEPENDS_python3-opencv = "python3-core python3-numpy" + +do_install_append() { + cp ${S}/include/opencv/*.h ${D}${includedir}/opencv/ + sed -i '/blobtrack/d' ${D}${includedir}/opencv/cvaux.h + + # Move Python files into correct library folder (for multilib build) + if [ "$libdir" != "/usr/lib" -a -d ${D}/usr/lib ]; then + mv ${D}/usr/lib/* ${D}/${libdir}/ + rm -rf ${D}/usr/lib + fi + + if ${@bb.utils.contains("PACKAGECONFIG", "samples", "true", "false", d)}; then + install -d ${D}${datadir}/OpenCV/samples/bin/ + cp -f bin/*-tutorial-* bin/*-example-* ${D}${datadir}/OpenCV/samples/bin/ + fi +} diff --git a/meta-rcar-gen3-adas/recipes-support/libiio/libiio.inc b/meta-rcar-gen3-adas/recipes-support/libiio/libiio.inc index 0e54c3e..81662a5 100644 --- a/meta-rcar-gen3-adas/recipes-support/libiio/libiio.inc +++ b/meta-rcar-gen3-adas/recipes-support/libiio/libiio.inc @@ -7,5 +7,5 @@ LIC_FILES_CHKSUM ??= "file://COPYING.txt;md5=7c13b3376cea0ce68d2d2da0a1b3a72c" inherit cmake pkgconfig -DEPENDS = "libxml2 bison-native flex-native" +DEPENDS = "libxml2 bison-native flex-native systemd" -- cgit 1.2.3-korg From 5a76ca6303891c2a21dee88a10d12ba6791e7798 Mon Sep 17 00:00:00 2001 From: Grigory Kletsko Date: Wed, 20 Sep 2017 16:25:35 +0300 Subject: Use OpenCV 2.4 by default (necessary for public release SV) --- meta-rcar-gen3-adas/conf/layer.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/layer.conf b/meta-rcar-gen3-adas/conf/layer.conf index 31e8f34..c871d29 100644 --- a/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-rcar-gen3-adas/conf/layer.conf @@ -74,4 +74,4 @@ IMAGE_INSTALL_remove = "gtk+3-demo clutter-1.0-examples" EXTRA_IMAGE_FEATURES_append_rcar-gen3 = " eclipse-debug" -PREFERRED_VERSION_opencv = "3.2%" +PREFERRED_VERSION_opencv = "2.4%" -- cgit 1.2.3-korg From 3b3bb85c224233fccc7a325f7e9c438d41bbaeb9 Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Fri, 27 Oct 2017 22:09:04 +0300 Subject: MOST: add scripts used for testing Add MOST card setup scripts used for testing --- meta-rcar-gen3-adas/conf/layer.conf | 1 + .../recipes-bsp/most-tools/files/most-tools.tar.gz | Bin 0 -> 65178 bytes .../recipes-bsp/most-tools/most-tools.bb | 22 +++++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 meta-rcar-gen3-adas/recipes-bsp/most-tools/files/most-tools.tar.gz create mode 100644 meta-rcar-gen3-adas/recipes-bsp/most-tools/most-tools.bb (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/layer.conf b/meta-rcar-gen3-adas/conf/layer.conf index c871d29..5fe6c62 100644 --- a/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-rcar-gen3-adas/conf/layer.conf @@ -47,6 +47,7 @@ IMAGE_INSTALL_append_rcar-gen3 = " \ pulseaudio-module-remap-source \ gstreamer1.0-plugins-good-pulse \ gdbserver \ + most-tools \ " # Radio packages diff --git a/meta-rcar-gen3-adas/recipes-bsp/most-tools/files/most-tools.tar.gz b/meta-rcar-gen3-adas/recipes-bsp/most-tools/files/most-tools.tar.gz new file mode 100644 index 0000000..f1eaacb Binary files /dev/null and b/meta-rcar-gen3-adas/recipes-bsp/most-tools/files/most-tools.tar.gz differ diff --git a/meta-rcar-gen3-adas/recipes-bsp/most-tools/most-tools.bb b/meta-rcar-gen3-adas/recipes-bsp/most-tools/most-tools.bb new file mode 100644 index 0000000..809db9a --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-bsp/most-tools/most-tools.bb @@ -0,0 +1,22 @@ +SUMMARY = "MOST tools" +SECTION = "multimedia" +LICENSE = "CLOSED" + +S = "${WORKDIR}/most-tools" + +SRC_URI = " \ + file://most-tools.tar.gz \ +" + +do_install() { + install -d ${D}/usr/share/most/ + install -m 755 ${S}/most_setup.sh ${D}/usr/share/most/ + install -m 755 ${S}/most_play.sh ${D}/usr/share/most/ + install -m 755 ${S}/setup-audio-50 ${D}/usr/share/most/ +} + +FILES_${PN} = " \ + /usr/share/most/most_setup.sh \ + /usr/share/most/most_play.sh \ + /usr/share/most/setup-audio-50 \ +" -- cgit 1.2.3-korg From cc609cd55d04afd285fe95eae2fa3f3151f8d66d Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Fri, 17 Nov 2017 12:13:41 +0300 Subject: V3M IMR/DRM - Support IMR/VSP/DRM for V3M - Add packeges to use IMR-DRM demo --- meta-rcar-gen3-adas/conf/layer.conf | 3 + .../sample/conf/eagle/linaro-gcc/bsp/local.conf | 3 + .../sample/conf/v3msk/linaro-gcc/bsp/local.conf | 3 + .../images/core-image-minimal.bbappend | 3 + .../packagegroups/packagegroup-surroundview-drm.bb | 20 + .../files/0002-mmngr-Add-V3MSK-board.patch | 31 ++ .../kernel-module-mmngr.bbappend | 8 +- ...gpu-drm-rcar-du-Extend-VSP1-DRM-interface.patch | 546 +++++++++++++++++++++ ...0104-media-vsp1-extend-DRM-VSP1-interface.patch | 367 ++++++++++++++ ...ia-rcar-imr-IMR-driver-updates-for-raw-DL.patch | 538 ++++++++++++++++++++ .../linux/linux-renesas_4.9.bbappend | 6 + 11 files changed, 1526 insertions(+), 2 deletions(-) create mode 100644 meta-rcar-gen3-adas/recipes-core/images/core-image-minimal.bbappend create mode 100644 meta-rcar-gen3-adas/recipes-core/packagegroups/packagegroup-surroundview-drm.bb create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-mmngr/files/0002-mmngr-Add-V3MSK-board.patch create mode 100644 meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0103-gpu-drm-rcar-du-Extend-VSP1-DRM-interface.patch create mode 100644 meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0104-media-vsp1-extend-DRM-VSP1-interface.patch create mode 100644 meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0105-media-rcar-imr-IMR-driver-updates-for-raw-DL.patch (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/layer.conf b/meta-rcar-gen3-adas/conf/layer.conf index 5fe6c62..1a7e025 100644 --- a/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-rcar-gen3-adas/conf/layer.conf @@ -48,6 +48,9 @@ IMAGE_INSTALL_append_rcar-gen3 = " \ gstreamer1.0-plugins-good-pulse \ gdbserver \ most-tools \ + perf \ + dropbear \ + opkg \ " # Radio packages diff --git a/meta-rcar-gen3-adas/docs/sample/conf/eagle/linaro-gcc/bsp/local.conf b/meta-rcar-gen3-adas/docs/sample/conf/eagle/linaro-gcc/bsp/local.conf index 7014ac9..a1c3b2a 100644 --- a/meta-rcar-gen3-adas/docs/sample/conf/eagle/linaro-gcc/bsp/local.conf +++ b/meta-rcar-gen3-adas/docs/sample/conf/eagle/linaro-gcc/bsp/local.conf @@ -257,6 +257,9 @@ BBMASK .= "|gles-user-module|kernel-module-gles|wayland-kms|libgbm" # Mask MMP recipes BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + # Linux ICCOM driver (RCG3ZLIDL4001ZNO) # Linux ICCOM library (RCG3ZLILL4001ZNO) #DISTRO_FEATURES_append = " iccom" diff --git a/meta-rcar-gen3-adas/docs/sample/conf/v3msk/linaro-gcc/bsp/local.conf b/meta-rcar-gen3-adas/docs/sample/conf/v3msk/linaro-gcc/bsp/local.conf index 623bb49..75b33e7 100644 --- a/meta-rcar-gen3-adas/docs/sample/conf/v3msk/linaro-gcc/bsp/local.conf +++ b/meta-rcar-gen3-adas/docs/sample/conf/v3msk/linaro-gcc/bsp/local.conf @@ -257,6 +257,9 @@ BBMASK .= "|gles-user-module|kernel-module-gles|wayland-kms|libgbm" # Mask MMP recipes BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + # Linux ICCOM driver (RCG3ZLIDL4001ZNO) # Linux ICCOM library (RCG3ZLILL4001ZNO) #DISTRO_FEATURES_append = " iccom" diff --git a/meta-rcar-gen3-adas/recipes-core/images/core-image-minimal.bbappend b/meta-rcar-gen3-adas/recipes-core/images/core-image-minimal.bbappend new file mode 100644 index 0000000..913dbf4 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-core/images/core-image-minimal.bbappend @@ -0,0 +1,3 @@ +IMAGE_INSTALL_append = " \ + packagegroup-surroundview-drm \ +" diff --git a/meta-rcar-gen3-adas/recipes-core/packagegroups/packagegroup-surroundview-drm.bb b/meta-rcar-gen3-adas/recipes-core/packagegroups/packagegroup-surroundview-drm.bb new file mode 100644 index 0000000..9a6fdda --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-core/packagegroups/packagegroup-surroundview-drm.bb @@ -0,0 +1,20 @@ +DESCRIPTION = "Packages required for DRM Surroundview demo" +LICENSE = "GPL" + +inherit packagegroup + +PACKAGES = " \ + packagegroup-surroundview-drm \ +" + +RDEPENDS_packagegroup-surroundview-drm = '${@ " \ + spacenavd \ + libspnav \ + gstreamer1.0-plugins-base libgstallocators-1.0 \ + gstreamer1.0-plugins-base-app libgstapp-1.0 \ + libdrm \ + kernel-module-mmngr \ + kernel-module-mmngrbuf \ + mmngr-user-module \ + vspmif-user-module \ +" if 'surroundview' in '${DISTRO_FEATURES}' else ""}' diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-mmngr/files/0002-mmngr-Add-V3MSK-board.patch b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-mmngr/files/0002-mmngr-Add-V3MSK-board.patch new file mode 100644 index 0000000..cfb5297 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-mmngr/files/0002-mmngr-Add-V3MSK-board.patch @@ -0,0 +1,31 @@ +From 5b50bdd074c162d927bfd3711546928ac93d4a13 Mon Sep 17 00:00:00 2001 +From: Vladimir Barinov +Date: Wed, 15 Nov 2017 00:03:43 +0300 +Subject: [PATCH] mmngr: Add V3MSK board + +This adds V3MSK board support + +Signed-off-by: Konstantin Kozhevnikov +Signed-off-by: Vladimir Barinov +--- + mmngr_drv/mmngr/mmngr-module/files/mmngr/include/mmngr_private.h | 5 ++ + 1 file changed, 5 insertions(+), 0 deletions(-) + +diff --git a/mmngr_drv/mmngr/mmngr-module/files/mmngr/include/mmngr_private.h b/mmngr_drv/mmngr/mmngr-module/files/mmngr/include/mmngr_private.h +index e593380..8282d42 100644 +--- a/mmngr_drv/mmngr/mmngr-module/files/mmngr/include/mmngr_private.h ++++ b/mmngr_drv/mmngr/mmngr-module/files/mmngr/include/mmngr_private.h +@@ -211,6 +211,11 @@ static int validate_memory_map(void); + #define MM_OMXBUF_SIZE (256 * 1024 * 1024) + #endif /* MMNGR_SALVATORX */ + ++#ifdef MMNGR_V3MSK ++#define MM_OMXBUF_ADDR (0x7F000000UL) ++#define MM_OMXBUF_SIZE (16 * 1024 * 1024) ++#endif /* MMNGR_V3MSK */ ++ + #define MM_CO_ORDER (12) + + #ifdef MMNGR_SSP_ENABLE +-- +1.9.1 diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-mmngr/kernel-module-mmngr.bbappend b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-mmngr/kernel-module-mmngr.bbappend index 45b79f1..6abdc7d 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-mmngr/kernel-module-mmngr.bbappend +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-mmngr/kernel-module-mmngr.bbappend @@ -1,2 +1,6 @@ -MMNGR_CFG_eagle = "MMNGR_SALVATORX" -MMNGR_CFG_v3msk = "MMNGR_SALVATORX" +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +MMNGR_CFG_eagle = "MMNGR_V3MSK" +MMNGR_CFG_v3msk = "MMNGR_V3MSK" + +SRC_URI_append = " file://0002-mmngr-Add-V3MSK-board.patch" diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0103-gpu-drm-rcar-du-Extend-VSP1-DRM-interface.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0103-gpu-drm-rcar-du-Extend-VSP1-DRM-interface.patch new file mode 100644 index 0000000..e3f24a6 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0103-gpu-drm-rcar-du-Extend-VSP1-DRM-interface.patch @@ -0,0 +1,546 @@ +From b6176e313aea415b83d5762db275b2f364f08820 Mon Sep 17 00:00:00 2001 +From: Konstantin Kozhevnikov +Date: Tue, 14 Nov 2017 01:38:51 -0800 +Subject: [PATCH] gpu: drm: rcar-du: Extend VSP1-DRM interface + +Extend VSP1-DRM interface + +Signed-off-by: Konstantin Kozhevnikov +--- + drivers/gpu/drm/drm_framebuffer.c | 1 + + drivers/gpu/drm/rcar-du/rcar_du_drv.h | 5 + + drivers/gpu/drm/rcar-du/rcar_du_kms.c | 42 ++++++- + drivers/gpu/drm/rcar-du/rcar_du_plane.c | 3 +- + drivers/gpu/drm/rcar-du/rcar_du_plane.h | 5 + + drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 209 ++++++++++++++++++++++++++------ + drivers/gpu/drm/rcar-du/rcar_du_vsp.h | 7 +- + 7 files changed, 232 insertions(+), 40 deletions(-) + +diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c +index 398efd6..4a43e15 100644 +--- a/drivers/gpu/drm/drm_framebuffer.c ++++ b/drivers/gpu/drm/drm_framebuffer.c +@@ -192,6 +192,7 @@ static int format_check(const struct drm_mode_fb_cmd2 *r) + case DRM_FORMAT_YVU422: + case DRM_FORMAT_YUV444: + case DRM_FORMAT_YVU444: ++ case DRM_FORMAT_R8: + return 0; + default: + format_name = drm_get_format_name(r->pixel_format); +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h +index 45d6e7e..bdf2612 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h ++++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h +@@ -104,6 +104,11 @@ struct rcar_du_device { + struct { + struct drm_property *alpha; + struct drm_property *colorkey; ++ struct drm_property *alphaplane; ++ struct drm_property *blend; ++ struct drm_property *ckey; ++ struct drm_property *ckey_set0; ++ struct drm_property *ckey_set1; + } props; + + unsigned int dpad0_source; +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c +index e955e92..31b48bc 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c +@@ -10,7 +10,7 @@ + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +- ++//#define DEBUG + #include + #include + #include +@@ -101,6 +101,12 @@ static const struct rcar_du_format_info rcar_du_format_infos[] = { + .planes = 2, + .pnmr = PnMR_SPIM_TP_OFF | PnMR_DDDF_YC, + .edf = PnDDCR4_EDF_NONE, ++ }, { ++ .fourcc = DRM_FORMAT_R8, ++ .bpp = 8, ++ .planes = 1, ++ .pnmr = PnMR_SPIM_TP_OFF | PnMR_DDDF_8BPP, ++ .edf = PnDDCR4_EDF_NONE, + }, + }; + +@@ -169,6 +175,10 @@ static const struct rcar_du_format_info rcar_vsp_format_infos[] = { + .fourcc = DRM_FORMAT_YVU444, + .bpp = 24, + .planes = 3, ++ }, { ++ .fourcc = DRM_FORMAT_R8, ++ .bpp = 8, ++ .planes = 1, + }, + }; + +@@ -565,6 +575,36 @@ static int rcar_du_properties_init(struct rcar_du_device *rcdu) + if (rcdu->props.colorkey == NULL) + return -ENOMEM; + ++ rcdu->props.alphaplane = ++ drm_property_create(rcdu->ddev, DRM_MODE_PROP_OBJECT, "alphaplane", 1); ++ if (rcdu->props.alphaplane == NULL) ++ return -ENOMEM; ++ rcdu->props.alphaplane->values[0] = DRM_MODE_OBJECT_FB; ++ ++ rcdu->props.blend = ++ drm_property_create_range(rcdu->ddev, 0, "blend", ++ 0, 0xffffffff); ++ if (rcdu->props.blend == NULL) ++ return -ENOMEM; ++ ++ rcdu->props.ckey = ++ drm_property_create_range(rcdu->ddev, 0, "ckey", ++ 0, 0xffffffff); ++ if (rcdu->props.ckey == NULL) ++ return -ENOMEM; ++ ++ rcdu->props.ckey_set0 = ++ drm_property_create_range(rcdu->ddev, 0, "ckey_set0", ++ 0, 0xffffffff); ++ if (rcdu->props.ckey_set0 == NULL) ++ return -ENOMEM; ++ ++ rcdu->props.ckey_set1 = ++ drm_property_create_range(rcdu->ddev, 0, "ckey_set1", ++ 0, 0xffffffff); ++ if (rcdu->props.ckey_set1 == NULL) ++ return -ENOMEM; ++ + return 0; + } + +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c +index e408aa3..2b57f09 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c +@@ -10,7 +10,7 @@ + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +- ++//#define DEBUG + #include + #include + #include +@@ -719,6 +719,7 @@ static const uint32_t formats[] = { + DRM_FORMAT_NV12, + DRM_FORMAT_NV21, + DRM_FORMAT_NV16, ++ DRM_FORMAT_R8, + }; + + int rcar_du_planes_init(struct rcar_du_group *rgrp) +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h +index c1de338..a6065ef 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h ++++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h +@@ -66,6 +66,11 @@ struct rcar_du_plane_state { + + unsigned int alpha; + unsigned int colorkey; ++ struct drm_framebuffer *alphaplane; ++ unsigned int blend; ++ unsigned int ckey; ++ unsigned int ckey_set0; ++ unsigned int ckey_set1; + }; + + static inline struct rcar_du_plane_state * +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +index 770238a..910e0f0 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +@@ -10,7 +10,7 @@ + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +- ++//#define DEBUG + #include + #include + #include +@@ -91,6 +91,16 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) + + void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) + { ++ struct rcar_du_vsp *vsp = crtc->vsp; ++ struct rcar_du_vsp_plane *primary = &vsp->planes[0]; ++ struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(primary->plane.state); ++ ++ /* ...drop alpha-plane associated with primary plane (why only primary? - tbd) */ ++ if (rstate->alphaplane) { ++ drm_framebuffer_unreference(rstate->alphaplane); ++ rstate->alphaplane = NULL; ++ } ++ + vsp1_du_setup_lif(crtc->vsp->vsp, NULL, crtc->lif_index, + crtc->suspend); + } +@@ -133,6 +143,7 @@ static const u32 formats_kms[] = { + DRM_FORMAT_YVU422, + DRM_FORMAT_YUV444, + DRM_FORMAT_YVU444, ++ DRM_FORMAT_R8, + }; + + static const u32 formats_v4l2[] = { +@@ -162,6 +173,7 @@ static const u32 formats_v4l2[] = { + V4L2_PIX_FMT_YVU422M, + V4L2_PIX_FMT_YUV444M, + V4L2_PIX_FMT_YVU444M, ++ V4L2_PIX_FMT_GREY, + }; + + static const u32 formats_xlate[][2] = { +@@ -184,6 +196,7 @@ static const u32 formats_xlate[][2] = { + { DRM_FORMAT_NV21, V4L2_PIX_FMT_NV21M }, + { DRM_FORMAT_NV16, V4L2_PIX_FMT_NV16M }, + { DRM_FORMAT_NV61, V4L2_PIX_FMT_NV61M }, ++ { DRM_FORMAT_R8, V4L2_PIX_FMT_GREY }, + }; + + static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) +@@ -226,6 +239,27 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) + } + } + ++ /* ...add alpha-plane as needed */ ++ if (state->alphaplane) { ++ i = state->format->planes; ++ cfg.alpha_mem = sg_dma_address(state->sg_tables[i].sgl); ++ cfg.alpha_pitch = state->alphaplane->pitches[0]; ++ pr_debug("alpha-%d: set alpha-mem address: %llx, pitch=%d\n", i, (unsigned long long)cfg.alpha_mem, cfg.alpha_pitch); ++ } ++ ++ /* ...add blending formula as needed */ ++ if (state->blend) { ++ cfg.blend = state->blend; ++ pr_debug("set blending formula: %X\n", cfg.blend); ++ } ++ ++ /* ...add color key property as needed */ ++ if (state->ckey) { ++ cfg.ckey = state->ckey; ++ cfg.ckey_set0 = state->ckey_set0; ++ cfg.ckey_set1 = state->ckey_set1; ++ } ++ + vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg); + } + +@@ -259,6 +293,23 @@ static int rcar_du_vsp_plane_prepare_fb(struct drm_plane *plane, + } + } + ++ /* ...check if we have alpha-plane attached */ ++ if (rstate->alphaplane) { ++ struct drm_gem_cma_object *gem = drm_fb_cma_get_gem_obj(rstate->alphaplane, 0); ++ struct sg_table *sgt = &rstate->sg_tables[i++]; ++ ++ ret = dma_get_sgtable(rcdu->dev, sgt, gem->vaddr, gem->paddr, gem->base.size); ++ if (ret) ++ goto fail; ++ ++ ret = vsp1_du_map_sg(vsp->vsp, sgt); ++ if (!ret) { ++ sg_free_table(sgt); ++ ret = -ENOMEM; ++ goto fail; ++ } ++ } ++ + return 0; + + fail: +@@ -288,6 +339,14 @@ static void rcar_du_vsp_plane_cleanup_fb(struct drm_plane *plane, + vsp1_du_unmap_sg(vsp->vsp, sgt); + sg_free_table(sgt); + } ++ ++ if (rstate->alphaplane) { ++ struct sg_table *sgt = &rstate->sg_tables[i]; ++ ++ vsp1_du_unmap_sg(vsp->vsp, sgt); ++ sg_free_table(sgt); ++ pr_debug("unmap alpha-plane\n"); ++ } + } + + static int rcar_du_vsp_plane_atomic_check(struct drm_plane *plane, +@@ -369,6 +428,11 @@ rcar_du_vsp_plane_atomic_duplicate_state(struct drm_plane *plane) + if (copy == NULL) + return NULL; + ++ if (copy->alphaplane) { ++ drm_framebuffer_reference(copy->alphaplane); ++ pr_debug("duplicate alpha-plane '%p' (refcount=%d)\n", copy->alphaplane, drm_framebuffer_read_refcount(copy->alphaplane)); ++ } ++ + __drm_atomic_helper_plane_duplicate_state(plane, ©->state); + + return ©->state; +@@ -377,8 +441,15 @@ rcar_du_vsp_plane_atomic_duplicate_state(struct drm_plane *plane) + static void rcar_du_vsp_plane_atomic_destroy_state(struct drm_plane *plane, + struct drm_plane_state *state) + { ++ struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state); ++ ++ if (rstate->alphaplane) { ++ pr_debug("unref alpha-plane '%p' (refcount=%d)\n", rstate->alphaplane, drm_framebuffer_read_refcount(rstate->alphaplane)); ++ drm_framebuffer_unreference(rstate->alphaplane); ++ } ++ + __drm_atomic_helper_plane_destroy_state(state); +- kfree(to_rcar_vsp_plane_state(state)); ++ kfree(rstate); + } + + static void rcar_du_vsp_plane_reset(struct drm_plane *plane) +@@ -386,6 +457,7 @@ static void rcar_du_vsp_plane_reset(struct drm_plane *plane) + struct rcar_du_vsp_plane_state *state; + + if (plane->state) { ++ pr_debug("reset plane '%p'\n", to_rcar_vsp_plane_state(plane->state)->alphaplane); + rcar_du_vsp_plane_atomic_destroy_state(plane, plane->state); + plane->state = NULL; + } +@@ -410,7 +482,30 @@ static int rcar_du_vsp_plane_atomic_set_property(struct drm_plane *plane, + + if (property == rcdu->props.alpha) + rstate->alpha = val; +- else ++ else if (property == rcdu->props.blend) ++ rstate->blend = val; ++ else if (property == rcdu->props.ckey) ++ rstate->ckey = val; ++ else if (property == rcdu->props.ckey_set0) ++ rstate->ckey_set0 = val; ++ else if (property == rcdu->props.ckey_set1) ++ rstate->ckey_set1 = val; ++ else if (property == rcdu->props.alphaplane) { ++ if (rstate->alphaplane) { ++ pr_debug("unref alpha-plane '%p' (refcount=%d)\n", rstate->alphaplane, drm_framebuffer_read_refcount(rstate->alphaplane)); ++ drm_framebuffer_unreference(rstate->alphaplane); ++ } ++ rstate->alphaplane = drm_framebuffer_lookup(plane->dev, val); ++ if (rstate->alphaplane) { ++ pr_debug("use alpha-plane '%p' (refcount=%d)\n", rstate->alphaplane, drm_framebuffer_read_refcount(rstate->alphaplane)); ++ /* ...the way how we handle this leads to a "loss" of plane reference (it is acquired ++ * within "drm_property_change_valid_get" but not returned in symmetric "drm_property_change_valid_put") ++ * Whether it is a bug or was done intentionally, I don't know. For a moment just drop that ++ * extra reference right here ++ */ ++ if (0) drm_framebuffer_unreference(rstate->alphaplane); ++ } ++ } else + return -EINVAL; + + return 0; +@@ -426,6 +521,16 @@ static int rcar_du_vsp_plane_atomic_get_property(struct drm_plane *plane, + + if (property == rcdu->props.alpha) + *val = rstate->alpha; ++ else if (property == rcdu->props.alphaplane) ++ *val = (rstate->alphaplane ? rstate->alphaplane->base.id : 0); ++ else if (property == rcdu->props.blend) ++ *val = rstate->blend; ++ else if (property == rcdu->props.ckey) ++ *val = rstate->ckey; ++ else if (property == rcdu->props.ckey_set0) ++ *val = rstate->ckey_set0; ++ else if (property == rcdu->props.ckey_set1) ++ *val = rstate->ckey_set1; + else + return -EINVAL; + +@@ -442,9 +547,10 @@ int rcar_du_vsp_write_back(struct drm_device *dev, void *data, + struct rcar_du_crtc *rcrtc; + struct rcar_du_device *rcdu; + const struct drm_display_mode *mode; +- u32 pixelformat, bpp; +- unsigned int pitch; ++ struct drm_framebuffer *fb; + dma_addr_t mem[3]; ++ struct sg_table sg_tables[3]; ++ int i = 0; + + obj = drm_mode_object_find(dev, sh->crtc_id, DRM_MODE_OBJECT_CRTC); + if (!obj) +@@ -455,62 +561,79 @@ int rcar_du_vsp_write_back(struct drm_device *dev, void *data, + rcdu = rcrtc->group->dev; + mode = &rcrtc->crtc.state->adjusted_mode; + +- switch (sh->fmt) { +- case DRM_FORMAT_RGB565: +- bpp = 16; +- pixelformat = V4L2_PIX_FMT_RGB565; +- break; +- case DRM_FORMAT_ARGB1555: +- bpp = 16; +- pixelformat = V4L2_PIX_FMT_ARGB555; +- break; +- case DRM_FORMAT_ARGB8888: +- bpp = 32; +- pixelformat = V4L2_PIX_FMT_ABGR32; +- break; +- default: +- dev_err(rcdu->dev, "specified format is not supported.\n"); ++ fb = drm_framebuffer_lookup(dev, sh->buff); ++ if (!fb) { ++ dev_err(dev->dev, "failed to lookup destination framebuffer '%lu'\n", sh->buff); + return -EINVAL; + } + +- pitch = mode->hdisplay * bpp / 8; ++ /* ...check framebuffer is okay */ ++ if ((fb->width != (mode->hdisplay)) || ++ (fb->height != (mode->vdisplay))) { ++ dev_err(dev->dev, "wrong fb mode: %d*%d vs %d*%d\n", fb->width, fb->height, mode->hdisplay, mode->vdisplay); ++ ret = -EINVAL; ++ goto done; ++ } + +- mem[0] = sh->buff; +- mem[1] = 0; +- mem[2] = 0; ++ /* ...need to verify compatibility of output format, I guess - tbd */ + +- if ((sh->width != (mode->hdisplay)) || +- (sh->height != (mode->vdisplay))) +- return -EINVAL; ++ /* ...fill memory planes addresses */ ++ for (i = 0; i < 3; i++) { ++ struct drm_gem_cma_object *gem; ++ struct sg_table *sgt = &sg_tables[i]; ++ gem = drm_fb_cma_get_gem_obj(fb, i); ++ if (!gem) ++ break; ++ ret = dma_get_sgtable(rcdu->dev, sgt, gem->vaddr, gem->paddr, ++ gem->base.size); ++ if (ret) ++ goto done; + +- if ((pitch * mode->vdisplay) > sh->buff_len) +- return -EINVAL; ++ ret = vsp1_du_map_sg(rcrtc->vsp->vsp, sgt); ++ if (!ret) { ++ sg_free_table(sgt); ++ ret = -ENOMEM; ++ goto done; ++ } ++ mem[i] = sg_dma_address(sg_tables[i].sgl) + fb->offsets[i]; ++ } ++ ++ dev_info(dev->dev, "setup write-back (pixfmt=%X, %u*%u, planes: %d)\n", fb->pixel_format, fb->width, fb->height, i); ++ ++ vsp1_du_setup_wb(rcrtc->vsp->vsp, fb->pixel_format, fb->pitches[0], mem, rcrtc->lif_index); + +- vsp1_du_setup_wb(rcrtc->vsp->vsp, pixelformat, pitch, mem, +- rcrtc->lif_index); + ret = vsp1_du_wait_wb(rcrtc->vsp->vsp, WB_STAT_CATP_SET, + rcrtc->lif_index); + if (ret != 0) +- return ret; ++ goto done; + + ret = rcar_du_async_commit(dev, crtc); + if (ret != 0) +- return ret; ++ goto done; + + ret = vsp1_du_wait_wb(rcrtc->vsp->vsp, WB_STAT_CATP_START, + rcrtc->lif_index); + if (ret != 0) +- return ret; ++ goto done; + + ret = rcar_du_async_commit(dev, crtc); + if (ret != 0) +- return ret; ++ goto done; + + ret = vsp1_du_wait_wb(rcrtc->vsp->vsp, WB_STAT_CATP_DONE, + rcrtc->lif_index); + if (ret != 0) +- return ret; ++ goto done; ++ ++done: ++ /* ...unmap all tables */ ++ while (i--) { ++ struct sg_table *sgt = &sg_tables[i]; ++ vsp1_du_unmap_sg(rcrtc->vsp->vsp, sgt); ++ sg_free_table(sgt); ++ } + ++ drm_framebuffer_unreference(fb); + return ret; + } + +@@ -574,6 +697,7 @@ static const uint32_t formats[] = { + DRM_FORMAT_NV21, + DRM_FORMAT_NV16, + DRM_FORMAT_NV61, ++ DRM_FORMAT_R8, + }; + + int rcar_du_vsp_init(struct rcar_du_vsp *vsp) +@@ -653,13 +777,24 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp) + drm_plane_helper_add(&plane->plane, + &rcar_du_vsp_plane_helper_funcs); + ++#if 0 // ...use same set of properties for all planes + if (type == DRM_PLANE_TYPE_PRIMARY) + continue; +- ++#endif + drm_object_attach_property(&plane->plane.base, + rcdu->props.alpha, 255); + drm_plane_create_zpos_property(&plane->plane, 1, 1, + vsp->num_planes - 1); ++ drm_object_attach_property(&plane->plane.base, ++ rcdu->props.alphaplane, 0); ++ drm_object_attach_property(&plane->plane.base, ++ rcdu->props.blend, 0); ++ drm_object_attach_property(&plane->plane.base, ++ rcdu->props.ckey, 0); ++ drm_object_attach_property(&plane->plane.base, ++ rcdu->props.ckey_set0, 0); ++ drm_object_attach_property(&plane->plane.base, ++ rcdu->props.ckey_set1, 0); + } + + return 0; +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h +index 3fd9cef..2f4aa41 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h ++++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h +@@ -52,10 +52,15 @@ struct rcar_du_vsp_plane_state { + struct drm_plane_state state; + + const struct rcar_du_format_info *format; +- struct sg_table sg_tables[3]; ++ struct sg_table sg_tables[4]; + + unsigned int alpha; + unsigned int zpos; ++ struct drm_framebuffer *alphaplane; ++ unsigned int blend; ++ unsigned int ckey; ++ unsigned int ckey_set0; ++ unsigned int ckey_set1; + }; + + static inline struct rcar_du_vsp_plane_state * +-- +2.7.4 + diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0104-media-vsp1-extend-DRM-VSP1-interface.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0104-media-vsp1-extend-DRM-VSP1-interface.patch new file mode 100644 index 0000000..2f6fa35 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0104-media-vsp1-extend-DRM-VSP1-interface.patch @@ -0,0 +1,367 @@ +From 0cbfce87c1a16b80111cdcecdd703ad5f75cc6e7 Mon Sep 17 00:00:00 2001 +From: Konstantin Kozhevnikov +Date: Tue, 14 Nov 2017 01:41:06 -0800 +Subject: [PATCH] media: platform: vsp1: extend DRM-VSP1 interface + +- Extend DRM-VSP1 interface +- Add alpha-plane support for VSP1 + +Signed-off-by: Konstantin Kozhevnikov +--- + drivers/media/platform/vsp1/vsp1_bru.c | 13 ++++++++++++- + drivers/media/platform/vsp1/vsp1_dl.c | 5 +++++ + drivers/media/platform/vsp1/vsp1_drm.c | 34 ++++++++++++++++++++++++++------- + drivers/media/platform/vsp1/vsp1_lif.c | 2 +- + drivers/media/platform/vsp1/vsp1_pipe.c | 4 ++++ + drivers/media/platform/vsp1/vsp1_rpf.c | 24 ++++++++++++++++++++--- + drivers/media/platform/vsp1/vsp1_rwpf.c | 2 +- + drivers/media/platform/vsp1/vsp1_rwpf.h | 6 ++++++ + drivers/media/platform/vsp1/vsp1_wpf.c | 4 +++- + include/media/vsp1.h | 6 ++++++ + 10 files changed, 86 insertions(+), 14 deletions(-) + +diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c +index 8b3164a..2c131be 100644 +--- a/drivers/media/platform/vsp1/vsp1_bru.c ++++ b/drivers/media/platform/vsp1/vsp1_bru.c +@@ -387,6 +387,16 @@ static void bru_configure(struct vsp1_entity *entity, + ctrl |= VI6_BRU_CTRL_SRCSEL_BRUIN(i); + + vsp1_bru_write(bru, dl, VI6_BRU_CTRL(i), ctrl); ++ dev_dbg(entity->vsp1->dev, "bru#%d: ctrl=%X\n", i, ctrl); ++ ++ /* ...set blending formula as defined by the input RPF */ ++ if (bru->inputs[i].rpf) { ++ if (bru->inputs[i].rpf->blend) { ++ vsp1_bru_write(bru, dl, VI6_BRU_BLD(i), bru->inputs[i].rpf->blend); ++ dev_dbg(entity->vsp1->dev, "bru#%d(#%d): setup blending formula: %X\n", i, bru->inputs[i].rpf->entity.index, bru->inputs[i].rpf->blend); ++ continue; ++ } ++ } + + /* Harcode the blending formula to + * +@@ -441,7 +451,8 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1) + v4l2_ctrl_new_std(&bru->ctrls, &bru_ctrl_ops, V4L2_CID_BG_COLOR, + 0, 0xffffff, 1, 0); + +- bru->bgcolor = 0; ++ /* ...for YUV, set black background */ ++ bru->bgcolor = 0x00800080; + + bru->entity.subdev.ctrl_handler = &bru->ctrls; + +diff --git a/drivers/media/platform/vsp1/vsp1_dl.c b/drivers/media/platform/vsp1/vsp1_dl.c +index 478e093..f9c6d09 100644 +--- a/drivers/media/platform/vsp1/vsp1_dl.c ++++ b/drivers/media/platform/vsp1/vsp1_dl.c +@@ -272,6 +272,7 @@ void vsp1_dl_set_addr_auto_fld(struct vsp1_dl_list *dl, struct vsp1_rwpf *rpf) + u32 y_top_index, y_bot_index; + u32 u_top_index, u_bot_index; + u32 v_top_index, v_bot_index; ++ u32 alpha_index; + dma_addr_t y_top_addr, y_bot_addr; + dma_addr_t u_top_addr, u_bot_addr; + dma_addr_t v_top_addr, v_bot_addr; +@@ -287,6 +288,7 @@ void vsp1_dl_set_addr_auto_fld(struct vsp1_dl_list *dl, struct vsp1_rwpf *rpf) + u_bot_index = rpf->entity.index * 8 + 3; + v_top_index = rpf->entity.index * 8 + 4; + v_bot_index = rpf->entity.index * 8 + 5; ++ alpha_index = rpf->entity.index * 8 + 6; + + switch (rpf->fmtinfo->fourcc) { + case V4L2_PIX_FMT_YUV420M: +@@ -359,6 +361,9 @@ void vsp1_dl_set_addr_auto_fld(struct vsp1_dl_list *dl, struct vsp1_rwpf *rpf) + dl->src_dst_addr[u_bot_index].addr = u_bot_addr; + dl->src_dst_addr[v_top_index].addr = v_top_addr; + dl->src_dst_addr[v_bot_index].addr = v_bot_addr; ++ ++ /* ...set alpha-plane address as needed */ ++ dl->src_dst_addr[alpha_index].addr = rpf->mem.alpha; + } + + static struct vsp1_dl_list *vsp1_dl_list_alloc(struct vsp1_dl_manager *dlm) +diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c +index 2681c8a..542ca5a 100644 +--- a/drivers/media/platform/vsp1/vsp1_drm.c ++++ b/drivers/media/platform/vsp1/vsp1_drm.c +@@ -10,7 +10,7 @@ + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +- ++//#define DEBUG + #include + #include + #include +@@ -201,7 +201,9 @@ int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg, + + format.format.width = cfg->width; + format.format.height = cfg->height; +- format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; ++ //format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; ++ /* ...always blend in YUV colorspace; apply conversion as needed */ ++ format.format.code = MEDIA_BUS_FMT_AYUV8_1X32; + format.format.field = V4L2_FIELD_NONE; + + ret = v4l2_subdev_call(&brs->entity.subdev, pad, +@@ -222,7 +224,9 @@ int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg, + + format.format.width = cfg->width; + format.format.height = cfg->height; +- format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; ++ //format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; ++ /* ...always blend in YUV colorspace; apply conversion as needed */ ++ format.format.code = MEDIA_BUS_FMT_AYUV8_1X32; + format.format.field = V4L2_FIELD_NONE; + + ret = v4l2_subdev_call(&bru->entity.subdev, pad, +@@ -241,7 +245,8 @@ int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg, + + format.format.width = cfg->width; + format.format.height = cfg->height; +- format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; ++ //format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; ++ format.format.code = MEDIA_BUS_FMT_AYUV8_1X32; + format.format.field = V4L2_FIELD_NONE; + + if (lif_index == 1) { +@@ -275,6 +280,13 @@ int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg, + format.format.code, lif_index); + + format.pad = RWPF_PAD_SOURCE; ++ /* ...force conversion back to ARGB at the output */ ++ format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; ++ ret = v4l2_subdev_call(&vsp1->wpf[0]->entity.subdev, pad, set_fmt, NULL, ++ &format); ++ if (ret < 0) ++ return ret; ++ + ret = v4l2_subdev_call(&vsp1->wpf[lif_index]->entity.subdev, + pad, get_fmt, NULL, &format); + if (ret < 0) +@@ -402,12 +414,12 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index, + } + + dev_dbg(vsp1->dev, +- "%s: RPF%u: (%u,%u)/%ux%u -> (%u,%u)/%ux%u (%08x), pitch %u dma { %pad, %pad, %pad } zpos %u\n", ++ "%s: RPF%u: (%u,%u)/%ux%u -> (%u,%u)/%ux%u (%08x), pitch %u dma { %pad, %pad, %pad } zpos %u, alpha %pad, ckey %x/%x/%x\n", + __func__, rpf_index, + cfg->src.left, cfg->src.top, cfg->src.width, cfg->src.height, + cfg->dst.left, cfg->dst.top, cfg->dst.width, cfg->dst.height, + cfg->pixelformat, cfg->pitch, &cfg->mem[0], &cfg->mem[1], +- &cfg->mem[2], cfg->zpos); ++ &cfg->mem[2], cfg->zpos, &cfg->alpha_mem, cfg->ckey, cfg->ckey_set0, cfg->ckey_set1); + + /* + * Store the format, stride, memory buffer address, crop and compose +@@ -432,6 +444,11 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index, + rpf->format.plane_fmt[1].bytesperline = cfg->pitch; + rpf->alpha = cfg->alpha; + rpf->interlaced = cfg->interlaced; ++ rpf->alpha_pitch = cfg->alpha_pitch; ++ rpf->ckey = cfg->ckey; ++ rpf->ckey_set0 = cfg->ckey_set0; ++ rpf->ckey_set1 = cfg->ckey_set1; ++ rpf->blend = cfg->blend; + + if ((vsp1->ths_quirks & VSP1_AUTO_FLD_NOT_SUPPORT) && + rpf->interlaced) { +@@ -443,6 +460,7 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index, + rpf->mem.addr[0] = cfg->mem[0]; + rpf->mem.addr[1] = cfg->mem[1]; + rpf->mem.addr[2] = cfg->mem[2]; ++ rpf->mem.alpha = cfg->alpha_mem; + + vsp1->drm->inputs[rpf_index].crop = cfg->src; + vsp1->drm->inputs[rpf_index].compose = cfg->dst; +@@ -517,7 +535,9 @@ static int vsp1_du_setup_rpf_pipe(struct vsp1_device *vsp1, + __func__, format.format.width, format.format.height, + format.format.code, rpf->entity.index); + +- format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; ++ //format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; ++ /* ...do blending in YUV color-space; apply conversion as needed */ ++ format.format.code = MEDIA_BUS_FMT_AYUV8_1X32; + + ret = v4l2_subdev_call(&rpf->entity.subdev, pad, set_fmt, NULL, + &format); +diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c +index e79f9e6..753763d 100644 +--- a/drivers/media/platform/vsp1/vsp1_lif.c ++++ b/drivers/media/platform/vsp1/vsp1_lif.c +@@ -162,7 +162,7 @@ static void lif_configure(struct vsp1_entity *entity, + + vsp1_lif_write(lif, dl, VI6_LIF_CTRL(lif->entity.index), + (obth << VI6_LIF_CTRL_OBTH_SHIFT) | +- (format->code == 0 ? VI6_LIF_CTRL_CFMT : 0) | ++ (format->code != MEDIA_BUS_FMT_ARGB8888_1X32 ? VI6_LIF_CTRL_CFMT : 0) | + VI6_LIF_CTRL_REQSEL | VI6_LIF_CTRL_LIF_EN); + + if (soc_device_match(r8a7797)) +diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c b/drivers/media/platform/vsp1/vsp1_pipe.c +index 8379962..86d4a85 100644 +--- a/drivers/media/platform/vsp1/vsp1_pipe.c ++++ b/drivers/media/platform/vsp1/vsp1_pipe.c +@@ -137,6 +137,10 @@ static const struct vsp1_format_info vsp1_video_formats[] = { + VI6_FMT_Y_U_V_444, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 3, { 8, 8, 8 }, false, false, 1, 1, false }, ++ { V4L2_PIX_FMT_GREY, MEDIA_BUS_FMT_Y8_1X8, ++ /*VI6_FMT_Y_U_V_444*/0xDEAD, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | ++ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, ++ 1, { 8, 0, 0 }, false, false, 0, 0, false }, + }; + + /** +diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c +index ff25470..2cce294 100644 +--- a/drivers/media/platform/vsp1/vsp1_rpf.c ++++ b/drivers/media/platform/vsp1/vsp1_rpf.c +@@ -10,7 +10,7 @@ + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +- ++//#define DEBUG + #include + + #include +@@ -253,8 +253,10 @@ static void rpf_configure(struct vsp1_entity *entity, + if (sink_format->code != source_format->code) + infmt |= VI6_RPF_INFMT_CSC; + ++ dev_dbg(vsp1->dev, "rpf#%d: infmt=%x (csc=%d)\n", rpf->entity.index, infmt, !!(infmt & VI6_RPF_INFMT_CSC)); ++ + vsp1_rpf_write(rpf, dl, VI6_RPF_INFMT, infmt); +- vsp1_rpf_write(rpf, dl, VI6_RPF_DSWAP, fmtinfo->swap); ++ vsp1_rpf_write(rpf, dl, VI6_RPF_DSWAP, fmtinfo->swap | 0xF00); + + /* Output location */ + if (pipe->bru) { +@@ -288,6 +290,15 @@ static void rpf_configure(struct vsp1_entity *entity, + (left << VI6_RPF_LOC_HCOORD_SHIFT) | + (top << VI6_RPF_LOC_VCOORD_SHIFT)); + ++ // ...setup alpha-plane as required ++ if (rpf->mem.alpha) { ++ vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_AI, rpf->mem.alpha); ++ vsp1_rpf_write(rpf, dl, VI6_RPF_ALPH_SEL, VI6_RPF_ALPH_SEL_ASEL_8B_PLANE); ++ vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ASTRIDE, rpf->alpha_pitch); ++ dev_dbg(vsp1->dev, "rpf#%d: setup alpha-plane: buffer=%pad, stride=%u\n", rpf->entity.index, &rpf->mem.alpha, rpf->alpha_pitch); ++ goto out; ++ } ++ + /* On Gen2 use the alpha channel (extended to 8 bits) when available or + * a fixed alpha value set through the V4L2_CID_ALPHA_COMPONENT control + * otherwise. +@@ -342,7 +353,9 @@ static void rpf_configure(struct vsp1_entity *entity, + if (entity->vsp1->info->gen == 3) { + u32 mult; + +- if ((fmtinfo->alpha) && ++ dev_dbg(vsp1->dev, "rpf#%d: alpha=%x, fourcc=%x\n", rpf->entity.index, fmtinfo->alpha, fmtinfo->fourcc); ++ ++ if (0 && (fmtinfo->alpha) && + (fmtinfo->fourcc != V4L2_PIX_FMT_ARGB555)) { + /* When the input contains an alpha channel enable the + * alpha multiplier. If the input is premultiplied we +@@ -371,9 +384,14 @@ static void rpf_configure(struct vsp1_entity *entity, + rpf->mult_alpha = mult; + } + ++out: + vsp1_rpf_write(rpf, dl, VI6_RPF_MSK_CTRL, 0); + vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_CTRL, 0); + ++ /* ...set up color keying */ ++ vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_CTRL, rpf->ckey); ++ vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_SET0, rpf->ckey_set0); ++ vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_SET1, rpf->ckey_set1); + } + + static const struct vsp1_entity_operations rpf_entity_ops = { +diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c b/drivers/media/platform/vsp1/vsp1_rwpf.c +index 66e4d7e..d7e730f 100644 +--- a/drivers/media/platform/vsp1/vsp1_rwpf.c ++++ b/drivers/media/platform/vsp1/vsp1_rwpf.c +@@ -10,7 +10,7 @@ + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +- ++//#define DEBUG + #include + + #include "vsp1.h" +diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h +index fbe6aa6..7553f2b 100644 +--- a/drivers/media/platform/vsp1/vsp1_rwpf.h ++++ b/drivers/media/platform/vsp1/vsp1_rwpf.h +@@ -33,6 +33,7 @@ struct vsp1_video; + + struct vsp1_rwpf_memory { + dma_addr_t addr[3]; ++ dma_addr_t alpha; + }; + + struct vsp1_rwpf { +@@ -72,6 +73,11 @@ struct vsp1_rwpf { + + int write_back; + dma_addr_t buf_addr[3]; ++ unsigned int alpha_pitch; ++ unsigned int ckey; ++ unsigned int ckey_set0; ++ unsigned int ckey_set1; ++ unsigned int blend; + }; + + static inline struct vsp1_rwpf *to_rwpf(struct v4l2_subdev *subdev) +diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c +index e8b3cfb..cb81848 100644 +--- a/drivers/media/platform/vsp1/vsp1_wpf.c ++++ b/drivers/media/platform/vsp1/vsp1_wpf.c +@@ -10,7 +10,7 @@ + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +- ++//#define DEBUG + #include + + #include +@@ -358,6 +358,8 @@ static void wpf_configure(struct vsp1_entity *entity, + + wpf->outfmt = outfmt; + ++ dev_dbg(vsp1->dev, "wpf#%d: outfmt=%x (csc=%d)\n", wpf->entity.index, outfmt, !!(outfmt & VI6_WPF_OUTFMT_CSC)); ++ + vsp1_dl_list_write(dl, VI6_DPR_WPF_FPORCH(wpf->entity.index), + VI6_DPR_WPF_FPORCH_FP_WPFN); + +diff --git a/include/media/vsp1.h b/include/media/vsp1.h +index d5d93ed..c1c3201 100644 +--- a/include/media/vsp1.h ++++ b/include/media/vsp1.h +@@ -53,11 +53,17 @@ struct vsp1_du_atomic_config { + u32 pixelformat; + unsigned int pitch; + dma_addr_t mem[3]; ++ dma_addr_t alpha_mem; ++ unsigned int alpha_pitch; ++ unsigned int ckey; ++ unsigned int ckey_set0; ++ unsigned int ckey_set1; + struct v4l2_rect src; + struct v4l2_rect dst; + unsigned int alpha; + unsigned int zpos; + bool interlaced; ++ unsigned int blend; + }; + + void vsp1_du_atomic_begin(struct device *dev, unsigned int lif_index); +-- +2.7.4 + diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0105-media-rcar-imr-IMR-driver-updates-for-raw-DL.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0105-media-rcar-imr-IMR-driver-updates-for-raw-DL.patch new file mode 100644 index 0000000..42d2e32 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0105-media-rcar-imr-IMR-driver-updates-for-raw-DL.patch @@ -0,0 +1,538 @@ +From a687bfb7343b33992f92e86c234718c3e21144a0 Mon Sep 17 00:00:00 2001 +From: Konstantin Kozhevnikov +Date: Tue, 14 Nov 2017 01:47:11 -0800 +Subject: [PATCH] media: rcar-imr: IMR driver updates for raw DL + +IMR driver updates for raw DL + +Signed-off-by: Konstantin Kozhevnikov +--- + drivers/media/platform/rcar_imr.c | 209 ++++++++++++++++++++++++++++++-------- + include/uapi/linux/rcar-imr.h | 16 +-- + 2 files changed, 175 insertions(+), 50 deletions(-) + +diff --git a/drivers/media/platform/rcar_imr.c b/drivers/media/platform/rcar_imr.c +index 30c6742..9b601da 100644 +--- a/drivers/media/platform/rcar_imr.c ++++ b/drivers/media/platform/rcar_imr.c +@@ -94,6 +94,7 @@ struct imr_device { + struct v4l2_device v4l2_dev; + struct video_device video_dev; + struct v4l2_m2m_dev *m2m_dev; ++ struct device *alloc_dev; + + /* ...do we need that counter really? framework counts fh structures for us - tbd */ + int refcount; +@@ -117,6 +118,9 @@ struct imr_ctx { + /* ...cropping parameters (in pixels) */ + u16 crop[4]; + ++ /* ...solid color code */ ++ u32 color; ++ + /* ...number of active configurations (debugging) */ + u32 cfg_num; + }; +@@ -192,6 +196,7 @@ struct imr_ctx { + + #define IMR_TRICR 0x6C + #define IMR_TRIC_YCFORM (1 << 31) ++#define IMR_TRICR2 0xA0 + + #define IMR_UVDPOR 0x70 + #define IMR_SUSR 0x74 +@@ -212,6 +217,8 @@ struct imr_ctx { + #define IMR_CPDP_UBDPO_SHIFT 4 + #define IMR_CPDP_VRDPO_SHIFT 0 + ++#define IMR_TPOR 0xF0 ++ + /******************************************************************************* + * Auxiliary helpers + ******************************************************************************/ +@@ -404,11 +411,16 @@ static int imr_queue_setup(struct vb2_queue *vq, + return -EINVAL; + } + ++ /* ...specify default allocator */ ++ alloc_devs[0] = ctx->imr->alloc_dev; ++ + return 0; + } + + static int imr_buf_prepare(struct vb2_buffer *vb) + { ++ struct imr_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); ++ + /* ...unclear yet if we want to prepare a buffer somehow (cache invalidation? - tbd) */ + return 0; + } +@@ -441,9 +453,10 @@ static void imr_buf_finish(struct vb2_buffer *vb) + WARN_ON(!mutex_is_locked(&ctx->imr->mutex)); + + /* ...any special processing of completed buffer? - tbd */ +- v4l2_dbg(3, debug, &ctx->imr->v4l2_dev, "%sput buffer <0x%08llx> done\n", ++ v4l2_dbg(3, debug, &ctx->imr->v4l2_dev, "%sput buffer <0x%08llx> done (err: %d) (ctx=%p)\n", + q->is_output ? "in" : "out", +- vb2_dma_contig_plane_dma_addr(vb, 0)); ++ vb2_dma_contig_plane_dma_addr(vb, 0), ++ vb->state, ctx); + + /* ...unref configuration pointer as needed */ + if (q->is_output) +@@ -568,6 +581,11 @@ static inline u16 __imr_auto_sg_dg_tcm(u32 type) + (type & IMR_MAP_TCM ? IMR_TRIM_TCM : 0); + } + ++static inline u16 __imr_bfe_tme(u32 type) ++{ ++ return (type & IMR_MAP_TME ? IMR_TRIM_TME : 0) | (type & IMR_MAP_BFE ? IMR_TRIM_BFE : 0); ++} ++ + static inline u16 __imr_uvdp(u32 type) + { + return __IMR_MAP_UVDPOR(type) | (type & IMR_MAP_DDP ? (1 << 8) : 0); +@@ -674,15 +692,14 @@ static inline u32 * imr_tri_set_type_b(u32 *dl, void *map, struct imr_mesh *mesh + ******************************************************************************/ + + /* ...calculate length of a type "c" mapping */ +-static inline u32 imr_tri_type_c_get_length(struct imr_vbo *vbo, int item_size) ++static inline u32 imr_tri_type_c_get_length(int num, int item_size) + { +- return ((4 + 3 * item_size) * vbo->num + 4); ++ return ((4 + 3 * item_size) * num + 4); + } + + /* ...set a VBO mapping using absolute coordinates */ +-static inline u32 * imr_tri_set_type_c(u32 *dl, void *map, struct imr_vbo *vbo, int item_size) ++static inline u32 * imr_tri_set_type_c(u32 *dl, void *map, int num, int item_size) + { +- int num = vbo->num; + int i; + + /* ...prepare list of triangles to draw */ +@@ -732,6 +749,7 @@ static inline void imr_dl_program_setup(struct imr_ctx *ctx, struct imr_cfg *cfg + int h = ctx->queue[0].fmt.height; + int W = ctx->queue[1].fmt.width; + int H = ctx->queue[1].fmt.height; ++ u32 tricr = ctx->color & 0xFFFFFF; + + v4l2_dbg(2, debug, &ctx->imr->v4l2_dev, "setup %u*%u -> %u*%u mapping (type=%x)\n", w, h, W, H, type); + +@@ -739,11 +757,17 @@ static inline void imr_dl_program_setup(struct imr_ctx *ctx, struct imr_cfg *cfg + *dl++ = IMR_OP_WTS(IMR_TRIMCR, 0xFFFF); + + /* ...set automatic source / destination coordinates generation flags */ +- *dl++ = IMR_OP_WTS(IMR_TRIMSR, __imr_auto_sg_dg_tcm(type) | IMR_TRIM_BFE | IMR_TRIM_TME); ++ *dl++ = IMR_OP_WTS(IMR_TRIMSR, __imr_auto_sg_dg_tcm(type) | __imr_bfe_tme(type)); ++ ++ /* ...that's probably not needed? - tbd */ ++ *dl++ = IMR_OP_SYNCM; + + /* ...set source / destination coordinate precision */ + *dl++ = IMR_OP_WTS(IMR_UVDPOR, __imr_uvdp(type)); + ++ /* ...that's probably not needed? - tbd */ ++ *dl++ = IMR_OP_SYNCM; ++ + /* ...set luminance/chromacity correction parameters precision */ + *dl++ = IMR_OP_WTS(IMR_CPDPOR, __imr_cpdp(type)); + +@@ -776,14 +800,12 @@ static inline void imr_dl_program_setup(struct imr_ctx *ctx, struct imr_cfg *cfg + } + } else { + u16 src_fmt = (iflags & IMR_F_UV_SWAP ? IMR_CMR2_UVFORM : 0) | (iflags & IMR_F_YUV_SWAP ? IMR_CMR2_YUV422FORM : 0); +- u32 dst_fmt = (oflags & IMR_F_YUV_SWAP ? IMR_TRIC_YCFORM : 0); + + /* ...interleaved input; output is either interleaved or planar */ + *dl++ = IMR_OP_WTS(IMR_CMRCSR2, IMR_CMR2_YUV422E | src_fmt); + + /* ...destination is always YUYV or UYVY */ +- *dl++ = IMR_OP_WTL(IMR_TRICR, 1); +- *dl++ = dst_fmt; ++ tricr |= (oflags & IMR_F_YUV_SWAP ? IMR_TRIC_YCFORM : 0); + + /* ...set precision of Y/UV planes and required correction */ + *dl++ = IMR_OP_WTS(IMR_CMRCSR, src_y_fmt | src_uv_fmt | dst_y_fmt | dst_uv_fmt | __imr_clce(type) | __imr_luce(type)); +@@ -810,6 +832,10 @@ static inline void imr_dl_program_setup(struct imr_ctx *ctx, struct imr_cfg *cfg + *dl++ = ((w - 2) << 16) | (w - 1); + *dl++ = h - 1; + ++ /* ...set triangle single color */ ++ *dl++ = IMR_OP_WTL(IMR_TRICR, 1); ++ *dl++ = tricr; ++ + /* ...invoke subroutine for triangles drawing */ + *dl++ = IMR_OP_GOSUB; + *dl++ = subaddr; +@@ -852,7 +878,7 @@ static int imr_ioctl_map(struct imr_ctx *ctx, struct imr_map_desc *desc) + { + struct imr_device *imr = ctx->imr; + struct imr_mesh *mesh; +- struct imr_vbo *vbo; ++ int vbo_num; + struct imr_cfg *cfg; + void *buf, *map; + u32 type; +@@ -925,13 +951,6 @@ static int imr_ioctl_map(struct imr_ctx *ctx, struct imr_map_desc *desc) + tri_length = imr_tri_type_a_get_length(mesh, item_size); + } + } else { +- /* ...assure we have proper VBO descriptor */ +- if (length < sizeof(struct imr_vbo)) { +- v4l2_err(&imr->v4l2_dev, "invalid vbo specification size: %u\n", length); +- ret = -EINVAL; +- goto out; +- } +- + /* ...make sure there is no automatic-generation flags */ + if (type & (IMR_MAP_AUTODG | IMR_MAP_AUTOSG)) { + v4l2_err(&imr->v4l2_dev, "invalid auto-dg/sg flags: 0x%x\n", type); +@@ -939,22 +958,23 @@ static int imr_ioctl_map(struct imr_ctx *ctx, struct imr_map_desc *desc) + goto out; + } + +- vbo = (struct imr_vbo *)buf; +- length -= sizeof(struct imr_vbo); +- map = buf + sizeof(struct imr_vbo); ++ map = buf; + + /* ...vertex is given with absolute coordinates */ + item_size += 8; + ++ /* ...calculate total number of triangles */ ++ vbo_num = length / (3 * item_size); ++ + /* ...check the length is sane */ +- if (length != vbo->num * 3 * item_size) { +- v4l2_err(&imr->v4l2_dev, "invalid vbo size: %u*%u*3 != %u\n", vbo->num, item_size, length); ++ if (length != vbo_num * 3 * item_size) { ++ v4l2_err(&imr->v4l2_dev, "invalid vbo size: %u*%u*3 != %u\n", vbo_num, item_size, length); + ret = -EINVAL; + goto out; + } + + /* ...calculate size of trangles drawing subroutine */ +- tri_length = imr_tri_type_c_get_length(vbo, item_size); ++ tri_length = imr_tri_type_c_get_length(vbo_num, item_size); + } + + /* ...DL main program shall start with 8-byte aligned address */ +@@ -975,13 +995,16 @@ static int imr_ioctl_map(struct imr_ctx *ctx, struct imr_map_desc *desc) + imr_cfg_unref(ctx, ctx->cfg); + + /* ...create new configuration */ +- ctx->cfg = cfg = imr_cfg_create(ctx, dl_size, dl_start_offset); ++ cfg = imr_cfg_create(ctx, dl_size, dl_start_offset); + if (IS_ERR(cfg)) { + ret = PTR_ERR(cfg); ++ ctx->cfg = NULL; + v4l2_err(&imr->v4l2_dev, "failed to create configuration: %d\n", ret); + goto out; + } + ++ ctx->cfg = cfg; ++ + /* ...get pointer to the new display list */ + dl_vaddr = cfg->dl_vaddr; + dl_dma_addr = cfg->dl_dma_addr; +@@ -994,7 +1017,7 @@ static int imr_ioctl_map(struct imr_ctx *ctx, struct imr_map_desc *desc) + imr_tri_set_type_a(dl_vaddr, map, mesh, item_size); + } + } else { +- imr_tri_set_type_c(dl_vaddr, map, vbo, item_size); ++ imr_tri_set_type_c(dl_vaddr, map, vbo_num, item_size); + } + + /* ...prepare main DL-program */ +@@ -1020,6 +1043,66 @@ static int imr_ioctl_map(struct imr_ctx *ctx, struct imr_map_desc *desc) + return ret; + } + ++/* ...set mapping data (function called with video device lock held) */ ++static int imr_ioctl_map_raw(struct imr_ctx *ctx, struct imr_map_desc *desc) ++{ ++ struct imr_device *imr = ctx->imr; ++ u32 type = desc->type; ++ u32 length = desc->size; ++ struct imr_cfg *cfg; ++ void *dl_vaddr; ++ u32 dl_size; ++ u32 dl_start_offset; ++ dma_addr_t dl_dma_addr; ++ ++ /* ...calculate main routine length */ ++ dl_size = imr_dl_program_length(ctx); ++ if (!dl_size) { ++ v4l2_err(&imr->v4l2_dev, "format configuration error\n"); ++ return -EINVAL; ++ } ++ ++ /* ...unref current configuration (will not be used by subsequent jobs) */ ++ imr_cfg_unref(ctx, ctx->cfg); ++ ++ /* ...create new configuration (starts with zero offset) */ ++ cfg = imr_cfg_create(ctx, dl_size, 0); ++ if (IS_ERR(cfg)) { ++ ctx->cfg = NULL; ++ v4l2_err(&imr->v4l2_dev, "failed to create configuration: %ld\n", PTR_ERR(cfg)); ++ return PTR_ERR(cfg); ++ } ++ ++ ctx->cfg = cfg; ++ ++ /* ...get pointer to the new display list */ ++ dl_vaddr = cfg->dl_vaddr; ++ ++ /* ...prepare main DL-program */ ++ imr_dl_program_setup(ctx, cfg, type, dl_vaddr, (u32)(uintptr_t)desc->data); ++ ++ /* ...update cropping parameters */ ++ cfg->dst_subpixel = (type & IMR_MAP_DDP ? 2 : 0); ++ ++ /* ...display list updated successfully */ ++ v4l2_dbg(2, debug, &ctx->imr->v4l2_dev, "display-list created: #%u[%08X]:%u[%u]\n", ++ cfg->id, (u32)dl_dma_addr, dl_size, 0); ++ ++ if (debug >= 4) ++ print_hex_dump_bytes("DL-", DUMP_PREFIX_OFFSET, dl_vaddr + dl_start_offset, dl_size - dl_start_offset); ++ ++ /* ...success */ ++ return 0; ++} ++ ++/* ...set mapping data (function called with video device lock held) */ ++static int imr_ioctl_color(struct imr_ctx *ctx, u32 color) ++{ ++ ctx->color = color; ++ ++ return 0; ++} ++ + /******************************************************************************* + * V4L2 I/O controls + ******************************************************************************/ +@@ -1183,7 +1266,7 @@ static int imr_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) + WARN_ON(!mutex_is_locked(&ctx->imr->mutex)); + + /* ...verify the configuration is complete */ +- if (!V4L2_TYPE_IS_OUTPUT(buf->type) && !ctx->cfg) { ++ if (!ctx->cfg) { + v4l2_err(&ctx->imr->v4l2_dev, "stream configuration is not complete\n"); + return -EINVAL; + } +@@ -1265,6 +1348,14 @@ static long imr_default(struct file *file, void *fh, bool valid_prio, unsigned i + /* ...set mesh data */ + return imr_ioctl_map(ctx, (struct imr_map_desc *)arg); + ++ case VIDIOC_IMR_MESH_RAW: ++ /* ...set mesh data */ ++ return imr_ioctl_map_raw(ctx, (struct imr_map_desc *)arg); ++ ++ case VIDIOC_IMR_COLOR: ++ /* ...set solid color code */ ++ return imr_ioctl_color(ctx, *(u32 *)arg); ++ + default: + return -ENOIOCTLCMD; + } +@@ -1326,6 +1417,9 @@ static int imr_open(struct file *file) + /* ...set default cropping parameters */ + ctx->crop[1] = ctx->crop[3] = 0x3FF; + ++ /* ...set default color */ ++ ctx->color = 0x808080; ++ + /* ...initialize M2M processing context */ + ctx->m2m_ctx = v4l2_m2m_ctx_init(imr->m2m_dev, ctx, imr_queue_init); + if (IS_ERR(ctx->m2m_ctx)) { +@@ -1418,8 +1512,11 @@ static unsigned int imr_poll(struct file *file, struct poll_table_struct *wait) + return -ERESTARTSYS; + + res = v4l2_m2m_poll(file, ctx->m2m_ctx, wait); ++ + mutex_unlock(&imr->mutex); + ++ v4l2_dbg(3, debug, &imr->v4l2_dev, "poll result: %X (ctx=%p)\n", res, ctx); ++ + return res; + } + +@@ -1453,7 +1550,6 @@ static const struct v4l2_file_operations imr_fops = { + * M2M device interface + ******************************************************************************/ + +-#if 0 + /* ...job cleanup function */ + static void imr_cleanup(struct imr_ctx *ctx) + { +@@ -1473,17 +1569,16 @@ static void imr_cleanup(struct imr_ctx *ctx) + /* ...release lock before we mark current job as finished */ + spin_unlock_irqrestore(&imr->lock, flags); + } +-#endif + + /* ...job execution function */ + static void imr_device_run(void *priv) + { +- struct imr_ctx *ctx = priv; +- struct imr_device *imr = ctx->imr; +- struct imr_cfg *cfg; +- struct vb2_buffer *src_buf, *dst_buf; +- u32 src_addr, dst_addr; +- unsigned long flags; ++ struct imr_ctx *ctx = priv; ++ struct imr_device *imr = ctx->imr; ++ struct imr_cfg *cfg; ++ struct vb2_v4l2_buffer *src_buf, *dst_buf; ++ u32 src_addr, dst_addr; ++ unsigned long flags; + + v4l2_dbg(3, debug, &imr->v4l2_dev, "run next job...\n"); + +@@ -1494,8 +1589,11 @@ static void imr_device_run(void *priv) + src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx); + dst_buf = v4l2_m2m_next_dst_buf(ctx->m2m_ctx); + ++ /* ...put source/destination buffers sequence numbers */ ++ dst_buf->sequence = src_buf->sequence = ctx->sequence++; ++ + /* ...take configuration pointer associated with input buffer */ +- cfg = to_imr_buffer(to_vb2_v4l2_buffer(src_buf))->cfg; ++ cfg = to_imr_buffer(src_buf)->cfg; + + /* ...cancel software reset state as needed */ + iowrite32(0, imr->mmio + IMR_CR); +@@ -1507,8 +1605,8 @@ static void imr_device_run(void *priv) + iowrite32(ctx->crop[3] << cfg->dst_subpixel, imr->mmio + IMR_YMAXR); + + /* ...adjust source/destination parameters of the program (interleaved / semiplanar) */ +- *cfg->src_pa_ptr[0] = src_addr = (u32)vb2_dma_contig_plane_dma_addr(src_buf, 0); +- *cfg->dst_pa_ptr[0] = dst_addr = (u32)vb2_dma_contig_plane_dma_addr(dst_buf, 0); ++ *cfg->src_pa_ptr[0] = src_addr = (u32)vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0); ++ *cfg->dst_pa_ptr[0] = dst_addr = (u32)vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0); + + /* ...adjust source/destination parameters of the UV-plane as needed */ + if (cfg->src_pa_ptr[1] && cfg->dst_pa_ptr[1]) { +@@ -1529,6 +1627,9 @@ static void imr_device_run(void *priv) + /* ...set display list address */ + iowrite32(cfg->dl_dma_addr + cfg->dl_start_offset, imr->mmio + IMR_DLSAR); + ++ /* ...enable texture prefetching */ ++ iowrite32(0xACCE5501, imr->mmio + IMR_TPOR); ++ + /* ...explicitly flush any pending write operations (don't need that, I guess) */ + wmb(); + +@@ -1536,7 +1637,7 @@ static void imr_device_run(void *priv) + iowrite32(IMR_CR_RS, imr->mmio + IMR_CR); + + /* ...timestamp input buffer */ +- src_buf->timestamp = ktime_get_ns(); ++ src_buf->vb2_buf.timestamp = ktime_get_ns(); + + /* ...unlock device access */ + spin_unlock_irqrestore(&imr->lock, flags); +@@ -1633,13 +1734,14 @@ static irqreturn_t imr_irq_handler(int irq, void *data) + dst_buf->timecode = src_buf->timecode; + dst_buf->flags = src_buf->flags & (V4L2_BUF_FLAG_TIMECODE | V4L2_BUF_FLAG_KEYFRAME | + V4L2_BUF_FLAG_PFRAME | V4L2_BUF_FLAG_BFRAME | V4L2_BUF_FLAG_TSTAMP_SRC_MASK); +- dst_buf->sequence = src_buf->sequence = ctx->sequence++; ++ //dst_buf->sequence = src_buf->sequence = ctx->sequence++; ++ + v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE); + v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_DONE); + +- v4l2_dbg(3, debug, &imr->v4l2_dev, "buffers <0x%08x,0x%08x> done\n", ++ v4l2_dbg(3, debug, &imr->v4l2_dev, "buffers <0x%08x,0x%08x> done (ctx=%p)\n", + (u32)vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0), +- (u32)vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0)); ++ (u32)vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0), ctx); + } else { + /* ...operation completed in error; no way to understand what exactly went wrong */ + v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); +@@ -1668,6 +1770,8 @@ static irqreturn_t imr_irq_handler(int irq, void *data) + * Device probing / removal interface + ******************************************************************************/ + ++static struct class *imr_alloc_class; ++ + static int imr_probe(struct platform_device *pdev) + { + struct imr_device *imr; +@@ -1727,6 +1831,26 @@ static int imr_probe(struct platform_device *pdev) + goto device_register_rollback; + } + ++ if (!imr_alloc_class) { ++ imr_alloc_class = class_create(THIS_MODULE, "imr-alloc"); ++ if (IS_ERR(imr_alloc_class)) { ++ v4l2_err(&imr->v4l2_dev, "Failed to create alloc-device class\n"); ++ ret = PTR_ERR(imr_alloc_class); ++ goto m2m_init_rollback; ++ } ++ } ++ ++ struct device *adev = device_create(imr_alloc_class, imr->dev, MKDEV(0, 0), NULL, "%s_alloc", dev_name(&pdev->dev)); ++ if (IS_ERR(adev)) { ++ v4l2_err(&imr->v4l2_dev, "Failed to create alloc-device\n"); ++ ret = PTR_ERR(adev); ++ goto m2m_init_rollback; ++ } ++ adev->dma_mask = &adev->coherent_dma_mask; ++ adev->coherent_dma_mask = DMA_BIT_MASK(32); ++ arch_setup_dma_ops(adev, 0, DMA_BIT_MASK(32) + 1, NULL, true); ++ imr->alloc_dev = adev; ++ + strlcpy(imr->video_dev.name, dev_name(&pdev->dev), sizeof(imr->video_dev.name)); + imr->video_dev.fops = &imr_fops; + imr->video_dev.ioctl_ops = &imr_ioctl_ops; +@@ -1765,6 +1889,7 @@ static int imr_remove(struct platform_device *pdev) + + //pm_runtime_disable(imr->v4l2_dev.dev); + video_unregister_device(&imr->video_dev); ++ //device_destroy(imr->alloc_dev, MKDEV(0, 0)); + v4l2_m2m_release(imr->m2m_dev); + v4l2_device_unregister(&imr->v4l2_dev); + +diff --git a/include/uapi/linux/rcar-imr.h b/include/uapi/linux/rcar-imr.h +index d02082f..7b8ed0c 100644 +--- a/include/uapi/linux/rcar-imr.h ++++ b/include/uapi/linux/rcar-imr.h +@@ -48,6 +48,12 @@ struct imr_map_desc { + /* ...vertex clockwise-mode order */ + #define IMR_MAP_TCM (1 << 5) + ++/* ...texture mapping enable flag */ ++#define IMR_MAP_TME (1 << 6) ++ ++/* ...bilinear filtration enable flag */ ++#define IMR_MAP_BFE (1 << 7) ++ + /* ...source coordinate decimal point position bit index */ + #define __IMR_MAP_UVDPOR_SHIFT 8 + #define __IMR_MAP_UVDPOR(v) (((v) >> __IMR_MAP_UVDPOR_SHIFT) & 0x7) +@@ -81,18 +87,12 @@ struct imr_mesh { + + } __attribute__((packed)); + +-/* ...VBO descriptor */ +-struct imr_vbo { +- /* ...number of triangles */ +- u16 num; +- +-} __attribute__((packed)); +- +- + /******************************************************************************* + * Private IOCTL codes + ******************************************************************************/ + + #define VIDIOC_IMR_MESH _IOW('V', BASE_VIDIOC_PRIVATE + 0, struct imr_map_desc) ++#define VIDIOC_IMR_MESH_RAW _IOW('V', BASE_VIDIOC_PRIVATE + 1, struct imr_map_desc) ++#define VIDIOC_IMR_COLOR _IOW('V', BASE_VIDIOC_PRIVATE + 2, u32) + + #endif /* RCAR_IMR_USER_H */ +-- +2.7.4 + diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend index 57a1ee6..d73c1e3 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend @@ -69,6 +69,12 @@ SRC_URI_append = " \ file://0079-ASoC-fix-pcm-creation-regression.patch \ " +SRC_URI_append_r8a7797 = " \ + file://0103-gpu-drm-rcar-du-Extend-VSP1-DRM-interface.patch \ + file://0104-media-vsp1-extend-DRM-VSP1-interface.patch \ + file://0105-media-rcar-imr-IMR-driver-updates-for-raw-DL.patch \ +" + SRC_URI_append_h3ulcb = " file://ulcb.cfg" SRC_URI_append_m3ulcb = " file://ulcb.cfg" SRC_URI_append_salvator-x = " file://salvator-x.cfg" -- cgit 1.2.3-korg From 366a422ea9e228fe2cb20338ce5a2bd8ac396af6 Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Fri, 17 Nov 2017 13:22:57 +0300 Subject: V3M: add V3MSK board in uboot Support eMMC, QSPI, Ether, reset, CPLD, console --- meta-rcar-gen3-adas/conf/machine/v3msk.conf | 2 +- .../0017-board-renesas-Add-V3MSK-board.patch | 813 +++++++++++++++++++++ .../recipes-bsp/u-boot/u-boot_2015.04.bbappend | 1 + 3 files changed, 815 insertions(+), 1 deletion(-) create mode 100644 meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0017-board-renesas-Add-V3MSK-board.patch (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/machine/v3msk.conf b/meta-rcar-gen3-adas/conf/machine/v3msk.conf index a86470e..75292c1 100644 --- a/meta-rcar-gen3-adas/conf/machine/v3msk.conf +++ b/meta-rcar-gen3-adas/conf/machine/v3msk.conf @@ -26,7 +26,7 @@ KERNEL_DEVICETREE = "renesas/r8a7797-v3msk.dtb" # u-boot PREFERRED_VERSION_u-boot = "v2015.04%" EXTRA_IMAGEDEPENDS += " u-boot" -UBOOT_MACHINE = "r8a7797_eagle_defconfig" +UBOOT_MACHINE = "v3msk_defconfig" # libdrm PREFERRED_VERSION_libdrm = "2.4.68" diff --git a/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0017-board-renesas-Add-V3MSK-board.patch b/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0017-board-renesas-Add-V3MSK-board.patch new file mode 100644 index 0000000..e10bf40 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0017-board-renesas-Add-V3MSK-board.patch @@ -0,0 +1,813 @@ +From 2e9bb759bda6ce52a446c2b7f7d79d51140c4316 Mon Sep 17 00:00:00 2001 +From: Vladimir Barinov +Date: Fri, 17 Nov 2017 13:01:38 +0300 +Subject: [PATCH] board: renesas: Add V3M Starter Kit board + +V3M Starter Kit is a board based on R-Car V3M SoC (R8A7797) + +Signed-off-by: Vladimir Barinov +--- + arch/arm/cpu/armv8/Kconfig | 4 + + board/renesas/v3msk/Kconfig | 15 +++ + board/renesas/v3msk/MAINTAINERS | 6 ++ + board/renesas/v3msk/Makefile | 9 ++ + board/renesas/v3msk/cpld.c | 164 +++++++++++++++++++++++++++++++ + board/renesas/v3msk/mdio_bb.h | 156 ++++++++++++++++++++++++++++++ + board/renesas/v3msk/v3msk.c | 209 ++++++++++++++++++++++++++++++++++++++++ + configs/v3msk_defconfig | 9 ++ + include/configs/v3msk.h | 145 ++++++++++++++++++++++++++++ + 9 files changed, 717 insertions(+) + create mode 100644 board/renesas/v3msk/Kconfig + create mode 100644 board/renesas/v3msk/MAINTAINERS + create mode 100644 board/renesas/v3msk/Makefile + create mode 100644 board/renesas/v3msk/cpld.c + create mode 100644 board/renesas/v3msk/mdio_bb.h + create mode 100644 board/renesas/v3msk/v3msk.c + create mode 100644 configs/v3msk_defconfig + create mode 100644 include/configs/v3msk.h + +diff --git a/arch/arm/cpu/armv8/Kconfig b/arch/arm/cpu/armv8/Kconfig +index fb2806d..761f4e6 100644 +--- a/arch/arm/cpu/armv8/Kconfig ++++ b/arch/arm/cpu/armv8/Kconfig +@@ -19,6 +19,9 @@ config TARGET_ULCB + config TARGET_EAGLE + bool "EAGLE board" + ++config TARGET_V3MSK ++ bool "V3MSK board" ++ + endchoice + + choice +@@ -41,5 +44,6 @@ config SYS_SOC + source "board/renesas/salvator-x/Kconfig" + source "board/renesas/ulcb/Kconfig" + source "board/renesas/eagle/Kconfig" ++source "board/renesas/v3msk/Kconfig" + + endif +diff --git a/board/renesas/v3msk/Kconfig b/board/renesas/v3msk/Kconfig +new file mode 100644 +index 0000000..dafbaef +--- /dev/null ++++ b/board/renesas/v3msk/Kconfig +@@ -0,0 +1,15 @@ ++if TARGET_V3MSK ++ ++config SYS_SOC ++ default "rcar_gen3" ++ ++config SYS_BOARD ++ default "v3msk" ++ ++config SYS_VENDOR ++ default "renesas" ++ ++config SYS_CONFIG_NAME ++ default "v3msk" if R8A7797 ++ ++endif +diff --git a/board/renesas/v3msk/MAINTAINERS b/board/renesas/v3msk/MAINTAINERS +new file mode 100644 +index 0000000..c39eb76 +--- /dev/null ++++ b/board/renesas/v3msk/MAINTAINERS +@@ -0,0 +1,6 @@ ++V3MSK BOARD ++M: Cogent Embedded, Inc. ++S: Maintained ++F: board/renesas/v3msk/ ++F: include/configs/r8a7797_v3msk.h ++F: configs/r8a7797_v3msk_defconfig +diff --git a/board/renesas/v3msk/Makefile b/board/renesas/v3msk/Makefile +new file mode 100644 +index 0000000..1f2ea42 +--- /dev/null ++++ b/board/renesas/v3msk/Makefile +@@ -0,0 +1,9 @@ ++# ++# board/renesas/v3msk/Makefile ++# ++# Copyright (C) 2017 Cogent Embedded, Inc. ++# ++# SPDX-License-Identifier: GPL-2.0+ ++# ++ ++obj-y := v3msk.o ../rcar-gen3-common/common.o cpld.o +diff --git a/board/renesas/v3msk/cpld.c b/board/renesas/v3msk/cpld.c +new file mode 100644 +index 0000000..ffb0637 +--- /dev/null ++++ b/board/renesas/v3msk/cpld.c +@@ -0,0 +1,164 @@ ++/* ++ * V3MSK board CPLD access support ++ * ++ * Copyright (C) 2017 Renesas Electronics Corporation ++ * Copyright (C) 2017 Cogent Embedded, Inc. ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define ENABLEZ GPIO_GP_1_19 ++#define MDC GPIO_GP_1_21 ++#define MOSI GPIO_GP_1_22 ++#define MISO GPIO_GP_1_23 ++ ++#define ADDR_PRODUCT_L 0x000 /* R */ ++#define ADDR_PRODUCT_H 0x001 /* R */ ++#define ADDR_CPLD_VERSION_D 0x002 /* R */ ++#define ADDR_CPLD_VERSION_Y 0x003 /* R */ ++#define ADDR_MODE_SET_L 0x004 /* R/W */ ++#define ADDR_MODE_SET_H 0x005 /* R/W */ ++#define ADDR_MODE_APPLIED_L 0x006 /* R */ ++#define ADDR_MODE_APPLIED_H 0x007 /* R */ ++#define ADDR_DIPSW 0x008 /* R */ ++#define ADDR_RESET 0x00A /* R/W */ ++#define ADDR_POWER_CFG 0x00B /* R/W */ ++#define ADDR_PERI_CFG1 0x00C /* R/W */ ++#define ADDR_PERI_CFG2 0x00D /* R/W */ ++#define ADDR_LEDS 0x00E /* R/W */ ++#define ADDR_PCB_VERSION 0x300 /* R */ ++#define ADDR_SOC_VERSION 0x301 /* R */ ++#define ADDR_PCB_SN_L 0x302 /* R */ ++#define ADDR_PCB_SN_H 0x303 /* R */ ++ ++/* LSI pin pull-up control */ ++#define PFC_PUEN2 0xe6060408 ++#define PUEN_CANFD1_TX (1 << 29) ++ ++#define MDIO_DELAY 10 /* microseconds */ ++ ++#define mdio_bb_active_mdio() gpio_direction_output(MOSI, 0) ++#define mdio_bb_tristate_mdio() gpio_direction_input(MOSI) ++#define mdio_bb_set_mdio(val) gpio_set_value(MOSI, val) ++#define mdio_bb_get_mdio() gpio_get_value(MISO) ++#define mdio_bb_set_mdc(val) gpio_set_value(MDC, val) ++ ++#include "mdio_bb.h" ++ ++static int cpld_initialized; ++ ++static u16 cpld_read(u16 addr) ++{ ++ /* random flash reads require 2 reads: first read is unreliable */ ++ if (addr >= ADDR_PCB_VERSION) ++ mdio_bb_read(addr >> 5, addr & 0x1f); ++ ++ return mdio_bb_read(addr >> 5, addr & 0x1f); ++} ++ ++static void cpld_write(u16 addr, u16 data) ++{ ++ mdio_bb_write(addr >> 5, addr & 0x1f, data); ++} ++ ++static void cpld_init(void) ++{ ++ if (cpld_initialized) ++ return; ++ ++ cpld_initialized = 1; ++#if 0 ++ /* PULL-UP on MISO line (should be pulled up after POR on V3M) */ ++ writel(readl(PFC_PUEN2) | PUEN_CANFD1_TX, PFC_PUEN2); ++#endif ++ gpio_request(MDC, NULL); ++ gpio_request(ENABLEZ, NULL); ++ gpio_request(MOSI, NULL); ++ gpio_request(MISO, NULL); ++ ++ gpio_direction_output(MDC, 0); ++ gpio_direction_output(ENABLEZ, 0); ++ gpio_direction_output(MOSI, 0); ++ gpio_direction_input(MISO); ++ ++ /* V3MSK Videobox Mini board has CANFD PHY connected ++ * we must shutdown this chip to use bb pins ++ */ ++ gpio_request(GPIO_GP_0_12, NULL); ++ gpio_direction_output(GPIO_GP_0_12, 1); ++} ++ ++static int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ++{ ++ u16 addr, val; ++ ++ cpld_init(); ++ ++ if (argc == 2 && strcmp(argv[1], "info") == 0) { ++ printf("Product: 0x%08x\n", ++ (cpld_read(ADDR_PRODUCT_H) << 16) | ++ cpld_read(ADDR_PRODUCT_L)); ++ printf("CPLD version: 0x%08x\n", ++ (cpld_read(ADDR_CPLD_VERSION_Y) << 16) | ++ cpld_read(ADDR_CPLD_VERSION_D)); ++ printf("Mode setting (MD0..26): 0x%08x\n", ++ (cpld_read(ADDR_MODE_APPLIED_H) << 16) | ++ cpld_read(ADDR_MODE_APPLIED_L)); ++ printf("DIPSW (SW4, SW5): 0x%02x, 0x%x\n", ++ (cpld_read(ADDR_DIPSW) & 0xff) ^ 0xff, ++ (cpld_read(ADDR_DIPSW) >> 8) ^ 0xf); ++ printf("Power config: 0x%08x\n", ++ cpld_read(ADDR_POWER_CFG)); ++ printf("Periferals config: 0x%08x\n", ++ (cpld_read(ADDR_PERI_CFG2) << 16) | ++ cpld_read(ADDR_PERI_CFG1)); ++ printf("PCB version: %d.%d\n", ++ cpld_read(ADDR_PCB_VERSION) >> 8, ++ cpld_read(ADDR_PCB_VERSION) & 0xff); ++ printf("SOC version: %d.%d\n", ++ cpld_read(ADDR_SOC_VERSION) >> 8, ++ cpld_read(ADDR_SOC_VERSION) & 0xff); ++ printf("PCB S/N: %d\n", ++ (cpld_read(ADDR_PCB_SN_H) << 16 ) | ++ cpld_read(ADDR_PCB_SN_L)); ++ return 0; ++ } ++ ++ if (argc < 3) ++ return CMD_RET_USAGE; ++ ++ addr = simple_strtoul(argv[2], NULL, 16); ++ if (!(addr >= ADDR_PRODUCT_L && addr <= ADDR_LEDS)) { ++ printf("cpld invalid addr\n"); ++ return CMD_RET_USAGE; ++ } ++ ++ if (argc == 3 && strcmp(argv[1], "read") == 0) { ++ printf("0x%x\n", cpld_read(addr)); ++ } else if (argc == 4 && strcmp(argv[1], "write") == 0) { ++ val = simple_strtoul(argv[3], NULL, 16); ++ cpld_write(addr, val); ++ } ++ ++ return 0; ++} ++ ++U_BOOT_CMD( ++ cpld, 4, 1, do_cpld, ++ "CPLD access", ++ "info\n" ++ "cpld read addr\n" ++ "cpld write addr val\n" ++); ++ ++void reset_cpu(ulong addr) ++{ ++ cpld_init(); ++ cpld_write(ADDR_RESET, 1); ++} +diff --git a/board/renesas/v3msk/mdio_bb.h b/board/renesas/v3msk/mdio_bb.h +new file mode 100644 +index 0000000..0311006 +--- /dev/null ++++ b/board/renesas/v3msk/mdio_bb.h +@@ -0,0 +1,156 @@ ++/* ++ * Bit-banged MDIO interface ++ * ++ * Copyright (C) 2017 Cogent Embedded, Inc. ++ * based on drivers/net/phy/miiphybb.c ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++ ++static void mdio_bb_delay(void) ++{ ++ udelay(MDIO_DELAY); ++} ++ ++/* Send the preamble, address, and register (common to read and write) */ ++static void mdio_bb_pre(u8 op, u8 addr, u8 reg) ++{ ++ int i; ++ ++ /* 32-bit preamble */ ++ mdio_bb_active_mdio(); ++ mdio_bb_set_mdio(1); ++ for (i = 0; i < 32; i++) { ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ } ++ /* send the ST (2-bits of '01') */ ++ mdio_bb_set_mdio(0); ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ mdio_bb_set_mdio(1); ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ /* send the OP (2-bits of Opcode: '10'-read, '01'-write) */ ++ mdio_bb_set_mdio(op >> 1); ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ mdio_bb_set_mdio(op & 1); ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ /* send the PA5 (5-bits of PHY address) */ ++ for (i = 0; i < 5; i++) { ++ mdio_bb_set_mdio(addr & 0x10); /* MSB first */ ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ addr <<= 1; ++ } ++ /* send the RA5 (5-bits of register address) */ ++ for (i = 0; i < 5; i++) { ++ mdio_bb_set_mdio(reg & 0x10); /* MSB first */ ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ reg <<= 1; ++ } ++} ++ ++static int mdio_bb_read(u8 addr, u8 reg) ++{ ++ int i; ++ u16 data = 0; ++ ++ mdio_bb_pre(2, addr, reg); ++ /* tri-state MDIO */ ++ mdio_bb_tristate_mdio(); ++ /* read TA (2-bits of turn-around, last bit must be '0') */ ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ /* check the turnaround bit: the PHY should drive line to zero */ ++ if (mdio_bb_get_mdio() != 0) { ++ printf ("PHY didn't drive TA low\n"); ++ for (i = 0; i < 32; i++) { ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ } ++ /* There is no PHY, set value to 0xFFFF */ ++ return 0xFFFF; ++ } ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ /* read 16-bits of data */ ++ for (i = 0; i < 16; i++) { ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ data <<= 1; ++ data |= mdio_bb_get_mdio(); ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ } ++ ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++#ifdef DEBUG ++ printf("cpld_read(0x%x) @ 0x%x = 0x%04x\n", reg, addr, data); ++#endif ++ return data; ++} ++ ++static void mdio_bb_write(u8 addr, u8 reg, u16 val) ++{ ++ int i; ++ ++ mdio_bb_pre(1, addr, reg); ++ /* send the TA (2-bits of turn-around '10') */ ++ mdio_bb_set_mdio(1); ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ mdio_bb_set_mdio(0); ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ /* write 16-bits of data */ ++ for (i = 0; i < 16; i++) { ++ mdio_bb_set_mdio(val & 0x8000); /* MSB first */ ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++ val <<= 1; ++ } ++ /* tri-state MDIO */ ++ mdio_bb_tristate_mdio(); ++ mdio_bb_set_mdc(0); ++ mdio_bb_delay(); ++ mdio_bb_set_mdc(1); ++ mdio_bb_delay(); ++} +diff --git a/board/renesas/v3msk/v3msk.c b/board/renesas/v3msk/v3msk.c +new file mode 100644 +index 0000000..b0de041 +--- /dev/null ++++ b/board/renesas/v3msk/v3msk.c +@@ -0,0 +1,209 @@ ++/* ++ * board/renesas/v3msk/v3msk.c ++ * This is V3MSK board support. ++ * ++ * Copyright (C) 2017 Cogent Embedded, Inc. ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++DECLARE_GLOBAL_DATA_PTR; ++ ++#define SCIF0_MSTP207 (1 << 7) ++#define ETHERAVB_MSTP812 (1 << 12) ++#define RPC_MSTP917 (1 << 17) ++#define SD0_MSTP314 (1 << 14) ++ ++#define SD0CKCR 0xE6150074 ++ ++#define CLK2MHZ(clk) (clk / 1000 / 1000) ++void s_init(void) ++{ ++ struct rcar_rwdt *rwdt = (struct rcar_rwdt *)RWDT_BASE; ++ struct rcar_swdt *swdt = (struct rcar_swdt *)SWDT_BASE; ++ u32 stc; ++ ++ /* Watchdog init */ ++ writel(0xA5A5A500, &rwdt->rwtcsra); ++ writel(0xA5A5A500, &swdt->swtcsra); ++ ++ /* CPU frequency setting. Set to 0.8GHz */ ++ stc = ((800 / CLK2MHZ(CONFIG_SYS_CLK_FREQ)) - 1) << PLL0_STC_BIT; ++ clrsetbits_le32(PLL0CR, PLL0_STC_MASK, stc); ++} ++ ++int board_early_init_f(void) ++{ ++ int freq; ++ ++ rcar_prr_init(); ++ ++ writel(0xa5a5ffff, 0xe6150900); ++ writel(0x5a5a0000, 0xe6150904); ++ mstp_clrbits_le32(MSTPSR1, SMSTPCR1, 0x02000000); ++ /* SCIF0 */ ++ mstp_clrbits_le32(MSTPSR2, SMSTPCR2, SCIF0_MSTP207); ++ /* SDHI0/MMC */ ++ mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SD0_MSTP314); ++ /* EHTERAVB */ ++ mstp_clrbits_le32(MSTPSR8, SMSTPCR8, ETHERAVB_MSTP812); ++ /* QSPI/RPC */ ++ mstp_clrbits_le32(MSTPSR9, SMSTPCR9, RPC_MSTP917); ++ ++ freq = rcar_get_sdhi_config_clk(); ++ writel(freq, SD0CKCR); ++ ++ return 0; ++} ++ ++int board_init(void) ++{ ++ /* adress of boot parameters */ ++ gd->bd->bi_boot_params = CONFIG_SYS_TEXT_BASE + 0x50000; ++ ++ /* Init PFC controller */ ++ pinmux_init(); ++#ifdef CONFIG_RAVB ++ /* GPSR1 */ ++ gpio_request(GPIO_GFN_AVB0_AVTP_CAPTURE, NULL); ++ gpio_request(GPIO_FN_AVB0_AVTP_MATCH, NULL); ++ gpio_request(GPIO_FN_AVB0_LINK, NULL); ++ gpio_request(GPIO_FN_AVB0_PHY_INT, NULL); ++ /* gpio_request(GPIO_FN_AVB0_MAGIC, NULL); */ ++ gpio_request(GPIO_FN_AVB0_MDC, NULL); ++ gpio_request(GPIO_FN_AVB0_MDIO, NULL); ++ gpio_request(GPIO_FN_AVB0_TXCREFCLK, NULL); ++ gpio_request(GPIO_FN_AVB0_TD3, NULL); ++ gpio_request(GPIO_FN_AVB0_TD2, NULL); ++ gpio_request(GPIO_FN_AVB0_TD1, NULL); ++ gpio_request(GPIO_FN_AVB0_TD0, NULL); ++ gpio_request(GPIO_FN_AVB0_TXC, NULL); ++ gpio_request(GPIO_FN_AVB0_TX_CTL, NULL); ++ gpio_request(GPIO_FN_AVB0_RD3, NULL); ++ gpio_request(GPIO_FN_AVB0_RD2, NULL); ++ gpio_request(GPIO_FN_AVB0_RD1, NULL); ++ gpio_request(GPIO_FN_AVB0_RD0, NULL); ++ gpio_request(GPIO_FN_AVB0_RXC, NULL); ++ gpio_request(GPIO_FN_AVB0_RX_CTL, NULL); ++ /* IPSR7 */ ++ gpio_request(GPIO_IFN_AVB0_AVTP_CAPTURE, NULL); ++ /* IPSR3 */ ++ gpio_request(GPIO_FN_AVB0_AVTP_PPS, NULL); ++#endif ++ /* QSPI/RPC */ ++ gpio_request(GPIO_FN_QSPI0_SPCLK, NULL); ++ gpio_request(GPIO_FN_QSPI0_MOSI_IO0, NULL); ++ gpio_request(GPIO_FN_QSPI0_MISO_IO1, NULL); ++ gpio_request(GPIO_FN_QSPI0_IO2, NULL); ++ gpio_request(GPIO_FN_QSPI0_IO3, NULL); ++ gpio_request(GPIO_FN_QSPI0_SSL, NULL); ++ gpio_request(GPIO_FN_QSPI1_SPCLK, NULL); ++ gpio_request(GPIO_FN_QSPI1_MOSI_IO0, NULL); ++ gpio_request(GPIO_FN_QSPI1_MISO_IO1, NULL); ++ gpio_request(GPIO_FN_QSPI1_IO2, NULL); ++ gpio_request(GPIO_FN_QSPI1_IO3, NULL); ++ gpio_request(GPIO_FN_QSPI1_SSL, NULL); ++ gpio_request(GPIO_FN_RPC_RESET_N, NULL); ++ gpio_request(GPIO_FN_RPC_WP_N, NULL); ++ gpio_request(GPIO_FN_RPC_INT_N, NULL); ++ ++ return 0; ++} ++ ++#define MAHR 0xE68005C0 ++#define MALR 0xE68005C8 ++int board_eth_init(bd_t *bis) ++{ ++ int ret = -ENODEV; ++ u32 val; ++ unsigned char enetaddr[6]; ++ ++ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) ++ return ret; ++ ++ /* Set Mac address */ ++ val = enetaddr[0] << 24 | enetaddr[1] << 16 | ++ enetaddr[2] << 8 | enetaddr[3]; ++ writel(val, MAHR); ++ ++ val = enetaddr[4] << 8 | enetaddr[5]; ++ writel(val, MALR); ++#ifdef CONFIG_RAVB ++ ret = ravb_initialize(bis); ++#endif ++ return ret; ++} ++ ++/* V3MSK has KSZ9031RNX */ ++int board_phy_config(struct phy_device *phydev) ++{ ++ return 0; ++} ++ ++int board_mmc_init(bd_t *bis) ++{ ++ int ret = -ENODEV; ++#ifdef CONFIG_SH_SDHI ++ /* SDHI2/eMMC */ ++ gpio_request(GPIO_FN_MMC_D0, NULL); ++ gpio_request(GPIO_FN_MMC_D1, NULL); ++ gpio_request(GPIO_FN_MMC_D2, NULL); ++ gpio_request(GPIO_FN_MMC_D3, NULL); ++ gpio_request(GPIO_FN_MMC_D4, NULL); ++ gpio_request(GPIO_FN_MMC_D5, NULL); ++ gpio_request(GPIO_FN_MMC_D6, NULL); ++ gpio_request(GPIO_FN_MMC_D7, NULL); ++ gpio_request(GPIO_FN_MMC_CLK, NULL); ++ gpio_request(GPIO_FN_MMC_CMD, NULL); ++ gpio_request(GPIO_FN_MMC_CD, NULL); ++ gpio_request(GPIO_FN_MMC_WP, NULL); ++ ++ ret = sh_sdhi_init(CONFIG_SYS_SH_SDHI2_BASE, 0, ++ SH_SDHI_QUIRK_64BIT_BUF); ++#endif ++ return ret; ++} ++ ++int dram_init(void) ++{ ++ gd->ram_size = PHYS_SDRAM_1_SIZE; ++ ++ return 0; ++} ++ ++void dram_init_banksize(void) ++{ ++ gd->bd->bi_dram[0].start = PHYS_SDRAM_1; ++ gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; ++} ++ ++const struct rcar_sysinfo sysinfo = { ++ CONFIG_RCAR_BOARD_STRING ++}; ++ ++#if defined(CONFIG_DISPLAY_BOARDINFO) ++int checkboard(void) ++{ ++ printf("Board: %s\n", sysinfo.board_string); ++ return 0; ++} ++#endif +diff --git a/configs/v3msk_defconfig b/configs/v3msk_defconfig +new file mode 100644 +index 0000000..d32840c +--- /dev/null ++++ b/configs/v3msk_defconfig +@@ -0,0 +1,9 @@ ++CONFIG_ARM=y ++CONFIG_RCAR_GEN3=y ++CONFIG_DM_SERIAL=y ++CONFIG_TARGET_V3MSK=y ++CONFIG_R8A7797=y ++CONFIG_SPL=y ++CONFIG_SH_SDHI=y ++CONFIG_SPI_FLASH=y ++CONFIG_SPI_FLASH_SPANSION=y +diff --git a/include/configs/v3msk.h b/include/configs/v3msk.h +new file mode 100644 +index 0000000..8998da4 +--- /dev/null ++++ b/include/configs/v3msk.h +@@ -0,0 +1,145 @@ ++/* ++ * include/configs/v3msk.h ++ * This file is V3MSK board configuration. ++ * CPU r8a7797. ++ * ++ * Copyright (C) 2017 Cogent Embedded, Inc. ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++#ifndef __V3MSK_H ++#define __V3MSK_H ++ ++#undef DEBUG ++#define CONFIG_RCAR_BOARD_STRING "V3MSK" ++#define CONFIG_RCAR_TARGET_STRING "r8a7797" ++ ++#include "rcar-gen3-common.h" ++ ++/* Cache Definitions */ ++//#define CONFIG_SYS_DCACHE_OFF ++//#define CONFIG_SYS_ICACHE_OFF ++ ++/* SCIF */ ++#define CONFIG_SCIF_CONSOLE ++#define CONFIG_CONS_SCIF0 ++#define CONFIG_SH_SCIF_CLK_FREQ CONFIG_S3D4_CLK_FREQ ++ ++/* [A] Hyper Flash */ ++/* use to RPC(SPI Multi I/O Bus Controller) */ ++ ++ /* underconstruction */ ++ ++#define CONFIG_SYS_NO_FLASH ++#if defined(CONFIG_SYS_NO_FLASH) ++#define CONFIG_SPI ++#define CONFIG_RCAR_GEN3_QSPI ++#define CONFIG_SH_QSPI_BASE 0xEE200000 ++#define CONFIG_CMD_SF ++#define CONFIG_CMD_SPI ++#define CONFIG_SPI_FLASH ++#define CONFIG_SPI_FLASH_SPANSION ++#else ++#undef CONFIG_CMD_SF ++#undef CONFIG_CMD_SPI ++#undef CONFIG_SPI_FLASH ++#undef CONFIG_SPI_FLASH_SPANSION ++#endif ++ ++/* Ethernet RAVB */ ++#define CONFIG_RAVB ++#define CONFIG_RAVB_PHY_ADDR 0x0 ++#define CONFIG_RAVB_PHY_MODE PHY_INTERFACE_MODE_RGMII_ID ++#define CONFIG_NET_MULTI ++#define CONFIG_PHYLIB ++#define CONFIG_PHY_MICREL ++#define CONFIG_BITBANGMII ++#define CONFIG_BITBANGMII_MULTI ++#define CONFIG_SH_ETHER_BITBANG ++ ++/* Board Clock */ ++/* XTAL_CLK : 33.33MHz */ ++#define RCAR_XTAL_CLK 33333333u ++#define CONFIG_SYS_CLK_FREQ RCAR_XTAL_CLK ++/* ch0to2 CPclk, ch3to11 S3D2_PEREclk, ch12to14 S3D2_RTclk */ ++/* CPclk 16.66MHz, S3D2 133.33MHz , S3D4 66.66MHz */ ++#define CONFIG_CP_CLK_FREQ (CONFIG_SYS_CLK_FREQ / 2) ++#define CONFIG_PLL1_CLK_FREQ (CONFIG_SYS_CLK_FREQ * 192 / 2) ++#define CONFIG_S3D2_CLK_FREQ (266666666u/2) ++#define CONFIG_S3D4_CLK_FREQ (266666666u/4) ++ ++/* Generic Timer Definitions (use in assembler source) */ ++#define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */ ++ ++/* Generic Interrupt Controller Definitions */ ++#define GICD_BASE (0xF1010000) ++#define GICC_BASE (0xF1020000) ++#define CONFIG_GICV2 ++ ++/* i2c */ ++#define CONFIG_SYS_I2C ++#define CONFIG_SYS_I2C_SH ++#define CONFIG_SYS_I2C_SLAVE 0x60 ++#define CONFIG_SYS_I2C_SH_NUM_CONTROLLERS 1 ++#define CONFIG_SYS_I2C_SH_SPEED0 400000 ++#define CONFIG_SH_I2C_DATA_HIGH 4 ++#define CONFIG_SH_I2C_DATA_LOW 5 ++#define CONFIG_SH_I2C_CLOCK 10000000 ++ ++#define CONFIG_SYS_I2C_POWERIC_ADDR 0x30 ++ ++/* USB */ ++#undef CONFIG_CMD_USB ++ ++/* SDHI */ ++#define CONFIG_MMC ++#define CONFIG_CMD_MMC ++#define CONFIG_GENERIC_MMC ++#define CONFIG_SH_SDHI_FREQ 200000000 ++#define CONFIG_SH_SDHI_MMC ++ ++/* ENV setting */ ++#define CONFIG_ENV_OVERWRITE ++#define CONFIG_ENV_SECT_SIZE (256 * 1024) ++#define CONFIG_ENV_SIZE (CONFIG_ENV_SECT_SIZE) ++#define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE) ++ ++#define CONFIG_ENV_IS_IN_MMC ++//#define CONFIG_ENV_IS_IN_SPI_FLASH ++ ++#if defined(CONFIG_ENV_IS_IN_MMC) ++/* Environment in eMMC, at the end of 2nd "boot sector" */ ++#define CONFIG_ENV_OFFSET (-CONFIG_ENV_SIZE) ++#define CONFIG_SYS_MMC_ENV_DEV 0 ++#define CONFIG_SYS_MMC_ENV_PART 2 ++#elif defined(CONFIG_ENV_IS_IN_SPI_FLASH) ++/* Environment in QSPI */ ++#define CONFIG_ENV_ADDR 0x700000 ++#define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR) ++#else ++#define CONFIG_ENV_IS_NOWHERE ++#endif ++ ++/* Module clock supply/stop status bits */ ++/* MFIS */ ++#define CONFIG_SMSTP2_ENA 0x00002000 ++/* serial(SCIF0) */ ++#define CONFIG_SMSTP3_ENA 0x00000400 ++/* INTC-AP, INTC-EX */ ++#define CONFIG_SMSTP4_ENA 0x00000180 ++ ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "fdt_high=0xffffffffffffffff\0" \ ++ "initrd_high=0xffffffffffffffff\0" \ ++ "ethact=ravb\0" \ ++ "ethaddr=2E:11:22:33:44:55\0" ++ ++#define CONFIG_BOOTARGS \ ++ "root=/dev/nfs rw ip=dhcp" ++ ++#define CONFIG_BOOTCOMMAND \ ++ "bootp 0x48080000 Image; tftp 0x48000000 Image-r8a7797-v3msk.dtb; " \ ++ "booti 0x48080000 - 0x48000000" ++ ++#endif /* __V3MSK_H */ +-- +1.9.1 + diff --git a/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2015.04.bbappend b/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2015.04.bbappend index 730c8c2..8171d10 100644 --- a/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2015.04.bbappend +++ b/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2015.04.bbappend @@ -16,6 +16,7 @@ SRC_URI_append = " \ file://0014-arm-renesas-Add-Renesas-R8A7797-SoC-support.patch \ file://0015-board-renesas-Add-V3M-Eagle-board.patch \ file://0016-tools-fix-build-fail.patch \ + file://0017-board-renesas-Add-V3MSK-board.patch \ file://0021-ARM-rcar_gen3-Add-RPC-flash-definitions.patch \ file://0022-mtd-Add-RPC-HyperFlash-support.patch \ file://0023-board-renesas-salvator-x-Enable-RPC-clock.patch \ -- cgit 1.2.3-korg From 27ebba749e6177f41ad840c1b0377dd8007e0747 Mon Sep 17 00:00:00 2001 From: Andrey Gusakov Date: Wed, 1 Nov 2017 19:49:05 +0300 Subject: Kingfisher: bluetooth fixes Add proper dbus configs Enable bluetooth on startup --- meta-rcar-gen3-adas/conf/layer.conf | 2 ++ .../recipes-connectivity/bluez5/bluez5_%.bbappend | 16 ++++++++++++++++ .../recipes-connectivity/bluez5/files/main.conf | 2 ++ .../pulseaudio/files/pulseaudio-ofono.conf | 15 +++++++++++++++ .../recipes-multimedia/pulseaudio/files/system.pa | 2 +- .../pulseaudio/pulseaudio_8.0.bbappend | 2 ++ 6 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 meta-rcar-gen3-adas/recipes-connectivity/bluez5/bluez5_%.bbappend create mode 100644 meta-rcar-gen3-adas/recipes-connectivity/bluez5/files/main.conf create mode 100644 meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/pulseaudio-ofono.conf (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/layer.conf b/meta-rcar-gen3-adas/conf/layer.conf index 1a7e025..6bbd590 100644 --- a/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-rcar-gen3-adas/conf/layer.conf @@ -45,6 +45,7 @@ IMAGE_INSTALL_append_rcar-gen3 = " \ pulseaudio-module-cli \ pulseaudio-module-remap-sink \ pulseaudio-module-remap-source \ + pulseaudio-module-loopback \ gstreamer1.0-plugins-good-pulse \ gdbserver \ most-tools \ @@ -73,6 +74,7 @@ IMAGE_INSTALL_append_rcar-gen3 += " \ DISTRO_FEATURES_remove="x11" DISTRO_FEATURES_append = " surroundview " DISTRO_FEATURES_append = " opencv-sdk " +DISTRO_FEATURES_append = " bluetooth" IMAGE_INSTALL_remove = "gtk+3-demo clutter-1.0-examples" diff --git a/meta-rcar-gen3-adas/recipes-connectivity/bluez5/bluez5_%.bbappend b/meta-rcar-gen3-adas/recipes-connectivity/bluez5/bluez5_%.bbappend new file mode 100644 index 0000000..99b0ede --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-connectivity/bluez5/bluez5_%.bbappend @@ -0,0 +1,16 @@ +FILESEXTRAPATHS_append := "${THISDIR}/files:" + +SRC_URI_append_rcar-gen3 = " \ + file://main.conf \ +" + +PACKAGECONFIG_append = " experimental" + +NOINST_TOOLS_EXPERIMENTAL_remove = " tools/bdaddr" + + +do_install_append_rcar-gen3() { + install -d ${D}/etc/bluetooth + + install -m 644 ${WORKDIR}/main.conf ${D}/${sysconfdir}/bluetooth/ +} diff --git a/meta-rcar-gen3-adas/recipes-connectivity/bluez5/files/main.conf b/meta-rcar-gen3-adas/recipes-connectivity/bluez5/files/main.conf new file mode 100644 index 0000000..d3e19f7 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-connectivity/bluez5/files/main.conf @@ -0,0 +1,2 @@ +[Policy] +AutoEnable=true diff --git a/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/pulseaudio-ofono.conf b/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/pulseaudio-ofono.conf new file mode 100644 index 0000000..e526d77 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/pulseaudio-ofono.conf @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/system.pa b/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/system.pa index 89af11a..fe585ec 100644 --- a/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/system.pa +++ b/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/system.pa @@ -67,7 +67,7 @@ load-module module-bluetooth-policy .endif .ifexists module-bluetooth-discover.so -load-module module-bluetooth-discover +load-module module-bluetooth-discover headset=auto .endif set-default-sink ak4613_output diff --git a/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/pulseaudio_8.0.bbappend b/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/pulseaudio_8.0.bbappend index aba7e61..06710e9 100644 --- a/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/pulseaudio_8.0.bbappend +++ b/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/pulseaudio_8.0.bbappend @@ -9,6 +9,7 @@ SRC_URI_append_rcar-gen3 = " \ file://system.pa \ file://daemon.conf \ file://pulseaudio-bluetooth.conf \ + file://pulseaudio-ofono.conf \ " inherit update-rc.d @@ -31,6 +32,7 @@ do_install_append_rcar-gen3() { install -d ${D}/${sysconfdir}/dbus-1/system.d install -m 644 ${WORKDIR}/pulseaudio-bluetooth.conf ${D}/${sysconfdir}/dbus-1/system.d/ + install -m 644 ${WORKDIR}/pulseaudio-ofono.conf ${D}/${sysconfdir}/dbus-1/system.d/ update-rc.d -r ${D} pulseaudio defaults 30 } -- cgit 1.2.3-korg From c3ea8a26ced44cb1062846d601b5844027c8b417 Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Tue, 28 Nov 2017 15:27:50 +0300 Subject: Add IMP --- meta-rcar-gen3-adas/conf/layer.conf | 6 + .../kernel-module-cmemdrv/files/GPL-COPYING | 339 +++++++++++++ .../kernel-module-cmemdrv/files/MIT-COPYING | 41 ++ .../kernel-module-cmemdrv/files/Makefile | 14 + .../kernel-module-cmemdrv/files/cmemdrv.c | 457 +++++++++++++++++ .../kernel-module-cmemdrv_0.1.bb | 24 + .../kernel-module-uio-imp/files/GPL-COPYING | 339 +++++++++++++ .../kernel-module-uio-imp/files/MIT-COPYING | 41 ++ .../kernel-module-uio-imp/files/Makefile | 14 + .../kernel-module-uio-imp/files/uio_imp.c | 559 +++++++++++++++++++++ .../kernel-module-uio-imp_0.1.bb | 27 + .../0049-clk-r8a779x-add-IMP-clock.patch | 59 +++ ...0-arm64-dts-renesas-r8a779x-add-IMP-nodes.patch | 418 +++++++++++++++ .../recipes-kernel/linux/linux-renesas/eagle.cfg | 1 + .../linux/linux-renesas/salvator-x.cfg | 1 + .../recipes-kernel/linux/linux-renesas/ulcb.cfg | 1 + .../recipes-kernel/linux/linux-renesas/v3msk.cfg | 1 + .../linux/linux-renesas_4.9.bbappend | 2 + 18 files changed, 2344 insertions(+) create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/GPL-COPYING create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/MIT-COPYING create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/Makefile create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/cmemdrv.c create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/kernel-module-cmemdrv_0.1.bb create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/GPL-COPYING create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/MIT-COPYING create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/Makefile create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/uio_imp.c create mode 100644 meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/kernel-module-uio-imp_0.1.bb create mode 100644 meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0049-clk-r8a779x-add-IMP-clock.patch create mode 100644 meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0050-arm64-dts-renesas-r8a779x-add-IMP-nodes.patch (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/layer.conf b/meta-rcar-gen3-adas/conf/layer.conf index 6bbd590..76874e7 100644 --- a/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-rcar-gen3-adas/conf/layer.conf @@ -71,6 +71,12 @@ IMAGE_INSTALL_append_rcar-gen3 += " \ ofono-tests \ " +# IMP +IMAGE_INSTALL_append_rcar-gen3 += " \ + kernel-module-uio-imp \ + kernel-module-cmemdrv \ +" + DISTRO_FEATURES_remove="x11" DISTRO_FEATURES_append = " surroundview " DISTRO_FEATURES_append = " opencv-sdk " diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/GPL-COPYING b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/GPL-COPYING new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/GPL-COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + 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., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/MIT-COPYING b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/MIT-COPYING new file mode 100644 index 0000000..28e2a15 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/MIT-COPYING @@ -0,0 +1,41 @@ + +This software is Copyright (C) 2013 Renesas Electronics Corporation + +You may use, distribute and copy this software under the terms of the MIT +license displayed below. + +----------------------------------------------------------------------------- + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Alternatively, the contents of this file may be used under the terms of + the GNU General Public License Version 2 ("GPL") in which case the provisions + of GPL are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + GPL, and not to allow others to use your version of this file under the terms + of the MIT license, indicate your decision by deleting the provisions above + and replace them with the notice and other provisions required by GPL as set + out in the file called "GPL-COPYING" included in this distribution. If you do + not delete the provisions above, a recipient may use your version of this file + under the terms of either the MIT license or GPL. + +----------------------------------------------------------------------------- + + EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS + PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +----------------------------------------------------------------------------- diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/Makefile b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/Makefile new file mode 100644 index 0000000..2e26bfb --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/Makefile @@ -0,0 +1,14 @@ +obj-m := cmemdrv.o + +SRC := $(shell pwd) + +all: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) + +modules_install: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install + +clean: + rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c + rm -f Module.markers Module.symvers modules.order + rm -rf .tmp_versions Modules.symvers diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/cmemdrv.c b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/cmemdrv.c new file mode 100644 index 0000000..a5d4363 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/files/cmemdrv.c @@ -0,0 +1,457 @@ +/*************************************************************************/ /* + Memory Driver (kernel module) + + Copyright (C) 2015 - 2017 Renesas Electronics Corporation + + License Dual MIT/GPLv2 + + The contents of this file are subject to the MIT license as set out below. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Alternatively, the contents of this file may be used under the terms of + the GNU General Public License Version 2 ("GPL") in which case the provisions + of GPL are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + GPL, and not to allow others to use your version of this file under the terms + of the MIT license, indicate your decision by deleting the provisions above + and replace them with the notice and other provisions required by GPL as set + out in the file called "GPL-COPYING" included in this distribution. If you do + not delete the provisions above, a recipient may use your version of this file + under the terms of either the MIT license or GPL. + + This License is also included in this distribution in the file called + "MIT-COPYING". + + EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS + PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + GPLv2: + If you wish to use this file under the terms of GPL, following terms are + effective. + + 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; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /*************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_AREA_NUM 4 +#define DEFAULT_AREA_SIZE (16 * 1024 * 1024) + +#define PARAM_SET 1 +#define M_LOCK 3 +#define M_UNLOCK 4 +#define GET_PHYS_ADDR 5 +#define M_ALLOCATE 6 +#define M_UNALLOCATE 7 +#define TRY_CONV 8 + +#define IOCTL_FROM_IMP_TO_CPU 0 +#define IOCTL_FROM_CPU_TO_IMP 1 + +struct mem_area_data { + struct device *dev; + size_t size; + void *virt_ptr; + dma_addr_t phys_addr; +}; + +struct mem_access_data { + struct mem_area_data* area; + int start_offset; + int offset; + int width; + int height; + int stride; + int locked; + int tl; +}; + +static unsigned int bsize_count; +static unsigned long bsize[MAX_AREA_NUM]; +module_param_array(bsize, ulong, &bsize_count, S_IRUGO); +static int cached = 1; +module_param(cached, int, S_IRUGO); + +#ifdef CFG_USE_FPGA +static unsigned long cfg_bsize = 0; +module_param(cfg_bsize, ulong, S_IRUGO); +#endif + +static unsigned int cmem_major = 88; // 0:auto +module_param(cmem_major, uint, S_IRUGO); + +static struct class *cmem_class = NULL; +static struct mem_area_data *cmem_areas[MAX_AREA_NUM]; + +static int cv_v_to_p(unsigned long vaddr, unsigned long *paddr) +{ + struct vm_area_struct *vma; + unsigned long start, offset; + unsigned long pfn; + int ret; + + *paddr = 0; + + vma = find_vma(current->active_mm, vaddr); + if (vma == NULL) + return -EINVAL; + + start = vaddr & PAGE_MASK; + ret = follow_pfn(vma, start, &pfn); + if (ret < 0) + return ret; + + offset = offset_in_page(vaddr); + *paddr = (pfn << PAGE_SHIFT) + offset; + + return 0; +} + +static void do_tl(u64 *src, u64 *dst, unsigned int height, unsigned int step) +{ + unsigned int i; + int j; + unsigned int yaddr; + u64 *isrc, *idst, *isrcp, *idstp; + + for (j = 0; j < height ; j += 2) { + yaddr = (j & ~0x1f) * step | ((j & 0x1f) << 7); + isrc = src + (yaddr >> 3); + idst = dst + (j * step >> 3); + for (i = 0; i < step >> 3; i += 16) { + idstp = idst + i; + isrcp = isrc + (i << 5); + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + + idstp = idst + i + (step >> 3); + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + *idstp++ = *isrcp++; + + //idst[i] = isrc[((i >> 4) << 9) + (i & 0xf)]; + } + } +} + +static ssize_t dev_read(struct file *filep, char *buf, size_t len, loff_t *ppos) +{ + size_t count; + struct mem_access_data *p = filep->private_data; + + if (p->tl) { + do_tl( (u64 *)(p->area->virt_ptr + p->offset + p->start_offset), + (u64 *)buf, p->height, p->stride ); + count = len; + } else { + count = copy_to_user(buf, p->area->virt_ptr + p->offset + p->start_offset, len); + } + + return count; +} + +static ssize_t dev_write(struct file *filep, const char *buf, size_t len, loff_t *ppos) +{ + size_t count; + struct mem_access_data *p = filep->private_data; + + count = copy_from_user(p->area->virt_ptr + p->offset + p->start_offset, buf, len); + + return count; +} + +static long dev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) +{ + struct mem_access_data *p = filep->private_data; + struct device *dev = p->area->dev; + u32 offset, size, dir; + + switch (cmd) { + case PARAM_SET : + p->width = ((unsigned int *)arg)[0]; + p->height = ((unsigned int *)arg)[1]; + p->stride = ((unsigned int *)arg)[2]; + p->tl = ((unsigned int *)arg)[3]; + p->offset = ((unsigned int *)arg)[4]; + break; + case M_ALLOCATE : + break; + case M_LOCK : + if (cached) { + offset = ((unsigned int *)arg)[0]; + size = ((unsigned int *)arg)[1]; + dir = ((unsigned int *)arg)[2]; + if (dir == IOCTL_FROM_IMP_TO_CPU) + dma_sync_single_for_device(dev, p->area->phys_addr + p->start_offset + offset, size, DMA_FROM_DEVICE); + else + dma_sync_single_for_device(dev, p->area->phys_addr + p->start_offset + offset, size, DMA_TO_DEVICE); + } + break; + case M_UNLOCK : + if (cached) { + offset = ((unsigned int *)arg)[0]; + size = ((unsigned int *)arg)[1]; + dir = ((unsigned int *)arg)[2]; + if (dir == IOCTL_FROM_IMP_TO_CPU) + dma_sync_single_for_cpu(dev, p->area->phys_addr + p->start_offset + offset, size, DMA_FROM_DEVICE); + else + dma_sync_single_for_cpu(dev, p->area->phys_addr + p->start_offset + offset, size, DMA_TO_DEVICE); + } + break; + case M_UNALLOCATE : + break; + case GET_PHYS_ADDR : + *((unsigned int *)arg) = p->area->phys_addr; + break; + case TRY_CONV : + cv_v_to_p( ( (unsigned long *)arg )[0], (unsigned long *)arg + 1); + break; + default: + dev_warn(dev, "## unknown ioctl command %d\n", cmd); + return -EINVAL; + } + + return 0; +} + +static int dev_mmap(struct file *filep, struct vm_area_struct *vma) +{ + struct mem_access_data *p = filep->private_data; + unsigned long off; + unsigned long start; + + if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) + return -EINVAL; + + off = vma->vm_pgoff << PAGE_SHIFT; + start = p->area->phys_addr; + + if ((vma->vm_end - vma->vm_start + off) > p->area->size) + return -EINVAL; + + off += start; + vma->vm_pgoff = off >> PAGE_SHIFT; + vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; + if (!cached) + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + + return remap_pfn_range( vma, + vma->vm_start, + vma->vm_pgoff, + vma->vm_end - vma->vm_start, + vma->vm_page_prot ) ; +} + +static int dev_open(struct inode *inode, struct file *filep) +{ + struct mem_access_data *mem_access_p; + int minor = iminor(inode); + struct mem_area_data* area = cmem_areas[minor]; + + mem_access_p = kzalloc(sizeof(*mem_access_p), GFP_KERNEL); + if (!mem_access_p) + return -ENOMEM; + + dev_dbg(area->dev, "Device Open\n"); + mem_access_p->area = area; + filep->private_data = mem_access_p; + + return 0; +} + +static int dev_rls(struct inode *inode, struct file *filep) +{ + struct mem_access_data *mem_access_p = filep->private_data; + kfree(mem_access_p); + return 0; +} + +static struct file_operations fops = { + .owner = THIS_MODULE, + .read = dev_read, + .write = dev_write, + .unlocked_ioctl = dev_ioctl, + .compat_ioctl = dev_ioctl, + .mmap = dev_mmap, + .open = dev_open, + .release = dev_rls, +}; + +static int cmemdrv_create_device(dev_t devt, size_t size) +{ + int ret; + struct mem_area_data *area; + struct device *dev; + void *virt_b_ptr; + dma_addr_t phy_b_addr; + + dev = device_create(cmem_class, NULL, devt, NULL, "cmem%d", MINOR(devt)); + if (IS_ERR(dev)) { + pr_err("cmem: unable to create device cmem%d\n", MINOR(devt)); + return PTR_ERR(dev); + } + + area = devm_kzalloc(dev, sizeof(*area), GFP_KERNEL); + if (!area) { + ret = -ENOMEM; + goto err; + } + area->dev = dev; + +#ifdef CONFIG_ARM64 + { + struct device_node *np; + np = of_find_compatible_node(NULL, NULL, "shared-dma-pool"); + of_dma_configure(dev, np); + } +#endif + + virt_b_ptr = dmam_alloc_coherent(dev, size + PAGE_SIZE, &phy_b_addr, GFP_KERNEL); + if (!virt_b_ptr) { + dev_err(dev, "Memory allocation failed.. (size:0x%zx)\n", size); + ret = -ENOMEM; + goto err; + } + + area->virt_ptr = PTR_ALIGN(virt_b_ptr, PAGE_SIZE); + area->phys_addr = phy_b_addr + (area->virt_ptr - virt_b_ptr); + area->size = size; + cmem_areas[MINOR(devt)] = area; + dev_notice(dev, "Memory allocated.. 0x%08lx (size:0x%zx)\n", (unsigned long)area->phys_addr, size); + + return 0; + +err: + device_destroy(cmem_class, devt); + return ret; +} + +static int __init cmemdrv_init(void) +{ + int i = 0; + int ret; + + if (bsize_count == 0) + bsize[bsize_count++] = DEFAULT_AREA_SIZE; /* add default area */ + +#ifdef CFG_USE_FPGA + if (cfg_bsize && bsize_count < MAX_AREA_NUM) + bsize[bsize_count++] = cfg_bsize; /* for compatibility */ +#endif + + ret = register_chrdev(cmem_major, "CMem", &fops); + if (ret < 0) { + pr_err("cmem: unable to get major %d\n", cmem_major); + return ret; + } + if (cmem_major == 0) + cmem_major = ret; + + cmem_class = class_create(THIS_MODULE, "cmem"); + if (IS_ERR(cmem_class)) { + pr_err("cmem: unable to create class\n"); + ret = PTR_ERR(cmem_class); + goto err1; + } + + for (i = 0; i < bsize_count; i++) { + ret = cmemdrv_create_device(MKDEV(cmem_major, i), bsize[i]); + if (ret < 0) + goto err2; + } + + return 0; + +err2: + for (i--; i >= 0; i--) + device_destroy(cmem_class, MKDEV(cmem_major, i)); + + class_destroy(cmem_class); +err1: + unregister_chrdev(cmem_major, "CMem"); + return ret; +} + +static void __exit cmemdrv_exit(void) +{ + int i; + for (i = 0; i < bsize_count; i++) + device_destroy(cmem_class, MKDEV(cmem_major, i)); + + class_destroy(cmem_class); + unregister_chrdev(cmem_major, "CMem"); +} + +module_init(cmemdrv_init) +module_exit(cmemdrv_exit) + +MODULE_AUTHOR("RenesasElectronicsCorp."); +MODULE_DESCRIPTION("Userspace I/O driver for image memory"); +MODULE_LICENSE("GPL v2"); diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/kernel-module-cmemdrv_0.1.bb b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/kernel-module-cmemdrv_0.1.bb new file mode 100644 index 0000000..c460c6f --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-cmemdrv/kernel-module-cmemdrv_0.1.bb @@ -0,0 +1,24 @@ +SUMMARY = "Cache Memory Primitive Module" +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \ + " + +inherit module + +PR = "r0" +PV = "0.1" + +SRC_URI = " \ + file://Makefile \ + file://cmemdrv.c \ + file://GPL-COPYING \ + file://MIT-COPYING \ + " + +S = "${WORKDIR}" + +KERNEL_MODULE_AUTOLOAD += "cmemdrv" +KERNEL_MODULE_PROBECONF += "cmemdrv" +module_conf_cmemdrv = "options cmemdrv bsize=0x7000000" diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/GPL-COPYING b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/GPL-COPYING new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/GPL-COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + 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., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/MIT-COPYING b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/MIT-COPYING new file mode 100644 index 0000000..28e2a15 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/MIT-COPYING @@ -0,0 +1,41 @@ + +This software is Copyright (C) 2013 Renesas Electronics Corporation + +You may use, distribute and copy this software under the terms of the MIT +license displayed below. + +----------------------------------------------------------------------------- + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Alternatively, the contents of this file may be used under the terms of + the GNU General Public License Version 2 ("GPL") in which case the provisions + of GPL are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + GPL, and not to allow others to use your version of this file under the terms + of the MIT license, indicate your decision by deleting the provisions above + and replace them with the notice and other provisions required by GPL as set + out in the file called "GPL-COPYING" included in this distribution. If you do + not delete the provisions above, a recipient may use your version of this file + under the terms of either the MIT license or GPL. + +----------------------------------------------------------------------------- + + EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS + PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +----------------------------------------------------------------------------- diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/Makefile b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/Makefile new file mode 100644 index 0000000..9d35e2a --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/Makefile @@ -0,0 +1,14 @@ +obj-m := uio_imp.o + +SRC := $(shell pwd) + +all: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) + +modules_install: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install + +clean: + rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c + rm -f Module.markers Module.symvers modules.order + rm -rf .tmp_versions Modules.symvers diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/uio_imp.c b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/uio_imp.c new file mode 100644 index 0000000..ca90d2c --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/files/uio_imp.c @@ -0,0 +1,559 @@ +/*************************************************************************/ /* + IMP Driver (kernel module) + + Copyright (C) 2015 - 2017 Renesas Electronics Corporation + + License Dual MIT/GPLv2 + + The contents of this file are subject to the MIT license as set out below. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Alternatively, the contents of this file may be used under the terms of + the GNU General Public License Version 2 ("GPL") in which case the provisions + of GPL are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + GPL, and not to allow others to use your version of this file under the terms + of the MIT license, indicate your decision by deleting the provisions above + and replace them with the notice and other provisions required by GPL as set + out in the file called "GPL-COPYING" included in this distribution. If you do + not delete the provisions above, a recipient may use your version of this file + under the terms of either the MIT license or GPL. + + This License is also included in this distribution in the file called + "MIT-COPYING". + + EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS + PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + GPLv2: + If you wish to use this file under the terms of GPL, following terms are + effective. + + 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; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /*************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define DRIVER_NAME "uio_imp" +#define DRIVER_VER "0.0" + +#define LUIO_DEVICE_IMP 0 +#define LUIO_DEVICE_IMPSC 1 +#define LUIO_DEVICE_IMPDES 2 +#define LUIO_DEVICE_IMRLSX 3 +#define LUIO_DEVICE_IMRX 4 +#define LUIO_DEVICE_MEM 5 +#define LUIO_DEVICE_VSP 6 +#define LUIO_DEVICE_IMPDMAC 7 + +#define IMP_INTERNAL_REG_SIZE 0x1000 +#define IMP_NUM_DIST_HWIRQ 32 + +static int bsize = 7 * 1024 * 1024; +module_param(bsize, uint, S_IRUGO); + +static bool clear_int = 0; +module_param(clear_int, bool, S_IRUGO); + +struct imp_dev_data { + int dtype; + irqreturn_t (*handler)(int irq, struct uio_info *dev_info); + void (*sreset)(struct uio_info *info); + const char *name; +}; + +struct uio_imp_platdata { + struct uio_info *uioinfo; + struct platform_device *pdev; + const struct imp_dev_data *dev_data; + + struct irq_chip irq_chip; + struct irq_domain *irq_domain; + unsigned int domain_irq[IMP_NUM_DIST_HWIRQ]; + int max_hwirq; +}; + +static unsigned int ReadReg(struct uio_info *info, + unsigned long reg_offs) +{ + return ioread32(info->mem[0].internal_addr + reg_offs); +} + +static void WriteReg(struct uio_info *info, + unsigned long reg_offs, u32 data) +{ + iowrite32(data, info->mem[0].internal_addr + reg_offs); +} + +static irqreturn_t imp_handler(int irq, struct uio_info *dev_info) +{ + u32 stat = ReadReg(dev_info, 0x10); + + if (clear_int && (stat & 0x00000020)) { + /* clear INT state */ + WriteReg(dev_info, 0x10, 0x00000020); + return IRQ_NONE; + } + + if (stat != 0) { + /* mask all interrupts */ + WriteReg(dev_info, 0x14, ReadReg(dev_info, 0x14) & 0x0fffffff); + + return IRQ_HANDLED; + } else { + return IRQ_NONE; + } +} + +static void imp_sreset(struct uio_info *info) +{ + /* software reset */ + WriteReg(info, 0x08, 0x80000000); + WriteReg(info, 0x08, 0x00000000); + ReadReg(info, 0x08); + + /* 32bit addressing mode */ + WriteReg(info, 0x08, 0x00000001); + + /* mask all interrupts */ + WriteReg(info, 0x14, 0); +} + +static irqreturn_t impsc_handler(int irq, struct uio_info *dev_info) +{ + u32 stat = ReadReg(dev_info, 0x14); + + if (clear_int && (stat & 0x00000004)) { + /* clear INT state */ + WriteReg(dev_info, 0x18, 0x00000004); + return IRQ_NONE; + } + + if (stat != 0) { + /* mask all interrupts */ + WriteReg(dev_info, 0x20, 0xffffffff); + + return IRQ_HANDLED; + } else { + return IRQ_NONE; + } +} + +static void impsc_sreset(struct uio_info *info) +{ + /* software reset */ + WriteReg(info, 0x08, 0x00000001); + WriteReg(info, 0x08, 0x00000000); + ReadReg(info, 0x08); + + /* mask all interrupts */ + WriteReg(info, 0x20, 0xffffffff); +} + +static irqreturn_t impdist_handler(int irq, struct uio_info *dev_info) +{ + unsigned int bit; + unsigned long stat; + struct uio_imp_platdata *priv = dev_info->priv; + + stat = ReadReg(dev_info, 0x100); /* sr */ + stat &= ~ReadReg(dev_info, 0x10c); /* imr */ + + if (stat & 0x100) + stat |= ReadReg(dev_info, 0x110); /* g0intsel */ + if (stat & 0x200) + stat |= ReadReg(dev_info, 0x114); /* g1intsel */ + if (stat & 0x400) + stat |= ReadReg(dev_info, 0x118); /* g2intsel */ + stat &= ~0x700; + + if (!stat) + return IRQ_NONE; + + for_each_set_bit(bit, &stat, IMP_NUM_DIST_HWIRQ) + generic_handle_irq(priv->domain_irq[bit]); + + return IRQ_HANDLED; +} + +static void impdist_irq_enable(struct irq_data *d) +{ + struct uio_imp_platdata *priv = irq_data_get_irq_chip_data(d); + int hw_irq = irqd_to_hwirq(d); + unsigned int d_var; + + d_var = ReadReg(priv->uioinfo, 0x10c) & ~BIT(hw_irq); + WriteReg(priv->uioinfo, 0x10c, d_var); +} + +static void impdist_irq_disable(struct irq_data *d) +{ + struct uio_imp_platdata *priv = irq_data_get_irq_chip_data(d); + int hw_irq = irqd_to_hwirq(d); + unsigned int d_var; + + d_var = ReadReg(priv->uioinfo, 0x10c) | BIT(hw_irq); + WriteReg(priv->uioinfo, 0x10c, d_var); +} + +static int impdist_irq_domain_map(struct irq_domain *h, unsigned int virq, + irq_hw_number_t hw) +{ + struct uio_imp_platdata *priv = h->host_data; + + dev_dbg(&priv->pdev->dev, "impdist_irq_domain_map: virq=%d, hw=%d\n", virq, (int)hw); + priv->domain_irq[hw] = virq; + irq_set_chip_data(virq, priv); + irq_set_chip_and_handler(virq, &priv->irq_chip, handle_simple_irq); + return 0; +} + +static struct irq_domain_ops impdist_irq_domain_ops = { + .map = impdist_irq_domain_map, +}; + +static void impdist_sreset(struct uio_info *info) +{ + WriteReg(info, 0x500, 0); +} + +static irqreturn_t impdmac_handler(int irq, struct uio_info *dev_info) +{ + u32 stat = ReadReg(dev_info, 0x08); + + if (clear_int && (stat & 0x00000040)) { + /* clear INT state */ + WriteReg(dev_info, 0x0c, 0x00000040); + return IRQ_NONE; + } + + if (stat != 0) { + /* mask all interrupts */ + WriteReg(dev_info, 0x14, 0xffffffff); + + return IRQ_HANDLED; + } else { + return IRQ_NONE; + } +} + +static void impdmac_sreset(struct uio_info *info) +{ + /* software reset */ + WriteReg(info, 0x04, 0x80000000); + WriteReg(info, 0x04, 0x00000000); + ReadReg(info, 0x04); + + /* mask all interrupts */ + WriteReg(info, 0x14, 0xffffffff); +} + +static const struct imp_dev_data imp_dev_data_legacy = { + .dtype = LUIO_DEVICE_IMP, + .handler = imp_handler, + .sreset = imp_sreset, +}; +static const struct imp_dev_data imp_dev_data_shader = { + .dtype = LUIO_DEVICE_IMPSC, + .handler = impsc_handler, + .sreset = impsc_sreset, +}; +static const struct imp_dev_data imp_dev_data_distributer = { + .dtype = LUIO_DEVICE_IMPDES, + .handler = impdist_handler, + .sreset = impdist_sreset, +}; +static const struct imp_dev_data imp_dev_data_memory = { + .dtype = LUIO_DEVICE_MEM, +}; +static const struct imp_dev_data imp_dev_data_dmac = { + .dtype = LUIO_DEVICE_IMPDMAC, + .handler = impdmac_handler, + .sreset = impdmac_sreset, +}; + +static const struct of_device_id of_imp_match[] = { + { .compatible = "renesas,impx4-legacy", .data = &imp_dev_data_legacy }, + { .compatible = "renesas,impx4-shader", .data = &imp_dev_data_shader }, + { .compatible = "renesas,impx4-distributer", .data = &imp_dev_data_distributer }, + { .compatible = "renesas,impx4-memory", .data = &imp_dev_data_memory }, + { .compatible = "renesas,impx5-dmac", .data = &imp_dev_data_dmac }, + { /* Terminator */ }, +}; +MODULE_DEVICE_TABLE(of, of_imp_match); + +static int uio_imp_open(struct uio_info *info, struct inode *inode) +{ + struct uio_imp_platdata *priv = info->priv; + + /* software reset */ + if (priv->dev_data->sreset) + priv->dev_data->sreset(info); + + return 0; +} + +static int uio_imp_release(struct uio_info *info, struct inode *inode) +{ + return 0; +} + +static int uio_imp_probe(struct platform_device *pdev) +{ + struct uio_info *uioinfo; + struct uio_imp_platdata *priv; + const struct imp_dev_data *dev_data; + struct resource *res; + struct uio_mem *uiomem; + int ret = -EINVAL; + + /* alloc uioinfo for one device */ + uioinfo = devm_kzalloc(&pdev->dev, sizeof(*uioinfo), + GFP_KERNEL); + if (!uioinfo) { + dev_err(&pdev->dev, "unable to kmalloc\n"); + return -ENOMEM; + } + + if (pdev->dev.of_node) { + const struct of_device_id *match; + match = of_match_node(of_imp_match, pdev->dev.of_node); + if (!match) + return ret; + + dev_data = match->data; + uioinfo->name = pdev->dev.of_node->name; + uioinfo->version = DRIVER_VER; + } else { + dev_data = pdev->dev.platform_data; + uioinfo->name = dev_data->name; + uioinfo->version = DRIVER_VER; + } + + if (!dev_data) { + dev_err(&pdev->dev, "missing platform_data\n"); + return ret; + } + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) { + dev_err(&pdev->dev, "unable to kmalloc\n"); + return -ENOMEM; + } + + priv->uioinfo = uioinfo; + priv->pdev = pdev; + priv->dev_data = dev_data; + + /* MEM */ + uiomem = &uioinfo->mem[0]; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + + if (res) { + uiomem->memtype = UIO_MEM_PHYS; + uiomem->addr = res->start; + uiomem->size = resource_size(res); + uiomem->name = res->name; + + /* If reg[1] is shown, use it as internnal addr. + Otherwise, use reg[0]. */ + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (res) + uiomem->internal_addr = devm_ioremap_nocache(&pdev->dev, + res->start, resource_size(res)); + else + uiomem->internal_addr = devm_ioremap_nocache(&pdev->dev, + uiomem->addr, IMP_INTERNAL_REG_SIZE); + + if (!uiomem->internal_addr) { + dev_err(&pdev->dev, "unable to ioremap\n"); + return -ENOMEM; + } + } else if (dev_data->dtype == LUIO_DEVICE_MEM) { + /* allocate physically-contiguous memory */ + int buffer_size = bsize; + dev_info(&pdev->dev, "Allocating Buffer size = %d\n", buffer_size); + uiomem->memtype = UIO_MEM_PHYS; + uiomem->size = buffer_size; + uiomem->name = "mem"; + + uiomem->internal_addr = dmam_alloc_coherent(&pdev->dev, + buffer_size, &uiomem->addr, GFP_KERNEL); + if (!uiomem->internal_addr) { + dev_err(&pdev->dev, "unable to dma_alloc_coherent\n"); + return -ENOMEM; + } + } else { + dev_err(&pdev->dev, "missing memory map\n"); + return -EINVAL; + } + + /* IRQ */ + if (dev_data->handler) { + if (pdev->dev.of_node) + uioinfo->irq = irq_of_parse_and_map(pdev->dev.of_node, 0); + else { + ret = platform_get_irq(pdev, 0); + if (ret >= 0) + uioinfo->irq = ret; + else if (ret != -ENXIO) { + dev_err(&pdev->dev, "failed to get IRQ\n"); + return ret; + } + } + if (uioinfo->irq) { + uioinfo->handler = dev_data->handler; + if (dev_data->dtype != LUIO_DEVICE_IMPDES) + uioinfo->irq_flags = IRQF_SHARED; + } + } + dev_dbg(&pdev->dev, "irq = %d\n", (int)uioinfo->irq); + + /* irq demuxing on distributer handler */ + if (uioinfo->irq && dev_data->dtype == LUIO_DEVICE_IMPDES) { + struct irq_chip *irq_chip = &priv->irq_chip; + irq_chip->name = uioinfo->name; + irq_chip->irq_mask = impdist_irq_disable; + irq_chip->irq_unmask = impdist_irq_enable; + irq_chip->irq_enable = impdist_irq_enable; + irq_chip->irq_disable = impdist_irq_disable; + irq_chip->flags = IRQCHIP_SKIP_SET_WAKE; + + priv->irq_domain = irq_domain_add_simple(pdev->dev.of_node, + IMP_NUM_DIST_HWIRQ, 0, + &impdist_irq_domain_ops, priv); + if (!priv->irq_domain) { + dev_err(&pdev->dev, "cannot initialize irq domain\n"); + ret = -ENXIO; + goto err1; + } + } + + pm_runtime_enable(&pdev->dev); + pm_runtime_get_sync(&priv->pdev->dev); + +#ifdef CFG_USE_FPGA + dev_info(&pdev->dev, "%s(0x%08lx)\n", + uioinfo->name, (unsigned long)uiomem->addr); +#else + /* software reset */ + if (dev_data->sreset) + dev_data->sreset(uioinfo); + + /* print hardware version */ + if (uiomem->internal_addr && dev_data->dtype != LUIO_DEVICE_MEM) { + unsigned int vcr0 = ReadReg(uioinfo, 0x0); + unsigned int vcr1 = ReadReg(uioinfo, 0x4); + dev_info(&pdev->dev, "%s(0x%08lx): VCR = 0x%08x, 0x%08x\n", + uioinfo->name, (unsigned long)uiomem->addr, vcr0, vcr1); + } +#endif /* CFG_USE_FPGA */ + + uioinfo->open = uio_imp_open; + uioinfo->release = uio_imp_release; + uioinfo->priv = priv; + + ret = uio_register_device(&pdev->dev, priv->uioinfo); + if (ret) { + dev_err(&pdev->dev, "unable to register uio device\n"); + goto err2; + } + + platform_set_drvdata(pdev, priv); + return 0; + +err2: + pm_runtime_put_sync(&priv->pdev->dev); + pm_runtime_disable(&pdev->dev); + if (priv->irq_domain) + irq_domain_remove(priv->irq_domain); + +err1: + if (pdev->dev.of_node && uioinfo->irq) + irq_dispose_mapping(uioinfo->irq); + + return ret; +} + +static int uio_imp_remove(struct platform_device *pdev) +{ + struct uio_imp_platdata *priv = platform_get_drvdata(pdev); + + uio_unregister_device(priv->uioinfo); + pm_runtime_put_sync(&priv->pdev->dev); + pm_runtime_disable(&pdev->dev); + + if (priv->irq_domain) + irq_domain_remove(priv->irq_domain); + + if (pdev->dev.of_node && priv->uioinfo->irq) + irq_dispose_mapping(priv->uioinfo->irq); + + return 0; +} + +static int uio_imp_runtime_nop(struct device *dev) +{ + return 0; +} + +static const struct dev_pm_ops uio_imp_dev_pm_ops = { + .runtime_suspend = uio_imp_runtime_nop, + .runtime_resume = uio_imp_runtime_nop, +}; + +static struct platform_driver uio_imp = { + .probe = uio_imp_probe, + .remove = uio_imp_remove, + .driver = { + .name = DRIVER_NAME, + .pm = &uio_imp_dev_pm_ops, + .of_match_table = of_match_ptr(of_imp_match), + }, +}; + +module_platform_driver(uio_imp); + +MODULE_AUTHOR("RenesasElectronicsCorp."); +MODULE_DESCRIPTION("Userspace I/O driver for IMP"); +MODULE_LICENSE("GPL v2"); diff --git a/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/kernel-module-uio-imp_0.1.bb b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/kernel-module-uio-imp_0.1.bb new file mode 100644 index 0000000..1000b7d --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/kernel-module-uio-imp/kernel-module-uio-imp_0.1.bb @@ -0,0 +1,27 @@ +SUMMARY = "IMP Primitive Driver Module" +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \ + " + +inherit module + +PR = "r0" +PV = "0.1" + +SRC_URI = " \ + file://Makefile \ + file://uio_imp.c \ + file://GPL-COPYING \ + file://MIT-COPYING \ + " + +S = "${WORKDIR}" + +KERNEL_MODULE_AUTOLOAD += "uio_imp" +KERNEL_MODULE_PROBECONF += "uio_imp" + +module_conf_uio_imp = "" +module_conf_uio_imp_r8a7795 = "options uio_imp clear_int" +module_conf_uio_imp_r8a7796 = "options uio_imp clear_int" diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0049-clk-r8a779x-add-IMP-clock.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0049-clk-r8a779x-add-IMP-clock.patch new file mode 100644 index 0000000..a7cf942 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0049-clk-r8a779x-add-IMP-clock.patch @@ -0,0 +1,59 @@ +From 9075957822c829026acfb5e8982a77f895a7a640 Mon Sep 17 00:00:00 2001 +From: Vladimir Barinov +Date: Mon, 27 Nov 2017 16:53:06 +0300 +Subject: [PATCH] clk: r8a779x: add IMP clock + +This adds IMP clock sources for Gen3 SoCs + +Signed-off-by: Vladimir Barinov +--- + drivers/clk/renesas/r8a7795-cpg-mssr.c | 1 + + drivers/clk/renesas/r8a7796-cpg-mssr.c | 1 + + drivers/clk/renesas/r8a7797-cpg-mssr.c | 7 +++++++ + 3 files changed, 9 insertions(+) + +diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c +index bc10df3..9061f7f 100644 +--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c ++++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c +@@ -234,6 +234,7 @@ enum clk_ids { + DEF_MOD("imr2", 821, R8A7795_CLK_S2D1), + DEF_MOD("imr1", 822, R8A7795_CLK_S2D1), + DEF_MOD("imr0", 823, R8A7795_CLK_S2D1), ++ DEF_MOD("imp", 824, R8A7795_CLK_S1D1), + DEF_MOD("gpio7", 905, R8A7795_CLK_S3D4), + DEF_MOD("gpio6", 906, R8A7795_CLK_S3D4), + DEF_MOD("gpio5", 907, R8A7795_CLK_S3D4), +diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c b/drivers/clk/renesas/r8a7796-cpg-mssr.c +index 819d3c6..e886d8a 100644 +--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c ++++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c +@@ -204,6 +204,7 @@ enum clk_ids { + DEF_MOD("vin1", 810, R8A7796_CLK_S0D2), + DEF_MOD("vin0", 811, R8A7796_CLK_S0D2), + DEF_MOD("etheravb", 812, R8A7796_CLK_S0D6), ++ DEF_MOD("imp", 824, R8A7796_CLK_S1D1), + DEF_MOD("gpio7", 905, R8A7796_CLK_S3D4), + DEF_MOD("gpio6", 906, R8A7796_CLK_S3D4), + DEF_MOD("gpio5", 907, R8A7796_CLK_S3D4), +diff --git a/drivers/clk/renesas/r8a7797-cpg-mssr.c b/drivers/clk/renesas/r8a7797-cpg-mssr.c +index 29dfe4a..6655592 100644 +--- a/drivers/clk/renesas/r8a7797-cpg-mssr.c ++++ b/drivers/clk/renesas/r8a7797-cpg-mssr.c +@@ -129,6 +129,13 @@ enum clk_ids { + DEF_MOD("imr2", 821, R8A7797_CLK_S2D1), + DEF_MOD("imr1", 822, R8A7797_CLK_S2D1), + DEF_MOD("imr0", 823, R8A7797_CLK_S2D1), ++ DEF_MOD("imp3", 824, R8A7797_CLK_S1D1), ++ DEF_MOD("imp2", 825, R8A7797_CLK_S1D1), ++ DEF_MOD("imp1", 826, R8A7797_CLK_S1D1), ++ DEF_MOD("imp0", 827, R8A7797_CLK_S1D1), ++ DEF_MOD("imp-ocv1", 828, R8A7797_CLK_S1D1), ++ DEF_MOD("imp-ocv0", 829, R8A7797_CLK_S1D1), ++ DEF_MOD("impram", 830, R8A7797_CLK_S1D1), + DEF_MOD("gpio5", 907, R8A7797_CLK_CP), + DEF_MOD("gpio4", 908, R8A7797_CLK_CP), + DEF_MOD("gpio3", 909, R8A7797_CLK_CP), +-- +1.9.1 + diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0050-arm64-dts-renesas-r8a779x-add-IMP-nodes.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0050-arm64-dts-renesas-r8a779x-add-IMP-nodes.patch new file mode 100644 index 0000000..316f182 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0050-arm64-dts-renesas-r8a779x-add-IMP-nodes.patch @@ -0,0 +1,418 @@ +From 9dcc1345c0b04ebab6e5b9f676881716bf985753 Mon Sep 17 00:00:00 2001 +From: Vladimir Barinov +Date: Tue, 28 Nov 2017 14:47:12 +0300 +Subject: [PATCH] arm64: dts: renesas: r8a779x: add IMP nodes + +This adds IMP resource nodes for Gen3 SoCs + +Signed-off-by: Vladimir Barinov +--- + arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi | 98 +++++++++++++++++++++++++++ + arch/arm64/boot/dts/renesas/r8a7795.dtsi | 98 +++++++++++++++++++++++++++ + arch/arm64/boot/dts/renesas/r8a7796.dtsi | 62 +++++++++++++++++ + arch/arm64/boot/dts/renesas/r8a7797.dtsi | 99 ++++++++++++++++++++++++++++ + 4 files changed, 357 insertions(+) + +diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi b/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi +index b3f3102..e15af8c 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi +@@ -2794,6 +2794,104 @@ + }; + }; + ++ imp_distributer: impdes0 { ++ compatible = "renesas,impx4-distributer"; ++ reg = <0 0xffa00000 0 0x4000>; ++ interrupts = ; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ }; ++ ++ imp0 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff900000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <0>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ imp1 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff920000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <1>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ imp2 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff940000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <2>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ imp3 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff960000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <3>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ impsc0 { ++ compatible = "renesas,impx4-shader"; ++ reg = <0 0xff980000 0 0x10000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <4>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ impsc1 { ++ compatible = "renesas,impx4-shader"; ++ reg = <0 0xff990000 0 0x10000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <5>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ impsl0 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff9c0000 0 0x10000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <12>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ impdm0 { ++ compatible = "renesas,impx5-dmac"; ++ reg = <0 0xffa10000 0 0x4000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <16>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ impc0 { ++ compatible = "renesas,impx4-memory"; ++ reg = <0 0xffa40000 0 0x20000>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ imprtt { ++ compatible = "renesas,impx5-rtt"; ++ reg = <0 0xff8d0000 0 0x1000>, ++ <0 0xe6150000 0 0x1000>; ++ interrupts = ; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ + imrlx4_ch0: imr-lx4@fe860000 { + compatible = "renesas,imr-lx4"; + reg = <0 0xfe860000 0 0x2000>; +diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi +index 02c5931..8ba4cec 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi +@@ -2790,6 +2790,104 @@ + }; + }; + ++ imp_distributer: impdes0 { ++ compatible = "renesas,impx4-distributer"; ++ reg = <0 0xffa00000 0 0x4000>; ++ interrupts = ; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ }; ++ ++ imp0 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff900000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <0>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ imp1 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff920000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <1>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ imp2 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff940000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <2>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ imp3 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff960000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <3>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ impsc0 { ++ compatible = "renesas,impx4-shader"; ++ reg = <0 0xff980000 0 0x10000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <4>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ impsc1 { ++ compatible = "renesas,impx4-shader"; ++ reg = <0 0xff990000 0 0x10000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <5>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ impsl0 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff9c0000 0 0x10000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <12>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ impdm0 { ++ compatible = "renesas,impx5-dmac"; ++ reg = <0 0xffa10000 0 0x4000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <16>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ impc0 { ++ compatible = "renesas,impx4-memory"; ++ reg = <0 0xffa40000 0 0x20000>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ ++ imprtt { ++ compatible = "renesas,impx5-rtt"; ++ reg = <0 0xff8d0000 0 0x1000>, ++ <0 0xe6150000 0 0x1000>; ++ interrupts = ; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7795_PD_A3IR>; ++ }; ++ + imrlx4_ch0: imr-lx4@fe860000 { + compatible = "renesas,imr-lx4"; + reg = <0 0xfe860000 0 0x2000>; +diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi +index b94d9e0..7c19f35 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi +@@ -2531,5 +2531,67 @@ + }; + }; + }; ++ ++ imp_distributer: impdes0 { ++ compatible = "renesas,impx4-distributer"; ++ reg = <0 0xffa00000 0 0x4000>; ++ interrupts = ; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7796_PD_A3IR>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ }; ++ ++ imp0 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff900000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <0>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7796_PD_A3IR>; ++ }; ++ ++ imp1 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff920000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <1>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7796_PD_A3IR>; ++ }; ++ ++ impsc0 { ++ compatible = "renesas,impx4-shader"; ++ reg = <0 0xff980000 0 0x10000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <4>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7796_PD_A3IR>; ++ }; ++ ++ impdm0 { ++ compatible = "renesas,impx5-dmac"; ++ reg = <0 0xffa10000 0 0x4000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <16>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7796_PD_A3IR>; ++ }; ++ ++ impc0 { ++ compatible = "renesas,impx4-memory"; ++ reg = <0 0xffa40000 0 0x20000>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7796_PD_A3IR>; ++ }; ++ ++ imprtt { ++ compatible = "renesas,impx5-rtt"; ++ reg = <0 0xff8d0000 0 0x1000>, ++ <0 0xe6150000 0 0x1000>; ++ interrupts = ; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7796_PD_A3IR>; ++ }; + }; + }; +diff --git a/arch/arm64/boot/dts/renesas/r8a7797.dtsi b/arch/arm64/boot/dts/renesas/r8a7797.dtsi +index 1be93e8..232eb19 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7797.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a7797.dtsi +@@ -970,6 +970,105 @@ + status = "okay"; + }; + ++ imp_distributer: impdes0 { ++ compatible = "renesas,impx4-distributer"; ++ reg = <0 0xffa00000 0 0x4000>; ++ interrupts = ; ++ clocks = <&cpg CPG_MOD 830>; ++ power-domains = <&sysc R8A7797_PD_A3IR>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ }; ++ ++ imp0 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff900000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <0>; ++ clocks = <&cpg CPG_MOD 827>; ++ power-domains = <&sysc R8A7797_PD_A2IR0>; ++ }; ++ ++ imp1 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff920000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <1>; ++ clocks = <&cpg CPG_MOD 826>; ++ power-domains = <&sysc R8A7797_PD_A2IR1>; ++ }; ++ ++ imp2 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff940000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <2>; ++ clocks = <&cpg CPG_MOD 825>; ++ power-domains = <&sysc R8A7797_PD_A2IR2>; ++ }; ++ ++ imp3 { ++ compatible = "renesas,impx4-legacy"; ++ reg = <0 0xff960000 0 0x20000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <3>; ++ clocks = <&cpg CPG_MOD 824>; ++ power-domains = <&sysc R8A7797_PD_A2IR3>; ++ }; ++ ++ impsc0 { ++ compatible = "renesas,impx4-shader"; ++ reg = <0 0xff980000 0 0x10000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <4>; ++ clocks = <&cpg CPG_MOD 829>; ++ power-domains = <&sysc R8A7797_PD_A2SC0>; ++ }; ++ ++ impsc1 { ++ compatible = "renesas,impx4-shader"; ++ reg = <0 0xff990000 0 0x10000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <5>; ++ clocks = <&cpg CPG_MOD 828>; ++ power-domains = <&sysc R8A7797_PD_A2SC1>; ++ }; ++ ++ impdm0 { ++ compatible = "renesas,impx5-dmac"; ++ reg = <0 0xffa10000 0 0x1000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <16>; ++ clocks = <&cpg CPG_MOD 830>; ++ power-domains = <&sysc R8A7797_PD_A3IR>; ++ }; ++ ++ impdm1 { ++ compatible = "renesas,impx5-dmac"; ++ reg = <0 0xffa10000 0 0x1000>, ++ <0 0xffa10800 0 0x0800>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <17>; ++ clocks = <&cpg CPG_MOD 830>; ++ power-domains = <&sysc R8A7797_PD_A3IR>; ++ }; ++ ++ imppsc0 { ++ compatible = "renesas,impx5-dmac"; ++ reg = <0 0xffa20000 0 0x4000>; ++ interrupt-parent = <&imp_distributer>; ++ interrupts = <12>; ++ clocks = <&cpg CPG_MOD 830>; ++ power-domains = <&sysc R8A7797_PD_A3IR>; ++ }; ++ ++ impc0 { ++ compatible = "renesas,impx4-memory"; ++ reg = <0 0xed000000 0 0x100000>; ++ clocks = <&cpg CPG_MOD 830>; ++ power-domains = <&sysc R8A7797_PD_A3IR>; ++ }; ++ + imrlx4_ch0: imr-lx4@fe860000 { + compatible = "renesas,imr-lx4"; + reg = <0 0xfe860000 0 0x2000>; +-- +1.9.1 + diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/eagle.cfg b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/eagle.cfg index b856d48..9796ba5 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/eagle.cfg +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/eagle.cfg @@ -26,3 +26,4 @@ CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_PROPERTIES=y CONFIG_HID_MULTITOUCH=y CONFIG_SERIAL_SH_SCI_DMA=y +CONFIG_UIO=y diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/salvator-x.cfg b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/salvator-x.cfg index 29425e5..a42b74c 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/salvator-x.cfg +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/salvator-x.cfg @@ -29,3 +29,4 @@ CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_PROPERTIES=y CONFIG_HID_MULTITOUCH=y CONFIG_SERIAL_SH_SCI_DMA=y +CONFIG_UIO=y diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/ulcb.cfg b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/ulcb.cfg index b52636a..4e24c06 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/ulcb.cfg +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/ulcb.cfg @@ -78,3 +78,4 @@ CONFIG_AIM_NETWORK=y CONFIG_AIM_SOUND=y CONFIG_AIM_V4L2=y CONFIG_HDM_DIM2=y +CONFIG_UIO=y diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/v3msk.cfg b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/v3msk.cfg index 0d06354..211da49 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/v3msk.cfg +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/v3msk.cfg @@ -30,3 +30,4 @@ CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_PROPERTIES=y CONFIG_HID_MULTITOUCH=y CONFIG_SERIAL_SH_SCI_DMA=y +CONFIG_UIO=y diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend index c1b71e7..0b4d393 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend @@ -49,6 +49,8 @@ SRC_URI_append = " \ file://0046-arm64-dts-renesas-r8a779x-add-mlp-nodes.patch \ ${@base_conditional("KF_ENABLE_SD3", "1", " file://0047-arm64-dts-renesas-ulcb-kf-enable-sd3.patch", "", d)} \ ${@base_conditional("KF_ENABLE_MOST", "1", " file://0048-arm64-dts-renesas-ulcb-kf-enable-most.patch", "", d)} \ + file://0049-clk-r8a779x-add-IMP-clock.patch \ + file://0050-arm64-dts-renesas-r8a779x-add-IMP-nodes.patch \ ${@base_conditional("LVDSCAMERA_FIRST4_TYPE1", "1", " file://0050-arm64-dts-Gen3-view-boards-TYPE1-first-4-cameras.patch", "", d)} \ ${@base_conditional("LVDSCAMERA_SECOND4_TYPE1", "1", " file://0051-arm64-dts-Gen3-view-boards-TYPE1-second-4-cameras.patch", "", d)} \ ${@base_conditional("LVDSCAMERA_FIRST4_TYPE2", "1", " file://0052-arm64-dts-Gen3-view-boards-TYPE2-first-4-cameras.patch", "", d)} \ -- cgit 1.2.3-korg From 53e8293acf1f18ffd9b7ba4f8b294bb5ba6bcaf8 Mon Sep 17 00:00:00 2001 From: Andrey Gusakov Date: Thu, 30 Nov 2017 20:38:54 +0300 Subject: Bluetooth: fix PCM channel of WL18xx --- meta-rcar-gen3-adas/conf/layer.conf | 1 + .../0071-ASoC-add-dummy-device-for-WL18xx-PCM-audio.patch | 4 ++-- meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/system.pa | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/layer.conf b/meta-rcar-gen3-adas/conf/layer.conf index 76874e7..229faf8 100644 --- a/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-rcar-gen3-adas/conf/layer.conf @@ -81,6 +81,7 @@ DISTRO_FEATURES_remove="x11" DISTRO_FEATURES_append = " surroundview " DISTRO_FEATURES_append = " opencv-sdk " DISTRO_FEATURES_append = " bluetooth" +DISTRO_FEATURES_append = " pulseaudio" IMAGE_INSTALL_remove = "gtk+3-demo clutter-1.0-examples" diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0071-ASoC-add-dummy-device-for-WL18xx-PCM-audio.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0071-ASoC-add-dummy-device-for-WL18xx-PCM-audio.patch index 9ebca61..30aebe0 100644 --- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0071-ASoC-add-dummy-device-for-WL18xx-PCM-audio.patch +++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0071-ASoC-add-dummy-device-for-WL18xx-PCM-audio.patch @@ -76,13 +76,13 @@ index 000000000000..50ebbd4c0013 + .capture = { + .channels_min = 2, + .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000, ++ .rates = SNDRV_PCM_RATE_48000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + .playback = { + .channels_min = 2, + .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000, ++ .rates = SNDRV_PCM_RATE_48000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, +}; diff --git a/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/system.pa b/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/system.pa index fe585ec..47ef8c3 100644 --- a/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/system.pa +++ b/meta-rcar-gen3-adas/recipes-multimedia/pulseaudio/files/system.pa @@ -30,7 +30,7 @@ load-module module-alsa-card device_id=ak4613 rate=48000 use_ucm=1 tsched=yes si ## Radio input (Kingfisher only) load-module module-alsa-source source_name=radio device=hw:radio channels=2 rate=48000 ## WL18xx PCM interface (Kingfisher only) -#load-module module-alsa-card device_id=wl18xx rate=8000 sink_name=bt_output source_name=bt_input +load-module module-alsa-card device_id=wl18xx rate=48000 sink_name=bt_output source_name=bt_input ### Load several protocols .ifexists module-esound-protocol-unix.so -- cgit 1.2.3-korg From 98664802e4c6650e8eb38162db9601a6d331c78d Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Mon, 11 Dec 2017 12:48:03 +0300 Subject: IMP udev rules --- meta-rcar-gen3-adas/conf/layer.conf | 1 + meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib.bb | 13 +++++++++++++ .../recipes-core/udev/udev-rules-cvlib/51-imp.rules | 1 + .../recipes-core/udev/udev-rules-cvlib/52-cmem.rules | 1 + 4 files changed, 16 insertions(+) create mode 100644 meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib.bb create mode 100644 meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib/51-imp.rules create mode 100644 meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib/52-cmem.rules (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/layer.conf b/meta-rcar-gen3-adas/conf/layer.conf index 229faf8..c5da1c9 100644 --- a/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-rcar-gen3-adas/conf/layer.conf @@ -75,6 +75,7 @@ IMAGE_INSTALL_append_rcar-gen3 += " \ IMAGE_INSTALL_append_rcar-gen3 += " \ kernel-module-uio-imp \ kernel-module-cmemdrv \ + udev-rules-cvlib \ " DISTRO_FEATURES_remove="x11" diff --git a/meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib.bb b/meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib.bb new file mode 100644 index 0000000..98485c6 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib.bb @@ -0,0 +1,13 @@ +SUMMARY = "udev rules for R-Car Gen3 CV Library" +LICENSE = "CLOSED" + +SRC_URI = " \ + file://51-imp.rules \ + file://52-cmem.rules \ +" + +do_install () { + install -d ${D}${sysconfdir}/udev/rules.d/ + install -m 0644 ${WORKDIR}/51-imp.rules ${D}${sysconfdir}/udev/rules.d/ + install -m 0644 ${WORKDIR}/52-cmem.rules ${D}${sysconfdir}/udev/rules.d/ +} diff --git a/meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib/51-imp.rules b/meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib/51-imp.rules new file mode 100644 index 0000000..df1a4b2 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib/51-imp.rules @@ -0,0 +1 @@ +SUBSYSTEM=="uio", ATTR{name}=="im*", SYMLINK+="$attr{name}", MODE="0666" diff --git a/meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib/52-cmem.rules b/meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib/52-cmem.rules new file mode 100644 index 0000000..7846e68 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-core/udev/udev-rules-cvlib/52-cmem.rules @@ -0,0 +1 @@ +SUBSYSTEM=="cmem", MODE="0666" -- cgit 1.2.3-korg From 2eaa66f2355ba99d36c583460223bd3ebc3730aa Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Mon, 11 Dec 2017 08:45:16 -0500 Subject: conf: remove distro-specific package configuration from BSP layer Additional packages should be managed in distro layers Change-Id: Ib2519d261603cf674480eee05c5dda038f9262a0 Signed-off-by: Matt Porter --- meta-rcar-gen3-adas/conf/layer.conf | 79 ------------------------------------- 1 file changed, 79 deletions(-) (limited to 'meta-rcar-gen3-adas/conf') diff --git a/meta-rcar-gen3-adas/conf/layer.conf b/meta-rcar-gen3-adas/conf/layer.conf index c5da1c9..a091d3a 100644 --- a/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-rcar-gen3-adas/conf/layer.conf @@ -10,82 +10,3 @@ BBFILES += " \ BBFILE_COLLECTIONS += "rcar-gen3-adas" BBFILE_PATTERN_rcar-gen3-adas := "^${LAYERDIR}/" BBFILE_PRIORITY_rcar-gen3-adas = "7" - -# Custom packages -IMAGE_INSTALL_append_rcar-gen3 = " \ - kernel-modules \ - kernel-devicetree \ - can-utils \ - libsocketcan \ - iproute2 \ - spidev-dbg \ - e2fsprogs \ - e2fsprogs-tune2fs \ - ethtool \ - pciutils \ - usbutils \ - util-linux \ - mtd-utils \ - capture \ - v4l2-fw \ - iperf \ - bonnie++ \ - lmbench \ - strace \ - libpcap \ - eglibc-utils \ - ldd \ - procps \ - can-utils libsocketcan \ - rsync \ - mm-init \ - iio-utils \ - pulseaudio-server \ - pulseaudio-misc \ - pulseaudio-module-cli \ - pulseaudio-module-remap-sink \ - pulseaudio-module-remap-source \ - pulseaudio-module-loopback \ - gstreamer1.0-plugins-good-pulse \ - gdbserver \ - most-tools \ - perf \ - dropbear \ - opkg \ -" - -# Radio packages -IMAGE_INSTALL_append_rcar-gen3 += " \ - si-tools \ - linux-firmware-wl18xx \ - wireless-tools \ - ti-bt \ - ti-bt-firmware \ - bluez5 \ - bluez5-testtools \ - pulseaudio-module-bluez5-device \ - pulseaudio-module-bluez5-discover \ - pulseaudio-module-bluetooth-discover \ - pulseaudio-module-bluetooth-policy \ - ofono \ - ofono-tests \ -" - -# IMP -IMAGE_INSTALL_append_rcar-gen3 += " \ - kernel-module-uio-imp \ - kernel-module-cmemdrv \ - udev-rules-cvlib \ -" - -DISTRO_FEATURES_remove="x11" -DISTRO_FEATURES_append = " surroundview " -DISTRO_FEATURES_append = " opencv-sdk " -DISTRO_FEATURES_append = " bluetooth" -DISTRO_FEATURES_append = " pulseaudio" - -IMAGE_INSTALL_remove = "gtk+3-demo clutter-1.0-examples" - -EXTRA_IMAGE_FEATURES_append_rcar-gen3 = " eclipse-debug" - -PREFERRED_VERSION_opencv = "2.4%" -- cgit 1.2.3-korg