1
0
Fork 0
Commit Graph

254 Commits (redonkable)

Author SHA1 Message Date
Yong Gan 1bb69f8b51 MGS-5464 [#imx-1915] 0014-CL249917-DEC400-P010_LSB-I010-format
CL249917 DEC400, P010_LSB, I010 format

Signed-off-by: Yong Gan <yong.gan@nxp.com>
2020-02-25 14:53:22 +08:00
Zhou Peng b55cdef32a MLK-23375: arm64: imx8mp: vc8000e: remove legacy ioremap_nocache interface
ioremap has provided non-cached semantics by default since the Linux 2.6

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2020-02-24 18:25:13 +08:00
Li Yang 072173c984 LF-994 mxc: vpu_malone vpu_windsor: cope with upstream y2038 changes
Upstream removed 32bit timespec to deal with y2038 issue.
Update MXC drivers to deal with the change.

Signed-off-by: Li Yang <leoyang.li@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
2020-02-24 17:00:12 +08:00
Ming Qian e883611a57 LF-984:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:report error event when the resolution beyond limit
If the resolution is too bit to support,
driver should report an error event,
so application can do the cancel flow

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2020-02-21 15:03:18 +08:00
Ming Qian 2342e62536 LF-840-7:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:abort or stop cmd may timeout after resume from suspend when run multi h264 instance
don't block the abort when wait res change

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2020-02-21 15:03:17 +08:00
Ming Qian 00eee65de7 LF-840-6:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:abort or stop cmd may timeout after resume from suspend when run multi h264 instance
fix the similar issue of vpu windsor

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2020-02-21 15:03:11 +08:00
Ming Qian 69dcbb5bd9 LF-840-5:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:abort or stop cmd may timeout after resume from suspend when run multi h264 instance
1. make sure mu interrupt in the fifo has been handled.
2. make sure event in the fifo has been handled.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2020-02-21 15:03:00 +08:00
Ming Qian b61e7b6411 LF-840-4:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:abort or stop cmd may timeout after resume from suspend when run multi h264 instance
don't alloc dma in the message handler.
because it may block the event

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2020-02-21 15:02:25 +08:00
Ming Qian 84a4ac79d8 LF-840-3:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:abort or stop cmd may timeout after resume from suspend when run multi h264 instance
don't clear the pic end flag as it should be cleared by firmware.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2020-02-21 15:02:07 +08:00
Ming Qian 5dfa928ea0 LF-840-2:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:abort or stop cmd may timeout after resume from suspend when run multi h264 instance
don't lock around cancel_work_sync, otherwise may cause dead lock.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2020-02-21 15:01:52 +08:00
Ming Qian 2804096a9e LF-840-1:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:abort or stop cmd may timeout after resume from suspend when run multi h264 instance
make the fw_flow_mutex a local mutex instead of a global mutex.
the global may cause dead lock when there are one instance

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2020-02-21 15:01:36 +08:00
Shijie Qin f4fa087e78 MLK-23263 mxc: vpu_malone: correct vpu decoder used bits of fuse
Malone decoder used bits of fuse are 14-15 bits

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
(cherry picked from commit 8d34c1d1ce31048316da88448f8eecbed885fc44)
2020-01-22 14:56:57 +08:00
Xianzhong 62b9c2b5a5 MGS-5485-2 [#imx-1870] fix system out of memory in gpu database
gputop patch added gcvDB_CONTIGUOUS and gcvDB_COMMAND_BUFFER types,
these need create more system memory to maintain database frequently,
gpu out of memory issue happen when run openGL ES CTS on imx6 boards,

this patch can avoid system memory allocation for new database types,
combine gcvDB_CONTIGUOUS memory type into video memory database,
remove gcvDB_COMMAND_BUFFER as not in database counters.

Fix "LF-165 [#imx-1870] gputop counter test failed"

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2020-01-15 00:32:13 +08:00
Xianzhong 72157df9dd MGS-5485 [#imx-1870] fix memory database error
need check memory object type when remove database,
Fix "LF-165 [#imx-1870] gputop counter test failed"

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2020-01-15 00:32:13 +08:00
Ella Feng 5dbe09abb8 MGS-5341 [#imx-1870] Fix the uninitialized variable in GPU driver.
Fix Coverity issue of uninitialized variable, which is introduced by
"LF-165 [#imx-1870] gputop counter test failed"

Date: 10 Jan, 2020
Signed-off-by: Ella Feng <ella.feng@nxp.com>
2020-01-15 00:32:13 +08:00
Ella Feng a1275731c5 LF-165 [#imx-1870] Fix the error when converting pointer to int for 32 bit system
Use gcmPTR_TO_UINT64() for converting pointer to int for both 64 bit and 32 bit system.
Fix previous patch, "LF-165 [#imx-1870] gputop counter test failed".

Signed-off-by: Xianzhong Li <xianzhong.li@nxp.com>
Signed-off-by: Ella Feng <ella.feng@nxp.com>
2020-01-15 00:32:13 +08:00
b18948 9881fb7e5f LF-165 [#imx-1870] gputop counter test failed
Recover gpu kernel database printout format and add statictics of contiguous memory

Signed-off-by: chingling wang <chingling.wang@nxp.com>
2020-01-15 00:32:12 +08:00
Xianzhong bc240b1ee1 MGS-5472 [#ccc] fix gpu resolve alignment issue
need make bank alignment for texture and bitmap,
this fix bandwidth problem with resolve test.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2020-01-15 00:32:12 +08:00
Shijie Qin 14aff2955b LF-765-2 [8QM_MEK/8QXP_MEK]mxc: vpu_malone: check buffer status before add buffer to queue
When add buffer to queue which status should be active.
When firmware release one buffer, could re-add it to queue if
its status is active.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: ming_qian <ming.qian@nxp.com>
2020-01-14 10:08:39 +08:00
Shijie Qin eb8cfa563e LF-765 [8QM_MEK/8QXP_MEK]mxc:vpu_malone: add FRAME_SKIP status to record skip-frame
Add 'FRAME_SKIP' status to record 'MEDIA_PLAYER_SKIPPED_FRAME_ID'
frame. Instead of use 'FRAME_READY' that will lead to this buffer
no chance to re-add to available buffer queue.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
2020-01-09 18:05:32 +08:00
xiahong.bao 78f2d96c67 MA-16211: imx8mp: vpu: Implement hantro vc8000e ioctl32
Implement hantro vc8000e ioctl32 for imx8mp

Signed-off-by: xiahong.bao <xiahong.bao@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2020-01-08 11:16:44 +08:00
Zhou Peng e9181a19c5 MLK-23211-1: arm64: imx8mp: vpu: add vc8000e driver
Add vc8000e driver source code

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2020-01-07 17:59:00 +08:00
Ming Qian a8512d04d2 LF-711:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:stream may hang due to the event
msg hasn't process in time

firmware write event message to message buffer, and trigger an interrupt,
driver will read the message and store it into a fifo. and call queue_work.
If the work is scheduling but have exited the while loop,
it may cause the event won't be processed until another event received.
So in some case, the stream may hang
as the next event is depends on the driver process the current event.

vpu_windsor may have the same issue.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-01-07 13:48:51 +08:00
Ming Qian beafe9f8ed LF-690:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor:extends the range of frame rate from integers to real numbers
currently, vpu encoder only support integer frame rate,
we need improve the firmware to support fractional frame rate
so extends the range of frame rate from integers to real numbers

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-01-06 14:19:14 +08:00
Ming Qian a96c3aee9f LF-688:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor:export fw log via debugfs
export fw log via debugfs
the fw log can help us debug some firmware issue.
keep consistent with the decoder

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-01-06 14:19:14 +08:00
Xianzhong e688e85dac MGS-5458 [#imx-1708] fix GPU/VIP coreIndex issue
coreInfoArray use offset as coreIndex, not use hardware core

Fix: 8744fe58453c("MGS-5372 [#imx-1708] Fix the VX/CL apps hang for 865 GPU/VIP
")

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-12-31 01:38:58 +08:00
Xianzhong b7096c3615 LF-408-2 [#imx-1873] disable 1M page for dynamic mapping
1M GPU MMU pages are used for flat mapping by default,
there is no performance benefit for dynamic mapping.

disabled 1M MMU page to fix unstable GPU problems.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-12-31 01:38:58 +08:00
Richard Liu 9821cda510 MA-16168 [#imx-1903] Fix GPU driver build error and not work issue on 5.4 kernel
Some drm common code changed, gpu driver need do the matched update on 5.4 kernel.
1. Some drm API name changed.
   drm_gem_object_unreference_unlocked() rename as drm_gem_object_put_unlocked().
   drm_dev_unref() rename as drm_dev_put().
2. Drm/prime remove DRIVER_PRIME, driver needs do the matched update.
3. API gem_prime_export remove input parameter "struct drm_device *dev".

Signed-off-by: Richard Liu <xuegang.liu@nxp.com>
2019-12-31 01:38:58 +08:00
Xianzhong 61c15e448d MGS-5064 [#imx-1868] 0010-BUG25711-CL244484-Android-CTS-some-cases-fail-in-gle
BUG25711 CL244484 Android CTS: some cases fail in gles2/gles3
 group on imx815 AndroidP/wayland BUG25710 CL244484 [vkcts1.1.3]:fail when run
 "dEQP-VK.glsl.limits.near_max.fragment_input.*" on 815 wayland BUG25646
 CL244484 [vkcts1.1.3]:dEQP-VK.glsl.limits.near_max.fragment_input.* fail on
 815 wayland

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-12-31 01:38:57 +08:00
Xianzhong 4404b5fa91 MGS-5064 [#imx-1868] 0006-CL244297-align-gc_feature_database
CL244297 align gc_feature_database

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-12-31 01:38:57 +08:00
Xianzhong 90e8fafb2d MGS-5064 [#imx-1868] 0003-CL244120-Prepare-for-NXP-backwards-compatible-requir
CL244120 Prepare for NXP backwards compatible requirement.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-12-31 01:38:57 +08:00
Shijie Qin cacbaeca03 LF-629: [8QM_MEK/8QXP_MEK]mxc:vpu_malone: donot set end_flag if scode type is BUFFFLUSH in low-latency mode
In low-latency mode, donot need set end_flag if scode type is
BUFFLUSH_PADDING_TYPE. Otherwise, firmware will ignore frame
threshold then may affect another instance performance.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: ming_qian <ming.qian@nxp.com>
2019-12-27 15:48:14 +08:00
ming_qian 23bd461be4 LF-628:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:export frame threshold of frame mode
export frame threshold of frame mode,
and then we can modify the threshold without update firmware.
It can be used for debug

Signed-off-by: ming_qian <ming.qian@nxp.com>
Acked-by: <shijie.qin@nxp.com>
2019-12-27 15:48:01 +08:00
Minjie Zhuang 7ec1ff2b8a MGS-5226 [#imx-1746] add REG_DisableVIP bit 1
add REG_DisableVIP bit 1 in gpu-viv/hal/kernel/inc/gc_feature_database.h

Signed-off-by: Minjie Zhuang <minjie.zhuang@nxp.com>
2019-12-20 17:47:38 +08:00
ming_qian 19d577f1f7 LF-561: [8QM_MEK/8QXP_MEK]mxc:vpu_malone:reinit completion before send command
we should reinit the completion before send command
who may trigger the completion,
otherwise it may be reinit after complete in certain timing,
then led to timeout

use private workqueue instead of public workqueue

Signed-off-by: ming_qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2019-12-20 17:04:17 +08:00
Zhou Peng 446ffbee0e LF-521: mxc: hantro: [All]arch64 kernel default build using imx_v8_defconfig has many Warnings.100%
Add 'break' statement to fix 'implicit-fallthrough' compiler warning

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
2019-12-19 18:37:04 +08:00
ming_qian 565cfec2d4 LF-503:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:check space of cmd buffer
Check the space of cmd buffer before write cmd,
if the wptr equals to rptr, it'll be treated as empty,
so we can't write to full.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2019-12-18 10:01:24 +08:00
Yong Gan b60340a2ff MGS-5326 [#imx-1803] 0058-align-gc_feature_database
align gc_feature_database

Signed-off-by: Yong Gan <yong.gan@nxp.com>
2019-12-13 13:52:04 +08:00
Shijie Qin f6cb75f3d9 LF-365 [8QM_MEK/8QXP_MEK]mxc:vpu_malone: need skip tsm when skip not decoded frame
- If frame ID is  MEDIA_PLAYER_SKIPPED_FRAME_ID, need skip this frame,
  also need skip its tsm at the same time.
- Fixed coverity issue: CID 6344236 (#2 of 2): Buffer not null
  terminated (BUFFER_SIZE_WARNING).
- Remove two deaded code about ctx pointer check.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: ming_qian <ming.qian@nxp.com>
2019-12-06 10:54:45 +08:00
Ella Feng fa6e1cd69f MGS-5372 [#imx-1708] Fix the VX/CL apps hang for 865 GPU/VIP
Add VIP HW type to avoid GPU/VIP command mess when run VX/CL apps.

Date: 4 Dec, 2019
Singed-off-by: Ella Feng <ella.feng@nxp.com>
2019-12-05 03:12:51 +08:00
Dong Aisheng b3d472cf0c Merge branch 'mxc/next' into next
* mxc/next: (119 commits)
  mxc: hdmi-cec: Add imx6 hdmi cec driver
  driver: mfd: hdmi: Add hdmi core driver
  MLK-22399 mxc IPUv3: cpmem: Get 0 u/v_offset in __ipu_ch_offset_calc() for some pfmts
  mxc: IPU3: Fix not including uapi/linux/sched/types.h
  media: platform: mxc: output: Forward IPUv3 V4L2 output driver from imx_4.19.y
  ...
2019-12-02 18:02:35 +08:00
Dong Aisheng 14b8ba8dec Merge remote-tracking branch 'origin/mxc/vpu' into mxc/next
* origin/mxc/vpu: (44 commits)
  LF-80:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:clear eos flag when output streamoff
  MLK-22999 mxc: vpu_malone: release debugfs after open to avoid memory leak
  MLK-22991 mxc: vpu_malone vpu_windsor: check is vpu poweroff when suspend
  MLK-22963 mxc vpu_windsor: fix call vzalloc during spinlock
  MLK-22945 mxc vpu_malone: disable decode ctx before release it.
  ...
2019-12-02 18:01:29 +08:00
Dong Aisheng e53be1f76e Merge remote-tracking branch 'origin/mxc/sim' into mxc/next
* origin/mxc/sim: (23 commits)
  sim: emvsim: add multi power domain support
  MLK-22217 mxc: emvsim: add value adjustment for cwt/bwt timer
  MLK-22216 mxc: emvsim: last character need be transmitted separately with no guard time
  MLK-22215 mxc: emvsim: correct irq mask and clear irq status before receiving
  MLK-22214 mxc: emvsim: clean up the code in ATR stage
  ...
2019-12-02 18:01:28 +08:00
Dong Aisheng e2be60b651 Merge remote-tracking branch 'origin/mxc/mlb' into mxc/next
* origin/mxc/mlb: (17 commits)
  MLK-23000-1 mxc: mlb: fix kernel dump when use gen_pool_dma_alloc
  mxc mlb: Allow compilation on imx8
  MLK-22071-3 Document: mlb: add imx8qxp compatible string
  MLK-15997 Document: mlb: add document for mlb
  mxc: mlb: fix interrupt rw lock dead lock
  ...
2019-12-02 18:01:25 +08:00
Dong Aisheng c282e8f9c1 Merge remote-tracking branch 'origin/mxc/ipu' into mxc/next
* origin/mxc/ipu: (6 commits)
  MLK-22399 mxc IPUv3: cpmem: Get 0 u/v_offset in __ipu_ch_offset_calc() for some pfmts
  mxc: IPU3: Fix not including uapi/linux/sched/types.h
  media: platform: mxc: output: Forward IPUv3 V4L2 output driver from imx_4.19.y
  mxc: IPU3: Forward IPUv3 common driver from imx_4.19.y kernel
  MLK-21876-13 ipu: add uapi headfile for yocto build pass
  ...
2019-12-02 18:01:24 +08:00
Dong Aisheng ca1ee1da8c Merge remote-tracking branch 'origin/mxc/hdmi' into mxc/next
* origin/mxc/hdmi:
  mxc: hdmi-cec: Add imx6 hdmi cec driver
  driver: mfd: hdmi: Add hdmi core driver
2019-12-02 18:01:23 +08:00
Robby Cai 5a43ed0df4 media: mipi csi: add IPU CSI driver
add IPU MIPI CSI driver, used by imx6qdl

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:38 +08:00
Sandor Yu 3815ade25a mxc: hdmi-cec: Add imx6 hdmi cec driver
Add imx6 hdmi cec driver.
This patch forwards imx6 hdmi cec driver from imx_4.19.y kernel.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 15:48:17 +08:00
Liu Ying c40a817bdc MLK-22399 mxc IPUv3: cpmem: Get 0 u/v_offset in __ipu_ch_offset_calc() for some pfmts
There are no u/v planars in the pixel formats
IPU_PIX_FMT_BGRA4444/IPU_PIX_FMT_BGRA5551/IPU_PIX_FMT_AYUV,
so we should explicitly get zero u/v_offset from __ipu_ch_offset_calc()
for those pixel formats.  Without this patch, '-EINVAL' will be
returned from __ipu_ch_offset_calc() as the function return value
and input parameter u/v_offset will not be touched, which is not a
good behavior, because the caller is likely to ignore the function
return value and take the u/v_offset as valid value.  The MXC IPUv3 fb
driver is a such kind of caller, which may get the u/v_offset
for those pixel formats without checking the function return value,
and hence wrongly pass the u/v_offset to PRE driver(finally causes
malfunction).

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:48:15 +08:00
Leonard Crestez 262ca4a0e5 mxc: IPU3: Fix not including uapi/linux/sched/types.h
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:48:14 +08:00
Liu Ying bc77a44ba0 mxc: IPU3: Forward IPUv3 common driver from imx_4.19.y kernel
This patch forwards IPUv3 common driver from imx_4.19.y kernel.
This includs IPUv3 common, IPUv3 prefetch engine and VDOA support.

[ Liu Ying: Fixed a minor build warning for PRE driver. ]
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:48:14 +08:00
Clark Wang d229e2c9b5 MLK-23000-1 mxc: mlb: fix kernel dump when use gen_pool_dma_alloc
If use dma pool when iram does not exist, the iram_pool will be NULL.
The previous version of lib/genalloc.c will check the pointer status
first. In 5.4, it will not check NULL pointer.
Therefore, add NULL check here.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:48:11 +08:00
Leonard Crestez f086607708 mxc mlb: Allow compilation on imx8
Upstream rejected ARCH_FSL_IMX8QM so just depend on ARCH_MXC or
COMPILE_TEST.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:48:11 +08:00
Clark Wang f150414008 mxc: mlb: fix interrupt rw lock dead lock
MLB has multiple lock calls rings, so this can be called from interrupt
calls at the same time resulting in:

[   73.688839] WARNING: inconsistent lock state
[   73.693116] 5.2.0-rc3-next-20190607-20092-ge32edc4b91df-dirty #38 Not tainted
[   73.700256] --------------------------------
[   73.704533] inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-R} usage.
[   73.710546] mxc_mlb_test.ou/612 [HC0[0]:SC0[0]:HE1:SE1] takes:
[   73.716386] 554a05da (mlb_devinfo[1].tx_rbuf.rb_lock){-?--}, at: mxc_mlb150_ioctl+0x6a8/0x9a8
[   73.724937] {IN-HARDIRQ-W} state was registered at:
[   73.729827]   _raw_write_lock+0x28/0x38
[   73.733669]   mlb_tx_isr+0x54/0xf8
[   73.737078]   mlb_ahb_isr+0x98/0x124
[   73.740668]   __handle_irq_event_percpu+0x48/0x360
[   73.745467]   handle_irq_event_percpu+0x28/0x7c
[   73.750002]   handle_irq_event+0x38/0x5c
[   73.753934]   handle_fasteoi_irq+0xc0/0x17c
[   73.758125]   generic_handle_irq+0x20/0x34
[   73.762228]   __handle_domain_irq+0x64/0xe0
[   73.766422]   gic_handle_irq+0x4c/0xa8
[   73.770179]   __irq_svc+0x70/0x98
[   73.773506]   cpuidle_enter_state+0x164/0x574
[   73.777869]   cpuidle_enter_state+0x164/0x574
[   73.782232]   cpuidle_enter+0x28/0x38
[   73.785905]   do_idle+0x220/0x2c0
[   73.789226]   cpu_startup_entry+0x18/0x20
[   73.793247]   start_kernel+0x3f4/0x4a0

Fix this by always using irq save rw locks in trans_complete_check.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 15:48:10 +08:00
Clark Wang e031e906f6 MLK-22071-1 mxc: mlb: Fix clock config for imx8qxp platform
Because CONFIG_ARCH_MXC_ARM64 is not used since 4.19, add devtype in
imx_mlb_hwdata to distinguish between imx6 and imx8 platform when init
the ipg and hclk clocks.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:48:09 +08:00
Gao Pan cfd8fbc27b MLK-15992 imx: mlb: add ipg & hclk clocks for imx8 mlb
Add ipg & hclk clock for imx8 mlb due to IP integration difference.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
(cherry picked from commit 599dfce3bf486ed65ccd3b63bca4ffba92cab15e)
2019-11-25 15:48:09 +08:00
Gao Pan 9cfdf9587a MLK-15999 imx: mlb: fix build warnings
fix build warnings

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:48:09 +08:00
Gao Pan a7aaf46bb9 MLK-15995 imx: mlb: only use irq_ahb1 for imx6
Due to IP integration difference, there are 2 ahb irqs
for imx6 and only 1 ahb irq for imx8. This patch makes
mlb driver compatible with irq difference.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:48:07 +08:00
Gao Pan 2c45f980f3 MLK-15990 imx: mlb: change mlb clock name
change mlb clock name from clk_mlb3p to mlb.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:48:07 +08:00
Gao Pan a00413cab3 MLK-15988 imx: mlb: remove clk for mlb 6 pin mode
mlb 6 pin mode is not supported in current release,
so remove clk for mlb 6 pin mode.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:48:07 +08:00
Gao Pan 6e5a6d795a MLK-15987 imx: mlb: use dma pool when iram doesn't exist
alloc mlb data buffer from dma pool when iram doesn't exist

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:48:06 +08:00
Gao Pan 10b8c40353 MLK-12185 mlb: imx: fix the operation for mlb status in mlb_isr
As a result that the wrong operation is used for the mlb status
in mlb_isr(), some results are independent of their operations.

for example:
rx_cis = (cdt_val[2] & ~MASK) >> SHIFT, where, MASK = 0xf0000000
and SHIFT = 28. So, the result is always 0 regardless of the values
of its operands.

This patch fixes the operation for mlb status in mlb_isr().

(reported by coverity check)

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:48:06 +08:00
Fugang Duan 969c959781 MLK-11910 mxc: mlb: fix irq unsigned_compare issue
After coverity code check, it tips:
unsigned_compare: This less-than-zero comparison of an unsigned value is
never true.

Interrupt variable must be signed type.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:48:05 +08:00
Vipul Kumar 98648c7d0e imx: mlb: Replace ACCESS_ONCE with READ_ONCE
As per commit 6aa7de0591 ("locking/atomics: COCCINELLE/treewide: Convert
trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()"), replace
ACCESS_ONCE with READ_ONCE to fix the compilation errors.

drivers/mxc/mlb/mxc_mlb.c: In function ‘mlb_rx_isr’:
drivers/mxc/mlb/mxc_mlb.c:1664:9: error: implicit declaration of function ‘ACCESS_ONCE’; did you mean ‘READ_ONCE’? [-Werror=implicit-function-declaration]
  tail = ACCESS_ONCE(rx_rbuf->tail);
         ^~~~~~~~~~~
         READ_ONCE
  CC      drivers/of/of_mdio.o

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:48:05 +08:00
Gao Pan ccf19d3237 MLK-11442 mlb: imx: add mlb support on imx_4.1.y
Add mlb support on imx_4.1.y. The files are copied from imx_3.14.y.

Signed-off-by: Gao Pan <b54642@freescale.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 24e36b318a29d85c0c4491076416343ade1f344e)
2019-11-25 15:48:04 +08:00
Joakim Zhang 7a059a09be sim: emvsim: add multi power domain support
Add multi power domain support for emvsim as it needs power domain both
SOC and Board level.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 15:48:02 +08:00
Joakim Zhang b3e7783229 MLK-22217 mxc: emvsim: add value adjustment for cwt/bwt timer
Add value adjustment for cwt/bwt timer, otherwise it will fail with
ultimate cwt/bwt value.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:48:02 +08:00
Joakim Zhang 297bfc6c1d MLK-22216 mxc: emvsim: last character need be transmitted separately with no guard time
It can't receive when transmitting on EMVSIM IP. ICC will send response
quickly when Terminal transmits last character with guard time. If the
response came to Terminal before the guard time expired, the Terminal
would not receive the respone. So should transmit last character with no
guard time.

This patch intends to fix the communication failure when setting guard
time.

This will cause about 1 ETU delay before transmitting last character
(according to timing measured), but it does not matter.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:48:02 +08:00
Joakim Zhang 0612dea846 MLK-22215 mxc: emvsim: correct irq mask and clear irq status before receiving
Just clean up the code and normalize the code.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:48:01 +08:00
Joakim Zhang 88a1ff5c08 MLK-22214 mxc: emvsim: clean up the code in ATR stage
Clean up the code in ATR stage.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:47:59 +08:00
Joakim Zhang 05d7253157 MLK-22213 mxc: emvsim: read TS character before updating value of GPCNT1
Should read TS character before updating value of GPCNT1, because TS
character will also cost 12 etus.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:47:58 +08:00
Joakim Zhang f0fba896a3 MLK-22211 mxc: emvsim: should not clear PEF/FEF flag in irq handler
Shouldn't clear PEF/FEF flag in irq handler as they are just a flag which
can't trigger interrupt. And they will be check later in irq handler.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:47:57 +08:00
Joakim Zhang c79402071a MLK-22210 mxc: emvsim: enable ICM mode
Once detected a valid TS, the ICM bit is cleared and the data format bit,
IC bit , is set to appropriate value depending on the data format
detected using the initial character.

When TS is 0x3B (direct convention) in cold reset, and then become 0x3F
(inverse convention) in warm reset, it will not in ICM mode.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:47:57 +08:00
Gao Pan 557037b6bd MLK-18485 emvsim: enable CWT for ATR
Enable CWT for ATR, and switch to RX_DATA_IM to detect receiving data
in fifo.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:47:56 +08:00
Gao Pan 4265cbdb4b MLK-17416 imx8: sim: add usleep_range() before reading SPDP Bit
Card Presence Detect Status Bit SPDP in EMV_SIM_PCSR is
synchronized by two posedge of low_ref_clk which is 32KHz.

So there should be 1.5 low_ref_clk cycles(about 90us) before
reading SPDP Bit.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:47:56 +08:00
Gao Pan bbc881815d MLK-17319-1 imx8: sim: add driver to support EMVSIM module
The EMVSIM module is designed to facilitate communication to
Smart Cards compatible to the EMV ver4.3 standard and compatible
with ISO/IEC 7816-3 Standard.

This patch adds driver to support EMVSIM module for imx8.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Reviewed-by: Andy Duan <fugang.duan@nxp.com>
2019-11-25 15:47:55 +08:00
Julien Olivain c0fa458f65 MLK-13473: imx_sim: fix module device table name
This fixes the build when this driver is built as a module, when
CONFIG_MXC_SIM=m

Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
2019-11-25 15:47:55 +08:00
Gao Pan 3135b8110b MLK-14642 imx: sim: fix segment fault caused by user address access
Kernel space cannot access user space memory directly.
In fact, the issue always exited. Since 4.4, the kernel
handle the action as page abort.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:47:54 +08:00
Gao Pan 34a04d8706 MLK-11472 sim: imx: set sim1 IOMUX to default state
SIM1 IOMUX is changed into reset state in LPSR mode.As a result,
sim can't work again.

This patch sets sim1 IOMUX to default state after existing from LPSR mode.

(cherry-picked from commit 8e237775cd413645bfd806e4c648954e1a773a2d)

Signed-off-by: Gao Pan <b54642@freescale.com>
2019-11-25 15:47:54 +08:00
Gao Pan 957de2871d MLK-11777 sim: imx: remove useless code
sim_activate() process is contained in the cold reset.
Thus, it is redundant and should be removed.

This patch also adds comments to cold reset process.

Signed-off-by: Gao Pan <b54642@freescale.com>
2019-11-25 15:47:54 +08:00
Gao Pan 44ab966c17 MLK-11354 sim: imx: relapce devm_request_and_ioremap with devm_ioremap_resource
The API devm_request_and_ioremap meets compile error
on branch imx_4.1.y. It is recommend to replace the api
with devm_ioremap_resource.

Signed-off-by: Gao Pan <b54642@freescale.com>
2019-11-25 15:47:53 +08:00
Luwei Zhou 1305ce8ff1 MLK-10976: mxc: sim: Using timer interrupt to implement precise timing.
The EMV4.3 has strict requirement about the reset sequence. The old code use the mdelay, udelay to
achievet, which is not precise enough. Replace it with the timer interrupt. The EMV4.3 requires
40000~45000 clock cycles duration when reset is low.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
(cherry picked from a006fe283c8b97f0a711cb0829bfbdaaf4a5f31f)
2019-11-25 15:47:53 +08:00
Luwei Zhou 81d3ff9421 MLK-10968: mxc: sim: Add the init delay detection function in the driver.
In EMV4.3 after warm/cold reset, there would be a receiving window. The receiving
window would be 42000 clock length.If the receiving window expires without receiving
one byte, IFD need to take actions as EMV4.3 spec. The driver need to support this
to identify the sequence of the receiving window expiring event and the receiving event.
Since theinterrupt latency in linux OS is not certain, we need to tune this setting to
pass the cases. Current tuning parameter can work.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
(cherry picked from faf1d8d881a6ad2c6b88fdf312cef142996937c1)
2019-11-25 15:47:52 +08:00
Luwei Zhou 0d5d107690 MLK-10959: mxc: sim: Disable cwt timer when tx and enable in rx.
The CWT timer is used to detect the the character interval in the data traffic.
When tx, SIM IP can guarantee the interval based our setting. When RX, we need
to enalbe the CWT timer to check whether the interval is in the range. This patch
fix this.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
(cherry picked from 9c92dfd070e7427eb1e0166f368b89b4a7ac1bff)
2019-11-25 15:47:52 +08:00
Luwei Zhou 50b2602a93 MLK-10913-1: mxc: sim: Add the SIM driver support for i.MX6UL-EVK platform.
Modify the driver to support the SIM on i.MX6UL-EVK platform. The main modification is:
1. Add port index to support different port on platform.
2. Add POS-CARD support. The POS card has external IC to assert when SVEN to low. Add support.
3. Using a function to calculate the strict timing delay.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
(cherry picked from 17d1315b0704e2db63ee6bd7aaefa0c796f53104)
2019-11-25 15:47:51 +08:00
Luwei Zhou 3867b4bd9f MLK-10600-2: mxc: sim: add an option to enable SIM driver build
Add the option to enable SIM driver build.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
Signed-off-by: Gao Pan <b45643@freescale.com>
(cherry picked from 0f7a6fa3c141bfc7333d9056639b7a5b1154ed1d)
2019-11-25 15:47:50 +08:00
Luwei Zhou fb80f7afe2 MLK-10600-1: mxc: sim: Add SIM IP driver support on the i.MX7d-12x12-arm2 platform.
This driver is based on the current code which runs the the EMV test on the i.MX258 platform.
Since there are still many cases that can't pass on the i.MX258 and i.MX7d platform. The
driver will need to be improved after per-test work. Just check in as a base code. There
would be definitly some timing improvement work to do in the future.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
(cherry picked from 3ac1ad5b2a68ecb052ccacca4ac7459ead04415e)
2019-11-25 15:47:50 +08:00
ming_qian bcaa7c17aa LF-80:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:clear eos flag when output streamoff
if the eos flag is not clear after output streamoff,
it may cause firmware hang with multi instances

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:47 +08:00
ming_qian c521bad20c MLK-22999 mxc: vpu_malone: release debugfs after open to avoid memory leak
VPU decoder driver create some debug fs,
but don't set the release function,
in open function, it will alloc some memory,
it should be freed when release function is called.
otherwise, memory will be leaked.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:47 +08:00
Shijie Qin 9fde70430f MLK-22991 mxc: vpu_malone vpu_windsor: check is vpu poweroff when suspend
the csr register 'CM0Px_CPUWAIT' will be cleared to '1' after
reset(poweroff then poweron), hence we could check is vpu poweroff
when suspend according to this value.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:46 +08:00
ming_qian 8801852a4c MLK-22963 mxc vpu_windsor: fix call vzalloc during spinlock
platform vzalloc may call wait_completion to sleep,
but sleep is forbidden during spinlock,
so use mutex instead

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:45 +08:00
ming_qian 23f0876ea4 MLK-22945 mxc vpu_malone: disable decode ctx before release it.
If close is called without calling streamoff,
the status of decode is enable,
some buffer status may be wrong.
disable before release it will avoid such error.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:45 +08:00
Zhou Peng 0775816459 vpu: hantro: Fix kconfig to depend on ARCH_MXC instead
Replace ARCH_FSL_IMX8MQ with ARCH_MXC in hantro 850 Kconfig

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:45 +08:00
Julien Olivain cd5340e7f6 MLK-22952 mxc: vpu_windsor: add missing semicolon
Add a missing semicolon. This missing semicolon is not breaking the
build in defconfig since the next MODULE_DEVICE_TABLE() expand to an
empty string, so the next semicolon is used. When this macro expands
to a non-empty string, the build breaks. This was found by a
"make allmodconfig" build.

Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:44 +08:00
Julien Olivain d1a0de782c MLK-22951 mxc: vpu_malone: add missing semicolon
Add a missing semicolon. This missing semicolon is not breaking the
build in defconfig since the next MODULE_DEVICE_TABLE() expand to an
empty string, so the next semicolon is used. When this macro expands
to a non-empty string, the build breaks. This was found by a
"make allmodconfig" build.

Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:44 +08:00
Leonard Crestez 874558fb16 vpu: hantro: Fix kconfig to depend on ARCH_MXC instead
Upstream rejected per-SOC kconfig symbols such as CONFIG_ARCH_FSL_IMX8MQ
so just use CONFIG_ARCH_MXC instead.

There is already an ARM64 check in drivers/mxc/Kconfig so this
shouldn't change anything except that we can drop CONFIG_ARCH_FSL_IMX8MQ
from linux-nxp tree.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:44 +08:00
ming_qian 008627cc26 MLK-22920 vpu: windsor encoder: change the writeable flag synchronously
If the writeable flag is not change synchronously,
the flag may not changed correct,
it'll case the encode stream hang.
It's likely to happen when small resolution stream do suspend.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 15:47:43 +08:00
Shijie Qin 23401f11ca MLK-22913 vpu: windsor malone: fix kernel panic caused by directly read MU
- After switch to use mailbox, shall not read MU register directly
- VPU shall always poweroff when suspend, hence related check
  unnecessary.
- Remain the API to unify code of 4.19 kernel version

[  123.773671] Call trace:
[  123.776123]  vpu_resume+0x90/0x1d8
[  123.779534]  platform_pm_resume+0x24/0x48
[  123.783542]  dpm_run_callback.isra.15+0x38/0xec
[  123.788075]  device_resume+0x74/0x11c
[  123.791740]  dpm_resume+0xdc/0x20c
[  123.795144]  dpm_resume_end+0x14/0x28
[  123.798809]  suspend_devices_and_enter+0x190/0x5a4
[  123.803596]  pm_suspend+0x258/0x320
[  123.807091]  state_store+0x84/0x108
[  123.810581]  kobj_attr_store+0x14/0x24
[  123.814333]  sysfs_kf_write+0x40/0x48
[  123.817993]  kernfs_fop_write+0xe8/0x1e4
[  123.821916]  __vfs_write+0x18/0x3c
[  123.825318]  vfs_write+0xb8/0x1ac
[  123.828634]  ksys_write+0x60/0xd8
[  123.831946]  __arm64_sys_write+0x18/0x20
[  123.835879]  el0_svc_common.constprop.2+0xb0/0x160
[  123.840669]  el0_svc_handler+0x20/0x7c
[  123.844422]  el0_svc+0x8/0x640
[  123.847484] Code: d65f03c0 f940d296 914042d6 910092d6 (b94002d6)
[  123.853581] ---[ end trace d17f2f7d780f8e3f ]---

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
2019-11-25 15:47:42 +08:00
Shijie Qin b8ce664bea vpu: windor encoder: malone decoder: fix kernel panic caused by MU_Init
- Remove MU_Init() and other related operations after switch to
  mailbox
- Remain API for unify code between 4.19 and 5.x

[   30.052738] Call trace:
[   30.055182]  MU_Init+0x10/0x80
[   30.058237]  vpu_resume+0x48/0x1e8
[   30.061638]  platform_pm_resume+0x24/0x60
[   30.065653]  dpm_run_callback.isra.16+0x1c/0x70
[   30.070186]  device_resume+0x88/0x148
[   30.073850]  dpm_resume+0xd4/0x1e0
[   30.077253]  dpm_resume_end+0x14/0x28
[   30.080918]  suspend_devices_and_enter+0x14c/0x500
[   30.085706]  pm_suspend+0x1f4/0x260
[   30.089194]  state_store+0x84/0xf0
[   30.092603]  kobj_attr_store+0x14/0x28
[   30.096357]  sysfs_kf_write+0x48/0x58
[   30.100016]  kernfs_fop_write+0xe0/0x1f8
[   30.103940]  __vfs_write+0x18/0x40
[   30.107339]  vfs_write+0x19c/0x1f0
[   30.110738]  ksys_write+0x64/0xf0
[   30.114054]  __arm64_sys_write+0x14/0x20
[   30.117989]  el0_svc_common.constprop.2+0xb0/0x168
[   30.122779]  el0_svc_handler+0x20/0x80
[   30.126534]  el0_svc+0x8/0xc

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 15:47:42 +08:00
Shijie Qin 68a85f9823 vpu: malone decoder: enable mailbox and unify code
- Enable mailbox for vpu decoder
  The mailbox of mu_m0 is used by imx8qxp and imx8qm

- Unify code between 4.19 and 5.x
  Update code from 4.19
  Separate sc and mu contents to vpu_mu.h/vpu_mu.c
  Separate pm_domain contents to vpu_pm.h/vpu_pm.c
  Add kfifo for better hold received mu message
  Sync v4l2 change
  Use ktime_get_real_ts64() replace do_gettimeofday()

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 15:47:42 +08:00
Shijie Qin de893e3f79 vpu: windsor encoder: enable mailbox and unify code
- Enable mailbox for vpu encoder
  The mailbox of mu1_m0 is used by imx8qxp
  The mailbox of mu2_m0 are used by imx8qm

- Unify code between 4.19 and 5.x
  Update code from 4.19
  Separate sc and mu contents to vpu_encoder_mu.h/.c
  Separate pm_domain contents to vpu_encoder_pm.h/.c
  Add kfifo for better hold received mu message
  Sync v4l2 change

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 15:47:41 +08:00
Shijie Qin 82e0fc6154 vpu: windsor encoder: add vpuenc2 power domain for imx8qm
Add vpuenc2 power for imx8qm.
Unify name as vpuenc1 and vpuenc2

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 15:47:40 +08:00
Dong Aisheng 6f8ceefb9a vpu: hantro_845_h1: fix compat_ptr building issue
compat_ptr() depends on CONFIG_COMPAT.
Make hx280enc_ioctl() conditionally compiled to avoid a build
break in case CONFIG_COMPAT is not defined.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:39 +08:00
Zhou Peng e9d52b0f5e vpu: imx6: add decoder/encoder
fix dma_alloc_attrs failure issue:
need to set valid device pointer instead of null pointer in
parameters of functions: dma_alloc_coherent/dma_free_coherent

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:39 +08:00
Zhou Peng bca0c6dcb1 vpu: imx6: add decoder/encoder
add vpu source and enable it in makefile/kconfig

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:39 +08:00
Zhou Peng efd24bb953 vpu: hantro: add encoder for imx845 h1
add hantro 845 source code, include h1

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
[ Aisheng: merge Kconfig&Makefile changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:38 +08:00
Zhou Peng 4602d72fc0 vpu: hantro: add decoder for imx845
add hantro 845 source code, include g1/g2

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
[ Aisheng: merge Kconfig&Makefile changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:38 +08:00
Zhou Peng bb61f55140 vpu: malone: encoder: add mu2 power domain for imx8qm
add mu2 power domain

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:38 +08:00
Zhou Peng 3ca2128468 vpu: hantro: fix build error when enabling 'CONFIG_DEVICE_THERMAL'
comment undefined function hantro_update_voltage() which was already disabled due to other build issues.

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:37 +08:00
Dong Aisheng 92e1bbb20a media: vpu_windsor: fix boot warning by intialize device_caps
Caused by:
049e684 media: v4l2-dev: fix WARN_ON(!vdev->device_caps)
3c13505 media: v4l2-dev/ioctl: require non-zero device_caps, verify sane querycap results

[    1.672018] WARNING: CPU: 0 PID: 61 at ../drivers/media/v4l2-core/v4l2-dev.c:864 __video_register_device+0x70/0x1524
[    1.682454] Modules linked in:
[    1.685501] CPU: 0 PID: 61 Comm: kworker/0:1 Not tainted 5.3.0-rc2-next-20190730-01100-gb0d5e17 #476
[    1.694617] Hardware name: Freescale i.MX8QXP MEK (DT)
[    1.699751] Workqueue: events deferred_probe_work_func
[    1.704870] pstate: 60000005 (nZCv daif -PAN -UAO)
[    1.709647] pc : __video_register_device+0x70/0x1524
[    1.714603] lr : __video_register_device+0x70/0x1524
[    1.719550] sp : ffff00001207ba70
[    1.722849] x29: ffff00001207ba70 x28: ffff00001005bcd8
[    1.728148] x27: ffff80083b4e23b8 x26: ffff0000119a0230
[    1.733448] x25: ffff80083af4d800 x24: 0000000000000001
[    1.738747] x23: 0000000000000000 x22: ffff80083bfc7c10
[    1.744046] x21: ffff80083fa285c0 x20: ffff000011041d90
[    1.749346] x19: ffff000011989000 x18: ffff000014ffffff
[    1.754645] x17: 0000000037cab0d3 x16: ffff000014ffffff
[    1.759945] x15: ffff0000113e6000 x14: 0000008000000000
[    1.765244] x13: 0000000000000000 x12: 00000000000000e9
[    1.770543] x11: ffffffffffffffff x10: 00000000000000ea
[    1.775843] x9 : ffff0000119a34c0 x8 : 5d20657265682074
[    1.781142] x7 : 7563205b2d2d2d2d x6 : ffff0000106dc978
[    1.786441] x5 : 0000000000000000 x4 : 0000000000000000
[    1.791741] x3 : 00000000ffffffff x2 : 1e3af7ec181d8600
[    1.797040] x1 : 0000000000000000 x0 : 0000000000000024
[    1.802342] Call trace:
[    1.804779]  __video_register_device+0x70/0x1524
[    1.809383]  vpu_enc_probe+0x290/0xb94
[    1.813117]  platform_drv_probe+0x4c/0xb0
[    1.817112]  really_probe+0x1c4/0x2d0
[    1.820761]  driver_probe_device+0x58/0xfc
[    1.824842]  __device_attach_driver+0x90/0xac
[    1.829190]  bus_for_each_drv+0x68/0xbc
[    1.833008]  __device_attach+0xe0/0x138
[    1.836831]  device_initial_probe+0x10/0x18
[    1.841000]  bus_probe_device+0x90/0x98
[    1.844823]  deferred_probe_work_func+0x70/0xa4
[    1.849346]  process_one_work+0x13c/0x2b4
[    1.853337]  worker_thread+0x35c/0x3e4
[    1.857077]  kthread+0xf8/0x124
[    1.860204]  ret_from_fork+0x10/0x18

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:37 +08:00
Dong Aisheng 5ae24aba1c media: vpu_malone: fix boot warning by intialize device_caps
Caused by:
049e684 media: v4l2-dev: fix WARN_ON(!vdev->device_caps)
3c13505 media: v4l2-dev/ioctl: require non-zero device_caps, verify sane querycap results

[    1.650814] WARNING: CPU: 2 PID: 32 at ../drivers/media/v4l2-core/v4l2-dev.c:864 __video_register_device+0x70/0x1524
[    1.661231] Modules linked in:
[    1.664277] CPU: 2 PID: 32 Comm: kworker/2:1 Not tainted 5.3.0-rc2-next-20190730-01098-g446d4cd #475
[    1.673393] Hardware name: Freescale i.MX8QXP MEK (DT)
[    1.678527] Workqueue: events deferred_probe_work_func
[    1.683647] pstate: 60000005 (nZCv daif -PAN -UAO)
[    1.688424] pc : __video_register_device+0x70/0x1524
[    1.693379] lr : __video_register_device+0x70/0x1524
[    1.698327] sp : ffff000011d8ba90
[    1.701626] x29: ffff000011d8ba90 x28: ffff000011d33cd8
[    1.706925] x27: ffff80083bee7838 x26: ffff0000119a0230
[    1.712224] x25: ffff80083ae63000 x24: 0000000000000001
[    1.717523] x23: 0000000000000000 x22: ffff000011989000
[    1.722823] x21: ffff80083bfc7810 x20: 0000000000000000
[    1.728122] x19: ffff000011989000 x18: ffff000010035fff
[    1.733422] x17: 0000000096ae19b6 x16: ffff000010035fff
[    1.738721] x15: ffff0000113e6000 x14: 0000008000000000
[    1.744020] x13: 0000000000000000 x12: 00000000000000e9
[    1.749320] x11: ffffffffffffffff x10: 00000000000000ea
[    1.754619] x9 : ffff0000119a34c0 x8 : 5d20657265682074
[    1.759918] x7 : 7563205b2d2d2d2d x6 : ffff0000106dc978
[    1.765218] x5 : 0000000000000000 x4 : 0000000000000000
[    1.770517] x3 : 00000000ffffffff x2 : 1e0ac921e89b3600
[    1.775816] x1 : 0000000000000000 x0 : 0000000000000024
[    1.781118] Call trace:
[    1.783557]  __video_register_device+0x70/0x1524
[    1.788160]  vpu_probe+0x2e4/0x9cc
[    1.791546]  platform_drv_probe+0x4c/0xb0
[    1.795540]  really_probe+0x1c4/0x2d0
[    1.799188]  driver_probe_device+0x58/0xfc
[    1.803271]  __device_attach_driver+0x90/0xac
[    1.807619]  bus_for_each_drv+0x68/0xbc
[    1.811439]  __device_attach+0xe0/0x138
[    1.815260]  device_initial_probe+0x10/0x18
[    1.819429]  bus_probe_device+0x90/0x98
[    1.823252]  deferred_probe_work_func+0x70/0xa4
[    1.827775]  process_one_work+0x13c/0x2b4
[    1.831766]  worker_thread+0x35c/0x3e4
[    1.835506]  kthread+0xf8/0x124
[    1.838633]  ret_from_fork+0x10/0x18
[    1.842193] ---[ end trace ee5db4b471a8d91f ]---

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:36 +08:00
Dong Aisheng 9d9cc0d614 MLK-21985-3 vpu: windsor: b0: fix build for next 20190607 upgrade
Due to below commit:
7e98b7b542 ("media: v4l2: Get rid of ->vidioc_enum_fmt_vid_{cap, out}_mplane")

../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1586:2: error: unknown field ‘vidioc_enum_fmt_vid_cap_mplane’ specified in initializer
  .vidioc_enum_fmt_vid_cap_mplane = vpu_enc_v4l2_ioctl_enum_fmt_vid_cap_mplane,
  ^
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1587:2: error: unknown field ‘vidioc_enum_fmt_vid_out_mplane’ specified in initializer
  .vidioc_enum_fmt_vid_out_mplane = vpu_enc_v4l2_ioctl_enum_fmt_vid_out_mplane,
  ^
../scripts/Makefile.build:278: recipe for target 'drivers/mxc/vpu_windsor/vpu_encoder_b0.o' failed
make[4]: *** [drivers/mxc/vpu_windsor/vpu_encoder_b0.o] Error 1

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:36 +08:00
Dong Aisheng 937fff6194 MLK-21985-2 vpu: malone: b0: fix build for next 20190607 upgrade
Due to below commit:
7e98b7b542 ("media: v4l2: Get rid of ->vidioc_enum_fmt_vid_{cap, out}_mplane")

We met the following build error:
../drivers/mxc/vpu_malone/vpu_b0.c:1721:2: error: unknown field ‘vidioc_enum_fmt_vid_cap_mplane’ specified in initializer
  .vidioc_enum_fmt_vid_cap_mplane = v4l2_ioctl_enum_fmt_vid_cap_mplane,
  ^
../drivers/mxc/vpu_malone/vpu_b0.c:1722:2: error: unknown field ‘vidioc_enum_fmt_vid_out_mplane’ specified in initializer
  .vidioc_enum_fmt_vid_out_mplane = v4l2_ioctl_enum_fmt_vid_out_mplane,

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:35 +08:00
Dong Aisheng 353bbca001 MLK-21876-22 vpu: build for ARM64 only
Current VPU drivers only support ARM64, not need to compile
for ARM32.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:35 +08:00
Zhou Peng feb3fc549f vpu: windsor encoder: porting from 4.19 rc3 release
Fix build error for kernel 5.x:
- power domain adjustment
  use dev_pm_domain_attach_by_name()/device_link_add
- remove sc fw api
  comment fuse related function
- definition of vb2_qbuf() changed
  set 'media_device' for vb2_qbuf()
- 'vidioc_g_crop'/'vidioc_s_crop' removed
  comment function 'v4l2_ioctl_g_crop'
- remove legacy macro, such as 'VB2_BUF_STATE_PREPARED'

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:34 +08:00
Zhou Peng 6c775159dd vpu: windsor encoder: porting from 4.19 rc3 release
updating source in drivers/mxc/vpu_windsor

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:34 +08:00
Zhou Peng fbfef11442 vpu: malone decoder: porting from 4.19 rc3 release
Fix build error for kernel 5.x:
- power domain adjustment
  use dev_pm_domain_attach_by_name()/device_link_add
- remove sc fw api
  comment fuse related function
- definition of vb2_qbuf() changed
  set 'media_device' for vb2_qbuf()
- 'vidioc_g_crop' removed
  comment function 'v4l2_ioctl_g_crop'

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:33 +08:00
Zhou Peng 79a1c026fa vpu: malone decoder: porting from 4.19 rc3 release
updating source in drivers/mxc/vpu_malone

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:32 +08:00
Dong Aisheng 67b35d2120 vpu: windsor: fix build error
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: In function ‘show_buffer_info’:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:3951:23: error: ‘VB2_BUF_STATE_REQUEUEING’ undeclared (first use in this function)
    " %d:requeueing,", VB2_BUF_STATE_REQUEUEING);

Due to this macro was removed by the following commit:
commit c6e4e2c403
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date:   Thu Feb 28 07:35:46 2019 -0500

    media: vb2: drop VB2_BUF_STATE_REQUEUEING

    The last user of this state has been converted, so we can now drop
    this. Requeueing causes the queue to become unordered, which causes
    problems with requests and (in the future) fences.

    Since it is no longer needed, just get rid of this.

    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:31 +08:00
Dong Aisheng 3f0ca5ec74 vpu: windsor: remove deprecated using of VB2_BUF_STATE_PREPARED
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: In function ‘show_buffer_info’:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:4001:21: error: ‘VB2_BUF_STATE_PREPARED’ undeclared (first use in this function)
    " %d:prepared,", VB2_BUF_STATE_PREPARED);

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:31 +08:00
Dong Aisheng d450dea80f vpu: windsor: remove deprecated using of s_crop/g_crop
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: At top level:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1415:2: error: unknown field ‘vidioc_g_crop’ specified in initializer
  .vidioc_g_crop                  = vpu_enc_v4l2_ioctl_g_crop,
  ^
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1415:2: warning: initialization from incompatible pointer type
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1415:2: warning: (near initialization for ‘vpu_enc_v4l2_ioctl_ops.vidioc_dqbuf’)
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1416:2: error: unknown field ‘vidioc_s_crop’ specified in initializer
  .vidioc_s_crop   = vpu_enc_v4l2_ioctl_s_crop,
  ^

Module owner can double check later if need implement the same function
in other callbackes.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:30 +08:00
Dong Aisheng 79ab5d4a80 vpu: windsor: fix build failure
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: In function ‘vpu_enc_v4l2_ioctl_qbuf’:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1048:8: warning: passing argument 2 of ‘vb2_qbuf’ from incompatible pointer type
  ret = vb2_qbuf(&q_data->vb2_q, buf);
        ^
In file included from ../include/media/v4l2-mem2mem.h:20:0,
                 from ../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:47:
../include/media/videobuf2-v4l2.h:144:5: note: expected ‘struct media_device *’ but argument is of type ‘struct v4l2_buffer *’
 int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev,
     ^
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1048:8: error: too few arguments to function ‘vb2_qbuf’
  ret = vb2_qbuf(&q_data->vb2_q, buf);

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:30 +08:00
Dong Aisheng 5c1f0bf1e6 vpu: malone: fix build failure
../drivers/mxc/vpu_malone/vpu_b0.c: In function ‘v4l2_ioctl_qbuf’:
../drivers/mxc/vpu_malone/vpu_b0.c:920:8: warning: passing argument 2 of ‘vb2_qbuf’ from incompatible pointer type
  ret = vb2_qbuf(&q_data->vb2_q, buf);
        ^
In file included from ../include/media/v4l2-mem2mem.h:20:0,
                 from ../drivers/mxc/vpu_malone/vpu_b0.c:47:
../include/media/videobuf2-v4l2.h:144:5: note: expected ‘struct media_device *’ but argument is of type ‘struct v4l2_buffer *’
 int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev,
     ^
../drivers/mxc/vpu_malone/vpu_b0.c:920:8: error: too few arguments to function ‘vb2_qbuf’
  ret = vb2_qbuf(&q_data->vb2_q, buf);
        ^
In file included from ../include/media/v4l2-mem2mem.h:20:0,
                 from ../drivers/mxc/vpu_malone/vpu_b0.c:47:
../include/media/videobuf2-v4l2.h:144:5: note: declared here
 int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev,
     ^
../drivers/mxc/vpu_malone/vpu_b0.c: At top level:
../drivers/mxc/vpu_malone/vpu_b0.c:1150:2: error: unknown field ‘vidioc_g_crop’ specified in initializer
  .vidioc_g_crop                  = v4l2_ioctl_g_crop,

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:30 +08:00
Dong Aisheng 373b49bfe3 vpu: hantro: fix build failure
../drivers/mxc/hantro/hantrodec.c: In function ‘hantrodec_ioctl’:
../drivers/mxc/hantro/hantrodec.c:1033:62: error: macro "access_ok" passed 3 arguments, but takes just 2
   err = !access_ok(VERIFY_WRITE, (void *) arg, _IOC_SIZE(cmd));
                                                              ^
../drivers/mxc/hantro/hantrodec.c:1033:10: error: ‘access_ok’ undeclared (first use in this function)
   err = !access_ok(VERIFY_WRITE, (void *) arg, _IOC_SIZE(cmd));
          ^
../drivers/mxc/hantro/hantrodec.c:1033:10: note: each undeclared identifier is reported only once for each function it appears in
../drivers/mxc/hantro/hantrodec.c:1035:61: error: macro "access_ok" passed 3 arguments, but takes just 2
   err = !access_ok(VERIFY_READ, (void *) arg, _IOC_SIZE(cmd));
                                                             ^
  CC      drivers/mtd/nand/raw/nand_base.o
  CC      drivers/irqchip/irq-mvebu-odmi.o
  CC      drivers/mtd/nand/raw/nand_legacy.o
../drivers/mxc/hantro/hantrodec.c: In function ‘get_hantro_core_desc32’:
../drivers/mxc/hantro/hantrodec.c:1266:61: error: macro "access_ok" passed 3 arguments, but takes just 2
  if (!access_ok(VERIFY_READ, up, sizeof(struct core_desc_32)) ||
                                                             ^
../drivers/mxc/hantro/hantrodec.c:1266:7: error: ‘access_ok’ undeclared (first use in this function)
  if (!access_ok(VERIFY_READ, up, sizeof(struct core_desc_32)) ||
       ^
../drivers/mxc/hantro/hantrodec.c: In function ‘put_hantro_core_desc32’:
../drivers/mxc/hantro/hantrodec.c:1280:62: error: macro "access_ok" passed 3 arguments, but takes just 2
  if (!access_ok(VERIFY_WRITE, up, sizeof(struct core_desc_32)) ||
                                                              ^
../drivers/mxc/hantro/hantrodec.c:1280:7: error: ‘access_ok’ undeclared (first use in this function)
  if (!access_ok(VERIFY_WRITE, up, sizeof(struct core_desc_32)) ||
       ^
../scripts/Makefile.build:278: recipe for target 'drivers/mxc/hantro/hantrodec.o' failed
make[4]: *** [drivers/mxc/hantro/hantrodec.o] Error 1
../scripts/Makefile.build:489: recipe for target 'drivers/mxc/hantro' failed
make[3]: *** [drivers/mxc/hantro] Error 2
../scripts/Makefile.build:489: recipe for target 'drivers/mxc' failed
make[2]: *** [drivers/mxc] Error 2
make[2]: *** Waiting for unfinished jobs...

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:30 +08:00
Zhou Peng 1875e0954b arm64: vpu: m850d: hantro: mxc config
enable hantro decoder in mxc config
drivers/mxc/Kconfig
drivers/mxc/Makefile

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:29 +08:00
Zhou Peng 83ac8664e5 arm64: vpu: m850d: hantro
Add hantro decoder driver:
drivers/mxc/hantro
include/linux/hantrodec.h
include/uapi/linux/hantrodec.h

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:28 +08:00
Zhou Peng 7339b6c620 Add directory driver/mxc and related scripts
Related build scripts:
drivers/Kconfig
drivers/Makefile
drivers/mxc/Kconfig
drivers/mxc/Makefile

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:27 +08:00
Zhou Peng 95b1763c0a Add Malone decoder and windsor encoder for QXP/QM
Add vpu driver:
drivers/mxc/vpu_malone
drivers/mxc/vpu_windsor

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:27 +08:00
Xianzhong d79b5a2808 LF-84 [#imx-1834] remove gpu coherent_dma_mask setting
gpu_probe set coherent_dma_mask with 40BIT configuration,
L5.4 dma_alloc_wc will return physical address beyond 4GB,
that will cause GPU hang and kernel panic problem on QM.

default coherent_dma_mask is 32BIT, can meet GPU requirement,
this patch remove coherent_dma_mask setting from GPU driver.

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 15:47:24 +08:00
Ya Zhou 9bfda82aee MGS-5245 [#imx-1755] [8MN_EVK] VTK: fix the gpu dump when enable vProfile
fix the gpu dump when enable vProfile on 8MN_EVK

Date: 7th Nov ,2019
Signed-off-by Ya Zhou <ya.zhou@nxp.com>

(cherry picked from commit 053c97c0387673c4e730d9b2f780f8cde5fcdf5b)
2019-11-25 15:47:23 +08:00
Xianzhong dfc0a717ce MGS-5307 gpu: integrate 6.4.0.p2 driver
Port M815 GPU patches from 6.2.4.p4 to 6.4.0,
More bug-fixings for vulkan 1.1.3 and NNCTS 1.2.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 15:47:23 +08:00
Yuantian Tang 4f78081163 QSDK-5959 [#ccc] update the platform driver to support layerscape soc
Update the imx platform gpu driver to accommodate layerscape soc,
so that both platform can share the same platform driver.

Signed-off-by: Tang Yuantian <andy.tang@nxp.com>
2019-11-25 15:47:19 +08:00
Xianzhong 929cd8167a MGS-5261 [#imx-1771] fix dummy draw hang for 8MM GPU
dummy draw is required for 8MM GPU errata - HBN1285,
this fix shall be applied for GPU power-up transition,
otherwise GPU shader hang with the unnecessary flush.

check GPU MMU state to enable dummy draw fix only.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 15:47:19 +08:00
Xianzhong 5e9a2ac12a MGS-5284 [#imx-1786] fix GPU panic with vm_mmap failure
When vm_mmap fail, code jump to OnError with error status and userLogical variable != 0.
Then _CMAFSLUnmapUser is called with a invalid virtual address (MdlMap->vmaAddr) and cause panic.

Check userLogical to avoid GPU kernel panic for error handling.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 15:47:18 +08:00
Xianzhong fe4bb99bf8 MGS-5283 [#imx-1784] fix GPU AXI bus error
Fix GPU safe memory with gcvALLOC_FLAG_4GB_ADDR

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 15:47:17 +08:00
Xianzhong f79ac90c9a MGS-5283 [#imx-1238] fix GPU memory without CMA
Fix GPU memory problem when disable CMA allocator,
set LINUX_CMA_FSL=0 in gc_hal_kernel_platform_imx.config

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 15:47:17 +08:00
Xianzhong 3c6cb83114 MGS-4376 [#imx-1238] fix low performance with CMA allocator
there are lots of PFNs busy message when run GPU tests:
 [  622.370671] alloc_contig_range: [4ea70, 4ea7c) PFNs busy
 [  626.518072] alloc_contig_range: [4ea90, 4ea9c) PFNs busy

this problem is related with CMA migration for fragments,

move CMA allocator after GFP to avoid memory migration,
also fix CMA preempt for contiguous memory request.

can improve CTS and gpubench benchmarks on M850D.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit ad77ed61b72c8362b04361acd2deb685fee15436)
2019-11-25 15:47:17 +08:00
Ella Feng 80b7bdd8b4 MGS-5176-2 [#imx-1744] Need free the pages if malloc memory failed
When alloc NonContiguous1MPages, if malloc fail, need free the pages to avoid memory leak

Date: 24 Oct, 2019
Signed-off-by: Xianzhong Li <xianzhong.li@nxp.com>
2019-11-25 15:47:16 +08:00
Ella Feng ce7c0558a8 MGS-5176 [#imx-1744] Coverity issue of 6.4.0.p1.
The intension of this code is that, if current core is null, go to get the next one.
If it's already the last one, no need to do this.

Date: 23 Oct, 2019
Signed-off-by: Ella Feng <ella.feng@nxp.com>
2019-11-25 15:47:15 +08:00
Xianzhong 475535f320 MGS-5252 Integrate Vivante 6.4.0.p1 GPU driver
Fix Coverity high impact and Vulkan 1.1.3 issues

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 15:47:15 +08:00
Leonard Crestez d06a28f58e gpu-viv: Fix writecombine/wc build error
Upstream removed the _writecombine aliases

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:47:14 +08:00
Minjie Zhuang 08f009a338 gpu:Remove dma.h to avoid Linux 5.x build problem
Log:
    ../drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c:87:17:
fatal error: dma.h: No such file or directory
     #include <dma.h>
                     ^
    compilation terminated.
    ../scripts/Makefile.build:280: recipe for target
'drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.o' failed
    make[4]: ***
[drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.o] Error 1

Signed-off-by: Minjie Zhuang<minjie.zhuang@nxp.com>
2019-11-25 15:47:13 +08:00
Dong Aisheng cc07713a0d gpu: fix build break due to dma headfile include
It's caused by GPU upgrade overwrite the former fix.

Log:
../drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c:87:17: fatal error: dma.h: No such file or directory
 #include <dma.h>
                 ^
compilation terminated.
../scripts/Makefile.build:280: recipe for target 'drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.o' failed
make[4]: *** [drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.o] Error 1

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:12 +08:00
Minjie Zhuang e9371a7092 gpu:Integrate 6.4.0 kernel driver for Linux L5.x
Containing update SCU API and upgrade kernel to 640 driver for Linux L5.x

drivers/mxc/gpu-viv/*

Signed-off-by: Minjie Zhuang<minjie.zhuang@nxp.com>
2019-11-25 15:47:12 +08:00
Minjie Zhuang 97bf98e7f2 gpu: Update SCU API and change the method to distinguish 8QM/8QXP from other boards
The SCU API used in this file is for 4.19 kernel version and need to upgrade,
Need to modify the method to distinguish 8QM.8QXP by compatible string

drivers/mxc/gpu-viv/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx.c
2019-11-25 15:47:10 +08:00
Dong Aisheng 0d03d5163c MLK-21876-11 gpu: fix build for next-20190524 upgrade
Failed on imx v6_v7 build.

../drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c:86:17: fatal error: dma.h: No such file or directory
 #include <dma.h>
                 ^
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:09 +08:00
Dong Aisheng 35802f523c gpu: imx: fix gpu boot hang by defer driver register time
GPU driver can't support DEFER_PROBE well.
So let's defer the driver register time to make booting ok first.

[    1.255193] galcore: clk_get clk_core failed
[    1.259741] Galcore version 6.2.4.190076
[    1.342888] Unable to handle kernel NULL pointer dereference at virtual address 00000000000001a0
[    1.351377] Mem abort info:
[    1.354134]   ESR = 0x96000004
[    1.357160]   Exception class = DABT (current EL), IL = 32 bits
[    1.363078]   SET = 0, FnV = 0
[    1.366116]   EA = 0, S1PTW = 0
[    1.369244] Data abort info:
[    1.372101]   ISV = 0, ISS = 0x00000004
[    1.375932]   CM = 0, WnR = 0
[    1.378887] [00000000000001a0] user address but active_mm is swapper
[    1.385234] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[    1.390781] Modules linked in:
[    1.393823] Process swapper/0 (pid: 1, stack limit = 0x(____ptrval____))
[    1.400515] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.1.0-rc5-next-20190418-00708-g2e89357-dirty #159
[    1.409892] Hardware name: Freescale i.MX8QXP MEK (DT)
[    1.415020] pstate: 60000005 (nZCv daif -PAN -UAO)
[    1.419808] pc : __pm_runtime_resume+0x20/0x74
[    1.424233] lr : _SetPower+0x48/0x54
[    1.427786] sp : ffff00001005b670
[    1.431088] x29: ffff00001005b670 x28: ffff80083bbd1a20
[    1.436387] x27: 0000000000000000 x26: 0000000000000000
[    1.441686] x25: 0000000000000000 x24: 0000000000000001
[    1.446985] x23: 0000000000000001 x22: 0000000000000001
[    1.452285] x21: ffff80083ad42800 x20: ffff80083ad42800
[    1.457584] x19: 0000000000000000 x18: 0000000000000030
[    1.462884] x17: 0000000080000000 x16: ffff000012c80000
[    1.468183] x15: ffff7e0020eb9040 x14: ffff80083f9eff80
[    1.473482] x13: 0000000000000000 x12: 00000000ffffffc1
[    1.478782] x11: 0000000000000005 x10: 0101010101010101
[    1.484081] x9 : 0000000000000000 x8 : ffff80083ad19798
[    1.489380] x7 : 0000000000000000 x6 : 000000000000003f
[    1.494680] x5 : 0000000000000040 x4 : 0000000000000000
[    1.499979] x3 : 00000000000001a0 x2 : ffff000011680470
[    1.505278] x1 : 0000000000000004 x0 : 0000000000000000
[    1.510580] Call trace:
[    1.513017]  __pm_runtime_resume+0x20/0x74
[    1.517099]  _SetPower+0x48/0x54
[    1.520312]  gckOS_SetGPUPower+0x6c/0x148
[    1.524311]  gctaOS_SetGPUPower+0x1c/0x24
[    1.528306]  gctaHARDWARE_Construct+0x8c/0x390
[    1.532733]  gcTA_Construct+0x6c/0x148
[    1.536474]  gckGALDEVICE_Construct+0x364/0x8f8
[    1.540989]  drv_init+0x1ec/0x34c
[    1.544291]  gpu_probe+0x1fc/0x244
[    1.547680]  platform_drv_probe+0x4c/0xb0
[    1.551675]  really_probe+0x1f8/0x2c8
[    1.555323]  driver_probe_device+0x58/0xfc
[    1.559406]  device_driver_attach+0x68/0x70
[    1.563578]  __driver_attach+0x94/0xdc
[    1.567312]  bus_for_each_dev+0x64/0xc0
[    1.571134]  driver_attach+0x20/0x28
[    1.574698]  bus_add_driver+0x148/0x1fc
[    1.578519]  driver_register+0x68/0x120
[    1.582342]  __platform_driver_register+0x4c/0x54
[    1.587035]  gpu_init+0x54/0x94
[    1.590162]  do_one_initcall+0x58/0x1b8
[    1.593985]  kernel_init_freeable+0x1cc/0x288
[    1.598329]  kernel_init+0x10/0x100
[    1.601802]  ret_from_fork+0x10/0x18
[    1.605367] Code: aa0003f3 361000e1 91068263 f9800071 (885f7c60)
[    1.611458] ---[ end trace e1dc4ddcfc5850c0 ]---
[    1.616118] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    1.623695] SMP: stopping secondary CPUs
[    1.627606] Kernel Offset: disabled
[    1.631078] CPU features: 0x002,20002008
[    1.634985] Memory Limit: none
[    1.638031] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:09 +08:00
Dong Aisheng ce86151b5c gpu: more build fix
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:09 +08:00
Dong Aisheng b54acb9c76 gpu: fix totalram_pages build error
../drivers/mxc/gpu-viv/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx.c: In function ‘_AdjustParam’:
../drivers/mxc/gpu-viv/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx.c:1520:46: error: invalid operands to binary * (have ‘long unsigned int (*)(void)’ and ‘long unsigned int’)
         ((Args->baseAddress + totalram_pages * PAGE_SIZE) > 0x100000000))

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:08 +08:00
Dong Aisheng 5ec394df46 gpu: fix do_gettimeofday build error
This api was removed from kernel. Use new instead.

../drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c: In function ‘gckOS_GetTime’:
../drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c:3006:5: error: implicit declaration of function ‘do_gettimeofday’ [-Werror=implicit-function-declaration]
     do_gettimeofday(&tv);

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:07 +08:00