linux.git
7 years agoMLK-16536-16 video: fbdev: dcss: change 'refcount' to 'struct kref' type
Fancy Fang [Fri, 29 Sep 2017 06:36:18 +0000 (14:36 +0800)]
MLK-16536-16 video: fbdev: dcss: change 'refcount' to 'struct kref' type

Use 'struct kref' type for 'refcount' field instead of
'atomic_t' to take advantage of 'kref_*()' interface
series. The benefit to do so can improve the defered
cfifo flush performance, since this defered flush does
not need to wait to be done until next vsync happens.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-15 video: fbdev: dcss: improve cfifo wrapping handling
Fancy Fang [Tue, 26 Sep 2017 09:11:55 +0000 (17:11 +0800)]
MLK-16536-15 video: fbdev: dcss: improve cfifo wrapping handling

After changing the strategy to 'flush cfifo once per frame',
the cfifo wrapping handling should also be changed accordingly.
Now, when it is found that the cfifo has no enough room from 'in'
to the buffer end to hold the current commit, the 'commit_cfifo'
will cancel this commit and flush the cfifo workqueue before
restart the commit again.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-14 video: fbdev: dcss: correct ret value for 'dcss_wait_for_vsync()'
Fancy Fang [Thu, 28 Sep 2017 14:09:47 +0000 (22:09 +0800)]
MLK-16536-14 video: fbdev: dcss: correct ret value for 'dcss_wait_for_vsync()'

The correct return value for 'dcss_wait_for_vsync()' when
it executes successfully should be '0'. But this current
value now gets from 'wait_event_interruptible_timeout()'
which returns non-zero value when the wait is not timeout.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-13 video: fbdev: dcss: improve 'kfifo_to_end_len()' macro
Fancy Fang [Wed, 27 Sep 2017 07:49:41 +0000 (15:49 +0800)]
MLK-16536-13 video: fbdev: dcss: improve 'kfifo_to_end_len()' macro

The macro 'kfifo_to_end_len()' is used to get the length
between the current kfifo 'in' and the kfifo end. Previous
implementation has a short-coming under the new strategy
that multiple commits are combined into one cfifo flush.

For a simple example, commits 'A' and 'B' are going to be
combined into one flush, and the last byte of 'A' exactly
occupy the last byte of fifo coincidently. Then when handling
the 'B' commit, the old 'kfifo_to_end_len()' logic returns
the fifo size instead of 0,  So the condition 'commit_size >
kfifo_to_end_len(&cfifo->fifo)' will be false and let 'B'
to be stored from fifo beginning which finally triggers
below kernel BUG log:

[  568.558341] ------------[ cut here ]------------
[  568.558343] kernel BUG at drivers/video/fbdev/mxc/imx_dcss.c:2261!
[  568.558348] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[  568.558354] Modules linked in:
[  568.558362] CPU: 0 PID: 34 Comm: kworker/u8:1 Not tainted
[  568.558364] Hardware name: Freescale i.MX8MQ EVK (DT)
[  568.558385] Workqueue: ctxld-wq dcss_ctxld_config
[  568.558387] task: ffff8000ba2d8c80 task.stack: ffff8000ba2f8000
[  568.558392] PC is at dcss_ctxld_config+0x1dc/0x1e8
[  568.558396] LR is at dcss_ctxld_config+0x1dc/0x1e8
[  568.558398] pc : [<ffff0000084786c4>] lr : [<ffff0000084786c4>]
pstate: 80000145
[  568.558399] sp : ffff8000ba2fbd30
[  568.558404] x29: ffff8000ba2fbd30 x28: ffff8000ba1f0000
[  568.558407] x27: ffff8000ba0096a8 x26: ffff8000ba9d8930
[  568.558411] x25: ffff8000ba3a2410 x24: 0000000000000003
[  568.558414] x23: 0000000000000008 x22: ffff8000ba9d8918
[  568.558417] x21: ffff8000ba9d88f0 x20: ffff8000ba9d8818
[  568.558421] x19: ffff8000bbdd0080 x18: ffffffffffffffff
[  568.558424] x17: 0000ffff934c8b60 x16: ffff0000081df178
[  568.558427] x15: ffff0000092db010 x14: 202c387830203d20
[  568.558431] x13: ffff0000092dafe0 x12: ffff0000091be498
[  568.558434] x11: ffff0000091be498 x10: ffff0000092d8650
[  568.558437] x9 : 0000000000000000 x8 : ffff8000bff7352f
[  568.558441] x7 : 0000000000000000 x6 : 0000000000000016
[  568.558444] x5 : 0000000000804738 x4 : 0000000000000000
[  568.558447] x3 : 0000000000000140 x2 : 000000000000f9bd
[  568.558450] x1 : ffff8000ba2f8000 x0 : 0000000000000030
[  568.558451]
[  568.558453] Process kworker/u8:1 (pid: 34, stack limit =
0xffff8000ba2f8020)
...
[  568.558541] Call trace:
[  568.558545] Exception stack(0xffff8000ba2fbb60 to 0xffff8000ba2fbc90)
...
[  568.558586] [<ffff0000084786c4>] dcss_ctxld_config+0x1dc/0x1e8
[  568.558595] [<ffff0000080d3bb4>] process_one_work+0x11c/0x370
[  568.558600] [<ffff0000080d3e58>] worker_thread+0x50/0x4a0
[  568.558606] [<ffff0000080d9a70>] kthread+0xd0/0xe8
[  568.558611] [<ffff000008082e80>] ret_from_fork+0x10/0x50
[  568.558616] Code: d00055e1 aa1903e0 91074021 94056a66 (d4210000)
[  568.558623] ---[ end trace faae62afa988e865 ]---
[  568.558707] Unable to handle kernel paging request at virtual address
ffffffffffffffd8
[  568.558709] pgd = ffff8000bbda1000
[  568.558712] [ffffffffffffffd8] *pgd=00000000fb7ad003
[  568.558714] , *pud=00000000fb6a0003
[  568.558715] , *pmd=0000000000000000
...

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-12 video: fbdev: dcss: flush cfifo once per frame
Fancy Fang [Mon, 25 Sep 2017 04:24:54 +0000 (12:24 +0800)]
MLK-16536-12 video: fbdev: dcss: flush cfifo once per frame

Change the cfifo flush to be once per frame to combine
possible multiple flush requests in one frame into one
flush to improve performance. And during one frame, only
flush requests from different channels can be combined,
and the different requests from the same channel cannot
be combined into one flush.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-11 video: fbdev: dcss: add '__maybe_unused' to 'dtg_irq_mask()'
Fancy Fang [Fri, 22 Sep 2017 14:41:53 +0000 (22:41 +0800)]
MLK-16536-11 video: fbdev: dcss: add '__maybe_unused' to 'dtg_irq_mask()'

The function 'dtg_irq_mask()' is not used at this
moment which caused gcc compiler generate the build
warning:

"‘dtg_irq_mask’ defined but not used [-Wunused-function]"

So add attribute '__maybe_unused' to 'dtg_irq_mask()'
functon definition to avoid this build warning.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-10 video: fbdev: dcss: unmask 'IRQ_TC_LINE1' by default
Fancy Fang [Fri, 22 Sep 2017 14:37:24 +0000 (22:37 +0800)]
MLK-16536-10 video: fbdev: dcss: unmask 'IRQ_TC_LINE1' by default

Unmask the 'IRQ_TC_LINE1' when initialize it by default,
since the vsync count can be used as a reference count or
timestamp.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-9 video: fbdev: dcss: remove undesired variables in 'dcss_set_par()'
Fancy Fang [Fri, 22 Sep 2017 14:19:02 +0000 (22:19 +0800)]
MLK-16536-9 video: fbdev: dcss: remove undesired variables in 'dcss_set_par()'

The variables 'cinfo' and 'chan_info' both refer to the
same 'struct dcss_channel_info' data. So remove 'chan_info'
and its related variables to make code more clean.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-8 video: fbdev: dcss: move 'ctxld_list' field to 'struct ctxld_fifo'
Fancy Fang [Fri, 22 Sep 2017 14:10:33 +0000 (22:10 +0800)]
MLK-16536-8 video: fbdev: dcss: move 'ctxld_list' field to 'struct ctxld_fifo'

The 'ctxld_list' is more closely related to 'struct ctxld_info'
structure. So moving its definition to this structure is more
reasonable.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-7 video: fbdev: dcss: abstract cfifo wq flush operation
Fancy Fang [Thu, 21 Sep 2017 03:44:38 +0000 (11:44 +0800)]
MLK-16536-7 video: fbdev: dcss: abstract cfifo wq flush operation

Abstract the cfifo workqueue flush operation to a separate
interface 'finish_cfifo()'.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-6 video: fbdev: dcss: split 'commit_to_fifo' into three parts
Fancy Fang [Wed, 20 Sep 2017 09:51:50 +0000 (17:51 +0800)]
MLK-16536-6 video: fbdev: dcss: split 'commit_to_fifo' into three parts

This commit split the function 'commit_to_fifo' into three
parts: 'alloc_cc()', 'commit_cfifo()' and 'flush_cfifo()'.
So that each of the three parts can be used as required,
but not used all together.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-5 video: fbdev: dcss: move 'ctxld_wq' to 'struct ctxld_fifo'
Fancy Fang [Wed, 20 Sep 2017 09:41:43 +0000 (17:41 +0800)]
MLK-16536-5 video: fbdev: dcss: move 'ctxld_wq' to 'struct ctxld_fifo'

The 'ctxld_wq' is more closely related to 'struct ctxld_info'
structure. So moving its definition to this structure is more
reasonable.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-4 video: fbdev: abstract cfifo 'in' operation
Fancy Fang [Wed, 20 Sep 2017 07:24:13 +0000 (15:24 +0800)]
MLK-16536-4 video: fbdev: abstract cfifo 'in' operation

Abstract the process that copy data from 'cb' to 'cfifo'
to a separate function from 'commit_to_fifo()'. This is
a refinement.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-3 video: fbdev: dcss: replace 'kfifo_esize()' by 'esize'
Fancy Fang [Tue, 19 Sep 2017 10:47:13 +0000 (18:47 +0800)]
MLK-16536-3 video: fbdev: dcss: replace 'kfifo_esize()' by 'esize'

