mirror of
https://github.com/revyos/thead-kernel.git
synced 2026-06-21 17:22:24 +02:00
Compare commits
244 Commits
Linux_SDK_
...
merged-ahe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75644d241a | ||
|
|
6cf922369e | ||
|
|
63d7efb218 | ||
|
|
b566649fe7 | ||
|
|
b2ea2ca49f | ||
|
|
ec48e278dc | ||
|
|
e15402b7ab | ||
|
|
bbf24fc7fa | ||
|
|
2030eb1b71 | ||
|
|
bc4c98ebd7 | ||
|
|
1b0b255060 | ||
|
|
8b9aa1faa1 | ||
|
|
aee62929de | ||
|
|
3478bb910d | ||
|
|
e95535c32a | ||
|
|
90bcc90cb8 | ||
|
|
833d4accd7 | ||
|
|
fa953236e1 | ||
|
|
71b7c456fa | ||
|
|
84b184c6c3 | ||
|
|
1223f3c597 | ||
|
|
1881bc9051 | ||
|
|
a86c91b80b | ||
|
|
b65595ebbc | ||
|
|
c6d4e5df18 | ||
|
|
931828f822 | ||
|
|
a637afb34d | ||
|
|
6563ff55d9 | ||
|
|
a3383ac8be | ||
|
|
0808b41c96 | ||
|
|
dda416a8b2 | ||
|
|
618138e424 | ||
|
|
82c0c62303 | ||
|
|
061f7f8738 | ||
|
|
1f1380d124 | ||
|
|
c75d368ffa | ||
|
|
7989ccb780 | ||
|
|
bcb9ecc2c3 | ||
|
|
3eee2bf4d2 | ||
|
|
6b9b37135d | ||
|
|
93bec7933c | ||
|
|
6f712a1d7f | ||
|
|
40d4663361 | ||
|
|
9443deb7d4 | ||
|
|
ffab133a52 | ||
|
|
8c67a7d26b | ||
|
|
384c5e9e27 | ||
|
|
1d7ed6a0c6 | ||
|
|
a546653719 | ||
|
|
2ab5512161 | ||
|
|
05c3f803b9 | ||
|
|
a6630353d8 | ||
|
|
11046edaf7 | ||
|
|
a695d43115 | ||
|
|
d4c68ef2c1 | ||
|
|
e17ac7bab2 | ||
|
|
2bd2eac4a7 | ||
|
|
6a61ffb0b6 | ||
|
|
6bb5a30b0e | ||
|
|
6bafa84231 | ||
|
|
593e484dbb | ||
|
|
108fcf335e | ||
|
|
5441a6d3e1 | ||
|
|
117a49c9b2 | ||
|
|
ceed3702cd | ||
|
|
274a4b08dd | ||
|
|
2c9ad71844 | ||
|
|
fa040f74fb | ||
|
|
37075d067b | ||
|
|
14763fe34c | ||
|
|
3c3d82b1e9 | ||
|
|
633d39c11d | ||
|
|
25fc785ecc | ||
|
|
d49c77423a | ||
|
|
31b8e1e375 | ||
|
|
3a6df042b4 | ||
|
|
f32b30324f | ||
|
|
1fd93bc1a9 | ||
|
|
b8c5d35460 | ||
|
|
afcdc418d4 | ||
|
|
d6f09caa32 | ||
|
|
727e6f3be6 | ||
|
|
2f78e6b748 | ||
|
|
cfe4413691 | ||
|
|
373e8161c5 | ||
|
|
9ba56a64a8 | ||
|
|
ad542ee013 | ||
|
|
e44f708a9e | ||
|
|
ccbbd8ae8f | ||
|
|
e286235a75 | ||
|
|
e084b32587 | ||
|
|
880ab177a1 | ||
|
|
c32beb855f | ||
|
|
8304fb3b0e | ||
|
|
51464f6592 | ||
|
|
f87b29df53 | ||
|
|
c71d194901 | ||
|
|
dc96c0fe68 | ||
|
|
5ffd7f5029 | ||
|
|
0f89c7db16 | ||
|
|
4a4a708db1 | ||
|
|
255c988024 | ||
|
|
af2602ac87 | ||
|
|
b6d74c3560 | ||
|
|
8f3347a598 | ||
|
|
9aa4002cc9 | ||
|
|
e025348004 | ||
|
|
58f804da14 | ||
|
|
277f5bc2bc | ||
|
|
2dc08a7dac | ||
|
|
05735e9ff4 | ||
|
|
d81a2398a8 | ||
|
|
e133903e4d | ||
|
|
8b4bca072c | ||
|
|
026ae08e53 | ||
|
|
95a545985b | ||
|
|
f722795a38 | ||
|
|
06bd593cfd | ||
|
|
556f057aca | ||
|
|
186355454e | ||
|
|
b25b9b6b16 | ||
|
|
35a32afaf8 | ||
|
|
3e042d29a3 | ||
|
|
c32ad7b836 | ||
|
|
99a459c9f7 | ||
|
|
c10fdb081d | ||
|
|
e3b22dbe54 | ||
|
|
b9526ccc12 | ||
|
|
f05fed4b3a | ||
|
|
3e8db613d4 | ||
|
|
e04af8ab30 | ||
|
|
a29e54cb02 | ||
|
|
fe82c45483 | ||
|
|
c64537c234 | ||
|
|
e0b5c2d836 | ||
|
|
65d28e339c | ||
|
|
383394d925 | ||
|
|
76d072714b | ||
|
|
f107c010f0 | ||
|
|
21488b4bba | ||
|
|
4090089096 | ||
|
|
48d0bea232 | ||
|
|
0f0b0abd92 | ||
|
|
2864ff8827 | ||
|
|
3b1e9db0d7 | ||
|
|
d7048c221b | ||
|
|
d92a0f15a5 | ||
|
|
e4706a16f3 | ||
|
|
34157258d7 | ||
|
|
825f6a577e | ||
|
|
f0fba63d97 | ||
|
|
790c65208f | ||
|
|
4f4ed3f042 | ||
|
|
4d4f6ba338 | ||
|
|
40ef3b0976 | ||
|
|
921113dc1d | ||
|
|
296d3dc80c | ||
|
|
d592c8d305 | ||
|
|
8d34c4a386 | ||
|
|
2360026a43 | ||
|
|
dd0b44d681 | ||
|
|
3366ec3f14 | ||
|
|
c2bb75e485 | ||
|
|
a854067698 | ||
|
|
580ea36ab7 | ||
|
|
2fac2fed77 | ||
|
|
ac080f0f32 | ||
|
|
22994ee8fd | ||
|
|
dd5c99c459 | ||
|
|
798c6e25dc | ||
|
|
ed4a257bd1 | ||
|
|
052b22ef8b | ||
|
|
cc197e94ce | ||
|
|
46e0a824e1 | ||
|
|
f72e7cd077 | ||
|
|
807db9d981 | ||
|
|
07167b855f | ||
|
|
342da2ebbd | ||
|
|
0504ee67e5 | ||
|
|
4d36214794 | ||
|
|
8e0c3eb23d | ||
|
|
3e585776f5 | ||
|
|
afef388b8e | ||
|
|
a26b2d282c | ||
|
|
0bd99ce376 | ||
|
|
3ddef5a969 | ||
|
|
8b0b779b76 | ||
|
|
c70e925ac5 | ||
|
|
c130cdb21f | ||
|
|
765b9ada52 | ||
|
|
8631d2c44f | ||
|
|
c56347a43e | ||
|
|
827be31621 | ||
|
|
8eac2d9ff9 | ||
|
|
d2d4e58f6d | ||
|
|
3360d12ccb | ||
|
|
c99828ab6f | ||
|
|
7d38ead3b4 | ||
|
|
66f9d7c397 | ||
|
|
9e49618e75 | ||
|
|
6324bd2198 | ||
|
|
16fdf152d1 | ||
|
|
0683ead841 | ||
|
|
1dd9935a28 | ||
|
|
b989adf3aa | ||
|
|
8cf226ab71 | ||
|
|
42de796933 | ||
|
|
387b686325 | ||
|
|
7a3658a807 | ||
|
|
7feb2daff6 | ||
|
|
0a18500133 | ||
|
|
87260fc991 | ||
|
|
772a291a5a | ||
|
|
77c3f5c0d0 | ||
|
|
3eeff2b39d | ||
|
|
06b8b8d9f0 | ||
|
|
9c58afc7ad | ||
|
|
ded657fd09 | ||
|
|
93e7aec675 | ||
|
|
231409c0ed | ||
|
|
1c1a707b48 | ||
|
|
7a1ebd4adb | ||
|
|
b4474f7737 | ||
|
|
bb4691fe55 | ||
|
|
0fcd24710d | ||
|
|
e495db816c | ||
|
|
0b23488d7c | ||
|
|
f158bc369f | ||
|
|
a396c98059 | ||
|
|
ca43e11e3d | ||
|
|
135fd54dd3 | ||
|
|
493de61386 | ||
|
|
3d7b6b56c3 | ||
|
|
5d620ffde0 | ||
|
|
2a5d72be62 | ||
|
|
8688f6fac3 | ||
|
|
fba465199e | ||
|
|
7b352f5ac2 | ||
|
|
3a0e6fabe8 | ||
|
|
5e2a0b4b3a | ||
|
|
d01df48030 | ||
|
|
29f55ef165 | ||
|
|
3024960f77 | ||
|
|
e042a6fabe |
97
.github/workflows/kernel.yml
vendored
Normal file
97
.github/workflows/kernel.yml
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
name: revyos-kernel-build
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 2 * * *"
|
||||
|
||||
env:
|
||||
xuantie_toolchain: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1705395627867
|
||||
toolchain_file_name: Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.1-20240115.tar.gz
|
||||
mainline_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.03.01
|
||||
mainline_toolchain_file_name: riscv64-glibc-ubuntu-22.04-gcc-nightly-2024.03.01-nightly.tar.gz
|
||||
wget_alias: 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0'
|
||||
ARCH: riscv
|
||||
board: th1520
|
||||
KBUILD_BUILD_USER: builder
|
||||
KBUILD_BUILD_HOST: revyos-riscv-builder
|
||||
KDEB_COMPRESS: none
|
||||
KDEB_CHANGELOG_DIST: unstable
|
||||
|
||||
jobs:
|
||||
kernel:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: gcc-13
|
||||
cross: riscv64-unknown-linux-gnu-
|
||||
machine: ubuntu-22.04
|
||||
run_image: ghcr.io/revyos/revyos-kernel-builder:amd64-2024.04.02
|
||||
- name: thead-gcc
|
||||
cross: riscv64-unknown-linux-gnu-
|
||||
machine: ubuntu-22.04
|
||||
run_image: ghcr.io/revyos/revyos-kernel-builder:amd64-2024.04.02
|
||||
- name: native
|
||||
cross: riscv64-linux-gnu-
|
||||
machine: [ self-hosted, Linux, riscv64 ]
|
||||
run_image: ghcr.io/revyos/revyos-kernel-builder:riscv64-2024.04.02
|
||||
|
||||
runs-on: ${{ matrix.machine }}
|
||||
container:
|
||||
image: ${{ matrix.run_image }}
|
||||
env:
|
||||
CROSS_COMPILE: ${{ matrix.cross }}
|
||||
|
||||
steps:
|
||||
- name: Checkout kernel
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'kernel'
|
||||
|
||||
- name: Compile Kernel && Install
|
||||
run: |
|
||||
mkdir -p rootfs
|
||||
if [[ ${{ matrix.name }} = "thead-gcc" ]]; then
|
||||
${wget_alias} ${xuantie_toolchain}/${toolchain_file_name}
|
||||
tar -xvf ${toolchain_file_name} -C /opt
|
||||
export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.1/bin:$PATH"
|
||||
elif [[ ${{ matrix.name }} = "gcc-13" ]]; then
|
||||
${wget_alias} ${mainline_toolchain}/${mainline_toolchain_file_name}
|
||||
tar -xvf ${mainline_toolchain_file_name} -C /opt
|
||||
export PATH="/opt/riscv/bin:$PATH"
|
||||
else
|
||||
echo "No download toolchain."
|
||||
fi
|
||||
${CROSS_COMPILE}gcc -v
|
||||
|
||||
pushd kernel
|
||||
make revyos_defconfig
|
||||
export KDEB_PKGVERSION="$(make kernelversion)-$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)"
|
||||
sed -i '/CONFIG_LOCALVERSION_AUTO/d' .config && echo "CONFIG_LOCALVERSION_AUTO=n" >> .config
|
||||
cat .config | grep "CONFIG_THEAD_ISA"
|
||||
if [ `uname -m` = "riscv64" ]; then
|
||||
# FIXME: force use 32 thread
|
||||
make -j32 bindeb-pkg LOCALVERSION="-${board}"
|
||||
else
|
||||
make -j$(nproc) bindeb-pkg LOCALVERSION="-${board}"
|
||||
fi
|
||||
|
||||
# Copy deb
|
||||
dcmd cp -v ../*.changes ${GITHUB_WORKSPACE}/rootfs/
|
||||
|
||||
# record commit-id
|
||||
git rev-parse HEAD > kernel-commitid
|
||||
cp -v kernel-commitid ${GITHUB_WORKSPACE}/rootfs/
|
||||
|
||||
ls -al ${GITHUB_WORKSPACE}/rootfs/
|
||||
popd
|
||||
|
||||
- name: 'Upload Artifact'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: thead-kernel-${{ matrix.name }}
|
||||
path: rootfs/*
|
||||
retention-days: 30
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -18,6 +18,7 @@
|
||||
*.c.[012]*.*
|
||||
*.dt.yaml
|
||||
*.dtb
|
||||
*.dtbo
|
||||
*.dtb.S
|
||||
*.dwo
|
||||
*.elf
|
||||
|
||||
3
Makefile
3
Makefile
@@ -480,6 +480,8 @@ LZ4 = lz4
|
||||
XZ = xz
|
||||
ZSTD = zstd
|
||||
|
||||
PAHOLE_FLAGS = $(shell PAHOLE=$(PAHOLE) $(srctree)/scripts/pahole-flags.sh)
|
||||
|
||||
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
|
||||
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
|
||||
NOSTDINC_FLAGS :=
|
||||
@@ -534,6 +536,7 @@ export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
|
||||
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
|
||||
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
|
||||
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
|
||||
export PAHOLE_FLAGS
|
||||
|
||||
# Files to ignore in find ... statements
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ config RISCV
|
||||
select ARCH_HAS_DEBUG_VM_PGTABLE
|
||||
select ARCH_HAS_DEBUG_VIRTUAL if MMU
|
||||
select ARCH_HAS_DEBUG_WX
|
||||
select ARCH_HAS_FAST_MULTIPLIER
|
||||
select ARCH_HAS_GCOV_PROFILE_ALL
|
||||
select ARCH_HAS_GIGANTIC_PAGE
|
||||
select ARCH_HAS_KCOV
|
||||
@@ -34,6 +35,7 @@ config RISCV
|
||||
select ARCH_KEEP_MEMBLOCK
|
||||
select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
|
||||
select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
|
||||
select ARCH_USE_CMPXCHG_LOCKREF
|
||||
select ARCH_USE_QUEUED_SPINLOCKS
|
||||
select ARCH_USE_QUEUED_RWLOCKS
|
||||
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
|
||||
@@ -393,45 +395,19 @@ config FPU
|
||||
If you don't know what to do here, say Y.
|
||||
|
||||
config VECTOR
|
||||
bool "VECTOR support"
|
||||
default n
|
||||
|
||||
choice VECTOR_VERSION
|
||||
prompt "Vector Version"
|
||||
depends on VECTOR
|
||||
default VECTOR_1_0
|
||||
|
||||
config VECTOR_1_0
|
||||
bool "VECTOR 1.0 support"
|
||||
help
|
||||
Say N here if you want to disable all vector 1.0 related procedure
|
||||
in the kernel.
|
||||
|
||||
If you don't know what to do here, say Y.
|
||||
|
||||
config VECTOR_0_7
|
||||
bool "VECTOR 0.7 support"
|
||||
default y
|
||||
help
|
||||
Say N here if you want to disable all vector 0.7 related procedure
|
||||
in the kernel.
|
||||
|
||||
If you don't know what to do here, say Y.
|
||||
|
||||
endchoice
|
||||
|
||||
config VLEN_256
|
||||
bool "VECTOR VLEN 256"
|
||||
depends on VECTOR
|
||||
default n
|
||||
|
||||
config VECTOR_EMU
|
||||
bool "VECTOR e64 emulate for c906 v1"
|
||||
depends on VECTOR
|
||||
default n
|
||||
|
||||
config THEAD_ISA
|
||||
bool "T-HEAD extension ISA in AFLAGS with -march=_xtheadc"
|
||||
default n
|
||||
default y
|
||||
help
|
||||
Say N here if you want to disable xtheadc in the kernel.
|
||||
|
||||
endmenu
|
||||
|
||||
|
||||
@@ -48,25 +48,25 @@ endif
|
||||
endif
|
||||
|
||||
# ISA string setting
|
||||
riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima
|
||||
riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima
|
||||
riscv-march-$(CONFIG_FPU) := $(riscv-march-y)fd
|
||||
riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c
|
||||
|
||||
# Fix mainline build
|
||||
toolchain-have-v0p7 := $(call cc-option-yn, -march=$(riscv-march-y)v0p7)
|
||||
riscv-march-$(toolchain-have-v0p7) := $(riscv-march-y)v0p7
|
||||
|
||||
toolchain-have-xtheadc := $(call cc-option-yn, -march=$(riscv-march-y)_xtheadc)
|
||||
riscv-march-$(toolchain-have-xtheadc) := $(riscv-march-y)_xtheadc
|
||||
|
||||
# Newer binutils versions default to ISA spec version 20191213 which moves some
|
||||
# instructions from the I extension to the Zicsr and Zifencei extensions.
|
||||
toolchain-need-zicsr-zifencei := $(call cc-option-yn, -march=$(riscv-march-y)_zicsr_zifencei)
|
||||
riscv-march-$(toolchain-need-zicsr-zifencei) := $(riscv-march-y)_zicsr_zifencei
|
||||
|
||||
riscv-march-cflags-$(CONFIG_ARCH_RV32I) := rv32ima
|
||||
riscv-march-cflags-$(CONFIG_ARCH_RV64I) := rv64ima
|
||||
riscv-march-cflags-$(CONFIG_RISCV_ISA_C) := $(riscv-march-cflags-y)c
|
||||
|
||||
riscv-march-aflags-$(CONFIG_ARCH_RV32I) := rv32ima
|
||||
riscv-march-aflags-$(CONFIG_ARCH_RV64I) := rv64ima
|
||||
riscv-march-aflags-$(CONFIG_FPU) := $(riscv-march-aflags-y)fd
|
||||
riscv-march-aflags-$(CONFIG_RISCV_ISA_C) := $(riscv-march-aflags-y)c
|
||||
riscv-march-aflags-$(CONFIG_VECTOR_1_0) := $(riscv-march-aflags-y)v
|
||||
riscv-march-aflags-$(CONFIG_VECTOR_0_7) := $(riscv-march-aflags-y)v0p7
|
||||
riscv-march-aflags-$(CONFIG_THEAD_ISA) := $(riscv-march-aflags-y)_xtheadc
|
||||
|
||||
KBUILD_CFLAGS += -march=$(riscv-march-cflags-y) -Wa,-march=$(riscv-march-aflags-y)
|
||||
KBUILD_AFLAGS += -march=$(riscv-march-aflags-y)
|
||||
KBUILD_CFLAGS += -march=$(subst _xtheadc,,$(subst v0p7,,$(subst fd,,$(riscv-march-y))))
|
||||
KBUILD_AFLAGS += -march=$(riscv-march-y)
|
||||
|
||||
KBUILD_CFLAGS += -mno-save-restore
|
||||
KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET)
|
||||
@@ -124,7 +124,7 @@ endif
|
||||
ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_KENDRYTE),yy)
|
||||
KBUILD_IMAGE := $(boot)/loader.bin
|
||||
else
|
||||
KBUILD_IMAGE := $(boot)/Image.gz
|
||||
KBUILD_IMAGE := $(boot)/Image
|
||||
endif
|
||||
BOOT_TARGETS := Image Image.gz loader loader.bin
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ifeq ($(CONFIG_OF_OVERLAY),y)
|
||||
DTC_FLAGS += -@
|
||||
endif
|
||||
|
||||
subdir-y += sifive
|
||||
subdir-y += kendryte
|
||||
subdir-y += thead
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ifeq ($(CONFIG_OF_OVERLAY),y)
|
||||
DTC_FLAGS += -@
|
||||
endif
|
||||
|
||||
dtb-$(CONFIG_SOC_THEAD_ICE) += ice.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD_TH1520_MPW) += th1520_mpw.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD_TH1520_EMU) += th1520-fm-emu.dtb
|
||||
@@ -49,3 +54,26 @@ dtb-$(CONFIG_SOC_THEAD_TH1520_ANDROID) += th1520-a-val-android.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD_FIRE) += fire-emu.dtb fire-emu-crash.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD_FIRE) += fire-emu-soc-base.dtb fire-emu-soc-c910x4.dtb fire-emu-gpu-dpu-dsi0.dtb fire-emu-vi-dsp-vo.dtb fire-emu-vi-vp-vo.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD_FIRE) += fire-emu-soc-base-sec.dtb
|
||||
|
||||
dtb-$(CONFIG_SOC_THEAD) += th1520-beagle.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD) += th1520-lpi4a-16gb.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD) += th1520-lpi4a-laptop.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD) += th1520-lpi4a-console.dtb th1520-lpi4a-console-16g.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD) += th1520-lpi4a-cluster.dtb th1520-lpi4a-cluster-16gb.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD) += th1520-lpi4a-z14inch-m0.dtb th1520-lpi4a-z14inch-m0-16g.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD) += th1520-milkv-meles.dtb th1520-milkv-meles-4g.dtb th1520-milkv-meles-dsi0.dtb
|
||||
|
||||
# compat old name
|
||||
dtb-$(CONFIG_SOC_THEAD) += light-lpi4a.dtb light-lpi4a-16gb.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD) += light-lpi4a-console.dtb light-lpi4a-console-16g.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD) += light-beagle.dtb
|
||||
|
||||
# compat mainline name
|
||||
dtb-$(CONFIG_SOC_THEAD) += th1520-lichee-pi-4a.dtb th1520-lichee-pi-4a-16g.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD) += th1520-lichee-cluster-4a.dtb th1520-lichee-cluster-4a-16g.dtb
|
||||
dtb-$(CONFIG_SOC_THEAD) += th1520-beaglev-ahead.dtb
|
||||
|
||||
targets += dtbs dtbs_install
|
||||
targets += $(dtb-y)
|
||||
|
||||
subdir-y := overlays
|
||||
|
||||
6
arch/riscv/boot/dts/thead/light-beagle.dts
Normal file
6
arch/riscv/boot/dts/thead/light-beagle.dts
Normal file
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2024 ISCAS.
|
||||
*/
|
||||
|
||||
#include "th1520-beagle.dts"
|
||||
6
arch/riscv/boot/dts/thead/light-lpi4a-16gb.dts
Normal file
6
arch/riscv/boot/dts/thead/light-lpi4a-16gb.dts
Normal file
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2024 ISCAS.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-16gb.dts"
|
||||
6
arch/riscv/boot/dts/thead/light-lpi4a-console-16g.dts
Normal file
6
arch/riscv/boot/dts/thead/light-lpi4a-console-16g.dts
Normal file
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2024 ISCAS.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-console-16g.dts"
|
||||
6
arch/riscv/boot/dts/thead/light-lpi4a-console.dts
Normal file
6
arch/riscv/boot/dts/thead/light-lpi4a-console.dts
Normal file
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2024 ISCAS.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-console.dts"
|
||||
6
arch/riscv/boot/dts/thead/light-lpi4a.dts
Normal file
6
arch/riscv/boot/dts/thead/light-lpi4a.dts
Normal file
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2024 ISCAS.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-product.dts"
|
||||
71
arch/riscv/boot/dts/thead/overlays/BBORG_LOAD-00A2.dts
Normal file
71
arch/riscv/boot/dts/thead/overlays/BBORG_LOAD-00A2.dts
Normal file
@@ -0,0 +1,71 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (C) 2020 - 2022 Deepak Khatri <lorforlinux@beagleboard.org>
|
||||
* See Cape Interface Spec page for more info on Bone Buses
|
||||
* https://docs.beagleboard.org/0.0/boards/capes/cape-interface-spec.html#beaglebone-cape-interface-spec
|
||||
*
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/*
|
||||
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
|
||||
*/
|
||||
&{/chosen} {
|
||||
overlays {
|
||||
BBORG_LOAD-00A2 = __TIMESTAMP__;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Easy load control through sysfs (/sys/class/leds/) using gpio-leds driver
|
||||
*/
|
||||
|
||||
&bone_led_P9_42 {
|
||||
status = "okay";
|
||||
label = "load-sink1";
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
&bone_led_P9_41 {
|
||||
status = "okay";
|
||||
label = "load-sink2";
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
&bone_led_P9_30 {
|
||||
status = "okay";
|
||||
label = "load-sink3";
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
&bone_led_P9_27 {
|
||||
status = "okay";
|
||||
label = "load-sink4";
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
&bone_led_P8_12 {
|
||||
status = "okay";
|
||||
label = "load-sink5";
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
&bone_led_P8_11 {
|
||||
status = "okay";
|
||||
label = "load-sink6";
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
&bone_led_P8_15 {
|
||||
status = "okay";
|
||||
label = "load-sink7";
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
&bone_led_P8_17 {
|
||||
status = "okay";
|
||||
label = "load-sink8";
|
||||
default-state = "keep";
|
||||
};
|
||||
58
arch/riscv/boot/dts/thead/overlays/BBORG_RELAY-00A2.dts
Normal file
58
arch/riscv/boot/dts/thead/overlays/BBORG_RELAY-00A2.dts
Normal file
@@ -0,0 +1,58 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (C) 2015 Robert Nelson <robertcnelson@gmail.com>
|
||||
* Copyright (C) 2019 Amilcar Lucas <amilcar.lucas@iav.de>
|
||||
* Copyright (C) 2020 - 2023 Deepak Khatri <lorforlinux@beagleboard.org>
|
||||
*
|
||||
* See Cape Interface Spec page for more info on Bone Buses
|
||||
* https://docs.beagleboard.org/0.0/boards/capes/cape-interface-spec.html#beaglebone-cape-interface-spec
|
||||
*
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/*
|
||||
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
|
||||
*/
|
||||
&{/chosen} {
|
||||
overlays {
|
||||
BBORG_RELAY-00A2.kernel = __TIMESTAMP__;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Easy load control through sysfs (/sys/class/leds/) using gpio-leds driver
|
||||
*/
|
||||
|
||||
// relay1
|
||||
&bone_led_P9_41 {
|
||||
status = "okay";
|
||||
// access: sys/class/leds/relay1
|
||||
label = "relay1";
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
// relay2
|
||||
&bone_led_P9_42 {
|
||||
status = "okay";
|
||||
// access: sys/class/leds/relay2
|
||||
label = "relay2";
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
// realy3
|
||||
&bone_led_P9_30 {
|
||||
status = "okay";
|
||||
// access: sys/class/leds/relay3
|
||||
label = "relay3";
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
// realy4
|
||||
&bone_led_P9_27 {
|
||||
status = "okay";
|
||||
// access: sys/class/leds/relay4
|
||||
label = "relay4";
|
||||
default-state = "keep";
|
||||
};
|
||||
32
arch/riscv/boot/dts/thead/overlays/BONE-LED_P8_03.dts
Normal file
32
arch/riscv/boot/dts/thead/overlays/BONE-LED_P8_03.dts
Normal file
@@ -0,0 +1,32 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (C) 2020 - 2022 Deepak Khatri <lorforlinux@beagleboard.org>
|
||||
*
|
||||
* See Cape Interface Spec page for more info on Bone Buses
|
||||
* https://docs.beagleboard.org/0.0/boards/capes/cape-interface-spec.html#beaglebone-cape-interface-spec
|
||||
*
|
||||
* Virtual cape for LED on P8_03
|
||||
* Supports BBB, BBBWL, BBAI, and BBAI-64
|
||||
*
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
&{/chosen} {
|
||||
overlays {
|
||||
BONE-LED_P8_03 = __TIMESTAMP__;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Easy LED control through sysfs (/sys/class/leds/) using gpio-leds driver
|
||||
*/
|
||||
|
||||
&bone_led_P8_03 {
|
||||
status = "okay";
|
||||
// access: sys/class/leds/led_P8_03
|
||||
label = "led_P8_03";
|
||||
linux,default-trigger = "heartbeat";
|
||||
default-state = "on";
|
||||
};
|
||||
32
arch/riscv/boot/dts/thead/overlays/BONE-LED_P9_11.dts
Normal file
32
arch/riscv/boot/dts/thead/overlays/BONE-LED_P9_11.dts
Normal file
@@ -0,0 +1,32 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (C) 2020 - 2022 Deepak Khatri <lorforlinux@beagleboard.org>
|
||||
*
|
||||
* See Cape Interface Spec page for more info on Bone Buses
|
||||
* https://docs.beagleboard.org/0.0/boards/capes/cape-interface-spec.html#beaglebone-cape-interface-spec
|
||||
*
|
||||
* Virtual cape for LED on P9_11
|
||||
* Supports BBB, BBBWL, BBAI, and BBAI-64
|
||||
*
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
&{/chosen} {
|
||||
overlays {
|
||||
BONE-LED_P9_11 = __TIMESTAMP__;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Easy LED control through sysfs (/sys/class/leds/) using gpio-leds driver
|
||||
*/
|
||||
|
||||
&bone_led_P9_11 {
|
||||
status = "okay";
|
||||
// access: sys/class/leds/led_P9_11
|
||||
label = "led_P9_11";
|
||||
linux,default-trigger = "heartbeat";
|
||||
default-state = "on";
|
||||
};
|
||||
30
arch/riscv/boot/dts/thead/overlays/BVA-MIKROBUS-0.dts
Normal file
30
arch/riscv/boot/dts/thead/overlays/BVA-MIKROBUS-0.dts
Normal file
@@ -0,0 +1,30 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (C) 2023 BeagleBoard.org - https://beagleboard.org/
|
||||
* Copyright (C) 2023 Deepak Khatri <lorforlinux@beagleboard.org>
|
||||
*
|
||||
* See Cape Interface Spec page for more info on Bone Buses
|
||||
* https://docs.beagleboard.org/0.0/boards/capes/cape-interface-spec.html
|
||||
*
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/*
|
||||
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
|
||||
*/
|
||||
|
||||
&{/chosen} {
|
||||
overlays {
|
||||
BBORG_LOAD-00A2 = __TIMESTAMP__;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Enable mikroBus port
|
||||
*/
|
||||
|
||||
&bone_mikrobus0 {
|
||||
status = "okay";
|
||||
};
|
||||
15
arch/riscv/boot/dts/thead/overlays/Makefile
Normal file
15
arch/riscv/boot/dts/thead/overlays/Makefile
Normal file
@@ -0,0 +1,15 @@
|
||||
# Overlays for the CONFIG_SOC_THEAD platform
|
||||
|
||||
dtbo-$(CONFIG_SOC_THEAD) += \
|
||||
BBORG_LOAD-00A2.dtbo \
|
||||
BBORG_RELAY-00A2.dtbo \
|
||||
BONE-LED_P8_03.dtbo \
|
||||
BONE-LED_P9_11.dtbo \
|
||||
BVA-MIKROBUS-0.dtbo \
|
||||
meles-wifibt-external-antenna.dtbo
|
||||
|
||||
targets += dtbs dtbs_install
|
||||
targets += $(dtbo-y)
|
||||
|
||||
always-y := $(dtbo-y)
|
||||
clean-files := *.dtbo
|
||||
@@ -0,0 +1,28 @@
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
fragment@0 {
|
||||
target-path = "/";
|
||||
|
||||
__overlay__ {
|
||||
ext_antenna: ext-antenna {
|
||||
status = "okay";
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-low;
|
||||
gpio = <&gpio1_porta 24 1>;
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-name = "ext_antenna";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&board_antenna>;
|
||||
|
||||
__overlay__ {
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
1490
arch/riscv/boot/dts/thead/th1520-beagle-bone-buses.dtsi
Normal file
1490
arch/riscv/boot/dts/thead/th1520-beagle-bone-buses.dtsi
Normal file
File diff suppressed because it is too large
Load Diff
728
arch/riscv/boot/dts/thead/th1520-beagle.dts
Normal file
728
arch/riscv/boot/dts/thead/th1520-beagle.dts
Normal file
@@ -0,0 +1,728 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2021 Alibaba Group Holding Limited.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include "th1520-beagle.dtsi"
|
||||
|
||||
/ {
|
||||
bcmdhd_wlan {
|
||||
compatible = "android,bcmdhd_wlan";
|
||||
|
||||
gpio_wl_reg_on = <&gpio2_porta 31 1>;
|
||||
gpio_wl_host_wake = <&gpio2_porta 25 1>;
|
||||
};
|
||||
};
|
||||
|
||||
&pwm {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&qspi0 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&qspi1 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&vvcam_sensor4 { // beagle board J5 CSI0 connector
|
||||
sensor_name = "IMX219";
|
||||
sensor_pdn = <&gpio2_porta 23 0>; //powerdown pin / shutdown pin
|
||||
sensor_pdn_delay_us = <2000>; //powerdown pin / shutdown pin actived till I2C ready
|
||||
i2c_addr = /bits/ 8 <0x10>;
|
||||
i2c_bus = /bits/ 8 <1>;
|
||||
i2c_reg_width = /bits/ 8 <2>;
|
||||
i2c_data_width = /bits/ 8 <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vvcam_sensor5 { // beagle board J4 CSI1 connector
|
||||
sensor_name = "IMX219";
|
||||
sensor_pdn = <&gpio2_porta 24 0>; //powerdown pin / shutdown pin
|
||||
sensor_pdn_delay_us = <2000>; //powerdown pin / shutdown pin actived till I2C ready
|
||||
i2c_addr = /bits/ 8 <0x10>;
|
||||
i2c_bus = /bits/ 8 <3>;
|
||||
i2c_reg_width = /bits/ 8 <2>;
|
||||
i2c_data_width = /bits/ 8 <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
/*
|
||||
sensor imx219 mounted on beagle board J4 CSI1 (=light CSI2X2_A+CSI2X2_B / CSI2X2_A only)
|
||||
video0: sensor-vipre-isp0
|
||||
video1: sensor-vipre-isp0-dw
|
||||
video7: sensor-vipre-isp0-dsp1-ry-dw
|
||||
video10: tuningtool
|
||||
|
||||
sensor imx219 mounted on beagle board J5 CSI0 (=light CSI2)
|
||||
video2: sensor-vipre-isp1
|
||||
video3: sensor-vipre-isp1-dw
|
||||
video4: sensor-vipre-isp1-dsp0-ry
|
||||
video5: sensor-vipre-isp1-dsp0-ry-dw
|
||||
video12: tuningtool
|
||||
*/
|
||||
|
||||
&video0{
|
||||
vi_mem_pool_region = <0xFFFFFFFF>; // vi_mem: framebuffer, region[2]
|
||||
channel0 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <5>; // imx219
|
||||
csi_idx = <2>; //<2>=CSI2X2_A
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI2_ISP0";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <0>;
|
||||
path_type = "ISP_MI_PATH_MP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <16>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
channel1 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <5>; // imx219
|
||||
csi_idx = <2>; //<2>=CSI2X2_A
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI2_ISP0";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <0>;
|
||||
path_type = "ISP_MI_PATH_SP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <16>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
channel2 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <5>; // imx219
|
||||
csi_idx = <2>; //<2>=CSI2X2_A
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI2_ISP0";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <0>;
|
||||
path_type = "ISP_MI_PATH_SP2_BP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <16>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&video2 {
|
||||
vi_mem_pool_region = <0>; // vi_mem: framebuffer, region[0]
|
||||
status = "okay";
|
||||
channel0 {
|
||||
channel_id = <0>;
|
||||
status = "okay";
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_MP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <16>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
channel1 {
|
||||
channel_id = <1>;
|
||||
status = "okay";
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_SP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <16>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
channel2 {
|
||||
channel_id = <2>;
|
||||
status = "okay";
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_SP2_BP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <16>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&video3{
|
||||
vi_mem_pool_region = <0>; // vi_mem: framebuffer, region[0]
|
||||
channel0 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_MP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dw {
|
||||
subdev_name = "dw";
|
||||
idx = <0>;
|
||||
path_type = "DW_DWE_VSE0";
|
||||
dw_dst_depth = <2>;
|
||||
};
|
||||
};
|
||||
channel1 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_MP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dw {
|
||||
subdev_name = "dw";
|
||||
idx = <0>;
|
||||
path_type = "DW_DWE_VSE1";
|
||||
dw_dst_depth = <2>;
|
||||
};
|
||||
};
|
||||
channel2 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_MP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dw {
|
||||
subdev_name = "dw";
|
||||
idx = <0>;
|
||||
path_type = "DW_DWE_VSE2";
|
||||
dw_dst_depth = <2>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&video4{
|
||||
vi_mem_pool_region = <0>; // vi_mem: framebuffer, region[0]
|
||||
channel0 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_PP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dsp {
|
||||
subdev_name = "dsp";
|
||||
idx = <0>;
|
||||
path_type = "DSP_PATH_ISP_RY";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
ry {
|
||||
subdev_name = "ry";
|
||||
idx = <0>;
|
||||
path_type = "ISP_RY_MI_PATH_MP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
channel1 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_PP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dsp {
|
||||
subdev_name = "dsp";
|
||||
idx = <0>;
|
||||
path_type = "DSP_PATH_ISP_RY";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
ry {
|
||||
subdev_name = "ry";
|
||||
idx = <0>;
|
||||
path_type = "ISP_RY_MI_PATH_SP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
channel2 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_PP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dsp {
|
||||
subdev_name = "dsp";
|
||||
idx = <0>;
|
||||
path_type = "DSP_PATH_ISP_RY";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
ry {
|
||||
subdev_name = "ry";
|
||||
idx = <0>;
|
||||
path_type = "ISP_RY_MI_PATH_SP2_BP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&video5{
|
||||
vi_mem_pool_region = <0>; // vi_mem: framebuffer, region[0]
|
||||
channel0 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_PP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dsp {
|
||||
subdev_name = "dsp";
|
||||
idx = <0>;
|
||||
path_type = "DSP_PATH_ISP_RY";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
ry {
|
||||
subdev_name = "ry";
|
||||
idx = <0>;
|
||||
path_type = "ISP_RY_MI_PATH_MP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dw {
|
||||
subdev_name = "dw";
|
||||
idx = <0>;
|
||||
path_type = "DW_DWE_VSE0";
|
||||
dw_dst_depth = <2>;
|
||||
};
|
||||
};
|
||||
channel1 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_PP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dsp {
|
||||
subdev_name = "dsp";
|
||||
idx = <0>;
|
||||
path_type = "DSP_PATH_ISP_RY";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
ry {
|
||||
subdev_name = "ry";
|
||||
idx = <0>;
|
||||
path_type = "ISP_RY_MI_PATH_MP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dw {
|
||||
subdev_name = "dw";
|
||||
idx = <0>;
|
||||
path_type = "DW_DWE_VSE1";
|
||||
dw_dst_depth = <2>;
|
||||
};
|
||||
};
|
||||
channel2 {
|
||||
sensor0 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <4>; // imx219
|
||||
csi_idx = <0>; //<0>=CSI2
|
||||
mode_idx = <0>;
|
||||
path_type = "SENSOR_1080P_RAW10_LINER";
|
||||
};
|
||||
sensor1 {
|
||||
subdev_name = "vivcam";
|
||||
idx = <0xff>; // invalid
|
||||
csi_idx = <0xff>;
|
||||
path_type = "SENSOR_VGA_RAW10_LINER";
|
||||
};
|
||||
dma {
|
||||
subdev_name = "vipre";
|
||||
idx = <0>;
|
||||
path_type = "VIPRE_CSI0_ISP1";
|
||||
};
|
||||
isp {
|
||||
subdev_name = "isp";
|
||||
idx = <1>;
|
||||
path_type = "ISP_MI_PATH_PP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dsp {
|
||||
subdev_name = "dsp";
|
||||
idx = <0>;
|
||||
path_type = "DSP_PATH_ISP_RY";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
ry {
|
||||
subdev_name = "ry";
|
||||
idx = <0>;
|
||||
path_type = "ISP_RY_MI_PATH_MP";
|
||||
output {
|
||||
max_width = <1920>;
|
||||
max_height = <1088>;
|
||||
bit_per_pixel = <12>;
|
||||
frame_count = <3>;
|
||||
};
|
||||
};
|
||||
dw {
|
||||
subdev_name = "dw";
|
||||
idx = <0>;
|
||||
path_type = "DW_DWE_VSE2";
|
||||
dw_dst_depth = <2>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#include "th1520-beagle-bone-buses.dtsi"
|
||||
2142
arch/riscv/boot/dts/thead/th1520-beagle.dtsi
Normal file
2142
arch/riscv/boot/dts/thead/th1520-beagle.dtsi
Normal file
File diff suppressed because it is too large
Load Diff
6
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
Normal file
6
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
Normal file
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2024 ISCAS.
|
||||
*/
|
||||
|
||||
#include "th1520-beagle.dts"
|
||||
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2024 ISCAS.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-cluster-16gb.dts"
|
||||
6
arch/riscv/boot/dts/thead/th1520-lichee-cluster-4a.dts
Normal file
6
arch/riscv/boot/dts/thead/th1520-lichee-cluster-4a.dts
Normal file
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2024 ISCAS.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-cluster.dts"
|
||||
6
arch/riscv/boot/dts/thead/th1520-lichee-pi-4a-16g.dts
Normal file
6
arch/riscv/boot/dts/thead/th1520-lichee-pi-4a-16g.dts
Normal file
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2024 ISCAS.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-16gb.dts"
|
||||
6
arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
Normal file
6
arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
Normal file
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2024 ISCAS.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-product.dts"
|
||||
20
arch/riscv/boot/dts/thead/th1520-lpi4a-16gb.dts
Normal file
20
arch/riscv/boot/dts/thead/th1520-lpi4a-16gb.dts
Normal file
@@ -0,0 +1,20 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2022 Alibaba Group Holding Limited.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-product.dts"
|
||||
|
||||
/ {
|
||||
model = "T-HEAD Light Lichee Pi 4A configuration for 16GB DDR board";
|
||||
compatible = "thead,light-val", "thead,light-lpi4a", "thead,light";
|
||||
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x200000 0x3 0xffe00000>;
|
||||
};
|
||||
};
|
||||
|
||||
&cmamem {
|
||||
alloc-ranges = <0x3 0xe4000000 0 0x14000000>; // [0x3E400_0000 ~ 0x3F800_0000]
|
||||
};
|
||||
30
arch/riscv/boot/dts/thead/th1520-lpi4a-cluster-16gb.dts
Normal file
30
arch/riscv/boot/dts/thead/th1520-lpi4a-cluster-16gb.dts
Normal file
@@ -0,0 +1,30 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2023 Sipeed.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-16gb.dts"
|
||||
|
||||
/ {
|
||||
model = "T-HEAD Light Lichee Pi 4A configuration for 16GB DDR board on Cluster";
|
||||
};
|
||||
|
||||
&audio_i2c0 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&audio_i2c1 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&lightsound {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
®_usb_hub_vdd1v2 {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
|
||||
®_usb_hub_vcc5v {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
30
arch/riscv/boot/dts/thead/th1520-lpi4a-cluster.dts
Normal file
30
arch/riscv/boot/dts/thead/th1520-lpi4a-cluster.dts
Normal file
@@ -0,0 +1,30 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2023 Sipeed.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-product.dts"
|
||||
|
||||
/ {
|
||||
model = "T-HEAD Light Lichee Pi 4A configuration for 8GB DDR board on Cluster";
|
||||
};
|
||||
|
||||
&audio_i2c0 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&audio_i2c1 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&lightsound {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
®_usb_hub_vdd1v2 {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
|
||||
®_usb_hub_vcc5v {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
17
arch/riscv/boot/dts/thead/th1520-lpi4a-console-16g.dts
Normal file
17
arch/riscv/boot/dts/thead/th1520-lpi4a-console-16g.dts
Normal file
@@ -0,0 +1,17 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2022 Alibaba Group Holding Limited.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-console.dts"
|
||||
|
||||
/ {
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x200000 0x3 0xffe00000>;
|
||||
};
|
||||
};
|
||||
|
||||
&cmamem {
|
||||
alloc-ranges = <0x3 0xe4000000 0 0x14000000>; // [0x3E400_0000 ~ 0x3F800_0000]
|
||||
};
|
||||
53
arch/riscv/boot/dts/thead/th1520-lpi4a-console.dts
Normal file
53
arch/riscv/boot/dts/thead/th1520-lpi4a-console.dts
Normal file
@@ -0,0 +1,53 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2023 Sipeed.
|
||||
*/
|
||||
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include "th1520-lpi4a-laptop.dts"
|
||||
|
||||
/ {
|
||||
model = "T-HEAD Light Lichee Pi 4A configuration for LicheeConsole4A";
|
||||
compatible = "thead,light", "sipeed,th1520-laptop", "sipeed,console4a";
|
||||
};
|
||||
|
||||
&dsi0_panel0 {
|
||||
compatible = "mingjun,mj070bi30ia2";
|
||||
};
|
||||
|
||||
&i2c2 {
|
||||
/* thank ice */
|
||||
trackpoint: trackpad@15 {
|
||||
compatible = "hid-over-i2c";
|
||||
reg = <0x15>;
|
||||
hid-descr-addr = <0x0020>;
|
||||
interrupt-parent = <&gpio1_porta>;
|
||||
interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
&cw2015 {
|
||||
cellwise,battery-profile = /bits/ 8 <
|
||||
0x17 0x67 0x72 0x68 0x66 0x63 0x62 0x5A
|
||||
0x64 0x61 0x4D 0x57 0x5A 0x51 0x43 0x38
|
||||
0x31 0x2A 0x24 0x22 0x29 0x31 0x3E 0x4C
|
||||
0x29 0x4D 0x0B 0x85 0x1C 0x38 0x47 0x57
|
||||
0x5D 0x5E 0x5F 0x60 0x3F 0x1A 0x6F 0x41
|
||||
0x0A 0x43 0x12 0x38 0x7B 0x95 0x9A 0x18
|
||||
0x4B 0x6F 0x9E 0xD5 0x80 0x57 0x87 0xCB
|
||||
0x2F 0x00 0x64 0xA5 0xB5 0x13 0x54 0xB9
|
||||
>;
|
||||
};
|
||||
|
||||
&lcd0_backlight {
|
||||
default-brightness-level = <50>;
|
||||
};
|
||||
|
||||
&sdhci0 {
|
||||
max-frequency = <35000000>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&fan {
|
||||
cooling-levels = <255 255 255 255>;
|
||||
};
|
||||
131
arch/riscv/boot/dts/thead/th1520-lpi4a-dsi0-hdmi.dts
Normal file
131
arch/riscv/boot/dts/thead/th1520-lpi4a-dsi0-hdmi.dts
Normal file
@@ -0,0 +1,131 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2022 Alibaba Group Holding Limited.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a.dtsi"
|
||||
|
||||
/ {
|
||||
model = "T-HEAD Light Lichee Pi 4A configuration for 8GB DDR board";
|
||||
compatible = "thead,light-val", "thead,light-lpi4a", "thead,light";
|
||||
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x00000000 0x2 0x00000000>;
|
||||
};
|
||||
};
|
||||
|
||||
&cmamem {
|
||||
alloc-ranges = <0x1 0xe4000000 0 0x14000000>; // [0x1E400_0000 ~ 0x1F800_0000]
|
||||
};
|
||||
|
||||
&pwm {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&qspi0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&qspi1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2c3 {
|
||||
touch@14 {
|
||||
#gpio-cells = <2>;
|
||||
compatible = "goodix,gt9271";
|
||||
reg = <0x14>;
|
||||
interrupt-parent = <&ao_gpio_porta>;
|
||||
interrupts = <3 0>;
|
||||
irq-gpios = <&ao_gpio_porta 3 0>;
|
||||
reset-gpios = <&pcal6408ahk_d 0 0>;
|
||||
AVDD28-supply = <®_tp_pwr_en>;
|
||||
touchscreen-size-x = <800>;
|
||||
touchscreen-size-y = <1280>;
|
||||
tp-size = <9271>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&dpu_enc0 {
|
||||
status = "okay";
|
||||
|
||||
ports {
|
||||
/* output */
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
|
||||
enc0_out: endpoint {
|
||||
remote-endpoint = <&dsi0_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&dpu_enc1 {
|
||||
ports {
|
||||
/delete-node/ port@0;
|
||||
};
|
||||
};
|
||||
|
||||
&dpu {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&dsi0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&dhost_0 {
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
|
||||
dsi0_in: endpoint {
|
||||
remote-endpoint = <&enc0_out>;
|
||||
};
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
|
||||
dsi0_out: endpoint {
|
||||
remote-endpoint = <&panel0_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dsi0_panel0: panel0@0 {
|
||||
compatible = "chongzhou,cz101b4001", "jadard,jd9365da-h3";
|
||||
reg = <0>;
|
||||
backlight = <&lcd0_backlight>;
|
||||
reset-gpio = <&pcal6408ahk_d 7 0>; /* active low */
|
||||
hsvcc-supply = <&soc_vdd18_lcd0_en_reg>;
|
||||
vspn3v3-supply = <&soc_vdd33_lcd0_en_reg>;
|
||||
|
||||
port {
|
||||
panel0_in: endpoint {
|
||||
remote-endpoint = <&dsi0_out>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&disp1_out {
|
||||
remote-endpoint = <&hdmi_tx_in>;
|
||||
};
|
||||
|
||||
&hdmi_tx {
|
||||
status = "okay";
|
||||
|
||||
port@0 {
|
||||
/* input */
|
||||
hdmi_tx_in: endpoint {
|
||||
remote-endpoint = <&disp1_out>;
|
||||
};
|
||||
};
|
||||
};
|
||||
330
arch/riscv/boot/dts/thead/th1520-lpi4a-laptop.dts
Normal file
330
arch/riscv/boot/dts/thead/th1520-lpi4a-laptop.dts
Normal file
@@ -0,0 +1,330 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2023 Sipeed.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-dsi0-hdmi.dts"
|
||||
|
||||
/ {
|
||||
model = "T-HEAD Light Lichee Pi 4A configuration for 8GB DDR board use on laptop";
|
||||
compatible = "thead,light", "sipeed,th1520-laptop";
|
||||
|
||||
reg_sys_vcc_5v: regulator-sys-vcc-5v-en {
|
||||
status = "okay";
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "regulator-sys-vcc-5v-en";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
gpio = <&pcal6408ahk_c 0 1>;
|
||||
enable-active-high;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
|
||||
// suspend for lichee laptop is not ready so dont turn it off
|
||||
/*
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-state-standby {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
*/
|
||||
};
|
||||
|
||||
reg_sys_vcc_3v3: regulator-sys-vcc-3v3-en {
|
||||
status = "okay";
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "regulator-sys-vcc-3v3-en";
|
||||
vin-supply = <®_sys_vcc_5v>;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
enable-active-high;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
reg_sys_vcc_1v8: regulator-sys-vcc-1v8-en {
|
||||
status = "okay";
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "regulator-sys-vcc-1v8-en";
|
||||
vin-supply = <®_sys_vcc_5v>;
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
enable-active-high;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
reg_usb_vcc_5v: regulator-usb-vcc-5v-en {
|
||||
status = "okay";
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "regulator-usb-vcc-5v-en";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
vin-supply = <®_sys_vcc_5v>;
|
||||
gpio = <&pcal6408ahk_d 3 1>;
|
||||
enable-active-high;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
reg_sata_vcc_5v: regulator-sata-vcc-5v-en {
|
||||
status = "okay";
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "regulator-sata-vcc-5v-en";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
vin-supply = <®_sys_vcc_5v>;
|
||||
gpio = <&pcal6408ahk_c 1 1>;
|
||||
enable-active-high;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
audio_amp: regulator-audio-amp-en {
|
||||
status = "okay";
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "regulator-audio-amp-en";
|
||||
vin-supply = <®_sys_vcc_5v>;
|
||||
gpio = <&pcal6408ahk_c 3 1>;
|
||||
enable-active-high;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
aon: aon {
|
||||
soc_dvdd12_rgb {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
soc_avdd25_ir {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
soc_dovdd18_ir {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
soc_dvdd12_ir {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
soc_cam2_avdd25_ir {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
soc_cam2_dovdd18_ir {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
soc_avdd28_rgb {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
soc_dovdd18_rgb {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
};
|
||||
|
||||
charger: dc-charger {
|
||||
compatible = "gpio-charger";
|
||||
charger-type = "mains";
|
||||
gpios = <&gpio0_porta 16 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
&es8156_audio_codec {
|
||||
AVDD-supply = <®_sys_vcc_3v3>;
|
||||
DVDD-supply = <®_sys_vcc_1v8>;
|
||||
PVDD-supply = <®_sys_vcc_1v8>;
|
||||
};
|
||||
|
||||
&es7210_audio_codec {
|
||||
MVDD-supply = <®_sys_vcc_3v3>;
|
||||
AVDD-supply = <®_sys_vcc_3v3>;
|
||||
DVDD-supply = <®_sys_vcc_1v8>;
|
||||
PVDD-supply = <®_sys_vcc_1v8>;
|
||||
};
|
||||
|
||||
&wcn_wifi {
|
||||
// WIFI,poweren_gpio = <&pcal6408ahk_c 4 0>;
|
||||
/delete-property/ WIFI,poweren_gpio;
|
||||
};
|
||||
|
||||
|
||||
&wcn_bt {
|
||||
// BT,power_gpio = <&pcal6408ahk_c 5 0>;
|
||||
/delete-property/ BT,power_gpio;
|
||||
};
|
||||
|
||||
&usb_1 {
|
||||
/delete-property/ vbus-supply;
|
||||
/delete-property/ hub1v2-supply;
|
||||
hub5v-supply = <®_usb_vcc_5v>;
|
||||
};
|
||||
|
||||
®_usb_hub_vcc5v {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
|
||||
&soc_cam2_dvdd12_ir_reg {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
|
||||
&vvcam_sensor0 {
|
||||
/delete-property/ sensor_rst;
|
||||
};
|
||||
|
||||
&vvcam_sensor1 {
|
||||
/delete-property/ sensor_rst;
|
||||
};
|
||||
|
||||
&vvcam_sensor2 {
|
||||
/delete-property/ sensor_rst;
|
||||
};
|
||||
|
||||
&vvcam_sensor3 {
|
||||
/delete-property/ sensor_rst;
|
||||
};
|
||||
|
||||
®_tp_pwr_en {
|
||||
/delete-property/ gpio;
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
/delete-node/ gpio@18;
|
||||
|
||||
cw2015: cw2015@62 {
|
||||
compatible = "cellwise,cw2015";
|
||||
reg = <0x62>;
|
||||
cellwise,monitor-interval-ms = <5000>;
|
||||
power-supplies = <&charger>;
|
||||
};
|
||||
};
|
||||
|
||||
&i2c3 {
|
||||
touch@14 {
|
||||
#gpio-cells = <2>;
|
||||
compatible = "goodix,gt9271";
|
||||
reg = <0x14>;
|
||||
interrupt-parent = <&ao_gpio_porta>;
|
||||
interrupts = <3 0>;
|
||||
irq-gpios = <&ao_gpio_porta 3 0>;
|
||||
reset-gpios = <&pcal6408ahk_d 0 0>;
|
||||
// read xmax & ymax from touch screen chip, thank ice
|
||||
//touchscreen-size-x = <1024>;
|
||||
//touchscreen-size-y = <600>;
|
||||
//tp-size = <9271>;
|
||||
/delete-property/ touchscreen-size-x;
|
||||
/delete-property/ touchscreen-size-y;
|
||||
/delete-property/ tp-size;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
lt8911: lt8911@29 {
|
||||
compatible = "lontium,lt8911exb";
|
||||
reg = <0x29>;
|
||||
lontium,pclk = <136000000>;
|
||||
lontium,hact = <2160>;
|
||||
lontium,vact = <1440>;
|
||||
lontium,hbp = <80>;
|
||||
lontium,hfp = <48>;
|
||||
lontium,vbp = <14>;
|
||||
lontium,vfp = <3>;
|
||||
lontium,hs = <32>;
|
||||
lontium,vs = <10>;
|
||||
lontium,mipi_lane = <2>;
|
||||
lontium,lane_cnt = <2>;
|
||||
lontium,color = <1>; //Color Depth 0:6bit 1:8bit
|
||||
lontium,test = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
&uart3 {
|
||||
clock-frequency = <100000000>;
|
||||
pinctrl-0 = <&pinctrl_uart3_tx_is_gpio>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&qspi0 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&qspi1 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&dsi0_panel0 {
|
||||
backlight = <&lcd0_backlight>;
|
||||
reset-gpio = <&pcal6408ahk_d 7 0>; /* active low */
|
||||
hsvcc-supply = <®_sys_vcc_1v8>;
|
||||
vspn3v3-supply = <®_sys_vcc_3v3>;
|
||||
};
|
||||
|
||||
&lcd0_backlight {
|
||||
pwms = <&pwm 0 50000>;
|
||||
brightness-levels = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
||||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
||||
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100>;
|
||||
default-brightness-level = <100>;
|
||||
};
|
||||
|
||||
&fan {
|
||||
pwms = <&pwm 1 10000000 0>;
|
||||
cooling-levels = <0 64 192 255>;
|
||||
};
|
||||
|
||||
&cpus {
|
||||
c910_0: cpu@0 {
|
||||
operating-points = <
|
||||
/* kHz uV */
|
||||
300000 500000
|
||||
800000 700000
|
||||
1500000 800000
|
||||
>;
|
||||
light,dvddm-operating-points = <
|
||||
/* kHz uV */
|
||||
300000 800000
|
||||
800000 800000
|
||||
1500000 800000
|
||||
>;
|
||||
};
|
||||
c910_1: cpu@1 {
|
||||
operating-points = <
|
||||
/* kHz uV */
|
||||
300000 500000
|
||||
800000 700000
|
||||
1500000 800000
|
||||
>;
|
||||
light,dvddm-operating-points = <
|
||||
/* kHz uV */
|
||||
300000 800000
|
||||
800000 800000
|
||||
1500000 800000
|
||||
>;
|
||||
};
|
||||
c910_2: cpu@2 {
|
||||
|
||||
operating-points = <
|
||||
/* kHz uV */
|
||||
300000 500000
|
||||
800000 700000
|
||||
1500000 800000
|
||||
>;
|
||||
light,dvddm-operating-points = <
|
||||
/* kHz uV */
|
||||
300000 800000
|
||||
800000 800000
|
||||
1500000 800000
|
||||
>;
|
||||
};
|
||||
c910_3: cpu@3 {
|
||||
|
||||
operating-points = <
|
||||
/* kHz uV */
|
||||
300000 500000
|
||||
800000 700000
|
||||
1500000 800000
|
||||
>;
|
||||
light,dvddm-operating-points = <
|
||||
/* kHz uV */
|
||||
300000 800000
|
||||
800000 800000
|
||||
1500000 800000
|
||||
>;
|
||||
};
|
||||
};
|
||||
17
arch/riscv/boot/dts/thead/th1520-lpi4a-z14inch-m0-16g.dts
Normal file
17
arch/riscv/boot/dts/thead/th1520-lpi4a-z14inch-m0-16g.dts
Normal file
@@ -0,0 +1,17 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2022 Alibaba Group Holding Limited.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-z14inch-m0.dts"
|
||||
|
||||
/ {
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x200000 0x3 0xffe00000>;
|
||||
};
|
||||
};
|
||||
|
||||
&cmamem {
|
||||
alloc-ranges = <0x3 0xe4000000 0 0x14000000>; // [0x3E400_0000 ~ 0x3F800_0000]
|
||||
};
|
||||
66
arch/riscv/boot/dts/thead/th1520-lpi4a-z14inch-m0.dts
Normal file
66
arch/riscv/boot/dts/thead/th1520-lpi4a-z14inch-m0.dts
Normal file
@@ -0,0 +1,66 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2023 Sipeed.
|
||||
*/
|
||||
|
||||
#include "th1520-lpi4a-laptop.dts"
|
||||
|
||||
/ {
|
||||
model = "T-HEAD Light Lichee Pi 4A configuration for Z14INCH-M0";
|
||||
};
|
||||
|
||||
&dsi0_panel0 {
|
||||
compatible = "custom,z14inch_2160x1440_40Hz";
|
||||
/* display-timings in devicetree is it not working, but I haven't time to fix it, so move it into simple-panel.c */
|
||||
/*
|
||||
display-timings {
|
||||
clock-frequency = <136000000>;
|
||||
hactive = <2160>;
|
||||
vactive = <1440>;
|
||||
hfront-porch = <48>;
|
||||
hback-porch = <80>;
|
||||
hsync-len = <32>;
|
||||
vback-porch = <14>;
|
||||
vfront-porch = <3>;
|
||||
vsync-len = <10>;
|
||||
};
|
||||
*/
|
||||
};
|
||||
|
||||
&cw2015 {
|
||||
cellwise,battery-profile = /bits/ 8 <
|
||||
0x17 0x67 0x72 0x68 0x66 0x63 0x62 0x5A
|
||||
0x64 0x61 0x4D 0x57 0x5A 0x51 0x43 0x38
|
||||
0x31 0x2A 0x24 0x22 0x29 0x31 0x3E 0x4C
|
||||
0x29 0x4D 0x0B 0x85 0x1C 0x38 0x47 0x57
|
||||
0x5D 0x5E 0x5F 0x60 0x3F 0x1A 0x6F 0x41
|
||||
0x0A 0x43 0x12 0x38 0x7B 0x95 0x9A 0x18
|
||||
0x4B 0x6F 0x9E 0xD5 0x80 0x57 0x87 0xCB
|
||||
0x2F 0x00 0x64 0xA5 0xB5 0x13 0x54 0xB9
|
||||
>;
|
||||
};
|
||||
|
||||
<8911 {
|
||||
lontium,pclk = <136000000>;
|
||||
lontium,hact = <2160>;
|
||||
lontium,vact = <1440>;
|
||||
lontium,hbp = <80>;
|
||||
lontium,hfp = <48>;
|
||||
lontium,vbp = <14>;
|
||||
lontium,vfp = <3>;
|
||||
lontium,hs = <32>;
|
||||
lontium,vs = <10>;
|
||||
lontium,mipi_lane = <2>;
|
||||
lontium,lane_cnt = <2>;
|
||||
lontium,color = <1>; //Color Depth 0:6bit 1:8bit
|
||||
lontium,test = <0>;
|
||||
};
|
||||
|
||||
&fan {
|
||||
pwms = <&pwm 1 10000000 0>;
|
||||
cooling-levels = <0 192 220 255>;
|
||||
};
|
||||
|
||||
&lcd0_backlight {
|
||||
default-brightness-level = <40>;
|
||||
};
|
||||
@@ -247,7 +247,7 @@
|
||||
regulator-max-microvolt = <1200000>;
|
||||
gpio = <&pcal6408ahk_d 2 1>;
|
||||
enable-active-high;
|
||||
regulator-always-on;
|
||||
|
||||
};
|
||||
|
||||
reg_usb_hub_vcc5v: regulator-hub-vcc5v-en {
|
||||
@@ -257,7 +257,7 @@
|
||||
regulator-max-microvolt = <5000000>;
|
||||
gpio = <&pcal6408ahk_d 3 1>;
|
||||
enable-active-high;
|
||||
regulator-always-on;
|
||||
|
||||
};
|
||||
|
||||
wcn_wifi: wireless-wlan {
|
||||
@@ -268,7 +268,7 @@
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_wifi_wake>;
|
||||
wifi_chip_type = "rtl8723ds";
|
||||
WIFI,poweren_gpio = <&pcal6408ahk_c 4 0>;
|
||||
// WIFI,poweren_gpio = <&pcal6408ahk_c 4 0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@@ -276,13 +276,13 @@
|
||||
compatible = "bluetooth-platdata";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_bt_wake>;
|
||||
BT,power_gpio = <&pcal6408ahk_c 5 0>;
|
||||
// BT,power_gpio = <&pcal6408ahk_c 5 0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
gpio-keys {
|
||||
compatible = "gpio-keys";
|
||||
pinctrl-0 = <&pinctrl_volume>;
|
||||
pinctrl-0 = <&pinctrl_volume &pinctrl_sleep>;
|
||||
pinctrl-names = "default";
|
||||
key-volumedown {
|
||||
label = "Volume Down Key";
|
||||
@@ -296,6 +296,13 @@
|
||||
debounce-interval = <1>;
|
||||
gpios = <&gpio2_porta 25 0x1>;
|
||||
};
|
||||
key-wake {
|
||||
label = "Wake Key";
|
||||
wakeup-source;
|
||||
linux,code = <KEY_WAKEUP>;
|
||||
debounce-interval = <1>;
|
||||
gpios = <&ao_gpio_porta 2 0x1>;
|
||||
};
|
||||
};
|
||||
|
||||
aon: aon {
|
||||
@@ -382,7 +389,7 @@
|
||||
regulator-max-microvolt = <3300000>;
|
||||
gpio = <&gpio1_porta 22 1>;
|
||||
enable-active-high;
|
||||
regulator-always-on;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -901,7 +908,7 @@
|
||||
};
|
||||
|
||||
&sdhci0 {
|
||||
max-frequency = <198000000>;
|
||||
max-frequency = <100000000>;
|
||||
bus-width = <4>;
|
||||
pull_up;
|
||||
wprtn_ignore;
|
||||
@@ -1098,6 +1105,16 @@
|
||||
>;
|
||||
};
|
||||
|
||||
|
||||
pinctrl_uart3_tx_is_gpio: uart3txisgpiogrp {
|
||||
thead,pins = <
|
||||
FM_UART3_TXD 0x3 0x202
|
||||
FM_UART3_RXD 0x1 0x202
|
||||
>;
|
||||
};
|
||||
|
||||
|
||||
|
||||
pinctrl_wifi_wake: wifi_grp {
|
||||
thead,pins = <
|
||||
FM_GPIO0_27 0x0 0x202
|
||||
@@ -1182,6 +1199,11 @@
|
||||
pinctrl_audiopa30: audiopa30 {
|
||||
thead,pins = < FM_AUDIO_PA30 LIGHT_PIN_FUNC_0 0x000 >;
|
||||
};
|
||||
pinctrl_sleep: sleep_grp {
|
||||
thead,pins = <
|
||||
FM_CPU_JTG_TCLK 0x3 0x238
|
||||
>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
@@ -1233,7 +1255,7 @@
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_i2c0>;
|
||||
|
||||
pcal6408ahk_b: gpio@20 {
|
||||
pcal6408ahk_b: gpio@18 {
|
||||
compatible = "nxp,pca9557";
|
||||
reg = <0x18>;
|
||||
gpio-controller;
|
||||
@@ -1247,7 +1269,7 @@
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_i2c1>;
|
||||
|
||||
pcal6408ahk_c: gpio@20 {
|
||||
pcal6408ahk_c: gpio@18 {
|
||||
compatible = "nxp,pca9557";
|
||||
reg = <0x18>;
|
||||
gpio-controller;
|
||||
@@ -1268,7 +1290,7 @@
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_i2c3>;
|
||||
|
||||
pcal6408ahk_d: gpio@20 {
|
||||
pcal6408ahk_d: gpio@18 {
|
||||
compatible = "nxp,pca9557";
|
||||
reg = <0x18>;
|
||||
gpio-controller;
|
||||
|
||||
16
arch/riscv/boot/dts/thead/th1520-milkv-meles-4g.dts
Normal file
16
arch/riscv/boot/dts/thead/th1520-milkv-meles-4g.dts
Normal file
@@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2022 Alibaba Group Holding Limited.
|
||||
*/
|
||||
|
||||
#include "th1520-milkv-meles.dts"
|
||||
|
||||
/ {
|
||||
model = "Milk-V Meles 4G";
|
||||
compatible = "milkv,meles", "thead,light";
|
||||
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x200000 0x0 0xffe00000>;
|
||||
};
|
||||
};
|
||||
133
arch/riscv/boot/dts/thead/th1520-milkv-meles-dsi0.dts
Normal file
133
arch/riscv/boot/dts/thead/th1520-milkv-meles-dsi0.dts
Normal file
@@ -0,0 +1,133 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Alibaba Group Holding Limited.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include "th1520-milkv-meles.dts"
|
||||
|
||||
/ {
|
||||
model = "Milk-V Meles";
|
||||
compatible = "milkv,meles", "thead,light";
|
||||
|
||||
lcd0_backlight: pwm-backlight@0 {
|
||||
status = "okay";
|
||||
compatible = "pwm-backlight";
|
||||
pwms = <&pwm 5 25000>;
|
||||
brightness-levels = <0 4 8 16 32 64 128 255>;
|
||||
default-brightness-level = <7>;
|
||||
};
|
||||
|
||||
vcc_lcd_mipi0: vcc-lcd-mipi0 {
|
||||
status = "okay";
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc_lcd_mipi0";
|
||||
gpio = <&gpio1_porta 25 0>;
|
||||
enable-active-high;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
};
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
clock-frequency = <100000>;
|
||||
status = "okay";
|
||||
|
||||
touch@14 {
|
||||
#gpio-cells = <2>;
|
||||
compatible = "goodix,gt9271";
|
||||
reg = <0x14>;
|
||||
interrupt-parent = <&gpio2_porta>;
|
||||
interrupts = <20 0>;
|
||||
irq-gpios = <&gpio2_porta 20 0>;
|
||||
reset-gpios = <&gpio2_porta 18 0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_touch_gpios>;
|
||||
};
|
||||
};
|
||||
|
||||
&padctrl0_apsys {
|
||||
light-evb-padctrl0 {
|
||||
pinctrl_dsi0_panel_gpio: dsi0-panel-gpio-group {
|
||||
thead,pins = <
|
||||
FM_GPIO2_21 0x0 0x238
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_touch_gpios: touch-gpios-group {
|
||||
thead,pins = <
|
||||
FM_GPIO2_18 0x0 0x238
|
||||
FM_GPIO2_20 0x0 0x208
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pwm {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&dpu_enc0 {
|
||||
status = "okay";
|
||||
|
||||
ports {
|
||||
/* output */
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
|
||||
enc0_out: endpoint {
|
||||
remote-endpoint = <&dsi0_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/delete-node/ &disp1_out;
|
||||
|
||||
/delete-node/ &hdmi_tx;
|
||||
|
||||
&dsi0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&dhost_0 {
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
|
||||
dsi0_in: endpoint {
|
||||
remote-endpoint = <&enc0_out>;
|
||||
};
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
|
||||
dsi0_out: endpoint {
|
||||
remote-endpoint = <&panel_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
panel@0 {
|
||||
compatible = "radxa,display-10fhd-ad003";
|
||||
reg = <0>;
|
||||
backlight = <&lcd0_backlight>;
|
||||
vdd-supply = <&vcc_lcd_mipi0>;
|
||||
vccio-supply = <&vdd_1v8>;
|
||||
reset-gpios = <&gpio2_porta 21 0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_dsi0_panel_gpio>;
|
||||
|
||||
port {
|
||||
panel_in: endpoint {
|
||||
remote-endpoint = <&dsi0_out>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
906
arch/riscv/boot/dts/thead/th1520-milkv-meles.dts
Normal file
906
arch/riscv/boot/dts/thead/th1520-milkv-meles.dts
Normal file
@@ -0,0 +1,906 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Alibaba Group Holding Limited.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include "th1520.dtsi"
|
||||
#include <dt-bindings/input/linux-event-codes.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
|
||||
/ {
|
||||
model = "Milk-V Meles";
|
||||
compatible = "milkv,meles", "thead,light";
|
||||
|
||||
aliases {
|
||||
mmc0 = &emmc;
|
||||
mmc1 = &sdhci0;
|
||||
mmc2 = &sdhci1;
|
||||
};
|
||||
|
||||
chosen {
|
||||
bootargs = "console=ttyS0,115200 crashkernel=256M-:128M earlycon clk_ignore_unused sram=0xffe0000000,0x180000";
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x200000 0x1 0xffe00000>;
|
||||
};
|
||||
|
||||
display_subsystem: display-subsystem {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
led0 {
|
||||
label = "SYS_STATUS";
|
||||
gpios = <&gpio1_porta 15 0>; /* GPIO_ACTIVE_HIGH: 0 */
|
||||
default-state = "off";
|
||||
};
|
||||
|
||||
led1 {
|
||||
label = "USER_LED";
|
||||
gpios = <&gpio1_porta 16 0>; /* GPIO_ACTIVE_HIGH: 0 */
|
||||
linux,default-trigger = "heartbeat";
|
||||
default-state = "on";
|
||||
};
|
||||
};
|
||||
|
||||
light_iopmp: iopmp {
|
||||
compatible = "thead,light-iopmp";
|
||||
|
||||
/* config#1: multiple valid regions */
|
||||
iopmp_emmc: IOPMP_EMMC {
|
||||
regions = <0x000000 0x100000>,
|
||||
<0x100000 0x200000>;
|
||||
attr = <0xFFFFFFFF>;
|
||||
dummy_slave= <0x800000>;
|
||||
};
|
||||
|
||||
/* config#2: iopmp bypass */
|
||||
iopmp_sdio0: IOPMP_SDIO0 {
|
||||
bypass_en;
|
||||
};
|
||||
|
||||
/* config#3: iopmp default region set */
|
||||
iopmp_sdio1: IOPMP_SDIO1 {
|
||||
attr = <0xFFFFFFFF>;
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_usb0: IOPMP_USB0 {
|
||||
attr = <0xFFFFFFFF>;
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_ao: IOPMP_AO {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_aud: IOPMP_AUD {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_chip_dbg: IOPMP_CHIP_DBG {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_eip120i: IOPMP_EIP120I {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_eip120ii: IOPMP_EIP120II {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_eip120iii: IOPMP_EIP120III {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_isp0: IOPMP_ISP0 {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_isp1: IOPMP_ISP1 {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_dw200: IOPMP_DW200 {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_vipre: IOPMP_VIPRE {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_venc: IOPMP_VENC {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_vdec: IOPMP_VDEC {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_g2d: IOPMP_G2D {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_fce: IOPMP_FCE {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_npu: IOPMP_NPU {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp0_dpu: IOPMP0_DPU {
|
||||
bypass_en;
|
||||
};
|
||||
|
||||
iopmp1_dpu: IOPMP1_DPU {
|
||||
bypass_en;
|
||||
};
|
||||
|
||||
iopmp_gpu: IOPMP_GPU {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_gmac1: IOPMP_GMAC1 {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_gmac2: IOPMP_GMAC2 {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_dmac: IOPMP_DMAC {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_tee_dmac: IOPMP_TEE_DMAC {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_dsp0: IOPMP_DSP0 {
|
||||
is_default_region;
|
||||
};
|
||||
|
||||
iopmp_dsp1: IOPMP_DSP1 {
|
||||
is_default_region;
|
||||
};
|
||||
};
|
||||
|
||||
mbox_910t_client1: mbox_910t_client1 {
|
||||
compatible = "thead,light-mbox-client";
|
||||
mbox-names = "902";
|
||||
mboxes = <&mbox_910t 1 0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
mbox_910t_client2: mbox_910t_client2 {
|
||||
compatible = "thead,light-mbox-client";
|
||||
mbox-names = "906";
|
||||
mboxes = <&mbox_910t 2 0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
lightsound: lightsound@1 {
|
||||
status = "okay";
|
||||
compatible = "simple-audio-card";
|
||||
simple-audio-card,name = "Light-Sound-Card";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
/* I2S - AUDIO SYS CODEC 8156*/
|
||||
simple-audio-card,dai-link@0 {
|
||||
reg = <0>;
|
||||
format = "i2s";
|
||||
cpu {
|
||||
sound-dai = <&i2s1 0>;
|
||||
};
|
||||
codec {
|
||||
sound-dai = <&es8156_audio_codec>;
|
||||
};
|
||||
};
|
||||
|
||||
/* I2S - HDMI */
|
||||
simple-audio-card,dai-link@1 {
|
||||
reg = <1>;
|
||||
format = "i2s";
|
||||
cpu {
|
||||
sound-dai = <&light_i2s 1>;
|
||||
};
|
||||
codec {
|
||||
sound-dai = <&dummy_codec>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
wifi_pwrseq: wifi-pwrseq {
|
||||
status = "okay";
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
reset-gpios = <&gpio0_porta 20 1>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_wireless_power>;
|
||||
};
|
||||
|
||||
dummy_codec: dummy_codec {
|
||||
#sound-dai-cells = <0>;
|
||||
compatible = "thead,light-dummy-pcm";
|
||||
status = "okay";
|
||||
sound-name-prefix = "DUMMY";
|
||||
};
|
||||
|
||||
vdd_5v: regulator-vdd-5v {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vdd_5v";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
vdd_1v8: regulator-vdd-1v8 {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vdd_1v8";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
vin-supply = <&vdd_5v>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
reg_vref_1v8: regulator-adc-verf {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vref-1v8";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
usb_vbus_en: regulator-usb-vbus-en {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "usb_vbus_en";
|
||||
gpio = <&gpio0_porta 27 0>; /* GPIO_ACTIVE_HIGH: 0 */
|
||||
enable-active-high;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
/* Select USB3.0 Type-A port */
|
||||
usb_select: regulator-usb-select {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "usb_select";
|
||||
gpio = <&gpio2_porta 30 1>; /* GPIO_ACTIVE_LOW: 1 */
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
board_antenna: board-antenna {
|
||||
status = "okay";
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpio = <&gpio1_porta 24 0>;
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-name = "board_antenna";
|
||||
};
|
||||
|
||||
aon {
|
||||
compatible = "thead,light-aon";
|
||||
mbox-names = "aon";
|
||||
mboxes = <&mbox_910t 1 0>;
|
||||
status = "okay";
|
||||
|
||||
pd: light-aon-pd {
|
||||
compatible = "thead,light-aon-pd";
|
||||
#power-domain-cells = <1>;
|
||||
};
|
||||
|
||||
aon_reg_dialog: light-dialog-reg {
|
||||
compatible = "thead,light-dialog-pmic-ant";
|
||||
status = "okay";
|
||||
|
||||
dvdd_cpu_reg: appcpu_dvdd {
|
||||
regulator-name = "appcpu_dvdd";
|
||||
regulator-min-microvolt = <300000>;
|
||||
regulator-max-microvolt = <1570000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
dvddm_cpu_reg: appcpu_dvddm {
|
||||
regulator-name = "appcpu_dvddm";
|
||||
regulator-min-microvolt = <300000>;
|
||||
regulator-max-microvolt = <1570000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_dvdd18_aon_reg: soc_dvdd18_aon {
|
||||
regulator-name = "soc_dvdd18_aon";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_avdd33_usb3_reg: soc_avdd33_usb3 {
|
||||
regulator-name = "soc_avdd33_usb3";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_dvdd08_aon_reg: soc_dvdd08_aon {
|
||||
regulator-name = "soc_dvdd08_aon";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_dvdd08_ddr_reg: soc_dvdd08_ddr {
|
||||
regulator-name = "soc_dvdd08_ddr";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_vdd_ddr_1v8_reg: soc_vdd_ddr_1v8 {
|
||||
regulator-name = "soc_vdd_ddr_1v8";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_vdd_ddr_1v1_reg: soc_vdd_ddr_1v1 {
|
||||
regulator-name = "soc_vdd_ddr_1v1";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_vdd_ddr_0v6_reg: soc_vdd_ddr_0v6 {
|
||||
regulator-name = "soc_vdd_ddr_0v6";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_dvdd18_ap_reg: soc_dvdd18_ap {
|
||||
regulator-name = "soc_dvdd18_ap";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_avdd08_mipi_hdmi_reg: soc_avdd08_mipi_hdmi {
|
||||
regulator-name = "soc_avdd08_mipi_hdmi";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_avdd18_mipi_hdmi_reg: soc_avdd18_mipi_hdmi {
|
||||
regulator-name = "soc_avdd18_mipi_hdmi";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_vdd33_emmc_reg: soc_vdd33_emmc {
|
||||
regulator-name = "soc_vdd33_emmc";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_vdd18_emmc_reg: soc_vdd18_emmc {
|
||||
regulator-name = "soc_vdd18_emmc";
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_dovdd18_scan_reg: soc_dovdd18_scan {
|
||||
regulator-name = "soc_dovdd18_scan";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
soc_dvdd12_scan_reg: soc_dvdd12_scan {
|
||||
regulator-name = "soc_dvdd12_scan";
|
||||
regulator-min-microvolt = <900000>;
|
||||
regulator-max-microvolt = <3600000>;
|
||||
};
|
||||
|
||||
soc_avdd28_scan_en_reg: soc_avdd28_scan_en {
|
||||
regulator-name = "soc_avdd28_scan_en";
|
||||
regulator-min-microvolt = <900000>;
|
||||
regulator-max-microvolt = <3600000>;
|
||||
};
|
||||
};
|
||||
|
||||
c910_cpufreq {
|
||||
compatible = "thead,light-mpw-cpufreq";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
test: light-aon-test {
|
||||
compatible = "thead,light-aon-test";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&cmamem {
|
||||
alloc-ranges = <0 0xe4000000 0 0x14000000>; // [0xE400_0000 ~ 0xF800_0000]
|
||||
};
|
||||
|
||||
&resmem {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
ranges;
|
||||
|
||||
tee_mem: memory@1a000000 {
|
||||
reg = <0x0 0x1a000000 0 0x4000000>;
|
||||
no-map;
|
||||
};
|
||||
dsp0_mem: memory@20000000 { /**0x2000_0000~0x2040_0000 4M**/
|
||||
reg = <0x0 0x20000000 0x0 0x00280000 /* DSP FW code&data section 2.5M*/
|
||||
0x0 0x20280000 0x0 0x00001000 /* DSP communication area 4K*/
|
||||
0x0 0x20281000 0x0 0x00007000 /* Panic/log page 28K */
|
||||
0x0 0x20288000 0x0 0x00178000>; /* DSP shared memory 1.5M-32K*/
|
||||
no-map;
|
||||
};
|
||||
dsp1_mem: memory@20400000 { /**0x2040_0000~0x2080_0000 4M**/
|
||||
reg = <0x0 0x20400000 0x0 0x00280000 /* DSP FW code&data section */
|
||||
0x0 0x20680000 0x0 0x00001000 /* DSP communication area */
|
||||
0x0 0x20681000 0x0 0x00007000 /* Panic/log page*/
|
||||
0x0 0x20688000 0x0 0x00178000>; /* DSP shared memory */
|
||||
no-map;
|
||||
};
|
||||
vi_mem: framebuffer@0f800000 {
|
||||
reg = <0x0 0x0F800000 0x0 0x05400000 /* vi_mem_pool_region[0] 84 MB (default) */
|
||||
0x0 0x14C00000 0x0 0x01D00000 /* vi_mem_pool_region[1] 29 MB */
|
||||
0x0 0x16900000 0x0 0x03200000>; /* vi_mem_pool_region[2] 50 MB */
|
||||
no-map;
|
||||
};
|
||||
facelib_mem: memory@22000000 {
|
||||
reg = <0x0 0x22000000 0x0 0x10000000>;
|
||||
no-map;
|
||||
};
|
||||
};
|
||||
|
||||
&adc {
|
||||
vref-supply = <®_vref_1v8>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
clock-frequency = <400000>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&i2c1 {
|
||||
clock-frequency = <400000>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&audio_i2c0 {
|
||||
clock-frequency = <100000>;
|
||||
status = "okay";
|
||||
|
||||
es8156_audio_codec: es8156@9 {
|
||||
#sound-dai-cells = <0>;
|
||||
compatible = "everest,es8156";
|
||||
reg = <0x09>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_audio_i2s1_mclk>;
|
||||
};
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
clock-frequency = <100000000>;
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
phy-mode = "rgmii-id";
|
||||
rx-clk-delay = <0x00>; /* for RGMII */
|
||||
tx-clk-delay = <0x00>; /* for RGMII */
|
||||
phy-handle = <&phy_88E1111_0>;
|
||||
status = "okay";
|
||||
|
||||
mdio0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "snps,dwmac-mdio";
|
||||
|
||||
phy_88E1111_0: ethernet-phy@0 {
|
||||
reg = <0x1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&gmac1 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&emmc {
|
||||
max-frequency = <198000000>;
|
||||
non-removable;
|
||||
mmc-hs400-1_8v;
|
||||
io_fixed_1v8;
|
||||
is_emmc;
|
||||
no-sdio;
|
||||
no-sd;
|
||||
pull_up;
|
||||
bus-width = <8>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdhci0 {
|
||||
max-frequency = <198000000>;
|
||||
bus-width = <4>;
|
||||
pull_up;
|
||||
wprtn_ignore;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdhci1 {
|
||||
status = "okay";
|
||||
max-frequency = <198000000>;
|
||||
bus-width = <4>;
|
||||
pull_up;
|
||||
no-sd;
|
||||
no-mmc;
|
||||
non-removable;
|
||||
io_fixed_1v8;
|
||||
post-power-on-delay-ms = <50>;
|
||||
wprtn_ignore;
|
||||
cap-sd-highspeed;
|
||||
keep-power-in-suspend;
|
||||
mmc-pwrseq = <&wifi_pwrseq>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
brcmf: wifi@1 {
|
||||
compatible = "brcm,bcm4329-fmac";
|
||||
reg = <1>;
|
||||
};
|
||||
};
|
||||
|
||||
&padctrl0_apsys { /* right-pinctrl */
|
||||
light-evb-padctrl0 {
|
||||
/*
|
||||
* Pin Configuration Node:
|
||||
* Format: <pin_id mux_node config>
|
||||
*/
|
||||
pinctrl_uart0: uart0grp {
|
||||
thead,pins = <
|
||||
FM_UART0_TXD 0x0 0x72
|
||||
FM_UART0_RXD 0x0 0x72
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_spi0: spi0grp {
|
||||
thead,pins = <
|
||||
FM_SPI_CSN 0x3 0x20a
|
||||
FM_SPI_SCLK 0x0 0x20a
|
||||
FM_SPI_MISO 0x0 0x23a
|
||||
FM_SPI_MOSI 0x0 0x23a
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_qspi0: qspi0grp {
|
||||
thead,pins = <
|
||||
FM_QSPI0_SCLK 0x0 0x20f
|
||||
FM_QSPI0_CSN0 0x3 0x20f
|
||||
FM_QSPI0_D0_MOSI 0x0 0x23f
|
||||
FM_QSPI0_D1_MISO 0x0 0x23f
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_pwm: pwmgrp {
|
||||
thead,pins = <
|
||||
FM_QSPI0_D2_WP 0x1 0x208 /* pwm5 */
|
||||
FM_QSPI0_CSN1 0x1 0x208 /* pwm2 */
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&padctrl1_apsys { /* left-pinctrl */
|
||||
light-evb-padctrl1 {
|
||||
/*
|
||||
* Pin Configuration Node:
|
||||
* Format: <pin_id mux_node config>
|
||||
*/
|
||||
pinctrl_uart3: uart3grp {
|
||||
thead,pins = <
|
||||
FM_UART3_TXD 0x0 0x72
|
||||
FM_UART3_RXD 0x0 0x72
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_uart4: uart4grp {
|
||||
thead,pins = <
|
||||
FM_UART4_TXD 0x0 0x72
|
||||
FM_UART4_RXD 0x0 0x72
|
||||
FM_UART4_CTSN 0x0 0x72
|
||||
FM_UART4_RTSN 0x0 0x72
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_qspi1: qspi1grp {
|
||||
thead,pins = <
|
||||
FM_QSPI1_SCLK 0x0 0x20a
|
||||
FM_QSPI1_CSN0 0x3 0x20a
|
||||
FM_QSPI1_D0_MOSI 0x0 0x23a
|
||||
FM_QSPI1_D1_MISO 0x0 0x23a
|
||||
FM_QSPI1_D2_WP 0x0 0x23a
|
||||
FM_QSPI1_D3_HOLD 0x0 0x23a
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_iso7816: iso7816grp {
|
||||
thead,pins = <
|
||||
FM_QSPI1_SCLK 0x1 0x208
|
||||
FM_QSPI1_D0_MOSI 0x1 0x238
|
||||
FM_QSPI1_D1_MISO 0x1 0x238
|
||||
FM_QSPI1_D2_WP 0x1 0x238
|
||||
FM_QSPI1_D3_HOLD 0x1 0x238
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_wireless_power: wireless-power-group {
|
||||
thead,pins = <
|
||||
FM_GPIO0_20 0x0 0x23a
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_wireless_host_wake: wireless-host-wake-group {
|
||||
thead,pins = <
|
||||
FM_GPIO0_21 0x0 0x21a
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&padctrl_aosys {
|
||||
light-aon-padctrl {
|
||||
/*
|
||||
* Pin Configuration Node:
|
||||
* Format: <pin_id mux_node config>
|
||||
*/
|
||||
|
||||
pinctrl_audiopa1: audiopa1_grp {
|
||||
thead,pins = <
|
||||
FM_AUDIO_PA1 0x3 0x72
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_audiopa2: audiopa2_grp {
|
||||
thead,pins = <
|
||||
FM_AUDIO_PA2 0x0 0x72
|
||||
>;
|
||||
};
|
||||
|
||||
pinctrl_volume: volume_grp {
|
||||
thead,pins = <
|
||||
FM_CPU_JTG_TDI 0x3 0x208
|
||||
FM_CPU_JTG_TDO 0x3 0x208
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&padctrl_audiosys {
|
||||
status = "okay";
|
||||
|
||||
light-audio-padctrl {
|
||||
/*
|
||||
* Pin Configuration Node:
|
||||
* Format: <pin_id mux_node config>
|
||||
*/
|
||||
|
||||
pinctrl_audio_i2s1_mclk: audio_i2s1_mclk_grp {
|
||||
thead,pins = <
|
||||
FM_AUDIO_IO_PA13 0x0 0x20a
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&xtensa_dsp {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&xtensa_dsp0 {
|
||||
status = "okay";
|
||||
memory-region = <&dsp0_mem>;
|
||||
};
|
||||
|
||||
&xtensa_dsp1{
|
||||
status = "okay";
|
||||
memory-region = <&dsp1_mem>;
|
||||
};
|
||||
|
||||
&trng {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&eip_28 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vdec {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&venc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&isp_venc_shake {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vidmem {
|
||||
status = "okay";
|
||||
memory-region = <&vi_mem>;
|
||||
};
|
||||
|
||||
&gpu {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&npu {
|
||||
vha_clk_rate = <1000000000>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&fce {
|
||||
memory-region = <&facelib_mem>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&cpus {
|
||||
c910_0: cpu@0 {
|
||||
operating-points = <
|
||||
/* kHz uV */
|
||||
300000 650000
|
||||
800000 700000
|
||||
1500000 800000
|
||||
1848000 1000000
|
||||
>;
|
||||
light,dvddm-operating-points = <
|
||||
/* kHz uV */
|
||||
300000 800000
|
||||
800000 800000
|
||||
1500000 800000
|
||||
1848000 1000000
|
||||
>;
|
||||
};
|
||||
|
||||
c910_1: cpu@1 {
|
||||
operating-points = <
|
||||
/* kHz uV */
|
||||
300000 650000
|
||||
800000 700000
|
||||
1500000 800000
|
||||
1848000 1000000
|
||||
>;
|
||||
light,dvddm-operating-points = <
|
||||
/* kHz uV */
|
||||
300000 800000
|
||||
800000 800000
|
||||
1500000 800000
|
||||
1848000 1000000
|
||||
>;
|
||||
};
|
||||
|
||||
c910_2: cpu@2 {
|
||||
operating-points = <
|
||||
/* kHz uV */
|
||||
300000 650000
|
||||
800000 700000
|
||||
1500000 800000
|
||||
1848000 1000000
|
||||
>;
|
||||
light,dvddm-operating-points = <
|
||||
/* kHz uV */
|
||||
300000 800000
|
||||
800000 800000
|
||||
1500000 800000
|
||||
1848000 1000000
|
||||
>;
|
||||
};
|
||||
|
||||
c910_3: cpu@3 {
|
||||
operating-points = <
|
||||
/* kHz uV */
|
||||
300000 650000
|
||||
800000 700000
|
||||
1500000 800000
|
||||
1848000 1000000
|
||||
>;
|
||||
light,dvddm-operating-points = <
|
||||
/* kHz uV */
|
||||
300000 800000
|
||||
800000 800000
|
||||
1500000 800000
|
||||
1848000 1000000
|
||||
>;
|
||||
};
|
||||
};
|
||||
|
||||
&dpu {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
/* DP1 --- HDMI0 */
|
||||
&dpu_enc1 {
|
||||
status = "disabled";
|
||||
ports {
|
||||
/delete-node/ port@0;
|
||||
};
|
||||
};
|
||||
|
||||
&disp1_out {
|
||||
remote-endpoint = <&hdmi_tx_in>;
|
||||
};
|
||||
|
||||
&hdmi_tx {
|
||||
status = "okay";
|
||||
|
||||
port@0 {
|
||||
/* input */
|
||||
hdmi_tx_in: endpoint {
|
||||
remote-endpoint = <&disp1_out>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&light_i2s {
|
||||
status = "okay";
|
||||
/delete-property/ pinctrl-names;
|
||||
/delete-property/ pinctrl-0;
|
||||
};
|
||||
|
||||
&i2s0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2s1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&qspi0 {
|
||||
status = "okay";
|
||||
num-cs = <1>;
|
||||
cs-gpios = <&gpio2_porta 3 0>; // GPIO_ACTIVE_HIGH: 0
|
||||
|
||||
spi_flash: spi-flash@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0x0>;
|
||||
spi-max-frequency = <50000000>;
|
||||
spi-tx-bus-width = <1>;
|
||||
spi-rx-bus-width = <1>;
|
||||
status = "okay";
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
loader@0 {
|
||||
label = "loader";
|
||||
reg = <0x0 0x800000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&qspi1 {
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <dt-bindings/pinctrl/light-fm-aon-pinctrl.h>
|
||||
#include <dt-bindings/pinctrl/light-fm-audio-pinctrl.h>
|
||||
#include <dt-bindings/pinctrl/light-fm-pinctrl-def.h>
|
||||
#include <dt-bindings/pinctrl/light.h>
|
||||
#include <dt-bindings/clock/light-fm-ap-clock.h>
|
||||
#include <dt-bindings/clock/light-vpsys.h>
|
||||
#include <dt-bindings/clock/light-vosys.h>
|
||||
@@ -479,7 +480,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
soc {
|
||||
soc: soc {
|
||||
compatible = "simple-bus";
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
@@ -1194,7 +1195,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
g2d: gc620@ffecc80000 {
|
||||
/* g2d: gc620@ffecc80000 {
|
||||
compatible = "thead,c910-gc620";
|
||||
reg = <0xff 0xecc80000 0x0 0x40000>;
|
||||
interrupt-parent = <&intc>;
|
||||
@@ -1206,6 +1207,20 @@
|
||||
clock-names = "pclk", "aclk", "cclk";
|
||||
operating-points-v2 = <&g2d_opp_table>;
|
||||
status = "okay";
|
||||
};*/
|
||||
|
||||
g2d: gpu@13040000 {
|
||||
compatible = "vivante,gc";
|
||||
reg = <0xff 0xecc80000 0x0 0x40000>;
|
||||
|
||||
clocks = <&vpsys_clk_gate LIGHT_VPSYS_G2D_PCLK>,
|
||||
<&vpsys_clk_gate LIGHT_VPSYS_G2D_ACLK>,
|
||||
<&vpsys_clk_gate LIGHT_VPSYS_G2D_CCLK>;
|
||||
clock-names = "bus", "core", "shader";
|
||||
|
||||
interrupt-parent = <&intc>;
|
||||
interrupts = <101>;
|
||||
operating-points-v2 = <&g2d_opp_table>;
|
||||
};
|
||||
|
||||
dsi0: dw-mipi-dsi0@ffef500000 {
|
||||
|
||||
6055
arch/riscv/configs/beaglev_defconfig
Normal file
6055
arch/riscv/configs/beaglev_defconfig
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,6 @@ CONFIG_POSIX_MQUEUE=y
|
||||
CONFIG_NO_HZ_IDLE=y
|
||||
CONFIG_HIGH_RES_TIMERS=y
|
||||
CONFIG_PREEMPT=y
|
||||
CONFIG_TASKSTATS=y
|
||||
CONFIG_TASK_DELAY_ACCT=y
|
||||
CONFIG_TASK_XACCT=y
|
||||
CONFIG_TASK_IO_ACCOUNTING=y
|
||||
CONFIG_IKCONFIG=y
|
||||
CONFIG_IKCONFIG_PROC=y
|
||||
CONFIG_CGROUPS=y
|
||||
@@ -341,7 +337,6 @@ CONFIG_OVERLAY_FS=y
|
||||
CONFIG_LOCKUP_DETECTOR=y
|
||||
CONFIG_SOFTLOCKUP_DETECTOR=y
|
||||
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
|
||||
CONFIG_SCHED_INFO=y
|
||||
CONFIG_PM=y
|
||||
# CONFIG_SUSPEND is not set
|
||||
# CONFIG_PM_SLEEP is not set
|
||||
|
||||
1209
arch/riscv/configs/revyos_defconfig
Normal file
1209
arch/riscv/configs/revyos_defconfig
Normal file
File diff suppressed because it is too large
Load Diff
@@ -396,4 +396,22 @@ static inline ulong __xchg16_relaxed(ulong new, void *ptr)
|
||||
cmpxchg_relaxed((ptr), (o), (n)); \
|
||||
})
|
||||
|
||||
#define cmpxchg64_relaxed(ptr, o, n) \
|
||||
({ \
|
||||
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
|
||||
cmpxchg_relaxed((ptr), (o), (n)); \
|
||||
})
|
||||
|
||||
#define cmpxchg64_acquire(ptr, o, n) \
|
||||
({ \
|
||||
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
|
||||
cmpxchg_acquire((ptr), (o), (n)); \
|
||||
})
|
||||
|
||||
#define cmpxchg64_release(ptr, o, n) \
|
||||
({ \
|
||||
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
|
||||
cmpxchg_release((ptr), (o), (n)); \
|
||||
})
|
||||
|
||||
#endif /* _ASM_RISCV_CMPXCHG_H */
|
||||
|
||||
@@ -26,19 +26,11 @@
|
||||
|
||||
#define SR_VS_OFF _AC(0x00000000, UL)
|
||||
|
||||
#if (defined(CONFIG_VECTOR_1_0) && defined(__THEAD_VERSION__))
|
||||
#define SR_VS _AC(0x00000600, UL) /* Vector Status */
|
||||
#define SR_VS_INITIAL _AC(0x00000200, UL)
|
||||
#define SR_VS_CLEAN _AC(0x00000400, UL)
|
||||
#define SR_VS_DIRTY _AC(0x00000600, UL)
|
||||
#else
|
||||
#define SR_VS _AC(0x01800000, UL) /* Vector Status */
|
||||
#define SR_VS_INITIAL _AC(0x00800000, UL)
|
||||
#define SR_VS_CLEAN _AC(0x01000000, UL)
|
||||
#define SR_VS_DIRTY _AC(0x01800000, UL)
|
||||
|
||||
#endif
|
||||
|
||||
#define SR_XS _AC(0x00018000, UL) /* Extension Status */
|
||||
#define SR_XS_OFF _AC(0x00000000, UL)
|
||||
#define SR_XS_INITIAL _AC(0x00008000, UL)
|
||||
|
||||
@@ -20,14 +20,6 @@
|
||||
#include <asm/csr.h>
|
||||
#include <asm/asm-offsets.h>
|
||||
|
||||
#if (defined(CONFIG_VECTOR_1_0) && defined(__THEAD_VERSION__))
|
||||
#define V_ST vse8.v
|
||||
#define V_LD vle8.v
|
||||
#else
|
||||
#define V_ST vsb.v
|
||||
#define V_LD vlb.v
|
||||
#endif
|
||||
|
||||
ENTRY(__vstate_save)
|
||||
li a2, TASK_THREAD_V0
|
||||
add a0, a0, a2
|
||||
@@ -46,81 +38,14 @@ ENTRY(__vstate_save)
|
||||
csrr t0, CSR_VTYPE
|
||||
sd t0, TASK_THREAD_VTYPE_V0(a0)
|
||||
|
||||
#ifdef CONFIG_VLEN_256
|
||||
vsetvli t0, x0, e8,m1
|
||||
V_ST v0, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v1, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v2, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v3, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v4, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v5, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v6, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v7, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v8, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v9, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v10, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v11, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v12, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v13, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v14, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v15, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v16, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v17, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v18, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v19, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v20, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v21, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v22, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v23, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v24, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v25, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v26, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v27, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v28, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v29, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v30, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_ST v31, (a0)
|
||||
#else
|
||||
vsetvli t0, x0, e8,m8
|
||||
V_ST v0, (a0)
|
||||
.word 0x003072d7 /* vsetvli t0, x0, e8,m8 */
|
||||
.word 0x02050027 /* vsb.v v0, (a0) */
|
||||
addi a0, a0, RISCV_VECTOR_VLENB*8
|
||||
V_ST v8, (a0)
|
||||
.word 0x02050427 /* vsb.v v8, (a0) */
|
||||
addi a0, a0, RISCV_VECTOR_VLENB*8
|
||||
V_ST v16, (a0)
|
||||
.word 0x02050827 /* vsb.v v16, (a0) */
|
||||
addi a0, a0, RISCV_VECTOR_VLENB*8
|
||||
V_ST v24, (a0)
|
||||
#endif
|
||||
.word 0x02050c27 /* vsb.v v24, (a0) */
|
||||
|
||||
csrc sstatus, t1
|
||||
ret
|
||||
@@ -134,99 +59,23 @@ ENTRY(__vstate_restore)
|
||||
li t1, (SR_VS | SR_FS)
|
||||
csrs sstatus, t1
|
||||
|
||||
#ifdef CONFIG_VLEN_256
|
||||
vsetvli t0, x0, e8,m1
|
||||
V_LD v0, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v1, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v2, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v3, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v4, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v5, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v6, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v7, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v8, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v9, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v10, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v11, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v12, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v13, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v14, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v15, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v16, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v17, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v18, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v19, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v20, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v21, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v22, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v23, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v24, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v25, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v26, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v27, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v28, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v29, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v30, (a0)
|
||||
addi a0, a0, RISCV_VECTOR_VLENB
|
||||
V_LD v31, (a0)
|
||||
#else
|
||||
vsetvli t0, x0, e8,m8
|
||||
V_LD v0, (a0)
|
||||
.word 0x003072d7 /* vsetvli t0, x0, e8,m8 */
|
||||
.word 0x12050007 /* vlb.v v0, (a0) */
|
||||
addi a0, a0, RISCV_VECTOR_VLENB*8
|
||||
V_LD v8, (a0)
|
||||
.word 0x12050407 /* vlb.v v8, (a0) */
|
||||
addi a0, a0, RISCV_VECTOR_VLENB*8
|
||||
V_LD v16, (a0)
|
||||
.word 0x12050807 /* vlb.v v16, (a0) */
|
||||
addi a0, a0, RISCV_VECTOR_VLENB*8
|
||||
V_LD v24, (a0)
|
||||
#endif
|
||||
.word 0x12050c07 /* vlb.v v24, (a0) */
|
||||
|
||||
mv a0, t2
|
||||
ld t0, TASK_THREAD_VXSAT_V0(a0)
|
||||
csrw CSR_VXSAT, t0
|
||||
ld t0, TASK_THREAD_VXRM_V0(a0)
|
||||
csrw CSR_VXRM, t0
|
||||
ld t0, TASK_THREAD_VL_V0(a0)
|
||||
ld t2, TASK_THREAD_VTYPE_V0(a0)
|
||||
#ifdef CONFIG_VECTOR_EMU
|
||||
srli t3, t2, 63
|
||||
bne t3,zero,1f
|
||||
#endif
|
||||
vsetvl t3, t0, t2
|
||||
#ifdef CONFIG_VECTOR_EMU
|
||||
j 2f
|
||||
1: vsetvli zero,zero,e64,m2,d1
|
||||
2:
|
||||
#endif
|
||||
|
||||
.word 0x8072fe57 /* vsetvl t3, t0, t2 */
|
||||
|
||||
/* vsetvl & vsetvli would reset vstart to zero */
|
||||
ld t0, TASK_THREAD_VSTART_V0(a0)
|
||||
csrw CSR_VSTART, t0
|
||||
|
||||
@@ -8,6 +8,7 @@ source "drivers/eisa/Kconfig"
|
||||
source "drivers/pci/Kconfig"
|
||||
source "drivers/pcmcia/Kconfig"
|
||||
source "drivers/rapidio/Kconfig"
|
||||
source "drivers/nna/Kconfig"
|
||||
|
||||
|
||||
source "drivers/base/Kconfig"
|
||||
|
||||
@@ -45,6 +45,9 @@ obj-$(CONFIG_VIRTIO) += virtio/
|
||||
obj-$(CONFIG_VDPA) += vdpa/
|
||||
obj-$(CONFIG_XEN) += xen/
|
||||
|
||||
# npu-ax3386-gpl driver
|
||||
obj-y += nna/
|
||||
|
||||
# regulators early, since some subsystems rely on them to initialize
|
||||
obj-$(CONFIG_REGULATOR) += regulator/
|
||||
|
||||
|
||||
@@ -115,14 +115,6 @@ config BT_HCIUART_H4
|
||||
|
||||
Say Y here to compile support for HCI UART (H4) protocol.
|
||||
|
||||
config BT_HCIUART_RTL3WIRE
|
||||
bool "Realtek Three-wire UART (H5) protocol support"
|
||||
depends on BT_HCIUART
|
||||
help
|
||||
Realtek Three-wire UART (H5) transport layer makes it possible
|
||||
to use Realtek Bluetooth controller with Three-wire UART.
|
||||
Say Y here to compile support for Realtek Three-wire UART.
|
||||
|
||||
config BT_HCIUART_NOKIA
|
||||
tristate "UART Nokia H4+ protocol support"
|
||||
depends on BT_HCIUART
|
||||
@@ -433,4 +425,6 @@ config BT_HCIRSI
|
||||
Say Y here to compile support for HCI over Redpine into the
|
||||
kernel or say M to compile as a module.
|
||||
|
||||
source "drivers/bluetooth/rtkbt/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -45,6 +45,6 @@ hci_uart-$(CONFIG_BT_HCIUART_BCM) += hci_bcm.o
|
||||
hci_uart-$(CONFIG_BT_HCIUART_QCA) += hci_qca.o
|
||||
hci_uart-$(CONFIG_BT_HCIUART_AG6XX) += hci_ag6xx.o
|
||||
hci_uart-$(CONFIG_BT_HCIUART_MRVL) += hci_mrvl.o
|
||||
hci_uart-y += rtk_coex.o
|
||||
hci_uart-$(CONFIG_BT_HCIUART_RTL3WIRE) += hci_rtk_h5.o
|
||||
hci_uart-objs := $(hci_uart-y)
|
||||
|
||||
obj-$(CONFIG_BT_RTKBT) += rtkbt/
|
||||
|
||||
@@ -654,7 +654,6 @@ static const struct h4_recv_pkt bcm_recv_pkts[] = {
|
||||
{ H4_RECV_ACL, .recv = hci_recv_frame },
|
||||
{ H4_RECV_SCO, .recv = hci_recv_frame },
|
||||
{ H4_RECV_EVENT, .recv = hci_recv_frame },
|
||||
{ H4_RECV_ISO, .recv = hci_recv_frame },
|
||||
{ BCM_RECV_LM_DIAG, .recv = hci_recv_diag },
|
||||
{ BCM_RECV_NULL, .recv = hci_recv_diag },
|
||||
{ BCM_RECV_TYPE49, .recv = hci_recv_diag },
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
*
|
||||
* Bluetooth HCI UART driver
|
||||
@@ -5,25 +6,10 @@
|
||||
* Copyright (C) 2000-2001 Qualcomm Incorporated
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/types.h>
|
||||
@@ -31,6 +17,7 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/poll.h>
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/errno.h>
|
||||
@@ -38,32 +25,18 @@
|
||||
#include <linux/signal.h>
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include <net/bluetooth/bluetooth.h>
|
||||
#include <net/bluetooth/hci_core.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include "hci_uart.h"
|
||||
|
||||
#ifdef BTCOEX
|
||||
#include "rtk_coex.h"
|
||||
#endif
|
||||
|
||||
//#define VERSION "1.2"
|
||||
|
||||
struct h4_struct {
|
||||
unsigned long rx_state;
|
||||
unsigned long rx_count;
|
||||
struct sk_buff *rx_skb;
|
||||
struct sk_buff_head txq;
|
||||
};
|
||||
|
||||
/* H4 receiver States */
|
||||
#define H4_W4_PACKET_TYPE 0
|
||||
#define H4_W4_EVENT_HDR 1
|
||||
#define H4_W4_ACL_HDR 2
|
||||
#define H4_W4_SCO_HDR 3
|
||||
#define H4_W4_DATA 4
|
||||
|
||||
/* Initialize protocol */
|
||||
static int h4_open(struct hci_uart *hu)
|
||||
{
|
||||
@@ -71,7 +44,7 @@ static int h4_open(struct hci_uart *hu)
|
||||
|
||||
BT_DBG("hu %p", hu);
|
||||
|
||||
h4 = kzalloc(sizeof(*h4), GFP_ATOMIC);
|
||||
h4 = kzalloc(sizeof(*h4), GFP_KERNEL);
|
||||
if (!h4)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -98,8 +71,6 @@ static int h4_close(struct hci_uart *hu)
|
||||
{
|
||||
struct h4_struct *h4 = hu->priv;
|
||||
|
||||
hu->priv = NULL;
|
||||
|
||||
BT_DBG("hu %p", hu);
|
||||
|
||||
skb_queue_purge(&h4->txq);
|
||||
@@ -112,7 +83,7 @@ static int h4_close(struct hci_uart *hu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Enqueue frame for transmittion (padding, crc, etc) */
|
||||
/* Enqueue frame for transmission (padding, crc, etc) */
|
||||
static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb)
|
||||
{
|
||||
struct h4_struct *h4 = hu->priv;
|
||||
@@ -120,174 +91,34 @@ static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb)
|
||||
BT_DBG("hu %p skb %p", hu, skb);
|
||||
|
||||
/* Prepend skb with frame type */
|
||||
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
|
||||
memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
|
||||
skb_queue_tail(&h4->txq, skb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
static inline int h4_check_data_len(struct h4_struct *h4, int len)
|
||||
#else
|
||||
static inline int h4_check_data_len(struct hci_dev *hdev, struct h4_struct *h4, int len)
|
||||
#endif
|
||||
{
|
||||
register int room = skb_tailroom(h4->rx_skb);
|
||||
|
||||
BT_DBG("len %d room %d", len, room);
|
||||
|
||||
if (!len) {
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
hci_recv_frame(h4->rx_skb);
|
||||
#else
|
||||
hci_recv_frame(hdev, h4->rx_skb);
|
||||
#endif
|
||||
} else if (len > room) {
|
||||
BT_ERR("Data length is too large");
|
||||
kfree_skb(h4->rx_skb);
|
||||
} else {
|
||||
h4->rx_state = H4_W4_DATA;
|
||||
h4->rx_count = len;
|
||||
return len;
|
||||
}
|
||||
|
||||
h4->rx_state = H4_W4_PACKET_TYPE;
|
||||
h4->rx_skb = NULL;
|
||||
h4->rx_count = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
static const struct h4_recv_pkt h4_recv_pkts[] = {
|
||||
{ H4_RECV_ACL, .recv = hci_recv_frame },
|
||||
{ H4_RECV_SCO, .recv = hci_recv_frame },
|
||||
{ H4_RECV_EVENT, .recv = hci_recv_frame },
|
||||
{ H4_RECV_ISO, .recv = hci_recv_frame },
|
||||
};
|
||||
|
||||
/* Recv data */
|
||||
static int h4_recv(struct hci_uart *hu, void *data, int count)
|
||||
static int h4_recv(struct hci_uart *hu, const void *data, int count)
|
||||
{
|
||||
struct h4_struct *h4 = hu->priv;
|
||||
register char *ptr;
|
||||
struct hci_event_hdr *eh;
|
||||
struct hci_acl_hdr *ah;
|
||||
struct hci_sco_hdr *sh;
|
||||
register int len, type, dlen;
|
||||
|
||||
BT_DBG("hu %p count %d rx_state %ld rx_count %ld",
|
||||
hu, count, h4->rx_state, h4->rx_count);
|
||||
if (!test_bit(HCI_UART_REGISTERED, &hu->flags))
|
||||
return -EUNATCH;
|
||||
|
||||
ptr = data;
|
||||
while (count) {
|
||||
if (h4->rx_count) {
|
||||
len = min_t(unsigned int, h4->rx_count, count);
|
||||
memcpy(skb_put(h4->rx_skb, len), ptr, len);
|
||||
h4->rx_count -= len; count -= len; ptr += len;
|
||||
|
||||
if (h4->rx_count)
|
||||
continue;
|
||||
|
||||
switch (h4->rx_state) {
|
||||
case H4_W4_DATA:
|
||||
BT_DBG("Complete data");
|
||||
#ifdef BTCOEX
|
||||
if(bt_cb(h4->rx_skb)->pkt_type == HCI_EVENT_PKT)
|
||||
rtk_btcoex_parse_event(
|
||||
h4->rx_skb->data,
|
||||
h4->rx_skb->len);
|
||||
|
||||
if(bt_cb(h4->rx_skb)->pkt_type == HCI_ACLDATA_PKT)
|
||||
rtk_btcoex_parse_l2cap_data_rx(
|
||||
h4->rx_skb->data,
|
||||
h4->rx_skb->len);
|
||||
#endif
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
hci_recv_frame(h4->rx_skb);
|
||||
#else
|
||||
hci_recv_frame(hu->hdev, h4->rx_skb);
|
||||
#endif
|
||||
|
||||
h4->rx_state = H4_W4_PACKET_TYPE;
|
||||
h4->rx_skb = NULL;
|
||||
continue;
|
||||
|
||||
case H4_W4_EVENT_HDR:
|
||||
eh = hci_event_hdr(h4->rx_skb);
|
||||
|
||||
BT_DBG("Event header: evt 0x%2.2x plen %d", eh->evt, eh->plen);
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
h4_check_data_len(h4, eh->plen);
|
||||
#else
|
||||
h4_check_data_len(hu->hdev, h4, eh->plen);
|
||||
#endif
|
||||
continue;
|
||||
|
||||
case H4_W4_ACL_HDR:
|
||||
ah = hci_acl_hdr(h4->rx_skb);
|
||||
dlen = __le16_to_cpu(ah->dlen);
|
||||
|
||||
BT_DBG("ACL header: dlen %d", dlen);
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
h4_check_data_len(h4, dlen);
|
||||
#else
|
||||
h4_check_data_len(hu->hdev, h4, dlen);
|
||||
#endif
|
||||
continue;
|
||||
|
||||
case H4_W4_SCO_HDR:
|
||||
sh = hci_sco_hdr(h4->rx_skb);
|
||||
|
||||
BT_DBG("SCO header: dlen %d", sh->dlen);
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
h4_check_data_len(h4, sh->dlen);
|
||||
#else
|
||||
h4_check_data_len(hu->hdev, h4, sh->dlen);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* H4_W4_PACKET_TYPE */
|
||||
switch (*ptr) {
|
||||
case HCI_EVENT_PKT:
|
||||
BT_DBG("Event packet");
|
||||
h4->rx_state = H4_W4_EVENT_HDR;
|
||||
h4->rx_count = HCI_EVENT_HDR_SIZE;
|
||||
type = HCI_EVENT_PKT;
|
||||
break;
|
||||
|
||||
case HCI_ACLDATA_PKT:
|
||||
BT_DBG("ACL packet");
|
||||
h4->rx_state = H4_W4_ACL_HDR;
|
||||
h4->rx_count = HCI_ACL_HDR_SIZE;
|
||||
type = HCI_ACLDATA_PKT;
|
||||
break;
|
||||
|
||||
case HCI_SCODATA_PKT:
|
||||
BT_DBG("SCO packet");
|
||||
h4->rx_state = H4_W4_SCO_HDR;
|
||||
h4->rx_count = HCI_SCO_HDR_SIZE;
|
||||
type = HCI_SCODATA_PKT;
|
||||
break;
|
||||
|
||||
default:
|
||||
BT_ERR("Unknown HCI packet type %2.2x", (__u8)*ptr);
|
||||
hu->hdev->stat.err_rx++;
|
||||
ptr++; count--;
|
||||
continue;
|
||||
};
|
||||
|
||||
ptr++; count--;
|
||||
|
||||
/* Allocate packet */
|
||||
h4->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
|
||||
if (!h4->rx_skb) {
|
||||
BT_ERR("Can't allocate mem for new packet");
|
||||
h4->rx_state = H4_W4_PACKET_TYPE;
|
||||
h4->rx_count = 0;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
h4->rx_skb->dev = (void *) hu->hdev;
|
||||
bt_cb(h4->rx_skb)->pkt_type = type;
|
||||
h4->rx_skb = h4_recv_buf(hu->hdev, h4->rx_skb, data, count,
|
||||
h4_recv_pkts, ARRAY_SIZE(h4_recv_pkts));
|
||||
if (IS_ERR(h4->rx_skb)) {
|
||||
int err = PTR_ERR(h4->rx_skb);
|
||||
bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
|
||||
h4->rx_skb = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
return count;
|
||||
@@ -299,8 +130,9 @@ static struct sk_buff *h4_dequeue(struct hci_uart *hu)
|
||||
return skb_dequeue(&h4->txq);
|
||||
}
|
||||
|
||||
static struct hci_uart_proto h4p = {
|
||||
static const struct hci_uart_proto h4p = {
|
||||
.id = HCI_UART_H4,
|
||||
.name = "H4",
|
||||
.open = h4_open,
|
||||
.close = h4_close,
|
||||
.recv = h4_recv,
|
||||
@@ -311,17 +143,132 @@ static struct hci_uart_proto h4p = {
|
||||
|
||||
int __init h4_init(void)
|
||||
{
|
||||
int err = hci_uart_register_proto(&h4p);
|
||||
|
||||
if (!err)
|
||||
BT_INFO("HCI H4 protocol initialized");
|
||||
else
|
||||
BT_ERR("HCI H4 protocol registration failed");
|
||||
|
||||
return err;
|
||||
return hci_uart_register_proto(&h4p);
|
||||
}
|
||||
|
||||
int __exit h4_deinit(void)
|
||||
{
|
||||
return hci_uart_unregister_proto(&h4p);
|
||||
}
|
||||
|
||||
struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
|
||||
const unsigned char *buffer, int count,
|
||||
const struct h4_recv_pkt *pkts, int pkts_count)
|
||||
{
|
||||
struct hci_uart *hu = hci_get_drvdata(hdev);
|
||||
u8 alignment = hu->alignment ? hu->alignment : 1;
|
||||
|
||||
/* Check for error from previous call */
|
||||
if (IS_ERR(skb))
|
||||
skb = NULL;
|
||||
|
||||
while (count) {
|
||||
int i, len;
|
||||
|
||||
/* remove padding bytes from buffer */
|
||||
for (; hu->padding && count > 0; hu->padding--) {
|
||||
count--;
|
||||
buffer++;
|
||||
}
|
||||
if (!count)
|
||||
break;
|
||||
|
||||
if (!skb) {
|
||||
for (i = 0; i < pkts_count; i++) {
|
||||
if (buffer[0] != (&pkts[i])->type)
|
||||
continue;
|
||||
|
||||
skb = bt_skb_alloc((&pkts[i])->maxlen,
|
||||
GFP_ATOMIC);
|
||||
if (!skb)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
hci_skb_pkt_type(skb) = (&pkts[i])->type;
|
||||
hci_skb_expect(skb) = (&pkts[i])->hlen;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check for invalid packet type */
|
||||
if (!skb)
|
||||
return ERR_PTR(-EILSEQ);
|
||||
|
||||
count -= 1;
|
||||
buffer += 1;
|
||||
}
|
||||
|
||||
len = min_t(uint, hci_skb_expect(skb) - skb->len, count);
|
||||
skb_put_data(skb, buffer, len);
|
||||
|
||||
count -= len;
|
||||
buffer += len;
|
||||
|
||||
/* Check for partial packet */
|
||||
if (skb->len < hci_skb_expect(skb))
|
||||
continue;
|
||||
|
||||
for (i = 0; i < pkts_count; i++) {
|
||||
if (hci_skb_pkt_type(skb) == (&pkts[i])->type)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= pkts_count) {
|
||||
kfree_skb(skb);
|
||||
return ERR_PTR(-EILSEQ);
|
||||
}
|
||||
|
||||
if (skb->len == (&pkts[i])->hlen) {
|
||||
u16 dlen;
|
||||
|
||||
switch ((&pkts[i])->lsize) {
|
||||
case 0:
|
||||
/* No variable data length */
|
||||
dlen = 0;
|
||||
break;
|
||||
case 1:
|
||||
/* Single octet variable length */
|
||||
dlen = skb->data[(&pkts[i])->loff];
|
||||
hci_skb_expect(skb) += dlen;
|
||||
|
||||
if (skb_tailroom(skb) < dlen) {
|
||||
kfree_skb(skb);
|
||||
return ERR_PTR(-EMSGSIZE);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
/* Double octet variable length */
|
||||
dlen = get_unaligned_le16(skb->data +
|
||||
(&pkts[i])->loff);
|
||||
hci_skb_expect(skb) += dlen;
|
||||
|
||||
if (skb_tailroom(skb) < dlen) {
|
||||
kfree_skb(skb);
|
||||
return ERR_PTR(-EMSGSIZE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* Unsupported variable length */
|
||||
kfree_skb(skb);
|
||||
return ERR_PTR(-EILSEQ);
|
||||
}
|
||||
|
||||
if (!dlen) {
|
||||
hu->padding = (skb->len - 1) % alignment;
|
||||
hu->padding = (alignment - hu->padding) % alignment;
|
||||
|
||||
/* No more data, complete frame */
|
||||
(&pkts[i])->recv(hdev, skb);
|
||||
skb = NULL;
|
||||
}
|
||||
} else {
|
||||
hu->padding = (skb->len - 1) % alignment;
|
||||
hu->padding = (alignment - hu->padding) % alignment;
|
||||
|
||||
/* Complete frame */
|
||||
(&pkts[i])->recv(hdev, skb);
|
||||
skb = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return skb;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(h4_recv_buf);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* Bluetooth HCI UART driver
|
||||
@@ -5,50 +6,12 @@
|
||||
* Copyright (C) 2000-2001 Qualcomm Incorporated
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include <linux/version.h>
|
||||
#include <net/bluetooth/bluetooth.h>
|
||||
#include <net/bluetooth/hci_core.h>
|
||||
|
||||
/* #define HCI_VERSION_CODE KERNEL_VERSION(3, 14, 41) */
|
||||
#define HCI_VERSION_CODE LINUX_VERSION_CODE
|
||||
|
||||
#ifndef N_HCI
|
||||
#define N_HCI 15
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BT_HCIUART_H4
|
||||
#define CONFIG_BT_HCIUART_H4
|
||||
#endif
|
||||
|
||||
#define BTCOEX
|
||||
|
||||
/* Send host sleep notification to Controller */
|
||||
#define WOBT_NOTIFY 0 /* 1 enable; 0 disable */
|
||||
|
||||
/* Send LE whitelist only for Background scan parameters */
|
||||
#define WOBT_NOTIFY_BG_SCAN_LE_WHITELIST_ONLY (0 * WOBT_NOTIFY) /* 1 enable; 0 disable */
|
||||
|
||||
/* RTKBT Power-on Whitelist for sideband wake-up by LE Advertising from Remote.
|
||||
* Note that it's necessary to apply TV FW Patch. */
|
||||
#define RTKBT_TV_POWERON_WHITELIST (0 * WOBT_NOTIFY) /* 1 enable; 0 disable */
|
||||
|
||||
/* Ioctls */
|
||||
#define HCIUARTSETPROTO _IOW('U', 200, int)
|
||||
#define HCIUARTGETPROTO _IOR('U', 201, int)
|
||||
@@ -57,7 +20,7 @@
|
||||
#define HCIUARTGETFLAGS _IOR('U', 204, int)
|
||||
|
||||
/* UART protocols */
|
||||
#define HCI_UART_MAX_PROTO 6
|
||||
#define HCI_UART_MAX_PROTO 12
|
||||
|
||||
#define HCI_UART_H4 0
|
||||
#define HCI_UART_BCSP 1
|
||||
@@ -65,6 +28,12 @@
|
||||
#define HCI_UART_H4DS 3
|
||||
#define HCI_UART_LL 4
|
||||
#define HCI_UART_ATH3K 5
|
||||
#define HCI_UART_INTEL 6
|
||||
#define HCI_UART_BCM 7
|
||||
#define HCI_UART_QCA 8
|
||||
#define HCI_UART_AG6XX 9
|
||||
#define HCI_UART_NOKIA 10
|
||||
#define HCI_UART_MRVL 11
|
||||
|
||||
#define HCI_UART_RAW_DEVICE 0
|
||||
#define HCI_UART_RESET_ON_INIT 1
|
||||
@@ -74,42 +43,46 @@
|
||||
#define HCI_UART_VND_DETECT 5
|
||||
|
||||
struct hci_uart;
|
||||
struct serdev_device;
|
||||
|
||||
struct hci_uart_proto {
|
||||
unsigned int id;
|
||||
const char *name;
|
||||
unsigned int manufacturer;
|
||||
unsigned int init_speed;
|
||||
unsigned int oper_speed;
|
||||
int (*open)(struct hci_uart *hu);
|
||||
int (*close)(struct hci_uart *hu);
|
||||
int (*flush)(struct hci_uart *hu);
|
||||
int (*recv)(struct hci_uart *hu, void *data, int len);
|
||||
int (*setup)(struct hci_uart *hu);
|
||||
int (*set_baudrate)(struct hci_uart *hu, unsigned int speed);
|
||||
int (*recv)(struct hci_uart *hu, const void *data, int len);
|
||||
int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb);
|
||||
struct sk_buff *(*dequeue)(struct hci_uart *hu);
|
||||
};
|
||||
|
||||
struct hci_uart {
|
||||
struct tty_struct *tty;
|
||||
struct serdev_device *serdev;
|
||||
struct hci_dev *hdev;
|
||||
unsigned long flags;
|
||||
unsigned long hdev_flags;
|
||||
|
||||
struct work_struct init_ready;
|
||||
struct work_struct write_work;
|
||||
struct workqueue_struct *hci_uart_wq;
|
||||
|
||||
struct hci_uart_proto *proto;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
|
||||
struct percpu_rw_semaphore proto_lock; /* Stop work for proto close */
|
||||
#else
|
||||
struct rw_semaphore proto_lock;
|
||||
#endif
|
||||
const struct hci_uart_proto *proto;
|
||||
struct percpu_rw_semaphore proto_lock; /* Stop work for proto close */
|
||||
void *priv;
|
||||
|
||||
struct semaphore tx_sem; /* semaphore for tx */
|
||||
|
||||
struct sk_buff *tx_skb;
|
||||
unsigned long tx_state;
|
||||
|
||||
#if WOBT_NOTIFY
|
||||
struct notifier_block pm_notify_block;
|
||||
#endif
|
||||
unsigned int init_speed;
|
||||
unsigned int oper_speed;
|
||||
|
||||
u8 alignment;
|
||||
u8 padding;
|
||||
};
|
||||
|
||||
/* HCI_UART proto flag bits */
|
||||
@@ -121,20 +94,108 @@ struct hci_uart {
|
||||
#define HCI_UART_SENDING 1
|
||||
#define HCI_UART_TX_WAKEUP 2
|
||||
|
||||
extern int hci_uart_register_proto(struct hci_uart_proto *p);
|
||||
extern int hci_uart_unregister_proto(struct hci_uart_proto *p);
|
||||
extern int hci_uart_tx_wakeup(struct hci_uart *hu);
|
||||
int hci_uart_register_proto(const struct hci_uart_proto *p);
|
||||
int hci_uart_unregister_proto(const struct hci_uart_proto *p);
|
||||
int hci_uart_register_device(struct hci_uart *hu, const struct hci_uart_proto *p);
|
||||
void hci_uart_unregister_device(struct hci_uart *hu);
|
||||
|
||||
int hci_uart_tx_wakeup(struct hci_uart *hu);
|
||||
int hci_uart_wait_until_sent(struct hci_uart *hu);
|
||||
int hci_uart_init_ready(struct hci_uart *hu);
|
||||
void hci_uart_init_work(struct work_struct *work);
|
||||
void hci_uart_set_baudrate(struct hci_uart *hu, unsigned int speed);
|
||||
bool hci_uart_has_flow_control(struct hci_uart *hu);
|
||||
void hci_uart_set_flow_control(struct hci_uart *hu, bool enable);
|
||||
void hci_uart_set_speeds(struct hci_uart *hu, unsigned int init_speed,
|
||||
unsigned int oper_speed);
|
||||
|
||||
#ifdef CONFIG_BT_HCIUART_H4
|
||||
extern int h4_init(void);
|
||||
extern int h4_deinit(void);
|
||||
int h4_init(void);
|
||||
int h4_deinit(void);
|
||||
|
||||
struct h4_recv_pkt {
|
||||
u8 type; /* Packet type */
|
||||
u8 hlen; /* Header length */
|
||||
u8 loff; /* Data length offset in header */
|
||||
u8 lsize; /* Data length field size */
|
||||
u16 maxlen; /* Max overall packet length */
|
||||
int (*recv)(struct hci_dev *hdev, struct sk_buff *skb);
|
||||
};
|
||||
|
||||
#define H4_RECV_ACL \
|
||||
.type = HCI_ACLDATA_PKT, \
|
||||
.hlen = HCI_ACL_HDR_SIZE, \
|
||||
.loff = 2, \
|
||||
.lsize = 2, \
|
||||
.maxlen = HCI_MAX_FRAME_SIZE \
|
||||
|
||||
#define H4_RECV_SCO \
|
||||
.type = HCI_SCODATA_PKT, \
|
||||
.hlen = HCI_SCO_HDR_SIZE, \
|
||||
.loff = 2, \
|
||||
.lsize = 1, \
|
||||
.maxlen = HCI_MAX_SCO_SIZE
|
||||
|
||||
#define H4_RECV_EVENT \
|
||||
.type = HCI_EVENT_PKT, \
|
||||
.hlen = HCI_EVENT_HDR_SIZE, \
|
||||
.loff = 1, \
|
||||
.lsize = 1, \
|
||||
.maxlen = HCI_MAX_EVENT_SIZE
|
||||
|
||||
#define H4_RECV_ISO \
|
||||
.type = HCI_ISODATA_PKT, \
|
||||
.hlen = HCI_ISO_HDR_SIZE, \
|
||||
.loff = 2, \
|
||||
.lsize = 2, \
|
||||
.maxlen = HCI_MAX_FRAME_SIZE \
|
||||
|
||||
struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
|
||||
const unsigned char *buffer, int count,
|
||||
const struct h4_recv_pkt *pkts, int pkts_count);
|
||||
#endif
|
||||
|
||||
extern int h5_init(void);
|
||||
extern int h5_deinit(void);
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
extern int hci_uart_send_frame(struct sk_buff *skb);
|
||||
#else
|
||||
extern int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb);
|
||||
#ifdef CONFIG_BT_HCIUART_BCSP
|
||||
int bcsp_init(void);
|
||||
int bcsp_deinit(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCIUART_LL
|
||||
int ll_init(void);
|
||||
int ll_deinit(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCIUART_ATH3K
|
||||
int ath_init(void);
|
||||
int ath_deinit(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCIUART_3WIRE
|
||||
int h5_init(void);
|
||||
int h5_deinit(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCIUART_INTEL
|
||||
int intel_init(void);
|
||||
int intel_deinit(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCIUART_BCM
|
||||
int bcm_init(void);
|
||||
int bcm_deinit(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCIUART_QCA
|
||||
int qca_init(void);
|
||||
int qca_deinit(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCIUART_AG6XX
|
||||
int ag6xx_init(void);
|
||||
int ag6xx_deinit(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCIUART_MRVL
|
||||
int mrvl_init(void);
|
||||
int mrvl_deinit(void);
|
||||
#endif
|
||||
|
||||
5
drivers/bluetooth/rtkbt/Kconfig
Normal file
5
drivers/bluetooth/rtkbt/Kconfig
Normal file
@@ -0,0 +1,5 @@
|
||||
config BT_RTKBT
|
||||
tristate "BT_RTKBT"
|
||||
default n
|
||||
help
|
||||
Help message of RTKBT
|
||||
2
drivers/bluetooth/rtkbt/Makefile
Normal file
2
drivers/bluetooth/rtkbt/Makefile
Normal file
@@ -0,0 +1,2 @@
|
||||
obj-$(CONFIG_BT_RTKBT) := rtkbt.o
|
||||
rtkbt-objs := hci_ldisc.o hci_h4.o hci_rtk_h5.o rtk_coex.o
|
||||
327
drivers/bluetooth/rtkbt/hci_h4.c
Normal file
327
drivers/bluetooth/rtkbt/hci_h4.c
Normal file
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
*
|
||||
* Bluetooth HCI UART driver
|
||||
*
|
||||
* Copyright (C) 2000-2001 Qualcomm Incorporated
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/fcntl.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/signal.h>
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <net/bluetooth/bluetooth.h>
|
||||
#include <net/bluetooth/hci_core.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include "hci_uart.h"
|
||||
|
||||
#ifdef BTCOEX
|
||||
#include "rtk_coex.h"
|
||||
#endif
|
||||
|
||||
//#define VERSION "1.2"
|
||||
|
||||
struct h4_struct {
|
||||
unsigned long rx_state;
|
||||
unsigned long rx_count;
|
||||
struct sk_buff *rx_skb;
|
||||
struct sk_buff_head txq;
|
||||
};
|
||||
|
||||
/* H4 receiver States */
|
||||
#define H4_W4_PACKET_TYPE 0
|
||||
#define H4_W4_EVENT_HDR 1
|
||||
#define H4_W4_ACL_HDR 2
|
||||
#define H4_W4_SCO_HDR 3
|
||||
#define H4_W4_DATA 4
|
||||
|
||||
/* Initialize protocol */
|
||||
static int h4_open(struct hci_uart *hu)
|
||||
{
|
||||
struct h4_struct *h4;
|
||||
|
||||
BT_DBG("hu %p", hu);
|
||||
|
||||
h4 = kzalloc(sizeof(*h4), GFP_ATOMIC);
|
||||
if (!h4)
|
||||
return -ENOMEM;
|
||||
|
||||
skb_queue_head_init(&h4->txq);
|
||||
|
||||
hu->priv = h4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Flush protocol data */
|
||||
static int h4_flush(struct hci_uart *hu)
|
||||
{
|
||||
struct h4_struct *h4 = hu->priv;
|
||||
|
||||
BT_DBG("hu %p", hu);
|
||||
|
||||
skb_queue_purge(&h4->txq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Close protocol */
|
||||
static int h4_close(struct hci_uart *hu)
|
||||
{
|
||||
struct h4_struct *h4 = hu->priv;
|
||||
|
||||
hu->priv = NULL;
|
||||
|
||||
BT_DBG("hu %p", hu);
|
||||
|
||||
skb_queue_purge(&h4->txq);
|
||||
|
||||
kfree_skb(h4->rx_skb);
|
||||
|
||||
hu->priv = NULL;
|
||||
kfree(h4);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Enqueue frame for transmittion (padding, crc, etc) */
|
||||
static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb)
|
||||
{
|
||||
struct h4_struct *h4 = hu->priv;
|
||||
|
||||
BT_DBG("hu %p skb %p", hu, skb);
|
||||
|
||||
/* Prepend skb with frame type */
|
||||
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
|
||||
skb_queue_tail(&h4->txq, skb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
static inline int h4_check_data_len(struct h4_struct *h4, int len)
|
||||
#else
|
||||
static inline int h4_check_data_len(struct hci_dev *hdev, struct h4_struct *h4, int len)
|
||||
#endif
|
||||
{
|
||||
register int room = skb_tailroom(h4->rx_skb);
|
||||
|
||||
BT_DBG("len %d room %d", len, room);
|
||||
|
||||
if (!len) {
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
hci_recv_frame(h4->rx_skb);
|
||||
#else
|
||||
hci_recv_frame(hdev, h4->rx_skb);
|
||||
#endif
|
||||
} else if (len > room) {
|
||||
BT_ERR("Data length is too large");
|
||||
kfree_skb(h4->rx_skb);
|
||||
} else {
|
||||
h4->rx_state = H4_W4_DATA;
|
||||
h4->rx_count = len;
|
||||
return len;
|
||||
}
|
||||
|
||||
h4->rx_state = H4_W4_PACKET_TYPE;
|
||||
h4->rx_skb = NULL;
|
||||
h4->rx_count = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Recv data */
|
||||
static int h4_recv(struct hci_uart *hu, void *data, int count)
|
||||
{
|
||||
struct h4_struct *h4 = hu->priv;
|
||||
register char *ptr;
|
||||
struct hci_event_hdr *eh;
|
||||
struct hci_acl_hdr *ah;
|
||||
struct hci_sco_hdr *sh;
|
||||
register int len, type, dlen;
|
||||
|
||||
BT_DBG("hu %p count %d rx_state %ld rx_count %ld",
|
||||
hu, count, h4->rx_state, h4->rx_count);
|
||||
|
||||
ptr = data;
|
||||
while (count) {
|
||||
if (h4->rx_count) {
|
||||
len = min_t(unsigned int, h4->rx_count, count);
|
||||
memcpy(skb_put(h4->rx_skb, len), ptr, len);
|
||||
h4->rx_count -= len; count -= len; ptr += len;
|
||||
|
||||
if (h4->rx_count)
|
||||
continue;
|
||||
|
||||
switch (h4->rx_state) {
|
||||
case H4_W4_DATA:
|
||||
BT_DBG("Complete data");
|
||||
#ifdef BTCOEX
|
||||
if(bt_cb(h4->rx_skb)->pkt_type == HCI_EVENT_PKT)
|
||||
rtk_btcoex_parse_event(
|
||||
h4->rx_skb->data,
|
||||
h4->rx_skb->len);
|
||||
|
||||
if(bt_cb(h4->rx_skb)->pkt_type == HCI_ACLDATA_PKT)
|
||||
rtk_btcoex_parse_l2cap_data_rx(
|
||||
h4->rx_skb->data,
|
||||
h4->rx_skb->len);
|
||||
#endif
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
hci_recv_frame(h4->rx_skb);
|
||||
#else
|
||||
hci_recv_frame(hu->hdev, h4->rx_skb);
|
||||
#endif
|
||||
|
||||
h4->rx_state = H4_W4_PACKET_TYPE;
|
||||
h4->rx_skb = NULL;
|
||||
continue;
|
||||
|
||||
case H4_W4_EVENT_HDR:
|
||||
eh = hci_event_hdr(h4->rx_skb);
|
||||
|
||||
BT_DBG("Event header: evt 0x%2.2x plen %d", eh->evt, eh->plen);
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
h4_check_data_len(h4, eh->plen);
|
||||
#else
|
||||
h4_check_data_len(hu->hdev, h4, eh->plen);
|
||||
#endif
|
||||
continue;
|
||||
|
||||
case H4_W4_ACL_HDR:
|
||||
ah = hci_acl_hdr(h4->rx_skb);
|
||||
dlen = __le16_to_cpu(ah->dlen);
|
||||
|
||||
BT_DBG("ACL header: dlen %d", dlen);
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
h4_check_data_len(h4, dlen);
|
||||
#else
|
||||
h4_check_data_len(hu->hdev, h4, dlen);
|
||||
#endif
|
||||
continue;
|
||||
|
||||
case H4_W4_SCO_HDR:
|
||||
sh = hci_sco_hdr(h4->rx_skb);
|
||||
|
||||
BT_DBG("SCO header: dlen %d", sh->dlen);
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
h4_check_data_len(h4, sh->dlen);
|
||||
#else
|
||||
h4_check_data_len(hu->hdev, h4, sh->dlen);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* H4_W4_PACKET_TYPE */
|
||||
switch (*ptr) {
|
||||
case HCI_EVENT_PKT:
|
||||
BT_DBG("Event packet");
|
||||
h4->rx_state = H4_W4_EVENT_HDR;
|
||||
h4->rx_count = HCI_EVENT_HDR_SIZE;
|
||||
type = HCI_EVENT_PKT;
|
||||
break;
|
||||
|
||||
case HCI_ACLDATA_PKT:
|
||||
BT_DBG("ACL packet");
|
||||
h4->rx_state = H4_W4_ACL_HDR;
|
||||
h4->rx_count = HCI_ACL_HDR_SIZE;
|
||||
type = HCI_ACLDATA_PKT;
|
||||
break;
|
||||
|
||||
case HCI_SCODATA_PKT:
|
||||
BT_DBG("SCO packet");
|
||||
h4->rx_state = H4_W4_SCO_HDR;
|
||||
h4->rx_count = HCI_SCO_HDR_SIZE;
|
||||
type = HCI_SCODATA_PKT;
|
||||
break;
|
||||
|
||||
default:
|
||||
BT_ERR("Unknown HCI packet type %2.2x", (__u8)*ptr);
|
||||
hu->hdev->stat.err_rx++;
|
||||
ptr++; count--;
|
||||
continue;
|
||||
};
|
||||
|
||||
ptr++; count--;
|
||||
|
||||
/* Allocate packet */
|
||||
h4->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
|
||||
if (!h4->rx_skb) {
|
||||
BT_ERR("Can't allocate mem for new packet");
|
||||
h4->rx_state = H4_W4_PACKET_TYPE;
|
||||
h4->rx_count = 0;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
h4->rx_skb->dev = (void *) hu->hdev;
|
||||
bt_cb(h4->rx_skb)->pkt_type = type;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct sk_buff *h4_dequeue(struct hci_uart *hu)
|
||||
{
|
||||
struct h4_struct *h4 = hu->priv;
|
||||
return skb_dequeue(&h4->txq);
|
||||
}
|
||||
|
||||
static struct hci_uart_proto h4p = {
|
||||
.id = HCI_UART_H4,
|
||||
.open = h4_open,
|
||||
.close = h4_close,
|
||||
.recv = h4_recv,
|
||||
.enqueue = h4_enqueue,
|
||||
.dequeue = h4_dequeue,
|
||||
.flush = h4_flush,
|
||||
};
|
||||
|
||||
int __init h4_init(void)
|
||||
{
|
||||
int err = hci_uart_register_proto(&h4p);
|
||||
|
||||
if (!err)
|
||||
BT_INFO("HCI H4 protocol initialized");
|
||||
else
|
||||
BT_ERR("HCI H4 protocol registration failed");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int __exit h4_deinit(void)
|
||||
{
|
||||
return hci_uart_unregister_proto(&h4p);
|
||||
}
|
||||
1403
drivers/bluetooth/rtkbt/hci_ldisc.c
Normal file
1403
drivers/bluetooth/rtkbt/hci_ldisc.c
Normal file
File diff suppressed because it is too large
Load Diff
145
drivers/bluetooth/rtkbt/hci_uart.h
Normal file
145
drivers/bluetooth/rtkbt/hci_uart.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
*
|
||||
* Bluetooth HCI UART driver
|
||||
*
|
||||
* Copyright (C) 2000-2001 Qualcomm Incorporated
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include <linux/version.h>
|
||||
#include <net/bluetooth/bluetooth.h>
|
||||
#include <net/bluetooth/hci_core.h>
|
||||
|
||||
/* #define HCI_VERSION_CODE KERNEL_VERSION(3, 14, 41) */
|
||||
#define HCI_VERSION_CODE LINUX_VERSION_CODE
|
||||
|
||||
#ifndef N_HCI
|
||||
#define N_HCI 15
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BT_HCIUART_H4
|
||||
#define CONFIG_BT_HCIUART_H4
|
||||
#endif
|
||||
|
||||
#define BTCOEX
|
||||
|
||||
/* Send host sleep notification to Controller */
|
||||
#define WOBT_NOTIFY 0 /* 1 enable; 0 disable */
|
||||
|
||||
/* Send LE whitelist only for Background scan parameters */
|
||||
#define WOBT_NOTIFY_BG_SCAN_LE_WHITELIST_ONLY (0 * WOBT_NOTIFY) /* 1 enable; 0 disable */
|
||||
|
||||
/* RTKBT Power-on Whitelist for sideband wake-up by LE Advertising from Remote.
|
||||
* Note that it's necessary to apply TV FW Patch. */
|
||||
#define RTKBT_TV_POWERON_WHITELIST (0 * WOBT_NOTIFY) /* 1 enable; 0 disable */
|
||||
|
||||
/* RTKBT Power-on Data Filter for Manufacturer field */
|
||||
/* Note that please edit the datafilter in
|
||||
* rtkbt_set_le_device_poweron_data_filter() of hci_ldisc.c */
|
||||
#define RTKBT_TV_POWERON_DATA_FILTER (0 * WOBT_NOTIFY) /* 1 enable; 0 disable */
|
||||
|
||||
/* Ioctls */
|
||||
#define HCIUARTSETPROTO _IOW('U', 200, int)
|
||||
#define HCIUARTGETPROTO _IOR('U', 201, int)
|
||||
#define HCIUARTGETDEVICE _IOR('U', 202, int)
|
||||
#define HCIUARTSETFLAGS _IOW('U', 203, int)
|
||||
#define HCIUARTGETFLAGS _IOR('U', 204, int)
|
||||
|
||||
/* UART protocols */
|
||||
#define HCI_UART_MAX_PROTO 6
|
||||
|
||||
#define HCI_UART_H4 0
|
||||
#define HCI_UART_BCSP 1
|
||||
#define HCI_UART_3WIRE 2
|
||||
#define HCI_UART_H4DS 3
|
||||
#define HCI_UART_LL 4
|
||||
#define HCI_UART_ATH3K 5
|
||||
|
||||
#define HCI_UART_RAW_DEVICE 0
|
||||
#define HCI_UART_RESET_ON_INIT 1
|
||||
#define HCI_UART_CREATE_AMP 2
|
||||
#define HCI_UART_INIT_PENDING 3
|
||||
#define HCI_UART_EXT_CONFIG 4
|
||||
#define HCI_UART_VND_DETECT 5
|
||||
|
||||
struct hci_uart;
|
||||
|
||||
struct hci_uart_proto {
|
||||
unsigned int id;
|
||||
int (*open)(struct hci_uart *hu);
|
||||
int (*close)(struct hci_uart *hu);
|
||||
int (*flush)(struct hci_uart *hu);
|
||||
int (*recv)(struct hci_uart *hu, void *data, int len);
|
||||
int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb);
|
||||
struct sk_buff *(*dequeue)(struct hci_uart *hu);
|
||||
};
|
||||
|
||||
struct hci_uart {
|
||||
struct tty_struct *tty;
|
||||
struct hci_dev *hdev;
|
||||
unsigned long flags;
|
||||
unsigned long hdev_flags;
|
||||
|
||||
struct work_struct write_work;
|
||||
struct workqueue_struct *hci_uart_wq;
|
||||
|
||||
struct hci_uart_proto *proto;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
|
||||
struct percpu_rw_semaphore proto_lock; /* Stop work for proto close */
|
||||
#else
|
||||
struct rw_semaphore proto_lock;
|
||||
#endif
|
||||
void *priv;
|
||||
|
||||
struct semaphore tx_sem; /* semaphore for tx */
|
||||
|
||||
struct sk_buff *tx_skb;
|
||||
unsigned long tx_state;
|
||||
|
||||
#if WOBT_NOTIFY
|
||||
struct notifier_block pm_notify_block;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* HCI_UART proto flag bits */
|
||||
#define HCI_UART_PROTO_SET 0
|
||||
#define HCI_UART_REGISTERED 1
|
||||
#define HCI_UART_PROTO_READY 2
|
||||
|
||||
/* TX states */
|
||||
#define HCI_UART_SENDING 1
|
||||
#define HCI_UART_TX_WAKEUP 2
|
||||
|
||||
extern int hci_uart_register_proto(struct hci_uart_proto *p);
|
||||
extern int hci_uart_unregister_proto(struct hci_uart_proto *p);
|
||||
extern int hci_uart_tx_wakeup(struct hci_uart *hu);
|
||||
|
||||
#ifdef CONFIG_BT_HCIUART_H4
|
||||
extern int h4_init(void);
|
||||
extern int h4_deinit(void);
|
||||
#endif
|
||||
|
||||
extern int h5_init(void);
|
||||
extern int h5_deinit(void);
|
||||
|
||||
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||
extern int hci_uart_send_frame(struct sk_buff *skb);
|
||||
#else
|
||||
extern int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb);
|
||||
#endif
|
||||
@@ -34,7 +34,7 @@ enum LIGHT_MPW_CPUFREQ_CLKS {
|
||||
};
|
||||
|
||||
#define LIGHT_MPW_CPUFREQ_CLK_NUM 4
|
||||
#define LIGHT_CPUFREQ_THRE 1500000
|
||||
#define LIGHT_CPUFREQ_THRE 2000000
|
||||
#define LIGHT_C910_BUS_CLK_SYNC BIT(11)
|
||||
#define LIGHT_C910_BUS_CLK_RATIO_MASK 0x700
|
||||
#define LIGHT_C910_BUS_CLK_DIV_RATIO_2 0x100
|
||||
|
||||
@@ -1947,6 +1947,7 @@ _SetHardwareOptions(
|
||||
gcmkASSERT(gcvSTATUS_TRUE == gckHARDWARE_IsFeatureAvailable(Hardware, gcvFEATURE_SECURITY_AHB));
|
||||
|
||||
options->secureMode = gcvSECURE_IN_NORMAL;
|
||||
pr_err("gcvSECURE_IN_NORMAL because of SECURITY\n");
|
||||
|
||||
status = gckOS_QueryOption(Hardware->os, "TA", &data);
|
||||
|
||||
@@ -1958,6 +1959,7 @@ _SetHardwareOptions(
|
||||
else if (gckHARDWARE_IsFeatureAvailable(Hardware, gcvFEATURE_SECURITY_AHB))
|
||||
{
|
||||
options->secureMode = gcvSECURE_IN_NORMAL;
|
||||
pr_err("gcvSECURE_IN_NORMAL because of SECURITY_AHB\n");
|
||||
}
|
||||
|
||||
options->hasShader = database->NumShaderCores;
|
||||
|
||||
@@ -25,7 +25,7 @@ struct c910_priv {
|
||||
static gcsPLATFORM c910_platform;
|
||||
|
||||
static const struct of_device_id c910_gc620_dt_ids[] = {
|
||||
{ .compatible = "thead,c910-gc620", },
|
||||
{ .compatible = "vivante,gc", },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, c910_gc620_dt_ids);
|
||||
@@ -37,7 +37,7 @@ static gceSTATUS c910_adjustParam(IN gcsPLATFORM * Platform,
|
||||
struct resource *res;
|
||||
struct platform_device *pdev = Platform->device;
|
||||
|
||||
irq = platform_get_irq_byname(pdev, "irq_2d");
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0)
|
||||
return gcvSTATUS_NOT_FOUND;
|
||||
|
||||
@@ -58,15 +58,15 @@ static gceSTATUS c910_getPower(IN gcsPLATFORM * Platform)
|
||||
struct c910_priv *c910 = Platform->priv;
|
||||
struct platform_device *pdev = c910_platform.device;
|
||||
|
||||
c910->pclk = devm_clk_get(&pdev->dev, "pclk");
|
||||
c910->pclk = devm_clk_get(&pdev->dev, "bus");
|
||||
if (IS_ERR(c910->pclk))
|
||||
return gcvSTATUS_NOT_FOUND;
|
||||
|
||||
c910->aclk = devm_clk_get(&pdev->dev, "aclk");
|
||||
c910->aclk = devm_clk_get(&pdev->dev, "core");
|
||||
if (IS_ERR(c910->aclk))
|
||||
return gcvSTATUS_NOT_FOUND;
|
||||
|
||||
c910->cclk = devm_clk_get(&pdev->dev, "cclk");
|
||||
c910->cclk = devm_clk_get(&pdev->dev, "shader");
|
||||
if (IS_ERR(c910->cclk))
|
||||
return gcvSTATUS_NOT_FOUND;
|
||||
|
||||
@@ -118,7 +118,7 @@ int gckPLATFORM_Init(struct platform_driver *pdrv, gcsPLATFORM **platform)
|
||||
struct platform_device *pdev;
|
||||
struct c910_priv *c910;
|
||||
|
||||
np = of_find_compatible_node(NULL, NULL, "thead,c910-gc620");
|
||||
np = of_find_compatible_node(NULL, NULL, "vivante,gc");
|
||||
if (!np)
|
||||
return -ENODEV;
|
||||
of_node_put(np);
|
||||
|
||||
@@ -394,6 +394,8 @@ source "drivers/gpu/drm/xlnx/Kconfig"
|
||||
|
||||
source "drivers/gpu/drm/verisilicon/Kconfig"
|
||||
|
||||
source "drivers/gpu/drm/img-rogue/Kconfig"
|
||||
|
||||
# Keep legacy drivers last
|
||||
|
||||
menuconfig DRM_LEGACY
|
||||
|
||||
@@ -57,6 +57,8 @@ drm_kms_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o
|
||||
obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
|
||||
obj-$(CONFIG_DRM_DEBUG_SELFTEST) += selftests/
|
||||
|
||||
obj-$(CONFIG_DRM_POWERVR_ROGUE) += img-rogue/
|
||||
|
||||
obj-$(CONFIG_DRM) += drm.o
|
||||
obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o
|
||||
obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o
|
||||
|
||||
@@ -62,6 +62,12 @@ config DRM_LONTIUM_LT9611
|
||||
HDMI signals
|
||||
Please say Y if you have such hardware.
|
||||
|
||||
config DRM_LONTIUM_LT8911EXB
|
||||
tristate "Lontium LT8911EXB mipi2edp chip"
|
||||
depends on OF
|
||||
help
|
||||
Driver for Lontium LT8911EXB DSI to eDP bridge
|
||||
|
||||
config DRM_LVDS_CODEC
|
||||
tristate "Transparent LVDS encoders and decoders support"
|
||||
depends on OF
|
||||
|
||||
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
|
||||
obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
|
||||
obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
|
||||
obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
|
||||
obj-$(CONFIG_DRM_LONTIUM_LT8911EXB) += lontium-lt8911exb.o
|
||||
obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
|
||||
obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o
|
||||
obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
|
||||
|
||||
1054
drivers/gpu/drm/bridge/lontium-lt8911exb.c
Normal file
1054
drivers/gpu/drm/bridge/lontium-lt8911exb.c
Normal file
File diff suppressed because it is too large
Load Diff
79
drivers/gpu/drm/bridge/lontium-lt8911exb.h
Normal file
79
drivers/gpu/drm/bridge/lontium-lt8911exb.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Lontium LT8911EXB MIPI to EDP driver
|
||||
|
||||
Copyright (C) 2016 - 2017 Topband. Ltd.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be a reference
|
||||
to you, when you are integrating the Lontium's LT8911EXB IC into your system,
|
||||
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.
|
||||
|
||||
Author: shenhaibo
|
||||
Version: 1.1.0
|
||||
Release Date: 2019/3/6
|
||||
*/
|
||||
|
||||
#ifndef _LONTIUM_LT8911EXB_H_
|
||||
#define _LONTIUM_LT8911EXB_H_
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/hrtimer.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
#include <linux/usb.h>
|
||||
#include <linux/power_supply.h>
|
||||
|
||||
#define LT8911EXB_I2C_NAME "lt8911exb"
|
||||
#define LT8911EXB_DRIVER_VERSION "1.0.0"
|
||||
|
||||
#define LT8911EXB_ADDR_LENGTH 1
|
||||
#define I2C_MAX_TRANSFER_SIZE 255
|
||||
#define RETRY_MAX_TIMES 3
|
||||
|
||||
struct lt8911exb_data {
|
||||
struct i2c_client *client;
|
||||
int pwr_gpio;
|
||||
int rst_gpio;
|
||||
|
||||
int hact;
|
||||
int vact;
|
||||
int hbp;
|
||||
int hfp;
|
||||
int hs;
|
||||
int vbp;
|
||||
int vfp;
|
||||
int vs;
|
||||
int pclk;
|
||||
int htotal;
|
||||
int vtotal;
|
||||
|
||||
int lane_cnt;
|
||||
int mipi_lane;
|
||||
int color; //Color Depth 0:6bit 1:8bit
|
||||
int test;
|
||||
};
|
||||
|
||||
#endif /*_LONTIUM_LT8911EXB_H_*/
|
||||
@@ -65,6 +65,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
#define chipModel_GC520 0x00000520
|
||||
#define chipModel_GC530 0x00000530
|
||||
#define chipModel_GC600 0x00000600
|
||||
#define chipModel_GC620 0x00000620
|
||||
#define chipModel_GC700 0x00000700
|
||||
#define chipModel_GC800 0x00000800
|
||||
#define chipModel_GC860 0x00000860
|
||||
|
||||
@@ -53,11 +53,12 @@ static inline void CMD_END(struct etnaviv_cmdbuf *buffer)
|
||||
OUT(buffer, VIV_FE_END_HEADER_OP_END);
|
||||
}
|
||||
|
||||
static inline void CMD_WAIT(struct etnaviv_cmdbuf *buffer)
|
||||
static inline void CMD_WAIT(struct etnaviv_cmdbuf *buffer,
|
||||
unsigned int waitcycles)
|
||||
{
|
||||
buffer->user_size = ALIGN(buffer->user_size, 8);
|
||||
|
||||
OUT(buffer, VIV_FE_WAIT_HEADER_OP_WAIT | 200);
|
||||
OUT(buffer, VIV_FE_WAIT_HEADER_OP_WAIT | waitcycles);
|
||||
}
|
||||
|
||||
static inline void CMD_LINK(struct etnaviv_cmdbuf *buffer,
|
||||
@@ -168,7 +169,7 @@ u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu)
|
||||
/* initialize buffer */
|
||||
buffer->user_size = 0;
|
||||
|
||||
CMD_WAIT(buffer);
|
||||
CMD_WAIT(buffer, gpu->fe_waitcycles);
|
||||
CMD_LINK(buffer, 2,
|
||||
etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping)
|
||||
+ buffer->user_size - 4);
|
||||
@@ -320,7 +321,7 @@ void etnaviv_sync_point_queue(struct etnaviv_gpu *gpu, unsigned int event)
|
||||
CMD_END(buffer);
|
||||
|
||||
/* Append waitlink */
|
||||
CMD_WAIT(buffer);
|
||||
CMD_WAIT(buffer, gpu->fe_waitcycles);
|
||||
CMD_LINK(buffer, 2,
|
||||
etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping)
|
||||
+ buffer->user_size - 4);
|
||||
@@ -416,8 +417,11 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
|
||||
|
||||
if (switch_mmu_context &&
|
||||
gpu->sec_mode == ETNA_SEC_KERNEL) {
|
||||
unsigned short id =
|
||||
etnaviv_iommuv2_get_pta_id(gpu->mmu_context);
|
||||
unsigned short id;
|
||||
|
||||
etnaviv_iommuv2_update_pta_entry(gpu->mmu_context);
|
||||
|
||||
id = etnaviv_iommuv2_get_pta_id(gpu->mmu_context);
|
||||
CMD_LOAD_STATE(buffer,
|
||||
VIVS_MMUv2_PTA_CONFIG,
|
||||
VIVS_MMUv2_PTA_CONFIG_INDEX(id));
|
||||
@@ -503,7 +507,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
|
||||
|
||||
CMD_LOAD_STATE(buffer, VIVS_GL_EVENT, VIVS_GL_EVENT_EVENT_ID(event) |
|
||||
VIVS_GL_EVENT_FROM_PE);
|
||||
CMD_WAIT(buffer);
|
||||
CMD_WAIT(buffer, gpu->fe_waitcycles);
|
||||
CMD_LINK(buffer, 2,
|
||||
etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping)
|
||||
+ buffer->user_size - 4);
|
||||
|
||||
@@ -121,6 +121,9 @@ void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf)
|
||||
int order = order_base_2(ALIGN(cmdbuf->size, SUBALLOC_GRANULE) /
|
||||
SUBALLOC_GRANULE);
|
||||
|
||||
if (!suballoc)
|
||||
return;
|
||||
|
||||
mutex_lock(&suballoc->lock);
|
||||
bitmap_release_region(suballoc->granule_map,
|
||||
cmdbuf->suballoc_offset / SUBALLOC_GRANULE,
|
||||
|
||||
@@ -468,12 +468,6 @@ static const struct drm_ioctl_desc etnaviv_ioctls[] = {
|
||||
ETNA_IOCTL(PM_QUERY_SIG, pm_query_sig, DRM_RENDER_ALLOW),
|
||||
};
|
||||
|
||||
static const struct vm_operations_struct vm_ops = {
|
||||
.fault = etnaviv_gem_fault,
|
||||
.open = drm_gem_vm_open,
|
||||
.close = drm_gem_vm_close,
|
||||
};
|
||||
|
||||
static const struct file_operations fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = drm_open,
|
||||
@@ -490,16 +484,9 @@ static struct drm_driver etnaviv_drm_driver = {
|
||||
.driver_features = DRIVER_GEM | DRIVER_RENDER,
|
||||
.open = etnaviv_open,
|
||||
.postclose = etnaviv_postclose,
|
||||
.gem_free_object_unlocked = etnaviv_gem_free_object,
|
||||
.gem_vm_ops = &vm_ops,
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_pin = etnaviv_gem_prime_pin,
|
||||
.gem_prime_unpin = etnaviv_gem_prime_unpin,
|
||||
.gem_prime_get_sg_table = etnaviv_gem_prime_get_sg_table,
|
||||
.gem_prime_import_sg_table = etnaviv_gem_prime_import_sg_table,
|
||||
.gem_prime_vmap = etnaviv_gem_prime_vmap,
|
||||
.gem_prime_vunmap = etnaviv_gem_prime_vunmap,
|
||||
.gem_prime_mmap = etnaviv_gem_prime_mmap,
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
.debugfs_init = etnaviv_debugfs_init,
|
||||
@@ -685,8 +672,24 @@ static int __init etnaviv_init(void)
|
||||
of_node_put(np);
|
||||
goto unregister_platform_driver;
|
||||
}
|
||||
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(40);
|
||||
pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
|
||||
|
||||
/*
|
||||
* PTA and MTLB can have 40 bit base addresses, but
|
||||
* unfortunately, an entry in the MTLB can only point to a
|
||||
* 32 bit base address of a STLB. Moreover, to initialize the
|
||||
* MMU we need a command buffer with a 32 bit address because
|
||||
* without an MMU there is only an indentity mapping between
|
||||
* the internal 32 bit addresses and the bus addresses.
|
||||
*
|
||||
* To make things easy, we set the dma_coherent_mask to 32
|
||||
* bit to make sure we are allocating the command buffers and
|
||||
* TLBs in the lower 4 GiB address space.
|
||||
*/
|
||||
if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(40)) ||
|
||||
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) {
|
||||
dev_dbg(&pdev->dev, "No suitable DMA available\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
* Apply the same DMA configuration to the virtual etnaviv
|
||||
|
||||
@@ -49,7 +49,6 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
|
||||
struct drm_file *file);
|
||||
|
||||
int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma);
|
||||
vm_fault_t etnaviv_gem_fault(struct vm_fault *vmf);
|
||||
int etnaviv_gem_mmap_offset(struct drm_gem_object *obj, u64 *offset);
|
||||
struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj);
|
||||
void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj);
|
||||
|
||||
@@ -125,9 +125,9 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
|
||||
return;
|
||||
etnaviv_dump_core = false;
|
||||
|
||||
mutex_lock(&gpu->mmu_context->lock);
|
||||
mutex_lock(&submit->mmu_context->lock);
|
||||
|
||||
mmu_size = etnaviv_iommu_dump_size(gpu->mmu_context);
|
||||
mmu_size = etnaviv_iommu_dump_size(submit->mmu_context);
|
||||
|
||||
/* We always dump registers, mmu, ring, hanging cmdbuf and end marker */
|
||||
n_obj = 5;
|
||||
@@ -157,7 +157,7 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
|
||||
iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN |
|
||||
__GFP_NORETRY);
|
||||
if (!iter.start) {
|
||||
mutex_unlock(&gpu->mmu_context->lock);
|
||||
mutex_unlock(&submit->mmu_context->lock);
|
||||
dev_warn(gpu->dev, "failed to allocate devcoredump file\n");
|
||||
return;
|
||||
}
|
||||
@@ -169,18 +169,18 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
|
||||
memset(iter.hdr, 0, iter.data - iter.start);
|
||||
|
||||
etnaviv_core_dump_registers(&iter, gpu);
|
||||
etnaviv_core_dump_mmu(&iter, gpu->mmu_context, mmu_size);
|
||||
etnaviv_core_dump_mmu(&iter, submit->mmu_context, mmu_size);
|
||||
etnaviv_core_dump_mem(&iter, ETDUMP_BUF_RING, gpu->buffer.vaddr,
|
||||
gpu->buffer.size,
|
||||
etnaviv_cmdbuf_get_va(&gpu->buffer,
|
||||
&gpu->mmu_context->cmdbuf_mapping));
|
||||
&submit->mmu_context->cmdbuf_mapping));
|
||||
|
||||
etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD,
|
||||
submit->cmdbuf.vaddr, submit->cmdbuf.size,
|
||||
etnaviv_cmdbuf_get_va(&submit->cmdbuf,
|
||||
&gpu->mmu_context->cmdbuf_mapping));
|
||||
&submit->mmu_context->cmdbuf_mapping));
|
||||
|
||||
mutex_unlock(&gpu->mmu_context->lock);
|
||||
mutex_unlock(&submit->mmu_context->lock);
|
||||
|
||||
/* Reserve space for the bomap */
|
||||
if (n_bomap_pages) {
|
||||
|
||||
@@ -130,8 +130,7 @@ static int etnaviv_gem_mmap_obj(struct etnaviv_gem_object *etnaviv_obj,
|
||||
{
|
||||
pgprot_t vm_page_prot;
|
||||
|
||||
vma->vm_flags &= ~VM_PFNMAP;
|
||||
vma->vm_flags |= VM_MIXEDMAP;
|
||||
vma->vm_flags |= VM_PFNMAP;
|
||||
|
||||
vm_page_prot = vm_get_page_prot(vma->vm_flags);
|
||||
|
||||
@@ -171,12 +170,13 @@ int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
return obj->ops->mmap(obj, vma);
|
||||
}
|
||||
|
||||
vm_fault_t etnaviv_gem_fault(struct vm_fault *vmf)
|
||||
static vm_fault_t etnaviv_gem_fault(struct vm_fault *vmf)
|
||||
{
|
||||
struct vm_area_struct *vma = vmf->vma;
|
||||
struct drm_gem_object *obj = vma->vm_private_data;
|
||||
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
|
||||
struct page **pages, *page;
|
||||
struct page **pages;
|
||||
unsigned long pfn;
|
||||
pgoff_t pgoff;
|
||||
int err;
|
||||
|
||||
@@ -200,12 +200,12 @@ vm_fault_t etnaviv_gem_fault(struct vm_fault *vmf)
|
||||
/* We don't use vmf->pgoff since that has the fake offset: */
|
||||
pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
|
||||
|
||||
page = pages[pgoff];
|
||||
pfn = page_to_pfn(pages[pgoff]);
|
||||
|
||||
VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
|
||||
page_to_pfn(page), page_to_pfn(page) << PAGE_SHIFT);
|
||||
pfn, pfn << PAGE_SHIFT);
|
||||
|
||||
return vmf_insert_page(vma, vmf->address, page);
|
||||
return vmf_insert_pfn(vma, vmf->address, pfn);
|
||||
}
|
||||
|
||||
int etnaviv_gem_mmap_offset(struct drm_gem_object *obj, u64 *offset)
|
||||
@@ -269,7 +269,12 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
|
||||
if (mapping->use == 0) {
|
||||
mutex_lock(&mmu_context->lock);
|
||||
if (mapping->context == mmu_context)
|
||||
mapping->use += 1;
|
||||
if (va && mapping->iova != va) {
|
||||
etnaviv_iommu_reap_mapping(mapping);
|
||||
mapping = NULL;
|
||||
} else {
|
||||
mapping->use += 1;
|
||||
}
|
||||
else
|
||||
mapping = NULL;
|
||||
mutex_unlock(&mmu_context->lock);
|
||||
@@ -305,18 +310,15 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
|
||||
list_del(&mapping->obj_node);
|
||||
}
|
||||
|
||||
mapping->context = etnaviv_iommu_context_get(mmu_context);
|
||||
mapping->use = 1;
|
||||
|
||||
ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj,
|
||||
mmu_context->global->memory_base,
|
||||
mapping, va);
|
||||
if (ret < 0) {
|
||||
etnaviv_iommu_context_put(mmu_context);
|
||||
if (ret < 0)
|
||||
kfree(mapping);
|
||||
} else {
|
||||
else
|
||||
list_add_tail(&mapping->obj_node, &etnaviv_obj->vram_list);
|
||||
}
|
||||
|
||||
out:
|
||||
mutex_unlock(&etnaviv_obj->lock);
|
||||
@@ -532,10 +534,8 @@ void etnaviv_gem_free_object(struct drm_gem_object *obj)
|
||||
|
||||
WARN_ON(mapping->use);
|
||||
|
||||
if (context) {
|
||||
if (context)
|
||||
etnaviv_iommu_unmap_gem(context, mapping);
|
||||
etnaviv_iommu_context_put(context);
|
||||
}
|
||||
|
||||
list_del(&mapping->obj_node);
|
||||
kfree(mapping);
|
||||
@@ -558,6 +558,22 @@ void etnaviv_gem_obj_add(struct drm_device *dev, struct drm_gem_object *obj)
|
||||
mutex_unlock(&priv->gem_lock);
|
||||
}
|
||||
|
||||
static const struct vm_operations_struct vm_ops = {
|
||||
.fault = etnaviv_gem_fault,
|
||||
.open = drm_gem_vm_open,
|
||||
.close = drm_gem_vm_close,
|
||||
};
|
||||
|
||||
static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
|
||||
.free = etnaviv_gem_free_object,
|
||||
.pin = etnaviv_gem_prime_pin,
|
||||
.unpin = etnaviv_gem_prime_unpin,
|
||||
.get_sg_table = etnaviv_gem_prime_get_sg_table,
|
||||
.vmap = etnaviv_gem_prime_vmap,
|
||||
.vunmap = etnaviv_gem_prime_vunmap,
|
||||
.vm_ops = &vm_ops,
|
||||
};
|
||||
|
||||
static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
|
||||
const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj)
|
||||
{
|
||||
@@ -592,6 +608,7 @@ static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
|
||||
INIT_LIST_HEAD(&etnaviv_obj->vram_list);
|
||||
|
||||
*obj = &etnaviv_obj->base;
|
||||
(*obj)->funcs = &etnaviv_gem_object_funcs;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ struct etnaviv_gem_submit {
|
||||
int out_fence_id;
|
||||
struct list_head node; /* GPU active submit list */
|
||||
struct etnaviv_cmdbuf cmdbuf;
|
||||
struct pid *pid; /* submitting process */
|
||||
bool runtime_resumed;
|
||||
u32 exec_state;
|
||||
u32 flags;
|
||||
|
||||
@@ -93,7 +93,15 @@ static void *etnaviv_gem_prime_vmap_impl(struct etnaviv_gem_object *etnaviv_obj)
|
||||
static int etnaviv_gem_prime_mmap_obj(struct etnaviv_gem_object *etnaviv_obj,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return dma_buf_mmap(etnaviv_obj->base.dma_buf, vma, 0);
|
||||
int ret;
|
||||
|
||||
ret = dma_buf_mmap(etnaviv_obj->base.dma_buf, vma, 0);
|
||||
if (!ret) {
|
||||
/* Drop the reference acquired by drm_gem_mmap_obj(). */
|
||||
drm_gem_object_put(&etnaviv_obj->base);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct etnaviv_gem_ops etnaviv_gem_prime_ops = {
|
||||
|
||||
@@ -407,11 +407,14 @@ static void submit_cleanup(struct kref *kref)
|
||||
dma_fence_put(submit->in_fence);
|
||||
if (submit->out_fence) {
|
||||
/* first remove from IDR, so fence can not be found anymore */
|
||||
mutex_lock(&submit->gpu->fence_lock);
|
||||
mutex_lock(&submit->gpu->idr_lock);
|
||||
idr_remove(&submit->gpu->fence_idr, submit->out_fence_id);
|
||||
mutex_unlock(&submit->gpu->fence_lock);
|
||||
mutex_unlock(&submit->gpu->idr_lock);
|
||||
dma_fence_put(submit->out_fence);
|
||||
}
|
||||
|
||||
put_pid(submit->pid);
|
||||
|
||||
kfree(submit->pmrs);
|
||||
kfree(submit);
|
||||
}
|
||||
@@ -435,6 +438,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
|
||||
struct sync_file *sync_file = NULL;
|
||||
struct ww_acquire_ctx ticket;
|
||||
int out_fence_fd = -1;
|
||||
struct pid *pid = get_pid(task_pid(current));
|
||||
void *stream;
|
||||
int ret;
|
||||
|
||||
@@ -532,6 +536,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
|
||||
goto err_submit_ww_acquire;
|
||||
}
|
||||
|
||||
submit->pid = pid;
|
||||
|
||||
ret = etnaviv_cmdbuf_init(priv->cmdbuf_suballoc, &submit->cmdbuf,
|
||||
ALIGN(args->stream_size, 8) + 8);
|
||||
if (ret)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/string_helpers.h>
|
||||
#include <linux/thermal.h>
|
||||
|
||||
#include "etnaviv_cmdbuf.h"
|
||||
@@ -27,10 +28,6 @@
|
||||
#include "state_hi.xml.h"
|
||||
#include "cmdstream.xml.h"
|
||||
|
||||
#ifndef PHYS_OFFSET
|
||||
#define PHYS_OFFSET 0
|
||||
#endif
|
||||
|
||||
static const struct platform_device_id gpu_ids[] = {
|
||||
{ .name = "etnaviv-gpu,2d" },
|
||||
{ },
|
||||
@@ -156,6 +153,18 @@ int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value)
|
||||
*value = ~0ULL;
|
||||
break;
|
||||
|
||||
case ETNAVIV_PARAM_GPU_PRODUCT_ID:
|
||||
*value = gpu->identity.product_id;
|
||||
break;
|
||||
|
||||
case ETNAVIV_PARAM_GPU_CUSTOMER_ID:
|
||||
*value = gpu->identity.customer_id;
|
||||
break;
|
||||
|
||||
case ETNAVIV_PARAM_GPU_ECO_ID:
|
||||
*value = gpu->identity.eco_id;
|
||||
break;
|
||||
|
||||
default:
|
||||
DBG("%s: invalid param: %u", dev_name(gpu->dev), param);
|
||||
return -EINVAL;
|
||||
@@ -408,6 +417,12 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
|
||||
if (gpu->identity.model == chipModel_GC700)
|
||||
gpu->identity.features &= ~chipFeatures_FAST_CLEAR;
|
||||
|
||||
/* These models/revisions don't have the 2D pipe bit */
|
||||
if ((gpu->identity.model == chipModel_GC500 &&
|
||||
gpu->identity.revision <= 2) ||
|
||||
gpu->identity.model == chipModel_GC300)
|
||||
gpu->identity.features |= chipFeatures_PIPE_2D;
|
||||
|
||||
if ((gpu->identity.model == chipModel_GC500 &&
|
||||
gpu->identity.revision < 2) ||
|
||||
(gpu->identity.model == chipModel_GC300 &&
|
||||
@@ -441,8 +456,9 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
|
||||
gpu_read(gpu, VIVS_HI_CHIP_MINOR_FEATURE_5);
|
||||
}
|
||||
|
||||
/* GC600 idle register reports zero bits where modules aren't present */
|
||||
if (gpu->identity.model == chipModel_GC600)
|
||||
/* GC600/300 idle register reports zero bits where modules aren't present */
|
||||
if (gpu->identity.model == chipModel_GC600 ||
|
||||
gpu->identity.model == chipModel_GC300)
|
||||
gpu->idle_mask = VIVS_HI_IDLE_STATE_TX |
|
||||
VIVS_HI_IDLE_STATE_RA |
|
||||
VIVS_HI_IDLE_STATE_SE |
|
||||
@@ -478,6 +494,14 @@ static void etnaviv_gpu_update_clock(struct etnaviv_gpu *gpu)
|
||||
clock |= VIVS_HI_CLOCK_CONTROL_FSCALE_VAL(fscale);
|
||||
etnaviv_gpu_load_clock(gpu, clock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Choose number of wait cycles to target a ~30us (1/32768) max latency
|
||||
* until new work is picked up by the FE when it polls in the idle loop.
|
||||
* If the GPU base frequency is unknown use 200 wait cycles.
|
||||
*/
|
||||
gpu->fe_waitcycles = clamp(gpu->base_rate_core >> (15 - gpu->freq_scale),
|
||||
200UL, 0xffffUL);
|
||||
}
|
||||
|
||||
static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
|
||||
@@ -499,7 +523,11 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
|
||||
control |= VIVS_HI_CLOCK_CONTROL_ISOLATE_GPU;
|
||||
gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, control);
|
||||
|
||||
if (gpu->sec_mode == ETNA_SEC_KERNEL) {
|
||||
if (etnaviv_is_model_rev(gpu, GC620, 0x5552)) {
|
||||
gpu_write(gpu, 0x00800, 0x10);
|
||||
}
|
||||
|
||||
if (gpu->identity.minor_features7 & chipMinorFeatures7_BIT_SECURITY) {
|
||||
gpu_write(gpu, VIVS_MMUv2_AHB_CONTROL,
|
||||
VIVS_MMUv2_AHB_CONTROL_RESET);
|
||||
} else {
|
||||
@@ -561,7 +589,7 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
|
||||
/* We rely on the GPU running, so program the clock */
|
||||
etnaviv_gpu_update_clock(gpu);
|
||||
|
||||
gpu->fe_running = false;
|
||||
gpu->state = ETNA_GPU_STATE_RESET;
|
||||
gpu->exec_state = -1;
|
||||
if (gpu->mmu_context)
|
||||
etnaviv_iommu_context_put(gpu->mmu_context);
|
||||
@@ -629,8 +657,6 @@ void etnaviv_gpu_start_fe(struct etnaviv_gpu *gpu, u32 address, u16 prefetch)
|
||||
VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE |
|
||||
VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(prefetch));
|
||||
}
|
||||
|
||||
gpu->fe_running = true;
|
||||
}
|
||||
|
||||
static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu,
|
||||
@@ -639,6 +665,8 @@ static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu,
|
||||
u16 prefetch;
|
||||
u32 address;
|
||||
|
||||
WARN_ON(gpu->state != ETNA_GPU_STATE_INITIALIZED);
|
||||
|
||||
/* setup the MMU */
|
||||
etnaviv_iommu_restore(gpu, context);
|
||||
|
||||
@@ -648,6 +676,8 @@ static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu,
|
||||
&gpu->mmu_context->cmdbuf_mapping);
|
||||
|
||||
etnaviv_gpu_start_fe(gpu, address, prefetch);
|
||||
|
||||
gpu->state = ETNA_GPU_STATE_RUNNING;
|
||||
}
|
||||
|
||||
static void etnaviv_gpu_setup_pulse_eater(struct etnaviv_gpu *gpu)
|
||||
@@ -683,6 +713,9 @@ static void etnaviv_gpu_setup_pulse_eater(struct etnaviv_gpu *gpu)
|
||||
|
||||
static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
|
||||
{
|
||||
WARN_ON(!(gpu->state == ETNA_GPU_STATE_IDENTIFIED ||
|
||||
gpu->state == ETNA_GPU_STATE_RESET));
|
||||
|
||||
if ((etnaviv_is_model_rev(gpu, GC320, 0x5007) ||
|
||||
etnaviv_is_model_rev(gpu, GC320, 0x5220)) &&
|
||||
gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400) {
|
||||
@@ -719,7 +752,13 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
|
||||
gpu_write(gpu, VIVS_MC_BUS_CONFIG, bus_config);
|
||||
}
|
||||
|
||||
if (gpu->sec_mode == ETNA_SEC_KERNEL) {
|
||||
/* FIXME: use feature bit 5 of minor features 12, G2D_DEC400EX */
|
||||
if (etnaviv_is_model_rev(gpu, GC620, 0x5552)) {
|
||||
gpu_write(gpu, 0x800, 0x2010188);
|
||||
gpu_write(gpu, 0x808, 0x3fc104);
|
||||
}
|
||||
|
||||
if (gpu->identity.minor_features7 & chipMinorFeatures7_BIT_SECURITY) {
|
||||
u32 val = gpu_read(gpu, VIVS_MMUv2_AHB_CONTROL);
|
||||
val |= VIVS_MMUv2_AHB_CONTROL_NONSEC_ACCESS;
|
||||
gpu_write(gpu, VIVS_MMUv2_AHB_CONTROL, val);
|
||||
@@ -729,11 +768,14 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
|
||||
etnaviv_gpu_setup_pulse_eater(gpu);
|
||||
|
||||
gpu_write(gpu, VIVS_HI_INTR_ENBL, ~0U);
|
||||
|
||||
gpu->state = ETNA_GPU_STATE_INITIALIZED;
|
||||
}
|
||||
|
||||
int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
|
||||
{
|
||||
struct etnaviv_drm_private *priv = gpu->drm->dev_private;
|
||||
dma_addr_t cmdbuf_paddr;
|
||||
int ret, i;
|
||||
|
||||
ret = pm_runtime_get_sync(gpu->dev);
|
||||
@@ -762,10 +804,12 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
|
||||
* On cores with security features supported, we claim control over the
|
||||
* security states.
|
||||
*/
|
||||
if ((gpu->identity.minor_features7 & chipMinorFeatures7_BIT_SECURITY) &&
|
||||
if ((gpu->identity.minor_features7 & chipMinorFeatures7_BIT_SECURITY) ||
|
||||
(gpu->identity.minor_features10 & chipMinorFeatures10_SECURITY_AHB))
|
||||
gpu->sec_mode = ETNA_SEC_KERNEL;
|
||||
|
||||
gpu->state = ETNA_GPU_STATE_IDENTIFIED;
|
||||
|
||||
ret = etnaviv_hw_reset(gpu);
|
||||
if (ret) {
|
||||
dev_err(gpu->dev, "GPU reset failed\n");
|
||||
@@ -776,28 +820,6 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
/*
|
||||
* Set the GPU linear window to be at the end of the DMA window, where
|
||||
* the CMA area is likely to reside. This ensures that we are able to
|
||||
* map the command buffers while having the linear window overlap as
|
||||
* much RAM as possible, so we can optimize mappings for other buffers.
|
||||
*
|
||||
* For 3D cores only do this if MC2.0 is present, as with MC1.0 it leads
|
||||
* to different views of the memory on the individual engines.
|
||||
*/
|
||||
if (!(gpu->identity.features & chipFeatures_PIPE_3D) ||
|
||||
(gpu->identity.minor_features0 & chipMinorFeatures0_MC20)) {
|
||||
u32 dma_mask = (u32)dma_get_required_mask(gpu->dev);
|
||||
if (dma_mask < PHYS_OFFSET + SZ_2G)
|
||||
priv->mmu_global->memory_base = PHYS_OFFSET;
|
||||
else
|
||||
priv->mmu_global->memory_base = dma_mask - SZ_2G + 1;
|
||||
} else if (PHYS_OFFSET >= SZ_2G) {
|
||||
dev_info(gpu->dev, "Need to move linear window on MC1.0, disabling TS\n");
|
||||
priv->mmu_global->memory_base = PHYS_OFFSET;
|
||||
gpu->identity.features &= ~chipFeatures_FAST_CLEAR;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the GPU is part of a system with DMA addressing limitations,
|
||||
* request pages for our SHM backend buffers from the DMA32 zone to
|
||||
@@ -814,6 +836,31 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the GPU linear window to cover the cmdbuf region, as the GPU
|
||||
* won't be able to start execution otherwise. The alignment to 128M is
|
||||
* chosen arbitrarily but helps in debugging, as the MMU offset
|
||||
* calculations are much more straight forward this way.
|
||||
*
|
||||
* On MC1.0 cores the linear window offset is ignored by the TS engine,
|
||||
* leading to inconsistent memory views. Avoid using the offset on those
|
||||
* cores if possible, otherwise disable the TS feature.
|
||||
*/
|
||||
cmdbuf_paddr = ALIGN_DOWN(etnaviv_cmdbuf_get_pa(&gpu->buffer), SZ_128M);
|
||||
|
||||
if (!(gpu->identity.features & chipFeatures_PIPE_3D) ||
|
||||
(gpu->identity.minor_features0 & chipMinorFeatures0_MC20)) {
|
||||
if (cmdbuf_paddr >= SZ_2G)
|
||||
priv->mmu_global->memory_base = SZ_2G;
|
||||
else
|
||||
priv->mmu_global->memory_base = cmdbuf_paddr;
|
||||
} else if (cmdbuf_paddr + SZ_128M >= SZ_2G) {
|
||||
dev_info(gpu->dev,
|
||||
"Need to move linear window on MC1.0, disabling TS\n");
|
||||
gpu->identity.features &= ~chipFeatures_FAST_CLEAR;
|
||||
priv->mmu_global->memory_base = SZ_2G;
|
||||
}
|
||||
|
||||
/* Setup event management */
|
||||
spin_lock_init(&gpu->event_spinlock);
|
||||
init_completion(&gpu->event_free);
|
||||
@@ -829,8 +876,6 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
|
||||
pm_runtime_mark_last_busy(gpu->dev);
|
||||
pm_runtime_put_autosuspend(gpu->dev);
|
||||
|
||||
gpu->initialized = true;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
@@ -1027,12 +1072,28 @@ pm_put:
|
||||
}
|
||||
#endif
|
||||
|
||||
void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
|
||||
void etnaviv_gpu_recover_hang(struct etnaviv_gem_submit *submit)
|
||||
{
|
||||
struct etnaviv_gpu *gpu = submit->gpu;
|
||||
char *comm = NULL, *cmd = NULL;
|
||||
struct task_struct *task;
|
||||
unsigned int i = 0;
|
||||
|
||||
dev_err(gpu->dev, "recover hung GPU!\n");
|
||||
|
||||
task = get_pid_task(submit->pid, PIDTYPE_PID);
|
||||
if (task) {
|
||||
comm = kstrdup(task->comm, GFP_KERNEL);
|
||||
cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL);
|
||||
put_task_struct(task);
|
||||
}
|
||||
|
||||
if (comm && cmd)
|
||||
dev_err(gpu->dev, "offending task: %s (%s)\n", comm, cmd);
|
||||
|
||||
kfree(cmd);
|
||||
kfree(comm);
|
||||
|
||||
if (pm_runtime_get_sync(gpu->dev) < 0)
|
||||
goto pm_put;
|
||||
|
||||
@@ -1359,7 +1420,7 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit)
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
if (!gpu->fe_running)
|
||||
if (gpu->state == ETNA_GPU_STATE_INITIALIZED)
|
||||
etnaviv_gpu_start_fe_idleloop(gpu, submit->mmu_context);
|
||||
|
||||
if (submit->prev_mmu_context)
|
||||
@@ -1408,6 +1469,15 @@ static void sync_point_worker(struct work_struct *work)
|
||||
|
||||
static void dump_mmu_fault(struct etnaviv_gpu *gpu)
|
||||
{
|
||||
static const char *fault_reasons[] = {
|
||||
"slave not present",
|
||||
"page not present",
|
||||
"write violation",
|
||||
"out of bounds",
|
||||
"read security violation",
|
||||
"write security violation",
|
||||
};
|
||||
|
||||
u32 status_reg, status;
|
||||
int i;
|
||||
|
||||
@@ -1420,18 +1490,25 @@ static void dump_mmu_fault(struct etnaviv_gpu *gpu)
|
||||
dev_err_ratelimited(gpu->dev, "MMU fault status 0x%08x\n", status);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
const char *reason = "unknown";
|
||||
u32 address_reg;
|
||||
u32 mmu_status;
|
||||
|
||||
if (!(status & (VIVS_MMUv2_STATUS_EXCEPTION0__MASK << (i * 4))))
|
||||
mmu_status = (status >> (i * 4)) & VIVS_MMUv2_STATUS_EXCEPTION0__MASK;
|
||||
if (!mmu_status)
|
||||
continue;
|
||||
|
||||
if ((mmu_status - 1) < ARRAY_SIZE(fault_reasons))
|
||||
reason = fault_reasons[mmu_status - 1];
|
||||
|
||||
if (gpu->sec_mode == ETNA_SEC_NONE)
|
||||
address_reg = VIVS_MMUv2_EXCEPTION_ADDR(i);
|
||||
else
|
||||
address_reg = VIVS_MMUv2_SEC_EXCEPTION_ADDR;
|
||||
|
||||
dev_err_ratelimited(gpu->dev, "MMU %d fault addr 0x%08x\n", i,
|
||||
gpu_read(gpu, address_reg));
|
||||
dev_err_ratelimited(gpu->dev,
|
||||
"MMU %d fault (%s) addr 0x%08x\n",
|
||||
i, reason, gpu_read(gpu, address_reg));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1456,6 +1533,8 @@ static irqreturn_t irq_handler(int irq, void *data)
|
||||
|
||||
if (intr & VIVS_HI_INTR_ACKNOWLEDGE_MMU_EXCEPTION) {
|
||||
dump_mmu_fault(gpu);
|
||||
gpu->state = ETNA_GPU_STATE_FAULT;
|
||||
drm_sched_fault(&gpu->sched);
|
||||
intr &= ~VIVS_HI_INTR_ACKNOWLEDGE_MMU_EXCEPTION;
|
||||
}
|
||||
|
||||
@@ -1566,7 +1645,7 @@ int etnaviv_gpu_wait_idle(struct etnaviv_gpu *gpu, unsigned int timeout_ms)
|
||||
|
||||
static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
|
||||
{
|
||||
if (gpu->initialized && gpu->fe_running) {
|
||||
if (gpu->state == ETNA_GPU_STATE_RUNNING) {
|
||||
/* Replace the last WAIT with END */
|
||||
mutex_lock(&gpu->lock);
|
||||
etnaviv_buffer_end(gpu);
|
||||
@@ -1579,11 +1658,13 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
|
||||
*/
|
||||
etnaviv_gpu_wait_idle(gpu, 100);
|
||||
|
||||
gpu->fe_running = false;
|
||||
gpu->state = ETNA_GPU_STATE_INITIALIZED;
|
||||
}
|
||||
|
||||
gpu->exec_state = -1;
|
||||
|
||||
gpu->state = ETNA_GPU_STATE_IDENTIFIED;
|
||||
|
||||
return etnaviv_gpu_clk_disable(gpu);
|
||||
}
|
||||
|
||||
@@ -1671,13 +1752,11 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
|
||||
if (ret)
|
||||
goto out_workqueue;
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
ret = pm_runtime_get_sync(gpu->dev);
|
||||
#else
|
||||
#ifndef CONFIG_PM
|
||||
ret = etnaviv_gpu_clk_enable(gpu);
|
||||
#endif
|
||||
if (ret < 0)
|
||||
goto out_sched;
|
||||
#endif
|
||||
|
||||
|
||||
gpu->drm = drm;
|
||||
@@ -1690,9 +1769,6 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
|
||||
|
||||
priv->gpu[priv->num_gpus++] = gpu;
|
||||
|
||||
pm_runtime_mark_last_busy(gpu->dev);
|
||||
pm_runtime_put_autosuspend(gpu->dev);
|
||||
|
||||
return 0;
|
||||
|
||||
out_sched:
|
||||
@@ -1730,11 +1806,8 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master,
|
||||
if (gpu->mmu_context)
|
||||
etnaviv_iommu_context_put(gpu->mmu_context);
|
||||
|
||||
if (gpu->initialized) {
|
||||
etnaviv_cmdbuf_free(&gpu->buffer);
|
||||
etnaviv_iommu_global_fini(gpu);
|
||||
gpu->initialized = false;
|
||||
}
|
||||
etnaviv_cmdbuf_free(&gpu->buffer);
|
||||
etnaviv_iommu_global_fini(gpu);
|
||||
|
||||
gpu->drm = NULL;
|
||||
idr_destroy(&gpu->fence_idr);
|
||||
@@ -1769,7 +1842,8 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
|
||||
|
||||
gpu->dev = &pdev->dev;
|
||||
mutex_init(&gpu->lock);
|
||||
mutex_init(&gpu->fence_lock);
|
||||
mutex_init(&gpu->sched_lock);
|
||||
mutex_init(&gpu->idr_lock);
|
||||
|
||||
/* Map registers: */
|
||||
gpu->mmio = devm_platform_ioremap_resource(pdev, 0);
|
||||
@@ -1874,7 +1948,7 @@ static int etnaviv_gpu_rpm_resume(struct device *dev)
|
||||
return ret;
|
||||
|
||||
/* Re-initialise the basic hardware state */
|
||||
if (gpu->drm && gpu->initialized) {
|
||||
if (gpu->state == ETNA_GPU_STATE_IDENTIFIED) {
|
||||
ret = etnaviv_gpu_hw_resume(gpu);
|
||||
if (ret) {
|
||||
etnaviv_gpu_clk_disable(gpu);
|
||||
|
||||
@@ -91,6 +91,15 @@ struct clk;
|
||||
|
||||
#define ETNA_NR_EVENTS 30
|
||||
|
||||
enum etnaviv_gpu_state {
|
||||
ETNA_GPU_STATE_UNKNOWN = 0,
|
||||
ETNA_GPU_STATE_IDENTIFIED,
|
||||
ETNA_GPU_STATE_RESET,
|
||||
ETNA_GPU_STATE_INITIALIZED,
|
||||
ETNA_GPU_STATE_RUNNING,
|
||||
ETNA_GPU_STATE_FAULT,
|
||||
};
|
||||
|
||||
struct etnaviv_gpu {
|
||||
struct drm_device *drm;
|
||||
struct thermal_cooling_device *cooling;
|
||||
@@ -99,9 +108,9 @@ struct etnaviv_gpu {
|
||||
struct etnaviv_chip_identity identity;
|
||||
enum etnaviv_sec_mode sec_mode;
|
||||
struct workqueue_struct *wq;
|
||||
struct mutex sched_lock;
|
||||
struct drm_gpu_scheduler sched;
|
||||
bool initialized;
|
||||
bool fe_running;
|
||||
enum etnaviv_gpu_state state;
|
||||
|
||||
/* 'ring'-buffer: */
|
||||
struct etnaviv_cmdbuf buffer;
|
||||
@@ -116,7 +125,7 @@ struct etnaviv_gpu {
|
||||
u32 idle_mask;
|
||||
|
||||
/* Fencing support */
|
||||
struct mutex fence_lock;
|
||||
struct mutex idr_lock;
|
||||
struct idr fence_idr;
|
||||
u32 next_fence;
|
||||
u32 completed_fence;
|
||||
@@ -145,6 +154,7 @@ struct etnaviv_gpu {
|
||||
struct clk *clk_shader;
|
||||
|
||||
unsigned int freq_scale;
|
||||
unsigned int fe_waitcycles;
|
||||
unsigned long base_rate_core;
|
||||
unsigned long base_rate_shader;
|
||||
};
|
||||
@@ -168,7 +178,7 @@ bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu);
|
||||
int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m);
|
||||
#endif
|
||||
|
||||
void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu);
|
||||
void etnaviv_gpu_recover_hang(struct etnaviv_gem_submit *submit);
|
||||
void etnaviv_gpu_retire(struct etnaviv_gpu *gpu);
|
||||
int etnaviv_gpu_wait_fence_interruptible(struct etnaviv_gpu *gpu,
|
||||
u32 fence, struct drm_etnaviv_timespec *timeout);
|
||||
|
||||
@@ -37,6 +37,37 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = {
|
||||
.minor_features10 = 0x0,
|
||||
.minor_features11 = 0x0,
|
||||
},
|
||||
{
|
||||
.model = 0x620,
|
||||
.revision = 0x5552,
|
||||
.product_id = 0x6200,
|
||||
.customer_id = 0x20b,
|
||||
.eco_id = 0,
|
||||
.stream_count = 1,
|
||||
.register_max = 64,
|
||||
.thread_count = 256,
|
||||
.shader_core_count = 1,
|
||||
.vertex_cache_size = 8,
|
||||
.vertex_output_buffer_size = 512,
|
||||
.pixel_pipes = 1,
|
||||
.instruction_count = 256,
|
||||
.num_constants = 168,
|
||||
.buffer_size = 0,
|
||||
.varyings_count = 8,
|
||||
.features = 0x001b4a40,
|
||||
.minor_features0 = 0xa0600080,
|
||||
.minor_features1 = 0x18050000,
|
||||
.minor_features2 = 0x04f30000,
|
||||
.minor_features3 = 0x00060005,
|
||||
.minor_features4 = 0x20629000,
|
||||
.minor_features5 = 0x0003380c,
|
||||
.minor_features6 = 0x00000000,
|
||||
.minor_features7 = 0x00001000,
|
||||
.minor_features8 = 0x00000000,
|
||||
.minor_features9 = 0x00000180,
|
||||
.minor_features10 = 0x00004000,
|
||||
.minor_features11 = 0x00000000,
|
||||
},
|
||||
{
|
||||
.model = 0x7000,
|
||||
.revision = 0x6214,
|
||||
|
||||
@@ -186,6 +186,14 @@ static void etnaviv_iommuv2_restore_nonsec(struct etnaviv_gpu *gpu,
|
||||
gpu_write(gpu, VIVS_MMUv2_CONTROL, VIVS_MMUv2_CONTROL_ENABLE);
|
||||
}
|
||||
|
||||
void etnaviv_iommuv2_update_pta_entry(struct etnaviv_iommu_context *context)
|
||||
{
|
||||
struct etnaviv_iommuv2_context *v2_context = to_v2_context(context);
|
||||
|
||||
context->global->v2.pta_cpu[v2_context->id] = v2_context->mtlb_dma |
|
||||
VIVS_MMUv2_CONFIGURATION_MODE_MODE4_K;
|
||||
}
|
||||
|
||||
static void etnaviv_iommuv2_restore_sec(struct etnaviv_gpu *gpu,
|
||||
struct etnaviv_iommu_context *context)
|
||||
{
|
||||
@@ -216,8 +224,7 @@ static void etnaviv_iommuv2_restore_sec(struct etnaviv_gpu *gpu,
|
||||
VIVS_MMUv2_SAFE_ADDRESS_CONFIG_SEC_SAFE_ADDR_HIGH(
|
||||
upper_32_bits(context->global->bad_page_dma)));
|
||||
|
||||
context->global->v2.pta_cpu[v2_context->id] = v2_context->mtlb_dma |
|
||||
VIVS_MMUv2_CONFIGURATION_MODE_MODE4_K;
|
||||
etnaviv_iommuv2_update_pta_entry(context);
|
||||
|
||||
/* trigger a PTA load through the FE */
|
||||
prefetch = etnaviv_buffer_config_pta(gpu, v2_context->id);
|
||||
@@ -241,6 +248,7 @@ unsigned short etnaviv_iommuv2_get_pta_id(struct etnaviv_iommu_context *context)
|
||||
|
||||
return v2_context->id;
|
||||
}
|
||||
|
||||
static void etnaviv_iommuv2_restore(struct etnaviv_gpu *gpu,
|
||||
struct etnaviv_iommu_context *context)
|
||||
{
|
||||
@@ -276,6 +284,8 @@ etnaviv_iommuv2_context_alloc(struct etnaviv_iommu_global *global)
|
||||
if (!v2_context)
|
||||
return NULL;
|
||||
|
||||
v2_context->id = 0;
|
||||
#if 0
|
||||
mutex_lock(&global->lock);
|
||||
v2_context->id = find_first_zero_bit(global->v2.pta_alloc,
|
||||
ETNAVIV_PTA_ENTRIES);
|
||||
@@ -286,6 +296,7 @@ etnaviv_iommuv2_context_alloc(struct etnaviv_iommu_global *global)
|
||||
goto out_free;
|
||||
}
|
||||
mutex_unlock(&global->lock);
|
||||
#endif
|
||||
|
||||
v2_context->mtlb_cpu = dma_alloc_wc(global->dev, SZ_4K,
|
||||
&v2_context->mtlb_dma, GFP_KERNEL);
|
||||
|
||||
@@ -80,10 +80,10 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
|
||||
return -EINVAL;
|
||||
|
||||
for_each_sgtable_dma_sg(sgt, sg, i) {
|
||||
u32 pa = sg_dma_address(sg) - sg->offset;
|
||||
phys_addr_t pa = sg_dma_address(sg) - sg->offset;
|
||||
size_t bytes = sg_dma_len(sg) + sg->offset;
|
||||
|
||||
VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes);
|
||||
VERB("map[%d]: %08x %pap(%zx)", i, iova, &pa, bytes);
|
||||
|
||||
ret = etnaviv_context_map(context, da, pa, bytes, prot);
|
||||
if (ret)
|
||||
@@ -92,6 +92,8 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
|
||||
da += bytes;
|
||||
}
|
||||
|
||||
context->flush_seq++;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
@@ -117,6 +119,8 @@ static void etnaviv_iommu_unmap(struct etnaviv_iommu_context *context, u32 iova,
|
||||
|
||||
da += bytes;
|
||||
}
|
||||
|
||||
context->flush_seq++;
|
||||
}
|
||||
|
||||
static void etnaviv_iommu_remove_mapping(struct etnaviv_iommu_context *context,
|
||||
@@ -124,11 +128,26 @@ static void etnaviv_iommu_remove_mapping(struct etnaviv_iommu_context *context,
|
||||
{
|
||||
struct etnaviv_gem_object *etnaviv_obj = mapping->object;
|
||||
|
||||
lockdep_assert_held(&context->lock);
|
||||
|
||||
etnaviv_iommu_unmap(context, mapping->vram_node.start,
|
||||
etnaviv_obj->sgt, etnaviv_obj->base.size);
|
||||
drm_mm_remove_node(&mapping->vram_node);
|
||||
}
|
||||
|
||||
void etnaviv_iommu_reap_mapping(struct etnaviv_vram_mapping *mapping)
|
||||
{
|
||||
struct etnaviv_iommu_context *context = mapping->context;
|
||||
|
||||
lockdep_assert_held(&context->lock);
|
||||
WARN_ON(mapping->use);
|
||||
|
||||
etnaviv_iommu_remove_mapping(context, mapping);
|
||||
etnaviv_iommu_context_put(mapping->context);
|
||||
mapping->context = NULL;
|
||||
list_del_init(&mapping->mmu_node);
|
||||
}
|
||||
|
||||
static int etnaviv_iommu_find_iova(struct etnaviv_iommu_context *context,
|
||||
struct drm_mm_node *node, size_t size)
|
||||
{
|
||||
@@ -196,10 +215,7 @@ static int etnaviv_iommu_find_iova(struct etnaviv_iommu_context *context,
|
||||
* this mapping.
|
||||
*/
|
||||
list_for_each_entry_safe(m, n, &list, scan_node) {
|
||||
etnaviv_iommu_remove_mapping(context, m);
|
||||
etnaviv_iommu_context_put(m->context);
|
||||
m->context = NULL;
|
||||
list_del_init(&m->mmu_node);
|
||||
etnaviv_iommu_reap_mapping(m);
|
||||
list_del_init(&m->scan_node);
|
||||
}
|
||||
|
||||
@@ -217,6 +233,44 @@ static int etnaviv_iommu_find_iova(struct etnaviv_iommu_context *context,
|
||||
static int etnaviv_iommu_insert_exact(struct etnaviv_iommu_context *context,
|
||||
struct drm_mm_node *node, size_t size, u64 va)
|
||||
{
|
||||
struct etnaviv_vram_mapping *m, *n;
|
||||
struct drm_mm_node *scan_node;
|
||||
LIST_HEAD(scan_list);
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&context->lock);
|
||||
|
||||
ret = drm_mm_insert_node_in_range(&context->mm, node, size, 0, 0, va,
|
||||
va + size, DRM_MM_INSERT_LOWEST);
|
||||
if (ret != -ENOSPC)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* When we can't insert the node, due to a existing mapping blocking
|
||||
* the address space, there are two possible reasons:
|
||||
* 1. Userspace genuinely messed up and tried to reuse address space
|
||||
* before the last job using this VMA has finished executing.
|
||||
* 2. The existing buffer mappings are idle, but the buffers are not
|
||||
* destroyed yet (likely due to being referenced by another context) in
|
||||
* which case the mappings will not be cleaned up and we must reap them
|
||||
* here to make space for the new mapping.
|
||||
*/
|
||||
|
||||
drm_mm_for_each_node_in_range(scan_node, &context->mm, va, va + size) {
|
||||
m = container_of(scan_node, struct etnaviv_vram_mapping,
|
||||
vram_node);
|
||||
|
||||
if (m->use)
|
||||
return -ENOSPC;
|
||||
|
||||
list_add(&m->scan_node, &scan_list);
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(m, n, &scan_list, scan_node) {
|
||||
etnaviv_iommu_reap_mapping(m);
|
||||
list_del_init(&m->scan_node);
|
||||
}
|
||||
|
||||
return drm_mm_insert_node_in_range(&context->mm, node, size, 0, 0, va,
|
||||
va + size, DRM_MM_INSERT_LOWEST);
|
||||
}
|
||||
@@ -241,6 +295,7 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
|
||||
iova = sg_dma_address(sgt->sgl) - memory_base;
|
||||
if (iova < 0x80000000 - sg_dma_len(sgt->sgl)) {
|
||||
mapping->iova = iova;
|
||||
mapping->context = etnaviv_iommu_context_get(context);
|
||||
list_add_tail(&mapping->mmu_node, &context->mappings);
|
||||
ret = 0;
|
||||
goto unlock;
|
||||
@@ -267,8 +322,8 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
mapping->context = etnaviv_iommu_context_get(context);
|
||||
list_add_tail(&mapping->mmu_node, &context->mappings);
|
||||
context->flush_seq++;
|
||||
unlock:
|
||||
mutex_unlock(&context->lock);
|
||||
|
||||
@@ -282,13 +337,19 @@ void etnaviv_iommu_unmap_gem(struct etnaviv_iommu_context *context,
|
||||
|
||||
mutex_lock(&context->lock);
|
||||
|
||||
/* Bail if the mapping has been reaped by another thread */
|
||||
if (!mapping->context) {
|
||||
mutex_unlock(&context->lock);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If the vram node is on the mm, unmap and remove the node */
|
||||
if (mapping->vram_node.mm == &context->mm)
|
||||
etnaviv_iommu_remove_mapping(context, mapping);
|
||||
|
||||
list_del(&mapping->mmu_node);
|
||||
context->flush_seq++;
|
||||
mutex_unlock(&context->lock);
|
||||
etnaviv_iommu_context_put(context);
|
||||
}
|
||||
|
||||
static void etnaviv_iommu_context_free(struct kref *kref)
|
||||
@@ -492,6 +553,9 @@ void etnaviv_iommu_global_fini(struct etnaviv_gpu *gpu)
|
||||
struct etnaviv_drm_private *priv = gpu->drm->dev_private;
|
||||
struct etnaviv_iommu_global *global = priv->mmu_global;
|
||||
|
||||
if (!global)
|
||||
return;
|
||||
|
||||
if (--global->use > 0)
|
||||
return;
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
|
||||
struct etnaviv_vram_mapping *mapping, u64 va);
|
||||
void etnaviv_iommu_unmap_gem(struct etnaviv_iommu_context *context,
|
||||
struct etnaviv_vram_mapping *mapping);
|
||||
void etnaviv_iommu_reap_mapping(struct etnaviv_vram_mapping *mapping);
|
||||
|
||||
int etnaviv_iommu_get_suballoc_va(struct etnaviv_iommu_context *ctx,
|
||||
struct etnaviv_vram_mapping *mapping,
|
||||
@@ -123,4 +124,6 @@ etnaviv_iommuv2_context_alloc(struct etnaviv_iommu_global *global);
|
||||
u32 etnaviv_iommuv2_get_mtlb_addr(struct etnaviv_iommu_context *context);
|
||||
unsigned short etnaviv_iommuv2_get_pta_id(struct etnaviv_iommu_context *context);
|
||||
|
||||
void etnaviv_iommuv2_update_pta_entry(struct etnaviv_iommu_context *context);
|
||||
|
||||
#endif /* __ETNAVIV_MMU_H__ */
|
||||
|
||||
@@ -106,8 +106,9 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
|
||||
*/
|
||||
dma_addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS);
|
||||
change = dma_addr - gpu->hangcheck_dma_addr;
|
||||
if (gpu->completed_fence != gpu->hangcheck_fence ||
|
||||
change < 0 || change > 16) {
|
||||
if (gpu->state == ETNA_GPU_STATE_RUNNING &&
|
||||
(gpu->completed_fence != gpu->hangcheck_fence ||
|
||||
change < 0 || change > 16)) {
|
||||
gpu->hangcheck_dma_addr = dma_addr;
|
||||
gpu->hangcheck_fence = gpu->completed_fence;
|
||||
goto out_no_timeout;
|
||||
@@ -118,7 +119,7 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
|
||||
|
||||
/* get the GPU back into the init state */
|
||||
etnaviv_core_dump(submit);
|
||||
etnaviv_gpu_recover_hang(gpu);
|
||||
etnaviv_gpu_recover_hang(submit);
|
||||
|
||||
drm_sched_resubmit_jobs(&gpu->sched);
|
||||
|
||||
@@ -146,14 +147,16 @@ static const struct drm_sched_backend_ops etnaviv_sched_ops = {
|
||||
int etnaviv_sched_push_job(struct drm_sched_entity *sched_entity,
|
||||
struct etnaviv_gem_submit *submit)
|
||||
{
|
||||
struct etnaviv_gpu *gpu = submit->gpu;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* Hold the fence lock across the whole operation to avoid jobs being
|
||||
* Hold the sched lock across the whole operation to avoid jobs being
|
||||
* pushed out of order with regard to their sched fence seqnos as
|
||||
* allocated in drm_sched_job_init.
|
||||
*/
|
||||
mutex_lock(&submit->gpu->fence_lock);
|
||||
mutex_lock(&gpu->sched_lock);
|
||||
|
||||
ret = drm_sched_job_init(&submit->sched_job, sched_entity,
|
||||
submit->ctx);
|
||||
@@ -161,9 +164,11 @@ int etnaviv_sched_push_job(struct drm_sched_entity *sched_entity,
|
||||
goto out_unlock;
|
||||
|
||||
submit->out_fence = dma_fence_get(&submit->sched_job.s_fence->finished);
|
||||
submit->out_fence_id = idr_alloc_cyclic(&submit->gpu->fence_idr,
|
||||
mutex_lock(&gpu->idr_lock);
|
||||
submit->out_fence_id = idr_alloc_cyclic(&gpu->fence_idr,
|
||||
submit->out_fence, 0,
|
||||
INT_MAX, GFP_KERNEL);
|
||||
mutex_unlock(&gpu->idr_lock);
|
||||
if (submit->out_fence_id < 0) {
|
||||
drm_sched_job_cleanup(&submit->sched_job);
|
||||
ret = -ENOMEM;
|
||||
@@ -176,7 +181,7 @@ int etnaviv_sched_push_job(struct drm_sched_entity *sched_entity,
|
||||
drm_sched_entity_push_job(&submit->sched_job, sched_entity);
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&submit->gpu->fence_lock);
|
||||
mutex_unlock(&gpu->sched_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
24
drivers/gpu/drm/img-rogue/Kconfig
Normal file
24
drivers/gpu/drm/img-rogue/Kconfig
Normal file
@@ -0,0 +1,24 @@
|
||||
config DRM_POWERVR_ROGUE
|
||||
tristate "PowerVR Rogue"
|
||||
depends on HAS_IOMEM
|
||||
depends on DRM
|
||||
select DRM_KMS_HELPER
|
||||
select PM_DEVFREQ
|
||||
select DEVFREQ_GOV_SIMPLE_ONDEMAND
|
||||
select PM_OPP
|
||||
select DEVFREQ_THERMAL
|
||||
select SYNC_FILE
|
||||
help
|
||||
Driver for PowerVR Rogue graphics hardware.
|
||||
|
||||
Say Y here if your SoC contains a PowerVR Rogue GPU. For more
|
||||
information, see <http://www.imgtec.com/powervr/>.
|
||||
|
||||
config DRM_POWERVR_ROGUE_DEBUG
|
||||
bool "Enable PowerVR Rogue debug features"
|
||||
depends on DRM_POWERVR_ROGUE
|
||||
default n
|
||||
help
|
||||
Add additional debug features to the PowerVR Rogue driver.
|
||||
To build a matching userspace, enable the following build options:
|
||||
BUILD=debug SUPPORT_PAGE_FAULT_DEBUG=1 PVRSRV_ENABLE_GPU_MEMORY_INFO=1
|
||||
19
drivers/gpu/drm/img-rogue/Makefile
Normal file
19
drivers/gpu/drm/img-rogue/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
img_basedir := $(srctree)/$(src)
|
||||
include $(img_basedir)/config_kernel.mk
|
||||
|
||||
obj-$(CONFIG_DRM_POWERVR_ROGUE) += pvrsrvkm.o
|
||||
|
||||
ccflags-y += \
|
||||
-include config_kernel.h \
|
||||
-I$(img_basedir)/include/drm \
|
||||
-I$(img_basedir) \
|
||||
-I$(img_basedir)/include \
|
||||
-I$(img_basedir)/km \
|
||||
-I$(img_basedir)/system \
|
||||
-D__linux__
|
||||
|
||||
include $(img_basedir)/pvrsrvkm.mk
|
||||
|
||||
obj-$(CONFIG_DRM_POWERVR_ROGUE) += drm_nulldisp.o
|
||||
|
||||
drm_nulldisp-y += drm_nulldisp_drv.o drm_nulldisp_netlink.o drm_netlink_gem.o drm_nulldisp_gem.o
|
||||
422
drivers/gpu/drm/img-rogue/allocmem.c
Normal file
422
drivers/gpu/drm/img-rogue/allocmem.c
Normal file
@@ -0,0 +1,422 @@
|
||||
/*************************************************************************/ /*!
|
||||
@File
|
||||
@Title Host memory management implementation for Linux
|
||||
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
|
||||
@License Dual MIT/GPLv2
|
||||
|
||||
The contents of this file are subject to the MIT license as set out below.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 2 ("GPL") in which case the provisions
|
||||
of GPL are applicable instead of those above.
|
||||
|
||||
If you wish to allow use of your version of this file only under the terms of
|
||||
GPL, and not to allow others to use your version of this file under the terms
|
||||
of the MIT license, indicate your decision by deleting the provisions above
|
||||
and replace them with the notice and other provisions required by GPL as set
|
||||
out in the file called "GPL-COPYING" included in this distribution. If you do
|
||||
not delete the provisions above, a recipient may use your version of this file
|
||||
under the terms of either the MIT license or GPL.
|
||||
|
||||
This License is also included in this distribution in the file called
|
||||
"MIT-COPYING".
|
||||
|
||||
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
|
||||
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/ /**************************************************************************/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
#include "img_defs.h"
|
||||
#include "allocmem.h"
|
||||
#include "pvr_debug.h"
|
||||
#include "process_stats.h"
|
||||
#if defined(DEBUG) && defined(SUPPORT_VALIDATION)
|
||||
#include "pvrsrv.h"
|
||||
#endif
|
||||
#include "osfunc.h"
|
||||
|
||||
|
||||
/*
|
||||
* When memory statistics are disabled, memory records are used instead.
|
||||
* In order for these to work, the PID of the process that requested the
|
||||
* allocation needs to be stored at the end of the kmalloc'd memory, making
|
||||
* sure 4 extra bytes are allocated to fit the PID.
|
||||
*
|
||||
* There is no need for this extra allocation when memory statistics are
|
||||
* enabled, since all allocations are tracked in DebugFS mem_area files.
|
||||
*/
|
||||
#if defined(PVRSRV_ENABLE_PROCESS_STATS) && !defined(PVRSRV_ENABLE_MEMORY_STATS)
|
||||
#define ALLOCMEM_MEMSTATS_PADDING sizeof(IMG_UINT32)
|
||||
#else
|
||||
#define ALLOCMEM_MEMSTATS_PADDING 0UL
|
||||
#endif
|
||||
|
||||
/* How many times kmalloc can fail before the allocation threshold is reduced */
|
||||
static const IMG_UINT32 g_ui32kmallocFailLimit = 10;
|
||||
/* How many kmalloc failures happened since the last allocation threshold change */
|
||||
static IMG_UINT32 g_ui32kmallocFailCount = 0;
|
||||
/* Current kmalloc threshold value in bytes */
|
||||
static IMG_UINT32 g_ui32kmallocThreshold = PVR_LINUX_KMALLOC_ALLOCATION_THRESHOLD;
|
||||
/* Spinlock used so that the global variables above may not be modified by more than 1 thread at a time */
|
||||
static DEFINE_SPINLOCK(kmalloc_lock);
|
||||
|
||||
#if defined(DEBUG) && defined(SUPPORT_VALIDATION)
|
||||
static DEFINE_SPINLOCK(kmalloc_leak_lock);
|
||||
static IMG_UINT32 g_ui32kmallocLeakCounter = 0;
|
||||
#endif
|
||||
|
||||
static inline void OSTryDecreaseKmallocThreshold(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&kmalloc_lock, flags);
|
||||
|
||||
g_ui32kmallocFailCount++;
|
||||
|
||||
if (g_ui32kmallocFailCount >= g_ui32kmallocFailLimit)
|
||||
{
|
||||
g_ui32kmallocFailCount = 0;
|
||||
if (g_ui32kmallocThreshold > PAGE_SIZE)
|
||||
{
|
||||
g_ui32kmallocThreshold >>= 1;
|
||||
printk(KERN_INFO "Threshold is now set to %d\n", g_ui32kmallocThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&kmalloc_lock, flags);
|
||||
}
|
||||
|
||||
static inline void OSResetKmallocFailCount(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&kmalloc_lock, flags);
|
||||
|
||||
g_ui32kmallocFailCount = 0;
|
||||
|
||||
spin_unlock_irqrestore(&kmalloc_lock, flags);
|
||||
}
|
||||
|
||||
static inline void _pvr_vfree(const void* pvAddr)
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
/* Size harder to come by for vmalloc and since vmalloc allocates
|
||||
* a whole number of pages, poison the minimum size known to have
|
||||
* been allocated.
|
||||
*/
|
||||
OSCachedMemSet((void*)pvAddr, PVRSRV_POISON_ON_ALLOC_VALUE,
|
||||
PAGE_SIZE);
|
||||
#endif
|
||||
vfree(pvAddr);
|
||||
}
|
||||
|
||||
static inline void _pvr_kfree(const void* pvAddr)
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
/* Poison whole memory block */
|
||||
OSCachedMemSet((void*)pvAddr, PVRSRV_POISON_ON_ALLOC_VALUE,
|
||||
ksize(pvAddr));
|
||||
#endif
|
||||
kfree(pvAddr);
|
||||
}
|
||||
|
||||
static inline void _pvr_alloc_stats_add(void *pvAddr, IMG_UINT32 ui32Size DEBUG_MEMSTATS_PARAMS)
|
||||
{
|
||||
#if !defined(PVRSRV_ENABLE_PROCESS_STATS)
|
||||
PVR_UNREFERENCED_PARAMETER(pvAddr);
|
||||
#else
|
||||
if (!is_vmalloc_addr(pvAddr))
|
||||
{
|
||||
#if defined(PVRSRV_ENABLE_MEMORY_STATS)
|
||||
IMG_CPU_PHYADDR sCpuPAddr;
|
||||
sCpuPAddr.uiAddr = 0;
|
||||
|
||||
PVRSRVStatsAddMemAllocRecord(PVRSRV_MEM_ALLOC_TYPE_KMALLOC,
|
||||
pvAddr,
|
||||
sCpuPAddr,
|
||||
ksize(pvAddr),
|
||||
NULL,
|
||||
OSGetCurrentClientProcessIDKM()
|
||||
DEBUG_MEMSTATS_ARGS);
|
||||
#else
|
||||
{
|
||||
/* Store the PID in the final additional 4 bytes allocated */
|
||||
IMG_UINT32 *puiTemp = IMG_OFFSET_ADDR(pvAddr, ksize(pvAddr) - ALLOCMEM_MEMSTATS_PADDING);
|
||||
*puiTemp = OSGetCurrentClientProcessIDKM();
|
||||
}
|
||||
PVRSRVStatsIncrMemAllocStat(PVRSRV_MEM_ALLOC_TYPE_KMALLOC, ksize(pvAddr), OSGetCurrentClientProcessIDKM());
|
||||
#endif /* defined(PVRSRV_ENABLE_MEMORY_STATS) */
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(PVRSRV_ENABLE_MEMORY_STATS)
|
||||
IMG_CPU_PHYADDR sCpuPAddr;
|
||||
sCpuPAddr.uiAddr = 0;
|
||||
|
||||
PVRSRVStatsAddMemAllocRecord(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
|
||||
pvAddr,
|
||||
sCpuPAddr,
|
||||
((ui32Size + PAGE_SIZE-1) & ~(PAGE_SIZE-1)),
|
||||
NULL,
|
||||
OSGetCurrentClientProcessIDKM()
|
||||
DEBUG_MEMSTATS_ARGS);
|
||||
#else
|
||||
PVRSRVStatsIncrMemAllocStatAndTrack(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
|
||||
((ui32Size + PAGE_SIZE-1) & ~(PAGE_SIZE-1)),
|
||||
(IMG_UINT64)(uintptr_t) pvAddr,
|
||||
OSGetCurrentClientProcessIDKM());
|
||||
#endif /* defined(PVRSRV_ENABLE_MEMORY_STATS) */
|
||||
}
|
||||
#endif /* !defined(PVRSRV_ENABLE_PROCESS_STATS) */
|
||||
}
|
||||
|
||||
static inline void _pvr_alloc_stats_remove(void *pvAddr)
|
||||
{
|
||||
#if !defined(PVRSRV_ENABLE_PROCESS_STATS)
|
||||
PVR_UNREFERENCED_PARAMETER(pvAddr);
|
||||
#else
|
||||
if (!is_vmalloc_addr(pvAddr))
|
||||
{
|
||||
#if !defined(PVRSRV_ENABLE_MEMORY_STATS)
|
||||
{
|
||||
IMG_UINT32 *puiTemp = IMG_OFFSET_ADDR(pvAddr, ksize(pvAddr) - ALLOCMEM_MEMSTATS_PADDING);
|
||||
PVRSRVStatsDecrMemKAllocStat(ksize(pvAddr), *puiTemp);
|
||||
}
|
||||
#else
|
||||
PVRSRVStatsRemoveMemAllocRecord(PVRSRV_MEM_ALLOC_TYPE_KMALLOC,
|
||||
(IMG_UINT64)(uintptr_t) pvAddr,
|
||||
OSGetCurrentClientProcessIDKM());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !defined(PVRSRV_ENABLE_MEMORY_STATS)
|
||||
PVRSRVStatsDecrMemAllocStatAndUntrack(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
|
||||
(IMG_UINT64)(uintptr_t) pvAddr);
|
||||
#else
|
||||
PVRSRVStatsRemoveMemAllocRecord(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
|
||||
(IMG_UINT64)(uintptr_t) pvAddr,
|
||||
OSGetCurrentClientProcessIDKM());
|
||||
#endif
|
||||
}
|
||||
#endif /* !defined(PVRSRV_ENABLE_PROCESS_STATS) */
|
||||
}
|
||||
|
||||
void *(OSAllocMem)(IMG_UINT32 ui32Size DEBUG_MEMSTATS_PARAMS)
|
||||
{
|
||||
void *pvRet = NULL;
|
||||
|
||||
if ((ui32Size + ALLOCMEM_MEMSTATS_PADDING) <= g_ui32kmallocThreshold)
|
||||
{
|
||||
pvRet = kmalloc(ui32Size + ALLOCMEM_MEMSTATS_PADDING, GFP_KERNEL);
|
||||
if (pvRet == NULL)
|
||||
{
|
||||
OSTryDecreaseKmallocThreshold();
|
||||
}
|
||||
else
|
||||
{
|
||||
OSResetKmallocFailCount();
|
||||
}
|
||||
}
|
||||
|
||||
if (pvRet == NULL)
|
||||
{
|
||||
pvRet = vmalloc(ui32Size);
|
||||
}
|
||||
|
||||
if (pvRet != NULL)
|
||||
{
|
||||
_pvr_alloc_stats_add(pvRet, ui32Size DEBUG_MEMSTATS_ARGS);
|
||||
}
|
||||
|
||||
return pvRet;
|
||||
}
|
||||
|
||||
void *(OSAllocZMem)(IMG_UINT32 ui32Size DEBUG_MEMSTATS_PARAMS)
|
||||
{
|
||||
void *pvRet = NULL;
|
||||
|
||||
if ((ui32Size + ALLOCMEM_MEMSTATS_PADDING) <= g_ui32kmallocThreshold)
|
||||
{
|
||||
pvRet = kzalloc(ui32Size + ALLOCMEM_MEMSTATS_PADDING, GFP_KERNEL);
|
||||
if (pvRet == NULL)
|
||||
{
|
||||
OSTryDecreaseKmallocThreshold();
|
||||
}
|
||||
else
|
||||
{
|
||||
OSResetKmallocFailCount();
|
||||
}
|
||||
}
|
||||
|
||||
if (pvRet == NULL)
|
||||
{
|
||||
pvRet = vzalloc(ui32Size);
|
||||
}
|
||||
|
||||
if (pvRet != NULL)
|
||||
{
|
||||
_pvr_alloc_stats_add(pvRet, ui32Size DEBUG_MEMSTATS_ARGS);
|
||||
}
|
||||
|
||||
return pvRet;
|
||||
}
|
||||
|
||||
/*
|
||||
* The parentheses around OSFreeMem prevent the macro in allocmem.h from
|
||||
* applying, as it would break the function's definition.
|
||||
*/
|
||||
void (OSFreeMem)(void *pvMem)
|
||||
{
|
||||
#if defined(DEBUG) && defined(SUPPORT_VALIDATION)
|
||||
unsigned long flags;
|
||||
PVRSRV_DATA *psPVRSRVData = PVRSRVGetPVRSRVData();
|
||||
|
||||
if (psPVRSRVData)
|
||||
{
|
||||
IMG_UINT32 ui32kmallocLeakMax = psPVRSRVData->sMemLeakIntervals.ui32OSAlloc;
|
||||
|
||||
spin_lock_irqsave(&kmalloc_leak_lock, flags);
|
||||
|
||||
g_ui32kmallocLeakCounter++;
|
||||
if (ui32kmallocLeakMax && (g_ui32kmallocLeakCounter >= ui32kmallocLeakMax))
|
||||
{
|
||||
g_ui32kmallocLeakCounter = 0;
|
||||
spin_unlock_irqrestore(&kmalloc_leak_lock, flags);
|
||||
|
||||
PVR_DPF((PVR_DBG_WARNING,
|
||||
"%s: Skipped freeing of pointer 0x%p to trigger memory leak.",
|
||||
__func__,
|
||||
pvMem));
|
||||
return;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&kmalloc_leak_lock, flags);
|
||||
}
|
||||
#endif
|
||||
if (pvMem != NULL)
|
||||
{
|
||||
_pvr_alloc_stats_remove(pvMem);
|
||||
|
||||
if (!is_vmalloc_addr(pvMem))
|
||||
{
|
||||
_pvr_kfree(pvMem);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pvr_vfree(pvMem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void *OSAllocMemNoStats(IMG_UINT32 ui32Size)
|
||||
{
|
||||
void *pvRet = NULL;
|
||||
|
||||
if (ui32Size <= g_ui32kmallocThreshold)
|
||||
{
|
||||
pvRet = kmalloc(ui32Size, GFP_KERNEL);
|
||||
if (pvRet == NULL)
|
||||
{
|
||||
OSTryDecreaseKmallocThreshold();
|
||||
}
|
||||
else
|
||||
{
|
||||
OSResetKmallocFailCount();
|
||||
}
|
||||
}
|
||||
|
||||
if (pvRet == NULL)
|
||||
{
|
||||
pvRet = vmalloc(ui32Size);
|
||||
}
|
||||
|
||||
return pvRet;
|
||||
}
|
||||
|
||||
void *OSAllocZMemNoStats(IMG_UINT32 ui32Size)
|
||||
{
|
||||
void *pvRet = NULL;
|
||||
|
||||
if (ui32Size <= g_ui32kmallocThreshold)
|
||||
{
|
||||
pvRet = kzalloc(ui32Size, GFP_KERNEL);
|
||||
if (pvRet == NULL)
|
||||
{
|
||||
OSTryDecreaseKmallocThreshold();
|
||||
}
|
||||
else
|
||||
{
|
||||
OSResetKmallocFailCount();
|
||||
}
|
||||
}
|
||||
|
||||
if (pvRet == NULL)
|
||||
{
|
||||
pvRet = vzalloc(ui32Size);
|
||||
}
|
||||
|
||||
return pvRet;
|
||||
}
|
||||
|
||||
/*
|
||||
* The parentheses around OSFreeMemNoStats prevent the macro in allocmem.h from
|
||||
* applying, as it would break the function's definition.
|
||||
*/
|
||||
void (OSFreeMemNoStats)(void *pvMem)
|
||||
{
|
||||
#if defined(DEBUG) && defined(SUPPORT_VALIDATION)
|
||||
unsigned long flags;
|
||||
PVRSRV_DATA *psPVRSRVData = PVRSRVGetPVRSRVData();
|
||||
|
||||
if (psPVRSRVData)
|
||||
{
|
||||
IMG_UINT32 ui32kmallocLeakMax = psPVRSRVData->sMemLeakIntervals.ui32OSAlloc;
|
||||
|
||||
spin_lock_irqsave(&kmalloc_leak_lock, flags);
|
||||
|
||||
g_ui32kmallocLeakCounter++;
|
||||
if (ui32kmallocLeakMax && (g_ui32kmallocLeakCounter >= ui32kmallocLeakMax))
|
||||
{
|
||||
g_ui32kmallocLeakCounter = 0;
|
||||
spin_unlock_irqrestore(&kmalloc_leak_lock, flags);
|
||||
|
||||
PVR_DPF((PVR_DBG_WARNING,
|
||||
"%s: Skipped freeing of pointer 0x%p to trigger memory leak.",
|
||||
__func__,
|
||||
pvMem));
|
||||
return;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&kmalloc_leak_lock, flags);
|
||||
}
|
||||
#endif
|
||||
if (pvMem != NULL)
|
||||
{
|
||||
if (!is_vmalloc_addr(pvMem))
|
||||
{
|
||||
_pvr_kfree(pvMem);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pvr_vfree(pvMem);
|
||||
}
|
||||
}
|
||||
}
|
||||
224
drivers/gpu/drm/img-rogue/allocmem.h
Normal file
224
drivers/gpu/drm/img-rogue/allocmem.h
Normal file
@@ -0,0 +1,224 @@
|
||||
/*************************************************************************/ /*!
|
||||
@File allocmem.h
|
||||
@Title memory allocation header
|
||||
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
|
||||
@Description Memory-Allocation API definitions
|
||||
@License Dual MIT/GPLv2
|
||||
|
||||
The contents of this file are subject to the MIT license as set out below.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 2 ("GPL") in which case the provisions
|
||||
of GPL are applicable instead of those above.
|
||||
|
||||
If you wish to allow use of your version of this file only under the terms of
|
||||
GPL, and not to allow others to use your version of this file under the terms
|
||||
of the MIT license, indicate your decision by deleting the provisions above
|
||||
and replace them with the notice and other provisions required by GPL as set
|
||||
out in the file called "GPL-COPYING" included in this distribution. If you do
|
||||
not delete the provisions above, a recipient may use your version of this file
|
||||
under the terms of either the MIT license or GPL.
|
||||
|
||||
This License is also included in this distribution in the file called
|
||||
"MIT-COPYING".
|
||||
|
||||
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
|
||||
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/ /**************************************************************************/
|
||||
|
||||
#ifndef ALLOCMEM_H
|
||||
#define ALLOCMEM_H
|
||||
|
||||
#include "img_types.h"
|
||||
#include "pvr_debug.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PVRSRV_ENABLE_PROCESS_STATS enables process statistics regarding events,
|
||||
* resources and memory across all processes
|
||||
* PVRSRV_ENABLE_MEMORY_STATS enables recording of Linux kernel memory
|
||||
* allocations, provided that PVRSRV_ENABLE_PROCESS_STATS is enabled
|
||||
* - Output can be found in:
|
||||
* /(sys/kernel/debug|proc)/pvr/proc_stats/[live|retired]_pids_stats/mem_area
|
||||
* PVRSRV_DEBUG_LINUX_MEMORY_STATS provides more details about memory
|
||||
* statistics in conjunction with PVRSRV_ENABLE_MEMORY_STATS
|
||||
* PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON is defined to encompass both memory
|
||||
* allocation statistics functionalities described above in a single macro
|
||||
*/
|
||||
#if defined(PVRSRV_ENABLE_PROCESS_STATS) && defined(PVRSRV_ENABLE_MEMORY_STATS) && defined(PVRSRV_DEBUG_LINUX_MEMORY_STATS) && defined(DEBUG)
|
||||
#define PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When using detailed memory allocation statistics, the line number and
|
||||
* file name where the allocation happened are also provided.
|
||||
* When this feature is not used, these parameters are not needed.
|
||||
*/
|
||||
#if defined(PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON)
|
||||
#define DEBUG_MEMSTATS_PARAMS ,void *pvAllocFromFile, IMG_UINT32 ui32AllocFromLine
|
||||
#define DEBUG_MEMSTATS_ARGS ,pvAllocFromFile, ui32AllocFromLine
|
||||
#define DEBUG_MEMSTATS_UNREF (void)pvAllocFromFile; (void)ui32AllocFromLine;
|
||||
#define DEBUG_MEMSTATS_VALUES ,__FILE__, __LINE__
|
||||
#else
|
||||
#define DEBUG_MEMSTATS_PARAMS /*!<
|
||||
* Used for PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON
|
||||
* build option. */
|
||||
#define DEBUG_MEMSTATS_ARGS /*!<
|
||||
* Used for PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON
|
||||
* build option. */
|
||||
#define DEBUG_MEMSTATS_UNREF /*!<
|
||||
* Used for PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON
|
||||
* build option. */
|
||||
#define DEBUG_MEMSTATS_VALUES /*!<
|
||||
* Used for PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON
|
||||
* build option. */
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************/ /*!
|
||||
@Function OSAllocMem
|
||||
@Description Allocates CPU memory. Contents are uninitialized.
|
||||
If passed a size of zero, function should not assert,
|
||||
but just return a NULL pointer.
|
||||
@Input ui32Size Size of required allocation (in bytes)
|
||||
@Return Pointer to allocated memory on success.
|
||||
Otherwise NULL.
|
||||
*/ /**************************************************************************/
|
||||
#if defined(DOXYGEN)
|
||||
void *OSAllocMem(IMG_UINT32 ui32Size);
|
||||
#else
|
||||
void *OSAllocMem(IMG_UINT32 ui32Size DEBUG_MEMSTATS_PARAMS);
|
||||
#define OSAllocMem(_size) (OSAllocMem)((_size) DEBUG_MEMSTATS_VALUES)
|
||||
#endif
|
||||
|
||||
/**************************************************************************/ /*!
|
||||
@Function OSAllocZMem
|
||||
@Description Allocates CPU memory and initializes the contents to zero.
|
||||
If passed a size of zero, function should not assert,
|
||||
but just return a NULL pointer.
|
||||
@Input ui32Size Size of required allocation (in bytes)
|
||||
@Return Pointer to allocated memory on success.
|
||||
Otherwise NULL.
|
||||
*/ /**************************************************************************/
|
||||
#if defined(DOXYGEN)
|
||||
void *OSAllocZMem(IMG_UINT32 ui32Size);
|
||||
#else
|
||||
void *OSAllocZMem(IMG_UINT32 ui32Size DEBUG_MEMSTATS_PARAMS);
|
||||
#define OSAllocZMem(_size) (OSAllocZMem)((_size) DEBUG_MEMSTATS_VALUES)
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************/ /*!
|
||||
@Function OSAllocMemNoStats
|
||||
@Description Allocates CPU memory. Contents are uninitialized.
|
||||
If passed a size of zero, function should not assert,
|
||||
but just return a NULL pointer.
|
||||
The allocated memory is not accounted for by process stats.
|
||||
Process stats are an optional feature (enabled only when
|
||||
PVRSRV_ENABLE_PROCESS_STATS is defined) which track the amount
|
||||
of memory allocated to help in debugging. Where this is not
|
||||
required, OSAllocMem() and OSAllocMemNoStats() equate to
|
||||
the same operation.
|
||||
@Input ui32Size Size of required allocation (in bytes)
|
||||
@Return Pointer to allocated memory on success.
|
||||
Otherwise NULL.
|
||||
*/ /**************************************************************************/
|
||||
void *OSAllocMemNoStats(IMG_UINT32 ui32Size);
|
||||
|
||||
/**************************************************************************/ /*!
|
||||
@Function OSAllocZMemNoStats
|
||||
@Description Allocates CPU memory and initializes the contents to zero.
|
||||
If passed a size of zero, function should not assert,
|
||||
but just return a NULL pointer.
|
||||
The allocated memory is not accounted for by process stats.
|
||||
Process stats are an optional feature (enabled only when
|
||||
PVRSRV_ENABLE_PROCESS_STATS is defined) which track the amount
|
||||
of memory allocated to help in debugging. Where this is not
|
||||
required, OSAllocZMem() and OSAllocZMemNoStats() equate to
|
||||
the same operation.
|
||||
@Input ui32Size Size of required allocation (in bytes)
|
||||
@Return Pointer to allocated memory on success.
|
||||
Otherwise NULL.
|
||||
*/ /**************************************************************************/
|
||||
void *OSAllocZMemNoStats(IMG_UINT32 ui32Size);
|
||||
|
||||
/**************************************************************************/ /*!
|
||||
@Function OSFreeMem
|
||||
@Description Frees previously allocated CPU memory.
|
||||
@Input pvCpuVAddr Pointer to the memory to be freed.
|
||||
@Return None.
|
||||
*/ /**************************************************************************/
|
||||
void OSFreeMem(void *pvCpuVAddr);
|
||||
|
||||
/**************************************************************************/ /*!
|
||||
@Function OSFreeMemNoStats
|
||||
@Description Frees previously allocated CPU memory.
|
||||
The freed memory does not update the figures in process stats.
|
||||
Process stats are an optional feature (enabled only when
|
||||
PVRSRV_ENABLE_PROCESS_STATS is defined) which track the amount
|
||||
of memory allocated to help in debugging. Where this is not
|
||||
required, OSFreeMem() and OSFreeMemNoStats() equate to the
|
||||
same operation.
|
||||
@Input pvCpuVAddr Pointer to the memory to be freed.
|
||||
@Return None.
|
||||
*/ /**************************************************************************/
|
||||
void OSFreeMemNoStats(void *pvCpuVAddr);
|
||||
|
||||
/*
|
||||
* These macros allow us to catch double-free bugs on DEBUG builds and
|
||||
* prevent crashes on RELEASE builds.
|
||||
*/
|
||||
|
||||
/*! @cond Doxygen_Suppress */
|
||||
#if defined(DEBUG)
|
||||
#define double_free_sentinel ((void *)&OSFreeMem)
|
||||
#define ALLOCMEM_ASSERT(exp) PVR_ASSERT(exp)
|
||||
#else
|
||||
#define double_free_sentinel NULL
|
||||
#define ALLOCMEM_ASSERT(exp) do {} while (0)
|
||||
#endif
|
||||
/*! @endcond */
|
||||
|
||||
/*! Frees memory allocated by OSAllocMem(). */
|
||||
#define OSFreeMem(_ptr) do { \
|
||||
ALLOCMEM_ASSERT((_ptr) != double_free_sentinel); \
|
||||
(OSFreeMem)(_ptr); \
|
||||
(_ptr) = double_free_sentinel; \
|
||||
MSC_SUPPRESS_4127 \
|
||||
} while (0)
|
||||
|
||||
/*! Frees memory allocated by OSAllocMemNoStats(). */
|
||||
#define OSFreeMemNoStats(_ptr) do { \
|
||||
ALLOCMEM_ASSERT((_ptr) != double_free_sentinel); \
|
||||
(OSFreeMemNoStats)(_ptr); \
|
||||
(_ptr) = double_free_sentinel; \
|
||||
MSC_SUPPRESS_4127 \
|
||||
} while (0)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ALLOCMEM_H */
|
||||
|
||||
/******************************************************************************
|
||||
End of file (allocmem.h)
|
||||
******************************************************************************/
|
||||
1630
drivers/gpu/drm/img-rogue/cache_km.c
Normal file
1630
drivers/gpu/drm/img-rogue/cache_km.c
Normal file
File diff suppressed because it is too large
Load Diff
151
drivers/gpu/drm/img-rogue/cache_km.h
Normal file
151
drivers/gpu/drm/img-rogue/cache_km.h
Normal file
@@ -0,0 +1,151 @@
|
||||
/*************************************************************************/ /*!
|
||||
@File cache_km.h
|
||||
@Title CPU cache management header
|
||||
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
|
||||
@License Dual MIT/GPLv2
|
||||
|
||||
The contents of this file are subject to the MIT license as set out below.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 2 ("GPL") in which case the provisions
|
||||
of GPL are applicable instead of those above.
|
||||
|
||||
If you wish to allow use of your version of this file only under the terms of
|
||||
GPL, and not to allow others to use your version of this file under the terms
|
||||
of the MIT license, indicate your decision by deleting the provisions above
|
||||
and replace them with the notice and other provisions required by GPL as set
|
||||
out in the file called "GPL-COPYING" included in this distribution. If you do
|
||||
not delete the provisions above, a recipient may use your version of this file
|
||||
under the terms of either the MIT license or GPL.
|
||||
|
||||
This License is also included in this distribution in the file called
|
||||
"MIT-COPYING".
|
||||
|
||||
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
|
||||
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/ /**************************************************************************/
|
||||
|
||||
#ifndef CACHE_KM_H
|
||||
#define CACHE_KM_H
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <linux/version.h>
|
||||
#else
|
||||
#define KERNEL_VERSION
|
||||
#endif
|
||||
|
||||
#include "pvrsrv_error.h"
|
||||
#include "os_cpu_cache.h"
|
||||
#include "img_types.h"
|
||||
#include "cache_ops.h"
|
||||
#include "device.h"
|
||||
#include "pmr.h"
|
||||
|
||||
typedef IMG_UINT32 PVRSRV_CACHE_OP_ADDR_TYPE; /*!< Represents CPU address type required for CPU d-cache maintenance */
|
||||
#define PVRSRV_CACHE_OP_ADDR_TYPE_VIRTUAL 0x1 /*!< Operation requires CPU virtual address only */
|
||||
#define PVRSRV_CACHE_OP_ADDR_TYPE_PHYSICAL 0x2 /*!< Operation requires CPU physical address only */
|
||||
#define PVRSRV_CACHE_OP_ADDR_TYPE_BOTH 0x3 /*!< Operation requires both CPU virtual & physical addresses */
|
||||
|
||||
#include "connection_server.h"
|
||||
|
||||
/*
|
||||
* CacheOpInit() & CacheOpDeInit()
|
||||
*
|
||||
* This must be called to initialise the KM cache maintenance framework.
|
||||
* This is called early during the driver/module (un)loading phase.
|
||||
*/
|
||||
PVRSRV_ERROR CacheOpInit(void);
|
||||
void CacheOpDeInit(void);
|
||||
|
||||
/*
|
||||
* CacheOpInit2() & CacheOpDeInit2()
|
||||
*
|
||||
* This must be called to initialise the UM cache maintenance framework.
|
||||
* This is called when the driver is loaded/unloaded from the kernel.
|
||||
*/
|
||||
PVRSRV_ERROR CacheOpInit2(void);
|
||||
void CacheOpDeInit2(void);
|
||||
|
||||
/*
|
||||
* CacheOpExec()
|
||||
*
|
||||
* This is the primary CPU data-cache maintenance interface and it is
|
||||
* always guaranteed to be synchronous; the arguments supplied must be
|
||||
* pre-validated for performance reasons else the d-cache maintenance
|
||||
* operation might cause the underlying OS kernel to fault.
|
||||
*/
|
||||
PVRSRV_ERROR CacheOpExec(PPVRSRV_DEVICE_NODE psDevNode,
|
||||
void *pvVirtStart,
|
||||
void *pvVirtEnd,
|
||||
IMG_CPU_PHYADDR sCPUPhysStart,
|
||||
IMG_CPU_PHYADDR sCPUPhysEnd,
|
||||
PVRSRV_CACHE_OP uiCacheOp);
|
||||
|
||||
/*
|
||||
* CacheOpValExec()
|
||||
*
|
||||
* Same as CacheOpExec(), except arguments are _Validated_ before being
|
||||
* presented to the underlying OS kernel for CPU data-cache maintenance.
|
||||
* The uiAddress is the start CPU virtual address for the to-be d-cache
|
||||
* maintained PMR, it can be NULL in which case a remap will be performed
|
||||
* internally, if required for cache maintenance. This is primarily used
|
||||
* as the services client bridge call handler for synchronous user-mode
|
||||
* cache maintenance requests.
|
||||
*/
|
||||
PVRSRV_ERROR CacheOpValExec(PMR *psPMR,
|
||||
IMG_UINT64 uiAddress,
|
||||
IMG_DEVMEM_OFFSET_T uiOffset,
|
||||
IMG_DEVMEM_SIZE_T uiSize,
|
||||
PVRSRV_CACHE_OP uiCacheOp);
|
||||
|
||||
/*
|
||||
* CacheOpQueue()
|
||||
*
|
||||
* This is the secondary cache maintenance interface and it is not
|
||||
* guaranteed to be synchronous in that requests could be deferred
|
||||
* and executed asynchronously. This interface is primarily meant
|
||||
* as services client bridge call handler. Both uiInfoPgGFSeqNum
|
||||
* and ui32[Current,Next]FenceSeqNum implements an internal client
|
||||
* server queueing protocol so making use of this interface outside
|
||||
* of services client is not recommended and should not be done.
|
||||
*/
|
||||
PVRSRV_ERROR CacheOpQueue(CONNECTION_DATA *psConnection,
|
||||
PPVRSRV_DEVICE_NODE psDevNode,
|
||||
IMG_UINT32 ui32OpCount,
|
||||
PMR **ppsPMR,
|
||||
IMG_UINT64 *puiAddress,
|
||||
IMG_DEVMEM_OFFSET_T *puiOffset,
|
||||
IMG_DEVMEM_SIZE_T *puiSize,
|
||||
PVRSRV_CACHE_OP *puiCacheOp,
|
||||
IMG_UINT32 ui32OpTimeline);
|
||||
|
||||
/*
|
||||
* CacheOpLog()
|
||||
*
|
||||
* This is used for logging client cache maintenance operations that
|
||||
* was executed in user-space.
|
||||
*/
|
||||
PVRSRV_ERROR CacheOpLog(PMR *psPMR,
|
||||
IMG_UINT64 uiAddress,
|
||||
IMG_DEVMEM_OFFSET_T uiOffset,
|
||||
IMG_DEVMEM_SIZE_T uiSize,
|
||||
IMG_UINT64 ui64StartTime,
|
||||
IMG_UINT64 ui64EndTime,
|
||||
PVRSRV_CACHE_OP uiCacheOp);
|
||||
|
||||
#endif /* CACHE_KM_H */
|
||||
61
drivers/gpu/drm/img-rogue/cache_ops.h
Normal file
61
drivers/gpu/drm/img-rogue/cache_ops.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*************************************************************************/ /*!
|
||||
@File
|
||||
@Title Services cache management header
|
||||
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
|
||||
@Description Defines for cache management which are visible internally
|
||||
and externally
|
||||
@License Dual MIT/GPLv2
|
||||
|
||||
The contents of this file are subject to the MIT license as set out below.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 2 ("GPL") in which case the provisions
|
||||
of GPL are applicable instead of those above.
|
||||
|
||||
If you wish to allow use of your version of this file only under the terms of
|
||||
GPL, and not to allow others to use your version of this file under the terms
|
||||
of the MIT license, indicate your decision by deleting the provisions above
|
||||
and replace them with the notice and other provisions required by GPL as set
|
||||
out in the file called "GPL-COPYING" included in this distribution. If you do
|
||||
not delete the provisions above, a recipient may use your version of this file
|
||||
under the terms of either the MIT license or GPL.
|
||||
|
||||
This License is also included in this distribution in the file called
|
||||
"MIT-COPYING".
|
||||
|
||||
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
|
||||
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/ /**************************************************************************/
|
||||
|
||||
#ifndef CACHE_OPS_H
|
||||
#define CACHE_OPS_H
|
||||
#include "img_types.h"
|
||||
/*!
|
||||
* @Defgroup CPUCacheAPIs
|
||||
* @{
|
||||
*/
|
||||
#define CACHE_BATCH_MAX (8U)
|
||||
#define MAX_DMA_OPS (34)
|
||||
typedef IMG_UINT32 PVRSRV_CACHE_OP; /*!< Type represents cache maintenance operation */
|
||||
#define PVRSRV_CACHE_OP_NONE 0x0U /*!< No operation */
|
||||
#define PVRSRV_CACHE_OP_CLEAN 0x1U /*!< Flush w/o invalidate */
|
||||
#define PVRSRV_CACHE_OP_INVALIDATE 0x2U /*!< Invalidate w/o flush */
|
||||
#define PVRSRV_CACHE_OP_FLUSH 0x3U /*!< Flush w/ invalidate */
|
||||
/*! @} End of Defgroup CPUCacheAPIs */
|
||||
|
||||
#endif /* CACHE_OPS_H */
|
||||
80
drivers/gpu/drm/img-rogue/client_cache_bridge.h
Normal file
80
drivers/gpu/drm/img-rogue/client_cache_bridge.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*******************************************************************************
|
||||
@File
|
||||
@Title Client bridge header for cache
|
||||
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
|
||||
@Description Exports the client bridge functions for cache
|
||||
@License Dual MIT/GPLv2
|
||||
|
||||
The contents of this file are subject to the MIT license as set out below.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 2 ("GPL") in which case the provisions
|
||||
of GPL are applicable instead of those above.
|
||||
|
||||
If you wish to allow use of your version of this file only under the terms of
|
||||
GPL, and not to allow others to use your version of this file under the terms
|
||||
of the MIT license, indicate your decision by deleting the provisions above
|
||||
and replace them with the notice and other provisions required by GPL as set
|
||||
out in the file called "GPL-COPYING" included in this distribution. If you do
|
||||
not delete the provisions above, a recipient may use your version of this file
|
||||
under the terms of either the MIT license or GPL.
|
||||
|
||||
This License is also included in this distribution in the file called
|
||||
"MIT-COPYING".
|
||||
|
||||
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
|
||||
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef CLIENT_CACHE_BRIDGE_H
|
||||
#define CLIENT_CACHE_BRIDGE_H
|
||||
|
||||
#include "img_defs.h"
|
||||
#include "pvrsrv_error.h"
|
||||
|
||||
#if defined(PVR_INDIRECT_BRIDGE_CLIENTS)
|
||||
#include "pvr_bridge_client.h"
|
||||
#include "pvr_bridge.h"
|
||||
#endif
|
||||
|
||||
#include "common_cache_bridge.h"
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpQueue(IMG_HANDLE hBridge,
|
||||
IMG_UINT32 ui32NumCacheOps,
|
||||
IMG_HANDLE * phPMR,
|
||||
IMG_UINT64 * pui64Address,
|
||||
IMG_DEVMEM_OFFSET_T * puiOffset,
|
||||
IMG_DEVMEM_SIZE_T * puiSize,
|
||||
PVRSRV_CACHE_OP * piuCacheOp,
|
||||
IMG_UINT32 ui32OpTimeline);
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpExec(IMG_HANDLE hBridge,
|
||||
IMG_HANDLE hPMR,
|
||||
IMG_UINT64 ui64Address,
|
||||
IMG_DEVMEM_OFFSET_T uiOffset,
|
||||
IMG_DEVMEM_SIZE_T uiSize, PVRSRV_CACHE_OP iuCacheOp);
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpLog(IMG_HANDLE hBridge,
|
||||
IMG_HANDLE hPMR,
|
||||
IMG_UINT64 ui64Address,
|
||||
IMG_DEVMEM_OFFSET_T uiOffset,
|
||||
IMG_DEVMEM_SIZE_T uiSize,
|
||||
IMG_INT64 i64StartTime,
|
||||
IMG_INT64 i64EndTime, PVRSRV_CACHE_OP iuCacheOp);
|
||||
|
||||
#endif /* CLIENT_CACHE_BRIDGE_H */
|
||||
112
drivers/gpu/drm/img-rogue/client_cache_direct_bridge.c
Normal file
112
drivers/gpu/drm/img-rogue/client_cache_direct_bridge.c
Normal file
@@ -0,0 +1,112 @@
|
||||
/*******************************************************************************
|
||||
@File
|
||||
@Title Direct client bridge for cache
|
||||
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
|
||||
@Description Implements the client side of the bridge for cache
|
||||
which is used in calls from Server context.
|
||||
@License Dual MIT/GPLv2
|
||||
|
||||
The contents of this file are subject to the MIT license as set out below.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 2 ("GPL") in which case the provisions
|
||||
of GPL are applicable instead of those above.
|
||||
|
||||
If you wish to allow use of your version of this file only under the terms of
|
||||
GPL, and not to allow others to use your version of this file under the terms
|
||||
of the MIT license, indicate your decision by deleting the provisions above
|
||||
and replace them with the notice and other provisions required by GPL as set
|
||||
out in the file called "GPL-COPYING" included in this distribution. If you do
|
||||
not delete the provisions above, a recipient may use your version of this file
|
||||
under the terms of either the MIT license or GPL.
|
||||
|
||||
This License is also included in this distribution in the file called
|
||||
"MIT-COPYING".
|
||||
|
||||
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
|
||||
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "client_cache_bridge.h"
|
||||
#include "img_defs.h"
|
||||
#include "pvr_debug.h"
|
||||
|
||||
/* Module specific includes */
|
||||
#include "cache_ops.h"
|
||||
|
||||
#include "cache_km.h"
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpQueue(IMG_HANDLE hBridge,
|
||||
IMG_UINT32 ui32NumCacheOps,
|
||||
IMG_HANDLE * phPMR,
|
||||
IMG_UINT64 * pui64Address,
|
||||
IMG_DEVMEM_OFFSET_T * puiOffset,
|
||||
IMG_DEVMEM_SIZE_T * puiSize,
|
||||
PVRSRV_CACHE_OP * piuCacheOp,
|
||||
IMG_UINT32 ui32OpTimeline)
|
||||
{
|
||||
PVRSRV_ERROR eError;
|
||||
PMR **psPMRInt;
|
||||
|
||||
psPMRInt = (PMR **) phPMR;
|
||||
|
||||
eError =
|
||||
CacheOpQueue(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
|
||||
ui32NumCacheOps,
|
||||
psPMRInt, pui64Address, puiOffset, puiSize, piuCacheOp, ui32OpTimeline);
|
||||
|
||||
return eError;
|
||||
}
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpExec(IMG_HANDLE hBridge,
|
||||
IMG_HANDLE hPMR,
|
||||
IMG_UINT64 ui64Address,
|
||||
IMG_DEVMEM_OFFSET_T uiOffset,
|
||||
IMG_DEVMEM_SIZE_T uiSize, PVRSRV_CACHE_OP iuCacheOp)
|
||||
{
|
||||
PVRSRV_ERROR eError;
|
||||
PMR *psPMRInt;
|
||||
PVR_UNREFERENCED_PARAMETER(hBridge);
|
||||
|
||||
psPMRInt = (PMR *) hPMR;
|
||||
|
||||
eError = CacheOpValExec(psPMRInt, ui64Address, uiOffset, uiSize, iuCacheOp);
|
||||
|
||||
return eError;
|
||||
}
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpLog(IMG_HANDLE hBridge,
|
||||
IMG_HANDLE hPMR,
|
||||
IMG_UINT64 ui64Address,
|
||||
IMG_DEVMEM_OFFSET_T uiOffset,
|
||||
IMG_DEVMEM_SIZE_T uiSize,
|
||||
IMG_INT64 i64StartTime,
|
||||
IMG_INT64 i64EndTime, PVRSRV_CACHE_OP iuCacheOp)
|
||||
{
|
||||
PVRSRV_ERROR eError;
|
||||
PMR *psPMRInt;
|
||||
PVR_UNREFERENCED_PARAMETER(hBridge);
|
||||
|
||||
psPMRInt = (PMR *) hPMR;
|
||||
|
||||
eError =
|
||||
CacheOpLog(psPMRInt,
|
||||
ui64Address, uiOffset, uiSize, i64StartTime, i64EndTime, iuCacheOp);
|
||||
|
||||
return eError;
|
||||
}
|
||||
111
drivers/gpu/drm/img-rogue/client_devicememhistory_bridge.h
Normal file
111
drivers/gpu/drm/img-rogue/client_devicememhistory_bridge.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/*******************************************************************************
|
||||
@File
|
||||
@Title Client bridge header for devicememhistory
|
||||
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
|
||||
@Description Exports the client bridge functions for devicememhistory
|
||||
@License Dual MIT/GPLv2
|
||||
|
||||
The contents of this file are subject to the MIT license as set out below.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 2 ("GPL") in which case the provisions
|
||||
of GPL are applicable instead of those above.
|
||||
|
||||
If you wish to allow use of your version of this file only under the terms of
|
||||
GPL, and not to allow others to use your version of this file under the terms
|
||||
of the MIT license, indicate your decision by deleting the provisions above
|
||||
and replace them with the notice and other provisions required by GPL as set
|
||||
out in the file called "GPL-COPYING" included in this distribution. If you do
|
||||
not delete the provisions above, a recipient may use your version of this file
|
||||
under the terms of either the MIT license or GPL.
|
||||
|
||||
This License is also included in this distribution in the file called
|
||||
"MIT-COPYING".
|
||||
|
||||
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
|
||||
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef CLIENT_DEVICEMEMHISTORY_BRIDGE_H
|
||||
#define CLIENT_DEVICEMEMHISTORY_BRIDGE_H
|
||||
|
||||
#include "img_defs.h"
|
||||
#include "pvrsrv_error.h"
|
||||
|
||||
#if defined(PVR_INDIRECT_BRIDGE_CLIENTS)
|
||||
#include "pvr_bridge_client.h"
|
||||
#include "pvr_bridge.h"
|
||||
#endif
|
||||
|
||||
#include "common_devicememhistory_bridge.h"
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryMap(IMG_HANDLE hBridge,
|
||||
IMG_HANDLE hPMR,
|
||||
IMG_DEVMEM_SIZE_T uiOffset,
|
||||
IMG_DEV_VIRTADDR sDevVAddr,
|
||||
IMG_DEVMEM_SIZE_T uiSize,
|
||||
const IMG_CHAR * puiText,
|
||||
IMG_UINT32 ui32Log2PageSize,
|
||||
IMG_UINT32 ui32AllocationIndex,
|
||||
IMG_UINT32 * pui32AllocationIndexOut);
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryUnmap(IMG_HANDLE hBridge,
|
||||
IMG_HANDLE hPMR,
|
||||
IMG_DEVMEM_SIZE_T uiOffset,
|
||||
IMG_DEV_VIRTADDR sDevVAddr,
|
||||
IMG_DEVMEM_SIZE_T uiSize,
|
||||
const IMG_CHAR * puiText,
|
||||
IMG_UINT32 ui32Log2PageSize,
|
||||
IMG_UINT32 ui32AllocationIndex,
|
||||
IMG_UINT32 * pui32AllocationIndexOut);
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryMapVRange(IMG_HANDLE hBridge,
|
||||
IMG_DEV_VIRTADDR sBaseDevVAddr,
|
||||
IMG_UINT32 ui32ui32StartPage,
|
||||
IMG_UINT32 ui32NumPages,
|
||||
IMG_DEVMEM_SIZE_T uiAllocSize,
|
||||
const IMG_CHAR * puiText,
|
||||
IMG_UINT32 ui32Log2PageSize,
|
||||
IMG_UINT32 ui32AllocationIndex,
|
||||
IMG_UINT32 * pui32AllocationIndexOut);
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryUnmapVRange(IMG_HANDLE hBridge,
|
||||
IMG_DEV_VIRTADDR sBaseDevVAddr,
|
||||
IMG_UINT32 ui32ui32StartPage,
|
||||
IMG_UINT32 ui32NumPages,
|
||||
IMG_DEVMEM_SIZE_T uiAllocSize,
|
||||
const IMG_CHAR * puiText,
|
||||
IMG_UINT32 ui32Log2PageSize,
|
||||
IMG_UINT32 ui32AllocationIndex,
|
||||
IMG_UINT32 * pui32AllocationIndexOut);
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistorySparseChange(IMG_HANDLE hBridge,
|
||||
IMG_HANDLE hPMR,
|
||||
IMG_DEVMEM_SIZE_T uiOffset,
|
||||
IMG_DEV_VIRTADDR sDevVAddr,
|
||||
IMG_DEVMEM_SIZE_T uiSize,
|
||||
const IMG_CHAR * puiText,
|
||||
IMG_UINT32 ui32Log2PageSize,
|
||||
IMG_UINT32 ui32AllocPageCount,
|
||||
IMG_UINT32 * pui32AllocPageIndices,
|
||||
IMG_UINT32 ui32FreePageCount,
|
||||
IMG_UINT32 * pui32FreePageIndices,
|
||||
IMG_UINT32 ui32AllocationIndex,
|
||||
IMG_UINT32 * pui32AllocationIndexOut);
|
||||
|
||||
#endif /* CLIENT_DEVICEMEMHISTORY_BRIDGE_H */
|
||||
@@ -0,0 +1,194 @@
|
||||
/*******************************************************************************
|
||||
@File
|
||||
@Title Direct client bridge for devicememhistory
|
||||
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
|
||||
@Description Implements the client side of the bridge for devicememhistory
|
||||
which is used in calls from Server context.
|
||||
@License Dual MIT/GPLv2
|
||||
|
||||
The contents of this file are subject to the MIT license as set out below.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 2 ("GPL") in which case the provisions
|
||||
of GPL are applicable instead of those above.
|
||||
|
||||
If you wish to allow use of your version of this file only under the terms of
|
||||
GPL, and not to allow others to use your version of this file under the terms
|
||||
of the MIT license, indicate your decision by deleting the provisions above
|
||||
and replace them with the notice and other provisions required by GPL as set
|
||||
out in the file called "GPL-COPYING" included in this distribution. If you do
|
||||
not delete the provisions above, a recipient may use your version of this file
|
||||
under the terms of either the MIT license or GPL.
|
||||
|
||||
This License is also included in this distribution in the file called
|
||||
"MIT-COPYING".
|
||||
|
||||
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
|
||||
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "client_devicememhistory_bridge.h"
|
||||
#include "img_defs.h"
|
||||
#include "pvr_debug.h"
|
||||
|
||||
/* Module specific includes */
|
||||
#include "img_types.h"
|
||||
#include "img_defs.h"
|
||||
#include "devicemem_typedefs.h"
|
||||
|
||||
#include "devicemem_history_server.h"
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryMap(IMG_HANDLE hBridge,
|
||||
IMG_HANDLE hPMR,
|
||||
IMG_DEVMEM_SIZE_T uiOffset,
|
||||
IMG_DEV_VIRTADDR sDevVAddr,
|
||||
IMG_DEVMEM_SIZE_T uiSize,
|
||||
const IMG_CHAR * puiText,
|
||||
IMG_UINT32 ui32Log2PageSize,
|
||||
IMG_UINT32 ui32AllocationIndex,
|
||||
IMG_UINT32 * pui32AllocationIndexOut)
|
||||
{
|
||||
PVRSRV_ERROR eError;
|
||||
PMR *psPMRInt;
|
||||
PVR_UNREFERENCED_PARAMETER(hBridge);
|
||||
|
||||
psPMRInt = (PMR *) hPMR;
|
||||
|
||||
eError =
|
||||
DevicememHistoryMapKM(psPMRInt,
|
||||
uiOffset,
|
||||
sDevVAddr,
|
||||
uiSize,
|
||||
puiText,
|
||||
ui32Log2PageSize, ui32AllocationIndex, pui32AllocationIndexOut);
|
||||
|
||||
return eError;
|
||||
}
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryUnmap(IMG_HANDLE hBridge,
|
||||
IMG_HANDLE hPMR,
|
||||
IMG_DEVMEM_SIZE_T uiOffset,
|
||||
IMG_DEV_VIRTADDR sDevVAddr,
|
||||
IMG_DEVMEM_SIZE_T uiSize,
|
||||
const IMG_CHAR * puiText,
|
||||
IMG_UINT32 ui32Log2PageSize,
|
||||
IMG_UINT32 ui32AllocationIndex,
|
||||
IMG_UINT32 * pui32AllocationIndexOut)
|
||||
{
|
||||
PVRSRV_ERROR eError;
|
||||
PMR *psPMRInt;
|
||||
PVR_UNREFERENCED_PARAMETER(hBridge);
|
||||
|
||||
psPMRInt = (PMR *) hPMR;
|
||||
|
||||
eError =
|
||||
DevicememHistoryUnmapKM(psPMRInt,
|
||||
uiOffset,
|
||||
sDevVAddr,
|
||||
uiSize,
|
||||
puiText,
|
||||
ui32Log2PageSize, ui32AllocationIndex, pui32AllocationIndexOut);
|
||||
|
||||
return eError;
|
||||
}
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryMapVRange(IMG_HANDLE hBridge,
|
||||
IMG_DEV_VIRTADDR sBaseDevVAddr,
|
||||
IMG_UINT32 ui32ui32StartPage,
|
||||
IMG_UINT32 ui32NumPages,
|
||||
IMG_DEVMEM_SIZE_T uiAllocSize,
|
||||
const IMG_CHAR * puiText,
|
||||
IMG_UINT32 ui32Log2PageSize,
|
||||
IMG_UINT32 ui32AllocationIndex,
|
||||
IMG_UINT32 * pui32AllocationIndexOut)
|
||||
{
|
||||
PVRSRV_ERROR eError;
|
||||
|
||||
eError =
|
||||
DevicememHistoryMapVRangeKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
|
||||
sBaseDevVAddr,
|
||||
ui32ui32StartPage,
|
||||
ui32NumPages,
|
||||
uiAllocSize,
|
||||
puiText,
|
||||
ui32Log2PageSize,
|
||||
ui32AllocationIndex, pui32AllocationIndexOut);
|
||||
|
||||
return eError;
|
||||
}
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryUnmapVRange(IMG_HANDLE hBridge,
|
||||
IMG_DEV_VIRTADDR sBaseDevVAddr,
|
||||
IMG_UINT32 ui32ui32StartPage,
|
||||
IMG_UINT32 ui32NumPages,
|
||||
IMG_DEVMEM_SIZE_T uiAllocSize,
|
||||
const IMG_CHAR * puiText,
|
||||
IMG_UINT32 ui32Log2PageSize,
|
||||
IMG_UINT32 ui32AllocationIndex,
|
||||
IMG_UINT32 * pui32AllocationIndexOut)
|
||||
{
|
||||
PVRSRV_ERROR eError;
|
||||
|
||||
eError =
|
||||
DevicememHistoryUnmapVRangeKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
|
||||
sBaseDevVAddr,
|
||||
ui32ui32StartPage,
|
||||
ui32NumPages,
|
||||
uiAllocSize,
|
||||
puiText,
|
||||
ui32Log2PageSize,
|
||||
ui32AllocationIndex, pui32AllocationIndexOut);
|
||||
|
||||
return eError;
|
||||
}
|
||||
|
||||
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistorySparseChange(IMG_HANDLE hBridge,
|
||||
IMG_HANDLE hPMR,
|
||||
IMG_DEVMEM_SIZE_T uiOffset,
|
||||
IMG_DEV_VIRTADDR sDevVAddr,
|
||||
IMG_DEVMEM_SIZE_T uiSize,
|
||||
const IMG_CHAR * puiText,
|
||||
IMG_UINT32 ui32Log2PageSize,
|
||||
IMG_UINT32 ui32AllocPageCount,
|
||||
IMG_UINT32 * pui32AllocPageIndices,
|
||||
IMG_UINT32 ui32FreePageCount,
|
||||
IMG_UINT32 * pui32FreePageIndices,
|
||||
IMG_UINT32 ui32AllocationIndex,
|
||||
IMG_UINT32 * pui32AllocationIndexOut)
|
||||
{
|
||||
PVRSRV_ERROR eError;
|
||||
PMR *psPMRInt;
|
||||
PVR_UNREFERENCED_PARAMETER(hBridge);
|
||||
|
||||
psPMRInt = (PMR *) hPMR;
|
||||
|
||||
eError =
|
||||
DevicememHistorySparseChangeKM(psPMRInt,
|
||||
uiOffset,
|
||||
sDevVAddr,
|
||||
uiSize,
|
||||
puiText,
|
||||
ui32Log2PageSize,
|
||||
ui32AllocPageCount,
|
||||
pui32AllocPageIndices,
|
||||
ui32FreePageCount,
|
||||
pui32FreePageIndices,
|
||||
ui32AllocationIndex, pui32AllocationIndexOut);
|
||||
|
||||
return eError;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user