Anson Huang [Thu, 12 Oct 2017 13:31:11 +0000 (21:31 +0800)]
MLK-16546-1 ARM64: dts: freescale: imx8qxp: add early_power_on property
Introduce early_power_on property, for those power
domain nodes with this property set, power domain driver
will power them on at syscore resume phase, since some
resources need to be power on earlier than device resume
phase, like irq chip driver etc..
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
Shengjiu Wang [Thu, 12 Oct 2017 06:03:15 +0000 (14:03 +0800)]
MLK-13946-7: ARM64: defconfig: add CONFIG_SND_SOC_IMX_CDNHDMI
Commit
3f16567eedabd3 ("MLK-16538-4: defconfig: Add hdmi/dp driver to
default kernel build") removed audio HDMI from defconfig.
Add it back after fix the compile issue.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Shengjiu Wang [Thu, 12 Oct 2017 06:02:53 +0000 (14:02 +0800)]
MLK-13946-6: ARM64: dts: remove video-mode in hdmi audio node
according the new api, video-mode is not needed for hdmi audio, it is
replaced by protocol property.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Shengjiu Wang [Thu, 12 Oct 2017 06:02:33 +0000 (14:02 +0800)]
MLK-13946-5: ARM64: dts: enable dp audio for imx8qm
Enable dp audio for imx8qm, define sai hdmi tx and rx node.
use property "procotol" to replace the "video-mode"
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Shengjiu Wang [Thu, 12 Oct 2017 06:01:49 +0000 (14:01 +0800)]
MLK-13946-4: ASoC: imx-cdnhdmi: refine machine driver for api changes
Since commit
3f5780eb4520 ("MLK-16538-2: hdmi api: Relocate hdmi api
soure code") change the api. And hdmi video driver provide a new api
for hdmi audio. Machine driver need to be updated accrodingly
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Shengjiu Wang [Thu, 12 Oct 2017 06:01:19 +0000 (14:01 +0800)]
MLK-13946-3: ASoC: fsl_sai: fix the xMR setting
When there is multi data line enabled, the xMR setting is
wrong if according to the channel number. which should
according to the slot number
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Shengjiu Wang [Thu, 12 Oct 2017 05:58:51 +0000 (13:58 +0800)]
MLK-13946-2: hdp: add i2s clock for imx8qm hdmi audio
hdmi audio need to enable the i2s clock and i2s_bypass clock
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Shengjiu Wang [Thu, 12 Oct 2017 05:58:18 +0000 (13:58 +0800)]
MLK-13946-1: clk: imx8qm: fix the definition of HDMI I2S clock
The resource id of HDMI I2S clock is SC_R_HDMI_I2S, and SAI HDMITX
and HDMIRX clock need FUNCTION_NAME paremeter.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Sandor Yu [Wed, 11 Oct 2017 11:05:13 +0000 (19:05 +0800)]
MLK-16570-2: hdmi audio: Add hdmi audio config function
Add hdmi audio config function to hdmi driver.
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Sandor Yu [Wed, 11 Oct 2017 11:00:58 +0000 (19:00 +0800)]
MLK-16570-1: hdp: Add hdp audio config function
Add hdp audio config function to hdp driver.
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Liu Ying [Thu, 12 Oct 2017 06:55:45 +0000 (14:55 +0800)]
MLK-16575 gpu: imx: dpu: fetcheco: Correct dpu->fe_priv[] access in dpu_fe_init()
The array size of dpu->fe_priv is only 4. We need to access the correct
entry of the array by comparing the id passed in dpu_fe_init() with
the entries in the fe_ids array instead of using the id directly.
This may avoid out-of-boundary array access on dpu->fe_priv.
Fixes:
936b978c44f3 ("MLK-16075-11 gpu: imx: dpu: Add basic fetcheco units support")
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Liu Ying [Thu, 12 Oct 2017 06:28:49 +0000 (14:28 +0800)]
MLK-16574 gpu: imx: dpu: layerblend: Fix layerblend_shdldsel()
The shadow load selection field of layerblend is at bit[2:1].
Thus, we need to shift to left by one bit for the selection value.
Fixes:
4ec895ea31a2 ("MLK-15001-11 gpu: Move ipuv3 and dpu to imx folder")
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Sandor Yu [Wed, 11 Oct 2017 07:58:43 +0000 (15:58 +0800)]
MLK-16565: hdmi: Remove CEC clock setting in HDMI driver
HDMI CEC clock have management in HDMI CEC driver,
so bypass CEC clock in HDMI driver.
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Fugang Duan [Wed, 11 Oct 2017 06:32:30 +0000 (14:32 +0800)]
MLK-16564-03 ARM: imx_v7_defconfig: enable rpmsg gpio driver
Enable CONFIG_GPIO_IMX_RPMSG to support rpmsg gpio driver in default.
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Fugang Duan [Wed, 11 Oct 2017 06:22:10 +0000 (14:22 +0800)]
MLK-16564-02 dts: imx7ulp-evk: add rpmsg gpio PTA and PTB support
Add rpmsg gpio PTA and PTB support.
Since currently M4 image support dynamical channel allocation,
and reserve below memory for kernel service and app channel:
* --0x9FF00000~0x9FF0FFFF: pmic,pm,audio,keys,gpio
* --0x9FF10000~0x9FF1FFFF: pingpong,virtual tty
Change the rpmsg instances of A core part to sync with M core.
Test M4 image built from Wayne Feng, M4 image commit ID:
b1321d4aca82
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Fugang Duan [Tue, 26 Sep 2017 06:28:16 +0000 (14:28 +0800)]
MLK-16564-01 gpio: imx-rpmsg: add rpmsg virtual gpio driver
Add rpmsg virtual gpio driver support.
i.MX7ULP GPIO PTA and PTB resource are managed by M4 core, setup one
simple protocol with M4 core based on RPMSG virtual IO to let A core
access such GPIOs that is what the driver do.
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Daniel Baluta [Mon, 2 Oct 2017 13:59:41 +0000 (16:59 +0300)]
MLK-16533: ARM64: dts: imx8qm-mek: Enable wm8960 codec
wm8960 can be found on i.mx8 QM MEK CPU board. It uses SAI1 as
a digital audio interface and also ASRC for rate conversion.
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Shengjiu Wang [Tue, 10 Oct 2017 09:12:46 +0000 (17:12 +0800)]
MLK-16563-3: ARM64: dts: support AUDIO IO board with imx8qxp-mek
AUDIO IO board (SCH-501-1-005960-A1) has CS42888 codec and connect
to MCIMX-8X-BB via PCIe.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Shengjiu Wang [Tue, 10 Oct 2017 09:06:26 +0000 (17:06 +0800)]
MLK-16563-2: ASoC: imx-cs42888: support 12.288MHz mclk of codec
The esai and cs42888 can use different mclk, which has different
frequency. But machine driver thought they are same frequency, which
may cause issue in some case.
Base on above conclusion, the codec can support 12.288MHz mclk.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Shengjiu Wang [Tue, 10 Oct 2017 08:59:50 +0000 (16:59 +0800)]
MLK-16563-1: ASoC: cs42xx8: reset the codec in the beginning of probe
In AUDIO IO board for imx8qxp mek, after board reset, the codec
failed to probe, system can't find codec device on i2c bus.
The reason is not clear, but add reset operation in the beginning of
probe can fix this issue.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Weiguang Kong [Thu, 28 Sep 2017 04:49:49 +0000 (12:49 +0800)]
MLK-16545-2: ASoC: fsl_hifi4: add support to reset hifi4 codec
add cases to support resetting the hifi4 codec when receiving
HIFI4_RESET_CODEC command from the user space.
Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Weiguang Kong [Thu, 28 Sep 2017 04:44:17 +0000 (12:44 +0800)]
MLK-16545-1: uapi: mxc_hifi4: add reset command for hifi4
add reset command declaration into mxc_hifi4.h file,
this command is used to reset hifi4 codec when seeking
Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Weiguang Kong [Fri, 29 Sep 2017 06:24:59 +0000 (14:24 +0800)]
MLK-16558: ASoC: fsl_hifi4: add reference counter for hifi4 device
When abnormal situation occurs and the current process terminates
abnormally, the hifi4 driver can't get the HIFI4_CODEC_CLOSE CMD
from user space to release the multi-codec resource, so the current
resource can't be used again.
Have found that the fsl_hifi4_close() function can be called
implicitly when process terminates abnormally, so add a reference
counter in fsl_hifi4_open() and fsl_hifi4_close() to check this
abnormal situation, when the number is same for opening and closing
hifi4 device, the multi-codec should be reinitialized again and
the hifi4 driver should send ICM_EXT_MSG_ADDR CMD to hifi4 framework
to initialize the multi-codec resources too.
Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
Yuchou Gan [Mon, 9 Oct 2017 11:21:40 +0000 (19:21 +0800)]
MGS-3314 [#ccc] Enable GPU for 8QM MEK board
Enable GPU for 8QM MEK board
Signed-off-by: Yuchou<yuchou.gan@nxp.com>
Date: 9th Oct, 2017
Richard Zhu [Thu, 21 Sep 2017 08:46:26 +0000 (16:46 +0800)]
MLK-16530-3 rpmsg: imx: init mu and limit the pingpong cycles
- Init mu power and clk.
- Change the cycles of the pingpong demot refer to
the limitation of M4 side.
When the received data larger than 100, the
pingpong of M4 side would be finished.
BuildInfo: SCFW
9e9f6ec6, IMX-MKIMAGE 0, ATF 0
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Richard Zhu [Thu, 21 Sep 2017 08:46:09 +0000 (16:46 +0800)]
MLK-16530-2 clk: imx8qm: add the cm40 ipg clk
Add the cm40 ipg clk
BuildInfo: SCFW
9e9f6ec6, IMX-MKIMAGE 0, ATF 0
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Richard Zhu [Fri, 15 Sep 2017 06:41:23 +0000 (14:41 +0800)]
MLK-16530-1 ARM64: dts: imx8: enable rpmsg support
enable imx8qm rpmsg support, and validated the
pingpong demo.
add the mu power and clk on imx8qxp.
BuildInfo: SCFW
9e9f6ec6, IMX-MKIMAGE 0, ATF 0
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Sandor Yu [Fri, 29 Sep 2017 06:06:25 +0000 (14:06 +0800)]
MLK-16538-6: dts: Add hdmi property to imx8qm dts
-Add hdmi property item to imx8qm dts file.
-Connect hdmi to dpu1_disp0 port.
-Remove unnecessary clk from hdmi steer irq property.
-Fix typo for irqsteer_csi0
Acked-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Sandor Yu [Fri, 29 Sep 2017 04:43:30 +0000 (12:43 +0800)]
MLK-16538-5: dts: Rename hdmi fb driver compatible name
Rename imx8mq hdmi fb driver compatible name to "fsl,imx8qm-fb-hdmi".
Acked-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Sandor Yu [Fri, 29 Sep 2017 06:05:32 +0000 (14:05 +0800)]
MLK-16538-4: defconfig: Add hdmi/dp driver to default kernel build
Default enable hdmi/dp drm dirver.
Acked-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Sandor Yu [Fri, 29 Sep 2017 06:22:36 +0000 (14:22 +0800)]
MLK-16538-3: hdmi/dp: Add imx8qm hdmi/dp driver
Add hdmi/dp drm architecture driver.
HDMI and DP driver can work in imx8qm ARM2 board.
The driver support basic hotplug function.
Default working mode is 1080p60.
Acked-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
Sandor Yu [Fri, 29 Sep 2017 06:16:27 +0000 (14:16 +0800)]
MLK-16538-2: hdmi api: Relocate hdmi api soure code
-Relocate hdmi api source code from drivers/video/fbdev/mxc/cdn_hdp
to drivers/mxc/hdp.
-Add displayport and hdcp api function.
-Move t28hpc_hdmitx function from api source code folder
to hdmi fb driver folder.
-Update imx8 hdmi fb driver according api source code change.
-Sync api source code with CDN_API_1_0_33 release.
Acked-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Sandor Yu [Mon, 9 Oct 2017 03:51:42 +0000 (11:51 +0800)]
MLK-16538-1: clks: correct ipg_hdmi_clk_root clk parent
Correct imx8qm ipg_hdmi_clk_root clk parent name.
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Leonard Crestez [Thu, 5 Oct 2017 14:03:01 +0000 (17:03 +0300)]
MLK-16225: imx8 pm: Check of_device_is_available
This patch causes imx8-pd nodes marked with status = "disabled" to be
ignored. This is very common in devicetree handling.
When running with xen the hypervisor will convert all xen,passthrough
properties to status = "disabled" before passing dtb to dom0. This patch
allows power domains to be marked this way and have them be ignored by
the host automatically.
The alternative is to remove the power domain nodes and references using
/delete-node/ and /delete-property/ and that gets messy.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <Ranjani.vaidyanathan@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Leonard Crestez [Thu, 28 Sep 2017 16:24:59 +0000 (19:24 +0300)]
MLK-16225: clk: imx8qm: Add fsl,lpcg_base_offset property
Right now the imx8qm clock provider hardcodes physical addresses. In
virtualization scenarios the intermediate physical addresses visible
from a guest can be different. In theory a 1:1 mapping could be done but
that in xen it would overlap with hardcoded guest ram starting at
0x40000000.
Solve this by adding a property with a common offset for all lpcg
areas. This should be set in the guest dts.
In theory each lpcg block could be remapped with it's own offset but
that is not supported.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <Ranjani.vaidyanathan@nxp.com>
Leonard Crestez [Tue, 26 Sep 2017 14:53:17 +0000 (17:53 +0300)]
MLK-16225: clk: imx8: Do not register clocks for unowned resources
Registering clocks for unowned resources can result in lots of pointless
scfw errors and potential faults when attempting to use LPCG.
Solve this by checking ownership via sc_rm_is_resource_owned and
returning -ENODEV from clock registration functions. The top-level clock
provider is also modified so that it accepts such errors silently.
This is intended for xen but could also be useful for SCFW partitioning.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <Ranjani.vaidyanathan@nxp.com>
Leonard Crestez [Thu, 28 Sep 2017 16:23:01 +0000 (19:23 +0300)]
MLK-16225: clk: imx8qm: Add LPCG_ADDR macro
All this does is replace the cast from physical address with a macro in
order to make later changes easier.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <Ranjani.vaidyanathan@nxp.com>
Leonard Crestez [Wed, 4 Oct 2017 13:27:32 +0000 (16:27 +0300)]
MLK-16225: clk: imx8qm: Ignore imx8qm-acm node missing
This can happen in virtualization scenarios, so just skip registering
the associated clocks instead of failing to boot.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <Ranjani.vaidyanathan@nxp.com>
Leonard Crestez [Mon, 2 Oct 2017 16:58:39 +0000 (19:58 +0300)]
MLK-16225: clk: imx8qm: Remove initial prepare/enable for A-core clk
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <Ranjani.vaidyanathan@nxp.com>
Robert Chiras [Fri, 21 Jul 2017 11:51:25 +0000 (14:51 +0300)]
MLK-16056 clk: imx8qm: add new dsi clocks
Add clk for dsi0-i2c1, dsi1-i2c0 and dsi1-i2c1
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Adriana Reus [Wed, 20 Sep 2017 07:58:01 +0000 (10:58 +0300)]
MLK-16442-3: dts: imx8qm: Add clock parents for DC clocks.
Adds dt settings for the dpu driver to set the default clock
parents
- PLL1 (dc0_pll0_clk) for dispay0 and PLL2(dc0_pll1_clk) for display1.
Functionality is not changed from dpu driver perspective as the same
parents for the display clocks were used before.
The resulting clock topology for dc0_disp1 is:
dc0_pll1_div 1 1
1188000000 0 0
dc0_pll1_clk 2 2
1188000000 0 0
dc0_disp1_sel 1 1
1188000000 0 0
dc0_disp1_div 1 1
148500000 0 0
dc0_disp1_clk 1 1
148500000 0 0
(BuildInfo: SCFW
9e9f6ec6, IMX-MKIMAGE 0, ATF 0)
Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Reviewed by: Ranjani Vaidyanathan <Ranjani.vaidyanathan@nxp.com>
Adriana Reus [Wed, 20 Sep 2017 07:54:33 +0000 (10:54 +0300)]
MLK-16442-2: clk: imx8qm: Add mux for DC clocks.
DC clocks can choose their clock source between PLL1, PLL2 and
bypass input.
This patch introduces a multiplexer in the dc clock topology to
allow this choice and introduces one set of parents that will be used
for both display0 and display1 clocks.
Clock paths tested:
1. PLL2(dc0_pll1_clk)->DC0_DISP1(dc0_disp1_clk)->LVDS
2. BYP(dc0_bypass0_clk)->DC0_DISP1(dc0_disp1_clk)->LVDS
(BuildInfo: SCFW
9e9f6ec6, IMX-MKIMAGE 0, ATF 0)
Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Reviewed by: Ranjani Vaidyanathan <Ranjani.vaidyanathan@nxp.com>
Adriana Reus [Mon, 11 Sep 2017 07:44:58 +0000 (10:44 +0300)]
MLK-16442-1: clk: clk-mux-scu: Add new mux type.
Display clocks can choose their parrent between various clock sources
(ex pll1, pll2, bypass).
This patch adds a new mux type that uses the underlying support in scfw
to set/get a parent.
(BuildInfo: SCFW
9e9f6ec6, IMX-MKIMAGE 0, ATF 0)
Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Reviewed by: Ranjani Vaidyanathan <Ranjani.vaidyanathan@nxp.com>
Adriana Reus [Mon, 11 Sep 2017 07:29:48 +0000 (10:29 +0300)]
MLK-16442-0: clk: imx8: Remove imx_clk_divider2_scu duplicate declaration.
The imx_clk_divider2_scu is declared twice.
Remove the second occurrence.
(BuildInfo: SCFW
9e9f6ec6, IMX-MKIMAGE 0, ATF 0)
Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Reviewed by: Ranjani Vaidyanathan <Ranjani.vaidyanathan@nxp.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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)
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)
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>
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>
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)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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").
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>