When doing ctxld config, the 'esize' variable is already
assigned to the value derived from 'kfifo_esize()'. So
using the exsiting value instead of deriving it again.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-2 video: fbdev: dcss: refine 'esize' obtainment
Fancy Fang [Tue, 19 Sep 2017 10:56:38 +0000 (18:56 +0800)]
MLK-16536-2 video: fbdev: dcss: refine 'esize' obtainment

The 'esize' is better be got by 'kfifo_esize()'
instead of using 'sizeof' to make the code more
compatible and easier to unserstand.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16536-1 video: fbdev: dcss: use kfifo 'out' to be next read offset
Fancy Fang [Tue, 19 Sep 2017 10:34:10 +0000 (18:34 +0800)]
MLK-16536-1 video: fbdev: dcss: use kfifo 'out' to be next read offset

The kfifo 'out' points to the first byte of data to be
consumed next time. So use it to get the data offset to
be accessed by CTXLD and remove unused field 'fifo_in'
from 'struct ctxld_commit'.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
7 years agoMLK-16551 ARM64: dts: fsl-imx8qxp-mek: enable USB2 port
Peter Chen [Fri, 29 Sep 2017 02:55:03 +0000 (10:55 +0800)]
MLK-16551 ARM64: dts: fsl-imx8qxp-mek: enable USB2 port

Both host and device mode are support, and the port is at base board.

Below rework is needed:
Remove R145, R143, R1390, and install R144, R142, R1389.

BuildInfo:
- SCFW 1f59442e, IMX-MKIMAGE fb52c576, ATF
- U-Boot 2017.03-imx_v2017.03+g34be5a2

Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
7 years agoMLK-16522-4 ARM64: dts: fsl-imx8qxp-mek: add USB3 support
Peter Chen [Mon, 18 Sep 2017 06:11:10 +0000 (14:11 +0800)]
MLK-16522-4 ARM64: dts: fsl-imx8qxp-mek: add USB3 support

Add TCPCI device NXP PTN5110 as well as USB3 port support, they are
disabled by default due to board rework is needed, it needs to
replace U182 from NTB0104 to NTS0104, please consult hardware team
for detail.

Without rework, but enable USB3 will cause endless of PTN5110 interrupts
due to voltage of ALERN_N from PTN5110 is incorrect.

BuildInfo:
- SCFW 1f59442e, IMX-MKIMAGE fb52c576, ATF
- U-Boot 2017.03-imx_v2017.03+g34be5a2

Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
7 years agoMLK-16522-3 usb: cdns3: do not disable interrupt during role switch
Peter Chen [Thu, 21 Sep 2017 09:22:36 +0000 (17:22 +0800)]
MLK-16522-3 usb: cdns3: do not disable interrupt during role switch

After "MLK-16522-1 usb: cdns3: change cdns3_role_start work flow", the
software maintained role is current role which is doing role_start, so
it should handle its initialization routine well, just like we only has
one role and the interrupt is enabled at that time.

And disable interrupt causes one timeout problem during remove hcd, the
last command takes about 5 seconds to finish. See below for detail:

[   84.894639]  xhci-cdns3: remove, state 1
[   84.898768]  xhci-cdns3: roothub graceful disconnect
[   84.898784] usb usb2: USB disconnect, device number 1
[   84.904052] usb 2-1: USB disconnect, device number 4
[   84.909195] usb 2-1: unregistering device
[   84.909204] usb 2-1: unregistering interface 2-1:1.0
[   84.931247] usb 2-1: usb_disable_device nuking all URBs
[   84.931264]  xhci-cdns3: xhci_drop_endpoint called for udev ffff80083b755000
[   84.931274]  xhci-cdns3: drop ep 0x81, slot id 3, new drop flags = 0x8, new add flags = 0x0
[   84.931278]  xhci-cdns3: xhci_drop_endpoint called for udev ffff80083b755000
[   84.931283]  xhci-cdns3: drop ep 0x2, slot id 3, new drop flags = 0x18, new add flags = 0x0
[   84.931288]  xhci-cdns3: xhci_check_bandwidth called for udev ffff80083b755000
[   84.931302]  xhci-cdns3: New Input Control Context:
[   84.931309]  xhci-cdns3: @ffff000009aa7000 (virt) @d8288000 (dma) 0x000018 - drop flags
[   84.931314]  xhci-cdns3: @ffff000009aa7004 (virt) @d8288004 (dma) 0x000001 - add flags
[   84.931320]  xhci-cdns3: @ffff000009aa7008 (virt) @d8288008 (dma) 0x000000 - rsvd2[0]
[   84.931325]  xhci-cdns3: @ffff000009aa700c (virt) @d828800c (dma) 0x000000 - rsvd2[1]
[   84.931331]  xhci-cdns3: @ffff000009aa7010 (virt) @d8288010 (dma) 0x000000 - rsvd2[2]
[   84.931336]  xhci-cdns3: @ffff000009aa7014 (virt) @d8288014 (dma) 0x000000 - rsvd2[3]
[   84.931341]  xhci-cdns3: @ffff000009aa7018 (virt) @d8288018 (dma) 0x000000 - rsvd2[4]
[   84.931346]  xhci-cdns3: @ffff000009aa701c (virt) @d828801c (dma) 0x000000 - rsvd2[5]
[   84.931350]  xhci-cdns3: Slot Context:
[   84.931355]  xhci-cdns3: @ffff000009aa7020 (virt) @d8288020 (dma) 0x8400000 - dev_info
[   84.931360]  xhci-cdns3: @ffff000009aa7024 (virt) @d8288024 (dma) 0x020000 - dev_info2
[   84.931365]  xhci-cdns3: @ffff000009aa7028 (virt) @d8288028 (dma) 0x000000 - tt_info
[   84.931371]  xhci-cdns3: @ffff000009aa702c (virt) @d828802c (dma) 0x000000 - dev_state
[   84.931377]  xhci-cdns3: @ffff000009aa7030 (virt) @d8288030 (dma) 0x000000 - rsvd[0]
[   84.931382]  xhci-cdns3: @ffff000009aa7034 (virt) @d8288034 (dma) 0x000000 - rsvd[1]
[   84.931387]  xhci-cdns3: @ffff000009aa7038 (virt) @d8288038 (dma) 0x000000 - rsvd[2]
[   84.931392]  xhci-cdns3: @ffff000009aa703c (virt) @d828803c (dma) 0x000000 - rsvd[3]
[   84.931398]  xhci-cdns3: IN Endpoint 00 Context (ep_index 00):
[   84.931403]  xhci-cdns3: @ffff000009aa7040 (virt) @d8288040 (dma) 0x000000 - ep_info
[   84.931408]  xhci-cdns3: @ffff000009aa7044 (virt) @d8288044 (dma) 0x2000026 - ep_info2
[   84.931414]  xhci-cdns3: @ffff000009aa7048 (virt) @d8288048 (dma) 0xd828f001 - deq
[   84.931419]  xhci-cdns3: @ffff000009aa7050 (virt) @d8288050 (dma) 0x000000 - tx_info
[   84.931424]  xhci-cdns3: @ffff000009aa7054 (virt) @d8288054 (dma) 0x000000 - rsvd[0]
[   84.931429]  xhci-cdns3: @ffff000009aa7058 (virt) @d8288058 (dma) 0x000000 - rsvd[1]
[   84.931434]  xhci-cdns3: @ffff000009aa705c (virt) @d828805c (dma) 0x000000 - rsvd[2]
[   84.931447]  xhci-cdns3: // Ding dong!
[   85.096180] FAT-fs (sda1): FAT read failed (blocknr 32)
[   90.134581]  xhci-cdns3: Command timeout
[   90.134590]  xhci-cdns3: Abort command ring
[   92.150582]  xhci-cdns3: No stop event for abort, ring start fail?
[   92.150606]  xhci-cdns3: Timeout while waiting for configure endpoint command
[   92.158310] usb usb2: unregistering device
[   92.158321] usb usb2: unregistering interface 2-0:1.0
[   92.158447]  xhci-cdns3: shutdown urb ffff80083b8f0700 ep1in-intr
[   92.158704] usb usb2: usb_disable_device nuking all URBs
[   92.158715] xHCI xhci_drop_endpoint called for root hub
[   92.158719] xHCI xhci_check_bandwidth called for root hub
[   92.159067]  xhci-cdns3: // Halt the HC
[   92.159075]  xhci-cdns3: // Reset the HC
[   92.159096]  xhci-cdns3: Wait for controller to be ready for doorbell rings
[   92.159102]  xhci-cdns3: USB bus 2 deregistered
[   92.163789]  xhci-cdns3: remove, state 4
[   92.167772]  xhci-cdns3: roothub graceful disconnect
[   92.167786] usb usb1: USB disconnect, device number 1
[   92.172880] usb usb1: unregistering device
[   92.172894] usb usb1: unregistering interface 1-0:1.0
[   92.173151] usb usb1: usb_disable_device nuking all URBs

BuildInfo:
- SCFW 1f59442e, IMX-MKIMAGE fb52c576, ATF
- U-Boot 2017.03-imx_v2017.03+g34be5a2

Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
7 years agoMLK-16522-2 usb: cdns3: host: change remove sequence for hcd
Peter Chen [Thu, 21 Sep 2017 09:08:34 +0000 (17:08 +0800)]
MLK-16522-2 usb: cdns3: host: change remove sequence for hcd

At probe, the main hcd is added first, then shared_hcd is added later,
so when we tries to remove hcds, the shared_hcd needs to remove first.

BuildInfo:
- SCFW 1f59442e, IMX-MKIMAGE fb52c576, ATF
- U-Boot 2017.03-imx_v2017.03+g34be5a2

Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
7 years agoMLK-16522-1 usb: cdns3: change cdns3_role_start work flow
Peter Chen [Thu, 21 Sep 2017 08:58:57 +0000 (16:58 +0800)]
MLK-16522-1 usb: cdns3: change cdns3_role_start work flow

When it goes to start new role, the interrupt may be occurred before
role_start returns, but at this time, the cdns->role is still the old
role, so the interrupt handler will make mistake.

In this commit, we set desired role before role_start, if the role_start
has failed and the desired role is different with current one, it tries
to back current role.

BuildInfo:
- SCFW 1f59442e, IMX-MKIMAGE fb52c576, ATF
- U-Boot 2017.03-imx_v2017.03+g34be5a2

Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
7 years agoMLK-16532 usb: chipidea: do not call WARN_ON if controller is going to suspend twice
Peter Chen [Mon, 25 Sep 2017 09:37:28 +0000 (17:37 +0800)]
MLK-16532 usb: chipidea: do not call WARN_ON if controller is going to suspend twice

