aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>2015-03-25 10:47:45 +0900
committerNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>2015-03-25 10:47:45 +0900
commit1c35920d85e424b3f65aa6df1dbde689dd6ec007 (patch)
tree58b2cacb3674111aad5a4ded694db0cef5cf55f3
commit BSP v1.8.0
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
-rw-r--r--COPYING.MIT17
-rw-r--r--MAINTAINERS28
-rw-r--r--README28
-rw-r--r--common/recipes-core/eglibc/eglibc_2.19.bbappend1
-rw-r--r--common/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.8.bbappend1
-rw-r--r--common/recipes-devtools/gcc/libgcc_4.8.bbappend38
-rw-r--r--common/recipes-devtools/qemu/qemu_1.7.0.bbappend1
-rw-r--r--common/recipes-gnome/gtk+/gtk+_2.24.22.bbappend26
-rw-r--r--common/recipes-graphics/directfb/directfb-examples_git.bb20
-rw-r--r--common/recipes-graphics/directfb/directfb.inc72
-rw-r--r--common/recipes-graphics/directfb/directfb/0001-drmkms-fix-property-to-check-when-setting-source-col.patch26
-rw-r--r--common/recipes-graphics/directfb/directfb/0002-drmkms-mute-plane-when-opacity-is-set-to-zero.patch150
-rw-r--r--common/recipes-graphics/directfb/directfb/configurefix.patch60
-rw-r--r--common/recipes-graphics/directfb/directfb/dfb_uiomux_support.patch36
-rw-r--r--common/recipes-graphics/directfb/directfb/directfb-1.2.x-fix-pkgconfig-cflags.patch48
-rw-r--r--common/recipes-graphics/directfb/directfb/directfbrc5
-rw-r--r--common/recipes-graphics/directfb/directfb/fbdev-uiomux-register.patch54
-rw-r--r--common/recipes-graphics/directfb/directfb/fix-compilation-with-zlib.patch29
-rw-r--r--common/recipes-graphics/directfb/directfb/fixsepbuild.patch19
-rw-r--r--common/recipes-graphics/directfb/directfb/mesa9.patch29
-rw-r--r--common/recipes-graphics/directfb/directfb/rename-no-instrument-function-macro.patch345
-rw-r--r--common/recipes-graphics/directfb/directfb_1.6.3.bb28
-rw-r--r--common/recipes-graphics/directfb/directfb_1.6.3.bbappend6
-rw-r--r--common/recipes-graphics/directfb/directfb_git.bb68
-rw-r--r--common/recipes-graphics/directfb/directfb_git.inc71
-rw-r--r--common/recipes-graphics/drm/libdrm/0001-modetest-add-the-possibility-to-select-the-refresh-f.patch118
-rw-r--r--common/recipes-graphics/drm/libdrm/GNU_SOURCE_definition.patch30
-rw-r--r--common/recipes-graphics/drm/libdrm/installtests.patch23
-rw-r--r--common/recipes-graphics/drm/libdrm_2.4.45.bb14
-rw-r--r--common/recipes-graphics/flux/flux_1.4.4.bb18
-rw-r--r--common/recipes-graphics/khronos-headers/khronos-headers/support_arm.patch12
-rw-r--r--common/recipes-graphics/khronos-headers/khronos-headers_20131030.bb24
-rw-r--r--common/recipes-kernel/linux-fusion/linux-fusion/linux-fusion-modules-replace-KERNELDIR-with-KERNEL_SRC.patch13
-rw-r--r--common/recipes-kernel/linux-fusion/linux-fusion_9.0.2.bb29
-rw-r--r--common/recipes-multimedia/gstreamer/gst-openmax/0001-Stop-using-deprecated-GLib-thread-API.patch335
-rw-r--r--common/recipes-multimedia/gstreamer/gst-openmax/0001-base_videodec-change-the-tile-height-for-T-L-address.patch27
-rw-r--r--common/recipes-multimedia/gstreamer/gst-openmax/disable_configure.patch15
-rw-r--r--common/recipes-multimedia/gstreamer/gst-openmax/gst-openmax.conf7
-rw-r--r--common/recipes-multimedia/gstreamer/gst-openmax_git.bb53
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-bad/0001-Setup-MERAM-for-A1.patch78
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-bad_0.10.23.bbappend27
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-base/0001-gstaudiosink-wait-for-gst_ring_buffer_advance-when-p.patch79
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-base_0.10.36.bbappend5
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0001-sys-v4l2-gstv4l2-fix-the-depth-value-for-RGB32.patch65
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0002-Revert-sys-v4l2-gstv4l2-fix-the-depth-value-for-RGB3.patch64
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0003-sys-v4l2-gstv4l2-register-uiomux-memory-regions-via-.patch262
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0004-sys-v4l2-gstv4l2-release-corresponding-uiomux-handle.patch31
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0005-videocrop-correct-coding-style-with-gst-indent.patch104
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0006-videocrop-send-a-query-whether-the-rowstride-capabil.patch105
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0007-videocrop-set-rowstride-capability.patch59
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0008-videocrop-kick-off-the-zero-copy-cropping.patch100
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0009-avidemux-set-frame-start-code-to-VC-1-advanced-profi.patch90
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0010-videocrop-add-gst_video_crop_get_image_details_from_.patch55
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0011-videocrop-change-the-unit-of-rowstride-to-byte.patch36
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0012-videocrop-add-tests-to-determine-if-width-and-height.patch39
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0013-videocrop-replace-the-processing-to-set-gint-value-t.patch35
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0014-videocrop-don-t-set-rowstride-only-when-the-color-sp.patch66
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0015-videocrop-fix-wrong-subbuffer-size.patch27
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0016-videocrop-support-getting-NV12-image-details.patch84
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0017-videocrop-add-NV12-format-caps-template.patch25
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0018-videocrop-kick-off-NV12-zero-copy-cropping.patch105
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0019-videocrop-send-a-query-by-the-first-invorker-of-quer.patch123
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0020-videocrop-set-tile-boundary-offset-in-caps-for-T-L-a.patch44
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0021-videocrop-support-cropping-interlaced-images.patch99
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0022-videocrop-move-output-buffer-size-calculation-to-tra.patch178
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0023-videocrop-skip-the-transforming-caps-process-when-th.patch32
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0024-v4l2src-fix-RGB32-colorspace-deinitions.patch69
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0025-sys-v4l2-gstv4l2-skip-set-caps-processing-if-the-par.patch86
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0026-sys-v4l2-gstv4l2-return-an-error-from-set_caps-if-tr.patch66
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0027-videocrop-add-a-new-function-to-determine-if-source-.patch67
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0028-videocrop-set-result-of-determing-if-source-images-a.patch35
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0029-videocrop-round-down-cropping-parameters-when-the-co.patch193
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0030-videocrop-hold-a-lock-to-prevent-from-accessing-crop.patch30
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good/0031-videocrop-fix-a-memory-leak-caused-by-invoking-gst_p.patch39
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-good_0.10.31.bbappend37
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-package.inc40
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-private-libs.inc18
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-ugly/0001-asfdemux-asfpacket-set-frame-start-code-to-VC-1-adva.patch99
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins-ugly_0.10.19.bbappend5
-rw-r--r--common/recipes-multimedia/gstreamer/gst-plugins.inc29
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-libav/libav_e500mc.patch21
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.2.3.bbappend9
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.2.3.bbappend21
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.2.3.bbappend5
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.2.3.bbappend5
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0_1.2.3.bbappend1
-rw-r--r--common/recipes-multimedia/libomxil/libomxil_0.9.3.bbappend3
-rw-r--r--common/recipes-multimedia/libshmeram/libshmeram/configfile-path.patch9
-rw-r--r--common/recipes-multimedia/libshmeram/libshmeram_0.9.4.bb29
-rw-r--r--common/recipes-multimedia/libshmeram/libshmeram_git.bb30
-rw-r--r--common/recipes-multimedia/libshvio/libshvio_1.7.2.bb25
-rw-r--r--common/recipes-multimedia/libshvio/libshvio_git.bb25
-rw-r--r--common/recipes-multimedia/libuiomux/libuiomux_1.7.0.bb25
-rw-r--r--common/recipes-multimedia/libuiomux/libuiomux_git.bb28
-rw-r--r--common/recipes-multimedia/omxil-sh/omxil-sh/0001-Removed-include-path-of-VPUMW-and-fixed-the-path-tha.patch28
-rw-r--r--common/recipes-multimedia/omxil-sh/omxil-sh/0001-vpu5-avc-parse-correct-pNal-size-calculation-for-EOS.patch29
-rw-r--r--common/recipes-multimedia/omxil-sh/omxil-sh/vcp1-library-change.patch16
-rw-r--r--common/recipes-multimedia/omxil-sh/omxil-sh_git.bb70
-rw-r--r--common/recipes-multimedia/v4l2apps/media-ctl_git.bbappend4
-rw-r--r--conf/layer.conf10
-rw-r--r--conf/machine/include/renesas-default-providers.inc4
-rw-r--r--files/device_table_add-renesas.txt11
-rw-r--r--meta-rcar-gen2/COPYING.MIT17
-rw-r--r--meta-rcar-gen2/README67
-rw-r--r--meta-rcar-gen2/README.proprietary170
-rw-r--r--meta-rcar-gen2/binary/.gitignore0
-rw-r--r--meta-rcar-gen2/conf/layer.conf10
-rw-r--r--meta-rcar-gen2/conf/machine/alt.conf29
-rw-r--r--meta-rcar-gen2/conf/machine/gose.conf28
-rw-r--r--meta-rcar-gen2/conf/machine/include/r8a7790.inc12
-rw-r--r--meta-rcar-gen2/conf/machine/include/r8a7791.inc12
-rw-r--r--meta-rcar-gen2/conf/machine/include/r8a7793.inc12
-rw-r--r--meta-rcar-gen2/conf/machine/include/r8a7794.inc12
-rw-r--r--meta-rcar-gen2/conf/machine/include/rcar-gen2-providers.inc8
-rw-r--r--meta-rcar-gen2/conf/machine/koelsch.conf28
-rw-r--r--meta-rcar-gen2/conf/machine/lager.conf28
-rw-r--r--meta-rcar-gen2/conf/machine/porter.conf28
-rw-r--r--meta-rcar-gen2/conf/machine/silk.conf28
-rw-r--r--meta-rcar-gen2/include/gles-control.inc6
-rw-r--r--meta-rcar-gen2/include/multimedia-control.inc3
-rw-r--r--meta-rcar-gen2/include/omx-components-control.inc78
-rw-r--r--meta-rcar-gen2/include/rcar-gen2-modules-common.inc9
-rw-r--r--meta-rcar-gen2/recipes-bsp/formfactor/formfactor/alt/machconfig3
-rw-r--r--meta-rcar-gen2/recipes-bsp/formfactor/formfactor/gose/machconfig3
-rw-r--r--meta-rcar-gen2/recipes-bsp/formfactor/formfactor/koelsch/machconfig3
-rw-r--r--meta-rcar-gen2/recipes-bsp/formfactor/formfactor/lager/machconfig0
-rw-r--r--meta-rcar-gen2/recipes-bsp/formfactor/formfactor_0.0.bbappend1
-rw-r--r--meta-rcar-gen2/recipes-bsp/u-boot/u-boot.inc99
-rw-r--r--meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0001-uboot-Silk-board-support.patch1708
-rw-r--r--meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0004-uboot-porter-board-support.patch3186
-rw-r--r--meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0005-uboot-serial-sh-SCIF-internal-clock-support.patch124
-rw-r--r--meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0006-uboot-Silk-disable-dcache-until-fixed.patch51
-rw-r--r--meta-rcar-gen2/recipes-bsp/u-boot/u-boot_2013.01.01.bb32
-rw-r--r--meta-rcar-gen2/recipes-core/base-files/base-files_3.0.14.bbappend7
-rw-r--r--meta-rcar-gen2/recipes-core/libmemcpy/libmemcpy/libmemcpy-1.0.tar.bz2bin0 -> 3992 bytes
-rw-r--r--meta-rcar-gen2/recipes-core/libmemcpy/libmemcpy_1.0.bb12
-rw-r--r--meta-rcar-gen2/recipes-core/ncurses/ncurses_5.9.bbappend4
-rw-r--r--meta-rcar-gen2/recipes-extended/socketcan/can-utils_git.bbappend2
-rw-r--r--meta-rcar-gen2/recipes-graphics/cogl/cogl-1.0_1.16.2.bbappend3
-rw-r--r--meta-rcar-gen2/recipes-graphics/gles-module/gles-test-module.bb45
-rw-r--r--meta-rcar-gen2/recipes-graphics/gles-module/gles-test-module/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module.bb95
-rw-r--r--meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/EGL_headers_for_wayland.patch32
-rw-r--r--meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/change-shell.patch8
-rw-r--r--meta-rcar-gen2/recipes-graphics/images/core-image-renesas-base.inc44
-rw-r--r--meta-rcar-gen2/recipes-graphics/images/core-image-weston-sdk.bb11
-rw-r--r--meta-rcar-gen2/recipes-graphics/images/core-image-weston.bbappend1
-rw-r--r--meta-rcar-gen2/recipes-graphics/images/core-image-weston.inc24
-rw-r--r--meta-rcar-gen2/recipes-graphics/images/core-image-x11-sdk.bb11
-rw-r--r--meta-rcar-gen2/recipes-graphics/images/core-image-x11.bbappend1
-rw-r--r--meta-rcar-gen2/recipes-graphics/images/core-image-x11.inc24
-rw-r--r--meta-rcar-gen2/recipes-graphics/mesa/mesa-dummy.inc0
-rw-r--r--meta-rcar-gen2/recipes-graphics/mesa/mesa-wayland.inc22
-rw-r--r--meta-rcar-gen2/recipes-graphics/mesa/mesa-x11.inc4
-rw-r--r--meta-rcar-gen2/recipes-graphics/mesa/mesa_9.2.5.bbappend13
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/libegl.bb18
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/libegl/0001-libegl-Remove-duplicate-header-files-of-gles-user-mo.patch4091
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/libgbm.bb23
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/wayland-kms_1.4.0.bb21
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/wayland/disable-macro-checks-not-used-for-scanner.patch50
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/wayland_1.5.0.bb41
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/weston/disable-wayland-scanner-pkg-check.patch13
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/weston/make-lcms-explicitly-configurable.patch43
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/weston/make-libwebp-explicitly-configurable.patch37
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/weston/weston.desktop9
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/weston/weston.pngbin0 -> 2383 bytes
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/weston_1.5.0.bb87
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/weston_1.5.0.bbappend25
-rw-r--r--meta-rcar-gen2/recipes-kernel/fdpm-module/fdpm-kernel-module.bb84
-rw-r--r--meta-rcar-gen2/recipes-kernel/fdpm-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-kernel/gles-module/gles-kernel-module.bb102
-rw-r--r--meta-rcar-gen2/recipes-kernel/gles-module/gles-kernel-module/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux-libc-headers/linux-libc-headers/scripts-Makefile.headersinst-install-headers-from-sc.patch59
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux-libc-headers/linux-libc-headers_3.10.bb13
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-dtb-append.inc61
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-dtb.inc69
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-alt-Add-vmalloc-384M-to-bootargs-of-DTS.patch26
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-gose-Add-vmalloc-384M-to-bootargs-of-DTS.patch26
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-koelsch-Add-vmalloc-384M-to-bootargs-of-DTS.patch26
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-lager-Add-vmalloc-384M-to-bootargs-of-DTS.patch26
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-kernel-Silk-board-support.patch1456
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0002-kernel-silk-fix-ethernet-phy-irq.patch25
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0003-kernel-silk-fix-sd-detect.patch25
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0004-kernel-Revert-i2c-rcar-Support-ACK-by-HW-auto-restart-after-NACK.patch66
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0006-Rcar-DU-add-RGB-connector.patch276
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0007-SILK-add-i2c0.patch45
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0008-Porter-board-support.patch1426
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0009-shmobile-add-atag-dtb-compat.patch26
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0010-Silk-Add-missing-pins-handle-to-Eth.patch43
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0011-Silk-Add-missing-DU-pins.patch49
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0012-can-add-Renesas-R-Car-CAN-driver.patch958
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0013-sh-pfc-r8a7791-add-CAN-pin-groups.patch216
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0014-sh-pfc-r8a7791-fix-CAN-pin-groups.patch52
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0015-can-rcar_can-support-all-input-clocks.patch139
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0016-can-rcar_can-document-device-tree-bindings.patch66
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0017-can-rcar_can-add-device-tree-support.patch77
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0018-porter-can-support.patch63
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0019-i2c-busses-rcar-Workaround-arbitration-loss-error.patch31
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0020-Silk-Remove-I2C1-clock-from-clk_enables.patch30
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas_3.10.bb71
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux.inc139
-rw-r--r--meta-rcar-gen2/recipes-kernel/mmngr-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-kernel/mmngr-module/mmngr-kernel-module.bb83
-rw-r--r--meta-rcar-gen2/recipes-kernel/mmngr-module/mmngrbuf-kernel-module.bb63
-rw-r--r--meta-rcar-gen2/recipes-kernel/s3ctl-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bb64
-rw-r--r--meta-rcar-gen2/recipes-kernel/scu-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-kernel/scu-module/scu-kernel-module.bb63
-rw-r--r--meta-rcar-gen2/recipes-kernel/ssp-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-kernel/ssp-module/ssp-kernel-module.bb69
-rw-r--r--meta-rcar-gen2/recipes-kernel/uvcs-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-kernel/uvcs-module/uvcs-kernel-module.bb70
-rw-r--r--meta-rcar-gen2/recipes-kernel/vspm-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-kernel/vspm-module/vspm-kernel-module.bb79
-rw-r--r--meta-rcar-gen2/recipes-multimedia/dtv-module/dtv-user-module.bb52
-rw-r--r--meta-rcar-gen2/recipes-multimedia/dtv-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-multimedia/fdpm-module/fdpm-tp-user-module.bb31
-rw-r--r--meta-rcar-gen2/recipes-multimedia/fdpm-module/fdpm-user-module.bb68
-rw-r--r--meta-rcar-gen2/recipes-multimedia/fdpm-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.0.0.bbappend26
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.2.3.bbappend26
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-alt.conf2
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-gose.conf2
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-koelsch.conf2
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-lager.conf2
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-porter.conf2
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-silk.conf2
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.2.3.bbappend49
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.2.3.bbappend12
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.2.3.bbappend12
-rw-r--r--meta-rcar-gen2/recipes-multimedia/libomxil/libomxil_0.9.3.bbappend3
-rw-r--r--meta-rcar-gen2/recipes-multimedia/mmngr-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngr-tp-user-module.bb29
-rw-r--r--meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngr-user-module.bb65
-rw-r--r--meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngrbuf-tp-user-module.bb29
-rw-r--r--meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngrbuf-user-module.bb67
-rw-r--r--meta-rcar-gen2/recipes-multimedia/omx-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-multimedia/omx-module/omx-user-module.bb426
-rw-r--r--meta-rcar-gen2/recipes-multimedia/packagegroups/packagegroup-rcar-gen2-multimedia.bb69
-rw-r--r--meta-rcar-gen2/recipes-multimedia/packagegroups/packagegroup-rcar-gen2-multimedia.bbappend17
-rw-r--r--meta-rcar-gen2/recipes-multimedia/s3ctl-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-multimedia/s3ctl-module/s3ctl-tp-user-module.bb32
-rw-r--r--meta-rcar-gen2/recipes-multimedia/s3ctl-module/s3ctl-user-module.bb64
-rw-r--r--meta-rcar-gen2/recipes-multimedia/v4l2apps/media-ctl_git.bbappend2
-rw-r--r--meta-rcar-gen2/recipes-multimedia/vspm-module/files/.gitkeep0
-rw-r--r--meta-rcar-gen2/recipes-multimedia/vspm-module/vspm-tp-user-module.bb29
-rw-r--r--meta-rcar-gen2/recipes-multimedia/vspm-module/vspm-user-module.bb58
248 files changed, 23218 insertions, 0 deletions
diff --git a/COPYING.MIT b/COPYING.MIT
new file mode 100644
index 0000000..fb950dc
--- /dev/null
+++ b/COPYING.MIT
@@ -0,0 +1,17 @@
+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.
+
+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. 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/MAINTAINERS b/MAINTAINERS
new file mode 100644
index 0000000..e2bdbe3
--- /dev/null
+++ b/MAINTAINERS
@@ -0,0 +1,28 @@
+This file contains a list of BSP maintainers for the BSPs contained in
+the meta-renesas repository.
+
+Descriptions of section entries:
+
+ M: Mail patches to: FullName <address@domain>
+ F: Files and directories with wildcard patterns.
+ A trailing slash includes all files and subdirectory files.
+ F: meta-XXXXX/ all files in and below meta-XXXXX
+ F: meta-XXXXX/* all files in meta-XXXXX, but not below
+ One pattern per line. Multiple F: lines acceptable.
+
+Please keep this list in alphabetical order.
+
+Maintainers List (try to look for most precise areas first)
+
+ -----------------------------------
+Renesas ARM SoCs R-Car Generation 2
+M: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+F: meta-rcar-gen2
+
+Renesas ARM SoCs rmobile
+M: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+F: meta-rmobile
+
+COMMON
+M: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+F: common/
diff --git a/README b/README
new file mode 100644
index 0000000..2c931a1
--- /dev/null
+++ b/README
@@ -0,0 +1,28 @@
+OpenEmbedded/Yocto BSP layer for Renesas Electronics's SoCs
+==========
+This layer provides support for Renesas Electronics's platforms for use with
+OpenEmbedded and/or Yocto.
+
+Layer maintainers: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+
+Supported Boards/Machines
+=========================
+
+In addition, this also provides layer that provides support board that is used
+SoCs that Renesas build. Layer and board that supports following:
+
+ * meta-rcar-gen2
+ - Renesas Electronics Corporation. Alt (R8A7794)
+ - Renesas Electronics Corporation. Gose (R8A7793)
+ - Renesas Electronics Corporation. Koelsch (R8A7791)
+ - Renesas Electronics Corporation. Lager (R8A7790)
+ * meta-rmobile
+ - Atmark Techno, Inc. Armadillo-800 EVA (R8A7740)
+
+Please see README in the layer directory about the description of the board.
+
+Original BSP image
+=========================
+The meta-renesas layer provides original BSP image. The following
+ * core-image-x11
+ * core-image-weston
diff --git a/common/recipes-core/eglibc/eglibc_2.19.bbappend b/common/recipes-core/eglibc/eglibc_2.19.bbappend
new file mode 100644
index 0000000..afd1fe4
--- /dev/null
+++ b/common/recipes-core/eglibc/eglibc_2.19.bbappend
@@ -0,0 +1 @@
+INSANE_SKIP_nativesdk-nscd += "textrel"
diff --git a/common/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.8.bbappend b/common/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.8.bbappend
new file mode 100644
index 0000000..8dec207
--- /dev/null
+++ b/common/recipes-devtools/gcc/gcc-cross-canadian_linaro-4.8.bbappend
@@ -0,0 +1 @@
+INSANE_SKIP_${PN} += "libdir"
diff --git a/common/recipes-devtools/gcc/libgcc_4.8.bbappend b/common/recipes-devtools/gcc/libgcc_4.8.bbappend
new file mode 100644
index 0000000..1f9888d
--- /dev/null
+++ b/common/recipes-devtools/gcc/libgcc_4.8.bbappend
@@ -0,0 +1,38 @@
+do_install_append () {
+ BINVER=`${TARGET_PREFIX}gcc -dumpversion`
+ if [ ${BINVER} != ${BINV} ] ; then
+ rm -rf ${D}${libdir}/${TARGET_SYS}/${BINVER}/include
+ SRC=${D}${libdir}/${TARGET_SYS}/${BINV}
+ DEST=${D}${libdir}/${TARGET_SYS}/${BINVER}
+ install -d ${SRC} ${DEST}
+ for f in ${SRC}/*
+ do
+ cp ${f} ${DEST}
+ done
+ fi
+}
+
+python do_package_prepend () {
+ import subprocess
+ subfolder = "*crt* 64 32 x32 n32 libgcc*"
+ cc = d.getVar('TARGET_PREFIX', True) + 'gcc'
+ cmd = subprocess.Popen([cc, "-dumpversion"], stdout=subprocess.PIPE)
+ out, err = cmd.communicate()
+ version = out.split()[-1]
+ binv = d.getVar('BINV', True)
+ if (version != binv):
+ pn = d.getVar('PN', True)
+ libdir = d.getVar('libdir', True)
+ targetsys = d.getVar('TARGET_SYS', True)
+ appendprefix = ' ' + libdir + '/' + targetsys + '/' + version + '/'
+ appends = ''
+ for i in subfolder.split():
+ appends = appends + appendprefix + i
+ d.appendVar("FILES_" + pn + "-dev", appends)
+ if bb.data.inherits_class('nativesdk', d):
+ packages_libgcov = 'FILES_nativesdk-libgcov-dev'
+ else:
+ packages_libgcov = 'FILES_libgcov-dev'
+ d.appendVar(packages_libgcov, appendprefix + "libgcov.a")
+}
+
diff --git a/common/recipes-devtools/qemu/qemu_1.7.0.bbappend b/common/recipes-devtools/qemu/qemu_1.7.0.bbappend
new file mode 100644
index 0000000..e860069
--- /dev/null
+++ b/common/recipes-devtools/qemu/qemu_1.7.0.bbappend
@@ -0,0 +1 @@
+INSANE_SKIP_${PN} += "textrel"
diff --git a/common/recipes-gnome/gtk+/gtk+_2.24.22.bbappend b/common/recipes-gnome/gtk+/gtk+_2.24.22.bbappend
new file mode 100644
index 0000000..6fc9264
--- /dev/null
+++ b/common/recipes-gnome/gtk+/gtk+_2.24.22.bbappend
@@ -0,0 +1,26 @@
+PACKAGESPLITFUNCS_prepend += " add_private_libs_packages "
+
+python add_private_libs_packages () {
+ import os
+ import re
+
+ gtk_libdir = d.expand('${libdir}/gtk-2.0/${LIBV}')
+ immodules_root = os.path.join(gtk_libdir, 'immodules')
+ printmodules_root = os.path.join(gtk_libdir, 'printbackends');
+
+ dvar = d.getVar('PKGD', True)
+
+ for dirpath, dirnames, filenames in os.walk(dvar + immodules_root):
+ for f in filenames:
+ m = re.match('^im-(.*)\.so$', f)
+ if m:
+ immodule = m.group(1)
+ d.setVar('PRIVATE_LIBS_' + 'gtk-immodule-' + immodule , 'im-' + immodule + '.so')
+
+ for dirpath, dirnames, filenames in os.walk(dvar + printmodules_root):
+ for f in filenames:
+ m = re.match('^libprintbackend-(.*)\.so$', f)
+ if m:
+ printbackend = m.group(1)
+ d.setVar('PRIVATE_LIBS_' + 'gtk-printbackend-' + printbackend , 'libprintbackend-' + printbackend + '.so')
+} \ No newline at end of file
diff --git a/common/recipes-graphics/directfb/directfb-examples_git.bb b/common/recipes-graphics/directfb/directfb-examples_git.bb
new file mode 100644
index 0000000..a022393
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb-examples_git.bb
@@ -0,0 +1,20 @@
+DEFAULT_PREFERENCE = "-1"
+DESCRIPTION = "The DirectFB-examples package contains a set of simple DirectFB \
+ applications that can be used to test and demonstrate various DirectFB \
+ features"
+DEPENDS = "directfb"
+SECTION = "libs"
+LICENSE = "MIT"
+RV = "1.7-0+git"
+PR = "r0"
+
+SRC_URI = " \
+ git://git.directfb.org/git/directfb/extras/DirectFB-examples.git;protocol=git \
+ "
+SRCREV = "61ddf7dc02ee28d8cab20ad482f37c2ad4390835"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=ecf6fd2b19915afc4da56043926ca18f"
+
+S = "${WORKDIR}/git"
+
+inherit autotools
diff --git a/common/recipes-graphics/directfb/directfb.inc b/common/recipes-graphics/directfb/directfb.inc
new file mode 100644
index 0000000..60b12f7
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb.inc
@@ -0,0 +1,72 @@
+SUMMARY = "Graphics abstraction library for the Linux Framebuffer Device"
+DESCRIPTION = "DirectFB is a thin library that provides developers \
+with hardware graphics acceleration, input device handling and \
+abstraction, an integrated windowing system with support for \
+translucent windows and multiple display layers on top of the \
+Linux framebuffer device."
+SECTION = "libs"
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=dcf3c825659e82539645da41a7908589"
+
+HOMEPAGE = "http://directfb.org"
+DEPENDS = "jpeg libpng freetype zlib tslib"
+
+INC_PR = "r0"
+
+SRC_URI = "http://directfb.org/downloads/Core/DirectFB-1.6/DirectFB-${PV}.tar.gz \
+ file://configurefix.patch"
+
+S = "${WORKDIR}/DirectFB-${PV}"
+
+LDFLAGS_append =" -lts -lm"
+
+inherit autotools binconfig pkgconfig
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[jpeg2000] = "--enable-jpeg2000,--disable-jpeg2000,jasper"
+
+EXTRA_OECONF = "\
+ --with-gfxdrivers=none \
+ --enable-libmpeg3=no \
+ --enable-freetype=yes \
+ --enable-sdl=no \
+ --enable-vnc=no \
+ --disable-x11 \
+ --disable-mesa \
+"
+
+#Once -fno-omit-frame-pointer option of gcc is added into TARGET_CLFAGS as default
+#this will cause directfb build failure on x86 arch, so filter out it.
+TARGET_CFLAGS_x86 := "${@oe_filter_out('-fno-omit-frame-pointer', '${TARGET_CFLAGS}', d)}"
+
+#PACKAGES_DYNAMIC += "^directfb-inputdrivers-.*"
+#
+#python populate_packages_prepend () {
+# inputdrivers_libdir = d.expand('${libdir}/directfb-${RV}/inputdrivers')
+# do_split_packages(d, inputdrivers_libdir, '*.so$', 'directfb-inputdrivers-%s', 'Directfb plugin for %s')
+#}
+
+# NOTE: monolithic packaging for now, should improve that eventually
+
+
+
+FILES_${PN}-dbg += "\
+ ${libdir}/directfb-${RV}/*/*/.debug/*.so \
+ ${libdir}/directfb-${RV}/*/.debug/*.so \
+"
+
+FILES_${PN}-dev += "\
+ ${bindir}/directfb-config \
+ ${libdir}/directfb-${RV}/systems/*.la \
+ ${libdir}/directfb-${RV}/inputdrivers/*.la \
+ ${libdir}/directfb-${RV}/interfaces/*/*.la \
+ ${libdir}/directfb-${RV}/wm/*.la \
+"
+
+FILES_${PN} += "\
+ ${libdir}/directfb-${RV}/systems/*.so \
+ ${libdir}/directfb-${RV}/inputdrivers/*.so \
+ ${libdir}/directfb-${RV}/interfaces/*/*.so \
+ ${libdir}/directfb-${RV}/wm/*.so \
+ ${datadir}/directfb-${PV} \
+"
diff --git a/common/recipes-graphics/directfb/directfb/0001-drmkms-fix-property-to-check-when-setting-source-col.patch b/common/recipes-graphics/directfb/directfb/0001-drmkms-fix-property-to-check-when-setting-source-col.patch
new file mode 100644
index 0000000..5c62dda
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/0001-drmkms-fix-property-to-check-when-setting-source-col.patch
@@ -0,0 +1,26 @@
+From 5bd208eb5e9d5e3e7f864e2e5d44060854fa40b4 Mon Sep 17 00:00:00 2001
+From: Takanari Hayama <taki@igel.co.jp>
+Date: Thu, 19 Sep 2013 18:55:03 +0900
+Subject: [PATCH 1/2] drmkms: fix property to check when setting source color
+ key.
+
+---
+ systems/drmkms/drmkms_layer.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/systems/drmkms/drmkms_layer.c b/systems/drmkms/drmkms_layer.c
+index bcae04f..a80d2e5 100644
+--- a/systems/drmkms/drmkms_layer.c
++++ b/systems/drmkms/drmkms_layer.c
+@@ -434,7 +434,7 @@ drmkmsPlaneSetRegion( CoreLayer *layer,
+
+ }
+
+- if ((updated & (CLRCF_SRCKEY | CLRCF_OPTIONS)) && data->alpha_propid) {
++ if ((updated & (CLRCF_SRCKEY | CLRCF_OPTIONS)) && data->colorkey_propid) {
+ uint32_t drm_colorkey = config->src_key.r << 16 | config->src_key.g << 8 | config->src_key.b;
+
+ if (config->options & DLOP_SRC_COLORKEY)
+--
+1.7.9.5
+
diff --git a/common/recipes-graphics/directfb/directfb/0002-drmkms-mute-plane-when-opacity-is-set-to-zero.patch b/common/recipes-graphics/directfb/directfb/0002-drmkms-mute-plane-when-opacity-is-set-to-zero.patch
new file mode 100644
index 0000000..226d5d5
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/0002-drmkms-mute-plane-when-opacity-is-set-to-zero.patch
@@ -0,0 +1,150 @@
+From 68e46530a1821ab2a2209899bf971e1ca39acac9 Mon Sep 17 00:00:00 2001
+From: Takanari Hayama <taki@igel.co.jp>
+Date: Thu, 19 Sep 2013 18:55:43 +0900
+Subject: [PATCH 2/2] drmkms: mute plane when opacity is set to zero.
+
+If the opacity value of zero is passed, then we mute the plane
+by disabling the plane. We re-enable when the plane if non-zero
+opacity value is passed.
+---
+ systems/drmkms/drmkms_layer.c | 65 +++++++++++++++++++++++++---------------
+ systems/drmkms/drmkms_system.h | 2 ++
+ 2 files changed, 43 insertions(+), 24 deletions(-)
+
+diff --git a/systems/drmkms/drmkms_layer.c b/systems/drmkms/drmkms_layer.c
+index a80d2e5..f2e8011 100644
+--- a/systems/drmkms/drmkms_layer.c
++++ b/systems/drmkms/drmkms_layer.c
+@@ -388,8 +388,7 @@ drmkmsPlaneTestRegion( CoreLayer *layer,
+
+ CoreLayerRegionConfigFlags failed = CLRCF_NONE;
+
+- if (((config->options & DLOP_OPACITY ) && !data->alpha_propid ) ||
+- ((config->options & DLOP_SRC_COLORKEY) && !data->colorkey_propid))
++ if ((config->options & DLOP_SRC_COLORKEY) && !data->colorkey_propid)
+ failed |= CLRCF_OPTIONS;
+
+ if (ret_failed)
+@@ -414,11 +413,15 @@ drmkmsPlaneSetRegion( CoreLayer *layer,
+ CoreSurfaceBufferLock *right_lock )
+ {
+ int ret;
++ bool unmute = false;
+ DRMKMSData *drmkms = driver_data;
+ DRMKMSLayerData *data = layer_data;
+
+ D_DEBUG_AT( DRMKMS_Layer, "%s()\n", __FUNCTION__ );
+- if (updated & (CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_BUFFERMODE | CLRCF_DEST | CLRCF_SOURCE)) {
++ if ((updated & CLRCF_OPACITY) && data->muted && config->opacity)
++ unmute = true;
++
++ if ((updated & (CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_BUFFERMODE | CLRCF_DEST | CLRCF_SOURCE)) || unmute) {
+ ret = drmModeSetPlane(drmkms->fd, data->plane->plane_id, drmkms->encoder[0]->crtc_id, (u32)(long)left_lock->handle,
+ /* plane_flags */ 0, config->dest.x, config->dest.y, config->dest.w, config->dest.h,
+ config->source.x << 16, config->source.y <<16, config->source.w << 16, config->source.h << 16);
+@@ -431,7 +434,7 @@ drmkmsPlaneSetRegion( CoreLayer *layer,
+ }
+
+ data->config = config;
+-
++ data->muted = false;
+ }
+
+ if ((updated & (CLRCF_SRCKEY | CLRCF_OPTIONS)) && data->colorkey_propid) {
+@@ -448,15 +451,26 @@ drmkmsPlaneSetRegion( CoreLayer *layer,
+ }
+ }
+
+- if (updated & CLRCF_OPACITY && data->alpha_propid) {
+- ret = drmModeObjectSetProperty( drmkms->fd, data->plane->plane_id, DRM_MODE_OBJECT_PLANE, data->alpha_propid, config->opacity );
++ if (updated & CLRCF_OPACITY) {
++ if (config->opacity == 0) {
++ ret = drmModeSetPlane(drmkms->fd, data->plane->plane_id, drmkms->encoder[0]->crtc_id, 0,
++ /* plane_flags */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
+
+- if (ret) {
+- D_ERROR( "DirectFB/DRMKMS: drmModeObjectSetProperty() failed setting alpha\n");
+- return DFB_FAILURE;
+- }
+- }
++ if (ret) {
++ D_ERROR( "DirectFB/DRMKMS: drmModeSetPlane() failed disabling plane\n");
++ return DFB_FAILURE;
++ }
++
++ data->muted = true;
++ } else if (data->alpha_propid) {
++ ret = drmModeObjectSetProperty( drmkms->fd, data->plane->plane_id, DRM_MODE_OBJECT_PLANE, data->alpha_propid, config->opacity );
+
++ if (ret) {
++ D_ERROR( "DirectFB/DRMKMS: drmModeObjectSetProperty() failed setting alpha\n");
++ return DFB_FAILURE;
++ }
++ }
++ }
+
+ return DFB_OK;
+ }
+@@ -473,13 +487,14 @@ drmkmsPlaneRemoveRegion( CoreLayer *layer,
+
+ D_DEBUG_AT( DRMKMS_Layer, "%s()\n", __FUNCTION__ );
+
++ if (!data->muted) {
++ ret = drmModeSetPlane(drmkms->fd, data->plane->plane_id, drmkms->encoder[0]->crtc_id, 0,
++ /* plane_flags */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
+
+- ret = drmModeSetPlane(drmkms->fd, data->plane->plane_id, drmkms->encoder[0]->crtc_id, 0,
+- /* plane_flags */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
+-
+- if (ret) {
+- D_PERROR( "DRMKMS/Layer/Remove: Failed setting plane configuration!\n" );
+- return ret;
++ if (ret) {
++ D_PERROR( "DRMKMS/Layer/Remove: Failed setting plane configuration!\n" );
++ return ret;
++ }
+ }
+
+ return DFB_OK;
+@@ -521,16 +536,18 @@ drmkmsPlaneFlipRegion( CoreLayer *layer,
+ /* Task */
+ data->pending_task = left_lock->task;
+
+- ret = drmModeSetPlane(drmkms->fd, data->plane->plane_id, drmkms->encoder[0]->crtc_id, (u32)(long)left_lock->handle,
+- /* plane_flags */ 0, data->config->dest.x, data->config->dest.y, data->config->dest.w, data->config->dest.h,
+- data->config->source.x << 16, data->config->source.y <<16, data->config->source.w << 16, data->config->source.h << 16);
++ if (!data->muted) {
++ ret = drmModeSetPlane(drmkms->fd, data->plane->plane_id, drmkms->encoder[0]->crtc_id, (u32)(long)left_lock->handle,
++ /* plane_flags */ 0, data->config->dest.x, data->config->dest.y, data->config->dest.w, data->config->dest.h,
++ data->config->source.x << 16, data->config->source.y <<16, data->config->source.w << 16, data->config->source.h << 16);
+
+- if (ret) {
+- D_PERROR( "DRMKMS/Layer/FlipRegion: Failed setting plane configuration!\n" );
++ if (ret) {
++ D_PERROR( "DRMKMS/Layer/FlipRegion: Failed setting plane configuration!\n" );
+
+- direct_mutex_unlock( &data->lock );
++ direct_mutex_unlock( &data->lock );
+
+- return ret;
++ return ret;
++ }
+ }
+
+ dfb_surface_flip( surface, false );
+diff --git a/systems/drmkms/drmkms_system.h b/systems/drmkms/drmkms_system.h
+index 008bfea..142ec68 100644
+--- a/systems/drmkms/drmkms_system.h
++++ b/systems/drmkms/drmkms_system.h
+@@ -83,6 +83,8 @@ typedef struct {
+
+ DirectMutex lock;
+ DirectWaitQueue wq_event;
++
++ bool muted;
+ } DRMKMSLayerData;
+
+ typedef struct {
+--
+1.7.9.5
+
diff --git a/common/recipes-graphics/directfb/directfb/configurefix.patch b/common/recipes-graphics/directfb/directfb/configurefix.patch
new file mode 100644
index 0000000..dd8c019
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/configurefix.patch
@@ -0,0 +1,60 @@
+Libtool needs these set correctly else we end up with pointless rpaths
+such as the QA warnings:
+
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/dfblayer contains probably-redundant RPATH /usr/libWARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/dfbmaster contains probably-redundant RPATH /usr/libWARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/mkdgifft contains probably-redundant RPATH /usr/libWARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/dfbdump contains probably-redundant RPATH /usr/libWARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/dfbinput contains probably-redundant RPATH /usr/libWARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/dfbfx contains probably-redundant RPATH /usr/libWARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/dfbscreen contains probably-redundant RPATH /usr/libWARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/mkdgiff contains probably-redundant RPATH /usr/libWARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/dfbinspector contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/mkdfiff contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/dfbinfo contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/dfbpenmount contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/bin/dfbg contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/libfusion-1.4.so.6 contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/libdirectfb-1.4.so.6.0.9 contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/libdirectfb-1.4.so.6 contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/libfusion-1.4.so.6.0.9 contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/systems/libdirectfb_fbdev.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/systems/libdirectfb_devmem.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/systems/libdirectfb_dummy.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/interfaces/IDirectFBVideoProvider/libidirectfbvideoprovider_v4l.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/interfaces/IDirectFBVideoProvider/libidirectfbvideoprovider_gif.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/interfaces/ICoreResourceManager/libicoreresourcemanager_test.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/interfaces/IDirectFBImageProvider/libidirectfbimageprovider_jpeg.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/interfaces/IDirectFBImageProvider/libidirectfbimageprovider_png.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/interfaces/IDirectFBImageProvider/libidirectfbimageprovider_dfiff.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/interfaces/IDirectFBImageProvider/libidirectfbimageprovider_gif.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/interfaces/IDirectFBFont/libidirectfbfont_ft2.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/interfaces/IDirectFBFont/libidirectfbfont_dgiff.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/wm/libdirectfbwm_default.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_zytronic.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_penmount.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_linux_input.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_serialmouse.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_mutouch.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_tslib.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_joystick.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_sonypi.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_lirc.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_wm97xx_ts.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_ps2mouse.so contains probably-redundant RPATH /usr/lib
+WARNING: QA Issue: directfb: /work/i586-poky-linux/directfb-1.4.15-r1/packages-split/directfb/usr/lib/directfb-1.4-6/inputdrivers/libdirectfb_keyboard.so contains probably-redundant RPATH /usr/lib
+
+Upstream-Status: Pending
+
+RP 2012/03/16
+
+Index: DirectFB-1.4.15/configure.in
+===================================================================
+--- DirectFB-1.4.15.orig/configure.in 2012-03-16 13:32:23.692402879 +0000
++++ DirectFB-1.4.15/configure.in 2012-03-16 13:33:22.312400960 +0000
+@@ -97,13 +97,6 @@
+ AC_CHECK_SIZEOF(long long)
+ AC_CHECK_FUNCS(fork)
+
+-
+-## Work around libstuhl during cross build...
+-if test "$host" != "$build"; then
+- sys_lib_dlsearch_path_spec=""
+- sys_lib_search_path_spec=""
+-fi
+-
+ AC_PATH_PROGS(PERL, perl5 perl)
+
+ AC_PATH_PROG(MAN2HTML, man2html, no)
diff --git a/common/recipes-graphics/directfb/directfb/dfb_uiomux_support.patch b/common/recipes-graphics/directfb/directfb/dfb_uiomux_support.patch
new file mode 100644
index 0000000..fdad88b
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/dfb_uiomux_support.patch
@@ -0,0 +1,36 @@
+diff --git a/systems/fbdev/Makefile.am b/systems/fbdev/Makefile.am
+index 2911ad8..ce268de 100644
+--- a/systems/fbdev/Makefile.am
++++ b/systems/fbdev/Makefile.am
+@@ -41,7 +43,8 @@ libdirectfb_fbdev_la_SOURCES = \
+ libdirectfb_fbdev_la_LIBADD = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+- $(top_builddir)/src/libdirectfb.la
++ $(top_builddir)/src/libdirectfb.la \
++ -luiomux
+
+
+ include $(top_srcdir)/rules/libobject.make
+diff --git a/systems/fbdev/fbdev.c b/systems/fbdev/fbdev.c
+index dd1c343..03e7361 100644
+--- a/systems/fbdev/fbdev.c
++++ b/systems/fbdev/fbdev.c
+@@ -93,6 +93,7 @@
+ #include "agp.h"
+
+ #include <core/core_system.h>
++#include <uiomux/uiomux.h>
+
+ DFB_CORE_SYSTEM( fbdev )
+
+@@ -517,6 +518,9 @@ system_initialize( CoreDFB *core, void **data )
+ goto error;
+ }
+
++ uiomux_register(dfb_fbdev->framebuffer_base, shared->fix.smem_start,
++ shared->fix.smem_len);
++
+ if (ioctl( dfb_fbdev->fd, FBIOGET_VSCREENINFO, &shared->orig_var ) < 0) {
+ D_PERROR( "DirectFB/FBDev: "
+ "Could not get variable screen information!\n" );
diff --git a/common/recipes-graphics/directfb/directfb/directfb-1.2.x-fix-pkgconfig-cflags.patch b/common/recipes-graphics/directfb/directfb/directfb-1.2.x-fix-pkgconfig-cflags.patch
new file mode 100644
index 0000000..ee60718
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/directfb-1.2.x-fix-pkgconfig-cflags.patch
@@ -0,0 +1,48 @@
+directfb: Get this patch from Openembedded
+
+Upstream-Status: Inappropriate [configuration]
+Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
+
+diff -Nur DirectFB-1.4.15/directfb-internal.pc.in DirectFB-1.4.15.new//directfb-internal.pc.in
+--- DirectFB-1.4.15/directfb-internal.pc.in 2011-09-29 17:51:21.000000000 +0800
++++ DirectFB-1.4.15.new//directfb-internal.pc.in 2011-11-03 15:14:37.000000000 +0800
+@@ -2,10 +2,10 @@
+ exec_prefix=@exec_prefix@
+ moduledir=@MODULEDIR@
+ moduledirname=@MODULEDIRNAME@
+-includedir=@INTERNALINCLUDEDIR@
++includedir=@includedir@
+
+ Name: DirectFB-Internal
+ Description: Third party module support package for DirectFB.
+ Version: @VERSION@
+ Requires: directfb = @VERSION@
+-Cflags: @DFB_INTERNAL_CFLAGS@ -I@INTERNALINCLUDEDIR@
++Cflags: @DFB_INTERNAL_CFLAGS@ -I${includedir}/directfb -I${includedir}
+diff -Nur DirectFB-1.4.15/directfb.pc.in DirectFB-1.4.15.new//directfb.pc.in
+--- DirectFB-1.4.15/directfb.pc.in 2011-09-29 17:51:21.000000000 +0800
++++ DirectFB-1.4.15.new//directfb.pc.in 2011-11-03 15:15:55.000000000 +0800
+@@ -9,4 +9,4 @@
+ Requires: @DEP_VOODOO@ fusion direct
+ Libs: -L${libdir} -ldirectfb @THREADLIB@ @OSX_LIBS@
+ Libs.private: -L${libdir} @LIBM@ @DYNLIB@ @ZLIB_LIBS@
+-Cflags: @THREADFLAGS@ -I@INCLUDEDIR@
++Cflags: @THREADFLAGS@ -I${includedir}/directfb
+diff -Nur DirectFB-1.4.15/lib/fusion/fusion.pc.in DirectFB-1.4.15.new//lib/fusion/fusion.pc.in
+--- DirectFB-1.4.15/lib/fusion/fusion.pc.in 2011-09-29 17:51:21.000000000 +0800
++++ DirectFB-1.4.15.new//lib/fusion/fusion.pc.in 2011-11-03 15:16:46.000000000 +0800
+@@ -8,4 +8,4 @@
+ Version: @VERSION@
+ Requires: direct
+ Libs: -L${libdir} -lfusion
+-Cflags: -I@INCLUDEDIR@
++Cflags: -I${includedir}/directfb -I${includedir}
+diff -Nur DirectFB-1.4.15/lib/voodoo/voodoo.pc.in DirectFB-1.4.15.new//lib/voodoo/voodoo.pc.in
+--- DirectFB-1.4.15/lib/voodoo/voodoo.pc.in 2011-09-29 17:51:21.000000000 +0800
++++ DirectFB-1.4.15.new//lib/voodoo/voodoo.pc.in 2011-11-03 15:17:34.000000000 +0800
+@@ -8,4 +8,4 @@
+ Version: @VERSION@
+ Requires: direct
+ Libs: -L${libdir} -lvoodoo
+-Cflags: -I@INCLUDEDIR@
++Cflags: -I${includedir}/directfb -I${includedir}
diff --git a/common/recipes-graphics/directfb/directfb/directfbrc b/common/recipes-graphics/directfb/directfb/directfbrc
new file mode 100644
index 0000000..75e9359
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/directfbrc
@@ -0,0 +1,5 @@
+system=drmkms
+drmkms-use-prime-fd
+drmkms-device=/dev/dri/card1
+no-vt
+mode=1024x768
diff --git a/common/recipes-graphics/directfb/directfb/fbdev-uiomux-register.patch b/common/recipes-graphics/directfb/directfb/fbdev-uiomux-register.patch
new file mode 100644
index 0000000..9bea5a3
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/fbdev-uiomux-register.patch
@@ -0,0 +1,54 @@
+diff -ru DirectFB-1.6.0//systems/fbdev/fbdev.c ../DirectFB-1.6.0//systems/fbdev/fbdev.c
+--- DirectFB-1.6.0//systems/fbdev/fbdev.c 2012-06-15 01:00:08.000000000 +0900
++++ ../DirectFB-1.6.0//systems/fbdev/fbdev.c 2012-08-30 16:16:11.998778572 +0900
+@@ -93,6 +93,7 @@
+ #include "agp.h"
+
+ #include <core/core_system.h>
++#include <uiomux/uiomux.h>
+
+ DFB_CORE_SYSTEM( fbdev )
+
+@@ -517,6 +518,9 @@
+ goto error;
+ }
+
++ uiomux_register(dfb_fbdev->framebuffer_base, shared->fix.smem_start,
++ shared->fix.smem_len);
++
+ if (ioctl( dfb_fbdev->fd, FBIOGET_VSCREENINFO, &shared->orig_var ) < 0) {
+ D_PERROR( "DirectFB/FBDev: "
+ "Could not get variable screen information!\n" );
+diff -ru DirectFB-1.6.0//systems/fbdev/Makefile.am ../DirectFB-1.6.0//systems/fbdev/Makefile.am
+--- DirectFB-1.6.0//systems/fbdev/Makefile.am 2012-06-15 01:00:08.000000000 +0900
++++ ../DirectFB-1.6.0//systems/fbdev/Makefile.am 2012-08-30 16:28:27.022814147 +0900
+@@ -5,7 +5,8 @@
+ -I$(top_builddir)/lib \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/lib \
+- -I$(top_srcdir)/src
++ -I$(top_srcdir)/src \
++ -I/usr/local/include
+
+ AM_CPPFLAGS = -D_XOPEN_SOURCE=500
+
+@@ -29,7 +30,8 @@
+
+ libdirectfb_fbdev_la_LDFLAGS = \
+ -avoid-version \
+- -module
++ -module \
++ -L/usr/local/lib
+
+ libdirectfb_fbdev_la_SOURCES = \
+ agp.c \
+@@ -41,7 +43,8 @@
+ libdirectfb_fbdev_la_LIBADD = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+- $(top_builddir)/src/libdirectfb.la
++ $(top_builddir)/src/libdirectfb.la \
++ -luiomux
+
+
+ include $(top_srcdir)/rules/libobject.make
diff --git a/common/recipes-graphics/directfb/directfb/fix-compilation-with-zlib.patch b/common/recipes-graphics/directfb/directfb/fix-compilation-with-zlib.patch
new file mode 100644
index 0000000..8b99b4e
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/fix-compilation-with-zlib.patch
@@ -0,0 +1,29 @@
+Upstream-Status: Pending
+
+From 1d6d597050fc24769e9df2693f754bdc824a8b78 Mon Sep 17 00:00:00 2001
+From: Laurentiu Palcu <laurentiu.palcu@intel.com>
+Date: Tue, 3 Jul 2012 16:06:10 +0300
+Subject: [PATCH] fix compilation with zlib
+
+Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
+---
+ src/core/surface.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/core/surface.c b/src/core/surface.c
+index 50434a2..52f50ab 100644
+--- a/src/core/surface.c
++++ b/src/core/surface.c
+@@ -49,6 +49,9 @@
+ #include <gfx/convert.h>
+ #include <gfx/util.h>
+
++#ifdef USE_ZLIB
++#include <zlib.h>
++#endif
+
+ D_DEBUG_DOMAIN( Core_Surface, "Core/Surface", "DirectFB Core Surface" );
+
+--
+1.7.9.5
+
diff --git a/common/recipes-graphics/directfb/directfb/fixsepbuild.patch b/common/recipes-graphics/directfb/directfb/fixsepbuild.patch
new file mode 100644
index 0000000..94a9ba5
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/fixsepbuild.patch
@@ -0,0 +1,19 @@
+Fix out of tree builds
+
+Upstream-Status: Pending
+
+RP 2013/03/21
+
+Index: DirectFB-1.6.1/configure.in
+===================================================================
+--- DirectFB-1.6.1.orig/configure.in 2013-03-19 01:38:28.174004720 +0000
++++ DirectFB-1.6.1/configure.in 2013-03-21 12:18:10.253113675 +0000
+@@ -111,7 +111,7 @@
+ AC_PATH_TOOL(FLUXCOMP, fluxcomp)
+ AC_SUBST(FLUXCOMP)
+ if test -z "$FLUXCOMP"; then
+- if ! test -e src/core/CoreDFB.cpp; then
++ if ! test -e $srcdir/src/core/CoreDFB.cpp; then
+ AC_MSG_ERROR([
+ *** DirectFB compilation requires fluxcomp ***
+
diff --git a/common/recipes-graphics/directfb/directfb/mesa9.patch b/common/recipes-graphics/directfb/directfb/mesa9.patch
new file mode 100644
index 0000000..43fd5c2
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/mesa9.patch
@@ -0,0 +1,29 @@
+Patch from upstream to fix build against Mesa 9.
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From 54beba0715a4fead2a0aa5477977347f81fc2bc0 Mon Sep 17 00:00:00 2001
+From: Andreas Shimokawa <andi@directfb.org>
+Date: Wed, 24 Oct 2012 18:01:15 +0200
+Subject: [PATCH] mesa: fix compatibility with mesa 9.0
+
+---
+ systems/mesa/mesa_surface_pool.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/systems/mesa/mesa_surface_pool.c b/systems/mesa/mesa_surface_pool.c
+index 0a588bb..bfb5ff3 100644
+--- a/systems/mesa/mesa_surface_pool.c
++++ b/systems/mesa/mesa_surface_pool.c
+@@ -297,7 +297,7 @@ mesaAllocateBuffer( CoreSurfacePool *pool,
+ alloc->bo = gbm_bo_create( mesa->gbm, surface->config.size.w, surface->config.size.h, GBM_BO_FORMAT_ARGB8888,
+ GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING );
+ alloc->handle = gbm_bo_get_handle( alloc->bo ).u32;
+- alloc->pitch = gbm_bo_get_pitch( alloc->bo );
++ alloc->pitch = gbm_bo_get_stride( alloc->bo );
+
+ alloc->image = eglCreateImageKHR( mesa->dpy, NULL, EGL_NATIVE_PIXMAP_KHR, alloc->bo, NULL );
+
+--
+1.7.9.5
diff --git a/common/recipes-graphics/directfb/directfb/rename-no-instrument-function-macro.patch b/common/recipes-graphics/directfb/directfb/rename-no-instrument-function-macro.patch
new file mode 100644
index 0000000..443df5a
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb/rename-no-instrument-function-macro.patch
@@ -0,0 +1,345 @@
+Rename __no_instrument_function__ macro to avoid conficting redefinitions
+of the same symbol.
+
+Upstream-Status: Pending
+Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
+
+Index: DirectFB-1.6.1/lib/direct/clock.c
+===================================================================
+--- DirectFB-1.6.1.orig/lib/direct/clock.c 2012-06-29 19:01:11.000000000 +0300
++++ DirectFB-1.6.1/lib/direct/clock.c 2013-01-05 18:03:24.000000000 +0200
+@@ -36,28 +36,28 @@
+
+ /**********************************************************************************************************************/
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ long long
+ direct_clock_get_micros( void )
+ {
+ return direct_clock_get_time( DIRECT_CLOCK_SESSION );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ long long
+ direct_clock_get_millis( void )
+ {
+ return direct_clock_get_time( DIRECT_CLOCK_SESSION ) / 1000LL;
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ long long
+ direct_clock_get_abs_micros( void )
+ {
+ return direct_clock_get_time( DIRECT_CLOCK_REALTIME );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ long long
+ direct_clock_get_abs_millis( void )
+ {
+Index: DirectFB-1.6.1/lib/direct/debug.c
+===================================================================
+--- DirectFB-1.6.1.orig/lib/direct/debug.c 2012-06-29 19:01:11.000000000 +0300
++++ DirectFB-1.6.1/lib/direct/debug.c 2013-01-05 18:03:49.000000000 +0200
+@@ -48,7 +48,7 @@
+
+ #if DIRECT_BUILD_DEBUGS /* Build with debug support? */
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_debug_log( DirectLogDomain *domain,
+ unsigned int debug_level, /* 1-9, 0 = info */
+@@ -63,7 +63,7 @@
+ va_end( ap );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_debug_at( DirectLogDomain *domain,
+ const char *format, ... )
+@@ -77,7 +77,7 @@
+
+ #endif /* DIRECT_BUILD_DEBUGS */
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_debug_at_always( DirectLogDomain *domain,
+ const char *format, ... )
+@@ -93,7 +93,7 @@
+
+ #if DIRECT_BUILD_DEBUGS /* Build with debug support? */
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_break( const char *func,
+ const char *file,
+@@ -123,7 +123,7 @@
+ direct_trap( "Break", SIGABRT );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_assertion( const char *exp,
+ const char *func,
+@@ -144,7 +144,7 @@
+ direct_trap( "Assertion", SIGTRAP );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_assumption( const char *exp,
+ const char *func,
+Index: DirectFB-1.6.1/lib/direct/interface.c
+===================================================================
+--- DirectFB-1.6.1.orig/lib/direct/interface.c 2012-06-29 19:01:11.000000000 +0300
++++ DirectFB-1.6.1/lib/direct/interface.c 2013-01-05 18:04:56.000000000 +0200
+@@ -522,7 +522,7 @@
+
+ /**************************************************************************************************/
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ static InterfaceDesc *
+ allocate_interface_desc( void )
+ {
+@@ -543,7 +543,7 @@
+ return &alloc_list[alloc_count++];
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ static __inline__ void
+ fill_interface_desc( InterfaceDesc *desc,
+ const void *interface_ptr,
+@@ -565,7 +565,7 @@
+
+ /**************************************************************************************************/
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_dbg_interface_add( const char *func,
+ const char *file,
+@@ -586,7 +586,7 @@
+ direct_mutex_unlock( &alloc_lock );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_dbg_interface_remove( const char *func,
+ const char *file,
+Index: DirectFB-1.6.1/lib/direct/log.c
+===================================================================
+--- DirectFB-1.6.1.orig/lib/direct/log.c 2012-06-29 19:01:11.000000000 +0300
++++ DirectFB-1.6.1/lib/direct/log.c 2013-01-05 18:04:18.000000000 +0200
+@@ -128,7 +128,7 @@
+ return DR_OK;
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ DirectResult
+ direct_log_printf( DirectLog *log,
+ const char *format, ... )
+@@ -197,7 +197,7 @@
+ return DR_OK;
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_log_lock( DirectLog *log )
+ {
+@@ -211,7 +211,7 @@
+ direct_mutex_lock( &log->lock );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_log_unlock( DirectLog *log )
+ {
+@@ -262,7 +262,7 @@
+
+ /**********************************************************************************************************************/
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ DirectLog *
+ direct_log_default( void )
+ {
+Index: DirectFB-1.6.1/lib/direct/log_domain.c
+===================================================================
+--- DirectFB-1.6.1.orig/lib/direct/log_domain.c 2012-06-29 19:01:11.000000000 +0300
++++ DirectFB-1.6.1/lib/direct/log_domain.c 2013-01-05 18:04:38.000000000 +0200
+@@ -69,7 +69,7 @@
+
+ /**********************************************************************************************************************/
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ static __inline__ LogDomainEntry *
+ lookup_domain( const char *name, bool sub );
+
+@@ -104,7 +104,7 @@
+ return NULL;
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ static DirectLogLevel
+ check_domain( DirectLogDomain *domain );
+
+@@ -207,7 +207,7 @@
+ /* FIXME: merge following */
+
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ DirectResult
+ direct_log_domain_vprintf( DirectLogDomain *domain,
+ DirectLogLevel level,
+@@ -268,7 +268,7 @@
+ return DR_OK;
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ DirectResult
+ direct_log_domain_log( DirectLogDomain *domain,
+ DirectLogLevel level,
+Index: DirectFB-1.6.1/lib/direct/mem.c
+===================================================================
+--- DirectFB-1.6.1.orig/lib/direct/mem.c 2012-06-29 19:01:11.000000000 +0300
++++ DirectFB-1.6.1/lib/direct/mem.c 2013-01-05 18:03:08.000000000 +0200
+@@ -121,7 +121,7 @@
+
+ /**********************************************************************************************************************/
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ static __inline__ MemDesc *
+ fill_mem_desc( MemDesc *desc, int bytes, const char *func, const char *file, int line, DirectTraceBuffer *trace )
+ {
+Index: DirectFB-1.6.1/lib/direct/messages.c
+===================================================================
+--- DirectFB-1.6.1.orig/lib/direct/messages.c 2012-06-29 19:01:11.000000000 +0300
++++ DirectFB-1.6.1/lib/direct/messages.c 2013-01-05 18:02:57.000000000 +0200
+@@ -40,7 +40,7 @@
+
+ #if DIRECT_BUILD_TEXT
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_messages_info( const char *format, ... )
+ {
+@@ -57,7 +57,7 @@
+ direct_log_printf( NULL, "(*) %s", buf );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_messages_error( const char *format, ... )
+ {
+@@ -76,7 +76,7 @@
+ direct_trace_print_stack( NULL );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_messages_derror( DirectResult result, const char *format, ... )
+ {
+@@ -95,7 +95,7 @@
+ direct_trace_print_stack( NULL );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_messages_perror( int erno, const char *format, ... )
+ {
+@@ -114,7 +114,7 @@
+ direct_trace_print_stack( NULL );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_messages_dlerror( const char *dlerr, const char *format, ... )
+ {
+@@ -133,7 +133,7 @@
+ direct_trace_print_stack( NULL );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_messages_once( const char *func,
+ const char *file,
+@@ -155,7 +155,7 @@
+ direct_trace_print_stack( NULL );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_messages_unimplemented( const char *func,
+ const char *file,
+@@ -166,7 +166,7 @@
+ direct_trace_print_stack( NULL );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_messages_bug( const char *func,
+ const char *file,
+@@ -188,7 +188,7 @@
+ direct_trace_print_stack( NULL );
+ }
+
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ void
+ direct_messages_warn( const char *func,
+ const char *file,
+Index: DirectFB-1.6.1/lib/direct/os/linux/glibc/types.h
+===================================================================
+--- DirectFB-1.6.1.orig/lib/direct/os/linux/glibc/types.h 2012-06-29 19:01:11.000000000 +0300
++++ DirectFB-1.6.1/lib/direct/os/linux/glibc/types.h 2013-01-05 18:06:04.000000000 +0200
+@@ -74,7 +74,7 @@
+
+ #define __inline__ inline
+ #define D_UNUSED __attribute__((unused))
+-#define __no_instrument_function__ __attribute__((no_instrument_function))
++#define __dfb_no_instrument_function__ __attribute__((no_instrument_function))
+ #define __constructor__ __attribute__((constructor))
+ #define __destructor__ __attribute__((destructor))
+ #define __typeof__(x) typeof(x)
+Index: DirectFB-1.6.1/lib/direct/util.c
+===================================================================
+--- DirectFB-1.6.1.orig/lib/direct/util.c 2012-06-29 19:01:11.000000000 +0300
++++ DirectFB-1.6.1/lib/direct/util.c 2013-01-05 18:03:59.000000000 +0200
+@@ -110,7 +110,7 @@
+ /*
+ * translates errno to DirectResult
+ */
+-__no_instrument_function__
++__dfb_no_instrument_function__
+ DirectResult
+ errno2result( int erno )
+ {
diff --git a/common/recipes-graphics/directfb/directfb_1.6.3.bb b/common/recipes-graphics/directfb/directfb_1.6.3.bb
new file mode 100644
index 0000000..7e0a6e6
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb_1.6.3.bb
@@ -0,0 +1,28 @@
+require directfb.inc
+
+RV = "1.6-0"
+PR = "${INC_PR}.2"
+
+DEPENDS += "sysfsutils"
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://fix-compilation-with-zlib.patch \
+ file://rename-no-instrument-function-macro.patch \
+ file://fixsepbuild.patch \
+"
+
+EXTRA_OECONF = "\
+ --enable-freetype=yes \
+ --enable-zlib \
+ --with-gfxdrivers=none \
+ --disable-sdl \
+ --disable-vnc \
+ --disable-x11 \
+ --disable-imlib2 \
+ --disable-mesa \
+"
+
+LEAD_SONAME = "libdirectfb-1.6.so.0"
+
+SRC_URI[md5sum] = "641e8e999c017770da647f9b5b890906"
+SRC_URI[sha256sum] = "7a96aced0f69b2ec0810e9923068e61c21e6b19dd593e09394c872414df75e70"
diff --git a/common/recipes-graphics/directfb/directfb_1.6.3.bbappend b/common/recipes-graphics/directfb/directfb_1.6.3.bbappend
new file mode 100644
index 0000000..4d839a4
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb_1.6.3.bbappend
@@ -0,0 +1,6 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+SRC_URI_append_armadillo800eva = " file://fbdev-uiomux-register.patch"
+
+EXTRA_OECONF += "\
+ --with-inputdrivers=linuxinput \
+"
diff --git a/common/recipes-graphics/directfb/directfb_git.bb b/common/recipes-graphics/directfb/directfb_git.bb
new file mode 100644
index 0000000..87da7c8
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb_git.bb
@@ -0,0 +1,68 @@
+DEFAULT_PREFERENCE = "-1"
+
+require directfb_git.inc
+
+RV = "1.8-0"
+PR = "r6"
+S = "${WORKDIR}/git"
+
+DEPENDS += "flux-native sysfsutils libuiomux libdrm linux-fusion khronos-headers"
+
+SRC_URI += "file://fix-compilation-with-zlib.patch \
+ file://directfbrc \
+ file://0001-drmkms-fix-property-to-check-when-setting-source-col.patch \
+ file://0002-drmkms-mute-plane-when-opacity-is-set-to-zero.patch \
+ "
+
+SRCREV = "b5301bba8c0878d86cb5a1901ccc587ecea20673"
+
+EXTRA_OECONF = "\
+ --enable-freetype \
+ --enable-zlib \
+ --disable-sdl \
+ --disable-vnc \
+ --disable-x11 \
+ --disable-imlib2 \
+ --disable-mesa \
+ --enable-trace \
+ --enable-debug \
+ --enable-debug-support \
+ --disable-one \
+ --enable-multi \
+ --enable-multicore \
+ --enable-network \
+ --enable-voodoo \
+ --enable-sawman \
+ --enable-fusiondale \
+ --enable-fusionsound \
+ --disable-unique \
+ --with-tests \
+ --with-fs-drivers=dummy \
+ --with-inputdrivers=linuxinput \
+ --without-smooth-scaling \
+ --without-vorbis \
+ --enable-fbdev \
+ --enable-png \
+ --disable-x11vdpau \
+ --disable-devmem \
+ --disable-linotype \
+ --enable-drmkms \
+ --enable-idirectfbgl-egl \
+ --with-gfxdrivers=gp2d \
+"
+
+TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
+
+do_configure_prepend() {
+ export GP2D_LIBS="-ldrm"
+ export DRMKMS_LIBS="-ldrm -lkms"
+}
+
+do_install_append () {
+ install -d ${D}/etc
+ install -m 0644 ${WORKDIR}/directfbrc ${D}/etc/
+ rm -rf ${D}/usr/lib/nm-n.*
+}
+
+LEAD_SONAME = "libdirectfb-1.8.so.0"
+
diff --git a/common/recipes-graphics/directfb/directfb_git.inc b/common/recipes-graphics/directfb/directfb_git.inc
new file mode 100644
index 0000000..eaa4269
--- /dev/null
+++ b/common/recipes-graphics/directfb/directfb_git.inc
@@ -0,0 +1,71 @@
+SUMMARY = "Graphics abstraction library for the Linux Framebuffer Device"
+DESCRIPTION = "DirectFB is a thin library that provides developers \
+with hardware graphics acceleration, input device handling and \
+abstraction, an integrated windowing system with support for \
+translucent windows and multiple display layers on top of the \
+Linux framebuffer device."
+SECTION = "libs"
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=dcf3c825659e82539645da41a7908589"
+
+HOMEPAGE = "http://directfb.org"
+DEPENDS = "jpeg libpng freetype zlib tslib"
+
+INC_PR = "r0"
+
+SRC_URI = "git://git.directfb.org/git/directfb/core/DirectFB.git;protocol=git \
+ file://directfb-1.2.x-fix-pkgconfig-cflags.patch \
+ file://configurefix.patch"
+
+S = "${WORKDIR}/git"
+
+LDFLAGS_append =" -lts -lm"
+
+inherit autotools binconfig pkgconfig
+
+EXTRA_OECONF = "\
+ --with-gfxdrivers=none \
+ --enable-libmpeg3=no \
+ --enable-freetype=yes \
+ --enable-sdl=no \
+ --enable-vnc=no \
+ --disable-x11 \
+ --disable-mesa \
+"
+
+#PACKAGES_DYNAMIC += "^directfb-inputdrivers-.*"
+#
+#python populate_packages_prepend () {
+# inputdrivers_libdir = d.expand('${libdir}/directfb-${RV}/inputdrivers')
+# do_split_packages(d, inputdrivers_libdir, '*.so$', 'directfb-inputdrivers-%s', 'Directfb plugin for %s')
+#}
+
+# NOTE: monolithic packaging for now, should improve that eventually
+
+
+
+FILES_${PN}-dbg += "\
+ ${libdir}/directfb-${RV}/*/*/.debug/*.so \
+ ${libdir}/directfb-${RV}/*/.debug/*.so \
+"
+
+FILES_${PN}-dev += "\
+ ${bindir}/directfb-config \
+ ${libdir}/directfb-${RV}/systems/*.la \
+ ${libdir}/directfb-${RV}/inputdrivers/*.la \
+ ${libdir}/directfb-${RV}/interfaces/*/*.la \
+ ${libdir}/directfb-${RV}/wm/*.la \
+ ${libdir}/directfb-${RV}/gfxdrivers/*.la \
+ ${libdir}/directfb-${RV}/snddrivers/*.la \
+"
+
+FILES_${PN} += "\
+ ${libdir}/directfb-${RV}/systems/*.so \
+ ${libdir}/directfb-${RV}/inputdrivers/*.so \
+ ${libdir}/directfb-${RV}/interfaces/*/*.so \
+ ${libdir}/directfb-${RV}/wm/*.so \
+ ${libdir}/directfb-${RV}/gfxdrivers/*.so \
+ ${libdir}/directfb-${RV}/snddrivers/*.so \
+ ${datadir}/directfb-${PV} \
+ /usr/share \
+"
diff --git a/common/recipes-graphics/drm/libdrm/0001-modetest-add-the-possibility-to-select-the-refresh-f.patch b/common/recipes-graphics/drm/libdrm/0001-modetest-add-the-possibility-to-select-the-refresh-f.patch
new file mode 100644
index 0000000..090cc00
--- /dev/null
+++ b/common/recipes-graphics/drm/libdrm/0001-modetest-add-the-possibility-to-select-the-refresh-f.patch
@@ -0,0 +1,118 @@
+From de0970203091618834e4753c14d5169770797800 Mon Sep 17 00:00:00 2001
+From: Vincent ABRIOU <vincent.abriou@st.com>
+Date: Fri, 10 Jan 2014 11:02:33 +0100
+Subject: [PATCH] modetest: add the possibility to select the refresh
+ frequency for a mode
+
+When mode is selected we only give the name of the mode as parameter.
+But sometime, two different modes have the same name but not
+the same vrefresh frequency.
+This patch give the possibility to select a mode by its name
+and optionally by its refresh frequency.
+
+Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Rob Clark <robclark@freedesktop.org>
+---
+ tests/modetest/modetest.c | 35 +++++++++++++++++++++++++++--------
+ 1 file changed, 27 insertions(+), 8 deletions(-)
+
+diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
+index 0afd1c8..12365d4 100644
+--- a/tests/modetest/modetest.c
++++ b/tests/modetest/modetest.c
+@@ -753,6 +753,7 @@ struct pipe_arg {
+ uint32_t crtc_id;
+ char mode_str[64];
+ char format_str[5];
++ unsigned int vrefresh;
+ unsigned int fourcc;
+ drmModeModeInfo *mode;
+ struct crtc *crtc;
+@@ -774,7 +775,8 @@ struct plane_arg {
+ };
+
+ static drmModeModeInfo *
+-connector_find_mode(struct device *dev, uint32_t con_id, const char *mode_str)
++connector_find_mode(struct device *dev, uint32_t con_id, const char *mode_str,
++ const unsigned int vrefresh)
+ {
+ drmModeConnector *connector;
+ drmModeModeInfo *mode;
+@@ -786,8 +788,16 @@ connector_find_mode(struct device *dev, uint32_t con_id, const char *mode_str)
+
+ for (i = 0; i < connector->count_modes; i++) {
+ mode = &connector->modes[i];
+- if (!strcmp(mode->name, mode_str))
+- return mode;
++ if (!strcmp(mode->name, mode_str)) {
++ /* If the vertical refresh frequency is not specified then return the
++ * first mode that match with the name. Else, return the mode that match
++ * the name and the specified vertical refresh frequency.
++ */
++ if (vrefresh == 0)
++ return mode;
++ else if (mode->vrefresh == vrefresh)
++ return mode;
++ }
+ }
+
+ return NULL;
+@@ -849,7 +859,7 @@ static int pipe_find_crtc_and_mode(struct device *dev, struct pipe_arg *pipe)
+
+ for (i = 0; i < (int)pipe->num_cons; i++) {
+ mode = connector_find_mode(dev, pipe->con_ids[i],
+- pipe->mode_str);
++ pipe->mode_str, pipe->vrefresh);
+ if (mode == NULL) {
+ fprintf(stderr,
+ "failed to find mode \"%s\" for connector %u\n",
+@@ -1175,8 +1185,8 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
+ if (pipe->mode == NULL)
+ continue;
+
+- printf("setting mode %s@%s on connectors ",
+- pipe->mode_str, pipe->format_str);
++ printf("setting mode %s-%dHz@%s on connectors ",
++ pipe->mode_str, pipe->mode->vrefresh, pipe->format_str);
+ for (j = 0; j < pipe->num_cons; ++j)
+ printf("%u, ", pipe->con_ids[j]);
+ printf("crtc %d\n", pipe->crtc->crtc->crtc_id);
+@@ -1308,6 +1318,7 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
+ const char *p;
+ char *endp;
+
++ pipe->vrefresh = 0;
+ pipe->crtc_id = (uint32_t)-1;
+ strcpy(pipe->format_str, "XR24");
+
+@@ -1342,11 +1353,19 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
+
+ arg = endp + 1;
+
+- p = strchrnul(arg, '@');
++ /* Search for the vertical refresh or the format. */
++ p = strpbrk(arg, "-@");
++ if (p == NULL)
++ p = arg + strlen(arg);
+ len = min(sizeof pipe->mode_str - 1, (unsigned int)(p - arg));
+ strncpy(pipe->mode_str, arg, len);
+ pipe->mode_str[len] = '\0';
+
++ if (*p == '-') {
++ pipe->vrefresh = strtoul(p + 1, &endp, 10);
++ p = endp;
++ }
++
+ if (*p == '@') {
+ strncpy(pipe->format_str, p + 1, 4);
+ pipe->format_str[4] = '\0';
+@@ -1434,7 +1453,7 @@ static void usage(char *name)
+
+ fprintf(stderr, "\n Test options:\n\n");
+ fprintf(stderr, "\t-P <crtc_id>[@<source_id>]:<w>x<h>[+<x>+<y>][@<format>]\tset a plane\n");
+- fprintf(stderr, "\t-s <connector_id>[,<connector_id>][@<crtc_id>]:<mode>[@<format>]\tset a mode\n");
++ fprintf(stderr, "\t-s <connector_id>[,<connector_id>][@<crtc_id>]:<mode>[-<vrefresh>][@<format>]\tset a mode\n");
+ fprintf(stderr, "\t-v\ttest vsynced page flipping\n");
+ fprintf(stderr, "\t-w <obj_id>:<prop_name>:<value>\tset property\n");
+
diff --git a/common/recipes-graphics/drm/libdrm/GNU_SOURCE_definition.patch b/common/recipes-graphics/drm/libdrm/GNU_SOURCE_definition.patch
new file mode 100644
index 0000000..8eb1d5e
--- /dev/null
+++ b/common/recipes-graphics/drm/libdrm/GNU_SOURCE_definition.patch
@@ -0,0 +1,30 @@
+uclibc headers need to know if _GNU_SOURCE is defined or not and its defined
+in config.h so include it first to get the definition if its there fixed build
+problems on uclibc
+
+test_decode.c:107:2: error: implicit declaration of function 'open_memstream' [-Werror=implicit-function-declaration]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: libdrm-2.4.30/intel/test_decode.c
+===================================================================
+--- libdrm-2.4.30.orig/intel/test_decode.c 2012-02-03 14:28:46.409355918 -0800
++++ libdrm-2.4.30/intel/test_decode.c 2012-02-03 14:29:02.357356689 -0800
+@@ -21,6 +21,8 @@
+ * IN THE SOFTWARE.
+ */
+
++#include "config.h"
++
+ #include <string.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+@@ -31,7 +33,6 @@
+ #include <sys/mman.h>
+ #include <err.h>
+
+-#include "config.h"
+ #include "intel_bufmgr.h"
+ #include "intel_chipset.h"
+
diff --git a/common/recipes-graphics/drm/libdrm/installtests.patch b/common/recipes-graphics/drm/libdrm/installtests.patch
new file mode 100644
index 0000000..7d443af
--- /dev/null
+++ b/common/recipes-graphics/drm/libdrm/installtests.patch
@@ -0,0 +1,23 @@
+tests: also install tests app
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Yu Ke <ke.yu@intel.com>
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index bf1987f..d909e19 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -6,10 +6,11 @@ AM_CPPFLAGS = \
+
+ LDADD = $(top_builddir)/libdrm.la
+
+-check_PROGRAMS = \
++bin_PROGRAMS = \
+ dristat \
+ drmstat
+
++check_PROGRAMS =
+ SUBDIRS = modeprint
+
+ if HAVE_LIBKMS
diff --git a/common/recipes-graphics/drm/libdrm_2.4.45.bb b/common/recipes-graphics/drm/libdrm_2.4.45.bb
new file mode 100644
index 0000000..c76af78
--- /dev/null
+++ b/common/recipes-graphics/drm/libdrm_2.4.45.bb
@@ -0,0 +1,14 @@
+require recipes-graphics/drm/libdrm.inc
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRCREV = "4d8674077c006f68ec4771530891df8231da839d"
+SRC_URI = "git://git.ideasonboard.com/renesas/drm.git;protocol=git;branch=live \
+ file://installtests.patch \
+ file://GNU_SOURCE_definition.patch \
+ file://0001-modetest-add-the-possibility-to-select-the-refresh-f.patch \
+ "
+
+PV_append = "+git${SRCREV}"
+S = "${WORKDIR}/git"
+EXTRA_OECONF += "--enable-install-test-programs"
diff --git a/common/recipes-graphics/flux/flux_1.4.4.bb b/common/recipes-graphics/flux/flux_1.4.4.bb
new file mode 100644
index 0000000..9a5870a
--- /dev/null
+++ b/common/recipes-graphics/flux/flux_1.4.4.bb
@@ -0,0 +1,18 @@
+SUMMARY = "flux is an interface description language used by DirectFB"
+HOMEPAGE = "http://directfb.org"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://src/fluxcomp.cpp;beginline=13;endline=32;md5=eb9874d4eb31887b9bc6b14fefff731c"
+
+PR = "r0"
+
+SRCREV = "d3086b8e39aaddd5302de6ce16cdc300ffd3ac75"
+SRC_URI = "git://git.directfb.org/git/directfb/core/flux.git;protocol=git"
+
+PR = "r0"
+PV = "1.4.4+git${SRCPV}"
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
+
+BBCLASSEXTEND = "native"
diff --git a/common/recipes-graphics/khronos-headers/khronos-headers/support_arm.patch b/common/recipes-graphics/khronos-headers/khronos-headers/support_arm.patch
new file mode 100644
index 0000000..13c8f40
--- /dev/null
+++ b/common/recipes-graphics/khronos-headers/khronos-headers/support_arm.patch
@@ -0,0 +1,12 @@
+diff -urN a/EGL/eglplatform.h b/EGL/eglplatform.h
+--- b/EGL/eglplatform.h 2010-08-19 15:46:25.000000000 +0900
++++ a/EGL/eglplatform.h 2010-11-02 19:40:45.000000000 +0900
+@@ -72,7 +72,7 @@
+ typedef HBITMAP EGLNativePixmapType;
+ typedef HWND EGLNativeWindowType;
+
+-#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
++#elif defined(__WINSCW__) || defined(__SYMBIAN32__) || defined(__arm__) /* Symbian */
+
+ typedef int EGLNativeDisplayType;
+ typedef void *EGLNativeWindowType;
diff --git a/common/recipes-graphics/khronos-headers/khronos-headers_20131030.bb b/common/recipes-graphics/khronos-headers/khronos-headers_20131030.bb
new file mode 100644
index 0000000..73dcd62
--- /dev/null
+++ b/common/recipes-graphics/khronos-headers/khronos-headers_20131030.bb
@@ -0,0 +1,24 @@
+DESCRIPTION = "khronos header files (http://www.khronos.org/registry/)"
+LICENSE = "MIT"
+
+LIC_FILES_CHKSUM = "file://CL/cl.h;beginline=1;endline=22;md5=688fcb59ec225081cedfaef77315908f"
+
+PV = "20130424"
+PR = "r0"
+
+SRC_URI = " \
+ http://www.khronos.org/registry/khronos_headers.tgz \
+ file://support_arm.patch \
+"
+
+SRC_URI[md5sum] = "56ad0e432eb56ba3ff058595eda7fa52"
+SRC_URI[sha256sum] = "0e5a8df9fc34cfe88a76d1796e3b5f7384139448a07f2f8819f3f2ebbcdb223e"
+
+S = "${WORKDIR}/khronos_headers"
+
+do_install () {
+ install -d ${D}/usr/include
+ cp -rf * ${D}/usr/include/.
+}
+
+FILES_${PN} += "usr/include/*"
diff --git a/common/recipes-kernel/linux-fusion/linux-fusion/linux-fusion-modules-replace-KERNELDIR-with-KERNEL_SRC.patch b/common/recipes-kernel/linux-fusion/linux-fusion/linux-fusion-modules-replace-KERNELDIR-with-KERNEL_SRC.patch
new file mode 100644
index 0000000..22f8e25
--- /dev/null
+++ b/common/recipes-kernel/linux-fusion/linux-fusion/linux-fusion-modules-replace-KERNELDIR-with-KERNEL_SRC.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index 0115a44..cb2856b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -25,7 +25,7 @@ ONE_CPPFLAGS += \
+ -I`pwd`/one/$(ONECORE) \
+ -I`pwd`/include \
+
+-KERNEL_BUILD = $(KERNELDIR)
++KERNEL_BUILD = $(KERNEL_SRC)
+ # works for 2.6.23
+ KERNEL_SOURCE = $(shell grep ^KERNELSRC $(KERNEL_BUILD)/Makefile | cut -d ' ' -f 6)
+ ifeq ($(KERNEL_SOURCE), )
diff --git a/common/recipes-kernel/linux-fusion/linux-fusion_9.0.2.bb b/common/recipes-kernel/linux-fusion/linux-fusion_9.0.2.bb
new file mode 100644
index 0000000..4a65c67
--- /dev/null
+++ b/common/recipes-kernel/linux-fusion/linux-fusion_9.0.2.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "The linux-fusion modules"
+LICENSE = "GPLv2"
+# dummy
+LIC_FILES_CHKSUM = "file://README;md5=54be18c46d265cc8ea0aafee3034a26d"
+
+DEPENDS = "virtual/kernel"
+
+inherit module
+
+PV = "9.0.2"
+PR = "r0"
+
+S = "${WORKDIR}/git"
+SRCREV = "52f7ad63b4f98929fb15c2b73b9d40d39089f83e"
+SRC_URI = "git://git.directfb.org/git/directfb/core/linux-fusion.git;protocol=git \
+ file://linux-fusion-modules-replace-KERNELDIR-with-KERNEL_SRC.patch"
+
+
+# inherit autotools pkgconfig
+
+export INSTALL_MOD_DIR="kernel/linux-fusion-modules"
+export KERNEL_SRC="${STAGING_KERNEL_DIR}"
+
+do_install_append() {
+ install -d ${D}/usr/include/linux
+ install -m 0644 ${S}/linux/include/linux/fusion.h ${D}/usr/include/linux
+}
+
+FILES_${PN}-headers = "/usr/include/linux"
diff --git a/common/recipes-multimedia/gstreamer/gst-openmax/0001-Stop-using-deprecated-GLib-thread-API.patch b/common/recipes-multimedia/gstreamer/gst-openmax/0001-Stop-using-deprecated-GLib-thread-API.patch
new file mode 100644
index 0000000..34b51fa
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-openmax/0001-Stop-using-deprecated-GLib-thread-API.patch
@@ -0,0 +1,335 @@
+From 4244ae9ac47f9a72f10797dcf71ca4427393528d Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Mon, 22 Apr 2013 15:06:19 +0900
+Subject: [PATCH] Stop using deprecated GLib thread API
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+---
+ omx/gstomx_base_filter.c | 12 ++++-----
+ omx/gstomx_base_filter.h | 2 +-
+ omx/gstomx_util.c | 62 ++++++++++++++++++++++++----------------------
+ omx/gstomx_util.h | 8 +++---
+ 4 files changed, 44 insertions(+), 40 deletions(-)
+
+diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
+index 674dcaa..46120b7 100644
+--- a/omx/gstomx_base_filter.c
++++ b/omx/gstomx_base_filter.c
+@@ -121,7 +121,7 @@ change_state (GstElement * element, GstStateChange transition)
+
+ switch (transition) {
+ case GST_STATE_CHANGE_PAUSED_TO_READY:
+- g_mutex_lock (self->ready_lock);
++ g_mutex_lock (&self->ready_lock);
+ if (self->ready) {
+ /* unlock */
+ g_omx_port_finish (self->in_port);
+@@ -131,7 +131,7 @@ change_state (GstElement * element, GstStateChange transition)
+ g_omx_core_unload (core);
+ self->ready = FALSE;
+ }
+- g_mutex_unlock (self->ready_lock);
++ g_mutex_unlock (&self->ready_lock);
+ if (core->omx_state != OMX_StateLoaded &&
+ core->omx_state != OMX_StateInvalid) {
+ ret = GST_STATE_CHANGE_FAILURE;
+@@ -163,7 +163,7 @@ finalize (GObject * obj)
+
+ g_omx_core_free (self->gomx);
+
+- g_mutex_free (self->ready_lock);
++ g_mutex_clear (&self->ready_lock);
+
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
+ }
+@@ -576,7 +576,7 @@ pad_chain (GstPad * pad, GstBuffer * buf)
+ GST_LOG_OBJECT (self, "state: %d", gomx->omx_state);
+
+ if (G_UNLIKELY (gomx->omx_state == OMX_StateLoaded)) {
+- g_mutex_lock (self->ready_lock);
++ g_mutex_lock (&self->ready_lock);
+
+ GST_INFO_OBJECT (self, "omx: prepare");
+
+@@ -594,7 +594,7 @@ pad_chain (GstPad * pad, GstBuffer * buf)
+ gst_pad_start_task (self->srcpad, output_loop, self->srcpad);
+ }
+
+- g_mutex_unlock (self->ready_lock);
++ g_mutex_unlock (&self->ready_lock);
+
+ if (gomx->omx_state != OMX_StateIdle)
+ goto out_flushing;
+@@ -890,7 +890,7 @@ type_instance_init (GTypeInstance * instance, gpointer g_class)
+ self->in_port = g_omx_core_new_port (self->gomx, 0);
+ self->out_port = g_omx_core_new_port (self->gomx, 1);
+
+- self->ready_lock = g_mutex_new ();
++ g_mutex_init (&self->ready_lock);
+
+ self->sinkpad =
+ gst_pad_new_from_template (gst_element_class_get_pad_template
+diff --git a/omx/gstomx_base_filter.h b/omx/gstomx_base_filter.h
+index 3175b8a..632344c 100644
+--- a/omx/gstomx_base_filter.h
++++ b/omx/gstomx_base_filter.h
+@@ -49,7 +49,7 @@ struct GstOmxBaseFilter
+
+ gboolean use_timestamps; /** @todo remove; timestamps should always be used */
+ gboolean ready;
+- GMutex *ready_lock;
++ GMutex ready_lock;
+
+ GstOmxBaseFilterCb omx_setup;
+ GstFlowReturn last_pad_push_return;
+diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
+index aed5d4f..2c9d430 100644
+--- a/omx/gstomx_util.c
++++ b/omx/gstomx_util.c
+@@ -78,7 +78,7 @@ static OMX_CALLBACKTYPE callbacks =
+ { EventHandler, EmptyBufferDone, FillBufferDone };
+
+ /* protect implementations hash_table */
+-static GMutex *imp_mutex;
++static GMutex imp_mutex;
+ static GHashTable *implementations;
+ static gboolean initialized;
+
+@@ -151,7 +151,7 @@ imp_new (const gchar * name)
+ return NULL;
+ }
+
+- imp->mutex = g_mutex_new ();
++ g_mutex_init(&imp->mutex);
+ imp->sym_table.init = dlsym (handle, "OMX_Init");
+ imp->sym_table.deinit = dlsym (handle, "OMX_Deinit");
+ imp->sym_table.get_handle = dlsym (handle, "OMX_GetHandle");
+@@ -167,7 +167,7 @@ imp_free (GOmxImp * imp)
+ if (imp->dl_handle) {
+ dlclose (imp->dl_handle);
+ }
+- g_mutex_free (imp->mutex);
++ g_mutex_clear(&imp->mutex);
+ g_free (imp);
+ }
+
+@@ -177,19 +177,19 @@ request_imp (const gchar * name, gboolean disable_postproc)
+ GOmxImp *imp = NULL;
+ int retry = 1;
+
+- g_mutex_lock (imp_mutex);
++ g_mutex_lock (&imp_mutex);
+ imp = g_hash_table_lookup (implementations, name);
+ if (!imp) {
+ imp = imp_new (name);
+ if (imp)
+ g_hash_table_insert (implementations, g_strdup (name), imp);
+ }
+- g_mutex_unlock (imp_mutex);
++ g_mutex_unlock (&imp_mutex);
+
+ if (!imp)
+ return NULL;
+
+- g_mutex_lock (imp->mutex);
++ g_mutex_lock (&imp->mutex);
+ reinit:
+ if (imp->client_count == 0) {
+ OMX_ERRORTYPE (*r_config) (OMX_STRING path);
+@@ -200,7 +200,7 @@ reinit:
+ if (r_config)
+ omx_error = r_config (FILE_OMXR_CFG_NO_IPC);
+ if ((r_config == NULL) || (omx_error != OMX_ErrorNone)) {
+- g_mutex_unlock (imp->mutex);
++ g_mutex_unlock (&imp->mutex);
+ return NULL;
+ }
+ }
+@@ -211,12 +211,12 @@ reinit:
+ imp->sym_table.deinit ();
+ goto reinit;
+ }
+- g_mutex_unlock (imp->mutex);
++ g_mutex_unlock (&imp->mutex);
+ return NULL;
+ }
+ }
+ imp->client_count++;
+- g_mutex_unlock (imp->mutex);
++ g_mutex_unlock (&imp->mutex);
+
+ return imp;
+ }
+@@ -224,12 +224,12 @@ reinit:
+ static inline void
+ release_imp (GOmxImp * imp)
+ {
+- g_mutex_lock (imp->mutex);
++ g_mutex_lock (&imp->mutex);
+ imp->client_count--;
+ if (imp->client_count == 0) {
+ imp->sym_table.deinit ();
+ }
+- g_mutex_unlock (imp->mutex);
++ g_mutex_unlock (&imp->mutex);
+ }
+
+ void
+@@ -237,7 +237,7 @@ g_omx_init (void)
+ {
+ if (!initialized) {
+ /* safe as plugin_init is safe */
+- imp_mutex = g_mutex_new ();
++ g_mutex_init(&imp_mutex);
+ implementations = g_hash_table_new_full (g_str_hash,
+ g_str_equal, g_free, (GDestroyNotify) imp_free);
+ initialized = TRUE;
+@@ -249,7 +249,7 @@ g_omx_deinit (void)
+ {
+ if (initialized) {
+ g_hash_table_destroy (implementations);
+- g_mutex_free (imp_mutex);
++ g_mutex_clear (&imp_mutex);
+ initialized = FALSE;
+ }
+ }
+@@ -268,8 +268,8 @@ g_omx_core_new (void *object)
+ core->object = object;
+ core->ports = g_ptr_array_new ();
+
+- core->omx_state_condition = g_cond_new ();
+- core->omx_state_mutex = g_mutex_new ();
++ g_cond_init(&core->omx_state_condition);
++ g_mutex_init(&core->omx_state_mutex);
+
+ core->done_sem = g_sem_new ();
+ core->flush_sem = g_sem_new ();
+@@ -289,8 +289,8 @@ g_omx_core_free (GOmxCore * core)
+ g_sem_free (core->flush_sem);
+ g_sem_free (core->done_sem);
+
+- g_mutex_free (core->omx_state_mutex);
+- g_cond_free (core->omx_state_condition);
++ g_mutex_clear (&core->omx_state_mutex);
++ g_cond_clear (&core->omx_state_condition);
+
+ g_ptr_array_free (core->ports, TRUE);
+
+@@ -501,7 +501,7 @@ g_omx_port_new (GOmxCore * core, guint index)
+
+ port->enabled = TRUE;
+ port->queue = async_queue_new ();
+- port->mutex = g_mutex_new ();
++ g_mutex_init (&port->mutex);
+
+ return port;
+ }
+@@ -509,7 +509,7 @@ g_omx_port_new (GOmxCore * core, guint index)
+ void
+ g_omx_port_free (GOmxPort * port)
+ {
+- g_mutex_free (port->mutex);
++ g_mutex_clear (&port->mutex);
+ async_queue_free (port->queue);
+
+ g_free (port->buffers);
+@@ -726,7 +726,7 @@ g_omx_port_finish (GOmxPort * port)
+ static inline void
+ change_state (GOmxCore * core, OMX_STATETYPE state)
+ {
+- g_mutex_lock (core->omx_state_mutex);
++ g_mutex_lock (&core->omx_state_mutex);
+
+ GST_DEBUG_OBJECT (core->object, "state=%d", state);
+ OMX_SendCommand (core->omx_handle, OMX_CommandStateSet, state, NULL);
+@@ -735,13 +735,13 @@ change_state (GOmxCore * core, OMX_STATETYPE state)
+ static inline void
+ complete_change_state (GOmxCore * core, OMX_STATETYPE state)
+ {
+- g_mutex_lock (core->omx_state_mutex);
++ g_mutex_lock (&core->omx_state_mutex);
+
+ core->omx_state = state;
+- g_cond_signal (core->omx_state_condition);
++ g_cond_signal (&core->omx_state_condition);
+ GST_DEBUG_OBJECT (core->object, "state=%d", state);
+
+- g_mutex_unlock (core->omx_state_mutex);
++ g_mutex_unlock (&core->omx_state_mutex);
+ }
+
+ static inline void
+@@ -755,9 +755,13 @@ wait_for_state (GOmxCore * core, OMX_STATETYPE state)
+
+ /* try once */
+ if (core->omx_state != state) {
++ gint64 t = g_get_monotonic_time () +
++ ((gint64)tv.tv_sec * G_USEC_PER_SEC + tv.tv_usec -
++ g_get_real_time ());
++
+ signaled =
+- g_cond_timed_wait (core->omx_state_condition, core->omx_state_mutex,
+- &tv);
++ g_cond_wait_until (&core->omx_state_condition, &core->omx_state_mutex,
++ t);
+
+ if (!signaled) {
+ GST_ERROR_OBJECT (core->object, "timed out switching from '%s' to '%s'",
+@@ -774,7 +778,7 @@ wait_for_state (GOmxCore * core, OMX_STATETYPE state)
+ }
+
+ leave:
+- g_mutex_unlock (core->omx_state_mutex);
++ g_mutex_unlock (&core->omx_state_mutex);
+ }
+
+ /*
+@@ -926,9 +930,9 @@ EventHandler (OMX_HANDLETYPE omx_handle,
+ */
+ if (is_err_type_state_change (core->omx_error)) {
+ /* unlock wait_for_state */
+- g_mutex_lock (core->omx_state_mutex);
+- g_cond_signal (core->omx_state_condition);
+- g_mutex_unlock (core->omx_state_mutex);
++ g_mutex_lock (&core->omx_state_mutex);
++ g_cond_signal (&core->omx_state_condition);
++ g_mutex_unlock (&core->omx_state_mutex);
+ }
+
+ GST_ELEMENT_ERROR (core->object, STREAM, FAILED, (NULL),
+diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
+index b2a0de5..9a0f062 100644
+--- a/omx/gstomx_util.h
++++ b/omx/gstomx_util.h
+@@ -65,7 +65,7 @@ struct GOmxImp
+ guint client_count;
+ void *dl_handle;
+ GOmxSymbolTable sym_table;
+- GMutex *mutex;
++ GMutex mutex;
+ };
+
+ struct GOmxCore
+@@ -76,8 +76,8 @@ struct GOmxCore
+ OMX_ERRORTYPE omx_error;
+
+ OMX_STATETYPE omx_state;
+- GCond *omx_state_condition;
+- GMutex *omx_state_mutex;
++ GCond omx_state_condition;
++ GMutex omx_state_mutex;
+
+ GPtrArray *ports;
+
+@@ -107,7 +107,7 @@ struct GOmxPort
+ guint port_index;
+ OMX_BUFFERHEADERTYPE **buffers;
+
+- GMutex *mutex;
++ GMutex mutex;
+ gboolean enabled;
+ gboolean omx_allocate; /**< Setup with OMX_AllocateBuffer rather than OMX_UseBuffer */
+ AsyncQueue *queue;
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-openmax/0001-base_videodec-change-the-tile-height-for-T-L-address.patch b/common/recipes-multimedia/gstreamer/gst-openmax/0001-base_videodec-change-the-tile-height-for-T-L-address.patch
new file mode 100644
index 0000000..9f2dca2
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-openmax/0001-base_videodec-change-the-tile-height-for-T-L-address.patch
@@ -0,0 +1,27 @@
+From 5ae3622b9711655479744ed8a95c20d095dcbf1e Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Wed, 10 Apr 2013 11:05:30 +0900
+Subject: [PATCH] base_videodec: change the tile height for T/L addressing
+
+This change is added to follow the change of the tile height to be
+tuned for the R-CarM1A in the REL OMX.
+---
+ omx/gstomx_base_videodec.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/omx/gstomx_base_videodec.c b/omx/gstomx_base_videodec.c
+index 247f596..da5585d 100644
+--- a/omx/gstomx_base_videodec.c
++++ b/omx/gstomx_base_videodec.c
+@@ -203,7 +203,7 @@ settings_changed_cb (GOmxCore * core)
+ ALIGN2UP (stride, stride);
+ chroma_byte_offset = stride * ALIGN32 (sliceheight);
+ #define OMXR_TILE_WIDTH 32
+-#define OMXR_TILE_HEIGHT 8
++#define OMXR_TILE_HEIGHT 16
+ gst_structure_set (struc, "tile-width", G_TYPE_INT, OMXR_TILE_WIDTH,
+ NULL);
+ gst_structure_set (struc, "tile-height", G_TYPE_INT, OMXR_TILE_HEIGHT,
+--
+1.7.5.4
+
diff --git a/common/recipes-multimedia/gstreamer/gst-openmax/disable_configure.patch b/common/recipes-multimedia/gstreamer/gst-openmax/disable_configure.patch
new file mode 100644
index 0000000..863a8b2
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-openmax/disable_configure.patch
@@ -0,0 +1,15 @@
+diff --git a/autogen.sh b/autogen.sh
+index e69af6d..081ac8c 100755
+--- a/autogen.sh
++++ b/autogen.sh
+@@ -112,10 +112,3 @@ test ! -z "$CONFIGURE_DEF_OPT" && echo " ./configure default flags: $CONFIGURE_
+ test ! -z "$CONFIGURE_EXT_OPT" && echo " ./configure external flags: $CONFIGURE_EXT_OPT"
+ test ! -z "$CONFIGURE_FILE_OPT" && echo " ./configure enable/disable flags: $CONFIGURE_FILE_OPT"
+ echo
+-
+-./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
+- echo " configure failed"
+- exit 1
+-}
+-
+-echo "Now type 'make' to compile $package."
diff --git a/common/recipes-multimedia/gstreamer/gst-openmax/gst-openmax.conf b/common/recipes-multimedia/gstreamer/gst-openmax/gst-openmax.conf
new file mode 100644
index 0000000..0e4e4a0
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-openmax/gst-openmax.conf
@@ -0,0 +1,7 @@
+omx_h264dec,
+ type=GstOmxH264Dec,
+ library-name=libomxshvpu5avc.so,
+ component-name=OMX.re.video_decoder.avc,
+ rank=256,
+ src=video/x-raw-yuv,
+ sink="video/x-h264, stream-format={avc,byte-stream}";
diff --git a/common/recipes-multimedia/gstreamer/gst-openmax_git.bb b/common/recipes-multimedia/gstreamer/gst-openmax_git.bb
new file mode 100644
index 0000000..3ae3788
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-openmax_git.bb
@@ -0,0 +1,53 @@
+DESCRIPTION = "GStreamer plug-in that allows communication with OpenMAX IL components"
+AUTHOR = "Katsuya Matsubara <matsu@igel.co.jp>"
+BUGTRACKER = ""
+
+DEFAULT_PREFERENCE = "-1"
+DEPENDS = "gstreamer"
+RDEPENDS_${PN} = "libomxil"
+LICENSE = "LGPLv2.1"
+LICENSE_FLAGS = "commercial"
+
+require gst-plugins.inc
+inherit gettext
+
+LIBV="0.10"
+PR = "r1"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24"
+EXTRA_OECONF += "--disable-valgrind"
+
+# for armadillo800eva
+SRCREV_armadillo800eva = "43e0be40d82f83308d0a17cd74060b280c30c2a8"
+SRC_URI_armadillo800eva = "git://github.com/matsu/gst-openmax.git \
+ file://gst-openmax.conf \
+"
+
+SRCREV = "3dad1ec6803bb2f2627188ce0e957dbeaa57b1be"
+SRC_URI = "git://github.com/renesas-devel/gst-openmax.git \
+ file://0001-base_videodec-change-the-tile-height-for-T-L-address.patch \
+ file://0001-Stop-using-deprecated-GLib-thread-API.patch \
+ file://disable_configure.patch \
+"
+
+S = "${WORKDIR}/git/"
+
+# for -Werror-deprecated-declarations
+CPPFLAGS += "-Wno-deprecated-declarations"
+EXTRA_OECONF := "${@'${EXTRA_OECONF}'.replace('--disable-experimental', '--enable-experimental')}"
+
+do_configure_prepend() {
+ (cd ${S}; sh autogen.sh --noconfigure)
+}
+
+do_install_append_armadillo800eva() {
+ install -d ${D}/home/root/.config/
+ install -m 644 ${WORKDIR}/gst-openmax.conf ${D}/home/root/.config/.
+}
+
+FILES_${PN} += "${libdir}/gstreamer-${LIBV}/libgstomx.so /home/root/.config"
+FILES_${PN}-dev += "${libdir}/gstreamer-0.10/libgstomx.la"
+FILES_${PN}-staticdev += "${libdir}/gstreamer-0.10/libgstomx.a"
+FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug/"
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-bad/0001-Setup-MERAM-for-A1.patch b/common/recipes-multimedia/gstreamer/gst-plugins-bad/0001-Setup-MERAM-for-A1.patch
new file mode 100644
index 0000000..802d159
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-bad/0001-Setup-MERAM-for-A1.patch
@@ -0,0 +1,78 @@
+From 0e02696530388011f573f0a5cc91af97ed84184d Mon Sep 17 00:00:00 2001
+From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+Date: Thu, 13 Sep 2012 13:14:13 +0900
+Subject: [PATCH] Setup MERAM for A1
+
+The A1 MERAM settings are different from E1 settings. Namely A1 has
+more MERAM memory available and so can use more caching.
+---
+ ext/directfb/dfbvideosink.c | 14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/ext/directfb/dfbvideosink.c b/ext/directfb/dfbvideosink.c
+index 39aa4cc..e680681 100644
+--- a/ext/directfb/dfbvideosink.c
++++ b/ext/directfb/dfbvideosink.c
+@@ -994,7 +994,7 @@ gst_dfbvideosink_setup (GstDfbVideoSink * dfbvideosink)
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icby[DST], MExxCTRL,
+ val | (7 << 4));
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icby[DST], MExxCTRL,
+- 0x90400702);
++ 0x90c00702);
+ /* NOTE: MExxSBSIZE is setting up afterward, that is in gst_dfbvideosink_setcaps(). */
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icby[DST], MExxSSARB,
+ 0);
+@@ -1665,7 +1665,7 @@ gst_dfbvideosink_setup_meram (GstDfbVideoSink * dfbvideosink, GstCaps * caps,
+ 0) ? dfbvideosink->chroma_byte_offset / stride : video_height;
+
+ /* set up a readahead icb for Y plane
+- 4 lines / block-line, 8 lines held, 16 lines allocated */
++ 32 lines / block-line, 32 lines held, 64 lines allocated */
+ if (dfbvideosink->icby[SRC]) {
+ addr =
+ meram_get_icb_address (dfbvideosink->meram, dfbvideosink->icby[SRC], 0);
+@@ -1680,13 +1680,13 @@ gst_dfbvideosink_setup_meram (GstDfbVideoSink * dfbvideosink, GstCaps * caps,
+ return;
+ }
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icby[SRC], MExxMCNF,
+- 0x010f0000);
++ 0x003f0000);
+ meram_read_icb (dfbvideosink->meram, dfbvideosink->icby[SRC], MExxCTRL, &val);
+ if (val & (7 << 4))
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icby[SRC], MExxCTRL,
+ val | 7 << 4);
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icby[SRC], MExxCTRL,
+- 0xa0000701);
++ 0xd0000701);
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icby[SRC], MExxSSARB, 0);
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icby[SRC], MExxBSIZE,
+ (((sliceheight + dfbvideosink->tile_boundary_y_offset -
+@@ -1717,7 +1717,7 @@ gst_dfbvideosink_setup_meram (GstDfbVideoSink * dfbvideosink, GstCaps * caps,
+ uiomux_register ((void *) addr, addr, 4096 * sliceheight);
+
+ /* set up a readahead icb for CbCr plane
+- 4 lines / block-line, 8 lines held, 16 lines allocated */
++ 16 lines / block-line, 16 lines held, 32 lines allocated */
+ if (dfbvideosink->icbc[SRC]) {
+ addr =
+ meram_get_icb_address (dfbvideosink->meram, dfbvideosink->icbc[SRC], 0);
+@@ -1733,14 +1733,14 @@ gst_dfbvideosink_setup_meram (GstDfbVideoSink * dfbvideosink, GstCaps * caps,
+ return;
+ }
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icbc[SRC], MExxMCNF,
+- 0x010f0000);
++ 0x001f0000);
+ meram_read_icb (dfbvideosink->meram, dfbvideosink->icbc[SRC], MExxCTRL,
+ &val);
+ if (val & (7 << 4))
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icbc[SRC], MExxCTRL,
+ val | 7 << 4);
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icbc[SRC], MExxCTRL,
+- 0xa0200701);
++ 0xc0800701);
+ meram_write_icb (dfbvideosink->meram, dfbvideosink->icbc[SRC], MExxBSIZE,
+ (((sliceheight / 2 + dfbvideosink->tile_boundary_c_offset -
+ 1) & 0x1fff) << 16) | ((stride - 1) & 0x7fff));
+--
+1.7.0.4
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-bad_0.10.23.bbappend b/common/recipes-multimedia/gstreamer/gst-plugins-bad_0.10.23.bbappend
new file mode 100644
index 0000000..6dd2399
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-bad_0.10.23.bbappend
@@ -0,0 +1,27 @@
+DEPENDS += "gstreamer libxml2"
+EXTRA_OECONF := "${@'${EXTRA_OECONF}'.replace('--disable-experimental', '--enable-experimental')}"
+EXTRA_OECONF += "--with-plugins=h264parse,asfmux,videoparsers"
+
+TARGET_CFLAGS += "-D_GNU_SOURCE"
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+# For armadillo
+SRCREV_armadillo800eva = "6c0a11cb57d4425f6d721a6756c5af4d9dd269e5"
+SRC_URI_armadillo800eva = "git://github.com/matsu/gst-plugins-bad.git \
+ file://0001-Setup-MERAM-for-A1.patch"
+S_armadillo800eva = "${WORKDIR}/git/"
+DEPENDS_append_armadillo800eva = " directfb libuiomux libshvio"
+EXTRA_OECONF_armadillo800eva := "${@'${EXTRA_OECONF}'.replace('--disable-directfb', '--enable-directfb')}"
+
+EXTRA_OECONF_append_armadillo800eva = " \
+ --disable-librfb --enable-introspection=no \
+ --disable-nls --disable-static --disable-gsettings \
+"
+
+do_configure_armadillo800eva() {
+ (cd ${S}; sh autogen.sh --noconfigure)
+ oe_runconf
+}
+
+FILES_${PN} += "${bindir}"
+require gst-plugins-private-libs.inc
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-base/0001-gstaudiosink-wait-for-gst_ring_buffer_advance-when-p.patch b/common/recipes-multimedia/gstreamer/gst-plugins-base/0001-gstaudiosink-wait-for-gst_ring_buffer_advance-when-p.patch
new file mode 100644
index 0000000..7d04c8c
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-base/0001-gstaudiosink-wait-for-gst_ring_buffer_advance-when-p.patch
@@ -0,0 +1,79 @@
+From d46fff879acb78b6cd42937864f80e22389e3acb Mon Sep 17 00:00:00 2001
+From: Hideki EIRAKU <hdk@igel.co.jp>
+Date: Fri, 18 May 2012 19:30:27 +0900
+Subject: [PATCH] gstaudiosink: wait for gst_ring_buffer_advance when pausing
+
+If gst_ring_buffer_advance is called after paused, the time of
+audio sink is updated and the base_time will be increased when resuming.
+The base_time change makes a cleared buffer play.
+Gstaudiosrc may have the same problem.
+---
+ gst-libs/gst/audio/gstaudiosink.c | 9 +++++++++
+ gst-libs/gst/audio/gstaudiosink.h | 3 +++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/gst-libs/gst/audio/gstaudiosink.c b/gst-libs/gst/audio/gstaudiosink.c
+index c5fec73..72984bf 100644
+--- a/gst-libs/gst/audio/gstaudiosink.c
++++ b/gst-libs/gst/audio/gstaudiosink.c
+@@ -265,6 +265,8 @@ audioringbuffer_thread_func (GstRingBuffer * buf)
+ gst_ring_buffer_advance (buf, 1);
+ } else {
+ GST_OBJECT_LOCK (abuf);
++ sink->buffer_running = FALSE;
++ g_cond_signal (sink->pause_cond);
+ if (!abuf->running)
+ goto stop_running;
+ if (G_UNLIKELY (g_atomic_int_get (&buf->state) ==
+@@ -280,6 +282,7 @@ audioringbuffer_thread_func (GstRingBuffer * buf)
+ if (!abuf->running)
+ goto stop_running;
+ GST_DEBUG_OBJECT (sink, "continue running");
++ sink->buffer_running = TRUE;
+ GST_OBJECT_UNLOCK (abuf);
+ }
+ }
+@@ -429,6 +432,8 @@ gst_audioringbuffer_activate (GstRingBuffer * buf, gboolean active)
+
+ GST_DEBUG_OBJECT (sink, "starting thread");
+
++ sink->pause_cond = g_cond_new ();
++ sink->buffer_running = TRUE;
+ #if !GLIB_CHECK_VERSION (2, 31, 0)
+ sink->thread =
+ g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE,
+@@ -454,6 +459,7 @@ gst_audioringbuffer_activate (GstRingBuffer * buf, gboolean active)
+
+ /* join the thread */
+ g_thread_join (sink->thread);
++ g_cond_free (sink->pause_cond);
+
+ GST_OBJECT_LOCK (buf);
+ }
+@@ -531,6 +537,9 @@ gst_audioringbuffer_pause (GstRingBuffer * buf)
+ GST_DEBUG_OBJECT (sink, "reset done");
+ }
+
++ if (sink->buffer_running)
++ g_cond_wait (sink->pause_cond, GST_OBJECT_GET_LOCK (buf));
++
+ return TRUE;
+ }
+
+diff --git a/gst-libs/gst/audio/gstaudiosink.h b/gst-libs/gst/audio/gstaudiosink.h
+index 83a4e95..8c32d5a 100644
+--- a/gst-libs/gst/audio/gstaudiosink.h
++++ b/gst-libs/gst/audio/gstaudiosink.h
+@@ -49,6 +49,9 @@ struct _GstAudioSink {
+ /*< private >*/ /* with LOCK */
+ GThread *thread;
+
++ GCond *pause_cond;
++ gboolean buffer_running;
++
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+ };
+--
+1.7.10.4
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-base_0.10.36.bbappend b/common/recipes-multimedia/gstreamer/gst-plugins-base_0.10.36.bbappend
new file mode 100644
index 0000000..8765eea
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-base_0.10.36.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://0001-gstaudiosink-wait-for-gst_ring_buffer_advance-when-p.patch"
+
+require gst-plugins-private-libs.inc
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0001-sys-v4l2-gstv4l2-fix-the-depth-value-for-RGB32.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0001-sys-v4l2-gstv4l2-fix-the-depth-value-for-RGB32.patch
new file mode 100644
index 0000000..b6bf9c1
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0001-sys-v4l2-gstv4l2-fix-the-depth-value-for-RGB32.patch
@@ -0,0 +1,65 @@
+From f2ceec7fb2e1b7a182eb737216fe3214a743247d Mon Sep 17 00:00:00 2001
+From: Katsuya Matsubara <matsu@igel.co.jp>
+Date: Wed, 14 Mar 2012 21:19:31 +0900
+Subject: [PATCH 01/31] sys/v4l2/gstv4l2: fix the depth value for RGB32
+
+The 'depth' value for RGB32 must be 24 rather than 32.
+This changes conversion code between color format
+representaion in caps and V4L2 definition.
+---
+ sys/v4l2/gstv4l2object.c | 17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
+index 81d1cb7..2c1bde4 100644
+--- a/sys/v4l2/gstv4l2object.c
++++ b/sys/v4l2/gstv4l2object.c
+@@ -1208,14 +1208,16 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc)
+ b_mask = 0xff0000;
+ break;
+ case V4L2_PIX_FMT_RGB32:
+- bpp = depth = 32;
++ bpp = 32;
++ depth = 24;
+ endianness = G_BIG_ENDIAN;
+ r_mask = 0xff000000;
+ g_mask = 0x00ff0000;
+ b_mask = 0x0000ff00;
+ break;
+ case V4L2_PIX_FMT_BGR32:
+- bpp = depth = 32;
++ bpp = 32;
++ depth = 24;
+ endianness = G_BIG_ENDIAN;
+ r_mask = 0x000000ff;
+ g_mask = 0x0000ff00;
+@@ -1480,9 +1482,10 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
+ #endif
+ }
+ } else if (!strcmp (mimetype, "video/x-raw-rgb")) {
+- gint depth, endianness, r_mask;
++ gint bpp, depth, endianness, r_mask;
+
+ gst_structure_get_int (structure, "depth", &depth);
++ gst_structure_get_int (structure, "bpp", &bpp);
+ gst_structure_get_int (structure, "endianness", &endianness);
+ gst_structure_get_int (structure, "red_mask", &r_mask);
+
+@@ -1499,10 +1502,10 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
+ V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X;
+ break;
+ case 24:
+- fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
+- break;
+- case 32:
+- fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
++ if (bpp == 24)
++ fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
++ else if (bpp == 32)
++ fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
+ break;
+ }
+ } else if (strcmp (mimetype, "video/x-dv") == 0) {
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0002-Revert-sys-v4l2-gstv4l2-fix-the-depth-value-for-RGB3.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0002-Revert-sys-v4l2-gstv4l2-fix-the-depth-value-for-RGB3.patch
new file mode 100644
index 0000000..d53ca83
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0002-Revert-sys-v4l2-gstv4l2-fix-the-depth-value-for-RGB3.patch
@@ -0,0 +1,64 @@
+From 187c290bc57a65fe6f669a6026bdb36b4c89a2a9 Mon Sep 17 00:00:00 2001
+From: Katsuya Matsubara <matsu@igel.co.jp>
+Date: Thu, 15 Mar 2012 14:53:39 +0900
+Subject: [PATCH 02/31] Revert "sys/v4l2/gstv4l2: fix the depth value for
+ RGB32"
+
+This reverts commit f2ceec7fb2e1b7a182eb737216fe3214a743247d.
+---
+ sys/v4l2/gstv4l2object.c | 17 +++++++----------
+ 1 file changed, 7 insertions(+), 10 deletions(-)
+
+diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
+index 2c1bde4..81d1cb7 100644
+--- a/sys/v4l2/gstv4l2object.c
++++ b/sys/v4l2/gstv4l2object.c
+@@ -1208,16 +1208,14 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc)
+ b_mask = 0xff0000;
+ break;
+ case V4L2_PIX_FMT_RGB32:
+- bpp = 32;
+- depth = 24;
++ bpp = depth = 32;
+ endianness = G_BIG_ENDIAN;
+ r_mask = 0xff000000;
+ g_mask = 0x00ff0000;
+ b_mask = 0x0000ff00;
+ break;
+ case V4L2_PIX_FMT_BGR32:
+- bpp = 32;
+- depth = 24;
++ bpp = depth = 32;
+ endianness = G_BIG_ENDIAN;
+ r_mask = 0x000000ff;
+ g_mask = 0x0000ff00;
+@@ -1482,10 +1480,9 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
+ #endif
+ }
+ } else if (!strcmp (mimetype, "video/x-raw-rgb")) {
+- gint bpp, depth, endianness, r_mask;
++ gint depth, endianness, r_mask;
+
+ gst_structure_get_int (structure, "depth", &depth);
+- gst_structure_get_int (structure, "bpp", &bpp);
+ gst_structure_get_int (structure, "endianness", &endianness);
+ gst_structure_get_int (structure, "red_mask", &r_mask);
+
+@@ -1502,10 +1499,10 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
+ V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X;
+ break;
+ case 24:
+- if (bpp == 24)
+- fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
+- else if (bpp == 32)
+- fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
++ fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
++ break;
++ case 32:
++ fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
+ break;
+ }
+ } else if (strcmp (mimetype, "video/x-dv") == 0) {
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0003-sys-v4l2-gstv4l2-register-uiomux-memory-regions-via-.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0003-sys-v4l2-gstv4l2-register-uiomux-memory-regions-via-.patch
new file mode 100644
index 0000000..cd22317
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0003-sys-v4l2-gstv4l2-register-uiomux-memory-regions-via-.patch
@@ -0,0 +1,262 @@
+From c3fe71c65f87b32351e58969becb30102d3ddb05 Mon Sep 17 00:00:00 2001
+From: Katsuya Matsubara <matsu@igel.co.jp>
+Date: Fri, 6 Apr 2012 16:51:08 +0900
+Subject: [PATCH 03/31] sys/v4l2/gstv4l2: register uiomux memory regions via
+ USERPTR
+
+This patch enables to register uiomux memory regions via USERPTR
+for capture buffers. This may reduce memory-copy overhead with
+sharing the buffer between source and sink element.
+---
+ configure.ac | 8 ++++++
+ sys/v4l2/Makefile.am | 2 ++
+ sys/v4l2/gstv4l2bufferpool.c | 55 ++++++++++++++++++++++++++++++++++++++++++
+ sys/v4l2/gstv4l2bufferpool.h | 8 ++++++
+ sys/v4l2/gstv4l2src.c | 15 ++++++++----
+ 5 files changed, 83 insertions(+), 5 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 8a43fda..5bfddfe 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -572,6 +572,14 @@ return 0;
+ AC_DEFINE(GST_V4L2_MISSING_BUFDECL, 1, [struct v4l2_buffer missing])
+ fi
+
++ dnl check for libuiomux
++ PKG_CHECK_MODULES(UIOMUX, uiomux >= 1.6.2, HAVE_UIOMUX="yes", [
++ HAVE_UIOMUX="no"
++ ])
++ if test $HAVE_UIOMUX = "yes"; then
++ AC_DEFINE(HAVE_UIOMUX, 1, [Define if we have libuiomux])
++ fi
++
+ dnl check for XOverlay libraries
+ AG_GST_CHECK_XV
+ fi
+diff --git a/sys/v4l2/Makefile.am b/sys/v4l2/Makefile.am
+index a7a99de..c4b55d2 100644
+--- a/sys/v4l2/Makefile.am
++++ b/sys/v4l2/Makefile.am
+@@ -28,6 +28,7 @@ libgstvideo4linux2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
+ $(GST_BASE_CFLAGS) \
+ $(GST_CONTROLLER_CFLAGS) \
+ $(GST_CFLAGS) \
++ $(UIOMUX_CFLAGS) \
+ $(X_CFLAGS) \
+ $(LIBV4L2_CFLAGS) \
+ $(GUDEV_CFLAGS)
+@@ -42,6 +43,7 @@ libgstvideo4linux2_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
+ -lgstvideo-$(GST_MAJORMINOR) \
+ -lgstinterfaces-$(GST_MAJORMINOR) \
+ $(GST_LIBS) \
++ $(UIOMUX_LIBS) \
+ $(xv_libs) \
+ $(LIBV4L2_LIBS) \
+ $(GUDEV_LIBS)
+diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
+index b81c6a4..a2800aa 100644
+--- a/sys/v4l2/gstv4l2bufferpool.c
++++ b/sys/v4l2/gstv4l2bufferpool.c
+@@ -108,7 +108,12 @@ gst_v4l2_buffer_finalize (GstV4l2Buffer * buffer)
+ "buffer %p (data %p, len %u) not recovered, unmapping",
+ buffer, GST_BUFFER_DATA (buffer), buffer->vbuffer.length);
+ gst_mini_object_unref (GST_MINI_OBJECT (pool));
++#if defined(HAVE_UIOMUX)
++ uiomux_free (pool->uiomux, pool->uiores, (void *) GST_BUFFER_DATA (buffer),
++ buffer->vbuffer.length);
++#else
+ v4l2_munmap ((void *) GST_BUFFER_DATA (buffer), buffer->vbuffer.length);
++#endif
+
+ GST_MINI_OBJECT_CLASS (v4l2buffer_parent_class)->finalize (GST_MINI_OBJECT
+ (buffer));
+@@ -166,7 +171,11 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index, GstCaps * caps)
+
+ ret->vbuffer.index = index;
+ ret->vbuffer.type = pool->type;
++#if defined(HAVE_UIOMUX)
++ ret->vbuffer.memory = V4L2_MEMORY_USERPTR;
++#else
+ ret->vbuffer.memory = V4L2_MEMORY_MMAP;
++#endif
+
+ if (v4l2_ioctl (pool->video_fd, VIDIOC_QUERYBUF, &ret->vbuffer) < 0)
+ goto querybuf_failed;
+@@ -183,12 +192,21 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index, GstCaps * caps)
+ GST_LOG_OBJECT (pool->v4l2elem, " length: %u", ret->vbuffer.length);
+ GST_LOG_OBJECT (pool->v4l2elem, " input: %u", ret->vbuffer.input);
+
++#if defined(HAVE_UIOMUX)
++ data = uiomux_malloc (pool->uiomux, pool->uiores, ret->vbuffer.length, 32);
++ if (data == NULL)
++ goto malloc_failed;
++
++ memset (data, 0, ret->vbuffer.length);
++ ret->vbuffer.m.userptr = (unsigned long) data;
++#else
+ data = (guint8 *) v4l2_mmap (0, ret->vbuffer.length,
+ PROT_READ | PROT_WRITE, MAP_SHARED, pool->video_fd,
+ ret->vbuffer.m.offset);
+
+ if (data == MAP_FAILED)
+ goto mmap_failed;
++#endif
+
+ GST_BUFFER_DATA (ret) = data;
+ GST_BUFFER_SIZE (ret) = ret->vbuffer.length;
+@@ -209,6 +227,17 @@ querybuf_failed:
+ errno = errnosave;
+ return NULL;
+ }
++#if defined(HAVE_UIOMUX)
++malloc_failed:
++ {
++ gint errnosave = errno;
++
++ GST_WARNING ("Failed uiomux_malloc: %s", g_strerror (errnosave));
++ gst_buffer_unref (GST_BUFFER (ret));
++ errno = errnosave;
++ return NULL;
++ }
++#else
+ mmap_failed:
+ {
+ gint errnosave = errno;
+@@ -218,6 +247,7 @@ mmap_failed:
+ errno = errnosave;
+ return NULL;
+ }
++#endif /* defined(HAVE_UIOMUX) */
+ }
+
+
+@@ -335,6 +365,9 @@ gst_v4l2_buffer_pool_new (GstElement * v4l2elem, gint fd, gint num_buffers,
+ GstV4l2BufferPool *pool;
+ gint n;
+ struct v4l2_requestbuffers breq;
++#if defined(HAVE_UIOMUX)
++ const char *blocks[2] = { "VIO", NULL };
++#endif
+
+ pool = (GstV4l2BufferPool *) gst_mini_object_new (GST_TYPE_V4L2_BUFFER_POOL);
+
+@@ -342,6 +375,12 @@ gst_v4l2_buffer_pool_new (GstElement * v4l2elem, gint fd, gint num_buffers,
+ if (pool->video_fd < 0)
+ goto dup_failed;
+
++#if defined(HAVE_UIOMUX)
++ pool->uiores = 1 << 0;
++ pool->uiomux = uiomux_open_named (blocks);
++ if (pool->uiomux == NULL)
++ goto uiomux_failed;
++#endif
+
+ /* first, lets request buffers, and see how many we can get: */
+ GST_DEBUG_OBJECT (v4l2elem, "STREAMING, requesting %d MMAP buffers",
+@@ -350,7 +389,11 @@ gst_v4l2_buffer_pool_new (GstElement * v4l2elem, gint fd, gint num_buffers,
+ memset (&breq, 0, sizeof (struct v4l2_requestbuffers));
+ breq.type = type;
+ breq.count = num_buffers;
++#if defined(HAVE_UIOMUX)
++ breq.memory = V4L2_MEMORY_USERPTR;
++#else
+ breq.memory = V4L2_MEMORY_MMAP;
++#endif
+
+ if (v4l2_ioctl (fd, VIDIOC_REQBUFS, &breq) < 0)
+ goto reqbufs_failed;
+@@ -396,6 +439,14 @@ dup_failed:
+
+ return NULL;
+ }
++#if defined(HAVE_UIOMUX)
++uiomux_failed:
++ {
++ GST_ELEMENT_ERROR (v4l2elem, RESOURCE, READ,
++ (_("Failed uiomux_open")), (NULL));
++ return NULL;
++ }
++#endif /* defined(HAVE_UIOMUX) */
+ reqbufs_failed:
+ {
+ GstV4l2Object *v4l2object = get_v4l2_object (v4l2elem);
+@@ -540,7 +591,11 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool)
+
+ memset (&buffer, 0x00, sizeof (buffer));
+ buffer.type = pool->type;
++#if defined(HAVE_UIOMUX)
++ buffer.memory = V4L2_MEMORY_USERPTR;
++#else
+ buffer.memory = V4L2_MEMORY_MMAP;
++#endif
+
+
+ if (v4l2_ioctl (pool->video_fd, VIDIOC_DQBUF, &buffer) >= 0) {
+diff --git a/sys/v4l2/gstv4l2bufferpool.h b/sys/v4l2/gstv4l2bufferpool.h
+index caad9ac..6fb3067 100644
+--- a/sys/v4l2/gstv4l2bufferpool.h
++++ b/sys/v4l2/gstv4l2bufferpool.h
+@@ -27,6 +27,9 @@
+
+ #include <gst/gst.h>
+ #include "v4l2_calls.h"
++#if defined(HAVE_UIOMUX)
++#include "uiomux/uiomux.h"
++#endif
+
+ GST_DEBUG_CATEGORY_EXTERN (v4l2buffer_debug);
+
+@@ -53,6 +56,11 @@ struct _GstV4l2BufferPool
+ {
+ GstMiniObject parent;
+
++#if defined(HAVE_UIOMUX)
++ UIOMux *uiomux; /* uiomux handle */
++ uiomux_resource_t uiores; /* uiomux resource flag */
++#endif /* defined(HAVE_UIOMUX) */
++
+ GstElement *v4l2elem; /* the v4l2 src/sink that owns us.. maybe we should be owned by v4l2object? */
+ gboolean requeuebuf; /* if true, unusued buffers are automatically re-QBUF'd */
+ enum v4l2_buf_type type; /* V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_OUTPUT */
+diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c
+index f8ae09c..d3f9a3c 100644
+--- a/sys/v4l2/gstv4l2src.c
++++ b/sys/v4l2/gstv4l2src.c
+@@ -63,8 +63,13 @@
+ GST_DEBUG_CATEGORY (v4l2src_debug);
+ #define GST_CAT_DEFAULT v4l2src_debug
+
++#if defined(HAVE_UIOMUX)
++#define PROP_DEF_QUEUE_SIZE 4
++#define PROP_DEF_ALWAYS_COPY FALSE
++#else
+ #define PROP_DEF_QUEUE_SIZE 2
+ #define PROP_DEF_ALWAYS_COPY TRUE
++#endif
+ #define PROP_DEF_DECIMATE 1
+
+ #define DEFAULT_PROP_DEVICE "/dev/video0"
+@@ -96,14 +101,14 @@ gst_v4l2src_iface_supported (GstImplementsInterface * iface, GType iface_type)
+
+ #ifdef HAVE_XVIDEO
+ if (!(iface_type == GST_TYPE_TUNER ||
+- iface_type == GST_TYPE_X_OVERLAY ||
+- iface_type == GST_TYPE_COLOR_BALANCE ||
+- iface_type == GST_TYPE_VIDEO_ORIENTATION))
++ iface_type == GST_TYPE_X_OVERLAY ||
++ iface_type == GST_TYPE_COLOR_BALANCE ||
++ iface_type == GST_TYPE_VIDEO_ORIENTATION))
+ return FALSE;
+ #else
+ if (!(iface_type == GST_TYPE_TUNER ||
+- iface_type == GST_TYPE_COLOR_BALANCE ||
+- iface_type == GST_TYPE_VIDEO_ORIENTATION))
++ iface_type == GST_TYPE_COLOR_BALANCE ||
++ iface_type == GST_TYPE_VIDEO_ORIENTATION))
+ return FALSE;
+ #endif
+
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0004-sys-v4l2-gstv4l2-release-corresponding-uiomux-handle.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0004-sys-v4l2-gstv4l2-release-corresponding-uiomux-handle.patch
new file mode 100644
index 0000000..c1b06b5
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0004-sys-v4l2-gstv4l2-release-corresponding-uiomux-handle.patch
@@ -0,0 +1,31 @@
+From c856d711cc54856dac5410aac6bf35330e5f8394 Mon Sep 17 00:00:00 2001
+From: Katsuya Matsubara <matsu@igel.co.jp>
+Date: Mon, 7 May 2012 10:11:38 +0900
+Subject: [PATCH 04/31] sys/v4l2/gstv4l2: release corresponding uiomux handle
+ whenever a buffer pool destroyed
+
+This change could avoid memory leaks and unnecessary file descriptor
+consumption.
+---
+ sys/v4l2/gstv4l2bufferpool.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
+index a2800aa..90ce3b3 100644
+--- a/sys/v4l2/gstv4l2bufferpool.c
++++ b/sys/v4l2/gstv4l2bufferpool.c
+@@ -513,6 +513,11 @@ gst_v4l2_buffer_pool_destroy (GstV4l2BufferPool * pool)
+ gst_buffer_unref (buf);
+ }
+
++#if defined(HAVE_UIOMUX)
++ if (pool->uiomux)
++ uiomux_close (pool->uiomux);
++#endif
++
+ gst_mini_object_unref (GST_MINI_OBJECT (pool));
+ }
+
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0005-videocrop-correct-coding-style-with-gst-indent.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0005-videocrop-correct-coding-style-with-gst-indent.patch
new file mode 100644
index 0000000..d512ba6
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0005-videocrop-correct-coding-style-with-gst-indent.patch
@@ -0,0 +1,104 @@
+From 1cce809f580828df792e35ae76a7a38685eec377 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Tue, 8 May 2012 17:04:13 +0900
+Subject: [PATCH 05/31] videocrop: correct coding style with gst-indent
+
+---
+ gst/videocrop/gstvideocrop.c | 7 +++----
+ gst/videocrop/gstvideocrop.h | 25 +++++++++++--------------
+ 2 files changed, 14 insertions(+), 18 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 04b6e61..1f09f8d 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -147,8 +147,7 @@ gst_video_crop_base_init (gpointer g_class)
+ "Crops video into a user-defined region",
+ "Tim-Philipp Müller <tim centricular net>");
+
+- gst_element_class_add_static_pad_template (element_class,
+- &sink_template);
++ gst_element_class_add_static_pad_template (element_class, &sink_template);
+ gst_element_class_add_static_pad_template (element_class, &src_template);
+ }
+
+@@ -639,8 +638,8 @@ gst_video_crop_set_caps (GstBaseTransform * trans, GstCaps * incaps,
+ GST_LOG_OBJECT (crop, "incaps = %" GST_PTR_FORMAT ", outcaps = %"
+ GST_PTR_FORMAT, incaps, outcaps);
+
+- if ((crop->crop_left | crop->crop_right | crop->crop_top | crop->
+- crop_bottom) == 0) {
++ if ((crop->crop_left | crop->crop_right | crop->
++ crop_top | crop->crop_bottom) == 0) {
+ GST_LOG_OBJECT (crop, "we are using passthrough");
+ gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (crop), TRUE);
+ } else {
+diff --git a/gst/videocrop/gstvideocrop.h b/gst/videocrop/gstvideocrop.h
+index 477f21b..f05649d 100644
+--- a/gst/videocrop/gstvideocrop.h
++++ b/gst/videocrop/gstvideocrop.h
+@@ -23,7 +23,6 @@
+ #include <gst/base/gstbasetransform.h>
+
+ G_BEGIN_DECLS
+-
+ #define GST_TYPE_VIDEO_CROP \
+ (gst_video_crop_get_type())
+ #define GST_VIDEO_CROP(obj) \
+@@ -34,27 +33,27 @@ G_BEGIN_DECLS
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_CROP))
+ #define GST_IS_VIDEO_CROP_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_CROP))
+-
+-typedef enum {
+- VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE = 0, /* RGBx, AYUV */
+- VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX, /* UYVY, YVYU */
+- VIDEO_CROP_PIXEL_FORMAT_PLANAR /* I420, YV12 */
++ typedef enum
++{
++ VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE = 0, /* RGBx, AYUV */
++ VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX, /* UYVY, YVYU */
++ VIDEO_CROP_PIXEL_FORMAT_PLANAR /* I420, YV12 */
+ } VideoCropPixelFormat;
+
+ typedef struct _GstVideoCropImageDetails GstVideoCropImageDetails;
+ struct _GstVideoCropImageDetails
+ {
+- /*< private >*/
+- VideoCropPixelFormat packing;
++ /*< private > */
++ VideoCropPixelFormat packing;
+
+ guint width;
+ guint height;
+ guint size;
+
+ /* for packed RGB and YUV */
+- guint stride;
+- guint bytes_per_pixel;
+- guint8 macro_y_off; /* for YUY2, YVYU, UYVY, Y offset within macropixel in bytes */
++ guint stride;
++ guint bytes_per_pixel;
++ guint8 macro_y_off; /* for YUY2, YVYU, UYVY, Y offset within macropixel in bytes */
+
+ /* for planar YUV */
+ guint y_stride, y_off;
+@@ -69,7 +68,7 @@ struct _GstVideoCrop
+ {
+ GstBaseTransform basetransform;
+
+- /*< private >*/
++ /*< private > */
+ gint crop_left;
+ gint crop_right;
+ gint crop_top;
+@@ -87,6 +86,4 @@ struct _GstVideoCropClass
+ GType gst_video_crop_get_type (void);
+
+ G_END_DECLS
+-
+ #endif /* __GST_VIDEO_CROP_H__ */
+-
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0006-videocrop-send-a-query-whether-the-rowstride-capabil.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0006-videocrop-send-a-query-whether-the-rowstride-capabil.patch
new file mode 100644
index 0000000..7058544
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0006-videocrop-send-a-query-whether-the-rowstride-capabil.patch
@@ -0,0 +1,105 @@
+From 39bb299bd638b78fdf8c4054bcc90f9f915d7ff8 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 10 May 2012 10:46:20 +0900
+Subject: [PATCH 06/31] videocrop: send a query whether the rowstride
+ capability is supported
+
+This patch sends a query which asks downstream plugins whether
+can handle the rowstride capability.
+gst_video_crop_start() can be invoked when the pad is enabled.
+The query is issued by gst_video_crop_start() once at initialization.
+
+This patch is preliminary for the zero-copy cropping.
+---
+ gst/videocrop/gstvideocrop.c | 38 ++++++++++++++++++++++++++++++++++++++
+ gst/videocrop/gstvideocrop.h | 4 ++++
+ 2 files changed, 42 insertions(+)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 1f09f8d..b0c3a68 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -136,6 +136,7 @@ static gboolean gst_video_crop_set_caps (GstBaseTransform * trans,
+ GstCaps * in_caps, GstCaps * outcaps);
+ static gboolean gst_video_crop_src_event (GstBaseTransform * trans,
+ GstEvent * event);
++static gboolean gst_video_crop_start (GstBaseTransform * trans);
+
+ static void
+ gst_video_crop_base_init (gpointer g_class)
+@@ -228,6 +229,7 @@ gst_video_crop_class_init (GstVideoCropClass * klass)
+ basetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_crop_set_caps);
+ basetransform_class->get_unit_size =
+ GST_DEBUG_FUNCPTR (gst_video_crop_get_unit_size);
++ basetransform_class->start = GST_DEBUG_FUNCPTR (gst_video_crop_start);
+
+ basetransform_class->passthrough_on_same_caps = FALSE;
+ basetransform_class->src_event = GST_DEBUG_FUNCPTR (gst_video_crop_src_event);
+@@ -240,6 +242,10 @@ gst_video_crop_init (GstVideoCrop * vcrop, GstVideoCropClass * klass)
+ vcrop->crop_left = 0;
+ vcrop->crop_top = 0;
+ vcrop->crop_bottom = 0;
++
++ /* register query type for rowstride */
++ vcrop->query_type_stride = gst_query_type_register ("stride-supported",
++ "whether dealing with rowstride as a capability or not");
+ }
+
+ static gboolean
+@@ -669,6 +675,38 @@ cropping_too_much:
+ }
+ }
+
++static gboolean
++gst_video_crop_query_stride_supported (GstVideoCrop * vcrop)
++{
++ gboolean result = FALSE;
++ GstPad *peer = gst_pad_get_peer (GST_BASE_TRANSFORM (vcrop)->srcpad);
++ GstStructure *structure;
++ GstQuery *query;
++
++ structure = gst_structure_empty_new ("GstQueryStrideSupported");
++ gst_structure_set (structure, "stride-supported", G_TYPE_BOOLEAN, FALSE,
++ NULL);
++
++ query = gst_query_new_application (vcrop->query_type_stride, structure);
++ if (gst_pad_query (peer, query))
++ gst_structure_get_boolean (structure, "stride-supported", &result);
++
++ gst_query_unref (query);
++ gst_object_unref (peer);
++
++ return result;
++}
++
++static gboolean
++gst_video_crop_start (GstBaseTransform * trans)
++{
++ GstVideoCrop *vcrop = GST_VIDEO_CROP (trans);
++
++ vcrop->stride_supported = gst_video_crop_query_stride_supported (vcrop);
++
++ return TRUE;
++}
++
+ static void
+ gst_video_crop_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+diff --git a/gst/videocrop/gstvideocrop.h b/gst/videocrop/gstvideocrop.h
+index f05649d..5cfe03e 100644
+--- a/gst/videocrop/gstvideocrop.h
++++ b/gst/videocrop/gstvideocrop.h
+@@ -76,6 +76,10 @@ struct _GstVideoCrop
+
+ GstVideoCropImageDetails in; /* details of input image */
+ GstVideoCropImageDetails out; /* details of output image */
++
++ /* query for rowstride */
++ GstQueryType query_type_stride;
++ gboolean stride_supported;
+ };
+
+ struct _GstVideoCropClass
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0007-videocrop-set-rowstride-capability.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0007-videocrop-set-rowstride-capability.patch
new file mode 100644
index 0000000..1eef8de
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0007-videocrop-set-rowstride-capability.patch
@@ -0,0 +1,59 @@
+From 0d5b9694fc670d489d02018d1e2d83394f299ad5 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 10 May 2012 11:20:18 +0900
+Subject: [PATCH 07/31] videocrop: set rowstride capability
+
+This patch sets the rowstride capability if downstream plugins
+can handle it.
+
+This patch is preliminary for the zero-copy cropping.
+---
+ gst/videocrop/gstvideocrop.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index b0c3a68..ae7ddaf 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -585,22 +585,22 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ other_caps = gst_caps_new_empty ();
+
+ for (i = 0; i < gst_caps_get_size (caps); ++i) {
+- const GValue *v;
++ const GValue *in_width, *in_height;
+ GstStructure *structure, *new_structure;
+ GValue w_val = { 0, }, h_val = {
+ 0,};
+
+ structure = gst_caps_get_structure (caps, i);
+
+- v = gst_structure_get_value (structure, "width");
+- if (!gst_video_crop_transform_dimension_value (v, dx, &w_val)) {
++ in_width = gst_structure_get_value (structure, "width");
++ if (!gst_video_crop_transform_dimension_value (in_width, dx, &w_val)) {
+ GST_WARNING_OBJECT (vcrop, "could not tranform width value with dx=%d"
+ ", caps structure=%" GST_PTR_FORMAT, dx, structure);
+ continue;
+ }
+
+- v = gst_structure_get_value (structure, "height");
+- if (!gst_video_crop_transform_dimension_value (v, dy, &h_val)) {
++ in_height = gst_structure_get_value (structure, "height");
++ if (!gst_video_crop_transform_dimension_value (in_height, dy, &h_val)) {
+ g_value_unset (&w_val);
+ GST_WARNING_OBJECT (vcrop, "could not tranform height value with dy=%d"
+ ", caps structure=%" GST_PTR_FORMAT, dy, structure);
+@@ -610,6 +610,10 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ new_structure = gst_structure_copy (structure);
+ gst_structure_set_value (new_structure, "width", &w_val);
+ gst_structure_set_value (new_structure, "height", &h_val);
++
++ /* set rowstride when creating output caps */
++ if (vcrop->stride_supported && (direction == GST_PAD_SINK))
++ gst_structure_set_value (new_structure, "rowstride", in_width);
+ g_value_unset (&w_val);
+ g_value_unset (&h_val);
+ GST_LOG_OBJECT (vcrop, "transformed structure %2d: %" GST_PTR_FORMAT
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0008-videocrop-kick-off-the-zero-copy-cropping.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0008-videocrop-kick-off-the-zero-copy-cropping.patch
new file mode 100644
index 0000000..1e4734e
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0008-videocrop-kick-off-the-zero-copy-cropping.patch
@@ -0,0 +1,100 @@
+From 78f532d7cc31fc7e2980998af97b1260c45ec5e5 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 10 May 2012 14:55:22 +0900
+Subject: [PATCH 08/31] videocrop: kick off the zero-copy cropping
+
+This patch enables zero-copy buffer cropping by creating a subbuffer
+from an input buffer.
+
+Instead of creating a new buffer, the subbuffer is specified as an
+offset into the input buffer along with an appropriate buffer size.
+
+The cropping functionality of gst_video_crop_transform() (which uses memory
+copying) is bypassed when a subbuffer is defined.
+---
+ gst/videocrop/gstvideocrop.c | 48 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 48 insertions(+)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index ae7ddaf..cfd548e 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -137,6 +137,8 @@ static gboolean gst_video_crop_set_caps (GstBaseTransform * trans,
+ static gboolean gst_video_crop_src_event (GstBaseTransform * trans,
+ GstEvent * event);
+ static gboolean gst_video_crop_start (GstBaseTransform * trans);
++static GstFlowReturn gst_video_crop_prepare_output_buffer (GstBaseTransform *
++ trans, GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf);
+
+ static void
+ gst_video_crop_base_init (gpointer g_class)
+@@ -230,6 +232,8 @@ gst_video_crop_class_init (GstVideoCropClass * klass)
+ basetransform_class->get_unit_size =
+ GST_DEBUG_FUNCPTR (gst_video_crop_get_unit_size);
+ basetransform_class->start = GST_DEBUG_FUNCPTR (gst_video_crop_start);
++ basetransform_class->prepare_output_buffer =
++ GST_DEBUG_FUNCPTR (gst_video_crop_prepare_output_buffer);
+
+ basetransform_class->passthrough_on_same_caps = FALSE;
+ basetransform_class->src_event = GST_DEBUG_FUNCPTR (gst_video_crop_src_event);
+@@ -484,6 +488,13 @@ gst_video_crop_transform (GstBaseTransform * trans, GstBuffer * inbuf,
+ {
+ GstVideoCrop *vcrop = GST_VIDEO_CROP (trans);
+
++ if (vcrop->stride_supported &&
++ ((vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE) ||
++ (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX))) {
++ GST_LOG_OBJECT (vcrop, "passthrough because of zero-copy cropping");
++ return GST_FLOW_OK;
++ }
++
+ switch (vcrop->in.packing) {
+ case VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE:
+ gst_video_crop_transform_packed_simple (vcrop, inbuf, outbuf);
+@@ -711,6 +722,43 @@ gst_video_crop_start (GstBaseTransform * trans)
+ return TRUE;
+ }
+
++static GstFlowReturn
++gst_video_crop_prepare_output_buffer (GstBaseTransform * trans,
++ GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf)
++{
++ GstVideoCrop *vcrop = GST_VIDEO_CROP (trans);
++ guint sub_offset, sub_size;
++
++ if (!vcrop->stride_supported) {
++ GST_LOG_OBJECT
++ (vcrop,
++ "creating subbuffer isn't needed because downstream plugins don't support rowstride");
++ return GST_FLOW_OK;
++ }
++
++ if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE) {
++ sub_offset = (vcrop->crop_top * vcrop->in.stride) +
++ (vcrop->crop_left * vcrop->in.bytes_per_pixel);
++ } else if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX) {
++ sub_offset = (vcrop->crop_top * vcrop->in.stride) +
++ (ROUND_DOWN_2 (vcrop->crop_left) * vcrop->in.bytes_per_pixel);
++ } else {
++ GST_LOG_OBJECT (vcrop,
++ "can't do zero-copy cropping except for packed format");
++ return GST_FLOW_OK;
++ }
++
++ sub_size = vcrop->out.height * vcrop->out.stride;
++ *buf = gst_buffer_create_sub (input, sub_offset, sub_size);
++ if (*buf == NULL) {
++ GST_ERROR_OBJECT (vcrop, "failed to create subbuffer");
++ return GST_FLOW_ERROR;
++ }
++ gst_buffer_set_caps (*buf, caps);
++
++ return GST_FLOW_OK;
++}
++
+ static void
+ gst_video_crop_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0009-avidemux-set-frame-start-code-to-VC-1-advanced-profi.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0009-avidemux-set-frame-start-code-to-VC-1-advanced-profi.patch
new file mode 100644
index 0000000..180fac3
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0009-avidemux-set-frame-start-code-to-VC-1-advanced-profi.patch
@@ -0,0 +1,90 @@
+From a3dc6aa0c57e1fa00efdf0e68d3a4b8645519b9d Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Wed, 18 Jul 2012 19:30:34 +0900
+Subject: [PATCH 09/31] avidemux: set frame start code to VC-1 advanced
+ profile stream
+
+VC-1 advanced profile constrains the bitstream format to pair
+the frame data with the frame start code.
+This patch pulls frame data from previous plugin with extra field
+for containing a start code and inserts the start code before the
+frame data if the stream doesn't has the start code.
+---
+ gst/avi/gstavidemux.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 48 insertions(+), 3 deletions(-)
+
+diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c
+index b6c065f..385aa30 100644
+--- a/gst/avi/gstavidemux.c
++++ b/gst/avi/gstavidemux.c
+@@ -4689,6 +4689,10 @@ gst_avi_demux_loop_data (GstAviDemux * avi)
+ guint64 out_offset, out_offset_end;
+ gboolean keyframe;
+ GstAviIndexEntry *entry;
++ guint8 *data;
++ GstStructure *structure;
++ guint32 fourcc;
++ gboolean need_st_code;
+
+ do {
+ stream_num = gst_avi_demux_find_next (avi, avi->segment.rate);
+@@ -4740,12 +4744,53 @@ gst_avi_demux_loop_data (GstAviDemux * avi)
+ G_GUINT64_FORMAT " (0x%" G_GINT64_MODIFIER "x), kf %d", size,
+ stream_num, offset, offset, keyframe);
+
++ structure = gst_caps_get_structure (GST_PAD_CAPS (stream->pad), 0);
++ if (gst_structure_get_fourcc (structure, "format", &fourcc)) {
++ /* set start code for VC-1 advanced profile if fourcc is 'WVC1' */
++ if (fourcc == GST_MAKE_FOURCC ('W', 'V', 'C', '1'))
++ need_st_code = TRUE;
++ else
++ need_st_code = FALSE;
++ } else
++ need_st_code = FALSE;
++
+ /* FIXME, check large chunks and cut them up */
+
+ /* pull in the data */
+- ret = gst_pad_pull_range (avi->sinkpad, offset, size, &buf);
+- if (ret != GST_FLOW_OK)
+- goto pull_failed;
++ if (need_st_code) {
++ if (offset < 4)
++ /* This branch isn't passed through because offset is definitely
++ more than 4 owing to container's header presented before
++ frame data. */
++ goto pull_failed;
++
++ ret = gst_pad_pull_range (avi->sinkpad, offset - 4, size + 4, &buf);
++ if (ret != GST_FLOW_OK)
++ goto pull_failed;
++
++ data = GST_BUFFER_DATA (buf);
++ /* check if this stream has a start code */
++ if (data[4] == 0x00 && data[5] == 0x00 && data[6] == 0x01 &&
++ data[7] == 0x0d) {
++ GstBuffer *sub_buf;
++
++ sub_buf = gst_buffer_create_sub (buf, 4, size);
++ if (sub_buf == NULL)
++ goto pull_failed;
++
++ gst_buffer_unref (buf);
++ buf = sub_buf;
++ } else {
++ data[0] = 0x00;
++ data[1] = 0x00;
++ data[2] = 0x01;
++ data[3] = 0x0d;
++ }
++ } else {
++ ret = gst_pad_pull_range (avi->sinkpad, offset, size, &buf);
++ if (ret != GST_FLOW_OK)
++ goto pull_failed;
++ }
+
+ /* check for short buffers, this is EOS as well */
+ if (GST_BUFFER_SIZE (buf) < size)
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0010-videocrop-add-gst_video_crop_get_image_details_from_.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0010-videocrop-add-gst_video_crop_get_image_details_from_.patch
new file mode 100644
index 0000000..5d64ac8
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0010-videocrop-add-gst_video_crop_get_image_details_from_.patch
@@ -0,0 +1,55 @@
+From 9f24d6c70d56c454a06b6fe41116d046dcc3c9f6 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Tue, 25 Sep 2012 15:51:24 +0900
+Subject: [PATCH 10/31] videocrop: add
+ gst_video_crop_get_image_details_from_structure
+ function
+
+Add an function to allow retrieval of image details from structures instead of
+only from caps.
+---
+ gst/videocrop/gstvideocrop.c | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index cfd548e..80c6d3d 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -253,13 +253,11 @@ gst_video_crop_init (GstVideoCrop * vcrop, GstVideoCropClass * klass)
+ }
+
+ static gboolean
+-gst_video_crop_get_image_details_from_caps (GstVideoCrop * vcrop,
+- GstVideoCropImageDetails * details, GstCaps * caps)
++gst_video_crop_get_image_details_from_structure (GstVideoCrop * vcrop,
++ GstVideoCropImageDetails * details, GstStructure * structure)
+ {
+- GstStructure *structure;
+ gint width, height;
+
+- structure = gst_caps_get_structure (caps, 0);
+ if (!gst_structure_get_int (structure, "width", &width) ||
+ !gst_structure_get_int (structure, "height", &height)) {
+ goto incomplete_format;
+@@ -356,6 +354,18 @@ incomplete_format:
+ }
+
+ static gboolean
++gst_video_crop_get_image_details_from_caps (GstVideoCrop * vcrop,
++ GstVideoCropImageDetails * details, GstCaps * caps)
++{
++ GstStructure *structure;
++
++ structure = gst_caps_get_structure (caps, 0);
++
++ return gst_video_crop_get_image_details_from_structure (vcrop, details,
++ structure);
++}
++
++static gboolean
+ gst_video_crop_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
+ guint * size)
+ {
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0011-videocrop-change-the-unit-of-rowstride-to-byte.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0011-videocrop-change-the-unit-of-rowstride-to-byte.patch
new file mode 100644
index 0000000..89c2025
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0011-videocrop-change-the-unit-of-rowstride-to-byte.patch
@@ -0,0 +1,36 @@
+From 88b1d76187a840987ef548bd9c3023ebfd97ea5a Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Wed, 26 Sep 2012 10:34:31 +0900
+Subject: [PATCH 11/31] videocrop: change the unit of rowstride to byte
+
+Set rowstride units to bytes in order to align with other plugins.
+---
+ gst/videocrop/gstvideocrop.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 80c6d3d..6af348a 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -633,8 +633,16 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ gst_structure_set_value (new_structure, "height", &h_val);
+
+ /* set rowstride when creating output caps */
+- if (vcrop->stride_supported && (direction == GST_PAD_SINK))
+- gst_structure_set_value (new_structure, "rowstride", in_width);
++ if (vcrop->stride_supported && (direction == GST_PAD_SINK)) {
++ GstVideoCropImageDetails img_details = { 0, };
++ GValue stride = { 0, };
++
++ gst_video_crop_get_image_details_from_structure (vcrop, &img_details,
++ structure);
++ g_value_init (&stride, G_TYPE_INT);
++ g_value_set_int (&stride, (gint) img_details.stride);
++ gst_structure_set_value (new_structure, "rowstride", &stride);
++ }
+ g_value_unset (&w_val);
+ g_value_unset (&h_val);
+ GST_LOG_OBJECT (vcrop, "transformed structure %2d: %" GST_PTR_FORMAT
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0012-videocrop-add-tests-to-determine-if-width-and-height.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0012-videocrop-add-tests-to-determine-if-width-and-height.patch
new file mode 100644
index 0000000..5712fdf
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0012-videocrop-add-tests-to-determine-if-width-and-height.patch
@@ -0,0 +1,39 @@
+From 93c3d86c39fceb5a9dd6b390627da5090ee171dd Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 4 Oct 2012 10:33:03 +0900
+Subject: [PATCH 12/31] videocrop: add tests to determine if width and height
+ caps hold range value before getting image details
+
+This check is necessary because gst_video_crop_get_image_details_from_structure()
+can't be performed when caps contain range value.
+---
+ gst/videocrop/gstvideocrop.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 6af348a..059b11a 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -637,11 +637,14 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ GstVideoCropImageDetails img_details = { 0, };
+ GValue stride = { 0, };
+
+- gst_video_crop_get_image_details_from_structure (vcrop, &img_details,
+- structure);
+- g_value_init (&stride, G_TYPE_INT);
+- g_value_set_int (&stride, (gint) img_details.stride);
+- gst_structure_set_value (new_structure, "rowstride", &stride);
++ if (!GST_VALUE_HOLDS_INT_RANGE (&w_val) &&
++ !GST_VALUE_HOLDS_INT_RANGE (&h_val) &&
++ gst_video_crop_get_image_details_from_structure (vcrop, &img_details,
++ structure)) {
++ g_value_init (&stride, G_TYPE_INT);
++ g_value_set_int (&stride, (gint) img_details.stride);
++ gst_structure_set_value (new_structure, "rowstride", &stride);
++ }
+ }
+ g_value_unset (&w_val);
+ g_value_unset (&h_val);
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0013-videocrop-replace-the-processing-to-set-gint-value-t.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0013-videocrop-replace-the-processing-to-set-gint-value-t.patch
new file mode 100644
index 0000000..bb0121b
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0013-videocrop-replace-the-processing-to-set-gint-value-t.patch
@@ -0,0 +1,35 @@
+From 5cb7845d61eadad90c1a0a2bc5078ec4c4b3dc98 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 4 Oct 2012 10:57:10 +0900
+Subject: [PATCH 13/31] videocrop: replace the processing to set gint value to
+ structure with gst_structure_set
+
+---
+ gst/videocrop/gstvideocrop.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 059b11a..9c5df28 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -635,15 +635,13 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ /* set rowstride when creating output caps */
+ if (vcrop->stride_supported && (direction == GST_PAD_SINK)) {
+ GstVideoCropImageDetails img_details = { 0, };
+- GValue stride = { 0, };
+
+ if (!GST_VALUE_HOLDS_INT_RANGE (&w_val) &&
+ !GST_VALUE_HOLDS_INT_RANGE (&h_val) &&
+ gst_video_crop_get_image_details_from_structure (vcrop, &img_details,
+ structure)) {
+- g_value_init (&stride, G_TYPE_INT);
+- g_value_set_int (&stride, (gint) img_details.stride);
+- gst_structure_set_value (new_structure, "rowstride", &stride);
++ gst_structure_set (new_structure, "rowstride", G_TYPE_INT,
++ (gint) img_details.stride, NULL);
+ }
+ }
+ g_value_unset (&w_val);
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0014-videocrop-don-t-set-rowstride-only-when-the-color-sp.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0014-videocrop-don-t-set-rowstride-only-when-the-color-sp.patch
new file mode 100644
index 0000000..3ae31e1
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0014-videocrop-don-t-set-rowstride-only-when-the-color-sp.patch
@@ -0,0 +1,66 @@
+From 61154856964b78b3c601e687d6f081e666f94958 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 4 Oct 2012 11:08:56 +0900
+Subject: [PATCH 14/31] videocrop: don't set rowstride only when the color
+ space is the planar
+
+videocrop wouldn't support zero-copy cropping in the planar format.
+Therefore, rowstride shouldn't set only when the color space is the planar.
+---
+ gst/videocrop/gstvideocrop.c | 30 ++++++++++++++++++++++--------
+ 1 file changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 9c5df28..f2d2949 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -610,6 +610,8 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ GstStructure *structure, *new_structure;
+ GValue w_val = { 0, }, h_val = {
+ 0,};
++ GstVideoCropImageDetails img_details = { 0, };
++ guint rowstride;
+
+ structure = gst_caps_get_structure (caps, i);
+
+@@ -633,17 +635,29 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ gst_structure_set_value (new_structure, "height", &h_val);
+
+ /* set rowstride when creating output caps */
+- if (vcrop->stride_supported && (direction == GST_PAD_SINK)) {
+- GstVideoCropImageDetails img_details = { 0, };
+-
+- if (!GST_VALUE_HOLDS_INT_RANGE (&w_val) &&
+- !GST_VALUE_HOLDS_INT_RANGE (&h_val) &&
+- gst_video_crop_get_image_details_from_structure (vcrop, &img_details,
++ if (!GST_VALUE_HOLDS_INT_RANGE (&w_val) &&
++ !GST_VALUE_HOLDS_INT_RANGE (&h_val)) {
++ if (!gst_video_crop_get_image_details_from_structure (vcrop, &img_details,
+ structure)) {
+- gst_structure_set (new_structure, "rowstride", G_TYPE_INT,
+- (gint) img_details.stride, NULL);
++ GST_ERROR_OBJECT (vcrop, "couldn't get image details from structure");
++ goto add_structure;
+ }
++ } else {
++ GST_LOG_OBJECT (vcrop, "go through setting rowstride");
++ goto add_structure;
+ }
++
++ if (img_details.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE ||
++ img_details.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX)
++ rowstride = img_details.stride;
++ else
++ rowstride = 0;
++
++ if (vcrop->stride_supported && (direction == GST_PAD_SINK) && rowstride)
++ gst_structure_set (new_structure, "rowstride", G_TYPE_INT,
++ (gint) rowstride, NULL);
++
++ add_structure:
+ g_value_unset (&w_val);
+ g_value_unset (&h_val);
+ GST_LOG_OBJECT (vcrop, "transformed structure %2d: %" GST_PTR_FORMAT
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0015-videocrop-fix-wrong-subbuffer-size.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0015-videocrop-fix-wrong-subbuffer-size.patch
new file mode 100644
index 0000000..0682416
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0015-videocrop-fix-wrong-subbuffer-size.patch
@@ -0,0 +1,27 @@
+From 2b7594421cbde82ee1e67e625514321f9517ea76 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 4 Oct 2012 12:02:54 +0900
+Subject: [PATCH 15/31] videocrop: fix wrong subbuffer size
+
+It wasn't just subbuffer size but in a unit of stride.
+This patch corrects it.
+---
+ gst/videocrop/gstvideocrop.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index f2d2949..0743719 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -781,7 +781,7 @@ gst_video_crop_prepare_output_buffer (GstBaseTransform * trans,
+ return GST_FLOW_OK;
+ }
+
+- sub_size = vcrop->out.height * vcrop->out.stride;
++ sub_size = vcrop->in.size - sub_offset;
+ *buf = gst_buffer_create_sub (input, sub_offset, sub_size);
+ if (*buf == NULL) {
+ GST_ERROR_OBJECT (vcrop, "failed to create subbuffer");
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0016-videocrop-support-getting-NV12-image-details.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0016-videocrop-support-getting-NV12-image-details.patch
new file mode 100644
index 0000000..e5a1bed
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0016-videocrop-support-getting-NV12-image-details.patch
@@ -0,0 +1,84 @@
+From 47cf0121df5c54d665ccbf9a721cddf547fbbce3 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 4 Oct 2012 11:29:44 +0900
+Subject: [PATCH 16/31] videocrop: support getting NV12 image details
+
+This patch adds a new pixel format definition that is NV12 format.
+The color format type of NV12 is classified into VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR.
+When rowstride or chroma_byte_offset is contained in caps, image
+details reflects these value.
+
+This is preliminary for NV12 zero-copy cropping.
+---
+ gst/videocrop/gstvideocrop.c | 21 +++++++++++++++++++++
+ gst/videocrop/gstvideocrop.h | 8 ++++++--
+ 2 files changed, 27 insertions(+), 2 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 0743719..b6336da 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -328,6 +328,27 @@ gst_video_crop_get_image_details_from_structure (GstVideoCrop * vcrop,
+ details->v_stride * (GST_ROUND_UP_2 (height) / 2);
+ break;
+ }
++ case GST_MAKE_FOURCC ('N', 'V', '1', '2'):
++ {
++ gint stride, chroma_byte_offset;
++
++ details->packing = VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR;
++
++ if (gst_structure_get_int (structure, "rowstride", &stride))
++ details->stride = stride;
++ else
++ details->stride = GST_ROUND_UP_2 (width);
++
++ details->y_off = 0;
++ if (gst_structure_get_int (structure, "chroma_byte_offset",
++ &chroma_byte_offset))
++ details->uv_off = chroma_byte_offset;
++ else
++ details->uv_off = details->stride * GST_ROUND_UP_2 (height);
++
++ details->size = details->uv_off * 3 / 2;
++ }
++ break;
+ default:
+ goto unknown_format;
+ }
+diff --git a/gst/videocrop/gstvideocrop.h b/gst/videocrop/gstvideocrop.h
+index 5cfe03e..2e5d5e6 100644
+--- a/gst/videocrop/gstvideocrop.h
++++ b/gst/videocrop/gstvideocrop.h
+@@ -37,7 +37,8 @@ G_BEGIN_DECLS
+ {
+ VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE = 0, /* RGBx, AYUV */
+ VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX, /* UYVY, YVYU */
+- VIDEO_CROP_PIXEL_FORMAT_PLANAR /* I420, YV12 */
++ VIDEO_CROP_PIXEL_FORMAT_PLANAR, /* I420, YV12 */
++ VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR /* NV12 */
+ } VideoCropPixelFormat;
+
+ typedef struct _GstVideoCropImageDetails GstVideoCropImageDetails;
+@@ -51,7 +52,7 @@ struct _GstVideoCropImageDetails
+ guint size;
+
+ /* for packed RGB and YUV */
+- guint stride;
++ guint stride; /* common use in semi-planar */
+ guint bytes_per_pixel;
+ guint8 macro_y_off; /* for YUY2, YVYU, UYVY, Y offset within macropixel in bytes */
+
+@@ -59,6 +60,9 @@ struct _GstVideoCropImageDetails
+ guint y_stride, y_off;
+ guint u_stride, u_off;
+ guint v_stride, v_off;
++
++ /* for semi-planar YUV */
++ guint uv_off;
+ };
+
+ typedef struct _GstVideoCrop GstVideoCrop;
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0017-videocrop-add-NV12-format-caps-template.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0017-videocrop-add-NV12-format-caps-template.patch
new file mode 100644
index 0000000..11bf99e
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0017-videocrop-add-NV12-format-caps-template.patch
@@ -0,0 +1,25 @@
+From d2d5af3b3912ff588c613803f366984eca82c53f Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 4 Oct 2012 12:11:38 +0900
+Subject: [PATCH 17/31] videocrop: add NV12 format caps template
+
+This is preliminary for NV12 zero-copy cropping.
+---
+ gst/videocrop/gstvideocrop.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index b6336da..df02302 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -102,6 +102,7 @@ enum
+ GST_VIDEO_CAPS_YUV ("Y800") ";" \
+ GST_VIDEO_CAPS_YUV ("I420") ";" \
+ GST_VIDEO_CAPS_YUV ("YV12") ";" \
++ GST_VIDEO_CAPS_YUV ("NV12") ";" \
+ GST_VIDEO_CAPS_RGB_16 ";" \
+ GST_VIDEO_CAPS_RGB_15 ";" \
+ GST_VIDEO_CAPS_GRAY
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0018-videocrop-kick-off-NV12-zero-copy-cropping.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0018-videocrop-kick-off-NV12-zero-copy-cropping.patch
new file mode 100644
index 0000000..4e391db
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0018-videocrop-kick-off-NV12-zero-copy-cropping.patch
@@ -0,0 +1,105 @@
+From 795110fd2b53f1197e94c61078153b3433a1d296 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 4 Oct 2012 13:45:06 +0900
+Subject: [PATCH 18/31] videocrop: kick off NV12 zero-copy cropping
+
+This patch allows videocrop plugin to do zero-copy cropping by
+adjusting the buffer offsets that are rowstride and chroma_byte_offset.
+First of all, the function of cropping with memcpy is passed through
+when the semi planar is set. Then, chroma_byte_offset is adjusted
+to compensate for the extra offset due to creating the subbuffer,
+which is caused by offsetting the buffer address based on Y plane.
+---
+ gst/videocrop/gstvideocrop.c | 37 ++++++++++++++++++++++++++++++++-----
+ 1 file changed, 32 insertions(+), 5 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index df02302..6b1da8a 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -522,7 +522,8 @@ gst_video_crop_transform (GstBaseTransform * trans, GstBuffer * inbuf,
+
+ if (vcrop->stride_supported &&
+ ((vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE) ||
+- (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX))) {
++ (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX) ||
++ (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR))) {
+ GST_LOG_OBJECT (vcrop, "passthrough because of zero-copy cropping");
+ return GST_FLOW_OK;
+ }
+@@ -634,6 +635,7 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ 0,};
+ GstVideoCropImageDetails img_details = { 0, };
+ guint rowstride;
++ gint chroma_byte_offset, delta_chroma_offs;
+
+ structure = gst_caps_get_structure (caps, i);
+
+@@ -656,7 +658,7 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ gst_structure_set_value (new_structure, "width", &w_val);
+ gst_structure_set_value (new_structure, "height", &h_val);
+
+- /* set rowstride when creating output caps */
++ /* set rowstride and adjust chroma_byte_offset when creating output caps */
+ if (!GST_VALUE_HOLDS_INT_RANGE (&w_val) &&
+ !GST_VALUE_HOLDS_INT_RANGE (&h_val)) {
+ if (!gst_video_crop_get_image_details_from_structure (vcrop, &img_details,
+@@ -665,20 +667,42 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ goto add_structure;
+ }
+ } else {
+- GST_LOG_OBJECT (vcrop, "go through setting rowstride");
++ GST_LOG_OBJECT (vcrop,
++ "go through setting rowstride and adjusting chroma_byte_offset");
+ goto add_structure;
+ }
+
+ if (img_details.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE ||
+- img_details.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX)
++ img_details.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX) {
+ rowstride = img_details.stride;
+- else
++ delta_chroma_offs = 0;
++ } else if (img_details.packing == VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR) {
++ guint ratio_y_c;
++
++ rowstride = img_details.stride;
++ /* Y plane / UV plane */
++ ratio_y_c = img_details.uv_off / (img_details.size - img_details.uv_off);
++ delta_chroma_offs = rowstride * vcrop->crop_top / ratio_y_c;
++ } else {
+ rowstride = 0;
++ delta_chroma_offs = 0;
++ }
+
+ if (vcrop->stride_supported && (direction == GST_PAD_SINK) && rowstride)
+ gst_structure_set (new_structure, "rowstride", G_TYPE_INT,
+ (gint) rowstride, NULL);
+
++ if (vcrop->stride_supported &&
++ gst_structure_get_int (structure, "chroma_byte_offset",
++ &chroma_byte_offset) && delta_chroma_offs) {
++ /* Adjust chroma_byte_offset because it would exceed the proper value
++ by delta_chroma_offs. It is due to offsetting the buffer address that
++ indicates Y plane with subbuffer for zero-copy cropping. */
++ chroma_byte_offset -= delta_chroma_offs;
++ gst_structure_set (new_structure, "chroma_byte_offset", G_TYPE_INT,
++ chroma_byte_offset, NULL);
++ }
++
+ add_structure:
+ g_value_unset (&w_val);
+ g_value_unset (&h_val);
+@@ -797,6 +821,9 @@ gst_video_crop_prepare_output_buffer (GstBaseTransform * trans,
+ } else if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX) {
+ sub_offset = (vcrop->crop_top * vcrop->in.stride) +
+ (ROUND_DOWN_2 (vcrop->crop_left) * vcrop->in.bytes_per_pixel);
++ } else if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR) {
++ sub_offset = (vcrop->crop_top * vcrop->in.stride) +
++ ROUND_DOWN_2 (vcrop->crop_left);
+ } else {
+ GST_LOG_OBJECT (vcrop,
+ "can't do zero-copy cropping except for packed format");
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0019-videocrop-send-a-query-by-the-first-invorker-of-quer.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0019-videocrop-send-a-query-by-the-first-invorker-of-quer.patch
new file mode 100644
index 0000000..217ebd0
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0019-videocrop-send-a-query-by-the-first-invorker-of-quer.patch
@@ -0,0 +1,123 @@
+From 554ffc759f9a87c4eac81fab91a2ac29e296c33c Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 4 Oct 2012 17:22:01 +0900
+Subject: [PATCH 19/31] videocrop: send a query by the first invorker of
+ query_stride_supported
+
+The query_stride_supported() might be failed because start() method
+can be called before the pipeline is constructed. To resolve this issue,
+this patch has the first invoker of query_stride_supported() send
+the query to downstream plugins. The result of query is cached
+at the first invoking.
+---
+ gst/videocrop/gstvideocrop.c | 30 +++++++++++++-----------------
+ gst/videocrop/gstvideocrop.h | 1 -
+ 2 files changed, 13 insertions(+), 18 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 6b1da8a..da30c1b 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -137,9 +137,9 @@ static gboolean gst_video_crop_set_caps (GstBaseTransform * trans,
+ GstCaps * in_caps, GstCaps * outcaps);
+ static gboolean gst_video_crop_src_event (GstBaseTransform * trans,
+ GstEvent * event);
+-static gboolean gst_video_crop_start (GstBaseTransform * trans);
+ static GstFlowReturn gst_video_crop_prepare_output_buffer (GstBaseTransform *
+ trans, GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf);
++static gboolean gst_video_crop_query_stride_supported (GstVideoCrop * vcrop);
+
+ static void
+ gst_video_crop_base_init (gpointer g_class)
+@@ -232,7 +232,6 @@ gst_video_crop_class_init (GstVideoCropClass * klass)
+ basetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_crop_set_caps);
+ basetransform_class->get_unit_size =
+ GST_DEBUG_FUNCPTR (gst_video_crop_get_unit_size);
+- basetransform_class->start = GST_DEBUG_FUNCPTR (gst_video_crop_start);
+ basetransform_class->prepare_output_buffer =
+ GST_DEBUG_FUNCPTR (gst_video_crop_prepare_output_buffer);
+
+@@ -520,7 +519,7 @@ gst_video_crop_transform (GstBaseTransform * trans, GstBuffer * inbuf,
+ {
+ GstVideoCrop *vcrop = GST_VIDEO_CROP (trans);
+
+- if (vcrop->stride_supported &&
++ if (gst_video_crop_query_stride_supported (vcrop) &&
+ ((vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE) ||
+ (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX) ||
+ (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR))) {
+@@ -688,11 +687,12 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ delta_chroma_offs = 0;
+ }
+
+- if (vcrop->stride_supported && (direction == GST_PAD_SINK) && rowstride)
++ if (gst_video_crop_query_stride_supported (vcrop) &&
++ (direction == GST_PAD_SINK) && rowstride)
+ gst_structure_set (new_structure, "rowstride", G_TYPE_INT,
+ (gint) rowstride, NULL);
+
+- if (vcrop->stride_supported &&
++ if (gst_video_crop_query_stride_supported (vcrop) &&
+ gst_structure_get_int (structure, "chroma_byte_offset",
+ &chroma_byte_offset) && delta_chroma_offs) {
+ /* Adjust chroma_byte_offset because it would exceed the proper value
+@@ -772,10 +772,14 @@ cropping_too_much:
+ static gboolean
+ gst_video_crop_query_stride_supported (GstVideoCrop * vcrop)
+ {
+- gboolean result = FALSE;
++ static gboolean result = FALSE;
+ GstPad *peer = gst_pad_get_peer (GST_BASE_TRANSFORM (vcrop)->srcpad);
+ GstStructure *structure;
+ GstQuery *query;
++ static gboolean is_query_done = FALSE;
++
++ if (is_query_done)
++ return result;
+
+ structure = gst_structure_empty_new ("GstQueryStrideSupported");
+ gst_structure_set (structure, "stride-supported", G_TYPE_BOOLEAN, FALSE,
+@@ -788,17 +792,9 @@ gst_video_crop_query_stride_supported (GstVideoCrop * vcrop)
+ gst_query_unref (query);
+ gst_object_unref (peer);
+
+- return result;
+-}
+-
+-static gboolean
+-gst_video_crop_start (GstBaseTransform * trans)
+-{
+- GstVideoCrop *vcrop = GST_VIDEO_CROP (trans);
+-
+- vcrop->stride_supported = gst_video_crop_query_stride_supported (vcrop);
++ is_query_done = TRUE;
+
+- return TRUE;
++ return result;
+ }
+
+ static GstFlowReturn
+@@ -808,7 +804,7 @@ gst_video_crop_prepare_output_buffer (GstBaseTransform * trans,
+ GstVideoCrop *vcrop = GST_VIDEO_CROP (trans);
+ guint sub_offset, sub_size;
+
+- if (!vcrop->stride_supported) {
++ if (!gst_video_crop_query_stride_supported (vcrop)) {
+ GST_LOG_OBJECT
+ (vcrop,
+ "creating subbuffer isn't needed because downstream plugins don't support rowstride");
+diff --git a/gst/videocrop/gstvideocrop.h b/gst/videocrop/gstvideocrop.h
+index 2e5d5e6..1534b3d 100644
+--- a/gst/videocrop/gstvideocrop.h
++++ b/gst/videocrop/gstvideocrop.h
+@@ -83,7 +83,6 @@ struct _GstVideoCrop
+
+ /* query for rowstride */
+ GstQueryType query_type_stride;
+- gboolean stride_supported;
+ };
+
+ struct _GstVideoCropClass
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0020-videocrop-set-tile-boundary-offset-in-caps-for-T-L-a.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0020-videocrop-set-tile-boundary-offset-in-caps-for-T-L-a.patch
new file mode 100644
index 0000000..1970394
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0020-videocrop-set-tile-boundary-offset-in-caps-for-T-L-a.patch
@@ -0,0 +1,44 @@
+From efde8be8052d31a13629160c55f59e3be661a48c Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Fri, 12 Oct 2012 18:33:29 +0900
+Subject: [PATCH 20/31] videocrop: set tile boundary offset in caps for T/L
+ addressing
+
+This change is necessary for cropping the image data that is stored
+as tiles in memory. Thease capabilities notify downstream plugins of
+the offset to the previous tile boundary.
+---
+ gst/videocrop/gstvideocrop.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index da30c1b..dbebcfa 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -677,11 +677,23 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ delta_chroma_offs = 0;
+ } else if (img_details.packing == VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR) {
+ guint ratio_y_c;
++ GstStructure *structure;
++ gint tile_height;
+
+ rowstride = img_details.stride;
+ /* Y plane / UV plane */
+ ratio_y_c = img_details.uv_off / (img_details.size - img_details.uv_off);
+ delta_chroma_offs = rowstride * vcrop->crop_top / ratio_y_c;
++
++ /* set tile boudary for T/L addressing */
++ structure = gst_caps_get_structure (caps, 0);
++ if (gst_structure_get_int (structure, "tile-height", &tile_height)) {
++ gst_structure_set (new_structure, "tile_boundary_y_offset",
++ G_TYPE_INT, vcrop->crop_top % tile_height, NULL);
++
++ gst_structure_set (new_structure, "tile_boundary_c_offset",
++ G_TYPE_INT, vcrop->crop_top / ratio_y_c % tile_height, NULL);
++ }
+ } else {
+ rowstride = 0;
+ delta_chroma_offs = 0;
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0021-videocrop-support-cropping-interlaced-images.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0021-videocrop-support-cropping-interlaced-images.patch
new file mode 100644
index 0000000..7d66fe4
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0021-videocrop-support-cropping-interlaced-images.patch
@@ -0,0 +1,99 @@
+From b2975883315542cc9beead18a6bfe3bf1dab06b7 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Tue, 16 Oct 2012 16:42:17 +0900
+Subject: [PATCH 21/31] videocrop: support cropping interlaced images
+
+This patch supports it by adjusting the subbuffer offset and
+chroma_byte_offset in caps.
+---
+ gst/videocrop/gstvideocrop.c | 43 ++++++++++++++++++++++++++++++++++++------
+ gst/videocrop/gstvideocrop.h | 2 ++
+ 2 files changed, 39 insertions(+), 6 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index dbebcfa..4d2a027 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -679,20 +679,44 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ guint ratio_y_c;
+ GstStructure *structure;
+ gint tile_height;
++ gboolean interlaced;
++ const gchar *layout;
++
++ structure = gst_caps_get_structure (caps, 0);
++ if (gst_structure_get_boolean (structure, "interlaced", &interlaced) &&
++ (interlaced == TRUE) &&
++ ((layout =
++ gst_structure_get_string (structure, "field-layout")) != NULL)
++ && (strcmp (layout, "sequential") == 0))
++ vcrop->interlaced = TRUE;
++ else
++ vcrop->interlaced = FALSE;
+
+ rowstride = img_details.stride;
+ /* Y plane / UV plane */
+ ratio_y_c = img_details.uv_off / (img_details.size - img_details.uv_off);
+- delta_chroma_offs = rowstride * vcrop->crop_top / ratio_y_c;
++ if (vcrop->interlaced)
++ delta_chroma_offs = rowstride * vcrop->crop_top / ratio_y_c / 2;
++ else
++ delta_chroma_offs = rowstride * vcrop->crop_top / ratio_y_c;
+
+ /* set tile boudary for T/L addressing */
+- structure = gst_caps_get_structure (caps, 0);
+ if (gst_structure_get_int (structure, "tile-height", &tile_height)) {
++ gint tile_y_offs, tile_c_offs;
++
++ if (vcrop->interlaced) {
++ tile_y_offs = vcrop->crop_top / 2 % tile_height;
++ tile_c_offs = vcrop->crop_top / ratio_y_c / 2 % tile_height;
++ } else {
++ tile_y_offs = vcrop->crop_top % tile_height;
++ tile_c_offs = vcrop->crop_top / ratio_y_c % tile_height;
++ }
++
+ gst_structure_set (new_structure, "tile_boundary_y_offset",
+- G_TYPE_INT, vcrop->crop_top % tile_height, NULL);
++ G_TYPE_INT, tile_y_offs, NULL);
+
+ gst_structure_set (new_structure, "tile_boundary_c_offset",
+- G_TYPE_INT, vcrop->crop_top / ratio_y_c % tile_height, NULL);
++ G_TYPE_INT, tile_c_offs, NULL);
+ }
+ } else {
+ rowstride = 0;
+@@ -830,8 +854,15 @@ gst_video_crop_prepare_output_buffer (GstBaseTransform * trans,
+ sub_offset = (vcrop->crop_top * vcrop->in.stride) +
+ (ROUND_DOWN_2 (vcrop->crop_left) * vcrop->in.bytes_per_pixel);
+ } else if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR) {
+- sub_offset = (vcrop->crop_top * vcrop->in.stride) +
+- ROUND_DOWN_2 (vcrop->crop_left);
++ GstStructure *structure;
++
++ structure = gst_caps_get_structure (caps, 0);
++ if (vcrop->interlaced)
++ sub_offset = (vcrop->crop_top / 2 * vcrop->in.stride) +
++ ROUND_DOWN_2 (vcrop->crop_left);
++ else
++ sub_offset = (vcrop->crop_top * vcrop->in.stride) +
++ ROUND_DOWN_2 (vcrop->crop_left);
+ } else {
+ GST_LOG_OBJECT (vcrop,
+ "can't do zero-copy cropping except for packed format");
+diff --git a/gst/videocrop/gstvideocrop.h b/gst/videocrop/gstvideocrop.h
+index 1534b3d..a72cacb 100644
+--- a/gst/videocrop/gstvideocrop.h
++++ b/gst/videocrop/gstvideocrop.h
+@@ -83,6 +83,8 @@ struct _GstVideoCrop
+
+ /* query for rowstride */
+ GstQueryType query_type_stride;
++
++ gboolean interlaced;
+ };
+
+ struct _GstVideoCropClass
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0022-videocrop-move-output-buffer-size-calculation-to-tra.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0022-videocrop-move-output-buffer-size-calculation-to-tra.patch
new file mode 100644
index 0000000..1c62e0d
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0022-videocrop-move-output-buffer-size-calculation-to-tra.patch
@@ -0,0 +1,178 @@
+From e22281e0458c48f1d38b7a2abf20121378a811f8 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 18 Oct 2012 18:27:03 +0900
+Subject: [PATCH 22/31] videocrop: move output buffer size calculation to
+ transform_size()
+
+transform_size() is the optional method that can be overridden to
+calculate buffer sizes. The default implementation uses get_unit_size(),
+but when performing zero-copy cropping, transform_size() should be used
+because the buffer size calculation is different from the default.
+The buffer size calculation should be performed using the tranform_size()
+override, rather than being inlined in prepare_output_buffer().
+---
+ gst/videocrop/gstvideocrop.c | 120 +++++++++++++++++++++++++++++++++---------
+ 1 file changed, 95 insertions(+), 25 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 4d2a027..4887137 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -140,6 +140,9 @@ static gboolean gst_video_crop_src_event (GstBaseTransform * trans,
+ static GstFlowReturn gst_video_crop_prepare_output_buffer (GstBaseTransform *
+ trans, GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf);
+ static gboolean gst_video_crop_query_stride_supported (GstVideoCrop * vcrop);
++static gboolean gst_videocrop_transform_size (GstBaseTransform * trans,
++ GstPadDirection direction, GstCaps * caps, guint size, GstCaps * othercaps,
++ guint * othersize);
+
+ static void
+ gst_video_crop_base_init (gpointer g_class)
+@@ -234,6 +237,8 @@ gst_video_crop_class_init (GstVideoCropClass * klass)
+ GST_DEBUG_FUNCPTR (gst_video_crop_get_unit_size);
+ basetransform_class->prepare_output_buffer =
+ GST_DEBUG_FUNCPTR (gst_video_crop_prepare_output_buffer);
++ basetransform_class->transform_size =
++ GST_DEBUG_FUNCPTR (gst_videocrop_transform_size);
+
+ basetransform_class->passthrough_on_same_caps = FALSE;
+ basetransform_class->src_event = GST_DEBUG_FUNCPTR (gst_video_crop_src_event);
+@@ -838,7 +843,6 @@ gst_video_crop_prepare_output_buffer (GstBaseTransform * trans,
+ GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf)
+ {
+ GstVideoCrop *vcrop = GST_VIDEO_CROP (trans);
+- guint sub_offset, sub_size;
+
+ if (!gst_video_crop_query_stride_supported (vcrop)) {
+ GST_LOG_OBJECT
+@@ -847,30 +851,7 @@ gst_video_crop_prepare_output_buffer (GstBaseTransform * trans,
+ return GST_FLOW_OK;
+ }
+
+- if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE) {
+- sub_offset = (vcrop->crop_top * vcrop->in.stride) +
+- (vcrop->crop_left * vcrop->in.bytes_per_pixel);
+- } else if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX) {
+- sub_offset = (vcrop->crop_top * vcrop->in.stride) +
+- (ROUND_DOWN_2 (vcrop->crop_left) * vcrop->in.bytes_per_pixel);
+- } else if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR) {
+- GstStructure *structure;
+-
+- structure = gst_caps_get_structure (caps, 0);
+- if (vcrop->interlaced)
+- sub_offset = (vcrop->crop_top / 2 * vcrop->in.stride) +
+- ROUND_DOWN_2 (vcrop->crop_left);
+- else
+- sub_offset = (vcrop->crop_top * vcrop->in.stride) +
+- ROUND_DOWN_2 (vcrop->crop_left);
+- } else {
+- GST_LOG_OBJECT (vcrop,
+- "can't do zero-copy cropping except for packed format");
+- return GST_FLOW_OK;
+- }
+-
+- sub_size = vcrop->in.size - sub_offset;
+- *buf = gst_buffer_create_sub (input, sub_offset, sub_size);
++ *buf = gst_buffer_create_sub (input, vcrop->in.size - size, size);
+ if (*buf == NULL) {
+ GST_ERROR_OBJECT (vcrop, "failed to create subbuffer");
+ return GST_FLOW_ERROR;
+@@ -880,6 +861,95 @@ gst_video_crop_prepare_output_buffer (GstBaseTransform * trans,
+ return GST_FLOW_OK;
+ }
+
++static gboolean
++gst_videocrop_transform_size (GstBaseTransform * trans,
++ GstPadDirection direction, GstCaps * caps, guint size, GstCaps * othercaps,
++ guint * othersize)
++{
++ GstVideoCrop *vcrop = GST_VIDEO_CROP (trans);
++ guint inunitsize;
++
++ if (!gst_video_crop_query_stride_supported (vcrop) ||
++ direction == GST_PAD_SRC) {
++ guint outunitsize, units;
++
++ if (!gst_video_crop_get_unit_size (trans, caps, &inunitsize))
++ goto no_in_size;
++
++ GST_DEBUG_OBJECT (vcrop, "input size %d, input unit size %d", size,
++ inunitsize);
++
++ /* input size must be a multiple of the unit_size of the input caps */
++ if (inunitsize == 0 || (size % inunitsize != 0))
++ goto no_multiple;
++
++ /* get the amount of units */
++ units = size / inunitsize;
++
++ /* now get the unit size of the output */
++ if (!gst_video_crop_get_unit_size (trans, othercaps, &outunitsize))
++ goto no_out_size;
++
++ /* the output size is the unit_size times the amount of units on the
++ * input */
++ *othersize = units * outunitsize;
++ } else {
++ guint sub_offset;
++
++ /* Calculate a subbufer size for zero-copy cropping. The subbuffer is
++ created in prepare_output_buffer (). */
++ if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE) {
++ sub_offset = (vcrop->crop_top * vcrop->in.stride) +
++ (vcrop->crop_left * vcrop->in.bytes_per_pixel);
++ } else if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX) {
++ sub_offset = (vcrop->crop_top * vcrop->in.stride) +
++ (ROUND_DOWN_2 (vcrop->crop_left) * vcrop->in.bytes_per_pixel);
++ } else if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR) {
++ GstStructure *structure;
++
++ structure = gst_caps_get_structure (caps, 0);
++ if (vcrop->interlaced)
++ sub_offset = (vcrop->crop_top / 2 * vcrop->in.stride) +
++ ROUND_DOWN_2 (vcrop->crop_left);
++ else
++ sub_offset = (vcrop->crop_top * vcrop->in.stride) +
++ ROUND_DOWN_2 (vcrop->crop_left);
++ } else {
++ GST_LOG_OBJECT (vcrop,
++ "can't do zero-copy cropping except for packed format");
++ return FALSE;
++ }
++
++ *othersize = vcrop->in.size - sub_offset;
++ }
++
++ GST_DEBUG_OBJECT (vcrop, "transformed size to %d", *othersize);
++
++ return TRUE;
++
++ /* ERRORS */
++no_in_size:
++ {
++ GST_DEBUG_OBJECT (vcrop, "could not get in_size");
++ g_warning ("%s: could not get in_size", GST_ELEMENT_NAME (trans));
++ return FALSE;
++ }
++no_multiple:
++ {
++ GST_DEBUG_OBJECT (vcrop, "Size %u is not a multiple of unit size %u", size,
++ inunitsize);
++ g_warning ("%s: size %u is not a multiple of unit size %u",
++ GST_ELEMENT_NAME (trans), size, inunitsize);
++ return FALSE;
++ }
++no_out_size:
++ {
++ GST_DEBUG_OBJECT (vcrop, "could not get out_size");
++ g_warning ("%s: could not get out_size", GST_ELEMENT_NAME (trans));
++ return FALSE;
++ }
++}
++
+ static void
+ gst_video_crop_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0023-videocrop-skip-the-transforming-caps-process-when-th.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0023-videocrop-skip-the-transforming-caps-process-when-th.patch
new file mode 100644
index 0000000..5c33ec6
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0023-videocrop-skip-the-transforming-caps-process-when-th.patch
@@ -0,0 +1,32 @@
+From d13fa761751f252c89032248fbf3b363d4f1827c Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 29 Nov 2012 14:06:33 +0900
+Subject: [PATCH 23/31] videocrop: skip the transforming caps process when the
+ passthrough mode is set
+
+When the passthrough mode is set, the basetransform class tries to accommodate
+a difference between input and output caps. This behavior causes
+the reallocation of the output buffers, and discarding the physical buffers
+used for zero-copy processing.
+To avoid this problem, the transforming caps process shouldn't be performed.
+---
+ gst/videocrop/gstvideocrop.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 4887137..caeb0b1 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -614,6 +614,9 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+
+ vcrop = GST_VIDEO_CROP (trans);
+
++ if (gst_base_transform_is_passthrough (trans))
++ return gst_caps_ref (caps);
++
+ GST_OBJECT_LOCK (vcrop);
+
+ GST_LOG_OBJECT (vcrop, "l=%d,r=%d,b=%d,t=%d",
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0024-v4l2src-fix-RGB32-colorspace-deinitions.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0024-v4l2src-fix-RGB32-colorspace-deinitions.patch
new file mode 100644
index 0000000..e141df9
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0024-v4l2src-fix-RGB32-colorspace-deinitions.patch
@@ -0,0 +1,69 @@
+From e7782d58ed397e0f66cbb62b5c59f3adea8227c4 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Mon, 16 Apr 2012 11:05:07 +0900
+Subject: [PATCH 24/31] v4l2src: fix RGB32 colorspace deinitions
+
+This patch makes RGB32 colorspace definitions used in the caps negotiation
+suitable for actual v4l2 driver's output format.
+---
+ sys/v4l2/gstv4l2object.c | 24 +++++++++++++++---------
+ 1 file changed, 15 insertions(+), 9 deletions(-)
+
+diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
+index 81d1cb7..0678305 100644
+--- a/sys/v4l2/gstv4l2object.c
++++ b/sys/v4l2/gstv4l2object.c
+@@ -1208,14 +1208,16 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc)
+ b_mask = 0xff0000;
+ break;
+ case V4L2_PIX_FMT_RGB32:
+- bpp = depth = 32;
++ bpp = 32;
++ depth = 24;
+ endianness = G_BIG_ENDIAN;
+- r_mask = 0xff000000;
+- g_mask = 0x00ff0000;
+- b_mask = 0x0000ff00;
++ r_mask = 0x00ff0000;
++ g_mask = 0x0000ff00;
++ b_mask = 0x000000ff;
+ break;
+ case V4L2_PIX_FMT_BGR32:
+- bpp = depth = 32;
++ bpp = 32;
++ depth = 24;
+ endianness = G_BIG_ENDIAN;
+ r_mask = 0x000000ff;
+ g_mask = 0x0000ff00;
+@@ -1480,9 +1482,10 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
+ #endif
+ }
+ } else if (!strcmp (mimetype, "video/x-raw-rgb")) {
+- gint depth, endianness, r_mask;
++ gint depth, bpp, endianness, r_mask;
+
+ gst_structure_get_int (structure, "depth", &depth);
++ gst_structure_get_int (structure, "bpp", &bpp);
+ gst_structure_get_int (structure, "endianness", &endianness);
+ gst_structure_get_int (structure, "red_mask", &r_mask);
+
+@@ -1499,10 +1502,13 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
+ V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X;
+ break;
+ case 24:
+- fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
+- break;
+ case 32:
+- fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
++ if (bpp == 24)
++ fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
++ else if (bpp == 32)
++ fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
++ else
++ GST_ERROR_OBJECT (v4l2object, "Invalid value bpp = %d", bpp);
+ break;
+ }
+ } else if (strcmp (mimetype, "video/x-dv") == 0) {
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0025-sys-v4l2-gstv4l2-skip-set-caps-processing-if-the-par.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0025-sys-v4l2-gstv4l2-skip-set-caps-processing-if-the-par.patch
new file mode 100644
index 0000000..53e7acd
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0025-sys-v4l2-gstv4l2-skip-set-caps-processing-if-the-par.patch
@@ -0,0 +1,86 @@
+From 91b8fe5f2e81eb1c5fcdd2f27e5d40ce64a4433f Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Wed, 16 May 2012 15:41:40 +0900
+Subject: [PATCH 25/31] sys/v4l2/gstv4l2: skip set caps processing if the
+ parameters are unchanged
+
+v4l2src re-creates the buffer pool in set_caps() when the buffers
+already have been allocated. If always-copy is set to false,
+the buffer dequeued from V4L2 driver can be passed to next plugin
+without copying. Therefore, set_caps() could free the buffer which
+is in use.
+
+set_caps() may be invoked by core libraries even if there is no change
+to the caps value. This behavior could free the buffer which is in use
+by another plugin. This patch skips the set_caps() processing if the caps
+parameters are unchanged.
+---
+ sys/v4l2/gstv4l2src.c | 36 ++++++++++++++++++++++++++++--------
+ 1 file changed, 28 insertions(+), 8 deletions(-)
+
+diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c
+index d3f9a3c..3f9c6ba 100644
+--- a/sys/v4l2/gstv4l2src.c
++++ b/sys/v4l2/gstv4l2src.c
+@@ -628,6 +628,7 @@ gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps)
+ struct v4l2_fmtdesc *format;
+ guint fps_n, fps_d;
+ guint size;
++ struct v4l2_format prev_format;
+
+ v4l2src = GST_V4L2SRC (src);
+
+@@ -635,8 +636,35 @@ gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps)
+ if (!GST_V4L2_IS_OPEN (v4l2src->v4l2object))
+ return FALSE;
+
++ /* we want our own v4l2 type of fourcc codes */
++ if (!gst_v4l2_object_get_caps_info (v4l2src->v4l2object, caps, &format, &w,
++ &h, &interlaced, &fps_n, &fps_d, &size)) {
++ GST_INFO_OBJECT (v4l2src,
++ "can't get capture format from caps %" GST_PTR_FORMAT, caps);
++ return FALSE;
++ }
++
+ /* make sure we stop capturing and dealloc buffers */
+ if (GST_V4L2_IS_ACTIVE (v4l2src->v4l2object)) {
++ memset (&prev_format, 0x00, sizeof (struct v4l2_format));
++ prev_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
++ if (v4l2_ioctl (v4l2src->v4l2object->video_fd, VIDIOC_G_FMT,
++ &prev_format) < 0) {
++ GST_ERROR_OBJECT (v4l2src, "Call to G_FMT failed: (%s)",
++ g_strerror (errno));
++ return FALSE;
++ }
++
++ if (prev_format.fmt.pix.width == w &&
++ prev_format.fmt.pix.height == h &&
++ prev_format.fmt.pix.pixelformat == format->pixelformat &&
++ (v4l2src->fps_n == 0 || v4l2src->fps_n == fps_n) &&
++ (v4l2src->fps_d == 0 || v4l2src->fps_d == fps_d) &&
++ v4l2src->frame_byte_size == size) {
++ GST_LOG_OBJECT (v4l2src, "skip set caps because of no need to change");
++ return TRUE;
++ }
++
+ /* both will throw an element-error on failure */
+ if (!gst_v4l2src_capture_stop (v4l2src))
+ return FALSE;
+@@ -644,14 +672,6 @@ gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps)
+ return FALSE;
+ }
+
+- /* we want our own v4l2 type of fourcc codes */
+- if (!gst_v4l2_object_get_caps_info (v4l2src->v4l2object, caps, &format, &w,
+- &h, &interlaced, &fps_n, &fps_d, &size)) {
+- GST_INFO_OBJECT (v4l2src,
+- "can't get capture format from caps %" GST_PTR_FORMAT, caps);
+- return FALSE;
+- }
+-
+ GST_DEBUG_OBJECT (v4l2src, "trying to set_capture %dx%d at %d/%d fps, "
+ "format %s", w, h, fps_n, fps_d, format->description);
+
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0026-sys-v4l2-gstv4l2-return-an-error-from-set_caps-if-tr.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0026-sys-v4l2-gstv4l2-return-an-error-from-set_caps-if-tr.patch
new file mode 100644
index 0000000..e73f3a7
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0026-sys-v4l2-gstv4l2-return-an-error-from-set_caps-if-tr.patch
@@ -0,0 +1,66 @@
+From 2cda1fcdf8147fdddbca0f2f2d584bda9cc9d283 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Wed, 23 May 2012 16:24:16 +0900
+Subject: [PATCH 26/31] sys/v4l2/gstv4l2: return an error from set_caps() if
+ trying to re-create in-use buffers
+
+Whether the caps can be changed depends on the always-copy option.
+
+If the caps of a buffer are changed, the buffer must be
+re-created because the buffer size may change. If always-copy is
+set to false, a buffer which is in use could be freed so that it
+can be re-created.
+
+For this reason, if always-copy is set to false, changing the caps is
+not supported and this patch returns an error.
+---
+ sys/v4l2/gstv4l2src.c | 24 ++++++++++++++++++------
+ 1 file changed, 18 insertions(+), 6 deletions(-)
+
+diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c
+index 3f9c6ba..3109429 100644
+--- a/sys/v4l2/gstv4l2src.c
++++ b/sys/v4l2/gstv4l2src.c
+@@ -646,6 +646,8 @@ gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps)
+
+ /* make sure we stop capturing and dealloc buffers */
+ if (GST_V4L2_IS_ACTIVE (v4l2src->v4l2object)) {
++ gboolean caps_changed = FALSE;
++
+ memset (&prev_format, 0x00, sizeof (struct v4l2_format));
+ prev_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ if (v4l2_ioctl (v4l2src->v4l2object->video_fd, VIDIOC_G_FMT,
+@@ -655,14 +657,24 @@ gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps)
+ return FALSE;
+ }
+
+- if (prev_format.fmt.pix.width == w &&
+- prev_format.fmt.pix.height == h &&
+- prev_format.fmt.pix.pixelformat == format->pixelformat &&
+- (v4l2src->fps_n == 0 || v4l2src->fps_n == fps_n) &&
+- (v4l2src->fps_d == 0 || v4l2src->fps_d == fps_d) &&
+- v4l2src->frame_byte_size == size) {
++ if (prev_format.fmt.pix.width != w ||
++ prev_format.fmt.pix.height != h ||
++ prev_format.fmt.pix.pixelformat != format->pixelformat ||
++ (v4l2src->fps_n != 0 && v4l2src->fps_n != fps_n) ||
++ (v4l2src->fps_d != 0 && v4l2src->fps_d != fps_d) ||
++ v4l2src->frame_byte_size != size) {
++ caps_changed = TRUE;
++ }
++
++ if (!caps_changed) {
+ GST_LOG_OBJECT (v4l2src, "skip set caps because of no need to change");
+ return TRUE;
++ } else if (!v4l2src->always_copy && caps_changed) {
++ GST_ERROR_OBJECT (v4l2src,
++ "can't change caps if v4l2src->always_copy is FALSE");
++ return FALSE;
++ } else {
++ GST_LOG_OBJECT (v4l2src, "run set caps");
+ }
+
+ /* both will throw an element-error on failure */
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0027-videocrop-add-a-new-function-to-determine-if-source-.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0027-videocrop-add-a-new-function-to-determine-if-source-.patch
new file mode 100644
index 0000000..cc41aaa
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0027-videocrop-add-a-new-function-to-determine-if-source-.patch
@@ -0,0 +1,67 @@
+From a4185ee69f456d244f3bc5d1dc56800d112a3067 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Mon, 29 Oct 2012 11:52:32 +0900
+Subject: [PATCH 27/31] videocrop: add a new function to determine if source
+ images are interlaced
+
+This patch groups the processing to determine if source images are
+interlaced to gst_video_crop_is_interlaced().
+---
+ gst/videocrop/gstvideocrop.c | 32 ++++++++++++++++++++++----------
+ 1 file changed, 22 insertions(+), 10 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index caeb0b1..d02948d 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -604,6 +604,26 @@ gst_video_crop_transform_dimension_value (const GValue * src_val,
+ return ret;
+ }
+
++static gboolean
++gst_video_crop_is_interlaced (GstCaps * caps)
++{
++ gboolean interlaced;
++ const gchar *layout;
++ GstStructure *structure;
++ gboolean result;
++
++ structure = gst_caps_get_structure (caps, 0);
++ if (gst_structure_get_boolean (structure, "interlaced", &interlaced) &&
++ (interlaced == TRUE) &&
++ ((layout = gst_structure_get_string (structure, "field-layout")) != NULL)
++ && (strcmp (layout, "sequential") == 0))
++ result = TRUE;
++ else
++ result = FALSE;
++
++ return result;
++}
++
+ static GstCaps *
+ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ GstPadDirection direction, GstCaps * caps)
+@@ -687,18 +707,10 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ guint ratio_y_c;
+ GstStructure *structure;
+ gint tile_height;
+- gboolean interlaced;
+- const gchar *layout;
+
+ structure = gst_caps_get_structure (caps, 0);
+- if (gst_structure_get_boolean (structure, "interlaced", &interlaced) &&
+- (interlaced == TRUE) &&
+- ((layout =
+- gst_structure_get_string (structure, "field-layout")) != NULL)
+- && (strcmp (layout, "sequential") == 0))
+- vcrop->interlaced = TRUE;
+- else
+- vcrop->interlaced = FALSE;
++
++ vcrop->interlaced = gst_video_crop_is_interlaced (caps);
+
+ rowstride = img_details.stride;
+ /* Y plane / UV plane */
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0028-videocrop-set-result-of-determing-if-source-images-a.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0028-videocrop-set-result-of-determing-if-source-images-a.patch
new file mode 100644
index 0000000..d5c39b2
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0028-videocrop-set-result-of-determing-if-source-images-a.patch
@@ -0,0 +1,35 @@
+From d9e4f81f59fea3a0b4342e7c6b3312384d479827 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Mon, 29 Oct 2012 14:53:32 +0900
+Subject: [PATCH 28/31] videocrop: set result of determing if source images
+ are interlaced at the head of transform_caps
+
+---
+ gst/videocrop/gstvideocrop.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index d02948d..93d6512 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -642,6 +642,8 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ GST_LOG_OBJECT (vcrop, "l=%d,r=%d,b=%d,t=%d",
+ vcrop->crop_left, vcrop->crop_right, vcrop->crop_bottom, vcrop->crop_top);
+
++ vcrop->interlaced = gst_video_crop_is_interlaced (caps);
++
+ if (direction == GST_PAD_SRC) {
+ dx = vcrop->crop_left + vcrop->crop_right;
+ dy = vcrop->crop_top + vcrop->crop_bottom;
+@@ -710,8 +712,6 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+
+ structure = gst_caps_get_structure (caps, 0);
+
+- vcrop->interlaced = gst_video_crop_is_interlaced (caps);
+-
+ rowstride = img_details.stride;
+ /* Y plane / UV plane */
+ ratio_y_c = img_details.uv_off / (img_details.size - img_details.uv_off);
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0029-videocrop-round-down-cropping-parameters-when-the-co.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0029-videocrop-round-down-cropping-parameters-when-the-co.patch
new file mode 100644
index 0000000..7d1b8ee
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0029-videocrop-round-down-cropping-parameters-when-the-co.patch
@@ -0,0 +1,193 @@
+From 077d4c596e51be368eb495b4aa3e8020acf11d56 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Mon, 29 Oct 2012 14:25:22 +0900
+Subject: [PATCH 29/31] videocrop: round down cropping parameters when the
+ color format is NV12
+
+When the color format is NV12, there are restrictions as the following.
+This change properly rounds down cropping parameters according to the
+restrictions.
+
+* Top: even number or multiple of 4 when a interlaced image is received.
+* Left: even number
+* Right: even number
+---
+ gst/videocrop/gstvideocrop.c | 86 +++++++++++++++++++++++++++++++++---------
+ gst/videocrop/gstvideocrop.h | 9 +++++
+ 2 files changed, 77 insertions(+), 18 deletions(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 93d6512..8fcc80e 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -624,6 +624,40 @@ gst_video_crop_is_interlaced (GstCaps * caps)
+ return result;
+ }
+
++static gboolean
++gst_video_crop_round_down_crop_properties (GstVideoCrop * vcrop, GstCaps * caps,
++ GstVideoCropRectangle * vcrop_rect)
++{
++ GstStructure *structure;
++ guint32 format = 0;
++ gboolean round_down_done;
++
++ g_return_val_if_fail (vcrop_rect != NULL, FALSE);
++
++ structure = gst_caps_get_structure (caps, 0);
++ if (!gst_structure_get_fourcc (structure, "format", &format)) {
++ GST_WARNING_OBJECT (vcrop, "failed to get fourcc");
++ return FALSE;
++ }
++
++ if (vcrop->interlaced && format == GST_MAKE_FOURCC ('N', 'V', '1', '2')) {
++ vcrop_rect->top = GST_ROUND_DOWN_4 (vcrop_rect->top);
++ vcrop_rect->left = GST_ROUND_DOWN_2 (vcrop_rect->left);
++ vcrop_rect->right = GST_ROUND_DOWN_2 (vcrop_rect->right);
++ round_down_done = TRUE;
++ } else if (!vcrop->interlaced &&
++ format == GST_MAKE_FOURCC ('N', 'V', '1', '2')) {
++ vcrop_rect->top = GST_ROUND_DOWN_2 (vcrop_rect->top);
++ vcrop_rect->left = GST_ROUND_DOWN_2 (vcrop_rect->left);
++ vcrop_rect->right = GST_ROUND_DOWN_2 (vcrop_rect->right);
++ round_down_done = TRUE;
++ } else {
++ round_down_done = FALSE;
++ }
++
++ return round_down_done;
++}
++
+ static GstCaps *
+ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ GstPadDirection direction, GstCaps * caps)
+@@ -631,6 +665,7 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ GstVideoCrop *vcrop;
+ GstCaps *other_caps;
+ gint dy, dx, i;
++ GstVideoCropRectangle rounded_rect;
+
+ vcrop = GST_VIDEO_CROP (trans);
+
+@@ -644,12 +679,21 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+
+ vcrop->interlaced = gst_video_crop_is_interlaced (caps);
+
++ rounded_rect.top = vcrop->crop_top;
++ rounded_rect.bottom = vcrop->crop_bottom;
++ rounded_rect.left = vcrop->crop_left;
++ rounded_rect.right = vcrop->crop_right;
++ if (gst_video_crop_round_down_crop_properties (vcrop, caps, &rounded_rect))
++ GST_LOG_OBJECT (vcrop, "round down l=%d,r=%d,b=%d,t=%d",
++ rounded_rect.left, rounded_rect.right, rounded_rect.bottom,
++ rounded_rect.top);
++
+ if (direction == GST_PAD_SRC) {
+- dx = vcrop->crop_left + vcrop->crop_right;
+- dy = vcrop->crop_top + vcrop->crop_bottom;
++ dx = rounded_rect.left + rounded_rect.right;
++ dy = rounded_rect.top + rounded_rect.bottom;
+ } else {
+- dx = 0 - (vcrop->crop_left + vcrop->crop_right);
+- dy = 0 - (vcrop->crop_top + vcrop->crop_bottom);
++ dx = 0 - (rounded_rect.left + rounded_rect.right);
++ dy = 0 - (rounded_rect.top + rounded_rect.bottom);
+ }
+ GST_OBJECT_UNLOCK (vcrop);
+
+@@ -716,20 +760,20 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
+ /* Y plane / UV plane */
+ ratio_y_c = img_details.uv_off / (img_details.size - img_details.uv_off);
+ if (vcrop->interlaced)
+- delta_chroma_offs = rowstride * vcrop->crop_top / ratio_y_c / 2;
++ delta_chroma_offs = rowstride * rounded_rect.top / ratio_y_c / 2;
+ else
+- delta_chroma_offs = rowstride * vcrop->crop_top / ratio_y_c;
++ delta_chroma_offs = rowstride * rounded_rect.top / ratio_y_c;
+
+ /* set tile boudary for T/L addressing */
+ if (gst_structure_get_int (structure, "tile-height", &tile_height)) {
+ gint tile_y_offs, tile_c_offs;
+
+ if (vcrop->interlaced) {
+- tile_y_offs = vcrop->crop_top / 2 % tile_height;
+- tile_c_offs = vcrop->crop_top / ratio_y_c / 2 % tile_height;
++ tile_y_offs = rounded_rect.top / 2 % tile_height;
++ tile_c_offs = rounded_rect.top / ratio_y_c / 2 % tile_height;
+ } else {
+- tile_y_offs = vcrop->crop_top % tile_height;
+- tile_c_offs = vcrop->crop_top / ratio_y_c % tile_height;
++ tile_y_offs = rounded_rect.top % tile_height;
++ tile_c_offs = rounded_rect.top / ratio_y_c % tile_height;
+ }
+
+ gst_structure_set (new_structure, "tile_boundary_y_offset",
+@@ -910,25 +954,31 @@ gst_videocrop_transform_size (GstBaseTransform * trans,
+ *othersize = units * outunitsize;
+ } else {
+ guint sub_offset;
++ GstVideoCropRectangle rounded_rect;
++
++ rounded_rect.top = vcrop->crop_top;
++ rounded_rect.bottom = vcrop->crop_bottom;
++ rounded_rect.left = vcrop->crop_left;
++ rounded_rect.right = vcrop->crop_right;
++ gst_video_crop_round_down_crop_properties (vcrop, caps, &rounded_rect);
+
+ /* Calculate a subbufer size for zero-copy cropping. The subbuffer is
+ created in prepare_output_buffer (). */
+ if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE) {
+- sub_offset = (vcrop->crop_top * vcrop->in.stride) +
+- (vcrop->crop_left * vcrop->in.bytes_per_pixel);
++ sub_offset = (rounded_rect.top * vcrop->in.stride) +
++ (rounded_rect.left * vcrop->in.bytes_per_pixel);
+ } else if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX) {
+- sub_offset = (vcrop->crop_top * vcrop->in.stride) +
+- (ROUND_DOWN_2 (vcrop->crop_left) * vcrop->in.bytes_per_pixel);
++ sub_offset = (rounded_rect.top * vcrop->in.stride) +
++ (ROUND_DOWN_2 (rounded_rect.left) * vcrop->in.bytes_per_pixel);
+ } else if (vcrop->in.packing == VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR) {
+ GstStructure *structure;
+
+ structure = gst_caps_get_structure (caps, 0);
+ if (vcrop->interlaced)
+- sub_offset = (vcrop->crop_top / 2 * vcrop->in.stride) +
+- ROUND_DOWN_2 (vcrop->crop_left);
++ sub_offset = (rounded_rect.top / 2 * vcrop->in.stride) +
++ rounded_rect.left;
+ else
+- sub_offset = (vcrop->crop_top * vcrop->in.stride) +
+- ROUND_DOWN_2 (vcrop->crop_left);
++ sub_offset = (rounded_rect.top * vcrop->in.stride) + rounded_rect.left;
+ } else {
+ GST_LOG_OBJECT (vcrop,
+ "can't do zero-copy cropping except for packed format");
+diff --git a/gst/videocrop/gstvideocrop.h b/gst/videocrop/gstvideocrop.h
+index a72cacb..4885c37 100644
+--- a/gst/videocrop/gstvideocrop.h
++++ b/gst/videocrop/gstvideocrop.h
+@@ -67,6 +67,7 @@ struct _GstVideoCropImageDetails
+
+ typedef struct _GstVideoCrop GstVideoCrop;
+ typedef struct _GstVideoCropClass GstVideoCropClass;
++typedef struct _GstVideoCropRectangle GstVideoCropRectangle;
+
+ struct _GstVideoCrop
+ {
+@@ -94,5 +95,13 @@ struct _GstVideoCropClass
+
+ GType gst_video_crop_get_type (void);
+
++struct _GstVideoCropRectangle
++{
++ gint left;
++ gint right;
++ gint top;
++ gint bottom;
++};
++
+ G_END_DECLS
+ #endif /* __GST_VIDEO_CROP_H__ */
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0030-videocrop-hold-a-lock-to-prevent-from-accessing-crop.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0030-videocrop-hold-a-lock-to-prevent-from-accessing-crop.patch
new file mode 100644
index 0000000..5114174
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0030-videocrop-hold-a-lock-to-prevent-from-accessing-crop.patch
@@ -0,0 +1,30 @@
+From 34b6056ac873388ce008817819cefe930ee9901f Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Wed, 31 Oct 2012 12:33:58 +0900
+Subject: [PATCH 30/31] videocrop: hold a lock to prevent from accessing
+ cropping params on performing set_property
+
+---
+ gst/videocrop/gstvideocrop.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 8fcc80e..2114dae 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -956,10 +956,12 @@ gst_videocrop_transform_size (GstBaseTransform * trans,
+ guint sub_offset;
+ GstVideoCropRectangle rounded_rect;
+
++ GST_OBJECT_LOCK (vcrop);
+ rounded_rect.top = vcrop->crop_top;
+ rounded_rect.bottom = vcrop->crop_bottom;
+ rounded_rect.left = vcrop->crop_left;
+ rounded_rect.right = vcrop->crop_right;
++ GST_OBJECT_UNLOCK (vcrop);
+ gst_video_crop_round_down_crop_properties (vcrop, caps, &rounded_rect);
+
+ /* Calculate a subbufer size for zero-copy cropping. The subbuffer is
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good/0031-videocrop-fix-a-memory-leak-caused-by-invoking-gst_p.patch b/common/recipes-multimedia/gstreamer/gst-plugins-good/0031-videocrop-fix-a-memory-leak-caused-by-invoking-gst_p.patch
new file mode 100644
index 0000000..248f8f7
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good/0031-videocrop-fix-a-memory-leak-caused-by-invoking-gst_p.patch
@@ -0,0 +1,39 @@
+From d152c33c21eba3b9df2918fb8187ff5f839f766f Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Tue, 22 Jan 2013 18:40:28 +0900
+Subject: [PATCH 31/31] videocrop: fix a memory leak caused by invoking
+ gst_pad_get_peer()
+
+Once is_query_done is set to TRUE, the function exits without decreasing
+the reference count of a GstPad instance.
+To fix the issue, this patch moves the call to gst_pad_get_peer() (which
+increases the GstPad refence count) to after is_query_done is tested.
+---
+ gst/videocrop/gstvideocrop.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
+index 2114dae..49edc6e 100644
+--- a/gst/videocrop/gstvideocrop.c
++++ b/gst/videocrop/gstvideocrop.c
+@@ -873,7 +873,7 @@ static gboolean
+ gst_video_crop_query_stride_supported (GstVideoCrop * vcrop)
+ {
+ static gboolean result = FALSE;
+- GstPad *peer = gst_pad_get_peer (GST_BASE_TRANSFORM (vcrop)->srcpad);
++ GstPad *peer;
+ GstStructure *structure;
+ GstQuery *query;
+ static gboolean is_query_done = FALSE;
+@@ -881,6 +881,8 @@ gst_video_crop_query_stride_supported (GstVideoCrop * vcrop)
+ if (is_query_done)
+ return result;
+
++ peer = gst_pad_get_peer (GST_BASE_TRANSFORM (vcrop)->srcpad);
++
+ structure = gst_structure_empty_new ("GstQueryStrideSupported");
+ gst_structure_set (structure, "stride-supported", G_TYPE_BOOLEAN, FALSE,
+ NULL);
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-good_0.10.31.bbappend b/common/recipes-multimedia/gstreamer/gst-plugins-good_0.10.31.bbappend
new file mode 100644
index 0000000..a055a97
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-good_0.10.31.bbappend
@@ -0,0 +1,37 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+PACKAGECONFIG_armadillo800eva += "v4l"
+
+SRC_URI_append_armadillo800eva = " \
+ file://0001-sys-v4l2-gstv4l2-fix-the-depth-value-for-RGB32.patch \
+ file://0002-Revert-sys-v4l2-gstv4l2-fix-the-depth-value-for-RGB3.patch \
+ file://0003-sys-v4l2-gstv4l2-register-uiomux-memory-regions-via-.patch \
+ file://0004-sys-v4l2-gstv4l2-release-corresponding-uiomux-handle.patch \
+ file://0005-videocrop-correct-coding-style-with-gst-indent.patch \
+ file://0006-videocrop-send-a-query-whether-the-rowstride-capabil.patch \
+ file://0007-videocrop-set-rowstride-capability.patch \
+ file://0008-videocrop-kick-off-the-zero-copy-cropping.patch \
+ file://0009-avidemux-set-frame-start-code-to-VC-1-advanced-profi.patch \
+ file://0010-videocrop-add-gst_video_crop_get_image_details_from_.patch \
+ file://0011-videocrop-change-the-unit-of-rowstride-to-byte.patch \
+ file://0012-videocrop-add-tests-to-determine-if-width-and-height.patch \
+ file://0013-videocrop-replace-the-processing-to-set-gint-value-t.patch \
+ file://0014-videocrop-don-t-set-rowstride-only-when-the-color-sp.patch \
+ file://0015-videocrop-fix-wrong-subbuffer-size.patch \
+ file://0016-videocrop-support-getting-NV12-image-details.patch \
+ file://0017-videocrop-add-NV12-format-caps-template.patch \
+ file://0018-videocrop-kick-off-NV12-zero-copy-cropping.patch \
+ file://0019-videocrop-send-a-query-by-the-first-invorker-of-quer.patch \
+ file://0020-videocrop-set-tile-boundary-offset-in-caps-for-T-L-a.patch \
+ file://0021-videocrop-support-cropping-interlaced-images.patch \
+ file://0022-videocrop-move-output-buffer-size-calculation-to-tra.patch \
+ file://0023-videocrop-skip-the-transforming-caps-process-when-th.patch \
+ file://0024-v4l2src-fix-RGB32-colorspace-deinitions.patch \
+ file://0025-sys-v4l2-gstv4l2-skip-set-caps-processing-if-the-par.patch \
+ file://0026-sys-v4l2-gstv4l2-return-an-error-from-set_caps-if-tr.patch \
+ file://0027-videocrop-add-a-new-function-to-determine-if-source-.patch \
+ file://0028-videocrop-set-result-of-determing-if-source-images-a.patch \
+ file://0029-videocrop-round-down-cropping-parameters-when-the-co.patch \
+ file://0030-videocrop-hold-a-lock-to-prevent-from-accessing-crop.patch \
+ file://0031-videocrop-fix-a-memory-leak-caused-by-invoking-gst_p.patch \
+ "
+require gst-plugins-private-libs.inc
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-package.inc b/common/recipes-multimedia/gstreamer/gst-plugins-package.inc
new file mode 100644
index 0000000..7ae3ef6
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-package.inc
@@ -0,0 +1,40 @@
+LIBV = "0.10"
+
+python populate_packages_prepend () {
+ gst_libdir = d.expand('${libdir}/gstreamer-${LIBV}')
+ postinst = d.getVar('plugin_postinst', True)
+ glibdir = d.getVar('libdir', True)
+
+ do_split_packages(d, glibdir, '^lib(.*)\.so\.*', 'lib%s', 'gstreamer %s library', extra_depends='', allow_links=True)
+ do_split_packages(d, gst_libdir, 'libgst(.*)\.so$', d.expand('${PN}-%s'), 'GStreamer plugin for %s', postinst=postinst, extra_depends=d.expand('${PN}'))
+ do_split_packages(d, gst_libdir, 'libgst(.*)\.la$', d.expand('${PN}-%s-dev'), 'GStreamer plugin for %s (development files)', extra_depends=d.expand('${PN}-dev'))
+ do_split_packages(d, gst_libdir, 'libgst(.*)\.a$', d.expand('${PN}-%s-staticdev'), 'GStreamer plugin for %s (static development files)', extra_depends=d.expand('${PN}-staticdev'))
+
+ pn = d.getVar('PN', True)
+ metapkg = pn + '-meta'
+ d.setVar('ALLOW_EMPTY_' + metapkg, "1")
+ d.setVar('FILES_' + metapkg, "")
+ blacklist = [ pn + '-locale', pn + '-dev', pn + '-dbg', pn + '-doc' ]
+ metapkg_rdepends = []
+ packages = d.getVar('PACKAGES', True).split()
+ 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.count('locale') and not pkg.count('-staticdev'):
+ metapkg_rdepends.append(pkg)
+ d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends))
+ d.setVar('DESCRIPTION_' + metapkg, pn + ' meta package')
+}
+
+# metapkg has runtime dependency on PN
+# each plugin depends on PN, plugin-dev on PN-dev and plugin-staticdev on PN-staticdev
+# so we need them even when empty (like in gst-plugins-good case)
+ALLOW_EMPTY_${PN} = "1"
+ALLOW_EMPTY_${PN}-dev = "1"
+ALLOW_EMPTY_${PN}-staticdev = "1"
+
+PACKAGES += "${PN}-apps ${PN}-meta ${PN}-glib"
+FILES_${PN}-apps = "${bindir}"
+
+FILES_${PN} = "${datadir}/gstreamer-${LIBV}"
+FILES_${PN}-dbg += "${libdir}/gstreamer-${LIBV}/.debug"
+FILES_${PN}-glib = "${datadir}/glib-2.0"
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-private-libs.inc b/common/recipes-multimedia/gstreamer/gst-plugins-private-libs.inc
new file mode 100644
index 0000000..ca59ea3
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-private-libs.inc
@@ -0,0 +1,18 @@
+PACKAGESPLITFUNCS_prepend += " add_private_libs_packages "
+
+python add_private_libs_packages () {
+ import os
+ import re
+
+ pn = d.getVar('PN', True)
+ gst_libdir = d.expand('${libdir}/gstreamer-${LIBV}')
+
+ dvar = d.getVar('PKGD', True)
+
+ for dirpath, dirnames, filenames in os.walk(dvar + gst_libdir):
+ for f in filenames:
+ m = re.match('libgst(.*)\.so$', f)
+ if m:
+ plugins = m.group(1)
+ d.setVar('PRIVATE_LIBS_' + pn + '-' + plugins , 'libgst' + plugins + '.so')
+}
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-ugly/0001-asfdemux-asfpacket-set-frame-start-code-to-VC-1-adva.patch b/common/recipes-multimedia/gstreamer/gst-plugins-ugly/0001-asfdemux-asfpacket-set-frame-start-code-to-VC-1-adva.patch
new file mode 100644
index 0000000..d065c7c
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-ugly/0001-asfdemux-asfpacket-set-frame-start-code-to-VC-1-adva.patch
@@ -0,0 +1,99 @@
+From 258bf9862e5b7179562f0cae9fb470f6486dca3a Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 12 Jul 2012 12:08:15 +0900
+Subject: [PATCH] asfdemux/asfpacket: set frame start code to VC-1 advanced
+ profile stream
+
+VC-1 advanced profile constrains the bitstream format to pair
+the frame data with the frame start code.
+---
+ gst/asfdemux/asfpacket.c | 36 +++++++++++++++++++++++++++++++++---
+ 1 file changed, 33 insertions(+), 3 deletions(-)
+
+diff --git a/gst/asfdemux/asfpacket.c b/gst/asfdemux/asfpacket.c
+index 552a559..77209f1 100644
+--- a/gst/asfdemux/asfpacket.c
++++ b/gst/asfdemux/asfpacket.c
+@@ -71,9 +71,10 @@ asf_packet_read_varlen_int (guint lentype_flags, guint lentype_bit_offset,
+
+ static GstBuffer *
+ asf_packet_create_payload_buffer (AsfPacket * packet, const guint8 ** p_data,
+- guint * p_size, guint payload_len)
++ guint * p_size, guint payload_len, gboolean need_st_code)
+ {
+ guint off;
++ guint8 *st_code;
+
+ g_assert (payload_len <= *p_size);
+
+@@ -83,6 +84,21 @@ asf_packet_create_payload_buffer (AsfPacket * packet, const guint8 ** p_data,
+ *p_data += payload_len;
+ *p_size -= payload_len;
+
++ /* set start code for VC-1 advanced profile */
++ if (need_st_code && off >= 4) {
++ st_code = GST_BUFFER_DATA (packet->buf) + (off - 4);
++ /* check if this packet has a start code */
++ if (st_code[4] != 0x00 || st_code[5] != 0x00 || st_code[6] != 0x01 ||
++ st_code[7] != 0x0d) {
++ st_code[0] = 0x00;
++ st_code[1] = 0x00;
++ st_code[2] = 0x01;
++ st_code[3] = 0x0d;
++
++ return gst_buffer_create_sub (packet->buf, off - 4, payload_len + 4);
++ }
++ }
++
+ return gst_buffer_create_sub (packet->buf, off, payload_len);
+ }
+
+@@ -274,6 +290,9 @@ gst_asf_demux_parse_payload (GstASFDemux * demux, AsfPacket * packet,
+ gboolean is_compressed;
+ guint payload_len;
+ guint stream_num;
++ GstStructure *structure;
++ guint32 fourcc;
++ gboolean need_st_code = FALSE;
+
+ if (G_UNLIKELY (*p_size < 1)) {
+ GST_WARNING_OBJECT (demux, "Short packet!");
+@@ -353,6 +372,17 @@ gst_asf_demux_parse_payload (GstASFDemux * demux, AsfPacket * packet,
+ return TRUE;
+ }
+
++ structure = gst_caps_get_structure (stream->caps, 0);
++ if (gst_structure_get_fourcc (structure, "format", &fourcc)) {
++ /*
++ * set start code for VC-1 advanced profile if fourcc is 'WVC1' and this
++ * packet is at the head of a payload.
++ */
++ if (fourcc == GST_MAKE_FOURCC ('W', 'V', 'C', '1')
++ && payload.mo_offset == 0)
++ need_st_code = TRUE;
++ }
++
+ if (G_UNLIKELY (!is_compressed)) {
+ GST_LOG_OBJECT (demux, "replicated data length: %u", payload.rep_data_len);
+
+@@ -384,7 +414,7 @@ gst_asf_demux_parse_payload (GstASFDemux * demux, AsfPacket * packet,
+ if ((stream = gst_asf_demux_get_stream (demux, stream_num))
+ && payload_len) {
+ payload.buf = asf_packet_create_payload_buffer (packet, p_data, p_size,
+- payload_len);
++ payload_len, need_st_code);
+
+ /* n-th fragment of a fragmented media object? */
+ if (payload.mo_offset != 0) {
+@@ -443,7 +473,7 @@ gst_asf_demux_parse_payload (GstASFDemux * demux, AsfPacket * packet,
+
+ if (G_LIKELY (sub_payload_len > 0)) {
+ payload.buf = asf_packet_create_payload_buffer (packet,
+- &payload_data, &payload_len, sub_payload_len);
++ &payload_data, &payload_len, sub_payload_len, need_st_code);
+
+ payload.ts = ts;
+ if (G_LIKELY (ts_delta))
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins-ugly_0.10.19.bbappend b/common/recipes-multimedia/gstreamer/gst-plugins-ugly_0.10.19.bbappend
new file mode 100644
index 0000000..b8c651f
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins-ugly_0.10.19.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+SRC_URI_bockw += " \
+ file://0001-asfdemux-asfpacket-set-frame-start-code-to-VC-1-adva.patch \
+"
+require gst-plugins-private-libs.inc
diff --git a/common/recipes-multimedia/gstreamer/gst-plugins.inc b/common/recipes-multimedia/gstreamer/gst-plugins.inc
new file mode 100644
index 0000000..fc9567a
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gst-plugins.inc
@@ -0,0 +1,29 @@
+DESCRIPTION = "Plugins for GStreamer"
+HOMEPAGE = "http://gstreamer.freedesktop.org/"
+BUGTRACKER = "https://bugzilla.gnome.org/enter_bug.cgi?product=Gstreamer"
+SECTION = "multimedia"
+DEPENDS = "gstreamer"
+
+inherit autotools pkgconfig
+
+FILESPATH =. "${FILE_DIRNAME}/gst-plugins:"
+
+SRC_URI = "http://gstreamer.freedesktop.org/src/${BPN}/${BPN}-${PV}.tar.bz2"
+
+GSTREAMER_DEBUG ?= "--disable-debug"
+EXTRA_OECONF = "--disable-valgrind ${GSTREAMER_DEBUG} --disable-examples "
+
+acpaths = "-I ${S}/common/m4 -I ${S}/m4"
+
+require gst-plugins-package.inc
+
+PACKAGES_DYNAMIC += "^${PN}-.*"
+
+# apply gstreamer hack after Makefile.in.in in source is replaced by our version from
+# ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in, but before configure is executed
+# http://lists.linuxtogo.org/pipermail/openembedded-core/2012-November/032233.html
+oe_runconf_prepend() {
+ if [ -e ${S}/po/Makefile.in.in ]; then
+ sed -i -e "1a\\" -e 'GETTEXT_PACKAGE = @GETTEXT_PACKAGE@' ${S}/po/Makefile.in.in
+ fi
+}
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-libav/libav_e500mc.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-libav/libav_e500mc.patch
new file mode 100644
index 0000000..eba4988
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-libav/libav_e500mc.patch
@@ -0,0 +1,21 @@
+diff --git a/gst-libs/ext/libav/configure b/gst-libs/ext/libav/configure
+index 8473069..4f74952 100755
+--- a/gst-libs/ext/libav/configure
++++ b/gst-libs/ext/libav/configure
+Fix gst-ffmpeg build issues for libav on e500mc (fsl-p4080)
+
+Upstream-Status: Backport
+
+Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
+
+@@ -2210,6 +2210,10 @@ elif enabled ppc; then
+ cpuflags="-mcpu=cell"
+ enable ldbrx
+ ;;
++ e500mc)
++ cpuflags="-mcpu=e500mc"
++ disable altivec
++ ;;
+ e500v2)
+ cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
+ disable altivec
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.2.3.bbappend b/common/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.2.3.bbappend
new file mode 100644
index 0000000..d55fea3
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.2.3.bbappend
@@ -0,0 +1,9 @@
+PACKAGECONFIG ??= " orc "
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += " \
+ file://libav_e500mc.patch \
+ "
+
+INSANE_SKIP_${PN} += "textrel"
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.2.3.bbappend b/common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.2.3.bbappend
new file mode 100644
index 0000000..0a0f5d9
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.2.3.bbappend
@@ -0,0 +1,21 @@
+PACKAGECONFIG ??= " \
+ ${@base_contains('DISTRO_FEATURES', 'wayland', 'wayland', '', d)} \
+ ${@base_contains('DISTRO_FEATURES', 'opengl', 'eglgles', '', d)} \
+ ${@base_contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \
+ ${@base_contains('DISTRO_FEATURES', 'directfb', 'directfb', '', d)} \
+ curl uvch264 neon \
+ hls sbc dash bz2 smoothstreaming \
+ "
+
+DEPENDS += "directfb faad2 libxml2 libuiomux libshvio"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+TARGET_CFLAGS += "-D_GNU_SOURCE"
+PACKAGECONFIG[directfb] = "--enable-directfb,--disable-directfb,directfb"
+
+PACKAGECONFIG := "${@'${PACKAGECONFIG}'.replace('curl', '')}"
+PACKAGECONFIG := "${@'${PACKAGECONFIG}'.replace('eglgles', '')}"
+PACKAGECONFIG += "faad directfb"
+
+EXTRA_OECONF += "--enable-directfb --enable-experimental --disable-nls"
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.2.3.bbappend b/common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.2.3.bbappend
new file mode 100644
index 0000000..2f46ba3
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.2.3.bbappend
@@ -0,0 +1,5 @@
+PACKAGECONFIG ??= " \
+ ${@base_contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \
+ ${@base_contains('DISTRO_FEATURES', 'alsa', 'alsa', '', d)} \
+ ivorbis ogg theora vorbis \
+ "
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.2.3.bbappend b/common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.2.3.bbappend
new file mode 100644
index 0000000..910b031
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.2.3.bbappend
@@ -0,0 +1,5 @@
+PACKAGECONFIG ??= " \
+ ${@base_contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \
+ ${@base_contains('DISTRO_FEATURES', 'pulseaudio', 'pulseaudio', '', d)} \
+ cairo flac gdk-pixbuf jpeg libpng soup speex taglib \
+ "
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0_1.2.3.bbappend b/common/recipes-multimedia/gstreamer/gstreamer1.0_1.2.3.bbappend
new file mode 100644
index 0000000..35c76f2
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0_1.2.3.bbappend
@@ -0,0 +1 @@
+PRIVATE_LIBS_${PN} = "libgstcoreelements.so"
diff --git a/common/recipes-multimedia/libomxil/libomxil_0.9.3.bbappend b/common/recipes-multimedia/libomxil/libomxil_0.9.3.bbappend
new file mode 100644
index 0000000..4829907
--- /dev/null
+++ b/common/recipes-multimedia/libomxil/libomxil_0.9.3.bbappend
@@ -0,0 +1,3 @@
+EXTRA_OECONF += "ac_cv_func_malloc_0_nonnull=yes \
+ ac_cv_func_realloc_0_nonnull=yes \
+"
diff --git a/common/recipes-multimedia/libshmeram/libshmeram/configfile-path.patch b/common/recipes-multimedia/libshmeram/libshmeram/configfile-path.patch
new file mode 100644
index 0000000..7538469
--- /dev/null
+++ b/common/recipes-multimedia/libshmeram/libshmeram/configfile-path.patch
@@ -0,0 +1,9 @@
+diff --git a/config_data/Makefile.am b/config_data/Makefile.am
+index 540990e..04becd1 100644
+--- a/config_data/Makefile.am
++++ b/config_data/Makefile.am
+@@ -1,3 +1,3 @@
+ EXTRA_DIST = meram.conf
+-configdir = $(prefix)/etc
++configdir = $(sysconfdir)
+ config_DATA = meram.conf
diff --git a/common/recipes-multimedia/libshmeram/libshmeram_0.9.4.bb b/common/recipes-multimedia/libshmeram/libshmeram_0.9.4.bb
new file mode 100644
index 0000000..be4cbf0
--- /dev/null
+++ b/common/recipes-multimedia/libshmeram/libshmeram_0.9.4.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "library for accessing the SH-Mobile MERAM"
+AUTHOR = "Damian Hobson-Garcia <dhobsong@igel.co.jp>"
+BUGTRACKER = ""
+
+SECTION = "libs"
+PRIORITY = "optional"
+
+PR = "r0"
+
+inherit autotools pkgconfig
+
+LICENSE = "LGPLv2.0+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3214f080875748938ba060314b4f727d"
+
+SRCREV = "2d9b1c32e17ddb260d592826a13fd5c8e0bdb763"
+SRC_URI = "git://github.com/renesas-devel/libshmeram.git \
+ file://configfile-path.patch \
+ "
+S = "${WORKDIR}/git/"
+
+DEPENDS = "libuiomux"
+
+do_configure() {
+ autoreconf -ivf ${S}
+ oe_runconf
+}
+
+# install to libshmeram
+FILES_${PN} += "${sysconfdir}/*"
diff --git a/common/recipes-multimedia/libshmeram/libshmeram_git.bb b/common/recipes-multimedia/libshmeram/libshmeram_git.bb
new file mode 100644
index 0000000..2d9873f
--- /dev/null
+++ b/common/recipes-multimedia/libshmeram/libshmeram_git.bb
@@ -0,0 +1,30 @@
+DESCRIPTION = "library for accessing the SH-Mobile MERAM"
+AUTHOR = "Damian Hobson-Garcia <dhobsong@igel.co.jp>"
+BUGTRACKER = ""
+
+SECTION = "libs"
+PRIORITY = "optional"
+
+PR = "r1"
+
+inherit autotools pkgconfig
+
+LICENSE = "LGPLv2.0+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3214f080875748938ba060314b4f727d"
+
+SRCREV = "c7d54646cddfc6759ef64a6c22a3ea9e2c61888c"
+SRCREV_armadillo800eva = "890bbd50e3a305a2331a4e2016ead968bdf916bb"
+SRC_URI = "git://github.com/renesas-devel/libshmeram.git \
+ file://configfile-path.patch \
+ "
+S = "${WORKDIR}/git/"
+
+DEPENDS = "libuiomux"
+
+do_configure() {
+ autoreconf -ivf ${S}
+ oe_runconf
+}
+
+# install to libshmeram
+FILES_${PN} += "${sysconfdir}/*"
diff --git a/common/recipes-multimedia/libshvio/libshvio_1.7.2.bb b/common/recipes-multimedia/libshvio/libshvio_1.7.2.bb
new file mode 100644
index 0000000..7552b62
--- /dev/null
+++ b/common/recipes-multimedia/libshvio/libshvio_1.7.2.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "A library for controlling the SH-Mobile VIO/VEU"
+AUTHOR = "Phil Edworthy <phil.edworthy@renesas.com>"
+BUGTRACKER = ""
+
+SECTION = "libs"
+PRIORITY = "optional"
+
+PR = "r0"
+
+inherit autotools pkgconfig
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=838c366f69b72c5df05c96dff79b35f2"
+
+SRCREV = "3cebf3b073c2f22c60109e345670641a77c5981f"
+SRC_URI = "git://github.com/renesas-devel/libshvio.git"
+S = "${WORKDIR}/git/"
+
+DEPENDS = "libuiomux libshmeram"
+EXTRA_OECONF = "--enable-meram"
+
+do_configure() {
+ autoreconf -ivf ${S}
+ oe_runconf
+}
diff --git a/common/recipes-multimedia/libshvio/libshvio_git.bb b/common/recipes-multimedia/libshvio/libshvio_git.bb
new file mode 100644
index 0000000..c9ad0af
--- /dev/null
+++ b/common/recipes-multimedia/libshvio/libshvio_git.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "A library for controlling the SH-Mobile VIO/VEU"
+AUTHOR = "Phil Edworthy <phil.edworthy@renesas.com>"
+BUGTRACKER = ""
+
+SECTION = "libs"
+PRIORITY = "optional"
+
+PR = "r0"
+
+inherit autotools pkgconfig
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=838c366f69b72c5df05c96dff79b35f2"
+
+SRCREV = "3cebf3b073c2f22c60109e345670641a77c5981f"
+SRC_URI = "git://github.com/renesas-devel/libshvio.git;branch=vio6"
+S = "${WORKDIR}/git/"
+
+DEPENDS = "libuiomux libshmeram"
+EXTRA_OECONF = "--enable-meram"
+
+do_configure() {
+ autoreconf -ivf ${S}
+ oe_runconf
+}
diff --git a/common/recipes-multimedia/libuiomux/libuiomux_1.7.0.bb b/common/recipes-multimedia/libuiomux/libuiomux_1.7.0.bb
new file mode 100644
index 0000000..f388e69
--- /dev/null
+++ b/common/recipes-multimedia/libuiomux/libuiomux_1.7.0.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "UIOMux is a conflict manager for system resources, including UIO devices."
+AUTHOR = "Conrad Parker <conrad@metadecks.org>"
+HOMEPAGE = "https://github.com/renesas-devel/libuiomux"
+BUGTRACKER = ""
+
+SECTION = "libs"
+PRIORITY = "optional"
+
+PR = "r0"
+
+inherit autotools pkgconfig
+
+LICENSE = "LGPLv2.0+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3214f080875748938ba060314b4f727d"
+
+SRCREV = "25df714bca0532184c0ed0ac041462743240d752"
+SRC_URI = "git://github.com/renesas-devel/libuiomux.git;protocol=git"
+S = "${WORKDIR}/git/"
+
+EXTRA_OECONF = "--with-max-map-mem=105"
+
+do_configure() {
+ autoreconf -ivf ${S}
+ oe_runconf
+}
diff --git a/common/recipes-multimedia/libuiomux/libuiomux_git.bb b/common/recipes-multimedia/libuiomux/libuiomux_git.bb
new file mode 100644
index 0000000..ca0d21b
--- /dev/null
+++ b/common/recipes-multimedia/libuiomux/libuiomux_git.bb
@@ -0,0 +1,28 @@
+DESCRIPTION = "UIOMux is a conflict manager for system resources, including UIO devices."
+AUTHOR = "Conrad Parker <conrad@metadecks.org>"
+HOMEPAGE = "https://github.com/renesas-devel/libuiomux"
+BUGTRACKER = ""
+
+SECTION = "libs"
+PRIORITY = "optional"
+
+PR = "r0"
+
+inherit autotools pkgconfig
+
+LICENSE = "LGPLv2.0+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3214f080875748938ba060314b4f727d"
+
+SRCREV = "f0197adfbf2067d886b2bceeeffd4dba396f8686"
+SRCREV_armadillo800eva = "2f40baf6c351ab49c852a43b331b080c5f4549ae"
+SRC_URI = "git://github.com/renesas-devel/libuiomux.git;protocol=git"
+S = "${WORKDIR}/git/"
+
+UIO_MAX_MAP_MEM_armadillo800eva = "128"
+EXTRA_OECONF_bockw = "--with-max-map-mem=${UIO_MAX_MAP_MEM}"
+EXTRA_OECONF_armadillo800eva = "--with-max-map-mem=${UIO_MAX_MAP_MEM}"
+
+do_configure() {
+ autoreconf -ivf ${S}
+ oe_runconf
+}
diff --git a/common/recipes-multimedia/omxil-sh/omxil-sh/0001-Removed-include-path-of-VPUMW-and-fixed-the-path-tha.patch b/common/recipes-multimedia/omxil-sh/omxil-sh/0001-Removed-include-path-of-VPUMW-and-fixed-the-path-tha.patch
new file mode 100644
index 0000000..032a286
--- /dev/null
+++ b/common/recipes-multimedia/omxil-sh/omxil-sh/0001-Removed-include-path-of-VPUMW-and-fixed-the-path-tha.patch
@@ -0,0 +1,28 @@
+From 26d17f5f9bedfc42fd3482c521ff7e492542d66a Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Tue, 25 Mar 2014 16:13:48 +0900
+Subject: [PATCH] Removed include path of VPUMW and fixed the path that refers
+ to firmware
+
+---
+ src/vpu5/Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/vpu5/Makefile.am b/src/vpu5/Makefile.am
+index f446593..d7618ce 100644
+--- a/src/vpu5/Makefile.am
++++ b/src/vpu5/Makefile.am
+@@ -8,8 +8,8 @@ endif
+
+ VPU5_LIBS = -L@VPUMW_PATH@/lib \
+ @VPU_CMN_LIBS@
+-VPU5_CFLAGS = -I@VPUMW_PATH@/include \
+- -DVPU5HG_FIRMWARE_PATH=\"@VPUMW_PATH@/lib/firmware\" \
++VPU5_CFLAGS = \
++ -DVPU5HG_FIRMWARE_PATH=\"/usr/lib/firmware\" \
+ -D$(VPU_VERSION) -D$(VPU_SERIES)
+
+ OPTIONAL_SOURCES =
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/omxil-sh/omxil-sh/0001-vpu5-avc-parse-correct-pNal-size-calculation-for-EOS.patch b/common/recipes-multimedia/omxil-sh/omxil-sh/0001-vpu5-avc-parse-correct-pNal-size-calculation-for-EOS.patch
new file mode 100644
index 0000000..ca1f494
--- /dev/null
+++ b/common/recipes-multimedia/omxil-sh/omxil-sh/0001-vpu5-avc-parse-correct-pNal-size-calculation-for-EOS.patch
@@ -0,0 +1,29 @@
+From a0e04460ec45afd25d58985c9144819c41d7ad4d Mon Sep 17 00:00:00 2001
+From: Osamu Fukushima <osamu.fukushima.wr@renesas.com>
+Date: Thu, 30 May 2013 13:29:21 +0900
+Subject: [PATCH] vpu5: avc parse: correct pNal->size calculation for EOS nal
+
+---
+ src/vpu5/shvpu5_avcdec_parse.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/vpu5/shvpu5_avcdec_parse.c b/src/vpu5/shvpu5_avcdec_parse.c
+index bd6ea18..1e529f5 100644
+--- a/src/vpu5/shvpu5_avcdec_parse.c
++++ b/src/vpu5/shvpu5_avcdec_parse.c
+@@ -396,6 +396,12 @@ parseAVCBuffer(shvpu_decode_PrivateType *shvpu_decode_Private,
+ avcparse->pPrevBuffer = pBuffer;
+ pStartSub = NULL;
+ nSizeSub = 0;
++ } else if(eos) {
++ pStartSub = NULL;
++ nSizeSub = 0;
++ pNal->splitBufferLen = 0;
++ pNal->size = nRemainSize + 1;
++ nRemainSize = 0;
+ } else {
+ pNal->size = pHead - pStart;
+ nRemainSize -= pNal->size;
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/omxil-sh/omxil-sh/vcp1-library-change.patch b/common/recipes-multimedia/omxil-sh/omxil-sh/vcp1-library-change.patch
new file mode 100644
index 0000000..15af4c4
--- /dev/null
+++ b/common/recipes-multimedia/omxil-sh/omxil-sh/vcp1-library-change.patch
@@ -0,0 +1,16 @@
+diff --git a/configure.ac b/configure.ac
+index 355289e..468f6ee 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -295,9 +295,8 @@ AS_CASE([$with_vpu5_version],
+ [VCP1],
+ [VPU_VERSION="VPU_VERSION_VCP1"
+ VPU_SERIES="VPU5HA_SERIES"
+- VPU_CMN_LIBS="-lmcvdecvcp1a_lx30 -lmciphvcp1a_lx30"
+- VPU_DEC_LIBS="-lavcdecvcp1a_lx30 -lmciphvcp1cmndeca_lx30 \
+- -lmciphvcp1avcdeca_lx30 -lmciphvcp1cmna_lx30"],
++ VPU_CMN_LIBS="-lvcp1_mciph -lvcp1_mciph_cmn -lvcp1_mciph_cmndec -lvcp1_mcvd"
++ VPU_DEC_LIBS="-lvcp1_avcd -lvcp1_mciph_avcdec"],
+ dnl default
+ [with_vpu5_version=VPU5HG
+ VPU_VERSION="VPU_VERSION_5"
diff --git a/common/recipes-multimedia/omxil-sh/omxil-sh_git.bb b/common/recipes-multimedia/omxil-sh/omxil-sh_git.bb
new file mode 100644
index 0000000..e65072b
--- /dev/null
+++ b/common/recipes-multimedia/omxil-sh/omxil-sh_git.bb
@@ -0,0 +1,70 @@
+DESCRIPTION = "A collection of OpenMAX IL components for SH-Mobile, using the \
+Bellagio OpenMAX IL project framework."
+HOMEPAGE = "https://github.com/dhobsong/omxil-sh"
+BUGTRACKER = "https://github.com/dhobsong/omxil-sh"
+SECTION = "multimedia"
+
+LICENSE = "LGPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=2d5025d4aa3495befef8f17206a5b0a1"
+
+PR = "r3"
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRCREV = "af89fcc030e3e5f82ce669fdfea2af105a73cf87"
+SRC_URI = "git://github.com/dhobsong/omxil-sh.git \
+ file://0001-vpu5-avc-parse-correct-pNal-size-calculation-for-EOS.patch \
+ file://0001-Removed-include-path-of-VPUMW-and-fixed-the-path-tha.patch \
+"
+DEPENDS = "libomxil libuiomux"
+S = "${WORKDIR}/git"
+
+# for armadillo800eva
+SRCREV_armadillo800eva = "bd43cfba750773cd323fb546f279e76b37c6d713"
+SRC_URI_append_armadillo800eva = " file://vcp1-library-change.patch"
+CHECK_OMXIL_SH_MW = "${USE_RENESAS_MW_VCP1}"
+CHECK_OMXIL_SH_MW += "${USE_RENESAS_MW_VPU5}"
+DEPENDS_append_armadillo800eva = ' ${@base_contains("CHECK_OMXIL_SH_MW", "1", "vcp1", "", d)}'
+
+inherit autotools pkgconfig
+
+VPUMW_PATH = "/usr/"
+
+EXTRA_OECONF = "--with-vpumw-path=${VPUMW_PATH} \
+ --enable-tl_conv=kernel \
+ --enable-tl_conv_internal \
+ --with-vpu5_version=VCP1 \
+ --disable-vpu5_encoder \
+ --disable-meram \
+ --enable-vpc \
+"
+
+do_configure() {
+ autoreconf -vif
+ oe_runconf
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+ ${PN}-staticdev \
+"
+
+# need *.so, these are used by omx.
+INSANE_SKIP_${PN} = "dev-so"
+FILES_${PN} += " \
+ ${libdir}/bellagio/*.so.* \
+ ${libdir}/bellagio/*.so \
+"
+
+FILES_${PN}-dev += " \
+ ${libdir}/bellagio/*.la \
+"
+
+FILES_${PN}-staticdev = " \
+ ${libdir}/bellagio/*.a \
+"
+
+#FILES_${PN}-dbg += " \
+# ${libdir}/bellagio/.debug/* \
+#"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/common/recipes-multimedia/v4l2apps/media-ctl_git.bbappend b/common/recipes-multimedia/v4l2apps/media-ctl_git.bbappend
new file mode 100644
index 0000000..479cce7
--- /dev/null
+++ b/common/recipes-multimedia/v4l2apps/media-ctl_git.bbappend
@@ -0,0 +1,4 @@
+SRCREV = "114c1b274edc40e07e9b99a435d26438f5b99943"
+DEPENDS = "virtual/kernel"
+PV = "0.0.1+git${SRCPV}"
+PR = "r4"
diff --git a/conf/layer.conf b/conf/layer.conf
new file mode 100644
index 0000000..ecc7647
--- /dev/null
+++ b/conf/layer.conf
@@ -0,0 +1,10 @@
+# We have a conf and classes directory, append to BBPATH
+BBPATH .= ":${LAYERDIR}"
+
+# We have a recipes directory, add to BBFILES
+BBFILES += "${LAYERDIR}/common/recipes-*/*/*.bb \
+ ${LAYERDIR}/common/recipes-*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "renesas"
+BBFILE_PATTERN_renesas := "^${LAYERDIR}/"
+BBFILE_PRIORITY_renesas = "5"
diff --git a/conf/machine/include/renesas-default-providers.inc b/conf/machine/include/renesas-default-providers.inc
new file mode 100644
index 0000000..93583b8
--- /dev/null
+++ b/conf/machine/include/renesas-default-providers.inc
@@ -0,0 +1,4 @@
+# Renesas BSP default providers
+
+IMAGE_DEVICE_TABLES = "files/device_table-minimal.txt \
+ files/device_table_add-renesas.txt"
diff --git a/files/device_table_add-renesas.txt b/files/device_table_add-renesas.txt
new file mode 100644
index 0000000..07fe33c
--- /dev/null
+++ b/files/device_table_add-renesas.txt
@@ -0,0 +1,11 @@
+#<path> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
+#/dev/mem c 640 0 0 1 1 0 0 -
+#
+#type can be one of:
+# f A regular file
+# d Directory
+# c Character special device file
+# b Block special device file
+# p Fifo (named pipe)
+
+/dev/ttySC c 640 0 5 204 8 0 1 4
diff --git a/meta-rcar-gen2/COPYING.MIT b/meta-rcar-gen2/COPYING.MIT
new file mode 100644
index 0000000..89de354
--- /dev/null
+++ b/meta-rcar-gen2/COPYING.MIT
@@ -0,0 +1,17 @@
+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.
+
+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. 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-gen2/README b/meta-rcar-gen2/README
new file mode 100644
index 0000000..dc5d184
--- /dev/null
+++ b/meta-rcar-gen2/README
@@ -0,0 +1,67 @@
+meta-rcar-gen2
+===========
+
+This layer provides that evaluation board is mounted ARM SoCs of Renesas
+Electronics, called the R-Car Generation 2. Currently, this supports
+board and the SoCs of the following:
+ - Board: lager / SoC: R8A7790 (R-Car H2)
+ - Board: koelsch / SoC: R8A7791 (R-Car M2-W)
+ - Board: gose / SoC: R8A7793 (R-Car M2-N)
+ - Board: alt / SoC: R8A7794 (R-Car E2)
+
+Patches
+=======
+
+Please submit any patches for this layer to: nobuhiro.iwamatsu.yj@renesas.com
+Please see the MAINTAINERS file for more details.
+
+Dependencies
+============
+
+This layer depends on:
+
+ URI: git://git.yoctoproject.org/poky
+ layers: meta, meta-yocto, meta-yocto-bsp
+ branch: master
+
+ URI: git://git.yoctoproject.org/meta-renesas
+ layers: renesas
+ branch: master
+
+Build Instructions
+==================
+
+The following instructions require a Poky installation (or equivalent).
+
+Initialize a build using the 'oe-init-build-env' script in Poky. Once
+initialized configure bblayers.conf by adding the meta-renesas and
+meta-rcar-gen2 layer. e.g.:
+
+ BBLAYERS ?= " \
+ <path to layer>/poky/meta \
+ <path to layer>/poky/meta-yocto \
+ <path to layer>/poky/meta-yocto-bsp \
+ <path to layer>/meta-renesas \
+ <path to layer>/meta-renesas/meta-rcar-gen2 \
+ "
+
+To build a specific target BSP configure the associated machine in local.conf:
+
+ MACHINE ?= "<supported board name>"
+
+Build the target file system image using bitbake:
+
+ $ bitbake core-image-minimal
+
+Once complete the images for the target machine will be available in the output
+directory 'tmp/deploy/images/<supported board name>'.
+
+Images generated:
+ * uImage (Linux Kernel binary, in u-boot wrapped format)
+ * uImage+dtb (Linux Kernel binary with DTB, in u-boot wrapped format)
+ * zImage (Linux Kernel binary)
+ * zImage+dtb (Linux Kernel binary with DTB)
+ * uImage-<SoC namme>-<machine name>.dtb (DTB for target machine)
+ * core-image-minimal-<machine name>.tar.bz2 (rootfs tar+bzip2)
+ * core-image-minimal-<machine name>.jffs2 (rootfs in JFFS2 format)
+ * u-boot.bin (U-Boot binary)
diff --git a/meta-rcar-gen2/README.proprietary b/meta-rcar-gen2/README.proprietary
new file mode 100644
index 0000000..0da8afe
--- /dev/null
+++ b/meta-rcar-gen2/README.proprietary
@@ -0,0 +1,170 @@
+Proprietary libraries for meta-rcar-gen2
+========================================
+
+The meta-rcar-gen2 of meta-renesas is supported GLES(RGX and SGX) libraries
+for x11 and Weston, and proprietary library of multimedia. This README describes
+how to use these features and setting to local.conf.
+There are 4 main paths:
+ I/ Board configuration
+ II/ Build with or without GLES
+ III/ Build with Renesas multimedia libraries
+ IV/ Configuration for unmasking packages
+
+The default package is without GLES and including multimedia feature with H264 decoder.
+Therefore, please check section II to config for GLES,
+And check section III for configuration of optional multimedia packages.
+
+In addition, these binaries are not provided at the recipes. If you want to use,
+you will need to get from Renesas.
+
+I/ Board configuration
+==================
+* Please add this line to local.conf depending on your board
+ A. For Lager board
+ MACHINE ??= "lager"
+ B. For Koelsch board
+ MACHINE ??= "koelsch"
+ C. For Gose board
+ MACHINE ??= "gose"
+ D. For Alt board
+ MACHINE ??= "alt"
+
+II/ Build with or without GLES
+==================
+ A/ Build with GLES
+ * For wayland with rgx/sgx
+
+ 1. Please copy proprietary libraries to the directory of recipes.
+ 2. Please set local.conf the following.
+ Step 1: Adding features and preferred providers:
+
+ MACHINE_FEATURES_append = " sgx"
+ MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2"
+ PREFERRED_PROVIDER_virtual/libgles1 = ""
+ PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module"
+ PREFERRED_PROVIDER_virtual/egl = "libegl"
+ PREFERRED_PROVIDER_virtual/libgl = ""
+ PREFERRED_PROVIDER_virtual/mesa = ""
+ PREFERRED_PROVIDER_libgbm = "libgbm"
+ PREFERRED_PROVIDER_libgbm-dev = "libgbm"
+
+ NOTE: The r8a7790 uses rgx, r8a7791, r8a7793 and r8a7794 uses sgx.
+ If you want to use rgx, please set to 'rgx' instead of 'sgx'.
+ For r8a7790, if you want to use OPENGLES3,
+ Please set following in local.conf (default is OPENGLES2)
+ OPENGLES3 = "1"
+ Step 2: Unmask the graphic recipes
+
+ #BBMASK .= "|gles-kernel-module|gles-user-module"
+
+ 3. Please run 'bitbake core-image-weston'
+
+ * For X11 with rgx/sgx
+ 1. Please copy proprietary libraries to the directory of recipes.
+ 2. Please set local.conf the following.
+ Step 1: Adding features and preferred providers:
+
+ MACHINE_FEATURES_append = " sgx"
+ MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2"
+ PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module"
+ PREFERRED_PROVIDER_virtual/egl = "gles-user-module"
+ DISTRO_FEATURES_remove = "wayland"
+ BBMASK .= "|libegl|libgbm|wayland-kms"
+
+ NOTE: The r8a7790 uses rgx, r8a7791, r8a7793 and r8a7794 uses sgx.
+ If you want to use rgx, please set to 'rgx' instead of 'sgx'.
+ For r8a7790, if you want to use OPENGLES3,
+ Please set following in local.conf (default is OPENGLES2)
+ OPENGLES3 = "1"
+ Step 2: Unmask the graphic recipes
+
+ #BBMASK .= "|gles-kernel-module|gles-user-module"
+
+ 3. Please run 'bitbake core-image-x11'
+
+ B/ Build without GLES
+ * For X11 without rgx/sgx
+ 1. Please copy proprietary libraries to the directory of recipes.
+ 2. Please set local.conf the following.
+
+ DISTRO_FEATURES_remove = "wayland"
+ BBMASK .= "|libegl|libgbm|wayland-kms"
+
+ If you need to install multimedia packages.
+ Please check section of 'Build with Renesas multimedia libraries'.
+
+III/ Build with Renesas multimedia libraries
+============================================
+ A/ Configuration for Multimedia and DTV features
+ 1. Please copy proprietary libraries to the directory of recipes.
+ 2. Please set local.conf the following.
+
+ # For multimedia feature
+ This provides package group of plug-ins of the GStreamer, multimedia
+ libraries and kernel drivers.
+
+ MACHINE_FEATURES_append = " multimedia"
+
+ # For DTV feature
+ This provides package group of dtv libraries with packagegroup-rcar-gen2-multimedia.
+ Step 1 : Adding MACHINE_FEATURES
+
+ MACHINE_FEATURES_append = " dtv"
+
+ Step 2: Unmask dtv recipes
+
+ #BBMASK .= "|dtv-module|ssp-module|scu-module"
+
+ B/ Configuration for optional codecs and middleware
+ 1. Please copy proprietary libraries to the directory of recipes.
+ 2. Add features to DISTRO_FEATURES_append to local.conf
+ # Additional configuration in OMX module
+ " h263dec_lib" - for OMX Media Component H263 Decoder Library
+ " vc1dec_lib" - for OMX Media Component VC-1 Decoder Library
+ " mpeg4dec_lib" - for OMX Media Component MPEG-4 Decoder Library
+ " mpeg2dec_lib" - for VCP3 Driver Adapted for Linux MPEG-2 Decoder Library
+ " divxdec_lib" - for DivX Decoder Library for Linux
+ " h264avcenc_lib" - for Encoder Library for Linux
+
+ # Configuration for audio decoders
+ " aacp2dec_lib" - for ARM 5.1ch aacPlus V2 Decoder for Linux
+ " mp3dec_lib" - for ARM MP3 Decoder for Linux
+ " wmadec_lib" - for ARM WMA Decoder for Linux
+ " ddddec_lib" - for ARM 5.1ch Dolby Digital Decoder for Linux
+ " alacdec_lib" - for ARM ALAC Decoder for Linux
+ " flacdec_lib" - for ARM FLAC Decoder for Linux
+ " aacenc_lib" - for ARM AAC Encoder for Linux
+
+ # Configuration for audio middlewares
+ " armaccp2dec_mdw" - for ARM 5.1ch aacPlus V2 Decode Middleware for Linux
+ " mp3dec_mdw" - for ARM MP3 Decode Middleware for Linux
+ " wmadec_mdw" - for ARM WMA Decode Middleware for Linux
+ " ddddec_mdw" - for ARM 5.1ch Dolby Digital Decode Middleware for Linux
+ " alacdec_mdw" - for ARM ALAC Decode Middleware for Linux
+ " flacdec_mdw" - for ARM FLAC Decode Middleware for Linux
+ " aacenc_mdw" - for ARM AAC Encode Middleware for Linux
+ Ex:
+
+ DISTRO_FEATURES_append = " mp3dec_lib wmadec_lib mp3dec_mdw wmadec_mdw"
+
+ C/ Configuration for test packages
+ 1. Please copy proprietary libraries to the directory of recipes.
+ 2. Add features to DISTRO_FEATURES_append to local.conf
+
+ # Configuration for multimedia test package
+ Step 1 : Adding DISTRO_FEATURES
+
+ DISTRO_FEATURES_append = " mm-test"
+
+ Step 2: Unmask multimedia test recipes
+
+ #BBMASK .= "|${BB_MULTIMEDIA_TEST_MODULE}"
+
+ # Configuration for gles test package
+ Step 1 : Adding DISTRO_FEATURES
+
+ DISTRO_FEATURES_append = " gles-test"
+
+ Step 2: Unmask gles test recipes
+
+ #BBMASK .= "|gles-test-module"
diff --git a/meta-rcar-gen2/binary/.gitignore b/meta-rcar-gen2/binary/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/binary/.gitignore
diff --git a/meta-rcar-gen2/conf/layer.conf b/meta-rcar-gen2/conf/layer.conf
new file mode 100644
index 0000000..3a60113
--- /dev/null
+++ b/meta-rcar-gen2/conf/layer.conf
@@ -0,0 +1,10 @@
+# We have a conf and classes directory, add to BBPATH
+BBPATH .= ":${LAYERDIR}"
+
+# We have a recipes-* directories, add to BBFILES
+BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
+ ${LAYERDIR}/recipes-*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "rcar-gen2"
+BBFILE_PATTERN_rcar-gen2 = "^${LAYERDIR}/"
+BBFILE_PRIORITY_rcar-gen2 = "6"
diff --git a/meta-rcar-gen2/conf/machine/alt.conf b/meta-rcar-gen2/conf/machine/alt.conf
new file mode 100644
index 0000000..68ba918
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/alt.conf
@@ -0,0 +1,29 @@
+#@TYPE: Machine
+#@NAME: alt
+#@DESCRIPTION: Machine configuration for alt systems
+
+require conf/machine/include/r8a7794.inc
+require conf/machine/include/rcar-gen2-providers.inc
+
+MACHINE_EXTRA_RRECOMMENDS = " kernel-modules"
+
+IMAGE_FSTYPES += "tar.bz2"
+
+SERIAL_CONSOLE = "38400 ttySC10"
+
+KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/r8a7794-alt.dts"
+
+KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
+
+UBOOT_MACHINE = "alt_config"
+UBOOT_ENTRYPOINT = "0x40008000"
+UBOOT_LOADADDRESS = "0x40007fc0"
+
+PREFERRED_VERSION_linux-renesas = "3.10%"
+PREFERRED_VERSION_linux-libc-headers = "3.10%"
+PREFERRED_VERSION_nativesdk-linux-libc-headers = "3.10%"
+PREFERRED_VERSION_u-boot = "v2013.01%"
+PREFERRED_VERSION_libdrm = "2.4.45%"
+
+MACHINE_FEATURES = "apm usbgadget usbhost vfat alsa ethernet"
+
diff --git a/meta-rcar-gen2/conf/machine/gose.conf b/meta-rcar-gen2/conf/machine/gose.conf
new file mode 100644
index 0000000..16ca03f
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/gose.conf
@@ -0,0 +1,28 @@
+#@TYPE: Machine
+#@NAME: gose
+#@DESCRIPTION: Machine configuration for gose systems
+
+require conf/machine/include/r8a7793.inc
+require conf/machine/include/rcar-gen2-providers.inc
+
+MACHINE_EXTRA_RRECOMMENDS = " kernel-modules"
+
+IMAGE_FSTYPES += "tar.bz2"
+
+SERIAL_CONSOLE = "38400 ttySC6"
+
+KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/r8a7793-gose.dts"
+
+KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
+
+UBOOT_MACHINE = "gose_config"
+UBOOT_ENTRYPOINT = "0x40008000"
+UBOOT_LOADADDRESS = "0x40007fc0"
+
+PREFERRED_VERSION_linux-renesas = "3.10%"
+PREFERRED_VERSION_linux-libc-headers = "3.10%"
+PREFERRED_VERSION_nativesdk-linux-libc-headers = "3.10%"
+PREFERRED_VERSION_u-boot = "v2013.01%"
+PREFERRED_VERSION_libdrm = "2.4.45%"
+
+ACHINE_FEATURES = "apm usbgadget usbhost vfat alsa ethernet"
diff --git a/meta-rcar-gen2/conf/machine/include/r8a7790.inc b/meta-rcar-gen2/conf/machine/include/r8a7790.inc
new file mode 100644
index 0000000..f99d65d
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/include/r8a7790.inc
@@ -0,0 +1,12 @@
+SOC_FAMILY = "rcar-gen2:r8a7790"
+require conf/machine/include/soc-family.inc
+DEFAULTTUNE ?= "cortexa15hf-neon"
+require conf/machine/include/tune-cortexa15.inc
+
+PREFERRED_PROVIDER_virtual/kernel ?= "linux-renesas"
+PREFERRED_PROVIDER_linux-libc-headers ?= "linux-libc-headers"
+PREFERRED_PROVIDER_nativesdk-linux-libc-headers ?= "nativesdk-linux-libc-headers"
+PREFERRED_PROVIDER_u-boot ?= "u-boot"
+
+KERNEL_IMAGETYPE ?= "uImage"
+EXTRA_IMAGEDEPENDS += "u-boot"
diff --git a/meta-rcar-gen2/conf/machine/include/r8a7791.inc b/meta-rcar-gen2/conf/machine/include/r8a7791.inc
new file mode 100644
index 0000000..d831024
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/include/r8a7791.inc
@@ -0,0 +1,12 @@
+SOC_FAMILY = "rcar-gen2:r8a7791"
+require conf/machine/include/soc-family.inc
+DEFAULTTUNE ?= "cortexa15hf-neon"
+require conf/machine/include/tune-cortexa15.inc
+
+PREFERRED_PROVIDER_virtual/kernel ?= "linux-renesas"
+PREFERRED_PROVIDER_linux-libc-headers ?= "linux-libc-headers"
+PREFERRED_PROVIDER_nativesdk-linux-libc-headers ?= "nativesdk-linux-libc-headers"
+PREFERRED_PROVIDER_u-boot ?= "u-boot"
+
+KERNEL_IMAGETYPE ?= "uImage"
+EXTRA_IMAGEDEPENDS += "u-boot"
diff --git a/meta-rcar-gen2/conf/machine/include/r8a7793.inc b/meta-rcar-gen2/conf/machine/include/r8a7793.inc
new file mode 100644
index 0000000..04c34bb
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/include/r8a7793.inc
@@ -0,0 +1,12 @@
+SOC_FAMILY = "rcar-gen2:r8a7793"
+require conf/machine/include/soc-family.inc
+DEFAULTTUNE ?= "cortexa15hf-neon"
+require conf/machine/include/tune-cortexa15.inc
+
+PREFERRED_PROVIDER_virtual/kernel ?= "linux-renesas"
+PREFERRED_PROVIDER_linux-libc-headers ?= "linux-libc-headers"
+PREFERRED_PROVIDER_nativesdk-linux-libc-headers ?= "nativesdk-linux-libc-headers"
+PREFERRED_PROVIDER_u-boot ?= "u-boot"
+
+KERNEL_IMAGETYPE ?= "uImage"
+EXTRA_IMAGEDEPENDS += "u-boot"
diff --git a/meta-rcar-gen2/conf/machine/include/r8a7794.inc b/meta-rcar-gen2/conf/machine/include/r8a7794.inc
new file mode 100644
index 0000000..1213953
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/include/r8a7794.inc
@@ -0,0 +1,12 @@
+SOC_FAMILY = "rcar-gen2:r8a7794"
+require conf/machine/include/soc-family.inc
+DEFAULTTUNE ?= "cortexa7hf-neon"
+require conf/machine/include/tune-cortexa7.inc
+
+PREFERRED_PROVIDER_virtual/kernel ?= "linux-renesas"
+PREFERRED_PROVIDER_linux-libc-headers ?= "linux-libc-headers"
+PREFERRED_PROVIDER_nativesdk-linux-libc-headers ?= "nativesdk-linux-libc-headers"
+PREFERRED_PROVIDER_u-boot ?= "u-boot"
+
+KERNEL_IMAGETYPE ?= "uImage"
+EXTRA_IMAGEDEPENDS += "u-boot"
diff --git a/meta-rcar-gen2/conf/machine/include/rcar-gen2-providers.inc b/meta-rcar-gen2/conf/machine/include/rcar-gen2-providers.inc
new file mode 100644
index 0000000..9258ab4
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/include/rcar-gen2-providers.inc
@@ -0,0 +1,8 @@
+# Configure for using linaro toolchain
+PREFERRED_VERSION_gcc-cross = "linaro-4.8"
+PREFERRED_VERSION_gcc-cross-initial = "linaro-4.8"
+PREFERRED_VERSION_gcc-cross-intermediate = "linaro-4.8"
+PREFERRED_VERSION_gcc-crosssdk = "linaro-4.8"
+PREFERRED_VERSION_gcc-crosssdk-initial = "linaro-4.8"
+PREFERRED_VERSION_gcc-crosssdk-intermediate = "linaro-4.8"
+PREFERRED_VERSION_gcc-cross-canadian-${TRANSLATED_TARGET_ARCH} = "linaro-4.8"
diff --git a/meta-rcar-gen2/conf/machine/koelsch.conf b/meta-rcar-gen2/conf/machine/koelsch.conf
new file mode 100644
index 0000000..00431f2
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/koelsch.conf
@@ -0,0 +1,28 @@
+#@TYPE: Machine
+#@NAME: koelsch
+#@DESCRIPTION: Machine configuration for koelsch systems
+
+require conf/machine/include/r8a7791.inc
+require conf/machine/include/rcar-gen2-providers.inc
+
+MACHINE_EXTRA_RRECOMMENDS = " kernel-modules"
+
+IMAGE_FSTYPES += "tar.bz2"
+
+SERIAL_CONSOLE = "38400 ttySC6"
+
+KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/r8a7791-koelsch.dts"
+
+KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
+
+UBOOT_MACHINE = "koelsch_config"
+UBOOT_ENTRYPOINT = "0x40008000"
+UBOOT_LOADADDRESS = "0x40007fc0"
+
+PREFERRED_VERSION_linux-renesas = "3.10%"
+PREFERRED_VERSION_linux-libc-headers = "3.10%"
+PREFERRED_VERSION_nativesdk-linux-libc-headers = "3.10%"
+PREFERRED_VERSION_u-boot = "v2013.01%"
+PREFERRED_VERSION_libdrm = "2.4.45%"
+
+MACHINE_FEATURES = "apm usbgadget usbhost vfat alsa ethernet"
diff --git a/meta-rcar-gen2/conf/machine/lager.conf b/meta-rcar-gen2/conf/machine/lager.conf
new file mode 100644
index 0000000..fd83319
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/lager.conf
@@ -0,0 +1,28 @@
+#@TYPE: Machine
+#@NAME: lager
+#@DESCRIPTION: Machine configuration for lager systems
+
+require conf/machine/include/r8a7790.inc
+require conf/machine/include/rcar-gen2-providers.inc
+
+MACHINE_EXTRA_RRECOMMENDS = " kernel-modules"
+
+IMAGE_FSTYPES += "tar.bz2"
+
+SERIAL_CONSOLE = "38400 ttySC6"
+
+KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/r8a7790-lager.dts"
+
+KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
+
+UBOOT_MACHINE = "lager_config"
+UBOOT_ENTRYPOINT = "0x40008000"
+UBOOT_LOADADDRESS = "0x40007fc0"
+
+PREFERRED_VERSION_linux-renesas = "3.10%"
+PREFERRED_VERSION_linux-libc-headers = "3.10%"
+PREFERRED_VERSION_nativesdk-linux-libc-headers = "3.10%"
+PREFERRED_VERSION_u-boot = "v2013.01%"
+PREFERRED_VERSION_libdrm = "2.4.45%"
+
+MACHINE_FEATURES = "apm usbgadget usbhost vfat alsa ethernet"
diff --git a/meta-rcar-gen2/conf/machine/porter.conf b/meta-rcar-gen2/conf/machine/porter.conf
new file mode 100644
index 0000000..ed4ed95
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/porter.conf
@@ -0,0 +1,28 @@
+#@TYPE: Machine
+#@NAME: porter
+#@DESCRIPTION: Machine configuration for porter systems
+
+require conf/machine/include/r8a7791.inc
+require conf/machine/include/rcar-gen2-providers.inc
+
+MACHINE_EXTRA_RRECOMMENDS = " kernel-modules"
+
+IMAGE_FSTYPES += "tar.bz2"
+
+SERIAL_CONSOLE = "38400 ttySC6"
+
+KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/r8a7791-porter.dts"
+
+KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
+
+UBOOT_MACHINE = "porter_config"
+UBOOT_ENTRYPOINT = "0x40008000"
+UBOOT_LOADADDRESS = "0x40007fc0"
+
+PREFERRED_VERSION_linux-renesas = "3.10%"
+PREFERRED_VERSION_linux-libc-headers = "3.10%"
+PREFERRED_VERSION_nativesdk-linux-libc-headers = "3.10%"
+PREFERRED_VERSION_u-boot = "v2013.01%"
+PREFERRED_VERSION_libdrm = "2.4.45%"
+
+MACHINE_FEATURES = "apm usbgadget usbhost vfat alsa ethernet"
diff --git a/meta-rcar-gen2/conf/machine/silk.conf b/meta-rcar-gen2/conf/machine/silk.conf
new file mode 100644
index 0000000..1499f74
--- /dev/null
+++ b/meta-rcar-gen2/conf/machine/silk.conf
@@ -0,0 +1,28 @@
+#@TYPE: Machine
+#@NAME: silk
+#@DESCRIPTION: Machine configuration for silk systems
+
+require conf/machine/include/r8a7794.inc
+require conf/machine/include/rcar-gen2-providers.inc
+
+MACHINE_EXTRA_RRECOMMENDS = " kernel-modules"
+
+IMAGE_FSTYPES += "tar.bz2"
+
+SERIAL_CONSOLE = "38400 ttySC10"
+
+KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/r8a7794-silk.dts"
+
+KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
+
+UBOOT_MACHINE = "silk_config"
+UBOOT_ENTRYPOINT = "0x40008000"
+UBOOT_LOADADDRESS = "0x40007fc0"
+
+PREFERRED_VERSION_linux-renesas = "3.10%"
+PREFERRED_VERSION_linux-libc-headers = "3.10%"
+PREFERRED_VERSION_nativesdk-linux-libc-headers = "3.10%"
+PREFERRED_VERSION_u-boot = "v2013.01%"
+PREFERRED_VERSION_libdrm = "2.4.45%"
+
+MACHINE_FEATURES = "apm usbgadget usbhost vfat alsa ethernet"
diff --git a/meta-rcar-gen2/include/gles-control.inc b/meta-rcar-gen2/include/gles-control.inc
new file mode 100644
index 0000000..8b21985
--- /dev/null
+++ b/meta-rcar-gen2/include/gles-control.inc
@@ -0,0 +1,6 @@
+USE_GLES = "${@'1' if 'rgx' in '${MACHINE_FEATURES}' or 'sgx' in '${MACHINE_FEATURES}' else '0'}"
+USE_WAYLAND = "${@'1' if 'wayland' in '${DISTRO_FEATURES}' else '0'}"
+USE_GLES_WAYLAND = "${@'1' if '${USE_GLES}' == '1' and '${USE_WAYLAND}' == '1' else '0'}"
+USE_X11 = "${@'1' if 'x11' in '${DISTRO_FEATURES}' else '0'}"
+USE_GLES_X11 = "${@'1' if '1' in '${USE_GLES}' and '${USE_X11}' == '1' and '${USE_WAYLAND}' == '0' else '0'}"
+USE_GLES_TEST = "${@'1' if '${USE_GLES}' == '1' and 'gles-test' in '${DISTRO_FEATURES}' else '0'}"
diff --git a/meta-rcar-gen2/include/multimedia-control.inc b/meta-rcar-gen2/include/multimedia-control.inc
new file mode 100644
index 0000000..3a535ba
--- /dev/null
+++ b/meta-rcar-gen2/include/multimedia-control.inc
@@ -0,0 +1,3 @@
+USE_DTV = "${@'1' if 'dtv' in '${MACHINE_FEATURES}' else '0'}"
+USE_MULTIMEDIA = "${@'1' if 'multimedia' in '${MACHINE_FEATURES}' or '${USE_DTV}' == '1' else '0'}"
+USE_MULTIMEDIA_TEST = "${@'1' if 'mm-test' in '${DISTRO_FEATURES}' and '${USE_MULTIMEDIA}' == '1' else '0'}"
diff --git a/meta-rcar-gen2/include/omx-components-control.inc b/meta-rcar-gen2/include/omx-components-control.inc
new file mode 100644
index 0000000..7848262
--- /dev/null
+++ b/meta-rcar-gen2/include/omx-components-control.inc
@@ -0,0 +1,78 @@
+## Additional configuration in OMX module, include
+# USE_H263_DECODER for OMX Media Component H263 Decoder Library, default is DISABLE (0)
+# USE_VC1_DECODER for OMX Media Component VC-1 Decoder Library, default is DISABLE (0)
+# USE_MPEG4_DECODER for OMX Media Component MPEG-4 Decoder Library, default is DISABLE (0)
+# USE_MPEG2_DECODER for VCP3 Driver Adapted for Linux MPEG-2 Decoder Library, default is DISABLE (0)
+# USE_DIVX_DECODER for DivX Decoder Library for Linux, default is DISABLE (0)
+USE_H263_DECODER = "${@'1' if 'h263dec_lib' in '${DISTRO_FEATURES}' else '0'}"
+USE_VC1_DECODER = "${@'1' if 'vc1dec_lib' in '${DISTRO_FEATURES}' else '0'}"
+USE_MPEG2_DECODER = "${@'1' if 'mpeg2dec_lib' in '${DISTRO_FEATURES}' else '0'}"
+USE_MPEG4_DECODER = "${@'1' if 'mpeg4dec_lib' in '${DISTRO_FEATURES}' else '0'}"
+USE_DIVX_DECODER = "${@'1' if 'divxdec_lib' in '${DISTRO_FEATURES}' else '0'}"
+
+## Config to build H264AVC encoder
+USE_H264AVC_ENCODER = "${@'1' if 'h264avcenc_lib' in '${DISTRO_FEATURES}' else '0'}"
+
+## Config for audio decoders
+#USE_AACP2_DECODER for ARM 5.1ch aacPlus V2 Decoder for Linux
+#USE_MP3_DECODER for ARM MP3 Decoder for Linux
+#USE_WMA_DECODER for ARM WMA Decoder for Linux
+#USE_DDD_DECODER for ARM 5.1ch Dolby Digital Decoder for Linux
+#USE_ALAC_DECODER for ARM ALAC Decoder for Linux
+#USE_FLAC_DECODER for ARM FLAC Decoder for Linux
+USE_AACP2_DECODER = "${@'1' if 'aacp2dec_lib' in '${DISTRO_FEATURES}' else '0'}"
+USE_MP3_DECODER = "${@'1' if 'mp3dec_lib' in '${DISTRO_FEATURES}' else '0'}"
+USE_WMA_DECODER = "${@'1' if 'wmadec_lib' in '${DISTRO_FEATURES}' else '0'}"
+USE_DDD_DECODER = "${@'1' if 'ddddec_lib' in '${DISTRO_FEATURES}' else '0'}"
+USE_ALAC_DECODER = "${@'1' if 'alacdec_lib' in '${DISTRO_FEATURES}' else '0'}"
+USE_FLAC_DECODER = "${@'1' if 'flacdec_lib' in '${DISTRO_FEATURES}' else '0'}"
+
+## Config for audio encoders
+# USE_AAC_ENCODER for ARM AAC Encoder for Linux
+USE_AAC_ENCODER = "${@'1' if 'aacenc_lib' in '${DISTRO_FEATURES}' else '0'}"
+
+# Config for audio middlewares
+# USE_ARMAACP2_MDW_DECODER for ARM 5.1ch aacPlus V2 Decode Middleware for Linux
+# USE_MP3_MDW_DECODER for ARM MP3 Decode Middleware for Linux
+# USE_WMA_MDW_DECODER for ARM WMA Decode Middleware for Linux
+# USE_DDD_MDW_DECODER for ARM 5.1ch Dolby Digital Decode Middleware for Linux
+# USE_ALAC_MDW_DECODER for ARM ALAC Decode Middleware for Linux
+# USE_FLAC_MDW_DECODER for ARM FLAC Decode Middleware for Linux
+USE_ARMAACP2_MDW_DECODER = "${@'1' if 'armaccp2dec_mdw' in '${DISTRO_FEATURES}' else '0'}"
+USE_MP3_MDW_DECODER = "${@'1' if 'mp3dec_mdw' in '${DISTRO_FEATURES}' else '0'}"
+USE_WMA_MDW_DECODER = "${@'1' if 'wmadec_mdw' in '${DISTRO_FEATURES}' else '0'}"
+USE_DDD_MDW_DECODER = "${@'1' if 'ddddec_mdw' in '${DISTRO_FEATURES}' else '0'}"
+USE_ALAC_MDW_DECODER = "${@'1' if 'alacdec_mdw' in '${DISTRO_FEATURES}' else '0'}"
+USE_FLAC_MDW_DECODER = "${@'1' if 'flacdec_mdw' in '${DISTRO_FEATURES}' else '0'}"
+##
+# USE_AAC_MDW_ENCODER for ARM AAC Encode Middleware for Linux
+USE_AAC_MDW_ENCODER = "${@'1' if 'aacenc_mdw' in '${DISTRO_FEATURES}' else '0'}"
+
+#############################################################
+##### Below part is auto dependent functions,
+##### user don't touch below part
+#############################################################
+# Config for audio common omx
+AUDIO_DECODER_ARRAY = "${USE_AACP2_DECODER}"
+AUDIO_DECODER_ARRAY += "${USE_MP3_DECODER}"
+AUDIO_DECODER_ARRAY += "${USE_WMA_DECODER}"
+AUDIO_DECODER_ARRAY += "${USE_DDD_DECODER}"
+AUDIO_DECODER_ARRAY += "${USE_ALAC_DECODER}"
+AUDIO_DECODER_ARRAY += "${USE_FLAC_DECODER}"
+AUDIO_ENCODER_ARRAY = "${USE_AAC_ENCODER}"
+USE_AUDIO_COMMON = "${@'1' if '1' in '${AUDIO_ENCODER_ARRAY}' or '1' in '${AUDIO_DECODER_ARRAY}' else '0' }"
+
+# Auto config for video common encoder. It will enable when there is at least 1 encoder is enabled.
+# Please add new encoder config into list when have new encoder (e.g. as RESERVE_ENCODER_CONF)
+VIDEO_ENCODER_ARRAY = "${USE_H264AVC_ENCODER}"
+#VIDEO_ENCODER_ARRAY += "${RESERVE_ENCODER_CONF}"
+USE_VIDEO_COMMON_ENCODER = '${@base_contains("VIDEO_ENCODER_ARRAY", "1", "1", "0", d)}'
+
+# Audio codec config
+ARMAACP2_MDW_DECODER = '${@base_conditional("USE_AACP2_DECODER", "1", "1", "${USE_ARMAACP2_MDW_DECODER}", d)}'
+MP3_MDW_DECODER = '${@base_conditional("USE_MP3_DECODER", "1", "1", "${USE_MP3_MDW_DECODER}", d)}'
+WMA_MDW_DECODER = '${@base_conditional("USE_WMA_DECODER", "1", "1", "${USE_WMA_MDW_DECODER}", d)}'
+DDD_MDW_DECODER = '${@base_conditional("USE_DDD_DECODER", "1", "1", "${USE_DDD_MDW_DECODER}", d)}'
+ALAC_MDW_DECODER = '${@base_conditional("USE_ALAC_DECODER", "1", "1", "${USE_ALAC_MDW_DECODER}", d)}'
+FLAC_MDW_DECODER = '${@base_conditional("USE_FLAC_DECODER", "1", "1", "${USE_FLAC_MDW_DECODER}", d)}'
+AAC_MDW_ENCODER = '${@base_conditional("USE_AAC_ENCODER", "1", "1", "${USE_AAC_MDW_ENCODER}", d)}'
diff --git a/meta-rcar-gen2/include/rcar-gen2-modules-common.inc b/meta-rcar-gen2/include/rcar-gen2-modules-common.inc
new file mode 100644
index 0000000..4a3658a
--- /dev/null
+++ b/meta-rcar-gen2/include/rcar-gen2-modules-common.inc
@@ -0,0 +1,9 @@
+export BUILDDIR = "${STAGING_INCDIR}/.."
+export LIBSHARED = "${STAGING_LIBDIR}"
+export KERNELSRC = "${STAGING_KERNEL_DIR}"
+export CROSS_COMPILE = "${TARGET_PREFIX}"
+export KERNELDIR = "${STAGING_KERNEL_DIR}"
+export LDFLAGS = ""
+export CP = "cp"
+
+inherit module
diff --git a/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/alt/machconfig b/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/alt/machconfig
new file mode 100644
index 0000000..54a7eab
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/alt/machconfig
@@ -0,0 +1,3 @@
+# Assume a USB mouse and keyboard are connected
+HAVE_TOUCHSCREEN=n
+HAVE_KEYBOARD=n
diff --git a/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/gose/machconfig b/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/gose/machconfig
new file mode 100644
index 0000000..54a7eab
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/gose/machconfig
@@ -0,0 +1,3 @@
+# Assume a USB mouse and keyboard are connected
+HAVE_TOUCHSCREEN=n
+HAVE_KEYBOARD=n
diff --git a/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/koelsch/machconfig b/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/koelsch/machconfig
new file mode 100644
index 0000000..54a7eab
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/koelsch/machconfig
@@ -0,0 +1,3 @@
+# Assume a USB mouse and keyboard are connected
+HAVE_TOUCHSCREEN=n
+HAVE_KEYBOARD=n
diff --git a/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/lager/machconfig b/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/lager/machconfig
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/formfactor/formfactor/lager/machconfig
diff --git a/meta-rcar-gen2/recipes-bsp/formfactor/formfactor_0.0.bbappend b/meta-rcar-gen2/recipes-bsp/formfactor/formfactor_0.0.bbappend
new file mode 100644
index 0000000..72d991c
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/formfactor/formfactor_0.0.bbappend
@@ -0,0 +1 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
diff --git a/meta-rcar-gen2/recipes-bsp/u-boot/u-boot.inc b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot.inc
new file mode 100644
index 0000000..d31c3fd
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot.inc
@@ -0,0 +1,99 @@
+DESCRIPTION = "U-Boot - the Universal Boot Loader"
+HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
+SECTION = "bootloaders"
+PROVIDES = "virtual/bootloader"
+
+inherit deploy
+
+EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"'
+
+python () {
+ if not d.getVar("UBOOT_MACHINE", True):
+ PN = d.getVar("PN", True)
+ FILE = os.path.basename(d.getVar("FILE", True))
+ bb.debug(1, "To build %s, see %s for instructions on \
+ setting up your machine config" % (PN, FILE))
+ raise bb.parse.SkipPackage("UBOOT_MACHINE is not set in the %s machine configuration." % d.getVar("MACHINE", True))
+}
+
+# Some versions of u-boot use .bin and others use .img. By default use .bin
+# but enable individual recipes to change this value.
+UBOOT_SUFFIX ?= "bin"
+UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
+UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
+UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
+UBOOT_MAKE_TARGET ?= "all"
+
+# MiniMonitor requires u-boot.srec
+UBOOT_SREC ?= "u-boot.srec"
+UBOOT_SREC_SYMLINK ?= "u-boot-${MACHINE}.srec"
+UBOOT_SREC_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.srec"
+
+# Some versions of u-boot build an SPL (Second Program Loader) image that
+# should be packaged along with the u-boot binary as well as placed in the
+# deploy directory. For those versions they can set the following variables
+# to allow packaging the SPL.
+SPL_BINARY ?= ""
+SPL_IMAGE ?= "${SPL_BINARY}-${MACHINE}-${PV}-${PR}"
+SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}"
+
+do_compile () {
+ if [ "${@base_contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
+ sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
+ fi
+
+ unset LDFLAGS
+ unset CFLAGS
+ unset CPPFLAGS
+ oe_runmake ${UBOOT_MACHINE}
+ oe_runmake ${UBOOT_MAKE_TARGET}
+}
+
+do_install () {
+ install -d ${D}/boot
+ install ${S}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
+ ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
+
+ if [ -e ${WORKDIR}/fw_env.config ] ; then
+ install -d ${D}${sysconfdir}
+ install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
+ fi
+
+ if [ "x${SPL_BINARY}" != "x" ]
+ then
+ install ${S}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
+ ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARY}
+ fi
+}
+
+FILES_${PN} = "/boot ${sysconfdir}"
+FILESPATH =. "${FILE_DIRNAME}/u-boot-git/${MACHINE}:"
+
+do_deploy () {
+ install -d ${DEPLOYDIR}
+ install ${S}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
+
+ cd ${DEPLOYDIR}
+ rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK}
+ ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
+ ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
+
+ if [ "x${SPL_BINARY}" != "x" ]
+ then
+ install ${S}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
+ rm -f ${DEPLOYDIR}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_SYMLINK}
+ ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARY}
+ ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK}
+ fi
+}
+
+do_deploy_append() {
+ install ${S}/${UBOOT_SREC} ${DEPLOYDIR}/${UBOOT_SREC_IMAGE}
+
+ cd ${DEPLOYDIR}
+ rm -f ${UBOOT_SREC} ${UBOOT_SREC_SYMLINK}
+ ln -sf ${UBOOT_SREC_IMAGE} ${UBOOT_SREC}
+ ln -sf ${UBOOT_SREC_IMAGE} ${UBOOT_SREC_SYMLINK}
+}
+
+addtask deploy before do_build after do_compile
diff --git a/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0001-uboot-Silk-board-support.patch b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0001-uboot-Silk-board-support.patch
new file mode 100644
index 0000000..e103ae4
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0001-uboot-Silk-board-support.patch
@@ -0,0 +1,1708 @@
+From ffb9865c74afe9fc5877aa4a44ea8bc8540abb2a Mon Sep 17 00:00:00 2001
+From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+Date: Sat, 20 Dec 2014 03:23:16 +0300
+Subject: [U-boot][PATCH] arm: rmobile: Add SILK board support
+
+SILK is an entry level development board based on R-Car E2 SoC (R8A7794)
+
+This commit supports the following peripherals:
+- SCIF, I2C, Ethernet, QSPI, MMC/SDHI, USB Host
+
+Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+
+---
+ board/renesas/silk/Makefile | 48 +
+ board/renesas/silk/lowlevel_init.S | 36 +
+ board/renesas/silk/qos.c | 956 +++++++++++++++++++++++++++++++++++++
+ board/renesas/silk/silk.c | 301 +++++++++++
+ board/renesas/silk/silk.h | 28 +
+ boards.cfg | 2
+ drivers/mmc/sh_sdhi.c | 4
+ drivers/usb/host/ehci-r8a779x.c | 2
+ include/configs/silk.h | 214 ++++++++
+ 9 files changed, 1589 insertions(+), 2 deletions(-)
+ create mode 100644 board/renesas/silk/Makefile
+ create mode 100644 board/renesas/silk/lowlevel_init.S
+ create mode 100644 board/renesas/silk/qos.c
+ create mode 100644 board/renesas/silk/silk.c
+ create mode 100644 board/renesas/silk/silk.h
+ create mode 100644 include/configs/silk.h
+
+Index: u-boot-sh.3/board/renesas/silk/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ u-boot-sh.3/board/renesas/silk/Makefile 2014-12-20 20:10:58.050016236 +0300
+@@ -0,0 +1,48 @@
++#
++# board/renesas/silk/Makefile
++#
++# Copyright (C) 2014 Renesas Electronics Corporation
++# Copyright (C) 2014 Cogent Embedded, Inc.
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License version 2
++# as published by the Free Software Foundation.
++#
++# 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.
++#
++
++include $(TOPDIR)/config.mk
++
++LIB = $(obj)lib$(BOARD).o
++
++COBJS := silk.o qos.o
++SOBJS := lowlevel_init.o
++
++SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
++OBJS := $(addprefix $(obj),$(COBJS))
++SOBJS := $(addprefix $(obj),$(SOBJS))
++
++$(LIB): $(obj).depend $(OBJS) $(SOBJS)
++ $(call cmd_link_o_target, $(OBJS) $(SOBJS))
++
++clean:
++ rm -f $(SOBJS) $(OBJS)
++
++distclean: clean
++ rm -f $(LIB) core *.bak $(obj).depend
++
++#########################################################################
++
++# defines $(obj).depend target
++include $(SRCTREE)/rules.mk
++
++sinclude $(obj).depend
++
++#########################################################################
+Index: u-boot-sh.3/board/renesas/silk/lowlevel_init.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ u-boot-sh.3/board/renesas/silk/lowlevel_init.S 2014-12-20 20:07:03.402016607 +0300
+@@ -0,0 +1,36 @@
++/*
++ * board/renesas/silk/lowlevel_init.S
++ * This file is silk low level initialize.
++ *
++ * Copyright (C) 2014 Renesas Electronics Corporation
++ * Copyright (C) 2014 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation.
++ *
++ * 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.
++ */
++
++#include <config.h>
++#include <linux/linkage.h>
++
++ENTRY(lowlevel_init)
++ ldr r3, =(CONFIG_SYS_INIT_SP_ADDR)
++ sub sp, r3, #4
++ str lr, [sp]
++
++ bl s_init
++
++ ldr lr, [sp]
++ mov pc, lr
++ nop
++ENDPROC(lowlevel_init)
++ .ltorg
+Index: u-boot-sh.3/board/renesas/silk/qos.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ u-boot-sh.3/board/renesas/silk/qos.c 2014-12-20 02:24:12.546490964 +0300
+@@ -0,0 +1,956 @@
++/*
++ * board/renesas/silk/qos.c
++ * This file is silk QoS setting.
++ *
++ * Copyright (C) 2014 Renesas Electronics Corporation
++ * Copyright (C) 2014 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation.
++ *
++ * 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.
++ */
++
++#include <common.h>
++#include <asm/processor.h>
++#include <asm/mach-types.h>
++#include <asm/io.h>
++#include <asm/arch/rmobile.h>
++
++/* QoS version 0.11 */
++
++enum {
++ DBSC3_00, DBSC3_01, DBSC3_02, DBSC3_03, DBSC3_04,
++ DBSC3_05, DBSC3_06, DBSC3_07, DBSC3_08, DBSC3_09,
++ DBSC3_10, DBSC3_11, DBSC3_12, DBSC3_13, DBSC3_14,
++ DBSC3_15,
++ DBSC3_NR,
++};
++
++static u32 dbsc3_0_r_qos_addr[DBSC3_NR] = {
++ [DBSC3_00] = DBSC3_0_QOS_R0_BASE,
++ [DBSC3_01] = DBSC3_0_QOS_R1_BASE,
++ [DBSC3_02] = DBSC3_0_QOS_R2_BASE,
++ [DBSC3_03] = DBSC3_0_QOS_R3_BASE,
++ [DBSC3_04] = DBSC3_0_QOS_R4_BASE,
++ [DBSC3_05] = DBSC3_0_QOS_R5_BASE,
++ [DBSC3_06] = DBSC3_0_QOS_R6_BASE,
++ [DBSC3_07] = DBSC3_0_QOS_R7_BASE,
++ [DBSC3_08] = DBSC3_0_QOS_R8_BASE,
++ [DBSC3_09] = DBSC3_0_QOS_R9_BASE,
++ [DBSC3_10] = DBSC3_0_QOS_R10_BASE,
++ [DBSC3_11] = DBSC3_0_QOS_R11_BASE,
++ [DBSC3_12] = DBSC3_0_QOS_R12_BASE,
++ [DBSC3_13] = DBSC3_0_QOS_R13_BASE,
++ [DBSC3_14] = DBSC3_0_QOS_R14_BASE,
++ [DBSC3_15] = DBSC3_0_QOS_R15_BASE,
++};
++
++static u32 dbsc3_0_w_qos_addr[DBSC3_NR] = {
++ [DBSC3_00] = DBSC3_0_QOS_W0_BASE,
++ [DBSC3_01] = DBSC3_0_QOS_W1_BASE,
++ [DBSC3_02] = DBSC3_0_QOS_W2_BASE,
++ [DBSC3_03] = DBSC3_0_QOS_W3_BASE,
++ [DBSC3_04] = DBSC3_0_QOS_W4_BASE,
++ [DBSC3_05] = DBSC3_0_QOS_W5_BASE,
++ [DBSC3_06] = DBSC3_0_QOS_W6_BASE,
++ [DBSC3_07] = DBSC3_0_QOS_W7_BASE,
++ [DBSC3_08] = DBSC3_0_QOS_W8_BASE,
++ [DBSC3_09] = DBSC3_0_QOS_W9_BASE,
++ [DBSC3_10] = DBSC3_0_QOS_W10_BASE,
++ [DBSC3_11] = DBSC3_0_QOS_W11_BASE,
++ [DBSC3_12] = DBSC3_0_QOS_W12_BASE,
++ [DBSC3_13] = DBSC3_0_QOS_W13_BASE,
++ [DBSC3_14] = DBSC3_0_QOS_W14_BASE,
++ [DBSC3_15] = DBSC3_0_QOS_W15_BASE,
++};
++
++void qos_init(void)
++{
++ int i;
++ struct r8a7794_s3c *s3c;
++ struct r8a7794_s3c_qos *s3c_qos;
++ struct r8a7794_dbsc3_qos *qos_addr;
++ struct r8a7794_mxi *mxi;
++ struct r8a7794_mxi_qos *mxi_qos;
++ struct r8a7794_axi_qos *axi_qos;
++
++ /* DBSC DBADJ2 */
++ writel(0x20042004, DBSC3_0_DBADJ2);
++
++ /* S3C -QoS */
++ s3c = (struct r8a7794_s3c *)S3C_BASE;
++ writel(0x1F0D0B0A, &s3c->s3crorr);
++ writel(0x1F0D0B09, &s3c->s3cworr);
++
++ /* QoS Control Registers */
++ s3c_qos = (struct r8a7794_s3c_qos *)S3C_QOS_CCI0_BASE;
++ writel(0x00890089, &s3c_qos->s3cqos0);
++ writel(0x20960010, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++ writel(0x20AA2200, &s3c_qos->s3cqos3);
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960010, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++ writel(0x20AA2200, &s3c_qos->s3cqos7);
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ s3c_qos = (struct r8a7794_s3c_qos *)S3C_QOS_CCI1_BASE;
++ writel(0x00890089, &s3c_qos->s3cqos0);
++ writel(0x20960010, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++ writel(0x20AA2200, &s3c_qos->s3cqos3);
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960010, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++ writel(0x20AA2200, &s3c_qos->s3cqos7);
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ s3c_qos = (struct r8a7794_s3c_qos *)S3C_QOS_MXI_BASE;
++ writel(0x80928092, &s3c_qos->s3cqos0);
++ writel(0x20960020, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++ writel(0x20AA20DC, &s3c_qos->s3cqos3);
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960020, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++ writel(0x20AA20DC, &s3c_qos->s3cqos7);
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ s3c_qos = (struct r8a7794_s3c_qos *)S3C_QOS_AXI_BASE;
++ writel(0x00820082, &s3c_qos->s3cqos0);
++ writel(0x20960020, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++ writel(0x20AA20FA, &s3c_qos->s3cqos3);
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960020, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++ writel(0x20AA20FA, &s3c_qos->s3cqos7);
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ /* DBSC -QoS */
++ /* DBSC0 - Read */
++ for (i = DBSC3_00; i < DBSC3_NR; i++) {
++ qos_addr = (struct r8a7794_dbsc3_qos *)dbsc3_0_r_qos_addr[i];
++ writel(0x00000002, &qos_addr->dblgcnt);
++ writel(0x0000207D, &qos_addr->dbtmval0);
++ writel(0x00002053, &qos_addr->dbtmval1);
++ writel(0x0000202A, &qos_addr->dbtmval2);
++ writel(0x00001FBD, &qos_addr->dbtmval3);
++ writel(0x00000001, &qos_addr->dbrqctr);
++ writel(0x00002064, &qos_addr->dbthres0);
++ writel(0x0000203E, &qos_addr->dbthres1);
++ writel(0x00002019, &qos_addr->dbthres2);
++ writel(0x00000001, &qos_addr->dblgqon);
++ }
++
++ /* DBSC0 - Write */
++ for (i = DBSC3_00; i < DBSC3_NR; i++) {
++ qos_addr = (struct r8a7794_dbsc3_qos *)dbsc3_0_w_qos_addr[i];
++ writel(0x00000002, &qos_addr->dblgcnt);
++ writel(0x0000207D, &qos_addr->dbtmval0);
++ writel(0x00002053, &qos_addr->dbtmval1);
++ writel(0x00002043, &qos_addr->dbtmval2);
++ writel(0x00002030, &qos_addr->dbtmval3);
++ writel(0x00000001, &qos_addr->dbrqctr);
++ writel(0x00002064, &qos_addr->dbthres0);
++ writel(0x0000203E, &qos_addr->dbthres1);
++ writel(0x00002031, &qos_addr->dbthres2);
++ writel(0x00000001, &qos_addr->dblgqon);
++ }
++
++ /* CCI-400 -QoS */
++ writel(0x20000800, CCI_400_MAXOT_1);
++ writel(0x20000800, CCI_400_MAXOT_2);
++ writel(0x0000000C, CCI_400_QOSCNTL_1);
++ writel(0x0000000C, CCI_400_QOSCNTL_2);
++
++ /* MXI -QoS */
++ /* Transaction Control (MXI) */
++ mxi = (struct r8a7794_mxi *)MXI_BASE;
++ writel(0x00000013, &mxi->mxrtcr);
++ writel(0x00000013, &mxi->mxwtcr);
++ writel(0x00780080, &mxi->mxsaar0);
++ writel(0x02000800, &mxi->mxsaar1);
++
++ /* QoS Control (MXI) */
++ mxi_qos = (struct r8a7794_mxi_qos *)MXI_QOS_BASE;
++ writel(0x0000000C, &mxi_qos->vspdu0);
++ writel(0x0000000E, &mxi_qos->du0);
++
++ /* AXI -QoS */
++ /* Transaction Control (MXI) */
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_SYX64TO128_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_AVB_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_IMUX0_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_IMUX1_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_IMUX2_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_LBS_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_MMUDS_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_MMUM_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_MMUS0_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_MMUS1_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_RTX_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_SDS0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_SDS1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_USB20_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_USB22_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_AX2M_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_CC50_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002029, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_CCI_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_CS_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_DDM_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_ETH_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_MPXM_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_SDM0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_SDM1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_TRKF_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_UDM0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI_UDM1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (RT-AXI) */
++ axi_qos = (struct r8a7794_axi_qos *)RT_AXI_SHX_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)RT_AXI_DBG_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)RT_AXI_RTX64TO128_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)RT_AXI_SY2RT_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (MP-AXI) */
++ axi_qos = (struct r8a7794_axi_qos *)MP_AXI_ADSP_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002037, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MP_AXI_ASDS0_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002014, &axi_qos->qosctset0);
++ writel(0x00000040, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MP_AXI_ASDS1_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002014, &axi_qos->qosctset0);
++ writel(0x00000040, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MP_AXI_MLP_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00001FF0, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00002001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MP_AXI_MMUMP_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MP_AXI_SPU_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MP_AXI_SPUC_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000206E, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (SYS-AXI256) */
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI256_AXI128TO256_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020EB, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI256_SYX_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020EB, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI256_MPX_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020EB, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)SYS_AXI256_MXI_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020EB, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (CCI-AXI) */
++ axi_qos = (struct r8a7794_axi_qos *)CCI_AXI_MMUS0_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)CCI_AXI_SYX2_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)CCI_AXI_MMUR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)CCI_AXI_MMUDS_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)CCI_AXI_MMUM_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)CCI_AXI_MXI_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)CCI_AXI_MMUS1_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)CCI_AXI_MMUMP_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (Media-AXI) */
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_MXR_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020DC, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x000020AA, &axi_qos->qosthres0);
++ writel(0x00002032, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_MXW_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020DC, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x000020AA, &axi_qos->qosthres0);
++ writel(0x00002032, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_TDMR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_TDMW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VSP1CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VSP1CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VSPDU0CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VSPDU0CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VIN0W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00001FF0, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00002001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_FDP0R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_FDP0W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_IMSR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_IMSW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VSP1R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VSP1W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_IMRR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_IMRW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VSPD0R_BASE;
++ writel(0x00000003, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VSPD0W_BASE;
++ writel(0x00000003, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_DU0R_BASE;
++ writel(0x00000003, &axi_qos->qosconf);
++ writel(0x00002063, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_DU0W_BASE;
++ writel(0x00000003, &axi_qos->qosconf);
++ writel(0x00002063, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VCP0CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VCP0CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VCP0VR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VCP0VW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7794_axi_qos *)MEDIA_AXI_VPC0R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++}
+Index: u-boot-sh.3/board/renesas/silk/silk.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ u-boot-sh.3/board/renesas/silk/silk.c 2014-12-20 20:10:29.802016281 +0300
+@@ -0,0 +1,318 @@
++/*
++ * board/renesas/silk/silk.c
++ * This file is silk board support.
++ *
++ * Copyright (C) 2014 Renesas Electronics Corporation
++ * Copyright (C) 2014 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation.
++ *
++ * 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.
++ */
++
++#include <common.h>
++#include <malloc.h>
++#include <asm/processor.h>
++#include <asm/mach-types.h>
++#include <asm/io.h>
++#include <asm/errno.h>
++#include <asm/arch/sys_proto.h>
++#include <asm/gpio.h>
++#include <asm/arch/rmobile.h>
++#include <netdev.h>
++#include <i2c.h>
++#include "silk.h"
++
++DECLARE_GLOBAL_DATA_PTR;
++
++void s_init(void)
++{
++ struct r8a7794_rwdt *rwdt = (struct r8a7794_rwdt *)RWDT_BASE;
++ struct r8a7794_swdt *swdt = (struct r8a7794_swdt *)SWDT_BASE;
++
++ /* Watchdog init */
++ writel(0xA5A5A500, &rwdt->rwtcsra);
++ writel(0xA5A5A500, &swdt->swtcsra);
++
++#if !defined(CONFIG_EXTRAM_BOOT)
++ /* QoS */
++ qos_init();
++#endif
++
++#ifndef CONFIG_DCACHE_OFF
++ /*
++ * The caches are disabled when ACTLR.SMP is set to 0
++ * regardless of the value of the SCTLR.C (cache enable bit)
++ * on Cortex-A7 MPCore
++ */
++ asm volatile(
++ "mrc 15, 0, r0, c1, c0, 1\n" /* read ACTLR */
++ "orr r0, r0, #(1 << 6)\n" /* set SMP */
++ "mcr p15, 0, r0, c1, c0, 1\n"); /* write ACTLR */
++#endif
++}
++
++#define TMU0_MSTP125 (1 << 25)
++
++#define IIC1_MSTP323 (1 << 23)
++#define MMC0_MSTP315 (1 << 15)
++#define SDHI1_MSTP312 (1 << 12)
++
++#define SCIF2_MSTP719 (1 << 19)
++
++#define ETHER_MSTP813 (1 << 13)
++
++#define SD1CKCR 0xE6150078
++#define SD1_97500KHZ 0x7
++
++int board_early_init_f(void)
++{
++ u32 val;
++
++ /* TMU0 */
++ val = readl(MSTPSR1);
++ val &= ~TMU0_MSTP125;
++ writel(val, SMSTPCR1);
++
++ /* IIC1 */
++ val = readl(MSTPSR3);
++ val &= ~IIC1_MSTP323;
++ writel(val, SMSTPCR3);
++
++ /* SCIF2 */
++ val = readl(MSTPSR7);
++ val &= ~SCIF2_MSTP719;
++ writel(val, SMSTPCR7);
++
++ /* ETHER */
++ val = readl(MSTPSR8);
++ val &= ~ETHER_MSTP813;
++ writel(val, SMSTPCR8);
++
++ /* MMC/SD */
++ val = readl(MSTPSR3);
++ val &= ~(MMC0_MSTP315 | SDHI1_MSTP312);
++ writel(val, SMSTPCR3);
++
++ /*
++ * SD0 clock is set to 97.5MHz by default.
++ * Set SD1 to the 97.5MHz as well.
++ */
++ writel(SD1_97500KHZ, SD1CKCR);
++
++ return 0;
++}
++
++/* LSI pin pull-up control */
++#define PUPR3 0xe606010C
++#define PUPR3_ETH 0x007FF800
++#define PUPR3_ETH_MAGIC (1 << 20)
++
++#define PUPR1 0xe6060104
++#define PUPR1_DREQ0_N (1 << 20)
++
++int board_init(void)
++{
++ u32 val;
++
++ /* adress of boot parameters */
++ gd->bd->bi_boot_params = SILK_SDRAM_BASE + 0x100;
++
++ /* Init PFC controller */
++ r8a7794_pinmux_init();
++
++ /* ETHER Enable */
++ gpio_request(GPIO_FN_ETH_CRS_DV, NULL);
++ gpio_request(GPIO_FN_ETH_RX_ER, NULL);
++ gpio_request(GPIO_FN_ETH_RXD0, NULL);
++ gpio_request(GPIO_FN_ETH_RXD1, NULL);
++ gpio_request(GPIO_FN_ETH_LINK, NULL);
++ gpio_request(GPIO_FN_ETH_REFCLK, NULL);
++ gpio_request(GPIO_FN_ETH_MDIO, NULL);
++ gpio_request(GPIO_FN_ETH_TXD1, NULL);
++ gpio_request(GPIO_FN_ETH_TX_EN, NULL);
++ gpio_request(GPIO_FN_ETH_MAGIC, NULL);
++ gpio_request(GPIO_FN_ETH_TXD0, NULL);
++ gpio_request(GPIO_FN_ETH_MDC, NULL);
++ gpio_request(GPIO_FN_IRQ8, NULL);
++
++ val = readl(PUPR3);
++ val &= ~(PUPR3_ETH & ~PUPR3_ETH_MAGIC);
++ writel(val, PUPR3);
++
++#ifdef CONFIG_SH_SDHI
++ gpio_request(GPIO_FN_SD1_DATA0, NULL);
++ gpio_request(GPIO_FN_SD1_DATA1, NULL);
++ gpio_request(GPIO_FN_SD1_DATA2, NULL);
++ gpio_request(GPIO_FN_SD1_DATA3, NULL);
++ gpio_request(GPIO_FN_SD1_CLK, NULL);
++ gpio_request(GPIO_FN_SD1_CMD, NULL);
++ gpio_request(GPIO_FN_SD1_CD, NULL);
++#endif
++
++ sh_timer_init();
++
++ gpio_request(GPIO_GP_1_24, NULL); /* PHY_RST */
++
++ val = readl(PUPR1);
++ val &= ~PUPR1_DREQ0_N;
++ writel(val, PUPR1);
++
++ gpio_direction_output(GPIO_GP_1_24, 0);
++ mdelay(20);
++ gpio_set_value(GPIO_GP_1_24, 1);
++ udelay(1);
++
++ /* mmc0 */
++ gpio_request(GPIO_GP_4_31, NULL);
++ gpio_direction_output(GPIO_GP_4_31, 1);
++ /* sdhi1 */
++ gpio_request(GPIO_GP_4_26, NULL);
++ gpio_request(GPIO_GP_4_29, NULL);
++ gpio_direction_output(GPIO_GP_4_26, 1);
++ gpio_direction_output(GPIO_GP_4_29, 1);
++
++ return 0;
++}
++
++int board_eth_init(bd_t *bis)
++{
++ int ret = -ENODEV;
++ u32 val;
++ unsigned char enetaddr[6];
++
++#ifdef CONFIG_SH_ETHER
++ ret = sh_eth_initialize(bis);
++ 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, 0xEE7003C0);
++
++ val = enetaddr[4] << 8 | enetaddr[5];
++ writel(val, 0xEE7003C8);
++#endif
++
++ return ret;
++}
++
++int dram_init(void)
++{
++ gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
++
++ return 0;
++}
++
++const struct rmobile_sysinfo sysinfo = {
++ CONFIG_RMOBILE_BOARD_STRING
++};
++
++void dram_init_banksize(void)
++{
++ gd->bd->bi_dram[0].start = SILK_SDRAM_BASE;
++ gd->bd->bi_dram[0].size = SILK_SDRAM_SIZE;
++}
++
++int board_late_init(void)
++{
++ return 0;
++}
++
++int board_mmc_init(bd_t *bis)
++{
++ int ret = 0;
++
++#ifdef CONFIG_SH_MMCIF
++ ret = mmcif_mmc_init();
++#endif
++
++#ifdef CONFIG_SH_SDHI
++ /* use SDHI1 */
++ ret = sdhi_mmc_init(SDHI1_BASE, 1);
++#endif
++
++ return ret;
++}
++
++void reset_cpu(ulong addr)
++{
++ u8 val;
++
++ i2c_init(CONFIG_SYS_I2C_SPEED, 0);
++ i2c_read(0x58, 0x13, 1, &val, 1);
++ val |= 0x02;
++ i2c_write(0x58, 0x13, 1, &val, 1);
++}
++
++#define TSTR0 4
++#define TSTR0_STR0 0x1
++
++enum {
++ MSTP00, MSTP01, MSTP02, MSTP03, MSTP04, MSTP05,
++ MSTP07, MSTP08, MSTP09, MSTP10, MSTP11,
++ MSTP_NR,
++};
++
++struct mstp_ctl {
++ u32 s_addr;
++ u32 s_dis;
++ u32 s_ena;
++ u32 r_addr;
++ u32 r_dis;
++ u32 r_ena;
++} mstptbl[MSTP_NR] = {
++ [MSTP00] = { SMSTPCR0, 0x00440801, 0x00400000,
++ RMSTPCR0, 0x00440801, 0x00000000 },
++ [MSTP01] = { SMSTPCR1, 0x936899DA, 0x00000000,
++ RMSTPCR1, 0x936899DA, 0x00000000 },
++ [MSTP02] = { SMSTPCR2, 0x100D21FC, 0x00002000,
++ RMSTPCR2, 0x100D21FC, 0x00000000 },
++ [MSTP03] = { SMSTPCR3, 0xE084D810, 0x00000000,
++ RMSTPCR3, 0xE084D810, 0x00000000 },
++ [MSTP04] = { SMSTPCR4, 0x800001C4, 0x00000180,
++ RMSTPCR4, 0x800001C4, 0x00000000 },
++ [MSTP05] = { SMSTPCR5, 0x40C00044, 0x00000000,
++ RMSTPCR5, 0x40C00044, 0x00000000 },
++ [MSTP07] = { SMSTPCR7, 0x013FE618, 0x00080000,
++ RMSTPCR7, 0x013FE618, 0x00000000 },
++ [MSTP08] = { SMSTPCR8, 0x40803C05, 0x00000000,
++ RMSTPCR8, 0x40803C05, 0x00000000 },
++ [MSTP09] = { SMSTPCR9, 0xFB879FEE, 0x00000000,
++ RMSTPCR9, 0xFB879FEE, 0x00000000 },
++ [MSTP10] = { SMSTPCR10, 0xFFFEFFE0, 0x00000000,
++ RMSTPCR10, 0xFFFEFFE0, 0x00000000 },
++ [MSTP11] = { SMSTPCR11, 0x000001C0, 0x00000000,
++ RMSTPCR11, 0x000001C0, 0x00000000 },
++};
++
++void arch_preboot_os()
++{
++ u32 val;
++ int i;
++
++ /* stop TMU0 */
++ val = readb(TMU_BASE + TSTR0);
++ val &= ~TSTR0_STR0;
++ writeb(val, TMU_BASE + TSTR0);
++
++ /* stop all module clock*/
++ for (i = MSTP00; i < MSTP_NR; i++) {
++ val = readl(mstptbl[i].s_addr);
++ writel((val | mstptbl[i].s_dis) & ~(mstptbl[i].s_ena),
++ mstptbl[i].s_addr);
++ val = readl(mstptbl[i].r_addr);
++ writel((val | mstptbl[i].r_dis) & ~(mstptbl[i].r_ena),
++ mstptbl[i].r_addr);
++ }
++}
+Index: u-boot-sh.3/board/renesas/silk/silk.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ u-boot-sh.3/board/renesas/silk/silk.h 2014-12-20 02:24:12.546490964 +0300
+@@ -0,0 +1,28 @@
++/*
++ * board/renesas/silk/silk.h
++ * This file is silk board definition.
++ *
++ * Copyright (C) 2014 Renesas Electronics Corporation
++ * Copyright (C) 2014 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation.
++ *
++ * 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.
++ */
++
++extern int sh_timer_init(void);
++extern int mmcif_mmc_init(void);
++extern int sdhi_mmc_init(unsigned long addr, int ch);
++
++extern void arch_preboot_os(void);
++
++extern void qos_init(void);
+Index: u-boot-sh.3/boards.cfg
+===================================================================
+--- u-boot-sh.3.orig/boards.cfg 2014-12-20 02:24:12.550490964 +0300
++++ u-boot-sh.3/boards.cfg 2014-12-20 03:35:08.394484236 +0300
+@@ -304,6 +304,8 @@
+ gose_extram arm armv7 gose renesas rmobile gose:EXTRAM_BOOT
+ alt arm armv7 alt renesas rmobile
+ alt_extram arm armv7 alt renesas rmobile alt:EXTRAM_BOOT
++silk arm armv7 silk renesas rmobile
++silk_extram arm armv7 silk renesas rmobile silk:EXTRAM_BOOT
+ socfpga_cyclone5 arm armv7 socfpga_cyclone5 altera socfpga
+ actux1_4_16 arm ixp actux1 - - actux1:FLASH2X2
+ actux1_4_32 arm ixp actux1 - - actux1:FLASH2X2,RAM_32MB
+Index: u-boot-sh.3/drivers/mmc/sh_sdhi.c
+===================================================================
+--- u-boot-sh.3.orig/drivers/mmc/sh_sdhi.c 2014-12-20 02:24:12.550490964 +0300
++++ u-boot-sh.3/drivers/mmc/sh_sdhi.c 2014-12-20 02:24:12.546490964 +0300
+@@ -197,7 +197,7 @@
+ if (host->ch < 2)
+ sdhi_writew(host, SDHI_HOST_MODE, 1); /* 16bit access */
+ #elif defined(KOELSCH_SDRAM_BASE) || defined(GOSE_SDRAM_BASE) || \
+- defined(ALT_SDRAM_BASE)
++ defined(ALT_SDRAM_BASE) || defined(SILK_SDRAM_BASE)
+ if (host->ch == 0)
+ sdhi_writew(host, SDHI_HOST_MODE, 1); /* 16bit access */
+ #else
+@@ -668,7 +668,7 @@
+ else
+ host->bus_shift = 0;
+ #elif defined(KOELSCH_SDRAM_BASE) || defined(GOSE_SDRAM_BASE) || \
+- defined(ALT_SDRAM_BASE)
++ defined(ALT_SDRAM_BASE) || defined(SILK_SDRAM_BASE)
+ if (ch == 0)
+ host->bus_shift = 1;
+ else
+Index: u-boot-sh.3/drivers/usb/host/ehci-r8a779x.c
+===================================================================
+--- u-boot-sh.3.orig/drivers/usb/host/ehci-r8a779x.c 2014-12-20 02:24:12.550490964 +0300
++++ u-boot-sh.3/drivers/usb/host/ehci-r8a779x.c 2014-12-20 02:24:12.546490964 +0300
+@@ -30,6 +30,8 @@
+ #define PHYS_OFFSET GOSE_SDRAM_BASE
+ #elif defined(ALT_SDRAM_BASE)
+ #define PHYS_OFFSET ALT_SDRAM_BASE
++#elif defined(SILK_SDRAM_BASE)
++#define PHYS_OFFSET SILK_SDRAM_BASE
+ #else
+ #error
+ #endif
+Index: u-boot-sh.3/include/configs/silk.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ u-boot-sh.3/include/configs/silk.h 2014-12-20 05:15:25.977962314 +0300
+@@ -0,0 +1,214 @@
++/*
++ * include/configs/silk.h
++ * This file is silk board configuration.
++ *
++ * Copyright (C) 2014 Renesas Electronics Corporation
++ * Copyright (C) 2014 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation.
++ *
++ * 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.
++ */
++
++#ifndef __SILK_H
++#define __SILK_H
++
++#undef DEBUG
++#define CONFIG_ARMV7
++#define CONFIG_R8A7794
++#define CONFIG_RMOBILE
++#define CONFIG_RMOBILE_BOARD_STRING "Silk Board\n"
++#define CONFIG_SH_GPIO_PFC
++#define CONFIG_SYS_THUMB_BUILD
++
++#include <asm/arch/rmobile.h>
++
++#define CONFIG_CMD_EDITENV
++#define CONFIG_CMD_SAVEENV
++#define CONFIG_CMD_MEMORY
++#define CONFIG_CMD_DFL
++#define CONFIG_CMD_SDRAM
++#define CONFIG_CMD_RUN
++#define CONFIG_CMD_LOADS
++#define CONFIG_CMD_NET
++#define CONFIG_CMD_MII
++#define CONFIG_CMD_PING
++#define CONFIG_CMD_DHCP
++#define CONFIG_CMD_NFS
++#define CONFIG_CMD_BOOTZ
++#define CONFIG_CMD_USB
++#define CONFIG_CMD_FAT
++#define CONFIG_FAT_WRITE
++#define CONFIG_CMD_MMC
++#define CONFIG_CMD_EXT4
++#define CONFIG_CMD_EXT4_WRITE
++#define CONFIG_CMD_SF
++#define CONFIG_CMD_SPI
++#define CONFIG_CMD_CACHE
++
++#define CONFIG_CMDLINE_TAG
++#define CONFIG_SETUP_MEMORY_TAGS
++#define CONFIG_INITRD_TAG
++#define CONFIG_CMDLINE_EDITING
++
++#define CONFIG_OF_LIBFDT
++#define BOARD_LATE_INIT
++
++#define CONFIG_BAUDRATE 38400
++#define CONFIG_BOOTDELAY 3
++#define CONFIG_BOOTARGS ""
++
++#define CONFIG_VERSION_VARIABLE
++#undef CONFIG_SHOW_BOOT_PROGRESS
++
++#define CONFIG_ARCH_CPU_INIT
++#define CONFIG_DISPLAY_CPUINFO
++#define CONFIG_DISPLAY_BOARDINFO
++#define CONFIG_BOARD_EARLY_INIT_F
++#define CONFIG_USE_ARCH_MEMSET
++#define CONFIG_USE_ARCH_MEMCPY
++#define CONFIG_TMU_TIMER
++
++/* STACK */
++#if defined(CONFIG_EXTRAM_BOOT)
++#define CONFIG_SYS_INIT_SP_ADDR 0x7003FFFC
++#else
++#define CONFIG_SYS_INIT_SP_ADDR 0xE633FFFC
++#endif
++#define STACK_AREA_SIZE 0xC000
++#define LOW_LEVEL_MERAM_STACK \
++ (CONFIG_SYS_INIT_SP_ADDR + STACK_AREA_SIZE - 4)
++
++/* MEMORY */
++#define SILK_SDRAM_BASE 0x40000000
++#define SILK_SDRAM_SIZE 0x40000000
++#define SILK_UBOOT_SDRAM_SIZE 0x20000000
++
++#define CONFIG_SYS_LONGHELP
++#define CONFIG_SYS_PROMPT "=> "
++#define CONFIG_SYS_CBSIZE 256
++#define CONFIG_SYS_PBSIZE 256
++#define CONFIG_SYS_MAXARGS 16
++#define CONFIG_SYS_BARGSIZE 512
++#define CONFIG_SYS_BAUDRATE_TABLE { 38400, 115200 }
++
++/* SCIF */
++#define CONFIG_SCIF_CONSOLE
++#define CONFIG_CONS_SCIF2
++#define SCIF2_BASE 0xe6e58000
++#undef CONFIG_SYS_CONSOLE_INFO_QUIET
++#undef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
++#undef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
++
++#define CONFIG_SYS_MEMTEST_START (SILK_SDRAM_BASE)
++#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + \
++ 504 * 1024 * 1024)
++#undef CONFIG_SYS_SILK_MEMTEST
++#undef CONFIG_SYS_MEMTEST_SCRATCH
++#undef CONFIG_SYS_LOADS_BAUD_CHANGE
++
++#define CONFIG_SYS_SDRAM_BASE (SILK_SDRAM_BASE)
++#define CONFIG_SYS_SDRAM_SIZE (SILK_UBOOT_SDRAM_SIZE)
++#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fc0)
++#define CONFIG_NR_DRAM_BANKS 1
++
++#define CONFIG_SYS_MONITOR_BASE 0x00000000
++#define CONFIG_SYS_MONITOR_LEN (256 * 1024)
++#define CONFIG_SYS_MALLOC_LEN (1 * 1024 * 1024)
++#define CONFIG_SYS_GBL_DATA_SIZE (256)
++#define CONFIG_SYS_BOOTMAPSZ (8 * 1024 * 1024)
++
++#if defined(CONFIG_EXTRAM_BOOT)
++#define CONFIG_SYS_TEXT_BASE 0x70000000
++#else
++#define CONFIG_SYS_TEXT_BASE 0xE6304000
++#endif
++
++/* FLASH */
++#define CONFIG_SPI
++#define CONFIG_SH_QSPI
++#define CONFIG_SPI_FLASH
++#define CONFIG_SPI_FLASH_SPANSION
++#define CONFIG_SPI_FLASH_QUAD
++#define CONFIG_SYS_NO_FLASH
++#define CONFIG_SH_QSPI_BASE 0xE6B10000
++
++/* ENV setting */
++#define CONFIG_ENV_IS_IN_SPI_FLASH
++#define CONFIG_ENV_SECT_SIZE (256 * 1024)
++#define CONFIG_ENV_ADDR 0xC0000
++#define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR)
++#define CONFIG_ENV_SIZE (CONFIG_ENV_SECT_SIZE)
++
++#define CONFIG_EXTRA_ENV_SETTINGS \
++ "bootm_low=0x40e00000\0" \
++ "bootm_size=0x100000\0" \
++
++/* SH Ether */
++#define CONFIG_NET_MULTI
++#define CONFIG_SH_ETHER
++#define CONFIG_SH_ETHER_USE_PORT 0
++#define CONFIG_SH_ETHER_PHY_ADDR 0x1
++#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
++#define CONFIG_SH_ETHER_CACHE_WRITEBACK
++#define CONFIG_SH_ETHER_CACHE_INVALIDATE
++#define CONFIG_PHYLIB
++#define CONFIG_PHY_MICREL
++#define CONFIG_BITBANGMII
++#define CONFIG_BITBANGMII_MULTI
++
++/* Board Clock */
++#define CONFIG_SYS_CLK_FREQ 20000000
++#define CONFIG_SCIF_CLK_FREQ 14745600
++#define CONFIG_SYS_TMU_CLK_DIV 4
++#define CONFIG_SYS_HZ 1000
++
++/* I2C */
++#define CONFIG_SH_I2C 1
++#define CONFIG_SYS_I2C_MODULE 1
++#define CONFIG_SYS_I2C_SPEED 400000 /* 400 kHz */
++#define CONFIG_SYS_I2C_SLAVE 0x7F
++#define CONFIG_SH_I2C_DATA_HIGH 4
++#define CONFIG_SH_I2C_DATA_LOW 5
++#define CONFIG_SH_I2C_CLOCK 10000000
++#define CONFIG_SH_I2C_BASE0 0xE6510000
++
++/* FS */
++#define CONFIG_DOS_PARTITION
++#define CONFIG_SUPPORT_VFAT
++
++/* USB */
++#define CONFIG_USB_STORAGE
++#define CONFIG_USB_EHCI
++#define CONFIG_USB_EHCI_R8A779x
++#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
++
++/* MMCIF */
++#define CONFIG_MMC 1
++#define CONFIG_GENERIC_MMC 1
++
++#define CONFIG_SH_MMCIF 1
++#define CONFIG_SH_MMCIF_ADDR 0xee200000
++#define CONFIG_SH_MMCIF_CLK 48000000
++#define CONFIG_SH_MMCIF_FREQ 100000000
++
++/* SD */
++#define CONFIG_SH_SDHI 1
++#define CONFIG_SH_SDHI_FREQ 97500000
++#define CONFIG_MMC_SH_SDHI_NR_CHANNEL 2
++
++/* USB-ether */
++#define CONFIG_MII
++#define CONFIG_USB_HOST_ETHER /* Enable USB Ethernet adapters */
++#define CONFIG_USB_ETHER_ASIX /* Asix, or whatever driver(s) you want */
++
++#endif /* __SILK_H */
diff --git a/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0004-uboot-porter-board-support.patch b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0004-uboot-porter-board-support.patch
new file mode 100644
index 0000000..f83620b
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0004-uboot-porter-board-support.patch
@@ -0,0 +1,3186 @@
+From 480e53ade723e637d9557d224706bad2210fb3ca Mon Sep 17 00:00:00 2001
+From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+Date: Wed, 4 Feb 2015 22:13:49 +0300
+Subject: [U-boot][PATCH] arm: rmobile: Add Porter board support
+
+Porter is an entry level development board based on R-Car M2 SoC (R8A7791)
+
+This commit supports the following peripherals:
+- SCIF, I2C, Ethernet, QSPI, SDHI, USB Host
+
+Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+---
+ board/renesas/porter/Makefile | 48 +
+ board/renesas/porter/lowlevel_init.S | 71 +
+ board/renesas/porter/porter.c | 308 +++++
+ board/renesas/porter/porter.h | 28 +
+ board/renesas/porter/qos.c | 2411 ++++++++++++++++++++++++++++++++++
+ boards.cfg | 2 +
+ drivers/mmc/sh_sdhi.c | 6 +-
+ drivers/usb/host/ehci-r8a779x.c | 2 +
+ include/configs/porter.h | 213 +++
+ 9 files changed, 3087 insertions(+), 2 deletions(-)
+ create mode 100644 board/renesas/porter/Makefile
+ create mode 100644 board/renesas/porter/lowlevel_init.S
+ create mode 100644 board/renesas/porter/porter.c
+ create mode 100644 board/renesas/porter/porter.h
+ create mode 100644 board/renesas/porter/qos.c
+ create mode 100644 include/configs/porter.h
+
+diff --git a/board/renesas/porter/Makefile b/board/renesas/porter/Makefile
+new file mode 100644
+index 0000000..24e63f1
+--- /dev/null
++++ b/board/renesas/porter/Makefile
+@@ -0,0 +1,48 @@
++#
++# board/renesas/porter/Makefile
++#
++# Copyright (C) 2015 Renesas Electronics Corporation
++# Copyright (C) 2015 Cogent Embedded, Inc.
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License version 2
++# as published by the Free Software Foundation.
++#
++# 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.
++#
++
++include $(TOPDIR)/config.mk
++
++LIB = $(obj)lib$(BOARD).o
++
++COBJS := porter.o qos.o
++SOBJS := lowlevel_init.o
++
++SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
++OBJS := $(addprefix $(obj),$(COBJS))
++SOBJS := $(addprefix $(obj),$(SOBJS))
++
++$(LIB): $(obj).depend $(OBJS) $(SOBJS)
++ $(call cmd_link_o_target, $(OBJS) $(SOBJS))
++
++clean:
++ rm -f $(SOBJS) $(OBJS)
++
++distclean: clean
++ rm -f $(LIB) core *.bak $(obj).depend
++
++#########################################################################
++
++# defines $(obj).depend target
++include $(SRCTREE)/rules.mk
++
++sinclude $(obj).depend
++
++#########################################################################
+diff --git a/board/renesas/porter/lowlevel_init.S b/board/renesas/porter/lowlevel_init.S
+new file mode 100644
+index 0000000..c5ceada
+--- /dev/null
++++ b/board/renesas/porter/lowlevel_init.S
+@@ -0,0 +1,71 @@
++/*
++ * board/renesas/porter/lowlevel_init.S
++ * This file is Porter low level initialize.
++ *
++ * Copyright (C) 2015 Renesas Electronics Corporation
++ * Copyright (C) 2015 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation.
++ *
++ * 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.
++ */
++
++#include <config.h>
++#include <linux/linkage.h>
++
++ENTRY(lowlevel_init)
++ mrc p15, 0, r4, c0, c0, 5 /* mpidr */
++ orr r4, r4, r4, lsr #6
++ and r4, r4, #7 /* id 0-3 = ca15.0,1,2,3 */
++
++ b do_lowlevel_init
++
++ .pool
++
++/*
++ * Only CPU ID #0 comes here
++ */
++ .align 4
++do_lowlevel_init:
++
++ /* surpress wfe if ca15 */
++ tst r4, #4
++ mrceq p15, 0, r0, c1, c0, 1 /* actlr */
++ orreq r0, r0, #(1<<7)
++ mcreq p15, 0, r0, c1, c0, 1
++
++ /* and set l2 latency */
++ mrc p15, 0, r0, c0, c0, 5 /* r0 = MPIDR */
++ and r0, r0, #0xf00
++ lsr r0, r0, #8
++ tst r0, #1 /* only need for cluster 0 */
++ bne _exit_init_l2_a15
++
++ mrc p15, 1, r0, c9, c0, 2 /* r0 = L2CTLR */
++ and r1, r0, #7
++ cmp r1, #3 /* has already been set up */
++ bicne r0, r0, #0xe7
++ orrne r0, r0, #0x83 /* L2CTLR[7:6] + L2CTLR[2:0] */
++ mcrne p15, 1, r0, c9, c0, 2
++_exit_init_l2_a15:
++ ldr r3, =(CONFIG_SYS_INIT_SP_ADDR)
++ sub sp, r3, #4
++ str lr, [sp]
++
++ /* initialize system */
++ bl s_init
++
++ ldr lr, [sp]
++ mov pc, lr
++ nop
++ENDPROC(lowlevel_init)
++ .ltorg
+diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
+new file mode 100644
+index 0000000..e6ded08
+--- /dev/null
++++ b/board/renesas/porter/porter.c
+@@ -0,0 +1,305 @@
++/*
++ * board/renesas/porter/porter.c
++ * This file is Porter board support.
++ *
++ * Copyright (C) 2015 Renesas Electronics Corporation
++ * Copyright (C) 2015 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation.
++ *
++ * 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.
++ */
++
++#include <common.h>
++#include <malloc.h>
++#include <asm/processor.h>
++#include <asm/mach-types.h>
++#include <asm/io.h>
++#include <asm/errno.h>
++#include <asm/arch/sys_proto.h>
++#include <asm/gpio.h>
++#include <asm/arch/rmobile.h>
++#include <netdev.h>
++#include <i2c.h>
++#include "porter.h"
++
++DECLARE_GLOBAL_DATA_PTR;
++
++#define PLL0CR 0xE61500D8
++
++void s_init(void)
++{
++ struct r8a7791_rwdt *rwdt = (struct r8a7791_rwdt *)RWDT_BASE;
++ struct r8a7791_swdt *swdt = (struct r8a7791_swdt *)SWDT_BASE;
++ u32 val;
++
++ /* Watchdog init */
++ writel(0xA5A5A500, &rwdt->rwtcsra);
++ writel(0xA5A5A500, &swdt->swtcsra);
++
++ /* cpu frequency setting */
++ val = readl(PLL0CR);
++ val &= ~0x7F000000;
++ val |= 0x4A000000; /* 1.5GHz */
++ writel(val, PLL0CR);
++
++#if !defined(CONFIG_EXTRAM_BOOT)
++ /* QoS */
++ qos_init();
++#endif
++}
++
++#define TMU0_MSTP125 (1 << 25)
++#define SDHI0_MSTP314 (1 << 14)
++#define SDHI2_MSTP311 (1 << 11)
++#define SCIF0_MSTP721 (1 << 21)
++#define ETHER_MSTP813 (1 << 13)
++
++#define SD2CKCR 0xE615026C
++#define SD2_97500KHZ 0x7
++
++int board_early_init_f(void)
++{
++ u32 val;
++
++ /* TMU0 */
++ val = readl(MSTPSR1);
++ val &= ~TMU0_MSTP125;
++ writel(val, SMSTPCR1);
++
++ val = readl(MSTPSR7);
++ val &= ~SCIF0_MSTP721;
++ writel(val, SMSTPCR7);
++
++ /* ETHER */
++ val = readl(MSTPSR8);
++ val &= ~ETHER_MSTP813;
++ writel(val, SMSTPCR8);
++
++ /* SD */
++ val = readl(MSTPSR3);
++ val &= ~(SDHI0_MSTP314 | SDHI2_MSTP311);
++ writel(val, SMSTPCR3);
++
++ /*
++ * SD0 clock is set to 97.5MHz by default.
++ * Set SD2 to the 97.5MHz as well.
++ */
++ writel(SD2_97500KHZ, SD2CKCR);
++
++ return 0;
++}
++
++/* LSI pin pull-up control */
++#define PUPR5 0xe6060114
++#define PUPR5_ETH 0x3FFC0000
++#define PUPR5_ETH_MAGIC (1 << 27)
++
++int board_init(void)
++{
++ u32 val;
++
++ /* adress of boot parameters */
++ gd->bd->bi_boot_params = PORTER_SDRAM_BASE + 0x100;
++
++ /* Init PFC controller */
++ r8a7791_pinmux_init();
++
++ sh_timer_init();
++
++ /* ETHER Enable */
++ gpio_request(GPIO_FN_ETH_CRS_DV, NULL);
++ gpio_request(GPIO_FN_ETH_RX_ER, NULL);
++ gpio_request(GPIO_FN_ETH_RXD0, NULL);
++ gpio_request(GPIO_FN_ETH_RXD1, NULL);
++ gpio_request(GPIO_FN_ETH_LINK, NULL);
++ gpio_request(GPIO_FN_ETH_REFCLK, NULL);
++ gpio_request(GPIO_FN_ETH_MDIO, NULL);
++ gpio_request(GPIO_FN_ETH_TXD1, NULL);
++ gpio_request(GPIO_FN_ETH_TX_EN, NULL);
++ gpio_request(GPIO_FN_ETH_TXD0, NULL);
++ gpio_request(GPIO_FN_ETH_MDC, NULL);
++ gpio_request(GPIO_FN_IRQ0, NULL);
++
++ val = readl(PUPR5);
++ val &= ~(PUPR5_ETH & ~PUPR5_ETH_MAGIC);
++ writel(val, PUPR5);
++
++ gpio_request(GPIO_GP_5_22, NULL); /* PHY_RST */
++ val = readl(PUPR5);
++ val &= ~PUPR5_ETH_MAGIC;
++ writel(val, PUPR5);
++
++ gpio_direction_output(GPIO_GP_5_22, 0);
++ mdelay(20);
++ gpio_set_value(GPIO_GP_5_22, 1);
++ udelay(1);
++
++#ifdef CONFIG_SH_SDHI
++ gpio_request(GPIO_FN_SD0_DATA0, NULL);
++ gpio_request(GPIO_FN_SD0_DATA1, NULL);
++ gpio_request(GPIO_FN_SD0_DATA2, NULL);
++ gpio_request(GPIO_FN_SD0_DATA3, NULL);
++ gpio_request(GPIO_FN_SD0_CLK, NULL);
++ gpio_request(GPIO_FN_SD0_CMD, NULL);
++ gpio_request(GPIO_FN_SD0_CD, NULL);
++ gpio_request(GPIO_FN_SD2_DATA0, NULL);
++ gpio_request(GPIO_FN_SD2_DATA1, NULL);
++ gpio_request(GPIO_FN_SD2_DATA2, NULL);
++ gpio_request(GPIO_FN_SD2_DATA3, NULL);
++ gpio_request(GPIO_FN_SD2_CLK, NULL);
++ gpio_request(GPIO_FN_SD2_CMD, NULL);
++ gpio_request(GPIO_FN_SD2_CD, NULL);
++#endif
++
++ /* sdhi0 */
++ gpio_request(GPIO_GP_2_12, NULL);
++ gpio_direction_output(GPIO_GP_2_12, 1); /* 1: 3.3V, 0: 1.8V */
++ /* sdhi2 */
++ gpio_request(GPIO_GP_2_26, NULL);
++ gpio_direction_output(GPIO_GP_2_26, 1); /* 1: 3.3V, 0: 1.8V */
++
++ return 0;
++}
++
++int board_eth_init(bd_t *bis)
++{
++ int ret = -ENODEV;
++ u32 val;
++ unsigned char enetaddr[6];
++
++#ifdef CONFIG_SH_ETHER
++ ret = sh_eth_initialize(bis);
++ 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, 0xEE7003C0);
++
++ val = enetaddr[4] << 8 | enetaddr[5];
++ writel(val, 0xEE7003C8);
++#endif
++
++ return ret;
++}
++
++int dram_init(void)
++{
++ gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
++
++ return 0;
++}
++
++const struct rmobile_sysinfo sysinfo = {
++ CONFIG_RMOBILE_BOARD_STRING
++};
++
++void dram_init_banksize(void)
++{
++ gd->bd->bi_dram[0].start = PORTER_SDRAM_BASE;
++ gd->bd->bi_dram[0].size = PORTER_SDRAM_SIZE;
++}
++
++int board_late_init(void)
++{
++ return 0;
++}
++
++int board_mmc_init(bd_t *bis)
++{
++ int ret = 0;
++
++#ifdef CONFIG_SH_SDHI
++ /* use SDHI0,2 */
++ ret = sdhi_mmc_init(SDHI0_BASE, 0);
++ if (ret)
++ return ret;
++
++ ret = sdhi_mmc_init(SDHI2_BASE, 2);
++#endif
++
++ return ret;
++}
++
++void reset_cpu(ulong addr)
++{
++ u8 val;
++
++ i2c_init(CONFIG_SYS_I2C_SPEED, 0);
++ i2c_read(0x58, 0x13, 1, &val, 1);
++ val |= 0x02;
++ i2c_write(0x58, 0x13, 1, &val, 1);
++}
++
++enum {
++ MSTP00, MSTP01, MSTP02, MSTP03, MSTP04, MSTP05,
++ MSTP07, MSTP08, MSTP09, MSTP10, MSTP11,
++ MSTP_NR,
++};
++
++struct mstp_ctl {
++ u32 s_addr;
++ u32 s_dis;
++ u32 s_ena;
++ u32 r_addr;
++ u32 r_dis;
++ u32 r_ena;
++} mstptbl[MSTP_NR] = {
++ [MSTP00] = { SMSTPCR0, 0x00640801, 0x00400000,
++ RMSTPCR0, 0x00640801, 0x00000000 },
++ [MSTP01] = { SMSTPCR1, 0x9B6C9B5A, 0x00000000,
++ RMSTPCR1, 0x9B6C9B5A, 0x00000000 },
++ [MSTP02] = { SMSTPCR2, 0x100D21FC, 0x00002000,
++ RMSTPCR2, 0x100D21FC, 0x00000000 },
++ [MSTP03] = { SMSTPCR3, 0xF08CD810, 0x00000000,
++ RMSTPCR3, 0xF08CD810, 0x00000000 },
++ [MSTP04] = { SMSTPCR4, 0x800001C4, 0x00000180,
++ RMSTPCR4, 0x800001C4, 0x00000000 },
++ [MSTP05] = { SMSTPCR5, 0x44C00046, 0x00000000,
++ RMSTPCR5, 0x44C00046, 0x00000000 },
++ [MSTP07] = { SMSTPCR7, 0x05BFE618, 0x00200000,
++ RMSTPCR7, 0x05BFE618, 0x00000000 },
++ [MSTP08] = { SMSTPCR8, 0x40C0FE85, 0x00000000,
++ RMSTPCR8, 0x40C0FE85, 0x00000000 },
++ [MSTP09] = { SMSTPCR9, 0xFF979FFF, 0x00000000,
++ RMSTPCR9, 0xFF979FFF, 0x00000000 },
++ [MSTP10] = { SMSTPCR10, 0xFFFEFFE0, 0x00000000,
++ RMSTPCR10, 0xFFFEFFE0, 0x00000000 },
++ [MSTP11] = { SMSTPCR11, 0x000001C0, 0x00000000,
++ RMSTPCR11, 0x000001C0, 0x00000000 },
++};
++
++#define TSTR0 4
++#define TSTR0_STR0 0x1
++
++void arch_preboot_os()
++{
++ u32 val;
++ int i;
++
++ /* stop TMU0 */
++ val = readb(TMU_BASE + TSTR0);
++ val &= ~TSTR0_STR0;
++ writeb(val, TMU_BASE + TSTR0);
++
++ /* stop all module clock*/
++ for (i = MSTP00; i < MSTP_NR; i++) {
++ val = readl(mstptbl[i].s_addr);
++ writel((val | mstptbl[i].s_dis) & ~(mstptbl[i].s_ena),
++ mstptbl[i].s_addr);
++ val = readl(mstptbl[i].r_addr);
++ writel((val | mstptbl[i].r_dis) & ~(mstptbl[i].r_ena),
++ mstptbl[i].r_addr);
++ }
++}
+diff --git a/board/renesas/porter/porter.h b/board/renesas/porter/porter.h
+new file mode 100644
+index 0000000..c83e200
+--- /dev/null
++++ b/board/renesas/porter/porter.h
+@@ -0,0 +1,27 @@
++/*
++ * board/renesas/porter/porter.h
++ * This file is Porter board definition.
++ *
++ * Copyright (C) 2015 Renesas Electronics Corporation
++ * Copyright (C) 2015 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation.
++ *
++ * 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.
++ */
++
++extern int sh_timer_init(void);
++extern int sdhi_mmc_init(unsigned long addr, int ch);
++
++extern void arch_preboot_os(void);
++
++extern void qos_init(void);
+diff --git a/board/renesas/porter/qos.c b/board/renesas/porter/qos.c
+new file mode 100644
+index 0000000..b3c2951
+--- /dev/null
++++ b/board/renesas/porter/qos.c
+@@ -0,0 +1,2411 @@
++/*
++ * board/renesas/porter/qos.c
++ * This file is Porter QoS setting.
++ *
++ * Copyright (C) 2015 Renesas Electronics Corporation
++ * Copyright (C) 2015 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation.
++ *
++ * 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.
++ */
++
++#include <common.h>
++#include <asm/processor.h>
++#include <asm/mach-types.h>
++#include <asm/io.h>
++#include <asm/arch/rmobile.h>
++
++/* QoS version 0.240 for ES1 and version 0.411 for ES2 later */
++
++#define QOS_PRI_MEDIA 0
++#define QOS_PRI_NORMAL 1
++#define QOS_PRI_GFX 0
++
++enum {
++ DBSC3_00, DBSC3_01, DBSC3_02, DBSC3_03, DBSC3_04,
++ DBSC3_05, DBSC3_06, DBSC3_07, DBSC3_08, DBSC3_09,
++ DBSC3_10, DBSC3_11, DBSC3_12, DBSC3_13, DBSC3_14,
++ DBSC3_15,
++ DBSC3_NR,
++};
++
++static u32 dbsc3_0_r_qos_addr[DBSC3_NR] = {
++ [DBSC3_00] = DBSC3_0_QOS_R0_BASE,
++ [DBSC3_01] = DBSC3_0_QOS_R1_BASE,
++ [DBSC3_02] = DBSC3_0_QOS_R2_BASE,
++ [DBSC3_03] = DBSC3_0_QOS_R3_BASE,
++ [DBSC3_04] = DBSC3_0_QOS_R4_BASE,
++ [DBSC3_05] = DBSC3_0_QOS_R5_BASE,
++ [DBSC3_06] = DBSC3_0_QOS_R6_BASE,
++ [DBSC3_07] = DBSC3_0_QOS_R7_BASE,
++ [DBSC3_08] = DBSC3_0_QOS_R8_BASE,
++ [DBSC3_09] = DBSC3_0_QOS_R9_BASE,
++ [DBSC3_10] = DBSC3_0_QOS_R10_BASE,
++ [DBSC3_11] = DBSC3_0_QOS_R11_BASE,
++ [DBSC3_12] = DBSC3_0_QOS_R12_BASE,
++ [DBSC3_13] = DBSC3_0_QOS_R13_BASE,
++ [DBSC3_14] = DBSC3_0_QOS_R14_BASE,
++ [DBSC3_15] = DBSC3_0_QOS_R15_BASE,
++};
++
++static u32 dbsc3_0_w_qos_addr[DBSC3_NR] = {
++ [DBSC3_00] = DBSC3_0_QOS_W0_BASE,
++ [DBSC3_01] = DBSC3_0_QOS_W1_BASE,
++ [DBSC3_02] = DBSC3_0_QOS_W2_BASE,
++ [DBSC3_03] = DBSC3_0_QOS_W3_BASE,
++ [DBSC3_04] = DBSC3_0_QOS_W4_BASE,
++ [DBSC3_05] = DBSC3_0_QOS_W5_BASE,
++ [DBSC3_06] = DBSC3_0_QOS_W6_BASE,
++ [DBSC3_07] = DBSC3_0_QOS_W7_BASE,
++ [DBSC3_08] = DBSC3_0_QOS_W8_BASE,
++ [DBSC3_09] = DBSC3_0_QOS_W9_BASE,
++ [DBSC3_10] = DBSC3_0_QOS_W10_BASE,
++ [DBSC3_11] = DBSC3_0_QOS_W11_BASE,
++ [DBSC3_12] = DBSC3_0_QOS_W12_BASE,
++ [DBSC3_13] = DBSC3_0_QOS_W13_BASE,
++ [DBSC3_14] = DBSC3_0_QOS_W14_BASE,
++ [DBSC3_15] = DBSC3_0_QOS_W15_BASE,
++};
++
++static u32 dbsc3_1_r_qos_addr[DBSC3_NR] = {
++ [DBSC3_00] = DBSC3_1_QOS_R0_BASE,
++ [DBSC3_01] = DBSC3_1_QOS_R1_BASE,
++ [DBSC3_02] = DBSC3_1_QOS_R2_BASE,
++ [DBSC3_03] = DBSC3_1_QOS_R3_BASE,
++ [DBSC3_04] = DBSC3_1_QOS_R4_BASE,
++ [DBSC3_05] = DBSC3_1_QOS_R5_BASE,
++ [DBSC3_06] = DBSC3_1_QOS_R6_BASE,
++ [DBSC3_07] = DBSC3_1_QOS_R7_BASE,
++ [DBSC3_08] = DBSC3_1_QOS_R8_BASE,
++ [DBSC3_09] = DBSC3_1_QOS_R9_BASE,
++ [DBSC3_10] = DBSC3_1_QOS_R10_BASE,
++ [DBSC3_11] = DBSC3_1_QOS_R11_BASE,
++ [DBSC3_12] = DBSC3_1_QOS_R12_BASE,
++ [DBSC3_13] = DBSC3_1_QOS_R13_BASE,
++ [DBSC3_14] = DBSC3_1_QOS_R14_BASE,
++ [DBSC3_15] = DBSC3_1_QOS_R15_BASE,
++};
++
++static u32 dbsc3_1_w_qos_addr[DBSC3_NR] = {
++ [DBSC3_00] = DBSC3_1_QOS_W0_BASE,
++ [DBSC3_01] = DBSC3_1_QOS_W1_BASE,
++ [DBSC3_02] = DBSC3_1_QOS_W2_BASE,
++ [DBSC3_03] = DBSC3_1_QOS_W3_BASE,
++ [DBSC3_04] = DBSC3_1_QOS_W4_BASE,
++ [DBSC3_05] = DBSC3_1_QOS_W5_BASE,
++ [DBSC3_06] = DBSC3_1_QOS_W6_BASE,
++ [DBSC3_07] = DBSC3_1_QOS_W7_BASE,
++ [DBSC3_08] = DBSC3_1_QOS_W8_BASE,
++ [DBSC3_09] = DBSC3_1_QOS_W9_BASE,
++ [DBSC3_10] = DBSC3_1_QOS_W10_BASE,
++ [DBSC3_11] = DBSC3_1_QOS_W11_BASE,
++ [DBSC3_12] = DBSC3_1_QOS_W12_BASE,
++ [DBSC3_13] = DBSC3_1_QOS_W13_BASE,
++ [DBSC3_14] = DBSC3_1_QOS_W14_BASE,
++ [DBSC3_15] = DBSC3_1_QOS_W15_BASE,
++};
++
++/* QoS version 0.240 for ES1 */
++
++void qos_init_es1(void)
++{
++ int i;
++ struct r8a7791_s3c *s3c;
++ struct r8a7791_s3c_qos *s3c_qos;
++ struct r8a7791_dbsc3_qos *qos_addr;
++ struct r8a7791_mxi *mxi;
++ struct r8a7791_mxi_qos *mxi_qos;
++ struct r8a7791_axi_qos *axi_qos;
++
++ /* DBSC DBADJ2 */
++ writel(0x20042004, DBSC3_0_DBADJ2);
++ writel(0x20042004, DBSC3_1_DBADJ2);
++
++ /* S3C -QoS */
++ s3c = (struct r8a7791_s3c *)S3C_BASE;
++ writel(0x00FF1B1D, &s3c->s3cadsplcr);
++ writel(0x1F0D0C0C, &s3c->s3crorr);
++ writel(0x1F0D0C0A, &s3c->s3cworr);
++
++ /* QoS Control Registers */
++ s3c_qos = (struct r8a7791_s3c_qos *)S3C_QOS_CCI0_BASE;
++ writel(0x00890089, &s3c_qos->s3cqos0);
++ writel(0x20960010, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++ writel(0x20AA2200, &s3c_qos->s3cqos3);
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960010, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++ writel(0x20AA2200, &s3c_qos->s3cqos7);
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ s3c_qos = (struct r8a7791_s3c_qos *)S3C_QOS_CCI1_BASE;
++ writel(0x00890089, &s3c_qos->s3cqos0);
++ writel(0x20960010, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++ writel(0x20AA2200, &s3c_qos->s3cqos3);
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960010, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++ writel(0x20AA2200, &s3c_qos->s3cqos7);
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ s3c_qos = (struct r8a7791_s3c_qos *)S3C_QOS_MXI_BASE;
++ writel(0x00820082, &s3c_qos->s3cqos0);
++ writel(0x20960020, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++ writel(0x20AA20DC, &s3c_qos->s3cqos3);
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960020, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++ writel(0x20AA20DC, &s3c_qos->s3cqos7);
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ s3c_qos = (struct r8a7791_s3c_qos *)S3C_QOS_AXI_BASE;
++ writel(0x00820082, &s3c_qos->s3cqos0);
++ writel(0x20960020, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++ writel(0x20AA20FA, &s3c_qos->s3cqos3);
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960020, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++ writel(0x20AA20FA, &s3c_qos->s3cqos7);
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ /* DBSC -QoS */
++ /* DBSC0 - Read */
++ for (i = DBSC3_00; i < DBSC3_NR; i++) {
++ qos_addr = (struct r8a7791_dbsc3_qos *)dbsc3_0_r_qos_addr[i];
++ writel(0x00000002, &qos_addr->dblgcnt);
++ writel(0x00002096, &qos_addr->dbtmval0);
++ writel(0x00002064, &qos_addr->dbtmval1);
++ writel(0x00002032, &qos_addr->dbtmval2);
++ writel(0x00001FB0, &qos_addr->dbtmval3);
++ writel(0x00000001, &qos_addr->dbrqctr);
++ writel(0x00002078, &qos_addr->dbthres0);
++ writel(0x0000204B, &qos_addr->dbthres1);
++ writel(0x00001FE7, &qos_addr->dbthres2);
++ writel(0x00000001, &qos_addr->dblgqon);
++ }
++
++ /* DBSC0 - Write */
++ for (i = DBSC3_00; i < DBSC3_NR; i++) {
++ qos_addr = (struct r8a7791_dbsc3_qos *)dbsc3_0_w_qos_addr[i];
++ writel(0x00000002, &qos_addr->dblgcnt);
++ writel(0x000020EB, &qos_addr->dbtmval0);
++ writel(0x0000206E, &qos_addr->dbtmval1);
++ writel(0x00002050, &qos_addr->dbtmval2);
++ writel(0x0000203A, &qos_addr->dbtmval3);
++ writel(0x00000001, &qos_addr->dbrqctr);
++ writel(0x00002078, &qos_addr->dbthres0);
++ writel(0x0000205A, &qos_addr->dbthres1);
++ writel(0x0000203C, &qos_addr->dbthres2);
++ writel(0x00000001, &qos_addr->dblgqon);
++ }
++
++ /* DBSC1 - Read */
++ for (i = DBSC3_00; i < DBSC3_NR; i++) {
++ qos_addr = (struct r8a7791_dbsc3_qos *)dbsc3_1_r_qos_addr[i];
++ writel(0x00000002, &qos_addr->dblgcnt);
++ writel(0x00002096, &qos_addr->dbtmval0);
++ writel(0x00002064, &qos_addr->dbtmval1);
++ writel(0x00002032, &qos_addr->dbtmval2);
++ writel(0x00001FB0, &qos_addr->dbtmval3);
++ writel(0x00000001, &qos_addr->dbrqctr);
++ writel(0x00002078, &qos_addr->dbthres0);
++ writel(0x0000204B, &qos_addr->dbthres1);
++ writel(0x00001FE7, &qos_addr->dbthres2);
++ writel(0x00000001, &qos_addr->dblgqon);
++ }
++
++ /* DBSC1 - Write */
++ for (i = DBSC3_00; i < DBSC3_NR; i++) {
++ qos_addr = (struct r8a7791_dbsc3_qos *)dbsc3_1_w_qos_addr[i];
++ writel(0x00000002, &qos_addr->dblgcnt);
++ writel(0x000020EB, &qos_addr->dbtmval0);
++ writel(0x0000206E, &qos_addr->dbtmval1);
++ writel(0x00002050, &qos_addr->dbtmval2);
++ writel(0x0000203A, &qos_addr->dbtmval3);
++ writel(0x00000001, &qos_addr->dbrqctr);
++ writel(0x00002078, &qos_addr->dbthres0);
++ writel(0x0000205A, &qos_addr->dbthres1);
++ writel(0x0000203C, &qos_addr->dbthres2);
++ writel(0x00000001, &qos_addr->dblgqon);
++ }
++
++ /* CCI-400 -QoS */
++ writel(0x20001000, CCI_400_MAXOT_1);
++ writel(0x20001000, CCI_400_MAXOT_2);
++ writel(0x0000000C, CCI_400_QOSCNTL_1);
++ writel(0x0000000C, CCI_400_QOSCNTL_2);
++
++ /* MXI -QoS */
++ /* Transaction Control (MXI) */
++ mxi = (struct r8a7791_mxi *)MXI_BASE;
++ writel(0x00000013, &mxi->mxrtcr);
++ writel(0x00000013, &mxi->mxwtcr);
++ writel(0x00780080, &mxi->mxsaar0);
++ writel(0x02000800, &mxi->mxsaar1);
++
++ /* QoS Control (MXI) */
++ mxi_qos = (struct r8a7791_mxi_qos *)MXI_QOS_BASE;
++ writel(0x0000000C, &mxi_qos->vspdu0);
++ writel(0x0000000C, &mxi_qos->vspdu1);
++ writel(0x0000000D, &mxi_qos->du0);
++
++ /* AXI -QoS */
++ /* Transaction Control (MXI) */
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SYX64TO128_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_AVB_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_G2D_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_IMP0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002021, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_IMP1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002037, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_IMUX0_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_IMUX1_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_IMUX2_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_LBS_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MMUDS_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MMUM_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MMUR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MMUS0_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MMUS1_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MTSB0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002021, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MTSB1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002021, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_PCI_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_RTX_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SDS0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SDS1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_USB20_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_USB21_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_USB22_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_USB30_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_AX2M_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_CC50_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002029, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_CCI_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_CS_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_DDM_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_ETH_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MPXM_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SAT0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SAT1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SDM0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SDM1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_TRAB_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_UDM0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_UDM1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (RT-AXI) */
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_SHX_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_DBG_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_RDM_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002299, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_RDS_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002029, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_RTX64TO128_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_STPRO_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002029, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_SY2RT_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (MP-AXI) */
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_ADSP_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002037, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_ASDS0_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002014, &axi_qos->qosctset0);
++ writel(0x00000040, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_ASDS1_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002014, &axi_qos->qosctset0);
++ writel(0x00000040, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_MLP_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00001FF0, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00002001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_MMUMP_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_SPU_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_SPUC_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000206E, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (SYS-AXI256) */
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI256_AXI128TO256_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI256_SYX_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI256_MPX_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI256_MXI_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (CCI-AXI) */
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUS0_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_SYX2_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUDS_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUM_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MXI_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUS1_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUMP_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (Media-AXI) */
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_MXR_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020DC, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x000020AA, &axi_qos->qosthres0);
++ writel(0x00002032, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_MXW_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020DC, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x000020AA, &axi_qos->qosthres0);
++ writel(0x00002032, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_JPR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_JPW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_TDMR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_TDMW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSP1CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSP1CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPDU0CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPDU0CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPDU1CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPDU1CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VIN0W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_FDP0R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_FDP0W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_IMSR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_IMSW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSP1R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSP1W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_FDP1R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_FDP1W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_IMRR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_IMRW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPD0R_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPD0W_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPD1R_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPD1W_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_DU0R_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002063, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_DU0W_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002063, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VCP0CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VCP0CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VCP0VR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VCP0VW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VPC0R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++}
++
++/* QoS version 0.411 for ES2 later */
++
++#define S3CADSPLCR_LINEAR_ALL 0
++#define S3CADSPLCR_4K_SPLIT_LINEAR_0x7000_0x7800 1
++#define S3CADSPLCR_4K_SPLIT_LINEAR_0x6800_0x7000 0
++#define S3CADSPLCR_4K_SPLIT_ALL 0
++
++void qos_init_es2(void)
++{
++ int i;
++ struct r8a7791_s3c *s3c;
++ struct r8a7791_s3c_qos *s3c_qos;
++ struct r8a7791_dbsc3_qos *qos_addr;
++ struct r8a7791_mxi *mxi;
++ struct r8a7791_mxi_qos *mxi_qos;
++ struct r8a7791_axi_qos *axi_qos;
++
++ /* DBSC DBADJ2 */
++ writel(0x20042004, DBSC3_0_DBADJ2);
++ writel(0x20042004, DBSC3_1_DBADJ2);
++
++ /* S3C -QoS */
++ s3c = (struct r8a7791_s3c *)S3C_BASE;
++#if S3CADSPLCR_LINEAR_ALL
++ writel(0x00000000, &s3c->s3cadsplcr);
++#elif S3CADSPLCR_4K_SPLIT_LINEAR_0x7000_0x7800
++ writel(0x00BF1B0C, &s3c->s3cadsplcr);
++#elif S3CADSPLCR_4K_SPLIT_LINEAR_0x6800_0x7000
++ writel(0x00DF1B0C, &s3c->s3cadsplcr);
++#elif S3CADSPLCR_4K_SPLIT_ALL
++ writel(0x00FF1B0C, &s3c->s3cadsplcr);
++#else
++#error "S3CADSPLCR_* not defined"
++#endif
++#if QOS_PRI_MEDIA
++ writel(0x1F0B0604, &s3c->s3crorr);
++ writel(0x1F0E0705, &s3c->s3cworr);
++#elif QOS_PRI_NORMAL
++ writel(0x1F0B0908, &s3c->s3crorr);
++ writel(0x1F0E0A08, &s3c->s3cworr);
++#elif QOS_PRI_GFX
++ writel(0x1F0B0B0B, &s3c->s3crorr);
++ writel(0x1F0E0C0C, &s3c->s3cworr);
++#else
++#error "QOS_PRI_* not defined"
++#endif
++
++ /* QoS Control Registers */
++ s3c_qos = (struct r8a7791_s3c_qos *)S3C_QOS_CCI0_BASE;
++ writel(0x00890089, &s3c_qos->s3cqos0);
++ writel(0x20960010, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++#if QOS_PRI_MEDIA
++ writel(0x20AA2300, &s3c_qos->s3cqos3);
++#elif QOS_PRI_NORMAL
++ writel(0x20AA2200, &s3c_qos->s3cqos3);
++#elif QOS_PRI_GFX
++ writel(0x20AA2100, &s3c_qos->s3cqos3);
++#endif
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960010, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++#if QOS_PRI_MEDIA
++ writel(0x20AA2300, &s3c_qos->s3cqos7);
++#elif QOS_PRI_NORMAL
++ writel(0x20AA2200, &s3c_qos->s3cqos7);
++#elif QOS_PRI_GFX
++ writel(0x20AA2100, &s3c_qos->s3cqos7);
++#endif
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ s3c_qos = (struct r8a7791_s3c_qos *)S3C_QOS_CCI1_BASE;
++ writel(0x00890089, &s3c_qos->s3cqos0);
++ writel(0x20960010, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++#if QOS_PRI_MEDIA
++ writel(0x20AA2300, &s3c_qos->s3cqos3);
++#elif QOS_PRI_NORMAL
++ writel(0x20AA2200, &s3c_qos->s3cqos3);
++#elif QOS_PRI_GFX
++ writel(0x20AA2100, &s3c_qos->s3cqos3);
++#endif
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960010, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++#if QOS_PRI_MEDIA
++ writel(0x20AA2300, &s3c_qos->s3cqos7);
++#elif QOS_PRI_NORMAL
++ writel(0x20AA2200, &s3c_qos->s3cqos7);
++#elif QOS_PRI_GFX
++ writel(0x20AA2100, &s3c_qos->s3cqos7);
++#endif
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ s3c_qos = (struct r8a7791_s3c_qos *)S3C_QOS_MXI_BASE;
++ writel(0x80928092, &s3c_qos->s3cqos0);
++ writel(0x20960020, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++ writel(0x20AA20DC, &s3c_qos->s3cqos3);
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960020, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++ writel(0x20AA20DC, &s3c_qos->s3cqos7);
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ s3c_qos = (struct r8a7791_s3c_qos *)S3C_QOS_AXI_BASE;
++ writel(0x00828092, &s3c_qos->s3cqos0);
++ writel(0x20960020, &s3c_qos->s3cqos1);
++ writel(0x20302030, &s3c_qos->s3cqos2);
++ writel(0x20AA20FA, &s3c_qos->s3cqos3);
++ writel(0x00002032, &s3c_qos->s3cqos4);
++ writel(0x20960020, &s3c_qos->s3cqos5);
++ writel(0x20302030, &s3c_qos->s3cqos6);
++ writel(0x20AA20FA, &s3c_qos->s3cqos7);
++ writel(0x00002032, &s3c_qos->s3cqos8);
++
++ /* DBSC -QoS */
++ /* DBSC0 - Read */
++ for (i = DBSC3_00; i < DBSC3_NR; i++) {
++ qos_addr = (struct r8a7791_dbsc3_qos *)dbsc3_0_r_qos_addr[i];
++ writel(0x00000002, &qos_addr->dblgcnt);
++ writel(0x00002096, &qos_addr->dbtmval0);
++ writel(0x00002064, &qos_addr->dbtmval1);
++ writel(0x00002032, &qos_addr->dbtmval2);
++ writel(0x00001FB0, &qos_addr->dbtmval3);
++ writel(0x00000001, &qos_addr->dbrqctr);
++ writel(0x00002078, &qos_addr->dbthres0);
++ writel(0x0000204B, &qos_addr->dbthres1);
++ writel(0x0000201E, &qos_addr->dbthres2);
++ writel(0x00000001, &qos_addr->dblgqon);
++ }
++
++ /* DBSC0 - Write */
++ for (i = DBSC3_00; i < DBSC3_NR; i++) {
++ qos_addr = (struct r8a7791_dbsc3_qos *)dbsc3_0_w_qos_addr[i];
++ writel(0x00000002, &qos_addr->dblgcnt);
++ writel(0x00002096, &qos_addr->dbtmval0);
++ writel(0x00002064, &qos_addr->dbtmval1);
++ writel(0x00002050, &qos_addr->dbtmval2);
++ writel(0x0000203A, &qos_addr->dbtmval3);
++ writel(0x00000001, &qos_addr->dbrqctr);
++ writel(0x00002078, &qos_addr->dbthres0);
++ writel(0x0000204B, &qos_addr->dbthres1);
++ writel(0x0000203C, &qos_addr->dbthres2);
++ writel(0x00000001, &qos_addr->dblgqon);
++ }
++
++ /* DBSC1 - Read */
++ for (i = DBSC3_00; i < DBSC3_NR; i++) {
++ qos_addr = (struct r8a7791_dbsc3_qos *)dbsc3_1_r_qos_addr[i];
++ writel(0x00000002, &qos_addr->dblgcnt);
++ writel(0x00002096, &qos_addr->dbtmval0);
++ writel(0x00002064, &qos_addr->dbtmval1);
++ writel(0x00002032, &qos_addr->dbtmval2);
++ writel(0x00001FB0, &qos_addr->dbtmval3);
++ writel(0x00000001, &qos_addr->dbrqctr);
++ writel(0x00002078, &qos_addr->dbthres0);
++ writel(0x0000204B, &qos_addr->dbthres1);
++ writel(0x0000201E, &qos_addr->dbthres2);
++ writel(0x00000001, &qos_addr->dblgqon);
++ }
++
++ /* DBSC1 - Write */
++ for (i = DBSC3_00; i < DBSC3_NR; i++) {
++ qos_addr = (struct r8a7791_dbsc3_qos *)dbsc3_1_w_qos_addr[i];
++ writel(0x00000002, &qos_addr->dblgcnt);
++ writel(0x00002096, &qos_addr->dbtmval0);
++ writel(0x00002064, &qos_addr->dbtmval1);
++ writel(0x00002050, &qos_addr->dbtmval2);
++ writel(0x0000203A, &qos_addr->dbtmval3);
++ writel(0x00000001, &qos_addr->dbrqctr);
++ writel(0x00002078, &qos_addr->dbthres0);
++ writel(0x0000204B, &qos_addr->dbthres1);
++ writel(0x0000203C, &qos_addr->dbthres2);
++ writel(0x00000001, &qos_addr->dblgqon);
++ }
++
++ /* CCI-400 -QoS */
++ writel(0x20001000, CCI_400_MAXOT_1);
++ writel(0x20001000, CCI_400_MAXOT_2);
++ writel(0x0000000C, CCI_400_QOSCNTL_1);
++ writel(0x0000000C, CCI_400_QOSCNTL_2);
++
++ /* MXI -QoS */
++ /* Transaction Control (MXI) */
++ mxi = (struct r8a7791_mxi *)MXI_BASE;
++ writel(0x00000013, &mxi->mxrtcr);
++ writel(0x00000016, &mxi->mxwtcr);
++ writel(0x00780080, &mxi->mxsaar0);
++ writel(0x02000800, &mxi->mxsaar1);
++
++ /* QoS Control (MXI) */
++ mxi_qos = (struct r8a7791_mxi_qos *)MXI_QOS_BASE;
++ writel(0x0000000C, &mxi_qos->vspdu0);
++ writel(0x0000000C, &mxi_qos->vspdu1);
++ writel(0x0000000E, &mxi_qos->du0);
++
++ /* AXI -QoS */
++ /* Transaction Control (MXI) */
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SYX64TO128_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_AVB_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_G2D_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_IMP0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002021, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_IMP1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002037, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_IMUX0_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_IMUX1_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_IMUX2_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_LBS_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MMUDS_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MMUM_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MMUR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MMUS0_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MMUS1_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MTSB0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002021, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MTSB1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002021, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_PCI_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_RTX_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SDS0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SDS1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_USB20_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_USB21_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_USB22_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_USB30_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_AX2M_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_CC50_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002029, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_CCI_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_CS_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_DDM_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_ETH_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_MPXM_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SAT0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SAT1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SDM0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_SDM1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000214C, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_TRAB_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x000020A6, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_UDM0_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI_UDM1_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (RT-AXI) */
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_SHX_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_DBG_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_RDM_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002299, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_RDS_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002029, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_RTX64TO128_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_STPRO_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002029, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)RT_AXI_SY2RT_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (MP-AXI) */
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_ADSP_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002037, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_ASDS0_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002014, &axi_qos->qosctset0);
++ writel(0x00000040, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_ASDS1_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002014, &axi_qos->qosctset0);
++ writel(0x00000040, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_MLP_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00001FF0, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00002001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_MMUMP_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_SPU_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x00002053, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MP_AXI_SPUC_BASE;
++ writel(0x00000000, &axi_qos->qosconf);
++ writel(0x0000206E, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (SYS-AXI256) */
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI256_AXI128TO256_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020EB, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI256_SYX_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020EB, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI256_MPX_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020EB, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)SYS_AXI256_MXI_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020EB, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (CCI-AXI) */
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUS0_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_SYX2_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUDS_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUM_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MXI_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x00002245, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUS1_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)CCI_AXI_MMUMP_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002004, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000000, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ /* QoS Register (Media-AXI) */
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_MXR_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020DC, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x000020AA, &axi_qos->qosthres0);
++ writel(0x00002032, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_MXW_BASE;
++ writel(0x00000002, &axi_qos->qosconf);
++ writel(0x000020DC, &axi_qos->qosctset0);
++ writel(0x00002096, &axi_qos->qosctset1);
++ writel(0x00002030, &axi_qos->qosctset2);
++ writel(0x00002030, &axi_qos->qosctset3);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x000020AA, &axi_qos->qosthres0);
++ writel(0x00002032, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_JPR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_JPW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_TDMR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_TDMW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSP1CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSP1CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPDU0CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPDU0CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPDU1CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPDU1CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002190, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VIN0W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00001FF0, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00002001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_FDP0R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_FDP0W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_IMSR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_IMSW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSP1R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSP1W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_FDP1R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_FDP1W_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_IMRR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_IMRW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPD0R_BASE;
++ writel(0x00000003, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPD0W_BASE;
++ writel(0x00000003, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPD1R_BASE;
++ writel(0x00000003, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VSPD1W_BASE;
++ writel(0x00000003, &axi_qos->qosconf);
++ writel(0x000020C8, &axi_qos->qosctset0);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_DU0R_BASE;
++ writel(0x00000003, &axi_qos->qosconf);
++ writel(0x00002063, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_DU0W_BASE;
++ writel(0x00000003, &axi_qos->qosconf);
++ writel(0x00002063, &axi_qos->qosctset0);
++ writel(0x00000001, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VCP0CR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VCP0CW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VCP0VR_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VCP0VW_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00000001, &axi_qos->qosthres0);
++ writel(0x00000001, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++
++ axi_qos = (struct r8a7791_axi_qos *)MEDIA_AXI_VPC0R_BASE;
++ writel(0x00000001, &axi_qos->qosconf);
++ writel(0x00002073, &axi_qos->qosctset0);
++ writel(0x00000020, &axi_qos->qosreqctr);
++ writel(0x00002064, &axi_qos->qosthres0);
++ writel(0x00002004, &axi_qos->qosthres1);
++ writel(0x00000001, &axi_qos->qosthres2);
++ writel(0x00000001, &axi_qos->qosqon);
++}
++
++void qos_init(void)
++{
++ if (rmobile_get_cpu_rev_integer() >= R8A7791_CUT_ES2X)
++ qos_init_es2();
++ else
++ qos_init_es1();
++}
+diff --git a/boards.cfg b/boards.cfg
+index 8bcb01f..ef340fa 100644
+--- a/boards.cfg
++++ b/boards.cfg
+@@ -300,6 +300,8 @@ lager arm armv7 lager renesas
+ lager_extram arm armv7 lager renesas rmobile lager:EXTRAM_BOOT
+ koelsch arm armv7 koelsch renesas rmobile
+ koelsch_extram arm armv7 koelsch renesas rmobile koelsch:EXTRAM_BOOT
++porter arm armv7 porter renesas rmobile
++porter_extram arm armv7 porter renesas rmobile porter:EXTRAM_BOOT
+ gose arm armv7 gose renesas rmobile
+ gose_extram arm armv7 gose renesas rmobile gose:EXTRAM_BOOT
+ alt arm armv7 alt renesas rmobile
+diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c
+index 7e691c8..e915ba4 100644
+--- a/drivers/mmc/sh_sdhi.c
++++ b/drivers/mmc/sh_sdhi.c
+@@ -197,7 +197,8 @@ static void sdhi_sync_reset(struct sdhi_host *host)
+ if (host->ch < 2)
+ sdhi_writew(host, SDHI_HOST_MODE, 1); /* 16bit access */
+ #elif defined(KOELSCH_SDRAM_BASE) || defined(GOSE_SDRAM_BASE) || \
+- defined(ALT_SDRAM_BASE) || defined(SILK_SDRAM_BASE)
++ defined(ALT_SDRAM_BASE) || defined(SILK_SDRAM_BASE) || \
++ defined(PORTER_SDRAM_BASE)
+ if (host->ch == 0)
+ sdhi_writew(host, SDHI_HOST_MODE, 1); /* 16bit access */
+ #else
+@@ -668,7 +669,8 @@ int sdhi_mmc_init(unsigned long addr, int ch)
+ else
+ host->bus_shift = 0;
+ #elif defined(KOELSCH_SDRAM_BASE) || defined(GOSE_SDRAM_BASE) || \
+- defined(ALT_SDRAM_BASE) || defined(SILK_SDRAM_BASE)
++ defined(ALT_SDRAM_BASE) || defined(SILK_SDRAM_BASE) || \
++ defined(PORTER_SDRAM_BASE)
+ if (ch == 0)
+ host->bus_shift = 1;
+ else
+diff --git a/drivers/usb/host/ehci-r8a779x.c b/drivers/usb/host/ehci-r8a779x.c
+index e33a5d6..494fc09 100644
+--- a/drivers/usb/host/ehci-r8a779x.c
++++ b/drivers/usb/host/ehci-r8a779x.c
+@@ -26,6 +26,8 @@
+ #define PHYS_OFFSET LAGER_SDRAM_BASE
+ #elif defined(KOELSCH_SDRAM_BASE)
+ #define PHYS_OFFSET KOELSCH_SDRAM_BASE
++#elif defined(PORTER_SDRAM_BASE)
++#define PHYS_OFFSET PORTER_SDRAM_BASE
+ #elif defined(GOSE_SDRAM_BASE)
+ #define PHYS_OFFSET GOSE_SDRAM_BASE
+ #elif defined(ALT_SDRAM_BASE)
+diff --git a/include/configs/porter.h b/include/configs/porter.h
+new file mode 100644
+index 0000000..0d68248
+--- /dev/null
++++ b/include/configs/porter.h
+@@ -0,0 +1,206 @@
++/*
++ * include/configs/porter.h
++ * This file is Porter board configuration.
++ *
++ * Copyright (C) 2015 Renesas Electronics Corporation
++ * Copyright (C) 2015 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation.
++ *
++ * 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.
++ */
++
++#ifndef __PORTER_H
++#define __PORTER_H
++
++#undef DEBUG
++#define CONFIG_ARMV7
++#define CONFIG_R8A7791
++#define CONFIG_RMOBILE
++#define CONFIG_RMOBILE_BOARD_STRING "Porter Board\n"
++#define CONFIG_SH_GPIO_PFC
++#define CONFIG_SYS_THUMB_BUILD
++
++#include <asm/arch/rmobile.h>
++
++#define CONFIG_CMD_EDITENV
++#define CONFIG_CMD_SAVEENV
++#define CONFIG_CMD_MEMORY
++#define CONFIG_CMD_DFL
++#define CONFIG_CMD_SDRAM
++#define CONFIG_CMD_RUN
++#define CONFIG_CMD_LOADS
++#define CONFIG_CMD_NET
++#define CONFIG_CMD_MII
++#define CONFIG_CMD_PING
++#define CONFIG_CMD_DHCP
++#define CONFIG_CMD_NFS
++#define CONFIG_CMD_BOOTZ
++#define CONFIG_CMD_USB
++#define CONFIG_CMD_FAT
++#define CONFIG_FAT_WRITE
++#define CONFIG_CMD_MMC
++#define CONFIG_CMD_EXT4
++#define CONFIG_CMD_EXT4_WRITE
++#define CONFIG_CMD_SF
++#define CONFIG_CMD_SPI
++
++#define CONFIG_CMDLINE_TAG
++#define CONFIG_SETUP_MEMORY_TAGS
++#define CONFIG_INITRD_TAG
++#define CONFIG_CMDLINE_EDITING
++
++#define CONFIG_OF_LIBFDT
++#define BOARD_LATE_INIT
++
++#define CONFIG_BAUDRATE 38400
++#define CONFIG_BOOTDELAY 3
++#define CONFIG_BOOTARGS ""
++
++#define CONFIG_VERSION_VARIABLE
++#undef CONFIG_SHOW_BOOT_PROGRESS
++
++#define CONFIG_ARCH_CPU_INIT
++#define CONFIG_DISPLAY_CPUINFO
++#define CONFIG_DISPLAY_BOARDINFO
++#define CONFIG_BOARD_EARLY_INIT_F
++#define CONFIG_USE_ARCH_MEMSET
++#define CONFIG_USE_ARCH_MEMCPY
++#define CONFIG_TMU_TIMER
++
++/* STACK */
++#if defined(CONFIG_EXTRAM_BOOT)
++#define CONFIG_SYS_INIT_SP_ADDR 0x7003FFFC
++#else
++#define CONFIG_SYS_INIT_SP_ADDR 0xE633FFFC
++#endif
++#define STACK_AREA_SIZE 0xC000
++#define LOW_LEVEL_MERAM_STACK \
++ (CONFIG_SYS_INIT_SP_ADDR + STACK_AREA_SIZE - 4)
++
++/* MEMORY */
++#define PORTER_SDRAM_BASE 0x40000000
++#define PORTER_SDRAM_SIZE 0x40000000
++#define PORTER_UBOOT_SDRAM_SIZE 0x20000000
++
++#define CONFIG_SYS_LONGHELP
++#define CONFIG_SYS_PROMPT "=> "
++#define CONFIG_SYS_CBSIZE 256
++#define CONFIG_SYS_PBSIZE 256
++#define CONFIG_SYS_MAXARGS 16
++#define CONFIG_SYS_BARGSIZE 512
++#define CONFIG_SYS_BAUDRATE_TABLE { 38400, 115200 }
++
++/* SCIF */
++#define CONFIG_SCIF_CONSOLE
++#define CONFIG_CONS_SCIF0
++#define SCIF0_BASE 0xe6e60000
++#undef CONFIG_SYS_CONSOLE_INFO_QUIET
++#undef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
++#undef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
++
++#define CONFIG_SYS_MEMTEST_START (PORTER_SDRAM_BASE)
++#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + \
++ 504 * 1024 * 1024)
++#undef CONFIG_SYS_ALT_MEMTEST
++#undef CONFIG_SYS_MEMTEST_SCRATCH
++#undef CONFIG_SYS_LOADS_BAUD_CHANGE
++
++#define CONFIG_SYS_SDRAM_BASE (PORTER_SDRAM_BASE)
++#define CONFIG_SYS_SDRAM_SIZE (PORTER_UBOOT_SDRAM_SIZE)
++#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fc0)
++#define CONFIG_NR_DRAM_BANKS 1
++
++#define CONFIG_SYS_MONITOR_BASE 0x00000000
++#define CONFIG_SYS_MONITOR_LEN (256 * 1024)
++#define CONFIG_SYS_MALLOC_LEN (1 * 1024 * 1024)
++#define CONFIG_SYS_GBL_DATA_SIZE (256)
++#define CONFIG_SYS_BOOTMAPSZ (8 * 1024 * 1024)
++
++#if defined(CONFIG_EXTRAM_BOOT)
++#define CONFIG_SYS_TEXT_BASE 0x70000000
++#else
++#define CONFIG_SYS_TEXT_BASE 0xE6304000
++#endif
++
++/* FLASH */
++#define CONFIG_SPI
++#define CONFIG_SH_QSPI
++#define CONFIG_SPI_FLASH
++#define CONFIG_SPI_FLASH_SPANSION
++#define CONFIG_SPI_FLASH_QUAD
++#define CONFIG_SYS_NO_FLASH
++#define CONFIG_SH_QSPI_BASE 0xE6B10000
++
++/* ENV setting */
++#define CONFIG_ENV_IS_IN_SPI_FLASH
++#define CONFIG_ENV_SECT_SIZE (256 * 1024)
++#define CONFIG_ENV_ADDR 0xC0000
++#define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR)
++#define CONFIG_ENV_SIZE (CONFIG_ENV_SECT_SIZE)
++
++#define CONFIG_EXTRA_ENV_SETTINGS \
++ "bootm_low=0x40e00000\0" \
++ "bootm_size=0x100000\0" \
++
++/* SH Ether */
++#define CONFIG_NET_MULTI
++#define CONFIG_SH_ETHER
++#define CONFIG_SH_ETHER_USE_PORT 0
++#define CONFIG_SH_ETHER_PHY_ADDR 0x1
++#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
++#define CONFIG_SH_ETHER_CACHE_WRITEBACK
++#define CONFIG_SH_ETHER_CACHE_INVALIDATE
++#define CONFIG_PHYLIB
++#define CONFIG_PHY_MICREL
++#define CONFIG_BITBANGMII
++#define CONFIG_BITBANGMII_MULTI
++
++/* Board Clock */
++#define CONFIG_SYS_CLK_FREQ 20000000
++#define CONFIG_SCIF_CLK_FREQ 65000000
++#define CONFIG_SYS_TMU_CLK_DIV 4
++#define CONFIG_SYS_HZ 1000
++
++/* i2c */
++#define CONFIG_SH_I2C 1
++#define CONFIG_SYS_I2C_MODULE 1
++#define CONFIG_SYS_I2C_SPEED 400000 /* 400 kHz */
++#define CONFIG_SYS_I2C_SLAVE 0x7F
++#define CONFIG_SH_I2C_DATA_HIGH 4
++#define CONFIG_SH_I2C_DATA_LOW 5
++#define CONFIG_SH_I2C_CLOCK 10000000
++#define CONFIG_SH_I2C_BASE0 0xE60B0000
++
++/* FS */
++#define CONFIG_DOS_PARTITION
++#define CONFIG_SUPPORT_VFAT
++
++/* USB */
++#define CONFIG_USB_STORAGE
++#define CONFIG_USB_EHCI
++#define CONFIG_USB_EHCI_R8A779x
++#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
++
++/* SD */
++#define CONFIG_MMC 1
++#define CONFIG_GENERIC_MMC 1
++#define CONFIG_SH_SDHI 1
++#define CONFIG_SH_SDHI_FREQ 97500000
++#define CONFIG_MMC_SH_SDHI_NR_CHANNEL 3
++
++/* USB-ether */
++#define CONFIG_MII
++#define CONFIG_USB_HOST_ETHER /* Enable USB Ethernet adapters */
++#define CONFIG_USB_ETHER_ASIX /* Asix, or whatever driver(s) you want */
++
++#endif /* __PORTER_H */
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0005-uboot-serial-sh-SCIF-internal-clock-support.patch b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0005-uboot-serial-sh-SCIF-internal-clock-support.patch
new file mode 100644
index 0000000..528da57
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0005-uboot-serial-sh-SCIF-internal-clock-support.patch
@@ -0,0 +1,124 @@
+From 95497016e961633e025666a041c63e501b0fc205 Mon Sep 17 00:00:00 2001
+From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+Date: Thu, 12 Feb 2015 16:25:57 +0300
+Subject: [U-boot][PATCH] serial: serial-sh: SCIF internal clock source support
+
+Support internal clock source for SCIF
+
+Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+
+---
+ drivers/serial/serial_sh.c | 4 ++++
+ drivers/serial/serial_sh.h | 7 ++++++-
+ include/configs/alt.h | 1 +
+ include/configs/gose.h | 1 +
+ include/configs/koelsch.h | 1 +
+ include/configs/lager.h | 1 +
+ include/configs/silk.h | 1 +
+ 7 files changed, 15 insertions(+), 1 deletion(-)
+
+Index: u-boot-sh.v1/drivers/serial/serial_sh.c
+===================================================================
+--- u-boot-sh.v1.orig/drivers/serial/serial_sh.c 2015-02-12 14:12:53.616876124 +0300
++++ u-boot-sh.v1/drivers/serial/serial_sh.c 2015-02-12 14:12:53.608876124 +0300
+@@ -63,9 +63,13 @@
+ DECLARE_GLOBAL_DATA_PTR;
+ #if defined(CONFIG_R8A7790) || defined(CONFIG_R8A7791) || \
+ defined(CONFIG_R8A7793) || defined(CONFIG_R8A7794)
++#ifdef CONFIG_SCIF_USE_EXT_CLK
+ sci_out(&sh_sci, DL, DL_VALUE(gd->baudrate, CONFIG_SCIF_CLK_FREQ));
+ udelay((1000000 * 2 * 16 / CONFIG_SYS_CLK_FREQ) * 1000 + 1);
+ #else
++ sci_out(&sh_sci, SCBRR, SCBRR_VALUE(gd->baudrate, CONFIG_SCIF_CLK_FREQ));
++#endif
++#else
+ sci_out(&sh_sci, SCBRR, SCBRR_VALUE(gd->baudrate, CONFIG_SYS_CLK_FREQ));
+ #endif
+ }
+Index: u-boot-sh.v1/drivers/serial/serial_sh.h
+===================================================================
+--- u-boot-sh.v1.orig/drivers/serial/serial_sh.h 2015-02-12 14:12:53.616876124 +0300
++++ u-boot-sh.v1/drivers/serial/serial_sh.h 2015-02-12 14:13:18.400876703 +0300
+@@ -227,8 +227,12 @@
+ #elif defined(CONFIG_R8A7790) || defined(CONFIG_R8A7791) || \
+ defined(CONFIG_R8A7793) || defined(CONFIG_R8A7794)
+ # define SCIF_ORER 0x0001
++#ifdef CONFIG_SCIF_USE_EXT_CLK
+ # define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0, */
+ #else
++# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0, */
++#endif
++#else
+ # error CPU subtype not defined
+ #endif
+
+@@ -735,7 +739,8 @@
+ #define SCBRR_VALUE(bps, clk) (((clk*1000/32)/bps)-1)
+ #elif defined(CONFIG_R8A7790) || defined(CONFIG_R8A7791) || \
+ defined(CONFIG_R8A7793) || defined(CONFIG_R8A7794)
+-#define DL_VALUE(bps, clk) (clk / bps / 16)
++#define DL_VALUE(bps, clk) (clk / bps / 16) /* External Clock */
++#define SCBRR_VALUE(bps, clk) (clk / bps / 32 - 1) /* Internal Clock */
+ #else /* Generic SH */
+ #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1)
+ #endif
+Index: u-boot-sh.v1/include/configs/gose.h
+===================================================================
+--- u-boot-sh.v1.orig/include/configs/gose.h 2015-02-12 14:12:53.616876124 +0300
++++ u-boot-sh.v1/include/configs/gose.h 2015-02-12 14:12:53.612876124 +0300
+@@ -102,6 +102,7 @@
+ /* SCIF */
+ #define CONFIG_SCIF_CONSOLE
+ #define CONFIG_CONS_SCIF0
++#define CONFIG_SCIF_USE_EXT_CLK
+ #define SCIF0_BASE 0xe6e60000
+ #undef CONFIG_SYS_CONSOLE_INFO_QUIET
+ #undef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
+Index: u-boot-sh.v1/include/configs/koelsch.h
+===================================================================
+--- u-boot-sh.v1.orig/include/configs/koelsch.h 2015-02-12 14:12:53.616876124 +0300
++++ u-boot-sh.v1/include/configs/koelsch.h 2015-02-12 14:12:53.612876124 +0300
+@@ -102,6 +102,7 @@
+ /* SCIF */
+ #define CONFIG_SCIF_CONSOLE
+ #define CONFIG_CONS_SCIF0
++#define CONFIG_SCIF_USE_EXT_CLK
+ #define SCIF0_BASE 0xe6e60000
+ #undef CONFIG_SYS_CONSOLE_INFO_QUIET
+ #undef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
+Index: u-boot-sh.v1/include/configs/lager.h
+===================================================================
+--- u-boot-sh.v1.orig/include/configs/lager.h 2015-02-12 14:12:53.616876124 +0300
++++ u-boot-sh.v1/include/configs/lager.h 2015-02-12 14:12:53.612876124 +0300
+@@ -103,6 +103,7 @@
+ /* SCIF */
+ #define CONFIG_SCIF_CONSOLE
+ #define CONFIG_CONS_SCIF0
++#define CONFIG_SCIF_USE_EXT_CLK
+ #define SCIF0_BASE 0xe6e60000
+ #undef CONFIG_SYS_CONSOLE_INFO_QUIET
+ #undef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
+Index: u-boot-sh.v1/include/configs/silk.h
+===================================================================
+--- u-boot-sh.v1.orig/include/configs/silk.h 2015-02-12 14:12:53.616876124 +0300
++++ u-boot-sh.v1/include/configs/silk.h 2015-02-12 14:12:53.612876124 +0300
+@@ -104,6 +104,7 @@
+ /* SCIF */
+ #define CONFIG_SCIF_CONSOLE
+ #define CONFIG_CONS_SCIF2
++#define CONFIG_SCIF_USE_EXT_CLK
+ #define SCIF2_BASE 0xe6e58000
+ #undef CONFIG_SYS_CONSOLE_INFO_QUIET
+ #undef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
+Index: u-boot-sh.v1/include/configs/alt.h
+===================================================================
+--- u-boot-sh.v1.orig/include/configs/alt.h 2015-02-12 14:12:53.616876124 +0300
++++ u-boot-sh.v1/include/configs/alt.h 2015-02-12 14:12:53.612876124 +0300
+@@ -102,6 +102,7 @@
+ /* SCIF */
+ #define CONFIG_SCIF_CONSOLE
+ #define CONFIG_CONS_SCIF2
++#define CONFIG_SCIF_USE_EXT_CLK
+ #define SCIF2_BASE 0xe6e58000
+ #undef CONFIG_SYS_CONSOLE_INFO_QUIET
+ #undef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
diff --git a/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0006-uboot-Silk-disable-dcache-until-fixed.patch b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0006-uboot-Silk-disable-dcache-until-fixed.patch
new file mode 100644
index 0000000..5d6bf50
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot/0006-uboot-Silk-disable-dcache-until-fixed.patch
@@ -0,0 +1,51 @@
+From 1b5c615b0bb18985c9e5b8a3023506d910877d78 Mon Sep 17 00:00:00 2001
+From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+Date: Sun, 15 Feb 2015 02:00:36 +0300
+Subject: [U-boot][PATCH] Silk disable dcache until fixed
+
+Disable D-cache on Silk platform until fixed
+
+Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+---
+ board/renesas/silk/silk.c | 4 ++--
+ include/configs/silk.h | 2 ++
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/board/renesas/silk/silk.c b/board/renesas/silk/silk.c
+index addcfcb..78aede1 100644
+--- a/board/renesas/silk/silk.c
++++ b/board/renesas/silk/silk.c
+@@ -48,7 +48,7 @@ void s_init(void)
+ qos_init();
+ #endif
+
+-#ifndef CONFIG_DCACHE_OFF
++//#ifndef CONFIG_DCACHE_OFF
+ /*
+ * The caches are disabled when ACTLR.SMP is set to 0
+ * regardless of the value of the SCTLR.C (cache enable bit)
+@@ -58,7 +58,7 @@ void s_init(void)
+ "mrc 15, 0, r0, c1, c0, 1\n" /* read ACTLR */
+ "orr r0, r0, #(1 << 6)\n" /* set SMP */
+ "mcr p15, 0, r0, c1, c0, 1\n"); /* write ACTLR */
+-#endif
++//#endif
+ }
+
+ #define TMU0_MSTP125 (1 << 25)
+diff --git a/include/configs/silk.h b/include/configs/silk.h
+index 1a61272..4b66573 100644
+--- a/include/configs/silk.h
++++ b/include/configs/silk.h
+@@ -55,6 +55,8 @@
+ #define CONFIG_CMD_SPI
+ #define CONFIG_CMD_CACHE
+
++#define CONFIG_DCACHE_OFF
++
+ #define CONFIG_CMDLINE_TAG
+ #define CONFIG_SETUP_MEMORY_TAGS
+ #define CONFIG_INITRD_TAG
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-bsp/u-boot/u-boot_2013.01.01.bb b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot_2013.01.01.bb
new file mode 100644
index 0000000..8ca9e3b
--- /dev/null
+++ b/meta-rcar-gen2/recipes-bsp/u-boot/u-boot_2013.01.01.bb
@@ -0,0 +1,32 @@
+require u-boot.inc
+
+# This is needs to be validated among supported BSP's before we can
+# make it default
+DEFAULT_PREFERENCE = "-1"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb"
+
+PV = "v2013.01.01+git${SRCPV}"
+
+COMPATIBLE_MACHINE = "(alt|gose|koelsch|lager|porter|silk)"
+
+SRCREV = "b653737dfca271d2f3d96cf02c67cabef6112dab"
+SRC_URI = "git://git.denx.de/u-boot-sh.git;branch=renesas/bsp/rcar-gen2-1.9.2;protocol=git"
+
+S = "${WORKDIR}/git"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI_append_porter = " \
+ file://0001-uboot-Silk-board-support.patch \
+ file://0004-uboot-porter-board-support.patch \
+ file://0005-uboot-serial-sh-SCIF-internal-clock-support.patch \
+ file://0006-uboot-Silk-disable-dcache-until-fixed.patch \
+"
+SRC_URI_append_silk = " \
+ file://0001-uboot-Silk-board-support.patch \
+ file://0004-uboot-porter-board-support.patch \
+ file://0005-uboot-serial-sh-SCIF-internal-clock-support.patch \
+ file://0006-uboot-Silk-disable-dcache-until-fixed.patch \
+"
diff --git a/meta-rcar-gen2/recipes-core/base-files/base-files_3.0.14.bbappend b/meta-rcar-gen2/recipes-core/base-files/base-files_3.0.14.bbappend
new file mode 100644
index 0000000..9d6092b
--- /dev/null
+++ b/meta-rcar-gen2/recipes-core/base-files/base-files_3.0.14.bbappend
@@ -0,0 +1,7 @@
+require meta-rcar-gen2/include/multimedia-control.inc
+
+do_install_append () {
+ if [ "X${USE_MULTIMEDIA}" = "X1" ] ; then
+ echo "export LD_LIBRARY_PATH=\"/usr/local/lib\"" >> ${D}${sysconfdir}/profile
+ fi
+}
diff --git a/meta-rcar-gen2/recipes-core/libmemcpy/libmemcpy/libmemcpy-1.0.tar.bz2 b/meta-rcar-gen2/recipes-core/libmemcpy/libmemcpy/libmemcpy-1.0.tar.bz2
new file mode 100644
index 0000000..85d93ac
--- /dev/null
+++ b/meta-rcar-gen2/recipes-core/libmemcpy/libmemcpy/libmemcpy-1.0.tar.bz2
Binary files differ
diff --git a/meta-rcar-gen2/recipes-core/libmemcpy/libmemcpy_1.0.bb b/meta-rcar-gen2/recipes-core/libmemcpy/libmemcpy_1.0.bb
new file mode 100644
index 0000000..22f5381
--- /dev/null
+++ b/meta-rcar-gen2/recipes-core/libmemcpy/libmemcpy_1.0.bb
@@ -0,0 +1,12 @@
+SUMMARY = "libmemcpy porting from eglibc 2.17"
+SECTION = "dev"
+LICENSE = "LGPL-2.1"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/LGPL-2.1;md5=1a6d268fd218675ffea8be556788b780"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+SRC_URI = "file://libmemcpy-1.0.tar.bz2"
+
+inherit autotools
+
+prefix="/usr/local/lib"
+exec_prefix="/usr/local"
diff --git a/meta-rcar-gen2/recipes-core/ncurses/ncurses_5.9.bbappend b/meta-rcar-gen2/recipes-core/ncurses/ncurses_5.9.bbappend
new file mode 100644
index 0000000..01cad8f
--- /dev/null
+++ b/meta-rcar-gen2/recipes-core/ncurses/ncurses_5.9.bbappend
@@ -0,0 +1,4 @@
+do_configure_prepend() {
+ # The --enable-pc-files requires PKG_CONFIG_LIBDIR existed
+ mkdir -p ${PKG_CONFIG_LIBDIR}
+}
diff --git a/meta-rcar-gen2/recipes-extended/socketcan/can-utils_git.bbappend b/meta-rcar-gen2/recipes-extended/socketcan/can-utils_git.bbappend
new file mode 100644
index 0000000..85571ba
--- /dev/null
+++ b/meta-rcar-gen2/recipes-extended/socketcan/can-utils_git.bbappend
@@ -0,0 +1,2 @@
+SRC_URI = "git://git.gitorious.org/linux-can/${BPN}.git;protocol=https;branch=master"
+
diff --git a/meta-rcar-gen2/recipes-graphics/cogl/cogl-1.0_1.16.2.bbappend b/meta-rcar-gen2/recipes-graphics/cogl/cogl-1.0_1.16.2.bbappend
new file mode 100644
index 0000000..b2f1a8c
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/cogl/cogl-1.0_1.16.2.bbappend
@@ -0,0 +1,3 @@
+require ../../include/gles-control.inc
+DEPENDS_append_rcar-gen2 = " \
+ ${@'libegl' if '${USE_GLES_WAYLAND}' == '1' else ''}"
diff --git a/meta-rcar-gen2/recipes-graphics/gles-module/gles-test-module.bb b/meta-rcar-gen2/recipes-graphics/gles-module/gles-test-module.bb
new file mode 100644
index 0000000..7a8fcb9
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/gles-module/gles-test-module.bb
@@ -0,0 +1,45 @@
+DESCRIPTION = "RGX/SGX unit test module"
+LICENSE = "CLOSED"
+DEPENDS += "gles-kernel-module gles-user-module"
+PN = "gles-test-module"
+PR = "r0"
+OPENGLES3 ?= "0"
+
+COMPATIBLE_MACHINE = "(r8a7790|r8a7791|r8a7793|r8a7794)"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+SRC_URI = '${@base_conditional( "OPENGLES3", "1", "file://gles3-sample-unittest.tar.bz2", "file://gles2-sample-unittest.tar.bz2", d )}'
+S = '${@base_conditional( "OPENGLES3", "1", "${WORKDIR}/gles3-sample-unittest", "${WORKDIR}/gles2-sample-unittest", d )}'
+
+do_patch[noexec] = "1"
+do_configure[noexec] = "1"
+do_populate_lic[noexec] = "1"
+
+do_compile() {
+ cd ${S}
+ make PKGROOT=${STAGING_DIR_HOST} LIBDRMROOT=${STAGING_DIR_HOST}${prefix}
+}
+
+do_install() {
+ # Copy binary into sysroot
+ mkdir -p ${D}/usr/local/bin/
+ if [ "X${OPENGLES3}" = "X0" ]; then
+ cp ${S}/OES2_Texture ${D}/usr/local/bin/
+ cp ${S}/FragShaderSample.fsh ${D}/usr/local/bin/
+ cp ${S}/VertShaderSample.vsh ${D}/usr/local/bin/
+ else
+ cp ${S}/OES3_Texture ${D}/usr/local/bin/
+ cp ${S}/OES3_FragShaderSample.fsh ${D}/usr/local/bin/
+ cp ${S}/OES3_VertShaderSample.vsh ${D}/usr/local/bin/
+ fi
+}
+
+PACKAGES = "\
+ ${PN} \
+ "
+FILES_${PN} = " \
+ /usr/local/bin/* \
+"
+RPROVIDES_${PN} += "gles-test-module"
+INSANE_SKIP_${PN} += "ldflags"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta-rcar-gen2/recipes-graphics/gles-module/gles-test-module/.gitkeep b/meta-rcar-gen2/recipes-graphics/gles-module/gles-test-module/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/gles-module/gles-test-module/.gitkeep
diff --git a/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module.bb b/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module.bb
new file mode 100644
index 0000000..3a12b27
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module.bb
@@ -0,0 +1,95 @@
+require ../../include/gles-control.inc
+
+DESCRIPTION = "SGX/RGX user module"
+LICENSE = "CLOSED"
+
+PN = "gles-user-module"
+PR = "r0"
+
+COMPATIBLE_MACHINE = "(r8a7790|r8a7791|r8a7793|r8a7794)"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+S_r8a7790 = "${WORKDIR}/rogue"
+GLES_r8a7790 = "rgx"
+S_r8a7791 = "${WORKDIR}/eurasia"
+GLES_r8a7791 = "sgx"
+S_r8a7793 = "${WORKDIR}/eurasia"
+GLES_r8a7793 = "sgx"
+S_r8a7794 = "${WORKDIR}/eurasia"
+GLES_r8a7794 = "sgx"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+OPENGLES3 ?= "0"
+SRC_URI_r8a7790 = '${@base_conditional( "OPENGLES3", "1", \
+ "file://r8a7790_linux_rgx_binaries_gles3.tar.bz2", \
+ "file://r8a7790_linux_rgx_binaries_gles2.tar.bz2", d )}'
+SRC_URI_append_r8a7790 = " ${@base_contains("DISTRO_FEATURES", "wayland", " \
+ file://EGL_headers_for_wayland.patch \
+ file://change-shell.patch \
+ ", "", d)}"
+
+SRC_URI_r8a7791 = "file://r8a7791_linux_sgx_binaries_gles2.tar.bz2"
+SRC_URI_append_r8a7791 = " ${@base_contains("DISTRO_FEATURES", "wayland", " \
+ file://EGL_headers_for_wayland.patch \
+ ", "", d)}"
+
+SRC_URI_r8a7793 = "file://r8a7791_linux_sgx_binaries_gles2.tar.bz2"
+SRC_URI_append_r8a7793 = " ${@base_contains("DISTRO_FEATURES", "wayland", " \
+ file://EGL_headers_for_wayland.patch \
+ ", "", d)}"
+
+SRC_URI_r8a7794 = "file://r8a7794_linux_sgx_binaries_gles2.tar.bz2"
+SRC_URI_append_r8a7794 = " ${@base_contains("DISTRO_FEATURES", "wayland", " \
+ file://EGL_headers_for_wayland.patch \
+ ", "", d)}"
+
+do_populate_lic[noexec] = "1"
+do_compile[noexec] = "1"
+
+do_install() {
+ # Copy binary into sysroot
+ cp -r ${S}/etc ${D}
+ cp -r ${S}/usr ${D}
+
+ if [ "${USE_WAYLAND}" = "1" ]; then
+ # Rename libEGL.so
+ mv ${D}/usr/lib/libEGL.so ${D}/usr/lib/libEGL-pvr.so
+
+ # Set the "WindowSystem" parameter for wayland
+ if [ "${GLES}" = "rgx" ]; then
+ sed -i -e "s/WindowSystem=libpvrNULL_WSEGL.so/WindowSystem=libpvrWAYLAND_WSEGL.so/g" \
+ ${D}/${sysconfdir}/powervr.ini
+ elif [ "${GLES}" = "sgx" ]; then
+ sed -i -e "s/WindowSystem=libpvrPVR2D_FLIPWSEGL.so/WindowSystem=libpvrPVR2D_WAYLANDWSEGL.so/g" \
+ ${D}/${sysconfdir}/powervr.ini
+ fi
+ fi
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ ${sysconfdir}/* \
+ ${libdir}/* \
+ /usr/local/bin/* \
+"
+
+FILES_${PN}-dev = " \
+ ${includedir}/* \
+"
+
+inherit update-rc.d
+
+PROVIDES = "virtual/libgles2"
+PROVIDES_append = "${@base_contains("DISTRO_FEATURES", "wayland", "", " virtual/egl", d)}"
+RPROVIDES_${PN} += "${GLES}-user-module libgles2-mesa libgles2-mesa-dev libgles2 libgles2-dev"
+INSANE_SKIP_${PN} += "ldflags already-stripped"
+INSANE_SKIP_${PN}-dev += "ldflags"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+PRIVATE_LIBS_${PN} = "libEGL.so.1"
+INITSCRIPT_NAME = "rc.pvr"
+INITSCRIPT_PARAMS = "start 8 5 2 . stop 61 0 1 6 ."
diff --git a/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/.gitkeep b/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/.gitkeep
diff --git a/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/EGL_headers_for_wayland.patch b/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/EGL_headers_for_wayland.patch
new file mode 100644
index 0000000..bd906c0
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/EGL_headers_for_wayland.patch
@@ -0,0 +1,32 @@
+--- a/usr/include/EGL/eglext.h
++++ b/usr/include/EGL/eglext.h
+@@ -638,6 +638,8 @@
+ #endif /* KHRONOS_SUPPORT_INT64 */
+ #endif /* EGL_NV_system_time */
+
++#include <EGL/eglmesaext.h>
++
+ #ifdef __cplusplus
+ }
+ #endif
+--- a/usr/include/EGL/eglplatform.h
++++ b/usr/include/EGL/eglplatform.h
+@@ -105,6 +105,18 @@
+ typedef Pixmap EGLNativePixmapType;
+ typedef Window EGLNativeWindowType;
+
++#elif defined(WL_EGL_PLATFORM)
++
++typedef struct wl_display *EGLNativeDisplayType;
++typedef struct wl_egl_pixmap *EGLNativePixmapType;
++typedef struct wl_egl_window *EGLNativeWindowType;
++
++#elif defined(__GBM__)
++
++typedef struct gbm_device *EGLNativeDisplayType;
++typedef struct gbm_bo *EGLNativePixmapType;
++typedef void *EGLNativeWindowType;
++
+ #else
+
+ /* NULLWS fallback */
diff --git a/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/change-shell.patch b/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/change-shell.patch
new file mode 100644
index 0000000..1dd22f4
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/gles-module/gles-user-module/change-shell.patch
@@ -0,0 +1,8 @@
+--- a/etc/init.d/rc.pvr 2014-08-01 09:56:47.528824893 +0900
++++ b/etc/init.d/rc.pvr 2014-08-01 09:56:55.744827677 +0900
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ ############################################################################ ###
+ #@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
+ #@License Strictly Confidential.
diff --git a/meta-rcar-gen2/recipes-graphics/images/core-image-renesas-base.inc b/meta-rcar-gen2/recipes-graphics/images/core-image-renesas-base.inc
new file mode 100644
index 0000000..4f99a90
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/images/core-image-renesas-base.inc
@@ -0,0 +1,44 @@
+require ../../include/multimedia-control.inc
+require ../../include/gles-control.inc
+# common
+IMAGE_INSTALL_append_rcar-gen2 = " \
+ alsa-utils alsa-tools \
+ libdrm-tests \
+ libdrm-kms \
+ bash \
+"
+
+IMAGE_INSTALL_append_rcar-gen2 = " \
+ gstreamer1.0-plugins-base-videorate \
+ gstreamer1.0-plugins-base-videotestsrc \
+ gstreamer1.0-plugins-base-audiotestsrc \
+ gstreamer1.0-plugins-base-alsa \
+ gstreamer1.0-plugins-good-autodetect \
+ gstreamer1.0-plugins-good-isomp4 \
+ gstreamer1.0-plugins-good-video4linux2 \
+ gstreamer1.0-plugins-good-videocrop \
+ gstreamer1.0-plugins-bad-asfmux \
+ gstreamer1.0-plugins-bad-fbdevsink \
+ gstreamer1.0-plugins-bad-faad \
+ gstreamer1.0-plugins-bad-videoparsersbad \
+"
+
+IMAGE_INSTALL_append_rcar-gen2 = '${@base_conditional("USE_GLES", "1", \
+ "gles-kernel-module gles-user-module", "", d)}'
+
+# pkg groups for multimedia
+IMAGE_INSTALL_append_rcar-gen2 = ' ${@base_contains("USE_MULTIMEDIA", "1", " \
+ packagegroup-rcar-gen2-multimedia \
+ ", "", d)}'
+# pkg groups for multimedia test program
+IMAGE_INSTALL_append_rcar-gen2 = ' ${@base_contains("USE_MULTIMEDIA_TEST", "1", " \
+ packagegroup-rcar-gen2-multimedia-tp \
+ ", "", d)}'
+# pkg groups for dtv
+IMAGE_INSTALL_append_rcar-gen2 = ' ${@base_contains("USE_DTV", "1", " \
+ packagegroup-rcar-gen2-dtv \
+ ", "", d)}'
+# pkg groups for graphic test program
+IMAGE_INSTALL_append_rcar-gen2 = ' ${@base_contains("USE_GLES_TEST", "1", " \
+ gles-test-module \
+ ", "", d)}'
diff --git a/meta-rcar-gen2/recipes-graphics/images/core-image-weston-sdk.bb b/meta-rcar-gen2/recipes-graphics/images/core-image-weston-sdk.bb
new file mode 100644
index 0000000..c782fb2
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/images/core-image-weston-sdk.bb
@@ -0,0 +1,11 @@
+require recipes-graphics/images/core-image-weston.bb
+include core-image-weston.inc
+
+DESCRIPTION = "Image with weston support that includes everything within \
+core-image-weston plus meta-toolchain, development headers and libraries to \
+form a standalone SDK."
+
+IMAGE_FEATURES += "dev-pkgs tools-sdk tools-debug debug-tweaks ssh-server-openssh"
+
+IMAGE_INSTALL += "kernel-dev \
+ ltp"
diff --git a/meta-rcar-gen2/recipes-graphics/images/core-image-weston.bbappend b/meta-rcar-gen2/recipes-graphics/images/core-image-weston.bbappend
new file mode 100644
index 0000000..b1f7965
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/images/core-image-weston.bbappend
@@ -0,0 +1 @@
+include core-image-weston.inc
diff --git a/meta-rcar-gen2/recipes-graphics/images/core-image-weston.inc b/meta-rcar-gen2/recipes-graphics/images/core-image-weston.inc
new file mode 100644
index 0000000..782752c
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/images/core-image-weston.inc
@@ -0,0 +1,24 @@
+include core-image-renesas-base.inc
+
+IMAGE_INSTALL_append_rcar-gen2 = '${@base_conditional("USE_GLES", "1", \
+ " libegl libegl-dev libgbm-dev", "", d)} \
+ gstreamer1.0-plugins-bad-waylandsink'
+
+# pkg groups for oss codecs
+IMAGE_INSTALL_append_silk = ' ${@base_conditional("USE_MULTIMEDIA", "1", " \
+ packagegroup-lcb-oss-codecs \
+ ", "", d)}'
+
+IMAGE_INSTALL_append_silk = " \
+ can-utils \
+ libsocketcan \
+"
+
+IMAGE_INSTALL_append_porter = ' ${@base_conditional("USE_MULTIMEDIA", "1", " \
+ packagegroup-lcb-oss-codecs \
+ ", "", d)}'
+
+IMAGE_INSTALL_append_porter = " \
+ can-utils \
+ libsocketcan \
+"
diff --git a/meta-rcar-gen2/recipes-graphics/images/core-image-x11-sdk.bb b/meta-rcar-gen2/recipes-graphics/images/core-image-x11-sdk.bb
new file mode 100644
index 0000000..991e51d
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/images/core-image-x11-sdk.bb
@@ -0,0 +1,11 @@
+require recipes-graphics/images/core-image-x11.bb
+include core-image-x11.inc
+
+DESCRIPTION = "Image with x11 support that includes everything within \
+core-image-x11 plus meta-toolchain, development headers and libraries to \
+form a standalone SDK."
+
+IMAGE_FEATURES += "dev-pkgs tools-sdk tools-debug debug-tweaks ssh-server-openssh"
+
+IMAGE_INSTALL += "kernel-dev \
+ ltp"
diff --git a/meta-rcar-gen2/recipes-graphics/images/core-image-x11.bbappend b/meta-rcar-gen2/recipes-graphics/images/core-image-x11.bbappend
new file mode 100644
index 0000000..6c43054
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/images/core-image-x11.bbappend
@@ -0,0 +1 @@
+include core-image-x11.inc
diff --git a/meta-rcar-gen2/recipes-graphics/images/core-image-x11.inc b/meta-rcar-gen2/recipes-graphics/images/core-image-x11.inc
new file mode 100644
index 0000000..cbb1017
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/images/core-image-x11.inc
@@ -0,0 +1,24 @@
+include core-image-renesas-base.inc
+
+IMAGE_FEATURES += "x11-sato ssh-server-dropbear"
+
+IMAGE_INSTALL += "packagegroup-core-x11-sato-games"
+
+# pkg groups for oss codecs
+IMAGE_INSTALL_append_silk = ' ${@base_conditional("USE_MULTIMEDIA", "1", " \
+ packagegroup-lcb-oss-codecs \
+ ", "", d)}'
+
+IMAGE_INSTALL_append_silk = " \
+ can-utils \
+ libsocketcan \
+"
+
+IMAGE_INSTALL_append_porter = ' ${@base_conditional("USE_MULTIMEDIA", "1", " \
+ packagegroup-lcb-oss-codecs \
+ ", "", d)}'
+
+IMAGE_INSTALL_append_porter = " \
+ can-utils \
+ libsocketcan \
+"
diff --git a/meta-rcar-gen2/recipes-graphics/mesa/mesa-dummy.inc b/meta-rcar-gen2/recipes-graphics/mesa/mesa-dummy.inc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/mesa/mesa-dummy.inc
diff --git a/meta-rcar-gen2/recipes-graphics/mesa/mesa-wayland.inc b/meta-rcar-gen2/recipes-graphics/mesa/mesa-wayland.inc
new file mode 100644
index 0000000..e58535e
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/mesa/mesa-wayland.inc
@@ -0,0 +1,22 @@
+# FIXME: can not override PACKAGECONFIG.
+PACKAGECONFIG[gles] = "--enable-gles1 --disable-gles2"
+PACKAGECONFIG[egl] = "--enable-egl --with-egl-platforms=wayland"
+
+# Disable the gbm modules of mesa
+EXTRA_OECONF_rcar-gen2 := "${@'${EXTRA_OECONF}'.replace('--enable-gbm', '--disable-gbm')}"
+# Remove the gbm and egl packages. These are provided in other recipes.
+PACKAGES_remove_rcar-gen2 = "libgbm-dev libgbm libegl-mesa-dev libegl-mesa libegl-dev libegl libgles2-mesa libgles2-mesa-dev"
+
+# Remove the x11 configure
+PACKAGECONFIG_rcar-gen2 := "${@'${PACKAGECONFIG}'.replace('x11', '')}"
+
+do_install_append_rcar-gen2() {
+ # Remove libegl-mesa modules and headers
+ rm -f ${D}/usr/lib/libEGL.la
+ rm -f ${D}/usr/lib/libEGL.so*
+ rm -f ${D}/usr/lib/pkgconfig/egl.pc
+ rm -rf ${D}/usr/include/KHR
+ rm -rf ${D}/usr/include/EGL
+}
+
+# FILES_${PN}-dbg += "${libdir}/src/debug/*"
diff --git a/meta-rcar-gen2/recipes-graphics/mesa/mesa-x11.inc b/meta-rcar-gen2/recipes-graphics/mesa/mesa-x11.inc
new file mode 100644
index 0000000..21c497c
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/mesa/mesa-x11.inc
@@ -0,0 +1,4 @@
+# FIXME: can not override PACKAGECONFIG[*]
+PACKAGECONFIG[gles] = "--enable-gles1 --disable-gles2"
+
+PACKAGECONFIG_remove_rcar-gen2 = "egl"
diff --git a/meta-rcar-gen2/recipes-graphics/mesa/mesa_9.2.5.bbappend b/meta-rcar-gen2/recipes-graphics/mesa/mesa_9.2.5.bbappend
new file mode 100644
index 0000000..c7f7f28
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/mesa/mesa_9.2.5.bbappend
@@ -0,0 +1,13 @@
+require ../../include/gles-control.inc
+
+def map_libs(d):
+ if base_conditional('USE_GLES_WAYLAND', "1", "1", "0", d) == "1":
+ return "wayland"
+
+ if base_conditional('USE_GLES_X11', "1", "1", "0", d) == "1":
+ return "x11"
+
+ return "dummy"
+
+MESATARGET := "${@map_libs(d)}"
+include mesa-${MESATARGET}.inc
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/libegl.bb b/meta-rcar-gen2/recipes-graphics/wayland/libegl.bb
new file mode 100644
index 0000000..e79d52d
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/libegl.bb
@@ -0,0 +1,18 @@
+SUMMARY = "EGL library"
+LICENSE = "Apache-2.0 & MIT"
+LIC_FILES_CHKSUM = "file://egl.c;beginline=5;endline=15;md5=3677623633a6e459b1f60b1e541c4212"
+
+COMPATIBLE_MACHINE = "(r8a7790|r8a7791|r8a7793|r8a7794)"
+
+PROVIDES = "${@base_contains("DISTRO_FEATURES", "wayland", "virtual/egl", "", d)}"
+SRCREV = "ee4bce93878d02a144ae6ebfba1eff28fe9b4442"
+SRC_URI = "git://github.com/thayama/libegl;protocol=git;branch=master \
+ file://0001-libegl-Remove-duplicate-header-files-of-gles-user-mo.patch"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
+
+DEPENDS = "libgbm gles-user-module"
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/libegl/0001-libegl-Remove-duplicate-header-files-of-gles-user-mo.patch b/meta-rcar-gen2/recipes-graphics/wayland/libegl/0001-libegl-Remove-duplicate-header-files-of-gles-user-mo.patch
new file mode 100644
index 0000000..c718a48
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/libegl/0001-libegl-Remove-duplicate-header-files-of-gles-user-mo.patch
@@ -0,0 +1,4091 @@
+From 20fe4af12ceca848c2b0758b2b7be354cd5da103 Mon Sep 17 00:00:00 2001
+From: Tomohiro Komagata <tomohiro.komagata.aj@renesas.com>
+Date: Tue, 21 Oct 2014 10:23:58 +0900
+Subject: [PATCH] libegl: Remove duplicate header files of gles-user-module.
+
+These header files are provided by gles-user-module too.
+And, when libegl is compiled, these header files in sysroot
+are refered by this patch.
+
+Signed-off-by: Tomohiro Komagata <tomohiro.komagata.aj@renesas.com>
+---
+ Makefile.am | 15 +-
+ include/EGL/egl.h | 329 -------
+ include/EGL/eglext.h | 580 ------------
+ include/EGL/eglplatform.h | 105 ---
+ include/GLES2/gl2.h | 620 -------------
+ include/GLES2/gl2ext.h | 2051 -------------------------------------------
+ include/GLES2/gl2platform.h | 30 -
+ include/KHR/khrplatform.h | 277 ------
+ 8 files changed, 1 insertion(+), 4006 deletions(-)
+ delete mode 100644 include/EGL/egl.h
+ delete mode 100644 include/EGL/eglext.h
+ delete mode 100644 include/EGL/eglplatform.h
+ delete mode 100644 include/GLES2/gl2.h
+ delete mode 100644 include/GLES2/gl2ext.h
+ delete mode 100644 include/GLES2/gl2platform.h
+ delete mode 100644 include/KHR/khrplatform.h
+
+diff --git a/Makefile.am b/Makefile.am
+index 4859e8d..b354344 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -17,20 +17,7 @@ libEGL_la_LDFLAGS = -version-info 1:0:0
+
+ egldir = $(includedir)/EGL
+ egl_HEADERS = \
+- $(top_srcdir)/include/EGL/eglmesaext.h \
+- $(top_srcdir)/include/EGL/egl.h \
+- $(top_srcdir)/include/EGL/eglplatform.h \
+- $(top_srcdir)/include/EGL/eglext.h
+-
+-khrdir = $(includedir)/KHR
+-khr_HEADERS = \
+- $(top_srcdir)/include/KHR/khrplatform.h
+-
+-gles2dir = $(includedir)/GLES2
+-gles2_HEADERS = \
+- $(top_srcdir)/include/GLES2/gl2ext.h \
+- $(top_srcdir)/include/GLES2/gl2platform.h \
+- $(top_srcdir)/include/GLES2/gl2.h
++ $(top_srcdir)/include/EGL/eglmesaext.h
+
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = egl.pc glesv2.pc
+diff --git a/include/EGL/egl.h b/include/EGL/egl.h
+deleted file mode 100644
+index 99ea342..0000000
+--- a/include/EGL/egl.h
++++ /dev/null
+@@ -1,329 +0,0 @@
+-/* -*- mode: c; tab-width: 8; -*- */
+-/* vi: set sw=4 ts=8: */
+-/* Reference version of egl.h for EGL 1.4.
+- * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+- */
+-
+-/*
+-** Copyright (c) 2007-2009 The Khronos Group Inc.
+-**
+-** Permission is hereby granted, free of charge, to any person obtaining a
+-** copy of this software and/or associated documentation files (the
+-** "Materials"), to deal in the Materials without restriction, including
+-** without limitation the rights to use, copy, modify, merge, publish,
+-** distribute, sublicense, and/or sell copies of the Materials, and to
+-** permit persons to whom the Materials are 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 Materials.
+-**
+-** THE MATERIALS ARE 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.
+-** 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
+-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+-*/
+-
+-#ifndef __egl_h_
+-#define __egl_h_
+-
+-/* All platform-dependent types and macro boilerplate (such as EGLAPI
+- * and EGLAPIENTRY) should go in eglplatform.h.
+- */
+-#include <EGL/eglplatform.h>
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-/* EGL Types */
+-/* EGLint is defined in eglplatform.h */
+-typedef unsigned int EGLBoolean;
+-typedef unsigned int EGLenum;
+-typedef void *EGLConfig;
+-typedef void *EGLContext;
+-typedef void *EGLDisplay;
+-typedef void *EGLSurface;
+-typedef void *EGLClientBuffer;
+-
+-/* EGL Versioning */
+-#define EGL_VERSION_1_0 1
+-#define EGL_VERSION_1_1 1
+-#define EGL_VERSION_1_2 1
+-#define EGL_VERSION_1_3 1
+-#define EGL_VERSION_1_4 1
+-
+-/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
+- * enums are assigned unique values starting at 0x3000.
+- */
+-
+-/* EGL aliases */
+-#define EGL_FALSE 0
+-#define EGL_TRUE 1
+-
+-/* Out-of-band handle values */
+-#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
+-#define EGL_NO_CONTEXT ((EGLContext)0)
+-#define EGL_NO_DISPLAY ((EGLDisplay)0)
+-#define EGL_NO_SURFACE ((EGLSurface)0)
+-
+-/* Out-of-band attribute value */
+-#define EGL_DONT_CARE ((EGLint)-1)
+-
+-/* Errors / GetError return values */
+-#define EGL_SUCCESS 0x3000
+-#define EGL_NOT_INITIALIZED 0x3001
+-#define EGL_BAD_ACCESS 0x3002
+-#define EGL_BAD_ALLOC 0x3003
+-#define EGL_BAD_ATTRIBUTE 0x3004
+-#define EGL_BAD_CONFIG 0x3005
+-#define EGL_BAD_CONTEXT 0x3006
+-#define EGL_BAD_CURRENT_SURFACE 0x3007
+-#define EGL_BAD_DISPLAY 0x3008
+-#define EGL_BAD_MATCH 0x3009
+-#define EGL_BAD_NATIVE_PIXMAP 0x300A
+-#define EGL_BAD_NATIVE_WINDOW 0x300B
+-#define EGL_BAD_PARAMETER 0x300C
+-#define EGL_BAD_SURFACE 0x300D
+-#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
+-
+-/* Reserved 0x300F-0x301F for additional errors */
+-
+-/* Config attributes */
+-#define EGL_BUFFER_SIZE 0x3020
+-#define EGL_ALPHA_SIZE 0x3021
+-#define EGL_BLUE_SIZE 0x3022
+-#define EGL_GREEN_SIZE 0x3023
+-#define EGL_RED_SIZE 0x3024
+-#define EGL_DEPTH_SIZE 0x3025
+-#define EGL_STENCIL_SIZE 0x3026
+-#define EGL_CONFIG_CAVEAT 0x3027
+-#define EGL_CONFIG_ID 0x3028
+-#define EGL_LEVEL 0x3029
+-#define EGL_MAX_PBUFFER_HEIGHT 0x302A
+-#define EGL_MAX_PBUFFER_PIXELS 0x302B
+-#define EGL_MAX_PBUFFER_WIDTH 0x302C
+-#define EGL_NATIVE_RENDERABLE 0x302D
+-#define EGL_NATIVE_VISUAL_ID 0x302E
+-#define EGL_NATIVE_VISUAL_TYPE 0x302F
+-#define EGL_SAMPLES 0x3031
+-#define EGL_SAMPLE_BUFFERS 0x3032
+-#define EGL_SURFACE_TYPE 0x3033
+-#define EGL_TRANSPARENT_TYPE 0x3034
+-#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
+-#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
+-#define EGL_TRANSPARENT_RED_VALUE 0x3037
+-#define EGL_NONE 0x3038 /* Attrib list terminator */
+-#define EGL_BIND_TO_TEXTURE_RGB 0x3039
+-#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
+-#define EGL_MIN_SWAP_INTERVAL 0x303B
+-#define EGL_MAX_SWAP_INTERVAL 0x303C
+-#define EGL_LUMINANCE_SIZE 0x303D
+-#define EGL_ALPHA_MASK_SIZE 0x303E
+-#define EGL_COLOR_BUFFER_TYPE 0x303F
+-#define EGL_RENDERABLE_TYPE 0x3040
+-#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
+-#define EGL_CONFORMANT 0x3042
+-
+-/* Reserved 0x3041-0x304F for additional config attributes */
+-
+-/* Config attribute values */
+-#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
+-#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
+-#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
+-#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
+-#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
+-
+-/* More config attribute values, for EGL_TEXTURE_FORMAT */
+-#define EGL_NO_TEXTURE 0x305C
+-#define EGL_TEXTURE_RGB 0x305D
+-#define EGL_TEXTURE_RGBA 0x305E
+-#define EGL_TEXTURE_2D 0x305F
+-
+-/* Config attribute mask bits */
+-#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
+-#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
+-#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
+-#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
+-#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
+-#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
+-#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
+-
+-#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
+-#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
+-#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
+-#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
+-
+-/* QueryString targets */
+-#define EGL_VENDOR 0x3053
+-#define EGL_VERSION 0x3054
+-#define EGL_EXTENSIONS 0x3055
+-#define EGL_CLIENT_APIS 0x308D
+-
+-/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
+-#define EGL_HEIGHT 0x3056
+-#define EGL_WIDTH 0x3057
+-#define EGL_LARGEST_PBUFFER 0x3058
+-#define EGL_TEXTURE_FORMAT 0x3080
+-#define EGL_TEXTURE_TARGET 0x3081
+-#define EGL_MIPMAP_TEXTURE 0x3082
+-#define EGL_MIPMAP_LEVEL 0x3083
+-#define EGL_RENDER_BUFFER 0x3086
+-#define EGL_VG_COLORSPACE 0x3087
+-#define EGL_VG_ALPHA_FORMAT 0x3088
+-#define EGL_HORIZONTAL_RESOLUTION 0x3090
+-#define EGL_VERTICAL_RESOLUTION 0x3091
+-#define EGL_PIXEL_ASPECT_RATIO 0x3092
+-#define EGL_SWAP_BEHAVIOR 0x3093
+-#define EGL_MULTISAMPLE_RESOLVE 0x3099
+-
+-/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
+-#define EGL_BACK_BUFFER 0x3084
+-#define EGL_SINGLE_BUFFER 0x3085
+-
+-/* OpenVG color spaces */
+-#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
+-#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
+-
+-/* OpenVG alpha formats */
+-#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
+-#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
+-
+-/* Constant scale factor by which fractional display resolutions &
+- * aspect ratio are scaled when queried as integer values.
+- */
+-#define EGL_DISPLAY_SCALING 10000
+-
+-/* Unknown display resolution/aspect ratio */
+-#define EGL_UNKNOWN ((EGLint)-1)
+-
+-/* Back buffer swap behaviors */
+-#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
+-#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
+-
+-/* CreatePbufferFromClientBuffer buffer types */
+-#define EGL_OPENVG_IMAGE 0x3096
+-
+-/* QueryContext targets */
+-#define EGL_CONTEXT_CLIENT_TYPE 0x3097
+-
+-/* CreateContext attributes */
+-#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+-
+-/* Multisample resolution behaviors */
+-#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
+-#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
+-
+-/* BindAPI/QueryAPI targets */
+-#define EGL_OPENGL_ES_API 0x30A0
+-#define EGL_OPENVG_API 0x30A1
+-#define EGL_OPENGL_API 0x30A2
+-
+-/* GetCurrentSurface targets */
+-#define EGL_DRAW 0x3059
+-#define EGL_READ 0x305A
+-
+-/* WaitNative engines */
+-#define EGL_CORE_NATIVE_ENGINE 0x305B
+-
+-/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
+-#define EGL_COLORSPACE EGL_VG_COLORSPACE
+-#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
+-#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
+-#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
+-#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
+-#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
+-
+-/* EGL extensions must request enum blocks from the Khronos
+- * API Registrar, who maintains the enumerant registry. Submit
+- * a bug in Khronos Bugzilla against task "Registry".
+- */
+-
+-
+-
+-/* EGL Functions */
+-
+-EGLAPI EGLint EGLAPIENTRY eglGetError(void);
+-
+-EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
+-EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
+-EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
+-
+-EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
+-
+-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
+- EGLint config_size, EGLint *num_config);
+-EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
+- EGLConfig *configs, EGLint config_size,
+- EGLint *num_config);
+-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
+- EGLint attribute, EGLint *value);
+-
+-EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
+- EGLNativeWindowType win,
+- const EGLint *attrib_list);
+-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
+- const EGLint *attrib_list);
+-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
+- EGLNativePixmapType pixmap,
+- const EGLint *attrib_list);
+-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
+-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
+- EGLint attribute, EGLint *value);
+-
+-EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
+-EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
+-
+-EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
+-
+-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
+-
+-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
+- EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
+- EGLConfig config, const EGLint *attrib_list);
+-
+-EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
+- EGLint attribute, EGLint value);
+-EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+-
+-
+-EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
+-
+-
+-EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
+- EGLContext share_context,
+- const EGLint *attrib_list);
+-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
+-EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
+- EGLSurface read, EGLContext ctx);
+-
+-EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
+-EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
+-EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
+-EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
+- EGLint attribute, EGLint *value);
+-
+-EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
+-EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
+-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
+-EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
+- EGLNativePixmapType target);
+-
+-/* This is a generic function pointer type, whose name indicates it must
+- * be cast to the proper type *and calling convention* before use.
+- */
+-typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+-
+-/* Now, define eglGetProcAddress using the generic function ptr. type */
+-EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
+- eglGetProcAddress(const char *procname);
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif /* __egl_h_ */
+diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
+deleted file mode 100644
+index 1d68178..0000000
+--- a/include/EGL/eglext.h
++++ /dev/null
+@@ -1,580 +0,0 @@
+-#ifndef __eglext_h_
+-#define __eglext_h_
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-/*
+-** Copyright (c) 2007-2013 The Khronos Group Inc.
+-**
+-** Permission is hereby granted, free of charge, to any person obtaining a
+-** copy of this software and/or associated documentation files (the
+-** "Materials"), to deal in the Materials without restriction, including
+-** without limitation the rights to use, copy, modify, merge, publish,
+-** distribute, sublicense, and/or sell copies of the Materials, and to
+-** permit persons to whom the Materials are 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 Materials.
+-**
+-** THE MATERIALS ARE 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.
+-** 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
+-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+-*/
+-
+-#include <EGL/eglplatform.h>
+-
+-/*************************************************************/
+-
+-/* Header file version number */
+-/* Current version at http://www.khronos.org/registry/egl/ */
+-/* $Revision: 21254 $ on $Date: 2013-04-25 03:11:55 -0700 (Thu, 25 Apr 2013) $ */
+-#define EGL_EGLEXT_VERSION 16
+-
+-#ifndef EGL_KHR_config_attribs
+-#define EGL_KHR_config_attribs 1
+-#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
+-#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
+-#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
+-#endif
+-
+-#ifndef EGL_KHR_lock_surface
+-#define EGL_KHR_lock_surface 1
+-#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
+-#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
+-#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
+-#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
+-#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
+-#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
+-#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
+-#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
+-#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
+-#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
+-#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
+-#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
+-#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
+-#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
+-#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
+-#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
+-#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
+-#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
+-#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
+-#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
+-#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+-EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
+-#endif
+-
+-#ifndef EGL_KHR_image
+-#define EGL_KHR_image 1
+-#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
+-typedef void *EGLImageKHR;
+-#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+-#endif
+-
+-#ifndef EGL_KHR_vg_parent_image
+-#define EGL_KHR_vg_parent_image 1
+-#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
+-#endif
+-
+-#ifndef EGL_KHR_gl_texture_2D_image
+-#define EGL_KHR_gl_texture_2D_image 1
+-#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
+-#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
+-#endif
+-
+-#ifndef EGL_KHR_gl_texture_cubemap_image
+-#define EGL_KHR_gl_texture_cubemap_image 1
+-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
+-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
+-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
+-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
+-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
+-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
+-#endif
+-
+-#ifndef EGL_KHR_gl_texture_3D_image
+-#define EGL_KHR_gl_texture_3D_image 1
+-#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
+-#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
+-#endif
+-
+-#ifndef EGL_KHR_gl_renderbuffer_image
+-#define EGL_KHR_gl_renderbuffer_image 1
+-#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
+-#endif
+-
+-#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
+-#ifndef EGL_KHR_reusable_sync
+-#define EGL_KHR_reusable_sync 1
+-
+-typedef void* EGLSyncKHR;
+-typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+-
+-#define EGL_SYNC_STATUS_KHR 0x30F1
+-#define EGL_SIGNALED_KHR 0x30F2
+-#define EGL_UNSIGNALED_KHR 0x30F3
+-#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+-#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+-#define EGL_SYNC_TYPE_KHR 0x30F7
+-#define EGL_SYNC_REUSABLE_KHR 0x30FA
+-#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
+-#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+-#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
+-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+-#endif
+-#endif
+-
+-#ifndef EGL_KHR_image_base
+-#define EGL_KHR_image_base 1
+-/* Most interfaces defined by EGL_KHR_image_pixmap above */
+-#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
+-#endif
+-
+-#ifndef EGL_KHR_image_pixmap
+-#define EGL_KHR_image_pixmap 1
+-/* Interfaces defined by EGL_KHR_image above */
+-#endif
+-
+-#ifndef EGL_IMG_context_priority
+-#define EGL_IMG_context_priority 1
+-#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+-#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+-#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+-#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+-#endif
+-
+-#ifndef EGL_KHR_lock_surface2
+-#define EGL_KHR_lock_surface2 1
+-#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
+-#endif
+-
+-#ifndef EGL_NV_coverage_sample
+-#define EGL_NV_coverage_sample 1
+-#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+-#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+-#endif
+-
+-#ifndef EGL_NV_depth_nonlinear
+-#define EGL_NV_depth_nonlinear 1
+-#define EGL_DEPTH_ENCODING_NV 0x30E2
+-#define EGL_DEPTH_ENCODING_NONE_NV 0
+-#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+-#endif
+-
+-#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */
+-#ifndef EGL_NV_sync
+-#define EGL_NV_sync 1
+-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+-#define EGL_SYNC_STATUS_NV 0x30E7
+-#define EGL_SIGNALED_NV 0x30E8
+-#define EGL_UNSIGNALED_NV 0x30E9
+-#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
+-#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
+-#define EGL_ALREADY_SIGNALED_NV 0x30EA
+-#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
+-#define EGL_CONDITION_SATISFIED_NV 0x30EC
+-#define EGL_SYNC_TYPE_NV 0x30ED
+-#define EGL_SYNC_CONDITION_NV 0x30EE
+-#define EGL_SYNC_FENCE_NV 0x30EF
+-#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
+-typedef void* EGLSyncNV;
+-typedef khronos_utime_nanoseconds_t EGLTimeNV;
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
+-EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
+-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+-#endif
+-#endif
+-
+-#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
+-#ifndef EGL_KHR_fence_sync
+-#define EGL_KHR_fence_sync 1
+-/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
+-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+-#define EGL_SYNC_CONDITION_KHR 0x30F8
+-#define EGL_SYNC_FENCE_KHR 0x30F9
+-#endif
+-#endif
+-
+-#ifndef EGL_HI_clientpixmap
+-#define EGL_HI_clientpixmap 1
+-
+-/* Surface Attribute */
+-#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
+-/*
+- * Structure representing a client pixmap
+- * (pixmap's data is in client-space memory).
+- */
+-struct EGLClientPixmapHI
+-{
+- void* pData;
+- EGLint iWidth;
+- EGLint iHeight;
+- EGLint iStride;
+-};
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
+-#endif /* EGL_HI_clientpixmap */
+-
+-#ifndef EGL_HI_colorformats
+-#define EGL_HI_colorformats 1
+-/* Config Attribute */
+-#define EGL_COLOR_FORMAT_HI 0x8F70
+-/* Color Formats */
+-#define EGL_COLOR_RGB_HI 0x8F71
+-#define EGL_COLOR_RGBA_HI 0x8F72
+-#define EGL_COLOR_ARGB_HI 0x8F73
+-#endif /* EGL_HI_colorformats */
+-
+-#ifndef EGL_MESA_drm_image
+-#define EGL_MESA_drm_image 1
+-#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */
+-#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */
+-#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */
+-#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */
+-#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
+-#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */
+-#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
+-EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+-#endif
+-
+-#ifndef EGL_NV_post_sub_buffer
+-#define EGL_NV_post_sub_buffer 1
+-#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+-#endif
+-
+-#ifndef EGL_ANGLE_query_surface_pointer
+-#define EGL_ANGLE_query_surface_pointer 1
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+-#endif
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+-#endif
+-
+-#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
+-#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
+-#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
+-#endif
+-
+-#ifndef EGL_NV_coverage_sample_resolve
+-#define EGL_NV_coverage_sample_resolve 1
+-#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
+-#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
+-#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
+-#endif
+-
+-#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
+-#ifndef EGL_NV_system_time
+-#define EGL_NV_system_time 1
+-typedef khronos_utime_nanoseconds_t EGLuint64NV;
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
+-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
+-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
+-#endif
+-#endif
+-
+-#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
+-#ifndef EGL_KHR_stream
+-#define EGL_KHR_stream 1
+-typedef void* EGLStreamKHR;
+-typedef khronos_uint64_t EGLuint64KHR;
+-#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
+-#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
+-#define EGL_PRODUCER_FRAME_KHR 0x3212
+-#define EGL_CONSUMER_FRAME_KHR 0x3213
+-#define EGL_STREAM_STATE_KHR 0x3214
+-#define EGL_STREAM_STATE_CREATED_KHR 0x3215
+-#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
+-#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
+-#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
+-#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
+-#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
+-#define EGL_BAD_STREAM_KHR 0x321B
+-#define EGL_BAD_STATE_KHR 0x321C
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
+-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
+-EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+-#endif
+-#endif
+-
+-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+-#ifndef EGL_KHR_stream_consumer_gltexture
+-#define EGL_KHR_stream_consumer_gltexture 1
+-#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream);
+-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
+-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+-#endif
+-#endif
+-
+-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+-#ifndef EGL_KHR_stream_producer_eglsurface
+-#define EGL_KHR_stream_producer_eglsurface 1
+-#define EGL_STREAM_BIT_KHR 0x0800
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+-#endif
+-#endif
+-
+-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+-#ifndef EGL_KHR_stream_producer_aldatalocator
+-#define EGL_KHR_stream_producer_aldatalocator 1
+-#endif
+-#endif
+-
+-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+-#ifndef EGL_KHR_stream_fifo
+-#define EGL_KHR_stream_fifo 1
+-/* reuse EGLTimeKHR */
+-#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
+-#define EGL_STREAM_TIME_NOW_KHR 0x31FD
+-#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
+-#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+-#endif
+-#endif
+-
+-#ifndef EGL_EXT_create_context_robustness
+-#define EGL_EXT_create_context_robustness 1
+-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
+-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
+-#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
+-#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
+-#endif
+-
+-#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
+-#define EGL_ANGLE_d3d_share_handle_client_buffer 1
+-/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */
+-#endif
+-
+-#ifndef EGL_KHR_create_context
+-#define EGL_KHR_create_context 1
+-#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
+-#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
+-#define EGL_CONTEXT_FLAGS_KHR 0x30FC
+-#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
+-#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
+-#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
+-#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
+-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+-#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
+-#endif
+-
+-#ifndef EGL_KHR_surfaceless_context
+-#define EGL_KHR_surfaceless_context 1
+-/* No tokens/entry points, just relaxes an error condition */
+-#endif
+-
+-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+-#ifndef EGL_KHR_stream_cross_process_fd
+-#define EGL_KHR_stream_cross_process_fd 1
+-typedef int EGLNativeFileDescriptorKHR;
+-#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream);
+-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+-#endif
+-#endif
+-
+-#ifndef EGL_EXT_multiview_window
+-#define EGL_EXT_multiview_window 1
+-#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
+-#endif
+-
+-#ifndef EGL_KHR_wait_sync
+-#define EGL_KHR_wait_sync 1
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+-#endif
+-
+-#ifndef EGL_NV_post_convert_rounding
+-#define EGL_NV_post_convert_rounding 1
+-/* No tokens or entry points, just relaxes behavior of SwapBuffers */
+-#endif
+-
+-#ifndef EGL_NV_native_query
+-#define EGL_NV_native_query 1
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV( EGLDisplay dpy, EGLNativeDisplayType* display_id);
+-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV( EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType* window);
+-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV( EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType* pixmap);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC)(EGLDisplay dpy, EGLNativeDisplayType *display_id);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+-#endif
+-
+-#ifndef EGL_NV_3dvision_surface
+-#define EGL_NV_3dvision_surface 1
+-#define EGL_AUTO_STEREO_NV 0x3136
+-#endif
+-
+-#ifndef EGL_ANDROID_framebuffer_target
+-#define EGL_ANDROID_framebuffer_target 1
+-#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
+-#endif
+-
+-#ifndef EGL_ANDROID_blob_cache
+-#define EGL_ANDROID_blob_cache 1
+-typedef khronos_ssize_t EGLsizeiANDROID;
+-typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
+-typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+-#endif
+-
+-#ifndef EGL_ANDROID_image_native_buffer
+-#define EGL_ANDROID_image_native_buffer 1
+-#define EGL_NATIVE_BUFFER_ANDROID 0x3140
+-#endif
+-
+-#ifndef EGL_ANDROID_native_fence_sync
+-#define EGL_ANDROID_native_fence_sync 1
+-#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
+-#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
+-#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
+-#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID( EGLDisplay dpy, EGLSyncKHR);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC)(EGLDisplay dpy, EGLSyncKHR);
+-#endif
+-
+-#ifndef EGL_ANDROID_recordable
+-#define EGL_ANDROID_recordable 1
+-#define EGL_RECORDABLE_ANDROID 0x3142
+-#endif
+-
+-#ifndef EGL_EXT_buffer_age
+-#define EGL_EXT_buffer_age 1
+-#define EGL_BUFFER_AGE_EXT 0x313D
+-#endif
+-
+-#ifndef EGL_EXT_image_dma_buf_import
+-#define EGL_EXT_image_dma_buf_import 1
+-#define EGL_LINUX_DMA_BUF_EXT 0x3270
+-#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
+-#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
+-#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
+-#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
+-#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
+-#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
+-#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
+-#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
+-#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
+-#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
+-#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
+-#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
+-#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
+-#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
+-#define EGL_ITU_REC601_EXT 0x327F
+-#define EGL_ITU_REC709_EXT 0x3280
+-#define EGL_ITU_REC2020_EXT 0x3281
+-#define EGL_YUV_FULL_RANGE_EXT 0x3282
+-#define EGL_YUV_NARROW_RANGE_EXT 0x3283
+-#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
+-#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
+-#endif
+-
+-#ifndef EGL_ARM_pixmap_multisample_discard
+-#define EGL_ARM_pixmap_multisample_discard 1
+-#define EGL_DISCARD_SAMPLES_ARM 0x3286
+-#endif
+-
+-#ifndef EGL_EXT_swap_buffers_with_damage
+-#define EGL_EXT_swap_buffers_with_damage 1
+-#ifdef EGL_EGLEXT_PROTOTYPES
+-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT( EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+-#endif /* EGL_EGLEXT_PROTOTYPES */
+-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+-#endif
+-
+-#include <EGL/eglmesaext.h>
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif /* __eglext_h_ */
+diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
+deleted file mode 100644
+index 58ee2a6..0000000
+--- a/include/EGL/eglplatform.h
++++ /dev/null
+@@ -1,105 +0,0 @@
+-#ifndef __eglplatform_h_
+-#define __eglplatform_h_
+-
+-/*
+-** Copyright (c) 2007-2009 The Khronos Group Inc.
+-**
+-** Permission is hereby granted, free of charge, to any person obtaining a
+-** copy of this software and/or associated documentation files (the
+-** "Materials"), to deal in the Materials without restriction, including
+-** without limitation the rights to use, copy, modify, merge, publish,
+-** distribute, sublicense, and/or sell copies of the Materials, and to
+-** permit persons to whom the Materials are 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 Materials.
+-**
+-** THE MATERIALS ARE 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.
+-** 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
+-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+-*/
+-
+-/* Platform-specific types and definitions for egl.h
+- * $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
+- *
+- * Adopters may modify khrplatform.h and this file to suit their platform.
+- * You are encouraged to submit all modifications to the Khronos group so that
+- * they can be included in future versions of this file. Please submit changes
+- * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+- * by filing a bug against product "EGL" component "Registry".
+- */
+-
+-#include <KHR/khrplatform.h>
+-
+-/* Macros used in EGL function prototype declarations.
+- *
+- * EGL functions should be prototyped as:
+- *
+- * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
+- * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
+- *
+- * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
+- */
+-
+-#ifndef EGLAPI
+-#define EGLAPI KHRONOS_APICALL
+-#endif
+-
+-#ifndef EGLAPIENTRY
+-#define EGLAPIENTRY KHRONOS_APIENTRY
+-#endif
+-#define EGLAPIENTRYP EGLAPIENTRY*
+-
+-/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
+- * are aliases of window-system-dependent types, such as X Display * or
+- * Windows Device Context. They must be defined in platform-specific
+- * code below. The EGL-prefixed versions of Native*Type are the same
+- * types, renamed in EGL 1.3 so all types in the API start with "EGL".
+- *
+- * Khronos STRONGLY RECOMMENDS that you use the default definitions
+- * provided below, since these changes affect both binary and source
+- * portability of applications using EGL running on different EGL
+- * implementations.
+- */
+-
+-#if defined(WL_EGL_PLATFORM)
+-
+-typedef struct wl_display *EGLNativeDisplayType;
+-typedef struct wl_egl_pixmap *EGLNativePixmapType;
+-typedef struct wl_egl_window *EGLNativeWindowType;
+-
+-#elif defined(__GBM__)
+-
+-typedef struct gbm_device *EGLNativeDisplayType;
+-typedef struct gbm_bo *EGLNativePixmapType;
+-typedef void *EGLNativeWindowType;
+-
+-#else
+-
+-typedef void *EGLNativeDisplayType;
+-typedef khronos_uintptr_t EGLNativePixmapType;
+-typedef khronos_uintptr_t EGLNativeWindowType;
+-
+-#endif
+-
+-/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
+-typedef EGLNativeDisplayType NativeDisplayType;
+-typedef EGLNativePixmapType NativePixmapType;
+-typedef EGLNativeWindowType NativeWindowType;
+-
+-
+-/* Define EGLint. This must be a signed integral type large enough to contain
+- * all legal attribute names and values passed into and out of EGL, whether
+- * their type is boolean, bitmask, enumerant (symbolic constant), integer,
+- * handle, or other. While in general a 32-bit integer will suffice, if
+- * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
+- * integer type.
+- */
+-typedef khronos_int32_t EGLint;
+-
+-#endif /* __eglplatform_h */
+diff --git a/include/GLES2/gl2.h b/include/GLES2/gl2.h
+deleted file mode 100644
+index c2d8357..0000000
+--- a/include/GLES2/gl2.h
++++ /dev/null
+@@ -1,620 +0,0 @@
+-#ifndef __gl2_h_
+-#define __gl2_h_
+-
+-/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */
+-
+-#include <GLES2/gl2platform.h>
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-/*
+- * This document is licensed under the SGI Free Software B License Version
+- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+- */
+-
+-/*-------------------------------------------------------------------------
+- * Data type definitions
+- *-----------------------------------------------------------------------*/
+-
+-typedef void GLvoid;
+-typedef char GLchar;
+-typedef unsigned int GLenum;
+-typedef unsigned char GLboolean;
+-typedef unsigned int GLbitfield;
+-typedef khronos_int8_t GLbyte;
+-typedef short GLshort;
+-typedef int GLint;
+-typedef int GLsizei;
+-typedef khronos_uint8_t GLubyte;
+-typedef unsigned short GLushort;
+-typedef unsigned int GLuint;
+-typedef khronos_float_t GLfloat;
+-typedef khronos_float_t GLclampf;
+-typedef khronos_int32_t GLfixed;
+-
+-/* GL types for handling large vertex buffer objects */
+-typedef khronos_intptr_t GLintptr;
+-typedef khronos_ssize_t GLsizeiptr;
+-
+-/* OpenGL ES core versions */
+-#define GL_ES_VERSION_2_0 1
+-
+-/* ClearBufferMask */
+-#define GL_DEPTH_BUFFER_BIT 0x00000100
+-#define GL_STENCIL_BUFFER_BIT 0x00000400
+-#define GL_COLOR_BUFFER_BIT 0x00004000
+-
+-/* Boolean */
+-#define GL_FALSE 0
+-#define GL_TRUE 1
+-
+-/* BeginMode */
+-#define GL_POINTS 0x0000
+-#define GL_LINES 0x0001
+-#define GL_LINE_LOOP 0x0002
+-#define GL_LINE_STRIP 0x0003
+-#define GL_TRIANGLES 0x0004
+-#define GL_TRIANGLE_STRIP 0x0005
+-#define GL_TRIANGLE_FAN 0x0006
+-
+-/* AlphaFunction (not supported in ES20) */
+-/* GL_NEVER */
+-/* GL_LESS */
+-/* GL_EQUAL */
+-/* GL_LEQUAL */
+-/* GL_GREATER */
+-/* GL_NOTEQUAL */
+-/* GL_GEQUAL */
+-/* GL_ALWAYS */
+-
+-/* BlendingFactorDest */
+-#define GL_ZERO 0
+-#define GL_ONE 1
+-#define GL_SRC_COLOR 0x0300
+-#define GL_ONE_MINUS_SRC_COLOR 0x0301
+-#define GL_SRC_ALPHA 0x0302
+-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+-#define GL_DST_ALPHA 0x0304
+-#define GL_ONE_MINUS_DST_ALPHA 0x0305
+-
+-/* BlendingFactorSrc */
+-/* GL_ZERO */
+-/* GL_ONE */
+-#define GL_DST_COLOR 0x0306
+-#define GL_ONE_MINUS_DST_COLOR 0x0307
+-#define GL_SRC_ALPHA_SATURATE 0x0308
+-/* GL_SRC_ALPHA */
+-/* GL_ONE_MINUS_SRC_ALPHA */
+-/* GL_DST_ALPHA */
+-/* GL_ONE_MINUS_DST_ALPHA */
+-
+-/* BlendEquationSeparate */
+-#define GL_FUNC_ADD 0x8006
+-#define GL_BLEND_EQUATION 0x8009
+-#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
+-#define GL_BLEND_EQUATION_ALPHA 0x883D
+-
+-/* BlendSubtract */
+-#define GL_FUNC_SUBTRACT 0x800A
+-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+-
+-/* Separate Blend Functions */
+-#define GL_BLEND_DST_RGB 0x80C8
+-#define GL_BLEND_SRC_RGB 0x80C9
+-#define GL_BLEND_DST_ALPHA 0x80CA
+-#define GL_BLEND_SRC_ALPHA 0x80CB
+-#define GL_CONSTANT_COLOR 0x8001
+-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+-#define GL_CONSTANT_ALPHA 0x8003
+-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+-#define GL_BLEND_COLOR 0x8005
+-
+-/* Buffer Objects */
+-#define GL_ARRAY_BUFFER 0x8892
+-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+-#define GL_ARRAY_BUFFER_BINDING 0x8894
+-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+-
+-#define GL_STREAM_DRAW 0x88E0
+-#define GL_STATIC_DRAW 0x88E4
+-#define GL_DYNAMIC_DRAW 0x88E8
+-
+-#define GL_BUFFER_SIZE 0x8764
+-#define GL_BUFFER_USAGE 0x8765
+-
+-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+-
+-/* CullFaceMode */
+-#define GL_FRONT 0x0404
+-#define GL_BACK 0x0405
+-#define GL_FRONT_AND_BACK 0x0408
+-
+-/* DepthFunction */
+-/* GL_NEVER */
+-/* GL_LESS */
+-/* GL_EQUAL */
+-/* GL_LEQUAL */
+-/* GL_GREATER */
+-/* GL_NOTEQUAL */
+-/* GL_GEQUAL */
+-/* GL_ALWAYS */
+-
+-/* EnableCap */
+-#define GL_TEXTURE_2D 0x0DE1
+-#define GL_CULL_FACE 0x0B44
+-#define GL_BLEND 0x0BE2
+-#define GL_DITHER 0x0BD0
+-#define GL_STENCIL_TEST 0x0B90
+-#define GL_DEPTH_TEST 0x0B71
+-#define GL_SCISSOR_TEST 0x0C11
+-#define GL_POLYGON_OFFSET_FILL 0x8037
+-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+-#define GL_SAMPLE_COVERAGE 0x80A0
+-
+-/* ErrorCode */
+-#define GL_NO_ERROR 0
+-#define GL_INVALID_ENUM 0x0500
+-#define GL_INVALID_VALUE 0x0501
+-#define GL_INVALID_OPERATION 0x0502
+-#define GL_OUT_OF_MEMORY 0x0505
+-
+-/* FrontFaceDirection */
+-#define GL_CW 0x0900
+-#define GL_CCW 0x0901
+-
+-/* GetPName */
+-#define GL_LINE_WIDTH 0x0B21
+-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+-#define GL_CULL_FACE_MODE 0x0B45
+-#define GL_FRONT_FACE 0x0B46
+-#define GL_DEPTH_RANGE 0x0B70
+-#define GL_DEPTH_WRITEMASK 0x0B72
+-#define GL_DEPTH_CLEAR_VALUE 0x0B73
+-#define GL_DEPTH_FUNC 0x0B74
+-#define GL_STENCIL_CLEAR_VALUE 0x0B91
+-#define GL_STENCIL_FUNC 0x0B92
+-#define GL_STENCIL_FAIL 0x0B94
+-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+-#define GL_STENCIL_REF 0x0B97
+-#define GL_STENCIL_VALUE_MASK 0x0B93
+-#define GL_STENCIL_WRITEMASK 0x0B98
+-#define GL_STENCIL_BACK_FUNC 0x8800
+-#define GL_STENCIL_BACK_FAIL 0x8801
+-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+-#define GL_STENCIL_BACK_REF 0x8CA3
+-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+-#define GL_VIEWPORT 0x0BA2
+-#define GL_SCISSOR_BOX 0x0C10
+-/* GL_SCISSOR_TEST */
+-#define GL_COLOR_CLEAR_VALUE 0x0C22
+-#define GL_COLOR_WRITEMASK 0x0C23
+-#define GL_UNPACK_ALIGNMENT 0x0CF5
+-#define GL_PACK_ALIGNMENT 0x0D05
+-#define GL_MAX_TEXTURE_SIZE 0x0D33
+-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+-#define GL_SUBPIXEL_BITS 0x0D50
+-#define GL_RED_BITS 0x0D52
+-#define GL_GREEN_BITS 0x0D53
+-#define GL_BLUE_BITS 0x0D54
+-#define GL_ALPHA_BITS 0x0D55
+-#define GL_DEPTH_BITS 0x0D56
+-#define GL_STENCIL_BITS 0x0D57
+-#define GL_POLYGON_OFFSET_UNITS 0x2A00
+-/* GL_POLYGON_OFFSET_FILL */
+-#define GL_POLYGON_OFFSET_FACTOR 0x8038
+-#define GL_TEXTURE_BINDING_2D 0x8069
+-#define GL_SAMPLE_BUFFERS 0x80A8
+-#define GL_SAMPLES 0x80A9
+-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+-
+-/* GetTextureParameter */
+-/* GL_TEXTURE_MAG_FILTER */
+-/* GL_TEXTURE_MIN_FILTER */
+-/* GL_TEXTURE_WRAP_S */
+-/* GL_TEXTURE_WRAP_T */
+-
+-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+-
+-/* HintMode */
+-#define GL_DONT_CARE 0x1100
+-#define GL_FASTEST 0x1101
+-#define GL_NICEST 0x1102
+-
+-/* HintTarget */
+-#define GL_GENERATE_MIPMAP_HINT 0x8192
+-
+-/* DataType */
+-#define GL_BYTE 0x1400
+-#define GL_UNSIGNED_BYTE 0x1401
+-#define GL_SHORT 0x1402
+-#define GL_UNSIGNED_SHORT 0x1403
+-#define GL_INT 0x1404
+-#define GL_UNSIGNED_INT 0x1405
+-#define GL_FLOAT 0x1406
+-#define GL_FIXED 0x140C
+-
+-/* PixelFormat */
+-#define GL_DEPTH_COMPONENT 0x1902
+-#define GL_ALPHA 0x1906
+-#define GL_RGB 0x1907
+-#define GL_RGBA 0x1908
+-#define GL_LUMINANCE 0x1909
+-#define GL_LUMINANCE_ALPHA 0x190A
+-
+-/* PixelType */
+-/* GL_UNSIGNED_BYTE */
+-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+-
+-/* Shaders */
+-#define GL_FRAGMENT_SHADER 0x8B30
+-#define GL_VERTEX_SHADER 0x8B31
+-#define GL_MAX_VERTEX_ATTRIBS 0x8869
+-#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+-#define GL_MAX_VARYING_VECTORS 0x8DFC
+-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+-#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+-#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+-#define GL_SHADER_TYPE 0x8B4F
+-#define GL_DELETE_STATUS 0x8B80
+-#define GL_LINK_STATUS 0x8B82
+-#define GL_VALIDATE_STATUS 0x8B83
+-#define GL_ATTACHED_SHADERS 0x8B85
+-#define GL_ACTIVE_UNIFORMS 0x8B86
+-#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+-#define GL_ACTIVE_ATTRIBUTES 0x8B89
+-#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+-#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+-#define GL_CURRENT_PROGRAM 0x8B8D
+-
+-/* StencilFunction */
+-#define GL_NEVER 0x0200
+-#define GL_LESS 0x0201
+-#define GL_EQUAL 0x0202
+-#define GL_LEQUAL 0x0203
+-#define GL_GREATER 0x0204
+-#define GL_NOTEQUAL 0x0205
+-#define GL_GEQUAL 0x0206
+-#define GL_ALWAYS 0x0207
+-
+-/* StencilOp */
+-/* GL_ZERO */
+-#define GL_KEEP 0x1E00
+-#define GL_REPLACE 0x1E01
+-#define GL_INCR 0x1E02
+-#define GL_DECR 0x1E03
+-#define GL_INVERT 0x150A
+-#define GL_INCR_WRAP 0x8507
+-#define GL_DECR_WRAP 0x8508
+-
+-/* StringName */
+-#define GL_VENDOR 0x1F00
+-#define GL_RENDERER 0x1F01
+-#define GL_VERSION 0x1F02
+-#define GL_EXTENSIONS 0x1F03
+-
+-/* TextureMagFilter */
+-#define GL_NEAREST 0x2600
+-#define GL_LINEAR 0x2601
+-
+-/* TextureMinFilter */
+-/* GL_NEAREST */
+-/* GL_LINEAR */
+-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+-
+-/* TextureParameterName */
+-#define GL_TEXTURE_MAG_FILTER 0x2800
+-#define GL_TEXTURE_MIN_FILTER 0x2801
+-#define GL_TEXTURE_WRAP_S 0x2802
+-#define GL_TEXTURE_WRAP_T 0x2803
+-
+-/* TextureTarget */
+-/* GL_TEXTURE_2D */
+-#define GL_TEXTURE 0x1702
+-
+-#define GL_TEXTURE_CUBE_MAP 0x8513
+-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+-
+-/* TextureUnit */
+-#define GL_TEXTURE0 0x84C0
+-#define GL_TEXTURE1 0x84C1
+-#define GL_TEXTURE2 0x84C2
+-#define GL_TEXTURE3 0x84C3
+-#define GL_TEXTURE4 0x84C4
+-#define GL_TEXTURE5 0x84C5
+-#define GL_TEXTURE6 0x84C6
+-#define GL_TEXTURE7 0x84C7
+-#define GL_TEXTURE8 0x84C8
+-#define GL_TEXTURE9 0x84C9
+-#define GL_TEXTURE10 0x84CA
+-#define GL_TEXTURE11 0x84CB
+-#define GL_TEXTURE12 0x84CC
+-#define GL_TEXTURE13 0x84CD
+-#define GL_TEXTURE14 0x84CE
+-#define GL_TEXTURE15 0x84CF
+-#define GL_TEXTURE16 0x84D0
+-#define GL_TEXTURE17 0x84D1
+-#define GL_TEXTURE18 0x84D2
+-#define GL_TEXTURE19 0x84D3
+-#define GL_TEXTURE20 0x84D4
+-#define GL_TEXTURE21 0x84D5
+-#define GL_TEXTURE22 0x84D6
+-#define GL_TEXTURE23 0x84D7
+-#define GL_TEXTURE24 0x84D8
+-#define GL_TEXTURE25 0x84D9
+-#define GL_TEXTURE26 0x84DA
+-#define GL_TEXTURE27 0x84DB
+-#define GL_TEXTURE28 0x84DC
+-#define GL_TEXTURE29 0x84DD
+-#define GL_TEXTURE30 0x84DE
+-#define GL_TEXTURE31 0x84DF
+-#define GL_ACTIVE_TEXTURE 0x84E0
+-
+-/* TextureWrapMode */
+-#define GL_REPEAT 0x2901
+-#define GL_CLAMP_TO_EDGE 0x812F
+-#define GL_MIRRORED_REPEAT 0x8370
+-
+-/* Uniform Types */
+-#define GL_FLOAT_VEC2 0x8B50
+-#define GL_FLOAT_VEC3 0x8B51
+-#define GL_FLOAT_VEC4 0x8B52
+-#define GL_INT_VEC2 0x8B53
+-#define GL_INT_VEC3 0x8B54
+-#define GL_INT_VEC4 0x8B55
+-#define GL_BOOL 0x8B56
+-#define GL_BOOL_VEC2 0x8B57
+-#define GL_BOOL_VEC3 0x8B58
+-#define GL_BOOL_VEC4 0x8B59
+-#define GL_FLOAT_MAT2 0x8B5A
+-#define GL_FLOAT_MAT3 0x8B5B
+-#define GL_FLOAT_MAT4 0x8B5C
+-#define GL_SAMPLER_2D 0x8B5E
+-#define GL_SAMPLER_CUBE 0x8B60
+-
+-/* Vertex Arrays */
+-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+-#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+-#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+-#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+-
+-/* Read Format */
+-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+-
+-/* Shader Source */
+-#define GL_COMPILE_STATUS 0x8B81
+-#define GL_INFO_LOG_LENGTH 0x8B84
+-#define GL_SHADER_SOURCE_LENGTH 0x8B88
+-#define GL_SHADER_COMPILER 0x8DFA
+-
+-/* Shader Binary */
+-#define GL_SHADER_BINARY_FORMATS 0x8DF8
+-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+-
+-/* Shader Precision-Specified Types */
+-#define GL_LOW_FLOAT 0x8DF0
+-#define GL_MEDIUM_FLOAT 0x8DF1
+-#define GL_HIGH_FLOAT 0x8DF2
+-#define GL_LOW_INT 0x8DF3
+-#define GL_MEDIUM_INT 0x8DF4
+-#define GL_HIGH_INT 0x8DF5
+-
+-/* Framebuffer Object. */
+-#define GL_FRAMEBUFFER 0x8D40
+-#define GL_RENDERBUFFER 0x8D41
+-
+-#define GL_RGBA4 0x8056
+-#define GL_RGB5_A1 0x8057
+-#define GL_RGB565 0x8D62
+-#define GL_DEPTH_COMPONENT16 0x81A5
+-#define GL_STENCIL_INDEX8 0x8D48
+-
+-#define GL_RENDERBUFFER_WIDTH 0x8D42
+-#define GL_RENDERBUFFER_HEIGHT 0x8D43
+-#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+-#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+-#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+-#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+-#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+-#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+-#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+-
+-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+-
+-#define GL_COLOR_ATTACHMENT0 0x8CE0
+-#define GL_DEPTH_ATTACHMENT 0x8D00
+-#define GL_STENCIL_ATTACHMENT 0x8D20
+-
+-#define GL_NONE 0
+-
+-#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+-#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+-
+-#define GL_FRAMEBUFFER_BINDING 0x8CA6
+-#define GL_RENDERBUFFER_BINDING 0x8CA7
+-#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+-
+-#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+-
+-/*-------------------------------------------------------------------------
+- * GL core functions.
+- *-----------------------------------------------------------------------*/
+-
+-GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+-GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+-GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
+-GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+-GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+-GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+-GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+-GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+-GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
+-GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+-GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+-GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+-GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
+-GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
+-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+-GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+-GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+-GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
+-GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+-GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+-GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+-GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
+-GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
+-GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+-GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+-GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+-GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+-GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+-GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
+-GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
+-GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+-GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
+-GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+-GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
+-GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+-GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+-GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
+-GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+-GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+-GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+-GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+-GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
+-GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+-GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+-GL_APICALL void GL_APIENTRY glFinish (void);
+-GL_APICALL void GL_APIENTRY glFlush (void);
+-GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+-GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+-GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+-GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
+-GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+-GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
+-GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
+-GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
+-GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+-GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+-GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+-GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
+-GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
+-GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
+-GL_APICALL GLenum GL_APIENTRY glGetError (void);
+-GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
+-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+-GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
+-GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
+-GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+-GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
+-GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
+-GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+-GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+-GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
+-GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
+-GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
+-GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
+-GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
+-GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
+-GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
+-GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
+-GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
+-GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
+-GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+-GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+-GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+-GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+-GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+-GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+-GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+-GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+-GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+-GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+-GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+-GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+-GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
+-GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+-GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+-GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
+-GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+-GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
+-GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
+-GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+-GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+-GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+-GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+-GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+-GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+-GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+-GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+-GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
+-GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+-GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
+-GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
+-GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
+-GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
+-GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
+-GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
+-GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
+-GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
+-GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
+-GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
+-GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
+-GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
+-GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
+-GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
+-GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+-GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
+-GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
+-GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
+-GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+-GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+-GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+-GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+-GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+-GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
+-GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
+-GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
+-GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
+-GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+-GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
+-GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+-GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
+-GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
+-GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif /* __gl2_h_ */
+diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
+deleted file mode 100644
+index 4ac971a..0000000
+--- a/include/GLES2/gl2ext.h
++++ /dev/null
+@@ -1,2051 +0,0 @@
+-#ifndef __gl2ext_h_
+-#define __gl2ext_h_
+-
+-/* $Revision: 22161 $ on $Date:: 2013-06-25 08:17:27 -0700 #$ */
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-/*
+- * This document is licensed under the SGI Free Software B License Version
+- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+- */
+-
+-#ifndef GL_APIENTRYP
+-# define GL_APIENTRYP GL_APIENTRY*
+-#endif
+-
+-/* New types shared by several extensions */
+-
+-#ifndef __gl3_h_
+-/* These are defined with respect to <inttypes.h> in the
+- * Apple extension spec, but they are also used by non-APPLE
+- * extensions, and in the Khronos header we use the Khronos
+- * portable types in khrplatform.h, which must be defined.
+- */
+-typedef khronos_int64_t GLint64;
+-typedef khronos_uint64_t GLuint64;
+-typedef struct __GLsync *GLsync;
+-#endif
+-
+-
+-/*------------------------------------------------------------------------*
+- * OES extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_OES_compressed_ETC1_RGB8_texture */
+-#ifndef GL_OES_compressed_ETC1_RGB8_texture
+-#define GL_ETC1_RGB8_OES 0x8D64
+-#endif
+-
+-/* GL_OES_compressed_paletted_texture */
+-#ifndef GL_OES_compressed_paletted_texture
+-#define GL_PALETTE4_RGB8_OES 0x8B90
+-#define GL_PALETTE4_RGBA8_OES 0x8B91
+-#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+-#define GL_PALETTE4_RGBA4_OES 0x8B93
+-#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+-#define GL_PALETTE8_RGB8_OES 0x8B95
+-#define GL_PALETTE8_RGBA8_OES 0x8B96
+-#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+-#define GL_PALETTE8_RGBA4_OES 0x8B98
+-#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+-#endif
+-
+-/* GL_OES_depth24 */
+-#ifndef GL_OES_depth24
+-#define GL_DEPTH_COMPONENT24_OES 0x81A6
+-#endif
+-
+-/* GL_OES_depth32 */
+-#ifndef GL_OES_depth32
+-#define GL_DEPTH_COMPONENT32_OES 0x81A7
+-#endif
+-
+-/* GL_OES_depth_texture */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_OES_EGL_image */
+-#ifndef GL_OES_EGL_image
+-typedef void* GLeglImageOES;
+-#endif
+-
+-/* GL_OES_EGL_image_external */
+-#ifndef GL_OES_EGL_image_external
+-/* GLeglImageOES defined in GL_OES_EGL_image already. */
+-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
+-#define GL_SAMPLER_EXTERNAL_OES 0x8D66
+-#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
+-#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
+-#endif
+-
+-/* GL_OES_element_index_uint */
+-#ifndef GL_OES_element_index_uint
+-#define GL_UNSIGNED_INT 0x1405
+-#endif
+-
+-/* GL_OES_get_program_binary */
+-#ifndef GL_OES_get_program_binary
+-#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
+-#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
+-#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
+-#endif
+-
+-/* GL_OES_mapbuffer */
+-#ifndef GL_OES_mapbuffer
+-#define GL_WRITE_ONLY_OES 0x88B9
+-#define GL_BUFFER_ACCESS_OES 0x88BB
+-#define GL_BUFFER_MAPPED_OES 0x88BC
+-#define GL_BUFFER_MAP_POINTER_OES 0x88BD
+-#endif
+-
+-/* GL_OES_packed_depth_stencil */
+-#ifndef GL_OES_packed_depth_stencil
+-#define GL_DEPTH_STENCIL_OES 0x84F9
+-#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+-#define GL_DEPTH24_STENCIL8_OES 0x88F0
+-#endif
+-
+-/* GL_OES_required_internalformat */
+-#ifndef GL_OES_required_internalformat
+-#define GL_ALPHA8_OES 0x803C
+-#define GL_DEPTH_COMPONENT16_OES 0x81A5
+-/* reuse GL_DEPTH_COMPONENT24_OES */
+-/* reuse GL_DEPTH24_STENCIL8_OES */
+-/* reuse GL_DEPTH_COMPONENT32_OES */
+-#define GL_LUMINANCE4_ALPHA4_OES 0x8043
+-#define GL_LUMINANCE8_ALPHA8_OES 0x8045
+-#define GL_LUMINANCE8_OES 0x8040
+-#define GL_RGBA4_OES 0x8056
+-#define GL_RGB5_A1_OES 0x8057
+-#define GL_RGB565_OES 0x8D62
+-/* reuse GL_RGB8_OES */
+-/* reuse GL_RGBA8_OES */
+-/* reuse GL_RGB10_EXT */
+-/* reuse GL_RGB10_A2_EXT */
+-#endif
+-
+-/* GL_OES_rgb8_rgba8 */
+-#ifndef GL_OES_rgb8_rgba8
+-#define GL_RGB8_OES 0x8051
+-#define GL_RGBA8_OES 0x8058
+-#endif
+-
+-/* GL_OES_standard_derivatives */
+-#ifndef GL_OES_standard_derivatives
+-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
+-#endif
+-
+-/* GL_OES_stencil1 */
+-#ifndef GL_OES_stencil1
+-#define GL_STENCIL_INDEX1_OES 0x8D46
+-#endif
+-
+-/* GL_OES_stencil4 */
+-#ifndef GL_OES_stencil4
+-#define GL_STENCIL_INDEX4_OES 0x8D47
+-#endif
+-
+-#ifndef GL_OES_surfaceless_context
+-#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
+-#endif
+-
+-/* GL_OES_texture_3D */
+-#ifndef GL_OES_texture_3D
+-#define GL_TEXTURE_WRAP_R_OES 0x8072
+-#define GL_TEXTURE_3D_OES 0x806F
+-#define GL_TEXTURE_BINDING_3D_OES 0x806A
+-#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
+-#define GL_SAMPLER_3D_OES 0x8B5F
+-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
+-#endif
+-
+-/* GL_OES_texture_float */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_OES_texture_float_linear */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_OES_texture_half_float */
+-#ifndef GL_OES_texture_half_float
+-#define GL_HALF_FLOAT_OES 0x8D61
+-#endif
+-
+-/* GL_OES_texture_half_float_linear */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_OES_texture_npot */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_OES_vertex_array_object */
+-#ifndef GL_OES_vertex_array_object
+-#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
+-#endif
+-
+-/* GL_OES_vertex_half_float */
+-/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */
+-
+-/* GL_OES_vertex_type_10_10_10_2 */
+-#ifndef GL_OES_vertex_type_10_10_10_2
+-#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
+-#define GL_INT_10_10_10_2_OES 0x8DF7
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * KHR extension tokens
+- *------------------------------------------------------------------------*/
+-
+-#ifndef GL_KHR_debug
+-typedef void (GL_APIENTRYP GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
+-#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242
+-#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243
+-#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244
+-#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245
+-#define GL_DEBUG_SOURCE_API_KHR 0x8246
+-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247
+-#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248
+-#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249
+-#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A
+-#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B
+-#define GL_DEBUG_TYPE_ERROR_KHR 0x824C
+-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D
+-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E
+-#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F
+-#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250
+-#define GL_DEBUG_TYPE_OTHER_KHR 0x8251
+-#define GL_DEBUG_TYPE_MARKER_KHR 0x8268
+-#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269
+-#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A
+-#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B
+-#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C
+-#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D
+-#define GL_BUFFER_KHR 0x82E0
+-#define GL_SHADER_KHR 0x82E1
+-#define GL_PROGRAM_KHR 0x82E2
+-#define GL_QUERY_KHR 0x82E3
+-/* PROGRAM_PIPELINE only in GL */
+-#define GL_SAMPLER_KHR 0x82E6
+-/* DISPLAY_LIST only in GL */
+-#define GL_MAX_LABEL_LENGTH_KHR 0x82E8
+-#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143
+-#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144
+-#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145
+-#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146
+-#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147
+-#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148
+-#define GL_DEBUG_OUTPUT_KHR 0x92E0
+-#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002
+-#define GL_STACK_OVERFLOW_KHR 0x0503
+-#define GL_STACK_UNDERFLOW_KHR 0x0504
+-#endif
+-
+-#ifndef GL_KHR_texture_compression_astc_ldr
+-#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
+-#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
+-#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
+-#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
+-#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
+-#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
+-#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
+-#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
+-#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
+-#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
+-#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
+-#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
+-#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
+-#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
+-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * AMD extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_AMD_compressed_3DC_texture */
+-#ifndef GL_AMD_compressed_3DC_texture
+-#define GL_3DC_X_AMD 0x87F9
+-#define GL_3DC_XY_AMD 0x87FA
+-#endif
+-
+-/* GL_AMD_compressed_ATC_texture */
+-#ifndef GL_AMD_compressed_ATC_texture
+-#define GL_ATC_RGB_AMD 0x8C92
+-#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+-#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+-#endif
+-
+-/* GL_AMD_performance_monitor */
+-#ifndef GL_AMD_performance_monitor
+-#define GL_COUNTER_TYPE_AMD 0x8BC0
+-#define GL_COUNTER_RANGE_AMD 0x8BC1
+-#define GL_UNSIGNED_INT64_AMD 0x8BC2
+-#define GL_PERCENTAGE_AMD 0x8BC3
+-#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
+-#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
+-#define GL_PERFMON_RESULT_AMD 0x8BC6
+-#endif
+-
+-/* GL_AMD_program_binary_Z400 */
+-#ifndef GL_AMD_program_binary_Z400
+-#define GL_Z400_BINARY_AMD 0x8740
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * ANGLE extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_ANGLE_depth_texture */
+-#ifndef GL_ANGLE_depth_texture
+-#define GL_DEPTH_COMPONENT 0x1902
+-#define GL_DEPTH_STENCIL_OES 0x84F9
+-#define GL_UNSIGNED_SHORT 0x1403
+-#define GL_UNSIGNED_INT 0x1405
+-#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+-#define GL_DEPTH_COMPONENT16 0x81A5
+-#define GL_DEPTH_COMPONENT32_OES 0x81A7
+-#define GL_DEPTH24_STENCIL8_OES 0x88F0
+-#endif
+-
+-/* GL_ANGLE_framebuffer_blit */
+-#ifndef GL_ANGLE_framebuffer_blit
+-#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
+-#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
+-#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
+-#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
+-#endif
+-
+-/* GL_ANGLE_framebuffer_multisample */
+-#ifndef GL_ANGLE_framebuffer_multisample
+-#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
+-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
+-#define GL_MAX_SAMPLES_ANGLE 0x8D57
+-#endif
+-
+-/* GL_ANGLE_instanced_arrays */
+-#ifndef GL_ANGLE_instanced_arrays
+-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
+-#endif
+-
+-/* GL_ANGLE_pack_reverse_row_order */
+-#ifndef GL_ANGLE_pack_reverse_row_order
+-#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
+-#endif
+-
+-/* GL_ANGLE_program_binary */
+-#ifndef GL_ANGLE_program_binary
+-#define GL_PROGRAM_BINARY_ANGLE 0x93A6
+-#endif
+-
+-/* GL_ANGLE_texture_compression_dxt3 */
+-#ifndef GL_ANGLE_texture_compression_dxt3
+-#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
+-#endif
+-
+-/* GL_ANGLE_texture_compression_dxt5 */
+-#ifndef GL_ANGLE_texture_compression_dxt5
+-#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
+-#endif
+-
+-/* GL_ANGLE_texture_usage */
+-#ifndef GL_ANGLE_texture_usage
+-#define GL_TEXTURE_USAGE_ANGLE 0x93A2
+-#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
+-#endif
+-
+-/* GL_ANGLE_translated_shader_source */
+-#ifndef GL_ANGLE_translated_shader_source
+-#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * APPLE extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_APPLE_copy_texture_levels */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_APPLE_framebuffer_multisample */
+-#ifndef GL_APPLE_framebuffer_multisample
+-#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
+-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
+-#define GL_MAX_SAMPLES_APPLE 0x8D57
+-#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
+-#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
+-#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
+-#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
+-#endif
+-
+-/* GL_APPLE_rgb_422 */
+-#ifndef GL_APPLE_rgb_422
+-#define GL_RGB_422_APPLE 0x8A1F
+-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
+-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
+-#endif
+-
+-/* GL_APPLE_sync */
+-#ifndef GL_APPLE_sync
+-
+-#define GL_SYNC_OBJECT_APPLE 0x8A53
+-#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111
+-#define GL_OBJECT_TYPE_APPLE 0x9112
+-#define GL_SYNC_CONDITION_APPLE 0x9113
+-#define GL_SYNC_STATUS_APPLE 0x9114
+-#define GL_SYNC_FLAGS_APPLE 0x9115
+-#define GL_SYNC_FENCE_APPLE 0x9116
+-#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
+-#define GL_UNSIGNALED_APPLE 0x9118
+-#define GL_SIGNALED_APPLE 0x9119
+-#define GL_ALREADY_SIGNALED_APPLE 0x911A
+-#define GL_TIMEOUT_EXPIRED_APPLE 0x911B
+-#define GL_CONDITION_SATISFIED_APPLE 0x911C
+-#define GL_WAIT_FAILED_APPLE 0x911D
+-#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001
+-#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull
+-#endif
+-
+-/* GL_APPLE_texture_format_BGRA8888 */
+-#ifndef GL_APPLE_texture_format_BGRA8888
+-#define GL_BGRA_EXT 0x80E1
+-#endif
+-
+-/* GL_APPLE_texture_max_level */
+-#ifndef GL_APPLE_texture_max_level
+-#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * ARM extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_ARM_mali_program_binary */
+-#ifndef GL_ARM_mali_program_binary
+-#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61
+-#endif
+-
+-/* GL_ARM_mali_shader_binary */
+-#ifndef GL_ARM_mali_shader_binary
+-#define GL_MALI_SHADER_BINARY_ARM 0x8F60
+-#endif
+-
+-/* GL_ARM_rgba8 */
+-/* No new tokens introduced by this extension. */
+-
+-/*------------------------------------------------------------------------*
+- * EXT extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_EXT_blend_minmax */
+-#ifndef GL_EXT_blend_minmax
+-#define GL_MIN_EXT 0x8007
+-#define GL_MAX_EXT 0x8008
+-#endif
+-
+-/* GL_EXT_color_buffer_half_float */
+-#ifndef GL_EXT_color_buffer_half_float
+-#define GL_RGBA16F_EXT 0x881A
+-#define GL_RGB16F_EXT 0x881B
+-#define GL_RG16F_EXT 0x822F
+-#define GL_R16F_EXT 0x822D
+-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
+-#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17
+-#endif
+-
+-/* GL_EXT_debug_label */
+-#ifndef GL_EXT_debug_label
+-#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
+-#define GL_PROGRAM_OBJECT_EXT 0x8B40
+-#define GL_SHADER_OBJECT_EXT 0x8B48
+-#define GL_BUFFER_OBJECT_EXT 0x9151
+-#define GL_QUERY_OBJECT_EXT 0x9153
+-#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
+-#endif
+-
+-/* GL_EXT_debug_marker */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_EXT_discard_framebuffer */
+-#ifndef GL_EXT_discard_framebuffer
+-#define GL_COLOR_EXT 0x1800
+-#define GL_DEPTH_EXT 0x1801
+-#define GL_STENCIL_EXT 0x1802
+-#endif
+-
+-#ifndef GL_EXT_disjoint_timer_query
+-#define GL_QUERY_COUNTER_BITS_EXT 0x8864
+-#define GL_CURRENT_QUERY_EXT 0x8865
+-#define GL_QUERY_RESULT_EXT 0x8866
+-#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
+-#define GL_TIME_ELAPSED_EXT 0x88BF
+-#define GL_TIMESTAMP_EXT 0x8E28
+-#define GL_GPU_DISJOINT_EXT 0x8FBB
+-#endif
+-
+-#ifndef GL_EXT_draw_buffers
+-#define GL_EXT_draw_buffers 1
+-#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
+-#define GL_MAX_DRAW_BUFFERS_EXT 0x8824
+-#define GL_DRAW_BUFFER0_EXT 0x8825
+-#define GL_DRAW_BUFFER1_EXT 0x8826
+-#define GL_DRAW_BUFFER2_EXT 0x8827
+-#define GL_DRAW_BUFFER3_EXT 0x8828
+-#define GL_DRAW_BUFFER4_EXT 0x8829
+-#define GL_DRAW_BUFFER5_EXT 0x882A
+-#define GL_DRAW_BUFFER6_EXT 0x882B
+-#define GL_DRAW_BUFFER7_EXT 0x882C
+-#define GL_DRAW_BUFFER8_EXT 0x882D
+-#define GL_DRAW_BUFFER9_EXT 0x882E
+-#define GL_DRAW_BUFFER10_EXT 0x882F
+-#define GL_DRAW_BUFFER11_EXT 0x8830
+-#define GL_DRAW_BUFFER12_EXT 0x8831
+-#define GL_DRAW_BUFFER13_EXT 0x8832
+-#define GL_DRAW_BUFFER14_EXT 0x8833
+-#define GL_DRAW_BUFFER15_EXT 0x8834
+-#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
+-#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
+-#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
+-#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
+-#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
+-#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
+-#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
+-#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
+-#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
+-#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
+-#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
+-#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
+-#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
+-#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
+-#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
+-#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
+-#endif
+-
+-/* GL_EXT_map_buffer_range */
+-#ifndef GL_EXT_map_buffer_range
+-#define GL_MAP_READ_BIT_EXT 0x0001
+-#define GL_MAP_WRITE_BIT_EXT 0x0002
+-#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
+-#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
+-#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
+-#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
+-#endif
+-
+-/* GL_EXT_multisampled_render_to_texture */
+-#ifndef GL_EXT_multisampled_render_to_texture
+-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
+-/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */
+-#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+-#define GL_MAX_SAMPLES_EXT 0x8D57
+-#endif
+-
+-/* GL_EXT_multiview_draw_buffers */
+-#ifndef GL_EXT_multiview_draw_buffers
+-#define GL_COLOR_ATTACHMENT_EXT 0x90F0
+-#define GL_MULTIVIEW_EXT 0x90F1
+-#define GL_DRAW_BUFFER_EXT 0x0C01
+-#define GL_READ_BUFFER_EXT 0x0C02
+-#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2
+-#endif
+-
+-/* GL_EXT_multi_draw_arrays */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_EXT_occlusion_query_boolean */
+-#ifndef GL_EXT_occlusion_query_boolean
+-#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
+-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
+-#define GL_CURRENT_QUERY_EXT 0x8865
+-#define GL_QUERY_RESULT_EXT 0x8866
+-#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
+-#endif
+-
+-/* GL_EXT_read_format_bgra */
+-#ifndef GL_EXT_read_format_bgra
+-#define GL_BGRA_EXT 0x80E1
+-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
+-#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
+-#endif
+-
+-/* GL_EXT_robustness */
+-#ifndef GL_EXT_robustness
+-/* reuse GL_NO_ERROR */
+-#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
+-#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
+-#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
+-#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
+-#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
+-#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
+-#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
+-#endif
+-
+-/* GL_EXT_separate_shader_objects */
+-#ifndef GL_EXT_separate_shader_objects
+-#define GL_VERTEX_SHADER_BIT_EXT 0x00000001
+-#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002
+-#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF
+-#define GL_PROGRAM_SEPARABLE_EXT 0x8258
+-#define GL_ACTIVE_PROGRAM_EXT 0x8259
+-#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
+-#endif
+-
+-/* GL_EXT_shader_framebuffer_fetch */
+-#ifndef GL_EXT_shader_framebuffer_fetch
+-#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
+-#endif
+-
+-/* GL_EXT_shader_texture_lod */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_EXT_shadow_samplers */
+-#ifndef GL_EXT_shadow_samplers
+-#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
+-#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
+-#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
+-#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
+-#endif
+-
+-/* GL_EXT_sRGB */
+-#ifndef GL_EXT_sRGB
+-#define GL_SRGB_EXT 0x8C40
+-#define GL_SRGB_ALPHA_EXT 0x8C42
+-#define GL_SRGB8_ALPHA8_EXT 0x8C43
+-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
+-#endif
+-
+-/* GL_EXT_texture_compression_dxt1 */
+-#ifndef GL_EXT_texture_compression_dxt1
+-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+-#endif
+-
+-/* GL_EXT_texture_filter_anisotropic */
+-#ifndef GL_EXT_texture_filter_anisotropic
+-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+-#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+-#endif
+-
+-/* GL_EXT_texture_format_BGRA8888 */
+-#ifndef GL_EXT_texture_format_BGRA8888
+-#define GL_BGRA_EXT 0x80E1
+-#endif
+-
+-/* GL_EXT_texture_rg */
+-#ifndef GL_EXT_texture_rg
+-#define GL_RED_EXT 0x1903
+-#define GL_RG_EXT 0x8227
+-#define GL_R8_EXT 0x8229
+-#define GL_RG8_EXT 0x822B
+-#endif
+-
+-/* GL_EXT_texture_storage */
+-#ifndef GL_EXT_texture_storage
+-#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
+-#define GL_ALPHA8_EXT 0x803C
+-#define GL_LUMINANCE8_EXT 0x8040
+-#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
+-#define GL_RGBA32F_EXT 0x8814
+-#define GL_RGB32F_EXT 0x8815
+-#define GL_ALPHA32F_EXT 0x8816
+-#define GL_LUMINANCE32F_EXT 0x8818
+-#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
+-/* reuse GL_RGBA16F_EXT */
+-/* reuse GL_RGB16F_EXT */
+-#define GL_ALPHA16F_EXT 0x881C
+-#define GL_LUMINANCE16F_EXT 0x881E
+-#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
+-#define GL_RGB10_A2_EXT 0x8059
+-#define GL_RGB10_EXT 0x8052
+-#define GL_BGRA8_EXT 0x93A1
+-#define GL_R8_EXT 0x8229
+-#define GL_RG8_EXT 0x822B
+-#define GL_R32F_EXT 0x822E
+-#define GL_RG32F_EXT 0x8230
+-#define GL_R16F_EXT 0x822D
+-#define GL_RG16F_EXT 0x822F
+-#endif
+-
+-/* GL_EXT_texture_type_2_10_10_10_REV */
+-#ifndef GL_EXT_texture_type_2_10_10_10_REV
+-#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
+-#endif
+-
+-/* GL_EXT_unpack_subimage */
+-#ifndef GL_EXT_unpack_subimage
+-#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2
+-#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3
+-#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * DMP extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_DMP_shader_binary */
+-#ifndef GL_DMP_shader_binary
+-#define GL_SHADER_BINARY_DMP 0x9250
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * FJ extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_FJ_shader_binary_GCCSO */
+-#ifndef GL_FJ_shader_binary_GCCSO
+-#define GL_GCCSO_SHADER_BINARY_FJ 0x9260
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * IMG extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_IMG_program_binary */
+-#ifndef GL_IMG_program_binary
+-#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
+-#endif
+-
+-/* GL_IMG_read_format */
+-#ifndef GL_IMG_read_format
+-#define GL_BGRA_IMG 0x80E1
+-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
+-#endif
+-
+-/* GL_IMG_shader_binary */
+-#ifndef GL_IMG_shader_binary
+-#define GL_SGX_BINARY_IMG 0x8C0A
+-#endif
+-
+-/* GL_IMG_texture_compression_pvrtc */
+-#ifndef GL_IMG_texture_compression_pvrtc
+-#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+-#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+-#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+-#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+-#endif
+-
+-/* GL_IMG_texture_compression_pvrtc2 */
+-#ifndef GL_IMG_texture_compression_pvrtc2
+-#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
+-#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
+-#endif
+-
+-/* GL_IMG_multisampled_render_to_texture */
+-#ifndef GL_IMG_multisampled_render_to_texture
+-#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
+-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
+-#define GL_MAX_SAMPLES_IMG 0x9135
+-#define GL_TEXTURE_SAMPLES_IMG 0x9136
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * NV extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_NV_coverage_sample */
+-#ifndef GL_NV_coverage_sample
+-#define GL_COVERAGE_COMPONENT_NV 0x8ED0
+-#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
+-#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
+-#define GL_COVERAGE_BUFFERS_NV 0x8ED3
+-#define GL_COVERAGE_SAMPLES_NV 0x8ED4
+-#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
+-#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
+-#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
+-#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000
+-#endif
+-
+-/* GL_NV_depth_nonlinear */
+-#ifndef GL_NV_depth_nonlinear
+-#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
+-#endif
+-
+-/* GL_NV_draw_buffers */
+-#ifndef GL_NV_draw_buffers
+-#define GL_MAX_DRAW_BUFFERS_NV 0x8824
+-#define GL_DRAW_BUFFER0_NV 0x8825
+-#define GL_DRAW_BUFFER1_NV 0x8826
+-#define GL_DRAW_BUFFER2_NV 0x8827
+-#define GL_DRAW_BUFFER3_NV 0x8828
+-#define GL_DRAW_BUFFER4_NV 0x8829
+-#define GL_DRAW_BUFFER5_NV 0x882A
+-#define GL_DRAW_BUFFER6_NV 0x882B
+-#define GL_DRAW_BUFFER7_NV 0x882C
+-#define GL_DRAW_BUFFER8_NV 0x882D
+-#define GL_DRAW_BUFFER9_NV 0x882E
+-#define GL_DRAW_BUFFER10_NV 0x882F
+-#define GL_DRAW_BUFFER11_NV 0x8830
+-#define GL_DRAW_BUFFER12_NV 0x8831
+-#define GL_DRAW_BUFFER13_NV 0x8832
+-#define GL_DRAW_BUFFER14_NV 0x8833
+-#define GL_DRAW_BUFFER15_NV 0x8834
+-#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
+-#define GL_COLOR_ATTACHMENT1_NV 0x8CE1
+-#define GL_COLOR_ATTACHMENT2_NV 0x8CE2
+-#define GL_COLOR_ATTACHMENT3_NV 0x8CE3
+-#define GL_COLOR_ATTACHMENT4_NV 0x8CE4
+-#define GL_COLOR_ATTACHMENT5_NV 0x8CE5
+-#define GL_COLOR_ATTACHMENT6_NV 0x8CE6
+-#define GL_COLOR_ATTACHMENT7_NV 0x8CE7
+-#define GL_COLOR_ATTACHMENT8_NV 0x8CE8
+-#define GL_COLOR_ATTACHMENT9_NV 0x8CE9
+-#define GL_COLOR_ATTACHMENT10_NV 0x8CEA
+-#define GL_COLOR_ATTACHMENT11_NV 0x8CEB
+-#define GL_COLOR_ATTACHMENT12_NV 0x8CEC
+-#define GL_COLOR_ATTACHMENT13_NV 0x8CED
+-#define GL_COLOR_ATTACHMENT14_NV 0x8CEE
+-#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
+-#endif
+-
+-/* GL_NV_draw_instanced */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_NV_fbo_color_attachments */
+-#ifndef GL_NV_fbo_color_attachments
+-#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
+-/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */
+-#endif
+-
+-/* GL_NV_fence */
+-#ifndef GL_NV_fence
+-#define GL_ALL_COMPLETED_NV 0x84F2
+-#define GL_FENCE_STATUS_NV 0x84F3
+-#define GL_FENCE_CONDITION_NV 0x84F4
+-#endif
+-
+-/* GL_NV_framebuffer_blit */
+-#ifndef GL_NV_framebuffer_blit
+-#define GL_READ_FRAMEBUFFER_NV 0x8CA8
+-#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9
+-#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6
+-#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA
+-#endif
+-
+-/* GL_NV_framebuffer_multisample */
+-#ifndef GL_NV_framebuffer_multisample
+-#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB
+-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
+-#define GL_MAX_SAMPLES_NV 0x8D57
+-#endif
+-
+-/* GL_NV_generate_mipmap_sRGB */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_NV_instanced_arrays */
+-#ifndef GL_NV_instanced_arrays
+-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
+-#endif
+-
+-/* GL_NV_read_buffer */
+-#ifndef GL_NV_read_buffer
+-#define GL_READ_BUFFER_NV 0x0C02
+-#endif
+-
+-/* GL_NV_read_buffer_front */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_NV_read_depth */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_NV_read_depth_stencil */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_NV_read_stencil */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_NV_shadow_samplers_array */
+-#ifndef GL_NV_shadow_samplers_array
+-#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4
+-#endif
+-
+-/* GL_NV_shadow_samplers_cube */
+-#ifndef GL_NV_shadow_samplers_cube
+-#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5
+-#endif
+-
+-/* GL_NV_sRGB_formats */
+-#ifndef GL_NV_sRGB_formats
+-#define GL_SLUMINANCE_NV 0x8C46
+-#define GL_SLUMINANCE_ALPHA_NV 0x8C44
+-#define GL_SRGB8_NV 0x8C41
+-#define GL_SLUMINANCE8_NV 0x8C47
+-#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45
+-#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C
+-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
+-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
+-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
+-#define GL_ETC1_SRGB8_NV 0x88EE
+-#endif
+-
+-/* GL_NV_texture_border_clamp */
+-#ifndef GL_NV_texture_border_clamp
+-#define GL_TEXTURE_BORDER_COLOR_NV 0x1004
+-#define GL_CLAMP_TO_BORDER_NV 0x812D
+-#endif
+-
+-/* GL_NV_texture_compression_s3tc_update */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_NV_texture_npot_2D_mipmap */
+-/* No new tokens introduced by this extension. */
+-
+-/*------------------------------------------------------------------------*
+- * QCOM extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_QCOM_alpha_test */
+-#ifndef GL_QCOM_alpha_test
+-#define GL_ALPHA_TEST_QCOM 0x0BC0
+-#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
+-#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
+-#endif
+-
+-/* GL_QCOM_binning_control */
+-#ifndef GL_QCOM_binning_control
+-#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0
+-#define GL_CPU_OPTIMIZED_QCOM 0x8FB1
+-#define GL_GPU_OPTIMIZED_QCOM 0x8FB2
+-#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3
+-#endif
+-
+-/* GL_QCOM_driver_control */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_QCOM_extended_get */
+-#ifndef GL_QCOM_extended_get
+-#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
+-#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
+-#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
+-#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
+-#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
+-#define GL_TEXTURE_TYPE_QCOM 0x8BD7
+-#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
+-#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
+-#define GL_TEXTURE_TARGET_QCOM 0x8BDA
+-#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
+-#define GL_STATE_RESTORE 0x8BDC
+-#endif
+-
+-/* GL_QCOM_extended_get2 */
+-/* No new tokens introduced by this extension. */
+-
+-/* GL_QCOM_perfmon_global_mode */
+-#ifndef GL_QCOM_perfmon_global_mode
+-#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
+-#endif
+-
+-/* GL_QCOM_writeonly_rendering */
+-#ifndef GL_QCOM_writeonly_rendering
+-#define GL_WRITEONLY_RENDERING_QCOM 0x8823
+-#endif
+-
+-/* GL_QCOM_tiled_rendering */
+-#ifndef GL_QCOM_tiled_rendering
+-#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
+-#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
+-#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
+-#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
+-#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
+-#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
+-#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
+-#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
+-#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
+-#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
+-#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
+-#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
+-#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
+-#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
+-#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
+-#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
+-#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
+-#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
+-#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
+-#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
+-#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
+-#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
+-#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
+-#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
+-#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
+-#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
+-#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
+-#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
+-#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
+-#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
+-#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
+-#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * VIV extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_VIV_shader_binary */
+-#ifndef GL_VIV_shader_binary
+-#define GL_SHADER_BINARY_VIV 0x8FC4
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * End of extension tokens, start of corresponding extension functions
+- *------------------------------------------------------------------------*/
+-
+-/*------------------------------------------------------------------------*
+- * OES extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_OES_compressed_ETC1_RGB8_texture */
+-#ifndef GL_OES_compressed_ETC1_RGB8_texture
+-#define GL_OES_compressed_ETC1_RGB8_texture 1
+-#endif
+-
+-/* GL_OES_compressed_paletted_texture */
+-#ifndef GL_OES_compressed_paletted_texture
+-#define GL_OES_compressed_paletted_texture 1
+-#endif
+-
+-/* GL_OES_depth24 */
+-#ifndef GL_OES_depth24
+-#define GL_OES_depth24 1
+-#endif
+-
+-/* GL_OES_depth32 */
+-#ifndef GL_OES_depth32
+-#define GL_OES_depth32 1
+-#endif
+-
+-/* GL_OES_depth_texture */
+-#ifndef GL_OES_depth_texture
+-#define GL_OES_depth_texture 1
+-#endif
+-
+-/* GL_OES_EGL_image */
+-#ifndef GL_OES_EGL_image
+-#define GL_OES_EGL_image 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+-GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+-#endif
+-
+-/* GL_OES_EGL_image_external */
+-#ifndef GL_OES_EGL_image_external
+-#define GL_OES_EGL_image_external 1
+-/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */
+-#endif
+-
+-/* GL_OES_element_index_uint */
+-#ifndef GL_OES_element_index_uint
+-#define GL_OES_element_index_uint 1
+-#endif
+-
+-/* GL_OES_fbo_render_mipmap */
+-#ifndef GL_OES_fbo_render_mipmap
+-#define GL_OES_fbo_render_mipmap 1
+-#endif
+-
+-/* GL_OES_fragment_precision_high */
+-#ifndef GL_OES_fragment_precision_high
+-#define GL_OES_fragment_precision_high 1
+-#endif
+-
+-/* GL_OES_get_program_binary */
+-#ifndef GL_OES_get_program_binary
+-#define GL_OES_get_program_binary 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+-GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
+-#endif
+-
+-/* GL_OES_mapbuffer */
+-#ifndef GL_OES_mapbuffer
+-#define GL_OES_mapbuffer 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+-GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+-GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params);
+-#endif
+-typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+-typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+-typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params);
+-#endif
+-
+-/* GL_OES_packed_depth_stencil */
+-#ifndef GL_OES_packed_depth_stencil
+-#define GL_OES_packed_depth_stencil 1
+-#endif
+-
+-/* GL_OES_required_internalformat */
+-#ifndef GL_OES_required_internalformat
+-#define GL_OES_required_internalformat 1
+-#endif
+-
+-/* GL_OES_rgb8_rgba8 */
+-#ifndef GL_OES_rgb8_rgba8
+-#define GL_OES_rgb8_rgba8 1
+-#endif
+-
+-/* GL_OES_standard_derivatives */
+-#ifndef GL_OES_standard_derivatives
+-#define GL_OES_standard_derivatives 1
+-#endif
+-
+-/* GL_OES_stencil1 */
+-#ifndef GL_OES_stencil1
+-#define GL_OES_stencil1 1
+-#endif
+-
+-/* GL_OES_stencil4 */
+-#ifndef GL_OES_stencil4
+-#define GL_OES_stencil4 1
+-#endif
+-
+-#ifndef GL_OES_surfaceless_context
+-#define GL_OES_surfaceless_context 1
+-#endif
+-
+-/* GL_OES_texture_3D */
+-#ifndef GL_OES_texture_3D
+-#define GL_OES_texture_3D 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+-GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+-GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+-GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+-GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+-GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+-typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+-typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+-#endif
+-
+-/* GL_OES_texture_float */
+-#ifndef GL_OES_texture_float
+-#define GL_OES_texture_float 1
+-#endif
+-
+-/* GL_OES_texture_float_linear */
+-#ifndef GL_OES_texture_float_linear
+-#define GL_OES_texture_float_linear 1
+-#endif
+-
+-/* GL_OES_texture_half_float */
+-#ifndef GL_OES_texture_half_float
+-#define GL_OES_texture_half_float 1
+-#endif
+-
+-/* GL_OES_texture_half_float_linear */
+-#ifndef GL_OES_texture_half_float_linear
+-#define GL_OES_texture_half_float_linear 1
+-#endif
+-
+-/* GL_OES_texture_npot */
+-#ifndef GL_OES_texture_npot
+-#define GL_OES_texture_npot 1
+-#endif
+-
+-/* GL_OES_vertex_array_object */
+-#ifndef GL_OES_vertex_array_object
+-#define GL_OES_vertex_array_object 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
+-GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
+-GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
+-GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
+-typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
+-typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
+-typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
+-#endif
+-
+-/* GL_OES_vertex_half_float */
+-#ifndef GL_OES_vertex_half_float
+-#define GL_OES_vertex_half_float 1
+-#endif
+-
+-/* GL_OES_vertex_type_10_10_10_2 */
+-#ifndef GL_OES_vertex_type_10_10_10_2
+-#define GL_OES_vertex_type_10_10_10_2 1
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * KHR extension functions
+- *------------------------------------------------------------------------*/
+-
+-#ifndef GL_KHR_debug
+-#define GL_KHR_debug 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+-GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+-GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam);
+-GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+-GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+-GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void);
+-GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+-GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+-GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label);
+-GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+-GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam);
+-typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+-typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+-typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void);
+-typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+-typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+-typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
+-typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+-typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
+-#endif
+-
+-#ifndef GL_KHR_texture_compression_astc_ldr
+-#define GL_KHR_texture_compression_astc_ldr 1
+-#endif
+-
+-
+-/*------------------------------------------------------------------------*
+- * AMD extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_AMD_compressed_3DC_texture */
+-#ifndef GL_AMD_compressed_3DC_texture
+-#define GL_AMD_compressed_3DC_texture 1
+-#endif
+-
+-/* GL_AMD_compressed_ATC_texture */
+-#ifndef GL_AMD_compressed_ATC_texture
+-#define GL_AMD_compressed_ATC_texture 1
+-#endif
+-
+-/* AMD_performance_monitor */
+-#ifndef GL_AMD_performance_monitor
+-#define GL_AMD_performance_monitor 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+-GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+-GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+-GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
+-GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
+-GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
+-GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
+-GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
+-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+-typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+-typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+-typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
+-typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+-typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+-#endif
+-
+-/* GL_AMD_program_binary_Z400 */
+-#ifndef GL_AMD_program_binary_Z400
+-#define GL_AMD_program_binary_Z400 1
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * ANGLE extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_ANGLE_depth_texture */
+-#ifndef GL_ANGLE_depth_texture
+-#define GL_ANGLE_depth_texture 1
+-#endif
+-
+-/* GL_ANGLE_framebuffer_blit */
+-#ifndef GL_ANGLE_framebuffer_blit
+-#define GL_ANGLE_framebuffer_blit 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+-#endif
+-
+-/* GL_ANGLE_framebuffer_multisample */
+-#ifndef GL_ANGLE_framebuffer_multisample
+-#define GL_ANGLE_framebuffer_multisample 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+-#endif
+-
+-#ifndef GL_ANGLE_instanced_arrays
+-#define GL_ANGLE_instanced_arrays 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+-GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+-GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
+-#endif
+-
+-/* GL_ANGLE_pack_reverse_row_order */
+-#ifndef GL_ANGLE_pack_reverse_row_order
+-#define GL_ANGLE_pack_reverse_row_order 1
+-#endif
+-
+-/* GL_ANGLE_program_binary */
+-#ifndef GL_ANGLE_program_binary
+-#define GL_ANGLE_program_binary 1
+-#endif
+-
+-/* GL_ANGLE_texture_compression_dxt3 */
+-#ifndef GL_ANGLE_texture_compression_dxt3
+-#define GL_ANGLE_texture_compression_dxt3 1
+-#endif
+-
+-/* GL_ANGLE_texture_compression_dxt5 */
+-#ifndef GL_ANGLE_texture_compression_dxt5
+-#define GL_ANGLE_texture_compression_dxt5 1
+-#endif
+-
+-/* GL_ANGLE_texture_usage */
+-#ifndef GL_ANGLE_texture_usage
+-#define GL_ANGLE_texture_usage 1
+-#endif
+-
+-#ifndef GL_ANGLE_translated_shader_source
+-#define GL_ANGLE_translated_shader_source 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * APPLE extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_APPLE_copy_texture_levels */
+-#ifndef GL_APPLE_copy_texture_levels
+-#define GL_APPLE_copy_texture_levels 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+-#endif
+-
+-/* GL_APPLE_framebuffer_multisample */
+-#ifndef GL_APPLE_framebuffer_multisample
+-#define GL_APPLE_framebuffer_multisample 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+-GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
+-#endif /* GL_GLEXT_PROTOTYPES */
+-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+-typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
+-#endif
+-
+-/* GL_APPLE_rgb_422 */
+-#ifndef GL_APPLE_rgb_422
+-#define GL_APPLE_rgb_422 1
+-#endif
+-
+-/* GL_APPLE_sync */
+-#ifndef GL_APPLE_sync
+-#define GL_APPLE_sync 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
+-GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
+-GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
+-GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+-GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+-GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
+-GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+-#endif
+-typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
+-typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
+-typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
+-typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+-typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+-typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
+-typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+-#endif
+-
+-/* GL_APPLE_texture_format_BGRA8888 */
+-#ifndef GL_APPLE_texture_format_BGRA8888
+-#define GL_APPLE_texture_format_BGRA8888 1
+-#endif
+-
+-/* GL_APPLE_texture_max_level */
+-#ifndef GL_APPLE_texture_max_level
+-#define GL_APPLE_texture_max_level 1
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * ARM extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_ARM_mali_program_binary */
+-#ifndef GL_ARM_mali_program_binary
+-#define GL_ARM_mali_program_binary 1
+-#endif
+-
+-/* GL_ARM_mali_shader_binary */
+-#ifndef GL_ARM_mali_shader_binary
+-#define GL_ARM_mali_shader_binary 1
+-#endif
+-
+-/* GL_ARM_rgba8 */
+-#ifndef GL_ARM_rgba8
+-#define GL_ARM_rgba8 1
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * EXT extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_EXT_blend_minmax */
+-#ifndef GL_EXT_blend_minmax
+-#define GL_EXT_blend_minmax 1
+-#endif
+-
+-/* GL_EXT_color_buffer_half_float */
+-#ifndef GL_EXT_color_buffer_half_float
+-#define GL_EXT_color_buffer_half_float 1
+-#endif
+-
+-/* GL_EXT_debug_label */
+-#ifndef GL_EXT_debug_label
+-#define GL_EXT_debug_label 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+-GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+-typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+-#endif
+-
+-/* GL_EXT_debug_marker */
+-#ifndef GL_EXT_debug_marker
+-#define GL_EXT_debug_marker 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
+-GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
+-GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+-typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+-typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
+-#endif
+-
+-/* GL_EXT_discard_framebuffer */
+-#ifndef GL_EXT_discard_framebuffer
+-#define GL_EXT_discard_framebuffer 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+-#endif
+-
+-#ifndef GL_EXT_disjoint_timer_query
+-#define GL_EXT_disjoint_timer_query 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
+-GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
+-GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
+-GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
+-GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
+-GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target);
+-GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
+-GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params);
+-GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
+-GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
+-GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
+-typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
+-typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
+-typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
+-typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
+-typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
+-typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params);
+-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
+-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
+-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
+-#endif /* GL_EXT_disjoint_timer_query */
+-
+-#ifndef GL_EXT_draw_buffers
+-#define GL_EXT_draw_buffers 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
+-#endif /* GL_EXT_draw_buffers */
+-
+-/* GL_EXT_map_buffer_range */
+-#ifndef GL_EXT_map_buffer_range
+-#define GL_EXT_map_buffer_range 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+-GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
+-#endif
+-typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+-typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+-#endif
+-
+-/* GL_EXT_multisampled_render_to_texture */
+-#ifndef GL_EXT_multisampled_render_to_texture
+-#define GL_EXT_multisampled_render_to_texture 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+-GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+-#endif
+-
+-/* GL_EXT_multiview_draw_buffers */
+-#ifndef GL_EXT_multiview_draw_buffers
+-#define GL_EXT_multiview_draw_buffers 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index);
+-GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices);
+-GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
+-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
+-typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
+-#endif
+-
+-#ifndef GL_EXT_multi_draw_arrays
+-#define GL_EXT_multi_draw_arrays 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, const GLint *, const GLsizei *, GLsizei);
+-GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
+-#endif /* GL_GLEXT_PROTOTYPES */
+-typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+-typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+-#endif
+-
+-/* GL_EXT_occlusion_query_boolean */
+-#ifndef GL_EXT_occlusion_query_boolean
+-#define GL_EXT_occlusion_query_boolean 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
+-GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
+-GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
+-GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
+-GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
+-GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
+-GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
+-typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
+-typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
+-typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
+-typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
+-typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
+-#endif
+-
+-/* GL_EXT_read_format_bgra */
+-#ifndef GL_EXT_read_format_bgra
+-#define GL_EXT_read_format_bgra 1
+-#endif
+-
+-/* GL_EXT_robustness */
+-#ifndef GL_EXT_robustness
+-#define GL_EXT_robustness 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
+-GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+-GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params);
+-GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+-#endif
+-typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
+-typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params);
+-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+-#endif
+-
+-/* GL_EXT_separate_shader_objects */
+-#ifndef GL_EXT_separate_shader_objects
+-#define GL_EXT_separate_shader_objects 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
+-GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
+-GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
+-GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
+-GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
+-GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
+-GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
+-GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
+-GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
+-GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x);
+-GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y);
+-GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z);
+-GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
+-GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x);
+-GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y);
+-GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
+-GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+-GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+-GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+-GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+-GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+-GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+-GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+-GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+-GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+-GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
+-GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+-typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
+-typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
+-typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+-typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
+-typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
+-typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
+-typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+-typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+-typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+-#endif
+-
+-/* GL_EXT_shader_framebuffer_fetch */
+-#ifndef GL_EXT_shader_framebuffer_fetch
+-#define GL_EXT_shader_framebuffer_fetch 1
+-#endif
+-
+-/* GL_EXT_shader_texture_lod */
+-#ifndef GL_EXT_shader_texture_lod
+-#define GL_EXT_shader_texture_lod 1
+-#endif
+-
+-/* GL_EXT_shadow_samplers */
+-#ifndef GL_EXT_shadow_samplers
+-#define GL_EXT_shadow_samplers 1
+-#endif
+-
+-/* GL_EXT_sRGB */
+-#ifndef GL_EXT_sRGB
+-#define GL_EXT_sRGB 1
+-#endif
+-
+-/* GL_EXT_texture_compression_dxt1 */
+-#ifndef GL_EXT_texture_compression_dxt1
+-#define GL_EXT_texture_compression_dxt1 1
+-#endif
+-
+-/* GL_EXT_texture_filter_anisotropic */
+-#ifndef GL_EXT_texture_filter_anisotropic
+-#define GL_EXT_texture_filter_anisotropic 1
+-#endif
+-
+-/* GL_EXT_texture_format_BGRA8888 */
+-#ifndef GL_EXT_texture_format_BGRA8888
+-#define GL_EXT_texture_format_BGRA8888 1
+-#endif
+-
+-/* GL_EXT_texture_rg */
+-#ifndef GL_EXT_texture_rg
+-#define GL_EXT_texture_rg 1
+-#endif
+-
+-/* GL_EXT_texture_storage */
+-#ifndef GL_EXT_texture_storage
+-#define GL_EXT_texture_storage 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+-GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+-GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+-GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+-GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+-GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+-#endif
+-
+-/* GL_EXT_texture_type_2_10_10_10_REV */
+-#ifndef GL_EXT_texture_type_2_10_10_10_REV
+-#define GL_EXT_texture_type_2_10_10_10_REV 1
+-#endif
+-
+-/* GL_EXT_unpack_subimage */
+-#ifndef GL_EXT_unpack_subimage
+-#define GL_EXT_unpack_subimage 1
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * DMP extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_DMP_shader_binary */
+-#ifndef GL_DMP_shader_binary
+-#define GL_DMP_shader_binary 1
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * FJ extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_FJ_shader_binary_GCCSO */
+-#ifndef GL_FJ_shader_binary_GCCSO
+-#define GL_FJ_shader_binary_GCCSO 1
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * IMG extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_IMG_program_binary */
+-#ifndef GL_IMG_program_binary
+-#define GL_IMG_program_binary 1
+-#endif
+-
+-/* GL_IMG_read_format */
+-#ifndef GL_IMG_read_format
+-#define GL_IMG_read_format 1
+-#endif
+-
+-/* GL_IMG_shader_binary */
+-#ifndef GL_IMG_shader_binary
+-#define GL_IMG_shader_binary 1
+-#endif
+-
+-/* GL_IMG_texture_compression_pvrtc */
+-#ifndef GL_IMG_texture_compression_pvrtc
+-#define GL_IMG_texture_compression_pvrtc 1
+-#endif
+-
+-/* GL_IMG_texture_compression_pvrtc2 */
+-#ifndef GL_IMG_texture_compression_pvrtc2
+-#define GL_IMG_texture_compression_pvrtc2 1
+-#endif
+-
+-/* GL_IMG_multisampled_render_to_texture */
+-#ifndef GL_IMG_multisampled_render_to_texture
+-#define GL_IMG_multisampled_render_to_texture 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+-GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * NV extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_NV_coverage_sample */
+-#ifndef GL_NV_coverage_sample
+-#define GL_NV_coverage_sample 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
+-GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
+-typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
+-#endif
+-
+-/* GL_NV_depth_nonlinear */
+-#ifndef GL_NV_depth_nonlinear
+-#define GL_NV_depth_nonlinear 1
+-#endif
+-
+-/* GL_NV_draw_buffers */
+-#ifndef GL_NV_draw_buffers
+-#define GL_NV_draw_buffers 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
+-#endif
+-
+-/* GL_NV_draw_instanced */
+-#ifndef GL_NV_draw_instanced
+-#define GL_NV_draw_instanced 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+-GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+-#endif
+-typedef void (GL_APIENTRYP PFNDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+-typedef void (GL_APIENTRYP PFNDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+-#endif
+-
+-/* GL_NV_fbo_color_attachments */
+-#ifndef GL_NV_fbo_color_attachments
+-#define GL_NV_fbo_color_attachments 1
+-#endif
+-
+-/* GL_NV_fence */
+-#ifndef GL_NV_fence
+-#define GL_NV_fence 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *);
+-GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *);
+-GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint);
+-GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint);
+-GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *);
+-GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint);
+-GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+-typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+-typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
+-typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
+-typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+-typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
+-typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+-#endif
+-
+-/* GL_NV_framebuffer_blit */
+-#ifndef GL_NV_framebuffer_blit
+-#define GL_NV_framebuffer_blit 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glBlitFramebufferNV (int srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+-#endif
+-typedef void (GL_APIENTRYP PFNBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+-#endif
+-
+-/* GL_NV_framebuffer_multisample */
+-#ifndef GL_NV_framebuffer_multisample
+-#define GL_NV_framebuffer_multisample 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+-#endif
+-typedef void (GL_APIENTRYP PFNRENDERBUFFERSTORAGEMULTISAMPLENVPROC) ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+-#endif
+-
+-/* GL_NV_generate_mipmap_sRGB */
+-#ifndef GL_NV_generate_mipmap_sRGB
+-#define GL_NV_generate_mipmap_sRGB 1
+-#endif
+-
+-/* GL_NV_instanced_arrays */
+-#ifndef GL_NV_instanced_arrays
+-#define GL_NV_instanced_arrays 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
+-#endif
+-typedef void (GL_APIENTRYP PFNVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
+-#endif
+-
+-/* GL_NV_read_buffer */
+-#ifndef GL_NV_read_buffer
+-#define GL_NV_read_buffer 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
+-#endif
+-
+-/* GL_NV_read_buffer_front */
+-#ifndef GL_NV_read_buffer_front
+-#define GL_NV_read_buffer_front 1
+-#endif
+-
+-/* GL_NV_read_depth */
+-#ifndef GL_NV_read_depth
+-#define GL_NV_read_depth 1
+-#endif
+-
+-/* GL_NV_read_depth_stencil */
+-#ifndef GL_NV_read_depth_stencil
+-#define GL_NV_read_depth_stencil 1
+-#endif
+-
+-/* GL_NV_read_stencil */
+-#ifndef GL_NV_read_stencil
+-#define GL_NV_read_stencil 1
+-#endif
+-
+-/* GL_NV_shadow_samplers_array */
+-#ifndef GL_NV_shadow_samplers_array
+-#define GL_NV_shadow_samplers_array 1
+-#endif
+-
+-/* GL_NV_shadow_samplers_cube */
+-#ifndef GL_NV_shadow_samplers_cube
+-#define GL_NV_shadow_samplers_cube 1
+-#endif
+-
+-/* GL_NV_sRGB_formats */
+-#ifndef GL_NV_sRGB_formats
+-#define GL_NV_sRGB_formats 1
+-#endif
+-
+-/* GL_NV_texture_border_clamp */
+-#ifndef GL_NV_texture_border_clamp
+-#define GL_NV_texture_border_clamp 1
+-#endif
+-
+-/* GL_NV_texture_compression_s3tc_update */
+-#ifndef GL_NV_texture_compression_s3tc_update
+-#define GL_NV_texture_compression_s3tc_update 1
+-#endif
+-
+-/* GL_NV_texture_npot_2D_mipmap */
+-#ifndef GL_NV_texture_npot_2D_mipmap
+-#define GL_NV_texture_npot_2D_mipmap 1
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * QCOM extension functions
+- *------------------------------------------------------------------------*/
+-
+-/* GL_QCOM_alpha_test */
+-#ifndef GL_QCOM_alpha_test
+-#define GL_QCOM_alpha_test 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
+-#endif
+-
+-/* GL_QCOM_binning_control */
+-#ifndef GL_QCOM_binning_control
+-#define GL_QCOM_binning_control 1
+-#endif
+-
+-/* GL_QCOM_driver_control */
+-#ifndef GL_QCOM_driver_control
+-#define GL_QCOM_driver_control 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
+-GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+-GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
+-GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
+-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+-typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+-typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+-#endif
+-
+-/* GL_QCOM_extended_get */
+-#ifndef GL_QCOM_extended_get
+-#define GL_QCOM_extended_get 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
+-GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+-GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+-GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+-GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+-GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
+-GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
+-GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
+-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+-typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+-typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+-typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+-typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
+-typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
+-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params);
+-#endif
+-
+-/* GL_QCOM_extended_get2 */
+-#ifndef GL_QCOM_extended_get2
+-#define GL_QCOM_extended_get2 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+-GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+-GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
+-GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+-typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
+-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+-#endif
+-
+-/* GL_QCOM_perfmon_global_mode */
+-#ifndef GL_QCOM_perfmon_global_mode
+-#define GL_QCOM_perfmon_global_mode 1
+-#endif
+-
+-/* GL_QCOM_writeonly_rendering */
+-#ifndef GL_QCOM_writeonly_rendering
+-#define GL_QCOM_writeonly_rendering 1
+-#endif
+-
+-/* GL_QCOM_tiled_rendering */
+-#ifndef GL_QCOM_tiled_rendering
+-#define GL_QCOM_tiled_rendering 1
+-#ifdef GL_GLEXT_PROTOTYPES
+-GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+-GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
+-#endif
+-typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+-typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
+-#endif
+-
+-/*------------------------------------------------------------------------*
+- * VIV extension tokens
+- *------------------------------------------------------------------------*/
+-
+-/* GL_VIV_shader_binary */
+-#ifndef GL_VIV_shader_binary
+-#define GL_VIV_shader_binary 1
+-#endif
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif /* __gl2ext_h_ */
+diff --git a/include/GLES2/gl2platform.h b/include/GLES2/gl2platform.h
+deleted file mode 100644
+index c9fa3c4..0000000
+--- a/include/GLES2/gl2platform.h
++++ /dev/null
+@@ -1,30 +0,0 @@
+-#ifndef __gl2platform_h_
+-#define __gl2platform_h_
+-
+-/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
+-
+-/*
+- * This document is licensed under the SGI Free Software B License Version
+- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+- */
+-
+-/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
+- *
+- * Adopters may modify khrplatform.h and this file to suit their platform.
+- * You are encouraged to submit all modifications to the Khronos group so that
+- * they can be included in future versions of this file. Please submit changes
+- * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+- * by filing a bug against product "OpenGL-ES" component "Registry".
+- */
+-
+-#include <KHR/khrplatform.h>
+-
+-#ifndef GL_APICALL
+-#define GL_APICALL KHRONOS_APICALL
+-#endif
+-
+-#ifndef GL_APIENTRY
+-#define GL_APIENTRY KHRONOS_APIENTRY
+-#endif
+-
+-#endif /* __gl2platform_h_ */
+diff --git a/include/KHR/khrplatform.h b/include/KHR/khrplatform.h
+deleted file mode 100644
+index 4479539..0000000
+--- a/include/KHR/khrplatform.h
++++ /dev/null
+@@ -1,277 +0,0 @@
+-#ifndef __khrplatform_h_
+-#define __khrplatform_h_
+-
+-/*
+-** Copyright (c) 2008-2009 The Khronos Group Inc.
+-**
+-** Permission is hereby granted, free of charge, to any person obtaining a
+-** copy of this software and/or associated documentation files (the
+-** "Materials"), to deal in the Materials without restriction, including
+-** without limitation the rights to use, copy, modify, merge, publish,
+-** distribute, sublicense, and/or sell copies of the Materials, and to
+-** permit persons to whom the Materials are 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 Materials.
+-**
+-** THE MATERIALS ARE 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.
+-** 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
+-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+-*/
+-
+-/* Khronos platform-specific types and definitions.
+- *
+- * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+- *
+- * Adopters may modify this file to suit their platform. Adopters are
+- * encouraged to submit platform specific modifications to the Khronos
+- * group so that they can be included in future versions of this file.
+- * Please submit changes by sending them to the public Khronos Bugzilla
+- * (http://khronos.org/bugzilla) by filing a bug against product
+- * "Khronos (general)" component "Registry".
+- *
+- * A predefined template which fills in some of the bug fields can be
+- * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
+- * must create a Bugzilla login first.
+- *
+- *
+- * See the Implementer's Guidelines for information about where this file
+- * should be located on your system and for more details of its use:
+- * http://www.khronos.org/registry/implementers_guide.pdf
+- *
+- * This file should be included as
+- * #include <KHR/khrplatform.h>
+- * by Khronos client API header files that use its types and defines.
+- *
+- * The types in khrplatform.h should only be used to define API-specific types.
+- *
+- * Types defined in khrplatform.h:
+- * khronos_int8_t signed 8 bit
+- * khronos_uint8_t unsigned 8 bit
+- * khronos_int16_t signed 16 bit
+- * khronos_uint16_t unsigned 16 bit
+- * khronos_int32_t signed 32 bit
+- * khronos_uint32_t unsigned 32 bit
+- * khronos_int64_t signed 64 bit
+- * khronos_uint64_t unsigned 64 bit
+- * khronos_intptr_t signed same number of bits as a pointer
+- * khronos_uintptr_t unsigned same number of bits as a pointer
+- * khronos_ssize_t signed size
+- * khronos_usize_t unsigned size
+- * khronos_float_t signed 32 bit floating point
+- * khronos_time_ns_t unsigned 64 bit time in nanoseconds
+- * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+- * nanoseconds
+- * khronos_stime_nanoseconds_t signed time interval in nanoseconds
+- * khronos_boolean_enum_t enumerated boolean type. This should
+- * only be used as a base type when a client API's boolean type is
+- * an enum. Client APIs which use an integer or other type for
+- * booleans cannot use this as the base type for their boolean.
+- *
+- * Tokens defined in khrplatform.h:
+- *
+- * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+- *
+- * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+- * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+- *
+- * Calling convention macros defined in this file:
+- * KHRONOS_APICALL
+- * KHRONOS_APIENTRY
+- * KHRONOS_APIATTRIBUTES
+- *
+- * These may be used in function prototypes as:
+- *
+- * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
+- * int arg1,
+- * int arg2) KHRONOS_APIATTRIBUTES;
+- */
+-
+-/*-------------------------------------------------------------------------
+- * Definition of KHRONOS_APICALL
+- *-------------------------------------------------------------------------
+- * This precedes the return type of the function in the function prototype.
+- */
+-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+-# if defined(KHRONOS_DLL_EXPORTS)
+-# define KHRONOS_APICALL __declspec(dllexport)
+-# else
+-# define KHRONOS_APICALL __declspec(dllimport)
+-# endif
+-#elif defined (__SYMBIAN32__)
+-# define KHRONOS_APICALL IMPORT_C
+-#elif (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303) \
+- || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+-/* KHRONOS_APIATTRIBUTES is not used by the client API headers yet */
+-# define KHRONOS_APICALL __attribute__((visibility("default")))
+-#else
+-# define KHRONOS_APICALL
+-#endif
+-
+-/*-------------------------------------------------------------------------
+- * Definition of KHRONOS_APIENTRY
+- *-------------------------------------------------------------------------
+- * This follows the return type of the function and precedes the function
+- * name in the function prototype.
+- */
+-#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+- /* Win32 but not WinCE */
+-# define KHRONOS_APIENTRY __stdcall
+-#else
+-# define KHRONOS_APIENTRY
+-#endif
+-
+-/*-------------------------------------------------------------------------
+- * Definition of KHRONOS_APIATTRIBUTES
+- *-------------------------------------------------------------------------
+- * This follows the closing parenthesis of the function prototype arguments.
+- */
+-#if defined (__ARMCC_2__)
+-#define KHRONOS_APIATTRIBUTES __softfp
+-#else
+-#define KHRONOS_APIATTRIBUTES
+-#endif
+-
+-/*-------------------------------------------------------------------------
+- * basic type definitions
+- *-----------------------------------------------------------------------*/
+-#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+-
+-
+-/*
+- * Using <stdint.h>
+- */
+-#include <stdint.h>
+-typedef int32_t khronos_int32_t;
+-typedef uint32_t khronos_uint32_t;
+-typedef int64_t khronos_int64_t;
+-typedef uint64_t khronos_uint64_t;
+-#define KHRONOS_SUPPORT_INT64 1
+-#define KHRONOS_SUPPORT_FLOAT 1
+-
+-#elif defined(__VMS ) || defined(__sgi)
+-
+-/*
+- * Using <inttypes.h>
+- */
+-#include <inttypes.h>
+-typedef int32_t khronos_int32_t;
+-typedef uint32_t khronos_uint32_t;
+-typedef int64_t khronos_int64_t;
+-typedef uint64_t khronos_uint64_t;
+-#define KHRONOS_SUPPORT_INT64 1
+-#define KHRONOS_SUPPORT_FLOAT 1
+-
+-#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+-
+-/*
+- * Win32
+- */
+-typedef __int32 khronos_int32_t;
+-typedef unsigned __int32 khronos_uint32_t;
+-typedef __int64 khronos_int64_t;
+-typedef unsigned __int64 khronos_uint64_t;
+-#define KHRONOS_SUPPORT_INT64 1
+-#define KHRONOS_SUPPORT_FLOAT 1
+-
+-#elif defined(__sun__) || defined(__digital__)
+-
+-/*
+- * Sun or Digital
+- */
+-typedef int khronos_int32_t;
+-typedef unsigned int khronos_uint32_t;
+-#if defined(__arch64__) || defined(_LP64)
+-typedef long int khronos_int64_t;
+-typedef unsigned long int khronos_uint64_t;
+-#else
+-typedef long long int khronos_int64_t;
+-typedef unsigned long long int khronos_uint64_t;
+-#endif /* __arch64__ */
+-#define KHRONOS_SUPPORT_INT64 1
+-#define KHRONOS_SUPPORT_FLOAT 1
+-
+-#elif 0
+-
+-/*
+- * Hypothetical platform with no float or int64 support
+- */
+-typedef int khronos_int32_t;
+-typedef unsigned int khronos_uint32_t;
+-#define KHRONOS_SUPPORT_INT64 0
+-#define KHRONOS_SUPPORT_FLOAT 0
+-
+-#else
+-
+-/*
+- * Generic fallback
+- */
+-#include <stdint.h>
+-typedef int32_t khronos_int32_t;
+-typedef uint32_t khronos_uint32_t;
+-typedef int64_t khronos_int64_t;
+-typedef uint64_t khronos_uint64_t;
+-#define KHRONOS_SUPPORT_INT64 1
+-#define KHRONOS_SUPPORT_FLOAT 1
+-
+-#endif
+-
+-
+-/*
+- * Types that are (so far) the same on all platforms
+- */
+-typedef signed char khronos_int8_t;
+-typedef unsigned char khronos_uint8_t;
+-typedef signed short int khronos_int16_t;
+-typedef unsigned short int khronos_uint16_t;
+-typedef signed long int khronos_intptr_t;
+-typedef unsigned long int khronos_uintptr_t;
+-typedef signed long int khronos_ssize_t;
+-typedef unsigned long int khronos_usize_t;
+-
+-#if KHRONOS_SUPPORT_FLOAT
+-/*
+- * Float type
+- */
+-typedef float khronos_float_t;
+-#endif
+-
+-#if KHRONOS_SUPPORT_INT64
+-/* Time types
+- *
+- * These types can be used to represent a time interval in nanoseconds or
+- * an absolute Unadjusted System Time. Unadjusted System Time is the number
+- * of nanoseconds since some arbitrary system event (e.g. since the last
+- * time the system booted). The Unadjusted System Time is an unsigned
+- * 64 bit value that wraps back to 0 every 584 years. Time intervals
+- * may be either signed or unsigned.
+- */
+-typedef khronos_uint64_t khronos_utime_nanoseconds_t;
+-typedef khronos_int64_t khronos_stime_nanoseconds_t;
+-#endif
+-
+-/*
+- * Dummy value used to pad enum types to 32 bits.
+- */
+-#ifndef KHRONOS_MAX_ENUM
+-#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+-#endif
+-
+-/*
+- * Enumerated boolean type
+- *
+- * Values other than zero should be considered to be true. Therefore
+- * comparisons should not be made against KHRONOS_TRUE.
+- */
+-typedef enum {
+- KHRONOS_FALSE = 0,
+- KHRONOS_TRUE = 1,
+- KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+-} khronos_boolean_enum_t;
+-
+-#endif /* __khrplatform_h_ */
+--
+1.7.9.5
+
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/libgbm.bb b/meta-rcar-gen2/recipes-graphics/wayland/libgbm.bb
new file mode 100644
index 0000000..e7dc398
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/libgbm.bb
@@ -0,0 +1,23 @@
+SUMMARY = "gbm library"
+LICENSE = "MIT"
+SECTION = "libs"
+
+LIC_FILES_CHKSUM = "file://gbm.c;beginline=4;endline=22;md5=5cdaac262c876e98e47771f11c7036b5"
+
+SRCREV = "39cad6b7f24ea65e6f7d2c2777e3fe3dda8c24c9"
+SRC_URI = "git://github.com/thayama/libgbm;protocol=git;branch=master"
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_MACHINE = "(r8a7790|r8a7791|r8a7793|r8a7794)"
+DEPENDS = "wayland-kms"
+
+inherit autotools pkgconfig
+
+# FILES_${PN} += "${libdir}/gbm/libgbm_kms.so.*"
+FILES_${PN} = "${libdir}/libgbm.so.* ${libdir}/gbm/libgbm_kms.so.*"
+FILES_${PN}-dev += "${libdir}/gbm/*.so ${libdir}/gbm/*.la"
+FILES_${PN}-dev += "${libdir}/gbm/*.so ${libdir}/gbm/*.la"
+FILES_${PN}-dbg += "${libdir}/gbm/.debug/*"
+FILES_${PN}-staticdev += "${libdir}/gbm/*.a"
+
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/wayland-kms_1.4.0.bb b/meta-rcar-gen2/recipes-graphics/wayland/wayland-kms_1.4.0.bb
new file mode 100644
index 0000000..52bc922
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/wayland-kms_1.4.0.bb
@@ -0,0 +1,21 @@
+SUMMARY = "KMS library for Wayland"
+LICENSE = "MIT"
+
+LIC_FILES_CHKSUM = "file://wayland-kms.c;beginline=6;endline=24;md5=5cdaac262c876e98e47771f11c7036b5"
+
+PV_append = "+git${SRCREV}"
+
+SRCREV = "d0c6d621f610d432abeffe3f4a624760bca61d0d"
+SRC_URI = "git://github.com/thayama/wayland-kms;protocol=git;branch=master"
+
+COMPATIBLE_MACHINE = "(r8a7790|r8a7791|r8a7793|r8a7794)"
+S = "${WORKDIR}/git"
+DEPENDS = "libdrm wayland gles-user-module"
+
+inherit autotools pkgconfig
+
+FILES_${PN} = "${libdir}/libwayland-kms.so.*"
+FILES_${PN}-dev = "${libdir}/libwayland-kms.la \
+ ${libdir}/libwayland-kms.so ${libdir}/pkgconfig/* \
+ ${includedir}/*"
+FILES_${PN}-staticdev += "${libdir}/libwayland-kms.a"
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/wayland/disable-macro-checks-not-used-for-scanner.patch b/meta-rcar-gen2/recipes-graphics/wayland/wayland/disable-macro-checks-not-used-for-scanner.patch
new file mode 100644
index 0000000..cd8bc55
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/wayland/disable-macro-checks-not-used-for-scanner.patch
@@ -0,0 +1,50 @@
+disable macro checks not used for scanner
+
+We only build wayland-native for the scanner, so disable the bits we don't
+actually need. This avoid build issue on older distro such as Centos 5.x:
+| error: 'O_CLOEXEC' undeclared (first use in this function)
+| error: sys/timerfd.h: No such file or directory
+| error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
+| error: 'TFD_CLOEXEC' undeclared (first use in this function)
+| error: 'SFD_CLOEXEC' undeclared (first use in this function)
+
+Upstream-Status: Pending
+
+Signed-off-by: Ting Liu <b28495@freescale.com>
+---
+ configure.ac | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -41,16 +41,16 @@ AC_SUBST(GCC_CFLAGS)
+
+ AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate])
+
+-AC_CHECK_DECL(SFD_CLOEXEC,[],
+- [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland")],
+- [[#include <sys/signalfd.h>]])
+-AC_CHECK_DECL(TFD_CLOEXEC,[],
+- [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile wayland")],
+- [[#include <sys/timerfd.h>]])
+-AC_CHECK_DECL(CLOCK_MONOTONIC,[],
+- [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile wayland")],
+- [[#include <time.h>]])
+-AC_CHECK_HEADERS([execinfo.h])
++##AC_CHECK_DECL(SFD_CLOEXEC,[],
++# [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland")],
++# [[#include <sys/signalfd.h>]])
++#AC_CHECK_DECL(TFD_CLOEXEC,[],
++# [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile wayland")],
++# [[#include <sys/timerfd.h>]])
++#AC_CHECK_DECL(CLOCK_MONOTONIC,[],
++# [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile wayland")],
++# [[#include <time.h>]])
++#AC_CHECK_HEADERS([execinfo.h])
+
+ AC_ARG_ENABLE([scanner],
+ [AC_HELP_STRING([--disable-scanner],
+--
+1.8.3.2
+
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/wayland_1.5.0.bb b/meta-rcar-gen2/recipes-graphics/wayland/wayland_1.5.0.bb
new file mode 100644
index 0000000..b1ae59e
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/wayland_1.5.0.bb
@@ -0,0 +1,41 @@
+SUMMARY = "Wayland, a protocol between a compositor and clients"
+DESCRIPTION = "Wayland is a protocol for a compositor to talk to its clients \
+as well as a C library implementation of that protocol. The compositor can be \
+a standalone display server running on Linux kernel modesetting and evdev \
+input devices, an X application, or a wayland client itself. The clients can \
+be traditional applications, X servers (rootless or fullscreen) or other \
+display servers."
+HOMEPAGE = "http://wayland.freedesktop.org"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=1d4476a7d98dd5691c53d4d43a510c72 \
+ file://src/wayland-server.c;endline=21;md5=079ae21dbf98ada52ec23744851b0a5c"
+
+SRC_URI = "http://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz"
+SRC_URI[md5sum] = "1d882776b27329b91d2d500b6d66dd1d"
+SRC_URI[sha256sum] = "0069e1e9af888b3e05384380ad8cc6c976ea3e81d08ba19b7675ce1d693a41b5"
+SRC_URI_append_class-native = " \
+ file://disable-macro-checks-not-used-for-scanner.patch \
+ "
+EXTRA_OECONF_class-native = "--disable-documentation --enable-scanner"
+
+inherit autotools pkgconfig
+
+# We need wayland-native for the wayland-scanner utility
+BBCLASSEXTEND = "native"
+
+DEPENDS_class-native = "expat-native libffi-native"
+DEPENDS = "expat libffi wayland-native"
+
+EXTRA_OECONF = "--disable-documentation --disable-scanner"
+
+# Wayland installs a M4 macro for other projects to use, which uses the target
+# pkg-config to find files. Replace pkg-config with pkg-config-native.
+do_install_append_class-native() {
+ sed -e 's,PKG_CHECK_MODULES(.*),,g' \
+ -e 's,$PKG_CONFIG,pkg-config-native,g' \
+ -i ${D}/${datadir}/aclocal/wayland-scanner.m4
+}
+
+sysroot_stage_all_append_class-target () {
+ cp ${STAGING_DATADIR_NATIVE}/aclocal/wayland-scanner.m4 ${SYSROOT_DESTDIR}/${datadir}/aclocal/
+}
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/weston/disable-wayland-scanner-pkg-check.patch b/meta-rcar-gen2/recipes-graphics/wayland/weston/disable-wayland-scanner-pkg-check.patch
new file mode 100644
index 0000000..062da5c
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/weston/disable-wayland-scanner-pkg-check.patch
@@ -0,0 +1,13 @@
+Index: weston-1.5.0/configure.ac
+===================================================================
+--- weston-1.5.0.orig/configure.ac
++++ weston-1.5.0/configure.ac
+@@ -503,7 +503,7 @@ if test x$wayland_scanner = x; then
+ AC_MSG_ERROR([wayland-scanner is needed to compile weston])
+ fi
+
+-PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner)
++#PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner)
+
+ AC_CONFIG_FILES([Makefile src/version.h src/weston.pc])
+
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/weston/make-lcms-explicitly-configurable.patch b/meta-rcar-gen2/recipes-graphics/wayland/weston/make-lcms-explicitly-configurable.patch
new file mode 100644
index 0000000..35e6d6f
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/weston/make-lcms-explicitly-configurable.patch
@@ -0,0 +1,43 @@
+weston-1.5.0/configure.ac: make lcms explicitly configurable
+
+The lcms package is outside of openembedded-core, so make it
+explicitly configurable. Make it deterministic, so that if lcms
+dependencies are missing, autoconf throws a fatal error. Follow
+upstream style to make it more likely to be merged.
+
+Upstream-Status: Pending
+
+Index: weston-1.5.0/configure.ac
+===================================================================
+--- weston-1.5.0.orig/configure.ac
++++ weston-1.5.0/configure.ac
+@@ -491,12 +491,24 @@ AC_ARG_ENABLE(demo-clients-install,
+ enable_demo_clients_install=no)
+ AM_CONDITIONAL(INSTALL_DEMO_CLIENTS, [test "x$enable_demo_clients_install" = "xyes"])
+
+-PKG_CHECK_MODULES(LCMS, lcms2,
+- [have_lcms=yes], [have_lcms=no])
+-if test "x$have_lcms" = xyes; then
+- AC_DEFINE(HAVE_LCMS, 1, [Have lcms support])
++AC_ARG_ENABLE(lcms,
++ AS_HELP_STRING([--disable-lcms],
++ [Disable lcms support]),,
++ enable_lcms=auto)
++AM_CONDITIONAL(HAVE_LCMS, [test "x$enable_lcms" = xyes])
++if test "x$enable_lcms" != "xno"; then
++ PKG_CHECK_MODULES(LCMS,
++ lcms2,
++ [have_lcms=yes],
++ [have_lcms=no])
++ if test "x$have_lcms" = "xno" -a "x$enable_lcms" = "xyes"; then
++ AC_MSG_ERROR([lcms support explicitly requested, but lcms couldn't be found])
++ fi
++ if test "x$have_lcms" = "xyes"; then
++ enable_lcms=yes
++ AC_DEFINE(HAVE_LCMS, 1, [Have lcms support])
++ fi
+ fi
+-AM_CONDITIONAL(HAVE_LCMS, [test "x$have_lcms" = xyes])
+
+ AC_PATH_PROG([wayland_scanner], [wayland-scanner])
+ if test x$wayland_scanner = x; then
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/weston/make-libwebp-explicitly-configurable.patch b/meta-rcar-gen2/recipes-graphics/wayland/weston/make-libwebp-explicitly-configurable.patch
new file mode 100644
index 0000000..ad07d4f
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/weston/make-libwebp-explicitly-configurable.patch
@@ -0,0 +1,37 @@
+
+The libwebp package is outside of openembedded-core, so make it
+explicitly configurable. Make it deterministic, so that if libwebp
+dependencies are missing, autoconf throws a fatal error.
+
+Upstream-Status: Pending
+
+Index: weston-1.5.0/configure.ac
+===================================================================
+--- weston-1.5.0.orig/configure.ac
++++ weston-1.5.0/configure.ac
+@@ -268,9 +268,22 @@ fi
+
+ PKG_CHECK_MODULES(PIXMAN, [pixman-1])
+ PKG_CHECK_MODULES(PNG, [libpng])
+-PKG_CHECK_MODULES(WEBP, [libwebp], [have_webp=yes], [have_webp=no])
+-AS_IF([test "x$have_webp" = "xyes"],
+- [AC_DEFINE([HAVE_WEBP], [1], [Have webp])])
++AC_ARG_ENABLE(webp,
++ AS_HELP_STRING([--disable-webp],
++ [Disable libwebp support]),,
++ enable_webp=auto)
++AM_CONDITIONAL(HAVE_WEBP, [test "x$enable_webp" = xyes])
++AS_IF([test "x$enable_webp" != "xno"],
++ PKG_CHECK_MODULES(WEBP,
++ [libwebp],
++ [have_webp=yes],
++ [have_webp=no])
++ AS_IF([test "x$have_webp" = "xno" -a "x$enable_webp" = "xyes"],
++ AC_MSG_ERROR([libwebp support explicitly request, but lipwebp could not be found]))
++ AS_IF([test "x$have_webp" = "xyes"],
++ [enable_webp=yes]
++ [AC_DEFINE([HAVE_WEBP], [1], [Have webp])])
++)
+
+ AC_ARG_ENABLE(vaapi-recorder, [ --enable-vaapi-recorder],,
+ enable_vaapi_recorder=auto)
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/weston/weston.desktop b/meta-rcar-gen2/recipes-graphics/wayland/weston/weston.desktop
new file mode 100644
index 0000000..1086ae8
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/weston/weston.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Name=Weston
+Comment=Wayland Compostitor
+Exec=weston
+Icon=weston
+Terminal=false
+Categories=Utility;
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/weston/weston.png b/meta-rcar-gen2/recipes-graphics/wayland/weston/weston.png
new file mode 100644
index 0000000..ea8b7e0
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/weston/weston.png
Binary files differ
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/weston_1.5.0.bb b/meta-rcar-gen2/recipes-graphics/wayland/weston_1.5.0.bb
new file mode 100644
index 0000000..4a8584f
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/weston_1.5.0.bb
@@ -0,0 +1,87 @@
+SUMMARY = "Weston, a Wayland compositor"
+DESCRIPTION = "Weston is the reference implementation of a Wayland compositor"
+HOMEPAGE = "http://wayland.freedesktop.org"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=275efac2559a224527bd4fd593d38466 \
+ file://src/compositor.c;endline=23;md5=aa98a8db03480fe7d500d0b1f4b8850c"
+
+SRC_URI = "http://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
+ file://weston.png \
+ file://weston.desktop \
+ file://disable-wayland-scanner-pkg-check.patch \
+ file://make-lcms-explicitly-configurable.patch \
+ file://make-libwebp-explicitly-configurable.patch \
+"
+SRC_URI[md5sum] = "8eb40d230efc2411f083c20656534780"
+SRC_URI[sha256sum] = "06388ba04ac79aa72d685cc1a8e646ddb2b8cfe11fcc742294f9addac48b7684"
+
+inherit autotools pkgconfig useradd
+
+DEPENDS = "libxkbcommon gdk-pixbuf pixman cairo glib-2.0 jpeg"
+DEPENDS += "wayland virtual/egl pango"
+
+EXTRA_OECONF = "--enable-setuid-install \
+ --disable-xwayland \
+ --enable-simple-clients \
+ --enable-clients \
+ --enable-demo-clients-install \
+ --disable-libunwind \
+ --disable-rpi-compositor \
+ --disable-rdp-compositor \
+ "
+
+
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms fbdev wayland egl', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'launch', '', d)} \
+ "
+#
+# Compositor choices
+#
+# Weston on KMS
+PACKAGECONFIG[kms] = "--enable-drm-compositor,--disable-drm-compositor,drm udev virtual/mesa mtdev"
+# Weston on Wayland (nested Weston)
+PACKAGECONFIG[wayland] = "--enable-wayland-compositor,--disable-wayland-compositor,virtual/mesa"
+# Weston on X11
+PACKAGECONFIG[x11] = "--enable-x11-compositor,--disable-x11-compositor,virtual/libx11 libxcb libxcb libxcursor cairo"
+# Headless Weston
+PACKAGECONFIG[headless] = "--enable-headless-compositor,--disable-headless-compositor"
+# Weston on framebuffer
+PACKAGECONFIG[fbdev] = "--enable-fbdev-compositor,--disable-fbdev-compositor,udev mtdev"
+# weston-launch
+PACKAGECONFIG[launch] = "--enable-weston-launch,--disable-weston-launch,libpam drm"
+# VA-API desktop recorder
+PACKAGECONFIG[vaapi] = "--enable-vaapi-recorder,--disable-vaapi-recorder,libva"
+# Weston with EGL support
+PACKAGECONFIG[egl] = "--enable-egl --enable-simple-egl-clients,--disable-egl --disable-simple-egl-clients,virtual/egl"
+# Weston with cairo glesv2 support
+PACKAGECONFIG[cairo-glesv2] = "--with-cairo-glesv2,--with-cairo=image,cairo"
+# Weston with lcms support
+PACKAGECONFIG[lcms] = "--enable-lcms,--disable-lcms,lcms"
+# Weston with webp support
+PACKAGECONFIG[webp] = "--enable-webp,--disable-webp,libwebp"
+
+do_install_append() {
+ # Weston doesn't need the .la files to load modules, so wipe them
+ rm -f ${D}/${libdir}/weston/*.la
+
+ # If X11, ship a desktop file to launch it
+ if [ "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}" = "x11" ]; then
+ install -d ${D}${datadir}/applications
+ install ${WORKDIR}/weston.desktop ${D}${datadir}/applications
+
+ install -d ${D}${datadir}/icons/hicolor/48x48/apps
+ install ${WORKDIR}/weston.png ${D}${datadir}/icons/hicolor/48x48/apps
+ fi
+}
+
+PACKAGES += "${PN}-examples"
+
+FILES_${PN} = "${bindir}/weston ${bindir}/weston-terminal ${bindir}/weston-info ${bindir}/weston-launch ${bindir}/wcap-decode ${libexecdir} ${datadir}"
+FILES_${PN}-examples = "${bindir}/*"
+
+RDEPENDS_${PN} += "xkeyboard-config"
+RRECOMMENDS_${PN} = "liberation-fonts"
+
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "--system weston-launch"
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/weston_1.5.0.bbappend b/meta-rcar-gen2/recipes-graphics/wayland/weston_1.5.0.bbappend
new file mode 100644
index 0000000..0f2f5a6
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/weston_1.5.0.bbappend
@@ -0,0 +1,25 @@
+require ../../include/gles-control.inc
+
+PACKAGECONFIG_rcar-gen2 := "${@'${PACKAGECONFIG}'.replace('x11', '')}"
+
+PACKAGECONFIG_append_rcar-gen2 = " \
+ ${@base_conditional('USE_GLES', '1', '', 'fbdev', d)}"
+DEPENDS_append_rcar-gen2 = " \
+ ${@base_conditional('USE_GLES', '1', 'gles-user-module', '', d)}"
+EXTRA_OECONF_append_rcar-gen2 = " \
+ ${@base_conditional('USE_GLES', '1', '--enable-v4l2', \
+ '--disable-xwayland-test WESTON_NATIVE_BACKEND=fbdev-backend.so', d)}"
+
+SRCREV_rcar-gen2 = "${@'decdc587ceb147d22eb989a3334e627208030f69' \
+ if '1' in '${USE_GLES}' else '00781bcf518f6bab0d08e6962630b0994e8bf632'}"
+SRC_URI_rcar-gen2 = "git://github.com/renesas-devel/weston.git;protocol=git;branch=RCAR-GEN2/1.5.0/gl-fallback \
+ file://weston.desktop \
+ file://weston.png \
+ file://disable-wayland-scanner-pkg-check.patch \
+ file://make-lcms-explicitly-configurable.patch \
+ file://make-libwebp-explicitly-configurable.patch \
+"
+S = "${WORKDIR}/git"
+
+RDEPENDS_${PN}_append_rcar-gen2 = " \
+ ${@base_conditional('USE_GLES', '1', 'media-ctl', '', d)}"
diff --git a/meta-rcar-gen2/recipes-kernel/fdpm-module/fdpm-kernel-module.bb b/meta-rcar-gen2/recipes-kernel/fdpm-module/fdpm-kernel-module.bb
new file mode 100644
index 0000000..328c833
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/fdpm-module/fdpm-kernel-module.bb
@@ -0,0 +1,84 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "GPLv2&MIT"
+LIC_FILES_CHKSUM = "file://drv/GPL-COPYING;md5=ffa10f40b98be2c2bc9608f56827ed23 \
+ file://drv/MIT-COPYING;md5=5526ef6e21dc96a1dd89fac4bde9f995"
+
+DEPENDS = "linux-renesas mmngr-kernel-module"
+PN = "fdpm-kernel-module"
+PR = "r0"
+SRC_URI = "file://fdpm-kernel.tar.bz2"
+S = "${WORKDIR}/fdpm"
+
+FDPM_CFG_r8a7790 = "H2CONFIG"
+FDPM_CFG_r8a7791 = "M2CONFIG"
+FDPM_CFG_r8a7793 = "M2CONFIG"
+FDPM_CFG_r8a7794 = "E2CONFIG"
+
+KERNEL_HEADER_PATH = "${KERNELSRC}/include/linux"
+FDPM_INATALL_HEADERS="fdpm_drv.h fdpm_public.h fdpm_api.h"
+
+do_compile() {
+ # Build kernel module
+ export FDPM_CONFIG=${FDPM_CFG}
+ export FDPM_MMNGRDIR=${KERNELSRC}/include
+ cd ${S}/drv
+ make all ARCH=arm
+}
+
+do_install() {
+ # Create destination folder
+ mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/extra ${D}/usr/src/kernel/include
+
+ # Copy driver and header files
+ cp -f ${S}/drv/fdpm.ko ${D}/lib/modules/${KERNEL_VERSION}/extra
+ cp ${S}/drv/Module.symvers ${KERNELSRC}/include/fdpm.symvers
+
+ for f in ${FDPM_INATALL_HEADERS} ; do
+ cp -f ${KERNEL_HEADER_PATH}/${f} ${KERNELSRC}/include
+ done
+
+ # Copy header files to destination
+ for f in ${FDPM_INATALL_HEADERS} ; do
+ cp -f ${KERNEL_HEADER_PATH}/${f} ${D}/usr/src/kernel/include
+ done
+ cp -f ${S}/drv/Module.symvers ${D}/usr/src/kernel/include/fdpm.symvers
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ if [ -d ${KERNELSRC} ] ; then
+ cd ${KERNELSRC}/include/linux/
+ rm -f fdpm_drv.h ${FDPM_INATALL_HEADERS}
+
+ cd ${KERNELSRC}/include/
+ rm -f fdpm.symvers ${FDPM_INATALL_HEADERS}
+ fi
+}
+
+PACKAGES = " \
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /lib/modules/${KERNEL_VERSION}/extra/fdpm.ko \
+"
+
+FILES_${PN}-dev = " \
+ /usr/src/kernel/include/*.h \
+ /usr/src/kernel/include/fdpm.symvers \
+"
+
+RPROVIDES_${PN} += "fdpm-kernel-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+do_configure[noexec] = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-kernel/fdpm-module/files/.gitkeep b/meta-rcar-gen2/recipes-kernel/fdpm-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/fdpm-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-kernel/gles-module/gles-kernel-module.bb b/meta-rcar-gen2/recipes-kernel/gles-module/gles-kernel-module.bb
new file mode 100644
index 0000000..a24d97f
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/gles-module/gles-kernel-module.bb
@@ -0,0 +1,102 @@
+DESCRIPTION = "RGX/SGX kernel module"
+LICENSE = "GPLv2&MIT"
+LIC_FILES_CHKSUM = "file://GPL-COPYING;md5=60422928ba677faaa13d6ab5f5baaa1e \
+ file://MIT-COPYING;md5=8c2810fa6bfdc5ae5c15a0c1ade34054"
+DEPENDS = "linux-renesas"
+PN = "gles-kernel-module"
+PR = "r0"
+
+COMPATIBLE_MACHINE = "(r8a7790|r8a7791|r8a7793|r8a7794)"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+SRC_URI_r8a7790 = 'file://RGX_KM_H2.tar.bz2'
+S_r8a7790 = "${WORKDIR}/rogue_km"
+KERNEL_SRC_PATH_r8a7790 = "build/linux/r8a7790_linux"
+TARGET_PATH_r8a7790 = "rogue_km/binary_r8a7790_linux_release/target/kbuild/"
+
+SRC_URI_r8a7791 = 'file://SGX_KM_M2.tar.bz2'
+S_r8a7791 = "${WORKDIR}/eurasia_km"
+KERNEL_SRC_PATH_r8a7791 = "eurasiacon/build/linux2/r8a7791_linux/"
+TARGET_PATH_r8a7791 = "eurasia_km/eurasiacon/binary2_r8a7791_linux_release/target/kbuild"
+
+SRC_URI_r8a7793 = 'file://SGX_KM_M2.tar.bz2'
+S_r8a7793 = "${WORKDIR}/eurasia_km"
+KERNEL_SRC_PATH_r8a7793 = "eurasiacon/build/linux2/r8a7793_linux/"
+TARGET_PATH_r8a7793 = "eurasia_km/eurasiacon/binary2_r8a7793_linux_release/target/kbuild"
+
+SRC_URI_r8a7794 = 'file://SGX_KM_E2.tar.bz2'
+S_r8a7794 = "${WORKDIR}/eurasia_km"
+KERNEL_SRC_PATH_r8a7794 = "eurasiacon/build/linux2/r8a7794_linux/"
+TARGET_PATH_r8a7794 = "eurasia_km/eurasiacon/binary2_r8a7794_linux_release/target/kbuild"
+
+GLES = "${@base_contains('MACHINE_FEATURES', 'rgx', 'rgx', \
+ base_contains('MACHINE_FEATURES', 'sgx', 'sgx', '', d), d)}"
+
+RPROVIDES_${PN} += "${GLES}-kernel-module"
+
+inherit module
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+do_patch[noexec] = "1"
+do_configure[noexec] = "1"
+do_populate_lic[noexec] = "1"
+
+export BUILDDIR = "${STAGING_INCDIR}/.."
+export LIBSHARED = "${STAGING_LIBDIR}"
+export KERNELSRC = "${STAGING_KERNEL_DIR}"
+export CROSS_COMPILE = "${TARGET_PREFIX}"
+export KERNELDIR = "${STAGING_KERNEL_DIR}"
+export LDFLAGS=""
+export CP = "cp"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_compile() {
+ cd ${S}/${KERNEL_SRC_PATH}
+ unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
+ make kbuild ARCH=arm DISCIMAGE=${D}
+}
+
+do_install() {
+ export DISCIMAGE=${D}
+ mkdir -p ${D}/lib/modules/${KERNEL_VERSION}
+
+ cd ${S}/${KERNEL_SRC_PATH}
+
+ unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
+ make kbuild_install ARCH=arm DISCIMAGE=${D}
+ mkdir -p ${D}/usr/src/kernel/include
+ cp -f ${WORKDIR}/${TARGET_PATH}/Module.symvers \
+ ${KERNELSRC}/include/${GLES}.symvers
+ cp -f ${WORKDIR}/${TARGET_PATH}/Module.symvers \
+ ${D}/usr/src/kernel/include/${GLES}.symvers
+}
+
+do_clean_source() {
+ rm -Rf ${KERNELSRC}/include/${GLES}.symvers
+}
+
+ALLOW_EMPTY_kernel-module-bc-example = "1"
+ALLOW_EMPTY_kernel-module-dc-linuxfb = "1"
+ALLOW_EMPTY_kernel-module-pvrsrvkm = "1"
+
+FILES_${PN}-dev = " \
+ /usr/src/kernel/include/${GLES}.symvers \
+"
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /lib/modules/${KERNEL_VERSION}/* \
+ /lib/modules/${KERNEL_VERSION}/extra/* \
+"
diff --git a/meta-rcar-gen2/recipes-kernel/gles-module/gles-kernel-module/.gitkeep b/meta-rcar-gen2/recipes-kernel/gles-module/gles-kernel-module/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/gles-module/gles-kernel-module/.gitkeep
diff --git a/meta-rcar-gen2/recipes-kernel/linux-libc-headers/linux-libc-headers/scripts-Makefile.headersinst-install-headers-from-sc.patch b/meta-rcar-gen2/recipes-kernel/linux-libc-headers/linux-libc-headers/scripts-Makefile.headersinst-install-headers-from-sc.patch
new file mode 100644
index 0000000..7eb7def
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux-libc-headers/linux-libc-headers/scripts-Makefile.headersinst-install-headers-from-sc.patch
@@ -0,0 +1,59 @@
+From b200d4bcffc86bb08fd3898bc7cde00f0686f62d Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Fri, 13 Sep 2013 22:01:02 -0400
+Subject: [PATCH] scripts/Makefile.headersinst: install headers from scratch file
+
+If headers_install is executed from a deep/long directory structure, the
+shell's maximum argument length can be execeeded, which breaks the operation
+with:
+
+| make[2]: execvp: /bin/sh: Argument list too long
+| make[2]: ***
+
+By dumping the input files to a scratch file and using xargs to read the
+input list from the scratch file, we can avoid blowing out the maximum
+argument size and install headers in a long path name environment.
+
+Robert:
+Use "$(foreach ,,$(shell echo))" rather than "echo" to make it work when
+len(TMPDIR) <= 410.
+
+Upstream-Status: Inappropriate [oe-specific]
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+RP: Refreshed for 3.10 as the problem still exists there on the autobuilders
+ scripts/Makefile.headersinst | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
+--- a/scripts/Makefile.headersinst
++++ b/scripts/Makefile.headersinst
+@@ -72,7 +72,7 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
+ quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
+ file$(if $(word 2, $(all-files)),s))
+ cmd_install = \
+- $(CONFIG_SHELL) $< $(installdir) $(input-files); \
++ xargs $(CONFIG_SHELL) $< $(installdir) < $(INSTALL_HDR_PATH)/.input-files; \
+ for F in $(wrapper-files); do \
+ echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
+ done; \
+@@ -98,10 +98,17 @@ __headersinst: $(subdirs) $(install-file)
+ @:
+
+ targets += $(install-file)
++# Use the $(foreach ,,$(shell echo)) to avoid the "Argument list too
++# long" error, and use the "$(shell echo)" rather than "echo" to keep
++# the order.
+ $(install-file): scripts/headers_install.sh $(input-files) FORCE
+ $(if $(unwanted),$(call cmd,remove),)
+ $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
++ $(shell echo -n > $(INSTALL_HDR_PATH)/.input-files)
++ $(foreach f,$(input-files),$(shell echo -n "$(f) " >> \
++ $(INSTALL_HDR_PATH)/.input-files))
+ $(call if_changed,install)
++ @rm $(INSTALL_HDR_PATH)/.input-files
+
+ else
+ __headerscheck: $(subdirs) $(check-file)
diff --git a/meta-rcar-gen2/recipes-kernel/linux-libc-headers/linux-libc-headers_3.10.bb b/meta-rcar-gen2/recipes-kernel/linux-libc-headers/linux-libc-headers_3.10.bb
new file mode 100644
index 0000000..69a9396
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux-libc-headers/linux-libc-headers_3.10.bb
@@ -0,0 +1,13 @@
+require recipes-kernel/linux-libc-headers/linux-libc-headers.inc
+
+KORG_ARCHIVE_COMPRESSION = "xz"
+COMPATIBLE_MACHINE = "(alt|gose|koelsch|lager|porter|silk)"
+PV_append = "+git${SRCREV}"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+RENESAS_BACKPORTS_URL="git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas-backport.git"
+SRCREV = "b8ca8c397343f4233f9f68fc3a5bf8e1c9b88251"
+SRC_URI = "${RENESAS_BACKPORTS_URL};protocol=git;branch=bsp/v3.10.31-ltsi/rcar-gen2-1.9.2 \
+ file://scripts-Makefile.headersinst-install-headers-from-sc.patch"
+S = "${WORKDIR}/git"
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-dtb-append.inc b/meta-rcar-gen2/recipes-kernel/linux/linux-dtb-append.inc
new file mode 100644
index 0000000..725f377
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-dtb-append.inc
@@ -0,0 +1,61 @@
+do_install_append() {
+ if [ ! -n "${KERNEL_DEVICETREE}" ]; then
+ echo "Device tree does not support"
+ exit
+ fi
+
+ for DTS_FILE in ${KERNEL_DEVICETREE}; do
+ if [ ! -f ${DTS_FILE} ]; then
+ echo "Warning: ${DTS_FILE} is not available!"
+ continue
+ fi
+ DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
+ if [ ! -f arch/${ARCH}/boot/dts/${DTS_BASE_NAME}.dtb ]; then
+ echo "Warning: ${DTS_BASE_NAME}.dtb is not available!"
+ continue
+ fi
+ # create zImage (for bootz)
+ cat arch/${ARCH}/boot/zImage arch/${ARCH}/boot/dts/${DTS_BASE_NAME}.dtb > arch/${ARCH}/boot/zImage+dtb
+ # create uImage
+ $(cut -f 3- -d ' ' < arch/${ARCH}/boot/.uImage.cmd | sed -e 's/zImage/zImage+dtb/g' -e 's/uImage/uImage+dtb/g')
+ done
+}
+
+do_deploy_append() {
+ # zImage
+ if [ -f ${B}/arch/${ARCH}/boot/zImage -a "${KERNEL_IMAGETYPE}" != "zImage" ]; then
+ ZIMAGE_AND_DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/uImage/zImage/g"`
+
+ install -d ${DEPLOYDIR}
+ install -m 0644 ${B}/arch/${ARCH}/boot/zImage ${DEPLOYDIR}/${ZIMAGE_AND_DTB_NAME}
+ cd ${DEPLOYDIR}
+ ln -sf ${ZIMAGE_AND_DTB_NAME} zImage
+ cd -
+ fi
+
+ # zImage + DTB
+ if [ -f ${B}/arch/${ARCH}/boot/zImage+dtb ]; then
+ ZIMAGE_AND_DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/uImage/zImage+dtb/g"`
+
+ install -d ${DEPLOYDIR}
+ install -m 0644 ${B}/arch/${ARCH}/boot/zImage+dtb ${DEPLOYDIR}/${ZIMAGE_AND_DTB_NAME}
+ cd ${DEPLOYDIR}
+ ln -sf ${ZIMAGE_AND_DTB_NAME} zImage+dtb
+ cd -
+ else
+ echo "Warning: arch/${ARCH}/boot/zImage+dtb is not available!"
+ fi
+
+ # uImage (zImage + DTB)
+ if [ -f ${B}/arch/${ARCH}/boot/uImage+dtb ]; then
+ UIMAGE_AND_DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/uImage/uImage+dtb/g"`
+
+ install -d ${DEPLOYDIR}
+ install -m 0644 ${B}/arch/${ARCH}/boot/uImage+dtb ${DEPLOYDIR}/${UIMAGE_AND_DTB_NAME}
+ cd ${DEPLOYDIR}
+ ln -sf ${UIMAGE_AND_DTB_NAME} uImage+dtb
+ cd -
+ else
+ echo "Warning: arch/${ARCH}/boot/uImage+dtb is not available!"
+ fi
+}
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-dtb.inc b/meta-rcar-gen2/recipes-kernel/linux/linux-dtb.inc
new file mode 100644
index 0000000..6b8f1a5
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-dtb.inc
@@ -0,0 +1,69 @@
+# Support for device tree generation
+FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
+
+python __anonymous () {
+ d.appendVar("PACKAGES", " kernel-devicetree")
+}
+
+do_install_append() {
+ if test -n "${KERNEL_DEVICETREE}"; then
+ for DTB in ${KERNEL_DEVICETREE}; do
+ if echo ${DTB} | grep -q '/dts/'; then
+ bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
+ DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
+ fi
+ DTB_BASE_NAME=`basename ${DTB} .dtb`
+ DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+ DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+ DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
+ oe_runmake ${DTB}
+ if [ ! -e "${DTB_PATH}" ]; then
+ DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
+ fi
+ install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
+ done
+ fi
+}
+
+do_deploy_append() {
+ if test -n "${KERNEL_DEVICETREE}"; then
+ for DTB in ${KERNEL_DEVICETREE}; do
+ if echo ${DTB} | grep -q '/dts/'; then
+ bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
+ DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
+ fi
+ DTB_BASE_NAME=`basename ${DTB} .dtb`
+ DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+ DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+ DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
+ if [ ! -e "${DTB_PATH}" ]; then
+ DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
+ fi
+ install -d ${DEPLOYDIR}
+ install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb
+ cd ${DEPLOYDIR}
+ ln -sf ${DTB_NAME}.dtb ${DTB_SYMLINK_NAME}.dtb
+ cd -
+ done
+ fi
+}
+
+pkg_postinst_kernel-devicetree () {
+ cd /${KERNEL_IMAGEDEST}
+ for DTB_FILE in ${KERNEL_DEVICETREE}
+ do
+ DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
+ DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+ update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
+ done
+}
+
+pkg_postrm_kernel-devicetree () {
+ cd /${KERNEL_IMAGEDEST}
+ for DTB_FILE in ${KERNEL_DEVICETREE}
+ do
+ DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
+ DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
+ update-alternatives --remove ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
+ done
+}
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-alt-Add-vmalloc-384M-to-bootargs-of-DTS.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-alt-Add-vmalloc-384M-to-bootargs-of-DTS.patch
new file mode 100644
index 0000000..b7d23b2
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-alt-Add-vmalloc-384M-to-bootargs-of-DTS.patch
@@ -0,0 +1,26 @@
+From 7baf674a7c54d3241d796adf3249b304aa2aeaaf Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Mon, 14 Jul 2014 11:44:41 +0900
+Subject: [PATCH] arm: shmobile: alt: Add 'vmalloc=384M' to bootargs of DTS
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+---
+ arch/arm/boot/dts/r8a7794-alt.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/r8a7794-alt.dts b/arch/arm/boot/dts/r8a7794-alt.dts
+index 3e1afef..c85edda8 100644
+--- a/arch/arm/boot/dts/r8a7794-alt.dts
++++ b/arch/arm/boot/dts/r8a7794-alt.dts
+@@ -31,7 +31,7 @@
+ compatible = "renesas,alt", "renesas,r8a7794";
+
+ chosen {
+- bootargs = "console=ttySC10,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp";
++ bootargs = "console=ttySC10,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp vmalloc=384M";
+ };
+
+ memory@40000000 {
+--
+1.7.9.5
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-gose-Add-vmalloc-384M-to-bootargs-of-DTS.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-gose-Add-vmalloc-384M-to-bootargs-of-DTS.patch
new file mode 100644
index 0000000..5c282c8
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-gose-Add-vmalloc-384M-to-bootargs-of-DTS.patch
@@ -0,0 +1,26 @@
+From f1b6ab8592afda486b6c4c513f39dfbe2a4e8334 Mon Sep 17 00:00:00 2001
+From: Dien Pham <dien.pham.ry@rvc.renesas.com>
+Date: Fri, 15 Aug 2014 14:59:45 +0700
+Subject: [PATCH] arm gose Add vmalloc 384M to bootargs of DTS
+
+Signed-off-by: Dien Pham <dien.pham.ry@rvc.renesas.com>
+---
+ arch/arm/boot/dts/r8a7793-gose.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/r8a7793-gose.dts b/arch/arm/boot/dts/r8a7793-gose.dts
+index 9c0108b..fbe3566 100644
+--- a/arch/arm/boot/dts/r8a7793-gose.dts
++++ b/arch/arm/boot/dts/r8a7793-gose.dts
+@@ -36,7 +36,7 @@
+ };
+
+ chosen {
+- bootargs = "console=ttySC6,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp";
++ bootargs = "console=ttySC6,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp vmalloc=384M";
+ };
+
+ memory@40000000 {
+--
+1.8.0.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-koelsch-Add-vmalloc-384M-to-bootargs-of-DTS.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-koelsch-Add-vmalloc-384M-to-bootargs-of-DTS.patch
new file mode 100644
index 0000000..d32019f
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-koelsch-Add-vmalloc-384M-to-bootargs-of-DTS.patch
@@ -0,0 +1,26 @@
+From 6f5df111b2cf5d4cb01922da7076a7ab238f5650 Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Mon, 14 Jul 2014 11:43:03 +0900
+Subject: [PATCH 1/3] arm: shmobile: koelsch: Add 'vmalloc=384M' to bootargs of DTS
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+---
+ arch/arm/boot/dts/r8a7791-koelsch.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
+index 5dc4f7d..d3619fc 100644
+--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
++++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
+@@ -39,7 +39,7 @@
+ };
+
+ chosen {
+- bootargs = "console=ttySC6,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp";
++ bootargs = "console=ttySC6,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp vmalloc=384M";
+ };
+
+ memory@40000000 {
+--
+1.7.9.5
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-lager-Add-vmalloc-384M-to-bootargs-of-DTS.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-lager-Add-vmalloc-384M-to-bootargs-of-DTS.patch
new file mode 100644
index 0000000..8d19c6d
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-arm-lager-Add-vmalloc-384M-to-bootargs-of-DTS.patch
@@ -0,0 +1,26 @@
+From 7a6b38f46db215055017a3288bd0d0bc6cfd5e8d Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Mon, 14 Jul 2014 11:43:33 +0900
+Subject: [PATCH] arm: shmobile: lager: Add 'vmalloc=384M' to bootargs of DTS
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index 58b30a2..e0ac607 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -38,7 +38,7 @@
+ };
+
+ chosen {
+- bootargs = "console=ttySC6,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp";
++ bootargs = "console=ttySC6,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp vmalloc=384M";
+ };
+
+ memory@40000000 {
+--
+1.7.9.5
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-kernel-Silk-board-support.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-kernel-Silk-board-support.patch
new file mode 100644
index 0000000..12fb76c
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0001-kernel-Silk-board-support.patch
@@ -0,0 +1,1456 @@
+From f04a201ce9bfc04ca4b8b017116ca1cf9a313c9a Mon Sep 17 00:00:00 2001
+From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+Date: Sat, 6 Dec 2014 03:29:15 +0300
+Subject: [linux-kernel][PATCH] arm: rmobile: Add SILK board support
+
+SILK is an entry level development board based on R-Car E2 SoC (R8A7794)
+
+Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+
+---
+ arch/arm/boot/dts/Makefile | 1 +
+ arch/arm/boot/dts/r8a7794-silk.dts | 360 ++++++++++
+ arch/arm/configs/shmobile_defconfig | 1 +
+ arch/arm/mach-shmobile/Kconfig | 6 +
+ arch/arm/mach-shmobile/Makefile | 1 +
+ arch/arm/mach-shmobile/Makefile.boot | 1 +
+ arch/arm/mach-shmobile/board-silk-reference.c | 995 ++++++++++++++++++++++++++
+ 7 files changed, 1365 insertions(+)
+ create mode 100644 arch/arm/boot/dts/r8a7794-silk.dts
+ create mode 100644 arch/arm/mach-shmobile/board-silk-reference.c
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index 2a7b49b..f2b99db 100644
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -178,6 +178,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
+ r8a7791-koelsch.dtb \
+ r8a7790-lager.dtb \
+ r8a7794-alt.dtb \
++ r8a7794-silk.dtb \
+ r8a7793-gose.dtb \
+ r8a7779-marzen.dtb
+ dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \
+diff --git a/arch/arm/boot/dts/r8a7794-silk.dts b/arch/arm/boot/dts/r8a7794-silk.dts
+new file mode 100644
+index 0000000..cb69f6b
+--- /dev/null
++++ b/arch/arm/boot/dts/r8a7794-silk.dts
+@@ -0,0 +1,360 @@
++/*
++ * Device Tree Source for the Silk board
++ *
++ * Copyright (C) 2014 Renesas Electronics Corporation
++ * Copyright (C) 2014 Cogent Embedded, Inc.
++ *
++ * This file is licensed under the terms of the GNU General Public License
++ * version 2. This program is licensed "as is" without any warranty of any
++ * kind, whether express or implied.
++ */
++
++/*
++ * SSI-AK4643
++ *
++ * SW1: 1: AK4643
++ * 3: ADV7511
++ *
++ * this command is required when playback.
++ *
++ * # amixer set "LINEOUT Mixer DACL" on
++ * # amixer set "Digital" 200
++ * # amixer set "DVC Out" 50
++ */
++
++/dts-v1/;
++#include "r8a7794.dtsi"
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/input/input.h>
++
++/ {
++ model = "Silk";
++ compatible = "renesas,silk", "renesas,r8a7794";
++
++ aliases {
++ serial10 = &scif2;
++ };
++
++ chosen {
++ bootargs = "console=ttySC10,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp vmalloc=384M";
++ };
++
++ memory@40000000 {
++ device_type = "memory";
++ reg = <0 0x40000000 0 0x40000000>;
++ };
++
++ lbsc {
++ #address-cells = <1>;
++ #size-cells = <1>;
++ };
++
++ gpio-keys {
++ compatible = "gpio-keys";
++
++ key-1 {
++ gpios = <&gpio3 9 GPIO_ACTIVE_LOW>;
++ linux,code = <KEY_1>;
++ label = "SW12";
++ gpio-key,wakeup;
++ debounce-interval = <20>;
++ };
++ key-2 {
++ gpios = <&gpio3 10 GPIO_ACTIVE_LOW>;
++ linux,code = <KEY_2>;
++ label = "SW12";
++ gpio-key,wakeup;
++ debounce-interval = <20>;
++ };
++ key-3 {
++ gpios = <&gpio3 11 GPIO_ACTIVE_LOW>;
++ linux,code = <KEY_3>;
++ label = "SW12";
++ gpio-key,wakeup;
++ debounce-interval = <20>;
++ };
++ key-4 {
++ gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
++ linux,code = <KEY_4>;
++ label = "SW12";
++ gpio-key,wakeup;
++ debounce-interval = <20>;
++ };
++ key-a {
++ gpios = <&gpio5 10 GPIO_ACTIVE_LOW>;
++ linux,code = <KEY_A>;
++ label = "SW3";
++ gpio-key,wakeup;
++ debounce-interval = <20>;
++ };
++ key-b {
++ gpios = <&gpio5 11 GPIO_ACTIVE_LOW>;
++ linux,code = <KEY_B>;
++ label = "SW4";
++ gpio-key,wakeup;
++ debounce-interval = <20>;
++ };
++ key-c {
++ gpios = <&gpio5 12 GPIO_ACTIVE_LOW>;
++ linux,code = <KEY_C>;
++ label = "SW6";
++ gpio-key,wakeup;
++ debounce-interval = <20>;
++ };
++ };
++
++ vcc_sdhi0: regulator@0 {
++ compatible = "regulator-fixed";
++
++ regulator-name = "SDHI0 Vcc";
++ regulator-min-microvolt = <3300000>;
++ regulator-max-microvolt = <3300000>;
++
++ gpio = <&gpio2 26 GPIO_ACTIVE_HIGH>;
++ enable-active-high;
++ };
++
++ vccq_sdhi0: regulator@1 {
++ compatible = "regulator-gpio";
++
++ regulator-name = "SDHI0 VccQ";
++ regulator-min-microvolt = <1800000>;
++ regulator-max-microvolt = <3300000>;
++
++ gpios = <&gpio2 29 GPIO_ACTIVE_HIGH>;
++ gpios-states = <1>;
++ states = <3300000 1
++ 1800000 0>;
++ };
++
++ vcc_sdhi1: regulator@2 {
++ compatible = "regulator-fixed";
++
++ regulator-name = "SDHI1 Vcc";
++ regulator-min-microvolt = <3300000>;
++ regulator-max-microvolt = <3300000>;
++
++ gpio = <&gpio4 26 GPIO_ACTIVE_HIGH>;
++ enable-active-high;
++ };
++
++ vccq_sdhi1: regulator@3 {
++ compatible = "regulator-gpio";
++
++ regulator-name = "SDHI1 VccQ";
++ regulator-min-microvolt = <1800000>;
++ regulator-max-microvolt = <3300000>;
++
++ gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
++ gpios-states = <1>;
++ states = <3300000 1
++ 1800000 0>;
++ };
++
++ fixedregulator3v3: fixedregulator@0 {
++ compatible = "regulator-fixed";
++ regulator-name = "fixed-3.3V";
++ regulator-min-microvolt = <3300000>;
++ regulator-max-microvolt = <3300000>;
++ regulator-boot-on;
++ regulator-always-on;
++ };
++
++ hdmi_transmitter: adv7511 {
++ compatible = "adi,adv7511";
++ gpios = <&gpio5 23 GPIO_ACTIVE_LOW>;
++
++ adi,input-style = <0x02>;
++ adi,input-id = <0x00>;
++ adi,input-color-depth = <0x03>;
++ adi,sync-pulse = <0x03>;
++ adi,bit-justification = <0x01>;
++ adi,up-conversion = <0x00>;
++ adi,timing-generation-sequence = <0x00>;
++ adi,vsync-polarity = <0x02>;
++ adi,hsync-polarity = <0x02>;
++ adi,clock-delay = <0x03>;
++ };
++};
++
++&extal_clk {
++ clock-frequency = <20000000>;
++};
++
++&i2c1 {
++ pinctrl-0 = <&i2c1_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++ clock-frequency = <400000>;
++
++ snd_codec: ak4643 {
++ #sound-dai-cells = <0>;
++ compatible = "asahi-kasei,ak4643";
++ reg = <0x12>;
++ };
++};
++
++&i2c8 {
++ status = "okay";
++ clock-frequency = <100000>;
++};
++
++&pfc {
++ pinctrl-0 = <&du_pins &usb0_pins &usb1_pins &sound_pins &sound_clk_pins
++ &vin0_pins>;
++ pinctrl-names = "default";
++
++ du_pins: du {
++ renesas,groups = "du0_rgb888", "du0_sync", "du0_clk_out",
++ "du1_rgb666", "du1_sync", "du1_clk_out";
++ renesas,function = "du";
++ };
++
++ i2c1_pins: i2c1 {
++ renesas,groups = "i2c1";
++ renesas,function = "i2c1";
++ };
++
++ scif2_pins: serial2 {
++ renesas,groups = "scif2_data";
++ renesas,function = "scif2";
++ };
++
++ ether_pins: ether {
++ renesas,groups = "eth_link", "eth_mdio", "eth_rmii";
++ renesas,function = "eth";
++ };
++
++ qspi_pins: spi0 {
++ renesas,groups = "qspi_ctrl", "qspi_data4";
++ renesas,function = "qspi";
++ };
++
++ sdhi0_pins: sd0 {
++ renesas,groups = "sdhi0_data4", "sdhi0_ctrl";
++ renesas,function = "sdhi0";
++ };
++
++ sdhi1_pins: sd1 {
++ renesas,groups = "sdhi1_data4", "sdhi1_ctrl";
++ renesas,function = "sdhi1";
++ };
++
++ mmc0_pins: mmc0 {
++ renesas,groups = "mmc_data8", "mmc_ctrl";
++ renesas,function = "mmc";
++ };
++
++ usb0_pins: usb0 {
++ renesas,groups = "usb0";
++ renesas,function = "usb0";
++ };
++
++ usb1_pins: usb1 {
++ renesas,groups = "usb1";
++ renesas,function = "usb1";
++ };
++
++ vin0_pins: vin0 {
++ renesas,groups = "vin0_data8", "vin0_sync", "vin0_field",
++ "vin0_clkenb", "vin0_clk";
++ renesas,function = "vin0";
++ };
++
++ sound_pins: sound {
++ renesas,groups = "ssi0129_ctrl", "ssi0_data", "ssi1_data";
++ renesas,function = "ssi";
++ };
++ sound_clk_pins: sound_clk {
++ renesas,groups = "audio_clk_c";
++ renesas,function = "audio_clk";
++ };
++};
++
++&ether {
++ phy-handle = <&phy1>;
++ renesas,ether-link-active-low;
++ status = "ok";
++
++ phy1: ethernet-phy@1 {
++ reg = <1>;
++ interrupt-parent = <&irqc0>;
++ interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
++ micrel,led-mode = <1>;
++ };
++};
++
++&scif2 {
++ pinctrl-0 = <&scif2_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++};
++
++&qspi {
++ pinctrl-0 = <&qspi_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++
++ flash: flash@0 {
++ #address-cells = <1>;
++ #size-cells = <1>;
++ compatible = "spansion,s25fl512s";
++ reg = <0>;
++ spi-max-frequency = <30000000>;
++ spi-tx-bus-width = <4>;
++ spi-rx-bus-width = <4>;
++ m25p,fast-read;
++ spi-cpol;
++ spi-cpha;
++
++ partition@0 {
++ label = "loader";
++ reg = <0x00000000 0x00040000>;
++ read-only;
++ };
++ partition@40000 {
++ label = "user";
++ reg = <0x00040000 0x00400000>;
++ read-only;
++ };
++ partition@440000 {
++ label = "flash";
++ reg = <0x00440000 0x03bc0000>;
++ };
++ };
++};
++
++&sdhi0 {
++ pinctrl-0 = <&sdhi0_pins>;
++ pinctrl-names = "default";
++
++ vmmc-supply = <&vcc_sdhi0>;
++ vqmmc-supply = <&vccq_sdhi0>;
++ cd-gpios = <&gpio6 6 GPIO_ACTIVE_LOW>;
++ wp-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
++ status = "okay";
++};
++
++&sdhi1 {
++ pinctrl-0 = <&sdhi1_pins>;
++ pinctrl-names = "default";
++
++ vmmc-supply = <&vcc_sdhi1>;
++ vqmmc-supply = <&vccq_sdhi1>;
++ cd-gpios = <&gpio6 14 GPIO_ACTIVE_LOW>;
++ wp-gpios = <&gpio6 15 GPIO_ACTIVE_HIGH>;
++ status = "okay";
++};
++
++&mmcif0 {
++ pinctrl-0 = <&mmc0_pins>;
++ pinctrl-names = "default";
++
++ vmmc-supply = <&fixedregulator3v3>;
++ bus-width = <8>;
++ non-removable;
++ status = "okay";
++};
+diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
+index efdc321..11237db 100644
+--- a/arch/arm/configs/shmobile_defconfig
++++ b/arch/arm/configs/shmobile_defconfig
+@@ -24,6 +24,7 @@ CONFIG_MACH_KOELSCH=y
+ CONFIG_MACH_LAGER=y
+ CONFIG_MACH_GOSE=y
+ CONFIG_MACH_ALT=y
++CONFIG_MACH_SILK=y
+ CONFIG_MACH_MARZEN=y
+ CONFIG_SHMOBILE_TIMER_HZ=100
+ CONFIG_ARM_LPAE=y
+diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
+index bb1b599..e2e00a9 100644
+--- a/arch/arm/mach-shmobile/Kconfig
++++ b/arch/arm/mach-shmobile/Kconfig
+@@ -82,6 +82,12 @@ config MACH_ALT
+ select MICREL_PHY if SH_ETH
+ select SND_SOC_AK4642 if SND_SIMPLE_CARD
+
++config MACH_SILK
++ bool "Silk board"
++ depends on ARCH_R8A7794
++ select MICREL_PHY if SH_ETH
++ select SND_SOC_AK4642 if SND_SIMPLE_CARD
++
+ config MACH_MARZEN
+ bool "MARZEN board"
+ depends on ARCH_R8A7779
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index 8d997e2..139f31c 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -76,6 +76,7 @@ obj-$(CONFIG_MACH_KOELSCH) += board-koelsch-reference.o
+ obj-$(CONFIG_MACH_LAGER) += board-lager-reference.o
+ obj-$(CONFIG_MACH_GOSE) += board-gose-reference.o
+ obj-$(CONFIG_MACH_ALT) += board-alt-reference.o
++obj-$(CONFIG_MACH_SILK) += board-silk-reference.o
+ obj-$(CONFIG_MACH_MARZEN) += board-marzen-reference.o
+ else
+ obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o
+diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
+index 58c2623..25105b2 100644
+--- a/arch/arm/mach-shmobile/Makefile.boot
++++ b/arch/arm/mach-shmobile/Makefile.boot
+@@ -15,6 +15,7 @@ loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
+ loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
+ loadaddr-$(CONFIG_MACH_GOSE) += 0x40008000
+ loadaddr-$(CONFIG_MACH_ALT) += 0x40008000
++loadaddr-$(CONFIG_MACH_SILK) += 0x40008000
+
+ __ZRELADDR := $(sort $(loadaddr-y))
+ zreladdr-y += $(__ZRELADDR)
+diff --git a/arch/arm/mach-shmobile/board-silk-reference.c b/arch/arm/mach-shmobile/board-silk-reference.c
+new file mode 100644
+index 0000000..090a4df
+--- /dev/null
++++ b/arch/arm/mach-shmobile/board-silk-reference.c
+@@ -0,0 +1,995 @@
++/*
++ * Silk board support - Reference DT implementation
++ *
++ * Copyright (C) 2014 Renesas Electronics Corporation
++ * Copyright (C) 2014 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; 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 <linux/dma-mapping.h>
++#include <linux/gpio.h>
++#include <linux/i2c.h>
++#include <linux/kernel.h>
++#include <linux/mfd/tmio.h>
++#include <linux/mmc/host.h>
++#include <linux/mmc/sh_mmcif.h>
++#include <linux/mmc/sh_mobile_sdhi.h>
++#include <linux/of_gpio.h>
++#include <linux/of_platform.h>
++#include <linux/platform_data/camera-rcar.h>
++#include <linux/platform_data/rcar-du.h>
++#include <linux/platform_data/usb-rcar-gen2-phy.h>
++#if IS_ENABLED(CONFIG_VIDEO_RENESAS_VSP1)
++#include <linux/platform_data/vsp1.h>
++#endif
++#include <linux/serial_sci.h>
++#include <linux/sh_dma.h>
++#include <linux/spi/flash.h>
++#include <linux/spi/sh_msiof.h>
++#include <linux/spi/spi.h>
++#include <linux/usb/phy.h>
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++#include <linux/usb/renesas_usbhs.h>
++#endif
++#include <media/soc_camera.h>
++#include <asm/mach/arch.h>
++#include <sound/rcar_snd.h>
++#include <sound/simple_card.h>
++
++#include "clock.h"
++#include "common.h"
++#include "dma-register.h"
++#include "irqs.h"
++#include "r8a7794.h"
++#include "rcar-gen2.h"
++
++/* DU */
++static struct rcar_du_encoder_data silk_du_encoders[] = {
++ {
++ .type = RCAR_DU_ENCODER_HDMI,
++ .output = RCAR_DU_OUTPUT_DPAD0,
++ },
++ {
++ .type = RCAR_DU_ENCODER_NONE,
++ .output = RCAR_DU_OUTPUT_LVDS0,
++ .connector.lvds.panel = {
++ .width_mm = 210,
++ .height_mm = 158,
++ .mode = {
++ .clock = 65000,
++ .hdisplay = 1024,
++ .hsync_start = 1048,
++ .hsync_end = 1184,
++ .htotal = 1344,
++ .vdisplay = 768,
++ .vsync_start = 771,
++ .vsync_end = 777,
++ .vtotal = 806,
++ .flags = 0,
++ },
++ },
++ },
++ {
++ .type = RCAR_DU_ENCODER_VGA,
++ .output = RCAR_DU_OUTPUT_DPAD1,
++ },
++};
++
++static struct rcar_du_crtc_data silk_du_crtcs[] = {
++ {
++ .exclk = 148500000,
++ .init_conn_type = DRM_MODE_CONNECTOR_HDMIA,
++ },
++ {
++ .exclk = 74250000,
++ .init_conn_type = DRM_MODE_CONNECTOR_VGA,
++ },
++};
++
++static int silk_lvds_backlight_on(void)
++{
++ return 0;
++}
++
++static int silk_lvds_backlight_off(void)
++{
++ return 0;
++}
++
++static struct rcar_du_platform_data silk_du_pdata = {
++ .encoders = silk_du_encoders,
++ .num_encoders = ARRAY_SIZE(silk_du_encoders),
++ .crtcs = silk_du_crtcs,
++ .num_crtcs = ARRAY_SIZE(silk_du_crtcs),
++#ifdef CONFIG_DRM_FBDEV_CRTC
++ .fbdev_crtc = 0,
++#endif
++ .backlight_on = silk_lvds_backlight_on,
++ .backlight_off = silk_lvds_backlight_off,
++ .i2c_ch = 1,
++};
++
++static const struct resource du_resources[] __initconst = {
++ DEFINE_RES_MEM(0xfeb00000, 0x40000),
++ DEFINE_RES_IRQ(gic_spi(256)),
++ DEFINE_RES_IRQ(gic_spi(268)),
++};
++
++static void __init silk_add_du_device(void)
++{
++ struct platform_device_info info = {
++ .name = "rcar-du-r8a7794",
++ .id = -1,
++ .res = du_resources,
++ .num_res = ARRAY_SIZE(du_resources),
++ .data = &silk_du_pdata,
++ .size_data = sizeof(silk_du_pdata),
++ .dma_mask = DMA_BIT_MASK(32),
++ };
++
++ platform_device_register_full(&info);
++}
++
++/* Sound */
++static struct rsnd_ssi_platform_info rsnd_ssi[] = {
++ RSND_SSI(AUDIOPP_DMAC_SLAVE_CMD0_TO_SSI0, gic_spi(370), 0),
++ RSND_SSI(AUDIOPP_DMAC_SLAVE_SSI1_TO_SCU2, gic_spi(371), RSND_SSI_CLK_PIN_SHARE),
++};
++
++static struct rsnd_src_platform_info rsnd_src[3] = {
++ RSND_SRC_UNUSED,
++ RSND_SRC(0, AUDIO_DMAC_SLAVE_SCU1_TX, gic_spi(353)),
++ RSND_SRC(0, AUDIO_DMAC_SLAVE_CMD1_TO_MEM, gic_spi(354)),
++};
++
++static struct rsnd_dvc_platform_info rsnd_dvc[2] = {
++};
++
++static struct rsnd_dai_platform_info rsnd_dai = {
++ .playback = { .ssi = &rsnd_ssi[0], .src = &rsnd_src[1], .dvc = &rsnd_dvc[0], },
++ .capture = { .ssi = &rsnd_ssi[1], .src = &rsnd_src[2], .dvc = &rsnd_dvc[1], },
++};
++
++static struct rcar_snd_info rsnd_info = {
++ .flags = RSND_GEN2,
++ .ssi_info = rsnd_ssi,
++ .ssi_info_nr = ARRAY_SIZE(rsnd_ssi),
++ .src_info = rsnd_src,
++ .src_info_nr = ARRAY_SIZE(rsnd_src),
++ .dvc_info = rsnd_dvc,
++ .dvc_info_nr = ARRAY_SIZE(rsnd_dvc),
++ .dai_info = &rsnd_dai,
++ .dai_info_nr = 1,
++};
++
++static struct asoc_simple_card_info rsnd_card_info = {
++ .name = "SSI01-AK4643",
++ .codec = "ak4642-codec.1-0012",
++ .platform = "rcar_sound",
++ .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
++ .cpu_dai = {
++ .name = "rcar_sound",
++ },
++ .codec_dai = {
++ .name = "ak4642-hifi",
++ .sysclk = 12288000,
++ },
++};
++
++static void __init silk_add_rsnd_device(void)
++{
++ struct resource rsnd_resources[] = {
++ [RSND_GEN2_SCU] = DEFINE_RES_MEM(0xec500000, 0x1000),
++ [RSND_GEN2_ADG] = DEFINE_RES_MEM(0xec5a0000, 0x100),
++ [RSND_GEN2_SSIU] = DEFINE_RES_MEM(0xec540000, 0x1000),
++ [RSND_GEN2_SSI] = DEFINE_RES_MEM(0xec541000, 0x1280),
++ };
++
++ struct platform_device_info cardinfo = {
++ .parent = &platform_bus,
++ .name = "asoc-simple-card",
++ .id = -1,
++ .data = &rsnd_card_info,
++ .size_data = sizeof(struct asoc_simple_card_info),
++ .dma_mask = DMA_BIT_MASK(32),
++ };
++
++ platform_device_register_resndata(
++ &platform_bus, "rcar_sound", -1,
++ rsnd_resources, ARRAY_SIZE(rsnd_resources),
++ &rsnd_info, sizeof(rsnd_info));
++
++ platform_device_register_full(&cardinfo);
++}
++
++
++/*
++ * This is a really crude hack to provide clkdev support to platform
++ * devices until they get moved to DT.
++ */
++static const struct clk_name clk_names[] __initconst = {
++ { "cmt0", NULL, "sh_cmt.0" },
++ { "scifa0", NULL, "sh-sci.0" },
++ { "scifa1", NULL, "sh-sci.1" },
++ { "scifb0", NULL, "sh-sci.2" },
++ { "scifb1", NULL, "sh-sci.3" },
++ { "scifb2", NULL, "sh-sci.4" },
++ { "scifa2", NULL, "sh-sci.5" },
++ { "scif0", NULL, "sh-sci.6" },
++ { "scif1", NULL, "sh-sci.7" },
++ { "hscif0", NULL, "sh-sci.8" },
++ { "hscif1", NULL, "sh-sci.9" },
++ { "scif2", NULL, "sh-sci.10" },
++ { "scif3", NULL, "sh-sci.11" },
++ { "scif4", NULL, "sh-sci.12" },
++ { "scif5", NULL, "sh-sci.13" },
++ { "scifa3", NULL, "sh-sci.14" },
++ { "scifa4", NULL, "sh-sci.15" },
++ { "scifa5", NULL, "sh-sci.16" },
++ { "hscif2", NULL, "sh-sci.17" },
++ { "du0", "du.0", "rcar-du-r8a7794" },
++ { "du1", "du.1", "rcar-du-r8a7794" },
++ { "hsusb", NULL, "usb_phy_rcar_gen2" },
++ { "ssi0", "ssi.0", "rcar_sound" },
++ { "ssi1", "ssi.1", "rcar_sound" },
++ { "src1", "src.1", "rcar_sound" },
++ { "src2", "src.2", "rcar_sound" },
++ { "dvc0", "dvc.0", "rcar_sound" },
++ { "dvc1", "dvc.1", "rcar_sound" },
++ { "vin0", NULL, "r8a7794-vin.0" },
++ { "vsps", NULL, NULL },
++#if IS_ENABLED(CONFIG_VIDEO_RENESAS_VSP1)
++ { "vsp1-du0", NULL, "vsp1.2" },
++#else
++ { "vsp1-du0", NULL, NULL },
++#endif
++ { "vpc0", NULL, "vpc1" },
++ { "2ddmac", NULL, "tddmac" },
++ { "fdp0", NULL, "fdp0" },
++ { "pvrsrvkm", NULL, "pvrsrvkm" },
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++ { "hsusb", NULL, "renesas_usbhs" },
++#else
++ { "ehci", NULL, "pci-rcar-gen2.0" },
++#endif
++};
++
++/*
++ * This is a really crude hack to work around core platform clock issues
++ */
++static const struct clk_name clk_enables[] __initconst = {
++ { "ether", NULL, "ee700000.ethernet" },
++ { "i2c1", NULL, "e6518000.i2c" },
++ { "mmcif0", NULL, "ee200000.mmc" },
++ { "sdhi0", NULL, "ee100000.sd" },
++ { "sdhi1", NULL, "ee140000.sd" },
++ { "ehci", NULL, "pci-rcar-gen2.1" },
++ { "vcp0", NULL, "vcp1" },
++ { "dmal", NULL, "sh-dma-engine.0" },
++ { "sys-dmac1", NULL, "sh-dma-engine.2" },
++ { "sys-dmac0", NULL, "sh-dma-engine.3" },
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++ { "usbdmac0", NULL, "sh-dma-engine.4" },
++#endif
++ { "ipmmu_gp", NULL, "ipmmu_gp" },
++};
++
++#define DMAE_CHANNEL(a, b) \
++{ \
++ .offset = (a) - 0x20, \
++ .dmars = (a) - 0x20 + 0x40, \
++ .chclr_bit = (b), \
++ .chclr_offset = 0x80 - 0x20, \
++}
++
++/* Sys-DMAC */
++#define SYS_DMAC_SLAVE(_id, _bit, _addr, toffset, roffset, t, r) \
++{ \
++ .slave_id = SYS_DMAC_SLAVE_## _id ##_TX, \
++ .addr = _addr + toffset, \
++ .chcr = CHCR_TX(XMIT_SZ_## _bit ##BIT), \
++ .mid_rid = t, \
++}, { \
++ .slave_id = SYS_DMAC_SLAVE_## _id ##_RX, \
++ .addr = _addr + roffset, \
++ .chcr = CHCR_RX(XMIT_SZ_## _bit ##BIT), \
++ .mid_rid = r, \
++}
++
++#define SYS_DMAC_SLAVE_TX(_id, _bit, _addr, toffset, roffset, t, r) \
++{ \
++ .slave_id = SYS_DMAC_SLAVE_## _id ##_TX, \
++ .addr = _addr + toffset, \
++ .chcr = CHCR_TX(XMIT_SZ_## _bit ##BIT), \
++ .mid_rid = t, \
++}
++
++static const struct sh_dmae_slave_config r8a7794_sys_dmac_slaves[] = {
++ SYS_DMAC_SLAVE(MMCIF0, 32, 0xee200000, 0x34, 0x34, 0xd1, 0xd2),
++ SYS_DMAC_SLAVE(SDHI0, 256, 0xee100000, 0x60, 0x2060, 0xcd, 0xce),
++ SYS_DMAC_SLAVE(SDHI1, 256, 0xee140000, 0x30, 0x2030, 0xc1, 0xc2),
++ SYS_DMAC_SLAVE(SCIF0, 8, 0xe6e60000, 0xc, 0x14, 0x29, 0x2a),
++ SYS_DMAC_SLAVE(SCIF1, 8, 0xe6e68000, 0xc, 0x14, 0x2d, 0x2e),
++ SYS_DMAC_SLAVE(SCIF2, 8, 0xe6e58000, 0xc, 0x14, 0x2b, 0x2c),
++ SYS_DMAC_SLAVE(SCIF3, 8, 0xe6ea8000, 0xc, 0x14, 0x2f, 0x30),
++ SYS_DMAC_SLAVE(SCIF4, 8, 0xe6ee0000, 0xc, 0x14, 0xfb, 0xfc),
++ SYS_DMAC_SLAVE(SCIF5, 8, 0xe6ee8000, 0xc, 0x14, 0xfd, 0xfe),
++ SYS_DMAC_SLAVE(SCIFA0, 8, 0xe6c40000, 0x20, 0x24, 0x21, 0x22),
++ SYS_DMAC_SLAVE(SCIFA1, 8, 0xe6c50000, 0x20, 0x24, 0x25, 0x26),
++ SYS_DMAC_SLAVE(SCIFA2, 8, 0xe6c60000, 0x20, 0x24, 0x27, 0x28),
++ SYS_DMAC_SLAVE(SCIFA3, 8, 0xe6c70000, 0x20, 0x24, 0x1b, 0x1c),
++ SYS_DMAC_SLAVE(SCIFA4, 8, 0xe6c78000, 0x20, 0x24, 0x1f, 0x20),
++ SYS_DMAC_SLAVE(SCIFA5, 8, 0xe6c80000, 0x20, 0x24, 0x23, 0x24),
++ SYS_DMAC_SLAVE(SCIFB0, 8, 0xe6c20000, 0x40, 0x60, 0x3d, 0x3e),
++ SYS_DMAC_SLAVE(SCIFB1, 8, 0xe6c30000, 0x40, 0x60, 0x19, 0x1a),
++ SYS_DMAC_SLAVE(SCIFB2, 8, 0xe6ce0000, 0x40, 0x60, 0x1d, 0x1e),
++ SYS_DMAC_SLAVE(HSCIF0, 8, 0xe62c0000, 0xc, 0x14, 0x39, 0x3a),
++ SYS_DMAC_SLAVE(HSCIF1, 8, 0xe62c8000, 0xc, 0x14, 0x4d, 0x4e),
++ SYS_DMAC_SLAVE(HSCIF2, 8, 0xe62d0000, 0xc, 0x14, 0x3b, 0x3c),
++ SYS_DMAC_SLAVE(MSIOF0, 32, 0xe7e20000, 0x50, 0x60, 0x51, 0x52),
++ SYS_DMAC_SLAVE(MSIOF1, 32, 0xe7e10000, 0x50, 0x60, 0x55, 0x56),
++ SYS_DMAC_SLAVE(MSIOF2, 32, 0xe7e00000, 0x50, 0x60, 0x41, 0x42),
++};
++
++static const struct sh_dmae_channel r8a7794_sys_dmac_channels[] = {
++ DMAE_CHANNEL(0x8000, 0),
++ DMAE_CHANNEL(0x8080, 1),
++ DMAE_CHANNEL(0x8100, 2),
++ DMAE_CHANNEL(0x8180, 3),
++ DMAE_CHANNEL(0x8200, 4),
++ DMAE_CHANNEL(0x8280, 5),
++ DMAE_CHANNEL(0x8300, 6),
++ DMAE_CHANNEL(0x8380, 7),
++ DMAE_CHANNEL(0x8400, 8),
++ DMAE_CHANNEL(0x8480, 9),
++ DMAE_CHANNEL(0x8500, 10),
++ DMAE_CHANNEL(0x8580, 11),
++ DMAE_CHANNEL(0x8600, 12),
++ DMAE_CHANNEL(0x8680, 13),
++ DMAE_CHANNEL(0x8700, 14),
++};
++
++static struct sh_dmae_pdata r8a7794_sys_dmac_platform_data = {
++ .slave = r8a7794_sys_dmac_slaves,
++ .slave_num = ARRAY_SIZE(r8a7794_sys_dmac_slaves),
++ .channel = r8a7794_sys_dmac_channels,
++ .channel_num = ARRAY_SIZE(r8a7794_sys_dmac_channels),
++ .ts_low_shift = TS_LOW_SHIFT,
++ .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
++ .ts_high_shift = TS_HI_SHIFT,
++ .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
++ .ts_shift = dma_ts_shift,
++ .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
++ .dmaor_init = DMAOR_DME,
++ .chclr_present = 1,
++ .chclr_bitwise = 1,
++ .fourty_bits_addr = 1,
++};
++
++static struct resource r8a7794_sys_dmac_resources[] = {
++ /* Channel registers and DMAOR for low */
++ DEFINE_RES_MEM(0xe6700020, 0x8763 - 0x20),
++ DEFINE_RES_IRQ(gic_spi(197)),
++ DEFINE_RES_NAMED(gic_spi(200), 15, NULL, IORESOURCE_IRQ),
++
++ /* Channel registers and DMAOR for high */
++ DEFINE_RES_MEM(0xe6720020, 0x8763 - 0x20),
++ DEFINE_RES_IRQ(gic_spi(220)),
++ DEFINE_RES_NAMED(gic_spi(216), 4, NULL, IORESOURCE_IRQ),
++ DEFINE_RES_NAMED(gic_spi(308), 11, NULL, IORESOURCE_IRQ),
++};
++
++#define r8a7794_register_sys_dmac(id) \
++ platform_device_register_resndata( \
++ &platform_bus, "sh-dma-engine", 2 + id, \
++ &r8a7794_sys_dmac_resources[id * 3], id * 1 + 3, \
++ &r8a7794_sys_dmac_platform_data, \
++ sizeof(r8a7794_sys_dmac_platform_data))
++
++static void __init silk_add_dmac_prototype(void)
++{
++ r8a7794_register_sys_dmac(0);
++ r8a7794_register_sys_dmac(1);
++}
++
++static struct sh_mmcif_plat_data mmcif0_pdata = {
++ .caps = MMC_CAP_4_BIT_DATA |
++ MMC_CAP_8_BIT_DATA |
++ MMC_CAP_NONREMOVABLE,
++ .ccs_unsupported = true,
++ .clk_ctrl2_present = true,
++ .slave_id_tx = SYS_DMAC_SLAVE_MMCIF0_TX,
++ .slave_id_rx = SYS_DMAC_SLAVE_MMCIF0_RX,
++};
++
++static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
++ .dma_slave_tx = SYS_DMAC_SLAVE_SDHI0_TX,
++ .dma_slave_rx = SYS_DMAC_SLAVE_SDHI0_RX,
++ .dma_rx_offset = 0x2000,
++
++ .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
++ MMC_CAP_POWER_OFF_CARD,
++ .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
++};
++
++static struct sh_mobile_sdhi_info sdhi1_info __initdata = {
++ .dma_slave_tx = SYS_DMAC_SLAVE_SDHI1_TX,
++ .dma_slave_rx = SYS_DMAC_SLAVE_SDHI1_RX,
++ .dma_rx_offset = 0x2000,
++
++ .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
++ MMC_CAP_POWER_OFF_CARD,
++ .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
++};
++
++/* SCIF */
++#define SCIF_PD(scif_type, index, scif_index) \
++static struct plat_sci_port scif##index##_platform_data = { \
++ .type = PORT_##scif_type, \
++ .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
++ .scscr = SCSCR_RE | SCSCR_TE, \
++ .dma_slave_tx = SYS_DMAC_SLAVE_##scif_type##scif_index##_TX, \
++ .dma_slave_rx = SYS_DMAC_SLAVE_##scif_type##scif_index##_RX, \
++}
++
++#define PDATA_SCIF(index, baseaddr, irq, i) SCIF_PD(SCIF, index, i)
++#define PDATA_SCIFA(index, baseaddr, irq, i) SCIF_PD(SCIFA, index, i)
++#define PDATA_SCIFB(index, baseaddr, irq, i) SCIF_PD(SCIFB, index, i)
++#define PDATA_HSCIF(index, baseaddr, irq, i) SCIF_PD(HSCIF, index, i)
++
++PDATA_SCIFA(0, 0xe6c40000, gic_spi(144), 0); /* SCIFA0 */
++PDATA_SCIFA(1, 0xe6c50000, gic_spi(145), 1); /* SCIFA1 */
++PDATA_SCIFB(2, 0xe6c20000, gic_spi(148), 0); /* SCIFB0 */
++PDATA_SCIFB(3, 0xe6c30000, gic_spi(149), 1); /* SCIFB1 */
++PDATA_SCIFB(4, 0xe6ce0000, gic_spi(150), 2); /* SCIFB2 */
++PDATA_SCIFA(5, 0xe6c60000, gic_spi(151), 2); /* SCIFA2 */
++PDATA_SCIF(6, 0xe6e60000, gic_spi(152), 0); /* SCIF0 */
++PDATA_SCIF(7, 0xe6e68000, gic_spi(153), 1); /* SCIF1 */
++PDATA_HSCIF(8, 0xe62c0000, gic_spi(154), 0); /* HSCIF0 */
++PDATA_HSCIF(9, 0xe62c8000, gic_spi(155), 1); /* HSCIF1 */
++PDATA_SCIF(10, 0xe6e58000, gic_spi(22), 2); /* SCIF2 */
++PDATA_SCIF(11, 0xe6ea8000, gic_spi(23), 3); /* SCIF3 */
++PDATA_SCIF(12, 0xe6ee0000, gic_spi(24), 4); /* SCIF4 */
++PDATA_SCIF(13, 0xe6ee8000, gic_spi(25), 5); /* SCIF5 */
++PDATA_SCIFA(14, 0xe6c70000, gic_spi(29), 3); /* SCIFA3 */
++PDATA_SCIFA(15, 0xe6c78000, gic_spi(30), 4); /* SCIFA4 */
++PDATA_SCIFA(16, 0xe6c80000, gic_spi(31), 5); /* SCIFA5 */
++PDATA_HSCIF(17, 0xe6cd0000, gic_spi(21), 2); /* HSCIF2 */
++
++#define SCIF_AD(scif_type, index, baseaddr) \
++ OF_DEV_AUXDATA("renesas," scif_type "-r8a7794", baseaddr, \
++ "sh-sci." # index, &scif##index##_platform_data)
++
++#define AUXDATA_SCIF(index, baseaddr, irq) SCIF_AD("scif", index, baseaddr)
++#define AUXDATA_SCIFA(index, baseaddr, irq) SCIF_AD("scifa", index, baseaddr)
++#define AUXDATA_SCIFB(index, baseaddr, irq) SCIF_AD("scifb", index, baseaddr)
++#define AUXDATA_HSCIF(index, baseaddr, irq) SCIF_AD("hscif", index, baseaddr)
++
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++/* USB-DMAC */
++static const struct sh_dmae_channel usb_dmac_channels[] = {
++ {
++ .offset = 0,
++ }, {
++ .offset = 0x20,
++ },
++};
++
++static const struct sh_dmae_slave_config usb_dmac_slaves[] = {
++ {
++ .slave_id = USB_DMAC_SLAVE_USBHS_TX,
++ .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_32BYTE),
++ }, {
++ .slave_id = USB_DMAC_SLAVE_USBHS_RX,
++ .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_32BYTE),
++ },
++};
++
++static struct sh_dmae_pdata usb_dmac_platform_data = {
++ .slave = usb_dmac_slaves,
++ .slave_num = ARRAY_SIZE(usb_dmac_slaves),
++ .channel = usb_dmac_channels,
++ .channel_num = ARRAY_SIZE(usb_dmac_channels),
++ .ts_low_shift = USBTS_LOW_SHIFT,
++ .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
++ .ts_high_shift = USBTS_HI_SHIFT,
++ .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
++ .ts_shift = dma_usbts_shift,
++ .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
++ .dmaor_init = DMAOR_DME,
++ .chcr_offset = 0x14,
++ .chcr_ie_bit = 1 << 5,
++ .dmaor_is_32bit = 1,
++ .needs_tend_set = 1,
++ .no_dmars = 1,
++ .slave_only = 1,
++};
++
++static struct resource usb_dmac_resources[] = {
++ DEFINE_RES_MEM(0xe65a0020, 0x44), /* Channel registers and DMAOR */
++ DEFINE_RES_MEM(0xe65a0000, 0x14), /* VCR/SWR/DMICR */
++ DEFINE_RES_IRQ(gic_spi(109)),
++};
++
++static void __init silk_add_usb_dmac_prototype(void)
++{
++ platform_device_register_resndata(&platform_bus, "sh-dma-engine",
++ 4,
++ usb_dmac_resources,
++ ARRAY_SIZE(usb_dmac_resources),
++ &usb_dmac_platform_data,
++ sizeof(usb_dmac_platform_data));
++}
++
++/* USBHS */
++static const struct resource usbhs_resources[] __initconst = {
++ DEFINE_RES_MEM(0xe6590000, 0x100),
++ DEFINE_RES_IRQ(gic_spi(107)),
++};
++
++struct usbhs_private {
++ struct renesas_usbhs_platform_info info;
++ struct usb_phy *phy;
++ int pwen_gpio;
++};
++
++#define usbhs_get_priv(pdev) \
++ container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info)
++
++static int usbhs_power_ctrl(struct platform_device *pdev,
++ void __iomem *base, int enable)
++{
++ struct usbhs_private *priv = usbhs_get_priv(pdev);
++
++ if (!priv->phy)
++ return -ENODEV;
++
++ if (enable) {
++ int retval = usb_phy_init(priv->phy);
++
++ if (!retval)
++ retval = usb_phy_set_suspend(priv->phy, 0);
++ return retval;
++ }
++
++ usb_phy_set_suspend(priv->phy, 1);
++ usb_phy_shutdown(priv->phy);
++ return 0;
++}
++
++static int usbhs_hardware_init(struct platform_device *pdev)
++{
++ struct usbhs_private *priv = usbhs_get_priv(pdev);
++ struct usb_phy *phy;
++ int ret;
++ struct device_node *np;
++
++ np = of_find_node_by_path("/gpio@e6055000");
++ if (np) {
++ priv->pwen_gpio = of_get_gpio(np, 24);
++ of_node_put(np);
++ } else {
++ pr_warn("Error: Unable to get PWEN GPIO line\n");
++ ret = -ENOTSUPP;
++ goto error2;
++ }
++
++ phy = usb_get_phy_dev(&pdev->dev, 0);
++ if (IS_ERR(phy)) {
++ ret = PTR_ERR(phy);
++ goto error;
++ }
++
++ priv->phy = phy;
++ return 0;
++ error:
++ gpio_free(priv->pwen_gpio);
++ error2:
++ return ret;
++}
++
++static int usbhs_hardware_exit(struct platform_device *pdev)
++{
++ struct usbhs_private *priv = usbhs_get_priv(pdev);
++
++ if (!priv->phy)
++ return 0;
++
++ usb_put_phy(priv->phy);
++ priv->phy = NULL;
++ gpio_free(priv->pwen_gpio);
++ return 0;
++}
++
++static int usbhs_get_id(struct platform_device *pdev)
++{
++ return USBHS_GADGET;
++}
++
++static int usbhs_get_vbus(struct platform_device *pdev)
++{
++ return 0;
++}
++
++static u32 lager_usbhs_pipe_type[] = {
++ USB_ENDPOINT_XFER_CONTROL,
++ USB_ENDPOINT_XFER_ISOC,
++ USB_ENDPOINT_XFER_ISOC,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_INT,
++ USB_ENDPOINT_XFER_INT,
++ USB_ENDPOINT_XFER_INT,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++};
++
++static struct usbhs_private usbhs_priv __initdata = {
++ .info = {
++ .platform_callback = {
++ .power_ctrl = usbhs_power_ctrl,
++ .hardware_init = usbhs_hardware_init,
++ .hardware_exit = usbhs_hardware_exit,
++ .get_id = usbhs_get_id,
++ .get_vbus = usbhs_get_vbus,
++ },
++ .driver_param = {
++ .buswait_bwait = 4,
++ .pipe_type = lager_usbhs_pipe_type,
++ .pipe_size = ARRAY_SIZE(lager_usbhs_pipe_type),
++ .d0_rx_id = USB_DMAC_SLAVE_USBHS_RX,
++ .d1_tx_id = USB_DMAC_SLAVE_USBHS_TX,
++ .usb_dmac_xfer_size = 32,
++ },
++ }
++};
++
++static void __init silk_register_usbhs(void)
++{
++ usb_bind_phy("renesas_usbhs", 0, "usb_phy_rcar_gen2");
++ platform_device_register_resndata(&platform_bus,
++ "renesas_usbhs", -1,
++ usbhs_resources,
++ ARRAY_SIZE(usbhs_resources),
++ &usbhs_priv.info,
++ sizeof(usbhs_priv.info));
++}
++
++#else
++/* Internal PCI0 */
++static const struct resource pci0_resources[] __initconst = {
++ DEFINE_RES_MEM(0xee090000, 0x10000), /* CFG */
++ DEFINE_RES_MEM(0xee080000, 0x10000), /* MEM */
++ DEFINE_RES_IRQ(gic_spi(108)),
++};
++
++static const struct platform_device_info pci0_info __initconst = {
++ .parent = &platform_bus,
++ .name = "pci-rcar-gen2",
++ .id = 0,
++ .res = pci0_resources,
++ .num_res = ARRAY_SIZE(pci0_resources),
++ .dma_mask = DMA_BIT_MASK(32),
++};
++
++static void __init silk_add_usb0_device(void)
++{
++ usb_bind_phy("pci-rcar-gen2.0", 0, "usb_phy_rcar_gen2");
++ platform_device_register_full(&pci0_info);
++}
++#endif
++/* USBHS PHY */
++static const struct rcar_gen2_phy_platform_data usbhs_phy_pdata __initconst = {
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++ .chan0_pci = 0, /* Channel 0 is USBHS */
++#else
++ .chan0_pci = 1, /* Channel 0 is PCI USB */
++#endif
++ .chan2_pci = 1, /* Channel 2 is PCI USB */
++ .gpio_vbus = 857,
++ .wakeup = true,
++};
++
++static const struct resource usbhs_phy_resources[] __initconst = {
++ DEFINE_RES_MEM(0xe6590100, 0x100),
++};
++
++/* Internal PCI1 */
++static const struct resource pci1_resources[] __initconst = {
++ DEFINE_RES_MEM(0xee0d0000, 0x10000), /* CFG */
++ DEFINE_RES_MEM(0xee0c0000, 0x10000), /* MEM */
++ DEFINE_RES_IRQ(gic_spi(113)),
++};
++
++static const struct platform_device_info pci1_info __initconst = {
++ .parent = &platform_bus,
++ .name = "pci-rcar-gen2",
++ .id = 1,
++ .res = pci1_resources,
++ .num_res = ARRAY_SIZE(pci1_resources),
++ .dma_mask = DMA_BIT_MASK(32),
++};
++
++static void __init silk_add_usb1_device(void)
++{
++ usb_bind_phy("pci-rcar-gen2.1", 0, "usb_phy_rcar_gen2");
++ platform_device_register_full(&pci1_info);
++}
++
++/* POWER IC */
++static struct i2c_board_info poweric_i2c[] = {
++ { I2C_BOARD_INFO("da9063", 0x58), },
++};
++
++static void silk_restart(char mode, const char *cmd)
++{
++ struct i2c_adapter *adap;
++ struct i2c_client *client;
++ u8 val;
++ int busnum = 8;
++
++ adap = i2c_get_adapter(busnum);
++ if (!adap) {
++ pr_err("failed to get adapter i2c%d\n", busnum);
++ return;
++ }
++
++ client = i2c_new_device(adap, &poweric_i2c[0]);
++ if (!client)
++ pr_err("failed to register %s to i2c%d\n",
++ poweric_i2c[0].type, busnum);
++
++ i2c_put_adapter(adap);
++
++ val = i2c_smbus_read_byte_data(client, 0x13);
++
++ if (val < 0)
++ pr_err("couldn't access da9063\n");
++
++ val |= 0x02;
++
++ i2c_smbus_write_byte_data(client, 0x13, val);
++}
++
++/* VIN */
++static const struct resource vin_resources[] __initconst = {
++ /* VIN0 */
++ DEFINE_RES_MEM(0xe6ef0000, 0x1000),
++ DEFINE_RES_IRQ(gic_spi(188)),
++};
++
++static void __init silk_add_vin_device(unsigned idx,
++ struct rcar_vin_platform_data *pdata)
++{
++ struct platform_device_info vin_info = {
++ .parent = &platform_bus,
++ .name = "r8a7794-vin",
++ .id = idx,
++ .res = &vin_resources[idx * 2],
++ .num_res = 2,
++ .dma_mask = DMA_BIT_MASK(32),
++ .data = pdata,
++ .size_data = sizeof(*pdata),
++ };
++
++ BUG_ON(idx > 1);
++
++ platform_device_register_full(&vin_info);
++}
++
++#define SILK_CAMERA(idx, name, addr, pdata, flag) \
++static struct i2c_board_info i2c_cam##idx##_device = { \
++ I2C_BOARD_INFO(name, addr), \
++}; \
++ \
++static struct rcar_vin_platform_data vin##idx##_pdata = { \
++ .flags = flag, \
++}; \
++ \
++static struct soc_camera_link cam##idx##_link = { \
++ .bus_id = idx, \
++ .board_info = &i2c_cam##idx##_device, \
++ .i2c_adapter_id = 1, \
++ .module_name = name, \
++ .priv = pdata, \
++}
++
++SILK_CAMERA(0, "adv7180", 0x20, NULL, RCAR_VIN_BT656);
++
++static void __init silk_add_camera0_device(void)
++{
++ platform_device_register_data(&platform_bus, "soc-camera-pdrv", 0,
++ &cam0_link, sizeof(cam0_link));
++ silk_add_vin_device(0, &vin0_pdata);
++}
++
++/* VSP1 */
++#if IS_ENABLED(CONFIG_VIDEO_RENESAS_VSP1)
++static const struct vsp1_platform_data silk_vsps_pdata __initconst = {
++ .features = 0,
++ .rpf_count = 5,
++ .uds_count = 3,
++ .wpf_count = 4,
++};
++
++static const struct vsp1_platform_data silk_vspd0_pdata __initconst = {
++ .features = VSP1_HAS_LIF,
++ .rpf_count = 4,
++ .uds_count = 1,
++ .wpf_count = 4,
++};
++
++static const struct vsp1_platform_data * const silk_vsp1_pdata[] __initconst
++ = {
++ &silk_vsps_pdata,
++ &silk_vspd0_pdata,
++};
++
++static const struct resource vsp1_1_resources[] __initconst = {
++ DEFINE_RES_MEM(0xfe928000, 0x8000),
++ DEFINE_RES_IRQ(gic_spi(267)),
++};
++
++static const struct resource vsp1_2_resources[] __initconst = {
++ DEFINE_RES_MEM(0xfe930000, 0x8000),
++ DEFINE_RES_IRQ(gic_spi(246)),
++};
++
++static const struct resource * const vsp1_resources[] __initconst = {
++ vsp1_1_resources,
++ vsp1_2_resources,
++};
++
++static void __init silk_add_vsp1_devices(void)
++{
++ struct platform_device_info info = {
++ .name = "vsp1",
++ .size_data = sizeof(*silk_vsp1_pdata[0]),
++ .num_res = 2,
++ .dma_mask = DMA_BIT_MASK(32),
++ };
++ unsigned int i;
++
++ for (i = 1; i < ARRAY_SIZE(vsp1_resources); ++i) {
++ info.id = i + 1;
++ info.data = silk_vsp1_pdata[i];
++ info.res = vsp1_resources[i];
++
++ platform_device_register_full(&info);
++ }
++}
++#endif
++
++/* MSIOF */
++static struct sh_msiof_spi_info msiof0_info = {
++ .rx_fifo_override = 256,
++ .num_chipselect = 1,
++ .dma_tx_id = SYS_DMAC_SLAVE_MSIOF0_TX,
++ .dma_rx_id = SYS_DMAC_SLAVE_MSIOF0_RX,
++};
++
++static struct sh_msiof_spi_info msiof1_info = {
++ .rx_fifo_override = 256,
++ .num_chipselect = 1,
++ .dma_tx_id = SYS_DMAC_SLAVE_MSIOF1_TX,
++ .dma_rx_id = SYS_DMAC_SLAVE_MSIOF1_RX,
++};
++
++/* MSIOF spidev */
++static const struct spi_board_info spi_bus[] __initconst = {
++ {
++ .modalias = "spidev",
++ .max_speed_hz = 6000000,
++ .mode = SPI_MODE_3,
++ .bus_num = 1,
++ .chip_select = 0,
++ },
++ {
++ .modalias = "spidev",
++ .max_speed_hz = 6000000,
++ .mode = SPI_MODE_3,
++ .bus_num = 2,
++ .chip_select = 0,
++ },
++};
++
++#define silk_add_msiof_device spi_register_board_info
++
++static struct of_dev_auxdata silk_auxdata_lookup[] __initdata = {
++ OF_DEV_AUXDATA("renesas,mmcif-r8a7794", 0xee200000, "sh_mmcif",
++ &mmcif0_pdata),
++ OF_DEV_AUXDATA("renesas,sdhi-r8a7794", 0xee100000, "sdhi0",
++ &sdhi0_info),
++ OF_DEV_AUXDATA("renesas,sdhi-r8a7794", 0xee140000, "sdhi1",
++ &sdhi1_info),
++ AUXDATA_SCIFA(0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
++ AUXDATA_SCIFA(1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
++ AUXDATA_SCIFB(2, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
++ AUXDATA_SCIFB(3, 0xe6c30000, gic_spi(149)), /* SCIFB1 */
++ AUXDATA_SCIFB(4, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */
++ AUXDATA_SCIFA(5, 0xe6c60000, gic_spi(151)), /* SCIFA2 */
++ AUXDATA_SCIF(6, 0xe6e60000, gic_spi(152)), /* SCIF0 */
++ AUXDATA_SCIF(7, 0xe6e68000, gic_spi(153)), /* SCIF1 */
++ AUXDATA_HSCIF(8, 0xe62c0000, gic_spi(154)), /* HSCIF0 */
++ AUXDATA_HSCIF(9, 0xe62c8000, gic_spi(155)), /* HSCIF1 */
++ AUXDATA_SCIF(10, 0xe6e58000, gic_spi(22)), /* SCIF2 */
++ AUXDATA_SCIF(11, 0xe6ea8000, gic_spi(23)), /* SCIF3 */
++ AUXDATA_SCIF(12, 0xe6ee0000, gic_spi(24)), /* SCIF4 */
++ AUXDATA_SCIF(13, 0xe6ee8000, gic_spi(25)), /* SCIF5 */
++ AUXDATA_SCIFA(14, 0xe6c70000, gic_spi(29)), /* SCIFA3 */
++ AUXDATA_SCIFA(15, 0xe6c78000, gic_spi(30)), /* SCIFA4 */
++ AUXDATA_SCIFA(16, 0xe6c80000, gic_spi(31)), /* SCIFA5 */
++ AUXDATA_HSCIF(17, 0xe6cd0000, gic_spi(21)), /* HSCIF2 */
++ OF_DEV_AUXDATA("renesas,msiof-r8a7794", 0xe6e20000,
++ "spi_r8a7794_msiof.0", &msiof0_info),
++ OF_DEV_AUXDATA("renesas,msiof-r8a7794", 0xe6e10000,
++ "spi_r8a7794_msiof.1", &msiof1_info),
++ {},
++};
++
++static void __init silk_add_standard_devices(void)
++{
++ shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
++ shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true);
++ r8a7794_add_dt_devices();
++ silk_add_dmac_prototype();
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++ silk_add_usb_dmac_prototype();
++#endif
++ of_platform_populate(NULL, of_default_bus_match_table,
++ silk_auxdata_lookup, NULL);
++ silk_add_du_device();
++
++ platform_device_register_resndata(&platform_bus, "usb_phy_rcar_gen2",
++ -1, usbhs_phy_resources,
++ ARRAY_SIZE(usbhs_phy_resources),
++ &usbhs_phy_pdata,
++ sizeof(usbhs_phy_pdata));
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++ silk_register_usbhs();
++#else
++ silk_add_usb0_device();
++#endif
++ silk_add_usb1_device();
++ silk_add_rsnd_device();
++ silk_add_camera0_device();
++#if IS_ENABLED(CONFIG_VIDEO_RENESAS_VSP1)
++ silk_add_vsp1_devices();
++#endif
++ silk_add_msiof_device(spi_bus, ARRAY_SIZE(spi_bus));
++}
++
++static const char * const silk_boards_compat_dt[] __initconst = {
++ "renesas,silk",
++ "renesas,silk-reference",
++ NULL,
++};
++
++DT_MACHINE_START(SILK_DT, "silk")
++ .smp = smp_ops(r8a7794_smp_ops),
++ .init_early = r8a7794_init_early,
++ .init_time = r8a7794_timer_init,
++ .init_machine = silk_add_standard_devices,
++ .init_late = shmobile_init_late,
++ .reserve = rcar_gen2_reserve,
++ .restart = silk_restart,
++ .dt_compat = silk_boards_compat_dt,
++MACHINE_END
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0002-kernel-silk-fix-ethernet-phy-irq.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0002-kernel-silk-fix-ethernet-phy-irq.patch
new file mode 100644
index 0000000..5e72b82
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0002-kernel-silk-fix-ethernet-phy-irq.patch
@@ -0,0 +1,25 @@
+From f186213b9d9d3942dc403060542796e07d254d52 Mon Sep 17 00:00:00 2001
+From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+Date: Mon, 2 Feb 2015 13:34:25 +0300
+Subject: [PATCH] Silk: Ethernet phy interrupt is connected to IRQ8
+
+---
+ arch/arm/boot/dts/r8a7794-silk.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/r8a7794-silk.dts b/arch/arm/boot/dts/r8a7794-silk.dts
+index cb69f6b..aa20df8 100644
+--- a/arch/arm/boot/dts/r8a7794-silk.dts
++++ b/arch/arm/boot/dts/r8a7794-silk.dts
+@@ -280,7 +280,7 @@
+ phy1: ethernet-phy@1 {
+ reg = <1>;
+ interrupt-parent = <&irqc0>;
+- interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
++ interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
+ micrel,led-mode = <1>;
+ };
+ };
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0003-kernel-silk-fix-sd-detect.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0003-kernel-silk-fix-sd-detect.patch
new file mode 100644
index 0000000..0bb4f75
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0003-kernel-silk-fix-sd-detect.patch
@@ -0,0 +1,25 @@
+From 1a56b82aad68465e69827f1cbe18f53ab886f7df Mon Sep 17 00:00:00 2001
+From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+Date: Mon, 2 Feb 2015 13:35:06 +0300
+Subject: [PATCH] Silk: Fix SDHI1 write protect pin detection
+
+---
+ arch/arm/boot/dts/r8a7794-silk.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/r8a7794-silk.dts b/arch/arm/boot/dts/r8a7794-silk.dts
+index aa20df8..9438dfa 100644
+--- a/arch/arm/boot/dts/r8a7794-silk.dts
++++ b/arch/arm/boot/dts/r8a7794-silk.dts
+@@ -345,7 +345,7 @@
+ vmmc-supply = <&vcc_sdhi1>;
+ vqmmc-supply = <&vccq_sdhi1>;
+ cd-gpios = <&gpio6 14 GPIO_ACTIVE_LOW>;
+- wp-gpios = <&gpio6 15 GPIO_ACTIVE_HIGH>;
++ wp-gpios = <&gpio6 15 GPIO_ACTIVE_LOW>;
+ status = "okay";
+ };
+
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0004-kernel-Revert-i2c-rcar-Support-ACK-by-HW-auto-restart-after-NACK.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0004-kernel-Revert-i2c-rcar-Support-ACK-by-HW-auto-restart-after-NACK.patch
new file mode 100644
index 0000000..5f23129
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0004-kernel-Revert-i2c-rcar-Support-ACK-by-HW-auto-restart-after-NACK.patch
@@ -0,0 +1,66 @@
+From 4f249ca259008006d972ea76fd2b37a2558ea2f1 Mon Sep 17 00:00:00 2001
+From: Petr Nechaev <petr.nechaev@cogentembedded.com>
+Date: Mon, 2 Feb 2015 13:37:55 +0300
+Subject: [PATCH] Revert "i2c: rcar: Support ACK by HW auto restart after
+ NACK"
+
+This reverts commit 4df6b2af6c0f795d810eb1e2e9411ad1cbbe4245.
+---
+ drivers/i2c/busses/i2c-rcar.c | 20 ++++++++------------
+ 1 file changed, 8 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
+index 18034cd..0e863f3 100644
+--- a/drivers/i2c/busses/i2c-rcar.c
++++ b/drivers/i2c/busses/i2c-rcar.c
+@@ -522,6 +522,7 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
+
+ /* go to stop phase */
+ rcar_i2c_bus_phase(priv, RCAR_BUS_PHASE_STOP);
++ rcar_i2c_irq_mask(priv, RCAR_IRQ_OPEN_FOR_STOP);
+ rcar_i2c_flags_set(priv, ID_NACK);
+ rcar_i2c_status_bit_clear(priv, MNR);
+ goto out;
+@@ -532,14 +533,8 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
+ */
+ if (msr & MST) {
+ dev_dbg(dev, "Stop\n");
+- if (rcar_i2c_flags_has(priv, ID_NACK)) {
+- /* don't set ID_DONE for expecting ACK
+- after auto-restart by HW */
+- rcar_i2c_status_bit_clear(priv, MST);
+- } else {
+- rcar_i2c_flags_set(priv, ID_DONE);
+- rcar_i2c_status_clear(priv);
+- }
++ rcar_i2c_flags_set(priv, ID_DONE);
++ rcar_i2c_status_clear(priv);
+ goto out;
+ }
+
+@@ -616,10 +611,6 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
+ rcar_i2c_flags_has(priv, ID_DONE),
+ 5 * HZ);
+ if (!timeout) {
+- if (rcar_i2c_flags_has(priv, ID_NACK)) {
+- ret = -ENXIO;
+- break;
+- }
+ ret = -ETIMEDOUT;
+ break;
+ }
+@@ -627,6 +618,11 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
+ /*
+ * error handling
+ */
++ if (rcar_i2c_flags_has(priv, ID_NACK)) {
++ ret = -ENXIO;
++ break;
++ }
++
+ if (rcar_i2c_flags_has(priv, ID_ARBLOST)) {
+ ret = -EAGAIN;
+ break;
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0006-Rcar-DU-add-RGB-connector.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0006-Rcar-DU-add-RGB-connector.patch
new file mode 100644
index 0000000..d1c8da8
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0006-Rcar-DU-add-RGB-connector.patch
@@ -0,0 +1,276 @@
+From 488e93a1d8371c6ce8cfd24d7299973c476a1aef Mon Sep 17 00:00:00 2001
+From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+Date: Sun, 28 Dec 2014 19:58:58 +0300
+Subject: [PATCH] Rcar-DU: add RGB connector
+
+
+Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+---
+ drivers/gpu/drm/rcar-du/Makefile | 1 +
+ drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 9 ++
+ drivers/gpu/drm/rcar-du/rcar_du_rgbcon.c | 142 +++++++++++++++++++++++++++++
+ drivers/gpu/drm/rcar-du/rcar_du_rgbcon.h | 24 +++++
+ include/linux/platform_data/rcar-du.h | 7 ++
+ 5 files changed, 183 insertions(+)
+ create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_rgbcon.c
+ create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_rgbcon.h
+
+diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile
+index a6909f0..744da0f 100644
+--- a/drivers/gpu/drm/rcar-du/Makefile
++++ b/drivers/gpu/drm/rcar-du/Makefile
+@@ -5,6 +5,7 @@ rcar-du-drm-y := rcar_du_crtc.o \
+ rcar_du_hdmicon.o \
+ rcar_du_kms.o \
+ rcar_du_lvdscon.o \
++ rcar_du_rgbcon.o \
+ rcar_du_plane.o \
+ rcar_du_vgacon.o
+
+diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+index 0edec97..de0ccc1 100644
+--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
++++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+@@ -24,6 +24,7 @@
+ #include "rcar_du_encoder.h"
+ #include "rcar_du_kms.h"
+ #include "rcar_du_lvdscon.h"
++#include "rcar_du_rgbcon.h"
+ #include "rcar_du_lvdsenc.h"
+ #include "rcar_du_vgacon.h"
+ #include "rcar_du_hdmicon.h"
+@@ -235,6 +236,9 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
+ case RCAR_DU_ENCODER_LVDS:
+ encoder_type = DRM_MODE_ENCODER_LVDS;
+ break;
++ case RCAR_DU_ENCODER_RGB:
++ encoder_type = DRM_MODE_ENCODER_NONE;
++ break;
+ case RCAR_DU_ENCODER_HDMI:
+ encoder_type = DRM_MODE_ENCODER_TMDS;
+ break;
+@@ -277,6 +281,11 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
+ case DRM_MODE_ENCODER_DAC:
+ return rcar_du_vga_connector_init(rcdu, renc);
+
++ case DRM_MODE_ENCODER_NONE:
++ if (type == RCAR_DU_ENCODER_RGB)
++ return rcar_du_rgb_connector_init(rcdu, renc,
++ &data->connector.rgb.panel);
++ /* fallthrough */
+ default:
+ return -EINVAL;
+ }
+diff --git a/drivers/gpu/drm/rcar-du/rcar_du_rgbcon.c b/drivers/gpu/drm/rcar-du/rcar_du_rgbcon.c
+new file mode 100644
+index 0000000..9ee845d
+--- /dev/null
++++ b/drivers/gpu/drm/rcar-du/rcar_du_rgbcon.c
+@@ -0,0 +1,142 @@
++/*
++ * rcar_du_rgbcon.c -- R-Car Display Unit RGB Connector
++ * base on rcar_du_lvdscon.c
++ *
++ * Copyright (C) 2013-2014 Renesas Electronics Corporation
++ *
++ * 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.
++ */
++
++#include <drm/drmP.h>
++#include <drm/drm_crtc.h>
++#include <drm/drm_crtc_helper.h>
++#include <drm/drm_encoder_slave.h>
++
++#include "rcar_du_drv.h"
++#include "rcar_du_encoder.h"
++#include "rcar_du_kms.h"
++#include "rcar_du_rgbcon.h"
++
++struct rcar_du_rgb_connector {
++ struct rcar_du_connector connector;
++
++ const struct rcar_du_panel_data *panel;
++};
++
++#define to_rcar_rgb_connector(c) \
++ container_of(c, struct rcar_du_rgb_connector, connector.connector)
++
++static int rcar_du_rgb_connector_get_modes(struct drm_connector *connector)
++{
++ struct rcar_du_rgb_connector *rgbcon =
++ to_rcar_rgb_connector(connector);
++ struct drm_display_mode *mode;
++
++ mode = drm_mode_create(connector->dev);
++ if (mode == NULL)
++ return 0;
++
++ mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
++ mode->clock = rgbcon->panel->mode.clock;
++ mode->hdisplay = rgbcon->panel->mode.hdisplay;
++ mode->hsync_start = rgbcon->panel->mode.hsync_start;
++ mode->hsync_end = rgbcon->panel->mode.hsync_end;
++ mode->htotal = rgbcon->panel->mode.htotal;
++ mode->vdisplay = rgbcon->panel->mode.vdisplay;
++ mode->vsync_start = rgbcon->panel->mode.vsync_start;
++ mode->vsync_end = rgbcon->panel->mode.vsync_end;
++ mode->vtotal = rgbcon->panel->mode.vtotal;
++ mode->flags = rgbcon->panel->mode.flags;
++
++ drm_mode_set_name(mode);
++ drm_mode_probed_add(connector, mode);
++
++ return 1;
++}
++
++static int rcar_du_rgb_connector_mode_valid(struct drm_connector *connector,
++ struct drm_display_mode *mode)
++{
++ return MODE_OK;
++}
++
++static const struct drm_connector_helper_funcs connector_helper_funcs = {
++ .get_modes = rcar_du_rgb_connector_get_modes,
++ .mode_valid = rcar_du_rgb_connector_mode_valid,
++ .best_encoder = rcar_du_connector_best_encoder,
++};
++
++static void rcar_du_rgb_connector_destroy(struct drm_connector *connector)
++{
++ drm_sysfs_connector_remove(connector);
++ drm_connector_cleanup(connector);
++}
++
++static enum drm_connector_status
++rcar_du_rgb_connector_detect(struct drm_connector *connector, bool force)
++{
++ return connector_status_connected;
++}
++
++static const struct drm_connector_funcs connector_funcs = {
++ .dpms = drm_helper_connector_dpms,
++ .detect = rcar_du_rgb_connector_detect,
++ .fill_modes = drm_helper_probe_single_connector_modes,
++ .destroy = rcar_du_rgb_connector_destroy,
++};
++
++int rcar_du_rgb_connector_init(struct rcar_du_device *rcdu,
++ struct rcar_du_encoder *renc,
++ const struct rcar_du_panel_data *panel)
++{
++ struct rcar_du_rgb_connector *rgbcon;
++ struct drm_connector *connector;
++ int ret;
++
++ if (rcdu->pdata->backlight_on) {
++ ret = rcdu->pdata->backlight_on();
++ if (ret < 0)
++ return ret;
++ }
++
++ rgbcon = devm_kzalloc(rcdu->dev, sizeof(*rgbcon), GFP_KERNEL);
++ if (rgbcon == NULL)
++ return -ENOMEM;
++
++ rgbcon->panel = panel;
++
++ connector = &rgbcon->connector.connector;
++ connector->display_info.width_mm = panel->width_mm;
++ connector->display_info.height_mm = panel->height_mm;
++
++ ret = drm_connector_init(rcdu->ddev, connector, &connector_funcs,
++ DRM_MODE_CONNECTOR_Component);
++ if (ret < 0)
++ return ret;
++
++ drm_connector_helper_add(connector, &connector_helper_funcs);
++ ret = drm_sysfs_connector_add(connector);
++ if (ret < 0)
++ return ret;
++
++#if 0
++ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
++ drm_object_property_set_value(&connector->base,
++ rcdu->ddev->mode_config.dpms_property, DRM_MODE_DPMS_OFF);
++#else
++ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
++ drm_object_property_set_value(&connector->base,
++ rcdu->ddev->mode_config.dpms_property, DRM_MODE_DPMS_ON);
++#endif
++ ret = drm_mode_connector_attach_encoder(connector, renc->encoder);
++ if (ret < 0)
++ return ret;
++
++ connector->encoder = renc->encoder;
++ rgbcon->connector.encoder = renc;
++
++ return 0;
++}
+diff --git a/drivers/gpu/drm/rcar-du/rcar_du_rgbcon.h b/drivers/gpu/drm/rcar-du/rcar_du_rgbcon.h
+new file mode 100644
+index 0000000..d4d51be
+--- /dev/null
++++ b/drivers/gpu/drm/rcar-du/rcar_du_rgbcon.h
+@@ -0,0 +1,24 @@
++/*
++ * rcar_du_rgbcon.h -- R-Car Display Unit RGB Connector
++ * based on rcar_du_lvdscon.h
++ *
++ * Copyright (C) 2013-2014 Renesas Electronics Corporation
++ *
++ * 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.
++ */
++
++#ifndef __RCAR_DU_RGBCON_H__
++#define __RCAR_DU_RGBCON_H__
++
++struct rcar_du_device;
++struct rcar_du_encoder;
++struct rcar_du_panel_data;
++
++int rcar_du_rgb_connector_init(struct rcar_du_device *rcdu,
++ struct rcar_du_encoder *renc,
++ const struct rcar_du_panel_data *panel);
++
++#endif /* __RCAR_DU_RGBCON_H__ */
+diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
+index 62464de..93c29af 100644
+--- a/include/linux/platform_data/rcar-du.h
++++ b/include/linux/platform_data/rcar-du.h
+@@ -31,6 +31,7 @@ enum rcar_du_encoder_type {
+ RCAR_DU_ENCODER_NONE,
+ RCAR_DU_ENCODER_VGA,
+ RCAR_DU_ENCODER_LVDS,
++ RCAR_DU_ENCODER_RGB,
+ RCAR_DU_ENCODER_HDMI,
+ };
+
+@@ -44,6 +45,11 @@ struct rcar_du_connector_lvds_data {
+ struct rcar_du_panel_data panel;
+ };
+
++struct rcar_du_connector_rgb_data {
++ struct rcar_du_panel_data panel;
++};
++
++
+ struct rcar_du_connector_vga_data {
+ /* TODO: Add DDC information for EDID retrieval */
+ };
+@@ -68,6 +74,7 @@ struct rcar_du_encoder_data {
+
+ union {
+ struct rcar_du_connector_lvds_data lvds;
++ struct rcar_du_connector_rgb_data rgb;
+ struct rcar_du_connector_vga_data vga;
+ struct rcar_du_connector_hdmi_data hdmi;
+ } connector;
+--
+1.7.10.4
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0007-SILK-add-i2c0.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0007-SILK-add-i2c0.patch
new file mode 100644
index 0000000..1f02501
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0007-SILK-add-i2c0.patch
@@ -0,0 +1,45 @@
+From 207ad91c8ebbfbd2b862323200071a8c2a816fef Mon Sep 17 00:00:00 2001
+From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+Date: Sun, 28 Dec 2014 20:01:53 +0300
+Subject: [PATCH] SILK: add i2c0
+
+
+Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+---
+ arch/arm/boot/dts/r8a7794-silk.dts | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7794-silk.dts b/arch/arm/boot/dts/r8a7794-silk.dts
+index aa20df8..bd1359d 100644
+--- a/arch/arm/boot/dts/r8a7794-silk.dts
++++ b/arch/arm/boot/dts/r8a7794-silk.dts
+@@ -181,6 +181,14 @@
+ clock-frequency = <20000000>;
+ };
+
++&i2c0 {
++ pinctrl-0 = <&i2c0_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++ clock-frequency = <400000>;
++};
++
+ &i2c1 {
+ pinctrl-0 = <&i2c1_pins>;
+ pinctrl-names = "default";
+@@ -211,6 +219,11 @@
+ renesas,function = "du";
+ };
+
++ i2c0_pins: i2c0 {
++ renesas,groups = "i2c0_d";
++ renesas,function = "i2c0";
++ };
++
+ i2c1_pins: i2c1 {
+ renesas,groups = "i2c1";
+ renesas,function = "i2c1";
+--
+1.7.10.4
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0008-Porter-board-support.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0008-Porter-board-support.patch
new file mode 100644
index 0000000..13fc68b
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0008-Porter-board-support.patch
@@ -0,0 +1,1426 @@
+From c8c4c6ed85b5f34b8f8178b8ce53c246a67cfa00 Mon Sep 17 00:00:00 2001
+From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+Date: Mon, 2 Feb 2015 14:12:24 +0300
+Subject: [PATCH] Add Porter board support
+
+Porter is an entry level development board based on R-Car M2 SoC
+(R8A7791)
+
+Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+---
+ arch/arm/boot/dts/Makefile | 1 +
+ arch/arm/boot/dts/r8a7791-porter.dts | 385 ++++++++++
+ arch/arm/configs/shmobile_defconfig | 1 +
+ arch/arm/mach-shmobile/Kconfig | 6 +
+ arch/arm/mach-shmobile/Makefile | 1 +
+ arch/arm/mach-shmobile/board-porter-reference.c | 953 ++++++++++++++++++++++++
+ 6 files changed, 1347 insertions(+)
+ create mode 100644 arch/arm/boot/dts/r8a7791-porter.dts
+ create mode 100644 arch/arm/mach-shmobile/board-porter-reference.c
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index f2b99db..a1de751 100644
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -176,6 +176,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
+ r7s72100-genmai.dtb \
+ r8a7791-henninger.dtb \
+ r8a7791-koelsch.dtb \
++ r8a7791-porter.dtb \
+ r8a7790-lager.dtb \
+ r8a7794-alt.dtb \
+ r8a7794-silk.dtb \
+diff --git a/arch/arm/boot/dts/r8a7791-porter.dts b/arch/arm/boot/dts/r8a7791-porter.dts
+new file mode 100644
+index 0000000..6a0ccde
+--- /dev/null
++++ b/arch/arm/boot/dts/r8a7791-porter.dts
+@@ -0,0 +1,385 @@
++/*
++ * Device Tree Source for the Porter board
++ *
++ * Copyright (C) 2015 Renesas Electronics Corporation
++ * Copyright (C) 2015 Cogent Embedded, Inc.
++ *
++ * This file is licensed under the terms of the GNU General Public License
++ * version 2. This program is licensed "as is" without any warranty of any
++ * kind, whether express or implied.
++ */
++
++/*
++ * SSI-AK4643
++ *
++ * these commands are required when playback.
++ *
++ * # amixer set "LINEOUT Mixer DACL" on
++ * # amixer set "Digital" 200
++ * # amixer set "DVC Out" 50
++ */
++
++/dts-v1/;
++#include "r8a7791.dtsi"
++#include <dt-bindings/gpio/gpio.h>
++
++/ {
++ model = "Porter";
++ compatible = "renesas,porter", "renesas,r8a7791";
++
++ aliases {
++ serial6 = &scif0;
++ };
++
++ chosen {
++ bootargs = "console=ttySC6,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp vmalloc=384M";
++ };
++
++ memory@40000000 {
++ device_type = "memory";
++ reg = <0 0x40000000 0 0x40000000>;
++ };
++
++ memory@200000000 {
++ device_type = "memory";
++ reg = <2 0x00000000 0 0x40000000>;
++ };
++
++ leds {
++ compatible = "gpio-leds";
++ led2 {
++ gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>;
++ };
++ led3 {
++ gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
++ };
++ led4 {
++ gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
++ };
++ };
++
++ vcc_sdhi0: regulator@0 {
++ compatible = "regulator-fixed";
++
++ regulator-name = "SDHI0 Vcc";
++ regulator-min-microvolt = <3300000>;
++ regulator-max-microvolt = <3300000>;
++ regulator-always-on;
++ };
++
++ vccq_sdhi0: regulator@1 {
++ compatible = "regulator-gpio";
++
++ regulator-name = "SDHI0 VccQ";
++ regulator-min-microvolt = <1800000>;
++ regulator-max-microvolt = <3300000>;
++
++ gpios = <&gpio2 12 GPIO_ACTIVE_HIGH>;
++ gpios-states = <1>;
++ states = <3300000 1
++ 1800000 0>;
++ };
++
++ vcc_sdhi2: regulator@2 {
++ compatible = "regulator-fixed";
++
++ regulator-name = "SDHI2 Vcc";
++ regulator-min-microvolt = <3300000>;
++ regulator-max-microvolt = <3300000>;
++ regulator-always-on;
++ };
++
++ vccq_sdhi2: regulator@3 {
++ compatible = "regulator-gpio";
++
++ regulator-name = "SDHI2 VccQ";
++ regulator-min-microvolt = <1800000>;
++ regulator-max-microvolt = <3300000>;
++
++ gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>;
++ gpios-states = <1>;
++ states = <3300000 1
++ 1800000 0>;
++ };
++
++ hdmi_transmitter: adv7511 {
++ compatible = "adi,adv7511";
++ gpios = <&gpio3 29 GPIO_ACTIVE_LOW>;
++
++ adi,input-style = <0x02>;
++ adi,input-id = <0x00>;
++ adi,input-color-depth = <0x03>;
++ adi,sync-pulse = <0x03>;
++ adi,bit-justification = <0x01>;
++ adi,up-conversion = <0x00>;
++ adi,timing-generation-sequence = <0x00>;
++ adi,vsync-polarity = <0x02>;
++ adi,hsync-polarity = <0x02>;
++ adi,clock-delay = <0x03>;
++ };
++
++ usbhs_udc {
++ gpios = <&gpio5 31 GPIO_ACTIVE_HIGH>;
++ };
++};
++
++&extal_clk {
++ clock-frequency = <20000000>;
++};
++
++&pfc {
++ pinctrl-0 = <&du_pins &usb0_pins &usb1_pins &sound_pins &sound_clk_pins &vin0_pins>;
++ pinctrl-names = "default";
++
++ du_pins: du {
++ renesas,groups = "du_rgb666", "du_sync", "du_clk_out_0";
++ renesas,function = "du";
++ };
++
++ scif0_pins: serial6 {
++ renesas,groups = "scif0_data_d";
++ renesas,function = "scif0";
++ };
++
++ i2c1_pins: i2c1 {
++ renesas,groups = "i2c1_e";
++ renesas,function = "i2c1";
++ };
++
++ i2c2_pins: i2c2 {
++ renesas,groups = "i2c2";
++ renesas,function = "i2c2";
++ };
++
++ i2c4_pins: i2c4 {
++ renesas,groups = "i2c4_c";
++ renesas,function = "i2c4";
++ };
++
++ ether_pins: ether {
++ renesas,groups = "eth_link", "eth_mdio", "eth_rmii";
++ renesas,function = "eth";
++ };
++
++ phy1_pins: phy1 {
++ renesas,groups = "intc_irq0";
++ renesas,function = "intc";
++ };
++
++ sdhi0_pins: sd0 {
++ renesas,groups = "sdhi0_data4", "sdhi0_ctrl";
++ renesas,function = "sdhi0";
++ };
++
++ sdhi2_pins: sd2 {
++ renesas,groups = "sdhi2_data4", "sdhi2_ctrl";
++ renesas,function = "sdhi2";
++ };
++
++ qspi_pins: spi0 {
++ renesas,groups = "qspi_ctrl", "qspi_data4";
++ renesas,function = "qspi";
++ };
++
++ msiof0_pins: spi1 {
++ renesas,groups = "msiof0_clk", "msiof0_sync", "msiof0_rx",
++ "msiof0_tx";
++ renesas,function = "msiof0";
++ };
++
++ sound_pins: sound {
++ renesas,groups = "ssi0129_ctrl", "ssi0_data", "ssi1_data";
++ renesas,function = "ssi";
++ };
++
++ sound_clk_pins: sound_clk {
++ renesas,groups = "audio_clk_a";
++ renesas,function = "audio_clk";
++ };
++
++ usb0_pins: usb0 {
++ renesas,groups = "usb0";
++ renesas,function = "usb0";
++ };
++
++ usb1_pins: usb1 {
++ renesas,groups = "usb1";
++ renesas,function = "usb1";
++ };
++
++ vin0_pins: vin0 {
++ renesas,groups = "vin0_data8", "vin0_clk";
++ renesas,function = "vin0";
++ };
++};
++
++&ether {
++ pinctrl-0 = <&ether_pins &phy1_pins>;
++ pinctrl-names = "default";
++
++ phy-handle = <&phy1>;
++ renesas,ether-link-active-low;
++ status = "ok";
++
++ phy1: ethernet-phy@1 {
++ reg = <1>;
++ interrupt-parent = <&irqc0>;
++ interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
++ micrel,led-mode = <1>;
++ };
++};
++
++&sata0 {
++ status = "okay";
++};
++
++&scif0 {
++ pinctrl-0 = <&scif0_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++};
++
++&sdhi0 {
++ pinctrl-0 = <&sdhi0_pins>;
++ pinctrl-names = "default";
++
++ vmmc-supply = <&vcc_sdhi0>;
++ vqmmc-supply = <&vccq_sdhi0>;
++ cd-gpios = <&gpio6 6 GPIO_ACTIVE_LOW>;
++ wp-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
++ status = "okay";
++};
++
++&sdhi2 {
++ pinctrl-0 = <&sdhi2_pins>;
++ pinctrl-names = "default";
++
++ vmmc-supply = <&vcc_sdhi2>;
++ vqmmc-supply = <&vccq_sdhi2>;
++ cd-gpios = <&gpio6 22 GPIO_ACTIVE_LOW>;
++ toshiba,mmc-wrprotect-disable;
++ status = "okay";
++};
++
++&qspi {
++ pinctrl-0 = <&qspi_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++
++ flash: flash@0 {
++ #address-cells = <1>;
++ #size-cells = <1>;
++ compatible = "spansion,s25fl512s";
++ reg = <0>;
++ spi-max-frequency = <30000000>;
++ spi-tx-bus-width = <4>;
++ spi-rx-bus-width = <4>;
++ m25p,fast-read;
++ spi-cpol;
++ spi-cpha;
++
++ partition@0 {
++ label = "loader";
++ reg = <0x00000000 0x00040000>;
++ read-only;
++ };
++ partition@40000 {
++ label = "user";
++ reg = <0x00040000 0x00400000>;
++ read-only;
++ };
++ partition@440000 {
++ label = "flash";
++ reg = <0x00440000 0x03bc0000>;
++ };
++ };
++};
++
++&msiof0 {
++ pinctrl-0 = <&msiof0_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++};
++
++&i2c1 {
++ pinctrl-0 = <&i2c1_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++ clock-frequency = <400000>;
++};
++
++&i2c2 {
++ pinctrl-0 = <&i2c2_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++ clock-frequency = <400000>;
++
++ eeprom@50 {
++ compatible = "renesas,24c02";
++ reg = <0x50>;
++ pagesize = <16>;
++ };
++
++ snd_codec: ak4643 {
++ #sound-dai-cells = <0>;
++ compatible = "asahi-kasei,ak4643";
++ reg = <0x12>;
++ };
++};
++
++&i2c4 {
++ pinctrl-0 = <&i2c4_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++ clock-frequency = <400000>;
++};
++
++&i2c5 {
++ status = "okay";
++ clock-frequency = <400000>;
++};
++
++&i2c6 {
++ status = "okay";
++ clock-frequency = <100000>;
++
++ vdd_dvfs: regulator@68 {
++ compatible = "diasemi,da9210";
++ reg = <0x68>;
++
++ regulator-min-microvolt = <1000000>;
++ regulator-max-microvolt = <1000000>;
++ regulator-boot-on;
++ regulator-always-on;
++ };
++};
++
++&pci0 {
++ status = "okay";
++ pinctrl-0 = <&usb0_pins>;
++ pinctrl-names = "default";
++};
++
++&pci1 {
++ status = "okay";
++ pinctrl-0 = <&usb1_pins>;
++ pinctrl-names = "default";
++};
++
++&pcie_bus_clk {
++ status = "okay";
++};
++
++&pciec {
++ status = "okay";
++};
++
++&cpu0 {
++ cpu0-supply = <&vdd_dvfs>;
++};
+diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
+index 11237db..bb4e0e6 100644
+--- a/arch/arm/configs/shmobile_defconfig
++++ b/arch/arm/configs/shmobile_defconfig
+@@ -26,6 +26,7 @@ CONFIG_MACH_GOSE=y
+ CONFIG_MACH_ALT=y
+ CONFIG_MACH_SILK=y
+ CONFIG_MACH_MARZEN=y
++CONFIG_MACH_PORTER=y
+ CONFIG_SHMOBILE_TIMER_HZ=100
+ CONFIG_ARM_LPAE=y
+ # CONFIG_SWP_EMULATE is not set
+diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
+index e2e00a9..7c15245 100644
+--- a/arch/arm/mach-shmobile/Kconfig
++++ b/arch/arm/mach-shmobile/Kconfig
+@@ -93,6 +93,12 @@ config MACH_MARZEN
+ depends on ARCH_R8A7779
+ select REGULATOR_FIXED_VOLTAGE if REGULATOR
+
++config MACH_PORTER
++ bool "Porter board"
++ depends on ARCH_R8A7791
++ select MICREL_PHY if SH_ETH
++ select SND_SOC_AK4642 if SND_SIMPLE_CARD
++
+ comment "Renesas ARM SoCs System Configuration"
+ endif
+
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index 139f31c..43b4025 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -78,6 +78,7 @@ obj-$(CONFIG_MACH_GOSE) += board-gose-reference.o
+ obj-$(CONFIG_MACH_ALT) += board-alt-reference.o
+ obj-$(CONFIG_MACH_SILK) += board-silk-reference.o
+ obj-$(CONFIG_MACH_MARZEN) += board-marzen-reference.o
++obj-$(CONFIG_MACH_PORTER) += board-porter-reference.o
+ else
+ obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o
+ obj-$(CONFIG_MACH_APE6EVM_REFERENCE) += board-ape6evm-reference.o
+diff --git a/arch/arm/mach-shmobile/board-porter-reference.c b/arch/arm/mach-shmobile/board-porter-reference.c
+new file mode 100644
+index 0000000..d481ecd
+--- /dev/null
++++ b/arch/arm/mach-shmobile/board-porter-reference.c
+@@ -0,0 +1,953 @@
++/*
++ * Porter board support - Reference DT implementation
++ *
++ * Copyright (C) 2013-2015 Renesas Electronics Corporation
++ * Copyright (C) 2013 Renesas Solutions Corp.
++ * Copyright (C) 2013 Magnus Damm
++ * Copyright (C) 2015 Cogent Embedded, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; 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 <linux/dma-mapping.h>
++#include <linux/kernel.h>
++#include <linux/mfd/tmio.h>
++#include <linux/mmc/host.h>
++#include <linux/mmc/sh_mobile_sdhi.h>
++#include <linux/of_gpio.h>
++#include <linux/of_platform.h>
++#include <linux/platform_data/camera-rcar.h>
++#include <linux/platform_data/rcar-du.h>
++#include <linux/platform_data/usb-rcar-gen2-phy.h>
++#if IS_ENABLED(CONFIG_VIDEO_RENESAS_VSP1)
++#include <linux/platform_data/vsp1.h>
++#endif
++#include <linux/serial_sci.h>
++#include <linux/sh_dma.h>
++#include <linux/spi/flash.h>
++#include <linux/spi/sh_msiof.h>
++#include <linux/spi/spi.h>
++#include <linux/usb/phy.h>
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++#include <linux/usb/renesas_usbhs.h>
++#endif
++#include <media/soc_camera.h>
++#include <asm/mach/arch.h>
++#include <sound/rcar_snd.h>
++#include <sound/simple_card.h>
++
++#include "clock.h"
++#include "common.h"
++#include "dma-register.h"
++#include "irqs.h"
++#include "r8a7791.h"
++#include "rcar-gen2.h"
++
++/* DU */
++static struct rcar_du_encoder_data porter_du_encoders[] = {
++ {
++ .type = RCAR_DU_ENCODER_HDMI,
++ .output = RCAR_DU_OUTPUT_DPAD0,
++ },
++ {
++ .type = RCAR_DU_ENCODER_NONE,
++ .output = RCAR_DU_OUTPUT_LVDS0,
++ .connector.lvds.panel = {
++ .width_mm = 229,
++ .height_mm = 149,
++ .mode = {
++ .clock = 69000,
++ .hdisplay = 1280,
++ .hsync_start = 1280 + 48,
++ .hsync_end = 1280 + 48 + 32,
++ .htotal = 1280 + 48 + 32 + 80,
++ .vdisplay = 800,
++ .vsync_start = 800 + 2,
++ .vsync_end = 800 + 2 + 6,
++ .vtotal = 800 + 2 + 6 + 15,
++ .flags = 0,
++ },
++ },
++ },
++};
++
++static struct rcar_du_crtc_data porter_du_crtcs[] = {
++ {
++ .exclk = 0, /* NoP */
++ .init_conn_type = DRM_MODE_CONNECTOR_LVDS,
++ },
++ {
++ .exclk = 0, /* NoP */
++ .init_conn_type = DRM_MODE_CONNECTOR_HDMIA,
++ },
++};
++
++static struct rcar_du_platform_data porter_du_pdata = {
++ .encoders = porter_du_encoders,
++ .num_encoders = ARRAY_SIZE(porter_du_encoders),
++ .crtcs = porter_du_crtcs,
++ .num_crtcs = ARRAY_SIZE(porter_du_crtcs),
++#ifdef CONFIG_DRM_FBDEV_CRTC
++ .fbdev_crtc = 1,
++#endif
++ .i2c_ch = 2,
++};
++
++static const struct resource du_resources[] __initconst = {
++ DEFINE_RES_MEM(0xfeb00000, 0x40000),
++ DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
++ DEFINE_RES_IRQ(gic_spi(256)),
++ DEFINE_RES_IRQ(gic_spi(268)),
++};
++
++static void __init porter_add_du_device(void)
++{
++ struct platform_device_info info = {
++ .name = "rcar-du-r8a7791",
++ .id = -1,
++ .res = du_resources,
++ .num_res = ARRAY_SIZE(du_resources),
++ .data = &porter_du_pdata,
++ .size_data = sizeof(porter_du_pdata),
++ .dma_mask = DMA_BIT_MASK(32),
++ };
++
++ platform_device_register_full(&info);
++}
++
++/* Sound */
++static struct rsnd_ssi_platform_info rsnd_ssi[] = {
++ RSND_SSI(AUDIOPP_DMAC_SLAVE_CMD0_TO_SSI0, gic_spi(370), 0),
++ RSND_SSI(AUDIOPP_DMAC_SLAVE_SSI1_TO_SCU1, gic_spi(371), RSND_SSI_CLK_PIN_SHARE),
++};
++
++static struct rsnd_src_platform_info rsnd_src[2] = {
++ RSND_SRC(0, AUDIO_DMAC_SLAVE_SCU0_TX, gic_spi(352)),
++ RSND_SRC(0, AUDIO_DMAC_SLAVE_CMD1_TO_MEM, gic_spi(353)),
++};
++
++static struct rsnd_dvc_platform_info rsnd_dvc[2] = {
++};
++
++static struct rsnd_dai_platform_info rsnd_dai = {
++ .playback = { .ssi = &rsnd_ssi[0], .src = &rsnd_src[0], .dvc = &rsnd_dvc[0], },
++ .capture = { .ssi = &rsnd_ssi[1], .src = &rsnd_src[1], .dvc = &rsnd_dvc[1], },
++};
++
++static struct rcar_snd_info rsnd_info = {
++ .flags = RSND_GEN2,
++ .ssi_info = rsnd_ssi,
++ .ssi_info_nr = ARRAY_SIZE(rsnd_ssi),
++ .src_info = rsnd_src,
++ .src_info_nr = ARRAY_SIZE(rsnd_src),
++ .dvc_info = rsnd_dvc,
++ .dvc_info_nr = ARRAY_SIZE(rsnd_dvc),
++ .dai_info = &rsnd_dai,
++ .dai_info_nr = 1,
++};
++
++static struct asoc_simple_card_info rsnd_card_info = {
++ .name = "SSI01-AK4643",
++ .codec = "ak4642-codec.2-0012",
++ .platform = "rcar_sound",
++ .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
++ .cpu_dai = {
++ .name = "rcar_sound",
++ },
++ .codec_dai = {
++ .name = "ak4642-hifi",
++ .sysclk = 11289600,
++ },
++};
++
++static void __init porter_add_rsnd_device(void)
++{
++ struct resource rsnd_resources[] = {
++ [RSND_GEN2_SCU] = DEFINE_RES_MEM(0xec500000, 0x1000),
++ [RSND_GEN2_ADG] = DEFINE_RES_MEM(0xec5a0000, 0x100),
++ [RSND_GEN2_SSIU] = DEFINE_RES_MEM(0xec540000, 0x1000),
++ [RSND_GEN2_SSI] = DEFINE_RES_MEM(0xec541000, 0x1280),
++ };
++
++ struct platform_device_info cardinfo = {
++ .parent = &platform_bus,
++ .name = "asoc-simple-card",
++ .id = -1,
++ .data = &rsnd_card_info,
++ .size_data = sizeof(struct asoc_simple_card_info),
++ .dma_mask = DMA_BIT_MASK(32),
++ };
++
++ platform_device_register_resndata(
++ &platform_bus, "rcar_sound", -1,
++ rsnd_resources, ARRAY_SIZE(rsnd_resources),
++ &rsnd_info, sizeof(rsnd_info));
++
++ platform_device_register_full(&cardinfo);
++}
++
++
++/*
++ * This is a really crude hack to provide clkdev support to platform
++ * devices until they get moved to DT.
++ */
++static const struct clk_name clk_names[] __initconst = {
++ { "cmt0", NULL, "sh_cmt.0" },
++ { "cmt0", "fck", "sh-cmt-48-gen2.0" },
++ { "du0", "du.0", "rcar-du-r8a7791" },
++ { "du1", "du.1", "rcar-du-r8a7791" },
++ { "lvds0", "lvds.0", "rcar-du-r8a7791" },
++ { "hsusb", NULL, "usb_phy_rcar_gen2" },
++ { "ssi0", "ssi.0", "rcar_sound" },
++ { "ssi1", "ssi.1", "rcar_sound" },
++ { "src0", "src.0", "rcar_sound" },
++ { "src1", "src.1", "rcar_sound" },
++ { "dvc0", "dvc.0", "rcar_sound" },
++ { "dvc1", "dvc.1", "rcar_sound" },
++ { "vin0", NULL, "r8a7791-vin.0" },
++ { "vsps", NULL, NULL },
++#if IS_ENABLED(CONFIG_VIDEO_RENESAS_VSP1)
++ { "vsp1-du0", NULL, "vsp1.2" },
++ { "vsp1-du1", NULL, "vsp1.3" },
++#else
++ { "vsp1-du0", NULL, NULL },
++ { "vsp1-du1", NULL, NULL },
++#endif
++ { "vcp0", NULL, NULL },
++ { "vpc0", NULL, NULL },
++ { "tddmac", NULL, NULL },
++ { "fdp1", NULL, NULL },
++ { "fdp0", NULL, NULL },
++ { "pvrsrvkm", NULL, "pvrsrvkm" },
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++ { "hsusb", NULL, "renesas_usbhs" },
++#else
++ { "ehci", NULL, "pci-rcar-gen2.0" },
++#endif
++};
++
++/*
++ * This is a really crude hack to work around core platform clock issues
++ */
++static const struct clk_name clk_enables[] __initconst = {
++ { "ehci", NULL, "pci-rcar-gen2.1" },
++ { "dmal", NULL, "sh-dma-engine.0" },
++ { "dmah", NULL, "sh-dma-engine.1" },
++ { "sys-dmac1", NULL, "sh-dma-engine.2" },
++ { "sys-dmac0", NULL, "sh-dma-engine.3" },
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++ { "usbdmac0", NULL, "sh-dma-engine.4" },
++#endif
++ { "ssp_dev", NULL, "ssp_dev" },
++ { "ipmmu_gp", NULL, "ipmmu_gp" },
++};
++
++#define DMAE_CHANNEL(a, b) \
++{ \
++ .offset = (a) - 0x20, \
++ .dmars = (a) - 0x20 + 0x40, \
++ .chclr_bit = (b), \
++ .chclr_offset = 0x80 - 0x20, \
++}
++
++/* Sys-DMAC */
++#define SYS_DMAC_SLAVE(_id, _bit, _addr, toffset, roffset, t, r) \
++{ \
++ .slave_id = SYS_DMAC_SLAVE_## _id ##_TX, \
++ .addr = _addr + toffset, \
++ .chcr = CHCR_TX(XMIT_SZ_## _bit ##BIT), \
++ .mid_rid = t, \
++}, { \
++ .slave_id = SYS_DMAC_SLAVE_## _id ##_RX, \
++ .addr = _addr + roffset, \
++ .chcr = CHCR_RX(XMIT_SZ_## _bit ##BIT), \
++ .mid_rid = r, \
++}
++
++#define SYS_DMAC_SLAVE_TX(_id, _bit, _addr, toffset, roffset, t, r) \
++{ \
++ .slave_id = SYS_DMAC_SLAVE_## _id ##_TX, \
++ .addr = _addr + toffset, \
++ .chcr = CHCR_TX(XMIT_SZ_## _bit ##BIT), \
++ .mid_rid = t, \
++}
++
++static const struct sh_dmae_slave_config r8a7791_sys_dmac_slaves[] = {
++ SYS_DMAC_SLAVE(SDHI0, 256, 0xee100000, 0x60, 0x2060, 0xcd, 0xce),
++ SYS_DMAC_SLAVE(SDHI1, 256, 0xee140000, 0x30, 0x2030, 0xc1, 0xc2),
++ SYS_DMAC_SLAVE(SDHI2, 256, 0xee160000, 0x30, 0x2030, 0xd3, 0xd4),
++ SYS_DMAC_SLAVE(SCIF0, 8, 0xe6e60000, 0xc, 0x14, 0x29, 0x2a),
++ SYS_DMAC_SLAVE(SCIF1, 8, 0xe6e68000, 0xc, 0x14, 0x2d, 0x2e),
++ SYS_DMAC_SLAVE(SCIF2, 8, 0xe6e58000, 0xc, 0x14, 0x2b, 0x2c),
++ SYS_DMAC_SLAVE(SCIF3, 8, 0xe6ea8000, 0xc, 0x14, 0x2f, 0x30),
++ SYS_DMAC_SLAVE(SCIF4, 8, 0xe6ee0000, 0xc, 0x14, 0xfb, 0xfc),
++ SYS_DMAC_SLAVE(SCIF5, 8, 0xe6ee8000, 0xc, 0x14, 0xfd, 0xfe),
++ SYS_DMAC_SLAVE(SCIFA0, 8, 0xe6c40000, 0x20, 0x24, 0x21, 0x22),
++ SYS_DMAC_SLAVE(SCIFA1, 8, 0xe6c50000, 0x20, 0x24, 0x25, 0x26),
++ SYS_DMAC_SLAVE(SCIFA2, 8, 0xe6c60000, 0x20, 0x24, 0x27, 0x28),
++ SYS_DMAC_SLAVE(SCIFA3, 8, 0xe6c70000, 0x20, 0x24, 0x1b, 0x1c),
++ SYS_DMAC_SLAVE(SCIFA4, 8, 0xe6c78000, 0x20, 0x24, 0x1f, 0x20),
++ SYS_DMAC_SLAVE(SCIFA5, 8, 0xe6c80000, 0x20, 0x24, 0x23, 0x24),
++ SYS_DMAC_SLAVE(SCIFB0, 8, 0xe6c20000, 0x40, 0x60, 0x3d, 0x3e),
++ SYS_DMAC_SLAVE(SCIFB1, 8, 0xe6c30000, 0x40, 0x60, 0x19, 0x1a),
++ SYS_DMAC_SLAVE(SCIFB2, 8, 0xe6ce0000, 0x40, 0x60, 0x1d, 0x1e),
++ SYS_DMAC_SLAVE(HSCIF0, 8, 0xe62c0000, 0xc, 0x14, 0x39, 0x3a),
++ SYS_DMAC_SLAVE(HSCIF1, 8, 0xe62c8000, 0xc, 0x14, 0x4d, 0x4e),
++ SYS_DMAC_SLAVE(HSCIF2, 8, 0xe62d0000, 0xc, 0x14, 0x3b, 0x3c),
++ SYS_DMAC_SLAVE(MSIOF0, 32, 0xe7e20000, 0x50, 0x60, 0x51, 0x52),
++ SYS_DMAC_SLAVE(MSIOF1, 32, 0xe7e10000, 0x50, 0x60, 0x55, 0x56),
++ SYS_DMAC_SLAVE(MSIOF2, 32, 0xe7e00000, 0x50, 0x60, 0x41, 0x42),
++};
++
++static const struct sh_dmae_channel r8a7791_sys_dmac_channels[] = {
++ DMAE_CHANNEL(0x8000, 0),
++ DMAE_CHANNEL(0x8080, 1),
++ DMAE_CHANNEL(0x8100, 2),
++ DMAE_CHANNEL(0x8180, 3),
++ DMAE_CHANNEL(0x8200, 4),
++ DMAE_CHANNEL(0x8280, 5),
++ DMAE_CHANNEL(0x8300, 6),
++ DMAE_CHANNEL(0x8380, 7),
++ DMAE_CHANNEL(0x8400, 8),
++ DMAE_CHANNEL(0x8480, 9),
++ DMAE_CHANNEL(0x8500, 10),
++ DMAE_CHANNEL(0x8580, 11),
++ DMAE_CHANNEL(0x8600, 12),
++ DMAE_CHANNEL(0x8680, 13),
++ DMAE_CHANNEL(0x8700, 14),
++};
++
++static struct sh_dmae_pdata r8a7791_sys_dmac_platform_data = {
++ .slave = r8a7791_sys_dmac_slaves,
++ .slave_num = ARRAY_SIZE(r8a7791_sys_dmac_slaves),
++ .channel = r8a7791_sys_dmac_channels,
++ .channel_num = ARRAY_SIZE(r8a7791_sys_dmac_channels),
++ .ts_low_shift = TS_LOW_SHIFT,
++ .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
++ .ts_high_shift = TS_HI_SHIFT,
++ .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
++ .ts_shift = dma_ts_shift,
++ .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
++ .dmaor_init = DMAOR_DME,
++ .chclr_present = 1,
++ .chclr_bitwise = 1,
++ .fourty_bits_addr = 1,
++};
++
++static struct resource r8a7791_sys_dmac_resources[] = {
++ /* Channel registers and DMAOR for low */
++ DEFINE_RES_MEM(0xe6700020, 0x8763 - 0x20),
++ DEFINE_RES_IRQ(gic_spi(197)),
++ DEFINE_RES_NAMED(gic_spi(200), 15, NULL, IORESOURCE_IRQ),
++
++ /* Channel registers and DMAOR for high */
++ DEFINE_RES_MEM(0xe6720020, 0x8763 - 0x20),
++ DEFINE_RES_IRQ(gic_spi(220)),
++ DEFINE_RES_NAMED(gic_spi(216), 4, NULL, IORESOURCE_IRQ),
++ DEFINE_RES_NAMED(gic_spi(308), 11, NULL, IORESOURCE_IRQ),
++};
++
++#define r8a7791_register_sys_dmac(id) \
++ platform_device_register_resndata( \
++ &platform_bus, "sh-dma-engine", 2 + id, \
++ &r8a7791_sys_dmac_resources[id * 3], id * 1 + 3, \
++ &r8a7791_sys_dmac_platform_data, \
++ sizeof(r8a7791_sys_dmac_platform_data))
++
++static void __init porter_add_dmac_prototype(void)
++{
++ r8a7791_register_sys_dmac(0);
++ r8a7791_register_sys_dmac(1);
++}
++
++static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
++ .dma_slave_tx = SYS_DMAC_SLAVE_SDHI0_TX,
++ .dma_slave_rx = SYS_DMAC_SLAVE_SDHI0_RX,
++ .dma_rx_offset = 0x2000,
++
++ .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
++ MMC_CAP_POWER_OFF_CARD,
++ .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
++};
++
++static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
++ .dma_slave_tx = SYS_DMAC_SLAVE_SDHI2_TX,
++ .dma_slave_rx = SYS_DMAC_SLAVE_SDHI2_RX,
++ .dma_rx_offset = 0x2000,
++
++ .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
++ MMC_CAP_POWER_OFF_CARD,
++ .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT |
++ TMIO_MMC_WRPROTECT_DISABLE,
++};
++
++/* SCIF */
++#define SCIF_PD(scif_type, index, scif_index) \
++static struct plat_sci_port scif##index##_platform_data = { \
++ .type = PORT_##scif_type, \
++ .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
++ .scscr = SCSCR_RE | SCSCR_TE, \
++ .dma_slave_tx = SYS_DMAC_SLAVE_##scif_type##scif_index##_TX, \
++ .dma_slave_rx = SYS_DMAC_SLAVE_##scif_type##scif_index##_RX, \
++}
++
++#define PDATA_SCIF(index, baseaddr, irq, i) SCIF_PD(SCIF, index, i)
++#define PDATA_SCIFA(index, baseaddr, irq, i) SCIF_PD(SCIFA, index, i)
++#define PDATA_SCIFB(index, baseaddr, irq, i) SCIF_PD(SCIFB, index, i)
++#define PDATA_HSCIF(index, baseaddr, irq, i) SCIF_PD(HSCIF, index, i)
++
++PDATA_SCIFA(0, 0xe6c40000, gic_spi(144), 0); /* SCIFA0 */
++PDATA_SCIFA(1, 0xe6c50000, gic_spi(145), 1); /* SCIFA1 */
++PDATA_SCIFB(2, 0xe6c20000, gic_spi(148), 0); /* SCIFB0 */
++PDATA_SCIFB(3, 0xe6c30000, gic_spi(149), 1); /* SCIFB1 */
++PDATA_SCIFB(4, 0xe6ce0000, gic_spi(150), 2); /* SCIFB2 */
++PDATA_SCIFA(5, 0xe6c60000, gic_spi(151), 2); /* SCIFA2 */
++PDATA_SCIF(6, 0xe6e60000, gic_spi(152), 0); /* SCIF0 */
++PDATA_SCIF(7, 0xe6e68000, gic_spi(153), 1); /* SCIF1 */
++PDATA_HSCIF(8, 0xe62c0000, gic_spi(154), 0); /* HSCIF0 */
++PDATA_HSCIF(9, 0xe62c8000, gic_spi(155), 1); /* HSCIF1 */
++PDATA_SCIF(10, 0xe6e58000, gic_spi(22), 2); /* SCIF2 */
++PDATA_SCIF(11, 0xe6ea8000, gic_spi(23), 3); /* SCIF3 */
++PDATA_SCIF(12, 0xe6ee0000, gic_spi(24), 4); /* SCIF4 */
++PDATA_SCIF(13, 0xe6ee8000, gic_spi(25), 5); /* SCIF5 */
++PDATA_SCIFA(14, 0xe6c70000, gic_spi(29), 3); /* SCIFA3 */
++PDATA_SCIFA(15, 0xe6c78000, gic_spi(30), 4); /* SCIFA4 */
++PDATA_SCIFA(16, 0xe6c80000, gic_spi(31), 5); /* SCIFA5 */
++PDATA_HSCIF(17, 0xe6cd0000, gic_spi(21), 2); /* HSCIF2 */
++
++#define SCIF_AD(scif_type, index, baseaddr) \
++ OF_DEV_AUXDATA("renesas," scif_type "-r8a7791", baseaddr, \
++ "sh-sci." # index, &scif##index##_platform_data)
++
++#define AUXDATA_SCIF(index, baseaddr, irq) SCIF_AD("scif", index, baseaddr)
++#define AUXDATA_SCIFA(index, baseaddr, irq) SCIF_AD("scifa", index, baseaddr)
++#define AUXDATA_SCIFB(index, baseaddr, irq) SCIF_AD("scifb", index, baseaddr)
++#define AUXDATA_HSCIF(index, baseaddr, irq) SCIF_AD("hscif", index, baseaddr)
++
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++/* USB-DMAC */
++static const struct sh_dmae_channel usb_dmac_channels[] = {
++ {
++ .offset = 0,
++ }, {
++ .offset = 0x20,
++ },
++};
++
++static const struct sh_dmae_slave_config usb_dmac_slaves[] = {
++ {
++ .slave_id = USB_DMAC_SLAVE_USBHS_TX,
++ .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_32BYTE),
++ }, {
++ .slave_id = USB_DMAC_SLAVE_USBHS_RX,
++ .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_32BYTE),
++ },
++};
++
++static struct sh_dmae_pdata usb_dmac_platform_data = {
++ .slave = usb_dmac_slaves,
++ .slave_num = ARRAY_SIZE(usb_dmac_slaves),
++ .channel = usb_dmac_channels,
++ .channel_num = ARRAY_SIZE(usb_dmac_channels),
++ .ts_low_shift = USBTS_LOW_SHIFT,
++ .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
++ .ts_high_shift = USBTS_HI_SHIFT,
++ .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
++ .ts_shift = dma_usbts_shift,
++ .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
++ .dmaor_init = DMAOR_DME,
++ .chcr_offset = 0x14,
++ .chcr_ie_bit = 1 << 5,
++ .dmaor_is_32bit = 1,
++ .needs_tend_set = 1,
++ .no_dmars = 1,
++ .slave_only = 1,
++};
++
++static struct resource usb_dmac_resources[] = {
++ DEFINE_RES_MEM(0xe65a0020, 0x44), /* Channel registers and DMAOR */
++ DEFINE_RES_MEM(0xe65a0000, 0x14), /* VCR/SWR/DMICR */
++ DEFINE_RES_IRQ(gic_spi(109)),
++};
++
++static void __init porter_add_usb_dmac_prototype(void)
++{
++ platform_device_register_resndata(&platform_bus, "sh-dma-engine",
++ 4,
++ usb_dmac_resources,
++ ARRAY_SIZE(usb_dmac_resources),
++ &usb_dmac_platform_data,
++ sizeof(usb_dmac_platform_data));
++}
++
++
++/* USBHS */
++static const struct resource usbhs_resources[] __initconst = {
++ DEFINE_RES_MEM(0xe6590000, 0x100),
++ DEFINE_RES_IRQ(gic_spi(107)),
++};
++
++struct usbhs_private {
++ struct renesas_usbhs_platform_info info;
++ struct usb_phy *phy;
++ int id_gpio;
++};
++
++#define usbhs_get_priv(pdev) \
++ container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info)
++
++static int usbhs_power_ctrl(struct platform_device *pdev,
++ void __iomem *base, int enable)
++{
++ struct usbhs_private *priv = usbhs_get_priv(pdev);
++
++ if (!priv->phy)
++ return -ENODEV;
++
++ if (enable) {
++ int retval = usb_phy_init(priv->phy);
++
++ if (!retval)
++ retval = usb_phy_set_suspend(priv->phy, 0);
++ return retval;
++ }
++
++ usb_phy_set_suspend(priv->phy, 1);
++ usb_phy_shutdown(priv->phy);
++ return 0;
++}
++
++static int usbhs_hardware_init(struct platform_device *pdev)
++{
++ struct usbhs_private *priv = usbhs_get_priv(pdev);
++ struct usb_phy *phy;
++ int ret;
++ struct device_node *np;
++
++ np = of_find_node_by_path("/gpio@e6055000");
++ if (np) {
++ priv->id_gpio = of_get_gpio(np, 31);
++ of_node_put(np);
++ } else {
++ pr_warn("Error: Unable to get MAX3355 ID input\n");
++ ret = -ENOTSUPP;
++ goto error2;
++ }
++
++ /* Check MAX3355E ID pin */
++ gpio_request_one(priv->id_gpio, GPIOF_IN, NULL);
++ if (!gpio_get_value(priv->id_gpio)) {
++ pr_warn("Error: USB0 cable selects host mode\n");
++ ret = -ENOTSUPP;
++ goto error;
++ }
++
++ phy = usb_get_phy_dev(&pdev->dev, 0);
++ if (IS_ERR(phy))
++ return PTR_ERR(phy);
++
++ priv->phy = phy;
++ return 0;
++
++error:
++ gpio_free(priv->id_gpio);
++error2:
++ return ret;
++}
++
++static int usbhs_hardware_exit(struct platform_device *pdev)
++{
++ struct usbhs_private *priv = usbhs_get_priv(pdev);
++
++ if (!priv->phy)
++ return 0;
++
++ usb_put_phy(priv->phy);
++ priv->phy = NULL;
++
++ gpio_free(priv->id_gpio);
++ return 0;
++}
++
++static int usbhs_get_id(struct platform_device *pdev)
++{
++ return USBHS_GADGET;
++}
++
++static int usbhs_get_vbus(struct platform_device *pdev)
++{
++ return 0;
++}
++
++static u32 porter_usbhs_pipe_type[] = {
++ USB_ENDPOINT_XFER_CONTROL,
++ USB_ENDPOINT_XFER_ISOC,
++ USB_ENDPOINT_XFER_ISOC,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_INT,
++ USB_ENDPOINT_XFER_INT,
++ USB_ENDPOINT_XFER_INT,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++};
++
++static struct usbhs_private usbhs_priv __initdata = {
++ .info = {
++ .platform_callback = {
++ .power_ctrl = usbhs_power_ctrl,
++ .hardware_init = usbhs_hardware_init,
++ .hardware_exit = usbhs_hardware_exit,
++ .get_id = usbhs_get_id,
++ .get_vbus = usbhs_get_vbus,
++ },
++ .driver_param = {
++ .buswait_bwait = 4,
++ .pipe_type = porter_usbhs_pipe_type,
++ .pipe_size = ARRAY_SIZE(porter_usbhs_pipe_type),
++ .d0_rx_id = USB_DMAC_SLAVE_USBHS_RX,
++ .d1_tx_id = USB_DMAC_SLAVE_USBHS_TX,
++ .usb_dmac_xfer_size = 32,
++ },
++ }
++};
++
++static void __init porter_add_usb0_gadget(void)
++{
++ usb_bind_phy("renesas_usbhs", 0, "usb_phy_rcar_gen2");
++ platform_device_register_resndata(&platform_bus,
++ "renesas_usbhs", -1,
++ usbhs_resources,
++ ARRAY_SIZE(usbhs_resources),
++ &usbhs_priv.info,
++ sizeof(usbhs_priv.info));
++}
++#else
++/* Internal PCI0 */
++static const struct resource pci0_resources[] __initconst = {
++ DEFINE_RES_MEM(0xee090000, 0x10000), /* CFG */
++ DEFINE_RES_MEM(0xee080000, 0x10000), /* MEM */
++ DEFINE_RES_IRQ(gic_spi(108)),
++};
++
++static void __init porter_add_usb0_host(void)
++{
++ usb_bind_phy("pci-rcar-gen2.0", 0, "usb_phy_rcar_gen2");
++ platform_device_register_simple("pci-rcar-gen2",
++ 0, pci0_resources,
++ ARRAY_SIZE(pci0_resources));
++}
++#endif
++
++/* Internal PCI1 */
++static const struct resource pci1_resources[] __initconst = {
++ DEFINE_RES_MEM(0xee0d0000, 0x10000), /* CFG */
++ DEFINE_RES_MEM(0xee0c0000, 0x10000), /* MEM */
++ DEFINE_RES_IRQ(gic_spi(113)),
++};
++
++static void __init porter_add_usb1_host(void)
++{
++ usb_bind_phy("pci-rcar-gen2.1", 0, "usb_phy_rcar_gen2");
++ platform_device_register_simple("pci-rcar-gen2",
++ 1, pci1_resources,
++ ARRAY_SIZE(pci1_resources));
++}
++
++/* USBHS PHY */
++static const struct rcar_gen2_phy_platform_data usbhs_phy_pdata __initconst = {
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++ .chan0_pci = 0, /* Channel 0 is USBHS */
++#else
++ .chan0_pci = 1, /* Channel 0 is PCI USB */
++#endif
++ .chan2_pci = 1, /* Channel 2 is PCI USB host */
++ .gpio_vbus = 798,
++ .wakeup = true,
++};
++
++/* VIN */
++static const struct resource vin_resources[] __initconst = {
++ /* VIN0 */
++ DEFINE_RES_MEM(0xe6ef0000, 0x1000),
++ DEFINE_RES_IRQ(gic_spi(188)),
++ /* VIN1 */
++ DEFINE_RES_MEM(0xe6ef1000, 0x1000),
++ DEFINE_RES_IRQ(gic_spi(189)),
++};
++
++static void __init porter_add_vin_device(unsigned idx,
++ struct rcar_vin_platform_data *pdata)
++{
++ struct platform_device_info vin_info = {
++ .parent = &platform_bus,
++ .name = "r8a7791-vin",
++ .id = idx,
++ .res = &vin_resources[idx * 2],
++ .num_res = 2,
++ .dma_mask = DMA_BIT_MASK(32),
++ .data = pdata,
++ .size_data = sizeof(*pdata),
++ };
++
++ BUG_ON(idx > 1);
++
++ platform_device_register_full(&vin_info);
++}
++
++#define PORTER_CAMERA(idx, name, addr, pdata, flag) \
++static struct i2c_board_info i2c_cam##idx##_device = { \
++ I2C_BOARD_INFO(name, addr), \
++}; \
++ \
++static struct rcar_vin_platform_data vin##idx##_pdata = { \
++ .flags = flag, \
++}; \
++ \
++static struct soc_camera_link cam##idx##_link = { \
++ .bus_id = idx, \
++ .board_info = &i2c_cam##idx##_device, \
++ .i2c_adapter_id = 2, \
++ .module_name = name, \
++ .priv = pdata, \
++}
++
++PORTER_CAMERA(0, "adv7180", 0x20, NULL, RCAR_VIN_BT656);
++
++static void __init porter_add_camera0_device(void)
++{
++ platform_device_register_data(&platform_bus, "soc-camera-pdrv", 0,
++ &cam0_link, sizeof(cam0_link));
++ porter_add_vin_device(0, &vin0_pdata);
++}
++
++/* VSP1 */
++#if IS_ENABLED(CONFIG_VIDEO_RENESAS_VSP1)
++static const struct vsp1_platform_data porter_vsps_pdata __initconst = {
++ .features = 0,
++ .rpf_count = 5,
++ .uds_count = 3,
++ .wpf_count = 4,
++};
++
++static const struct vsp1_platform_data porter_vspd0_pdata __initconst = {
++ .features = VSP1_HAS_LIF,
++ .rpf_count = 4,
++ .uds_count = 1,
++ .wpf_count = 4,
++};
++
++static const struct vsp1_platform_data porter_vspd1_pdata __initconst = {
++ .features = VSP1_HAS_LIF,
++ .rpf_count = 4,
++ .uds_count = 1,
++ .wpf_count = 4,
++};
++
++static const struct vsp1_platform_data * const porter_vsp1_pdata[] __initconst
++ = {
++ &porter_vsps_pdata,
++ &porter_vspd0_pdata,
++ &porter_vspd1_pdata,
++};
++
++static const struct resource vsp1_1_resources[] __initconst = {
++ DEFINE_RES_MEM(0xfe928000, 0x8000),
++ DEFINE_RES_IRQ(gic_spi(267)),
++};
++
++static const struct resource vsp1_2_resources[] __initconst = {
++ DEFINE_RES_MEM(0xfe930000, 0x8000),
++ DEFINE_RES_IRQ(gic_spi(246)),
++};
++
++static const struct resource vsp1_3_resources[] __initconst = {
++ DEFINE_RES_MEM(0xfe938000, 0x8000),
++ DEFINE_RES_IRQ(gic_spi(247)),
++};
++
++static const struct resource * const vsp1_resources[] __initconst = {
++ vsp1_1_resources,
++ vsp1_2_resources,
++ vsp1_3_resources,
++};
++
++static void __init porter_add_vsp1_devices(void)
++{
++ struct platform_device_info info = {
++ .name = "vsp1",
++ .size_data = sizeof(*porter_vsp1_pdata[0]),
++ .num_res = 2,
++ .dma_mask = DMA_BIT_MASK(32),
++ };
++ unsigned int i;
++
++ for (i = 1; i < ARRAY_SIZE(vsp1_resources); ++i) {
++ info.id = i + 1;
++ info.data = porter_vsp1_pdata[i];
++ info.res = vsp1_resources[i];
++
++ platform_device_register_full(&info);
++ }
++}
++#endif
++
++static const struct resource usbhs_phy_resources[] __initconst = {
++ DEFINE_RES_MEM(0xe6590100, 0x100),
++};
++
++/* Add all available USB devices */
++static void __init porter_add_usb_devices(void)
++{
++ platform_device_register_resndata(&platform_bus, "usb_phy_rcar_gen2",
++ -1, usbhs_phy_resources,
++ ARRAY_SIZE(usbhs_phy_resources),
++ &usbhs_phy_pdata,
++ sizeof(usbhs_phy_pdata));
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++ porter_add_usb0_gadget();
++#else
++ porter_add_usb0_host();
++#endif
++ porter_add_usb1_host();
++}
++
++/* MSIOF */
++static struct sh_msiof_spi_info msiof0_info = {
++ .rx_fifo_override = 256,
++ .num_chipselect = 1,
++ .dma_tx_id = SYS_DMAC_SLAVE_MSIOF0_TX,
++ .dma_rx_id = SYS_DMAC_SLAVE_MSIOF0_RX,
++};
++
++/* MSIOF spidev */
++static const struct spi_board_info spi_bus[] __initconst = {
++ {
++ .modalias = "spidev",
++ .max_speed_hz = 6000000,
++ .mode = SPI_MODE_3,
++ .bus_num = 1,
++ .chip_select = 0,
++ },
++};
++
++#define porter_add_msiof_device spi_register_board_info
++
++/* POWER IC */
++static struct i2c_board_info poweric_i2c[] = {
++ { I2C_BOARD_INFO("da9063", 0x58), },
++};
++
++static void porter_restart(char mode, const char *cmd)
++{
++ struct i2c_adapter *adap;
++ struct i2c_client *client;
++ u8 val;
++ int busnum = 6;
++
++ adap = i2c_get_adapter(busnum);
++ if (!adap) {
++ pr_err("failed to get adapter i2c%d\n", busnum);
++ return;
++ }
++
++ client = i2c_new_device(adap, &poweric_i2c[0]);
++ if (!client)
++ pr_err("failed to register %s to i2c%d\n",
++ poweric_i2c[0].type, busnum);
++
++ i2c_put_adapter(adap);
++
++ val = i2c_smbus_read_byte_data(client, 0x13);
++
++ if (val < 0)
++ pr_err("couldn't access da9063\n");
++
++ val |= 0x02;
++
++ i2c_smbus_write_byte_data(client, 0x13, val);
++}
++
++static struct of_dev_auxdata porter_auxdata_lookup[] __initdata = {
++ OF_DEV_AUXDATA("renesas,sdhi-r8a7791", 0xee100000, "sdhi0",
++ &sdhi0_info),
++ OF_DEV_AUXDATA("renesas,sdhi-r8a7791", 0xee160000, "sdhi2",
++ &sdhi2_info),
++ AUXDATA_SCIFA(0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
++ AUXDATA_SCIFA(1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
++ AUXDATA_SCIFB(2, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
++ AUXDATA_SCIFB(3, 0xe6c30000, gic_spi(149)), /* SCIFB1 */
++ AUXDATA_SCIFB(4, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */
++ AUXDATA_SCIFA(5, 0xe6c60000, gic_spi(151)), /* SCIFA2 */
++ AUXDATA_SCIF(6, 0xe6e60000, gic_spi(152)), /* SCIF0 */
++ AUXDATA_SCIF(7, 0xe6e68000, gic_spi(153)), /* SCIF1 */
++ AUXDATA_HSCIF(8, 0xe62c0000, gic_spi(154)), /* HSCIF0 */
++ AUXDATA_HSCIF(9, 0xe62c8000, gic_spi(155)), /* HSCIF1 */
++ AUXDATA_SCIF(10, 0xe6e58000, gic_spi(22)), /* SCIF2 */
++ AUXDATA_SCIF(11, 0xe6ea8000, gic_spi(23)), /* SCIF3 */
++ AUXDATA_SCIF(12, 0xe6ee0000, gic_spi(24)), /* SCIF4 */
++ AUXDATA_SCIF(13, 0xe6ee8000, gic_spi(25)), /* SCIF5 */
++ AUXDATA_SCIFA(14, 0xe6c70000, gic_spi(29)), /* SCIFA3 */
++ AUXDATA_SCIFA(15, 0xe6c78000, gic_spi(30)), /* SCIFA4 */
++ AUXDATA_SCIFA(16, 0xe6c80000, gic_spi(31)), /* SCIFA5 */
++ AUXDATA_HSCIF(17, 0xe6cd0000, gic_spi(21)), /* HSCIF2 */
++ OF_DEV_AUXDATA("renesas,msiof-r8a7791", 0xe6e20000,
++ "spi_r8a7791_msiof.0", &msiof0_info),
++ {},
++};
++
++static void __init porter_add_standard_devices(void)
++{
++ shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
++ shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true);
++ r8a7791_add_dt_devices();
++ porter_add_dmac_prototype();
++#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
++ porter_add_usb_dmac_prototype();
++#endif
++ of_platform_populate(NULL, of_default_bus_match_table,
++ porter_auxdata_lookup, NULL);
++
++ porter_add_du_device();
++ porter_add_usb_devices();
++ porter_add_rsnd_device();
++ porter_add_camera0_device();
++#if IS_ENABLED(CONFIG_VIDEO_RENESAS_VSP1)
++ porter_add_vsp1_devices();
++#endif
++ porter_add_msiof_device(spi_bus, ARRAY_SIZE(spi_bus));
++}
++
++static const char * const porter_boards_compat_dt[] __initconst = {
++ "renesas,porter",
++ "renesas,porter-reference",
++ NULL,
++};
++
++DT_MACHINE_START(PORTER_DT, "porter")
++ .smp = smp_ops(r8a7791_smp_ops),
++ .init_early = shmobile_init_delay,
++ .init_time = rcar_gen2_timer_init,
++ .init_machine = porter_add_standard_devices,
++ .init_late = shmobile_init_late,
++ .reserve = rcar_gen2_reserve,
++ .restart = porter_restart,
++ .dt_compat = porter_boards_compat_dt,
++MACHINE_END
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0009-shmobile-add-atag-dtb-compat.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0009-shmobile-add-atag-dtb-compat.patch
new file mode 100644
index 0000000..8b6935f
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0009-shmobile-add-atag-dtb-compat.patch
@@ -0,0 +1,26 @@
+From 80644cc053765ec9ea7c509acad7cfd819ea25f5 Mon Sep 17 00:00:00 2001
+From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+Date: Wed, 11 Feb 2015 15:19:56 +0300
+Subject: [PATCH] Add ATAG DTB compatibility
+
+This is useful when DTB is static
+
+Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+
+---
+ arch/arm/configs/shmobile_defconfig | 2 ++
+ 1 file changed, 2 insertions(+)
+
+Index: renesas-backport.v0/arch/arm/configs/shmobile_defconfig
+===================================================================
+--- renesas-backport.v0.orig/arch/arm/configs/shmobile_defconfig 2015-01-28 12:21:43.823500578 +0300
++++ renesas-backport.v0/arch/arm/configs/shmobile_defconfig 2015-02-11 14:33:34.864892464 +0300
+@@ -52,6 +52,8 @@
+ CONFIG_ZBOOT_ROM_TEXT=0x0
+ CONFIG_ZBOOT_ROM_BSS=0x0
+ CONFIG_ARM_APPENDED_DTB=y
++CONFIG_ARM_ATAG_DTB_COMPAT=y
++CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
+ CONFIG_KEXEC=y
+ CONFIG_CPU_FREQ=y
+ CONFIG_CPU_FREQ_STAT_DETAILS=y
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0010-Silk-Add-missing-pins-handle-to-Eth.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0010-Silk-Add-missing-pins-handle-to-Eth.patch
new file mode 100644
index 0000000..22742ea
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0010-Silk-Add-missing-pins-handle-to-Eth.patch
@@ -0,0 +1,43 @@
+From 4369d6e8d6c7068f6d570701afd87fb0e3b50495 Mon Sep 17 00:00:00 2001
+From: Valentine Barshak <valentine.barshak@cogentembedded.com>
+Date: Fri, 13 Feb 2015 23:12:41 +0300
+Subject: [PATCH] ARM: dts: r8a7794-silk: Add missing pins handle to
+ Ethernet node
+
+This adds missing pins handle to the Ethernet node.
+
+Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
+Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+---
+ arch/arm/boot/dts/r8a7794-silk.dts | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7794-silk.dts b/arch/arm/boot/dts/r8a7794-silk.dts
+index dc04673..9775aba 100644
+--- a/arch/arm/boot/dts/r8a7794-silk.dts
++++ b/arch/arm/boot/dts/r8a7794-silk.dts
+@@ -239,6 +239,11 @@
+ renesas,function = "eth";
+ };
+
++ phy1_pins: phy1 {
++ renesas,groups = "intc_irq8";
++ renesas,function = "intc";
++ };
++
+ qspi_pins: spi0 {
+ renesas,groups = "qspi_ctrl", "qspi_data4";
+ renesas,function = "qspi";
+@@ -286,6 +291,9 @@
+ };
+
+ &ether {
++ pinctrl-0 = <&ether_pins &phy1_pins>;
++ pinctrl-names = "default";
++
+ phy-handle = <&phy1>;
+ renesas,ether-link-active-low;
+ status = "ok";
+--
+1.9.3
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0011-Silk-Add-missing-DU-pins.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0011-Silk-Add-missing-DU-pins.patch
new file mode 100644
index 0000000..791b1a8
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0011-Silk-Add-missing-DU-pins.patch
@@ -0,0 +1,49 @@
+From 78aac9e8fbd6b5463554990e055302074a7fc485 Mon Sep 17 00:00:00 2001
+From: Valentine Barshak <valentine.barshak@cogentembedded.com>
+Date: Fri, 13 Feb 2015 06:01:51 +0300
+Subject: [PATCH] ARM: dts: r8a7794-silk: Add missing DU pins
+
+This adds missing DU pins to R8A7794 SILK device tree.
+
+Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
+---
+ arch/arm/boot/dts/r8a7794-silk.dts | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7794-silk.dts b/arch/arm/boot/dts/r8a7794-silk.dts
+index f6994c9..dc04673 100644
+--- a/arch/arm/boot/dts/r8a7794-silk.dts
++++ b/arch/arm/boot/dts/r8a7794-silk.dts
+@@ -209,16 +209,26 @@
+ };
+
+ &pfc {
+- pinctrl-0 = <&du_pins &usb0_pins &usb1_pins &sound_pins &sound_clk_pins
++ pinctrl-0 = <&du_pins &du0_pins &du1_pins &usb0_pins &usb1_pins &sound_pins &sound_clk_pins
+ &vin0_pins>;
+ pinctrl-names = "default";
+
+ du_pins: du {
+- renesas,groups = "du0_rgb888", "du0_sync", "du0_clk_out",
+- "du1_rgb666", "du1_sync", "du1_clk_out";
++ renesas,groups = "du0_rgb888", "du0_sync", "du0_clk_out", "du0_cde_disp",
++ "du1_rgb666", "du1_sync", "du1_clk_out", "du1_cde_disp";
+ renesas,function = "du";
+ };
+
++ du0_pins: du0 {
++ renesas,groups = "du0_clk_in";
++ renesas,function = "du0";
++ };
++
++ du1_pins: du1 {
++ renesas,groups = "du1_clk_in";
++ renesas,function = "du1";
++ };
++
+ i2c0_pins: i2c0 {
+ renesas,groups = "i2c0_d";
+ renesas,function = "i2c0";
+--
+1.9.3
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0012-can-add-Renesas-R-Car-CAN-driver.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0012-can-add-Renesas-R-Car-CAN-driver.patch
new file mode 100644
index 0000000..55450c0
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0012-can-add-Renesas-R-Car-CAN-driver.patch
@@ -0,0 +1,958 @@
+From fd1159318e55e901cf269de90163b19fd62938cb Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Sat, 17 May 2014 00:03:54 +0400
+Subject: [PATCH] can: add Renesas R-Car CAN driver
+
+Add support for the CAN controller found in Renesas R-Car SoCs.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ drivers/net/can/Kconfig | 10 +
+ drivers/net/can/Makefile | 1 +
+ drivers/net/can/rcar_can.c | 876 ++++++++++++++++++++++++++++++++++
+ include/linux/can/platform/rcar_can.h | 17 +
+ 4 files changed, 904 insertions(+)
+ create mode 100644 drivers/net/can/rcar_can.c
+ create mode 100644 include/linux/can/platform/rcar_can.h
+
+diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
+index ac67afa..714b187 100644
+--- a/drivers/net/can/Kconfig
++++ b/drivers/net/can/Kconfig
+@@ -119,6 +119,16 @@ config CAN_GRCAN
+ endian syntheses of the cores would need some modifications on
+ the hardware level to work.
+
++config CAN_RCAR
++ tristate "Renesas R-Car CAN controller"
++ depends on ARM
++ ---help---
++ Say Y here if you want to use CAN controller found on Renesas R-Car
++ SoCs.
++
++ To compile this driver as a module, choose M here: the module will
++ be called rcar_can.
++
+ source "drivers/net/can/mscan/Kconfig"
+
+ source "drivers/net/can/sja1000/Kconfig"
+diff --git a/drivers/net/can/Makefile b/drivers/net/can/Makefile
+index c420588..90f538c 100644
+--- a/drivers/net/can/Makefile
++++ b/drivers/net/can/Makefile
+@@ -25,5 +25,6 @@ obj-$(CONFIG_CAN_JANZ_ICAN3) += janz-ican3.o
+ obj-$(CONFIG_CAN_FLEXCAN) += flexcan.o
+ obj-$(CONFIG_PCH_CAN) += pch_can.o
+ obj-$(CONFIG_CAN_GRCAN) += grcan.o
++obj-$(CONFIG_CAN_RCAR) += rcar_can.o
+
+ ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG
+diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c
+new file mode 100644
+index 0000000..5268d21
+--- /dev/null
++++ b/drivers/net/can/rcar_can.c
+@@ -0,0 +1,876 @@
++/* Renesas R-Car CAN device driver
++ *
++ * Copyright (C) 2013 Cogent Embedded, Inc. <source@cogentembedded.com>
++ * Copyright (C) 2013 Renesas Solutions Corp.
++ *
++ * 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.
++ */
++
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/types.h>
++#include <linux/interrupt.h>
++#include <linux/errno.h>
++#include <linux/netdevice.h>
++#include <linux/platform_device.h>
++#include <linux/can/led.h>
++#include <linux/can/dev.h>
++#include <linux/clk.h>
++#include <linux/can/platform/rcar_can.h>
++
++#define RCAR_CAN_DRV_NAME "rcar_can"
++
++/* Mailbox configuration:
++ * mailbox 60 - 63 - Rx FIFO mailboxes
++ * mailbox 56 - 59 - Tx FIFO mailboxes
++ * non-FIFO mailboxes are not used
++ */
++#define RCAR_CAN_N_MBX 64 /* Number of mailboxes in non-FIFO mode */
++#define RCAR_CAN_RX_FIFO_MBX 60 /* Mailbox - window to Rx FIFO */
++#define RCAR_CAN_TX_FIFO_MBX 56 /* Mailbox - window to Tx FIFO */
++#define RCAR_CAN_FIFO_DEPTH 4
++
++/* Mailbox registers structure */
++struct rcar_can_mbox_regs {
++ u32 id; /* IDE and RTR bits, SID and EID */
++ u8 stub; /* Not used */
++ u8 dlc; /* Data Length Code - bits [0..3] */
++ u8 data[8]; /* Data Bytes */
++ u8 tsh; /* Time Stamp Higher Byte */
++ u8 tsl; /* Time Stamp Lower Byte */
++};
++
++struct rcar_can_regs {
++ struct rcar_can_mbox_regs mb[RCAR_CAN_N_MBX]; /* Mailbox registers */
++ u32 mkr_2_9[8]; /* Mask Registers 2-9 */
++ u32 fidcr[2]; /* FIFO Received ID Compare Register */
++ u32 mkivlr1; /* Mask Invalid Register 1 */
++ u32 mier1; /* Mailbox Interrupt Enable Register 1 */
++ u32 mkr_0_1[2]; /* Mask Registers 0-1 */
++ u32 mkivlr0; /* Mask Invalid Register 0*/
++ u32 mier0; /* Mailbox Interrupt Enable Register 0 */
++ u8 pad_440[0x3c0];
++ u8 mctl[64]; /* Message Control Registers */
++ u16 ctlr; /* Control Register */
++ u16 str; /* Status register */
++ u8 bcr[3]; /* Bit Configuration Register */
++ u8 clkr; /* Clock Select Register */
++ u8 rfcr; /* Receive FIFO Control Register */
++ u8 rfpcr; /* Receive FIFO Pointer Control Register */
++ u8 tfcr; /* Transmit FIFO Control Register */
++ u8 tfpcr; /* Transmit FIFO Pointer Control Register */
++ u8 eier; /* Error Interrupt Enable Register */
++ u8 eifr; /* Error Interrupt Factor Judge Register */
++ u8 recr; /* Receive Error Count Register */
++ u8 tecr; /* Transmit Error Count Register */
++ u8 ecsr; /* Error Code Store Register */
++ u8 cssr; /* Channel Search Support Register */
++ u8 mssr; /* Mailbox Search Status Register */
++ u8 msmr; /* Mailbox Search Mode Register */
++ u16 tsr; /* Time Stamp Register */
++ u8 afsr; /* Acceptance Filter Support Register */
++ u8 pad_857;
++ u8 tcr; /* Test Control Register */
++ u8 pad_859[7];
++ u8 ier; /* Interrupt Enable Register */
++ u8 isr; /* Interrupt Status Register */
++ u8 pad_862;
++ u8 mbsmr; /* Mailbox Search Mask Register */
++};
++
++struct rcar_can_priv {
++ struct can_priv can; /* Must be the first member! */
++ struct net_device *ndev;
++ struct napi_struct napi;
++ struct rcar_can_regs __iomem *regs;
++ struct clk *clk;
++ u8 tx_dlc[RCAR_CAN_FIFO_DEPTH];
++ u32 tx_head;
++ u32 tx_tail;
++ u8 clock_select;
++ u8 ier;
++};
++
++static const struct can_bittiming_const rcar_can_bittiming_const = {
++ .name = RCAR_CAN_DRV_NAME,
++ .tseg1_min = 4,
++ .tseg1_max = 16,
++ .tseg2_min = 2,
++ .tseg2_max = 8,
++ .sjw_max = 4,
++ .brp_min = 1,
++ .brp_max = 1024,
++ .brp_inc = 1,
++};
++
++/* Control Register bits */
++#define RCAR_CAN_CTLR_BOM (3 << 11) /* Bus-Off Recovery Mode Bits */
++#define RCAR_CAN_CTLR_BOM_ENT (1 << 11) /* Entry to halt mode */
++ /* at bus-off entry */
++#define RCAR_CAN_CTLR_SLPM (1 << 10)
++#define RCAR_CAN_CTLR_CANM (3 << 8) /* Operating Mode Select Bit */
++#define RCAR_CAN_CTLR_CANM_HALT (1 << 9)
++#define RCAR_CAN_CTLR_CANM_RESET (1 << 8)
++#define RCAR_CAN_CTLR_CANM_FORCE_RESET (3 << 8)
++#define RCAR_CAN_CTLR_MLM (1 << 3) /* Message Lost Mode Select */
++#define RCAR_CAN_CTLR_IDFM (3 << 1) /* ID Format Mode Select Bits */
++#define RCAR_CAN_CTLR_IDFM_MIXED (1 << 2) /* Mixed ID mode */
++#define RCAR_CAN_CTLR_MBM (1 << 0) /* Mailbox Mode select */
++
++/* Status Register bits */
++#define RCAR_CAN_STR_RSTST (1 << 8) /* Reset Status Bit */
++
++/* FIFO Received ID Compare Registers 0 and 1 bits */
++#define RCAR_CAN_FIDCR_IDE (1 << 31) /* ID Extension Bit */
++#define RCAR_CAN_FIDCR_RTR (1 << 30) /* Remote Transmission Request Bit */
++
++/* Receive FIFO Control Register bits */
++#define RCAR_CAN_RFCR_RFEST (1 << 7) /* Receive FIFO Empty Status Flag */
++#define RCAR_CAN_RFCR_RFE (1 << 0) /* Receive FIFO Enable */
++
++/* Transmit FIFO Control Register bits */
++#define RCAR_CAN_TFCR_TFUST (7 << 1) /* Transmit FIFO Unsent Message */
++ /* Number Status Bits */
++#define RCAR_CAN_TFCR_TFUST_SHIFT 1 /* Offset of Transmit FIFO Unsent */
++ /* Message Number Status Bits */
++#define RCAR_CAN_TFCR_TFE (1 << 0) /* Transmit FIFO Enable */
++
++#define RCAR_CAN_N_RX_MKREGS1 2 /* Number of mask registers */
++ /* for Rx mailboxes 0-31 */
++#define RCAR_CAN_N_RX_MKREGS2 8
++
++/* Bit Configuration Register settings */
++#define RCAR_CAN_BCR_TSEG1(x) (((x) & 0x0f) << 20)
++#define RCAR_CAN_BCR_BPR(x) (((x) & 0x3ff) << 8)
++#define RCAR_CAN_BCR_SJW(x) (((x) & 0x3) << 4)
++#define RCAR_CAN_BCR_TSEG2(x) ((x) & 0x07)
++
++/* Mailbox and Mask Registers bits */
++#define RCAR_CAN_IDE (1 << 31)
++#define RCAR_CAN_RTR (1 << 30)
++#define RCAR_CAN_SID_SHIFT 18
++
++/* Mailbox Interrupt Enable Register 1 bits */
++#define RCAR_CAN_MIER1_RXFIE (1 << 28) /* Receive FIFO Interrupt Enable */
++#define RCAR_CAN_MIER1_TXFIE (1 << 24) /* Transmit FIFO Interrupt Enable */
++
++/* Interrupt Enable Register bits */
++#define RCAR_CAN_IER_ERSIE (1 << 5) /* Error (ERS) Interrupt Enable Bit */
++#define RCAR_CAN_IER_RXFIE (1 << 4) /* Reception FIFO Interrupt */
++ /* Enable Bit */
++#define RCAR_CAN_IER_TXFIE (1 << 3) /* Transmission FIFO Interrupt */
++ /* Enable Bit */
++/* Interrupt Status Register bits */
++#define RCAR_CAN_ISR_ERSF (1 << 5) /* Error (ERS) Interrupt Status Bit */
++#define RCAR_CAN_ISR_RXFF (1 << 4) /* Reception FIFO Interrupt */
++ /* Status Bit */
++#define RCAR_CAN_ISR_TXFF (1 << 3) /* Transmission FIFO Interrupt */
++ /* Status Bit */
++
++/* Error Interrupt Enable Register bits */
++#define RCAR_CAN_EIER_BLIE (1 << 7) /* Bus Lock Interrupt Enable */
++#define RCAR_CAN_EIER_OLIE (1 << 6) /* Overload Frame Transmit */
++ /* Interrupt Enable */
++#define RCAR_CAN_EIER_ORIE (1 << 5) /* Receive Overrun Interrupt Enable */
++#define RCAR_CAN_EIER_BORIE (1 << 4) /* Bus-Off Recovery Interrupt Enable */
++#define RCAR_CAN_EIER_BOEIE (1 << 3) /* Bus-Off Entry Interrupt Enable */
++#define RCAR_CAN_EIER_EPIE (1 << 2) /* Error Passive Interrupt Enable */
++#define RCAR_CAN_EIER_EWIE (1 << 1) /* Error Warning Interrupt Enable */
++#define RCAR_CAN_EIER_BEIE (1 << 0) /* Bus Error Interrupt Enable */
++
++/* Error Interrupt Factor Judge Register bits */
++#define RCAR_CAN_EIFR_BLIF (1 << 7) /* Bus Lock Detect Flag */
++#define RCAR_CAN_EIFR_OLIF (1 << 6) /* Overload Frame Transmission */
++ /* Detect Flag */
++#define RCAR_CAN_EIFR_ORIF (1 << 5) /* Receive Overrun Detect Flag */
++#define RCAR_CAN_EIFR_BORIF (1 << 4) /* Bus-Off Recovery Detect Flag */
++#define RCAR_CAN_EIFR_BOEIF (1 << 3) /* Bus-Off Entry Detect Flag */
++#define RCAR_CAN_EIFR_EPIF (1 << 2) /* Error Passive Detect Flag */
++#define RCAR_CAN_EIFR_EWIF (1 << 1) /* Error Warning Detect Flag */
++#define RCAR_CAN_EIFR_BEIF (1 << 0) /* Bus Error Detect Flag */
++
++/* Error Code Store Register bits */
++#define RCAR_CAN_ECSR_EDPM (1 << 7) /* Error Display Mode Select Bit */
++#define RCAR_CAN_ECSR_ADEF (1 << 6) /* ACK Delimiter Error Flag */
++#define RCAR_CAN_ECSR_BE0F (1 << 5) /* Bit Error (dominant) Flag */
++#define RCAR_CAN_ECSR_BE1F (1 << 4) /* Bit Error (recessive) Flag */
++#define RCAR_CAN_ECSR_CEF (1 << 3) /* CRC Error Flag */
++#define RCAR_CAN_ECSR_AEF (1 << 2) /* ACK Error Flag */
++#define RCAR_CAN_ECSR_FEF (1 << 1) /* Form Error Flag */
++#define RCAR_CAN_ECSR_SEF (1 << 0) /* Stuff Error Flag */
++
++#define RCAR_CAN_NAPI_WEIGHT 4
++#define MAX_STR_READS 0x100
++
++static void tx_failure_cleanup(struct net_device *ndev)
++{
++ int i;
++
++ for (i = 0; i < RCAR_CAN_FIFO_DEPTH; i++)
++ can_free_echo_skb(ndev, i);
++}
++
++static void rcar_can_error(struct net_device *ndev)
++{
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++ struct net_device_stats *stats = &ndev->stats;
++ struct can_frame *cf;
++ struct sk_buff *skb;
++ u8 eifr, txerr = 0, rxerr = 0;
++
++ /* Propagate the error condition to the CAN stack */
++ skb = alloc_can_err_skb(ndev, &cf);
++
++ eifr = readb(&priv->regs->eifr);
++ if (eifr & (RCAR_CAN_EIFR_EWIF | RCAR_CAN_EIFR_EPIF)) {
++ txerr = readb(&priv->regs->tecr);
++ rxerr = readb(&priv->regs->recr);
++ if (skb) {
++ cf->can_id |= CAN_ERR_CRTL;
++ cf->data[6] = txerr;
++ cf->data[7] = rxerr;
++ }
++ }
++ if (eifr & RCAR_CAN_EIFR_BEIF) {
++ int rx_errors = 0, tx_errors = 0;
++ u8 ecsr;
++
++ netdev_dbg(priv->ndev, "Bus error interrupt:\n");
++ if (skb) {
++ cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
++ cf->data[2] = CAN_ERR_PROT_UNSPEC;
++ }
++ ecsr = readb(&priv->regs->ecsr);
++ if (ecsr & RCAR_CAN_ECSR_ADEF) {
++ netdev_dbg(priv->ndev, "ACK Delimiter Error\n");
++ tx_errors++;
++ writeb(~RCAR_CAN_ECSR_ADEF, &priv->regs->ecsr);
++ if (skb)
++ cf->data[3] |= CAN_ERR_PROT_LOC_ACK_DEL;
++ }
++ if (ecsr & RCAR_CAN_ECSR_BE0F) {
++ netdev_dbg(priv->ndev, "Bit Error (dominant)\n");
++ tx_errors++;
++ writeb(~RCAR_CAN_ECSR_BE0F, &priv->regs->ecsr);
++ if (skb)
++ cf->data[2] |= CAN_ERR_PROT_BIT0;
++ }
++ if (ecsr & RCAR_CAN_ECSR_BE1F) {
++ netdev_dbg(priv->ndev, "Bit Error (recessive)\n");
++ tx_errors++;
++ writeb(~RCAR_CAN_ECSR_BE1F, &priv->regs->ecsr);
++ if (skb)
++ cf->data[2] |= CAN_ERR_PROT_BIT1;
++ }
++ if (ecsr & RCAR_CAN_ECSR_CEF) {
++ netdev_dbg(priv->ndev, "CRC Error\n");
++ rx_errors++;
++ writeb(~RCAR_CAN_ECSR_CEF, &priv->regs->ecsr);
++ if (skb)
++ cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;
++ }
++ if (ecsr & RCAR_CAN_ECSR_AEF) {
++ netdev_dbg(priv->ndev, "ACK Error\n");
++ tx_errors++;
++ writeb(~RCAR_CAN_ECSR_AEF, &priv->regs->ecsr);
++ if (skb) {
++ cf->can_id |= CAN_ERR_ACK;
++ cf->data[3] |= CAN_ERR_PROT_LOC_ACK;
++ }
++ }
++ if (ecsr & RCAR_CAN_ECSR_FEF) {
++ netdev_dbg(priv->ndev, "Form Error\n");
++ rx_errors++;
++ writeb(~RCAR_CAN_ECSR_FEF, &priv->regs->ecsr);
++ if (skb)
++ cf->data[2] |= CAN_ERR_PROT_FORM;
++ }
++ if (ecsr & RCAR_CAN_ECSR_SEF) {
++ netdev_dbg(priv->ndev, "Stuff Error\n");
++ rx_errors++;
++ writeb(~RCAR_CAN_ECSR_SEF, &priv->regs->ecsr);
++ if (skb)
++ cf->data[2] |= CAN_ERR_PROT_STUFF;
++ }
++
++ priv->can.can_stats.bus_error++;
++ ndev->stats.rx_errors += rx_errors;
++ ndev->stats.tx_errors += tx_errors;
++ writeb(~RCAR_CAN_EIFR_BEIF, &priv->regs->eifr);
++ }
++ if (eifr & RCAR_CAN_EIFR_EWIF) {
++ netdev_dbg(priv->ndev, "Error warning interrupt\n");
++ priv->can.state = CAN_STATE_ERROR_WARNING;
++ priv->can.can_stats.error_warning++;
++ /* Clear interrupt condition */
++ writeb(~RCAR_CAN_EIFR_EWIF, &priv->regs->eifr);
++ if (skb)
++ cf->data[1] = txerr > rxerr ? CAN_ERR_CRTL_TX_WARNING :
++ CAN_ERR_CRTL_RX_WARNING;
++ }
++ if (eifr & RCAR_CAN_EIFR_EPIF) {
++ netdev_dbg(priv->ndev, "Error passive interrupt\n");
++ priv->can.state = CAN_STATE_ERROR_PASSIVE;
++ priv->can.can_stats.error_passive++;
++ /* Clear interrupt condition */
++ writeb(~RCAR_CAN_EIFR_EPIF, &priv->regs->eifr);
++ if (skb)
++ cf->data[1] = txerr > rxerr ? CAN_ERR_CRTL_TX_PASSIVE :
++ CAN_ERR_CRTL_RX_PASSIVE;
++ }
++ if (eifr & RCAR_CAN_EIFR_BOEIF) {
++ netdev_dbg(priv->ndev, "Bus-off entry interrupt\n");
++ tx_failure_cleanup(ndev);
++ priv->ier = RCAR_CAN_IER_ERSIE;
++ writeb(priv->ier, &priv->regs->ier);
++ priv->can.state = CAN_STATE_BUS_OFF;
++ /* Clear interrupt condition */
++ writeb(~RCAR_CAN_EIFR_BOEIF, &priv->regs->eifr);
++ can_bus_off(ndev);
++ if (skb)
++ cf->can_id |= CAN_ERR_BUSOFF;
++ }
++ if (eifr & RCAR_CAN_EIFR_ORIF) {
++ netdev_dbg(priv->ndev, "Receive overrun error interrupt\n");
++ ndev->stats.rx_over_errors++;
++ ndev->stats.rx_errors++;
++ writeb(~RCAR_CAN_EIFR_ORIF, &priv->regs->eifr);
++ if (skb) {
++ cf->can_id |= CAN_ERR_CRTL;
++ cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
++ }
++ }
++ if (eifr & RCAR_CAN_EIFR_OLIF) {
++ netdev_dbg(priv->ndev,
++ "Overload Frame Transmission error interrupt\n");
++ ndev->stats.rx_over_errors++;
++ ndev->stats.rx_errors++;
++ writeb(~RCAR_CAN_EIFR_OLIF, &priv->regs->eifr);
++ if (skb) {
++ cf->can_id |= CAN_ERR_PROT;
++ cf->data[2] |= CAN_ERR_PROT_OVERLOAD;
++ }
++ }
++
++ if (skb) {
++ stats->rx_packets++;
++ stats->rx_bytes += cf->can_dlc;
++ netif_rx(skb);
++ }
++}
++
++static void rcar_can_tx_done(struct net_device *ndev)
++{
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++ struct net_device_stats *stats = &ndev->stats;
++ u8 isr;
++
++ while (1) {
++ u8 unsent = readb(&priv->regs->tfcr);
++
++ unsent = (unsent & RCAR_CAN_TFCR_TFUST) >>
++ RCAR_CAN_TFCR_TFUST_SHIFT;
++ if (priv->tx_head - priv->tx_tail <= unsent)
++ break;
++ stats->tx_packets++;
++ stats->tx_bytes += priv->tx_dlc[priv->tx_tail %
++ RCAR_CAN_FIFO_DEPTH];
++ priv->tx_dlc[priv->tx_tail % RCAR_CAN_FIFO_DEPTH] = 0;
++ can_get_echo_skb(ndev, priv->tx_tail % RCAR_CAN_FIFO_DEPTH);
++ priv->tx_tail++;
++ netif_wake_queue(ndev);
++ }
++ /* Clear interrupt */
++ isr = readb(&priv->regs->isr);
++ writeb(isr & ~RCAR_CAN_ISR_TXFF, &priv->regs->isr);
++ can_led_event(ndev, CAN_LED_EVENT_TX);
++}
++
++static irqreturn_t rcar_can_interrupt(int irq, void *dev_id)
++{
++ struct net_device *ndev = dev_id;
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++ u8 isr;
++
++ isr = readb(&priv->regs->isr);
++ if (!(isr & priv->ier))
++ return IRQ_NONE;
++
++ if (isr & RCAR_CAN_ISR_ERSF)
++ rcar_can_error(ndev);
++
++ if (isr & RCAR_CAN_ISR_TXFF)
++ rcar_can_tx_done(ndev);
++
++ if (isr & RCAR_CAN_ISR_RXFF) {
++ if (napi_schedule_prep(&priv->napi)) {
++ /* Disable Rx FIFO interrupts */
++ priv->ier &= ~RCAR_CAN_IER_RXFIE;
++ writeb(priv->ier, &priv->regs->ier);
++ __napi_schedule(&priv->napi);
++ }
++ }
++
++ return IRQ_HANDLED;
++}
++
++static void rcar_can_set_bittiming(struct net_device *dev)
++{
++ struct rcar_can_priv *priv = netdev_priv(dev);
++ struct can_bittiming *bt = &priv->can.bittiming;
++ u32 bcr;
++
++ bcr = RCAR_CAN_BCR_TSEG1(bt->phase_seg1 + bt->prop_seg - 1) |
++ RCAR_CAN_BCR_BPR(bt->brp - 1) | RCAR_CAN_BCR_SJW(bt->sjw - 1) |
++ RCAR_CAN_BCR_TSEG2(bt->phase_seg2 - 1);
++ /* Don't overwrite CLKR with 32-bit BCR access; CLKR has 8-bit access.
++ * All the registers are big-endian but they get byte-swapped on 32-bit
++ * read/write (but not on 8-bit, contrary to the manuals)...
++ */
++ writel((bcr << 8) | priv->clock_select, &priv->regs->bcr);
++}
++
++static void rcar_can_start(struct net_device *ndev)
++{
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++ u16 ctlr;
++ int i;
++
++ /* Set controller to known mode:
++ * - FIFO mailbox mode
++ * - accept all messages
++ * - overrun mode
++ * CAN is in sleep mode after MCU hardware or software reset.
++ */
++ ctlr = readw(&priv->regs->ctlr);
++ ctlr &= ~RCAR_CAN_CTLR_SLPM;
++ writew(ctlr, &priv->regs->ctlr);
++ /* Go to reset mode */
++ ctlr |= RCAR_CAN_CTLR_CANM_FORCE_RESET;
++ writew(ctlr, &priv->regs->ctlr);
++ for (i = 0; i < MAX_STR_READS; i++) {
++ if (readw(&priv->regs->str) & RCAR_CAN_STR_RSTST)
++ break;
++ }
++ rcar_can_set_bittiming(ndev);
++ ctlr |= RCAR_CAN_CTLR_IDFM_MIXED; /* Select mixed ID mode */
++ ctlr |= RCAR_CAN_CTLR_BOM_ENT; /* Entry to halt mode automatically */
++ /* at bus-off */
++ ctlr |= RCAR_CAN_CTLR_MBM; /* Select FIFO mailbox mode */
++ ctlr |= RCAR_CAN_CTLR_MLM; /* Overrun mode */
++ writew(ctlr, &priv->regs->ctlr);
++
++ /* Accept all SID and EID */
++ writel(0, &priv->regs->mkr_2_9[6]);
++ writel(0, &priv->regs->mkr_2_9[7]);
++ /* In FIFO mailbox mode, write "0" to bits 24 to 31 */
++ writel(0, &priv->regs->mkivlr1);
++ /* Accept all frames */
++ writel(0, &priv->regs->fidcr[0]);
++ writel(RCAR_CAN_FIDCR_IDE | RCAR_CAN_FIDCR_RTR, &priv->regs->fidcr[1]);
++ /* Enable and configure FIFO mailbox interrupts */
++ writel(RCAR_CAN_MIER1_RXFIE | RCAR_CAN_MIER1_TXFIE, &priv->regs->mier1);
++
++ priv->ier = RCAR_CAN_IER_ERSIE | RCAR_CAN_IER_RXFIE |
++ RCAR_CAN_IER_TXFIE;
++ writeb(priv->ier, &priv->regs->ier);
++
++ /* Accumulate error codes */
++ writeb(RCAR_CAN_ECSR_EDPM, &priv->regs->ecsr);
++ /* Enable error interrupts */
++ writeb(RCAR_CAN_EIER_EWIE | RCAR_CAN_EIER_EPIE | RCAR_CAN_EIER_BOEIE |
++ (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING ?
++ RCAR_CAN_EIER_BEIE : 0) | RCAR_CAN_EIER_ORIE |
++ RCAR_CAN_EIER_OLIE, &priv->regs->eier);
++ priv->can.state = CAN_STATE_ERROR_ACTIVE;
++
++ /* Go to operation mode */
++ writew(ctlr & ~RCAR_CAN_CTLR_CANM, &priv->regs->ctlr);
++ for (i = 0; i < MAX_STR_READS; i++) {
++ if (!(readw(&priv->regs->str) & RCAR_CAN_STR_RSTST))
++ break;
++ }
++ /* Enable Rx and Tx FIFO */
++ writeb(RCAR_CAN_RFCR_RFE, &priv->regs->rfcr);
++ writeb(RCAR_CAN_TFCR_TFE, &priv->regs->tfcr);
++}
++
++static int rcar_can_open(struct net_device *ndev)
++{
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++ int err;
++
++ err = clk_prepare_enable(priv->clk);
++ if (err) {
++ netdev_err(ndev, "clk_prepare_enable() failed, error %d\n",
++ err);
++ goto out;
++ }
++ err = open_candev(ndev);
++ if (err) {
++ netdev_err(ndev, "open_candev() failed, error %d\n", err);
++ goto out_clock;
++ }
++ napi_enable(&priv->napi);
++ err = request_irq(ndev->irq, rcar_can_interrupt, 0, ndev->name, ndev);
++ if (err) {
++ netdev_err(ndev, "error requesting interrupt %x\n", ndev->irq);
++ goto out_close;
++ }
++ can_led_event(ndev, CAN_LED_EVENT_OPEN);
++ rcar_can_start(ndev);
++ netif_start_queue(ndev);
++ return 0;
++out_close:
++ napi_disable(&priv->napi);
++ close_candev(ndev);
++out_clock:
++ clk_disable_unprepare(priv->clk);
++out:
++ return err;
++}
++
++static void rcar_can_stop(struct net_device *ndev)
++{
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++ u16 ctlr;
++ int i;
++
++ /* Go to (force) reset mode */
++ ctlr = readw(&priv->regs->ctlr);
++ ctlr |= RCAR_CAN_CTLR_CANM_FORCE_RESET;
++ writew(ctlr, &priv->regs->ctlr);
++ for (i = 0; i < MAX_STR_READS; i++) {
++ if (readw(&priv->regs->str) & RCAR_CAN_STR_RSTST)
++ break;
++ }
++ writel(0, &priv->regs->mier0);
++ writel(0, &priv->regs->mier1);
++ writeb(0, &priv->regs->ier);
++ writeb(0, &priv->regs->eier);
++ /* Go to sleep mode */
++ ctlr |= RCAR_CAN_CTLR_SLPM;
++ writew(ctlr, &priv->regs->ctlr);
++ priv->can.state = CAN_STATE_STOPPED;
++}
++
++static int rcar_can_close(struct net_device *ndev)
++{
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++
++ netif_stop_queue(ndev);
++ rcar_can_stop(ndev);
++ free_irq(ndev->irq, ndev);
++ napi_disable(&priv->napi);
++ clk_disable_unprepare(priv->clk);
++ close_candev(ndev);
++ can_led_event(ndev, CAN_LED_EVENT_STOP);
++ return 0;
++}
++
++static netdev_tx_t rcar_can_start_xmit(struct sk_buff *skb,
++ struct net_device *ndev)
++{
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++ struct can_frame *cf = (struct can_frame *)skb->data;
++ u32 data, i;
++
++ if (can_dropped_invalid_skb(ndev, skb))
++ return NETDEV_TX_OK;
++
++ if (cf->can_id & CAN_EFF_FLAG) /* Extended frame format */
++ data = (cf->can_id & CAN_EFF_MASK) | RCAR_CAN_IDE;
++ else /* Standard frame format */
++ data = (cf->can_id & CAN_SFF_MASK) << RCAR_CAN_SID_SHIFT;
++
++ if (cf->can_id & CAN_RTR_FLAG) { /* Remote transmission request */
++ data |= RCAR_CAN_RTR;
++ } else {
++ for (i = 0; i < cf->can_dlc; i++)
++ writeb(cf->data[i],
++ &priv->regs->mb[RCAR_CAN_TX_FIFO_MBX].data[i]);
++ }
++
++ writel(data, &priv->regs->mb[RCAR_CAN_TX_FIFO_MBX].id);
++
++ writeb(cf->can_dlc, &priv->regs->mb[RCAR_CAN_TX_FIFO_MBX].dlc);
++
++ priv->tx_dlc[priv->tx_head % RCAR_CAN_FIFO_DEPTH] = cf->can_dlc;
++ can_put_echo_skb(skb, ndev, priv->tx_head % RCAR_CAN_FIFO_DEPTH);
++ priv->tx_head++;
++ /* Start Tx: write 0xff to the TFPCR register to increment
++ * the CPU-side pointer for the transmit FIFO to the next
++ * mailbox location
++ */
++ writeb(0xff, &priv->regs->tfpcr);
++ /* Stop the queue if we've filled all FIFO entries */
++ if (priv->tx_head - priv->tx_tail >= RCAR_CAN_FIFO_DEPTH)
++ netif_stop_queue(ndev);
++
++ return NETDEV_TX_OK;
++}
++
++static const struct net_device_ops rcar_can_netdev_ops = {
++ .ndo_open = rcar_can_open,
++ .ndo_stop = rcar_can_close,
++ .ndo_start_xmit = rcar_can_start_xmit,
++};
++
++static void rcar_can_rx_pkt(struct rcar_can_priv *priv)
++{
++ struct net_device_stats *stats = &priv->ndev->stats;
++ struct can_frame *cf;
++ struct sk_buff *skb;
++ u32 data;
++ u8 dlc;
++
++ skb = alloc_can_skb(priv->ndev, &cf);
++ if (!skb) {
++ stats->rx_dropped++;
++ return;
++ }
++
++ data = readl(&priv->regs->mb[RCAR_CAN_RX_FIFO_MBX].id);
++ if (data & RCAR_CAN_IDE)
++ cf->can_id = (data & CAN_EFF_MASK) | CAN_EFF_FLAG;
++ else
++ cf->can_id = (data >> RCAR_CAN_SID_SHIFT) & CAN_SFF_MASK;
++
++ dlc = readb(&priv->regs->mb[RCAR_CAN_RX_FIFO_MBX].dlc);
++ cf->can_dlc = get_can_dlc(dlc);
++ if (data & RCAR_CAN_RTR) {
++ cf->can_id |= CAN_RTR_FLAG;
++ } else {
++ for (dlc = 0; dlc < cf->can_dlc; dlc++)
++ cf->data[dlc] =
++ readb(&priv->regs->mb[RCAR_CAN_RX_FIFO_MBX].data[dlc]);
++ }
++
++ can_led_event(priv->ndev, CAN_LED_EVENT_RX);
++
++ stats->rx_bytes += cf->can_dlc;
++ stats->rx_packets++;
++ netif_receive_skb(skb);
++}
++
++static int rcar_can_rx_poll(struct napi_struct *napi, int quota)
++{
++ struct rcar_can_priv *priv = container_of(napi,
++ struct rcar_can_priv, napi);
++ int num_pkts;
++
++ for (num_pkts = 0; num_pkts < quota; num_pkts++) {
++ u8 rfcr, isr;
++
++ isr = readb(&priv->regs->isr);
++ /* Clear interrupt bit */
++ if (isr & RCAR_CAN_ISR_RXFF)
++ writeb(isr & ~RCAR_CAN_ISR_RXFF, &priv->regs->isr);
++ rfcr = readb(&priv->regs->rfcr);
++ if (rfcr & RCAR_CAN_RFCR_RFEST)
++ break;
++ rcar_can_rx_pkt(priv);
++ /* Write 0xff to the RFPCR register to increment
++ * the CPU-side pointer for the receive FIFO
++ * to the next mailbox location
++ */
++ writeb(0xff, &priv->regs->rfpcr);
++ }
++ /* All packets processed */
++ if (num_pkts < quota) {
++ napi_complete(napi);
++ priv->ier |= RCAR_CAN_IER_RXFIE;
++ writeb(priv->ier, &priv->regs->ier);
++ }
++ return num_pkts;
++}
++
++static int rcar_can_do_set_mode(struct net_device *ndev, enum can_mode mode)
++{
++ switch (mode) {
++ case CAN_MODE_START:
++ rcar_can_start(ndev);
++ netif_wake_queue(ndev);
++ return 0;
++ default:
++ return -EOPNOTSUPP;
++ }
++}
++
++static int rcar_can_get_berr_counter(const struct net_device *dev,
++ struct can_berr_counter *bec)
++{
++ struct rcar_can_priv *priv = netdev_priv(dev);
++ int err;
++
++ err = clk_prepare_enable(priv->clk);
++ if (err)
++ return err;
++ bec->txerr = readb(&priv->regs->tecr);
++ bec->rxerr = readb(&priv->regs->recr);
++ clk_disable_unprepare(priv->clk);
++ return 0;
++}
++
++static int rcar_can_probe(struct platform_device *pdev)
++{
++ struct rcar_can_platform_data *pdata;
++ struct rcar_can_priv *priv;
++ struct net_device *ndev;
++ struct resource *mem;
++ void __iomem *addr;
++ int err = -ENODEV;
++ int irq;
++
++ pdata = dev_get_platdata(&pdev->dev);
++ if (!pdata) {
++ dev_err(&pdev->dev, "No platform data provided!\n");
++ goto fail;
++ }
++
++ irq = platform_get_irq(pdev, 0);
++ if (!irq) {
++ dev_err(&pdev->dev, "No IRQ resource\n");
++ goto fail;
++ }
++
++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++ addr = devm_ioremap_resource(&pdev->dev, mem);
++ if (IS_ERR(addr)) {
++ err = PTR_ERR(addr);
++ goto fail;
++ }
++
++ ndev = alloc_candev(sizeof(struct rcar_can_priv), RCAR_CAN_FIFO_DEPTH);
++ if (!ndev) {
++ dev_err(&pdev->dev, "alloc_candev() failed\n");
++ err = -ENOMEM;
++ goto fail;
++ }
++
++ priv = netdev_priv(ndev);
++
++ priv->clk = devm_clk_get(&pdev->dev, NULL);
++ if (IS_ERR(priv->clk)) {
++ err = PTR_ERR(priv->clk);
++ dev_err(&pdev->dev, "cannot get clock: %d\n", err);
++ goto fail_clk;
++ }
++
++ ndev->netdev_ops = &rcar_can_netdev_ops;
++ ndev->irq = irq;
++ ndev->flags |= IFF_ECHO;
++ priv->ndev = ndev;
++ priv->regs = addr;
++ priv->clock_select = pdata->clock_select;
++ priv->can.clock.freq = clk_get_rate(priv->clk);
++ priv->can.bittiming_const = &rcar_can_bittiming_const;
++ priv->can.do_set_mode = rcar_can_do_set_mode;
++ priv->can.do_get_berr_counter = rcar_can_get_berr_counter;
++ priv->can.ctrlmode_supported = CAN_CTRLMODE_BERR_REPORTING;
++ platform_set_drvdata(pdev, ndev);
++ SET_NETDEV_DEV(ndev, &pdev->dev);
++
++ netif_napi_add(ndev, &priv->napi, rcar_can_rx_poll,
++ RCAR_CAN_NAPI_WEIGHT);
++ err = register_candev(ndev);
++ if (err) {
++ dev_err(&pdev->dev, "register_candev() failed, error %d\n",
++ err);
++ goto fail_candev;
++ }
++
++ devm_can_led_init(ndev);
++
++ dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%u)\n",
++ priv->regs, ndev->irq);
++
++ return 0;
++fail_candev:
++ netif_napi_del(&priv->napi);
++fail_clk:
++ free_candev(ndev);
++fail:
++ return err;
++}
++
++static int rcar_can_remove(struct platform_device *pdev)
++{
++ struct net_device *ndev = platform_get_drvdata(pdev);
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++
++ unregister_candev(ndev);
++ netif_napi_del(&priv->napi);
++ free_candev(ndev);
++ return 0;
++}
++
++static int __maybe_unused rcar_can_suspend(struct device *dev)
++{
++ struct net_device *ndev = dev_get_drvdata(dev);
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++ u16 ctlr;
++
++ if (netif_running(ndev)) {
++ netif_stop_queue(ndev);
++ netif_device_detach(ndev);
++ }
++ ctlr = readw(&priv->regs->ctlr);
++ ctlr |= RCAR_CAN_CTLR_CANM_HALT;
++ writew(ctlr, &priv->regs->ctlr);
++ ctlr |= RCAR_CAN_CTLR_SLPM;
++ writew(ctlr, &priv->regs->ctlr);
++ priv->can.state = CAN_STATE_SLEEPING;
++
++ clk_disable(priv->clk);
++ return 0;
++}
++
++static int __maybe_unused rcar_can_resume(struct device *dev)
++{
++ struct net_device *ndev = dev_get_drvdata(dev);
++ struct rcar_can_priv *priv = netdev_priv(ndev);
++ u16 ctlr;
++ int err;
++
++ err = clk_enable(priv->clk);
++ if (err) {
++ netdev_err(ndev, "clk_enable() failed, error %d\n", err);
++ return err;
++ }
++
++ ctlr = readw(&priv->regs->ctlr);
++ ctlr &= ~RCAR_CAN_CTLR_SLPM;
++ writew(ctlr, &priv->regs->ctlr);
++ ctlr &= ~RCAR_CAN_CTLR_CANM;
++ writew(ctlr, &priv->regs->ctlr);
++ priv->can.state = CAN_STATE_ERROR_ACTIVE;
++
++ if (netif_running(ndev)) {
++ netif_device_attach(ndev);
++ netif_start_queue(ndev);
++ }
++ return 0;
++}
++
++static SIMPLE_DEV_PM_OPS(rcar_can_pm_ops, rcar_can_suspend, rcar_can_resume);
++
++static struct platform_driver rcar_can_driver = {
++ .driver = {
++ .name = RCAR_CAN_DRV_NAME,
++ .owner = THIS_MODULE,
++ .pm = &rcar_can_pm_ops,
++ },
++ .probe = rcar_can_probe,
++ .remove = rcar_can_remove,
++};
++
++module_platform_driver(rcar_can_driver);
++
++MODULE_AUTHOR("Cogent Embedded, Inc.");
++MODULE_LICENSE("GPL");
++MODULE_DESCRIPTION("CAN driver for Renesas R-Car SoC");
++MODULE_ALIAS("platform:" RCAR_CAN_DRV_NAME);
+diff --git a/include/linux/can/platform/rcar_can.h b/include/linux/can/platform/rcar_can.h
+new file mode 100644
+index 0000000..0f4a2f3
+--- /dev/null
++++ b/include/linux/can/platform/rcar_can.h
+@@ -0,0 +1,17 @@
++#ifndef _CAN_PLATFORM_RCAR_CAN_H_
++#define _CAN_PLATFORM_RCAR_CAN_H_
++
++#include <linux/types.h>
++
++/* Clock Select Register settings */
++enum CLKR {
++ CLKR_CLKP1 = 0, /* Peripheral clock (clkp1) */
++ CLKR_CLKP2 = 1, /* Peripheral clock (clkp2) */
++ CLKR_CLKEXT = 3 /* Externally input clock */
++};
++
++struct rcar_can_platform_data {
++ enum CLKR clock_select; /* Clock source select */
++};
++
++#endif /* !_CAN_PLATFORM_RCAR_CAN_H_ */
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0013-sh-pfc-r8a7791-add-CAN-pin-groups.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0013-sh-pfc-r8a7791-add-CAN-pin-groups.patch
new file mode 100644
index 0000000..23e74c7
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0013-sh-pfc-r8a7791-add-CAN-pin-groups.patch
@@ -0,0 +1,216 @@
+From 0e9386752758b74fd42fda7cbdd6ccb5cb31033c Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Wed, 2 Jul 2014 00:58:16 +0400
+Subject: [PATCH] sh-pfc: r8a7791: add CAN pin groups
+
+Add CAN0/1 data/clock pin groups to R8A7791 PFC driver.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+---
+ drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 167 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 167 insertions(+)
+
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+index 394b234..576d41b 100644
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+@@ -1726,6 +1726,133 @@ static const unsigned int audio_clkout_mux[] = {
+ AUDIO_CLKOUT_MARK,
+ };
+
++/* - CAN -------------------------------------------------------------------- */
++
++static const unsigned int can0_data_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(3, 26), RCAR_GP_PIN(3, 29),
++};
++
++static const unsigned int can0_data_mux[] = {
++ CAN0_TX_MARK, CAN0_RX_MARK,
++};
++
++static const unsigned int can0_data_b_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(7, 4), RCAR_GP_PIN(7, 3),
++};
++
++static const unsigned int can0_data_b_mux[] = {
++ CAN0_TX_B_MARK, CAN0_RX_B_MARK,
++};
++
++static const unsigned int can0_data_c_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(5, 17), RCAR_GP_PIN(5, 18),
++};
++
++static const unsigned int can0_data_c_mux[] = {
++ CAN0_TX_C_MARK, CAN0_RX_C_MARK,
++};
++
++static const unsigned int can0_data_d_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(2, 26), RCAR_GP_PIN(2, 27),
++};
++
++static const unsigned int can0_data_d_mux[] = {
++ CAN0_TX_D_MARK, CAN0_RX_D_MARK,
++};
++
++static const unsigned int can0_data_e_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(4, 18), RCAR_GP_PIN(4, 28),
++};
++
++static const unsigned int can0_data_e_mux[] = {
++ CAN0_TX_E_MARK, CAN0_RX_E_MARK,
++};
++
++static const unsigned int can0_data_f_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(6, 7), RCAR_GP_PIN(6, 6),
++};
++
++static const unsigned int can0_data_f_mux[] = {
++ CAN0_TX_F_MARK, CAN0_RX_F_MARK,
++};
++
++static const unsigned int can1_data_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(3, 21), RCAR_GP_PIN(3, 20),
++};
++
++static const unsigned int can1_data_mux[] = {
++ CAN1_TX_MARK, CAN1_RX_MARK,
++};
++
++static const unsigned int can1_data_b_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(7, 8), RCAR_GP_PIN(7, 9),
++};
++
++static const unsigned int can1_data_b_mux[] = {
++ CAN1_TX_B_MARK, CAN1_RX_B_MARK,
++};
++
++static const unsigned int can1_data_c_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(5, 20), RCAR_GP_PIN(5, 19),
++};
++
++static const unsigned int can1_data_c_mux[] = {
++ CAN1_TX_C_MARK, CAN1_RX_C_MARK,
++};
++
++static const unsigned int can1_data_d_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(4, 29), RCAR_GP_PIN(4, 31),
++};
++
++static const unsigned int can1_data_d_mux[] = {
++ CAN1_TX_D_MARK, CAN1_RX_D_MARK,
++};
++
++static const unsigned int can_clk_pins[] = {
++ /* CLK */
++ RCAR_GP_PIN(7, 2),
++};
++
++static const unsigned int can_clk_mux[] = {
++ CAN_CLK_MARK,
++};
++
++static const unsigned int can_clk_b_pins[] = {
++ /* CLK */
++ RCAR_GP_PIN(5, 21),
++};
++
++static const unsigned int can_clk_b_mux[] = {
++ CAN_CLK_B_MARK,
++};
++
++static const unsigned int can_clk_c_pins[] = {
++ /* CLK */
++ RCAR_GP_PIN(4, 30),
++};
++
++static const unsigned int can_clk_c_mux[] = {
++ CAN_CLK_C_MARK,
++};
++
++static const unsigned int can_clk_d_pins[] = {
++ /* CLK */
++ RCAR_GP_PIN(7, 19),
++};
++
++static const unsigned int can_clk_d_mux[] = {
++ CAN_CLK_D_MARK,
++};
+
+ /* - DU --------------------------------------------------------------------- */
+ static const unsigned int du_rgb666_pins[] = {
+@@ -4055,6 +4182,20 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
+ SH_PFC_PIN_GROUP(audio_clk_b_b),
+ SH_PFC_PIN_GROUP(audio_clk_c),
+ SH_PFC_PIN_GROUP(audio_clkout),
++ SH_PFC_PIN_GROUP(can0_data),
++ SH_PFC_PIN_GROUP(can0_data_b),
++ SH_PFC_PIN_GROUP(can0_data_c),
++ SH_PFC_PIN_GROUP(can0_data_d),
++ SH_PFC_PIN_GROUP(can0_data_e),
++ SH_PFC_PIN_GROUP(can0_data_f),
++ SH_PFC_PIN_GROUP(can1_data),
++ SH_PFC_PIN_GROUP(can1_data_b),
++ SH_PFC_PIN_GROUP(can1_data_c),
++ SH_PFC_PIN_GROUP(can1_data_d),
++ SH_PFC_PIN_GROUP(can_clk),
++ SH_PFC_PIN_GROUP(can_clk_b),
++ SH_PFC_PIN_GROUP(can_clk_c),
++ SH_PFC_PIN_GROUP(can_clk_d),
+ SH_PFC_PIN_GROUP(du_rgb666),
+ SH_PFC_PIN_GROUP(du_rgb888),
+ SH_PFC_PIN_GROUP(du_clk_out_0),
+@@ -4367,6 +4508,30 @@ static const char * const audio_clk_groups[] = {
+ "audio_clkout",
+ };
+
++static const char * const can0_groups[] = {
++ "can0_data_a",
++ "can0_data_b",
++ "can0_data_c",
++ "can0_data_d",
++ "can0_data_e",
++ "can0_data_f",
++ "can_clk_a",
++ "can_clk_b",
++ "can_clk_c",
++ "can_clk_d",
++};
++
++static const char * const can1_groups[] = {
++ "can1_data_a",
++ "can1_data_b",
++ "can1_data_c",
++ "can1_data_d",
++ "can_clk_a",
++ "can_clk_b",
++ "can_clk_c",
++ "can_clk_d",
++};
++
+ static const char * const du_groups[] = {
+ "du_rgb666",
+ "du_rgb888",
+@@ -4790,6 +4955,8 @@ static const char * const vin2_groups[] = {
+
+ static const struct sh_pfc_function pinmux_functions[] = {
+ SH_PFC_FUNCTION(audio_clk),
++ SH_PFC_FUNCTION(can0),
++ SH_PFC_FUNCTION(can1),
+ SH_PFC_FUNCTION(du),
+ SH_PFC_FUNCTION(du0),
+ SH_PFC_FUNCTION(du1),
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0014-sh-pfc-r8a7791-fix-CAN-pin-groups.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0014-sh-pfc-r8a7791-fix-CAN-pin-groups.patch
new file mode 100644
index 0000000..65b0fcd
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0014-sh-pfc-r8a7791-fix-CAN-pin-groups.patch
@@ -0,0 +1,52 @@
+From 302fb1781783ded370f515e8e649b8285ee29cdc Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Tue, 29 Jul 2014 02:12:55 +0400
+Subject: [PATCH] sh-pfc: r8a7791: fix CAN pin groups
+
+I had made last-minute changes before submitting the patch "sh-pfc: r8a7791:
+add CAN pin groups"; now I'm seeing that they weren't complete: I had missed
+update to the pin group names in pin[01]_groups[]. Drop the "_a" suffixes there.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+---
+ drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+index 576d41b..c6e5deb 100644
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+@@ -4509,24 +4509,24 @@ static const char * const audio_clk_groups[] = {
+ };
+
+ static const char * const can0_groups[] = {
+- "can0_data_a",
++ "can0_data",
+ "can0_data_b",
+ "can0_data_c",
+ "can0_data_d",
+ "can0_data_e",
+ "can0_data_f",
+- "can_clk_a",
++ "can_clk",
+ "can_clk_b",
+ "can_clk_c",
+ "can_clk_d",
+ };
+
+ static const char * const can1_groups[] = {
+- "can1_data_a",
++ "can1_data",
+ "can1_data_b",
+ "can1_data_c",
+ "can1_data_d",
+- "can_clk_a",
++ "can_clk",
+ "can_clk_b",
+ "can_clk_c",
+ "can_clk_d",
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0015-can-rcar_can-support-all-input-clocks.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0015-can-rcar_can-support-all-input-clocks.patch
new file mode 100644
index 0000000..65f33af
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0015-can-rcar_can-support-all-input-clocks.patch
@@ -0,0 +1,139 @@
+From 862e2b6af9413b43ef044979b934cab07bfd33e5 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Fri, 1 Aug 2014 01:23:32 +0400
+Subject: [PATCH] can: rcar_can: support all input clocks
+
+When writing the driver, I didn't give enough attention to the possible sources
+of the CAN clock: although the value of the CLKR register was specified by the
+platform data, the driver only handled one case, that is CAN clock being
+sourced from the clkp1 clock, the same that clocks the whole CAN module. In
+order to fix that overlook, we'll have to handle the CAN clock separately from
+the peripheral clock (however, clkp1 will be specified for a CAN device only
+once)...
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ drivers/net/can/rcar_can.c | 42 ++++++++++++++++++++++++++++++++++++------
+ 1 file changed, 36 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c
+index 5268d21..c02fcf3 100644
+--- a/drivers/net/can/rcar_can.c
++++ b/drivers/net/can/rcar_can.c
+@@ -87,6 +87,7 @@ struct rcar_can_priv {
+ struct napi_struct napi;
+ struct rcar_can_regs __iomem *regs;
+ struct clk *clk;
++ struct clk *can_clk;
+ u8 tx_dlc[RCAR_CAN_FIFO_DEPTH];
+ u32 tx_head;
+ u32 tx_tail;
+@@ -505,14 +506,20 @@ static int rcar_can_open(struct net_device *ndev)
+
+ err = clk_prepare_enable(priv->clk);
+ if (err) {
+- netdev_err(ndev, "clk_prepare_enable() failed, error %d\n",
++ netdev_err(ndev, "failed to enable periperal clock, error %d\n",
+ err);
+ goto out;
+ }
++ err = clk_prepare_enable(priv->can_clk);
++ if (err) {
++ netdev_err(ndev, "failed to enable CAN clock, error %d\n",
++ err);
++ goto out_clock;
++ }
+ err = open_candev(ndev);
+ if (err) {
+ netdev_err(ndev, "open_candev() failed, error %d\n", err);
+- goto out_clock;
++ goto out_can_clock;
+ }
+ napi_enable(&priv->napi);
+ err = request_irq(ndev->irq, rcar_can_interrupt, 0, ndev->name, ndev);
+@@ -527,6 +534,8 @@ static int rcar_can_open(struct net_device *ndev)
+ out_close:
+ napi_disable(&priv->napi);
+ close_candev(ndev);
++out_can_clock:
++ clk_disable_unprepare(priv->can_clk);
+ out_clock:
+ clk_disable_unprepare(priv->clk);
+ out:
+@@ -565,6 +574,7 @@ static int rcar_can_close(struct net_device *ndev)
+ rcar_can_stop(ndev);
+ free_irq(ndev->irq, ndev);
+ napi_disable(&priv->napi);
++ clk_disable_unprepare(priv->can_clk);
+ clk_disable_unprepare(priv->clk);
+ close_candev(ndev);
+ can_led_event(ndev, CAN_LED_EVENT_STOP);
+@@ -715,6 +725,12 @@ static int rcar_can_get_berr_counter(const struct net_device *dev,
+ return 0;
+ }
+
++static const char * const clock_names[] = {
++ [CLKR_CLKP1] = "clkp1",
++ [CLKR_CLKP2] = "clkp2",
++ [CLKR_CLKEXT] = "can_clk",
++};
++
+ static int rcar_can_probe(struct platform_device *pdev)
+ {
+ struct rcar_can_platform_data *pdata;
+@@ -722,6 +738,7 @@ static int rcar_can_probe(struct platform_device *pdev)
+ struct net_device *ndev;
+ struct resource *mem;
+ void __iomem *addr;
++ u32 clock_select;
+ int err = -ENODEV;
+ int irq;
+
+@@ -730,6 +747,7 @@ static int rcar_can_probe(struct platform_device *pdev)
+ dev_err(&pdev->dev, "No platform data provided!\n");
+ goto fail;
+ }
++ clock_select = pdata->clock_select;
+
+ irq = platform_get_irq(pdev, 0);
+ if (!irq) {
+@@ -753,10 +771,22 @@ static int rcar_can_probe(struct platform_device *pdev)
+
+ priv = netdev_priv(ndev);
+
+- priv->clk = devm_clk_get(&pdev->dev, NULL);
++ priv->clk = devm_clk_get(&pdev->dev, "clkp1");
+ if (IS_ERR(priv->clk)) {
+ err = PTR_ERR(priv->clk);
+- dev_err(&pdev->dev, "cannot get clock: %d\n", err);
++ dev_err(&pdev->dev, "cannot get peripheral clock: %d\n", err);
++ goto fail_clk;
++ }
++
++ if (clock_select >= ARRAY_SIZE(clock_names)) {
++ err = -EINVAL;
++ dev_err(&pdev->dev, "invalid CAN clock selected\n");
++ goto fail_clk;
++ }
++ priv->can_clk = devm_clk_get(&pdev->dev, clock_names[clock_select]);
++ if (IS_ERR(priv->can_clk)) {
++ err = PTR_ERR(priv->can_clk);
++ dev_err(&pdev->dev, "cannot get CAN clock: %d\n", err);
+ goto fail_clk;
+ }
+
+@@ -765,8 +795,8 @@ static int rcar_can_probe(struct platform_device *pdev)
+ ndev->flags |= IFF_ECHO;
+ priv->ndev = ndev;
+ priv->regs = addr;
+- priv->clock_select = pdata->clock_select;
+- priv->can.clock.freq = clk_get_rate(priv->clk);
++ priv->clock_select = clock_select;
++ priv->can.clock.freq = clk_get_rate(priv->can_clk);
+ priv->can.bittiming_const = &rcar_can_bittiming_const;
+ priv->can.do_set_mode = rcar_can_do_set_mode;
+ priv->can.do_get_berr_counter = rcar_can_get_berr_counter;
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0016-can-rcar_can-document-device-tree-bindings.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0016-can-rcar_can-document-device-tree-bindings.patch
new file mode 100644
index 0000000..df8137f
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0016-can-rcar_can-document-device-tree-bindings.patch
@@ -0,0 +1,66 @@
+From 632e25ca722e5361a1b40d89e77808f8f1c6799f Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Fri, 1 Aug 2014 01:24:25 +0400
+Subject: [PATCH] can: rcar_can: document device tree bindings
+
+Document the R-Car CAN device tree bindings.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ .../devicetree/bindings/net/can/rcar_can.txt | 43 ++++++++++++++++++++++
+ 1 file changed, 43 insertions(+)
+ create mode 100644 Documentation/devicetree/bindings/net/can/rcar_can.txt
+
+diff --git a/Documentation/devicetree/bindings/net/can/rcar_can.txt b/Documentation/devicetree/bindings/net/can/rcar_can.txt
+new file mode 100644
+index 0000000..002d844
+--- /dev/null
++++ b/Documentation/devicetree/bindings/net/can/rcar_can.txt
+@@ -0,0 +1,43 @@
++Renesas R-Car CAN controller Device Tree Bindings
++-------------------------------------------------
++
++Required properties:
++- compatible: "renesas,can-r8a7778" if CAN controller is a part of R8A7778 SoC.
++ "renesas,can-r8a7779" if CAN controller is a part of R8A7779 SoC.
++ "renesas,can-r8a7790" if CAN controller is a part of R8A7790 SoC.
++ "renesas,can-r8a7791" if CAN controller is a part of R8A7791 SoC.
++- reg: physical base address and size of the R-Car CAN register map.
++- interrupts: interrupt specifier for the sole interrupt.
++- clocks: phandles and clock specifiers for 3 CAN clock inputs.
++- clock-names: 3 clock input name strings: "clkp1", "clkp2", "can_clk".
++- pinctrl-0: pin control group to be used for this controller.
++- pinctrl-names: must be "default".
++
++Optional properties:
++- renesas,can-clock-select: R-Car CAN Clock Source Select. Valid values are:
++ <0x0> (default) : Peripheral clock (clkp1)
++ <0x1> : Peripheral clock (clkp2)
++ <0x3> : Externally input clock
++
++Example
++-------
++
++SoC common .dtsi file:
++
++ can0: can@e6e80000 {
++ compatible = "renesas,can-r8a7791";
++ reg = <0 0xe6e80000 0 0x1000>;
++ interrupts = <0 186 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp9_clks R8A7791_CLK_RCAN0>,
++ <&cpg_clocks R8A7791_CLK_RCAN>, <&can_clk>;
++ clock-names = "clkp1", "clkp2", "can_clk";
++ status = "disabled";
++ };
++
++Board specific .dts file:
++
++&can0 {
++ pinctrl-0 = <&can0_pins>;
++ pinctrl-names = "default";
++ status = "okay";
++};
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0017-can-rcar_can-add-device-tree-support.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0017-can-rcar_can-add-device-tree-support.patch
new file mode 100644
index 0000000..716bdbc
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0017-can-rcar_can-add-device-tree-support.patch
@@ -0,0 +1,77 @@
+From a268de6c68e4933234e9ac62f2ab7ff8264ce0b4 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Fri, 1 Aug 2014 01:25:53 +0400
+Subject: [PATCH] can: rcar_can: add device tree support
+
+Add support of the device tree probing for the Renesas R-Car CAN controllers.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ drivers/net/can/rcar_can.c | 28 ++++++++++++++++++++++------
+ 1 file changed, 22 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c
+index c02fcf3..1abe133 100644
+--- a/drivers/net/can/rcar_can.c
++++ b/drivers/net/can/rcar_can.c
+@@ -20,6 +20,7 @@
+ #include <linux/can/dev.h>
+ #include <linux/clk.h>
+ #include <linux/can/platform/rcar_can.h>
++#include <linux/of.h>
+
+ #define RCAR_CAN_DRV_NAME "rcar_can"
+
+@@ -738,16 +739,21 @@ static int rcar_can_probe(struct platform_device *pdev)
+ struct net_device *ndev;
+ struct resource *mem;
+ void __iomem *addr;
+- u32 clock_select;
++ u32 clock_select = CLKR_CLKP1;
+ int err = -ENODEV;
+ int irq;
+
+- pdata = dev_get_platdata(&pdev->dev);
+- if (!pdata) {
+- dev_err(&pdev->dev, "No platform data provided!\n");
+- goto fail;
++ if (pdev->dev.of_node) {
++ of_property_read_u32(pdev->dev.of_node,
++ "renesas,can-clock-select", &clock_select);
++ } else {
++ pdata = dev_get_platdata(&pdev->dev);
++ if (!pdata) {
++ dev_err(&pdev->dev, "No platform data provided!\n");
++ goto fail;
++ }
++ clock_select = pdata->clock_select;
+ }
+- clock_select = pdata->clock_select;
+
+ irq = platform_get_irq(pdev, 0);
+ if (!irq) {
+@@ -888,10 +894,20 @@ static int __maybe_unused rcar_can_resume(struct device *dev)
+
+ static SIMPLE_DEV_PM_OPS(rcar_can_pm_ops, rcar_can_suspend, rcar_can_resume);
+
++static const struct of_device_id rcar_can_of_table[] __maybe_unused = {
++ { .compatible = "renesas,can-r8a7778" },
++ { .compatible = "renesas,can-r8a7779" },
++ { .compatible = "renesas,can-r8a7790" },
++ { .compatible = "renesas,can-r8a7791" },
++ { }
++};
++MODULE_DEVICE_TABLE(of, rcar_can_of_table);
++
+ static struct platform_driver rcar_can_driver = {
+ .driver = {
+ .name = RCAR_CAN_DRV_NAME,
+ .owner = THIS_MODULE,
++ .of_match_table = of_match_ptr(rcar_can_of_table),
+ .pm = &rcar_can_pm_ops,
+ },
+ .probe = rcar_can_probe,
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0018-porter-can-support.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0018-porter-can-support.patch
new file mode 100644
index 0000000..e56bda3
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0018-porter-can-support.patch
@@ -0,0 +1,63 @@
+From b73784d861cfff9651936b3d101b1a91ca3550a8 Mon Sep 17 00:00:00 2001
+From: Andrey Dolnikov <andrey.dolnikov@cogentembedded.com>
+Date: Wed, 25 Feb 2015 15:17:46 +0300
+Subject: [PATCH] Porter: Add CAN support.
+
+---
+ arch/arm/boot/dts/r8a7791-porter.dts | 12 ++++++++++++
+ arch/arm/boot/dts/r8a7791.dtsi | 9 +++++++++
+ 2 files changed, 21 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791-porter.dts b/arch/arm/boot/dts/r8a7791-porter.dts
+index 6a0ccde..4fb5cd5 100644
+--- a/arch/arm/boot/dts/r8a7791-porter.dts
++++ b/arch/arm/boot/dts/r8a7791-porter.dts
+@@ -211,6 +211,11 @@
+ renesas,groups = "vin0_data8", "vin0_clk";
+ renesas,function = "vin0";
+ };
++
++ can0_pins: can0 {
++ renesas,groups = "can0_data_b";
++ renesas,function = "can0";
++ };
+ };
+
+ &ether {
+@@ -229,6 +234,13 @@
+ };
+ };
+
++&can0 {
++ pinctrl-0 = <&can0_pins>;
++ pinctrl-names = "default";
++ renesas,can-clock-select = <0x0>;
++ status = "okay";
++};
++
+ &sata0 {
+ status = "okay";
+ };
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index 799d41c..1cad41e 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -533,6 +533,15 @@
+ status = "disabled";
+ };
+
++ can0: can@e6e80000 {
++ compatible = "renesas,can-r8a7791";
++ reg = <0 0xe6e80000 0 0x1000>;
++ interrupts = <0 186 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp9_clks R8A7791_CLK_RCAN0>;
++ clock-names = "clkp1", "clkp2", "can_clk";
++ status = "disabled";
++ };
++
+ sata0: sata@ee300000 {
+ compatible = "renesas,sata-r8a7791";
+ reg = <0 0xee300000 0 0x2000>;
+--
+1.9.1
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0019-i2c-busses-rcar-Workaround-arbitration-loss-error.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0019-i2c-busses-rcar-Workaround-arbitration-loss-error.patch
new file mode 100644
index 0000000..209d1b4
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0019-i2c-busses-rcar-Workaround-arbitration-loss-error.patch
@@ -0,0 +1,31 @@
+From 23fa8d125ca1be9c03ac7d2f42530a57d6ca28f2 Mon Sep 17 00:00:00 2001
+From: Valentine Barshak <valentine.barshak@cogentembedded.com>
+Date: Tue, 3 Mar 2015 18:30:16 +0300
+Subject: [PATCH] i2c: busses: rcar: Workaround arbitration loss error
+
+Sometimes I2C master enable/disable at every transmission
+causes arbitration loss errors making the bus unusable.
+Workaround the issue by enabling I2C master
+in the rcar_i2c_init() function.
+
+Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
+---
+ drivers/i2c/busses/i2c-rcar.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
+index 0e863f3..4334006 100644
+--- a/drivers/i2c/busses/i2c-rcar.c
++++ b/drivers/i2c/busses/i2c-rcar.c
+@@ -161,7 +161,7 @@ static void rcar_i2c_init(struct rcar_i2c_priv *priv)
+
+ /* reset master mode */
+ rcar_i2c_write(priv, ICMIER, 0);
+- rcar_i2c_write(priv, ICMCR, 0);
++ rcar_i2c_write(priv, ICMCR, MDBS | MIE);
+ rcar_i2c_write(priv, ICMSR, 0);
+ rcar_i2c_write(priv, ICMAR, 0);
+ }
+--
+1.9.3
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0020-Silk-Remove-I2C1-clock-from-clk_enables.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0020-Silk-Remove-I2C1-clock-from-clk_enables.patch
new file mode 100644
index 0000000..78a3a5b
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0020-Silk-Remove-I2C1-clock-from-clk_enables.patch
@@ -0,0 +1,30 @@
+From 6c0691906b3bcce0a9629ca00faa6be88a013aaa Mon Sep 17 00:00:00 2001
+From: Valentine Barshak <valentine.barshak@cogentembedded.com>
+Date: Tue, 3 Mar 2015 18:25:15 +0300
+Subject: [PATCH] ARM: shmobile: silk: Remove I2C1 clock from clk_enables
+ array
+
+Remove I2C1 clock from clk_enables array since it is not needed.
+I2C clocks are handled by the OF driver while shmobile_clk_workaround
+is only needed for platform devices.
+
+Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
+---
+ arch/arm/mach-shmobile/board-silk-reference.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/board-silk-reference.c b/arch/arm/mach-shmobile/board-silk-reference.c
+index 090a4df..d4c64fa 100644
+--- a/arch/arm/mach-shmobile/board-silk-reference.c
++++ b/arch/arm/mach-shmobile/board-silk-reference.c
+@@ -271,7 +271,6 @@ static const struct clk_name clk_names[] __initconst = {
+ */
+ static const struct clk_name clk_enables[] __initconst = {
+ { "ether", NULL, "ee700000.ethernet" },
+- { "i2c1", NULL, "e6518000.i2c" },
+ { "mmcif0", NULL, "ee200000.mmc" },
+ { "sdhi0", NULL, "ee100000.sd" },
+ { "sdhi1", NULL, "ee140000.sd" },
+--
+1.9.3
+
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas_3.10.bb b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas_3.10.bb
new file mode 100644
index 0000000..c303492
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas_3.10.bb
@@ -0,0 +1,71 @@
+require linux.inc
+require linux-dtb.inc
+require linux-dtb-append.inc
+
+DESCRIPTION = "Linux kernel for the R-Car Generation 2 based board"
+COMPATIBLE_MACHINE = "(alt|gose|koelsch|lager|porter|silk)"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+PV_append = "+git${SRCREV}"
+
+RENESAS_BACKPORTS_URL="git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas-backport.git"
+SRCREV = "b8ca8c397343f4233f9f68fc3a5bf8e1c9b88251"
+SRC_URI = "${RENESAS_BACKPORTS_URL};protocol=git;branch=bsp/v3.10.31-ltsi/rcar-gen2-1.9.2 \
+ file://0001-arm-lager-Add-vmalloc-384M-to-bootargs-of-DTS.patch \
+ file://0001-arm-koelsch-Add-vmalloc-384M-to-bootargs-of-DTS.patch \
+ file://0001-arm-alt-Add-vmalloc-384M-to-bootargs-of-DTS.patch \
+ file://0001-arm-gose-Add-vmalloc-384M-to-bootargs-of-DTS.patch \
+"
+
+SRC_URI_append_porter = " \
+ file://0001-kernel-Silk-board-support.patch \
+ file://0002-kernel-silk-fix-ethernet-phy-irq.patch \
+ file://0003-kernel-silk-fix-sd-detect.patch \
+ file://0004-kernel-Revert-i2c-rcar-Support-ACK-by-HW-auto-restart-after-NACK.patch \
+ file://0006-Rcar-DU-add-RGB-connector.patch \
+ file://0007-SILK-add-i2c0.patch \
+ file://0008-Porter-board-support.patch \
+ file://0009-shmobile-add-atag-dtb-compat.patch \
+ file://0010-Silk-Add-missing-pins-handle-to-Eth.patch \
+ file://0011-Silk-Add-missing-DU-pins.patch \
+ file://0012-can-add-Renesas-R-Car-CAN-driver.patch \
+ file://0013-sh-pfc-r8a7791-add-CAN-pin-groups.patch \
+ file://0014-sh-pfc-r8a7791-fix-CAN-pin-groups.patch \
+ file://0015-can-rcar_can-support-all-input-clocks.patch \
+ file://0016-can-rcar_can-document-device-tree-bindings.patch \
+ file://0017-can-rcar_can-add-device-tree-support.patch \
+ file://0018-porter-can-support.patch \
+ file://0019-i2c-busses-rcar-Workaround-arbitration-loss-error.patch \
+ file://0020-Silk-Remove-I2C1-clock-from-clk_enables.patch \
+"
+
+SRC_URI_append_silk = " \
+ file://0001-kernel-Silk-board-support.patch \
+ file://0002-kernel-silk-fix-ethernet-phy-irq.patch \
+ file://0003-kernel-silk-fix-sd-detect.patch \
+ file://0004-kernel-Revert-i2c-rcar-Support-ACK-by-HW-auto-restart-after-NACK.patch \
+ file://0006-Rcar-DU-add-RGB-connector.patch \
+ file://0007-SILK-add-i2c0.patch \
+ file://0008-Porter-board-support.patch \
+ file://0009-shmobile-add-atag-dtb-compat.patch \
+ file://0010-Silk-Add-missing-pins-handle-to-Eth.patch \
+ file://0011-Silk-Add-missing-DU-pins.patch \
+ file://0012-can-add-Renesas-R-Car-CAN-driver.patch \
+ file://0013-sh-pfc-r8a7791-add-CAN-pin-groups.patch \
+ file://0014-sh-pfc-r8a7791-fix-CAN-pin-groups.patch \
+ file://0015-can-rcar_can-support-all-input-clocks.patch \
+ file://0016-can-rcar_can-document-device-tree-bindings.patch \
+ file://0017-can-rcar_can-add-device-tree-support.patch \
+ file://0018-porter-can-support.patch \
+ file://0019-i2c-busses-rcar-Workaround-arbitration-loss-error.patch \
+ file://0020-Silk-Remove-I2C1-clock-from-clk_enables.patch \
+"
+
+S = "${WORKDIR}/git"
+
+KERNEL_DEFCONFIG = "shmobile_defconfig"
+
+do_configure_prepend() {
+ install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available."
+}
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux.inc b/meta-rcar-gen2/recipes-kernel/linux/linux.inc
new file mode 100644
index 0000000..a265ee8
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux.inc
@@ -0,0 +1,139 @@
+DESCRIPTION = "Linux Kernel"
+SECTION = "kernel"
+LICENSE = "GPLv2"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
+
+inherit kernel siteinfo
+
+# Enable OABI compat for people stuck with obsolete userspace
+ARM_KEEP_OABI ?= "1"
+
+# Quirk for udev greater or equal 141
+UDEV_GE_141 ?= "1"
+
+# Set the verbosity of kernel messages during runtime
+# You can define CMDLINE_DEBUG in your local.conf or distro.conf to override this behaviour
+CMDLINE_DEBUG ?= '${@base_conditional("DISTRO_TYPE", "release", "quiet", "debug", d)}'
+CMDLINE_append = " ${CMDLINE_DEBUG}"
+
+# Set a variable in .configure
+# $1 - Configure variable to be set
+# $2 - value [n/y/value]
+kernel_configure_variable() {
+ # Remove the config
+ CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;"
+ if test "$2" = "n"
+ then
+ echo "# CONFIG_$1 is not set" >> ${S}/.config
+ else
+ echo "CONFIG_$1=$2" >> ${S}/.config
+ fi
+}
+
+do_configure_prepend() {
+ # Clean .config
+ echo "" > ${S}/.config
+ CONF_SED_SCRIPT=""
+
+ # oabi / eabi support
+ if [ "${TARGET_OS}" = "linux-gnueabi" -o "${TARGET_OS}" = "linux-uclibceabi" ]; then
+ kernel_configure_variable AEABI y
+ if [ "${ARM_KEEP_OABI}" = "1" ] ; then
+ kernel_configure_variable OABI_COMPAT y
+ else
+ kernel_configure_variable OABI_COMPAT n
+ fi
+ else
+ kernel_configure_variable AEABI n
+ kernel_configure_variable OABI_COMPAT n
+ fi
+
+ # Set cmdline
+ kernel_configure_variable CMDLINE "\"${CMDLINE}\""
+
+ # Localversion
+ kernel_configure_variable LOCALVERSION "\"\""
+ kernel_configure_variable LOCALVERSION_AUTO n
+
+ # Udev quirks
+ # Newer versions of udev mandate that sysfs doesn't have deprecated entries
+ if [ "${UDEV_GE_141}" = "1" ] ; then
+ kernel_configure_variable SYSFS_DEPRECATED n
+ kernel_configure_variable SYSFS_DEPRECATED_V2 n
+ kernel_configure_variable HOTPLUG y
+ kernel_configure_variable UEVENT_HELPER_PATH "\"\""
+ kernel_configure_variable UNIX y
+ kernel_configure_variable SYSFS y
+ kernel_configure_variable PROC_FS y
+ kernel_configure_variable TMPFS y
+ kernel_configure_variable INOTIFY_USER y
+ kernel_configure_variable SIGNALFD y
+ kernel_configure_variable TMPFS_POSIX_ACL y
+ kernel_configure_variable BLK_DEV_BSG y
+ kernel_configure_variable DEVTMPFS y
+ kernel_configure_variable DEVTMPFS_MOUNT y
+ fi
+
+ # Newer inits like systemd need cgroup support
+ if [ "${KERNEL_ENABLE_CGROUPS}" = "1" ] ; then
+ kernel_configure_variable CGROUP_SCHED y
+ kernel_configure_variable CGROUPS y
+ kernel_configure_variable CGROUP_NS y
+ kernel_configure_variable CGROUP_FREEZER y
+ kernel_configure_variable CGROUP_DEVICE y
+ kernel_configure_variable CPUSETS y
+ kernel_configure_variable PROC_PID_CPUSET y
+ kernel_configure_variable CGROUP_CPUACCT y
+ kernel_configure_variable RESOURCE_COUNTERS y
+ fi
+
+ # root-over-nfs-over-usb-eth support. Limited, but should cover some cases
+ # Enable this by setting a proper CMDLINE_NFSROOT_USB.
+ if [ ! -z "${CMDLINE_NFSROOT_USB}" ]; then
+ oenote "Configuring the kernel for root-over-nfs-over-usb-eth with CMDLINE ${CMDLINE_NFSROOT_USB}"
+ kernel_configure_variable INET y
+ kernel_configure_variable IP_PNP y
+ kernel_configure_variable USB_GADGET y
+ kernel_configure_variable USB_GADGET_SELECTED y
+ kernel_configure_variable USB_ETH y
+ kernel_configure_variable NFS_FS y
+ kernel_configure_variable ROOT_NFS y
+ kernel_configure_variable ROOT_NFS y
+ kernel_configure_variable CMDLINE "\"${CMDLINE_NFSROOT_USB}\""
+ fi
+
+ # Activate CONFIG_LEGACY_PTYS
+ kernel_configure_variable LEGACY_PTYS y
+
+ # Keep this the last line
+ # Remove all modified configs and add the rest to .config
+ sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${S}/.config'
+
+ yes '' | oe_runmake oldconfig
+}
+
+do_configure_append_porter() {
+ # Enable CAN
+ kernel_configure_variable CAN y
+ kernel_configure_variable CAN_RCAR y
+
+ yes '' | oe_runmake oldconfig
+}
+
+# Automatically depend on lzop-native if CONFIG_KERNEL_LZO is enabled
+python () {
+ try:
+ defconfig = bb.fetch2.localpath('file://defconfig', d)
+ except bb.fetch2.FetchError:
+ return
+
+ try:
+ configfile = open(defconfig)
+ except IOError:
+ return
+
+ if 'CONFIG_KERNEL_LZO=y\n' in configfile.readlines():
+ depends = d.getVar('DEPENDS', False)
+ d.setVar('DEPENDS', depends + ' lzop-native')
+}
diff --git a/meta-rcar-gen2/recipes-kernel/mmngr-module/files/.gitkeep b/meta-rcar-gen2/recipes-kernel/mmngr-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/mmngr-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-kernel/mmngr-module/mmngr-kernel-module.bb b/meta-rcar-gen2/recipes-kernel/mmngr-module/mmngr-kernel-module.bb
new file mode 100644
index 0000000..32c6abd
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/mmngr-module/mmngr-kernel-module.bb
@@ -0,0 +1,83 @@
+require ../../include/rcar-gen2-modules-common.inc
+require ../../include/multimedia-control.inc
+
+LICENSE = "GPLv2&MIT"
+LIC_FILES_CHKSUM = "file://drv/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://drv/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \
+ file://include/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://include/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 "
+DEPENDS = "linux-renesas"
+PN = "mmngr-kernel-module"
+SRC_URI = "file://mmngr.tar.bz2"
+S = "${WORKDIR}/mmngr"
+
+MMNGR_CFG_r8a7790 = "MMNGR_LAGER"
+MMNGR_CFG_r8a7791 = "MMNGR_KOELSCH"
+MMNGR_CFG_r8a7793 = "MMNGR_GOSE"
+MMNGR_CFG_r8a7794 = "MMNGR_ALT"
+
+do_compile() {
+ export MMNGR_CONFIG=${MMNGR_CFG}
+ if [ "X${USE_DTV}" = "X1" ]; then
+ export MMNGR_SSP_CONFIG="MMNGR_SSP_ENABLE"
+ else
+ export MMNGR_SSP_CONFIG="MMNGR_SSP_DISABLE"
+ fi
+ cd ${S}/drv
+ make all ARCH=arm
+}
+
+do_install () {
+ # Create destination folders
+ mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/extra/ ${D}/usr/src/kernel/include
+
+ # Copy shared library for reference from other modules
+ cp -f ${S}/drv/Module.symvers ${KERNELSRC}/include/mmngr.symvers
+ cp -f ${S}/drv/Module.symvers ${KERNELSRC}/include
+ cp -f ${S}/drv/Module.symvers ${D}/usr/src/kernel/include
+ cp -f ${S}/drv/Module.symvers ${D}/usr/src/kernel/include/mmngr.symvers
+
+ # Copy kernel module
+ cp -f ${S}/drv/mmngr.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/
+
+ # Copy shared header files
+ cp -f ${KERNELSRC}/include/mmngr_public.h ${D}/usr/src/kernel/include
+ cp -f ${KERNELSRC}/include/mmngr_private.h ${D}/usr/src/kernel/include
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -f ${KERNELSRC}/include/mmngr_private.h
+ rm -f ${KERNELSRC}/include/mmngr_public.h
+ rm -f ${KERNELSRC}/include/mmngr.symvers
+ rm -f ${KERNELSRC}/include/Module.symvers
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /lib/modules/${KERNEL_VERSION}/extra/mmngr.ko \
+"
+
+FILES_${PN}-dev = " \
+ /usr/src/kernel/include \
+ /usr/src/kernel/include/Module.symvers \
+ /usr/src/kernel/include/mmngr.symvers \
+ /usr/src/kernel/include/*.h \
+"
+
+RPROVIDES_${PN} += "mmngr-kernel-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+do_configure[noexec] = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-kernel/mmngr-module/mmngrbuf-kernel-module.bb b/meta-rcar-gen2/recipes-kernel/mmngr-module/mmngrbuf-kernel-module.bb
new file mode 100644
index 0000000..ac91e0c
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/mmngr-module/mmngrbuf-kernel-module.bb
@@ -0,0 +1,63 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "GPLv2&MIT"
+DEPENDS = "linux-renesas"
+PN = "mmngrbuf-kernel-module"
+PR = "r0"
+SRC_URI = "file://mmngrbuf.tar.bz2"
+LIC_FILES_CHKSUM = "file://drv/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://drv/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \
+ file://include/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://include/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 "
+
+S = "${WORKDIR}/mmngrbuf"
+
+do_compile() {
+ cd ${S}/drv
+ make all ARCH=arm
+}
+
+do_install () {
+ # Create destination folders
+ mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/extra/ ${D}/usr/src/kernel/include
+
+ # Copy shared library for reference from other modules
+ cp -f ${S}/drv/Module.symvers ${KERNELSRC}/include/mmngrbuf.symvers
+ cp -f ${S}/drv/Module.symvers ${D}/usr/src/kernel/include/mmngrbuf.symvers
+
+ # Copy kernel module
+ cp -f ${S}/drv/mmngrbuf.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -f ${KERNELSRC}/include/mmngr_buf_private.h
+ rm -f ${KERNELSRC}/include/mmngrbuf.symvers
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /lib/modules/${KERNEL_VERSION}/extra/mmngrbuf.ko \
+"
+
+FILES_${PN}-dev = " \
+ /usr/src/kernel/include/mmngrbuf.symvers \
+ /usr/src/kernel/include/*.h \
+"
+
+RPROVIDES_${PN} += "mmngrbuf-kernel-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+do_configure[noexec] = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-kernel/s3ctl-module/files/.gitkeep b/meta-rcar-gen2/recipes-kernel/s3ctl-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/s3ctl-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bb b/meta-rcar-gen2/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bb
new file mode 100644
index 0000000..211dd78
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bb
@@ -0,0 +1,64 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "GPLv2&MIT"
+LIC_FILES_CHKSUM = "file://drv/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://drv/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378"
+DEPENDS = "linux-renesas"
+PN = "s3ctl-kernel-module"
+PR = "r0"
+SRC_URI = "file://s3ctl-kernel.tar.bz2"
+
+S = "${WORKDIR}/s3ctl"
+
+do_compile() {
+ # Build kernel module
+ cd ${S}/drv
+ make all ARCH=arm
+}
+
+do_install() {
+ # Create shared folder
+ mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/extra/ ${D}/usr/src/kernel/include
+
+ # Copy kernel module
+ cp -f ${S}/drv/s3ctl.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/
+
+ # Copy shared header files
+ cp -f ${S}/drv/Module.symvers ${KERNELSRC}/include/s3ctl.symvers
+ cp -f ${KERNELSRC}/include/s3ctl_private.h ${D}/usr/src/kernel/include
+ cp -f ${S}/drv/Module.symvers ${D}/usr/src/kernel/include/s3ctl.symvers
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -rf ${KERNELSRC}/include/s3ctl_private.h
+ rm -rf ${KERNELSRC}/include/s3ctl.symvers
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /lib/modules/${KERNEL_VERSION}/extra/s3ctl.ko \
+"
+
+FILES_${PN}-dev = " \
+ /usr/src/kernel/include \
+ /usr/src/kernel/include/*.h \
+ /usr/src/kernel/include/s3ctl.symvers \
+"
+
+RPROVIDES_${PN} += "s3ctl-kernel-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+do_configure[noexec] = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-kernel/scu-module/files/.gitkeep b/meta-rcar-gen2/recipes-kernel/scu-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/scu-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-kernel/scu-module/scu-kernel-module.bb b/meta-rcar-gen2/recipes-kernel/scu-module/scu-kernel-module.bb
new file mode 100644
index 0000000..ec392a8
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/scu-module/scu-kernel-module.bb
@@ -0,0 +1,63 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "GPLv2&MIT"
+LIC_FILES_CHKSUM = "file://src/include/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://src/include/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \
+"
+DEPENDS = "linux-renesas"
+PN = "scu-kernel-module"
+PR = "r0"
+SRC_URI = "file://scu-kernel.tar.bz2"
+S = "${WORKDIR}"
+do_compile() {
+ cd ${S}/src/drv
+ make clean ARCH=arm
+ make all ARCH=arm
+}
+
+do_install() {
+ # Create destination folder
+ mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/extra/ ${D}/usr/src/kernel/include/
+ mkdir -p ${KERNELSRC}/include
+
+ # Copy kernel module
+ cp ${S}/src/drv/scu_src_drv.ko ${D}/lib/modules/${KERNEL_VERSION}/extra
+
+ # Copy shared header files
+ cp -f ${S}/src/include/scu_src_drv.h ${KERNELSRC}/include
+ cp -f ${S}/src/drv/Module.symvers ${KERNELSRC}/include/scu-drv.symvers
+ # Export for SDK
+ cp -f ${S}/src/include/scu_src_drv.h ${D}/usr/src/kernel/include
+ cp -f ${S}/src/drv/Module.symvers ${D}/usr/src/kernel/include/scu-drv.symvers
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -f ${KERNELSRC}/include/scu_src_drv.h ${KERNELSRC}/include/scu-drv.symvers
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /lib/modules/${KERNEL_VERSION}/extra/scu_src_drv.ko \
+"
+
+FILES_${PN}-dev = " \
+ /usr/src/kernel/include \
+ /usr/src/kernel/include/*.symvers \
+ /usr/src/kernel/include/*.h \
+"
+
+RPROVIDES_${PN} += "scu-kernel-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-kernel/ssp-module/files/.gitkeep b/meta-rcar-gen2/recipes-kernel/ssp-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/ssp-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-kernel/ssp-module/ssp-kernel-module.bb b/meta-rcar-gen2/recipes-kernel/ssp-module/ssp-kernel-module.bb
new file mode 100644
index 0000000..8159215
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/ssp-module/ssp-kernel-module.bb
@@ -0,0 +1,69 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "GPLv2&MIT"
+LIC_FILES_CHKSUM = "file://ssp/drv/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://ssp/drv/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \
+"
+DEPENDS = "linux-renesas"
+PN = "ssp-kernel-module"
+PR = "r0"
+SRC_URI = "file://ssp-kernel.tar.bz2"
+
+S = "${WORKDIR}"
+
+do_compile() {
+ cd ${S}/ssp/drv
+ make clean ARCH=arm
+ make all ARCH=arm
+}
+
+do_install() {
+ # Create destination folder
+ mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/extra/ ${D}/usr/src/kernel/include/
+ mkdir -p ${KERNELSRC}/include
+
+ # Copy kernel module
+ cp ${S}/ssp/drv/ssp_dev.ko ${D}/lib/modules/${KERNEL_VERSION}/extra
+
+ # Copy shared header files
+ cp -f ${S}/ssp/include/ssp_dev_private.h ${KERNELSRC}/include
+ cp -f ${S}/ssp/include/ssp_dev_public.h ${KERNELSRC}/include
+ cp -f ${S}/ssp/drv/Module.symvers ${KERNELSRC}/include/ssp-drv.symvers
+
+ # Export for SDK
+ cp -f ${S}/ssp/include/ssp_dev_private.h ${D}/usr/src/kernel/include
+ cp -f ${S}/ssp/include/ssp_dev_public.h ${D}/usr/src/kernel/include
+ cp -f ${S}/ssp/drv/Module.symvers ${D}/usr/src/kernel/include/ssp-drv.symvers
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -f ${KERNELSRC}/include/ssp_dev_private.h ${KERNELSRC}/include/ssp_dev_public.h
+ rm -f ${KERNELSRC}/include/ssp-drv.symvers
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /lib/modules/${KERNEL_VERSION}/extra/ssp_dev.ko \
+"
+
+FILES_${PN}-dev = " \
+ /usr/src/kernel/include \
+ /usr/src/kernel/include/*.symvers \
+ /usr/src/kernel/include/*.h \
+"
+
+RPROVIDES_${PN} += "ssp-kernel-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-kernel/uvcs-module/files/.gitkeep b/meta-rcar-gen2/recipes-kernel/uvcs-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/uvcs-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-kernel/uvcs-module/uvcs-kernel-module.bb b/meta-rcar-gen2/recipes-kernel/uvcs-module/uvcs-kernel-module.bb
new file mode 100644
index 0000000..17b0637
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/uvcs-module/uvcs-kernel-module.bb
@@ -0,0 +1,70 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "GPLv2&MIT"
+LIC_FILES_CHKSUM = "file://uvcs/include/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://uvcs/include/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \
+"
+DEPENDS = "linux-renesas"
+PN = "uvcs-kernel-module"
+PR = "r0"
+SRC_URI = "file://uvcs-kernel.tar.bz2"
+S = "${WORKDIR}"
+
+export UVCS_DRV_SRC_DIR = "${S}/uvcs/source/uvcs_lkm"
+export UVCS_CMN_SRC_DIR = "${S}/uvcs/source/uvcs_cmn"
+export UVCS_CMN_INC_DIR = "${S}/uvcs/include"
+export DRV_CORE_SRC_DIR = "${S}/uvcs/source/driver_core"
+
+do_compile() {
+ cd ${S}/uvcs/source/makefile/linaro_4_7_3/
+ make clean ARCH=arm
+ make all ARCH=arm
+}
+
+do_install() {
+ # Create destination folder
+ mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/extra/ ${D}/usr/src/kernel/include
+
+ # Copy kernel module
+ cp -f ${S}/uvcs/source/makefile/linaro_4_7_3/uvcs_cmn.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/uvcs_cmn.ko
+
+ # Copy shared header files
+ cp -f ${S}/uvcs/include/uvcs_cmn.h ${D}/usr/src/kernel/include
+ cp -f ${S}/uvcs/include/uvcs_types.h ${D}/usr/src/kernel/include
+ cp -f ${S}/uvcs/source/makefile/linaro_4_7_3/Module.symvers ${D}/usr/src/kernel/include/uvcs.symvers
+
+ cp -f ${S}/uvcs/include/uvcs_cmn.h ${KERNELSRC}/include/
+ cp -f ${S}/uvcs/include/uvcs_types.h ${KERNELSRC}/include/
+ cp -f ${S}/uvcs/source/makefile/linaro_4_7_3/Module.symvers ${KERNELSRC}/include/uvcs.symvers
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -f ${KERNELSRC}/include/uvcs_cmn.h ${KERNELSRC}/include/uvcs_types.h
+ rm -f ${KERNELSRC}/include/uvcs.symvers
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /lib/modules/${KERNEL_VERSION}/extra/uvcs_cmn.ko \
+"
+FILES_${PN}-dev = " \
+ /usr/src/kernel/include \
+ /usr/src/kernel/include/*.h \
+ /usr/src/kernel/include/uvcs.symvers \
+"
+
+RPROVIDES_${PN} += "uvcs-kernel-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-kernel/vspm-module/files/.gitkeep b/meta-rcar-gen2/recipes-kernel/vspm-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/vspm-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-kernel/vspm-module/vspm-kernel-module.bb b/meta-rcar-gen2/recipes-kernel/vspm-module/vspm-kernel-module.bb
new file mode 100644
index 0000000..1e88e6f
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/vspm-module/vspm-kernel-module.bb
@@ -0,0 +1,79 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "GPLv2&MIT"
+LIC_FILES_CHKSUM = "file://vspm/drv/GPL-COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
+ file://vspm/drv/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \
+"
+DEPENDS = "linux-renesas"
+PN = "vspm-kernel-module"
+PR = "r0"
+SRC_URI = "file://vspm-kernel.tar.bz2"
+S = "${WORKDIR}"
+
+VSPM_CFG_r8a7790 = "H2CONFIG"
+VSPM_CFG_r8a7791 = "M2CONFIG"
+VSPM_CFG_r8a7793 = "M2CONFIG"
+VSPM_CFG_r8a7794 = "E2CONFIG"
+
+do_compile() {
+ export VSPM_CONFIG=${VSPM_CFG}
+ cd ${S}/vspm/drv
+ make all ARCH=arm
+}
+
+do_install() {
+ # Create destination folder
+ mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/extra/ ${D}/usr/src/kernel/include
+
+ # Copy kernel module
+ cp -f ${S}/vspm/drv/vspm.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/
+
+ # Copy shared header files
+ cp -f ${KERNELSRC}/include/vspm_public.h ${D}/usr/src/kernel/include
+ cp -f ${KERNELSRC}/include/vsp_drv.h ${D}/usr/src/kernel/include
+ cp -f ${KERNELSRC}/include/tddmac_drv.h ${D}/usr/src/kernel/include
+ cp -f ${KERNELSRC}/include/vspm_if.h ${D}/usr/src/kernel/include
+ cp -f ${S}/vspm/drv/Module.symvers ${D}/usr/src/kernel/include/vspm.symvers
+ cp -f ${S}/vspm/drv/Module.symvers ${KERNELSRC}/include/vspm.symvers
+
+ # Copy for vspm-user-module
+ cp -f ${KERNELSRC}/include/vspm_if.h ${BUILDDIR}/include
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -f ${KERNELSRC}/include/vspm_public.h
+ rm -f ${KERNELSRC}/include/vsp_drv.h
+ rm -f ${KERNELSRC}/include/tddmac_drv.h
+ rm -f ${KERNELSRC}/include/vspm_if.h
+ rm -f ${BUILDDIR}/include/vspm_if.h
+ rm -f ${KERNELSRC}/include/vspm.symvers
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /lib/modules/${KERNEL_VERSION}/extra/vspm.ko \
+"
+
+FILES_${PN}-dev = " \
+ /usr/src/kernel/include \
+ /usr/src/kernel/include/*.h \
+ /usr/src/kernel/include/vspm.symvers \
+"
+
+RPROVIDES_${PN} += "vspm-kernel-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+do_configure[noexec] = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-multimedia/dtv-module/dtv-user-module.bb b/meta-rcar-gen2/recipes-multimedia/dtv-module/dtv-user-module.bb
new file mode 100644
index 0000000..7b8e5ca
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/dtv-module/dtv-user-module.bb
@@ -0,0 +1,52 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "CLOSED"
+PN = "dtv"
+PR = "r0"
+SRC_URI = "file://dtv.tar.bz2"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+S = "${WORKDIR}"
+
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+do_populate_lic[noexec] = "1"
+
+do_install() {
+ # Create share folders
+ mkdir -p ${D}/usr/local/include/ ${D}/usr/local/lib ${D}/usr/local/src/dtv/reference
+
+ # Copy share files to destination
+ cp -f ${WORKDIR}/dtv/include/*.h ${D}/usr/local/include/
+ cp -f ${WORKDIR}/dtv/lib/libdtv.a ${D}/usr/local/lib
+ cp -f ${WORKDIR}/dtv/userfunc/* ${D}/usr/local/src/dtv/reference
+}
+
+SYSROOT_PREPROCESS_FUNCS += "do_populate_reference_src"
+
+do_populate_reference_src () {
+ sysroot_stage_dir ${D}/usr/local ${SYSROOT_DESTDIR}/usr/local
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+ ${PN}-staticdev \
+"
+
+FILES_${PN} = ""
+ALLOW_EMPTY_${PN} = "1"
+
+FILES_${PN}-dev = " \
+ /usr/local/include/*.h \
+ /usr/local/src/dtv/reference/*.c \
+ /usr/local/src/dtv/reference/*.h \
+"
+
+FILES_${PN}-staticdev = " \
+ /usr/local/lib/*.a \
+"
+
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+do_configure[noexec] = "1"
diff --git a/meta-rcar-gen2/recipes-multimedia/dtv-module/files/.gitkeep b/meta-rcar-gen2/recipes-multimedia/dtv-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/dtv-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-multimedia/fdpm-module/fdpm-tp-user-module.bb b/meta-rcar-gen2/recipes-multimedia/fdpm-module/fdpm-tp-user-module.bb
new file mode 100644
index 0000000..2f01ed3
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/fdpm-module/fdpm-tp-user-module.bb
@@ -0,0 +1,31 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+S = "${WORKDIR}"
+
+LICENSE = "CLOSED"
+DEPENDS = "fdpm-user-module mmngr-user-module"
+SRC_URI = "file://fdpm-tp-user.tar.bz2"
+
+do_compile() {
+ cd ${S}/fdpm/
+ make all ARCH=arm
+}
+
+do_install() {
+ # Create destination folder
+ mkdir -p ${D}/usr/local/bin/
+
+ # Copy user test program
+ cp ${S}/fdpm/fdpm_tp ${D}/usr/local/bin/
+}
+
+PACKAGES = "\
+ ${PN} \
+"
+
+FILES_${PN} = " \
+ /usr/local/bin/fdpm_tp \
+"
+
+RPROVIDES_${PN} += "fdpm-tp-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta-rcar-gen2/recipes-multimedia/fdpm-module/fdpm-user-module.bb b/meta-rcar-gen2/recipes-multimedia/fdpm-module/fdpm-user-module.bb
new file mode 100644
index 0000000..7146a2a
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/fdpm-module/fdpm-user-module.bb
@@ -0,0 +1,68 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "CLOSED"
+DEPENDS = "fdpm-kernel-module mmngr-user-module"
+PN = "fdpm-user-module"
+SRC_URI = "file://fdpm.tar.bz2"
+
+S = "${WORKDIR}/fdpm"
+
+do_compile() {
+ # Build shared library
+ cd ${S}/if
+ rm -rf libfdpm.so*
+ make all ARCH=arm
+ # Copy shared library for reference from other modules
+ cp -P ${S}/if/libfdpm.so* ${LIBSHARED}
+ cp -rf ${S}/include/*h ${STAGING_INCDIR}
+}
+
+do_install() {
+ # Create destination folder
+ mkdir -p ${D}/usr/local/lib/ ${D}/usr/local/include/
+
+ # Copy shared library
+ cp -P ${S}/if/libfdpm.so* ${D}/usr/local/lib
+ cp -rf ${S}/include/*h ${D}/usr/local/include/
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -f ${LIBSHARED}/libfdpm.so*
+ rm -f ${STAGING_INCDIR}/fdpm_api.h
+ rm -f ${STAGING_INCDIR}/fdpm_drv.h
+ rm -f ${STAGING_INCDIR}/fdpm_if_fd.h
+ rm -f ${STAGING_INCDIR}/fdpm_if.h
+ rm -f ${STAGING_INCDIR}/fdpm_if_par.h
+ rm -f ${STAGING_INCDIR}/fdpm_if_priv.h
+ rm -f ${STAGING_INCDIR}/fdpm_public.h
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /usr/local/lib/libfdpm.so.* \
+"
+
+FILES_${PN}-dev = " \
+ /usr/local/lib/libfdpm.so \
+ /usr/local/include/*.h \
+"
+
+RPROVIDES_${PN} += "fdpm-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INSANE_SKIP_${PN} += "libdir"
+INSANE_SKIP_${PN}-dev += "libdir"
+
+do_configure[noexec] = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-multimedia/fdpm-module/files/.gitkeep b/meta-rcar-gen2/recipes-multimedia/fdpm-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/fdpm-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.0.0.bbappend b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.0.0.bbappend
new file mode 100644
index 0000000..8a7128e
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.0.0.bbappend
@@ -0,0 +1,26 @@
+require ../../include/gles-control.inc
+
+SRC_URI_rcar-gen2 = "git://github.com/renesas-devel/gst-omx.git;protocol=git;branch=RCAR-GEN2/1.0.0"
+SRCREV_rcar-gen2 = "05563465faad99243ee2dd30547e3075eb8cf5e3"
+
+LIC_FILES_CHKSUM_remove_rcar-gen2 = " file://omx/gstomx.h;beginline=1;endline=21;md5=5c8e1fca32704488e76d2ba9ddfa935f"
+LIC_FILES_CHKSUM_append_rcar-gen2 = " file://omx/gstomx.h;beginline=1;endline=22;md5=17e5f2943dace9e5cde4a8587a31e8f9"
+S = "${WORKDIR}/git"
+
+do_configure() {
+ ./autogen.sh --noconfigure
+ oe_runconf
+}
+
+DEPENDS_append_rcar-gen2 = " omx-user-module mmngrbuf-user-module"
+EXTRA_OECONF_append_rcar-gen2 = " --with-omx-target=rcar --enable-experimental \
+ '${@'--disable-dmabuf' if '${USE_GLES}' == '0' and '${USE_WAYLAND}' == '1' else ''}'"
+
+# Overwrite do_install[postfuncs] += " set_omx_core_name "
+# because it will force the plugin to use bellagio instead of our config
+revert_omx_core_name() {
+ sed -i -e "s;^core-name=.*;core-name=/usr/local/lib/libomxr_core.so;" "${D}/etc/xdg/gstomx.conf"
+}
+REVERT_OMX_CORE_NAME = ""
+REVERT_OMX_CORE_NAME_rcar-gen2 = "revert_omx_core_name"
+do_install[postfuncs] += "${REVERT_OMX_CORE_NAME}"
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.2.3.bbappend b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.2.3.bbappend
new file mode 100644
index 0000000..ac9e52e
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.2.3.bbappend
@@ -0,0 +1,26 @@
+require ../../include/gles-control.inc
+require ../../include/multimedia-control.inc
+
+SRC_URI_rcar-gen2 = "git://github.com/renesas-devel/gst-plugins-bad.git;protocol=git;branch=RCAR-GEN2/1.2.3"
+SRCREV_rcar-gen2 = "${@'eda7155f94981ace11b866fc02daca6ad4869221' \
+ if '1' in '${USE_GLES_WAYLAND}' else 'c1f5e09ce341f3438fb601a852ee70e72d375646'}"
+LIC_FILES_CHKSUM_remove_rcar-gen2 = "\
+ file://common/coverage/coverage-report.pl;beginline=2;endline=17;md5=a4e1830fce078028c8f0974161272607"
+
+S = "${WORKDIR}/git"
+
+do_configure() {
+ ./autogen.sh --noconfigure
+ oe_runconf
+}
+
+# for wayland
+PACKAGECONFIG_remove_rcar-gen2 = "${@'orc' if '1' in '${USE_GLES_WAYLAND}' else ''}"
+PACKAGECONFIG_append_rcar-gen2 = " faad ${@base_contains('USE_GLES_WAYLAND', '1', 'wayland', '', d)}"
+
+# for lcb
+DEPENDS_append_silk = " ${@base_conditional('USE_MULTIMEDIA', '1', 'faac', '', d)}"
+PACKAGECONFIG_silk = " ${@base_conditional('USE_MULTIMEDIA', '1', 'faac', '', d)}"
+
+DEPENDS_append_porter = " ${@base_conditional('USE_MULTIMEDIA', '1', 'faac', '', d)}"
+PACKAGECONFIG_porter = " ${@base_conditional('USE_MULTIMEDIA', '1', 'faac', '', d)}"
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-alt.conf b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-alt.conf
new file mode 100644
index 0000000..b324cbe
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-alt.conf
@@ -0,0 +1,2 @@
+input-device-name=/dev/video1
+output-device-name=/dev/video5
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-gose.conf b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-gose.conf
new file mode 100644
index 0000000..c534883
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-gose.conf
@@ -0,0 +1,2 @@
+input-device-name=/dev/video2
+output-device-name=/dev/video6
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-koelsch.conf b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-koelsch.conf
new file mode 100644
index 0000000..c534883
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-koelsch.conf
@@ -0,0 +1,2 @@
+input-device-name=/dev/video2
+output-device-name=/dev/video6
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-lager.conf b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-lager.conf
new file mode 100644
index 0000000..c534883
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-lager.conf
@@ -0,0 +1,2 @@
+input-device-name=/dev/video2
+output-device-name=/dev/video6
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-porter.conf b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-porter.conf
new file mode 100644
index 0000000..b324cbe
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-porter.conf
@@ -0,0 +1,2 @@
+input-device-name=/dev/video1
+output-device-name=/dev/video5
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-silk.conf b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-silk.conf
new file mode 100644
index 0000000..b324cbe
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstvspfilter-silk.conf
@@ -0,0 +1,2 @@
+input-device-name=/dev/video1
+output-device-name=/dev/video5
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.2.3.bbappend b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.2.3.bbappend
new file mode 100644
index 0000000..eee4b59
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.2.3.bbappend
@@ -0,0 +1,49 @@
+require ../../include/gles-control.inc
+
+SRC_URI_rcar-gen2 = "git://github.com/renesas-devel/gst-plugins-base.git;protocol=git;branch=RCAR-GEN2/1.2.3"
+SRCREV_rcar-gen2 = "f5176e8e2e9b39ee96181c37cf61e2a90e56069b"
+LIC_FILES_CHKSUM_remove_rcar-gen2 = "\
+ file://common/coverage/coverage-report.pl;beginline=2;endline=17;md5=a4e1830fce078028c8f0974161272607"
+
+S = "${WORKDIR}/git"
+
+do_configure() {
+ ./autogen.sh --noconfigure
+ oe_runconf
+}
+
+# For Common
+FILESEXTRAPATHS_prepend_rcar-gen2 := '${THISDIR}/${PN}:'
+VSPFILTER_CONFIGS = " \
+ file://gstvspfilter-alt.conf \
+ file://gstvspfilter-gose.conf \
+ file://gstvspfilter-koelsch.conf \
+ file://gstvspfilter-lager.conf \
+ file://gstvspfilter-porter.conf \
+ file://gstvspfilter-silk.conf \
+"
+
+# For wayland
+PACKAGECONFIG_remove_rcar-gen2 = "${@base_contains("DISTRO_FEATURES", "wayland", "orc", "", d)}"
+
+SRC_URI_append_rcar-gen2 = \
+ "${@'${VSPFILTER_CONFIGS}' \
+ if '${USE_WAYLAND}' == '1' else ''}"
+
+EXTRA_OECONF_append_rcar-gen2 = " \
+ ${@'--enable-vspfilter' \
+ if '${USE_WAYLAND}' == '1' else ''}"
+
+do_install_append_rcar-gen2() {
+ if [ '${USE_WAYLAND}' = '1' ] ; then
+ mkdir ${D}/etc/
+ install -m644 ${WORKDIR}/gstvspfilter-${MACHINE}.conf ${D}/etc/gstvspfilter.conf
+ fi
+}
+
+FILES_${PN}_append_rcar-gen2 = " \
+ ${@'${datadir}/gst-plugins-base/1.0/* ${sysconfdir}/*.conf' \
+ if '${USE_WAYLAND}' == '1' else ''}"
+
+# For x11
+# None
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.2.3.bbappend b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.2.3.bbappend
new file mode 100644
index 0000000..573f71a
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.2.3.bbappend
@@ -0,0 +1,12 @@
+SRC_URI_rcar-gen2 = "git://github.com/renesas-devel/gst-plugins-good.git;protocol=git;branch=RCAR-GEN2/1.2.3"
+SRCREV_rcar-gen2 = "e752441fef9f70c97bb0976476fdaa6c7df27b6b"
+
+LIC_FILES_CHKSUM_remove_rcar-gen2 = "\
+ file://common/coverage/coverage-report.pl;beginline=2;endline=17;md5=a4e1830fce078028c8f0974161272607"
+
+S = "${WORKDIR}/git"
+
+do_configure() {
+ ./autogen.sh --noconfigure
+ oe_runconf
+}
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.2.3.bbappend b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.2.3.bbappend
new file mode 100644
index 0000000..6d43b52
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.2.3.bbappend
@@ -0,0 +1,12 @@
+SRC_URI_rcar-gen2 = "git://github.com/renesas-devel/gst-plugins-ugly.git;protocol=git;branch=RCAR-GEN2/1.2.3"
+SRCREV_rcar-gen2 = "af884db954b53bf083ebc39e3a90b639f81513e1"
+S = "${WORKDIR}/git"
+
+PACKAGECONFIG ??= " \
+ a52dec lame mad mpeg2dec \
+ "
+
+do_configure() {
+ ./autogen.sh --noconfigure
+ oe_runconf
+}
diff --git a/meta-rcar-gen2/recipes-multimedia/libomxil/libomxil_0.9.3.bbappend b/meta-rcar-gen2/recipes-multimedia/libomxil/libomxil_0.9.3.bbappend
new file mode 100644
index 0000000..3be14f6
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/libomxil/libomxil_0.9.3.bbappend
@@ -0,0 +1,3 @@
+do_populate_sysroot () {
+ rm -f ${D}/usr/include/*.h
+}
diff --git a/meta-rcar-gen2/recipes-multimedia/mmngr-module/files/.gitkeep b/meta-rcar-gen2/recipes-multimedia/mmngr-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/mmngr-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngr-tp-user-module.bb b/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngr-tp-user-module.bb
new file mode 100644
index 0000000..515f784
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngr-tp-user-module.bb
@@ -0,0 +1,29 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "CLOSED"
+DEPENDS = "mmngr-kernel-module mmngr-user-module"
+SRC_URI = "file://mmngr-tp-user.tar.bz2"
+
+S = "${WORKDIR}/mmngr"
+
+do_compile() {
+ # Build test kernel module
+ cd ${S}
+ make all ARCH=arm
+}
+
+do_install() {
+ # Copy kernel test program
+ mkdir -p ${D}/usr/local/bin/
+ cp ${S}/mmtp ${D}/usr/local/bin/
+}
+
+PACKAGES = "\
+ ${PN} \
+"
+FILES_${PN} = " \
+ /usr/local/bin/mmtp \
+"
+
+RPROVIDES_${PN} += "mmngr-tp-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngr-user-module.bb b/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngr-user-module.bb
new file mode 100644
index 0000000..3205915
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngr-user-module.bb
@@ -0,0 +1,65 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "CLOSED"
+DEPENDS = "mmngr-kernel-module"
+PN = "mmngr-user-module"
+S = "${WORKDIR}/mmngr"
+SRC_URI = "file://mmngr.tar.bz2"
+
+do_compile() {
+ # Build shared library
+ cd ${S}/if
+ rm -rf ${S}/if/libmmngr.so*
+ make all ARCH=arm
+ # Copy shared library into shared folder
+ cp -P ${S}/if/libmmngr.so* ${LIBSHARED}
+}
+
+do_install() {
+ mkdir -p ${D}/usr/local/lib/ ${D}/usr/local/include
+
+ # Copy shared library
+ cp -P ${S}/if/libmmngr.so* ${D}/usr/local/lib/
+ cd ${D}/usr/local/lib/
+ # Copy shared header files
+ cp -f ${BUILDDIR}/include/mmngr_user_public.h ${D}/usr/local/include
+ cp -f ${BUILDDIR}/include/mmngr_user_private.h ${D}/usr/local/include
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -f ${LIBSHARED}/libmmngr.so*
+ rm -Rf ${BUILDDIR}/include/mmngr_user_public.h
+ rm -Rf ${BUILDDIR}/include/mmngr_user_private.h
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /usr/local/lib/libmmngr.so.* \
+"
+
+FILES_${PN}-dev = " \
+ /usr/local/include \
+ /usr/local/include/*.h \
+ /usr/local/lib \
+ /usr/local/lib/libmmngr.so \
+"
+
+RPROVIDES_${PN} += "mmngr-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INSANE_SKIP_${PN} += "libdir"
+INSANE_SKIP_${PN}-dev += "libdir"
+
+do_configure[noexec] = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngrbuf-tp-user-module.bb b/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngrbuf-tp-user-module.bb
new file mode 100644
index 0000000..c07945d
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngrbuf-tp-user-module.bb
@@ -0,0 +1,29 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "CLOSED"
+DEPENDS = "mmngrbuf-kernel-module mmngrbuf-user-module"
+SRC_URI = "file://mmngrbuf-tp-user.tar.bz2"
+
+S = "${WORKDIR}/mmngrbuf"
+
+do_compile() {
+ # Build test kernel module
+ cd ${S}
+ make all ARCH=arm
+}
+
+do_install() {
+ # Copy kernel test program
+ mkdir -p ${D}/usr/local/bin/
+ cp ${S}/mmbuftp ${D}/usr/local/bin/
+}
+
+PACKAGES = "\
+ ${PN} \
+"
+FILES_${PN} = " \
+ /usr/local/bin/mmbuftp \
+"
+
+RPROVIDES_${PN} += "mmngrbuf-tp-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngrbuf-user-module.bb b/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngrbuf-user-module.bb
new file mode 100644
index 0000000..d2f90e0
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/mmngr-module/mmngrbuf-user-module.bb
@@ -0,0 +1,67 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "CLOSED"
+DEPENDS = "mmngrbuf-kernel-module"
+PN = "mmngrbuf-user-module"
+PR = "r0"
+S = "${WORKDIR}/mmngrbuf"
+SRC_URI = "file://mmngrbuf.tar.bz2"
+
+
+do_compile() {
+ # Build shared library
+ cd ${S}/if
+ rm -rf ${S}/if/libmmngrbuf.so*
+ make all ARCH=arm
+ # Copy shared library into shared folder
+ cp -P ${S}/if/libmmngrbuf.so* ${LIBSHARED}
+}
+
+do_install() {
+ mkdir -p ${D}/usr/local/lib/ ${D}/usr/local/include
+
+ # Copy shared library
+ cp -P ${S}/if/libmmngrbuf.so* ${D}/usr/local/lib/
+ cd ${D}/usr/local/lib/
+ # Copy shared header files
+ cp -f ${BUILDDIR}/include/mmngr_buf_user_public.h ${D}/usr/local/include
+ cp -f ${BUILDDIR}/include/mmngr_buf_user_private.h ${D}/usr/local/include
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -f ${LIBSHARED}/libmmngrbuf.so*
+ rm -Rf ${BUILDDIR}/include/mmngr_buf_user_public.h
+ rm -Rf ${BUILDDIR}/include/mmngr_buf_user_private.h
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /usr/local/lib/libmmngrbuf.so.* \
+"
+
+FILES_${PN}-dev = " \
+ /usr/local/include \
+ /usr/local/include/*.h \
+ /usr/local/lib \
+ /usr/local/lib/libmmngrbuf.so \
+"
+
+RPROVIDES_${PN} += "mmngrbuf-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INSANE_SKIP_${PN} += "libdir"
+INSANE_SKIP_${PN}-dev += "libdir"
+
+do_configure[noexec] = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-multimedia/omx-module/files/.gitkeep b/meta-rcar-gen2/recipes-multimedia/omx-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/omx-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-multimedia/omx-module/omx-user-module.bb b/meta-rcar-gen2/recipes-multimedia/omx-module/omx-user-module.bb
new file mode 100644
index 0000000..f4f0c8b
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/omx-module/omx-user-module.bb
@@ -0,0 +1,426 @@
+require ../../include/rcar-gen2-modules-common.inc
+require ../../include/omx-components-control.inc
+
+LICENSE = "CLOSED"
+DEPENDS = "mmngr-kernel-module mmngr-user-module \
+ vspm-kernel-module vspm-user-module \
+ s3ctl-kernel-module s3ctl-user-module \
+ fdpm-kernel-module fdpm-user-module \
+ uvcs-kernel-module"
+
+PR = "r0"
+PV = "1.0"
+PN = "omx-user-module"
+
+SRC_URI = "file://RTM0AC0000XCMCTL20SL32C.tar.bz2;name=file1 \
+ file://RTM0AC0000XVCMND20SL32C.tar.bz2;name=file2 \
+ file://RTM0AC0000XV264D20SL32C.tar.bz2;name=file3 \
+ "
+SRC_URI += '${@base_conditional( "USE_H263_DECODER", "1", " file://RTM0AC0000XV263D20SL32C.tar.bz2;name=file4", "", d )}'
+SRC_URI += '${@base_conditional( "USE_MPEG2_DECODER", "1", " file://RTM0AC0000XVM2VD20SL32C.tar.bz2;name=file5", "", d )}'
+SRC_URI += '${@base_conditional( "USE_MPEG4_DECODER", "1", " file://RTM0AC0000XVM4VD20SL32C.tar.bz2;name=file6", "", d )}'
+SRC_URI += '${@base_conditional( "USE_DIVX_DECODER", "1", " file://RTM0AC0000XVDVXD20SL32C.tar.bz2;name=file7", "", d )}'
+SRC_URI += '${@base_conditional( "USE_VC1_DECODER", "1", " file://RTM0AC0000XVVC1D20SL32C.tar.bz2;name=file8", "", d )}'
+SRC_URI += '${@base_conditional( "USE_H264AVC_ENCODER", "1", " file://RTM0AC0000XV264E20SL32C.tar.bz2;name=file9", "", d )}'
+SRC_URI += '${@base_conditional( "USE_VIDEO_COMMON_ENCODER", "1", " file://RTM0AC0000XVCMNE20SL32C.tar.bz2;name=file10", "", d )}'
+SRC_URI += '${@base_conditional( "USE_AUDIO_COMMON", "1", " file://RTM0AC0000XACMND20SL32C.tar.bz2;name=file11", "", d )}'
+SRC_URI += '${@base_conditional( "USE_AACP2_DECODER", "1", " file://RTM0AC0000XAAAPD20SL32C.tar.bz2;name=file12", "", d )}'
+SRC_URI += '${@base_conditional( "USE_MP3_DECODER", "1", " file://RTM0AC0000XAMP3D20SL32C.tar.bz2;name=file13", "", d )}'
+SRC_URI += '${@base_conditional( "USE_WMA_DECODER", "1", " file://RTM0AC0000XAWMAD20SL32C.tar.bz2;name=file14", "", d )}'
+SRC_URI += '${@base_conditional( "USE_DDD_DECODER", "1", " file://RTM0AC0000XADD5D20SL32C.tar.bz2;name=file15", "", d )}'
+SRC_URI += '${@base_conditional( "USE_ALAC_DECODER", "1", " file://RTM0AC0000XAALAD20SL32C.tar.bz2;name=file16", "", d )}'
+SRC_URI += '${@base_conditional( "USE_FLAC_DECODER", "1", " file://RTM0AC0000XAFLAD20SL32C.tar.bz2;name=file17", "", d )}'
+SRC_URI += '${@base_conditional( "USE_AAC_ENCODER", "1", " file://RTM0AC0000XAAACE20SL32C.tar.bz2;name=file18", "", d )}'
+SRC_URI += '${@base_conditional( "ARMAACP2_MDW_DECODER", "1", " file://RTM0AC0000ADAAPMZ1SL32C.tar.bz2;name=file19", "", d )}'
+SRC_URI += '${@base_conditional( "MP3_MDW_DECODER", "1", " file://RTM0AC0000ADMP3MZ1SL32C.tar.bz2;name=file20", "", d )}'
+SRC_URI += '${@base_conditional( "WMA_MDW_DECODER", "1", " file://RTM0AC0000ADWMAMZ1SL32C.tar.bz2;name=file21", "", d )}'
+SRC_URI += '${@base_conditional( "DDD_MDW_DECODER", "1", " file://RTM0AC0000ADDD5MZ1SL32C.tar.bz2;name=file22", "", d )}'
+SRC_URI += '${@base_conditional( "ALAC_MDW_DECODER", "1", " file://RCG2ADALAMZ1SL32.tar.bz2;name=file23", "", d )}'
+SRC_URI += '${@base_conditional( "FLAC_MDW_DECODER", "1", " file://RCG2ADFLAMZ1SL32.tar.bz2;name=file24", "", d )}'
+SRC_URI += '${@base_conditional( "AAC_MDW_ENCODER", "1", " file://RTM0AC0000AEAACMZ1SL32C.tar.bz2;name=file25", "", d )}'
+
+LISTSRC = "RTM0AC0000XCMCTL20SL32C \
+ RTM0AC0000XVCMND20SL32C \
+ RTM0AC0000XV264D20SL32C"
+
+LISTSRC += '${@base_conditional( "USE_H263_DECODER", "1", "RTM0AC0000XV263D20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_MPEG2_DECODER", "1", "RTM0AC0000XVM2VD20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_MPEG4_DECODER", "1", "RTM0AC0000XVM4VD20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_DIVX_DECODER", "1", "RTM0AC0000XVDVXD20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_VC1_DECODER", "1", "RTM0AC0000XVVC1D20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_H264AVC_ENCODER", "1", "RTM0AC0000XV264E20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_VIDEO_COMMON_ENCODER", "1", "RTM0AC0000XVCMNE20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_AUDIO_COMMON", "1", "RTM0AC0000XACMND20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_AACP2_DECODER", "1", "RTM0AC0000XAAAPD20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_MP3_DECODER", "1", "RTM0AC0000XAMP3D20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_WMA_DECODER", "1", "RTM0AC0000XAWMAD20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_DDD_DECODER", "1", "RTM0AC0000XADD5D20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_ALAC_DECODER", "1", "RTM0AC0000XAALAD20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_FLAC_DECODER", "1", "RTM0AC0000XAFLAD20SL32C", "", d )}'
+LISTSRC += '${@base_conditional( "USE_AAC_ENCODER", "1", "RTM0AC0000XAAACE20SL32C", "", d )}'
+
+MIDWARESRC = '${@base_conditional( "ARMAACP2_MDW_DECODER", "1", "RTM0AC0000ADAAPMZ1SL32C", "", d )}'
+MIDWARESRC += '${@base_conditional( "MP3_MDW_DECODER", "1", "RTM0AC0000ADMP3MZ1SL32C", "", d )}'
+MIDWARESRC += '${@base_conditional( "WMA_MDW_DECODER", "1", "RTM0AC0000ADWMAMZ1SL32C", "", d )}'
+MIDWARESRC += '${@base_conditional( "DDD_MDW_DECODER", "1", "RTM0AC0000ADDD5MZ1SL32C", "", d )}'
+MIDWARESRC += '${@base_conditional( "ALAC_MDW_DECODER", "1", "RCG2ADALAMZ1SL32", "", d )}'
+MIDWARESRC += '${@base_conditional( "FLAC_MDW_DECODER", "1", "RCG2ADFLAMZ1SL32", "", d )}'
+MIDWARESRC += '${@base_conditional( "AAC_MDW_ENCODER", "1", "RTM0AC0000AEAACMZ1SL32C", "", d )}'
+
+S = "${WORKDIR}/omx"
+
+do_unpack_append () {
+ bb.build.exec_func('do_collect_src', d)
+}
+
+do_collect_src() {
+ cd ${WORKDIR}
+ mkdir -p ${S}
+ for dir in ${LISTSRC}; do
+ cp -rf ${dir}/Software/* ${S}
+ rm -rf ${dir}
+ done
+ cp -rf ${S}/OMXR/include ${S}/UDF_Linux
+ cp -rf ${S}/OMXR/lib/linux/linaro_4_7_3/* ${S}/OMXR/lib/
+ rm -rf ${S}/OMXR/lib/linux/
+
+ # Colect audio midleware
+ mkdir -p ${S}/audio_mdw
+ for dir in ${MIDWARESRC}; do
+ cp -rf ${dir}/* ${S}/audio_mdw
+ rm -rf ${dir}
+ done
+}
+
+
+do_configure() {
+ cd ${S}/UDF_Linux
+ ./autogen.sh
+ ./configure --prefix=${D}/usr/local/ --host=arm-linux \
+ CFLAGS="-I${BUILDDIR}/include -I${KERNELDIR}/include" \
+ LDFLAGS="-L${LIBSHARED}" \
+ OMXR_DEFAULT_CONFIG_FILE_NAME=/usr/local/config/omxr_config_base.txt
+}
+
+do_compile() {
+ cd ${S}/UDF_Linux
+ make
+}
+
+do_install() {
+ # Create share files
+ mkdir -p ${D}/usr/local/lib ${D}/usr/local/config
+ cd ${S}/UDF_Linux
+ make install
+ cp -rf ${S}/OMXR/config/*.txt ${D}/usr/local/config/
+ cp -rf ${S}/UDF_Linux/include ${D}/usr/local/include
+ cp -rf ${S}/UDF_Linux/include/*.h ${STAGING_INCDIR}
+
+ cd ${S}/OMXR/lib/
+
+ # OMX ctrl part
+ ln -sf libomxr_core.so.2.0.0 libomxr_core.so.2
+ ln -sf libomxr_core.so.2.0.0 libomxr_core.so
+
+ ln -sf libomxr_mc_cmn.so.2.0.0 libomxr_mc_cmn.so.2
+ ln -sf libomxr_mc_cmn.so.2.0.0 libomxr_mc_cmn.so
+
+ # Video (decode) common
+ ln -sf libomxr_mc_vcmn.so.2.0.0 libomxr_mc_vcmn.so.2
+ ln -sf libomxr_mc_vcmn.so.2.0.0 libomxr_mc_vcmn.so
+
+ ln -sf libomxr_mc_vdcmn.so.2.0.0 libomxr_mc_vdcmn.so.2
+ ln -sf libomxr_mc_vdcmn.so.2.0.0 libomxr_mc_vdcmn.so
+
+ ln -sf libuvcs_dec.so.1.0.0 libuvcs_dec.so.1
+ ln -sf libuvcs_dec.so.1.0.0 libuvcs_dec.so
+
+ ln -sf libvcp3_mcvd.so.1.0.0 libvcp3_mcvd.so.1
+ ln -sf libvcp3_mcvd.so.1.0.0 libvcp3_mcvd.so
+
+ # H264 Decoder
+ ln -sf libomxr_mc_h264d.so.2.0.0 libomxr_mc_h264d.so.2
+ ln -sf libomxr_mc_h264d.so.2.0.0 libomxr_mc_h264d.so
+
+ ln -sf libvcp3_avcd.so.1.0.0 libvcp3_avcd.so.1
+ ln -sf libvcp3_avcd.so.1.0.0 libvcp3_avcd.so
+
+ # H263 Decoder
+ if [ "X${USE_H263_DECODER}" = "X1" ] ; then
+ ln -sf libomxr_mc_h263d.so.2.0.0 libomxr_mc_h263d.so.2
+ ln -sf libomxr_mc_h263d.so.2.0.0 libomxr_mc_h263d.so
+
+ ln -sf libvcp3_hv3d.so.1.0.0 libvcp3_hv3d.so.1
+ ln -sf libvcp3_hv3d.so.1.0.0 libvcp3_hv3d.so
+ fi
+
+ # M2VD decoder
+ if [ "X${USE_MPEG2_DECODER}" = "X1" ] ; then
+ ln -sf libvcp3_m2vd.so.1.0.0 libvcp3_m2vd.so.1
+ ln -sf libvcp3_m2vd.so.1 libvcp3_m2vd.so
+
+ ln -sf libomxr_mc_m2vd.so.2.0.0 libomxr_mc_m2vd.so.2
+ ln -sf libomxr_mc_m2vd.so.2 libomxr_mc_m2vd.so
+ fi
+
+ # M4VD decoder
+ if [ "X${USE_MPEG4_DECODER}" = "X1" ] ; then
+ ln -sf libvcp3_m4vd.so.1.0.0 libvcp3_m4vd.so.1
+ ln -sf libvcp3_m4vd.so.1 libvcp3_m4vd.so
+
+ ln -sf libomxr_mc_m4vd.so.2.0.0 libomxr_mc_m4vd.so.2
+ ln -sf libomxr_mc_m4vd.so.2 libomxr_mc_m4vd.so
+ fi
+
+ # DIVX decoder
+ if [ "X${USE_DIVX_DECODER}" = "X1" ] ; then
+ ln -sf libvcp3_dvxd.so.1.0.0 libvcp3_dvxd.so.1
+ ln -sf libvcp3_dvxd.so.1 libvcp3_dvxd.so
+
+ ln -sf libomxr_mc_divxd.so.2.0.0 libomxr_mc_divxd.so.2
+ ln -sf libomxr_mc_divxd.so.2 libomxr_mc_divxd.so
+ fi
+
+ # VC1D decoder
+ if [ "X${USE_VC1_DECODER}" = "X1" ] ; then
+ ln -sf libvcp3_vc1d.so.1.0.0 libvcp3_vc1d.so.1
+ ln -sf libvcp3_vc1d.so.1 libvcp3_vc1d.so
+
+ ln -sf libomxr_mc_vc1d.so.2.0.0 libomxr_mc_vc1d.so.2
+ ln -sf libomxr_mc_vc1d.so.2 libomxr_mc_vc1d.so
+ fi
+
+ #Encoder
+ # H264E
+ if [ "X${USE_H264AVC_ENCODER}" = "X1" ] ; then
+ ln -sf libomxr_mc_h264e.so.2.0.0 libomxr_mc_h264e.so.2
+ ln -sf libomxr_mc_h264e.so.2 libomxr_mc_h264e.so
+
+ ln -sf libvcp3_avce.so.1.0.0 libvcp3_avce.so.1
+ ln -sf libvcp3_avce.so.1.0.0 libvcp3_avce.so
+ fi
+
+ ### Encoder common
+ if [ "X${USE_VIDEO_COMMON_ENCODER}" = "X1" ] ; then
+ ln -sf libomxr_mc_vecmn.so.2.0.0 libomxr_mc_vecmn.so.2
+ ln -sf libomxr_mc_vecmn.so.2.0.0 libomxr_mc_vecmn.so
+
+ ln -sf libuvcs_enc.so.1.0.0 libuvcs_enc.so.1
+ ln -sf libuvcs_enc.so.1.0.0 libuvcs_enc.so
+
+ ln -sf libvcp3_mcve.so.1.0.0 libvcp3_mcve.so.1
+ ln -sf libvcp3_mcve.so.1.0.0 libvcp3_mcve.so
+ fi
+
+ # audio common OMX
+ if [ "X${USE_AUDIO_COMMON}" = "X1" ] ; then
+ ln -sf libomxr_mc_acmn.so.2.0.0 libomxr_mc_acmn.so.2
+ ln -sf libomxr_mc_acmn.so.2.0.0 libomxr_mc_acmn.so
+ fi
+
+ # aacd OMX
+ if [ "X${USE_AACP2_DECODER}" = "X1" ] ; then
+ ln -sf libomxr_mc_aacd.so.2.0.0 libomxr_mc_aacd.so.2
+ ln -sf libomxr_mc_aacd.so.2.0.0 libomxr_mc_aacd.so
+ fi
+
+ # mp3 OMX
+ if [ "X${USE_MP3_DECODER}" = "X1" ] ; then
+ ln -sf libomxr_mc_mp3d.so.2.0.0 libomxr_mc_mp3d.so.2
+ ln -sf libomxr_mc_mp3d.so.2.0.0 libomxr_mc_mp3d.so
+ fi
+
+ # wma OMX
+ if [ "X${USE_WMA_DECODER}" = "X1" ] ; then
+ ln -sf libomxr_mc_wmad.so.2.0.0 libomxr_mc_wmad.so.2
+ ln -sf libomxr_mc_wmad.so.2.0.0 libomxr_mc_wmad.so
+ fi
+
+ # ddd OMX
+ if [ "X${USE_DDD_DECODER}" = "X1" ] ; then
+ ln -sf libomxr_mc_ddd.so.2.0.0 libomxr_mc_ddd.so.2
+ ln -sf libomxr_mc_ddd.so.2.0.0 libomxr_mc_ddd.so
+ fi
+
+ # alac OMX
+ if [ "X${USE_ALAC_DECODER}" = "X1" ] ; then
+ ln -sf libomxr_mc_alacd.so.2.0.0 libomxr_mc_alacd.so.2
+ ln -sf libomxr_mc_alacd.so.2.0.0 libomxr_mc_alacd.so
+ fi
+
+ # flac OMX
+ if [ "X${USE_FLAC_DECODER}" = "X1" ] ; then
+ ln -sf libomxr_mc_flacd.so.2.0.0 libomxr_mc_flacd.so.2
+ ln -sf libomxr_mc_flacd.so.2.0.0 libomxr_mc_flacd.so
+ fi
+
+ # aac enc omx
+ if [ "X${USE_AAC_ENCODER}" = "X1" ] ; then
+ ln -sf libomxr_mc_aace.so.2.0.0 libomxr_mc_aace.so.2
+ ln -sf libomxr_mc_aace.so.2.0.0 libomxr_mc_aace.so
+ fi
+
+ # Copy all the symbolic link and lib to destination
+ cp -Prf ${S}/OMXR/lib/* ${D}/usr/local/lib
+
+ # Copy the audio midleware
+ # audio aacp2 midleware
+ if [ "X${ARMAACP2_MDW_DECODER}" = "X1" ] ; then
+ cd ${S}/audio_mdw
+ ln -sf libRSACPDLA_L.so.1.1 libRSACPDAL_L.so.1.1
+ ln -sf libRSACPDLA_L.so.1.1 libRSACPDLA_L.so.1
+ ln -sf libRSACPDLA_L.so.1.1 libRSACPDLA_L.so
+ ln -sf libRSACPDAL_L.so.1.1 libRSACPDAL_L.so.1
+ ln -sf libRSACPDAL_L.so.1.1 libRSACPDAL_L.so
+ cp -P ${S}/audio_mdw/*.so* ${D}/usr/local/lib/
+ cp -P ${S}/audio_mdw/RSACPD_ADL.h ${D}/usr/local/include
+ cp -P ${S}/audio_mdw/RSACPD_ADL.h ${STAGING_INCDIR}
+ fi
+
+ if [ "X${MP3_MDW_DECODER}" = "X1" ] ; then
+ cd ${S}/audio_mdw
+ ln -sf libMP3DLA_L.so.1.4 libMP3DLA_L.so.1
+ ln -sf libMP3DLA_L.so.1.4 libMP3DLA_L.so
+ cp -P ${S}/audio_mdw/*.so* ${D}/usr/local/lib/
+ cp -P ${S}/audio_mdw/mp3d_Lib.h ${D}/usr/local/include
+ cp -P ${S}/audio_mdw/mp3d_Lib.h ${STAGING_INCDIR}
+ fi
+
+ if [ "X${WMA_MDW_DECODER}" = "X1" ] ; then
+ cd ${S}/audio_mdw
+ ln -sf libWMASTDLA_L.so.1.3 libWMASTDLA_L.so.1
+ ln -sf libWMASTDLA_L.so.1.3 libWMASTDLA_L.so
+ cp -P ${S}/audio_mdw/*.so* ${D}/usr/local/lib/
+ cp -P ${S}/audio_mdw/wmastd_Lib.h ${D}/usr/local/include
+ cp -P ${S}/audio_mdw/wmastd_Lib.h ${STAGING_INCDIR}
+ fi
+
+ if [ "X${DDD_MDW_DECODER}" = "X1" ] ; then
+ cd ${S}/audio_mdw
+ ln -sf libRSDACDLA_L.so.1.0 libRSDACDLA_L.so.1
+ ln -sf libRSDACDLA_L.so.1.0 libRSDACDLA_L.so
+ cp -P ${S}/audio_mdw/*.so* ${D}/usr/local/lib/
+ cp -P ${S}/audio_mdw/RSDACD_ADL.h ${D}/usr/local/include
+ cp -P ${S}/audio_mdw/RSDACD_ADL.h ${STAGING_INCDIR}
+ fi
+
+ if [ "X${ALAC_MDW_DECODER}" = "X1" ] ; then
+ cd ${S}/audio_mdw
+ ln -sf libALACDLA_L.so.1.0 libALACDLA_L.so.1
+ ln -sf libALACDLA_L.so.1.0 libALACDLA_L.so
+ cp -P ${S}/audio_mdw/*.so* ${D}/usr/local/lib/
+ cp -P ${S}/audio_mdw/alacd_Lib.h ${D}/usr/local/include
+ cp -P ${S}/audio_mdw/alacd_Lib.h ${STAGING_INCDIR}
+ fi
+
+ if [ "X${FLAC_MDW_DECODER}" = "X1" ] ; then
+ cd ${S}/audio_mdw
+ ln -sf libFLACDLA_L.so.1.1 libFLACDLA_L.so.1
+ ln -sf libFLACDLA_L.so.1.1 libFLACDLA_L.so
+ cp -P ${S}/audio_mdw/*.so* ${D}/usr/local/lib/
+ cp -P ${S}/audio_mdw/flacd_Lib.h ${D}/usr/local/include
+ cp -P ${S}/audio_mdw/flacd_Lib.h ${STAGING_INCDIR}
+ fi
+
+ if [ "X${AAC_MDW_ENCODER}" = "X1" ] ; then
+ cd ${S}/audio_mdw
+ ln -sf libRSAACELA_L.so.2.1 libRSAACELA_L.so.2
+ ln -sf libRSAACELA_L.so.2.1 libRSAACELA_L.so
+ cp -P ${S}/audio_mdw/*.so* ${D}/usr/local/lib/
+ cp -P ${S}/audio_mdw/RSAACE_AAC.h ${D}/usr/local/include
+ cp -P ${S}/audio_mdw/RSAACE_AAC.h ${STAGING_INCDIR}
+ fi
+}
+
+do_install_append() {
+ if [ "X${MACHINE}" = "Xsilk" -o "X${MACHINE}" = "Xporter" ] ; then
+ cd ${S}/OMXR/lib/
+
+ ln -sf libomxr_core.so.0.0.0 libomxr_core.so.2.0.0
+ ln -sf libomxr_core.so.0.0.0 libomxr_core.so.0
+ ln -sf libomxr_mc_cmn.so.0.0.0 libomxr_mc_cmn.so.2.0.0
+ ln -sf libomxr_mc_h264d.so.0.0.0 libomxr_mc_h264d.so.2.0.0
+ ln -sf libomxr_mc_h264d.so.0.0.0 libomxr_mc_h264d.so.0
+ ln -sf libomxr_mc_h264e.so.0.0.0 libomxr_mc_h264e.so.2.0.0
+ ln -sf libomxr_mc_h264e.so.0.0.0 libomxr_mc_h264e.so.0
+ ln -sf libomxr_mc_vecmn.so.0.0.0 libomxr_mc_vecmn.so.2.0.0
+ ln -sf libomxr_mc_vcmn.so.0.0.0 libomxr_mc_vcmn.so.2.0.0
+ ln -sf libomxr_mc_vdcmn.so.0.0.0 libomxr_mc_vdcmn.so.2.0.0
+ ln -sf libuvcs_dec.so.0.0.0 libuvcs_dec.so.1.0.0
+ ln -sf libuvcs_enc.so.0.0.0 libuvcs_enc.so.1.0.0
+ ln -sf libvcp3_avcd.so.0.0.0 libvcp3_avcd.so.1.0.0
+ ln -sf libvcp3_avce.so.0.0.0 libvcp3_avce.so.1.0.0
+ ln -sf libvcp3_mcvd.so.0.0.0 libvcp3_mcvd.so.1.0.0
+ ln -sf libvcp3_mcve.so.0.0.0 libvcp3_mcve.so.1.0.0
+
+ # Copy all the symbolic link and lib to destination
+ cp -Prf ${S}/OMXR/lib/* ${D}/usr/local/lib
+ fi
+}
+
+SYSROOT_PREPROCESS_FUNCS += "do_populate_share_lib"
+
+do_populate_share_lib () {
+ sysroot_stage_dir ${D}/usr/local/lib ${SYSROOT_DESTDIR}/usr/lib
+}
+
+# Append function to clean extract source
+CLEANFUNCS += 'do_clean_sharedfiles'
+
+do_clean_sharedfiles() {
+ rm -f ${LIBSHARED}/libomxr_*.so*
+ rm -f ${LIBSHARED}/libuvcs*.so*
+ rm -f ${LIBSHARED}/libvcp3_*.so*
+ rm -f ${STAGING_INCDIR}/OMX_*.h
+ rm -f ${STAGING_INCDIR}/OMXR_*.h
+
+ rm -f ${LIBSHARED}/libRSACPDLA_L.so*
+ rm -f ${LIBSHARED}/libRSACPDAL_L.so*
+ rm -f ${STAGING_INCDIR}/RSACPD_ADL.h
+
+ rm -f ${LIBSHARED}/libMP3DLA_L.so*
+ rm -f ${STAGING_INCDIR}/mp3d_Lib.h
+
+ rm -f ${LIBSHARED}/libWMASTDLA_L.so*
+ rm -f ${STAGING_INCDIR}/wmastd_Lib.h
+
+ rm -f ${LIBSHARED}/libRSDACDLA_L.so*
+ rm -f ${STAGING_INCDIR}/RSDACD_ADL.h
+
+ rm -f ${LIBSHARED}/libALACDLA_L.so*
+ rm -f ${STAGING_INCDIR}/alacd_Lib.h
+
+ rm -f ${LIBSHARED}/libFLACDLA_L.so*
+ rm -f ${STAGING_INCDIR}/flacd_Lib.h
+
+ rm -f ${LIBSHARED}/libRSAACELA_L.so*
+ rm -f ${STAGING_INCDIR}/RSAACE_AAC.h
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+ ${PN}-staticdev \
+"
+
+FILES_${PN} = " \
+ /usr/local/lib/*.so \
+ /usr/local/lib/*.so.* \
+ /usr/local/config/* \
+"
+
+FILES_${PN}-dev = " \
+ /usr/local/include/* \
+"
+
+FILES_${PN}-staticdev = " \
+ /usr/local/lib/*.a \
+ /usr/local/lib/*.la \
+"
+
+INSANE_SKIP_${PN} += "rpaths"
+INSANE_SKIP_${PN} += "dev-so"
+INSANE_SKIP_${PN} += "libdir"
+INSANE_SKIP_${PN}-dev += "libdir"
+RPROVIDES_${PN} += "omx-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta-rcar-gen2/recipes-multimedia/packagegroups/packagegroup-rcar-gen2-multimedia.bb b/meta-rcar-gen2/recipes-multimedia/packagegroups/packagegroup-rcar-gen2-multimedia.bb
new file mode 100644
index 0000000..688c6b7
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/packagegroups/packagegroup-rcar-gen2-multimedia.bb
@@ -0,0 +1,69 @@
+require ../../include/gles-control.inc
+require ../../include/multimedia-control.inc
+
+DESCRIPTION = "Package Group for multimedia of R-Car Gen2"
+LICENSE = "CLOSED"
+
+inherit packagegroup
+
+PACKAGES = "\
+ packagegroup-rcar-gen2-multimedia \
+ packagegroup-rcar-gen2-multimedia-tp \
+ packagegroup-rcar-gen2-dtv \
+"
+
+MULTIMEDIA_PACKAGES ="\
+ mmngr-kernel-module mmngr-user-module \
+ mmngrbuf-kernel-module mmngrbuf-user-module \
+ mmngrbuf-user-module-dev \
+ fdpm-kernel-module fdpm-user-module \
+ vspm-kernel-module vspm-user-module \
+ s3ctl-kernel-module s3ctl-user-module \
+ uvcs-kernel-module omx-user-module \
+ libmemcpy \
+"
+
+RDEPENDS_packagegroup-rcar-gen2-multimedia = "\
+ ${@ "${MULTIMEDIA_PACKAGES}" if "${USE_MULTIMEDIA}" == "1" else "" } \
+ media-ctl \
+ gstreamer1.0-meta-base \
+ gstreamer1.0-meta-audio \
+ gstreamer1.0-meta-video \
+ gstreamer1.0-plugins-base-audioconvert \
+ gstreamer1.0-plugins-base-audioresample \
+ gstreamer1.0-plugins-base-playback \
+ gstreamer1.0-plugins-base-videoconvert \
+ gstreamer1.0-plugins-base-typefindfunctions \
+ gstreamer1.0-plugins-base-videoscale \
+ gstreamer1.0-plugins-good-avi \
+ gstreamer1.0-plugins-good-audioparsers \
+ gstreamer1.0-plugins-good-id3demux \
+ gstreamer1.0-plugins-bad-faad \
+ gstreamer1.0-plugins-bad-mpegtsdemux \
+ gstreamer1.0-plugins-bad-debugutilsbad \
+ ${@base_contains("LICENSE_FLAGS_WHITELIST", "commercial", "gstreamer1.0-omx gstreamer1.0-plugins-ugly-asf", "", d )} \
+ ${@base_conditional("USE_GLES_WAYLAND", "1", "gstreamer1.0-plugins-base-vspfilter", "", d )} \
+"
+
+MULTIMEDIA_TEST_PACKAGES = "\
+ ${MULTIMEDIA_PACKAGES} \
+ mmngr-tp-user-module \
+ mmngrbuf-tp-user-module \
+ fdpm-tp-user-module \
+ vspm-tp-user-module \
+ s3ctl-tp-user-module \
+"
+
+RDEPENDS_packagegroup-rcar-gen2-multimedia-tp = "\
+ ${@ '${MULTIMEDIA_TEST_PACKAGES}' if '${USE_MULTIMEDIA}' == '1' and '${USE_MULTIMEDIA_TEST}' == '1' else '' } \
+"
+
+DTV_PACKAGES = "\
+ ${MULTIMEDIA_PACKAGES} \
+ scu-kernel-module ssp-kernel-module \
+ dtv \
+"
+
+RDEPENDS_packagegroup-rcar-gen2-dtv = "\
+ ${@ '${DTV_PACKAGES}' if '${USE_DTV}' == '1' else '' } \
+"
diff --git a/meta-rcar-gen2/recipes-multimedia/packagegroups/packagegroup-rcar-gen2-multimedia.bbappend b/meta-rcar-gen2/recipes-multimedia/packagegroups/packagegroup-rcar-gen2-multimedia.bbappend
new file mode 100644
index 0000000..b74228d
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/packagegroups/packagegroup-rcar-gen2-multimedia.bbappend
@@ -0,0 +1,17 @@
+PACKAGES_append_silk = " packagegroup-lcb-oss-codecs"
+PACKAGES_append_porter = " packagegroup-lcb-oss-codecs"
+
+RDEPENDS_packagegroup-lcb-oss-codecs = "\
+ libmad \
+ lame \
+ faac \
+ faad2 \
+ libvorbis \
+ libogg \
+ gstreamer1.0-plugins-ugly-mad \
+ gstreamer1.0-plugins-ugly-lame \
+ gstreamer1.0-plugins-bad-faac \
+ gstreamer1.0-plugins-bad-faad \
+ gstreamer1.0-plugins-base-ogg \
+ gstreamer1.0-plugins-base-vorbis \
+"
diff --git a/meta-rcar-gen2/recipes-multimedia/s3ctl-module/files/.gitkeep b/meta-rcar-gen2/recipes-multimedia/s3ctl-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/s3ctl-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-multimedia/s3ctl-module/s3ctl-tp-user-module.bb b/meta-rcar-gen2/recipes-multimedia/s3ctl-module/s3ctl-tp-user-module.bb
new file mode 100644
index 0000000..3fcc5ad
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/s3ctl-module/s3ctl-tp-user-module.bb
@@ -0,0 +1,32 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "CLOSED"
+DEPENDS = "s3ctl-kernel-module s3ctl-user-module"
+SRC_URI = "file://s3ctl-tp-user.tar.bz2"
+S = "${WORKDIR}/s3ctl"
+
+do_compile() {
+ # Build user test program
+ cd ${S}
+ make all ARCH=arm
+}
+
+do_install() {
+ # Create shared folder
+ mkdir -p ${D}/usr/local/bin/
+ # Copy user test program
+ cp ${S}/s3tp ${D}/usr/local/bin/
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+ ${PN}-dbg \
+"
+
+FILES_${PN} = " \
+ /usr/local/bin/s3tp \
+"
+
+RPROVIDES_${PN} += "s3ctl-tp-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta-rcar-gen2/recipes-multimedia/s3ctl-module/s3ctl-user-module.bb b/meta-rcar-gen2/recipes-multimedia/s3ctl-module/s3ctl-user-module.bb
new file mode 100644
index 0000000..ed02e0a
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/s3ctl-module/s3ctl-user-module.bb
@@ -0,0 +1,64 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "CLOSED"
+DEPENDS = "s3ctl-kernel-module"
+PN = "s3ctl-user-module"
+PR = "r0"
+SRC_URI = "file://s3ctl.tar.bz2"
+
+S = "${WORKDIR}/s3ctl"
+
+do_compile() {
+ # Build shared library
+ cd ${S}/if
+ rm -rf libs3ctl.so*
+ make all ARCH=arm
+ # Copy shared library for reference from other modules
+ cp -P ${S}/if/libs3ctl.so* ${LIBSHARED}
+}
+
+do_install() {
+ # Create shared folder
+ mkdir -p ${D}/usr/local/lib/ ${D}/usr/local/include/
+ # Copy share library
+ cp -P ${S}/if/libs3ctl.so* ${D}/usr/local/lib/
+ # Copy shared header files
+ cp -f ${BUILDDIR}/include/s3ctl_user_public.h ${D}/usr/local/include/
+ cp -f ${BUILDDIR}/include/s3ctl_user_private.h ${D}/usr/local/include/
+}
+
+# Append function to clean extract source
+do_cleansstate_prepend() {
+ bb.build.exec_func('do_clean_source', d)
+}
+
+do_clean_source() {
+ rm -f ${LIBSHARED}/libs3ctl.so*
+ rm -f ${BUILDDIR}/include/s3ctl_user_public.h
+ rm -f ${BUILDDIR}/include/s3ctl_user_private.h
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /usr/local/lib/libs3ctl.so.* \
+"
+
+FILES_${PN}-dev = " \
+ /usr/local/lib/libs3ctl.so \
+ /usr/local/include/*.h \
+"
+
+RPROVIDES_${PN} += "s3ctl-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INSANE_SKIP_${PN} += "libdir"
+INSANE_SKIP_${PN}-dev += "libdir"
+
+do_configure[noexec] = "1"
+
+python do_package_ipk_prepend () {
+ d.setVar('ALLOW_EMPTY', '1')
+}
diff --git a/meta-rcar-gen2/recipes-multimedia/v4l2apps/media-ctl_git.bbappend b/meta-rcar-gen2/recipes-multimedia/v4l2apps/media-ctl_git.bbappend
new file mode 100644
index 0000000..aeb591c
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/v4l2apps/media-ctl_git.bbappend
@@ -0,0 +1,2 @@
+SRCREV = "114c1b274edc40e07e9b99a435d26438f5b99943"
+PV = "0.0.1+git${SRCPV}"
diff --git a/meta-rcar-gen2/recipes-multimedia/vspm-module/files/.gitkeep b/meta-rcar-gen2/recipes-multimedia/vspm-module/files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/vspm-module/files/.gitkeep
diff --git a/meta-rcar-gen2/recipes-multimedia/vspm-module/vspm-tp-user-module.bb b/meta-rcar-gen2/recipes-multimedia/vspm-module/vspm-tp-user-module.bb
new file mode 100644
index 0000000..b7b97a0
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/vspm-module/vspm-tp-user-module.bb
@@ -0,0 +1,29 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "CLOSED"
+DEPENDS = "vspm-user-module mmngr-user-module"
+SRC_URI = "file://vspm-tp-user.tar.bz2"
+S = "${WORKDIR}"
+
+do_compile() {
+ cd ${S}/vspm/
+ make all ARCH=arm
+}
+
+do_install() {
+ # Create destination folder
+ mkdir -p ${D}/usr/local/bin/
+
+ # Copy user test program
+ cp ${S}/vspm/vspm_tp ${D}/usr/local/bin/
+}
+
+PACKAGES = "\
+ ${PN} \
+"
+FILES_${PN} = " \
+ /usr/local/bin/vspm_tp \
+"
+
+RPROVIDES_${PN} += "vspm-tp-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta-rcar-gen2/recipes-multimedia/vspm-module/vspm-user-module.bb b/meta-rcar-gen2/recipes-multimedia/vspm-module/vspm-user-module.bb
new file mode 100644
index 0000000..3327861
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/vspm-module/vspm-user-module.bb
@@ -0,0 +1,58 @@
+require ../../include/rcar-gen2-modules-common.inc
+
+LICENSE = "CLOSED"
+DEPENDS = "vspm-kernel-module"
+PN = "vspm-user-module"
+PR = "r0"
+SRC_URI = "file://vspm-user.tar.bz2"
+
+S = "${WORKDIR}"
+
+do_compile() {
+ # Build shared library
+ cd ${S}/vspm/if
+ rm -rf ${S}/vspm/if/libvspm.so*
+ make all ARCH=arm
+ # Copy shared library for reference from other modules
+ cp -P ${S}/vspm/if/libvspm.so* ${LIBSHARED}
+}
+
+do_install() {
+ # Create destination folder
+ mkdir -p ${D}/usr/local/lib/ ${D}/usr/local/include
+ # Copy shared library
+ cp -P ${S}/vspm/if/libvspm.so* ${D}/usr/local/lib/
+ # Copy shared header files
+ cp -f ${BUILDDIR}/include/vspm_public.h ${D}/usr/local/include
+ cp -f ${BUILDDIR}/include/vsp_drv.h ${D}/usr/local/include
+ cp -f ${BUILDDIR}/include/tddmac_drv.h ${D}/usr/local/include
+}
+
+do_clean_source() {
+ rm -f ${LIBSHARED}/libvspm.so*
+ rm -f ${BUILDDIR}/include/vspm_public.h
+ rm -f ${BUILDDIR}/include/vsp_drv.h
+ rm -f ${BUILDDIR}/include/tddmac_drv.h
+}
+
+PACKAGES = "\
+ ${PN} \
+ ${PN}-dev \
+"
+
+FILES_${PN} = " \
+ /usr/local/lib/libvspm.so.* \
+"
+
+FILES_${PN}-dev = " \
+ /usr/local/lib \
+ /usr/local/lib/libvspm.so \
+ /usr/local/lib/* \
+ /usr/local/include \
+ /usr/local/include/*.h \
+"
+
+RPROVIDES_${PN} += "vspm-user-module"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INSANE_SKIP_${PN} += "libdir"
+INSANE_SKIP_${PN}-dev += "libdir"