At current PM framework, the dev->runtime_suspend may be called after
dev->system_suspend is called, and the dev->runtime_resume may be called
before dev->system_suspend is called. So, we need to delete WARN_ON to
avoid before dump:

[  466.712978] [<ffff200008c49cdc>] ci_hdrc_imx_runtime_suspend+0x2c/0xa8
[  466.719619] [<ffff2000088c29e8>] pm_generic_runtime_suspend+0x48/0x68
[  466.726168] [<ffff2000088d4f04>] genpd_runtime_suspend+0xcc/0x300
[  466.732372] [<ffff2000088c7068>] pm_runtime_force_suspend+0x48/0xa8
[  466.738748] [<ffff2000088d5330>] pm_genpd_suspend_noirq+0xa0/0x118
[  466.745032] [<ffff2000088c86ec>] dpm_run_callback+0x4c/0xc0
[  466.750709] [<ffff2000088c941c>] __device_suspend_noirq+0x194/0x3d0
[  466.757080] [<ffff2000088cb460>] dpm_suspend_noirq+0x188/0x328
[  466.763024] [<ffff200008143218>] suspend_devices_and_enter+0x230/0x650
[  466.769655] [<ffff200008143990>] pm_suspend+0x358/0x3d0
[  466.774984] [<ffff200008141f0c>] state_store+0x8c/0x100
[  466.780321] [<ffff20000857a83c>] kobj_attr_store+0x44/0x60
[  466.785915] [<ffff2000083436a8>] sysfs_kf_write+0x98/0xb0
[  466.791419] [<ffff200008342118>] kernfs_fop_write+0x120/0x288
[  466.797276] [<ffff20000828d518>] __vfs_write+0xc0/0x238
[  466.802604] [<ffff20000828e900>] vfs_write+0xc8/0x248
[  466.807764] [<ffff200008290678>] SyS_write+0xa0/0x110
[  466.812919] [<ffff20000808374c>] __sys_trace_return+0x0/0x4

BuildInfo:
- SCFW 1f59442e, IMX-MKIMAGE fb52c576, ATF
- U-Boot 2017.03-imx_v2017.03+g34be5a2

Cc: Anson Huang <anson.huang@nxp.com>
Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
7 years agoMLK-16469: clk-imx8qxp: Fix GPT clock hierarchy
Adriana Reus [Thu, 14 Sep 2017 11:25:16 +0000 (14:25 +0300)]
MLK-16469: clk-imx8qxp: Fix GPT clock hierarchy

This is a change similar to:

'commit 01fdf7bf572b ("MLK-16281-2: clk-imx8qm: Fix GPT clock hierarchy")'
    There are five gpt modules on imx8qm (gpt0 .. gpt4).
    Of these, gpt2 and gpt4 clock hierarchies are inconsistent
    with the rest.
    Having the per clocks (gpt_hf_clk and gpt_clk) as children of the
    peripheral access clock (ipg_s) and bus sync slave clock
    (ipg_slv_clk)
    ensures that the latter are enabled when the driver enables the
    gpt_clk
    (or hf).
    This patch reconciles these two gpt clock trees with the rest.

    Before:

     gpt_2_div
        gpt_2_hf_clk
        gpt_2_ipg_s_clk
           gpt_2_ipg_slv_clk
              gpt_2_clk

     gpt_4_div
        gpt_4_hf_clk
        gpt_4_clk
        gpt_4_ipg_s_clk
           gpt_4_ipg_slv_clk

    After:

     gpt_2_div
        gpt_2_ipg_s_clk
           gpt_2_ipg_slv_clk
              gpt_2_hf_clk
              gpt_2_clk

     gpt_4_div
        gpt_4_ipg_s_clk
           gpt_4_ipg_slv_clk
              gpt_4_hf_clk
              gpt_4_clk

Apply this change  for imx8qxp also which has the same inconsistency
regarding the gpt clocks.
(BuildInfo: SCFW 9e9f6ec6, IMX-MKIMAGE imx8-mu, ATF 0)

Reviewed-by: Anson Huang <anson.huang@nxp.com>
Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
7 years agoMLK-16527 mmc: cqhci: fix function cqhci_set_irqs()
Haibo Chen [Fri, 22 Sep 2017 07:59:46 +0000 (15:59 +0800)]
MLK-16527 mmc: cqhci: fix function cqhci_set_irqs()

When we want to use some certain cqhci irq, we use the following
function to enable certain irq by pass the value to parameter 'set',

  void cqhci_set_irqs(struct cqhci_host *cq_host, u32 set)

Currently, driver use '|=' to set the ISGE and ISTE. But when we
want to clear all cqhci irq, by send 0 to the parameter 'set',
'|=' operation do not work.

This patch change to directly write the parameter 'set' to register
ISGE and ISTE, to fix this issue.

Without this patch, we may see the following dump massage when
cqhci driver do the recovery procress. For the bit 14 of the usdhc
interrupt status register, it is added for command queuing interrupt.
Currently our USDHC IC has a limitation, just confirm with IC team,
the bit 14 of register INT_STATUS_EN and INT_SIGNAL_EN can not mask
command queueing interrupt, this command queueing interrupt is impacted
by the CQIS. And CQIS can be masked by ISTE and ISGE.

[   35.225286] mmc0: running CQE recovery
[   35.229075] mmc0: Unexpected interrupt 0x00004000.
[   35.233870] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[   35.240315] mmc0: sdhci: Sys addr:  0x00000000 | Version:  0x00000002
[   35.246766] mmc0: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000008
[   35.253215] mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x00000033
[   35.259667] mmc0: sdhci: Present:   0x01fd8009 | Host ctl: 0x00000031
[   35.266117] mmc0: sdhci: Power:     0x00000002 | Blk gap:  0x00000080
[   35.272565] mmc0: sdhci: Wake-up:   0x00000008 | Clock:    0x0000000f
[   35.279013] mmc0: sdhci: Timeout:   0x0000008f | Int stat: 0x00004000
[   35.285466] mmc0: sdhci: Int enab:  0x007f1003 | Sig enab: 0x007f1003
[   35.291915] mmc0: sdhci: AC12 err:  0x00000000 | Slot int: 0x00000502
[   35.298365] mmc0: sdhci: Caps:      0x07eb0000 | Caps_1:   0x8000b407
[   35.304815] mmc0: sdhci: Cmd:       0x00000cd3 | Max curr: 0x00ffffff
[   35.311266] mmc0: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0xffffffff
[   35.317716] mmc0: sdhci: Resp[2]:   0x328f5903 | Resp[3]:  0x00d02700
[   35.324163] mmc0: sdhci: Host ctl2: 0x00000008
[   35.328606] mmc0: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x00000000
[   35.335054] mmc0: sdhci: ============================================

Fixes: 1aa50a573336 ("mmc: cqhci: support for command queue enabled host")
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
7 years agoMLK-16524 drm/bridge: it6263: Fix incorrect colors
Oliver Brown [Thu, 21 Sep 2017 12:39:18 +0000 (07:39 -0500)]
MLK-16524 drm/bridge: it6263: Fix incorrect colors

This addresses a problem with colors that are sometimes incorrect after
startup. Now the AVI packet is initialized with RGB color space rather
than relying on the default.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
7 years agoMLK-16375-3 video: fbdev: dcss: add '__maybe_unused' to 'fill_db'
Fancy Fang [Mon, 25 Sep 2017 14:29:19 +0000 (22:29 +0800)]
MLK-16375-3 video: fbdev: dcss: add '__maybe_unused' to 'fill_db'

The function 'fill_db()' is not used at this moment
which caused gcc compiler generate the build warning:

"‘fill_db’ defined but not used [-Wunused-function]"

So add attribute '__maybe_unused' to 'fill_db()' functon
definition to avoid this build warning.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
7 years agoMLK-16375-2 Revert "MLK-16349 video: fbdev: dcss: reset dcss domains before clock...
Fancy Fang [Thu, 7 Sep 2017 04:28:50 +0000 (12:28 +0800)]
MLK-16375-2 Revert "MLK-16349 video: fbdev: dcss: reset dcss domains before clock source config"

The reverted patch is to workaround a hang issue which is caused
by DCSS reset control bug in 'Block Control' submodule. But this
workaround may cause another issue on some boards. So revert it.

This reverts commit 2d22e932664dc0347dc279a5588834a29aec47ce.

(cherry picked from commit 6f1ae20eb4a12af5179d859890fa32d5042a17cd)

7 years agoMLK-16375-1 Revert "MLK-16255-2 video: fbdev: dcss: use 'db' of ctxld to config DTG"
Fancy Fang [Thu, 7 Sep 2017 04:28:46 +0000 (12:28 +0800)]
MLK-16375-1 Revert "MLK-16255-2 video: fbdev: dcss: use 'db' of ctxld to config DTG"

For A0 soc, on some boards, using double buffer to load
DTG configs may cause ctxld timeout. This may be an IC
bug, so revert this patch to avoid trigger this timeout
isssue.

This reverts commit b9ea3e85d40da5d260b7558a7d3df4ae24db4e8b.

(cherry picked from commit 800911f4befc1ce6bc92e01e2494e61ac69b46e5)

7 years agoMLK-16526-2 thermal: qoriq: add buffer for passive cooling mechanism
Anson Huang [Fri, 22 Sep 2017 04:11:22 +0000 (12:11 +0800)]
MLK-16526-2 thermal: qoriq: add buffer for passive cooling mechanism

On i.MX8MQ, When temperature exceeds passive point,
the cooling mechanism will be trigger and temperature
will begin to drop, to avoid back and forth surrounding
the passive point, here adds 10 C buffer for passive point,
that means when cooling mechanism is trigger, only after
the temperature drop to 10 C below the passive point,
the cooling mechanism will exit.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
7 years agoMLK-16526-1 thermal: imx_sc: add buffer for passive cooling mechanism
Anson Huang [Fri, 22 Sep 2017 04:06:09 +0000 (12:06 +0800)]
MLK-16526-1 thermal: imx_sc: add buffer for passive cooling mechanism

On i.MX8QM/8QXP, When temperature exceeds passive point,
the cooling mechanism will be trigger and temperature
will begin to drop, to avoid back and forth surrounding
the passive point, here adds 10 C buffer for passive point,
that means when cooling mechanism is trigger, only after
the temperature drop to 10 C below the passive point,
the cooling mechanism will exit.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
7 years agommc: block: fix lockdep splat when removing mmc_block module
Michał Mirosław [Tue, 8 Aug 2017 23:48:59 +0000 (01:48 +0200)]
mmc: block: fix lockdep splat when removing mmc_block module

Fix lockdep splat introduced in v4.13-rc4.

[  266.297226] ------------[ cut here ]------------
[  266.300078] WARNING: CPU: 2 PID: 176 at /mnt/src/jaja/git/tf300t/include/linux/blkdev.h:657 mmc_blk_remove_req+0xd0/0xe8 [mmc_block]
[  266.302937] Modules linked in: mmc_block(-) sdhci_tegra sdhci_pltfm sdhci pwrseq_simple pwrseq_emmc mmc_core
[  266.305941] CPU: 2 PID: 176 Comm: rmmod Tainted: G        W       4.13.0-rc4mq-00208-gb691e67724b8-dirty #694
[  266.308852] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[  266.311719] [<b011144c>] (unwind_backtrace) from [<b010ca54>] (show_stack+0x18/0x1c)
[  266.314664] [<b010ca54>] (show_stack) from [<b062e3f4>] (dump_stack+0x84/0x98)
[  266.317644] [<b062e3f4>] (dump_stack) from [<b01214f4>] (__warn+0xf4/0x10c)
[  266.320542] [<b01214f4>] (__warn) from [<b01215d4>] (warn_slowpath_null+0x28/0x30)
[  266.323534] [<b01215d4>] (warn_slowpath_null) from [<af067858>] (mmc_blk_remove_req+0xd0/0xe8 [mmc_block])
[  266.326568] [<af067858>] (mmc_blk_remove_req [mmc_block]) from [<af068f40>] (mmc_blk_remove_parts.constprop.6+0x50/0x64 [mmc_block])
[  266.329678] [<af068f40>] (mmc_blk_remove_parts.constprop.6 [mmc_block]) from [<af0693b8>] (mmc_blk_remove+0x24/0x140 [mmc_block])
[  266.332894] [<af0693b8>] (mmc_blk_remove [mmc_block]) from [<af0052ec>] (mmc_bus_remove+0x20/0x28 [mmc_core])
[  266.336198] [<af0052ec>] (mmc_bus_remove [mmc_core]) from [<b046aa64>] (device_release_driver_internal+0x164/0x200)
[  266.339367] [<b046aa64>] (device_release_driver_internal) from [<b046ab54>] (driver_detach+0x40/0x74)
[  266.342537] [<b046ab54>] (driver_detach) from [<b046982c>] (bus_remove_driver+0x68/0xdc)
[  266.345660] [<b046982c>] (bus_remove_driver) from [<af06ad40>] (mmc_blk_exit+0xc/0x2cc [mmc_block])
[  266.348875] [<af06ad40>] (mmc_blk_exit [mmc_block]) from [<b01aee30>] (SyS_delete_module+0x1c4/0x254)
[  266.352068] [<b01aee30>] (SyS_delete_module) from [<b0108480>] (ret_fast_syscall+0x0/0x34)
[  266.355308] ---[ end trace f68728a0d3053b72 ]---

Fixes: 7c84b8b43d3d ("mmc: block: bypass the queue even if usage is present for hotplug")
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 3f8b23a09a87aa65df3e13129cb2d9cffcb394db)

7 years agoMLK-16523 net: wireless: bcmdhd_1363: fix the stack out of bounds issue reported...
Fugang Duan [Thu, 21 Sep 2017 10:08:04 +0000 (18:08 +0800)]
MLK-16523 net: wireless: bcmdhd_1363: fix the stack out of bounds issue reported by KASAN

Enable KASAN kernel config, KASAN report bug on bcmdhd_1363 wifi driver:

BUG: KASAN: stack-out-of-bounds in dhd_attach+0xe68/0x14e0 at addr ffff8000a01d74c7
Call trace:
dump_backtrace+0x0/0x2c0
show_stack+0x14/0x20
dump_stack+0xa4/0xc8
kasan_report_error+0x4c4/0x4d8
kasan_report+0x40/0x48
__asan_load1+0x4c/0x58
dhd_attach+0xe68/0x14e0
dhdpcie_bus_attach+0x248/0x4b0

Tested on i.MX8MQ EVK RevA1 with Murata 1CX module installed.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reported-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
7 years agoMLK-16495 ARM64: dts: freescale: imx8qm: add mek board support
Anson Huang [Thu, 21 Sep 2017 02:37:35 +0000 (10:37 +0800)]
MLK-16495 ARM64: dts: freescale: imx8qm: add mek board support

Add i.MX8QM MEK board support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
7 years agoMLK-16359-3: Added i.MX8 CAST IP JPEG Encoder/Decoder Linux V4L2 driver v2
Zhengyu Shen [Mon, 18 Sep 2017 19:34:52 +0000 (14:34 -0500)]
MLK-16359-3: Added i.MX8 CAST IP JPEG Encoder/Decoder Linux V4L2 driver v2

mxc-jpeg driver creates two v4l2 file handles in /dev/ which allows them to be used
by v4l2 programs. Supports encode and decode of various formats.

Note: Output data is not correct but matches validation result because IP Bug
TKT340836

v2: Split patches, added copyright

Signed-off-by: Zhengyu Shen <zhengyu.shen_1@nxp.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
7 years agoMLK-16359-2: Change clock power domain for JPEG Encoder/Decoder to match DTS
Zhengyu Shen [Mon, 18 Sep 2017 19:32:40 +0000 (14:32 -0500)]
MLK-16359-2: Change clock power domain for JPEG Encoder/Decoder to match DTS

Clocks use power domains from DTS.

Signed-off-by: Zhengyu Shen <zhengyu.shen_1@nxp.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
7 years agoMLK-16359-1: Added i.MX8 CAST IP JPEG Encoder/Decoder Linux to DTS
Zhengyu Shen [Mon, 18 Sep 2017 19:30:35 +0000 (14:30 -0500)]
MLK-16359-1: Added i.MX8 CAST IP JPEG Encoder/Decoder Linux to DTS

Adds device tree files for JPEG decoder and encoder to device tree.

Signed-off-by: Zhengyu Shen <zhengyu.shen_1@nxp.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
7 years agoMLK-16285-6 usb: cdns3: add more operatons at cdns3_remove
Peter Chen [Mon, 18 Sep 2017 06:08:57 +0000 (14:08 +0800)]
MLK-16285-6 usb: cdns3: add more operatons at cdns3_remove

Add PHY shutdown and clock disable operations at cdns3_remove.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
7 years agoMLK-16285-5 extcon: extcon-ptn5110: only sends EXTCON_USB_HOST event
Peter Chen [Mon, 18 Sep 2017 03:07:09 +0000 (11:07 +0800)]
MLK-16285-5 extcon: extcon-ptn5110: only sends EXTCON_USB_HOST event

Since Type-C port only has two data roles, we just need use
one event to stand for USB host and USB device.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
7 years agoMLK-16285-4 usb: cdns3: change controller role state machine
Peter Chen [Mon, 18 Sep 2017 02:51:00 +0000 (10:51 +0800)]
MLK-16285-4 usb: cdns3: change controller role state machine

Since the USB Type-C port only has two data roles, host and device,
the controller driver can only receive above two events, it can't
remain 'disconnection' state alone at controller driver due to there
is no such event from Type-C.

Due to above, we delete the controller state "CDNS3_ROLE_END" which
stands for 'disconnection' state before. Instead, when we use
"CDNS3_ROLE_GADGET" stands for it, and this state is the default
state for controller.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
7 years agoMLK-16285-3 usb: cdns3: core: move INIT_WORK before cdns3_register_extcon
Peter Chen [Fri, 15 Sep 2017 03:13:17 +0000 (11:13 +0800)]
MLK-16285-3 usb: cdns3: core: move INIT_WORK before cdns3_register_extcon

At the extcon notifier, it will queue a work item, so we need to
make sure the work is initialized before it is used.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
7 years agoMLK-16285-2 staging: typec: tcpci: add optional reset pin support
Peter Chen [Fri, 15 Sep 2017 02:48:19 +0000 (10:48 +0800)]
MLK-16285-2 staging: typec: tcpci: add optional reset pin support

Some USB3 differential channel switch chips need to do reset before
functional, we add this support here.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
7 years agoMLK-16285-1 staging: typec: tcpci: move request interrupt to the end of probe
Peter Chen [Fri, 15 Sep 2017 02:05:21 +0000 (10:05 +0800)]
MLK-16285-1 staging: typec: tcpci: move request interrupt to the end of probe

The tcpci_irq may visit tcpci->port if unexpected interrupt occurs
(eg, board design issue causes GPIO status is incorrect) and cause
NULL pointer dereference issue.

Besides, delete clear TCPC_ALERT and TCPC_ALERT_MASK code which are
already done at tcpci_init.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
7 years agoMLK-16482: dma: fsl-edma-v3: Fix RCU issue while playing Audio
Robin Gong [Tue, 19 Sep 2017 03:36:58 +0000 (11:36 +0800)]
MLK-16482: dma: fsl-edma-v3: Fix RCU issue while playing Audio

That's caused by commit 593034f1b908 ("MLK-16437: dma: fsl-edma-v3:
fix kernel crash while edma interrupt trigger after channel disabled").
Because fsl_chan->vchan.lock will be hold always and trigger RCU report
as below:

1571.3  Playing WAVE '/mnt/nfs/vte_mx82/../test_stream/esai_stream/48k16bit-six.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Channels 6
1571.5  [ 4642.698771] INFO: rcu_preempt detected stalls on CPUs/tasks:
1571.6  [ 4642.704443] 0-...: (1 GPs behind) idle=2c5/140000000000000/0 softirq=155373/155374 fqs=2541
1571.7  [ 4642.712967] (detected by 2, t=5252 jiffies, g=104259, c=104258, q=22)
1571.8  [ 4642.719501] Task dump for CPU 0:
1571.9  [ 4642.722724] aplay R running task 0 15723 15721 0x00000202
1571.10  [ 4642.729786] Call trace:
1571.11  [ 4642.732239] [<ffff0000080855e4>] __switch_to+0x8c/0xa0
1571.12  [ 4642.737379] [<ffff0000084e3a48>] dma_chan_put+0x70/0xa0
1571.13  [ 4642.742603] [<ffff0000084e3aac>] dma_release_channel+0x34/0xa0
1571.14  [ 4642.748435] [<ffff000008972240>] fsl_asrc_dma_hw_free+0x38/0x50
1571.15  [ 4642.754358] [<ffff000008960568>] soc_pcm_hw_free+0x110/0x1a8
1571.16  [ 4642.760013] [<ffff000008963bcc>] dpcm_fe_dai_hw_free+0x6c/0xe0
1571.17  [ 4642.765844] [<ffff000008948ae8>] snd_pcm_common_ioctl1+0xb40/0xce0
1571.18  [ 4642.772028] [<ffff000008948e64>] snd_pcm_playback_ioctl1+0x1dc/0x310
1571.19  [ 4642.778378] [<ffff000008948fc0>] snd_pcm_playback_ioctl+0x28/0x40
1571.20  [ 4642.784470] [<ffff0000081ee0a4>] do_vfs_ioctl+0xa4/0x748
1571.21  [ 4642.789784] [<ffff0000081ee7d4>] SyS_ioctl+0x8c/0xa0
1571.22  [ 4642.794745] [<ffff000008082f4c>] __sys_trace_return+0x0/0x4
1571.23  [ 4705.718740] INFO: rcu_preempt detected stalls on CPUs/tasks:
1571.24  [ 4705.724420] 0-...: (1 GPs behind) idle=2c5/140000000000000/0 softirq=155373/155374 fqs=10407
1571.25  [ 4705.733030] (detected by 1, t=21010 jiffies, g=104259, c=104258, q=119)

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reported-by: Jason Liu <jason.hui.liu@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Fixes: 593034f1b908 ("MLK-16437: dma: fsl-edma-v3: fix kernel crash
while edma interrupt trigger after channel disabled").

7 years agoMLK-16484 dts: imx8qxp: add pcie disable pin
Fugang Duan [Tue, 19 Sep 2017 04:05:33 +0000 (12:05 +0800)]
MLK-16484 dts: imx8qxp: add pcie disable pin

Since i.MX8QXP MEK board PCIe has disable pin that is reseverd for future
use, we should add the disable pin.

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16485 PCI: imx6: Defer probing if .of_get_named_gpio() returns -EPROBE_DEFER
Fugang Duan [Tue, 19 Sep 2017 04:09:01 +0000 (12:09 +0800)]
MLK-16485 PCI: imx6: Defer probing if .of_get_named_gpio() returns -EPROBE_DEFER

Driver should do defer probing if .of_get_named_gpio() returns -EPROBE_DEFER.
And moving epdev_on regulator to be common for all platforms.

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16483 ARM64: dts: imx8mq-evk-pcie1-m2: add pcie1 M.2 interface support
Fugang Duan [Fri, 15 Sep 2017 11:10:13 +0000 (19:10 +0800)]
MLK-16483 ARM64: dts: imx8mq-evk-pcie1-m2: add pcie1 M.2 interface support

Add pcie1 M.2 interface support.

Tested with Murata 1CQ bt-wifi old EVB card, we still don't get
new EVB card. To disable usdhc2 port that old MEK board use SD2_nRST
as wifi wlreg_on.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16475-02 arm64: dts: imx8qm/qxp: pull up uart pins in default
Fugang Duan [Wed, 23 Aug 2017 07:00:52 +0000 (15:00 +0800)]
MLK-16475-02 arm64: dts: imx8qm/qxp: pull up uart pins in default

Pull up uart pins in default.

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16475-01 ARM64: dts: imx8mq-evk: pull up uart pins in default
Fugang Duan [Wed, 23 Aug 2017 06:46:16 +0000 (14:46 +0800)]
MLK-16475-01 ARM64: dts: imx8mq-evk: pull up uart pins in default

Pull up uart pins in default.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16357 tty: serial: lpuart: avoid report NULL interrupt
Fugang Duan [Fri, 15 Sep 2017 10:50:43 +0000 (18:50 +0800)]
MLK-16357 tty: serial: lpuart: avoid report NULL interrupt

The current driver register irq in .startup() and free the irq in
.shutdown(), then user will see the NULL interrupt output from
'cat /proc/interrupts' after the uart port test completed:
...
 41:        515          0          0          0     GICv3 257 Level     fsl-lpuart
 42:          2          0          0          0     GICv3 258 Level
...

It is better to register all the irqs during probe function via devm_request_irq()
to avoid to call free_irq().

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16474 net: fec: fixup: remove the unnecessary variable
Fugang Duan [Tue, 12 Sep 2017 03:20:22 +0000 (11:20 +0800)]
MLK-16474 net: fec: fixup: remove the unnecessary variable

Remove the unnecessary variable.

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16473 irqchip: imx-irqsteer: change irqsteer type to level
Seb Laveze [Wed, 23 Aug 2017 08:55:00 +0000 (10:55 +0200)]
MLK-16473 irqchip: imx-irqsteer: change irqsteer type to level

Irqsteer block only supports level interrupts.

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Seb Laveze <sebastien.laveze@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16472-02: ARM64: defconfig: add ath10k wireless driver support
Fugang Duan [Fri, 15 Sep 2017 09:36:21 +0000 (17:36 +0800)]
MLK-16472-02: ARM64: defconfig: add ath10k wireless driver support

Add ath10k wireless driver support.

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16472-01 arm64: dts: imx8qxp: enable Murata 1CQ wifi for MEK board
Fugang Duan [Mon, 14 Aug 2017 13:45:54 +0000 (21:45 +0800)]
MLK-16472-01 arm64: dts: imx8qxp: enable Murata 1CQ wifi for MEK board

Add Murata 1CQ wifi enable for MEK board.

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16471-02 arm64: dts: imx8qm/imx8qxp: remove ptp clock from assigned-clocks
Fugang Duan [Fri, 15 Sep 2017 07:37:22 +0000 (15:37 +0800)]
MLK-16471-02 arm64: dts: imx8qm/imx8qxp: remove ptp clock from assigned-clocks

Since IMX8QXP_ENET0_ROOT_DIV clock is included in assigned-clocks list,
and who is the parent of IMX8QXP_ENET0_PTP_CLK (ptp clock), so remove
ptp clock from assigned-clocks list.

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16471-01 clk: imx8qm/imx8qxp: fix ptp clock parent
Fugang Duan [Fri, 15 Sep 2017 07:20:51 +0000 (15:20 +0800)]
MLK-16471-01 clk: imx8qm/imx8qxp: fix ptp clock parent

Connectivity sbsystem ADD documention Figure 7-2 clock connection
of ENET-AVB has wrong clock connection for ipg_clk_time:
ENETn_CLK_ROOT -> LPCG -> CLKDIV -> ipg_clk_time

Confirm with IC and integration owner, in fact the timer clock path is:
ENETn_CLK_ROOT -> LPCG -> ipg_clk_time

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16479 mmc: fix potential dead lock when get mmc host index
Haibo Chen [Mon, 18 Sep 2017 08:55:52 +0000 (16:55 +0800)]
MLK-16479 mmc: fix potential dead lock when get mmc host index

When open some kernel debug options including LOCKDEP, hot plug sd
will meet the following dump message:

[  883.769343] BUG: sleeping function called from invalid context at /home/b29397/work/projects/linux-imx/kernel/locki
ng/mutex.c:620
[  883.781212] in_atomic(): 1, irqs_disabled(): 0, pid: 1497, name: kworker/0:2
[  883.788307] 4 locks held by kworker/0:2/1497:
[  883.792697]  #0:  ("events_freezable"){.+.+.+}, at: [<ffff2000080db228>] process_one_work+0x120/0x3b8
[  883.802021]  #1:  ((&(&host->detect)->work)){+.+.+.}, at: [<ffff2000080db228>] process_one_work+0x120/0x3b8
[  883.811854]  #2:  (&dev->mutex){......}, at: [<ffff200008630b3c>] __device_attach+0x28/0x154
[  883.820388]  #3:  (mmc_blk_lock){+.+...}, at: [<ffff200008962414>] mmc_blk_alloc_req+0x60/0x3f8
[  883.829181] CPU: 0 PID: 1497 Comm: kworker/0:2 Not tainted 4.9.11-03102-gd9ab0a1-dirty #523
[  883.837542] Hardware name: Freescale i.MX8QXP MEK (DT)
[  883.842692] Workqueue: events_freezable mmc_rescan
[  883.847490] Call trace:
[  883.849945] [<ffff200008089234>] dump_backtrace+0x0/0x1e0
[  883.855354] [<ffff200008089428>] show_stack+0x14/0x1c
[  883.860413] [<ffff2000084046f4>] dump_stack+0xb0/0xec
[  883.865468] [<ffff2000080e8540>] ___might_sleep+0x144/0x1e4
[  883.871044] [<ffff2000080e8634>] __might_sleep+0x54/0x88
[  883.876364] [<ffff200008bfc99c>] mutex_lock_nested+0x3c/0x3cc
[  883.882113] [<ffff2000089cd164>] of_alias_get_id+0x34/0x98
[  883.887602] [<ffff20000895258c>] mmc_get_reserved_index+0x1c/0x24
[  883.893702] [<ffff20000896241c>] mmc_blk_alloc_req+0x68/0x3f8
[  883.899450] [<ffff2000089640d0>] mmc_blk_probe+0x74/0x2c0
[  883.904856] [<ffff2000089553b4>] mmc_bus_probe+0x1c/0x24
[  883.910174] [<ffff200008630fe4>] driver_probe_device+0x27c/0x418
[  883.916182] [<ffff200008631360>] __device_attach_driver+0x98/0x130
[  883.922370] [<ffff20000862ed48>] bus_for_each_drv+0x54/0x94
[  883.927947] [<ffff200008630bdc>] __device_attach+0xc8/0x154
[  883.933525] [<ffff200008631540>] device_initial_probe+0x10/0x18
[  883.939450] [<ffff20000862ff98>] bus_probe_device+0x94/0x9c
[  883.945026] [<ffff20000862dd08>] device_add+0x40c/0x58c
[  883.950257] [<ffff20000895589c>] mmc_add_card+0xf0/0x2a4
[  883.955576] [<ffff20000895bb78>] mmc_attach_sd+0x94/0x138
[  883.960975] [<ffff200008955070>] mmc_rescan+0x2d8/0x350
[  883.966208] [<ffff2000080db294>] process_one_work+0x18c/0x3b8
[  883.971959] [<ffff2000080db518>] worker_thread+0x58/0x440
[  883.977362] [<ffff2000080e1f48>] kthread+0xe0/0xf4
[  883.982157] [<ffff200008083680>] ret_from_fork+0x10/0x50

This is caused by commit 6e9e049fac59 ("mmc: Allow setting slot index via
devicetree alias"). Function mmc_get_reserved_index(), ida_simple_get() and
mmc_get_reserved_index() do not need addtional lock protect, these function
already contain the mutex_lock() inside. Only ida_get_new_above() need
required lock. spin_lock() nested with mutex_lock() or spin_lock() may cause
dead lock.
This patch fix the potential dead lock.

Fixes: 6e9e049fac59 ("mmc: Allow setting slot index via devicetree alias")
Reported-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
7 years agoMLK-16468-2: ASoC: fsl_hifi4: add multi-codec support for hifi4
Weiguang Kong [Thu, 14 Sep 2017 05:32:20 +0000 (13:32 +0800)]
MLK-16468-2: ASoC: fsl_hifi4: add multi-codec support for hifi4

The previous hifi4 driver and framework code can't support
multi-codec decoding or encoding together, so change the driver
code to support this feature.
Currently, the hifi4 driver and framework can support at most
5 codec working together.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
Reviewed-by: Mihai Serban <mihai.serban@nxp.com>
7 years agoMLK-16468-1: include: uapi: add multi-codec support for hifi4
Weiguang Kong [Thu, 14 Sep 2017 05:31:22 +0000 (13:31 +0800)]
MLK-16468-1: include: uapi: add multi-codec support for hifi4

update the mxc_hifi4.h header file to support multi-codec
decoding or encoding together for hifi4 dsp.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
Reviewed-by: Mihai Serban <mihai.serban@nxp.com>
7 years agoMLK-16477 cpufreq: imx8: switch cpufreq governor to schedutil for multi-cluster
Anson Huang [Mon, 18 Sep 2017 04:41:40 +0000 (12:41 +0800)]
MLK-16477 cpufreq: imx8: switch cpufreq governor to schedutil for multi-cluster

For multi-cluster platforms like i.MX8QM, the best cpufreq
governor is schedutil, as common cpufreq framework decides
default cpufreq governor in static compile, so this patch
adds dynamic switch of cpufreq governor according to cluster
number, changing it via sysfs interface, although it is
ugly, but it realizes dynamic cpufreq governor select for
users.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
7 years agoMLK-16461-2 ARM64: dts: fsl-imx8mq.dtsi: set property fsl,strobe-dll-delay-target
Haibo Chen [Fri, 15 Sep 2017 12:07:22 +0000 (20:07 +0800)]
MLK-16461-2 ARM64: dts: fsl-imx8mq.dtsi: set property fsl,strobe-dll-delay-target

On some i.MX8MQ-EVK A0/A1 board, we may meet eMMC read data CRC error in
HS400 mode. This is because the delay cell set for the strobe pad
is not correct. Before this patch, usdhc driver default set this delay
cell to value 7, but for some board, only value 3~6 can pass read
operation in HS400 mode, some board, the pass value is 2~10, and
some board, the pass value is 3~8. So the default value 7 can't
make sure all the board can pass eMMC read in HS400.

This patch set the value 5 to fsl,strobe-dll-delay-target, make sure
all the board can work stable in HS400 mode.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
7 years agoMLK-16461-1 mmc: sdhci-esdhc-imx: add strobe-dll-delay-target support
Haibo Chen [Fri, 15 Sep 2017 11:48:14 +0000 (19:48 +0800)]
MLK-16461-1 mmc: sdhci-esdhc-imx: add strobe-dll-delay-target support

strobe-dll-delay-target is the delay cell add on the strobe line.
Strobe line the the uSDHC loopback read clock which is use in HS400
mode. Different strobe-dll-delay-target may need to set for different
board/SoC. If this delay cell is not set to an appropriate value,
we may see some read operation meet CRC error after HS400 mode select
which already pass the tuning.

This patch add the strobe-dll-delay-target setting in driver, so that
user can easily config this delay cell in dts file.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
7 years agoMLK-14409-02 ARM: dts: imx: Add 900MHz setpoint on i.mx6ull
Bai Ping [Fri, 10 Mar 2017 06:58:51 +0000 (14:58 +0800)]
MLK-14409-02 ARM: dts: imx: Add 900MHz setpoint on i.mx6ull

Add 900MHz/1.25V setpoint according the latest datasheet(Rev.1,2/2017),
we add a 25mV voltage margin to cover the IR frop and board tolerance.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
7 years agoMLK-14409-01 ARM: imx: Add speed grading fuse check for 900MHz on i.mx6ull
Bai Ping [Fri, 10 Mar 2017 06:54:01 +0000 (14:54 +0800)]
MLK-14409-01 ARM: imx: Add speed grading fuse check for 900MHz on i.mx6ull

According to the latest datasheet(Rev.1,02/2017), when the internal LDO
is enabled, the ARM core can run at 900MHz. We need to check the
speed grading fuse to determine the max ARM core frequency.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
7 years agoMLK-14747 driver: cpufreq: Correct dc regulator voltage on imx6ull
Bai Ping [Mon, 24 Apr 2017 10:45:17 +0000 (18:45 +0800)]
MLK-14747 driver: cpufreq: Correct dc regulator voltage on imx6ull

On i.MX6ULL EVK board, when the overdrive mode(900MHz/800MHz) is
enable, the DC regulator voltage should not be changed. Keep the
DC regulator to default 1.4V.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
(cherry picked from commit e4b51b651ae95226c0ae0447673c64b23b079ee6)

Conflicts:
drivers/cpufreq/imx6q-cpufreq.c

7 years agoMLK-16470 thermal: imx_thermal: fix wrong thermal grade register read for MX7D
Dong Aisheng [Wed, 13 Sep 2017 14:23:21 +0000 (22:23 +0800)]
MLK-16470 thermal: imx_thermal: fix wrong thermal grade register read for MX7D

From MX7D Fuse Map v2.9, the thermal grade register is 0x440[7:6],
not 0x480[7:6] as before.

Fixes: 2045abb4391a ("MLK-11518-01 thermal: imx: add thermal support for imx7")
Reviewed-by: Bai Ping <ping.bai@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
7 years agoMLK-16437: dma: fsl-edma-v3: fix kernel crash while edma interrupt trigger after...
Robin Gong [Wed, 13 Sep 2017 08:39:49 +0000 (16:39 +0800)]
MLK-16437: dma: fsl-edma-v3: fix kernel crash while edma interrupt trigger after channel disabled

edma interrupt may come after channel terminated, so should ignore
interrupts, else kernel crash as below since fsl_chan->edesc set
to NULL when terminate.

 606.837306] Unable to handle kernel NULL pointer dereference at virtual address 00000060
[  606.845411] pgd = ffff000009295000
[  606.848814] [00000060] *pgd=00000008bfffe003[  606.852906] , *pud=00000008bfffd003
 , *pmd=0000000000000000[  606.858395]
[  606.859885] Internal error: Oops: 96000006 1 PREEMPT SMP
[  606.865460] Modules linked in:
[  606.868522] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.11-03371-g9904ea0 #42
[  606.875832] Hardware name: Freescale i.MX8QXP LPDDR4 ARM2 (DT)
[  606.881662] task: ffff000009120680 task.stack: ffff000009110000
[  606.887588] PC is at fsl_edma3_tx_handler+0x50/0x150

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Tested-by: Daniel Baluta <daniel.baluta@nxp.com>
7 years agoMLK-16450-2: ASoC: fsl_hifi4: free unused memory when closing device
Weiguang Kong [Wed, 13 Sep 2017 11:11:02 +0000 (19:11 +0800)]
MLK-16450-2: ASoC: fsl_hifi4: free unused memory when closing device

free unused memory which is allocated in fsl_hifi4_open() function
when closing the hifi4 device.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
7 years agoMLK-16450-1: ASoC: fsl_hifi4: fix crash issue caused by memcpy()
Weiguang Kong [Wed, 13 Sep 2017 07:24:38 +0000 (15:24 +0800)]
MLK-16450-1: ASoC: fsl_hifi4: fix crash issue caused by memcpy()

When loop testing the hifi4 dirver, a random crash issue always
occur when doing memcpy() in decode function.
Have found that memcpy() is not suited to transfer data between
kernel space and user space, so use copy_from_user() and copy_
to_user() function to replace memcpy() to fix this issue.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
7 years agoMLK-16218 tty: serial: fsl_lpuart: use the sg count from dma_map_sg
Peng Fan [Wed, 13 Sep 2017 05:24:27 +0000 (13:24 +0800)]
MLK-16218 tty: serial: fsl_lpuart: use the sg count from dma_map_sg

The dmaengine_prep_slave_sg needs to use sg count returned
by dma_map_sg, not use sport->dma_tx_nents, because the return
value of dma_map_sg is not always same with "nents".

When enabling iommu for lpuart + edma, iommu framework may concatenate
two sgs into one.

Fixes: 6250cc30c4c4e ("tty: serial: fsl_lpuart: Use scatter/gather DMA for Tx")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16416-2 soc:imx Add support to save/restore clock parents
Viorel Suman [Mon, 11 Sep 2017 10:55:10 +0000 (13:55 +0300)]
MLK-16416-2 soc:imx Add support to save/restore clock parents

In iMX8QM/iMX8QXP the clock parent set in HW is lost when devices are
powered up/down as part of runtime-pm or suspend/resume.
Add support to the power domain driver to save/restore clock parents
associated with devices as part of power up/down.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>
7 years agoMLK-16416-1 clk: imx: scu mux: refactor set/get_parent method
Viorel Suman [Thu, 7 Sep 2017 08:54:33 +0000 (11:54 +0300)]
MLK-16416-1 clk: imx: scu mux: refactor set/get_parent method

The current clk_mux_set_parent_scu() implementation returns error
if device power domain is not enabled. As consequence of this the
existing "assigned-clock-parents" DTS functionality cannot be used for
clk_mux. In order to avoid returning error in "set_parent" the code is
refactored as follows:

a) On "set_parent" the "mux->reg" value is prepared and stored in
   "mux->val" field. The "mux->reg" is updated if power domain is enabled,
   or triggered for update on "prepare" subsequent call otherwise.

b) On "prepare" the power domain status check is performed and "mux->val"
   is stored in "mux->reg" if triggered for update.

c) On "get_parent" the "mux->reg" is not read anymore and "mux->val" is
   used to get the "get_parent" output.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>
7 years agoMGS-3177-4 [#imx-701] fix the suspend/resume hang issue on imx6
Yuchou Gan [Mon, 11 Sep 2017 14:18:57 +0000 (22:18 +0800)]
MGS-3177-4 [#imx-701] fix the suspend/resume hang issue on imx6

The imx6q/6qp board have VG core,so that device->kernels[i]->hardware pointer of the VG core will be NULL,
which cause invalid access to device->kernels[i]->hardware->forcePowerOff. This will lead to hang on suspend/resume test.

Date: Sep 07, 2017
Signed-off-by: Yuchou Gan<yuchou.gan@nxp.com>
7 years agoMLK-16430 : [i.MX8MQ/Hantro]: Add support to handle interrupt timeout
Zhou Peng-B04994 [Mon, 11 Sep 2017 03:54:58 +0000 (11:54 +0800)]
MLK-16430 : [i.MX8MQ/Hantro]: Add support to handle interrupt timeout

Add support to handle interrupt timeout.
decoder won't be blocked and will report timeout event to application
when no any interrupts are triggered.

Signed-off-by: Zhou Peng-B04994 <eagle.zhou@nxp.com>
7 years agoMLK-16371-2 rpmsg: imx: add the rpmsg for imx8qxp
Richard Zhu [Tue, 18 Jul 2017 08:37:38 +0000 (16:37 +0800)]
MLK-16371-2 rpmsg: imx: add the rpmsg for imx8qxp

Add rpmsg support for imx8qxp.
The pingpong demo had been verified on 8qxp platforms.
Use memset_io replace memset, because that
the memory type of rpvq->addr is strong order type.
There would be kernel dump when memset is used
on imx8qxp.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16371-1 arm64: dts: imx8qxp: add the rpmsg support
Richard Zhu [Tue, 18 Jul 2017 08:35:54 +0000 (16:35 +0800)]
MLK-16371-1 arm64: dts: imx8qxp: add the rpmsg support

add the rpmsg support for imx8qxp.
Based on intmux, the int31 of mu0_a0 of m4 side is
used by rpmsg.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
7 years agoMLK-16415 thermal: imx_sc: add device cooling for all thermal zones
Anson Huang [Fri, 8 Sep 2017 08:04:25 +0000 (16:04 +0800)]
MLK-16415 thermal: imx_sc: add device cooling for all thermal zones

For system controller thermal devices, add device
cooling for all thermal zones, when temperature
exceeds passive trip point, thermal driver will
send out notification, all devices that register
device cooling notification can take actions to
cooling down the chip, such as for GPU, below message
will be printed out:

[  581.284453] System is too hot. GPU3D will work at 1/64 clock.

And when temperature drops to below passive trip
point, GPU cooling action will be cancelled:

[  578.300532] Hot alarm is canceled. GPU3D clock will return to 64/64

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
7 years agoMLK-16414 drm: Kbuild: add imx_drm.h to the installed headers
Meng Mingming [Fri, 8 Sep 2017 07:54:39 +0000 (15:54 +0800)]
MLK-16414 drm: Kbuild: add imx_drm.h to the installed headers

Add imx_drm.h to the installed headers.

Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
7 years agoMLK-16358-2: ARM: imx8mq: enable ddr perf monitor
Frank Li [Fri, 1 Sep 2017 18:09:16 +0000 (13:09 -0500)]
MLK-16358-2: ARM: imx8mq: enable ddr perf monitor

Enable DDR perf monitor support

Signed-off-by: Frank Li <Frank.Li@nxp.com>
7 years agoMLK-16358-1: ARM: FSL: DTS: enable arm pmu for A53
Frank Li [Fri, 1 Sep 2017 18:06:48 +0000 (13:06 -0500)]
MLK-16358-1: ARM: FSL: DTS: enable arm pmu for A53

Enable A53 PMU for imx8

Signed-off-by: Frank Li <Frank.Li@nxp.com>
7 years agoMLK-16374-4: PxP: add AS and PS engine colorkey support
Guoniu.Zhou [Thu, 7 Sep 2017 02:04:14 +0000 (10:04 +0800)]
MLK-16374-4: PxP: add AS and PS engine colorkey support

Enable PS and AS colorkey function if user enable and
set colorkey parameters of s0 and overlay buffer.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit f2ed3bfca174b3e370fc37cd5f75a67334822093)

7 years agoMLK-16374-3: PxP: improve stride parameter setting compatible
Guoniu.Zhou [Wed, 6 Sep 2017 06:23:13 +0000 (14:23 +0800)]
MLK-16374-3: PxP: improve stride parameter setting compatible

In pxp lib, the unit of stride parameter is pixel and stride
is not equal with width parameter of out buffer in some cases.

In order to use latest pxp lib in old version rootfs, PXP_DEVICE_LEGACY
macro is used to distinguish pxp drvier version. Because the
new pxp driver define a new variable and pxp lib can know this
through PXP_DEVICE_LEGACY, and determine if use it.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 91da74e81cfdd2774b39a7574edf93de3f2a3f25)

7 years agoMLK-16374-2: PxP: add new format support for as and out buffer
Guoniu.Zhou [Tue, 5 Sep 2017 09:58:02 +0000 (17:58 +0800)]
MLK-16374-2: PxP: add new format support for as and out buffer

1) add PXP_PIX_FMT_BGRA32 format support for AS buffer
2) add PXP_PIX_FMT_BGRA32 format support for OUT buffer

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 4eeefd54cdbb8d1d3ffd64bd444ea7b759101a35)

7 years agoMLK-16374-1: PxP: add alpha blending back compatible
Guoniu.Zhou [Mon, 4 Sep 2017 08:42:41 +0000 (16:42 +0800)]
MLK-16374-1: PxP: add alpha blending back compatible

In support of both g2d and pxp lib alpha blending, there
must be two alpha blending versions. So there is one rule
that user should obey for different usage cases.

  1) g2d alpha blending: user should set combine_enable
      member of struct pxp_proc_data.
  2) pxp lib alpha blending: user should set combine_enable
     member of struct pxp_layer_param if the pxp_layer_param
     describe overlay buffer parameters.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 7c62393a556d043f88dd188edac3c0d250039358)

7 years agoMLK-16270 ARM64: defconfig: add usb host audio support
Li Jun [Thu, 7 Sep 2017 10:51:52 +0000 (18:51 +0800)]
MLK-16270 ARM64: defconfig: add usb host audio support

Build usb host audio as module.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
7 years agoMLK-16354-2 ARM64: dts: imx8qm: add usdhc support for IOMMU
Haibo Chen [Fri, 1 Sep 2017 09:35:24 +0000 (17:35 +0800)]
MLK-16354-2 ARM64: dts: imx8qm: add usdhc support for IOMMU

add usdhc1/usdhc2/usdhc3 support for IOMMU

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
7 years agoMLK-16354-1 mmc: sdhci: add usdhc support for IOMMU
Haibo Chen [Fri, 1 Sep 2017 09:05:26 +0000 (17:05 +0800)]
MLK-16354-1 mmc: sdhci: add usdhc support for IOMMU

The default max segment size of IOMMU is 64KB, which exceed the ADMA
limitation. ADMA only support max to 65535, 64KB - 1Byte. IOMMU will
optimize the segments it received, merge the little segment into one
big segment. If we use the default IOMMU config, then ADMA will get
some segments which it's size is 64KB. Then ADMA error will shows up.

Currently, when use standard tuning, driver default disable DMA. But
on i.MX usdhc, this is not enough. Need also clear DMA_SEL. If not,
once the DMA_SEL select AMDA2, even dma already disabled, when send
tuning command, usdhc will still prefetch the ADMA script from wrong
DMA address, then we will see IOMMU report some error which show
lack of TLB mapping.

This patch fix these two issue, make sure usdhc can work well by
operate data through IOMMU.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
7 years agommc: block: bypass the queue even if usage is present for hotplug
Shawn Lin [Tue, 25 Jul 2017 01:11:28 +0000 (09:11 +0800)]
mmc: block: bypass the queue even if usage is present for hotplug

The commit 304419d8a7e9 ("mmc: core: Allocate per-request data using the
block layer core") refactored mechanism of queue handling caused
mmc_init_request() can be called just after mmc_cleanup_queue() caused null
pointer dereference.

Another commit bbdc74dc19e0 ("mmc: block: Prevent new req entering queue
after its cleanup") tried to fix the problem. However it actually miss one
corner case.

We could still reproduce the issue mentioned with these steps:
(1) insert a SD card and mount it
(2) hotplug it, so it will leave md->usage still be counted
(3) reboot the system which will sync data and umount the card

[Unable to handle kernel NULL pointer dereference at virtual address
00000000
[user pgtable: 4k pages, 48-bit VAs, pgd = ffff80007bab3000
[[0000000000000000] *pgd=000000007a828003, *pud=0000000078dce003,
*pmd=000000007aab6003, *pte=0000000000000000
[Internal error: Oops: 96000007 [#1] PREEMPT SMP
[Modules linked in:
[CPU: 3 PID: 3507 Comm: umount Tainted: G        W
4.13.0-rc1-next-20170720-00012-g9d9bf45 #33
[Hardware name: Firefly-RK3399 Board (DT)
[task: ffff80007a1de200 task.stack: ffff80007a01c000
[PC is at mmc_init_request+0x14/0xc4
[LR is at alloc_request_size+0x4c/0x74
[pc : [<ffff0000087d7150>] lr : [<ffff000008378fe0>] pstate: 600001c5
[sp : ffff80007a01f8f0

....

[[<ffff0000087d7150>] mmc_init_request+0x14/0xc4
[[<ffff000008378fe0>] alloc_request_size+0x4c/0x74
[[<ffff00000817ac28>] mempool_create_node+0xb8/0x17c
[[<ffff00000837aadc>] blk_init_rl+0x9c/0x120
[[<ffff000008396580>] blkg_alloc+0x110/0x234
[[<ffff000008396ac8>] blkg_create+0x424/0x468
[[<ffff00000839877c>] blkg_lookup_create+0xd8/0x14c
[[<ffff0000083796bc>] generic_make_request_checks+0x368/0x3b0
[[<ffff00000837b050>] generic_make_request+0x1c/0x240

So mmc_blk_put wouldn't calling blk_cleanup_queue which actually the
QUEUE_FLAG_DYING and QUEUE_FLAG_BYPASS should stay. Block core expect
blk_queue_bypass_{start, end} internally to bypass/drain the queue before
actually dying the queue, so it didn't expose API to set the queue bypass.
I think we should set QUEUE_FLAG_BYPASS whenever queue is removed, although
the md->usage is still counted, as no dispatch queue could be found then.

Fixes: 304419d8a7e9 ("mmc: core: Allocate per-request data using the block layer core")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 7c84b8b43d3d550fa6f0b57277d03f2e1bafb357)

7 years agommc: block: Prevent new req entering queue after its cleanup
Grzegorz Sluja [Thu, 13 Jul 2017 09:17:58 +0000 (11:17 +0200)]
mmc: block: Prevent new req entering queue after its cleanup

The commit 304419d8a7e9 ("mmc: core: Allocate per-request data using the
block layer core"), refactored the mechanism of queue handling, but also
made mmc_init_request() to be called after mmc_cleanup_queue(). This
triggers a null pointer dereference:

[  683.123791] BUG: unable to handle kernel NULL pointer dereference at (null)
[  683.123801] IP: mmc_init_request+0x2c/0xf0 [mmc_block]
...
[  683.123905] Call Trace:
[  683.123913]  alloc_request_size+0x4f/0x70
[  683.123919]  mempool_alloc+0x5f/0x150
[  683.123925]  ? __enqueue_entity+0x6c/0x70
[  683.123928]  get_request+0x3ad/0x720
[  683.123933]  ? prepare_to_wait_event+0x110/0x110
[  683.123937]  blk_queue_bio+0xc1/0x3a0
[  683.123940]  generic_make_request+0xf8/0x2a0
[  683.123942]  submit_bio+0x75/0x150
[  683.123947]  submit_bio_wait+0x51/0x70
[  683.123951]  blkdev_issue_flush+0x5c/0x90
[  683.123956]  ext4_sync_fs+0x171/0x1b0
[  683.123961]  sync_filesystem+0x73/0x90
[  683.123965]  fsync_bdev+0x24/0x50
[  683.123971]  invalidate_partition+0x24/0x50
[  683.123973]  del_gendisk+0xb2/0x2a0
[  683.123977]  mmc_blk_remove_req.part.38+0x71/0xa0 [mmc_block]
[  683.123980]  mmc_blk_remove+0xba/0x190 [mmc_block]
[  683.123990]  mmc_bus_remove+0x1a/0x20 [mmc_core]
[  683.123995]  device_release_driver_internal+0x141/0x200
[  683.123999]  device_release_driver+0x12/0x20
[  683.124001]  bus_remove_device+0xfd/0x170
[  683.124004]  device_del+0x1e8/0x330
[  683.124012]  mmc_remove_card+0x60/0xc0 [mmc_core]
[  683.124019]  mmc_remove+0x19/0x30 [mmc_core]
[  683.124025]  mmc_stop_host+0xfb/0x1a0 [mmc_core]
[  683.124032]  mmc_remove_host+0x1a/0x40 [mmc_core]
[  683.124037]  sdhci_remove_host+0x2e/0x1c0 [mmc_sdhci]
[  683.124042]  sdhci_pci_remove_slot+0x3f/0x80 [sdhci_pci]
[  683.124045]  sdhci_pci_remove+0x39/0x70 [sdhci_pci]
[  683.124049]  pci_device_remove+0x39/0xc0
[  683.124052]  device_release_driver_internal+0x141/0x200
[  683.124056]  driver_detach+0x3f/0x80
[  683.124059]  bus_remove_driver+0x55/0xd0
[  683.124062]  driver_unregister+0x2c/0x50
[  683.124065]  pci_unregister_driver+0x29/0x90
[  683.124069]  sdhci_driver_exit+0x10/0x4f3 [sdhci_pci]
[  683.124073]  SyS_delete_module+0x171/0x250
[  683.124078]  entry_SYSCALL_64_fastpath+0x1e/0xa9

Fix this by setting the queue DYING flag before cleanup the queue, as it
prevents new reqs from entering the queue.

Signed-off-by: Grzegorz Sluja <grzegorzx.sluja@intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Fixes: 304419d8a7e9 ("mmc: core: Allocate per-request data using the...")
[Ulf: Updated the changelog]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit bbdc74dc19e09ac4e71bfb219596b3d5bc786720)

7 years agoMLK-16372-4 arm64: dts: imx8qm: add cpu-freq cooling map
Anson Huang [Tue, 5 Sep 2017 09:35:22 +0000 (17:35 +0800)]
MLK-16372-4 arm64: dts: imx8qm: add cpu-freq cooling map

Add i.MX8QM cpu-freq cooling support, when temperature
exceeds passive point, cpu-freq will drop to lowest
set-point. Both A53 and A72 cluster are supported.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
7 years agoMLK-16372-3 arm64: dts: imx8qxp: add cpu-freq cooling map
Anson Huang [Tue, 5 Sep 2017 09:33:50 +0000 (17:33 +0800)]
MLK-16372-3 arm64: dts: imx8qxp: add cpu-freq cooling map

Add i.MX8QXP cpu-freq cooling support, when temperature
exceeds passive point, cpu-freq will drop to lowest
set-point.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
7 years agoMLK-16372-2 cpufreq: imx8: add cpu-freq cooling support
Anson Huang [Tue, 5 Sep 2017 09:31:43 +0000 (17:31 +0800)]
MLK-16372-2 cpufreq: imx8: add cpu-freq cooling support

Register cpu-freq cooling device if device tree
supports cooling-cells, different cluster can
have its own cooling device settings.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
7 years agoMLK-16372-1 thermal: imx_sc: add get_trend and set_trip_temp support
Anson Huang [Tue, 5 Sep 2017 09:28:58 +0000 (17:28 +0800)]
MLK-16372-1 thermal: imx_sc: add get_trend and set_trip_temp support

Add get_trend and set_trip_temp callback to support
cpu-freq cooling function.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
7 years agoMLK-16367 driver: clk: imx: enable ddrc apb clock always on i.mx8mq
Bai Ping [Tue, 5 Sep 2017 03:13:12 +0000 (11:13 +0800)]
MLK-16367 driver: clk: imx: enable ddrc apb clock always on i.mx8mq

Keep the DDRC APB init on, so we can access the DDRC register.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
7 years agoMLK-16368: irqchip: intmux: fix address definition of register
Shengjiu Wang [Tue, 5 Sep 2017 08:22:45 +0000 (16:22 +0800)]
MLK-16368: irqchip: intmux: fix address definition of register

Fix the offset of CHANIPR register address. Document is KL28Z
reference manual

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
7 years agoMLK-16370-3 video: fbdev: dcss: align dpr 'pitch' config to 16 bytes for NV12
Fancy Fang [Tue, 5 Sep 2017 05:03:48 +0000 (13:03 +0800)]
MLK-16370-3 video: fbdev: dcss: align dpr 'pitch' config to 16 bytes for NV12

The Hantro VPU always has a 16 bytes alignment on width.
So the pitch configured in DPR should be also aligned
to 16 bytes to be compatible with VPU buffer. For now,
only NV12 is supported.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
7 years agoMLK-16370-2 video: fbdev: dcss: remove YUV422 support in dpr
Fancy Fang [Tue, 5 Sep 2017 05:58:21 +0000 (13:58 +0800)]
MLK-16370-2 video: fbdev: dcss: remove YUV422 support in dpr

Return error value when meeting 'YUV422' pixel format,
since there is no code can handle this format, and this
can also avoid some build warning.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
7 years agoMLK-16370-1 video: fbdev: dcss: refine 'pitch' config logic for dpr
Fancy Fang [Tue, 5 Sep 2017 04:40:18 +0000 (12:40 +0800)]
MLK-16370-1 video: fbdev: dcss: refine 'pitch' config logic for dpr

Refine the 'pitch' configuration logic for DPR to
make it more reasonable and clear.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
7 years agoMLK-16360 ARM64: dts: Update the temp sensor calibration data on i.mx8mq
Bai Ping [Mon, 4 Sep 2017 02:14:46 +0000 (10:14 +0800)]
MLK-16360 ARM64: dts: Update the temp sensor calibration data on i.mx8mq

Update the calibration data of the temp sensor range0~3.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
7 years agoMLK-16327-2: ARM64: dts: fsl-imx8qm/qxp: correct edma channel name
Robin Gong [Wed, 30 Aug 2017 11:05:32 +0000 (19:05 +0800)]
MLK-16327-2: ARM64: dts: fsl-imx8qm/qxp: correct edma channel name

Correct edma channel name to support unique edma channel name in multi
edma instances.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
7 years agoMLK-16327-1: dma: fsl-edma-v3: make exclusive channel name for all edma channels
Robin Gong [Wed, 30 Aug 2017 10:51:16 +0000 (18:51 +0800)]
MLK-16327-1: dma: fsl-edma-v3: make exclusive channel name for all edma channels

  Since there are multi edmav3 instances on i.mx8, every edma channel name
is better unique.But so far, all edma channel name is 'edma-channel(id)-
tx',thus some edma channels which share the same channel id but different
edma instance will show the same channel name in kernel and this is not
friendly to debug in kernel.
  Now the edma channel name(interrupt-names property) is define in dts
as below:
        "edmaX-chanX-Xx"
             |     | |---> receive/transmit, r or t
             |     |---> channel id, the max number is 32
             |---> edma controller instance, 0, 1, 2,..etc
and get below correct name with 'cat /proc/interrupts':
 43:          0          0          0          0     GICv3 466 Level     edma0-chan8-rx
 44:          0          0          0          0     GICv3 467 Level     edma0-chan9-tx
 45:         79          0          0          0     GICv3 468 Level     edma0-chan10-rx
 46:        311          0          0          0     GICv3 469 Level     edma0-chan11-tx
 47:          0          0          0          0     GICv3 470 Level     edma0-chan12-rx
 48:          0          0          0          0     GICv3 471 Level     edma0-chan13-tx
 49:          0          0          0          0     GICv3 472 Level     edma0-chan14-rx
 50:          0          0          0          0     GICv3 473 Level     edma0-chan15-tx
 51:          0          0          0          0     GICv3 406 Level     edma2-chan0-tx
 52:          0          0          0          0     GICv3 407 Level     edma2-chan1-tx
 53:          0          0          0          0     GICv3 408 Level     edma2-chan2-tx
 54:          0          0          0          0     GICv3 409 Level     edma2-chan3-tx
 55:          0          0          0          0     GICv3 410 Level     edma2-chan4-tx
 56:          0          0          0          0     GICv3 411 Level     edma2-chan5-tx
 57:          0          0          0          0     GICv3 442 Level     edma2-chan6-rx, edma2-chan7-tx

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>