Compare commits

...

4176 Commits

Author SHA1 Message Date
ab78041aca MLK-23256 clk: imx: Correct the root clk of media ldb on imx8mp
The root clock slice at 0xbf00 is media_ldb clock, not csi_phy2_ref,
so correct it.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Liu Ying <victor.liu@nxp.com>
2020-01-21 17:01:15 +08:00
bcd647a0a2 MLK-23183-03 arm64: dts: freescale: Add the thermal node for imx8mp
Add the thermal node for i.MX8MP.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2020-01-21 17:01:15 +08:00
3857b5ba7b MLK-23183-02 dt-bindings: thermal: Update the binding for imx8mp
Update the binding info for i.MX8MP TMU module.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2020-01-21 17:01:15 +08:00
488d686610 MLK-23183-01 thermal: imx8mm: Update the driver for multiple sensor support
For SOC like i.MX8MP, it has two sensor under the same tmu module, so
update the driver to support thermal zone for each of the sensor.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2020-01-21 17:01:08 +08:00
b597790d41 MLK-23181-5 usb: cdns3: gadget: need to handle sg case for cdns3_descmiss_copy_data
Add sg request case for cdns3_descmiss_copy_data.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-01-20 17:26:31 +08:00
1b363ca8c4 MLK-23181-4 usb: cdns3: gadget: enlarge TRB ring
At android ADB use case, we find the TRB ring is prepared very fast,
and it reaches empty very soon, enlarge it avoid empty trb ring
situation.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-01-20 17:26:25 +08:00
f9e2ca657f MLK-23181-3 usb: cdns3: gadget: handle multiple trb request properly
We use polling EP_TRADDR to judge if the trb has finished, so for
request which includes multiple trb, we may quit the trb judgement
in the middle of request, in that case, we can't giveback the
request. We should only giveback the request when all the TRB in
this request has finished.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-01-20 17:26:19 +08:00
3e7c6dff3e MLK-23181-2 usb: cdns3: gadget: add one missing condition for cdns3_request_handled
If the dequeue pointer advances to the first trb, but the priv_req->end_trb
is the last trb, we consider the trb this dequeue pointer points doesn't
belong to this request.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-01-20 17:23:29 +08:00
adb129da17 MLK-23181-1 usb: cdns3: gadget: using num_mapped_sgs for scatter list
For some systems, the iommu or swiotlb is used, the sg list may not
the same between before and after DMA map. So we should use
num_mapped_sgs for DMA since it is the final DMA mapped sg list
for hardware.

Reviewed-by: Jun Li <jun.li@nxp.com>
Reported-by: Zhang Sanshan <pete.zhang@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-01-20 17:23:04 +08:00
2ac8c34bc1 MGS-5489: arm64: dts: imx8dx: update GPU memory setting
The 8DX MEK only has 1GB DDR, update GPU memory as below:
- set GPU MMU mapping size to 1GB (0x80000000-0xC0000000)
- set GPU reserve size to 128MB

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 30efecdc1cef0fcff82f5cebd9823c61fee17e74)
2020-01-20 01:18:46 -08:00
d122f11672 MLK-23247: arm64: dts: Add DTS files for DSP play on imx8dx mek
This file is almost same as the fsl-imx8qxp-mek-dsp.dts

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 62a4fde8d81886244c59d7ebb3c0b7023ce7c57a)
2020-01-20 01:18:46 -08:00
583b2f7d29 MLK-23243-3 arm64: dts: Add DTS files for iMX8DX MEK board
Add iMX8DX MEK DTS file and its rpmsg DTS file, both re-use the
common MEK board DTS files.
The 8DX MEK only has 1GB DDR, so decrease its CMA size to 320MB.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 9ab7b42c2c99dc0e2dd7fafa5cb4cebd792aceaf)
2020-01-20 01:18:46 -08:00
0917c6768a MLK-23243-2 arm64: dts: Add new DTS imx8x-mek for MEK common nodes
Abstract the MEK board DTS nodes to common files imx8x-mek.dtsi
and imx8x-mek-rpmsg.dtsi. So that we can share the board nodes
between 8QXP and 8DX MEK DTS

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit e1a4c61d3c0f9593ec0d2292cc4d510bcb59a01f)
2020-01-20 01:18:46 -08:00
3fcf0c3f23 MLK-23243-1 arm64: dts: imx8dx: Fix GPU clock rate
According to iMX8DX spec, the GPU and shader frequecy are both 372Mhz.
Also fix VPU decoder issue, not delete it.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 2dd79af22fd753434b4213b11b799053cb9ec358)
2020-01-20 01:18:46 -08:00
a7d97d8f8e MLK-23242-6: arm64: dts: imx8mp: Add support for audio sound card
Enable the sound-wm8960 and sound-micfil
1. Add audio device node for each IP in imx8mp
2. Add clocks for audiomix power domains
3. Enable the ASRC.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-01-20 17:08:29 +08:00
c45fbeeb2d MLK-23242-5: dt-bindings: imx: update pinmux for PDM
Update pinmux for PDM according to latest RM.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-01-20 17:08:25 +08:00
27198be03f MLK-23242-4: ASoC: fsl_sai: Add support for imx8mp
In imx8mp there is audiomix power domains, and only
one power domain, that we don't need to call
dev_pm_domain_attach_by_id, which should return the EEXIST.

And we need to enable the MCLK output even it is in slave
mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-01-20 17:08:20 +08:00
604582693e MLK-23242-3: clk: imx: imx8mp: correct audio_root_clk parent
audio_root_clk parent should be ipg_audio_root.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-01-20 17:08:16 +08:00
1de3e8edd9 MLK-23242-2: ASoC: fsl_micfil: Add support for imx8mp
The new features are:
1. The output is 24 more significative bits in 32bit slot
2. The fifo depth is 32 entries.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-01-20 17:08:13 +08:00
93a53a2f8b MLK-23242-1: ASoC: fsl_easrc: request dma channel from specific controller
Request dma channel from specific dma controller instead of generic dma
controller list, otherwise, may get the wrong dma controller if there are
multi dma controllers such as i.mx8mp.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2020-01-20 17:08:03 +08:00
4d1d9fe075 arm64: dts: imx8mp: Add the clocks to audiomix_pd
It seems the audiomix_pd needs the following clocks:
IMX8MP_CLK_AUDIO_ROOT, IMX8MP_CLK_AUDIO_AXI_DIV
and IMX8MP_CLK_IPG_AUDIO_ROOT.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
2020-01-20 10:45:02 +02:00
bb02b4a28f arm64: dts: imx8mp: Enable audiomix
Now the audiomix driver is working again, so enable it.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
2020-01-20 10:44:41 +02:00
0e08021b90 clk: imx: pll4xx: Pass on the dev to clk_register
The dev needs to be passed on to the clk_register
to allow the PM runtime and other dev related stuff
to work.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
2020-01-20 10:44:34 +02:00
06f45e24ce arm64: dts: imx8mp: Add clock and power domain to audiomix dts node
Since the clocks that are unused get disabled on imx_5.4.y,
the IMX8MP_CLK_AUDIO_ROOT needs to be controlled by the audiomix
driver on suspend and resume. And that allows us to get
rid of the dummy clock of_clk_get_by_name that was there to
make sure the CCM driver gets probed before the audiomix.

The order of the clocks was all wrong. Fixed that here also.

Also added the PM runtime and the AUDIO_ROOT_CLK.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
2020-01-20 10:43:23 +02:00
b8286630ce reset: imx: Add audiomix reset controller support
The audiomix MFD driver registers some devices, one of which maps correctly to
a reset controller type. This driver registers a reset controller for that.
For now, only the EARC specific resets are added.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2020-01-20 10:43:16 +02:00
2b3268a70e MLK-23250-12: defconfig: audiomix and samsung phy modules
two variable added:
CONFIG_MFD_IMX_AUDIOMIX
CONFIG_PHY_SAMSUNG_HDMI_PHY

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 23:31:56 +08:00
229661a121 MLK-23250-11: arm64: dts: imx: add imx8mp hdmimix modules
new dts file for imx8mp hdmi.
Add all hdmimix submodules.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 23:31:56 +08:00
b82d0af62f MLK-23250-10: drm: imx: hdmi: Add iMX8MP hdmi driver
Add iMX8MP hdmi driver.
Basci hdmi video function is working.
EDID function is working.
HPD basic working but not stable enough for stress test,
may not work in some TVs.
HDMI GP audio function added.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 23:31:56 +08:00
54ec768dc7 MLK-23250-09: drm: imx: pavi: Add PAVI driver for iMX8MP HDMI
PAVI is a submodule for imx8mp hdmimix.
Create API functions in the driver for iMX8MP HDMI driver
to enable/disable PAVI function and power.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 23:31:56 +08:00
71c766d9ef MLK-23250-08: phy: Add samsung hdmi phy driver
Add samsung hdmi phy driver.
hdmi phy driver register phy clock named with "hdmi_phy".

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 23:31:56 +08:00
a9a0956262 MLK-23250-07: clk: imx: add imx8mp hdmimix clk driver
Add hdmimix clk driver for imx8mp.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 23:31:56 +08:00
d4b6fb2adc MLK-23250-06: reset: Add hdmimix reset driver
Add hdmi reset driver.

According hdmimix submodues.
Group hdmimix reset bits to eight reset domains as followed:
IMX_HDMIMIX_HDMI_TX_RESET
IMX_HDMIMIX_HDMI_PHY_RESET
IMX_HDMIMIX_HDMI_PAI_RESET
IMX_HDMIMIX_HDMI_PVI_RESET
IMX_HDMIMIX_HDMI_TRNG_RESET
IMX_HDMIMIX_IRQ_STEER_RESET
IMX_HDMIMIX_HDMI_HDCP_RESET
IMX_HDMIMIX_LCDIF_RESET

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 23:31:56 +08:00
d123948770 MLK-23250-05: irqchip: imx-irqsteer: Add reset function
Add reset function for imx-irqsteer.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 17:26:00 +08:00
f29d13f9f3 MLK-23250-04: lcdifv3: Add hdmimix lcdifv3 support
Add iMX8MP hdmimix lcdif3 support.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 17:25:54 +08:00
153a51c5cb MLK-23250-03: clk: imx: rename 27m hdmi clock to 24m
27M HDMI clock have replaced by 24M in IP.
Fix HDMI AXI clk parent issue.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 17:25:49 +08:00
419783bc72 MLK-23250-02: drm: lcdifv3: Change frame size limit to 4096
Change framesize limit to 4096 to support 4K.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 17:25:43 +08:00
b4111e3234 MLK-23250-01: arm64: dts: imx8mp: disable audiomix
audiomix driver is not ready, disable it
to avoid bootup break.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-19 17:25:37 +08:00
5f5a9c97f5 mfd: Add audiomix support
Some of the i.MX SoCs have a IP for interfacing the audio dedicated IPs with
clocks, resets and interrupts, plus some DSP specific control registers.
To allow the functionality to be split between drivers, this MFD driver is
added that has only two purposes: register the devices and map the entire
register addresses. Everything else is left to the dedicated drivers that will
bind to the registered devices.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2020-01-18 22:01:33 +08:00
fd3113259b MLK-23229: arm64: dts: remove CSI1_PHY_REF clock for i.MX8MN MIPI CSI
Remove CSI1_PHY_REF clock for i.MX8MN MIPI CSI since it's not being used.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 23:16:15 +08:00
d0d7f9b0d4 MLK-23227-11: media: imx: set panic threshold in ISI
Set panic threshold for Y, U, V output buffer in ISI for different version

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:51:08 +08:00
6528126123 MLK-23227-10: arm64: dts: use no-reset-control property in ISI of i.MX8QM/QXP
For i.MX8MN/MP, dispmix/mediamix subsystem use GPR to do bus reset, but
for i.MX8QM/QXP, it doesn't. So add no-reset-control property in dts for
i.MX8QXP and QM to distinguish.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:50:56 +08:00
99d739fc61 MLK-23227-9: media: imx: use no-reset-control property in ISI of i.MX8MP
For i.MX8MN platform, it uses dispmix-reset driver to control bus reset,
clock enable for LCDIF, DSI, CSI and ISI in dispmix GPR. But for i.MX8MP,
driver for mediamxi GPR isn't ready, so use no-reset-control property in
dts to skip parse reset node.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:50:41 +08:00
222af43058 MLK-23227-8: media: imx: remove CSI PHY clock operation
Remove CSI PHY clock operation because MIPI CSI only need clock
for CSI core.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:50:27 +08:00
3df0a32266 MLK-23227-7: media: imx: add multi instance for MIPI CSI driver
Add multi instance for Samsung MIPI CSI receiver driver.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:49:25 +08:00
9b30e41c89 MLK-23227-6: media: imx: add driver support for ISI of i.MX8MP
Add drivers support for ISI of i.MX8MP.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:49:02 +08:00
20450b6e8c MLK-23227-5: media: imx: refine soc version match method for ISI
Because there are three ISI version and CHNL_STS[BUF1_ACTIVE],
CHNL_STS[BUF2_ACTIVE] have reverse definition in new version,
please refer to commit fe2655a720 ("LF-356: media: imx8 isi:
fix buffer active bit change for QXP C0") for more information.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:48:18 +08:00
df5b6d07dd MLK-23227-4: media: imx: add input image source port selection as platform data
Image will be sourced from input port of the Pixel Link Crossbar. For different
soc, it has some difference, as bellow:

For i.MX8QM/QXP,
  Pixel Link input 0 => DC0,
  Pixel Link input 1 => DC1,
  Pixel Link input 2 => MIPI CSI0,
  Pixel Link input 3 => MIPI CSI1,
  Pixel Link input 4 => HDMI,
  Pixel Link input 4 => Parallel CSI,
  Pixel Link input 5 => MEM,
HDMI and Parallel CSI share the same input port.

For i.MX8MN
  Pixel Link input 0 => MIPI CSI0,
  Pixel Link input 1 => MIPI CSI1,
Don't support other port.

So add it platform data for ISI pixel-link port selection

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:48:00 +08:00
1254f6a154 MLK-23227-3: media: imx: add ISI IER register as platform data
IER[24:16] used to enable/disable ISI line buffer panic, overflow
generation of interrupt to the processor. With the improvement of
ISI, there are three version for it and have some changes in IER
bit definition. So add it as platform data for different version.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:47:46 +08:00
22ceb20e96 MLK-23227-2: arm64: dts: add ISI, CSI, OV5640 device node for i.MX8MP
Add ISI, MIPI CSI and OV5640 device node for i.MX8MP platform. i.MX8MP evk
board support dual mipi csi interfaces. Because the two csi interface share
the same RST, PWDN and MCLK pin, which will cause some problem when user
change camera work sequence, so disable the second one until fix the issue
on board.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:47:32 +08:00
8b914f5621 MLK-23227-1: arm64: dts: remove mediamix-reset device node for i.MX8MP
Remove mediamix-reset and its child node in dts because mediamix reset
driver for i.MX8MP is not ready;

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2020-01-17 22:46:34 +08:00
bc220fa0ca MGS-5488-2 arm64: dtsi: Add resmem node for imx8mp.
Add resmem node for imx8mp, add cma config to this node.

Signed-off-by: Ella Feng <ella.feng@nxp.com>
Reviewed-by: Jian Li <jian.li@nxp.com>
2020-01-17 21:47:31 +08:00
9c25ea25cc MGS-5488-1 arm64: dtsi: Fix GPU 3D shader clk.
Should use IMX8MP_CLK_GPU3D_SHADER_DIV instead of IMX8MP_CLK_DUMMY clk.

Signed-off-by: Ella Feng <ella.feng@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
2020-01-17 21:47:31 +08:00
8ee6d93d89 MLK-23248 gpu: imx: lcdifv3: correct panic enable register typo
The LCDIFv3 panic threshold enable register should be
'LCDIFV3_INT_ENABLE_D1' instead of 'LCDIFV3_PANIC0_THRES'.
So correct it.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-17 12:34:57 +08:00
3b2e5b3755 MLK-23245 gpu: imx: lcdifv3: correct panic thresholds calculation
According to the LCDIFv3 specification, the input pixel
FIFO size is 8K(512 * 128bit) and the panic threshold
low and high should be chosen from 0 to 511, so correct
the thresholds calculation.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Jian Li <jian.li@nxp.com>
2020-01-17 09:45:14 +08:00
58b33e87cb MLK-23240 clk: imx8mp: Correct/Add frequency for audio/video PLL
Add new frequency support for video PLL, and there is restriction
for audio PLL that the frequency is up to 650MHz, correct them as
well.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Tested-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2020-01-16 13:26:21 +08:00
137a01d9e8 MLK-23234-11 arm64: dts: imx8mp-evk: add dtb to support RM67191
Add a new dtb 'imx8mp-evk-rm67191.dtb' to support rm67191
mipi panel display on i.MX8MP EVK board.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:15:46 +08:00
50315e5a6d MLK-23234-10 arm64: dts: imx8mp-evk: enable adv7535 display
Enable LCDIFv3 -> SEC DSIM -> ADV7535 display pipeline
on i.MX8MP EVK board by default.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:15:46 +08:00
5c127b72ea MLK-23234-9 drm/imx: sec-dsim: bypass mediamix resets on imx8mp
Bypass the mediamix resets for dsim on imx8mp temporarily,
since on imx8mp platform, the mediamix resets code is not
ready and the imx8mp ATF has done this resets for DSIM.
And after the reset driver code is ready, this bypass will
be removed then.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:10:58 +08:00
05aa60a193 MLK-23234-8 drm/imx: sec-dsim: add imx8mp compatible
Add a compatible string which includes 'imx8mp' for
SEC DSIM platform driver.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:10:58 +08:00
cda6e56603 MLK-23234-7 drm/imx: core: add LCDIFv3 support
Allows the LCDIFv3 to be one of the supported
client components. And set the 'legacyfb_depth'
of LCDIFv3 to be 32.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:10:58 +08:00
e8f4eba1d0 MLK-23234-6 drm/imx: add LCDIFv3 DRM/KMS driver
This is a new DRM/KMS driver for LCDIFv3 controller
which conforms to the IMX DRM Core framework. It
provides support for CRTCs, Planes and mode config
of KMS.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:10:58 +08:00
128add0066 MLK-23234-5 arm64: imx_v8_defconfig: enable IMX_LCDIFV3_CORE
Enable the 'IMX_LCDIFV3_CORE' config by default in ARM64
defconfig.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:10:58 +08:00
95f56808b1 MLK-23234-4 gpu: imx: add LCDIFv3 core driver
The LCDIFv3 core driver is responsible to provide
controller registers configuration and create the
platform devices for the child port nodes. And the
platform devices later will attach to the related
DRM/KMS drivers via name match. And the LCDIFv3 is
completely different from the LCDIF controller
which is used on imx8mm and imx8mn platforms.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:10:58 +08:00
6c5cd919d7 MLK-23234-3 arm64: dts: imx8mp: add 'blk-ctl' property for lcdif1
Add the 'blk-ctl' property for lcdif1 which is used to
do the lcdif controller reset during probe stage to
avoid any conflict with uboot splash screen settings.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:10:58 +08:00
a6374fb4cc MLK-23234-2 arm64: dts: imx8mp: add blk-ctl node for mediamix
The block control module in mediamix is responsible for
clocks gating, sub-modules reset and other module control
for lcdif, dsi, csi, isp, isi and etc sub-modules which
are included in the mediamix. So create a device node to
simplify the usages.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:10:58 +08:00
18a80d652e MLK-23234-1 arm64: dts: imx8mp: correct cfg clock for mipi_dsi
The 'cfg' clock for mipi dsi is used for register
accesses and the mipi apb clock should be enabled
for this purpose, so correct it in the mipi dsi
device node.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2020-01-15 16:10:58 +08:00
7f41c62a20 MLK-23216-9 dt-bindings: usb: add "nxp,cbtl04gp" for typec switch
Adds compatible string for "nxp,cbtl04gp", which is also super speed
mux switch for type-c orientation, controlled by one GPIO.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-01-15 15:26:00 +08:00
3439580529 MLK-23216-8 dt-bindings: phy-imx8mq-usb: add imx8mp support
imx8mp SoC has the similar USB3 PHY with different version than
imx8mq, add compatible string "fsl,imx8mp-usb-phy", which has
the same properties.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-01-15 15:26:00 +08:00
11790a5211 MLK-23216-7 usb: dwc3: imx8mp: Add device tree binding
iMX8MP USB3 integrate Synopsys DesignWare Cores SuperSpeed
USB 3.0 Controller 3.30b IP, the glue layer is added to support
wakeup from low power mode.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-01-15 15:26:00 +08:00
2db3ced9af MLK-23216-6 Revert "usb: dwc3: Set default mode for DWC_usb3 v3.30a and higher"
This reverts commit 89a9cc4751.
Don't limit DRD for higher IP version.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-01-15 15:26:00 +08:00
d0307f1e31 MLK-23216-5 arm64: dts: imx8mp-evk: enable usb and typec
usb0 with typec is enabled as dual role port, and usb1 with type-A
socket is enabled as host only port. Make IMX8MP_CLK_HSIO_ROOT as
init-on-array because currently usb power domain is not ready, this
clock should be controlled by hsiomix power domain.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-01-15 15:26:00 +08:00
7d347fa0e9 MLK-23216-4 arm64: dtsi: imx8mp: add usb support
Use parent and child node as we need a glue layer driver
to support wakeup. Adds snps,dis_u2_susphy_quirk property
because currently there is one issue, USB2 PHY suspend
will make host can't work with USB3 device; Adds
snps,dis_u3_susphy_quirk for now to avoid gadget command
timeout.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-01-15 15:26:00 +08:00
30a7009416 MLK-23216-3 usb: host: xhci-plat: add XHCI_NO_64BIT_SUPPORT quirk
Set the quirk flag of XHCI_NO_64BIT_SUPPORT if the XHC actually does
not support 64-bit address memory pointers on some platforms.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-01-15 15:26:00 +08:00
bca755afa8 MLK-23216-2 phy: freescale: imx8mq-usb: add imx8mp support
imx8mp SoC has the similar phy as imx8mq but with a few different
settings for ref clock.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-01-15 15:26:00 +08:00
e2dfe06c74 MLK-23216-1 usb: dwc3: add imx865 usb3 glue layer driver
iMX8MP integrate DWC3 core and adds wakeup support, the glue layer
mainly used to support low power suspend.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-01-15 15:26:00 +08:00
62b9c2b5a5 MGS-5485-2 [#imx-1870] fix system out of memory in gpu database
gputop patch added gcvDB_CONTIGUOUS and gcvDB_COMMAND_BUFFER types,
these need create more system memory to maintain database frequently,
gpu out of memory issue happen when run openGL ES CTS on imx6 boards,

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

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

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

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

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

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

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

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2020-01-15 00:32:12 +08:00
419045d4b1 MGS-5301 dts: arm64: imx8mp: Add GPU 3D/2D/VIP support
Add GPU 3D/2D/VIP support for 8mp evk board.
Enlarge cma to 960M. Also enlarge GPU reserve memory to 256M.

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

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: ming_qian <ming.qian@nxp.com>
2020-01-14 10:08:39 +08:00
6fd220205d MLK-23228-4 clk: imx: imx8mp: fix a53 cpu clock
A53 CCM clk root only accepts input up to 1GHz, however
the A53 core could run above 1GHz which voliates the CCM limitation.

There is a CORE_SEL slice before A53 core, we need configure the
CORE_SEL slice source from ARM PLL, not A53 CCM clk root.

The A53 CCM clk root should only be used when need to change ARM PLL
frequency.

Add arm_a53_core clk that could source from arm_a53_div and arm_pll_out.
Configure a53 ccm root sources from 800MHz sys pll
Configure a53 core sources from arm_pll_out
Enable arm_pll_out to avoid disable the clock when set a53 core parent.

Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-01-13 18:40:34 +08:00
414748562d MLK-23228-3 clk: imx: imx8mn: fix a53 cpu clock
A53 CCM clk root only accepts input up to 1GHz, however
the A53 core could run above 1GHz which voliates the CCM limitation.

There is a CORE_SEL slice before A53 core, we need configure the
CORE_SEL slice source from ARM PLL, not A53 CCM clk root.

The A53 CCM clk root should only be used when need to change ARM PLL
frequency.

Add arm_a53_core clk that could source from arm_a53_div and arm_pll_out.
Configure a53 ccm root sources from 800MHz sys pll
Configure a53 core sources from arm_pll_out
Enable arm_pll_out to avoid disable the clock when set a53 core parent.

Fixes: 96d6392b54 ("clk: imx: Add support for i.MX8MN clock driver")
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-01-13 18:40:33 +08:00
a5a750b512 MLK-23228-2 clk: imx: imx8mm: fix a53 cpu clock
A53 CCM clk root only accepts input up to 1GHz, however
the A53 core could run above 1GHz which voliates the CCM limitation.

There is a CORE_SEL slice before A53 core, we need configure the
CORE_SEL slice source from ARM PLL, not A53 CCM clk root.

The A53 CCM clk root should only be used when need to change ARM PLL
frequency.

Add arm_a53_core clk that could source from arm_a53_div and arm_pll_out.
Configure a53 ccm root sources from 800MHz sys pll
Configure a53 core sources from arm_pll_out
Enable arm_pll_out to avoid disable the clock when set a53 core parent.

Fixes: ba5625c3e2 ("clk: imx: Add clock driver support for imx8mm")
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-01-13 18:40:33 +08:00
abe1b58ae5 MLK-23228-1 clk: imx: imx8mq: fix a53 cpu clock
A53 CCM clk root only accepts input up to 1GHz, however
the A53 core could run above 1GHz which voliates the CCM limitation.

There is a CORE_SEL slice before A53 core, we need configure the
CORE_SEL slice source from ARM PLL, not A53 CCM clk root.

The A53 CCM clk root should only be used when need to change ARM PLL
frequency.

Add arm_a53_core clk that could source from arm_a53_div and arm_pll_out.
Configure a53 ccm root sources from 800MHz sys pll
Configure a53 core sources from arm_pll_out
Enable arm_pll_out to avoid disable the clock when set a53 core parent.

Fixes db27e40b27 ("clk: imx8mq: Add the missing ARM clock")
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-01-13 18:40:33 +08:00
b815988854 LF-762: media: correct multi instance management for CSI camera
CSI and Max9286 should be disabled when there is no any other
instance is running.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2020-01-13 11:18:00 +08:00
f377416770 net: stmmac: platform: Fix MDIO init for platforms without PHY
The current implementation of "stmmac_dt_phy" function initializes
the MDIO platform bus data, even in the absence of PHY. This fix
will skip MDIO initialization if there is no PHY present.

Fixes: 7437127 ("net: stmmac: Convert to phylink and remove phylib logic")
Acked-by: Jayati Sahu <jayati.sahu@samsung.com>
Signed-off-by: Sriram Dash <sriram.dash@samsung.com>
Signed-off-by: Padmanabhan Rajanbabu <p.rajanbabu@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
f3d45d9a4f net: stmmac: tc: Fix TAPRIO division operation
For ARCHs that don't support 64 bits division we need to use the
helpers.

Fixes: b60189e039 ("net: stmmac: Integrate EST with TAPRIO scheduler API")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
6d768b8894 net: stmmac: mmc: Add Frame Preemption counters on GMAC5+ cores
This can be useful for debug. Add these counters on GMAC5+ cores just
like we did for XGMAC.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
9cf5e7ca2d net: stmmac: xgmac3+: Add support for Frame Preemption
Adds the HW specific support for Frame Preemption on XGMAC3+ cores.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
a07fde062c net: stmmac: gmac5+: Add support for Frame Preemption
Adds the HW specific support for Frame Preemption on GMAC5+ cores.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
42aaf31ede net: stmmac: Add Frame Preemption support using TAPRIO API
Adds the support for Frame Preemption using TAPRIO API. This works along
with EST feature and allows to select if preemptable traffic shall be
sent during specific queues opening time.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
bd45b5607e net: stmmac: Integrate EST with TAPRIO scheduler API
Now that we have the EST code for XGMAC and QoS we can use it with the
TAPRIO scheduler. Integrate it into the main driver and use the API to
configure the EST feature.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
3d01dbb484 net: stmmac: Add basic EST support for XGMAC
Adds the support for EST in XGMAC cores. This feature allows to offload
scheduling of queues opening time to the IP.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
9acb5ff2a1 net: stmmac: Add basic EST support for GMAC5+
Adds the support for EST in GMAC5+ cores. This feature allows to offload
scheduling of queues opening time to the IP.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
c2aeeb4922 net: stmmac: Always use TX coalesce timer value when rescheduling
When we have pending packets we re-arm the TX timer with a magic value.

This changes the re-arm of the timer from 10us to the user-defined
coalesce value. As we support different speeds, having a magic value of
10us can be either too short or to large depending on the speed so we
let user configure it. The default value of the timer is 1ms but it can
be reconfigured by ethtool.

Changes from v1:
- Reword commit message (Jakub)

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
c8f065cb2c net: stmmac: Let TX and RX interrupts be independently enabled/disabled
By using this mechanism we can get rid of the not so nice method of
scheduling TX NAPI when the RX was scheduled. No bandwidth reduction was
seen with this change.

Changes from v1:
- Remove useless comment (Jakub)
- Do not bind the TX clean to NAPI budget (Jakub)

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
d2f2d7cf62 net: stmmac: Print more information in DebugFS DMA Capabilities file
DMA Capabilites have grown but the DebugFS that shows this info has not
been updated. Lets add the missing information.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
744f444fb2 net: stmmac: Always arm TX Timer at end of transmission start
If TX Coalesce timer is enabled we should always arm it, otherwise we
may hit the case where an interrupt is missed and the TX Queue will
timeout.

Arming the timer does not necessarly mean it will run the tx_clean()
because this function is wrapped around NAPI launcher.

Fixes: 9125cdd1be ("stmmac: add the initial tx coalesce schema")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
1bb669aa64 net: stmmac: Enable 16KB buffer size
XGMAC supports maximum MTU that can go to 16KB. Lets add this check in
the calculation of RX buffer size.

Fixes: 7ac6653a08 ("stmmac: Move the STMicroelectronics driver")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
1c4fa3c5cc net: stmmac: 16KB buffer must be 16 byte aligned
The 16KB RX Buffer must also be 16 byte aligned. Fix it.

Fixes: 7ac6653a08 ("stmmac: Move the STMicroelectronics driver")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
d0f4a9eddc net: stmmac: RX buffer size must be 16 byte aligned
We need to align the RX buffer size to at least 16 byte so that IP
doesn't mis-behave. This is required by HW.

Changes from v2:
- Align UP and not DOWN (David)

Fixes: 7ac6653a08 ("stmmac: Move the STMicroelectronics driver")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
b775a158cb net: stmmac: xgmac: Clear previous RX buffer size
When switching between buffer sizes we need to clear the previous value.

Fixes: d6ddfacd95 ("net: stmmac: Add DMA related callbacks for XGMAC2")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
31204975e3 net: stmmac: Only the last buffer has the FCS field
Only the last received buffer contains the FCS field. Check for end of
packet before trying to strip the FCS field.

Fixes: 88ebe2cf7f ("net: stmmac: Rework stmmac_rx()")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
cf9883e86d net: stmmac: Do not accept invalid MTU values
The maximum MTU value is determined by the maximum size of TX FIFO so
that a full packet can fit in the FIFO. Add a check for this in the MTU
change callback.

Also check if provided and rounded MTU does not passes the maximum limit
of 16K.

Changes from v2:
- Align MTU before checking if its valid

Fixes: 7ac6653a08 ("stmmac: Move the STMicroelectronics driver")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
be02a7524c net: stmmac: Determine earlier the size of RX buffer
Split Header feature needs to know the size of RX buffer but current
code is determining it too late. Fix this by moving the RX buffer
computation to earlier stage.

Changes from v2:
- Do not try to align already aligned buffer size

Fixes: 67afd6d1cf ("net: stmmac: Add Split Header support and enable it in XGMAC cores")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
66c78e3ca7 net: stmmac: selftests: Needs to check the number of Multicast regs
When running the MC and UC filter tests we setup a multicast address
that its expected to be blocked. If the number of available multicast
registers is zero, driver will always pass the multicast packets which
will fail the test.

Check if available multicast addresses is enough before running the
tests.

Fixes: 091810dbde ("net: stmmac: Introduce selftests support")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
e44d9285ac net: stmmac: dwc-qos: avoid clk and reset for acpi device
There are no clocks, resets or gpios referenced by Tegra ACPI
device so don't access clocks, resets or gpios interface with
ACPI device.

Clocks, resets and GPIOs for ACPI devices will be handled via
ACPI interface.

Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
d35f63899c net: stmmac: reset Tx desc base address before restarting Tx
Refer to the databook of DesignWare Cores Ethernet MAC Universal:

6.2.1.5 Register 4 (Transmit Descriptor List Address Register

If this register is not changed when the ST bit is set to 0, then
the DMA takes the descriptor address where it was stopped earlier.

The stmmac_tx_err() does zero indices to Tx descriptors, but does
not reset HW current Tx descriptor address. To fix inconsistency,
the base address of the Tx descriptors should be rewritten before
restarting Tx.

Signed-off-by: Jongsung Kim <neidhard.kim@lge.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
973d5d07db page_pool: do not release pool until inflight == 0.
The page pool keeps track of the number of pages in flight, and
it isn't safe to remove the pool until all pages are returned.

Disallow removing the pool until all pages are back, so the pool
is always available for page producers.

Make the page pool responsible for its own delayed destruction
instead of relying on XDP, so the page pool can be used without
the xdp memory model.

When all pages are returned, free the pool and notify xdp if the
pool is registered with the xdp memory system.  Have the callback
perform a table walk since some drivers (cpsw) may share the pool
among multiple xdp_rxq_info.

Note that the increment of pages_state_release_cnt may result in
inflight == 0, resulting in the pool being released.

Fixes: d956a048cd ("xdp: force mem allocator removal and periodic warning")
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
5a7dd16286 net: stmmac: xgmac: Do not enable TBU interrupt
Now that TX Coalesce has been rewritten we no longer need this
additional interrupt enabled. This reduces CPU usage.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
379977e8ae net: stmmac: Rework TX Coalesce logic
Coalesce logic currently increments the number of packets and sets the
IC bit when the coalesced packets have passed a given limit. This does
not reflect very well what coalesce was meant for as we can have a large
number of packets that are coalesced and then a single one, sent later
on that has the IC bit.

Rework the logic so that it coalesces only upon a limit of packets and
sets the IC bit for large number of packets.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
49f00ac960 net: stmmac: Tune-up default coalesce settings
Tune-up the defalt coalesce settings for optimal values. This gives the
best performance in most of the use-cases.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
93dcfda5f9 net: stmmac: xgmac: Remove uneeded computation for RFA/RFD
RFA and RFD should not be dependent on FIFO size. In fact, the more FIFO
space we have, the later we can activate Flow Control. Let's use
hard-coded values for RFA and RFD for all FIFO sizes with the exception
of 4k, which is a special case.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
c085cf07cd net: stmmac: gmac4+: Remove uneeded computation for RFA/RFD
RFA and RFD should not be dependent on FIFO size. In fact, the more FIFO
space we have, the later we can activate Flow Control. Let's use
hard-coded values for RFA and RFD for all FIFO sizes with the exception
of 4k, which is a special case.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
c169dc5e9c net: stmmac: Setup a default RX Coalesce value instead of the minimum
For performance reasons, sometimes using the minimum RX Coalesce value
is not optimal. Lets setup a default value that is optimal in most of
the use cases.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
c83f71b70c net: stmmac: Do not set RX IC bit if RX Coalesce is zero
We may only want to use the RX Watchdog so lets check if RX Coalesce
settings are non-zero and only set the RX Interrupt on Completion bit if
its not.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
294ef5f6ce net: stmmac: Implement UDP Segmentation Offload
Implement the UDP Segmentation Offload feature in stmmac. This is only
available in GMAC4+ cores.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
be560b23c3 net: stmmac: Rework stmmac_rx()
This looks over-engineered. Let's use some helpers to get the buffer
length and hereby simplify the stmmac_rx() function. No performance drop
was seen with the new implementation.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
185baa8382 net: stmmac: tc: Remove the speed dependency
XGMAC3 supports full CBS features with speeds that can go up to 10G so
we can now remove the maximum speed check of CBS.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
804535d499 net: stmmac: xgmac: Add C45 PHY support in the MDIO callbacks
Add the support for C45 PHYs in the MDIO callbacks for XGMAC. This was
tested using Synopsys DesignWare XPCS.

v2:
- Pull out the readl_poll_timeout() calls into common code (Andrew)

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
9cb62b47ba net: stmmac: gmac4+: Add Split Header support
GMAC4+ cores also support the Split Header feature.

Add the support for Split Header feature in the RX path following the
same implementation logic that XGMAC followed.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
f2d54bfb66 net: stmmac: add flexible PPS to dwmac 4.10a
All the registers and the functionalities used in the callback
dwmac5_flex_pps_config() are common between dwmac 4.10a [1] and
5.00a [2].

Reuse the same callback for dwmac 4.10a too.

Tested on STM32MP15x, based on dwmac 4.10a.

[1] DWC Ethernet QoS Databook 4.10a October 2014
[2] DWC Ethernet QoS Databook 5.00a September 2017

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
2020-01-10 15:36:05 +08:00
4ed69f30bb net: stmmac: Implement L3/L4 Filters in GMAC4+
GMAC4+ cores support Layer 3 and Layer 4 filtering. Add the
corresponding callbacks in these cores.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10 15:36:05 +08:00
c2aba4909d MLK-23225-2 can: flexcan: initialize all flexcan memory for ECC function
There is a NOTE at the section "Detection and correction of memory errors":
All FlexCAN memory must be initialized before starting its operation in
order to have the parity bits in memory properly updated. CTRL2[WRMFRZ]
grants write access to all memory positions that require initialization,
ranging from 0x080 to 0xADF and from 0xF28 to 0xFFF when the CAN FD feature
is enabled. The RXMGMASK, RX14MASK, RX15MASK, and RXFGMASK registers need to
be initialized as well. MCR[RFEN] must not be set during memory initialization.

Memory range from 0x080 to 0xADF, there are reserved memory (unimplemented
by hardware), these memory can be initialized or not.

Initialize all FlexCAN memory before accessing them, otherwise, memory
errors may be detected. The internal region cannot be initialized when
the hardware does not support ECC.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-10 14:12:26 +08:00
3bfbaaef55 MLK-23225-1 can: flexcan: add correctable errors correction when HW supports ECC
commit cdce844865 ("can: flexcan: add vf610 support for FlexCAN")
From above commit by Stefan Agner, the patch just disables
non-correctable errors interrupt and freeze mode. It still can correct
the correctable errors since ECC enabled by default after reset (MECR[ECCDIS]=0,
enable memory error correct) if HW supports ECC.

commit 5e269324db ("can: flexcan: disable completely the ECC mechanism")
From above commit by Joakim Zhang, the patch disables ECC completely (assert
MECR[ECCDIS]) according to the explanation of FLEXCAN_QUIRK_DISABLE_MECR that
disable memory error detection. This cause correctable errors cannot be
corrected even HW supports ECC.

The error correction mechanism ensures that in this 13-bit word, errors
in one bit can be corrected (correctable errors) and errors in two bits can
be detected but not corrected (non-correctable errors). Errors in more than
two bits may not be detected.

If HW supports ECC, we can use this to correct the correctable errors detected
from FlexCAN memory. Then disable non-correctable errors interrupt and freeze
mode to avoid that put FlexCAN in freeze mode.

This patch adds correctable errors correction when HW supports ECC, and
modify explanation for FLEXCAN_QUIRK_DISABLE_MECR.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-10 14:12:26 +08:00
eb8cfa563e LF-765 [8QM_MEK/8QXP_MEK]mxc:vpu_malone: add FRAME_SKIP status to record skip-frame
Add 'FRAME_SKIP' status to record 'MEDIA_PLAYER_SKIPPED_FRAME_ID'
frame. Instead of use 'FRAME_READY' that will lead to this buffer
no chance to re-add to available buffer queue.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
2020-01-09 18:05:32 +08:00
7c025b33e6 LF-741: ARM: dts: imx6qdl-sabresd: disable snvs_pwrkey
There are snvs design issue on legacy i.mx6q/dl chip so gpio key used
instead of snvs_pwrkey on i.mx6qdl-sabresd board. Disable snvs_pwrkey to
match board design though there is another software workaround for such
design issue in the future:
https://lore.kernel.org/linux-arm-kernel/20191125161210.8275-1-robin@protonic.nl/

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit 26e4d220c335f2225fc35ba7f28acc5671e5483c)
2020-01-10 00:43:05 +08:00
a5433563ff MLK-13477: ARM: dts: imx6sll-evk: add charger driver
Add charger driver in dts.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
(cherry picked from commit b0eeefe99b174fbf281bc71de8aece03f33a3643)
2020-01-10 00:43:05 +08:00
eb04f8bcc1 MLK-23215-2 dts: arm64: imx8mp: add the rpmsg support
Add the RPMSG support on iMX8MP EVK board.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Andy Duan <fugang.duan@nxp.com>
2020-01-09 14:14:00 +08:00
ac27cfd234 MLK-23215-1 CLK: imx8mp: add the rpmsg support
Add the MU clock mandatory required by MU module and mailbox
would be used in RPMSG.
Check M core is enabled or not, to make sure M core's uart consol
work well.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Andy Duan <fugang.duan@nxp.com>
2020-01-09 14:13:59 +08:00
2b26c0dade MLK-23222 net: stmmac: add clocks management for gmac driver
Add clocks mangement for gamc driver.
Only enable clocks when netif is running, otherwise
keep all clocks disabled. If the dwmac driver is built as
module, it also keeps clocks off when the module is removed.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-08 17:28:33 +08:00
78f2d96c67 MA-16211: imx8mp: vpu: Implement hantro vc8000e ioctl32
Implement hantro vc8000e ioctl32 for imx8mp

Signed-off-by: xiahong.bao <xiahong.bao@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2020-01-08 11:16:44 +08:00
03f54f151a MLK-23211-3: arm64: imx8mp: dts: enable vpu module
Enable g1/g2/vc8000e for m865 evk board

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2020-01-07 17:59:00 +08:00
ee2900a781 MLK-23211-2: arm64: imx8mp: dts: set proper vpu clk rate
Set clk rate 600M/600M for G1, 400M/600M for G2/VC8000E

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2020-01-07 17:59:00 +08:00
e9181a19c5 MLK-23211-1: arm64: imx8mp: vpu: add vc8000e driver
Add vc8000e driver source code

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2020-01-07 17:59:00 +08:00
8913b88302 MLK-23214 net: stmmac: correctly capture timestamp for PTPv2 EVENT
Current ptp driver, for event 'HWTSTAMP_FILTER_PTP_V2_EVENT',
it only takes timestamp for sync, Pdelay_req, Pdelay_resp evnets.

Then it causes below issue when test E2E case:
ptp4l[2479.534]: port 1: received DELAY_REQ without timestamp
ptp4l[2481.423]: port 1: received DELAY_REQ without timestamp
ptp4l[2481.758]: port 1: received DELAY_REQ without timestamp
ptp4l[2483.524]: port 1: received DELAY_REQ without timestamp
ptp4l[2484.233]: port 1: received DELAY_REQ without timestamp
ptp4l[2485.750]: port 1: received DELAY_REQ without timestamp
ptp4l[2486.888]: port 1: received DELAY_REQ without timestamp
ptp4l[2487.265]: port 1: received DELAY_REQ without timestamp
ptp4l[2487.316]: port 1: received DELAY_REQ without timestamp

For dwmac v5.10a, enabling all events and general messages
timestamps by setting bits 17/16 to 01 and clearing bits 15,14
to 0, which can support rx filter including SYNC, Follow_Up,
Delay_Req, Delay_Resp, Pdelay_Req, Pdelay_Resp and
Pdelay_Resp_Follow_U pmessages.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-07 17:41:58 +08:00
a8512d04d2 LF-711:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:stream may hang due to the event
msg hasn't process in time

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

vpu_windsor may have the same issue.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-01-07 13:48:51 +08:00
b1f0f76611 MLK-23195-4 tool: perf: imx8mp-ddr: correct the master ID
The i.MX8MP DDR Perf JSON file only give the LSB 5 bits, also need point
out the MSB 3 bits for each master. This patch corrects the master ID
and makes some masters name more readable.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-07 10:32:56 +08:00
0a2228ab23 MLK-23195-3 perf/imx_ddr: speed up overflow frequency of cycle counter
For i.MX8MP, we cannot ensure that cycle counter overflow occurs at
least 4 times as often as other events. Due to byte counters will count for
any event configured, it will overflow more often. And if byte counters
oveflow that related counters would stop since they share the
COUNTER_CNTL. We can speed up cycle counter overflow frequency by
setting counter parameter(CP) field of cycle counter.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-07 10:32:56 +08:00
05d68c514f MLK-23195-2 perf/imx_ddr: add stop counter support for i.MX8MP
DDR perf driver now only supports free running counter, add stop counter
support which is compabile with free running counter, since i.MX8MP is
not free running.

Add spinlock for counter value update and clear.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-07 10:32:55 +08:00
a6950601f3 MLK-23195-1 arch: arm64: config: buildin ddr perf driver
Buildin ddr perf driver as it is used much often.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-07 10:32:55 +08:00
93aeeb232b MLK-23210 ARM64: dts: imx8mp: let mac name string correct mapping to fuse table
Although MAC fuse is not hard wired and is fully handled by
software, but we judge the correct mapping by below name string:

IP        fuse table string      uboot/kernel net interface
-----------------------------------------------------------
ENET:      ENET1     MAC1        eth0
EQOS TSN:  ENET2     MAC2        eth1

The ethernet RJ45 labels on imx8mp EVK board:
IP         REVA      Next
-----------------------------------
ENET:     ENET1     ENET1
EQOS TSN: ENET0     ENET2

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-07 09:07:27 +08:00
6c97820060 MLK-23192-2: defconfig: imx8mp: Add coresight trace support
Add configs to support arm coresight trace.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
2020-01-07 08:59:27 +08:00
8eadfdb6bb MLK-23192-1: dts: imx8mp: Add coresight component dts node
Add coresight component: etm, funnel, etf and etr

usage example for coresight trace:

    echo 1 >/sys/bus/coresight/devices/tmc_etr0/enable_sink
    echo 1 >/sys/bus/coresight/devices/etmx/enable_source(x=0,1,2,3)
    cat /dev/tmc_etr0 > trace.data

    use ptm2human(https://github.com/hwangcc23/ptm2human) to show trace data:
    ptm2human -e -i trace.data

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
2020-01-07 08:59:27 +08:00
f4a803794e LF-710 arm: dts: add touch support for imx7ulp-evkb board
Add goodix touch support for imx7ulp-evkb board.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-06 16:11:44 +08:00
beafe9f8ed LF-690:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor:extends the range of frame rate from integers to real numbers
currently, vpu encoder only support integer frame rate,
we need improve the firmware to support fractional frame rate
so extends the range of frame rate from integers to real numbers

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

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-01-06 14:19:14 +08:00
d024584f79 MLK-23190-4 ARM64: dts: imx8mp: add pwm support
Add pwm1/2/4 nodes support.
Enable pwm1 on pin GPIO1_IO01 for DSI_BL_PWM
       pwm2 on pin GPIO1_IO11 for LVDS_BL_PWM
       pwm4 on pin SAI5_RXFS for J21-32

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2020-01-06 13:38:05 +08:00
7b6e59bd98 MLK-23190-3 ARM64: dts: imx8mp: add ecspi2 support
Add ecspi2 node to support ECSPI on i.MX8mp.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2020-01-06 13:38:05 +08:00
2179e10e4e MLK-23190-2 ARM64: dts: imx8mp: correct i2c3 compatible string
Correct i2c3 compatible string.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2020-01-06 13:38:05 +08:00
dc30a465d4 MLK-23190-1 ARM64: dts: imx8mp: enable sdma1
Correct sdma1 setting and enable it by default.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2020-01-06 13:38:05 +08:00
32dde8e396 LF-695 arm: dts: imx6qdl-sabreauto: increase the drive strength for usdhc1
On sabreauto board, the usdhc1 is connected to the base board, to
make sd card work stable on base board sd slot, need to increase
the I/O drive strength.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2020-01-03 19:04:21 +08:00
16cb58eb8e MLK-23189-4 arch: arm64: dts: imx8mp-evk: add pinctrl for CAN
Add pinctrl for CAN on i.MX8MP EVK board.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-03 16:40:40 +08:00
55e1e8dd44 MLK-23189-3 arch: arm64: dts: imx8mp: change per clock source for CAN
The source of per clock should be source 0 which connected to
can_clk_root.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-03 16:40:40 +08:00
58ad1d8d20 MLK-23189-2 arch: arm64: dts: imx8mp: correct the name of stop mode property
The name of stop mode property should be "fsl,stop-mode".

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-03 16:40:40 +08:00
426c0b42c3 MLK-23189-1 arch: arm64: dts: imx8mp: remove unused interrupt for CAN
Remove the unused interrupt for CAN, this interrupt is for ECC and now
driver disabled ECC function.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-03 16:40:39 +08:00
86c5542c09 MLK-23118: can: flexcan: add flexcan driver for i.MX8MP
Add flexcan driver for i.MX8MP.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2020-01-03 16:40:39 +08:00
40d463b7fa MLK-23184 arm64: dts: imx8mp: Use OD typical voltage for 1.2GHz/1.6GHz
According to design timing requirement, when SoC is running at OD mode's
voltage/frequency, ARM can NOT run at ND voltage, choose OD mode's typical
voltage for 1.2GHz/1.6GHz.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2020-01-03 09:16:57 +08:00
8073f3451f MLK-23173-12 dt-bindings: net: imx-dwmac: add support of imx families
Add description for Ethernet imx8 families that integrate the
gmac IP version 5.10a.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:44:54 +08:00
52aa69dcc5 MLK-23173-11 clk: imx8mp: correct the enet_qos parent clock
enet_qos is for eqos tsn AXI bus clock whose clock source is from
ccm_enet_axi_clk_root, but depends on CCM_CCGR59 and CCM_CCGR64.
So correct enet_qos root clock's parent clock to sim_enet.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:44:43 +08:00
b148b07867 MLK-23173-10 arm64: dts: imx8mp-evk: enable flexspi nor
Enable flexspi nor flash.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:44:30 +08:00
f7e1932181 MLK-23173-9 arm64: dts: imx8mp-evk: enable i2c bus and i2c expander gpio
Enable i2c2,i2c3 bus and i2c expander gpio pca6416.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:44:11 +08:00
0c0277bf2b MLK-23173-08 ARM64: imx_v8_defconfig: build in stmmac core driver
Build in stmmac core driver for eqos tsn ethernet.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:43:57 +08:00
1866999018 MLK-23173-07 ARM64: dts: imx8mp-evk: add eqos tsn IP support
Add eqos tsn IP support for imx8mp evk board.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:43:43 +08:00
a40db8b5ee MLK-23173-06 net: stmmac: enable dwmac5 34Bits address width
Enable dwmac5 34Bits address width for imx.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:43:29 +08:00
56dffc1115 MLK-23173-05 net: stmmac: dwmac4_lib: increase the timeout for dma reset
Current timeout value is not enough for gmac5 dma reset
on imx8mp platform, increase the timeout range.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:43:13 +08:00
6f5599fd79 MLK-23173-04 net: stmmac: use platform_get_irq_byname_optional() to get optional irq
Use platform_get_irq_byname_optional() to get optional irq.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:42:53 +08:00
c1683124fb MLK-23173-03 MLK-23173-03 stmmac: platform: add "snps,dwmac-5.10a" IP compatible string
Add "snps,dwmac-5.10a" compatible string for 5.10a version,
and move some plat data from glue layer into platform layer.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:42:38 +08:00
e2bf3df4f6 MLK-23173-02 net: ethernet: dwmac: add Ethernet glue logic for NXP imx8 chip
NXP imx8 family chips support Synopsys MAC 5.10a IP.
This patch adds settings for logical glue logic:
- clocks
- dwmac address width
- low power wake up
- phy interface mode selection

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:42:23 +08:00
b610eb69f2 MLK-23173-01 net: phy: realtek: add support for RX delay enable on RTL8211F
Add RX delay enable support for RTL8211F PHY.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:42:15 +08:00
7fc02a74f2 LF-289 net: fec: request pmqos during low power
Request pmqos during low power for legacy imx6 ENET.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 16:41:52 +08:00
679d3ec79a Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (7 commits)
  LF-697 net: ethernet: freescale: sdk_fman: fix the build warnings
  MGS-5458 [#imx-1708] fix GPU/VIP coreIndex issue
  LF-408-2 [#imx-1873] disable 1M page for dynamic mapping
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2020-01-02 13:26:18 +08:00
28942017c5 LF-697 net: ethernet: freescale: sdk_fman: fix the build warnings
The patch fixes the build warnings by adding the comments 'fall through' to avoid the build warnings
The patch also initializes the value pgid_val to avoid the warning: ‘pgid_val’ may be used uninitialized
The patch should not and will not have any function impact.

drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c: In function ‘ValidateNextEngineParams’:
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c:1681:51: warning: this statement may fall through [-Wimplicit-fallthrough=]
In file included from drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c:40:
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c: In function ‘GetGenHdrCode’:
drivers/net/ethernet/freescale/sdk_fman/inc/error_ext.h:446:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
In file included from drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c:40:
drivers/net/ethernet/freescale/sdk_fman/inc/error_ext.h:446:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c:255:13: note: here
  255 |             case (HEADER_TYPE_ETH):
      |             ^~~~
In file included from drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c:40:
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c:278:13: note: here
  278 |             case (HEADER_TYPE_MINENCAP):
      |             ^~~~
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c: In function ‘BuildHmct’:
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c:673:32: warning: this statement may fall through [-Wimplicit-fallthrough=]
  673 |                         tmpReg = HMCD_INSRT_UDP_LITE;
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c:674:21: note: here
  674 |                     case (e_FM_PCD_MANIP_INSRT_BY_HDR_UDP):
      |                     ^~~~
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c: In function ‘FM_PORT_Config’:
arch/arm64/include/asm/io.h:36:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
   36 | #define __raw_writel __raw_writel
drivers/net/ethernet/freescale/sdk_fman/src/inc/types_linux.h:99:25: note: in expansion of macro ‘__raw_writel’
   99 | #define out_be32(a, v)  __raw_writel(__cpu_to_be32(v), a)
      |                         ^~~~~~~~~~~~
drivers/net/ethernet/freescale/sdk_fman/src/inc/types_linux.h:121:37: note: in expansion of macro ‘out_be32’
  121 | #define WRITE_UINT32(arg, data)     out_be32(&(arg), data)//*(volatile unsigned int *)(&(arg)) = (data)
      |                                     ^~~~~~~~
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:2404:13: note: in expansion of macro ‘WRITE_UINT32’
 2404 |             WRITE_UINT32( p_FmPort->p_FmPortBmiRegs->txPortBmiRegs.fmbm_tfp,
      |             ^~~~~~~~~~~~
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:2407:9: note: here
 2407 |         case (e_FM_PORT_TYPE_TX_10G):
      |         ^~~~
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:2435:60: warning: this statement may fall through [-Wimplicit-fallthrough=]
 2435 |             p_FmPort->p_FmPortDriverParam->noScatherGather =
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:2438:9: note: here
 2438 |         case (e_FM_PORT_TYPE_OH_HOST_COMMAND):
      |         ^~~~
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c: In function ‘FM_PORT_ModifyCounter’:
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:4268:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
 4268 |             if ((p_FmPort->portType == e_FM_PORT_TYPE_RX)
      |                ^
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:4273:9: note: here
 4273 |         case (e_FM_PORT_COUNTERS_ENQ_TOTAL):
      |         ^~~~
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c: In function ‘SetPcd’:
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:1396:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
 1396 |                 tmpReg = NIA_KG_CC_EN;
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c:1397:13: note: here
 1397 |             case (e_FM_PORT_PCD_SUPPORT_PRS_AND_KG):
      |             ^~~~
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c: In function ‘FM_GetCounter’:
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c:4804:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
 4804 |             if ((p_Fm->p_FmStateStruct->revInfo.majorRev == 4) ||
      |                ^
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c:4810:9: note: here
 4810 |         case (e_FM_COUNTERS_ENQ_TOTAL_FRAME):
      |         ^~~~
drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c: In function ‘fm_get_counter’:
drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c:1803:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
 1803 |   if (p_fm->p_FmStateStruct->revInfo.majorRev >= 6)
      |      ^
drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c:1806:2: note: here
 1806 |  case (e_FM_COUNTERS_ENQ_TOTAL_FRAME):
      |  ^~~~
drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c: In function ‘compat_copy_fm_pcd_cc_next_engine’:
drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c:378:33: warning: this statement may fall through [-Wimplicit-fallthrough=]
  378 |                 param->manip_id = compat_pcd_id2ptr(compat_param->manip_id);
      |                 ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c:379:13: note: here
  379 |             default:
      |             ^~~~~~~
drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c:405:40: warning: this statement may fall through [-Wimplicit-fallthrough=]
  405 |                 compat_param->manip_id = compat_pcd_ptr2id(param->manip_id);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c:406:13: note: here
  406 |             default:
      |             ^~~~~~~
In file included from drivers/net/ethernet/mscc/ocelot.h:21,
                 from drivers/net/ethernet/mscc/ocelot_tsn.c:12:
drivers/net/ethernet/mscc/ocelot_tsn.c: In function ‘ocelot_seq_gen_set’:
include/soc/mscc/ocelot.h:499:48: warning: ‘pgid_val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  499 | #define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
      |                                                ^~~~~~~~~~~~~~~~~
drivers/net/ethernet/mscc/ocelot_tsn.c:755:5: note: ‘pgid_val’ was declared here
  755 |  u8 pgid_val, fwdport;

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Cc: Madalin Bucur <madalin.bucur@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2020-01-02 13:24:07 +08:00
bd0fd2d5d9 MLK-23178 clk: imx: imx8mp: remove memrepair clock
memrepair clock needs to be on for HDMIMIX memrepair before
de-assert HDMIMIX reset. If the clock is run time off by Linux,
the memrepair will not be functional. Since there is no software
user in Linux side, let's remove this clock and leave it
default on.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-31 17:00:04 +08:00
2933b8891c MLK-23175 arm64: dts: imx8mp: Enable cpu-idle
Enable cpu-idle for i.MX8MP, system counter also needs to be added
as broadcast timer, 2 states supported as below:

root@imx8mpevk:~# cat /sys/devices/system/cpu/cpu0/cpuidle/state0/name
WFI
root@imx8mpevk:~# cat /sys/devices/system/cpu/cpu0/cpuidle/state1/name
cpu-pd-wait

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-12-31 10:40:19 +08:00
e688e85dac MGS-5458 [#imx-1708] fix GPU/VIP coreIndex issue
coreInfoArray use offset as coreIndex, not use hardware core

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

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

disabled 1M MMU page to fix unstable GPU problems.

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

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

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

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

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-12-31 01:38:57 +08:00
af67fd4209 Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (11 commits)
  LF-625 PCI: imx: pcie ep probe failed
  LF-637 pwm: imx27: Eliminate error message for defer probe
  MLK-22620: ASoC: imx-ak5558: Force tdm mode for ASRC case
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2019-12-30 17:04:18 +08:00
1332c8be1f MLK-23172 arm64: dts: imx8mp: Configure bus fabric clocks to overdrive frequency
According to design, for overdrive mode, NOC/NOC_IO/GIC need to run
at higher speed as below:

NOC: 1000MHz;
NOC_IO: 800MHz;
GIC: 500MHz;

Configure them to expected frequency by default.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
2019-12-30 16:55:19 +08:00
da2ec8c834 LF-625 PCI: imx: pcie ep probe failed
The atu_base should be assigned if the iatu_unroll_enabled is true.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-30 14:12:18 +08:00
e5d0756645 LF-637 pwm: imx27: Eliminate error message for defer probe
For defer probe error, no need to output error message which
will cause confusion.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
2019-12-30 11:09:06 +08:00
0885728776 MLK-22620: ASoC: imx-ak5558: Force tdm mode for ASRC case
In order to support the odd channels for ASRC case, we
force to enable TDM mode. In non-tdm case, we enable
multi lane to support multi channels, but limitation
is odd multi channels can't be supported.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-29 13:26:32 +08:00
1ed8c746fe LF-588: ARM: dts: imx6: correct reg_vdd3p0 source in
The source of reg_vdd3p0 should be from USB_VBUS instead of VDD_HIGH_IN
which is provied by PMIC. Correct it, otherwise below error will come out
on i.mx6sll-evk board since usb driver want to raise voltage to 3.2V and
mismatch is here(3.2V + 125mv = 3.325V > 3.3V max):

[    5.836553] SW2: unsupportable voltage range: 3325000-3300000uV
[    5.843066] regulator regulator.1: Failed to increase supply voltage: -22

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-12-28 05:05:38 +08:00
1507c127e2 arm64: dts: ls208xa: Remove dma-coherent from dwc3 nodes
ls208xa encounteded below USB failure when applying dma-coherent, remove it.
[   11.087839] xhci-hcd xhci-hcd.1.auto: Error while assigning device slot ID
[   11.094730] xhci-hcd xhci-hcd.1.auto: Max number of devices this xHCI host supports is 127.
[   11.103103] xhci-hcd xhci-hcd.0.auto: Error while assigning device slot ID
[   11.109985] xhci-hcd xhci-hcd.0.auto: Max number of devices this xHCI host supports is 127.
[   11.118348] usb usb2-port1: couldn't allocate usb_device
[   11.123680] usb usb4-port1: couldn't allocate usb_device

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-12-27 18:25:31 +08:00
e5569d9e14 LF-633-3 ARM64: dts: imx8qm: add bus recovery for i2c1
In order to avoid the bus busy status when read wm8960, add bus recovery
feature for i2c1.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-12-27 18:11:07 +08:00
fffbfb6ad2 LF-633-2 ARM64: dts: imx8qxp: add bus recovery for cm40_i2c
In order to avoid the bus busy status when read wm8960, add bus recovery
feature for cm40_i2c.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-12-27 18:11:07 +08:00
8d2f8a4723 LF-633-1 i2c: lpi2c: add bus recovery feature
Add bus recovery feature for LPI2C.
Need add gpio pinctrl, scl-gpios and sda-gpios configuration in dts.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-12-27 18:11:07 +08:00
69fdeab8df MLK-23170 arm64: dts: imx8mp: Add wdog support for evk board
Add watchdog support for i.MX8MP EVK board.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
2019-12-27 16:19:51 +08:00
cacbaeca03 LF-629: [8QM_MEK/8QXP_MEK]mxc:vpu_malone: donot set end_flag if scode type is BUFFFLUSH in low-latency mode
In low-latency mode, donot need set end_flag if scode type is
BUFFLUSH_PADDING_TYPE. Otherwise, firmware will ignore frame
threshold then may affect another instance performance.

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

Signed-off-by: ming_qian <ming.qian@nxp.com>
Acked-by: <shijie.qin@nxp.com>
2019-12-27 15:48:01 +08:00
b3b0eac7bd arm64: dts: ls208xa: Update qspi node properties for LS2088ARDB
LS2088ADB has one spansion flash s25fs512s of size 64M.

Update qspi dts entry for the board using compatibles as "jedec,spi-nor"
to probe flash successfully. Also, align properties with other board dts
properties.

Since device properties are different, so remove fsl, ls1021a-qspi.
ls1021a-qspi is to be used only for Big-endian verion of QSPI
controller. Use dt-bindings constants in interrupts instead of using
numbers.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
2019-12-27 11:58:30 +05:30
2f84118fd3 Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y:
  LF-603-2 video: fbdev: imx: mipi_dsi_samsung: remove mipi phy supply
  LF-603-1 arm: dts: imx7d: use power-domains for mipi phy

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2019-12-27 14:27:30 +08:00
d26a146b36 MLK-23167-3 arm64: dts: imx8mp: Improve DT files
Improve DT files by below:

1. Fix some nodes reg address format issue;
2. Sort nodes using either address or alphabet sequence;
3. Remove unnecessary code.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
2019-12-27 08:58:22 +08:00
ed45b2526a MLK-23167-2 pinctrl: imx8mp: Skip unnecessary of_match_device operation
Skip unnecessary of_match_device operation to simply code.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
2019-12-27 08:58:05 +08:00
b7ff0ae6a6 MLK-23167-1 arm64: dts: imx8mp: Add "fsl,imx8mm-anatop" as fallback compatible for anatop
Add "fsl,imx8mm-anatop" as fallback compatible for anatop node to support
reading SoC revision.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
2019-12-27 08:57:33 +08:00
71615ff805 MLK-23168 arm64: imx8mp: jailhouse dual linux
Add jailhouse dual linux dts. The 2nd linux use SDHC3 and UART4.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-26 18:31:40 +08:00
c02e642c3d LF-603-2 video: fbdev: imx: mipi_dsi_samsung: remove mipi phy supply
Since using power domains to handle the mipi phy power
management in gpcv2 driver for mipi phy domain, remove
the legacy unncessary regulator related code for mipi
phy.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-26 18:25:03 +08:00
5372899ed0 LF-603-1 arm: dts: imx7d: use power-domains for mipi phy
Since the gpcv2 driver has been changed to use
power domains for all the modules, so add the
'power-domains' property for mipi dsi and remove
previous 'mipi-phy' supply property for dphy
power management.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-26 18:24:22 +08:00
a904ae5784 MLK-23159-9 arm64: dts: freescale: Add i.MX8MP basic DT support
Add i.MX8MP SoC & board basic DT support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Ella Feng<ella.feng@nxp.com>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-12-26 10:28:09 +08:00
3f72ffaa34 MLK-23159-8 cpufreq: cpufreq-dt-platdev: Add i.MX8MP to platdev's blacklist
i.MX8MP uses operating-points-v2, add it to blacklist for proper
OPPs initialization.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-12-26 10:28:09 +08:00
9be72e3484 MLK-23159-7 cpufreq: imx-cpufreq-dt: Add i.MX8MP support
Add i.MX8MP cpufreq DT support for speed grading and market
segment check.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-12-26 10:28:09 +08:00
445a7b5d4b MLK-23159-6 soc: imx: Add i.MX8MP SoC ID driver support
Add support for i.MX8MP SoC ID driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-12-26 10:28:09 +08:00
347e4dade2 MLK-23159-5 arm64: imx_v8_defconfig: Enable CONFIG_CLK_IMX8MP by default
Select CONFIG_CLK_IMX8MP by default to enable i.MX8MP clock driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-12-26 10:28:09 +08:00
0cb5ca4280 MLK-23159-4 clk: imx: Add i.MX8MP clock driver
Add support for i.MX8MP clock driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-12-26 10:28:09 +08:00
f014bd8ad0 MLK-23159-3 arm64: imx_v8_defconfig: Enable CONFIG_PINCTRL_IMX8MP by default
Select CONFIG_PINCTRL_IMX8MP by default to support i.MX8MP pinctrl.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-12-26 10:28:09 +08:00
1b6842f56d MLK-23159-2 pinctrl: freescale: Add i.MX8MP pinctrl driver support
Add the pinctrl driver support for i.MX8MP.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-12-26 10:28:09 +08:00
9e9cba462b MLK-23159-1 dt-bindings: imx: Add pinctrl binding doc for i.MX8MP
Add binding doc for i.MX8MP pinctrl driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-12-26 10:28:09 +08:00
d7ba389e77 Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y:
  arm64: dts: layerscape: apply dma-coherent for dwc3 nodes
  LF-605 mmc: sdhci-of-esdhc: update tuning erratum A-008171
  LF-605 mmc: sdhci-of-esdhc: convert to use esdhc_tuning_window_ptr()

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2019-12-26 10:19:25 +08:00
bcae63bb27 arm64: dts: layerscape: apply dma-coherent for dwc3 nodes
Since dwc3 cache type has been set to cacheable, apply dma-coherent to
all dwc3 nodes accordingly.

Note: For LS1043A and LS1046A, since QE-HDLC still doesn't support
dma-coherent, we cannot directly revert cd1a4f3c (sdk: dts: ls104x move
dma-coherent from soc to its child nodes) to recover dma-coherent for
soc.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-12-25 15:11:02 +08:00
fc01006503 LF-605 mmc: sdhci-of-esdhc: update tuning erratum A-008171
There is an official update for eSDHC tuning erratum A-008171.
This patch is to implement the changes,
- Affect all revisions of SoC.
- Changes for tuning window checking.
- Hardware hits a new condition that tuning succeeds although
  the eSDHC might not have tuned properly for type2 SoCs
  (soc_tuning_erratum_type2[] array in driver). So check
  tuning window after tuning succeeds.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
2019-12-25 12:52:20 +08:00
5b1f47eb9d LF-605 mmc: sdhci-of-esdhc: convert to use esdhc_tuning_window_ptr()
Convert to use a new function esdhc_tuning_window_ptr() to
get tuning window start point and end point.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
2019-12-25 12:51:47 +08:00
a582a7306b Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (7 commits)
  LF-592 usb: chipidea: handle single role for usb role class
  LF-568-2: drm: gpu: bridge: cdns: Add force mode set flag
  LF-568-1: drm: bridge: cdns: dp: change bridge_enable/disable name
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2019-12-25 10:07:16 +08:00
f7841e1734 LF-592 usb: chipidea: handle single role for usb role class
If usb port is configed to be single role, but usb role class
is trying to set unavailable role, don't try to do role change.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-25 08:55:01 +08:00
e03224dd32 LF-568-2: drm: gpu: bridge: cdns: Add force mode set flag
In DRM framework, when hdmi/dp cable plugout/plugin in the same HDMI
sink, because the video mode is same, DRM will not call mode_set.
But for HDMI 2.0 sink the SCDC configurate will lost, and DP sink
linktraning status will lost too after cable plugout then plugin.

Currently, hdmi/dp driver will call mode_set function in HPD thread,
But the mode_set function is called out of DRM framework, and it have
chance to fail.
In the patch add force_mode_set flag, set the crtc_state->mode_changed
to force drm call mode_set when cable plugin.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-12-25 09:11:42 +08:00
3e030e3c1c LF-568-1: drm: bridge: cdns: dp: change bridge_enable/disable name
Change the bridge_enable/disable function name.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-25 09:11:02 +08:00
5c472cbfba MLK-11550-1: regulator: pfuze100: restore some registers after LPSR for pfuze3000
Some registers on pfuze3000 will lost after exit from LPSR, need restore them,
otherwise system may reboot with below command after system enter LPSR one time:

root@imx7d_all:~# echo enabled > /sys/class/tty/ttymxc0/power/wakeup
root@imx7d_all:~# echo mem > /sys/power/state

because LDOGCTL not recover as 1. Add 'fsl,lpsr-mode' property to this case,
please add this property if your board support LPSR mode as imx7d-12x12-lpddr3-arm2
board.

Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 4aa2a2a928)
2019-12-24 19:13:48 +08:00
17479f0f48 LF-590-2: ARM64: dts: imx8mq-evk: support switch enable/disable feature
On i.mx8mq-evk, sw1ab/sw1c could be enable/disable in runtime.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2019-12-24 19:13:48 +08:00
26807e4d1d LF-590-1: ARM64: dts: imx8mq-evk: correct pgc_vpu
Correct supply for vpu since it source from pgc_vpu which relies on
sw1c_reg.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2019-12-24 19:13:48 +08:00
0d7a95f593 LF-583 PCI: imx6q: turn off the refclk and set testpd mode when link is down
To save power consumption, turn off the REFCLK and set the test power
down mode when link is down during the initialization.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-24 10:04:41 +08:00
9537b1398c Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (23 commits)
  sdk_dpaa: ceetm: coding style cleanup
  sdk_dpaa: ceetm: enable building as a module
  sdk_dpaa: ceetm: export the ceetm_tx symbol
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2019-12-24 09:42:00 +08:00
d63e7593f3 sdk_dpaa: ceetm: coding style cleanup
Fix checkpatch warnings and use reverse Christmas tree variable ordering
throughout the driver.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-23 15:32:50 +02:00
475de1b3ad sdk_dpaa: ceetm: enable building as a module
Enable building the driver as a module by adding the required module
macros and creating the fsl_ceetm object file.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-23 15:32:50 +02:00
fe50fca501 sdk_dpaa: ceetm: export the ceetm_tx symbol
In order to enable building the driver as a module, export the ceetm_tx
symbol for the DPAA Ethernet driver to use.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-23 15:32:49 +02:00
00a778a4d2 sdk_dpaa: ceetm: remove references to qdisc_lookup
In order to enable building the driver as a module, remove the
references to the undefined qdisc_lookup symbol.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-23 15:32:49 +02:00
5663979a2d LF-562 arm: dts: add the vgen3 into pcie node
The VGEN_1V8 is used on SCH-28857 REV B sabresd board.
Add the according vgen3 into PCIe node.
Thus, the external OSC can keep toggling with the correct
power supply.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <Fugang.duan@nxp.com>
2019-12-23 17:35:00 +08:00
52b77b939f LF-580 dt-bindings: imx: correct i2c4/uart1 clocks ID
Current i2c4/uart1 clocks ID have conflict with pwm2/pwm3,
correct them.

Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-23 17:12:25 +08:00
a03628f1a6 LF-403 ARM64: dts: fsl: Add clock-names mclk0 for SAI nodes
This patch adds clock-names "mclk0" to match with the current SAI
driver.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
2019-12-23 15:46:15 +08:00
de1a87b02a MLK-23104: ASoC: fsl_rpmsg_i2s: Add constraint for supported rate
In imx8mn, M7 image has poor quality for 8kHz ~ 22kHz sample rate
case, but M7 side don't want to fix this issue in their image, so
we remove these sample rate in supported list.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-23 14:56:08 +08:00
a430d862b1 LF-527 ARM64: dts: imx8mn: change the usdhc compatible with imx8mm
the usdhc IP of imx8mn and imx8mm is the same, so let imx8mn share
the compatible with imx8mm. so that it can support HS400ES and CMDQ.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-23 14:31:27 +08:00
5c04e95ca6 LF-311 ARM: dts: imx6sx: add tuning step and tuning start tap for usdhc
If usdhc want to support SDR104/HS200, it need to do tuning, so need
to config the tuning step and tuning start tap. Otherwise some card may
meet tuning issue as the following log show:

mmc2: Tuning failed, falling back to fixed sampling clock

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-23 14:31:27 +08:00
7980314a3c arm64: dts: ls1043a: mark the A050385 FMan erratum
Mark the A050385 FMan erratum and activate its workaround.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-20 16:44:47 +02:00
d1954fdb3d sdk_dpaa: sdk_fman: ls1034a errata: update number to A050385
The A050385 erratum extends the A010022 erratum by defining additional
FMan lock-up conditions and suggests new w/a restrictions.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-20 16:44:47 +02:00
889be54892 sdk_dpaa: sdk_fman: ls1043a errata: detect based on DTB property
Detect if the platform is vulnerable to the A010022 erratum based on device
tree properties instead of the SoC family.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-20 16:44:47 +02:00
9d80e99430 sdk_dpaa: ls1043a errata: re-enable SG support and recycling
With certain limitation, SG frames can be used safely without triggering
the errata.

Buffers can be recycled, even after realigning the data.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-20 16:44:46 +02:00
2b2bf9ef39 sdk_dpaa: ls1043a errata: update and optimize the restrictions
An skb is in no danger of triggering the errata under the following
conditions:
- the paged data doesn't cross a 4K page boundary OR the linear data
is aligned to 256 bytes when crossing a 4K page boundary
- the linear and the paged data are 16 byte aligned
- the paged data is a multiple of 16 bytes in size

Optimize the detection for each skb that might trigger the errata. Parse
the skb twice, at most, and realign it only once.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-20 16:44:46 +02:00
66e3451076 sdk_dpaa: ls1043a errata: memory related fixes
Avoid a crash by verifying the allocation return status.

Use the standard API for determining the page order needed for
allocating Jumbo sized skbs.

Explicitly remove the old skb outside the w/a, for both successful and
unsuccessful realignments. Make sure the old skb's memory isn't leaked.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-20 16:44:46 +02:00
ec88523751 sdk_dpaa: ethtool: drop unused variable
Remove unused variable that was missed in past code refactorings.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-20 16:44:46 +02:00
6aeb0556c1 sdk_fman: decrease log severity levels
Decrease the severity of log messages from critical to appropriate
levels (warning and info).

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-20 16:44:19 +02:00
9fbd0e79d6 bus: fsl-mc: add the dpdbg device type
A new object type was recently added in MC.  This has to be added in the
fsl-mc bus device type list so that it can be properly listed.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-20 15:02:19 +02:00
7ec1ff2b8a MGS-5226 [#imx-1746] add REG_DisableVIP bit 1
add REG_DisableVIP bit 1 in gpu-viv/hal/kernel/inc/gc_feature_database.h

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

use private workqueue instead of public workqueue

Signed-off-by: ming_qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2019-12-20 17:04:17 +08:00
59bf0914d6 LF-168: arm64: dts: imx8qm: modify GPU frequency according to 8QM spec
modify GPU core clock to 800000 and GPU shader clock to 1000000.

As per commit 30d9947ad71007("LF-168: arm64: dts: imx8qm: add frequency
operating-points to enable GPU governor") the operating-points node use
the wrong GPU core clock and shader clock.

So, modify GPU frequency according to 8QM spec

Fixes:30d9947ad71007("LF-168: arm64: dts: imx8qm: add frequency
operating-points to enable GPU governor")

Signed-off-by: Minjie Zhuang <minjie.zhuang@nxp.com>
2019-12-20 15:31:50 +08:00
a20f232a97 LF-221: staging: media: imx: fix potential memory out of bound
ISI will not do scale when output width or height equal to input
width or height. But actully, in this case, the source image size
is larger than target size. For instance, 640x480 resize to 640x400.
ISI need to skip scaling operation only when output width and height
equeal to input width and height, so change the OR logic into AND logic.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
2019-12-20 13:34:14 +08:00
63fbce0064 LF-531-2 arm64: dts: imx8mn: add cma setting
Fix GPU AXI bus error when run WebGL 2.0 CTS,

The original CMA size is 320MB, set with 640MB,
This patch will align 8MN CMA size with L4.14.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-20 18:07:39 +08:00
6cc89b1bee LF-531-1 arm64: dts: imx8mq/imx8mn: fix gpu setting
move gpu device configuration out of soc subsystem,
gpu parameters exceed soc range and will be skipped:
  ranges = <0x0 0x0 0x0 0x3e000000>

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-20 18:07:38 +08:00
0a7ebc520b Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (19 commits)
  LF-531-2 arm64: dts: imx8mn: add cma setting
  LF-531-1 arm64: dts: imx8mq/imx8mn: fix gpu setting
  staging: fsl-dpaa2/mac: do not stop MAC when the net_dev is not up
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2019-12-20 10:04:14 +08:00
e41f1a1fa2 staging: fsl-dpaa2/mac: do not stop MAC when the net_dev is not up
In case the net_device is not up, there is no need to call
dpmac_mac_stop(). Guard the call by checking the IFF_UP flag.
This patch will also solve the following warning generated by removing a
dpmac that is not up.

[   40.942937] called from state READY
[   40.946442] WARNING: CPU: 0 PID: 755 at drivers/net/phy/phy.c:838
phy_stop+0x6c/0x78
[   40.954171] Modules linked in:
[   40.957214] CPU: 0 PID: 755 Comm: bash Tainted: G        W
5.4.0-03629-gfd7102c32b2c-dirty #911
[   40.966592] Hardware name: NXP Layerscape LX2160ARDB (DT)
[   40.971978] pstate: 40000005 (nZcv daif -PAN -UAO)
[   40.976756] pc : phy_stop+0x6c/0x78
[   40.980232] lr : phy_stop+0x6c/0x78
(..)
[   41.066487] Call trace:
[   41.068922]  phy_stop+0x6c/0x78
[   41.072052]  dpaa2_mac_stop.part.4+0x34/0x5c
[   41.076309]  dpaa2_mac_remove+0x9c/0xa8

Also, remove the IFF_UP flag from the mac netdev since the PHY is not
anymore started at probe time but is rather started/stopped on ifconfig
up/down.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-19 19:34:56 +02:00
a8fd628437 soc: fsl: dpio: Enable ACP port in Linux QMAN driver
Setting the software portal configuration DE(dequeue stashing
enable) bit. This should enable the ACP (Accelerator Coherency
Port).

During test this improved performance on the LS2088a slightly. No
effect on the LX2160a.

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
2019-12-19 19:33:42 +02:00
96488946df LF-541-2: ARM: imx_v7_defconfig: enable CRYPTO_{CFB,OFB}
These are needed for tcrypt speed regression suite.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-12-19 18:28:37 +02:00
d6101482fe LF-541-1: arm64: imx_v8_defconfig: enable CRYPTO_{CFB,OFB}
These are needed for tcrypt speed regression suite.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-12-19 18:28:37 +02:00
e0238fcd9f MLK-21698: tee:optee: fix shared memory page attribute checks
When allocating pages for share memory with OP-TEE,
the driver checks the page attribute (pte).
The current checks only allow writealloc pages.
i.MX 6SLL sets the page attribute to writeback.
Relax this check to allow writealloc, writeback and writethrough.

Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com>
Reviewed-by: Franck Lenormand <franck.lenormand@nxp.com>
Reviewed-by: Horia Geanta <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
(cherry picked from commit a4c5efa2df07a54ce112206c3ffc8fccf3369c52)
(cherry picked from commit 51f031613d55e864f22cb244059e70432d7acd81)
2019-12-19 17:40:15 +01:00
a9e9801d61 sdk_fman: address compilation warning
Signed-off-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
2019-12-19 15:38:18 +02:00
05c608b502 sdk_fman: fix identation causing compilation warnings
Signed-off-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
2019-12-19 15:38:17 +02:00
446ffbee0e LF-521: mxc: hantro: [All]arch64 kernel default build using imx_v8_defconfig has many Warnings.100%
Add 'break' statement to fix 'implicit-fallthrough' compiler warning

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
2019-12-19 18:37:04 +08:00
0aebb6ecf4 LF-387-5 arm64: dts: layerscape: add chip-specific compatible string to usb nodes
To allow USB dwc3 driver to conduct some chip-scpeific configuring.
Cover all arm64 based Layerscape SoCs.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
Reviewed-by: Leo Li <leo.li@nxp.com>
2019-12-19 17:19:59 +08:00
2e2432559a LF-387-4 usb: dwc3: Add cache type configuration support
This feature is telling how to configure cache type on 4 different
transfer types: Data Read, Desc Read, Data Write and Desc write. For each
treasfer type, controller has a 4-bit register field to enable different
cache type. Quoted from DWC3 data book Table 6-5 Cache Type Bit Assignments:
----------------------------------------------------------------
MBUS_TYPE| bit[3]       |bit[2]       |bit[1]     |bit[0]
----------------------------------------------------------------
AHB      |Cacheable     |Bufferable   |Privilegge |Data
AXI3     |Write Allocate|Read Allocate|Cacheable  |Bufferable
AXI4     |Allocate Other|Allocate     |Modifiable |Bufferable
AXI4     |Other Allocate|Allocate     |Modifiable |Bufferable
Native   |Same as AXI   |Same as AXI  |Same as AXI|Same as AXI
----------------------------------------------------------------
Note: The AHB, AXI3, AXI4, and PCIe busses use different names for certain
signals, which have the same meaning:
  Bufferable = Posted
  Cacheable = Modifiable = Snoop (negation of No Snoop)

In most cases, driver support is not required unless the default values of
registers are not correct *and* DWC3 node has enabled dma-coherent. So far we
have observed USB device detect failure on some Layerscape platforms if this
programming was not applied.

Related struct:
struct dwc3_cache_type {
	u8 transfer_type_datard;
	u8 transfer_type_descrd;
	u8 transfer_type_datawr;
	u8 transfer_type_descwr;
};

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
2019-12-19 17:08:11 +08:00
647267f966 LF-387-3 usb: dwc3: Add chip-specific compatible string
Some Layerscape paltforms (such as LS1088A, LS2088A, etc) require update HW
default cache type configuration to fix DWC3 init failure when applying
property dma-coherent.

Note that the cache type configuration is actually native feature of DWC3,
not additional desgin coming from SoC, so add this support here.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2019-12-19 17:07:54 +08:00
9ff38337a0 LF-387-2 Revert "usb: dwc3: Add chip-specific compatible string"
This reverts commit b1b26e7ed4.
Will use next version patch to replace this.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-12-19 17:07:09 +08:00
b00fffd7a2 LF-387-1 Revert "usb: dwc3: Add cache type configuration support"
This reverts commit ebceaf435c.
Will use next version patch to replace this.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-12-19 17:04:35 +08:00
5c68287d6c MLK-22879-01 clk: imx: Add no cached flag for dram pll
When doing DRAM frequency change, the DRAM PLL config will
be changed in ATF side, so add 'CLK_GET_RATE_NOCACHE' flag
to make sure each time we get the DRAM PLL frequency through
'clk_get_rate' API, we can get the correct frequency.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
2019-12-19 16:24:24 +08:00
7e99bce2f6 MLK-23131-2 soc: imx: busfreq-imx8mq: Correct dram pll clock for rate update
When DRAM PLL clock is changed in TF-A, the DRAM PLL clock rate needs
to be updated, previous implementation uses dram_pll_clk which is
clock gate and it will NOT trigger clock rate update, need to use PLL
type clock which has CLK_GET_RATE_NOCACHE flag set and will trigger
clock rate recalculation. Otherwise, when system enters low bus mode,
checking clock rate via "cat /sys/kernel/debug/clk/dram_core_clk/clk_rate"
will NOT return the latest dram core clk rate.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
2019-12-19 16:24:24 +08:00
c19e15747f MLK-23131-1 arm64: dts: imx8mm/imx8mn: Add dram_pll_div clock for busfreq
On i.MX8MM/i.MX8MN platforms, need to add dram_pll_div clock for
busfreq driver to update dram_core clock when DRAM frequency switches
between low bus mode and high bus mode.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
2019-12-19 16:24:24 +08:00
4241039b94 LF-538 net: phy: tja11xx: add user interface to enable slave mode
Current phy driver only support master mode.
Add sysfs interface for user to danimiacally configure
the phy mode to master or slave.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-19 14:42:16 +08:00
e36664e8ab Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (19 commits)
  LF-537-10: ASoC: SOF Fix unused variable ‘mach’ warning
  crypto: caam/qi - use QBMan (NXP) SDK driver
  fsl_qbman: add dummy functions for probe deferal APIs
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2019-12-19 14:16:34 +08:00
77255cbb70 LF-537-10: ASoC: SOF Fix unused variable ‘mach’ warning
mach is only used now in nocodec usecase, so properly
guard it to avoid compiler warning.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-18 23:17:33 +02:00
689df5b5e5 crypto: caam/qi - use QBMan (NXP) SDK driver
Update caam/qi to work with QBMan from NXP SDK.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>

Squashed "crypto: caam/qi - fix FD congestion weight" fix.

Solved rebase conflicts:

drivers/crypto/caam/qi.c:579
    kept call to dev_err_ratelimited, but changed to fd->status
drivers/crypto/caam/sg_sw_qm.h:96
    kept changes from patch, but changed sg_count to len

Signed-off-by: Vlad Pelin <vlad.pelin@nxp.com>
Acked-by: Horia Geanta <horia.geanta@nxp.com>
2019-12-18 14:48:15 +02:00
8c502c7ad1 fsl_qbman: add dummy functions for probe deferal APIs
Add missing definitions for probe deferal APIs for drivers
that use them with the SDK version of the qbman drivers.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Vlad Pelin <vlad.pelin@nxp.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-18 14:48:05 +02:00
5d677f4ef6 LF-509: video: fbdev: sii902x: Fix imx7d hdmi display not work
sii902x hdmi cable detect thread is trigged by
event FB_EVENT_FB_REGISTERED in register_framebuffer function
when device bootup.

when CONFIG_FB_MXC_OVERLAY is enabled, pixel clock has
chance to be disabled by overlay fb.
In this case cable detect thread will fail to get cable state
and sii902x hdmi will not initialized.

Fix it with immediate execute the cable detect thread and
add 20ms delay to wait cable detect thread get the cable state.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-18 19:58:02 +08:00
4b7126efd1 LF-486: staging: media: imx: fix uninitialized variable
Variable mf is used in mxc_isi_subdev_get_fmt() without any
initialization or assignment.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-12-18 19:53:20 +08:00
58edbb3091 LF-510: staging: media: imx: add s/g_frame_interval support for max9286
Add s_frame_interval/g_frame_interval support for max9286

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-12-18 19:53:20 +08:00
e8ef76a055 LF-481: video: fbdev: mxc: Fix build warning
Fix the followed build warning.

drivers/video/fbdev/mxc/mxc_hdmi.c: In function ‘mxc_hdmi_cable_connected’:
drivers/video/fbdev/mxc/mxc_hdmi.c:1964:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
   mxc_hdmi_default_edid_cfg(hdmi);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/video/fbdev/mxc/mxc_hdmi.c:1966:2: note: here
  case HDMI_EDID_NO_MODES:
  ^~~~

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-12-18 19:08:12 +08:00
da85e842dc LF-537-10 ASoC: simple-card: Don't create separate link when platform is present
In normal sound case all DAIs are detected as CPU-Codec.
simple_dai_link_of supports the presence of a platform but it counts
it as a CPU DAI resulting in the creation of an extra link.

Adding a platform property to a link description like:

simple-audio-card,dai-link {
	cpu {
		sound-dai = <&sai1>;
	};
	plat {
		sound-dai = <&dsp>;
	};
	codec {
		sound-dai = <&wm8960>;
	}

will result in the creation of two links:
	* sai1 <-> wm8960
	* dsp  <-> wm8960

which is obviously not what we want. We just want one single link
with:
	* sai1 <-> wm8960 (and platform set to dsp).

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20191209135353.17427-1-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-18 11:39:24 +02:00
3e06d35bf8 LF-537-9: arch: arm64: Rename cs42888 SOF dts file
Rename imx8qxp-mek-sof.dtb -> imx8qxp-mek-sof-cs42888.dtb to better
explain what this dts is for.

We have now:
	* imx8qxp-mek-sof-wm8960, for wm8960 codec
	* imx8qxp-mek-sof-cs42888, for cs42888 codec.

In the future we will support both codecs in parallel, but currently SOF
doesn't easily allow this.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-18 11:39:13 +02:00
dd11d91ae1 LF-537-8 arch: arm64: Add machine driver property to dts
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-18 11:39:05 +02:00
da521a8d0a LF-537-7 arm64: dts: Enable simple-audio-card for SAI1 + wm8960
We use existing simple-audio-card machine drivfer to demonstrate
the usage of SAI1 + wm8960 codec.

FSL DAI driver is used in order to manage SAI resources (PD, clocks,
pinctrl) the rest is taken care of by the SAI driver from the DSP.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-18 11:38:59 +02:00
4fe325ff10 LF-537-6 ASoC: SOF: imx8: Fix dsp_box offset
dsp_box is used to keep DSP initiated messages. The value of dsp_offset
is set by the DSP with the first message, so we need a way to boostrap
it in order to get the first message.

We do this by setting the correct default dsp_box offset which on i.MX8
is not zero.

Very interesting is why it has worked until now.

On i.MX8, DSP communicates with ARM core using a shared SDRAM memory
area. Actually, there are two shared areas:
	* SDRAM0 - starting at 0x92400000, size 0x800000
	* SDRAM1 - starting at 0x92C00000, size 0x800000

SDRAM0 keeps the data sections, starting with .rodata. By chance
fw_ready structure was placed at the beginning of .rodata.

dsp_box_base is defined as SDRAM0 + dsp_box_offset and it is placed
at the begining of SDRAM1 (dsp_box_offset should be 0x800000). But
because it is zero initialized by default it points to SDRAM0 where
by chance the fw_ready was placed in the SOF firmware.

Anyhow, SOF commit 7466bee378dd811b ("clk: make freq arrays constant")
fw_ready is no longer at the beginning of SDRAM0 and everything shows
how lucky we were until now.

Fix this by properly setting the default dsp_box offset.

Fixes 202acc565a ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-18 11:38:50 +02:00
c1364b5b4a LF-537-5 ASoC: SOF: log compiler name and version information
Log information about used compilator and optimization level
in sof firmware to host system.
It will be helful to catch some compiler dependent bugs.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-12-18 11:38:39 +02:00
77470e19cd LF-537-4 ASoC: SOF: define struct with compiler name and version
Add compiler information structure sof_ipc_cc_version.
Add new enum value in sof_ipc_ext_data for new structure.
This struct will be used to show more information about firmware
in host system. It will be helpful during debugging.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-12-18 11:38:34 +02:00
4109d0ed20 LF-537-3 ASoC: SOF: fix snd_sof_fw_parse_ext_data
An error occurs during parsing more than one ext_data from the mailbox, because
of invalid data offset handling. Fix by removing the incorrect duplicate
increment of the offset.

The return value is also reset in the switch case. This does not change the
behavior but improves readability - there is no longer a need to check what the
return value of get_ext_windows is.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-12-18 11:38:28 +02:00
8e260d958e LF-537-2 ASoC: SOF: snd_sof_fw_parse_ext_data log warning on unknown header
Added warning log when found some unknown FW boot ext header,
to improve debuggability.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2019-12-18 11:38:23 +02:00
0b4813a18e LF-537-1 ASoC: SOF: Introduce machine driver name
ACPI creates tables with information about the machine driver.
With DT there is no need for such tables because we can directly
get all the information needed from DT file.

This patch introduces machine driver property inside dsp node.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-18 11:38:03 +02:00
09803ef575 LF-468-2 usb: gadget: f_fs: set req->num_sgs as 0 for non-sg transfer
The UDC core uses req->num_sgs to judge if scatter buffer list is used.
Eg: usb_gadget_map_request_by_dev. For f_fs sync io mode, the request
is re-used for each request, so if the 1st request->length > PAGE_SIZE,
and the 2nd request->length is <= PAGE_SIZE, the f_fs uses the 1st
req->num_sgs for the 2nd request, it causes the UDC core get the wrong
req->num_sgs value (The 2nd request doesn't use sg). For f_fs async
io mode, it is not harm to initialize req->num_sgs as 0 either, in case,
the UDC driver doesn't zeroed request structure.

Cc: Jun Li <jun.li@nxp.com>
Cc: stable <stable@vger.kernel.org>
Fixes: 772a7a724f ("usb: gadget: f_fs: Allow scatter-gather buffers")
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-12-18 15:12:09 +08:00
4ad131b729 LF-468-1 usb: cdns3: gadget: handle trb correctly at sg case
At current transfer complete handler, it doesn't consider
sg (scatter buffer list) case, and only handles single trb
request. In fact, we need to handle every trbs in request,
and giveback the request after all trbs are handled.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-12-18 15:12:09 +08:00
77c9c0e291 Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (19 commits)
  LF-514-3 arm64: dts: imx8m: fix inmate linux boot
  LF-514-2 arm64: dts: imx8mq-root: init on IMX8MQ_CLK_USDHC1_ROOT
  LF-514-1 arm64: dts: imx8mm-root: init on IMX8MM_CLK_NAND_USDHC_BUS
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2019-12-18 13:21:09 +08:00
2f1bdd071f LF-514-3 arm64: dts: imx8m: fix inmate linux boot
The security related node in dtsi are default status okay, so we need
remove them from inmate linux, otherwise inmate crash.

Also remove other nodes that might break boot, such as busfreq and etc
to make it align with 4.19 kernel.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-18 11:50:16 +08:00
134dea7685 LF-514-2 arm64: dts: imx8mq-root: init on IMX8MQ_CLK_USDHC1_ROOT
Without init on IMX8MQ_CLK_USDHC1_ROOT, inmate linux emmc
will not work properly.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-18 11:50:16 +08:00
cb01c2f8e7 LF-514-1 arm64: dts: imx8mm-root: init on IMX8MM_CLK_NAND_USDHC_BUS
Without init on IMX8MM_CLK_NAND_USDHC_BUS, inmate linux emmc
will not work properly.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-18 11:50:15 +08:00
61c86b733b LF-487-2 ARM: dts: imx6sll: add fsl,mf-mix-wakeup-irq for gpc
Otherwise M/F will be off while system sleep even wakeup source
is enabled or requested on.

Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-18 10:34:56 +08:00
139dade16f LF-487-1 ARM: dts: imx6ul: add fsl,mf-mix-wakeup-irq for gpc
Otherwise M/F will be off while system sleep even wakeup source
is enabled or requested on.

Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-18 10:34:56 +08:00
565cfec2d4 LF-503:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:check space of cmd buffer
Check the space of cmd buffer before write cmd,
if the wptr equals to rptr, it'll be treated as empty,
so we can't write to full.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2019-12-18 10:01:24 +08:00
bcc0a56950 LF-497-3 arm: dts: imx6qdl-sabresd: enable mipi dsi
Enable mipi dsi for imx6q and imx6dl sabresd
boards by default.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-17 18:47:25 +08:00
221e303b6a LF-497-2 arm: dts: imx6q: add mipi dsi node
Add the mipi dsi device node for imx6q platform.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-17 18:47:25 +08:00
dbf2e9cc50 LF-497-1 arm: dts: imx6dl: add mipi dsi node
Add the mipi dsi device node for imx6dl platform.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-17 18:47:25 +08:00
57ec9315e6 ASoC: soc-pcm: check symmetry before hw_params
This reverts commit 957ce0c6b8 (ASoC: soc-pcm: check symmetry after
hw_params).

That commit cause soc_pcm_params_symmetry can't take effect.
cpu_dai->rate, cpu_dai->channels and cpu_dai->sample_bits
are updated in the middle of soc_pcm_hw_params, so move
soc_pcm_params_symmetry to the end of soc_pcm_hw_params is
not a good solution, for judgement of symmetry in the function
is always true.

FIXME:
According to the comments of that commit, I think the case
described in the commit should disable symmetric_rates
in Back-End, rather than changing the position of
soc_pcm_params_symmetry.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1573555602-5403-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-17 17:58:21 +08:00
52b052f64e LF-218 reset: dispmix: remove dev when init mmio regmap
Remove dev for mmio regmap init can forbid the
regmap to create entries for this device under
the /sys/kernel/debug/regmap/ directory which
can avoid hang issue when access the registers
if no display connected to it.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-12-17 17:24:34 +08:00
5af6d5eaf4 MLK-21865 Revert "regmap: use debugfs even when no device"
This reverts commit 9b947a13e7.

The commit 9b947a13e7 does not consider power and
clock when expose the regmap into debugsfs. This may bring some problem for some
case. E.g., For reset registers (not real GPR, but csi bridge register) for
MIPI DSI, MIPI CSI and LCDIF on i.mx8mm, they only can be accessed after the
disp_root clock and dispmix power has been turned on, otherwise the system may
be stuck.

on i.mx8mm evk, the command to reproduce (with default dtb, no display/capture
running):
cat /sys/kernel/debug/regmap/dummy-display-gpr@32e28000/registers

This patch reverted previous commit to avoid the exposure.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
2019-12-17 17:24:34 +08:00
57e0cc9da1 LF-496-5 arm64: dts: add i.MX8QM inmate/root dts
Use the following command to boot the 2nd linux, the lpuart2 is in base
board. The m4 should be disabled for qm mek, because lpuart2 is used
by m4.

jailhouse cell linux imx8qm-linux-demo.cell Image -d
imx8qm-mek-inmate.dtb -c "clk_ignore_unused console=ttyLP2,115200
earlycon=lpuart32,mmio32,0x5a060010,115200 cma=32MB root=/dev/mmcblk0p2
rootwait rw"

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-17 17:18:28 +08:00
cbb61c1b75 LF-496-4 arm64: dts: add i.MX8QXP inmate/root dts
Add i.MX8QXP inmate/root dts.

Use the following command to boot the 2nd linux, the lpuart2 is in base
board.

jailhouse cell linux imx8qxp-linux-demo.cell Image -d
imx8qxp-mek-inmate.dtb -c "clk_ignore_unused console=ttyLP2,115200
earlycon=lpuart32,mmio32,0x5a060010,115200 cma=32MB root=/dev/mmcblk0p2
rootwait rw"

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-17 17:18:22 +08:00
7ff8df421e LF-496-3 arm64: dts: imx8qxp: move memory-region to soc dtsi
memory-region in ss dtsi is not correct, it should be in soc dtsi,
because the referenced region is in soc dtsi

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-17 17:18:13 +08:00
c4da86ba0f LF-496-2 arm64: defconfig: enable xen blk back
Select xen blk back as module, then domu could use paravirtual
block.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-17 17:18:07 +08:00
f0f0e16aad LF-496-1 arm64: defconfig: enable ivshmem net
Without ivshmem net, jailhouse inter-vm communication will not work.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-17 17:17:41 +08:00
76121138fa LF-484 tty: serial: lpuart: support UPIO_MEM32 for lpuart32
"earlycon" no need to specify the value string since it uses
stdout-path parameters. However when earlycon and normal console
are not using the same uart port, we need specify value string
to earlycon, this is what we need to do when support dual linux
using jailhouse hypervisor. The 2nd linux will use the uart
of the 1st linux as earlycon.

earlycon=lpuart32,mmio32,0x5a060010,115200 not work for i.MX8QXP.
It is because lpuart32_early_console_setup not support little endian.

Since the original code is to support UPIO_MEM32BE, so if not
UPIO_MEM32, we still take it as UPIO_MEM32BE

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-17 17:17:13 +08:00
4a77ce2dfb LF-470 ARM: dts: imx7d: Add DDRC node
Add DDRC node to support DDR type identification during
kernel boot up.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-12-17 15:28:31 +08:00
f15d28b991 Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (220 commits)
  LF-482 media: mipi csi: fix build warning
  LF-168: arm64: dts: imx8qm: add frequency operating-points to enable GPU governor
  LF-463-2: arm64/dts/imx8qm: Enable DisplayPort in lpddr4 val board
  ...
2019-12-16 19:02:24 +08:00
33f9f5df21 LF-482 media: mipi csi: fix build warning
fix build warning of unused variable:
drivers/media/platform/imx8/mxc-mipi-csi2_yav.c: In function 'mipi_csi2_pm_resume':
drivers/media/platform/imx8/mxc-mipi-csi2_yav.c:691:6: warning: unused variable 'ret' [-Wunused-variable]
  691 |  int ret;
      |      ^~~

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Sandor.yu <sandor.yu@nxp.com>
(cherry picked from commit bce8fa37a7d88e5038dceaf70cd11a4ffd491923)
2019-12-16 17:47:31 +08:00
30d9947ad7 LF-168: arm64: dts: imx8qm: add frequency operating-points to enable GPU governor
add frequency operating-points to enable GPU governor

Signed-off-by: Minjie Zhuang <minjie.zhuang@nxp.com>
2019-12-16 17:25:34 +08:00
9d7943d836 LF-463-2: arm64/dts/imx8qm: Enable DisplayPort in lpddr4 val board
Enable DisplayPort in imx8qm lpddr4 validation board.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-12-16 16:14:15 +08:00
836297fc17 LF-463-1: arm64/dts/imx8qm: Enable DPU in lpddr4 validation board
Enable DPU in lpddr4 validation board.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-12-16 16:14:15 +08:00
622141309f Merge linux-5.4.y tag 'v5.4.3' into lf-5.4.y
This is the 5.4.3 stable release

 Conflicts:
	drivers/cpufreq/imx-cpufreq-dt.c
	drivers/spi/spi-fsl-qspi.c

The conflict is very minor, fixed it when do the merge. The imx-cpufreq-dt.c
is just one line code-style change, using upstream one, no any function change.

The spi-fsl-qspi.c has minor conflicts when merge upstream fixes: c69b17da53
spi: spi-fsl-qspi: Clear TDH bits in FLSHCR register

After merge, basic boot sanity test and basic qspi test been done on i.mx

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2019-12-16 14:38:10 +08:00
c84c7c3c3c Merge remote-tracking branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (13 commits)
  LF-467: media: imx: isi: fix some typo issues
  LF-462 ARM: dts: imx7d-12x12-lpddr3-val: correct the phy interface mode
  arm64: config: enable usb network card R8152 AX88179 and AX8817X driver
  ...
2019-12-16 10:14:57 +08:00
c85bf6f690 LF-467: media: imx: isi: fix some typo issues
Fix some typo issues in ISI driver.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Acked-by: Sandor.yu <sandor.yu@nxp.com>
2019-12-13 16:30:54 +08:00
d04ac1d9db LF-462 ARM: dts: imx7d-12x12-lpddr3-val: correct the phy interface mode
Correct the phy interface mode to "rgmii-id".

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-13 15:49:21 +08:00
f7688b48ac Linux 5.4.3 2019-12-13 08:43:32 +01:00
57e4b1c3e3 kselftest: Fix NULL INSTALL_PATH for TARGETS runlist
[ Upstream commit 02bf1f8b3c ]

As per commit 131b30c94f ("kselftest: exclude failed TARGETS from
runlist") failed targets were excluded from the runlist. But value
$$INSTALL_PATH is always NULL. It should be $INSTALL_PATH instead
$$INSTALL_PATH.

So, fix Makefile to use $INSTALL_PATH.

Fixes: 131b30c94f ("kselftest: exclude failed TARGETS from runlist")
Signed-off-by: Prabhakar Kushwaha <pkushwaha@marvell.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:43:31 +01:00
7da7a701e2 perf script: Fix invalid LBR/binary mismatch error
[ Upstream commit 5172672da0 ]

The 'len' returned by grab_bb() includes an extra MAXINSN bytes to allow
for the last instruction, so the the final 'offs' will not be 'len'.
Fix the error condition logic accordingly.

Before:

  $ perf record -e '{intel_pt//,cpu/mem_inst_retired.all_loads,aux-sample-size=8192/pp}:u' grep -rqs jhgjhg /boot
  [ perf record: Woken up 19 times to write data ]
  [ perf record: Captured and wrote 2.274 MB perf.data ]
  $ perf script -F +brstackinsn --xed --itrace=i1usl100 | head
            grep 13759 [002]  8091.310257:       1862                                        instructions:uH:      5641d58069eb bmexec+0x86b (/bin/grep)
        bmexec+2485:
        00005641d5806b35                        jnz 0x5641d5806bd0              # MISPRED
        00005641d5806bd0                        movzxb  (%r13,%rdx,1), %eax
        00005641d5806bd6                        add %rdi, %rax
        00005641d5806bd9                        movzxb  -0x1(%rax), %edx
        00005641d5806bdd                        cmp %rax, %r14
        00005641d5806be0                        jnb 0x5641d58069c0              # MISPRED
        mismatch of LBR data and executable
        00005641d58069c0                        movzxb  (%r13,%rdx,1), %edi

After:

  $ perf script -F +brstackinsn --xed --itrace=i1usl100 | head
            grep 13759 [002]  8091.310257:       1862                                        instructions:uH:      5641d58069eb bmexec+0x86b (/bin/grep)
        bmexec+2485:
        00005641d5806b35                        jnz 0x5641d5806bd0              # MISPRED
        00005641d5806bd0                        movzxb  (%r13,%rdx,1), %eax
        00005641d5806bd6                        add %rdi, %rax
        00005641d5806bd9                        movzxb  -0x1(%rax), %edx
        00005641d5806bdd                        cmp %rax, %r14
        00005641d5806be0                        jnb 0x5641d58069c0              # MISPRED
        00005641d58069c0                        movzxb  (%r13,%rdx,1), %edi
        00005641d58069c6                        add %rax, %rdi

Fixes: e98df280bc ("perf script brstackinsn: Fix recovery from LBR/binary mismatch")
Reported-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20191127095631.15663-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:43:31 +01:00
d2136afb51 EDAC/ghes: Fix locking and memory barrier issues
[ Upstream commit 23f61b9fc5 ]

The ghes registration and refcount is broken in several ways:

 * ghes_edac_register() returns with success for a 2nd instance
   even if a first instance's registration is still running. This is
   not correct as the first instance may fail later. A subsequent
   registration may not finish before the first. Parallel registrations
   must be avoided.

 * The refcount was increased even if a registration failed. This
   leads to stale counters preventing the device from being released.

 * The ghes refcount may not be decremented properly on unregistration.
   Always decrement the refcount once ghes_edac_unregister() is called to
   keep the refcount sane.

 * The ghes_pvt pointer is handed to the irq handler before registration
   finished.

 * The mci structure could be freed while the irq handler is running.

Fix this by adding a mutex to ghes_edac_register(). This mutex
serializes instances to register and unregister. The refcount is only
increased if the registration succeeded. This makes sure the refcount is
in a consistent state after registering or unregistering a device.

Note: A spinlock cannot be used here as the code section may sleep.

The ghes_pvt is protected by ghes_lock now. This ensures the pointer is
not updated before registration was finished or while the irq handler is
running. It is unset before unregistering the device including necessary
(implicit) memory barriers making the changes visible to other CPUs.
Thus, the device can not be used anymore by an interrupt.

Also, rename ghes_init to ghes_refcount for better readability and
switch to refcount API.

A refcount is needed because there can be multiple GHES structures being
defined (see ACPI 6.3 specification, 18.3.2.7 Generic Hardware Error
Source, "Some platforms may describe multiple Generic Hardware Error
Source structures with different notification types, ...").

Another approach to use the mci's device refcount (get_device()) and
have a release function does not work here. A release function will be
called only for device_release() with the last put_device() call. The
device must be deleted *before* that with device_del(). This is only
possible by maintaining an own refcount.

 [ bp: touchups. ]

Fixes: 0fe5f281f7 ("EDAC, ghes: Model a single, logical memory controller")
Fixes: 1e72e673b9 ("EDAC/ghes: Fix Use after free in ghes_edac remove path")
Co-developed-by: James Morse <james.morse@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
Co-developed-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Robert Richter <rrichter@marvell.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Link: https://lkml.kernel.org/r/20191105200732.3053-1-rrichter@marvell.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:43:30 +01:00
8a13daae81 watchdog: aspeed: Fix clock behaviour for ast2600
[ Upstream commit c04571251b ]

The ast2600 no longer uses bit 4 in the control register to indicate a
1MHz clock (It now controls whether this watchdog is reset by a SOC
reset). This means we do not want to set it. It also does not need to be
set for the ast2500, as it is read-only on that SoC.

The comment next to the clock rate selection wandered away from where it
was set, so put it back next to the register setting it's describing.

Fixes: b3528b4874 ("watchdog: aspeed: Add support for AST2600")
Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20191108032905.22463-1-joel@jms.id.au
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:43:30 +01:00
6dc2a7e67e drm/mcde: Fix an error handling path in 'mcde_probe()'
[ Upstream commit 15c665bb46 ]

If we don't find any matching components, we should go through the error
handling path, in order to free some resources.

Fixes: ca5be902a8 ("drm/mcde: Fix uninitialized variable")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190822211518.5578-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:43:29 +01:00
526152a239 md/raid0: Fix an error message in raid0_make_request()
[ Upstream commit e3fc3f3d09 ]

The first argument to WARN() is supposed to be a condition.  The
original code will just print the mdname() instead of the full warning
message.

Fixes: c84a1372df ("md/raid0: avoid RAID0 data corruption due to layout confusion.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:43:29 +01:00
7a5e10c1d6 cpufreq: imx-cpufreq-dt: Correct i.MX8MN's default speed grade value
[ Upstream commit af44d180e3 ]

i.MX8MN has different speed grade definition compared to
i.MX8MQ/i.MX8MM, when fuses are NOT written, the default
speed_grade should be set to minimum available OPP defined
in DT which is 1.2GHz, the corresponding speed_grade value
should be 0xb.

Fixes: 5b8010ba70 ("cpufreq: imx-cpufreq-dt: Add i.MX8MN support")
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:43:28 +01:00
0d4e867e0c ALSA: hda - Fix pending unsol events at shutdown
[ Upstream commit ca58f55108 ]

This is an alternative fix attemp for the issue reported in the commit
caa8422d01 ("ALSA: hda: Flush interrupts on disabling") that was
reverted later due to regressions.  Instead of tweaking the hardware
disablement order and the enforced irq flushing, do calling
cancel_work_sync() of the unsol work early enough, and explicitly
ignore the unsol events during the shutdown by checking the
bus->shutdown flag.

Fixes: caa8422d01 ("ALSA: hda: Flush interrupts on disabling")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://lore.kernel.org/r/s5h1ruxt9cz.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:43:27 +01:00
8ad39a3b44 KVM: x86: fix out-of-bounds write in KVM_GET_EMULATED_CPUID (CVE-2019-19332)
commit 433f4ba190 upstream.

The bounds check was present in KVM_GET_SUPPORTED_CPUID but not
KVM_GET_EMULATED_CPUID.

Reported-by: syzbot+e3f4897236c4eeb8af4f@syzkaller.appspotmail.com
Fixes: 84cffe499b ("kvm: Emulate MOVBE", 2013-10-29)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:26 +01:00
e8f669921e binder: Handle start==NULL in binder_update_page_range()
commit 2a9edd056e upstream.

The old loop wouldn't stop when reaching `start` if `start==NULL`, instead
continuing backwards to index -1 and crashing.

Luckily you need to be highly privileged to map things at NULL, so it's not
a big problem.

Fix it by adjusting the loop so that the loop variable is always in bounds.

This patch is deliberately minimal to simplify backporting, but IMO this
function could use a refactor. The jump labels in the second loop body are
horrible (the error gotos should be jumping to free_range instead), and
both loops would look nicer if they just iterated upwards through indices.
And the up_read()+mmput() shouldn't be duplicated like that.

Cc: stable@vger.kernel.org
Fixes: 457b9a6f09 ("Staging: android: add binder driver")
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Link: https://lore.kernel.org/r/20191018205631.248274-3-jannh@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:25 +01:00
015c08bc70 binder: Prevent repeated use of ->mmap() via NULL mapping
commit a7a74d7ff5 upstream.

binder_alloc_mmap_handler() attempts to detect the use of ->mmap() on a
binder_proc whose binder_alloc has already been initialized by checking
whether alloc->buffer is non-zero.

Before commit 880211667b ("binder: remove kernel vm_area for buffer
space"), alloc->buffer was a kernel mapping address, which is always
non-zero, but since that commit, it is a userspace mapping address.

A sufficiently privileged user can map /dev/binder at NULL, tricking
binder_alloc_mmap_handler() into assuming that the binder_proc has not been
mapped yet. This leads to memory unsafety.
Luckily, no context on Android has such privileges, and on a typical Linux
desktop system, you need to be root to do that.

Fix it by using the mapping size instead of the mapping address to
distinguish the mapped case. A valid VMA can't have size zero.

Fixes: 880211667b ("binder: remove kernel vm_area for buffer space")
Cc: stable@vger.kernel.org
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Link: https://lore.kernel.org/r/20191018205631.248274-2-jannh@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:25 +01:00
6e0efd9e9e binder: Fix race between mmap() and binder_alloc_print_pages()
commit 8eb52a1ee3 upstream.

binder_alloc_print_pages() iterates over
alloc->pages[0..alloc->buffer_size-1] under alloc->mutex.
binder_alloc_mmap_handler() writes alloc->pages and alloc->buffer_size
without holding that lock, and even writes them before the last bailout
point.

Unfortunately we can't take the alloc->mutex in the ->mmap() handler
because mmap_sem can be taken while alloc->mutex is held.
So instead, we have to locklessly check whether the binder_alloc has been
fully initialized with binder_alloc_get_vma(), like in
binder_alloc_new_buf_locked().

Fixes: 8ef4665aa1 ("android: binder: Add page usage in binder stats")
Cc: stable@vger.kernel.org
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Link: https://lore.kernel.org/r/20191018205631.248274-1-jannh@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:23 +01:00
0bbb506cd5 Revert "serial/8250: Add support for NI-Serial PXI/PXIe+485 devices"
commit 27ed14d0ec upstream.

This reverts commit fdc2de8712 ("serial/8250:
Add support for NI-Serial PXI/PXIe+485 devices").

The commit fdc2de8712 ("serial/8250: Add support for NI-Serial
PXI/PXIe+485 devices") introduced a breakage on NI-Serial PXI(e)-RS485
devices, RS-232 variants have no issue. The Linux system can enumerate the
NI-Serial PXI(e)-RS485 devices, but it broke the R/W operation on the
ports.

However, the implementation is working on the NI internal Linux RT kernel
but it does not work in the Linux main tree kernel. This is only affecting
NI products, specifically the RS-485 variants. Reverting the upstream
until a proper implementation that can apply to both NI internal Linux
kernel and Linux mainline kernel is figured out.

Signed-off-by: Je Yen Tam <je.yen.tam@ni.com>
Fixes: fdc2de8712 ("serial/8250: Add support for NI-Serial PXI/PXIe+485 devices")
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191127075301.9866-1-je.yen.tam@ni.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:22 +01:00
0b0923bb6d vcs: prevent write access to vcsu devices
commit 0c9acb1af7 upstream.

Commit d21b0be246 ("vt: introduce unicode mode for /dev/vcs") guarded
against using devices containing attributes as this is not yet
implemented. It however failed to guard against writes to any devices
as this is also unimplemented.

Reported-by: Or Cohen <orcohen@paloaltonetworks.com>
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Cc: <stable@vger.kernel.org> # v4.19+
Cc: Jiri Slaby <jslaby@suse.com>
Fixes: d21b0be246 ("vt: introduce unicode mode for /dev/vcs")
Link: https://lore.kernel.org/r/nycvar.YSQ.7.76.1911051030580.30289@knanqh.ubzr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:22 +01:00
7d967912c0 thermal: Fix deadlock in thermal thermal_zone_device_check
commit 163b00cde7 upstream.

1851799e1d ("thermal: Fix use-after-free when unregistering thermal zone
device") changed cancel_delayed_work to cancel_delayed_work_sync to avoid
a use-after-free issue. However, cancel_delayed_work_sync could be called
insides the WQ causing deadlock.

[54109.642398] c0   1162 kworker/u17:1   D    0 11030      2 0x00000000
[54109.642437] c0   1162 Workqueue: thermal_passive_wq thermal_zone_device_check
[54109.642447] c0   1162 Call trace:
[54109.642456] c0   1162  __switch_to+0x138/0x158
[54109.642467] c0   1162  __schedule+0xba4/0x1434
[54109.642480] c0   1162  schedule_timeout+0xa0/0xb28
[54109.642492] c0   1162  wait_for_common+0x138/0x2e8
[54109.642511] c0   1162  flush_work+0x348/0x40c
[54109.642522] c0   1162  __cancel_work_timer+0x180/0x218
[54109.642544] c0   1162  handle_thermal_trip+0x2c4/0x5a4
[54109.642553] c0   1162  thermal_zone_device_update+0x1b4/0x25c
[54109.642563] c0   1162  thermal_zone_device_check+0x18/0x24
[54109.642574] c0   1162  process_one_work+0x3cc/0x69c
[54109.642583] c0   1162  worker_thread+0x49c/0x7c0
[54109.642593] c0   1162  kthread+0x17c/0x1b0
[54109.642602] c0   1162  ret_from_fork+0x10/0x18
[54109.643051] c0   1162 kworker/u17:2   D    0 16245      2 0x00000000
[54109.643067] c0   1162 Workqueue: thermal_passive_wq thermal_zone_device_check
[54109.643077] c0   1162 Call trace:
[54109.643085] c0   1162  __switch_to+0x138/0x158
[54109.643095] c0   1162  __schedule+0xba4/0x1434
[54109.643104] c0   1162  schedule_timeout+0xa0/0xb28
[54109.643114] c0   1162  wait_for_common+0x138/0x2e8
[54109.643122] c0   1162  flush_work+0x348/0x40c
[54109.643131] c0   1162  __cancel_work_timer+0x180/0x218
[54109.643141] c0   1162  handle_thermal_trip+0x2c4/0x5a4
[54109.643150] c0   1162  thermal_zone_device_update+0x1b4/0x25c
[54109.643159] c0   1162  thermal_zone_device_check+0x18/0x24
[54109.643167] c0   1162  process_one_work+0x3cc/0x69c
[54109.643177] c0   1162  worker_thread+0x49c/0x7c0
[54109.643186] c0   1162  kthread+0x17c/0x1b0
[54109.643195] c0   1162  ret_from_fork+0x10/0x18
[54109.644500] c0   1162 cat             D    0  7766      1 0x00000001
[54109.644515] c0   1162 Call trace:
[54109.644524] c0   1162  __switch_to+0x138/0x158
[54109.644536] c0   1162  __schedule+0xba4/0x1434
[54109.644546] c0   1162  schedule_preempt_disabled+0x80/0xb0
[54109.644555] c0   1162  __mutex_lock+0x3a8/0x7f0
[54109.644563] c0   1162  __mutex_lock_slowpath+0x14/0x20
[54109.644575] c0   1162  thermal_zone_get_temp+0x84/0x360
[54109.644586] c0   1162  temp_show+0x30/0x78
[54109.644609] c0   1162  dev_attr_show+0x5c/0xf0
[54109.644628] c0   1162  sysfs_kf_seq_show+0xcc/0x1a4
[54109.644636] c0   1162  kernfs_seq_show+0x48/0x88
[54109.644656] c0   1162  seq_read+0x1f4/0x73c
[54109.644664] c0   1162  kernfs_fop_read+0x84/0x318
[54109.644683] c0   1162  __vfs_read+0x50/0x1bc
[54109.644692] c0   1162  vfs_read+0xa4/0x140
[54109.644701] c0   1162  SyS_read+0xbc/0x144
[54109.644708] c0   1162  el0_svc_naked+0x34/0x38
[54109.845800] c0   1162 D 720.000s 1->7766->7766 cat [panic]

Fixes: 1851799e1d ("thermal: Fix use-after-free when unregistering thermal zone device")
Cc: stable@vger.kernel.org
Signed-off-by: Wei Wang <wvw@google.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:21 +01:00
58240f4571 iomap: Fix pipe page leakage during splicing
commit 419e9c38aa upstream.

When splicing using iomap_dio_rw() to a pipe, we may leak pipe pages
because bio_iov_iter_get_pages() records that the pipe will have full
extent worth of data however if file size is not block size aligned
iomap_dio_rw() returns less than what bio_iov_iter_get_pages() set up
and splice code gets confused leaking a pipe page with the file tail.

Handle the situation similarly to the old direct IO implementation and
revert iter to actually returned read amount which makes iter consistent
with value returned from iomap_dio_rw() and thus the splice code is
happy.

Fixes: ff6a9292e6 ("iomap: implement direct I/O")
CC: stable@vger.kernel.org
Reported-by: syzbot+991400e8eba7e00a26e1@syzkaller.appspotmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:20 +01:00
f41afbe8dc bdev: Refresh bdev size for disks without partitioning
commit cba22d86e0 upstream.

Currently, block device size in not updated on second and further open
for block devices where partition scan is disabled. This is particularly
annoying for example for DVD drives as that means block device size does
not get updated once the media is inserted into a drive if the device is
already open when inserting the media. This is actually always the case
for example when pktcdvd is in use.

Fix the problem by revalidating block device size on every open even for
devices with partition scan disabled.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Cc: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:19 +01:00
f1f3ba27c0 bdev: Factor out bdev revalidation into a common helper
commit 731dc48683 upstream.

Factor out code handling revalidation of bdev on disk change into a
common helper.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Cc: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:18 +01:00
fbf86f6d5a rfkill: allocate static minor
commit 8670b2b8b0 upstream.

udev has a feature of creating /dev/<node> device-nodes if it finds
a devnode:<node> modalias. This allows for auto-loading of modules that
provide the node. This requires to use a statically allocated minor
number for misc character devices.

However, rfkill uses dynamic minor numbers and prevents auto-loading
of the module. So allocate the next static misc minor number and use
it for rfkill.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Link: https://lore.kernel.org/r/20191024174042.19851-1-marcel@holtmann.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:43:18 +01:00
5ab462ef09 RDMA/qib: Validate ->show()/store() callbacks before calling them
commit 7ee23491b3 upstream.

The permissions of the read-only or write-only sysfs files can be
changed (as root) and the user can then try to read a write-only file or
write to a read-only file which will lead to kernel crash here.

Protect against that by always validating the show/store callbacks.

Link: https://lore.kernel.org/r/d45cc26361a174ae12dbb86c994ef334d257924b.1573096807.git.viresh.kumar@linaro.org
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:16 +01:00
98ad98f809 can: ucan: fix non-atomic allocation in completion handler
commit 870db5d101 upstream.

USB completion handlers are called in atomic context and must
specifically not allocate memory using GFP_KERNEL.

Fixes: 9f2d3eae88 ("can: ucan: add driver for Theobroma Systems UCAN devices")
Cc: stable <stable@vger.kernel.org>     # 4.19
Cc: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
Cc: Martin Elshuber <martin.elshuber@theobroma-systems.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:16 +01:00
7008e30bf2 spi: Fix NULL pointer when setting SPI_CS_HIGH for GPIO CS
commit 15f794bd97 upstream.

Even if the flag use_gpio_descriptors is set, it is possible that
cs_gpiods was not allocated, which leads to a kernel crash.

Reported-by: "kernelci.org bot" <bot@kernelci.org>
Fixes: 3e5ec1db8b ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS")
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20191024141309.22434-1-gregory.clement@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:15 +01:00
39552e0e71 spi: Fix SPI_CS_HIGH setting when using native and GPIO CS
commit 3e5ec1db8b upstream.

When improving the CS GPIO support at core level, the SPI_CS_HIGH
has been enabled for all the CS lines used for a given SPI controller.

However, the SPI framework allows to have on the same controller native
CS and GPIO CS. The native CS may not support the SPI_CS_HIGH, so they
should not be setup automatically.

With this patch the setting is done only for the CS that will use a
GPIO as CS

Fixes: f3186dd876 ("spi: Optionally use GPIO descriptors for CS GPIOs")
Cc: <stable@vger.kernel.org>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20191018152929.3287-1-gregory.clement@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:14 +01:00
0c6e9bb642 spi: atmel: Fix CS high support
commit 7cbb16b212 upstream.

Until a few years ago, this driver was only used with CS GPIO. The
only exception is CS0 on AT91RM9200 which has to use internal CS. A
limitation of the internal CS is that they don't support CS High.

So by using the CS GPIO the CS high configuration was available except
for the particular case CS0 on RM9200.

When the support for the internal chip-select was added, the check of
the CS high support was not updated. Due to this the driver accepts
this configuration for all the SPI controller v2 (used by all SoCs
excepting the AT91RM9200) whereas the hardware doesn't support it for
infernal CS.

This patch fixes the test to match the hardware capabilities.

Fixes: 4820303480 ("spi: atmel: add support for the internal chip-select of the spi controller")
Cc: <stable@vger.kernel.org>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20191017141846.7523-3-gregory.clement@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:13 +01:00
13978bd2d3 spi: stm32-qspi: Fix kernel oops when unbinding driver
commit 3c0af1dd2f upstream.

spi_master_put() must only be called in .probe() in case of error.

As devm_spi_register_master() is used during probe, spi_master_put()
mustn't be called in .remove() callback.

It fixes the following kernel WARNING/Oops when executing
echo "58003000.spi" > /sys/bus/platform/drivers/stm32-qspi/unbind :

------------[ cut here ]------------
WARNING: CPU: 1 PID: 496 at fs/kernfs/dir.c:1504 kernfs_remove_by_name_ns+0x9c/0xa4
kernfs: can not remove 'uevent', no directory
Modules linked in:
CPU: 1 PID: 496 Comm: sh Not tainted 5.3.0-rc1-00219-ga0e07bb51a37 #62
Hardware name: STM32 (Device Tree Support)
[<c0111570>] (unwind_backtrace) from [<c010d384>] (show_stack+0x10/0x14)
[<c010d384>] (show_stack) from [<c08db558>] (dump_stack+0xb4/0xc8)
[<c08db558>] (dump_stack) from [<c01209d8>] (__warn.part.3+0xbc/0xd8)
[<c01209d8>] (__warn.part.3) from [<c0120a5c>] (warn_slowpath_fmt+0x68/0x8c)
[<c0120a5c>] (warn_slowpath_fmt) from [<c02e5844>] (kernfs_remove_by_name_ns+0x9c/0xa4)
[<c02e5844>] (kernfs_remove_by_name_ns) from [<c05833a4>] (device_del+0x128/0x358)
[<c05833a4>] (device_del) from [<c05835f8>] (device_unregister+0x24/0x64)
[<c05835f8>] (device_unregister) from [<c0638dac>] (spi_unregister_controller+0x88/0xe8)
[<c0638dac>] (spi_unregister_controller) from [<c058c580>] (release_nodes+0x1bc/0x200)
[<c058c580>] (release_nodes) from [<c0588a44>] (device_release_driver_internal+0xec/0x1ac)
[<c0588a44>] (device_release_driver_internal) from [<c0586840>] (unbind_store+0x60/0xd4)
[<c0586840>] (unbind_store) from [<c02e64e8>] (kernfs_fop_write+0xe8/0x1c4)
[<c02e64e8>] (kernfs_fop_write) from [<c0266b44>] (__vfs_write+0x2c/0x1c0)
[<c0266b44>] (__vfs_write) from [<c02694c0>] (vfs_write+0xa4/0x184)
[<c02694c0>] (vfs_write) from [<c0269710>] (ksys_write+0x58/0xd0)
[<c0269710>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x54)
Exception stack(0xdd289fa8 to 0xdd289ff0)
9fa0:                   0000006c 000e20e8 00000001 000e20e8 0000000d 00000000
9fc0: 0000006c 000e20e8 b6f87da0 00000004 0000000d 0000000d 00000000 00000000
9fe0: 00000004 bee639b0 b6f2286b b6eaf6c6
---[ end trace 1b15df8a02d76aef ]---
------------[ cut here ]------------
WARNING: CPU: 1 PID: 496 at fs/kernfs/dir.c:1504 kernfs_remove_by_name_ns+0x9c/0xa4
kernfs: can not remove 'online', no directory
Modules linked in:
CPU: 1 PID: 496 Comm: sh Tainted: G        W         5.3.0-rc1-00219-ga0e07bb51a37 #62
Hardware name: STM32 (Device Tree Support)
[<c0111570>] (unwind_backtrace) from [<c010d384>] (show_stack+0x10/0x14)
[<c010d384>] (show_stack) from [<c08db558>] (dump_stack+0xb4/0xc8)
[<c08db558>] (dump_stack) from [<c01209d8>] (__warn.part.3+0xbc/0xd8)
[<c01209d8>] (__warn.part.3) from [<c0120a5c>] (warn_slowpath_fmt+0x68/0x8c)
[<c0120a5c>] (warn_slowpath_fmt) from [<c02e5844>] (kernfs_remove_by_name_ns+0x9c/0xa4)
[<c02e5844>] (kernfs_remove_by_name_ns) from [<c0582488>] (device_remove_attrs+0x20/0x5c)
[<c0582488>] (device_remove_attrs) from [<c05833b0>] (device_del+0x134/0x358)
[<c05833b0>] (device_del) from [<c05835f8>] (device_unregister+0x24/0x64)
[<c05835f8>] (device_unregister) from [<c0638dac>] (spi_unregister_controller+0x88/0xe8)
[<c0638dac>] (spi_unregister_controller) from [<c058c580>] (release_nodes+0x1bc/0x200)
[<c058c580>] (release_nodes) from [<c0588a44>] (device_release_driver_internal+0xec/0x1ac)
[<c0588a44>] (device_release_driver_internal) from [<c0586840>] (unbind_store+0x60/0xd4)
[<c0586840>] (unbind_store) from [<c02e64e8>] (kernfs_fop_write+0xe8/0x1c4)
[<c02e64e8>] (kernfs_fop_write) from [<c0266b44>] (__vfs_write+0x2c/0x1c0)
[<c0266b44>] (__vfs_write) from [<c02694c0>] (vfs_write+0xa4/0x184)
[<c02694c0>] (vfs_write) from [<c0269710>] (ksys_write+0x58/0xd0)
[<c0269710>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x54)
Exception stack(0xdd289fa8 to 0xdd289ff0)
9fa0:                   0000006c 000e20e8 00000001 000e20e8 0000000d 00000000
9fc0: 0000006c 000e20e8 b6f87da0 00000004 0000000d 0000000d 00000000 00000000
9fe0: 00000004 bee639b0 b6f2286b b6eaf6c6
---[ end trace 1b15df8a02d76af0 ]---
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000050
pgd = e612f14d
[00000050] *pgd=ff1f5835
Internal error: Oops: 17 [#1] SMP ARM
Modules linked in:
CPU: 1 PID: 496 Comm: sh Tainted: G        W         5.3.0-rc1-00219-ga0e07bb51a37 #62
Hardware name: STM32 (Device Tree Support)
PC is at kernfs_find_ns+0x8/0xfc
LR is at kernfs_find_and_get_ns+0x30/0x48
pc : [<c02e49a4>]    lr : [<c02e4ac8>]    psr: 40010013
sp : dd289dac  ip : 00000000  fp : 00000000
r10: 00000000  r9 : def6ec58  r8 : dd289e54
r7 : 00000000  r6 : c0abb234  r5 : 00000000  r4 : c0d26a30
r3 : ddab5080  r2 : 00000000  r1 : c0abb234  r0 : 00000000
Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c5387d  Table: dd11c06a  DAC: 00000051
Process sh (pid: 496, stack limit = 0xe13a592d)
Stack: (0xdd289dac to 0xdd28a000)
9da0:                            c0d26a30 00000000 c0abb234 00000000 c02e4ac8
9dc0: 00000000 c0976b44 def6ec00 dea53810 dd289e54 c02e864c c0a61a48 c0a4a5ec
9de0: c0d630a8 def6ec00 c0d04c48 c02e86e0 def6ec00 de909338 c0d04c48 c05833b0
9e00: 00000000 c0638144 dd289e54 def59900 00000000 475b3ee5 def6ec00 00000000
9e20: def6ec00 def59b80 dd289e54 def59900 00000000 c05835f8 def6ec00 c0638dac
9e40: 0000000a dea53810 c0d04c48 c058c580 dea53810 def59500 def59b80 475b3ee5
9e60: ddc63e00 dea53810 dea3fe10 c0d63a0c dea53810 ddc63e00 dd289f78 dd240d10
9e80: 00000000 c0588a44 c0d59a20 0000000d c0d63a0c c0586840 0000000d dd240d00
9ea0: 00000000 00000000 ddc63e00 c02e64e8 00000000 00000000 c0d04c48 dd9bbcc0
9ec0: c02e6400 dd289f78 00000000 000e20e8 0000000d c0266b44 00000055 00000cc0
9ee0: 000000e3 000e3000 dd11c000 dd11c000 00000000 00000000 00000000 00000000
9f00: ffeee38c dff99688 00000000 475b3ee5 00000001 dd289fb0 ddab5080 ddaa5800
9f20: 00000817 000e30ec dd9e7720 475b3ee5 ddaa583c 0000000d dd9bbcc0 000e20e8
9f40: dd289f78 00000000 000e20e8 0000000d 00000000 c02694c0 00000000 00000000
9f60: c0d04c48 dd9bbcc0 00000000 00000000 dd9bbcc0 c0269710 00000000 00000000
9f80: 000a91f4 475b3ee5 0000006c 000e20e8 b6f87da0 00000004 c0101204 dd288000
9fa0: 00000004 c0101000 0000006c 000e20e8 00000001 000e20e8 0000000d 00000000
9fc0: 0000006c 000e20e8 b6f87da0 00000004 0000000d 0000000d 00000000 00000000
9fe0: 00000004 bee639b0 b6f2286b b6eaf6c6 600e0030 00000001 00000000 00000000
[<c02e49a4>] (kernfs_find_ns) from [<def6ec00>] (0xdef6ec00)
Code: ebf8eeab c0dc50b8 e92d40f0 e292c000 (e1d035b0)
---[ end trace 1b15df8a02d76af1 ]---

Fixes: a88eceb17a ("spi: stm32-qspi: add spi_master_put in release function")
Cc: <stable@vger.kernel.org>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Link: https://lore.kernel.org/r/20191004123606.17241-1-patrice.chotard@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:13 +01:00
c69b17da53 spi: spi-fsl-qspi: Clear TDH bits in FLSHCR register
commit f6910679e1 upstream.

Later versions of the QSPI controller (e.g. in i.MX6UL/ULL and i.MX7)
seem to have an additional TDH setting in the FLSHCR register, that
needs to be set in accordance with the access mode that is used (DDR
or SDR).

Previous bootstages such as BootROM or bootloader might have used the
DDR mode to access the flash. As we currently only use SDR mode, we
need to make sure the TDH bits are cleared upon initialization.

Fixes: 84d043185d ("spi: Add a driver for the Freescale/NXP QuadSPI controller")
Cc: <stable@vger.kernel.org>
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Acked-by: Han Xu <han.xu@nxp.com>
Link: https://lore.kernel.org/r/20191007071933.26786-1-frieder.schrempf@kontron.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:12 +01:00
d8d63ea238 crypto: user - fix memory leak in crypto_reportstat
commit c03b04dcdb upstream.

In crypto_reportstat, a new skb is created by nlmsg_new(). This skb is
leaked if crypto_reportstat_alg() fails. Required release for skb is
added.

Fixes: cac5818c25 ("crypto: user - Implement a generic crypto statistics")
Cc: <stable@vger.kernel.org>
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:11 +01:00
b022e155cc crypto: user - fix memory leak in crypto_report
commit ffdde59320 upstream.

In crypto_report, a new skb is created via nlmsg_new(). This skb should
be released if crypto_report_alg() fails.

Fixes: a38f7907b9 ("crypto: Add userspace configuration API")
Cc: <stable@vger.kernel.org>
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:10 +01:00
8e6d97c5b0 crypto: ecdh - fix big endian bug in ECC library
commit f398243e9f upstream.

The elliptic curve arithmetic library used by the EC-DH KPP implementation
assumes big endian byte order, and unconditionally reverses the byte
and word order of multi-limb quantities. On big endian systems, the byte
reordering is not necessary, while the word ordering needs to be retained.

So replace the __swab64() invocation with a call to be64_to_cpu() which
should do the right thing for both little and big endian builds.

Fixes: 3c4b23901a ("crypto: ecdh - Add ECDH software support")
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:09 +01:00
f1702e2047 crypto: ccp - fix uninitialized list head
commit 691505a803 upstream.

A NULL-pointer dereference was reported in fedora bz#1762199 while
reshaping a raid6 array after adding a fifth drive to an existing
array.

[   47.343549] md/raid:md0: raid level 6 active with 3 out of 5 devices, algorithm 2
[   47.804017] md0: detected capacity change from 0 to 7885289422848
[   47.822083] Unable to handle kernel read from unreadable memory at virtual address 0000000000000000
...
[   47.940477] CPU: 1 PID: 14210 Comm: md0_raid6 Tainted: G        W         5.2.18-200.fc30.aarch64 #1
[   47.949594] Hardware name: AMD Overdrive/Supercharger/To be filled by O.E.M., BIOS ROD1002C 04/08/2016
[   47.958886] pstate: 00400085 (nzcv daIf +PAN -UAO)
[   47.963668] pc : __list_del_entry_valid+0x2c/0xa8
[   47.968366] lr : ccp_tx_submit+0x84/0x168 [ccp]
[   47.972882] sp : ffff00001369b970
[   47.976184] x29: ffff00001369b970 x28: ffff00001369bdb8
[   47.981483] x27: 00000000ffffffff x26: ffff8003b758af70
[   47.986782] x25: ffff8003b758b2d8 x24: ffff8003e6245818
[   47.992080] x23: 0000000000000000 x22: ffff8003e62450c0
[   47.997379] x21: ffff8003dfd6add8 x20: 0000000000000003
[   48.002678] x19: ffff8003e6245100 x18: 0000000000000000
[   48.007976] x17: 0000000000000000 x16: 0000000000000000
[   48.013274] x15: 0000000000000000 x14: 0000000000000000
[   48.018572] x13: ffff7e000ef83a00 x12: 0000000000000001
[   48.023870] x11: ffff000010eff998 x10: 00000000000019a0
[   48.029169] x9 : 0000000000000000 x8 : ffff8003e6245180
[   48.034467] x7 : 0000000000000000 x6 : 000000000000003f
[   48.039766] x5 : 0000000000000040 x4 : ffff8003e0145080
[   48.045064] x3 : dead000000000200 x2 : 0000000000000000
[   48.050362] x1 : 0000000000000000 x0 : ffff8003e62450c0
[   48.055660] Call trace:
[   48.058095]  __list_del_entry_valid+0x2c/0xa8
[   48.062442]  ccp_tx_submit+0x84/0x168 [ccp]
[   48.066615]  async_tx_submit+0x224/0x368 [async_tx]
[   48.071480]  async_trigger_callback+0x68/0xfc [async_tx]
[   48.076784]  ops_run_biofill+0x178/0x1e8 [raid456]
[   48.081566]  raid_run_ops+0x248/0x818 [raid456]
[   48.086086]  handle_stripe+0x864/0x1208 [raid456]
[   48.090781]  handle_active_stripes.isra.0+0xb0/0x278 [raid456]
[   48.096604]  raid5d+0x378/0x618 [raid456]
[   48.100602]  md_thread+0xa0/0x150
[   48.103905]  kthread+0x104/0x130
[   48.107122]  ret_from_fork+0x10/0x18
[   48.110686] Code: d2804003 f2fbd5a3 eb03003f 54000320 (f9400021)
[   48.116766] ---[ end trace 23f390a527f7ad77 ]---

ccp_tx_submit is passed a dma_async_tx_descriptor which is contained in
a ccp_dma_desc and adds it to a ccp channel's pending list:

	list_del(&desc->entry);
	list_add_tail(&desc->entry, &chan->pending);

The problem is that desc->entry may be uninitialized in the
async_trigger_callback path where the descriptor was gotten
from ccp_prep_dma_interrupt which got it from ccp_alloc_dma_desc
which doesn't initialize the desc->entry list head. So, just
initialize the list head to avoid the problem.

Cc: <stable@vger.kernel.org>
Reported-by: Sahaj Sarup <sahajsarup@gmail.com>
Signed-off-by: Mark Salter <msalter@redhat.com>
Acked-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:08 +01:00
a75a2957f0 crypto: geode-aes - switch to skcipher for cbc(aes) fallback
commit 504582e8e4 upstream.

Commit 79c65d179a ("crypto: cbc - Convert to skcipher") updated
the generic CBC template wrapper from a blkcipher to a skcipher algo,
to get away from the deprecated blkcipher interface. However, as a side
effect, drivers that instantiate CBC transforms using the blkcipher as
a fallback no longer work, since skciphers can wrap blkciphers but not
the other way around. This broke the geode-aes driver.

So let's fix it by moving to the sync skcipher interface when allocating
the fallback. At the same time, align with the generic API for ECB and
CBC by rejecting inputs that are not a multiple of the AES block size.

Fixes: 79c65d179a ("crypto: cbc - Convert to skcipher")
Cc: <stable@vger.kernel.org> # v4.20+ ONLY
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Florian Bezdeka <florian@bezdeka.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:08 +01:00
2a00d74e0f crypto: af_alg - cast ki_complete ternary op to int
commit 64e7f852c4 upstream.

when libkcapi test is executed  using HW accelerator, cipher operation
return -74.Since af_alg_async_cb->ki_complete treat err as unsigned int,
libkcapi receive 429467222 even though it expect -ve value.

Hence its required to cast resultlen to int so that proper
error is returned to libkcapi.

AEAD one shot non-aligned test 2(libkcapi test)
./../bin/kcapi   -x 10   -c "gcm(aes)" -i 7815d4b06ae50c9c56e87bd7
-k ea38ac0c9b9998c80e28fb496a2b88d9 -a
"853f98a750098bec1aa7497e979e78098155c877879556bb51ddeb6374cbaefc"
-t "c4ce58985b7203094be1d134c1b8ab0b" -q
"b03692f86d1b8b39baf2abb255197c98"

Fixes: d887c52d6a ("crypto: algif_aead - overhaul memory management")
Cc: <stable@vger.kernel.org>
Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
Signed-off-by: Atul Gupta <atul.gupta@chelsio.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:06 +01:00
96ce5238c7 crypto: atmel-aes - Fix IV handling when req->nbytes < ivsize
commit 86ef1dfcb5 upstream.

commit 394a9e0447 ("crypto: cfb - add missing 'chunksize' property")
adds a test vector where the input length is smaller than the IV length
(the second test vector). This revealed a NULL pointer dereference in
the atmel-aes driver, that is caused by passing an incorrect offset in
scatterwalk_map_and_copy() when atmel_aes_complete() is called.

Do not save the IV in req->info of ablkcipher_request (or equivalently
req->iv of skcipher_request) when req->nbytes < ivsize, because the IV
will not be further used.

While touching the code, modify the type of ivsize from int to
unsigned int, to comply with the return type of
crypto_ablkcipher_ivsize().

Fixes: 91308019ec ("crypto: atmel-aes - properly set IV after {en,de}crypt")
Cc: <stable@vger.kernel.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:05 +01:00
1e863b723e crypto: crypto4xx - fix double-free in crypto4xx_destroy_sdr
commit 746c908c4d upstream.

This patch fixes a crash that can happen during probe
when the available dma memory is not enough (this can
happen if the crypto4xx is built as a module).

The descriptor window mapping would end up being free'd
twice, once in crypto4xx_build_pdr() and the second time
in crypto4xx_destroy_sdr().

Fixes: 5d59ad6eea ("crypto: crypto4xx - fix crypto4xx_build_pdr, crypto4xx_build_sdr leak")
Cc: <stable@vger.kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:04 +01:00
d61ce96433 KVM: x86: Grab KVM's srcu lock when setting nested state
commit ad5996d9a0 upstream.

Acquire kvm->srcu for the duration of ->set_nested_state() to fix a bug
where nVMX derefences ->memslots without holding ->srcu or ->slots_lock.

The other half of nested migration, ->get_nested_state(), does not need
to acquire ->srcu as it is a purely a dump of internal KVM (and CPU)
state to userspace.

Detected as an RCU lockdep splat that is 100% reproducible by running
KVM's state_test selftest with CONFIG_PROVE_LOCKING=y.  Note that the
failing function, kvm_is_visible_gfn(), is only checking the validity of
a gfn, it's not actually accessing guest memory (which is more or less
unsupported during vmx_set_nested_state() due to incorrect MMU state),
i.e. vmx_set_nested_state() itself isn't fundamentally broken.  In any
case, setting nested state isn't a fast path so there's no reason to go
out of our way to avoid taking ->srcu.

  =============================
  WARNING: suspicious RCU usage
  5.4.0-rc7+ #94 Not tainted
  -----------------------------
  include/linux/kvm_host.h:626 suspicious rcu_dereference_check() usage!

               other info that might help us debug this:

  rcu_scheduler_active = 2, debug_locks = 1
  1 lock held by evmcs_test/10939:
   #0: ffff88826ffcb800 (&vcpu->mutex){+.+.}, at: kvm_vcpu_ioctl+0x85/0x630 [kvm]

  stack backtrace:
  CPU: 1 PID: 10939 Comm: evmcs_test Not tainted 5.4.0-rc7+ #94
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  Call Trace:
   dump_stack+0x68/0x9b
   kvm_is_visible_gfn+0x179/0x180 [kvm]
   mmu_check_root+0x11/0x30 [kvm]
   fast_cr3_switch+0x40/0x120 [kvm]
   kvm_mmu_new_cr3+0x34/0x60 [kvm]
   nested_vmx_load_cr3+0xbd/0x1f0 [kvm_intel]
   nested_vmx_enter_non_root_mode+0xab8/0x1d60 [kvm_intel]
   vmx_set_nested_state+0x256/0x340 [kvm_intel]
   kvm_arch_vcpu_ioctl+0x491/0x11a0 [kvm]
   kvm_vcpu_ioctl+0xde/0x630 [kvm]
   do_vfs_ioctl+0xa2/0x6c0
   ksys_ioctl+0x66/0x70
   __x64_sys_ioctl+0x16/0x20
   do_syscall_64+0x54/0x200
   entry_SYSCALL_64_after_hwframe+0x49/0xbe
  RIP: 0033:0x7f59a2b95f47

Fixes: 8fcc4b5923 ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:04 +01:00
a4e2e22148 KVM: x86: Remove a spurious export of a static function
commit 24885d1d79 upstream.

A recent change inadvertently exported a static function, which results
in modpost throwing a warning.  Fix it.

Fixes: cbbaa2727a ("KVM: x86: fix presentation of TSX feature in ARCH_CAPABILITIES")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:03 +01:00
52c8b0c6e1 KVM: x86: fix presentation of TSX feature in ARCH_CAPABILITIES
commit cbbaa2727a upstream.

KVM does not implement MSR_IA32_TSX_CTRL, so it must not be presented
to the guests.  It is also confusing to have !ARCH_CAP_TSX_CTRL_MSR &&
!RTM && ARCH_CAP_TAA_NO: lack of MSR_IA32_TSX_CTRL suggests TSX was not
hidden (it actually was), yet the value says that TSX is not vulnerable
to microarchitectural data sampling.  Fix both.

Cc: stable@vger.kernel.org
Tested-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:02 +01:00
0616125c46 KVM: x86: do not modify masked bits of shared MSRs
commit de1fca5d6e upstream.

"Shared MSRs" are guest MSRs that are written to the host MSRs but
keep their value until the next return to userspace.  They support
a mask, so that some bits keep the host value, but this mask is
only used to skip an unnecessary MSR write and the value written
to the MSR is always the guest MSR.

Fix this and, while at it, do not update smsr->values[slot].curr if
for whatever reason the wrmsr fails.  This should only happen due to
reserved bits, so the value written to smsr->values[slot].curr
will not match when the user-return notifier and the host value will
always be restored.  However, it is untidy and in rare cases this
can actually avoid spurious WRMSRs on return to userspace.

Cc: stable@vger.kernel.org
Reviewed-by: Jim Mattson <jmattson@google.com>
Tested-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:01 +01:00
30bd5c4587 KVM: arm/arm64: vgic: Don't rely on the wrong pending table
commit ca185b2609 upstream.

It's possible that two LPIs locate in the same "byte_offset" but target
two different vcpus, where their pending status are indicated by two
different pending tables.  In such a scenario, using last_byte_offset
optimization will lead KVM relying on the wrong pending table entry.
Let us use last_ptr instead, which can be treated as a byte index into
a pending table and also, can be vcpu specific.

Fixes: 280771252c ("KVM: arm64: vgic-v3: KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES")
Cc: stable@vger.kernel.org
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Eric Auger <eric.auger@redhat.com>
Link: https://lore.kernel.org/r/20191029071919.177-4-yuzenghui@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:43:00 +01:00
815403a6ea KVM: nVMX: Always write vmcs02.GUEST_CR3 during nested VM-Enter
commit 04f11ef458 upstream.

Write the desired L2 CR3 into vmcs02.GUEST_CR3 during nested VM-Enter
instead of deferring the VMWRITE until vmx_set_cr3().  If the VMWRITE
is deferred, then KVM can consume a stale vmcs02.GUEST_CR3 when it
refreshes vmcs12->guest_cr3 during nested_vmx_vmexit() if the emulated
VM-Exit occurs without actually entering L2, e.g. if the nested run
is squashed because nested VM-Enter (from L1) is putting L2 into HLT.

Note, the above scenario can occur regardless of whether L1 is
intercepting HLT, e.g. L1 can intercept HLT and then re-enter L2 with
vmcs.GUEST_ACTIVITY_STATE=HALTED.  But practically speaking, a VMM will
likely put a guest into HALTED if and only if it's not intercepting HLT.

In an ideal world where EPT *requires* unrestricted guest (and vice
versa), VMX could handle CR3 similar to how it handles RSP and RIP,
e.g. mark CR3 dirty and conditionally load it at vmx_vcpu_run().  But
the unrestricted guest silliness complicates the dirty tracking logic
to the point that explicitly handling vmcs02.GUEST_CR3 during nested
VM-Enter is a simpler overall implementation.

Cc: stable@vger.kernel.org
Reported-and-tested-by: Reto Buerki <reet@codelabs.ch>
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:59 +01:00
ff6900f46d KVM: PPC: Book3S HV: XIVE: Set kvm->arch.xive when VPs are allocated
commit e7d71c9430 upstream.

If we cannot allocate the XIVE VPs in OPAL, the creation of a XIVE or
XICS-on-XIVE device is aborted as expected, but we leave kvm->arch.xive
set forever since the release method isn't called in this case. Any
subsequent tentative to create a XIVE or XICS-on-XIVE for this VM will
thus always fail (DoS). This is a problem for QEMU since it destroys
and re-creates these devices when the VM is reset: the VM would be
restricted to using the much slower emulated XIVE or XICS forever.

As an alternative to adding rollback, do not assign kvm->arch.xive before
making sure the XIVE VPs are allocated in OPAL.

Cc: stable@vger.kernel.org # v5.2
Fixes: 5422e95103 ("KVM: PPC: Book3S HV: XIVE: Replace the 'destroy' method by a 'release' method")
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:59 +01:00
88c494172b KVM: PPC: Book3S HV: XIVE: Fix potential page leak on error path
commit 30486e7209 upstream.

We need to check the host page size is big enough to accomodate the
EQ. Let's do this before taking a reference on the EQ page to avoid
a potential leak if the check fails.

Cc: stable@vger.kernel.org # v5.2
Fixes: 13ce3297c5 ("KVM: PPC: Book3S HV: XIVE: Add controls for the EQ configuration")
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:58 +01:00
97c9c012fe KVM: PPC: Book3S HV: XIVE: Free previous EQ page when setting up a new one
commit 31a88c82b4 upstream.

The EQ page is allocated by the guest and then passed to the hypervisor
with the H_INT_SET_QUEUE_CONFIG hcall. A reference is taken on the page
before handing it over to the HW. This reference is dropped either when
the guest issues the H_INT_RESET hcall or when the KVM device is released.
But, the guest can legitimately call H_INT_SET_QUEUE_CONFIG several times,
either to reset the EQ (vCPU hot unplug) or to set a new EQ (guest reboot).
In both cases the existing EQ page reference is leaked because we simply
overwrite it in the XIVE queue structure without calling put_page().

This is especially visible when the guest memory is backed with huge pages:
start a VM up to the guest userspace, either reboot it or unplug a vCPU,
quit QEMU. The leak is observed by comparing the value of HugePages_Free in
/proc/meminfo before and after the VM is run.

Ideally we'd want the XIVE code to handle the EQ page de-allocation at the
platform level. This isn't the case right now because the various XIVE
drivers have different allocation needs. It could maybe worth introducing
hooks for this purpose instead of exposing XIVE internals to the drivers,
but this is certainly a huge work to be done later.

In the meantime, for easier backport, fix both vCPU unplug and guest reboot
leaks by introducing a wrapper around xive_native_configure_queue() that
does the necessary cleanup.

Reported-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org # v5.2
Fixes: 13ce3297c5 ("KVM: PPC: Book3S HV: XIVE: Add controls for the EQ configuration")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Greg Kurz <groug@kaod.org>
Tested-by: Lijun Pan <ljp@linux.ibm.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:58 +01:00
3640045742 arm64: dts: exynos: Revert "Remove unneeded address space mapping for soc node"
commit bed903167a upstream.

Commit ef72171b36 ("arm64: dts: exynos: Remove unneeded address space
mapping for soc node") changed the address and size cells in root node from
2 to 1, but /memory nodes for the affected boards were not updated. This
went unnoticed on Exynos5433-based TM2(e) boards, because they use u-boot,
which updates /memory node to the correct values. On the other hand, the
mentioned commit broke boot on Exynos7-based Espresso board, which
bootloader doesn't touch /memory node at all.

This patch reverts commit ef72171b36 ("arm64: dts: exynos: Remove
unneeded address space mapping for soc node"), so Exynos5433 and Exynos7
SoCs again matches other ARM64 platforms with 64bit mappings in root
node.

Reported-by: Alim Akhtar <alim.akhtar@samsung.com>
Fixes: ef72171b36 ("arm64: dts: exynos: Remove unneeded address space mapping for soc node")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: <stable@vger.kernel.org> # 5.3.x: 72ddcf6aa2 arm64: dts: exynos: Move GPU under /soc node for Exynos5433
Cc: <stable@vger.kernel.org> # 5.3.x: ede87c3a2b arm64: dts: exynos: Move GPU under /soc node for Exynos7
Cc: <stable@vger.kernel.org> # 4.18.x
Tested-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:57 +01:00
1ac33be230 arm64: Validate tagged addresses in access_ok() called from kernel threads
commit df325e05a6 upstream.

__range_ok(), invoked from access_ok(), clears the tag of the user
address only if CONFIG_ARM64_TAGGED_ADDR_ABI is enabled and the thread
opted in to the relaxed ABI. The latter sets the TIF_TAGGED_ADDR thread
flag. In the case of asynchronous I/O (e.g. io_submit()), the
access_ok() may be called from a kernel thread. Since kernel threads
don't have TIF_TAGGED_ADDR set, access_ok() will fail for valid tagged
user addresses. Example from the ffs_user_copy_worker() thread:

	use_mm(io_data->mm);
	ret = ffs_copy_to_iter(io_data->buf, ret, &io_data->data);
	unuse_mm(io_data->mm);

Relax the __range_ok() check to always untag the user address if called
in the context of a kernel thread. The user pointers would have already
been checked via aio_setup_rw() -> import_{single_range,iovec}() at the
time of the asynchronous I/O request.

Fixes: 63f0c60379 ("arm64: Introduce prctl() options to control the tagged user addresses ABI")
Cc: <stable@vger.kernel.org> # 5.4.x-
Cc: Will Deacon <will@kernel.org>
Reported-by: Evgenii Stepanov <eugenis@google.com>
Tested-by: Evgenii Stepanov <eugenis@google.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:56 +01:00
5d8115f535 drm/i810: Prevent underflow in ioctl
commit 4f69851fba upstream.

The "used" variables here come from the user in the ioctl and it can be
negative.  It could result in an out of bounds write.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20191004102251.GC823@mwanda
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:56 +01:00
a77ab31626 drm: damage_helper: Fix race checking plane->state->fb
commit 354c2d3100 upstream.

Since the dirtyfb ioctl doesn't give us any hints as to which plane is
scanning out the fb it's marking as damaged, we need to loop through
planes to find it.

Currently we just reach into plane state and check, but that can race
with another commit changing the fb out from under us. This patch locks
the plane before checking the fb and will release the lock if the plane
is not displaying the dirty fb.

Fixes: b9fc5e01d1 ("drm: Add helper to implement legacy dirtyfb")
Cc: Rob Clark <robdclark@gmail.com>
Cc: Deepak Rawat <drawat@vmware.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v5.0+
Reported-by: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190904202938.110207-1-sean@poorly.run
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:55 +01:00
693f399753 drm/msm: fix memleak on release
commit a64fc11b9a upstream.

If a process is interrupted while accessing the "gpu" debugfs file and
the drm device struct_mutex is contended, release() could return early
and fail to free related resources.

Note that the return value from release() is ignored.

Fixes: 4f776f4511 ("drm/msm/gpu: Convert the GPU show function to use the GPU state")
Cc: stable <stable@vger.kernel.org>     # 4.18
Cc: Jordan Crouse <jcrouse@codeaurora.org>
Cc: Rob Clark <robdclark@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191010131333.23635-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:54 +01:00
1a6a96e0ff jbd2: Fix possible overflow in jbd2_log_space_left()
commit add3efdd78 upstream.

When number of free space in the journal is very low, the arithmetic in
jbd2_log_space_left() could underflow resulting in very high number of
free blocks and thus triggering assertion failure in transaction commit
code complaining there's not enough space in the journal:

J_ASSERT(journal->j_free > 1);

Properly check for the low number of free blocks.

CC: stable@vger.kernel.org
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20191105164437.32602-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:53 +01:00
01e7ab5b9b kernfs: fix ino wrap-around detection
commit e23f568aa6 upstream.

When the 32bit ino wraps around, kernfs increments the generation
number to distinguish reused ino instances.  The wrap-around detection
tests whether the allocated ino is lower than what the cursor but the
cursor is pointing to the next ino to allocate so the condition never
triggers.

Fix it by remembering the last ino and comparing against that.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 4a3ef68aca ("kernfs: implement i_generation")
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: stable@vger.kernel.org # v4.14+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:53 +01:00
451b1d966a nfsd: restore NFSv3 ACL support
commit 7c149057d0 upstream.

An error in e333f3bbef left the nfsd_acl_program->pg_vers array empty,
which effectively turned off the server's support for NFSv3 ACLs.

Fixes: e333f3bbef "nfsd: Allow containers to set supported nfs versions"
Cc: stable@vger.kernel.org
Cc: Trond Myklebust <trondmy@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:52 +01:00
e02a226b27 nfsd: Ensure CLONE persists data and metadata changes to the target file
commit a25e3726b3 upstream.

The NFSv4.2 CLONE operation has implicit persistence requirements on the
target file, since there is no protocol requirement that the client issue
a separate operation to persist data.
For that reason, we should call vfs_fsync_range() on the destination file
after a successful call to vfs_clone_file_range().

Fixes: ffa0160a10 ("nfsd: implement the NFSv4.2 CLONE operation")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:51 +01:00
11ac30b4f0 can: slcan: Fix use-after-free Read in slcan_open
commit 9ebd796e24 upstream.

Slcan_open doesn't clean-up device which registration failed from the
slcan_devs device list. On next open this list is iterated and freed
device is accessed. Fix this by calling slc_free_netdev in error path.

Driver/net/can/slcan.c is derived from slip.c. Use-after-free error was
identified in slip_open by syzboz. Same bug is in slcan.c. Here is the
trace from the Syzbot slip report:

__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x197/0x210 lib/dump_stack.c:118
print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
__kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
kasan_report+0x12/0x20 mm/kasan/common.c:634
__asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
sl_sync drivers/net/slip/slip.c:725 [inline]
slip_open+0xecd/0x11b7 drivers/net/slip/slip.c:801
tty_ldisc_open.isra.0+0xa3/0x110 drivers/tty/tty_ldisc.c:469
tty_set_ldisc+0x30e/0x6b0 drivers/tty/tty_ldisc.c:596
tiocsetd drivers/tty/tty_io.c:2334 [inline]
tty_ioctl+0xe8d/0x14f0 drivers/tty/tty_io.c:2594
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:509 [inline]
do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:696
ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
__do_sys_ioctl fs/ioctl.c:720 [inline]
__se_sys_ioctl fs/ioctl.c:718 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Fixes: ed50e1600b ("slcan: Fix memory leak in error path")
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: David Miller <davem@davemloft.net>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Jouni Hogander <jouni.hogander@unikie.com>
Cc: linux-stable <stable@vger.kernel.org> # >= v5.4
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:50 +01:00
a3812fe7a4 tty: vt: keyboard: reject invalid keycodes
commit b2b2dd71e0 upstream.

Do not try to handle keycodes that are too big, otherwise we risk doing
out-of-bounds writes:

BUG: KASAN: global-out-of-bounds in clear_bit include/asm-generic/bitops-instrumented.h:56 [inline]
BUG: KASAN: global-out-of-bounds in kbd_keycode drivers/tty/vt/keyboard.c:1411 [inline]
BUG: KASAN: global-out-of-bounds in kbd_event+0xe6b/0x3790 drivers/tty/vt/keyboard.c:1495
Write of size 8 at addr ffffffff89a1b2d8 by task syz-executor108/1722
...
 kbd_keycode drivers/tty/vt/keyboard.c:1411 [inline]
 kbd_event+0xe6b/0x3790 drivers/tty/vt/keyboard.c:1495
 input_to_handler+0x3b6/0x4c0 drivers/input/input.c:118
 input_pass_values.part.0+0x2e3/0x720 drivers/input/input.c:145
 input_pass_values drivers/input/input.c:949 [inline]
 input_set_keycode+0x290/0x320 drivers/input/input.c:954
 evdev_handle_set_keycode_v2+0xc4/0x120 drivers/input/evdev.c:882
 evdev_do_ioctl drivers/input/evdev.c:1150 [inline]

In this case we were dealing with a fuzzed HID device that declared over
12K buttons, and while HID layer should not be reporting to us such big
keycodes, we should also be defensive and reject invalid data ourselves as
well.

Reported-by: syzbot+19340dff067c2d3835c0@syzkaller.appspotmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191122204220.GA129459@dtor-ws
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:50 +01:00
b1dd777a27 CIFS: Fix SMB2 oplock break processing
commit fa9c236249 upstream.

Even when mounting modern protocol version the server may be
configured without supporting SMB2.1 leases and the client
uses SMB2 oplock to optimize IO performance through local caching.

However there is a problem in oplock break handling that leads
to missing a break notification on the client who has a file
opened. It latter causes big latencies to other clients that
are trying to open the same file.

The problem reproduces when there are multiple shares from the
same server mounted on the client. The processing code tries to
match persistent and volatile file ids from the break notification
with an open file but it skips all share besides the first one.
Fix this by looking up in all shares belonging to the server that
issued the oplock break.

Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:48 +01:00
ee4f281989 CIFS: Fix NULL-pointer dereference in smb2_push_mandatory_locks
commit 6f582b273e upstream.

Currently when the client creates a cifsFileInfo structure for
a newly opened file, it allocates a list of byte-range locks
with a pointer to the new cfile and attaches this list to the
inode's lock list. The latter happens before initializing all
other fields, e.g. cfile->tlink. Thus a partially initialized
cifsFileInfo structure becomes available to other threads that
walk through the inode's lock list. One example of such a thread
may be an oplock break worker thread that tries to push all
cached byte-range locks. This causes NULL-pointer dereference
in smb2_push_mandatory_locks() when accessing cfile->tlink:

[598428.945633] BUG: kernel NULL pointer dereference, address: 0000000000000038
...
[598428.945749] Workqueue: cifsoplockd cifs_oplock_break [cifs]
[598428.945793] RIP: 0010:smb2_push_mandatory_locks+0xd6/0x5a0 [cifs]
...
[598428.945834] Call Trace:
[598428.945870]  ? cifs_revalidate_mapping+0x45/0x90 [cifs]
[598428.945901]  cifs_oplock_break+0x13d/0x450 [cifs]
[598428.945909]  process_one_work+0x1db/0x380
[598428.945914]  worker_thread+0x4d/0x400
[598428.945921]  kthread+0x104/0x140
[598428.945925]  ? process_one_work+0x380/0x380
[598428.945931]  ? kthread_park+0x80/0x80
[598428.945937]  ret_from_fork+0x35/0x40

Fix this by reordering initialization steps of the cifsFileInfo
structure: initialize all the fields first and then add the new
byte-range lock list to the inode's lock list.

Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:47 +01:00
965f6dee89 x86/PCI: Avoid AMD FCH XHCI USB PME# from D0 defect
commit 7e8ce0e2b0 upstream.

The AMD FCH USB XHCI Controller advertises support for generating PME#
while in D0.  When in D0, it does signal PME# for USB 3.0 connect events,
but not for USB 2.0 or USB 1.1 connect events, which means the controller
doesn't wake correctly for those events.

  00:10.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller [1022:7914] (rev 20) (prog-if 30 [XHCI])
        Subsystem: Dell FCH USB XHCI Controller [1028:087e]
        Capabilities: [50] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)

Clear PCI_PM_CAP_PME_D0 in dev->pme_support to indicate the device will not
assert PME# from D0 so we don't rely on it.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203673
Link: https://lore.kernel.org/r/20190902145252.32111-1-kai.heng.feng@canonical.com
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:46 +01:00
89398a7fc4 x86/mm/32: Sync only to VMALLOC_END in vmalloc_sync_all()
commit 9a62d20027 upstream.

The job of vmalloc_sync_all() is to help the lazy freeing of vmalloc()
ranges: before such vmap ranges are reused we make sure that they are
unmapped from every task's page tables.

This is really easy on pagetable setups where the kernel page tables
are shared between all tasks - this is the case on 32-bit kernels
with SHARED_KERNEL_PMD = 1.

But on !SHARED_KERNEL_PMD 32-bit kernels this involves iterating
over the pgd_list and clearing all pmd entries in the pgds that
are cleared in the init_mm.pgd, which is the reference pagetable
that the vmalloc() code uses.

In that context the current practice of vmalloc_sync_all() iterating
until FIX_ADDR_TOP is buggy:

        for (address = VMALLOC_START & PMD_MASK;
             address >= TASK_SIZE_MAX && address < FIXADDR_TOP;
             address += PMD_SIZE) {
                struct page *page;

Because iterating up to FIXADDR_TOP will involve a lot of non-vmalloc
address ranges:

	VMALLOC -> PKMAP -> LDT -> CPU_ENTRY_AREA -> FIX_ADDR

This is mostly harmless for the FIX_ADDR and CPU_ENTRY_AREA ranges
that don't clear their pmds, but it's lethal for the LDT range,
which relies on having different mappings in different processes,
and 'synchronizing' them in the vmalloc sense corrupts those
pagetable entries (clearing them).

This got particularly prominent with PTI, which turns SHARED_KERNEL_PMD
off and makes this the dominant mapping mode on 32-bit.

To make LDT working again vmalloc_sync_all() must only iterate over
the volatile parts of the kernel address range that are identical
between all processes.

So the correct check in vmalloc_sync_all() is "address < VMALLOC_END"
to make sure the VMALLOC areas are synchronized and the LDT
mapping is not falsely overwritten.

The CPU_ENTRY_AREA and the FIXMAP area are no longer synced either,
but this is not really a proplem since their PMDs get established
during bootup and never change.

This change fixes the ldt_gdt selftest in my setup.

[ mingo: Fixed up the changelog to explain the logic and modified the
         copying to only happen up until VMALLOC_END. ]

Reported-by: Borislav Petkov <bp@suse.de>
Tested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Cc: <stable@vger.kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: hpa@zytor.com
Fixes: 7757d607c6: ("x86/pti: Allow CONFIG_PAGE_TABLE_ISOLATION for x86_32")
Link: https://lkml.kernel.org/r/20191126111119.GA110513@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:46 +01:00
6f9e8b6244 media: rc: mark input device as pointing stick
commit ce819649b0 upstream.

libinput refuses pointer movement from rc-core, since it believes it's not
a pointer-type device:

libinput error: event17 - Media Center Ed. eHome Infrared Remote Transceiver (1784:0008): libinput bug: REL_X/Y from a non-pointer device

Fixes: 158bc148a3 ("media: rc: mce_kbd: input events via rc-core's input device")
Fixes: 0ac5a603a7 ("media: rc: imon: report mouse events using rc-core's input device")
Cc: stable@vger.kernel.org # 4.20+
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:45 +01:00
9eb2551315 Input: Fix memory leak in psxpad_spi_probe
In the implementation of psxpad_spi_probe() the allocated memory for
pdev is leaked if psxpad_spi_init_ff() or input_register_polled_device()
fail. The solution is using device managed allocation, like the one used
for pad. Perform the allocation using
devm_input_allocate_polled_device().

Fixes: 8be193c7b1 ("Input: add support for PlayStation 1/2 joypads connected via SPI")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:44 +01:00
a295943689 coresight: etm4x: Fix input validation for sysfs.
commit 2fe6899e36 upstream.

A number of issues are fixed relating to sysfs input validation:-

1) bb_ctrl_store() - incorrect compare of bit select field to absolute
value. Reworked per ETMv4 specification.
2) seq_event_store() - incorrect mask value - register has two
event values.
3) cyc_threshold_store() - must mask with max before checking min
otherwise wrapped values can set illegal value below min.
4) res_ctrl_store() - update to mask off all res0 bits.

Reviewed-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Mike Leach <mike.leach@linaro.org>
Fixes: a77de2637c ("coresight: etm4x: moving sysFS entries to a dedicated file")
Cc: stable <stable@vger.kernel.org> # 4.9+
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20191104181251.26732-6-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:43 +01:00
8b14c2925d Input: goodix - add upside-down quirk for Teclast X89 tablet
commit df5b5e555b upstream.

The touchscreen on the Teclast X89 is mounted upside down in relation to
the display orientation (the touchscreen itself is mounted upright, but the
display is mounted upside-down). Add a quirk for this so that we send
coordinates which match the display orientation.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bastien Nocera <hadess@hadess.net>
Link: https://lore.kernel.org/r/20191202085636.6650-1-hdegoede@redhat.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:42 +01:00
1efa3aff82 Input: synaptics-rmi4 - don't increment rmiaddr for SMBus transfers
commit a284e11c37 upstream.

This increment of rmi_smbus in rmi_smb_read/write_block() causes
garbage to be read/written.

The first read of SMB_MAX_COUNT bytes is fine, but after that
it is nonsense. Trial-and-error showed that by dropping the
increment of rmiaddr everything is fine and the F54 function
properly works.

I tried a hack with rmi_smb_write_block() as well (writing to the
same F54 touchpad data area, then reading it back), and that
suggests that there too the rmiaddr increment has to be dropped.
It makes sense that if it has to be dropped for read, then it has
to be dropped for write as well.

It looks like the initial work with F54 was done using i2c, not smbus,
and it seems nobody ever tested F54 with smbus. The other functions
all read/write less than SMB_MAX_COUNT as far as I can tell, so this
issue was never noticed with non-F54 functions.

With this change I can read out the touchpad data correctly on my
Lenovo X1 Carbon 6th Gen laptop.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Link: https://lore.kernel.org/r/8dd22e21-4933-8e9c-a696-d281872c8de7@xs4all.nl
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:42 +01:00
b4ea1f788f Input: synaptics-rmi4 - re-enable IRQs in f34v7_do_reflash
commit 86bcd3a129 upstream.

F34 is a bit special as it reinitializes the device and related driver
structs during the firmware update. This clears the fn_irq_mask which
will then prevent F34 from receiving further interrupts, leading to
timeouts during the firmware update. Make sure to reinitialize the
IRQ enables at the appropriate times.

The issue is in F34 code, but the commit in the fixes tag exposed the
issue, as before this commit things would work by accident.

Fixes: 363c53875a (Input: synaptics-rmi4 - avoid processing unknown IRQs)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://lore.kernel.org/r/20191129133514.23224-1-l.stach@pengutronix.de
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:41 +01:00
2a8e38a8b9 Input: synaptics - switch another X1 Carbon 6 to RMI/SMbus
commit fc1156f373 upstream.

Some Lenovo X1 Carbon Gen 6 laptops report LEN0091. Add this
to the smbus_pnp_ids list.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20191119105118.54285-2-hverkuil-cisco@xs4all.nl
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:40 +01:00
92f7cd863d soc: mediatek: cmdq: fixup wrong input order of write api
commit 47b6b604b2 upstream.

Fixup a issue was caused by the previous fixup patch.

Fixes: 1a92f98912 ("soc: mediatek: cmdq: reorder the parameter")

Link: https://lore.kernel.org/r/20191127165428.19662-1-matthias.bgg@gmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:40 +01:00
d050d28073 ALSA: hda: Modify stream stripe mask only when needed
commit e38e486d66 upstream.

The recent commit in HD-audio stream management for changing the
stripe control seems causing a regression on some platforms.  The
stripe control is currently used only by HDMI codec, and applying the
stripe mask unconditionally may lead to scratchy and static noises as
seen on some MacBooks.

For addressing the regression, this patch changes the stream
management code to apply the stripe mask conditionally only when the
codec driver requested.

Fixes: 9b6f7e7a29 ("ALSA: hda: program stripe bits for controller")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204477
Tested-by: Michael Pobega <mpobega@neverware.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191202074947.1617-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:39 +01:00
feebcef2fd ALSA: hda - Add mute led support for HP ProBook 645 G4
commit e190de6941 upstream.

Mic mute led does not work on HP ProBook 645 G4.
We can use CXT_FIXUP_MUTE_LED_GPIO fixup to support it.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191120082035.18937-1-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:38 +01:00
d2d135cba8 ALSA: pcm: oss: Avoid potential buffer overflows
commit 4cc8d6505a upstream.

syzkaller reported an invalid access in PCM OSS read, and this seems
to be an overflow of the internal buffer allocated for a plugin.
Since the rate plugin adjusts its transfer size dynamically, the
calculation for the chained plugin might be bigger than the given
buffer size in some extreme cases, which lead to such an buffer
overflow as caught by KASAN.

Fix it by limiting the max transfer size properly by checking against
the destination size in each plugin transfer callback.

Reported-by: syzbot+f153bde47a62e0b05f83@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191204144824.17801-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:38 +01:00
b8cc281681 ALSA: hda/realtek - Fix inverted bass GPIO pin on Acer 8951G
commit 336820c437 upstream.

We've added the bass speaker support on Acer 8951G by the commit
00066e9733 ("Add Acer Aspire Ethos 8951G model quirk"), but it seems
that the GPIO pin was wrongly set: while the commit turns off the bit
to power up the amp, the actual hardware reacts other way round,
i.e. GPIO bit on = amp on.

So this patch fixes the bug, turning on the GPIO bit 0x02 as default.
Since turning on the GPIO bit can be more easily managed with
alc_setup_gpio() call, we simplify the quirk code by integrating the
GPIO setup into the existing alc662_fixup_aspire_ethos_hp() and
dropping the whole ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER quirk.

Fixes: 00066e9733 ("Add Acer Aspire Ethos 8951G model quirk")
Reported-and-tested-by: Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191128202630.6626-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:37 +01:00
e3743f4311 ALSA: hda/realtek - Dell headphone has noise on unmute for ALC236
commit e1e8c1fdce upstream.

headphone have noise even the volume is very small.
Let it fill up pcbeep hidden register to default value.
The issue was gone.

Fixes: 4344aec84b ("ALSA: hda/realtek - New codec support for ALC256")
Fixes: 736f20a706 ("ALSA: hda/realtek - Add support for ALC236/ALC3204")
Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/9ae47f23a64d4e41a9c81e263cd8a250@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:36 +01:00
e0d9c5c5e9 ALSA: hda/realtek - Enable the headset-mic on a Xiaomi's laptop
commit 695d1ec399 upstream.

The headset on this machine is not defined, after applying the quirk
ALC256_FIXUP_ASUS_HEADSET_MIC, the headset-mic works well

BugLink: https://bugs.launchpad.net/bugs/1846148
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20191121025427.8856-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:36 +01:00
f40b02538b ALSA: hda/realtek - Enable internal speaker of ASUS UX431FLC
commit 436e25505f upstream.

Laptops like ASUS UX431FLC and UX431FL can share the same audio quirks.
But UX431FLC needs one more step to enable the internal speaker: Pull
the GPIO from CODEC to initialize the AMP.

Fixes: 60083f9e94 ("ALSA: hda/realtek - Enable internal speaker & headset mic of ASUS UX431FL")
Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191125093405.5702-1-jian-hong@endlessm.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:35 +01:00
96b209dc22 SUNRPC: Avoid RPC delays when exiting suspend
commit 66eb3add45 upstream.

Jon Hunter: "I have been tracking down another suspend/NFS related
issue where again I am seeing random delays exiting suspend. The delays
can be up to a couple minutes in the worst case and this is causing a
suspend test we have to fail."

Change the use of a deferrable work to a standard delayed one.

Reported-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Fixes: 7e0a0e38fc ("SUNRPC: Replace the queue timer with a delayed work function")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:34 +01:00
74dcfcd1d3 io_uring: ensure req->submit is copied when req is deferred
There's an issue with deferred requests through drain, where if we do
need to defer, we're not copying over the sqe_submit state correctly.
This can result in using uninitialized data when we then later go and
submit the deferred request, like this check in __io_submit_sqe():

         if (unlikely(s->index >= ctx->sq_entries))
                 return -EINVAL;

with 's' being uninitialized, we can randomly fail this check. Fix this
by copying sqe_submit state when we defer a request.

Because it was fixed as part of a cleanup series in mainline, before
anyone realized we had this issue. That removed the separate states
of ->index vs ->submit.sqe. That series is not something I was
comfortable putting into stable, hence the much simpler addition.
Here's the patch in the series that fixes the same issue:

commit cf6fd4bd55
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Mon Nov 25 23:14:39 2019 +0300

    io_uring: inline struct sqe_submit

Reported-by: Andres Freund <andres@anarazel.de>
Reported-by: Tomáš Chaloupka
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:33 +01:00
1dec7fcac3 io_uring: fix missing kmap() declaration on powerpc
commit aa4c396775 upstream.

Christophe reports that current master fails building on powerpc with
this error:

   CC      fs/io_uring.o
fs/io_uring.c: In function ‘loop_rw_iter’:
fs/io_uring.c:1628:21: error: implicit declaration of function ‘kmap’
[-Werror=implicit-function-declaration]
     iovec.iov_base = kmap(iter->bvec->bv_page)
                      ^
fs/io_uring.c:1628:19: warning: assignment makes pointer from integer
without a cast [-Wint-conversion]
     iovec.iov_base = kmap(iter->bvec->bv_page)
                    ^
fs/io_uring.c:1643:4: error: implicit declaration of function ‘kunmap’
[-Werror=implicit-function-declaration]
     kunmap(iter->bvec->bv_page);
     ^

which is caused by a missing highmem.h include. Fix it by including
it.

Fixes: 311ae9e159 ("io_uring: fix dead-hung for non-iter fixed rw")
Reported-by: Christophe Leroy <christophe.leroy@c-s.fr>
Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:32 +01:00
cbc5b45148 fuse: verify attributes
commit eb59bd17d2 upstream.

If a filesystem returns negative inode sizes, future reads on the file were
causing the cpu to spin on truncate_pagecache.

Create a helper to validate the attributes.  This now does two things:

 - check the file mode
 - check if the file size fits in i_size without overflowing

Reported-by: Arijit Banerjee <arijit@rubrik.com>
Fixes: d8a5ba4545 ("[PATCH] FUSE - core")
Cc: <stable@vger.kernel.org> # v2.6.14
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:31 +01:00
8aa5c23ef8 fuse: verify write return
commit 8aab336b14 upstream.

Make sure filesystem is not returning a bogus number of bytes written.

Fixes: ea9b9907b8 ("fuse: implement perform_write")
Cc: <stable@vger.kernel.org> # v2.6.26
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:31 +01:00
ba916a1310 fuse: verify nlink
commit c634da718d upstream.

When adding a new hard link, make sure that i_nlink doesn't overflow.

Fixes: ac45d61357 ("fuse: fix nlink after unlink")
Cc: <stable@vger.kernel.org> # v3.4
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:30 +01:00
a266e9072a fuse: fix leak of fuse_io_priv
commit f1ebdeffc6 upstream.

exit_aio() is sometimes stuck in wait_for_completion() after aio is issued
with direct IO and the task receives a signal.

The reason is failure to call ->ki_complete() due to a leaked reference to
fuse_io_priv.  This happens in fuse_async_req_send() if
fuse_simple_background() returns an error (e.g. -EINTR).

In this case the error value is propagated via io->err, so return success
to not confuse callers.

This issue is tracked as a virtio-fs issue:
https://gitlab.com/virtio-fs/qemu/issues/14

Reported-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Fixes: 45ac96ed7c ("fuse: convert direct_io to simple api")
Cc: <stable@vger.kernel.org> # v5.4
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:30 +01:00
57aabff8cc io_uring: transform send/recvmsg() -ERESTARTSYS to -EINTR
commit 441cdbd544 upstream.

We should never return -ERESTARTSYS to userspace, transform it into
-EINTR.

Cc: stable@vger.kernel.org # v5.3+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:28 +01:00
f246eedbaf io_uring: fix dead-hung for non-iter fixed rw
commit 311ae9e159 upstream.

Read/write requests to devices without implemented read/write_iter
using fixed buffers can cause general protection fault, which totally
hangs a machine.

io_import_fixed() initialises iov_iter with bvec, but loop_rw_iter()
accesses it as iovec, dereferencing random address.

kmap() page by page in this case

Cc: stable@vger.kernel.org
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:27 +01:00
3b2b7b8954 mwifiex: Re-work support for SDIO HW reset
commit cdb2256f79 upstream.

The SDIO HW reset procedure in mwifiex_sdio_card_reset_work() is broken,
when the SDIO card is shared with another SDIO func driver. This is the
case when the Bluetooth btmrvl driver is being used in combination with
mwifiex. More precisely, when mwifiex_sdio_card_reset_work() runs to resets
the SDIO card, the btmrvl driver doesn't get notified about it. Beyond that
point, the btmrvl driver will fail to communicate with the SDIO card.

This is a generic problem for SDIO func drivers sharing an SDIO card, which
are about to be addressed in subsequent changes to the mmc core and the
mmc_hw_reset() interface. In principle, these changes means the
mmc_hw_reset() interface starts to return 1 if the are multiple drivers for
the SDIO card, as to indicate to the caller that the reset needed to be
scheduled asynchronously through a hotplug mechanism of the SDIO card.

Let's prepare the mwifiex driver to support the upcoming new behaviour of
mmc_hw_reset(), which means extending the mwifiex_sdio_card_reset_work() to
support the asynchronous SDIO HW reset path. This also means, we need to
allow the ->remove() callback to run, without waiting for the FW to be
loaded. Additionally, during system suspend, mwifiex_sdio_suspend() may be
called when a reset has been scheduled, but waiting to be executed. In this
scenario let's simply return -EBUSY to abort the suspend process, as to
allow the reset to be completed first.

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Cc: stable@vger.kernel.org # v5.4+
Acked-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:26 +01:00
b6e7b24af3 serial: ifx6x60: add missed pm_runtime_disable
commit 50b2b571c5 upstream.

The driver forgets to call pm_runtime_disable in remove.
Add the missed calls to fix it.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191118024833.21587-1-hslester96@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:25 +01:00
2c72cd48ab serial: 8250_dw: Avoid double error messaging when IRQ absent
commit 05faa64e73 upstream.

Since the commit 7723f4c5ec ("driver core: platform: Add an error message
to platform_get_irq*()") platform_get_irq() started issuing an error message.
Thus, there is no need to have the same in the driver

Fixes: 7723f4c5ec ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191023103558.51862-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:25 +01:00
bc441f7390 serial: stm32: fix clearing interrupt error flags
commit 1250ed7114 upstream.

The interrupt clear flag register is a "write 1 to clear" register.
So, only writing ones allows to clear flags:
- Replace buggy stm32_clr_bits() by a simple write to clear error flags
- Replace useless read/modify/write stm32_set_bits() routine by a
  simple write to clear TC (transfer complete) flag.

Fixes: 4f01d833fd ("serial: stm32: fix rx error handling")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1574323849-1909-1-git-send-email-fabrice.gasnier@st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:24 +01:00
6e728a5792 serial: serial_core: Perform NULL checks for break_ctl ops
commit 7d73170e1c upstream.

Doing fuzz test on sbsa uart device, causes a kernel crash
due to NULL pointer dereference:

------------[ cut here ]------------
Unable to handle kernel paging request at virtual address fffffffffffffffc
pgd = ffffffe331723000
[fffffffffffffffc] *pgd=0000002333595003, *pud=0000002333595003, *pmd=00000
Internal error: Oops: 96000005 [#1] PREEMPT SMP
Modules linked in: ping(O) jffs2 rtos_snapshot(O) pramdisk(O) hisi_sfc(O)
Drv_Nandc_K(O) Drv_SysCtl_K(O) Drv_SysClk_K(O) bsp_reg(O) hns3(O)
hns3_uio_enet(O) hclgevf(O) hclge(O) hnae3(O) mdio_factory(O)
mdio_registry(O) mdio_dev(O) mdio(O) hns3_info(O) rtos_kbox_panic(O)
uart_suspend(O) rsm(O) stp llc tunnel4 xt_tcpudp ipt_REJECT nf_reject_ipv4
iptable_filter ip_tables x_tables sd_mod xhci_plat_hcd xhci_pci xhci_hcd
usbmon usbhid usb_storage ohci_platform ohci_pci ohci_hcd hid_generic hid
ehci_platform ehci_pci ehci_hcd vfat fat usbcore usb_common scsi_mod
yaffs2multi(O) ext4 jbd2 ext2 mbcache ofpart i2c_dev i2c_core uio ubi nand
nand_ecc nand_ids cfi_cmdset_0002 cfi_cmdset_0001 cfi_probe gen_probe
cmdlinepart chipreg mtdblock mtd_blkdevs mtd nfsd auth_rpcgss oid_registry
nfsv3 nfs nfs_acl lockd sunrpc grace autofs4
CPU: 2 PID: 2385 Comm: tty_fuzz_test Tainted: G           O    4.4.193 #1
task: ffffffe32b23f110 task.stack: ffffffe32bda4000
PC is at uart_break_ctl+0x44/0x84
LR is at uart_break_ctl+0x34/0x84
pc : [<ffffff8393196098>] lr : [<ffffff8393196088>] pstate: 80000005
sp : ffffffe32bda7cc0
x29: ffffffe32bda7cc0 x28: ffffffe32b23f110
x27: ffffff8393402000 x26: 0000000000000000
x25: ffffffe32b233f40 x24: ffffffc07a8ec680
x23: 0000000000005425 x22: 00000000ffffffff
x21: ffffffe33ed73c98 x20: 0000000000000000
x19: ffffffe33ed94168 x18: 0000000000000004
x17: 0000007f92ae9d30 x16: ffffff8392fa6064
x15: 0000000000000010 x14: 0000000000000000
x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000020 x10: 0000007ffdac1708
x9 : 0000000000000078 x8 : 000000000000001d
x7 : 0000000052a64887 x6 : ffffffe32bda7e08
x5 : ffffffe32b23c000 x4 : 0000005fbc5b0000
x3 : ffffff83938d5018 x2 : 0000000000000080
x1 : ffffffe32b23c040 x0 : ffffff83934428f8
virtual start addr offset is 38ac00000
module base offset is 2cd4cf1000
linear region base offset is : 0
Process tty_fuzz_test (pid: 2385, stack limit = 0xffffffe32bda4000)
Stack: (0xffffffe32bda7cc0 to 0xffffffe32bda8000)
7cc0: ffffffe32bda7cf0 ffffff8393177718 ffffffc07a8ec680 ffffff8393196054
7ce0: 000000001739f2e0 0000007ffdac1978 ffffffe32bda7d20 ffffff8393179a1c
7d00: 0000000000000000 ffffff8393c0a000 ffffffc07a8ec680 cb88537fdc8ba600
7d20: ffffffe32bda7df0 ffffff8392fa5a40 ffffff8393c0a000 0000000000005425
7d40: 0000007ffdac1978 ffffffe32b233f40 ffffff8393178dcc 0000000000000003
7d60: 000000000000011d 000000000000001d ffffffe32b23f110 000000000000029e
7d80: ffffffe34fe8d5d0 0000000000000000 ffffffe32bda7e14 cb88537fdc8ba600
7da0: ffffffe32bda7e30 ffffff8393042cfc ffffff8393c41720 ffffff8393c46410
7dc0: ffffff839304fa68 ffffffe32b233f40 0000000000005425 0000007ffdac1978
7de0: 000000000000011d cb88537fdc8ba600 ffffffe32bda7e70 ffffff8392fa60cc
7e00: 0000000000000000 ffffffe32b233f40 ffffffe32b233f40 0000000000000003
7e20: 0000000000005425 0000007ffdac1978 ffffffe32bda7e70 ffffff8392fa60b0
7e40: 0000000000000280 ffffffe32b233f40 ffffffe32b233f40 0000000000000003
7e60: 0000000000005425 cb88537fdc8ba600 0000000000000000 ffffff8392e02e78
7e80: 0000000000000280 0000005fbc5b0000 ffffffffffffffff 0000007f92ae9d3c
7ea0: 0000000060000000 0000000000000015 0000000000000003 0000000000005425
7ec0: 0000007ffdac1978 0000000000000000 00000000a54c910e 0000007f92b95014
7ee0: 0000007f92b95090 0000000052a64887 000000000000001d 0000000000000078
7f00: 0000007ffdac1708 0000000000000020 0000000000000000 0000000000000000
7f20: 0000000000000000 0000000000000010 000000556acf0090 0000007f92ae9d30
7f40: 0000000000000004 000000556acdef10 0000000000000000 000000556acdebd0
7f60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
7f80: 0000000000000000 0000000000000000 0000000000000000 0000007ffdac1840
7fa0: 000000556acdedcc 0000007ffdac1840 0000007f92ae9d3c 0000000060000000
7fc0: 0000000000000000 0000000000000000 0000000000000003 000000000000001d
7fe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
Call trace:
Exception stack(0xffffffe32bda7ab0 to 0xffffffe32bda7bf0)
7aa0:                                   0000000000001000 0000007fffffffff
7ac0: ffffffe32bda7cc0 ffffff8393196098 0000000080000005 0000000000000025
7ae0: ffffffe32b233f40 ffffff83930d777c ffffffe32bda7b30 ffffff83930d777c
7b00: ffffffe32bda7be0 ffffff83938d5000 ffffffe32bda7be0 ffffffe32bda7c20
7b20: ffffffe32bda7b60 ffffff83930d777c ffffffe32bda7c10 ffffff83938d5000
7b40: ffffffe32bda7c10 ffffffe32bda7c50 ffffff8393c0a000 ffffffe32b23f110
7b60: ffffffe32bda7b70 ffffff8392e09df4 ffffffe32bda7bb0 cb88537fdc8ba600
7b80: ffffff83934428f8 ffffffe32b23c040 0000000000000080 ffffff83938d5018
7ba0: 0000005fbc5b0000 ffffffe32b23c000 ffffffe32bda7e08 0000000052a64887
7bc0: 000000000000001d 0000000000000078 0000007ffdac1708 0000000000000020
7be0: 0000000000000000 0000000000000000
[<ffffff8393196098>] uart_break_ctl+0x44/0x84
[<ffffff8393177718>] send_break+0xa0/0x114
[<ffffff8393179a1c>] tty_ioctl+0xc50/0xe84
[<ffffff8392fa5a40>] do_vfs_ioctl+0xc4/0x6e8
[<ffffff8392fa60cc>] SyS_ioctl+0x68/0x9c
[<ffffff8392e02e78>] __sys_trace_return+0x0/0x4
Code: b9410ea0 34000160 f9408aa0 f9402814 (b85fc280)
---[ end trace 8606094f1960c5e0 ]---
Kernel panic - not syncing: Fatal exception

Fix this problem by adding NULL checks prior to calling break_ctl ops.

Signed-off-by: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1574263133-28259-1-git-send-email-xiaojiangfeng@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:23 +01:00
2550aabf75 serial: pl011: Fix DMA ->flush_buffer()
commit f6a1964771 upstream.

PL011's ->flush_buffer() implementation releases and reacquires the port
lock.  Due to a race condition here, data can end up being added to the
circular buffer but neither being discarded nor being sent out.  This
leads to, for example, tcdrain(2) waiting indefinitely.

Process A                       Process B

uart_flush_buffer()
 - acquire lock
 - circ_clear
 - pl011_flush_buffer()
 -- release lock
 -- dmaengine_terminate_all()

                                uart_write()
                                - acquire lock
                                - add chars to circ buffer
                                - start_tx()
                                -- start DMA
                                - release lock

 -- acquire lock
 -- turn off DMA
 -- release lock

                                // Data in circ buffer but DMA is off

According to the comment in the code, the releasing of the lock around
dmaengine_terminate_all() is to avoid a deadlock with the DMA engine
callback.  However, since the time this code was written, the DMA engine
API documentation seems to have been clarified to say that
dmaengine_terminate_all() (in the identically implemented but
differently named dmaengine_terminate_async() variant) does not wait for
any running complete callback to be completed and can even be called
from a complete callback.  So there is no possibility of deadlock if the
DMA engine driver implements this API correctly.

So we should be able to just remove this release and reacquire of the
lock to prevent the aforementioned race condition.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191118092547.32135-1-vincent.whitchurch@axis.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:23 +01:00
1545befcf6 tty: serial: msm_serial: Fix flow control
commit b027ce2583 upstream.

hci_qca interfaces to the wcn3990 via a uart_dm on the msm8998 mtp and
Lenovo Miix 630 laptop.  As part of initializing the wcn3990, hci_qca
disables flow, configures the uart baudrate, and then reenables flow - at
which point an event is expected to be received over the uart from the
wcn3990.  It is observed that this event comes after the baudrate change
but before hci_qca re-enables flow. This is unexpected, and is a result of
msm_reset() being broken.

According to the uart_dm hardware documentation, it is recommended that
automatic hardware flow control be enabled by setting RX_RDY_CTL.  Auto
hw flow control will manage RFR based on the configured watermark.  When
there is space to receive data, the hw will assert RFR.  When the watermark
is hit, the hw will de-assert RFR.

The hardware documentation indicates that RFR can me manually managed via
CR when RX_RDY_CTL is not set.  SET_RFR asserts RFR, and RESET_RFR
de-asserts RFR.

msm_reset() is broken because after resetting the hardware, it
unconditionally asserts RFR via SET_RFR.  This enables flow regardless of
the current configuration, and would undo a previous flow disable
operation.  It should instead de-assert RFR via RESET_RFR to block flow
until the hardware is reconfigured.  msm_serial should rely on the client
to specify that flow should be enabled, either via mctrl() or the termios
structure, and only assert RFR in response to those triggers.

Fixes: 04896a77a9 ("msm_serial: serial driver for MSM7K onboard serial peripheral.")
Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Andy Gross <agross@kernel.org>
Link: https://lore.kernel.org/r/20191021154616.25457-1-jeffrey.l.hugo@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:22 +01:00
6b64c361ba tty: serial: fsl_lpuart: use the sg count from dma_map_sg
commit 487ee861de upstream.

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: 6250cc30c4 ("tty: serial: fsl_lpuart: Use scatter/gather DMA for Tx")
Cc: <stable@vger.kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1572932977-17866-1-git-send-email-peng.fan@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:21 +01:00
5f43cf50ef serial: 8250-mtk: Use platform_get_irq_optional() for optional irq
commit eb9c1a41ea upstream.

As platform_get_irq() now prints an error when the interrupt does not
exist, this warnings are printed on bananapi-r2:

[    4.935780] mt6577-uart 11004000.serial: IRQ index 1 not found
[    4.962589] 11002000.serial: ttyS1 at MMIO 0x11002000 (irq = 202, base_baud = 1625000) is a ST16650V2
[    4.972127] mt6577-uart 11002000.serial: IRQ index 1 not found
[    4.998927] 11003000.serial: ttyS2 at MMIO 0x11003000 (irq = 203, base_baud = 1625000) is a ST16650V2
[    5.008474] mt6577-uart 11003000.serial: IRQ index 1 not found

Fix this by calling platform_get_irq_optional() instead.

now it looks like this:

[    4.872751] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled

Fixes: 7723f4c5ec ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191027062117.20389-1-frank-w@public-files.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:21 +01:00
95a9680ccf usb: gadget: u_serial: add missing port entry locking
commit daf82bd24e upstream.

gserial_alloc_line() misses locking (for a release barrier) while
resetting port entry on TTY allocation failure. Fix this.

Cc: stable@vger.kernel.org
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:20 +01:00
40f9f2f6f3 staging/octeon: Use stubs for MIPS && !CAVIUM_OCTEON_SOC
commit 17a29fea08 upstream.

When building for a non-Cavium MIPS system with COMPILE_TEST=y, the
Octeon ethernet driver hits a number of issues due to use of macros
provided only for CONFIG_CAVIUM_OCTEON_SOC=y configurations. For
example:

  drivers/staging/octeon/ethernet-rx.c:190:6: error:
    'CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE' undeclared (first use in this function)
  drivers/staging/octeon/ethernet-rx.c:472:25: error:
    'OCTEON_IRQ_WORKQ0' undeclared (first use in this function)

These come from various asm/ headers that a non-Octeon build will be
using a non-Octeon version of.

Fix this by using the octeon-stubs.h header for non-Cavium MIPS builds,
and only using the real asm/octeon/ headers when building a Cavium
Octeon kernel configuration.

This requires that octeon-stubs.h doesn't redefine XKPHYS_TO_PHYS, which
is defined for MIPS by asm/addrspace.h which is pulled in by many other
common asm/ headers.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
URL: https://lore.kernel.org/linux-mips/CAMuHMdXvu+BppwzsU9imNWVKea_hoLcRt9N+a29Q-QsjW=ip2g@mail.gmail.com/
Fixes: 171a9bae68 ("staging/octeon: Allow test build on !MIPS")
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: David S. Miller <davem@davemloft.net>
Link: https://lore.kernel.org/r/20191007231741.2012860-1-paul.burton@mips.com
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:19 +01:00
8b3ae914e3 mailbox: tegra: Fix superfluous IRQ error message
commit c745da8d43 upstream.

Commit 7723f4c5ec ("driver core: platform: Add an error message to
platform_get_irq*()") added an error message to avoid drivers having
to print an error message when IRQ lookup fails. However, there are
some cases where IRQs are optional and so new optional versions of
the platform_get_irq*() APIs have been added for these cases.

The IRQs for Tegra HSP module are optional because not all instances
of the module have the doorbell and all of the shared interrupts.
Hence, since the above commit was applied the following error messages
are now seen on Tegra194 ...

 ERR KERN tegra-hsp c150000.hsp: IRQ doorbell not found
 ERR KERN tegra-hsp c150000.hsp: IRQ shared0 not found

The Tegra HSP driver deliberately does not fail if these are not found
and so fix the above errors by updating the Tegra HSP driver to use
the platform_get_irq_byname_optional() API.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20191011083459.11551-1-jonathanh@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:19 +01:00
05ee6e46a2 time: Zero the upper 32-bits in __kernel_timespec on 32-bit
commit 7b8474466e upstream.

On compat interfaces, the high order bits of nanoseconds should be zeroed
out. This is because the application code or the libc do not guarantee
zeroing of these. If used without zeroing, kernel might be at risk of using
timespec values incorrectly.

Originally it was handled correctly, but lost during is_compat_syscall()
cleanup. Revert the condition back to check CONFIG_64BIT.

Fixes: 98f76206b3 ("compat: Cleanup in_compat_syscall() callers")
Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20191121000303.126523-1-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:18 +01:00
acd6cd17c7 lp: fix sparc64 LPSETTIMEOUT ioctl
commit 45a2d64696 upstream.

The layout of struct timeval is different on sparc64 from
anything else, and the patch I did long ago failed to take
this into account.

Change it now to handle sparc64 user space correctly again.

Quite likely nobody cares about parallel ports on sparc64,
but there is no reason not to fix it.

Cc: stable@vger.kernel.org
Fixes: 9a45048408 ("lp: support 64-bit time_t user space")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20191108203435.112759-7-arnd@arndb.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:17 +01:00
c3277e67a9 sparc64: implement ioremap_uc
commit 38e45d81d1 upstream.

On sparc64, the whole physical IO address space is accessible using
physically addressed loads and stores. *_uc does nothing like the
others.

Cc: <stable@vger.kernel.org> # v4.19+
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Tuowen Zhao <ztuowen@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:17 +01:00
b5e2dee3bd perf scripts python: exported-sql-viewer.py: Fix use of TRUE with SQLite
commit af833988c0 upstream.

Prior to version 3.23 SQLite does not support TRUE or FALSE, so always
use 1 and 0 for SQLite.

Fixes: 26c11206f4 ("perf scripts python: exported-sql-viewer.py: Use new 'has_calls' column")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: stable@vger.kernel.org # v5.3+
Link: http://lore.kernel.org/lkml/20191113120206.26957-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[Adrian: backported to v5.3, v5.4]
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:16 +01:00
1c4472b7dc arm64: tegra: Fix 'active-low' warning for Jetson Xavier regulator
commit d440538e5f upstream.

Commit 4fdbfd60a3a2 ("arm64: tegra: Add PCIe slot supply information
in p2972-0000 platform") added regulators for the PCIe slot on the
Jetson Xavier platform. One of these regulators has an active-low enable
and this commit incorrectly added an active-low specifier for the GPIO
which causes the following warning to occur on boot ...

 WARNING KERN regulator@3 GPIO handle specifies active low - ignored

The fixed-regulator binding does not use the active-low flag from the
gpio specifier and purely relies of the presence of the
'enable-active-high' property to determine if it is active high or low
(if this property is omitted). Fix this warning by setting the GPIO
to active-high in the GPIO specifier. Finally, remove the
'enable-active-low' as this is not a valid property.

Fixes: 4fdbfd60a3a2 ("arm64: tegra: Add PCIe slot supply information in p2972-0000 platform")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:15 +01:00
bd09f7d6ac arm64: tegra: Fix 'active-low' warning for Jetson TX1 regulator
commit 1e5e929c00 upstream.

Commit 3499359418 ("arm64: tegra: Enable HDMI on Jetson TX1")
added a regulator for HDMI on the Jetson TX1 platform. This regulator
has an active high enable, but the GPIO specifier for enabling the
regulator incorrectly defines it as active-low. This causes the
following warning to occur on boot ...

 WARNING KERN regulator@10 GPIO handle specifies active low - ignored

The fixed-regulator binding does not use the active-low flag from the
gpio specifier and purely relies of the presence of the
'enable-active-high' property to determine if it is active high or low
(if this property is omitted). Fix this warning by setting the GPIO
to active-high in the GPIO specifier which aligns with the presense of
the 'enable-active-high' property.

Fixes: 3499359418 ("arm64: tegra: Enable HDMI on Jetson TX1")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:14 +01:00
9f513166a8 rsi: release skb if rsi_prepare_beacon fails
commit d563131ef2 upstream.

In rsi_send_beacon, if rsi_prepare_beacon fails the allocated skb should
be released.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13 08:42:13 +01:00
46b954d90d arm64: config: enable usb network card R8152 AX88179 and AX8817X driver
This patch is to enable that driver for R8152 AX88179 and AX8817X chip can
work well on layerscape board

Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
2019-12-13 15:17:37 +08:00
e455af3561 LF-458-4 arm64: dts: imx8mm-evk: add dtb for rm67191 panel
Add a new dtb imx8mm-evk-rm67191.dtb to support rm67191
mipi panel display.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-13 14:35:16 +08:00
4eb33c8737 LF-458-3 arm64: dts: imx8mn-ddr4-evk: add 'attach-bridge' to dsi port@1
The 'attach-bridge' property for dsi port@1 can be used
to assit the dsim bridge to check if the port is used to
attach to the next bridge display device(e.g. adv7511).

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-13 14:35:16 +08:00
7090248710 LF-458-2 arm64: dts: imx8mn-evk: add 'attach-bridge' to dsi port@1
The 'attach-bridge' property for dsi port@1 can be used
to assit the dsim bridge to check if the port is used to
attach to the next bridge display device(e.g. adv7511).

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-13 14:35:16 +08:00
b1549ad897 LF-458-1 arm64: dts: imx8mm-evk: enable mipi2hdmi display
Add ADV7535 device node and enable the whole display
pipeline for mipi2hdmi on imx8mm evk board.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-13 14:35:16 +08:00
b60340a2ff MGS-5326 [#imx-1803] 0058-align-gc_feature_database
align gc_feature_database

Signed-off-by: Yong Gan <yong.gan@nxp.com>
2019-12-13 13:52:04 +08:00
5cf121fb13 LF-456: ARM: imx_v7_defconfig: remove CONFIG_PROVE_LOCKING
Disable lockdep for release due to it has performance impact.

Defconfig generated by make ARCH=arm savedefconfig

Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-13 11:18:28 +08:00
fd7102c32b staging: fsl-dpaa2/mac: reverse order of handling stop/start IRQs
Both the LINK_UP_REQ and the LINK_DOWN_REQ IRQs can be received in the
same time when a reset is performed on the DPMAC's partner.
Handle first the link down and then the link up so that we do not
trigger a phylib WARNING like the following:

[  446.272011] called from state NOLINK
[  446.275604] WARNING: CPU: 0 PID: 473 at drivers/net/phy/phy.c:874
phy_start+0x44/0xa8

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-12 14:06:29 +02:00
e814c1c730 staging: fsl-dpaa2/mac: do not call dpmac_set_link_state() when nothing changed
In case nothing changed in the link configuration do not call
dpmac_set_link_state().
This is needed in case of the following sequence of commands.

$ ip link set dev eth1 up; ip link set dev eth2 down

Phylib brings the link down when the aneg is started on the phy which
translates in a link down from phy in MC and confuses the MC linkman.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-12 14:06:28 +02:00
98f77072a7 LF-215-2: ASoC: fsl_rpmsg_i2s: Fix suspend failure in free run mode
As we enabled WQ_FREEZABLE for workqueue, flush_workqueue in suspend
stage will not success, for the workqueue is freezed.

flush_workqueue in suspend is a wrong operation with WQ_FREEZABLE,
so remove it.

Fixes: 5b07f684de ("LF-215: ASoC: fsl_rpmsg_i2s: Enable WQ_FREEZABLE for workqueue")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-12 19:21:31 +08:00
e2b36118ed LF-396 arm64: imx_v8_defconfig: add CONFIG_MODVERSIONS
add CONFIG_MODVERSIONS which can ease the module test work.

Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-12 18:23:05 +08:00
dea2fede7e Merge 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (19 commits)
  LF-446 clk: imx: lpcg-scu: SW workaround for errata (e10858)
  LF-413-2 arm64: dtsi: imx8mn: remove usbotg2
  LF-413-1 arm64: dtsi: imx8mn: add power domain for usb
  ...
2019-12-12 17:28:19 +08:00
f8605294b4 LF-446 clk: imx: lpcg-scu: SW workaround for errata (e10858)
Back-to-back LPCG writes can be ignored by the LPCG register due to
a HW bug. The writes need to be seperated by at least 4 cycles of
the gated clock.

The workaround is implemented as follows:
1. For clocks running greater than or equal to 24MHz, a read
followed by the write will provide sufficient delay.
2. For clocks running below 24MHz, add a delay of 4 clock cylces
after the write to the LPCG register.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-12 14:59:31 +08:00
4b0b80a740 LF-413-2 arm64: dtsi: imx8mn: remove usbotg2
Remove usbotg2 as imx8mn only has one usb port.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-12 12:36:14 +08:00
88640ed2b5 LF-413-1 arm64: dtsi: imx8mn: add power domain for usb
Add the missing power domain for usbotg1.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-12 12:36:14 +08:00
bdd5e91cd0 LF-443 arm64: imx_v8_defconfig: Build in powersave/conservative governor by default
Make powersave and conservative governor built in instead of module.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-12-12 10:21:50 +08:00
1e03824c0f LF-226 cpufreq: Avoid leaving stale IRQ work items during CPU offline
The scheduler code calling cpufreq_update_util() may run during CPU
offline on the target CPU after the IRQ work lists have been flushed
for it, so the target CPU should be prevented from running code that
may queue up an IRQ work item on it at that point.

Unfortunately, that may not be the case if dvfs_possible_from_any_cpu
is set for at least one cpufreq policy in the system, because that
allows the CPU going offline to run the utilization update callback
of the cpufreq governor on behalf of another (online) CPU in some cases.

If that happens, the cpufreq governor callback may queue up an IRQ work
on the CPU running it, which is going offline, and the IRQ work will
not be flushed after that point.  Moreover, that IRQ work cannot be
flushed until the "offlining" CPU goes back online, so if any other
CPU calls irq_work_sync() to wait for the completion of that IRQ work,
it will have to wait until the "offlining" CPU is back online and that
may not happen forever. In particular, a system-wide deadlock may
occur during CPU online as a result of that.

The failing scenario is as follows. CPU0 is the boot CPU, so it creates
a cpufreq policy and becomes the "leader" of it (policy->cpu).  It
cannot go offline, because it is the boot CPU.
Next, other CPUs join the cpufreq policy as they go online and they
leave it when they go offline.  The last CPU to go offline, say CPU3,
may queue up an IRQ work while running the governor callback on behalf
of CPU0 after leaving the cpufreq policy because of the
dvfs_possible_from_any_cpu effect described above.  Then, CPU0 is the
only online CPU in the system and the stale IRQ work is still queued on
CPU3.  When, say, CPU1 goes back online, it will run
irq_work_sync() to wait for that IRQ work to complete and so it will
wait for CPU3 to go back online (which may never happen even in
principle), but (worse yet) CPU0 is waiting for CPU1 at that point too
and a system-wide deadlock occurs.

To address this problem notice that CPUs which cannot run cpufreq
utilization update code for themselves (for example, because they have
left the cpufreq policies that they belonged to), should also be
prevented from running that code on behalf of the other CPUs that
belong to a cpufreq policy with dvfs_possible_from_any_cpu set and so
in that case the cpufreq_update_util_data pointer of the CPU running
the code must not be NULL as well as for the CPU which is the target
of the cpufreq utilization update in progress.

Accordingly, change cpufreq_this_cpu_can_update() into a regular
function in kernel/sched/cpufreq.c (instead of a static inline in a
header file) and make it check the cpufreq_update_util_data pointer
of the local CPU if dvfs_possible_from_any_cpu is set for the target
cpufreq policy.

Also update the schedutil governor to do the
cpufreq_this_cpu_can_update() check in the non-fast-switch case too
to avoid the stale IRQ work issues.

Fixes: 99d14d0e16 ("cpufreq: Process remote callbacks from any CPU if the platform permits")
Reported-by: Anson Huang <anson.huang@nxp.com>
Cc: 4.14+ <stable@vger.kernel.org> # 4.14+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-12-12 09:33:40 +08:00
560be559b0 LF-425-2 drm/bridge: sec-dsim: use 'attach-bridge' for bridge attach
Since the port nodes under dsim device can be detached
dynamically by other devices. So use the 'attach-bridge'
property to imply that if there is any available bridge
endpoint node exists. If not, the panel node existence
is required to be detected. If still not, whole display
components binding should be ended which can avoid the
endless defer probe problem when no available display
devices can be attached to dsim.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-12 09:20:10 +08:00
3b78f128f6 LF-425-1 arm64: dts: imx8mm-evk: add 'attach-bridge' to dsi port@1
The 'attach-bridge' property for dsi port@1 can be used
to assit the dsim bridge to check if the port is used to
attach to the next bridge display device(e.g. adv7511).

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-12 09:20:10 +08:00
f1d02bae29 LF-424 gpu/imx: lcdif: fix typo for imx_lcdif_dt_ids
When built the driver as module, this typo error can
be found by compiler with below build error reported:

In file included from drivers/gpu/imx/lcdif/lcdif-common.c:20:
drivers/gpu/imx/lcdif/lcdif-common.c:78:25: error: ‘lcdif_dt_ids’ undeclared here (not in a function); did you mean ‘imx_lcdif_dt_ids’?
   78 | MODULE_DEVICE_TABLE(of, lcdif_dt_ids);
      |                         ^~~~~~~~~~~~
./include/linux/module.h:227:15: note: in definition of macro ‘MODULE_DEVICE_TABLE’
  227 | extern typeof(name) __mod_##type##__##name##_device_table  \
      |               ^~~~
./include/linux/module.h:227:21: error: ‘__mod_of__lcdif_dt_ids_device_table’ aliased to undefined symbol ‘lcdif_dt_ids’
  227 | extern typeof(name) __mod_##type##__##name##_device_table  \
      |                     ^~~~~~
drivers/gpu/imx/lcdif/lcdif-common.c:78:1: note: in expansion of macro ‘MODULE_DEVICE_TABLE’
   78 | MODULE_DEVICE_TABLE(of, lcdif_dt_ids);
      | ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-12 09:20:10 +08:00
25546f1dc3 LF-440: arm64: config: enable fspi on imx8qxp val board
enable fspi on imx8qxp val board

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-12-11 16:53:48 -06:00
99e0cd1cdc MLK-11747: mtd: nand: raw: gpmi-nand: add the debugfs files for gpmi-nand for kobs-ng
add the debugfs files in gpmi-nand driver for kobs-ng

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-12-11 16:53:48 -06:00
ae980dccc6 MLK-11719-4: mtd: nand: raw: gpmi-nand: change the BCH layout setting for large oob NAND
The code change updated the NAND driver BCH ECC layout algorithm to
support large oob size NAND chips(oob > 1024 bytes) and proposed a new
way to set ECC layout.

Current implementation requires each chunk size larger than oob size so
the bad block marker (BBM) can be guaranteed located in data chunk. The
ECC layout always using the unbalanced layout(Ecc for both meta and
Data0 chunk), but for the NAND chips with oob larger than 1k, the driver
cannot support because BCH doesn’t support GF 15 for 2K chunk.

The change keeps the data chunk no larger than 1k and adjust the ECC
strength or ECC layout to locate the BBM in data chunk. General idea for
large oob NAND chips is

1.Try all ECC strength from the minimum value required by NAND spec to
the maximum one that works, any ECC makes the BBM locate in data chunk
can be chosen.

2.If none of them works, using separate ECC for meta, which will add one
extra ecc with the same ECC strength as other data chunks. This extra
ECC can guarantee BBM located in data chunk, of course, we need to check
if oob can afford it.

Previous code has two methods for ECC layout setting, the
legacy_set_geometry and set_geometry_by_ecc_info, the difference between
these two methods is, legacy_set_geometry set the chunk size larger chan
oob size and then set the maximum ECC strength that oob can afford.
While the set_geometry_by_ecc_info set chunk size and ECC strength
according to NAND spec. It has been proved that the first method cannot
provide safe ECC strength for some modern NAND chips, so in current
code,

    1. Driver read NAND parameters first and then chose the proper ECC
       layout setting method.

    2. If the oob is large or NAND required data chunk larger than oob
       size, chose set_geometry_for_large_oob, otherwise use
       set_geometry_by_ecc_info

    3. legacy_set_geometry only used for some NAND chips does not
       contains necessary information. So this is only a backup plan, it is NOT
       recommended to use these NAND chips.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-12-11 16:53:40 -06:00
5594e28f66 staging: dpaa2-ethsw: ordered workqueue should be per ethsw
Create a different ordered workqueue per dpaa2-ethsw instance.  Without
this change, we overwrite the global queue and leak memory when probing
multiple instances of the driver.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1573491058-24766-5-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-11 15:47:48 +02:00
a4c3047a99 staging: dpaa2-ethsw: move port switchdev blocking notifier per ethsw
Register a different switchdev blocking notifier block per ethsw
instance.  When probing multiple dpaa2-ethsw instances, without this the
register will fail.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1573491058-24766-4-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-11 15:47:47 +02:00
2892168d9e staging: dpaa2-ethsw: move port switchdev notifier per ethsw
Register a different switchdev notifier block per ethsw instance.
When probing multiple dpaa2-ethsw instances, without this the register
will fail.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1573491058-24766-3-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-11 15:47:46 +02:00
2f534ab50d staging: dpaa2-ethsw: move port notifier per ethsw
Register a different net_device notifier block per ethsw instance.
When probing multiple dpaa2-ethsw instances, without this the register
will fail.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1573491058-24766-2-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-11 15:47:45 +02:00
de64be535d LF-433: staging: media: imx: refine mipi csi2 driver for Samsung
csis_get_remote_sensor_pad() and media_entity_to_v4l2_subdev() called
to get remote subdev in many place. This patch wrap the two function
with a new method named csis_get_remote_subdev(). So we can remove
some redundant code.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby.cai <robby.cai@nxp.com>
2019-12-11 19:17:57 +08:00
a7c15a2fef LF-79: staging: media: imx: replace s_parm/g_parm with s/g_frame_interval
Replace s_parm/g_parm with s_frame_interval/g_frame_interval because
s_parm/g_parm was remove in latest V4L2 framework, more detail, please
refer to commit: 8180b4f4f5

we need to use s_frame_interval/g_frame_interval to set/get new property
of subdev.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby.cai <robby.cai@nxp.com>
2019-12-11 19:17:51 +08:00
4c7f570af6 LF-397-2 clk: imx8qxp: fix wrong clock name of dummy clock
The correct dummy clock name should be "clk_dummy".

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-11 18:44:06 +08:00
15751bb695 LF-397-1 clk: imx8qxp: fix orphan clock rate of sdhc0_clk
Currently sdhc0_clk is an orphan clock and it's rate is wrong.
The reason is missing parent pll clocks defined in DT.
$ cat /sys/kernel/debug/clk/clk_summary  | grep sdhc
 ...
 sdhc0_clk                            0        0        0           0          0     0  50000
    sdhc0_lpcg_per_clk                0        0        0   396000000          0     0  50000

As sdhc does not have requiremnt to change the clock parent to AVPLL now,
let's remove the unused parent clock definition in clock driver to avoid
this issue.

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-11 18:44:06 +08:00
83c7c12c6f Merge branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (19 commits)
  LF-155: media: i2c: ov5640: fix 1024x768 abnormal green flicker issue
  LF-389: input: keyboard: snvs_pwrkey: fix no event report from suspend
  LF-363 arm64: kernel: TKT340553 Errata workaround update for i.MX8QM
  ...
2019-12-11 17:43:45 +08:00
48157c8b68 LF-155: media: i2c: ov5640: fix 1024x768 abnormal green flicker issue
IMX8QXP MEK board connect data[9:2] lines of ov5640 sensor, so we need
to set sensor work at 10-bit mode.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Acked-by: Sandor.yu <sandor.yu@nxp.com>
2019-12-11 17:39:10 +08:00
010acdd743 LF-389: input: keyboard: snvs_pwrkey: fix no event report from suspend
In case long latency spent on some board such as i.mx8mq-evk where pcie
driver may take 200ms timing window to restore pcie link in no_irq phase,
press event will be ignored since key maybe already released before timer
start to run because of the above large 200ms window with irq disabled.
Directly report press event in interrupt handler after suspend to ensure
no press event miss in this case.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2019-12-12 01:33:05 +08:00
7ae82f64e9 LF-363 arm64: kernel: TKT340553 Errata workaround update for i.MX8QM
As per latest i.MX8QM SOC Errata, TKT340553 workaround needs to be
updated to unconditionally downgrade TLB operations and instruction
cache maintenance.

Signed-off-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
2019-12-11 13:58:36 +08:00
faee630930 LF-45-2: input: touch: synaptics_dsx: enable module autoloading
Export the OF table, report the OF module alias, to enable the
module autoloading.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-11 11:19:39 +08:00
c1a10cf6a0 LF-406: ASoC: fsl_audmix: add missing spin lock init
Add missing spin lock init.

Fixes: 9360612 ("ASoC: fsl_audmix: Add spin lock to protect tdms")
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-12-10 13:28:31 +02:00
d9a6fd7eb7 MLK-21957-3: ASoC: fsl_sai: add bitcount and timestamp controls
Bitcount and timestamp support added in SAI IP recently.
Add the related controls in SAI driver.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-12-10 13:28:28 +02:00
4c4b7df6f9 MLK-22522: ASoC: fsl_sai: fix stack-out-of-bounds KASAN complain
Fix the following KASAN reported issue:
==================================================================
[   11.580278] BUG: KASAN: stack-out-of-bounds in find_next_bit+0x3c/0xc0
[   11.586815] Read of size 8 at addr ffffffc8c8d4f760 by task swapper/0/1
[   11.593440]
[   11.594943] CPU: 4 PID: 1 Comm: swapper/0 Tainted: G W 4.19.35-05042-g. #157
[   11.604259] Hardware name: Freescale i.MX8QM MEK (DT)
[   11.609323] Call trace:
[   11.611785]  dump_backtrace+0x0/0x230
[   11.615458]  show_stack+0x14/0x20
[   11.618787]  dump_stack+0xbc/0xf4
[   11.622118]  print_address_description+0x60/0x270
[   11.626830]  kasan_report+0x230/0x360
[   11.630505]  __asan_load8+0x84/0xa8
[   11.634005]  find_next_bit+0x3c/0xc0
[   11.637595]  fsl_sai_calc_dl_off+0x1c/0x50
[   11.641703]  fsl_sai_read_dlcfg+0x184/0x368
[   11.645898]  fsl_sai_probe+0x3ec/0xb48
[   11.649663]  platform_drv_probe+0x70/0xd8
[   11.653683]  really_probe+0x24c/0x370
[   11.657358]  driver_probe_device+0x70/0x138
[   11.661554]  __driver_attach+0x124/0x128
[   11.665489]  bus_for_each_dev+0xe8/0x158
[   11.669425]  driver_attach+0x30/0x40
[   11.673012]  bus_add_driver+0x290/0x308
[   11.676861]  driver_register+0xbc/0x1d0
[   11.680711]  __platform_driver_register+0x7c/0x88
[   11.685431]  fsl_sai_driver_init+0x18/0x20
[   11.689537]  do_one_initcall+0xe8/0x5a8
[   11.693387]  kernel_init_freeable+0x6b0/0x760
[   11.697759]  kernel_init+0x10/0x120
[   11.701255]  ret_from_fork+0x10/0x18
....
==================================================================
[   11.800186] Disabling lock debugging due to kernel taint

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-10 13:28:22 +02:00
b02e986120 MLK-21957-2: ASoC: fsl_sai: read SAI version and params in probe
Read SAI IP version and parameters in probe function.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-12-10 13:28:18 +02:00
183d08c764 MLK-21957-1: ASoC: fsl_sai: remove reset code from dai_probe
SAI software reset is done in runtime resume,
there is no need to do it in fsl_sai_dai_probe.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-10 13:28:14 +02:00
115b39615b MLK-21484-4: ASoC: fsl_sai: ensure clk not in use prior set_mclk_rate
On recent kernels clks which are marked with CLK_SET_RATE_GATE are
"protected" against further changes at clk_prepare time, including clk
set_parent and set_rate. See commit 9461f7b33d ("clk: fix
CLK_SET_RATE_GATE with clock rate protection"). The current fsl_sai
implementation ensures the clock is not in use prior set_parent,
extend this for set_rate also by moving if (sai->mclk_streams == 0)
outside fsl_sai_set_mclk_rate(). Aside of this avoid changing rate and
parent for BUS clk.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-12-10 13:28:09 +02:00
7d65e4480a LF-407-3: drm/imx/dcss: remove unnecessary sleep
No need to sleep 50ms after re-enabling the pixel clock. Remove it.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2019-12-10 13:06:50 +02:00
f25f5c106a LF-407-2: drm/imx/dcss: fix module insertion hang
In dcss_dtg_sync_set(), the pixel clock is cut off in order to change the rate.
However, if the vblank interrupt happens in the same time, it will freeze the
platform as it will access the DTG registers while the clock is off.

This patch will activate the vblank interrupt after the dcss_dtg_sync_set() is
called.

Also, while at it, make sure the DPR and DTG interrupts are masked off before
requesting the interrupt, so that the handlers are not called before CRTC is
enabled.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2019-12-10 13:06:34 +02:00
532e6fa205 LF-407-1: drm/imx/dcss: fix compilation issues after rebase
Upstream demoved the drmP.h header file. This patch replaces it with the
appropriate headers.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2019-12-10 13:06:14 +02:00
fe88b874f6 LF-374: ASoC: imx-pcm-dma-v2: Fix compile issue with SND_SOC_IMX_PCM_DMA=m
When build with CONFIG_SND_SOC_IMX_PCM_DMA=m, there is error:

ERROR: "snd_pcm_lib_preallocate_free" [sound/soc/fsl/imx-pcm-dma-v2.ko] undefined!

The reason is that snd_pcm_lib_preallocate_free is not declared
with EXPORT_SYMBOL.

In this patch, we use snd_dma_alloc_pages & snd_dma_free_pages to replace
the snd_pcm_lib_preallocate_pages & snd_pcm_lib_preallocate_free to fix
the build issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-10 18:35:09 +08:00
0e05c736c0 drm/panel: rm67191: Make reset non exclusive
The reset pin may be shared between multiple panels, so make it non
exclusive and set it's default state to reset. Also, don't put the pin
into reset in prepare, so it won't brake the other panel port.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-12-10 11:38:01 +02:00
01b8b7a56f arm64: dts: mipi-lvds: fix mipi rx/tx clocks
By default, the MIPI RX and TX clocks are parented to the BYPASS clock,
but it seems that this doesn't work on QXP. Since these clocks can also
be parented to MIPI_PLL and MIPI_PLL_DIV2, use the MIPI_PLL_DIV2 with a
fixed rate of 432M and parent the RX and TX clocks to it.
This works on both QM and QXP.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-12-10 11:38:00 +02:00
a6a3a9cd11 clk: imx8qxp: add parent clocks for mipi
Add parent clocks to allow mipi to select a parent.
Now only support pll div2 by refer to 4.19 tree.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-12-10 11:37:59 +02:00
b84c06e4f7 arm64: dts: imx8qxp: Increase panel clock-drop-level
Increase the clock-drop-level to 2, for a better pixel-clock on the DSI
when using panel.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-12-10 11:37:59 +02:00
954da08a81 arm64: dts: imx8qm: Fix rm67191 reset gpio and clock-drop-level
Panel driver modified in order to accept non-exclusive reset gpio, so we
can add back the reset gpio for MIPI1 panel.
Also, increase the clock-drop-level to 2, for a better pixel-clock.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-12-10 11:37:58 +02:00
74c4c933b0 Merge branch 'linux-lts-nxp/lf-5.4.y' into imx_5.4.y
* linux-lts-nxp/lf-5.4.y: (6 commits)
  LF-364: media: isi: correct capabilities for ISI m2m video device
  LF-323-2: drm/bridge/cdns: enhance link training stability
  LF-323-1: drm/bridge/cdns: move link training to bridge enable function
  ...
2019-12-10 17:00:29 +08:00
2e69cb0ffb LF-364: media: isi: correct capabilities for ISI m2m video device
V4L2_CAP_VIDEO_CAPTURE_MPLANE and V4L2_CAP_VIDEO_OUTPUT_MPLANE is used
to video capture and output device, so remove them for mem-to-mem video
device

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Sandor.yu <sandor.yu@nxp.com>
2019-12-10 16:16:12 +08:00
46916ead38 LF-323-2: drm/bridge/cdns: enhance link training stability
Remove drm_dp_link_power_down from bridge_disable function,
in case some DP sinks aren't follow DP 1.1 specification
and can not exit the power saving state within 1 ms.
Add drm_dp_link_power_up to bridge_enable function,
make sure DP sinks are power up before link training.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-10 15:12:21 +08:00
4f29108fb3 LF-323-1: drm/bridge/cdns: move link training to bridge enable function
Move link training and video enable functions from mode_set to
bridge_enable. it is more reasonable.
cdns_dp_mode_set don't needed in HPD thread, DP link training will
resetup in bridge_enable when cable connecting.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-10 15:12:21 +08:00
1971f2280e LF-388 ARM: imx: Add AXI clock parent switch for i.MX6DL low bus mode
On i.MX6DL, AXI clock is from 540M PFD in normal mode, and from periph
clk in low bus mode, so need to make sure AXI clock parent switch
correctly in normal mode and low bus mode.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-12-10 14:19:08 +08:00
97a6600dd0 LF-313-2: arm: imx_v6_v7_defconfig: add vadc to defconfig
add vadc to imx_v6_v7_defconfig

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-12-10 14:14:31 +08:00
2d014252f8 LF-313-1: arm: imx_v7_defconfig: add vadc to defconfig
add vadc to imx_v7_defconfig.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-12-10 14:14:20 +08:00
61dc1220f1 LF-313: arm: imx_v7_defconfig: add vadc to defconfig
add vadc to imx_v7_defconfig.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-12-10 13:45:39 +08:00
8138c68ab4 LF-382 ARM: dts: imx6dl: Add bus-freq node
Add bus-freq node to enable it by default.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-12-10 13:10:19 +08:00
cfebc19b7f arm64: configs: Enable FELIX DSA switch with TSN and dependencies
CONFIG_MSCC_FELIX_SWITCH is obsolete.
CONFIG_NET_DSA is a dependecy for FELIX and FELIX_SWITCH_TSN.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-06 14:19:05 +02:00
645c8037a7 LF-300-2 media: mipi csi: make the csi clock usecount to 0 when it's not used
Balance the clocks enable/disable to make sure clock use count is 0 when the
module is not used.
This applies for imx8mm, imx7d.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu.zhou <guoniu.zhou@nxp.com>
(cherry picked from commit c2e8e77015a69955541152f4942fa6ff58fbe4cd)
2019-12-06 18:04:41 +08:00
94716420dc LF-300-1 media: mipi csi: make the csi clock usecount to 0 when it's not used
Balance the clocks enable/disable to make sure clock use count is 0 when the
module is not used.
This applies for imx8mq.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu.zhou <guoniu.zhou@nxp.com>
(cherry picked from commit f7b9503f39836e6e84bd1302f3a9eeee9f87b060)
2019-12-06 18:04:35 +08:00
7b246b74e8 LF-376 enetc: disable EEE autoneg by default
The EEE support has not been enabled on ENETC, but it may connect
to a PHY which supports EEE and advertises EEE by default, while
its link partner also advertises EEE. If this happens, the PHY enters
low power mode when the traffic rate is low and causes packet loss.
This patch disables EEE advertisement by default for any PHY that
ENETC connects to, to prevent the above unwanted outcome.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-06 17:20:57 +08:00
832c3fce7d arch: arm64: Fix reserved memory area property name for DSP
After change  e00f0e9f11 ("ASoC: fsl_dsp: Rename reserved-region
with memory-region") reserved memory area for DSP is now grabbed
from DSP node property named memory-region instead of reserved-region.

We've done this change in order to align with upstream implementation.
Usually we should support the old property name but because
imx-audio-framework is is obsolete and planned for removal in the future
we won't do that.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-06 10:27:30 +02:00
ad05c9f2eb LF-375 sensor: fxls8471: set output data rate when device init
The default output data rate was only assigned to variable. It was not
configured for register when sensor init. This causes output data rate
is 800hz and it will increase cpu loading.
Config output data rate as 12.5hz to register when sensor init now.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-12-06 16:01:46 +08:00
f6cb75f3d9 LF-365 [8QM_MEK/8QXP_MEK]mxc:vpu_malone: need skip tsm when skip not decoded frame
- If frame ID is  MEDIA_PLAYER_SKIPPED_FRAME_ID, need skip this frame,
  also need skip its tsm at the same time.
- Fixed coverity issue: CID 6344236 (#2 of 2): Buffer not null
  terminated (BUFFER_SIZE_WARNING).
- Remove two deaded code about ctx pointer check.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: ming_qian <ming.qian@nxp.com>
2019-12-06 10:54:45 +08:00
aa00e66561 LF-367: arm64/dts: imx8qm: Disable mipi dsi in hdmi dts file
HDMI driver couldn't support unbind function now,
because HDMI FW should always running.
mipi dsi driver will probe faile if no mipi dsi panel connected
to mek board, then all connectors will be unbinded and hdmi will faile
in the secondly bind.
Disable mipi dsi in hdmi dts file to avoid hdmi driver unbinded.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-12-06 10:47:29 +08:00
41ee8dabf8 LF-369: mtd: nand: raw: gpmi-nand: fixe gpmi-nand runtime pm issue
gpmi_init function may return without marking the last_busy status for
runtime, which causes gpmi doesn't go to auto suspend. Also fixed the
issue that pinctrl set to wrong state and re-apply timing after system
resume.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-12-05 16:37:48 -06:00
b0f52887e4 LF-330 ARM: imx_v7_defconfig: select CRYPTO_DES
After commit 04007b0e6c ("crypto: des - split off DES library from generic DES cipher driver")
CRYPTO_DES must be explicitly selected if generic DES/3DES ciphers
are needed.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Franck LENORMAND <franck.lenormand@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-12-05 16:09:10 +02:00
42b963f49b MLK-21231 gpu: imx: dpu: framegen: Wait for 100ms at most for secondary syncup
Another coming patch will wait for framegen secondary channel syncup
for non-sync mode cases.  It appears that waiting for 50ms for video
modes like 1920x1080p@24 and 1920x1080p@30 is not enough.  So, this
patch increases the timeout value to 100ms.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-12-05 19:56:35 +08:00
5de3dcaf9c LF-368 net: mscc: ocelot: add VCAP IS2 rule to trap PTP Ethernet frames
All the PTP messages over Ethernet have etype 0x88f7 on them.
Use etype as the key to trap PTP messages.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-05 18:53:53 +08:00
51185aaed2 LF-368 net: mscc: ocelot: make ocelot_ace_rule support multiple ports
The ocelot_ace_rule is port specific now. Make it flexible to
be able to support multiple ports too.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-05 18:53:53 +08:00
b75a2a3e61 LF-368 net: mscc: ocelot: hard code VCAP_PORT_CNT for Felix temporarily
The Felix switch supports different port number with Ocelot.
This makes the bits mapping in TCAM entry and Action entry
is different with Ocelot for VCAP function.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-05 18:53:53 +08:00
5e9a0b2432 soc: fsl: rcpm: remove build warning
This removes build warning,
drivers/soc/fsl/rcpm.c: In function ‘rcpm_pm_prepare’:
drivers/soc/fsl/rcpm.c:126:37: warning: left shift count >= width of type [-Wshift-count-overflow]
          (u32)(((u64)(reg_offset[1] << (sizeof(u32) * 8) |
                                     ^~
drivers/soc/fsl/rcpm.c:131:38: warning: left shift count >= width of type [-Wshift-count-overflow]
           (u32)(((u64)(reg_offset[1] << (sizeof(u32) * 8) |

Reviewed-by: Ran Wang <ran.wang_1@nxp.com>
Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-12-05 17:56:08 +08:00
c4fb88cc05 drm/bridge: nwl-dsi: Fix phy_ref clock ordering
For some reason, the ADV7535 DSI-HDMI converter doesn't have a signal
when the DSI uses a phy_ref of 24M. In order to fix that, put the 27M as
the first option in phy_ref_rates.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-12-05 11:40:05 +02:00
bb8eef6527 arm64: dts: imx8qm: Fix rm67191 reset gpios
On 8QM, there is a single GPIO pin that is used for both MIPI DSI
interfaces. So, use the correct pin only for MIPI0, which will be used
for both ports MIPI0 and MIPI1.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-12-05 11:38:18 +02:00
aa1e5c0aed LF-362-2 arm64: dts: imx8mq: Add DDR3l and DDR4 validation boards support
Add DTS files to support iMX8MQ DDR3l and DDR4 validation boards. Basic nodes
like UART, SD/eMMC, i2c, Ethernet, rawnand and usb are added to work.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-12-05 00:40:19 -08:00
2d7e271500 LF-362-1 arm64: dts: imx8mq: Add gpmi and apbh-dma nodes
Add gpmi and apbh-dma nodes to i.MX8MQ DTSi. Both are used by RAWNAND driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-12-05 00:40:19 -08:00
fe2655a720 LF-356: media: imx8 isi: fix buffer active bit change for QXP C0
For ISI of QXP B0, if CHNL_STS[BUF1_ACTIVE] bit is zero, means buffer1
of ping-pong buffer is active, driver can't change buffer1 address.
If CHNL_STS[BUF1_ACTIVE] bit is set, means buffer1 is free, driver
can modify its address.

For ISI of QXP C0, the buffer active logical reverse. It means driver
can change buffer1 address if CHNL_STS[BUF1_ACTIVE] bit is zero and can't
if CHNL_STS[BUF1_ACTIVE] bit is set.

So driver need to distinguish soc version and select how to switch ping
pong buffer.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Sandor.yu <sandor.yu@nxp.com>
2019-12-05 16:15:43 +08:00
d40637cc8c LF-135 media: mx6s_capture: fix kernel dump when start two instances of capture
the driver can't support two instances capturing, but should not have dump even
run two instances.
fix the kernel dump as below by using open counts.

[   59.147670] Mem abort info:
[   59.150480]   ESR = 0x96000006
[   59.153580]   EC = 0x25: DABT (current EL), IL = 32 bits
[   59.158928]   SET = 0, FnV = 0
[   59.162271]   EA = 0, S1PTW = 0
[   59.165431] Data abort info:
[   59.171168]   ISV = 0, ISS = 0x00000006
[   59.175031]   CM = 0, WnR = 0
[   59.180852] user pgtable: 4k pages, 48-bit VAs, pgdp=00000000b9a61000
[   59.187317] [0000000000000008] pgd=00000000b84d8003, pud=00000000b857f003, pmd=0000000000000000
[   59.198708] Internal error: Oops: 96000006 [#1] PREEMPT SMP
[   59.204282] Modules linked in:
[   59.207343] CPU: 1 PID: 642 Comm: mx6s_v4l2_captu Not tainted 5.4.0-03538-gd9bad5b71b42 #5
Message from syslogd@imx8mme[   59.218379] Hardware name: FSL i.MX8MM EVK board (DT)
[   59.223430] pstate: 60000005 (nZCv daif -PAN -UAO)
[   59.228228] pc : put_vaddr_frames+0x10/0xf0
[   59.232412] lr : vb2_destroy_framevec+0x14/0x28
[   59.236940] sp : ffff80001266bc10
[   59.240251] x29: ffff80001266bc10 x28: ffff0000746b8dc0
[   59.245562] x27: 0000000000000000 x26: 0000000000000030
[   59.250872] x25: 0000000000000060 x24: 0000000000000003
[   59.256181] x23: 0000000000000000 x22: 0000000000000000
[   59.261491] x21: 0000000000000001 x20: 0000000000000000
[   59.266801] x19: 0000000000000000 x18: 0000000000000000
[   59.272112] x17: 0000000000000000 x16: 0000000000000000
[   59.277423] x15: 0000000000000000 x14: 0000000000000000
[   59.282733] x13: 0000000000000000 x12: 0000000000000000
[   59.288043] x11: 0000000000000000 x10: 0000000000000001
[   59.293354] x9 : 0000000000000020 x8 : ffff00007dba5af8
[   59.298665] x7 : 0000000000000001 x6 : ffff00007a5ca300
[   59.303973] x5 : ffff80001266bc60 x4 : 0000000000000000
[   59.309283] x3 : 0000000000000002 x2 : ffff0000747b7600
[   59.314593] x1 : ffff800010cba6a8 x0 : 0000000000000000
[   59.319906] Call trace:
[   59.322354]  put_vaddr_frames+0x10/0xf0
[   59.326189]  vb2_destroy_framevec+0x14/0x28
[   59.330371]  vb2_dc_put_userptr+0xac/0x120
[   59.334468]  __vb2_queue_free+0x118/0x240
[   59.338476]  vb2_core_queue_release+0x34/0x48
[   59.342832]  vb2_queue_release+0xc/0x18
[   59.346668]  mx6s_csi_close+0x34/0xfc
[   59.350329]  v4l2_release+0xb4/0xe8
[   59.353817]  __fput+0x88/0x228
[   59.356868]  ____fput+0xc/0x18
[   59.359925]  task_work_run+0x80/0x130
[   59.363589]  do_notify_resume+0x1f0/0x460
[   59.367597]  work_pending+0x8/0x10
[   59.371001] Code: a9bd7bfd 910003fd a90153f3 aa0003f4 (39402001)
[   59.377094] ---[ end trace 57c60e9205cdecb0 ]---

reproduce steps:
1. v4l_emma.sh 1 4
2. enter ctrl+z when systrem start capturing
3. v4l_emma.sh 1 4

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu.zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 1a7af0123bd0677ce1a2a12f333c79552885eca9)
2019-12-05 15:35:43 +08:00
ec6ff73b55 ENGR00279980 ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1
If the master mtd does not have any slave mtd partitions,
and its numeraseregions is one(only has one erease block), and
we attach the master mtd with : ubiattach -m 0 -d 0

We will meet the error:
-------------------------------------------------------
root@freescale ~$ ubiattach /dev/ubi_ctrl -m 0 -d 0
UBI: attaching mtd0 to ubi0
UBI error: io_init: multiple regions, not implemented
ubiattach: error!: cannot attach mtd0
           error 22 (Invalid argument)
-------------------------------------------------------

In fact, if there is only one "erase block", we should not
prevent the attach.

This patch fixes it.

Signed-off-by: Huang Shijie <b32955@freescale.com>
(cherry picked from commit 361cdc47fc4c4db31c5485560cdabd94f409bd81)
(cherry picked from commit ebee7d7491)

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-12-04 23:54:06 -06:00
08a6343815 LF-281: arm: dts: Add CONFIG_MTD_PHYSMAP and CONFIG_MTD_PHYSMAP_OF for weim nor
enable weim nor by adding CONFIG_MTD_PHYSMAP and CONFIG_MTD_PHYSMAP_OF
in config

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-12-04 23:54:06 -06:00
5b4b8ddbab LF-251-3: mtd: nand: raw: gpmi-nand: add the bad block options
add the bad block options for gpmi-nand driver

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-12-04 23:54:06 -06:00
509289ed60 LF-251-2: dma: mxs-dma: switch from dma_coherent to dma_pool
create one dma_pool dedicate for all following dma_alloc and avoid
keeping allocate available memories.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-12-04 23:54:06 -06:00
49fc3313af LF-251-1: dma: mxs-dma: enable runtime PM for mxs-dma
enable runtime PM for mxs-dma

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-12-04 23:54:06 -06:00
a07a8e2d38 Documentation: dt: binding: fsl: Add 'fsl,ippdexpcr1-alt-addr' property
The 'fsl,ippdexpcr1-alt-addr' property is used to handle an errata A-008646
on LS1021A

Reviewed-by: Ran Wang <ran.wang_1@nxp.com>
Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-12-05 12:06:23 +08:00
698ce681b3 soc: fsl: handle RCPM errata A-008646 on SoC LS1021A
Description:
	- Reading configuration register RCPM_IPPDEXPCR1
	  always return zero

Workaround:
	- Save register RCPM_IPPDEXPCR1's value to
	  register SCFG_SPARECR8.(uboot's psci also
	  need reading value from the register SCFG_SPARECR8
	  to set register RCPM_IPPDEXPCR1)

Impact:
	- FlexTimer module will cannot wakeup system in
	  deep sleep on SoC LS1021A

Reviewed-by: Ran Wang <ran.wang_1@nxp.com>
Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-12-05 12:03:03 +08:00
5f8bc2bb0e Linux 5.4.2 2019-12-04 22:31:09 +01:00
e64cd7a033 platform/x86: hp-wmi: Fix ACPI errors caused by passing 0 as input size
commit f3e4f3fc8e upstream.

The AML code implementing the WMI methods creates a variable length
field to hold the input data we pass like this:

        CreateDWordField (Arg1, 0x0C, DSZI)
        Local5 = DSZI /* \HWMC.DSZI */
        CreateField (Arg1, 0x80, (Local5 * 0x08), DAIN)

If we pass 0 as bios_args.datasize argument then (Local5 * 0x08)
is 0 which results in these errors:

[   71.973305] ACPI BIOS Error (bug): Attempt to CreateField of length zero (20190816/dsopcode-133)
[   71.973332] ACPI Error: Aborting method \HWMC due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529)
[   71.973413] ACPI Error: Aborting method \_SB.WMID.WMAA due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529)

And in our HPWMI_WIRELESS2_QUERY calls always failing. for read commands
like HPWMI_WIRELESS2_QUERY the DSZI value is not used / checked, except for
read commands where extra input is needed to specify exactly what to read.

So for HPWMI_WIRELESS2_QUERY we can safely pass the size of the expected
output as insize to hp_wmi_perform_query(), as we are already doing for all
other HPWMI_READ commands we send. Doing so fixes these errors.

Cc: stable@vger.kernel.org
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=197007
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=201981
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:08 +01:00
5227ac4dda platform/x86: hp-wmi: Fix ACPI errors caused by too small buffer
commit 16245db148 upstream.

The HP WMI calls may take up to 128 bytes of data as input, and
the AML methods implementing the WMI calls, declare a couple of fields for
accessing input in different sizes, specifycally the HWMC method contains:

        CreateField (Arg1, 0x80, 0x0400, D128)

Even though we do not use any of the WMI command-types which need a buffer
of this size, the APCI interpreter still tries to create it as it is
declared in generoc code at the top of the HWMC method which runs before
the code looks at which command-type is requested.

This results in many of these errors on many different HP laptop models:

[   14.459261] ACPI Error: Field [D128] at 1152 exceeds Buffer [NULL] size 160 (bits) (20170303/dsopcode-236)
[   14.459268] ACPI Error: Method parse/execution failed [\HWMC] (Node ffff8edcc61507f8), AE_AML_BUFFER_LIMIT (20170303/psparse-543)
[   14.459279] ACPI Error: Method parse/execution failed [\_SB.WMID.WMAA] (Node ffff8edcc61523c0), AE_AML_BUFFER_LIMIT (20170303/psparse-543)

This commit increases the size of the data element of the bios_args struct
to 128 bytes fixing these errors.

Cc: stable@vger.kernel.org
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=197007
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=201981
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:08 +01:00
41dc53ab98 HID: core: check whether Usage Page item is after Usage ID items
commit 1cb0d2aee2 upstream.

Upstream commit 58e7515500 ("HID: core: move Usage Page concatenation
to Main item") adds support for Usage Page item after Usage ID items
(such as keyboards manufactured by Primax).

Usage Page concatenation in Main item works well for following report
descriptor patterns:

    USAGE_PAGE (Keyboard)                   05 07
    USAGE_MINIMUM (Keyboard LeftControl)    19 E0
    USAGE_MAXIMUM (Keyboard Right GUI)      29 E7
    LOGICAL_MINIMUM (0)                     15 00
    LOGICAL_MAXIMUM (1)                     25 01
    REPORT_SIZE (1)                         75 01
    REPORT_COUNT (8)                        95 08
    INPUT (Data,Var,Abs)                    81 02

-------------

    USAGE_MINIMUM (Keyboard LeftControl)    19 E0
    USAGE_MAXIMUM (Keyboard Right GUI)      29 E7
    LOGICAL_MINIMUM (0)                     15 00
    LOGICAL_MAXIMUM (1)                     25 01
    REPORT_SIZE (1)                         75 01
    REPORT_COUNT (8)                        95 08
    USAGE_PAGE (Keyboard)                   05 07
    INPUT (Data,Var,Abs)                    81 02

But it makes the parser act wrong for the following report
descriptor pattern(such as some Gamepads):

    USAGE_PAGE (Button)                     05 09
    USAGE (Button 1)                        09 01
    USAGE (Button 2)                        09 02
    USAGE (Button 4)                        09 04
    USAGE (Button 5)                        09 05
    USAGE (Button 7)                        09 07
    USAGE (Button 8)                        09 08
    USAGE (Button 14)                       09 0E
    USAGE (Button 15)                       09 0F
    USAGE (Button 13)                       09 0D
    USAGE_PAGE (Consumer Devices)           05 0C
    USAGE (Back)                            0a 24 02
    USAGE (HomePage)                        0a 23 02
    LOGICAL_MINIMUM (0)                     15 00
    LOGICAL_MAXIMUM (1)                     25 01
    REPORT_SIZE (1)                         75 01
    REPORT_COUNT (11)                       95 0B
    INPUT (Data,Var,Abs)                    81 02

With Usage Page concatenation in Main item, parser recognizes all the
11 Usages as consumer keys, it is not the HID device's real intention.

This patch checks whether Usage Page is really defined after Usage ID
items by comparing usage page using status.

Usage Page concatenation on currently defined Usage Page will always
do in local parsing when Usage ID items encountered.

When Main item is parsing, concatenation will do again with last
defined Usage Page if this page has not been used in the previous
usages concatenation.

Signed-off-by: Candle Sun <candle.sun@unisoc.com>
Signed-off-by: Nianfu Bai <nianfu.bai@unisoc.com>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Siarhei Vishniakou <svv@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:07 +01:00
f98a928d6e crypto: talitos - Fix build error by selecting LIB_DES
commit dbc2e87bd8 upstream.

The talitos driver needs to select LIB_DES as it needs calls
des_expand_key.

Fixes: 9d574ae8eb ("crypto: talitos/des - switch to new...")
Cc: <stable@vger.kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:07 +01:00
88e373c047 Revert "jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()"
commit 6e78c01fde upstream.

This reverts commit f2538f9993. The patch
stopped JFFS2 from being able to mount an existing filesystem with the
following errors:

 jffs2: error: (77) jffs2_build_inode_fragtree: Add node to tree failed -22
 jffs2: error: (77) jffs2_do_read_inode_internal: Failed to build final fragtree for inode #5377: error -22

Fixes: f2538f9993 ("jffs2: Fix possible null-pointer dereferences...")
Cc: stable@vger.kernel.org
Suggested-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:06 +01:00
69412e8ac6 ext4: add more paranoia checking in ext4_expand_extra_isize handling
commit 4ea99936a1 upstream.

It's possible to specify a non-zero s_want_extra_isize via debugging
option, and this can cause bad things(tm) to happen when using a file
system with an inode size of 128 bytes.

Add better checking when the file system is mounted, as well as when
we are actually doing the trying to do the inode expansion.

Link: https://lore.kernel.org/r/20191110121510.GH23325@mit.edu
Reported-by: syzbot+f8d6f8386ceacdbfff57@syzkaller.appspotmail.com
Reported-by: syzbot+33d7ea72e47de3bdf4e1@syzkaller.appspotmail.com
Reported-by: syzbot+44b6763edfc17144296f@syzkaller.appspotmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:05 +01:00
2840e52f67 r8169: fix resume on cable plug-in
[ Upstream commit 398fd408cc ]

It was reported [0] that network doesn't wake up on cable plug-in with
certain chip versions. Reason is that on these chip versions the PHY
doesn't detect cable plug-in when being in power-down mode. So prevent
the PHY from powering down if WoL is enabled.

[0] https://bugzilla.kernel.org/show_bug.cgi?id=202103

Fixes: 95fb8bb318 ("net: phy: force phy suspend when calling phy_stop")
Reported-by: jhdskag3 <jhdskag3@tutanota.com>
Tested-by: jhdskag3 <jhdskag3@tutanota.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:05 +01:00
c07fd3caad r8169: fix jumbo configuration for RTL8168evl
[ Upstream commit 14012c9f3b ]

Alan reported [0] that network is broken since the referenced commit
when using jumbo frames. This commit isn't wrong, it just revealed
another issue that has been existing before. According to the vendor
driver the RTL8168e-specific jumbo config doesn't apply for RTL8168evl.

[0] https://lkml.org/lkml/2019/11/30/119

Fixes: 4ebcb113ed ("r8169: fix jumbo packet handling on resume from suspend")
Reported-by: Alan J. Wylie <alan@wylie.me.uk>
Tested-by: Alan J. Wylie <alan@wylie.me.uk>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:04 +01:00
cb2008b4de selftests: pmtu: use -oneline for ip route list cache
[ Upstream commit 2745aea675 ]

Some versions of iproute2 will output more than one line per entry, which
will cause the test to fail, like:

TEST: ipv6: list and flush cached exceptions                        [FAIL]
  can't list cached exceptions

That happens, for example, with iproute2 4.15.0. When using the -oneline
option, this will work just fine:

TEST: ipv6: list and flush cached exceptions                        [ OK ]

This also works just fine with a more recent version of iproute2, like
5.4.0.

For some reason, two lines are printed for the IPv4 test no matter what
version of iproute2 is used. Use the same -oneline parameter there instead
of counting the lines twice.

Fixes: b964641e99 ("selftests: pmtu: Make list_flush_ipv6_exception test more demanding")
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:04 +01:00
b5c36e7734 tipc: fix link name length check
[ Upstream commit fd567ac20c ]

In commit 4f07b80c97 ("tipc: check msg->req data len in
tipc_nl_compat_bearer_disable") the same patch code was copied into
routines: tipc_nl_compat_bearer_disable(),
tipc_nl_compat_link_stat_dump() and tipc_nl_compat_link_reset_stats().
The two link routine occurrences should have been modified to check
the maximum link name length and not bearer name length.

Fixes: 4f07b80c97 ("tipc: check msg->reg data len in tipc_nl_compat_bearer_disable")
Signed-off-by: John Rutherford <john.rutherford@dektech.com.au>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:03 +01:00
7b7a6e872d selftests: bpf: correct perror strings
[ Upstream commit e5dc9dd325 ]

perror(str) is basically equivalent to
print("%s: %s\n", str, strerror(errno)).
New line or colon at the end of str is
a mistake/breaks formatting.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:03 +01:00
987daa48f8 selftests: bpf: test_sockmap: handle file creation failures gracefully
[ Upstream commit 4b67c51503 ]

test_sockmap creates a temporary file to use for sendpage.
this may fail for various reasons. Handle the error rather
than segfault.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:03 +01:00
569cac5a50 net/tls: use sg_next() to walk sg entries
[ Upstream commit c5daa6cccd ]

Partially sent record cleanup path increments an SG entry
directly instead of using sg_next(). This should not be a
problem today, as encrypted messages should be always
allocated as arrays. But given this is a cleanup path it's
easy to miss was this ever to change. Use sg_next(), and
simplify the code.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:02 +01:00
a58365a79a net/tls: remove the dead inplace_crypto code
[ Upstream commit 9e5ffed37d ]

Looks like when BPF support was added by commit d3b18ad31f
("tls: add bpf support to sk_msg handling") and
commit d829e9c411 ("tls: convert to generic sk_msg interface")
it broke/removed the support for in-place crypto as added by
commit 4e6d47206c ("tls: Add support for inplace records
encryption").

The inplace_crypto member of struct tls_rec is dead, inited
to zero, and sometimes set to zero again. It used to be
set to 1 when record was allocated, but the skmsg code doesn't
seem to have been written with the idea of in-place crypto
in mind.

Since non trivial effort is required to bring the feature back
and we don't really have the HW to measure the benefit just
remove the left over support for now to avoid confusing readers.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:02 +01:00
0e663d88f9 selftests/tls: add a test for fragmented messages
[ Upstream commit 65190f7742 ]

Add a sendmsg test with very fragmented messages. This should
fill up sk_msg and test the boundary conditions.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:01 +01:00
3cef7ef9c4 net: skmsg: fix TLS 1.3 crash with full sk_msg
[ Upstream commit 031097d9e0 ]

TLS 1.3 started using the entry at the end of the SG array
for chaining-in the single byte content type entry. This mostly
works:

[ E E E E E E . . ]
  ^           ^
   start       end

                 E < content type
               /
[ E E E E E E C . ]
  ^           ^
   start       end

(Where E denotes a populated SG entry; C denotes a chaining entry.)

If the array is full, however, the end will point to the start:

[ E E E E E E E E ]
  ^
   start
   end

And we end up overwriting the start:

    E < content type
   /
[ C E E E E E E E ]
  ^
   start
   end

The sg array is supposed to be a circular buffer with start and
end markers pointing anywhere. In case where start > end
(i.e. the circular buffer has "wrapped") there is an extra entry
reserved at the end to chain the two halves together.

[ E E E E E E . . l ]

(Where l is the reserved entry for "looping" back to front.

As suggested by John, let's reserve another entry for chaining
SG entries after the main circular buffer. Note that this entry
has to be pointed to by the end entry so its position is not fixed.

Examples of full messages:

[ E E E E E E E E . l ]
  ^               ^
   start           end

   <---------------.
[ E E . E E E E E E l ]
      ^ ^
   end   start

Now the end will always point to an unused entry, so TLS 1.3
can always use it.

Fixes: 130b392c6c ("net: tls: Add tls 1.3 support")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:31:01 +01:00
795c687eac net/tls: free the record on encryption error
[ Upstream commit d10523d0b3 ]

When tls_do_encryption() fails the SG lists are left with the
SG_END and SG_CHAIN marks in place. One could hope that once
encryption fails we will never see the record again, but that
is in fact not true. Commit d3b18ad31f ("tls: add bpf support
to sk_msg handling") added special handling to ENOMEM and ENOSPC
errors which mean we may see the same record re-submitted.

As suggested by John free the record, the BPF code is already
doing just that.

Reported-by: syzbot+df0d4ec12332661dd1f9@syzkaller.appspotmail.com
Fixes: d3b18ad31f ("tls: add bpf support to sk_msg handling")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:59 +01:00
a85ca00279 net/tls: take into account that bpf_exec_tx_verdict() may free the record
[ Upstream commit c329ef9684 ]

bpf_exec_tx_verdict() may free the record if tls_push_record()
fails, or if the entire record got consumed by BPF. Re-check
ctx->open_rec before touching the data.

Fixes: d3b18ad31f ("tls: add bpf support to sk_msg handling")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:59 +01:00
ab46fb3ef6 openvswitch: remove another BUG_ON()
[ Upstream commit 8a574f8665 ]

If we can't build the flow del notification, we can simply delete
the flow, no need to crash the kernel. Still keep a WARN_ON to
preserve debuggability.

Note: the BUG_ON() predates the Fixes tag, but this change
can be applied only after the mentioned commit.

v1 -> v2:
 - do not leak an skb on error

Fixes: aed067783e ("openvswitch: Minimize ovs_flow_cmd_del critical section.")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:58 +01:00
910d9e8839 openvswitch: drop unneeded BUG_ON() in ovs_flow_cmd_build_info()
[ Upstream commit 8ffeb03fbb ]

All the callers of ovs_flow_cmd_build_info() already deal with
error return code correctly, so we can handle the error condition
in a more gracefull way. Still dump a warning to preserve
debuggability.

v1 -> v2:
 - clarify the commit message
 - clean the skb and report the error (DaveM)

Fixes: ccb1352e76 ("net: Add Open vSwitch kernel components.")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:58 +01:00
0111438d7c sctp: cache netns in sctp_ep_common
[ Upstream commit 312434617c ]

This patch is to fix a data-race reported by syzbot:

  BUG: KCSAN: data-race in sctp_assoc_migrate / sctp_hash_obj

  write to 0xffff8880b67c0020 of 8 bytes by task 18908 on cpu 1:
    sctp_assoc_migrate+0x1a6/0x290 net/sctp/associola.c:1091
    sctp_sock_migrate+0x8aa/0x9b0 net/sctp/socket.c:9465
    sctp_accept+0x3c8/0x470 net/sctp/socket.c:4916
    inet_accept+0x7f/0x360 net/ipv4/af_inet.c:734
    __sys_accept4+0x224/0x430 net/socket.c:1754
    __do_sys_accept net/socket.c:1795 [inline]
    __se_sys_accept net/socket.c:1792 [inline]
    __x64_sys_accept+0x4e/0x60 net/socket.c:1792
    do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290
    entry_SYSCALL_64_after_hwframe+0x44/0xa9

  read to 0xffff8880b67c0020 of 8 bytes by task 12003 on cpu 0:
    sctp_hash_obj+0x4f/0x2d0 net/sctp/input.c:894
    rht_key_get_hash include/linux/rhashtable.h:133 [inline]
    rht_key_hashfn include/linux/rhashtable.h:159 [inline]
    rht_head_hashfn include/linux/rhashtable.h:174 [inline]
    head_hashfn lib/rhashtable.c:41 [inline]
    rhashtable_rehash_one lib/rhashtable.c:245 [inline]
    rhashtable_rehash_chain lib/rhashtable.c:276 [inline]
    rhashtable_rehash_table lib/rhashtable.c:316 [inline]
    rht_deferred_worker+0x468/0xab0 lib/rhashtable.c:420
    process_one_work+0x3d4/0x890 kernel/workqueue.c:2269
    worker_thread+0xa0/0x800 kernel/workqueue.c:2415
    kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253
    ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

It was caused by rhashtable access asoc->base.sk when sctp_assoc_migrate
is changing its value. However, what rhashtable wants is netns from asoc
base.sk, and for an asoc, its netns won't change once set. So we can
simply fix it by caching netns since created.

Fixes: d6c0256a60 ("sctp: add the rhashtable apis for sctp global transport hashtable")
Reported-by: syzbot+e3b35fe7918ff0ee474e@syzkaller.appspotmail.com
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:57 +01:00
97d92f0763 slip: Fix use-after-free Read in slip_open
[ Upstream commit e58c191241 ]

Slip_open doesn't clean-up device which registration failed from the
slip_devs device list. On next open after failure this list is iterated
and freed device is accessed. Fix this by calling sl_free_netdev in error
path.

Here is the trace from the Syzbot:

__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x197/0x210 lib/dump_stack.c:118
print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
__kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
kasan_report+0x12/0x20 mm/kasan/common.c:634
__asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
sl_sync drivers/net/slip/slip.c:725 [inline]
slip_open+0xecd/0x11b7 drivers/net/slip/slip.c:801
tty_ldisc_open.isra.0+0xa3/0x110 drivers/tty/tty_ldisc.c:469
tty_set_ldisc+0x30e/0x6b0 drivers/tty/tty_ldisc.c:596
tiocsetd drivers/tty/tty_io.c:2334 [inline]
tty_ioctl+0xe8d/0x14f0 drivers/tty/tty_io.c:2594
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:509 [inline]
do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:696
ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
__do_sys_ioctl fs/ioctl.c:720 [inline]
__se_sys_ioctl fs/ioctl.c:718 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Fixes: 3b5a39979d ("slip: Fix memory leak in slip_open error path")
Reported-by: syzbot+4d5170758f3762109542@syzkaller.appspotmail.com
Cc: David Miller <davem@davemloft.net>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Jouni Hogander <jouni.hogander@unikie.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:56 +01:00
d6a456237d sctp: Fix memory leak in sctp_sf_do_5_2_4_dupcook
[ Upstream commit b6631c6031 ]

In the implementation of sctp_sf_do_5_2_4_dupcook() the allocated
new_asoc is leaked if security_sctp_assoc_request() fails. Release it
via sctp_association_free().

Fixes: 2277c7cd75 ("sctp: Add LSM hooks")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:55 +01:00
8109f5b67a openvswitch: fix flow command message size
[ Upstream commit 4e81c0b3fa ]

When user-space sets the OVS_UFID_F_OMIT_* flags, and the relevant
flow has no UFID, we can exceed the computed size, as
ovs_nla_put_identifier() will always dump an OVS_FLOW_ATTR_KEY
attribute.
Take the above in account when computing the flow command message
size.

Fixes: 74ed7ab926 ("openvswitch: Add support for unique flow IDs.")
Reported-by: Qi Jun Ding <qding@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:55 +01:00
dbb5cc35b9 net: sched: fix tc -s class show no bstats on class with nolock subqueues
[ Upstream commit 14e54ab914 ]

When a classful qdisc's child qdisc has set the flag
TCQ_F_CPUSTATS (pfifo_fast for example), the child qdisc's
cpu_bstats should be passed to gnet_stats_copy_basic(),
but many classful qdisc didn't do that. As a result,
`tc -s class show dev DEV` always return 0 for bytes and
packets in this case.

Pass the child qdisc's cpu_bstats to gnet_stats_copy_basic()
to fix this issue.

The qstats also has this problem, but it has been fixed
in 5dd431b6b9 ("net: sched: introduce and use qstats read...")
and bstats still remains buggy.

Fixes: 22e0f8b932 ("net: sched: make bstats per cpu and estimator RCU safe")
Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
Signed-off-by: Tony Lu <tonylu@linux.alibaba.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:54 +01:00
63c197a192 net: psample: fix skb_over_panic
[ Upstream commit 7eb9d7675c ]

We need to calculate the skb size correctly otherwise we risk triggering
skb_over_panic[1]. The issue is that data_len is added to the skb in a
nl attribute, but we don't account for its header size (nlattr 4 bytes)
and alignment. We account for it when calculating the total size in
the > PSAMPLE_MAX_PACKET_SIZE comparison correctly, but not when
allocating after that. The fix is simple - use nla_total_size() for
data_len when allocating.

To reproduce:
 $ tc qdisc add dev eth1 clsact
 $ tc filter add dev eth1 egress matchall action sample rate 1 group 1 trunc 129
 $ mausezahn eth1 -b bcast -a rand -c 1 -p 129
 < skb_over_panic BUG(), tail is 4 bytes past skb->end >

[1] Trace:
 [   50.459526][ T3480] skbuff: skb_over_panic: text:(____ptrval____) len:196 put:136 head:(____ptrval____) data:(____ptrval____) tail:0xc4 end:0xc0 dev:<NULL>
 [   50.474339][ T3480] ------------[ cut here ]------------
 [   50.481132][ T3480] kernel BUG at net/core/skbuff.c:108!
 [   50.486059][ T3480] invalid opcode: 0000 [#1] PREEMPT SMP
 [   50.489463][ T3480] CPU: 3 PID: 3480 Comm: mausezahn Not tainted 5.4.0-rc7 #108
 [   50.492844][ T3480] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-2.fc30 04/01/2014
 [   50.496551][ T3480] RIP: 0010:skb_panic+0x79/0x7b
 [   50.498261][ T3480] Code: bc 00 00 00 41 57 4c 89 e6 48 c7 c7 90 29 9a 83 4c 8b 8b c0 00 00 00 50 8b 83 b8 00 00 00 50 ff b3 c8 00 00 00 e8 ae ef c0 fe <0f> 0b e8 2f df c8 fe 48 8b 55 08 44 89 f6 4c 89 e7 48 c7 c1 a0 22
 [   50.504111][ T3480] RSP: 0018:ffffc90000447a10 EFLAGS: 00010282
 [   50.505835][ T3480] RAX: 0000000000000087 RBX: ffff888039317d00 RCX: 0000000000000000
 [   50.507900][ T3480] RDX: 0000000000000000 RSI: ffffffff812716e1 RDI: 00000000ffffffff
 [   50.509820][ T3480] RBP: ffffc90000447a60 R08: 0000000000000001 R09: 0000000000000000
 [   50.511735][ T3480] R10: ffffffff81d4f940 R11: 0000000000000000 R12: ffffffff834a22b0
 [   50.513494][ T3480] R13: ffffffff82c10433 R14: 0000000000000088 R15: ffffffff838a8084
 [   50.515222][ T3480] FS:  00007f3536462700(0000) GS:ffff88803eac0000(0000) knlGS:0000000000000000
 [   50.517135][ T3480] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 [   50.518583][ T3480] CR2: 0000000000442008 CR3: 000000003b222000 CR4: 00000000000006e0
 [   50.520723][ T3480] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 [   50.522709][ T3480] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
 [   50.524450][ T3480] Call Trace:
 [   50.525214][ T3480]  skb_put.cold+0x1b/0x1b
 [   50.526171][ T3480]  psample_sample_packet+0x1d3/0x340
 [   50.527307][ T3480]  tcf_sample_act+0x178/0x250
 [   50.528339][ T3480]  tcf_action_exec+0xb1/0x190
 [   50.529354][ T3480]  mall_classify+0x67/0x90
 [   50.530332][ T3480]  tcf_classify+0x72/0x160
 [   50.531286][ T3480]  __dev_queue_xmit+0x3db/0xd50
 [   50.532327][ T3480]  dev_queue_xmit+0x18/0x20
 [   50.533299][ T3480]  packet_sendmsg+0xee7/0x2090
 [   50.534331][ T3480]  sock_sendmsg+0x54/0x70
 [   50.535271][ T3480]  __sys_sendto+0x148/0x1f0
 [   50.536252][ T3480]  ? tomoyo_file_ioctl+0x23/0x30
 [   50.537334][ T3480]  ? ksys_ioctl+0x5e/0xb0
 [   50.540068][ T3480]  __x64_sys_sendto+0x2a/0x30
 [   50.542810][ T3480]  do_syscall_64+0x73/0x1f0
 [   50.545383][ T3480]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
 [   50.548477][ T3480] RIP: 0033:0x7f35357d6fb3
 [   50.551020][ T3480] Code: 48 8b 0d 18 90 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d f9 d3 20 00 00 75 13 49 89 ca b8 2c 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 34 c3 48 83 ec 08 e8 eb f6 ff ff 48 89 04 24
 [   50.558547][ T3480] RSP: 002b:00007ffe0c7212c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
 [   50.561870][ T3480] RAX: ffffffffffffffda RBX: 0000000001dac010 RCX: 00007f35357d6fb3
 [   50.565142][ T3480] RDX: 0000000000000082 RSI: 0000000001dac2a2 RDI: 0000000000000003
 [   50.568469][ T3480] RBP: 00007ffe0c7212f0 R08: 00007ffe0c7212d0 R09: 0000000000000014
 [   50.571731][ T3480] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000082
 [   50.574961][ T3480] R13: 0000000001dac2a2 R14: 0000000000000001 R15: 0000000000000003
 [   50.578170][ T3480] Modules linked in: sch_ingress virtio_net
 [   50.580976][ T3480] ---[ end trace 61a515626a595af6 ]---

CC: Yotam Gigi <yotamg@mellanox.com>
CC: Jiri Pirko <jiri@mellanox.com>
CC: Jamal Hadi Salim <jhs@mojatatu.com>
CC: Simon Horman <simon.horman@netronome.com>
CC: Roopa Prabhu <roopa@cumulusnetworks.com>
Fixes: 6ae0a62861 ("net: Introduce psample, a new genetlink channel for packet sampling")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:54 +01:00
40c1eee566 net: macb: add missed tasklet_kill
[ Upstream commit 61183b056b ]

This driver forgets to kill tasklet in remove.
Add the call to fix it.

Fixes: 032dc41ba6 ("net: macb: Handle HRESP error")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:53 +01:00
45b03799ad net: dsa: sja1105: fix sja1105_parse_rgmii_delays()
[ Upstream commit 9bca3a0a92 ]

This function was using configuration of port 0 in devicetree for all ports.
In case CPU port was not 0, the delay settings was ignored. This resulted not
working communication between CPU and the switch.

Fixes: f5b8631c29 ("net: dsa: sja1105: Error out if RGMII delays are requested in DT")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:53 +01:00
72e08c098e mdio_bus: don't use managed reset-controller
[ Upstream commit 32085f25d7 ]

Geert Uytterhoeven reported that using devm_reset_controller_get leads
to a WARNING when probing a reset-controlled PHY. This is because the
device devm_reset_controller_get gets supplied is not actually the
one being probed.

Acquire an unmanaged reset-control as well as free the reset_control on
unregister to fix this.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
CC: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David Bauer <mail@david-bauer.net>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:52 +01:00
1189227da8 macvlan: schedule bc_work even if error
[ Upstream commit 1d7ea55668 ]

While enqueueing a broadcast skb to port->bc_queue, schedule_work()
is called to add port->bc_work, which processes the skbs in
bc_queue, to "events" work queue. If port->bc_queue is full, the
skb will be discarded and schedule_work(&port->bc_work) won't be
called. However, if port->bc_queue is full and port->bc_work is not
running or pending, port->bc_queue will keep full and schedule_work()
won't be called any more, and all broadcast skbs to macvlan will be
discarded. This case can happen:

macvlan_process_broadcast() is the pending function of port->bc_work,
it moves all the skbs in port->bc_queue to the queue "list", and
processes the skbs in "list". During this, new skbs will keep being
added to port->bc_queue in macvlan_broadcast_enqueue(), and
port->bc_queue may already full when macvlan_process_broadcast()
return. This may happen, especially when there are a lot of real-time
threads and the process is preempted.

Fix this by calling schedule_work(&port->bc_work) even if
port->bc_work is full in macvlan_broadcast_enqueue().

Fixes: 412ca1550c ("macvlan: Move broadcasts into a work queue")
Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:52 +01:00
1c57e9361e gve: Fix the queue page list allocated pages count
[ Upstream commit a95069ecb7 ]

In gve_alloc_queue_page_list(), when a page allocation fails,
qpl->num_entries will be wrong.  In this case priv->num_registered_pages
can underflow in gve_free_queue_page_list(), causing subsequent calls
to gve_alloc_queue_page_list() to fail.

Fixes: f5cedc84a3 ("gve: Add transmit and receive support")
Signed-off-by: Jeroen de Borst <jeroendb@google.com>
Reviewed-by: Catherine Sullivan <csully@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:51 +01:00
4c1bb6bbc5 x86/fpu: Don't cache access to fpu_fpregs_owner_ctx
commit 59c4bd853a upstream.

The state/owner of the FPU is saved to fpu_fpregs_owner_ctx by pointing
to the context that is currently loaded. It never changed during the
lifetime of a task - it remained stable/constant.

After deferred FPU registers loading until return to userland was
implemented, the content of fpu_fpregs_owner_ctx may change during
preemption and must not be cached.

This went unnoticed for some time and was now noticed, in particular
since gcc 9 is caching that load in copy_fpstate_to_sigframe() and
reusing it in the retry loop:

  copy_fpstate_to_sigframe()
    load fpu_fpregs_owner_ctx and save on stack
    fpregs_lock()
    copy_fpregs_to_sigframe() /* failed */
    fpregs_unlock()
         *** PREEMPTION, another uses FPU, changes fpu_fpregs_owner_ctx ***

    fault_in_pages_writeable() /* succeed, retry */

    fpregs_lock()
	__fpregs_load_activate()
	  fpregs_state_valid() /* uses fpu_fpregs_owner_ctx from stack */
    copy_fpregs_to_sigframe() /* succeeds, random FPU content */

This is a comparison of the assembly produced by gcc 9, without vs with this
patch:

| # arch/x86/kernel/fpu/signal.c:173:      if (!access_ok(buf, size))
|        cmpq    %rdx, %rax      # tmp183, _4
|        jb      .L190   #,
|-# arch/x86/include/asm/fpu/internal.h:512:       return fpu == this_cpu_read_stable(fpu_fpregs_owner_ctx) && cpu == fpu->last_cpu;
|-#APP
|-# 512 "arch/x86/include/asm/fpu/internal.h" 1
|-       movq %gs:fpu_fpregs_owner_ctx,%rax      #, pfo_ret__
|-# 0 "" 2
|-#NO_APP
|-       movq    %rax, -88(%rbp) # pfo_ret__, %sfp
…
|-# arch/x86/include/asm/fpu/internal.h:512:       return fpu == this_cpu_read_stable(fpu_fpregs_owner_ctx) && cpu == fpu->last_cpu;
|-       movq    -88(%rbp), %rcx # %sfp, pfo_ret__
|-       cmpq    %rcx, -64(%rbp) # pfo_ret__, %sfp
|+# arch/x86/include/asm/fpu/internal.h:512:       return fpu == this_cpu_read(fpu_fpregs_owner_ctx) && cpu == fpu->last_cpu;
|+#APP
|+# 512 "arch/x86/include/asm/fpu/internal.h" 1
|+       movq %gs:fpu_fpregs_owner_ctx(%rip),%rax        # fpu_fpregs_owner_ctx, pfo_ret__
|+# 0 "" 2
|+# arch/x86/include/asm/fpu/internal.h:512:       return fpu == this_cpu_read(fpu_fpregs_owner_ctx) && cpu == fpu->last_cpu;
|+#NO_APP
|+       cmpq    %rax, -64(%rbp) # pfo_ret__, %sfp

Use this_cpu_read() instead this_cpu_read_stable() to avoid caching of
fpu_fpregs_owner_ctx during preemption points.

The Fixes: tag points to the commit where deferred FPU loading was
added. Since this commit, the compiler is no longer allowed to move the
load of fpu_fpregs_owner_ctx somewhere else / outside of the locked
section. A task preemption will change its value and stale content will
be observed.

 [ bp: Massage. ]

Debugged-by: Austin Clements <austin@google.com>
Debugged-by: David Chase <drchase@golang.org>
Debugged-by: Ian Lance Taylor <ian@airs.com>
Fixes: 5f409e20b7 ("x86/fpu: Defer FPU state load until return to userspace")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Rik van Riel <riel@surriel.com>
Tested-by: Borislav Petkov <bp@suse.de>
Cc: Aubrey Li <aubrey.li@intel.com>
Cc: Austin Clements <austin@google.com>
Cc: Barret Rhoden <brho@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: David Chase <drchase@golang.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: ian@airs.com
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Josh Bleecher Snyder <josharian@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20191128085306.hxfa2o3knqtu4wfn@linutronix.de
Link: https://bugzilla.kernel.org/show_bug.cgi?id=205663
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:50 +01:00
5148c89f99 thunderbolt: Power cycle the router if NVM authentication fails
commit 7a7ebfa85f upstream.

On zang's Dell XPS 13 9370 after Thunderbolt NVM firmware upgrade the
Thunderbolt controller did not come back as expected. Only after the
system was rebooted it became available again. It is not entirely clear
what happened but I suspect the new NVM firmware image authentication
failed for some reason. Regardless of this the router needs to be power
cycled if NVM authentication fails in order to get it fully functional
again.

This modifies the driver to issue a power cycle in case the NVM
authentication fails immediately when dma_port_flash_update_auth()
returns. We also need to call tb_switch_set_uuid() earlier to be able to
fetch possible NVM authentication failure when DMA port is added.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=205457
Reported-by: zang <dump@tzib.net>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:50 +01:00
570c0ee0b9 mei: me: add comet point V device id
commit 82b29b9f72 upstream.

Comet Point (Comet Lake) V device id.

Cc: <stable@vger.kernel.org>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20191105150514.14010-2-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:49 +01:00
57916ffb5d mei: bus: prefix device names on bus with the bus name
commit 7a2b9e6ec8 upstream.

Add parent device name to the name of devices on bus to avoid
device names collisions for same client UUID available
from different MEI heads. Namely this prevents sysfs collision under
/sys/bus/mei/device/

In the device part leave just UUID other parameters that are
required for device matching are not required here and are
just bloating the name.

Cc: <stable@vger.kernel.org>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20191105150514.14010-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:49 +01:00
5029226bb6 USB: serial: ftdi_sio: add device IDs for U-Blox C099-F9P
commit c1a1f273d0 upstream.

This device presents itself as a USB hub with three attached devices:
 - An ACM serial port connected to the GPS module (not affected by this
   commit)
 - An FTDI serial port connected to the GPS module (1546:0502)
 - Another FTDI serial port connected to the ODIN-W2 radio module
   (1546:0503)

This commit registers U-Blox's VID and the PIDs of the second and third
devices.

Datasheet: https://www.u-blox.com/sites/default/files/C099-F9P-AppBoard-Mbed-OS3-FW_UserGuide_%28UBX-18063024%29.pdf

Signed-off-by: Fabio D'Urso <fabiodurso@hotmail.it>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:48 +01:00
244d577e28 staging: rtl8723bs: Add 024c:0525 to the list of SDIO device-ids
commit 3d5f1eedbf upstream.

Add 024c:0525 to the list of SDIO device-ids, based on a patch found
in the Android X86 kernels. According to that patch this device id is
used on the Alcatel Plus 10 device.

Reported-and-tested-by: youling257 <youling257@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191111113846.24940-1-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:47 +01:00
928353f4e1 staging: rtl8723bs: Drop ACPI device ids
commit 2d9d249153 upstream.

The driver only binds by SDIO device-ids, all the ACPI device-id does
is causing the driver to load unnecessarily on devices where the DSDT
contains a bogus OBDA8723 device.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191111113846.24940-2-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:47 +01:00
ab1908cbe2 staging: rtl8192e: fix potential use after free
commit b7aa39a2ed upstream.

The variable skb is released via kfree_skb() when the return value of
_rtl92e_tx is not zero. However, after that, skb is accessed again to
read its length, which may result in a use after free bug. This patch
fixes the bug by moving the release operation to where skb is never
used later.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1572965351-6745-1-git-send-email-bianpan2016@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:47 +01:00
bb2135c6a5 staging: wilc1000: fix illegal memory access in wilc_parse_join_bss_param()
commit c7e621bb98 upstream.

Do not copy the extended supported rates in 'param->supp_rates' if the
array is already full with basic rates values. The array size check
helped to avoid possible illegal memory access [1] while copying to
'param->supp_rates' array.

1. https://marc.info/?l=linux-next&m=157301720517456&w=2

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1487400 ("Memory - illegal accesses")
Fixes: 4e0b0f42c9 ("staging: wilc1000: use struct to pack join parameters for FW")
Cc: stable@vger.kernel.org
Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Link: https://lore.kernel.org/r/20191106062127.3165-1-ajay.kathat@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:46 +01:00
eea8956c96 usb: dwc2: use a longer core rest timeout in dwc2_core_reset()
commit 6689f0f4bb upstream.

Testing on different generations of Lantiq MIPS SoC based boards, showed
that it takes up to 1500 us until the core reset bit is cleared.

The driver from the vendor SDK (ifxhcd) uses a 1 second timeout. Use the
same timeout to fix wrong hang detections and make the driver work for
Lantiq MIPS SoCs.

At least till kernel 4.14 the hanging reset only caused a warning but
the driver was probed successful. With kernel 4.19 errors out with
EBUSY.

Cc: linux-stable <stable@vger.kernel.org> # 4.19+
Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:45 +01:00
88d945a0b0 driver core: platform: use the correct callback type for bus_find_device
commit 492c88720d upstream.

platform_find_device_by_driver calls bus_find_device and passes
platform_match as the callback function. Casting the function to a
mismatching type trips indirect call Control-Flow Integrity (CFI) checking.

This change adds a callback function with the correct type and instead
of casting the function, explicitly casts the second parameter to struct
device_driver* as expected by platform_match.

Fixes: 36f3313d6b ("platform: Add platform_find_device_by_driver() helper")
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191112214156.3430-1-samitolvanen@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:45 +01:00
f3cda1dea7 crypto: inside-secure - Fix stability issue with Macchiatobin
commit b8c5d882c8 upstream.

This patch corrects an error in the Transform Record Cache initialization
code that was causing intermittent stability problems on the Macchiatobin
board.

Unfortunately, due to HW platform specifics, the problem could not happen
on the main development platform, being the VCU118 Xilinx development
board. And since it was a problem with hash table access, it was very
dependent on the actual physical context record DMA buffers being used,
i.e. with some (bad) luck it could seemingly work quit stable for a while.

Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 22:30:44 +01:00
d624594445 net: disallow ancillary data for __sys_{send,recv}msg_file()
[ Upstream commit d69e07793f ]

Only io_uring uses (and added) these, and we want to disallow the
use of sendmsg/recvmsg for anything but regular data transfers.
Use the newly added prep helper to split the msghdr copy out from
the core function, to check for msg_control and msg_controllen
settings. If either is set, we return -EINVAL.

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-04 22:30:44 +01:00
78df03e4c8 net: separate out the msghdr copy from ___sys_{send,recv}msg()
[ Upstream commit 4257c8ca13 ]

This is in preparation for enabling the io_uring helpers for sendmsg
and recvmsg to first copy the header for validation before continuing
with the operation.

There should be no functional changes in this patch.

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-04 22:30:43 +01:00
8387e3688a io_uring: async workers should inherit the user creds
[ Upstream commit 181e448d87 ]

If we don't inherit the original task creds, then we can confuse users
like fuse that pass creds in the request header. See link below on
identical aio issue.

Link: https://lore.kernel.org/linux-fsdevel/26f0d78e-99ca-2f1b-78b9-433088053a61@scylladb.com/T/#u
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-04 22:30:42 +01:00
f31f59f101 net: dsa: felix: Fix probing allocation and cleanup path
dsa_switch_alloc() uses managed (devm_alloc) allocation
to alloc 'ds'.  kfree()-ing 'ds' results in memory corruption.
kfree(ds) seems harmless on the error path, however for this
particular device, dsa_register_swtich() deffers probing to
allow the enetc driver to probe the master port first.
This results in kfree(ds) being called during the first
probing attempt of felix, followed by a NULL poiter access
crash during enetc driver probing (when accessing its net_device).

This patch fixes following crash (triggerred in the enetc driver by
the probing routine of the felix driver):

[    3.502254] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[    3.511073] Mem abort info:
[    3.513874]   ESR = 0x96000044
[    3.516936]   EC = 0x25: DABT (current EL), IL = 32 bits
[    3.522266]   SET = 0, FnV = 0
[    3.525327]   EA = 0, S1PTW = 0
[    3.528476] Data abort info:
[    3.531359]   ISV = 0, ISS = 0x00000044
[    3.535205]   CM = 0, WnR = 1
[    3.538182] user pgtable: 4k pages, 48-bit VAs, pgdp=00000020f612d000
[    3.544645] [0000000000000000] pgd=0000000000000000
[    3.549542] Internal error: Oops: 96000044 [#1] PREEMPT SMP
[    3.555128] Modules linked in:
[    3.558189] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.0-03552-gfa6e1cd69f80 #1
[    3.565781] Hardware name: LS1028A RDB Board (DT)
[    3.570496] pstate: a0000005 (NzCv daif -PAN -UAO)
[    3.575303] pc : enetc_pf_probe+0x784/0xba8
[    3.579495] lr : enetc_pf_probe+0x6e8/0xba8
[    3.583686] sp : ffff80001002ba90
[    3.587005] x29: ffff80001002ba90 x28: ffff002076130c08
[    3.592331] x27: 0000000000000002 x26: ffff002076130c80
[    3.597657] x25: ffff002076130c00 x24: ffff002076130c80
[    3.602982] x23: ffffb3f2ab0ec000 x22: ffff0020760d7840
[    3.608307] x21: ffff0020760d7000 x20: ffff002076130c00
[    3.613632] x19: ffff800010850000 x18: ffffffffffffffff
[    3.618957] x17: 000000007dee1586 x16: 00000000cb746ba4
[    3.624282] x15: ffffb3f2abce9908 x14: 0000000000000000
[    3.629608] x13: 0000000000000101 x12: 0000000000010000
[    3.634933] x11: 00000000ffffffff x10: ffff4c2dd0136000
[    3.640257] x9 : 0000000000000000 x8 : ffff002076122000
[    3.645582] x7 : 0000000000000000 x6 : 000000000000003f
[    3.650908] x5 : 0000000000000040 x4 : 0000000000000001
[    3.656234] x3 : ffff800010850000 x2 : ffffb3f2ab0ed868
[    3.661560] x1 : 0000000000000000 x0 : 00000000051ca556
[    3.666886] Call trace:
[    3.669333]  enetc_pf_probe+0x784/0xba8
[    3.673178]  local_pci_probe+0x3c/0xa0
[    3.676935]  pci_device_probe+0x128/0x1c0
[    3.680954]  really_probe+0x108/0x348
[    3.684623]  driver_probe_device+0x58/0x100
[    3.688815]  device_driver_attach+0x6c/0x90
[    3.693006]  __driver_attach+0x84/0xc8
[    3.696762]  bus_for_each_dev+0x74/0xc8
[    3.700605]  driver_attach+0x20/0x28
[    3.704186]  bus_add_driver+0x148/0x1f0
[    3.708029]  driver_register+0x60/0x110
[    3.711872]  __pci_register_driver+0x40/0x48
[    3.716153]  enetc_pf_driver_init+0x20/0x28
[    3.720346]  do_one_initcall+0x5c/0x1b0
[    3.724189]  kernel_init_freeable+0x1a4/0x24c
[    3.728557]  kernel_init+0x10/0x108
[    3.732052]  ret_from_fork+0x10/0x18
[    3.735635] Code: f9400680 f9417ea1 91020000 b9400000 (b9000020)
[    3.741749] ---[ end trace c8ab43e3d33fed3f ]---
[    3.746396] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    3.748522] ata1: SATA link down (SStatus 0 SControl 300)
[    3.754077] SMP: stopping secondary CPUs
[    3.754082] Kernel Offset: 0x33f299c00000 from 0xffff800010000000
[    3.754083] PHYS_OFFSET: 0xfffff019c0000000
[    3.754086] CPU features: 0x0002,21806008
[    3.754088] Memory Limit: none
[    3.780794] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---

As a result of the fix, struct felix allocation also needs to
be converted to managed allocation (devm_alloc).

Fixes: bb849431a9 ("net: dsa: ocelot: alloc memory for dsa switch instance")

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-04 20:05:36 +02:00
fa6e1cd69f MGS-5372 [#imx-1708] Fix the VX/CL apps hang for 865 GPU/VIP
Add VIP HW type to avoid GPU/VIP command mess when run VX/CL apps.

Date: 4 Dec, 2019
Singed-off-by: Ella Feng <ella.feng@nxp.com>
2019-12-05 03:12:51 +08:00
f4bdd2f37b arm64: defconfig: Enable support for SOF on i.MX8
This enables SOF for i.MX8QXP.

    Brings in support for:
            * IMX DSP protocol communication driver
            * SOF_OF, device tree support for SOF
            * SOF_IMX8, support for i.MX8QXP integration.
            * Generic FSL DAI support

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-04 12:44:41 +02:00
4539312b8d LF-318 arm64: dts: imx8qm/qxp: mark ocotp as read only
Mark ocotp as read only, if you need to program fuse in linux,
remove this property.

Acked-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-04 18:42:59 +08:00
51226f91ca LF-334-2 nvmem: imx-ocotp-scu: align offset with fusemap
The previous offset / 4 maps to fuse map row index, which is
not friendly for user. So align with the following patch, update
the write to align with fuse row index exactly

"
    nvmem: imx: correct the fuse word index

    iMX8 fuse word index represent as one 4-bytes word,
    it should not be divided by 4.

    Exp:
    - MAC0 address layout in fuse:
    offset 708: MAC[3] MAC[2] MAC[1] MAC[0]
    offset 709: XX     xx     MAC[5] MAC[4]

    Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
"

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-04 18:42:59 +08:00
ee4c49f1e6 LF-334-1 nvmem: imx: scu: fix write SIP
SIP number 0xC200000A is for reading, 0xC200000B is for writing.
And the following two args for write are word index, data to write.

Fixes: 885ce72a09 ("nvmem: imx: scu: support write")
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-04 18:42:59 +08:00
9fcda3b2b8 nvmem: imx: scu: support write
The fuse programming from non-secure world is blocked, so we could
only use Arm Trusted Firmware SIP call to let ATF program fuse.

Because there is ECC region that could only be programmed once,
so add a heler in_ecc to check the ecc region.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20191029114240.14905-5-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 18:42:59 +08:00
789af1cdc8 nvmem: imx: scu: support hole region check
Introduce HOLE/ECC_REGION flag and in_hole helper to ease the check
of hole region. The ECC_REGION is also introduced here which is
preparing for programming support. ECC_REGION could only be programmed
once, so need take care.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20191029114240.14905-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-04 18:42:58 +08:00
95b33c0bba enetc: add support tsn capabilities qbv/qci/qbu/cbs
Support Qbv/Qci/Qbu/Credit Base Shaper etc.
This patch using the generic netlink adapt layer driver net/tsn/*
and include/net/tsn.h interface load by user space. The user space
refer the include/uapi/linux/tsn.h.

Signed-off-by: Po Liu <Po.Liu@nxp.com>
2019-12-04 17:49:44 +08:00
fb1919ab79 enetc: add support Credit Based Shaper(CBS) for hardware offload
The ENETC hardware support the Credit Based Shaper(CBS) which part
of the IEEE-802.1Qav. The CBS driver was loaded by the sch_cbs
interface when set in the QOS in the kernel.

Here is an example command to set 20Mbits bandwidth in 1Gbits port
for taffic class 7:

tc qdisc add dev eth0 root handle 1: mqprio \
	   num_tc 8 map 0 1 2 3 4 5 6 7 hw 1

tc qdisc replace dev eth0 parent 1:8 cbs \
	   locredit -1470 hicredit 30 \
	   sendslope -980000 idleslope 20000 offload 1

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-04 17:49:41 +08:00
7c9ec8f31d LF-352 arm: dts: imx6ul[l]-evk: increase CMA size to fix alloc failure for v4l2
increase CMA size to 160MB to fix cma alloc failure for v4l2 capture case:

Capture_To_Display_mmap: mode 6(2592x1944)@15fps test.
...
[ 247.301290] cma: cma_alloc: alloc failed, req-size: 2461 pages, ret: -12
[ 247.308290] mx6s-csi 21c4000.csi: dma_alloc_coherent of size 10080256 failed
[ 247.317097] cma: cma_alloc: alloc failed, req-size: 2461 pages, ret: -12
...

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
(cherry picked from commit 1b0a2c9d50ac0d441243f0a2e88760c7e1e7b5ef)
2019-12-04 16:44:41 +08:00
2ae1e74241 LF-351 ARM: imx: Correct the soc_id on imx6qp
On i.MX6QP, the soc_id exported to the /sys/devices/soc0/soc_id
should be 'i.MX6QP'.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-12-04 16:39:56 +08:00
03b6fb77ec LF-95-5 drm/imx: imx-ldb: Correct control register offset for i.MX8QM/QXP LDB
The i.MX8QM/QXP LDB control register lives in CSR region, so the offset
of it should be calculated according to CSR region start address.
Without this patch, the offset is calculated according to i.MX8QM/QXP
LVDS subsystem start address.  This patch corrects the offset.

Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-12-04 13:26:55 +08:00
ae40f5e155 LF-95-4 drm/bridge: nwl-dsi: Correct register offsets for tx_ulps and pxl2dpi
Registers tx_ulps and pxl2dpi live in CSR region, so the offsets of
them should be calculated according to CSR region start address.
Without this patch, the offsets are calculated according to i.MX8QM
MIPI DSI subsystem start address or i.MX8QXP LVDS/MIPI DSI subsystem
start address.  This patch corrects the offsets.

Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-12-04 13:26:55 +08:00
819ac28e43 LF-95-3 arm64: imx8qxp-ss-lvds.dtsi: Correct LVDS/MIPI DSI region address and size
The LVDS/MIPI DSI region is the CSR(Control Status Registers) space.
The spec tells us that the CSR start address is 0x1000 and end address
is 0x1FFF according to the subsystem start address.  However, it turns
out some space are inaccessible, which would accidently cause system
hang via kernel regmap debugfs.  This patch corrects the LVDS/MIPI DSI
region start address and chooses a sensible size, which makes sure all
exposed registers are accessible.

Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-12-04 13:26:55 +08:00
bc13a402c6 LF-95-2 arm64: imx8qm-ss-mipi.dtsi: Correct MIPI CSR address and size
The spec tells us that the CSR start address is 0x1000 and end address
is 0x1FFF according to the subsystem start address.  However, it turns
out some space are inaccessible, which would accidently cause system
hang via kernel regmap debugfs.  This patch corrects the MIPI CSR
start address and chooses a sensible size, which makes sure all exposed
registers are accessible.

Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-12-04 13:26:55 +08:00
545c6201da LF-95-1 arm64: imx8qm-ss-lvds.dtsi: Correct LVDS region address and size
The LVDS region is the CSR(Control Status Registers) space.
The spec tells us that the CSR start address is 0x1000 and end address
is 0x1FFF according to the subsystem start address.  However, it turns
out some space are inaccessible, which would accidently cause system
hang via kernel regmap debugfs.  This patch corrects the LVDS region
start address and chooses a sensible size, which makes sure all exposed
registers are accessible.

Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-12-04 13:26:55 +08:00
533604f383 MLK-21106: ASoC: imx-ak4458: Fix channel not supported in tdm & daisy chain
The channel num (9 - 15) should not be supported in tdm & daisy chain
mode for there is two dataline, this channel number can't be
symmetrically distributed on two dataline (the first one is fixed to
be 8 channel)

Fixes commit 8d29874365 ("MLK-17817-2: ASoC: imx-ak4458: enable 16
channels in TDM mode")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0bc47b3166)
2019-12-04 12:50:54 +08:00
2218ef087f LF-346 arm64: dts: imx8mm-ddr4-evk-revb: add new dtb for rm67191 and touch
Create a new dts to support rm67191 panel display and its
touch function on the imx8mm ddr4 evk revb board.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
2019-12-04 11:13:29 +08:00
61b2db1d73 LF-335 drm/bridge: sec-dsim: solve fallthrough build warnings
There are some fallthrough build warnings reported by
the GCC with -Wimplicit-fallthrough option like below:

drivers/gpu/drm/bridge/sec-dsim.c: In function ‘sec_mipi_dsim_write_pl_to_sfr_fifo’:
drivers/gpu/drm/bridge/sec-dsim.c:606:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
  606 |   pl_data |= ((u8 *)payload)[2] << 16;
      |   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/bridge/sec-dsim.c:607:2: note: here
  607 |  case 2:
      |  ^~~~
drivers/gpu/drm/bridge/sec-dsim.c:608:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
  608 |   pl_data |= ((u8 *)payload)[1] << 8;
      |   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/bridge/sec-dsim.c:609:2: note: here
  609 |  case 1:
      |  ^~~~
drivers/gpu/drm/bridge/sec-dsim.c: In function ‘sec_mipi_dsim_read_pl_from_sfr_fifo’:
drivers/gpu/drm/bridge/sec-dsim.c:687:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
  687 |     ((u8 *)payload)[2] = (pl >> 16) & 0xff;
      |     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/bridge/sec-dsim.c:688:4: note: here
  688 |    case 2:
      |    ^~~~
drivers/gpu/drm/bridge/sec-dsim.c:689:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
  689 |     ((u8 *)payload)[1] = (pl >> 8) & 0xff;
      |     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/bridge/sec-dsim.c:690:4: note: here
  690 |    case 1:
      |    ^~~~

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
2019-12-04 11:13:29 +08:00
a3e29899f6 arm64: defconfig: Enable generic FSL DAI module
To be used with SOF.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 18:15:54 +02:00
9724d358ea arm64: dts: Add tplg-filename property
This will support ESAI + cs42888 usecase.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 17:56:57 +02:00
95f787bb06 arm64: defconfig: Enable support for SOF on i.MX8
This enables SOF for i.MX8QXP.

Brings in support for:
	* IMX DSP protocol communication driver
	* SOF_OF, device tree support for SOF
	* SOF_IMX8, support for i.MX8QXP integration.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 17:45:24 +02:00
e00f0e9f11 ASoC: fsl_dsp: Rename reserved-region with memory-region
This aligns DSP node description with upstream. No need
to add backward compatibility for older dtbs because
FSL DSP driver is obsolete and it will be removed in the future

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 17:45:01 +02:00
6ac62ad9c5 arm64: dts: Fix memory-region property of DSP node
With this fixed we can avoid overrinding the property in SOF DTS
because it is useless now.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 17:45:01 +02:00
345182e91d arm64: dts: Move mailbox description to generic DSP node
This matches the upstream implementation.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 17:45:01 +02:00
050dd665bd arm64: dts: Do not override power-domains node of dsp
Because we've separated power domain enablement for DSP (DAI related
power-domains are now enabled in FSL DAI node) there is no need
to override power-domains node.

Note that IRQSTR_DSP power-domain was missing from initial dsp
description so add it now.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 17:45:01 +02:00
a43b8238de arm64: dts: Disable amix when running SOF testcases
This will allow imx8qxp-mek-sof.dtb to be used exclusively
for SOF.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 17:45:01 +02:00
8511427845 ASoC: SOF: Parse fw/tplg filename from DT
Introduce two DT properties in dsp node:
	* fw-filename, optional property giving the firmware filename
	(if this is missing fw filename is read from board description)
	* tplg-filename, mandatory giving the topology filename.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-12-03 17:44:01 +02:00
e9ebba414a LF-302-5: usb: typec: tcpci: enable force discharge
Enable vbus low voltage alert and do force discharge, this can aid turn
off vbus quickly.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-03 18:33:04 +08:00
3bb18b9d22 LF-332 ARM: dts: imx6ul-14x14-evk: update usdhc1 pin group
imx6ul Rev1.2 with 14x14 evk revC board required to increase
SD1_CLK pin drive strength. So update usdhc1 pin group for
imx6ul-14x14-evk to avoid crc error.

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-03 18:41:04 +08:00
62b1880446 LF-105-2 fbdev: mxc: hdmi: fix build warning of fall through
fix following build warning:
../drivers/video/fbdev/mxc/mxc_hdmi.c: In function 'mxc_hdmi_cable_connected':
../drivers/video/fbdev/mxc/mxc_hdmi.c:1964:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
   mxc_hdmi_default_edid_cfg(hdmi);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/video/fbdev/mxc/mxc_hdmi.c:1966:2: note: here
  case HDMI_EDID_NO_MODES:
  ^~~~

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
(cherry picked from commit ca5ffb6e67b6c4ce7351285a184179bd3c20afc5)
2019-12-03 18:10:20 +08:00
4cfc9a7d83 LF-105-1 dmaengine: pxp: fix build warning of fall through
Fix the following build warning:
../drivers/dma/pxp/pxp_dma_v3.c: In function 'pxp_store_shift_ctrl_config':
../drivers/dma/pxp/pxp_dma_v3.c:1700:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
    shift_bypass = 1;
    ~~~~~~~~~~~~~^~~
../drivers/dma/pxp/pxp_dma_v3.c:1701:3: note: here
   case PXP_PIX_FMT_YVYU:
   ^~~~
../drivers/dma/pxp/pxp_dma_v3.c:1705:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
    shift_bypass = 1;
    ~~~~~~~~~~~~~^~~
../drivers/dma/pxp/pxp_dma_v3.c:1706:3: note: here
   case PXP_PIX_FMT_NV61:
   ^~~~

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
(cherry picked from commit c1ca344b32c914c89cbcf307a2e1313ad82a0b71)
2019-12-03 18:09:26 +08:00
4c442d257e arm: imx_v7_defconfig: enable FB_MXC_OVERLAY config
Enable FB_MXC_OVERLAY config by default for the lcdif
driver on legacy i.MX6 and i.MX7 platforms.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-12-03 17:58:36 +08:00
dd7f8f01c5 video: fbdev: mxsfb: fix build error for dma_alloc_writecombine
Since the commit

commit 212836a992
Author: Christoph Hellwig <hch@lst.de>
Date:   Fri Jul 26 08:58:36 2019 +0200

    dma-mapping: remove dma_{alloc,free,mmap}_writecombine

has removed dma_alloc_writecombine interface, below build
error occured:

drivers/video/fbdev/mxsfb.c: In function ‘mxsfb_overlay_map_video_memory’:
drivers/video/fbdev/mxsfb.c:2059:19: error: implicit declaration of function ‘dma_alloc_writecombine’; did you mean ‘pgprot_writecombine’? [-Werror=implicit-function-declaration]
 2059 |  ofb->video_mem = dma_alloc_writecombine(ofb->dev,
      |                   ^~~~~~~~~~~~~~~~~~~~~~
      |                   pgprot_writecombine
drivers/video/fbdev/mxsfb.c:2059:17: warning: assignment to ‘void *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 2059 |  ofb->video_mem = dma_alloc_writecombine(ofb->dev,
      |                 ^
drivers/video/fbdev/mxsfb.c: In function ‘mxsfb_overlay_exit’:
drivers/video/fbdev/mxsfb.c:2134:4: error: implicit declaration of function ‘dma_free_writecombine’; did you mean ‘pgprot_writecombine’? [-Werror=implicit-function-declaration]
 2134 |    dma_free_writecombine(ofb->dev, ofb->video_mem_size,
      |    ^~~~~~~~~~~~~~~~~~~~~
      |    pgprot_writecombine

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-12-03 17:54:46 +08:00
ece5870144 vide: fbdev: mxsfb: don't check return value for lock_fb_info()
Since the commit

commit cf4a3ae4ef
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Tue May 28 11:02:47 2019 +0200

    fbdev: lock_fb_info cannot fail

has changed the lock_fb_info() to void type, so cannot check its
return value anymore.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-12-03 17:54:39 +08:00
0d583079c7 LF-282 drm/imx: dpu: Kconfig: Add prompt string for DRM_IMX_DPU
The prompt string for config entry DRM_IMX_DPU is missing,
so this patch adds it.

Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-12-03 17:15:43 +08:00
0473ed0d66 usb: gadget: configfs: Fix missing spin_lock_init()
(Upstream: 093edc2baa)

The driver allocates the spinlock but not initialize it.
Use spin_lock_init() on it to initialize it correctly.

This is detected by Coccinelle semantic patch.

Reviewed-by: Ran Wang <ran.wang_1@nxp.com>
Fixes: 1a1c851bbd ("usb: gadget: configfs: fix concurrent issue between composite APIs")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Link: https://lore.kernel.org/r/20191030034046.188808-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-03 17:12:29 +08:00
915ec16261 LF-320-2 ARM: imx_v7_defconfig: add some missing USB configurations
- Two USB certification configuration
i.MX customers need one Image for both USB certification and production,
add USB certification configurations will not affect normal functions.

- CONFIG_EXTCON_USB_GPIO
Align with v4.19 kernel, some old boards uses this configurations.

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-12-03 17:12:29 +08:00
75dfc16e2d LF-320-1 ARM64: imx_v8_defconfig: add USB certification related configurations
i.MX customers need one Image for both USB certification and production,
add USB certification configurations will not affect normal functions.

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-12-03 17:12:29 +08:00
c3a152de1f LF-296: drm: mhdp: build mhdp sub-modules into one driver module
mhdp kernel driver support build as module.
All mhdp sub-modules are built into one driver module.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit f516f7769a52fdda185920a89efa3de9a1ddb9e8)
2019-12-03 17:06:34 +08:00
ce03e58492 LF-319 ARM: imx: Enable ARM_ERRATA_814220 for i.MX6UL and i.MX7D
i.MX6UL and i.MX7D have Cortex-A7 inside, need to enable ARM_ERRATA_814220
for proper workaround.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-12-03 15:01:29 +08:00
52c8608ced LF-315 ARM: imx_v7_defconfig: fix missing config options
The former imx_v7_defconfig missed a lot configs. Re-generated by removing
only MULTI_V6 support and make savedefconfig.

Double checked with 4.19 .config, no signifcant config options are missing.

Fixes: 6d80685fd7 ("LF-272-1 ARM: config: add imx_v7_defconfig")
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-03 14:48:25 +08:00
2474e149bc MLK-17077 usb: typec: clear vbus change event in irq handler
For vbus change event, we need read the vbus status to clear
the alert. Current code do this in queue work, this has problem
on single core running, the queue work of vbus change may have
no chance to be scheduled as we continue receive the vbus change
event in threaded irq.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-03 12:08:18 +08:00
2525024fc9 LF-302-4 arm64: dts: imx8mn-ddr4-evk: add usb and typec node
Add usb and typec node for 1st port.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-03 12:08:18 +08:00
9aaf209c0e LF-302-3 arm64: dts: imx8mn-evk: update typec node
Update typec node of 1st port to use the property of new kernel
driver, and use usb-role-switch for dual role switch.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-03 12:08:18 +08:00
5bce52181e LF-302-2 arm64: dtsi: imx8mn: remove unused clk for usb
Remove unused clock IMX8MN_CLK_USB_CORE_REF.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-03 12:08:18 +08:00
5d84573265 LF-302-1 clk: imx8mn: correct the usb1_ctrl parent to be usb_bus
Per latest imx8mn datasheet of CCM, the parent of usb1_ctrl_root_clk
should be usb_bus.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-03 12:08:18 +08:00
a0efe64cd7 LF-283 gpu: imx: dpu: common: Get irq count properly
Since of_irq_count() is not exported as a symbol, we cannot
find it's definition when imx-dpu-core is built as a module.
To address this issue, this patch calls platform_irq_count()
to get irq count instead.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-12-03 10:55:23 +08:00
c3dec8972f LF-304 ARM64: dts: add synaptics_dsx_i2c touch support for imx8mm/imx8mq board.
Add synaptics_dsx_i2c touch support for imx8mm-ddr4-evk board and
imx8mq-evk board.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-12-03 10:19:19 +08:00
a3e8e990c6 LF-238-1 ARM: configs: imx_v7_defconfig: enable USB ACM
It is used for CDC ACM function.

Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
[ Aisheng: cherry picked from imx_v6_v7_defconfig ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:17:19 +08:00
90bc113ae3 LF-230 ARM: imx_v7_defconfig: Use 2G/2G for user/kernel memory split
Use 2G/2G for user/kernel memory split to increase vmalloc size.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-12-02 18:06:32 +08:00
498e52211a LF-272-2 arm64: defconfig: add imx_v8_defconfig
1. Remove other Arch except layerscape and s32.
2. Change CONFIG_FORCE_MAX_ZONEORDER to 14

Then generated by make savedefconfig

Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:06:17 +08:00
6d80685fd7 LF-272-1 ARM: config: add imx_v7_defconfig
Remove MULTI_V6 and Vybrid support.
This is aligned with 4.19 support

Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:06:02 +08:00
b789d4e9ea Merge branch 'xen/next' into next
* xen/next:
  LF-191-3 Documentation: bindings: i2c: add xen,i2c
  LF-191-2 i2c: introduce xen i2c paravirtualization driver
  LF-191-1 xen: interface: introduce i2cif
2019-12-02 18:05:34 +08:00
5628bf4325 Merge branch 'pwm/next' into next
* pwm/next:
  pwm: imx27: Use 32k clock if it is supplied
2019-12-02 18:05:34 +08:00
9c3a4bfcf6 Merge branch 'wifi/next' into next
* wifi/next: (51 commits)
  MLK-22949 brcmfmac: add chip id check for clm_blob firmware load
  MLK-22948 brcmfmac: avoid to send mailbox interrupt twice for core version 0xb
  MLK-22946 brcmfmac: freeing wiphy after brcmf attach failed
  dt-bindings: add new property to enable board_type
  brcmfmac: let board_type is optional
  ...
2019-12-02 18:05:33 +08:00
88db34eef0 Merge branch 'vfio/next' into next
* vfio/next: (10 commits)
  vfio/fsl-mc: Map the VFIO region according to the flags received from mc firmware
  vfio/fsl-mc: Add read/write support for fsl-mc devices
  vfio/fsl-mc: trigger an interrupt via eventfd
  vfio/fsl-mc: Add irq infrastructure for fsl-mc devices
  vfio/fsl-mc: Added lock support in preparation for interrupt handling
  ...
2019-12-02 18:05:32 +08:00
210428cc37 Merge branch 'usb/next' into next
* usb/next: (188 commits)
  LF-252 usb: cdns3: gadget: fix the issue for DMA scatter buffer list
  usb: dwc3: Add cache type configuration support
  usb: dwc3: Add chip-specific compatible string
  MLK-22675 usb: dwc3: host: disable park mode
  MLK-22878 usb: cdns3: gadget: add imx8qxp C0 support
  ...
2019-12-02 18:05:31 +08:00
3e2e5e5550 Merge branch 'uart/next' into next
* uart/next: (18 commits)
  MLK-22971 serial: imx: disable UCR4_OREN in .stop_rx()
  tty: serial: lpuart: add LS1028A support
  serial: fsl_lpuart: enable two stop bits
  tty: serial: lpuart: enable wakeup source for lpuart
  MLK-17133-02 tty: serial: lpuart: add runtime pm support
  ...
2019-12-02 18:05:30 +08:00
e6fbc0b2a6 Merge branch 'thermal/next' into next
* thermal/next: (12 commits)
  MLK-23010 thermal: imx_sc_thermal: Correct message format to avoid stack corruption
  thermal: imx_sc_thermal: Add system-wide device cooling to all thermal zones
  thermal: qoriq: add thermal monitor unit version 2 support
  thermal: imx: Add device cooling support
  thermal: imx8mm: Add device cooling support
  ...
2019-12-02 18:05:29 +08:00
b822384c41 Merge branch 'spi/next' into next
* spi/next: (15 commits)
  spi: spi-fsl-qspi: Introduce variable to fix different invalid master Id
  dt-bindings: spi: spi-fsl-qspi: Add bindings of ls1088a and ls1012a
  spi: spi-fsl-qspi: dynamically alloc AHB memory for QSPI
  spi: spi-nxp-fspi: Enable the Octal Mode in MCR0
  MLK-21960-2: spi: fspi: dynamically alloc AHB memory
  ...
2019-12-02 18:05:29 +08:00
7b8618cba8 Merge branch 'sensor/next' into next
* sensor/next: (29 commits)
  LF-99 hwmon: mag3110: correct processing order after probe error
  MLK-22296-4 misc: mpl3115: Fix build warning when CONFIG_PM_SLEEP=n
  MLK-17061-1 sensor: set sensor interrupt pins as open-drain
  hwmon: mma8451: Add regulator_disable to avoid WARN_ON
  hwmon: mag3110: Add regulator_disable to avoid WARN_ON
  ...
2019-12-02 18:05:28 +08:00
37f302047d Merge branch 'sdhc/next' into next
* sdhc/next: (27 commits)
  MLK-19402 mmc: sdhci-esdhc-imx: optimize the strobe dll setting
  MLK-22966 mmc: sdhci-esdhc-imx: optimize the clock setting
  mmc: sdhci-esdhc-imx: Add support for S32V234
  mmc: sdhci-of-esdhc: fix up erratum A-008171 workaround
  mmc: sdhci-of-esdhc: poll ESDHC_FLUSH_ASYNC_FIFO bit until completion
  ...
2019-12-02 18:05:27 +08:00
7ef83a3b25 Merge branch 'sata/next' into next
* sata/next: (11 commits)
  LF-58: sata: imx8: fix the calibration failure of phy
  MLK-22941 ata: ahci_imx: fix error path
  ahci: imx: set the rx water mark to fix the gen3 link issue
  ahci_qoriq: bug fix for ecc_addr
  ahci: qoriq: workaround for errata A-379364 on lx2160a
  ...
2019-12-02 18:05:27 +08:00
3e11676672 Merge branch 'rtc/next' into next
* rtc/next:
  rtc: imx-rpmsg: Add i.MX RPMSG RTC support
  rtc: imx-sc: Add i.MX8QM RTC support
2019-12-02 18:05:26 +08:00
d02c20ba62 Merge branch 'rpmsg/next' into next
* rpmsg/next: (8 commits)
  LF-44 rpmsg: imx: add the rpmsg tty demo
  rpmsg: imx: enable the tx_block mechanism in the flow
  rpmsg: imx_rpmsg: add partition reset notify
  rpmsg: imx: bug fix and clean up the codes
  rpmsg: imx: extend the rpmsg support for imx8qm and so on
  ...
2019-12-02 18:05:26 +08:00
a125d5ff37 Merge branch 'reset/next' into next
* reset/next: (12 commits)
  reset: Kconfig: use 'ARCH_MXC' for reset dispmix
  reset: imx8m: Correct clock name for dispmix driver
  reset: gpio-reset: add pinctrl comsuer header file
  reset: imx7: add the clkreq reset for imx8m
  dt-bindings: reset: imx7: add clkreq reset used by the l1ss on imx8m
  ...
2019-12-02 18:05:25 +08:00
f8ed5516d5 Merge branch 'regulator/next' into next
* regulator/next: (14 commits)
  MLK-22824-2: regulator: pca9450: add pca9450 regulator driver
  MLK-22824-1: mfd: pca9450: add pca9450 mfd driver
  LF-53: regulator: pf1550-regulator-rpmsg: fix ldo2 voltage changing failure
  MLK-13638-4 regulator: fixed: add system pm routines for pinctrl
  regulator: fixed: add off-on-delay
  ...
2019-12-02 18:05:24 +08:00
757600c147 Merge branch 'qe/next' into next
* qe/next: (6 commits)
  config/qe: add irq-qeic support.
  QE: remove PPCisms for QE
  irqchip/qeic: remove PPCisms for QEIC
  irqchip/qeic: merge qeic_of_init into qe_ic_init
  irqchip/qeic: merge qeic init code from platforms to a common function
  ...
2019-12-02 18:05:23 +08:00
2c04041962 Merge branch 'pxp/next' into next
* pxp/next:
  media: pxp device: fix kernel dump when run pxp_test
  media: v4l2: add pxp_v4l2 driver
  dma: pxp: porting pxp dma driver from imx_4.19.y
2019-12-02 18:05:22 +08:00
08dcfadc9a Merge branch 'pm/next' into next
* pm/next: (54 commits)
  drivers/soc/fsl: add EPU FSM configuration for deep sleep
  fsl_pmc: update device bindings
  soc: fsl: add RCPM driver
  Documentation: dt: binding: fsl: Add 'little-endian' and update Chassis define
  MLK-22992 firmware: imx: scu-pd: fix wu_num
  ...
2019-12-02 18:05:21 +08:00
433035eb79 Merge branch 'pinctrl/next' into next
* pinctrl/next: (18 commits)
  pinctrl: s32v234: Add FlexCAN pins to S32V234 driver
  dt-bindings: pinctrl: s32v234: Add defines for all pins
  dt-bindings: pinctrl: s32v234: Add macros for MSCR and config pairs
  pinctrl: s32v234: Remove s32v234_pins enum
  dt-bindings: pinctrl: s32v234: Add macros for MSCR/IMCR numbers
  ...
2019-12-02 18:05:20 +08:00
4402983b63 Merge branch 'phy/next' into next
* phy/next: (6 commits)
  phy: mixel-lvds-combo: Configure CO divider to meet fvco range requirement
  phy: Add Mixel LVDS combo PHY support
  dt-bindings: phy: Add DT binding for Mixel LVDS PHY(LVDS/MIPI DSI combo)
  phy: Add Mixel LVDS PHY support
  dt-bindings: phy: Add DT binding for Mixel LVDS PHY
  ...
2019-12-02 18:05:18 +08:00
b5f8879f2e Merge branch 'perf/next' into next
* perf/next:
  perf vendor events: add JSON metrics for imx8 DDR Perf
  tools: perf: metricgroup: add metricgroup for each PMU
2019-12-02 18:05:18 +08:00
b138c331cb Merge branch 'pcie/next' into next
* pcie/next: (40 commits)
  LF-128 PCI: imx: turn off the clocks and regulators when link is down
  PCI: imx: add the imx pcie ep verification solution
  misc: pci_endpoint_test: Add the layerscape PCIe GEN4 EP device support
  PCI: mobiveil: Add workaround for unsupported request error
  PCI: mobiveil: Add PCIe Gen4 EP driver for NXP Layerscape SoCs
  ...
2019-12-02 18:05:17 +08:00
89c380b1e8 net: tsn: fix headfile voliates the new rule
After commit
622445541b ("kbuild: detect missing "WITH Linux-syscall-note" for uapi headers")
the headfile must explicitly include "WITH Linux-syscall-note".

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:05:17 +08:00
6a49b2da83 net:tsn: netlink interface for APP layer to config TSN capability hardware ports
This patch provids netlink method to configure the TSN protocols hardwares.
TSN guaranteed packet transport with bounded low latency, low packet delay
variation, and low packet loss by hardware and software methods.

The three basic components of TSN are:

1. Time synchronization: This was implement by 8021AS which base on the
   IEEE1588 precision Time Protocol. This is configured by the other way
   in kernel.
   8021AS not included in this patch.

2. Scheduling and traffic shaping and per-stream filter policing:
   This patch support Qbv/Qci/Qbu/8021CB/Qav etc.

3. Selection of communication paths:
   This patch not support the pure software only TSN protocols(like Qcc)
   but hardware related configuration.

TSN Protocols supports by this patch: Qbv/Qci/Qbu/Credit-base Shaper(Qav).
This patch verified on NXP ls1028ardb board.

Signed-off-by: Po Liu <Po.Liu@nxp.com>
2019-12-02 18:05:16 +08:00
257d9bc9b9 drivers: net: phy: aquantia: enable USX AN for USXGMII protocol
Depending on FW defaults USX AN in AQR PHY must be explicitly enabled when
using USXGMII.  Enable it based on interface type.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
2019-12-02 18:05:16 +08:00
2e16cadb54 drivers: net: phy: aquantia: fix system side protocol misconfiguration
Do not set up protocols for speeds that are not supported by FW.  Enabling
these protocols leads to link issues on system side.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
2019-12-02 18:05:15 +08:00
55de3101dc drivers: net: phy: aquantia: enable AQR112 and AQR412
Adds support for AQR112 and AQR412 which is mostly based on existing code
with the addition of code configuring the protocol on system side.
This allows changing the system side protocol without having to deploy a
different firmware on the PHY.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
2019-12-02 18:05:15 +08:00
6a2c04f224 net: phy: at803x: add vddio-1v8 and eee disable support
Add new property "at803x,vddio-1p8v" and "at803x,eee-disabled"
support.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Aisheng: fix small merge conflict ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:05:14 +08:00
8989469663 net/phy: Inphi IN112525_s03 retimer updates
The retimer doesn't get probed in linux due to the fact that it's a
non-standard clause-45 device. Hardcoding the phyid in device-tree
and adding custom routines for registry read/write operations
solves the issue.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
2019-12-02 18:05:14 +08:00
46bb3930ed net/phy: Inphi IN112525_s03 retimer support
Software controller for IN112525_s03 retimer

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
2019-12-02 18:05:14 +08:00
4005d43ba8 at803x: Address packet drops at low traffic rate due to SmartEEE feature
* According to the AR8035 datasheet, smartEEE mode (active by default)
  makes the PHY enters sleep after a configurable idle time. It does
  this autonomously, without LPI (Low Power Idle) signals coming from MAC.
* Tested with ping (default of 1 second interval) over back-to-back
  RGMII between 2 boards having AR8035 at both ends:
    - Without patch:
  225 packets transmitted, 145 received, 35% packet loss, time 229334ms
    - With patch:
  144 packets transmitted, 144 received, 0% packet loss, time 146378ms

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:05:13 +08:00
6355c6bc23 phy: Add 2.5G SGMII interface mode
Add 2.5G SGMII interface mode(PHY_INTERFACE_MODE_2500SGMII)
in existing phy_interface list

Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
2019-12-02 18:05:13 +08:00
fc6df7a7e1 net: phy: add 10G fixed-link support
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:05:12 +08:00
3dc30dfb3d staging: fsl_ppfe/eth: Disable termination of CRC fwd.
LS1012A MAC PCS block has an erratum that is seen with specific PHY AR803x.
The issue is triggered by the (spec-compliant) operation of the AR803x PHY
on the LS1012A-FRWY board.Due to this, good FCS packet is reported as error
packet by MAC, so for these error packets FCS should be validated and
discard only real error packets in PFE Rx packet path.

Signed-off-by: Nagesh Koneti <koneti.nagesh@nxp.com>
Signed-off-by: Nagesh Koneti <“koneti.nagesh@nxp.com”>
2019-12-02 18:05:12 +08:00
d736dfa7d0 staging: fsl_ppfe/eth: add pfe support to Kconfig and Makefile
Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
[ Aisheng: fix minor conflict due to removed VBOXSF_FS ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:05:11 +08:00
69b54742b6 staging: fsl_ppfe/eth: prefix header search paths with $(srctree)/
Currently, the rules for configuring search paths in Kbuild have
changed: https://lkml.org/lkml/2019/5/13/37

This will lead the below error:

fatal error: pfe/pfe.h: No such file or directory

Fix it by adding $(srctree)/ prefix to the search paths.

Signed-off-by: Ting Liu <ting.liu@nxp.com>
2019-12-02 18:05:10 +08:00
0594c1fff6 staging: fsl_ppfe/eth: remove 'fallback' argument from dev->ndo_select_queue()
To be consistent with upstream API change.

Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-12-02 18:05:09 +08:00
658db0ba79 staging: fsl_ppfe/eth: use memremap() to map RAM area used by PFE
RAM area used by PFE should be mapped using memremap() instead of
directly traslating physical addr to virtual. This will ensure proper
checks are done before the area is used.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:09 +08:00
24d69cea65 staging: fsl_ppfe/eth: use generic soc_device infra instead of fsl_guts_get_svr()
Commit ("soc: fsl: guts: make fsl_guts_get_svr() static") has
made fsl_guts_get_svr() static and hence use generic soc_device
infrastructure to check SoC revision.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:08 +08:00
54fe1e0dd6 staging: fsl_ppfe/eth: adapt to link mode based phydev changes
Setting link mode bits have changed with the integration of
commit (3c1bcc8 net: ethernet: Convert phydev advertize and
supported from u32 to link mode). Adapt to the new method of
setting and clearing the link mode bits.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:08 +08:00
9688f347dd staging: fsl_ppfe/eth: separate mdio init from mac init
- separate mdio initialization from mac initialization
- Define pfe_mdio_priv_s structure to hold mii_bus structure and other
  related data.
- Modify functions to work with the separted mdio init model.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:07 +08:00
e6092a5f07 staging: fsl_ppfe/eth: remove unused code
- remove gemac-bus-id related code that is unused.
- remove unused prototype gemac_set_mdc_div.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:07 +08:00
5f95d60da3 net: fsl_ppfe: update dts properties for phy
Use commonly used phy-handle property and mdio subnode to handle
phy properties.

Deprecate bindings fsl,gemac-phy-id & fsl,pfe-phy-if-flags.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:07 +08:00
a498d8f7a0 staging: fsl_ppfe/eth: support single interface initialization
- arrange members of struct mii_bus in sequence matching phy.h
- if mdio node is defined, use of_mdiobus_register to register
  child nodes (phy devices) available on the mdio bus.
- remove of_phy_register_fixed_link from pfe_phy_init as it is being
  handled in pfe_get_gemac_if_properties
- remove mdio enabled check
- skip phy init, if no PHY or fixed-link

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:07 +08:00
f0645177f9 staging: fsl_ppfe/eth: reorganize platform phy parameters
- Use "phy-handle" and of_* functions to get phy node and fixed-link
parameters

- Reorganize phy parameters and initialize them only if phy-handle
or fixed-link is defined in the dtb.

- correct typo pfe_get_gemac_if_proprties to pfe_get_gemac_if_properties

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:06 +08:00
b44f7c508b staging: fsl_ppfe/eth: misc clean up
- remove redundant hwfeature init
- remove unused vars from ls1012a_eth_platform_data
- To handle ls1012a errata_a010897, PPFE driver requires GUTS driver
to be compiled in. Select FSL_GUTS when PPFE driver is compiled.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:06 +08:00
1783b0624b staging: fsl_ppfe/eth: Update to use SPDX identifiers
Replace license text with corresponding SPDX identifiers and update the
format of existing SPDX identifiers to follow the new guideline
Documentation/process/license-rules.rst.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:05 +08:00
1785151bb0 staging: fsl_ppfe: performance tuning for user space
interrupt coalescing of 100 usec is added.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
2019-12-02 18:05:05 +08:00
d2009ed1f0 staging: fsl_ppfe: enable hif event from userspace
HIF interrupts are enabled using ioctl from user space,
and epoll wait from user space wakes up when there is an HIF
interrupt.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
2019-12-02 18:05:05 +08:00
62d4c212c0 staging: fsl_ppfe: add support for a char dev for link status
Read and IOCTL support is added. Application would need to open,
read/ioctl the /dev/pfe_us_cdev device.
select is pending as it requires a wait_queue.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:04 +08:00
fab313f6f0 staging: fsl_ppfe/eth: add fixed-link support
In cases where MAC is not connected to a normal MDIO-managed PHY
device, and instead to a switch, it is configured as a "fixed-link".
Code to handle this scenario is added here.

phy_node in the dtb is checked to identify a fixed-link.
On identification of a fixed-link, it is registered and connected.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:03 +08:00
d75972b2ca staging: fsl_ppfe/eth: resolve indentation warning
Resolve the following indentation warning:

drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c:
In function ‘pfe_get_gemac_if_proprties’:
drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c:96:2:
warning: this ‘else’ clause does not guard...
[-Wmisleading-indentation]
  else
  ^~~~
drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c:98:3:
note: ...this statement, but the latter is misleadingly indented as
if it were guarded by the ‘else’
   pdata->ls1012a_eth_pdata[port].mdio_muxval = phy_id;
   ^~~~~

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:02 +08:00
dbff4fe66a staging: fsl_ppfe/eth: replace magic numbers
Replace magic numbers and some cosmetic changes.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:02 +08:00
3d59ba5818 staging: fsl_ppfe/eth: handle ls1012a errata_a010897
On LS1012A rev 1.0, Jumbo frames are not supported as it causes
the PFE controller to hang. A reset of the entire chip is required
to resume normal operation.

To handle this errata, frames with length > 1900 are truncated for
rev 1.0 of LS1012A.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:02 +08:00
3f288e369a staging: fsl_ppfe/eth: disable CRC removal
Disable CRC removal from the packet, so that packets are forwarded
as is to Linux.
CRC configuration in MAC will be reflected in the packet received
to Linux.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:01 +08:00
b9d5f651e6 staging: fsl_ppfe/eth: remove jumbo frame enable from gemac init
MAC Receive Control Register was configured to allow jumbo frames.
This is removed as jumbo frames can be supported anytime by changing
mtu which will in turn modify MAX_FL field of MAC RCR.
Jumbo frames caused pfe to hang on LS1012A rev 1.0 Silicon due to
erratum A-010897.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:01 +08:00
3b7a66dc81 staging: fsl_ppfe/eth: define pfe ndo_change_mtu function
Define ndo_change_mtu function for pfe. This sets the max Rx frame
length to the new mtu.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:05:00 +08:00
4f617ff735 staging: fsl_ppfe/eth: use mask for rx max frame len
Define and use PFE_RCR_MAX_FL_MASK to properly set Rx max frame
length of MAC Receive Control Register.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:59 +08:00
5bf4094441 staging: fsl_ppfe/eth: reorganize pfe_netdev_ops
Reorganize members of struct pfe_netdev_ops to match with the order
of members in struct net_device_ops defined in include/linux/netdevice.h

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:59 +08:00
8ea7cbc859 staging: fsl_ppfe/eth: HW parse results for DPDK
HW Parse results are included in the packet headroom.
Length and Offset calculation now accommodates parse info size.

Signed-off-by: Archana Madhavan <archana.madhavan@nxp.com>
2019-12-02 18:04:58 +08:00
b0c6cb4781 staging: fsl_ppfe/eth: unregister netdev after pfe_phy_exit
rmmod pfe.ko throws below warning:

kernfs: can not remove 'phydev', no directory
------------[ cut here ]------------
WARNING: CPU: 0 PID: 2230 at fs/kernfs/dir.c:1481
kernfs_remove_by_name_ns+0x90/0xa0

This is caused when the unregistered netdev structure is accessed to
disconnect phy.

Resolve the issue by unregistering netdev after disconnecting phy.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:58 +08:00
5c20cca334 staging: fsl_ppfe/eth: support for userspace networking
This patch adds the userspace mode support to fsl_ppfe network driver.
In the new mode, basic hardware initialization is performed in kernel, while
the datapath and HIF handling is the responsibility of the userspace.

The new command line parameter is added to initialize the ppfe module
in userspace mode. By default the module remains in kernelspace networking
mode.
To enable userspace mode, use "insmod pfe.ko us=1"

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
2019-12-02 18:04:58 +08:00
11c4548e49 staging: fsl_ppfe/eth: calculate PFE_PKT_SIZE with SKB_DATA_ALIGN
pfe packet size was calculated without considering skb data alignment
and this resulted in jumbo frames crashing kernel when the
cacheline size increased from 64 to 128 bytes with
commit 9730348075 ("arm64: Increase the max granular size").

Modify pfe packet size caclulation to include skb data alignment of
sizeof(struct skb_shared_info).

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:57 +08:00
1f13ccbbf0 staging: fsl_ppfe/eth: Disable autonegotiation for 2.5G SGMII
PCS initialization sequence for 2.5G SGMII interface governs
auto negotiation to be in disabled mode

Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
2019-12-02 18:04:57 +08:00
e947a43e6e staging: fsl_ppfe/eth: Enable PFE in clause 45 mode
when we opearate in clause 45 mode, we need to call
the function get_phy_device() with its 3rd argument as
"true" and then the resultant phy device needs to be
register with phy layer via phy_device_register()

Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
2019-12-02 18:04:57 +08:00
d923279b92 staging: fsl_ppfe/eth: Avoid packet drop at TMU queues
Added flow control between TMU queues and PFE Linux driver,
based on TMU credits availability.
Added tx_qos module parameter to control this behavior.
Use queue-0 as default queue to transmit packets.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Akhila Kavi <akhila.kavi@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:56 +08:00
4dd92879c0 staging: fsl_ppfe/eth: add function to update tmu credits
__hif_lib_update_credit function is used to update the tmu credits.
If tx_qos is set, tmu credit is updated based on the number of packets
transmitted by tmu.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:56 +08:00
eff1d7fc71 staging: fsl_ppfe/eth: Make phy_ethtool_ksettings_get return void
Make return value void since function never return meaningful value

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:55 +08:00
6b7fa1fdb5 staging: fsl_ppfe/eth: fix read/write/ack idx issue
While fixing checkpatch errors some of the index increments
were commented out. They are enabled.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:55 +08:00
782ffeea4c staging: fsl_ppfe/eth: remove unused functions
Remove unused functions hif_xmit_pkt & hif_lib_xmit_pkt.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-12-02 18:04:54 +08:00
2162c084f7 staging: fsl_ppfe/eth: fix RGMII tx delay issue
Recently logic to enable RGMII tx delay was changed by
below patch.

https://patchwork.kernel.org/patch/9447581/

Based on the patch, appropriate change is made in PFE driver.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:54 +08:00
520f8c5cf5 staging: fsl_ppfe/eth: introduce pfe driver
This patch introduces Linux support for NXP's LS1012A Packet
Forwarding Engine (pfe_eth). LS1012A uses hardware packet forwarding
engine to provide high performance Ethernet interfaces. The device
includes two Ethernet ports.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:53 +08:00
23bf09a6eb staging: fsl_ppfe/eth: header files for pfe driver
This patch has all pfe header files.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:53 +08:00
e424f891ed net: fsl_ppfe: dts binding for ppfe
Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
2019-12-02 18:04:53 +08:00
1082a3ef9e net: dsa: felix: Add PCS operations for PHYLINK
This removes the bootloader dependency for SGMII PCS pre-configuration,
as well as adds support for monitoring the in-band SGMII AN between the
PCS and the system-side link partner (PHY or other MAC).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:52 +08:00
423c8b0400 net: mscc: ocelot: introduce more focused PCS ops for PHYLINK
The reason for doing this is that the 2 mainline Ocelot switches so far,
VSC7514 and VSC9959, have radically different SoC/SerDes integration. So
although the PHYLINK callbacks are common, the implementations will
actually lie in device-specific function pointers.

Also, there was a duplicated and unused function pointer for pcs_init in
struct ocelot, remove that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:52 +08:00
e51cc023c3 net: mscc: ocelot: convert to PHYLINK
This patch reworks ocelot_board.c (aka the MIPS on the VSC7514) to
register a PHYLINK instance for each port. The registration code is
local to the VSC7514, but the PHYLINK callback implementation is common
so that the Felix DSA front-end can use it as well (but DSA does its own
registration).

Now Felix can use native PHYLINK callbacks instead of the PHYLIB
adaptation layer in DSA, which had issues supporting fixed-link slave
ports (no struct phy_device to pass to the adjust_link callback), as
well as fixed-link CPU port at 2.5Gbps.

The old code from ocelot_port_enable and ocelot_port_disable has been
moved into ocelot_phylink_mac_link_up and ocelot_phylink_mac_link_down.

The PHY connect operation has been moved from ocelot_port_open to
mscc_ocelot_probe in ocelot_board.c.

The phy_set_mode_ext() call for the SerDes PHY has also been moved into
mscc_ocelot_probe from ocelot_port_open, and since that was the only
reason why a reference to it was kept in ocelot_port_private, that
reference was removed.

Again, the usage of phy_interface_t phy_mode is now local to
mscc_ocelot_probe only, after moving the PHY connect operation.
So it was also removed from ocelot_port_private.
*Maybe* in the future, it can be added back to the common struct
ocelot_port, with the purpose of validating mismatches between
state->phy_interface and ocelot_port->phy_mode in PHYLINK callbacks.
But at the moment that is not critical, since other DSA drivers are not
doing that either. No SFP+ modules are in use with Felix/Ocelot yet, to
my knowledge.

In-band AN is not yet supported, due to the fact that this is a mostly
mechanical patch for the moment. The mac_an_restart PHYLINK operation
needs to be implemented, as well as mac_link_state. Both are SerDes
specific, and Felix does not have its PCS configured yet (it works just
by virtue of U-Boot initialization at the moment).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:52 +08:00
f3ebad1269 net: mscc: ocelot: do not force Felix MACs at lower speeds than gigabit
In the LS1028A, the VSC9959 switch was integrated with an NXP PCS which
performs SGMII AN and rate adaptation autonomously. The MAC does not
need to know about this, and forcing the MAC speed to something else,
when connected to a 10/100 link partner, actually breaks the GMII
internal link between the MAC and the PCS.

Add a quirk system in the ocelot driver, and a first quirk called "PCS
performs rate adaptation", to distinguish the VSC7514 from the VSC9959
regarding this behavior.

Signed-off-by: Catalin Horghidan <catalin.horghidan@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:51 +08:00
9dc338323f net: mscc: ocelot: unregister the PTP clock on deinit
Currently a switch driver deinit frees the regmaps, but the PTP clock is
still out there, available to user space via /dev/ptpN. Any PTP
operation is a ticking time bomb, since it will attempt to use the freed
regmaps and thus trigger kernel panics:

[    4.291746] fsl_enetc 0000:00:00.2 eth1: error -22 setting up slave phy
[    4.291871] mscc_felix 0000:00:00.5: Failed to register DSA switch: -22
[    4.308666] mscc_felix: probe of 0000:00:00.5 failed with error -22
[    6.358270] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000088
[    6.367090] Mem abort info:
[    6.369888]   ESR = 0x96000046
[    6.369891]   EC = 0x25: DABT (current EL), IL = 32 bits
[    6.369892]   SET = 0, FnV = 0
[    6.369894]   EA = 0, S1PTW = 0
[    6.369895] Data abort info:
[    6.369897]   ISV = 0, ISS = 0x00000046
[    6.369899]   CM = 0, WnR = 1
[    6.369902] user pgtable: 4k pages, 48-bit VAs, pgdp=00000020d58c7000
[    6.369904] [0000000000000088] pgd=00000020d5912003, pud=00000020d5915003, pmd=0000000000000000
[    6.369914] Internal error: Oops: 96000046 [#1] PREEMPT SMP
[    6.420443] Modules linked in:
[    6.423506] CPU: 1 PID: 262 Comm: phc_ctl Not tainted 5.4.0-03625-gb7b2a5dadd7f #204
[    6.431273] Hardware name: LS1028A RDB Board (DT)
[    6.435989] pstate: 40000085 (nZcv daIf -PAN -UAO)
[    6.440802] pc : css_release+0x24/0x58
[    6.444561] lr : regmap_read+0x40/0x78
[    6.448316] sp : ffff800010513cc0
[    6.451636] x29: ffff800010513cc0 x28: ffff002055873040
[    6.456963] x27: 0000000000000000 x26: 0000000000000000
[    6.462289] x25: 0000000000000000 x24: 0000000000000000
[    6.467617] x23: 0000000000000000 x22: 0000000000000080
[    6.472944] x21: ffff800010513d44 x20: 0000000000000080
[    6.478270] x19: 0000000000000000 x18: 0000000000000000
[    6.483596] x17: 0000000000000000 x16: 0000000000000000
[    6.488921] x15: 0000000000000000 x14: 0000000000000000
[    6.494247] x13: 0000000000000000 x12: 0000000000000000
[    6.499573] x11: 0000000000000000 x10: 0000000000000000
[    6.504899] x9 : 0000000000000000 x8 : 0000000000000000
[    6.510225] x7 : 0000000000000000 x6 : ffff800010513cf0
[    6.515550] x5 : 0000000000000000 x4 : 0000000fffffffe0
[    6.520876] x3 : 0000000000000088 x2 : ffff800010513d44
[    6.526202] x1 : ffffcada668ea000 x0 : ffffcada64d8b0c0
[    6.531528] Call trace:
[    6.533977]  css_release+0x24/0x58
[    6.537385]  regmap_read+0x40/0x78
[    6.540795]  __ocelot_read_ix+0x6c/0xa0
[    6.544641]  ocelot_ptp_gettime64+0x4c/0x110
[    6.548921]  ptp_clock_gettime+0x4c/0x58
[    6.552853]  pc_clock_gettime+0x5c/0xa8
[    6.556699]  __arm64_sys_clock_gettime+0x68/0xc8
[    6.561331]  el0_svc_common.constprop.2+0x7c/0x178
[    6.566133]  el0_svc_handler+0x34/0xa0
[    6.569891]  el0_sync_handler+0x114/0x1d0
[    6.573908]  el0_sync+0x140/0x180
[    6.577232] Code: d503201f b00119a1 91022263 b27b7be4 (f9004663)
[    6.583349] ---[ end trace d196b9b14cdae2da ]---
[    6.587977] Kernel panic - not syncing: Fatal exception
[    6.593216] SMP: stopping secondary CPUs
[    6.597151] Kernel Offset: 0x4ada54400000 from 0xffff800010000000
[    6.603261] PHYS_OFFSET: 0xffffd0a7c0000000
[    6.607454] CPU features: 0x10002,21806008
[    6.611558] Memory Limit: none

And now that ocelot->ptp_clock is checked at exit, prevent a potential
error where ptp_clock_register returned a pointer-encoded error, which
we are keeping in the ocelot private data structure. So now,
ocelot->ptp_clock is now either NULL or a valid pointer.

Fixes: 4e3b0468e6 ("net: mscc: PTP Hardware Clock (PHC) support")
Cc: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:51 +08:00
3f643e4af0 enetc: Set MDIO_CFG_HOLD to the recommended value of 2
This increases the MDIO hold time to 5 enet_clk cycles from the previous
value of 0. This is actually the out-of-reset value, that the driver was
previously overwriting with 0. Zero worked for the external MDIO, but
breaks communication with the internal MDIO buses on which the PCS of
ENETC SI's and Felix switch are found.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:51 +08:00
f8d80c003b enetc: export enetc_mdio definitionns to include/linux/fsl
The Felix DSA switch has an internal MDIO bus that has the same register
map as the ENETC one, so the accessors can be reused.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:50 +08:00
57fe15baac net: phylink: call mac_an_restart for SGMII/QSGMII inband interfaces too
It doesn't quite make sense why restarting the AN process should be
unique to 802.3z (1000Base-X) modes. It is valid to put an SGMII PCS in
in-band AN mode, therefore also make PHYLINK re-trigger an
auto-negotiation if needed.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:50 +08:00
fe7fd9f6af net: phylink: make QSGMII a valid PHY mode for in-band AN
QSGMII is just SGMII clocked at a higher frequency (5 Gbaud vs 1.25
Gbaud). Logically it is just 4 SGMII interfaces multiplexed onto the
same physical lanes. Each MAC PCS has its own in-band AN process with
the system side of the QSGMII PHY, which is identical to the regular
SGMII AN process. So allow QSGMII as a valid in-band AN mode.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:49 +08:00
de81e3c1cc mii: Add helpers for parsing SGMII auto-negotiation
Typically a MAC PCS auto-configures itself after it receives the
negotiated link settings from the PHY, but some MAC devices are more
special and need manual manipulation of the SGMII AN result.

Therefore, add the bit definitions for the SGMII registers 4 and 5
(local device ability, link partner ability), as well as a link_mode
conversion helper that can be used to feed the AN results into
phy_resolve_aneg_linkmode.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:48 +08:00
bb849431a9 net: dsa: ocelot: alloc memory for dsa switch instance
The dsa switch instance hasn't alloc memory for switch ports in felix
initialization driver, which will cause NULL pointer issue. Using
dsa_switch_alloc to alloc memory for dsa switch instance.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
2019-12-02 18:04:48 +08:00
eca0b86bb0 net: dsa: ocelot: add tsn support for felix switch
Support tsn capabilities in DSA felix switch driver. This felix tsn
driver is using tsn configuration of ocelot, and registered on each
switch port through DSA port setup.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
2019-12-02 18:04:48 +08:00
b5c05e3404 net: mscc: ocelot: tsn configuration support
Support TSN configuration for ocelot switch. The TSN configuration
fucntions are based on tsn netlink interface, it can support Qbv,
Qbu, Qci, 802.1CB, and Qav configuration now.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
2019-12-02 18:04:47 +08:00
e867508ce9 net: mscc: ocelot: use skb queue instead of skbs list
Convert to use skb queue instead of the list of skbs.
The skb queue could provide protection with lock.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:47 +08:00
8dcd7db3b0 net: mscc: ocelot: avoid incorrect consuming in skbs list
Break the matching loop when find the matching skb for TX timestamp.
This is to avoid consuming more skbs incorrectly. The timestamp ID
is from 0 to 3 while the FIFO could support 128 timestamps at most.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:46 +08:00
e0c76105a0 net: dsa: ocelot: add hardware timestamping support for Felix
This patch is to reuse ocelot functions as possible to enable PTP
clock and to support hardware timestamping on Felix.
On TX path, timestamping works on packet which requires timestamp.
The injection header will be configured accordingly, and skb clone
requires timestamp will be added into a list. The TX timestamp
is final handled in threaded interrupt handler when PTP timestamp
FIFO is ready.
On RX path, timestamping is always working. The RX timestamp could
be got from extraction header.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:46 +08:00
1dfdeafe3d net: dsa: ocelot: define PTP registers for felix_vsc9959
This patch is to define PTP registers for felix_vsc9959.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:46 +08:00
7b28cb7fae net: mscc: ocelot: convert to use ocelot_port_add_txtstamp_skb()
Convert to use ocelot_port_add_txtstamp_skb() for adding skbs which
require TX timestamp into list. Export it so that DSA Felix driver
could reuse it too.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:45 +08:00
b933c347ac net: mscc: ocelot: convert to use ocelot_get_txtstamp()
The method getting TX timestamp by reading timestamp FIFO and
matching skbs list is common for DSA Felix driver too.
So move code out of ocelot_board.c, convert to use
ocelot_get_txtstamp() function and export it.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:45 +08:00
04c967e8c4 net: mscc: ocelot: export ocelot_hwstamp_get/set functions
Export ocelot_hwstamp_get/set functions so that DSA driver
is able to reuse them.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:45 +08:00
b1b7b24700 net: dsa: felix: Fix CPU port assignment when not last port
On the NXP LS1028A, there are 2 Ethernet links between the Felix switch
and the ENETC:
- eno2 <-> swp4, at 2.5G
- eno3 <-> swp5, at 1G

Only one of the above Ethernet port pairs can act as a DSA link for
tagging.

When adding initial support for the driver, it was tested only on the 1G
eno3 <-> swp5 interface, due to the necessity of using PHYLIB initially
(which treats fixed-link interfaces as emulated C22 PHYs, so it doesn't
support fixed-link speeds higher than 1G).

After making PHYLINK work, it appears that swp4 still can't act as CPU
port. So it looks like ocelot_set_cpu_port was being called for swp4,
but then it was called again for swp5, overwriting the CPU port assigned
in the DT.

It appears that when you call dsa_upstream_port for a port that is not
defined in the device tree (such as swp5 when using swp4 as CPU port),
its dp->cpu_dp pointer is not initialized by dsa_tree_setup_default_cpu,
and this trips up the following condition in dsa_upstream_port:

	if (!cpu_dp)
		return port;

So the moral of the story is: don't call dsa_upstream_port for a port
that is not defined in the device tree, and therefore its dsa_port
structure is not completely initialized (ds->num_ports is still 6).

Fixes: 5605194877 ("net: dsa: ocelot: add driver for Felix switch family")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:44 +08:00
7fc603c551 net: dsa: ocelot: add driver for Felix switch family
This supports an Ethernet switching core from Vitesse / Microsemi /
Microchip (VSC9959) which is part of the Ocelot family (a brand name),
and whose code name is Felix. The switch can be (and is) integrated on
different SoCs as a PCIe endpoint device.

The functionality is provided by the core of the Ocelot switch driver
(drivers/net/ethernet/mscc). In this regard, the current driver is an
instance of Microsemi's Ocelot core driver, with a DSA front-end. It
inherits its name from VSC9959's code name, to distinguish itself from
the switchdev ocelot driver.

The patch adds the logic for probing a PCI device and defines the
register map for the VSC9959 switch core, since it has some differences
in register addresses and bitfield mappings compared to the other Ocelot
switches (VSC7511, VSC7512, VSC7513, VSC7514).

The Felix driver declares the register map as part of the "instance
table". Currently the VSC9959 inside NXP LS1028A is the only instance,
but presumably it can support other switches in the Ocelot family, when
used in DSA mode (Linux running on the external CPU, and not on the
embedded MIPS).

In a few cases, some h/w operations have to be done differently on
VSC9959 due to missing bitfields.  This is the case for the switch core
reset and init.  Because for this operation Ocelot uses some bits that
are not present on Felix, the latter has to use a register from the
global registers block (GCB) instead.

Although it is a PCI driver, it relies on DT bindings for compatibility
with DSA (CPU port link, PHY library). It does not have any custom
device tree bindings, since we would like to minimize its dependency on
device tree though.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:44 +08:00
ea238a2d60 net: dsa: ocelot: add tagger for Ocelot/Felix switches
While it is entirely possible that this tagger format is in fact more
generic than just these 2 switch families, I don't have that knowledge.
The Seville switch in NXP T1040 has a similar frame format, but there
are enough differences (e.g. DEST field starts at bit 57 instead of 56)
that calling this file tag_vitesse.c is a bit of a stretch at the
moment. The frame format has been listed in a comment so that people who
add support for further Vitesse switches can rework this tagger while
keeping compatibility with Felix.

The "ocelot" name was chosen instead of "felix" because even the Ocelot
switch can act as a DSA device when it is used in NPI mode, and the Felix
tagger format is almost identical. Currently it is only used for the
Felix switch embedded in the NXP LS1028A chip.

The ABI for this tagger should be considered "not stable" at the moment.
The DSA tag is always placed before the Ethernet header and therefore,
we are using the long prefix for RX tags to avoid putting the DSA master
port in promiscuous mode. Once there will be an API in DSA for drivers
to request DSA masters to be in promiscuous mode unconditionally, we
will switch to the "no prefix" extraction frame header, which will save
16 padding bytes for each RX frame.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:43 +08:00
4c01182261 net: mscc: ocelot: publish ocelot_sys.h to include/soc/mscc
The Felix DSA driver needs to write to SYS_RAM_INIT_RAM_INIT for its own
chip initialization process.

Also update the MAINTAINERS file such that the headers exported by the
ocelot driver are under the same maintainers' umbrella as the driver
itself.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:43 +08:00
bf2cf3be1f net: mscc: ocelot: publish structure definitions to include/soc/mscc/ocelot.h
We will be registering another switch driver based on ocelot, which
lives under drivers/net/dsa.

Make sure the Felix DSA front-end has the necessary abstractions to
implement a new Ocelot driver instantiation. This includes the function
prototypes for implementing DSA callbacks.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:43 +08:00
9701378ee1 net: mscc: ocelot: separate the implementation of switch reset
The Felix switch has a different reset procedure, so a function pointer
needs to be created and added to the ocelot_ops structure.

The reset procedure has been moved into ocelot_init.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:42 +08:00
0f288c4bfe net: mscc: ocelot: adjust MTU on the CPU port in NPI mode
When using the NPI port, the DSA tag is passed through Ethernet, so the
switch's MAC needs to accept it as it comes from the DSA master. Increase
the MTU on the external CPU port to account for the length of the
injection header.

Without this patch, MTU-sized frames are dropped by the switch's CPU
port on xmit, which is especially obvious in TCP sessions.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:42 +08:00
f3c5acb6d2 net: mscc: ocelot: export a constant for the tag length in bytes
This constant will be used in a future patch to increase the MTU on NPI
ports, and will also be used in the tagger driver for Felix.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:42 +08:00
0e09850893 net: mscc: ocelot: create a helper for changing the port MTU
Since in an NPI/DSA setup, not all ports will have the same MTU, we need
to make sure the watermarks for pause frames and/or tail dropping logic
that existed in the driver is still coherent for the new MTU values.

We need to do this because the NPI (aka external CPU) port needs an
increased MTU for the DSA tag. This will be done in a future patch.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:41 +08:00
c80fc13366 net: mscc: ocelot: move invariant configs out of adjust_link
It doesn't make sense to rewrite all these registers every time the PHY
library notifies us about a link state change.

In a future patch we will customize the MTU for the CPU port, and since
the MTU was previously configured from adjust_link, if we don't make
this change, its value would have got overridden.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:41 +08:00
c3d5754174 net: mscc: ocelot: filter out ocelot SoC specific PCS config from common path
The adjust_link routine should be generic enough to be (re)used by
any SoC that integrates a switch core compatible with the Ocelot
core switch driver.  Currently all configurations are generic except
for the PCS settings that are SoC specific.  Move these out to the
Ocelot SoC/board instance.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:41 +08:00
bccd287b67 net: mscc: ocelot: move resource ioremap and regmap init to common code
Let's make this ioremap and regmap init code common.  It should not
be platform dependent as it should be usable by PCI devices too.
Use better names where necessary to avoid clashes.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:40 +08:00
e092cf28af net: mscc: ocelot: don't hardcode the number of the CPU port
VSC7514 is a 10-port switch with 2 extra "CPU ports" (targets in the
queuing subsystem for terminating traffic locally).

There are 2 issues with hardcoding the CPU port as #10:
- It is not clear which snippets of the code are configuring something
  for one of the CPU ports, and which snippets are just doing something
  related to the number of physical ports.
- Actually any physical port can act as a CPU port connected to an
  external CPU (in addition to the local CPU). This is called NPI mode
  (Node Processor Interface) and is the way that the 6-port VSC9959
  (Felix) switch is integrated inside NXP LS1028A (the "local management
  CPU" functionality is not used there).

This patch makes it clear that the ocelot_bridge_stp_state_set function
operates on the CPU port (by making it an implicit member of the
bridging domain), and at the same time adds logic for the NPI port (aka
a physical port) to play the role of a CPU port (it shouldn't be part of
bridge_fwd_mask, as it's not explicitly enslaved to a bridge).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:39 +08:00
5150a11226 net: mscc: ocelot: split assignment of the cpu port into a separate function
Now that the places that configure routing destinations for the CPU port
have been marked as such, allow callers to specify their own CPU port
that is different than ocelot->num_phys_ports. A user will be the Felix
DSA driver, where the CPU port is one of the physical ports (NPI mode).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:39 +08:00
a052a2a64b net: mscc: ocelot: refactor adjust_link into a netdev-independent function
This will be called from the Felix DSA frontend, which will work in
PHYLIB compatibility mode initially.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:39 +08:00
2608b67f94 net: mscc: ocelot: initialize list of multicast addresses in common code
This is just common path code that belongs to ocelot_init,
it has nothing to do with a specific SoC/board instance.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:38 +08:00
5b139ecc9d net: mscc: ocelot: separate the common implementation of ndo_open and ndo_stop
Allow these functions to be called from the .port_enable and
.port_disable callbacks of DSA.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:38 +08:00
b5b50c88fd net: mscc: ocelot: move port initialization into separate function
We need a function for the DSA front-end that does none of the
net_device registration, but initializes the hardware ports.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:37 +08:00
1bee5c6a59 net: mscc: ocelot: limit vlan ingress filtering to actual number of ports
The VSC7514 switch (Ocelot) is a 10-port device, while VSC9959 (Felix)
is 6-port. Therefore the VLAN filtering mask would be out of bounds when
calling for this new switch. Fix that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:37 +08:00
e6e9bfd95b net: mscc: ocelot: refactor ethtool callbacks
Convert them into an implementation that can be called from DSA as well.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:37 +08:00
9333f97050 net: mscc: ocelot: separate net_device related items out of ocelot_port
The ocelot and ocelot_port structures will be used by a new DSA driver,
so the ocelot_board.c file will have to allocate and work with a private
structure (ocelot_port_private), which embeds the generic struct
ocelot_port. This is because in DSA, at least one interface does not
have a net_device, and the DSA driver API does not interact with that
anyway.

The ocelot_port structure is equivalent to dsa_port, and ocelot to
dsa_switch. The members of ocelot_port which have an equivalent in
dsa_port (such as dp->vlan_filtering) have been moved to
ocelot_port_private.

We want to enforce the coding convention that "ocelot_port" refers to
the structure, and "port" refers to the integer index. One can retrieve
the structure at any time from ocelot->ports[port].

The patch is large but only contains variable renaming and mechanical
movement of fields from one structure to another.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:36 +08:00
856610d6e5 net: mscc: ocelot: refactor struct ocelot_port out of function prototypes
The ocelot_port structure has a net_device embedded in it, which makes
it unsuitable for leaving it in the driver implementation functions.

Leave ocelot_flower.c untouched. In that file, ocelot_port is used as an
interface to the tc shared blocks. That will be addressed in the next
patch.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:36 +08:00
8b53dbe93b net: mscc: ocelot: change prototypes of switchdev port attribute handlers
This is needed so that the Felix DSA front-end can call the Ocelot
implementations.

The implementation of the "mc_disabled" switchdev attribute has also
been simplified by using the read-modify-write macro instead of
open-coding that operation.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:36 +08:00
a0178d69be net: mscc: ocelot: change prototypes of hwtstamping ioctls
This is needed in order to present a simpler prototype to the DSA
front-end of ocelot.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:35 +08:00
64bfb05b74 net: mscc: ocelot: break out fdb operations into abstract implementations
To be able to implement a DSA front-end over ocelot_fdb_add,
ocelot_fdb_del, ocelot_fdb_dump, these need to have a simple function
prototype that is independent of struct net_device, netlink skb, etc.

So rename the ndo ops of the ocelot driver into
ocelot_port_fdb_{add,del,dump}, and have them all call the abstract
implementations. At the same time, refactor ocelot_port_fdb_do_dump into
a function whose prototype is compatible with dsa_fdb_dump_cb_t, so that
the do_dump implementations can live together and be called by the
ocelot_fdb_dump through a function pointer.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:35 +08:00
07d2859b5e net: mscc: ocelot: break apart vlan operations into ocelot_vlan_{add, del}
We need an implementation of these functions that is agnostic to the
higher layer (switchdev or dsa).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:34 +08:00
fb0633b400 net: mscc: ocelot: break apart ocelot_vlan_port_apply
This patch transforms the ocelot_vlan_port_apply function ("apply
what?") into 3 standalone functions:

- ocelot_port_vlan_filtering
- ocelot_port_set_native_vlan
- ocelot_port_set_pvid

These functions have a prototype that is better aligned to the DSA API.

The function also had some static initialization (TPID, drop frames with
multicast source MAC) which was not being changed from any place, so
that was just moved to ocelot_probe_port (one of the 6 callers of
ocelot_vlan_port_apply).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:34 +08:00
5fa2a4674e net: fec: Add initial s32v234 support
* Update Kconfig to also check for ARCH_S32
* Add compatible string and quirks for fsl,s32v234

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:33 +08:00
7e3881f610 net: fec: fix the typo for the property string "fsl,wakeup_irq"
Fix the typo for the property string "fsl,wakeup_irq".

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:33 +08:00
c399737215 net: fec: avoid imx_sc_misc_set_control() is called at atomic context
Avoid SCU interface like imx_sc_misc_set_control() is called at
atomic context.

Signed-off-by: Fugang Duan <B38611@freescale.com>
2019-12-02 18:04:32 +08:00
87e5154e27 MLK-11051 net: phy: mdio_bus: don't call .phy_suspendi() when netdev is NULL
In .mdio_bus_phy_may_suspend(), there check netdev is NULL to judge to set
phy to suspend status.

netdev is NULL has three cases:
- phy is not found
- phy is found, match to general phy driver
- phy is found, match to specifical phy driver

Case 1: phy is not found, cannot communicate by MDIO bus.
Case 2: phy is found:
        if phy dev driver probe/bind err, netdev is not __open__ status,
           mdio bus is unregistered.
        if phy is detached, phy had entered suspended status.
Case 3: phy is found, phy is detached, phy had entered suspended status.

So, in here, it shouldn't set phy to suspend by calling mdio bus.

In i.MX6UL evk/arm2 board, if down the ethx interface and do
suspend/resume, system will hang. Because after ethx down all clocks are
gated off, for general phy driver, unbind the phy device, for specifical
phy driver, no unbind the device, and the original driver call mdio bus to
set phy to suspend during system suspend, so system will hang since there
have mdio register access.
The patch can fix it.

Signed-off-by: Fugang Duan <B38611@freescale.com>
2019-12-02 18:04:32 +08:00
0a3d11ff6c net: fec: update scu ctrl name
The scu ctrl name is updated, so update driver accordingly

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:04:32 +08:00
5345bb1ed0 dt-bindings: fec: update the clocks and new properties
Update the required and optinal clocks, and add properties
for new features.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:31 +08:00
875d2d2988 MLK-20190-01 ptp: fec: add clock rate zero check
Add clock rate zero check to fixes coverity issue of "divide by 0".

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-12-02 18:04:31 +08:00
213a2c2e1f net: fec: force mii bus runtime pm suspend during device suspend
Force mii bus runtime pm suspend during dev suspend since
phydev state already is PHY_HALTED, and there has no mii bus
accessing during suspend stage.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:31 +08:00
72c5983e67 MLK-16782 net: fec: double check the mii interrupt status
Double check the mii interrupt status during mdio bus accessing
to avoid interrupt lost in timeout case.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:30 +08:00
15ddf8ee92 net: fec: change the default rx copybreak value to maximum
Set the default rx copybreak value to maximum that can improve
the performance when SMMU is enabled. User can change the copybreak
vaule in dynamically by ethtool.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:30 +08:00
9801f2e913 net: fec: reinit MAC0 MII bus to be used by MAC1 after resume back
i.MX6SX-AI board has two enet MACs (MAC0 and MAC1), they share MAC0 MII
bus. When PHY0 don't connect to enet MAC0, MAC0 mii bus probe phy0 failed,
and the net interface is set to unattach mode. During suspend resume test,
driver don't reinit MAC0 after resume back, so MII bus don't work that
causes MAC1 also cannot access PHY1. SO reinit MAC0 MII bus for MAC1 using.

Signed-off-by: Fugang Duan <B38611@freescale.com>
2019-12-02 18:04:29 +08:00
70f96bd563 net: fec: add stop mode support for imx8 platform
The current driver support stop mode by calling machine api.
The patch add dts support to set gpr register for stop request.

imx8mq enter stop/exit stop mode by setting GPR bit, which can
be accessed by A core.
imx8qm enter stop/exit stop mode by calling IMX_SC ipc APIs that
communicate with M core ipc service, and the M core set the related
GPR bit at last.

After magic pattern coming during system suspend status, system will
be waked up, and irq handler will be called, then registers access
cause system hang due to clocks are off. So disable wake up irq in
.suspend(), and enable it in .resume().

Signed-off-by: Fugang Duan <B38611@freescale.com>
2019-12-02 18:04:29 +08:00
8a7fe8f38b MLK-11285-02 net:fec: add enet AVB Ubuntu Gstreamer demo support
Support Gstreamer AVB demo support.

ring1 -> ClassA, ring2 -> ClassB, ring0 -> Best Effort

For QoS: ring1 > ring2 > ring0
For bandwidth reverse:
      50% bandwidth -> ClassA
      33% bandwidth -> ClassB
      17% bandwidth -> Best effort queue

In general, ClassA run audio, ClassB run video.
Since AVB demo use big bandwidth streaming, video cost more than
33Mbps bandwidth, and with Qos limitation: ClassA >= ClassB > Best effort,
so we have to change ring2 bandwidth equal to ring1 bandwidth (50%).
After validate on FPGA, AVB demo can work fine for audio and video.

Signed-off-by: Fugang Duan <B38611@freescale.com>
2019-12-02 18:04:29 +08:00
fa6960c0b5 net: fec: add MAC internal delayed clock feature support
i.MX8QM ENET IP version support timing specification that MAC
integrate clock delay in RGMII mode, the delayed TXC/RXC as an
alternative option to work well with various PHYs.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:27 +08:00
6842cc4c3b net: fec: add eee mode tx lpi support
The i.MX8MQ ENET version support IEEE802.3az eee mode, add
eee mode tx lpi enable to support ethtool interface.

usage:
1. set sleep and wake timer to 5ms:
ethtool --set-eee eth0 eee on tx-lpi on tx-timer 5000
2. check the eee mode:
~# ethtool --show-eee eth0
EEE Settings for eth0:
        EEE status: enabled - active
        Tx LPI: 5000 (us)
        Supported EEE link modes:  100baseT/Full
                                   1000baseT/Full
        Advertised EEE link modes:  100baseT/Full
                                    1000baseT/Full
        Link partner advertised EEE link modes:  100baseT/Full

Note: For realtime case and IEEE1588 ptp case, it should disable
EEE mode.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:27 +08:00
819700d6f7 net: fec: add imx8mq and imx8qm new versions support
The ENET of imx8mq and imx8qm are basically the same as imx6sx,
but they have new features support based on imx6sx, like:
- imx8mq: supports IEEE 802.3az EEE standard.
- imx8qm: supports RGMII mode delayed clock.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:26 +08:00
a43fb4e63c net: fec: Fix keeping busfreq high on probe defer
Add release_bus_freq on probe exit path.

This was exposed by commit 95ea0158b3fe ("net: fec: add defer probe for
of_get_mac_address")

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Fixes: fed31bc87f36 ("MLK-9786 net: fec: Add busfreq support to the driver")
2019-12-02 18:04:26 +08:00
77f76ace06 dt-bindings: doc: add new properties for of_get_mac_address from nvmem
Currently, of_get_mac_address supports NVMEM, some platforms
MAC address that read from NVMEM efuse requires to swap bytes
order, so add new property "nvmem_macaddr_swap" to specify the
behavior. If the MAC address is valid from NVMEM, add new property
"nvmem-mac-address" in ethernet node.

Update these two properties in the binding documentation.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Aisheng: update to yaml format ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:04:25 +08:00
ca906c76a1 of_net: add property "nvmem-mac-address" for of_get_mac_addr()
If MAC address read from nvmem cell and it is valid mac address,
.of_get_mac_addr_nvmem() add new property "nvmem-mac-address" in
ethernet node. Once user call .of_get_mac_address() to get MAC
address again, it can read valid MAC address from device tree in
directly.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:25 +08:00
1dcfba998f net: ethernet: add property "nvmem_macaddr_swap" to swap macaddr bytes order
ethernet controller driver call .of_get_mac_address() to get
the mac address from devictree tree, if these properties are
not present, then try to read from nvmem.

For example, read MAC address from nvmem:
of_get_mac_address()
	of_get_mac_addr_nvmem()
		nvmem_get_mac_address()

i.MX6x/7D/8MQ/8MM platforms ethernet MAC address read from
nvmem ocotp eFuses, but it requires to swap the six bytes
order.

The patch add optional property "nvmem_macaddr_swap" to swap
macaddr bytes order.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:24 +08:00
da0c265c47 net: fec: add defer probe for of_get_mac_address
If MAC address read from nvmem efuse by calling .of_get_mac_address(),
but nvmem efuse is registerred later than the driver, then it
return -EPROBE_DEFER value. So modify the driver to support
defer probe when read MAC address from nvmem efuse.

Updates for v2:
avoid memory leak that the queues allocated by fec_enet_alloc_queue().

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:24 +08:00
4c26af069e net: fec: fix the potential memory leak in fec_enet_init()
If the memory allocated for cbd_base is failed, it should
free the memory allocated for the queues, otherwise it causes
memory leak.

And if the memory allocated for the queues is failed, it can
return error directly.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-02 18:04:24 +08:00
ade4ccd746 MLK-9786 net: fec: Add busfreq support to the driver
Add request_bus_freq() and release_bus_freq() calls to the
various drivers to ensure that the DDR and AHB are the requested
frequency before the driver starts its task.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-12-02 18:04:23 +08:00
7a5abf6a72 enetc: Remove mdio bus on PF probe error path
Fixes following kernel panic on the probing error
path, when pci=nomsi bootarg is used (which is
not supporrted by the enetc dirver):

fsl_enetc 0000:00:00.0: MSIX alloc failed
------------[ cut here ]------------
kernel BUG at drivers/net/phy/mdio_bus.c:487!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
Modules linked in:
Process swapper/0 (pid: 1, stack limit = 0x(____ptrval____))
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.68-00004-g85dc4876e6e6 #1
Hardware name: LS1028A RDB Board (DT)
pstate: 80000005 (Nzcv daif -PAN -UAO)
pc : mdiobus_free+0x5c/0x60
lr : _devm_mdiobus_free+0x20/0x30
[...]
Call trace:
 mdiobus_free+0x5c/0x60
 _devm_mdiobus_free+0x20/0x30
 release_nodes+0x148/0x238
 devres_release_all+0x3c/0x68
 really_probe+0x90/0x2a0
 driver_probe_device+0x5c/0x100
 __driver_attach+0xf0/0xf8
 bus_for_each_dev+0x84/0xd8
 driver_attach+0x30/0x40
 bus_add_driver+0x1c4/0x230
 driver_register+0x64/0x110
 __pci_register_driver+0x58/0x68
 enetc_pf_driver_init+0x28/0x30
 do_one_initcall+0x54/0x268
 kernel_init_freeable+0x2d0/0x37c
 kernel_init+0x18/0x118
 ret_from_fork+0x10/0x1c
Code: 97e0dd79 f9400bf3 a8c27bfd d65f03c0 (d4210000)
---[ end trace 1e4e5729f059b773 ]---

Fixes: ebfcb23d62 ("enetc: Add ENETC PF level external MDIO support")
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:22 +08:00
9308f989b0 enetc: Replace enetc_gregs with a readers-writer lock
The LS1028A MDIO errata tells us that any MDIO register access must not
be concurrent with any other ENETC register access.

That has been handled so far by a number of per-CPU spinlocks over the
ENETC register map. This came as an optimization over a single spinlock,
because the regular register accesses can still be concurrent with one
another, as long as they aren't concurrent with MDIO.

But this logic is broken in RT, because the enetc_rd_reg_wa and
enetc_wr_reg_wa functions can be preempted in any context, and when they
resume they may not run on the same CPU.

This renders the logic to take the per-CPU spinlock pointless, since the
spinlock may not be the correct one (corresponding to this CPU) after
preemption has occurred.

The following splat is telling us the same thing:

[   19.073928] BUG: using smp_processor_id() in preemptible [00000000] code: systemd-network/3423
[   19.073932] caller is debug_smp_processor_id+0x1c/0x30
[   19.073935] CPU: 1 PID: 3423 Comm: systemd-network Not tainted 4.19.68-rt26 #1
[   19.073936] Hardware name: LS1028A RDB Board (DT)
[   19.073938] Call trace:
[   19.073940]  dump_backtrace+0x0/0x1a0
[   19.073942]  show_stack+0x24/0x30
[   19.073945]  dump_stack+0x9c/0xdc
[   19.073948]  check_preemption_disabled+0xe0/0x100
[   19.073951]  debug_smp_processor_id+0x1c/0x30
[   19.073954]  enetc_open+0x1b0/0xbc0
[   19.073957]  __dev_open+0xdc/0x160
[   19.073960]  __dev_change_flags+0x160/0x1d0
[   19.073963]  dev_change_flags+0x34/0x70
[   19.073966]  do_setlink+0x2a0/0xcd0
[   19.073969]  rtnl_setlink+0xe4/0x140
[   19.073972]  rtnetlink_rcv_msg+0x18c/0x500
[   19.073975]  netlink_rcv_skb+0x60/0x120
[   19.073978]  rtnetlink_rcv+0x28/0x40
[   19.073982]  netlink_unicast+0x194/0x210
[   19.073985]  netlink_sendmsg+0x194/0x330
[   19.073987]  sock_sendmsg+0x34/0x50
[   19.073990]  __sys_sendto+0xe4/0x150
[   19.073992]  __arm64_sys_sendto+0x30/0x40
[   19.073996]  el0_svc_common+0xa4/0x1a0
[   19.073999]  el0_svc_handler+0x38/0x80
[   19.074002]  el0_svc+0x8/0xc

But there already exists a spinlock optimized for the single writer,
multiple readers case: the rwlock_t. The writer in this case is the MDIO
access code (irrelevant whether that MDIO access is a register read or
write), and the reader is everybody else.

This patch also fixes two more existing bugs in the errata workaround:
- The MDIO access code was not unlocking the per-CPU spinlocks in the
  reverse order of their locking order.
- The per-CPU spinlock array was not initialized.

Fixes: 5ec0d668d62e ("enetc: WA for MDIO register access issue")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:22 +08:00
15f0bf01a5 enetc: Clean up of ehtool stats len
Just refactoring stats len code to make it easier to
add new stats counters.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:22 +08:00
7e2622ca82 enetc: WA for MDIO register access issue
Due to a hardware issue access to MDIO registers concurrent with other
ENETC register access may lead to the MDIO access being dropped or
corrupted.  The workaround introduces locking for all register access in
ENETC space.  To reduce performance impact, code except MDIO uses per-cpu
locks, MDIO code having to acquire all per-CPU locks to perform an access.
To further reduce the performance impact, datapath functions acquire the
per-cpu lock fewer times and use _hot accessors.  All the rest of the code
uses the _wa accessors which lock every time a register is accessed.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
2019-12-02 18:04:21 +08:00
2d468e7227 enetc: Enable live mac addr change for PF
Use device flag IFF_LIVE_ADDR_CHANGE to signal that
the device supports changing the primary mac address
for a ENETC port, when the PF eth interface is running.
This capability is required by certain applications,
like bonding mode 6 (Adaptive Load Balancing).

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:21 +08:00
d05ad46efd enetc: Handle USXGMII protocol
Adds USXGMII protocol which is now supported in Linux.  XGMII is kept for
compatibility although there is no plain XGMII support in ENETC.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
2019-12-02 18:04:21 +08:00
501d929c03 enetc: Use DT protocol information to set up the ports
Use DT information rather than in-band information from bootloader to
set up MAC for XGMII. For RGMII use the DT indication in addition to
RGMII defaults in hardware.
However, this implies that PHY connection information needs to be
extracted before netdevice creation, when the ENETC Port MAC is
being configured.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:20 +08:00
9cf9459fe2 enetc: Drop redundant device node check
The existence of the DT port node is the first thing checked
at probe time, and probing won't continue if the node is missing.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:20 +08:00
d49dbe7946 enetc: Initialize SerDes for SGMII and SXGMII protocols
ENETC has ethernet MACs capable of SGMII and SXGMII but
in order to use these protocols some serdes configurations
need to be performed.
The serdes is configurable via an internal MDIO bus
connected to an internal PCS device, all reads/writes are
performed at address 0.
This patch basically removes the dependecy on a bootloader
regarding serdes initialization.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:19 +08:00
572ee5d842 enetc: Make mdio accessors more generic
Refactoring needed to support multiple MDIO buses.
'mdio_base' - MDIO registers base address - is being parameterized.
The MDIO accessors are made more generic to be able to work with
different MDIO register bases.
Some includes get cleaned up in the process.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:19 +08:00
48d4784a7e enetc: Fix if_mode extraction
If if_mode not found then just handle it as fixed link
(i.e mac2mac connection).

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-12-02 18:04:19 +08:00
2695b0ed9d enetc: update TSN Qbv PSPEED set according to adjust link speed
ENETC has a register PSPEED to indicate the link speed of hardware.
It is need to update accordingly. PSPEED field needs to be updated
with the port speed for QBV scheduling purposes. Or else there is
chance for gate slot not free by frame taking the MAC if PSPEED and
phy speed not match. So update PSPEED when link adjust. This is
implement by the adjust_link.

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:18 +08:00
faf3c36220 enetc: Configure the Time-Aware Scheduler via tc-taprio offload
ENETC supports in hardware for time-based egress shaping according
to IEEE 802.1Qbv. This patch implement the Qbv enablement by the
hardware offload method qdisc tc-taprio method.
Also update cbdr writeback to up level since control bd ring may
writeback data to control bd ring.

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-02 18:04:18 +08:00
04b23c7617 bus: fsl-mc: add autorescan sysfs
Add the autorescan sysfs in order to enable/disable the DPRC IRQs on
which automatic rescan of the bus is performed. This is important when
dynamic creation of objects is needed to happen in a timely manner because
object creation can be bundled together.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:04:17 +08:00
9329f333eb soc: fsl: dpio: Replace QMAN array mode by ring mode enqueue.
This change of algorithm will enable faster bulk enqueue.
This will grately benefit XDP bulk enqueue.

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
2019-12-02 18:04:17 +08:00
6a74b37669 soc: fsl: dpio: QMAN performance improvement. Function pointer indirection.
We are making the access decision in the initialization and
setting the function pointers accordingly.

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
2019-12-02 18:04:17 +08:00
9a499cc1e7 soc: fsl: dpio: Adding QMAN multiple enqueue interface.
Update of QMAN the interface to enqueue frame. We now support multiple
enqueue (qbman_swp_enqueue_multiple) and multiple enqueue with
a table of descriptor (qbman_swp_enqueue_multiple_desc).

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
2019-12-02 18:04:16 +08:00
acab5eafaa bus/fsl-mc: Set the QMAN/BMAN region flags
The QMAN region can be memory mapped, so it should be
of type IORESOURCE_MEM. Also use the bus specific bits
in order to pass additional information about the region.

Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-12-02 18:04:16 +08:00
60128d52b7 bus/fsl-mc: Extend functions from the bus driver to be used by vfio-mc
The bus/dpcr driver use some common functions, export those
functions to be accessible from the vfio-mc driver.

Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-12-02 18:04:16 +08:00
e45893bf91 bus/fsl-mc: Add a new parameter to dprc_scan_objects function
Prepare the dprc_scan_objects function to be used by
the VFIO mc driver code. The function is used to scan the mc
objects by the bus driver. The same functionality is
needed by the VFIO mc driver, but in this case the
interrupt configuration is delayed until the userspace
configures them. In order to use the same function in both
drivers add a new parameter.

Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-12-02 18:04:15 +08:00
4f1754011c dpaa2-eth: Don't use netif_receive_skb_list for TCP frames
Using Rx skb bulking for all frames may negatively impact the
performance in some TCP termination scenarios, as it effectively
bypasses GRO.

Look at the hardware parse results of each ingress frame to see
if a TCP header is present or not; for TCP frames fall back to
the old implementation.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:04:15 +08:00
8e9e4f1ab8 dpaa2-eth: Add autoneg support
For MC versions that support it, use the new DPNI link APIs, which
allow setting/getting of advertised and supported link modes.

A mapping between DPNI link modes and ethtool ones is created to
help converting from one to the other.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
2019-12-02 18:04:14 +08:00
417ada8701 dpaa2-eth: Add support for new link state APIs
Add v2 of dpni_get_link_state() and dpni_set_link_cfg() commands.
The new version allows setting & getting advertised and supported
link options.

Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:14 +08:00
eb7a63400e dpaa2-eth: Re-add get_link_ksettings ethtool op
Which was removed from upstream driver since without a MAC driver
we have no support for changing link parameters there.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:14 +08:00
923d6a315b dpaa2-eth: Add CEETM qdisc support
Features include:
- dual rate shaping support
- per-channel shaping and classification
- strict / weighted scheduling among num_tc classes
- TD enabled for configured class queues
- prio class (leaf) firmware statistics support
- weights normalized based on max
- tc filters based classification

Only 1 CEETM ch supported, only channel shaping supported.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:04:13 +08:00
c867c998f6 dpaa2-eth: Add API for ceetm_id + tc in set congestion
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:04:13 +08:00
94eb68e5f7 dpaa2-eth: Update dpni_get_statistics
Statistics struct now contains an addditional page, with CEETM stats.
Also update the cmd version, and the call where it's used.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:04:13 +08:00
43b60fcebd dpaa2-eth: Add dpni_set_tx_priorities API
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:04:12 +08:00
4ecfcbd44e dpaa2-eth: Update dpni_set_tx_shaping cmd to v2
Support dual rate shaping (committed, excess) and the coupled parameter.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:04:12 +08:00
3c6d29fdf7 dpaa2-eth: Add channel stat
Compute average number of frames processed for each CDAN
received on a channel and print it in the detailed channel
stats.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:11 +08:00
a3ad9d7e42 dpaa2-eth: Add reset controls for debugfs stats
Allow the user to reset statistics counters through debugfs entries.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:11 +08:00
5377fa0819 dpaa2-eth: Add API for counters reset
Add DPNI object API function for resetting interface
hardware counters.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:11 +08:00
a6539fd6a4 dpaa2-eth: Add Rx error queue
Until now all error frames on the ingress path were discarded
in hardware. For debug purposes, add an option to have these
frames delivered to the cpu, on a dedicated queue.

TODO: Remove Kconfig option, find another way to enable
Rx error queue support

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:10 +08:00
d61bbcdfa1 dpaa2-eth: Add Tx shaping support
Add support in sysfs for controlling DPNI Tx shaping
parameters: rate limit (in Mbps) and max burst size (in bytes).
The settings are per port.

TODO: See how to integrate Tx shaping support using
standard Linux tools (ethtool)

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:04:10 +08:00
e767ffc55a dpaa2-eth: Add Tx shaping API
DPNIs can be configured to accept a maximum Tx rate and
burst size. Add the MC API for controlling these parameters.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:09 +08:00
c3b30b61f5 dpaa2-eth: Keep congestion group taildrop enabled when PFC on
Leave congestion group taildrop enabled for all traffic classes
when PFC is enabled. Notification threshold is low enough such
that it will be hit first and this also ensures that FQs on
traffic classes which are not PFC enabled won't drain the buffer
pool.

FQ taildrop threshold is kept disabled as long as any form of
flow control is on. Since FQ taildrop works with bytes, not number
of frames, we can't guarantee it will not interfere with the
congestion notification mechanism for all frame sizes.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:09 +08:00
69951b8620 dpaa2-eth: Enable Tx PFC
Configure the hardware to generate PFC frames based on Rx congestion
notifications. When a certain number of frames accumulate in the
ingress queues corresponding to a traffic class, priority flow control
frames are generated for that TC.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:09 +08:00
0814ea9201 dpaa2-eth: Enable Rx PFC
Instruct the hardware to respond to received PFC frames.

Current firmware doesn't allow us to selectively enable PFC
on the Rx side for some priorities only, so we will react to
all incoming PFC frames (and stop transmitting on the traffic
classes specified in the frame).

PFC depends on the PAUSE flag also being set in link options.
Don't set it implicitly when user configures PFC, but issue
a warning if the two settings are not in sync.

For the Tx side, setting the PFC_PAUSE flag in the link options
is necessary but not sufficient, so PFC frame generation is
not enabled yet.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:08 +08:00
620603a5b6 dpaa2-eth: Add DCB ops
Add a skeleton implementation of DCB PFC ops. Actual hardware
configuration to be added in further commits.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:08 +08:00
817353f3cb dpaa2-eth: Update FQ taildrop threshold and buffer pool count
Now that we have congestion group taildrop configured at all
times, we can afford to increase the frame queue taildrop
threshold; this will ensure a better response when receiving
bursts of large-sized frames.

Also decouple the buffer pool count from the Rx FQ taildrop
threshold, as above change would increase it too much. Instead,
keep the old count as a hardcoded value.

With the new limits, we try to ensure that:
* we allow enough leeway for large frame bursts (by buffering
enough of them in queues to avoid heavy dropping in case of
bursty traffic, but when overall ingress bandwidth is manageable)
* allow pending frames to be evenly spread between ingress FQs,
regardless of frame size
* avoid dropping frames due to the buffer pool being empty; this
is not a bad behaviour per se, but system overall response is
more linear and predictable when frames are dropped at frame
queue/group level.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:07 +08:00
e50b364258 dpaa2-eth: Add congestion group taildrop
The increase in number of ingress frame queues means we now risk
depleting the buffer pool before the FQ taildrop kicks in.

Congestion group taildrop allows us to control the number of frames
that can accumulate on a group of Rx frame queues belonging to the
same traffic class.

This setting coexists with the frame queue based taildrop: whichever
limit gets hit first triggers the frame drop.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:07 +08:00
9843260761 dpaa2-eth: Minor cleanup in dpaa2_eth_set_rx_taildrop()
Make clear the setting refers to FQ-based taildrop and the threshold
value is given in bytes (the default option).

Reverse the logic of the second argument (pass tx_pause transparently).
This will be helpful further on.

Also don't set the device's Rx taildrop flag unless configuration
succeeds.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:06 +08:00
eed0dc57bd dpaa2-eth: Add helper functions
Add convenient helper functions that determines whether Rx/Tx pause
frames are enabled based on link state flags received from firmware.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:06 +08:00
e45522f512 dpaa2-eth: Distribute ingress frames based on VLAN prio
Configure static ingress classification based on VLAN PCP field.
If the DPNI doesn't have enough traffic classes to accommodate all
priority levels, the lowest ones end up on TC 0 (default on miss).

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:05 +08:00
41a59b0c57 dpaa2-eth: Trim debugfs FQ stats
With the addition of multiple traffic classes support, the number
of available frame queues grew significantly, overly inflating the
debugfs FQ statistics entry. Update it to only show the queues
which are actually in use (i.e. have a non-zero frame counter).

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:05 +08:00
23a2b6a0d0 dpaa2-eth: Add support for Rx traffic classes
The firmware reserves for each DPNI a number of RX frame queues
equal to the number of configured flows x number of configured
traffic classes.

Current driver configuration directs all incoming traffic to
FQs corresponding to TC0, leaving all other priority levels unused.

Start adding support for multiple ingress traffic classes, by
configuring the FQs associated with all priority levels, not just
TC0. All settings that are per-TC, such as those related to
hashing and flow steering, are also updated.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:05 +08:00
1b0071a411 dpaa2-eth: Avoid unbounded while loops
Throughout the driver there are several places where we wait
indefinitely for DPIO portal commands to be executed, while
the portal returns a busy response code.

Even though in theory we are guaranteed the portals become
available eventually, in practice the QBMan hardware module
may become unresponsive in various corner cases.

Make sure we can never get stuck in an infinite while loop
by adding a retry counter for all portal commands.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:04 +08:00
40f7236657 dpaa2-eth: Fix minor bug in ethtool stats reporting
Don't print error message for a successful return value.

Fixes: d84c3a4ded ("dpaa2-eth: Add new DPNI statistics counters")

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:03 +08:00
8655b1e4de dpaa2-eth: Cleanup dead code
Remove one function call whose result was not used anywhere.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:03 +08:00
285d0e5a95 staging: dpaa2-evb: Update netlink attributes API
Account for upstream changes in some nla functions.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:04:02 +08:00
a9744edd0f staging: dpaa2-evb: Defer probe if no mc portal is found
Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:04:02 +08:00
ee1e0a3441 staging: dpaa2-evb: Fix MC bus include
Adapt to upstream changes.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:04:02 +08:00
edb182c9bc staging: dpaa2-evb: change mc_command in fsl_mc_command
Adapt to the upstream changes.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:04:01 +08:00
8732d3cdb4 staging: dpaa2-evb: Use MC portal in atomic context
Avoid triggering stack trace when retrieving interface counters via
ifconfig by allocating MC portal with atomic I/O enabled.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:04:01 +08:00
a139c24d8c staging: dpaa2-evb: Update netdev_master_upper_dev_link parameters
Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:04:01 +08:00
7409543bed staging: dpaa2-evb: Update netlink parsing parameters
Accommodate extended ACL reporting addded to netlink parsing functions.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:04:00 +08:00
df1c1379bd staging: dpaa2-evb: Update MTU update procedure
Set limits on the MTU to accommodate netdevice update. There is no need to
check the limits before setting the new value.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:04:00 +08:00
963eda3218 staging: dpaa2-evb: Improve ethtool support
Improve ethtool support by adding ops for:
- driver info
- link status
- auto-negotiation setting and result
- speed setting and result

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:03:59 +08:00
3c6ba63c57 staging: dpaa2-evb: Fix W=1 warnings
Fix warnings triggered by '-Wsign-compare' flag.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:03:59 +08:00
08e6dd10bd staging: dpaa2-evb: Add Edge Virtual Bridge driver
This contains the following patches migrated from sdk-v2.0.x branch:

dpaa2-evb: Added Edge Virtual Bridge driver
dpaa2-evb: Add VLAN_8021Q dependency
dpaa2-evb: Update dpdmux binary interface to 5.0
dpaa2-evb: Add support to set max frame length.
dpaa2-evb: Fix interrupt handling
dpaa2-evb: Add object version check
staging: dpaa2-evb: update dpdmux command ids set for MC v10.x
dpaa2-evb: replace uintX_t types by kernel preferred kernel uX types
dpaa2-evb: uprev binary interface to v6.0
dpaa2-evb: move comments from declaration to definition
dpaa2-evb: delete extraneous tabs
dpaa2-evb: align function parameters
dpaa2-evb: convert mc command build/parse to use C structs

Initial patches have been signed-off by:
Alex Marginean <alexandru.marginean@freescale.com>
J. German Rivera <German.Rivera@freescale.com>
Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Mihaela Panescu <mihaela.panescu@freescale.com>
Catalin Horghidan <catalin.horghidan@nxp.com>
Ioana Ciornei <ioana.ciornei@nxp.com>
Stuart Yoder <stuart.yoder@freescale.com>

Updated FLIBs to the latest available for MC 10.x and fixed check-patch
warnings. Updated maintainer to myself and removed the DPAA2 Ethernet
dependency.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:03:58 +08:00
ff6084127b staging: dpaa2-mac: add link up/down events for dpmac
Fix a limitation that affects the networking behavior when the user
issues ifconfig down/up on a DPNI and the link remains down.
The actual problem was that the mac driver was not aware of the
dpni link change event. Now, the event is sent by firmware and
phylib state machine is manipulated conveniently.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:03:58 +08:00
43996c56e3 staging: dpaa2-mac: Update interface mode array
We used to set PHY_INTERFACE_MODE_XGMII as a placeholder
for interface modes listed by MC but not defined in the
linux kernel. Some of these modes have been added in upstream,
so update the interface mode array to better match actual PHYs.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:57 +08:00
2f5eda5940 staging: fsl-dpaa2/mac: add pause frames support for managed phys
Read the configured dpmac options and depending on the supported
features set the according advertising bit.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:57 +08:00
54f2696bc9 staging: fsl-dpaa2/mac: connect to the fixed phy
This patch is formed from 2 parts:
   - first it moves the code that determines the if_mode to the
     beginning so that it's used for both fixed link and phy mode.
   - secondly, when in fixed link mode, call the phy_connect_phy
     function as needed.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:03:57 +08:00
0e5fc90a7b staging: fsl-dpaa2/mac: Add autoneg support
For MC versions that support it, use the new DPMAC link APIs, which
allow setting/getting of advertised and supported link modes.

A mapping between DPMAC link modes and phydev ones is created to
help converting from one to the other.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
2019-12-02 18:03:56 +08:00
e6254bc596 staging: fsl-dpaa2/mac: Add support for new link state APIs
Add v2 of dpmac_set_link_state() and dpmac_get_link_cfg() commands.
The new version allows setting & getting advertised and supported
link options.

Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:56 +08:00
d14909d06d staging: fsl-dpaa2/mac: Fix dpmac_set_link_state() command
The instruction writing link state value in the MC command
structure wasn't correct, but it happened to work nonetheless.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:55 +08:00
c45948a39f staging: fsl-dpaa2/mac: Check DPMAC version
Read the current API version exposed by the DPMAC object.
Add a check at probe time to make sure it is compatible with
the set of MC commands we intend to use on it.
Also, print the version number through ethtool driver info.

Signed-off-by: Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:55 +08:00
009177ecdf staging: fsl-dpaa2/mac: Add more PHY modes
Add support for CAUI, USXGMII and 1000BASE-X.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:54 +08:00
a6accaf7fa staging: fsl-dpaa2/mac: read phy mode from device tree
If the a dpmac node defines its phy mode in the device tree using
the 'phy-mode' or the 'phy-connection-type' attributes this will take
precedence over the interface mode reported by the MC in the
dpmac attributes structure.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:54 +08:00
bc3333ba01 staging: fsl-dpaa2/mac: Fix uninitialized variable
Reported by coverity.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:53 +08:00
4f489198bb staging: fsl-dpaa2/mac: probe phy as fixed link based on dpmac properties
Keep in sync the PHY type settings in DPC and Linux device tree.

If the dpmac is connected to a fixed link PHY based on dpc config,
treat it as a fixed-link device, regardless of whether the "phy-handle"
property is present in the device tree node or not.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:53 +08:00
7165c0b6d4 staging: fsl-dpaa2/mac: make compatible with upstream MC bus
Update the mc.h include path.
Rename struct mc_command to struct fsl_mc_command.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:03:53 +08:00
64b3a33fcd staging: fsl-dpaa2/mac: defer probe if no mc portal is found
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:53 +08:00
7038d1de65 staging: fsl-dpaa2/mac: Free phydev on unbind
Stop polling and unregister / disconnect the phydev structure on DPAA2
mac driver unbind.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:03:52 +08:00
cdb4ed7cb9 staging: fsl-dpaa2/mac: Cleanup code
- move dpaa2_mac_open and dpaa2_mac_stop out of
  CONFIG_FSL_DPAA2_MAC_NETDEVS, since their implementation is necessary
  regardless of it
- reorder ndo ops to match function implementation order
- update comment to describe the phy connection mode that's to be used -
  it no longer depends on DPC, but on the device tree

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:03:50 +08:00
bd94632ec4 staging: fsl-dpaa2/mac: Remove redundant free
free_netdev (put_device) already handles freeing the private data
structure, and KASAN will complain due to a free after free if we
explicitly do the same afterwards.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:03:50 +08:00
91e1a4d583 staging: fsl-dpaa2/mac: Request atomic context MC portals
The MAC driver may need to issue MC commands while in atomic
context (e.g. dpaa2_mac_get_stats can be called from a critical
section), so we need to use MC portals that don't sleep while
waiting for a command response to arrive.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:49 +08:00
9de4f517fb staging: fsl-dpaa2/mac: Comply with mc bus header updates
The fsl-mc bus driver reorganized some of its headers, so
update our includes accordingly.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:49 +08:00
eb452924e7 staging: fsl-dpaa2/mac: Update ethtool ops
Ethtool ops get/set_settings() are deprecated, so implement
get/set_link_ksettings() instead.

These now call the corresponding phy_ethtool_ksettings_*
generic functions, as the old ones also got deprecated
and removed from the kernel entirely.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-12-02 18:03:49 +08:00
2425e80aa5 staging: fsl-dpaa2/mac: Remove link type from phy sel logic
Signed-off-by: Constantin Tudor <constantin.tudor@nxp.com>
2019-12-02 18:03:48 +08:00
e97ed1f13d staging: fsl-dpaa2/mac: Add Freescale DPAA2 mac driver
Introduce the DPAA2 mac driver, which manages Datapath
Media Access Control (DPMAC) objects discovered on the
MC bus.

This driver works as a proxy between phylib including phy
drivers and the Management Complex firmware. It receives
updates on link state changes from PHY lib and forwards
them to the Management Complex and receives interrupts
from the Management Complex whenever a request is made to
change the link state.

This is a squashed commit containing contributions of the
following owners:
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@nxp.com>
Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: J. German Rivera <German.Rivera@freescale.com>
Signed-off-by: Itai Katz <itai.katz@freescale.com>

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:03:48 +08:00
bdb3d15e00 staging: fsl-dpaa2/mac: Add APIs for DPMAC objects
Add the command build/parse APIs for operating on DPMAC
objects through the DPAA2 Management Complex.

Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
2019-12-02 18:03:47 +08:00
7650abf2ec soc: fsl: dpio: aligned access of qbman cacheable region
Alignment requirement on ARM is lenient (In Linux) for regions
mapped as "Memory Type" but have very strict policy for regions
mapped as "Device Type". Unaligned access to regions mapped
as "Device Type" will always result to unaligned fault.

DPIO driver have un-aligned access to QBman cacheable region
and the Linux driver maps the region as "Memory Type". On Host
Linux this works because MMU Stage-1 configured by driver allows
unaligned access. In Virtual Machine cases, final region mapping type
is governed by combination of Stage-1 and Stage-2 MMU mapping.

Linux driver in VM controls maps the region as "Memory Type" in
Stage-1 MMU while Stage-2 is controlled by KVM. And current KVM
implementation does not allow device region to be mapped as
"Memory Type". Till we have a working/upstream-able solution
for Virtual Machine, we need to change un-aligned access in DPIO
driver to be aligned

While we reached to this point as we observed below alignment
exception in Virtual Machine when accessing qbman cacheable region.

  kvm [2347]: Unsupported FSC: EC=0x24 xFSC=0x21
  ESR_EL2=0x92000061
  error: kvm run failed Bad address
  PC=ffff000008398e78  SP=ffff800009bcb540
  X00=ffff000008041000 X01=ffff800009bcb580 X02=ffff800009bcb650
  X03=0000000000000180
  X04=ffff000008041001 X05=ffff800009bcb581 X06=0200000000000000
  X07=0000000000000000
  X08=0000000000000000 X09=ffff000008041000 X10=0000000000000001
  X11=0000000000de6cb0
  X12=00000000fa83b2da X13=0000000000000001 X14=000000007f605ec8
  X15=00000000e26f5d5e
  X16=000000008521af1e X17=000000001076277e X18=ffff800009bcb5c0
  X19=ffff800079da2b00
  X20=ffff800009bcb650 X21=0000000000000002 X22=0000000000000000
  X23=0000000000000000
  X24=0000000000000000 X25=ffff8000099e7440 X26=ffff000008da6000
  X27=ffff000008e7f000
  X28=00000000499e7440 X29=ffff800009bcb540 X30=ffff00000839a160
  PSTATE=20000145 --C- EL1h

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
2019-12-02 18:03:47 +08:00
b462bd28f6 soc: fsl: dpio: add support for opr
Order preservation is a feature that will be supported
in dpni, dpseci and dpci devices.
This is a preliminary patch for the changes to be
introduced in the corresponding drivers.

Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:03:47 +08:00
2ebf4f0821 soc: fsl: dpio: Fix order restoration API for QBMan 5.0
The mechanism for indicating to HW that a frame was dropped
when performing HW order restoration changed in QBMan 5.0 to
use a management command instead of a special enqueue command.
This patch implements that change when running on a QBMan 5.0
and above device.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:03:46 +08:00
d8cfff8022 soc: fsl: dpio: Add Support for Order Restoration
Add DPIO support for HW assisted order restoration

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:03:46 +08:00
4820cd6245 soc: fsl: dpio: Prefer the CPU affine DPIO
Use the cpu affine DPIO unless there isn't one which can happen
if less DPIOs than cores are assign to the kernel.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:03:46 +08:00
166290c210 soc: fsl: dpio: enable qbman CENA portal memory access
Once we enable the cacheable portal memory, we need to do
cache flush for enqueue, vdq, buffer release, and management
commands, as well as invalidate and prefetch for the valid bit
of management command response and next index of dqrr.

Signed-off-by: Haiying Wang <Haiying.Wang@nxp.com>
2019-12-02 18:03:45 +08:00
b91206e1c4 soc: fsl: dpio: change CENA regs to be cacheable
Change cache enabled regsiter accessed to be cacheable
plus non-shareable to meet the performance requirement.
QMan's CENA region contains registers and structures that
are 64byte in size and are inteneded to be accessed using a
single 64 byte bus transaction, therefore this portal
memory should be configured as cache-enabled. Also because
the write allocate stash transcations of QBMan should be
issued as cachable and non-coherent(non-sharable), we
need to configure this region to be non-shareable.

Signed-off-by: Haiying Wang <Haiying.Wang@nxp.com>
2019-12-02 18:03:45 +08:00
8c78d11317 bus: fsl-mc: use raw spin lock to serialize mc cmds
Replace the spinlock that serializes the MC commands with a raw
spinlock. This is needed for the RT kernel because there are MC
commands sent in interrupt context.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:03:44 +08:00
9d92fe98c8 bus: fsl-mc: Allocate mc-portal from root dprc container
Root dprc container have allocate-able mc-portals which
can be allocated by kernel drivers.

As per current design mc-portal is allocated from parent
dprc container if requesting device is not root-dprc.
This works fine if the requesting device is child of
root dprc container, because their parent is root-dprc
container. But if request device is grandchild of root
dprc container then it tries to allocate from it's parent
root dprc-container and it fails.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
2019-12-02 18:03:44 +08:00
f5802e6188 bus: fsl-mc: DMA configure to have force-dma as default
Implicit dma setting from bus works when dma-ranges
specified but not otherwise. We need to continue
to go for force_dma as default for cases dma-ranges not
specified. Example dynamic device tree generation for
generic kvm virtual machines.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
2019-12-02 18:03:44 +08:00
e533169ad3 bus: fsl-mc: add support for dpaiop, dpci and dpdmai device type
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:03:43 +08:00
9e83de8d50 bus: fsl-mc: add support for dpdcei device type
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:03:43 +08:00
9cc7ca6406 bus: fsl-mc: add support for dpdmux device type
Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
2019-12-02 18:03:43 +08:00
cbfccf3b76 bus: fsl-mc: Some apis are made public for vfio
Some of the APIs and data-structures are required for VFIO.
This patch moves dprc.h to public header files.
Also some APIs of mc-bus are made public for vfio.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:03:42 +08:00
d5b79182e6 bus: fsl-mc: Extend ICID size from 16bit to 32bit
Extend the ICID from 16-bit to 32-bit.
Primary reason for this is enabling DPAA2 drivers
in Virtual Machine where device-id range is defined
for DPAA2 devices is 0x10000-0x20000.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:03:42 +08:00
20971721c5 bus: fsl-mc: define macros for iommu enablement for fsl-mc bus
Macros to get coherency and the container device of the devices on
fsl-mc bus are required to suport SMMU for this bus. This patch
defines the same.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:03:41 +08:00
b6b7fc49b8 bus: fsl-mc: added missing fields to dprc_rsp_get_obj_region structure
'type' and 'flags' fields were missing from dprc_rsp_get_obj_region
structure therefore the MC Bus driver was not receiving proper flags
from MC like DPRC_REGION_CACHEABLE.

Signed-off-by: Cristian Sovaiala <cristian.sovaiala@freescale.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:03:41 +08:00
db62b667e6 bus: fsl-mc: increase MC_CMD_COMPLETION_TIMEOUT_MS value to 15s
With recent MC release, a timeout of 500ms is not enough in most
circumstances. If MC firmware will respond faster, we should
decrease this value.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:03:41 +08:00
e9366604ed bus: fsl-mc: move fsl_mc_device_remove to common header
VFIO fsl-mc driver need this function on device remove,
moving this to common header file

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:03:40 +08:00
8202edf97e bus: fsl-mc: add device binding path 'driver_override'
This patch is required for vfio-fsl-mc meta driver to successfully bind
layerscape container devices for device passthrough. This patch adds
a mechanism to allow a layerscape device to specify a driver rather than
a layerscape driver provide a device match.

This patch is based on following proposed patches for PCI and platform
devices
- https://lkml.org/lkml/2014/4/8/571  :- For Platform devices
- http://lists-archives.com/linux-kernel/28030441-pci-introduce-new-device-binding-path-using-pci_dev-driver_override.html
:- For PCI devices

Example to allow a device (dprc.1) to specifically bind
with driver (vfio-fsl-mc):-
 - echo vfio-fsl-mc > /sys/bus/fsl-mc/devices/dprc.1/driver_override
 - echo dprc.1 > /sys/bus/fsl-mc/drivers/fsl_mc_dprc/unbind
 - echo dprc.1 > /sys/bus/fsl-mc/drivers/vfio-fsl-mc/bind

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:03:40 +08:00
01d718af32 bus: fsl-mc: Propagate driver_override for a child DPRC's children
When a child DPRC is bound to the vfio_fsl_mc driver via
driver_override, its own children should not be bound to corresponding
host kernel drivers, but instead should be bound to the vfio_fsl_mc
driver as well.

Currently, when a child container is scanned by the vfio_fsl_mc
driver, child devices found are automatically bound to corresponding
host kernel drivers (e.g., DPMCP and DPBP objects are bound to the
fsl_mc_allocator driver, DPNI objects are bound to the ldpaa_eth
driver, etc), Then, the user has to manually unbind these child
devices from their drivers, set the driver_override sysfs attribute
to vfio_fsl_mc driver, for each of them and rebind them.

Signed-off-by: J. German Rivera <German.Rivera@freescale.com>
Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:03:40 +08:00
06a44a7971 bus: fsl-mc: Add dprc-reset-container support
DPRC-reset is required for VFIO and is missing from
mc-bus support.
This patch added reset-container support.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:03:40 +08:00
29a9860b1c bus: fsl-mc: add bus rescan attribute
Introduce the rescan attribute as a bus attribute to
synchronize the fsl-mc bus objects and the MC firmware.

To rescan the fsl-mc bus, e.g.,
echo 1 > /sys/bus/fsl-mc/rescan

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:03:39 +08:00
959a22bedb bus: fsl-mc: add root dprc rescan attribute
Introduce the rescan attribute as a device attribute to
synchronize the fsl-mc bus objects and the MC firmware.

To rescan the root dprc only, e.g.
echo 1 > /sys/bus/fsl-mc/devices/dprc.1/rescan

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:03:39 +08:00
672699a389 bus: fsl-mc: add fsl-mc userspace support
Adding userspace support for the MC (Management Complex) means exporting
an ioctl capable device file representing the root resource container.

This new functionality in the fsl-mc bus driver intends to provide
userspace applications an interface to interact with the MC firmware.

Commands that are composed in userspace are sent to the MC firmware
through the FSL_MC_SEND_MC_COMMAND ioctl.  By default the implicit MC
I/O portal is used for this operation, but if the implicit one is busy,
a dynamic portal is allocated and then freed upon execution.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:03:38 +08:00
b3e9fc16c0 bus: fsl-mc: move fsl_mc_command struct in a uapi header
Define "struct fsl_mc_command" as a structure that can cross the
user/kernel boundary.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-12-02 18:03:38 +08:00
0962f7fb57 sdk_dpa: align to upstream PHY_INTERFACE_MODE
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:37 +08:00
9c0bab7869 net: dpaa: fix build failure due to skb_frag_t struct change
We met below build break due to new kernel change:
8842d285ba ("net: Convert skb_frag_t to bio_vec")

../drivers/net/ethernet/freescale/dpaa/dpaa_eth.c: In function ‘dpaa_errata_a010022_has_dma_issue’:
../drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2137:37: error: ‘skb_frag_t’ has no member named ‘page_offset’
   if (CROSS_4K_BOUND((uintptr_t)frag->page_offset, frag->bv_len))
                                     ^
../drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2105:5: note: in definition of macro ‘CROSS_4K_BOUND’
  (((start) + (size)) > (((start) + 0x1000) & ~0xFFF))
     ^
../drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2137:37: error: ‘skb_frag_t’ has no member named ‘page_offset’
   if (CROSS_4K_BOUND((uintptr_t)frag->page_offset, frag->bv_len))
                                     ^
../drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2105:27: note: in definition of macro ‘CROSS_4K_BOUND’
  (((start) + (size)) > (((start) + 0x1000) & ~0xFFF))

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:03:37 +08:00
513f4f7812 ptp: support ptp_qoriq for sdk dpaa
The ptp_qoriq driver could be used for both sdk version
dpaa driver and upstream version dpaa driver. So added
sdk dpaa dependency for ptp_qoriq driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:03:37 +08:00
8cf1c902a9 net: Makefile: re-add DPAA SDK drivers
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:36 +08:00
d30d0c1e96 config: add SDK QBMan driver
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
[ Aisheng: fix minor conflict due to removed CONFIG_VBOXSF_FS ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:03:36 +08:00
8530f309f0 config: enable SDK QBMan
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
[ Aisheng: fix minor conflcit due to removed vboxsf/Kconfig ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 18:03:36 +08:00
69a050c01a config: enable SDK DPAA driver
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:35 +08:00
bdcf59b776 config: enable SDK FMan driver
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:35 +08:00
724a6c4e73 dpaa_eth: Rename skb_frag_t size to bv_len
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-12-02 18:03:35 +08:00
3e79b81e54 sdk_dpaa: net: Rename skb_frag_t size to bv_len
Update for upstream data structure change similar to

commit b8b576a16f
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date:   Mon Jul 22 20:08:30 2019 -0700

    net: Rename skb_frag_t size to bv_len

Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-12-02 18:03:34 +08:00
506b2806f8 sdk_dpaa: ceetm: update Makefile to use absolute include paths
Explicitly mention the root source tree directory when building. This
allows the build process to start from a different location.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:34 +08:00
a16647b81b dpaa_eth: ERR010022: preserve timestamping
Maintain all timestamping fields when copying the skb.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:03:33 +08:00
23b525eb68 dpaa_eth: ERR010022: align skb_shinfo
Cache-line align the new skb's shared info field.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:33 +08:00
63456fc727 sdk_dpaa: ceetm: align to upstream API changes
Align to the following upstream patches:
8cb0817 netlink: make validation more configurable for future strictness
ae0be8d netlink: make nla_nest_start() add NLA_F_NESTED flag

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:32 +08:00
03fa50842a sdk_qbman: Update cpus_allowed to cpus_mask to cope with upstream change
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-12-02 18:03:32 +08:00
5a22522dea sdk_dpaa: SGMII 2500 needs AN disabled
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:32 +08:00
9851bf3f8c sdk_qbman: Fix error in IP revision comparison
The comparison for QMAN_REV31 was incorrect as it
would always fail due to the wrong mask.

This fixes the following error in newer GCC versions:
"error: bitwise comparison always evaluates to false
	[-Werror=tautological-compare]"

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:03:31 +08:00
56edc75e74 sdk_dpaa: Rework QBMan portal mappings
Rework the QBMan portal mappings in the SDK driver to
match the mechanism used in the upstream varient.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:03:31 +08:00
6e3d32d6c0 sdk_qbman: Avoid variable length array in USDPAA
As of Linux 5.0 variable length arrays on the stack are no
longer allowed. Change to a dynamic array and create a common
exit point in the function for cleanup.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:03:31 +08:00
2ddcb37980 sdk_dpaa: adapt to kernel 5.1.0 rc1
Apply fixes corresponding to the following upstream patches:
3c1bcc8 net: ethernet: Convert phydev advertize and supported from u32 to link mode
1e562c8 ptp_qoriq: make structure/function names more consistent
70814e8 net: ethernet: Add helper for set_pauseparam for Asym Pause
22b7d29 net: ethernet: Add helper to determine if pause configuration is supported

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:30 +08:00
5eed844329 sdk_dpaa: remove the QM_FQCTRL_PREFERINCACHE flag
Only a limited number of FQs can be in the cache, setting the
QM_FQCTRL_PREFERINCACHE flag for all FQs is not useful.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:30 +08:00
8319e92525 sdk_dpaa: ls1043a errata: impose S/G frame realignment
Scatter/Gather frames are not support on LS1043A beacuse they trigger
the A010022 errata.

Even though we do not advertise S/G support to the stack, we need to
make sure that if S/G frames do reach the driver somehow, they trigger
the errata workaround.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:30 +08:00
20a95a6321 fsl_qbman: Adjust platform device creation for QMan portals
Fix the platform device creation in QMan portals such that
dma mappings are done properly.

Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:03:29 +08:00
034786ce18 sdk_fman: avoid array overflow error in fman port init
Perform a verification of external buffer pools used which can cause array
overflow error in port init function SetExtBufferPools() if it was set to
value 1 via fman port API

Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
2019-12-02 18:03:29 +08:00
4332a99301 sdk/qbman: fix issue in qman_delete_cgr_safe()
The wait_for_completion() call in qman_delete_cgr_safe()
was triggering a scheduling while atomic bug, replacing the
kthread with a smp_call_function_single() call to fix it.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-12-02 18:03:29 +08:00
0225bc611c sdk_dpaa: remove useless 1588 timer enablement
1588 timer had been enabled to run at ptp_qoriq driver
probing stage. So removed the useless enablement.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:03:28 +08:00
07b89cb04a sdk_dpaa: fix hardware timestamp value
The hardware timestamp value got didn't need to be multiplied
by nominal frequency since ptp_qoriq driver initialized the
counter to add clock period, not the clock tick.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:03:28 +08:00
fb5cf1854e sdk_fman: share the event interrupt
This patch is to share fman event interrupt because
the 1588 timer driver will also use this interrupt.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:03:27 +08:00
df01c2f49b sdk_dpaa: add the get_ts_info interface for ethtool
Added the get_ts_info interface for ethtool to check
the timestamping capability.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:03:27 +08:00
202cc40c6f sdk_fman: disable ptp timer probe
DPAA PTP timer was managed by ptp_qoriq driver in drivers/ptp/.
We will no longer manage it in sdk_fman driver and use related
APIs.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:03:27 +08:00
d5afe66afc sdk_fman: suspend the FMan to Deep Sleep on PPC only
The SCFG_FMCLKDPSLPCR register is present on PPC targets only. This
feature does not apply to ARM SoCs.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:26 +08:00
a25f10599f sdk_dpaa: remove ptp clock driver
Removed dpaa_ptp driver since we could use common
ptp_qoriq driver in drivers/ptp/ instead.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:03:26 +08:00
251f60a2ee sdk_dpaa: set the skb queue mapping when looping
Save the current CPU ID on ingress, when FSL_DPAA_DBG_LOOP is set.
Use the skb_set_queue_mapping() call instead of skb_record_rx_queue()
because the stack isn't involved and won't compensate for the additional
offset.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:26 +08:00
2504ba39e2 sdk_dpaa: guard against an out of bounds queue index
Make sure the queue mapping recorded in the skb is not larger than our
egress queue count.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:25 +08:00
c2b7d10bd0 sdk_dpaa: ceetm: guard against an out of bounds queue index
Make sure the queue mapping recorded in the skb is not larger than our
egress queue count.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:25 +08:00
44fffdeb55 dpaa_eth: fix iova handling for sg frames
The driver relies on the no longer valid assumption that dma addresses
(iovas) are identical to physical addressees and uses phys_to_virt() to
make iova -> vaddr conversions. Fix this also for scatter-gather frames
using the iova -> phys conversion function added in the previous patch.
While at it, clean-up a redundant dpaa_bpid2pool() and pass the bp
as parameter.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:24 +08:00
68f7175c14 dpaa_eth: fix iova handling for contiguous frames
The driver relies on the no longer valid assumption that dma addresses
(iovas) are identical to physical addressees and uses phys_to_virt() to
make iova -> vaddr conversions. Fix this by adding a function that does
proper iova -> phys conversions using the iommu api and update the code
to use it.
Also, a dma_unmap_single() call had to be moved further down the code
because iova -> vaddr conversions were required before the unmap.
For now only the contiguous frame case is handled and the SG case is
split in a following patch.
While at it, clean-up a redundant dpaa_bpid2pool() and pass the bp
as parameter.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:24 +08:00
80cb48f3df dpaa_eth: base dma mappings on the fman rx port
The dma transactions initiator is the rx fman port so that's the device
that the dma mappings should be done. Previously the mappings were done
through the MAC device which makes no sense because it's neither dma-able
nor connected in any way to smmu.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:24 +08:00
290d620c46 dpaa_eth: defer probing after qbman
Enabling SMMU altered the order of device probing causing the dpaa1
ethernet driver to get probed before qbman and causing a boot crash.
Add predictability in the probing order by deferring the ethernet
driver probe after qbman and portals by using the recently introduced
qbman APIs.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:23 +08:00
550fb342cb fsl/fman: add API to get the device behind a fman port
Add an API that retrieves the 'struct device' that the specified fman
port probed against. The new API will be used in a subsequent iommu
enablement related patch.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:23 +08:00
30dd550e68 fsl/fman: backup and restore ICID registers
During probing, FMAN is reset thus losing all its register
settings. Backup port ICID registers before reset and restore
them after, similarly to how it's done on powerpc / PAMU based
platforms.
This also has the side effect of disabling the old code path
(liodn backup/restore handling) that obviously make no sense
in the context of SMMU on ARMs.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:22 +08:00
9580032bed sdk_dpaa: remove FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE
Remove FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE and record the
receive CPU in skb queue mapping to maintain the same CPU
for tx in forwarding scenarios.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:22 +08:00
7c8d934e12 sdk_dpaa: ceetm: rename qdisc_destroy() to qdisc_put()
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:22 +08:00
eac6c84c8a sdk_dpaa: ceetm: avoid double frees on error paths
The stack calls the destroy() callback when a qdisc init() fails.
We stop calling it ourselves and trust the stack do the cleanup.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:21 +08:00
08f45df7f9 staging/fsl_qbman: stop using current_kernel_time()
The current_kernel_time() call was removed in [1] in order to avoid
overflows in 2038. Use ktime_get_coarse_real_ts64() instead.

[1] 9765164 ("y2038: remove unused time interfaces")

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:21 +08:00
01a63a24ac staging/fsl_qbman: remove bootmem header
The bootmem allocator was removed in [1]. The memblock allocator is
supposed to be used directly instead. We already include it.

[1] afd505b ("mm: remove include/linux/bootmem.h")

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:21 +08:00
299edfcd06 sdk_dpaa: ceetm: lower the default congestion thresholds
The congestion thresholds need to be set in such a way that:
    a) the threshold is high enough so that frames aren't dropped
    unnecessarily
    b) the threshold is low enough so that the latency isn't too big

The current thresholds are set too high. In forwarding scenarios, the
latency is too large and frames are dropped on ingress due to a lack of
buffers.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:20 +08:00
f63917b62f sdk_dpaa: ls1043a errata: move comment
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:20 +08:00
c9b6b5002a sdk_dpaa: ls1043a errata: align skb_shinfo
Make sure the skb shared info is cache-line aligned when realigning
egress frames.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:20 +08:00
e4dcf29795 sdk_dpaa: store the skb backpointer in the skb headroom
The skb backpointer is stored right before the FMan buffer, in order to
avoid overwriting. The memory area storing the backpointer was outside of
the skb. This made it hard to guarantee its size.

This patch changes the layout of the skb at buffer seed time: the area
reserved for storing the skb backpointer is part of the skb's headroom.
This makes it easier to track if the backpointer can be safely stored
when recycling the buffer.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:19 +08:00
303189f16b fmd: use "fsl,fman-ptp-timer" compatible for ptp probe
Current ptp compatible "fsl,fman-rtc" used for ptp probe
in fmd driver couldn't involve PowerPC DPAA FMan PTP timer.
Let's use "fsl,fman-ptp-timer" instead to support DPAA FMan
PTP timer of both ARM and PowerPC.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:03:19 +08:00
265a877c3f staging/fsl_qbman: Recalcuate cursor after consuming ring
If the dqrr_init() function consumes frames during init
the cursor needs to be updated before anything starts
to use the ring.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:03:19 +08:00
f323a2bf13 staging/fsl_qbman: Consume all frames in DQRR during init
The qm_dqrr_cdc_consume_n() function takes a bitmask, not an index.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:03:18 +08:00
2f66e3553f fsl_qbman/usdpaa: change to debug print in interrupt handler
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
2019-12-02 18:03:18 +08:00
3de8b97791 sdk_dpaa: reserve 256 bytes for the SGT on TX
The FMan reads 256 bytes from the start of the SGT regardless of its
size. We reserve the same amount of memory on TX to access.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:18 +08:00
cb94caa2e2 sdk_dpaa: enable Jumbo frame support on LS1043A
Due to the A010022 errata restrictions, Jumbo frames on LS1043A require two
conditions to be met:
- on TX, the data is stored in a contiguous buffer of up to 9600 bytes
- the data is aligned to 256 bytes

The conditions are met by realigning all outgoing frames to 256 bytes.
Also, compound pages of varying orders are allocated to accommodate the
outgoing contiguous buffers.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:17 +08:00
ede8a56754 dpaa_eth: ERR010022: adapt to new skb copy API
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:17 +08:00
d11d8efa87 sdk_dpaa: ls1043a errata: adapt to new skb copy API
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:16 +08:00
18b74ce6de sdk_dpaa: ceetm: drain the ceetm CQs on destroy
The CEETM CQs must be empty when configured. To guarantee this, stop all
transmissions and wait for them to drain before releasing them. On the
next configuration, we are certain they will be empty.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:16 +08:00
d3c32443f1 sdk_dpaa: ceetm: WQ/CEETM mode switchover cleanup
Wait for the WQ TX FQs to empty before switching from WQ to CEETM mode.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:13 +08:00
fc7bf639ab sdk_dpaa: ceetm: reset the wbfs groups and priorities on teardown
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:12 +08:00
7a8c559eab sdk_dpaa: ceetm: propagate the ceetm channel through the qdisc tree
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:11 +08:00
33722b6f9d fsl_qbman: ceetm: export the qman_ceetm_query_cq call
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:10 +08:00
e0afacb9dc sdk_dpaa: ceetm: stop the netdev queues when switching ceetm on
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:10 +08:00
89d6a40b3c sdk_dpaa: ceetm: avoid use-after-free scenarios
Once the pfiofo qdiscs are grafted to the netdev queues, they are destroyed
by the kernel when required. Remove references to the pfifo qdiscs after
grafting, in order to avoid double free scenarios.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:10 +08:00
8255fd1cb8 memac_init_phy: RGMII fixed-link: pass adjust_link callback to of_phy_connect
* The mEMAC configuration for RGMII is held in the IF_MODE register
* In the driver, IF_MODE is configured in 2 places (both in fman_memac.c):
    - fman_memac_init: sets the IF_MODE bit macro IF_MODE_RGMII_AUTO
      (this translates to setting ENA = 1 - Enable automatic speed selection
      - RGMII PHY in-band status information is used to select the speed
      of operation).
    - fman_memac_adjust_link: brings the RGMII port in ENA = 0 mode
      (link speed not determined autonomously by the MAC, but set according
      to SSP).
* The issue with the current code is that in the case of RGMII fixed-link,
  the of_phy_attach function is being called, instead of of_phy_connect
  with a callback that calls fman_memac_adjust_link.
* For this reason, the RGMII port is left in a state with ENA = 1. In
  most (if not all) RGMII fixed-link setups, the link partner will not
  send any in-bank link speed information that is expected by the mEMAC.
* The effect is that the link speed setting will probably not be correct
  (and will definitely not be according to the "fixed-link" property in
  the DTS).
* The adjust_link callback seems to be called by the PHY state machine,
  even for fixed links, exactly once: on "link up". Therefore, this
  patch ensures that on link up, RGMII fixed links are configured to the
  link speed that is set in the DTS, and not left with IF_MODE[ENA] = 1.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-12-02 18:03:09 +08:00
c6bc7b73a6 sdk_dpaa: propagate the skb ownership information
Some skbs on the Tx path may be reallocated by the driver
due to insufficient headroom, in which case the socket
value gets lost.

Make sure we propagate the skb ownership information to the
new skb, since it's needed by the Tx timestamp function in
the kernel.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:09 +08:00
b6b7a9bce3 sdk_dpa: adapt ceetm code to new kernel API
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:09 +08:00
7dd51c356f sdk_fman: disable timer code in arm code
The (unused) timer code is no longer compatible with the newer
kernel API. Disabling the incompatible code in the arm64 code.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:08 +08:00
8fed39bbaa sdk_fman: disable timer code
The (unused) timer code is no longer compatible with the newer
kernel API. Disabling the incompatible code.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:08 +08:00
310601107d sdk_fman: on P-series platforms, the OH ports start at offset 1
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:08 +08:00
5702194a79 sdk_fman: probe OH ports on PPC
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:07 +08:00
2592025578 sdk_fman: fix probing of 10G ports on T102x
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:05 +08:00
70e8fe9428 sdk: dpa: adapt compatibles to upstream binding document
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:03:05 +08:00
3cfd870ae6 sdk_fman: DPAA-dTSEC ports fail to work when link changes
Signed-off-by: Iordache Florinel-R70177 <florinel.iordache@nxp.com>
2019-12-02 18:03:04 +08:00
ca2ad107fc dpaa_eth: workaround for ERR010022
On LS1043A SoC there is a known erratum ERR010022 that results in split DMA
transfers in the FMan under certain conditions. This, combined with a fixed
size FIFO of ongoing DMA transfers that may overflow when a split occurs,
results in the FMan stalling DMA transfers under high traffic. To avoid the
problem, one needs to prevent the DMA transfer splits to occur by preparing
the buffers as follows.

In order to prevent split transactions, all frames need to be aligned to 16
bytes and not cross 4K address boundaries. To allow Jumbo frames (up to
9.6K), all data must be aligned to 256 byes. This way, 4K boundary crossings
will not trigger any transaction splits.

The errata is prevented from manifesting by realigning all outgoing frames to
256 byte boundaries. In the process, all S/G frames are linearized.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:04 +08:00
1959e2b81b sdk_dpaa: ceetm: store Qdisc pointer in struct block
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:04 +08:00
65d0675a8f sdk_dpaa: ceetm: remove tc class reference counting
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:03 +08:00
94d2e50087 sdk_dpaa: ceetm: use the tcf block infrastructure
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:03 +08:00
a5efbd8d58 sdk_dpaa: ceetm: introduce a TRAP control action
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:02 +08:00
1fe6218dc6 sdk_dpaa: ceetm: adapt to new tcf classify API
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:02 +08:00
48ed84bc8b sdk_dpaa: ceetm: pass extended ACK struct to parsing functions
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:02 +08:00
8e1e664469 sdk_dpaa: update comments about recycling and back-pointer storage
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:01 +08:00
45dc4ed3d7 sdk_dpaa: update buffer recycling conditions
Guarantee there is enough space inside the skb's headroom to store the
skb back-pointer before recycling the buffer. The back-pointer is stored
right before the buffer's start.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:01 +08:00
8357b7b46d sdk_dpaa: ceetm: increment the interface's ern counters when needed
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:03:00 +08:00
9f7f880d11 sdk_dpaa: ceetm: coding style fixes and added comments
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:59 +08:00
5b1642b7d3 sdk_dpaa: ceetm: stop transmitting frames when the CQ is congested
When the egress CQ is congested, drop the frames instead of enqueueing
them. This is more efficient than enqueueing and receiving them back on
the ERN queue.

We also can't stop the netdev queues because that would affect all the CQs
and would hinder prioritization.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:59 +08:00
9de5449da4 sdk_dpaa: ceetm: add independent CEETM congestion thresholds
Configure the CEETM egress congestion thresholds independently from the
default Ethernet driver's Work Queues. Allow the user to edit the
thresholds through menuconfig.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:59 +08:00
0de5eca6ff net: ethernet: Rename PHY_INTERFACE_MODE_SGMII_2500
Rename PHY_INTERFACE_MODE_SGMII_2500 to PHY_INTERFACE_MODE_2500SGMII
Convention is to put the number(2500) first and then the
interface mode(SGMII)

Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
2019-12-02 18:02:58 +08:00
d74c7bad30 fsl_qbman/usdpaa: Invalidate software portals before use
Invalidate the cache for the software portals before using them
since the portals are non coherent. This ensures that the core
using the portal is seeing the most up to date information in
case the cache contained older data. This is important during
the cleanup phase if cleanup occurs on a differnt core than
what the application was using.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:02:58 +08:00
d88a9280e4 staging/fsl_qbman: Calculate valid bit from MC-RR
Use the management commmand response registers to determine
the next expected valid bit when initializing a software
portal. This avoids using the wrong valid bit in cases
where a command was partially written but then not
completed.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:02:57 +08:00
88700360ce sdk_dpaa: ls1043a errata: stop advertising S/G and GSO support
The errata prevents us from transmitting S/G frames. Instead of
linearizing them ourselves, stop advertising S/G support and have the
stack do it for us.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:57 +08:00
3d3d7334bb Added MII IOCTL support for SIOCGMIIREG
Signed-off-by: Vicentiu Galanopulo <vicentiu.galanopulo@nxp.com>
2019-12-02 18:02:57 +08:00
1ff3071930 sdk: dpa: use netdev dev for DMA mapping
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:02:56 +08:00
89601d1ca1 sdk_dpaa: accept frames on RX even if larger than MTU
Documentation/networking/netdevices.txt mentions that interfaces must
be able to receive frames at least the size of the configured MTU. The
behavior for received frames larger than the MTU is unspecified. We have
been dropping these frames in software. Remove this behavior and accept
them.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:56 +08:00
7d64eeda2d Extend FM MAC Statistics with frame size counters (request from Nokia)
Signed-off-by: Iordache Florinel-R70177 <florinel.iordache@nxp.com>
2019-12-02 18:02:56 +08:00
88286f13bc sdk_dpaa: adapt to the new API for MTU changes
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:55 +08:00
046302d132 sdk_dpaa: ls1043a errata: restrict the max mtu
We can not allow for Jumbo frames and large MTU values on LS1043A due to
the A-010022 FMan errata. All outgoing frames larger than 4K bytes are dropped.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:54 +08:00
96485d054c sdk_dpaa: ls1043a errata: maintain timestamp info
When creating a new skb for the errata workaround, maintain the socket
and timestamp configurations for timestamp hardware offloading.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:54 +08:00
06cd63e4d5 sdk_fman: resolve arm32 compilation issues for linux-4.13
Signed-off-by: Iordache Florinel-R70177 <florinel.iordache@nxp.com>
2019-12-02 18:02:53 +08:00
1644f3b122 sdk_dpaa: update the xmit timestamp to avoid watchdog timeouts
Update txq0's trans_start in order to prevent the netdev watchdog from
triggering too quickly. Since we set the LLTX flag, the stack won't update
the jiffies for other tx queues. Prevent the watchdog from checking the
other tx queues by adding the NETIF_HW_ACCEL_MQ flag.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:53 +08:00
f7afb519f6 sdk_dpaa: avoid crashing on OOM
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:02:53 +08:00
b01aafcde9 drivers/staging/fsl_qbman: Fix SWP Mask in Error Handling
If an ECC error occurs QBMan stores data in a register for
debug purposes. If the memory is software portal memory then
15 bits are used. This patch adjusts the mask to be correct.

Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-12-02 18:02:52 +08:00
e230c6cc1a sdk_dpaa: ls1043a errata: fix arm32 build
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:52 +08:00
6b957087d4 sdk_dpaa: ls1043a errata: do not recycle the realigned buffers
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:51 +08:00
bad9667b13 sdk_dpaa: ls1043a errata: verify and resize headroom alignment
If the skb's headroom isn't aligned to 16 bytes, reallocate the entire
skb and resize its headroom to priv->tx_headroom. Update the pointers
to the network and transport headers accordingly.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:51 +08:00
aa65306961 sdk_dpaa: ls1043a errata: realign skb in place if needed
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:51 +08:00
96825985ee sdk_dpaa: ls1043a errata: realign and linearize egress skbs
Allocate a new page and copy the skb's contents to it in order to
guarantee that 4k boundary crossings do not occur.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:50 +08:00
c892187492 sdk_dpaa: ls1043a errata: resplit the skb after copy
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:50 +08:00
a4101460ae dpaa_eth: memac: set adjust_link callback for fixed link interfaces
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:49 +08:00
aed7bc2e8a sdk_dpaa: fix dpa_set_ksettings
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:02:49 +08:00
4513e6e98f sdk_dpaa: use new api ethtool_ksettings_{get|set}
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:02:49 +08:00
ea90682c2f dpaa_eth: move global variable 'clock' into ptp_priv_s struct
This patch is to move global variable 'clock' for DPAA PTP
clock pointer into ptp_priv_s struct.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:02:48 +08:00
fc4b6b5c39 dpaa_eth: use ptp-timer phandle instead of ptimer-handle
Layerscape DPAA platforms have updated dts to use ptp-timer phandle
instead of ptimer-handle for Fman RTC node. This patch is to
update it in driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:02:47 +08:00
5a7792eba3 fmd: use ptp-timer for Fman RTC node name
Layerscape DPAA platforms have updated dts to use ptp-timer
instead of rtc for Fman RTC node name. This patch is to
update it in driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-12-02 18:02:47 +08:00
9e8815c2a7 dpa_eth: remove unused code
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:02:47 +08:00
97a6c84eae dpaa_eth: ceetm: update include paths for tc filters
The tcf_destroy_chain call prototype has been moved.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:46 +08:00
43870fa24e dpaa_eth: ceetm: adapt to the new gnet stats API
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:46 +08:00
6a9eb04135 dpaa_eth: ceetm: adapt to net/sched API changes
The tc_classify and tc_classify_compat calls have been merged. Adapt to
the new API.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:46 +08:00
a60d546738 dpaa_eth: ls1043a errata: check if the skb is linear after 4k splitting
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-12-02 18:02:46 +08:00
7fab630ae3 dpa: SDK DPAA 1.x Ethernet driver
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:02:44 +08:00
60bb3db8cf fmd: SDK DPAA 1.x FMan driver
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:02:42 +08:00
16ff861424 fsl_qbman: SDK DPAA 1.x QBMan drivers
Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-12-02 18:02:39 +08:00
405be24697 soc/fsl/bqman: page align iommu mapping sizes
Prior to calling iommu_map()/iommu_unmap() page align the size or
failures such as below could happen:

iommu: unaligned: iova 0x... pa 0x... size 0x4000 min_pagesz 0x10000
qman_portal 500000000.qman-portal: failed to iommu_map() -22

Seen when booted a kernel compiled with 64K page size support.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:02:39 +08:00
4100f962d8 soc/fsl/qbman_portals: add APIs to retrieve the probing status
Add a couple of new APIs to check the probing status of the required
cpu bound qman and bman portals:
 'int bman_portals_probed()' and 'int qman_portals_probed()'.
They return the following values.
 *  1 if qman/bman portals were all probed correctly
 *  0 if qman/bman portals were not yet probed
 * -1 if probing of qman/bman portals failed
Portals are considered successful probed if no error occurred during
the probing of any of the portals and if enough portals were probed
to have one available for each cpu.
The error handling paths were slightly rearranged in order to fit this
new functionality without being too intrusive.
Drivers that use qman/bman portal driver services are required to use
these APIs before calling any functions exported by these drivers or
otherwise they will crash the kernel.
First user will be the dpaa1 ethernet driver, coming in a subsequent
patch.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:02:39 +08:00
e6b50b37ef soc/fsl/qman-portal: map CENA area in the iommu
Add a one-to-one iommu mapping for qman portal CENA register area.
This is required for QMAN stashing to work without faults behind
an iommu.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:02:38 +08:00
8c0225ba64 soc/fsl/qman: map FQD and PFDR areas in the iommu
Add a one-to-one iommu mapping for qman private data memory areas
(FQD and PFDR). This is required for QMAN to work without faults
behind an iommu.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:02:38 +08:00
20bdd9d0a8 soc/fsl/bman: map FBPR area in the iommu
Add a one-to-one iommu mapping for bman private data memory (FBPR).
This is required for BMAN to work without faults behind an iommu.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:02:38 +08:00
57ed5de24f soc/fsl/qman: fixup liodns only on ppc targets
ARM SoCs use SMMU so the liodn fixup done in the qman driver is no
longer making sense and it also breaks the ICID settings inherited
from u-boot. Do the fixups only for PPC targets.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-12-02 18:02:37 +08:00
ece4fa7e6d Merge branch 'nand/next' into next
* nand/next:
  mtd: nand: raw: gpmi-nand: fix the qxp clk name and runtime issues
  mtd: nand: raw: gpmi-nand: add all supported platform info
  mtd: nand: raw: gpmi-nand: fix the suspend/resume issue
  drivers/mtd: Add deep sleep support for IFC
2019-12-02 18:02:35 +08:00
b3d472cf0c Merge branch 'mxc/next' into next
* mxc/next: (119 commits)
  mxc: hdmi-cec: Add imx6 hdmi cec driver
  driver: mfd: hdmi: Add hdmi core driver
  MLK-22399 mxc IPUv3: cpmem: Get 0 u/v_offset in __ipu_ch_offset_calc() for some pfmts
  mxc: IPU3: Fix not including uapi/linux/sched/types.h
  media: platform: mxc: output: Forward IPUv3 V4L2 output driver from imx_4.19.y
  ...
2019-12-02 18:02:35 +08:00
c8e9f05902 Merge branch 'misc/next' into next
* misc/next:
  nvmem: imx: correct the fuse word index
  nvmem: imx-ocotp: add support for the unaliged word count
  MA-11994 Add get phys address ioctl to dma-buf.
  staging: android: allow to compile ION unconditionally
2019-12-02 18:02:33 +08:00
093e21c5ca Merge branch 'mailbox/next' into next
* mailbox/next: (6 commits)
  mailbox: imx: add support for imx v1 mu
  dt-bindings: mailbox: imx-mu: add imx7ulp MU support
  mailbox: imx: Clear the right interrupts at shutdown
  mailbox: imx: Fix Tx doorbell shutdown path
  mailbox: imx: change to arch_init()
  ...
2019-12-02 18:02:32 +08:00
89c08f49ef Merge branch 'kvm/next' into next
* kvm/next:
  virt/vgic: Increase number of DeviceIDs to 17
  arm/arm64: KVM: drop qman mmio cacheable mapping hack
  arm/arm64 KVM: allow specifying s2 prot bits when mapping i/o
  arm64: KVM: support flushing device memory
2019-12-02 18:02:32 +08:00
0e41cf483e Merge branch 'keys/next' into next
* keys/next:
  encrypted_keys: Adds support for secure key-type as master key.
  security/keys/secure_key: Adds the secure key support based on CAAM.
2019-12-02 18:02:30 +08:00
96f124e418 Merge branch 'jailhouse/next' into next
* jailhouse/next: (22 commits)
  mm: Re-export ioremap_page_range
  arm64: export __hyp_stub_vectors
  jailhouse: Add simple debug console via the hypervisor
  ivshmem-net: Switch to netdev_xmit_more helper
  ivshmem-net: Refactor and comment ivshm_net_state_change
  ...
2019-12-02 18:02:29 +08:00
501fcef208 Merge branch 'irq/next' into next
* irq/next: (9 commits)
  LF-125 irqchip: irq-imx-gpcv2: Fix build error of nosmp
  MLK-21399 irqchip: Allow i.MX8MQ to call into TF-A
  irqchip: irq-imx-gpcv2: Fix build warning for imx_v6_v7_defconfig
  irqchip: irq-imx-gpcv2: fix the suspend/resume on imx8mq
  irqchip: imx-gpcv2: Fix build error for imx_v6_v7_defconfig
  ...
2019-12-02 18:02:29 +08:00
3171cbbd6e Merge branch 'input/next' into next
* input/next: (18 commits)
  LF-175: input: keyboard: imx_sc_pwrkey: fix no release event reported
  LF-68-1: input: keyboard: snvs_pwrkey: add clk management
  MLK-22977 input: imx_sc_pwrkey: Correct message format to avoid stack corruption
  input: keyboard: imx_sc: Correct SCFW API parameter to fix NULL pointer crash
  input: keyboard: imx_sc_pwrkey: add PWRON key driver
  ...
2019-12-02 18:02:28 +08:00
a44f25b882 Merge branch 'i2c/next' into next
* i2c/next: (28 commits)
  LF-263-2 i2c: imx: increase PM timeout to avoid operate clk frequently
  LF-263-1 i2c: lpi2c: increase PM timeout to avoid operate clk frequently
  i2c: mux: pca954x: support property idle-state
  dt-bindings: i2c: support property idle-state
  LF-98 i2c: imx: fix the judgement of slave mode in isr
  ...
2019-12-02 18:02:28 +08:00
a83b0af812 Merge branch 'gpio/next' into next
* gpio/next: (12 commits)
  gpio : mpc8xxx : ls1088a/ls1028a edge detection mode bug fixs.
  gpio: mpc8xxx: Don't overwrite default irq_set_type callback
  gpio/mpc8xxx: change irq handler from chained to normal
  MLK-22733 gpio: mxc: use platform_get_irq_optional() to avoid error message
  gpio: pca953x: no need to do regcache sync without vcc regulator
  ...
2019-12-02 18:02:27 +08:00
74c70feb09 Merge branch 'firmware/next' into next
* firmware/next: (15 commits)
  firmware: imx: Allow imx dsp to be selected as module
  LF-202-4 firmware: imx: scu-pd: ignore power domain not owned
  LF-202-2 firmware: imx: add resource management api
  LF-202-1 firmware: imx: scu: use hvc for dom0
  MLK-22984 firmware: imx: imx-scu-irq: fix RCU complains after M4 partition reset
  ...
2019-12-02 18:02:26 +08:00
3e8c4bdbf7 Merge branch 'dts/next' into next
* dts/next: (765 commits)
  arm64: dts: fsl: ls1028a: Disable eno3 and make swp5 the Felix CPU port
  arm64: dts: fsl: ls1028a: Specify that the Felix port 4 runs at 2.5Gbps
  arm64: dts: fsl: Drop "compatible" string from Felix switch
  arm64: dts: fsl: Specify phy-mode for CPU ports
  LF-261: arm64: dts: imx8mq: Set parent clock for IMX8MQ_CLK_AUDIO_AHB
  ...
2019-12-02 18:02:25 +08:00
dbdab14cb0 Merge branch 'dma/next' into next
* dma/next: (52 commits)
  LF-301: dmaengine: imx-sdma: Add once more loading firmware
  LF-246: dmaengine: imx-sdma: correct is_ram_script checking
  dma: caam: fix compilation error
  dma: caam: add dma memcpy driver
  dmaengine: fsl-dpaa2-qdma: Add NXP dpaa2 qDMA controller driver for Layerscape SoCs
  ...
2019-12-02 18:02:24 +08:00
240dd9ec8c Merge branch 'display/next' into next
* display/next: (340 commits)
  LF-94: drm: hdmi: imx: Add hdmi phy video mode valid function
  drm: hdmi: imx8: fix wrong hdmi type with non-SCDC HDMI sinks
  Revert "drm/imx/hdp: fix issue with non-SCDC HDMI sinks"
  drm/bridge: nwl-dsi Correct the DSI init sequence
  gpu: imx: framegen: Use crtc_clock instead of mode clock
  ...
2019-12-02 18:02:24 +08:00
7c2588e590 crypto: dcp - check zero-length input
In case of zero-length input for ablkcipher algorithms, IV copying
accesses invalid memory - due to (last_out_len-AES_BLOCK_SIZE)
turning into a big unsigned offset for last_out_len = 0U.

Since zero-length input is allowed for ablkcipher / skcipher algorithms,
make this case a no-op by returning immediately.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:23 +08:00
1b8b6d74d0 LF-21 crypto: caam - do not reset pointer size from MCFGR register
In commit 'a1cf573ee95 ("crypto: caam - select DMA address size at runtime")'
CAAM pointer size (caam_ptr_size) is changed from
sizeof(dma_addr_t) to runtime value computed from MCFGR register.
Therefore, do not reset MCFGR[PS].

Fixes: a1cf573ee9 ("crypto: caam - select DMA address size at runtime")
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Alison Wang <alison.wang@nxp.com>
Acked-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:23 +08:00
97dc4e4fa4 LF-63-1 crypto: caam - fix SM test init
Commit 77debf316c44 ("LFV-26 crypto: caam - fix Secure Memory driver init")
addressed SM driver initialization and also update SM test.

However, the fix for SM test is insufficient.
There are cases when SM test runs before SM driver, causing a crash
due to uninitialized "priv" pointer being dereferenced.

The fix consists in the following:

1. Since SM test is a "bare" device driver (doesn't sit on any bus),
there is no deferred probing support.
Thus we have no choice (*) but to abort SM tests with a notification.

(*) We don't want to force SM driver running first by means of
init levels etc. Just KISS.

2. SM test driver forced to being built only as a module
Since SM test driver's only goal is to run SM tests, it doesn't make
any sense to be built-in.
Building the driver as a module allows for running the tests
several times if needed (multiple modprobe & rmmod cycles).

Note: from the perspective of wanting to test repetitively, it would
make sense to force module unloading by returning an error code
in the module_init function.
However, this might affect test scripts (due to error code and/or
message output by unsuccessful module loading), so we postpone
this change for now.

Fixes: d02fe599d7d5 ("MLKU-25-3 crypto: caam - add Secure Memory support")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-12-02 18:02:23 +08:00
cd21a001f8 LFV-20 crypto: caam/qi2 - fix typo in algorithm's driver name
Fixes: 8d818c1055 ("crypto: caam/qi2 - add DPAA2-CAAM driver")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2019-12-02 18:02:22 +08:00
4d3a0772bf LFV-26 crypto: caam - fix Secure Memory driver init
SM driver is buggy, since it runs irrespective of the presence of
the caam-sm DT node.
This causes issues on SoCs that have caam HW, but without support
for secure memory.

Let's transform the module in a library, in the same way (and for
the same reasons) we did for the other job ring-dependent drivers
(caamalg, caamhash etc.) in
commit 1b46c90c8e ("crypto: caam - convert top level drivers to libraries")

SM test module is also updated, to run only when needed.

Fixes: 54e3fcf89f97 ("MLKU-25-3 crypto: caam - add Secure Memory support")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2019-12-02 18:02:22 +08:00
4458e5f8bb crypto: caam - add CAAM job ring UIO support
This patch add the support for job ring UIO so
that userspace drivers can have access to the
caam job rings

Signed-off-by: Sandeep Malik <Sandeep.Malik@nxp.com>
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
2019-12-02 18:02:21 +08:00
e480a44196 crypto: caam - add caam_dma device on caam_probe
Dynamically create a platform device for the caam_dma driver
at caam_probe() time.

Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>

Use devres for caam_dma platform device unregistering.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:21 +08:00
0515b79b53 crypto: caam - add functionality used by the caam_dma driver
The caam_dma is a memcpy DMA driver based on the DMA functionality of
the CAAM hardware block. It creates a DMA channel for each JR of the
CAAM. This patch adds functionality that is used by the caam_dma that is
not yet part of the JR driver.

Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:20 +08:00
191ee3ffda crypto: caam/qi2 - add support for TLS 1.0 record
TLS 1.0 descriptors run on SEC 4.x or higher. For now, only
tls10(hmac(sha1),cbc(aes)) algorithm is registered by the driver.

Known limitations:
 - when src == dst - there should be no element in the src scatterlist
   array that contains both associated data and message data.
 - when src != dst - associated data is not copied from source into
   destination.
 - for decryption when src != dst the size of the destination should be
   large enough so that the buffer may contain the decrypted authenc and
padded data.

Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:20 +08:00
ba17612d5e crypto: caam/qi - add support for TLS 1.0 record
TLS 1.0 descriptors run on SEC 4.x or higher.
For now, only tls10(hmac(sha1),cbc(aes)) algorithm
is registered by the driver.

Known limitations:
 - when src == dst - there should be no element in the src scatterlist array
   that contains both associated data and message data.
 - when src != dst - associated data is not copied from source into
   destination.
 - for decryption when src != dst the size of the destination should be
   large enough so that the buffer may contain the decrypted authenc and
   padded data.

Signed-off-by: Tudor Ambarus <tudor-dan.ambarus@nxp.com>
Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
2019-12-02 18:02:19 +08:00
f20e83fe09 crypto: caam - add support for MOVEB command
CHAs of SEC work natively in BE mode. When moving
data to the alignment blocks, swapping is needed
for LE platforms. This is done by means of the MOVEB
command. This patch adds support
to DCL for this command.

Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com>
Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
2019-12-02 18:02:19 +08:00
ad6548c757 crypto: caam/qi2 - add OPR (Order Preservation) support
During driver upstreaming OPR was removed due to lacking users.
Add OPR back, since in LSDK / LSDK-based ADKs there is at least
one user (ASF / VortiQa IPsec).

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:19 +08:00
57a18886f6 crypto: caam/qi2 - add (unused) dpseci API
During driver upstreaming all unused dpseci API was trimmed down.
Add the API back to be in sync with files provided by MC f/w release.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:18 +08:00
db6b4b03c5 MLK-19449 crypto: caam - Change structure type representing DECO MID
The structure partid is not suitable to represent the DECO MID register.

This patch replace partid by masterid which is more appropriate.

Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
(cherry picked from commit 2d8dab7357)
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:18 +08:00
8275436087 MLK-10036 crypto: caam - add support for DSM with Mega/Fast mix on
This patch allows CAAM to be enabled as a wakeup source for the
Mega/Fast mix domain. If CAAM is enabled as a wakeup source, it
will continue to be powered on across Deep Sleep Mode (DSM). This
allows CAAM to be functional after the system resumes from DSM.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
(cherry picked from commit 290744e3b40a563319324e234fa5a65b49fd4d82)
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 0bf9c6f84f)

Changed commit headline prefix.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:18 +08:00
0f77eb0292 MLK-19801-2 crypto: caam - add support of tagged keys in caamalg
A tagged key is a key which has been tagged with metadata
using tag_object.h API.

We add the support for these keys to caamalg.

For each algo of caamalg which supports tagged keys , it is done by:
 - Creating a modified version of the algo
 - Registering the modified version
 - When the modified transform is used, it gets
   the load parameter of the key.

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
(cherry picked from commit 88dee97d985890dbf37cafa7934c476d0ecfd0b3)
(Vipul: Fixed merge conflicts)
Conflicts:
	drivers/crypto/caam/caamalg.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 5adebac40a)

-port from ablkcipher to current skcipher implementation
-since in linux-imx true key_inline was always true: a. simplify
the descriptors and b. use key_cmd_opt to differentiate b/w tk and non-tk
cases
-change commit headline prefix

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:17 +08:00
1a9ab669c1 MLK-19801-1 crypto: caam - add tag functionality
Add functions to tag an object with metadata(configuration).

It is possible to:
 - create metadata:
	- init_tag_object_header
	- init_blackey_conf
	- set_tag_object_conf
 - retrieve metadata:
	- get_tag_object_conf
	- get_blackey_conf

The API expects an object to be a space a memory
with an address and a size.

The implementation of the tag is currently exposed
but users shouldn't access it directly, they should
use the functions provided.

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
(cherry picked from commit ebbb132da8e7f9de7f3d375eff8d87f684feb1eb)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 8b6f6b4474)

-make tag functionality depend on JR
-change commit headline prefix

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:17 +08:00
e0f7d41a2e MLKU-25-3 crypto: caam - add Secure Memory support
This is a squash of the following i.MX BSP commits
(rel_imx_4.19.35_1.1.0_rc2)

1.  ae8175a3f1 ("MLK-9710-10 Add CCM defs for FIFO_STORE instruction")
2.  9512280d06 ("MLK-9769-11 Add SM register defs, and expanded driver-private storage.")
3.  a9dc44de81 ("MLK-9769-10 Add Blob command bitdefs.")
4.  8f6a17b419 ("ENGR00289885 [iMX6Q] Add Secure Memory and SECVIO support.")
5.  c7d4f9db10 ("MLK-9710-11 Add internal key cover and external blob export/import to prototype SM-API")
6.  568e449edf ("MLK-9710-12 Adapt sm_test as a black-key handling example")
7.  f42f12d9cb ("MLK-9710-13 Correct size in BLOB_OVERHEAD definition")
8.  022fc2b33f ("MLK-9710-14 Un-pad cache sizes for blob export/import")
9.  8d3e8c3c4d ("MLK-9710-15 Correct size of padded key buffers")
10. 997fb2ff88 ("MLK-9710-5 Unregister Secure Memory platform device upon shutdown")
11. 5316249198 ("MLK-10897-1 ARM: imx7d: Add CAAM support for i.mx7d")
12. 07566f42a4 ("MLK-11103 Missing register in Secure memory configuration v1")
13. 3004636304 ("MLK-12302 caam: Secure Memory platform device creation crashes")
14. 0e6ed5a819 ("MLK-13779 crypto: caam - initialize kslock spinlock")
15. b1254b6b5f ("Add missing NULL checks in CAAM sm")
16. 61f57509bc ("MLK-17992: caam: sm: Fix compilation warnings")
17. 41cf3d4c58 ("MLK-15473-1: crypto: caam: Add CAAM driver support for iMX8 soc family")
18. bb87424812 ("MLK-17253-1: crypto: caam: Fix computation of SM pages addresses")
19. 308796dfae ("MLK-17253-2: crypto: caam: Use correct memory function for Secure Memory")
20. ba2cb6b5fb ("MLK-17732-2: SM store: Support iMX8QX and iMX8QM")
21. de710d376a ("MLK-17674-1: sm_store remove CONFIG_OF")
22. cfcae64743 ("MLK-17674-2: CAAM SM : get base address from device tree")
23. f49ebbd5ee ("MLK-17992: caam: sm: Fix compilation warnings")
24. 345ead4338 ("MLK-17841: crypto: caam: Correct bugs in Secure Memory")
25. c17811f3ff ("MLK-18082: crypto: caam: sm: Fix encap/decap function to handle errors")
26. 41bcba1d4c ("MLK-18082: crypto: caam: sm: Fix descriptor running functions")
27. b7385ab947 ("MLK-20204: drivers: crypto: caam: sm: Remove deadcode")
28. 1d749430cb ("MLK-20204: drivers: crypto: caam: sm: test: Dealloc keyslot properly")
29. 6a5c2d9d35 ("crypto: caam - lower SM test verbosity")
30. 1a6bc92c0c ("MLK-21617: crypto: caam - update SM test error handling")

Signed-off-by: Dan Douglass <dan.douglass@nxp.com>
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Steve Cornelius <steve.cornelius@nxp.com>
Signed-off-by: Octavian Purdila <octavian.purdila@nxp.com>
Signed-off-by: Radu Solea <radu.solea@nxp.com>
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com>

that have been reworked:

4.
-make SM depend on JR
-enable SM, SECVIO only on i.MX SoCs
-fix resource leak - add off_node_put() where needed

Split commit in three:
1 - SNVS/SECVIO driver
2 - Secure Memory driver
3 - DT changes

11.
Clock handling dropped - logic already upstream.

17.
Keep only Secure Memory related changes.
Changes related to page 0 registers have been added previously.
Other changes are dropped.

21.
Always use first jr in ctrlpriv->jr[] array to access registers
in page 0 (aliased in jr page), irrespective of SCU presence.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:16 +08:00
f50dd756a0 MLKU-38-3 crypto: caam - add SNVS / SECVIO support
This is a squash of the following i.MX BSP commits
(rel_imx_4.19.35_1.1.0_rc2)

1. 8f6a17b419 ("ENGR00289885 [iMX6Q] Add Secure Memory and SECVIO support.")
2. 8433c811e9 ("MLK-9710-18 snvs - make SECVIO module device tree correct")
3. 35bbc34e99 ("MLK-9769-23 Replace SECVIO of_irq_to_resource() with irq_of_parse_and_map()")
4. 3ac6edcd92 ("MLK-11360-01 crypto: caam_snvs: add snvs clock management")
5. 9d9ca7a03e ("MLK-11922 i.mx6: Linux 3.14.28 CAAM & SNVS enabled by default. JTAG, DS-5 attachment causes exceptions")
6. fcdaabf1bb ("MLK-17412-01: Fix secvio driver to have same driver name as DTS")

Signed-off-by: Dan Douglass <dan.douglass@nxp.com>
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Steve Cornelius <steve.cornelius@nxp.com>
Signed-off-by: Fugang Duan <andy.duan@nxp.com>
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>

that have been reworked:

1.
-make SM depend on JR
-enable SM, SECVIO only on i.MX SoCs
-fix resource leak - add off_node_put() where needed

Split commit in three:
- SNVS/SECVIO driver
- Secure Memory driver
- DT changes

3.
JR changes dropped - no longer needed, already upstream in
commit 549077d7d8 ("crypto: caam - check irq_of_parse_and_map for errors")

4.
Split the patch in two:
-DT bindings changes
-driver changes

5.
Fixed conflicts in imx7d.dtsi - added caam_sm and irq_sec_vio nodes.

Split commit in 3:
-SECVIO/SNVS driver changes
-SECVIO/SNVS DT changes
-Secure Memory DT changes

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:16 +08:00
6aa9b70c99 MLKU-114-3 crypto: caam - OP-TEE firmware support
caam driver needs to be aware of OP-TEE f/w presence, since some things
are done differently:

1. there is no access to controller's register page (note however that
some registers are aliased in job rings' register pages)

It's worth mentioning that due to this, MCFGR[PS] cannot be read
and driver assumes MCFGR[PS] = b'0 - engine using 32-bit address pointers.

This is in sync with the fact that:
-all i.MX SoCs currently use MCFGR[PS] = b'0
-only i.MX OP-TEE use cases don't allow access to controller register page

Note: When DN OP-TEE will start enforcing the same policy,
this solution will stop working and information about caam configuration
will have to deduced in some other way.

2. as a consequence of "1.", part of the initialization is moved in
other f/w (TF-A etc.), e.g. RNG initialization

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:16 +08:00
eaf297a711 MLKU-114-2 crypto: caam - SCU firmware support
Some i.MX8 processors, e.g. i.MX8QM (QM, QP), i.MX8QX (QXP, DX) have a
System Controller Firmware (SCFW) running on a dedicated Cortex-M core
that provides power, clock, and resource management.

caam driver needs to be aware of SCU f/w presence, since some things
are done differently:

1. clocks are under SCU f/w control and are turned on automatically

2. there is no access to controller's register page (note however that
some registers are aliased in job rings' register pages)

It's worth mentioning that due to this, MCFGR[PS] cannot be read
and driver assumes MCFGR[PS] = b'0 - engine using 32-bit address pointers.
This is in sync with the limitation imposed by the
SECO (Security Controller) ROM and f/w running on a dedicated Cortex-M.

3. as a consequence of "2.", part of the initialization is moved in
other f/w (SCU, TF-A etc.), e.g. RNG initialization

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:15 +08:00
35688521a2 MLKU-114-1 crypto: caam - reduce page 0 regs access to minimum
TODO:

1. if of_property_read_u32_index(,,index=0,) is to be used,
DT bindings (fsl-sec4.txt) should be updated to mandate for
-checked that all existing DTs are configured like this
-this might create problems in the future, if DTs are needed where
JR DT nodes would exist without the controller DT node
(directly on simple bus etc.)

2. MCFGR (ctrl->mcr)
How to determine caam_ptr_sz if MCFGR is not accesible?

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:15 +08:00
ec4e09e526 MLKU-123-1 crypto: caam - add support for i.mx8mm, mn
TODO:

1. clarify logic wrt. virtualization and DECORSR - see e-mail thread:
"Register-based interface - DECORSR with virtualization disabled"

2. check whether the clocks are identical for all mScale parts,
and if they do use a single "i.MX8M*" entry in clocks array.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:14 +08:00
95cbc51050 MLK-9769-8 crypto: caam - add a test for the RNG
Freescale's CAAM includes a Random Number Generator.  This change adds
a kernel configuration option to test the RNG's capabilities via the
hw_random framework.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 05fba1bb85)

-fixed compilation warning:
drivers/crypto/caam/caamrng.c:271:2: warning: format '%d' expects argument of type 'int', but argument 2 has type 'size_t' [-Wformat=]

-changed commit headline

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:14 +08:00
434576d02b MLK-9769-9 crypto: caam - adjust RNG timing to support more devices
Adjust RNG timing parameters to support more i.MX6 devices.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 57eabb6384)

Changed commit headline prefix.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:14 +08:00
8935c53d9f MLK-19053 crypto: caam - RNG4 TRNG errata
The TRNG as used in RNG4, used in CAAM has a documentation issue. The
effect is that it is possible that the entropy used to instantiate the
DRBG may be old entropy, rather than newly generated entropy. There is
proper programming guidance, but it is not in the documentation.

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit ea2b30c817)

-ported to RNG initialization in ctrl.c
-changed commit headline

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:13 +08:00
5898437214 MLK-20204 crypto: caam - remove deadcode on 32-bit platforms
When building on a platform with a 32bit DMA address, taking the
upper 32 bits makes no sense.

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
(cherry picked from commit d3346aaa3f)

-replace ifdeffery with IS_ENABLED() macro
-change commit headline prefix

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:13 +08:00
3c029f7456 MLK-9769-1 crypto: caam/jr - remove incorrect comment from job ring module
caam_jr_register() function is no longer part of the driver since
commit 6dad41158d ("crypto: caam - Remove unused functions from Job Ring")

This patch removes a comment referencing the function.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 96c125b896)

-changed commit headline prefix
-added details about commit removing caam_jr_register()

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:13 +08:00
d64507e262 crypto: caam - populate platform devices last
Move the call to devm_of_platform_populate() at the end of
caam_probe(), so we won't try to add any child devices until all of
the initialization is finished successfully.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 51d13aaf59)
2019-12-02 18:02:12 +08:00
db750c50dd crypto: caam - use devres to populate platform devices
Use devres to de-initialize the RNG and drop explicit de-initialization
code in caam_remove().

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 1a1c4f0044)
2019-12-02 18:02:12 +08:00
084e6c0e15 crypto: caam - use devres to de-initialize QI
Use devres to de-initialize the QI and drop explicit de-initialization
code in caam_remove().

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit f414de2e2f)
2019-12-02 18:02:11 +08:00
4cc5f13254 crypto: caam - use devres to de-initialize the RNG
Use devres to de-initialize the RNG and drop explicit de-initialization
code in caam_remove().

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit e57acaf0df)
2019-12-02 18:02:11 +08:00
f94fa4a5be crypto: caam - use devres to remove debugfs
Use devres to remove debugfs and drop corresponding
debugfs_remove_recursive() call.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit eceb5daf9e)
2019-12-02 18:02:11 +08:00
eb5e94d462 crypto: caam - use devres to unmap memory
Use devres to unmap memory and drop corresponding iounmap() call.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 66e93b2807)
2019-12-02 18:02:10 +08:00
e2c5540a18 crypto: caam - use mapped_{src,dst}_nents for descriptor
The mapped_{src,dst}_nents _returned_ from the dma_map_sg
call (which could be less than src/dst_nents) have to be
used to generate the job descriptors.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit eff9771d51)
2019-12-02 18:02:10 +08:00
8c3f97ab23 crypto: tcrypt - include rsa test
Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Tudor Ambarus <tudor-dan.ambarus@nxp.com>
2019-12-02 18:02:09 +08:00
a9278aadeb crypto: add support for TLS 1.0 record encryption
This patch adds kernel support for encryption/decryption of TLS 1.0
records using block ciphers. Implementation is similar to authenc in the
sense that the base algorithms (AES, SHA1) are combined in a template to
produce TLS encapsulation frames. The composite algorithm will be called
"tls10(hmac(<digest>),cbc(<cipher>))". The cipher and hmac keys are
wrapped in the same format used by authenc.c.

Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-12-02 18:02:09 +08:00
749f4d590f Merge branch 'config/next' into next
* config/next: (194 commits)
  LF-238-1 ARM: configs: imx_v6_v7_defconfig: enable USB ACM
  MLK-21599-2 arm64: defconfig: FORCE_MAX_ZONEORDER default 14 for imx
  LF-210 arm64: defconfig: add imx fragment config
  LF-238 ARM64: defconfig: enable USB ACM
  LF-45 ARM64: defconfig: build as module for synaptics dsx touch
  ...
2019-12-02 18:02:08 +08:00
9872ac8647 Merge branch 'clock/next' into next
* clock/next: (122 commits)
  LF-279 clk: imx: scu: ignore cpu resources when do owned check
  clk: s32v234: Enable FlexCAN clock
  clk: s32v234: Add definitions for CAN clocks
  clk: imx: Add missing mipi1_dsi_phy_clk
  LF-202-3 clk: imx: scu: ignore clks not owned
  ...
2019-12-02 18:02:07 +08:00
1e188020fb Merge branch 'capture/next' into next
* capture/next: (68 commits)
  LF-237 media: ov5640_mipi: fix regulator dump when i2c access for camera fail
  staging: media: imx: add g_parm/s_parm for imx8 capture device
  staging: media: imx: enable ISI for imx8mn platform
  media: staging: imx: add media device driver support for IMX8
  LF-115: media: i2c: ov5640: fix enumerate capture mode issue
  ...
2019-12-02 18:02:07 +08:00
80c4b9b705 Merge branch 'can/next' into next
* can/next: (29 commits)
  can: flexcan: Add S32V234 support to FlexCAN driver
  can: flexcan: add CAN wakeup function for i.MX8
  can: flexcan: change the way of stop mode acknowledgment
  can: flexcan: fix deadlock when using self wakeup
  can: flexcan: add LPSR mode support for i.MX7D
  ...
2019-12-02 18:02:07 +08:00
371f523934 Merge branch 'backlight/next' into next
* backlight/next:
  MLK-12932-01: pwm backlight: Add fb name check feature
2019-12-02 18:02:06 +08:00
45efd194bf Merge branch 'audio/next' into next
* audio/next: (528 commits)
  LF-276: ASoC: fsl_easi: constrain period size for edma case
  LF-215: ASoC: fsl_rpmsg_i2s: Enable WQ_FREEZABLE for workqueue
  ASoC: SOF: Read tplg filename from board descriptor
  ASoC: SOF: Update fw_filename from board description
  ASoC: SOF: Allow probe to continue when we have an actual codec
  ...
2019-12-02 18:02:06 +08:00
96aa3bc2ff Merge branch 'arch/next' into next
* arch/next: (81 commits)
  MLK-21599-1 arm64: Kconfig: Make FORCE_MAX_ZONEORDER configurable
  LF-171 ARM: imx: Add cpu type check for imx6ulz in msl code
  LF-176 ARM: imx: mach-imx6q: Revert "ARM: imx: correct the enet_clk_ref clock string"
  drivers: soc: fsl: add qixis driver
  Add APIs to setup HugeTLB mappings for USDPAA
  ...
2019-12-02 18:02:06 +08:00
8756248f28 Merge branch 'adc/next' into next
* adc/next:
  iio: adc: Add imx8qxp adc driver support
  MLK-11476 iio: adc: Enable i.MX6SX adc driver.
2019-12-02 18:02:05 +08:00
8c64fabeb0 Merge branch 'core' into next
* core: (8 commits)
  Revert "jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()"
  of: of_reserved_mem: Ensure cma reserved region not cross the low/high memory
  mm: Re-export ioremap_page_range
  nand: raw: workaround for EDO high speed mode
  cgroup/bfq: revert bfq.weight symlink change
  ...
2019-12-02 18:02:05 +08:00
0211ada0b3 Merge branch 'base' into next
* base: (7 commits)
  perf/imx_ddr: Dump AXI ID filter info to userspace
  perf/imx_ddr: Add driver for DDR PMU in i.MX8MPlus
  perf/imx_ddr: Add enhanced AXI ID filter support
  bindings: perf: imx-ddr: Add new compatible string
  docs: perf: Add imx-ddr to documentation index
  ...
2019-12-02 18:02:05 +08:00
8baeb551e7 Merge remote-tracking branch 'origin/usb/typec' into usb/next
* origin/usb/typec: (11 commits)
  usb: typec: tcpci: add pm ops to disable irq
  MLK-16013-43 usb: typec: tcpm: add extcon support for data role switch
  MLK-16013-17 usb: typec: tcpm: set cc when attached
  MLK-22452-2 usb: typec: mux: add nxp cbtl04gp super speed mux compatible
  MLK-22452-1 usb: typec: mux: add reset gpio for gpio switch
  ...
2019-12-02 18:02:02 +08:00
b4e4776fd6 Merge remote-tracking branch 'origin/usb/phy' into usb/next
* origin/usb/phy: (14 commits)
  Doc: ABI: add usb charger uevent
  usb: phy: show USB charger type for user
  MLK-19850-1 usb: phy: mxs: add DCD implementation
  MLK-16576 usb: phy: mxs: set hold_ring_off for USB2 PLL power up
  MLK-14947-2 usb: phy: add mxs phy driver dependency for ARM64
  ...
2019-12-02 18:02:02 +08:00
7866db2c15 Merge remote-tracking branch 'origin/usb/dwc3' into usb/next
* origin/usb/dwc3: (10 commits)
  usb: dwc3: Add cache type configuration support
  usb: dwc3: Add chip-specific compatible string
  MLK-22675 usb: dwc3: host: disable park mode
  usb: dwc3: Add workaround for host mode VBUS glitch when boot
  usb: dwc3: Add avoiding vbus glitch happen during xhci reset
  ...
2019-12-02 18:02:01 +08:00
242101792d Merge remote-tracking branch 'origin/usb/core' into usb/next
* origin/usb/core: (11 commits)
  MLK-22099 usb: host: xhci: do warm reset for link state rxdect
  MLK-16604-1 usb: host: xhci-plat: add XHCI_MISSING_CAS quirk
  MLK-16604-3 dt-bindings: usb: xhci: add usb3-resume-missing-cas property
  MLK-9829 usb: core: print suggested message if failed to get device descriptor
  MLK-18794-1 usb: host: xhci: add .bus_suspend override
  ...
2019-12-02 18:02:01 +08:00
c74b7d2dfe Merge remote-tracking branch 'origin/usb/chipidea-legacy' into usb/next
* origin/usb/chipidea-legacy:
  usb: gadget: Correct NULL pointer checking in fsl gadget
  usb: fsl: Remove unused variable
2019-12-02 18:02:00 +08:00
ce5fa8ff67 Merge remote-tracking branch 'origin/usb/chipidea' into usb/next
* origin/usb/chipidea: (51 commits)
  MLK-22752-3 usb: chipidea: imx: pinctrl for HSIC is optional
  MLK-22752-2 usb: chipidea: imx: refine the error handling for hsic
  MLK-22752-1 usb: chipidea: imx: change hsic power regulator as optional
  MLK-21900-2 usb: chipidea: imx: turn off vbus comparator when suspend
  MLK-21900-1 usb: chipidea: imx: group usbmisc operations for PM
  ...
2019-12-02 18:01:59 +08:00
daf83a84eb Merge remote-tracking branch 'origin/usb/cdns3' into usb/next
* origin/usb/cdns3: (89 commits)
  LF-252 usb: cdns3: gadget: fix the issue for DMA scatter buffer list
  MLK-22878 usb: cdns3: gadget: add imx8qxp C0 support
  MA-15789-1 usb: cdns3: gadget: move USB interrupt handling to thread irq
  MLK-22527-2 usb: cdns3: quit if the port is woken up during suspending
  MLK-22527-1 usb: cdns3: gadget: quit functional halt if there are pending requests
  ...
2019-12-02 18:01:59 +08:00
f7bb9c8545 Merge remote-tracking branch 'origin/spi/qspi' into spi/next
* origin/spi/qspi:
  spi: spi-fsl-qspi: Introduce variable to fix different invalid master Id
  dt-bindings: spi: spi-fsl-qspi: Add bindings of ls1088a and ls1012a
  spi: spi-fsl-qspi: dynamically alloc AHB memory for QSPI
2019-12-02 18:01:58 +08:00
3cd5af855f Merge remote-tracking branch 'origin/spi/lpspi' into spi/next
* origin/spi/lpspi:
  MLK-21520-3 spi: lpspi: remove fsl_lpspi->chipselect
  MLK-21520-2 spi: lpspi: add multi SS support in PIO mode
  MLK-21520-1 spi: lpspi: add NULL check when probe device
2019-12-02 18:01:58 +08:00
4f813a932f Merge remote-tracking branch 'origin/spi/fspi' into spi/next
* origin/spi/fspi:
  spi: spi-nxp-fspi: Enable the Octal Mode in MCR0
  MLK-21960-2: spi: fspi: dynamically alloc AHB memory
  MLK-21960-1: spi: fspi: enable fspi on imx8qxp and imx8mm
2019-12-02 18:01:57 +08:00
368e652ca3 Merge remote-tracking branch 'origin/spi/cspi' into spi/next
* origin/spi/cspi: (6 commits)
  MLK-10404-1 spi: spi-imx: use XCH mode even in DMA mode
  MLK-11405 spi: imx : sets spi IOMUX to default state
  MLK-9817 spi: imx: convert all clk_enable to clk_prepare_enable
  dt-bindings: spi: imx: add i.mx6ul to state errata fixed
  spi: imx: remove ERR009165 workaround on i.mx6ul
  ...
2019-12-02 18:01:57 +08:00
e09f1585c5 Merge remote-tracking branch 'origin/pm/qoriq' into pm/next
* origin/pm/qoriq:
  drivers/soc/fsl: add EPU FSM configuration for deep sleep
  fsl_pmc: update device bindings
  soc: fsl: add RCPM driver
  Documentation: dt: binding: fsl: Add 'little-endian' and update Chassis define
2019-12-02 18:01:54 +08:00
d80b3c114b Merge remote-tracking branch 'origin/pm/imx' into pm/next
* origin/pm/imx: (49 commits)
  MLK-22992 firmware: imx: scu-pd: fix wu_num
  MLK-22986-1: soc: imx: gpc: add ldo-bypass
  firmware: imx: scu-pd: correct edma0 channel number
  imx: scu-pd: add vpu-enc1 power domains for imx8qm
  cpufreq: imx-cpufreq-dt: Correct i.MX8MN's default speed grade value
  ...
2019-12-02 18:01:53 +08:00
280a74a100 Merge remote-tracking branch 'origin/pm/core' into pm/next
* origin/pm/core:
  PM: wakeup: Add routine to help fetch wakeup source object.
2019-12-02 18:01:53 +08:00
447e002898 Merge remote-tracking branch 'origin/pcie/mobiveil' into pcie/next
* origin/pcie/mobiveil: (14 commits)
  misc: pci_endpoint_test: Add the layerscape PCIe GEN4 EP device support
  PCI: mobiveil: Add workaround for unsupported request error
  PCI: mobiveil: Add PCIe Gen4 EP driver for NXP Layerscape SoCs
  dt-bindings: Add DT binding for PCIE GEN4 EP of the layerscape
  PCI: mobiveil: Add the EP driver support
  ...
2019-12-02 18:01:51 +08:00
8a60512601 Merge remote-tracking branch 'origin/pcie/dwc' into pcie/next
* origin/pcie/dwc: (22 commits)
  LF-128 PCI: imx: turn off the clocks and regulators when link is down
  PCI: imx: add the imx pcie ep verification solution
  MLK-22995: pci: controller: dwc: pci-imx6: fix regulator warning complains on i.mx6sx-sdb
  PCI: dwc: fix the msi failure after pm operations
  Revert "MLK-11484-3 PCI: designware: Refine setup_rc and add msi data restore"
  ...
2019-12-02 18:01:51 +08:00
1b27df2693 Merge remote-tracking branch 'origin/pcie/core' into pcie/next
* origin/pcie/core:
  PCI: Disable MSI on marvel 88w9098 and 88w8997 chips
  MLK-20716 PCI: add quirk for cyw4356 to disable D3 mode
  MLK-20684 PCI: Disable MSI on CYW4356 and CYW4359 chips
  pci:add support aer/pme interrupts with none MSI/MSI-X/INTx mode
2019-12-02 18:01:51 +08:00
14b8ba8dec Merge remote-tracking branch 'origin/mxc/vpu' into mxc/next
* origin/mxc/vpu: (44 commits)
  LF-80:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:clear eos flag when output streamoff
  MLK-22999 mxc: vpu_malone: release debugfs after open to avoid memory leak
  MLK-22991 mxc: vpu_malone vpu_windsor: check is vpu poweroff when suspend
  MLK-22963 mxc vpu_windsor: fix call vzalloc during spinlock
  MLK-22945 mxc vpu_malone: disable decode ctx before release it.
  ...
2019-12-02 18:01:29 +08:00
e53be1f76e Merge remote-tracking branch 'origin/mxc/sim' into mxc/next
* origin/mxc/sim: (23 commits)
  sim: emvsim: add multi power domain support
  MLK-22217 mxc: emvsim: add value adjustment for cwt/bwt timer
  MLK-22216 mxc: emvsim: last character need be transmitted separately with no guard time
  MLK-22215 mxc: emvsim: correct irq mask and clear irq status before receiving
  MLK-22214 mxc: emvsim: clean up the code in ATR stage
  ...
2019-12-02 18:01:28 +08:00
e2be60b651 Merge remote-tracking branch 'origin/mxc/mlb' into mxc/next
* origin/mxc/mlb: (17 commits)
  MLK-23000-1 mxc: mlb: fix kernel dump when use gen_pool_dma_alloc
  mxc mlb: Allow compilation on imx8
  MLK-22071-3 Document: mlb: add imx8qxp compatible string
  MLK-15997 Document: mlb: add document for mlb
  mxc: mlb: fix interrupt rw lock dead lock
  ...
2019-12-02 18:01:25 +08:00
c282e8f9c1 Merge remote-tracking branch 'origin/mxc/ipu' into mxc/next
* origin/mxc/ipu: (6 commits)
  MLK-22399 mxc IPUv3: cpmem: Get 0 u/v_offset in __ipu_ch_offset_calc() for some pfmts
  mxc: IPU3: Fix not including uapi/linux/sched/types.h
  media: platform: mxc: output: Forward IPUv3 V4L2 output driver from imx_4.19.y
  mxc: IPU3: Forward IPUv3 common driver from imx_4.19.y kernel
  MLK-21876-13 ipu: add uapi headfile for yocto build pass
  ...
2019-12-02 18:01:24 +08:00
ca1ee1da8c Merge remote-tracking branch 'origin/mxc/hdmi' into mxc/next
* origin/mxc/hdmi:
  mxc: hdmi-cec: Add imx6 hdmi cec driver
  driver: mfd: hdmi: Add hdmi core driver
2019-12-02 18:01:23 +08:00
775ac33c28 Merge remote-tracking branch 'origin/mxc/gpu' into mxc/next
* origin/mxc/gpu: (27 commits)
  LF-84 [#imx-1834] remove gpu coherent_dma_mask setting
  MGS-5245 [#imx-1755] [8MN_EVK] VTK: fix the gpu dump when enable vProfile
  MGS-5307 gpu: integrate 6.4.0.p2 driver
  QSDK-5959 [#ccc] update the platform driver to support layerscape soc
  MGS-5261 [#imx-1771] fix dummy draw hang for 8MM GPU
  ...
2019-12-02 18:01:23 +08:00
cc1abcec4b Merge remote-tracking branch 'origin/input/touch' into input/next
* origin/input/touch: (12 commits)
  MLK-19751 input: synaptics_dsx: free touch irq when touch suspend
  MLK-18816-2 input/touch: do not clear touch interrupt when enable irq
  MLK-17829 touchscreen: Add synaptics_dsx S3508 i2c touch driver
  MLK-14392-1 input: touch: add focaltech touch screen support
  MLK-18636 Input: egalax_ts: Restore call to i2c_set_clientdata
  ...
2019-12-02 18:01:20 +08:00
d30af07fb3 Merge remote-tracking branch 'origin/input/keypad' into input/next
* origin/input/keypad: (6 commits)
  LF-175: input: keyboard: imx_sc_pwrkey: fix no release event reported
  LF-68-1: input: keyboard: snvs_pwrkey: add clk management
  MLK-22977 input: imx_sc_pwrkey: Correct message format to avoid stack corruption
  input: keyboard: imx_sc: Correct SCFW API parameter to fix NULL pointer crash
  input: keyboard: imx_sc_pwrkey: add PWRON key driver
  ...
2019-12-02 18:01:20 +08:00
79a2871019 Merge remote-tracking branch 'origin/dts/s32' into dts/next
* origin/dts/s32: (12 commits)
  arm64: dts: s32v234: Add FlexCAN nodes for EVB and SBC
  arm64: dts: s32v234-evb: Use macros for MSCR and config pairs
  arm64: dts: s32v234: Initial ethernet support
  arm64: dts: s32v234: Add all mc_cgm nodes
  arm64: dts: Initial s32v234-sbc support
  ...
2019-12-02 18:01:18 +08:00
3c1f476273 Merge remote-tracking branch 'origin/dts/qoriq' into dts/next
* origin/dts/qoriq: (105 commits)
  arm64: dts: fsl: ls1028a: Disable eno3 and make swp5 the Felix CPU port
  arm64: dts: fsl: ls1028a: Specify that the Felix port 4 runs at 2.5Gbps
  arm64: dts: fsl: Drop "compatible" string from Felix switch
  arm64: dts: fsl: Specify phy-mode for CPU ports
  arm64: dts: ls1028a: Add DP DT nodes
  ...
2019-12-02 18:01:17 +08:00
b62cc9d2c6 Merge remote-tracking branch 'origin/dts/imx' into dts/next
* origin/dts/imx: (648 commits)
  LF-261: arm64: dts: imx8mq: Set parent clock for IMX8MQ_CLK_AUDIO_AHB
  LF-235: arm64: dts: imx8qm: disable all hdmi ss modules defaultly
  LF-257-02 dts: imx6ull: change the usdhc root clock to 396MHz
  LF-257-01 ARM: dts: imx6ull/ulz-14x14-evk: update usdhc1 pin group
  LF-270 ARM64: dts: imx8mq.dtsi: set the IMX8MQ_CLK_NAND_USDHC_BUS clock rate
  ...
2019-12-02 18:01:17 +08:00
52e3d2b6ed Merge remote-tracking branch 'origin/dma/sdma' into dma/next
* origin/dma/sdma: (23 commits)
  LF-301: dmaengine: imx-sdma: Add once more loading firmware
  LF-246: dmaengine: imx-sdma: correct is_ram_script checking
  MLK-23005: dmaengine: imx-sdma: correct data size of channel context
  MLK-22972 dmaengine: imx-sdma: correct the script number for v3
  dma: imx-sdma: Add pm_ops to support suspend & resume
  ...
2019-12-02 18:01:15 +08:00
5ebe728cc7 LF-301: dmaengine: imx-sdma: Add once more loading firmware
In case 60 seconds maybe not enough for Yocto loading sdma firmware on
some poor performance chips such as i.mx6sll in nfs case, add another
round to load firmware.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-12-03 02:06:10 +08:00
11adda239a Merge remote-tracking branch 'origin/dma/qdma' into dma/next
* origin/dma/qdma:
  dmaengine: fsl-dpaa2-qdma: Add NXP dpaa2 qDMA controller driver for Layerscape SoCs
  dmaengine: fsl-dpaa2-qdma: Add the DPDMAI(Data Path DMA Interface) support
2019-12-02 18:01:15 +08:00
484805c54b Merge remote-tracking branch 'origin/dma/mxsdma' into dma/next
* origin/dma/mxsdma:
  dma: mxs-dma: change the way to register the probe function
  MLK-19897: dma: mxs-dma: filter out the unrelated dma channels
2019-12-02 18:01:14 +08:00
c0280c514d Merge remote-tracking branch 'origin/dma/edma' into dma/next
* origin/dma/edma: (23 commits)
  MLK-22909 dmaengine: fsl-edma-v3: clear interrupt coming after channel terminated
  MLK-22302-2: dmaengine: fsl-edma-v3: fix build warning with CONFIG_PM_SLEEP=n
  MLK-22284-2 dmaengine: fsl-edma-v3: check dma description before register touch
  MLK-22284-1 dmaengine: fsl-edma-v3: add power domains for each channel
  MLK-21443: dmaengine: fsl-edma-v3: clear pending irq before request irq
  ...
2019-12-02 18:01:14 +08:00
f0970fef74 Merge remote-tracking branch 'origin/dma/caam' into dma/next
* origin/dma/caam:
  dma: caam: fix compilation error
  dma: caam: add dma memcpy driver
2019-12-02 18:01:14 +08:00
49fcbd44f5 Merge remote-tracking branch 'origin/display/prefetch' into display/next
* origin/display/prefetch:
  MLK-21378-2 gpu: imx: Add imx8_dprc support
  MLK-21378-1 gpu: imx: Add imx8_prg support
  gpu: Move ipu-v3 to imx folder
  drm/imx: Revert a patch which merges imx-drm-core and ipuv3-crtc in one module
2019-12-02 18:01:13 +08:00
a557a5b86c Merge remote-tracking branch 'origin/display/pc' into display/next
* origin/display/pc:
  gpu: imx: Add imx8 pixel combiner support
  gpu: Move ipu-v3 to imx folder
  drm/imx: Revert a patch which merges imx-drm-core and ipuv3-crtc in one module
2019-12-02 18:01:12 +08:00
f73b88b974 Merge remote-tracking branch 'origin/display/panel' into display/next
* origin/display/panel:
  drm/panel: rm67191: Add dev_err for reset gpio
  drm/panel: simple: Add support for JDI TX26D202VM0BWA panel
  dt-bindings: display: Add JDI TX26D202VM0BWA LCD panel bindings
  drm/panel: rm67191: Remove CLOCK_NON_CONTINUOUS flag
2019-12-02 18:01:11 +08:00
356e74dcf7 Merge remote-tracking branch 'origin/display/nwl-dsi' into display/next
* origin/display/nwl-dsi: (14 commits)
  drm/bridge: nwl-dsi Correct the DSI init sequence
  drm/bridge: nwl-dsi: Fix find_panel_or_bridge
  drm/bridge: nwl-dsi: Add support for 8QM and 8QXP
  drm/bridge: nwl-dsi: Add support for component framework
  phy: imx8-mipi-dphy: Add support for 8QM and 8QXP
  ...
2019-12-02 18:01:10 +08:00
34ac946b63 Merge remote-tracking branch 'origin/display/mxsfb' into display/next
* origin/display/mxsfb: (14 commits)
  drm/mxsfb: Add support for live pixel format change
  drm/mxsfb: Add support for horizontal stride
  drm/mxsfb: Clear OUTSTANDING_REQS bits
  drm/mxsfb: Improve the axi clock usage
  drm/mxsfb: Update mxsfb to support LCD reset
  ...
2019-12-02 18:01:09 +08:00
ce491fc5a6 Merge remote-tracking branch 'origin/display/mali' into display/next
* origin/display/mali:
  drm/arm/mali-dp: Add display QoS interface configuration for Mali DP500
  dt/bindings: display: Add optional property node define for Mali DP500
2019-12-02 18:01:09 +08:00
d8a6ae95b3 Merge remote-tracking branch 'origin/display/ldb' into display/next
* origin/display/ldb: (11 commits)
  drm/imx: ldb: Add dual channel mode support for i.MX8QXP
  dt-bindings: display: imx: ldb: Add i.MX8qxp LDB dual channel mode documentation
  dt-bindings: display: imx: ldb: Correct pixel and bypass clock description
  drm/imx: ldb: Add system power management support
  MLK-21876-23 drm/imx: ldb: fix incorrect color displayed for mx8qxp
  ...
2019-12-02 18:01:08 +08:00
4b8a6afa43 Merge remote-tracking branch 'origin/display/lcdif' into display/next
* origin/display/lcdif: (32 commits)
  gpu: imx: lcdif: add imx8mn compatible support
  drm/imx: Replace reset flow for LCDIF
  gpu: imx: lcdif: fix build warnings if CONFIG_PM_SLEEP off
  drm/imx: lcdif: change DISPMIX reset for IMX8MN
  MLK-21876-10 gpu: drm: lcdif: fix headfile reference issue
  ...
2019-12-02 18:01:07 +08:00
97fae6c25b Merge remote-tracking branch 'origin/display/ipu' into display/next
* origin/display/ipu: (7 commits)
  MLK-22156-3 gpu: ipu-v3: move new ipu file ipu-ic-csc.c under gpu/imx
  MLK-21876-10 gpu: drm: ipu: fix headfile reference issue (part2)
  drm/imx: ipuv3-kms: Move to a new ipuv3 folder
  drm/imx: ipuv3-crtc: Rename some IPUv3 specific functions
  drm/imx: Extract IPUv3 specific KMS functions to ipuv3-kms.c (part 2)
  ...
2019-12-02 18:01:06 +08:00
db73224120 Merge remote-tracking branch 'origin/display/hdp' into display/next
* origin/display/hdp: (32 commits)
  LF-94: drm: hdmi: imx: Add hdmi phy video mode valid function
  drm: hdmi: imx8: fix wrong hdmi type with non-SCDC HDMI sinks
  Revert "drm/imx/hdp: fix issue with non-SCDC HDMI sinks"
  drm/imx/hdp: fix issue with non-SCDC HDMI sinks
  drm: imx: mhdp: Adjustment core rate of DP TX CTRL for LS1028A
  ...
2019-12-02 18:01:05 +08:00
cef61e1b56 Merge remote-tracking branch 'origin/display/fbdev' into display/next
* origin/display/fbdev: (26 commits)
  MLK-22768 video: fbdev: mxc_ipuv3_fb: Handle enabled fg properly when set-par happens on bg
  video: fbdev: mxsfb: Fix writecombine/wc build error
  MLK-22084: fbdev: hdmi: Fix HDCP function failed work with Sony TV
  fbdev: dcic: Enable imx6 dcic driver
  video: fbdev: mxc: hdmi: add hdmi framebuffer driver
  ...
2019-12-02 18:01:04 +08:00
7b8c04b86d Merge remote-tracking branch 'origin/display/dsim' into display/next
* origin/display/dsim: (17 commits)
  LF-46 drm/imx: sec-dsim: use late suspend
  drm/imx: sec_dsim-imx: add imx8mn compatible support
  drm/imx: sec-dsim_imx: add resets put for probe failure
  drm/imx: Replace reset flow for DSIM
  MLK-22304-1 drm/imx: dsim: fix build warnings if CONFIG_PM_SLEEP off
  ...
2019-12-02 18:01:04 +08:00
674885ab1c Merge remote-tracking branch 'origin/display/drm-core' into display/next
* origin/display/drm-core: (6 commits)
  MLK-18535-6 drm/imx: core: add LCDIF support
  MLK-22171 drm/imx: Avoid leaking dangling pointer dev->driver_data to PM ops
  drm/imx: Add DPU KMS support (part 2)
  drm/imx: Extract IPUv3 specific KMS functions to ipuv3-kms.c (part 1)
  gpu: Move ipu-v3 to imx folder
  ...
2019-12-02 18:01:03 +08:00
270a1ad2a9 Merge remote-tracking branch 'origin/display/drm' into display/next
* origin/display/drm: (8 commits)
  drm/fourcc: add a 10bits fully packed variant of NV12
  drm/fourcc: add modifier for vivante compressed tiled layout
  MLK-17368-1 drm: add fourcc codes for Verisilicon tiled formats
  MLK-16290 drm: Add drm_of_component_probe_with_match() helper
  MLK-15110-1 drm/fourcc: Add Amphion tiled layout format modifier
  ...
2019-12-02 18:01:02 +08:00
09b639e3e5 Merge remote-tracking branch 'origin/display/dpu-blit' into display/next
* origin/display/dpu-blit: (12 commits)
  gpu: imx: dpu-blit: Do not initialize STORE9_STATIC register
  MGS-4265 gpu: imx: dpu-blit: fix video hang with g2d compositor
  MGS-3940 gpu: imx: dpu-blit: fix dpr hang for smaller size
  MGS-4051 gpu: imx: dpu-blit: fix suspend resume issue
  MGS-3940 gpu: imx: dpu-blit: fix first frame handler
  ...
2019-12-02 18:01:02 +08:00
a1cb6f9924 Merge remote-tracking branch 'origin/display/dpu' into display/next
* origin/display/dpu: (73 commits)
  gpu: imx: framegen: Use crtc_clock instead of mode clock
  gpu: imx: dpu: common: Initialize SCU misc settings in dpu_resume()
  LF-73 gpu: imx: dpu: sc misc: Initialze KACHUNK_CNT as needed by blit engine
  gpu: imx: dpu: sc misc: Rename dpu_pxlink_init() to dpu_sc_misc_init()
  gpu: imx: dpu: sc misc: Rename dpu_sc_misc_init() to dpu_sc_misc_get_handle()
  ...
2019-12-02 18:01:01 +08:00
11ae29ac2e Merge remote-tracking branch 'origin/display/dcss' into display/next
* origin/display/dcss: (25 commits)
  drm/imx/dcss: Release DTRC IRQs in case of failure
  drm/imx/dcss: fix crash in DTRC exit routine
  dt-bindings: display: imx8mq-dcss: add bindings for DTRC interrupts
  drm/imx/dcss: add support for tiled formats on overlay planes
  drm/imx/dcss: change HDR10 pipes config handling
  ...
2019-12-02 18:01:00 +08:00
c8b30c5905 Merge remote-tracking branch 'origin/display/bridge' into display/next
* origin/display/bridge: (50 commits)
  drm/bridge: adv7511: Fix of_reconfig
  MLK-21958-13: drm/bridge: adv7511: Limit supported clocks
  MLK-17275-2: drm/bridge: it6263: Add support for OF_DYNAMIC
  MLK-20438 drm/bridge: sec-dsim: remove 'FORCEBTA' for packet send
  MLK-20687 drm/bridge: sec-dsim: correct LPM config for Long Packet
  ...
2019-12-02 18:01:00 +08:00
e6b5173647 Merge remote-tracking branch 'origin/config/powerpc' into config/next
* origin/config/powerpc:
  powerpc/configs/sdk_dpaa: enable the Cortina PHY driver
  powerpc/configs/sdk_dpaa: add defconfigs
2019-12-02 18:00:57 +08:00
2e47b6c603 Merge remote-tracking branch 'origin/config/arm64' into config/next
* origin/config/arm64: (112 commits)
  MLK-21599-2 arm64: defconfig: FORCE_MAX_ZONEORDER default 14 for imx
  LF-210 arm64: defconfig: add imx fragment config
  LF-238 ARM64: defconfig: enable USB ACM
  LF-45 ARM64: defconfig: build as module for synaptics dsx touch
  LF-209-2 arm64: defconfig: Select CONFIG_PM_TEST_SUSPEND by default
  ...
2019-12-02 18:00:57 +08:00
7bedb1d449 Merge remote-tracking branch 'origin/config/arm' into config/next
* origin/config/arm: (80 commits)
  LF-238-1 ARM: configs: imx_v6_v7_defconfig: enable USB ACM
  LF-63-2 ARM: imx_v6_v7_defconfig: build SM test as module
  LF-141: ARM: imx_v6_v7_defconfig: enable CONFIG_PREEMPT
  LF-40 ARM: imx_v6_v7_defconfig: remove HCI SDIO config
  ARM: imx_v6_v7_defconfig: enable adv7180
  ...
2019-12-02 18:00:57 +08:00
c8505b1bc2 Merge remote-tracking branch 'origin/clock/s32' into clock/next
* origin/clock/s32: (9 commits)
  clk: s32v234: Enable FlexCAN clock
  clk: s32v234: Add definitions for CAN clocks
  clk: s32v234: Initial enet clk support
  clk: s32v234: Add dfs clk
  clk: Enable SDHC clock for S32V234
  ...
2019-12-02 18:00:53 +08:00
19f5dd2561 Merge remote-tracking branch 'origin/clock/qoriq' into clock/next
* origin/clock/qoriq:
  clk: ls1028a: Add clock driver for Display output interface
  dt/bindings: clk: Add YAML schemas for LS1028A Display Clock bindings
2019-12-02 18:00:53 +08:00
3d8281ed47 Merge remote-tracking branch 'origin/capture/pi' into capture/next
* origin/capture/pi:
  LF-101: staging: media: imx: fix XR24 format R and B are opposite issue
  staging: media: imx: add video ops for imx8 parallel subdev
  staging: media: imx: add parallel capture interface driver for imx8qxp
  media: dt-bindings: add bindings for i.MX8QXP parallel interface
  imx busfreq: Add API header file
2019-12-02 18:00:52 +08:00
a01dcca551 Merge remote-tracking branch 'origin/clock/imx' into clock/next
* origin/clock/imx: (111 commits)
  LF-279 clk: imx: scu: ignore cpu resources when do owned check
  clk: imx: Add missing mipi1_dsi_phy_clk
  LF-202-3 clk: imx: scu: ignore clks not owned
  LF-108 clk: imx: clk-imx7ulp: Add missing sentinel of ulp_div_table
  clk: imx8qxp: acm: Support suspend and resume
  ...
2019-12-02 18:00:52 +08:00
d2de144463 Merge remote-tracking branch 'origin/capture/ov5640' into capture/next
* origin/capture/ov5640: (16 commits)
  LF-237 media: ov5640_mipi: fix regulator dump when i2c access for camera fail
  LF-115: media: i2c: ov5640: fix enumerate capture mode issue
  media: i2c: ov5640: add mode and fps checking for ov5640
  media: i2c: fix the incomplete first frame issue
  media: i2c: fix hang issue when ov5640 work at DVP mode
  ...
2019-12-02 18:00:51 +08:00
b8cb1caf1e Merge remote-tracking branch 'origin/capture/mxc' into capture/next
* origin/capture/mxc: (11 commits)
  media: v4l2: vadc: Enable vadc driver
  media: mx6s_capture: accommodate the driver to framework's change
  media: v4l2 capture: add v4l2 capture driver based on csi
  media: mipi csi: add IPU CSI driver
  media: add adv7180 video decoder driver
  ...
2019-12-02 18:00:51 +08:00
9c17c11604 Merge remote-tracking branch 'origin/capture/media-dev' into capture/next
* origin/capture/media-dev:
  media: staging: imx: add media device driver support for IMX8
  media: dt-bindings: add bindings for i.MX8QXP/QM virtual media device
2019-12-02 18:00:50 +08:00
9553b03d09 Merge remote-tracking branch 'origin/capture/media' into capture/next
* origin/capture/media: (7 commits)
  Revert "media: v4l2-ioctl: clear fields in s_parm"
  media: v4l2: export video_usercopy function
  Revert "media: v4l2-subdev.h: remove obsolete g/s_parm"
  MLK-21770: media: v4l: Add packed YUV444 24bpp pixel format
  MLK-20724: uapi: add RGBA to exend V4L2 standard format for android usage
  ...
2019-12-02 18:00:49 +08:00
c7a3925dd6 Merge remote-tracking branch 'origin/capture/max9286' into capture/next
* origin/capture/max9286:
  LF-116: staging: media: imx: fix no enum_frameinterval result issue
  media: staging: imx: add driver for GMSL MAX9286 device
2019-12-02 18:00:49 +08:00
9c7f085807 Merge remote-tracking branch 'origin/capture/jpeg' into capture/next
* origin/capture/jpeg: (9 commits)
  MLK-22835: mxc-jpeg: jpeg decoder stuck due to race condition
  mxc-jpeg: Fix warning at build, for EXPORT_SYMBOL on static variable
  media: mxc-jpeg: jpeg: Replace stracpy with strscpy
  mxc-jpeg: Build mxc-jpeg as module, by default
  mxc-jpeg: Add support for multi power domain
  ...
2019-12-02 18:00:48 +08:00
028cc80de9 Merge remote-tracking branch 'origin/capture/isi' into capture/next
* origin/capture/isi: (9 commits)
  staging: media: imx: add g_parm/s_parm for imx8 capture device
  staging: media: imx: enable ISI for imx8mn platform
  media: staging: imx: add V4L2 memory to memory driver for ISI of imx8qxp/qm
  media: staging: imx: add isi capture driver support for imx8qm/qxp
  media: staging: imx: add isi core driver support for imx8qm/qxp
  ...
2019-12-02 18:00:47 +08:00
06e92d2f26 Merge remote-tracking branch 'origin/capture/csi2-samsung' into capture/next
* origin/capture/csi2-samsung:
  staging: media: imx: add V4L2 subdev driver for MIPI CSI2 of Samsung
  media: mipi csi: accommodate the driver to framework's change
  media: mipi csi: add samsung's mipi csi support
2019-12-02 18:00:47 +08:00
4981735db9 Merge remote-tracking branch 'origin/capture/csi2-mixel' into capture/next
* origin/capture/csi2-mixel:
  staging: media: imx: add video ops for imx8 mipi csi subdev
  media: mipi csi: add mixel's mipi csi driver
  media: staging: csi: add mipi csi driver support for IMX8
  media: dt-bindings: add bindings for i.MX8QXP/QM mipi csi-2 driver
2019-12-02 18:00:46 +08:00
8d66f9b461 Merge remote-tracking branch 'origin/audio/ssi' into audio/next
* origin/audio/ssi:
  LF-106: ASoC: fsl_ssi: request BUS_FREQ_AUDIO
  MLK-15975-1: ASoC: fsl_ssi: support multi fifo script
2019-12-02 18:00:44 +08:00
635de10e16 Merge remote-tracking branch 'origin/audio/spdif' into audio/next
* origin/audio/spdif: (20 commits)
  LF-106: ASoC: fsl_spdif: request BUS_FREQ_HIGH
  ASoC: fsl_spdif:Support multi power domains
  ASoC: fsl_spdif: Add pm_runtime_enable in probe
  MLK-21484-2: ASoC: fsl_spdif: ensure clk is unprepared before reparent
  MLK-19154-5: ASoC: fsl_spdif: refine PLL switch handling
  ...
2019-12-02 18:00:44 +08:00
b7f8883066 Merge remote-tracking branch 'origin/audio/sof' into audio/next
* origin/audio/sof: (21 commits)
  ASoC: SOF: Read tplg filename from board descriptor
  ASoC: SOF: Update fw_filename from board description
  ASoC: SOF: Allow probe to continue when we have an actual codec
  ASoC: SOF: Hardcode ignore_machine
  ASoC: fsl: Add generic DAI driver
  ...
2019-12-02 18:00:44 +08:00
2a635fc846 Merge remote-tracking branch 'origin/audio/sai' into audio/next
* origin/audio/sai: (65 commits)
  LF-106: ASoC: fsl_sai: request BUS_FREQ_AUDIO
  ASoC: fsl_sai: Mark cache dirty at resume
  MLK-21876-4 ASoC: fsl: sai: fix build for next-20190524 upgrade
  ASoC: fsl: sai: fix build failture due to 5.1 RC7 upgrade
  ASoC: fsl_sai: support multi power domain
  ...
2019-12-02 18:00:43 +08:00
d7ba9dc826 Merge remote-tracking branch 'origin/audio/rpmsg' into audio/next
* origin/audio/rpmsg: (59 commits)
  LF-215: ASoC: fsl_rpmsg_i2s: Enable WQ_FREEZABLE for workqueue
  ASoC: imx-pcm-rpmsg: Remove the prtd
  ASoC: imx-pcm-rpmsg: Fix writecombine/wc build error
  ASoC: rpmsg_ak4497: ignore suspend with DAPM
  Revert "ASoC: soc-pcm: remove soc_rtdcom_ack()"
  ...
2019-12-02 18:00:43 +08:00
f543f63f55 Merge remote-tracking branch 'origin/audio/micfil' into audio/next
* origin/audio/micfil:
  MLK-22598: ASoC: fsl_micfil: Reset channel output data Flag
  ASoC: fsl_micfil: Merge the changes from imx_4.19.y
2019-12-02 18:00:42 +08:00
af11fb98c2 Merge remote-tracking branch 'origin/audio/hdmi' into audio/next
* origin/audio/hdmi: (22 commits)
  ASoC: imx-hdmi: Fix compile error
  ASoC: imx-hdmi-dma: Fix issue with dma_alloc_coherent
  ASoC: imx-hdmi-dma: replace platform to component
  ASoC: imx-cdnhdmi: Fix compile error
  MLK-20183-2: ASoC: imx-cdnhdmi: reconfigure the mclk for HDMI on imx8mq
  ...
2019-12-02 18:00:42 +08:00
25d4beddff Merge remote-tracking branch 'origin/audio/fm' into audio/next
* origin/audio/fm: (8 commits)
  MLK-11429-21: ASoC: fsl: port si476x machine driver from imx_3.10.y
  MLK-11305 radio-si476x: support set V4L2_CID_AUDIO_MUTE CTRL
  MLK-22355: mfd: si476x: Use system_freezable_wq instead of system_wq
  MLK-10055-2: mfd: si476x-i2c: sound is registered when no FM module attached
  MLK-10038-1: mfd: si476x-i2c: Add support of si476x-rev4.0 board
  ...
2019-12-02 18:00:41 +08:00
845f67dda2 Merge remote-tracking branch 'origin/audio/esai' into audio/next
* origin/audio/esai: (7 commits)
  LF-276: ASoC: fsl_easi: constrain period size for edma case
  ASoC: fsl_esai: Remove the tasklet
  ASoC: fsl_esai: Add spin lock to protect reset, stop and start
  ASoC: fsl_esai: Remove expensive print in irq handler
  ASoC: fsl_esai: support multi power domain
  ...
2019-12-02 18:00:40 +08:00
5d9b52c341 Merge remote-tracking branch 'origin/audio/dsp' into audio/next
* origin/audio/dsp: (78 commits)
  MLK-22815-1: ASoC: fsl: dsp: Expand parameter msg size
  MLK-21144 ASoC: fsl: Fix crash with multiple open/close
  ASoC: fsl_dsp: Use new compatible string for FSL DSP
  ASoC: fsl: dsp: remove unused types.h
  MLK-21985-6 ASoC: imx-dsp: fix build for next 20190607 upgrade
  ...
2019-12-02 18:00:40 +08:00
d40375dbf7 Merge remote-tracking branch 'origin/audio/dma' into audio/next
* origin/audio/dma: (14 commits)
  ASoC: imx-pcm-dma-v2: Fix writecombine/wc build error
  ASoC: imx-pcm-dma-v2: Add component name
  ASoC: imx: fix build failture
  MLK-16224-2: ASoC: dmaengine_pcm: add fifo_num to snd_dmaengine_dai_dma_data
  MLK-18947: ASoC: imx-pcm-dma: alloc buffer from IRAM
  ...
2019-12-02 18:00:39 +08:00
dfc1c26529 Merge remote-tracking branch 'origin/audio/codec' into audio/next
* origin/audio/codec: (34 commits)
  LF-102: ASoC: ak4458: Support DSD512 when codec is ak4497
  ASoC: AK4458: Enable DSD for AK4497
  MLK-17817-1: ASoC: ak4458: enable daisy chain
  MLK-20189-7: ASoC: ak4458: check reset control status
  MLK-19573-2: ASoC: ak4458: enable DSD playback
  ...
2019-12-02 18:00:39 +08:00
2e5482f337 Merge remote-tracking branch 'origin/audio/card' into audio/next
* origin/audio/card: (127 commits)
  ASoC: imx-pdm: Fix compile issue
  ASoC: imx-wm8524: remove unused audio route
  ASoC: imx-ak5558: remove unused audio route
  ASoC: imx-wm8962: change cpu-dai to audio-cpu
  ASoC: imx-sii902x: Fix compile error
  ...
2019-12-02 18:00:38 +08:00
bbeadc6b01 Merge remote-tracking branch 'origin/audio/audmix' into audio/next
* origin/audio/audmix:
  ASoC: fsl_audmix: Add spin lock to protect tdms
2019-12-02 18:00:37 +08:00
b1d0e4ce42 Merge remote-tracking branch 'origin/audio/asrc' into audio/next
* origin/audio/asrc: (68 commits)
  MLK-22722: ASoC: fsl_easrc: Use global variable instead local variable
  MLK-22591: ASoC: fsl_easrc: Add RUN_STOP in stop context
  MLK-22575-3: ASoC: fsl_easrc: reformat the fsl_easrc_config_slot
  MLK-22575-2: ASoC: fsl_easrc: disable PF_BYPASS_MODE
  MLK-22575-1: ASoC: fsl_easrc: configure slot according to pf memory size
  ...
2019-12-02 18:00:37 +08:00
7e3b1c91d0 Merge remote-tracking branch 'origin/arch/qoriq' into arch/next
* origin/arch/qoriq: (17 commits)
  drivers: soc: fsl: add qixis driver
  Add APIs to setup HugeTLB mappings for USDPAA
  powerpc/pm: add sleep and deep sleep on QorIQ SoCs
  powerpc/cache: add cache flush operation for various e500
  powerpc/pm: Fix suspend=n in menuconfig for e500mc platforms.
  ...
2019-12-02 18:00:36 +08:00
2287abcd65 Merge remote-tracking branch 'origin/arch/imx' into arch/next
* origin/arch/imx: (64 commits)
  MLK-21599-1 arm64: Kconfig: Make FORCE_MAX_ZONEORDER configurable
  LF-171 ARM: imx: Add cpu type check for imx6ulz in msl code
  LF-176 ARM: imx: mach-imx6q: Revert "ARM: imx: correct the enet_clk_ref clock string"
  LF-39 soc: imx: Update busfreq to support different frequncy setpoint
  MLK-23008 ARM: imx: Remove unused code on i.MX7D suspend driver
  ...
2019-12-02 18:00:36 +08:00
98e786bdbd LF-237 media: ov5640_mipi: fix regulator dump when i2c access for camera fail
in 5451781dad commit, it added the check that
the regulator need to be disabled before calling regulator_put().

when i2c access for camera fails in some case, need disable the regulator to
fix following dump message.

[    3.881140] i2c i2c-2: cannot deal with slave irq,i2c_imx->slave is null
[    3.981772] ov5640_mipi 2-003c: Write reg error: reg=3008, val=2
[    3.987841] ov5640_mipi 2-003c: Camera init failed
[    4.001224] ------------[ cut here ]------------
[    4.005949] WARNING: CPU: 2 PID: 189 at drivers/regulator/core.c:2042 _regulator_put.part.0+0x140/0x148
[    4.015363] Modules linked in:
[    4.018466] CPU: 2 PID: 189 Comm: kworker/2:2 Not tainted 5.4.0-rc7-5.4-zeus-next+g56a9ca3b7f4e #1
[    4.027434] Hardware name: FSL i.MX8MM EVK board (DT)
[    4.032554] Workqueue: events deferred_probe_work_func
[    4.037712] pstate: 80000005 (Nzcv daif -PAN -UAO)
[    4.042511] pc : _regulator_put.part.0+0x140/0x148
[    4.047316] lr : regulator_put+0x34/0x48
[    4.051248] sp : ffff8000129935f0
[    4.054571] x29: ffff8000129935f0 x28: ffff000079d39580
[    4.059891] x27: ffff000079d6cc80 x26: ffff80001206eae0
[    4.065213] x25: ffff8000120ab538 x24: ffff000079d3fc00
[    4.070534] x23: 0000000000000009 x22: ffff8000129936a8
[    4.075856] x21: ffff00007a47c4c0 x20: ffff8000120550c0
[    4.081174] x19: ffff000079d3ff00 x18: 0000000000000000
[    4.086495] x17: 0000000000000000 x16: 0000000000000000
[    4.091817] x15: 0000000000000000 x14: ffff00007b0aa940
[    4.097138] x13: ffff80006c0ef000 x12: 0000000034d4d91d
[    4.102460] x11: 071c71c71c71c71c x10: 0000000000000990
[    4.107780] x9 : 0000000000000000 x8 : ffff8000107ef620
[    4.113102] x7 : ffff000079d5e2b8 x6 : ffff000079d3fc00
[    4.118424] x5 : ffff000079d5e2b8 x4 : 0000000000000000
[    4.123745] x3 : ffff800012055490 x2 : ffff00007a47c4c0
[    4.129066] x1 : 0000000000000000 x0 : 0000000000000001
[    4.134397] Call trace:
[    4.136861]  _regulator_put.part.0+0x140/0x148
[    4.141318]  regulator_put+0x34/0x48
[    4.144917]  devm_regulator_release+0x10/0x18
[    4.149298]  release_nodes+0x1a8/0x220
[    4.153057]  devres_release_all+0x34/0x58
[    4.157078]  really_probe+0x1b8/0x308
[    4.160748]  driver_probe_device+0x54/0xe8
[    4.164851]  __device_attach_driver+0x80/0xb8
[    4.169225]  bus_for_each_drv+0x74/0xc0
[    4.173070]  __device_attach+0xdc/0x138
[    4.176916]  device_initial_probe+0x10/0x18
[    4.181105]  bus_probe_device+0x90/0x98
[    4.184954]  device_add+0x378/0x648
[    4.188450]  device_register+0x1c/0x28
[    4.192230]  i2c_new_client_device+0x134/0x270
[    4.196681]  i2c_new_device+0xc/0x20
[    4.200277]  of_i2c_register_device+0x70/0x98
[    4.204640]  of_i2c_register_devices+0x9c/0x164
[    4.209176]  i2c_register_adapter+0x14c/0x400
[    4.213545]  __i2c_add_numbered_adapter+0x58/0xa0
[    4.218259]  i2c_add_adapter+0x9c/0xc8
[    4.222015]  i2c_add_numbered_adapter+0x24/0x30
[    4.226580]  i2c_imx_probe+0x37c/0x840
[    4.230340]  platform_drv_probe+0x50/0xa0
[    4.234357]  really_probe+0xd4/0x308
[    4.237944]  driver_probe_device+0x54/0xe8
[    4.242050]  __device_attach_driver+0x80/0xb8
[    4.246414]  bus_for_each_drv+0x74/0xc0
[    4.250264]  __device_attach+0xdc/0x138
[    4.254111]  device_initial_probe+0x10/0x18
[    4.258304]  bus_probe_device+0x90/0x98
[    4.262147]  deferred_probe_work_func+0x64/0x98
[    4.266720]  process_one_work+0x198/0x320
[    4.270740]  worker_thread+0x1f0/0x420
[    4.274523]  kthread+0xf0/0x120
[    4.277694]  ret_from_fork+0x10/0x18
[    4.281291] ---[ end trace 429c2bceeb60ea02 ]---

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-12-02 17:59:19 +08:00
6e2908e6e7 staging: media: imx: add g_parm/s_parm for imx8 capture device
Add g_parm/s_parm for imx8 capture device

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-12-02 15:37:08 +08:00
f093fe3262 staging: media: imx: enable ISI for imx8mn platform
ISI is image sensor interface of imx8 family. It's reused in imx8mn
platform. But they use different clock tree, so driver need to select
the related clock operation for different platform. In order to solve
the problem, driver define mxc_isi_dev_ops which used to control clock
operation.

Dispmix subsystem of imx8mn is consist of ISI, CSI, DSI and LCDIF modules.
It use GPR to manage the reset and clock signal for all modules. We add
a reset driver for dispmix reset function, so add related consumer of reset
in ISI core driver.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-12-02 15:37:03 +08:00
125bad112c LF-276: ASoC: fsl_easi: constrain period size for edma case
There is limitaion for EDMA, which can only accept the period bytes
that can be divided by maxburst with no remainder. Otherwise EDMA
will not copy the left data in the end, and it will cause noise.
so add constraint for these chips.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-02 15:33:20 +08:00
f343c2747a LF-238-1 ARM: configs: imx_v6_v7_defconfig: enable USB ACM
It is used for CDC ACM function.

Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-12-02 15:27:32 +08:00
04231adf80 LF-279 clk: imx: scu: ignore cpu resources when do owned check
CPU resources are specical resources, it is assigned in ATF, not
non-secure OS, but we still need to allow cpu freq, so return
true for non-secure OS for cpu resources.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Tested-by: Anson Huang <anson.huang@nxp.com>
2019-12-02 11:14:28 +08:00
40682f78ec media: staging: imx: add media device driver support for IMX8
Add media device drivers support. Media device is a virtual platform
device which used to manage all modules in IMX8 image subsystem and
as the parent device for all modules devices.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
[ Aisheng: Kconfig & Makefile update for a clean base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-12-02 09:58:14 +08:00
122200c5fa LF-246: dmaengine: imx-sdma: correct is_ram_script checking
Correct is_ram_script checking in case sdma firmware not loaded as
expected, otherwise all scripts are considered as rom script without
correct "sdma firmware not ready!" since sdma->ram_code_start is 0.

Note: only add the doubtless is_ram_script for sdma-imx6q.bin/sdma-imx7d.
bin , and leave the legacy i.mx5x/i.mx3x/i.mx2x firmware alone since not
sure which of the remain scripts should be in ram.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-29 20:54:39 +08:00
243f4bdb2b arm64: dts: fsl: ls1028a: Disable eno3 and make swp5 the Felix CPU port
This patch returns to the switch port setup from BSP 0.2, where the
switch only had a single Ethernet connection to the CPU, via a tagging
interface. Choose eno2 for this purpose, as it has higher bandwidth and
also supports TSN offloads.

The reason is that the switch is not able to do DSA tags on 2 CPU ports
at the same time, and it is confusing to have so many ports with no
clear indication which should be used for what (a "data" port and a
"control" port).

We don't revert to the BSP 0.2 RCW configuration, however. The ENETC
port 3 is still enabled in the RCW, however it is not probed by Linux by
default, since the large majority of use cases will not need it. For
those that do (like originating 802.1CB traffic from the CPU), it can be
enabled back by simply reverting this device tree change.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-11-29 13:54:12 +02:00
25b6846e86 arm64: dts: fsl: ls1028a: Specify that the Felix port 4 runs at 2.5Gbps
This is just an informative change, because all Felix MACs inside the
LS1028A are hardwired in gigabit mode anyway.

Only PHYLINK is able to understand fixed-link speeds higher than 1 Gbps.
With PHYLIB, fixed-link interfaces are emulated as C22 PHYs by the swphy
driver, and C22 does not specify settings for speeds higher than
gigabit.

This patch brings no functional change except for the messages printed
during driver initialization.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-11-29 13:54:03 +02:00
6c9ef8f83b arm64: dts: fsl: Drop "compatible" string from Felix switch
Since Felix is not a platform device but a PCI device, the "compatible"
string serves no purpose. The device driver is found by matching the PCI
device/vendor ID to the ENETC PF.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-11-29 13:53:55 +02:00
51eb297b8e arm64: dts: fsl: Specify phy-mode for CPU ports
PHYLINK requires that device tree nodes have a phy-mode or
phy-connection-type property. The internal Felix ports really are
connected to the ENETC via 2 back-to-back MACs, so the correct MII type
is GMII (one of which is overclocked at 2.5Gbaud, but still GMII).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-11-29 13:53:46 +02:00
4798f8f73d LF-261: arm64: dts: imx8mq: Set parent clock for IMX8MQ_CLK_AUDIO_AHB
Set parent clock for IMX8MQ_CLK_AUDIO_AHB, and move setting
IMX8MQ_AUDIO_PLL1 and IMX8MQ_AUDIO_PLL2 rate to a common place.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-29 19:38:57 +08:00
f38cc79e02 LF-175: input: keyboard: imx_sc_pwrkey: fix no release event reported
scfw only take care of the least 1 byte of payload of powerkey message.
Correct key state checking logic, otherwise, the state maybe wrong since
the upper 3 bytes maybe not 0 as expected.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-29 18:07:26 +08:00
34682fd73b LF-94: drm: hdmi: imx: Add hdmi phy video mode valid function
Add hdmi phy video mode valid function to filter the video modes.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-11-29 17:59:55 +08:00
382e4628e2 LF-235: arm64: dts: imx8qm: disable all hdmi ss modules defaultly
imx8qm hdmi has a specific dts file, in order to avoid
unnecessary probe hdmi subsystem modules in imx8qm-mek.dts
all hdmi submodules by default set to disabled and enabled
in imx8qm-mek-hdmi.dts

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2019-11-29 17:57:10 +08:00
8e3c876c3e LF-263-2 i2c: imx: increase PM timeout to avoid operate clk frequently
Switching the clock frequently will affect the data transmission
efficiency, and prolong the timeout to reduce autosuspend times for
i2c-imx.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-29 17:51:00 +08:00
b60341e965 LF-263-1 i2c: lpi2c: increase PM timeout to avoid operate clk frequently
Switching the clock frequently will affect the data transmission
efficiency, and prolong the timeout to reduce autosuspend times for
lpi2c.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-29 17:50:53 +08:00
c22be94605 can: flexcan: Add S32V234 support to FlexCAN driver
The FlexCAN driver is compatible with the modules on S32V234 chips.

Signed-off-by: Chircu-Mare Bogdan-Petru <Bogdan.Chircu@freescale.com>
Signed-off-by: Dan Nica <dan.nica@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Reviewed-by: Li Yang <leoyang.li@nxp.com>
Reviewed-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 11:44:52 +02:00
9ce8988c80 clk: s32v234: Enable FlexCAN clock
Enable the clocks needed for FlexCAN support on Treerunner.

Signed-off-by: Chircu-Mare Bogdan-Petru <Bogdan.Chircu@freescale.com>
Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Larisa Grigore <Larisa.Grigore@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Reviewed-by: Li Yang <leoyang.li@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 11:44:11 +02:00
086bbd068f clk: s32v234: Add definitions for CAN clocks
Define macros which will indicate the clock signals obtained after
auxiliary clock 6 source selection and division (CAN_CLK) respectively.

Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-29 11:44:06 +02:00
ff465fbf1b LF-257-02 dts: imx6ull: change the usdhc root clock to 396MHz
Due to the errata ERR010450 limit, this patch change the imx6ull
usdhc root clock to 132MHz in soc related dts file, remove all
the root clock setting in board dts file, after this patch,
SDR104/HS200 work at 132MHz, DDR50/DDR52 work at 33MHz.

(merged from commit: 1a3160ae69)

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-29 17:43:08 +08:00
50413a6671 LF-257-01 ARM: dts: imx6ull/ulz-14x14-evk: update usdhc1 pin group
Update usdhc1 pin group for imx6ull/ulz-14x14-evk.

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-29 17:43:08 +08:00
f53e570ff0 arm64: dts: s32v234: Add FlexCAN nodes for EVB and SBC
S32V234 SoCs provide two instances of FlexCAN. Each of S32V234-EVB and
S32V234-SBC use both of them. Add the can nodes and the necessary
pinctrl groups for FlexCAN PAD configurations in SIUL2.
The pinctrl_can* nodes for SBC include a fix for an S-pin reliability
issue.

Signed-off-by: Chircu-Mare Bogdan-Petru <Bogdan.Chircu@freescale.com>
Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Kay Potthoff <Kay.Potthoff@microsys.de>
Signed-off-by: Costin Carabas <costin.carabas@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 11:43:04 +02:00
58b9c9e00e arm64: dts: s32v234-evb: Use macros for MSCR and config pairs
Make use of the new macros defined in s32v234-pinctrl.h. The MSCR
numbers will no longer be hardcoded either.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Catalin Udma <catalin-dan.udma@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 11:42:56 +02:00
bf5b9043bc pinctrl: s32v234: Add FlexCAN pins to S32V234 driver
Prepare FlexCAN support for S32V234 by defining the necessary pins in
the pinctrl driver using the already defined IMCR numbers.

Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Costin Carabas <costin.carabas@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 11:42:15 +02:00
d524558f02 dt-bindings: pinctrl: s32v234: Add defines for all pins
Add macros for MSCR register numbers, configuration for these registers
and pairs of MSCR numbers and values for all currently supported
peripherals in the Auto Linux BSP.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Ghennadi Procopciuc <Ghennadi.Procopciuc@nxp.com>
Signed-off-by: Cristian Tomescu <Cristian.Tomescu@nxp.com>
Signed-off-by: Larisa Grigore <Larisa.Grigore@nxp.com>
Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Grigore Lupescu <grigore.lupescu@freescale.com>
Signed-off-by: Eddy Petrișor <eddy.petrisor@nxp.com>
Signed-off-by: Cosmin Oprea <cosmin.oprea@nxp.com>
Signed-off-by: Chircu-Mare Bogdan-Petru <Bogdan.Chircu@freescale.com>
Signed-off-by: Costin Carabas <costin.carabas@nxp.com>
Signed-off-by: Catalin Udma <catalin-dan.udma@nxp.com>
Signed-off-by: Andrei Trandafir <andrei.trandafir@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 11:42:09 +02:00
2e37504319 dt-bindings: pinctrl: s32v234: Add macros for MSCR and config pairs
Define macros for the combinations of MSCR numbers and values to be
written into those registers. These will be used together in 'fsl,pins'
properties of pinctrl group dts nodes.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 11:42:03 +02:00
23c9ff826a pinctrl: s32v234: Remove s32v234_pins enum
These values were replaced with macros with the same names in
s32v234-pinctrl.h, to be usable in device tree definitions as well.

Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 11:41:58 +02:00
3d76679805 dt-bindings: pinctrl: s32v234: Add macros for MSCR/IMCR numbers
The values of the s32v234_pins enum from pinctrl-s32v234.c will be moved
to s32v234-pinctrl.h to avoid using magic numbers in ENET configuration
definitions.

Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 11:41:50 +02:00
187d81ea3b LF-270 ARM64: dts: imx8mq.dtsi: set the IMX8MQ_CLK_NAND_USDHC_BUS clock rate
Need to set the IMX8MQ_CLK_NAND_USDHC_BUS clock rate to 266MHz, to make
clock align, otherwise USDHC oparation will has issue.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-29 17:39:19 +08:00
325019e17e drm: hdmi: imx8: fix wrong hdmi type with non-SCDC HDMI sinks
hdmi type is uninitialized with non-SCDC HDMI sinks.
And hdmi ctrl will work in DVI mode that is not ecpected.
Set hdmi type to HDMI1.4 before SCDC support check to fix it.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-29 17:32:28 +08:00
6f0fafb43a Revert "drm/imx/hdp: fix issue with non-SCDC HDMI sinks"
For HDMI sinks that support HDMI2.0, those video modes have
listed in hdmi1.4 specification should work in hdmi 1.4.
Remove the patch, make sure all video modes can work well
in HDMI2.0 sinks.
For non-SCDC HDMI sinks issue,
it will be fixed with another patch.

This reverts commit 4b6617643f.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-29 17:32:02 +08:00
79438f37a6 Linux 5.4.1 2019-11-29 10:10:32 +01:00
fcddcfa746 KVM: PPC: Book3S HV: Flush link stack on guest exit to host kernel
commit af2e8c68b9 upstream.

On some systems that are vulnerable to Spectre v2, it is up to
software to flush the link stack (return address stack), in order to
protect against Spectre-RSB.

When exiting from a guest we do some house keeping and then
potentially exit to C code which is several stack frames deep in the
host kernel. We will then execute a series of returns without
preceeding calls, opening up the possiblity that the guest could have
poisoned the link stack, and direct speculative execution of the host
to a gadget of some sort.

To prevent this we add a flush of the link stack on exit from a guest.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:32 +01:00
79f6bca3bc powerpc/book3s64: Fix link stack flush on context switch
commit 39e72bf96f upstream.

In commit ee13cb249f ("powerpc/64s: Add support for software count
cache flush"), I added support for software to flush the count
cache (indirect branch cache) on context switch if firmware told us
that was the required mitigation for Spectre v2.

As part of that code we also added a software flush of the link
stack (return address stack), which protects against Spectre-RSB
between user processes.

That is all correct for CPUs that activate that mitigation, which is
currently Power9 Nimbus DD2.3.

What I got wrong is that on older CPUs, where firmware has disabled
the count cache, we also need to flush the link stack on context
switch.

To fix it we create a new feature bit which is not set by firmware,
which tells us we need to flush the link stack. We set that when
firmware tells us that either of the existing Spectre v2 mitigations
are enabled.

Then we adjust the patching code so that if we see that feature bit we
enable the link stack flush. If we're also told to flush the count
cache in software then we fall through and do that also.

On the older CPUs we don't need to do do the software count cache
flush, firmware has disabled it, so in that case we patch in an early
return after the link stack flush.

The naming of some of the functions is awkward after this patch,
because they're called "count cache" but they also do link stack. But
we'll fix that up in a later commit to ease backporting.

This is the fix for CVE-2019-18660.

Reported-by: Anthony Steinhauser <asteinhauser@google.com>
Fixes: ee13cb249f ("powerpc/64s: Add support for software count cache flush")
Cc: stable@vger.kernel.org # v4.4+
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:31 +01:00
14c274e717 staging: comedi: usbduxfast: usbduxfast_ai_cmdtest rounding error
commit 5618332e5b upstream.

The userspace comedilib function 'get_cmd_generic_timed' fills
the cmd structure with an informed guess and then calls the
function 'usbduxfast_ai_cmdtest' in this driver repeatedly while
'usbduxfast_ai_cmdtest' is modifying the cmd struct until it
no longer changes. However, because of rounding errors this never
converged because 'steps = (cmd->convert_arg * 30) / 1000' and then
back to 'cmd->convert_arg = (steps * 1000) / 30' won't be the same
because of rounding errors. 'Steps' should only be converted back to
the 'convert_arg' if 'steps' has actually been modified. In addition
the case of steps being 0 wasn't checked which is also now done.

Signed-off-by: Bernd Porr <mail@berndporr.me.uk>
Cc: <stable@vger.kernel.org> # 4.4+
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20191118230759.1727-1-mail@berndporr.me.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:29 +01:00
6618825699 USB: serial: option: add support for Foxconn T77W968 LTE modules
commit f079709542 upstream.

These are the Foxconn-branded variants of the Dell DW5821e modules,
same USB layout as those. The device exposes AT, NMEA and DIAG ports
in both USB configurations.

P:  Vendor=0489 ProdID=e0b4 Rev=03.18
S:  Manufacturer=FII
S:  Product=T77W968 LTE
S:  SerialNumber=0123456789ABCDEF
C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
I:  If#=0x1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option

P:  Vendor=0489 ProdID=e0b4 Rev=03.18
S:  Manufacturer=FII
S:  Product=T77W968 LTE
S:  SerialNumber=0123456789ABCDEF
C:  #Ifs= 7 Cfg#= 2 Atr=a0 MxPwr=500mA
I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#=0x6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
[ johan: drop id defines ]
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:29 +01:00
191243c650 USB: serial: option: add support for DW5821e with eSIM support
commit 957c31ea08 upstream.

The device exposes AT, NMEA and DIAG ports in both USB configurations.
Exactly same layout as the default DW5821e module, just a different
vid/pid.

P:  Vendor=413c ProdID=81e0 Rev=03.18
S:  Manufacturer=Dell Inc.
S:  Product=DW5821e-eSIM Snapdragon X20 LTE
S:  SerialNumber=0123456789ABCDEF
C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
I:  If#=0x1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option

P:  Vendor=413c ProdID=81e0 Rev=03.18
S:  Manufacturer=Dell Inc.
S:  Product=DW5821e-eSIM Snapdragon X20 LTE
S:  SerialNumber=0123456789ABCDEF
C:  #Ifs= 7 Cfg#= 2 Atr=a0 MxPwr=500mA
I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#=0x6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:28 +01:00
ef50d287de USB: serial: mos7840: fix remote wakeup
commit 92fe35fb9c upstream.

The driver was setting the device remote-wakeup feature during probe in
violation of the USB specification (which says it should only be set
just prior to suspending the device). This could potentially waste
power during suspend as well as lead to spurious wakeups.

Note that USB core would clear the remote-wakeup feature at first
resume.

Fixes: 3f5429746d ("USB: Moschip 7840 USB-Serial Driver")
Cc: stable <stable@vger.kernel.org>     # 2.6.19
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:27 +01:00
c380833817 USB: serial: mos7720: fix remote wakeup
commit ea422312a4 upstream.

The driver was setting the device remote-wakeup feature during probe in
violation of the USB specification (which says it should only be set
just prior to suspending the device). This could potentially waste
power during suspend as well as lead to spurious wakeups.

Note that USB core would clear the remote-wakeup feature at first
resume.

Fixes: 0f64478cbc ("USB: add USB serial mos7720 driver")
Cc: stable <stable@vger.kernel.org>     # 2.6.19
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:26 +01:00
076b084d68 USB: serial: mos7840: add USB ID to support Moxa UPort 2210
commit e696d00e65 upstream.

Add USB ID for MOXA UPort 2210. This device contains mos7820 but
it passes GPIO0 check implemented by driver and it's detected as
mos7840. Hence product id check is added to force mos7820 mode.

Signed-off-by: Pavel Löbl <pavel@loebl.cz>
Cc: stable <stable@vger.kernel.org>
[ johan: rename id defines and add vendor-id check ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:25 +01:00
04484bed9f appledisplay: fix error handling in the scheduled work
commit 91feb01596 upstream.

The work item can operate on

1. stale memory left over from the last transfer
the actual length of the data transfered needs to be checked
2. memory already freed
the error handling in appledisplay_probe() needs
to cancel the work in that case

Reported-and-tested-by: syzbot+495dab1f175edc9c2f13@syzkaller.appspotmail.com
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191106124902.7765-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:25 +01:00
878389a536 USB: chaoskey: fix error case of a timeout
commit 92aa5986f4 upstream.

In case of a timeout or if a signal aborts a read
communication with the device needs to be ended
lest we overwrite an active URB the next time we
do IO to the device, as the URB may still be active.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191107142856.16774-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:24 +01:00
0e8311ef18 usb-serial: cp201x: support Mark-10 digital force gauge
commit 347bc8cb26 upstream.

Add support for the Mark-10 digital force gauge device to the cp201x
driver.

Based on a report and a larger patch from Joel Jennings

Reported-by: Joel Jennings <joel.jennings@makeitlabs.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20191118092119.GA153852@kroah.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:23 +01:00
274e0f1aee usbip: Fix uninitialized symbol 'nents' in stub_recv_cmd_submit()
commit 2a9125317b upstream.

Smatch reported that nents is not initialized and used in
stub_recv_cmd_submit(). nents is currently initialized by sgl_alloc()
and used to allocate multiple URBs when host controller doesn't
support scatter-gather DMA. The use of uninitialized nents means that
buf_len is zero and use_sg is true. But buffer length should not be
zero when an URB uses scatter-gather DMA.

To prevent this situation, add the conditional that checks buf_len
and use_sg. And move the use of nents right after the sgl_alloc() to
avoid the use of uninitialized nents.

If the error occurs, it adds SDEV_EVENT_ERROR_MALLOC and stub_priv
will be released by stub event handler and connection will be shut
down.

Fixes: ea44d19076 ("usbip: Implement SG support to vhci-hcd and stub driver")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Suwan Kim <suwan.kim027@gmail.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191111141035.27788-1-suwan.kim027@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:22 +01:00
9b6ae97d23 usbip: tools: fix fd leakage in the function of read_attr_usbip_status
commit 26a4d4c00f upstream.

We should close the fd before the return of read_attr_usbip_status.

Fixes: 3391ba0e27 ("usbip: tools: Extract generic code to be shared with vudc backend")
Signed-off-by: Hewenliang <hewenliang4@huawei.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191025043515.20053-1-hewenliang4@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:21 +01:00
8c22dc7584 USBIP: add config dependency for SGL_ALLOC
commit 1ec13abac5 upstream.

USBIP uses lib/scatterlist.h
Hence it needs to set CONFIG_SGL_ALLOC

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20191112154939.21217-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:20 +01:00
b730b2ceb2 ALSA: hda - Disable audio component for legacy Nvidia HDMI codecs
commit 5a858e79c9 upstream.

The old Nvidia chips have multiple HD-audio codecs on the same
HD-audio controller, and this doesn't work as expected with the current
audio component binding that is implemented under the one-codec-per-
controller assumption; at the probe time, the driver leads to several
kernel WARNING messages.

For the proper support, we may change the pin2port and port2pin to
traverse the codec list per the given pin number, but this needs more
development and testing.

As a quick workaround, instead, this patch drops the binding in the
audio side for these legacy chips since the audio component support in
nouveau graphics driver is still not merged (hence it's basically
unused).

[ Unlike the original commit, this patch actually disables the audio
  component binding for all Nvidia chips, not only for legacy chips.
  It doesn't matter much, though: nouveau gfx driver still doesn't
  provide the audio component binding on 5.4.y, so it's only a
  placeholder for now.  Also, another difference from the original
  commit is that this removes the nvhdmi_audio_ops and other
  definitions completely in order to avoid a compile warning due to
  unused stuff.  -- tiwai ]

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205625
Fixes: ade49db337 ("ALSA: hda/hdmi - Allow audio component for AMD/ATI and Nvidia HDMI")
Link: https://lore.kernel.org/r/20191122132000.4460-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:19 +01:00
5567384fec media: mceusb: fix out of bounds read in MCE receiver buffer
commit e43148645d upstream.

Fix multiple cases of out of bounds (OOB) read associated with
MCE device receive/input data handling.

In reference for the OOB cases below, the incoming/read (byte) data
format when the MCE device responds to a command is:
    { cmd_prefix, subcmd, data0, data1, ... }
where cmd_prefix are:
    MCE_CMD_PORT_SYS
    MCE_CMD_PORT_IR
and subcmd examples are:
    MCE_RSP_GETPORTSTATUS
    MCE_RSP_EQIRNUMPORTS
    ...
Response size dynamically depends on cmd_prefix and subcmd.
So data0, data1, ... may or may not be present on input.
Multiple responses may return in a single receiver buffer.

The trigger condition for OOB read is typically random or
corrupt input data that fills the mceusb receiver buffer.

Case 1:

mceusb_handle_command() reads data0 (var hi) and data1 (var lo)
regardless of whether the response includes such data.
If { cmd_prefix, subcmd } is at the end of the receiver buffer,
read past end of buffer occurs.

This case was reported by
KASAN: slab-out-of-bounds Read in mceusb_dev_recv
https://syzkaller.appspot.com/bug?extid=c7fdb6cb36e65f2fe8c9

Fix: In mceusb_handle_command(), change variable hi and lo to
pointers, and dereference only when required.

Case 2:

If response with data is truncated at end of buffer after
{ cmd_prefix, subcmd }, mceusb_handle_command() reads past
end of buffer for data0, data1, ...

Fix: In mceusb_process_ir_data(), check response size with
remaining buffer size before invoking mceusb_handle_command().
+    if (i + ir->rem < buf_len)
            mceusb_handle_command(ir, &ir->buf_in[i - 1]);

Case 3:

mceusb_handle_command() handles invalid/bad response such as
{ 0x??, MCE_RSP_GETPORTSTATUS } of length 2 as a response
{ MCE_CMD_PORT_SYS, MCE_RSP_GETPORTSTATUS, data0, ... }
of length 7. Read OOB occurs for non-existent data0, data1, ...
Cause is mceusb_handle_command() does not check cmd_prefix value.

Fix: mceusb_handle_command() must test both cmd_prefix and subcmd.

Case 4:

mceusb_process_ir_data() receiver parser state SUBCMD is
possible at start (i=0) of receiver buffer resulting in buffer
offset=-1 passed to mceusb_dev_printdata().
Bad offset results in OOB read before start of buffer.

[1214218.580308] mceusb 1-1.3:1.0: rx data[0]: 00 80 (length=2)
[1214218.580323] mceusb 1-1.3:1.0: Unknown command 0x00 0x80
...
[1214218.580406] mceusb 1-1.3:1.0: rx data[14]: 7f 7f (length=2)
[1214218.679311] mceusb 1-1.3:1.0: rx data[-1]: 80 90 (length=2)
[1214218.679325] mceusb 1-1.3:1.0: End of raw IR data
[1214218.679340] mceusb 1-1.3:1.0: rx data[1]: 7f 7f (length=2)

Fix: If parser_state is SUBCMD after processing receiver buffer,
reset parser_state to CMD_HEADER.
In effect, discard cmd_prefix at end of receiver buffer.
In mceusb_dev_printdata(), abort if buffer offset is out of bounds.

Case 5:

If response with data is truncated at end of buffer after
{ cmd_prefix, subcmd }, mceusb_dev_printdata() reads past
end of buffer for data0, data1, ...
while decoding the response to print out.

Fix: In mceusb_dev_printdata(), remove unneeded buffer offset
adjustments (var start and var skip) associated with MCE gen1 header.
Test for truncated MCE cmd response (compare offset+len with buf_len)
and skip decoding of incomplete response.
Move IR data tracing to execute before the truncation test.

Signed-off-by: A Sun <as1033x@comcast.net>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:18 +01:00
eff2ccdfd2 media: imon: invalid dereference in imon_touch_event
commit f3f5ba42c5 upstream.

The touch timer is set up in intf1. If the second interface does not exist,
the timer and touch input device are not setup and we get the following
error, when touch events are reported via intf0.

kernel BUG at kernel/time/timer.c:956!
invalid opcode: 0000 [#1] SMP KASAN
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.0-rc1+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__mod_timer kernel/time/timer.c:956 [inline]
RIP: 0010:__mod_timer kernel/time/timer.c:949 [inline]
RIP: 0010:mod_timer+0x5a2/0xb50 kernel/time/timer.c:1100
Code: 45 10 c7 44 24 14 ff ff ff ff 48 89 44 24 08 48 8d 45 20 48 c7 44 24 18 00 00 00 00 48 89 04 24 e9 5a fc ff ff e8 ae ce 0e 00 <0f> 0b e8 a7 ce 0e 00 4c 89 74 24 20 e9 37 fe ff ff e8 98 ce 0e 00
RSP: 0018:ffff8881db209930 EFLAGS: 00010006
RAX: ffffffff86c2b200 RBX: 00000000ffffa688 RCX: ffffffff83efc583
RDX: 0000000000000100 RSI: ffffffff812f4d82 RDI: ffff8881d2356200
RBP: ffff8881d23561e8 R08: ffffffff86c2b200 R09: ffffed103a46abeb
R10: ffffed103a46abea R11: ffff8881d2355f53 R12: dffffc0000000000
R13: 1ffff1103b64132d R14: ffff8881d2355f50 R15: 0000000000000006
FS:  0000000000000000(0000) GS:ffff8881db200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f75e2799000 CR3: 00000001d3b07000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 imon_touch_event drivers/media/rc/imon.c:1348 [inline]
 imon_incoming_packet.isra.0+0x2546/0x2f10 drivers/media/rc/imon.c:1603
 usb_rx_callback_intf0+0x151/0x1e0 drivers/media/rc/imon.c:1734
 __usb_hcd_giveback_urb+0x1f2/0x470 drivers/usb/core/hcd.c:1654
 usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1719
 dummy_timer+0x120f/0x2fa2 drivers/usb/gadget/udc/dummy_hcd.c:1965
 call_timer_fn+0x179/0x650 kernel/time/timer.c:1404
 expire_timers kernel/time/timer.c:1449 [inline]
 __run_timers kernel/time/timer.c:1773 [inline]
 __run_timers kernel/time/timer.c:1740 [inline]
 run_timer_softirq+0x5e3/0x1490 kernel/time/timer.c:1786
 __do_softirq+0x221/0x912 kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:373 [inline]
 irq_exit+0x178/0x1a0 kernel/softirq.c:413
 exiting_irq arch/x86/include/asm/apic.h:536 [inline]
 smp_apic_timer_interrupt+0x12f/0x500 arch/x86/kernel/apic/apic.c:1137
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830
 </IRQ>
RIP: 0010:default_idle+0x28/0x2e0 arch/x86/kernel/process.c:581
Code: 90 90 41 56 41 55 65 44 8b 2d 44 3a 8f 7a 41 54 55 53 0f 1f 44 00 00 e8 36 ee d0 fb e9 07 00 00 00 0f 00 2d fa dd 4f 00 fb f4 <65> 44 8b 2d 20 3a 8f 7a 0f 1f 44 00 00 5b 5d 41 5c 41 5d 41 5e c3
RSP: 0018:ffffffff86c07da8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
RAX: 0000000000000007 RBX: ffffffff86c2b200 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000006 RDI: ffffffff86c2ba4c
RBP: fffffbfff0d85640 R08: ffffffff86c2b200 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 cpuidle_idle_call kernel/sched/idle.c:154 [inline]
 do_idle+0x3b6/0x500 kernel/sched/idle.c:263
 cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:355
 start_kernel+0x82a/0x864 init/main.c:784
 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241
Modules linked in:

Reported-by: syzbot+f49d12d34f2321cf4df2@syzkaller.appspotmail.com
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:17 +01:00
b96f53c165 media: cxusb: detect cxusb_ctrl_msg error in query
commit ca8f245f28 upstream.

Don't use uninitialized ircode[] in cxusb_rc_query() when
cxusb_ctrl_msg() fails to populate its contents.

syzbot reported:

dvb-usb: bulk message failed: -22 (1/-30591)
=====================================================
BUG: KMSAN: uninit-value in ir_lookup_by_scancode drivers/media/rc/rc-main.c:494 [inline]
BUG: KMSAN: uninit-value in rc_g_keycode_from_table drivers/media/rc/rc-main.c:582 [inline]
BUG: KMSAN: uninit-value in rc_keydown+0x1a6/0x6f0 drivers/media/rc/rc-main.c:816
CPU: 1 PID: 11436 Comm: kworker/1:2 Not tainted 5.3.0-rc7+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events dvb_usb_read_remote_control
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x191/0x1f0 lib/dump_stack.c:113
 kmsan_report+0x13a/0x2b0 mm/kmsan/kmsan_report.c:108
 __msan_warning+0x73/0xe0 mm/kmsan/kmsan_instr.c:250
 bsearch+0x1dd/0x250 lib/bsearch.c:41
 ir_lookup_by_scancode drivers/media/rc/rc-main.c:494 [inline]
 rc_g_keycode_from_table drivers/media/rc/rc-main.c:582 [inline]
 rc_keydown+0x1a6/0x6f0 drivers/media/rc/rc-main.c:816
 cxusb_rc_query+0x2e1/0x360 drivers/media/usb/dvb-usb/cxusb.c:548
 dvb_usb_read_remote_control+0xf9/0x290 drivers/media/usb/dvb-usb/dvb-usb-remote.c:261
 process_one_work+0x1572/0x1ef0 kernel/workqueue.c:2269
 worker_thread+0x111b/0x2460 kernel/workqueue.c:2415
 kthread+0x4b5/0x4f0 kernel/kthread.c:256
 ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355

Uninit was stored to memory at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:150 [inline]
 kmsan_internal_chain_origin+0xd2/0x170 mm/kmsan/kmsan.c:314
 __msan_chain_origin+0x6b/0xe0 mm/kmsan/kmsan_instr.c:184
 rc_g_keycode_from_table drivers/media/rc/rc-main.c:583 [inline]
 rc_keydown+0x2c4/0x6f0 drivers/media/rc/rc-main.c:816
 cxusb_rc_query+0x2e1/0x360 drivers/media/usb/dvb-usb/cxusb.c:548
 dvb_usb_read_remote_control+0xf9/0x290 drivers/media/usb/dvb-usb/dvb-usb-remote.c:261
 process_one_work+0x1572/0x1ef0 kernel/workqueue.c:2269
 worker_thread+0x111b/0x2460 kernel/workqueue.c:2415
 kthread+0x4b5/0x4f0 kernel/kthread.c:256
 ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355

Local variable description: ----ircode@cxusb_rc_query
Variable was created at:
 cxusb_rc_query+0x4d/0x360 drivers/media/usb/dvb-usb/cxusb.c:543
 dvb_usb_read_remote_control+0xf9/0x290 drivers/media/usb/dvb-usb/dvb-usb-remote.c:261

Signed-off-by: Vito Caputo <vcaputo@pengaru.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:16 +01:00
acfcb05fbd media: b2c2-flexcop-usb: add sanity checking
commit 1b976fc6d6 upstream.

The driver needs an isochronous endpoint to be present. It will
oops in its absence. Add checking for it.

Reported-by: syzbot+d93dff37e6a89431c158@syzkaller.appspotmail.com
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:16 +01:00
fc12e3da6a media: uvcvideo: Fix error path in control parsing failure
commit 8c279e9394 upstream.

When parsing the UVC control descriptors fails, the error path tries to
cleanup a media device that hasn't been initialised, potentially
resulting in a crash. Fix this by initialising the media device before
the error handling path can be reached.

Fixes: 5a254d751e ("[media] uvcvideo: Register a v4l2_device")
Reported-by: syzbot+c86454eb3af9e8a4da20@syzkaller.appspotmail.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:15 +01:00
fc3b55ef2c futex: Prevent exit livelock
commit 3ef240eaff upstream.

Oleg provided the following test case:

int main(void)
{
	struct sched_param sp = {};

	sp.sched_priority = 2;
	assert(sched_setscheduler(0, SCHED_FIFO, &sp) == 0);

	int lock = vfork();
	if (!lock) {
		sp.sched_priority = 1;
		assert(sched_setscheduler(0, SCHED_FIFO, &sp) == 0);
		_exit(0);
	}

	syscall(__NR_futex, &lock, FUTEX_LOCK_PI, 0,0,0);
	return 0;
}

This creates an unkillable RT process spinning in futex_lock_pi() on a UP
machine or if the process is affine to a single CPU. The reason is:

 parent	    	    			child

  set FIFO prio 2

  vfork()			->	set FIFO prio 1
   implies wait_for_child()	 	sched_setscheduler(...)
 			   		exit()
					do_exit()
 					....
					mm_release()
					  tsk->futex_state = FUTEX_STATE_EXITING;
					  exit_futex(); (NOOP in this case)
					  complete() --> wakes parent
  sys_futex()
    loop infinite because
    tsk->futex_state == FUTEX_STATE_EXITING

The same problem can happen just by regular preemption as well:

  task holds futex
  ...
  do_exit()
    tsk->futex_state = FUTEX_STATE_EXITING;

  --> preemption (unrelated wakeup of some other higher prio task, e.g. timer)

  switch_to(other_task)

  return to user
  sys_futex()
	loop infinite as above

Just for the fun of it the futex exit cleanup could trigger the wakeup
itself before the task sets its futex state to DEAD.

To cure this, the handling of the exiting owner is changed so:

   - A refcount is held on the task

   - The task pointer is stored in a caller visible location

   - The caller drops all locks (hash bucket, mmap_sem) and blocks
     on task::futex_exit_mutex. When the mutex is acquired then
     the exiting task has completed the cleanup and the state
     is consistent and can be reevaluated.

This is not a pretty solution, but there is no choice other than returning
an error code to user space, which would break the state consistency
guarantee and open another can of problems including regressions.

For stable backports the preparatory commits ac31c7ff86 .. ba31c1a485
are required as well, but for anything older than 5.3.y the backports are
going to be provided when this hits mainline as the other dependencies for
those kernels are definitely not stable material.

Fixes: 778e9a9c3e ("pi-futex: fix exit races and locking problems")
Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Stable Team <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/20191106224557.041676471@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:14 +01:00
56690612a9 futex: Provide distinct return value when owner is exiting
commit ac31c7ff86 upstream.

attach_to_pi_owner() returns -EAGAIN for various cases:

 - Owner task is exiting
 - Futex value has changed

The caller drops the held locks (hash bucket, mmap_sem) and retries the
operation. In case of the owner task exiting this can result in a live
lock.

As a preparatory step for seperating those cases, provide a distinct return
value (EBUSY) for the owner exiting case.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.935606117@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:14 +01:00
d3ba1e8d5c futex: Add mutex around futex exit
commit 3f186d9748 upstream.

The mutex will be used in subsequent changes to replace the busy looping of
a waiter when the futex owner is currently executing the exit cleanup to
prevent a potential live lock.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.845798895@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:13 +01:00
172b09ddc3 futex: Provide state handling for exec() as well
commit af8cbda2cf upstream.

exec() attempts to handle potentially held futexes gracefully by running
the futex exit handling code like exit() does.

The current implementation has no protection against concurrent incoming
waiters. The reason is that the futex state cannot be set to
FUTEX_STATE_DEAD after the cleanup because the task struct is still active
and just about to execute the new binary.

While its arguably buggy when a task holds a futex over exec(), for
consistency sake the state handling can at least cover the actual futex
exit cleanup section. This provides state consistency protection accross
the cleanup. As the futex state of the task becomes FUTEX_STATE_OK after the
cleanup has been finished, this cannot prevent subsequent attempts to
attach to the task in case that the cleanup was not successfull in mopping
up all leftovers.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.753355618@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:13 +01:00
398902dbc8 futex: Sanitize exit state handling
commit 4a8e991b91 upstream.

Instead of having a smp_mb() and an empty lock/unlock of task::pi_lock move
the state setting into to the lock section.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.645603214@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:12 +01:00
b2f4e10676 futex: Mark the begin of futex exit explicitly
commit 18f694385c upstream.

Instead of relying on PF_EXITING use an explicit state for the futex exit
and set it in the futex exit function. This moves the smp barrier and the
lock/unlock serialization into the futex code.

As with the DEAD state this is restricted to the exit path as exec
continues to use the same task struct.

This allows to simplify that logic in a next step.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.539409004@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:11 +01:00
350a30ce84 futex: Set task::futex_state to DEAD right after handling futex exit
commit f24f22435d upstream.

Setting task::futex_state in do_exit() is rather arbitrarily placed for no
reason. Move it into the futex code.

Note, this is only done for the exit cleanup as the exec cleanup cannot set
the state to FUTEX_STATE_DEAD because the task struct is still in active
use.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.439511191@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:10 +01:00
1bcee23370 futex: Split futex_mm_release() for exit/exec
commit 150d71584b upstream.

To allow separate handling of the futex exit state in the futex exit code
for exit and exec, split futex_mm_release() into two functions and invoke
them from the corresponding exit/exec_mm_release() callsites.

Preparatory only, no functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.332094221@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:10 +01:00
7d7e93588f exit/exec: Seperate mm_release()
commit 4610ba7ad8 upstream.

mm_release() contains the futex exit handling. mm_release() is called from
do_exit()->exit_mm() and from exec()->exec_mm().

In the exit_mm() case PF_EXITING and the futex state is updated. In the
exec_mm() case these states are not touched.

As the futex exit code needs further protections against exit races, this
needs to be split into two functions.

Preparatory only, no functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.240518241@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:10 +01:00
52507cfaff futex: Replace PF_EXITPIDONE with a state
commit 3d4775df0a upstream.

The futex exit handling relies on PF_ flags. That's suboptimal as it
requires a smp_mb() and an ugly lock/unlock of the exiting tasks pi_lock in
the middle of do_exit() to enforce the observability of PF_EXITING in the
futex code.

Add a futex_state member to task_struct and convert the PF_EXITPIDONE logic
over to the new state. The PF_EXITING dependency will be cleaned up in a
later step.

This prepares for handling various futex exit issues later.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.149449274@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:09 +01:00
8012f98f92 futex: Move futex exit handling into futex code
commit ba31c1a485 upstream.

The futex exit handling is #ifdeffed into mm_release() which is not pretty
to begin with. But upcoming changes to address futex exit races need to add
more functionality to this exit code.

Split it out into a function, move it into futex code and make the various
futex exit functions static.

Preparatory only and no functional change.

Folded build fix from Borislav.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.049705556@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:08 +01:00
ba386ec3d7 cpufreq: Add NULL checks to show() and store() methods of cpufreq
commit e6e8df0726 upstream.

Add NULL checks to show() and store() in cpufreq.c to avoid attempts
to invoke a NULL callback.

Though some interfaces of cpufreq are set as read-only, users can
still get write permission using chmod which can lead to a kernel
crash, as follows:

chmod +w /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
echo 1 >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

This bug was found in linux 4.19.

Signed-off-by: Kai Shen <shenkai8@huawei.com>
Reported-by: Feilong Lin <linfeilong@huawei.com>
Reviewed-by: Feilong Lin <linfeilong@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
[ rjw: Subject & changelog ]
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:07 +01:00
3143cd5f00 media: usbvision: Fix races among open, close, and disconnect
commit 9e08117c9d upstream.

Visual inspection of the usbvision driver shows that it suffers from
three races between its open, close, and disconnect handlers.  In
particular, the driver is careful to update its usbvision->user and
usbvision->remove_pending flags while holding the private mutex, but:

	usbvision_v4l2_close() and usbvision_radio_close() don't hold
	the mutex while they check the value of
	usbvision->remove_pending;

	usbvision_disconnect() doesn't hold the mutex while checking
	the value of usbvision->user; and

	also, usbvision_v4l2_open() and usbvision_radio_open() don't
	check whether the device has been unplugged before allowing
	the user to open the device files.

Each of these can potentially lead to usbvision_release() being called
twice and use-after-free errors.

This patch fixes the races by reading the flags while the mutex is
still held and checking for pending removes before allowing an open to
succeed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:06 +01:00
ddac4e3401 media: usbvision: Fix invalid accesses after device disconnect
commit c7a1914640 upstream.

The syzbot fuzzer found two invalid-access bugs in the usbvision
driver.  These bugs occur when userspace keeps the device file open
after the device has been disconnected and usbvision_disconnect() has
set usbvision->dev to NULL:

	When the device file is closed, usbvision_radio_close() tries
	to issue a usb_set_interface() call, passing the NULL pointer
	as its first argument.

	If userspace performs a querycap ioctl call, vidioc_querycap()
	calls usb_make_path() with the same NULL pointer.

This patch fixes the problems by making the appropriate tests
beforehand.  Note that vidioc_querycap() is protected by
usbvision->v4l2_lock, acquired in a higher layer of the V4L2
subsystem.

Reported-and-tested-by: syzbot+7fa38a608b1075dfd634@syzkaller.appspotmail.com

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:05 +01:00
5aa7ad7e99 media: vivid: Fix wrong locking that causes race conditions on streaming stop
commit 6dcd5d7a7a upstream.

There is the same incorrect approach to locking implemented in
vivid_stop_generating_vid_cap(), vivid_stop_generating_vid_out() and
sdr_cap_stop_streaming().

These functions are called during streaming stopping with vivid_dev.mutex
locked. And they all do the same mistake while stopping their kthreads,
which need to lock this mutex as well. See the example from
vivid_stop_generating_vid_cap():
  /* shutdown control thread */
  vivid_grab_controls(dev, false);
  mutex_unlock(&dev->mutex);
  kthread_stop(dev->kthread_vid_cap);
  dev->kthread_vid_cap = NULL;
  mutex_lock(&dev->mutex);

But when this mutex is unlocked, another vb2_fop_read() can lock it
instead of vivid_thread_vid_cap() and manipulate the buffer queue.
That causes a use-after-free access later.

To fix those issues let's:
  1. avoid unlocking the mutex in vivid_stop_generating_vid_cap(),
vivid_stop_generating_vid_out() and sdr_cap_stop_streaming();
  2. use mutex_trylock() with schedule_timeout_uninterruptible() in
the loops of the vivid kthread handlers.

Signed-off-by: Alexander Popov <alex.popov@linux.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: <stable@vger.kernel.org>      # for v3.18 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:04 +01:00
92edb64da9 media: vivid: Set vid_cap_streaming and vid_out_streaming to true
commit b4add02d22 upstream.

When vbi stream is started, followed by video streaming,
the vid_cap_streaming and vid_out_streaming were not being set to true,
which would cause the video stream to stop when vbi stream is stopped.
This patch allows to set vid_cap_streaming and vid_out_streaming to true.
According to Hans Verkuil it appears that these 'if (dev->kthread_vid_cap)'
checks are a left-over from the original vivid development and should never
have been there.

Signed-off-by: Vandana BN <bnvandana@gmail.com>
Cc: <stable@vger.kernel.org>      # for v3.18 and up
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:03 +01:00
9756233a20 ALSA: usb-audio: Fix Scarlett 6i6 Gen 2 port data
commit ce3cba788a upstream.

The s6i6_gen2_info.ports[] array had the Mixer and PCM port type
entries in the wrong place. Use designators to explicitly specify the
array elements being set.

Fixes: 9e4d5c1be2 ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Tested-by: Alex Fellows <alex.fellows@gmail.com>
Tested-by: Markus Schroetter <project.m.schroetter@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191110134356.GA31589@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:02 +01:00
0d0dc91e84 ALSA: usb-audio: Fix NULL dereference at parsing BADD
commit 9435f2bb66 upstream.

snd_usb_mixer_controls_badd() that parses UAC3 BADD profiles misses a
NULL check for the given interfaces.  When a malformed USB descriptor
is passed, this may lead to an Oops, as spotted by syzkaller.
Skip the iteration if the interface doesn't exist for avoiding the
crash.

Fixes: 17156f23e9 ("ALSA: usb: add UAC3 BADD profiles support")
Reported-by: syzbot+a36ab65c6653d7ccdd62@syzkaller.appspotmail.com
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191122112840.24797-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:01 +01:00
82ca3ab31b futex: Prevent robust futex exit race
commit ca16d5bee5 upstream.

Robust futexes utilize the robust_list mechanism to allow the kernel to
release futexes which are held when a task exits. The exit can be voluntary
or caused by a signal or fault. This prevents that waiters block forever.

The futex operations in user space store a pointer to the futex they are
either locking or unlocking in the op_pending member of the per task robust
list.

After a lock operation has succeeded the futex is queued in the robust list
linked list and the op_pending pointer is cleared.

After an unlock operation has succeeded the futex is removed from the
robust list linked list and the op_pending pointer is cleared.

The robust list exit code checks for the pending operation and any futex
which is queued in the linked list. It carefully checks whether the futex
value is the TID of the exiting task. If so, it sets the OWNER_DIED bit and
tries to wake up a potential waiter.

This is race free for the lock operation but unlock has two race scenarios
where waiters might not be woken up. These issues can be observed with
regular robust pthread mutexes. PI aware pthread mutexes are not affected.

(1) Unlocking task is killed after unlocking the futex value in user space
    before being able to wake a waiter.

        pthread_mutex_unlock()
                |
                V
        atomic_exchange_rel (&mutex->__data.__lock, 0)
                        <------------------------killed
            lll_futex_wake ()                   |
                                                |
                                                |(__lock = 0)
                                                |(enter kernel)
                                                |
                                                V
                                            do_exit()
                                            exit_mm()
                                          mm_release()
                                        exit_robust_list()
                                        handle_futex_death()
                                                |
                                                |(__lock = 0)
                                                |(uval = 0)
                                                |
                                                V
        if ((uval & FUTEX_TID_MASK) != task_pid_vnr(curr))
                return 0;

    The sanity check which ensures that the user space futex is owned by
    the exiting task prevents the wakeup of waiters which in consequence
    block infinitely.

(2) Waiting task is killed after a wakeup and before it can acquire the
    futex in user space.

        OWNER                         WAITER
				futex_wait()
   pthread_mutex_unlock()               |
                |                       |
                |(__lock = 0)           |
                |                       |
                V                       |
         futex_wake() ------------>  wakeup()
                                        |
                                        |(return to userspace)
                                        |(__lock = 0)
                                        |
                                        V
                        oldval = mutex->__data.__lock
                                          <-----------------killed
    atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,  |
                        id | assume_other_futex_waiters, 0)      |
                                                                 |
                                                                 |
                                                   (enter kernel)|
                                                                 |
                                                                 V
                                                         do_exit()
                                                        |
                                                        |
                                                        V
                                        handle_futex_death()
                                        |
                                        |(__lock = 0)
                                        |(uval = 0)
                                        |
                                        V
        if ((uval & FUTEX_TID_MASK) != task_pid_vnr(curr))
                return 0;

    The sanity check which ensures that the user space futex is owned
    by the exiting task prevents the wakeup of waiters, which seems to
    be correct as the exiting task does not own the futex value, but
    the consequence is that other waiters wont be woken up and block
    infinitely.

In both scenarios the following conditions are true:

   - task->robust_list->list_op_pending != NULL
   - user space futex value == 0
   - Regular futex (not PI)

If these conditions are met then it is reasonably safe to wake up a
potential waiter in order to prevent the above problems.

As this might be a false positive it can cause spurious wakeups, but the
waiter side has to handle other types of unrelated wakeups, e.g. signals
gracefully anyway. So such a spurious wakeup will not affect the
correctness of these operations.

This workaround must not touch the user space futex value and cannot set
the OWNER_DIED bit because the lock value is 0, i.e. uncontended. Setting
OWNER_DIED in this case would result in inconsistent state and subsequently
in malfunction of the owner died handling in user space.

The rest of the user space state is still consistent as no other task can
observe the list_op_pending entry in the exiting tasks robust list.

The eventually woken up waiter will observe the uncontended lock value and
take it over.

[ tglx: Massaged changelog and comment. Made the return explicit and not
  	depend on the subsequent check and added constants to hand into
  	handle_futex_death() instead of plain numbers. Fixed a few coding
	style issues. ]

Fixes: 0771dfefc9 ("[PATCH] lightweight robust futexes: core")
Signed-off-by: Yang Tao <yang.tao172@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/1573010582-35297-1-git-send-email-wang.yi59@zte.com.cn
Link: https://lkml.kernel.org/r/20191106224555.943191378@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:01 +01:00
95443fc0d7 x86/entry/32: Fix FIXUP_ESPFIX_STACK with user CR3
commit 4a13b0e3e1 upstream.

UNWIND_ESPFIX_STACK needs to read the GDT, and the GDT mapping that
can be accessed via %fs is not mapped in the user pagetables.  Use
SGDT to find the cpu_entry_area mapping and read the espfix offset
from that instead.

Reported-and-tested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:00 +01:00
cd923d2b57 x86/pti/32: Calculate the various PTI cpu_entry_area sizes correctly, make the CPU_ENTRY_AREA_PAGES assert precise
commit 05b042a194 upstream.

When two recent commits that increased the size of the 'struct cpu_entry_area'
were merged in -tip, the 32-bit defconfig build started failing on the following
build time assert:

  ./include/linux/compiler.h:391:38: error: call to ‘__compiletime_assert_189’ declared with attribute error: BUILD_BUG_ON failed: CPU_ENTRY_AREA_PAGES * PAGE_SIZE < CPU_ENTRY_AREA_MAP_SIZE
  arch/x86/mm/cpu_entry_area.c:189:2: note: in expansion of macro ‘BUILD_BUG_ON’
  In function ‘setup_cpu_entry_area_ptes’,

Which corresponds to the following build time assert:

	BUILD_BUG_ON(CPU_ENTRY_AREA_PAGES * PAGE_SIZE < CPU_ENTRY_AREA_MAP_SIZE);

The purpose of this assert is to sanity check the fixed-value definition of
CPU_ENTRY_AREA_PAGES arch/x86/include/asm/pgtable_32_types.h:

	#define CPU_ENTRY_AREA_PAGES    (NR_CPUS * 41)

The '41' is supposed to match sizeof(struct cpu_entry_area)/PAGE_SIZE, which value
we didn't want to define in such a low level header, because it would cause
dependency hell.

Every time the size of cpu_entry_area is changed, we have to adjust CPU_ENTRY_AREA_PAGES
accordingly - and this assert is checking that constraint.

But the assert is both imprecise and buggy, primarily because it doesn't
include the single readonly IDT page that is mapped at CPU_ENTRY_AREA_BASE
(which begins at a PMD boundary).

This bug was hidden by the fact that by accident CPU_ENTRY_AREA_PAGES is defined
too large upstream (v5.4-rc8):

	#define CPU_ENTRY_AREA_PAGES    (NR_CPUS * 40)

While 'struct cpu_entry_area' is 155648 bytes, or 38 pages. So we had two extra
pages, which hid the bug.

The following commit (not yet upstream) increased the size to 40 pages:

  x86/iopl: ("Restrict iopl() permission scope")

... but increased CPU_ENTRY_AREA_PAGES only 41 - i.e. shortening the gap
to just 1 extra page.

Then another not-yet-upstream commit changed the size again:

  880a98c339: ("x86/cpu_entry_area: Add guard page for entry stack on 32bit")

Which increased the cpu_entry_area size from 38 to 39 pages, but
didn't change CPU_ENTRY_AREA_PAGES (kept it at 40). This worked
fine, because we still had a page left from the accidental 'reserve'.

But when these two commits were merged into the same tree, the
combined size of cpu_entry_area grew from 38 to 40 pages, while
CPU_ENTRY_AREA_PAGES finally caught up to 40 as well.

Which is fine in terms of functionality, but the assert broke:

	BUILD_BUG_ON(CPU_ENTRY_AREA_PAGES * PAGE_SIZE < CPU_ENTRY_AREA_MAP_SIZE);

because CPU_ENTRY_AREA_MAP_SIZE is the total size of the area,
which is 1 page larger due to the IDT page.

To fix all this, change the assert to two precise asserts:

	BUILD_BUG_ON((CPU_ENTRY_AREA_PAGES+1)*PAGE_SIZE != CPU_ENTRY_AREA_MAP_SIZE);
	BUILD_BUG_ON(CPU_ENTRY_AREA_TOTAL_SIZE != CPU_ENTRY_AREA_MAP_SIZE);

This takes the IDT page into account, and also connects the size-based
define of CPU_ENTRY_AREA_TOTAL_SIZE with the address-subtraction based
define of CPU_ENTRY_AREA_MAP_SIZE.

Also clean up some of the names which made it rather confusing:

 - 'CPU_ENTRY_AREA_TOT_SIZE' wasn't actually the 'total' size of
   the cpu-entry-area, but the per-cpu array size, so rename this
   to CPU_ENTRY_AREA_ARRAY_SIZE.

 - Introduce CPU_ENTRY_AREA_TOTAL_SIZE that _is_ the total mapping
   size, with the IDT included.

 - Add comments where '+1' denotes the IDT mapping - it wasn't
   obvious and took me about 3 hours to decode...

Finally, because this particular commit is actually applied after
this patch:

  880a98c339: ("x86/cpu_entry_area: Add guard page for entry stack on 32bit")

Fix the CPU_ENTRY_AREA_PAGES value from 40 pages to the correct 39 pages.

All future commits that change cpu_entry_area will have to adjust
this value precisely.

As a side note, we should probably attempt to remove CPU_ENTRY_AREA_PAGES
and derive its value directly from the structure, without causing
header hell - but that is an adventure for another day! :-)

Fixes: 880a98c339: ("x86/cpu_entry_area: Add guard page for entry stack on 32bit")
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: stable@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:10:00 +01:00
92f8c688b2 selftests/x86/sigreturn/32: Invalidate DS and ES when abusing the kernel
commit 4d2fa82d98 upstream.

If the kernel accidentally uses DS or ES while the user values are
loaded, it will work fine for sane userspace.  In the interest of
simulating maximally insane userspace, make sigreturn_32 zero out DS
and ES for the nasty parts so that inadvertent use of these segments
will crash.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:59 +01:00
72e521b167 selftests/x86/mov_ss_trap: Fix the SYSENTER test
commit 8caa016bfc upstream.

For reasons that I haven't quite fully diagnosed, running
mov_ss_trap_32 on a 32-bit kernel results in an infinite loop in
userspace.  This appears to be because the hacky SYSENTER test
doesn't segfault as desired; instead it corrupts the program state
such that it infinite loops.

Fix it by explicitly clearing EBP before doing SYSENTER.  This will
give a more reliable segfault.

Fixes: 59c2a7226f ("x86/selftests: Add mov_to_ss test")
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:58 +01:00
e74c494a20 x86/entry/32: Fix NMI vs ESPFIX
commit 8954290765 upstream.

When the NMI lands on an ESPFIX_SS, we are on the entry stack and must
swizzle, otherwise we'll run do_nmi() on the entry stack, which is
BAD.

Also, similar to the normal exception path, we need to correct the
ESPFIX magic before leaving the entry stack, otherwise pt_regs will
present a non-flat stack pointer.

Tested by running sigreturn_32 concurrent with perf-record.

Fixes: e5862d0515 ("x86/entry/32: Leave the kernel via trampoline stack")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:58 +01:00
778226c41e x86/entry/32: Unwind the ESPFIX stack earlier on exception entry
commit a1a338e5b6 upstream.

Right now, we do some fancy parts of the exception entry path while SS
might have a nonzero base: we fill in regs->ss and regs->sp, and we
consider switching to the kernel stack. This results in regs->ss and
regs->sp referring to a non-flat stack and it may result in
overflowing the entry stack. The former issue means that we can try to
call iret_exc on a non-flat stack, which doesn't work.

Tested with selftests/x86/sigreturn_32.

Fixes: 45d7b25574 ("x86/entry/32: Enter the kernel via trampoline stack")
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:57 +01:00
9352a3a1ee x86/entry/32: Move FIXUP_FRAME after pushing %fs in SAVE_ALL
commit 82cb8a0b1d upstream.

This will allow us to get percpu access working before FIXUP_FRAME,
which will allow us to unwind ESPFIX earlier.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:56 +01:00
81a204f1b4 x86/entry/32: Use %ss segment where required
commit 4c4fd55d3d upstream.

When re-building the IRET frame we use %eax as an destination %esp,
make sure to then also match the segment for when there is a nonzero
SS base (ESPFIX).

[peterz: Changelog and minor edits]
Fixes: 3c88c692c2 ("x86/stackframe/32: Provide consistent pt_regs")
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:55 +01:00
0fbd1f06b6 x86/entry/32: Fix IRET exception
commit 40ad219958 upstream.

As reported by Lai, the commit 3c88c692c2 ("x86/stackframe/32:
Provide consistent pt_regs") wrecked the IRET EXTABLE entry by making
.Lirq_return not point at IRET.

Fix this by placing IRET_FRAME in RESTORE_REGS, to mirror how
FIXUP_FRAME is part of SAVE_ALL.

Fixes: 3c88c692c2 ("x86/stackframe/32: Provide consistent pt_regs")
Reported-by: Lai Jiangshan <laijs@linux.alibaba.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:54 +01:00
90964a3fb5 x86/cpu_entry_area: Add guard page for entry stack on 32bit
commit 880a98c339 upstream.

The entry stack in the cpu entry area is protected against overflow by the
readonly GDT on 64-bit, but on 32-bit the GDT needs to be writeable and
therefore does not trigger a fault on stack overflow.

Add a guard page.

Fixes: c482feefe1 ("x86/entry/64: Make cpu_entry_area.tss read-only")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:54 +01:00
987e90450a x86/pti/32: Size initial_page_table correctly
commit f490e07c53 upstream.

Commit 945fd17ab6 ("x86/cpu_entry_area: Sync cpu_entry_area to
initial_page_table") introduced the sync for the initial page table for
32bit.

sync_initial_page_table() uses clone_pgd_range() which does the update for
the kernel page table. If PTI is enabled it also updates the user space
page table counterpart, which is assumed to be in the next page after the
target PGD.

At this point in time 32-bit did not have PTI support, so the user space
page table update was not taking place.

The support for PTI on 32-bit which was introduced later on, did not take
that into account and missed to add the user space counter part for the
initial page table.

As a consequence sync_initial_page_table() overwrites any data which is
located in the page behing initial_page_table causing random failures,
e.g. by corrupting doublefault_tss and wreckaging the doublefault handler
on 32bit.

Fix it by adding a "user" page table right after initial_page_table.

Fixes: 7757d607c6 ("x86/pti: Allow CONFIG_PAGE_TABLE_ISOLATION for x86_32")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:52 +01:00
2867004c1d x86/doublefault/32: Fix stack canaries in the double fault handler
commit 3580d0b29c upstream.

The double fault TSS was missing GS setup, which is needed for stack
canaries to work.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:51 +01:00
274ad46fb7 x86/xen/32: Simplify ring check in xen_iret_crit_fixup()
commit 922eea2ce5 upstream.

This can be had with two instead of six insns, by just checking the high
CS.RPL bit.

Also adjust the comment - there would be no #GP in the mentioned cases, as
there's no segment limit violation or alike. Instead there'd be #PF, but
that one reports the target EIP of said branch, not the address of the
branch insn itself.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lkml.kernel.org/r/a5986837-01eb-7bf8-bf42-4d3084d6a1f5@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:50 +01:00
5f74e73ec3 x86/xen/32: Make xen_iret_crit_fixup() independent of frame layout
commit 29b810f5a5 upstream.

Now that SS:ESP always get saved by SAVE_ALL, this also needs to be
accounted for in xen_iret_crit_fixup(). Otherwise the old_ax value gets
interpreted as EFLAGS, and hence VM86 mode appears to be active all the
time, leading to random "vm86_32: no user_vm86: BAD" log messages alongside
processes randomly crashing.

Since following the previous model (sitting after SAVE_ALL) would further
complicate the code _and_ retain the dependency of xen_iret_crit_fixup() on
frame manipulations done by entry_32.S, switch things around and do the
adjustment ahead of SAVE_ALL.

Fixes: 3c88c692c2 ("x86/stackframe/32: Provide consistent pt_regs")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Juergen Gross <jgross@suse.com>
Cc: Stable Team <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/32d8713d-25a7-84ab-b74b-aa3e88abce6b@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:49 +01:00
4614bc9655 x86/stackframe/32: Repair 32-bit Xen PV
commit 81ff2c37f9 upstream.

Once again RPL checks have been introduced which don't account for a 32-bit
kernel living in ring 1 when running in a PV Xen domain. The case in
FIXUP_FRAME has been preventing boot.

Adjust BUG_IF_WRONG_CR3 as well to guard against future uses of the macro
on a code path reachable when running in PV mode under Xen; I have to admit
that I stopped at a certain point trying to figure out whether there are
present ones.

Fixes: 3c88c692c2 ("x86/stackframe/32: Provide consistent pt_regs")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Stable Team <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/0fad341f-b7f5-f859-d55d-f0084ee7087e@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:48 +01:00
abf404dfa5 nbd: prevent memory leak
commit 03bf73c315 upstream.

In nbd_add_socket when krealloc succeeds, if nsock's allocation fail the
reallocted memory is leak. The correct behaviour should be assigning the
reallocted memory to config->socks right after success.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:47 +01:00
7b77206ad5 x86/speculation: Fix redundant MDS mitigation message
commit cd5a2aa89e upstream.

Since MDS and TAA mitigations are inter-related for processors that are
affected by both vulnerabilities, the followiing confusing messages can
be printed in the kernel log:

  MDS: Vulnerable
  MDS: Mitigation: Clear CPU buffers

To avoid the first incorrect message, defer the printing of MDS
mitigation after the TAA mitigation selection has been done. However,
that has the side effect of printing TAA mitigation first before MDS
mitigation.

 [ bp: Check box is affected/mitigations are disabled first before
   printing and massage. ]

Suggested-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Mark Gross <mgross@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20191115161445.30809-3-longman@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:47 +01:00
75cad94d03 x86/speculation: Fix incorrect MDS/TAA mitigation status
commit 64870ed1b1 upstream.

For MDS vulnerable processors with TSX support, enabling either MDS or
TAA mitigations will enable the use of VERW to flush internal processor
buffers at the right code path. IOW, they are either both mitigated
or both not. However, if the command line options are inconsistent,
the vulnerabilites sysfs files may not report the mitigation status
correctly.

For example, with only the "mds=off" option:

  vulnerabilities/mds:Vulnerable; SMT vulnerable
  vulnerabilities/tsx_async_abort:Mitigation: Clear CPU buffers; SMT vulnerable

The mds vulnerabilities file has wrong status in this case. Similarly,
the taa vulnerability file will be wrong with mds mitigation on, but
taa off.

Change taa_select_mitigation() to sync up the two mitigation status
and have them turned off if both "mds=off" and "tsx_async_abort=off"
are present.

Update documentation to emphasize the fact that both "mds=off" and
"tsx_async_abort=off" have to be specified together for processors that
are affected by both TAA and MDS to be effective.

 [ bp: Massage and add kernel-parameters.txt change too. ]

Fixes: 1b42f01741 ("x86/speculation/taa: Add mitigation for TSX Async Abort")
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: linux-doc@vger.kernel.org
Cc: Mark Gross <mgross@linux.intel.com>
Cc: <stable@vger.kernel.org>
Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20191115161445.30809-2-longman@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:46 +01:00
c5bc6816fc x86/insn: Fix awk regexp warnings
commit 700c1018b8 upstream.

gawk 5.0.1 generates the following regexp warnings:

  GEN      /home/sasha/torvalds/tools/objtool/arch/x86/lib/inat-tables.c
  awk: ../arch/x86/tools/gen-insn-attr-x86.awk:260: warning: regexp escape sequence `\:' is not a known regexp operator
  awk: ../arch/x86/tools/gen-insn-attr-x86.awk:350: (FILENAME=../arch/x86/lib/x86-opcode-map.txt FNR=41) warning: regexp escape sequence `\&' is  not a known regexp operator

Ealier versions of gawk are not known to generate these warnings. The
gawk manual referenced below does not list characters ':' and '&' as
needing escaping, so 'unescape' them. See

  https://www.gnu.org/software/gawk/manual/html_node/Escape-Sequences.html

for more info.

Running diff on the output generated by the script before and after
applying the patch reported no differences.

 [ bp: Massage commit message. ]

[ Caught the respective tools header discrepancy. ]
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20190924044659.3785-1-alexander.kapshuk@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:45 +01:00
8ac794da75 md/raid10: prevent access of uninitialized resync_pages offset
commit 45422b704d upstream.

Due to unneeded multiplication in the out_free_pages portion of
r10buf_pool_alloc(), when using a 3-copy raid10 layout, it is
possible to access a resync_pages offset that has not been
initialized.  This access translates into a crash of the system
within resync_free_pages() while passing a bad pointer to
put_page().  Remove the multiplication, preventing access to the
uninitialized area.

Fixes: f025061836 ("md: raid10: don't use bio's vec table to manage resync pages")
Cc: stable@vger.kernel.org # 4.12+
Signed-off-by: John Pittman <jpittman@redhat.com>
Suggested-by: David Jeffery <djeffery@redhat.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:45 +01:00
191355a2cf Revert "dm crypt: use WQ_HIGHPRI for the IO and crypt workqueues"
commit f612b2132d upstream.

This reverts commit a1b89132dc.

Revert required hand-patching due to subsequent changes that were
applied since commit a1b89132dc.

Requires: ed0302e830 ("dm crypt: make workqueue names device-specific")
Cc: stable@vger.kernel.org
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=199857
Reported-by: Vito Caputo <vcaputo@pengaru.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:44 +01:00
68c5b8cb26 Revert "Bluetooth: hci_ll: set operational frequency earlier"
commit cef456cd35 upstream.

As nice as it would be to update firmware faster, that patch broke
at least two different boards, an OMAP4+WL1285 based Motorola Droid
4, as reported by Sebasian Reichel and the Logic PD i.MX6Q +
WL1837MOD.

This reverts commit a2e02f38ef.

Signed-off-by: Adam Ford <aford173@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: stable@vger.kernel.org
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:43 +01:00
457c529fc1 ath10k: restore QCA9880-AR1A (v1) detection
commit f8914a1462 upstream.

This patch restores the old behavior that read
the chip_id on the QCA988x before resetting the
chip. This needs to be done in this order since
the unsupported QCA988x AR1A chips fall off the
bus when resetted. Otherwise the next MMIO Op
after the reset causes a BUS ERROR and panic.

Cc: stable@vger.kernel.org
Fixes: 1a7fecb766 ("ath10k: reset chip before reading chip_id in probe")
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:42 +01:00
2a807b1b4e ath10k: Fix HOST capability QMI incompatibility
commit 7165ef890a upstream.

The introduction of 768ec4c012 ("ath10k: update HOST capability QMI
message") served the purpose of supporting the new and extended HOST
capability QMI message.

But while the new message adds a slew of optional members it changes the
data type of the "daemon_support" member, which means that older
versions of the firmware will fail to decode the incoming request
message.

There is no way to detect this breakage from Linux and there's no way to
recover from sending the wrong message (i.e. we can't just try one
format and then fallback to the other), so a quirk is introduced in
DeviceTree to indicate to the driver that the firmware requires the 8bit
version of this message.

Cc: stable@vger.kernel.org
Fixes: 768ec4c012 ("ath10k: update HOST capability qmi message")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:41 +01:00
0126be1409 ath10k: Fix a NULL-ptr-deref bug in ath10k_usb_alloc_urb_from_pipe
commit bfd6e6e6c5 upstream.

The `ar_usb` field of `ath10k_usb_pipe_usb_pipe` objects
are initialized to point to the containing `ath10k_usb` object
according to endpoint descriptors read from the device side, as shown
below in `ath10k_usb_setup_pipe_resources`:

for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
        endpoint = &iface_desc->endpoint[i].desc;

        // get the address from endpoint descriptor
        pipe_num = ath10k_usb_get_logical_pipe_num(ar_usb,
                                                endpoint->bEndpointAddress,
                                                &urbcount);
        ......
        // select the pipe object
        pipe = &ar_usb->pipes[pipe_num];

        // initialize the ar_usb field
        pipe->ar_usb = ar_usb;
}

The driver assumes that the addresses reported in endpoint
descriptors from device side  to be complete. If a device is
malicious and does not report complete addresses, it may trigger
NULL-ptr-deref `ath10k_usb_alloc_urb_from_pipe` and
`ath10k_usb_free_urb_to_pipe`.

This patch fixes the bug by preventing potential NULL-ptr-deref.

Signed-off-by: Hui Peng <benquike@gmail.com>
Reported-by: Hui Peng <benquike@gmail.com>
Reported-by: Mathias Payer <mathias.payer@nebelwelt.net>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[groeck: Add driver tag to subject, fix build warning]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:41 +01:00
3064134f88 ath9k_hw: fix uninitialized variable data
commit 80e84f3641 upstream.

Currently, data variable in ar9003_hw_thermo_cal_apply() could be
uninitialized if ar9300_otp_read_word() will fail to read the value.
Initialize data variable with 0 to prevent an undefined behavior. This
will be enough to handle error case when ar9300_otp_read_word() fails.

Fixes: 80fe43f2bb ("ath9k_hw: Read and configure thermocal for AR9462")
Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: stable@vger.kernel.org
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:40 +01:00
6b47a3043a Bluetooth: Fix invalid-free in bcsp_close()
commit cf94da6f50 upstream.

Syzbot reported an invalid-free that I introduced fixing a memleak.

bcsp_recv() also frees bcsp->rx_skb but never nullifies its value.
Nullify bcsp->rx_skb every time it is freed.

Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+a0d209a4676664613e76@syzkaller.appspotmail.com
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Alexander Potapenko <glider@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-29 10:09:39 +01:00
f262be36f6 LF-252 usb: cdns3: gadget: fix the issue for DMA scatter buffer list
If the DMA buffer is sgatter list, current TD organization is wrong.
Fix this in this commit. We triggered this issue due to the f_fs
begins to use scatter buffer list as data buffer.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-29 16:28:05 +08:00
dfb874e95e LF-215: ASoC: fsl_rpmsg_i2s: Enable WQ_FREEZABLE for workqueue
In the end of playback, when the suspend happen, there will be error
in m4 side.

RTM_SaiSdmaAdapter_SetParam: Tx in wrong state 2!
SRTM_SaiSdmaAdapter_SetBuf: Tx in wrong state 2!
SRTM_SaiSdmaAdapter_Start: Tx in wrong state 2!

The reason is that the I2S_TX_TERMINATE happen in the middle of
I2S_TX_SUSPEND and I2S_TX_RESUME, this sequence is not allowed.

So we make the rpmsg message workqueue enter freeze in suspend
to avoid such issue. that the command sequence will be
I2S_TX_SUSPEND->I2S_TX_RESUME->I2S_TX_TERMINATE

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-29 16:15:08 +08:00
d12ea28a22 LF-193-3 ARM: dts: imx6ull: add rng
Add node for the RNGB block.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 09:58:09 +02:00
33412bf006 LF-193-2 ARM: dts: imx6sll: add rng
Add node for the RNGB block.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 09:58:07 +02:00
a1767c9019 LF-193-1 ARM: dts: imx6sl: fix rng node
rng DT node was added without a compatible string.

i.MX driver for RNGC (drivers/char/hw_random/imx-rngc.c) also claims
support for RNGB, and is currently used for i.MX25.

Let's used this driver also for RNGB block in i.MX6SL.

Fixes: e29fe21cff ("ARM: dts: add device tree source for imx6sl SoC")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 09:58:05 +02:00
c52d9b893d MLK-21599-2 arm64: defconfig: FORCE_MAX_ZONEORDER default 14 for imx
This patch change MAX_ZONEORDER default to 14 on i.MX8 platforms
due to GPU/DISPLAY large continuous physical memory requires it

This also aligned with previous imx releases on imx6/7/8

Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-29 15:05:56 +08:00
407df7f611 LF-210 arm64: defconfig: add imx fragment config
In imx fragment config file, it will disable all other ARCH
except Layerscape and S32 which can save the image size and
compiling time a lot.

Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-29 15:05:18 +08:00
03b112e3a4 LF-238 ARM64: defconfig: enable USB ACM
It is used for CDC ACM function.

Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-29 15:10:14 +08:00
70d28fd884 MLK-21599-1 arm64: Kconfig: Make FORCE_MAX_ZONEORDER configurable
Older imx releases increased this based on SOC_IMX8 but that symbol is
gone and the expectation is that SOC-selection symbols like "ARCH_MXC"
will almost always be defined and shouldn't be used to make incompatible
config decisions.

Make the value of FORCE_MAX_ZONEORDER configurable so this can be
adjusted in a .config file.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Li Yang <Leoyang.li@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-29 15:03:58 +08:00
e9e988a573 LF-45 ARM64: defconfig: build as module for synaptics dsx touch
Change the SYNAPTICS_DSX_I2C touch driver build as module.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 14:54:00 +08:00
f69fef59fc LF-255 ARM: dts: imx6ul-14x14-evk.dtsi: set CMA memory size to 96M bytes
imx6ul/ull/ulz 14x14 evk board memory size is 512M, current
board dts set CMA reserved memory size to 320M, which causes
system has no free memory for unmovable and reclaimable.

In fact, set CMA memory size to 96M is large enough for pxp and
epdc cases.

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-29 14:42:54 +08:00
e22cb576c5 LF-227 arm64: dts: imx8qxp: add i.MX8QXP MEK dom0 dts
Add i.MX8QXP MEK dom0 dts to work with XEN 4.13

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-29 14:58:50 +08:00
95f253fd17 arm64: dts: add the imx8mm revb board supports
Add the iMX8MM REV B boards supports.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-29 14:14:02 +08:00
d1fcbc345b LF-128 PCI: imx: turn off the clocks and regulators when link is down
To save power consumption, disable pcie clocks and regulators when
pcie link is down.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-29 13:34:36 +08:00
5aa37b5e7d LF-223-02 arm64: dts: freescale: Add cpuidle state node for im8mn
Add the cpuidle state node for imx8mn.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-29 10:34:31 +08:00
bb46a80aef LF-223-01 arm64: dts: freescale: Add system counter timer node on imx8mn
Add the system counter node on imx8mn.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-29 10:34:17 +08:00
0ef487ebee LF-209-2 arm64: defconfig: Select CONFIG_PM_TEST_SUSPEND by default
Select CONFIG_PM_TEST_SUSPEND by default to support PM test.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-11-29 09:34:18 +08:00
82c82c313e LF-209-1 arm64: defconfig: Deselect CONFIG_HIBERNATION by default
Deselect CONFIG_HIBERNATION as it is NOT supported on i.MX SoCs.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-11-29 09:34:17 +08:00
9c3a087b1d ASoC: SOF: Read tplg filename from board descriptor
We use the nocodec tplg_filename for now. Proper name
should be read from device tree file.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-29 00:51:41 +02:00
ee18bf513e arch: arm64: Remove ESAI related PD from original esai node
This nodes will be enabled inside FSL DAI node.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-29 00:35:28 +02:00
9ce84c863a ASoC: SOF: Update fw_filename from board description
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-29 00:32:36 +02:00
98885524c4 firmware: imx: Allow imx dsp to be selected as module
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-28 23:33:17 +02:00
95ab2f59ea ASoC: SOF: Allow probe to continue when we have an actual codec
For now the machine driver taking care of the codec is hard-coded.
In the future we will need to read the name from DT.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-28 23:24:35 +02:00
1b9618b96c ASoC: SOF: Hardcode ignore_machine
We need to find a way to pass the machine driver name to SOF core. So
far just hard code it.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-28 23:21:46 +02:00
925ad97abd ASoC: fsl: Add generic DAI driver
On i.MX8 platforms that have a DSP the DAI handling is taken care
of by two entities:
	* Application Processor (AP), which runs Linux
	* DSP, which runs a firmware (typically Sound Open Firmware)

The DSP has access to DAI IP registers, but it cannot easily handle
resources like:
	* clock
	* power domain management
	* pinctrl.

For this reason we introduce a generic FSL DAI driver which will take
care of the resources above.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-28 23:16:40 +02:00
78570725ce Revert "ASoC: fsl: Add generic DAI driver"
This reverts commit 9aca4d89de.
Reverting this because the patch suffered a lot of changes and
I don't want to do a first push. This should be squasehd
with 9aca4d89de.
2019-11-28 23:15:41 +02:00
9e55813ab5 arm64: dts: Remove nodes related to old audio framework
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-28 23:09:46 +02:00
b5400cd3c8 arm64: dts: Enable simple-audio-card for ESAI0 + cs42888
We use existing simple-audio-card machine driver to demonstrate
the usage of ESAI0 with cs42888 codec.

Mind that we use FSL DAI driver in order to manage ESAI related
resources (PD, clocks, pinctrl). This was previously done by
dsp platorm node.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-28 23:09:45 +02:00
fc3129c10b MLK-22824-4: ARM64: configs: defconfig: enable pca9450 by default
Add pca9450 support into defconfig.

Signed-off-by: John Lee <john.lee@nxp.com>
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
(cherry picked from commit 96a47b5299)
2019-11-29 04:25:30 +08:00
c46712e52a MLK-22824-2: regulator: pca9450: add pca9450 regulator driver
Add pca9450 regulator driver.

Signed-off-by: John Lee <john.lee@nxp.com>
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
(cherry picked from commit 90f61a4155)
2019-11-29 04:23:51 +08:00
919ef6d130 MLK-22824-1: mfd: pca9450: add pca9450 mfd driver
Add new pmic pca9450 driver for i.mx8mn-evk board.

Signed-off-by: John Lee <john.lee@nxp.com>
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
(cherry picked from commit 2189979539)
2019-11-29 04:23:43 +08:00
9dd66e5707 clk: imx: Add missing mipi1_dsi_phy_clk
Add missing definition for mipi1_dsi_phy_clk, needed for MIPI_1

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 18:01:48 +02:00
0785deb865 arm64: dts: imx8mq: Add lcdif clock in mipi dsi node
This clock is needed in order to be able to correctly use the MIPI
resets, since this clock is the only one connected to the MIPI Reset
Synchronizer block.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 18:01:08 +02:00
bedf57eae8 drm/bridge: nwl-dsi Correct the DSI init sequence
Use the correct sequence for DSI power-on, as detailed by vendor. In
order to do that, each resets should be handled individually.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 18:00:37 +02:00
7dc82fecec arm64: dts: imx8qxp: Add nodes for rm67191 mipi panel
Add dts file for rm67191 MIPI panel.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 17:22:32 +02:00
b38ae2b2e6 arm64: dts: imx8qxp: Add nodes for adv7535 device
Add dts nodes for adv7535 DSI-HDMI converter and connect them to their
corresponding mipi dsi nodes.
Use dsi-adv7535 as default use-case for imx8qxp-mek.dtb file.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 17:22:31 +02:00
48df7dc20c arm64: dts: imx8qxp: Add mipi dsi nodes
Add dts file for mipi dsi nodes and the corresponding endpoints.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 17:22:30 +02:00
60b1ead90c arm64: dts: imx8qm: Add nodes for rm67191 mipi panel
Add dts file for rm67191 MIPI panel.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 17:22:29 +02:00
5154e13e44 arm64: dts: imx8qm: Add nodes for adv7535 device
Add dts nodes for adv7535 DSI-HDMI converter and connect them to their
corresponding mipi dsi nodes.
Use dsi-adv7535 as default use-case for imx8qm-mek.dtb file.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 17:22:28 +02:00
f21cd56a98 arm64: dts: imx8qm: Add mipi dsi nodes
Add dts file for mipi dsi nodes and the corresponding endpoints.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 17:22:28 +02:00
c286e88c71 LF-53: regulator: pf1550-regulator-rpmsg: fix ldo2 voltage changing failure
Add n_voltages/min_uV in regulator description so that no failure return
while regulator_count_voltages() called, which cause vqmmc regulator
voltage switching to 1.8V failure on i.mx7ulp-evk. This issue is exposed
by commit 4982094451 ("regulator: core: simplify return value on
suported_voltage").

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reported-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-28 22:38:53 +08:00
edea653892 gpu: imx: framegen: Use crtc_clock instead of mode clock
Any CRTC driver should use the crtc_clock instead of clock value from
drm_display_mode structure, since the crtc_clock might differ from the
actual pixel clock needed by that mode.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 16:14:12 +02:00
c16eb12d0e drm/panel: rm67191: Add dev_err for reset gpio
Add dev_err info when the reset gpio fails, so that we have more
information in dmesg.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 16:12:42 +02:00
5eb7228543 drm/bridge: adv7511: Fix of_reconfig
Currently, if the actual i2c device chip (ADV75**) is not found, the
remote node is disabled completely. This causes undefined behavior, if
that device was probed and being used.
In order to fix this behavior, don't disable the remote device, just
detach the remote's endpoint, so that the remote device will just
abandon the connection.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 16:11:29 +02:00
1e530815c6 MLK-21958-13: drm/bridge: adv7511: Limit supported clocks
Some modes are not working with this converter. Until we find a real fix
to make any mode working, just limit the supported modes by their
clocks.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-28 16:11:28 +02:00
09b1112685 drm/bridge: nwl-dsi: Fix find_panel_or_bridge
Correct the usage of drm_of_find_panel_or_bridge. It's pair remove
function drm_of_panel_bridge_remove should be called from drm_bridge
detach instead of dsi_host detach.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 16:08:45 +02:00
1d973c9e62 drm/bridge: nwl-dsi: Add support for 8QM and 8QXP
Add compatible for i.MX8QM and i.MX8QXP and the related helper functions
needed to power on the MIPI IP on these platforms.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 16:08:44 +02:00
cc8665d55a drm/bridge: nwl-dsi: Add support for component framework
Add a new dts property 'use-disp-ss', based on this, nwl driver will act
like a component with bind and unbind callbacks.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 16:08:43 +02:00
a63c5c3514 phy: imx8-mipi-dphy: Add support for 8QM and 8QXP
Add compatibles for i.MX8QM and i.MX8QXP.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-28 16:08:42 +02:00
e0c5d25da9 LF-204 arm: dts: imx7d-sdb-epdc: disable hdmi sii902x
there's pin conflict between epdc and sii902x, seeing following boot message:
[    4.736169] imx7d-pinctrl 30330000.iomuxc: pin MX7D_PAD_EPDC_DATA13 already requested by 2-0039; cannot claim for 306f0000.epdc
[    4.748188] imx7d-pinctrl 30330000.iomuxc: pin-26 (306f0000.epdc) status -22
[    4.755346] imx7d-pinctrl 30330000.iomuxc: could not request pin 26 (MX7D_PAD_EPDC_DATA13) from group epdcgrp0  on device 30330000.iomuxc
[    4.767766] imx_epdc_v2_fb 306f0000.epdc: Error applying setting, reverse things back

disable hdmi(sii902x) to make epdc work

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-28 20:00:06 +08:00
e55691dd83 i2c: mux: pca954x: support property idle-state
This supports property idle-state,if present,
overrides i2c-mux-idle-disconnect.

My use cases:
	- Use the property idle-state to fix
	  an errata on LS2085ARDB and LS2088ARDB.
	- Errata id: E-00013(board LS2085ARDB and
	  LS2088ARDB revision on Rev.B, Rev.C and Rev.D).
	- About E-00013:
	  - Description: I2C1 and I2C3 buses
	    are missing pull-up.
	  - Impact: When the PCA954x device is tri-stated, the I2C bus
	    will float. This makes the I2C bus and its associated
	    downstream devices inaccessible.
	  - Hardware fix: Populate resistors R189 and R190 for I2C1
	    and resistors R228 and R229 for I2C3.
	  - Software fix: Remove the tri-state option from the PCA954x
	    driver(PCA954x always on enable status, specify a
	    channel zero in dts to fix the errata E-00013).

Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-28 18:43:20 +08:00
26f838d820 dt-bindings: i2c: support property idle-state
This supports property idle-state

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2019-11-28 18:43:20 +08:00
48e874653b LF-98 i2c: imx: fix the judgement of slave mode in isr
The I2CR[MSTA] will be modified by software or hardware even in master
mode. The judgment of slave mode by reading CR register is unreliable.
Change to use i2c_imx->slave registered status to judge i2c mode.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-28 18:43:20 +08:00
0af141327c i2c: imx: correct code of errata A-010650 for layerscape platform
- Simplify code with helper function i2c_imx_clr_al_bit
- Fix an error about clearing arbitration lost bit
- Fix an error that not set I2Cx_IBCR following by
  the workaround of A-010650 (in step 5)

Reviewed-by: Clark Wang <xiaoning.wang@nxp.com>
Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-28 18:43:20 +08:00
60c97c96b5 i2c: imx: support slave mode for imx I2C driver
The patch supports slave mode for imx I2C driver

Reviewed-by: Clark Wang <xiaoning.wang@nxp.com>
Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-28 18:43:20 +08:00
07085f4de6 LF-191-3 Documentation: bindings: i2c: add xen,i2c
Add xen,i2c bindings

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-28 16:28:01 +08:00
dda4dde724 LF-191-2 i2c: introduce xen i2c paravirtualization driver
Add i2c backend frontend support.
The transaction only support one msg each time.
The frontend sends a request to backend, backend use i2c_transfer
to do real transaction to hardware and return the results to frontend.

Now i2cdump/get/set works.
In domu cfg file, use
"vi2c = ['backend=0,be-adapter=5a800000.i2c,addr=0x51;0x44']" to
create a dummy controller in frontend and allowed slaves in backend.

Currently the slave address check not added, it will be supported in
furture patch.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-28 16:27:52 +08:00
1990cee78d LF-191-1 xen: interface: introduce i2cif
Introduce i2cif from xen. This will be used by paravirtualization
i2c driver.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-28 16:27:43 +08:00
192cbc5d86 LF-202-3 clk: imx: scu: ignore clks not owned
Not register clks that not owned to current partition.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-28 16:24:17 +08:00
4b6617643f drm/imx/hdp: fix issue with non-SCDC HDMI sinks
Currently, if sink does not support SCDC, even if the sink is HDMI 1.4 or 2.0,
the hdmi_type is left to default value (MODE_DVI). Hence the HDMI controler is
not properly initialized when cdns_hdmi_ctrl_init() is called.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reported-by: Jared Hu <jared.hu@nxp.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
2019-11-28 10:07:22 +02:00
090b431c46 LF-171 ARM: imx: Add cpu type check for imx6ulz in msl code
Add cpu type check for i.MX6ULZ in MSL code to support low
power feature.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-28 15:13:42 +08:00
3f81e5834f LF-220-2 ARM64: dts: imx8dxl-phantom-mek.dtsi: change pinctrl for vbus regulator
The vbus regulator should be put under its node, not but at
usb controller node.

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-28 15:03:08 +08:00
616331ab65 LF-220-1 ARM64: dts: imx8dxl-phantom-mek.dtsi: enable usbphy1
Enable USBPHY, otherwise, USB controller can't work properly.

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-28 15:03:08 +08:00
7a1edf892a LF-198 arm: dts: imx7ulp: add GPU clock rate setting
set GPU 2D/3D clock parent with IMX7ULP_CLK_APLL_PFD2,
set IMX7ULP_CLK_APLL_PFD2 clock rate with 400MHz.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-28 22:19:13 +08:00
ebceaf435c usb: dwc3: Add cache type configuration support
This feature is telling how to configure cache type on 4 different
transfer types: Data Read, Desc Read, Data Write and Desc write. For each
transfer type, controller has a 4-bit register field to enable different
cache type. Quoted from DWC3 data book Table 6-5 Cache Type Bit Assignments:
----------------------------------------------------------------
MBUS_TYPE| bit[3]       |bit[2]       |bit[1]     |bit[0]
----------------------------------------------------------------
AHB      |Cacheable     |Bufferable   |Privilegge |Data
AXI3     |Write Allocate|Read Allocate|Cacheable  |Bufferable
AXI4     |Allocate Other|Allocate     |Modifiable |Bufferable
AXI4     |Other Allocate|Allocate     |Modifiable |Bufferable
Native   |Same as AXI   |Same as AXI  |Same as AXI|Same as AXI
----------------------------------------------------------------
Note: The AHB, AXI3, AXI4, and PCIe busses use different names for certain
signals, which have the same meaning:
  Bufferable = Posted
  Cacheable = Modifiable = Snoop (negation of No Snoop)

In most cases, driver support is not required unless the default values of
registers are not correct *and* DWC3 node has enabled dma-coherent. So far we
have observed USB device detect failure on some Layerscape platforms if this
programming was not applied.

Related struct:
struct dwc3_cache_type {
	u8 transfer_type_datard;
	u8 transfer_type_descrd;
	u8 transfer_type_datawr;
	u8 transfer_type_descwr;
};

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
2019-11-28 14:40:59 +08:00
b1b26e7ed4 usb: dwc3: Add chip-specific compatible string
Some Layerscape paltforms (such as LS1088A, LS2088A, etc) require update HW
default cache type configuration to fix DWC3 init failure when applying
property dma-coherent.

Note that the cache type configuration is actually native feature of DWC3,
not additional desgin coming from SoC, so add this support here.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
2019-11-28 14:40:53 +08:00
9ae7fab35e MLK-22675 usb: dwc3: host: disable park mode
- Advantage of park mode
  When only a single Async endpoint is active.

- Behavior of park mode
  1. The controller prefetches data/TRBs to do 3 * burst_size worth
     of packets.
  2. When park mode is disabled there will be some delay between
     bursts on the USB. This can be avoided if park mode is enabled
     in cases of only one endpoint is active.
  3. But this delay is significant only with systems of large
     latencies.
  4. We have noticed that in cases where a device NAKs often, it
     tends to bring down the performance for a single endpoint case.

- Issue on "park mode"
  1. LSP (List Processor) goes in and out of park mode irrespective
     of the fact that there are more endpoints active. #LSP consider
     that there is only one endpoint active.
  2. This causes master scheduler and transaction handlers to think
     that they are in park mode even though they are not. This is
     because request to transaction handlers, generated by HSCH is
     in park mode when the request is made
  3. This causes a case where the master scheduler calculates wrongly
     the number of TRB cache space available.
  4. Because of the wrongly calculated number of TRB spaces, the core
     fetches more TRBS than there is space for.
  5. This causes overwriting the TRB cache area into the TRQ cache
     area which is next to the TRB cache area.
  6. This causes invalidating an entry in the TRQ
  7. This causes transaction handlers to ignore a request in the TRQ
     which it should have processed.
  8. This causes the main scheduler to hang because it is waiting for
     status from transaction handler.
  9. This causes host controller to hang.

- Work Around
  Disabling park mode for super speed by setting GUCTL1[17] to be 1.

The STAR number is 9001415732, which is target to be released around
May,2020.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Reviewed-by: Ran Wang <ran.wang_1@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-28 14:39:45 +08:00
25a450f2a2 Merge pull request #32 in LFAC/linux-nxp from ~NXF40818/linux-nxp:display/hdp to display/hdp
* commit 'dc96a61c1b57f2e1e53ab75934b83160871132e6':
  drm: imx: mhdp: Adjustment core rate of DP TX CTRL for LS1028A
2019-11-28 07:20:35 +01:00
269cf6f39b perf vendor events: add JSON metrics for imx8 DDR Perf
Add JSON metrics for i.MX8 DDR perf.

Below command used for metric:
--------------------------------------------------------------
root@imx8qmmek:~# perf list metricgroup

List of pre-defined events (to be used in -e):

Metric Groups:

i.MX8MM_DDR_MON
i.MX8MP_DDR_MON
i.MX8QM_DDR_MON
--------------------------------------------------------------
root@imx8qmmek:~# perf list metric

List of pre-defined events (to be used in -e):

Metrics:

  imx8mm-ddr0-2d-r
       [imx8mm: bursts of gpu 2d read from ddr0]
  imx8mm-ddr0-2d-w
       [imx8mm: bursts of gpu 2d write to ddr0]
  imx8mm-ddr0-3d-r
       [imx8mm: bursts of gpu 3d read from ddr0]
  imx8mm-ddr0-3d-w
       [imx8mm: bursts of gpu 3d write to ddr0]
  imx8mm-ddr0-a53-r
       [imx8mm: bursts of a53 core read from ddr0]
  imx8mm-ddr0-a53-w
       [imx8mm: bursts of a53 core write to ddr0]
  imx8mm-ddr0-all-r
       [imx8mm: bytes of all masters read from ddr0]
  imx8mm-ddr0-all-w
       [imx8mm: bytes of all masters write to ddr0]
------------------------------------------------------------
root@imx8qmmek:~# perf stat -a -M imx8mm-ddr0-2d-r sleep 1

  Performance counter stats for 'system wide':

                 0      imx8_ddr0/axid-read,axi_mask=0x0001,axi_id=0x0004/ #      0.0 imx8mm-ddr0-2d-r

       1.012773375 seconds time elapsed

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-28 12:11:37 +08:00
b8552bd2ea tools: perf: metricgroup: add metricgroup for each PMU
If we want to add/print metricgroup, we need get pmu evets map via CPUID
string, so it is important to get CPUID string. Now in metricgroup, it
passes NULL to perf_pmu__find_map(), will never get the pmu events map on
ARM64 platforms, due to get_cpuid_str() implement for ARM64 depending on the
cpu info of PMU. The CPUID string will not be same on all CPUs on heterogeneous
platforms, adding provision(using pmu->cpus) to find cpuid string from
associated CPUs of PMU.

The implement of get_cpuid_str() for ARM64 has taken heterogeneous platforms
into consideration, but metricgroup has not. So it is necessory to add
heterogeneous support for metricgroup. When we want to add/print metricgroup,
need iterator each PMU then pass the perf_pmu struct to perf_pmu__find_map().

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-28 12:11:37 +08:00
37231434b2 perf/imx_ddr: Dump AXI ID filter info to userspace
caps/filter indicates whether HW supports AXI ID filter or not.
caps/enhanced_filter indicates whether HW supports enhanced AXI ID filter
or not.

Users can check filter features from userspace with these attributions.

Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
[will: reworked cap switch to be less error-prone]
Signed-off-by: Will Deacon <will@kernel.org>
2019-11-28 12:08:35 +08:00
b1a16a5b38 perf/imx_ddr: Add driver for DDR PMU in i.MX8MPlus
Add driver for DDR PMU in i.MX8MPlus.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Will Deacon <will@kernel.org>
2019-11-28 12:08:35 +08:00
c1e0ea519f perf/imx_ddr: Add enhanced AXI ID filter support
With DDR_CAP_AXI_ID_FILTER quirk, indicating HW supports AXI ID filter
which only can get bursts from DDR transaction, i.e. DDR read/write
requests.

This patch add DDR_CAP_AXI_ID_ENHANCED_FILTER quirk, indicating HW
supports AXI ID filter which can get bursts and bytes from DDR
transaction at the same time. We hope PMU always return bytes in the
driver due to it is more meaningful for users.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Will Deacon <will@kernel.org>
2019-11-28 12:08:35 +08:00
b5905c484f bindings: perf: imx-ddr: Add new compatible string
Add new compatible string for i.MX8MPlus DDR PMU core.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Will Deacon <will@kernel.org>
2019-11-28 12:08:34 +08:00
3d2d4538b9 docs: perf: Add imx-ddr to documentation index
Sphinx is currently outputting a warning where
the file 'imx-ddr.rst' is not included in the
documentation index. Additionally, the code
highlighting and doc formatting can be slightly
improved.

Signed-off-by: Adam Zerella <adam.zerella@gmail.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2019-11-28 12:08:34 +08:00
9869cf739e docs/perf: Add AXI ID filter capabilities information
Add capabilities information for AXI ID filter.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Will Deacon <will@kernel.org>
2019-11-28 12:08:34 +08:00
d094d32b0e docs/perf: Add explanation for DDR_CAP_AXI_ID_FILTER_ENHANCED quirk
Add explanation for DDR_CAP_AXI_ID_FILTER_ENHANCED quirk.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
[will: Simplified wording]
Signed-off-by: Will Deacon <will@kernel.org>
2019-11-28 12:08:34 +08:00
f571934477 LF-202-5 arm64: dts: imx8qm: add basic dom0/domu dts
Add basic dom0/domu dts for xen on i.MX8QM MEK.
Dual display works and emmc passthrough to DomU.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-28 10:26:20 +08:00
b32c7c3b6a LF-202-4 firmware: imx: scu-pd: ignore power domain not owned
Should not register power domain that not owned by current
partition.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-28 10:25:13 +08:00
5a5785a7c4 LF-202-2 firmware: imx: add resource management api
Add resource management API, when we have multiple
partition running together, resources not owned to current
partition should not be used.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-28 10:17:47 +08:00
240ff35098 LF-202-1 firmware: imx: scu: use hvc for dom0
We use hvc to let xen handle the scfw api call for dom0.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-28 10:17:36 +08:00
b99656aef5 LF-58: sata: imx8: fix the calibration failure of phy
The calibration of the SATA PHYX1 is derived from the PHYX2.
Add the release of the PHYX2 APB reset, and turn on the HW gated
pipe_pclks of PHYX2 to make sure that the calibration of SATA PHYX1
can be finished successfully.
Adjust the APB reset of SATA, it should be released firstly.
The EPCS configrations should be placed before the EPCS reset.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-28 09:38:53 +08:00
a3f97ef8b2 arm64: dts: ls1028a: Add DP DT nodes
Add DP DT nodes for configure and enable the HD Display
controller on LS1028ARDB and LS1028AQDS boards.

Signed-off-by: Wen He <wen.he_1@nxp.com>
2019-11-27 14:29:48 -06:00
3177db0e93 arm64: dts: ls1028a: Add properties for HD Display controller node
The HD Display controller includes DP TX CTRL and DPHY, their offers
multi-protocol support of standards such as DisplayPort and eDP, with
one of these standards supported at a time.

This patch enables the HD Display controller driver on the LS1028A.

Signed-off-by: Wen He <wen.he_1@nxp.com>
2019-11-27 14:29:48 -06:00
4800eb36fc arm64: dts: ls1028a: Update #clock-cells of dpclk node
Update the property #clock-cells = <1> to #clock-cells = <0> of the
dpclk, since the Display output pixel clock driver provides single
clock output.

Signed-off-by: Wen He <wen.he_1@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-11-27 14:29:48 -06:00
d5c7e09d2b arm64: dts: ls1028a: Update the clock providers for the Mali DP500
In order to maximise performance of the LCD Controller's 64-bit AXI
bus, for any give speed bin of the device, the AXI master interface
clock(ACLK) clock can be up to CPU_frequency/2, which is already
capable of optimal performance. In general, ACLK is always expected
to be equal to CPU_frequency/2. APB slave interface clock(PCLK) and
Main processing clock(PCLK) both are tied to the same clock as ACLK.

This change followed the LS1028A Architecture Specification Manual.

Signed-off-by: Wen He <wen.he_1@nxp.com>
Acked-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-11-27 14:29:48 -06:00
dc342625c1 arm64: dts: ls1028a: fix dwc pci over smmu
In order for the dwc controller to work with SMMU it needs the
bootloader to fixup it's iommu-map property. In the current
implementation to bootloader will not perform the fixup if the
property is not already in the device tree with dummy fields.
Add it to fix DWC PCI over SMMU.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-27 14:29:48 -06:00
93560605cc arm: dts: ls1021a: fix that FlexTimer cannot wakeup system in deep sleep
The patch fixes a bug that FlexTimer cannot
wakeup system in deep sleep.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-27 14:29:48 -06:00
284718e621 usb: dwc3: enable otg mode for dwc3 usb ip on layerscape
layerscape otg function should be supported HNP SRP and ADP protocol
accroing to rm doc, but dwc3 code not realize it and use id pin to
detect who is host or device(0 is host 1 is device) this patch is to
enable OTG mode on ls1028ardb ls1088ardb and ls1046ardb in dts

Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
2019-11-27 14:29:48 -06:00
841edb9867 arm64: dts: LS1028a-rdb: use Ethernet PHY interrupt
Use the PHY interrupt wired to GPIO pins as part of MDIO WA performance
impact mitigation.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
2019-11-27 14:29:48 -06:00
7545a26aa5 arm64: dts: ls1028a: define networking options for QDS
Defines connectivity for a few serdes protocol combinations (85xx, 65xx,
13xx, 9999, 7777).

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
2019-11-27 14:29:48 -06:00
afbdcece47 arm64: ls1028a-qds: correct bus of rtc
The rtc is on i2c2 bus(hardware), not on i2c1 channel 3,
so correct it

Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-27 14:29:48 -06:00
82c49e9aad arm64: dts: lx2160a: add tmu device node
Add the TMU (Thermal Monitoring Unit) device node to enable
TMU feature.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
2019-11-27 14:29:48 -06:00
ceebeb986a ASoC: soc-core: Set dpcm_playback / dpcm_capture
When converting a normal link to a DPCM link we need
to set dpcm_playback / dpcm_capture otherwise playback/capture
streams will not be created resulting in aplay/arecord not working.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 22:01:55 +02:00
9aca4d89de ASoC: fsl: Add generic DAI driver
On i.MX8 platforms that have a DSP the DAI handling is taken care
of by two entities:
	* Application Processor (AP), which runs Linux
	* DSP, which runs a firmware (typically Sound Open Firmware)

The DSP has access to DAI IP registers, but it cannot easily handle
resources like:
	* clock
	* power domain management
	* pinctrl.

For this reason we introduce a generic FSL DAI driver which will take
care of the resources above.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 21:56:10 +02:00
37ade25a58 ASoC: SOF: nocodec: Amend arguments for sof_nocodec_setup()
Set the drv_name and tplg_filename for nocodec
machine driver in sof_machine_check().
This means the sof_nocodec_setup() does not
need the mach, plat_data or desc arguments any longer.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 21:50:22 +02:00
19fa41a7ab ASoC: Make creation of machine device from SOF core optional
Currently, SOF probes machine drivers by creating a platform device
and passing the machine description as private data.

This is driven by the ACPI restrictions. Ideally, ACPI tables
should contain the description for the machine driver. This is
not possible because ACPI tables are frozen and used on multiple
OS-es (e.g Windows).

In the case, of Device Tree we don't have this restrictions, so we
choose to probe the machine drivers by creating a DT node as is
the standard ALSA way.

This patch makes the probing of machine drivers from SOF core optional
allowing for arm platforms to decouple the SOF core from machine
driver probing.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 21:49:11 +02:00
3d9382581a ASoC: SOF: Remove unused drv_name in sof_pdata
This field is only set but never used. Let's remove
it to make code cleaner.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2019-11-27 21:48:18 +02:00
0d4340c272 ASoC: SOF: core: move check for runtime callbacks to core
For some platforms, the refcount is explicitly incremented
to prevent it from entering runtime suspend. This
should be be done during probe in the core instead
of being done in the PCM driver.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2019-11-27 21:31:48 +02:00
9758ebd19b MLKU-25-4 arm64: dts: imx8m: add secure memory
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-27 18:30:18 +02:00
c0716a68e5 MLKU-38-5 arm64: dts: imx8m: add caam snvs and secvio
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-27 18:30:19 +02:00
5fcf215fc4 MLKU-38-4 dt-bindings: crypto: fsl: add caam snvs and secvio
This is a rework of the following i.MX BSP commit
(rel_imx_4.19.35_1.1.0_rc2):
9b63038a58cc ("MLK-21453: crypto: caam - fix Mentor's port, merge conflict resolutions")

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-27 18:29:46 +02:00
86edc0c207 MLKU-38-2-fix ARM: dts: imx6: remove unused secvio_src property
secvio_src property of caam_secvio node is a left-over from i.MX BSP,
remove it since it's no longer used.

Fixes: 2bc9a11149 ("MLKU-38-2 ARM: dts: imx: add caam snvs and secvio")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-27 18:29:41 +02:00
1e3817aa33 LF-63-3 arm64: defconfig: set CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST=m
This effectively:
-reverts commit 0c857beb7d ("hotfix: arm64: defconfig: disable CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST")
since the SM test issue has been fixed and
-changes SM test Kconfig symbol from y to m
(since SM test driver was changed to build only as a module)

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-27 18:29:13 +02:00
12dfefd889 LF-63-2 ARM: imx_v6_v7_defconfig: build SM test as module
SM test driver was changed to build only as a module.
Update defconfig accordingly.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-27 18:28:47 +02:00
ed4e044776 ASoC: SOF: core: modify the signature for snd_sof_create_page_table
Modify the signature for snd_sof_create_page_table to
take struct device pointer as an argument instead of
struct snd_sof_dev as this will be used by both the SOF
core device and its clients. Also, move the definition
out of core.c to utils.c.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2019-11-27 17:12:16 +02:00
9e39858592 ASoC: SOF: Introduce default_fw_filename member in sof_dev_desc
Currently the FW filename is obtained from the ACPI matching
table when determining which machine driver to use. In
preparation for making the machine driver ACPI match optional
for Device Tree platforms and moving the machine driver selection
out of the SOF core, this patch introduces the default_fw_filename
member in struct sof_dev_desc.

Once the machine driver selection is moved out of SOF core,
the nocodec_fw_filename will become obsolete and will be removed.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 17:11:42 +02:00
0e821afb94 ASoC: SOF: Intel: Fix CFL and CML FW nocodec binary names.
The manifest information is different between CNL, CML and CFL platforms
hence we need to load different files.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2019-11-27 17:11:24 +02:00
67c1304cd5 ASoC: SOF: topology: remove snd_sof_init_topology()
Remove snd_sof_init_topology() as it is never used.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2019-11-27 17:10:06 +02:00
62a6c4c769 ASoC: SOF: topology: Fix unload for SAI/ESAI
Link unload now fails for ESAI/SAI DAIs with:

"error: invalid DAI type 6" because DAI type is not
properly handled.

Fix this by correctly handling cases where type is ESAI or SAI.

Fixes: a4eff5f86c ("ASoC: SOF: imx: Read ESAI parameters and send them to DSP")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 17:09:46 +02:00
48744b1600 ASoC: SOF: imx: Read SAI parameters and send them to DSP
Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-11-27 17:08:23 +02:00
33a9c59680 ASoC: SOF: imx: Describe SAI parameters to be sent to DSP
Introduce sof_ipc_dai_sai_params to keep information that
we get from topology and we send to DSP FW.
For the moment it is identical to ESAI one but it will
evolve shortly independently

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2019-11-27 17:08:23 +02:00
592b8ba3b6 ASoC: SOF: imx: Read ESAI parameters and send them to DSP
ESAI parameters are read for topology file, packed into
sof_ipc_dai_esai_parms struct and then sent to DSP.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 17:08:23 +02:00
1314d31f0e ASoC: SOF: imx: Describe ESAI parameters to be sent to DSP
Introduce sof_ipc_dai_esai_params to keep information that
we get from topology and we send to DSP FW.

Also bump the ABI minor to reflect the changes on DSP FW.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 17:08:23 +02:00
4bdce73802 LF-46 drm/imx: sec-dsim: use late suspend
Due to possible defer probe, the system suspend
sequences between display-subsystem and dsim can
not be fixed. But the working sequence should be
display-subsystem first and then dsim. Use late
suspend operation for dsim can make this fixed.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-27 20:12:49 +08:00
91cbc7cc11 LF-141: ARM: imx_v6_v7_defconfig: enable CONFIG_PREEMPT
Enable CONFIG_PREEMPT instead of CONFIG_PREEMPT_VOLUNTARY, the former
is much suitable for embed system as i.mx. Besides, that aligns with
internal legacy imx_v7_defconfig.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-27 20:00:31 +08:00
dc96a61c1b drm: imx: mhdp: Adjustment core rate of DP TX CTRL for LS1028A
This Display TX CTRL clock should be ACLK/4, update it to align with
the specification.

Signed-off-by: Wen He <wen.he_1@nxp.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
2019-11-27 18:29:02 +08:00
988d0a7af7 clk: ls1028a: Add clock driver for Display output interface
Add clock driver for QorIQ LS1028A Display output interfaces(LCD, DPHY),
as implemented in TSMC CLN28HPM PLL, this PLL supports the programmable
integer division and range of the display output pixel clock's 27-594MHz.

Signed-off-by: Wen He <wen.he_1@nxp.com>
Signed-off-by: Michael Walle <michael@walle.cc>
2019-11-27 17:53:48 +08:00
cfa43c88ca dt/bindings: clk: Add YAML schemas for LS1028A Display Clock bindings
LS1028A has a clock domain PXLCLK0 used for provide pixel clocks to Display
output interface. Add a YAML schema for this.

Signed-off-by: Wen He <wen.he_1@nxp.com>
Signed-off-by: Michael Walle <michael@walle.cc>
2019-11-27 17:53:42 +08:00
9bfb9485e2 LF-176 ARM: imx: mach-imx6q: Revert "ARM: imx: correct the enet_clk_ref clock string"
enet_clk_ref is the same clock as ptp for i.MX6qdl platform,
but dtsi only define ptp clock that source from soc internal
anatop clock, and imx6q clock driver already register "enet_ref"
clock lookup for the ptp clock, so keep the con_id string as
"enet_ref" for clk_get_sys().

This reverts commit a3990871b9.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-27 16:58:32 +08:00
9c6e153782 LF-148 arm: dts: imx7ulp: set the sdhc clock sourced from apll_pfd1
imx7ulp need to support emmc hs400 mode, this mode need the sdhc clock
set near 400MHz, so that hs400 mode can work at near 200MHz, to get
the best performance. And also due to the I/O limitation, HS400 can only
work stable when the card clock rate is less than 176.4MHz. So this patch
change the sdhc clock sourced from apll_pfd1, and config the apll_pfd1
at 352.8MHz.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-27 15:53:30 +08:00
5038699a88 LF-115: media: i2c: ov5640: fix enumerate capture mode issue
Driver will enumerate all res@fps to user, but for ov5640,
when it work in DVP mode, 1080P only can reach 15fps. For
2592x1944, no matter which mode it works, it only support
about 8fps. So driver need to clarify these info and report
the real capability to user.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-27 15:09:30 +08:00
22755e3733 media: i2c: ov5640: add mode and fps checking for ov5640
Accroding to ov5640 datasheet, 2592x1944 only support 7.5fps.
But actually, it can reach about 8. For 1080P@30fps in DVP
mode, it can reach 1080P@15fsp, so adding valid mode and fps
checking before streaming.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-27 14:50:45 +08:00
f503843f85 PCI: imx: add the imx pcie ep verification solution
Enable the PCIE EP RC for iMX

  - hw setup:
    * two imx boards, one is used as pcie rc, the other is used
    as pcie ep.
    RC TX N/P <--> EP RX N/P
       RX N/P <--> EP TX N/P

  - sw setup:
    * when build rc image, make sure that
      CONFIG_PCI_IMX6=y
      CONFIG_RC_MODE_IN_EP_RC_SYS=y
    * when build ep image
      CONFIG_PCI_IMX6=y
      CONFIG_EP_MODE_IN_EP_RC_SYS=y

  - features:
    * set-up link between rc and ep by their stand-alone
    ref clk running internally.

    * in ep's system, ep can access the reserved ddr memory
    (default address:0x4000_0000 on imx6q sd board, and
    0xb000_0000 on imx6sx sdb and imx7d arm2 boards) of
    pcie rc's system, by the interconnection between pcie
    ep and pcie rc.

    * provide one example, howto configure the bar# of ep and so on,
    when pcie ep emaluates one memory ram ep device

    * setup one new outbound memory region at rc side, let imx pcie rc
    can access the memory of imx pcie ep in imx pcie rc ep validation
    system.

  - NOTE:
    * boot up ep platform firstly, then boot up rc platform.
    * For imx6q/6dl/6sx/7d sabresd boards, make sure that mem=768M is
    contained in the kernel command line,
    since the start address of the upper 256mb of the 1g ddr mem is
    reserved to do the pcie ep rc access operations in default.

  - RC access memory of EP:
    - EP:
      write the <ddr_region_address> to the bar0 of ep.
      echo <ddr_region_address> > /sys/devices/.../pcie/ep_bar0_addr
    - RC:
      access the <pcie_mem_base_addr>, and this address
      would be mapped to the <ddr_region_address> of ep.
    - Note:
            ddr_region_address    pcie_mem_base_addr  bar0_addr
    imx6qdl 0x4000_0000           0x0100_0000         0x01ff_c010
    imx6sx  0xb000_0000           0x0800_0000         0x08ff_c010
    imx7d   0xb000_0000           0x4000_0000         0x3380_0010
    imx8mq  0xb820_0000           0x2000_0000         0x33c0_0010
    imx8mm  0xb820_0000           0x1800_0000         0x3380_0010
    imx8qm  0x9020_0000           0x6000_0000         0x5f00_0010
    imx8qxp 0x9020_0000           0x7000_0000         0x5f01_0010

    - The example of the RC access memory of EP
    step1:
    EP side:
    echo 0x90200000 > /sys/devices/platform/bus@5f000000/5f000000.pcie
    /ep_bar0_addr

    root@imx8_all:~# ./memtool 90200000 4
    Reading 0x4 count starting at address 0x90200000

    0x90200000:  00000000 00000000 00000000 00000000

    RC side:
    ./memtool 60000000=55aa55aa
    Writing 32-bit value 0x55AA55AA to address 0x60000000

    EP side:
    root@imx8_all:~# ./memtool 90200000 4
    Reading 0x4 count starting at address 0x90200000

    0x90200000:  55AA55AA 00000000 00000000 00000000

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-27 11:16:57 +08:00
4b8d4a6c10 arm64: dts: enable the imx pcie ep verification solution
Enable the imx pcie ep verification solution.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-27 11:13:24 +08:00
90d1a825e8 dt-bindings: imx6q-pcie: add some optional property entries
Add some optional property entries.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-27 11:13:18 +08:00
6613a67cd8 MLK-22878 usb: cdns3: gadget: add imx8qxp C0 support
We use controller version to differetiate between B0 (0x00024502)
and C0 (0x0002450C). The controller uses TDL check to
avoid "NO NAK" issue at B0 if there is not buffer for OUT, this issue
is described at "Work around 2" at the begin of gadget.c

At default, the TDL value is 0, so it always NAK host's OUT token.
When the TD is added, the TDL value is non-zero, it will respond
NAK/ACK according to OUT FIFO's situation.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-27 10:03:20 +08:00
1a05978da9 LF-68-1: input: keyboard: snvs_pwrkey: add clk management
On i.mx8mm, kernel may hang if imx_imx_snvs_check_for_events() scheduled
after snvs clock turned off by rtc-snvs driver while ONOFF key kept on
pressing during kernel suspend, because imx_imx_snvs_check_for_events()
will touch snvs rigister. Add clock management in snvs_pwrkey driver
to fix it. Please note this clock is optional since snvs clock kept always
on(or even no snvs root clock in clock tree)on some chips such as i.mx6sx/
i.mx6ul.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-26 23:43:23 +08:00
7fbde092c2 arm64: dts: imx8mq: add adv7535 related DTS files
This patch adds:
 * an ADV7535 entry in imx8mq-evk.dts;
 * DTS for DCSS + MIPI_DSI + ADV7535;
 * DTS for LCDIF + MIPI_DSI + ADV7535;

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-26 13:58:18 +02:00
aae28655f6 drm/bridge/nwl-dsi: fix attach flow of downstream bridge
Currently a downstream bridge is attached only if dsi->panel_bridge is valid.
However, dsi->panel_bridge becomes valid after the DSI host is attached. For
ADV7535, for example, the DSI host is attached from the drm_bridge_attach()
routine, which is never called.

This patch moves the downstream panel_bridge probing part from
nwl_dsi_host_attach() to nwl_dsi_bridge_attach().

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-26 13:57:12 +02:00
a987cb8567 drm/imx/dcss: Release DTRC IRQs in case of failure
In case the DTRC init function fails, or the exit routine is called, the IRQs
should be properly released.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-26 13:54:17 +02:00
9e93d71a3e vfio/fsl-mc: Map the VFIO region according to the flags received from mc firmware
There are some VFIO regions which are cacheable (QMAN CENA region).
These regions should be mapped cacheable.

Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-26 11:42:23 +02:00
6f5a90ce35 vfio/fsl-mc: Add read/write support for fsl-mc devices
This patch adds support to read and write ioctls for
fsl-mc devices. Only read-write to DPRC/DPMCP devices
are supported while read writes on other fsl-mc devices
is not supported by this patch.

Also current patch limits userspace to write complete
64byte command once and read 64byte response by one ioctl.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-26 11:42:17 +02:00
d59f6fd5f4 vfio/fsl-mc: trigger an interrupt via eventfd
This patch allows to set an eventfd for fsl-mc device interrupt
and also to trigger the interrupt eventfd from userspace for testing.

All fsl-mc device interrupts are MSI type. This does not yet handle
correctly DPRC container interrupt where re-scanning on container is
required.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-26 11:42:12 +02:00
111dc0dd7f vfio/fsl-mc: Add irq infrastructure for fsl-mc devices
This patch adds the skeleton for interrupt support
for fsl-mc devices. The interrupts are not yet functional,
the functionality will be added by subsequent patches.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-26 11:42:06 +02:00
7cc830478f vfio/fsl-mc: Added lock support in preparation for interrupt handling
All the devices in a DPRC share the same pool of interrupts.
Because of this the access to the pool of interrupts must be
protected with a lock. Extend the current lock implementation
to have a lock per DPRC.

Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-26 11:42:02 +02:00
b767af83fb vfio/fsl-mc: Allow userspace to MMAP fsl-mc device MMIO regions
Allow userspace to mmap device regions for direct access of
fsl-mc devices.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-26 11:41:56 +02:00
7841247983 vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call
Expose to userspace information about the memory regions.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-26 11:41:52 +02:00
dc9b92a6f7 vfio/fsl-mc: Implement VFIO_DEVICE_GET_INFO ioctl
Allow userspace to get fsl-mc device info (number of regions
and irqs).

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-26 11:41:48 +02:00
5e22d08986 vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind
The DPRC(Data Path Resource Container) device is a bus device and has
child devices attached to it. When the vfio-fsl-mc driver is probed
the DPRC is scanned and the child devices discovered and initialized.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-26 11:41:43 +02:00
34e571fdd2 vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices
This patch adds the infrastructure for VFIO support for fsl-mc
devices. Subsequent patches will add support for binding and secure
assigning these devices using VFIO.

FSL-MC is a new bus (driver/bus/fsl-mc/) which is different
from PCI and Platform bus.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-26 11:41:04 +02:00
9fafb55506 LF-125 irqchip: irq-imx-gpcv2: Fix build error of nosmp
Fix below build error when CONFIG_SMP is NOT selected:

drivers/irqchip/irq-imx-gpcv2.c: In function "imx_gpcv2_wake_request_fixup":
drivers/irqchip/irq-imx-gpcv2.c:123:2: error: implicit declaration of function
"set_smp_cross_call" [-Werror=implicit-function-declaration]
  123 |  set_smp_cross_call(imx_gpcv2_raise_softirq);
      |  ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [drivers/irqchip/irq-imx-gpcv2.o] Error 1

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
2019-11-26 17:18:45 +08:00
daa3cebcd9 LF-152: ARM64: dts: imx8mq: fix OF graph in imx8mq-evk-dcss-rm67191.dts
imx8mq-evk.dts defines a graph connection for hdmi, but
then imx8mq-evk-dcss-rm67191.dts overrides that with a graph
connection for the mipi dsi as the same output signals are used.
This leaves an incomplete graph as the hdmi output has only half a
connection. Though hdmi is disabled in imx8mq-evk-dcss-rm67191.dts
Still have the following warning:

arch/arm64/boot/dts/freescale/imx8mq-evk.dts:1092.21-1094.5:
Warning (graph_endpoint): /soc@0/bus@32c00000/hdmi@32c00000/port@0/endpoint:
graph connection to node '/soc@0/bus@32c00000/
display-controller@32e00000/port@0/endpoint' is not bidirectional

Fix this by delete hdmi node in imx8mq-evk-dcss-rm67191.dts.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-26 16:39:33 +08:00
b73ce2bebd LF-146: ARM64: dts: freescale: imx8qm-mek-dsp: add power-domain-names
Add power-domain-names for edma2 device node, otherwise, power-domains
in imx8qm-mek-dsp.dts will not match with the default power-domain-names
in imx8qm-ss-audio.
commit 479432deec17 ("LF-121: arm64: dts: imx8qm-mek-dsp: Fix the typo")
is not enough.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-26 23:42:09 +08:00
26d588d441 LF-68-3: ARM64: dts: freescale: imx8mm/mq: add clock property for snvs-pwrkey
Add clock property for snvs-pwrkey.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-26 23:41:48 +08:00
13cdb939df LF-68-2: ARM: dts: imx7s: add clock property for snvs-pwrkey
Add clock property for snvs-pwrkey.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-26 23:41:41 +08:00
32b92522ec MA-15789-1 usb: cdns3: gadget: move USB interrupt handling to thread irq
Since the endpoint interrupt handling is at thread irq, to align with
it, move USB interrupt handling to thread irq, otherwise, it may has
lock recursion issue.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-26 09:07:11 +08:00
f75f2fdb82 LF-136-2 ARM64: dts: imx8qm.dtsi: add USB wakeup support
Add USB2 and USB3 wakeup support

Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-26 09:05:47 +08:00
a5679789b9 LF-136-1 ARM64: dts: imx8qxp.dtsi: add USB wakeup support
Add both USB2 and USB3 wakeup support

Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-26 09:05:16 +08:00
8e738f464e LF-113 ARM64: dts: imx8qxpmek: fix sensor interrupt pin settings
Mpl3115 shares one interrupt pin with fxos8700/fxas2100/isl29023. Need
to set its interrupt pin as "interrupt-open-drain". Otherwise, one of
them interrupt cannot pull down this pin to 0V.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 18:10:36 +08:00
d2615a1773 LF-99 hwmon: mag3110: correct processing order after probe error
Disable regulator first after an error occurs when probe. Remove the
directly return code when probe error occurs.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 18:09:36 +08:00
347a845787 MLK-22296-4 misc: mpl3115: Fix build warning when CONFIG_PM_SLEEP=n
Fix build warning when CONFIG_PM_SLEEP=n, the warning message is:
drivers/input/misc/mpl3115.c:290:12: warning: ‘mpl3115_start_chip’ defined but not used [-Wunused-function]
 static int mpl3115_start_chip(struct i2c_client *client)
            ^~~~~~~~~~~~~~~~~~

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit fd826f4b26257fe04272e0d91b53a8e448812bf3)
2019-11-25 18:09:36 +08:00
6f823288ab MLK-17061-1 sensor: set sensor interrupt pins as open-drain
The sensors share an interrupt pin on imx8qm/imx8qxp mek.
As a result, the interrupt signals will be interfered by
each other in default push-pull status.

This patch sets sensor interrupt pins as open-drain when
necessary.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
(cherry-picked from 48bcb7aafa2a3ced923d1a1753bb19d89a9fc273)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 8406dfab0fdbd5d135a614c38492b2e949ce0ede)
2019-11-25 18:09:35 +08:00
52791b37ca drivers: soc: fsl: add qixis driver
FPGA on LX2160AQDS/LX2160ARDB connected on I2C bus, so add qixis driver
which is basically an i2c client driver to control FPGA.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
2019-11-25 16:32:14 +08:00
b558f49bc0 Add APIs to setup HugeTLB mappings for USDPAA 2019-11-25 16:32:12 +08:00
dc640f653a powerpc/pm: add sleep and deep sleep on QorIQ SoCs
In sleep mode, the clocks of CPU core and unused IP blocks are turned
off (IP blocks allowed to wake up system will running).

Some QorIQ SoCs like MPC8536, P1022 and T104x, have deep sleep PM mode
in addtion to the sleep PM mode. While in deep sleep mode,
additionally, the power supply is removed from CPU core and most IP
blocks. Only the blocks needed to wake up the chip out of deep sleep
are ON.

This feature supports 32-bit and 36-bit address space.

The sleep mode is equal to the Standby state in Linux. The deep sleep
mode is equal to the Suspend-to-RAM state of Linux Power Management.
    Command to enter sleep mode.
        echo standby > /sys/power/state
    Command to enter deep sleep mode.
        echo mem > /sys/power/state

Signed-off-by: Dave Liu <daveliu@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Jin Qing <b24347@freescale.com>
Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
Signed-off-by: Xie Xiaobo <X.Xie@freescale.com>
Signed-off-by: Zhao Qiang <B45475@freescale.com>
Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:32:12 +08:00
ffb8e12c2e powerpc/cache: add cache flush operation for various e500
Various e500 core have different cache architecture, so they
need different cache flush operations. Therefore, add a callback
function cpu_flush_caches to the struct cpu_spec. The cache flush
operation for the specific kind of e500 is selected at init time.
The callback function will flush all caches in the current cpu.

Signed-off-by: Chenhui Zhao <chenhui.zhao@freescale.com>
Reviewed-by: Yang Li <LeoLi@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:32:11 +08:00
3ba26f9e41 powerpc/pm: Fix suspend=n in menuconfig for e500mc platforms.
Also, unselect FSL_PMC which is for older platfroms instead.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:32:10 +08:00
37f27cc362 irqchip/qeic: remove PPCisms for QEIC
[PowerPC part]

QEIC was supported on PowerPC, and dependent on PPC,
Now it is supported on other platforms, so remove PPCisms.

Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 16:32:10 +08:00
cbe10bae8d irqchip/qeic: merge qeic init code from platforms to a common function
[PowerPC part]

The codes of qe_ic init from a variety of platforms are redundant,
merge them to a common function and put it to irqchip/irq-qeic.c

For non-p1021_mds mpc85xx_mds boards, use "qe_ic_init(np, 0,
qe_ic_cascade_low_mpic, qe_ic_cascade_high_mpic);" instead of
"qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);".

qe_ic_cascade_muxed_mpic was used for boards has the same interrupt
number for low interrupt and high interrupt, qe_ic_init has checked
if "low interrupt == high interrupt"

Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 16:32:09 +08:00
bbe3181057 arm64: add stage-2 cache-able non-shareable page type
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:32:09 +08:00
f262f73113 arm: add pgprot_cached and pgprot_cached_ns support
Signed-off-by: Jianhua Xie <jianhua.xie@nxp.com>
2019-11-25 16:32:09 +08:00
da39c8ee96 arm: add new non-shareable ioremap
Signed-off-by: Pan Jiafei <Jiafei.Pan@nxp.com>
Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
2019-11-25 16:32:07 +08:00
690e978155 arm: dma-mapping: export arch_setup_dma_ops()
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:32:07 +08:00
0babba4195 export arch_setup_dma_ops()
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-11-25 16:32:06 +08:00
4e02081fa8 arch: arm: add ARM specific fucntions required for ehci fsl driver
Add below functions for ARM platform which are used by ehci fsl driver:
1. spin_event_timeout function
2. set/clear bits functions

Signed-off-by: Zhao Qiang <B45475@freescale.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
2019-11-25 16:32:06 +08:00
d761bbdcfe arm64: add ioremap for normal cacheable non-shareable memory
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
Reviewed-by: Roy Pledge <roy.pledge@freescale.com>
Reviewed-by: Stuart Yoder <stuart.yoder@freescale.com>
2019-11-25 16:32:06 +08:00
7c0b2833ff arm64/pgtable: add support to map cacheable and non shareable memory
Signed-off-by: Haiying Wang <Haiying.wang@freescale.com>
2019-11-25 16:32:05 +08:00
928debc344 arm64: add support to remap kernel cacheable memory to userspace
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
Reviewed-by: Roy Pledge <roy.pledge@freescale.com>
Reviewed-by: Stuart Yoder <stuart.yoder@freescale.com>
2019-11-25 16:32:05 +08:00
4ef3de913f arm: kernel: utilize hrtimer based broadcast
Hrtimer based broadcast is used on ARM platform. It can be
registered as the tick broadcast device in the absence of
a real external clock device.

Signed-off-by: Alison Wang <alison.wang@freescale.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
2019-11-25 16:32:05 +08:00
82dbf8881d LF-39 soc: imx: Update busfreq to support different frequncy setpoint
On i.MX8M SOC family, we can support LPDDR4, DDR4 or DDR3L, we may need
to support different setpoint for audio & low bus mode on different DDR type,
So update the code to get all the supported setpoint info from ATF.
The maximum setpoints that can be supported by hardware is 4, if the drate
for a setpoint is '0', that means this setpoint is not enabled. We can use
these info to find out the lowest drate setpoint for audio & low bus mode.

    BuildInfo:
        - ATF 59fe78cfe7

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:32:02 +08:00
e7002cc2bd MLK-23008 ARM: imx: Remove unused code on i.MX7D suspend driver
Remove unused code on i.MX7D suspend driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:32:02 +08:00
b704a998a5 MLK-23002 ARM: imx: Make sure system counter frequency change successfully
During system counter frequency change, the counter will stop, it
takes several mS even up to 20mS to finish the frequency change, if
system enters STOP mode before the frequency change done, system
counter will NOT run during STOP mode, then it will case system time
inaccurate and sometimes cause below RCU stall, so system can ONLY
enter STOP mode after the system counter frequency change done by
checking the ACK of frequency change.

rtc_testapp_6    0  TINFO  :    Waiting 50 seconds for alarm.......
fec 30be0000.ethernet eth0: Link is Down
PM: suspend devices took 0.670 seconds
Disabling non-boot CPUs ...
Enabling non-boot CPUs ...
rcu: INFO: rcu_sched self-detected stall on CPU
rcu:     0-...!: (1 ticks this GP) idle=1f6/1/0x40000002 softirq=5240/5240 fqs=0
 (t=4903 jiffies g=3737 q=4)
rcu: rcu_sched kthread starved for 4903 jiffies! g3737 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 ->0
rcu: RCU grace-period kthread stack dump:
rcu_sched       I    0    10      2 0x00000000
[<c0d85a9c>] (__schedule) from [<c0d85e64>] (schedule+0x50/0xc4)
[<c0d85e64>] (schedule) from [<c0d8b8fc>] (schedule_timeout+0x1b8/0x37c)
[<c0d8b8fc>] (schedule_timeout) from [<c01b9f2c>] (rcu_gp_kthread+0x8cc/0x1678)
[<c01b9f2c>] (rcu_gp_kthread) from [<c015f12c>] (kthread+0x114/0x14c)
[<c015f12c>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20)
Exception stack(0xd80fdfb0 to 0xd80fdff8)
dfa0:                                     00000000 00000000 00000000 00000000
dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
NMI backtrace for cpu 0
CPU: 0 PID: 834 Comm: rtc_testapp_6 Not tainted 5.4.0-rc7-03214-g56a9ca3 #105
Hardware name: Freescale i.MX7 Dual (Device Tree)
[<c01126e4>] (unwind_backtrace) from [<c010cf3c>] (show_stack+0x10/0x14)
[<c010cf3c>] (show_stack) from [<c0d691dc>] (dump_stack+0xe4/0x118)
[<c0d691dc>] (dump_stack) from [<c0d70678>] (nmi_cpu_backtrace+0xac/0xbc)
[<c0d70678>] (nmi_cpu_backtrace) from [<c0d70768>] (nmi_trigger_cpumask_backtrace+0xe0/0x130)
[<c0d70768>] (nmi_trigger_cpumask_backtrace) from [<c01be188>] (rcu_dump_cpu_stacks+0x9c/0xd8)
[<c01be188>] (rcu_dump_cpu_stacks) from [<c01bd254>] (rcu_sched_clock_irq+0x940/0xbec)
[<c01bd254>] (rcu_sched_clock_irq) from [<c01c5758>] (update_process_times+0x2c/0x54)
[<c01c5758>] (update_process_times) from [<c01d9cf0>] (tick_sched_timer+0x5c/0xc0)
[<c01d9cf0>] (tick_sched_timer) from [<c01c6bf8>] (__hrtimer_run_queues+0x140/0x548)
[<c01c6bf8>] (__hrtimer_run_queues) from [<c01c792c>] (hrtimer_interrupt+0x134/0x2bc)
[<c01c792c>] (hrtimer_interrupt) from [<c097eb00>] (arch_timer_handler_phys+0x2c/0x34)
[<c097eb00>] (arch_timer_handler_phys) from [<c01a6b1c>] (handle_percpu_devid_irq+0xd4/0x384)
[<c01a6b1c>] (handle_percpu_devid_irq) from [<c01a072c>] (generic_handle_irq+0x20/0x34)
[<c01a072c>] (generic_handle_irq) from [<c01a0d34>] (__handle_domain_irq+0x64/0xe0)
[<c01a0d34>] (__handle_domain_irq) from [<c0548510>] (gic_handle_irq+0x4c/0xa0)
[<c0548510>] (gic_handle_irq) from [<c0101a70>] (__irq_svc+0x70/0x98)
Exception stack(0xd8cedd00 to 0xd8cedd48)
dd00: 00000001 d88a5d20 00000000 200a0013 00000000 00000000 c1b3f6f0 0000002a
dd20: d8cec000 00000000 c1b3dbf8 c1b3d6f8 c16c82bc d8cedd50 c018fe50 c019dd68
dd40: 200a0013 ffffffff
[<c0101a70>] (__irq_svc) from [<c019dd68>] (console_unlock+0x4e0/0x634)
[<c019dd68>] (console_unlock) from [<c019f6c8>] (vprintk_emit+0xf4/0x2d0)
[<c019f6c8>] (vprintk_emit) from [<c019f8c8>] (vprintk_default+0x24/0x2c)
[<c019f8c8>] (vprintk_default) from [<c019fe9c>] (printk+0x2c/0x54)
[<c019fe9c>] (printk) from [<c013b560>] (enable_nonboot_cpus+0x38/0x2cc)
[<c013b560>] (enable_nonboot_cpus) from [<c019b4d0>] (suspend_devices_and_enter+0x374/0xa44)
[<c019b4d0>] (suspend_devices_and_enter) from [<c019be8c>] (pm_suspend+0x2ec/0x3d0)
[<c019be8c>] (pm_suspend) from [<c019a088>] (state_store+0x68/0xc8)
[<c019a088>] (state_store) from [<c033305c>] (kernfs_fop_write+0xfc/0x1e0)
[<c033305c>] (kernfs_fop_write) from [<c029d278>] (__vfs_write+0x2c/0x1d0)
[<c029d278>] (__vfs_write) from [<c02a0184>] (vfs_write+0xa0/0x180)
[<c02a0184>] (vfs_write) from [<c02a03e0>] (ksys_write+0x5c/0xd8)
[<c02a03e0>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
Exception stack(0xd8cedfa8 to 0xd8cedff0)
dfa0:                   00036294 00021590 00000004 bef5cd29 00000007 00000000
dfc0: 00036294 00021590 b6fc0d20 00000004 00000000 00000000 b6fc2fa4 00000000
dfe0: 00000004 bef5c8e8 b6f35d4f b6ec1d16
CPU1 is up
imx6q-pcie 33800000.pcie: Phy link never came up
imx6q-pcie 33800000.pcie: pcie link is down after resume.
mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
mmc1: queuing unknown CIS tuple 0x80 (6 bytes)
PM: resume devices took 0.220 seconds
OOM killer enabled.
Restarting tasks ... done.
PM: suspend exit

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:32:02 +08:00
593bea4e36 MLK-16005-2 arm64: tlb: add the SW workaround for i.MX8QM TKT340553
on i.MX8QM 1.0/1.1,TLB maintenance through DVM messages over ARADDR channel,
some bits (see the following) will be corrupted:

ASID[15:12] VA[48:45] VA[44:41] VA[39:36]

This issue will result in the TLB aintenance across the clusters not working
as expected due to some VA and ASID bits get corrupted

The SW workaround is: use the vmalle1is if VA larger than 36bits or
ASID[15:12] is not zero, otherwise, we use original TLB maintenance path.

Note: To simplify the code, we did not check VA[40] bit specifically

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-25 16:31:59 +08:00
fbfe972a07 ARM: imx: add ipu csi mux setting for imx6qdl
add csi mux setting for imx6qdl

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 2e10c8c02446f4fd20ac98172e86b185892480ba)
2019-11-25 16:31:59 +08:00
12456dda6c soc: imx8mq: Read SOC revision from TF-A
SOC revision on older imx8mq is not available in fuses so on anything
other than B1 current code just reports "unknown".

TF-A already handles this by parsing the ROM and exposes the value
through a SMC call. Call this instead of reimplementing the workaround
in the kernel itself.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Tested-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit e814909ddca3067d089a8bd62084aae851387f79)
2019-11-25 16:31:57 +08:00
2baaa05720 ARM: imx: Remove PU power operation for i.MX6QP
The GPC power domain driver add GENPD_FLAG_RPM_ALWAYS_ON to
the i.MX6QP's PU power domain flag, that means it is always ON
for runtime PM but can be OFF during suspend, so no need to
explicitly power ON/OFF PU power for i.MX6QP during suspend/resume
to avoid below dump:

Unable to handle kernel NULL pointer dereference at virtual address 00000044
pgd = 20824a30
[00000044] *pgd=4e36d831
Internal error: Oops: 17 [#1] SMP ARM
Modules linked in:
CPU: 0 PID: 732 Comm: sh Tainted: G        W         5.3.0-rc3-next-20190809-01770-g0a0b3ec-dir3
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
PC is at regmap_update_bits_base+0x10/0x74
LR is at imx6_pm_domain_power_on+0xbc/0x1b4
pc : [<c070887c>]    lr : [<c05e18e4>]    psr: 600001d3
sp : e9339d68  ip : e9338000  fp : c1a24158
r10: c1308b08  r9 : 00000260  r8 : c1308b08
r7 : c1426120  r6 : c1426120  r5 : c1373580  r4 : 00000000
r3 : 00000001  r2 : 00000001  r1 : 00000260  r0 : 00000000
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment none
Control: 10c5387d  Table: 3949404a  DAC: 00000051
Process sh (pid: 732, stack limit = 0x8ba716d6)

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:57 +08:00
738569521c ARM: imx: Fix i.MX7D debug uart path
Correct i.MX7D debug uart path for Mega/Fast mix off suspend
to avoid output mess during resume.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:56 +08:00
23b3047588 ARM: imx: Add anatop initialization for i.MX SoCs
i.MX SoCs needs anatop for suspend/resume, add anatop initialization
for them.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:56 +08:00
8cb7f0e456 mfd: imx6dl: Add LDB/IPU DI mux control register definitions for iomuxc gpr
This patch adds macros to define masks and bits for imx6dl
LDB/IPU DI mux control registers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:31:55 +08:00
9528afb199 mfd: imx6qp: Add PRE/PRG mux control register definitions for iomuxc gpr
This patch adds macros to define masks, shifts and bits for imx6qp
PRE/PRG mux control registers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:31:55 +08:00
a86c2f7db7 ARM: imx6ul/ull: init enet MAC address
Add enet MAC address read from efuse.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:31:54 +08:00
05f69cb034 MLK-10463-1 ARM: imx: init ENET RGMII tx clock source
Init ENET RGMII tx clock source, set GPR5[9] to select clock from
internal PLL_enet. And set phy VDDIO to 1.8V that get better signal
quality.

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: d7a171fcf5218166f558428610ca8e9cb9f7e830)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 16:31:54 +08:00
c894edb367 MLK-10060 ARM: i.MX6: disable ethernet phy AR8031 EEE mode in default
Disable ethernet phy AR8031 EEE mode in default to reduce the IEEE1588
latency.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 16:31:54 +08:00
a3990871b9 ARM: imx: correct the enet_clk_ref clock string
Correct the clock string "enet_ref" to "enet_clk_ref".

Signed-off-by: Fugang Duan <B38611@freescale.com>
2019-11-25 16:31:53 +08:00
e67f13383b MLK-12065 ARM: imx: imx7d: enable enet mdio open drain
The management data input/output (MDIO) bus where often high-speed,
open-drain operation is required. i.MX7D TO1.0 ENET MDIO pin has no
open drain as IC ticket number: TKT252980, i.MX7D TO1.1 fix the issue.

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: a747abd5f01d278b91d1b6ee6628e1935cb7b23c)

Conflicts:
	arch/arm/mach-imx/mach-imx7d.c
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 16:31:52 +08:00
05d0ab781f MLK-9694 ARM: imx6: init enet MAC address
Enet get MAC address order:
From module parameters or kernel command line -> device tree ->
pfuse -> mac registers set by bootloader -> random mac address.

When there have no "fec.macaddr" parameters set in kernel command
line, enet driver get MAC address from device tree. And then if
the MAC address set in device tree and is valid, enet driver get
MAC address from device tree. Otherwise,enet get MAarch/arm/mach-imx
/mach-imx6q.c address from
pfuse. So, in the condition, update the MAC address (read from pfuse)
to device tree.

Cherry-pick & Merge patches from:
149ac988a25b8d8eb86d05679cbb7b42819ff7a1 &
3269e5c06bdb2f7ab9bd5afa9bbfe46d872197d3

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 16:31:52 +08:00
ec873f0edb ARM: imx: Enable i.MX7ULP cpufreq driver
Register i.MX7ULP cpufreq platform device to enable cpufreq
driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:51 +08:00
6f233c715c ARM: imx: Add i.MX7ULP suspend/resume support
Add i.MX7ULP suspend/resume support, including standby mode
and mem mode, mapped to VLPS and VLLS mode.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:51 +08:00
32fd54d13f MLK-22404-04: arm64: Enable IMX8M_PM_DOMAINS config for ARCH_MXC platform
The imx8m_pm_domain driver is used by i.MX8M SOC family, so enable
the IMX8M_PM_DOMAINS config for ARCH_MXC platform by default.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:51 +08:00
a9796ede8a ARM: mach-imx: add heartbeat driver for i.mx7ulp
Add heartbeat driver for i.mx7ulp.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:31:50 +08:00
7d4e79f327 soc: imx: imx-scu: Use SoC name as soc_id
Use SoC name as soc_id instead of number passed from SCU firmware.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:50 +08:00
4a8eb0f594 arm: imx: rename the compatible node of lpm mu driver
Because that the mailbox MU driver is used in i.MX RPMSG implementation.
There is a confliction between this MU driver and the mailbox MU driver.

To back-compaible with LPM of iMX6SX, iMX7D and iMX7ULP.
Rename the compatible node of this MU driver.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:31:49 +08:00
8edeb92188 arm: arch: enable rpmsg for imx amp soc
Enable the RPMSG for iMX AMP SOC.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:31:49 +08:00
c54a998d8d Revert "of/fdt: Remove dead code and mark functions with __init"
This reverts commit 9b4d2b635b.

Those APIs are needed by i.MX PM codes
2019-11-25 16:31:48 +08:00
194fc9c9db Revert "of/fdt: Fix ‘of_fdt_match’ defined but not used compiler warning"
This reverts commit 5d9c4e9591.

Those APIs are used by PM codes
2019-11-25 16:31:48 +08:00
e3e8dee20e MLK-20136-03 driver: soc: imx: add 100mts support for imx8mq low bus mode
The 100MTS low bus mode can be only supported by i.MX8MQ Rev2.1 and
future TO. So necessary check is added to identify the chip revision
when doing busfreq mode switch.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>

Use soc_device_metch instead of global imx_get_soc_revision

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:31:47 +08:00
ae8d63a1a1 MLK-21985-9 Revert "MLK-20136-03 driver: soc: imx: add 100mts support for imx8mq low bus mode"
This reverts commit 7560cff21b7b92127675d5e955874af2827a9bca.

drivers/soc/imx/busfreq-imx8mq.o: In function `reduce_bus_freq':
/home/b29396/Work/linux/dash-linux-devel/build_v8/../drivers/soc/imx/busfreq-imx8mq.c:193: undefined reference to `imx_get_soc_revision'
/home/b29396/Work/linux/dash-linux-devel/build_v8/../drivers/soc/imx/busfreq-imx8mq.c:120: undefined reference to `imx_get_soc_revision'
drivers/soc/imx/busfreq-imx8mq.o: In function `set_high_bus_freq':
/home/b29396/Work/linux/dash-linux-devel/build_v8/../drivers/soc/imx/busfreq-imx8mq.c:327: undefined reference to `imx_get_soc_revision'
/home/b29396/Work/linux/dash-linux-devel/Makefile:1052: recipe for target 'vmlinux' failed
make[1]: *** [vmlinux] Error 1

upstream kernel did not export imx_get_soc_revision for mx8.
Need find a better way to support for both mx8m and mx8.
2019-11-25 16:31:46 +08:00
f6b12bccd7 MLK-20203-4 soc: imx: fix coverity issue
This patch fixes coverity issue of "divide by 0".

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
(cherry picked from commit ed044f6d78)
2019-11-25 16:31:46 +08:00
1e853ac345 MLK-20136-03 driver: soc: imx: add 100mts support for imx8mq low bus mode
The 100MTS low bus mode can be only supported by i.MX8MQ Rev2.1 and
future TO. So necessary check is added to identify the chip revision
when doing busfreq mode switch.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit a906afb17d)
2019-11-25 16:31:46 +08:00
d5f14e4b58 MLK-18427-03 driver: soc: add busfreq driver support for imx8mm
add busfreq support on i.MX8MM. when system is running at low bus or
audio bus mode, the dram & bus clock will be reduced to a lower rate:
   NOC: 150MHZ, AXI: 24MHz, AXI 20MHZ, DRAM core clock: 25MHz.

when system is running at high bus mode, all the bus clock and dram
clock will be restore to the highest one.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit 4984e653a6)
2019-11-25 16:31:46 +08:00
b6cb41ac99 MLK-17590-02 driver: soc: imx: update the busfreq flow on imx8mq
Currently, on imx8mq evk board, we only support 3200mts and 667mts
frequency setpoints. So the DDR DVFS flow need to be updated accordingly.

The dram pll and dram apb clock rate is changed in ATF when doing frequency,
in kernel side, we need to call the clk API to update the clock rate info
in clock tree.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit a69c3794f5)
2019-11-25 16:31:45 +08:00
c74f346528 MLK-17447 drivers: soc: imx: Fix busfreq mutex unlock twice on imx8mq
A 'return' statement is missed before, So the mutex will be unlocked
twice, in some corner case, one core will unlock the mutex that locked
by anohter core wrongly. Then lead to concurrent access to the DVFS
at the same time.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit 659615af4d)
2019-11-25 16:31:45 +08:00
ac3505d8ee MLK-17190 driver: soc: Fix audio bus mode clock rate on imx8mq
If the system is currently in low bus mode, if the audio device
request the audio bus mode, the NOC, AHB and AXI bus clock rate
will be set wrongly, then bus will run at very low frequency, then
lead to audio playback underrun.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Tested-by: Anson Huang <anson.huang@nxp.com>
(cherry picked from commit 3a2a988cc0)
2019-11-25 16:31:44 +08:00
68449e5c27 MLK-16804-08 driver: soc: Reduce NOC/AHB/MAIN_AXI to save SOC power for audio playback
reduce the NOC, main AXI and AHB bus clock frequency to save power when DDR enter low
frequency mode. VDDSOC is ~195mA during video play, and ~180mA in idle.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Bai Ping <ping.bai@nxp.com>
(cherry picked from commit e109b34d30)
2019-11-25 16:31:44 +08:00
4db8bf6666 MLK-16804-06 driver: soc: Optimize the DDR frequency in audio playback case
If audio device is the only that access to ddr memory, the DDR
frequency can be reduce to 25MHz to save power. when DDR run in
25MHz frequency, the memory bandwidth is about 66MB/s, it can
meet the performance requirement for audio only case.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
(cherry picked from commit 7c2389b6dc)
2019-11-25 16:31:44 +08:00
92e082d9fb MLK-16689-03 driver: soc: Add busfreq driver for imx8mq
Add busfreq driver support on i.MX8MQ. The busfreq driver is
mainly used for dynamic DDR frequency change for power saving
feature. When there is no peripheral or DMA device has direct
access to DDR memory, we can lower the DDR frequency to save
power. Currently, we support frequency setpoint for LPDDR4:

    (1): 3200mts, the DDRC core clock is sourced from 800MHz
         dram_pll, the DDRC apb clock is 200MHz.

    (2): 400mts, the DDRC core clock is source from sys1_pll_400m,
         the DDRC apb clock is is sourced from sys1_pll_40m.

    (3): 100mts, the DDRC core clock is sourced from sys1_pll_100m,
         the DDRC apb clock is sourced from sys1_pll_40m.

In our busfreq driver, we have three mode supported:
    * high bus mode  <-----> 3200mts;
    * audio bus mode <-----> 400mts;
    * low bus mode   <-----> 100mts;

The actual DDR frequency is done in ARM trusted firmware by calling
the SMCC SiP service call.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>

Use CONFIG_IMX8M_BUSFREQ
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:31:43 +08:00
348314ae48 soc: imx8: do not build for arm v6/v7 platforms
Because imx_src_is_m4_enabled also defined in v6/v7 platforms code.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:31:43 +08:00
82836f6a33 arm: imx: fix busfreq-imx build failure
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:31:42 +08:00
e6d26ea852 arm: imx: Add low power idle for imx6ull
Add low power idle support for i.MX6ULL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:42 +08:00
9d8cacc997 arm: imx: Add low power idle support for imx6sll
Add low power idle support for i.MX6SLL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:41 +08:00
92685e4a28 arm: imx Add busfreq support for imx6sll
Add busfreq support for i.MX6SLL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:41 +08:00
1e1c1396e5 arm: imx: Add busfreq support for imx6ull
Add the busfreq node for i.MX6ULL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:41 +08:00
9378dc38b8 arm: imx: add low power idle for imx6ul
Add the low power idle support for i.MX6UL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:40 +08:00
b202184ae7 arm: imx: Add busfreq support for imx6ul
Add busfreq support on i.MX6UL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:37 +08:00
21066aba62 arm: imx: Add map io for imx6ul
Add the map io on i.MX6UL to support dsm,
busfreq & low power idle.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:36 +08:00
42528edf3f arm: imx: Add imx6sl low power idle support
Add i.MX6SL low power idle support.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:36 +08:00
55ec6efecd arm: imx: Add busfreq support imx6sl
Add busfreq support for i.MX6SL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:36 +08:00
1bc81e83d4 arm: imx: Add map io for imx6sl
Add the map io for i.MX6SL to support suspend/resume,
busfreq and low power idle.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:31:35 +08:00
95508eed54 arm: imx: remove RPMSG from Kconfig
There's already an rpmsg driver under drivers/rpmsg
Remove this duplicated one.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:31:34 +08:00
ee891b4c23 ARM: imx: add i.MX7D power management support
This patch adds i.MX7D power management support, including
low power idle, suspend with FastMix off, A7-M4 AMP power
management support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[ Aisheng: remove duplicated imx7d_init_late definition ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:31:34 +08:00
b199c5a470 soc: imx: fix build error of missing imx_src_is_m4_enabled
drivers/clk/imx/clk-gate2.o: In function `clk_gate2_do_shared_clks':
/home/b29396/Work/linux/dash-linux-devel/build_v8/../drivers/clk/imx/clk-gate2.c:61: undefined reference to `imx_src_is_m4_enabled'
drivers/clk/imx/clk-pfd.o: In function `clk_pfd_do_shared_clks':
/home/b29396/Work/linux/dash-linux-devel/build_v8/../drivers/clk/imx/clk-pfd.c:55: undefined reference to `imx_src_is_m4_enabled'
/home/b29396/Work/linux/dash-linux-devel/build_v8/../drivers/clk/imx/clk-pfd.c:55: undefined reference to `imx_src_is_m4_enabled'
drivers/clk/imx/clk-pllv3.o: In function `clk_pllv3_do_shared_clks':
/home/b29396/Work/linux/dash-linux-devel/build_v8/../drivers/clk/imx/clk-pllv3.c:109: undefined reference to `imx_src_is_m4_enabled'
/home/b29396/Work/linux/dash-linux-devel/Makefile:1047: recipe for target 'vmlinux' failed
make[1]: *** [vmlinux] Error 1
make[1]: Leaving directory '/home/b29396/Work/linux/dash-linux-devel/build_v8'
Makefile:179: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:31:33 +08:00
e12ffa41c1 ARM: imx: add i.MX6SX AMP system support
This patch adds i.MX6SX A9-M4 AMP system support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:33 +08:00
a70f422f26 ARM: imx: add i.MX6SX low power idle support
This patch adds i.MX6SX low power idle support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[ Aisheng: Fix rebase conflict ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:31:33 +08:00
4d546d4a1e ARM: imx: add suspend/resume with FastMix OFF support
This patch adds suspend/resume with FastMix OFF support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:32 +08:00
1f6b6e8a89 ARM: imx: add i.MX6SX bus-freq support
This patch adds i.MX6SX bus-freq support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:31 +08:00
1b8714b0de ARM: imx: add i.MX6DL bus-freq support
This patch adds i.MX6DL bus-freq support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:30 +08:00
ee23850e61 ARM: imx: add i.MX6Q bus-freq support
Add i.MX6Q bus-freq support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:30 +08:00
dc782dd284 ARM: imx: add i.MX7D bus-freq support
Add i.MX7D bus-freq support, it supports High/Low/Audio bus
mode.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:31:30 +08:00
a4f408b44e Add MU module for vpu dependence on QXP/QM
Add MU module:
drivers/soc/imx/Makefile
drivers/soc/imx/mu/Makefile
drivers/soc/imx/mu/mx8_mu.c
include/linux/mx8_mu.h

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:31:29 +08:00
0cc4444a6d imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:31:29 +08:00
9082092896 powerpc/configs/sdk_dpaa: enable the Cortina PHY driver
Cortina PHYs are present on T4240RDB and T2080RDB. Enable the driver
by default.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-11-25 16:31:28 +08:00
f81fba037e powerpc/configs/sdk_dpaa: add defconfigs
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-11-25 16:31:27 +08:00
8e47bd4d4e arm64/defconfig: build DCSS driver by default
This patch will make DCSS driver built-in.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:31:25 +08:00
0c857beb7d hotfix: arm64: defconfig: disable CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST
This is a temporarily workaround cause it breaks MX8MQ and LS platforms
booting.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:31:25 +08:00
5222809412 MLK-23000-2 ARM64: defconfig: enable CONFIG_MXC_MLB150
Add mlb support for i.MX8QXP-lpddr4-val paltform.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:31:24 +08:00
c92d854e36 arm64: lsdk.config: set CONFIG_SQUASHFS_XZ=y
When user use squashfs image which has enabled XZ, kenrel need to also enable
this feature, otherwise will encoutner below error when boot:

squashfs: SQUASHFS error: Filesystem uses "xz" compression.. This is not supported

This feature is needed by some standard Ubuntu tools like snap or initramfs.
So enable it in LSDK kernel by default.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:31:24 +08:00
43bccd56a0 arm64: defconfig: Build in i.MX27 PWM driver
This patch builds in the i.MX27 PWM driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:31:24 +08:00
37764cb966 arm64: defconfig: Build in generic PWM backlight driver
This patch builds in the generic PWM backlight driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:31:23 +08:00
eacfcf52de arm64: defconfig: Build in DRM simple panel driver
This patch builds in the DRM simple panel driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:31:23 +08:00
ff5b9d8fac MLK-22957 ARM64: defconfig: add some USB configurations
- CONFIG_SND_USB_AUDIO
Support USB audio card when boards are at host mode.

- CONFIG_USB_EHSET_TEST_FIXTURE
Triggering Embedded Host entering test mode for USB-IF electrical test.

- CONFIG_USB_TEST
Support USB host stress test in raw data mode

Cc: Jun Li <jun.li@nxp.com>
Cc: Ran Wang <ran.wang_1@nxp.com>
Cc: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:31:22 +08:00
7501210b84 arm64: defconfig: Add GPMI_NAND and MXS_DMA in defconfig
Add the GPMI_NAND and related MXS_DMA into defconfig

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:31:22 +08:00
88127bc1a7 Revert "arm64: defconfig: Add imx8mq platform"
This reverts commit 8bf5ea8506c2185dba919d7876987e24b193ca9c.

There is no ARCH_FSL_IMX8MQ in upstream, this was ported by mistake for
VPU. VPU dependency was already fixed.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:31:21 +08:00
ec1b47dc7b arm64: defconfig: enable some CRYPTO_* symbols
Enable the following:
-CAAM SNVS and SM drivers
-generic SW crypto algorithms - needed for tcrypt speed tests
-CRYPTO_USER - needed for configuring crypto algorithms
from user space (using tools like crconf)

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:31:20 +08:00
9a8154d245 arm64: defconfig: Enable the SBSA watchdog
Enable the SBSA watchdog driver that is present on lx2160a.

Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 16:31:20 +08:00
98515676df MLK-22901 arm64: defconfig: select CONFIG_UIO and CONFIG_UIO_PCI_GENERIC
The two configs are needed when enabling jailhouse hypervisor for
inter-cell communication.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:31:20 +08:00
a55388c23e arm64: defconfig: Enable pinctrl-s32v234 driver
Update default ARM64 config with S32V234 SIUL2 pin controller driver.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 16:31:19 +08:00
74a4052587 arm64: defconfig: Enable configs for S32V234
Enable support for the S32V234 SoC, including the previously added UART
driver.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Adrian.Nitu <adrian.nitu@freescale.com>
Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-11-25 16:31:19 +08:00
6777b5481b arm64: defconfig: enable TSN on felix switch
Enable TSN feature on felix switch driver in defconfig.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
2019-11-25 16:31:19 +08:00
7717ea0d12 arm64: configs: enable TSN on ENETC
Enables TSN feature on ENETC in defconfig and lsdk.config

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
2019-11-25 16:31:18 +08:00
f91f856a09 arm64: defconfig: enable ENETC and LS1028A board PHYs in defconfig
Enables ENETC and felix drivers used on LS1028A along with PHYs used on
LS1028A boards.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
2019-11-25 16:31:18 +08:00
38835af592 arm64: lsdk.config: Remove unnecessary CONFIG_BLK_DEV_RAM_SIZE
CONFIG_BLK_RAM_SIZE is no longer needed as we use initrd instead of
the old way of using ramdisk in LSDK.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:31:17 +08:00
5368a81bfe arm64: lsdk.config: Remove non-NXP modules
There are many non-NXP modules which are endabled in defconfig by default.
Actually we can remove these unused modules in kernel lsdk.config for LSDK to
reduce the size of lib/modules.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:31:17 +08:00
8b4dccb95c arm64: lsdk.config: Don't remove MEDIA_SUPPORT required by IMX
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:31:16 +08:00
19ee65c61c arm64: defconfig: enable PCF85363
Enable upstream driver of pcf85263

Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-25 16:31:15 +08:00
eab289fbb8 arm64: defconfig: ls1028a: Enables Display related options
This patch add display drivers related options as modules by default.

Signed-off-by: Wen He <wen.he_1@nxp.com>
2019-11-25 16:31:15 +08:00
a48f5dbb91 arm64: lsdk.config: Disable ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT temporarily
The upstream kernel created this option to disable the bypass by
default. But our MC driver cannot work with bypass disabled.  While we
are investigating the issue, disable the new option temporarily for the
DPAA2 platforms to boot.  As this is not aligned with the upstream
strategy, the change is temporary and should be removed once the MC
problem is addressed.

Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:31:15 +08:00
2396fa7b7f arm64: configs: Enable Audio related options
This patch enables Audio related options.

CONFIG_SND_SOC_FSL_SAI is implied by CONFIG_SND_SOC_IMX_* drivers.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
2019-11-25 16:31:15 +08:00
df0d9b1386 arm64: lsdk.config: Update CONFIG_BLK_DEV_RAM_SIZE
Current ramdiskrfs is causing error of 'No space left on device' when
merging kernel module into the ramdisk. Need change CONFIG_BLK_DEV_RAM_SIZE
to 524288 to fix this issue

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:31:14 +08:00
a81f9c07e6 arm64: lsdk.config: Remove the definition "CONFIG_DRM is not set"
As per patch "arm64: defconfig: Enables Display support on LS1028A"
, already added option CONFIG_DRM as default. this definition will
override default options set by defconfig.

Otherwise 64-bit ARM builds fail with undefined references to DRM.

Signed-off-by: Wen He <wen.he_1@nxp.com>
2019-11-25 16:31:14 +08:00
683175a975 arm64: defconfig: enable NXP FlexCAN driver as module
Enable driver support of NXP FlexCAN controller.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
2019-11-25 16:31:13 +08:00
4791cfd4a6 arm64: defconfig: Enable CONFIG_MTD_PHYSMAP
Enable CONFIG_MTD_PHYSMAP to communicate with IFC NOR flash.

Signed-off-by: Jagdish Gediya <jagdish.gediya@nxp.com>
2019-11-25 16:31:13 +08:00
db77da38ad arm64: lsdk.config: Enable IOMMU passthrough by default
Since Linux v4.19 the new kernel configure option has been added to
enable the IOMMU passthrough by default.  We have been enabling the
passthrough for LSDK in kernel parameter.  Enabling this in kernel
configure will make kernel parameter optional.

Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:31:12 +08:00
a41695abf9 arm64: defconfig: add qixis and regmap based mdio mux config
MDIO bus mux in LX2160AQDS is controlled via qixis.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
2019-11-25 16:31:12 +08:00
657be93958 arm64: defconfig: add CONFIG_INPHI_PHY for IN112525 retimer
Inphi IN112525_s03 is used on LX2 RDB boards on the 25G interfaces.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
2019-11-25 16:31:12 +08:00
ca7bdd7c04 arm64: defconfig: Enable CONFIG_PCI_LAYERSCAPE_GEN4
Enable the PCIe Gen4 controller driver for Layerscape SoCs.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:31:11 +08:00
310c86cb42 arm64: lsdk.config: enable CGROUP_FREEZER to support lxc
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-11-25 16:31:10 +08:00
2829a01a43 arm64: defconfig: enable CONFIG_GPIO_MPC8XXX
Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
2019-11-25 16:31:10 +08:00
7b08659e4c arm64: defconfig: change fsl-mc userspace support config
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-11-25 16:31:10 +08:00
145b935384 arm64: defconfig: enable drivers used on QorIQ SoC and RDB boards
Enables various network related options:

CONFIG_FSL_DPAA2_ETH=y
CONFIG_FSL_DPAA2_MAC=y

CONFIG_FSL_SDK_DPA=y
CONFIG_FSL_SDK_FMAN=y
CONFIG_FSL_SDK_DPAA_ETH=y

CONFIG_VITESSE_PHY=y
CONFIG_REALTEK_PHY=y
CONFIG_AQUANTIA_PHY=y
CONFIG_FSL_XGMAC_MDIO=y

CONFIG_VFIO_FSL_MC=y

CONFIG_NET_SWITCHDEV=y
CONFIG_FSL_DPAA2_ETHSW=y

CONFIG_FSL_PPFE=y
CONFIG_FSL_PPFE_UTIL_DISABLED=y

and other drivers:
CONFIG_RTC_DRV_DS1307=y
CONFIG_RTC_DRV_PCF2127=y
CONFIG_SND_SOC_FSL_SAI=y
CONFIG_CRYPTO_DEV_FSL_CAAM=y
CONFIG_SPI_FSL_DSPI=y
CONFIG_SPI_FSL_QUADSPI=y
CONFIG_E1000=y

There are options implied by new options:
CONFIG_MDIO_BUS_MUX_MMIOREG by CONFIG_FSL_DPAA2_MAC=y
CONFIG_CLK_QORIQ by CONFIG_QORIQ_CPUFREQ=y
CONFIG_VLAN_8021Q=m by CONFIG_FSL_DPAA2_EVB  drivers/staging/fsl-dpaa2/evb/Kconfig
CONFIG_MEMORY by CONFIG_MTD_NAND_FSL_IFC  drivers/mtd/nand/raw/Kconfig

Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:31:09 +08:00
2eba1151d0 arm64: lsdk.config: enable CONFIG_CRYPTO_USER
Enable CONFIG_CRYPTO_USER to allow for configuring crypto algorithms
from user space, for e.g. changing their priorities.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:31:08 +08:00
9c0d4a5096 arm64: lsdk.config: enable support for lxd and lxd-bridge
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-11-25 16:31:08 +08:00
441116b21b arm64: lsdk.config: Avoid byte_swap for MTD partition
As per patch "driver: mtd: update struct map_info's swap as per
map requirement" swap filed of struct mtd_info is automatically
configured as per device characteristics defined in device tree.

No need to CONFIG_MTD_CFI_BE_BYTE_SWAP as default.

Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
2019-11-25 16:31:06 +08:00
1942a9a5a5 arm64: lsdk.config: added config options required to run docker
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-11-25 16:31:02 +08:00
feba18ee28 arm64: lsdk.config: add additional lsdk.config for LSDK
This patch is only for LSDK instead of upstream.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
2019-11-25 16:31:02 +08:00
a8774e9176 arm64: defconfig: Set CMA_SIZE_MBYTES=320
This matches previous imx releases.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:31:01 +08:00
2e2e40e943 arm64: defconfig: Add imx8mq platform
Add mscale platform 'CONFIG_ARCH_FSL_IMX8MQ':
arch/arm64/Kconfig.platforms
arch/arm64/configs/defconfig

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:31:00 +08:00
452651a93a MLK-15095-02 arm64: defconfig: add Bluetooth support
Enable Bluetooth stack, driver and HCI interface config for
Bluetooth support.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:31:00 +08:00
305ad89ba1 ARM64: defconfig: remove ATH10K config
Remove ATH10K config which has conflict with QCA CLD
driver.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:30:59 +08:00
9f51529176 MLK-19464 arm64: defconfig: build in IPv6
For mfgtool (UUU) requirement, it needs to build in IPv6 for nfs
rootfs mount.

Reviewed-by: Frank Li <frank.li@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Leonard: make savedefconfig clean ]
[ Leonard: drop adding xfrm modules, upstream removed symbols ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:59 +08:00
27d7c5f818 MLK-20685-01 arm64: defconfig: add pcie hif support for brcmfmac
Enable pcie hif config for brcmfmac.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:30:58 +08:00
4bad73ab3f MLK-15312 arm64: defconfig: enable 802.2 LLC
Enable IEEE 802.2 LLC protocol.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Pandy Gao <pandy.gao@nxp.com>
2019-11-25 16:30:58 +08:00
891f51a639 arm64: defconfig: enable wireless configs for marvell
- disable marvell community wifi driver that is conflict
  with marvell wifi module driver released from marvell.
- build in cfg80211 and cfg80211 wireless extensions.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:58 +08:00
f9941f576a arm64: defconfig: Enable pm debug config by default
Enable 'CONFIG_PM_DEBUG' by default for suspend/resume
debug purpose.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:30:57 +08:00
cb6258d43d arm64: defconfig: Select CONFIG_GPIO_SYSFS by default
Select CONFIG_GPIO_SYSFS by default to enable gpio sysfs
interface.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:30:57 +08:00
50fe56bbbb arm64: defconfig: built-in CONFIG_SND_SOC_IMX_PDM_MIC
built-in CONFIG_SND_SOC_IMX_PDM_MIC

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:30:56 +08:00
7fb45058db arm64: defconfig: built-in the CONFIG_SND_SOC_IMX_MQS
built-in the CONFIG_SND_SOC_IMX_MQS

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:30:56 +08:00
50b73d99c3 arm64: defconfig: Enable CONFIG_ARM_IMX_CPUFREQ_DT by default
Build in CONFIG_ARM_IMX_CPUFREQ_DT by default to support i.MX
DT cpu-freq driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:30:55 +08:00
27182012a5 arm64: defconfig: Do not add CONFIG_IMX8_JPEG as not set
Let mxc-jpeg build as module, as it is by default in
drivers/media/platform/imx8/Kconfig

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:55 +08:00
ca594f455c arm64: defconfig: enable mipi csi driver
enable mixel's mipi csi driver, for imx8mq

Signed-off-by: Robby Cai <robby.cai@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:54 +08:00
e0b907359f MLK-22746-2 arm64: defconfig: Add imx wireless-related configuration
Add wireless HOSTAP config and NL80211_TESTMODE config enable for
i.MX8mm Murata 1PJ (Qca9377-3).

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
2019-11-25 16:30:54 +08:00
e02ea37a40 MLK-22625-1 arm64: defconfig: enable tcrypt module
tcrypt module is required for testing crypto algorithms.

Note: CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is let to default value ("y"),
since setting it to "n" would slow down boot, i.e. have a system-level
effect.
For tcrypt testing CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=n is needed,
which will have to be done using a separate kernel config.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:30:54 +08:00
9e7ad00274 arm64: defconfig: enable mipi csi and mipi camera ov5640
enable mipi csi, csi bridge, and mipi camera ov5640

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:54 +08:00
0d3717e228 arm64: defconfig: built-in CONFIG_DRM_CDNS_HDMI_CEC
built-in CONFIG_DRM_CDNS_HDMI_CEC

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:53 +08:00
dcfcefa65b arm64: defconfig: built-in SND_SOC_IMX_CDNHDMI
built-in SND_SOC_IMX_CDNHDMI

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:30:53 +08:00
47816088ac arm64: defconfig: built-in SND_SOC_IMX_WM8524
built-in SND_SOC_IMX_WM8524

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:52 +08:00
553e91165f MLK-21940-9 arm64: defconfig: Built in CONFIG_SND_SOC_FSL_EASRC
Built in CONFIG_SND_SOC_FSL_EASRC

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 16:30:52 +08:00
e6127dae32 arm64: defconfig: Build-in SND_SOC_IMX_MICFIL and SND_SOC_IMX_RPMSG
Build-in SND_SOC_IMX_MICFIL and SND_SOC_IMX_RPMSG

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:30:51 +08:00
e2a3b157ce arm64: defconfig: support AK4497/AK5558/AK4497/SPDIF
support AK4497/AK5558/AK4497/SPDIF

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:30:50 +08:00
8b720855f2 arm64: defconfig: Enable lcdif-dsi-rm67191 display pipe
Add drivers for MXSFB, NWL-DSI, MIXEL_DPHY and RAYDIUM_RM67191 as
built-in.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:50 +08:00
9aea55c917 arm64: defconfig: remove the CONFIG_SENSORS_ISL29018 (part 2)
No need for this config define, remove it.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:30:50 +08:00
af0fcb6a36 arm64: defconfig: enable AUDMIX
enable AUDMIX

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:49 +08:00
7e0732b4b4 arm64: defconfig: Add iMX8 HDMI/DP to defconfig
Add iMX8 HDMI/DP to defconfig

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:49 +08:00
7abcad3605 MLK-20940-4 arm64: defconfig: Add RPBUS and RPMSG config
Enable RPBUS(i2c-rpmsg-imx.c) and RPMSG functions.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit b0ee196e5b)
2019-11-25 16:30:48 +08:00
4da947f758 MLK-22445-1 arm64: defconfig: enable Cadence USB3
Enable Cadence USB3 driver.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:48 +08:00
aa54ebc175 arm64: defconfig: enable SNVS/SC key driver
Enable SNVS/SC key driver for i.mx8 family.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
(cherry picked from commit 017ad346c16771f62905745550511ce951e9eea8)
2019-11-25 16:30:48 +08:00
90ec419fc5 MLK-16698-5: arm64: defconfig: Build in RM67191 panel driver
Enable the Raydium RM67171 drm panel driver as built-in in defconfig.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:47 +08:00
f30e706cce arm64: defconfig: add sensors CONFIG strings (part 2)
Add sensors' CONFIG stings for imx6/7/8.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:47 +08:00
2175803d15 arm64: defconfig: enable imx8qxp adc
Enable imx8qxp adc in default

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:30:47 +08:00
500508f028 MLK-16347-10: arm64: defconfig: Make ADV7511 driver built-in
Make the ADV7511 drm bridge driver as built-in, so the path MIPI-DSI to
ADV7535 will be available by default.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:46 +08:00
0236cdbbb6 arm64: defconfig: Enable CONFIG_IMX8MM_THERMAL by default
Enable CONFIG_IMX8MM_THERMAL by default to support i.MX8MM
thermal driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[ Leonard: make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:45 +08:00
a7ad0584b5 arm64: defconfig: Enable CONFIG_THERMAL_WRITABLE_TRIPS by default
Select CONFIG_THERMAL_WRITABLE_TRIPS by default to easy the test.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:30:45 +08:00
ae04785f9e arm64: defconfig: Enable CONFIG_DEVICE_THERMAL by default
Select CONFIG_DEVICE_THERMAL by default to support device
cooling.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:30:44 +08:00
a9de6ca6f6 MLK-18535-4 arm64: defconfig: enable 'IMX_LCDIF_CORE' config
Enable the 'IMX_LCDIF_CORE' config by default in ARM64
defconfig.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
[ Leonard: make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:44 +08:00
d1b26e01e4 MLK-18535-9 arm64: defconfig: enable 'IMX_SEC_DSIM' config
Enable the 'IMX_SEC_DSIM' config by default in ARM64
defconfig.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:30:43 +08:00
26dec1aa7b arm64: defconfig: enable imx sata
enable iMX SATA defaultly

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:30:43 +08:00
173a662558 arm64: defconfig: enable at8031 and tja110x PHY
Enable at8031 and tja110x PHY config.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:30:43 +08:00
3d9332d49e arm64: defconfig: enable imx8mq evk audio support
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:30:43 +08:00
2221ed9fa4 MLK-17319-2 arm64: defconfig: enable EMVSIM driver
Enable EMVSIM in defconfig.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:42 +08:00
139fc71b20 arm64: defconfig: enable qspi
Enable QuadSPI function in defconfig.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
[Leonard: Make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:42 +08:00
665c2a90a7 MLK-21960-5: arm64: defconfig: fspi related defconfig changes
enable UBI/UBIFS/JFFS2 and disable the 4K NOR erase size in defconfig

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:30:41 +08:00
2ab443fe99 arm64: defconfig: build-in necessary modules by default
Make i.MX RTC, thermal and watchdog modules build-in by default.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[ Leonard: Make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:40 +08:00
fcf04c478f arm64: defconfig: add FSL_EDMA_V3 support
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
[Leonard: Make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:40 +08:00
73e24a2746 arm64: defconfig: Build in imx-drm stuffs for i.MX8qxp mek by default
[Aisheng: Keep CONFIG_FB and remove unrelated OV5640 config]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
[Leonard: Make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:39 +08:00
9f77d929b8 arm64: defconfig: switch default cpufreq governor to ondemand
Use ondemand as default cpufreq governor to save power.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[Leonard: Make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:39 +08:00
3b97573cdc arm64: defconfig: built-in dsp drivers
built-in dsp drivers

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Leonard: Make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:39 +08:00
c43b9c9b0f arm64: defconfig: enable camera for imx8
Enable OV5640 camera sensor driver
Enable Image subsystem driver for imx8, it includes ISI, MIPI CSI
and virtual camera device which used to manage all modules driver

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
[ Aisheng: fix upgrade conflict ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
[ Leonard: Make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:39 +08:00
5a645ed934 arm64: defconfig: add LPSPI suppoort
Enable LPSPI, SPIDEV and slave mode support for ARM64.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
[ Leonard: make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:38 +08:00
b311b84122 arm64: defconfig: add imx8qxp audio support
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Leonard: Make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:38 +08:00
9bc116939a arm64: defconfig: add mxs-phy
Add USB MXS PHY driver.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:30:38 +08:00
ee38bea5d4 arm64: defconfig: enable usb and typec config
- Enable imx8mq PHY driver
- Enable usb gadget via configfs
- Enable legacy gadget drivers as module
- Enable typec related configs.

Signed-off-by: Li Jun <jun.li@nxp.com>
[ Aisheng: fix conflicts due to TYPEC already enabled as m ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
[ Leonard: Make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:37 +08:00
7d23aff84e arm64: defconfig: Add i.MX system controller thermal support
This patch enables CONFIG_IMX_SC_THERMAL as module.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[Leonard: make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:37 +08:00
d815c25bfd arm64: defconfig: add FlexCAN suppoort
Set the imx FlexCAN block as build-in.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
[Leonard: Make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:36 +08:00
49eb4642ea arm64: defconfig: add pcie lpi2c and nvme
Set the imx pcie, lpi2c and nvme blk as built-in.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
[Leonard: Make savedefconfig clean]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:36 +08:00
bff7a12a37 arm64: defconfig: add ION
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
[ Aisheng: fix upgrade conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
[ Leonard: make savedefconfig clean ]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:35 +08:00
13b9f2db3e arm64: defconfig: add imx8qm mek support
add imx8qm mek support

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:30:35 +08:00
fdb591667e arm64: defconfig: cycle through savedefconfig
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:34 +08:00
91aacb7e2b LF-40 ARM: imx_v6_v7_defconfig: remove HCI SDIO config
IMX bluetooth support interface is HCI UART. Remove HCI SDIO
interface since there have HIF conflict for cypress bluetooth.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:30:33 +08:00
81976c5817 ARM: imx_v6_v7_defconfig: enable adv7180
enable adv7180 as module

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:32 +08:00
f5aa899d33 ARM: imx_v6_v7_defconfig: enable some CRYPTO_* symbols
Enable the following:
-CAAM SNVS and SM drivers
-generic SW crypto algorithms - needed for tcrypt speed tests
-CRYPTO_USER - needed for configuring crypto algorithms
from user space (using tools like crconf)

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:30:32 +08:00
05adaaa23b MLK-22921-1 ARM: config: add spi slave support for imx6/7
Add spi slave support for imx6/7 platforms.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:30:32 +08:00
99cac263b0 MLK-22904: ARM: imx_v6_v7_defconfig: add DMA_CMA support
This is needed for VPU/MM/GPU features.
Generated by savedefconfig.

NOTE: the exist CONFIG_CMA_SIZE_MBYTES=320 option actually did not work
before due to missing CONFIG_DMA_CMA, removed it first.

Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:30:32 +08:00
b7102b50a5 ARM: lsdk.config: Remove non-NXP modules
There are many non-NXP modules which are endabled in defconfig by
default. Actually we can remove these unused modules in kernel
lsdk.config for LSDK to reduce the size of lib/modules.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:30:31 +08:00
71a3cbfc22 ARM: lsdk.config: enable support for lxd and lxd-bridge
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-11-25 16:30:31 +08:00
11998b39c1 ARM: lsdk.config: enable crypto options
Move crypto options from ARMv8-specific config fragment to lsdk.config
(which is used both by ARMv7 and ARMv8) - since they are needed for both
SoCs.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:30:30 +08:00
499d206c0a ARM: lsdk.config: Add ARM_MODULE_PLTS to support out of range modules
Enables the CONFIG_ARM_MODULES_PLTS by default for LSDK to allow modules
to be allocated in the vmalloc area.

Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:30:30 +08:00
47d810dd4a ARM: configs: Add multi_v7_lpae.config to support ARM_LPAE
Add multi_v7_lpae.config to support the Large Physical Address
Extension.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
2019-11-25 16:30:29 +08:00
5e9c3e6147 ARM: multi_v7_defconfig: Enable CONFIG_MTD_CFI_AMDSTD and CONFIG_MTD_PHYSMAP_OF.
Enable CONFIG_MTD_CFI_AMDSTD to support CFI command set 0002.
Enable CONFIG_MTD_PHYSMAP_OF which allows the NOR flash driver code to
communicate with chips which are mapped physically into the CPU's memory.

[ Leo: CONFIG_MTD_PHYSMAP_OF implied ]

Signed-off-by: Pankit Garg <pankit.garg@nxp.com>
2019-11-25 16:30:29 +08:00
1e579f07f4 ARM: multi_v7_defconfig: added config options required for DPAA 1
[ Leo: CONFIG_FSL_SDK_FMAN implied ]
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
2019-11-25 16:30:26 +08:00
5a0fe00f39 ARM: multi_v7_defconfig: Enable more drivers for LS1021A
This patch enables more drivers for LS1021A, such as FlexCAN, IFC, SATA,
PCIE, DCU, RTC, CAAM and Virtualization.

[leo: FlexCAN and DCU were enabled as 'm' in upstream.]

Signed-off-by: Alison Wang <alison.wang@nxp.com>
2019-11-25 16:30:23 +08:00
ae3b9584d1 ARM: multi_v8.config: fix PFE compile issue
add CONFIG_FSL_PPFE_UTIL_DISABLED to arm32

Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 16:30:23 +08:00
eb6483ff4a ARM: configs: add lsdk.config for arm32
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-11-25 16:30:22 +08:00
132af9c20f ARM: configs: Add multi_v8.config for ARMv8 AArch32 support
This patch is to add multi_v8.config for AArch32 support on ARMv8
platforms.

The default config for ARMv8 AArch32 support is multi_v7_defconfig +
multi_v7_lpae.config + multi_v8.config.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
2019-11-25 16:30:22 +08:00
78f592de0e ARM: multi_v7_defconfig: reorder with savedefconfig
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:30:22 +08:00
f2445a5c55 ARM: imx_v6_v7_defconfig: set the configs for marvell wireless
Set the necessary configs for marvell wireless solution.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:30:21 +08:00
88ffe78616 ARM: imx_v6_v7_defconfig: disable ov5640 driver of upstreaming version
disable ov5640 driver of upstreaming version

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:21 +08:00
b6c04deb67 MLK-22625-2 ARM: imx_v6_v7_defconfig: enable tcrypt module
tcrypt module is required for testing crypto algorithms.

Note: CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is let to default value ("y"),
since setting it to "n" would slow down boot, i.e. have a system-level
effect.
For tcrypt testing CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=n is needed,
which will have to be done using a separate kernel config.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:30:21 +08:00
dd223e97dd ARM: imx_v6_v7_defconfig: Enable mipi camera ov5640 of subdev version
enable mipi camera ov5640 of subdev version

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:20 +08:00
36d285cf6b ARM: imx_v6_v7_defconfig: Enable MIPI CSI driver
Enable Samsung's MIPI CSI driver

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:19 +08:00
28c6f5f3c5 ARM: imx_v6_v7_defconfig: Enable mx6s v4l2 capture driver
enable CONFIG_VIDEO_MXC_CSI_CAMERA as module

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:19 +08:00
964f2a36e9 ARM: imx_v6_v7_defconfig: Enable parallel camera ov5640 driver
enable parallel camera ov5640 driver based on subdev,
used by iMX 6UL/ULL/SX/SL/SLL

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:18 +08:00
16da39c90c ARM: imx_v6_v7_defconfig: Build in MXC IPU output driver
This patch builds in MXC IPU output driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:30:18 +08:00
c4434fab4c ARM: imx_v6_v7_defconfig: add v4l2 capture support for imx6qdl
add v4l2 capture support for imx6qdl, including IPU CSI/PrP, V4L2 capture and the
camera ov5640 (mipi and parallel) drivers.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:18 +08:00
633976b33d ARM: imx_v6_v7_defconfig: Fixup the typo for CONFIG_LLC2
Correct the typo for CONFIG_LLC2.

Fixes: ec4753a4c99a("MLK-22558 imx_v6_v7_defconfig: enable the necessary net configs")
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:30:18 +08:00
31d4db56e7 ARM: imx_v6_v7_defconfig: built-in SND_SOC_IMX_SI476X
built-in SND_SOC_IMX_SI476X

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:30:17 +08:00
a45d5f6ca2 ARM: imx_v6_v7_defconfig: Enable SND_SOC_IMX_SII902X and SND_SOC_IMX_HDMI
built-in SND_SOC_IMX_SII902X and SND_SOC_IMX_HDMI

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:30:17 +08:00
9fe46cac74 ARM: imx_v6_v7_defconfig: Enable dcic
CONFIG_FB_MXC_DCIC=y
support dcic.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:30:16 +08:00
227c77ff12 ARM: imx_v6_v7_defconfig: Enable imx6/7 hdmi fb device driver
CONFIG_FB_MXC_HDMI=y
CONFIG_FB_MXS_SII902X=y
CONFIG_MXC_HDMI_CEC=y

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:30:16 +08:00
aa9c25a714 ARM: imx_v6_v7_defconfig: Enable CONFIG_USB_CONFIGFS=y
This is used for network boot with an USB ethernet gadget

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:16 +08:00
fcbf87efe1 ARM: imx_v6_v7_defconfig: Enable CONFIG_VIDEO_MXC_PXP_V4L2
enable PXP V4L2 driver

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:15 +08:00
96a0a89e5b ARM: imx_v6_v7_defconfig: Enlarge CMA size to 320M
Enlarge CMA size to 320M so that GPU can reserve enough memory.

Signed-off-by: Ella Feng <ella.feng@nxp.com>
2019-11-25 16:30:14 +08:00
cbb3d9fc4b ARM: imx_v6_v7_defconfig: Disable etnaviv GPU driver.
Disable etnaviv driver to use Vivante private driver.

Signed-off-by: Ella Feng <ella.feng@nxp.com>
2019-11-25 16:30:14 +08:00
ba9d7c1b28 MLK-22558 ARM: imx_v6_v7_defconfig: Enable necessary net configs
Enable the necessary net configs:
	CONFIG_IP_MULTICAST
	CONFIG_VLAN_8021Q
	CONFIG_LLC2

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:30:13 +08:00
e7e39ec15e ARM: imx_v6_v7_defconfig: Enable audio sound card
support audio sound card (wm8960/wm8958/wm8962/mqs)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:30:13 +08:00
09b2e5d560 ARM: imx_v6_v7_defconfig: Remove CONFIG_MMA8452
Remove this define, because the mma8541 use CONFIG_MXC_MMA8451.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:30:13 +08:00
25b8c97a75 ARM: imx_v6_v7_defconfig: Enable focaltech touch support
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:30:13 +08:00
876b2579bc ARM: imx_v6_v7_defconfig: Eanble elan touch screen support
Currently, we just use driver elan_ts.c, not elants_i2c.c. So this
patch change this.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:30:12 +08:00
da4dad9ed9 ARM: imx_v6_v7_defconfig: Remove CONFIG_SENSORS_ISL29018
No need for this config define, remove it.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
[ Aisheng : split arm64 changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:30:12 +08:00
b7a0e0ad7b ARM: imx_v6_v7_defconfig: Enable CONFIG_FB_MXC_LDB
This patch sets CONFIG_FB_MXC_LDB to y so that we may
build in LDB driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:30:11 +08:00
ecbb5edccb ARM: imx_v6_v7_defconfig: Build in CONFIG_FB_MXC_SYNC_PANEL
This patch sets CONFIG_FB_MXC_SYNC_PANEL to y so that we
may build in IPUv3 framebuffer driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:30:11 +08:00
9986a20864 ARM: imx_v6_v7_defconfig: Enable CONFIG_MXC_IPU and CONFIG_MXC_IPU_PRE
This patch sets CONFIG_MXC_IPU and CONFIG_MXC_IPU_PRE to y so that we
can build in IPUv3 common driver and IPUv3 prefetch drivers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:30:11 +08:00
90b0e42f5e ARM: imx_v6_v7_defconfig: Disable CONFIG_IMX_IPUV3_CORE
For now we'll use our internal IPUv3 common driver, so this patch
disables CONFIG_IMX_IPUV3_CORE from upstream kernel.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[Leonard: Remove unrelated changes]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:30:11 +08:00
a07c60b6cf ARM: imx_v6_v7_defconfig: Enable EPDC driver
enable EPDC V1 and V2 driver

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:10 +08:00
37cc85c8de ARM: imx_v6_v7_defconfig: Enable PXP v2 and v3 driver
enable PXP v2 and v3 driver

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:10 +08:00
90d1521be3 ARM: imx_v6_v7_defconfig: Enable max17135 hwmon+regulator mfd
Enable max17135 hwmon, mfd, regulator function

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:30:09 +08:00
3f922d3262 ARM: imx_v6_v7_defconfig: Enable FB_MXC_TRULY_WVGA_SYNC_PANEL
Enable 'FB_MXC_TRULY_WVGA_SYNC_PANEL' config by default
for imx6 and imx7 series which support the TRULY HX8369
mipi panel.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:30:09 +08:00
38f5b839fb ARM: imx_v6_v7_defconfig: Enable FB_MXC_MIPI_DSI
Enable 'FB_MXC_MIPI_DSI' config by default for imx6 and imx7
series which include the NXP MIPI DSI controller.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:30:08 +08:00
7e8c78c6e7 ARM: imx_v6_v7_defconfig: Enable FB_MXC_MIPI_DSI_SAMSUNG
Enable 'FB_MXC_MIPI_DSI_SAMSUNG' config by default for
imx6 and imx7 series which include the Samsung MIPI DSI
controller.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:30:07 +08:00
f505cfe417 ARM: imx_v6_v7_defconfig: Enable FB_MXC_RK_PANEL_RK055IQH042
Enable 'FB_MXC_RK_PANEL_RK055IQH042' config by default for
imx6 and imx7 series which support the RM68191 mipi panel.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:30:07 +08:00
edc8796ea8 ARM: imx_v6_v7_defconfig: Enable FB_MXC_RK_PANEL_RK055AHD042
Enable 'FB_MXC_RK_PANEL_RK055AHD042' config by default for imx6 and imx7
series which support the RM68200 mipi panel.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:30:07 +08:00
a45efe0d9a ARM: imx_v6_v7_defconfig: Enable FB_MXC_TRULY_PANEL_TFT3P5581E
Enable 'FB_MXC_TRULY_PANEL_TFT3P5581E' config by default for imx6 and
imx7 series which support the TRULY TFT3P5581E mipi panel.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:30:06 +08:00
2d0ac27a1b ARM: imx_v6_v7_defconfig: Enable FB_MXC_MIPI_DSI_NORTHWEST
Enable 'FB_MXC_MIPI_DSI_NORTHWEST' config by default for imx6 and imx7
series which includes the Northwest Logic MIPI DSI controller.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:30:05 +08:00
eb196c1243 ARM: imx_v6_v7_defconfig: Enable FB_MXC_ADV7535
Enable 'FB_MXC_ADV7535' by default for imx6 and imx7 series.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:30:05 +08:00
ab4d079d75 ARM: imx_v6_v7_defconfig: Enable max8903 charger
Enable max8903 charger for i.mx6 boards.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:30:04 +08:00
6f6a7ab4a2 Revert "ARM: imx_v6_v7_defconfig: use MXSFB DRM driver"
This reverts commit aaeabc18a0.

Since, on legacy i.MX6 and i.MX7 series, only framebuffer driver
can be supported.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:30:04 +08:00
fe8a4ba200 ARM: imx_v6_v7_defconfig: Disable CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
Disable the CONFIG_MTD_SPI_NOR_USE_4K_SECTORS in imx_v6_v7_defconfig

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:30:03 +08:00
43f30e7213 ARM: imx_v6_v7_defconfig: Enable spidev for imx7ulp testing
Enable spidev for imx7ulp for test.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:30:03 +08:00
2ecdec7cd0 ARM: imx_v6_v7_defconfig: Enable sensors
Enable sensor drivers for imx6/7.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:30:03 +08:00
3ea93da663 ARM: imx_v6_v7_defconfig: Enable Bluetooth
Enable necessary Bluetooth configs.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:30:02 +08:00
a8a3d6a512 ARM: imx_v6_v7_defconfig: Enable CONFIG_ARM_IMX7ULP_CPUFREQ
Select CONFIG_ARM_IMX7ULP_CPUFREQ by default to support i.MX7ULP cpufreq.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:30:02 +08:00
27877589ab ARM: imx_v6_v7_defconfig: Enable CONFIG_IMX7ULP_WDT by default
Select CONFIG_IMX7ULP_WDT by default to support i.MX7ULP wdog.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:30:01 +08:00
e6bb340b93 ARM: imx_v6_v7_defconfig: Enable RPMSG RTC
Select CONFIG_RTC_DRV_IMX_RPMSG by default to support
i.MX RPMSG RTC.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:30:01 +08:00
5343fa13c5 ARM: imx_v6_v7_defconfig: Enable rpmsg_keys driver
Enable rpmsg_keys driver.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:30:01 +08:00
76f2635e3f ARM: imx_v6_v7_defconfig: Enable pf1550 rpmsg regulator
Add pf1550 rpmsg driver.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:30:00 +08:00
07d35c6b21 ARM: imx_v6_v7_defconfig: Enable rpmsg gpio driver
Enable CONFIG_GPIO_IMX_RPMSG to support rpmsg gpio driver in default.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:29:59 +08:00
0e5ca8fd77 ARM: imx_v6_v7_deconfig: Enable MAILBOX and IMX_MBOX
Enable the MBOX, it would be used by RPMSG implementation.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:59 +08:00
9757981134 ARM: imx_v6_v7_defconfig: Enable MLB
Enable CONFIG_MXC_MLB150=y

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:59 +08:00
93d3422809 MLK-10600-4: ARM: imx_v6_v7_defconfig: Enable SIM driver
Enable SIM driver.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:29:58 +08:00
5c29414f4e ARM: imx_v6_v7_defconfig: Enable lpspi support
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:58 +08:00
393a7b922e ARM: imx_v6_v7_defconfig: Enable lpi2c support
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:58 +08:00
a9482d7e4d ARM: imx_v6_v7_defconfig: Enable explicit CONFIG_TMPFS
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:29:57 +08:00
615770e0eb ARM: imx_v6_v7_defconfig: Enable CONFIG_DEVICE_THERMAL
Select CONFIG_DEVICE_THERMAL by default.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:57 +08:00
7f81d8498e ARM: imx_v6_v7_defconfig: Enable explicit CONFIG_THERMAL
Select CONFIG_THERMAL by default, it is removed by commit
6b77284c4e ("ARM: imx_v6_v7_defconfig: Re-sync defconfig")
which is unexpected.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:57 +08:00
a81c631c50 ARM: imx_v6_v7_defconfig: Cycle through savedefconfig
Cycling through "make savedefconfig" ensures that following patches
don't include diffs caused by changes in Kconfig defaults.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:29:56 +08:00
2c62de1a31 drivers/soc/fsl: add EPU FSM configuration for deep sleep
In the last stage of deep sleep, software will trigger a Finite
State Machine (FSM) to control the hardware procedure, such a
board isolation, killing PLLs, removing power, and so on.

When the system is waked up by an interrupt, the FSM controls
the hardware to complete the early resume procedure.

This patch configure the EPU FSM preparing for deep sleep.

Signed-off-by: Hongbo Zhang <hongbo.zhang@freescale.com>
Signed-off-by: Chenhui Zhao <chenhui.zhao@freescale.com>
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:29:54 +08:00
3f34a11961 fsl_pmc: update device bindings
Signed-off-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Zhao Chenhui <chenhui.zhao@nxp.com>
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:29:54 +08:00
0d058d7506 soc: fsl: add RCPM driver
The NXP's QorIQ processors based on ARM Core have RCPM module
(Run Control and Power Management), which performs system level
tasks associated with power management such as wakeup source control.

Note that this driver will not support PowerPC based QorIQ processors,
and it depends on PM wakeup source framework which provide collect
wake information.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-11-25 16:29:53 +08:00
3a3987b001 Documentation: dt: binding: fsl: Add 'little-endian' and update Chassis define
By default, QorIQ SoC's RCPM register block is Big Endian. But
there are some exceptions, such as LS1088A and LS2088A, are
Little Endian. So add this optional property to help identify
them.

Actually LS2021A and other Layerscapes won't totally follow Chassis
2.1, so separate them from powerpc SoC.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2019-11-25 16:29:53 +08:00
c6ec2917a6 MLK-22992 firmware: imx: scu-pd: fix wu_num
wu_num needs to be int type, u32 is not correct.

When "wakeup-irq" not included, of_property_count_u32_elems
will return a negative value. So use int.

And directly return when "wakeup-irq" not exists.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 16:29:51 +08:00
eeaa64aa12 MLK-22986-1: soc: imx: gpc: add ldo-bypass
Add ldo-bypass in gpc driver.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-25 16:29:51 +08:00
6b9ef3ceeb firmware: imx: scu-pd: correct edma0 channel number
32 channels are used for edma0 on i.mx8qxp/8qm. Correct it.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:29:50 +08:00
a1f3b5741c imx: scu-pd: add vpu-enc1 power domains for imx8qm
Add power domains for 'IMX_SC_R_VPU_ENC_1'

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 16:29:50 +08:00
f458fc5594 cpufreq: imx-cpufreq-dt: Correct i.MX8MN's default speed grade value
i.MX8MN has different speed grade definition compared to
i.MX8MQ/i.MX8MM, when fuses are NOT written, the default
speed_grade should be set to minimum available OPP defined
in DT which is 1.2GHz, the corresponding speed_grade value
should be 0xb.

Fixes: 5b8010ba70 ("cpufreq: imx-cpufreq-dt: Add i.MX8MN support")
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:49 +08:00
7c03849625 firmware: imx: pd: add board level power domain
Add power domain for board level on imx8qm mek.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:29:49 +08:00
29aec5cb8b firmware: imx: pd: add power domain for emvsim
Add power domain for emvsim on imx8qm mek.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:29:49 +08:00
aaaf06b9e9 imx: scu-pd: Add power domains for mxc-jpeg
Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
2019-11-25 16:29:46 +08:00
261386810a MLKU-62 imx: scu-pd: add power domain for caam job rings
On i.MX8 QM and QXP, caam crypto accelerator has 4 job rings,
however only the last two (JR2 and JR3) are accesible from the kernel.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:29:46 +08:00
ea8c1df2ee imx: scu-pd: add power domains for gpu1-pid
add power domains for gpu1-pid

Signed-off-by: Minjie Zhuang <minjie.zhuang@nxp.com>
2019-11-25 16:29:45 +08:00
d3aa9ad2e9 soc: imx: gpc: Remove unused APIs
Now that i.MX6QP does NOT need to handle PU power manually during
suspend/resume, remove those unused APIs.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:45 +08:00
dfed8a56ea cpufreq: imx6q: get old_freq from policy->cur
Get the old_freq from the policy->cur. So we can
get the correct frequency when low power run mode
is enabled.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:29:45 +08:00
387da9b7c4 imx: scu-pd: add vpu mu2 power domains for imx8qm
Add power domain for 'IMX_SC_R_VPU_MU_2'

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:29:44 +08:00
c18ddfb8a0 imx: scu-pd: add audio power domains for imx8qm
add audio power domains

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:29:43 +08:00
a1a5236525 firmware: imx: scu-pd: add the hdmi tx power domains
Add the HDMI TX power domains.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:29:43 +08:00
4700421b27 MLK-14473-2: power: supply: sabresd_battery: check max11801_read_adc()
part2 of commit(b4568bee5d).
The function calibration_voltage is calling max11801_read_adc from
touchscreen driverm which can return negative values in case of an
error. I case of an error, just stop reading ADC data and return 0 as
voltage_data.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:29:42 +08:00
c0e24ef714 MLK-11703-4: sabresd_battery: fix usb charger detect when resume back on mx6sl
cherry-pick below patch:

ENGR00288351 sabresd_battery: fix usb charger detect when resume back on
mx6sl

Fix  below redundant log after first resume back on mx6slevk:
max8903-charger max8903.12: USB Charger Connected

It's caused by not add enough prepare for uok&dok which are connected,
such as i.MX6SL-EVK. In this case the board only support DC charger detect,
so we didn't need judge the uok pin for USB charger detect, although uok
share with dok pin.

Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit c5ba4940a72e8124db7ef91a67b337df4e45e3b0)
(cherry picked from commit bcd7f8e5e1)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 52692baf47)
2019-11-25 16:29:42 +08:00
7ecd0e7d15 MLK-11703-3: power: sabresd_battery: remove check charger offset on mx6slevk
cherry-pick below patch:

ENGR00277663-3 power: sabresd_battery: remove check charger offset on
mx6slevk

No need check the charger offset on mx6slevk, since there is no adc
converter

Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 7683c62cf2290629f09983744d5a3987a4d64669)
(cherry picked from commit 5f29715585)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit c00d547719)
2019-11-25 16:29:42 +08:00
d7d4cae373 MLK-11703-2: power: sabresd_battery: add sabresd_battery driver
cherry-pick below patch:
ENGR00275004-4: power: sabresd_battery: add sabresd_battery driver

Add sabresd battery driver which based on Max8903 charger IC.

Signed-off-by: Robin Gong <b38343@freescale.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit cf4e6e09dd)
2019-11-25 16:29:42 +08:00
7a072a816e firmware: imx: scu-pd: add the hsio pds
Add the HSIO PDs, mandatory required by PCIe/SATA.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:41 +08:00
97e757069d cpufreq: Add i.MX7ULP cpufreq support
Add i.MX7ULP cpufreq driver support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:41 +08:00
2ec28b6d49 firmware: imx: scu-pd: change init level to subsys_initcall
Change power domain init level to subsys_initcall to ensure it's probed
before most devices to avoid unneccesary defer probe.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:40 +08:00
7ebcf5ccf4 MLK-22404-02 soc: imx: Add power domain driver support for i.mx8m family
The i.MX8M family is a set of NXP product focus on delivering
the latest and greatest video and audio experience combining
state-of-the-art media-specific features with high-performance
processing while optimized for lowest power consumption.

i.MX8MQ, i.MX8MM, i.MX8MN, even the furture i.MX8MP are all
belong to this family. A GPC module is used to manage all the
PU power domain on/off. But the situation is that the number of
power domains & the power up sequence has significate difference
on those SoCs. Even on the same SoC. The power up sequence still
has big difference. It makes us hard to reuse the GPCv2 driver to
cover the whole i.MX8M family. Each time a new SoC is supported in
the mainline kernel, we need to modify the GPCv2 driver to support
it. We need to add or modify hundred lines of code in worst case.
It is a bad practice for the driver maintainability.

This driver add a more generic power domain driver that the actual
power on/off is done by TF-A code. the abstraction give us the
possibility that using one driver to cover the whole i.MX8M family
in kernel side.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:29:40 +08:00
9b782c50ca MLK-22404-01 dt-bindings: power: Add power domain binding for i.mx8m family
Add the binding doc of power domain for i.MX8M SOC family.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:29:39 +08:00
94db85b0ea firmware: imx: scu-pd: add dc1 power domains
Add dc1 power domains

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:39 +08:00
5090ffced3 firmware: imx: scu-pd: add lvds power domains
Add lvds power domains

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:38 +08:00
c380248180 firmware: imx: scu-pd: Add IRQSTEER wakeup support
To support different wakeup source, Linux kernel needs to call
SCU firmware to assign different wakeup controllers, for those
SCU resources like RTC alarm, ON/OFF button, MU etc., it should
use SCU wakeup controller, for other peripheral resources like
LPUART, CAN, etc., it should use IRQSTERR wakeup controller.

To support this feasure, all devices supporting wakeup should
add its hwirq number to pd node's wakeup-irq property. Below
is the example of adding LPUART0~3 as wakeup source, SCU PD
driver will determine whether IRQSTEER or SCU should be selected
as wakeup controller, this is done by reading GIC distributor's
register and wakeup-irq array to check whether a wakeup source
is enabled in GIC in order to support wakeup.

pd: imx8qx-pd {
        compatible = "fsl,imx8qm-scu-pd", "fsl,scu-pd";
        #power-domain-cells = <1>;
        wakeup-irq = <345 346 347 348>;
};

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:38 +08:00
1da4c73628 firmware: scu-pd: add pd for CM41 SS
Add pd for CM41 SS on imx8QM.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:29:38 +08:00
82f326dbbe PM / Domains: remove no governor for states warning
It's possible for a platform to define multi states but without
using a governor.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:37 +08:00
e80c8c6bf4 firmware: imx: scu-pd: add multi states support
add multi states support

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:37 +08:00
85dd28204d PM / Domains: Choose the deepest state to enter if no devices using it
For a domain has no working devices anymore, let's choose the deepest state
to enter to save power. e.g. driver probe failure.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:37 +08:00
f93257d4e4 PM / Domains: Support enter deepest state for multiple states domains
Currently the generic power domain will power off the domain if all
devices in it have been stopped during system suspend.

It is done by checking if the domain is active in genpd_sync_power_off,
then disable it. However, for power domains supporting multiple low power
states, it may have already entered an intermediate low power state by
runtime PM before system suspend and the status is already
GPD_STATE_POWER_OFF which results in then the power domain stay at an
intermediate low power state during system suspend.
Then genpd_sync_power_off will keep it at the low power state instead
of completely gate off it.

Let's give the power domain a chance to switch to the deepest state in
case it's already off but in an intermediate low power state.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:36 +08:00
070d55393a PM / Domains: Move the Subdomain check into _genpd_power_off
Move the Subdomain check into _genpd_power_off, then the caller does
not have to check it each time. This also ensures a double check
of &genpd->sd_count before really power off domain in case it's
increased asychronously by subdomains. This is the same behavior
as the original genpd_power_off() does.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:36 +08:00
8102eb7211 PM / Domains: Remove the unnecessary ->power_off() check in genpd_power_off
There's already a check in _genpd_power_off, so caller can directly call it
without checking.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:35 +08:00
c2e74728f9 firmware: imx: scu-pd: do not power off console if no_console_suspend
Do not power off console if no_console_suspend

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:35 +08:00
819cd1e261 firmware: imx: scu-pd: do not power off console domain
Do not power off console domain in runtime pm.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:35 +08:00
dced470837 firmware: imx: scu-pd: add dc video pd
add dc video pd

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:34 +08:00
b932c67cf7 cpufreq: imx6: Add the busfreq request/release on imx6ul/ull/sll
Add the busfreq support on i.MX6ULL/SLL. add the dc regulator
support at the same time.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:29:33 +08:00
f17252c510 char: imx_amp: add sema4 driver support
Add i.MX SEMA4 driver support for AMP SoC such as i.MX6SX.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:33 +08:00
a9e5893d31 cpufreq: imx6q: keep PLL1 enabled from bypassed clock when NOT used
For some i.MX platforms such as i.MX6SX, PLL1 is used as temporary
clock during low power idle mode enter/exit, it MUST be enabled, but
can be switch to its default bypass clock source OSC. This patch
adds support for such scenario, when PLL1 is NOT used, bypass it and
keep it enabled.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:33 +08:00
48396c917a soc: imx: gpc: export PU power control API for suspend/resume
Export PU power ON/OFF APIs for suspend/resume usage, some i.MX
platforms need to control PU power status during suspend/resume.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:32 +08:00
c48b927421 cpufreq: imx6q: add bus-freq request/release support
Add bus-freq request for high cpu-freq set-point and release
the request when cpu is running at lowest set-point.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:32 +08:00
0828343304 firmware: imx: scu-pd: add mipi lvds1 power domains
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:31 +08:00
58a92295d5 imx: scu-pd: add audio power domains
add audio power domains

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:29:31 +08:00
767da37e89 firmware: imx: scu-pd: add power domain for edma2
Add power domain for edma2.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:29:31 +08:00
9fdcde38bd firmware: imx: scu-pd: add SCU power domain for image subsystem
Add SCU power domains for image subsystem. The subsystem include
ISI, CSI, PARALLEL, I2C, PWM and DPLL modules

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:29:30 +08:00
5767ff0586 firmware: imx: scu-pd: add power domian for i2c and intmux in cm40
Add power domian for i2c and intmux which are in cm40 subsystem.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:29:30 +08:00
81713457b9 firmware: imx: scu-pd: add VPU MU powe domains
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:29:29 +08:00
fad6183864 drivers: base: move devices pm to tail when driver bound
Only moving device pm to tail for defer probe is not enough because
the device driver may be probed out of order without defer probe
due to different driver init levels.

Let's move the device pm to tail in the driver bound to ensure
the device pm sequence is exactly the same as its probe sequence.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:29 +08:00
7b67af6ed9 PM: wakeup: Add routine to help fetch wakeup source object.
Some user might want to go through all registered wakeup sources
and doing things accordingly. For example, SoC PM driver might need to
do HW programming to prevent powering down specific IP which wakeup
source depending on. So add this API to help walk through all registered
wakeup source objects on that list and return them one by one.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Tested-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:27 +08:00
890d871063 misc: pci_endpoint_test: Add the layerscape PCIe GEN4 EP device support
Add the layerscape PCIE GEN4 EP device support in pci_endpoint_test driver.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:26 +08:00
89b832cd81 PCI: mobiveil: Add workaround for unsupported request error
Errata: unsupported request error on inbound posted write
transaction, PCIe controller reports advisory error instead
of uncorrectable error message to RC.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:25 +08:00
04f8a74d2a PCI: mobiveil: Add PCIe Gen4 EP driver for NXP Layerscape SoCs
This PCIe controller is based on the Mobiveil GPEX IP, it work in EP
mode if select this config opteration.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
[Zhiqiang: Correct the Copyright]
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:25 +08:00
924bfdb0f7 dt-bindings: Add DT binding for PCIE GEN4 EP of the layerscape
Add the documentation for the Device Tree binding of the layerscape
PCIe GEN4 controller with EP mode.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:25 +08:00
e01168ca8b PCI: mobiveil: Add the EP driver support
Add the EP driver support for Mobiveil base on endpoint framework.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
[Zhiqiang: Correct the Copyright]
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:24 +08:00
6d5b9d4c66 PCI: ls_gen4: WA for SERROR
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:23 +08:00
7e3a04890a PCI: mobiveil: ls_pcie_g4: add Workaround for A-011451
When LX2 PCIe controller is sending multiple split completions and
ACK latency expires indicating that ACK should be send at priority.
But because of large number of split completions and FC update DLLP,
the controller does not give priority to ACK transmission. This
results into ACK latency timer timeout error at the link partner and
the pending TLPs are replayed by the link partner again.

Workaround:
1. Reduce the ACK latency timeout value to a very small value.
2. Restrict the number of completions from the LX2 PCIe controller
   to 1, by changing the Max Read Request Size (MRRS) of link partner
   to the same value as Max Packet size (MPS).

This patch implemented part 1, the part 2 can be set by kernel parameter
'pci=pcie_bus_perf'

This ERRATA is only for LX2160A Rev1.0, and it will be fixed
in Rev2.0.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:23 +08:00
efca0d2a58 PCI: mobiveil: ls_pcie_g4: add Workaround for A-011577
PCIe configuration access to non-existent function triggered
SERROR interrupt exception.

Workaround:
Disable error reporting on AXI bus during the Vendor ID read
transactions in enumeration.

This ERRATA is only for LX2160A Rev1.0, and it will be fixed
in Rev2.0.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:23 +08:00
24e0514f88 PCI: mobiveil: Add PCIe Gen4 RC driver for NXP Layerscape SoCs
This PCIe controller is based on the Mobiveil GPEX IP, which is
compatible with the PCI Express™ Base Specification, Revision 4.0.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
2019-11-25 16:29:22 +08:00
73c5cc9d93 PCI: mobiveil: Add 8-bit and 16-bit CSR register accessors
There are some 8-bit and 16-bit registers in PCIe configuration
space, so add these accessors accordingly.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
Reviewed-by: Subrahmanya Lingappa <l.subrahmanya@mobiveil.co.in>
2019-11-25 16:29:22 +08:00
7e84ffc988 dt-bindings: PCI: Add NXP Layerscape SoCs PCIe Gen4 controller
Add PCIe Gen4 controller DT bindings of NXP Layerscape SoCs.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2019-11-25 16:29:22 +08:00
9a9fe7dbd9 PCI: mobiveil: Make mobiveil_host_init() can be used to re-init host
Make the mobiveil_host_init() function can be used to re-init
host controller's PAB and GPEX CSR register block, as NXP
integrated Mobiveil IP has to reset and then re-init the PAB
and GPEX CSR registers upon hot-reset.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Subrahmanya Lingappa <l.subrahmanya@mobiveil.co.in>
2019-11-25 16:29:21 +08:00
f619c54210 PCI: mobiveil: Refactor Mobiveil PCIe Host Bridge IP driver
Refactor the Mobiveil PCIe Host Bridge IP driver to make
it easier to add support for both RC and EP mode driver.
This patch moved the Mobiveil driver to an new directory
'drivers/pci/controller/mobiveil' and refactor it according
to the RC and EP abstraction.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
Reviewed-by: Subrahmanya Lingappa <l.subrahmanya@mobiveil.co.in>
2019-11-25 16:29:21 +08:00
1a2738da42 pci:add support aer/pme interrupts with none MSI/MSI-X/INTx mode
On some platforms, root port doesn't support MSI/MSI-X/INTx in RC mode.
When chip support the aer/pme interrupts with none MSI/MSI-X/INTx mode,
maybe there is interrupt line for aer pme etc. Search the interrupt
number in the fdt file. Then fixup the dev->irq with it.

Signed-off-by: Po Liu <po.liu@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:20 +08:00
f815250fac MLK-22995: pci: controller: dwc: pci-imx6: fix regulator warning complains on i.mx6sx-sdb
Commit 5eaa8f6f6dba("PCI: imx: enable the epdev_on regulator after
possible -EPROBE_DEFER") still not enough on i.mx6sx-sdb:

[    1.168638] imx6q-pcie 8ffc000.pcie: 8ffc000.pcie supply epdev_on not found, using dummy regulator
[    1.173250] ------------[ cut here ]------------
[    1.173387] WARNING: CPU: 0 PID: 7 at drivers/regulator/core.c:2042 _regulator_put.part.8+0x1a4/0x1c8
[    1.173409] Modules linked in:
[    1.173439] CPU: 0 PID: 7 Comm: kworker/u2:0 Not tainted 5.4.0-rc7-03212-ga83f2b7 #55
[    1.173457] Hardware name: Freescale i.MX6 SoloX (Device Tree)
[    1.173488] Workqueue: events_unbound async_run_entry_fn
[    1.173527] [<c0112b60>] (unwind_backtrace) from [<c010cccc>] (show_stack+0x10/0x14)
[    1.173555] [<c010cccc>] (show_stack) from [<c0d63420>] (dump_stack+0xe0/0x114)
[    1.173581] [<c0d63420>] (dump_stack) from [<c0137188>] (__warn+0xe4/0x10c)
[    1.173604] [<c0137188>] (__warn) from [<c0137254>] (warn_slowpath_fmt+0xa4/0xb4)
[    1.173630] [<c0137254>] (warn_slowpath_fmt) from [<c05fdb74>] (_regulator_put.part.8+0x1a4/0x1c8)
[    1.173658] [<c05fdb74>] (_regulator_put.part.8) from [<c05fdbc4>] (regulator_put+0x2c/0x3c)
[    1.173684] [<c05fdbc4>] (regulator_put) from [<c06f9fac>] (release_nodes+0x168/0x1f4)
[    1.173713] [<c06f9fac>] (release_nodes) from [<c06f598c>] (really_probe+0x118/0x350)
[    1.173739] [<c06f598c>] (really_probe) from [<c06f5d40>] (driver_probe_device+0x5c/0x164)
[    1.173763] [<c06f5d40>] (driver_probe_device) from [<c06f5e98>] (__driver_attach_async_helper+0x50/0x54)
[    1.173791] [<c06f5e98>] (__driver_attach_async_helper) from [<c0162030>] (async_run_entry_fn+0x3c/0x104)
[    1.173820] [<c0162030>] (async_run_entry_fn) from [<c0157b64>] (process_one_work+0x2c4/0x75c)
[    1.173844] [<c0157b64>] (process_one_work) from [<c0158030>] (worker_thread+0x34/0x574)
[    1.173868] [<c0158030>] (worker_thread) from [<c015f730>] (kthread+0x10c/0x148)
[    1.173891] [<c015f730>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20)
[    1.173909] Exception stack(0xd80d7fb0 to 0xd80d7ff8)
[    1.173929] 7fa0:                                     00000000 00000000 00000000 00000000
[    1.173949] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.173969] 7fe0: 00000000 00000000 00000000 00000000 00000013 0000000

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:18 +08:00
198642d250 PCI: dwc: fix the msi failure after pm operations
The controller may be powered off (Link is in L3) during the suspend
mode. The MSI_ADDR would be missed after resume and MSI function
would be failed.
Re-store MSI_ADDR to fix the MSI failure after PM operations.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:18 +08:00
36ef451ed2 Revert "MLK-11484-3 PCI: designware: Refine setup_rc and add msi data restore"
This patch is not proper for 5.4 kernel, revert it by this commit.
This reverts commit 8b76ca7ff3f7bb26223e5aa111d3bef987e62a4e.

Signed-off-by: richard zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:29:18 +08:00
c4ba500595 PCI: imx: enable the epdev_on regulator after possible -EPROBE_DEFER
Enable the epdev_on regulator after possible -EPROBE_DEFER.
Otherwise, there would kernel WARNING dump if there is -EPROBE_DEFER
later during boot procedure.

[    1.335146] WARNING: CPU: 1 PID: 7 at drivers/regulator/core.c:2042 _regulator_put.part.27+0x140/0x148
[    1.344423] Modules linked in:
[    1.347470] CPU: 1 PID: 7 Comm: kworker/u4:0 Not tainted 5.4.0-rc5-02973-ged0629621d25 #15
[    1.355716] Hardware name: Freescale i.MX8DXL Phantom MEK (DT)
[    1.361547] Workqueue: events_unbound async_run_entry_fn
[    1.366838] pstate: 80000005 (Nzcv daif -PAN -UAO)
[    1.368962] Bus freq driver module loaded
[    1.371620] pc : _regulator_put.part.27+0x140/0x148
[    1.371628] lr : regulator_put+0x34/0x48
[    1.384384] sp : ffff80001005bc20
[    1.387685] x29: ffff80001005bc20 x28: 0000000000000000
[    1.391866] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    1.392986] x27: 0000000000000000 x26: ffff8000100fddf0
[    1.392992] x25: 0000000000000000 x24: 0000000000000007
[    1.392997] x23: ffff80001005bcd8 x22: ffff000029844600

Signed-off-by: richard zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:29:17 +08:00
764a31f318 MLK-15141-1: PCI: imx: Add epdev_on regulator for 8QM WiFi
Add the epdev_on regulator to power up the WiFi module
on the iMX8QM board.
This regulator needs to be powered up before the pcie
link, in order for the WiFi module to work.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Tiberiu Breana <andrei-tiberiu.breana@nxp.com>

rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:29:17 +08:00
d95659f2bb PCI: imx: do power reset for EP device
Since "dis_gpio" GPIO pin is used as M.2 KeyE interface PIN56
for power control of EP device, it should do reset for EP device
for partition reset case.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:29:16 +08:00
6e1d933a7c MLK-11484-3 PCI: designware: Refine setup_rc and add msi data restore
- move "program correct class for RC" from dw_pcie_host_init()
to dw_pcie_setup_rc(). since this is RC setup, it's
better to contained in dw_pcie_setup_rc function.
Then, RC can be re-setup really by dw_pcie_setup_rc().
- add one store/re-store msi cfg functions. Because that
pcie controller maybe powered off during system suspend,
and the msi data configuration would be lost.
these functions can be used to store/restore the msi data
and msi_enable during the suspend/resume callback.

Signed-off-by: Richard Zhu <richard.zhu@freescale.com>
Vipul: rebased on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:29:16 +08:00
f0ee6f2061 PCI: dwc: Use interrupt disabling instead of masking
commit 830920e065e9("PCI: dwc: Use interrupt masking instead
of disabling") break i.MX platform PCIe suspend/resume when
MSI enabled.

Revert the commit to keep orinigal method that using interrupt
disabling instead of masking.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:29:15 +08:00
1c5214143e PCI: layerscape: Add LS1028a support
Add support for the LS1028a PCIe controller.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:15 +08:00
de06f34e8b dt-bindings: pci: layerscape-pci: add compatible strings "fsl, ls1028a-pcie"
Add the PCIe compatible string for LS1028A

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2019-11-25 16:29:14 +08:00
580ae8fbf5 PCI: imx: enable imx6qp pcie pm support
Enable the iMX6QP PCIe PM operations support.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:14 +08:00
20ec83d318 PCI: imx: enable imx8 pcie pm support
Enable iMX8 PCIe PM operations support.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:13 +08:00
260d030cfc PCI: imx: add the l1ss feature on imx8m platforms
Add the L1.1SS feature on iMX8M platforms.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:13 +08:00
f209864791 dt-bindings: imx6q-pcie: Add pcie support for imx8mm
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:13 +08:00
46a288f17b PCI: imx: enable imx8mm pcie support
Enable iMX8MM PCIe support.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:12 +08:00
b71e692290 PCI: imx: set up the hsio regmap itself
Setup PCI its own HSIO regmap to fix the kernel dump, when the HSIO
regmap is set as system syscon.
/sys/kernel/debug/regmap# cat dummy-hsio@5f080000/register

NOTE: devm_ioremap is used to get the virtual address, because that the
devm_ioremap_resource would return -EBUSY when there is a resource
overlap between different HSIO consumers.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:12 +08:00
fefb65ce41 PCI: imx: msi enable bit of rc should be set in resume
The MSI Enable bit controls delivery of MSI interrupts from components
below the Root Port.
This bit would be lost during the suspend, should be re-configured
during resume.
Remove one line redundant debug code.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:10 +08:00
8c2ab4d757 pci: imx: fix build failure due to 5.1 RC7 upgrade
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:09 +08:00
e76f906f97 PCI: imx: enable imx8qm/qxp pcie support
Enable the imx8qm/qxp pcie support.
Verified on the imx8qxp mek board.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:09 +08:00
efa6fd8e6d PCI: imx: set the according disable signal
Set the according disable signal to high when enable the pcie port if
there is the disable signal in the hardware design.(e.x the second
port of imx8mq evk board).

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:29:08 +08:00
9c86847fad PCI: Disable MSI on marvel 88w9098 and 88w8997 chips
i.MX8x with MSI enable suspend/resume doesn't work for
marvell 88w9098 and 88w8997 wlan chips, disable the feature
before the issue fixed.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:29:07 +08:00
d0540388b1 MLK-20716 PCI: add quirk for cyw4356 to disable D3 mode
Add quirk for cyw4356 to disable D3 mode because current firmware
still doesn't support D3 mode.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Shrikant Bobade <Shrikant_Bobade@mentor.com>
(cherry picked from commit 22212c60d7fb067e28a2fed16914515e3d6d3950)
2019-11-25 16:29:06 +08:00
7efa841a61 MLK-20684 PCI: Disable MSI on CYW4356 and CYW4359 chips
MSI is broken on CYW4356/4359 chips. This causes CYW4356 1CX not
work on i.MX8x platforms with bandwidth test. It is known issue
that i.MX8x PCIe host driver MSI interrupt lost.

Disable MSI completely for this chipset to let wifi can stable work
until PCIe RC driver fix the issue.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit d99766187f)
2019-11-25 16:29:06 +08:00
958dafe933 pci:add support aer/pme interrupts with none MSI/MSI-X/INTx mode
On some platforms, root port doesn't support MSI/MSI-X/INTx in RC mode.
When chip support the aer/pme interrupts with none MSI/MSI-X/INTx mode,
maybe there is interrupt line for aer pme etc. Search the interrupt
number in the fdt file. Then fixup the dev->irq with it.

Signed-off-by: Po Liu <po.liu@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:29:06 +08:00
ec8d984325 MLK-22977 input: imx_sc_pwrkey: Correct message format to avoid stack corruption
The SCU message data field received from SCU side is 32 bit width,
while the message defined in imx_sc_pwrkey driver is 8 bit width,
it will cause stack corruption when SCU writes the response data,
with CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG enabled, kernel stack
protection will have panic. Correct the data field width to 32 bit
to avoid this issue.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:29:04 +08:00
d0a7bcfc04 input: keyboard: imx_sc: Correct SCFW API parameter to fix NULL pointer crash
The SCU FW API of getting button status actually needs response
data, but SCU FW API does NOT have return value for this API, so
we should call this API with response but skip return value check
to avoid below NULL pointer crash, since the msg stored in stack
could be released when mailbox receives the response data and NULL
pointer dump will occur as below:

Event: time 1564685464.345502, type 1 (EV_KEY), code 116 (KEY_POWER), value 1
Event: time 1564685464.345502, -------------- SYN_REPORT ------------
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
Mem abort info:
  ESR = 0x96000006
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x00000006
  CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=00000008b75c6000
[0000000000000008] pgd=00000008b7611003, pud=00000008b77f4003, pmd=0000000000000000
Internal error: Oops: 96000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 112 Comm: kworker/0:5 Not tainted 5.3.0-rc3-next-20190809-01769-g17e0d18 #200
Hardware name: Freescale i.MX8QXP MEK (DT)
Workqueue:  0x0 (events)
pstate: 60000085 (nZCv daIf -PAN -UAO)
pc : process_one_work+0x3c/0x2b4
lr : worker_thread+0x134/0x3e4
sp : ffff00001216bdb0
x29: ffff00001216bdb0 x28: ffff00001005bcd8
x27: ffff80083b03e8b8 x26: ffff000011a204b0
x25: ffff80083b58c4c0 x24: ffff000011a07000
x23: 0000000112010201 x22: ffff80083cbaf840
x21: 0000000000000000 x20: ffff80083b043220
x19: ffff80083b043200 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000
x15: 0000000000000000 x14: 0000000000000000
x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: 00000000000009a0
x9 : ffff00001216bd50 x8 : 0000000000000018
x7 : 0000000000000001 x6 : ffff80083cbaf860
x5 : ffff80083cbaf860 x4 : ffff80083cbaf858
x3 : ffff80083cbaf858 x2 : ffff80083b043228
x1 : ffff80083b043220 x0 : 0000000000000000
Call trace:
 process_one_work+0x3c/0x2b4
 worker_thread+0x134/0x3e4
 kthread+0xf8/0x124
 ret_from_fork+0x10/0x18
Code: 9278deb5 eb1f001f 9a9f12b5 b94012c0 (f94006a1)
---[ end trace 9374afe12d7955b1 ]---

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:29:04 +08:00
dddcaeb960 input: keyboard: imx_sc_pwrkey: add PWRON key driver
Add PWRON key driver which is based on scfw.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:29:03 +08:00
127f1fb1f2 input: keyboard: rpmsg-keys: add rpmsg-keys driver
Add rpmsg-keys driver for i.mx7ulp.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:29:02 +08:00
d7ed12c616 MLK-19751 input: synaptics_dsx: free touch irq when touch suspend
On the imx8 MIPI DSI oled board, MIPI panel and touch share one RST
pin. when suspend the whole system, touch will suspend first, it
disable touch irq, and let touch work in sleep mode. Then MIPI panel
suspend, it will give a reset signal on the RST pin. Due to this reset
signal, touch will trigger two interrupt on GPIO1_9. Because touch
suspend code already disable touch irq, so these two new touch interrupt
will be pending there, and pending there in GPIO forever.

When system resume, GPIO will restore registers in runtime resume before
synaptics_dsx_i2c touch driver resume, so the GPIO1_9 IRQ will be unmasked
and since its IRQ is pending there so IRQ keeps coming without touch
driver to handle it, since it is NOT resume yet, make the system can't
resueme back normally.

Due to this is the hardware limitation which cause this issue, I format this
patch to workaround this issue.
This patch free touch irq in the touch driver suspend procedure, rather than
just disable the touch irq.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
(cherry picked from commit a157605b47e2c3800d706b3ca0af24e26c92c187)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:29:01 +08:00
693d3f267c MLK-18816-2 input/touch: do not clear touch interrupt when enable irq
On imx8mscale-evk baord, if I2C bus is configed pull-up, then once send
the i2c command to clear touch interrupt during the touch initialization,
touch will keep SDA line in low level, block the i2c bus. If config the
I2C bus pull-down, then this issue gone. Due to it is not reasonable to
set the I2c bus to pull-down for other i2c slave device, this patch work
as a workaround, just remove this i2c command, do not clear the touch
interrupt, test that touch can also work well after the initialization.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:29:01 +08:00
1ab24993c6 MLK-17829 touchscreen: Add synaptics_dsx S3508 i2c touch driver
Add S3508 touch driver support.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:29:00 +08:00
b5805df1b1 MLK-14392-1 input: touch: add focaltech touch screen support
add focaltech touch screen support

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
2019-11-25 16:29:00 +08:00
9b51542a1c MLK-18636 Input: egalax_ts: Restore call to i2c_set_clientdata
Upstream dropped the call to i2c_set_client_data as "unneeded" in commit
8300445cc7 ("Input: touchscreen - drop calls to platform_set_drvdata and i2c_set_clientdata")

The client_data pointer is used on suspend/resume by downstream commit
76a621ae711b ("MLK-17779 input: egalax_ts: free irq resource before request the line as GPIO")

This causes suspend/resume to crash (and apparently hang) on
imx6qdl-sabresd with LVDS display connected. Fix by adding back the
i2c_set_clientdata call.

Fixes: 76a621ae711b ("MLK-17779 input: egalax_ts: free irq resource before request the line as GPIO")

This could be squashed into MLK-17779

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:29:00 +08:00
e7aca899a5 MLK-17779 input: egalax_ts: free irq resource before request the line as GPIO
If GPIO is connected to an IRQ then it should not request it as
GPIO function only when free its IRQ resource.

Tested-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:28:59 +08:00
30931ccb0f MLK-15950 input: egalax_ts: switch to i2c interface before wake up
For HannStar (HSD100PXN1 Rev: 1-A00C11 F/W:0634) LVDS touch screen,
it has a special request for the EETI touch controller. The host
needs to trigger I2C event to device FW at booting first, and then
the FW can switch to I2C interface. Otherwise, the FW can’t  work
with I2C interface, and can't generate any interrupt when touch
the screen.

This patch send an I2C command before the device wake up, make sure
the device switch to I2C interface first.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Andy Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:28:59 +08:00
3785cf3fde MLK-13244 input: touchscreen: add support for vtl touchscreen
Add the support for a CT36X based touchscreens using
the CT36X controller and i2c touchscreen interface.

Signed-off-by: Alejandro Lozano <alejandro.lozano@nxp.com>
Signed-off-by: Juan Gutierrez <juan.gutierrez@nxp.com>
Signed-off-by: Alejandro Sierra <alejandro.sierra@nxp.com>
(Vipul: Fixed merge conflicts)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:28:59 +08:00
5f365614c4 MLK-14801 input: touch: ads7846: fix the pressure_max setting
For the touch pressure_max, if dts has no property "ti,pressure-max"
or this property is config to value 0, then default use 65535 as
the max pressure value. otherwise, in the latest xwayland rootfs,
will meet the following issue:

[21:44:34.302] input device 'ADS7846 Touchscreen', /dev/input/event3 is tagged by udev as: Touchscreen
[21:44:34.302] kernel bug: Device 'ADS7846 Touchscreen' has min == max on ABS_PRESSURE
[21:44:34.302] input device 'ADS7846 Touchscreen', /dev/input/event3 was rejected.
[21:44:34.302] failed to create input device '/dev/input/event3'

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
(cherry picked from commit 0bb15e676cb74739291c9054411a28cad4e36f34)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:28:57 +08:00
a961d6b291 Input: ads7846: add return value check after calling .of_property_read_u32()
Add return value check after calling .of_property_read_u32().
The issue was reported by coverity.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:28:57 +08:00
b96148101f MLK-10142-1 touchscreen: elan: add elan touch screen driver support
Add elan touch screen driver in linux kernel.

Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
(cherry picked from commit 20180719c5)
(Vipul: Fixed merge conflicts)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:28:57 +08:00
901b3581cd MLK-11703-1: input: touchscreen: max11801_ts: Add DCM mode for max11801 ADC
We need add DCM mode/AUX mode for ADC converter function of max11801, so
that it can be used to read voltage of battery. Meanwhile, let the driver
based on device tree. The patchset is based on below patch (V3.5.7):

commit 4001774cf51f0140ae7e4e8e0ec1d86475790682
Author: Rong Dian <b38775@freescale.com>
Date:   Fri Jan 18 14:24:28 2013 +0800

    Engr00240284-1 MAX11801: Add DCM aux adc sample function

        1.Add direct conversion mode operations
	2.Add aux adc sample function

Signed-off-by: Robin Gong <b38343@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 16:28:56 +08:00
fba4afe476 clk: s32v234: Initial enet clk support
Add ethernet clocks and dependencies (sys_pll, arm_pll)

Based on ALB v4.19.31_bsp23.0_rc2

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:28:55 +08:00
318d69432b clk: s32v234: Add dfs clk
Port from ALB v4.19.31_bsp23.0_rc2

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:28:54 +08:00
6cbe7edb1a clk: Enable SDHC clock for S32V234
Enable the clocks needed for uSDHC support on Treerunner.

Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Larisa Grigore <Larisa.Grigore@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 16:28:54 +08:00
491a5c07c5 clk: Enable UART clock for S32V234
Enable the clocks needed for LINFlexD UART support on Treerunner and make
use of them in the LINFlexD driver.

Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Adrian.Nitu <adrian.nitu@freescale.com>
Signed-off-by: Larisa Grigore <Larisa.Grigore@nxp.com>
Signed-off-by: Iustin Dumitrescu <Iustin.Dumitrescu@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:28:53 +08:00
457bcf4d5d clk: Add clk support for S32V234
Add clock framework for Treerunner (S32V234), based on code from the i.MX
3.10.17 codebase[1]. Add clock definitions that are used in the clocks
vector (tree). At this point, the only PLL enabled is PERIPH-PLL.

[1] https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_3.10.17_1.0.0_ga_caf

Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Larisa Grigore <Larisa.Grigore@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 16:28:53 +08:00
46fe72556e dt-bindings: clock: Document S32V234 MC_CGM and MC_ME
Add DT bindings documentation for the upcoming S32V234 clk driver. Add
s32v234-clock.h header, which is referred in MC_CGM documentation.

Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 16:28:53 +08:00
699690ba51 arm64: Introduce config for S32
Add configuration option for the NXP S32 platform family in
Kconfig.platforms. For starters, the only SoC supported will be Treerunner
(S32V234), with a single execution target: the S32V234-EVB (rev 29288)
board.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
(cherry picked from commit 3d4e0158c1)
2019-11-25 16:28:53 +08:00
361d678bcb LF-108 clk: imx: clk-imx7ulp: Add missing sentinel of ulp_div_table
There should be a sentinel of ulp_div_table, otherwise _get_table_div
may access data out of the array.

Fixes: b1260067ac ("clk: imx: add imx7ulp clk driver")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 16:28:49 +08:00
bc85a350de clk: imx8qxp: acm: Support suspend and resume
Save the acm registers when suspend, then restore
them when resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:28:49 +08:00
293fb267d9 clk: imx8qm: acm: Support suspend and resume
Save the acm registers when suspend, then restore
them when resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:28:48 +08:00
44ad0c94fd clk: imx: Add m4 enable check for imx8mn
Check if M4 is enabled to make sure the root
clocks used by M4 are on by default.

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:28:48 +08:00
53f2c5daa3 clk: imx: scu: add parent save and restore
Add clock parent save and restore.

Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:48 +08:00
4872753779 MLK-22936 clk: imx: Only save DC SS clock using non-cached clock rate
Display sub-system has special clock settings in SCFW, the
bypassed clock is used instead of PLL in Linux kernel clock
tree, so when saving clock rate, need to save non-cached clock
rate for Display sub-system's bypass clocks, and other clocks
still use the cached clock rate which is with runtime PM ON.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Tested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:28:47 +08:00
bae5f64837 clk: imx: Skip HDMI LPCG clock save/restore
On i.MX8QM, HDMI LPCG clocks operation needs SCU clock "hdmi_ipg_clk"
to be ON, while during noirq suspend phase, "hdmi_ipg_clk" is disabled
by HDMI IRQ STEER driver, so SError will be triggered.

Skip all HDMI LPCG clocks save/restore to avoid this SError during
system suspend/resume, it will NOT introduce additional power consumption
as their parent clock is disabled when suspend.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:28:47 +08:00
32caf053fc clk: imx8mm: Change the 'nand_usdhc_bus' clock to non-critical one
The 'nand_usdhc_bus' clock is only need to be enabled when usdhc
or nand module is active, so change it to non-critical clock type.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:28:46 +08:00
333db80efd clk: imx: Add A72 cluster cpufreq support
Add A72 clock to support cpufreq on A72 cluster, and adding
cpufreq governor switch for i.MX8QM which has 2 clusters,
in the late phase of kernel boot up, cpufreq governor will
be switched to shedutil which is much more suitable for
multi-clusters SoCs.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:28:46 +08:00
754fce578f clk: imx8mm/mn/mq: add imx_clk_init_on
When we need to support dual linux with jailhouse, there is no clock
controller in 2nd inmate linux cell, it relys on the first linux to
configure the clock ready and on. So we add those clocks required for
the 2nd linux in dts to make them prepare enabled, and pass
clk_ignore_unused to the 1st linux, then the 1st linux will not gated
off the clocks. So the 2nd linux could use IPs without touching clocks.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 16:28:45 +08:00
ccc947478e clock: imx8mq: change csi's parent clock to get desired value
change csi's parent clock to get desired value

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:28:45 +08:00
d455041615 clk: imx8qm-clk: add clk for emvsim
Add clk for emvsim device on imx8qm mek.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:28:44 +08:00
d4606a5f01 clk: imx8mm: adjust csi's parent clock to get desired value
adjust csi's parent clock to get desired value

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:28:44 +08:00
198c604320 clk: imx8mn: Set AUDIO_AHB and IPG_AUDIO_ROOT to 400MHz
Set AUDIO_AHB and IPG_AUDIO_ROOT to 400MHz

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:28:44 +08:00
72a7e2e711 clk: imx: unbypass all the plls by default on imx8mq
Unbypass all the PLLs by default on i.MX8MQ.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:28:44 +08:00
6f7bd4b2f9 clk: imx8mq: add 27MHz PHY ref clock
This clock is a high precision clock on imx8mq-evk board that will be used by
HDMI phy.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:28:43 +08:00
b44fb3a382 clk: imx8mq: Add VIDEO2_PLL clock
This clock is needed by DCSS when high resolutions are used.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:28:43 +08:00
f84e37af2c clk: imx6sl: configure epdc clock to get desired value
configure epdc clock to get desired value

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:28:43 +08:00
6dd9caaf69 clk: imx: add clk for gpu_core1/gpu_shader1
add clk for gpu_core1/gpu_shader1

Signed-off-by: Minjie Zhuang <minjie.zhuang@nxp.com>
2019-11-25 16:28:42 +08:00
53a2ef2638 MLK-22086 clk: imx: Keep the root clock gate always enabled for m4
If the M4/M7 core is enabled, just skip registering the gate ops
to make sure the ROOT clock is always enabled for M core to simplify
the clock management due to the lack of domain control for the root
clock slice gate.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
(cherry picked from commit 0853b1d611)

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:28:42 +08:00
349a6af888 clk: imx: update the audio pll rate table on imx8mm
Audio PLL is a frac pll, the config for this PLL should follow
below limitation:
    Fout = ((m + k / 65536) * FIN) / (p * 2^s),
    Fvco = ((m + k / 65536) * FIN) / p
    Fref = FIN / p

    a). 6MHz <= Fref <= 25MHz;
    b). 1 <= p <= 63;
    c). 64 <= m <= 1023;
    d). 0 <= s <= 6;
    e). -32768 <= k <= 32767;

due to the frac part calculation deviation, frac pll 'recalc_rate'
is updated to look up the pll rate from table first.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:28:42 +08:00
754ae82cc5 clk: imx: enable the earlycon uart clocks by parsing from dt
Remove the earlycon uart clocks that are hard cord in platforms
clock driver, instead of parsing the earlycon uart port from dt
and enable these clocks from clock property in dt node.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:28:41 +08:00
24d9251ca5 clk: imx6sll: configure epdc clock to get desired value
configure epdc clock to get desired value

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:28:40 +08:00
3ff06a6624 clk: imx8qm: add audio acm clocks
add audio acm clocks

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:28:40 +08:00
e72f2ac0f3 clk: imx6q: Forward some IPUv3 and LDB clock changes from imx_4.19.y kernel
This patch forwards some IPUv3 and LDB clock changes from imx_4.19.y kernel,
as needed to enable internal IPUv3 fb and LVDS displays.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:28:39 +08:00
17f458d0a4 clk: imx7ulp: remove IMX7ULP_CLK_MIPI_PLL clock
The mipi pll clock comes from the MIPI PHY PLL output, so
it should not be a fixed clock.

MIPI PHY PLL is in the MIPI DSI space, and it is used as
the bit clock for transfering the pixel data out and its
output clock is configured according to the display mode.

So it should be used only for MIPI DSI and not be exported
out for other usages.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:28:39 +08:00
e9c584db53 clk: imx: scu: add hdmi tx clock support
add hdmi tx clock support which exists on MX8QM.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:28:38 +08:00
a6f73ca594 clk: imx7d: set PLL_SYS_MAIN as parent clock of epdc pixel clock
set PLL_SYS_MAIN as EPDC pixel_clock's parent clock to get desired clock

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:28:38 +08:00
85812d2eb7 clk: imx7d: add pxp ipg clock and axi clock
add pxp ipg/axi clock on imx7d

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:28:37 +08:00
e7ad6f029a clk: imx: scu: add CLK_SET_PARENT_NOCACHE
SCU clock state may be changed transparently to users due to PD state
changes. We need use CLK_SET_PARENT_NOCACHE to ensure the parent setting
can be programed into HW in case an invalid parent cache.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:36 +08:00
07a9d89f79 MLK-21052-08 clk: imx: Add CLK_SET_PARENT_NOCACHE
Implement a CLK_SET_PARENT_NOCACHE flag in clk core for imx8 clk
implementation where the parent needs to be restore after PM domain is
up.

Reviewed-by: Anson Huang <anson.huang@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
(cherry picked from commit 87e997822c)
[Leonard: split clk core part]
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:28:36 +08:00
c200286b3d clk: imx: imx8mm: set the parent clks of pcie
Set the parent clocks of PCIe.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:28:36 +08:00
839fc3028a clk: imx: scu: add uart4 clock support
add uart4 clock support which exists on MX8QM.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:36 +08:00
b7a740727b clk: imx8qxp: Remove gpt0_clk to avoid warning during kernel boot up
The gpt0 is assigned to ATF previously due to LPCG, context
save/restore etc. for cpu-idle feature, remove gpt0_clk to
avoid below warning during kernel boot up, if gpt0 is going
to be used in future, need to remove corresponding operations
in ATF and add it back in kernel.

[    0.291286]  gpt0: failed to power up resource 207 ret -13
[    0.291355] imx-scu-clk: probe of gpt0_clk failed with error -5

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:28:35 +08:00
c7847db9c7 clk: imx: Fix division by zero warning on pfdv2
Fix below division by zero warning:

[    3.176443] Division by zero in kernel.
[    3.181809] CPU: 0 PID: 88 Comm: kworker/0:2 Not tainted 5.3.0-rc2-next-20190730-63758-ge08da51-dirty #124
[    3.191817] Hardware name: Freescale i.MX7ULP (Device Tree)
[    3.197821] Workqueue: events dbs_work_handler
[    3.202849] [<c01127d8>] (unwind_backtrace) from [<c010cd80>] (show_stack+0x10/0x14)
[    3.211058] [<c010cd80>] (show_stack) from [<c0c77e68>] (dump_stack+0xd8/0x110)
[    3.218820] [<c0c77e68>] (dump_stack) from [<c0c753c0>] (Ldiv0_64+0x8/0x18)
[    3.226263] [<c0c753c0>] (Ldiv0_64) from [<c05984b4>] (clk_pfdv2_set_rate+0x54/0xac)
[    3.234487] [<c05984b4>] (clk_pfdv2_set_rate) from [<c059192c>] (clk_change_rate+0x1a4/0x698)
[    3.243468] [<c059192c>] (clk_change_rate) from [<c0591a08>] (clk_change_rate+0x280/0x698)
[    3.252180] [<c0591a08>] (clk_change_rate) from [<c0591fc0>] (clk_core_set_rate_nolock+0x1a0/0x278)
[    3.261679] [<c0591fc0>] (clk_core_set_rate_nolock) from [<c05920c8>] (clk_set_rate+0x30/0x64)
[    3.270743] [<c05920c8>] (clk_set_rate) from [<c089cb88>] (imx7ulp_set_target+0x184/0x2a4)
[    3.279501] [<c089cb88>] (imx7ulp_set_target) from [<c0896358>] (__cpufreq_driver_target+0x188/0x514)
[    3.289196] [<c0896358>] (__cpufreq_driver_target) from [<c0899b0c>] (od_dbs_update+0x130/0x15c)
[    3.298438] [<c0899b0c>] (od_dbs_update) from [<c089a5d0>] (dbs_work_handler+0x2c/0x5c)
[    3.306914] [<c089a5d0>] (dbs_work_handler) from [<c0156858>] (process_one_work+0x2ac/0x704)
[    3.315826] [<c0156858>] (process_one_work) from [<c0156cdc>] (worker_thread+0x2c/0x574)
[    3.324404] [<c0156cdc>] (worker_thread) from [<c015cfe8>] (kthread+0x134/0x148)
[    3.332278] [<c015cfe8>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20)
[    3.339858] Exception stack(0xe82d5fb0 to 0xe82d5ff8)
[    3.345314] 5fa0:                                     00000000 00000000 00000000 00000000
[    3.353926] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    3.362519] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:28:34 +08:00
876a843cf2 clk: imx8qxp: Add i.MX8QM A53 frequency scaling support
Add i.MX8QM cpufreq support for A53 cluster.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:28:33 +08:00
a51cf9621d clk: imx: imx8qxp-acm: change init level to fs_initcall
ACM depends on SCU PD, change its init level later than SCU PD
but to fs_initcall to ensure it's probed before LPCG clocks to
avoid unneccesary massive defer probe.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:33 +08:00
b83ec1eb23 clk: imx: scu: change init level to subsys_initcall_sync
Change scu clk init level to subsys_initcall_sync to ensure it's
probed before most devices to avoid unneccesary defer probe.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:33 +08:00
f9ac716378 clk: imx: scu: add dc parent clocks
Add dc parent clocks

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:33 +08:00
e9e5aadd31 clk: imx: scu: add missing lvds clocks for mx8qm
Add missing lvds clocks for mx8qm

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:32 +08:00
ebeb9785d3 clk: imx: scu: add dc1 scu clocks
Add DC1 scu clocks which is exist on MX8QM.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:32 +08:00
e5e9d60129 clk: imx7ulp: call imx_register_uart_clocks once during clocks reigster
imx_register_uart_clocks() only support once call during platform
clocks register. So use one gobal pcc_uart_clks[] array instead of
two array.

Fixes: 041652514d8b(clk: imx7ulp: Make sure earlycon's clock is enabled)
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:28:31 +08:00
d348b7cf91 clk: imx: correct the earlycon port index check
Correct the earlycon port index check.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:28:31 +08:00
a106965e48 clk: imx8qm: add clock for CAN1/2
Add clock for CAN1/2 on imx8qm.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:28:30 +08:00
79927d64ec clk: imx8qxp: add clock for CM41 SS
Add clock for CM41 SS.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:28:30 +08:00
31b25e5f69 dt-bindings: clock: imx8-lpcg: remove lpcg legacy clock binding support
remove lpcg legacy clock binding support

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:29 +08:00
17bf733e70 dt-bindings: firmware: imx: remove scu legacy clock binding support
remove scu legacy clock binding support

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:29 +08:00
79714f7a41 clk: imx: scu: remove legacy lpcg clock binding support
remove legacy lpcg clock binding support to avoid confusing

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:28 +08:00
8ba3387831 clk: imx: scu: remove legacy scu clock binding support
remove legacy scu clock binding support to avoid confusing

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:27 +08:00
774d90fb2e clk: imx8: add imx8qm clock valid resource checking
Add imx8qm clock valid resource checking mechanism

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:27 +08:00
bab5cb98cb clk: imx: scu: bypass pi_pll enable status restore
PI PLL does not support enable/disable. So bypass it's
enable status restore.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:27 +08:00
4188a7474e clk: imx8qxp: add clock valid checking mechnism
clk-imx8qxp is a common SCU clock driver used by both QM and QXP
platforms. The clock numbers vary a bit between those two platforms.
This patch introduces a mechanism to only register the valid clocks
for one platform by checking the clk resource id table.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:27 +08:00
16454ec4d7 clk: imx: scu: detach pd if can't power up
detach pd if can't power up as it may be allocated to a differet
partition.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:26 +08:00
d3ed43b656 clk: imx: scu: bypass cpu clock save and restore
CPU clock is managed by ATF. No need save and restore.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:26 +08:00
719b6726fc clk: imx: acm: make it probe earlier
Many audio LPCGs depend on ACM module, so let's make it probe earlier.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:25 +08:00
6d6b95fed1 clk: imx: scu: add two cell binding support for gpr clocks
add two cell binding support for gpr clocks

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:25 +08:00
7edb6f1e42 clk: imx: scu: clean up gpr clocks
Clean up gpr clocks by defining a common scu gpr clock.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:25 +08:00
cf94f27a37 clk: imx: scu: rename imx_clk_scu3 to imx_clk_gate_gpr_scu
Like other scu gpr clocks, change the name to be more accurate.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:23 +08:00
b93157db7f clk: imx8: fix ENET RMII 50M ref clock ID
The ENET RMII 50M SCU Ref clock was wrongly put in LPCG clock ID
definition which may overwrite the SCU clock IDs.
Fix it by move it into the correct place.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:23 +08:00
d85732be35 clk: imx: lpcg: add suspend/resume support
LPCG clock state may be lost when it's power domain is completely
off during system suspend/resume and we need save and restore the
state properly.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:23 +08:00
016611a0a5 clk: imx: clk-imx8qxp-lpcg: add runtime pm support
add runtime pm support

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:20 +08:00
57a376f3cf clk: imx: lpcg: allow lpcg clk to take device pointer
Used to support runtime pm.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:18 +08:00
bbf6c78d18 clk: imx: imx8qxp-lpcg: add parsing clocks from device tree
Add parsing clocks from device tree.

Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
--
Changelog:
v1->v3: no changes
2019-11-25 16:28:16 +08:00
19d97bb532 clk: imx: scu: add suspend/resume support
Clock state will be lost when its power domain is completely off
during system suspend/resume. So we save and restore the state
accordingly in suspend/resume callback.

Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:15 +08:00
ed93db277e clk: imx: scu: add runtime pm support
Add runtime pm support

Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:15 +08:00
996e60e2c8 clk: imx: scu: allow scu clk to take device pointer
Used to support runtime pm.

Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:14 +08:00
1a92f7499c clk: imx: scu: bypass cpu power domains
Bypass cpu power domains which are owned by ATF.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:14 +08:00
c889734e82 clk: imx: scu: add two cells binding support
This patch implements the new two cells binding for SCU clocks.
The usage is as follows:
clocks = <&uart0_clk IMX_SC_R_UART_0 IMX_SC_PM_CLK_PER>

Due to each SCU clock is associated with a power domain, without power
on the domain, the SCU clock can't work. So we create platform devices
for each domain clock respectively and manually attach the required domain
before register the clock devices, then we can register clocks in the
clock platform driver accordingly.

Note because we do not have power domain info in device tree and the SCU
resource ID is the same for power domain and clock, so we use resource ID
to find power domains.

Later, we will also use this clock platform driver to support suspend/resume
and runtime pm.

Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:14 +08:00
d7c3017943 dt-bindings: clock: imx-lpcg: add support to parse clocks from device tree
MX8QM and MX8QXP LPCG Clocks are mostly the same except they may reside
in different subsystems across CPUs and also vary a bit on the availability.

Same as SCU clock, we want to move the clock definition into device tree
which can fully decouple the dependency of Clock ID definition from device
tree and make us be able to write a fully generic lpcg clock driver.

And we can also use the existence of clock nodes in device tree to address
the device and clock availability differences across different SoCs.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:14 +08:00
0139c92aff dt-bindings: firmware: imx-scu: new binding to parse clocks from device tree
There's a few limitations on the original one cell clock binding
(#clock-cells = <1>) that we have to define some SW clock IDs for device
tree to reference. This may cause troubles if we want to use common
clock IDs for multi platforms support when the clock of those platforms
are mostly the same.
e.g. Current clock IDs name are defined with SS prefix.

However the device may reside in different SS across CPUs, that means the
SS prefix may not valid anymore for a new SoC. Furthermore, the device
availability of those clocks may also vary a bit.

For such situation, we want to eliminate the using of SW Clock IDs and
change to use a more close to HW one instead.
For SCU clocks usage, only two params required: Resource id + Clock Type.
Both parameters are platform independent. So we could use two cells binding
to pass those parameters,

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:13 +08:00
a065a0f3c6 clk: imx7d: enable uart2 clock when m4 is enabled
The UART clock used by M4 maybe turned off by Linux side, after the
initialization of the clocks. Enable the UART2 clock when M4 is enabled.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:28:13 +08:00
2777135445 clk: imx8qxp: add enet RMII reference clock
Add enet0/1 RMII mode reference clock support.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:28:12 +08:00
b184aa2ba9 clk: imx: scu: add scu gate clock support
On i.MX8QM/QXP platforms, some clocks tree use GPR to set clock
gate, add scu clock gate driver support.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
2019-11-25 16:28:12 +08:00
b90071a9ac MLK-22156-2 clk: imx: remove __initdata for earlycon_bits
We met below build warnings:
WARNING: vmlinux.o(.text+0x52ea80): Section mismatch in reference from the function imx_register_uart_clocks() to the variable .init.data:earlycon_bits
The function imx_register_uart_clocks() references
the variable __initdata earlycon_bits.
This is often because imx_register_uart_clocks lacks a __initdata
annotation or the annotation of earlycon_bits is wrong.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:12 +08:00
e1cac40ef2 clk: imx8qxp: correct enet clock tree
Correct enet clock tree according to ADD documentation.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:28:12 +08:00
d64b0bbb4c clk: imx: scu: add scu gpr divider and mux clk_hw support
i.MX8QM/QXP platforms some clocks tree use GPR to set clock
divider value, or select the clock source.
So add scu divider and mux clock driver support.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
2019-11-25 16:28:11 +08:00
979c0306d2 MLK-21876-3 clk: imx7ulp: fix build for next-20190524 upgrade
../drivers/clk/imx/clk-composite-7ulp.c: In function ‘imx7ulp_clk_composite’:
../drivers/clk/imx/clk-composite-7ulp.c:83:3: error: implicit declaration of function ‘readl_relaxed’ [-Werror=implicit-function-declaration]
   val = readl_relaxed(reg);
   ^
../drivers/clk/imx/clk-composite-7ulp.c:85:3: error: implicit declaration of function ‘writel_relaxed’ [-Werror=implicit-function-declaration]
   writel_relaxed(val, reg);
   ^
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:11 +08:00
ca06f727dc clk: imx: only enable clocks for earlycon/earlyprintk port
Only enable clocks for earlycon or earlyprintk uart port.

For communication uart port, clock enable will break clock
paraent and rate switch by commit 9461f7b33d (clk: fix
CLK_SET_RATE_GATE with clock rate protection)

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Aisheng: update to CLK HW APIs ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:10 +08:00
176cae71a3 clk: imx: disable i.mx7ulp composite clock during initialization
i.MX7ULP peripheral clock ONLY allow parent/rate to be changed
with clock gated, however, during clock tree initialization, the
peripheral clock could be enabled by bootloader, but the prepare
count in clock tree is still zero, so clock core driver will allow
parent/rate changed even with CLK_SET_RATE_GATE/CLK_SET_PARENT_GATE
set, but the change will fail due to HW NOT allow parent/rate change
with clock enabled. It will cause clock HW status mismatch with
clock tree info and lead to function issue. Below is an example:

usdhc0's pcc clock value is 0xC5000000 during kernel boot up, it
means usdhc0 clock is enabled, its parent is APLL_PFD1. In DT file,
the usdhc0 clock settings are as below:

assigned-clocks = <&pcc2 IMX7ULP_CLK_USDHC0>;
assigned-clock-parents = <&scg1 IMX7ULP_CLK_NIC1_DIV>;

when kernel boot up, the clock tree info is as below, but the usdhc0
PCC register is still 0xC5000000, which means its parent is still
from APLL_PFD1, which is incorrect and cause usdhc0 NOT work.

nic1_clk       2        2        0   176000000          0     0  50000
    usdhc0       0        0        0   176000000          0     0  50000

After making sure the peripheral clock is disabled during clock tree
initialization, the usdhc0 is working, and this change is necessary
for all i.MX7ULP peripheral clocks.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:28:09 +08:00
984c39615c clk: imx8m: make a check the m4 is enabled or not
Make a check that the M4 is enabled or not.
Otherwise, the clocks of the M4 maybe turned off later.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:28:09 +08:00
c9e1df54c5 clk: imx: Add uart from osc support on imx6ul/ull
Add 'uart_from_osc' support on i.MX6UL/ULL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
[ Aisheng: update to CLK HW APIs ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:08 +08:00
15ea9f22fd clk: imx: add clocks for parallel capture interface of IMX8QXP
Add clocks for parallel port capture interface of IMX8QXP.
Because digital pll for parallel interface is on by default, and
not provide enable/disable function by scu, so add the related ops
for this kind of clocks.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:28:08 +08:00
a1b58d4754 clk: imx7d: add A7-M4 AMP power management support
When M4 is active, Linux needs to take care of the power management
considering M4 status, this patch adds runtime check for clock
management for M4 active case.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[ Aisheng: update to CLK HW APIs ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:07 +08:00
e0bbe08475 clk: imx6sx: add AMP clock management support
i.MX6SX has A9 and M4 inside, they can run independently,
this patch adds shared clock management for AMP system.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[ Aisheng: update to CLK HW APIs ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:07 +08:00
4daa319d0b clk: imx6sx: support low power idle
Add uart_from_osc bootargs and change PLL1 bypass clock
to fix clock to support low power idle

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:28:07 +08:00
cc95063346 clk: imx6sx: support suspend/resume with FastMix off
Add M4 related APIs for suspend/resume support, and make
MMDC P1 IPG clock always ON, as it is required during resume
with FastMix OFF.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[ Aisheng: update to CLK HW APIs and add FIXME]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:06 +08:00
2be5e06f51 clk: imx6sx: keep OCRAM_S always ON
OCRAM_S is used as iram tlb table for low power modes, clock
needs to be always ON.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[ Aisheng: update to CLK HW APIs ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:05 +08:00
0d15950c53 clk: imx8qxp-acm: fix boot crash on mx8qm board
Need special care to handl SAI4&5 differently on mx8qm.
Remove it temporarily.

[    2.694908] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP
[    2.702348] Modules linked in:
[    2.705394] CPU: 0 PID: 49 Comm: kworker/0:1 Not tainted 5.1.0-rc3-next-20190405-00675-g19c2025-dirty #131
[    2.715030] Hardware name: Freescale i.MX8QM MEK (DT)
[    2.720084] Workqueue: events deferred_probe_work_func
[    2.725197] pstate: 20000005 (nzCv daif -PAN -UAO)
[    2.729980] pc : clk_mux_get_parent+0xc/0x44
[    2.734235] lr : __clk_init_parent+0x30/0x60
[    2.738484] sp : ffff0000124d39d0
[    2.741786] x29: ffff0000124d39d0 x28: ffff000011161e48
[    2.747086] x27: 0000000000000000 x26: 0000000000000000
[    2.752384] x25: ffff000011161e08 x24: ffffffffffffffef
[    2.757684] x23: ffff8008f7129d00 x22: ffff00001115bae0
[    2.762983] x21: ffff8008f712a400 x20: ffff000010d9b780
[    2.768282] x19: ffff8008f712a400 x18: 000000000006fffc
[    2.773582] x17: 0000000000000000 x16: ffff0000139d0000
[    2.778881] x15: ffff7e0023e2e940 x14: ffff8008ff3eefa0
[    2.784180] x13: 0000000000000000 x12: 00000000000001c2
[    2.789480] x11: 0000000000000003 x10: 0101010101010101
[    2.794779] x9 : 0000000000000000 x8 : 7f7f7f7f7f7f7f7f
[    2.800079] x7 : 626f6b5e33686072 x6 : 1202046b2c0d1957
[    2.805378] x5 : 57190d2c6b040212 x4 : 0000000000000000
[    2.810677] x3 : 0b1b6afb9b0b49a0 x2 : 0000000000000004
[    2.815977] x1 : ffff000013940000 x0 : ffff8008f7129d00
[    2.821281] Process kworker/0:1 (pid: 49, stack limit = 0x(____ptrval____))
[    2.828229] Call trace:
[    2.830665]  clk_mux_get_parent+0xc/0x44
[    2.834570]  __clk_init_parent+0x30/0x60
[    2.838481]  clk_register+0x3ac/0x6a8
[    2.842127]  clk_hw_register+0xc/0x1c
[    2.845777]  clk_hw_register_mux_table+0x104/0x190
[    2.850554]  clk_register_mux+0x30/0x4c
[    2.854385]  imx8qxp_acm_clk_probe+0x6e8/0x838
[    2.858811]  platform_drv_probe+0x4c/0xb0
[    2.862805]  really_probe+0x1f8/0x2c8
[    2.866456]  driver_probe_device+0x58/0xfc
[    2.870537]  __device_attach_driver+0x90/0xac
[    2.874883]  bus_for_each_drv+0x68/0xbc
[    2.878703]  __device_attach+0xe0/0x138
[    2.882525]  device_initial_probe+0x10/0x18
[    2.886695]  bus_probe_device+0x90/0x98
[    2.890518]  deferred_probe_work_func+0x70/0xa4
[    2.895043]  process_one_work+0x13c/0x2b4
[    2.899032]  worker_thread+0x35c/0x3e4
[    2.902772]  kthread+0xf8/0x124
[    2.905900]  ret_from_fork+0x10/0x18
[    2.909462] Code: 17fffff8 a9bf7bfd 910003fd f9400c01 (b9400021)
[    2.915543] ---[ end trace 5a27cc1a041a3c2f ]---

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:05 +08:00
11f00aae28 clk: imx8qxp: Fix dc0 pll0/1 clocks
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:28:04 +08:00
02d7f1e6ca clk: imx8qxp: add mipi lpcg clocks support
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:04 +08:00
5a21a5ab4b dt-bindings: clock: imx8: add MIPI LPCG clock ID
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:04 +08:00
7bb67efb5d clk: imx8qxp: add mipi lvds clock support
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:03 +08:00
7e74860837 dt-bindings: clock: imx8: add more MIPI LVDS clock ids
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:02 +08:00
902be735cd clk: imx8qxp: add dc0 lpcg clk support
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:02 +08:00
c84c8379b2 clk: imx8qxp: add dc0 pll and bypass clk support
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:02 +08:00
f8463d8ce6 dt-bindings: clock: imx8: add dc0 lpcg clock id
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:28:02 +08:00
42a5e53f1d dt-bindings: clock: imx8: add dc bypass scu clock id
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:27:59 +08:00
00f917dddd clk: imx8qxp: add lpcg clocks for LPSPI in adma
Add lpcg clocks for LPSPI in adma subsystem.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:27:58 +08:00
0d7fd7e52a clk: imx8qxp: add audio clocks
add audio clocks

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:27:58 +08:00
8feae1a376 clk: imx: clk-imx8qxp-lpcg: add USB2 clock
Add USB2 controller and PHY clock information.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:27:57 +08:00
a457cffe01 dt-bindings: clock: imx8-clock: add USB2 clock information
For both USB2 controller and USB PHY.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:27:57 +08:00
cd86a02771 clk: imx8qxp: add CSI clocks for image subsystem
Add MIPI CSI clocks for image subsystem of IMX8QXP

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:27:57 +08:00
9fd6dfd95c clk: imx8qxp: add ISI clocks for image subsystem
Add LPCG clocks for ISI of image subsystem

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:27:56 +08:00
b53c6bb516 clk: imx8qxp: add lpcg clocks for hsio
Add the lpcg clocks for hsio.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:27:55 +08:00
8612977fc4 clk: imx8qxp: add lpcg clocks for FlexCAN in adma
Add lpcg clocks for FlexCAN which is in adma subsystem.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:27:55 +08:00
184ae229cf clk: imx8qxp: add scu/lpcg clocks for i2c in cm40
Add scu clocks and lpcg clocks for i2c which is in cm40 subsystem.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:27:55 +08:00
111f7d7083 clk: imx8qxp: add parent clocks for uSDHC
add parent clocks mux support for uSDHC

Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:27:55 +08:00
ae7315e17b dt-bindings: clock: imx8: add CONN SS PLL clock IDs
add CONN SS PLL clock IDs

Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:27:54 +08:00
38395e17e7 arm64: dts: s32v234: Initial ethernet support
Add fec node to SOC dtsi and enable on s32v234-sbc board

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:11:43 +08:00
819b2eb7cc arm64: dts: s32v234: Add all mc_cgm nodes
These are required for managing additional clocks.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:11:43 +08:00
ac3b174235 arm64: dts: Initial s32v234-sbc support
Only enable uart and sdhc so currently identical to evb board.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:11:43 +08:00
f7d6827909 arm64: Add uSDHC node in S32V234-EVB dts
Notes:
- Since the SDs that required to work at 1.8V encountered errors when
  attempting to transition to that voltage, support for 1.8V has been
  disabled for S32V234.
- The maximum bus-width for SD/eMMC is set to 8 bits by default, in order
  to increase the speed. The driver will detect automatically the maximum
  supported bus-width according to the used media properties.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 16:11:42 +08:00
ae20ea255d arm64: dts: s32v234-evb: Add uSDHC pin group to S32V234-EVB dts
Add pinctrl group for uSDHC PAD configurations in SIUL2.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:11:40 +08:00
fb2a044f58 arm64: dts: s32v234: Enable UART clock for S32V234
Enable the clocks needed for LINFlexD UART support on Treerunner and make
use of them in the LINFlexD driver.

Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Adrian.Nitu <adrian.nitu@freescale.com>
Signed-off-by: Larisa Grigore <Larisa.Grigore@nxp.com>
Signed-off-by: Iustin Dumitrescu <Iustin.Dumitrescu@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:11:40 +08:00
9b260c8501 arm64: Prepare S32V234 dtsi for clock support
Update device tree with nodes needed by the clock driver, including clock
generation module (MC_CGM), mode entry module (MC_ME) and system reset
controller (SRC).

Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Dragoș Papavă <dragos.papava@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 16:11:40 +08:00
6a0eef0672 arm64: Add UART pin groups to S32V234-EVB dts
Add pinctrl groups for UART0 and UART1 PAD configurations in SIUL2.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Catalin Udma <catalin-dan.udma@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 16:11:39 +08:00
140d25e28c arm64: Prepare S32V234-EVB dts for pinmuxing support
Add node for the SIUL2 pin controller, which will be used by the pinctrl
driver.

Signed-off-by: Grigore Lupescu <grigore.lupescu@freescale.com>
Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 16:11:39 +08:00
7ed887f332 arm64: dts: fsl: Add device tree for S32V234-EVB
Add initial version of device tree for S32V234-EVB, including nodes for the
4 Cortex-A53 cores, AIPS bus with UART modules, ARM architected timer and
Generic Interrupt Controller (GIC).

Keep SoC level separate from board level to let future boards with this SoC
share common properties, while the dts files will keep board-dependent
properties.

Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Dan Nica <dan.nica@nxp.com>
Signed-off-by: Larisa Grigore <Larisa.Grigore@nxp.com>
Signed-off-by: Phu Luu An <phu.luuan@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-11-25 16:11:38 +08:00
f2d9c53feb arm64: dts: lx2160a: add ftm_alarm0 DT node
The patch adds ftm_alarm0 DT node for Soc LX2160A
FlexTimer1 module is used to wakeup the system in deep sleep

Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-25 16:11:27 +08:00
e7c676ba0b arm64: dts: ls1028a-rdb: enable emmc hs400 mode
This patch is to enable emmc hs400 mode for ls1028ardb

Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
2019-11-25 16:11:27 +08:00
c29a6ec669 arm64: dts: ls1028a: fix little-big endian issue for dcfg
dcfg use little endian that SoC register value will be correct

Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
2019-11-25 16:11:26 +08:00
394d9b1223 arm64: dts: ls1028a: Fix interrupt-map property of PCIe nodes
The current interrupt-map entries lost the 'parent unit address',
it will result in fail to allocate legacy INTx interrupts.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:11:25 +08:00
66ad22e41e arm64: dts: fix endianness of rcpm
Add little-endian property of rcpm for ls1028a,ls1088a,ls208xa

Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-25 16:11:24 +08:00
278ae656ff arm64: dts: ls1028a: Add ethernet property for l2switch CPU port
This enables the CPU traffic for the l2 switch (aka the
CPU frame injection/ extraction feature).

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-11-25 16:11:24 +08:00
1b65f8dba4 arm64: dts: ls1028a: support Felix/PF5 INTB interrupt
The INTB interrupt includes,
- PTP timestamp ready in timestamp FIFO
- TSN Preemption

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-11-25 16:11:23 +08:00
6388ac60f6 arm64: dts: fsl: ls1028a: Enable switch PHYs on RDB
Just link the switch PHY nodes to the central MDIO
controller PCIe endpoint node on ls1028 (implemented
as PF3) so that PHYs are configurable via MDIO.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-11-25 16:11:22 +08:00
1c5cb7c99b arm64: dts: fsl: ls1028a: Add Felix switch port DT node
Add the switch device node, available on PF5, so that the
switch port sub-nodes (net devices) can be linked to
corresponding board specific phy nodes (external ports) or
have their link mode defined (internal ports).
The switch device features 6 ports, 4 with external links
and 2 internally facing to the ls1028a SoC and connected via
fixed links to 2 internal enetc ethernet contoller ports.
Add the corresponding enetc internal port device nodes,
mapped to PF2 and PF6 PCIe functions.
And don't forget to enable the 4MB BAR4 in the root complex
ECAM space, where the switch registers are mapped.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
2019-11-25 16:11:21 +08:00
3d8c449559 arm64: ls1028aqds: Add support DP nodes for LS1028AQDS
This patch add HDP PHY Controller related nodes on the LS1028AQDS.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
Signed-off-by: Wen He <wen.he_1@nxp.com>
2019-11-25 16:11:21 +08:00
e76cc41226 arm64: ls1028ardb: Add support DP nodes for LS1028ARDB
This patch add HDP PHY Controller related nodes on the LS1028ARDB.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
Signed-off-by: Wen He <wen.he_1@nxp.com>
2019-11-25 16:11:20 +08:00
6d7ffb8c23 arm: dts: ls1021a: replace ftm0 with ftm_alarm0 DT node
The patch replaces ftm0 with ftm_alarm0 DT node
	- remove old ftm0 node
	- add rcpm node
	- add ftm_alarm0 node
	- aliases ftm_alarm0 as rtc1

Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-25 16:11:20 +08:00
32c72605d7 arm64: dts: ls1012a/ls1043a/ls1046a/ls1088a/ls208xa: replace ftm0 with ftm_alarm0
The patch replaces ftm0 with ftm_alarm0 DT node
	- replace ftm0 with ftm_alarm0
	- add new rcpm node
	- remove old rcpm node
	- aliases ftm_alarm0 as rtc1

Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-25 16:11:19 +08:00
45512a8079 arm64: dts: ls1028a: Add ftm_alarm0 DT node
The patch adds ftm_alarm0 DT node for LS1028ARDB board
FlexTimer1 module is used to wakeup the system

Signed-off-by: Biwen Li <biwen.li@nxp.com>
2019-11-25 16:11:19 +08:00
8fb3fd370d arm64: dts: lx2160a: Update phy mode for Aquantia PHYs
The Aquantia driver does not allow xgmii mode anymore for
the AQR107 PHYs. Use the correct usxgmii mode instead.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-11-25 16:11:18 +08:00
804d05706e arm64: dts: fsl: add optee node for ls1028
For enabling OP-TEE on LS1028, need to add optee node
in DTS

Signed-off-by: Sahil Malhotra <sahil.malhotra@nxp.com>
2019-11-25 16:11:17 +08:00
30b70ae21e arm64: dts: ls1028a: add gpu node
Add GPU dts node to enable GPU feature.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
2019-11-25 16:11:17 +08:00
00b0c502ab arm64: dts: ls1028a: Update fspi reg properties
Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
2019-11-25 16:11:15 +08:00
05a0b6011d arm64: dts: lx2160a: update interrupt property for Aquantia phy
Update Aquantia AQR107 nodes interrupt property.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
2019-11-25 16:11:14 +08:00
f0f0a99109 arm64: dts: fsl: remove backplane support
Remove entire backplane support from device tree for all supported platforms

Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
2019-11-25 16:11:14 +08:00
5687a14049 sdk: dts: ls1046frwy move dma-coherent from soc to its child nodes
Since SMMU is not supported for SDK version, USB function will down if
still apply property 'dma-coherent' in scope of soc (USB driver is not
ready to support it alone) in SDK device trees, decide to remove it.
And add dma-coherent on other non-USB child nodes under soc.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:11:14 +08:00
3d1f00441a sdk: dts: ls1046: drop smmu from the frwy sdk dtses
Drop the smmu from the frwy and frwy-usdpaa versions of the SDK device
trees because SMMU is supported only for the upstream version of the
dpaa ethernet drivers.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:11:13 +08:00
70889548fe arm64: dts: ls1028a: add flexspi nodes
Add fspi node property for LS1028A SoC for FlexSPI driver.
Property added for the FlexSPI controller and for the connected
slave device for the LS1028ARDB and LS1028AQDS target.
This is having one SPI-NOR flash device, mt35xu02g connected at
CS0.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
2019-11-25 16:11:13 +08:00
d109072fa5 powerpc: dts: Fix the bug that intx interrupt not work in P1010RDB-PB
P1010RDB-PA board configure the INTA with polarity as active-low.
P1010RDB-PB board configure the INTA with polarity as active-high.
Therefore, we need to configure P1010RDB-PB's INTA with polarity as
active-high and configure P1010RDB-PA's INTA with polarity as active-low.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
2019-11-25 16:11:12 +08:00
fbfc50c5f8 arm64: dts: fsl: ls1046: Modify the qspi flash frequency
The qspi flash in ls1046a based QDS and RDB boards can operate
at 50MHz frequency.
Therefore, update the maximum supported freq in their respective
dts files.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
2019-11-25 16:11:12 +08:00
77f6280d72 arm64: dts: fsl: ls1028a: add flexcan node
Add flexcan node in LS1028A SOC file as well as in QDS and RDB files.
The device tree bindings used can be referred from
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
2019-11-25 16:11:11 +08:00
0d8b0a9163 arm64: dts: fsl: lx2160a: add flexcan node
Add flexcan node in LX2160A SOC file as well as in QDS and RDB files.
The device tree bindings used can be referred from
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
2019-11-25 16:11:10 +08:00
24a65a90fa Documentation: can: flexcan: Add flexcan clocks' information
The clocking information is missing from flexcan device tree bindings.
This information is needed to be able to use flexcan. Document the same.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
2019-11-25 16:11:09 +08:00
16d534b719 arm64: dts: lx2160a: Enable usb3-lpm-capable for usb3 node
Enable USB3 HW LPM feature for lx2160a and active patch for
snps erratum A-010131. It will disable U1/U2 temperary when
initiate U3 request.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:11:09 +08:00
7950028a19 arm64: dts: ls1028a: Add PCIe controller DT nodes
LS1028a implements 2 PCIe 3.0 controllers.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
2019-11-25 16:11:08 +08:00
edaf7a64ce dt-bindings: pci: layerscape-pci: add compatible strings "fsl,ls1028a-pcie"
Add the PCIe compatible string for LS1028A

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
2019-11-25 16:11:08 +08:00
c060cc367f arm64: dts: nxp: frwy-ls1046a: add support for micron nor flash
add micron nor flash support for ls1046a frwy board.

Signed-off-by: Ashish Kumar <ashish.kumar@nxp.com>
Signed-off-by: Pramod Kumar <pramod.kumar_1@nxp.com>
2019-11-25 16:11:07 +08:00
1f290f0563 sdk: arm64: dts: nxp: add DPAA1 SDK flavor dts files
dts fsl-ls1046a-frwy-sdk.dts which enables sdk specific entries
dts fsl-ls1046a-frwy-usdpaa.dts which enables dpdk

Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Signed-off-by: Pramod Kumar <pramod.kumar_1@nxp.com>
2019-11-25 16:11:06 +08:00
44f789de2d arm64: dts: fsl: layerscape: fix warnings when compiling dts files
when compiling dts file using DTC_FLAG='-@', the device tree compiler
reports these warnings:

Warning (alias_paths): /aliases: aliases property name must include
only lowercase and '-'

Fixed the node aliases to silence these warnings.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
2019-11-25 16:11:06 +08:00
e8d5168a11 arm64: dts: fsl: layerscape: fix warnings when compiling dts files
when compiling dts file using DTC_FLAG='-@', the device tree compiler
reports these warnings:

Warning (simple_bus_reg): /soc/mdio@0x8c0b000: simple-bus unit address
format error, expected "8c0b000"
Warning (unit_address_format): /pfe@04000000: unit name should not have
leading 0s

Fixed the node names to silence these warnings.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
2019-11-25 16:11:05 +08:00
2dfc5fc0eb arm64: dts: lx2160a: add interrupt property for aquantia phy
Add interrupt property for Aquantia AQR107 ethernet phy, currently
working in polling mode.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
2019-11-25 16:11:04 +08:00
cd1a4f3c64 sdk: dts: ls104x move dma-coherent from soc to its child nodes
Since SMMU is not supported for SDK version, USB function will down if
still apply property 'dma-coherent' in scope of soc (USB driver is not
ready to support it alone) in SDK device trees, decide to remove it.
And add dma-coherent on other non-USB child nodes under soc.

dma-coherent feature in dts node will cause issue that
QE-HDLC received too little, when a lot of data is transmitted while
just little data received, the Tx buffer will run out.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 16:11:03 +08:00
cfb690db7f arm64: dts: freescale: lx2160a: add pcie EP mode DT nodes
The LX2160A PCIe EP mode node.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
2019-11-25 16:11:00 +08:00
8102c50ab5 ARM: dts: ls1021aqds: enable esdhc controller
This patch is to enable esdhc controller in ls1021aqds

Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
2019-11-25 16:11:00 +08:00
0e8ea479b3 ARM: dts: Fix DWC3 IP VBUS glitch issue on LS1021A
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:10:59 +08:00
ba458f63e3 arm64: dts: Fix DWC3 IP VBUS glitch issue on Layerscape platforms
Cover LS1012A, LS1043A, LS1046A, LS1088A, LS208xA, LX2160A

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:10:59 +08:00
d9186c7939 sdk: arm64: dts: reduce usdpaa memory to 4K for LS1046/43
This patch reducing the USDPAA reseved memory to 4K.
In case USDPAA is to be used, 256MB needs to be reserved in the DTS file.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
2019-11-25 16:10:59 +08:00
d68d2a8a02 arm64: dts: lx2160aqds: Add mdio mux nodes
The two external MDIO buses used to communicate with phy devices that are
external to SOC are muxed in LX2160AQDS board.
These buses can be routed to any one of the eight IO slots on LX2160AQDS
board depending on value in fpga register 0x54.
Additionally the external MDIO1 is used to communicate to the onboard
RGMII phy devices.
The mdio1 is controlled by bits 4-7 of fpga register and mdio2 is
controlled by bits 4-7 of fpga register.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
2019-11-25 16:10:58 +08:00
070918bd49 arm64: dts: fix the LS104x QDS mdio-mux support
Set the "simple-bus" compatible and the fpga ranges in order to
successfully probe the mdio-mux-emi1.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
2019-11-25 16:10:57 +08:00
73849d2020 sdk: dts: ls104x: drop smmu from the qds and usdpaa sdk dts
Also drop the smmu from the qds and usdpaa versions of the
SDK device trees because SMMU is supported only for the
upstream version of the dpaa ethernet drivers.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:10:56 +08:00
bc5314d94b arm64: dts: ls1012a: reorganize pfe_mac nodes
To keep platform specific properties in the platform dts files,
remove pfe_mac nodes from dtsi and define them in dts files.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-11-25 16:10:54 +08:00
b315070991 arm64: dts: ls1012a: remove unused gemac-bus-id
gemac-bus-id is unused property and is removed.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-11-25 16:10:53 +08:00
a8dcd1a058 arm64: dts: ls1012a: use phy-handle to handle phy params
Replace properties "fsl,gemac-phy-id" and "fsl,pfe-phy-if-flags"
and use phy-handle instead.
Create mdio node with phy-handles defining PHYs available on the
mdio bus.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
2019-11-25 16:10:52 +08:00
8e7862e540 arm64: dts: lx2160a-qds: add sata node support
Add sata node support and Enable sata support

Signed-off-by: Peng Ma <peng.ma@nxp.com>
2019-11-25 16:10:52 +08:00
ade810df11 arm64: dts: ls104x: constrain sata dma address size
Limit the dma mask size for sata to 40 bits to match the actual address
size generated towards the interconnect. Re-use the already existing
auxiliary simple bus meant for usb but drop the usb reference from the
node name.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:10:51 +08:00
35c57c0768 arm64: dts: lx2160a: add optee-tz node
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
2019-11-25 16:10:51 +08:00
71f6c0d310 arm64: dts: freescale: lx2160a: Inphi in112525_s03 mdio node
Add Inphi retimer phyid in the mdio node, solving the probe issue
for this non-standard clause-45 device.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
2019-11-25 16:10:50 +08:00
8d31b4c842 arm64: dts: freescale: lx2160a: add pcie DT nodes
The LX2160A integrated 6 PCIe Gen4 controllers.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:10:49 +08:00
adc1b40663 arm64: dts: Added endianness information to dts serdes node
This change is required to specify that serdes HW peripheral is little-endian.

Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
2019-11-25 16:10:48 +08:00
59399b4e83 arm64: dts: lx2160: DPMAC connections to backplane PHYs example
This is an example of device tree nodes required to enable 10GBase-KR and 40GBase-KR on LX2160

Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
2019-11-25 16:10:48 +08:00
534cfce193 arm64: dts: lx2160: PCS PHY definitions for 10GBase-KR and 40GBase-KR backplane modes
Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
2019-11-25 16:10:48 +08:00
424023f637 arm64: dts: lx2160: Add all pcs mdio definitions according to RM
This change is required in preparation for adding 40GBase-KR support in DTS for LX2160

Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
2019-11-25 16:10:47 +08:00
10f11e8c1b arm64: dts: lx2160a-rdb: Add Aquantia PHY nodes
DPMAC3 and DPMAC4 are connected to 10G Aquantia PHYs

Signed-off-by: Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-11-25 16:10:46 +08:00
3dc1539dd5 arm64: dts: lx2160a-rdb: Add Inphi PHY node
DPMAC5 and DPMAC6 are connected to 25G Inphi PHY

Signed-off-by: Vicentiu Galanopulo <vicentiu.galanopulo@nxp.com>
Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
2019-11-25 16:10:46 +08:00
fab043e8ad arm64: dts: nxp: add more thermal zone support
To enable all the supported thermal sensors, add sensor id information
to thermal zone node.
Dts for ls1012a, ls1046a, ls1043a, ls1088a are updated.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
2019-11-25 16:10:45 +08:00
6a5ebd0be1 arm64: dts: nxp: ls208xa: add more thermal zone support
Ls208xa has several thermal sensors. Add all the sensor id to dts
to enable them.

To make the dts cleaner, re-organize the nodes to split out the
common part so that it can be shared with other SoCs.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
2019-11-25 16:10:45 +08:00
a8d347c746 arm64: dts: lx2160a: add DT node for all DSPI controller
Add device tree node for first flash (CS0) connected
to all dspi controller.

Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com>
Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
2019-11-25 16:10:44 +08:00
ba44a6fb1e arm64: dts: lx2160a: add dspi controller DT nodes
Add the dspi support on lx2160

Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com>
Signed-off-by: Bao Xiaowei <xiaowei.bao@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2019-11-25 16:10:43 +08:00
4788bed7fa arm64: dts: lx2160a: correct scl-gpios property
Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
2019-11-25 16:10:43 +08:00
7425c21cad arm64: dts: lx2160a-rdb: Add RGMII PHY nodes for dpmac 17 and 18
* Both are AR8035 chips

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-11-25 16:10:42 +08:00
f9d10fd115 arm64: dts: lx2160a: add MDIO device-tree nodes
Signed-off-by: Vicentiu Galanopulo <vicentiu.galanopulo@nxp.com>
2019-11-25 16:10:42 +08:00
bd37058080 sdk: dts: ls104x: drop smmu from the sdk device trees
SMMU is not supported for the SDK version of the dpaa ethernet
drivers so remove the SMMU node from the device tree.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:10:41 +08:00
a97ab66907 arm64: dts: ls104x: use a pseudo-bus to constrain usb dma size
Wrap the usb controllers in an intermediate simple-bus and use it to
constrain the dma address size of these usb controllers to the 40 bits
that they generate toward the interconnect.
This is required because the SoC uses 48 bits address sizes and this
mismatch would lead to smmu context faults because the usb generates
40-bit addresses while the smmu page tables are populated with 48-bit
wide addresses.

Suggested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:10:41 +08:00
ba183cc45d arm64: dts: ls104x: make dma-coherent global to the SoC
These SoCs are really completely dma coherent in their entirety so add
the dma-coherent property at the soc level in the device tree and drop
the instances where it's specifically added to a few select devices.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:10:41 +08:00
b3dc531ee7 arm64: dts: ls104x: add iommu-map to pci controllers
The pci controllers are also behind the smmu so add the iommu-map
property to reflect this. The bootloader needs to patch the stream id
ranges to some sane values.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:10:40 +08:00
f8bc3940d0 arm64: dts: ls104x: add missing dma ranges property
These chips have a 48-bit address size so make sure that the dma-ranges
reflects this. Otherwise the linux kernel's dma sub-system will set
the default dma masks to full 64-bit, badly breaking dmas.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:10:39 +08:00
116860553f arm64: dts: ls104xa: set mask to drop TBU ID from StreamID
The StreamID entering the SMMU is actually a concatenation of the
SMMU TBU ID and the ICID configured in software.
Since the TBU ID is internal to the SoC and since we want that the
actual the ICID configured in software to enter the SMMU witout any
additional set bits, mask out the TBU ID bits and leave only the
relevant ICID bits to enter SMMU.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:10:38 +08:00
e5a1392347 arm64: dts: ls1043a: add smmu node
This allows for the SMMU device to be probed by the SMMU kernel driver.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:10:38 +08:00
440195b179 arm64: dts: ls1046a: add smmu node
This allows for the SMMU device to be probed by the SMMU kernel driver.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 16:10:37 +08:00
b5eef889ef dt-bindings: arm64: add compatible for LX2160A
Add compatible for LX2160A SoC,QDS and RDB board
Add lx2160a compatible for clockgen and dcfg

Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2019-11-25 16:10:37 +08:00
567bc3e2ef ARM: dts: accumulated change
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:10:36 +08:00
d81e8c730d arm64: dts: ls208xa: accumulated change to ls208xa boards
commit 46123df3a174f0d76c8b954a0386e64841453836
Author: Florinel Iordache <florinel.iordache@nxp.com>
Date:   Thu Aug 9 12:29:18 2018 +0300

    arm64: dts: updates for Unified Backplane driver

    Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>

commit 76a741dbb9b93ea9ab2f6122b8df5bc4f0db7676
Author: Nipun Gupta <nipun.gupta@nxp.com>
Date:   Sat Apr 28 00:20:16 2018 +0530

    arm64: dts: ls208x: add dma-cohernet property in fsl-mc node

    Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

commit f6309e9dc8e0c6171a43fd6759123b5de1c574aa
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Mon Apr 2 16:27:23 2018 +0800

    arm64: dts: ls208xa: add dts entry for A-010650

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 8c37bad2038a210a4f0a369fd946aaae4317eac4
Author: Nipun Gupta <nipun.gupta@nxp.com>
Date:   Fri Apr 20 17:14:10 2018 +0530

    arm64: dts: ls208x: add dma ranges property

    Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

commit 38566bbd5ca6747b30d2f0c251bbcfe0723df8c6
Author: Changming Huang <jerry.huang@nxp.com>
Date:   Wed Apr 19 12:49:50 2017 +0800

    arm/arm64: dts: Add property snps incr burst type adjustment for
INCR burst type for dwc3

    Signed-off-by: yinbo.zhu <yinbo.zhu@nxp.com>
    Signed-off-by: Ran Wang <ran.wang_1@nxp.com>

commit dbb65ea8ee1d46067e756c6d64c7fe66a0058f49
Author: Pankaj Bansal <pankaj.bansal@nxp.com>
Date:   Mon Mar 5 12:37:04 2018 +0530

    arm64: dts: ls208x: remove NXP Erratum A008585 from LS2088A.

    NXP Erratum A008585 affects A57 core cluster used in LS2085rev1.
    However this problem has been fixed in A72 core cluster used in
LS2088.
    Therefore remove the erratum from LS2088A. Keeping it only in
LS2085.

    Cc: <stable@vger.kernel.org> # 4.14
    Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
    Reviewed-by: Sandeep Malik <sandeep.malik@nxp.com>
    Acked-by: Priyanka Jain <priyanka.jain@nxp.com>

commit 85f41b0f6abe6b9d7d303790bb3712ed559890e9
Author: Nipun Gupta <nipun.gupta@nxp.com>
Date:   Mon Feb 26 10:39:54 2018 +0530

    arm64: dts: ls208xa: add dma coherent property in smmu node

    Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

commit e910d8b78b823a625451b1da7ae7499dadde2ae9
Author: Suresh Gupta <suresh.gupta@nxp.com>
Date:   Thu Feb 1 23:49:56 2018 +0530

    arm64: dts: freescale: ls208xa: Modify DT nodes for qspi

    Signed-off-by: Abhimanyu Saini <abhimanyu.saini@nxp.com>

commit 7654ef78c8c85de3a43dfa0dffd572d589ea1332
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Wed Nov 1 10:34:04 2017 +0800

    arm64: dts: ls208xa: correct the i2c clock to 1/2 platform pll

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit efdb129228baa6a999c06072338b979d783d7b60
Author: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Date:   Thu Aug 31 14:45:02 2017 +0530

    arm64: dts: ls208xa: Add iommu-map property for pci

    This patch adds iommu-map property for PCIe, which enables
    SMMU for these devices on LS208xA devices.

    Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>

commit 45af5d025eafaf4a85000e16e5f47992de663ff6
Author: Iordache Florinel-R70177 <florinel.iordache@nxp.com>
Date:   Mon Aug 21 11:46:59 2017 +0300

    arm64: dts: ls2088a: update backplane support with dpmac connections

    Signed-off-by: Iordache Florinel-R70177 <florinel.iordache@nxp.com>

commit b2ede6c088a883fceb348e8659253b2c7cdeeff8
Author: Santan Kumar <santan.kumar@nxp.com>
Date:   Thu Jun 22 13:04:00 2017 +0530

    arm64: dts: ls2088ardb: Update nodes for QSPI

    -As per board design, different QSPI flash is connected on
      boards, hence change QSPI flash node from s25fl256s1 to s25fs512ss
in
      device tree.
    -Enable fast-read support in QSPI node.

    Signed-off-by: Santan Kumar <santan.kumar@nxp.com>

commit d5324a75c56e9f9210113e51cffa846a86b50fbd
Author: Santan Kumar <santan.kumar@nxp.com>
Date:   Mon Jun 19 15:26:03 2017 +0530

    arm64: dts: ls2081ardb: Update nodes for QSPI, SATA, INA220

    Update ls2081ardb.dts for below nodes:
     -As per updated board design, different QSPI flash is connected on
      boards, hence change QSPI flash node from n25q512a to s25fs512ss
in
      device tree.
     -Enable dual flash support in QSPI node.
     -Add DTS node for INA220.
     -Enable SATA node.

    Signed-off-by: Santan Kumar <santan.kumar@nxp.com>
    Signed-off-by: Tao Yang <b31903@freescale.com>
    Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>

commit 43d506fa19e1e50e4c2e4f9689ad3c60d9a06d71
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Thu May 11 08:42:19 2017 +0800

    arm64: dts: ls208x: add property for PCA954x Mux device

    PCA954x Mux device should never be turned-off after power-on. if
    device tree contians "i2c-mux-never-disable" property for pca954x
    device node, it can ensure that skip disabling PCA954x Mux device.

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 6d3a96446a7ffccb0b9936b616d855c8d5572bce
Author: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Date:   Wed May 3 14:26:35 2017 +0000

    arm64: dts: fsl/ls1088,ls208x: Add mdio and phy nodes

    Add mdio and phy nodes for the following FSL platforms:
    - LS1088A RDB
    - LS2080A QDS & RDB
    - LS2088A QDS, RDB & simu

    Contains contributions from patches by the following authors:
    Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
    Signed-off-by: Rai Harninder <harninder.rai@nxp.com>
    Signed-off-by: Pratiyush Mohan Srivastava
<pratiyush.srivastava@nxp.com>
    Signed-off-by: Raghav Dogra <raghav.dogra@nxp.com>
    Signed-off-by: Santan Kumar <santan.kumar@nxp.com>
    Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
    Signed-off-by: Ashish Kumar <ashish.kumar@nxp.com>
    Signed-off-by: Abhimanyu Saini <abhimanyu.saini@nxp.com>
    Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
    Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>

commit 0443625ea24bc4ea315c30b718712254c588bd18
Author: Suresh Gupta <suresh.gupta@nxp.com>
Date:   Fri May 5 13:54:22 2017 +0530

    arm64: dts: ls208xa: Add QSPI Flash node for RDB

    This is temporary patch, will rewrite for open source

    Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>

commit ed0ce1d49aa72d12ea54f82d3771a377c68af37e
Author: Priyanka Jain <priyanka.jain@nxp.com>
Date:   Thu Apr 13 16:49:40 2017 +0530

    arm64: dts: ls2081ardb: Add DTS support for NXP LS2081ARDB

    This patch add support for NXP LS2081ARDB board which has
    LS2081A SoC.

    LS2081A SoC is 40-pin derivative of LS2088A SoC
    So, from functional perspective both are same.
    Hence,ls2088a SoC dtsi files are included from ls2081ARDB dts

    Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>

commit e4fb842554a5e7b8c3f6e3c243222dbe4515aee3
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Thu Apr 27 15:01:54 2017 +0800

    arm64: dts: ls208xa: add ftm0 nodes

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 64c3e2c3a7ddc89c3c23c012ee364f2c014524d2
Author: costi <constantin.tudor@freescale.com>
Date:   Fri Mar 3 18:08:28 2017 +0200

    arm64: dts: fsl-ls2088: Add mdio/phy devices

    Signed-off-by: Constantin Tudor <constantin.tudor@nxp.com>

commit 3bcdc4de0a1c9e6f4a4ddc916e8efe8044d8bbfd
Author: Po Liu <po.liu@nxp.com>
Date:   Fri Sep 30 17:11:36 2016 +0800

    arm64: dts: ls1043/ls2080: add pcie aer/pme interrupt-name property

    Some platforms(NXP Layerscape for example) aer/pme interrupts was
not
    MSI/MSI-X/INTx but using interrupt line independently. This patch
    add "aer", "pme" interrupt-names for aer/pme interrupt.

    With the interrupt-names "aer", "pme" code could probe aer/pme
interrupt
    line for pcie root port, replace the aer/pme interrupt service irqs.

    This is intend to fixup the Layerscape platforms which aer/pmes
interrupts
    was not MSI/MSI-X/INTx, but using interrupt line independently.

    Since the interrupt-names "intr" never been used. Remove it.

    Signed-off-by: Po Liu <po.liu@nxp.com>
    Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

commit 64d859836d3d194e8bc926bb951fd21859689824
Author: Nipun Gupta <nipun.gupta@nxp.com>
Date:   Mon Dec 5 05:20:51 2016 +0530

    arm64: dts: ls208xa: Comply with the new iommu binding for fsl_mc

    fsl-mc bus support the new iommu-map property. Comply to this
binding
    for fsl_mc bus.

    Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
2019-11-25 16:10:36 +08:00
7d0b9df921 arm64: dts: ls1088a: accumulated change to ls1088a boards
commit f967940f2fb73bc7ec676dbad9f32fbf4e7fea2b
Author: Pengbo Mu <pengbo.mu@nxp.com>
Date:   Fri Jul 13 16:19:36 2018 +0800

    arm64: dts: ls1088a: add snps incr burst type adjustment in usb0 &
usb1

    This property could fix the defect that external usb device always
    prints this error log --- 'reset SuperSpeed USB device number n
using
    xhci_hcd' when system power on.

    Signed-off-by: Pengbo Mu <pengbo.mu@nxp.com>

commit 46123df3a174f0d76c8b954a0386e64841453836
Author: Florinel Iordache <florinel.iordache@nxp.com>
Date:   Thu Aug 9 12:29:18 2018 +0300

    arm64: dts: updates for Unified Backplane driver

    Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>

commit 3b214bd42d47ebe7b6af925a3ffcf09aaaaabfb9
Author: Nipun Gupta <nipun.gupta@nxp.com>
Date:   Sat Apr 28 00:20:48 2018 +0530

    arm64: dts: ls1088: add dma-cohernet property in fsl-mc node

    Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

commit 240b04a98171f6774d1c3c498f8cb21f4411ac5f
Author: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Date:   Thu Apr 26 12:26:54 2018 +0300

    arm64: dts: ls1088a: move fsl-mc node as a child of soc

    Move the fsl-mc hardware manager node in the soc node because all
the
    soc settings (such as 'dma-ranges') also apply to the fsl-mc and
need
    to be propagated to it.

    Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>

commit 3f2f50950f763d1335181ce374a11ed118abf0fa
Author: Nipun Gupta <nipun.gupta@nxp.com>
Date:   Wed Apr 25 09:43:47 2018 +0530

    arm64: dts: ls1088: add dma ranges property

    Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

commit 6afd0157e8fa2510790537855c86f8a7c1431abe
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Mon Apr 2 16:25:38 2018 +0800

    arm64: dts: ls1088a: add dts entry for A-010650

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 0f8432c30c44771f9180aa7bf7580ad1d7e7c9d3
Author: Nipun Gupta <nipun.gupta@nxp.com>
Date:   Mon Feb 26 10:40:37 2018 +0530

    arm64: dts: ls1088a: add dma coherent property in smmu node

    Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

commit 6417c66b823ab380cf73ee252a998d98b28f0180
Author: Suresh Gupta <suresh.gupta@nxp.com>
Date:   Fri Feb 2 00:04:41 2018 +0530

    arm64: dts: freescale: ls1088a: Modify DT nodes for qspi

    Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>
    Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>

commit 01a1ea9e781d307ab87da95043ec898736495fff
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Thu Nov 2 10:36:48 2017 +0800

    arm64: dts: ls1088a: correct the i2c clock to 1/8 platform pll

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 60122f1192e1cc23e5952468cc5a884287d64907
Author: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Date:   Thu Sep 7 10:08:31 2017 +0530

    arm64: dts: ls1088a: Add iommu-map property for pci

    This patch adds iommu-map property for PCIe, which enables
    SMMU for these devices on LS1088.

    Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>

commit 43c4d0cf074106b411280c5b2be75d5d6e63fb01
Author: Iordache Florinel-R70177 <florinel.iordache@nxp.com>
Date:   Mon Aug 21 11:43:07 2017 +0300

    arm64: dts: ls1088a: add backplane support

    Signed-off-by: Iordache Florinel-R70177 <florinel.iordache@nxp.com>

commit 57d49424694f72adbf7cf1dbeff38704f0d65359
Author: Ashish Kumar <Ashish.Kumar@nxp.com>
Date:   Mon Jun 19 18:32:13 2017 +0530

    arm64: dts: ls1088: Add Reboot node in dtsi

    Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>

commit ee950989a7babc240153a20fe468573e13d61f98
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Thu May 11 14:59:28 2017 +0800

    arm64: dts: ls1088a: add ftm0 nodes

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 6d3a96446a7ffccb0b9936b616d855c8d5572bce
Author: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Date:   Wed May 3 14:26:35 2017 +0000

    arm64: dts: fsl/ls1088,ls208x: Add mdio and phy nodes

    Add mdio and phy nodes for the following FSL platforms:
    - LS1088A RDB
    - LS2080A QDS & RDB
    - LS2088A QDS, RDB & simu

    Contains contributions from patches by the following authors:
    Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
    Signed-off-by: Rai Harninder <harninder.rai@nxp.com>
    Signed-off-by: Pratiyush Mohan Srivastava
<pratiyush.srivastava@nxp.com>
    Signed-off-by: Raghav Dogra <raghav.dogra@nxp.com>
    Signed-off-by: Santan Kumar <santan.kumar@nxp.com>
    Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
    Signed-off-by: Ashish Kumar <ashish.kumar@nxp.com>
    Signed-off-by: Abhimanyu Saini <abhimanyu.saini@nxp.com>
    Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
    Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>

commit 971ff2e74cfebb84286ec3e191f5910dded4bd41
Author: Suresh Gupta <suresh.gupta@nxp.com>
Date:   Thu May 4 18:04:44 2017 +0530

    arm64: dts: ls1088a: Add QSPI node for QDS, RDB

    This is temporary patch, will rewrite for open source

    Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
    Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>

commit c61036e6dfe264d61cc213293040d873d863e8ac
Author: Nipun Gupta <nipun.gupta@nxp.com>
Date:   Thu Apr 27 23:35:15 2017 +0530

    arm64: dts: add iommu-map property in fsl-mc node

    Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

commit a4412cc510162a900d10c8ca4add71defb3f2d97
Author: Nipun Gupta <nipun.gupta@nxp.com>
Date:   Wed Apr 19 22:26:15 2017 +0530

    arm64: dts: add smmu device node in LS1088 devicetree

    Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
2019-11-25 16:10:35 +08:00
f0ba13fd56 arm64: dts: ls1046a: accumulated change to ls1046a boards
commit 118e2f48ee8da3f5547c24888bd6fdb78f03b7ce
Author: Peng Ma <peng.ma@nxp.com>
Date:   Wed Jul 25 08:53:07 2018 +0000

    dts: fsl-ls1021a, fsl-ls1043a, fsl-ls1046a: add multi block node
support

    add block-offset to support different virtual block offset for qdma
    base on soc;
    the interrupt named "qdma-queueN(N:0,1,2,3)" correspond to a virtual
    block,N based on block number of qdma;

    Signed-off-by: Peng Ma <peng.ma@nxp.com>

commit 46123df3a174f0d76c8b954a0386e64841453836
Author: Florinel Iordache <florinel.iordache@nxp.com>
Date:   Thu Aug 9 12:29:18 2018 +0300

    arm64: dts: updates for Unified Backplane driver

    Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>

commit c08136017e8b18eb58b153129487c5dc760afd20
Author: Florinel Iordache <florinel.iordache@nxp.com>
Date:   Thu Aug 9 12:23:42 2018 +0300

    arm64: dts: ls1046: add support for 10GBase-KR

    Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>

commit 8473f478783f6f601e1c6d7e6afba49a13f3a6a3
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Mon Apr 2 16:24:33 2018 +0800

    arm64: dts: ls1046a: add dts entry for A-010650

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 3159fe9263fb145601ccb07fcb9336a68fba4e08
Author: Bao Xiaowei <xiaowei.bao@nxp.com>
Date:   Fri Oct 13 11:04:39 2017 +0800

    arm64: dts: ls1046a: add the property of IB and OB

    Add the property of inbound and outbound windows number for ep
    driver.

    Signed-off-by: Bao Xiaowei <xiaowei.bao@nxp.com>

    Acked-by: Minghuan Lian <minghuan.Lian@nxp.com>
    Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

commit c8fed58f3c9a0219fda0467791f61abd86eb97f3
Author: Abhimanyu Saini <abhimanyu.saini@nxp.com>
Date:   Wed Jan 24 22:56:48 2018 +0530

    arm64: dts: freescale: ls1046a: Modify DT nodes for qspi

    Signed-off-by: Abhimanyu Saini <abhimanyu.saini@nxp.com>

commit 96558859ea3a4af44c0b25441f7574ae6222509a
Author: Ran Wang <ran.wang_1@nxp.com>
Date:   Fri Jan 5 15:17:23 2018 +0800

    arm64: dts: ls1046a: Enable usb3-lpm-capable for usb3 node

    Enable USB3 HW LPM feature for ls1046a and active patch for
    snps erratum A-010131. It will disable U1/U2 temperary when
    initiate U3 request.

    Signed-off-by: Ran Wang <ran.wang_1@nxp.com>

commit 9b17a5fcf8da5656ff99ebef3d63ba040e9f676d
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Tue Jun 13 13:14:26 2017 +0800

    arm64: dts: correct the register range of dcfg

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 67c82e3c7b376139d7cee624589bedbc311f8868
Author: jiaheng.fan <jiaheng.fan@nxp.com>
Date:   Thu May 11 17:36:33 2017 +0800

    arm64: dts: ls1021/ls1043/ls1046: add qdma nodes

    Signed-off-by: jiaheng.fan <jiaheng.fan@nxp.com>

commit 4a6cef0c83748ee4f6641489fc324bd64095485d
Author: Chenhui Zhao <chenhui.zhao@nxp.com>
Date:   Fri May 5 17:53:27 2017 +0800

    arm64: dts: ls1046a: add ftm0 node

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
2019-11-25 16:10:33 +08:00
14e3e0f88c arm64: dts: ls1043a: accumulated change for ls1043a boards
commit 118e2f48ee8da3f5547c24888bd6fdb78f03b7ce
Author: Peng Ma <peng.ma@nxp.com>
Date:   Wed Jul 25 08:53:07 2018 +0000

    dts: fsl-ls1021a, fsl-ls1043a, fsl-ls1046a: add multi block node
support

    add block-offset to support different virtual block offset for qdma
    base on soc;
    the interrupt named "qdma-queueN(N:0,1,2,3)" correspond to a virtual
    block,N based on block number of qdma;

    Signed-off-by: Peng Ma <peng.ma@nxp.com>

Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Mon Apr 2 16:22:40 2018 +0800

    arm64: dts: ls1043a: add dts entry for A-010650

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit a47e4bd0b5d076feb6d81601c16d5b79e53a92c8
Author: Rajesh Bhagat <rajesh.bhagat@freescale.com>
Date:   Wed Jan 27 11:37:25 2016 +0530

    arm64: dts: ls1043a: Add configure-gfladj property to USB3 node

    Add "configure-gfladj" boolean property to USB3 node. This property
    is used to determine whether frame length adjustent is required
    or not

    Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
    Signed-off-by: Ran Wang <ran.wang_1@nxp.com>

commit 38566bbd5ca6747b30d2f0c251bbcfe0723df8c6
Author: Changming Huang <jerry.huang@nxp.com>
Date:   Wed Apr 19 12:49:50 2017 +0800

    arm/arm64: dts: Add property snps incr burst type adjustment for
INCR burst type for dwc3

    Signed-off-by: yinbo.zhu <yinbo.zhu@nxp.com>
    Signed-off-by: Ran Wang <ran.wang_1@nxp.com>

commit 8632d84e0fe187aa023a24f0dad0040c53e12450
Author: Abhimanyu Saini <abhimanyu.saini@nxp.com>
Date:   Thu Jan 25 11:31:13 2018 +0530

    arm64: dts: freescale: ls1043a: Modify DT nodes for qspi

    Signed-off-by: Abhimanyu Saini <abhimanyu.saini@nxp.com>

commit b1dc1ebed79e9aaab75fd06837d794ec2f1b624d
Author: Ran Wang <ran.wang_1@nxp.com>
Date:   Fri Jan 5 15:14:48 2018 +0800

    arm64: dts: ls1043a: Enable usb3-lpm-capable for usb3 node

    Enable USB3 HW LPM feature for ls1043a and active patch for
    snps erratum A-010131. It will disable U1/U2 temperary when
    initiate U3 request.

    Signed-off-by: Ran Wang <ran.wang_1@nxp.com>

commit 9b17a5fcf8da5656ff99ebef3d63ba040e9f676d
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Tue Jun 13 13:14:26 2017 +0800

    arm64: dts: correct the register range of dcfg

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit f60e39fd51ad702e3a2613faaca40871a4763735
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Tue Aug 22 18:04:02 2017 +0800

    arm64: dts: ls1043a: add pcf85263 rtc nodes

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 67c82e3c7b376139d7cee624589bedbc311f8868
Author: jiaheng.fan <jiaheng.fan@nxp.com>
Date:   Thu May 11 17:36:33 2017 +0800

    arm64: dts: ls1021/ls1043/ls1046: add qdma nodes
    Signed-off-by: jiaheng.fan <jiaheng.fan@nxp.com>

commit c6d9c2498ee83669f9853100301edff9a5905caf
Author: Wang Dongsheng <dongsheng.wang@nxp.com>
Date:   Fri Apr 21 13:26:07 2017 +0800

    arm64: dts: ls1043a: add ftm0 nodes

    Add rcpm and ftm0 nodes. The Power Management related features
    need these nodes.

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 3bcdc4de0a1c9e6f4a4ddc916e8efe8044d8bbfd
Author: Po Liu <po.liu@nxp.com>
Date:   Fri Sep 30 17:11:36 2016 +0800

    arm64: dts: ls1043/ls2080: add pcie aer/pme interrupt-name property

    Some platforms(NXP Layerscape for example) aer/pme interrupts was
not
    MSI/MSI-X/INTx but using interrupt line independently. This patch
    add "aer", "pme" interrupt-names for aer/pme interrupt.

    With the interrupt-names "aer", "pme" code could probe aer/pme
interrupt
    line for pcie root port, replace the aer/pme interrupt service irqs.

    This is intend to fixup the Layerscape platforms which aer/pmes
interrupts
    was not MSI/MSI-X/INTx, but using interrupt line independently.

    Since the interrupt-names "intr" never been used. Remove it.

    Signed-off-by: Po Liu <po.liu@nxp.com>
    Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

commit 4d20ecf029f1255520b30c103e1724c618b981c7
Author: Zhao Qiang <qiang.zhao@nxp.com>
Date:   Sun Jun 12 15:51:44 2016 +0800

    arm64: dts: ls1043ardb: add ds26522 node

    add ds26522 node to fsl-ls1043a-rdb.dts

    Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>

commit ca470562646ab058814fc4a1195016fb3266cdf5
Author: Zhao Qiang <qiang.zhao@nxp.com>
Date:   Sun Jun 12 15:44:11 2016 +0800

    arm64: dts: ls1043ardb: add qe node

    Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 16:10:33 +08:00
f3c0c9dd5b arm64: dts: ls1012a: accumulated change for ls1012a boards
commit 65c558ec270003e8e99cb58c940d3b913d08fa39
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Tue May 15 08:47:19 2018 +0800

    arm64: dts: ls1012a: correct the register range of dcfg

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit 8f7b4cded4ea1fca53516ae8f5d5bc89af291f26
Author: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
Date:   Mon May 7 11:52:04 2018 +0530

    arm64: dts: ls1012a: Add LS1012A-FRWY board support

    LS1012A-FRWY is a different design from LS1012A-FRDM,
    but has some common SoC features. Key feature on this
    board is 2x1G SGMII PFE MAC, Micro SD, USB 3.0, DDR,
    QuadSPI, Audio, UART.

    Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>

commit 94fc77837b3b6f4213a49b29ddc3e09e38ae5fbb
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Mon Apr 2 16:16:47 2018 +0800

    arm64: dts: ls1012a: add dts entry for A-010650

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit d4164a6d8cffd8f09c451073754834d58b7ace19
Author: Suresh Gupta <suresh.gupta@nxp.com>
Date:   Thu Feb 1 23:44:15 2018 +0530

    arm64: dts: freescale: ls1012a: Add DT nodes for qspi

    Signed-off-by: Abhimanyu Saini <abhimanyu.saini@nxp.com>
    Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>

commit 4fdc98a03492b732a48426a4180f7d6a36847e71
Author: Zhang Ying-22455 <ying.zhang22455@nxp.com>
Date:   Wed Nov 1 10:31:47 2017 +0800

    arm64: dts: ls1012a: correct the i2c clock to 1/4 platform pll

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>

commit bb534725996b92aff853a4dee43738629fd4ac08
Author: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
Date:   Wed Nov 29 06:31:23 2017 +0530

    arm64: dts: freescale: ls1012a: Disable PCIe node as default

    Keep PCIe node in "disabled" status as SoC default.
    Only enable it for boards with PCIe circuit designed,
    such as LS1012ARDB and LS1012AQDS.

    Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>

commit 6b9a3244baba2c5126f349800ecaad83ba97ee47
Author: Calvin Johnson <calvin.johnson@nxp.com>
Date:   Mon Oct 16 12:25:19 2017 +0530

    arm64: dts: freescale: ls1012a: fix RGMII tx delay issue

    Recently logic to enable RGMII tx delay was changed by
    below patch.

    https://patchwork.kernel.org/patch/9447581/

    Based on the patch, enabling tx delay again using rgmii-txid.

    Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
    Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>

commit 1e17e247088f6e2c08041559e38053b70a9d2bbe
Author: Calvin Johnson <calvin.johnson@nxp.com>
Date:   Sat Sep 16 14:20:23 2017 +0530

    arm64: dts: freescale: ls1012a: update with pppfe support

            Update ls1012a dtsi and platform dts files with
    support for ppfe.

    Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
    Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>

commit e9661ed864d2a9d437057f97729410bb9af994f2
Author: Suresh Gupta <suresh.gupta@nxp.com>
Date:   Tue May 16 17:17:21 2017 +0530

    arm64: dts: ls1012a: add the DTS node for QSPI support

    There is a s25fs512s qspi flash on QDS, RDB and FRDM board.

    Signed-off-by: Yuan Yao <yao.yuan@nxp.com>

commit ed9c51239461fe0322da2e93f50033ea0d05bc4f
Author: Chenhui Zhao <chenhui.zhao@nxp.com>
Date:   Fri May 5 17:45:15 2017 +0800

    arm64: dts: ls1012a: add ftm0 node

    Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
2019-11-25 16:10:32 +08:00
6d83fbd54e arm64: dts: ls2081ardb: Add DTS support for NXP LS2081ARDB
This patch add support for NXP LS2081ARDB board which has
LS2081A SoC.

LS2081A SoC is 40-pin derivative of LS2088A SoC
So, from functional perspective both are same.
Hence,ls2088a SoC dtsi files are included from ls2081ARDB dts

Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
Signed-off-by: Santan Kumar <santan.kumar@nxp.com>
Signed-off-by: Tao Yang <b31903@freescale.com>
Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
Signed-off-by: Abhimanyu Saini <abhimanyu.saini@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:10:32 +08:00
2eff676d71 dt-bindings: Add compatible string for LS1012A-FRWY
Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
2019-11-25 16:10:32 +08:00
5851ea5486 arm64: dts: ls1012a: Add more nodes to LS1012A-FRWY board support
LS1012A-FRWY is a different design from LS1012A-FRDM,
but has some common SoC features. Key feature on this
board is 2x1G SGMII PFE MAC, Micro SD, USB 3.0, DDR,
QuadSPI, Audio, UART.

Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:10:31 +08:00
1d87a84122 arm64: dts: ls1012a: Add LS1012A-2G5RDB board support
LS1012A-2G5RDB is a different design from LS1012ARDB,
but has some common SoC features. Key feature on this
board is 2.5Gbps SGMII.

Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:10:30 +08:00
9fb19305f1 sdk: arm64: dts: add DPAA1 SDK flavor dts files
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: Iordache Florinel-R70177 <florinel.iordache@nxp.com>
Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:10:29 +08:00
ab84ba883b sdk: arm64: dts: add/update DPAA1 include files for SDK flavor
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:10:29 +08:00
f599c955cf sdk: ppc: dts: New files for accumulated DPAA1 updates
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:10:28 +08:00
2aedffd062 sdk: ppc: dts: accumulated DPAA1 updates to existing files
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 16:10:27 +08:00
92622bd612 powerpc: dts: add power management nodes
Enable Power Management feature on device tree, including MPC8536,
MPC8544, MPC8548, MPC8572, P1010, P1020, P1021, P1022, P2020, P2041,
P3041, T104X, T1024.

Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 16:10:27 +08:00
7de94b7386 arm64: dts: imx8mq: use the DCSS DTRC interrupts
Needed for decoding tiled-compressed VPU formats.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:10:25 +08:00
423fc59500 dts: arm64: add dts for DCSS and rm67191
This DTS will be needed for the following display pipeline:

DCSS + MIPI_DSI + RM67191

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:10:25 +08:00
691017f1d2 arm64: dts: imx8mq: add DCSS entries to hdmi DTS
DCSS is needed for HDMI output to work.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:10:24 +08:00
2e0e5b0883 arm64: dts: imx8mq: add DCSS external oscillator support
The external oscillator, which is high precision, will be used when DCSS output
goes to HDMI.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:10:24 +08:00
c8e30ed1b4 arm64: dts: imx8mq: add DCSS node
This patch adds the node for iMX8MQ Display Controller Subsystem.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:10:23 +08:00
de7a191d84 arm64: dts: imx8mq: remove dcss entries from dts files
Remove the DCSS entries from DTS. Will add them back, after the upstream DCSS
driver is added back.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:10:22 +08:00
baabcb7a2c LF-121: arm64: dts: imx8qm-mek-dsp: Fix the typo
Fix typo "pdomains", should be "power-domains"

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:10:21 +08:00
dd8ddfd646 arm64: imx8-ss-dc1.dtsi: Correct display LPCG clocks in DC1 subsystem
This patch corrects display LPCG clocks in DC1 subsystem by
s/dc0_disp_lpcg/dc1_disp_lpcg/.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:21 +08:00
3b79fecbfe LF-38: arm64: dts: imx8mq: Remove imx8mq-evk-hdmi.dts
Remove imx8mq-evk-hdmi.dts file.
Because native hdmi is the default display for imx8mq evk board.
hdmi properties are moved to imx8mq-evk.dts.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:10:20 +08:00
ca9229d41b LF-39 arm64: dts: imx8mn Add busfreq support for imx8mn
Add busfreq support for imx8mn.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:10:19 +08:00
69456b33fa MLK-23015: add flexspi support for iMX8MN DDR4 EVK
Add flexspi support in iMX8MN DDR4 EVK dts

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:10:19 +08:00
1126a15315 MLK-23014: arm64: dts: add flexspi support for iMX8QM mek
add flexspi support in iMX8QM MEK dts file

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:10:18 +08:00
d837a99393 LF-47 arm64: dts: imx8mn: Add thermal support on imx8mn
Add thermal support on i.MX8MN.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:10:16 +08:00
df6bc51138 MLK-23007 ARM: dts: imx7s: Use 3MHz as GPT clock source
Use 3MHz as GPT clock source on i.MX7D to aligned with
previous releases.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:10:15 +08:00
8d1616fbcf MLK-22986-2: ARM: dts: imx6qdl/sl/sll/sx: add ldo-bypass
Add ldo-bypass support.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
2019-11-25 16:10:15 +08:00
037440f8ec MLK-23000-3 ARM64: dts: imx8qxp: add mlb dts
Add mlb dts file for imx8qxp-lpddr4-val platform.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:10:14 +08:00
556e21f406 ARM: dts: imx6ul: imx6ul-14x14-evk.dtsi: Fix SPI NOR probing
Without this "jedec,spi-nor" compatible property, probing of the SPI NOR
does not work on the NXP i.MX6ULL EVK. Fix this by adding this
compatible property to the DT.

Fixes: 7d77b8505a ("ARM: dts: imx6ull: fix the imx6ull-14x14-evk configuration")
Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Cc: Shawn Guo <shawnguo@kernel.org>
2019-11-25 16:10:13 +08:00
8f811e5379 arm64: dts: imx8mm-ddr4-evk: add dtb for panel RM67191
Create a new dts 'imx8mm-ddr4-evk-rm67191.dts' to
support panel 'RM67191' display which is attached
to DSIM controller directly on IMX8MM DDR4 board
to avoid conflict with ADV7535 display.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:10:12 +08:00
7eb30dd20c MLK-20420 ARM: dts: imx7ulp-evk: add delay cell for DDR50/DDR52 mode
We find some imx7ulp evk board, SD card work in DDR50 mode will meet
data CRC error. Only some board has this issue. And eMMC DDR50 mode
also has this issue on these boards. For DDR50, do tuning can fix
this issue, but eMMC DDR52 do not support tuning. So this patch
manually add the delay cell on the fixed clock (FBCLK_SEL = 0).
Currently, add 15 delay cell, which can make DDR50/DDR52 works stable
on all imx7ulp evk board.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
(cherry picked from commit ef369313de)

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:10:12 +08:00
8a1a24adab ARM: dts: imx7d-12x12-lpddr3: support audio sound card wm8958
Add imx7d-12x12-lpddr3-val-sai.dts to support wm8958

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:10:11 +08:00
8697b6ab32 MLK-22989 arm64: dts: imx8qxp-ss-img: disable gpio0_mipi_csi1 node
csi1 is not avaviable for imx8qxp, it should disable gpio0 node
that is part of csi1 resource.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:10:11 +08:00
bbc538743c MLK-22988 arm64: dts: imx8dxl-phantom-mek: disabled lvds subsystem
imx8dxl phanton mek board doesn't support lvds and dc0 subsystem
resources are not owned by A-core os. So disable lvds subsystem.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:10:10 +08:00
35e65b8d4a ARM: imx6qdl-sabreauto: enable mxc v4l2 capture
add mxc v4l2 capture node

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:10:10 +08:00
1be0196bb4 arm64: dts: imx8qxp-mek: Add IT6263 dual channel mode support
This patch introduces two DT source files to add IT6263 dual
channel mode support.  Either LVDS0 acts as the primary channel
or LVDS1 does.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:10 +08:00
8b04c3d5d5 arm64: dts: imx8qxp-mek: Add JDI WUXGA LVDS panel support
The JDI TX26D202VM0BWA WUXGA LVDS panel works in LVDS
dual channel mode.  It can connect with the i.MX8QXP
MEK board via J1(for LVDS0) and J3(for LVDS1) jacks.
Either LVDS0 or LVDS1 can be the primary channel.
The panel uses PWM signal supplied by i.MX8QXP to
control the backlight.  This patch adds the panel
support on the i.MX8QXP MEK platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:09 +08:00
7d5577a3ee arm64: dts: imx8qm-mek: Add JDI WUXGA LVDS panel support on LVDS1
This patch adds JDI WUXGA LVDS panel(on LVDS1) support
for the i.MX8QM MEK platform.
Note that the i.MX8QM MEK board needs a hardware rework
to add a 0ohm resistor for R211 to make the PWM backlight
work for the panel.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:08 +08:00
22087da0d6 arm64: dts: imx8qxp-mek: Add LVDS0/1 PWM backlight support
This patch adds LVDS0/1 PWM backlight support
for the i.MX8QXP MEK platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:07 +08:00
cf3eb6cd8f arm64: dts: imx8qm-mek: Add LVDS0/1 PWM backlight support
This patch adds LVDS0/1 PWM backlight support
for the i.MX8QM MEK platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:07 +08:00
099c2eaed2 arm64: imx8qxp-ss-lvds.dtsi: Add properties of aux ldb to support split mode
This patch adds properties of auxiliary ldb to support LDB split mode
for i.MX8QXP MIPI DSI/LVDS subsystem device tree.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:07 +08:00
17c0e99cfa arm64: imx8qxp-ss-lvds.dtsi: Add pwm_mipi_lvds0/1 support
This patch adds pwm_mipi_lvds0/1 support for
i.MX8QXP MIPI DSI/LVDS subsystem device tree.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:06 +08:00
a058412a5e arm64: imx8qm-ss-lvds.dtsi: Add pwm_lvds0/1 support
This patch adds pwm_lvds0/1 support for
i.MX8QM LVDS subsystem device tree.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:05 +08:00
2ff0f55f2f arm64: imx8qxp-ss-lvds.dtsi: Add mipi0/1_pwm_lpcg clocks support
This patch adds mipi0/1_pwm_lpcg clocks support for
i.MX8QXP MIPI DSI/LVDS subsystem device tree.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:05 +08:00
bcb66a5be4 arm64: imx8qm-ss-lvds.dtsi: Add lvds0/1_pwm_lpcg clocks support
This patch adds lvds0/1_pwm_lpcg clocks support for
i.MX8QM LVDS subsystem device tree.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:10:04 +08:00
c7dcf1ef9e MLK-22965 ARM64: dts: imx8dxl-phantom: add partition reset function
Enable rpsmg to add partition reset function support for imx8dxl-phantom
platform.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:10:03 +08:00
65ff6756ba arm64: dts: imx8mm: add fsl,dataline for SAI node
Add fsl,dataline for SAI node

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:10:02 +08:00
e44fce2e5f MLK-21653-3 arm: dts: add 'auto-cmd23-broken' for eMMC on imx6sx
Broken the auto cmd23 function for eMMC on imx6qpdl/imx6sx/imx7d, otherwise
the eMMC RPMB write access will return general fail.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:10:02 +08:00
f43ed0b101 MLK-22985 ARM: dts: imx7d sdb: remove the duplicated pin for uart6 node
Remove the duplicated pin function for uart6 node.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:10:01 +08:00
ac098c2384 ARM64: dts: freescale: imx8mn: correct clock setting for sdma1
sdma1 should work in clock ratio 1:2, thus ahb clock should be correct
to IMX8MN_CLK_AHB, otherwise, 1:1 clock ratio will be used wrong like
sdma2/3. Correct it to IPG@66Mhz/AHB@133Mhz.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:10:01 +08:00
5e11a3cf27 arm64: dts: add imx8qxp gpmi-nand dts
add gpmi-nand dts for nand support on imx8qxp val

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:10:00 +08:00
bb2b112553 MLK-22974-3 ARM: dts: imx7d sdb: reserve CMA memory for Display
Reserve CMA memory for Display

[ Aisheng: Ported from 4.19 GA ]
Tested-by: Robby Cai <robby.cai@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:10:00 +08:00
a0c0373f3e MLK-22974-2 ARM: dts: imx6sl/sll-evk: reserve CMA memory for Display
Reserve CMA memory for Display

[ Aisheng: Ported from 4.19 GA ]
Tested-by: Robby Cai <robby.cai@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:09:59 +08:00
2cc907bb2c MLK-22974-1 ARM: dts: imx6ul-evk: reserve CMA memory for GPU/MM/Display
Reserve CMA memory for GPU/MM/Display

[ Aisheng: Ported from 4.19 GA ]
Tested-by: Robby Cai <robby.cai@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:09:59 +08:00
c926c3af03 MLK-22764: ARM: dts: imx7ulp: Change sound card name
Change the sound card name from "rpmsg-audio" to "wm8960-audio".
That we can utilize the /var/lib/alsa/asound.state config
file to share same configuration as wm8960 sound card.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:09:58 +08:00
334cf0a275 arm64: dts: add flexspi in iMX8MN EVK dts
add flexspi support in iMX8MN EVK dts

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:57 +08:00
7085cfb62d MLK-22970 ARM: dts: imx6sll-evk: enable uart5 for bluetooth
Add uart5 port for bluetooth HCI interface.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:56 +08:00
bbe5a2face MLK-22918 arm64: dts: imx8: add the alias for ethernet
Add alias for ethernet nodes.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:56 +08:00
62e130bd57 ARM: dts: imx6/7: reserve CMA memory for GPU
At imx6dl/imx6q/imx6sx,reserve 320M CMA memory
At imx7ulp,reserve 200M CMA memory

Signed-off-by: Minjie Zhuang <minjie.zhuang@nxp.com>
2019-11-25 16:09:55 +08:00
3d56ae8d83 arm64: dts: add the rpmsg and enable rpmsg audio on imx8mn
Enable the RPMSG on iMX8MN DDR4 EVK platform, and verify the rpmsg
audio feature.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:55 +08:00
09cbc6b4dd arm64: dts: imx8qm-mek: Enable dc0/1_pc nodes
This patch enables dc0/1_pc device tree nodes for
the i.MX8QM MEK platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:53 +08:00
5db28f40ad arm64: dts: imx8qxp-mek: Enable dc0_pc node
This patch enables dc0_pc device tree node for
the i.MX8QXP MEK platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:52 +08:00
126088b01b arm64: imx8-ss-dc1.dtsi: Add dc1_pc phandle for dpu2
This patch adds dc1_pc phandle for dpu2 node.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:51 +08:00
0b60c34762 arm64: imx8-ss-dc0.dtsi: Add dc0_pc phandle for dpu1
This patch adds dc0_pc phandle for dpu1 node.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:51 +08:00
655c0c12ab arm64: imx8-ss-dc1.dtsi: Add pixel combiner node support
This patch adds pixel combiner device tree node support
for the i.MX8 DC1 subsystem.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:50 +08:00
01be2ba683 arm64: imx8-ss-dc0.dtsi: Add pixel combiner node support
This patch adds pixel combiner device tree node support
for the i.MX8 DC0 subsystem.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:50 +08:00
d7e2a439ce MLK-22964 arm64: dts: imx8dxl-phantom-mek: add nvmem for fec2 node
Add nvmem for fec2 node to get MAC address from eFuse.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:49 +08:00
1a753ad289 MLK-22962 arm64: dts: imx8qxp: correct fec2 compatible string
commit 3a1309af0048(arm64: dts: imx8qxp: update fec fallback
compatible string) not completely correct the fec compatible
string that only change fec1 node, not fec2 node. So the patch
correct fec2 node compatible string.

Fixes: 4f3c854068e4(arm64: dts: imx8qxp: orginize dts in subsystems)
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:48 +08:00
3ebf8faa47 MLK-22961 arm64: dts: imx8dxl-phantom-mek: enable epdev for pcie wlan
Enable epdev regulator for pcie wlan on imx8dxl phantom mek.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:48 +08:00
d1daf8a536 MLK-22960 ARM: dts: imx6sll-evk-btwifi: enable oob irq in default
Enable oob irq in default for imx6sll evk board.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:47 +08:00
e5712215f6 MLK-22959 ARM: dts: imx6sll-evk-btwifi: remove pin function node
Remove pin function node "imx6sll-evk-murata-v2" since
default dts "imx6sll-evk.dts" iomux node already remove
board pin function node.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:45 +08:00
6e65f83857 MLK-14451 ARM: dts: imx7ulp: Move dts entry for sensors into another dts
Sensors are connected to M4 and not to A-Core.
Sensors will not be exposed to A-Core via standard
i2c interface but via an i2c proxy layer over rpmsg.

Remove the dts entry to avoid the probe error messages and
add a separate dts file for the case where someone wishes to
rework the board themselves and connect sensors for testing purposes.

Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
(cherry picked from commit 05f0c61222)
2019-11-25 16:09:45 +08:00
2f6b19528e MLK-22921-4 ARM64: dts: imx8qxp/qm: add lpspi dts files
Add lpspi mater and slave dts files for imx8qxp/qm platforms.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:09:44 +08:00
eb0faf1296 MLK-22921-3 ARM: dts: imx7ulp: add lpspi slave dts support
Add some missing dts files of imx7ulp which file names have
been changed in 4.19.y.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:09:44 +08:00
dca41ea4b8 MLK-22921-2 ARM: dts: imx6ul: fix compile warning of spi slave dts
Add a address-cells property to fix compile warning of -ecspi-slave.dts.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:09:44 +08:00
701bc68961 ARM: dts: imx6: add *ldo dtb file
Add *ldo dtb board file to support board work in ldo-enable mode.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:09:42 +08:00
18a60fb286 MLK-22947 arm64: dts: imx8mm-ddr4-evk: use external osc as refclk
i.MX8MM ddr4 evk revC already use the external osc as the pcie
refclk, and previous boards not supported, so change the refclk
to osc in default.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:42 +08:00
084627fad7 MLK-16483 ARM64: dts: imx8mq-evk-pcie1-m2: add pcie1 M.2 interface support
Add pcie1 M.2 interface support.

The patch merged from commit: 21cb81b4f0bc(MLK-21084 arm64: dts: Copy all imx8 dts)

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:41 +08:00
f11d5aa6dc MLK-22284-3 ARM64: dts: freescale: imx8dx/qm: split dma channel power domain
Split dma channel power domain from sub-domain of dma customer driver
such as Audio, LPUART etc.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:09:41 +08:00
c1e14884a3 MLK-22930 ARM64: dts: change the source clock rate of usdhc1 for imx8qxp/imx8qm
On imx8qxp and imx8qm mek board, usdhc1 is for eMMC usage, and will work at
HS400 mode, this HS400 mode will work at 200MHz, and will default divide 2 from
source clock(IMX_SC_R_SDHC_0), which mean we need to config the source clock
to 400MHz at least.

Before this patch, HS400 mode only work at 100MHz, and will meet some timeout issue
when do system suspend/resume, due to our HS400 related timing setting is based on
the 200MHz. Also, HS400 work at 100MHz will impact the performance.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Tested-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:40 +08:00
7f0da9ae99 Revert "arm64: dts: imx8mq: Disable sysctr because it breaks cpuidle"
This reverts commit 9b9ae1e2d639973ca826f839717e2b2405df5f51.

Was an emergency hotfix but real problem was solved

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:09:40 +08:00
98f9370985 arm64: dts: imx8qm-mek: Enable dc0/1_dpr1_channel3 and dc0/1_dpr2_channel1-3 nodes
This patch enables dc0/1_dpr1_channel3 and dc0/1_dpr2_channel1-3 nodes
for the i.MX8QM MEK platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:39 +08:00
fabf88b1b5 arm64: dts: imx8qxp-mek: Enable dc0_dpr1_channel3 and dc0_dpr2_channel1-3 nodes
This patch enables dc0_dpr1_channel3 and dc0_dpr2_channel1-3 nodes
for the i.MX8QXP MEK platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:39 +08:00
74b52782ff arm64: dts: imx8qm-mek: Enable dc0_prg3-9 and dc1_prg3-9 nodes
This patch enables dc0_prg3-9 and dc1_prg3-9 device tree nodes for
the i.MX8QM MEK platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:37 +08:00
3eb1122b82 arm64: dts: imx8qxp-mek: Enable dc0_prg3-9 nodes
This patch enables dc0_prg3-9 device tree nodes for
the i.MX8QXP MEK platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:37 +08:00
0f48f49add arm64: imx8-ss-dc1.dtsi: Add dc1_dpr1_channel3 and dc1_dpr2_channel1-3 phandles for dpu2
This patch adds dc1_dpr1_channel3 and dc1_dpr2_channel1-3 phandles for dpu2
node.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:36 +08:00
0e98761734 arm64: imx8-ss-dc0.dtsi: Add dc0_dpr1_channel3 and dc0_dpr2_channel1-3 phandles for dpu1
This patch adds dc0_dpr1_channel3 and dc0_dpr2_channel1-3 phandles for dpu1
node.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:36 +08:00
672cfd49a3 arm64: imx8-ss-dc1.dtsi: Add dc1_dpr1_channel3 and dc1_dpr2_channel1-3 support
This patch adds dc1_dpr1_channel3 and dc1_dpr2_channel1-3 device tree
nodes support for i.MX8 DC1 subsystem.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:35 +08:00
0ba94b8535 arm64: imx8-ss-dc0.dtsi: Add dc0_dpr1_channel3 and dc0_dpr2_channel1-3 support
This patch adds dc0_dpr1_channel3 and dc0_dpr2_channel1-3 device tree
nodes support for i.MX8 DC0 subsystem.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:35 +08:00
c2c1fbdf9c arm64: imx8-ss-dc1.dtsi: Add dc1_prg3 to dc1_prg9 support
This patch adds dc1_prg3 to dc1_prg9 device tree nodes support
for i.MX8 DC1 subsystem.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:34 +08:00
2b6086fc94 arm64: imx8-ss-dc1.dtsi: Add dc1_prg3 to dc1_prg9 support
This patch adds dc1_prg3 to dc1_prg9 device tree nodes support
for i.MX8 DC0 subsystem.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:09:33 +08:00
3b2a18a0a0 MLK-22939 arm64: dts: imx8-ss-img: fix gpio reg
Fix gpio reg

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 16:09:33 +08:00
aa7aad6a7d arm64: dts: imx8qm: specify the sid of sata module
Specify the SID of SATA. Otherwise, uboot would configure the SID by
the power domain.
And would break PCIe functions since SATA module has PCIe's power
domain too.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 16:09:32 +08:00
e8c3b884e9 MLK-22902 arm64: dts: imx8qm-ss-hdmi: fix i2c0_hdmi node
The reg property is wrong, address/size cells are 1

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:09:31 +08:00
e7b74f9330 MLK-22933 ARM: dts: imx6qdl-sabreauto: disable gpmi node due to pin conflict
GPMI NAND has pin conflict with uart3, and there already
have extra dts "*-gpmi-weim.dts" files to enable GPMI, so
disable GPMI in sabreauto default dts.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:09:30 +08:00
cb16d6194d MLK-22932 ARM: dts: imx6qdl: apply ENET IRQ workaround for sabresd/sabreauto boards
i.MX6Q/DL ENET cannot wake up system in wait mode because ENET
tx & rx interrupt signal don't connect to GPC. Add ENET GPIO IRQ
workaround for sabresd/sabreauto boards.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:09:30 +08:00
e6effcaa03 arm64: dts: freescale: add the rpmsg node on imx8dxl phantom mek board
Add the RPMSG node on iMX8DXL phantom MEK board.

Signed-off-by: richard zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:29 +08:00
785749398f arm64: dts: freescale: Add the pcie on imx8dxl phantom mek board
Add the PCIe on iMX8DXL phantom MEK board.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:28 +08:00
bda3f9898b arm: dts: imx6dl: dcic2: Add dcic1 clock to dcic2 property
dcic2 depend in dcic1 clock, add the clock to dcic2 to avoid
dcic2 hang.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:09:27 +08:00
070501e253 MLK-22912 ARM64: dts: add synaptics_dsx touch support for imx8mn/imx8mq
Enable the synaptics_dsx touch support when use rm67191 screen.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:09:27 +08:00
baf340ecc3 arm: dts: add gpmi weim dts for imx6ulz
add gpmi weim dts for imx6ulz 14x14 evk

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:27 +08:00
29d98b1086 arm: dts: add gpmi weim dts for imx6ull
add gpmi weim dts for imx6ull 14x14 evk

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:26 +08:00
124231a4fb arm: dts: add gpmi weim dts for imx6ul
add gpmi weim dts for imx6ul

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:26 +08:00
d1609c1a6b arm: dts: add both ecspi and ecspi slave dts for imx6ul
add both ecspi and ecspi slave dts for imx6ul 14x14 evk

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:25 +08:00
d1eb3e07a4 arm: dts: add gpmi weim dts for imx6qp sabreauto
add gpmi weim dts for imx6qp sabreauto

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:23 +08:00
f33c5600e6 arm: dts: add ecspi dts for imx6qp sabreauto
add ecspi dts for imx6qp sabreauto

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:22 +08:00
fc40a77dac arm: dts: add gpmi weim dts for imx6q sabreauto
add gpmi weim dts for imx6q sabreauto

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:21 +08:00
b0b179fb4a arm: dts: add ecspi dts for imx6q sabreauto
add ecspi dts for imx6q sabreauto

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:21 +08:00
7369387d9b arm: dts: add gpmi weim dts for imx6dl sabreatuo
add gpmi weim dts for imx6dl sabreatuo

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:20 +08:00
d9f7df84dc arm: dts: add ecspi dts for imx6dl sabreauto
add ecspi dts for imx6dl sabreauto

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:09:20 +08:00
724a66a1fc arm:dts:imx: dropping leading 0s on ocram nodes
removing all the leading "0x" and zeros to fix the
following dtc warnings:

Warning (unit_address_format): Node /XXX unit name should not have leading "0x"
and
Warning (unit_address_format): Node /XXX unit name should not have leading 0s

Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com>
2019-11-25 16:09:19 +08:00
c6aa28920d MLK-18036-1 Add "fsl,optee-lpm-sram" node for optee os power management.
This node will be used by the OCRAM driver in optee to:
* Get the OCRAM start address for power management in optee.
* Add an entry that will overwrite ocrams nodes and dynamically reduce
the OCRAM available for mmio-sram in Linux.

That way we do not touch the legacy Linux boot and remove the dedicated
optee device tree.

Signed-off-by: Clement Faure <clement.faure@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
[Arul: Fix merge conflicts]
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:09:18 +08:00
e29d148d3b MLK-22484: arm64: dts: Fix mem clock for asrc
The mem clock is used to access the register, if there is no
mem clock defined, we should use the ipg clock instead,
otherwise there will be kernel dump after system reboot.

[    3.010962] Kernel panic - not syncing: Asynchronous SError Interrupt
[    3.010964] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.19.35-05057-g2134d856e6b2 #2889
[    3.010966] Hardware name: Freescale i.MX8QXP MEK (DT)
[    3.010968] Call trace:
[    3.010969]  dump_backtrace+0x0/0x178
[    3.010971]  show_stack+0x14/0x20
[    3.010972]  dump_stack+0x8c/0xac
[    3.010974]  panic+0x120/0x28c
[    3.010975]  __stack_chk_fail+0x0/0x18
[    3.010977]  arm64_serror_panic+0x74/0x80
[    3.010979]  do_serror+0x68/0x130
[    3.010980]  el1_error+0x7c/0xdc
[    3.010982]  _raw_spin_unlock_irqrestore+0xc/0x48
[    3.010984]  clk_core_disable_lock+0x28/0x38
[    3.010985]  clk_disable+0x1c/0x30
[    3.010987]  regmap_mmio_write+0x54/0x68
[    3.010989]  _regmap_bus_reg_write+0x14/0x20
[    3.010990]  _regmap_write+0x60/0xa8
[    3.010992]  regmap_write+0x48/0x70
[    3.010994]  fsl_asrc_probe+0x258/0x660
[    3.010995]  platform_drv_probe+0x50/0xb0

Why this issue only happen at kernel reboot, it is because the ipg
clock is enabled in default after system reset, after used once, the
ipg clock is disabled, then reboot system, the issue happen.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:09:17 +08:00
7c15bdabdb arm64: dts: freescale: Add i.MX8DM LPDDR4 validation board support
Add i.MX8DM validation board DT support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:16 +08:00
444be9e696 arm64: dts: freescale: Add i.MX8DX 17x17 validation board support
Add i.MX8DX 17x17 validation board DT support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:16 +08:00
5553d3dcf5 arm64: dts: freescale: Add i.MX8QP LPDDR4 validation board support
Add i.MX8QP LPDDR4 validation board DT support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:15 +08:00
5b12c6cd17 arm64: dts: freescale: Add i.MX8QM DDR4 validation board support
Add i.MX8QM DDR4 validation board DT support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:14 +08:00
e2fa38ac48 arm64: dts: freescale: Add i.MX8DX LPDDR4 validation board support
Add i.MX8DX LPDDR4 validation board DT support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:14 +08:00
347dea76ee arm64: dts: freescale: Add i.MX8QXP 17x17 validation board support
Add i.MX8QXP 17x17 Validation board DT support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:13 +08:00
321ad8ae90 arm64: dts: freescale: Add i.MX8DXP LPDDR4 validation board support
Add i.MX8DXP LPDDR4 validation board DT support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:13 +08:00
2882394893 MLK-22900 ARM: dts: change to use off-on-delay-us in regulator
After commit f7907e57ae ("regulator: fixed: add off-on-delay"), user
can use "off-on-delay-us" to define the regulator off-delay time.

For SD card, according to the spec requirement, for sd card power reset
operation, it need sd card supply voltage to be lower than 0.5v and keep
over 1ms, otherwise, next time power back the sd card supply voltage to
3.3v, sd card can't support SD3.0 mode again.

This patch add the off-on-delay-us to each board, make sure the sd power
reset behavior is align with the specification. Without this patch, when
do quick system suspend/resume test, some sd card can't work at SD3.0 mode
after system resume back.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:09:11 +08:00
7a34d0e8b2 arm64: dts: imx8qm: Add LPDDR4 validation board single cluster support
Add *-ca53.dtb and *-ca72.dtb to support booting up single
cluster on LPDDR4 validation board, to boot up single A72 cluster,
dedicated flash.bin needs to be used.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:11 +08:00
414eb312b2 arm64: dts: imx8qxp: Add DDR3L validation board support
Add i.MX8QXP DDR3L validation board support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:10 +08:00
08ad932a5a arm64: dts: imx8qxp: Add MEK/VAL board with A0 chip support
Add i.MX8QXP MEK/VAL board with A0 chip support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:10 +08:00
292017b6f2 ARM: dts: imx6sll: Add EVK Rev-A board support
Add i.MX6SLL EVK Rev-A board DT support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:10 +08:00
3ad8cc16ef ARM: dts: imx6: enable Murata 1MW M.2 card for imx6 legacy platforms
Enable Murata 1MW M.2 card for i.MX6 legacy platforms. Plug in
Murata 1MW M.2 into SD slot by using Murata uSD-to-M.2 Adapter.

Below i.MX6 legacy platforms will be supported:
- i.MX6Q/QP/DL SDB, SD2 slot
- i.MX6SX SDB, SD2 slot
- i.MX6SLL EVK, SD3 slot
- i.MX6UL/ULL/ULZ EVK, SD1 slot

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:09 +08:00
56d26191f3 MLK-18675-23 ARM: dts: imx7d-sdb: add wifi bcm4339 support with fmac driver
Add wifi bcm4339 support with fmac driver.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[Arul: Fix merge conflicts]
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:09:08 +08:00
9335122c7c arm64: dts: imx8mn-ddr4-evk: enable wlan/bt HIF
Enable sdio HIF for wlan, and uart HIF for bluetooth to
support cypress cyw43455 wireless solution.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:08 +08:00
47dfa42215 MLK-20717 arm64: dts: imx8mm: set ddr4 evk with cyw43455 board as default
Since the ddr4 evk with qca9377 board is out support, so set the
ddr4 evk with cyw43455 board as the default support.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked and merged from commit: d260e22591)
2019-11-25 16:09:07 +08:00
6fff98a134 arm64: dts: imx8mq-evk: enable pcie wireless
Enable 32Khz for cypress cyw4356/cyw4359 and Marvell 88w8997.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:06 +08:00
1331da5cfd MLK-20685-05 arm64: dts: imx8qm/qxp: add cyw4356 and cyw4359 support
Add cyw4356 and cyw4359 support on imx8qm MEK boards..

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:05 +08:00
4147cf5921 arm64: dts: imx8qxp-mek: enable pcie wireless
Enable pcie wireless for M.2 interface.
That support cypress and marvell pcie wlan.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:09:05 +08:00
a13734a302 arm64: dts: imx8mn-ddr4-evk: add a new dts for rm67191 display
Add a new dts imx8mn-ddr4-evk-rm67191.dts to support the
mipi panel RM67191 display on IMX8MN DDR4 EVK board.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:09:04 +08:00
ff632e4791 arm64: dts: imx8mn-ddr4-evk: enable adv7535 HDMI display
Enable LCDIF --> MIPI DSIM --> ADV7535 HDMI display for
imx8mn-ddr4-evk board.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:09:04 +08:00
b8dce51356 arm64: dts: imx8mn: add display devices nodes
Add LCDIF, MIPI DSI, display subystem display devices
and the required resets nodes.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:09:03 +08:00
74c03e2c35 arm64: dts: imx8mm: rename apb clock names for dispmix reset
Rename the apb clock names from 'apb-clk' to 'disp_apb_root_clk'
for dispmix reset nodes, since in commit f541de184245(reset: imx8m:
Correct clock name for dispmix driver), it changes the apb clock
name.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:09:03 +08:00
20517363b0 arm64: dts: imx8mm: Define resets for LCDIF and DSIM
The dispmix-reset device can be used to control the LCDIF and
DSIM bus reset and clock enable. So define 'resets' property
for both LCDIF and DSIM for this purpose which will be used to
replace 'dispmix_gpr' usage.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:09:02 +08:00
5b44f9e58b arm64: dts: imx8mm: Add 'dispmix-reset' device
Create a new device node 'dispmix-reset' to describe the
reset controller in DISPMIX to control several submodules
bus and clock reset and enable. All the reset lines can be
divided into three groups: sft_rstn, clk_en and mipi_rst.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:09:01 +08:00
54f66ad5c2 arm64: dts: imx8qxp: Add CPU cooling support
Add CPU cooling support for i.MX8QXP.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:00 +08:00
b3234f8eac arm64: dts: imx8qm: Update thermal zone number to support PMIC thermal zone
Update thermal zone number to 6 to support PMIC thermal zone.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:00 +08:00
c460ce429f arm64: dts: freescale: Add i.MX8DXL phantom mek board
Add i.MX8DXL phantom mek board DT.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:09:00 +08:00
8a414a8149 arm64: dts: imx8qm: Disable dsp lpcg clock
There is no LPCG clock defined for DSP in imx8qm, so disable
dsp lpcg clock.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:08:59 +08:00
f677bffe25 arm64: dts: imx8qm: Add A72 cluster cpufreq support
Add A72 cluster OPP table to support cpufreq.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:08:59 +08:00
4960791f49 arm64: dts: imx8qm: Add support for booting up single cluster
Add *-ca53.dtb and *-ca72.dtb to support booting up single
cluster, to boot up single A72 cluster, dedicated flash.bin
needs to be used.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:08:58 +08:00
860b4dc027 arm64: dts: imx8qm-mek.dts: Enable A72 cluster by default
Enable A72 cluster by default to support 6 CPUs totally.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:08:56 +08:00
8e94bae57f arm64: dts: imx8qm-lpddr4-val.dts: Enable A72 cluster by default
Enable A72 cluster by default.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:08:56 +08:00
38e057ea06 arm64: dts: imx8qm: Add A72 cluster thermal zone
Add A72 cluster thermal zone support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:08:55 +08:00
4f63a7faca arm64: dts: imx8qm imx8qxp: enable mailbox for vpu
- The mailbox of mu_m0 is used by vpu decoder
- The mailbox of mu1_m0 and mu2_m0 are used by vpu encoder
  mu2_m0 only enabled on imx8qm

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 16:08:54 +08:00
510ef26e4e arm64: dts: imx8qm: add smmu
Add smmu node, enable smmu for usdhc/fec/usb/sata

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 16:08:54 +08:00
805cf7d9ed arm64: dts: imx8mq: Support TDM format for audio sound card
Support TDM format for audio sound card

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:08:53 +08:00
e2c104291c arm64: dts: imx8mm: Support TDM format for audio sound card
Support TDM format for audio sound card

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:08:52 +08:00
e8b2c5ec86 arm64: dts: imx8qm-lpddr4-val: support audio sound card
Add support audio sound card (ESAI/ASRC/AMIX/CS42888/MQS)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:08:51 +08:00
0e1ccc89bb arm64: dts: imx8qxp-lpddr4-val: support audio sound card
Add support audio sound card (ESAI/ASRC/AMIX/CS42888/MQS)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:08:51 +08:00
355e11eebf ARM: dts: imx6ull-14x14-evk: enable csi and ov5640
enable csi and ov5640

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:50 +08:00
e5ce0ffcb6 ARM: dts: imx6ul-14x14-evk: add new dts file for CSI support
add new dts file for CSI support, as there's pin conflict with SIM2

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:49 +08:00
4a462be0ff ARM: dts: imx6qdl-sabreauto: use internal version of adv7180 driver
change compatible string to use internal version of adv7180 driver

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:49 +08:00
7380ea70ff arm: dts: imx: add emmc support on imx6ulz
eMMC on EVK board share the same USDHC with Micro-SD.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:08:48 +08:00
714b71358e ARM: dts: imx7d-sdb: add syscon-poweroff
Add syscon-poweroff device node for i.mx7d.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:08:48 +08:00
6738f1d9e1 arch: arm: dts: add dts file to enable can1
Add dts file to enbale can1 which is pin conflict with fec on
i.MX6Q/QP/DL sabreauto board.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:08:48 +08:00
c4d79d3680 arm64: dts: imx8mn: Add LPDDR4 EVK support
Add i.MX8MN LPDDR4 EVK support, make it as default EVK board
as usual.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:08:47 +08:00
ac9bc21178 dts: arm: imx6qdl auto: set hdmi to disp_id 1
set hdmi to disp_id 1.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:08:46 +08:00
c09c36a6a4 arm64 dts: add vpuenc2 for imx8qm vpu_encoder
Add 'IMX_SC_R_VPU_ENC_1' for imx8qm vpu_encoder.
Unify name as vpuenc1 and vpuenc2

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 16:08:46 +08:00
1e60413b77 ARM: dts: imx7d-sdb: move pin LPSR_GPIO1_IO04 to iomuxc_lpsr
PIN LPSR_GPIO1_IO04 is LPSR pin, then move it to iomuxc_lpsr
node. And remove the dummy pin group for the PIN.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:08:45 +08:00
908ef148d7 arm64: dts: imx8mn: add device nodes support for camera
Camera subsystem of imx8mn is consist of ISI, MIPI CSI and OV5640
sensor, add device nodes for them.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:08:45 +08:00
57101fca3c arm: dts: move the sai3 pinctrl to the correct group
one of the sai3 pinctrl should be in lpsr iomux group rather than
in iomux group, which messes up the QSPI iomux control.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:08:44 +08:00
f88b8eac9a arm: dts: enabled qspi on imx7d
change the dts description to adapt to spi-mem and disable the
conflict epdc module.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:08:42 +08:00
dcf5630d5f ARM: dts: imx6sx: Support audio sound card for sabreauto board
Support audio sound card for sabreauto board

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:08:41 +08:00
1a76277d9d MLKU-25-2-fix ARM: dts: imx: add secure memory for 6qdl
-add missing secure memory node for 6qdl
-fix register size for 6ul and 6sx

Fixes: 069951d3976d ("MLKU-25-2 ARM: dts: imx: add secure memory")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:08:40 +08:00
2cda90cb7e arm64: dts: imx8mn: add dispmix reset support in dts for imx8mn
Enable dispmix reset controller function in dts for imx8mn

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:08:40 +08:00
5b10cf377d ARM64: imx8qm/imx8qxp: Remove unused audio route
Remove unused audio route for issue:
[    3.087278] imx-wm8960 sound-wm8960: ASoC: no source widget found for ASRC-Playback
[    3.094959] imx-wm8960 sound-wm8960: ASoC: Failed to add route ASRC-Playback -> direct -> CPU-Playback
[    3.104292] imx-wm8960 sound-wm8960: ASoC: no sink widget found for ASRC-Capture
[    3.111712] imx-wm8960 sound-wm8960: ASoC: Failed to add route CPU-Capture -> direct -> ASRC-Capture
[    3.121031] imx-wm8960 sound-wm8960: snd_soc_register_card failed (-19)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:08:39 +08:00
82aeb151c7 arm64: dts: imx8mq: add inmate/root dts
Add inmate/root dts for jailhouse dual linux case.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 16:08:38 +08:00
0d974bbbf3 arm64: dts: imx8mn: add inmate/root dts
Add inmate/root dts for jailhouse dual linux case.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 16:08:38 +08:00
9bf2a37108 arm64: dts: imx8mm: add inmate/root dts
Add inmate/root dts for jailhouse dual linux case.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 16:08:37 +08:00
4acf3940c9 ARM64: imx8mm-evk: Move assign clocks of audio PLLs to correct place
Put assigned clocks of audio PLLs in imx8mm-evk.dts, which conflict
with the assigned clocks in imx8mm.

Fixes: 77b5daa55e63 ("ARM64: dts: imx8mm: Enable AK4497/AK4458/AK5558/SPDIF/MICFIL")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:08:36 +08:00
55508ab478 arm64: dts: imx8mq: Disable sysctr because it breaks cpuidle
For some reason the activating the upsteam sysctr driver causes cpuidle
hangs on imx8mq.

Temporarily disable this until the root cause can be figured out. This
reverts to behavior in linux-nxp before rebase from next-20190809 to
v5.4-rc3.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:08:35 +08:00
57ad127809 arm: dts: imx6sx: Add vadc properity
Add vadc properity.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:08:35 +08:00
293b8f994c arm: dts: imx6: Add hdmi property to sabreauto dts files
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:08:34 +08:00
bf650f5fe5 MLK-22752-4 ARM: dts: imx7s: Add power domain for imx7d HSIC
Otherwise, the system will hang if USB driver try to access
portsc register.

Cc: André Draszik <git@andred.net>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:08:34 +08:00
1c45d36d3d MLK-22721 ARM: dts: imx6ul-14x14-evk.dtsi: configure USBOTG1 ID pinctrl
Without configuring this pinctrl, the ID value can't be got correctly,
then, the dual-role switch can't work well.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:08:34 +08:00
c6e4ab93f4 arm64: dts: Add mxc-jpeg decoder/encoder nodes for imx8qxp/qm
Add jpeg decoder/encoder nodes imx8qxp & imx8qm.

At this stage, labgrid tests pass on imx8qxp/qm.
Also, basic v4l2-compliance tests pass on imx8qxp/qm.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:08:33 +08:00
853c80da34 arch: arm: imx6qdl-sabreauto: add back pinctrl-assert-gpios property for CAN
pinctrl-assert-gpios, this property does not exist in upstream, need add
back.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
(cherry picked from commit 4577fefdc5bc5e7de7a0a2f904fefc8445d68ac9)
2019-11-25 16:08:33 +08:00
dc4bf2dd54 arch: arm: imx6ul14x14: add back pinctrl-assert-gpios and registers-default property for CAN
pinctrl-assert-gpios and registers-default, these properties does not exist
in upstream, need add back.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
(cherry picked from commit 8492eb228a80712059d1873c613954b180f009ae)
2019-11-25 16:08:31 +08:00
dcadf53022 ARM: dts: imx6ull-14x14-evk: Add assigned-clocks for audio PLL
Add assigned-clocks for audio PLL

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 12727b6d7c6f47452c14da34edc9c1194ea81cde)
2019-11-25 16:08:30 +08:00
af572c4c9d ARM64: dts: imx8mq-evk: enable csi bridge, mipi csi and mipi camera ov5640
enable csi bridge, mipi csi and mipi camera ov5640

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 7f7bbb2dfb7a19381f1f6dab75110329b89dc05b)
2019-11-25 16:08:30 +08:00
a532ea7777 ARM64: dts: imx8mq: add csi and mipi csi node
add csi bridge and mipi csi node

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 7028095660d45064d7a1404c26b9a4f00d034043)
2019-11-25 16:08:29 +08:00
0aea80b560 MLK-22746-1 dts: add wifi device support in i.MX8mm device tree
Add usdhc1 node which represent wifi device.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
(cherry picked from commit ae940d9d4393b7b1fa68faf61f4755310d0f564c)
2019-11-25 16:08:29 +08:00
a92d83813f ARM: imx6qdl-sabreauto.dtsi: Change LDB_DI0/1_SEL clk's parent to PLL2_PFD0_352M
This patch changes LDB_DI0/1_SEL clock's parent from PLL3_USB_OTG to
PLL2_PFD0_352M so that it aligns with imx_4.19.y kernel. Also, with
this patch applied, the clock tree may provide ~64.6MHz pixel clock
rate to the Hannstar XGA LVDS panel, which is closer to the desired
65MHz(before the change, it's ~68.5MHz).

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 142b7222bbebe521d3f4b8d3850c40bd7660a7cf)
2019-11-25 16:08:28 +08:00
10cc7dba5b ARM: imx6qdl-sabresd.dtsi: Change LDB_DI0/1_SEL clk's parent to PLL2_PFD0_352M
This patch changes LDB_DI0/1_SEL clock's parent from PLL3_USB_OTG to
PLL2_PFD0_352M so that it aligns with imx_4.19.y kernel. Also, with
this patch applied, the clock tree may provide ~64.6MHz pixel clock
rate to the Hannstar XGA LVDS panel, which is closer to the desired
65MHz(before the change, it's ~68.5MHz).

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit a76d0c86ada7717c1cb556a1ac1fc4dd022db8bc)
2019-11-25 16:08:27 +08:00
f6cae0a82b arm64: dts: imx8qm: add emvsim device node
Add emvsim device node for imx8qm mek.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
(cherry picked from commit e4586a8fddc499296abc1442ff3291559fb77e97)
2019-11-25 16:08:26 +08:00
81990ba6e8 clk: imx8qxp: Add JPEG encode/decode clocks
Clocks needed by JPEG Encoder/Decoder Linux V4L2 driver.
These additions are based on linux-imx/imx_4.19.y.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Tested-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
(cherry picked from commit 7ac4b9c761b133cfb364d269d7e64db57c4863d8)
2019-11-25 16:08:25 +08:00
adc1246178 ARM64: dts: imx8mm: increase cma size to '0x28000000'
Default is only about 300MB, not enough for some multi-instance test

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 43b40a50f66d7e6e83775a9568546a92876956d1)
2019-11-25 16:08:25 +08:00
da6d896963 ARM: dts: imx6sx-sdb: enable ldb and lcdif2
enable ldb and lcdif2

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 130202618e293f273419dd4c377fc936c66bd313)
2019-11-25 16:08:25 +08:00
1952772adf ARM: dts: imx6sx: add ldb node for lvds
add ldb node for lvds

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit f7647936eae0e75614455b8e99b0a1d68a1d26b1)
2019-11-25 16:08:24 +08:00
0220e32be0 ARM: dts: imx6: change cpu-dai to audio-cpu
change cpu-dai to audio-cpu for alignment between
imx-wm8962 and fsl-asoc-card

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 010293d320968ac8b74ae2beff2815574efaf2a6)
2019-11-25 16:08:23 +08:00
3f61393166 ARM: dts: imx6sll: change compatible string for sdma
change compatible string for sdma

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 12c7a2a0fa87a09977eb5582a28f39db29b11f00)
2019-11-25 16:08:23 +08:00
b7a4e60c6b Revert "ARM: dts: Disable ov564x cameras"
This reverts commit fbfe81a9783a604226689455666abdad472e37aa.

(cherry picked from commit c4786ad992e5e48d474ee5cf15af0a292b61bc62)
2019-11-25 16:08:23 +08:00
f860033b77 ARM: dts: imx6qp-sabresd: adjust AVDD and DOVDD for camera ov5640
on imx6qp sabresd board, use different regulators for AVDD and DOVDD
power supply for camera ov5640 (both parallel and mipi).

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 2f372c5776fd84541577bc61a9501795206d1dd0)
2019-11-25 16:08:21 +08:00
eb6281aee4 ARM64: dts: imx8mm: Add dai-tdm-slot-num and dai-tdm-slot-width
Add dai-tdm-slot-num and dai-tdm-slot-width for sound-wm8524

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 874740c7dcceb0704e68cacf57b3ea907c3b2710)
2019-11-25 16:08:20 +08:00
a9b28af0c8 ARM: dts: imx6ull-14x14-evk: Improve model name
Improve model name which is used as machine name in
soc driver to meet test team's auto test requirement.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit b7d8943bb1b2342a431424e7e4c3c9094d35fa5c)
2019-11-25 16:08:20 +08:00
74dbce2397 ARM: dts: imx6dl: Correct cpu clocks
cpu clocks should match cpufreq's clk table, otherwise,
cpufreq driver probe will fail.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit ca2dadb6be4a30b3b8b429faa2bbbd8c86ab9eae)
2019-11-25 16:08:19 +08:00
e5907a9126 arm64: dts: imx8mq: Remove GPU/VPU thermal zone
Remove GPU/VPU thermal zones to make it aligned with
previous NXP internal tree.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit 6bcd8249cb717c8525bd69c9ca501d378b67e0be)
2019-11-25 16:08:19 +08:00
c685791ca6 MLKU-25-2 ARM: dts: imx: add secure memory
This is a rework of the following i.MX BSP commits
(rel_imx_4.19.35_1.1.0_rc2):

e165190049 ("MLK-12339 Security: Missing caam support.")
dfc914b909 ("ARM: dts: imx6ul: Add caam")
9d9ca7a03e ("MLK-11922 i.mx6: Linux 3.14.28 CAAM & SNVS enabled by default. JTAG, DS-5 attachment causes exceptions")
42993884b1 ("MLK-18082: ARM: dts: imx: Change size of caam-sm to correct size")

Signed-off-by: Dan Douglass <dan.douglass@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:08:18 +08:00
bd7968b6f1 MLKU-25-1 dt-bindings: crypto: fsl: add secure memory
This is a rework of the following i.MX BSP commit
(rel_imx_4.19.35_1.1.0_rc2):
0adf02011a ("MLK-18082: defconfig: Add caam to 7ulp conf")

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:08:18 +08:00
2bc9a11149 MLKU-38-2 ARM: dts: imx: add caam snvs and secvio
This is a rework of the following i.MX BSP commits
(rel_imx_4.19.35_1.1.0_rc2):

8f6a17b419 ("ENGR00289885 [iMX6Q] Add Secure Memory and SECVIO support.")
e165190049 ("MLK-12339 Security: Missing caam support.")
dfc914b909 ("ARM: dts: imx6ul: Add caam")
9d9ca7a03e ("MLK-11922 i.mx6: Linux 3.14.28 CAAM & SNVS enabled by default. JTAG, DS-5 attachment causes exceptions")
c1bf396415 ("MLK-10086-2 ARM: imx6: add dts entries for hsic controller")
34dc698078 ("MLK-11265-1 ARM: dts: add imx7d soc dtsi support")

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:08:17 +08:00
606d296ae7 MLKU-38-1 dt-bindings: crypto: fsl: add snvs clock management
This is a rework of the following i.MX BSP commit
(rel_imx_4.19.35_1.1.0_rc2):
3ac6edcd92 ("MLK-11360-01 crypto: caam_snvs: add snvs clock management")

caam_snvs driver involves snvs HP registers access that needs to
enable snvs clock source. The patch add the clock management.

Signed-off-by: Andy Duan <fugang.duan@nxp.com>
Signed-off-by: Dan Douglass <dan.douglass@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:08:16 +08:00
33738b5dcd MLKU-62-1 arm64: dts: imx8qm/imx8qxp: add security subsystem
Security subsystem includes:
-caam crypto engine
-secure memory

Notes:

1. caam has 4 job rings, however only last 2 rings are accessible
from the kernel.

2. Controller DT node is added in the same power domain as the JR2
(1st jr showing in DT).
This is needed since controller driver (ctrl.c) needs first jr
(JR2 in this case) "powered", so it can access its register page
(which has some aliases for registers located in controller page,
page that is not accesible from the kernel).

Adding controller DT node to the power domain leads to SCU f/w
being instructed to "power up" JR2.
What actually happens is that:
-XRDC2 is programmed to provide access to JR2 register page
-SECO f/w is instructed to update JR2DID_LS and possibly
JR2DID_MS[USE_OUT].

USE_OUT details from Security RM:

"JRaDID_MS contains a USE_OUT field that enables a second set of ICID
and DID values.

When USE_OUT=1, this Job Ring's *data* write transactions will assert
TrustZone Non-SecureWorld, along with the OUT_DID and OUT_ICID values
from JRSDID_LS.
All other bus transactions, including all reads, descriptor write-backs
and job completion status writes will assert the PRIM_ICID, PRIM_ICID and
not PRIM_TZ values from JRaDID_MS.

When USE_OUT=0, all bus transactions performed on behalf of this Job Ring
will use the PRIM_ICID, PRIM_ICID and not PRIM_TZ values from JRSDID_MS."

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:08:15 +08:00
41ff3c14e4 MLKU-123-3 arm64: dts: imx8mn: Add CAAM node
Add node for CAAM - Cryptographic Acceleration and Assurance Module.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:08:15 +08:00
d66d658f05 MLKU-123-2 arm64: dts: imx8mm: Add CAAM node
Add node for CAAM - Cryptographic Acceleration and Assurance Module.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:08:14 +08:00
a53b76c23b arm64: dts: imx8qxp-mek: Remove stray adma_dsp
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:08:14 +08:00
a95001e8f7 ARM: dts: imx6sl-evk-csi: add new dts file for csi
add new dts file for csi since csi and epdc has pin conflict

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:13 +08:00
aad3b65f3a ARM: dts: imx6sl: update csi node
update csi node

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:13 +08:00
d7e137db9d ARM64: dts: imx8mm-evk: enable mipi camera ov5640
enable csi bridge, mipi csi and mipi camera ov5640

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:12 +08:00
576d7f89f2 ARM64: dts: imx8mm: add csi bridge and mipi csi node
add csi bridge and mipi csi node

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:11 +08:00
8bb0316408 ARM: dts: imx7d-sdb: enable mipi camera ov5640
enable csi bridge, mipi csi, and mipi camera ov5640 on imx7d sdb

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:11 +08:00
30c2ee0d48 ARM: dts: imx7d: use internal version of csi bridge/mipi csi node
use internal version of csi bridge and mipi csi node

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:10 +08:00
23abe424e7 ARM: dts: add new imx6sx-sdb-lcdif1 dts file
on SDB board, LCD1_DATA07 is shared by lcdif1 and csi1, so add -lcdif1 dts
file to resovle the conflict.

[  503.947201] imx6sx-pinctrl 20e0000.iomuxc: pin MX6SX_PAD_LCD1_DATA07 already requested by 2220000.lcdif; cannot claim for 0-003c
[  503.958957] imx6sx-pinctrl 20e0000.iomuxc: pin-59 (0-003c) status -22
[  503.965560] imx6sx-pinctrl 20e0000.iomuxc: could not request pin 59 (MX6SX_PAD_LCD1_DATA07) from group csigrp-0  on device 20e0000.iomuxc

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:09 +08:00
c4ae264ae8 ARM: dts: imx6sx-sdb: add parallel camera ov5640 support
add parallel camera ov5640 support on imx6sx sdb

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:09 +08:00
f6f5339f7b ARM: dts: imx6sx: add CSI support of internal version
use internal version of CSI driver

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:08 +08:00
8d513c754b ARM: dts: imx6ull-9x9-evk: add parallel camera ov5640 support
add parallel camera ov5640 support on imx6ull 9x9 EVK

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:07 +08:00
4eb092f584 ARM: dts: imx6ul-9x9-evk: add parallel camera ov5640 support
add parallel camera ov5640 support on imx6ul 9x9 EVK

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:06 +08:00
2388f37462 ARM: dts: imx6ul-14x14-evk: add parallel camera ov5640 support
add parallel camera ov5640 support on imx6ul/imx6ull 14x14 EVK.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:05 +08:00
528b809ba5 ARM: dts: imx6ul: add csi node
Add csi node on imx6ul

This has different clocks versus upstream.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:08:04 +08:00
5461070c20 ARM: dts: Disable ov564x cameras
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:08:04 +08:00
ce2a37362b ARM: dts: imx6qdl: Disable cnm,coda960 VPU driver
Disable cnm,coda960 VPU driver and use MXC VPU driver instead.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:08:03 +08:00
509983c208 arm: imx6qdl-sabreauto.dtsi: Enable mxc_v4l2_output
This patch enables mxc_v4l2_output device tree support for
the i.MX6qdl Sabreauto platforms.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:08:03 +08:00
794b452181 arm: imx6qdl-sabresd.dtsi: Enable mxc_v4l2_output
This patch enables mxc_v4l2_output device tree support for
the i.MX6qdl Sabresd platforms.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:08:02 +08:00
b7ce0a73b2 arm: dts: imx6qdl-sabresd: add V4L2 capture support
use internal version and resolve conflict with upstreaming code.
add the nodes for v4l2 capture, mipi csi, and ov5460 cameras.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:08:02 +08:00
76adf3e7d3 arm64: imx8mq: Remove link_rate and num_lanes from DP
Remove link_rate and num_lanes from DP.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:08:01 +08:00
1146dff374 arch: arm: imx6ull-9x9: add the missing CAN node
Add the missing CAN node.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:08:00 +08:00
606755e45a ARM64: dts: imx8qm: enable ARC for HDMI Audio
enable ARC for HDMI Audio

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:59 +08:00
04461eca5e ARM: dts: imx6sll: change the usdhc compatible
Change the usdhc compatible to make it support hs400 mode.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:07:59 +08:00
5643e0913d arm64: dts: imx8mm: Add imx8mm ddr4 evk board support
Add i.MX8MM DDR4 EVK board support.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:07:58 +08:00
a22e26b75a arm64: dts: imx8qm: Change OV10635 as default camera
Change OV10635 as default camera for IMX8QM platform and OV5640
as optional choice. For OV10635, IMX8QM support eight sensors.
For OV5640, IMX8QM support two.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:07:57 +08:00
83fc74ac28 arm64: dts: imx8qxp: change OV10635 as default camera
Change OV10635 and OV5640 DVP mode as default camera for
IMX8QXP platform and OV5640 MIPI mode as optional choice.
IMX8QXP support four ov5640 sensors and one ov5640 sensor
which only work on DVP mode by default. For ov5640 optional
choice, it support two sensor, one work on DVP mode and the
other work on MIPI mode.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:07:57 +08:00
78d95da18a ARM: imx: imx6ull: Add imx6ull 9x9 evk board support
Add i.MX6ULL 9x9 EVK board dts support.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:07:57 +08:00
4b9af200f7 ARM: dts: imx6ul: Add imx6ul 9x9 evk board support
Add i.MX6UL 9x9 EVK board dts support

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:07:56 +08:00
1ce7e8a194 ARM: dts: imx7d: Enable sii902x sound card
Enable sii902x sound card

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:54 +08:00
2adf3e252d ARM: dts: imx6qdl: Enable HDMI audio sound card
Enable HDMI audio sound card

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:54 +08:00
2be8d6859f ARM: dts: imx6qdl: Enable HDMI Audio in devicetree
Enable HDMI Audio in devicetree

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:54 +08:00
0ca3188658 ARM64: dts: imx8mq: Enable HDMI Audio
Enable HDMI audio

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:53 +08:00
dde2eb8370 dts: arm: imx: add imx8mq evk dp dts
Add imx8mq dp dts file.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:07:53 +08:00
285592d461 ARM64: dts: imx8mn: enable audio modules
Enable SAI/MICFIL/SPDIF/WM8524/AK5558

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:52 +08:00
63d6da155c ARM: dts: imx7d: Add i.MX7D 12x12 LPDDR3 validation board support
Add i.MX7D 12x12 LPDDR3 validation board support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:07:52 +08:00
4867754155 arm: dts: imx6sx: Add dcic property
Add imx6sx dcic property.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:07:51 +08:00
f9503ce381 arm: dts: imx6qdl: add dcic property
add dcic property.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:07:51 +08:00
aaef9eacc4 arm: dts: imx6: Add hdmi property in dts files
add imx6qp/q/dl hdmi property.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:07:49 +08:00
ef495aa744 arm: dts: add sii902x hdmi connector driver
Add sii902x hdmi connector driver to imx7d sdb board.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:07:49 +08:00
bb12c8dc79 arm64: dts: imx8qxp: Add basic LPDDR4 validation board support
Add i.MX8QXP LPDDR4 Validation board support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:07:48 +08:00
00266f6d53 arm64: dts: imx8qm: Add basic LPDDR4 validation board support
Add i.MX8QM LPDDR4 Validation board support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:07:48 +08:00
6d45559f35 dts: arm: imx: add imx8mq hdmi
Add imx8mq hdmi
remove imx8qm csr properity.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:07:47 +08:00
edf14286bf ARM: dts: imx6ul: add enet wakeup irq
Add imx6ul enet wakeup irq as system wakeup source.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:07:47 +08:00
dcc51204a9 arm64: dts: imx8mq/mm/mn: add the enet wakeup support
Add the wakeup irq property as the system wakeup source.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:07:46 +08:00
b68f3e40bc arm64: dts: imx8qm/imx8qxp: enable enet wakeup irq
Enable enet wakeup irqs into scu-pd wakeup irq list.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:07:46 +08:00
5e64b0716e arm64: dts: imx8mq: add dcss, hdmi and create imx8mq-evk-hdmi.dts file
This will allow using DCSS with HDMI on iMX8MQ.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
[ Aisheng: fix one unnecessary blank line ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:07:44 +08:00
06cadee585 arm: dts: imx6ul-14x14-evk: remove panel node
currently we still use internal framebuffer driver for lcdif.
remove DRM-specific staff to avoid conflict.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:44 +08:00
3995dfa608 arm: dts: imx6sll-evk: remove panel node
currently we still use internal framebuffer driver for lcdif.
remove DRM-specific staff to avoid conflict.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:43 +08:00
aa1e7273a1 arm: dts: imx6sl-evk: enable epdc support
enable epdc support on imx6sololite EVK

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:43 +08:00
adf91ef59f arm: dts: imx6sl-evk: add max17135 support
add max17135 support, needed by epdc

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:43 +08:00
80f47cbf4b arm: dts: imx6sl: update epdc properties
update epdc properties

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:42 +08:00
af2f08e42f arm: dts: imx6sl-evk: enable PXP v4l2 driver
enable PXP v4l2 driver on imx6sl EVK

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:42 +08:00
2d03f3b949 arm: dts: imx6sll: update pxp properties
update pxp properties

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:41 +08:00
c533f683ee arm: dts: imx6ul-14x14-evk: enable PXP v4l2 driver
enable PXP V4L2 driver on imx6ul 14x14 EVK

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:39 +08:00
3a7535e1e7 arm: dts: imx6sll-evk: enable pxp v4l2 driver
enable pxp v4l2 driver on imx6sll evk

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:39 +08:00
3ab2323286 arm: dts: imx7d-sdb: enable pxp v4l2 driver
enable pxp v4l2 driver on imx7d sdb board

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:38 +08:00
16d2e76b5b arm: dts: imx6sx-sdb: enable pxp v4l2 driver
enable pxp v4l2 driver on imx6sx sdb board

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:07:37 +08:00
4a80a441e7 ARM: dts: fix isl29023's regulator
Use vdd-supply for isl29023.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:07:37 +08:00
4cefbf217d arm64: dts: imx8qm/imx8qxp: Add GPU devices for 8QM/8QXP
Add gpu in device tree:
arm64/boot/dts/freescale/imx8-ss-gpu0.dtsi
arm64/boot/dts/freescale/imx8-ss-gpu1.dtsi
arm64/boot/dts/freescale/imx8qm-mek.dts
arm64/boot/dts/freescale/imx8qm-ss-gpu.dtsi
arm64/boot/dts/freescale/imx8qm.dtsi
arm64/boot/dts/freescale/imx8qxp-ss-gpu.dtsi
arm64/boot/dts/freescale/imx8qxp.dtsi

Signed-off-by: Minjie Zhuang <minjie.zhuang@nxp.com>
2019-11-25 16:07:35 +08:00
596b29d461 arm64: dts: fix 8qm pcie boot hang
Make sure that the REF CLK is turned on.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:07:35 +08:00
9761c20023 arm: dts: imx7ulp: Add GPU device for 7ulp
Add gpu in device tree:
arch/arm/boot/dts/imx7ulp.dtsi

Signed-off-by: Minjie Zhuang <minjie.zhuang@nxp.com>
[ Aisheng : remove unnecessary new blank line ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:07:34 +08:00
753ad64ba5 arm64: dts: imx8mn: Add GPU device for 8MN
Add gpu in device tree:
arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
arch/arm64/boot/dts/freescale/imx8mn.dtsi

Signed-off-by: Minjie Zhuang <minjie.zhuang@nxp.com>
[ Aisheng: fix unnecessary double space issue ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:07:32 +08:00
8bbd733e2e arm64: dts: imx8mm: Add GPU device for 8MM
Add gpu in device tree:
arch/arm64/boot/dts/freescale/imx8mm.dtsi
arch/arm64/boot/dts/freescale/imx8mm-evk.dts

Signed-off-by: Ella Feng <ella.feng@nxp.com>
[ Aisheng: remove unecessary new blank line ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:07:31 +08:00
fc229c0fc1 arm64: dts: imx8mq: Add GPU device for 8MQ
Add gpu in device tree:
arch/arm64/boot/dts/freescale/imx8mq.dtsi
arch/arm64/boot/dts/freescale/imx8mq-evk.dts

Signed-off-by: Ella Feng <ella.feng@nxp.com>
2019-11-25 16:07:31 +08:00
fbfa1466db ARM: dts: Add ipg clk for all lpi2c bus
Add ipg clk for all lpi2c bus on imx7ulp.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:07:30 +08:00
bbdd216988 ARM64: dts: Add ipg clk for all lpi2c bus
Add ipg clock config for all lpi2c bus.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:07:30 +08:00
431c79ae00 arm64: dts: imx-8mq: Disable ETNAVIV GPU
Disable ETNAVIV GPU for Vivante private GPU driver for i.MX8 board.

Signed-off-by: Ella Feng <ella.feng@nxp.com>
2019-11-25 16:07:29 +08:00
5497d961e3 ARM: dts: imx-6q/6dl/6sx: Disable ETNAVIV GPU
Disable ETNAVIV GPU for Vivante private GPU driver for i.MX6 board.

Signed-off-by: Ella Feng <ella.feng@nxp.com>
2019-11-25 16:07:28 +08:00
4f40bf5121 ARM: dts: imx6q/qp/dl/sx: enable GPU
Enable VIVANTE GPU with private driver for imx6/qp/dl/sx.

Signed-off-by: Ella Feng <ella.feng@nxp.com>
2019-11-25 16:07:28 +08:00
856d773916 arm64: dts: imx8qm/qxp: add dpr support for bliteng
add dpr channel 1 and 2 to support DPU blit engine

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 16:07:27 +08:00
947f519f08 ARM: dts: imx7d-sdb: remove panel node
The panel node is a device node for the DRM driver for
"sii,43wvf1g" panel. But the lcdif1 is implemented by
a framebuffer driver. So to avoid conflict, remove the
panel node.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:07:26 +08:00
3200db7804 ARM: dts: imx7d-sdb: add lcd-supply property for lcdif
The 3v3 regulator is required for the "sii,43wvf1g"
LCD panel display.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:07:25 +08:00
a2b73852d1 ARM: dts: imx7d-sdb: add 'display' property for lcdif
Since the mxsfb framebuffer driver requires 'display'
property to exist, so add this property to lcdif1,
otherwise there will be below errors printed:

[    3.617194] mxsfb 2220000.lcdif: failed to find display phandle
[    3.623254] mxsfb 2220000.lcdif: Failed to initialize fbinfo: -2
[    3.640538] mxsfb: probe of 2220000.lcdif failed with error -2

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:07:25 +08:00
89a272efb1 ARM: dts: imx7s: add disp_axi clock for lcdif
Since the LCDIF framebuffer driver mxsfb requires the
disp_axi clock.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:07:24 +08:00
a408012e98 ARM: dts: imx6sx-sdb: add lcd-supply property
The 3v3 regulator is required for the "sii,43wvf1g"
LCD panel display.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:07:23 +08:00
f2c1a805b0 ARM: dts: imx6sx-sdb: remove panel node
The panel node is a device node for the DRM driver for
"sii,43wvf1g" panel. But the lcdif1 is implemented by
a framebuffer driver. So to avoid conflict, remove the
panel node.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:07:22 +08:00
d0b15f0d9d arm64: dts: imx8mn: Add the power domain node for imx8mn
Add the power domain nodes for i.MX8MN.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:07:22 +08:00
5f12e1ecc2 ARM: dts: imx6sx-sdb: add 'display' property for lcdif1
Since the mxsfb framebuffer driver requires 'display'
property to exist, so add this property to lcdif1,
otherwise there will be below errors printed:

[    3.617194] mxsfb 2220000.lcdif: failed to find display phandle
[    3.623254] mxsfb 2220000.lcdif: Failed to initialize fbinfo: -2
[    3.640538] mxsfb: probe of 2220000.lcdif failed with error -2

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:07:22 +08:00
fdb94ec3ab ARM: dts: imx6sll: support audio sound card
support audio sound card (wm8962)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:21 +08:00
1ebef08ab0 ARM: dts: imx7ulp: support audio sound card
support audio sound card (rpmsg)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:20 +08:00
325ecddae8 ARM: dts: imx7d: support audio sound card
support audio sound card (wm8960)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:19 +08:00
d5e70418e1 ARM: dts: imx6sl: support audio sound card
support audio sound card (wm8962)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:18 +08:00
0b8e2ec142 ARM: dts: imx6sx: support audio sound card
support audio sound card (wm8962/mqs)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:18 +08:00
9f7dc89a78 AMR: dts: imx6qdl-sabresd: support audio sound card
support audio sound card (wm8962)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:17 +08:00
20469df94f ARM: dts: imx6qdl-sabreauto: support audio sound card
support audio sound card (cs42xx8/spdif)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:17 +08:00
150995d3af ARM: dts: imx6ul: support audio sound card
Support audio sound card (wm8960)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:16 +08:00
1b2ccb849f ARM64: dts: imx8mm: Enable AK4497/AK4458/AK5558/SPDIF/MICFIL
Enable AK4497/AK4458/AK5558/SPDIF/MICFIL

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:15 +08:00
4e11bcca0e arm64: dts: enable imx8 pcie pm support
Enable the iMX8 PCIe PM supports.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:07:15 +08:00
009f3dbd0b arm64: dts: enable the second pcie on imx8mq evk board
Enable the second PCIe port on iMX8MQ EVK board.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:07:14 +08:00
8561ea399e ARM64: dts: Support ak4458/ak5558/ak4497/spdif in imx8mq
Support ak4458/ak5558/ak4497/spdif in imx8mq

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:14 +08:00
a6500723cd arm64: dts: imx8qm hdmi: correct i2s clk parent
correct hdmi tx i2s clk parent.
remove unnecessary power domain for i2c.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:07:12 +08:00
e9e657c67c arm64: dts: imx8qm mek hdmi: Add hdmi tx audio device
Enable imx8qm hdmi tx audio.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:07:12 +08:00
916296da8b arm64: dts: imx8qm mek hdmi: Add lane_mapping set
Add lane_mapping set for hdmi.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:07:11 +08:00
2acebd132c ARM64: dts: Enable dsp basic function in imx8qm and imx8qxp
Enable dsp basic function in imx8qm and imx8qxp

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:11 +08:00
95c3a6ee38 arm64: dts: imx8mq: compile imx8mq-evk-lcdif-rm67191.dtb
Add imx8mq-evk-lcdif-rm67191.dtb to Makefile in order to compile it.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:07:10 +08:00
287511caf7 arm64: dts: imx8mq-evk: create dts file for lcdif-rm67191
Since on imx8mq evk board there are multiple display paths, create one
dts file for each display path.
This patch creates the dts file for lcdif-dsi-rm67191 (mipi-dsi panel)
display path.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:07:09 +08:00
7d42363819 arm64: dts: imx8mq: add dsi node
Add mipi_dsi node, to support add support for the nwl-dsi driver on
i.MX8mq.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:07:09 +08:00
59a47ab08b arm64: dts: imx8mq: add lcdif node
Add lcdif node, to support add support for the mxsfb-drm driver on
i.MX8mq.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:07:08 +08:00
c1e58a55d1 arm: dts: imx6: enable vpu decoder/encoder in device tree
add vpu node for imx6 in dts

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:07:07 +08:00
4bc67e56ba arm64: dts: imx8qm: fix hsio phyx2 lpcg power domain
It should be SERDES_0.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:07:06 +08:00
bd2919dfb8 arm64: dts: imx8qm: add missing pd for uart4 lpcg
missing pd for uart4 lpcg

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:07:06 +08:00
5215b05419 arm64: dts: imx845: add vpu encoder
enable 845 h1 in device tree

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:07:06 +08:00
d78d416ca7 arm64: dts: imx845: add vpu decoder
enable 845 g1/g2 in device tree

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:07:06 +08:00
b348645208 ARM64: dts: update reset gpio setting for cs42xx8
update reset gpio setting for cs42xx8

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:05 +08:00
40b3295e48 ARM64: dts: imx8: update compatible string for esai
update compatible string for esai

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:07:04 +08:00
930c02233f arm64: dts: change light sensor's compatible string for imx8qxp
Change isl29023's compatible string into "fsl,isl29023". Make sure it
will match the driver drivers/input/misc/isl29023.c.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:07:02 +08:00
2cffeeb1f3 arm: dts: change light sensor's compatible string for imx6ql
Change isl29023's compatible string into "fsl,isl29023". Make sure it
will match the driver drivers/input/misc/isl29023.c.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:07:02 +08:00
b54433f21b arm64: dts: imx8qm: add vpu decoder and encoder
enable vpu decoder and encoder

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:07:01 +08:00
f2a981c62f ARM64: dts: imx8mm: re-order display nodes
The devices in the device tree are registered in the
top-down order. But when system suspend entered, the
device tree is walked in a bottom-up order to suspend
devices. So change the display device nodes register
order to be:

LCDIF -> SEC DSIM -> Display Subsystem

Since in display subystem, it will disable the whole
display pipeline. So this should be first suspended
before LCDIF and SEC DSIM. And besides, the SEC DSIM
is better to be suspended before LCDIF which is the
same with the sequence for display pipeline disables.
And when system resume entered, the devices resume
sequence is:

LCDIF -> SEC DSIM -> Display Subsystem

Which is a top-down order and is the correct sequence
for display devices resume.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:07:01 +08:00
3be6afd4ec MLK-22046 arm: dts: imx6dl-sabresd: enable elan touch driver
note ELAN touch chip is on IMXEBOOKDC2 board, which is plugged into
i.MX6DL SabreSD board.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:07:00 +08:00
a2883095a4 arm: dts: imx6dl-sabresd: add epdc support
Add epdc support on i.MX6DL SabreSD board.
enable pxp, pmic, epdc in imx6dl-sabresd.dts

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:58 +08:00
17b8d66649 arm: dts: imx6dl: amend property for pxp node
amend property for pxp node

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:58 +08:00
bd2d6c9612 arm: dts: imx6dl: amend property for epdc node
amend property for epdc node

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:57 +08:00
a799a11e5e arm: dts: imx6ull: add epdc node
add epdc node on imx6ull

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:56 +08:00
83fdfc2cb0 arm: dts: imx6ull: use internal version of pxp
use internal version instead of upstream version

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:55 +08:00
2d845798ff arm: dts: imx6ul: use internal version of pxp
use pxp internal version instead of upstream version

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:55 +08:00
b6279d749d arm: dts: imx6sll-evk: enable epdc and pxp on evk board
enable epdc and pxp on imx6sll-evk board

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:54 +08:00
363e1f765b arm: dts: imx6sll-evk: enable pmic max17135
enable max17135 on imx6sll evk board

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:53 +08:00
0433167244 arm: dts: imx6sll: add epdc node
add epdc node on imx6sll

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:52 +08:00
5cfc1afbd0 arm: dts: imx6sll: add pxp node
add pxp property on imx6sll

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:51 +08:00
9e784f0367 arm: dts: imx7d-sdb-epdc: enable elan touch on IMXEBOOKDC4 board
enable elan touch on IMXEBOOKDC4 panel board

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:51 +08:00
ae508241b0 arm64: dts: imx8qm hdmi: disable hdmi tx default
disable hdmi tx default.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:06:51 +08:00
9b20d36c1d ARM: dts: imx7ulp: remove mipi pll clock node
According to the IMX7ULP reference manual, the mipi pll
clock comes from the MIPI PHY PLL output. So it should
not be defined as a fixed clock. So remove this clock
node and all the references to it.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:50 +08:00
c9978b4ac9 arm: dts: add imx7d-sdb-epdc.dts into Makefile
add imx7d-sdb-epdc.dts into Makefile

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:50 +08:00
12646937b8 ARM64: dts: imx8qm: enable audio sound card
enable audio sound card (dsp, amix, asrc, esai, sai, cs42888, wm8960)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:06:49 +08:00
3666cde64e arm64: dts: imx6qdl/qp-sabresd/auto: Enable IPUv3 fb and LVDS displays
This patch enables internal IPUv3 fb and LVDS displays in device tree.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:06:48 +08:00
fc154ba6d2 ARM64: dts: imx8mm: add the clkreq reset for imx8mm pcie
Add the CLKREQ reset used by L1.1ss feature on iMX8MM PCIe.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:06:48 +08:00
290e14eb71 arm: dts: imx7d: add epdc property
on imx7d-sdb board, epdc has pin conflict with fec2, sim, etc.
so add a separate dts file for it.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:47 +08:00
1482c8df9a arm: dts: imx7d: add qosc node
add qosc node on imx7d

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:46 +08:00
0427cabb00 arm: dts: imx7d-sdb: add max17135 support
add pmic max17135 support

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:46 +08:00
0d607c2e35 arm: dts: imx7d: add pxp node
add pxp property like clock, interrupt, io register base for imx7d soc

enable pxp on sdb board

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:06:45 +08:00
b0cae40bf7 arm64: imx8qm mek: Add hdmi tx support
Move hdmi tx function out of imx8qm-mek.dts.
Disable lvds devices in imx8qm-mek-hdmi.dts,
then hdmi tx function should not depend on LVDS connector plugged.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:06:45 +08:00
5a8a6c85de arm64: imx8-ss-dc0/1.dtsi: add dc0/1_disp clocks for dpu0/1
disp0/1 lpcg clocks parent are fixed.
so dc0/1_disp0/1 clocks couldn't replace by disp0/1_lpcg clocks.
Add dc0/1 disp clocks and disp0/1_lpcg clocks for dc0/1.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:06:44 +08:00
f40ec652a9 arm64: dts: imx8qm: hdmi tx: Add hdmi tx subsystem device tree
This patch adds HDMI TX subsystems support for i.MX8qm

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:06:44 +08:00
7ac49d4f42 ARM64: dts: imx8mm: correct the imx8mm pcie phy dts node
Correct the reg scope of the iMX8MM PCIe PHY DTS node.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:06:44 +08:00
2fca821328 ARM: dts: imx7d-sdb: add mipi panel display support
Create a new dts for TFT3P5581E mipi panel display support
on imx7d sdb board.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:43 +08:00
ff175596cf ARM: dts: imx7d: add a device node for mipi dsi
Add a new device node for Samsung MIPI DSI controller.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:42 +08:00
476285dc18 arm: dts: imx: fix make dtbs break
Fix make dts break which is caused by a typo.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:06:41 +08:00
8a47ddc5e1 arm64: dts: add partition reset function for i.MX8QM/QXP
Add partition reset function for i.MX8QM/QXP.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:06:41 +08:00
12e3cb0ed3 arm64: dts: imx8qxp-mek-sof: Introduce DSP SOF DT
This introduces a separate DT file for enabling DSP SOF
DT node.

Scenario that we want to enable is. Simple playback pipeline
with CS42888 + ESAI on imx8QXP.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 16:06:40 +08:00
6076103a33 arm64: dts: imx8qxp-mek-dsp: Change compatible string for old DSP driver
Currently there are two Linux DSP drivers. We will use the following
compatible strings depending on which driver is used:

1) fsl,imx8qxp-dsp-v1

Used for FSL DSP Linux driver that works with the old audio framework written
completely inside NXP.

2) fsl,imx8qxp-dsp

Used for SOF Linux driver. This will be used in the future, but until
SOF Linux driver / FW will completely support all the features we will
need to support 1) and 2) in parallel.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 16:06:40 +08:00
7df19d43bf ARM: dts: imx7ulp-evk: add RK055IQH042 mipi panel support
Add a new dtb imx7ulp-evkb-rm68191-qhd.dtb to support the
mipi panel RK055IQH042.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:38 +08:00
8b053d516a ARM: dts: imx7ulp-evk: add RK055AHD042 mipi panel support
Add a new dtb imx7ulp-evkb-rm68200-wxga.dtb to support the
mipi panel RK055AHD042.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:38 +08:00
b01b2afe4c arm64: dts: imx8qxp-mek: Enable dc0_prg1/2 and dc0_dpr1_channel1/2
This patch enables dc0_prg1/2 and dc0_dpr1_channel1/2 for
DC0 subsystems of imx8qxp mek platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:06:36 +08:00
64e2e5af16 arm64: dts: imx8qm-mek: Enable dc0/1_prg1/2 and dc0/1_dpr1_channel1/2
This patch enables dc0/1_prg1/2 and dc0/1_dpr1_channel1/2 for
DC0/1 subsystems of imx8qm mek platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:06:36 +08:00
5e94e6bb5a arm64: imx8-ss-dc0/1.dtsi: Add dc0/1_prg1/2 and dc0/1_dpr1_channel1/2 support
This patch adds dc0/1_prg1/2 and dc0/1_dpr1_channel1/2 support for
DC0/1 subsystems.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:06:36 +08:00
71d79dcec4 arm64: imx8-ss-dc0/1.dtsi: Use dc0/1_disp_lpcg clocks as disp0/1 clocks of dpu0/1
This patch uses dc0/1_disp_lpcg clocks as disp0/1 clocks of dpu0/1.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:06:35 +08:00
6cc83bcf29 arm64: imx8-ss-dc0/1.dtsi: Add dc0/1_displ_lpcg clocks
This patch adds dc0/1_displ_lpcg clocks to DC0/1 subsystem device trees.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:06:35 +08:00
ea334b7f64 ARM64: dts: enable pcie on imx8mm
Enable PCIe on iMX8MM platforms.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:06:34 +08:00
30aeb21a6f ARM64: dts: freescale: imx8qm: add m4_1 rpmsg support
Add m4_1 rpmsg support on i.mx8qm-mek board.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:06:34 +08:00
01fcab9630 ARM: dts: imx7ulp-evk: add TFT3P5581E mipi panel support
Add a new dtb imx7ulp-evk-mipi.dtb to support the TRULY
mipi panel TFT3P5581E.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:33 +08:00
e708036e69 ARM: dts: imx6qdl-sabresd: add max11801 device node
Add max11801 device node.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:06:32 +08:00
b02dbe4a3b ARM64: dts: imx8qm-mek: add USBOTG3 support
It is a USB3 port which uses Cadence IP.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:06:32 +08:00
1ace327640 ARM64: dts: imx8qm-mek: Add type-c support
Add USB Type-C support which is used for Cadence USB3 port.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:06:31 +08:00
d16ead77fa ARM64: dts: imx8qm-mek: fix wrong gpio using by mmc
Fix wrong gpio using by mmc.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:06:31 +08:00
43e63b33bc ARM64: dts: freescale: imx8qm-ss-audio: correct edma reg setting
Fix below edma probe error:
[    0.502018] fsl-edma-v3 bus@59000000:dma-controller@591F0000: invalid resource
[    0.508906] fsl-edma-v3: probe of bus@59000000:dma-controller@591F0000 failed with error -22
[    0.517354] fsl-edma-v3 bus@59000000:dma-controller@599F0000: invalid resource
[    0.524539] fsl-edma-v3: probe of bus@59000000:dma-controller@599F0000 failed with error -22

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:06:30 +08:00
f056d3206c arm: dts: imx6qp: enable sata and pcie
Enable SATA and PCIe support on iMX6QP REVA sabresd board.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:06:30 +08:00
f087aaa09f ARM: dts: imx7ulp-evk: enable mipi to hdmi display
Enable 'LCDIF --> MIPI DSI --> ADV7535(HDMI)' display
on imx7ulp EVK board.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:29 +08:00
4d4e65d50c ARM: dts: imx7ulp: add adv7535 node under lpi2c5
Add a device node for adv7535 under the lpi2c5 device.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:28 +08:00
1769408696 ARM64: dts: imx8mq-evk: update typec switch gpio property
As the typec switch driver may use more gpio(like reset), so
rename the "gpios" property to be "switch-gpios", update
the existing user dts accordingly.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 16:06:27 +08:00
3a82526ade ARM64: dts: imx8qxp-mek: add usb3 node
Add usbotg3 node for usb3 port which use type-c connector.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 16:06:27 +08:00
5598dba8d4 ARM64: dts: imx8qxp-mek: enable typec support
Add typec node for USB3 which cover:
- Typec and PD support with power source and dual data role.
- USB3 super speed mux switch for orientation.
- usb-role-switch property is not added as the controller driver
  does not support role switch class for now.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 16:06:25 +08:00
9f46f7135f ARM: dts: imx7ulp: add 'lpi2c4' and 'lpi2c5' nodes
Add 'lpi2c4' and 'lpi2c5' device nodes which may be used
by some peripherals.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:25 +08:00
cbd609fb65 ARM: dts: imx7ulp: add MIPI DSI node
Add a device node for the Northwest Logic MIPI DSI
controller.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:25 +08:00
d26ea1ff32 ARM: dts: imx7ulp: add LCDIF controller node
Add a device node for LCDIF display controller.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:24 +08:00
f3c0f80d17 MLK-11703-7: ARM: dts: imx6qdl-sabresd: add retain-state-suspended property in dts
cherry-pick below patch:

ENGR00295892-2: ARM: dts: imx6qdl-sabresd: add retain-state-suspended
property in dts.

Add property "retain-state-suspended" in dts.

Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit aff480769c26ff7f64059f9631b10e8177c4791b)
(cherry picked from commit 4a029915c4)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
(cherry picked from commit 85923d1f6a)
2019-11-25 16:06:24 +08:00
64aa9dac35 MLK-11703-6: ARM: imx6: Add charging led support on Sabresd board
cherry-pick below patch:

ENGR00290496-1 ARM: imx6: Add charging led support on Sabresd board

Enable led lighting while the board in charging status. Implement it
on Sabresd board.

Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 7a47183634c524f5ac11c60fe555b0b18c0fe7e0)
(cherry picked from commit 28b266aa0b)
[Arul: Fix merge conflicts]
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>

(cherry picked from commit 0d4fb6276e)
2019-11-25 16:06:23 +08:00
3f9fd5070d ENGR00330406-1: ARM: dts: imx6: add battery device node in dts file
Add battery device node on imx6q/dl-sabresd and imx6sl-evk board

Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 1f2670578d)
2019-11-25 16:06:23 +08:00
d3da7a2c88 ARM: dts: imx6dl: correct sram address
Fix duplicated sram device node and correct mmio-sram/lpm-sram
address map to make sure no overwrite.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:06:21 +08:00
ec1a037c5f MLK-22445-2 ARM64: dts: imx8-ss-conn: add Cadence USB3 support
Add Cadence USB3 support

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:06:21 +08:00
12447ceff9 arm64: dts: add qspi for imx8mq evk
add qspi support for imx8mq evk

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:06:20 +08:00
0ca9c7cd87 arm: dts: add gpmi-nand support for imx7d sabresd
add gpmi-nand support for imx7d sabresd

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:06:20 +08:00
9a829f97bc arm: dts: add qspi support for imx7d sabresd
add qspi support for imx7d sabresd

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:06:19 +08:00
777f3a3eb1 arm: dts: support qspi for imx6sx sabreauto
add qspi support for imx6sx sabreauto

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:06:19 +08:00
1cc5a3b7dd arm: dts: add nand support for imx6sx sabreauto
add gpmi nand support for imx6sx sabreauto

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:06:18 +08:00
22dc13a0e6 arm64: dts: imx8: add the fixed hsio ref clocks
External 100Mhz differential OSC is used as HSIO REF clock source, so
set it as the parent clk of the PHY PCLK.
Then add the fixed HSIO REF clocks regarding the different HSIO use
cases.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:06:17 +08:00
d644f2ee4a ARM64: dts: imx8mm-evk-rm67191.dts: add touch support
Add touch support on the imx8mm evk board when it connect the
synaptics_dsx screen.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:16 +08:00
81b079b483 ARM64: dts: imx8mq-evk: add synaptics_dsx touch scren support
Synaptics_dsx touch is on i2c3 bus, so add it here, but default disbale
it, because it share the irq pin with screen, will enable it in the
fsl-imx8mq-evk-dcss-rm67191.dts

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:16 +08:00
fed24b76f6 arm64: dts: imx8: select different module for imx8qxp, qm image ss
Image subsystem of imx8qm, qxp have some common part and some different
part. For qm, img ss include ISI, CSI0 and CSI1. For qxp, img ss include
ISI, CSI0 and PI0. So split two dtsi file to disable the unrelated modules

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:06:15 +08:00
a596add667 ARM: dts: imx7ulp: add focaltech touch panel ft5426 support
Add focaltech new touch panel ft5426 support.
Set the ft5426 as default panel for dts. If want to use the old panel, then
it needs to boot with imx7ulp-evk-ft5416.dtb file.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:15 +08:00
d9c5474c4c arm: dts: add rpmsg sensor for imx7ulp
Add rpmsg_sensor for imx7ulp evk board.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:06:15 +08:00
47bc4813fd arm: dts: add lpspi master function for imx7ulp
Add lpspi master function for imx7ulp

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:06:14 +08:00
dd69933b03 ARM: dts: imx6sl-evk.dts: add elan touch support
Add elan touch screen support on imx6sl-evk board.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:13 +08:00
28b5f2ac9d ARM: dts: imx6sx-sdb: add egalax touch screen support
Add i2c2 bus and add egalax touch screen support on imx6sx-sdb board.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:13 +08:00
30266a1389 arm64: dts: add sensors dts nodes for imx8
Add sensors nodes for 8qxp/qm in dts files for tests.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:06:12 +08:00
26792987c3 arm: dts: add sensors dts nodes
Add sensors nodes in dts files for tests.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:06:12 +08:00
55ad6777a9 ARM64: dts: freescale: imx8qm/qxp: add imx_sc_pwr_key driver
Add imx_sc_pwr_key driver for i.mx8qm/qxp.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:06:11 +08:00
26bbaeb483 ARM64: dts: imx8mm-evk: change reset gpio polarity to active low
Change the reset gpio polarity for RM67191 panel to active low
to match the RM67191 dt bindings file:

'Documentation/devicetree/bindings/display/panel/raydium,rm67191.txt'.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:10 +08:00
429f5b5b7b ARM: dts: imx7ulp: add sd1 slot support
SDIO wifi and sd1 slot share one usdhc, this patch add sd1 slot support
on imx7ulp evk board, need to do hardware rework first.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:10 +08:00
40d6a53370 ARM: dts: imx7ulp-evk: add emmc support
Add emmc support for imx7ulp-evk board, need to do rework first.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:09 +08:00
593a5012a5 ARM: dts: imx7ulp-evk: add SD3.0 support for usdhc0
Add SD3.0 support for the micro sd slot. Also add usdhc1 node to
support wifi.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:09 +08:00
af0864b63a ARM: dts: imx6ul-14x14-evk: add emmc support
Add emmc support for imx6ull-14x14-evk and imx6ul-14x14-evk board

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:08 +08:00
602c3749f5 ARM: dts: imx6sll-evk: add emmc support
Add emmc support for imx6sll-evk board

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:08 +08:00
1b80e7d717 ARM: dts: imx6qdl-sabreauto: add base board sd support
Add base board sd slot support for imx6qdl-sabreauto boards.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:08 +08:00
62c62c9494 ARM64: dts: add ADC support for imx8qm
Add ADC support for imx8qm-mek board.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:07 +08:00
53751f8732 ARM: dts: add emmc support for imx6sx-sdb board
Add emmc support for imx6sx-sdb board, due to this support
need remove sd4 sd card slot and solder an eMMC chip, so
this patch add imx6sx-sdb-emmc.dts file.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:06 +08:00
562b71e3b6 ARM: dts: add adc support for imx6sx
Add ADC support for imx6sx-sdb and imx6sx-sabreauto board.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:06:05 +08:00
bdf36c9da6 ARM64: dts: imx8mm: add power domain for display
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:05 +08:00
754ba6188b ARM64: dts: imx8mm: correct 'reg' property for display nodes
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:06:05 +08:00
3db05fb48f MLK-11390-1 ARM: dts: update imx6sx pinfunc header
Update i.MX6SX pinfunc header, add uart mux function.

Signed-off-by: Anson Huang <b20788@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:06:04 +08:00
938c77e364 MLK-12033 ARM: dts: imx6qdl-sabreauto: add enet irq dts files to avoid conflict with MLB
ENET gpio irq pin conlict with MLB on i.MX6qdl sabreauto board, since enet
gpio irq is extended feature for performance improvement, so let MLB enable
in default dts file and newly create sabreauto enet irq dts files.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:06:04 +08:00
825a71e2ad MLK-10096 ARM: dts: imx6qdl: add enet ENET_REF_CLK pin set for sabreauto board
Add enet RGMII ENET_REF_CLK pin set for sabreauto board.

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 3e4c0a2aec2473f577f807786f21e7641df16d61)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:06:03 +08:00
00355b6cca MLK-11457-04 ARM: dts: imx6qdl: add uart3 pad set for sabreauto board
Add imx6qdl-sabreauto board uart3 DTE pad set. To avoid a flood of
dts files, there comment out DTE pinctrl set. If user want to test
DTE mode, it needs to rebuild the DTB file.

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit dc6028b08c6bd718d57866a1714f3977ba7820d3)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:06:03 +08:00
b8dfe83784 MLK-11457-02 ARM: dts: imx6q: add uart5 dte set for sabresd board
Add uart5 DTE mode pinctrl set for imx6q-sabresd board. Since there
have pin confliction, so add new dts file.

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit d63b40d5b1b05992d2328ef0bdc80ec5d96f2dce)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:06:01 +08:00
f5f2f1e63e MLK-11853 ARM: dts: imx6qp-sabreauto: remove the enet pin reconfig
Tuning MMDC ZQ_PU_OFFSET impact DDR IO timing like the value is greater
than 0x9 causing enet lost packets due to the worse timing. Reinforce
ENET DDR IO drive strength can fix the issue. Use the default pin setting
can match the RGMII timing for AI board.

Worse timing cause performance drop, the performance has no drop after
enhancing the DDR IO pins drive strength. Pass over night test.

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 5ceb746c0358c0851187a3f4f6f61d02e951eae0)

Conflicts:
	arch/arm/boot/dts/imx6qp-sabreauto.dts

(cherry picked from commit 0ea975d4bd)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:06:01 +08:00
17df3614c7 arm: dts: imx6sx: disable at8031 eee mode for sdb and auto board
Since EEE impacts IEEE1588 performance, so disable EEE mode
for sdb and auto board in default.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:06:00 +08:00
9fa7447d16 MLK-11457-03 ARM: dts: imx6sl-evk: add uart4 support
Add uart4 DCE and DTE pinctrl set. Since there have pin confliction,
so add new dts file. To avoid a flood of dts files, there comment out
DTE pinctrl set. If user want to test DTE mode, it needs to rebuild
the DTB file.

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit a3602fa5796bb86ba432474220389ec712bde92a)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:05:59 +08:00
93a7ea6d59 ARM: dts: imx6qdl: add enet magic packet support
Add imx6q/dl/qp sabresd magic packet support.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:59 +08:00
1c585a2ace ARM: dts: imx6sx: add enet magic packet support
Add imx6sx sabreauto magic packet support.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:58 +08:00
d1016cc972 ARM: dts: imx6sx: add uart2/5 support for imx6sx-sabreauto board
Add uart2 and uart5 support for imx6sx-sabreauto board.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:57 +08:00
35822c5207 MLK-11460 ARM: dts: imx6sx: enet RGMII TXCLK output drive strength is weak
The current enet RGMII TXCLK rise/fall time which could be
observed(~0.85ns) is longer than requirement (<=0.75ns).

The current setting, SPEED/DSE/SRE=10/110/1 is used, and then it needs to
increase DSE to 111 "37 Ohm @ 3.3V, 21 Ohm@1.8V, 34 Ohm for DDR".
After the change RGMII TXCLK match the spec requirement.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:05:56 +08:00
1f71104062 MLK-11458 ARM: dts: imx6sx: enable fec2 MAC multiqueue
Enable fec2 MAC multiqueue.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:05:56 +08:00
8445fad64f MLK-11457-01 ARM: dts: imx6sx: add uart5 dte pad set for imx6sx-sdb board
Add imx6sx-sdb baord uart5 DTE pad set. To avoid a flood of dts files,
there only comment out DTE pinctrl set. If user want to test DTE mode,
it needs to rebuild the DTB file.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:05:54 +08:00
24a58afbad MLK-14897-0: imx7d: dts: Add enet_axi and enet_phy clock parents and rates
Add clock parents and rates for enet_axi and enet_phy in dts via
the asigned-parents and assigned-rates attributes.
These were previously set in the ccm driver via set_parent/set_rate
calls but that has been removed in upstream linux.

Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:53 +08:00
410dbcc9a5 ARM: dts: imx7d-sdb: enable uart5/6 node
- Enable uart5 for GPS
- Add modem reset for uart6 BT port

Signed-off-by: Fugang Duan <B38611@freescale.com>
2019-11-25 16:05:53 +08:00
6f9d176663 MLK-10447-01: dts: imx7d sdb: Add 74LV595 gpio expander node
-74LV595 function compatible with 74HC595, add 74HC595
driver into imx7d sdb dts.

Signed-off-by: Sandor Yu <R01008@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>

This was also added upstream, only change that remains is adding
registers-default on the gpio-expander node.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 16:05:51 +08:00
f853942cf4 MLK-13910: ARM: dts: imx7d: correct enet clock CCGR register offset
Correct enet clock CCGR register offset.

CCGR6: IMX7D_ENET_AXI_ROOT_CLK (enet1 enet2 bus clocks)
CCGR112: IMX7D_ENET1_TIME_ROOT_CLK, IMX7D_ENET1_IPG_ROOT_CLK
CCGR113: IMX7D_ENET2_TIME_ROOT_CLK, IMX7D_ENET2_IPG_ROOT_CLK

IMX7D_ENET_PHY_REF_ROOT_DIV supply clock for PHY, no gate after the clock, its parent
clcok root has gate.
IMX7D_ENET1_REF_ROOT_DIV/IMX7D_ENET2_REF_ROOT_DIV supply clocks for enet IPG_CLK_RMII,
no gate after the clock, its parent clock root has gate.

IMX7D_PLL_ENET_MAIN_125M_CLK (anatop pll) supply clock for enet RGMII tx_clk.

Update copyright information.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Adrian Alonso <adrian.alonso@nxp.com>
2019-11-25 16:05:50 +08:00
fa44d026c4 dts: imx7s: add uart dma chans
Add uart dma chans.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:50 +08:00
b1ed9140d3 ARM64: dts: imx8mm-evk: initialize the at8031 phy
- enable VDDIO as 1v8
- disable the PHY EEE mode

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:49 +08:00
9d2e068b23 arm64: dts: imx8mq-evk: enable bluetooth uart port
Enable bluetooth uart port.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:49 +08:00
d6f8721194 arm64: dts: imx8mq-evk: disable at8031 phy eee mode
Since EEE mode impacts IEEE1588 performance, so disable
the PHY eee mode in default.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:48 +08:00
0af604593c arm64: dts: imx8qxp-mek: add modem reset for bluetooth
Add modem reset for bluetooth.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:47 +08:00
ff8bcf9b7b arch: arm64: imx8qm: add ddr perf device node
Add another ddr perf monitor device node.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:05:47 +08:00
d0556e99f9 arm64: dts: imx8qm: enable pciea and sata
Enable imx8qm pciea and sata

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:05:46 +08:00
ed49c29a99 arm64: imx8-ss-dc0/1.dtsi: Add common dpu clocks
Currently, all DPUs in i.MX8qm/qxp have the same clocks - pll0/1,
bypass0 and disp0/1.  So add the common clocks in imx8-ss-dc0/1.dtsi.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:45 +08:00
ef80f59c77 arm64: imx8qm-ss-dc.dtsi: Drop status property for dpu2
imx8-ss-dc1.dtsi has specified the status property for dpu2,
so remove the superfluous one.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:44 +08:00
15d5100616 arm64: imx8qm-ss-dc.dtsi: Remove dpu2 power domains
Power domains for dpu are specified in imx8-ss-dc0/1.dtsi,
so remove the superfluous power domains in imx8qm-ss-dc.dtsi.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:44 +08:00
3535a94ea8 ARM: dts: imx7ulp: Add OPP table for cpu0
Add OPP table for cpu0 to support i.MX7ULP cpufreq.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:05:43 +08:00
625e5c3e56 ARM: dts: imx7ulp: Add necessary nodes for suspend/resume support
Add necessary nodes for suspend/resume support, including wdog
node which is needed for initializing wdog when resumed from
VLLS mode.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:05:43 +08:00
c6d6238d26 ARM: dts: imx7ulp: Add rpmsg rtc node
Add rpmsg rtc node to support RTC driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:05:42 +08:00
efdabb671c ARM: dts: imx7ulp-evk: add rpmsg-keys driver
Add rpmsg-keys device node.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:05:41 +08:00
e382742237 arm: dts: imx7ulp: specify the mu compatible name
One version 1.0 MU module is contained in i.MX7ULP.
And it has the different register layout.
Use one specific compatible for i.MX7ULP MU.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:05:41 +08:00
6698da7cde ARM: dts: imx7ulp-evk: add pf1550 rpmsg device node
Add pf1550 rpmsg device node.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:05:40 +08:00
e0084ca978 ARM: dts: imx7ulp: add heartbeat
Add heartbeat device node.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:05:39 +08:00
4ddd22d5ed MLK-22404-03 arm64: dts: freescale: Add power domain nodes for i.mx8mm
Add the power domain nodes for i.MX8MM.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:05:39 +08:00
3aa2619452 MLK-21299 ARM64: dts: imx8mm-evk: add interrupt support for ADV7535
Add interrupt and related pinctrl properties for ADV7535,
the interrupt can be used for hotplug, edid ready and etc
in the adv bridge driver.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:05:39 +08:00
bd7ffc71e5 MLK-18605-12 ARM64: dts: imx8mm-evk: add support for RM67191 panel
Create a new dts 'fsl-imx8mm-evk-rm67191.dts' to support panel
'RM67191' display which is attached to DSIM controller directly.
So the corresponding panel device node is defined as the child
of 'mipi_dsi' node under the DRM DSI framework. Since the
'adv_bridge' and 'RM67191' should be enabled exclusively, so
disable 'adv_bridge' when enable 'RM67191'.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:05:38 +08:00
133cc5a047 MLK-18535-11 ARM64: dts: imx8mm-evk: enable 'lcdif', 'mipi_dsi' and 'adv7535'
Enable the whole display pipeline 'LCDIF --> MIPI DSI --> ADV7535'
on IMX8MM EVK board.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:05:38 +08:00
39afdd2cf3 ARM64: dts: imx8mm: add display devices nodes
Add device nodes for display devices, LCDIF, MIPI DSI,
Dispmix GPR controller and display subsystem.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:05:37 +08:00
fa68377164 arm64: dts: imx8mm: Add thermal zone support
Add thermal zone and tmu node to support i.MX8MM thermal
driver, ONLY cpu thermal zone is supported, and cpu cooling
is also added.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:05:37 +08:00
858d195341 arm64: dts: imx8qm-mek: Enable dual IT6263 LVDS to HDMI display
This patch enables dual IT6263 LVDS to HDMI display.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:36 +08:00
3649a4a793 arm64: imx8qm.dtsi: Add LVDS0/1 subsystems support
This patch adds LVDS0/1 subsystems support for i.MX8qm.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:35 +08:00
dfe3fe9d5f arm64: dts: imx8qm-mek: Enable dpu1/2
This patch enables dpu1/2 for i.MX8qm MEK platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:34 +08:00
e419cb88c1 arm64: imx8qm.dtsi: Add DC0/1 subsystem support
This patch adds DC0/1 subsystem support for i.MX8qm.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:34 +08:00
99a1f25896 arm64: imx8-ss-dc1.dtsi: Add DC1 subsystem support
This patch adds DC1 subsystem support.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:33 +08:00
79d1b7a317 arm64: imx8qxp-ss-lvds.dtsi: Rename imx8-ss-lvds.dtsi to imx8qxp-ss-lvds.dtsi
i.MX8qxp LVDS display feature is supported by MIPI DSI/LVDS combo subsystem.
i.MX8qm LVDS display feature is supported by standalone LVDS subsystem.
There is not a lot of common hardwares for the two kinds of subsytems,
so rename imx8-ss-lvds.dtsi to imx8qxp-ss-lvds.dtsi.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:33 +08:00
a6d72d406b arm64: imx8-ss-dc0.dtsi: Improve DC0 subsystem device tree
This patch improves DC0 subsystem device tree to clearly reflect it is
the first DC subsystem instance embedded in a SoC. So, some renaming
happens in imx8-ss-dc.dtsi, and finally imx8-ss-dc.dtsi is renamed to be
imx8-ss-dc0.dtsi.

Also, extract the i.MX8qxp specific compatible string, display clocks,
display ports and display-subsystem from imx8-ss-dc0.dtsi and put them
in SoC specific imx8qxp-ss-dc.dtsi.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:32 +08:00
3c8c094650 arm64: imx8-ss-dc.dtsi: Improve display endpoint names
Change dpu_disp0/1_lvds0/1_ch0/1 to dpu_disp0/1_ldb1/2_ch0/1.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:05:32 +08:00
8f8987f5c5 arm64: dts: imx8mq: Add idle states and gpcv2 wake_request broken property
Add the cpu-sleep idle state with all the necessary parameters and also add
the cpu-idle-states to the cpu nodes.

The 'broken-wake-request-signals' property is used to let the irq-imx-gpcv2
driver know that the wake request signals from GIC are not linked to the
GPC at all and, therefore, the driver should  make use of the dedicated
workaround to explicitly wake up the target core on every IPI.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
2019-11-25 16:05:31 +08:00
082a776ee0 arm: dts: add 'auto-cmd23-broken' for eMMC on imx6qpdl/imx6sx/imx7d
Broken the auto cmd23 function for eMMC on imx6qpdl/imx6sx/imx7d, otherwise
the eMMC RPMB write access will return general fail.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:05:30 +08:00
a35a666c7f ARM64: dts: imx8qm-mek: fix the usdhc2 cd and wp setting
Change to set the correct pad for usdhc2 cd pin and wp pin.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:05:29 +08:00
51c4b191a8 ARM64: imx8qm: add edma device nodes
edma devices are slight different with i.mx8qxp, such as different
edma2 called on i.mx8qm while edma0 called on i.mx8qxp for the same
edma address map. Besides, dma channel used by audio/uart may be
different with i.mx8qxp too.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:05:29 +08:00
520edaf9a2 arm: dts: imx7ulp: remove the duplicated edma node
- remove the duplicated edma node
- use upstream edma node index like edma1

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:29 +08:00
c2c4be04ce arm64: dts: imx8qm: Add system controller watchdog support
Add scu watchdog support for i.MX8QM.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:05:28 +08:00
d4eb13ee3e arm64: dts: imx8qm: Add mbox-names channel name for general MU IRQ
General MU IRQ is added but with no name specified in mbox-names
node, add it.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:05:28 +08:00
2ad117183e arm64: imx8qxp: Add CAN wakeup support
Pass wakeup source's hardware irq number for CAN.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:05:27 +08:00
98b8469a7a arm64: imx8qm: Add CAN wakeup support
Pass wakeup source's hardware irq number for CAN.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:05:27 +08:00
f64d1e8f38 arm64: dts: imx8qxp: add CAN alias
Add CAN alias on i.MX8QXP.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:05:26 +08:00
5d9f1d45f2 arm64: dts: imx8qm: add CAN alias
Add CAN alias on i.MX8QM.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:05:25 +08:00
9240a0be5d arm64: dts: imx8qxp-ai_ml: fix aliase
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:24 +08:00
9493b7abaa arm64: dts: add lpspi2 support for imx8qm-mek board
Enable LPSPI2 function on imx8qm-mek board. LPSPI2 pinout are on the
base board.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:05:24 +08:00
20341403d2 arm64: imx8qxp: Add IRQSTEER wakeup support
Add a "wakeup-irq" property in scu pd's node to pass wakeup
source's hardware irq number for irqsteer wakeup support in
kernel.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:05:22 +08:00
027f602559 arm64: imx8qm: Add IRQSTEER wakeup support
Add a "wakeup-irq" property in scu pd's node to pass wakeup
source's hardware irq number for irqsteer wakeup support in
kernel.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:05:22 +08:00
e1e0ac72cd arm64: dts: imx8: convert enet&uart clock to new binding
convert enet&uart clock to new binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:22 +08:00
5157f9ba3e arm64: dts: imx8qm-mek: add tja1100 net card support
Add tja1100 net card support on imx8qm MEK base board
enet2 connector.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Aisheng: fix small conflicts during upgrade ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:21 +08:00
4efe4cf2e1 arm64: dts: imx8qm-mek: enable enet2 port
Add enet2 port enable for imx8qm MEK board.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:20 +08:00
155046d3d7 arm64: dts: imx8qm-mek: enable dma subsystem i2c0 and i2c1
Enable dma subsystem i2c0 and i2c1.
Enable max7322 i2c slave device.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:20 +08:00
16a284f191 arch: arm64: imx8qm: add CAN node in devicetree
Add CAN node for imx8qm in devicetree.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:05:19 +08:00
7051e8c236 arch: arm64: imx8qm: add lpi2c and intmux for CM41 subsystem
Add lpi2c and intmux for CM41 subsystem.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:05:19 +08:00
14fe1de8bc arch: arm64: imx8qxp: drop multi-pd for CAN device
From HW point of view, CAN1/2 do not depend on CAN0 PD, it just uses
CAN0 clock which could be handled by clock driver itself. Now clock
runtime pm has support it, so drop multi-pd for CAN1/2.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:05:18 +08:00
bc224ea990 arm64: dts: imx8qm-mek: add modem reset for BT uart port
Add modem reset node for BT uart port.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:18 +08:00
458f4e3980 arm64: dts: imx8qm-mek: add lpuart ports
Add lpuart1/2/3 ports for MEK board.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:17 +08:00
098d901430 arm64: dts: imx8qm: add serial alias
Add i.MX8QM serial alias for lpuart ports.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:16 +08:00
e7cbfedccf arm64: dts: imx8-audio: disable dsp lpcg for qm
Can't access this LPCG on QM, not sure if it's doc incorrectness issue.
Anyway it seems the driver actually is not using it currently, so it's
safe to disable.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:16 +08:00
2807ae242e arm64: dts: imx8qm: correct lpuart compatible string
imx8qm lpuart is the same as imx8qxp, and driver's compatible
string in of_device_id is "fsl,imx8qxp-lpuart", so change imx8qm
lpuart compatible string to "fsl,imx8qxp-lpuart".

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:05:15 +08:00
4e028df4e3 arm: dts: imx: enable the rpmsg on imx legacy platforms
Based on the mailbox MU driver, enable the RPMSG on i.MX legacy
platforms.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:05:15 +08:00
0070bf4a5a arm64: dts: imx: hsio: move pciea into qm hsio ss
move pciea into qm hsio ss

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:14 +08:00
39b06bd02e arm64: dts: imx8-audio: disable sai4&5 temporarily
Due to SCU SAI4&5 clock is still not registered.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:13 +08:00
c8eb932379 arm64: dts: imx: imx8qxp img does not support csi1
imx8qxp img does not support csi1
Note: a better way is to split csi, pi and img ss,
then imx8qm/qxp could select the required ones.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:12 +08:00
1651d4ea40 arm64: dts: imx8: img: csi and pi lpcgs depend on ISI power
ci and pi lpcgs depend on ISI power, otherwise, accessing LPCG
will abort.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:12 +08:00
fafde519da arm64: dts: imx8qxp: postpone gpu ss register
GPU driver does not support DEFER_PROBE, we have to postpone
it's register to ensure it's probe&suspend is later than the dependent
resoureces.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:11 +08:00
654bbac86c arm64: dts: imx8qm: include second level SoC dtsi
Include the required second level SoC dtsi.
Also move PD node before scu clk node.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:11 +08:00
85b32baaba arm64: dts: imx8qxp: update fec fallback compatible string
update fec fallback compatible string

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:10 +08:00
98ab84636e arm64: dts: imx8qxp-mek: convert to new clock binding
convert to new clock binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:10 +08:00
c637f0d66a arm64: dts: imx8qxp-mek-dsp: convert to new clock binding
convert to new clock binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:09 +08:00
0a0add4eb9 arm64: dts: imx8qm: convert to new clock binding
convert to new clock binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:09 +08:00
7d99868f45 arm64: dts: imx8qm-mek: clean up for new clock binding
clean up for new clock binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:08 +08:00
0489b96a45 arm64: dts: imx8-mek-max9286: convert to dt dummy clock
convert to dt dummy clock

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:07 +08:00
64058fd71d arm64: dts: imx8qxp-enet2-tja1100: fix ptp clock
fix ptp clock

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:07 +08:00
d5bdd2aae9 arm64: dts: imx8qxp-enet2-tja1100: fix enet 50M ref clock
It's actually SCU clk, not LPCG clk.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:06 +08:00
042f030b90 arm64: dts: imx8: gpu0: move into a separate ss dtsi
move gpu0 changes into a separate ss dtsi

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:06 +08:00
ce1b32cea9 arm64: dts: imx8: gpu: fully switched to new clk binding
fully switched to new clk binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:05 +08:00
bee78ead95 arm64: dts: imx8qxp: convert cpu clocks to new binding
convert cpu clocks to new binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:05 +08:00
191e226508 arm64: dts: imx8: mipi/lvds: fully switched to new clk binding
fully switched to new clk binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:04 +08:00
5e48fdd8a5 arm64: dts: imx8: dc: fully switched to new clk binding
fully switched to new clk binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:04 +08:00
51bb143a9f arm64: dts: imx8: hsio: fully switched to new clk binding
fully switched to new clk binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:02 +08:00
18be06c7b8 arm64: dts: imx8: img: fully switched to new clk binding
fully switched to new clk binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:02 +08:00
9547230297 arm64: dts: imx8: audio: fully switched to new clk binding
fully switched to new clk binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:01 +08:00
464d1ca647 arm64: dts: imx8: cm40: move into a separate ss dtsi
move cm40 changes into a separate ss dtsi

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:01 +08:00
937b511d2f arm64: dts: imx8: cm40: fully switched to new clk binding
fully switched to new clk binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:01 +08:00
cdd5694363 arm64: dts: imx8: dma: fully switched to new clk binding
fully switched to new clk binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:05:00 +08:00
19ca7baa77 arm64: dts: imx8: lsio: fully switched to new clk binding
fully switched to new clk binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:59 +08:00
582cadd072 arm64: dts: imx8: lsio: fix mu property
fix mu property

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:58 +08:00
f9a192b4bf arm64: dts: imx8: conn: fully switched to new clk binding
fully switched to new clk binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:57 +08:00
918ba1b3e4 arm64: dts: imx8qxp: add fallback compatible string for scu clk
add fallback compatible string for scu clk

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:57 +08:00
7976fada92 arm64: dts: imx8qm: fix lpuart alias name
fix lpuart alias name

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:56 +08:00
63e445a6d6 arm64: dts: imx8qm: add dma ss support
The DMA SS of MX8QM is mostly the same as the DMA part in MX8QXP ADMA SS
while it has one more instance for each of LPUART, ADC and LPI2C. And unlike
MX8QXP that flexcan clocks are shared between multiple CAN instances,
MX8QM has separate flexcan clock slice.

So we reuse the most part of common imx8-ss-dma.dtsi and add new things
based on it.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:55 +08:00
409a169daa arm64: dts: imx8: split adma ss into dma and audio ss
amda ss is consisted of dma and audio ss in qxp which are
also used in qm.
Let's split them into two ss for better code reuse.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:55 +08:00
f89269175e arm64: dts: imx8qm: add conn ss support
The CONN SS of MX8QM is mostly the same as MX8QXP except it has one more
USB HSIC module support. So we can fully reuse the exist CONN SS dtsi.
Add <soc>-ss-conn.dtsi with compatible string updated according to
imx8-ss-conn.dtsi.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:54 +08:00
d0587e6458 arm64: dts: imx8qm: add lsio ss support
The LSIO SS of MX8QM is exactly the same as MX8QXP. So we can fully
reuse the exist LSIO SS dtsi. Add <soc>-ss-lsio.dtsi with compatible
string updated according to imx8-ss-lsio.dtsi.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:53 +08:00
584d649472 arm64: dts: imx8: switch to new lpcg clock binding
switch to new lpcg clock binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:52 +08:00
df244316e4 arm64: dts: imx8: switch to two cell scu clock binding
switch to two cell scu clock binding

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:51 +08:00
5b6c64df1e arm64: dts: imx8: add adma lpcg clocks
Add adma lpcg clocks

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:50 +08:00
864cef80b1 arm64: dts: imx8: add conn lpcg clocks
Add conn lpcg clocks

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:50 +08:00
c63951de64 arm64: dts: imx8: add lsio lpcg clocks
Add lsio lpcg clocks

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:50 +08:00
db0866d1d1 arm64: dts: imx8qxp: orginize dts in subsystems
MX8 SoC is comprised of a few HW subsystems while some of them can be
reused in the different SoCs. So let's re-orginize them into subsystems
in device tree as well for the possible reuse of the common part.

Note, as there's still no devices of hsio subsys, so removed it
first instead of creating a subsys headfile with no devices.
They will be added back when new devices added.

NOTE: this is a complementary patch of
c24fc267a8a9 ("arm64: dts: imx8qxp: orginize dts in subsystems"
based on latest upstream versions.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:49 +08:00
9d055faa28 arm64: dts: imx8qxp: move scu pd node before scu clock node
SCU clock depends on SCU Power domain. So let's move scu pd node
before scu clock to make it probe earlier.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:49 +08:00
a07118c666 arm64: dts: imx8qxp: add fallback compatible string for scu pd
According to binding doc, add the fallback compatible string for
scu pd.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:47 +08:00
996554bb19 ARM: dts: imx7ulp-evk: enable lpuart and edma
Enable lpuart and edma.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:04:47 +08:00
0a6ce67012 arm64: dts: imx8qxp: add lpuart2/3/4 support
Add imx8qxp lpuart2/3/4 support.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Aisheng: fix small conflicts during upgrade ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:46 +08:00
d54479855c arm64: dts: add the rpmsg support for imx8qm
Add the reserved memory and enable RPMSG.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:04:46 +08:00
291d77d276 arm: dts: add the rpmsg into the dts file
- Mailbox is used in the RPMSG implementation.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:04:45 +08:00
d7373a4bdd arm64: dts: Allow playing S24_LE samples
For 24 bits samples SAI is not able to derive a bitclk. So,
use tdm width = 32 so that requested rate is always a multiple of 32.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 16:04:45 +08:00
8f842aa85b arm64: dts: imx8qxp: enable enet2 port for MEK board
Enable enet2 port for MEK board.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Aisheng: fix small conflicts during upgrade ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:44 +08:00
f5c1692354 arm64: dts: define the specific device dma pool for rpmsg
Define the specific device dma pool for iMX8M RPMSG.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:04:44 +08:00
53eb4fa255 arm64: dts: imx8qxp: refine the rpmsg definitions
Move the memory definition of the RPMSG to the board dts file.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:04:42 +08:00
bf81727f21 arm64: dts: enable MLB for imx6dl-sabresdauto
Because the pin conflict between fec and mlb, add a
imx6dl-sabreauto-enetirq.dts to avoid the conflict.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:04:42 +08:00
fe5efc9cf6 MLK-21985-1 arm64: dts: imx8mq: fix vpu dts build error
../arch/arm64/boot/dts/freescale/imx8mq.dtsi:1074.21-1088.5: ERROR (phandle_references): /soc@0/vpu@38300000: Reference to non-existent node or label "sw1c_reg"

ERROR: Input tree has errors, aborting (use -f to force output)
scripts/Makefile.lib:297: recipe for target 'arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dtb' failed
make[3]: *** [arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dtb] Error 2

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:41 +08:00
eed9bc60b9 arm64: imx8qxp: add multi-pd support for CAN1/2
Add multi-pd support for CAN1/2 due to they share CAN0's clock.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:04:41 +08:00
13391826e5 MLK-10913-2: arch: arm: imx6ul: add SIM device node
Add SIM device node.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:04:40 +08:00
7af5742237 MLK-10600-3: arch: arm: imx7d: add SIM device node
Add SIM device node.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
[ Aisheng: fix minor conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:39 +08:00
c142237fef MLK-22041: arm64: dts: one more range entry for fspi
add one more range entry for fspi memory area.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:04:39 +08:00
eeb9c2d28b Revert "arm64: dts: imx8mq-evk: disable usb due to it causes boot hang"
This reverts commit 8240161b1488a24d71df07f5e43fcb77dd562c27.
Since the dwc3 feature branch resolved the boot hang, so revert
this patch.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 16:04:38 +08:00
8dd34f6aed MLK-21985-11 arm64: dts: imx8qxp-mek: fix cs42888 gpio polarity
It should be ACTIVE_HIGH.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:37 +08:00
175f164c79 arm64: dts: imx8qm: Add general MU interrupt support
Add general MU interrupt support, now suspend/resume waked
up by RTC alarm is working.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:36 +08:00
3027b04eab arm64: dts: imx8qm: Add A53 OPP table
Add A53 OPP table to support cpu-freq.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:36 +08:00
f6e276ee87 arm64: dts: imx8qm: Add thermal zone node
This patch adds i.MX8QM thermal zones support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:36 +08:00
704919bc18 arm64: dts: imx8qm: Add SCU RTC node
Add SCU RTC node to support SC RTC driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:35 +08:00
c8290930f0 arm64: dts: imx8qxp: add pmic thermal zone
Add i.MX8QXP MEK board's PMIC thermal zone support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:34 +08:00
2b2bc09293 arm64: dts: imx8: add fec fuse mac support
Add ocotp fuse support and enable enet MAC fuse.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:04:34 +08:00
c8ae224d26 arm64: dts: imx8mm: add nvmem mac address support
Add nvmem mac address support, then enet controller
can read valid mac address from efuse.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:04:33 +08:00
c9e4330dc1 arm64: dts: imx8mq: add nvmem mac address support
Add nvmem mac address support, then enet controller
can read valid mac address from efuse.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:04:33 +08:00
37f783cdf8 MLK-21960-4: arm64: dts: enable fspi in imx8qxp dts
enable fspi in imx8qxp DT file

Signed-off-by: Han Xu <han.xu@nxp.com>
[ Aisheng: sort in reg address and fix conflict ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:32 +08:00
f5fc8e4f9a MLK-21960-3: arm64: dts: enable fspi in imx8mm dts
enable fspi in imx8mm DT file

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:04:31 +08:00
6fac62a282 arm64: dts: imx8qxp: enable enet1 port
Currently enet cannot work due to the wrong clock tree and
incorrect IO voltage, correct them.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:04:31 +08:00
09c09cbf91 arm64:dts:vpu:add reserved memory for windsor encoder
Add 'encoder_reserved' for windsor encoder

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:04:30 +08:00
26de6057eb arm64: dts: imx8mq: Add busfreq node
Port with no interesting changes.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:04:30 +08:00
ca8f0a8df5 arm64: dts: imx: enable uart1 and uart3 ports
Enable uart1 and uart3 ports, uart1 port is for Bluetooth.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Aisheng: fix small conflicts during upgrade ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:29 +08:00
b3fa6fc11c arm64: dts: imx8mm: Add busfreq 2019-11-25 16:04:29 +08:00
e03d22695c arm64: dts: add dts for GMSL MAX9286 device node
GMSL MAX9286 is a quad 1.5Gbps GMSL Deserializer with Coax
or STP Input and CSI-2 Output. IMX8QM support two max9286
and IMX8QXP only support one.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
[ Aisheng: fix small conflicts during upgrade ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:29 +08:00
b9e9466491 ARM: dts: imx6q: add missing clocks for cpufreq
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:28 +08:00
e9fc677962 arm64: dts: imx8mq-evk: disable usb due to it causes boot hang
USB seems cause the system to boot hang.
Disable it to allow the booting:
[    1.070165] GPIO line 381 (wl-reg-on) hogged as output/high
[    1.079363] pfuze100-regulator 0-0008: Full layer: 2, Metal layer: 1
[    1.086361] pfuze100-regulator 0-0008: FAB: 0, FIN: 0
[    1.091438] pfuze100-regulator 0-0008: pfuze100 found.
[    1.109038] i2c i2c-0: IMX I2C adapter registered
[    1.114223] imx8mq-usb-phy 382f0040.usb-phy: 382f0040.usb-phy supply vbus not found, using dummy regulator

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:27 +08:00
6945d59d54 arm64: dts: imx8m: add the rpmsg support
Add the imx8mq/imx8mm rpmsg support.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:04:27 +08:00
cd8bc8edd7 arm: dts: imx: update the clocks of cpu node
Update the clocks of cpu to match with the
cpufreq driver.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:04:26 +08:00
b3db7efdc5 arm: dts: imx: add busfreq node for imx6sll
Add busfreq node for i.MX6SLL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:04:26 +08:00
d0a55efa0a arm: dts: imx: add ocram node for low power support on imx6sll
Add the OCRAM node on i.MX6SLL for low power feature support.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:04:25 +08:00
e36c0d4cac arm: dts: imx: add busfreq node for imx6ull
Add the busfreq node for i.MX6ULL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:04:22 +08:00
1fb6fafe98 arm: dts: imx: Add busfreq node for imx6ul
Add the busfreq node for i.MX6UL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:04:21 +08:00
64775cded5 arm: dts: imx: Add ocram node for low power feature support on imx6ul
Add the OCRAM node to support low power feature on i.MX6UL/ULL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:04:21 +08:00
c7fabb5e26 arm: dts: imx: Add busfreq node for imx6sl
Add the busfreq node for i.MX6SL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 16:04:21 +08:00
ddbadf6870 arm: dts: imx: Add ocram node for low power feature on imx6sl
Add the ocram node in dts for low power feature support
on i.MX6SL.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
[ Aisheng: fix small conflicts during upgrade ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:20 +08:00
056478146c arm64: dts: add parallel capture subsystem device node
Add parallel capture subsystem device nodes for imx8qxp platform.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:04:19 +08:00
5f96d0fe49 arm64: dts: imx8qxp: add the rpmsg support
Add the rpmsg support.
- Setup the rpmsg reserved memory, one is used for vring, the other one
is used for shared buffers.
- The mailbox of the lsio mu5a is used by rpmsg on imx8qxp platforms

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:04:18 +08:00
86d846cbd4 ARM: dts: imx6sll: correct ecspi/sdma compatible
Correct ecspi/sdma compatible since ecspi errata ERR009165
not fixed on i.mx6sll chip.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
[ Aisheng: fix small conflicts during upgrade ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:15 +08:00
8877af4ee5 ARM64: dts: freescale: imx8mm/8mq: update new compatible name for ecspi and sdma
Add new 'imx6ul-ecspi' compatible name for ecspi and new 'imx8mq-sdma' name
for sdma since on i.mx8mm/mq chip fix ecspi errata.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:04:14 +08:00
1fb98e9584 Revert "ARM: dts: imx6: Use correct SDMA script for SPI cores"
There are two ways for SDMA accessing SPBA devices: one is SDMA->AIPS
->SPBA(masterA port), another is SDMA->SPBA(masterC port). Please refer
to the 'Figure 58-1. i.MX 6Dual/6Quad SPBA connectivity' of i.mx6DQ
Reference Manual. SDMA provide the corresponding app_2_mcu/mcu_2_app and
shp_2_mcu/mcu_2_shp script for such two options. So both AIPS and SPBA
scripts should keep the same behaviour, the issue only caught in AIPS
script sounds not solide.
  The issue is more likely as the ecspi errata
ERR009165(http://www.nxp.com/docs/en/errata/IMX6DQCE.pdf):
eCSPI: TXFIFO empty flag glitch can cause the current FIFO transfer to
           be sent twice
So revert commit 'dd4b487b32a3' firstly.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:04:14 +08:00
61e25044be Revert "ARM: dts: imx6q: Use correct SDMA script for SPI5 core"
There are two ways for SDMA accessing SPBA devices: one is SDMA->AIPS
->SPBA(masterA port), another is SDMA->SPBA(masterC port). Please refer
to the 'Figure 58-1. i.MX 6Dual/6Quad SPBA connectivity' of i.mx6DQ
Reference Manual. SDMA provide the corresponding app_2_mcu/mcu_2_app and
shp_2_mcu/mcu_2_shp script for such two options. So both AIPS and SPBA
scripts should keep the same behaviour, the issue only caught in AIPS
script sounds not solide.
  The issue is more likely as the ecspi errata
ERR009165(http://www.nxp.com/docs/en/errata/IMX6DQCE.pdf):
eCSPI: TXFIFO empty flag glitch can cause the current FIFO transfer to
       be sent twice
So revert commit 'df07101e1c4a' firstly.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:04:13 +08:00
7052d5ef55 ARM: dts: imx7d: add low power support
This patch adds low power mode support for i.MX7D, including
FastMix off feature support, low power idle support and A7-M4
AMP power management support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:13 +08:00
b92e16830e ARM: dts: imx6sx: add M4 support
Add AMP system support for i.MX6SX.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:11 +08:00
cf6f49c024 ARM: dts: imx6sx: add more clocks for cpu-freq driver
When cpu-freq driver switch ARM clock source from PLL1 to
STEP clock, need to keep PLL1 enabled and from its bypass
clock source OSC, this is necessary for i.MX6SX low power
idle.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:11 +08:00
dfa9c3b870 ARM: dts: imx6sx: add fastmix off suspend support
Add suspend with FastMix OFF support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:10 +08:00
956b8b6daa ARM: dts: imx6sx: add bus-freq support
Add busfreq node and adjust ocram space to support bus-freq
driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:10 +08:00
80f8151aa5 ARM: dts: imx6q: add bus-freq support
Add busfreq/ocram/mmdc node to bus-freq support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:10 +08:00
17f3800cb1 ARM: dts: imx7d: add bus-freq driver support
This patch adds i.MX7D bus-freq driver support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:09 +08:00
51e520c19f arm64: dts: imx8qm-mek: add ov5640 sensor support
Add ov5640 sensor support for imx8qm platform

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:04:09 +08:00
a136034d5f arm64: dts: imx8qm.dtsi: add image sensor subsystem support
Add image sensor subsystem support for imx8qm platform

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:04:08 +08:00
9cc6950b27 arm64: dts: imx8qxp-mek: Enable IT6263 LVDS to HDMI displays
This patch enables IT6263 LVDS to HDMI displays on the iMX8qxp mek platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:04:08 +08:00
62285a3318 arm64: dts: imx8qxp-mek: Enable dpu node
This patch enables dpu node on the iMX8qxp mek platform.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:04:07 +08:00
684fe315b3 arm64: imx8qxp.dtsi: Add display subsystem support
This patch adds i.MX8qxp display subsystem support in device tree.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:04:06 +08:00
df466f76d8 arm64: imx8qxp.dtsi: Introduce LVDS subsystem support
This patch introduces i.MX8qxp LVDS subsystem support in device tree.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: update irqsteer to latest binding ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:05 +08:00
98c4feea2b arm64: imx8qxp.dtsi: Introduce DC subsystem support
This patch introduces i.MX8qxp DC subsystem support in device tree.
The dpu node is supported.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: update irqsteer to latest binding ]
[ Aisheng: Fix rebase conflict ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:05 +08:00
be9cf2f5b4 arm64: dts: freescale: imx8qxp: add cpu opp table
Add CPU opp table for cpu-freq.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:04 +08:00
f7f6138204 ARM64: dts: imx8qxp: enable dsp function
enable dsp function

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: fix conflict due to upstreamed MU13 ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:04:04 +08:00
30608e4d28 arm64: dts: freescale: imx8qxp: add soc node
Add SoC node for Linux kernel SoC driver to use.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 16:04:03 +08:00
6e9a87265b ARM64: dts: imx8qxp: enable audio modules
enable audio modules

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:04:03 +08:00
870fc0e0fe arm64: dts: imx8qxp: add LPSPI node in adma
Add LPSPI decive in adma subsystem.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 16:04:02 +08:00
d89f1dd6d0 ARM64: dts: imx8qxp-mek: enable USB2
Enable both controller and PHY for USB2.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:04:02 +08:00
370e4a3bef ARM64: dts: imx8qm-mek: enable USB2
Enable both USB2 controller and PHY.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:04:01 +08:00
8e9d597ea4 ARM64: dts: imx8-ss-conn: add NXP USB2 node
Add NXP USB2 controller and PHY node

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 16:04:00 +08:00
b0026e3c00 arm: dts: imx7d-sdb: add SD3.0 support for usdhc1
Add usdhc1 support SD3.0.

Besides, add fsl,tuning-start-tap for all usdhc, imx usdhc IP
logic require the tuning-start-tap larger than 10, to make
sure the tuning logical can work normal.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:04:00 +08:00
e2581a17e8 ARM64: dts: imx8qxp/imx8qm: add SD3.0 support
Add SD3.0 support, and make usdhc support eMMC V5.1

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 16:04:00 +08:00
93f7238341 ARM64: dts: freescale: imx8qxp-mek: add gpu device
Add gpu in device tree:
arch/arm64/boot/dts/freescale/imx8qxp.dtsi
arch/arm64/boot/dts/freescale/imx8qxp-mek.dts

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 16:03:59 +08:00
01ea60eb25 ARM64: dts: imx8mq-evk: add typec switch node
PTN36043 is a super speed active channel switch controlled
by a GPIO, used for USB3 data channel switch according to typec
orientation.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 16:03:59 +08:00
9bef6e0c61 ARM64: dts: imx8mq-evk: add typec port controller node
Add typec port controller node ptn5110, which is a standard
TCPCI interface with PD PHY, imx8mq-evk board equiped with
a typec connector which is DRP on power, with the usb port
dwc3_0 has dual role enabled, so typec can control the data
role of the otg port.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 16:03:58 +08:00
5c95116d03 ARM64: dts: imx8mq-evk: enable the first USB port
Enable the USB0 as dual role mode.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 16:03:58 +08:00
1dceaa46a3 arm64: dts: fsl: imx8mq: add "snps,power-down-scale" for usb nodes
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 16:03:57 +08:00
4bb24e1b44 arm64: dts: imx: add ov5640 sensor device node in dts
Add ov5640 sensor device node support in device tree

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:03:56 +08:00
03b13719b1 arm64: dts: imx: add image subsystem dts support for IMX8
Add image subsystem of imx8 device tree support

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
[ Aisheng: update irqsteer to latest binding ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:03:56 +08:00
addcb26299 ARM64: dts: freescale: imx8qxp: add lpuart1 dma support
Add lpuart1 with dma support.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
[ Aisheng: change title as lpuart1 is already there ]
[ Aisheng: fix upgrade conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:03:55 +08:00
97717f1b49 arm64: dts: vpu: add hantro decoder
Add vpu in device tree:
arch/arm64/boot/dts/freescale/imx8mq-evk.dts
arch/arm64/boot/dts/freescale/imx8mq.dtsi

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:03:55 +08:00
036d3dfa40 ARM64: dts: imx: add i.MX8QXP thermal support
Add i.MX8QXP CPU thermal zone support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
[ Aisheng: fix wrong postiion of thermal zones ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:03:54 +08:00
3a4a0b0520 ARM64: dts: add the hsio pcie support for imx8qm/qxp
Add the hsio pcie support for imx8qm/qxp.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:03:54 +08:00
b02e0dfef8 arm64: dts: imx8qxp: add FlexCAN in adma
Add FlexCAN decive in adma subsystem.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:03:54 +08:00
c607df59ff arm64: dts: imx8qxp: add i2c and intmux in cm40
Add i2c and intmux device which are in cm40 subsystem.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 16:03:53 +08:00
5b2c6f40bd ARM64: dts: freescale: imx8qxp: add edmav3 support
Add edmav3 in dts.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:03:52 +08:00
4ea49e9e9e arm64: dts: imx8: add vpu support
add vpu support

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 16:03:52 +08:00
7a3f0cae70 arm64: dts: imx: add imx8qm mek support
The i.MX8QuadMax is a Dual (2x) Cortex-A72 and Quad (4x) Cortex-A53
proccessor with powerful graphic and multimedia features.
This patch adds i.MX8QuadMax MEK board support.

Note that MX8QM needs a special workaround for TLB flush due to a SoC
errata, otherwise there may be random crash if enable both clusters of
A72 and A53. As the errata workaround is still not in mainline, so we
disable A72 cluster first for MX8QM MEK.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:03:52 +08:00
a8caf2c7d5 arm64: dts: add imx8qm common dts file
The i.MX8QuadMax is a Dual (2x) Cortex-A72 and Quad (4x) Cortex-A53
proccessor with powerful graphic and multimedia features.
This patch adds i.MX8QuadMax SoC dtsi file.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:03:50 +08:00
412967b5b0 arm64: dts: imx8qxp: orginize dts in subsystems
MX8 SoC is comprised of a few HW subsystems while some of them can be
reused in the different SoCs. So let's re-orginize them into subsystems
in device tree as well for the possible reuse of the common part.

Note, as there's still no devices of hsio subsys, so removed it
first instead of creating a subsys headfile with no devices.
They will be added back when new devices added.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:03:50 +08:00
021427a7b0 spi: spi-fsl-qspi: Introduce variable to fix different invalid master Id
Different platforms have different Master with different SourceID on
AHB bus. The 0X0E Master ID is used by cluster 3 in case of LS2088A.
So, patch introduce an invalid master id variable to fix invalid
mastered on different platforms.

Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>
Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
2019-11-25 16:03:46 +08:00
4ec3b46f94 dt-bindings: spi: spi-fsl-qspi: Add bindings of ls1088a and ls1012a
Signed-off-by: Ashish Kumar <ashish.kumar@nxp.com>
Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
2019-11-25 16:03:45 +08:00
20ad39f99a spi: spi-fsl-qspi: dynamically alloc AHB memory for QSPI
dynamically alloc AHB memory for QSPI controller.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:03:44 +08:00
7bab889b31 spi: spi-nxp-fspi: Enable the Octal Mode in MCR0
Enable the octal combination mode in MCR0

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:03:42 +08:00
e2aff3e4c2 MLK-21960-2: spi: fspi: dynamically alloc AHB memory
dynamically allocate AHB memory as needed.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:03:41 +08:00
6283e73009 MLK-21960-1: spi: fspi: enable fspi on imx8qxp and imx8mm
enable fspi on imx8qxp and imx8mm

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:03:41 +08:00
4672188dc4 MLK-21520-3 spi: lpspi: remove fsl_lpspi->chipselect
Replace fsl_lpspi->chipselect by controller->cs_gpios. Clean up the
code.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:03:39 +08:00
be3ecfb1fa MLK-21520-2 spi: lpspi: add multi SS support in PIO mode
Add "fsl,spi-num-chipselects" check to support multi SS function in PIO
mode.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:03:39 +08:00
908cee55b7 MLK-21520-1 spi: lpspi: add NULL check when probe device
Add a NULL check for device node and lpspi_platform_info when lpspi
device probe.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:03:38 +08:00
a417a92a2d MLK-10404-1 spi: spi-imx: use XCH mode even in DMA mode
To workaroud the TKT238285, the safe way is use XCH mode in SDMA
script to simulate as PIO mode which never report such issue. Meanwhile,
set tx threashold as 0. But this workaroud will bring performance impacted,
below performance data is collected by 'dd' with SPI-NOR flash on i.mx6dl
sabresd board:

  mode                   write data            read data
--PIO                     194KB/s              644KB/s
--DMA normal
  (SMC, tx_thresh=32)     222KB/s              1.4MB/s
--DMA(XCH, tx_thresh=0)   210KB/s              1.0MB/s

Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 01be65fa5617aa192307ca38b6fc6128f3f0c3f7)
(cherry picked from commit 646a751a4d1d0e227a762b461d9b8f92605c26b1)
(cherry picked from commit b334993950)

Conflicts:
	drivers/spi/spi-imx.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 52b04b9b51)
2019-11-25 16:03:35 +08:00
250176ca52 MLK-11405 spi: imx : sets spi IOMUX to default state
SPI IOMUX is changed into reset state in LPSR mode. As a result,
spi can't work again.

This patch sets spi IOMUX to default state.

(cherry-picked from commit 2c8603c318)

Signed-off-by: Gao Pan <b54642@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 48de3eb17f)
2019-11-25 16:03:35 +08:00
4259cdb0f9 MLK-9817 spi: imx: convert all clk_enable to clk_prepare_enable
This is done in preparation for low power mode. Convert all clk_enable
to clk_prepare_enable and clk_disable to clk_disable_unprepare. Make sure
PLL3 power down when entering low power mode.

Signed-off-by: Bai Ping <b51503@freescale.com>
(cherry picked from commit 1808b31fdae576e775159a05cde9b45e404bb6e2)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit a58ef0c6a2)
2019-11-25 16:03:34 +08:00
daffda7adf dt-bindings: spi: imx: add i.mx6ul to state errata fixed
ERR009165 fixed from i.mx6ul, add it to show the errata fixed.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:03:34 +08:00
636b99dca4 spi: imx: remove ERR009165 workaround on i.mx6ul
ERR009165 fix on i.mx6ul and next chip, such as i.mx6ull/i.mx8mq/i.mx8mm.
Remove workaround on those chips. Add new i.mx6ul type for that.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:03:33 +08:00
463d071a51 spi: imx: fix ERR009165
Change to XCH  mode even in dma mode, please refer to the below
errata:
https://www.nxp.com/docs/en/errata/IMX6DQCE.pdf

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:03:32 +08:00
5393bb7ad5 dma: caam: fix compilation error
Fix compilation error, introduced by incorrect rebase of the
commit 9c51c141264c ("dma: caam: add dma memcpy driver"
on top of upstream
commit 1bcdf5a00f41 ("crypto: caam - make CAAM_PTR_SZ dynamic")

Fixes: 9c51c141264c ("dma: caam: add dma memcpy driver")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:03:30 +08:00
99b7650327 dma: caam: add dma memcpy driver
This module introduces a memcpy DMA driver based on the DMA capabilities
of the CAAM hardware block. CAAM DMA is a platform driver that is only
probed if the device is defined in the device tree. The driver creates
a DMA channel for each JR of the CAAM. This introduces a dependency on
the JR driver. Therefore a defering mechanism was used to ensure that
the CAAM DMA driver is probed only after the JR driver.

Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Tudor Ambarus <tudor-dan.ambarus@nxp.com>
Signed-off-by: Rajiv Vishwakarma <rajiv.vishwakarma@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
2019-11-25 16:03:29 +08:00
1154aa773a dmaengine: fsl-dpaa2-qdma: Add NXP dpaa2 qDMA controller driver for Layerscape SoCs
DPPA2(Data Path Acceleration Architecture 2) qDMA supports
virtualized channel by allowing DMA jobs to be enqueued into
different work queues. Core can initiate a DMA transaction by
preparing a frame descriptor(FD) for each DMA job and enqueuing
this job through a hardware portal. DPAA2 components can also
prepare a FD and enqueue a DMA job through a hardware portal.
The qDMA prefetches DMA jobs through DPAA2 hardware portal. It
then schedules and dispatches to internal DMA hardware engines,
which generate read and write requests. Both qDMA source data and
destination data can be either contiguous or non-contiguous using
one or more scatter/gather tables.
The qDMA supports global bandwidth flow control where all DMA
transactions are stalled if the bandwidth threshold has been reached.
Also supported are transaction based read throttling.

Add NXP dppa2 qDMA to support some of Layerscape SoCs.
such as: LS1088A, LS208xA, LX2, etc.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
2019-11-25 16:03:26 +08:00
1e9b1c9bd7 dmaengine: fsl-dpaa2-qdma: Add the DPDMAI(Data Path DMA Interface) support
The MC(Management Complex) exports the DPDMAI(Data Path DMA Interface)
object as an interface to operate the DPAA2(Data Path Acceleration
Architecture 2) qDMA Engine. The DPDMAI enables sending frame-based
requests to qDMA and receiving back confirmation response on transaction
completion, utilizing the DPAA2 QBMan(Queue Manager and Buffer Manager
hardware) infrastructure. DPDMAI object provides up to two priorities for
processing qDMA requests.
The following list summarizes the DPDMAI main features and capabilities:
	1. Supports up to two scheduling priorities for processing
	service requests.
	- Each DPDMAI transmit queue is mapped to one of two service
	priorities, allowing further prioritization in hardware between
	requests from different DPDMAI objects.
	2. Supports up to two receive queues for incoming transaction
	completion confirmations.
	- Each DPDMAI receive queue is mapped to one of two receive
	priorities, allowing further prioritization between other
	interfaces when associating the DPDMAI receive queues to DPIO
	or DPCON(Data Path Concentrator) objects.
	3. Supports different scheduling options for processing received
	packets:
	- Queues can be configured either in 'parked' mode (default),
	or attached to a DPIO object, or attached to DPCON object.
	4. Allows interaction with one or more DPIO objects for
	dequeueing/enqueueing frame descriptors(FD) and for
	acquiring/releasing buffers.
	5. Supports enable, disable, and reset operations.

Add dpdmai to support some platforms with dpaa2 qdma engine.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
2019-11-25 16:03:25 +08:00
5882a6f8ef MLK-22909 dmaengine: fsl-edma-v3: clear interrupt coming after channel terminated
Clear EDMA_CH_INT in case dma done interrupt comes after channel terminated
instead of channel free-ed, otherwise, RCU maybe caught because it's
ignored without interrupt status cleared as Android team report in Monkey
test.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit ef91ff6ed465cebe2fe6483a480351abba36e237)
(cherry picked from commit 56ee55c71c)
2019-11-25 16:03:23 +08:00
3f8b89fadd MLK-22302-2: dmaengine: fsl-edma-v3: fix build warning with CONFIG_PM_SLEEP=n
Fix build waring with CONFIG_PM_SLEEP=n.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Andy Duan <fugang.duan@nxp.com>
(cherry picked from commit dfe2a75520)
2019-11-25 16:03:23 +08:00
7d7fb3da1c MLK-22284-2 dmaengine: fsl-edma-v3: check dma description before register touch
Check dma desscription firstly to ignore any unexpected interrupt
after channel terminate, otherwise, still have chance to touch channel
register whose power has been already off.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
(cherry picked from commit fd073e017e)
2019-11-25 16:03:23 +08:00
cfe6412faa MLK-22284-1 dmaengine: fsl-edma-v3: add power domains for each channel
Add power domains for each dma channel so that edma channel could
know the power state of every dma channel anytime and clear easily
unexpected interrupt which triggered before the last partition reset.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0b6da46b7b)
2019-11-25 16:03:22 +08:00
e8e9c9bc99 MLK-21443: dmaengine: fsl-edma-v3: clear pending irq before request irq
edma interrupt maybe happened during reboot or watchdog reset, meanwhile
gic never power down on i.mx8QM/QXP, thus the unexpect irq will come in
once edma driver request irq at probe phase. Unfortunately, at that time
that edma channel's power domain which power-up by customer driver such
as audio/uart driver may not be ready, so kernel panic triggered once
touch such edma registers which still not power up in interrupt handler.
Move request irq from probe to alloc dma channel so that edma channel's
power domain has already been powered, besides, clear meaningless
interrupt before request irq.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 0a0d8f8b94)
2019-11-25 16:03:21 +08:00
f55fd6f075 MLK-22798-1: dmaengine: fsl-edma-v3: do not enable interrupt in dev_2_dev
Do not enable interrupt in dev_2_dev with cyclic case, since in such
case no any interrupt needed. Otherwise many interrupt will come in
every 64 words transfered in ASRC case, which cause heavy system
loading.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit f0a3172e1c)
2019-11-25 16:03:20 +08:00
5b2c91a75e dmaengine: fsl-edma: calculate the real count for slave sg
Calculate the rela count for current slave sg after eDMA stop.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:03:19 +08:00
2432fcf604 dma: imx: add the 32bit dma limitation
Since the imx8qm/qxp hsio only supports up to 32bit
dma capability.
Add the 32bit dma limitation into dma binding document.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 16:03:19 +08:00
1432768dff MLK-20205-1: dmaengine: fsl-edma-v3: fix NULL pointer dereference
Fix 'null pointer dereferences issue' reported by coverity(CID-1477441).

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit 5343c0018af0af2eb3bb90c5a75e765b851a2c12)
2019-11-25 16:03:19 +08:00
9ff1f271a0 MLK-19931-1: dmaengine: fsl-edma-v3: fix potential kernel crash in cyclic
There is one potential race condition in virt-dma framework as below:
terminate dma channel after the last dma done interrupt, but before
vchan_complete tasklet scheduled, thus the free-ed 'vd' (free in
fsl_edma3_terminate_all) maybe still be touched in vchan_complete()
which cause NULL pointer crash.
  Kernel community noticed this issue and fix it at virt-dma level:
https://patchwork.kernel.org/patch/10057791/. To avoid backport too
much patches, set 'vc->cyclic = NULL' in terminate dma channel
interfaces to fix such issue easily.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 18c9083826400a2ef731496391a0b5e71d461a5f)
2019-11-25 16:03:18 +08:00
0b02c5f7d5 MLK-19022-2: dmaengine: fsl-edma-v3: add device_synchronize
Add device_synchronize for edma driver, since some driver such as
Audio need it to make sure dma done callback never come out after
resource related with dma channel free-ed by Audio driver. Android
team report such issue on MA-12087.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
(cherry picked from commit 483519c063b08fc1ce0dd297b6c186799cf639d6)
(cherry picked from commit 29ab274aca01ef8f5fc70e8c0a6d43a5bdb3c689)
2019-11-25 16:03:17 +08:00
9dc7c227d4 MLK-18248: dma: fsl-edma-v3: avoid touch unused edma channel
Avoid touch unused edma channel register in susped/resume, otherwise,
kernel crash if XRDC enabled in scfw.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit aa221c4aba34c6ce1ce5f561fa073bb8297cc0ff)
2019-11-25 16:03:17 +08:00
e3890608e2 MLK-17782 dma: fsl-edma-v3: fix issue reported by Coverity
Fix below issue reported by Coverity, actually, don't need this
condition check here, remove it.

CID undefined (#1 of 1): Wrong operator used (CONSTANT_EXPRESSION_RESULT)operator_confusion:
(16UL /* 1UL << 4 */) | (__u16)(__le16)tcd->csr is always 1/true regardless of the values of its operand.
This occurs as the logical first operand of "&&".

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit ab942110975cadcde57ab1110df03f526bd3fec5)
2019-11-25 16:03:16 +08:00
e2c4230707 MLK-17094 dma: fsl-edma-v3: add suspend/resume to restore back channel registers
Add suspend to save channel registers and resume to restore them back since
edmav3 may powered off in suspend.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
(cherry picked from commit 7eda1ae538ec7e7c0f993b3ea91805459f3dedd3)
2019-11-25 16:03:15 +08:00
f8e9e04f6d 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").

(cherry picked from commit e62e8707154f47e168fcfd148e97be4e2f991898)
2019-11-25 16:03:14 +08:00
fe8cf28f2b 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>
(cherry picked from commit 625afad5a0900bc3e3288510f61647b1d891a5a4)
2019-11-25 16:03:14 +08:00
9d36acb860 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>
(cherry picked from commit af8e197a92c9c024ec4fbfcf543d744e81748773)
2019-11-25 16:03:13 +08:00
ec32139328 MLK-15330-3 dma: fsl-edma-v3: add dual fifo support
There is Audio dual fifo cause that fill fifo one by one and
loop back after every minor loop:
  -- fill the first 32bit width fifo
  -- fill the next 32bit width fifo
  -- +MLOFF signed offset after the above two FIFOs filled
  -- loop back to the first step to handle the next minor loop.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
(cherry picked from commit 5aa5e9663bb3a834444b75ea086bef8c37ecb636)
2019-11-25 16:03:13 +08:00
4688ef9be7 MLK-15330-1: dma: fsl-edma-v3: combine two cells into one
For dual fifo case, fsl-edma-v3 need add another cell. It's not friendly
for user and it's possible other cells maybe added to other use cases,
so combine two cells into one now, and for some special use cases such as
dual fifo property can directly be passed by one bit of cell3 rather than
another cell.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
(cherry picked from commit 3ecd1b3382e2c746728842fb2c084fbb030eb5de)
2019-11-25 16:03:12 +08:00
b1b8c0ae94 MLK-15014 dma: fsl-edma-v3: clear DONE before E_SG enabled
Below described in RM, otherwise, channel error status(CHa_ES)
may be triggered:
The user must clear the CHa_CSR[DONE] bit before writing the
TCDa_CSR[MAJORELINK] or TCDa_CSR[ESG] bits.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
(cherry picked from commit c4164d0a15306174056c6ff423ba2408dd901fcf)
2019-11-25 16:03:12 +08:00
5dd7504280 MLK-15003-2: Document: fsl_edma_v3: update document
update fsl_edma_v3 document for #dma-cell is changed
one more cell is added, which is for local/remote access.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 65543fb7fefbdb7df4cb60931a88f61507c5073f)
2019-11-25 16:03:10 +08:00
f61b296ab2 MLK-15003-1: DMA: fsl-edma-v3: add one more parameter for xlate
The parameter is "is_remote", which is to use remote access for
edma, the default access is local access.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit eee976b30b0523680f30e762742984f5b5a01b97)
2019-11-25 16:03:10 +08:00
2f9e74892d MLK-14610 DMA: fsl-edma-v3: add fsl-edma-v3 support
Add edma-v3 driver on i.mx8qm.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
(cherry picked from commit d0ac0971c2e637ebddc853f12f71d130f5df4f91)
2019-11-25 16:03:10 +08:00
58d26348b1 MLK-23005: dmaengine: imx-sdma: correct data size of channel context
Correct data size of channel context which would be save and restore back
during suspend/resume. Otherwise, potential memory break may come as
USB met.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Reported-by: Jun Li <jun.li@nxp.com>
Tested-by: Jun Li <jun.li@nxp.com>
2019-11-25 16:03:05 +08:00
bb526c17a4 MLK-22972 dmaengine: imx-sdma: correct the script number for v3
Correct the ram script number for v3.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 16:03:05 +08:00
64acbb6d0a dma: imx-sdma: Add pm_ops to support suspend & resume
Add pm_ops to support suspend & resume

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:03:04 +08:00
d75a298a95 dma: imx-sdma: Fix issue with IMX_DMATYPE_HDMI
There is no bds for HDMI, so add one more condition
for sdma_alloc_bd

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:03:04 +08:00
95fdc2b77f MLK-22239-1: dmaengine: imx-sdma: Support 24bit/3bytes for sg mode
Support 24bit/3bytes for sg mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:03:03 +08:00
b9416dfe21 dmaengine: imx-sdma: update sdma script for multi fifo on SAI
update sdma script for multi fifo SAI on i.mx8MQ. Besides,Add
new cell for sw_done/sw_done_selector, because PDM need enable
software done feature in sdma script(same multi fifo script).
The new fourth cell defined as below:
        Bit31: sw_done
        Bit15~bit0: selector
For example: 0x80000000 means sw_done enabled for done0 sector which
is for PDM on i.mx8mm.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:03:02 +08:00
40373109c4 MLK-16885-1: DMA: imx-sdma: update the buswidth that is supported
update buswidth that is supported by sdma.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
(cherry picked from commit c6e6f9cf26)
2019-11-25 16:03:02 +08:00
a89c75d447 MLK-11259-1: dmaengine: imx-sdma: support dual fifo for DEV_TO_DEV
As SSI has dual fifo, add src_dualfifo and dst_dualfifo in imx_dma_data
to support dual fifo in DMA_DEV_TO_DEV.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit cfde1308f170166a0099ca39ee8733895f9626f0)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>

(cherry picked from commit 0ea90e5f83)
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:03:01 +08:00
e977370b6d dmaengine: imx-sdma: add sdma resume back after megafast off
On i.mx6sx or i.mx7d chip, megafast could be off in suspend which
means sdma controller will be power-ed off, thus sdma driver
should resume back including firmware loaded again.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
[ Aisheng: fix rebase conflict ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:03:00 +08:00
a3e3585408 dmaengine: imx-sdma: Add hdmi audio support in sdma
Add hdmi audio support.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:02:59 +08:00
ff3799c817 dmaengine: imx-sdma: support allocate memory from iram
Allocate memory from SoC internal SRAM so that we can turn off
voltage of external DDR to save power if 'iram' property in dts.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:02:59 +08:00
2d1e5b8f23 MLK-21309: dma: engine: sdma: add uart rom script
For syncing with unstreaming kernel on UART driver from 4.19 changed
to rom script for uart rx path, and the compatiblity of legacy kernel
using ram script, add both uart rom and ram script support, so add
rom script address.

ram script:
        uart_2_mcu_fix_addr
        uartsh_2_mcu_fix_addr /* through spba bus */
rom script:
        uart_2_mcu_addr
        uartsh_2_mcu_addr /* through spba bus */

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:02:58 +08:00
e4770db1f1 dmaengine: imx-sdma: fix ecspi1 rx dma not work on i.mx8mm
Because the number of ecspi1 rx event on i.mx8mm is 0, the condition
check ignore such special case without dma channel enabled, which caused
ecspi1 rx works failed. Actually, no need to check event_id0, checking
event_id1 is enough for DEV_2_DEV case because it's so lucky that event_id1
never be 0.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:02:58 +08:00
76772e7931 dt-bindings: dma: imx-sdma: add i.mx6ul/6sx compatible name
Add i.mx6ul and i.mx6sx compatible name.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:02:57 +08:00
d89ee194f6 dmaengine: imx-sdma: remove ERR009165 on i.mx6ul
ECSPI issue fixed from i.mx6ul at hardware level, no need
ERR009165 anymore on those chips such as i.mx8mq. Add i.mx6sx
from where i.mx6ul source.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:02:57 +08:00
7542e1d08a dma: engine: imx-sdma: add mcu_2_ecspi script
Add mcu_2_ecspi script to fix ecspi errata ERR009165.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:02:56 +08:00
ea884be272 dmaengine: imx-sdma: remove dupilicated sdma_load_context
Since sdma_transfer_init() will do sdma_load_context before any
sdma transfer, no need once more in sdma_config_channel().

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:02:56 +08:00
cdb5dd1f2b MLK-17385: dma: imx-sdma: update sdma script for multi fifo on SAI
update sdma script for multi fifo SAI on i.mx8MQ.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
[ Aisheng: fix build error ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:02:55 +08:00
9b50f7037d include: dma-imx: support dual fifo for for DEV_TO_DEV
Add src_dualfifo and dst_dualfifo in imx_dma_data to
support dual fifo for DMA_DEV_TO_DEV

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:02:54 +08:00
3ce7fb0ce7 MLK-16224-1: dmaengine: add src_fifo_num and dst_fifo_num in dma_slave_config
In order to support multi-fifo sdma script, the audio driver need to send
the fifo number to dma driver through dma_slave_config, so add src_fifo_num
and dst_fifo_num two new variable for struct dma_slave_config.

src_fifo_num: bit 0-7 is the fifo number, bit:8-11 is the fifo offset;
dst_fifo_num: same as src_fifo_num

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Robin Gong<yibin.gong@nxp.com>
2019-11-25 16:02:54 +08:00
2cb2cdf8ed Revert "dmaengine: imx-sdma: refine to load context only once"
This reverts commit ad0d92d7ba, because
in spi-imx case, burst length may be changed dynamically.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 16:02:53 +08:00
f84f5223ac dma: mxs-dma: change the way to register the probe function
change the old way to register the probe function in driver

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:02:51 +08:00
016b719166 MLK-19897: dma: mxs-dma: filter out the unrelated dma channels
update mxs-dma filter function to firstly filter the dma channels only
for mxs-dma, rather than checking unrelated dma chans in following code.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 16:02:51 +08:00
3c10505cd7 MLK-22835: mxc-jpeg: jpeg decoder stuck due to race condition
The race condition is on ctx->dht_needed, this variable indicates if the
decoder operates in one stage (decode) or two stages (inject default
Huffman table + decode).

While decoding the current buffer, and before the IP finishes it, a new
buffer in enqueued, jpeg parse begins, initializes ctx->dht_needed with
true, and does not get to finish parsing the jpeg headers. In the
meantime, the IP finishes decoding the current buffer and checks for
ctx->dht_needed, and believes it needs to run again the IP to finish
the job, which is wrong and gets the IP stuck.

This dht_needed property should be per buffer, not per context, so, add
a custom structure for the source buffer, struct mxc_jpeg_src_buf, and
don't forget to tell v4l2 core about its size, in mxc_jpeg_queue_init.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
(cherry picked from commit 4601417e95d35e995e0d8347b8464090a511db0d)
2019-11-25 16:02:49 +08:00
c211d5f468 mxc-jpeg: Fix warning at build, for EXPORT_SYMBOL on static variable
WARNING: "mxc_jpeg_tracing" [drivers/media/platform/imx8/mxc-jpeg-encdec]
is a static EXPORT_SYMBOL

While at it, add description for module parameter jpeg_tracing.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
2019-11-25 16:02:48 +08:00
f74491652d media: mxc-jpeg: jpeg: Replace stracpy with strscpy
The stracpy function exists in next-20190809 but not in v5.4. Replace
with strscpy to fix the build

The stracpy function was apparently rejected by Linus:

	https://lkml.org/lkml/2019/8/20/1286

Fixes: fa00960c5659 ("mxc-jpeg: Add v4l2 driver for i.MX8 CAST IP JPEG Encoder/Decoder")
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:02:48 +08:00
f00097b0a3 mxc-jpeg: Build mxc-jpeg as module, by default
For now, only mxc-jpeg is present in imx8 folder,
modify the corresponding Kconfig entry for it.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
(cherry picked from commit 1ef7d078d7bef7f24d9f4adeea603ec11afb1881)
2019-11-25 16:02:47 +08:00
4d69ad2022 mxc-jpeg: Add support for multi power domain
Attach the power domains in probe, detach in remove.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
(cherry picked from commit 5b766aa74094e73875282c110e0824e92af6c93e)
2019-11-25 16:02:47 +08:00
d981b31e3c media: Add imx8 folder to the build
(cherry picked from commit ad720d766e00641adcd803ef2bfb8137562a87ca)
2019-11-25 16:02:46 +08:00
e0a236469b MLK-15124-04: image ss: Add mx8 image subsystem driver
Add mxc media device driver.
Add mx8 isi device driver.
Add mx8 mipi csi device driver.
Add max9286 sensor driver.
mxc isi driver support CSC and scaling function.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
(cherry-pick from linux-imx d82547704c)
(cherry picked from commit a85ff6b0559b69787a24f9b8e6a3952df71c4875)
2019-11-25 16:02:46 +08:00
5bdecfe987 media: dt-bindings: add bindings for i.MX8QXP/QM JPEG driver
Add bindings documentation for i.MX8QXP/QM JPEG decoder & encoder driver.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
(cherry picked from commit abe3dcf9e67fe387c5d0a49fa25acdfc20588984)
2019-11-25 16:02:45 +08:00
e1959f2436 mxc-jpeg: Add v4l2 driver for i.MX8 CAST IP JPEG Encoder/Decoder
This IP is present in i.MX 8QuadMax and i.MX 8DualX/8DualXPlus/8QuadXPlus
application processors.
The mxc-jpeg driver creates two v4l2 file handles in /dev, one for the
decoder, and one for the encoder, which can be used by v4l2 programs.
The multi-planar buffers API is used.

Baseline and extended sequential jpeg decoding is supported.
Progressive jpeg decoding is not supported by the IP.
Supports encode and decode of various formats:
    YUV444, YUV422, YUV420, RGB, ARGB, Gray
YUV420 is the only multi-planar format supported.
Minimum resolution is 64 x 64, maximum 8192 x 8192.
The alignment requirements for the resolution depend on the format,
multiple of 16 resolutions should work for all formats.
Special workarounds are made in the driver to support NV12 1080p.

When decoding, the driver detects image resolution and pixel format
from the jpeg stream, parsing the jpeg markers.

The mxc-jpeg driver was tested to work with gstreamer & NXP gst plugins
for jpeg encoder/decoder.

The IP has 4 slots available for context switching, but only slot 0
was fully tested to work. Context switching is not used by the driver.
Each driver instance (context) allocates a slot for itself, but this
is postponed util device_run, to allow unlimited opens.

The driver submits jobs to the IP by setting up a descriptor for the
used slot, and then validating it. The encoder has an additional descriptor
for the configuration phase. The driver expects FRM_DONE interrupt from
IP to mark the job as finished.

The decoder IP has some limitations regarding the component ID's,
but the driver works around this by replacing them in the jpeg stream.

A module parameter is available for debug purpose: jpeg_tracing

The v4l2-compliance basic tests are passing on decoder/encoder nodes.
The driver builds fine as builtin or module.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Signed-off-by: Zhengyu Shen <zhengyu.shen_1@nxp.com>
Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>, Frank Li <Frank.Li@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
(cherry picked from commit 4450ab9207122e885c4b3ad877db3f8163e9ce7f)
2019-11-25 16:02:44 +08:00
0ac4a48bea LF-116: staging: media: imx: fix no enum_frameinterval result issue
Fix no enum_frameinterval result issue

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:42 +08:00
f11f9f00f9 media: staging: imx: add driver for GMSL MAX9286 device
MAX9286 is a quad 1.5Gbps GMSL Deserializer with Coax or STP Input
and CSI-2 Output. Add driver support for it.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
[ Aisheng: Kconfig & Makefile update for a clean base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:02:41 +08:00
9ee1187583 media: v4l2: vadc: Enable vadc driver
Add vadc driver for imx6sx.
This patch forwards from imx_4.19.y kernel.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:02:39 +08:00
986bae231a media: mx6s_capture: accommodate the driver to framework's change
- use v4l2_async_notifier_add_subdev for subdev registration on notification
- vidioc_cropcap/vidioc_s_crop/vidioc_g_crop not used anymore,
- vdev->device_caps need to be set

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:39 +08:00
d6bfdb3631 media: v4l2 capture: add v4l2 capture driver based on csi
add v4l2 capture driver based on csi, which is used by
iMX 6UL/6ULL/6SX/6SL/6SLL(parallel), and iMX7D/M850(mipi).

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:38 +08:00
5a43ed0df4 media: mipi csi: add IPU CSI driver
add IPU MIPI CSI driver, used by imx6qdl

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:38 +08:00
5f77e6b267 media: add adv7180 video decoder driver
add adv7180 video decoder driver

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:37 +08:00
9cab3a0203 media: add Kconfig and Makefile for the capture driver
add Kconfig/Makefile for IPU CSI, camera, and V4L2 captures drivers etc.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:37 +08:00
293da2bd55 media: capture: add mxc v4l2 capture driver
add mxc v4l2 capture driver for imx6qdl

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:37 +08:00
2c9fd7c1ad media: v4l2: add int device framework for backward support
Add int device framework for backward support on imx6qdl

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:36 +08:00
1b00e429b3 media: IPU: add IPU csi and prp driver
Add IPU CSI and prp driver

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:35 +08:00
1a0497c5d5 MLK-21876-17 mxc_v4l2: add uapi headfile for yocto build pass
Copied from 4.14.78 GA.
Module onwer could merge it when adding drivers code.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:02:35 +08:00
9319cc149c imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:02:35 +08:00
99aa4c8c18 media: i2c: fix the incomplete first frame issue
VSYNC signal trigger before a frame end when ov5640 work at MIPI
mode. It leads to the first frame content only hav some lines of
image. I tried many configuration and finally have the patch to
fix the issue. My thought is suspending sensor when update its
registers and resume after update.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:32 +08:00
75b542c49e media: i2c: fix hang issue when ov5640 work at DVP mode
When setting ov5640 to XGA, 720P, 1080P and 2592x1944 at DVP mode,
receiver can't get data from sensor. After trying many configuration,
I found 0x3824[1] need to be set to control divide DVP PCLK and do
software power-down when configure sensor to XGA and 720P.

For 1080P and 2592x1944, sensor don't support 30fps. So return NULL
when user try to get 1080P@30 and 2592x1944@30fps.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:28 +08:00
54f171f06f media: platform: mxc: capture: ov5640: Disable regulators in ov5640_remove()
The below commit introduced in v5.0 would warn us when putting
a regulator with non-zero enable_count.  So, we should disable
regulators in ov5640_remove() in cases where regulators are
still enabled when the module is removed.  This patch can suppress
the below warnings when the module is removed:

[  456.156524] WARNING: CPU: 3 PID: 11175 at drivers/regulator/core.c:2042 _regulator_put.part.4+0x1a4/0x1c8
[  456.166261] Modules linked in: mxc_v4l2_capture ipu_bg_overlay_sdc ipu_still ipu_prp_enc ipu_csi_enc ipu_fg_overlay_sdc ov5640_camera_mipi_v2 ov5640_camera_int(-) imx_vdoa ov5640_camera_mipi_int v4l2_int_device galcore(O) [last unloaded: ipu_bg_overlay_sdc]
[  456.189199] CPU: 3 PID: 11175 Comm: modprobe Tainted: G        W  O      5.4.0-rc3-5.3-warrior-next+gfb33033 #1
[  456.199312] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[  456.205881] [<c0112e70>] (unwind_backtrace) from [<c010cd80>] (show_stack+0x10/0x14)
[  456.213654] [<c010cd80>] (show_stack) from [<c0c98ba0>] (dump_stack+0xd8/0x110)
[  456.220992] [<c0c98ba0>] (dump_stack) from [<c0136da0>] (__warn+0xc0/0x10c)
[  456.227978] [<c0136da0>] (__warn) from [<c0137168>] (warn_slowpath_fmt+0x58/0xb8)
[  456.235490] [<c0137168>] (warn_slowpath_fmt) from [<c05f143c>] (_regulator_put.part.4+0x1a4/0x1c8)
[  456.244477] [<c05f143c>] (_regulator_put.part.4) from [<c05f148c>] (regulator_put+0x2c/0x3c)
[  456.252942] [<c05f148c>] (regulator_put) from [<c0685f08>] (release_nodes+0x1ac/0x1f8)
[  456.260890] [<c0685f08>] (release_nodes) from [<c0682168>] (device_release_driver_internal+0xf8/0x1b8)
[  456.270222] [<c0682168>] (device_release_driver_internal) from [<c0682284>] (driver_detach+0x44/0x80)
[  456.279464] [<c0682284>] (driver_detach) from [<c0680e40>] (bus_remove_driver+0x4c/0xa4)
[  456.287584] [<c0680e40>] (bus_remove_driver) from [<c01e4c64>] (sys_delete_module+0x164/0x1d8)
[  456.296222] [<c01e4c64>] (sys_delete_module) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
[  456.304505] Exception stack(0xe7657fa8 to 0xe7657ff0)
[  456.309577] 7fa0:                   01d284b8 01d284f4 01d284f4 00000800 00000070 00000000
[  456.317776] 7fc0: 01d284b8 01d284f4 00000000 00000081 00000001 01d27150 01d284b8 be935b40
[  456.325973] 7fe0: b6ef8340 be93479c 0001fd24 b6ef834c
[  456.331155] irq event stamp: 4303
[  456.334505] hardirqs last  enabled at (4311): [<c019d73c>] console_unlock+0x420/0x5dc
[  456.342449] hardirqs last disabled at (4328): [<c019d3c4>] console_unlock+0xa8/0x5dc
[  456.350328] softirqs last  enabled at (4344): [<c01024e4>] __do_softirq+0x2c4/0x518
[  456.358104] softirqs last disabled at (4355): [<c013e9d4>] irq_exit+0x100/0x18c
[  456.365516] ---[ end trace 67f399ebac279467 ]---

commit 5451781dad ("regulator: core: Only count load for enabled consumers")

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:02:28 +08:00
3b78d52323 media: ov5640 v2: fix kernel warning when no camera is plugged in
in 5451781dad commit, it added the check that
the regulator need to be disabled before calling regulator_put().
If not do so, the kernel will print warning message as below.
To fix this, need to disable regulator before probe function return if the
camera's not found. regulator_put() will be called when probe fails in this case
as devm_regulator_get() already called in probe function.

[ 1482.424157] camera ov5640 is not found
[ 1482.428022] ------------[ cut here ]------------
[ 1482.433070] WARNING: CPU: 0 PID: 697 at drivers/regulator/core.c:2039 _regulator_put.part.4+0x100/0x120
[ 1482.442566] Modules linked in: ov5640_camera_v2(+) v4l2_int_device mx6s_capture galcore(O) [last unloaded: ov5640_camera_int]
[ 1482.453990] CPU: 0 PID: 697 Comm: modprobe Tainted: G           O      5.3.0-rc3-next-20190809-5.3-warrior-next+g1dc2946 #1
[ 1482.465136] Hardware name: Freescale i.MX6 SoloX (Device Tree)
[ 1482.471007] [<c0112868>] (unwind_backtrace) from [<c010cd9c>] (show_stack+0x10/0x14)
[ 1482.478781] [<c010cd9c>] (show_stack) from [<c0cec834>] (dump_stack+0xd8/0x110)
[ 1482.486116] [<c0cec834>] (dump_stack) from [<c01362c4>] (__warn.part.3+0xa8/0xe8)
[ 1482.493620] [<c01362c4>] (__warn.part.3) from [<c013645c>] (warn_slowpath_null+0x40/0x4c)
[ 1482.501824] [<c013645c>] (warn_slowpath_null) from [<c05e6868>] (_regulator_put.part.4+0x100/0x120)
[ 1482.510894] [<c05e6868>] (_regulator_put.part.4) from [<c05e68b4>] (regulator_put+0x2c/0x3c)
[ 1482.519356] [<c05e68b4>] (regulator_put) from [<c06dd210>] (release_nodes+0x1ac/0x1f8)
[ 1482.527298] [<c06dd210>] (release_nodes) from [<c06d8cb0>] (really_probe+0x104/0x340)
[ 1482.535151] [<c06d8cb0>] (really_probe) from [<c06d9098>] (driver_probe_device+0x84/0x194)
[ 1482.543436] [<c06d9098>] (driver_probe_device) from [<c06d938c>] (device_driver_attach+0x58/0x60)
[ 1482.552329] [<c06d938c>] (device_driver_attach) from [<c06d93ec>] (__driver_attach+0x58/0xd0)
[ 1482.560875] [<c06d93ec>] (__driver_attach) from [<c06d70b8>] (bus_for_each_dev+0x70/0xb4)
[ 1482.569073] [<c06d70b8>] (bus_for_each_dev) from [<c06d80e4>] (bus_add_driver+0x198/0x1d0)
[ 1482.577358] [<c06d80e4>] (bus_add_driver) from [<c06da078>] (driver_register+0x74/0x108)
[ 1482.585474] [<c06da078>] (driver_register) from [<c088b238>] (i2c_register_driver+0x38/0x84)
[ 1482.593937] [<c088b238>] (i2c_register_driver) from [<c0103078>] (do_one_initcall+0x80/0x338)
[ 1482.602486] [<c0103078>] (do_one_initcall) from [<c01e163c>] (do_init_module+0x5c/0x238)
[ 1482.610598] [<c01e163c>] (do_init_module) from [<c01e3b00>] (load_module+0x2260/0x256c)
[ 1482.618623] [<c01e3b00>] (load_module) from [<c01e4060>] (sys_finit_module+0xbc/0xdc)
[ 1482.626473] [<c01e4060>] (sys_finit_module) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
[ 1482.634666] Exception stack(0xec0f5fa8 to 0xec0f5ff0)
[ 1482.639737] 5fa0:                   00000000 00000000 00000003 00028e44 00000000 01602408
[ 1482.647933] 5fc0: 00000000 00000000 00040000 0000017b 00000000 00000000 00000000 01602630
[ 1482.656127] 5fe0: beb158f0 beb158e0 0001fdb4 b6f1f510
[ 1482.661324] irq event stamp: 3497
[ 1482.664677] hardirqs last  enabled at (3505): [<c019be00>] console_unlock+0x418/0x5f4
[ 1482.672612] hardirqs last disabled at (3522): [<c019ba70>] console_unlock+0x88/0x5f4
[ 1482.680451] softirqs last  enabled at (3538): [<c01024e4>] __do_softirq+0x2c4/0x514
[ 1482.688136] softirqs last disabled at (3531): [<c013da4c>] irq_exit+0x100/0x188
[ 1482.695530] ---[ end trace e580778621876135 ]---

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:27 +08:00
cc90e18113 media: ov5640 mipi v2: fix kernel warning when no camera is plugged in
in 5451781dad commit, it added the check that
the regulator need to be disabled before calling regulator_put().
If not do so, the kernel will print warning message as below.
To fix this, need to disable regulator before probe function return if the
camera's not found. regulator_put() will be called when probe fails in this case
as devm_regulator_get() already called in probe function.

[    2.834247] ov5640_mipi 1-003c: Camera is not found
[    2.839198] ------------[ cut here ]------------
[    2.844386] WARNING: CPU: 0 PID: 33 at drivers/regulator/core.c:2039 _regulator_put+0x34/0xd8
[    2.852954] Modules linked in:
[    2.856091] CPU: 0 PID: 33 Comm: kworker/0:1 Not tainted 5.3.0-rc3-next-20190809-5.3-warrior-next+g1dc2946 #1
[    2.866044] Hardware name: NXP i.MX8MQ EVK (DT)
[    2.870692] Workqueue: events deferred_probe_work_func
[    2.875879] pstate: 60000005 (nZCv daif -PAN -UAO)
[    2.880712] pc : _regulator_put+0x34/0xd8
[    2.884756] lr : _regulator_put+0x34/0xd8
[    2.888802] sp : ffff00001210b5f0
[    2.892153] x29: ffff00001210b5f0 x28: ffff0000111ca238
[    2.897478] x27: ffff000011db1850 x26: ffff000011db1790
[    2.902800] x25: ffff000011db1790 x24: 0000000000000009
[    2.908151] x23: ffff00001210b698 x22: ffff8000baec9e00
[    2.913501] x21: ffff000011c498c8 x20: ffff8000baecc100
[    2.918852] x19: ffff8000baecc100 x18: 0000000000000010
[    2.924202] x17: 0000000000000000 x16: 0000000000000000
[    2.929553] x15: ffffffffffffffff x14: ffff000011c498c8
[    2.934904] x13: ffff00009210b387 x12: ffff00001210b38f
[    2.940254] x11: ffff000011c62000 x10: ffff00001210b310
[    2.945605] x9 : 00000000ffffffd0 x8 : ffff0000106e31a0
[    2.950955] x7 : 0000000000000124 x6 : ffff000011e63b43
[    2.956305] x5 : 0000000000000000 x4 : 0000000000000000
[    2.961655] x3 : 00000000ffffffff x2 : e14ea0006ddd6c00
[    2.967006] x1 : 0000000000000000 x0 : 0000000000000024
[    2.972390] Call trace:
[    2.974884]  _regulator_put+0x34/0xd8
[    2.978588]  regulator_put+0x2c/0x40
[    2.982227]  devm_regulator_release+0x10/0x18
[    2.986640]  release_nodes+0x1b0/0x220
[    2.990429]  devres_release_all+0x34/0x58
[    2.994480]  really_probe+0x1b8/0x2e8
[    2.998184]  driver_probe_device+0x74/0x118
[    3.002406]  __device_attach_driver+0x80/0xb8
[    3.006805]  bus_for_each_drv+0x78/0xc8
[    3.010653]  __device_attach+0xd4/0x130
[    3.014528]  device_initial_probe+0x10/0x18
[    3.018746]  bus_probe_device+0x90/0x98
[    3.022624]  device_add+0x48c/0x720
[    3.026150]  device_register+0x1c/0x28
[    3.029975]  i2c_new_client_device+0x130/0x2a0
[    3.034431]  i2c_new_device+0xc/0x20
[    3.038061]  of_i2c_register_device+0x70/0x98
[    3.042457]  of_i2c_register_devices+0x98/0x120
[    3.047026]  i2c_register_adapter+0x160/0x410
[    3.051395]  __i2c_add_numbered_adapter+0x58/0x90
[    3.056137]  i2c_add_adapter+0x9c/0xc8
[    3.059925]  i2c_add_numbered_adapter+0x24/0x30
[    3.064507]  i2c_imx_probe+0x3d0/0x880
[    3.068296]  platform_drv_probe+0x50/0xa0
[    3.072318]  really_probe+0xdc/0x2e8
[    3.075933]  driver_probe_device+0x74/0x118
[    3.080127]  __device_attach_driver+0x80/0xb8
[    3.084522]  bus_for_each_drv+0x78/0xc8
[    3.088397]  __device_attach+0xd4/0x130
[    3.092268]  device_initial_probe+0x10/0x18
[    3.096461]  bus_probe_device+0x90/0x98
[    3.100332]  deferred_probe_work_func+0x64/0x98
[    3.104956]  process_one_work+0x1e0/0x320
[    3.109007]  worker_thread+0x228/0x428
[    3.112812]  kthread+0x120/0x128
[    3.116104]  ret_from_fork+0x10/0x18
[    3.119722] ---[ end trace 69a95d03ced5eb6c ]---

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit ddfe50087eb3addb4d0574b8ee1a153b7da71284)
2019-11-25 16:02:27 +08:00
1b8ca61ed2 media: ov5640 mipi: fix kernel warning when no camera is plugged in
in 5451781dad commit, it added the check that
the regulator need to be disabled before calling regulator_put().
If not do so, the kernel will print warning message as below.
To fix this, need to disable regulator before probe function return if the
camera's not found. regulator_put() will be called when probe fails in this case
as devm_regulator_get() already called in probe function.

[   11.444811] ------------[ cut here ]------------
[   11.444866] WARNING: CPU: 1 PID: 317 at drivers/regulator/core.c:2039 _regulator_put.part.4+0x100/0x120
[   11.444881] Modules linked in: ov5640_camera_mipi_int(+) ov5640_camera_int(+) v4l2_int_device
[   11.444949] CPU: 1 PID: 317 Comm: systemd-udevd Tainted: G        W  O      5.3.0-rc3-next-20190809-02774-g6e085ec #18
[   11.444965] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[   11.445008] [<c0112868>] (unwind_backtrace) from [<c010cd9c>] (show_stack+0x10/0x14)
[   11.445047] [<c010cd9c>] (show_stack) from [<c0d26ad4>] (dump_stack+0xd8/0x110)
[   11.445081] [<c0d26ad4>] (dump_stack) from [<c01362c4>] (__warn.part.3+0xa8/0xe8)
[   11.445107] [<c01362c4>] (__warn.part.3) from [<c013645c>] (warn_slowpath_null+0x40/0x4c)
[   11.445143] [<c013645c>] (warn_slowpath_null) from [<c05e6520>] (_regulator_put.part.4+0x100/0x120)
[   11.445177] [<c05e6520>] (_regulator_put.part.4) from [<c05e656c>] (regulator_put+0x2c/0x3c)
[   11.445213] [<c05e656c>] (regulator_put) from [<c06dce90>] (release_nodes+0x1ac/0x1f8)
[   11.445247] [<c06dce90>] (release_nodes) from [<c06d8968>] (really_probe+0x104/0x340)
[   11.445266] [<c06d8968>] (really_probe) from [<c06d8d50>] (driver_probe_device+0x84/0x194)
[   11.445281] [<c06d8d50>] (driver_probe_device) from [<c06d9044>] (device_driver_attach+0x58/0x60)
[   11.445295] [<c06d9044>] (device_driver_attach) from [<c06d90a4>] (__driver_attach+0x58/0xd0)
[   11.445308] [<c06d90a4>] (__driver_attach) from [<c06d6d70>] (bus_for_each_dev+0x70/0xb4)
[   11.445322] [<c06d6d70>] (bus_for_each_dev) from [<c06d7d9c>] (bus_add_driver+0x198/0x1d0)
[   11.445337] [<c06d7d9c>] (bus_add_driver) from [<c06d9d30>] (driver_register+0x74/0x108)
[   11.445355] [<c06d9d30>] (driver_register) from [<c088ae30>] (i2c_register_driver+0x38/0x84)
[   11.445394] [<c088ae30>] (i2c_register_driver) from [<bf01b010>] (ov5640_init+0x10/0x1000 [ov5640_camera_mipi_int])
[   11.445442] [<bf01b010>] (ov5640_init [ov5640_camera_mipi_int]) from [<c0103078>] (do_one_initcall+0x80/0x338)
[   11.445482] [<c0103078>] (do_one_initcall) from [<c01e163c>] (do_init_module+0x5c/0x238)
[   11.445512] [<c01e163c>] (do_init_module) from [<c01e3b00>] (load_module+0x2260/0x256c)
[   11.445535] [<c01e3b00>] (load_module) from [<c01e4060>] (sys_finit_module+0xbc/0xdc)
[   11.445550] [<c01e4060>] (sys_finit_module) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
[   11.445559] Exception stack(0xed885fa8 to 0xed885ff0)
[   11.445571] 5fa0:                   00000000 00000000 00000007 b6f167e8 00000000 007f2e78
[   11.445583] 5fc0: 00000000 00000000 beebbddc 0000017b 00000000 00000000 beebbda0 007f0890
[   11.445593] 5fe0: beebbd08 beebbcf8 b6f0ed84 b6d81510
[   11.445604] irq event stamp: 19099
[   11.445618] hardirqs last  enabled at (19105): [<c019d9f4>] vprintk_emit+0x294/0x2c8
[   11.445629] hardirqs last disabled at (19110): [<c019d884>] vprintk_emit+0x124/0x2c8
[   11.445641] softirqs last  enabled at (18974): [<c01024e4>] __do_softirq+0x2c4/0x514
[   11.445657] softirqs last disabled at (18917): [<c013da4c>] irq_exit+0x100/0x188
[   11.445666] ---[ end trace 13b19ccc3a78aa48 ]---

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 5c9b5de893eda4e328d1b72a244fe790efaddd54)
2019-11-25 16:02:24 +08:00
00bb85342b media: ov5640: fix kernel warning when no camera is plugged in
in 5451781dad commit, it added the check that
the regulator need to be disabled before calling regulator_put().
If not do so, the kernel will print warning message as below.
To fix this, need to disable regulator before probe function return if the
camera's not found. regulator_put() will be called when probe fails in this case
as devm_regulator_get() already called in probe function.

[   11.342219] ------------[ cut here ]------------
[   11.347211] WARNING: CPU: 0 PID: 314 at drivers/regulator/core.c:2039 _regulator_put.part.4+0x100/0x120
[   11.356861] Modules linked in: ov5640_camera_mipi_int(+) ov5640_camera_int(+) v4l2_int_device
[   11.365604] CPU: 0 PID: 314 Comm: systemd-udevd Tainted: G        W  O      5.3.0-rc3-next-20190809-02774-g6e085ec #18
[   11.376346] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[   11.382947] [<c0112868>] (unwind_backtrace) from [<c010cd9c>] (show_stack+0x10/0x14)
[   11.390758] [<c010cd9c>] (show_stack) from [<c0d26ad4>] (dump_stack+0xd8/0x110)
[   11.398120] [<c0d26ad4>] (dump_stack) from [<c01362c4>] (__warn.part.3+0xa8/0xe8)
[   11.405636] [<c01362c4>] (__warn.part.3) from [<c013645c>] (warn_slowpath_null+0x40/0x4c)
[   11.414007] [<c013645c>] (warn_slowpath_null) from [<c05e6520>] (_regulator_put.part.4+0x100/0x120)
[   11.414045] [<c05e6520>] (_regulator_put.part.4) from [<c05e656c>] (regulator_put+0x2c/0x3c)
[   11.414063] [<c05e656c>] (regulator_put) from [<c06dce90>] (release_nodes+0x1ac/0x1f8)
[   11.414082] [<c06dce90>] (release_nodes) from [<c06d8968>] (really_probe+0x104/0x340)
[   11.414097] [<c06d8968>] (really_probe) from [<c06d8d50>] (driver_probe_device+0x84/0x194)
[   11.414112] [<c06d8d50>] (driver_probe_device) from [<c06d9044>] (device_driver_attach+0x58/0x60)
[   11.414126] [<c06d9044>] (device_driver_attach) from [<c06d90a4>] (__driver_attach+0x58/0xd0)
[   11.414141] [<c06d90a4>] (__driver_attach) from [<c06d6d70>] (bus_for_each_dev+0x70/0xb4)
[   11.414154] [<c06d6d70>] (bus_for_each_dev) from [<c06d7d9c>] (bus_add_driver+0x198/0x1d0)
[   11.414168] [<c06d7d9c>] (bus_add_driver) from [<c06d9d30>] (driver_register+0x74/0x108)
[   11.414186] [<c06d9d30>] (driver_register) from [<c088ae30>] (i2c_register_driver+0x38/0x84)
[   11.414203] [<c088ae30>] (i2c_register_driver) from [<c0103078>] (do_one_initcall+0x80/0x338)
[   11.414223] [<c0103078>] (do_one_initcall) from [<c01e163c>] (do_init_module+0x5c/0x238)
[   11.414236] [<c01e163c>] (do_init_module) from [<c01e3b00>] (load_module+0x2260/0x256c)
[   11.414250] [<c01e3b00>] (load_module) from [<c01e4060>] (sys_finit_module+0xbc/0xdc)
[   11.414263] [<c01e4060>] (sys_finit_module) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
[   11.414272] Exception stack(0xeda6bfa8 to 0xeda6bff0)
[   11.414284] bfa0:                   00000000 00000000 0000000f b6f167e8 00000000 007ecba0
[   11.414297] bfc0: 00000000 00000000 beebbddc 0000017b 00000000 00000000 beebbda0 007f7db0
[   11.414307] bfe0: beebbd08 beebbcf8 b6f0ed84 b6d81510
[   11.414423] irq event stamp: 16217
[   11.414445] hardirqs last  enabled at (16223): [<c019d9f4>] vprintk_emit+0x294/0x2c8
[   11.414458] hardirqs last disabled at (16228): [<c019d884>] vprintk_emit+0x124/0x2c8
[   11.414472] softirqs last  enabled at (16192): [<c01024e4>] __do_softirq+0x2c4/0x514
[   11.414489] softirqs last disabled at (16137): [<c013da4c>] irq_exit+0x100/0x188
[   11.414498] ---[ end trace 13b19ccc3a78aa43 ]---

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 14d7e9fc1249f8d8ed81743c42e157fcd6598ac9)
2019-11-25 16:02:24 +08:00
842bca0c72 media: capture: add mipi camera ov5647 driver
add ov5647 driver

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:23 +08:00
1558faf71f media: capture: add ov5640 mipi and parallel driver of subdev version
ov5640 module supports both mipi and parallel interface.
The driver is based on subdev framework.
The driver is used on 6UL/6ULL/6SX/6SL/6SLL/7D EVK or SabreSD board.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:23 +08:00
192bfd4638 media: capture: add ov5640 mipi and parallel driver
ov5640 module supports both mipi and parallel interface.
The driver is based on int device framework.
The driver is used on imx6qdl Sabresd boads.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:23 +08:00
2b8ecf6766 media: i2c: save width and height of new mode to sensor format
Save the width and height info of new mode to sensor format data
in order to get the info by G_FMT ioctl command

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:22 +08:00
2ea26ba43d media: i2c: sensor: add link_setup entity ops for ov5640 driver
Add link_setup callback for ov5640 sensor entity ops.
In some cases, driver will call the related entity ops
to notify the link setup events

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:21 +08:00
e4ebb11af1 imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:02:20 +08:00
2a34998f49 LF-101: staging: media: imx: fix XR24 format R and B are opposite issue
R and B are opposite because U and V are opposite when transfer by PI module

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:16 +08:00
3e0529639e staging: media: imx: add video ops for imx8 parallel subdev
Add g_frame_interval/s_frame_interval callback for imx8 parallel
sub device.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:16 +08:00
86bb022020 staging: media: imx: add parallel capture interface driver for imx8qxp
CI_PI module which is used for capture parallel interface in
imx8qxp platform. Add v4l2 subdev driver for it.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
[ Aisheng: Kconfig & Makefile update for a clean base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:02:15 +08:00
f49e4de44b media: dt-bindings: add bindings for i.MX8QXP parallel interface
Add bindings documentation for i.MX8QXP parallel interface device

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:14 +08:00
2e664b43b7 imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:02:13 +08:00
e21befd5be staging: media: imx: add V4L2 subdev driver for MIPI CSI2 of Samsung
Add V4L2 subdev drivers for MIPI CSI2 of Samsung

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:11 +08:00
b0435ed598 media: mipi csi: accommodate the driver to framework's change
use v4l2_async_notifier_add_subdev for subdev registration on notification

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:11 +08:00
29cf1a9a4c media: mipi csi: add samsung's mipi csi support
Add samsung's mipi csi support, which is used by MX7D, M850

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:02:10 +08:00
c9ed6c5676 staging: media: imx: add video ops for imx8 mipi csi subdev
Add g_frame_interval/s_frame_interval callback for imx8 mipi
csi sub device.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:08 +08:00
92eae43967 media: mipi csi: add mixel's mipi csi driver
add mixel's mipi csi driver, which is used on imx8mq.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit bc1d9b215f5c9374dcf9b949df83d939038962bd)
2019-11-25 16:02:08 +08:00
8c1f0633e6 media: staging: csi: add mipi csi driver support for IMX8
Add MIPI CSI driver support for imx8qm/qxp platform

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
[ Aisheng: Kconfig & Makefile update for a clean base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:02:07 +08:00
11dd36f7f1 media: dt-bindings: add bindings for i.MX8QXP/QM mipi csi-2 driver
Add bindings documentation for i.MX8QXP/QM mipi csi-2 drivers.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:07 +08:00
d8977ba09f media: staging: imx: add V4L2 memory to memory driver for ISI of imx8qxp/qm
ISI is an image sensor interface which used to process image data from
camera sensor or memory. Add ISI V4L2 memory to memory function driver
for it.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:03 +08:00
69a93d7039 media: staging: imx: add isi capture driver support for imx8qm/qxp
ISI is an image sensor interface which used to process image data from
camera sensor or memory. Add ISI capture function driver for it.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:02 +08:00
4b44b37dab media: staging: imx: add isi core driver support for imx8qm/qxp
Because ISI can be used to capture data from camera or memory.
Split ISI driver to two parts. One for ISI core and hardware, the
other is for ISI capture function. Core driver will create virtual
device for them and be shared by capture and memory to memory driver.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:02:02 +08:00
4bcce30760 media: isi: fix boot warning by intialize device_caps
Caused by:
049e684 media: v4l2-dev: fix WARN_ON(!vdev->device_caps)
3c13505 media: v4l2-dev/ioctl: require non-zero device_caps, verify sane querycap results

[    2.085781] WARNING: CPU: 2 PID: 32 at ../drivers/media/v4l2-core/v4l2-dev.c:864 __video_register_device+0x70/0x1524
[    2.096305] Modules linked in:
[    2.099369] CPU: 2 PID: 32 Comm: kworker/2:1 Not tainted 5.3.0-rc2-next-20190730-01098-g446d4cd #475
[    2.108500] Hardware name: Freescale i.MX8QM MEK (DT)
[    2.113559] Workqueue: events deferred_probe_work_func
[    2.118703] pstate: 60000005 (nZCv daif -PAN -UAO)
[    2.123495] pc : __video_register_device+0x70/0x1524
[    2.128466] lr : __video_register_device+0x70/0x1524
[    2.133433] sp : ffff000011d8b9d0
[    2.136742] x29: ffff000011d8b9d0 x28: ffff8008ff45edc0
[    2.142057] x27: ffff8008f6f35580 x26: ffff000011b2b148
[    2.147374] x25: ffff8008f6e381c0 x24: 0000000000000001
[    2.152691] x23: 0000000000000000 x22: ffff8008f6f35818
[    2.158008] x21: ffff8008f6e381c0 x20: 0000000000000001
[    2.163324] x19: ffff000011989000 x18: ffff000011cfdfff
[    2.168641] x17: 0000000000000000 x16: ffff000011cfdfff
[    2.173958] x15: ffff7e0023dbecc0 x14: 0000000000000000
[    2.179274] x13: 0000000000000000 x12: 0000000000000028
[    2.184591] x11: 0101010101010101 x10: 00000000000009a0
[    2.189908] x9 : ffff000011d8b700 x8 : ffff8008f813c100
[    2.195225] x7 : 0000000000000002 x6 : 00000000000000ed
[    2.200533] x5 : 0000000000000000 x4 : 000000000199047f
[    2.205849] x3 : 0000000000000001 x2 : ddfc02a91bc52500
[    2.211166] x1 : 0000000000000000 x0 : 0000000000000024
[    2.216488] Call trace:
[    2.218940]  __video_register_device+0x70/0x1524
[    2.223563]  mxc_isi_subdev_registered+0x1f8/0x230
[    2.228357]  v4l2_device_register_subdev+0xb0/0x160
[    2.233236]  mxc_md_probe+0x2b0/0x6b8
[    2.236897]  platform_drv_probe+0x4c/0xb0
[    2.240907]  really_probe+0x1c4/0x2d0
[    2.244571]  driver_probe_device+0x58/0xfc
[    2.248665]  __device_attach_driver+0x90/0xac
[    2.253020]  bus_for_each_drv+0x68/0xbc
[    2.256855]  __device_attach+0xe0/0x138
[    2.260686]  device_initial_probe+0x10/0x18
[    2.264867]  bus_probe_device+0x90/0x98
[    2.268696]  deferred_probe_work_func+0x70/0xa4
[    2.273230]  process_one_work+0x13c/0x2b4
[    2.277236]  worker_thread+0x35c/0x3e4
[    2.280985]  kthread+0xf8/0x124
[    2.284132]  ret_from_fork+0x10/0x18

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:02:01 +08:00
6a2aaf9f11 MLK-21985-8 media: isi: fix build for next 20190607 upgrade
API change due to commit:
7e98b7b542 ("media: v4l2: Get rid of ->vidioc_enum_fmt_vid_{cap, out}_mplane")

../drivers/staging/media/imx/imx8-isi-cap.c:1211:2: error: unknown field ‘vidioc_enum_fmt_vid_cap_mplane’ specified in initializer
  .vidioc_enum_fmt_vid_cap_mplane = mxc_isi_cap_enum_fmt_mplane,

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:02:00 +08:00
ade11ee383 media: staging: imx: add isi driver support for imx8qm/qxp
ISI is an image sensor interface which used to process
image data from camera sensor and then transfer to DC
or memory.

Add V4L2 Capture subdev driver support for it.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
[ Aisheng: Kconfig & Makefile update for a clean base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:02:00 +08:00
4792d808dc media: dt-bindings: add bindings for i.MX8QXP/QM ISI driver
Add bindings documentation for i.MX8QXP/QM ISI drivers.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:01:59 +08:00
ec704fe2ab media: dt-bindings: add bindings for i.MX8QXP/QM virtual media device
Add bindings documentation for i.MX8QXP/QM virtual media device

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 16:01:55 +08:00
11c8df0cde Revert "media: v4l2-ioctl: clear fields in s_parm"
This reverts commit 8a7c5594c0.
2019-11-25 16:01:53 +08:00
6e652a1d50 media: v4l2: export video_usercopy function
export video_usercopy function to fix following build error.

ERROR: "video_usercopy" [drivers/media/platform/mxc/capture/mxc_v4l2_capture.ko] undefined!
../scripts/Makefile.modpost:105: recipe for target 'modules-modpost' failed
make[2]: *** [modules-modpost] Error 1
/u/home/r63905/ProjectA/Dash_Linux_next2/dash-linux-devel/Makefile:1305: recipe for target 'modules' failed
make[1]: *** [modules] Error 2
make[1]: *** Waiting for unfinished jobs....

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:01:52 +08:00
e17564d66c Revert "media: v4l2-subdev.h: remove obsolete g/s_parm"
This reverts commit 8180b4f4f5.
2019-11-25 16:01:52 +08:00
dde81e854d MLK-21770: media: v4l: Add packed YUV444 24bpp pixel format
The added format is V4L2_PIX_FMT_YUV24, this is a packed
YUV 4:4:4 format, with 8 bits for each component, 24 bits
per sample.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
[ Aisheng : fix minor conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:01:51 +08:00
50e5bcc9cf MLK-20724: uapi: add RGBA to exend V4L2 standard format for android usage
Android has RGBA format output but V4L2 framework do not have this format
.In order to support this in our mem2mem driver, we need to extend V4L2
format.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>

(cherry picked from commit 24c970a517)
Only add uapi part to help yocto build
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:01:51 +08:00
2c0076d850 MLK-9662 [V4L2 Capture] Revert patch to re-add support for _G_CHIP_IDENT
This reverts commit b71c99801e.

Signed-off-by: Oliver Brown <oliver.brown@freescale.com>
(cherry picked from commit 5c74966c0e7deb0ac84b3fa8a84c6c942e7d434f)
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>

 Conflicts:
	drivers/media/v4l2-core/v4l2-ioctl.c
2019-11-25 16:01:50 +08:00
80882dc381 media: Kconfig: make MEDIA_SUBDRV_AUTOSELECT not default y
Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
[ Aisheng: fix upgrade conflicts. Note: this patch probaby
  could be dropped ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:01:49 +08:00
8602993d15 drm/arm/mali-dp: Add display QoS interface configuration for Mali DP500
Configure the display Quality of service (QoS) levels priority if the
optional property node "arm,malidp-aqros-value" is defined in DTS file.

QoS signaling using AQROS and AWQOS AXI interface signals, the AQROS is
driven from the "RQOS" register, so needed to program the RQOS register
to avoid the high resolutions flicker issue on the LS1028A platform.

Signed-off-by: Wen He <wen.he_1@nxp.com>
2019-11-25 16:01:47 +08:00
953bc461be dt/bindings: display: Add optional property node define for Mali DP500
Add optional property node 'arm,malidp-arqos-value' for the Mali DP500.
This property describe the ARQoS levels of DP500's QoS signaling.

Signed-off-by: Wen He <wen.he_1@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2019-11-25 16:01:46 +08:00
4784b07666 drm/imx/dcss: fix crash in DTRC exit routine
This patch fixes a "NULL pointer dereference" in DTRC exit routine.

Also, it removes a couple of defines used for tracing that are no longer
needed.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:42 +08:00
cb42847aa2 dt-bindings: display: imx8mq-dcss: add bindings for DTRC interrupts
The DTRC module triggers an interrupt when each bank finished processing. So,
they are needed if video compressed formats are to be played.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:41 +08:00
31cfd97efc drm/imx/dcss: add support for tiled formats on overlay planes
Video tiled formats are handled by the DTRC (Decompression and Tiled to Raster
Conversion) module. This patch allows playback of VPU tiled formats.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:41 +08:00
c640054c9f drm/imx/dcss: change HDR10 pipes config handling
This patch will adjust the HDR10 LUTs/CSCs depending on how userspace sets
color encoding and color range.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:39 +08:00
b0cb7fd583 drm/imx/dcss: add color management properties to video planes
The properties will be used by userspace to configure the video planes' color
encoding and/or range.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:38 +08:00
d4e0c32345 drm/imx/dcss: eliminate unnecessary formats from planes
Limit graphics plane formats to RGB and video planes formats to YUV.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:37 +08:00
ce3ab00333 drm/imx/dcss: add support for NV12_10LE40 format
This patch will allow DCSS to configure the pipes accordingly when 10 bit NV12
packed format is received from VPU.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:36 +08:00
7e5500299d drm/imx/dcss: add WRSCL/RDSRC support
In order to be able to spread the DDR bandwidth over the entire duration of the
frame, when scaling down to lower downscale ratios, WRSCL/RDSRC should be used.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:36 +08:00
a033b8582d drm/imx/dcss: remove reference to P010
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:35 +08:00
05d6cbb739 drm/imx/dcss: add support vor video overlays
iMX8MQ DCSS has one graphics plane and 2 overlay video planes. This patch adds
support for HDR10 module which will handle the 3 pipes' blending based on LUTs
and CSCs.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:35 +08:00
f83ee74ef2 drm/imx/dcss: add support for DEC400D
This patch adds support in DCSS for Vivante tiled-compressed buffers.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:34 +08:00
249ae4933e drm/imx/dcss: add busfreq support
DCSS cannot work properly at high resolutions and high framerate without
BUSFREQ.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:33 +08:00
8f09a3eeff dt-bindings: display: imx8mq-dcss: add clocks needed for HDMI
This adds dt bindings for pll_src and pll_phy_ref, used when output is on HDMI.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:33 +08:00
76c17b70c9 drm/imx/dcss: use the external 27MHz phy clock
The 27MHz external oscillator offers a high precision low jitter clock and
is suitable for high pixel clocks modes(ie 4K@60).

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:32 +08:00
b47bad65a5 dt-bindings: display: imx: add bindings for DCSS
Add bindings for iMX8MQ Display Controller Subsystem.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:31 +08:00
ba6f14e6f2 drm/imx: Add initial support for DCSS on iMX8MQ
This adds initial support for iMX8MQ's Display Controller Subsystem (DCSS).
Some of its capabilities include:
 * 4K@60fps;
 * HDR10;
 * one graphics and 2 video pipelines;
 * on-the-fly decompression of compressed video and graphics;

The reference manual can be found here:
https://www.nxp.com/webapp/Download?colCode=IMX8MDQLQRM

The current patch adds only basic functionality: one primary plane for
graphics, linear, tiled and super-tiled buffers support (no graphics
decompression yet), no HDR10 and no video planes.

Video planes support and HDR10 will be added in subsequent patches once
per-plane de-gamma/CSC/gamma support is in.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:31 +08:00
7c1e8801f3 drm/imx: compile imx directory by default
Currently the drm/imx/ directory is compiled only if DRM_IMX is set. Adding a
new IMX related IP in the same directory would need DRM_IMX to be set, which would
bring in also IPUv3 core driver...

The current patch would allow adding new IPs in the imx/ directory without needing
to set DRM_IMX.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:30 +08:00
9946062c7f Revert "drm/imx: Add initial support for DCSS on iMX8MQ"
This reverts commit 345c0451efbccdf4561e848ebb84942e8a658d31.

This is reverted in order to add the driver that was sent on the LKML mailing
list.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:30 +08:00
35359717f5 Revert "drm/imx/dcss: add busfreq support"
This reverts commit 78034aa7ca2b28ca2bcda6ddeabc19cebb88c7df.

This is reverted in order to add the driver that was sent on the LKML mailing
list.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:29 +08:00
3112774059 Revert "drm: imx: dcss: Fix for renaming reservation.h to dma-resv.h"
This reverts commit 6dc6cbdf24b4863ed8f213604dc98bf4cba1b94f.

This is reverted in order to add the driver that was sent on the LKML mailing
list.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:29 +08:00
f30d89a715 drm: imx: dcss: Fix for renaming reservation.h to dma-resv.h
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:01:28 +08:00
1344c5c77b drm/imx/dcss: add busfreq support
DCSS cannot work properly at high resolutions and high framerate without
BUSFREQ.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:27 +08:00
a3ae4711f0 drm/imx: Add initial support for DCSS on iMX8MQ
This adds initial support for iMX8MQ's DCSS display controller.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:27 +08:00
14781f84b2 imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:01:27 +08:00
d3cf551985 gpu: imx: dpu-blit: Do not initialize STORE9_STATIC register
The bit DIV0 of register STORE9_STATIC is used as a control bit
to fix the unsynchronization issue bewteen two display streams
in FrameGen side-by-side mode, which is introduced from an ECO
operation for the display controller.  The bit has to be one
when the side-by-side mode is enabled.  And, it has to be zero
when the mode is disabled, otherwise, a single display stream
cannot startup correctly.  Since the DPU common driver initializes
the register for us at the driver probe stage and system resume
stage, we may remove the same initialization logic of our own.
Without this patch, as the DPU blit engine DRM driver is resumed
relatively late, the bit would be overwritten to be zero at the
driver's ->resume() callback, which causes the display controller
cannot be correctly resumed from FrameGen side-by-side mode and
content ExtDst shadow load done event from the slave stream won't
come.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:01:25 +08:00
4137cd8a5d MGS-4265 gpu: imx: dpu-blit: fix video hang with g2d compositor
video playback cause system hang with Wayland g2d compositor,
this also can be reproduced with Android G2D HWComposer.

the problem is second prg not handled between GPU and video.
need re-enable dprc & prg pipes when modifier changed.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 8ca7df5227)
2019-11-25 16:01:24 +08:00
e9cbdf8cb7 MGS-3940 gpu: imx: dpu-blit: fix dpr hang for smaller size
auto-trigger cause dpr hang in inital blitter implementation,
the problem is dpr repeat mode has conflict with command sequencer.

as proposed by design, blitter need do manual trigger for each process:
dpr register -> dpr run -> seeris register -> seeris trigger -> sync

frstly this patch removed dprc first frame handler from dpu blitter,
then removed dpr repeat, and enable dpr run for each blit processing.

also add sync flag to avoid the duplicated calling to dpu_be_wait.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 04eb0533d5)
2019-11-25 16:01:23 +08:00
3e7d6ebfe4 MGS-4051 gpu: imx: dpu-blit: fix suspend resume issue
suspend & resume will destory and recreate blitter,
reset dprc start flags in blitter initialization.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 01514db138)
2019-11-25 16:01:23 +08:00
8905aa345c MGS-3940 gpu: imx: dpu-blit: fix first frame handler
chrome browser hang is reproduced with mouse connected,
the first frame handler trigger the problem in below scenario:
tile (dprc-enable) --> linear (dprc->disable) --> tile (handle first frame wrongly).

need_handle_start is set following dprc_enable, need reset it with dprc_disable.

fix event trigger as previous implementation does not flush command sequence,
that will cause the obvious flicker when run glmark2 in full-screen.
also reduce bitter delay to 30us to improve blitter performance.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 9b5700a98e9b12b9d0119a67e45251a8d2405628)
2019-11-25 16:01:22 +08:00
89be3ec26d MGS-4061 gpu: imx: dpu-blit: fix kernel panic in pm test
resume will increase unlock counter, max allowed value is 15.
suspend need decrease unlock counter to avoid overflow panic.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 0582cd50ed)
(cherry picked from commit a9b740f91b05398564bf776e4f1959e44c876938)
2019-11-25 16:01:18 +08:00
20d50b459f MLK-17311 gpu: imx: dpu-blit: enable prefetch feature
Add struct drm_imx_dpu_frame_info.
Configure dprc to enable prefetch for dpu blit.
Configure prefetch with source frame info for dpu blit.

Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
2019-11-25 16:01:17 +08:00
34e7158489 MLK-15321-4 drm/imx: core: Add bliteng as component of imx-drm
Implement Blt engine as DRM renderer.
Add dpu bliteng as component of imx-drm.

Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Signed-off-by: Marius Vlad <marius-cristian.vlad@nxp.com>
Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 16:01:17 +08:00
f61b12ef75 MLK-15321-3 drm/imx: dpu: Add render feature support
Implement Blt engine as DRM renderer.
Add dpu ioctl to support imx-drm render feature.

Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Signed-off-by: Marius Vlad <marius-cristian.vlad@nxp.com>
Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
2019-11-25 16:01:16 +08:00
d52edc635c MLK-15321-2 gpu: imx: dpu: Add dpu blit engine driver
Implement Blt engine as DRM renderer.
Add dpu blit engine driver.

Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
[ Aisheng : fix Makefile cflags include path ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:01:16 +08:00
044cbf5264 gpu: Move ipu-v3 to imx folder
The new imx folder may contain ipu-v3 and dpu common drivers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix source path ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:01:15 +08:00
ca7e3d16e4 drm/imx: Revert a patch which merges imx-drm-core and ipuv3-crtc in one module
DPU CRTC found in i.MX8qm/qxp SoCs can be hooked into imx-drm.
Thus, move ipuv3-crtc out of imx-drm-core.

Revert "drm/imx: merge imx-drm-core and ipuv3-crtc in one module"

This reverts commit 3d1df96ad4.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:01:15 +08:00
7d58a80df7 drm/imx/hdp: handle the various deep-color settings
iMX8MQ has the ability to handle color depths up to 12bpc. This patch adds
support for higher color depths for various modes.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:12 +08:00
626092cc29 drm/imx/hdp: force a mode set when colorspace is changed
If the userspace changes the connector Colorspace property, we need to force a
modeset, so that the entire pipeline is properly configured.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:12 +08:00
d1805e3d8f drm/imx/hdp: add colorspace property
iMX8MQ has the ability to adjust the DCSS output pipe gamut and nonlinearity
depending on the HDMI connector capability. Userspace can explicitly set this
property if it decides, based on EDID parsing, that the sink supports REC.2020
and it wants to switch when it plays HDR10 content.

Otherwise, the kernel will use the default settings specified in the HDMI
specifications.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:11 +08:00
0f79c83cda drm/imx/hdp: add hdr10 metadata property
The HDR_OUTPUT_METADATA property is needed in order for userspace to instruct
the sink to switch to HDR10 mode.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:01:11 +08:00
9906900ec1 drm: bridge: cadence: hdmi: remove video mode limition
combine mode is supported by imx8qm DPU.
imx8qm HDMI could support full feature.
Remove the 1080p60 limition.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:11 +08:00
caf452ef08 drm: mhdp: reset video mode after hdmi/dp cable plugin
DP need setup link training, and HDMI need reset hdmi sink SCDC
status after cable reconnected.
Add video mode_set function when cable plugin.
Add 20ms/50ms delay for hdmi/dp to waite FW stable.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:10 +08:00
6abf57d89e drm: mhdp: add mutex lock to mhdp register access function
Add muxtex lock to mhdp registers access functions
that could avoid race condition between cec thread and hdmi video.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:09 +08:00
94d74f72df DRM: mhdp: HDMI: skip scdc write return check
HDMI sink that only support HDMI1.4 is not support
SCDC read/write. Skip the SCDC write check and continue
HDMI initialize process.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:09 +08:00
039ee564f8 drm: bridge: cdns cec: fix LA failed set issue
improved function set_logical_addr() function.
Fix LA set failed issue in some case.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:08 +08:00
3015c6ea25 drm: imx: mhdp: add dual mode support for imx8qm
Add dual mode support for imx8qm.
imx8qm hdmi/dp driver are ready to support 4K.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:07 +08:00
53f2b801db drm: bridge: cdns dp: Remove link rate/lanes set by device tree
Get the link rate and lanes from sink device.
Remove user specific set by device tree.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:06 +08:00
da78697aeb drm: bridge: cadence: Fix return value for set log addr
Fix return value for set log addr with cec

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 16:01:06 +08:00
97ead55de6 drm: imx: hdmi: support arc function
Add HDMI ARC configurate function.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:05 +08:00
560e6e4066 drm: bridge: cadence: Add support for periodically poll the connector
Normally, DP/HDMI PHY use HPD_IRQ to monitor the connector connection
status, but LS1028A doesn't support HPD_IRQ signals response.

This patch allows periodically poll the connector for connection and
disconnection.

Signed-off-by: Wen He <wen.he_1@nxp.com>
2019-11-25 16:01:05 +08:00
e04d199413 drm: ls1028a: Add DP driver support for LS1028A
Add Display Port driver support for NXP Layerscape LS1028A platform.

Signed-off-by: Wen He <wen.he_1@nxp.com>
2019-11-25 16:01:04 +08:00
6d5b6a5fed drm: bridge: cadence: Add power_on to __cdns_dp_probe
Add power_on of the cnds_plat_data to __cdns_dp_probe as to update
Board related configuration initalization.

Signed-off-by: Wen He <wen.he_1@nxp.com>
2019-11-25 16:01:04 +08:00
dd12200cd9 drm: rockchip: change base address name from regs to regs_base
change the regs name to regs_base according the bridge druver.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:03 +08:00
769411dee5 drm: imx: add imx8mq hdmi support
add struct imx_mhdp_device for imx specific.
add imx8mq hdmi support.
move imx8qm specific functions to plat_data
uniform variable name.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:02 +08:00
98b24ea5f5 drm: bridge: cadence: move struct imx_mhdp_device to drm/imx
move struct imx_mhdp_device to drm/imx folder.
change the base address name from regs to regs_base.
add mhdp bus access function.
uniform variable name.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:02 +08:00
7bf4d5302d drm: rockchip: Fix build failed issue
Macro variable AFMT_SPDIF have renamed to AFMT_SPDIF_INT in headfile.
use the correct variable to fix build issue.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:01 +08:00
18252d211f drm: bridge: cadence: Add CEC driver for cdns mhdp hdmi
Add cec driver for cdns mhdp hdmi.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:01 +08:00
efb3962858 drm: bridge: cadence: Add mhdp audio driver
Move mhdp audio driver to cadence folder.
Add audio info-frame set function for hdmi tx audio.
The driver suppoer both HDMI and DP audio.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:01 +08:00
46e3b4a52e drm: bridge: cadence: Add new api functions
Add variable lane_mapping for hdmi.
Add new API function cdns_mhdp_bus_read/cdns_mhdp_bus_write,
cdns_mhdp_get_fw_clk and cdns_mhdp_infoframe_set.
Adjust some API function interface.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:01:00 +08:00
92754d3a7a gpu: drm: Add imx8qm/mq DP/HDMI driver
Add imx8qm/mq DP/hdmi driver

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:00:59 +08:00
0d1c0aadce drm: bridge: Add Cadence DP/HDMI core driver
Add HDMI and DP core driver.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:00:59 +08:00
7a3d6a6e25 drm: bridge: add Cadence MHDP HDMI/DP API
Changes made in the low level driver (cdn-dp-reg.*):
- moved it to from drivers/gpu/drm/rockchip to
 drivers/gpu/drm/bridge/cadence/cdns-mhdp-common.c and
 include/drm/bridge/cdns-mhdp-common.h
- functions for sending/receiving commands are now public
- added functions for reading registers and link training adjustment

Changes made in RK's driver (cdn-dp-core.*):
- Moved audio_info and audio_pdev fields from cdn_dp_device to
  cdns_mhdp_device structure.

Signed-off-by: Quentin Schulz<quentin.schulz@free-electrons.com>
Signed-off-by: Piotr Sroka <piotrs@cadence.com>
Signed-off-by: Damian Kos <dkos@cadence.com>
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:00:58 +08:00
203c116241 drm/rockchip: prepare common code for cdns and rk dpi/dp driver
- Extracted common fields from cdn_dp_device to a new cdns_mhdp_device
  structure which will be used by two separate drivers later on.
- Moved some datatypes (audio_format, audio_info,
  vic_pxl_encoding_format, video_info) from cdn-dp-core.c to cdn-dp-reg.h.
- Changed prefixes from cdn_dp to cdns_mhdp cdn -> cdns to match the other Cadence's drivers
  dp -> mhdp to distinguish it from a "just a DP" as the IP underneath this registers map can be a HDMI (which is
  internally different, but the interface for commands, events is pretty much the same).
- Modified cdn-dp-core.c to use the new driver structure and new function names.

Signed-off-by: Damian Kos<dkos@cadence.com>
Reviewed-by: Andrzej Hajda<a.hajda@samsung.com>
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:00:56 +08:00
501580e94f MLK-22768 video: fbdev: mxc_ipuv3_fb: Handle enabled fg properly when set-par happens on bg
When we do set-par for background framebuffer without on-the-fly
flag being set, we should also unset the enabled overlay framebuffer's
on-the-fly flag, otherwise the overlay framebuffer cannot be enabled
again properly because a full mode set procedure is needed for overlay
framebuffer as it experiences a period of time when background
framebuffer stops fetching frames.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:00:55 +08:00
f512d192b1 video: fbdev: mxsfb: Fix writecombine/wc build error
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:00:54 +08:00
485d7611bb MLK-22084: fbdev: hdmi: Fix HDCP function failed work with Sony TV
HDCP function could work in other TVs
but it failed with Sony TV when run hdcp enable/disable stress test.
The TMDS clock is not detected by Sony TV.
The TV seems time sensitive for HDMI TMDS.
Add 20ms delay before TMDS enable make it work.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:00:54 +08:00
ce69b9fef5 fbdev: dcic: Enable imx6 dcic driver
This patch forwards imx6 dcic driver from imx_4.19.y kernel.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:00:54 +08:00
46dabba394 video: fbdev: mxc: hdmi: add hdmi framebuffer driver
Add imx6 hdmi framebuffer driver.
This patch forwards imx6 HDMI framebuffer driver from imx_4.19.y kernel.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:00:53 +08:00
1907d4da81 video: fbdev: add sii902x hdmi driver code
Add sii902x hdmi driver source code.
This patch forwards sii902x framebuffer driver from imx_4.19.y kernel.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:00:53 +08:00
c1725ce9b4 video: fbdev: add fb suspend/resume event support for mxc hdmi
FB events FB_EVENT_SUSPEND/FB_EVENT_RESUME
are remove in the kernel patch

commit 50c5056356
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Tue May 28 11:02:52 2019 +0200

    fbdev: directly call fbcon_suspended/resume

Add these events back to support mxc hdmi fb driver.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:00:51 +08:00
1f1ec2f18c video: fbdev: add FB_EVENT_FB_REGISTERED/UNREGISTERED support
fb event FB_EVENT_FB_REGISTERED and FB_EVENT_FB_UNREGISTERED
are removed by kernel patch

commit 97b67986f1
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Tue May 28 11:02:41 2019 +0200
    fbcon: call fbcon_fb_(un)registered directly

Add these two events back to support
mxc hdmi and sii90x hdmi fb driver.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 16:00:51 +08:00
d95584c74b video: epdc: add epdc driver
mxc_epdc_fb.c for i.MX6DL, i.MX6SL
mxc_epdc_v2_fb.c for i.MX7D, i.MX6ULL, i.MX6SLL.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 16:00:51 +08:00
9dc19e869b video: fbdev: mxc: Forward LDB driver from imx_4.19.y kernel
This patch forwards LDB driver from imx_4.19.y kernel.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:00:50 +08:00
faa785d159 video: fbdev: mxc: Forward IPUv3 framebuffer driver from imx_4.19.y kernel
This patch forwards IPUv3 framebuffer driver from imx_4.19.y kernel.

[ Liu Ying: Fixed a minor build warning ]
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:00:49 +08:00
cace9da88b video: fbdev: mxc: add HX8369 mipi panel driver support
Add driver support for HX8369 mipi panel display.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:48 +08:00
30bd1939b2 video: fbdev: mxc: add NXP MIPI DSI driver support
Add the framebuffer driver support for the NXP MIPI
DSI controller.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:48 +08:00
baae63d78c video: fbdev: mxc: add Samsung MIPI DSI driver support
Add the framebuffer driver support for the Samsung
MIPI DSI controller.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:46 +08:00
dd204551ec video: fbdev: mxc: add RM68191 mipi panel driver support
Add driver support for RM68191 mipi panel display.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:45 +08:00
7530894e6f video: fbdev: mxc: add RM68200 mipi panel driver support
Add driver support for RM68200 mipi panel display.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:45 +08:00
8508b3b54f video: fbdev: mxc: add HX8363 mipi panel driver support
Add driver support for Truly HX8363 mipi panel.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:44 +08:00
d89f676e5e video: fbdev: mxc: add ADI ADV7535 driver support
Add driver support for ADI ADV7535 module which can convert
MIPI DSI signals to HDMI signals.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:44 +08:00
bf9855d59a video: fbdev: mxc: add Northwest Logic DSI driver support
Add the framebuffer driver support for the Northwest Logic
MIPI DSI controller.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:43 +08:00
afcde92505 video: fbdev: add i.MX LCDIF framebuffer driver
Add framebuffer driver for i.MX LCDIF display controller
which appears on quite a lot of i.MX platforms.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:42 +08:00
f22617dd45 MLK-21876-18 pxp: add uapi headfile for yocto build pass
Copied from 4.14.78 GA.
Module onwer could merge it when adding drivers code.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:00:41 +08:00
e8af0e15c4 MLK-21876-21 mxcfb: add uapi headfile for yocto build pass
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:00:41 +08:00
d370eb8a0f MLK-21876-19 pxp_dma: add uapi headfile for yocto build pass
Copied from 4.14.78 GA.
Module onwer could merge it when adding drivers code.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:00:41 +08:00
7dcc2a58d1 MLK-21876-14 dcic: add uapi headfile for yocto build pass
Copied from 4.14.78 GA.
Module onwer could merge it when adding drivers code.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:00:40 +08:00
d42348160b MLK-21876-13 ipu: add uapi headfile for yocto build pass
Copied from 4.14.78 GA.
Module onwer could merge it when adding drivers code.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 16:00:39 +08:00
01b9536dc8 imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 16:00:39 +08:00
10d1c632dc drm/bridge/nwl-dsi: add support for DCSS
DCSS needs active low VSYNC and HSYNC. Also, move the input selection in the
probe function, as this will not change at runtime.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:00:36 +08:00
0c39351e06 drm/bridge: nwl-dsi: fix nwl-dsi when used as module
When used as module and the panel is not yet probed, the bridge attach
callback will return -EINVAL. We should return -EPROBE_DEFER instead, to
give us another shot.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:00:36 +08:00
d0ca828d6b dt-bindings: display/bridge: nwl-dsi: Document fsl,clock-drop-level property
Add documentation for a new property: 'fsl,clock-drop-level'.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:00:35 +08:00
5d860acfb2 drm/bridge: nwl-dsi: Add support for clock-drop-level
The clock-drop-level is needed in order to add more blanking space needed
by DSI panels when sending DSI commands. One level is the equivalent of
phy_ref rate from the PLL rate. Since the PLL rate is targeted as highest
possible, each level should not get the crtc_clock too low, compared to the
actual clock.

Example for a clock of 132M, with "clock-drop-level = <1>" in dts file will
result in a crtc_clock of 129M, using the following logic:
- video_pll rate to provide both phy_ref rate of 24M and pixel-clock
  of 132M is 1056M (divisor /43 for phy_ref and /8 for pixel-clock)
- from this rate, we subtract the equivalent of phy_ref (24M) but
  keep the same divisor. This way, the video_pll rate will be 1056 - 24 =
  1032M.
- new pixel-clock will be: 1032 / 8 = 129M

For a "clock-drop-level = <2>", new pixel-clock will be:
(1056 - (24 * 2)) / 8 = 1008 / 8 = 126M

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:00:35 +08:00
8536dc2e27 dt-bindings: display/bridge: nwl-dsi: Document video_pll clock
Add documentation for a new clock 'video_pll'.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:00:35 +08:00
6bad38af38 drm/bridge: nwl-dsi: Add support for video_pll
This patch adds support for a new clock 'video_pll' in order to better
set the video_pll clock to a clock-rate that satisfies a mode's clock.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:00:34 +08:00
70de3be1b8 drm/bridge: Add NWL MIPI DSI host controller support
This adds initial support for the NWL MIPI DSI Host controller found on
i.MX8 SoCs.

It adds support for the i.MX8MQ but the same IP can be found on
e.g. the i.MX8QXP.

It has been tested on the Librem 5 devkit using mxsfb.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Co-developed-by: Robert Chiras <robert.chiras@nxp.com>
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:00:33 +08:00
634e936cfe dt-bindings: display/bridge: Add binding for NWL mipi dsi host controller
The Northwest Logic MIPI DSI IP core can be found in NXPs i.MX8 SoCs.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 16:00:32 +08:00
5381ccd1a4 drm/imx: sec_dsim-imx: add imx8mn compatible support
Add a compatible string which includes 'imx8mn' for
SEC DSIM platform driver.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:30 +08:00
596d489100 drm/imx: sec-dsim_imx: add resets put for probe failure
When the probe function fails, especially when the defer
probe happens, the reset arrays need to be put for next
probe, otherwise, below warning will be triggered:

[    1.948680] WARNING: CPU: 0 PID: 192 at drivers/reset/core.c:557 __reset_control_get_internal+0xe4/0x140
[    1.948683] Modules linked in:
[    1.953376] imx6q-pcie 33800000.pcie: EXT REF_CLK is used!.
[    1.960689] CPU: 0 PID: 192 Comm: kworker/0:3 Not tainted 5.4.0-rc5-03174-g8c184f974f45 #219
[    1.960691] Hardware name: FSL i.MX8MM EVK board (DT)
[    1.960701] Workqueue: events deferred_probe_work_func
[    1.997399] pstate: 60000005 (nZCv daif -PAN -UAO)
[    2.002189] pc : __reset_control_get_internal+0xe4/0x140
[    2.007499] lr : __of_reset_control_get+0x190/0x1a8
[    2.012373] sp : ffff80001292b7f0
[    2.015685] x29: ffff80001292b7f0 x28: ffff800011d29000
[    2.020996] x27: 0000000000000001 x26: 0000000000000000
[    2.026307] x25: 0000000000000000 x24: 0000000000000001
[    2.031618] x23: 0000000000000000 x22: ffff00007c4ca180
[    2.036928] x21: 0000000000000005 x20: ffff00007c4ca1a0
[    2.042239] x19: ffff00007c676480 x18: 0000000000000014
[    2.047550] x17: 0000000000000000 x16: 0000000000000000
[    2.052860] x15: 0000000000000000 x14: 6d65747379736275
[    2.058171] x13: 0000000000000000 x12: 0000000000000141
[    2.063481] x11: 0000000000000020 x10: 0101010101010101
[    2.068792] x9 : 0000000000000004 x8 : 7f7f7f7f7f7f7f7f
[    2.074102] x7 : 766f21ff726b6b64 x6 : 0000000080237077
[    2.079413] x5 : 0000000000000001 x4 : 0000000000000000
[    2.084724] x3 : 0000000000000001 x2 : 0000000000000000
[    2.090034] x1 : 0000000000000005 x0 : 0000000000000000
[    2.095345] Call trace:
[    2.097791]  __reset_control_get_internal+0xe4/0x140
[    2.102754]  __of_reset_control_get+0x190/0x1a8
[    2.107283]  of_reset_control_array_get+0xdc/0x1b8
[    2.112075]  imx_sec_dsim_bind+0x1ac/0x34c
[    2.116171]  component_bind_all+0x128/0x26c
[    2.120353]  imx_drm_bind+0xc8/0x154
[    2.123928]  try_to_bring_up_master+0x160/0x1c0
[    2.128457]  __component_add+0xa4/0x17c
[    2.132291]  component_add+0x10/0x18
[    2.135866]  imx_sec_dsim_probe+0x18/0x20
[    2.139876]  platform_drv_probe+0x4c/0xb0
[    2.143885]  really_probe+0x1c4/0x320
[    2.147545]  driver_probe_device+0x58/0xfc
[    2.151640]  __device_attach_driver+0x90/0xac
[    2.155996]  bus_for_each_drv+0x68/0xbc
[    2.159830]  __device_attach+0xe0/0x138
[    2.163665]  device_initial_probe+0x10/0x18
[    2.167846]  bus_probe_device+0x90/0x98
[    2.171680]  deferred_probe_work_func+0x68/0x9c
[    2.176212]  process_one_work+0x14c/0x2d0
[    2.180220]  worker_thread+0x360/0x3e8
[    2.183968]  kthread+0xf4/0x120
[    2.187110]  ret_from_fork+0x10/0x18
[    2.190684] ---[ end trace 63ee8d9f75c07389 ]---

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:29 +08:00
7adcf1c464 drm/imx: Replace reset flow for DSIM
After the dispmix reset driver development, the reset flow
is better to be replaced by using this driver to hide the
reset details for all the dispmix submodules, and whose
driver code for reset can become platform independent.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit b1fd6e40a4)
2019-11-25 16:00:28 +08:00
5e70d1c886 MLK-22304-1 drm/imx: dsim: fix build warnings if CONFIG_PM_SLEEP off
When CONFIG_PM_SLEEP is disabled, the suspend and resume hooks
are implemented as dummy functions, but GCC will report below
build warnings:

drivers/gpu/drm/imx/sec_mipi_dsim-imx.c:324:12: warning: ‘imx_sec_dsim_suspend’ defined but not used [-Wunused-function]
 static int imx_sec_dsim_suspend(struct device *dev)
            ^
drivers/gpu/drm/imx/sec_mipi_dsim-imx.c:329:12: warning: ‘imx_sec_dsim_resume’ defined but not used [-Wunused-function]
 static int imx_sec_dsim_resume(struct device *dev)
            ^

So remove these dummy functions to avoid these build warnings.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:27 +08:00
a3deb9ccdd drm/imx: dsim: change DISPMIX reset for IMX8MN
According to the design spec for IMX8MN platform, the GPR reset
module for DISPMIX has some changes. So the reset code should be
adjusted accordingly. This is a temporary solution and will be
improved later.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:26 +08:00
2d489fafab drm/imx: sec-dsim_imx: correct DSIM version register access
During the DSIM binding stage, only enable cfg clock is not
enough to access the version register, since at this time,
if the DSIM is still in the reset state, the register read
will always return 0. So before the version register read,
the runtime pm should be in resume state.

(This is the DSIM controller driver part change.)

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:26 +08:00
8e76a569c4 drm/imx: sec-dsim_imx: a general way to compute PLL PMS
A fixed PLL PMS setting for attached panel is obviously not
enough for any other mipi panel which needs a different PLL
output clock frequency, and besides, for the CEA-861 standard
display modes, the 'pll_pms' table also can not cover all the
modes requirements. So a general way is created to solve this
problem which can provide an optimum solution to output a PLL
bit clock to match the request frequency in a maximum degree
and also satisfy the input clock and intermediate clocks limit
according to the PLL specification.

(This is the DSIM controller driver change for PLL PMS compute.)

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:25 +08:00
4d9cab94fb MLK-19400-2 drm/imx: sec-dsim_imx: alter 'rpm_suspended' to a counter
Since the DSIM's runtime PM suspend() and resume() callbacks
are also called during system PM suspend() and resume(), it
is necessary to use a counter to record the suspended depth,
and 'rpm_suspended' field can be used as this purpose which
can help to detect and avoid runtime suspend and resume calls
mismatch caused problems, by changing the 'rpm_suspended' to
be an atomic integer from a boolean type.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 91a8e6c8f63db328fbc752b1659bdaa67ee5c8d5)
2019-11-25 16:00:24 +08:00
d7cdf77a36 drm/imx: sec-dsim_imx: improve DPHY TIMING configs
The SEC provides a table to guide the DPHY TIMINGS config based
on the PLL output bit clock frequency for DSIM. So create the
table which is used by SEC LN14LPP DPHY with HS Timing v1.2 and
this table will be used by the SEC DSIM Bridge driver to help to
config the corresponding DPHY Timings correctly for each display
mode. Along with the table, a DPHY TIMING table entry 'compare'
method is implemented for the binary search when lookup the
suitable DPHY TIMING entry.

(This is the DSIM controller driver change for DPHY TIMING config
improvements.)

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:24 +08:00
6b9f75cb20 drm/imx: sec-dsim_imx: move PLL check to DSIM Encoder
Defer the PLL output check to the SEC DSIM Encoder's atomic check
from SEC DSIM Bridge's mode_fixup(), since in the attached DSI
device Bridge's mode_fixup(), it may change the data lanes number,
and this change is done after the SEC DSIM Bridge's mode_fixup().
And the DSIM Encoder's atomic check is the ideal place to do this
PLL check, since it happens after all the Bridges' mode_fixup()
done.

(This is the DSIM controller driver change for the PLL check.)

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:23 +08:00
61944712fc MLK-19537-3 drm/imx: sec-dsim_imx: remove dphy slave reset
Remove dphy slave reset and only keep master reset for mipi dsi

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 83f4a5a95262184759f1c99be46e8906dd24543b)
2019-11-25 16:00:22 +08:00
9012eac7b3 MLK-19158-1 drm/imx: sec-dsim_imx: add bus format check for ENCODER
The connector's 'display_info' usually includes all the bus
formats the display peripheral device can be accepted. And
the DRM adjusted display mode's 'private_flags' includes
bus format the DSIM bridge requested according to the DSI
device display format. Add the bus format check to the DSIM
encoder's atomic check to make sure these two bus formats
have intersection.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 6d804db82b95411ebad9fcfb43b3acecee5941d9)
2019-11-25 16:00:21 +08:00
44f3e2e5f5 MLK-19017-7 drm/imx: sec-dsim_imx: add rpm status check for suspend/resume
Add runtime PM status check during runtime suspend and resume
to avoid unnecessary jobs if it is already in that state which
can avoid possible kernel warnings of clock disable/unprepare
mismatch during system suspend if it is alreay in runtime
suspended state.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 6f95c6fdc0de2fd4fe1d835c164f5e3cfb23e17d)
2019-11-25 16:00:20 +08:00
bfda55d4f7 MLK-19017-6 drm/imx: add system pm support for SEC DSIM
Implement the suspend()/resume() callbacks to support system
power management functions for SEC DSIM.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit db3e9faa0278af6de5aaac008478123d0ebecb73)
2019-11-25 16:00:20 +08:00
8eb8aa019d drm/imx: add DISPMIX power domain support for SEC DSIM
After the DISPMIX power domain enabled, all the related registers
will drop their values once runtime pm suspend called. So in the
pm runtime resume process, the SEC DSIM de-reset and some init jobs
need to be done, and these jobs are no longer necessary to be done
during probe bind anymore.

(This is the platform driver part change for power domain support.)

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 7a7f17f5fb66135629ef20a2b4780dfef2f0f0ce)
2019-11-25 16:00:19 +08:00
b41429c61a MLK-18535-8 drm/imx: sec_mipi_dsim-imx: add DSIM host driver
The Samsung DSIM host driver mainly focuses on the config
related with soc platforms. And the controller itself config
has been moved to the sec-dsim bridge driver.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:19 +08:00
491c4a215d drm/panel: simple: Add support for JDI TX26D202VM0BWA panel
This patch adds support for Japan Display Inc. 10.1" TX26D202VM0BWA
WUXGA(1920x1200) TFT LCD panel with LVDS interface.
The panel has dual LVDS channels.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:00:17 +08:00
193f966dbc dt-bindings: display: Add JDI TX26D202VM0BWA LCD panel bindings
The JDI TX26D202VM0BWA LCD panel is a 10.1" panel
with a 1920x1200 (WUXGA) resolution.
The panel has dual LVDS channels.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 16:00:17 +08:00
febcc5d229 drm/panel: rm67191: Remove CLOCK_NON_CONTINUOUS flag
The flag MIPI_DSI_CLOCK_NON_CONTINUOUS was wrong used in the DSI driver,
so it was added to this panel, but not neccesary.
So, remove this flag since it is not needed.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:00:16 +08:00
42987ee137 MLK-17275-2: drm/bridge: it6263: Add support for OF_DYNAMIC
When CONFIG_OF_DYNAMIC is used, and this driver is enabled in
devicetree, but fails to probe a physical i2c client, it should disable
it's remote endpoint, so that the DRM master device won't fail to bind
the other available devices.
Usually, the remote endpoint of this device is a DRM encoder. If a DRM
encoder fails to bind, the DRM master device will also fail to bind.
This is why, we should disable the encoder node dynamically in
devicetree.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:00:14 +08:00
3b494389a0 MLK-20438 drm/bridge: sec-dsim: remove 'FORCEBTA' for packet send
Configure 'FORCEBTA' mandatorily for every packet send may
cause some packet send timeout in a low possibility. And
until now, this timeout issue only happens during panel
disable callback with the below error log:

"
imx_sec_dsim_drv 32e10000.mipi_dsi: wait pkthdr tx done time out
panel-raydium-rm67191 32e10000.mipi_dsi.0: [drm:rad_panel_disable] *ERROR* Failed to enter sleep mode (-16)
imx_sec_dsim_drv 32e10000.mipi_dsi: panel disable failed: -16
panel-raydium-rm67191 32e10000.mipi_dsi.0: [drm:rad_panel_unprepare] *ERROR* Panel still enabled!
imx_sec_dsim_drv 32e10000.mipi_dsi: panel unprepare failed: -1
"

The root cause for this error is not clear, but remove
'FORCEBTA' can avoid it and won't cause any side effect.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 8116960876)
2019-11-25 16:00:14 +08:00
655d0db583 MLK-20687 drm/bridge: sec-dsim: correct LPM config for Long Packet
According to the test, the Low Power Mode config should be
done before the Long Packet payload is written to SFR FIFO.
Otherwise, the packet send out by DSIM is not correct. This
should be the DSIM implementation behaviour.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit c7833c3920)
2019-11-25 16:00:14 +08:00
dbae5bce3b MLK-21274-2 drm/bridge: sec-dsim: remove bridge assign for encoder
Remove the bridge assignment for encoder before the bridge
attach during the sec dsim bind stage, since if the bridge
attach succeeds, the assignment will be done in the attach,
or if attach fails, the encoder's bridge field should be
set to NULL, otherwise below warning message printed:

[    1.034614] WARNING: CPU: 1 PID: 1 at drivers/gpu/drm/drm_bridge.c:150 drm_bridge_detach+0x4c/0x54
[    1.043570] Modules linked in:
[    1.046630] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.19.30-03537-g02a6fac0da96 #338
[    1.054544] Hardware name: FSL i.MX8MM EVK board (DT)
[    1.059595] pstate: 60000005 (nZCv daif -PAN -UAO)
[    1.064386] pc : drm_bridge_detach+0x4c/0x54
[    1.068657] lr : drm_encoder_cleanup+0x28/0xa4
[    1.073099] sp : ffff00000807b9d0
[    1.076412] x29: ffff00000807b9d0 x28: ffff80007ab3ba80
[    1.081725] x27: 0000000000000039 x26: ffff80007a8a3080
[    1.087039] x25: ffff80007ab3ba88 x24: ffff80007ab6c800
[    1.092352] x23: 00000000ffffffed x22: ffff000008f1c518
[    1.097665] x21: ffff80007ab6c800 x20: ffff80007ab3ba88
[    1.102978] x19: 0000000000000000 x18: 0000000000000000
[    1.108291] x17: 0000000000000001 x16: 00000000000000fc
[    1.113604] x15: 0000000000000000 x14: 64697262206d6973
[    1.118917] x13: 642063657320646e x12: 6962206f74206465
[    1.124230] x11: ffffffffffffffff x10: 0000000000000006
[    1.129543] x9 : 0000000000000005 x8 : 000000000000068e
[    1.134856] x7 : 7320646e6962206f x6 : ffff000008668de4
[    1.140169] x5 : 0000000000000000 x4 : 0000000000000000
[    1.145481] x3 : ffffffffffffffff x2 : 0000000000000000
[    1.150794] x1 : 31cae07dd51c2b00 x0 : ffff80007a7bd580
[    1.156107] Call trace:
[    1.158555]  drm_bridge_detach+0x4c/0x54
[    1.162478]  drm_encoder_cleanup+0x28/0xa4
[    1.166574]  imx_sec_dsim_bind+0x1c4/0x1f8
[    1.170673]  component_bind_all+0xfc/0x24c
[    1.174770]  imx_drm_bind+0xa0/0x134
[    1.178346]  try_to_bring_up_master+0x148/0x1a8
[    1.182877]  component_add+0x9c/0x174
[    1.186539]  lcdif_crtc_probe+0x20/0x3c
[    1.190376]  platform_drv_probe+0x4c/0xb0
[    1.194385]  really_probe+0x21c/0x2b4
[    1.198047]  driver_probe_device+0xa8/0xfc
[    1.202143]  __driver_attach+0xd4/0xd8
[    1.205892]  bus_for_each_dev+0x64/0xc0
[    1.209728]  driver_attach+0x20/0x28
[    1.213303]  bus_add_driver+0x1c0/0x224
[    1.217140]  driver_register+0x68/0x120
[    1.220976]  __platform_driver_register+0x4c/0x54
[    1.225682]  lcdif_crtc_driver_init+0x18/0x20
[    1.230040]  do_one_initcall+0x58/0x168
[    1.233877]  kernel_init_freeable+0x1b4/0x274
[    1.238235]  kernel_init+0x10/0x104
[    1.241724]  ret_from_fork+0x10/0x18
[    1.245300] ---[ end trace a1ee52d990264440 ]---

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:12 +08:00
83abd90471 MLK-21274-3 drm/bridge: sec-dsim: add defer probe support
Since the dsi panel device is not a component, so its driver
loading can be before or after the other display components
binding randomly. So add defer probing for sec dsim bridge
attach to support the case that the panel driver is loaded
after sec dsim binding.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 16:00:12 +08:00
3a907b5a05 MLK-17537-1 drm/bridge: Correct the ADV7533 init
According to the Analog Devices configuration script, there are some
steps that need to be made when configuring the ADV for a specific mode.
Some of those steps were missing from driver, so this patch takes care
of this.
Also, in mode_fixup, the driver is trying to reconfigure the DSI lanes
from 4 to 3, when pixel clock is lower than 80MHz, which is not
necessary. the lanes property represents the maximum available lanes on
that devices and should not differ from a mode to another.
The DSI host is the one who should predict how many lanes it could use
to drive a display mode, so remove this from ADV driver.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:00:10 +08:00
16c16ceba0 MLK-18877-1 drm/bridge: adv7511: Add debug info for HPD event
Add debug information for the HDP event catched with i2c interrupt.
Also, simplify the code in adv7511_hpd_work.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:00:06 +08:00
ab35a9108e MLK-17650-1 drm/bridge: adv7511: Add support for programmable i2c addresses
The DSI-HDMI converter, ADV7535, driver uses four i2c memory maps: MAIN,
DSI-CEC, EDID and PACKET.
While the MAIN address is hard-coded in the ROM chip, the other three
can be programmed into the MAIN memory map.
Currently, the three memory maps addresses, that can be programmed, are
hard-coded into the code.
In order to avoid conflicts with other i2c clients on the bus, update
the driver to use configurable addresses specified in DTS file.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 16:00:03 +08:00
1bdc9083f7 MLK-17275-7 drm/bridge: adv7511: Add dsi-channel property
Add a new property "adi,dsi-channel" to allow the user specify the DSI
channel to be used when communicating with DSI peripheral.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:00:01 +08:00
369b5f06ac MLK-17275-1 drm/bridge: adv7511: Add support for OF_DYNAMIC
When CONFIG_OF_DYNAMIC is used, and this driver is enabled in
devicetree, but fails to probe a physical i2c client, it should disable
it's remote endpoint, so that the DRM master device won't fail to bind
the other available devices.
Usually, the remote endpoint of this device is a DRM encoder. If a DRM
encoder fails to bind, the DRM master device will also fail to bind.
This is why, we should disable the encoder node dynamically in
devicetree.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:00:00 +08:00
453cd42feb MLK-16986-4 drm/bridge: adv7511: set bus_flags and bus_format
For a proper initialization of the crtc driving the connector for this
bridge, we need to set the bus_formats and bus_flags of the connector's
display_info.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 16:00:00 +08:00
cff284949b MLK-16918-15 drm/bridge: Update adv7511 driver with some regs for adv7535
The low refresh rate register for ADV7535 is in 0x4A instead of 0xFB. In
order to correctly handle these differences, add the new type ADV7535.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 15:59:59 +08:00
b7b8f742b3 MLK-16347-6 drm/bridge: adv7511: Add new compatible string
Added "adi,adv7535" to the adv7511 drm bridge and adi,adv7511.txt doc,
since the driver can also support the ADV7535 chipset (upgrade of ADV7533).

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
2019-11-25 15:59:59 +08:00
c7effd46c3 MLK-21911 drm/bridge: sec-dsim: free 'pll_pms' to avoid memory leak
The 'pll_pms' data is allocated dynamically and it should be
freed after its usage is done explicitly, otherwise there is
a serious memory leak problem, since this data allocation
frequency is really high during video playback and graphic
cases running.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2019-11-25 15:59:59 +08:00
7b01081fad MLK-21880-1 drm/bridge: sec-dsim: correct DSIM version register access
During the DSIM binding stage, only enable cfg clock is not
enough to access the version register, since at this time,
if the DSIM is still in the reset state, the register read
will always return 0. So before the version register read,
the runtime pm should be in resume state.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:58 +08:00
2565b307a7 MLK-21383 drm/bridge: sec-dsim: fix maybe-uninitialized build warnings
If enable CONFIG_DYNAMIC_DEBUG, below maybe-uninitialized build
warnings happen:

"
In file included from ./include/linux/printk.h:336:0,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/unaligned/access_ok.h:5,
                 from ./include/asm-generic/unaligned.h:13,
                 from ./arch/arm64/include/generated/asm/unaligned.h:1,
                 from drivers/gpu/drm/bridge/sec-dsim.c:17:
drivers/gpu/drm/bridge/sec-dsim.c: In function ‘sec_mipi_dsim_calc_pmsk’:
./include/linux/dynamic_debug.h:135:3: warning: ‘best_s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   __dynamic_dev_dbg(&descriptor, dev, fmt, \
   ^
drivers/gpu/drm/bridge/sec-dsim.c:1149:27: note: ‘best_s’ was declared here
  uint32_t best_p, best_m, best_s;
                           ^
In file included from ./include/linux/printk.h:336:0,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/unaligned/access_ok.h:5,
                 from ./include/asm-generic/unaligned.h:13,
                 from ./arch/arm64/include/generated/asm/unaligned.h:1,
                 from drivers/gpu/drm/bridge/sec-dsim.c:17:
./include/linux/dynamic_debug.h:135:3: warning: ‘best_m’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   __dynamic_dev_dbg(&descriptor, dev, fmt, \
   ^
drivers/gpu/drm/bridge/sec-dsim.c:1149:19: note: ‘best_m’ was declared here
  uint32_t best_p, best_m, best_s;
                   ^
In file included from ./include/linux/printk.h:336:0,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/unaligned/access_ok.h:5,
                 from ./include/asm-generic/unaligned.h:13,
                 from ./arch/arm64/include/generated/asm/unaligned.h:1,
                 from drivers/gpu/drm/bridge/sec-dsim.c:17:
./include/linux/dynamic_debug.h:135:3: warning: ‘best_p’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   __dynamic_dev_dbg(&descriptor, dev, fmt, \
   ^
drivers/gpu/drm/bridge/sec-dsim.c:1149:11: note: ‘best_p’ was declared here
  uint32_t best_p, best_m, best_s;
           ^
"

Although this is a spurious warning according to the code logic, it
is better to give 'best_p', 'best_m' and 'best_s' initial values to
suppress the warnings.

Reported-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 753f2cab5a21256d51338caa746909066ba4ea8f)
2019-11-25 15:59:58 +08:00
a940cee4fd MLK-21252 drm/bridge: sec-dsim: resolve OVERFLOW_BEFORE_WIDEN warns
Coverity reports the 'OVERFLOW_BEFORE_WIDEN' warns which can
cause potential expression overflow for multiplying two 32bit
integers and assign the result to a 64bit integer, since no
automatic integer type promotion exists before the multiply
operation, so requires explicit type casting for either one
of operands.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 9f10b3172107df0c31031e3fb02d32b6f26696f2)
2019-11-25 15:59:57 +08:00
2a0fed9fbb MLK-21150-4 drm/bridge: sec-dsim: a general way to compute PLL PMS
A fixed PLL PMS setting for attached panel is obviously not
enough for any other mipi panel which needs a different PLL
output clock frequency, and besides, for the CEA-861 standard
display modes, the 'pll_pms' table also can not cover all the
modes requirements. So a general way is created to solve this
problem which can provide an optimum solution to output a PLL
bit clock to match the request frequency in a maximum degree
and also satisfy the input clock and intermediate clocks limit
according to the PLL specification.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:56 +08:00
a087a95aa2 MLK-21150-3 drm/bridge: sec-dsim: add a new property 'pref-rate'
Add a new property 'pref-rate' support which can be used to
assign a different clock frequency for the DPHY PLL reference
clock in the dtb file. And if this property does not exist,
the default clock frequency for the reference clock will be
used. And according to the spec, the DPHY PLL reference clk
frequency should be in [6MHz, 300MHz] range.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:55 +08:00
688f619a41 MLK-21150-2 drm/bridge: sec-dsim: refine hblank word count compute
When there is no existing horizontal blanking word counts in
'dsim_hblank_par' tables, these data requires to be computed
according to the 'hfp', 'hbp' and 'hsa' timings which are in
pixel unit. So the pixel unit data requires to be converted
to word count unit data correctly to match the PLL output clk
frequency.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:55 +08:00
9c9e2872a2 MLK-21150-1 drm/bridge: sec-dsim: change uint64_t clk fields to uint32_t
Change the 'bit_clk' and 'pix_clk' fields of struct sec_mipi_dsim
and the 'bit_clk' field of struct dsim_pll_pms from 'uint64_t' type
to 'uint32_t' type, since first, these two fields are in KHz unit,
and so 32 bit unsigned integer is enough to hold the data values,
and second, use 32 bit integer can simplify related clocks compute.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:54 +08:00
8c1a2d0981 MLK-19400-1 drm/bridge: sec-dsim: correct one fail branching
Obviously, DRM panel prepare is done after the DSIM PLL config,
so when PLL config failed, the 'sec_mipi_dsim_bridge_enable()'
should return directly instead of goto DRM panel unprepare.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 9c77865d6ec98ff60a82f03743fd797d082634cc)
2019-11-25 15:59:54 +08:00
a89e9e064b MLK-19317-2 drm/bridge: sec-dsim: fine tune for '720p@60Hz' mode on 2 lanes
There is an issue that run several times of modetest 720p@60 test,
display turns to be abnormal or no display. So fine tunning the
DPHY TIMING config to use the same timing config of '720p@60Hz'
mode on 4 data lanes for the same display mode no 2 data lanes.
Until now, it works fine with this config.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 6ca115f778cf61691ef4c20d8473e5818f96ad31)
2019-11-25 15:59:53 +08:00
1380835856 MLK-19317-1 drm/bridge: sec-dsim: add missing 'ctrail' assignment
In the macro 'DSIM_DPHY_TIMING' definition, the field
'clk_trail' assignment to 'ctrail' is missing which
certainly needs to be added.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit f2818410d3d8d3b09002a85b593cee192d60bb06)
2019-11-25 15:59:53 +08:00
d4d572fb34 MLK-19252-7 drm/bridge: sec-dsim: workaround for 720p@60Hz on 4 lanes
For the CEA standard mode '1280x720@60Hz', the standard HFP value
is not suitable for the DSI peripheral which works with Non-burst
with Sync Pulse mode with 4 data lanes enabled. And this commit is
a workaround to plus 2 to the original HFP value to make this case
can display correctly.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 8b39ff24f89c5a9d21459ab5af47259060185b0a)
(cherry picked from commit 56c91a7ee4)
2019-11-25 15:59:52 +08:00
92e3680b5c MLK-19252-6 drm/bridge: sec-dsim: improve DPHY TIMING configs
The SEC provides a table to guide the DPHY TIMINGS config based
on the PLL output bit clock frequency for DSIM. So create the
table which is used by SEC LN14LPP DPHY with HS Timing v1.2 and
this table will be used by the SEC DSIM Bridge driver to help to
config the corresponding DPHY Timings correctly for each display
mode. Along with the table, a DPHY TIMING table entry 'compare'
method is implemented for the binary search when lookup the
suitable DPHY TIMING entry.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit eb899b434be6127db26c370bf200d8072eaf01c4)
(cherry picked from commit 3b23233daf)
2019-11-25 15:59:52 +08:00
5e2c0eaf8a MLK-19252-5 drm/bridge: sec-dsim: improve PLL PMS configs
Generally, different modes request different frequency bit clock,
so create a table to contain the PLL PMS config for each display
mode. This commit first contains several PLL PMS config entry for
several most popular CEA standard display modes.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 016ebc631e592e16848cd6426dd5b262a401746f)
(cherry picked from commit 5cddc84ba3)
2019-11-25 15:59:50 +08:00
2ad57e0a14 MLK-19252-4 drm/bridge: sec-dsim: improve HT configs
To make some DSI peripheral which can work only with 'Non-burst
with Sync Pulse mode' to display CEA standard timings, and there
is no common way to get the horizontal blanking timings for all
the display modes according to the test, and this is also related
with the data lanes used for data transfer, so create an horizontal
blanking parameters table for 2 and 4 data lanes mode respectively
for several popular CEA standard display modes.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 8fe1e3d77af5d380da4642c9f99c2dc59f5c5484)
(cherry picked from commit dbd661c160)
2019-11-25 15:59:50 +08:00
085f1a66b5 MLK-19252-3 drm/bridge: sec-dsim: workaround 3 data lanes case
According to a lot of tests and debug, for the Non-Burst with
Sync Pulse mode with 3 data lanes enable, the DSI peripheral
ADV7535 cannot display correctly, but the output timings seems
to be correct. Until now, the root cause for this issue still
cannot be found. So make this workaround to force to use 2 data
lanes when meeting the 3 lanes requests.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 6e7bc3bfd5b03da698a4024199bb696b792cc14e)
(cherry picked from commit 14f43f0aef)
2019-11-25 15:59:49 +08:00
3c7dee02cf MLK-19252-1 drm/bridge: sec-dsim: move PLL check to DSIM Encoder
Defer the PLL output check to the SEC DSIM Encoder's atomic check
from SEC DSIM Bridge's mode_fixup(), since in the attached DSI
device Bridge's mode_fixup(), it may change the data lanes number,
and this change is done after the SEC DSIM Bridge's mode_fixup().
And the DSIM Encoder's atomic check is the ideal place to do this
PLL check, since it happens after all the Bridges' mode_fixup()
done.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit c9bce66fed982383dde189c428d4c2ee2c2fc623)
(cherry picked from commit ead3666313)
2019-11-25 15:59:49 +08:00
e12f4e7073 MLK-19082 drm/bridge: sec-dsim: wait 'ph_tx_done' for long packet send
According to a lot of tests, for long packet send, the packet
payload transfer done interrupt will be triggered no later than
the packet header transfer done interrupt. So, to make sure the
long packet has been send to the peripheral completely, wait
'ph_tx_done' interrupt instead of 'pl_tx_done' for long packet
transfer. Otherwise it may cause subsequent packet transfer
failed sometimes.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 69a5f44025c6ecb2fee16c1650a81198b501f284)
2019-11-25 15:59:49 +08:00
9d86695797 MLK-19017-5 drm/bridge: sec-dsim: add DISPMIX power domain support
After the DISPMIX power domain enabled, all the related registers
will drop their values once runtime pm suspend called. So in the
pm runtime resume process, the SEC DSIM de-reset and some init jobs
need to be done, and these jobs are no longer necessary to be done
during probe bind anymore.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 7a7f17f5fb66135629ef20a2b4780dfef2f0f0ce)
2019-11-25 15:59:49 +08:00
3a7e380335 MLK-18605-10 drm/bridge: sec-dsim: complete mipi panel support
This patch adds mipi panel enable/disable during the dsim
bridge enable/disable procedure and implements required
callbacks and helper functions for dsi panel peripheral
support.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 4ef0a4e4ba0faca91e5b556fd13483aafdb64519)
2019-11-25 15:59:48 +08:00
74935f80b0 MLK-18605-9 drm/bridge: sec-dsim: increase timeout values for BTA and LPRX
The current timeout values for 'BTA' and 'LPRX' in register
'DSIM_TIMEOUT' is not long enough for some dsi peripherals,
so increase them long enough for all current peripherals to
avoid timeout errors generation in some cases.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 8e2b86b317382635e74002a5b2a466804247e61a)
2019-11-25 15:59:47 +08:00
a6221348b1 MLK-18605-8 drm/bridge: sec-dsim: add non-continuous clock support
Complete the non-continuous clock mode support.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit cd216df51f322434e45d12b6721637f1d8159fe4)
2019-11-25 15:59:47 +08:00
468720b3be MLK-18605-7 drm/bridge: sec-dsim: correct a register macro misspelt
The macro 'CONFIG_NON_CONTINUOUS_CLOCK_LANE' has been misspelt
to 'CONFIG_NON_CONTINOUS_CLOCK_LANE'. So correct it.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 24a05825b7299fc2f60768468fafbbc9a33804ad)
2019-11-25 15:59:46 +08:00
a81512f7fe MLK-18605-6 drm/bridge: sec-dsim: add fifo pointers initialization
All the DSIM fifo pointers should be better to be put into the
initialized state before enabling DSIM to transfer commands or
data.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 1c1624e48c83623a538f4af862367e6b3cbf8d67)
2019-11-25 15:59:45 +08:00
3c48f7e195 MLK-18605-5 drm/bridge: sec-dsim: correct 'DSIM_FIFOCTRL' offset
According to the DSIM specification, the 'DSIM_FIFOCTRL'
register addr offset should be '0x4c' instead of '0x48'.
So correct it.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 31850816f3aea109aff6c4bbcb44221e7d74afb5)
2019-11-25 15:59:45 +08:00
2ead18c575 MLK-18605-4 drm/bridge: sec-dsim: refine data lanes stop state check
When the attached dsi device does not use all the data lanes
to transfer data, data lanes stop state check should only
check the lanes used precisely, since unused lanes state is
not guaranteed to be in some stable state.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 6787ee8505ab16bf7bba38c721da0bfa87e9de0e)
2019-11-25 15:59:44 +08:00
13d58e1ef7 MLK-18605-3 drm/bridge: sec-dsim: refuse unknown dsi device attach
When a dsi device who is neither a bridge nor a panel requests
to be attached to the host, refuse this request directly.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 2e80acc8a611327fcc77d2e73515bc062cdc4233)
2019-11-25 15:59:44 +08:00
2270bdbbcd MLK-18605-2 drm/bridge: sec-dsim: allow same panel can be re-attached
During the mode set procedure, some dsi client device may detach
itself first and then attach it again according to the target
display mode parameters. In this case, the dsi client device
should be allowed to be re-attached again. So this is also true
for panel device.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit f586625dd1a665c58b976405c7980b7414554481)
2019-11-25 15:59:43 +08:00
aad2dbc1f1 MLK-18605-1 drm/bridge: sec-dsim: add cleanup when detach dsi client
When the dsi device is detached, the dsi parameters saved when
the dsi device is attached should be cleaned to avoid to be
misused. And besides, add some sanity check along with this
cleanup.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit a02c30a0ed8acc4a136d2281431fa4b07d66b933)
2019-11-25 15:59:43 +08:00
a813007c76 MLK-19081 drm/bridge: sec-dsim: correct args of 'drm_bridge_attach' call
Obviously, according to the drm_bridge_attach()'s definition,
the passing arguments of its function call should be corrected
here.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:43 +08:00
7a92948ef1 MLK-18535-13 dt-bindings: display: bridge: add sec-dsim bindings
Add the device-tree bindings for the display bridge
Samsung MIPI DSIM on i.MX platforms.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:42 +08:00
08b44f5436 MLK-18535-7 drm/bridge: sec-dsim: add bridge driver support
This is the abstracted bridge driver for Samsung MIPI DSIM
controller. This driver only foucses on the DSIM controller
itself configurations and never care about any config about
the platforms. So it can be shared by different platforms
without any modifications.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:42 +08:00
30ef09a80f drm/bridge: Add ITE IT6263 LVDS to HDMI transmitter support
ITE IT6263 is a LVDS to HDMI transmitter.
This patch adds IT6263 video support.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:59:41 +08:00
6b767485aa dt-bindings: display: bridge: Document ITE IT6263 LVDS to HDMI transmitter
This patch adds device tree binding for ITE IT6263 LVDS to HDMI transmitter.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:59:40 +08:00
4ad662b2a5 dt-bindings: Add vendor prefix for ITE Tech. Inc.
ITE Tech. Inc. (abbreviated as ITE) is a fabless IC design house from Taiwan.

Website: www.ite.com.tw

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: change to YAML format ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:59:39 +08:00
577013da72 gpu: imx: lcdif: add imx8mn compatible support
Add a compatible string which includes 'imx8mn' for
LCDIF platform driver.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:37 +08:00
cd658e9e0b drm/imx: Replace reset flow for LCDIF
After the dispmix reset driver development, the reset flow
is better to be replaced by using this driver to hide the
reset details for all the dispmix submodules, and whose
driver code for reset can become platform independent.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:36 +08:00
1a04575706 gpu: imx: lcdif: fix build warnings if CONFIG_PM_SLEEP off
When CONFIG_PM_SLEEP is disabled, the suspend and resume hooks
are implemented as dummy functions, but GCC will report below
build warnings:

drivers/gpu/imx/lcdif/lcdif-common.c:731:12: warning: ‘imx_lcdif_suspend’ defined but not used [-Wunused-function]
 static int imx_lcdif_suspend(struct device *dev)
            ^
drivers/gpu/imx/lcdif/lcdif-common.c:735:12: warning: ‘imx_lcdif_resume’ defined but not used [-Wunused-function]
 static int imx_lcdif_resume(struct device *dev)
            ^

So remove these dummy functions to avoid these build warnings.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:36 +08:00
2b13ac2aba drm/imx: lcdif: change DISPMIX reset for IMX8MN
According to the design spec for IMX8MN platform, the GPR reset
module for DISPMIX has some changes. So the reset code should be
adjusted accordingly. This is a temporary solution and will be
improved later.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:34 +08:00
59f9e4438f MLK-21876-10 gpu: drm: lcdif: fix headfile reference issue
CC      drivers/gpu/drm/imx/lcdif/lcdif-crtc.o
../drivers/gpu/drm/imx/lcdif/lcdif-crtc.c:26:21: fatal error: imx-drm.h: No such file or directory
 #include "imx-drm.h"

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:59:34 +08:00
d2ed3ca7b5 MLK-22158 drm/imx: lcdif: force 'mode_changed' for fb pix fmt change
According to the LCDIF function definition, the pixel format
configuration should not be done during LCDIF is running. So
if finding pixel format change is requested, the 'mode_changed'
needs to be set to make sure the commit become to be a full
modeset.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:34 +08:00
44fabffdb9 MLK-20337 drm/imx: lcdif: block 'active CRTC with no plane' commit
When an atomic commit contains an active CRTC with no plane,
it may cause two potential issues:

First, this CRTC will fetch its last attached plane data
or has no data can be fetched depending on the plane
driver's atomic_disable() implementation.

Second, this CRTC's 'plane_changed' will be false during
the whole commit tail stage, and this will make vblank
wait to be bypassed which directly causes the later wait
flip done timeout.

So add this commit case check to the LCDIF CRTC's atomic
check to block this kind of commits.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:32 +08:00
e5a1910f2e MLK-19819-2 Revert "MLK-19318 drm/imx: lcdif: avoid log print when no device attached"
This reverts commit 05d335b07b, since the
commit e07309cfdc567623a3f0cde6b79b972910248152 (MLK-19819-1 drm/imx:
lcdif: bypass atomic check when CRTC is disabled) can cover the function
that commit 05d335b07b can provide.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:30 +08:00
f8c6924808 MLK-19819-1 drm/imx: lcdif: bypass atomic check when CRTC will be disabled
On 4.14.y kernel branch, the DRM framework has been modified that
when no CONNECTOR attach to CRTC, the fb creation wil be deferred
until some CONNECTOR has been detected via hotplug. And the system
suspend workflow is also affected accordingly, if the CRTC atomic
check fails, the display-subsystem suspend also will be caused to
fail. So bypass the 'bus_format' check when CRTC is going to be
disabled.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:28 +08:00
654f67fa80 MLK-19318 drm/imx: lcdif: avoid log print when no device attached
In the 'lcdif_crtc_atomic_check()', when the 'bus_format' is
zero which means that there is no valid display peripherals
attached to LCDIF, return directly to avoid below error log
to make noises, since the error log is not cared in this case.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 25d2b80f637af06094f56c60d46404af3b7ff381)
2019-11-25 15:59:27 +08:00
7f01982660 MLK-19158-5 drm/imx: lcdif: add bus format check to CRTC's check
Add the check to LCDIF CRTC atomic check for the requested bus
format by encoder with the bus format which can be supported by
LCDIF CRTC to refuse unsupported case.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit e98afe9b6b20c2494c8570427b7811ed9ce202e8)
2019-11-25 15:59:27 +08:00
9119f18239 MLK-19158-4 drm/imx: lcdif: remove bus format check from PLANE's check
Since the LCDIF output data width can be different from the data
width of input pixel data, so the bus format check in the plane's
atomic check is not correct anymore, and need to be removed.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 2245702e7905fa7b75aec92fdbb9ffeb33bdb6de)
2019-11-25 15:59:25 +08:00
4d24275a91 MLK-19158-3 gpu: imx: lcdif: fix output order for 16bpp BGR formats
The 16bpp BGR order pixel formats 'DRM_FORMAT_ABGR1555' and
'DRM_FORMAT_XBGR1555' also require to be re-ordered to RGB
order for display, just like the format 'DRM_FORMAT_BGR565'
does.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit f5cc4f4699570fe697d21cb47c54aa91b82c8458)
2019-11-25 15:59:24 +08:00
028b9481aa MLK-19158-2 drm/imx: lcdif: improve output bus format config
According to LCDIF specification, the input pixel data
width and the output pixel data width can be different,
and this conversion is done by LCDIF automatically. So
config the output data width according to the requested
bus format from the encoder, instead to be same with the
input pixel data width.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit bfd27f6d71d86a7f2fc8314f082565db3682b925)
2019-11-25 15:59:24 +08:00
730377db70 MLK-19199 drm/imx: lcdif: replace FB width usage for cropping
According to the comments of 'struct drm_framebuffer', its
'width' field refers to the logical width of the visible
area of the framebuffer. This may be unequal to the total
pixels number of a line. So use the 'pitches' field to
replace 'width' for the horizontal cropping feature.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 9a2bbbf971ed79b32ae1c7da2d62b8a72f3ccffd)
2019-11-25 15:59:23 +08:00
9f54662720 MLK-19152-3 drm/imx: lcdif: add horizontal crop support to plane update
Add horizontal cropping support when atomic plane update is
running, and if the attached CRTC needs modeset. And if the
width of visible portion of plane is equal to the fb surface
width, the Pigeon Mode will be disabled, so cropping will be
disabled.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 30672b2b18a07a2926979cc533cbb84ea4a642dd)
2019-11-25 15:59:23 +08:00
f5ca7971de MLK-19152-2 drm/imx: lcdif: force 'mode_changed' when fb width changed
In DRM atomic modeset check, it will not check the fb's width
change, so in later atomic commit, it will not disable the CRTC
which has no mode changed. But for LCDIF, the fb width related
registers configuration can not be done when LCDIF is running.
So force 'mode_changed' to be true when fb width changed.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 518ff82756a39ff2d2f750596295baa4f5fca4c5)
2019-11-25 15:59:23 +08:00
5757e468fc MLK-19152-1 gpu: imx: lcdif: realize fb horizontal crop via Pigeon Mode
According to the LCDIF specification, the Legacy Mode does not
support cropping function in the horizontal direction, so add
Pigeon Mode which can support this kind of function. And when
enable this mode, the legacy horizontal timings configuration
should use stride value but not the active width, and related
pigeon configuration should use the active width but not the
stride value.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit e6da9542693dd585972897f62748a101f5726a74)
2019-11-25 15:59:22 +08:00
e662645ff4 MLK-19112 gpu: imx: lcdif: change 'rpm_suspended' to be atomic counter
Change the 'rpm_suspended' field to be an atomic type from
boolean type to make it have the counting ability which can
help to detect and avoid runtime suspend and resume calls
mismatch caused problems.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit dece6fbe51f9c0ea3cd42c52e1c174bd26ae70f1)
2019-11-25 15:59:21 +08:00
4e87da31b9 MLK-19083 drm/imx: lcdif: remove untrue condition for pixel format set
After supporting DISPMIX power domain, the LCDIF runtime
resume callback always write '0' to 'LCDIF_CTRL' register
which will clear previous pixel format related setting.
So the previous condition by comparing format change for
setting pixel format during plane atomic update is not
true anymore.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 5f84c69799456f28fd8182fd156e9067921e9a4e)
2019-11-25 15:59:20 +08:00
dc64834b84 MLK-19017-4 gpu: imx: lcdif: add rpm status check for suspend/resume
Add runtime PM status check during runtime suspend and resume
to avoid unnecessary jobs if it is already in that state which
can avoid below kernel warnings during system suspend if it is
alreay in runtime suspended state:

[   21.772969] ------------[ cut here ]------------
[   21.772982] WARNING: CPU: 3 PID: 3328 at drivers/clk/clk.c:594 clk_core_disable+0x80/0x88
[   21.772986] Modules linked in:
[   21.772988]
[   21.772993] CPU: 3 PID: 3328 Comm: rtcwakeup.out Not tainted 4.9.88-05410-g9fa23e9ada2a #135
[   21.772995] Hardware name: FSL i.MX8MM EVK board (DT)
[   21.772997] task: ffff800074358c80 task.stack: ffff80007b40c000
[   21.773000] PC is at clk_core_disable+0x80/0x88
[   21.773003] LR is at clk_core_disable_lock+0x20/0x34
[   21.773005] pc : [<ffff0000084e1430>] lr : [<ffff0000084e1a5c>] pstate: 800001c5
[   21.773007] sp : ffff80007b40fa90
[   21.773010] x29: ffff80007b40fa90 x28: 0000000000000000
[   21.773014] x27: 0000000000000002 x26: ffff000009395000
[   21.773017] x25: ffff00000863473c x24: ffff0000092de3d0
[   21.773021] x23: ffff80007a53f870 x22: 0000000000000000
[   21.773024] x21: ffff00000862877c x20: ffff80007a049400
[   21.773027] x19: 0000000000000140 x18: 0000000000000002
[   21.773031] x17: 0000ffff93824858 x16: ffff00000822a200
[   21.773034] x15: 0000463fe3000000 x14: 0000000000000000
[   21.773037] x13: 0000000000000000 x12: 0000000000000000
[   21.773040] x11: 0000000000000000 x10: 0000000000000000
[   21.773044] x9 : 0000000040000000 x8 : 0000000000210d00
[   21.773047] x7 : 0000000000000000 x6 : 0010ed7f00000000
[   21.773051] x5 : ffff80007a53f9a8 x4 : 0000000000000000
[   21.773054] x3 : 0000000010c110c0 x2 : 0000000000000000
[   21.773057] x1 : 0000000000000000 x0 : ffff80007a049400
[   21.773058]
[   21.773060] ---[ end trace 4a8e187491f145ed ]---
[   21.773062] Call trace:
[   21.773065] Exception stack(0xffff80007b40f8b0 to 0xffff80007b40f9e0)
[   21.773068] f8a0:                                   0000000000000140 0000ffffffffffff
[   21.773071] f8c0: ffff80007b40fa90 ffff0000084e1430 00000000800001c5 000000000000003d
[   21.773074] f8e0: ffff80007b475c00 ffff80007b40c000 ffff80007b40c000 000000018020001e
[   21.773077] f900: ffff000008c53cec ffff80007b40c000 ffff80007b40f950 ffff0000085d3b9c
[   21.773081] f920: ffff80007b40f9b0 ffff0000085f3728 ffff80007b475c00 ffff80007b475c00
[   21.773084] f940: ffff80007b40f990 ffff0000085f2430 ffff80007b475c00 ffff80007abf8800
[   21.773087] f960: ffff80007a049400 0000000000000000 0000000000000000 0000000010c110c0
[   21.773090] f980: 0000000000000000 ffff80007a53f9a8 0010ed7f00000000 0000000000000000
[   21.773092] f9a0: 0000000000210d00 0000000040000000 0000000000000000 0000000000000000
[   21.773095] f9c0: 0000000000000000 0000000000000000 0000000000000000 0000463fe3000000
[   21.773098] [<ffff0000084e1430>] clk_core_disable+0x80/0x88
[   21.773101] [<ffff0000084e1a5c>] clk_core_disable_lock+0x20/0x34
[   21.773104] [<ffff0000084e1a8c>] clk_disable+0x1c/0x24
[   21.773110] [<ffff0000085c73a0>] lcdif_disable_clocks+0x1c/0x60
[   21.773113] [<ffff0000085c7718>] imx_lcdif_suspend+0x10/0x24
[   21.773118] [<ffff0000086287a0>] platform_pm_suspend+0x24/0x50
[   21.773123] [<ffff000008633b58>] dpm_run_callback.isra.12+0x30/0x8c
[   21.773126] [<ffff0000086345d4>] __device_suspend+0x110/0x278
[   21.773129] [<ffff000008635800>] dpm_suspend+0x114/0x240
[   21.773132] [<ffff000008635bfc>] dpm_suspend_start+0x6c/0x78
[   21.773137] [<ffff000008104e28>] suspend_devices_and_enter+0xbc/0x534
[   21.773139] [<ffff0000081054f8>] pm_suspend+0x258/0x2f4
[   21.773142] [<ffff000008104030>] state_store+0x80/0xf4
[   21.773147] [<ffff0000083e7ce8>] kobj_attr_store+0x14/0x24
[   21.773153] [<ffff00000825d974>] sysfs_kf_write+0x40/0x48
[   21.773156] [<ffff00000825cd48>] kernfs_fop_write+0xb8/0x1cc
[   21.773160] [<ffff0000081e2d00>] __vfs_write+0x28/0x110
[   21.773163] [<ffff0000081e3ae4>] vfs_write+0xa8/0x1a8
[   21.773166] [<ffff0000081e4ea0>] SyS_write+0x44/0xa0
[   21.773170] [<ffff0000080838d8>] __sys_trace_return+0x0/0x4
[   21.773184] ------------[ cut here ]------------
[   21.773188] WARNING: CPU: 3 PID: 3328 at drivers/clk/clk.c:476 clk_core_unprepare+0x88/0x98
[   21.773190] Modules linked in:
[   21.773192]
[   21.773195] CPU: 3 PID: 3328 Comm: rtcwakeup.out Tainted: G        W       4.9.88-05410-g9fa23e9ada2a #135
[   21.773196] Hardware name: FSL i.MX8MM EVK board (DT)
[   21.773198] task: ffff800074358c80 task.stack: ffff80007b40c000
[   21.773201] PC is at clk_core_unprepare+0x88/0x98
[   21.773204] LR is at clk_unprepare+0x28/0x34
[   21.773206] pc : [<ffff0000084e1320>] lr : [<ffff0000084e3130>] pstate: 60000145
[   21.773208] sp : ffff80007b40faa0
[   21.773211] x29: ffff80007b40faa0 x28: 0000000000000000
[   21.773215] x27: 0000000000000002 x26: ffff000009395000
[   21.773218] x25: ffff00000863473c x24: ffff0000092de3d0
[   21.773221] x23: ffff80007a53f870 x22: 0000000000000000
[   21.773225] x21: ffff00000862877c x20: ffff80007aafbf80
[   21.773228] x19: ffff80007aafb298 x18: 0000000000000002
[   21.773232] x17: 0000ffff93824858 x16: ffff00000822a200
[   21.773235] x15: 0000463fe3000000 x14: 0000000000000000
[   21.773238] x13: 0000000000000000 x12: 0000000000000000
[   21.773241] x11: 0000000000000000 x10: 0000000000000000
[   21.773245] x9 : 0000000040000000 x8 : 0000000000210d00
[   21.773248] x7 : 0000000000000000 x6 : 0010ed7f00000000
[   21.773251] x5 : ffff80007a53f9a8 x4 : ffff00000944b000
[   21.773255] x3 : 0000000000000000 x2 : ffff800074358c80
[   21.773258] x1 : 0000000000000000 x0 : ffff80007a049400
[   21.773259]
[   21.773260] ---[ end trace 4a8e187491f145ee ]---
[   21.773262] Call trace:
[   21.773264] Exception stack(0xffff80007b40f8c0 to 0xffff80007b40f9f0)
[   21.773267] f8c0: ffff80007aafb298 0000ffffffffffff ffff80007b40faa0 ffff0000084e1320
[   21.773270] f8e0: 0000000060000145 000000000000003d ffff80007b40c000 000000018020001e
[   21.773273] f900: ffff000008c53cec ffff80007b40c000 ffff80007b40f950 ffff0000085d3b9c
[   21.773276] f920: ffff80007b40f9b0 ffff0000085f3728 ffff80007b475c00 ffff80007b475c00
[   21.773279] f940: ffff80007b40f990 ffff0000085f2430 ffff80007b475c00 ffff80007abf8800
[   21.773282] f960: ffff80007a049400 0000000000000000 ffff80007a049400 0000000000000000
[   21.773285] f980: ffff800074358c80 0000000000000000 ffff00000944b000 ffff80007a53f9a8
[   21.773288] f9a0: 0010ed7f00000000 0000000000000000 0000000000210d00 0000000040000000
[   21.773291] f9c0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   21.773293] f9e0: 0000000000000000 0000463fe3000000
[   21.773296] [<ffff0000084e1320>] clk_core_unprepare+0x88/0x98
[   21.773299] [<ffff0000084e3130>] clk_unprepare+0x28/0x34
[   21.773303] [<ffff0000085c73a8>] lcdif_disable_clocks+0x24/0x60
[   21.773306] [<ffff0000085c7718>] imx_lcdif_suspend+0x10/0x24
[   21.773309] [<ffff0000086287a0>] platform_pm_suspend+0x24/0x50
[   21.773312] [<ffff000008633b58>] dpm_run_callback.isra.12+0x30/0x8c
[   21.773315] [<ffff0000086345d4>] __device_suspend+0x110/0x278
[   21.773318] [<ffff000008635800>] dpm_suspend+0x114/0x240
[   21.773321] [<ffff000008635bfc>] dpm_suspend_start+0x6c/0x78
[   21.773324] [<ffff000008104e28>] suspend_devices_and_enter+0xbc/0x534
[   21.773327] [<ffff0000081054f8>] pm_suspend+0x258/0x2f4
[   21.773329] [<ffff000008104030>] state_store+0x80/0xf4
[   21.773332] [<ffff0000083e7ce8>] kobj_attr_store+0x14/0x24
[   21.773336] [<ffff00000825d974>] sysfs_kf_write+0x40/0x48
[   21.773339] [<ffff00000825cd48>] kernfs_fop_write+0xb8/0x1cc
[   21.773342] [<ffff0000081e2d00>] __vfs_write+0x28/0x110
[   21.773345] [<ffff0000081e3ae4>] vfs_write+0xa8/0x1a8
[   21.773347] [<ffff0000081e4ea0>] SyS_write+0x44/0xa0
[   21.773350] [<ffff0000080838d8>] __sys_trace_return+0x0/0x4

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit a6bac9bdebbdecf56575f6e361ad8f54e5263b95)
2019-11-25 15:59:19 +08:00
81441846b4 MLK-19017-3 gpu: imx: add system pm support for LCDIF
Implement the suspend()/resume() callbacks to support system
power management functions for LCDIF.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 7e00487012753cb370eab4ff5c05f76f7361297f)
2019-11-25 15:59:19 +08:00
4ba532e2cd MLK-19017-2 gpu: imx: add DISPMIX power domain support for LCDIF
After the DISPMIX power domain enabled, all the related registers
will drop their values once runtime pm suspend called. So in the
pm runtime resume process, the LCDIF de-reset and some init jobs
need to be done, and these jobs are no longer necessary to be done
during probe stage anymore.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit f83aaaecaeb54d8b1231be2cb7175ce58682dae7)
2019-11-25 15:59:18 +08:00
34fc2260a6 MLK-18605-14 drm/imx: lcdif: adjust 'max_height' for '1080x1920' mode
Change the maximum height limitation to 1920 to support
'1080x1920' resolution mode. It is a temporary work
around and will be improved later.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 44d0209e97e0c574af30dd7a7d7e059d4ddf996d)
2019-11-25 15:59:18 +08:00
51c5292731 MLK-18560 drm/imx: lcdif: refine bus format sanity check for plane
Add an function to get the LCDIF controller supported bus
formats according to the pixel format bpp. And change the
bus format sanity check in the plane's atomic check to see
if the bus format required by the peripheral attached to
LCDIF can be supported by LCDIF.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:17 +08:00
5bddd8f0b0 MLK-18535-10 drm/imx: lcdif: limit the maximum resolution to '1920x1080'
For now, the higher resolution than '1920x1080' is not supported
yet. So limit the 'max_width' and 'max_height' of mode_config
to be 1920 and 1080.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:17 +08:00
fe5a554200 gpu: imx: lcdif: break Kconfig recursive dependency
After adding LCDIF DRM/KMS driver, there will be a Kconfig recursive
dependency loop:

drivers/media/v4l2-core/Kconfig:7:error: recursive dependency detected!
drivers/media/v4l2-core/Kconfig:7:      symbol VIDEO_V4L2 depends on I2C
drivers/i2c/Kconfig:8:  symbol I2C is selected by FB_DDC
drivers/video/fbdev/Kconfig:63: symbol FB_DDC depends on FB
drivers/video/fbdev/Kconfig:12: symbol FB is selected by DRM_KMS_FB_HELPER
drivers/gpu/drm/Kconfig:75:     symbol DRM_KMS_FB_HELPER depends on DRM_KMS_HELPER
drivers/gpu/drm/Kconfig:69:     symbol DRM_KMS_HELPER is selected by DRM_IMX
drivers/gpu/drm/imx/Kconfig:2:  symbol DRM_IMX depends on IMX_LCDIF_CORE
drivers/gpu/imx/lcdif/Kconfig:1:        symbol IMX_LCDIF_CORE depends on RESET_CONTROLLER
drivers/reset/Kconfig:5:        symbol RESET_CONTROLLER is selected by QCOM_SCM
drivers/firmware/Kconfig:218:   symbol QCOM_SCM is selected by VIDEO_QCOM_VENUS
drivers/media/platform/Kconfig:482:     symbol VIDEO_QCOM_VENUS depends on V4L_MEM2MEM_DRIVERS
drivers/media/platform/Kconfig:165:     symbol V4L_MEM2MEM_DRIVERS depends on VIDEO_V4L2

Making IMX_LCDIF_CORE select RESET_CONTROLLER instead of depending on it
breaks this loop.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:16 +08:00
ae0466c8cb MLK-18535-5 drm/imx: add LCDIF DRM/KMS driver
This is a new DRM/KMS driver for LCDIF which conforms
to the IMX DRM Core framework. It provides support for
CRTCs, Planes and mode config of KMS.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:59:15 +08:00
6cd1ebf267 MLK-18535-3 gpu: imx: add LCDIF core driver
The LCDIF core driver is responsible to provide controller
registers configuration and create the platform devices for
the child port nodes. And the platform devices later will
attach to the corresponding DRM/KMS drivers via name match.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
[ Aisheng: Kconfig & Makefile update for a clean base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:59:14 +08:00
47362804d8 imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:59:14 +08:00
aed0e27470 gpu: Move ipu-v3 to imx folder
The new imx folder may contain ipu-v3 and dpu common drivers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix source path ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:59:13 +08:00
3cabcc300e drm/imx: Revert a patch which merges imx-drm-core and ipuv3-crtc in one module
DPU CRTC found in i.MX8qm/qxp SoCs can be hooked into imx-drm.
Thus, move ipuv3-crtc out of imx-drm-core.

Revert "drm/imx: merge imx-drm-core and ipuv3-crtc in one module"

This reverts commit 3d1df96ad4.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:59:13 +08:00
2c302d969b MLK-22156-3 gpu: ipu-v3: move new ipu file ipu-ic-csc.c under gpu/imx
Caused by f208b26e61 ("gpu: ipu-v3: ipu-ic: Fully describe colorspace conversions")

make[5]: *** No rule to make target 'drivers/gpu/imx/ipu-v3/ipu-ic-csc.o', needed by 'drivers/gpu/imx/ipu-v3/built-in.a'.  Stop.
make[5]: *** Waiting for unfinished jobs....
../scripts/Makefile.build:498: recipe for target 'drivers/gpu/imx/ipu-v3' failed
make[4]: *** [drivers/gpu/imx/ipu-v3] Error 2
../scripts/Makefile.build:498: recipe for target 'drivers/gpu/imx' failed

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:59:12 +08:00
672b38b989 MLK-21876-10 gpu: drm: ipu: fix headfile reference issue (part2)
../drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c:17:21: fatal error: imx-drm.h: No such file or directory
 #include "imx-drm.h"

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:59:11 +08:00
6607e4b591 drm/imx: ipuv3-kms: Move to a new ipuv3 folder
Since we want to add i.MX DPU support into imx-drm, the IPUv3 KMS driver
can be put into the ipuv3 folder to organize the driver code better.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:59:10 +08:00
ae54c0c5e6 drm/imx: ipuv3-crtc: Rename some IPUv3 specific functions
Since we want to add i.MX DPU support into imx-drm, the IPUv3 specific
KMS function names should be no more too generic with the prefix 'imx_drm'.
Let's rename them to be prefixed with 'ipu'.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:59:09 +08:00
c80bca52cd drm/imx: Extract IPUv3 specific KMS functions to ipuv3-kms.c (part 2)
Since we want to add i.MX DPU support into imx-drm, the imx-drm core
driver should be no more IPUv3 specific.  Let's make imx-drm more generic
and extract IPUv3 specific KMS functions to ipuv3-kms.c.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: update to new kernel version accordingly ]
[ Aisheng: split imx-drm-core changes out of ipu ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:59:09 +08:00
722e39a6a6 gpu: Move ipu-v3 to imx folder
The new imx folder may contain ipu-v3 and dpu common drivers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix source path ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:59:09 +08:00
604ded611b drm/imx: Revert a patch which merges imx-drm-core and ipuv3-crtc in one module
DPU CRTC found in i.MX8qm/qxp SoCs can be hooked into imx-drm.
Thus, move ipuv3-crtc out of imx-drm-core.

Revert "drm/imx: merge imx-drm-core and ipuv3-crtc in one module"

This reverts commit 3d1df96ad4.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:59:08 +08:00
327e1daa6e drm/mxsfb: Add support for live pixel format change
This IP requires full stop and re-start when changing display timings,
but we can change the pixel format while running.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:59:04 +08:00
109dbe2950 drm/mxsfb: Add support for horizontal stride
Besides the eLCDIF block, there is another IP block, used in the past
for EPDC panels. Since the iMX.8mq doesn't have an EPDC connector, this
block is not documented, but we can use it to do additional operations
on the frame buffer.
In this case, we can use the pigeon registers from this IP block in
order to do horizontal crop on the frame buffer processed by the eLCDIF
block.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:59:04 +08:00
37d8088c18 drm/mxsfb: Clear OUTSTANDING_REQS bits
Bit 21 can alter the CTRL2_OUTSTANDING_REQS value right after the eLCDIF
is enabled, since it comes up with default value of 1 (this behaviour
has been seen on some imx8 platforms).
In order to fix this, clear CTRL2_OUTSTANDING_REQS bits before setting
its value.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:59:03 +08:00
b53ccc9cba drm/mxsfb: Improve the axi clock usage
Currently, the enable of the axi clock return status is ignored, causing
issues when the enable fails then we try to disable it. Therefore, it is
better to check the return status and disable it only when enable
succeeded.
Also, remove the helper functions around clk_axi, since we can directly
use the clk API function for enable/disable the clock. Those functions
are already checking for NULL clk and returning 0 if that's the case.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:59:03 +08:00
cfe8597341 drm/mxsfb: Update mxsfb to support LCD reset
The eLCDIF controller has control pin for the external LCD reset pin.
Add support for it and assert this pin in enable and de-assert it in
disable.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:59:02 +08:00
1d0b3c97e5 dt-bindings: display: Add max-memory-bandwidth property for mxsfb
Add new optional property 'max-memory-bandwidth', to limit the maximum
bandwidth used by the MXSFB_DRM driver.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Rob Herring <robh@kernel.org>
2019-11-25 15:59:02 +08:00
7bfb905f8e drm/mxsfb: Add max-memory-bandwidth property for MXSFB
Because of stability issues, we may want to limit the maximum bandwidth
required by the MXSFB (eLCDIF) driver.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:59:01 +08:00
1dbb0cdb20 drm/mxsfb: Signal mode changed when bpp changed
Add mxsfb_atomic_helper_check to signal mode changed when bpp changed.
This will trigger the execution of disable/enable on
a modeset with different bpp than the current one.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:59:01 +08:00
d44845c848 drm/mxsfb: Update mxsfb with additional pixel formats
Since version 4 of eLCDIF, there are some registers that can do
transformations on the input data, like re-arranging the pixel
components. By doing that, we can support more pixel formats.
This patch adds support for X/ABGR and RGBX/A. Although, the local alpha
is not supported by eLCDIF, the alpha pixel formats were added to the
supported pixel formats but it will be ignored. This was necessary since
there are systems (like Android) that requires such pixel formats.

Also, add support for the following pixel formats:
            16 bpp: RG16 ,BG16, XR15, XB15, AR15, AB15

Set the bus format based on input from the user and panel
capabilities.
Save the bus format in crtc->mode.private_flags, so the bridge can
use it.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:59:00 +08:00
bc98fb9ceb drm/mxsfb: Update register definitions using bit manipulation defines
Use BIT(x) and GEN_MASK(h, l) for better representation the inside of
various registers.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:58:59 +08:00
fbb37b1907 drm/mxsfb: Reset vital registers for a proper initialization
Some of the registers, like LCDC_CTRL, CTRL2_OUTSTANDING_REQS and
CTRL1_RECOVERY_ON_UNDERFLOW needs to be properly cleared/initialized
for a better start and stop routine.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:58:59 +08:00
2242682d70 drm/mxsfb: Add defines for the rest of registers
Some of the existing registers in this controller are not defined, but
also not used. Add them to the register definitions, so that they can be
easily used in future improvements or fixes.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:58:58 +08:00
873e3b8dfd drm/mxsfb: Read bus flags from bridge if present
The bridge might have special requirmentes on the input bus. This
is e.g. used by the imx-nwl bridge.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Stefan Agner <stefan@agner.ch>
2019-11-25 15:58:58 +08:00
c16e4a933f drm/mxsfb: Update mxsfb to support a bridge
Currently, the MXSFB DRM driver only supports a panel. But, its output
display signal can also be redirected to another encoder, like a DSI
controller. In this case, that DSI controller may act like a drm_bridge.
In order support this use-case too, this patch adds support for drm_bridge
in mxsfb.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Tested-by: Guido Günther <agx@sigxcpu.org>
2019-11-25 15:58:57 +08:00
42797d088c drm/imx: ldb: Add dual channel mode support for i.MX8QXP
i.MX8QXP uses two LDBs(one primary, one auxiliary) to support
dual channel mode.  This patch adds the dual channel mode support
for i.MX8QXP.  Note that the drivers contain specific sequence
needed by this mode - LDB VSYNC polarity and channel selection settings
should be configured into the register a bit earlier in ->atomic_mode_set
instead of in ->enable, and DC subsystem pixel link enablement is moved
from the DPU driver to the LDB driver to make sure it happens later
than LDB clocks enablement in ->enable.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:55 +08:00
92ec3526fc dt-bindings: display: imx: ldb: Add i.MX8qxp LDB dual channel mode documentation
i.MX8qxp LDB dual channel mode uses two LDB channels from two LDB
instances, while all other LDB variants in other SoCs use two LDB
channels from one LDB instance.  This patch adds documentation
for the special case of i.MX8qxp LDB dual channel mode.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:54 +08:00
0f33257959 dt-bindings: display: imx: ldb: Correct pixel and bypass clock description
Not only i.MX8qm LDB requires pixel and bypass clocks, but also
i.MX8qxp LDB does.  This patch corrects pixel and bypass clock
description by explicitly saying that i.MX8qxp LDB requires
the clocks.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:53 +08:00
8a75807a3a drm/imx: ldb: Add system power management support
This patch adds system power management support for imx-ldb drm driver
by proper PHY exit/init handling and pixel link re-initialization in
the resume operation.  The driver depends on the imx-drm core driver
to handle ldb bridge power management operations.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:49 +08:00
d79348c30f MLK-21876-23 drm/imx: ldb: fix incorrect color displayed for mx8qxp
The changed was introduced by Liu Ying from 4.19 kernel.
But we observed it caused the latest kernel color display is wrong.
So revert to the original version which worked before.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:58:49 +08:00
654926dceb drm/imx: ldb: Add i.MX8qxp LDB support
This patch adds i.MX8qxp LDB support.
Logics are added to make i.MX8qxp LDB cope with Mixel LVDS combo PHY.
Also, logics are added to handle pixel link quirks for i.MX8qxp LDB.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:48 +08:00
15409f90e6 dt-bindings: display: imx: ldb: Add i.MXqxp LDB compatible string and properties
This patch adds device tree binding support for i.MXqxp LDB,
including compatible string and additional properties.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:48 +08:00
2e9d9adb1c drm/imx: ldb: Add i.MX8qm LDB support
This patch adds i.MX8qm LDB support.
Logics are added to make i.MX8qm LDB cope with Mixel LVDS PHY.
Also, logics are added to handle pixel link padding quirks for i.MX8qm LDB.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix headfile include conflict during upgrade ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:58:47 +08:00
0e81504511 dt-bindings: display: imx: ldb: Add i.MXqm LDB compatible string and properties
This patch adds device tree binding support for i.MXqm LDB,
including compatible string and additional properties.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:47 +08:00
427c82c5fa gpu: Move ipu-v3 to imx folder
The new imx folder may contain ipu-v3 and dpu common drivers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix source path ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:58:46 +08:00
a17cb2216a drm/imx: Revert a patch which merges imx-drm-core and ipuv3-crtc in one module
DPU CRTC found in i.MX8qm/qxp SoCs can be hooked into imx-drm.
Thus, move ipuv3-crtc out of imx-drm-core.

Revert "drm/imx: merge imx-drm-core and ipuv3-crtc in one module"

This reverts commit 3d1df96ad4.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:58:45 +08:00
615237a7b7 gpu: imx: Add imx8 pixel combiner support
This patch adds i.MX8 pixel combiner driver support.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:43 +08:00
e5b7df5e23 gpu: Move ipu-v3 to imx folder
The new imx folder may contain ipu-v3 and dpu common drivers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix source path ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:58:42 +08:00
052e169f8b drm/imx: Revert a patch which merges imx-drm-core and ipuv3-crtc in one module
DPU CRTC found in i.MX8qm/qxp SoCs can be hooked into imx-drm.
Thus, move ipuv3-crtc out of imx-drm-core.

Revert "drm/imx: merge imx-drm-core and ipuv3-crtc in one module"

This reverts commit 3d1df96ad4.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:58:42 +08:00
97a558deb1 MLK-21378-2 gpu: imx: Add imx8_dprc support
Fast-forward imx8_dprc driver from imx_4.14.y.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Liu Ying: scfw call updates and other small tweaks for upgrade]
2019-11-25 15:58:39 +08:00
7724e0e059 MLK-21378-1 gpu: imx: Add imx8_prg support
Fast-forward imx8_prg driver from imx_4.14.y.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:38 +08:00
12a79131ea gpu: Move ipu-v3 to imx folder
The new imx folder may contain ipu-v3 and dpu common drivers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix source path ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:58:38 +08:00
aadb30a383 drm/imx: Revert a patch which merges imx-drm-core and ipuv3-crtc in one module
DPU CRTC found in i.MX8qm/qxp SoCs can be hooked into imx-drm.
Thus, move ipuv3-crtc out of imx-drm-core.

Revert "drm/imx: merge imx-drm-core and ipuv3-crtc in one module"

This reverts commit 3d1df96ad4.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:58:38 +08:00
072e3bcb7b gpu: imx: dpu: common: Initialize SCU misc settings in dpu_resume()
To make sure SCU misc settings are in valid status at system resume
stage, let's initialize them in dpu_resume().

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:36 +08:00
9e023db2ce LF-73 gpu: imx: dpu: sc misc: Initialze KACHUNK_CNT as needed by blit engine
The KACHUNK_CNT SCU misc setting is for DPU blit engine's prefetch engine.
It represents how many cycles are needed to trigger prefetch engine after
DPU shadow being loaded.  Set it to be 32, which is recommended and tested.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:35 +08:00
7cb714ff4b gpu: imx: dpu: sc misc: Rename dpu_pxlink_init() to dpu_sc_misc_init()
The SCU misc settings of DC subsystem contain pixel link settings
and other settings, like DC sync mode and KACHUNK_CNT.  So, it would
be better to rename dpu_pxlink_init() to dpu_sc_misc_init(), which
includes initialization code for all SCU misc settings of DC subsystem.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:34 +08:00
9b76f38f10 gpu: imx: dpu: sc misc: Rename dpu_sc_misc_init() to dpu_sc_misc_get_handle()
The function dpu_sc_misc_init() actually gets the SCU handle only.
So, renaming it to dpu_sc_misc_get_handle() better reflects what it does.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:33 +08:00
8c154b03a5 gpu: imx: framegen: Don't enable/disable pixlnk when driving special encoder
The LVDS encoder driver for i.MX8qxp SoC needs to enable/disable pixel link
in order to meet some sequence requirements, otherwise, display artifacts
will be seen on LVDS display.  This patch avoids to enable/disable pixel
link in the FrameGen driver for this special encoder.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:33 +08:00
212aa6d7e4 gpu: imx: dpu: common: Add flag has_dual_ldb in struct dpu_data
i.MX8qxp LDB dual channel mode uses two LDB channels from two LDB
instances, while i.MX8qm LDB uses two LDB channels from one LDB
instance.  So, this patch adds flag has_dual_ldb in struct dpu_data
so that it can be used to tell the difference.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:32 +08:00
334bbd5df8 gpu: imx: dpu: framegen: Cache encoder_type in struct dpu_framegen
This patch caches encoder_type in struct dpu_framegen when we
call framegen_cfg_videomode().  This cached type can be used
later when determining whether to enable pixel link in the
FrameGen driver or not.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:32 +08:00
0b9e3fb177 gpu: imx: dpu: disengcfg: Do HW initialization in dpu_dec_init()
This patch does DisEngCFG initialization in dpu_dec_init()
by calling _dpu_dec_init() in it.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:31 +08:00
77a77f3723 drm/imx: dpu: plane: Add color properties support
As DPU fetchunits support ITU601(limited range)/ITU601_FR(full range)
and ITU709(limited range) YUV to RGB color space conversions, we may
add color encoding and color range properties support for planes.
Considering software backward compatibility, the default color encoding
is set to ITU601 with full color range.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:31 +08:00
68e0ff911a drm/imx: dpu: plane: Support multiple pixel blend modes
This patch adds mulitple pixel blend modes for DPU plane.
The modes are "None", "Pre-multiplied" and "Coverage".

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:31 +08:00
b85579f653 drm/imx: dpu: plane: Support alpha in pixel for overlay planes
Now that we've already got proper default blend mode support,
we may introduce alpha in pixel feature for overlay planes.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:30 +08:00
4c2a16383b drm/imx: dpu: plane: Support full zpos range for planes
DPU has no limitations on the plane's zpos, so we don't
have to limit the primary plane zpos to be zero and the
overlay plane zpos to be non-zero.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:29 +08:00
32ceb4b92f drm/imx: dpu: plane: Improve bailout path of dpu_plane_create()
This patch improves bailout path of dpu_plane_create().
As we'll add more drm properties to the planes later,
this would simply the code.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:29 +08:00
8d0c853756 drm/imx: dpu: kms: Support proper default blend mode
Without the new blend modes("None", "Pre-multiplied" and "Coverage")
introduced in the below commit, the old userspace assumes alpha in
pixel is per-premultiplied by default.  So, let's support the default
blend mode properly.

commit a5ec8332d4 ("drm: Add per-plane pixel blend mode property")

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:29 +08:00
a321801f16 drm/imx: dpu: kms: Add pixel combiner support
This patch adds pixel combiner support in the DPU KMS driver.
Pretty much logics are implemented to allocate/organize the
CRTC resources(extdst, framegen, tcon, pixel combiner, etc)
and plane resources(extdst, fetchunit, layerblend, etc) which
are needed to drive a high pixel rate display via pixel combiner.
Additional logics are implemented to support sync up mode fixup
found in the new version of DPU IP.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:28 +08:00
1a04cd435d gpu: imx: dpu: extdst: Add extdst_pixengcfg_syncmode_master() helper
This patch adds extdst_pixengcfg_syncmode_master() helper support
so that the callers may control if a extdst is master or slave
when it works in sync mode.  The bit16 of extdst's PIXENGCFG_STATIC
register controls this and it's a part of sync mode fixup logic.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:28 +08:00
5705389c71 gpu: imx: dpu: framegen: Add framegen_syncmode_fixup() helper
Bit7 of framegen's SECSTATCONFIG register is used to control
the sync mode fixup logic implemented in framegen.  This patch
adds framegen_syncmode_fixup() helper so that the callers
may enable/disable the fixup logic for a framegen.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:27 +08:00
40b282a223 gpu: imx: dpu: common: Provide store9 to client pdev via pdata
Store9 unit can be shared bewteen display engine(for sync mode fixup)
and blit engine.  It's proper to get the store resource in the DPU
common driver and then provide it to client platform device via
platform data.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:26 +08:00
c735596b06 gpu: imx: dpu: common: Add store9 support for sync mode fixup
Bit16 of store9's PIXENGCFG_STATIC register is used to control
the sync mode fixup logic implemented in store9.  So, let's
add store9 support in the DPU core driver and export a function
for users to enable/disable the fixup logic.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:26 +08:00
3ecace4942 gpu: imx: dpu: common: Set master stream id to be 1 for i.MX8QM DPU
This patch sets master stream id to be 1 for i.MX8QM DPU.
The master stream id is used when FrameGen works in sync mode.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:25 +08:00
a1ab21d2fc gpu: imx: dpu: Add pixel combiner support
This patch adds pixel combiner support in the DPU core driver.
Users may get and enable/disable/control a pixel combiner instant
via tcon functions and may tell if it is needed in a specific usecase
via the dpu_get_syncmode_min_prate() and dpu_get_singlemode_max_width()
helpers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:23 +08:00
15952eb997 drm/imx: dpu: crtc: Peek auxiliary CRTC resources
Cache the auxiliary CRTC resources in struct dpu_crtc via the
dpu_aux_{unit}_peek() helpers so that the DPU CRTC driver may
use them later.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:22 +08:00
6aabfb9104 drm/imx: dpu: crtc: Set crtc group id
The DPU CRTC device driver may get the CRTC group id from
the pdata of the device.  Let's cache it in struct dpu_crtc
so that the driver may use it later.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:21 +08:00
3849ba0a44 gpu: imx: tcon: Add side-by-side support
This patch adds side-by-side support for tcon so that
two tcons can participate in the dual display streams
to work with pixel combiner to drive a high pixel rate
display.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:21 +08:00
f98fa2a052 gpu: imx: dpu: framegen: Add side-by-side support
This patch adds side-by-side support for framegen so that
two framegens can work in sync mode to participate in the
dual display streams to drive a high pixel rate display
via a pixel combiner.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:21 +08:00
4436810703 gpu: imx: dpu: sc misc: Add helper dpu_pxlink_set_dc_sync_mode() support
This patch adds helper dpu_pxlink_set_dc_sync_mode() support
so that callers may enable or disable DC sync mode.
In DC sync mode, high pixel rate video mode can be supported
by combining two display streams together.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:20 +08:00
069fb8f384 gpu: imx: dpu: tcon: Add tcon_is_master/slave() helpers support
This patch adds tcon_is_master/slave() helpers support so that
callers may know if a tcon is a master or slave tcon.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:20 +08:00
698aeb479b gpu: imx: dpu: extdst: Add extdst_is_master() helper support
This patch adds extdst_is_master() helper support so that
callers may know if a extdst is a master extdst or not.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:19 +08:00
3baeefbcae gpu: imx: dpu: framegen: Add framegen_is_master/slave() helper support
This patch adds framegen_is_master/slave() helpers support so that
callers may know if a framegen is a master or slave framegen.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:19 +08:00
83ca944de6 gpu: imx: dpu: common: Add helper dpu_get_master_stream_id() support
This patch adds helper dpu_get_master_stream_id() support
so that callers may know the master stream when FrameGen
works in sync mode.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:18 +08:00
ad25687906 gpu: imx: dpu: common: Introduce master_stream_id in struct dpu_data
This patch introduces master_stream_id flag in struct dpu_data
so that master stream can be chosen when FrameGen works in sync mode.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:18 +08:00
53c5342fbc gpu: imx: dpu: common: Add di_grp_id in display client pdev's data
This patch adds a new di_grp_id entry in display client pdev's data
so that the relevant display platform driver may know the display
group ID of the display device.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:17 +08:00
ee63aa8251 gpu: imx: dpu: Add helpers to peek at auxiliary display submodules
This patch adds dpu_aux_{unit}_peek() helpers so that callers
may peek at auxiliary display submodules.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:14 +08:00
61584d69b2 dt-bindings: display: imx-drm: Add pixel combiner descriptions
Pixel combiner found in i.MX8 SoCs may combine two display
streams(one master and the other slave) to drive a high
pixel rate display.  This patch adds DT property descriptions
in imx-drm device tree documentation for pixel combiner.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:12 +08:00
ed071c82ec drm/imx: dpu: kms: Support full screen CRTC background
The CRTC background should be full screen instead of partial
screen, because the DRM core is likely to add configurable
background color support in the future.  We may cover the full
screen with ConstFrame0/1, upon which builds planes.  With this,
it is easier to compute each plane's layer offset vs CRTC start
point and all ConstFrame units can be controlled by CRTC.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:12 +08:00
95dea9fe25 drm/imx: dpu: crtc: Wait for FrameGen secondary syncup in ->atomic_enable()
Although the hardware spec doesn't mention the additional operation to
wait for FrameGen secondary syncup for FrameGen non-sync mode when we
enable a display, it doesn't hurt to do it and we may get warning message
in case it's not syncup.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:12 +08:00
afe3279dbb drm/imx: dpu: crtc: Warn on FrameGen sec chan empty FIFO read request
The DPU planes' fetch units are built upon the CRTC's FrameGen secondary
channel.  Empty FIFO read request from the channel is very likely caused
by insufficient AXI bandwidth for the fetch units, which makes display
underrun.  This patch warns users via dmesg on the empty FIFO read request.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:11 +08:00
75e35bcb99 gpu: imx: dpu: framegen: Add helpers to get/clear sec chan status
This patch adds two helpers to get and clear FrameGen secondary channel
status respectively.  Via the two helpers, users may know if there is
empty FIFO read request on this channel or not after getting the status.
And, if yes, users may choose to clear the status.  According to the IP
spec, the empty FIFO read request indicates that data stream from a Fetch
unit(e.g., AXI bandwidth not sufficient) fell down.  Assuming the display
driver sets things up properly, the falling down is very likely caused by
the insufficient AXI bandwidth, that is, display underrun.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:11 +08:00
491b250b63 drm/imx: dpu: crtc: Precisely send vbland event if CRTC is active
If CRTC is active, we should send vblank event in vblank
interrupt handler to make sure it's sent precisely.  This
patch caches the event to be sent at dpu_crtc->event in
the ->atomic_enable() and the ->atomic_flush() callbacks
and finally sends it out in dpu_vbl_irq_handler().  Since
we rely on the interrupt handler to send the event, we
call drm_crtc_vblank_get() to get a vblank refcount to
guarantee the interrupt is enabled when caching the event
in dpu_crtc_queue_state_event() and call drm_crtc_vblank_put()
to drop a vblank refcount in the interrupt handler.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:10 +08:00
8ccda946f5 drm/imx: dpu: crtc: Remove WARN_ON(!crtc->state->event)
The DRM atomic core ensures crtc->state->event is not NULL when
calling the ->atomic_disable() or the ->atomic_flush() callbacks.
So, let's remove the unnecessary NULL check warning on it.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:10 +08:00
228db22f2c drm/imx: dpu: crtc: Do not send out bogus vblank event in ->atomic_disable()
When a full modeset is needed, the CRTC could be totally disabled or
enabled/re-enabled after the modeset.  If it's re-enabled, a vblank
event would be sent during the CRTC enablement procedure.  So, a bogus
event should be killed in the ->atomic_disable() callback.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:09 +08:00
9b16689976 drm/imx: dpu: crtc: Send vblank event after drm_crtc_vblank_off() in ->atomic_disable()
The Kdoc for the event entry of struct drm_crtc_state mentions that the
simplest way to send vblank event when a CRTC is being disabled is that
calling drm_crtc_send_vblank_event() somewhen after drm_crtc_vblank_off()
has been called.  This patch takes the way mentioned above to send vblank
event in the ->atomic_disable() callback.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:08 +08:00
ce2f4cc484 drm/imx: dpu: kms: Ensure array idx k >= 0 before accessing sources[]
This patch checks array index 'k' in function
dpu_atomic_assign_plane_source_per_crtc() to make sure it's
no less than zero before using it to access array sources[].

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:08 +08:00
dceda67545 drm/imx: dpu: kms: Return properly in case we fail to get plane state to check
We should return properly in case we fail to get plane state to check.
For example, a race condition on the plane state would happen when one
thread does page flip and another thread updates CRTC properties on
that CRTC simultaneously.  '-EDEADLK' should be returned when the
condition occurs.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:07 +08:00
95438a662b drm/imx: dpu: kms: Add prefetch engine support
This patch adds prefetch engine support for DPU KMS.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:07 +08:00
c2dd2db4ef drm/imx: dpu: crtc: Evade the first dumb frame for DPR/PRG errata
To workaround the errata TKT320950, DPR/PRG need to evade the first dumb frame
which is generated by DPU.  The way we achieve that is to bypass TCON(but set
the TCON sync signals and KA_CHUCK strobe signal up) before enabling the DPU
display controller, and then 1) enable the display controller, 2) wait for the
frame index starting to move and 3) finally switch TCON to operation mode.
Steps 1) to 3) should be done within a frame, so we disable local irq and
preemption to make sure we don't relinquish CPU during the procedure.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:06 +08:00
accaed25e2 gpu: imx: dpu: Access regs in display engine units wo holding mutex
We don't need holding mutex when accessing registers in display engine
units, because KMS is the only relevant client driver and it has ww mutex
mechansim to ensure there is no race condition on the CRTC resources.
Also, we are naturally safe when the driver initializes the units at the
probe and system power management stages.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:06 +08:00
f53dd7a041 gpu: imx: dpu: fetchunit: Add DPR support
This patch adds DPR support for fetchunit in the DPU base driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:05 +08:00
35b8f4aa7c gpu: imx: dpu: fetchunit: Use TKT343664&TKT339017's fixups for ->set_src_stride()
This patch uses TKT343664&TKT339017's fixups for ->set_src_stride().

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:05 +08:00
8212c85a3c gpu: imx: dpu: fetchunit: Use TKT343664&TKT339017's fixups for ->set_baseaddress()
This patch uses TKT343664&TKT339017's fixups for ->set_baseaddress().

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:04 +08:00
acbd004cf4 gpu: imx: dpu: fetchunit: Use TKT343664's fixup for ->set_burstlength()
This patch uses TKT343664 burst size fixup for ->set_burstlength().

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:03 +08:00
2458abce7a gpu: imx: dpu: fetchunit: Add helper for TKT339017 to fixup stride
This patch adds helper fetchunit_stride_fixup_tkt339017() for
TKT339017 to fixup stride.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:02 +08:00
c33e9faa20 gpu: imx: dpu: fetchunit: Add helper for TKT343664 to fixup burst size
This patch adds helper fetchunit_burst_size_fixup_tkt343664() for
TKT343664 to fixup burst size.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:02 +08:00
3f00d5aa73 dt-bindings: display: fsl-imx-drm: Add DPR channel property to dpu binding doc
This patch adds DPR channel property to dpu binding doc.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:01 +08:00
ab29cdf8ae dt-bindings: display: fsl-imx-drm: Add i.MX8 DPR(Display Prefetch Resolve) support
The Display Prefetch Resolve(DPR) is a processor of fetching display data
before the display pipeline which needs data to drive pixels in the active
display region.  The data is transformed, or resolved from a variety of
tiled buffer formats into linear format.  The DPR transaction sequences are
issued with a high level of DRAM efficiency.  This patch adds device tree
binding doc support for i.MX8qm/qxp DPR.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:01 +08:00
b76ebc473b dt-bindings: display: fsl-imx-drm: Add i.MX8 PRG(Prefetch Resolve Gasket) support
The Pretch Resolve Gasket(PRG) is a digital core function as a gasket
interface between RTRAM controller and DPU.  The main function of PRG
is to convert the AXI interface to RTRAM interface and remapping the
ARADDR to a RTRAM address.  This patch adds device tree binding doc
support for i.MX8qm/qxp PRG.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:00 +08:00
a571b89dea MLK-15321-1 gpu: imx: dpu: Add dpu blit engine device
Implement Blt engine as DRM renderer.
Add dpu blit engine device. And as dpu bliteng has
no device tree node, so to set dpu's of_node as the
platform data for imx-drm component compare_of.

Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
Acked-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:58:00 +08:00
4d6bbfd527 gpu: imx: dpu: framegen: add disp_lpcg clock
Add disp_lpcg clock.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 15:57:58 +08:00
456946814c drm/imx: dpu: crtc: Specify encoder type for framegen_cfg_videomode()
This patch specifies encoder type for framegen_cfg_videomode()
so that framegen driver may program display clock tree properly
for different kinds of encoders.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:57:58 +08:00
568ed66cac gpu: imx: dpu: framegen: Use bypass clock when display encoder type is TMDS
This patch sets display clock's parent to bypass clock when display
encoder type is TMDS, otherwise, to pll clock when other types of
encoder.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:57:57 +08:00
72559a032d MLK-21876-10 gpu: drm: dpu: fix headfile reference issue (part 1)
../drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c:17:21: fatal error: imx-drm.h: No such file or directory
 #include "imx-drm.h"

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:56 +08:00
5437c5b6a0 MLK-21876-9 gpu: drm: dpu: fix build for next-20190524 upgrade
Due to below commit:
05c452c115 ("drm: Remove users of drm_format_num_planes")

../drivers/gpu/drm/imx/dpu/dpu-kms.c: In function ‘dpu_atomic_assign_plane_source_per_crtc’:
../drivers/gpu/drm/imx/dpu/dpu-kms.c:144:3: error: implicit declaration of function ‘drm_format_num_planes’ [-Werror=implicit-function-declaration]
   num_planes = drm_format_num_planes(fb->format->format);
   ^
../drivers/gpu/drm/imx/dpu/dpu-plane.c: In function ‘dpu_plane_atomic_check’:
../drivers/gpu/drm/imx/dpu/dpu-plane.c:313:2: error: implicit declaration of function ‘drm_format_num_planes’ [-Werror=implicit-function-declaration]
  if (drm_format_num_planes(fb->format->format) > 1) {

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:56 +08:00
8a7826c808 MLK-21876-8 gpu: drm: dpu: fix build for next-20190524 upgrade
Due to below commit:
f3e9632cb6 ("drm: Remove users of drm_format_(horz|vert)_chroma_subsampling")

../drivers/gpu/drm/imx/dpu/dpu-plane.c: In function ‘drm_plane_state_to_uvbaseaddr’:
../drivers/gpu/drm/imx/dpu/dpu-plane.c:164:2: error: implicit declaration of function ‘drm_format_horz_chroma_subsampling’ [-Werror=implicit-function-declaration]
  x /= drm_format_horz_chroma_subsampling(fb->format->format);
  ^
../drivers/gpu/drm/imx/dpu/dpu-plane.c:165:2: error: implicit declaration of function ‘drm_format_vert_chroma_subsampling’ [-Werror=implicit-function-declaration]
  y /= drm_format_vert_chroma_subsampling(fb->format->format);
  ^

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:55 +08:00
99aa856532 MLK-21876-7 gpu: drm: dpu: fix build for next-20190524 upgrade
../drivers/gpu/drm/imx/dpu/dpu-kms.c:23:21: fatal error: imx-drm.h: No such file or directory
 #include "imx-drm.h"

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:55 +08:00
38b2801e27 MLK-21876-6 gpu: drm: dpu: fix build for next-20190524 upgrade
Due to below commit:
b0f986b4b0 ("drm: Remove users of drm_format_info_plane_cpp")

../drivers/gpu/drm/imx/dpu/dpu-plane.c: In function ‘drm_plane_state_to_baseaddr’:
../drivers/gpu/drm/imx/dpu/dpu-plane.c:150:9: error: implicit declaration of function ‘drm_format_plane_cpp’ [-Werror=implicit-function-declaration]
         drm_format_plane_cpp(fb->format->format, 0) * x;

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:54 +08:00
a97e8d0336 MLK-21876-5 gpu: drm: dpu: fix build for next-20190524 upgrade
In file included from ../drivers/gpu/drm/imx/dpu/dpu-crtc.h:19:0,
                 from ../drivers/gpu/drm/imx/dpu/dpu-crtc.c:29:
../drivers/gpu/drm/imx/dpu/dpu-plane.h:19:21: fatal error: imx-drm.h: No such file or directory
 #include "imx-drm.h"
                     ^
compilation terminated.
../scripts/Makefile.build:278: recipe for target 'drivers/gpu/drm/imx/dpu/dpu-crtc.o' failed
make[6]: *** [drivers/gpu/drm/imx/dpu/dpu-crtc.o] Error 1
../scripts/Makefile.build:489: recipe for target 'drivers/gpu/drm/imx/dpu' failed
make[5]: *** [drivers/gpu/drm/imx/dpu] Error 2

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:52 +08:00
0fc89b1e13 drm/imx: Add DPU KMS support (part 1)
This patch adds i.MX DPU KMS support.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix headfile include conflicts ]
[ Aisheng: Kconfig & Makefile update for a clean base ]
[ Aisheng: Split imx drm core changes]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:52 +08:00
583c9de66e gpu: imx: Add dpu common driver support
The dpu is found in i.MX8qm/qxp SoCs.
It has a display controller and a blit engine to support graphics.
This patch adds dpu common driver support.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:57:52 +08:00
e271b534e6 dt-bindings: fsl-imx-drm: Add DT binding for the Display Processing Unit
This patch adds device tree binding for the Display Processing Unit(DPU),
as found in i.MX8qxp SoC.

The DPU is comprised of two main components that include a blit engine
for 2D graphics accelertations and a display controller for display
output processing, as well as a command sequencer.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:57:51 +08:00
57c73dc743 imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:57:51 +08:00
2a3e3aa8d8 gpu: Move ipu-v3 to imx folder
The new imx folder may contain ipu-v3 and dpu common drivers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix source path ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:51 +08:00
b387d26faa drm/imx: Revert a patch which merges imx-drm-core and ipuv3-crtc in one module
DPU CRTC found in i.MX8qm/qxp SoCs can be hooked into imx-drm.
Thus, move ipuv3-crtc out of imx-drm-core.

Revert "drm/imx: merge imx-drm-core and ipuv3-crtc in one module"

This reverts commit 3d1df96ad4.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:50 +08:00
836d2932da MLK-18535-6 drm/imx: core: add LCDIF support
Allows the LCDIF to be one of the supported client
components. And set the 'legacyfb_depth' of LCDIF
to be 32.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:57:47 +08:00
a1b12d1d40 MLK-22171 drm/imx: Avoid leaking dangling pointer dev->driver_data to PM ops
In case ->bind() fails, we should avoid leaking dangling pointer
dev->driver_data which is set by dev_set_drvdata(), otherwise
it would be leaked, and seen/dereferenced by PM ops, thus hang
happens.  Moving dev_set_drvdata() down just before ->bind()
successfully returns may address this issue.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:57:47 +08:00
344185de9b drm/imx: Add DPU KMS support (part 2)
This patch adds i.MX DPU KMS support.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:46 +08:00
4fde6828f1 drm/imx: Extract IPUv3 specific KMS functions to ipuv3-kms.c (part 1)
Since we want to add i.MX DPU support into imx-drm, the imx-drm core
driver should be no more IPUv3 specific.  Let's make imx-drm more generic
and extract IPUv3 specific KMS functions to ipuv3-kms.c.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: update to new kernel version accordingly ]
[ Aisheng: split IPU changes out of imx-drm-core change ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:46 +08:00
d058287ec9 gpu: Move ipu-v3 to imx folder
The new imx folder may contain ipu-v3 and dpu common drivers.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix source path ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:45 +08:00
51b6936711 drm/imx: Revert a patch which merges imx-drm-core and ipuv3-crtc in one module
DPU CRTC found in i.MX8qm/qxp SoCs can be hooked into imx-drm.
Thus, move ipuv3-crtc out of imx-drm-core.

Revert "drm/imx: merge imx-drm-core and ipuv3-crtc in one module"

This reverts commit 3d1df96ad4.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: fix conflicts ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:45 +08:00
c779d1746c drm/fourcc: add a 10bits fully packed variant of NV12
This pixel format is a fully packed and 10bits variant of NV12.
A luma pixel would take 10bits in memory, without any
filled bits between pixels in a stride.

Signed-off-by: Randy Li <ayaka@soulik.info>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 15:57:42 +08:00
a5686e011e drm/fourcc: add modifier for vivante compressed tiled layout
Add a new fb modifier for Vivante compressed and tiled
pixle layout which can be decompressed by DEC400D module
in DCSS.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
2019-11-25 15:57:42 +08:00
bc23ab6cb3 MLK-17368-1 drm: add fourcc codes for Verisilicon tiled formats
These formats will be used by VPU and DCSS.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
[ Aisheng : VENDOR_VSI changed to 0xf1 ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:42 +08:00
36b8a992d5 MLK-16290 drm: Add drm_of_component_probe_with_match() helper
A component master may have both OF based and non-OF based components to be
bound with.  This patch adds a helper drm_of_component_probe_with_match()
similar to drm_of_component_probe() so that the new helper may get an
additional provided match pointer(contains match entries for non-OF based
components) to support this case.

Tested-by: Meng Mingming <mingming.meng@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit c3cad72234)
2019-11-25 15:57:41 +08:00
9b995437fe MLK-15110-1 drm/fourcc: Add Amphion tiled layout format modifier
Amphion VPU has a tiled layout using 8x128 pixel vertical strips,
where each strip contains 1x16 groups of 8x8 pixels in a row-major layout.

Signed-off-by: Song Bing <bing.song@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng : AMPHION changed to 0xf1 ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:57:41 +08:00
31e8de9f0a media: bus format: Add RGB101010_1X7X5_SPWG/JEIDA support
This patch adds 30bit RGB101010 LVDS pixel formats support for
the SPWG and JEIDA LVDS mapping standards.  Each pixel is transferred
on 5 lanes with 7bit respectively.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:57:40 +08:00
e862d7a257 media: bus format: Add RGB666_1X30_PADLO support
This patch adds 30bit RGB666 with low padding support.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:57:39 +08:00
d82e1848fe media: bus format: Add RGB888_1X30_PADLO support
This patch adds 30bit RGB888 with low padding support.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:57:39 +08:00
4870c2e1a3 MLK-22099 usb: host: xhci: do warm reset for link state rxdect
As some USB3 port will lose link state while system sleep, then
the link state will be at rxdect after resume, we need a warm
reset to bring it back, so add the rxdect condition for CAS
missing.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:35 +08:00
5a12e7f1ee MLK-16604-1 usb: host: xhci-plat: add XHCI_MISSING_CAS quirk
i.MX8MQ USB3 host needs XHCI_MISSING_CAS quirk to warm reset the port to
enum the USB3 device plugged in while system sleep, as the port state is
stuck in polling mode after resume.

Signed-off-by: Li Jun <jun.li@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 9f1f431677)
2019-11-25 15:57:35 +08:00
d424cf6f8f MLK-16604-3 dt-bindings: usb: xhci: add usb3-resume-missing-cas property
There is already one quirk for usb3 xhci flag XHCI_MISSING_CAS, for
those platform with OF we can use usb3-resume-missing-cas to enable
this quirk to work around usb3 resume from system sleep.

Signed-off-by: Li Jun <jun.li@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit ba58ff8d3a)
2019-11-25 15:57:34 +08:00
d984b04bc4 MLK-9829 usb: core: print suggested message if failed to get device descriptor
This is required for USB OTG and EH compliance test 6.7.22(A-UUT “Device No
Response” for connection timeout). When the connected usb device(PET) does
not response to transactions, host will fail to get device descriptor.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 86d0bd661ecbbdf97dd9a8ddbaf0d3811de7f39e)
(cherry picked from commit 858af83637291d2ececfc7b2b4b17e3a371b53f3)
2019-11-25 15:57:32 +08:00
5f0ebd9dfc MLK-18794-1 usb: host: xhci: add .bus_suspend override
Some platforms (eg: Cadence USB3) have special requirements to add
platform USB register setting between xhci_bus_suspend and
platform USB controller suspend routine. Eg, The Cadence USB3 needs
RX detect clock switch from 24Mhz to 32Khz within 100ms after set
port to U3, but sometimes, for USB3 HUB connection, the USB2
bus suspend will cost more than 100ms, and introduce the disconnection
before the PHY enters low power mode, then the state is in mess from
controller side.

So in this commit, we introduce .bus_suspend for xhci_driver_overrides
for above use cases.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit f6baa57913)
2019-11-25 15:57:31 +08:00
1e64a7da32 MLK-19153-2 usb: host: xhci: do not return error status for URB
Current XHCI implementation does not consider completion interrupt
for SETUP packet standalone, so it will show warning message
and return error status for URB. In fact, it can support it. In
this commit, we change warning message as debug message and set
status as zero for URB.

Support completion interrupt for SETUP packet is needed for USB EH2.0
SINGLE_STEP_SET_FEATURE Test.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 78b212e8c2)
2019-11-25 15:57:31 +08:00
cfaf1a54fd MLK-16735 usb: host: add XHCI_CDNS_HOST flag
The NXP Cadence XHCI host has the same issue with Intel's,
it is triggered by reboot test, the test case is described
at this jira ticket.

BuildInfo:
- SCFW 8dcff26, IMX-MKIMAGE ea027c4b, ATF
- U-Boot 2017.03-imx_v2017.03_4.9.51_imx8_beta1+g6dc7b0f

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 5e35313293)
2019-11-25 15:57:31 +08:00
fd48765e9f MLK-17380-4 usb: host: xhci: add EH SINGLE_STEP_SET_FEATURE Test for USB2
This function is similar with EHCI's, but implemented using XHCI.
The USB2 host needs to send SETUP packet first, then wait 15
seconds before DATA (IN) + STATUS stage.

It is needed at USB Certification test for Embedded Host 2.0, and
the detail is at CH6.4.1.1 of On-The-Go and Embedded Host Supplement
to the USB Revision 2.0 Specification

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 8d46e3bca5)
2019-11-25 15:57:30 +08:00
a5395cb29e MLK-17380-3 usb: move EH SINGLE_STEP_SET_FEATURE implement to core
Since other USB 2.0 host may need it, like USB2 for XHCI. We move
this design to HCD core.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 035a27e1a3)
2019-11-25 15:57:29 +08:00
ddd2d65ea5 MLK-9785-1 usb: host: ehci-hcd: enable park mode
Enable park mode will improve the performance a lot at USB ethernet use
case, but a little at USB mass storage use case, and it is not harm from
the tests. Below the performance comparison at imx6sl:

USB Ethernet (Mbps)
	Default			Enable Park
TX	192			262
RX	262			290

USB Mass Storage (MB/s)
Read	21.8			22.9
Write	19.5			22.8

This patch is used for freescale internal.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit b2289a78958859cff37508e4db0314463f33c2e0)
(cherry picked from commit 233f37db41)
2019-11-25 15:57:29 +08:00
5593f1e17f MLK-11340-40 usb: whitelist: update otg & eh's TPL for fsl i.mx
The default TPL is for USB OTG & EH compliance test, the supported
class is: mass storage, hub, and hid.

Besides, we add one match criterion that matching targeted device
through class at interface descriptor.

Tested-by: Li Jun <b47624@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 483c071d989ceb36cacf76e1e3e779c67e5b8280)
(cherry picked from commit defcf3883f)
2019-11-25 15:57:28 +08:00
83e2195664 Doc: ABI: add usb charger uevent
When the USB charger is inserted or removed, the users could get
USB charger state and type through the uevent.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:26 +08:00
9ff5b5eacd usb: phy: show USB charger type for user
Current USB charger framework only shows charger state for user, but the
user may also need charger type for further use, add support for it.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:26 +08:00
f3791970f8 MLK-19850-1 usb: phy: mxs: add DCD implementation
The DCD is a hardware IP in USB PHY which is used for USB charger
detection, we use polling method for charger detection in this
design to avoid unknown USB PHY interrupt. Currently, the
imx8qm, imx8qxp and imx7ulp have DCD module.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:25 +08:00
5840b174e8 MLK-16576 usb: phy: mxs: set hold_ring_off for USB2 PLL power up
USB2 PLL use ring VCO, when the PLL power up, the ring VCO’s supply also
ramp up. There is a possibility that the ring VCO start oscillation at
multi nodes in this phase, especially for VCO which has many stages, then
the multiwave will kept until PLL power down. Hold_ring_off(bit11) can
force the VCO in one determined state when VCO supply start ramp up, to
avoid this multiwave issue. Per IC design's suggestion it's better this
bit can be off from 25us after pll power up to 25us before USB TX/RX.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit a094377f04c9ed2c8e702ee7bfab843caa03eb96)
2019-11-25 15:57:25 +08:00
a01c80c32a MLK-14947-2 usb: phy: add mxs phy driver dependency for ARM64
Add mxs phy driver dependency on ARCH_MXC_ARM64.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:25 +08:00
b8f509e1fc MLK-14285-3 usb: phy: mxs: optimize disconnect line condition
We only have below cases to disconnect line when suspend:
1. Device mode without connection to any host/charger(no vbus).
2. Device mode connect to a charger(w/ vbus), usb suspend when
   system is entering suspend.
This patch can fix usb phy wrongly does disconnect line in case
some usb host enters suspend but vbus is off.

Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 2af48913f77cec3658f5863b13f63619d8101279)
2019-11-25 15:57:24 +08:00
f72c32985f MLK-14285-1 usb: phy: add usb mode for usb_phy
USB phy driver may need to know the current working mode of
the controller, and does some different settings according to
host mode or device mode.

Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 2286cb30feedd6f4a5cb82a0f0af5aa3a04ab698)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 15:57:23 +08:00
1747e6ecc7 MLK-13125 usb: phy: phy-mxs-usb: enable weak 1p1 regulator for imx6ul during suspend
For imx6ul PHY, when the system enters suspend, its 1p1 is off by default,
that may cause the PHY get inaccurate USB DP/DM value. If the USB wakeup
is enabled at this time, the unexpected wakeup may occur when the system
enters suspend.

In this patch, when the vbus is there, we enable weak 1p1 during the PHY
suspend API, in that case, the USB DP/DM will be accurate for USB PHY,
then unexpected usb wakeup will not be occurred, especially for the USB
charger is connected scenario. The user needs to enable PHY wakeup for
USB wakeup function using below setting.

echo enabled > /sys/devices/platform/soc/2000000.aips-bus/20c9000.usbphy
/power/wakeup

Cc: Shaojun Wang <shaojun.wang@nxp.com>
Cc: Anson Huang <anson.huang@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:23 +08:00
5bbaeb9792 MLK-13308-2 usb: phy: phy-mxs-usb: handle USB PHY event
For mxs PHY, if there is a vbus but the bus is not enumerated,
force the dp/dm as SE0 from the consider side. If not, there
is possible USB wakeup due to unstable dp/dm, since there is
possible no pull on dp/dm, eg, there is a USB charger on the
port. Note, the vbus event is only occurred at device mode,
and sent by udc driver.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:22 +08:00
245652b2e6 MLK-20158-3 usb: phy: mxs: add wakeup enable for imx7ulp
This wakeup setting can enable USB wakeup function even the
controller's power is lost, and both A7 and M4 are in VLLS mode.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:22 +08:00
28e487f5c6 MLK-10170 usb: phy: mxs: keep USBPHY2's clk always on
Per IC engineer request, we need to keep USBPHY2's clk always on,
in this way, the USBPHY2 (PLL7) power can be controlled by
hardware suspend signal totally. It is benefit of USB remote wakeup
case which needs the resume signal be sent out as soon as
possible (without software interfere).

It is intended to fix the issue which this ticket describes, the
reason for this issue is the host does not send resume in time.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 98888b352377f9ebaee03bedce8c239691f45262)
2019-11-25 15:57:21 +08:00
af486fb671 MLK-10196-4 usb: phy: mxs: Using regulator phy-3p0
It is one of PHY's power, and we need to enable it to keep signal
quality good, and pass eye diagram test.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 3a8670ee7ff698521369e8292bba7ef288a12335)
2019-11-25 15:57:20 +08:00
d03a83b7bb MLK-11340-27 usb: phy-mxs: Add implementation of nofity_suspend{resume}
Implementation of notify_suspend and notify_resume will be different
according to mxs_phy_data->flags.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit d1ce766d9aabdfb823131d38056ff67c94e7e20a)
2019-11-25 15:57:20 +08:00
9b9596c733 MLK-11340-26 usb: phy: add notify suspend and resume callback
They are used to notify PHY that the controller enters suspend
or finishes resume.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
2019-11-25 15:57:19 +08:00
581e242221 usb: typec: tcpci: add pm ops to disable irq
Add typec irq as system wakeup source, in case typec irq is not enabled
as system wakeup soruce by user, disable typec irq when suspend to avoid
the threaded irq handler will access some resource(i2c/rpmsg) which is
not ready in early resume phrase.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:17 +08:00
08612d66af MLK-16013-43 usb: typec: tcpm: add extcon support for data role switch
Some usb controller driver only can support legacy extcon to set
data roles, if it use typec connector, need change data role
according to typec states, so add extcon for tcpm to control
data role.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:16 +08:00
651f8d74dc MLK-16013-17 usb: typec: tcpm: set cc when attached
As the cc setting while drp toggling may not be the correct value
for attached state, which only means the start value in case of
tcpci, so update the cc setting when src/snk attached state.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:16 +08:00
e0d71896b1 MLK-22452-2 usb: typec: mux: add nxp cbtl04gp super speed mux compatible
NXP CBTL04GP043EXJ is a super speed mux chip controlled by
a single GPIO.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:15 +08:00
7b175a6899 MLK-22452-1 usb: typec: mux: add reset gpio for gpio switch
Some typec switch chip may need do reset before use it, so
add reset-gpios property.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:14 +08:00
6159086f25 MLK-21355 typec: tcpm: use freezable workqueue for event handling
While system suspend, the typec event handling required service
maybe is not available(suspended), so we need freeze those event
handling by using freezable workqueue, e.g while tcpm is handling
PD message but system suspend started.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:13 +08:00
688a708413 MLK-21641 usb: typec: tcpm: cancel delayed work when unregister tcpm
We may do tcpm port unregister in middle of tcpm state transitions,
if there are delayed works queued, we need cancel them before finish
the tcpm unregsiter.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:13 +08:00
08cef4ba53 MLK-22406 usb: typec: tcpm: support source only port with dual data
In case source only for power, but dual data role on USB, we
enable drp toggling for detect source(host), then keep it at
SNK_ATTACHED state, this is mainly for get orientation.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:13 +08:00
c38f325545 MLK-21478-24 usb: typec: tcpci: allow drp toggling for non-drp port
Some single power role port with dual data role, this kind of
port connects non-typec port for usb data will need tcpm to
work to get polarity for orientation change, so remove the drp
port condition for now.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:12 +08:00
b95ffb6589 usb: typec: add typec switch via GPIO control
This patch adds a simple typec switch driver which only needs
a GPIO to switch the super speed active channel according to
typec orientation.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:12 +08:00
f2a46c35b6 dt-bindings: usb: add documentation for typec switch via GPIO
Some typec super speed active channel switch can be controled via
a GPIO, this binding can be used to specify the switch node by
a GPIO and the remote endpoint of its consumre.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:11 +08:00
b30e41dc1e usb: dwc3: Add workaround for host mode VBUS glitch when boot
When DWC3 is set to host mode by programming register DWC3_GCTL, VBUS
(or its control signal) will be turned on immediately on related Root Hub
ports. Then, the VBUS is turned off for a little while(15us) when do xhci
reset (conducted by xhci driver) and back to normal finally, we can
observe a negative glitch of related signal happen.

This VBUS glitch might cause some USB devices enumeration fail if kernel
boot with them connected. Such as LS1012AFWRY/LS1043ARDB/LX2160AQDS
/LS1088ARDB with Kingston 16GB USB2.0/Kingston USB3.0/JetFlash Transcend
4GB USB2.0 drives. The fail cases include enumerated as full-speed device
or report wrong device descriptor, etc.

One SW workaround which can fix this is by programing all xhci PORTSC[PP]
to 0 to turn off VBUS immediately after setting host mode in DWC3 driver
(per signal measurement result, it will be too late to do it in
xhci-plat.c or xhci.c). Then, after xhci reset complete in xhci driver,
PORTSC[PP]s' value will back to 1 automatically and VBUS on at that time,
no glitch happen and normal enumeration process has no impact.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:08 +08:00
bca3c354c8 usb: dwc3: Add avoiding vbus glitch happen during xhci reset
When DWC3 is set to host mode by programming register DWC3_GCTL, VBUS
(or its control signal) will turn on immediately on related Root Hub
ports. Then the VBUS will be de-asserted for a little while during xhci
reset (conducted by xhci driver) for a little while and back to normal.

This VBUS glitch might cause some USB devices emuration fail if kernel
boot with them connected. One SW workaround which can fix this is to
program all PORTSC[PP] to 0 to turn off VBUS immediately after setting
host mode in DWC3 driver(per signal measurement result, it will be too
late to do it in xhci-plat.c or xhci.c).

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:07 +08:00
7241ae6d91 usb: dwc3: set fwnode for role switch
As the usb role switch use device connection which uses the fwnode
of dwc3 for match, so set the role switch fwnode to be the fwnode
of dwc3.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:07 +08:00
e3fca537df usb: dwc3: gadget: increase timeout value for send ep cmd
In case the USB3 PHY enters P3, then ep command may need a long
time to complete, per test of ep0out enable, the dwc3 trace time
stamp shows the time is more then 280us, so increase the timeout
loop count to be 2000, this has no side effect for HW which has
no this problem.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:06 +08:00
d9d7fda42a usb: dwc3: drd: add usb role switch class support for dual role swap
Register a usb_role_switch for dual role swap if the property
"usb-role-switch" is present.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:06 +08:00
457a20b8ce usb: dwc3: add otg properties update
During the USB certification CV9 test, if we report OTG descriptor
to test suite, it will require doing OTG test, but in fact, it does
not support OTG-compliance in dwc3 driver.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:06 +08:00
129be0aec4 usb: dwc3: use suspend clock from dt to set power down scale
Since the new dwc3 use bulk clks including the suspend clk, so we can
use it to calculate the power down scale value.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:57:05 +08:00
cd89490d42 usb: gadget: Correct NULL pointer checking in fsl gadget
Correct NULL pointer checking for endpoint descriptor
before it gets dereferenced

Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:03 +08:00
2b5f0851e5 usb: fsl: Remove unused variable
Remove unused variable td_complete

Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
Reviewed-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:57:03 +08:00
86e8efc80b MLK-22752-3 usb: chipidea: imx: pinctrl for HSIC is optional
For imx chipidea controllers, if they use mxs PHY, they need pinctrl
for HSIC. Otherwise, it doesn't need pinctrl and usbmisc control. Like
imx7d and imx8mm.

Reported-by: André Draszik <git@andred.net>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:59 +08:00
304618fb1d MLK-22752-2 usb: chipidea: imx: refine the error handling for hsic
- -EPROBE_DEFER is an error, but without need show error message
- If pinctrl is not existed, set pinctrl as NULL

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:59 +08:00
04ebf23cb1 MLK-22752-1 usb: chipidea: imx: change hsic power regulator as optional
Not every platform needs this regulator.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:58 +08:00
dc5f8b1958 MLK-21900-2 usb: chipidea: imx: turn off vbus comparator when suspend
As we use bvalid for vbus wakeup source, to save power when
suspend, turn off the vbus comparator for imx7d and imx8mm.

Below is this bit description from RM of iMX8MM
"VBUS Valid Comparator Enable:
 This signal controls the USB OTG PHY VBUS Valid comparator which
indicates whether the voltage on the USB_OTG*_VBUS pin is below
the VBUS Valid threshold. The VBUS Valid threshold is nominally
4.75V on this USB PHY. The VBUS Valid threshold can be adjusted
using the USBNC_OTGn_PHY_CFG1[OTGTUNE0] bit field. Status of the
VBUS Valid comparator, when it is enabled, is reported on the
USBNC_OTGn_PHY_STATUS[VBUS_VLD] bit.
When OTGDISABLE0 (USBNC_USB_OTGx_PHY_CFG2[10])is set to 1'b0 and
DRVVBUS0 is set to 1'b1, the Bandgap circuitry and VBUS Valid
comparator are powered, even in Suspend or Sleep mode.
DRVVBUS0 should be reset to 1'b0 when the internal VBUS Valid comparator
is not required, to reduce quiescent current in Suspend or Sleep mode.
 - 0 The VBUS Valid comparator is disabled
  - 1 The VBUS Valid comparator is enabled"

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:56:57 +08:00
29f824ce61 MLK-21900-1 usb: chipidea: imx: group usbmisc operations for PM
As there maybe more APIs of usbmisc for suspend and resume, group
them into imx_usbmisc_suspend/resume, no function change.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:56:57 +08:00
e9ccde105e MLK-22025-1 usb: chipidea: phy enter low power mode when host suspend
On some imx host, if USB PHY is active when bus suspended, host may
have problem on taking over resume signal of remote wakeup from usb
device, resolve this by making PHY enter low power mode right after
bus suspended.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:56:57 +08:00
cf4c986d39 MLK-20346 usb: chipidea: change power_lost workqueue as freezable
Like commit d144dfea8a ("usb: chipidea: otg: change workqueue
ci_otg as freezable"), the power_lost work item may try to remove
hcd if controller is powered off during the system suspend, and
the similar deadlock happens, see below dumps.

Meanwhile, with this change, we need to disable USB interrupt
during the work item runs (after driver resume has finished),
otherwise, USB transfer will be timeout (5s) due to USB interrupt
is disabled and IAA watchdog is still not ready at that time.

Workqueue: events ci_power_lost_work
Call trace:
[<ffff000008085c44>] __switch_to+0x8c/0xd0
[<ffff000008d7bbf4>] __schedule+0x19c/0x5d8
[<ffff000008d7c068>] schedule+0x38/0xa0
[<ffff000008d7f3b4>] schedule_timeout+0x19c/0x338
[<ffff000008d7cc10>] wait_for_common+0xa0/0x148
[<ffff000008d7cccc>] wait_for_completion+0x14/0x20
[<ffff0000080e6040>] flush_work+0xd8/0x1f0
[<ffff0000080e61f4>] flush_delayed_work+0x3c/0x48
[<ffff0000081ae1c8>] wb_shutdown+0x90/0xd0
[<ffff0000081ae688>] bdi_unregister+0x58/0x1c0
[<ffff000008413a60>] del_gendisk+0x218/0x228
[<ffff00000871683c>] sd_remove+0x64/0xc0
[<ffff0000086b6eec>] device_release_driver_internal+0x154/0x1f0
[<ffff0000086b6f9c>] device_release_driver+0x14/0x20
[<ffff0000086b5d40>] bus_remove_device+0xc8/0x108
[<ffff0000086b2a08>] device_del+0x1f8/0x300
[<ffff0000087049ec>] __scsi_remove_device+0xec/0x128
[<ffff000008702c70>] scsi_forget_host+0x70/0x78
[<ffff0000086f7ee8>] scsi_remove_host+0xa0/0x140
[<ffff0000088e0588>] usb_stor_disconnect+0x50/0xc0
[<ffff00000887eab8>] usb_unbind_interface+0x78/0x280
[<ffff0000086b6eec>] device_release_driver_internal+0x154/0x1f0
[<ffff0000086b6f9c>] device_release_driver+0x14/0x20
[<ffff0000086b5d40>] bus_remove_device+0xc8/0x108
[<ffff0000086b2a08>] device_del+0x1f8/0x300
[<ffff00000887c364>] usb_disable_device+0xa4/0x210
[<ffff000008872cfc>] usb_disconnect+0x7c/0x240
[<ffff000008872e40>] usb_disconnect+0x1c0/0x240
[<ffff000008878e10>] usb_remove_hcd+0xc0/0x1d8
[<ffff0000088e7bac>] host_stop+0x34/0x90
[<ffff0000088e4088>] ci_handle_id_switch+0x70/0x1d0
[<ffff0000088e3038>] ci_power_lost_work+0x90/0xa8
[<ffff0000080e7100>] process_one_work+0x1e0/0x340
[<ffff0000080e72b0>] worker_thread+0x50/0x458
[<ffff0000080ed32c>] kthread+0xfc/0x128
[<ffff000008084eb8>] ret_from_fork+0x10/0x18

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:56 +08:00
55276da7e4 MLK-20343 usb: chipidea: udc: using structure ci_hdrc device for runtime PM
At current code, it doesn't maintain ci->gadget.dev's runtime PM
status well. Eg, after system resume, call pm_runtime_put_sync for
ci->dev will cause ci->dev's runtime suspend is called if its
power.usage is 0 even the power.usage is 1 for its child ci->gadget.dev.
at that time. It causes the oops this ticket describes that visiting
clock without AHB clock.

To fix this issue, we use ci_hdrc device instead of ci->gadget.dev
for runtime PM APIs at udc driver, in the way, we handle runtime
PM APIs for single device structure.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:56 +08:00
a320ed8dd7 MLK-20158-1 usb: chipidea: ci_hdrc_imx: restore pinctrl
The pinctrl setting may lost during the system suspend
(eg, imx7ulp), we need to restore it after system resume.
Meanwhile, some platforms may need to set special pinctrl
for power comsumption.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:55 +08:00
b4b090d280 MLK-19850-5 usb: chipidea: imx: add imx7d USB charger detection
Since USB generic PHY doesn't have USB charger interface, we
implement imx7d (using USB generic PHY) USB charger detection
at usbmisc.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:55 +08:00
b90bd6962c MLK-19850-4 usb: chipidea: udc: using USB PHY charger framework for detection
Some platforms (eg, imx6/imx7ulp/imx8qm) which implements charger
detection at USB PHY driver can use framework directly. Other
platforms (eg, imx7d/imx845) which do not implement charger detection
at their USB PHY driver, just assign the charger detection results
for usb_phy structure.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:54 +08:00
ecac0beb56 MLK-19258-7 usb: chipidea: imx: add two picophy parameters tuning implementation
These two parameters are used to improve USB signal for board level,
in this commit, we read it from the dtb, and write to related register
during the initialization.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:53 +08:00
8f70f8f6b5 MLK-20045-1 usb: chipidea: usbmisc_imx: using different ops for imx7ulp
imx7ulp uses different USB PHY with imx7d (MXS PHY vs PICO PHY), so the
features are supported by non-core register are a little different.
For example, autoresume feature is supported by all controllers for
imx7ulp, but for imx7d, it is only supported by non-HSIC controller.

Besides, these two platforms use different HSIC controller, imx7ulp
needs software operation, but imx7d doesn't.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:53 +08:00
9a2bb23f01 MLK-16715-7 usb: chipidea: imx: add "ci-disable-lpm" quirk
Some chipidea hardware needs to disable low power mode for controller
due to IC issue or hardware issue, add one quirk for it.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:52 +08:00
1fbbc6bd15 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>
2019-11-25 15:56:52 +08:00
d6f08b0a29 MLK-20011-2 usb: chipidea: delete DP pullup for secondary charger detection
Since the DP pullup can be finished at glue layer, we can delete
it at common code, but we still need to keep DP pulldown operation
since the DP may have already pulled up before.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:56:52 +08:00
cebd6f46dd MLK-14396 usb: chipidea: add mutex for concurrent running
The ci_handle_id_switch is called at two places, at very rare situations,
it may be running at the same time. Eg, when the system is back from
the resume, the id event is occurred from extcon driver, as well as
power_lost work item is called due to the controller is poweroff at
the suspend.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:51 +08:00
28dcf702b0 MLK-14285-2 usb: chipidea: set mode for usb phy driver
After enters one specific role, notify usb phy driver.

Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit d3aa2a13f4e47bc7fae7f2eee1e86291d7513312)
2019-11-25 15:56:51 +08:00
21b67cda90 MLK-13851-1 usb: chipidea: otg: delete the workaround code
After commit 4967018428 ("usb: chipidea: otg: change workqueue
ci_otg as freezable"), we have fixed the bug that ID removed
wakeup (ID: 0->1) will lock up system resume, we delete the
workaround code in this commit.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:50 +08:00
62985ce5ff MLK-13638-6 usb: chipidea: add recovery from vbus is off during system suspend
When the vbus is off during the suspend controller is powered off, if we
do not want to see disconnection from USB core, we need to make sure the
device pulls DP up before USB core resume runs. However, several devices
are slow to pull DP up when see vbus (maybe it needs vbus to power up
system), so we need to wait connection at platform code.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:49 +08:00
8f3d6882f0 MLK-13570-8 usb: chpidea: usbmisc_imx: add non-burst setting for both imx7d and imx7ulp
For all imx Socs later than imx6 (including imx6), the USB_nSBUSCFG.AHBBRST
will be set as 0 at dtsi file, so the non-burst setting needs to be
set at non-core register, or there will be no burst for USB AHB/AXI
transfer.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:48 +08:00
ae54db9905 MLK-13308-1 usb: chipidea: udc: add USB PHY event
Add USB PHY event for below situation:
- vbus connect
- vbus disconnect
- gadget driver is enumerated

USB PHY driver can get the last event after above situation
occurs.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:48 +08:00
14bc08c6ab MLK-12421 usb: chipidea: fix build warning if disable CONFIG_USB_CHIPIDEA_HOST
Fix chipidea usb driver compile warning if CONFIG_USB_CHIPIDEA_HOST
is disabled:
In file included from drivers/usb/chipidea/otg.c:26:0:
drivers/usb/chipidea/host.h:23:13: warning: 'ci_hdrc_host_driver_init'
defined but not used [-Wunused-function]
 static void ci_hdrc_host_driver_init(void)
             ^
  CC      drivers/usb/chipidea/otg_fsm.o
In file included from drivers/usb/chipidea/otg_fsm.c:34:0:
drivers/usb/chipidea/host.h:23:13: warning: 'ci_hdrc_host_driver_init'
defined but not used [-Wunused-function]
 static void ci_hdrc_host_driver_init(void)
             ^

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:56:47 +08:00
43e724eb4e MLK-12344-3 usb: chipidea: update power lost handling for gadget
After we put gadget disconnect and connect in id switch handling,
update power lost work accordingly.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit fd49596ece)
2019-11-25 15:56:47 +08:00
82c83d06b3 MLK-12344-2 usb: chipidea: otg: add vbus disconnect for gadget after sleep
During system sleep, if we switch otg role from gadget to host, and host
vbus is directly controlled by ID signal, we will lose vbus drop event
after resume because the vbus is on both at system suspend and resume, so
we will miss gadget disconnect handling before start host role. This patch
is to fix it by adding gadget disconnect for this case.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 79aab6fc3c)
2019-11-25 15:56:46 +08:00
5f59266728 MLK-12344-1 usb: chipidea: otg: add vbus connect for gadget after sleep
During system sleep, if we switch otg role from host to gadget, because
the vbus is on both at system suspend and resume, we will lose vbus
connect event after system resume, thus, no chance to setup vbus session
for gadget so enumeration will not happen. This patch is to fix it by
adding vbus connect handling for this case.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit bd54eea0f7)
2019-11-25 15:56:46 +08:00
76d927518e MLK-12247 usb: chipidea: udc: disconnect host if system enters suspend
It is better we disconnect (pulldown dp) host when the system enters
suspend if the host did not suspend bus beforehand, it can avoid
unnecessary udc suspend irq during usb enters suspend. This unexpected
suspend irq occurs due to the udc still pulls up dp, but the host
suspends bus due to it finds the device has disconnected. The device
turns off high speed terminal will be considered a disconnection event
from the host.

It also fixes the bug ENGR00325724 describes.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 9d9ddd142cdbfb4bcbaae161a452596668441b1a)
2019-11-25 15:56:45 +08:00
6c11f3257e usb: chipidea: imx: enable vbus and id wakeup only for OTG events
If ID or VBUS is from external block, don't enable its wakeup
because it isn't used at all.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:56:44 +08:00
6c0b2ae06c usb: chipidea: usbmisc_imx: change vbus-wakeup regualator as optional
This is an optional regualator, without this change, it will
tried to get dummy regulator, and cause the kernel dump by
calling regulator_disable.

Reported-by: Anson Huang <anson.huang@nxp.com>
Tested-by: Anson Huang <anson.huang@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:43 +08:00
5fab364d5a MLK-13638-5 usb: chipidea: usbmisc_imx: add power_lost_check API for imx7ulp
For imx7ulp, the power of USB controller may be lost, add power_lost_check
API for USB recovery.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 64a3e0c3eb)
2019-11-25 15:56:43 +08:00
267994809b MLK-11831-2 usb: chipidea: imx: add request{release}_bus_freq
When the usb in idle, it calls release_bus_req.
When the usb is going to use, it calls request_bus_req.
This is a rework patch of ENGR00286459 and ENGR00286926.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:42 +08:00
76945d371b MLK-11831-1 usb: chipidea: imx: Add dummy LDO2p5 regulator for VBUS wakeup
LDO2p5 cannot be disabled in low power idle mode when the USB driver
enables VBUS wakeup. To identify when LDO2p5 can be disabled add a dummy
regulator that the USB driver will enable when VBUS wakeup is required.

Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 1c75404665)
2019-11-25 15:56:42 +08:00
797aa78231 MLK-11183-1 usb: chipidea: host: fix NULL pointer problem for fast load/unload module
The interrupt may occur (due to remove process may block interrupt)
after we remove hcd, in that case, we should not call hcd's interrupt
handler, otherwise, below NULL pointer dereference will occur, the reason
for this is we call free_irq later than hcd's. So after hcd has been
removed, we should not call hcd interrupt handler.

ci_hdrc ci_hdrc.0: remove, state 1
usb usb1: USB disconnect, device number 1
ci_hdrc ci_hdrc.0: USB bus 1 deregistered
[<800691e8>] (handle_irq_event) from [<8006c02c>] (handle_fasteoi_irq+0x84/0x14c)
[<8006c02c>] (handle_fasteoi_irq) from [<800687f4>] (generic_handle_irq+0x2c/0x3c)
[<800687f4>] (generic_handle_irq) from [<8000ed4c>] (handle_IRQ+0x40/0x90)
[<8000ed4c>] (handle_IRQ) from [<8000856c>] (gic_handle_irq+0x2c/0x5c)
[<8000856c>] (gic_handle_irq) from [<80012240>] (__irq_svc+0x40/0x70)
Exception stack(0x80db1f18 to 0x80db1f60)
1f00: 80db1f60 3b9aca00
1f20: 06f86934 0000000d 80dbe1c8 80dbe1c8 ee71e0d0 00000000 06f5bb01 0000000d
1f40: 80db0000 00000000 00000017 80db1f60 00000009 8049c19c 000d0013 ffffffff
[<80012240>] (__irq_svc) from [<8049c19c>] (cpuidle_enter_state+0x54/0xe4)
[<8049c19c>] (cpuidle_enter_state) from [<8049c2e0>] (cpuidle_idle_call+0xb4/0x14c)
[<8049c2e0>] (cpuidle_idle_call) from [<8000f07c>] (arch_cpu_idle+0x8/0x44)
[<8000f07c>] (arch_cpu_idle) from [<8006876c>] (cpu_startup_entry+0x100/0x14c)
[<8006876c>] (cpu_startup_entry) from [<80d52b10>] (start_kernel+0x350/0x35c)
--[ end trace 1160f590a7b228b3 ]--
Unable to handle kernel NULL pointer dereference at virtual address 000000b0
pgd = 80004000
[000000b0] *pgd=00000000
Internal error: Oops: 17 1 PREEMPT SMP ARM
Modules linked in: ci_hdrc_imx usbmisc_imx ci_hdrc udc_core ehci_hcd phy_mxs_usb mxc_v4l2_capture ipu_bg_overlay_sdc ipu_still ipu_prp_enc adv7180_tvin ipu_csi_enc v4l2_int_device ipu_fg_overlay_sdc mxc_mlb mxc_dcic evbug [last unloaded: phy_mxs_usb]
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 3.14.38-usb-host-otg-02047-ga4dec77 #13
task: 80dbbae8 ti: 80db0000 task.ti: 80db0000
PC is at usb_hcd_irq+0x4/0x38
LR is at handle_irq_event_percpu+0x50/0x180
pc : [<8040eed8>] lr : [<8006907c>] psr: a00d0193
sp : 80db1e98 ip : fffffffa fp : 00000000
r10: 80e1f13f r9 : d8009900 r8 : 0000004b
r7 : 00000000 r6 : 00000000 r5 : d800995c r4 : d8f2dec0
r3 : d2234010 r2 : d2234010 r1 : 00000000 r0 : 0000004b
Flags: NzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c53c7d Table: 6920004a DAC: 00000015
Process swapper/0 (pid: 0, stack limit = 0x80db0238)
Stack: (0x80db1e98 to 0x80db2000)
1e80: d2234010 8006907c
1ea0: 0000004b ee71da00 d8009900 d800995c d8f2dec0 f4a00100 06f5bb01 0000000d
1ec0: 80db0000 800691e8 d8009900 d800995c 00000000 8006c02c 8006bfa8 0000004b
1ee0: 0000004b 800687f4 80dace54 8000ed4c f4a0010c 80db8970 80db1f18 8000856c
1f00: 00000009 8049c19c 000d0013 ffffffff 80db1f4c 80012240 80db1f60 3b9aca00
1f20: 06f86934 0000000d 80dbe1c8 80dbe1c8 ee71e0d0 00000000 06f5bb01 0000000d
1f40: 80db0000 00000000 00000017 80db1f60 00000009 8049c19c 000d0013 ffffffff
1f60: 06f86934 0000000d 80dc4a54 ee71e0d0 80db8574 ee71e0d0 00000000 00000000
1f80: 00000000 80e797f8 80dbe1c8 8049c2e0 00000000 80db0000 80db8574 806fe48c
1fa0: 80db0038 80e1f13d 80e1f13d 8000f07c 00000000 8006876c ffffffff 80d52b10
1fc0: ffffffff ffffffff 80d5258c 00000000 00000000 80d9ef30 00000000 10c53c7d
1fe0: 80db84fc 80d9ef2c 80dbcb80 1000406a 412fc09a 10008074 00000000 00000000
[<8040eed8>] (usb_hcd_irq) from [<8006907c>] (handle_irq_event_percpu+0x50/0x180)
[<8006907c>] (handle_irq_event_percpu) from [<800691e8>] (handle_irq_event+0x3c/0x5c)
[<800691e8>] (handle_irq_event) from [<8006c02c>] (handle_fasteoi_irq+0x84/0x14c)
[<8006c02c>] (handle_fasteoi_irq) from [<800687f4>] (generic_handle_irq+0x2c/0x3c)
[<800687f4>] (generic_handle_irq) from [<8000ed4c>] (handle_IRQ+0x40/0x90)
[<8000ed4c>] (handle_IRQ) from [<8000856c>] (gic_handle_irq+0x2c/0x5c)
[<8000856c>] (gic_handle_irq) from [<80012240>] (__irq_svc+0x40/0x70)
Exception stack(0x80db1f18 to 0x80db1f60)
1f00: 80db1f60 3b9aca00
1f20: 06f86934 0000000d 80dbe1c8 80dbe1c8 ee71e0d0 00000000 06f5bb01 0000000d
1f40: 80db0000 00000000 00000017 80db1f60 00000009 8049c19c 000d0013 ffffffff
[<80012240>] (__irq_svc) from [<8049c19c>] (cpuidle_enter_state+0x54/0xe4)
[<8049c19c>] (cpuidle_enter_state) from [<8049c2e0>] (cpuidle_idle_call+0xb4/0x14c)
[<8049c2e0>] (cpuidle_idle_call) from [<8000f07c>] (arch_cpu_idle+0x8/0x44)
[<8000f07c>] (arch_cpu_idle) from [<8006876c>] (cpu_startup_entry+0x100/0x14c)
[<8006876c>] (cpu_startup_entry) from [<80d52b10>] (start_kernel+0x350/0x35c)
Code: 11a002a0 03a00001 e12fff1e e92d4008 (e59130b0)
--[ end trace 1160f590a7b228b4 ]--
Kernel panic - not syncing: Fatal exception in interrupt
CPU2: stopping
CPU: 2 PID: 1483 Comm: modprobe Tainted: G D W 3.14.38-usb-host-otg-02047-ga4dec77 #13
[<80014a68>] (unwind_backtrace) from [<80011758>] (show_stack+0x10/0x14)
[<80011758>] (show_stack) from [<806f5fe8>] (dump_stack+0x7c/0xbc)
[<806f5fe8>] (dump_stack) from [<800139f0>] (handle_IPI+0x144/0x158)
[<800139f0>] (handle_IPI) from [<80008598>] (gic_handle_irq+0x58/0x5c)
[<80008598>] (gic_handle_irq) from [<80012240>] (__irq_svc+0x40/0x70)
Exception stack(0xd96c5dc0 to 0xd96c5e08)
5dc0: d800995c 0000004b 00000000 00072004 d8f2dec0 d8009900 d800995c 0000004b
5de0: d800995c a00f0013 00000000 010f2280 fffffffa d96c5e08 00000000 8006926c
5e00: 000f0013 ffffffff
[<80012240>] (__irq_svc) from [<8006926c>] (synchronize_irq+0x18/0xa8)
[<8006926c>] (synchronize_irq) from [<800696dc>] (__free_irq+0xfc/0x1c4)
[<800696dc>] (__free_irq) from [<80069838>] (free_irq+0x4c/0xa4)
[<80069838>] (free_irq) from [<8034b760>] (release_nodes+0x16c/0x1cc)
[<8034b760>] (release_nodes) from [<803487ec>] (__device_release_driver+0x78/0xcc)
[<803487ec>] (__device_release_driver) from [<8034885c>] (device_release_driver+0x1c/0x28)
[<8034885c>] (device_release_driver) from [<8034827c>] (bus_remove_device+0xdc/0x108)
[<8034827c>] (bus_remove_device) from [<80345788>] (device_del+0x100/0x1a4)
[<80345788>] (device_del) from [<8034a218>] (platform_device_del+0x18/0x9c)
[<8034a218>] (platform_device_del) from [<8034a2a8>] (platform_device_unregister+0xc/0x20)
[<8034a2a8>] (platform_device_unregister) from [<7f61932c>] (ci_hdrc_remove_device+0xc/0x20 [ci_hdrc])
[<7f61932c>] (ci_hdrc_remove_device [ci_hdrc]) from [<7f631260>] (ci_hdrc_imx_remove+0x2c/0xdc [ci_hdrc_imx])
[<7f631260>] (ci_hdrc_imx_remove [ci_hdrc_imx]) from [<8034a350>] (platform_drv_remove+0x18/0x30)
[<8034a350>] (platform_drv_remove) from [<803487e4>] (__device_release_driver+0x70/0xcc)
[<803487e4>] (__device_release_driver) from [<80348ef4>] (driver_detach+0xac/0xb0)
[<80348ef4>] (driver_detach) from [<803484e4>] (bus_remove_driver+0x4c/0xa0)
[<803484e4>] (bus_remove_driver) from [<80084158>] (SyS_delete_module+0x11c/0x17c)
[<80084158>] (SyS_delete_module) from [<8000e460>] (ret_fast_syscall+0x0/0x30)
CPU3: stopping
CPU: 3 PID: 0 Comm: swapper/3 Tainted: G D W 3.14.38-usb-host-otg-02047-ga4dec77 #13
[<80014a68>] (unwind_backtrace) from [<80011758>] (show_stack+0x10/0x14)
[<80011758>] (show_stack) from [<806f5fe8>] (dump_stack+0x7c/0xbc)
[<806f5fe8>] (dump_stack) from [<800139f0>] (handle_IPI+0x144/0x158)
[<800139f0>] (handle_IPI) from [<80008598>] (gic_handle_irq+0x58/0x5c)
[<80008598>] (gic_handle_irq) from [<80012240>] (__irq_svc+0x40/0x70)
Exception stack(0xd80b1f50 to 0xd80b1f98)
1f40: d80b1f98 3b9aca00 256aed09 0000000d
1f60: 80dbe1c8 80dbe1c8 ee7360d0 00000000 25477984 0000000d d80b0000 00000000
1f80: 00000017 d80b1f98 00000009 8049c19c 00070013 ffffffff
[<80012240>] (__irq_svc) from [<8049c19c>] (cpuidle_enter_state+0x54/0xe4)
[<8049c19c>] (cpuidle_enter_state) from [<8049c2e0>] (cpuidle_idle_call+0xb4/0x14c)
[<8049c2e0>] (cpuidle_idle_call) from [<8000f07c>] (arch_cpu_idle+0x8/0x44)
[<8000f07c>] (arch_cpu_idle) from [<8006876c>] (cpu_startup_entry+0x100/0x14c)
[<8006876c>] (cpu_startup_entry) from [<10008624>] (0x10008624)
CPU1: stopping

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 402f2d38e22007e931dc3dd52a69c0fed88452bf)
2019-11-25 15:56:42 +08:00
cf5e629825 MLK-10510-3 usb: chipidea: usbmisc_imx: add power lost check for i.MX7D
Add power lost check implementation for i.MX7D.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 59102c3b9756923f1c8cdba8bcab7b8611685321)
2019-11-25 15:56:41 +08:00
37763a37a7 MLK-10132-4 usb: chipidea: imx: disable usb wakeup in probe
Disable usb wakeup as initial setting in probe.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit bf54f23766bcebd781f1c09bd68bc00d790160c8)
2019-11-25 15:56:40 +08:00
42c246213d MLK-11340-38 usb: chipidea: imx: enable different wakeup setting
We have different wakeup setting for different roles:
For peripheral-only mode, we may only enable vbus wakeup.
The Micro-AB cable should not be considered as wakeup source.
For host-only mode, the ID change or vbus change should not be
considered as wakeup source. For OTG mode, all wakeup setting
should be considered as wakeup source.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:39 +08:00
9f629a4861 MLK-11340-37 usb: chipidea: add query_available_role interface
The glue layer may need to know current available role, add
ci_hdrc_query_available_role for that.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 5c340402131ca6eacaeb122deb1ee59bcea2778c)
2019-11-25 15:56:38 +08:00
731e345e6f MLK-10132-3 usb: chipidea: udc: do not enter low power mode if vbus on
This patch is to prevent usb entering low power mode if vbus is on even gadget
driver is not binded, by holding the PM count of ci->dev.
So, there are 3 pm usage_count status:
- ci->dev: 1 ci->gadget.dev: 1
  Device mode with gadget driver binded and vbus on.
- ci->dev: 1 ci->gadget.dev: 0
  USB vbus on but gadget driver not binded.
- ci->dev: 0 ci->gadget.dev: 1
  USB OTG FSM is in a_peripheral mode.
Above 2 device's pm usage_count hold by ci otg(ci->dev) and usb gadget
(ci->gadget.dev).

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 673c6bf1b3aa0b1b698569b9259712b0e765be32)
2019-11-25 15:56:38 +08:00
97926727e0 MLK-11340-35 usb: chipidea: host: call notify PHY for power management
Notify PHY for controller's PM status

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:37 +08:00
ded9d896fa MLK-9831-1 usb: chipidea: udc: refine ci_udc_start
Use ci_hdrc_gadget_connect() API directly if vbus is on.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
2019-11-25 15:56:37 +08:00
214ed5edf0 MLK-9618-7 usb: chipidea: otg: delay turn on vbus when detecting data pulse
This patch adds a timer to delay turn on vbus after detecting data pulse
from B-device, this is required by OTG SRP timing.

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit f02ee3e93715c41f5b1e11140f36e350c7ed4d6b)
2019-11-25 15:56:36 +08:00
837186db93 MLK-10102-8 usb: chipidea: support role change after power lost
This patch is to complete support usb resume from power lost in non-otg
fsm mode:
- Re-init usb phy.
- Support role changes during system sleep with power lost.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
2019-11-25 15:56:35 +08:00
fa30097131 MLK-10102-7 usb: chipidea: otg: fix deadlock of usb host removal after system resume
This is to fix possible deadlock of usb host with mass storage removal after
system resume, by waiting host finish device disconnection and then stop host
This is a patch merge for ideas from below 2 patches:
ENGR00308442-2 usb: chipidea: otg: wait devices disconnected before stop host.
ENGR00310498 usb: chipidea: otg: fix otg role switch from host to device failure

How to reproduce:
Failure case 1:
- Enable console wakeup:
  echo enabled > /sys/class/tty/ttymxc0/power/wakeup
- Connect a udisk with ID cable to OTG port.
- Suspend the system:
  ehco mem > /sys/power/state
- Remove ID cable together with udisk.
- Wakeup the system by console.
- OTG port cannot switch to device role.
Failure case 2:
- Connect a udisk with ID cable to OTG port.
- Enable usb wakeup by ./low_power_usb.sh
- Suspend the system:
  ehco mem > /sys/power/state
- Remove ID cable together with udisk.
- System wakeup but OTG port cannot switch to device role.

Root cause:
In this case, ID change interrupt generates before port change interrupt,
so with irq disabled, ci_handle_id_switch() will find there is usb device
still connected and wait it to disconnect by sleep, but disconnect will not
happen since usb irq still disabled so port change irq has no chance to be
handled.

How this patch is fixing this issue:
This patch waits host finish handle usb device disconnection before stop host,
and enables irq before sleep and disables irq after, thus port change
rq can be handled and usb device disconnection can timely happen, then
ci_handle_id_switch() can stop host and switch to device role correctly.

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 56d79fbaa4bea3670542a96354ee7034239a1c1f)
(cherry picked from commit d5350035b22cfa1cef15956612a4eec36b4dc0de)
2019-11-25 15:56:34 +08:00
35f82e19b0 MLK-10102-9 usb: chipidea: host: add ci_hdrc_host_has_device API
This patch adds a new API ci_hdrc_host_has_device to check if there
is usb device connected on host port.

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit fd68eb8ef9cdac1ca861ccbc3d01d874123bf52a)
(cherry picked from commit 13ad3de98a)
2019-11-25 15:56:33 +08:00
b98209af30 MLK-10102-6 usb: chipidea: otg: export ci_handle_id_switch API
Export ci_handle_id_switch interface for controller handle id
changes during system sleep with power lost.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit e130afe623307b69b3737cb5a41905400082ca36)
(cherry picked from commit 7acb88a1d4d4f49cebe7c92ce92937e94c2b6486)
(cherry picked from commit 509c78374c)
2019-11-25 15:56:33 +08:00
5af3e83f13 MLK-10102-5 usb: chipidea: udc: support resume udc from power lost
This patch implements the suspend and resume routine for udc resume
from power lost.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit a1389afb0c70d4024e07ff9634f10eba559af374)
(cherry picked from commit 733d0547c2cc90299b35b1b0d34073838ffcf6d9)
(cherry picked from commit 458b611c60)
2019-11-25 15:56:32 +08:00
8fa4940f38 MLK-10102-4 usb: chipidea: host: support resume usb from power lost
This patch implements the suspend and resume routine for save and restore
registers of ehci, this is to support host resume from a system sleep with
power lost.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit ab8e5ef4265b706b47b2e3ee36e079d63a3f0bce)
(cherry picked from commit 31039b54ec0bd2429f758626c0abfc9898c5aa82)
(cherry picked from commit 77aaaabe4b)
2019-11-25 15:56:32 +08:00
e48fb21081 MLK-10102-3 usb: chipidea: export hw_controller_reset API
Host needs to reset controller for recovery from power lost.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 136222e683d40890f11985e61b447f2481b8bff5)
(cherry picked from commit 606efc2e85)
2019-11-25 15:56:31 +08:00
5aedb7d9a2 MLK-10102-2 usb: chipidea: add suspend and resume routine for role driver
We may need to do extra things for system suspend/resume per different
roles(e.g. power lost during system sleep), so define system suspend/resume
handler for roles.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit cac6f339b30102c63f8bb5c56e77d5c7a6c6b4b5)
(cherry picked from commit 11fe36e4b3)
2019-11-25 15:56:31 +08:00
bd6e7339b6 MLK-10102-1 usb: chipidea: imx: usb resume from power lost during system sleep
i.MX6SX mega off can shutdown domain power supply if none of peripheral
in this domain is registered as wakeup source, this patch adds usb controller
imx specific re-init after resume from such power lost during system sleep.

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit cd37f9b7157322e28c1d336e42813d441eb1f778)
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:30 +08:00
5037438220 MLK-10085-5 usb: chipidea: Add usb charger detect notify
- Change .notify's return value from void to int, update msm notify_event
  return value accordingly.
- Add CI_HDRC_CONTROLLER_VBUS_EVENT and
  CI_HDRC_CONTROLLER_CHARGER_POST_EVENT to finish the USB charger
  detection flow.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 681ca18061)
2019-11-25 15:56:29 +08:00
6970ad778e MLK-22527-2 usb: cdns3: quit if the port is woken up during suspending
If the port receives the resume during the suspending, it needs to
quit instead of going on, it could keep controller status correct,
and eliminating below timeout warning message.

cdns-usb3 5b110000.usb3: wait lpm_clk_req timeout
cdns-usb3 5b110000.usb3: wait phy_refclk_req timeout

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:27 +08:00
b2d9251b02 MLK-22527-1 usb: cdns3: gadget: quit functional halt if there are pending requests
If the non-control endpoints want to halt, but there are pending
requests on this endpoint, we need to return -EAGAIN, otherwise,
the controller may be in stuck if we stall the doolbell'ed
endpoint.

With this change, we could pass the USB certification MSC test.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:27 +08:00
25a67f55dd MLK-16735-2 usb: host: add XHCI_CDNS_HOST flag
The NXP Cadence XHCI host has the same issue with Intel's,
it is triggered by reboot test, the test case is described
at this jira ticket.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:26 +08:00
8105884023 MLK-22366-8 usb: cdns3: ep0: check gadget private data pointer before calling composite_setup
At very rare cases, the cdev at compsite driver will be NULL when the
interrupt occurs, see below oops. The root cause has not found, to avoid
NULL pointer, we could add one checker before calling composite API.

libprocessgroup: Successfully killed process cgroup uid 0 pid 10441 in 41ms
using random self ethernet address
using random host ethernet address
init: Service 'adbd' (pid 10441) received signal 9
init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:14)
init: Received control message 'start' for 'adbd' from pid: 3215 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: starting service 'adbd'...
init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000
read descriptors
read strings
usb0: HOST MAC 1a:7c:d4:da:d4:57
usb0: MAC 6e:64:d4:2b:a2:01
init: Received control message 'start' for 'adbd' from pid: 3345 (system_server)
android_work: did not send uevent (0 0           (null))
read descriptors
read strings
android_work: sent uevent USB_STATE=CONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONFIGURED
android_work: sent uevent USB_STATE=DISCONNECTED
read descriptors
read strings
android_work: sent uevent USB_STATE=CONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONFIGURED
Unable to handle kernel NULL pointer dereference at virtual address 00000090
android_work: sent uevent USB_STATE=DISCONNECTED
Mem abort info:
  Exception class = DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x00000006
  CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgd = ffff80082c136000
[0000000000000090] *pgd=00000008ac177003, *pud=00000008ac178003, *pmd=0000000000000000
Internal error: Oops: 96000006 [#1] PREEMPT SMP
Modules linked in: wlan
CPU: 3 PID: 2329 Comm: irq/37-5b110000 Tainted: G        W       4.14.98-07849-g5336857 #3
Hardware name: Freescale i.MX8QXP MEK (DT)
task: ffff80083b3e8000 task.stack: ffff00000b318000
PC is at _raw_spin_lock_irqsave+0x1c/0x50
LR is at android_setup+0x34/0x13c
pc : [<ffff000009009d30>] lr : [<ffff000008a03288>] pstate: 800001c5
sp : ffff00000b31bc30
x29: ffff00000b31bc30 x28: ffff80083ae4a6a4
x27: 0000000000000001 x26: 0000000000000140
x25: ffff000008145bc8 x24: ffff8008360ed010
x23: 0000000000000000 x22: 0000000000000090
x21: ffff80083b3e8000 x20: ffff00000a8ee000
x19: fffffffffffffbd8 x18: 0000000000000008
x17: 0000f63c442ded10 x16: ffff000008173bf8
x15: 00006436c9000000 x14: 002756cd00000000
x13: 00e80008a2b0df53 x12: 0000000000000018
x11: 000000082cd330c0 x10: 0000000000000a30
x9 : ffff00000b31bd00 x8 : ffff80083b3e8a90
x7 : 0000000082bdc457 x6 : 0000000000000001
x5 : 0000000000000000 x4 : 0000000000000000
x3 : 00000000000001c0 x2 : ffff80083b3e8000
x1 : 0000000000000001 x0 : 0000000000000090

X2: 0xffff80083b3e7f80:
7f80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8000  00000020 00000000 ffffffff ffffffff 00000002 00000000 00000000 00000000
8020  0b318000 ffff0000 00000003 00208040 00000000 00000000 00000000 00000000
8040  00000001 00000003 00000006 00000000 00082641 00000001 31296200 ffff8008
8060  00000003 00000001 00000031 00000078 00000031 00000032 09031e38 ffff0000

X8: 0xffff80083b3e8a10:
8a10  00000000 00000000 3ae46f80 ffff8008 00000001 00000000 00000000 00000000
8a30  2ccd0e00 ffff8008 3b3e8000 ffff8008 3b3e8000 ffff8008 09873000 ffff0000
8a50  367af800 ffff8008 00000000 00000000 3b3e8648 ffff8008 09c7e000 ffff0000
8a70  3ff67800 ffff8008 09031d48 ffff0000 0b31bd00 ffff0000 0b31bd00 ffff0000
8a90  080861bc ffff0000 00000000 00000000 00000000 00000000 00000000 00000000
8ab0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8ad0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8af0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

X19: 0xfffffffffffffb58:
fb58  ******** ******** ******** ******** ******** ******** ******** ********
fb78  ******** ******** ******** ******** ******** ******** ******** ********
fb98  ******** ******** ******** ******** ******** ******** ******** ********
fbb8  ******** ******** ******** ******** ******** ******** ******** ********
fbd8  ******** ******** ******** ******** ******** ******** ******** ********
fbf8  ******** ******** ******** ******** ******** ******** ******** ********
fc18  ******** ******** ******** ******** ******** ******** ******** ********
fc38  ******** ******** ******** ******** ******** ******** ******** ********

X21: 0xffff80083b3e7f80:
7f80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8000  00000020 00000000 ffffffff ffffffff 00000002 00000000 00000000 00000000
8020  0b318000 ffff0000 00000003 00208040 00000000 00000000 00000000 00000000
8040  00000001 00000003 00000006 00000000 00082641 00000001 31296200 ffff8008
8060  00000003 00000001 00000031 00000078 00000031 00000032 09031e38 ffff0000

X24: 0xffff8008360ecf90:
cf90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
cfb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
cfd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
cff0  00000000 00000000 00000000 00000000 3ae4c010 ffff8008 3ae4c010 ffff8008
d010  00000000 00000000 360ed018 ffff8008 360ed018 ffff8008 08a067ec ffff0000
d030  36191400 ffff8008 091c3650 ffff0000 3bf5d618 ffff8008 3bf5d730 ffff8008
d050  361a0430 ffff8008 00000000 00000005 00000000 00000000 095d0150 ffff0000
d070  3ae4c010 ffff8008 361a0500 ffff8008 095c9850 ffff0000 36191428 ffff8008

X28: 0xffff80083ae4a624:
a624  00000000 00000000 00000025 0000010f 00000000 3ae4a600 ffff8008 09d8fad0
a644  ffff0000 3a088000 ffff8008 3ab11780 ffff8008 00000000 00000000 09886bb0
a664  ffff0000 081486a4 ffff0000 3ae46a80 ffff8008 00000000 00000000 00000000
a684  00000000 00011a91 00000000 00082641 00000001 00000001 0000f49b 8000f49b
a6a4  352b352b 00000000 00000000 00000000 00000000 00000000 00000000 00000000
a6c4  00000000 00000000 00000000 00000001 00000000 f2def2de 00000000 3ae4a6e0
a6e4  ffff8008 3ae4a6e0 ffff8008 00000001 00000000 00000000 00000000 361a0700
a704  ffff8008 00000000 00000000 00000000 00000000 3ab11400 ffff8008 3ae4a720

Process irq/37-5b110000 (pid: 2329, stack limit = 0xffff00000b318000)
Call trace:
Exception stack(0xffff00000b31baf0 to 0xffff00000b31bc30)
bae0:                                   0000000000000090 0000000000000001
bb00: ffff80083b3e8000 00000000000001c0 0000000000000000 0000000000000000
bb20: 0000000000000001 0000000082bdc457 ffff80083b3e8a90 ffff00000b31bd00
bb40: 0000000000000a30 000000082cd330c0 0000000000000018 00e80008a2b0df53
bb60: 002756cd00000000 00006436c9000000 ffff000008173bf8 0000f63c442ded10
bb80: 0000000000000008 fffffffffffffbd8 ffff00000a8ee000 ffff80083b3e8000
bba0: 0000000000000090 0000000000000000 ffff8008360ed010 ffff000008145bc8
bbc0: 0000000000000140 0000000000000001 ffff80083ae4a6a4 ffff00000b31bc30
bbe0: ffff000008a03288 ffff00000b31bc30 ffff000009009d30 00000000800001c5
bc00: ffff80083b3e8648 ffff000009c7e000 ffffffffffffffff ffff80083b3e8000
bc20: ffff00000b31bc30 ffff000009009d30
[<ffff000009009d30>] _raw_spin_lock_irqsave+0x1c/0x50
[<ffff0000089bd9b0>] cdns3_ep0_delegate_req+0x4c/0x80
[<ffff0000089be004>] cdns3_check_ep0_interrupt_proceed+0x33c/0x654
[<ffff0000089bca44>] cdns3_device_thread_irq_handler+0x4b0/0x4bc
[<ffff0000089b77b4>] cdns3_thread_irq+0x48/0x68
[<ffff000008145bf0>] irq_thread_fn+0x28/0x88
[<ffff000008145e38>] irq_thread+0x13c/0x228
[<ffff0000080fed70>] kthread+0x104/0x130
[<ffff000008085064>] ret_from_fork+0x10/0x18
Code: b9401041 11000421 b9001041 f9800011 (885ffc01)
---[ end trace 497c9866542e50ab ]---
Kernel panic - not syncing: Fatal exception
SMP: stopping secondary CPUs
Kernel Offset: disabled
CPU features: 0x0802008
Memory Limit: none
Rebooting in 5 seconds..

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:26 +08:00
d1fea6ce83 MLK-22366-7 usb: cdns3: gadget: quit if endpoint has already disabled
It fixed below oops:
audit: audit_lost=500851 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
libprocessgroup: Successfully killed process cgroup uid 0 pid 25371 in 49ms
init: Service 'adbd' (pid 25371) received signal 9
init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:14)
init: Received control message 'start' for 'adbd' from pid: 3308 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: starting service 'adbd'...
init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000
read descriptors
read strings
init: Received control message 'start' for 'adbd' from pid: 3447 (system_server)
android_work: did not send uevent (0 0           (null))
audit: audit_lost=500888 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
audit: audit_lost=500925 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
using random self ethernet address
using random host ethernet address
read descriptors
read strings
usb0: HOST MAC 32:e7:67:29:5f:d8
usb0: MAC 02:5c:48:b3:2b:d7
android_work: sent uevent USB_STATE=CONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONFIGURED
Unable to handle kernel NULL pointer dereference at virtual address 00000002
Mem abort info:
  Exception class = DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x00000004
  CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgd = ffff8008f7bed000
[0000000000000002] *pgd=0000000000000000
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 2 PID: 3326 Comm: Binder:3276_2 Not tainted 4.14.98-07848-gfb2a5a8 #1
Hardware name: Freescale i.MX8QM MEK (DT)
task: ffff8008f77f3800 task.stack: ffff00000b378000
PC is at __cdns3_gadget_ep_queue.isra.18+0x238/0x524
LR is at cdns3_gadget_ep_queue+0x44/0xd8
pc : [<ffff0000089bbf90>] lr : [<ffff0000089bc2c0>] pstate: 400001c5
sp : ffff00000b37ba40
x29: ffff00000b37ba40 x28: ffff8008f235fa00
x27: ffff8008f2f11600 x26: ffff8008f2dee118
x25: ffff8008f2df0000 x24: 0000000000000000
x23: ffff000009c8e000 x22: ffff8008f2df0000
x21: 0000000000000000 x20: ffff8008f2dee118
x19: ffff8008f1f1ac00 x18: 0000fcc72810fc1a
x17: 0000fcc729e2d0e0 x16: ffff0000082b4430
x15: 0000000000000000 x14: ffffffffffffffff
x13: 0000000000000000 x12: 0000000000000020
x11: 0000000000000020 x10: 0101010101010101
x9 : 0000000000000000 x8 : 0000000000000024
x7 : 0000000040000000 x6 : 0000000000000020
x5 : 0000000000000000 x4 : 0000000000000000
x3 : 0000000000000140 x2 : 0000000000000000
x1 : ffff8008f1f1ac00 x0 : ffff8008f7738010

X0: 0xffff8008f7737f90:
7f90  f75baef8 ffff8008 00000000 00000000 3305708c 00000000 f7332aa0 ffff8008
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fd0  00005408 00000001 a1ff0014 00000000 00000000 00000000 00000000 00000000
7ff0  00000000 00000000 00000000 00000000 f7548780 ffff8008 ffffffff 00000000
8010  09dc50d8 ffff0000 f76fc800 ffff8008 f7548780 ffff8008 f7738428 ffff8008
8030  f76e7c28 ffff8008 09dc50e8 ffff0000 f6e6ae80 ffff8008 09dc4ac8 ffff0000
8050  f753e660 ffff8008 00000007 00000007 00000000 00000000 00000000 00000000
8070  00000000 00000000 00000000 00000000 f7738080 ffff8008 f7738080 ffff8008

X1: 0xffff8008f1f1ab80:
ab80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
aba0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
abc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
abe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ac00  ec128080 ffff8008 0000062a 00000000 f5383800 00000000 00000000 00000000
ac20  00000000 00000000 00000000 00000000 08a179d8 ffff0000 e85aeb00 ffff8008
ac40  f1f1ac40 ffff8008 f1f1ac40 ffff8008 ffffff8d 00000000 f2dee118 ffff8008
ac60  0afdb024 ffff0000 00000003 00000003 00000000 00000000 00000000 00000000

X19: 0xffff8008f1f1ab80:
ab80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
aba0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
abc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
abe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ac00  ec128080 ffff8008 0000062a 00000000 f5383800 00000000 00000000 00000000
ac20  00000000 00000000 00000000 00000000 08a179d8 ffff0000 e85aeb00 ffff8008
ac40  f1f1ac40 ffff8008 f1f1ac40 ffff8008 ffffff8d 00000000 f2dee118 ffff8008
ac60  0afdb024 ffff0000 00000003 00000003 00000000 00000000 00000000 00000000

X20: 0xffff8008f2dee098:
e098  ae000000 00000000 f2df0000 ffff8008 00307065 00000000 00000000 00000000
e0b8  00000000 00000010 00000000 00000000 00000080 00000000 00000002 00000000
e0d8  00000000 00000000 00000002 00000000 00000000 00000000 00000000 00000000
e0f8  00000000 00000000 f2dee200 ffff8008 f2dee000 ffff8008 087793a4 ffff0000
e118  f0475900 ffff8008 f2dee1a8 ffff8008 091c36b0 ffff0000 f2dee230 ffff8008
e138  f2df0048 ffff8008 0000002e 02000000 000f0400 00000101 00000000 00000000
e158  00000000 00000000 f2dee160 ffff8008 f2dee160 ffff8008 f2dee170 ffff8008
e178  f2dee170 ffff8008 f2dee180 ffff8008 f2dee180 ffff8008 0afdb000 ffff0000

X22: 0xffff8008f2deff80:
ff80  f33b40a0 ffff8008 f3dd6810 ffff8008 f03f8de8 ffff8008 00000000 00000000
ffa0  27ac430e 00000000 00000000 00000000 f2aec128 ffff8008 f32e0680 ffff8008
ffc0  00000000 00000000 f3623400 ffff8008 000000ac 00000001 41e80011 00000000
ffe0  f3b18000 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
0000  f7738010 ffff8008 f7738010 ffff8008 000000c0 00000000 f2df0018 ffff8008
0020  f2df0018 ffff8008 08a077e4 ffff0000 f2d42c00 ffff8008 091c3650 ffff0000
0040  f2dee018 ffff8008 f2dee130 ffff8008 f2deee30 ffff8008 00000003 00000005
0060  00000007 00000000 095d1550 ffff0000 f7738010 ffff8008 f2deef00 ffff8008

X25: 0xffff8008f2deff80:
ff80  f33b40a0 ffff8008 f3dd6810 ffff8008 f03f8de8 ffff8008 00000000 00000000
ffa0  27ac430e 00000000 00000000 00000000 f2aec128 ffff8008 f32e0680 ffff8008
ffc0  00000000 00000000 f3623400 ffff8008 000000ac 00000001 41e80011 00000000
ffe0  f3b18000 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
0000  f7738010 ffff8008 f7738010 ffff8008 000000c0 00000000 f2df0018 ffff8008
0020  f2df0018 ffff8008 08a077e4 ffff0000 f2d42c00 ffff8008 091c3650 ffff0000
0040  f2dee018 ffff8008 f2dee130 ffff8008 f2deee30 ffff8008 00000003 00000005
0060  00000007 00000000 095d1550 ffff0000 f7738010 ffff8008 f2deef00 ffff8008

X26: 0xffff8008f2dee098:
e098  ae000000 00000000 f2df0000 ffff8008 00307065 00000000 00000000 00000000
e0b8  00000000 00000010 00000000 00000000 00000080 00000000 00000002 00000000
e0d8  00000000 00000000 00000002 00000000 00000000 00000000 00000000 00000000
e0f8  00000000 00000000 f2dee200 ffff8008 f2dee000 ffff8008 087793a4 ffff0000
e118  f0475900 ffff8008 f2dee1a8 ffff8008 091c36b0 ffff0000 f2dee230 ffff8008
e138  f2df0048 ffff8008 0000002e 02000000 000f0400 00000101 00000000 00000000
e158  00000000 00000000 f2dee160 ffff8008 f2dee160 ffff8008 f2dee170 ffff8008
e178  f2dee170 ffff8008 f2dee180 ffff8008 f2dee180 ffff8008 0afdb000 ffff0000

X27: 0xffff8008f2f11580:
1580  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
15a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
15c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
15e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
1600  f0475000 ffff8008 00000003 00000000 f235fa00 ffff8008 00000000 00000000
1620  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
1640  00000000 00000000 00000000 00000000 00000002 00000000 00000000 00000000
1660  00000000 00000000 00000000 00000000 08e3b158 ffff0000 f2f11600 ffff8008

X28: 0xffff8008f235f980:
f980  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
f9a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
f9c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
f9e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
fa00  00000000 00000000 09f6e3d8 ffff0000 00000000 00000000 f2f11600 ffff8008
fa20  00000000 00000000 00000000 00000000 812aa8c0 812aa8c0 00ffffff ff2aa8c0
fa40  00001800 00000080 30627375 00000000 00000000 00000000 00000000 00000000
fa60  0046ac7c 00000001 0046ac7c 00000001 00000000 00000000 00000000 00000000

Process Binder:3276_2 (pid: 3326, stack limit = 0xffff00000b378000)
Call trace:
Exception stack(0xffff00000b37b900 to 0xffff00000b37ba40)
b900: ffff8008f7738010 ffff8008f1f1ac00 0000000000000000 0000000000000140
b920: 0000000000000000 0000000000000000 0000000000000020 0000000040000000
b940: 0000000000000024 0000000000000000 0101010101010101 0000000000000020
b960: 0000000000000020 0000000000000000 ffffffffffffffff 0000000000000000
b980: ffff0000082b4430 0000fcc729e2d0e0 0000fcc72810fc1a ffff8008f1f1ac00
b9a0: ffff8008f2dee118 0000000000000000 ffff8008f2df0000 ffff000009c8e000
b9c0: 0000000000000000 ffff8008f2df0000 ffff8008f2dee118 ffff8008f2f11600
b9e0: ffff8008f235fa00 ffff00000b37ba40 ffff0000089bc2c0 ffff00000b37ba40
ba00: ffff0000089bbf90 00000000400001c5 ffff00000b37ba20 ffff00000827c354
ba20: 0000ffffffffffff ffff000008d578c4 ffff00000b37ba40 ffff0000089bbf90
[<ffff0000089bbf90>] __cdns3_gadget_ep_queue.isra.18+0x238/0x524
[<ffff0000089bc2c0>] cdns3_gadget_ep_queue+0x44/0xd8
[<ffff000008a06f70>] usb_ep_queue+0x5c/0xfc
[<ffff000008a1762c>] rx_submit+0xec/0x1bc
[<ffff000008a1775c>] rx_fill+0x60/0xb4
[<ffff000008a17c7c>] eth_open+0x64/0x78
[<ffff000008d72cf4>] __dev_open+0xe0/0x164
[<ffff000008d73128>] __dev_change_flags+0x160/0x18c
[<ffff000008d73174>] dev_change_flags+0x20/0x5c
[<ffff000008e359f0>] devinet_ioctl+0x68c/0x724
[<ffff000008e37cc4>] inet_ioctl+0x8c/0xa8
[<ffff000008d48a48>] sock_do_ioctl+0x34/0x70
[<ffff000008d49da0>] sock_ioctl+0x21c/0x320
[<ffff0000082b3b98>] do_vfs_ioctl+0xbc/0x954
[<ffff0000082b44b4>] SyS_ioctl+0x84/0x98
Exception stack(0xffff00000b37bec0 to 0xffff00000b37c000)
bec0: 000000000000003d 0000000000008914 0000fcc728110840 0000000000000003
bee0: 0000fcc728110850 6f43ffffffffffff 0000000000000000 0000000000800000
bf00: 000000000000001d 0000fcc7281107f8 0000fcc7281107f8 0000fcc728110840
bf20: 0000fcc728110458 0000000000000028 ffffffffffffffff 00002d18ec000000
bf40: 0000fcc72962af68 0000fcc729e2d0e0 0000fcc72810fc1a 0000fcc728111588
bf60: 0000fcc72962b000 0000ab36f6e99ac5 0000ab36f6e99a8e 0000000000000008
bf80: 0000ab36f6e99ac8 0000fcc728111588 0000ab36f6e99c0e 0000000000000006
bfa0: 0000fcc72902b108 0000fcc728110830 0000fcc729e2d16c 0000fcc728110740
bfc0: 0000fcc729e73758 00000000a0000000 000000000000003d 000000000000001d
bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[<ffff000008083ac0>] el0_svc_naked+0x34/0x38
Code: d503201f f9401e82 aa1303e1 f94006c0 (39c00842)
---[ end trace f7b45310362d53ac ]---
Kernel panic - not syncing: Fatal exception
SMP: stopping secondary CPUs
SMP: failed to stop secondary CPUs 0,2,4
Kernel Offset: disabled
CPU features: 0x180200c
Memory Limit: none
Rebooting in 5 seconds..
SMP: stopping secondary CPUs
SMP: failed to stop secondary CPUs 0,2,4

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:24 +08:00
e5daab383b MLK-22366-6 usb: cdns3: gadget: do not call disconnect if it is not configured
Fix below oops:
init: Received control message 'start' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: starting service 'adbd'...
init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=CONFIGURED
init: Received control message 'start' for 'adbd' from pid: 3499 (system_server)
init: Received control message 'stop' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
android_work: sent uevent USB_STATE=DISCONNECTED
audit: audit_lost=179935 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
audit: audit_lost=179970 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
using random self ethernet address
using random host ethernet address
read descriptors
read strings
usb0: HOST MAC f2:80:c5:eb:a1:fd
usb0: MAC 92:da:4f:13:01:73
android_work: did not send uevent (0 0           (null))
audit: audit_lost=180005 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
init: Received control message 'start' for 'adbd' from pid: 3499 (system_server)
composite_disconnect: Calling disconnect on a Gadget that is                      not connected
android_work: did not send uevent (0 0           (null))
init: Received control message 'stop' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: Sending signal 9 to service 'adbd' (pid 22343) process group...
------------[ cut here ]------------
audit: audit_lost=180038 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
WARNING: CPU: 0 PID: 3468 at /home/tianyang/maddev_pie9.0/vendor/nxp-opensource/kernel_imx/drivers/usb/gadget/composite.c:2009 composite_disconnect+0x80/0x88
Modules linked in:
CPU: 0 PID: 3468 Comm: HWC-UEvent-Thre Not tainted 4.14.98-07846-g0b40a9b-dirty #16
Hardware name: Freescale i.MX8QM MEK (DT)
task: ffff8008f2349c00 task.stack: ffff00000b0a8000
PC is at composite_disconnect+0x80/0x88
LR is at composite_disconnect+0x80/0x88
pc : [<ffff0000089ff9b0>] lr : [<ffff0000089ff9b0>] pstate: 600001c5
sp : ffff000008003dd0
x29: ffff000008003dd0 x28: ffff8008f2349c00
x27: ffff000009885018 x26: ffff000008004000
Timeout for IPC response!
x25: ffff000009885018 x24: ffff000009c8e280
x23: ffff8008f2d98010 x22: 00000000000001c0
x21: ffff8008f2d98394 x20: ffff8008f2d98010
x19: 0000000000000000 x18: 0000e3956f4f075a
fxos8700 4-001e: i2c block read acc failed
x17: 0000e395735727e8 x16: ffff00000829f4d4
x15: ffffffffffffffff x14: 7463656e6e6f6320
x13: 746f6e2009090920 x12: 7369207461687420
x11: 7465676461472061 x10: 206e6f207463656e
x9 : 6e6f637369642067 x8 : ffff000009c8e280
x7 : ffff0000086ca6cc x6 : ffff000009f15e78
x5 : 0000000000000000 x4 : 0000000000000000
x3 : ffffffffffffffff x2 : c3f28b86000c3900
x1 : c3f28b86000c3900 x0 : 000000000000004e

X20: 0xffff8008f2d97f90:
7f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
libprocessgroup: Failed to kill process cgroup uid 0 pid 22343 in 215ms, 1 processes remain
7fd0
Timeout for IPC response!
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
using random self ethernet address
7ff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
8010  00000100 00000000 f2d98018 ffff8008 f2d98018 ffff8008 08a067dc
using random host ethernet address
 ffff0000
8030  f206d800 ffff8008 091c3650 ffff0000 f7957b18 ffff8008 f7957730 ffff8008
8050  f716a630 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
8070  f76c8010 ffff8008 f716a800 ffff8008 095cac68 ffff0000 f206d828 ffff8008

X21: 0xffff8008f2d98314:
8314  ffff8008 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8334  00000000 00000000 00000000 00000000 00000000 08a04cf4 ffff0000 00000000
8354  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8374  00000000 00000000 00000000 00001001 00000000 00000000 00000000 00000000
8394  e4bbe4bb 0f230000 ffff0000 0afae000 ffff0000 ae001000 00000000 f206d400
Timeout for IPC response!
83b4  ffff8008 00000000 00000000 f7957b18 ffff8008 f7957718 ffff8008 f7957018
83d4  ffff8008 f7957118 ffff8008 f7957618 ffff8008 f7957818 ffff8008 f7957918
83f4  ffff8008 f7957d18 ffff8008 00000000 00000000 00000000 00000000 00000000

X23: 0xffff8008f2d97f90:
7f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7ff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
8010  00000100 00000000 f2d98018 ffff8008 f2d98018 ffff8008 08a067dc ffff0000
8030  f206d800 ffff8008 091c3650 ffff0000 f7957b18 ffff8008 f7957730 ffff8008
8050  f716a630 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
8070  f76c8010 ffff8008 f716a800 ffff8008 095cac68 ffff0000 f206d828 ffff8008

X28: 0xffff8008f2349b80:
9b80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ba0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9bc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9be0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c00  00000022 00000000 ffffffff ffffffff 00010001 00000000 00000000 00000000
9c20  0b0a8000 ffff0000 00000002 00404040 00000000 00000000 00000000 00000000
9c40  00000001 00000000 00000001 00000000 001ebd44 00000001 f390b800 ffff8008
9c60  00000000 00000001 00000070 00000070 00000070 00000000 09031d48 ffff0000

Call trace:
Exception stack(0xffff000008003c90 to 0xffff000008003dd0)
3c80:                                   000000000000004e c3f28b86000c3900
3ca0: c3f28b86000c3900 ffffffffffffffff 0000000000000000 0000000000000000
3cc0: ffff000009f15e78 ffff0000086ca6cc ffff000009c8e280 6e6f637369642067
3ce0: 206e6f207463656e 7465676461472061 7369207461687420 746f6e2009090920
3d00: 7463656e6e6f6320 ffffffffffffffff ffff00000829f4d4 0000e395735727e8
3d20: 0000e3956f4f075a 0000000000000000 ffff8008f2d98010 ffff8008f2d98394
3d40: 00000000000001c0 ffff8008f2d98010 ffff000009c8e280 ffff000009885018
3d60: ffff000008004000 ffff000009885018 ffff8008f2349c00 ffff000008003dd0
3d80: ffff0000089ff9b0 ffff000008003dd0 ffff0000089ff9b0 00000000600001c5
3da0: ffff8008f33f2cd8 0000000000000000 0000ffffffffffff 0000000000000000
init: Received control message 'start' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
3dc0: ffff000008003dd0 ffff0000089ff9b0
[<ffff0000089ff9b0>] composite_disconnect+0x80/0x88
[<ffff000008a044d4>] android_disconnect+0x3c/0x68
[<ffff0000089ba9f8>] cdns3_device_irq_handler+0xfc/0x2c8
[<ffff0000089b84c0>] cdns3_irq+0x44/0x94
[<ffff00000814494c>] __handle_irq_event_percpu+0x60/0x24c
[<ffff000008144c0c>] handle_irq_event+0x58/0xc0
[<ffff00000814873c>] handle_fasteoi_irq+0x98/0x180
[<ffff000008143a10>] generic_handle_irq+0x24/0x38
[<ffff000008144170>] __handle_domain_irq+0x60/0xac
[<ffff0000080819c4>] gic_handle_irq+0xd4/0x17c
Exception stack(0xffff00000b0ab950 to 0xffff00000b0aba90)

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:23 +08:00
6f37e02265 MLK-22366-5 usb: cdns3: ep0: check NULL pointer before calling composite_setup
Fix below oops at stress USB switch test at android:
read strings
audit: rate limit exceeded
android_work: did not send uevent (0 0           (null))
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
configfs-gadget gadget: super-speed config #1: b
android_work: sent uevent USB_STATE=CONFIGURED
init: Received control message 'start' for 'adbd' from pid: 3515 (system_server)
Unable to handle kernel NULL pointer dereference at virtual address 0000002a
init: Received control message 'stop' for 'adbd' from pid: 3375 (/vendor/bin/hw/android.hardware.usb@1.1-servic)
Mem abort info:
  Exception class = DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x00000004
  CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgd = ffff8008f1b7f000
[000000000000002a] *pgd=0000000000000000
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 4 PID: 2457 Comm: irq/125-5b11000 Not tainted 4.14.98-07846-g0b40a9b-dirty #16
Hardware name: Freescale i.MX8QM MEK (DT)
task: ffff8008f2a98000 task.stack: ffff00000b7b8000
PC is at composite_setup+0x44/0x1508
LR is at android_setup+0xb8/0x13c
pc : [<ffff0000089ffb3c>] lr : [<ffff000008a032fc>] pstate: 800001c5
sp : ffff00000b7bbb80
x29: ffff00000b7bbb80 x28: ffff8008f2a3c010
x27: 0000000000000001 x26: 0000000000000000                                                          [1232/1897]
audit: audit_lost=25791 audit_rate_limit=5 audit_backlog_limit=64
x25: 00000000ffffffa1 x24: ffff8008f2a3c010
audit: rate limit exceeded
x23: 0000000000000409 x22: ffff000009c8e000
x21: ffff8008f7a8b428 x20: ffff00000afae000
x19: ffff0000089ff000 x18: 0000000000000000
x17: 0000000000000000 x16: ffff0000082b7c9c
x15: 0000000000000000 x14: f1866f5b952aca46
x13: e35502e30d44349c x12: 0000000000000008
x11: 0000000000000008 x10: 0000000000000a30
x9 : ffff00000b7bbd00 x8 : ffff8008f2a98a90
x7 : ffff8008f27a9c90 x6 : 0000000000000001
x5 : 0000000000000000 x4 : 0000000000000001
x3 : 0000000000000000 x2 : 0000000000000006
x1 : ffff0000089ff8d0 x0 : 732a010310b9ed00

X7: 0xffff8008f27a9c10:
9c10  00000002 00000000 00000001 00000000 13110000 ffff0000 00000002 00208040
9c30  00000000 00000000 00000000 00000000 00000000 00000005 00000029 00000000
9c50  00051778 00000001 f27a8e00 ffff8008 00000005 00000000 00000078 00000078
9c70  00000078 00000000 09031d48 ffff0000 00100000 00000000 00400000 00000000
9c90  00000001 00000000 00000000 00000000 00000000 00000000 ffefb1a0 ffff8008
9cb0  f27a9ca8 ffff8008 00000000 00000000 b9d88037 00000173 1618a3eb 00000001
9cd0  870a792a 0000002e 16188fe6 00000001 0000242b 00000000 00000000 00000000
using random self ethernet address
9cf0  019a4646 00000000 000547f3 00000000 ecfd6c33 00000002 00000000
using random host ethernet address
 00000000

X8: 0xffff8008f2a98a10:
8a10  00000000 00000000 f7788d00 ffff8008 00000001 00000000 00000000 00000000
8a30  eb218000 ffff8008 f2a98000 ffff8008 f2a98000 ffff8008 09885000 ffff0000
8a50  f34df480 ffff8008 00000000 00000000 f2a98648 ffff8008 09c8e000 ffff0000
8a70  fff2c800 ffff8008 09031d48 ffff0000 0b7bbd00 ffff0000 0b7bbd00 ffff0000
8a90  080861bc ffff0000 00000000 00000000 00000000 00000000 00000000 00000000
8ab0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8ad0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8af0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

X21: 0xffff8008f7a8b3a8:
b3a8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
b3c8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
b3e8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
b408  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
b428  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
b448  0053004d 00540046 00300031 00010030 eb07b520 ffff8008 20011201 00000003
b468  e418d109 0104404e 00010302 00000000 eb07b558 ffff8008 eb07b558 ffff8008
b488  f7a8b488 ffff8008 f7a8b488 ffff8008 f7a8b300 ffff8008 00000000 00000000

X24: 0xffff8008f2a3bf90:
bf90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
c010  00000000 00000000 f2a3c018 ffff8008 f2a3c018 ffff8008 08a067dc ffff0000
c030  f2a5a000 ffff8008 091c3650 ffff0000 f716fd18 ffff8008 f716fe30 ffff8008
c050  f2ce4a30 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
c070  f76c8010 ffff8008 f2ce4b00 ffff8008 095cac68 ffff0000 f2a5a028 ffff8008

X28: 0xffff8008f2a3bf90:
bf90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
c010  00000000 00000000 f2a3c018 ffff8008 f2a3c018 ffff8008 08a067dc ffff0000
c030  f2a5a000 ffff8008 091c3650 ffff0000 f716fd18 ffff8008 f716fe30 ffff8008
c050  f2ce4a30 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
c070  f76c8010 ffff8008 f2ce4b00 ffff8008 095cac68 ffff0000 f2a5a028 ffff8008

Process irq/125-5b11000 (pid: 2457, stack limit = 0xffff00000b7b8000)
Call trace:
Exception stack(0xffff00000b7bba40 to 0xffff00000b7bbb80)
ba40: 732a010310b9ed00 ffff0000089ff8d0 0000000000000006 0000000000000000
ba60: 0000000000000001 0000000000000000 0000000000000001 ffff8008f27a9c90
ba80: ffff8008f2a98a90 ffff00000b7bbd00 0000000000000a30 0000000000000008
baa0: 0000000000000008 e35502e30d44349c f1866f5b952aca46 0000000000000000
bac0: ffff0000082b7c9c 0000000000000000 0000000000000000 ffff0000089ff000
bae0: ffff00000afae000 ffff8008f7a8b428 ffff000009c8e000 0000000000000409
bb00: ffff8008f2a3c010 00000000ffffffa1 0000000000000000 0000000000000001
bb20: ffff8008f2a3c010 ffff00000b7bbb80 ffff000008a032fc ffff00000b7bbb80
bb40: ffff0000089ffb3c 00000000800001c5 ffff00000b7bbb80 732a010310b9ed00
bb60: ffffffffffffffff ffff0000080f777c ffff00000b7bbb80 ffff0000089ffb3c
[<ffff0000089ffb3c>] composite_setup+0x44/0x1508
[<ffff000008a032fc>] android_setup+0xb8/0x13c
[<ffff0000089bd9a8>] cdns3_ep0_delegate_req+0x44/0x70
[<ffff0000089bdff4>] cdns3_check_ep0_interrupt_proceed+0x33c/0x654
[<ffff0000089bca44>] cdns3_device_thread_irq_handler+0x4b0/0x4bc
[<ffff0000089b77b4>] cdns3_thread_irq+0x48/0x68
[<ffff000008145bf0>] irq_thread_fn+0x28/0x88
[<ffff000008145e38>] irq_thread+0x13c/0x228
[<ffff0000080fed70>] kthread+0x104/0x130
[<ffff000008085064>] ret_from_fork+0x10/0x18
Code: 91234261 f94006ba f90057a0 79400a97 (3940ab40)
---[ end trace e8f0a7c675a161ca ]---
Kernel panic - not syncing: Fatal exception
SMP: stopping secondary CPUs
Kernel Offset: disabled
CPU features: 0x180200c
Memory Limit: none
Rebooting in 5 seconds..

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:22 +08:00
f8e6f51571 MLK-22366-4 usb: cdns3: gadget: don't call request handler for the unconfigured device
We don't need to notify the bus reset for class driver if the non-control
endpoints are not enabled. It could cause unnecessary disconnect event for
android due to below two reasons:
- Android declares the disconnect event for reset handler.
- The controller will get two reset interrupts at HS mode
it fixed two below oops:

oops #1

android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
android_work: sent uevent USB_STATE=CONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONFIGURED
android_work: sent uevent USB_STATE=DISCONNECTED
audit: audit_lost=8846 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
init: Received control message 'start' for 'adbd' from pid: 3275 (system_server)
android_work: sent uevent USB_STATE=CONNECTED
android_disconnect: gadget driver already disconnected
init: Received control message 'stop' for 'adbd' from pid: 3135
(/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: Sending signal 9 to service 'adbd' (pid 5859) process group...
android_work: sent uevent USB_STATE=DISCONNECTED
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5858 at kernel_imx/drivers/usb/gadget/configfs.c:1533 android_disconnect+0x60/0x68
Modules linked in:
audit: audit_lost=8877 audit_rate_limit=5 audit_backlog_limit=64
CPU: 0 PID: 5858 Comm: main Not tainted 4.14.98-07844-g346f959 #14
audit: rate limit exceeded
Hardware name: Freescale i.MX8QXP MEK (DT)
task: ffff800063950e00 task.stack: ffff00000daf8000
PC is at android_disconnect+0x60/0x68
LR is at android_disconnect+0x60/0x68
pc : [<ffff000008a044cc>] lr : [<ffff000008a044cc>] pstate: 600001c5
sp : ffff000008003e00
x29: ffff000008003e00 x28: ffff800063950e00
Timeout for IPC response!
x27: ffff000009885018 x26: ffff000008004000
Failed power operation on resource 248 sc_err 3
x25: ffff000009885018 x24: ffff000009c8e280
x23: ffff800836158810 x22: 00000000000001c0
x21: ffff800836158b94 x20: ffff800836158810
x19: 0000000000000000 x18: 0000f6cba5d06050
Synchronous External Abort: synchronous external abort (0x96000210) at 0xffff000011790024
x17: 0000f6cba74ac218 x16: ffff00000829be84
Internal error: : 96000210 [#1] PREEMPT SMP
Modules linked in:
x15: 0000f6cba5d067f0
x14: 0000f6cba5d0a3d0
CPU: 2 PID: 2353 Comm: kworker/2:1H Not tainted 4.14.98-07844-g346f959 #14
Hardware name: Freescale i.MX8QXP MEK (DT)
x13: 656c626174206665 x12: 078db5fab2ae6e00
Workqueue: kblockd blk_mq_run_work_fn
x11: ffff000008003ad0
task: ffff80083bf62a00 task.stack: ffff00000b5e8000
x10: ffff000008003ad0
PC is at esdhc_readl_le+0x8/0x15c
x9 : 0000000000000006
LR is at sdhci_send_command+0xc4/0xa54
x8 : ffff000009c8e280
pc : [<ffff000008b82ea4>] lr : [<ffff000008b6ca48>] pstate: 200001c5
i2c-rpmsg virtio0.rpmsg-i2c-channel.-1.2: rpmsg_xfer failed: timeout
fxos8700 14-001e: i2c block read acc failed
i2c-rpmsg virtio0.rpmsg-i2c-channel.-1.2: rpmsg_xfer failed: timeout

oops 2#:

init: Received control message 'start' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: starting service 'adbd'...
init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=CONFIGURED
init: Received control message 'start' for 'adbd' from pid: 3499 (system_server)
init: Received control message 'stop' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
android_work: sent uevent USB_STATE=DISCONNECTED
audit: audit_lost=179935 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
audit: audit_lost=179970 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
using random self ethernet address
using random host ethernet address
read descriptors
read strings
usb0: HOST MAC f2:80:c5:eb:a1:fd
usb0: MAC 92:da:4f:13:01:73
android_work: did not send uevent (0 0           (null))
audit: audit_lost=180005 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
init: Received control message 'start' for 'adbd' from pid: 3499 (system_server)
composite_disconnect: Calling disconnect on a Gadget that is                      not connected
android_work: did not send uevent (0 0           (null))
init: Received control message 'stop' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: Sending signal 9 to service 'adbd' (pid 22343) process group...
------------[ cut here ]------------
audit: audit_lost=180038 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
WARNING: CPU: 0 PID: 3468 at /home/tianyang/maddev_pie9.0/vendor/nxp-opensource/kernel_imx/drivers/usb/gadget/composite.c:2009 composite_disconnect+0x80/0x88
Modules linked in:
CPU: 0 PID: 3468 Comm: HWC-UEvent-Thre Not tainted 4.14.98-07846-g0b40a9b-dirty #16
Hardware name: Freescale i.MX8QM MEK (DT)
task: ffff8008f2349c00 task.stack: ffff00000b0a8000
PC is at composite_disconnect+0x80/0x88
LR is at composite_disconnect+0x80/0x88
pc : [<ffff0000089ff9b0>] lr : [<ffff0000089ff9b0>] pstate: 600001c5
sp : ffff000008003dd0
x29: ffff000008003dd0 x28: ffff8008f2349c00
x27: ffff000009885018 x26: ffff000008004000
Timeout for IPC response!
x25: ffff000009885018 x24: ffff000009c8e280
x23: ffff8008f2d98010 x22: 00000000000001c0
x21: ffff8008f2d98394 x20: ffff8008f2d98010
x19: 0000000000000000 x18: 0000e3956f4f075a
fxos8700 4-001e: i2c block read acc failed
x17: 0000e395735727e8 x16: ffff00000829f4d4
x15: ffffffffffffffff x14: 7463656e6e6f6320
x13: 746f6e2009090920 x12: 7369207461687420
x11: 7465676461472061 x10: 206e6f207463656e
x9 : 6e6f637369642067 x8 : ffff000009c8e280
x7 : ffff0000086ca6cc x6 : ffff000009f15e78
x5 : 0000000000000000 x4 : 0000000000000000
x3 : ffffffffffffffff x2 : c3f28b86000c3900
x1 : c3f28b86000c3900 x0 : 000000000000004e

X20: 0xffff8008f2d97f90:
7f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
libprocessgroup: Failed to kill process cgroup uid 0 pid 22343 in 215ms, 1 processes remain
7fd0
Timeout for IPC response!
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
using random self ethernet address
7ff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
8010  00000100 00000000 f2d98018 ffff8008 f2d98018 ffff8008 08a067dc
using random host ethernet address
 ffff0000
8030  f206d800 ffff8008 091c3650 ffff0000 f7957b18 ffff8008 f7957730 ffff8008
8050  f716a630 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
8070  f76c8010 ffff8008 f716a800 ffff8008 095cac68 ffff0000 f206d828 ffff8008

X21: 0xffff8008f2d98314:
8314  ffff8008 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8334  00000000 00000000 00000000 00000000 00000000 08a04cf4 ffff0000 00000000
8354  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8374  00000000 00000000 00000000 00001001 00000000 00000000 00000000 00000000
8394  e4bbe4bb 0f230000 ffff0000 0afae000 ffff0000 ae001000 00000000 f206d400
Timeout for IPC response!
83b4  ffff8008 00000000 00000000 f7957b18 ffff8008 f7957718 ffff8008 f7957018
83d4  ffff8008 f7957118 ffff8008 f7957618 ffff8008 f7957818 ffff8008 f7957918
83f4  ffff8008 f7957d18 ffff8008 00000000 00000000 00000000 00000000 00000000

X23: 0xffff8008f2d97f90:
7f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7ff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
8010  00000100 00000000 f2d98018 ffff8008 f2d98018 ffff8008 08a067dc ffff0000
8030  f206d800 ffff8008 091c3650 ffff0000 f7957b18 ffff8008 f7957730 ffff8008
8050  f716a630 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
8070  f76c8010 ffff8008 f716a800 ffff8008 095cac68 ffff0000 f206d828 ffff8008

X28: 0xffff8008f2349b80:
9b80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ba0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9bc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9be0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c00  00000022 00000000 ffffffff ffffffff 00010001 00000000 00000000 00000000
9c20  0b0a8000 ffff0000 00000002 00404040 00000000 00000000 00000000 00000000
9c40  00000001 00000000 00000001 00000000 001ebd44 00000001 f390b800 ffff8008
9c60  00000000 00000001 00000070 00000070 00000070 00000000 09031d48 ffff0000

Call trace:
Exception stack(0xffff000008003c90 to 0xffff000008003dd0)
3c80:                                   000000000000004e c3f28b86000c3900
3ca0: c3f28b86000c3900 ffffffffffffffff 0000000000000000 0000000000000000
3cc0: ffff000009f15e78 ffff0000086ca6cc ffff000009c8e280 6e6f637369642067
3ce0: 206e6f207463656e 7465676461472061 7369207461687420 746f6e2009090920
3d00: 7463656e6e6f6320 ffffffffffffffff ffff00000829f4d4 0000e395735727e8
3d20: 0000e3956f4f075a 0000000000000000 ffff8008f2d98010 ffff8008f2d98394
3d40: 00000000000001c0 ffff8008f2d98010 ffff000009c8e280 ffff000009885018
3d60: ffff000008004000 ffff000009885018 ffff8008f2349c00 ffff000008003dd0
3d80: ffff0000089ff9b0 ffff000008003dd0 ffff0000089ff9b0 00000000600001c5
3da0: ffff8008f33f2cd8 0000000000000000 0000ffffffffffff 0000000000000000
init: Received control message 'start' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
3dc0: ffff000008003dd0 ffff0000089ff9b0
[<ffff0000089ff9b0>] composite_disconnect+0x80/0x88
[<ffff000008a044d4>] android_disconnect+0x3c/0x68
[<ffff0000089ba9f8>] cdns3_device_irq_handler+0xfc/0x2c8
[<ffff0000089b84c0>] cdns3_irq+0x44/0x94
[<ffff00000814494c>] __handle_irq_event_percpu+0x60/0x24c
[<ffff000008144c0c>] handle_irq_event+0x58/0xc0
[<ffff00000814873c>] handle_fasteoi_irq+0x98/0x180
[<ffff000008143a10>] generic_handle_irq+0x24/0x38
[<ffff000008144170>] __handle_domain_irq+0x60/0xac
[<ffff0000080819c4>] gic_handle_irq+0xd4/0x17c
Exception stack(0xffff00000b0ab950 to 0xffff00000b0aba90)
b940:                                   ffff8008f2a65c00 0000000000000140
b960: 00000000000068ea ffff8008f6cf9c00 0000000000000000 0000000000000000
b980: ffff000009893800 ffff8008f23c38a8 ffff8008ffee21a0 00000000ffffffff
b9a0: 0000000000000001 6f6674616c702f73 30313162352f6d72 336273752e303030
b9c0: 3162352f6364752f ffffffffffffffff ffff00000829f4d4 0000e395735727e8
b9e0: 0000e3956f4f075a ffff8008f2a65c00 0000000000000001 0000000000000140
ba00: 00000000000000c3 0000000000000001 0000000000000001 ffff000009c8e000
ba20: ffff8008f2c5b940 ffff8008d5a6fb00 0000000000000067 ffff00000b0aba90
ba40: ffff00000812b354 ffff00000b0aba90 ffff000009010044 0000000060000145
ba60: 0000000000000140 00000000000000c3 0000ffffffffffff 0000000000000001
ba80: ffff00000b0aba90 ffff000009010044
[<ffff000008083230>] el1_irq+0xb0/0x124
[<ffff000009010044>] _raw_spin_unlock_irqrestore+0x18/0x48
[<ffff00000812b354>] __wake_up_common_lock+0xa0/0xd4
[<ffff00000812b3c0>] __wake_up_sync_key+0x1c/0x24
[<ffff000008d515f0>] sock_def_readable+0x40/0x70
[<ffff000008e7a71c>] unix_dgram_sendmsg+0x45c/0x728
[<ffff000008d4df10>] sock_write_iter+0x10c/0x124
[<ffff00000829c4e0>] do_iter_readv_writev+0xf8/0x160
[<ffff00000829d2e4>] do_iter_write.part.17+0x38/0x154
[<ffff00000829e9c4>] vfs_writev+0x114/0x158
[<ffff00000829ea68>] do_writev+0x60/0xe8
[<ffff00000829f4e4>] SyS_writev+0x10/0x18
Exception stack(0xffff00000b0abec0 to 0xffff00000b0ac000)
bec0: 000000000000000f 0000e3956f4f0cb0 0000000000000004 0000000000000003
bee0: 0000000000000067 0000000080000000 725705beff78606b 7f7f7fff7f7f7f7f
bf00: 0000000000000042 000000000000005c 0000e3956f4f0e60 0000000000000053
bf20: 0000e3956f4f0f98 ffffffffffffffff ffffffffff000000 ffffffffffffffff
bf40: 0000e39572bf0cc0 0000e395735727e8 0000e3956f4f075a 0000000000000000
bf60: 000000000000000f 0000e3956f4f0cb0 0000000000000004 0000e39572bf17e0
bf80: 0000e3956f4f2588 0000e39572bf1618 0000000000000004 0000000000000000
bfa0: 0000e39572bf1618 0000e3956f4f0d70 0000e39572bd4260 0000e3956f4f0cb0
bfc0: 0000e395735727f0 0000000060000000 000000000000000f 0000000000000042
bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[<ffff000008083ac0>] el0_svc_naked+0x34/0x38

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:22 +08:00
0f13bfdbb0 MLK-22366-3 usb: cdns3: gadget: set request as NULL when it is freed
Meanwhile, the pending_setup_status work item needs to be flushed after
EP0 is dequeued. It fixed below oops:

[  292.766596] android_work: sent uevent USB_STATE=DISCONNECTED
[  292.769602] ------------[ cut here ]------------
[  292.769631] WARNING: CPU: 3 PID: 88 at /home/b29397/work/projects/linux-imx/drivers/usb/gadget/composite.c:1383 com
posite_setup_complete+0xc8/0xd0
[  292.769639] Modules linked in:
[  292.790493] audit: audit_lost=5519 audit_rate_limit=5 audit_backlog_limit=64
[  292.796604] audit: rate limit exceeded
[  292.803165] CPU: 3 PID: 88 Comm: kworker/3:1 Not tainted 4.14.98-07842-g3848d2f45363-dirty #51
[  292.803168] Hardware name: Freescale i.MX8QXP MEK (DT)
[  292.803183] Workqueue: events_freezable cdns3_pending_setup_status_handler
[  292.803188] task: ffff80083ac68e80 task.stack: ffff00000ada8000
[  292.803195] PC is at composite_setup_complete+0xc8/0xd0
[  292.803200] LR is at composite_setup_complete+0xc8/0xd0
[  292.803204] pc : [<ffff000008aa17c8>] lr : [<ffff000008aa17c8>] pstate: 000001c5
[  292.803206] sp : ffff00000adabd70
[  292.803208] x29: ffff00000adabd70 x28: 0000000000000000
[  292.803215] x27: ffff80083abf8c38 x26: ffff000009619518
[  292.803227] x25: 0000000000000000 x24: ffff00000a150cf8
[  292.870582] x23: 0000000000000000 x22: ffff80083ff6c100
[  292.875901] x21: 0000000000000140 x20: ffff800836342718
[  292.881216] x19: ffff8000706e5900 x18: 0000000000000010
[  292.886533] x17: 0000eb3821d31268 x16: ffff000008313fc8
[  292.891850] x15: ffffffffffffffff x14: ffff00000a12e008
[  292.897166] x13: ffff00008a4319d7 x12: ffff00000a4319df
[  292.902483] x11: ffff00000a157000 x10: ffff00000adaba90
[  292.907801] x9 : 00000000ffffffd0 x8 : ffff000008729658
[  292.913116] x7 : 75716572206e776f x6 : 0000000000000006
[  292.918433] x5 : 0000000000000000 x4 : 0000000000000000
[  292.923749] x3 : 0000000000000000 x2 : 13710ac2b6ac9b00
[  292.929067] x1 : 0000000000000000 x0 : 0000000000000020
[  292.934397]
[  292.934397] X19: 0xffff8000706e5880:
[  292.939448] 5880  00004ef4 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  292.947651] 58a0  00000000 00000000 00004ef5 00000000 00000000 00000000 00000000 00000000
[  292.955860] 58c0  00000000 00000000 00000000 00000000 00000000 00000000 71f24600 ffff8000
[  292.964070] 58e0  00000300 00000001 706e58e0 ffff8000 395101c0 ffff8008 00000000 00000000
[  292.972280] 5900  706e5000 ffff8000 00000000 00000000 f47ff000 00000000 00000000 00000000
[  292.980487] 5920  00000000 00000000 00000000 00000000 08aa1700 ffff0000 3bb36428 ffff8008
[  292.988697] 5940  706e5940 ffff8000 706e5940 ffff8000 00000000 00000000 36342718 ffff8008
[  292.996907] 5960  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.005121]
[  293.005121] X20: 0xffff800836342698:
[  293.010181] 2698  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.014718] using random self ethernet address
[  293.018391] 26b8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.018413] 26d8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.018435] 26f8  00000000 00000000 36342900 ffff8008 3ac7c880 ffff8008 087e56b0 ffff0000
[  293.018458] 2718  3bb36428 ffff8008 363427a8 ffff8008 092cbfa0
[  293.030136] using random host ethernet address
[  293.031092]  ffff0000 00000000 00000000
[  293.031101] 2738  00000000 00000000 00000031 02000000 00000200 00000004 0a286238 ffff0000
[  293.031136] 2758  00000000 00000000 36342760 ffff8008 36342760 ffff8008 36342770 ffff8008
[  293.077978] 2778  36342770 ffff8008 36342780 ffff8008 36342780 ffff8008 0ae25000 ffff0000
[  293.086193]
[  293.086193] X22: 0xffff80083ff6c080:
[  293.091253] c080  3ff6c080 ffff8008 3ff6c080 ffff8008 ffffffe0 0000000f 3ff6c098 ffff8008
[  293.099463] c0a0  3ff6c098 ffff8008 080fb2b0 ffff0000 00000000 00000000 00000000 00000000
[  293.107672] c0c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.115882] c0e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.124083] c100  3ff68000 ffff8008 3a00ce00 ffff8008 00000000 ffffffff 00000002 00000001
[  293.132293] c120  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.140494] c140  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000100
[  293.148695] c160  3ff6c160 ffff8008 3ff6c160 ffff8008 3ff53170 ffff8008 3a00ce00 ffff8008
[  293.156903]
[  293.156903] X27: 0xffff80083abf8bb8:
[  293.161961] 8bb8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.170162] 8bd8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.178371] 8bf8  00000000 00000000 00000000 00000000 643a725f 5f706368 3aafd100 ffff8008
[  293.186583] 8c18  00000000 73706d75 00000000 74706f5f 3abf8c28 ffff8008 3abf8c28 ffff8008
[  293.194791] 8c38  00000000 dead0000 00000000 ffff8008 3abf8c48 ffff8008 3abf8c48 ffff8008
[  293.203001] 8c58  00000050 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.211210] 8c78  00000000 00000000 00000001 ffff8008 3607ac00 ffff8008 00000002 00000000
[  293.219420] 8c98  3abf8c98 ffff8008 00000000 00000000 00000000 00000000 3ad74fb0 ffff8008
[  293.227625]
[  293.229119] Call trace:
[  293.231573] Exception stack(0xffff00000adabc30 to 0xffff00000adabd70)
[  293.238027] bc20:                                   0000000000000020 0000000000000000
[  293.245865] bc40: 13710ac2b6ac9b00 0000000000000000 0000000000000000 0000000000000000
[  293.253707] bc60: 0000000000000006 75716572206e776f ffff000008729658 00000000ffffffd0
[  293.261543] bc80: ffff00000adaba90 ffff00000a157000 ffff00000a4319df ffff00008a4319d7
[  293.269379] bca0: ffff00000a12e008 ffffffffffffffff ffff000008313fc8 0000eb3821d31268
[  293.277217] bcc0: 0000000000000010 ffff8000706e5900 ffff800836342718 0000000000000140
[  293.285051] bce0: ffff80083ff6c100 0000000000000000 ffff00000a150cf8 0000000000000000
[  293.292887] bd00: ffff000009619518 ffff80083abf8c38 0000000000000000 ffff00000adabd70
[  293.300723] bd20: ffff000008aa17c8 ffff00000adabd70 ffff000008aa17c8 00000000000001c5
[  293.308562] bd40: ffff000008aa1700 0000000000000000 ffffffffffffffff ffff800838000058
[  293.316406] bd60: ffff00000adabd70 ffff000008aa17c8
[  293.321303] [<ffff000008aa17c8>] composite_setup_complete+0xc8/0xd0
[  293.327584] [<ffff000008a56040>] cdns3_pending_setup_status_handler+0x70/0x98
[  293.334729] [<ffff0000080fe1e0>] process_one_work+0x1d8/0x470
[  293.340476] [<ffff0000080fe4c4>] worker_thread+0x4c/0x458
[  293.345885] [<ffff0000081052ec>] kthread+0x134/0x138
[  293.350862] [<ffff00000808525c>] ret_from_fork+0x10/0x1c
[  293.356175] ---[ end trace 9b2dcf754a0dbda5 ]---
[  293.392462] init: Service 'adbd' (pid 4743) received signal 9
[  293.399231] init: Sending signal 9 to service 'adbd' (pid 4743) process group...
[  293.412539] libprocessgroup: Successfully killed process cgroup uid 0 pid 4743 in 4ms
[  295.781315] init: Received control message 'start' for 'adbd' from pid: 3253 (system_server)
[  295.790279] init: starting service 'adbd'...
[  295.798116] init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:22 +08:00
17cb94a10a MLK-22366-2 usb: cdns3: gadget: fix the hot plug and function switch issue
- If the UDC is not started, we need not to access register at .udc_stop
- Clear all priv_ep flags except EP_CLAIMED which should be cleared at
.udc_stop
- Clear warning message that the .ep_disable may be called twice, one
from class driver, one from UDC driver.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:21 +08:00
6cdfc74523 MLK-22366-1 usb: cdns3: gadget: enlarge the TD list
At Android ADB and MTP use case, TD consumes very fast compared to TD has
finished, so we need to enlarge the TD list to avoid "no free TD error".

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:20 +08:00
31a13eb06a MLK-22094 usb: cdns3: include head directory to find it
define_trace.h needs to know how to find our header, otherwise
we will have below build error:

In file included from drivers/usb/cdns3/trace.h:446:0,
                 from drivers/usb/cdns3/trace.c:11:
./include/trace/define_trace.h:89:43: fatal error: ./trace.h: No such
file or directory
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
                                           ^
compilation terminated.
scripts/Makefile.build:326: recipe for target
'drivers/usb/cdns3/trace.o' failed
make[3]: *** [drivers/usb/cdns3/trace.o] Error 1
make[3]: *** Waiting for unfinished jobs....
  CC      drivers/usb/host/pci-quirks.o
  CC      drivers/usb/isp1760/isp1760-core.o
  CC      drivers/usb/misc/ehset.o
  CC      drivers/usb/isp1760/isp1760-if.o
scripts/Makefile.build:585: recipe for target 'drivers/usb/cdns3' failed
make[2]: *** [drivers/usb/cdns3] Error 2
make[2]: *** Waiting for unfinished jobs....
  CC      drivers/usb/misc/usb3503.o
  CC      drivers/usb/host/ehci-hcd.o
  CC      drivers/usb/isp1760/isp1760-hcd.o

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit b0067d4b7c)
2019-11-25 15:56:20 +08:00
467e16fe25 MLK-18579-2 usb: cdns3: xhci: disable BEI support
The Cadence xHCI doesn't support BEI well, it causes the disconnection
of ISOC devices can't be detected, so we disable it.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 258bb7de5b)
2019-11-25 15:56:19 +08:00
b9fb073145 MLK-18579-1 usb: cdns3: using upstream multiple TD driver
Keep the internal framework, just use the UDC driver from
upstream version which supports multiple TD.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:17 +08:00
a07b01773a MLK-16065-6 doc: binding: cdns-usb3: add binding-doc for Cadence USB3
Add binding-doc for Cadence USB3

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:17 +08:00
86f778d416 MLK-20754 usb: cdns3: add role switch sys entry
It is an experimental feature, and tested by internal team for
Carplay feature.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 270c1ea516)
2019-11-25 15:56:17 +08:00
e4cf494471 MA-13475 usb: cdns3: gadget: fix NULL pointer issue when switch functions
Below oops is reproduced when switch between mtp and ptp function
at Android, the interrupt occurs when the usb_ss->gadget_driver
is already NULL. In this commit, we add NULL pointer check for
it as well as protecting for clear usb_ss->gadget_driver.

init: Sending signal 9 to service 'adbd' (pid 4644) process group...
Mem abort info:
  Exception class = DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x00000004
  CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgd = ffff800830e49000
[0000000000000020] *pgd=0000000000000000
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in: wlan
CPU: 0 PID: 3226 Comm: surfaceflinger Not tainted 4.14.98 #1
init: Successfully killed process cgroup uid 0 pid 4644 in 11ms
Hardware name: Freescale i.MX8QXP MEK (DT)
task: ffff80083bf55400 task.stack: ffff00000ffe8000
PC is at cdns_get_setup_ret+0x38/0x64
LR is at cdns_get_setup_ret+0x24/0x64
pc : [<ffff0000089b0e88>] lr : [<ffff0000089b0e74>] pstate: 000001c5
sp : ffff000008003d10
x29: ffff000008003d10 x28: ffff80083bf55400
x27: ffff000009873018 x26: ffff000008004000
x25: ffff000009873018 x24: ffff000009c6a288
x23: ffff000008003f24 x22: ffff00000a85e000
x21: 0000000000000001 x20: ffff8008361c97b8
x19: ffff8008361c9000 x18: 0000000000000001
x17: 0000fe6e544aee34 x16: ffff0000082b54f0
x15: 0000ffffccae15f0 x14: 0000000000000000
x13: 0000000000000000 x12: 0000000000010000
x11: 0000000000000040 x10: 0000000000000040
x9 : ffff8008380ae238 x8 : ffff800838000248
x7 : 0000000000000000 x6 : ffff800838000248
init: Service 'adbd' (pid 4644) killed by signal 9
x5 : ffff80083ae40600 x4 : 0000000000000000
x3 : 00000000000001c0 x2 : 0000000000000000
x1 : ffff00000a85e000 x0 : ffff8008361c9300

X0: 0xffff8008361c9280:
9280  00000000 00000000 00000000 00000000 000f000f
init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15)
 00000000 3bf6ce00 ffff8008
92a0  3acd9a00 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
92c0  00000000 00000000 00000000 00000000 00000000 00000000 089b0e3c ffff0000
92e0  00000000
init: processing action (sys.usb.config=mtp,adb && sys.usb.configfs=1) from (/init.usb.configfs.rc:33)
 00000000 00000000 00000000
read descriptors
read strings
init: starting service 'adbd'...
 00000000
init: property_set("ro.boottime.adbd", "97804848500") failed: property already set
init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000
 00000000 0e0f0000 ffff0000
9300  3ff21105 ffff8008 3ff1d120 ffff8008 2e15d4e0 ffff8008 089f9558 ffff0000
9320  3618ac00 ffff8008 091b7860 ffff0000 3bf6ce18 ffff8008 3bf6cd30
read descriptors
read strings
 ffff8008
9340  3acd9a30 ffff8008 00000000 00000005 00000000 00000000 095c4e58 ffff0000
9360  361c9000 ffff8008 3acd9700 ffff8008 095be4c8 ffff0000 3618ac28 ffff8008

X5: 0xffff80083ae40580:
0580  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
05a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
05c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
05e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0600  03440204 ffffffff 00000000 00000000 00000000 00000000 0000000f 00000000
0620  00000001 00000000 00000000 00000030 0000010f 00000000 3ae40600 ffff8008
0640  09d7aae0 ffff0000 3a088000 ffff8008 3aa22c80 ffff8008 00000000 00000000
0660  09886e24 ffff0000 081496ec ffff0000 3b444080 ffff8008 00000000 00000000

X6: 0xffff8008380001c8:
01c8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
01e8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0208  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0228  fffffc00 ffffffff 00000000 00000000 00000000 00000000 38000248 ffff8008
0248  003f0000 00000000 380af6c0 ffff8008 09c937f0 ffff0000 38000260 ffff8008
0268  38000260 ffff8008 00000000 00000000 3a007400 ffff8008 3a007600 ffff8008
0288  3a007800 ffff8008 3a007a00 ffff8008 3a007c00 ffff8008 3a6be600 ffff8008
02a8  3ab1da00 ffff8008 3ab1dc00 ffff8008 3ab1de00 ffff8008 3ac52000 ffff8008

X8: 0xffff8008380001c8:
01c8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
01e8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0208  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0228  fffffc00 ffffffff 00000000 00000000 00000000 00000000 38000248 ffff8008
0248  003f0000 00000000 380af6c0 ffff8008 09c937f0 ffff0000 38000260 ffff8008
0268  38000260 ffff8008 00000000 00000000 3a007400 ffff8008 3a007600 ffff8008
0288  3a007800 ffff8008 3a007a00 ffff8008 3a007c00 ffff8008 3a6be600 ffff8008
02a8  3ab1da00 ffff8008 3ab1dc00 ffff8008 3ab1de00 ffff8008 3ac52000 ffff8008

X9: 0xffff8008380ae1b8:
e1b8  3ae1ddd0 ffff8008 3ae1de58 ffff8008 3ae1dee0 ffff8008 3ae1df68 ffff8008
e1d8  3aad9000 ffff8008 3aad9088 ffff8008 3aad9110 ffff8008 3aad9198 ffff8008
e1f8  3aad9220 ffff8008 3aad92a8 ffff8008 3aad9330 ffff8008 3aad93b8 ffff8008
e218  00000000 00000000 00000000 00000000 00000000 00000000 380ae238 ffff8008
e238  000b0400 00000000 3802c490 ffff8008 3a081060 ffff8008 380ae250 ffff8008
e258  380ae250 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
e278  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
e298  00000000 00000000 3aea2c28 ffff8008 3aea2e28 ffff8008 00000000 00000000

X19: 0xffff8008361c8f80:
8f80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8fa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8fc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9000  3ab9f410 ffff8008 3bf6b000 ffff8008 095c4e48 ffff0000 361c9378 ffff8008
9020  360ed558 ffff8008 3ab9f420 ffff8008 3a7d5800 ffff8008 09d9fa00 ffff0000
9040  361b94c8 ffff8008 00000006 00000003 00000000 00000000 00000000 00000000
9060  00000000 00000000 00000000 00000000 361c9070 ffff8008 361c9070 ffff8008

X20: 0xffff8008361c9738:
9738  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9758  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9778  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9798  0000000e 00000000 71a71600 ffff8000 00000000 00000000 00000000 00000000
97b8  044c044c 00000002 00000000 00000000 00000001 00000000 3ab9f410 ffff8008
97d8  00000001 00000000 3bf6cc70 ffff8008 3bf6c170 ffff8008 00000000 00000000
97f8  00000000 00000000 361c9800 ffff8008 361c9800 ffff8008 089b1dc8 ffff0000
9818  71a71600 ffff8000 00000000 00000000 00000000 00000000 00000000 00000000

X28: 0xffff80083bf55380:
5380  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
53a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
53c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
53e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
5400  00000022 00000000 ffffffff ffffffff 00010001 00000000 00000000 00000000
5420  0ffe8000 ffff0000 00000006 00404100 00000000 00000000 00000000 00000000
5440  00000001 00000000 000000e6 00000000 ffff3a2d 00000000 30c10000 ffff8008
5460  00000000 00000001 00000062 00000070 00000062 00000001 09023e38 ffff0000

Process surfaceflinger (pid: 3226, stack limit = 0xffff00000ffe8000)
Call trace:
Exception stack(0xffff000008003bd0 to 0xffff000008003d10)
3bc0:                                   ffff8008361c9300 ffff00000a85e000
3be0: 0000000000000000 00000000000001c0 0000000000000000 ffff80083ae40600
3c00: ffff800838000248 0000000000000000 ffff800838000248 ffff8008380ae238
3c20: 0000000000000040 0000000000000040 0000000000010000 0000000000000000
3c40: 0000000000000000 0000ffffccae15f0 ffff0000082b54f0 0000fe6e544aee34
3c60: 0000000000000001 ffff8008361c9000 ffff8008361c97b8 0000000000000001
3c80: ffff00000a85e000 ffff000008003f24 ffff000009c6a288 ffff000009873018
3ca0: ffff000008004000 ffff000009873018 ffff80083bf55400 ffff000008003d10
3cc0: ffff0000089b0e74 ffff000008003d10 ffff0000089b0e88 00000000000001c5
3ce0: 00000000000001c0 1a8824534cfb2000 0000ffffffffffff ffff0000080f87c8
3d00: ffff000008003d10 ffff0000089b0e88
[<ffff0000089b0e88>] cdns_get_setup_ret+0x38/0x64
[<ffff0000089b2a48>] cdns_check_ep0_interrupt_proceed+0xc0/0x8dc
[<ffff0000089b3508>] cdns_irq_handler_thread+0x2a4/0x4e8
[<ffff0000089afd98>] cdns3_irq+0x44/0x94
[<ffff000008145994>] __handle_irq_event_percpu+0x60/0x24c
[<ffff000008145c54>] handle_irq_event+0x58/0xc0
[<ffff000008149784>] handle_fasteoi_irq+0x98/0x180
[<ffff000008144a58>] generic_handle_irq+0x24/0x38
[<ffff0000081451b8>] __handle_domain_irq+0x60/0xac
[<ffff0000080819c4>] gic_handle_irq+0xd4/0x17c

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 6ee6e32b0c)
2019-11-25 15:56:16 +08:00
0d1d3ffd17 MLK-21073 usb: cdns3: core: fix the oops when the interrupt occurs during suspend
When the interrupt occurs during the USB is entering suspend, the
cdns->lpm flag may not be updated well, the below oops may occur.
We treat above interrupt as wakeup interrupt, it should be handled
after lpm flag is set.

irq 120: nobody cared (try booting with the "irqpoll" option)
CPU: 0 PID: 107 Comm: kworker/0:1 Tainted: G           O    4.14.78 #1
Hardware name: Freescale i.MX8QM MEK (DT)
Workqueue: pm pm_runtime_work
Call trace:
[<ffff000008083230>] el1_irq+0xb0/0x124
[<ffff000009028fcc>] _raw_spin_unlock_irqrestore+0x18/0x48
[<ffff000008147a6c>] __irq_put_desc_unlock+0x1c/0x44
[<ffff000008149e4c>] enable_irq+0x54/0x90
[<ffff0000089cb08c>] cdns3_enter_suspend+0x30c/0x3ac
[<ffff0000089cb274>] cdns3_runtime_suspend+0x40/0x78
[<ffff000008796cd8>] pm_generic_runtime_suspend+0x28/0x48
[<ffff0000087a7400>] genpd_runtime_suspend+0x90/0x21c
[<ffff00000879a14c>] __rpm_callback+0x130/0x264
[<ffff00000879a2a4>] rpm_callback+0x24/0x78
[<ffff000008798ec8>] rpm_suspend+0x10c/0x668
[<ffff0000087996b4>] rpm_idle+0x1c0/0x390
[<ffff00000879aa6c>] pm_runtime_work+0x94/0xe0
[<ffff0000080fac88>] process_one_work+0x140/0x3f8
[<ffff0000080fb078>] worker_thread+0x138/0x3e4
[<ffff0000081014e0>] kthread+0x104/0x130
[<ffff00000808552c>] ret_from_fork+0x10/0x18

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 1befe1d04e)
(cherry picked from commit 35574d63d9)
2019-11-25 15:56:16 +08:00
67481f9ff8 MLK-20585-2 usb: cdns3: gadget: fix the KASAN issue
BUG: KASAN: use-after-free in pending_setup_status_handler+0x4c/0x9c
Read of size 8 at addr ffff8008b2fb6130 by task kworker/0:1/4432

CPU: 0 PID: 4432 Comm: kworker/0:1 Not tainted 4.14.78-06631-gd2e1817-dirty #18
Hardware name: Freescale i.MX8QM MEK (DT)
Workqueue: events_freezable pending_setup_status_handler
Call trace:
[<ffff20000808dff8>] dump_backtrace+0x0/0x49c
[<ffff20000808e4a8>] show_stack+0x14/0x1c
[<ffff20000967b808>] dump_stack+0xa0/0xc8
[<ffff200008344f80>] print_address_description+0x124/0x2f8
[<ffff200008345404>] kasan_report+0x200/0x348
[<ffff200008343780>] __asan_load8+0x6c/0x84
[<ffff200008d897d8>] pending_setup_status_handler+0x4c/0x9c
[<ffff2000081236e4>] process_one_work+0x250/0x72c
[<ffff200008123c58>] worker_thread+0x98/0x69c
[<ffff20000812cd00>] kthread+0x170/0x1b0
[<ffff200008085cd8>] ret_from_fork+0x10/0x18

Allocated by task 4689:
 kasan_kmalloc.part.5+0x50/0x124
 kasan_kmalloc+0xc4/0xe4
 kmem_cache_alloc_trace+0x13c/0x298
 usb_ss_gadget_ep_alloc_request+0x48/0x50
 usb_ep_alloc_request+0x44/0x16c
 composite_dev_prepare+0x4c/0x1b8
 configfs_composite_bind+0x6c/0x694
 udc_bind_to_driver+0xcc/0x218
 usb_gadget_probe_driver+0x108/0x1b0
 gadget_dev_desc_UDC_store+0xf4/0x174
 configfs_write_file+0x184/0x25c
 vfs_write+0xf0/0x26c
 SyS_write+0x64/0xd4
 el0_svc_naked+0x34/0x38

Freed by task 3406:
 kasan_slab_free+0xb0/0x1c0
 kfree+0x7c/0x270
 usb_ss_gadget_ep_free_request+0x10/0x18
 usb_ep_free_request+0x44/0x158
 composite_dev_cleanup+0x188/0x230
 configfs_composite_unbind+0x48/0x80
 usb_gadget_remove_driver+0x84/0xf0
 usb_gadget_unregister_driver+0x10c/0x134
 gadget_dev_desc_UDC_store+0xa0/0x174
 configfs_write_file+0x184/0x25c
 vfs_write+0xf0/0x26c
 SyS_write+0x64/0xd4
 el0_svc_naked+0x34/0x38

The buggy address belongs to the object at ffff8008b2fb6100
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 48 bytes inside of
 128-byte region [ffff8008b2fb6100, ffff8008b2fb6180)
The buggy address belongs to the page:
page:ffff7e0022cbed80 count:1 mapcount:0 mapping:          (null) index:0x0

Reported-by: Yang Tian <yang.tian@nxp.com>
Tested-by: Yang Tian <yang.tian@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 0cf9ae2a80)
2019-11-25 15:56:15 +08:00
150ce1ee8e MLK-20585-1 usb: cdns3: gadget: fix the KASAN issue
BUG: KASAN: use-after-free in cdns3_gadget_remove+0x114/0x1d8
Read of size 8 at addr ffff80081f8817a0 by task swapper/0/1

CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.78-05577-gbe1ecd23b99a-dirty #231
Hardware name: Freescale i.MX8QXP MEK (DT)
Call trace:
[<ffff20000808cd10>] dump_backtrace+0x0/0x510
[<ffff20000808d234>] show_stack+0x14/0x20
[<ffff200009471d84>] dump_stack+0xa4/0xc8
[<ffff2000082966c0>] print_address_description+0x60/0x250
[<ffff200008296bb8>] kasan_report+0x240/0x308
[<ffff2000082952e0>] __asan_load8+0x88/0xb0
[<ffff200008d089cc>] cdns3_gadget_remove+0x114/0x1d8
[<ffff200008d0220c>] cdns3_probe+0x634/0x940
[<ffff2000089ebf10>] platform_drv_probe+0x70/0xf0
[<ffff2000089e9060>] driver_probe_device+0x388/0x5f0
[<ffff2000089e9414>] __driver_attach+0x14c/0x150
[<ffff2000089e5dd8>] bus_for_each_dev+0xd8/0x138
[<ffff2000089e8560>] driver_attach+0x30/0x40
[<ffff2000089e7c38>] bus_add_driver+0x278/0x3a0
[<ffff2000089ea27c>] driver_register+0xb4/0x198
[<ffff2000089ebe0c>] __platform_driver_register+0x7c/0x88
[<ffff20000a0d78e8>] cdns3_driver_platform_register+0x1c/0x24
[<ffff200008083cc0>] do_one_initcall+0x90/0x1b8
[<ffff20000a071040>] kernel_init_freeable+0x238/0x2d8
[<ffff20000948c2a8>] kernel_init+0x10/0x118
[<ffff200008085450>] ret_from_fork+0x10/0x18

Allocated by task 1:
 kasan_kmalloc+0xd8/0x188
 __cdns3_gadget_init+0xb8/0x998
 cdns3_gadget_init+0xbc/0xd0
 cdns3_probe+0x718/0x940
 platform_drv_probe+0x70/0xf0
 driver_probe_device+0x388/0x5f0
 __driver_attach+0x14c/0x150
 bus_for_each_dev+0xd8/0x138
 driver_attach+0x30/0x40
 bus_add_driver+0x278/0x3a0
 driver_register+0xb4/0x198
 __platform_driver_register+0x7c/0x88
 cdns3_driver_platform_register+0x1c/0x24
 do_one_initcall+0x90/0x1b8
 kernel_init_freeable+0x238/0x2d8
 kernel_init+0x10/0x118
 ret_from_fork+0x10/0x18

Freed by task 1:
 kasan_slab_free+0x88/0x188
 kfree+0x70/0x1e0
 cdns3_gadget_release+0x60/0x80
 device_release+0x44/0xd8
 kobject_put+0xd8/0x280
 device_unregister+0x28/0x80
 cdns3_gadget_remove+0x100/0x1d8
 cdns3_probe+0x634/0x940
 platform_drv_probe+0x70/0xf0
 driver_probe_device+0x388/0x5f0
 __driver_attach+0x14c/0x150
 bus_for_each_dev+0xd8/0x138
 driver_attach+0x30/0x40
 bus_add_driver+0x278/0x3a0
 driver_register+0xb4/0x198
 __platform_driver_register+0x7c/0x88
 cdns3_driver_platform_register+0x1c/0x24
 do_one_initcall+0x90/0x1b8
 kernel_init_freeable+0x238/0x2d8
 kernel_init+0x10/0x118
 ret_from_fork+0x10/0x18

The buggy address belongs to the object at ffff80081f881100
 which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 1696 bytes inside of
 4096-byte region [ffff80081f881100, ffff80081f882100)
The buggy address belongs to the page:
page:ffff7e00207e2000 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x1fffc00000008100(slab|head)
raw: 1fffc00000008100 0000000000000000 0000000000000000 0000000180070007
raw: dead000000000100 dead000000000200 ffff800822003200 0000000000000000
page dumped because: kasan: bad access detected

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 68e0107f55)
2019-11-25 15:56:15 +08:00
c90aced5e2 MLK-20599-2 usb: cdns3: gadget: fix link test TD 7.37
USB3 device should accept LGO_U1 request after receiving SET_CONFIGURATION.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 979c91e49c)
2019-11-25 15:56:14 +08:00
b7dbdb1c09 MLK-20599-1 usb: cdns3: gadget: fix link test TD 7.23
The USB compliance link test TD 7.23 requires the U1 exit time
is from 900ns to 1.2us, the current code is 744ns, the default
value is 1.104us, so changing it as default value.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit ec499d83ba)
2019-11-25 15:56:14 +08:00
7b7df2836a MLK-19601-1 usb: cdns3: host: Fix leaking USB3 shared_hcd at xhci removal
(Merged upstream reviewing patch, and add cdns support -- Peter Chen)

Ensure that the shared_hcd pointer is valid when calling usb_put_hcd()

The shared_hcd is removed and freed in xhci by first calling
usb_remove_hcd(xhci->shared_hcd), and later
usb_put_hcd(xhci->shared_hcd)

Afer commit fe190ed0d6 ("xhci: Do not halt the host until both HCD have
disconnected their devices.") the shared_hcd was never properly put as
xhci->shared_hcd was set to NULL before usb_put_hcd(xhci->shared_hcd) was
called.

shared_hcd (USB3) is removed before primary hcd (USB2).
While removing the primary hcd we might need to handle xhci interrupts
to cleanly remove last USB2 devices, therefore we need to set
xhci->shared_hcd to NULL before removing the primary hcd to let xhci
interrupt handler know shared_hcd is no longer available.

xhci-plat.c, cdns/host.c first create both their hcd's before
adding them. so to keep the correct reverse removal order use a temporary
shared_hcd variable for them.
For more details see commit 4ac53087d6 ("usb: xhci: plat: Create both
HCDs before adding them")

Fixes: fe190ed0d6 ("xhci: Do not halt the host until both
	       	HCD have disconnected their devices.")
Cc: Joel Stanley <joel@jms.id.au>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Jianguo Sun <sunjianguo1@huawei.com>
Cc: <stable@vger.kernel.org>
Tested-by: Peter Chen <peter.chen@nxp.com>
Tested-by: Jack Pham <jackp@codeaurora.org>
Reported-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit ab8ddbf8e9)
2019-11-25 15:56:12 +08:00
7e35aa8425 MLK-19442-1 usb: host: xhci: export xhci_bus_suspend
It may be used by xhci platform driver, fixed below error when
building xhci as module.

ERROR: "xhci_bus_suspend" [drivers/usb/cdns3/cdns3.ko] undefined!
linux-imx/scripts/Makefile.modpost:92: recipe for target '__modpost' failed
make[2]: *** [__modpost] Error 1
linux-imx/Makefile:1231: recipe for target 'modules' failed
make[1]: *** [modules] Error 2

Reported-by: Bruce Zhang <bo.zhang@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit f4211724d6)
2019-11-25 15:56:12 +08:00
a4d0971ca9 MLK-19258-3 usb: cdns3: core: change the MODULE_ALIAS
To reflect it is a USB driver.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit e06b8ceecc)
2019-11-25 15:56:11 +08:00
f4523a64f1 MLK-18794-3 usb: cdns3: change the definition of PowerState at XECP_PM_PMCSR
When the USB port goes to suspend, PowerState should set to "D1"
(the D2 and D3hot are not supported now); PowerState should set to
"D0" when the USB port goes to resume.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit c57f21e103)
2019-11-25 15:56:11 +08:00
065da5c38e MLK-18794-2 usb: cdns: improve the suspend routine for xhci host
The controller needs to set CFG_RXDET_P3_EN within 100ms after
USB3 port is set to U3, but when there is a USB3 HUB in port, the
USB2 port bus suspend may take more than 100ms to finish, it causes
disconnection and PHY can't enter low power mode in system suspend
routine.

To fix this issue, we implement the platform .bus_suspend, and set
CFG_RXDET_P3_EN just after xhci_bus_suspend. The LPM_2_STB_SWITCH_EN
only needs to be set one time, and OTG_STB_CLK_SWITCH_EN isn't needed
to set for host/device mode according to IC engineer's sugguestion.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 2bc2bc9d40)
2019-11-25 15:56:10 +08:00
7299512a54 MLK-19254 usb: cdns3: gadget: set gadget state to be USB_STATE_NOTATTACHED after stop
Update gadget state to be USB_STATE_NOTATTACHED after stop gaget.

Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 15a7227b63)
2019-11-25 15:56:09 +08:00
674face74c MLK-18817 usb: cdns3: gadget: add mutex for role_start and role_stop
The usb_add_hcd and usb_remove_hcd can't be called together, otherwise,
there is oops like below. To fix it, we add mutex to avoid calling
role_start and role_stop at the same time.

[3.336786] Can't support > 32 bit dma.
[3.340676]  xhci-cdns3: xHCI Host Controller
[3.345052]  xhci-cdns3: new USB bus registered, assigned bus number 1
[3.363462]  xhci-cdns3: hcc params 0x200073c8 hci version 0x100 quirks 0x60010010
[3.374555] hub 1-0:1.0: USB hub found
[3.378349] hub 1-0:1.0: 1 port detected
[3.382573]  xhci-cdns3: xHCI Host Controller
[3.386948]  xhci-cdns3: new USB bus registered, assigned bus number 2
[3.387707] cdns-usb3 5b110000.cdns3: current role is 0, switch to 1
[3.387711]  xhci-cdns3: remove, state 0
[3.387721] Unable to handle kernel NULL pointer dereference at virtual address 000000d8
[3.387723] pgd = ffff0000095f5000
[3.387731] [000000d8] *pgd=00000008bfffe003, *pud=00000008bfffd003, *pmd=0000000000000000
[3.387735] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[3.387739] Modules linked in:
[3.387746] CPU: 0 PID: 745 Comm: kworker/0:1 Not tainted 4.9.88-05224-geb65e0981da1 #2087
[3.387748] Hardware name: Freescale i.MX8QXP MEK (DT)
[3.387765] Workqueue: events_freezable cdns3_role_switch
[3.387768] task: ffff80083a1d7080 task.stack: ffff80083aa5c000
[3.387775] PC is at sysfs_remove_group+0x18/0x98
[3.387781] LR is at usb_remove_hcd+0x58/0x200
[3.387784] pc : [<ffff000008265688>] lr : [<ffff00000885ac28>] pstate: 80000145
[3.387786] sp : ffff80083aa5fc70
[3.387791] x29: ffff80083aa5fc70 x28: 0000000000000000
[3.387795] x27: 0000000000000000 x26: ffff0000093cb2a8
[3.387800] x25: ffff000009506191 x24: ffff80083ff37280
[3.387804] x23: ffff80083b1b0138 x22: ffff80083b238000
[3.387809] x21: ffff80083b238000 x20: ffff0000094a1610
[3.387813] x19: ffff80083b1b0000 x18: 0000000000000020
[3.387817] x17: 0000000000000001 x16: 0000000000000019
[3.387822] x15: ffffffffffffffff x14: 00000000fffffff0
[3.387827] x13: ffff0000095a2068 x12: ffff0000093ce600
[3.387831] x11: ffff0000093ce000 x10: ffff00000959f000
[3.387836] x9 : 0000000000000000 x8 : ffff80083fe4244c
[3.387840] x7 : 0000000000000000 x6 : 0000000007cb5702
[3.387844] x5 : 00ffffffffffffff x4 : 0000000000000000
[3.387848] x3 : 0000000000000140 x2 : 00000000000008a6
[3.387852] x1 : 0000000000000000 x0 : 00000000000000a8
[3.387853]
[3.387856] Process kworker/0:1 (pid: 745, stack limit = 0xffff80083aa5c020)
[3.387860] Stack: (0xffff80083aa5fc70 to 0xffff80083aa60000)
[3.387865] fc60:                                   ffff80083aa5fca0 ffff00000885ac28
[3.387870] fc80: ffff80083b1b0000 ffff0000094a1000 ffff80083b238000 0000000000000000
[3.387875] fca0: ffff80083aa5fcf0 ffff00000889c5c8 ffff80083b1bf400 ffff80083b23e018
[3.387880] fcc0: ffff80083b238000 ffff80083b238000 ffff80083ff3bb00 ffff80083a1d7080
[3.387885] fce0: ffff000008ccc25c 0000000000000000 ffff80083aa5fd20 ffff000008897130
[3.387890] fd00: ffff80083b23e018 0000000000000001 0000000000000000 0000000000000000
[3.387895] fd20: ffff80083aa5fd50 ffff0000088972ec ffff80083b23e0d0 0000000000000000
[3.387901] fd40: ffff80083b23e018 ffff000008ccc25c ffff80083aa5fd80 ffff0000080dbc38
[3.387906] fd60: 0000000000000000 ffff80083ac3a600 ffff80083b23e0d0 ffff0000093b6000
[3.387911] fd80: ffff80083aa5fdc0 ffff0000080dbe40 ffff80083ac3a600 ffff80083ff37280
[3.387916] fda0: ffff80083ff37280 ffff80083ac3a630 ffff80083ff372a0 ffff0000093b6000
[3.387921] fdc0: ffff80083aa5fe20 ffff0000080e1c78 ffff80083a0fee80 ffff80083aa5c000
[3.387926] fde0: ffff00000908e2c8 ffff80083ac3a600 ffff0000080dbdf0 0000000000000000
[3.387931] fe00: 0000000000000000 0000000000000000 0000000000000000 ffff80083ac3a600
[3.387936] fe20: 0000000000000000 ffff000008083820 ffff0000080e1b98 ffff80083a0fee80
[3.387941] fe40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387946] fe60: ffff80083aa5fea0 0000000000000000 ffff0000080e1b98 ffff80083ac3a600
[3.387951] fe80: 0000000000000000 0000000000000000 ffff80083aa5fe90 ffff80083aa5fe90
[3.387956] fea0: 0000000000000000 ffff000000000000 ffff80083aa5feb0 ffff80083aa5feb0
[3.387960] fec0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387965] fee0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387970] ff00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387974] ff20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387979] ff40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387983] ff60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387988] ff80: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387992] ffa0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387997] ffc0: 0000000000000000 0000000000000005 0000000000000000 0000000000000000
[3.388002] ffe0: 0000000000000000 0000000000000000 fefffac7ef9fea6e f6ef6c26eeee7272
[3.388004] Call trace:
[3.388008] Exception stack(0xffff80083aa5faa0 to 0xffff80083aa5fbd0)
[3.388013] faa0: ffff80083b1b0000 0000ffffffffffff ffff80083aa5fc70 ffff000008265688
[3.388019] fac0: ffff80083b238000 ffff80083b238000 ffff80083b1b0138 ffff80083ff37280
[3.388024] fae0: ffff000009506191 ffff0000093cb2a8 0000000000000000 ffff80083aa5fcb0
[3.388029] fb00: ffff80083aa5fc20 ffff80083aa5fc20 ffff80083aa5fbf0 00000000ffffffd8
[3.388034] fb20: ffff000009506191 ffff0000093cb2a8 0000000000000000 ffff80083a11f408
[3.388038] fb40: 00000000000000a8 0000000000000000 00000000000008a6 0000000000000140
[3.388043] fb60: 0000000000000000 00ffffffffffffff 0000000007cb5702 0000000000000000
[3.388048] fb80: ffff80083fe4244c 0000000000000000 ffff00000959f000 ffff0000093ce000
[3.388054] fba0: ffff0000093ce600 ffff0000095a2068 00000000fffffff0 ffffffffffffffff
[3.388057] fbc0: 0000000000000019 0000000000000001
[3.388061] [<ffff000008265688>] sysfs_remove_group+0x18/0x98
[3.388066] [<ffff00000885ac28>] usb_remove_hcd+0x58/0x200
[3.388072] [<ffff00000889c5c8>] cdns3_host_stop+0x38/0xa0
[3.388077] [<ffff000008897130>] cdns3_do_role_switch+0x58/0x188
[3.388082] [<ffff0000088972ec>] cdns3_role_switch+0x8c/0xa0
[3.388089] [<ffff0000080dbc38>] process_one_work+0x1c8/0x380
[3.388094] [<ffff0000080dbe40>] worker_thread+0x50/0x4c0
[3.388099] [<ffff0000080e1c78>] kthread+0xe0/0xf8
[3.388104] [<ffff000008083820>] ret_from_fork+0x10/0x30

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:09 +08:00
321003929c MLK-18609-8 usb: cdns3: gadget: do not support multiple requests for ep0
Current code does not support queuing multiple requests for ep0, return
-EOPNOTSUPP if that happens.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:09 +08:00
c025f313c2 MLK-18609-7 usb: cdns3: gadget: only unmap buffer for demand request
We only unmap the request which is demanded from the gadget driver.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:08 +08:00
1a804f47d9 MLK-18609-6 usb: cdns3: gadget: need to prepare setup packet after status
We need to prepare setup packet no matter configuration is set or
not.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:05 +08:00
2be0b1e63a MLK-18609-5 usb: cdns3: gadget: implement setup status completion properly
For CDNS3 gadget, there is NO setup status completion interrupt, but
software has related request and completion handler for EP0 setup
status. In previous design, it executes ->completion before .ep0_queue
back, and causes cdev->setup_pending and cdev->os_desc_pending
incorrect, the dequeue is executed wrongly.

In this commit, we postpone ->comletion to workqueue or the next
EP0 interrupt, it makes sure the ->completion is executed after
.ep0_queue.

[  220.785184] android_work: did not send uevent (0 0           (null))
[  220.792651] Bad mode in Error handler detected on CPU2, code 0xbf000002 -- SError
06-28 02:47:13.145  3946  3946 I zygote64: Deoptimizing void com.android.systemui.statusbar.stack.NotificationStackScrollLayout.updateContentHeight() due to JIT inline cache
[  220.815371] Internal error: Oops - bad mode: 0 [#1] PREEMPT SMP
[  220.821312] Modules linked in:
[  220.824389] CPU: 2 PID: 1 Comm: init Not tainted 4.9.105-644221-ga78d348 #8
[  220.831362] Hardware name: Freescale i.MX8QXP MEK (DT)
[  220.836504] task: ffff80083a0e0000 task.stack: ffff80083a0e8000
[  220.842431] PC is at 0x4ec908
[  220.845398] LR is at 0x454a30
[  220.848363] pc : [<00000000004ec908>] lr : [<0000000000454a30>] pstate: 40000000
[  220.855762] sp : 0000ffffe0c35ca0
[  220.859072] x29: 0000ffffe0c35cc0 x28: 00000000ffffffff
[  220.864397] x27: 00000000ffffffff x26: 0000000000000001
[  220.869722] x25: 0000ffff7f6446a9 x24: 000000000057da40
[  220.875047] x23: 0000000000088241 x22: 0000ffff7f6446c0
[  220.880373] x21: 0000ffff7f6446c1 x20: 0000000000000009
[  220.885698] x19: 0000000000000004 x18: 00000000020f06cc
[  220.891024] x17: aaaaaaaaaaaaaaab x16: 0000000000000000
[  220.896349] x15: 000000000000005c x14: 0000000000000000
[  220.901675] x13: 4344552f31672f74 x12: 0000ffffe0c35c88
[  220.907000] x11: 0000ffffe0c35cd0 x10: 0000000000000004
[  220.912325] x9 : 0000000000000000 x8 : 0000000000000040
[  220.917651] x7 : 7f7f7f7f7f7f7f7f x6 : 655e666d68736860
[  220.922976] x5 : 0000000000000000 x4 : 0000000000000000
[  220.928302] x3 : 0000000000000180 x2 : 0000000000000004
[  220.933627] x1 : 0000ffff7f6446c1 x0 : 0000000000000004
[  220.938952]
[  220.940440] Process init (pid: 1, stack limit = 0xffff80083a0e8000)

Reported-by: Andy Tian <yang.tian@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:04 +08:00
c0d42a86b7 MLK-18609-4 usb: cdns3: gadget: refine de-init process
- The gadget speed should be reset to USB_SPEED_UNKNOWN at any de-init
  process
- The TRB buffer should be free when the gadget is removed

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:04 +08:00
d043325ee5 MLK-18609-3 usb: cdns3: gadget: refine the memory allocation function
Move all memory allocation to usb_ss_allocate_trb_pool and align with
usb_ss_free_trb_pool.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit cfed2bf84c)
2019-11-25 15:56:03 +08:00
18de9e5a9a MLK-18609-2 usb: cdns3: gadget: flush fifo only controller is started
Some gadget drivers may dequeue its request very late, eg, after
the controller is stopped, at this situation, visiting related
register will cause abort. See below oops from android use case:

[ 1676.773258] android_work: sent uevent USB_STATE=CONFIGURED
[ 1676.788278] mtp_open
[ 1850.542145] android_work: sent uevent USB_STATE=DISCONNECTED
[ 1850.545311] mtp_release
[ 1852.050358] init: processing action (sys.usb.config=none && sys.usb.configfs=1) from (init.freescale.usb.rc:45)
[ 1852.061224] init: processing action (sys.usb.config=none && sys.usb.configfs=1) from (/init.usb.configfs.rc:1)
[ 1852.074316] android_work: did not send uevent (0 0           (null))
[ 1852.080893] Unhandled fault: synchronous external abort (0x96000210) at 0xffff000016a90028
[ 1852.089186] Internal error: : 96000210 [#1] PREEMPT SMP
[ 1852.094422] Modules linked in:
[ 1852.097491] CPU: 0 PID: 1 Comm: init Not tainted 4.9.105-00010-g30f2a53-dirty #4
[ 1852.104889] Hardware name: Freescale i.MX8QXP MEK (DT)
[ 1852.110031] task: ffff80083a0e0000 task.stack: ffff80083a0e8000
[ 1852.115966] PC is at wait_reg_bit.constprop.13+0x24/0xb4
[ 1852.121286] LR is at usb_ss_gadget_ep_dequeue+0x110/0x164
[ 1852.126685] pc : [<ffff00000894c2d0>] lr : [<ffff00000894ccf4>] pstate: a00001c5
[ 1852.134085] sp : ffff80083a0ebc30
[ 1852.137395] x29: ffff80083a0ebc30 x28: ffff80083a0e0000
[ 1852.142720] x27: ffff000008ec3000 x26: 0000000000000000
[ 1852.148046] x25: ffff80083a0ebeb0 x24: ffff80083b751000
[ 1852.153371] x23: 0000000000000080 x22: 0000000000000000
[ 1852.158696] x21: ffff000016a90028 x20: ffff80083b6e7e18
[ 1852.164022] x19: ffff8000507fb580 x18: 000000000042d1e0
[ 1852.169348] x17: aaaaaaaaaaaaaaab x16: ffff0000082678fc
[ 1852.174673] x15: ffffffffffffffff x14: 2020202020202020
[ 1852.179998] x13: 2020203020302820 x12: 746e657665752064
[ 1852.185324] x11: ffff80083ff2ee40 x10: ffff80083b708870
[ 1852.190649] x9 : 0000000040000000 x8 : 0000000000210d00
[ 1852.195974] x7 : 0000000000000005 x6 : ffff80083b708871
[ 1852.201300] x5 : ffff00000894c084 x4 : 0000000000000000
[ 1852.206627] x3 : 0000000000000000 x2 : 0000000000000080
[ 1852.211951] x1 : ffff000016a90028 x0 : ffff80083b751000
[ 1852.217278]
[ 1852.217278] SP: 0xffff80083a0ebbb0:
[ 1852.222245] bbb0  00000000 00000000 00000080 00000000 3b751000 ffff8008 3a0ebeb0 ffff8008
[ 1852.230498] bbd0  00000000 00000000 08ec3000 ffff0000 3a0e0000 ffff8008 3a0ebc30 ffff8008
[ 1852.238751] bbf0  0894ccf4 ffff0000 3a0ebc30 ffff8008 0894c2d0 ffff0000 a00001c5 00000000
[ 1852.247004] bc10  3a0ebeb0 ffff8008 3b6e6418 ffff8008 ffffffff 0000ffff 80080007 00000001
[ 1852.255257] bc30  3a0ebc70 ffff8008 0894ccf4 ffff0000 507fb580 ffff8000 3b6e7e18 ffff8008
[ 1852.263510] bc50  00000000 00000000 00000140 00000000 3b7517d0 ffff8008 3b751000 ffff8008
[ 1852.271764] bc70  3a0ebcb0 ffff8008 0898ef58 ffff0000 3b537490 ffff8008 09a4a5a8 ffff0000
[ 1852.280017] bc90  3b6e7e18 ffff8008 507fb580 ffff8000 00000004 00000000 aee44671 0000ffff
[ 1852.288272]
[ 1852.288272] X0: 0xffff80083b750f80:
[ 1852.293240] 0f80  6cfdc6bf fee6fc67 76effaff d777e7fe 5ff67667 e7eef7ff 7fff75fc 6f7d7fff
[ 1852.301492] 0fa0  7d7ef6f6 f23feefb 7ffff7ee f7de7e72 eeb47f7e 4bff73f4 fe367677 3ef573ed
[ 1852.309745] 0fc0  674eb7e7 76f94767 f6ff66e7 eabe66ee fef663df fe7764e7 66ee2e64 febf7bcc
[ 1852.317998] 0fe0  ef7f35ff f7ef6f6c 4cded7ee 76fffb77 f7f3765d ff8f7efb e5ee6ce7 bfe5e7ff
[ 1852.326252] 1000  3a657c10 ffff8008 3b6e7f00 ffff8008 09341970 ffff0000 3b751388 ffff8008
[ 1852.334505] 1020  3a657c28 ffff8008 3a657c20 ffff8008 3a1b8000 ffff8008 098f9d10 ffff0000
[ 1852.342758] 1040  3b70b5a0 ffff8008 00000006 00000003 00000000 00000000 00000000 00000000
[ 1852.351011] 1060  00000001 00000000 3b751068 ffff8008 3b751068 ffff8008 00000000 00000000
[ 1852.359268]
[ 1852.359268] X6: 0xffff80083b7087f1:
[ 1852.364234] 87f0  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
[ 1852.372487] 8810  3b708810 ffff8008 3b708810 ffff8008 00000000 00000000 00000000 00000000
[ 1852.380740] 8830  01ea01ea 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.388993] 8850  3b708850 ffff8008 3b708850 ffff8008 00000004 00000003 00000002 00000000
[ 1852.397246] 8870  00000001 00010001 00000000 00000000 00320032 00000000 3b708888 ffff8008
[ 1852.405499] 8890  3b708888 ffff8008 00000001 00000000 00000000 00000000 3bd5e300 ffff8008
[ 1852.413752] 88b0  34157200 ffff8008 35173c00 ffff8008 35173c1c ffff8008 00000074 00000003
[ 1852.422005] 88d0  00000003 00000005 00000001 00000000 00000000 00000000 3b76e5b0 ffff8008
[ 1852.430258] 88f0  3b76e5b0 ffff8008 3b76e5b0 ffff8008 0000000f 00820100 00000000 00000000
[ 1852.438514]
[ 1852.438514] X10: 0xffff80083b7087f0:
[ 1852.443570] 87f0  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
[ 1852.451821] 8810  3b708810 ffff8008 3b708810 ffff8008 00000000 00000000 00000000 00000000
[ 1852.460074] 8830  01ea01ea 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.468327] 8850  3b708850 ffff8008 3b708850 ffff8008 00000004 00000003 00000002 00000000
[ 1852.476580] 8870  00000001 00010001 00000000 00000000 00320032 00000000 3b708888 ffff8008
[ 1852.484833] 8890  3b708888 ffff8008 00000001 00000000 00000000 00000000 3bd5e300 ffff8008
[ 1852.493086] 88b0  34157200 ffff8008 35173c00 ffff8008 35173c1c ffff8008 00000074 00000003
[ 1852.501340] 88d0  00000003 00000005 00000001 00000000 00000000 00000000 3b76e5b0 ffff8008
[ 1852.509595]
[ 1852.509595] X11: 0xffff80083ff2edc0:
[ 1852.514649] edc0  00000000 00000000 00100000 00000000 00000000 00000000 0003b33d 00000000
[ 1852.522902] ede0  000be6cc 00000000 00100000 00000000 00000000 00000000 00000001 00000001
[ 1852.531155] ee00  00000000 00000000 caabd6a1 0000000c 00000000 00000000 00000000 00000000
[ 1852.539408] ee20  3a0e0080 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.547661] ee40  392570e9 000001af 0239e900 00000000 0185fbb6 00000295 000002f9 00000000
[ 1852.555914] ee60  00000211 00000000 0182c397 00000000 0000020d 00000000 00000000 00000000
[ 1852.564167] ee80  00000001 00000000 00000052 00000000 0000001c 00000000 000002f9 00000000
[ 1852.572421] eea0  0005eb9a 00000001 00000000 00000000 3ff2ed80 ffff8008 00000001 00000000
[ 1852.580679]
[ 1852.580679] X19: 0xffff8000507fb500:
[ 1852.585730] b500  00000001 00000000 0994b2b0 ffff0000 00000000 00000000 00000000 00000000
[ 1852.593983] b520  507fb520 ffff8000 507fb520 ffff8000 507fb560 ffff8000 00000002 00000000
[ 1852.602236] b540  00002441 00000000 00000001 00000000 d54b3f06 00000175 00000000 00000000
[ 1852.610489] b560  00010001 00000000 3b413200 ffff8008 0000c4f8 00000000 00000000 00000000
[ 1852.618742] b580  3b76d800 ffff8008 00000000 00000000 fe5db800 00000000 00000000 00000000
[ 1852.626995] b5a0  00000000 00000000 00000000 00000000 08989814 ffff0000 3b537430 ffff8008
[ 1852.635249] b5c0  00000000 00000000 00000000 00000000 ffffff98 00000022 00000000 00000000
[ 1852.643502] b5e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.651758]
[ 1852.651758] X20: 0xffff80083b6e7d98:
[ 1852.656812] 7d98  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.665064] 7db8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.673317] 7dd8  00000000 00000000 00000000 00000000 00000000 00000000 316e6163 00000000
[ 1852.681570] 7df8  00000000 00000000 3b6e7b00 ffff8008 3b7512a8 ffff8008 0874a428 ffff0000
[ 1852.689823] 7e18  3b537430 ffff8008 3b6e7e98 ffff8008 08fe1788 ffff0000 00000000 00000000
[ 1852.698077] 7e38  00000000 00000000 00000031 02000100 00000200 00000004 09917320 ffff0000
[ 1852.706330] 7e58  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.714583] 7e78  00000000 00000000 00000000 00000000 00000000 00000000 3b751000 ffff8008
[ 1852.722839]
[ 1852.722839] X24: 0xffff80083b750f80:
[ 1852.727892] 0f80  6cfdc6bf fee6fc67 76effaff d777e7fe 5ff67667 e7eef7ff 7fff75fc 6f7d7fff
[ 1852.736147] 0fa0  7d7ef6f6 f23feefb 7ffff7ee f7de7e72 eeb47f7e 4bff73f4 fe367677 3ef573ed
[ 1852.744398] 0fc0  674eb7e7 76f94767 f6ff66e7 eabe66ee fef663df fe7764e7 66ee2e64 febf7bcc
[ 1852.752652] 0fe0  ef7f35ff f7ef6f6c 4cded7ee 76fffb77 f7f3765d ff8f7efb e5ee6ce7 bfe5e7ff
[ 1852.760905] 1000  3a657c10 ffff8008 3b6e7f00 ffff8008 09341970 ffff0000 3b751388 ffff8008
[ 1852.769158] 1020  3a657c28 ffff8008 3a657c20 ffff8008 3a1b8000 ffff8008 098f9d10 ffff0000
[ 1852.777411] 1040  3b70b5a0 ffff8008 00000006 00000003 00000000 000 00000000 00000000 00000000
[ 1852.919573] 0040  00000001 00000000 00000034 00000000 0005eb90 00000001 3a905400 ffff8008
52.949389] bbd0  00000000 00000000 08ec3000 ffff0000 3a0e0000 ffff8008 3a0ebc30 ffff8008
[ 1852.957642] bbf0  0894ccf4 ffff3b6e7e18 ffff8008
[ 1852.982401] bc50  00000000 00000000 00000140 00000000 3b7517d0 ffff8008 3b751000 ffff8008
[ 1852.990600140
[ 1853.036348] bc60: ffff80083b7517d0 ffff80083b751000 ffff80083a0ebcb0 ffff00000898ef58
[ 1853.044183] bc80: ffff80083b537490 ffff000009a4a5a8 ffff80083b6e7e18 ffff8000507fb580
[ 1853.052019] bca0: 0000000000000004 0000ffffaee44671 ffff80083a0ebce0 ffff00000898b4f0
[ 1853.059855] bcc0: ffff80083b537490 ffff000009a4a5a8 ffff80083b537490 ffff80083b537430
[ 1853.067691] bce0: ffff80083a0ebd10 ffff00000898d280 ffff80083b537430 ffff000009a4a5a8
[ 1853.075528] bd00: ffff80083b751310 ffff00000991e000 ffff80083a0ebd40 ffff000008990b10
[ 1853.083364] bd20: ffff80083b6fa000 ffff00000991ea48 ffff80083b537350 ffff00000991ea48
[ 1853.091200] bd40: ffff80083a0ebd60 ffff000008990c00 ffff80083b6fa000 ffff00000898e86c
[ 1853.099036] bd60: ffff80083a0ebd90 ffff00000898e8bc ffff800066af6f80 ffff80083b537000
[ 1853.106872] bd80: 0000000000000000 ffff80083b5372a8 ffff80083a0ebdd0 ffff0000082db924
[ 1853.114708] bda0: 0000000000000004 ffff800066af6d80 0000000000000000 ffff800066af6da0
[ 1853.122544] bdc0: ffff8000674aeb00 0000000000000004 ffff80083a0ebe30 ffff0000082507c8
[ 1853.130382] bde0: 0000000000000004 ffff8000674aeb00 0000000000000000 ffff80083a0ebeb0
[ 1853.138216] be00: 0000ffffaee44671 0000000000000015 0000000000000123 0000000000000040
[ 1853.146052] be20: 0000000000000004 0000000000000004 ffff80083a0ebe70 ffff000008251c7c
[ 1853.153889] be40: ffff8000674aeb00 ffff8000674aeb00 ffff000009838000 00000000004ec908
[ 1853.161724] be60: 0000000040000000 0000800836a09000 0000000000000000 ffff000008083780
[ 1853.169561] be80: ffffffffffffff1d 0000800836a09000 ffffffffffffffff 00000000004ec908
[ 1853.177396] bea0: 0000ffffaee44671 0000000000000004 0000000000000000 0000000000040969
[ 1853.185233] bec0: 0000000000000009 0000ffffaee44671 0000000000000004 0000000000000180
[ 1853.193069] bee0: 0000000000000000 0000000000000000 655e666d68736860 7f7f7f7f7f7f7f7f
[ 1853.200905] bf00: 0000000000000040 0000000000000000 0000000000000004 0000ffffffa57620
[ 1853.208742] bf20: 0000ffffffa575d8 4344552f31672f74 0000000000000000 000000000000005c
[ 1853.216577] bf40: 0000000000000000 000000000000000d 0000000052841d82 0000000000000004
[ 1853.224416] bf60: 0000000000000009 0000ffffaee44671 0000ffffaee44670 0000000000088241
[ 1853.232250] bf80: 000000000057da40 0000ffffaee44659 0000000000000001 00000000ffffffff
[ 1853.240086] bfa0: 00000000ffffffff 0000ffffffa57610 0000000000454a30 0000ffffffa575f0
[ 1853.247922] bfc0: 00000000004ec908 0000000040000000 0000000000000009 0000000000000040
[ 1853.255758] bfe0: 0000000000000000 0000000000000000 a62044020608c465 1224422020842444
[ 1853.263592] Call trace:
[ 1853.266035] Exception stack(0xffff80083a0eba40 to 0xffff80083a0ebb70)
[ 1853.272482] ba40: ffff8000507fb580 0000ffffffffffff ffff80083a0ebc30 ffff00000894c2d0
[ 1853.280320] ba60: 00000000a00001c5 ffff00000810a7dc ffff80083a0e0080 0000000000000007
[ 1853.288154] ba80: ffff800800000000 ffff000016a90028 0000000000000000 ffff80083a001e00
[ 1853.295990] baa0: ffff80083a0e0000 ffff80083a0e0000 000000018020001f 0000000100200020
[ 1853.303828] bac0: ffff80083a0ebbe0 ffff00000822fda8 ffff7e00019dc9c0 ffff00000894c084
[ 1853.311663] bae0: ffff80083a0ebc00 ffff00000822fda8 ffff7e000153f0c0 0000000000040969
[ 1853.319498] bb00: ffff80083b751000 ffff000016a90028 0000000000000080 0000000000000000
[ 1853.327334] bb20: 0000000000000000 ffff00000894c084 ffff80083b708871 0000000000000005
[ 1853.335170] bb40: 0000000000210d00 0000000040000000 ffff80083b708870 ffff80083ff2ee40
[ 1853.343005] bb60: 746e657665752064 2020203020302820
[ 1853.347892] [<ffff00000894c2d0>] wait_reg_bit.constprop.13+0x24/0xb4
[ 1853.354248] [<ffff00000894ccf4>] usb_ss_gadget_ep_dequeue+0x110/0x164
[ 1853.360696] [<ffff00000898ef58>] usb_ep_dequeue+0x24/0xd8
[ 1853.366098] [<ffff00000898b4f0>] composite_dev_cleanup+0xe8/0x104
[ 1853.372197] [<ffff00000898d280>] configfs_composite_unbind+0x3c/0x5c
[ 1853.378556] [<ffff000008990b10>] usb_gadget_remove_driver+0x44/0x74
[ 1853.384830] [<ffff000008990c00>] usb_gadget_unregister_driver+0xc0/0xf0

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 6df600ff83)
2019-11-25 15:56:02 +08:00
d2a98f3652 MLK-18609-1 usb: cdns3: gadget: add ep0 request to list
It is necessary to add ep0 request for its ep request list,
ep0 request may need to be dequeued when remove gadget driver,
see composite_dev_cleanup for detail.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 0e666f6b02)
2019-11-25 15:56:02 +08:00
fd5766e652 MLK-18685 usb: cdns3: gadget: balance spin lock if map request fails
spin_unlock_irqrestore is missing if usb_gadget_map_request_by_dev
fails.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit ce04a997e4)
2019-11-25 15:56:01 +08:00
bc97fd4270 MLK-18656 usb: cdns3: gdaget: add hanlding of request->zero for non-EP0
In case a ZLP is required to finish the transfer, this patch implements it
by adding a request with a preallocated buffer, which is shared with all
EPs, please be noted this patch is only for non-EP0, ZLP for EP0 will be
added later.

Reported-by: Andy Tian <yang.tian@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 03d202e88c)
2019-11-25 15:56:01 +08:00
da35644781 MLK-18319-3 usb: cdns3: gadget: Typo cleanup
Typo cleanup.

Reviewed-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit c284d5755e)
2019-11-25 15:56:01 +08:00
b8407f59c0 MLK-18319-2 usb: cdns3: gadget: delete the unless code
Confirmed from CDNS, this code is from bare metal, and not needed
for Linux. Below are their response:

This is alternative deferred interrupt.
This is intended to be used in Bare Metal to not block system in
interrupt.
This was not fully checked in Linux, so we do not recommend to use it
there.

Reviewed-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit e5a1abc937)
2019-11-25 15:56:00 +08:00
6c681f1430 MLK-18319-1 usb: cdns3: gadget: improvement the handling for non-aligned buffer
If the user buffer is not 8-byte aligned, it needs to use debounce
buffer for DMA transfer, and in this commit, we do below two
improvements:
- Copy back the request buffer when the transfer has completed
- Using Macro for default debounce buffer size

Reviewed-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 648aa52282)
2019-11-25 15:55:59 +08:00
e317760f25 MLK-18206-5 usb: cdns3: gadget: change maxburst as numbered buffered packet
This value is suggested by CDNS IC engineer.

Reviewed-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 0663ce54ac)
2019-11-25 15:55:59 +08:00
83204d9a4c MLK-18206-4 usb: cdns3: gadget: fix can't do usbtest for same EP twice
When using usbtest <--> f_sourcesink to do usb test, the current
code can't do test on same EP twice (eg EP1OUT), the DMA engine
can't restarted for the second test, the real reason is unknown.
The workaround for this problem is reset EP at .ep_enable, and
this operation is reasonable since we can reset EP at its
initialized state before using it. The fail cause for current
code like below:
./testusb -a -t 1
/* do it again */
./testusb -a -t 1

Reviewed-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 57781498d1)
2019-11-25 15:55:59 +08:00
3fbcfea09e MLK-18206-3 usb: cdns3: gadget: add dflush for both .dequeue and .ep_disable
There are may active transfers when we would like dequeue request
or disable endpoint, so it needs to flush the on-chip buffer before
dequeue software request.

Reviewed-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 4e88d4a56b)
2019-11-25 15:55:58 +08:00
bc0a72586a MLK-18206-2 usb: cdns3: gadget: change infinite wait as wait-timeout
Add API pair wait_reg_bit_set/clear to replace infinite wait code.

Reviewed-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 5621f390aa)
2019-11-25 15:55:57 +08:00
f6bd71274d MLK-18206-1 usb: cdns3: gadget: show error message when onchip memory is full
For Cadence USB3 device mode, the onchip buffer size is fixed
(eg: 18KB at this version), and the software needs to judge
if the onchip buffer is full when tries to configure endpoint.
For IN endpoint, each endpoint has its own onchip buffer;
For OUT endpoint, all endpoints share the same onchip buffer.

Reviewed-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 2ceddbe5e4)
2019-11-25 15:55:56 +08:00
0190d5d5ec MLK-18200 usb: cdns3: gadget: fix can't wait configurated with USB2
With Linux PC USB2 connection, if L1 enable bit is set during the
initialization, the usbsts.cfgsts can't be 1 (device is in the
configured state) after setting usbconf.cfgset, move L1 enable
after USB configuration done can workaround this issue.

Reviewed-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit a05fbc0cdd)
2019-11-25 15:55:56 +08:00
e948cfc535 MLK-17631-7 usb: cdns3: gadget: clear stalled_flag at .ep_enable
When the EP is going to enable, it should not be stalled, and the
software flag needs to be updated. It fixes the mass_storage gadget
can't work after re-plug in.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 32cee02f2e)
2019-11-25 15:55:55 +08:00
99eb96b3e0 MLK-17631-6 usb: cdns3: gadget: disable U1 and U2 for reset state
When we receive the bus reset, according to CH 9.4.5, the U1
and U2 should be reset to disabled status.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 74168280c3)
2019-11-25 15:55:55 +08:00
0c03add5fa MLK-17631-5 usb: cdns3: gadget: set selfpower flag for usb_gadget
Implement selfpower setting between USB gadget core and
controller driver

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 79c2172df4)
2019-11-25 15:55:55 +08:00
5d5595b890 MLK-17631-4 usb: cdns3: gadget: support LPM for USB 2.0
Superspeed device should support USB 2.0 LPM feature.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit d4c99663dd)
2019-11-25 15:55:54 +08:00
63957d5736 MLK-17631-3 usb: cdns3: gadget: fix NULL pointer deference issue for usbtest
When running usbtest case 9, it meets below oops, the reason for this
issue is the EP2-IN is not enabled, but the related interrupt for it
occurs, the structure usb_request for it is NULL. The software should
make sure there is no oops even the hardware triggers wrong interrupt.

[  476.636715]  gadget-cdns3: EP_STS: 00000804
[  476.636726] Unable to handle kernel NULL pointer dereference at virtual address 00000002
[  476.636729] pgd = ffff0000095f1000
[  476.636736] [00000002] *pgd=00000008bfffe003, *pud=00000008bfffd003, *pmd=0000000000000000
[  476.636741] Internal error: Oops: 96000006 [#1] PREEMPT SMP
[  476.636750] Modules linked in: g_zero vivante ipv6
[  476.636757] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.88-04771-g7b3994b #1669
[  476.636759] Hardware name: Freescale i.MX8QXP MEK (DT)
[  476.636762] task: ffff0000093c0780 task.stack: ffff0000093b0000
[  476.636774] PC is at single_td_ep_dequeue+0x50/0x180
[  476.636780] LR is at cdns_irq_handler_thread+0x21c/0x6c0
[  476.636783] pc : [<ffff0000088b6aa8>] lr : [<ffff0000088b6214>] pstate: 600001c5
[  476.636785] sp : ffff80083ff40e40
[  476.636790] x29: ffff80083ff40e40 x28: ffff80083ae0c418
[  476.636795] x27: 0000000000040000 x26: 0000000000000804
[  476.636800] x25: ffff0000095624f8 x24: ffff80083b1047a0
[  476.636804] x23: ffff000009187718 x22: ffff0000095619b8
[  476.636809] x21: ffff80083b104000 x20: ffff80083ae0c418
[  476.636813] x19: 0000000000000000 x18: 0000000000000010
[  476.636818] x17: 0000ffff968c5e30 x16: ffff000008b14998
[  476.636823] x15: 0000000000000008 x14: 00000000fffffff0
[  476.636827] x13: ffff0000095a0068 x12: ffff0000093ce600
[  476.636832] x11: ffff0000093ce000 x10: ffff00000959d6d8
[  476.636837] x9 : 0000000000000001 x8 : ffff80083c8eb43f
[  476.636841] x7 : 0000000000000000 x6 : 000000000811c50d
[  476.636845] x5 : 00ffffffffffffff x4 : 0000000000000000
[  476.636850] x3 : 00000000000001c0 x2 : 0000000000000000
[  476.636854] x1 : 0000000000000000 x0 : ffff80083a607410
[  476.636855]
[  476.636859] Process swapper/0 (pid: 0, stack limit = 0xffff0000093b0020)
[  476.636862] Stack: (0xffff80083ff40e40 to 0xffff0000093b4000)
[  476.636864] Call trace:
[  476.636869] Exception stack(0xffff80083ff40c70 to 0xffff80083ff40da0)
[  476.636874] 0c60:                                   0000000000000000 0000ffffffffffff
[  476.636879] 0c80: ffff80083ff40e40 ffff0000088b6aa8 ffff80083ff40db0 ffff80083ff40db0
[  476.636885] 0ca0: ffff80083ff40d80 00000000ffffffd8 ffff80083bb17500 0000000000000000
[  476.636889] 0cc0: ffff8008344f6a00 0000000000000000 0000000000000000 0000000000000000
[  476.636895] 0ce0: ffff80083ff40cf0 ffff0000088f8b9c ffff80083ff40d20 ffff0000088f9270
[  476.636900] 0d00: ffff80083bb17500 0000000000000000 ffff80083a607410 0000000000000000
[  476.636905] 0d20: 0000000000000000 00000000000001c0 0000000000000000 00ffffffffffffff
[  476.636910] 0d40: 000000000811c50d 0000000000000000 ffff80083c8eb43f 0000000000000001
[  476.636916] 0d60: ffff00000959d6d8 ffff0000093ce000 ffff0000093ce600 ffff0000095a0068
[  476.636921] 0d80: 00000000fffffff0 0000000000000008 ffff000008b14998 0000ffff968c5e30
[  476.636927] [<ffff0000088b6aa8>] single_td_ep_dequeue+0x50/0x180
[  476.636932] [<ffff0000088b6214>] cdns_irq_handler_thread+0x21c/0x6c0
[  476.636937] [<ffff0000088b1f0c>] cdns3_irq+0x44/0x98
[  476.636945] [<ffff00000810b0cc>] __handle_irq_event_percpu+0x9c/0x128
[  476.636950] [<ffff00000810b174>] handle_irq_event_percpu+0x1c/0x58
[  476.636955] [<ffff00000810b1f8>] handle_irq_event+0x48/0x78
[  476.636961] [<ffff00000810eb90>] handle_fasteoi_irq+0xb8/0x1b0
[  476.636967] [<ffff00000810a1b4>] generic_handle_irq+0x24/0x38
[  476.636972] [<ffff00000810a81c>] __handle_domain_irq+0x5c/0xb8
[  476.636978] [<ffff00000808180c>] gic_handle_irq+0xbc/0x168
[  476.636981] Exception stack(0xffff0000093b3de0 to 0xffff0000093b3f10)
[  476.636987] 3de0: 0000000000000000 0000000000000000 0000000000000001 0000000000000000
[  476.636992] 3e00: 00000000000001c0 0100000000000000 00000000eb3aea81 ffff80083ff47b38
[  476.636998] 3e20: ffff0000093c1060 ffff0000093b0000 0000000000000880 000000001469197d
[  476.637003] 3e40: 0000000000000018 0000000059362c44 000c28cb00000000 0000554bf0000000
[  476.637008] 3e60: ffff000008b14998 0000ffff968c5e30 0000000000000000 ffff0000093b72e8
[  476.637013] 3e80: ffff0000093b7258 0000000000000001 0000000000000000 0000000000000000
[  476.637019] 3ea0: ffff0000093b0000 ffff00000936da60 ffff000009506fd4 ffff0000093b7000
[  476.637024] 3ec0: ffff0000093b7000 ffff0000093b3f10 ffff00000808599c ffff0000093b3f10
[  476.637029] 3ee0: ffff0000080859a0 0000000000000145 ffff000008116ec4 0000000040000145
[  476.637033] 3f00: ffffffffffffffff 7fffffffffffffff
[  476.637038] [<ffff000008082eec>] el1_irq+0xac/0x120
[  476.637043] [<ffff0000080859a0>] arch_cpu_idle+0x10/0x18
[  476.637050] [<ffff0000080ff478>] cpu_startup_entry+0x118/0x1d8
[  476.637058] [<ffff000008cd54a0>] rest_init+0x80/0x90
[  476.637067] [<ffff000009290b40>] start_kernel+0x378/0x38c
[  476.637072] [<ffff0000092901d8>] __primary_switched+0x5c/0x64
[  476.637078] Code: d1010273 f9401e82 aa1303e1 f943dea0 (39400842)
[  476.637088] ---[ end trace 21e06658d7988711 ]---
[  476.637091] Kernel panic - not syncing: Fatal exception in interrupt
[  476.637094] SMP: stopping secondary CPUs
[  476.643852] Kernel Offset: disabled
[  476.643854] Memory Limit: none
[  477.339728] ---[ end Kernel panic - not syncing: Fatal exception in interrupt

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 63239f73cc)
2019-11-25 15:55:54 +08:00
29f17e258a MLK-17631-2 usb: cdns3: gadget: fix the bug the non-ep0 can't work after disconnection
We add endpoints to ep_match_list when adding gadget module, but
we delete the endpoints from the ep_match_list before set configuration.
When the re-enumeration after the new connection, the ep_match_list
is empty, in that case, the non-ep0s have not configurated, the
transfer on them will be failed.

In this commit, we only delete the endpoints from the list when we
remove the gadget module.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit ad13dd3ffd)
2019-11-25 15:55:53 +08:00
bae455e536 MLK-17631-1 usb: cdns3: gadget: fix deadlock during remove gadget module
For mass_storage gadget, when we remove the module after disconnection,
the request->complete at .ep_dequeue can't be executed, then the
wakeup_thread for certain endpoints is not called, the sleep_thread
will be dead lock.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit ac0d56a6df)
2019-11-25 15:55:53 +08:00
a87b33f3e6 MLK-17323 usb: cdns3: fix the kernel dump during the reboot stress test
During the reboot stress test, there may "nobody cared irq" for CDNS3,
the interrupts are occurred during the controller is entering low power
mode. In fact, we do no expect interrupt during this period, so disable
controller interrupt for it. With this patch, the kernel dump does
not occur again during reboot stress test.

[   18.460516] irq 44: nobody cared (try booting with the "irqpoll" option)
[   18.467222] CPU: 0 PID: 112 Comm: kworker/0:1 Not tainted 4.9.51-04150-ge84b58d-dirty #1198
[   18.475573] Hardware name: Freescale i.MX8QXP MEK (DT)
[   18.480720] Workqueue: pm pm_runtime_work
[   18.484739] Call trace:
[   18.487186] [<ffff0000080884e0>] dump_backtrace+0x0/0x1e0
[   18.492588] [<ffff0000080886d4>] show_stack+0x14/0x20
[   18.497644] [<ffff0000083e571c>] dump_stack+0x94/0xb8
[   18.502701] [<ffff0000081062c0>] __report_bad_irq+0x38/0xe8
[   18.508276] [<ffff000008106644>] note_interrupt+0x20c/0x2e0
[   18.513853] [<ffff00000810386c>] handle_irq_event_percpu+0x44/0x58
[   18.520038] [<ffff0000081038c8>] handle_irq_event+0x48/0x78
[   18.525608] [<ffff000008107260>] handle_fasteoi_irq+0xb8/0x1b0
[   18.531445] [<ffff000008102894>] generic_handle_irq+0x24/0x38
[   18.537187] [<ffff000008102f04>] __handle_domain_irq+0x5c/0xb8
[   18.543017] [<ffff00000808163c>] gic_handle_irq+0xbc/0x168
[   18.548506] Exception stack(0xffff80083ff4ae00 to 0xffff80083ff4af30)
[   18.554946] ae00: ffff80083ff4ae30 0001000000000000 ffff80083ff4af60 ffff0000080c1fec
[   18.562781] ae20: 0000000040000145 ffff80083a474000 0000000000000000 0000000000000000
[   18.570617] ae40: 00000000fffeecc3 ffff000008a2d368 00000000020c49ba 0000000000000020
[   18.578454] ae60: 000000000f78257c 7fffffffffffffff 0000000000000020 ffff80083a403f00
[   18.586290] ae80: ffff80083ff51ab0 ffff000008cb0b68 00000000000003ef 0000000000000000
[   18.594125] aea0: 0000000000000011 00000000000003ef 0000000000000019 0000000000000001
[   18.601962] aec0: 0000000000000007 ffff0000092f9000 ffff0000092f5b08 0000000000000000
[   18.609798] aee0: ffff000009501180 ffff80083a002a80 ffff80083a474000 00000000fffeecc2
[   18.617634] af00: ffff80083ff4b090 ffff000009336000 0000000000000002 ffff80083ff4af60
[   18.625469] af20: ffff0000080c243c ffff80083ff4af60
[   18.630343] [<ffff0000080827b0>] el1_irq+0xb0/0x124
[   18.635220] [<ffff0000080c243c>] irq_exit+0xac/0xf0
[   18.640099] [<ffff000008102f08>] __handle_domain_irq+0x60/0xb8
[   18.645928] [<ffff00000808163c>] gic_handle_irq+0xbc/0x168
[   18.651409] Exception stack(0xffff80083a477ad0 to 0xffff80083a477c00)

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 006891a403)
2019-11-25 15:55:52 +08:00
54acdffe6d MLK-17380-7 usb: cdns3: add platform TPL support
The TPL support is used to identify targeted devices during
EH2.0 and EH3.0 certification test.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 3e96618557)
2019-11-25 15:55:52 +08:00
8fddd7638c MLK-17366-2 usb: cdns3: decrease autosuspend timeout
Cadence3 low power sequence doesn't allow too much time gap
between xhci bus suspend and controller suspend,
otherwise, the disconnection will be seen between them.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 3c70ec34f7)
2019-11-25 15:55:51 +08:00
3346b8ff11 MLK-17366-1 usb: cdns3: improve USB PHY operation
Improve USB PHY operation, and keep 32K clock for RX detection
all the time, it can fix SS connection can't be recognition
from U3.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit db01f49aaa)
2019-11-25 15:55:49 +08:00
120b51228b MLK-17312-5 usb: cdns3: improve the role switch process
Current design tries to switch role no matter it is a dual-role device
or a single-role device. It produces extra switch process, and have an
error message at console when tries to start a non-exist role.

In this commit, we do below changes
- The role switch work queue is only for dual-role or peripheral-only
device.
- For peripheral-only device, we need to switch role to CDNS3_ROLE_END
since we need to close vbus and turn off clocks at this role when the
cable is disconnected from the host; And we do noop when the external
cable indicates we are host.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 2000169e68)
2019-11-25 15:55:47 +08:00
9324418e00 MLK-17312-4 usb: cdns3: gadget: fix the recognition issue when connection before load module
At imx8qm/imx8qxp A0 chip, there is a vbus toggle issue, so we need to
force the vbus as high before connection, otherwise, there will be endless
connect/disconnect interrupts for USB2 and causes enumeration failure.
The current work flow only cover this during the role switch, but omit
it when the connection has established at module probe routine.

This patch fixes it by moving force vbus operation to cdns_set_role to
cover both static and dynamic recognition issue.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit c89cf074ea)
2019-11-25 15:55:47 +08:00
512ce4b77b MLK-17312-3 usb: cdns3: gadget: configure all endpoints before set configuration
Cadence IP has one limitation that all endpoints must be configured
(Type & MaxPacketSize) before setting configuration through hardware
register, it means we can't change endpoints configuration after
set_configuration.

In this patch, we add non-control endpoint through usb_ss->ep_match_list,
which is added when the gadget driver uses usb_ep_autoconfig to configure
specific endpoint; When the udc driver receives set_configurion request,
it goes through usb_ss->ep_match_list, and configure all endpoints
accordingly.

At usb_ep_ops.enable/disable, we only enable and disable endpoint through
ep_cfg register which can be changed after set_configuration, and do
some software operation accordingly.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit a7146b650c)
2019-11-25 15:55:46 +08:00
ee9b1be0e6 MLK-17312-2 usb: cdns3: gadget: improve comments
Fix typos and some error comments

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit a9fb87de9e)
2019-11-25 15:55:46 +08:00
6776537ab1 MLK-17312-1 usb: cdns3: gadget: prepare setup packet buffer before receiving it
At current setup packet handling flow, the setup packet buffer
is only prepared after the controller receives the setup packet,
then stores it at its internal buffer, and trigger DESCMIS interrupt
(Transfer descriptor missing) to prepare TRB for it.

The shortcoming of this design is there is an extra DESCMIS interrupt,
and consume more time on enumeration process. As an improvement,
we parepare setup buffer beforehand, it is prepared at below situations:
- After bus reset has finished.
- For non-data stage setup transfers, prepare it before sending ACK for
status stage.
- For data stage setup transfers, prepare it after data stage but
before sending ACK for status stage.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit a5fae341d8)
2019-11-25 15:55:45 +08:00
3a61c89b54 MLK-17261-1 usb: cdns3: gadget: fix the spinlock recursion problem when detach cable
The __cdns3_gadget_stop holds spinlock before calling
usb_ss->gadget_driver->disconnect which calls ep_disable,
and ep_disable tries to hold spinlock too.

To fix it, let spinlock only protect the variable and register access.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 69c8b18235)
2019-11-25 15:55:45 +08:00
d7326a7d62 MLK-17062 usb: cdns3: gadget: add test mode support for USB2
Add USB2 device test mode support for CDNS3 IP

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 1c43fc49a3)
2019-11-25 15:55:44 +08:00
7692d3bf1f MLK-16976-4 usb: cdns3: add power management support
This patch set adds both runtime and system-level pm support.
For runtime-pm: both host and device wakeup events are supported.
For system-pm: only host wakeup events are supported, device wakeup
events are from other peripherals, and will support later.

BuildInfo:
- SCFW 245582b, IMX-MKIMAGE 0ad6069a, ATF 6bd98a3
- U-Boot 2017.03-imx_v2017.03+gfa65b0a

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 248fa444f3)
2019-11-25 15:55:43 +08:00
635e881f22 MLK-16682 usb: cdns3: gadget: delete useless is_iso_flag
Since the runtime endpoint type is decided by device descriptors,
we delete useless is_iso_flag which is decided during the initialization.
It also fixed a bug the max_packet_size is determined wrongly for
high/full speed connection.

BuildInfo:
- SCFW 8dcff26, IMX-MKIMAGE ea027c4b, ATF
- U-Boot 2017.03-imx_v2017.03_4.9.51_imx8_beta1+g6dc7b0f

Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 644e1c75c5)
2019-11-25 15:55:42 +08:00
8ac997a892 MLK-16727-3 usb: cdns3: force vbus status accordingly
Since the controller doesn't know vbus status well due to IC limitation,
it needs to force vbus status for controller when the connection and
disconnection occur.

BuildInfo:
- SCFW 8dcff26, IMX-MKIMAGE ea027c4b, ATF
- U-Boot 2017.03-imx_v2017.03_4.9.51_imx8_beta1+g6dc7b0f

Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit e5c88818c1)
2019-11-25 15:55:42 +08:00
f45b88d6ee MLK-16727-1 usb: cdns3: needs to handle disconnection at device mode
The IP has some issues to detect vbus status correctly, we have to
force vbus status accordingly, so we need a status to indicate
vbus disconnection, and add some code to let control know vbus
removal, in that case, the controller's state mechine can be correct.

In this commit, we increase one role 'CDNS3_ROLE_END' to for
this status.

BuildInfo:
- SCFW 8dcff26, IMX-MKIMAGE ea027c4b, ATF
- U-Boot 2017.03-imx_v2017.03_4.9.51_imx8_beta1+g6dc7b0f

Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 287d40d92e)
2019-11-25 15:55:41 +08:00
473680d29a 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>
(cherry picked from commit 3e5c3b3ee0)
2019-11-25 15:55:41 +08:00
0dc1260d17 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>
(cherry picked from commit 3e56a1e631)
2019-11-25 15:55:40 +08:00
6ba4099d97 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>
(cherry picked from commit 0f21c9e70b)
2019-11-25 15:55:40 +08:00
660bfe1ea3 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>
(cherry picked from commit fc7ec8ba1a)
2019-11-25 15:55:39 +08:00
488c3aa3a1 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>
(cherry picked from commit cb3c8642c4)
2019-11-25 15:55:38 +08:00
9840ea9473 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>
(cherry picked from commit 99c0401ec8)
2019-11-25 15:55:37 +08:00
fd9034a365 MLK-16221-6 usb: cdns3: gadget: fix non-initialized spinlock warning
The below warning is showed if we open lockdep debug, fix it by
initializing spinlock before using it.

[  192.159535] INFO: trying to register non-static key.
[  192.164507] the code is fine but needs lockdep annotation.
[  192.169996] turning off the locking correctness validator.
[  192.175485] CPU: 1 PID: 2831 Comm: modprobe Not tainted 4.9.11-03045-g39aab30 #514
[  192.183054] Hardware name: Freescale i.MX8QXP LPDDR4 ARM2 (DT)
[  192.188884] Call trace:
[  192.191348] [<ffff200008089234>] dump_backtrace+0x0/0x1e0
[  192.196751] [<ffff200008089428>] show_stack+0x14/0x1c
[  192.201808] [<ffff2000084046f4>] dump_stack+0xb0/0xec
[  192.206865] [<ffff200008107570>] register_lock_class+0x510/0x538
[  192.212873] [<ffff20000810b7c4>] __lock_acquire+0x84/0x6f0
[  192.218363] [<ffff20000810c34c>] lock_acquire+0x68/0xc8
[  192.223596] [<ffff200008bfe1f4>] _raw_spin_lock_irqsave+0x50/0x68
[  192.229694] [<ffff200008857528>] usb_ss_gadget_udc_start+0x38/0x1b0
[  192.235966] [<ffff20000889da8c>] udc_bind_to_driver+0xcc/0x11c
[  192.241803] [<ffff20000889e0e4>] usb_gadget_probe_driver+0xa4/0x150
[  192.248077] [<ffff2000088983a8>] usb_composite_probe+0xb8/0xd8
[  192.253923] [<ffff200000ce8018>] msg_init+0x18/0x1000 [g_mass_storage]
[  192.260456] [<ffff200008083960>] do_one_initcall+0x38/0x12c
[  192.266033] [<ffff200008187764>] do_init_module+0x98/0x214
[  192.271523] [<ffff2000081465fc>] load_module+0x1014/0x10f0
[  192.277012] [<ffff200008146970>] SyS_finit_module+0xc8/0xd4
[  192.282590] [<ffff20000808374c>] __sys_trace_return+0x0/0x4

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 020811d77f)
2019-11-25 15:55:36 +08:00
3bdaa16a12 MLK-16221-5 usb: cdns3: gadget: fix wMaxPacketSize for ep0
We should set wMaxPacketSize according to connection speed,
and add missing ep0 descriptor.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 2118444b58)
2019-11-25 15:55:36 +08:00
f48063ca20 MLK-16221-4 usb: cdns3: gadget: disable device mode when the gadget is stopped
After USB_CONF.DEVDS is set, the device mode will be disabled, and the
host will set the disconnection, this bit is just like DP pullup bit
at USB2.

And we add disable/enable device mode logic at .pullup function for
UDC core.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 5847b6c6e6)
2019-11-25 15:55:35 +08:00
1841b3f530 MLK-16221-3 usb: cdns3: gadget: add free memory operation when gadget is stopped
When the UDC core calls ->udc_stop, we need to free related non-ep TRB
memory.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 57a2906928)
2019-11-25 15:55:35 +08:00
d9dc20c09a MLK-16221-2 usb: cdns3: gadget: avoid visiting register when detach
When the port does not connect to host, the controller's gadget
mode is enabled, so we need to avoid visiting register at this situation.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit f7da0154aa)
2019-11-25 15:55:35 +08:00
d9bf790339 MLK-16221-1 usb: cdns3: add module removal support
We need to destroy both host and gadget roles when removing module.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit f4ba47c18f)
2019-11-25 15:55:34 +08:00
08502e37bb MLK-16065-16 usb: cdns3: gadget: fix no one handled interrupt issue
If there are too many interrupts for non-control ep, the
no-one handled interrupt issue will occur due to without
return IRQ_HANDLED for them.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit ea3d9d8759)
2019-11-25 15:55:34 +08:00
11b725df48 MLK-16065-15 usb: cdns3: gadget: refine the enable endpoint operation
Move non-ep enable operation from set_configuration to ep_enable

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 74e2184f89)
2019-11-25 15:55:34 +08:00
2c6ecd731b MLK-16065-7 usb: cdns3: add Cadence USB3 controller driver
Add Cadence USB3 IP driver, this is the 1st version for this driver,
so wrapper layer and PHY layer are still IP core file (core.c).
Below functions are supported:

- Basic host function
- Limited gadget function, only ACM (old g_seiral) are supported, and
mass_storage support is not very well.
- Role switch between host and device through extcon design
(Eg, Type-C application NXP PTN5150).

Below functions are missing:
- Multi-queue support at gadget function, without this feature, many
gadget function are missing.
- Low power mode support, including system PM and runtime PM
- Wakeup support

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit ef808bfac1)
2019-11-25 15:55:32 +08:00
576d5c3cde usb: cdns3: remove upstream cadence USB3 driver
Upstream version is an initial version, it can't be used directly.
We will use downstream version for v5.4 instead.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:55:32 +08:00
fcfc4be154 MLK-11429-21: ASoC: fsl: port si476x machine driver from imx_3.10.y
cherry-pick below patch from imx_3.14.y
ENGR00330403-3: ASoC: fsl: port si476x machine driver from imx_3.10.y

Port si476x machine dirver for i.MX series SoC and binding doc from imx_3.10.y

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:34 +08:00
9ecdda6d03 MLK-11305 radio-si476x: support set V4L2_CID_AUDIO_MUTE CTRL
By using gstreamer plugin v4l2radio, it will call VIDIOC_S_CTRL with
V4L2_CID_AUDIO_MUTE, but return failed.

So add V4L2_CID_AUDIO_MUTE CTRL support for radio-si476x.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit c18520adfd6de40dcc0659ddd778b0a2bd383cd4)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:54:33 +08:00
5504d2877a MLK-22355: mfd: si476x: Use system_freezable_wq instead of system_wq
There is issue that system can't enter suspend while the si476x is
working.

The reason is that with the workqueue thread is still working after
i2c enter suspend, then cause the cpu_suspend function failed.

This patch is to use the system_freezable_wq instead of the system_wq,
that the workqueue will be freeze before system enter suspend.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:32 +08:00
49e5b31740 MLK-10055-2: mfd: si476x-i2c: sound is registered when no FM module attached
The si476x_core_get_revision_info will send i2c command to FM module, if it
return error, there is no FM modules attached, so we need't to register the
sound card. otherwise, the pulseaudio will access this sound card, but
return a lot of i2c error.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 4c8e9916128f05f9b4115e1ee1af4a1e7d800c4a)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:54:32 +08:00
c0195d1455 MLK-10038-1: mfd: si476x-i2c: Add support of si476x-rev4.0 board
Currently, si476x-rev1.0 and si476x-rev4.0 board just support A10
compatible command set. For si476x-rev1.0 board, its firmware revision is
unsupported and will revert to A10 compatible function. For si476x-rev4.0
board, its firmware revision is two and will use A30 function, but A30
command set function can't work for the rev4.0 board.
So make the command set configurable in dts. If "revision-a10" is present,
set the revision to SI476X_REVISION_A10 to use A10 compatible commit set.
Otherwise, get the revision from si476x register.

Signed-off-by: Zidan Wang <b50113@freescale.com>
(cherry picked from commit b648714c3b71ee084188ae04b1e6a6f2554fe2cb)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:54:31 +08:00
73a126450a MLK-9684-1: mfd: si476x-i2c: add of_compatible for si476x-codec
Add of_compatible for si476x-codec, then si476x-codec driver will have
codec_of_node, So machine driver can use the codec_of_node.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit e2ec44f91a21b127e155e8317d06e8ead7fd2678)
(cherry picked from commit ac6decaf5414e784ae81a524edc2f32060061b59)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:54:31 +08:00
78490823a1 MLK-11429-23: mfd: si476x: Use default configuration when no platform data
cherry-pick below patch from imx_3.14.y
ENGR00276567-6 mfd: si476x: Use default configuration when no platform data

This would allow the driver to work normally without specific platform
data, when using devicetree for example.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
(cherry picked from commit 23e369b88b546d7b699ca9ec46e195a05c61b717)
(cherry picked from commit a2449e1d303e341f32556fb7f4ebc7dcbdd9ead1)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:54:30 +08:00
ecfadb7f27 MLK-11429-22: mfd: si476x: Fix power up failure
cherry-pick below patch from imx_3.14.y
ENGR00276567-4 mfd: si476x: Fix power up failure

This's some logical error in power-up code, thus fix it.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
(cherry picked from commit 77d97ad1bb77c0e3c60b9781a06b61d4b4667de1)
(cherry picked from commit b656522da2685ef9a4da2229b6786d5cd0c12189)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:29 +08:00
f25a242346 LF-106: ASoC: fsl_ssi: request BUS_FREQ_AUDIO
request BUS_FREQ_AUDIO

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:27 +08:00
24a3bee2e1 MLK-15975-1: ASoC: fsl_ssi: support multi fifo script
With dual fifo enabled, the case recording mono sound
in the background, playback sound twice in parallal,
the second time playback sound may distort, the possible
reason is using dual fifo to playback mono sound is not
recommended.

This patch is to provide a option to use multi fifo script,
which can be dynamically configured as one fifo or two fifo
mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 9d71068cf7d1fc1ec36e5fb34a321c1bdbaad324)
2019-11-25 15:54:27 +08:00
c7dad700c4 LF-106: ASoC: fsl_spdif: request BUS_FREQ_HIGH
request BUS_FREQ_HIGH

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:25 +08:00
bd7b26036e ASoC: fsl_spdif:Support multi power domains
Support multi power domains

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:24 +08:00
2d2076c4d0 ASoC: fsl_spdif: Add pm_runtime_enable in probe
Add pm_runtime_enable in probe

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:24 +08:00
ccea8f42a7 MLK-21484-2: ASoC: fsl_spdif: ensure clk is unprepared before reparent
On recent kernels clks which are marked with CLK_SET_RATE_GATE are
"protected" against further changes at clk_prepare time, including clk
reparent. Wrap clk set_parent and set_rate operations with
disable_unprepare and prepare_enable.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:23 +08:00
8e013fb268 MLK-19154-5: ASoC: fsl_spdif: refine PLL switch handling
Allow PLL switch for playback stream only and remove
PLL switch guard with regard to capture stream as the
clock for capture stream is provided externally.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit c8213da5fbcd370acb4d764bef5df5981a517c11)
2019-11-25 15:54:22 +08:00
084c2ca345 MLK-19154-4: ASoC: imx_spdif: set SPDIF ROOT clock freq as function of rate
Set SPDIF master clock frequency as function of rate.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 407430a03994e4acff508afe8c9772680558c1c5)
2019-11-25 15:54:22 +08:00
960f3f4848 MLK-19154-3: ASoC: fsl_spdif: Add support for PLL switch at runtime.
iMX8 platforms typically have 2 AUDIO PLLs being configured to handle
8k and 11k audio rates. The patch implements the functionality to
select at runtime the appropriate AUDIO PLL as function of audio
file rate.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 3a29374cfbe0bfaf1785fa66163ffd3b9e30aca3)
2019-11-25 15:54:21 +08:00
1b48437219 MLK-19154-2: ASoC: fsl_spdif: keep all 7 TxClk sources
Use txclk array to keep all 7 TxClk sources instead of keeping clocks per
rate - need to do this in order to avoid multiple prepare_enable /
disable_unprepare of the same clock during suspend/resume.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 61bc5c83af0713a09b520486051a2efcbe852763)
2019-11-25 15:54:21 +08:00
fff54ed842 MLK-19115-2: ASoC: fsl_spdif: add support for enabling raw capture mode
Since i.MX8 MQ SPDIF interface is able to capture raw data.
Add support in SPDIF driver for this functionality.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit e13a302391f56a6bb547ff89e3fac73941cee429)
2019-11-25 15:54:20 +08:00
83fbe12324 MLK-19115-1: ASoC: fsl_spdif: use snd_ctl_boolean_mono_info
Remove redundant code and use snd_ctl_boolean_mono_info
instead.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 6ae5e1bf20eeff7e5ec821d96958329170359ce8)
2019-11-25 15:54:20 +08:00
e3e48111d9 MLK-18574: ASoC: fsl_spdif: specify the spdif in imx8mm
specify the spdif in imx8mm for the ipg clock is higher that
it can support 192kHz

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:19 +08:00
590ec64bb5 MLK-18574: ASoC: fsl_spdif: support 192kHz for rx in imx8
The ipg clock is higher enough to support 192kHz in imx8

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:18 +08:00
70e9a07d29 MLK-17089-4: ASoC: fsl_spdif: support suspend & resume for imx8
Base on latest power management design in MLK-17074, every driver
need to enter runtime suspend state in suspend, so the driver should
call the pm_runtime_force_suspend in suspend. with this implementation
the suspend function almost same as runtime suspend function. so remove
the suspend function, just use pm_runtime_force_suspend instead.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:18 +08:00
c4f6be48fd MLK-17034-6: ASoC: fsl_spdif: Move clock operation to pm runtime function
In imx8 when systerm enter suspend state, the power of subsystem will be
off, the clock enable state will be lost after resume, but the runtime
resume function will be called after resume by pm, so need to move clock
enablement to runtime resume and clock disablement to runtime suspend.
Then after resume the clock enable state can be recovered.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:17 +08:00
c84933c819 MLK-15960-3: ASoC: fsl_spdif: refine pm runtime function
In imx8qm/imx8qxp, the power domain of IP is enabled when
pm_runtime_get_sync() is called, and disabled when pm_runtime
_put_sync() is called. when power domain is disabled, the value
of registers will lost, so we need to use the regcache_sync()
to restore the registers in fsl_spdif_runtime_resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:54:17 +08:00
38f89d3ce1 MLK-13947: ASoC: fsl_spdif: introduce SoC specific data
Introduce a SoC data struct which contains the differences between
the different SoCs this driver supports. This makes it easy to support
more differences without having to introduce a new switch/case each
time.
And in imx8qm, the spdif has two interrupt numbers and the burst size
should be 2 for EDMA limitation to support dual FIFO.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:54:16 +08:00
610e75569e MLK-12722: ASoC: fsl_spdif: clear the validity bit for TX
Validity bit is set in default, which means the data is not reliable,
The receive device may drop this data. So clear it in default, and
provide a mixer interface for user to control this bit.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:54:15 +08:00
54cf07dcaf MLK-10903-2: ASoC: imx_spdif: add snd_soc_pm_ops
Add snd_soc_pm_ops in machine driver to make the trigger suspend/resume
be called in suspend/resume. Remove platform_set_drvdata for redundance,
When register card, it has been called.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit fe21119eed18804b2bc7c47216b6f4478de0268d)
2019-11-25 15:54:15 +08:00
f675fa3778 MLK-10903-1: ASoC: fsl_spdif: remove cache only in suspend/resume
In imx6qp, there is no mega fast. After suspend, but before resume,
there will be spdif interrupt, if set cache only in suspend, then we
can't clear the interrupt, because regmap_write only write to cache.
So the system will hang for the interrupt can't be cleared.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 2a6a522c86d6c0fe80023c4327ca7ce4792035c8)
2019-11-25 15:54:14 +08:00
15bbc61393 MLK-11429-1: ASoC: fsl_spdif: don't change the root clock rate of spdif in driver
cherry-pick below patch from imx_3.14.y
ENGR00331799-2 ASoC: fsl_spdif: don't change the root clock rate of spdif in driver

The spdif root clock may be used by other module or defined with
CLK_SET_RATE_GATE, so we can't change the clock rate in driver.
In this patch remove the clk_set_rate and clk_round_rate to protect the
clock.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit c77170b2c9a9737f6fd61a5ea85a43b90e8ef02b)
[ Aisheng: fix incorrectly removing u64 rate_actual ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:14 +08:00
801e2a74c5 LF-106: ASoC: fsl_sai: request BUS_FREQ_AUDIO
request BUS_FREQ_AUDIO

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:12 +08:00
61e5cc7288 ASoC: fsl_sai: Mark cache dirty at resume
This is needed so that at resume will restore the
correct SAI registers.

Looks like the call to regcache_mark_dirty was missed when
porting commit 760bd61874 ("MLK-15960-2: ASoC: fsl_sai: refine
the pm runtime function")

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:54:12 +08:00
21ab6ea993 MLK-21876-4 ASoC: fsl: sai: fix build for next-20190524 upgrade
In file included from ../sound/soc/fsl/fsl_sai.c:15:0:
../sound/soc/fsl/fsl_sai.c: In function ‘fsl_sai_startup’:
../sound/soc/fsl/fsl_sai.c:957:51: error: ‘offset’ undeclared (first use in this function)
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),
                                                   ^
../include/linux/regmap.h:77:31: note: in definition of macro ‘regmap_update_bits’
  regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
                               ^
../sound/soc/fsl/fsl_sai.h:84:37: note: in expansion of macro ‘FSL_SAI_TCR3’
 #define FSL_SAI_xCR3(tx, off) (tx ? FSL_SAI_TCR3(off) : FSL_SAI_RCR3(off))
                                     ^
../sound/soc/fsl/fsl_sai.c:957:34: note: in expansion of macro ‘FSL_SAI_xCR3’
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),
                                  ^
../sound/soc/fsl/fsl_sai.c:957:51: note: each undeclared identifier is reported only once for each function it appears in
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),
                                                   ^
../include/linux/regmap.h:77:31: note: in definition of macro ‘regmap_update_bits’
  regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
                               ^
../sound/soc/fsl/fsl_sai.h:84:37: note: in expansion of macro ‘FSL_SAI_TCR3’
 #define FSL_SAI_xCR3(tx, off) (tx ? FSL_SAI_TCR3(off) : FSL_SAI_RCR3(off))
                                     ^
../sound/soc/fsl/fsl_sai.c:957:34: note: in expansion of macro ‘FSL_SAI_xCR3’
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:11 +08:00
63de0c0232 ASoC: fsl: sai: fix build failture due to 5.1 RC7 upgrade
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:11 +08:00
53915e7ea9 ASoC: fsl_sai: support multi power domain
support multi power domain

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:10 +08:00
c43c341752 ASoC: fsl_sai: Support -EPROBE_DEFER
Support -EPROBE_DEFER for the resource is not ready in time

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:09 +08:00
e138a5378b MLK-20328-1: ASoC: fsl_sai: map number of pins to dataline masks
The patch enable mapping the number of pins required to play or record
a specific number of channels to a specific dataline mask.

Three consequent elements in "fsl,dataline" and "fsl,dataline,dsd" defines a
particular mapping, for instance for: fsl,dataline = "0 0xff 0xff 2 0x11 0x11"
there are two mappings defined:

default (0 pins) "rx" and "tx" dataline masks: 0 0xff 0xff
         2 pins  "rx" and "tx" dataline masks: 2 0x11 0x11

In case if property is missing, then default value "0 0x1 0x1" is considered.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:09 +08:00
34ef089c73 MLK-20189-8: ASoC: fsl_sai: use signed offset variable
Both dataline_off and dataline_off_dsd fields are unsigned,
thus checking negative values make no sense. Use a signed
variable to calculate offset instead.

This fixes Coverity issue: CID1899299

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:08 +08:00
f2fa8b69e5 MLK-15975-3: ASoC: fsl_sai: The offset of fifo_off is changed
Commit 786c8bd56324 ("MLK-19734-3: dmaengine: imx-sdma: change
fifo offset of fifo_num") change the offset of fifo_off, so
the sai driver need to be updated.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit c94ce8776e01f1f40a866d4da89603ab042dde0f)
2019-11-25 15:54:06 +08:00
a9534c8c98 MLK-19573-1: ASoC: fsl: dsd: make fsl_get_pins_state inline
Make fsl_get_pins_state function inline.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit badcb97ebd8c0aae89f76e979bcc801be35c7400)
2019-11-25 15:54:05 +08:00
f3d96d45f6 MLK-18898-1: ASoC: fsl_sai: select pinctrl state as function of bitclock rate
Similar to DSD512 case we need a PCM pinctrl state option to map SAI BCLK
to codec MCLK pin. Given that bitclock rate is function of slots number and
slot width - pass bclk rate as parameter value from SAI driver.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 826caeae32713cff7ad50de8ebc9915de975edd9)
2019-11-25 15:54:02 +08:00
ddf3ffebf9 MLK-18947: ASoC: fsl_sai: fix volatile function
The FSL_SAI_VERID and FSL_SAI_PARAM only available
when reg_offset is 8

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0a0695672dc7ecf07a7642ff6f99f0b9d3a26b32)
2019-11-25 15:54:01 +08:00
244757cda2 MLK-18682-2: ASoC: fsl: sai: allow dynamic pll switching
Currently SAI master clock derives from an audio pll that cannot be
changed at runtime. iMX8 SoC has 2 audio plls usually configured to support
either 8000Hz (8k,16k,32k,48k,etc) or 11025Hz (11k,22k,44.1k,88.2k,etc)
ranges of rates - thus at runtime a SAI interface is able to play only one
range of rates. The patch allows dynamic SAI master clock reparenting to
the appropriate audio pll as function of the audio stream rate to be
played/recorded.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:01 +08:00
4bc2390d93 MLK-18682-1: ASoC: fsl: sai: use set_bclk_ratio to calculate BCLK freq (part 1)
ALSA API has a standard way to configure DAI BCLK by calling
"snd_soc_dai_set_bclk_ratio" function. So use it to set BCLK ratio
and calculate SAI BCLK frequency.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
[ Aisheng: split machine imx-pdm changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:00 +08:00
06131f164d MLK-18534-1: ASoC: fsl: sai: introduce 1:1 bclk:mclk ratio support
Since IP version 3.01 (845s) SAI has support for 1:1
bclk:mclk ratio.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:00 +08:00
f228945168 MLK-17531-1: ASoC: fsl: sai: add support for SAI v3.01
a) Add support for new SAI (VERID, PARAM, MCTL, MDIV) registers
   available in i.MX 850d (SAI v3.00) and i.MX 845s (SAI v3.01).
b) Handle SAI MCLK register as function of SAI IP version.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:59 +08:00
cf1d61356c MLK-17580: ASoC: fsl: sai: check for pinctrl status
For some cases (like AMIX) pinctrl may be null - this
breaks SAI functionality. Enforce pinctrl null pointer
checking prior calling any function which involves
pins state changes.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:58 +08:00
0e084ed83d MLK-17580: ASoC: fsl: sai: Use DSD helper
Replace DSD related code with calls to DSD helper functions.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com
2019-11-25 15:53:58 +08:00
6e286195f6 MLK-17580: ASoC: fsl: dsd: Add DSD utilities helper
Add DSD utilities helper.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com
2019-11-25 15:53:57 +08:00
8f88f5a166 Sound: Soc: fsl: Set SAI Channel Mode to Output Mode
Transmit data pins will output zero when slots are masked or channels
are disabled. In CHMOD TDM mode, transmit data pins are tri-stated when
slots are masked or channels are disabled. When data pins are tri-stated,
there is noise on some channels when FS clock value is high and data is
read while fsclk is transitioning from high to low.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:56 +08:00
24e96cb548 MLK-17156-1: ASoC: fsl_sai: update register offset for ULP B0
ULP B0 integrate the latest SAI IP, there is version id and
parameter id register in the beginning, so update the offset
for ULP B0

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:55 +08:00
868ead7e7e MLK-17528-3: ASoC: fsl_sai: Set clock rate in "set_sysclk" API
Set the requested clock rate in "set_sysclk" for specified clock id.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:55 +08:00
c5f603a927 MLK-17528-1: ASoC: fsl_sai: Introduce FSL_SAI_CLK_BIT clock id
Introduce FSL_SAI_CLK_BIT clock id in order to distinguish
the bit clock and master clocks in "set_sysclk" API.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:54 +08:00
af5446166b MLK-17566: ASoC: fsl_sai: fix register definition
The register definition is not completed for SAI support
8 transmit data register and 8 receive data register.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:53 +08:00
7713dcdb9f MLK-17485: ASoC: fsl_sai: Specify supported rate_min and rate_max
Because fsl_sai_dai rates doesn't have a specific set of
rate values (.rates = SNDRV_PCM_RATE_KNOT) we need to provide
rate_min and rate_max otherwise functions trying to get
supported parameters will get confused and return an error.

Fixes:  1b6f0496e0 ("MLK-17428-8: ASoC: fsl_sai: support 768KHz sample rate")
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:53 +08:00
c31b8ab22e MLK-17428-8: ASoC: fsl_sai: support 768KHz sample rate
support 768Hz sample rate and 2.8MHz for DSD

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:52 +08:00
086dcbc6a9 MLK-16224-6: ASoC: fsl_sai: fix DSD suspend/resume
With the existing implementation the SAI pinctrl state is restored to
default after resume - this breaks DSD playback after resume.
Restore DSD pinctrl state in snd_soc_dai_driver resume callback.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:52 +08:00
27fdb7856d MLK-17467: ASoC: fsl_sai: fix typo for fsl_sai
Fix build warning

sound/soc/fsl/fsl_sai.c: In function ‘fsl_sai_trigger’:
sound/soc/fsl/fsl_sai.c:736:3: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
   while (tx && i < channels)
   ^~~~~
sound/soc/fsl/fsl_sai.c:742:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘while’
    j++;
    ^
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:52 +08:00
15e50be363 MLK-16224-4: ASoC: fsl_sai: support multi fifo and DSD
The codec always mux the LRCLK pin to DSD data line, so when
we want to support DSD, the pinmux is different. For two channel
DSD, the DSDL is mapped to TX0, but the DSDR is mapped to TX4,
there is address offset for the fifo address of TX0 and TX4, TX4's
fifo is not adjacent to TX0's.

Usually, if mapping is TX0 and TX1, that will be easy for SAI
and SDMA to handle, that SAI can use the FIFO combine mode, SDMA
can use the normal script.

so for DSD:
1. The SDMA should use the multi-fifo script, and SAI can't
use the FIFO combine mode.
2. driver should to check the dts configuration(fsl,dataline) for
which dataline is used corrently
3. maxburst is the multiply of datalines
4. each channel of DSD occupy one data lane
5. according to data lane, set TRCE bits

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:50 +08:00
82a7f067a1 MLK-17442: ASoC: fsl: fix wrong usage of filter_data (part 1)
The filter_data should be used for dma_filter_fn function,
but we used the filter_data wrongly for dma channel name.
This patch is to fix the issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviwed-by: Daniel Baluta <daniel.baluta@nxp.com>
[ Aisheng: split out esai and pcm changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:49 +08:00
c49d1d073a MLK-16929-1: ASoC: fsl_sai: add bitclk_freq
Allow set SAI bit clock frequency trough snd_soc_dai_set_sysclk
function call on machine sound drivers.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Adrian Alonso <adrian.alonso@nxp.com>
2019-11-25 15:53:49 +08:00
300eef7d06 MLK-13946-8: ASoC: fsl_sai: use min(channels,slots) for xMR setting
xMR setting must be set as min(channels,slots) since
both "channels < slots" and "channels > slots" scenarios
are possible.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:49 +08:00
0da2560aff 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>
2019-11-25 15:53:48 +08:00
4b73b084ba MLK-16130-1: ASoC: fsl_sai: enable TCE/RCE according to input channels
If there is only two channels input and slots is 2, then enable one
port is enough for data transfer. so enable the TCE/RCE according to
the input channels and slots configuration.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:48 +08:00
be7bf0faa8 MLK-13975: ASoC: fsl_sai: Refine master flag handling
The patch introduces the master flag handling
as function of direction and the option to provide
the flag value from DTS.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:47 +08:00
c709ebd035 MLK-15960-2: ASoC: fsl_sai: refine the pm runtime function
In imx8qm/imx8qxp, the power domain of IP is enabled when
pm_runtime_get_sync() is called, and disabled when pm_runtime
_put_sync() is called. when power domain is disabled, the value
of registers will lost, so we need to use the regcache_sync()
to restore the registers in fsl_sai_runtime_resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:47 +08:00
f4a5a72887 MLK-15960-1: ASoC: fsl_sai: update fifo_depth for different platform
The fifo_depth is changed to 64 in imx8qm/imx8qxp, in imx8mq, the
fifo_depth is 128. which is mentioned in their ADD.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:46 +08:00
90efe83b6e MLK-15927-1: ASoC: fsl_sai: Fix noise when using EDMA
EDMA requires the period size to be multiple of maxburst. Otherwise the
remaining bytes are not transferred and thus noise is produced.

We can handle this issue by adding a constraint on
SNDRV_PCM_HW_PARAM_PERIOD_SIZE to be multiple of tx/rx maxburst value.

This is based on a similar patch we have for ESAI:
commit bd3f3eb2a37c
("MLK-15109-2: ASoC: fsl_esai: add constrain_period_size")

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:45 +08:00
62bd14531e MLK-15140-1: ASoC: fsl_sai: support latest sai module
The version of sai is upgrate in imx8mq, which add two register
in beginning, there is VERID and PARAM. the driver need to be
update

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:45 +08:00
f3f09671c6 MLK-14935: ASoC: fsl_sai: Fix mixing initialization data with actual audio samples
When starting a playback the initialization data used to reduce underruns
was send to the transmit data register after the DMA requests were enabled.
This patch moves the initialization phase before enabling the DMA so the
data is transmitted in correct order.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
2019-11-25 15:53:44 +08:00
35c3e9f7fe MLK-14870: ASoC: fsl_sai: Remove support for S20_3LE
With current clock configuration we cannot derive bitclk for S20_3LE
format in SAI master mode. There was an attempt to fix this in commit
65e6b5f1b4a7 ("MLK-14536: ASoC: wm8960: Fix playback in CPU DAI master mode")
but this broke codec-master mode, thus the patch was partially reverted in
96f0d36e420 ("MLK-14798: arm: dts: imx6ul: Fix wm8960 codec master mode")

So, remove S20_3LE support for SAI master mode. Clients using this
feature should use codec master mode, which is the default one in the
dts anyway.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:44 +08:00
3d1fa75a96 MLK-14847: Revert "ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode"
This reverts commit c768ed336b ("ASoC: fsl-sai: set xCR4/xCR5/xMR for
SAI master mode")

This change was already introduced by commit 51659ca069 ("ASoC: fsl-sai:
set xCR4/xCR5/xMR for SAI master mode") from upstream.

Manually adjust the code to match the changes introduced by subsequent
commit b2936555bb38 ("MLK-13609: ASoC: fsl_sai: fix for synchronize mode")
by removing updates to FSL_SAI_TMR/FSL_SAI_RMR registers.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
2019-11-25 15:53:42 +08:00
56507d35db ASoC: fsl: add imx-pcm-dma v2 platform driver (part 2)
which don't request the dma channel in the probe, but request
dma channel when needed. for the dma channel of cpu dai in BE
can be reused by the FE.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: split PCM changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:42 +08:00
cbd9903c62 ASoC: fsl_sai: set specific fmt for I2S XTOR
Set specific fmt, for i2s xtor receiver is
in slave mode and i2s xtor transmitter is in master mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:42 +08:00
cd3f08ca64 ASoC: fsl_sai: handle slave mode per TX/RX direction
The SAI interface can be a clock supplier or consummer
as function of stream direction, ie when interacting
with I2S XTOR. Removed FSL_SAI_RFR define as it is now
referred as FSL_SAI_RFR0.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:40 +08:00
606e962127 ASoC: fsl_(e)sai: introduce "shared-interrupt" DT flag (part 2)
SAI & ESAI interfaces may share the same interrupt with EDMA,
so that we need a flag to trigger proper shared interrupt
handling. For compatibility the same DT flag, "shared-interrupt",
is introduced as the one used in drivers/dma/fsl-edma-v3.c.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
[ Aisheng: split easi changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:39 +08:00
e03d9fa698 MLK-13609: ASoC: fsl_sai: fix for synchronize mode
TX synchronous with receiver: the RMR should not be changed and
the RCSR.RE should be set in playback.
RX synchronous with transmitter: the TMR should not be changed and
the TCSR.TE should be set in recording.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:39 +08:00
da84851398 MLK-13574-2: ASoC: fsl_sai: refine driver for ip upgrade
In imx7ulp1, the sai can support two TX channel and two RX
channels, So the usage need to be updated.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:39 +08:00
2bb7f96ef1 MLK-12786-2: ASoC: fsl_sai: correct the clock source for mclk0
mclk0 is assigned through the device tree.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:38 +08:00
6099503aa3 MLK-12374: ASoC: fsl_sai: Change the dev_warn to dev_dbg
When audio stop, it will first stop dma, then stop cpu_dai.
If there is delay between dma stop and cpu dai stop, there
will be underrun error, the print will cost time, then will
cause another underrun error, it is a infinite loop.
Which will cause the cpu dai can't stop.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:37 +08:00
583b9f7b09 ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode
For SAI master mode, when Tx(Rx) sync with Rx(Tx) clock, Rx(Tx) will
generate bclk and frame clock for Tx(Rx), we should set RCR4(TCR4),
RCR5(TCR5) and RMR(TMR) for playback(capture), or there will be sync
error sometimes.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 51659ca069)
2019-11-25 15:53:37 +08:00
bf40b0c9ad MLK-11628 ASoC: fsl_sai: add initial value for is_slave_mode
After playback audio with sai<->wm8960 sound card, is_slave_mode
will be set, but it will not be cleared. So playback audio with
sai<->sii902x sound card will have no voice.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
2019-11-25 15:53:36 +08:00
90248ae954 MLK-10611-1 ASoC: fsl-sai: Just one device can playback(captrue) when using the same SAI
Just one device can playback(captrue) when using the same SAI.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 7981a488c4da440db21f0544b519b44636a0cabb)
2019-11-25 15:53:35 +08:00
9401ad6c72 MLK-9974: ASoC: fsl_sai: There is underrun detected in the beginning sometimes
Write initial words to SAI FIFO to reduce underrun error

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 7ba8ae883d84540fac5ed4147d124399537bc0b3)
(cherry picked from commit f4435f35aa2a97551d2c4a12ca316c354a880f85)
2019-11-25 15:53:35 +08:00
a7e3a722ed Revert "ASoC: fsl_sai: add of_match data"
This reverts commit 89c9679f69.
2019-11-25 15:53:34 +08:00
252b2a0d9e Revert "ASoC: fsl_sai: derive TX FIFO watermark from FIFO depth"
This reverts commit bd517707d8.
2019-11-25 15:53:34 +08:00
0df4d8e7c7 Revert "ASoC: fsl_sai: mark regmap as fast_io"
This reverts commit 6d19d8a3ce.
2019-11-25 15:53:33 +08:00
f337340c23 Revert "ASoC: Remove dev_err() usage after platform_get_irq()"
This reverts commit cf9441adb1.
2019-11-25 15:53:33 +08:00
ab150b3f7c Revert "ASoC: fsl_sai: Add registers definition for multiple datalines"
This reverts commit 5f0ac20ed6.
2019-11-25 15:53:32 +08:00
d992f25c8a Revert "ASoC: fsl_sai: Update Tx/Rx channel enable mask"
This reverts commit b84f50b0fc.
2019-11-25 15:53:32 +08:00
0f43cd8a07 Revert "ASoC: fsl_sai: Add support for SAI new version"
This reverts commit 4f7a0728b5.
2019-11-25 15:53:31 +08:00
119c5ea09b Revert "ASoC: fsl_sai: Add support for imx7ulp/imx8mq"
This reverts commit a860fac420.
2019-11-25 15:53:31 +08:00
0476bb82fb Revert "ASoC: fsl_sai: Add support for imx8qm"
This reverts commit 6eeb60be5e.
2019-11-25 15:53:31 +08:00
b47e849752 Revert "ASoC: fsl_sai: Implement set_bclk_ratio"
This reverts commit 63d1a3488f.
2019-11-25 15:53:30 +08:00
1ea30a6341 Revert "ASoC: fsl_sai: Fix noise when using EDMA"
This reverts commit e75f4940e8.
2019-11-25 15:53:29 +08:00
50b229c2d5 ASoC: imx-pcm-rpmsg: Remove the prtd
prtd is not needed by this driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:25 +08:00
6eb375e54d ASoC: imx-pcm-rpmsg: Fix writecombine/wc build error
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:53:23 +08:00
07386f3836 ASoC: rpmsg_ak4497: ignore suspend with DAPM
When suspend, the widget "AK4497 DAC" is powered down
then there is no sound output, which is not accepted
by LPA definition.

so ignore suspend with DAPM, that the widget will not
be powered down

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:23 +08:00
bc157dae22 Revert "ASoC: soc-pcm: remove soc_rtdcom_ack()"
This reverts commit 18bd7b5ef3.

We need the soc_rtdcom_ack() for LPA.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:22 +08:00
9c2bac2c85 ASoC: rpmsg_wm8960: replace codec to component
replace codec to component

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:22 +08:00
b13fc2d9bb ASoC: rpmsg_cs42xx8: replace codec to component
replace codec to component

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:21 +08:00
d4215f5953 ASoC: rpmsg_ak4497: replace codec to component
replace codec to component

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:21 +08:00
26e4c3d80f ASoC: fsl_rpmsg: Merge changes from imx_4.19.y
77be7d36a5 ("MLK-22400-1: ASoC: fsl_rpmsg_i2s: Add rpmsg i2s for imx8mn")
31d5dfa44c ("MLK-22340-5: ASoC: imx-pcm-rpmsg: enable ignore_suspend for LPA")
c5c41138d5 ("MLK-22340-4: ASoC: fsl_rpmsg_i2s: add lock to protect the resource")
adb4b596d2 ("MLK-22340-3: ASoC: imx-pcm-rpmsg: refine the timer")
a5e80bf012 ("MLK-22340-2: ASoC: imx-pcm-rpmsg: drop the cmd I2S_TX_POINTER")
404367d931 ("MLK-21980: ASoC: imx-pcm-rpmsg: add debugfs_prefix for platform")
971faf0952 ("MLK-21450: ASoC: fsl_rpmsg: fix timer issue for updating to 4.19")
edbbcdc07b ("MLK-21461: ASoC: fsl_rpmsg_i2s: clear buffer pointer in i2s_send_message")
f5f2f38018 ("MLK-21447: ASoC: fsl_rpmsg_i2s: underrun in m4 for msg delayed")
d9410ace75 ("MLK-21307: ASoC: fsl_rpmsg_i2s: optimize the message sent to m4")
98633a4cd3 ("MLK-21440-1: ASoC: fsl_rpmsg_i2s: init spin lock")
7bf6d31318 ("MLK-21107-1: ASoC: Fix timer wake up system after suspend")
eb422681ff ("MLK-20661: ASoC: imx-pcm-rpmsg: remove the nonblock constraint")
e36957e97c ("MLK-21002-1: ASoC: imx-pcm-rpmsg: fix data consumed faster with pause")
bc828e6169 ("MLK-19565-1: ASoC: fsl_rpmsg_i2s: support rpmsg on imx8qm")
e56bedf71a ("MLK-21107-2: ASoC: Drop msg if msg queue is full")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 31def06487)
2019-11-25 15:53:20 +08:00
b3b38fea22 MLK-21440-1: ASoC: fsl_rpmsg_i2s: init spin lock
With CONFIG_LOCKDEP=y, there will kernel dump

[   55.305563] INFO: trying to register non-static key.
[   55.310540] the code is fine but needs lockdep annotation.
[   55.316027] turning off the locking correctness validator.
[   55.321520] CPU: 0 PID: 32 Comm: kworker/0:1 Tainted: G        W       4.14.78-00007-g524e1b1f0b3f #18
[   55.330827] Hardware name: FSL i.MX8MM EVK board (DT)
[   55.335892] Workqueue: events rpmsg_work_handler
[   55.340515] Call trace:
[   55.342971] [<ffff00000808c438>] dump_backtrace+0x0/0x270
[   55.348375] [<ffff00000808c6cc>] show_stack+0x24/0x30
[   55.353433] [<ffff000009078f38>] dump_stack+0xb8/0xf0
[   55.358490] [<ffff000008150404>] register_lock_class+0x364/0x548
[   55.364501] [<ffff000008153544>] __lock_acquire+0x7c/0x18a8
[   55.370077] [<ffff0000081555e8>] lock_acquire+0xc8/0x290
[   55.375394] [<ffff00000909422c>] _raw_spin_lock_irqsave+0x54/0x70
[   55.381493] [<ffff000008d80888>] i2s_rpmsg_cb+0xe8/0x1b0
[   55.386810] [<ffff000008d01dc4>] rpmsg_recv_done+0x144/0x210
[   55.392476] [<ffff000008713f44>] vring_interrupt+0x44/0x78
[   55.397966] [<ffff000008d025d4>] imx_mu_rpmsg_callback+0x6c/0x80
[   55.403977] [<ffff000008111f44>] notifier_call_chain+0x5c/0x98
[   55.409813] [<ffff0000081124f8>] __blocking_notifier_call_chain+0x58/0xa0
[   55.416605] [<ffff00000811257c>] blocking_notifier_call_chain+0x3c/0x50
[   55.423223] [<ffff000008d029a0>] rpmsg_work_handler+0x88/0xe8
[   55.428974] [<ffff000008108380>] process_one_work+0x290/0x738
[   55.434723] [<ffff000008108880>] worker_thread+0x58/0x460
[   55.440127] [<ffff000008110084>] kthread+0x104/0x130
[   55.445096] [<ffff000008085a4c>] ret_from_fork+0x10/0x1c

The reason is that the spin lock is not initilized.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0e98ac55f1)
(cherry picked from commit 314ef30b1b)
2019-11-25 15:53:20 +08:00
49822e0e11 MLK-21440-2: ASoC: imx-rpmsg: Remove snd_soc_find_dai
Previously we add snd_soc_find_dai to check if the codec is probed or
not, but this bring kernel dump issue when CONFIG_LOCKDEP=y.

[    2.823379] WARNING: CPU: 2 PID: 1 at sound/soc/soc-core.c:1016 snd_soc_find_dai+0x144/0x150
[    2.831827] Modules linked in:
[    2.834907] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.14.78-00007-g524e1b1f0b3f #18
[    2.842748] Hardware name: FSL i.MX8MM EVK board (DT)
[    2.847811] task: ffff8000624f0000 task.stack: ffff000008078000
[    2.853745] PC is at snd_soc_find_dai+0x144/0x150
[    2.858462] LR is at snd_soc_find_dai+0x140/0x150

...

[    3.469675] Call trace:
[    3.472135] Exception stack(0xffff00000807ba40 to 0xffff00000807bb80)
[    3.478590] ba40: 0000000000000000 00000000ffffffff 0000000000000000 0000000000000002
[    3.4864333.596564] [<ffff00000883f2a8>] bus_add_driver+0x110/0x230
[    3.602149] [<ffff0000088412e8>] driver_register+0x68/0x100
[    3.607735] [<ffff0000088426dc>] __platform_driver_register+0x54/0x60
[    3.614191] [<ffff0000097e4cc8>] imx_rpmsg_driver_init+0x20/0x28
[    3.620213] [<ffff0000080844c4>] do_one_initcall+0x44/0x130
[    3.625801] [<ffff000009760ef8>] kernel_init_freeable+0x1e0/0x280
[    3.631909] [<ffff00000908c3f8>] kernel_init+0x18/0x110
[    3.637148] [<ffff000008085a4c>] ret_from_fork+0x10/0x1c

So we could't resolve the warning "snd_soc_register_card failed (-517)".

Fixes: 75632b22a3 ("MLK-20247: ASoC: imx-rpmsg: fix error when
m4 image is not loaded")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>

(cherry picked from commit bbc1868d1c)
(cherry picked from commit ebf3fc59b8)
2019-11-25 15:53:16 +08:00
75b0218811 ASoC: fsl: fix SND_SOC_FSL_RPMSG_I2S dependency issue
IMX RPMSG is still not ready.

In file included from ../sound/soc/codecs/rpmsg_wm8960.c:27:0:
../sound/soc/codecs/../fsl/fsl_rpmsg_i2s.h:278:29: fatal error: linux/imx_rpmsg.h: No such file or directory
 #include <linux/imx_rpmsg.h>
                             ^
compilation terminated.
../scripts/Makefile.build:278: recipe for target 'sound/soc/codecs/rpmsg_wm8960.o' failed
make[4]: *** [sound/soc/codecs/rpmsg_wm8960.o] Error 1
make[4]: *** Waiting for unfinished jobs....
  AR      arch/arm/mach-imx/built-in.a
In file included from ../sound/soc/codecs/rpmsg_cs42xx8.c:25:0:
../sound/soc/codecs/../fsl/fsl_rpmsg_i2s.h:278:29: fatal error: linux/imx_rpmsg.h: No such file or directory
 #include <linux/imx_rpmsg.h>

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:15 +08:00
0f97f661f2 MLK-19168-5: ASoC: imx-cs42888: support codec through rpmsg (part 2)
support codec through rpmsg

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 8585d67e54c4c3607990a792718992de8be8fe58)
[ Aisheng: split card imx-cs42888 changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:15 +08:00
a6f50f7227 MLK-20661: ASoC: imx-pcm-rpmsg: remove the nonblock constraint
we can call the snd_pcm_period_elapsed in timer's callback
to achieve pseudo period wake up, so the nonblock constraint
can be removed

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:14 +08:00
270158aedd MLK-20434: ASoC: fsl_rpmsg_i2s: add more rates in constraint list
add more rates in constraint list, Fixes commit ee959e2c9b
("MLK-19581-3: ASoC: fsl_rpmsg_i2s: support multipul rate and DSD format")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:14 +08:00
f59723a50d MLK-20357-1: ASoC: imx-rpmsg: add audio routing for wm8960
The rpmsg wm8960 codec driver is completed to support
full function, not only the volume control. which cause
an issue that there is no sound when recording, the reason
is that the MIC Bias not enabled, and it should be enabled
through audio routing.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:13 +08:00
ce1d0f858c MLK-20247: ASoC: imx-rpmsg: fix error when m4 image is not loaded
The reason is same as commit d4eb8ab263 ("MLK-19854-1: ASoC:
imx-cs42888: fix error when m4 image is not loaded")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:13 +08:00
cabb2debdc MLK-20277-3: ASoC: imx-pcm-rpmsg: change the state of substream in resume
In LPA mode, the system will be resumed by audio notification, when the
period size is small, there will be occasion that when notification
the underrun is happen, but the substream runtime state is not running
so the aplay won't trigger stop first, then start. just only trigger
the start, which don't comply with the convention.
So in this patch, we change the substream runtime state to running, when
the notification happened at resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:12 +08:00
783c56a330 MLK-20277-2: ASoC: rpmsg_ak4497: remove digital_mute function
For the LPA mode, when the system enter suspend, the M4 will
continue to play the data, but for normal ALSA case, the digital
mute should be called at suspend, so the codec will be mute,
which conflict with the requirement of LPA.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:11 +08:00
aa4833ef35 MLK-20277-1: ASoC: imx-pcm-rpmsg: reset the period index at stop
With the case that underrun happened, the aplay will trigger
stop and start, if the period index is not reset at stop, the
counter of period will be wrong

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:10 +08:00
66aea92f46 MLK-19750-3: ASoC: rpmsg_cs42xx8: enhance async mode for rpmsg_cs42xx8
with this patch,codec driver can support tx and rx in
different master/slave mode, for example, tx in master mode,
rx in slave mode

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:10 +08:00
4fd0f03d0b MLK-19760: ASoC: imx-pcm-rpmsg: fix resume back quickly after resume
With LPA mode, if the period size is small, the timer for query
buffer pointer will be triggered immediately after suspend, the MU
interrupt will resume the system quickly.
This patch is to disable timer when suspend.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 9c5e78cf50855bd73f2b5c3dc8bc48f8a0907b39)
2019-11-25 15:53:10 +08:00
6ef9128b30 MLK-19581-4: ASoC: imx-pcm-rpmsg: support rpmsg_ak4497
register the codec when needed.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 241b6b3275924f3dc63be26d1442b55b80ac53ef)
2019-11-25 15:53:09 +08:00
ace16c55c8 MLK-19581-3: ASoC: fsl_rpmsg_i2s: support multipul rate and DSD format
The Ak4497 support large range rate and DSD format, so increase
the supported scope of cpu dai.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 29155a9161bfb9985918ed9130aebafc2293c734)
2019-11-25 15:53:09 +08:00
1744cad4ec MLK-19581-2: ASoC: imx-rpmsg: support rpmsg_ak4497
For ak4497, the dai fmt should be SND_SOC_DAIFMT_CBS_CFS.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit ecd184c46e2916d2bcdde8db9b2281b89e8b0189)
2019-11-25 15:53:08 +08:00
d895d7a234 MLK-19581-1: ASoC: rpmsg_ak4497: support ak4497 over rpmsg
The difference of rpmsg_ak4497 and ak4497 driver is first one
will send command through rpmsg, second one send command through
i2c.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 337f70c4ea5278db28abe1e6eaefbf2d0082aec5)
2019-11-25 15:53:08 +08:00
713549b367 MLK-19565-1: ASoC: fsl_rpmsg_i2s: support rpmsg on imx8qm
On imx8qm mek, the cs42888 is connected with i2c in cm41 domain,
but wm8960 is connected with i2c1, which is not in m4 domain.
So we only need to eable rpmsg for cs42888.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 9d2368aef40e4d107e4deee1a2c7e191c1afe644)
2019-11-25 15:53:07 +08:00
6414b94c42 MLK-19168-6: ASoC: imx-rpmsg: update the rpmsg codec name
update the rpmsg codec name

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 6130b919df97b127fafe319f0c2ff601ebc6bed2)
2019-11-25 15:53:06 +08:00
08cf70aa23 MLK-19168-4: ASoC: fsl_rpmsg_i2s: support more codec
support more codecs, codec is specified by compatible string

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 7c92a75fcf83ec0aa3fe6773e4cb5f5e88a1ff09)
2019-11-25 15:53:05 +08:00
997f8ece23 MLK-19168-3: ASoC: imx-pcm-rpmsg: register rpmsg wm8960 and cs42xx8 codec
register rpmsg wm8960 and cs42xx8 codec

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit c49f8d20c6fd4479ad45d76290bb5c57d4800d9e)
2019-11-25 15:53:05 +08:00
dba422ef60 MLK-19168-2: ASoC: rpmsg_cs42xx8: support cs42xx8 over rpmsg
The difference of rpmsg_cs42xx8 and cs42xx8 driver is previous one
will send command through rpmsg, others are same.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit dda40ff395bb1d86fc75920bb2bc2ea99099ed4b)
2019-11-25 15:53:04 +08:00
69776826fd MLK-19168-1: ASoC: rpmsg_wm8960: port all function from wm8960
The difference of rpmsg_wm8960 and wm8960 driver is previous one
will send command through rpmsg, others are same.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 094521755ae806a572fd841455371b23408c36d1)
2019-11-25 15:53:04 +08:00
6b270ced20 MLK-19155: ASoC: fsl_rpmsg: fix the volume is low for S24_LE
The format send to M4 through rpmsg is wrong, that make the
driver treat the data as S32_LE, it looks like data is right
shift 8 bit.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 508550b70e80339d3d49594ffc23946dd80b0c82)
2019-11-25 15:53:03 +08:00
610f643cd3 MLK-19067-1: ASoC: imx-rpmsg: differentiate input and output direction
Some platform the rpmsg device only support playback or record. So
Add a property to differentiate them.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit aa8b9304d207e5f00cca8a41772c130dd4c6944b)
2019-11-25 15:53:03 +08:00
95f35f84fe MLK-19042-4: ASoC: imx-rpmsg: dummy codec support in imx8mm
In imx8mm, there is no controls for wm8524, so we use the
dummy codec instead.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 43bcd3a8e9f4c1b2af9974f2082a34beacfba4a1)
2019-11-25 15:53:02 +08:00
354ef27ff1 MLK-19042-3: ASoC: rpmsg_wm8960: changes for receive message
Update the read and write function for the send_message function
changes

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 4610826f39ee4124588b818e5589c25448aa3dba)
2019-11-25 15:53:02 +08:00
c17407c2dd MLK-19042-2: ASoC: imx-pcm-rpmsg: support low power audio
Add ack function, which is to info M4 side how many data
has been writen to buffer.

Add timer, which is to get the position of hw pointer in m4.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 0fd349fbab28d97f8c5501ec635bff053e3b1470)
2019-11-25 15:53:01 +08:00
093cb51e6f MLK-19042-1: ASoC: fsl_rpmsg_i2s: support low power audio
Add two new message command I2S_TX_POINTER and I2S_RX_POINTER,
which are used to get the hw pointer in m4 side. For in low
power audio mode, m4 won't send notification every period, the
notification only be sent when hw pointer reach end of buffer,
so we need these command to get the position of hw pointer,
user can use it to calculate the timestamp.

Restructure send message and recv message together for i2s_rpmsg,
that every send message has a recv message. so the
i2s_send_message can store the recv message indepedently. one
reason is that the receive message is async withe send message.

The low power audio is disabled in default, user need to enabled
it by add "fsl,enable-lpa" in dts.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 753e7b819609ad4791e32069a124d4411c720947)
2019-11-25 15:53:00 +08:00
ce72f6da78 MLK-17979: ASoC: rpmsg_wm8960: add mixer control for ADC input
The microphone only connect to left input, when record stereo channel
data, the right channel is mute. Add 'ADC Data Output Select' mixer
control that user can select the wanted configure. The default setting
is 'Left Data = Left ADC;  Right Data = Left ADC'.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:00 +08:00
b9156dc3c1 MLK-17156-7: ASoC: imx-rpmsg: use rpmsg codec instead the dummy
use the rpmsg_wm8960 codec instead of the dummy codec

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:00 +08:00
35c675bc63 MLK-17156-6: ASoC: imx-pcm-rpmsg: fix get codec data failed
Receive message is only used when the type is B. originally
we copy the receive message to revg_msg all the time, when
the message type is C, which will overide the revg_msg, which
cause the get codec data command return wrong value.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:59 +08:00
f823c83ef9 MLK-17156-5: ASoC: imx-pcm-rpmsg: register rpmsg codec
register rpmsg codec after the rpmsg-audio-channel is
ready.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:58 +08:00
d41276f382 MLK-17156-4: ASoC: rpmsg_wm8960: add rpmsg_wm8960 codec
This codec is accessed by rpmsg. As the wm8960 is controlled
mainly by M4, so we only add volume in this rpmsg_wm8960 codec.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:58 +08:00
c98b293c40 MLK-17156-3: ASoC: fs_rpmsg_i2s: update the protocol for i2c message
rpmsg provide command for A7 side to set the codec value and get
codec value by i2c. In this case, the A7 can control the codec.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:57 +08:00
53039092de MLK-17220: ASoC: fsl_rpmsg_i2s: restore original lock context
Restore original lock context and unlock the mutex in case if
info->rpdev is uninitialized.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:52:56 +08:00
ccb2d1a994 MLK-17220: ASoC: fsl_rpmsg_i2s: unlock mutex on error
Mutex must be unlocked when i2s_send_message method
fails.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:52:55 +08:00
214ddc0e96 MLK-14989: ASoC: fsl_rpmsg_i2s: enable pm_qos for audio
with "echo 1 > /sys/class/graphics/fb0/blank", and there is no
usb connected on board, the system may enter low power mode,
then audio playback will be failed. use pm_qos to prevent A7
core enter low power mode during audio playback and recording.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:55 +08:00
7fadff23ce MLK-14528: ASoC: sdma: Update period/segment max bytes (part 2)
Commit 665ced16cf ("MLK-10050 dma: imx-sdma: add support for sdma
memory copy") enforces maximum SDMA buffer descriptor length at 65532,
but doesn't update period_bytes_max or max_segment size in DMA drivers.

Thus, resulting in the following bug:

$ arecord -Dhw:0,0 -r 192000 -f S20_3LE -c 1 -d 10 audio192k20b1c.wav
imx-sdma: SDMA channel 5: maximum period size exceeded: 65534 > 65532

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
[ Aisheng: split asrc change ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:54 +08:00
14e0dcede5 MLK-14582: ASoC: imx-pcm-rpmsg: fix audio noise issue with pulseaudio
The pulse audio will set a wrong buffer size which is not the integral
multiple of period size, it will cause the DMA can't work correctly in
M4 side.
The reason is that we always need to add a constraint for
SNDRV_PCM_HW_PARAM_PERIODS, which make it integer.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 54a10a6c2130a69aca4c1923dac3a15137911146)
2019-11-25 15:52:54 +08:00
ce2f05d271 MLK-14372: ASoC: fsl_rpmsg_i2s: remove unsupported sample rate
RTOS for M4 core in imx7ulp don't support 32kHz and 44kHz

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:53 +08:00
5d8c7ea7ce MLK-14258: ASoC: imx-pcm-rpmsg: sync sample rate with tx and rx
In suspend and resume, the M4 side will reset hw parameter for tx
and rx, when only tx is working, the parameter of rx is a old value,
which will cause the parameter is not sync with tx and rx.
currently the M4 audio can only work in sync mode, so set both
parameter in same time.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:53 +08:00
c040763b30 MLK-14254: ASoC: imx_pcm_rpmsg: fix cmd dropped by work queue
The test case is to playback a bitstream, then repeat ctrl+z and fg,
several times later, the playback is failed to continue.

The reason is if the work is pending in work queue, send second time
of this work, the second work is dropped by work queue. so use one
work for one cmd is not fit for audio case. use a work loop for audio
cmd to fix this issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:52 +08:00
45aa9064e2 MLK-14007: ASoC: fsl_rpmsg_i2s: remove mono for M4 don't support it
Currently the M4 audio driver don't support mono channel, so remove it.
After mono channel is supported in M4 os, this commit should be reverted.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:51 +08:00
c5ffd857b5 MLK-13992: ASoC: fsl_rpmsg_i2s: add flush workqueue
some cmd is sent by workqueue, others are sent by call send message
function directly, for workqueue may have delay, so there is occasion
that cmd is not sent in order.
Add flush_workqueue before the CLOSE and SUSPEND to make sure previous
cmd is finished in that time.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:50 +08:00
aa0cc6695a MLK-13991: ASoC: fsl_rpmsg_i2s: remove unsupported rate
The M4 audio driver only support 8k/16k/32k/44k/48kHz sample rate.
so remove other rate in supported list.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:50 +08:00
92dd31be5b MLK-13980: ASoC: fsl_rpmsg_i2s: fix wrong cmd sent to M4 in suspend
This typo issue will cause that wrong cmd send to M4 side.

Fixes: 3e13a631aee0 ("MLK-13904-1: ASoC: fsl: add audio cpu dai driver base on rpmsg")

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:50 +08:00
6e155db640 MLK-13904-3: ASoC: fsl: add audio machine driver base on rpmsg
Add machine driver, which is using the dummy codec.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Acked-by: Robin Gong <yibin.gong@nxp.com>
[ Aisheng: clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:49 +08:00
118fc234d5 MLK-13904-2: ASoC: fsl: add audio platform driver base on rpmsg
Add platform driver, each step like set hw param, trigger start
trigger stop, and so on, will call the rpmsg api.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Acked-by: Robin Gong <yibin.gong@nxp.com>
[Aisheng: clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:48 +08:00
a019e7b415 MLK-13904-1: ASoC: fsl: add audio cpu dai driver base on rpmsg (part 1)
Add the cpu dai driver, as the rpmsg_send api can't be used in
atomic context, so using the workqueue instead of calling
rpmsg_send() directly.
The detail communication stack is defined in header file.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Acked-by: Robin Gong <yibin.gong@nxp.com>
[ Aisheng: split out imx-pcm.h changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:48 +08:00
e12b0060cd MLK-22598: ASoC: fsl_micfil: Reset channel output data Flag
With the case below, there is issue that after recording with
8 channels, the recording of 1 channel will fail.

arecord -Dhw:2,0 -r 32000 -f S16_LE -c 8 -d 5 -t raw /tmp/test1.pcm
arecord -Dhw:2,0 -r 32000 -f S16_LE -c 1 -d 5 -t raw /tmp/test2.pcm
arecord: pcm_read:2143: read error: Input/output error

The reason is that we need to reset channel output data Flag before
we start the recording

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 45ea3acd0c)
2019-11-25 15:52:44 +08:00
7ac5c8b94a ASoC: fsl_micfil: Merge the changes from imx_4.19.y
Merge the changes from imx_4.19.y

The top commit is:
b5472e3f3d ("MLK-21775-4: ASoC: fsl_micfil: synchronize HWVAD enable/disable")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:43 +08:00
1e852d94e0 ASoC: imx-hdmi: Fix compile error
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:40 +08:00
e9623c8a83 ASoC: imx-hdmi-dma: Fix issue with dma_alloc_coherent
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:40 +08:00
0ee873881b ASoC: imx-hdmi-dma: replace platform to component
As per commit 4cb1ea925e ("ASoC: fsl: dma: replace platform to
component"), replace platform to component.

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:52:39 +08:00
716fc277a2 ASoC: imx-cdnhdmi: Fix compile error
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:39 +08:00
10fa83ab64 MLK-20183-2: ASoC: imx-cdnhdmi: reconfigure the mclk for HDMI on imx8mq
In order to support 44kHz and 48kHz sample rate together, we need to
reconfigure the parent clock of mclk.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:38 +08:00
2c5a729e00 MLK-19312: ASoC: hdmi-codec: fix error log for hdmi audio
There is error log:

[   31.988272] hdmi-audio-codec hdmi-audio-codec.1: Not able to map channels to speakers (-22)
[   31.996659] hdmi-audio-codec hdmi-audio-codec.1: ASoC: can't set i2s-hifi hw params: -22

which is caused by the channel map read from device don't match
with current channel number.

Orignal method is just return error, but this channel number is
supported by device, so we think should not return error directly,
the playback can ongoing with UNKNOWN channel map.

This issue happen on some TV set (SUMSUNG UA40KUF30EJXXZ).

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:38 +08:00
139e0453a0 MLK-19063: ASoC: fsl_hdmi: fix null pointer dereference issue
This issue is reported by coverity (4022712).

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:37 +08:00
31e6c7140d MLK-18105: ASoC: imx-hdmi: fix no sound card issue
The codec dai name is changed in 4.14,so the machine driver need to
be updated

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:37 +08:00
6a7c25fc00 MLK-18833: ASoC: imx-cdnhdmi: fix no sound card issue
The codec dai name is changed in 4.14,so the machine driver need to
be updated

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:36 +08:00
67b21f3a87 MLK-18368-2: ASoC: fsl: support hdmi rx in machine driver
support hdmi rx in machine driver

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:35 +08:00
184f623bb7 MLK-18368-1: ASoC: codecs: support rx in hdmi codec driver
The most difference with TX is that RX don't need to get edid
information.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:35 +08:00
1e3b64e110 MLK-17794: ASoC: fsl: Add SND_SOC_IMX_CDNHDMI back
The FB_MX8_HDMI is removed, the dependency is changed
to DRM_IMX_HDP.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
2019-11-25 15:52:35 +08:00
3c4981dfe0 MLK-17620-2: ASoC: imx-cdnhdmi: switch to generic hdmi codec
switch to generic hdmi codec, which provide the api for get
the edid information.
Add snd controls which is the interface for user to query
the HDMI capibility. ( channels, rates, formats)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:52:33 +08:00
7ffc2895ef MLK-17344-1: ASoC: imx-cdnhdmi: get constraint rate from dts
Constraint rate depends on the clock rata of cpu dai, which is
defined in dts, so we add constraint-rate property in dts, then
driver can get it.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:33 +08:00
d16ae6be35 MLK-13946-4: ASoC: imx-cdnhdmi: refine machine driver for api changes
Since commit 3f5780eb45 ("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>
2019-11-25 15:52:32 +08:00
e2c81bccd1 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>
2019-11-25 15:52:32 +08:00
64bc534268 MLK-16159: ASoC: imx_cdnhdmi: refine the N value selection
According the HDMI spec, the N value depends on the TMDS
rate, and sample rate. As we set the vic mode in dts file,
use the vic_table to get the TMDS rate, then choose the
proper N value.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
2019-11-25 15:52:31 +08:00
2e02a9402d MLK-16130-2: ASoC: fsl: add machine driver for cadence hdmi
The machine driver will call the API which is provided by
the cadence to configure the audio features.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
[ Aisheng: clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:30 +08:00
323210035c MLK-13799: ASoC: fsl: Add ASoC generic hdmi audio codec support
Use the new ASoC hdmi-codec infrastructure.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
2019-11-25 15:52:30 +08:00
5dc1865131 MLK-13224: ASoC: imx-hdmi-dma: fix glitch noise issue in long time playback
The calculation "runtime->status->hw_ptr * (runtime->frame_bits / 8)" may
exceed the integer scope, then appl_bytes is no correct.
This patch is to fix this issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:29 +08:00
f1b5df313e MLK-9731 ASoC: imx-hdmi-dma: audio output is noisy in long time playback
In the frame_to_bytes(), when hw_ptr*frame_bits exceed the maxmum of unsigned
long, the return value is saturated, so the appl_bytes is wrong.
This patch is to correct the usage of frame_to_bytes().

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 9e66132d9c96305b65aa5fa3ba8a35271a04ded9)
2019-11-25 15:52:29 +08:00
ef0a172403 MLK-11530-01 ASoC: fsl_hdmi: port hdmi audio driver
cherry-pick below patch from v3.14.y:
ENGR00330403-2: ASoC: fsl_hdmi: port hdmi audio driver from imx_3.10.y

Port HDMI audio driver (CPU driver, machine driver, platform driver) from
imx_3.10.y.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>

During 4.14 rebase converted from snd_pcm_ops.copy to copy_user because
copy was removed by upstream

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
[ Aisheng: fix conflicts for a clean base and merge MLK-12244
file onwership change ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:28 +08:00
2bbe95fe6c ASoC: fsl_esai: Remove the tasklet
Remove tasklet for it may cause the xrun interrupt not be
handled immediately, that will be endless interrupt.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:26 +08:00
ff66736b87 ASoC: fsl_esai: Add spin lock to protect reset, stop and start
xrun may happen at the end of stream, the
trigger->fsl_esai_trigger_stop maybe called in the middle of
fsl_esai_hw_reset, this may cause esai in wrong state
after stop, and there may be endless xrun interrupt.

This issue may also happen with trigger->fsl_esai_trigger_start.

So Add spin lock to lock those functions.

Fixes: 7ccafa2b38 ("ASoC: fsl_esai: recover the channel swap after xrun")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/52e92c4221a83e39a84a6cd92fc3d5479b44894c.1572252321.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-25 15:52:26 +08:00
53115815b4 ASoC: fsl_esai: Remove expensive print in irq handler
When stopping audio, ASoC will first stop DMA then CPU DAI.
Sometimes there is a delay between DMA stop and CPU DAI stop, which
triggers an underrun error. Now, because of the delay introduced
by dev_err another underrun error will occur causing a vicious circle
making impossible to stop CPU DAI.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:25 +08:00
4058ef0bb8 ASoC: fsl_esai: support multi power domain
support multi power domain

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:25 +08:00
63458262c8 MLK-19750-1: ASoC: fsl_esai: enhance async mode (part 1)
With this patch, esai driver can support tx and rx in
different master/slave mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: split codec cs42xx8 changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:24 +08:00
f3b448d4e4 ASoC: fsl_(e)sai: introduce "shared-interrupt" DT flag (part 1)
SAI & ESAI interfaces may share the same interrupt with EDMA,
so that we need a flag to trigger proper shared interrupt
handling. For compatibility the same DT flag, "shared-interrupt",
is introduced as the one used in drivers/dma/fsl-edma-v3.c.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
[ Aisheng: split SAI changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:23 +08:00
21f3df8506 MLK-22815-1: ASoC: fsl: dsp: Expand parameter msg size
Modified parameter msg in dsp, make sure still can transfer right msg
between DSP and user, modified parameter msg in kernel.

Signed-off-by: Zhang Peng <peng_zhang_8@nxp.com>
2019-11-25 15:52:21 +08:00
6bfa0c442b MLK-21144 ASoC: fsl: Fix crash with multiple open/close
Because we are re-initializing the proxy at close it might
happen that work is still pending which causes the following crash:

[   94.699835] Unable to handle kernel NULL pointer dereference at virtual address 00000008
[   94.707923] Mem abort info:
[   94.710722]   Exception class = DABT (current EL), IL = 32 bits
[   94.716637]   SET = 0, FnV = 0
[   94.719686]   EA = 0, S1PTW = 0
[   94.722822] Data abort info:
[   94.725698]   ISV = 0, ISS = 0x00000005
[   94.729530]   CM = 0, WnR = 0
[   94.732504] user pgtable: 4k pages, 48-bit VAs, pgd = ffff8008d9ba3000
[   94.739035] [0000000000000008] *pgd=0000000938419003, *pud=0000000000000000
[   94.746015] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[   94.751589] Modules linked in:
[   94.754652] CPU: 0 PID: 2068 Comm: kworker/0:2 Not tainted 4.14.98-dirty #75
[   94.761700] Hardware name: Freescale i.MX8QM MEK (DT)
[   94.766768] task: ffff8008f23ae200 task.stack: ffff000014378000
[   94.772705] PC is at process_one_work+0x34/0x414
[   94.777325] LR is at process_one_work+0x1e0/0x414

In order to fix this, we make sure that no work is pending before starting
the re-initialization.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 2c00c24be5)
2019-11-25 15:52:20 +08:00
940d9baeca ASoC: fsl_dsp: Use new compatible string for FSL DSP
In order to support in parallel FSL DSP and SOF Linux drivers
we will need to use different compatible strings for DSP nodes.

Use fsl,imx8qxp-dsp-v1 for FSL DSP driver. Note that our goal is
to only support SOF Linux driver, so FSL DSP driver will be deprecated.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:20 +08:00
129c45f837 ASoC: fsl: dsp: remove unused types.h
types.h has been moved into rsrc.h

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:19 +08:00
3a3aba569a MLK-21985-6 ASoC: imx-dsp: fix build for next 20190607 upgrade
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

../sound/soc/fsl/imx-dsp.c: In function ‘imx_dsp_audio_probe’:
../sound/soc/fsl/imx-dsp.c:123:14: error: ‘struct snd_soc_dai_link’ has no member named ‘codec_dai_name’
  data->dai[0].codec_dai_name = "snd-soc-dummy-dai";
              ^
../sound/soc/fsl/imx-dsp.c:124:14: error: ‘struct snd_soc_dai_link’ has no member named ‘codec_name’
  data->dai[0].codec_name = "snd-soc-dummy";
              ^
../sound/soc/fsl/imx-dsp.c:125:14: error: ‘struct snd_soc_dai_link’ has no member named ‘cpu_dai_name’
  data->dai[0].cpu_dai_name = dev_name(&cpu_pdev->dev);
              ^
../sound/soc/fsl/imx-dsp.c:126:14: error: ‘struct snd_soc_dai_link’ has no member named ‘cpu_of_node’
  data->dai[0].cpu_of_node = cpu_np;
              ^
../sound/soc/fsl/imx-dsp.c:127:14: error: ‘struct snd_soc_dai_link’ has no member named ‘platform_of_node’
  data->dai[0].platform_of_node = platform_np;
              ^
../sound/soc/fsl/imx-dsp.c:140:14: error: ‘struct snd_soc_dai_link’ has no member named ‘codec_dai_name’
  data->dai[1].codec_dai_name = "cs42888";
              ^
../sound/soc/fsl/imx-dsp.c:141:14: error: ‘struct snd_soc_dai_link’ has no member named ‘codec_of_node’
  data->dai[1].codec_of_node = codec_np;
              ^
../sound/soc/fsl/imx-dsp.c:142:14: error: ‘struct snd_soc_dai_link’ has no member named ‘cpu_dai_name’
  data->dai[1].cpu_dai_name = "snd-soc-dummy-dai";
              ^
../sound/soc/fsl/imx-dsp.c:143:14: error: ‘struct snd_soc_dai_link’ has no member named ‘cpu_name’
  data->dai[1].cpu_name = "snd-soc-dummy";
              ^
../sound/soc/fsl/imx-dsp.c:144:14: error: ‘struct snd_soc_dai_link’ has no member named ‘platform_name’
  data->dai[1].platform_name = "snd-soc-dummy";

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:19 +08:00
4de686476a MLK-20793: ASoC: fsl_dsp: remove error message
With non fsl-imx8qxp-mek-dsp.dts, the clock is not assigned
to dsp node, which cause error message when kernel boot up.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:18 +08:00
87850fce95 ASoC: fsl_dsp: support multi power domain
support multi power domain

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:17 +08:00
badc4f7be2 MLK-20693-3: ASoC: fsl_dsp: Add clocks for peripheral devices
Add clocks for peripheral devices

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:17 +08:00
248f112adb MLK-20693-2: ASoC: fsl_dsp_cpu: remove the clock operation
Remove the clock operation in cpu dai, all clock will be
moved to platform driver.
The reason is that the suspend and resume of dsp is handled in
platform driver, if the clock is disabled before the suspend,
the dsp framework can't access the registers of device in suspend.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:16 +08:00
e8d93a7218 MLK-20693-1: ASoC: fsl_dsp: remove this workaround of skip sections
Revert "MLK-18497-13: ASoC: fsl: dsp: Skip SDRAM section update if
fw is already loaded"

This reverts commit a0cffd9a92.

This is just to avoid reconfigure the edma isr handler in dsp
framework, which should be handled by dsp framework.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:15 +08:00
4ef3575026 MLK-20095-4: ASoC: fsl: Use hardwired system address offset source select for QM
We set system address offset select to 0 on QM because of the following reasons:
	* SC_C_OFS_PERIPH, it is not available for QM
	* SC_C_OFS_AUDIO, it is not used
	* SC_C_OFS_IRQ, needs to get outside of the VPU.

A simplified version of the code is:

if (dsp_priv->dsp_board_type == DSP_IMX8QXP_TYPE) {
	sc_misc_set_control(ipcHndl, SC_R_DSP, SC_C_OFS_SEL, 1);
	sc_misc_set_control(ipcHndl, SC_R_DSP, SC_C_OFS_PERIPH, 0x5A);
	sc_misc_set_control(ipcHndl, SC_R_DSP, SC_C_OFS_IRQ, 0x51);
	sc_misc_set_control(ipcHndl, SC_R_DSP, SC_C_OFS_AUDIO, 0x80);
	}
} else {
	sc_misc_set_control(ipcHndl, SC_R_DSP, SC_C_OFS_SEL, 0);
}

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:15 +08:00
b35ac86e87 MLK-20095-3: ASoC: fsl: Differentiate between QXP and QM
On QM the DSP is inside the VPU subsystem while in QXP
it is inside the Audio DMA subsystem. For this reason
there are "subtle" differences.

Introduce new compatible string for QM to help us correctly
configure the DSP depending on the board they run.

dsp_mem_msg structure is shared with the DSP, so by introducing
new member dsp_board_type we can let DSP know on which target it runs.

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:15 +08:00
b9668d7af2 MLK-20095-3: ASoC: fsl: dsp: Add ASRC clocks
We enable the ASRC clocks from CPU side. We only need
the following clocks: "mem", "ipg" and "asrc0..3".

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:14 +08:00
1ac4dce34c MLK-20189-10: ASoC: fsl: dsp: Avoid unnecessary check
strtab is always non-null so remove unnecessary check.

This is a follow up of patch
167a6d79f ("ASoC: fsl: Skip checking for string section type")
and finally fixes CID3901026

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:14 +08:00
4bff2e7204 MLK-20189-6: ASoC: fsl: Skip checking for string section type
e_shstrndx already contains the section header index, so
shdr->sh_type will always be SHT_STRTAB.

Remove this redundant check and make Coverity happy.

Fixes: CID3901026
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:13 +08:00
f5f13e4c2c MLK-20189-5: ASoC: fsl: dsp_proxy: Unlock proxy->lock on error path
xf_cmd_send_recv returns with lock taken if waiting was
interrupted by a signal.

This fixes Coverity issues: CID5233120 / CID5233060

Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:12 +08:00
13bc9cfb13 MLK-20189-4: ASoC: fsl: library_load: Check return value for kernel_read
Bail out if kernel_read returns an error.

Fixes: CID1477415

Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:12 +08:00
a314e4fe32 MLK-20189-3: ASoC: fsl: library_load: Remove dead code
At this point err is always 0. So, just remove the check.

Fixes: CID1477380

Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:11 +08:00
4130b46451 MLK-20189-2: ASoC: dsp: Replace atomic_dec_return with atomic_dec
Return value is not used so better use atomic_dec.
This also silences coverity warning CID3344689.

Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:11 +08:00
20a12565f1 MLK-20189-1: ASoC: fsl: dsp: Unlock proxy->lock on error path
xf_cmd_recv will return with lock taken in two cases:
	* msg was received
	* waiting for msg was interrupted by a signal

Make sure we unlock proxy->lock in both cases.

This fixes Coverity issue: CID3335482.

Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:08 +08:00
fc803f2425 MLK-20222-4 sound: Update SCFW API
Update SCFW API to the following commit:
"
   ("430d1e3646fbe75e339e18abf2330565eac906e0")
   Author: Chuck Cannon <chuck.cannon@nxp.com>
   Date:   Fri Nov 2 15:25:45 2018 -0500

   SCF-105: RN updates.
"

Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
2019-11-25 15:52:06 +08:00
3aa009e2c0 MLK-20094: ASoC: fsl: dsp: Fix crash in compress cleanup path
We must find a way to no longer touch resources after they are
cleand up.

Now, after a stress test we get the following crash:

[ 2156.863772] fsl-dsp 596e8000.dsp: xf_pool_alloc failed
[ 2156.869337] Unable to handle kernel NULL pointer dereference at
virtual address 00000060
[ 2157.148594] [<ffff000008d8839c>] _raw_spin_lock+0x14/0x48
[ 2157.153995] [<ffff000008b3e0b8>] xf_cmd_send_recv_complete+0x40/0xf0
[ 2157.160354] [<ffff000008b3e470>] xf_close+0x40/0x88
[ 2157.165239] [<ffff000008b3f7a4>] xaf_comp_delete+0x5c/0x70
[ 2157.170730] [<ffff000008b40530>] dsp_platform_compr_free+0xa0/0xe8
[ 2157.176917] [<ffff000008b287fc>] soc_compr_free_fe+0x144/0x1a0
[ 2157.182754] [<ffff000008b11b24>] snd_compr_free+0x64/0x98

This happens because:

	1) dsp_platform_process work handler waits in a loop for
	   messages to arrive.
	2) when cplay process finishes it cleans up most of the
	   resources.
	3) when another cplay process starts it reinitializes the
	  resources including queues for example.
	4) a message will be generated and kernel will crash because
	   dsp_platform_process uses the older queues.

A solution for this is to make sure dsp_platform_process work loop
is stopped at cleanup time.

We use is_active state and signal dsp_platform_process handler to
finish because we are on the cleanup path.

While at it replace cancel_work with cancel_work sync to be sure
that work handler ends before going on with the rest of the cleanup.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:06 +08:00
d50e2b69e8 MLK-19972-2: ASoC: fsl: dsp: Fix component creation cleanup path
Because we don't correctly free resources when an error occurs
on component creation path we can end up with partially initialized
components.

Freeing such partially initialized components most of the time leads
to kernel crashing in pain.

Avoid this by making sure we either:
	* return a fully initialized component, comp->active = true
	* don't "create" the component at all, comp->active = false

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:05 +08:00
2cdddf2f2e MLK-19972-1: ASoC: fsl: dsp: Fix compr_set_param cleanup path
In case of error no cleanup was done leaving thus reasources
in an undefined state.

This can cause crashes like this:

[   34.259281] fsl-dsp 596e8000.dsp: load codec wrap lib error
[   34.266333] fsl-dsp 596e8000.dsp: create component failed, type = 1,
err = -2
[   34.273493] err pool alloc ret = -2
[   34.298363] Unable to handle kernel NULL pointer dereference at
virtual address 00000000

... which happens when lib_dsp_codec_wrap.so is not present.

While at it, we also realign some lines of code in order to avoid
going over the 80 characters limit that Linux kernel coding style
preaches on.

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:05 +08:00
ef0c584816 MLK-19949: ASoC: dsp: Fix codec libraries search path
Old implementation uses /usr/lib/imx-mm/audio-codec
to look for codec libraries.

Also this is the patch where Yocto rootfs stores the codec
libraries. So until we align Yocto with the kernel lets
change the driver to use the old path.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:04 +08:00
eae3b2f34c MLK-18497-13: ASoC: fsl: dsp: Skip SDRAM section update if fw is already loaded
If the DSP firmware binary is already loaded it is wrong to update
SDRAM located sections because we will overwrite and data stored there.

This makes suspend/resume work.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:03 +08:00
ee01b4da5e MLK-18497-12: ASoC: fsl: imx-dsp: Add DSP machine driver
Finally! We register DSP as a sound card.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
[ Aisheng: Makefile clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:03 +08:00
09194b889d MLK-18497-11: ASoC: fsl: compress: Introduce compress implemenation
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:02 +08:00
78520df682 MLK-18497-10: ASoC: fsl: dsp: Refactor fsl_dsp_{open|close}
DSP driver now supports two interfaces. Old ioctl chardev based
interface and ALSA compress inteface.

Because some part of the open/close code is common introduce
two new functions which encapsulate the common functionality.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:00 +08:00
e5a35115db MLK-18497-9: ASoC: fsl: dsp: Export xf_client_alloc
While at it add include guard to dsp.h

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:59 +08:00
6bb3efa95e MLK-18497-8: ASoC: fsl: dsp: Add DSP audio platform driver
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:59 +08:00
67f631a2d6 MLK-18497-7: ASoC: fsl: xaf_afi: Introduce component API
This is based on Xtensa Audio framework
userspace implemention API.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:58 +08:00
93bc6108aa MLK-18497-6: ASoC: fsl: dsp: Add Xtensa library handling API
This is based on RF-2016.4-linux package received from Cadence
and introduce the API for loading shared libraries into memory.

Based on this we create xf_load_lib/xf_load_unlib functions
which are used to tell DSP framework that codec libraries
are mapped in memory and it can start using them.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:57 +08:00
d2164cd4e6 MLK-18497-5: ASoC: fsl: dsp_proxy: Introduce client API
This will allow DSP driver to create/destroy a client on
DSP audio-framework proxy.

Registering a client on remote DSP proxy means creating
a component.

The implementation is similar with userspace application
proxy implementation.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:57 +08:00
17aa1ae760 MLK-18497-4: ASoC: fsl: dsp: Add message buffer pool API
Memory is allocated to clients from memory pools. A memory pool
allocation is requested to DSP framework via XF_ALLOC command and
freed via XF_FREE.

Memory pool allocation API offers two functions:
	* xf_pool_alloc, allocate a number of buffers of given length
	* xf_pool_free, free memory area allocated for a pool.

Once a buffer pool is allocated users can handle buffers using the
following API:
	* xf_buffer_get(pool), gets a buffer from a pool
	* xf_buffer_put(buf), puts back a buffer into its pool

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:56 +08:00
1aeb3e481a MLK-18497-3: ASoC: fsl: dsp_proxy: Add new send/recv helpers
This commit adds 3 new function helpers for sending
messages to DSP framework and waiting for response.

While at it cleanup spaces around struct client fields.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:56 +08:00
9e49bf4e07 MLK-18497-2: ASoC: fsl: dsp_proxy: Add missing xf_unlock
xf_cmd_send_recv function returns with a lock taken
in case of success. Fix this, now!

This bug is present since the beginning of time and it didn't
show up because no one used xd_cmd_alloc/xf_cmd_free.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:55 +08:00
ea43dedbf9 MLK-18497-1: ASoC: fsl: dsp_proxy: Fix license headers
This is a cleanup patch to have all the headers style
consistent across DSP driver.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:55 +08:00
b6fdfbcf64 MLK-19063: ASoC: fsl_dsp: Fix use after free
Move client freeing later when no one needs it.
This fixes Coverity Issue 3344686.

Note that this also fixes a potential memory leak, if proxy happens to
be NULL.

Reported-by: Ioan-alexandru Palalau <ioan-alexandru.palalau@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit a0bb3e2d5a)
2019-11-25 15:51:54 +08:00
8f8581c48f MLK-17481-4: ASoC: fsl: Don't bail out on OFS_PERIPH error
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit b6fa30e239da2f38cf31508e98a405ef697e233b)
2019-11-25 15:51:54 +08:00
8184e47416 MLK-17481-3: ASoC: fsl: Fix DSP memory mappings
We load DSP firmware from the ARM side at 0x556e8000 but because the
compiler generated memory layout starts at 0x596e8000 we need to do
some fixups.

Thus, each address (in DSP local memory) generated by the compiler
needs to be substracted an offset = 0x596e8000 - 0x556e8000 = 0x4000000.

Because this only happens on QM we will use dts to specify the offset.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 8d4518d2a5d956549e829470af15003d7adff841)
2019-11-25 15:51:53 +08:00
49c0d24bec MLK-18646: ASoC: fsl_dsp: fix the license issue
correct the license issue

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:53 +08:00
dc9756fa77 MLK-18279: ASoC: fsl_dsp: get the information of reserved memory from dts
The reserved memory for dsp is defined in dts file, however, the dsp
driver has also defined the address and size of this reserved memory,
which is repeated and inflexible.

So by cancelling the definition in dsp driver and use system API to
get the information of reserved memory from dts dynamically to fix
this problem.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:52 +08:00
6b034c90fb MLK-18245-1: ASoC: fsl_dsp: remove the explicit power enablement
The driver don't need to explicit enable the power domain, which
can be done by runtime power management, when the power domain tree
defined in device tree.
in this case, the MU initialization can be moved to runtime pm function.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:51 +08:00
6b7b1ae0ec MLK-17747: dsp: use the name of dsp instead of hifi
In order to avoid the name problem going forward with
integration with Qcom, Qcom has their own dsp and hifi
is competitor, so the hifi name should not be used in
our code.

So use the name of dsp instead of hifi to fix this
problem.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:51 +08:00
7d17cbca37 MLK-14997-3: Document: Add fsl,hifi4 compatibility document
add hifi4 document

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:51 +08:00
1964416618 MLK-17635-3: ASoC: fsl_dsp: add suspend & resume support for new framework
The architecture of dsp framework has been changed, so update dsp
driver to support suspend & resume test of new dsp framework.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:50 +08:00
e45c12e946 MLK-17635-2: ASoC: fsl_dsp: fix unhandled alignment fault in user space
When using memcpy() or fread() function in dsp unit test or wrapper code,
an unhandled alignment fault error will occur randomly, this issue
is caused by the setting of mmap(). After using pgprot_writecombine()
function instead of pgprot_noncached() function, this error will not
occur.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:50 +08:00
12d419bbb1 MLK-17635-1: ASoC: fsl_dsp: change dsp driver to support new dsp framework
The architecture of dsp framework has been changed, the role of
dsp driver is transferring messages between dsp framework and user space
application, so change dsp driver to support this function.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:49 +08:00
d69e9a1786 MLK-17309-1: uapi: mxc_hifi4: provide new interface for user space
In order to avoid license problem of Cadence header files, these
license files has been wrappered into a library and new interface
has been abstracted to replace the interface of Cadence header
files.

So update the mxc_hifi4.h file to provide new interface for
user space to use.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:49 +08:00
3b3a0bf665 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>
2019-11-25 15:51:48 +08:00
94894c6775 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>
2019-11-25 15:51:48 +08:00
d4a9dadb61 MLK-18073: ASoC: fsl_dsp: fix uninitialized scalar variable issue
This patch is used to fix Coverity-1793874, Coverity-1793875,
Coverity-1793876, Coverity-1793877 issue.

The icm_base_info_t is not initialized before using, so
use memset() to initialize it to fix these issues.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:47 +08:00
7d877756eb MLK-17309-4: ASoC: fsl_hifi: fix crash issue when destination not align
When loading the codec libs in driver, if the destination is
not 4-bytes alignment when doing memset_hifi(), the driver
will print a warning message and the driver may crash in some
cases.

So by changing the memset() function and aligning the virtual address
based on the physical address to fix this issue.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:47 +08:00
4c599d4b5c MLK-17309-3: ASoC: fsl_hifi: get free memory from hifi framework
In order to manage the memory simply, all the memory which is
shared between hifi driver and hifi framework are managed by
hifi framework.

So when the driver wants to get free memory, it can send
"ICM_PI_LIB_MEM_ALLOC" command to hifi framework, then hifi
framework will return the address of available memory to
driver. When the driver wants to release the memory, it can
send "ICM_PI_LIB_MEM_FREE" command to hifi framework, the hifi
framework will mark this memory available.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:46 +08:00
72ac226ce9 MLK-17309-2: ASoC: fsl_hifi: use new way to realize multi-codec
In current hifi driver, some resources are shared when multi
codec decodes together. When switching between multi-codec,
the hifi driver and framework need to save and restore the shared
resources,this will waster time and complicate the hifi driver.

So by distributing private resources for each codec to avoid
this problem. When the user space wants to enable a new codec,
it can send "HIFI4_CLIENT_REGISTER" command to hifi driver to apply
an available resource, the driver will send a client id to
user space. When the user space wants to release the resource,
it can send "HIFI4_CLIENT_UNREGISTER" command to hifi driver,
then the driver will mark this resource available.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:45 +08:00
8da839128b MLK-17152: ASoC: fsl_hifi: support suspend and resume
For hifi need to enter runtime suspend state in suspend,
then the power of HIFI can be down. In this case content
in internal RAM will be lost, and need to be recovered
in resume.

Move the loading firmware to runtime resume function, and
define ICM_SUSPEND and ICM_RESUME command, with ICM_SUSPEND
the hifi framework will store the data in RAM and with
ICM_RESUME the hifi framework will restore the data to RAM.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:45 +08:00
a3101ecf1a MLK-16678-2: ASoC: fsl_hifi4: move hifi4 firmware to SDRAM
move hifi4 dsp firmware's code and data section to SDRAM space
move hifi4 dsp codec lib's code section to SDRAM space

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:44 +08:00
55981e9f8d MLK-16691: ASoC: fsl_hifi4: unlock mutex before return error
When error occurs in fsl_hifi4_open() function, before this
function exists, "hifi4_priv->hifi4_mutex" should be unlocked.
If not, when the device is opened next time, the kernel will
be hanged.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:44 +08:00
c20260581b MLK-16674: ASoC: fsl_hifi4: enable pm runtime for hifi4
Enable pm runtime for hifi4, so the firmware may load many times,
The shdr->sh_addr can't be refined in hifi4_load_firmware, otherwise
it should impact the load operation in next time.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:43 +08:00
cd0e89c920 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>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:51:43 +08:00
47903b06af 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>
2019-11-25 15:51:42 +08:00
3afb3b413d 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>
2019-11-25 15:51:42 +08:00
db15cd2f98 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>
2019-11-25 15:51:41 +08:00
8dfa0f8731 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>
2019-11-25 15:51:41 +08:00
62bd3cf203 MLK-16174: ASoC: fsl_hifi4: load firmware in device open phase.
Move the load firmware operation from probe function to open,
Then firmware can be loaded from rootfs.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:40 +08:00
3bd60dcafc MLK-16129: ASoC: fsl_hifi4: refine the copyright
As the fsl_hifi4.c uses the function from uboot/cmd/elf.c,
so need to add the copyright of elf.c, and change licence to
Dual BSD/GPL.
And mxc_hifi4.h is used by user space, so change license to BSD.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
2019-11-25 15:51:40 +08:00
bc2b6918ba MLK-16099-2: ASoc: fsl: length is not same for alloc and free memory
In fsl_hifi4_probe(), the length for dma_alloc_coherent() is
MSG_BUF_SIZE + INPUT_BUF_SIZE + OUTPUT_BUF_SIZE +
FIRMWARE_DATA_BUF_SIZE + SCRATCH_DATA_BUF_SIZE;

However, in fsl_hifi4_remove(), the length for dma_free_coherent()
is MSG_BUF_SIZE + INPUT_BUF_SIZE + OUTPUT_BUF_SIZE +
FIRMWARE_DATA_BUF_SIZE;

By keeping the same length between dma_alloc_coherent() and
dma_free_coherent() to fix this issue.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:39 +08:00
2634b1938b MLK-16099-1: ASoc: fsl: fix crash issue when no dsp core lib
When dsp driver can't find the dsp core lib in loading codec
process, the kernel will be crashed. This issue is caused
by unreasonable way of error handling.

By changing the way of error handling to fix this issue.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:38 +08:00
6035676ebe MLK-16010: ASoc: fsl: support 32-bit application for hifi4
add cases to support 32-bit application for hifi4 when
kernel is running on 64-bit cpu mode.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:38 +08:00
15a76b231c MLK-15959: ASoc: fsl: fix hifi4 driver build warning
When building sound/soc/fsl/fsl_hifi4.c file, a warning
occurs:
      warning: cast to pointer from integer of different
      size [-Wint-to-pointer-cast]
      (struct timestamp_info_t *)pext_msg->dtstamp;

By forced conversing int type to long type to fix this
issue.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:38 +08:00
81973d10d2 MLK-15934-3: ASoc: fsl: add hifi4 firmware's status transfer support
1. add cases to receive error value from hifi4 firmware and
   return this error to hifi4 driver's caller.
2. add cases to receive input over indicator variable from
   hifi4 dirver's caller and pass this value to hifi4 firmware

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:37 +08:00
64d0b8c10f MLK-15296-2: include: uapi: add consumed cycles
add a new structure element(cycles) to save the
consumed cycles that returned from dsp framework

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:36 +08:00
0c35f92e94 MLK-14997-2: include: uapi: add hifi header file
add hifi header file, which is used by user space.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:35 +08:00
f28efa9c49 MLK-15934-2: ASoc: fsl: different pointer length issue for hifi4
when transferring struct icm_open_resp_info_t type
between hifi4 framework and hifi4 driver, because this
struct has an element "*dtstamp" which is a pointer,
but for hifi4 firmware, this pointer occupies 4 bytes,
for hifi4 driver, this pointer occupies 8 bytes.
different pointer length will cause issue when reading
this structure's content in hifi4 driver.

By changing the pointer type to unsigned int type to
fix this issue.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:34 +08:00
f4fa46fed6 MLK-15296-3: ASoc: fsl: remap the dsp firmware
In order to use the hifi4's Cache to cache the firmware's
.rodata, .text, .data, .bss section and hifi4 core lib's
.text section, the firmware's .rodata, .text, .data and
.bss section should be remaped to 0x20700000 - 0x20FFFFFF
address range. This patch is used to parse the firmware
and load each section to corresponding address range.

This patch also set csr_gpr_control to 0x515A2080 to
remap the hifi4's address range in SCFW.

In addtion, add cases to support hifi4 framework's
performance test.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
2019-11-25 15:51:32 +08:00
72473479d1 MLK-14997-6: ARM64: defconfig: built-in hifi driver
built-in hifi driver

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:31 +08:00
4520379e9c MLK-14997-4: ASoC: fsl: add hifi4 dsp driver
The function of driver is to communicate with hifi firmware.
The mu13 is dedicated for hifi communication, driver allocate
a share memory for message transfer between driver and firmware.
The calling sequence is that LOAD_CODEC,INIT_CODEC,CODEC_OPEN,
DECODE_ONE_FRAME, CODEC_CLOSE.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
[ Aisheng: clean up for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:51:31 +08:00
0803f9c776 ASoC: imx-pcm-dma-v2: Fix writecombine/wc build error
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:51:28 +08:00
f3f4ebe088 ASoC: imx-pcm-dma-v2: Add component name
Add component name

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:28 +08:00
ba63a9043a ASoC: imx: fix build failture
sound/soc/fsl/imx-pcm-dma-v2.c: In function ‘imx_pcm_preallocate_dma_buffer’:
sound/soc/fsl/imx-pcm-dma-v2.c:131:6: error: void value not ignored as it ought to be
ret = snd_pcm_lib_preallocate_pages(substream,
    ^
sound/soc/fsl/imx-pcm-dma-v2.c: In function ‘imx_pcm_free_dma_buffers’:
sound/soc/fsl/imx-pcm-dma-v2.c:144:2: error: void value not ignored as it ought to be
return snd_pcm_lib_preallocate_free(substream);
^
sound/soc/fsl/imx-pcm-dma-v2.c:145:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:51:27 +08:00
58876d293b MLK-16224-2: ASoC: dmaengine_pcm: add fifo_num to snd_dmaengine_dai_dma_data
In order to support multi-fifo sdma script, the audio driver need to send
the fifo number to dma driver through dma_slave_config, and the cpu_dai
driver should config fifo_num for the audio platform driver, then platform
driver can config fifo_num to dma.
So add new variable fifo_num for struct snd_dmaengine_dai_dma_data.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Robin Gong<yibin.gong@nxp.com>
2019-11-25 15:51:27 +08:00
6ee22f9f6d MLK-18947: ASoC: imx-pcm-dma: alloc buffer from IRAM
In some platform, the low power audio playback should be
supported, which need the audio buffer allocated from
OCRAM/IRAM. So move the buffer allocation to .open
function at that time the dma chan is allocated.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 85c59acfc5c8d17aa0f369dbe30e4a5fb128c25f)
2019-11-25 15:51:27 +08:00
7047fb026b MLK-16224-3: ASoC: imx-pcm-dma-v2: fifo_num is used by dma slave config
fifo_num is a new added parameter for dma slave config

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:51:26 +08:00
da6c85af86 MLK-17442: ASoC: fsl: fix wrong usage of filter_data (part 3)
The filter_data should be used for dma_filter_fn function,
but we used the filter_data wrongly for dma channel name.
This patch is to fix the issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviwed-by: Daniel Baluta <daniel.baluta@nxp.com>
[ Aisheng: split out DAI sai&esai changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:51:26 +08:00
deaa49291f MLK-16885-2: ASoC: imx-pcm-dma-v2: query the caps of dma
query the caps of dma, then update the hw parameters according
the caps. for EDMA can't support 24bit sample, but we didn't
add any constraint, that cause issues.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:25 +08:00
d3a4db61b0 MLK-15066-2: ASoC: imx-pcm-dma-v2: fix typo issue
fix typo issue

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:25 +08:00
d928e16f9d MLK-15066-1: ASoC: imx-pcm-dma-v2: fix noise issue with pulseaudio
Same as commit c55075170214 ("MLK-14582: ASoC: imx-pcm-rpmsg: fix
audio noise issue with pulseaudio"), need to add a constraint for
SNDRV_PCM_HW_PARAM_PERIODS, which make the period number integer.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:24 +08:00
98ee747278 MLK-15098: ASoC: fsl: fix imx-pcm build error when no dma
Fix build error when SOC_IMX_PCM_DMA is not enabled
error: expected identifier or ‘(’ before ‘{’ token})

Signed-off-by: Adrian Alonso <adrian.alonso@nxp.com>
2019-11-25 15:51:23 +08:00
3515ccf42e ASoC: fsl: add imx-pcm-dma v2 platform driver (part 1)
which don't request the dma channel in the probe, but request
dma channel when needed. for the dma channel of cpu dai in BE
can be reused by the FE.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: spli SAI DAI changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:51:23 +08:00
c235425c00 MLK-13904-1: ASoC: fsl: add audio cpu dai driver base on rpmsg (part 2)
Add the cpu dai driver, as the rpmsg_send api can't be used in
atomic context, so using the workqueue instead of calling
rpmsg_send() directly.
The detail communication stack is defined in header file.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Acked-by: Robin Gong <yibin.gong@nxp.com>
[ Aisheng: split out rpmsg changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:51:22 +08:00
6170d91a8b MLK-11429-11: ASoC: change error message to debug message
cherry-pick below patch from imx_3.14.y
ENGR00274585-9 ASoC: change error message to debug message

This error message is not actual error, which is a warning. When using
FE/BE, if there is widget which is used by playback and capture route, then
this message will be printed.

Signed-off-by: Shengjiu Wang <b02247@freescale.com>
(cherry picked from commit ad60b0e03d058b57f2fd9538e1158da8eefcea1f)
2019-11-25 15:51:22 +08:00
5a56ee6204 LF-102: ASoC: ak4458: Support DSD512 when codec is ak4497
Support DSD512 when codec is ak4497

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:20 +08:00
b25b67f5f9 ASoC: AK4458: Enable DSD for AK4497
Enable DSD for AK4497

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:20 +08:00
d87a95d612 MLK-17817-1: ASoC: ak4458: enable daisy chain
Enable Daisy Chain if in TDM mode and the number of played
channels is bigger than the maximum supported number of channels.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 5ae97f159bfd9c4a37e7e60cd20aa3437041b251)
(Vipul: apply manually whilre rebase on v4.19)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:51:19 +08:00
d9b9ac9fb4 MLK-20189-7: ASoC: ak4458: check reset control status
Save error so that the following error checking now make sense.

This fixes Coverity issue: CID2828734

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Vipul: apply manuallly while rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:51:18 +08:00
18b91ee0bc MLK-19573-2: ASoC: ak4458: enable DSD playback
Enable AK4458 DSD playback.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 2faade4b12f12e1fd33d20cda885ed6ddac0fd5e)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:51:18 +08:00
24270174e5 MLK-21940-5: ASoC: wm8524: remove constrain for FE-BE
The constraint is not needed for back end bistream for
the sample rate is fixed by dts and the constraint
is propagate to front end bistream for they share same
snd_soc_pcm_runtime.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:51:18 +08:00
e7b4562bbd MLK-19118-3: ASoC: AK5558: add regulators for ak5558
add regulators for ak5558

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 914f117ffb4233ba630515d8426d30006a82794f)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 15:51:17 +08:00
e15d006d1a MLK-19118-1: ASoC: AK4458: add regulator for ak4458
add regulator for ak4458

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 6b9f1e42e6d4f59ad2c66c0d327fc6d63572147f)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
2019-11-25 15:51:17 +08:00
a9b0619fa0 MLK-20940-3 codecs: cs42xx8: use single read/write to send i2c msg
cs42xx8 will call regcache_sync to refresh its register cache. However,
it will send a long msg which length is greater than the max buffer size
of virtual i2c driver. It will cause the regcache_sync operation failed.
So, use the single read/write to send i2c msg in regcache functions.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 0153e60c26a0fdcf463fb16b090511da7e52df0c)
2019-11-25 15:51:16 +08:00
1a36afae7e ASoC: codecs: fsl_mqs: fix build for 5.1 RC kernel
Due to below patch:
999f7f5af8 ("ASoC: remove Codec related code")
codec related structures have been removed.
Need update legacy drivers accordingly.

  CC      sound/soc/codecs/hdmi-codec.o
  CC      sound/soc/codecs/si476x.o
../sound/soc/codecs/fsl_mqs.c: In function 'fsl_mqs_hw_params':
../sound/soc/codecs/fsl_mqs.c:65:35: error: 'struct snd_soc_dai' has no member named 'codec'
  struct snd_soc_codec *codec = dai->codec;
                                   ^
../sound/soc/codecs/fsl_mqs.c:66:9: error: implicit declaration of function 'snd_soc_codec_get_drvdata' [-Werror=implicit-function-declaration]
  struct fsl_mqs *mqs_priv = snd_soc_codec_get_drvdata(codec);
         ^
../sound/soc/codecs/fsl_mqs.c:66:29: warning: initialization makes pointer from integer without a cast
  struct fsl_mqs *mqs_priv = snd_soc_codec_get_drvdata(codec);

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:51:16 +08:00
62e2861cf0 ASoC: cs42xx8: support multi power domain
support multi power domain

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:16 +08:00
9b2cec9598 MLK-20428-1: ASoC: cs42xx8: add constraint for tdm mode
TDM mode can only work with codec slave mode, and the mclk
frequency should be 256FS.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:15 +08:00
41de343dab MLK-19750-2: ASoC: cs42xx8: enhance the async mode for cs42xx8
with this patch, codec driver can support tx and rx in
different master/slave mode, for example, tx in master mode,
rx in slave mode

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: fix big conflicts for next-20190730 upgrade ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:51:15 +08:00
1e66cff973 MLK-18530: ASoC: wm8524: support S32_LE
support S32_LE

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:14 +08:00
01924e035e MLK-17355-1: ASoC: fsl_mqs: Fix potential uninitialized pointer read
Initialize gpr_np in order to avoid potential unitialized
pointer read in the section following the "out:" label.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:51:13 +08:00
ec3d8fb623 MLK-17089-7: ASoC: fsl_mqs: support suspend & resume for imx8
Base on latest power management design in MLK-17074, every driver
need to enter runtime suspend state in suspend, so the driver should
call the pm_runtime_force_suspend in suspend. with this implementation
the suspend function almost same as runtime suspend function. so remove
the suspend function, just use pm_runtime_force_suspend instead.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:13 +08:00
a9ea8e0682 MLK-17089-6: ASoC: wm8962: support suspend & resume for imx8
Base on latest power management design in MLK-17074, every driver
need to enter runtime suspend state in suspend, so the driver should
call the pm_runtime_force_suspend in suspend.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:12 +08:00
9d988eefa3 MLK-17089-5: ASoC: wm8962: restore the CLOCKING2 register
The CLOCKING2 is a volatile register, but some bits should
be restored when resume, for example SYSCLK_SRC. otherwise
the output clock is wrong

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:11 +08:00
b28c5d13a1 MLK-17034-5: ASoC: fsl_mqs: Move clock operation to pm runtime function
In imx8 when systerm enter suspend state, the power of subsystem will be
off, The clock enable state will be lost after resume, but the runtime
resume function will be called after resume by pm, so need to move clock
enablement to runtime resume and clock disablement to runtime suspend.
Then after resume the clock enable state can be recovered.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:10 +08:00
8876a263d6 MLK-16350-2: ASoC: fsl_mqs: enable the pm_runtime
enable the pm_runtime, the power domains wil be disabled when
mqs is idle.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:10 +08:00
6e0e9370a3 ASoC: codecs: fsl_mqs: Add PM support
Save the values of registers at suspend and restore
it at resume.

We don't need to implement runtime PM support because
MQS is already enabled in startup() and disabled in
shutdown().

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:09 +08:00
5eb82ae30f MLK-15340-1: ASoC: wm8962: fix lambda value
According RM, the FLL_LAMBDA must be set to non-zero value in
integer and Franctional modes.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Mihai Serban <mihai.serban@nxp.com>
2019-11-25 15:51:09 +08:00
56b42dc792 MLK-13945-1: ASoC: fsl_mqs: refine the mqs driver for support imx8qm
IOMUXC_GPR2 register is not used for imx8, there is a new register
designed for this usage in imx8, so it also need the ipg clock.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:51:08 +08:00
0a37960199 MLK-14851: ASoC: wm8962: fix clock issue for S20_3LE (part 1)
There is error log "wm8962 3-001a: Unsupported BCLK ratio 6"
When the bitstream's format is S20_3LE.
The reason is that the pll output is samplerate*256, which
can't divide to clock samplerate*20*2. So in this patch change
the pll output to samplerate*384, and use the physical_width
for S20_3LE to calculate the bclk.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
[ Aisheng: split card changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:51:08 +08:00
f372be5c8a MLK-15028: ASoC: codecs: wm8960: Remove bitclk relax condition
Using a higher bitclk then expected doesn't always work.
Here is an example:

aplay -Dhw:0,0 -d 5 -r 48000 -f S24_LE -c 2 audio48k24b2c.wav

In this case, the required bitclk is 48000 * 24 * 2 = 2304000
but the closest bitclk that can be derived is 3072000.

Now, for format S24_LE, SAI will use slot_width = 24, but since
the clock is faster than expected, it will start to send bytes
from the next channel so the sound will be corrupted.

Thus, remove bitclk relaxation condition which was added mostly
for supporting S20_3LE format which was removed from SAI in
commit 739e6d654b5c0a ("MLK-14870: ASoC: fsl_sai: Remove support
for S20_3LE").

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:07 +08:00
3f64f32f8a MLK-13621: ASoC: codec: wm8960: fix reset failed in probe
There is occasion that wm8960 reset failed in the beginning,
Especially after board reboot. The issue is found in the
imx7d-sdb board Rev.C. After retry, the reset operation is
successful.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:06 +08:00
e61cf4622e MLK-13418: ASoC: wm8960: workaround no sound issue in master mode
The input MCLK is 12.288MHz, The desired output sysclk is 11.2896MHz
the sample rate is 44100Hz, with the pllprescale=2, postscale=sysclkdiv=1,
some chip may have wrong bclk and lrclk output in master mode. then there
will be no sound.
With the pllprescale=1, postscale=2, the output clock is correct. so use
this configuration to workaround this issue.
Tested 8k/11k/16k/22k/32k/44k/48kHz case.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:06 +08:00
7f3c08bb06 MLK-12464-2: ASoC: wm8960: fix clock is not correct after suspend/resume
After the suspend/resume, hw_params may be called in bias_level is not
BIAS_ON, then the PLL is not disable/enabled, if the sample rate is
changed, the output clock is not correct.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:06 +08:00
ee61ae7f87 MLK-11915-10 ASoC: imx_mqs: fix mqs_priv->name overrun issue
fix mqs_priv->name overrun issue. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit ef1c59f93981b15412a0207d5517a26901bb2ecd)
2019-11-25 15:51:05 +08:00
d77b7dbf6d MLK-10183 ASoC: wm8962: separate ALC Coefficients to four reigsters
Attempt to read volatile register when cache_only is set will return
EBUSY. After playback/record, wm8962_runtime_suspend function will set
cache_only flag, so the volitale register ALC2 can't be read from cache.

Separate ALC Coefficients to four reigsters, the volatile register ALC2
will be read from hardware instead of cache.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 5ec8878be12530517b4c8ae307441a0ac16071a3)
2019-11-25 15:51:05 +08:00
7d0becbfe1 MLK-10899: ASoC: si476x: add startup/shutdown to powerup/down FM
The hw parameter is set failed for si476x if si476x is not powerup,
the codec use the default value of this module. So add startup/shutdown
to powerup/powerdown FM, then we can set parameter successfully.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 796665760605e020e6835f13db6ce49e0a0e03f5)
2019-11-25 15:51:05 +08:00
ebf67d3ab0 MLK-11004-3: ASoC: cs42888: enable PWR in probe for fix pop noise
Delete PWR widget, enable it in probe to fix pop noise

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 4fdb40165706bba3de6aa47e6328136d1eb597fc)
2019-11-25 15:51:04 +08:00
0f0a3d8e08 MLK-10515-2: ASoC: fsl_mqs: Move clk get_rate to hw_param
It is too early to put clk get rate in probe, because the rate for
the clock may not be ready.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:51:03 +08:00
723c0b0be0 MLK-9723-4: ASoC: fsl_mqs: add mqs codec driver
Implement codec driver for mqs. mqs is a very simple IP. which support:

Word length: 16bit.
DAI format: Left-Justified, slave mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 9da6bdd2072b850e9bb910512123eff7d80a0e2f)
2019-11-25 15:51:03 +08:00
005e9f2963 ASoC: imx-pdm: Fix compile issue
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:01 +08:00
d60cc6c5e3 ASoC: imx-wm8524: remove unused audio route
The Capture route is not needed by wm8524

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:51:00 +08:00
40414785a7 ASoC: imx-ak5558: remove unused audio route
The playback route is not need by ak5558

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:59 +08:00
141eb5a465 ASoC: imx-wm8962: change cpu-dai to audio-cpu
change cpu-dai to audio-cpu for alignment with
fsl-asoc-card

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:59 +08:00
eb5f47207d ASoC: imx-sii902x: Fix compile error
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:58 +08:00
cdb2a067d9 MLK-21697-2: ASoC: imx-sii902x: Remove the operation for sii902x
Move the operation for sii902x module to mxsfb_sii902x_audio.c
platform driver. change codec from dummy to hdmi-codec

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:58 +08:00
c65041ddba ASoC: imx-wm8524: Fix compile error
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:56 +08:00
134471ab8a MLK-21940-6: ASoC: imx-wm8524: Support EASRC in this sound card
Support EASRC in this sound card with FE-BE structure

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:50:54 +08:00
b455c78216 MLK-21940-7: ASoC: imx-ak5558: Support EASRC in this sound card
Support EASRC in this sound card with FE-BE structure

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:50:53 +08:00
c8a38b48a0 ASoC: imx-mqs: Fix compile error
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:53 +08:00
78b719abec ASoC: imx-wm8958: Fix compile error
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:53 +08:00
7bcdb1f7f4 ASoC: imx-wm8962: Fix compile error
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:52 +08:00
9bf74ee0f5 MLK-16784-5 sound: asoc: add machine driver for micfil in iMX8MM
Add machine driver for micfill IP in iMX8MM.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit 3c788dfc51)
2019-11-25 15:50:52 +08:00
29bf3d3b48 ASoC: imx-ak4497: Fix compile issue with new dai link definition
Fix compile issue with new dai link definition

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:51 +08:00
a8f9b59725 ASoC: imx-ak5558: Fix compile issue with new dai link definition
Fix compile issue with new dai link definition

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:51 +08:00
a582572c30 ASoC: imx-ak4458: Fix compile issue with the new dai link definition
Fix compile issue with the new dai link definition

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:51 +08:00
530a93df7b MLK-21440-3: ASoC: imx-wm8960: remove snd_soc_find_dai
Previously we add snd_soc_find_dai to check if the codec is probed or
not, but this bring kernel dump issue when CONFIG_LOCKDEP=y.

[    2.823379] WARNING: CPU: 2 PID: 1 at sound/soc/soc-core.c:1016 snd_soc_find_dai+0x144/0x150
[    2.831827] Modules linked in:
[    2.834907] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.14.78-00007-g524e1b1f0b3f #18
[    2.842748] Hardware name: FSL i.MX8MM EVK board (DT)
[    2.847811] task: ffff8000624f0000 task.stack: ffff000008078000
[    2.853745] PC is at snd_soc_find_dai+0x144/0x150
[    2.858462] LR is at snd_soc_find_dai+0x140/0x150

...

[    3.469675] Call trace:
[    3.472135] Exception stack(0xffff00000807ba40 to 0xffff00000807bb80)
[    3.478590] ba40: 0000000000000000 00000000ffffffff 0000000000000000 0000000000000002
[    3.4864333.596564] [<ffff00000883f2a8>] bus_add_driver+0x110/0x230
[    3.602149] [<ffff0000088412e8>] driver_register+0x68/0x100
[    3.607735] [<ffff0000088426dc>] __platform_driver_register+0x54/0x60
[    3.614191] [<ffff0000097e4cc8>] imx_rpmsg_driver_init+0x20/0x28
[    3.620213] [<ffff0000080844c4>] do_one_initcall+0x44/0x130
[    3.625801] [<ffff000009760ef8>] kernel_init_freeable+0x1e0/0x280
[    3.631909] [<ffff00000908c3f8>] kernel_init+0x18/0x110
[    3.637148] [<ffff000008085a4c>] ret_from_fork+0x10/0x1c

So we could't resolve the warning "snd_soc_register_card failed (-517)".

Fixes: a52c88bc39 ("MLK-19854-1: ASoC: imx-wm8960: fix error when m4
image is not loaded")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>

(cherry picked from commit f5d9013702)
(cherry picked from commit c54e5cd381)
2019-11-25 15:50:50 +08:00
3ada8a2e15 MLK-21440-4: ASoC: imx-cs42888: remove snd_soc_find_dai
Previously we add snd_soc_find_dai to check if the codec is probed or
not, but this bring kernel dump issue when CONFIG_LOCKDEP=y.

[    2.823379] WARNING: CPU: 2 PID: 1 at sound/soc/soc-core.c:1016 snd_soc_find_dai+0x144/0x150
[    2.831827] Modules linked in:
[    2.834907] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.14.78-00007-g524e1b1f0b3f #18
[    2.842748] Hardware name: FSL i.MX8MM EVK board (DT)
[    2.847811] task: ffff8000624f0000 task.stack: ffff000008078000
[    2.853745] PC is at snd_soc_find_dai+0x144/0x150
[    2.858462] LR is at snd_soc_find_dai+0x140/0x150

...

[    3.469675] Call trace:
[    3.472135] Exception stack(0xffff00000807ba40 to 0xffff00000807bb80)
[    3.478590] ba40: 0000000000000000 00000000ffffffff 0000000000000000 0000000000000002
[    3.4864333.596564] [<ffff00000883f2a8>] bus_add_driver+0x110/0x230
[    3.602149] [<ffff0000088412e8>] driver_register+0x68/0x100
[    3.607735] [<ffff0000088426dc>] __platform_driver_register+0x54/0x60
[    3.614191] [<ffff0000097e4cc8>] imx_rpmsg_driver_init+0x20/0x28
[    3.620213] [<ffff0000080844c4>] do_one_initcall+0x44/0x130
[    3.625801] [<ffff000009760ef8>] kernel_init_freeable+0x1e0/0x280
[    3.631909] [<ffff00000908c3f8>] kernel_init+0x18/0x110
[    3.637148] [<ffff000008085a4c>] ret_from_fork+0x10/0x1c

So we could't resolve the warning "snd_soc_register_card failed (-517)".

Fixes: 2bf5f97047 ("MLK-19854-1: ASoC: imx-cs42888: fix error when m4
image is not loaded")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>

(cherry picked from commit 58ffdf2392)
(cherry picked from commit d1222a0e5f)
2019-11-25 15:50:49 +08:00
43e47ec8fe MLK-21985-5 ASoC: imx-wm8960: fix build for next 20190607 upgrade
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

../sound/soc/fsl/imx-wm8960.c:538:3: warning: statement with no effect [-Wunused-value]
   imx_wm8960_dai[0].codec_name     = "rpmsg-audio-codec-wm8960";
   ^
../sound/soc/fsl/imx-wm8960.c:539:20: error: ‘struct snd_soc_dai_link’ has no member named ‘codec_dai_name’
   imx_wm8960_dai[0].codec_dai_name = "rpmsg-wm8960-hifi";
                    ^
../sound/soc/fsl/imx-wm8960.c:539:3: warning: statement with no effect [-Wunused-value]
   imx_wm8960_dai[0].codec_dai_name = "rpmsg-wm8960-hifi";
   ^
../sound/soc/fsl/imx-wm8960.c:547:20: error: ‘struct snd_soc_dai_link’ has no member named ‘codec_of_node’
   imx_wm8960_dai[0].codec_of_node = codec_np;
                    ^
../sound/soc/fsl/imx-wm8960.c:547:3: warning: statement with no effect [-Wunused-value]
   imx_wm8960_dai[0].codec_of_node = codec_np;
   ^
../sound/soc/fsl/imx-wm8960.c:549:19: error: ‘struct snd_soc_dai_link’ has no member named ‘cpu_dai_name’
  imx_wm8960_dai[0].cpu_dai_name = dev_name(&cpu_pdev->dev);
                   ^
../sound/soc/fsl/imx-wm8960.c:549:2: warning: statement with no effect [-Wunused-value]
  imx_wm8960_dai[0].cpu_dai_name = dev_name(&cpu_pdev->dev);
  ^
../sound/soc/fsl/imx-wm8960.c:550:19: error: ‘struct snd_soc_dai_link’ has no member named ‘platform_of_node’
  imx_wm8960_dai[0].platform_of_node = cpu_np;
                   ^
../sound/soc/fsl/imx-wm8960.c:550:2: warning: statement with no effect [-Wunused-value]
  imx_wm8960_dai[0].platform_of_node = cpu_np;
  ^

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:48 +08:00
ffec693b52 MLK-21985-4 ASoC: imx-cs42888: fix build for next 20190607 upgrade
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Caused below error:
../sound/soc/fsl/imx-cs42888.c:272:3: error: unknown field ‘codec_dai_name’ specified in initializer
   .codec_dai_name = "cs42888",
   ^
../sound/soc/fsl/imx-cs42888.c:272:3: warning: initialization from incompatible pointer type
../sound/soc/fsl/imx-cs42888.c:272:3: warning: (near initialization for ‘imx_cs42888_dai[0].cpus’)
../sound/soc/fsl/imx-cs42888.c:279:3: error: unknown field ‘codec_name’ specified in initializer
   .codec_name = "snd-soc-dummy",
   ^
../sound/soc/fsl/imx-cs42888.c:279:3: warning: initialization from incompatible pointer type
../sound/soc/fsl/imx-cs42888.c:279:3: warning: (near initialization for ‘imx_cs42888_dai[1].cpus’)
../sound/soc/fsl/imx-cs42888.c:280:3: error: unknown field ‘codec_dai_name’ specified in initializer
   .codec_dai_name = "snd-soc-dummy-dai",
   ^
../sound/soc/fsl/imx-cs42888.c:280:3: warning: initialization makes integer from pointer without a cast
../sound/soc/fsl/imx-cs42888.c:280:3: warning: (near initialization for ‘imx_cs42888_dai[1].num_cpus’)
../sound/soc/fsl/imx-cs42888.c:280:3: error: initializer element is not computable at load time
../sound/soc/fsl/imx-cs42888.c:280:3: error: (near initialization for ‘imx_cs42888_dai[1].num_cpus’)
../sound/soc/fsl/imx-cs42888.c:290:3: error: unknown field ‘codec_dai_name’ specified in initializer
   .codec_dai_name = "cs42888",
   ^
../sound/soc/fsl/imx-cs42888.c:290:3: warning: initialization from incompatible pointer type
../sound/soc/fsl/imx-cs42888.c:290:3: warning: (near initialization for ‘imx_cs42888_dai[2].cpus’)
../sound/soc/fsl/imx-cs42888.c:291:3: error: unknown field ‘platform_name’ specified in initializer
   .platform_name = "snd-soc-dummy",

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:48 +08:00
71f38f9ea0 ASoC: fsl: imx-wm8962: fix build fix build for 5.1 RC kernel
./sound/soc/fsl/imx-wm8962.c: In function 'hpjack_status_check':
../sound/soc/fsl/imx-wm8962.c:116:3: error: implicit declaration of function 'snd_soc_codec_get_dapm' [-Werror=implicit-function-declaration]
   snd_soc_dapm_disable_pin(snd_soc_codec_get_dapm(priv->codec), "Ext Spk");
   ^
../sound/soc/fsl/imx-wm8962.c:116:3: warning: passing argument 1 of 'snd_soc_dapm_disable_pin' makes pointer from integer without a cast
In file included from ../include/sound/soc.h:413:0,
                 from ../sound/soc/fsl/imx-wm8962.c:24:
../include/sound/soc-dapm.h:449:5: note: expected 'struct snd_soc_dapm_context *' but argument is of type 'int'
 int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
     ^
../sound/soc/fsl/imx-wm8962.c:120:3: warning: passing argument 1 of 'snd_soc_dapm_enable_pin' makes pointer from integer without a cast
   snd_soc_dapm_enable_pin(snd_soc_codec_get_dapm(priv->codec), "Ext Spk");
   ^
In file included from ../include/sound/soc.h:413:0,
                 from ../sound/soc/fsl/imx-wm8962.c:24:
../include/sound/soc-dapm.h:445:5: note: expected 'struct snd_soc_dapm_context *' but argument is of type 'int'
 int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm,
     ^
../sound/soc/fsl/imx-wm8962.c: In function 'micjack_status_check':
../sound/soc/fsl/imx-wm8962.c:147:3: error: implicit declaration of function 'snd_soc_update_bits' [-Werror=implicit-function-declaration]
   snd_soc_update_bits(priv->codec, WM8962_THREED1,
   ^
../sound/soc/fsl/imx-wm8962.c:161:3: warning: passing argument 1 of 'snd_soc_dapm_disable_pin' makes pointer from integer without a cast
   snd_soc_dapm_disable_pin(snd_soc_codec_get_dapm(priv->codec), "DMIC");
   ^
In file included from ../include/sound/soc.h:413:0,
                 from ../sound/soc/fsl/imx-wm8962.c:24:
../include/sound/soc-dapm.h:449:5: note: expected 'struct snd_soc_dapm_context *' but argument is of type 'int'
 int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
     ^
../sound/soc/fsl/imx-wm8962.c:165:3: warning: passing argument 1 of 'snd_soc_dapm_enable_pin' makes pointer from integer without a cast
   snd_soc_dapm_enable_pin(snd_soc_codec_get_dapm(priv->codec), "DMIC");
   ^
In file included from ../include/sound/soc.h:413:0,
                 from ../sound/soc/fsl/imx-wm8962.c:24:
../include/sound/soc-dapm.h:445:5: note: expected 'struct snd_soc_dapm_context *' but argument is of type 'int'
 int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm,
     ^
../sound/soc/fsl/imx-wm8962.c: In function 'imx_wm8962_gpio_init':
../sound/soc/fsl/imx-wm8962.c:441:41: error: 'struct snd_soc_dai' has no member named 'codec'
  struct snd_soc_codec *codec = codec_dai->codec;
                                         ^
cc1: some warnings being treated as errors
../scripts/Makefile.build:278: recipe for target 'sound/soc/fsl/imx-wm8962.o' failed

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:48 +08:00
69bef11189 ASoC: fsl: imx-wm8958: fix build for 5.1 RC kernel
../sound/soc/fsl/imx-wm8958.c: In function 'hpjack_status_check':
../sound/soc/fsl/imx-wm8958.c:88:3: error: implicit declaration of function 'snd_soc_codec_get_dapm' [-Werror=implicit-function-declaration]
   snd_soc_dapm_disable_pin(snd_soc_codec_get_dapm(priv->codec), "Ext Spk");
   ^
../sound/soc/fsl/imx-wm8958.c:88:3: warning: passing argument 1 of 'snd_soc_dapm_disable_pin' makes pointer from integer without a cast
In file included from ../include/sound/soc.h:413:0,
                 from ../sound/soc/fsl/imx-wm8958.c:19:
../include/sound/soc-dapm.h:449:5: note: expected 'struct snd_soc_dapm_context *' but argument is of type 'int'
 int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
     ^
../sound/soc/fsl/imx-wm8958.c:92:3: warning: passing argument 1 of 'snd_soc_dapm_enable_pin' makes pointer from integer without a cast
   snd_soc_dapm_enable_pin(snd_soc_codec_get_dapm(priv->codec), "Ext Spk");
   ^
In file included from ../include/sound/soc.h:413:0,
                 from ../sound/soc/fsl/imx-wm8958.c:19:
../include/sound/soc-dapm.h:445:5: note: expected 'struct snd_soc_dapm_context *' but argument is of type 'int'
 int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm,
     ^
../sound/soc/fsl/imx-wm8958.c: In function 'imx_hifi_hw_params':
../sound/soc/fsl/imx-wm8958.c:126:41: error: 'struct snd_soc_dai' has no member named 'codec'
  struct snd_soc_codec *codec = codec_dai->codec;
                                         ^
../sound/soc/fsl/imx-wm8958.c:210:2: error: implicit declaration of function 'snd_soc_update_bits' [-Werror=implicit-function-declaration]
  snd_soc_update_bits(codec, WM8994_GPIO_1, 0x1f, 0x2);
  ^
../sound/soc/fsl/imx-wm8958.c: In function 'imx_wm8958_gpio_init':
../sound/soc/fsl/imx-wm8958.c:292:41: error: 'struct snd_soc_dai' has no member named 'codec'
  struct snd_soc_codec *codec = codec_dai->codec;

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:47 +08:00
c71bd2df2f ASoC: imx-wm8960: Use -EPROBE_DEFER instead of -EINVAL
Use -EPROBE_DEFER instead of -EINVAL for the resource is
not ready in time

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:47 +08:00
1492f5267f ASoC: imx-cs42888: Use -EPROBE_DEFER instead of -EINVAL
Use -EPROBE_DEFER instead of -EINVAL for the resource is
not ready in time

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:46 +08:00
51bf2fec17 MLK-17817-2: ASoC: imx-ak4458: enable 16 channels in TDM mode
In TDM mode with Daisy Chain enabled (CPLD mode 0x04) DAC1 and DAC2
AK4458 codecs on audio board are able to play 16 channels, so extend
the TDM mode constraint to 16 channels.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:50:46 +08:00
4dcdcf9d6b MLK-20428-2: ASoC: imx-cs42xx8: The FMT should be same for tx and rx
If the FMT of tx and rx is different, there will be issue. for example
tx is working at TDM mode, but rx want to work at I2S mode, this case
is not supported in current ALSA driver, the best way to support this
is to distinguish substream in set_fmt function.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:45 +08:00
fa2768aca5 MLK-20034-1: ASoC: imx-ak4458: constrain the mclk rate for DSD
When enable DSD for ak4458 with imx8mm platform, in DSD256 mode
the mclk calculated from ak4458_get_mclk_rate is 256fs, but
the codec require the mclk should be 512fs. so just hard code
the clock to be 512fs in DSD mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:45 +08:00
a0cdb67b91 MLK-19854-1: ASoC: imx-wm8960: fix error when m4 image is not loaded
With rpmsg sound, when the m4 image is not loaded. There is error log

[ 46.275223] imx-wm8960 sound-rpmsg-wm8960: ASoC: CODEC DAI rpmsg-wm8960-hifi not registered
[ 46.284543] imx-wm8960 sound-rpmsg-wm8960: snd_soc_register_card failed (-517)

The issue is caused by that codec is not registered, the sound
card registration will fail

So add check in probe function for codec dai is ready or not.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:44 +08:00
ddbe30f27f MLK-19854-1: ASoC: imx-cs42888: fix error when m4 image is not loaded
With rpmsg sound, when the m4 image is not loaded. There is error log

[ 46.257647] imx-cs42888 sound-rpmsg-cs42888: ASoC: CODEC DAI cs42888 not registered
[ 46.265413] imx-cs42888 sound-rpmsg-cs42888: snd_soc_register_card failed (-517)

The issue is that codec is not register, the sound registeration will fail

So add check in probe function for codec dai ready or not.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:43 +08:00
b554454f67 MLK-19733-3: ASoC: imx-wm8958: Remove duplicate jack kcontrol
We first add the jack kcontrol in commit c2c7959e3a ("MLK-11479-09
pulseaudio5.0 mute Headphone volume when Headphone plugged")

After that there is change in kernel by commit f63e8581e2 ("ASoC: jack:
create kctls according to jack pins info"), the jack kcontrol will be
created with snd_soc_jack_add_pins.

So our change for jack kcontrol in machine driver is not need now, for
driver already call imx_wm8958_gpio_init -> snd_soc_card_jack_new ->
snd_soc_jack_add_pins. otherwise the jack kcontrol will be created twice.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:43 +08:00
6f0dea3aa0 MLK-19733-2: ASoC: imx-wm8962: Remove duplicate jack kcontrol
We first add the jack kcontrol in commit c2c7959e3a ("MLK-11479-09
pulseaudio5.0 mute Headphone volume when Headphone plugged")

After that there is change in kernel by commit f63e8581e2 ("ASoC: jack:
create kctls according to jack pins info"), the jack kcontrol will be
created with snd_soc_jack_add_pins.

So our change for jack kcontrol in machine driver is not need now, for
driver already call imx_wm8962_gpio_init -> snd_soc_card_jack_new ->
snd_soc_jack_add_pins. otherwise the jack kcontrol will be created twice.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:42 +08:00
56474acf4b MLK-19733-1: ASoC: imx-wm8960: Remove duplicate jack kcontrol
We first add the jack kcontrol in commit c2c7959e3a ("MLK-11479-09
pulseaudio5.0 mute Headphone volume when Headphone plugged")

After that there is change in kernel by commit f63e8581e2 ("ASoC: jack:
create kctls according to jack pins info"), the jack kcontrol will be
created with snd_soc_jack_add_pins.

So our change for jack kcontrol in machine driver is not need now, for
driver already call imx_wm8960_gpio_init -> snd_soc_card_jack_new ->
snd_soc_jack_add_pins. otherwise the jack kcontrol will be created twice.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:42 +08:00
2e916a466e MLK-19573-3: ASoC: imx-ak4458: enable DSD playback
Enable DSD playback.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 351177200e66b980deae67b9d571d378f5b128a2)
2019-11-25 15:50:41 +08:00
6346403644 MLK-18170-1: ASoC: imx-wm8960: use API jack functions
Fix the build when IMX_WM8960 machine driver is compiled as module:
CONFIG_SND_SOC_IMX_WM8960=m

Signed-off-by: Florent Tomasin <florent.tomasin@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 233f1db5c861034acb29ade544d05604d08ef040)
2019-11-25 15:50:41 +08:00
4ac1d64047 MLK-19432-1: ASoC: imx-ak5558: limit max rate as function of sample bits
According to AK5558 MCLK frequence must not exceed 36.864 MHz.
Limit maximum supported rate as function of max MCLK frequency,
sample bits and number of slots.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 236796cad225daa39d5b77d763a1d964dd4de4c9)
2019-11-25 15:50:40 +08:00
e49e74b10a MLK-18898-2: ASoC: imx-ak4458: refine mclk rate calculation
The existing implementation calculates mclk rate as function
of audio sample rate multiplied to multiplier taken from Table 5.
However this is not accurate for Manual Setting Mode - tables 3 & 4 from
AK4458 RM defines rate (LRCK/FS) and frame width (MCLK/16fs..1152fs) ranges
as parameters to calculate mclk frequency. Aside of this - adjust
bclk:mclk ratio from machine driver as function of "compatible" id.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 527b8b7032dcb75c14bb2790330ab96743d83b16)
2019-11-25 15:50:40 +08:00
38e7229732 MLK-19168-7: ASoC: imx-wm8960: support codec over rpmsg
support codec over rpmsg

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0b2238d0b88b19a1134aee54706b64a322c6e51b)
2019-11-25 15:50:39 +08:00
39721ca2cc MLK-19168-5: ASoC: imx-cs42888: support codec through rpmsg (part 1)
support codec through rpmsg

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 8585d67e54c4c3607990a792718992de8be8fe58)
[ Aisheng: split rpmsg Kconfig changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:38 +08:00
466a99ed9b MLK-18682-6: ASoC: imx-ak4497: refine 1:1 bclk:mclk ratio support
Use a specific compatible string for 850D in order to limit DSD MCLK
frequency for platforms newer than 850D.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:50:38 +08:00
7b9d5a6277 MLK-18682-3: ASoC: imx-ak: enable both 8k and 11k range of rates
SAI interface now is able to change at runtime the pll parent of the
master clock, so enable both 8k and 11k range of rates for AK codecs.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:50:38 +08:00
e5c4922c52 MLK-18682-1: ASoC: fsl: sai: use set_bclk_ratio to calculate BCLK freq (part 2)
ALSA API has a standard way to configure DAI BCLK by calling
"snd_soc_dai_set_bclk_ratio" function. So use it to set BCLK ratio
and calculate SAI BCLK frequency.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
[ Aisheng: split DAI sai changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:37 +08:00
a73abcd3ed ASoC: wm8962: remove unused variable
codec_clk is now part of private_data.

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
2019-11-25 15:50:37 +08:00
808db64543 MLK-17734-2: ASoC: fsl: ak5558: Remove support for 192KHz in TDM mode
Using TDM256 mode (our only supported mode) in order to
support 192KHz we would need a MCLK of 192000 * 512 = 98304000.

But maximum frequency supported by the Audio PLL is 4.91 MHz.

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:36 +08:00
8ffa567575 MLK-17734-1: ASoC: fsl: imx-ak5558: Fix TDM mode for 8kHz / 16Khz
In order for TDM to correctly work we need that MCLK and
BCLK to follow the values in Table 9.

Thus,
	* TDM128: BCLK = 128fs, MCLK = 128-1024fs
	* TDM256: BCLK = 256fs, MCLK = 256-1024fs
	* TDM512: BCLK = 512fs, MCLK = 512-1024fs

We assume only support TDM256 for the moment.

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:36 +08:00
3be16c7bc4 MLK-15071: ASoC: fsl: imx-ak4497: Fix clk for 384KHz and 786KHz (part 2)
With the current multipliers SAI isn't able to derive a correct bitclk.

e.g: When playing at 786Khz with current multiplier

MCLK = 22579200, requested freq 22579200 but SAI wants:
MCLK = (DIV + 1) * 2 * freq [SAI TCR2], so an acceptable solution
is to add a 2x factor to mclk.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
[ Aisheng: split codec changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:36 +08:00
c04acda5e4 MLK-15071: ASoC: fsl: imx-ak5558: Fix clk for 384KHz and 786KHz
With the current multipliers SAI isn't able to derive a correct bitclk.

e.g: When recording at 786Khz with current multiplier

MCLK = 24576000, requested freq 24576000 but SAI wants:
MCLK = (DIV + 1) * 2 * freq [SAI TCR2], so an acceptable solution
is to add a 2x factor to mclk.

Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:35 +08:00
4c76f8ab00 MLK-17600: ASoC: imx-ak5558: Set MCLK as a function of fs
MCLK frequency is determined based on LRCK frequency, according
to the operation mode. Because AK5558 runs in Auto Mode, we use
table 5 from datasheet to set the correct MCLK.

Multiplier must be set twice as value shown in RM because SAI
MCLK must be at least double the BCLK.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Cosmin Samoila <cosmin.samoila@nxp.com>
2019-11-25 15:50:34 +08:00
37a4dee8bf MLK-17509: ASoC: imx-ak4458: Set MCLK freq as a function of FS
According to AK4458 RM the MCLK freq need to be set
externaly as function of LRCK frequency. Notice that
multiplier is twice the value shown in RM since SAI
MCLK must be at least double the BCLK.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:50:33 +08:00
d0c91438bc MLK-17528-4: ASoC: imx-ak4497: set MCLK freq as function of FS
According to AK4497 RM the MCLK freq need to be set
externaly as function of LRCK frequency.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:33 +08:00
a4c28a6d35 MLK-17528-2: ASoC: imx_pdm: Use FSL_SAI_CLK_BIT to signal the proper clock id
The current implementation suggest that MAST1 frequency is to be changed,
which is wrong. Use FSL_SAI_CLK_BIT clock id instead of FSL_SAI_CLK_MAST1
in order to make the code more intuitive and to signal proper
clk_id to SAI.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:32 +08:00
476e8f9e9a MLK-17515-1: ASoC: imx-ak4458: add pdn gpio for machine driver
There is two ak4458 codecs which share some pdn gpio. If assign
the pdn gpio to one codec, will cause the another codec error:

ak4458 1-0012: Unable to sync registers 0x0-0x0. -6

The reason is that if the codec driver is trying to do regcache_sync,
but another codec is resetting the pdn gpio in same time, the
regcache_sync will fail.

So Move the pdn gpio to machine driver, machine driver will
control this gpio for two codecs.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin Samoila <cosmin.samoila@nxp.com>
2019-11-25 15:50:32 +08:00
81ef35e645 MLK-15033-1: ASoC: fsl: Change rate constraints in TDM mode for AK4458
When in TDM mode, change constraints for rate and allow only
rates in [8KHz, 96KHz] due to the limitations of SAI master
clock. If rate is higher than 96KHz, the TX rate cannot be
obtained using only a 49MHz SAI clock.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:31 +08:00
aa64db99e1 ASoC: imx-ak5558: Add support for 384KHz and 768KHz
In normal mode we need to test SAI capability of supporting
higher rates so adjust constraints list to allow 384KHz
and 768KHz.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:31 +08:00
9e64d03186 MLK-15033: ASoC: fsl: Change constraints for AK4458
Add 384KHz and 768KHz as supported rates and add
different constraints for number of channels when
in tdm mode.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:31 +08:00
681e50e56c MLK-15033: ASoC: fsl: Add TDM support in machine driver for AK4458
TDM mode is enabled when "fsl,tdm" property is added in machine
driver dts node. When using TDM mode, SND_SOC_DAIFMT_DSP_B format
is used and the tdm slot_width is set to 32.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:30 +08:00
368b9a331a MLK-17472: ASoC: imx-wm8962: fix build warning
sound/soc/fsl/imx-wm8962.c: In function ‘imx_wm8962_probe’:
sound/soc/fsl/imx-wm8962.c:810:2: warning: ‘cpu_np’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  of_node_put(cpu_np);
  ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:30 +08:00
f051128280 MLK-17462-3: ASoC: imx-ak5558: support TDM mode
add fsl,tdm property, in tdm mode, the slot_width is fixed to
32 bit.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:29 +08:00
0caaa11532 MLK-15071: ASoC: codecs: AK5558: Remove unsuported rates and channels
Support only even number of channels greater than 2 and
rates multiple of 8000.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:28 +08:00
512a0da419 MLK-16224-7: ASoC: imx-ak4497: support dsd format
for dsd, specify the slot number is 1, SND_SOC_DAIFMT_PDM is
used for DSD, and add constraint for sample rate.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:50:28 +08:00
61e5eb6b45 MLK-15033: ASoC: codecs: AK4458: Remove unsupported rates and channels
Support only even number of channels greater than 2 and
rates multiple of 8000.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:27 +08:00
0d2e4764e0 MLK-17428-7: ASoC: imx-ak5558: support 768KHz sample rate
For 768kHz sample rate, the codec can't support 64fs mclk, only
can support 32fs mclk, so we can't fix the slot_width to 32, which
is for S32_LE, use params_physical_width(params) to instead of
hard code.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:27 +08:00
ab38dd7dda MLK-17428-6: ASoC: imx-ak4497: support 768KHz sample rate
For 768kHz sample rate, the codec can't support 64fs mclk, only
can support 32fs mclk, so we can't fix the slot_width to 32, which
is for S32_LE, use params_physical_width(params) to instead of
hard code.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:26 +08:00
86dc94e98e MLK-17428-5: ASoC: imx-ak4458: support 768KHz sample rate
For 768kHz sample rate, the codec can't support 64fs mclk, only
can support 32fs mclk, so we can't fix the slot_width to 32, which
is for S32_LE, use params_physical_width(params) to instead of
hard code.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:26 +08:00
493fff48cb MLK-15070-2: ASoC: fsl: Add machine driver for AK4497
This glues SAI interface with AK4497 DAC codec on i.MX boards.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: Makefile clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:25 +08:00
a14c19c079 MLK-15071-2: ASoC: fsl: Add machine driver for AK5558
Add machine driver for i.MX boards that have AK5558 ADC attached to SAI.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:24 +08:00
522efbcae4 MLK-15033-2: ASoC: fsl: Add machine driver for AK4458
Add machine driver for i.MX boards that have AK4458 DAC attached to SAI.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:21 +08:00
06a2063127 MLK-16929-2: sound: soc: fsl: imx pdm mic driver over SAI
i.MX Sound SoC Audio support for PDM mics on SAI
Set audio recording hardware constrains, support
Sample rates: 8000, 16000, 32000, 48000, 64000
PDM decimation factor property fixed to 64
Number of channels: 1

Signed-off-by: Adrian Alonso <adrian.alonso@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:19 +08:00
3b62ee9b1c MLK-17034-3: ASoC: imx-wm8960: remove clk operation in startup/shutdown
In imx8 when systerm enter suspend state, the power of subsystem will be
off, the clock enable state will be lost after resume, the startup
function isn't called after resume, so the clock will be enabled after
resume, the clock operation should be moved to pm runtime resume function.
For the mclk is for codec, this clock enablement and disablement will be
move to code driver's runtime resume and runtime suspend

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:17 +08:00
15e7198715 MLK-16742-4: ASoC: imx-cs42888: fix DAPM routes
ASRC DAPM routes not needed when ASRC node is not specified.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:16 +08:00
0f03217059 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>
2019-11-25 15:50:16 +08:00
2f0990fdee MLK-16350-5: ASoC: imx-wm8962: fix clock rate issue
The rate returned by clk_get_rate in probe function is not correct,
for the power domain in that time may be closed, kernel get 0 rate
from scfw, so move the clk_get_rate to hw_params, in that time, the
power domain should be enabled

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:15 +08:00
4b5fcca4a1 MLK-16350-4: ASoC: imx_mqs: fix the clock rate issue
The rate returned by clk_get_rate in probe function is not correct,
for the power domain in that time may be closed, kernel get 0 rate
from scfw, so move the clk_get_rate to hw_params, in that time, the
power domain should be enabled

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:15 +08:00
efc41bef7f MLK-16350-3: ASoC: imx-cs42888: fix clock rate issue
The rate returned by clk_get_rate in probe function is not correct,
for the power domain in that time may be closed, kernel get 0 rate
from scfw, so move the clk_get_rate to hw_params, in that time, the
power domain should be enabled

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:14 +08:00
215c1891b7 MLK-13945-2: ASoC: imx_mqs: specify clock name in machine driver
specify clock name in machine driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:14 +08:00
8f578fd3a1 MLK-15140-2: ASoC: fsl: add machine driver for wm8524
This a simple machine driver for wm8524.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
[ Aisheng: clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:13 +08:00
06532305e2 MLK-15067: ASoC: fsl: imx-wm8958: Kill warning for non-gpr boards
Similar with 7c280619ed (" MLK-14663-2: ASoC: fsl: imx-wm8960: Kill
warning for non-gpr boards")

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:13 +08:00
6e74493303 MLK-15067: ASoC: fsl: imx-wm8958: Refactor GPR parsing
This is similar with commit c79a82aec8 ("ASoC: fsl: imx-wm8960: Refactor
GPR parsing") and it is needed for easier adding support for non-gpr boards.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:13 +08:00
4a99b32098 MLK-14663-2: ASoC: fsl: imx-wm8960: Kill warning for non-gpr boards
A side effect of commit 5555277e69 ("MLK-13574-1: ASoC: imx-wm8960:
remove the gpr dependency") is that a warning was printed for boards
without gpr. This can be confusing.

imx7d boards do not have a gpr setting, so use imx7d-evk-wm8960
compatible string to avoid printing the warning.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:12 +08:00
84b1aee36e MLK-14663-1: ASoC: fsl: imx-wm8960: Refactor GPR parsing
Refactor GPR handling into a function for easier adding support
for non-gpr boards.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:11 +08:00
1a88b02e51 MLK-15104: ASoC: imx-sii902: add constraint for channels
The maximum channel supported by sii902 is 2, but machine
driver use dummy codec, and there is no constraint list
from codec, so add constraint directly in machine driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 037051e60f)
2019-11-25 15:50:11 +08:00
8d4d4530c4 MLK-15053: ASoC: fsl: imx-cs42888: Reject unsupported sampling rates
Dynamic constraints for supported sampling rates cannot prevent aplay to
play audio files with higher rates. So we remove the constraints and hard
reject the unsupported samples.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:50:10 +08:00
e8e2ecd38b MLK-15063: ASoC: fsl: add dpcm_merged_chan for machine driver
Same as commit cfe36e2e7f ("MLK-15043-2: ASoC: imx-cs42888: fix
noise issue with FE-BE case"). need to add same configuration
for imx-wm8960, imx-wm8962, imx-mqs.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 7195ad8ff5)
2019-11-25 15:50:10 +08:00
27496f3b2d MLK-15043-2: ASoC: imx-cs42888: fix noise issue with FE-BE case
The case is "aplay -Dhw:0,1 -d 5 -r 8000 -f S16_LE -c 9 audio8k16b9c.wav",
which is to playback 9 channel bitstream. But the maximum supported channel
of codec is 8, ALSA didn't return error for this case, but continue to
playback.

The reason is that in FE-BE case, ASLA only get the FE's hw parameter for
constraint list, omit the BE's parameter. This patch is to merge BE's
parameter to FE. in this situation with the 9 channel case, ASLA will
return error "aplay: set_params:1303: Channels count non available"

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit cfe36e2e7f)
2019-11-25 15:50:09 +08:00
1c3a98e0fc MLK-15067: ASoC: fsl: imx-wm8958: Don't fail if gpr is missing
There are boards without gpr setting, so it's better not to fail
in such cases and only print a warning.

This is related to commit ce72b6d2668049 ("MLK-13574-1: ASoC: imx-wm8960:
remove the gpr dependency").

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:50:09 +08:00
19dd93807e MLK-14955-1 imx8: Added MXC_ARM64 into dependent
Otherwise there are warning when remove COMPILE_TEST

Signed-off-by: Frank Li <Frank.Li@nxp.com>
2019-11-25 15:50:08 +08:00
ebdb55bf3a MLK-14778: ASoC: fsl: imx-cs42888: Improve support for odd number of channels
For samples with more than 2 and odd number of channels the I2S mode
does not work correctly. In I2S mode we are required to activate an even
number of channels (possibly on multiple datalines) and thus configure
the BCLK for even channels. In this case samples with odd (smaller) number
of channels are played faster and the sound is distorted.

To fix this behavior we can enable TDM mode for the special cases of
samples with 3, 5 or 7 channels. But even TDM has some restrictions that
prevent us from having full support for the special cases:
1. TDM is not supported by codec in master mode so 3, 5 and 7 channels
usage is denied.
2. In codec slave mode TDM works only with 8 slots and slot width of 32
bits. For an often used MCLK frequency of 24MHz and the above restrictions
the maximum sample rate is limited to 48KHz = 24576000/(2*8*32).
The 2 denominator is required by ESAI BCLK divisors.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
2019-11-25 15:50:08 +08:00
c554bf7027 MLK-14851: ASoC: wm8962: fix clock issue for S20_3LE (part 2)
There is error log "wm8962 3-001a: Unsupported BCLK ratio 6"
When the bitstream's format is S20_3LE.
The reason is that the pll output is samplerate*256, which
can't divide to clock samplerate*20*2. So in this patch change
the pll output to samplerate*384, and use the physical_width
for S20_3LE to calculate the bclk.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
[ Aisheng: split codec changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:07 +08:00
f6e79e6447 MLK-13574-1: ASoC: imx-wm8960: remove the gpr dependency
There is no gpr setting in some board. so we can't return
a fatal error.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:06 +08:00
d1ab1dbc59 MLK-13369-1: ASoC: fsl: fix the hard code gpr address in machine driver
There is hard code for gpr address in machine driver, imx-wm8960
and imx-wm8958, when the sai interface changed to sai1 or sai3,
there will be issue, so remove the hard code, use the property
from the device tree.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:06 +08:00
28fdfb3d2c MLK-12907: ASoC: imx_mqs: mqs can't be recorder
mqs can't be used as recorder, the capture property need to be zero.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:05 +08:00
3be48438f1 MLK-12787-1: ASoC: imx-wm8962: Add codec-master property
Add codec-master property for imx-wm8962. If set this in device
tree, the codec will work as master, if don't set it, the cpu dai
will work as master.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:05 +08:00
58609cf02e MLK-12745-2: ASoC: fsl_esai: remove the channel swap workaround for imx6ull (part 2)
In imx6ull, the esai errata ERR008000 for imx6q/dl is fixed, so remove the
workaround from imx6ull.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
[ Aisheng: split ESAI DAI changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:05 +08:00
65c3a6b229 MLK-12745-1: ASoC: imx-cs42888: add codec master mode support
Add codec master mode support, the default is slave mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:04 +08:00
5cf8ad51ee MLK-12464-1: ASoC: fsl: imx-wm8960: Fix no clock after suspend/resume randomly
After suspend and resume, the wm8960 codec will change the state from
BIAS_OFF to BIAS_ON, in this time, the hw_free is called, the PLL will be
diabled, and next instance is started in rapid sequence, hw_params is called
But PLL is not enabled, because the bias state is not BIAS_ON.

As PLL is disabled in BIAS_ON->BIAS_STANDBY, so don't need to disable pll
in hw_free of machine driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:04 +08:00
5bc6557674 MLK-12244 ASoC: fsl: Set the sound card owner field
When load sound card, the pulseaudio will using the sound card to
playback and record. It may be cause a kernel crash when the sound
card is unloaded while the playback/record is active

After setting the sound card owner field, when pulseaudio is running,
the sound card module ref-count will not be 0 and the sound card will
not be unloaded. So you should stop the pulseaudio when you want to
unload the sound card.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
[ Aisheng: hdmi change merged into hdmi branch ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:50:04 +08:00
c770ac5d82 MLK-12165: ASoC: fsl: imx-cs42888: remove 32k and 64k support
Revert "MLK-11623 ASoC: imx-cs42888: add 32k and 64k sample rate support"

This reverts commit 314a01f405.

In Async mode, record and playback use different samplerate, one is 32k,
another is 48kHz, there will be issue "unsupported sysclk ratio".

example case is
arecord -Dhw:0,1 -f S16_LE -r 32000 -c 2 | aplay -f S16_LE -r 32000 -c 2

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:03 +08:00
1afa12b39e MLK-12057 ASoC: imx-wm8960: add headphone/micphone/headset jack support
Add headphone/micphone/headset jack support for different board.

There are headphone detect gpio and microphone detect gpio which
can be configured from device tree.
If headphone and microphone using the same gpio for jack detect,
it suppose to be a headset and will register a headphone jack for it.
If headphone and microphone using different gpio for jack detect,
it suppose not to be a headset, and will register headphone jack
and microphone jack respectively.

Is't not appropriate to set the adc data output in machine driver.
It will not be compatibly when we change hardware connection.
wm8960 codec driver has added "ADC Data Output Select" kcontrol,
so that we can set the ADC data output from user space.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 92f65b4bee51fabdfa3a3c191f511c2ec7cb18a1)
2019-11-25 15:50:02 +08:00
557c11cd80 MLK-12043: ASoC: fsl: imx-cs42888: Add return value check
Report by coverity (CID 18428). The return value need be checked
for snd_soc_dai_set_sysclk().

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:50:02 +08:00
61d25ac27e MLK-11915-05 ASoC: imx-wm8958: init codec_np to avoid wild pointer
init codec_np to avoid wild pointer. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 76665930654867cf38a86ba747a9f8a5bf2665e2)
2019-11-25 15:50:01 +08:00
2bd402ba2f MLK-11915-04 ASoC: imx-cs42888: init asrc_np to avoid wild pointer and check return value of set_fmt()
init asrc_np to avoid wild pointer and check return value of
set_fmt(). Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 4ccc87a93e180e09b6494fd6c6d81b07dc054e9b)
2019-11-25 15:50:00 +08:00
cf5acdaf4b MLK-11915-03 ASoC: imx-sii902x: init sii902x_np to avoid wild pointer
init sii902x_np to avoid wild pointer. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 780e27683c38f785ea7f7e07e83b00ffd3c22d78)
2019-11-25 15:50:00 +08:00
5db31deedb MLK-11915-02 ASoC: imx-wm8962: init codec_np to avoid wild pointer
init codec_np to avoid wild pointer. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 8e27b90c9adf5033038a40e0b61a7ffe4c971290)
2019-11-25 15:50:00 +08:00
c47fb5a73d MLK-11915-01 ASoC: imx-wm8960: check return value and init codec_np to avoid wild pointer
check return value for set_fmt and set_sysclk function, and init
codec_np to avoid wild pointer. Reported by coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 68021ab9ada4a7f3037993a3887453e12271d4ed)
2019-11-25 15:50:00 +08:00
4a8b90a349 MLK-11623 ASoC: imx-cs42888: add 32k and 64k sample rate support
When codec sysclk is 24576000, the sample rate ratio can be 128, 192,
256, 384, 512, 768, 1024. So 32k, 48k, 64k, 96k, 192k can be support.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit b436254cd5)
2019-11-25 15:49:59 +08:00
556cc10e2c MLK-10713-2 ASoC: imx-sii902x: Add 96k and 192k sample rate support
Add 96k and 192k sample rate support for hdmi audio.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit fa94b89ab9)
2019-11-25 15:49:59 +08:00
e2310573c9 MLK-10611-2 ASoC: imx-sii902x: forbid using SAI when SAI is being used by other device
imx7d-sdb board using one SAI for wm8960 and sii902x hdmi audio, wm8960
using SAI as slave mode and sii902x hdmi audio using SAI as master mode,
so SAI can't be used at the same time.

Forbid palyback(capture) when SAI is being used capture(playback) by other
device.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit bac15c28c3)
2019-11-25 15:49:58 +08:00
c9f343d9df MLK-10518-1 ASoC: imx-sii902x: add machine driver for sii902x hdmi audio
Add machine driver for sii902x hdmi audio. Restricting by SAI master clock,
the hdmi audio just support 16bit 24bit sample width and 32k 48k sample rate.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 8dc359b46c)
2019-11-25 15:49:58 +08:00
ca0392b0cb MLK-11259-2: ASoC: fsl: enable ASRC p2p for ssi->wm8962 (part1)
Enable ASRC p2p for ssi->wm8962, base on the new p2p script,
which support to select dualfifo for source/destination device.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
[ Aisheng: split ASRC changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:49:58 +08:00
8139df52bd MLK-11479-11 ASoC: imx-wm8962: Add non-SSI cpu dai support (part 1)
cherry-pick below patch from v3.14.y:
ENGR00307635-5 ASoC: imx-wm8962: Add non-SSI cpu dai support

The current imx-wm8962 machine driver is designed for SSI as CPU DAI only
while as its name we should make the driver more generic to any other CPU
DAI on i.MX serires -- ESAI, SAI for example.

So this patch makes the driver more general so as to support those non-SSI
cases.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
(cherry picked from commit b6fca438dde1b4c0bbdee31729871d601f287dc9)
[ Aisheng: split dts changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:49:58 +08:00
62f5b5f0ca MLK-11479-10 ASoC: fsl: pop noise with wm8962
cherry-pick below patch from v3.14.y:
ENGR00312217-1 ASoC: fsl: pop noise with wm8962

The reason of pop noise is that we change the sysclk in hw_free, which is
for another wm8962 issue. So in currently the pop noise can't be resolved
with no confliction. So for Android, because the samplerate is fixed. we can
use other workaround for this issue: change the sysclk in the set_bias().

Signed-off-by: Shengjiu Wang <b02247@freescale.com>
(cherry picked from commit 84babc7fa0a56f6620f8b04a86baece620297dda)
2019-11-25 15:49:57 +08:00
2237688f52 MLK-11479-09 pulseaudio5.0 mute Headphone volume when Headphone plugged
cherry-pick below patch from v3.14.y:
ENGR00306857 pulseaudio5.0 mute Headphone volume when Headphone plugged

Pulseaudio will detect the Headphone Jack, then swith to Headphone.
So register new Jack for Headphone, the iface=CARD.

Signed-off-by: Shengjiu Wang <b02247@freescale.com>
(cherry picked from commit 6a715373c43f16e48883061049e67919281878d1)
2019-11-25 15:49:57 +08:00
be98d73d36 MLK-11479-06 ASoC: fsl: Add WM8962 jack detecting support
cherry-pick below patch from v3.14.y:
ENGR00277715-3 ASoC: fsl: Add WM8962 jack detecting support

There're two GPIOs connected to the headphone jack and microphone jack,
thus add the states detection.

Reviewed-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <b42378@freescale.com>
2019-11-25 15:49:56 +08:00
02bac8135e MLK-11479-05 ASoC: fsl: Fix set-mute-failed issue after WM8962 capture
cherry-pick below patch from v3.14.y:
ENGR00277471 ASoC: fsl: Fix set-mute-failed issue after WM8962 capture

We only need to mute WM8962 after playback, so add direction check
before doing mute.

And a mute failure would cause hw_free() abruptly return after it,
which might drop the essential procedure code for FLL controlling.
Thus put mute before FLL controlling code and drop its return check.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <b42378@freescale.com>
(cherry picked from commit 3133b6cfb31b202805d31d449bfa70383e5e1c75)
2019-11-25 15:49:55 +08:00
2b55dd085e MLK-11479-04 ASoC: imx-wm8962: Set MCLK source clock to 0Hz in hw_free()
cherry-pick below patch from v3.14.y:
ENGR00274386-2 ASoC: imx-wm8962: Set MCLK source clock to 0Hz in hw_free()

When DAPM closed WM8962 after playback, its driver would prompt
'wm8962 0-001a: Unsupported sysclk ratio 500' due to the invalid
divisor calculated by WM8962 codec driver.

To fix it, we can work around by setting its MCLK source to 0Hz,
so the codec driver would never get an invalid divisor any more.
Since hw_params() would re-set the MCLK source, no need to worry
about any side-effect.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <b42378@freescale.com>
(cherry picked from commit a935f7680ac3958ce72cf7413cac278c0683d4c0)
2019-11-25 15:49:55 +08:00
f206144f3a MLK-11479-01 ASoC: fsl: Use hw_params() and hw_free() to set FLL
We followed community way by using set_bias() to set FLL of WM8962.
But this can't meet our requirement: aplay -Dhw: 16khz.wav 24khz.wav.
Thus use hw_params() and hw_free() instead.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <b42378@freescale.com>
2019-11-25 15:49:55 +08:00
6f97b9951f Revert "ASoC: imx-wm8962: Remove global variables"
This reverts commit 8f7206d69a

It is broken and breaks rebasing of imx_4.9.y wm8962 code

See: http://mailman.alsa-project.org/pipermail/alsa-devel/2018-February/132595.html

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:49:54 +08:00
d08dacb943 MLK-11435 ASoC: fsl_mqs: add snd_soc_pm_ops for mqs machine driver
add snd_soc_pm_ops for mqs machine driver to make the trigger
suspend/resume be called in suspend/resume.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 7887d4d9ab461f8d1d67f62c6cbc032e082193c2)
2019-11-25 15:49:54 +08:00
36316acb3f MLK-10055-1: ASoC: imx-cs42888: when codec probe failed, alsa return RETRY error.
If there is no codec device, the machine driver will not register the
card. then alsa will not return RETRY error. update the error handling
for machine driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 01ffd8e5e828d20214a196e64b981c9fd94c913e)
2019-11-25 15:49:53 +08:00
e2a81a7a37 MLK-11429-21: ASoC: imx-cs42888: port cs42888 machine driver from imx_3.10.y
cherry-pick below patch from imx_3.14.y
ENGR00330403-1: ASoC: imx-cs42888: port cs42888 machine driver from imx_3.10.y

Port the cs42888 machine driver from imx_3.10.y and do update according to
new esai driver and asrc driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 7ed3aac83630a38eb397ed92f815a28e07198748)
2019-11-25 15:49:53 +08:00
532bc92ed2 MLK-11053: ASoC: imx_mqs: Remove 96k and 192k support for mqs
If the mclk is 24.576MHz, mqs can't support 96k and 192kHz, because
the we can't get a proper clock divider for mqs.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:49:52 +08:00
288a1ac19c MLK-10775-2: ASoC: imx-mqs: add asrc p2p support in sai->mqs
add asrc p2p support in sai->mqs

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:49:52 +08:00
7883ba7b59 MLK-10108-2: ASoC: imx-mqs: set tdm slot in hw_params() for sai master mode
Set tdm slot in hw_params() for sai master mode.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
2019-11-25 15:49:51 +08:00
953b49f01a MLK-9723-5: ASoC: imx-mqs: add mqs machine driver
Implement machine driver for mqs, which use the sai as cpu dai.
sai work on master mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit cac9eb41debc6444d753dc936cdf76874260b9e4)
2019-11-25 15:49:50 +08:00
cc3d498408 MLK-11369-4 ASoC: imx-wm8958: port wm8958 machine driver from imx_3.14.y
port wm8958 machine driver from imx_3.14.y.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>

Fix build for DRIVER_ATTR removal during 4.14 rebase

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:49:50 +08:00
dffd004bed MLK-11369-1 ASoC: imx-wm8960: port wm8960 machine driver from imx_3.14.y branch
port wm8960 machine driver from imx_3.14.y branch

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>

Fix build for DRIVER_ATTR removal during 4.14 rebase

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:49:50 +08:00
c8182e664d Revert "ASoC: imx-wm8962: Remove machine driver"
This reverts commit 790d631dcf.
2019-11-25 15:49:50 +08:00
2fc195593d imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:49:49 +08:00
9360612b85 ASoC: fsl_audmix: Add spin lock to protect tdms
When two stream start to run, the trigger function
may be called by two substream in same time, that
the priv->tdms may be updated wrongly

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:49:46 +08:00
d92835b3d0 MLK-22722: ASoC: fsl_easrc: Use global variable instead local variable
After suspend & resume, there may be noise in asrc output. The reason
is the coeff variable is local, in resume function this variable is
invalid to access, so that cause the prefilter coeff not correctly be
setted.

This patch is to change the coeff variable to be global that we can
get the correct value in resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 56aa181b23)
2019-11-25 15:48:52 +08:00
03944b23b2 MLK-22591: ASoC: fsl_easrc: Add RUN_STOP in stop context
When record bitstream with ASRC+AK5558, there may be I/O error
for the high sample rate case (352kHz/768kHz).

The reason is that the context is not fully reset after
conversion, the ASRC does not start to work in next conversion.

In order to fully reset the context, we need to enable RUN_STOP,
then clear the RUN_EN bit.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 7b44c3c653)
2019-11-25 15:48:52 +08:00
8a4b48b552 MLK-22575-3: ASoC: fsl_easrc: reformat the fsl_easrc_config_slot
Wrap the common code to fsl_easrc_config_one_slot function, that
is to make the code more clear.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0a640c4dde)
2019-11-25 15:48:51 +08:00
1eee7abe7c MLK-22575-2: ASoC: fsl_easrc: disable PF_BYPASS_MODE
When run conversion in parrallel, one is down sampling, another
is up sampling, so one enables PF_BYPASS_MODE, another disable
PF_BYPASS_MODE, when the allocated slots in a same context
processor, there is noise in the result of down sampling.

If we alway disable PF_BYPASS_MODE, the issue can't be reproduced.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 3a1a4abc02)
2019-11-25 15:48:51 +08:00
e5b7fd131b MLK-22575-1: ASoC: fsl_easrc: configure slot according to pf memory size
The maximum prefilter memory size is 6144 entry, it is not allowed to
require memory size exceed this size.

When we calculate the available channel in the context processer, we
need to consider if the prefilter memory is not enough for the maxmum
channels, then we need to reduce the channels in this context processor,
move the left channel to another context processor.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 5a15d81a1c)
2019-11-25 15:48:51 +08:00
2e30be00cd MLK-22521-3: ASoC: fsl_easrc: Add multi context for bps_iec958
Add multi context support for bps_iec958

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 131408cc5b)
2019-11-25 15:48:50 +08:00
3a07d7894e MLK-22521-2: ASoC: fsl_easrc: support configuration of channel status
support configuration of channel status for IEC958

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 92aee54f84)
2019-11-25 15:48:50 +08:00
646df31f0f MLK-22521-1: ASoC: fsl_easrc:IEC958 is only supported for output
IEC958 is only supported for output according to the RM

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit bf36888526)
2019-11-25 15:48:49 +08:00
0cbd4bcb1c MLK-22463-1: ASoC: fsl_easrc: Fix logically dead code
Fix logically dead code which is reported by coverity

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:48:49 +08:00
3dca6df996 MLK-22333: ASoC: fsl_easrc: Support FLOAT_LE
The audio float point data range is (-1, 1), the asrc would output
all zero for float point input and integer output case, that is to
drop the fractional part of the data directly.

In order to support float to int conversion or int to float conversion
we need to do special operation on the coefficient to enlarge/reduce
the data to the expected range.

For float to int case:
Up sampling:
1. Create a 1 tap filter with center tap (only tap) of 2^31
   in 64 bits floating point.
   double value = (double)(((uint64_t)1) << 31);
2. Program 1 tap prefilter with center tap above.

Down sampling,
1. If the filter is single stage filter, add "shift" to the exponent of
   stage 1 coefficients.
2. If the filter is two stage filter , add "shift" to the exponent of
   stage 2 coefficients.

The "shift" is 31, same for int16, int24, int32 case.

For int to float case:
Up sampling:
1. Create a 1 tap filter with center tap (only tap) of 2^-31
   in 64 bits floating point.
2. Program 1 tap prefilter with center tap above.

Down sampling,
1. If the filter is single stage filter, subtract "shift" to the
   exponent of stage 1 coefficients.
2. If the filter is two stage filter , subtract "shift" to the
   exponent of stage 2 coefficients.

The "shift" is 15,23,31, different for int16, int24, int32 case.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 8a18a7a2dd)
2019-11-25 15:48:47 +08:00
1a1a2bb13e MLK-22295-2: ASoC: fsl_easrc: Fix build warning with CONFIG_PM_SLEEP=n
Fix build warning with CONFIG_PM_SLEEP=n, the message is

In file included from sound/soc/fsl/fsl_easrc.c:2204:0:
sound/soc/fsl/fsl_easrc_m2m.c:960:13: warning: ‘fsl_easrc_m2m_resume’ defined but not used [-Wunused-function]
 static void fsl_easrc_m2m_resume(struct fsl_easrc *easrc)
             ^~~~~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_easrc_m2m.c:927:13: warning: ‘fsl_easrc_m2m_suspend’ defined but not used [-Wunused-function]
 static void fsl_easrc_m2m_suspend(struct fsl_easrc *easrc)
             ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 0b6e34f8aa)
2019-11-25 15:48:47 +08:00
faa039ded9 MLK-22295-1: ASoC: fsl_asrc: fix build warning with CONFIG_PM_SLEEP=n
fix build warning with CONFIG_PM_SLEEP=n, the warning message is

In file included from sound/soc/fsl/fsl_asrc.c:968:0:
sound/soc/fsl/fsl_asrc_m2m.c:1021:13: warning: ‘fsl_asrc_m2m_resume’ defined but not used [-Wunused-function]
 static void fsl_asrc_m2m_resume(struct fsl_asrc *asrc_priv)
             ^~~~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_asrc_m2m.c:990:13: warning: ‘fsl_asrc_m2m_suspend’ defined but not used [-Wunused-function]
 static void fsl_asrc_m2m_suspend(struct fsl_asrc *asrc_priv)
             ^~~~~~~~~~~~~~~~~~~~

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit a3ec5433cf)
2019-11-25 15:48:47 +08:00
7740241513 MLK-22254: ASoC: fsl_easrc: Fix issue reported by coverity
Fix issue reported by coverity:
a. Resource leak for ctx is not freed when m2m allocation
failed
b. Use of untrusted scalar value

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:47 +08:00
4594bd9dd7 MLK-22242: fsl_easrc: Fix definition issue of parameter width
Some definition of parameter's width is wrong, that cause the
failure of conversion for more than 16 channels.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:46 +08:00
b4d37eb87a MLK-22243: fsl_easrc: Add lock to protect configuration of slot
With multi-instance case, the fsl_easrc_config_slot will be called
in parallel, the fsl_easrc_slot is independent with context, so
we need to lock to protect the access of fsl_easrc_config_slot,
otherwise, the slot configuration will be fail for some instance
that cause "input DMA task timeout".

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:46 +08:00
1b89c277d1 MLK-22161: fsl_easrc: Remove float point format support
The input audio float data range is normalized to (-1, 1), but
the hardware will drop to fractional part if output format
is integer format, so the output is all zero, which does not flow
the normal audio case, that to shift the output to Q15/Q31.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:48:45 +08:00
f3ed8de138 MLK-22160: fsl_easrc: Remove Big endian support
The hardware don't support big endian format. which only
support bit reverse.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:48:45 +08:00
fe546b8f9c MLK-22239-2: ASoC: fsl_easrc: Support S24_3LE and S20_3LE for m2m
upport S24_3LE and S20_3LE for m2m.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:48:44 +08:00
f45cca3729 MLK-22168-2: fsl_easrc:fix timeout issue if STOP_CONV is not called
When error happen, user may not call STOP_CONV to stop the context,
then there will be "input DMA task timeout" issue for next m2m task.

In this patch, fsl_easrc_stop_context is called in RELEASE_PAIR to
make sure context is stopped.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:43 +08:00
2ca6909313 MLK-22168: fsl_easrc:Add error handle for format check
Add error handler for format check, if the format is not supported
should return error, otherwise it cause "input DMA task timeout"

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:48:43 +08:00
d1d5947493 MLK-21940-4: ASoC: fsl_easrc: Support the m2m function
EASRC M2M function is not able to put upstream due to its self-designed
ioctl protocol. So make a single patch for it and make it merge
into P2P driver as simply as possible.

The patch can only be maintained internally unless some one designs a
new protocol or implement the originally protocol by using some common
approach provided by Linux Kernel.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:48:43 +08:00
afd67f6331 MLK-21940-3: ASoC: fsl_easrc: Add support new asrc module
EASRC (Enhanced ASRC) is a new IP module found on i.MX8 MN. It is
different from old ASRC module.

The primary features for the EASRC are as follows:
1. 4 Contexts - groups of channels with an independent time base
2. Fully independent and concurrent context control
3. Simultaneous processing of up to 32 audio channels
4. Programmable filter charachteristics for each context
5. 32, 24, 20, and 16-bit fixed point audio sample support
6. 32-bit floating point audio sample support
7. 8kHz to 384kHz sample rate
8. 1/16 to 8x sample rate conversion ratio
9. Software control of fine conversion ratio

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:48:42 +08:00
84ef7c4988 MLK-21940-2: dt-bindings: sound: Add document for fsl,easrc
EASRC (Enhanced ASRC) is a new IP module found on i.MX8 MN. It is
different from old ASRC module.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:48:42 +08:00
cc5cf63ec9 MLK-22239-3: ASoC: fsl_asrc: Support S24_3LE for m2m
Support S24_3LE for m2m with SDMA, but add constraint
for EDMA case, for EDMA don't support 3bytes copy.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:48:41 +08:00
c1484093fe MLK-21940-1: ASoC: fsl_asrc: Update mxc_asrc uapi
In order to support the new ASRC in i.MX815, we update the
user api file mxc_asrc.h.

The reason is that the new ASRC support more sample width, and
support endianness, sign, float format, iec958 format setting,
All these type can be expressed by snd_pcm_format_t type.

So we use the in(out)put_format to instead the in(out)put_word_width.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit b95c32c4d4)
2019-11-25 15:48:40 +08:00
68c724dca5 ASoC: fsl_asrc: Get dma channel from Front-End for p2p
Previously we get dma channel for p2p from Back-End, but the
channel maybe allocated already by Back-End platform driver.
that we switch to imx-pcm-dma-v2.

But if we get dma channel for p2p from Front-End then we don't
need to switch to imx-pcm-dma-v2 driver. this more formal

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:40 +08:00
442ad6fd0c ASoC: fsl_asrc: support multi power domain
support multi power domain

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:40 +08:00
c0815928c5 MLK-20613: ASoC: fsl_asrc: add limitation for non ideal ratio mode
for non ideal ratio mode, the clock rate should divide the sample rate
with no remainder, and the quotient should be less than 1024.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:39 +08:00
37baed62f6 MLK-18182: ASoC: fsl_asrc: increase the retry times
When 3 asrc pair are working in parallel, there will be
error log randomly

output DMA task timeout
fsl-asrc 2034000.asrc: Pair B: failed to process buffer: -62

The reason is that the initialization is not finished for
some pair, the prefill data is failed to be input in FIFO.

The patch is to increase the retry times to make sure that
initialization is success.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:39 +08:00
c630d62462 MLK-18076-2: ASoC: fsl_asrc: support S8 format for p2p
support S8 format for p2p

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: Fix rebase conflict ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:48:38 +08:00
cf1ce85c92 MLK-18076-1: ASoC: fsl_asrc_m2m: support input width with 8bit
support input data width with 8bit for m2m

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:36 +08:00
2c706419b3 MLK-20096: ASoC: fsl_asrc_m2m: fix noise issue for 8k5c to 176k5c conversion
Compare with imx6, the conversion of 8kHz 5channel to 176kHz is ok.
And compare the output we found that about every 48K bytes, there will be
additional data be added, which cause noise.

In this case, there will be two sg_nodes, for the maxmum output size exceed
the ASRC_MAX_BUFFER_SIZE, each size is ASRC_MAX_BUFFER_SIZE, it is 49152.
the value can't be exact divided by channel * word_with * watermark = 40.
So the EDMA can't finish the copy with correct size.

There is limitation of EMDA described in commit 3519b67ac0
("MLK-19151: ASoC: fsl_asrc: fix dma timeout issue for imx8qxp")

EDMA just copy 49120 bytes, there will 32 bytes wrong data.

According to this limitation, this commit is to change the maxburst to 1
for EDMA case, then EDMA can do what we expect correctly.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:35 +08:00
1562153cc8 MLK-13208: ASoC: fsl_asrc_m2m: change the return value for signal_pending
There is error log after suspend resume with asrc alsa plugin.

"fsl-asrc 2034000.asrc: Pair A: failed to process buffer: -16"

"asrc_pair_convert_s16: Convert ASRC pair 0 failed,
[0x989410][440][0x9895d0][1764]"

Which is caused by the return value is -EBUSY when signal_pending, in this
case we can use the -ERESTARTSYS to instead, that system will recall the
convert function after resume.

Fixes commit e1e9de8e93 ("MLK-10048-2: ASoC: fsl_asrc: change
the return value")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:35 +08:00
46bc9e9ca5 MLK-18979-2: ASoC: fsl_asrc: add initial check in resume
If the initialization is not finished, then we input data to
the FIFO will fail, which still cause the error

"output dma task timeout"

So we need to ad initial check in the resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:34 +08:00
e0e7942c70 MLK-18979-1: ASoC: fsl_asrc: add resume function for asrc_m2m
There will be "output DMA task timeout" after suspend and resume.
The reason is there is not enough data in the input FIFO.

In the fsl_asrc_start_pair function we initialize the FIFO with
zero data after pair is enabled, it looks like we add more data
to input FIFO. For example if the input buffer length is 100,
but the actual length is 100 + channel*4. so we need to do same
work in resume for the asrc pair is disabled in suspend, the
input FIFO is cleared.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:34 +08:00
9d607a7189 MLK-19151: ASoC: fsl_asrc: fix dma timeout issue for imx8qxp
In the imx8qxp, the DMA is EDMA, which require the buffer size
should be divided by burst size with no remainder, otherwise
the remainder is not transferred by EDMA, so the input buffer
is not consumed by ASRC, then there will be dma output timeout
issue. This behavior is different with SDMA.

This patch is to change the input burst size to be 1 to avoid
the issue, and refine the last_period_size for output buffer.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:33 +08:00
6e7c69f03b MLK-18874: ASoC: fsl_asrc: fix noise issue with 5 channel conversion
The dma_len is the size that how many data dma should transmit. As
the asrc use channel as unit, so the dma_len should also in channel unit.
Otherwise the output data is not align in channel, there will be noise.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
2019-11-25 15:48:33 +08:00
cc6fdf8653 MLK-18971: ASoC: fsl_asrc: fix record sound distortion issue
Fixes commit feb06839682c ("MLK-16839-1: ASoC: fsl_asrc: selec
a proper clock source from the clock list")

When inclk is INCLK_ASRCK1_CLK, the driver will config module
to be non ideal ration mode, But the divider should be less
than 1024 and exact division. otherwise there will be distortion.

If the divider larger than 1024 or it is not exact division, asrc
should switch to ideal ratio mode, which don't care about the
divider.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
2019-11-25 15:48:32 +08:00
3b433c19d3 MLK-18875: ASoC: fsl_asrc_m2m: refine the last period size
The output size of asrc for a dedicate input is uncertain.

For example, if the input size is 1k, the output ratio is
2, so the output size should be 2k. but the actual output
size is not 2k,  is less than 2k. if we set the dma size
to be 2k, the dma can't get enough data that can't finish
the transmission, then there will be

"output DMA task timeout"

So we need to set the dma size a proper value but we don't know
how many data less than expected. so we defined the last period
size for assumption of reduced size.

The last period size should not be too large, if it is large
there will be

"input DMA task timeout"

The reason is the output FIFO is full, which will block the
input data comsumption.

In this patch, the last period size is set to the difference
of configured buffer size and the expected output size, plus
a fix size.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
2019-11-25 15:48:32 +08:00
683763a08c MLK-18737: move 'pair_streams' to 'struct fsl_asrc_pair'
For multi p2p instance an ASRC device cannot be closed successfully
when two threads plays streams simultaneously on same ASRC device.
'pair_streams' variable shall be moved to 'struct fsl_asrc_pair'
for multi p2p instance in order to handle pair release properly.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:32 +08:00
de02517719 MLK-17410: ASoC: fsl_asrc: fix kernel panic in suspend resume
After ASRC convert, there will be kernel panic

[   54.365777] [<ffff000008636528>] regmap_mmio_read32le+0x8/0x18
[   54.371615] [<ffff00000862f004>] _regmap_bus_reg_read+0x14/0x20
[   54.377538] [<ffff000008630830>] _regmap_read+0x60/0xe8
[   54.382769] [<ffff000008630c30>] _regmap_update_bits+0xa0/0xf0
[   54.388606] [<ffff000008631be8>] regmap_update_bits_base+0x60/0x90
[   54.394794] [<ffff000008a275c4>] fsl_asrc_resume+0x74/0xa8
[   54.400287] [<ffff0000086226a8>] dpm_run_callback.isra.6+0x30/0x98
[   54.406468] [<ffff000008622b20>] device_resume+0x100/0x188
[   54.411958] [<ffff0000086239c8>] dpm_resume+0x100/0x218
[   54.417188] [<ffff000008623c9c>] dpm_resume_end+0x14/0x28
[   54.422594] [<ffff0000080fd990>] suspend_devices_and_enter+0x138/0x500
[   54.429124] [<ffff0000080fdfc0>] pm_suspend+0x268/0x2d8
[   54.434348] [<ffff0000080fcabc>] state_store+0x84/0xf8
[   54.439491] [<ffff0000083dfcac>] kobj_attr_store+0x14/0x28
[   54.444982] [<ffff000008254e58>] sysfs_kf_write+0x48/0x58
[   54.450383] [<ffff0000082541c8>] kernfs_fop_write+0xb0/0x1f8
[   54.456050] [<ffff0000081dc5c4>] __vfs_write+0x1c/0x100
[   54.461277] [<ffff0000081dd3cc>] vfs_write+0x9c/0x1b0
[   54.466332] [<ffff0000081de814>] SyS_write+0x44/0xa0
[   54.471295] [<ffff000008082f4c>] __sys_trace_return+0x0/0x4

The reason is that the power of subsystem is disabled in suspend
the register can't be accessed. so we need to call pm_runtime_force_suspend
and pm_runtime_force_resume in suspend and resume state.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:31 +08:00
740c0b6c74 MLK-16956: ASoC: fsl_asrc: fix error with S24_3LE format bitstream
The error is "aplay: pcm_write:2023: write error: Input/output error"

query the caps of dma, then update the hw parameters according
the caps. for EDMA can't support 24bit sample, but we didn't
add any constraint, that cause issues.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:31 +08:00
e71db44eb0 MLK-16839-1: ASoC: fsl_asrc: selec a proper clock source from the clock list
In internal ratio mode, when the clock rate can't be divided with no
remainder, The final convert ratio is not as expected, there is distortion
in output data.
So need to select a proper clock source for this mode, if can't find a good
clock source, then swith to ideal ratio mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:30 +08:00
5cfc86a07a MLK-16154: ASoC: fsl_asrc_m2m: fix crash issue with multi-instance
When open 2 instances of m2m, there is kernel dump. The reason is we
use the dev_set_drvdata to set drvdata for each instance, but each
instance share a same device, the result is drvdata will be changed
by other instances, then cause issue. so the dev_set_drvdata can't be
used, need to combine the pair data with file handler.

Fixes: 58ab1eb5b8c5 ("MLK-13945-3: ASoC: fsl_asrc: support two asrc
devices")

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:48:30 +08:00
77924f38da MLK-16007-2: ASoC: fsl_asrc: Enable automatic configuration for P2P
Use automatic selection of processing options and internal measured
ratio for P2P conversions.

The conversion done by ASRC depends on the IPG master clock frequency
that can have any value between 130MHz and 200MHz. The documentation
states that to support 10 channels with 192KHz sampling rate the
master clock frequency must be at least 160MHz.
When the master clock cannot be configured to faster frequencies the
ASRC can still convert the samples but it have to be configured to
automatically adjust the processing options and conversion ratio.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:29 +08:00
c6b54c908e MLK-16007-1: ASoC: fsl_asrc: Fix automatic mode configuration
Fix configuration for automatic selection of processing options and
internal measured ratio.

ASRC can automatically select its pre-processing and post-processing
options based on the frequencies it detects. To use this option the
two parameter registers ASR76K and ASR56K must be correctly configured
based on IPG clock frequency and the corresponding ATSx bits from the
ASRCTR register must be set.

When both the input sampling clock and the output sampling clock are
physically available, the rate conversion can work by configuring the
physical clocks. For this use case the ASRCTR:USRx and ASRCTR:IRDx
bits have to be configured as 1 and 0 respectively.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:48:28 +08:00
8290af4e12 MLK-15960-4: ASoC: fsl_asrc: refine pm runtime function
In imx8qm/imx8qxp, the power domain of IP is enabled when
pm_runtime_get_sync() is called, and disabled when pm_runtime
_put_sync() is called. when power domain is disabled, the value
of registers will lost, so we need to use the regcache_sync()
to restore the registers in fsl_asrc_runtime_resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:48:28 +08:00
9fb7266cc7 MLK-13945-3: ASoC: fsl_asrc: support two asrc devices
In imx8qm, there is two asrc devices, so using global structure
"miscdevice" will cause error. Each instance should have their
own structure.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:48:28 +08:00
add4029889 MLK-15042: ASoC: fsl_asrc: update supported format
The ASRC support 24 bit input width, but for S20_3LE the input width
is 20 bit, asrc will treat it as 24bit, which like a 24bit data shift
4 bit right, the result is the volume is lower than expected.
ASRC can't shift the 20bit data left 4 bit internally, so remove the
S20_3LE in supported list, add S24_3LE in supported list.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit e65a014efe)
2019-11-25 15:48:27 +08:00
e265086e8f MLK-15061-2: ASoC: fsl_asrc_m2m: fix asrc m2m can't work in imx8
Power domain need to be enabled when asrc m2m start to work, and
disabled when it stop.
Switch back to use the pm_runtime_get_sync and pm_runtime_put_sync
for which is removed in commit 1a3d82e08fa2 ("ASoC: fsl: refine
the asrc driver for imx8qm").

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:48:27 +08:00
ce70583b4f MLK-15061-1: ASoC: fsl_asrc_m2m: fix dma_map_sg issue for arm64
For arm64, the dma_map_sg and dma_unmap_sg need the device parameter,
otherwise, it will return error.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:48:26 +08:00
29668d659e MLK-14528: ASoC: sdma: Update period/segment max bytes (part 1)
Commit 665ced16cf ("MLK-10050 dma: imx-sdma: add support for sdma
memory copy") enforces maximum SDMA buffer descriptor length at 65532,
but doesn't update period_bytes_max or max_segment size in DMA drivers.

Thus, resulting in the following bug:

$ arecord -Dhw:0,0 -r 192000 -f S20_3LE -c 1 -d 10 audio192k20b1c.wav
imx-sdma: SDMA channel 5: maximum period size exceeded: 65534 > 65532

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
[ Aisheng: split rpmsg changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:48:26 +08:00
eb267cdcaa ASoC: fsl: refine the asrc driver for imx8qm
The clock source of ASRC in imx8qm is changed.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:48:26 +08:00
096ff09cc5 MLK-14679-2: ASoC: fsl_asrc: Add warning message
Add warning message for both divider of input clock and output clock
exceed the maximum value. which is useful for debugging.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:48:26 +08:00
d53e77a086 MLK-12771: ASoC: fsl_asrc: fix dma task timeout issue
The test case is one p2p playback + two m2m converter running
simultaneously. There are three root cause for this issue:

1. hw_free() of p2p may be called twice in the end, which cause
release twice of one pair, if another pair request is called between
this two release, there will be issue.

2. In m2m close(), the asrc_priv->pair[i] will be set NULL twice,
which is same issue as 1.

3. when output rate is more than eight multiple of input rate for m2m,
the last_period_size should be larger.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:48:25 +08:00
21859d28ff MLK-12794: ASoC: fsl_asrc: fix underrun issue when convert 192k to 96kHz.
The maximum divider of asrc clock is 1024, but there is no judgement
for this limitaion in driver, which may cause the divider setting not
correct.

When IDEAL_RATIO_RATE 200kHZ, the cost time of conversion from 192kHz
to 96kHz is 24ms every 1024 sample, but these sample's playback time
is 1024/96=11ms, so there will be underrun. So need to enlarge this RATE.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:48:25 +08:00
98ba60a173 MLK-12372: ASoC: fsl_asrc: fix dma task timeout after suspend/resume
commit 743cead0f8 is not a complete fix.
There is low possibility that this issue still occur.

Last commit add init_completion() in the suspend function, but if the
dma callback function is called after convert error, the complete is
done, the init_completion will not be called, so the complete state is
not correct in the next conversion.

This patch is to move init_completion to the beginning of conversion
to fix the issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:48:24 +08:00
54c70617c7 MLK-12202: ASoC: fsl_asrc_m2m: fix dma timeout after suspend/resume
In suspend function, the complete will be set to done in callback.
After resuming, the convert will not spend time to wait the complete.
which is a wrong complete.
So in suspend function, the complete need to be reinited for next convert.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:48:24 +08:00
299f7667db MLK-11942 ASoC: fsl_asrc_m2m: free pair after allocating m2m failed
free pair after allocating m2m failed. Reported by coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 237a35db5b48b78250a019f891d9d746c3411d49)
2019-11-25 15:48:23 +08:00
b89be81eda MLK-11915-12 ASoC: fsl_asrc_m2m: fix null check issue for variable m2m and pair
After allocating memory for m2m, we should null check for m2m instead of pair.

In fsl_asrc_close(), null-checking pair suggests that it may be null, but it
has already been dereferenced before the null check. pair will be alloceted
in fsl_asrc_open(), pair is null means that open dev file failed, and
close should not be called in user space. So remove null check for pair.

buf_len should not greater than ASRC_DMA_BUFFER_SIZE, otherwith dma buffer will
be overrun.

Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit b0dc15375b12b6c1bf46b9071b92267b827d8ce0)
2019-11-25 15:48:22 +08:00
5008702eea MLK-11915-11 ASoC: fsl_asrc_dma: check the return value for snd_pcm_hw_constraint_integer()
check the return value for snd_pcm_hw_constraint_integer().
Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 26f8fea617fcebd8835f660534a988c58b9f0517)
2019-11-25 15:48:22 +08:00
e524b2bcb4 MLK-11259-2: ASoC: fsl: enable ASRC p2p for ssi->wm8962 (part 2)
Enable ASRC p2p for ssi->wm8962, base on the new p2p script,
which support to select dualfifo for source/destination device.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
[ Aisheng: split imx-wm8962.c changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:48:22 +08:00
f54a93b477 MLK-10048-5: ASoC: fsl_asrc: underrun for playback 192k, 6ch p2p case.
For p2p output, the output divider should align with the output sample
rate, if use the Ideal sample rate, there will be a lot of overload, which
will cause underrun.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 5ab043f1a020ae8c3aeb3d91f6894bbd6a6ec147)
2019-11-25 15:48:21 +08:00
200a083afb MLK-11429-16: ASoC: fsl_asrc: Add delay after enabling ASRC p2p
cherry-pick below patch from imx_3.14.y
ENGR00307592 ASoC: fsl_asrc: Add delay after enabling ASRC p2p

When using ASRC p2p as a for-end with other back-end modules like ESAI,
it'd be safer to add 1ms delay, less might be futile for extreme cases,
after enabling ASRC so as to keep ASRC output FIFO with enough data to
content the DMA burstsize of back-ends and accordingly prevent underrun
that might happen to them.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
(cherry picked from commit c68c1874c07c30a3483eed70fb2abe82e19d1d20)
2019-11-25 15:48:21 +08:00
432bae15ee MLK-10048-4: ASoC: fsl_asrc: fix dma task timeout issue when use 3 instance
Merged from 49108fcf7b79ed77d34be33b53a3964b2ac27204
1. Watermark level in sdma use byte as its unit. but asrc driver use
word, there is mismatch between them. Here fix this issue and sdma can
work more efficiency.
2. Enlarge the larst_period_size, when use small size, for some case,
the dma task will timeout, because sdma has no much data for output.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 8a96e09e265294f396bd3af29b429e4b7bdff461)
2019-11-25 15:48:20 +08:00
b063e095e4 MLK-10048-3: ASoC: fsl_asrc: fix asrc crach when suspend/resume
merge 7e1a620a030d17f93fdd97d076f1cdd042e79337

The reason of crach is that some variables are not protected in
function mxc_asrc_suspend(), when suspend, there is possibility to
access one NULL pointer.
Refine the spin lock usage, add protecting for pair_hold.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit e90c73f8170bc929cff54b0478da0573e4e26c23)
2019-11-25 15:48:20 +08:00
16d07ad5f7 MLK-10048-2: ASoC: fsl_asrc: change the return value
Merge from c086d0151ee3e131b52bef96c5096d1ee603c852

Return value -ERESTARTSYS is not visible for user space according
to include/linux/errno.h. So use -EBUSY replace it.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 69d529646a610d8d1360bd116ceec1341aef4211)
2019-11-25 15:48:20 +08:00
6c061d1776 MLK-11398: ASoC: fsl_asrc: Add Memory to Memory support
cherry-pick below patch from v3.14.y:
ENGR00330403-4: ASoC: fsl_asrc: Add Memory to Memory support

ASRC M2M function is not able to put upstream due to its self-designed
ioctl protocol. So I just make a single patch for it and make it merge
into P2P driver as simply as possible.

The patch can only be maintained internally unless some one designs a
new protocol or implement the originally protocol by using some common
approach provided by Linux Kernel.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>

Fixed missing includes in 4.14 rebase

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:48:19 +08:00
3815ade25a mxc: hdmi-cec: Add imx6 hdmi cec driver
Add imx6 hdmi cec driver.
This patch forwards imx6 hdmi cec driver from imx_4.19.y kernel.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 15:48:17 +08:00
144797d672 driver: mfd: hdmi: Add hdmi core driver
Add imx6 hdmi code driver.
This patch forwards imx6 HDMI code driver from imx_4.19.y kernel.

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

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:48:15 +08:00
262ca4a0e5 mxc: IPU3: Fix not including uapi/linux/sched/types.h
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:48:14 +08:00
c2b8e1ef74 media: platform: mxc: output: Forward IPUv3 V4L2 output driver from imx_4.19.y
This patch forwards IPUv3 V4l2 output driver from imx_4.19.y kernel.

[ Liu Ying: remove unused get_jiffies(), resolve conflicts related to
            vb->ts, some ioctrls(vidioc_cropcap, vidioc_g_crop and
            vidioc_s_crop) and mxc_vout_template->device_caps ]

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:48:14 +08:00
bc77a44ba0 mxc: IPU3: Forward IPUv3 common driver from imx_4.19.y kernel
This patch forwards IPUv3 common driver from imx_4.19.y kernel.
This includs IPUv3 common, IPUv3 prefetch engine and VDOA support.

[ Liu Ying: Fixed a minor build warning for PRE driver. ]
Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:48:14 +08:00
2d4f90ebd9 MLK-21876-13 ipu: add uapi headfile for yocto build pass
Copied from 4.14.78 GA.
Module onwer could merge it when adding drivers code.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:48:14 +08:00
1d1042da18 imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:48:13 +08:00
d229e2c9b5 MLK-23000-1 mxc: mlb: fix kernel dump when use gen_pool_dma_alloc
If use dma pool when iram does not exist, the iram_pool will be NULL.
The previous version of lib/genalloc.c will check the pointer status
first. In 5.4, it will not check NULL pointer.
Therefore, add NULL check here.

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

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:48:11 +08:00
49dc991f89 MLK-22071-3 Document: mlb: add imx8qxp compatible string
Add imx8qxp compatible string for i.MX8 SoCs.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:48:10 +08:00
0e8db63334 MLK-15997 Document: mlb: add document for mlb
add document for mlb

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:48:10 +08:00
f150414008 mxc: mlb: fix interrupt rw lock dead lock
MLB has multiple lock calls rings, so this can be called from interrupt
calls at the same time resulting in:

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

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

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

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

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

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

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

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

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

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

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

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

(reported by coverity check)

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

Interrupt variable must be signed type.

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

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

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

Signed-off-by: Gao Pan <b54642@freescale.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 24e36b318a)
2019-11-25 15:48:04 +08:00
1f84465aec MLK-21876-15 mlb: add uapi headfile for yocto build pass
Copied from 4.14.78 GA.
Module onwer could merge it when adding drivers code.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:48:04 +08:00
7a059a09be sim: emvsim: add multi power domain support
Add multi power domain support for emvsim as it needs power domain both
SOC and Board level.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This patch adds driver to support EMVSIM module for imx8.

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

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

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

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

(cherry-picked from commit 8e237775cd)

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

This patch also adds comments to cold reset process.

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

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

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

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

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

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

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

Signed-off-by: Luwei Zhou <b45643@freescale.com>
(cherry picked from 3ac1ad5b2a68ecb052ccacca4ac7459ead04415e)
2019-11-25 15:47:50 +08:00
3e03bbc9a9 MLK-21876-16 sim: add uapi headfile for yocto build pass
Copied from 4.14.78 GA.
Module onwer could merge it when adding drivers code.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:49 +08:00
bcaa7c17aa LF-80:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:clear eos flag when output streamoff
if the eos flag is not clear after output streamoff,
it may cause firmware hang with multi instances

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:32 +08:00
81539672fd MLK-21876-12 vpu: add handro h1 headfile for Yocto build pass
Copied from 4.14.78 GA.
Module onwer could merge it when adding drivers code.

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

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

    media: vb2: drop VB2_BUF_STATE_REQUEUEING

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:27 +08:00
c5b08a52fe Add MU module for vpu dependence on QXP/QM
Add MU module:
drivers/soc/imx/Makefile
drivers/soc/imx/mu/Makefile
drivers/soc/imx/mu/mx8_mu.c
include/linux/mx8_mu.h

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:26 +08:00
ad751c3173 imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

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

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

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

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

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

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

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

check GPU MMU state to enable dummy draw fix only.

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

Check userLogical to avoid GPU kernel panic for error handling.

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

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

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

this problem is related with CMA migration for fragments,

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

can improve CTS and gpubench benchmarks on M850D.

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

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

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

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

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

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

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

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

drivers/mxc/gpu-viv/*

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

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

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

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

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

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

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

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:07 +08:00
a780e02ff3 gpu: fix access_ok build error
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:06 +08:00
d421c76cc1 MGS-4530-3 [#imx-1314] include dma-direct.h to fix gpu build for L4.19
error: implicit declaration of function ‘dma_to_phys’; did you mean ‘virt_to_phys’? [-Werror=implicit-function-declaration]
     page = phys_to_page(dma_to_phys(&Allocator->os->device->platform->device->dev, mdl_priv->physical));
                         ^
./include/asm-generic/memory_model.h:54:40: note: in definition of macro ‘__pfn_to_page’
 #define __pfn_to_page(pfn) (vmemmap + (pfn))
                                        ^~~
./include/asm-generic/memory_model.h:78:30: note: in expansion of macro ‘PHYS_PFN’
 #define __phys_to_pfn(paddr) PHYS_PFN(paddr)
                              ^~~~~~~~
./arch/arm64/include/asm/memory.h:255:41: note: in expansion of macro ‘__phys_to_pfn’
 #define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys)))
                                         ^~~~~~~~~~~~~
gc_hal_kernel_allocator_cma.c:237:12: note: in expansion of macro ‘phys_to_page’
     page = phys_to_page(dma_to_phys(&Allocator->os->device->platform->device->dev, mdl_priv->physical));
            ^~~~~~~~~~~~

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 15:47:06 +08:00
40cc89f4fc MGS-4530-2 disable busfreq-imx to fix L4.19 dash build
gc_hal_kernel_platform_imx.c:90:14: fatal error: linux/busfreq-imx.h: No such file or directory
 #    include <linux/busfreq-imx.h>

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 15:47:06 +08:00
30638182fd MGS-4530-1 add 6.2.4.p4 gpu driver for L4.19
add mxc config to include drivers/mxc/gpu-viv

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
2019-11-25 15:47:05 +08:00
4f8c3ce4ee imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:47:04 +08:00
36c3110ff9 Revert "jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()"
This reverts commit f2538f9993.

This patch causes the jffs2 failed to be written, which leads to several
storage test failed. This patch should be reverted in 5.4 release.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 15:47:00 +08:00
13d884a650 of: of_reserved_mem: Ensure cma reserved region not cross the low/high memory
Need ensure the cma reserved region not cross the low/high memory boundary
when using the dynamic allocation methond through device-tree, otherwise,
kernel will fail to boot up when cma reserved region cross how/high mem.

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:46:59 +08:00
3dcec0005a mm: Re-export ioremap_page_range
We need this in Jailhouse to map at specific virtual addresses, at
least for the moment.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 94bb285491a9a9e15c82c0761505b1073d6b7a47)
2019-11-25 15:46:59 +08:00
b808b78709 nand: raw: workaround for EDO high speed mode
Found issue for EDO high speed mode, set to low speed mode as a
workaround.

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 15:46:58 +08:00
591cc4604b cgroup/bfq: revert bfq.weight symlink change
There's some discussion on how to do this the best, and Tejun prefers
that BFQ just create the file itself instead of having cgroups support
a symlink feature.

Hence revert commit 54b7b868e8 and 19e9da9e86 for 5.2, and this
can be done properly for 5.3.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit cf8929885d)
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 15:46:58 +08:00
caa25172f6 cgroup: let a symlink too be created with a cftype file
This commit enables a cftype to have a symlink (of any name) that
points to the file associated with the cftype.

Signed-off-by: Angelo Ruocco <angeloruocco90@gmail.com>
Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 54b7b868e8)
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2019-11-25 15:46:58 +08:00
df3e8521e0 drivers/base: add sysfs entries for suppliers and consumers
Instead of scraping dmesg for messages such as 'Linked as a consumer to'
or 'Dropping the link to' export two new sysfs entries in the device
folder that list the consumer and supplier devices.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2019-11-25 15:46:57 +08:00
21187fcd08 net: readd skb_recycle()
Adding back skb_recycle() as it's used by the DPAA Ethernet driver.
This was removed from the upstream kernel because it was lacking users.

Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
2019-11-25 15:46:56 +08:00
7422980717 mailbox: imx: add support for imx v1 mu
There is a version 1.0 MU on i.MX7ULP platform.
One new version ID register is added, and it's offset is 0.
TRn registers are defined at the offset 0x20 ~ 0x2C.
RRn registers are defined at the offset 0x40 ~ 0x4C.
SR/CR registers are defined at 0x60/0x64.
Extend this driver to support it.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Suggested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
2019-11-25 15:46:54 +08:00
adecb130af dt-bindings: mailbox: imx-mu: add imx7ulp MU support
There is a version 1.0 MU on imx7ulp, use "fsl,imx7ulp-mu" compatible
to support it.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:54 +08:00
f85439634e mailbox: imx: Clear the right interrupts at shutdown
Make sure to only clear enabled interrupts keeping count
of the connection type.

Suggested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:53 +08:00
f8e849e46e mailbox: imx: Fix Tx doorbell shutdown path
Tx doorbell is handled by txdb_tasklet and doesn't
have an associated IRQ.

Anyhow, imx_mu_shutdown ignores this and tries to
free an IRQ that wasn't requested for Tx DB resulting
in the following warning:

[    1.967644] Trying to free already-free IRQ 26
[    1.972108] WARNING: CPU: 2 PID: 157 at kernel/irq/manage.c:1708 __free_irq+0xc0/0x358
[    1.980024] Modules linked in:
[    1.983088] CPU: 2 PID: 157 Comm: kworker/2:1 Tainted: G
[    1.993524] Hardware name: Freescale i.MX8QXP MEK (DT)
[    1.998668] Workqueue: events deferred_probe_work_func
[    2.003812] pstate: 60000085 (nZCv daIf -PAN -UAO)
[    2.008607] pc : __free_irq+0xc0/0x358
[    2.012364] lr : __free_irq+0xc0/0x358
[    2.016111] sp : ffff00001179b7e0
[    2.019422] x29: ffff00001179b7e0 x28: 0000000000000018
[    2.024736] x27: ffff000011233000 x26: 0000000000000004
[    2.030053] x25: 000000000000001a x24: ffff80083bec74d4
[    2.035369] x23: 0000000000000000 x22: ffff80083bec7588
[    2.040686] x21: ffff80083b1fe8d8 x20: ffff80083bec7400
[    2.046003] x19: 0000000000000000 x18: ffffffffffffffff
[    2.051320] x17: 0000000000000000 x16: 0000000000000000
[    2.056637] x15: ffff0000111296c8 x14: ffff00009179b517
[    2.061953] x13: ffff00001179b525 x12: ffff000011142000
[    2.067270] x11: ffff000011129f20 x10: ffff0000105da970
[    2.072587] x9 : 00000000ffffffd0 x8 : 0000000000000194
[    2.077903] x7 : 612065657266206f x6 : ffff0000111e7b09
[    2.083220] x5 : 0000000000000003 x4 : 0000000000000000
[    2.088537] x3 : 0000000000000000 x2 : 00000000ffffffff
[    2.093854] x1 : 28b70f0a2b60a500 x0 : 0000000000000000
[    2.099173] Call trace:
[    2.101618]  __free_irq+0xc0/0x358
[    2.105021]  free_irq+0x38/0x98
[    2.108170]  imx_mu_shutdown+0x90/0xb0
[    2.111921]  mbox_free_channel.part.2+0x24/0xb8
[    2.116453]  mbox_free_channel+0x18/0x28

This bug is present from the beginning of times.

Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:53 +08:00
81655e1fff mailbox: imx: change to arch_init()
Many module driver depends on rpmsg driver, need bring
mailbox driver probed to arch_init() level.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 15:46:53 +08:00
53379e62bf imx-mailbox: add state save and restore
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:52 +08:00
936c74516d MLK-22984 firmware: imx: imx-scu-irq: fix RCU complains after M4 partition reset
Use blocking_notifier_chain instead of atomic_notifier_chain, otherwise
below RCU complains would come out since unregister/register_virtio_device
()will issue mbox message (mbox_send_message() is blocking) again after
received M4 partition reset. Actually, no need atomic for notifier which
is so tough for user since this notifier is called in worker instead of
interrupt handler directly.

[  389.706645] i2c-rpmsg virtio0.rpmsg-i2c-channel.-1.2: i2c rpmsg driver is removed
[  389.767362] Wait for remote ready timeout, use first_notify.
[  389.774084] ------------[ cut here ]------------
[  389.778729] WARNING: CPU: 0 PID: 397 at kernel/rcu/tree_plugin.h:293 rcu_note_context_switch+0x34/0x338
[  389.788131] Modules linked in:
[  389.791195] CPU: 0 PID: 397 Comm: kworker/0:13 Not tainted 5.4.0-rc5-02977-g08f78722f07b #26
[  389.799633] Hardware name: Freescale i.MX8DXL Phantom MEK (DT)
[  389.805481] Workqueue: events imx_scu_irq_work_handler
[  389.810626] pstate: 20000085 (nzCv daIf -PAN -UAO)
[  389.815422] pc : rcu_note_context_switch+0x34/0x338
[  389.820307] lr : __schedule+0x98/0x548
[  389.824054] sp : ffff800013e7b770
[  389.827362] x29: ffff800013e7b770 x28: 0000000000000000
[  389.832679] x27: 0000000000000000 x26: 0000000000000100
[  389.837997] x25: ffff0000299f6e00 x24: ffff80001112fdc8
[  389.843312] x23: ffff800011f298c8 x22: ffff800011af4018
[  389.848628] x21: 0000000000000000 x20: ffff0000299f6e00
[  389.853945] x19: ffff00002afdd840 x18: ffff80001188ca18
[  389.859262] x17: 0000000000000000 x16: 0000000000000000
[  389.864579] x15: 0000000090008000 x14: ffff800012473000
[  389.869896] x13: ffff800012470000 x12: 0000000000000100
[  389.875212] x11: ffff0000297b9980 x10: 0000000000000001
[  389.880529] x9 : 0000000000000228 x8 : 0000000000000220
[  389.885846] x7 : 0000000000000035 x6 : ffff00002afd6418
[  389.891162] x5 : 0000000000002000 x4 : 0000000000002000
[  389.896479] x3 : 0000000000000000 x2 : ffff8000194dc000
[  389.901798] x1 : 0000000000000001 x0 : 0000000000000001
[  389.907115] Call trace:
[  389.909561]  rcu_note_context_switch+0x34/0x338
[  389.914094]  __schedule+0x98/0x548
[  389.917499]  schedule+0x40/0xe0
[  389.920643]  schedule_timeout+0x144/0x268
[  389.924659]  wait_for_completion_timeout+0x94/0x128
[  389.929543]  mbox_send_message+0x9c/0x120
[  389.933554]  imx_rpmsg_notify+0x5c/0x68
[  389.937397]  virtqueue_notify+0x20/0x50
[  389.941233]  rpmsg_probe+0x274/0x318
[  389.944811]  virtio_dev_probe+0x16c/0x228
[  389.948830]  really_probe+0xd4/0x308
[  389.952404]  driver_probe_device+0x54/0xe8
[  389.956507]  __device_attach_driver+0x80/0xb8
[  389.960868]  bus_for_each_drv+0x78/0xc8
[  389.964705]  __device_attach+0xd4/0x130
[  389.968549]  device_initial_probe+0x10/0x18
[  389.972735]  bus_probe_device+0x90/0x98
[  389.976574]  device_add+0x3f0/0x638
[  389.980067]  register_virtio_device+0xb0/0x108
[  389.984514]  imx_rpmsg_restore+0x120/0x170
[  389.988615]  imx_rpmsg_partition_notify+0x3c/0x60
[  389.993325]  notifier_call_chain+0x54/0x90
[  389.997424]  atomic_notifier_call_chain+0x38/0x58
[  390.002133]  imx_scu_irq_work_handler+0x80/0xd8
[  390.006669]  process_one_work+0x1e0/0x358
[  390.010681]  worker_thread+0x40/0x488
[  390.014349]  kthread+0x118/0x120
[  390.017580]  ret_from_fork+0x10/0x18
[  390.021157] ---[ end trace 7205c5eaadacce06 ]---
[  390.025926] virtio_rpmsg_bus virtio0: rpmsg host is online

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:50 +08:00
7472da7424 firmware: imx: keep HDMI power domains always on
firmware running in hdmi subsystem,
the power domains of hdmi should be always on.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 15:46:50 +08:00
faa4898632 firmware: imx: make sure MU irq can wake up system from suspend mode
IRQF_NO_SUSPEND flag is set for MU IRQ of IPC work, but with this
flag set, IRQD_WAKEUP_ARMED flag will NOT be set during
suspend_device_irq() phase, then when MU IRQ arrives, it will NOT
wake up system from suspend.

To fix this issue, pm_system_wakeup() is called in general MU IRQ
handler to make sure system can be waked up when MU IRQ arrives.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:46:49 +08:00
255d962ee5 firmware: imx: scu: change init level to subsys_initcall_sync
Change firmware init level to subsys_initcall_sync to ensure it's
probed before most devices to avoid unneccesary defer probe.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:49 +08:00
60175674c8 firmware: imx: scu: intialization rx_size before sending cmd
intialization rx_size before sending cmd

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:49 +08:00
7d1c3295eb firmware: imx: remove unused types.h
types.h has been moved into rsrc.h

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:49 +08:00
f79cbde3c1 firmware: imx: move sc ctrl into dt-binding headfile
move sc ctrl into dt-binding headfile which may be used by dts file.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:48 +08:00
ba18f61caf dt-bindings: firmware: imx: add scu clock type IDs
Add scu clock type IDs

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:48 +08:00
db20decd98 firmware: imx: increase scu timeout
When system loading is high, we can met some command timeout
issue occasionaly, so increase the timeout to a more safe value.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:47 +08:00
4221d38de6 firmware: imx: scu-pd: add mipi lvds1 power domains
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:47 +08:00
a72c36c599 firmware: imx: always export scu symbols 2019-11-25 15:46:46 +08:00
d50867a97b pinctrl: s32v234: Add ethernet pins
Copy definitions from ALB v4.19.31_bsp23.0_rc2

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:46:42 +08:00
a3fc2110a4 dt-bindings: pinctrl: s32v234: Initial enet pad support
Copy definitions from ALB v4.19.31_bsp23.0_rc2

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:46:41 +08:00
9cee2db313 dt-bindings: pinctrl: s32v234: Add uSDHC pin group
Add pinctrl group for uSDHC PAD configurations in SIUL2.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 15:46:40 +08:00
4ee01aa5fe pinctrl: Add uSDHC pins to S32V234 driver
Prepare uSDHC support for S32V234 by defining the necessary IMCR PADs in
the pinctrl driver.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Costin Carabas <costin.carabas@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 15:46:40 +08:00
bfc7bd1fab dt-bindings: pinctrl: s32v234: Add UART pin groups
Add pinctrl groups for UART0 and UART1 PAD configurations in SIUL2.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Catalin Udma <catalin-dan.udma@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 15:46:40 +08:00
518093b0a2 pinctrl: Add UART pins to S32V234 driver
Prepare UART support for S32V234 by defining the necessary IMCR PADs in
the pinctrl driver.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Costin Carabas <costin.carabas@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 15:46:39 +08:00
ca4e90d819 pinctrl: Add pinmuxing driver for S32V234
Add basic support for S32V234 SIUL2 pin controller, based on i.MX model.

Definitions of MSCR PADs, which are used for I/O (MSCR < 512), were added.
Definitions of IMCR (input only) PADs (MSCR >= 512), corresponding to
specific peripherals like ENET, I2C, UART or uSDHC are going to be added
along with the drivers which need them.

Add configurations for specific S32 SoC selection and pinmuxing driver.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Costin Carabas <costin.carabas@nxp.com>
Signed-off-by: Nica Dan <dan.nica@nxp.com>
Signed-off-by: Ghennadi Procopciuc <Ghennadi.Procopciuc@nxp.com>
Signed-off-by: Matthew Nunez <matthew.nunez@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 15:46:39 +08:00
fbc2f71123 arm64: Introduce config for S32
Add configuration option for the NXP S32 platform family in
Kconfig.platforms. For starters, the only SoC supported will be Treerunner
(S32V234), with a single execution target: the S32V234-EVB (rev 29288)
board.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
(cherry picked from commit 3d4e0158c1)
2019-11-25 15:46:38 +08:00
6ad9a554a1 dt-bindings: pinctrl: Add SIUL2 definitions
Add device tree bindings documentation and useful definitions for SIUL2 pin
controller, which is found on the S32V234 SoC.

Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Ghennadi Procopciuc <Ghennadi.Procopciuc@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
2019-11-25 15:46:38 +08:00
796ad640d7 MLK-19048: pinctrl: add defer probe check for pinctrl setting assertion
Pinctrl support of a device tree property "pinctrl-assert-gpios"
under client device node to select function at a board level pin
multiplexer. The pin route is controlled by a GPIO or i2c/spi expander
GPIO.

For i2c/spi expander GPIO, it may be loaded after client device that
set "pinctrl-assert-gpios" property in devicetree. Then the client device's
pin function doesn't work.

So it should add defer probe check for the GPIO pin.

Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:46:37 +08:00
dc81f006fb MLK-11749: pinctrl: support pinctrl setting assertion via gpios
It's pretty common that on some reference design or validation boards,
one pin could be used by two devices on board, and the pin route is
controlled by a GPIO.  So to assert the pin for given device, not only
the pinmux controller in SoC needs to be set up properly but also the
GPIO needs to be pulled up/down.

The patch adds support of a device tree property "pinctrl-assert-gpios"
under client device node.  It plays pretty much like a board level pin
multiplexer, and steers the pin route by controlling the GPIOs.  When
client device has the property represent in its node, pinctrl device
tree mapping function will firstly pull up/down the GPIOs to assert the
pins for the device at board level.

[shawn.guo: cherry-pick commit e5a718edab82 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:46:37 +08:00
9571794eaf MLK-9723-3: include: imx6q-iomuxc-gpr: add bit description for MQS
Add MQS's bit description in gpr header file.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 1e576de4b46a0fadd1c8df7f08229ac759e765f5)
[ Aisheng: fix build error ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:36 +08:00
7c8a2f7028 pinctrl: imx8qxp: add GPIORHB pad
add GPIORHB pad

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:46:36 +08:00
3c6696099f gpio : mpc8xxx : ls1088a/ls1028a edge detection mode bug fixs.
On these boards, the irq_set_type must point one valid function pointer
that can correctly set both edge and falling edge.

Signed-off-by: Song Hui <hui.song_1@nxp.com>
2019-11-25 15:46:33 +08:00
c9b816b363 gpio: mpc8xxx: Don't overwrite default irq_set_type callback
The per-SoC devtype structures can contain their own callbacks that
overwrite mpc8xxx_gpio_devtype_default.

The clear intention is that mpc8xxx_irq_set_type is used in case the SoC
does not specify a more specific callback. But what happens is that if
the SoC doesn't specify one, its .irq_set_type is de-facto NULL, and
this overwrites mpc8xxx_irq_set_type to a no-op. This means that the
following SoCs are affected:

- fsl,mpc8572-gpio
- fsl,ls1028a-gpio
- fsl,ls1088a-gpio

On these boards, the irq_set_type does exactly nothing, and the GPIO
controller keeps its GPICR register in the hardware-default state. On
the LS1028A, that is ACTIVE_BOTH, which means 2 interrupts are raised
even if the IRQ client requests LEVEL_HIGH. Another implication is that
the IRQs are not checked (e.g. level-triggered interrupts are not
rejected, although they are not supported).

Fixes: 82e39b0d85 ("gpio: mpc8xxx: handle differences between incarnations at a single place")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2019-11-25 15:46:33 +08:00
7291eb596c gpio/mpc8xxx: change irq handler from chained to normal
More than one gpio controllers can share one interrupt, change the
driver to request shared irq.

While this will work, it will mess up userspace accounting of the number
of interrupts per second in tools such as vmstat.  The reason is that
for every GPIO interrupt, /proc/interrupts records the count against GIC
interrupt 68 or 69, as well as the GPIO itself.  So, for every GPIO
interrupt, the total number of interrupts that the system has seen
increments by two.

Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@nxp.com>
Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Song Hui <hui.song_1@nxp.com>
2019-11-25 15:46:31 +08:00
54b0c2f928 MLK-22733 gpio: mxc: use platform_get_irq_optional() to avoid error message
Use platform_get_irq_optional() to avoid error message for the
optional irq.

Fixes: 7723f4c5ec ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:46:31 +08:00
d0df73dda7 gpio: pca953x: no need to do regcache sync without vcc regulator
If device node don't specify the vcc regulator that means the
regulator maybe always on, so it don't need to do regcache sync
after system resume back.

The patch doesn't change other code logical.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:46:30 +08:00
f36f3ea58a MLK-11293: gpio: pca953x: add device_reset() call
The pca953x type of devices, e.g. max7310, may have a reset which needs
to be handled to get the device start working.  Add a device_reset()
call for that, and defer the probe if the reset controller for that is
not ready yet.

The patch merge below two commits:
1a5c743f463f("MLK-11293: gpio: pca953x: add device_reset() call")
7500d014297a("MLK-13773 gpio: pca953x: correct device_reset() return
	      value check on kernel 4.1")

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:46:30 +08:00
982fb844da gpio: mxc: Add PAD wakeup support for SoCs with SCU
This patch enables gpio pin's pad wakeup function which
is supported by SCFW, with pad wakeup enabled, GPIO's
power is no need to be enabled after suspend, hence
save a sub-system's power.

To enable pad wakeup, dtb needs to provide pad wakeup
number for each gpio port, and each pin has to provide
<pin_id, type, line>, they should be inside each gpio node,

To enable pad wakeup, dtb needs to provide pad wakeup
number for each gpio port, and each pin has to provide
<pin_id, type, line>, they should be inside each gpio node,
this is for calling SCFW APIs to enable/disable pad wakeup,
example of adding GPIO4_22 pad wakeup in dtb:

&lsio_gpio4 {
    /* total pad wakeup number in gpio4 */
    pad-wakeup-num = <1>;
    /* SC_P_USDHC1_CD_B, SC_PAD_WAKEUP_LOW_LVL, LINE 22 */
    pad-wakeup = <27 4 22>;
};

Pad wakeup will be enabled after GPIO port suspend, and
once any pad wakes up system, gpio driver will get the
wakeup line and handles the event during noirq resume
phase.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:46:29 +08:00
6f7fccc17f MLK-10449-1: 74x164: Add new property registers-default
For some platform such as imx7D SDB, one pin of 74x164 to
control all peripheral power supply(PERI_3V_EN).
The pin should keep in high voltage level when 74x164 loading,
otherwise the module depend on PERI_3V3 will lose power.
So add new property registers-default into 74x164 driver.

Signed-off-by: Sandor Yu <R01008@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 61fe7af7e47dd8bf6acc91ceabd9e660d28de28a)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:46:29 +08:00
056c182863 gpio: imx-rpmsg: add gpio interrupt chip support
Add gpio interrupt chip support that only support wakeup feature
by M4 core.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:46:29 +08:00
f3462feb1f 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.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:46:28 +08:00
5d8768625f MLK-19251-01 gpio: max732x: add output IO default voltage set
Add output IOs defalut voltage set in device tree by add property like:
    out-default = /bits/ 16 <mask val>;

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:46:28 +08:00
01f989853e MLK-17400-02 gpio: max732x: add device reset support
Add device reset for max732x driver.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:46:27 +08:00
a4c08f327f i2c: imx: fix system hang due to access i2c registers without clock
Currently, i2c_imx_bus_busy in i2c_imx_xfer is called before
pm_runtime_get which means the clocks are still not enabled.
This will cause a hang on IMX as IMX requires accessing registers
with clocks.

So let's change the order to ensure the clocks are enabled before
accessing registers. This is also a more safe way to access registers,
suppose shouldn't affect other platforms.

Fixes: 4a6ebf1c125c ("i2c: imx: add workaround for erratum ERR010027")
Reviewed-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:23 +08:00
5fa8c422a1 i2c: imx: get rid of CONFIG_ARCH_LAYERSCAPE
We can't use CONFIG_ARCH_LAYERSCAPE for one Image multiple platforms
support.

Reviewed-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:23 +08:00
90b29e7b9c i2c: imx: implement bus recovery with gpio for Layerscape
Based on the I2C specification, if the data line (SDA) is stuck low,
the master should send nine clock pulses. The I2C slave device that
held the bus low should release it sometime within those nine clocks.

Because pinctrl is not supported on Layerscape, current bus recovery
is not avalible for Layerscape. This patch uses an open drain GPIO
pin to connect to the IICx_SCL to drive nine clock pulses to unlock
the I2C bus.

Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
2019-11-25 15:46:22 +08:00
60d402959a i2c: imx: add workaround for erratum ERR010027
ERR010027: Attempting a start cycle while the bus is busy may
generate a short clock pulse.

Software must ensure that the I2C BUS is idle by checking the
bus busy before switching to master mode and attempting a Start
cycle.

Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
2019-11-25 15:46:22 +08:00
e8b8f8761f MLK-20368 i2c-imx: Coverity: fix divide by zero warning
"i2c_clk_rate / 2" might be zero when the i2c_clk_rate gets the clock is
0 or 1, so add a judgment to avoid the denominator is equal to 0.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
[Arul: Add support to check return value everywhere in the driver]
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>

Signed-off-by: Shrikant Bobade <Shrikant_Bobade@mentor.com>
(cherry picked from commit d382de595bffc0975ab7c0582e08dd4f7afc0c1a)
(cherry picked from commit 456caa9ba2)
2019-11-25 15:46:21 +08:00
873430408f MLK-20773 i2c-imx: add a limit of maximum transfer speed for imx7d
According the e7805 in Errata, the SCK low level period should be less
than 1.3us.

The other series platform use this same IP can match the errata, and
ensure the low level period longer than 1.3us when the speed set to
400KHz. However, only at imx7d platform, the low level period is less
than 1.3us in the same situation.

Therefore, limit the maximum transfer speed to 384KHz when probe at
imx7d platform.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 19f553846e872b5c379b37ed029132b79566cab0)
(cherry picked from commit 5d35540781)
2019-11-25 15:46:21 +08:00
3972bc5c12 MLK-16203 enable runtime pm of i2c temporary when do system suspend
When we do system suspend, the runtime pm will be disabled, but we need
to control the PMIC to power on/off the regulator, if the runtime pm is
disabled, if will failed to request runtime wakeup. So data transfer will
failed.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 93adab7140)
2019-11-25 15:46:20 +08:00
ad5de9a31c MLK-11403: I2C: imx: restore pin setting for i2c
restore pin setting for i2c in suspend/resume

Signed-off-by: Gao Pan <gaopan@freescale.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 42b5aa1d72)
2019-11-25 15:46:19 +08:00
07b4214f92 MLK-10893: i2c: imx: add irqf_no_suspend
The i2c irq is masked when pcie starts a i2c transfer process
during noirq suspend stage. As a result, i2c transfer fails.
To solve the problem, IRQF_NO_SUSPEND is added to i2c bus.

Signed-off-by: Gao Pan <b54642@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit d21259d913)
2019-11-25 15:46:19 +08:00
d13a60151f MLK-16220 lpi2c: imx8: improve i2c driver probe priority
use subsys_initcall for i2c driver to improve i2c driver probe priority

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
(cherry picked from commit 3661eef81a)
(cherry picked from commit 9c867985d2)
2019-11-25 15:46:19 +08:00
14b1ee1706 MLK-21060 i2c: lpi2c: Fix clk fetch
During porting commit ede264acf0 ("MLK-14982-1 imx8: lpi2c: add ipg
clk for lpi2c driver") which replaced the single clk
with clk_ipg and clk_per was skipped.

Part of the code was later added in commit 96dbdd8c3d0b ("MLK-16713 i2c:
imx-lpi2c: add runtime pm support") except the "clk" field was kept and
clk_get calls were not updated.

Fix imx7ulp boot by fetching both clocks.

Fixes: 96dbdd8c3d0b ("MLK-16713 i2c: imx-lpi2c: add runtime pm support")

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 1b9c92f344)
2019-11-25 15:46:19 +08:00
c846995d43 MLK-17426 imx: lpi2c: add debug message when i2c peripheral clk doesn't work
add debug message when i2c peripheral clk rate is 0, then
directly return -EINVAL.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Reviewed-by: Andy Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 1e6707bb5e)
2019-11-25 15:46:18 +08:00
96586cb843 MLK-17290-02 i2c: imx-lpi2c: manage irq resource request/release in runtime pm
Manage irq resource request/release in runtime pm to save irq domain's
power.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Tested-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit e1aa13df4b)
2019-11-25 15:46:18 +08:00
c690e3c3d6 MLK-16713 i2c: imx-lpi2c: add runtime pm support
- Add runtime pm support to dynamicly manage the ipg and per clocks.
- Put the suspend to suspend_noirq.
- Call .pm_runtime_force_suspend() to force runtime pm suspended
  in .suspend_noirq().

BuildInfo:
  - SCFW 88456c73, IMX-MKIMAGE 06bc2767, ATF a438801
  - U-Boot 2017.03-imx_v2017.03_4.9.51_imx8_beta1+g7953d47

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>

During 4.14 rebase added pm_runtime_get_sync/pm_runtime_put around
the reading of LPI2C_PARAM.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 31cc4be3e8)
2019-11-25 15:46:17 +08:00
99f3c847cf MLK-14393 i2c: imx-lpi2c: directly retrun ISR when detect a NACK
A NACK flag in ISR means i2c bus error. In such codition,
there is no need to do read/write operation. It's better
to return ISR directly and then stop i2c transfer.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
(cherry-pick from 839d59e48b6fdbd882776a48a88ce26ff14d8b86)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 3d05274613)
2019-11-25 15:46:16 +08:00
815085e823 i2c: rpmsg-imx: add defer probe for rpbus
Add defer probe when rpbus probe, so if the rpmsg channel is not
created, the rpbus will try to probe later.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 15:46:16 +08:00
f2b8850526 MLK-21140 i2c: rpmsg: ensure received bus_id and addr is same as sent
For some chips may need long time to get the response from M4 sometimes,
enlarge timeout to 500ms.

Add a judgement to check if the received data is the current transfer
wanted.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 222e201b52)
(cherry picked from commit 6cfc8578cc)
2019-11-25 15:46:15 +08:00
9220d6066a MLK-21023 i2c: rpmsg-imx: add mutex lock when transfer i2c messages
I2c_lock_bus function in i2c-core-base will not stop the transfer to
different devices on different buses at the same time.

Since the multiple rpmsg i2c buses share one rpmsg channel, so it has to
add mutex to protect rpmsg resource accessing.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit d592afe901)
(cherry picked from commit 44622ff8c8)
2019-11-25 15:46:14 +08:00
43fea2b3b2 MLK-20993 i2c: rpmsg: add a BUG_ON to catch alias id issue
The alias ID must be defined in device tree, because
that will be used as BUS ID to Cortex M4. If the alias ID
not defined, linux kernel will automatically allocate one
ID which might not be the same number used in Cortex M4 and
Cortex M4 will not send msg to I2C controller.

So let's add BUG_ON to catch issue as earlier as possible to avoid
wasting efforts.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit b9ff203550)
(cherry picked from commit 8e509705dd)
2019-11-25 15:46:14 +08:00
b927082852 MLK-20940-1 i2c: busses: Add virtual i2c driver based on rpmsg
Add virtual i2c driver to send SRTM i2c messages to M4.
Each virtual I2C bus has a specal bus id, which is abstracted by M4.
Each SRTM message include a bus id for the bus which the device is on.

Virtual i2c rpmsg bus will bind rpbus nodes with compatible string
"fsl,i2c-rpbus". And "rpmsg-i2c-channel" will probe only one rpmsg
channel for all rpbuses.

This virtual i2c driver depends on CONFIG_I2C and CONFIG_RPMSG.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 9feeac93a7)
(cherry picked from commit 379ab8392e)
2019-11-25 15:46:13 +08:00
9955e666a9 MLK-16095-01 i2c: mux: pca954x: add i2c bus switch PCA9646 chip support
Add i2c bus switch PCA9646 chip support, which 2-wire bus switch
and buffered 4-channel.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:46:13 +08:00
3aa441cd89 MLK-13638-4 regulator: fixed: add system pm routines for pinctrl
At some systems, the pinctrl setting will be lost or needs to
set as "sleep" state to save power consumption. So, we need to
configure pinctrl as "sleep" state when system enters suspend,
and as "default" state after system resumes. In this way, the
pinctrl value can be recovered as "default" state after resuming.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:46:09 +08:00
341dbbc673 regulator: fixed: add off-on-delay
Depends on board design, the gpio controlling regulator may
connects with a big capacitance. When need off, it takes some time
to let the regulator to be truly off. If not add enough delay, the
regulator might have always been on, so introduce off-on-delay to
handle such case.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1572311875-22880-3-git-send-email-peng.fan@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit f7907e57ae)
2019-11-25 15:46:08 +08:00
13598d5068 dt-bindings: regulator: fixed: add off-on-delay-us property
When disabling a fixed regulator, it may take some time to let the
voltage drop to the expected value, such as zero. If not delay
enough time, the regulator might have been always enabled.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1572311875-22880-2-git-send-email-peng.fan@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 96da2d9c90)
2019-11-25 15:46:08 +08:00
32e5e6175b mfd: max17135: fix kernel warning at boot time when max17135 is not detecteded
in 5451781dad commit, it added the check that
the regulator need to be disabled before calling regulator_put().
If not do so, the kernel will print warning message as below.

To fix this, need to disable regulator before probe function return if this
PMIC is not found. regulator_put() will be called when probe fails in this case
as devm_regulator_get() already called in probe function.

[    0.269916] i2c i2c-2: Max17135 PMIC not found!
[    0.270004] ------------[ cut here ]------------
[    0.270145] WARNING: CPU: 0 PID: 1 at drivers/regulator/core.c:2039 _regulator_put.part.4+0x100/0x120
[    0.270166] Modules linked in:
[    0.270196] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.3.0-rc3-next-20190809-02777-g23dc3ed #22
[    0.270214] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[    0.270250] [<c0112868>] (unwind_backtrace) from [<c010cd9c>] (show_stack+0x10/0x14)
[    0.270281] [<c010cd9c>] (show_stack) from [<c0d26ad4>] (dump_stack+0xd8/0x110)
[    0.270310] [<c0d26ad4>] (dump_stack) from [<c01362c4>] (__warn.part.3+0xa8/0xe8)
[    0.270335] [<c01362c4>] (__warn.part.3) from [<c013645c>] (warn_slowpath_null+0x40/0x4c)
[    0.270361] [<c013645c>] (warn_slowpath_null) from [<c05e6520>] (_regulator_put.part.4+0x100/0x120)
[    0.270385] [<c05e6520>] (_regulator_put.part.4) from [<c05e656c>] (regulator_put+0x2c/0x3c)
[    0.270414] [<c05e656c>] (regulator_put) from [<c06dce90>] (release_nodes+0x1ac/0x1f8)
[    0.270444] [<c06dce90>] (release_nodes) from [<c06d8968>] (really_probe+0x104/0x340)
[    0.270467] [<c06d8968>] (really_probe) from [<c06d8d50>] (driver_probe_device+0x84/0x194)
[    0.270492] [<c06d8d50>] (driver_probe_device) from [<c06d6e44>] (bus_for_each_drv+0x7c/0xc4)
[    0.270516] [<c06d6e44>] (bus_for_each_drv) from [<c06d87e8>] (__device_attach+0xcc/0x140)
[    0.270539] [<c06d87e8>] (__device_attach) from [<c06d7b00>] (bus_probe_device+0x88/0x90)
[    0.270563] [<c06d7b00>] (bus_probe_device) from [<c06d49d0>] (device_add+0x608/0x754)
[    0.270591] [<c06d49d0>] (device_add) from [<c088c4a0>] (i2c_new_client_device+0x12c/0x20c)
[    0.270615] [<c088c4a0>] (i2c_new_client_device) from [<c088c588>] (i2c_new_device+0x8/0x14)
[    0.270641] [<c088c588>] (i2c_new_device) from [<c088f5e0>] (of_i2c_register_devices+0x90/0x110)
[    0.270666] [<c088f5e0>] (of_i2c_register_devices) from [<c088c950>] (i2c_register_adapter+0x148/0x3ec)
[    0.270691] [<c088c950>] (i2c_register_adapter) from [<c0892b24>] (i2c_imx_probe+0x37c/0x830)
[    0.270719] [<c0892b24>] (i2c_imx_probe) from [<c06dac38>] (platform_drv_probe+0x48/0x98)
[    0.270747] [<c06dac38>] (platform_drv_probe) from [<c06d8a40>] (really_probe+0x1dc/0x340)
[    0.270773] [<c06d8a40>] (really_probe) from [<c06d8d50>] (driver_probe_device+0x84/0x194)
[    0.270797] [<c06d8d50>] (driver_probe_device) from [<c06d9044>] (device_driver_attach+0x58/0x60)
[    0.270821] [<c06d9044>] (device_driver_attach) from [<c06d90a4>] (__driver_attach+0x58/0xd0)
[    0.270844] [<c06d90a4>] (__driver_attach) from [<c06d6d70>] (bus_for_each_dev+0x70/0xb4)
[    0.270867] [<c06d6d70>] (bus_for_each_dev) from [<c06d7d9c>] (bus_add_driver+0x198/0x1d0)
[    0.270890] [<c06d7d9c>] (bus_add_driver) from [<c06d9d30>] (driver_register+0x74/0x108)
[    0.270916] [<c06d9d30>] (driver_register) from [<c0103078>] (do_one_initcall+0x80/0x338)
[    0.270946] [<c0103078>] (do_one_initcall) from [<c1301214>] (kernel_init_freeable+0x2fc/0x3d8)
[    0.270973] [<c1301214>] (kernel_init_freeable) from [<c0d3f59c>] (kernel_init+0x8/0x110)
[    0.270997] [<c0d3f59c>] (kernel_init) from [<c01010b4>] (ret_from_fork+0x14/0x20)
[    0.271015] Exception stack(0xec0e9fb0 to 0xec0e9ff8)
[    0.271038] 9fa0:                                     00000000 00000000 00000000 00000000
[    0.271059] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    0.271077] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    0.271094] irq event stamp: 70901
[    0.271125] hardirqs last  enabled at (70909): [<c019be00>] console_unlock+0x418/0x5f4
[    0.271149] hardirqs last disabled at (70916): [<c019ba70>] console_unlock+0x88/0x5f4
[    0.271173] softirqs last  enabled at (69156): [<c01024e4>] __do_softirq+0x2c4/0x514
[    0.271198] softirqs last disabled at (68881): [<c013da4c>] irq_exit+0x100/0x188
[    0.271268] ---[ end trace 579e47ca40f2be36 ]---

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 15:46:07 +08:00
f5c206b539 MLK-13470 mfd: max17135: export symbols to fix build error as a module
export symbols to fix build error as a module:

ERROR: "max17135_reg_read" [drivers/hwmon/max17135-hwmon.ko] undefined!

Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
Acked-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 15:46:07 +08:00
72eceaad82 MLK-13982: 4.9 rebase: EPDC does not work
The Linux kernel regulator core implementation does not accept negative
voltage values; all negative values are treated as errors.

The problem with the EPDC is that the panel uses a negative voltage
regulator which fails to be enabled by the regulator core. This issue has
slipped up until the 4.9 rebase because the voltage range [min, max] was
checked against only when min = max. This has been fixed in 4.9, resulting
in errors in the VCOM regulator driver.

The fix is to use the negative values when communicating with the hardware,
but send only positive values to the regulator core.

This patch sends the absolute value to the regulator core and transforms
the received value (from the regulator core) to negative one before sending
it to hardware.

Fix device tree to deal with negative voltage regulator values by setting
min_value = -real_max_value and vice versa. Boards affected:
- imx6dl-sabresd
- imx6ull-14x14-ddr3-arm2
- imx7d-12x12-lpddr3-arm2
- imx7d-sdb
- imx6sll-evk
- imx6sl-evk
- imx6sll-lpddr3-arm2

Signed-off-by: Cristina Ciocan <cristina-mihaela.ciocan@nxp.com>
[Arul: Fix merge conflicts]
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>

[Robby: split original patch to driver and dts part. this is driver part.]
Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 15:46:07 +08:00
d562e283fa MLK-11908 mfd: MAX17135: don't free i2c device client
i2c device client shouldn't be freed by i2c device driver, there have
problems in below cases:
- one device match to different drivers, the second matched driver will
  cannot access i2c device client if it is freed by the first matched
  driver.
- one module driver insmod: the first insmod fail free client due to system
  low memory, after kswapd system free pages and has enough free pages, the
  second insmod will cause match failed.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:46:06 +08:00
6d06039776 hwmon: max17135: Added linux/mod_devicetable.h
This patch added linux/mod_devicetable.h to fix the compilation error.

drivers/hwmon/max17135-hwmon.c:57:40: error: array type has incomplete element type ‘struct platform_device_id’
 static const struct platform_device_id max17135_sns_id[] = {
                                        ^~~~~~~~~~~~~~~
drivers/hwmon/max17135-hwmon.c:57:40: warning: ‘max17135_sns_id’ defined but not used [-Wunused-variable]
scripts/Makefile.build:303: recipe for target 'drivers/hwmon/max17135-hwmon.o' failed
make[2]: *** [drivers/hwmon/max17135-hwmon.o] Error 1

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:46:06 +08:00
16d0d9837e MLK-11556-1 pmic: max17135: add hwmon, mfd and regulator drivers for this pmic
Add PMIC 'MAX17135' module drivers to 4.1.y kernel. These are necessary
to supply power for E-ink panel display functions.

Signed-off-by: Robby Cai <r63905@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:46:05 +08:00
baddd42022 regulator: pf1550-regulator-rpmsg: check rpmsg channel is ready
Return EPROBE_DEFER if rpmsg channel is not ready.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 15:46:05 +08:00
f1e48a3e58 regulator: pf1550-regulator-rpmsg: add pf1550 rpmsg driver
Add pf1550 rpmsg driver for i.mx7ulp-evk.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 15:46:04 +08:00
17fc5a742b LF-44 rpmsg: imx: add the rpmsg tty demo
Add the rpmsg tty demo for iMX AMP platforms.
Use the "echo <string> > /dev/*RPMSG*", after insmod the module.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:46:03 +08:00
c17da7150d rpmsg: imx: enable the tx_block mechanism in the flow
- Enable the tx_block mechanism to make sure that every transmission is
  complete when mailbox is used.
- Refine the data exchange in the rpmsg_rx_callback and some info
  messages and codes comments.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:46:02 +08:00
9c9acbf066 rpmsg: imx_rpmsg: add partition reset notify
Add partition reset notify if m4 reset so that rpmsg channel
could re-create again while m4 come back.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 15:46:02 +08:00
e2de271424 rpmsg: imx: bug fix and clean up the codes
- Clean up the codes, move the tx/rx mailbox initializations into one
function.
- Fix the mu msg data exchange bug.
- Fix to stop autoload pingpong test module.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:46:02 +08:00
928ae4d445 rpmsg: imx: extend the rpmsg support for imx8qm and so on
- extend the rpmsg support for imx8qm/imx7ulp/imx7d/imx6sx

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:46:01 +08:00
93f8cacdff dt-binding: add imx rpmsg compatibility documentation
Extend the rpmsg compatibility support for
imx8qm/imx7ulp/imx7d/imx6sx

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:46:01 +08:00
d44446a80c rpmsg: imx: add the initial imx rpmsg support
Based on "virtio_rpmsg_bus" driver, This patch-set is used to set up
the communication mechanism between A core and M core on i.MX AMP SOCs.

Add the initial imx rpmsg support glue driver and one pingpong demo,
demonstrated the data transactions between A core and remote M core.
Distributed framework is used in IMX RPMSG implementation, refer to the
following requirements:
  - The CAN functions contained in M core and RTOS should be ready and
    complete functional in 50ms after AMP system is turned on.
  - Partition reset. System wouldn't be stalled by the exceptions (e.x
    the reset triggered by the system hang) occurred at the other side.
    And the RPMSG mechanism should be recovered automactilly after the
    partition reset is completed.
In this scenario, the M core and RTOS would be kicked off by bootloader
firstly, then A core and Linux would be loaded later. Both M core/RTOS
and A core/Linux are running independly.

One physical memory region used to store the vring is mandatory required
to pre-reserved and well-knowned by both A core and M core

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:46:01 +08:00
f0e9006a3c dt-binding: add imx rpmsg compatibility documentation
Add imx rpmsg compatibility documentation.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:46:00 +08:00
3da2516208 MLK-21399 irqchip: Allow i.MX8MQ to call into TF-A
As of now, if somebody masks/unmasks any irq while the set_wake goes
to TF-A, the masking/unmasking might be overwritten. So add new irq_chip ops
that implement the masking, unmasking, set_wake and set_affinity and each
calls into TF-A internally. Also add the ERR11171 knob that allows
initializing the core wake-up workaround by registering our own
smp_cross_call funtion and call the old one from within. The ERR11171 knob
gets enabled by default if the machine is i.MX8MQ.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 15:45:58 +08:00
a2dc94ac6a irqchip: irq-imx-gpcv2: Fix build warning for imx_v6_v7_defconfig
Fix below build warning when built with imx_v6_v7_defconfig:

drivers/irqchip/irq-imx-gpcv2.c: In function 'imx_gpcv2_irq_set_wake':
drivers/irqchip/irq-imx-gpcv2.c:129:23: warning: unused variable 'res' [-Wunused-variable]
  struct arm_smccc_res res;
                       ^

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:45:57 +08:00
3bc3ffbe14 irqchip: irq-imx-gpcv2: fix the suspend/resume on imx8mq
The wakeup irq info need to be provided to ATF side, then
ATF side can config the correct wakeup IRQ when entering
suspend.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 15:45:57 +08:00
cdcad70321 irqchip: imx-gpcv2: Fix build error for imx_v6_v7_defconfig
Fix below build error when built with imx_v6_v7_defconfig:

drivers/irqchip/irq-imx-gpcv2.c: In function 'imx_gpcv2_wake_request_fixup':
drivers/irqchip/irq-imx-gpcv2.c:112:28: error: '__smp_cross_call' undeclared (first use in this function); did you mean 'set_smp_cross_call'?
  __gic_v3_smp_cross_call = __smp_cross_call;
                            ^~~~~~~~~~~~~~~~
                            set_smp_cross_call
drivers/irqchip/irq-imx-gpcv2.c:112:28: note: each undeclared identifier is reported only once for each function it appears in

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:45:56 +08:00
2fe889b77c irqchip: irq-imx-gpcv2: Disable cpuidle if no GPC_CORE_WAKE in EL3
Not all EL3 have the FSL_SIP_CONFIG_GPC_CORE_WAKE, therefore disable
the cpuidle to avoid all the cores going to sleep ending up with a
hang. This allows all the EL3 implementations to work with i.MX8MQ
even if they do not support core wake-up through GPC as a workaround.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
2019-11-25 15:45:56 +08:00
4d3a0f7344 irqchip: irq-imx-gpcv2: Add workaround for i.MX8MQ ERR11171
i.MX8MQ is missing the wake_request signals from GIC to GPCv2. This indirectly
breaks cpuidle support due to inability to wake target cores on IPIs.

Here is the link to the errata (see e11171):

https://www.nxp.com/docs/en/errata/IMX8MDQLQ_0N14W.pdf

Now, in order to fix this, we can trigger IRQ 32 (hwirq 0) to all the cores by
setting 12th bit in IOMUX_GPR1 register. In order to control the target cores
only, that is, not waking up all the cores every time, we can unmask/mask the
IRQ 32 in the first GPC IMR register. So basically we can leave the IOMUX_GPR1
12th bit always set and just play with the masking and unmasking the IRO 32 for
each independent core.

Since EL3 is the one that deals with powering down/up the cores, and since the
cores wake up in EL3, EL3 should be the one to control the IMRs in this case.
This implies we need to get into EL3 on every IPI to do the unmasking, leaving
the masking to be done on the power-up sequence by the core itself.

In order to be able to get into EL3 on each IPI, we 'hijack' the registered smp
cross call handler, in this case the gic_raise_softirq which is registered by
the irq-gic-v3 driver and register our own handler instead. This new handler is
basically a wrapper over the hijacked handler plus the call into EL3.

To get into EL3, we use a custom vendor SIP id added just for this purpose.

All of this is conditional for i.MX8MQ only.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
2019-11-25 15:45:56 +08:00
5f3b5c70ac irq: imx: irqsteer: add multi-pd support for irqsteer
In some subsystem of IMX8, irqsteer is under multi power domains
and they need to be actived when irqsteer work.

irqsteer of imx8qxp image subsystem need CSI and ISI power domains
to be actived, so add multi-pd support as an optional feature for
irqsteer driver

The power-domains on imx8qxp are meant to look like this:
	power-domains = <&pd IMX_SC_R_CSI_0>, <&pd IMX_SC_R_ISI_CH0>;
	power-domain-names = "pd_csi", "pd_isi_ch0";

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 15:45:55 +08:00
5f95722d20 irqchip: add intmux driver support
Add intmux irq driver support.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 15:45:55 +08:00
3d64db930d media: pxp device: fix kernel dump when run pxp_test
In 5.x, the first parameter of dma_alloc_coherent() can't be 0, otherwise
the following dump will arise when run the command:
`/unit_tests/Display/pxp_test.out -I "-o 1.yuv" '. This patch fixed this.
And also, use register_chrdev instead of misc_register to make it clean.

[   53.838653] Internal error: Oops: 17 [#1] SMP ARM
[   53.844538] Modules linked in:
[   53.847610] CPU: 0 PID: 754 Comm: pxp_test.out Not tainted 5.4.0-rc5-03564-g9792b86 #46
[   53.855620] Hardware name: Freescale i.MX6 SoloX (Device Tree)
[   53.861473] PC is at dma_alloc_attrs+0x10/0x114
[   53.866015] LR is at pxp_device_ioctl+0x90c/0xe98
[   53.870728] pc : [<c01bf1e8>]    lr : [<c05eb360>]    psr: a0070013
[   53.877001] sp : ed4e7e74  ip : 00000001  fp : b6591f9c
[   53.882232] r10: 00000000  r9 : e47efd40  r8 : ed4e7ecc
[   53.887463] r7 : ed508cc0  r6 : c1408b08  r5 : 00000000  r4 : 00000051
[   53.893997] r3 : 00000cc1  r2 : e47efd4c  r1 : 00055000  r0 : 00000240
[   53.900533] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   53.907675] Control: 10c5387d  Table: ad14804a  DAC: 00000051
[   53.913428] Process pxp_test.out (pid: 754, stack limit = 0x(ptrval))
[   53.919878] Stack: (0xed4e7e74 to 0xed4e8000)
[   53.924245] 7e60:                                              00000051 b6591cf4 c1408b08
[   53.932434] 7e80: ed508cc0 ed4e7ecc e47efd40 00000000 b6591f9c c05eb360 00000000 c0605e08
[   53.940622] 7ea0: ed42ac00 c0607e3c 00000034 e47fe3c0 ed4e6000 00000034 c1408b08 c0605cc0
[   53.948810] 7ec0: ed4e7f78 00000000 ed4e6000 00000000 00054600 00000000 00000000 00000000
[   53.956998] 7ee0: c1408b08 0479b828 00000000 c1408b08 b6591cf4 e47fb640 c02b7b8c b6591cf4
[   53.965187] 7f00: ed4e6000 eca65e00 b6591f9c c02b71e0 c02c4bbc c0192be8 ec2dc380 c018dc54
[   53.973374] 7f20: c1408b08 00000001 00000000 0479b828 c15344fd 00000004 00004000 e47fb3c0
[   53.981562] 7f40: c15344fd c112a1d4 c110a05c c02c4bcc 00000000 00000000 c02c4aa8 00000000
[   53.989750] 7f60: e47fab41 0479b828 bee8aad0 e47fb641 e47fb640 00000004 c0145004 b6591cf4
[   53.997938] 7f80: ed4e6000 00000036 b6591f9c c02b7b8c b6591cf4 bee8aad0 b6591ce8 00000036
[   54.006125] 7fa0: c01011c4 c0101000 b6591cf4 bee8aad0 00000004 c0145004 b6591cf4 b6ee603c
[   54.014313] 7fc0: b6591cf4 bee8aad0 b6591ce8 00000036 00077858 00000000 bee8aad0 b6591f9c
[   54.022502] 7fe0: b6ee6018 b6591cac b6ed5848 b6e604bc 60070010 00000004 00000000 00000000
[   54.030699] [<c01bf1e8>] (dma_alloc_attrs) from [<00000034>] (0x34)
[   54.036981] Code: e92d4ff0 e1a05000 e2800d09 e59f60ec (e140a0d8)
[   54.043222] ---[ end trace d872f4c07e2464bf ]---

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 15:45:52 +08:00
3da8290b90 media: v4l2: add pxp_v4l2 driver
add pxp v4l2 driver

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 15:45:52 +08:00
1f862ce17f dma: pxp: porting pxp dma driver from imx_4.19.y
Porting pxp dma drivers v2 and v3 from imx_4.19.y

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2019-11-25 15:45:52 +08:00
947cc1408e MLK-22941 ata: ahci_imx: fix error path
When imx8_sata_enable failed, the clk/regulator needs to be disabled,
otherwise there will be kernel dump as following:

WARNING: CPU: 1 PID: 124 at drivers/regulator/core.c:2043 _regulator_put.part.27+0x34/0x158
Modules linked in:
CPU: 1 PID: 124 Comm: kworker/1:11 Tainted: G        W         5.4.0-rc5-03350-g718796b75472-dirty #1793
Hardware name: Freescale i.MX8QM MEK DOM0 (DT)
Workqueue: events deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO)
pc : _regulator_put.part.27+0x34/0x158
lr : _regulator_put.part.27+0x2c/0x158
sp : ffff80001286bb00
x29: ffff80001286bb00 x28: 0000000000000000
x27: 0000000000000000 x26: ffff8000100fddf0
x25: 0000000000000000 x24: 000000000000001b
x23: ffff80001286bbd8 x22: ffff0008ea007600
x21: ffff0008ea0104f0 x20: ffff0008ea007e00
x19: ffff8000120753e8 x18: 0000000000000010
x17: 00000000eefd8a54 x16: 00000000deadbeef
x15: ffffffffffffffff x14: ffff800011f198c8
x13: 0000000000000000 x12: 0000000000000001
x11: 0000000000000000 x10: 0000000000000990
x9 : ffff80001286b870 x8 : ffff0008eb99c0f0
x7 : ffff0008eb99b880 x6 : ffff0008eb99b7c0
x5 : 00000000000001df x4 : 0000000000001adb
x3 : ffff8008de089000 x2 : a4c383a3cc862400
x1 : 0000000000000000 x0 : 0000000000000001
Call trace:
 _regulator_put.part.27+0x34/0x158
 regulator_put+0x34/0x48
 ahci_platform_put_resources+0x64/0xd0
 release_nodes+0x1b0/0x220
 devres_release_all+0x34/0x50
 really_probe+0x1b8/0x308
 driver_probe_device+0x54/0xe8
 __device_attach_driver+0x80/0xb8
 bus_for_each_drv+0x78/0xc8
 __device_attach+0xd4/0x130
 device_initial_probe+0x10/0x18
 bus_probe_device+0x90/0x98
 deferred_probe_work_func+0x64/0x98
 process_one_work+0x1e0/0x358
 worker_thread+0x208/0x488
 kthread+0x118/0x120
 ret_from_fork+0x10/0x18

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Acked-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 15:45:50 +08:00
2ff55e6e80 ahci: imx: set the rx water mark to fix the gen3 link issue
- Refine the tx/rx impedance ratio setting.
- Set the RxWaterMark to fix the GEN3 link unstable issue on iMX8QM.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:45:49 +08:00
4a079ef60b ahci_qoriq: bug fix for ecc_addr
Original driver expect a register node with name "sata-ecc"
this node is of 64 bit wide.
In ACPI such nodes can be provided with QWordMemory, but
QWordMemory can not hold DescriptorName more than 4 characters.

Therefore this patch changes platform property retrival based
upon index instead of named.

Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
2019-11-25 15:45:49 +08:00
745ccd66e5 ahci: qoriq: workaround for errata A-379364 on lx2160a
There is a erratum on lx2160a which is: "SATA link is
going down sometime during sata initialization"
The workaround for it is to reset the lane. This patch
implements this workaround.
This erratum only exists on lx2160 Rev1, will be addressed
on Rev2 and later.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
2019-11-25 15:45:49 +08:00
153787792a ahci: qoriq: enable acpi support in qoriq ahci driver
This patch enables ACPI support in qoriq ahci driver.

Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
Signed-off-by: Peng Ma <peng.ma@nxp.com>
2019-11-25 15:45:48 +08:00
25d6299a99 ata: imx: enable 8qm ahci sata pm
Enable iMX8QM SATA PM support.
Regarding to the different PCIe link, the PHYx2 APB clocks should be
turn on and off accordingly in PM operations on iMX8QM.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:45:48 +08:00
6f39fdb657 ata: imx: set up the hsio regmap itself
Setup SATA its own HSIO regmap to fix the kernel dump,
when the HSIO regmap is set as system syscon.
/sys/kernel/debug/regmap# cat dummy-hsio@5f080000/register

NOTE: devm_ioremap is used to get the virtual address, because that the
devm_ioremap_resource would return -EBUSY when there is a resource
overlap between different HSIO consumers.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:45:47 +08:00
0adaace11b ata: imx: enhance the codes to enable imx8qm sata
- Add one ext_osc parameter for imx8qm ahci.
  Add one parameter to distinguish the different ref_clk
  source, internal pll or the external osc.
  NOTE: The value of the ext_osc should be aligned to the one
  of the PCIe's, since both of them share one ref_clk source.
- Fix can't find ahb clk issue.
  The ahb clock is not mandatory required by iMX8QM SATA, fetch it only
  when there is "ahb" clock.
- Specify the 32-bit dma limitation and the softreset for iMX8QM SATA.
- Use the standard ahci_error_handler on iMX8QM SATA.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:45:47 +08:00
f32935f387 ahci: imx: add the bist mode sysfile callback for imx8qm sata
In order to do SATA compliance tests, add the bist mode
sysfile callback to generate kinds of test patterns.
- Add the "ahci-imx.bist=1" into kernel command line to
register the bist mode enable callback.
- Use "echo <pattern_#> /sys/devices/.../ahci_bist_pattern"
to generate the responding test pattern.
- Use "cat /sys/devices/.../ahci_bist_pattern" to check
the current pattern configuration.
NOTE:
LBP 0, LFTP 1, MFTP 2, HFTP 3.
- Adjust the TX-DEEMP and COMINT to pass the compliance tests.

BuildInfo:
- SCFW 685bd659, SECO-FW 00000000, IMX-MKIMAGE 53974947, ATF 625d9ed
- U-Boot 2017.03-01018-g6045484

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
2019-11-25 15:45:46 +08:00
789755d1af MLK-11444 ata: imx: cmd buf corruption errata bug fix
errata:
When a read command returns less data than specified in the PRDs (for
example, there are two PRDs for this command, but the device returns a
number of bytes which is less than in the first PRD), the second PRD of
this command is  not read out of the PRD FIFO, causing the next command
to use this PRD erroneously.

workaround
- forces sg_tablesize = 1
- modified the sg_io function in block/scsi_ioctl.c to use a 64k buffer
  allocated with dma_alloc_coherent during the probe in ahci_imx
- In order to fix the scsi/sata hang, when CD_ROM and HDD are
  accessed simultaneously after the workaround is applied.
  Do not go to sleep in scsi_eh_handler, when there is host failed.

Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
2019-11-25 15:45:46 +08:00
be6bb8135b MLK-19402 mmc: sdhci-esdhc-imx: optimize the strobe dll setting
After set the STROBE SLV delay target value, it need to wait some
time to let the usdhc lock the REF and SLV clock. In normal case,
1~2us is enough for imx8/imx6 and imx7d, and 4~5us is enough for
imx7ulp, but when do reboot stress test or do the bind/unbind stress
test, sometimes need to wait about 10us to get the status lock.

This patch optimize delay handle method, only print the warning
message if the status is still not lock after 1ms delay.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:45:43 +08:00
61b62c333a MLK-22966 mmc: sdhci-esdhc-imx: optimize the clock setting
When force clock off, check the SDOFF of register PRSSTAT to make sure
the clock is gate off. Before force clock on, check the SDSTB of register
PRSSTAT to make sure the clock is stable, this will eliminate the clock
glitch.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:45:43 +08:00
f64d092299 mmc: sdhci-esdhc-imx: Add support for S32V234
S32V234 uSDHC is compatible with the driver implemented for i.MX.
Notes:
- Errata ESDHC_FLAG_ERR004536 is not applicable for S32V234 uSDHC.
- MMC driver is selected based on the SOC that is part of the Freescale S32
  family.

Signed-off-by: Gilles Talis <gilles.talis@nxp.com>
Signed-off-by: Mihaela Martinas <Mihaela.Martinas@freescale.com>
Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com>
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Acked by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:42 +08:00
ec5b4c1411 mmc: sdhci-of-esdhc: fix up erratum A-008171 workaround
A previous patch implemented an incomplete workaround of erratum
A-008171. The complete workaround is as below. This patch is to
implement the complete workaround which uses SW tuning if HW tuning
fails, and retries both HW/SW tuning once with reduced clock if
workaround fails. This is suggested by hardware team, and the patch
had been verified on LS1046A eSDHC + Phison 32G eMMC which could
trigger the erratum.

Workaround:
/* For T1040, T2080, LS1021A, T1023 Rev 1: */
1. Program TBPTR[TB_WNDW_END_PTR] = 3*DIV_RATIO.
2. Program TBPTR[TB_WNDW_START_PTR] = 5*DIV_RATIO.
3. Program the software tuning mode by setting TBCTL[TB_MODE] = 2'h3.
4. Set SYSCTL2[EXTN] and SYSCTL2[SAMPCLKSEL].
5. Issue SEND_TUNING_BLK Command (CMD19 for SD, CMD21 for MMC).
6. Wait for IRQSTAT[BRR], buffer read ready, to be set.
7. Clear IRQSTAT[BRR].
8. Check SYSCTL2[EXTN] to be cleared.
9. Check SYSCTL2[SAMPCLKSEL], Sampling Clock Select. It's set value
   indicate tuning procedure success, and clear indicate failure.
   In case of tuning failure, fixed sampling scheme could be used by
   clearing TBCTL[TB_EN].
/* For LS1080A Rev 1, LS2088A Rev 1.0, LA1575A Rev 1.0: */
1. Read the TBCTL[31:0] register. Write TBCTL[11:8]=4'h8 and wait for
   1ms.
2. Read the TBCTL[31:0] register and rewrite again. Wait for 1ms second.
3. Read the TBSTAT[31:0] register twice.
3.1 Reset data lines by setting ESDHCCTL[RSTD] bit.
3.2 Check ESDHCCTL[RSTD] bit.
3.3 If ESDHCCTL[RSTD] is 0, go to step 3.4 else go to step 3.2.
3.4 Write 32'hFFFF_FFFF to IRQSTAT register.
4. if TBSTAT[15:8]-TBSTAT[7:0] > 4*DIV_RATIO or TBSTAT[7:0]-TBSTAT[15:8]
   > 4*DIV_RATIO , then program TBPTR[TB_WNDW_END_PTR] = 4*DIV_RATIO and
   program TBPTR[TB_WNDW_START_PTR] = 8*DIV_RATIO.
/* For LS1012A Rev1, LS1043A Rev 1.x, LS1046A 1.0: */
1. Read the TBCTL[0:31] register. Write TBCTL[20:23]=4'h8 and wait for
   1ms.
2. Read the TBCTL[0:31] register and rewrite again. Wait for 1ms second.
3. Read the TBSTAT[0:31] register twice.
3.1 Reset data lines by setting ESDHCCTL[RSTD] bit.
3.2 Check ESDHCCTL[RSTD] bit.
3.3 If ESDHCCTL[RSTD] is 0, go to step 3.4 else go to step 3.2.
3.4 Write 32'hFFFF_FFFF to IRQSTAT register.
4. if TBSTAT[16:23]-TBSTAT[24:31] > 4*DIV_RATIO or TBSTAT[24:31]-
   TBSTAT[16:23] > 4* DIV_RATIO , then program TBPTR[TB_WNDW_END_PTR] =
   4*DIV_RATIO and program TBPTR[TB_WNDW_START_PTR] = 8*DIV_RATIO.
/* For LS1080A Rev 1, LS2088A Rev 1.0, LA1575A Rev 1.0 LS1012A Rev1,
 * LS1043A Rev 1.x, LS1046A 1.0:
 */
5. else program TBPTR[TB_WNDW_END_PTR] = 3*DIV_RATIO and program
   TBPTR[TB_WNDW_START_PTR] = 5*DIV_RATIO.
6. Program the software tuning mode by setting TBCTL[TB_MODE] = 2'h3.
7. Set SYSCTL2[EXTN], wait 1us and SYSCTL2[SAMPCLKSEL].
8. Issue SEND_TUNING_BLK Command (CMD19 for SD, CMD21 for MMC).
9. Wait for IRQSTAT[BRR], buffer read ready, to be set.
10. Clear IRQSTAT[BRR].
11. Check SYSCTL2[EXTN] to be cleared.
12. Check SYSCTL2[SAMPCLKSEL], Sampling Clock Select. It's set value
    indicate tuning procedure success, and clear indicate failure.
    In case of tuning failure, fixed sampling scheme could be used by
    clearing TBCTL[TB_EN].

Fixes: b1f378ab53 ("mmc: sdhci-of-esdhc: add erratum A008171 support")
Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
2019-11-25 15:45:42 +08:00
34008ae4b4 mmc: sdhci-of-esdhc: poll ESDHC_FLUSH_ASYNC_FIFO bit until completion
The ESDHC_FLUSH_ASYNC_FIFO bit which is set to flush asynchronous FIFO
should be polled until it's auto cleared by hardware.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2019-11-25 15:45:41 +08:00
89a819705b mmc: sdhci: disable irq in sdhci host suspend ranther than free this irq
Currently sdhci driver free irq in host suspend, and call
request_threaded_irq() in host resume. But during host resume,
Ctrl+C can impact sdhci host resume, see the error log:

CPU1 is up
PM: noirq resume of devices complete after 0.637 msecs imx-sdma 30bd0000.sdma: loaded firmware 4.1
PM: early resume of devices complete after 0.774 msecs
dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -4
PM: Device 30b40000.usdhc failed to resume: error -4
dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -4
PM: Device 30b50000.usdhc failed to resume: error -4
dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -4
PM: Device 30b60000.usdhc failed to resume: error -4 fec 30be0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
mmc0: Timeout waiting for hardware interrupt.
mmc0: Timeout waiting for hardware interrupt.
mmc0: Timeout waiting for hardware interrupt.
mmc0: Timeout waiting for hardware interrupt.
mmc0: Timeout waiting for hardware interrupt.
mmc0: Timeout waiting for hardware interrupt.
mmc0: error -110 during resume (card was removed?)
mmc2: Timeout waiting for hardware interrupt.
mmc2: Timeout waiting for hardware interrupt.
mmc2: error -110 during resume (card was removed?)

In request_threaded_irq-> __setup_irq-> kthread_create
->kthread_create_on_node, the comment shows that SIGKILLed will
impact the kthread create, and return -EINTR.

This patch replace them with disable|enable_irq(), that will prevent
IRQs from being propagated to the sdhci driver.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:41 +08:00
2401f8cd59 mmc: cqhci: clear pending interrupt and halt
On i.MX8MM, we are running Dual Linux OS, with 1st Linux using SD Card
as rootfs storage, 2nd Linux using eMMC as rootfs storage. We let the
the 1st linux configure power/clock for the 2nd Linux.

When the 2nd Linux is booting into rootfs stage, we let the 1st Linux
to destroy the 2nd linux, then restart the 1st linux, we met SDHCI dump
as following, after we clear the pending interrupt and halt CQCTL, issue
gone.

[ 1.334594] mmc2: Got command interrupt 0x00000001 even though no command operation was in progress.
[ 1.334595] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[ 1.334599] mmc2: sdhci: Sys addr: 0xa05dcc00 | Version: 0x00000002
[ 1.340819] lib80211: common routines for IEEE802.11 drivers
[ 1.345538] mmc2: sdhci: Blk size: 0x00000200 | Blk cnt: 0x00000000
[ 1.345541] mmc2: sdhci: Argument: 0x00018000 | Trn mode: 0x00000033
[ 1.345543] mmc2: sdhci: Present: 0x01f88008 | Host ctl: 0x00000031
[ 1.345547] mmc2: sdhci: Power: 0x00000002 | Blk gap: 0x00000080
[ 1.357903] mmc2: sdhci: Wake-up: 0x00000008 | Clock: 0x0000003f
[ 1.357905] mmc2: sdhci: Timeout: 0x0000008f | Int stat: 0x00000000
[ 1.357908] mmc2: sdhci: Int enab: 0x107f100b | Sig enab: 0x107f100b
[ 1.357911] mmc2: sdhci: AC12 err: 0x00000000 | Slot int: 0x00000502
[ 1.370268] mmc2: sdhci: Caps: 0x07eb0000 | Caps_1: 0x0000b400
[ 1.370270] mmc2: sdhci: Cmd: 0x00000d1a | Max curr: 0x00ffffff
[ 1.370273] mmc2: sdhci: Resp[0]: 0x00000b00 | Resp[1]: 0xffffffff
[ 1.370276] mmc2: sdhci: Resp[2]: 0x328f5903 | Resp[3]: 0x00d00f00
[ 1.382132] mmc2: sdhci: Host ctl2: 0x00000000
[ 1.382135] mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0xa2040208

[ 2.060932] mmc2: Unexpected interrupt 0x00004000.
[ 2.065538] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[ 2.071720] mmc2: sdhci: Sys addr: 0x00000000 | Version: 0x00000002
[ 2.077902] mmc2: sdhci: Blk size: 0x00000200 | Blk cnt: 0x00000001
[ 2.084083] mmc2: sdhci: Argument: 0x00000000 | Trn mode: 0x00000000
[ 2.090264] mmc2: sdhci: Present: 0x01f88009 | Host ctl: 0x00000011
[ 2.096446] mmc2: sdhci: Power: 0x00000002 | Blk gap: 0x00000080
[ 2.102627] mmc2: sdhci: Wake-up: 0x00000008 | Clock: 0x000010ff
[ 2.108809] mmc2: sdhci: Timeout: 0x0000008f | Int stat: 0x00004000
[ 2.114990] mmc2: sdhci: Int enab: 0x007f1003 | Sig enab: 0x007f1003
[ 2.121171] mmc2: sdhci: AC12 err: 0x00000000 | Slot int: 0x00000502
[ 2.127353] mmc2: sdhci: Caps: 0x07eb0000 | Caps_1: 0x0000b400
[ 2.133534] mmc2: sdhci: Cmd: 0x0000371a | Max curr: 0x00ffffff
[ 2.139715] mmc2: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0xffffffff
[ 2.145896] mmc2: sdhci: Resp[2]: 0x328f5903 | Resp[3]: 0x00d00f00
[ 2.152077] mmc2: sdhci: Host ctl2: 0x00000000
[ 2.156342] mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x00000000

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:40 +08:00
e41d4f9835 mmc: sdhci-esdhc-imx: handle 'auto-cmd23-broken' from devicetree
Since L4.15, community involve the commit 105819c8a5 ("mmc: core: use mrq->sbc
when sending CMD23 for RPMB"), let the usdhc to decide whether to use ACMD23 for
RPMB. This CMD23 for RPMB need to set the bit 31 to its argument, if not, the
RPMB write operation will return general fail.

According to the sdhci logic, SDMA mode will disable the ACMD23, and only in
ADMA mode, it will chose to use ACMD23 if the host support. But according to
debug, and confirm with IC, the imx6qpdl/imx6sx/imx6sl/imx7d do not support
the ACMD23 feature completely. These SoCs only use the 16 bit block count of
the register 0x4 (BLOCK_ATT) as the CMD23's argument in ACMD23 mode, which
means it will ignore the upper 16 bit of the CMD23's argument. This will block
the reliable write operation in RPMB, because RPMB reliable write need to set
the bit31 of the CMD23's argument. This is the hardware limitation. Due to
imx6sl use SDMA, so for imx6qpdl/imx6sx/imx7d, it need to broke the ACMD23 for
eMMC, SD card do not has this limitation, because SD card do not support reliable
write.

For imx6ul/imx6ull/imx6sll/imx7ulp/imx8, it support the ACMD23 completely, it
change to use the 0x0 register (DS_ADDR) to put the CMD23's argument in ADMA mode.

This patch handle 'auto-cmd23-broken' from devicetree.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:39 +08:00
2ca5aef528 mmc: sdhci-esdhc-imx: add esdhc_soc_data for i.MX8MM
i.MX8MM contains USDHC which support eMMC V5.1 (including CMDQ and
HS400ES), besides i.MX8MM also support bus frequency, so add a new
esdhc_soc_data for i.MX8MM.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:39 +08:00
9812606c0e mmc: sdhci-esdhc-imx: use bus freq in runtime pm
Request BUS_FREQ_HIGH when bus is busy and then release BUS_FREQ_HIGH
when bus becomes idle.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:39 +08:00
860bae54af mmc: sdhci-esdhc-imx: make sure usdhc clock enabled during suspend
When suspend usdhc, it will access usdhc register. So usdhc clock
should be enabled, otherwise the access usdhc register will return
error or cause system.

Take this into consideration, if system enable a usdhc and do not
connect any SD/SDIO/MMC card, after system boot up, this usdhc
will do runtime suspend, and close all usdhc clock. At this time,
if suspend the system, due to no card persent, usdhc runtime resume
will not be called. So usdhc clock still closed, then in suspend,
once access usdhc register, system hung or bus error return.

This patch make sure usdhc clock always enabled while doing usdhc
suspend.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:38 +08:00
10e95d5a9d 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>
2019-11-25 15:45:38 +08:00
5f00a5a695 mmc: sdhci-esdhc-imx: restore the per_clk rate in PM_RUNTIME
When pm_runtime_suspend is run, a call to SCFW power off the SS in
which the resource resides is made. The SCFW can power off the SS
if no other resource in active in tha SS. If so, all state associated
with all the resources within the SS that is powered off is lost,
this includes the clock rates, clock state etc. When pm_runtime_resume
is called, the SS associated with that resource is powered up. But
the clocks are left in the default state.

This patch restore clock rate in pm_runtime_resume, make sure the
clock is right rather than depending on the default state setting
by SCFW.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:37 +08:00
f5d4c8a47e mmc: sdhci-esdhci-imx: retune needed for Mega/Mix enabled SoCs
For Mega/Mix enabled SoCs like MX7D and MX6SX, uSDHC will lost power in
LP mode no matter whether the MMC_KEEP_POWER flag is set or not.
This may cause state misalign between kernel and HW, especially for
SDIO3.0 WiFi cards.
e.g. SDIO WiFi driver usually will keep power during system suspend.
And after resume, no card re-enumeration called.
But the tuning state is lost due to Mega/Mix.
Then CRC error may happen during next data transfer.

So we should always fire a mmc_retune_needed() for such type SoC
to tell MMC core retuning is needed for next data transfer.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:37 +08:00
feeb4928bf mmc: esdhc-sdhci-imx: no fail when no pinctrl available
When using jailhouse to support two Linux on i.MX8MQ EVK,
we use the 1st Linux to configure pinctrl for the 2nd Linux.
Then the 2nd Linux could use the mmc without pinctrl driver.

So give a warning message when no pinctrl available, but no fail probe.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:37 +08:00
8282097452 mmc: add feature of setting slot index via devicetree alias
Add feature of setting slot index via devicetree alias, to hard code the
mmc/sd root device.

The patch requires additional alias_id fix or it won't work.

Note: minor device number keep independent with this device alias.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:36 +08:00
084c5fd0ed 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>
2019-11-25 15:45:35 +08:00
061e13343b mmc: core: add MMC_PM_IGNORE_PM_NOTIFY feature
With igore pm notify feature, MMC core will not re-detect card
after system suspend/resume. This is needed for some special cards
like Broadcom WiFi which can't work propertly on card re-detect
after system resume.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:35 +08:00
0813febf62 mmc: sdhci: remove MMC_CAP_NEEDS_POLL
This will cause meaningless CPU overhead by polling the card at backgroud
if the CD is broken.
Most board does not intend to use this function, so remove it.
Platform driver could add it for test if needed.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:34 +08:00
0e84465457 mmc: core: add delay for SD3.0 UHS mode switch
We may meet the following errors with a SD3.0 DDR50 cards during reboot test.
mmc0: new ultra high speed DDR50 SDHC card at address aaaa
mmcblk0: mmc0:aaaa SU08G 7.40 GiB
mmcblk0: error -84 transferring data, sector 0, nr 8, cmd response 0x900, card status 0xb00
mmcblk0: retrying using single block read
mmcblk0: error -84 transferring data, sector 0, nr 8, cmd response 0x900, card status 0x0
end_request: I/O error, dev mmcblk0, sector 0
.....
Buffer I/O error on device mmcblk0, logical block 0
mmcblk0: unable to read partition table

The root cause is still unknown.
Since there's an errata of Sandisk eMMC card before that it requires delay for CMD6
for eMMC DDR mode to work stable, we also suspect the SD3.0 DDR requires similar delay.
(Still not confirmed by Sandisk)
By adding the delay, the overnight reboot test(run 2000+ times) did not
show the issue anymore. Originally it can easy show the error after about 20 times of
reboot test.

So this patch would be the temporary workaround for Sandisk SD3.0 DDR50 mode
unstable issue.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:34 +08:00
50f70ed62e mmc: sdhci-esdhc-imx: do not enable wakeup by default
After adding mega fast support, the default enabled usdhc wakeup will block
M/F to gate off power domain.

To avoid this issue, we only claim wakeup capability and reply on user to enable
it via sysfs according to real needs.
The drawback of such change is that for SDIO WiFi Wakeup On Wireless feature,
User has to enable both uSDHC and WiFi WoW wakeup mannually to make
WoW work well.

BTW, due to the wakeup feature is controller itself, so we do not need to reply
on WiFi PM flags to enable it.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:34 +08:00
6bb8c60645 mmc: sdhci: do not enable card detect interrupt for gpio cd type
Except SDHCI_QUIRK_BROKEN_CARD_DETECTION and MMC_CAP_NONREMOVABLE,
we also do not need to handle controller native card detect interrupt
for gpio cd type.
If we wrong enabled the card detect interrupt for gpio case, it will
cause a lot of unexpected card detect interrupts during data transfer
which should not happen.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:34 +08:00
e7337d9374 mmc: add delay after CMD6 befoer sending CMD13 for sandisk
Some sandisk emmc cards need certain delay before sending cmd13 after cmd6.
Original CR: ENGR174296 (commit: fd031f9)

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:32 +08:00
bf17575fac mmc: sdhci-esdhc-imx: restore pin state when resume back
In some low power mode, SoC will lose the pin state, so need to restore
the pin state when resume back.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:45:30 +08:00
2c48dea21d Revert "mmc: sdhci: Drop redundant code for SDIO IRQs"
This reverts commit af5d2b7b0d.
2019-11-25 15:45:30 +08:00
2e388fae57 Revert "mmc: sdhci: Convert to use sdio_irq_claimed()"
This reverts commit 0e62614b6c.
2019-11-25 15:45:29 +08:00
157b5eb94c imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:45:29 +08:00
11a8351e80 MLK-22971 serial: imx: disable UCR4_OREN in .stop_rx()
Disable UCR4_OREN bit in .stop_rx() to avoid endless
interrupt happen while tty port is shuting down.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:27 +08:00
7e33590f8b tty: serial: lpuart: add LS1028A support
NXP LS1028A lpuart is the same IP as LS1021A, but it is
little endian for register accessing instead of big endian
on LS1021A.

So add LS1028A matching data to distiguish the chips.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:27 +08:00
2e82029a2e serial: fsl_lpuart: enable two stop bits
Add two stop bits support.
User can run the command to enable two stop bits
for test: stty  cstopb  -F /dev/ttyLPx

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:27 +08:00
cde0cb39c0 tty: serial: lpuart: enable wakeup source for lpuart
When use lpuart with DMA mode as wake up source, it still switch to
cpu mode in .suspend() that enable cpu interrupts RIE and ILIE as
wakeup source. Enable the wakeup irq bits in .suspend_noirq() and
disable the wakeup irq bits in .resume_noirq().

For DMA mode, after system resume back, it needs to setup DMA again,
if DMA setup is failed, it switchs to CPU mode. .resume() will share
the HW setup code with .startup(), so abstract the same code to the
api like lpuartx_hw_setup().

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:26 +08:00
421adf006e MLK-17133-02 tty: serial: lpuart: add runtime pm support
Add runtime pm support to manage lpuart clock and its power domain
to save power in system idle and system suspend stages.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
2019-11-25 15:45:26 +08:00
f0d4eccecf MLK-21445 serial: fsl_lpuart: do HW reset for communication port
Do HW reset for communication port after the port is registered
if the UART controller support the feature.

Do partition reset with LPUART's power on, LPUART registers will
keep the previous status, like on i.MX8QM platform,  which is not
expected action, so reset the HW is required.

Currently, only i.MX7ULP and i.MX8QM LPUART controllers include
global register that support HW reset.

Tested-by: Robin Gong <yibin.gong@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit c2bc1f62ec)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Shrikant Bobade <Shrikant_Bobade@mentor.com>
(cherry picked from commit 9f396f540093402317c3c1b9a8fe955b91c89164)
2019-11-25 15:45:25 +08:00
24259ac670 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: 6250cc30c4 ("tty: serial: fsl_lpuart: Use scatter/gather DMA for Tx")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:45:25 +08:00
d44a60d517 MLK-15094 tty: serial: fsl_lpuart: check dma_tx_in_progress in callback
There have a corner case that tx DMA .callback() is coming after
.flush_buffer(), then .callback() should check dma_tx_in_progress
flag and return in directly.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:45:24 +08:00
12ad8eef84 tty: serial: fsl_lpuart: enable loopback mode
Enable lpuart32 loopback mode.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:24 +08:00
e085dff6cb tty: serial: fsl_lpuart: enable dma mode for imx8qxp
imx8qxp lpuart support eDMA for dma mode, support EOP (end-of-packet)
feature. But eDMA cannot detect the correct DADDR for current major
loop in cyclic mode, so it doesn't support cyclic mode.

The patch is to enable lpuart prep slave sg dma mode for imx8qxp.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:23 +08:00
a2d1059cb9 MLK-18137: fsl_lpuart: Fix loopback mode
Register offset needs to be applied on mapbase also.
dma_tx/rx_request use the physical address of UARTDATA.
Register offset is currently only applied to membase (the
corresponding virtual addr) but not on mapbase.

Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
2019-11-25 15:45:22 +08:00
f285ec299e tty: serial: fsl_lpuart: add magic SysRq support
Add magic SysRq key support.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:22 +08:00
89d0add021 tty: serial: fsl_lpuart: add modem device reset
Add modem device reset, wthether to reset depend on dts configuration.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:22 +08:00
db08d5739e tty: serial: lpuart: add power domain support
lpuart dma mode depends on dma channel's power domain like:
power-domains = <&pd IMX_SC_R_UART_1>,
                <&pd IMX_SC_R_DMA_2_CH10>,
                <&pd IMX_SC_R_DMA_2_CH11>;
power-domain-names = "uart", "rxdma", "txdma";

So define the multiple power domain for lpuart.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:21 +08:00
8ee7d8348e tty: serial: imx: add modem device reset
Add modem device reset for Bluetooth device.
The device reset is optional.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:21 +08:00
926ebffe56 tty: serial: imx: add busfreq and pm qos support for DMA mode
Add busfreq and pm qos support for DMA mode.

DMA mode cannot work stablely at low busfreq mode, so request
high busfreq once DMA is enabled.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:21 +08:00
9fc55e60c4 tty: serial: imx: set uart module clock to 80MHz
The IP module clock maximum clock rate is 80MHz, Once the module
clock is great than 80MHz, there may have risk.

So set the maximum module clock to 80MHz.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:20 +08:00
65e9e0baa9 imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:45:20 +08:00
4fa439eff9 MLK-12932-01: pwm backlight: Add fb name check feature
Add fb name check function pwm_backlight_check_fb_name(),
pwm driver can banding to fb with fb name when driver working
in device tree architecture.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:45:18 +08:00
9ff00c698a phy: mixel-lvds-combo: Configure CO divider to meet fvco range requirement
As the below diagram shows, to achieve a particular serial clock rate,
we should choose an appropriate CO divider value(1/2/4/8) so that PLL
VCO frequency(fvco) is in specified range(640MHz ~ 1500MHz).

 ---------  640MHz ~ 1500MHz   ------------      --------------
| PLL VCO | ----------------> | CO divider | -> | serial clock |
 ---------                     ------------      --------------
                               1/2/4/8 div      7 * phy_clk_rate

This patch configures CO divider to be appropriate value to meet the fvco
range requirement.  This may address display flicker issue seen on some
SoC samples.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:45:15 +08:00
2738e0707c phy: Add Mixel LVDS combo PHY support
This patch adds Mixel LVDS combo PHY support(MIPI DSI and LVDS combo).
This LVDS PHY supports one LVDS channel in single mode and two channels in
dual mode.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:45:14 +08:00
72c912225c dt-bindings: phy: Add DT binding for Mixel LVDS PHY(LVDS/MIPI DSI combo)
This patch adds device tree binding for Mixel LVDS PHY(LVDS/MIPI DSI combo),
as found in i.MX8qxp SoC.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:45:14 +08:00
95c3b3c0cf phy: Add Mixel LVDS PHY support
This patch adds Mixel LVDS PHY support.
This PHY supports two LVDS channels.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:45:14 +08:00
824cbfa98d dt-bindings: phy: Add DT binding for Mixel LVDS PHY
This patch adds device tree binding for Mixel LVDS PHY,
as found in i.MX8qm SoC.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:45:13 +08:00
800275e78a dt-bindings: Add vendor prefix for Mixel, Inc.
Mixel, Inc. is a provider of mixed-signal mobile IPs.

Website: www.mixel.com

Signed-off-by: Liu Ying <victor.liu@nxp.com>
[ Aisheng: change to YAML format ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:45:13 +08:00
31a37c0612 rtc: imx-rpmsg: Add i.MX RPMSG RTC support
Add i.MX RPMSG RTC support for i.MX7ULP.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:45:10 +08:00
3dbf430578 rtc: imx-sc: Add i.MX8QM RTC support
Add i.MX8QM RTC support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:45:09 +08:00
4ec8c81845 reset: Kconfig: use 'ARCH_MXC' for reset dispmix
Use 'ARCH_MXC' config to replace 'ARCH_FSL_IMX8MM' and
'ARCH_FSL_IMX8MN' configs which are not defined for
dispmix reset kconfig entry.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:45:07 +08:00
7a139f7c25 reset: imx8m: Correct clock name for dispmix driver
devm_regmap_init_mmio_clk() will try to get clock by matching
clock-names property in dts with its clk_id. So the clock name
should be identical to name which clock registered. Otherwise,
devm_regmap_init_mmio_clk() will fail with -ENOENT error.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2019-11-25 15:45:07 +08:00
b92740311f reset: gpio-reset: add pinctrl comsuer header file
Add pinctrl comsuser header file that defile the pintrl
interfaces for different configs define.

Reported-by: Ran Wang <ran.wang_1@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Tested-by: Ran Wang <ran.wang_1@nxp.com>
2019-11-25 15:45:07 +08:00
07ad1543f0 reset: imx7: add the clkreq reset for imx8m
Add the clkreq reset used by the L1ss feature on iMX8M

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:45:06 +08:00
09d3bfdf8b dt-bindings: reset: imx7: add clkreq reset used by the l1ss on imx8m
Add the clkreq reset used by the L1SS feature on iMX8M

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:45:06 +08:00
6d73c7f3ae reset: Add driver for dispmix reset
This is an reset driver to implement a reset controller
device DISPMIX on IMX8MM and IMX8MN platforms. Dispmix
reset is used to reset or enable related buses and clks
for the submodules in DISPMIX.

All the dispmix resets are divided into three subgroups:
sft_rstn, clk_en and mipi_rst, and each of them contains
several reset lines to control several different modules
on and off in DISPMIX which doesn't require the standard
reset flow, but only line assert and deassert operations.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
2019-11-25 15:45:06 +08:00
a9c85cb2d8 MLK-20682 reset: gpio-reset: add suspend/resume callback
The reset PIN may loss its state when system suspend due to GPIO
controller power off. Set pinctrl as "sleep" state to keep PIN
voltage during system suspend, and configurate pinctrl as "default"
state after system resume back. Because GPIO resume back earlier
than gpio-reset, then GPIO signal can control the PIN voltage again.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Shrikant Bobade <Shrikant_Bobade@mentor.com>
(cherry picked from commit ea5a9cdc1941afc36fd0f5a223ea762b85512130)
2019-11-25 15:45:05 +08:00
80fcea5b45 MLK-15092 reset: gpio-reset: add post reset delay
Some devices need to wait for some milliseconds after reset, so add
post reset delay in the gpio-reset chip.

The post reset delay is optional.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:45:05 +08:00
bc1f879da9 MLK-14498-11 reset: gpio-reset: use the cansleep variant of the GPIO API
Use the cansleep variant of the GPIO API.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:45:04 +08:00
16c4d62c0a MLK-11395-2: reset: build in CONFIG_RESET_GPIO by default
GPIO is widely used as the reset control for various devices.  Let's
build the support in by default.

[shawn.guo: cherry-pick commit 795fcb3bc5bb from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>

(cherry picked from commit 0cbf78b5b02c57e6fd0e57e811cfe56509c4fd24)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:45:04 +08:00
76d42334db MLK-11395-1: reset: register gpio-reset driver in arch_initcall
It's a little bit late to register gpio-reset driver at module_init
time, because gpio-reset provides reset control via gpio for other
devices which are mostly probed at module_init time too.  And it
becomes even worse, when the gpio comes from IO expander on I2C bus,
e.g. pca953x.  In that case, gpio-reset needs to be ready before I2C
bus driver which is generally ready at subsys_initcall time.  Let's
register gpio-reset driver in arch_initcall() to have it ready early
enough.

The defer probe mechanism is not used here, because a reset controller
driver should be reasonably registered early than other devices.  More
importantly, defer probe doe not help in some nasty cases, e.g. the
gpio-pca953x device itself needs a reset from gpio-reset driver start
working.

[shawn.guo: cherry-pick commit 7153f05108ef from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>

(cherry picked from commit 11e3543010d4ed50db78a5fc809f24c89e8c6e30)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:45:04 +08:00
5f83111d4f reset: Add driver for gpio-controlled reset pins
This driver implements a reset controller device that toggle a gpio
connected to a reset pin of a peripheral IC. The delay between assertion
and de-assertion of the reset signal can be configured via device tree.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:45:03 +08:00
322bc87dd3 MLK-22949 brcmfmac: add chip id check for clm_blob firmware load
bcm4339 has no clm_blob firmware, so add chip id check before
clm_blob firmware loaded.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:01 +08:00
733dd259f4 MLK-22948 brcmfmac: avoid to send mailbox interrupt twice for core version 0xb
The commit 9ef77fbedad9(brcmfmac: send mailbox interrupt twice for
specific hardware device) broken cyw4356 suspend.

kernel suspend log:
	Timeout on response for entering D3 substate

At least, PCIE wireless device with core revision 0xb should not involve
the workaround.

Fixes:9ef77fbedad9(brcmfmac: send mailbox interrupt twice for specific hardware device)
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:01 +08:00
ca733aa15f MLK-22946 brcmfmac: freeing wiphy after brcmf attach failed
Current code error path process like as below:
brcmf_pcie_setup()
	brcmf_attach()
		if attach error, brcmf_detach();
	if attach error, call brcmf_pcie_remove()
		call brcmf_detach() again

To avoid attach/detach() mismatch, free wiphy when brcmf instance
attach failed.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:01 +08:00
665ba6f938 dt-bindings: add new property to enable board_type
Add new property to enable board_type for NVRAM suffix.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:00 +08:00
c6d6fce243 brcmfmac: let board_type is optional
Let board_type is optional specified by dts property.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:00 +08:00
94c8800dae MLK-22364 brcmfmac: double check the D3 ACK state when wait event timeout
When system suspend, pcie bus write BRCMF_H2D_HOST_D3_INFORM cmd
into tcm32 mem to let host enter D3 mode, and wait the D3 ACK
interrupt. But sometime, the interrupt is comming lately then
cause wait event timeout, so double check the D3 ACK state.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:44:59 +08:00
c05fe15463 MLK-21756 brcmfmac: bcmsdh: attach device only func1 compatible string match
brcmfamc driver attach mmc func devices only when func1 device's
node exist, and whose compatible string match "brcm,bcm4329-fmac".

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:59 +08:00
b8328d0f95 MLK-19341 brcmfmac: bcmsdh: add shutdown handler to avoid kernel panic on reboot
When running wlan interface up/down stress test in background then run
reboot command, there have kernel panic as below message.
This issue is fixed by doing cleanup in shutdown handler.

Unable to handle kernel paging request at virtual address 7f0e9040
pgd = 86c20000
[7f0e9040] *pgd=86ecd811, *pte=00000000, *ppte=00000000
Internal error: Oops: 7 [#1] PREEMPT SMP ARM
task: 8603c000 task.stack: 86040000
PC is at device_shutdown+0x198/0x204
LR is at _raw_spin_unlock_irq+0x28/0x54
pc : [<804ee520>]    lr : [<809a70dc>]    psr: 20030013
sp : 86041e60  ip : 00000000  fp : 80c5b7e4
r10: 80cb0b24  r9 : 80f7e020  r8 : 86b0b844
r7 : 80fdce84  r6 : 86b0b810  r5 : 80f34ef0  r4 : 86b0b81c
r3 : 7f0e9018  r2 : ffffffff  r1 : 00000002  r0 : 00000000
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c53c7d  Table: 86c2006a  DAC: 00000051
Process systemd-shutdow (pid: 1, stack limit = 0x86040210)
Stack: (0x86041e60 to 0x86042000)
1e60: 00000000 00000000 80f0f704 aef99500 fee1dead 80107c44 86040000 00000000
1e80: 7eee5fd4 8014bb74 00000000 8014bdcc 00000000 00000000 00000000 8020464c
1ea0: 87336540 00000000 00000000 00000000 861b24e0 87336548 00000024 00000002
1ec0: 00000000 00000005 0000001e 80205c34 00000000 00000000 1c4a66cc 87336540
1ee0: 00000000 86041f08 86041f80 00000000 00000000 80205d5c 86041f04 86041f08
1f00: 00000000 00000000 00000001 00000000 00000024 86041f20 00000005 7eee521c
1f20: 7eee5350 00000004 7eee5f1c 00000010 7eee5364 00000005 7eee53f4 0000000a
1f40: 76ece6fc 00000001 86005b00 00000005 fffffffe fffffffe 86d1a000 fffff000
1f60: 80107c44 87336540 87336540 00000000 7eee5318 80205df0 00000000 00000004
1f80: 00000000 00000000 00000000 7eee53f4 7eee5318 00000000 00000000 00000000
1fa0: 00000058 80107a60 00000000 00000000 fee1dead 28121969 01234567 aef99500
1fc0: 00000000 00000000 00000000 00000058 00000000 ffffffff 00000000 7eee5fd4
1fe0: 004a0e18 7eee5c44 0048afa4 76d0b5e0 60030010 fee1dead 00000000 00000000
[<804ee520>] (device_shutdown) from [<8014bb74>] (kernel_restart+0xc/0x50)
[<8014bb74>] (kernel_restart) from [<8014bdcc>] (SyS_reboot+0xc8/0x1ac)
[<8014bdcc>] (SyS_reboot) from [<80107a60>] (ret_fast_syscall+0x0/0x54)
Code: eaffffb5 e5943040 e3530000 0afffff3 (e5933028)
---[ end trace cb8c3d96d6f26a91 ]---

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:59 +08:00
60561138a9 MLK-21611 brcmfmac: change message level for reading optional iovar data
Not all firmware set channel/ulp_sdioctrl, so change the error message
to debug level for reading chanspec/ulp_sdioctrl iovar data.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:58 +08:00
c5a54a59cf MLK-21071 brcmfmac: add PCIe shutdown handler to avoid system warning on reboot
If reboot command is issued when PCIe WLAN device is in connected
state, system kernel dump while booting as below log. This issue
is fixed by doing cleanup and disable PCIe interrupt in shutdown handler.

[    6.405135] irq 304: nobody cared (try booting with the "irqpoll" option)
[    6.425581] Call trace:
[    6.428034] [<ffff000008089c48>] dump_backtrace+0x0/0x3c8
[    6.433433] [<ffff00000808a024>] show_stack+0x14/0x20
[    6.438485] [<ffff000008d8bec0>] dump_stack+0x9c/0xbc
[    6.443538] [<ffff00000811e7e4>] __report_bad_irq+0x34/0xf0
[    6.449110] [<ffff00000811ec84>] note_interrupt+0x2ec/0x338
[    6.454682] [<ffff00000811bc2c>] handle_irq_event_percpu+0x44/0x58
[    6.460861] [<ffff00000811bc88>] handle_irq_event+0x48/0x78
[    6.466433] [<ffff00000811fa88>] handle_fasteoi_irq+0xa8/0x180
[    6.472265] [<ffff00000811ac1c>] generic_handle_irq+0x24/0x38
[    6.478009] [<ffff00000811b29c>] __handle_domain_irq+0x5c/0xb8
[    6.483841] [<ffff000008081960>] gic_handle_irq+0x78/0x174
[    6.489325] Exception stack(0xffff0000094f3d80 to 0xffff0000094f3ec0)
[    6.495765] 3d80: 0000000000000000 ffff000009502580 0000000000000709 ffff000008ac5b28
[    6.503593] 3da0: 0000000002222221 00ffffffffffffff 0000000008cd6205 00000000000000c0
[    6.511421] 3dc0: 00000032b5503510 ffff000008082000 0000000000001000 0000000000000000
[    6.519249] 3de0: 0000000034d5d91d 00008000b4a78000 ffff000009502580 0000000000000000
[    6.527077] 3e00: 0000000000000000 0000000000000000 0000000000000000 000000016cb15db1
[    6.534905] 3e20: 0000000000000001 ffff8000b900ce00 ffff8000b925e000 0000000000000001
[    6.542733] 3e40: 000000016c9c1569 ffff8000b925e000 ffff000009502580 0000000000000400
[    6.550561] 3e60: 00000000417b0018 ffff0000094f3ec0 ffff000008a308a8 ffff0000094f3ec0
[    6.558389] 3e80: ffff000008a307f4 0000000040000045 ffff8000b925e060 0000000000000001
[    6.566217] 3ea0: ffffffffffffffff ffff8000b925e000 ffff0000094f3ec0 ffff000008a307f4
[    6.574045] [<ffff000008083230>] el1_irq+0xb0/0x124
[    6.578925] [<ffff000008a307f4>] cpuidle_enter_state+0x134/0x228
[    6.584930] [<ffff000008a30920>] cpuidle_enter+0x18/0x20
[    6.590242] [<ffff00000810c75c>] call_cpuidle+0x1c/0x40
[    6.595465] [<ffff00000810c9ac>] do_idle+0x1a4/0x1e0
[    6.600428] [<ffff00000810cb84>] cpu_startup_entry+0x24/0x28
[    6.606088] [<ffff000008d9e798>] rest_init+0xd0/0xe0
[    6.611056] [<ffff0000093b0b70>] start_kernel+0x398/0x3ac

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:57 +08:00
bbed664da4 MLK-21580 brcmfmac: add BRCMF_FEAT_WOWL check when set wowlan parameters
Only set wowlan parameters when the interface's BRCMF_FEAT_WOWL
flag is set.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:57 +08:00
24aa2e3334 MLK-21579 brcmfmac: bcmsdh: move the func->num check early in .brcmf_ops_sdio_suspend()
Move the func->num check early in .brcmf_ops_sdio_suspend() to
save suspend time.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:57 +08:00
9eecd7fab1 MLK-21502 brcmfmac: fix the load issue for bcm4339
Current brcmfmac driver cannot load cyw4339 module and always report
bus timeout as below log.

brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4339-sdio for chip BCM4339/2
brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4339-sdio for chip BCM4339/2
brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-11), device may have limited channels available
brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
brcmfmac: brcmf_bus_started: failed: -110
brcmfmac: brcmf_attach: dongle is not responding: err=-110
brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
brcmfmac: brcmf_bus_started: failed: -110
brcmfmac: brcmf_attach: dongle is not responding: err=-110
brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed
brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
brcmfmac: brcmf_c_preinit_dcmds: Retreiving version information failed, -110
brcmfmac: brcmf_bus_started: failed: -110
Unable to handle kernel NULL pointer dereference at virtual address 00000004
pgd = 50d469b0
[00000004] *pgd=00000000
Internal error: Oops: 817 [#1] PREEMPT SMP ARM
Modules linked in: mxc_vadc mxc_dcic mx6s_capture ov5640_camera_v2 brcmfmac brcmutil
CPU: 0 PID: 91 Comm: kworker/0:3 Not tainted 4.19.35-04384-g50ca4a9 #1147
Hardware name: Freescale i.MX6 SoloX (Device Tree)
Workqueue: events request_firmware_work_func
PC is at brcmf_attach+0x234/0x3d8 [brcmfmac]
LR is at __slab_free+0x1a4/0x308
pc : [<7f022500>]    lr : [<8020d7a8>]    psr: 20010013
sp : a8679e78  ip : a8679de8  fp : 00000000
r10: 00000000  r9 : a8ef0c00  r8 : a9ffa1a0
r7 : a868b808  r6 : a9ff8460  r5 : ffffff92  r4 : a9ff81a0
r3 : 00000000  r2 : 588fd8f8  r1 : 00000000  r0 : 00000000
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c53c7d  Table: a901c04a  DAC: 00000051
Process kworker/0:3 (pid: 91, stack limit = 0xbe6d797a)
Stack: (0xa8679e78 to 0xa867a000)
9e60:                                                       7f03540c 00000000
9e80: a97cecc0 00000008 00000001 a8ecf800 81004d08 a8ecfc00 a868b808 7f0328b8
9ea0: 00000002 00000008 00000001 7f02adfc 00000840 00010000 00000840 bc3ef180
9ec0: a92abcc0 00000000 00000000 588fd8f8 ab731d80 a92ab454 a8398340 00000014
9ee0: 81004d08 00000000 a92ab440 a9461140 ab731d80 7f023620 a9eec980 588fd8f8
9f00: a9461480 81004d08 ab731d80 ab734f00 00000000 a9461484 00000000 8054c058
9f20: 00000000 00000003 a9461140 588fd8f8 ab731d80 a9461480 a865a280 80146690
9f40: 81003d00 ab731d98 a865a280 a865a294 ab731d80 81003d00 ab731d98 a8678000
9f60: 00000008 8014697c 00000000 a8643e00 a8643dc0 00000000 a865a280 80146950
9f80: a8643e1c a8075ebc 00000000 8014bfc8 a8643dc0 8014bea4 00000000 00000000
9fa0: 00000000 00000000 00000000 801010e8 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[<7f022500>] (brcmf_attach [brcmfmac]) from [<7f02adfc>] (brcmf_sdio_firmware_callback+0x4c4/0x74c [brcmfmac])
[<7f02adfc>] (brcmf_sdio_firmware_callback [brcmfmac]) from [<7f023620>] (brcmf_fw_request_done+0x188/0x214 [brcmfmac])
[<7f023620>] (brcmf_fw_request_done [brcmfmac]) from [<8054c058>] (request_firmware_work_func+0x4c/0x88)
[<8054c058>] (request_firmware_work_func) from [<80146690>] (process_one_work+0x138/0x3f8)
[<80146690>] (process_one_work) from [<8014697c>] (worker_thread+0x2c/0x554)
[<8014697c>] (worker_thread) from [<8014bfc8>] (kthread+0x124/0x154)
[<8014bfc8>] (kthread) from [<801010e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0xa8679fb0 to 0xa8679ff8)
9fa0:                                     00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
Code: e3530000 0a000011 e59432cc e3a00000 (e5839004)
---[ end trace 8b8e3996f6f715bf ]---

cyw4339 doesn't support ulp_sdioctrl iovar and ulp mode, the current logic make
sdio bus down/up, and trigger firmware load twice. So remove the ulp status
check for cyw4339.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:53 +08:00
a0f14445b3 MLK-21493 brcmfmac: move .brcmf_bus_preinit() after changing bus state
Moving the brcmf_bus_preinit() call allows the bus code to do some
required initialization before handling firmware control messages.

.brcmf_bus_preinit() already is called in .brcmf_bus_started() when
bus is ready. So remove it from .brcmf_c_preinit_dcmds().

Fixes: 383c26d2ea2f(MLK-18675-20 brcmfmac: Support wake on ping packet)
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:53 +08:00
41d3b41dd5 MLK-21492 brcmfmac: remove func0 that is not provied by mmc stack
func0 is not provided by the mmc stack as a function when probing.
commit 99d7b6fdfc8c(brcmfmac: Remove func0 from function array)
already remove the func0.

But commit c37fa19e0128(brcmfmac: Remove array of functions) add
fun0 again. That cause NULL pointer issue.

Fixes: c37fa19e0128(brcmfmac: Remove array of functions)
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:52 +08:00
731c91883d brcmfmac: Fix access point mode
commit 861cb5eb46 ("brcmfmac: Fix access point mode") upstream.

Since commit 1204aa17f3 ("brcmfmac: set WIPHY_FLAG_HAVE_AP_SME flag")
the Raspberry Pi 3 A+ (BCM43455) isn't able to operate in AP mode with
hostapd (device_ap_sme=1 use_monitor=0):

brcmfmac: brcmf_cfg80211_stop_ap: setting AP mode failed -52

So add the missing mgmt_stypes for AP mode to fix this.

Fixes: 1204aa17f3 ("brcmfmac: set WIPHY_FLAG_HAVE_AP_SME flag")
Suggested-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-11-25 15:44:52 +08:00
28b7c0bc8d MLK-21161-04 brcmfmac: fix 43455 CRC error under SDIO 3.0 SDR104 mode
This patch fixes 43455 CRC error while running throughput test with
suspend/resume stress test.

The continuous failure messages before system crash:
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 25600 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 24576 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit d6e37c2eb0)
2019-11-25 15:44:52 +08:00
02bf1d13f6 MLK-21161-03 brcmfmac: add sleep in bus suspend and cfg80211 resume functions
With asynchronous suspend/resume feature, suspend and resume callbacks to
be executed in parallel with each other. It makes bus changes the state to
BRCMF_BUS_DOWN before all brcmf_cfg80211_suspend IOVAR executions.
The same situation also happens in resume procedure and causes PM mode
keeps in PM_MAX after resume. In order to fix the race condition, We add
one second sleep in bus suspend and cfg80211 resume function.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit fdb676ce00)
2019-11-25 15:44:51 +08:00
475eade733 MLK-21161-02 brcmfmac: validate ifp pointer in brcmf_txfinalize
We got ifp null pointer kernel panic in brcmf_txfinalize after removing
Wi-Fi USB dongle when data was transmitting, The root cause is that
interface was removed before calling brcmf_txfinalize in
brcmf_fws_dequeue_worker and finally caused kernel panic.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 3f94bfe6fe)
2019-11-25 15:44:50 +08:00
7b00dfee5a MLK-21161-01 brcmfmac: To fix kernel crash on out of boundary access
To trunkcate the addtional bytes, if extra bytes are received.
Current code only have a warning and proceed without handling it.
But in one crash dump reported by DVT, these causes the
crash intermittently. So the processing is limit to the skb->len.

Signed-off-by: Raveendran Somu <raveendran.somu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit f7112c027e)
2019-11-25 15:44:50 +08:00
9198db3a1a MLK-20681 brcmfmac: add brcmfmac platform device pinctrl state support
Add brcmfmac platform device pinctrl state support. That is useful
for dynamically configurate pin group for different wlan chips.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 88f2834cd5)
2019-11-25 15:44:49 +08:00
0536e4052d MLK-20680 brcmfmac: add time delay for pcie device exit D3 mode
- The current timeout value is not enough for MB transaction read
when modem enter D3 mode, so increase the timeout value to match
the D3 mode timing requirement.
- Add 10 ms delay for pcie device to exit D3 state and enter D0 state.
- Remove the duplicated code for SBMBX register access.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 05601af462)
2019-11-25 15:44:49 +08:00
00175c4567 MLK-20679 brcmfmac: reset two D11 cores if chip has two D11 cores
There are two D11 cores in RSDB chips like 4359. We have to reset two
D11 cores simutaneously before firmware download, or the firmware may
not be initialized correctly and cause "fw initialized failed" error.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked commit from 8f50bea935)
2019-11-25 15:44:49 +08:00
6d246f2947 MLK-20678 brcmfmac: avoid the error log print when get the wowl_wakeind failed
Not all chips support wowlan, then get wowlan wakeup event failed.
Change the log into debug level.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 47b205952c)
2019-11-25 15:44:48 +08:00
5d13e5b656 MLK-20190-03 brcmfmac: check thre return value of .brcmf_fil_iovar_data_get()
Check the return value of .brcmf_fil_iovar_data_get() to fix
the coverity issue of "error handling issue".

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:44:47 +08:00
fc786002e6 MLK-20190-02 brcmfmac: init the wlfc_mode variable before it is used
Init the wlfc_mode variable before it is used to fix
coverity issue of "Uninitialized variable".

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:44:47 +08:00
9eb0713d6c MLK-18993 brcmfmac: configure wowl parameters only if firmware support wowl
Configure wowl parameters only if firmware support wowl.

Tested-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:ceccd33fb63e49cb816a827c0dfcb8abf7059e7f)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:47 +08:00
0d62633290 MLK-19517-18 brcmfmac: map 802.1d priority to precedence level based on AP WMM params
In WLAN, priority among various access categories of traffic is
always set by the AP using WMM parameters and this may not always
follow the standard 802.1d priority.
In this change, priority is adjusted based on the AP WMM params
received as part of the Assoc Response and the same is later used
to map the priority of all incoming traffic.

This change should fix the following 802.11n certification tests:
* 5.2.31 ACM Bit Conformance test
* 5.2.32 AC Parameter Modification test

Signed-off-by: Saravanan Shanmugham <sasm@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:62657fc5931db1c1d48c3181f2f4effebf37a74b)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:46 +08:00
8e9b368c6e MLK-19517-14 brcmfmac: increase max hanger slots from 1K to 3K in fws layer
Will enable FMAC to push more packets to bus tx queue and help
improve throughput when fws queuing is enabled. This change is
required to tune the throughput for passing WMM CERT tests.

Signed-off-by: Madhan Mohan R <MadhanMohan.R@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:48195bf1b7dea8c6030dfce45900dda60f2d0ea4)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:46 +08:00
94cecc296b MLK-19517-12 brcmfmac: only generate random p2p address when needed
P2p spec mentioned that the p2p device address should be the globally
administered address with locally administered bit set. Therefore,
follow this guideline by default.

When the primary interface is set to a locally administered address, the
locally administered bit cannot be set again. Generate a random locally
administered address for this case.

Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:930ac6e9230a48a775e55ee6cb31c4dffe5d5dcc)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:46 +08:00
6a0c5c1cfa MLK-19517-11 brcmfmac: P2P CERT 6.1.9-Support GOUT handling P2P Presence Request
Send P2P Presence Response from the p2p interface address instead
of the p2p device address.

Signed-off-by: Madhan Mohan R <MadhanMohan.R@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:1ce946c329e68457fd8e72da33d17251a7f2377c)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:45 +08:00
10143c9661 MLK-19517-08 brcmfmac: fix unused variable building warning message
The variable "wq_flags" is not used anymore. Remove it.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:453591909a747bede4ff3fabe1d4073370f920f4)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:45 +08:00
7967e27e83 MLK-19517-04 brcmfmac: make setting SDIO workqueue WQ_HIGHPRI a module parameter
With setting sdio_wq_highpri=1 in module parameters, tasks submitted to
SDIO workqueue will put at the head of the queue and run immediately.
This parameter is for getting higher TX/RX throughput with SDIO bus.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: 7c2b310299f051be555c6928f0f858fdbac35abb)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:44 +08:00
d776333793 MLK-19517-03 revert: brcmfmac: add a module parameter to set scheduling priority of sdio_dpc
will use WQ_HIGHPRI instead.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: 2925b73171942933311e87ab51747a055cfd8abf)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:44 +08:00
d848f03913 MLK-19516 brcmfmac: fix 4339 CRC error under SDIO 3.0 SDR104 mode
This patch fixes 4339 CRC error while running Tput test with
suspend/resume test script. Update F2 Watermark to 48 to avoid
CRC error.

The continuous failure messages before system crash:
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 25600 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 24576 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame

Tested-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:43 +08:00
30ad29bbf7 MLK-18675-21 brcmfmac: Remove WOWL configuration in disconnect state
Set wowl configuration in disconnect state is redundant.
Remove it to fix no scan result issue after resume.

Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:43 +08:00
6aeb870197 MLK-18675-20 brcmfmac: Support wake on ping packet
FMAC driver need to provide a dummy wowlan filter for kernel and
provided the well configured wowlan stack. So the system will
keep driver in connected state in suspend mode and can be wake
up by ping packet.

Enable unicast packet filter before system suspend and
disable it after resume.

Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:42 +08:00
bf8d6bbcc4 MLK-18675-19 brcmfmac: make firmware eap_restrict a module parameter
When eap_restrict is enabled, firmware will toss non-802.1x frames from
tx/rx data path if station not yet authorized.
Internal firmware eap_restrict is disabled by default. This patch makes
it possible to enable firmware eap_restrict by specifying
eap_restrict=1 as module parameter.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:41 +08:00
23235ce8d9 MLK-18675-18 brcmfmac: add a module parameter to set scheduling priority of sdio_dpc
To enhance RX throughput, we add a module parameter "sdio_dpc_prio" to let
user can set scheduling  priority for sdio_dpc. It can improve RX
throughput by reducing the receiving time in sdio_dpc.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:41 +08:00
aca283a438 MLK-18675-16 brcmfmac: do not print ulp_sdioctrl get error
Don't print ulp_sdioctrl get error as errors are expected for non ulp
cases.

Signed-off-by: Naveen Gupta <nagu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:41 +08:00
dd38337def MLK-18675-15 brcmfmac: support AP isolation
Hostap daemon has a parameter "ap_isolate which is used to prevent
low-level bridging of frames between associated stations in the BSS.
For driver side, we add cfg80211 ops method change_bss to support
setting AP isolation from user space.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:40 +08:00
02aca044c6 MLK-18675-14 brcmfmac: Add support for 43428 SDIO device ID
The device 43428 is a new SDIO device ID but shares the same WLAN core
with device 43430a1. It is a 1x1 802.11b/g/n 2.4GHz HT20,
256-QAM/Turbo QAM WLAN chip.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:40 +08:00
72f8f2a80c brcmfmac: Fix compilation error
This patch fix the below compilation errors.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_ulp_pre_redownload_check’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2631:10: error: implicit declaration of function ‘brcmf_sdiod_regrb’; did you mean ‘brcmf_sdiod_readb’? [-Werror=implicit-function-declaration]
  value = brcmf_sdiod_regrb(bus->sdiodev, SDIO_CCCR_IOEx, &err);
          ^~~~~~~~~~~~~~~~~
          brcmf_sdiod_readb
In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:42:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:437:2: error: implicit declaration of function ‘brcmf_sdiod_regrl’; did you mean ‘brcmf_sdiod_readl’? [-Werror=implicit-function-declaration]
  brcmf_sdiod_regrl(sdh, D11SHM_ADDR(offset), ret)
  ^~~~~~~~~~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2636:18: note: in expansion of macro ‘D11SHM_RD’
   ulp_wake_ind = D11SHM_RD(bus->sdiodev, M_ULP_WAKE_IND(
                  ^~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:434:2: error: implicit declaration of function ‘brcmf_sdiod_regwl’; did you mean ‘brcmf_sdiod_readl’? [-Werror=implicit-function-declaration]
  brcmf_sdiod_regwl(sdh, D11SHM_ADDR(offset), val, ret)
  ^~~~~~~~~~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2654:4: note: in expansion of macro ‘D11SHM_WR’
    D11SHM_WR(bus->sdiodev, M_DS1_CTRL_SDIO(
    ^~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_firmware_callback’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:4388:9: error: implicit declaration of function ‘brcmf_bus_started’; did you mean ‘brcmf_bus_txctl’? [-Werror=implicit-function-declaration]
   err = brcmf_bus_started(dev);
         ^~~~~~~~~~~~~~~~~
         brcmf_bus_txctl
cc1: some warnings being treated as errors
scripts/Makefile.build:303: recipe for target 'drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.o' failed
make[6]: *** [drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.o] Error 1

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:40 +08:00
2ce630c00f brcmfmac: pass struct in brcmf_fw_get_firmwares()
As per 'commit d09ae51a4b ("brcmfmac: pass struct in
brcmf_fw_get_firmwares()")', make changes in the brcmf_fw_get_firmwares()
call to fix the compilation error.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_ulp_reinit_fw’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2597:45: error: ‘BRCMF_FW_REQUEST_NVRAM’ undeclared (first use in this function); did you mean ‘BRCMF_FW_TYPE_NVRAM’?
  err = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM,
                                             ^~~~~~~~~~~~~~~~~~~~~~
                                             BRCMF_FW_TYPE_NVRAM
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2597:45: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2598:17: error: passing argument 3 of ‘brcmf_fw_get_firmwares’ from incompatible pointer type [-Werror=incompatible-pointer-types]
          sdiodev->fw_name, sdiodev->nvram_name,
          ~~~~~~~^~~~~~~~~
In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:22,
                 from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:42:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:93:14: note: expected ‘void (*)(struct device *, int,  struct brcmf_fw_request *)’ but argument is of type ‘char *’
       void (*fw_cb)(struct device *dev, int err,
       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       struct brcmf_fw_request *req));
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2597:8: error: too many arguments to function ‘brcmf_fw_get_firmwares’
  err = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM,
        ^~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:22,
                 from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:42:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:92:5: note: declared here
 int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req,
     ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:39 +08:00
a709b000cc MLK-18675-12 brcmfmac: DS1 Exit should re download the firmware.
In Deep Sleep mode ARM is off and once Exit trigger comes than
Mail Box Interrupt comes to Host and whole Re Initiation should be done
in the ARM to start TX/RX.

Signed-off-by: Naveen Gupta <nagu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>

Vipul: Fixed merge conflicts
Conflict:
	drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:39 +08:00
288a2e34b7 MLK-18675-10 brcmfmac: calling skb_orphan before sending skb to SDIO bus
Linux 3.6 introduces TSQ which has a per socket threshold for TCP Tx
packet to reduce latency. In fcmode 1/2, host driver enqueues skb in
hanger and TCP doesn't push new skb frees until host frees the skb when
receiving fwstatus event. So using skb_orphan before sending skb to bus
will make the skb removing the ownership of socket. With this patch, we
got better throughput in fcmode 1/2.

Tested 43455 TCP throughput in 20 MHz bandwidth with/without this patch.
fcmode 0: 59.5 / 59.6 (Mbps)
fcmode 1: 59.3 / 23.4 (Mbps)
fcmode 2: 59.6 / 21.5 (Mbps)

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:37 +08:00
a97e286fdc MLK-18675-06 brcmfmac: set apsta to 1 when AP start on primary interface.
APSTA can work on two band concurrently with using VSDB(Virtual
Simultaneous Dual-Band) or RSDB(Real Simultaneous Dual-Band) features.
In this case, we have to keep apsta is 1 in firmware side. However, if
we start wpa_supplicant on wlan0 and then start hostapd on wlan 1, the
apsta will be set to 0, and we will see data stall on wlan0(station)
So that, we only set apsta to 1 when AP start on primary interface.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:37 +08:00
6fce59f3da MLK-18675-04 brcmfmac: return -EPERM when getting error in vendor command handler
Firmware returns proprietary error code when getting error in
fil_cmd_data_set or fil_cmd_data_get. Sometimes the vendor tool or
utilities which uses libnl may stuck in some commands when wl is down.
For example, issue "scan" command after issuing "down" command, the
"scan" command will be the blocking call and stuck as no response from
firmware. It is caused by that firmware returns BCME_NOTUP(-4) when wl
is down, but in Linux the -4 is -EINTR, so libnl catches the error and
not pass to upper layer.
Because of that, the driver should return Linux error code instead of the
proprietary error code, and the tools or utilities need to get the real
firmware error code by another command "bcmerrorstr" after receiving
the error.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:37 +08:00
bfb37fbab4 MLK-18675-03 brcmfmac: Add sg parameters dts parsing
broken_sg_support, sd_head_align, and sd_sgentry_align are used in
brcmfmac code but not configurable in dts file. Add the parsing logic.
Now they can be configured like below in dts:
	brcm,broken_sg_support;
	brcm,sd_head_align = /bits/ 16 <4>;
	brcm,sd_sgentry_align = /bits/ 16 <4>;

Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:36 +08:00
5b0d72e6ce MLK-18675-02 brcmfmac: Set F2 blksz and Watermark to 256 for 4373
We got SDIO_CRC_ERROR with 4373 on SDR104 when doing bi-directional
throughput test. Setting F2 blocksize and enable watermark to 256 to
guarantee the operation stability.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflictts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:36 +08:00
0f2229eedc MLK-22746-3 wireless: Changes for wireless and cfg80211 support
Pulling the following commits and some general changes from custom
v3.10 kernel for supporting qcacld2.0 on kernel v4.9.11.
1. cfg80211: Using new wiphy flag WIPHY_FLAG_DFS_OFFLOAD
When flag WIPHY_FLAG_DFS_OFFLOAD is defined, the driver would handle
all the DFS related operations. Therefore the kernel needs to ignore
the DFS state that it uses to block the userspace calls to the driver
through cfg80211 APIs. Also it should treat the userspace calls to
start radar detection as a no-op.

Please note that changes in util.c is not picked up explicitly.
Kernel v4.9.11 uses wrapper cfg80211_get_chans_dfs_required which takes
care of this change.

Change-Id: I9dd2076945581ca67e54dfc96dd3dbc526c6f0a2
IRs-Fixed: 202686

2. New db.txt from git/sforshee/wireless-regdb.git
CONFIG_CFG80211_INTERNAL_REGDB is enabled in build. This causes
kernel warn messages as db.txt is empty. A new db.txt is added
from:
git://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git

IRs-Fixed: 202686

3. Picked up the declaration and definition of the function
cfg80211_is_gratuitous_arp_unsolicited_na

Change-Id: I1e4083a2327c121073226aa6b75bb6b5b97cec00
CRs-fixed: 1079453

Signed-off-by: Nakul Kachhwaha <nkachh@codeaurora.org>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
(TODO: checkpatch warnings)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:36 +08:00
b4b30ffe8a hwmon: mma8451: Add regulator_disable to avoid WARN_ON
In probe function, if probe fails, the enabled regulator will cause a
WARN_ON.
Add regulator_diable when error occurs in probe function.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 15:44:32 +08:00
8c4d12b5af hwmon: mag3110: Add regulator_disable to avoid WARN_ON
In probe function, if probe fails, the enabled regulator will cause a
WARN_ON.
Add regulator_diable when error occurs in probe function.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 15:44:32 +08:00
af3730f2dc input: isl29023: Add regulator_disable to avoid WARN_ON
In probe function, if probe fails, the enabled regulator will cause a
WARN_ON.
Add regulator_diable when error occurs in probe function.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 15:44:32 +08:00
42520c8570 MLK-13472: hwmon: mxc_mma8451: add empty sentinel entry at the end of i2c_device_id table
This is fixing the build when the driver is enabled as a module, when
CONFIG_MXC_MMA8451=m

Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:31 +08:00
a9c8703f49 MLK-11469-01 hwmon: mma8451: Add mma8451 driver support on i.MX6Q/DL/SX platform.
Add mma8451 driver support for i.MX6Q/DL/SX platform. The code derives from 3.10.y branch.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>

Added explicit dependency on INPUT_POLLDEV during 4.14 rebase so that it
doesn't break the arm64 build

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:31 +08:00
ca372d023a input: misc: add sensors makefile strings
Add makefile and kconfig strings for rpmsg sensor and isl29023.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 15:44:30 +08:00
33c0437a78 hwmon: mag3110: add mag3110 makefile and kconfig string
Add makefile and kconfig string for mag3110.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 15:44:30 +08:00
d047f4467e input: misc: fxls8471: add motion sensor fxls8471_i2c
Add Freescale fxls8471 motion sensor support files.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-11-25 15:44:30 +08:00
24a8460504 MLK-10833-2 hwmon: mag3110: use global variable instead of macro define
Use global variable instead of macro "MAG3110_IRQ_USED" that is more
flexible.

Signed-off-by: Fugang Duan <B38611@freescale.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:29 +08:00
f914441e07 MLK-10833-1 hwmon: mag3110: Add mag3110 driver support on i.MX6Q/DL/SX platform.
Add mag3110 driver support for i.MX6Q/DL/SX platform. The code derives from 3.10.y branch.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: dd027baab7652c62d26f1749f334099e4dbe61c9)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:29 +08:00
917ca5df66 MLK-13471: fxls8471: add a symbol export to fix module build
When CONFIG_SENSOR_FXLS8471=m build was failing due to missing
exported symbol. This patch export the missing symbol.

Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:28 +08:00
16a52e9040 MLK-11957 input: misc: fxls8471: remove unnecessary .kfree()
The driver kfree the global memory that is not correct. The patch
remove them.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:27 +08:00
21fa2ebec7 MLK-11206: input: misc: fxls8471: support ±2g/±4g/±8g dynamically selection
Support ±2g/±4g/±8g dynamically selection for motion sensor fxls8471.

Set the sensor mode to standby mode before changing the scale range
with the command "echo 0 > enable". The scale range can be changed
with the command "echo 0/1/2 > range".

Signed-off-by: Gao Pan <b54642@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 6824cff93d368eafbf96c71fad541f9bc2502e3a)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:27 +08:00
c08db55e18 MLK-10948 input: misc: fxls8471: add motion sensor fxls8471
Add Freescale fxls8471 motion sensor.

Signed-off-by: Gao Pan <b54642@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 20cfe2d9d9305559e35fe2e508d5a70b057ffc70)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:26 +08:00
c69c9ca4d0 MLK-20234 isl29023: fix Coverity warning
Fix the Coverity warning "divide_by_zero".

If "rext" is incorrectly set as zero in dts file, "divide_by_zero" will
happen at line 960. So add a judgment condition here, and let "rext" uses
default value when it is equal to zero.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 999f94e0d7524640381eb4b3f6590f213533679e)
2019-11-25 15:44:26 +08:00
57ee653284 MLK-11471-01 input: misc: isl29023: Add isl29023 driver support on i.MX6Q/DL/SX platform.
Add isl29023 driver support for i.MX6Q/DL/SX platform. The code derives from 3.10.y branch.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: b0134420bba0022151499f1bb15e0d5daba970fa)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:26 +08:00
2d58a1e6aa MLK-11468 input: mma8450: evbug module will keep print message.
evbug will open the mma8450 on i.MX6SL_EVK and mma8450 will work in 2G mode
by default.
That is the reason why mma8450 logs will be printed out. The main changes
is below:

 * Remove the open(), close() hook out of the drivers. The open() and
   close() hook in input framework is defined as void type. It isn't
   strictly safe in logic when some error happends. So remove them out.
 * Modify the mma8450 to standby mode by default. It will be more power
   saving and there would be no log printing out after booting up.
 * Provide the sys interface to modify the mma8450 work modes. Then the
   higher layer can modify the the mma8450 work mode via the interface. It
   would be much safer.There would be a sclaemode interface in the folder
   of
   /sys/devices/soc0/soc.1/2100000.aips-bus/21a0000.i2c/i2c-0/0-001c/scalemode
   User can use cat to read the current scalemode and echo to write. The
   mode is defined as: MODE_STANDBY: 0  MODE_2G:1  MODE_4G:2  MODE_8G:3
 * Add mutex to protect and some error handling.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit c51a786078fd569ce95eb6dcf09c76d1b3c0f172)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:25 +08:00
600e21d55c MLK-11467 input: mma8450: Add chip id check in probe
Add chip ID check in probe function. The mma8450 is
on the E-INK daughter board. When the daughter board
is not pluged, there would be polling error log
continuously. Add the check to avoid this.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit e9f2c4cf673dee1527925f30a9f3fd137d9799ad)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:25 +08:00
2ae74bc014 MLK-17837-01 input: misc: rpmsg_input: add rpmsg virtual sensor driver
NXP i.MX7ULP EVK boards all sensors connect with M4 core, A core
has to conmunicate with sensors by virtual io bus like rpmsg bus.
The driver implement the virtual sensor input driver to configure
sensors active/idle/delay actions and report the sensors' event to
user space.

Supply below sysfs for user to enable/disable detector and counter,
set poll delay:
	/sys/class/misc/step_counter/enable
	/sys/class/misc/step_detector/enable
	/sys/class/misc/step_counter/poll_delay

Reviewed-by: Elven Wang <elven.wang@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:24 +08:00
558bc91d93 MLK-17061-1 sensor: set sensor interrupt pins as open-drain
The sensors share an interrupt pin on imx8qm/imx8qxp mek.
As a result, the interrupt signals will be interfered by
each other in default push-pull status.

This patch sets sensor interrupt pins as open-drain when
necessary.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
(cherry-picked from 48bcb7aafa2a3ced923d1a1753bb19d89a9fc273)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:23 +08:00
33349dd8ad MLK-17061-1 sensor: set sensor interrupt pins as open-drain
The sensors share an interrupt pin on imx8qm/imx8qxp mek.
As a result, the interrupt signals will be interfered by
each other in default push-pull status.

This patch sets sensor interrupt pins as open-drain when
necessary.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
(cherry-picked from 48bcb7aafa2a3ced923d1a1753bb19d89a9fc273)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:23 +08:00
2ff7fc5130 MLK-11218: misc: fxos8700: support ±2g/±4g/±8g dynamically
Support ±2g/±4g/±8g dynamically selection for motion sensor fxos8700.

Set the sensor mode to standby mode before changing the scale range
with the command "echo 0 > enable". The scale range can be changed
with the command "echo 0/1/2 > range".

Signed-off-by: Gao Pan <b54642@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 74c9af0a5806fb5c926ffdab3145fc1680fc87e6)
TODO: checkpatch warnings
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:21 +08:00
a0f31f355b MLK-10835-2 misc: fxos8700: add Freescale FXOS8700 6-Axis Acc and Mag Combo Sensor
Add Freescale FXOS8700 6-Axis Acc and Mag Combo Sensor

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit fd3fa10c00)
2019-11-25 15:44:20 +08:00
40e60806e6 MLK-10835-1 misc: fxas2100x: add Freescale FXAS2100X gyroscope sensor
Add Freescale FXAS2100X gyroscope sensor

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit 2ffcd8b906)
2019-11-25 15:44:20 +08:00
3580222e84 MLK-10835-3 input: misc: mpl3115: add Freescale MPL3115 pressure temperature sensor
Add Freescale MPL3115 pressure temperature sensor.

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit 16bf758cad)
2019-11-25 15:44:19 +08:00
d69d93e593 MLK-21876-20 input: misc: isl29023: add uapi headfile for yocto build pass
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:44:19 +08:00
3b49ab9577 MLK-23010 thermal: imx_sc_thermal: Correct message format to avoid stack corruption
The SCU message should be 32-bit aligned, as MU transmits data with
32-bits aligned and SCU could modify the message data, if the message
is NOT 32-bit aligned, it will cause stack corruption when SCU writes
the response data, with CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG enabled,
kernel stack protection will have panic. Correct the message to 32-bit
width to avoid this issue.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-11-25 15:44:17 +08:00
1d79088bb7 thermal: imx_sc_thermal: Add system-wide device cooling to all thermal zones
It makes more sense to trigger system-wide device cooling for
all thermal zones rather than thermal zone0 ONLY.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:16 +08:00
d5e238ed4d thermal: qoriq: add thermal monitor unit version 2 support
Thermal Monitor Unit v2 is introduced on new Layscape SoC.
Compared to v1, TMUv2 has a little different register layout
and digital output is fairly linear.

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:16 +08:00
e38d9c5e40 thermal: imx: Add device cooling support
Register device cooling for thermal zone manually, when temperature
exceeds passive trip, system wide cooling notification will be triggered.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:15 +08:00
eafc897eb6 thermal: imx8mm: Add device cooling support
Register device cooling for first thermal zone manually, when
temperature exceeds passive trip, system wide cooling notification
will be triggered.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:15 +08:00
23eba08685 thermal: imx8mm: Add support for i.MX8MM thermal monitoring unit
i.MX8MM has a thermal monitoring unit(TMU) inside, it ONLY has one
sensor for CPU, add support for reading immediate temperature of
this sensor.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:15 +08:00
8697354487 dt-bindings: thermal: imx8mm-thermal: Add binding doc for i.MX8MM
Add thermal binding doc for Freescale's i.MX8MM Thermal Monitoring Unit.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:14 +08:00
6f5ee8814f thermal: qoriq: Add device cooling support
Register device cooling for first thermal zone manually, when
temperature exceeds passive trip, system wide cooling notification
will be triggered.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:14 +08:00
a74bea8231 thermal: imx_sc: Add device cooling support
Register device cooling for each thermal zone manually, when
temperature exceeds passive trip, system wide cooling notification
will be triggered.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:14 +08:00
2afca9456e thermal: Add generic device cooling support
To compatible with previous implementation, add generic device
cooling support, each thermal zone will register a cooling
device, and when temperature exceed passive trip, the device
cooling driver will send out a system wide notification, each
device supporting cooling will need to register device cooling
and takes action when passive trip is exceeded;

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:13 +08:00
1d22bec32b thermal: imx_sc: Add i.MX8QM thermal support
Add i.MX8QM system controller thermal driver support,
as there are multiple thermal zones in i.MX8QM, and when
resource is powered off, getting temperature from SCU
firmware will fail, so this patch also handles this case
by printing the failure once and return temperature 0 for
the powered-off resource.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:13 +08:00
bf4ca067a6 thermal: imx_sc: add i.MX system controller thermal support
i.MX8QXP is an ARMv8 SoC which has a Cortex-M4 system controller
inside, the system controller is in charge of controlling power,
clock and thermal sensors etc..

This patch adds i.MX system controller thermal driver support,
Linux kernel has to communicate with system controller via MU
(message unit) IPC to get each thermal sensor's temperature,
it supports multiple sensors which are passed from device tree,
please see the binding doc for details.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:44:12 +08:00
3cbeaea8b5 iio: adc: Add imx8qxp adc driver support
i.MX8QXP B0 and i.MX8QM has the same ADC IP, so add the
adc driver to support it.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
2019-11-25 15:44:10 +08:00
0ee9f9d5e3 MLK-11476 iio: adc: Enable i.MX6SX adc driver.
Enable i.MX6SX adc driver. ADC driver will try getting ADC controller
channel number via device tree, because i.MX chip enable 4 channels
on each controller.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit 14a6a98f64e26702b1c0ecfc7d58a45ee5752d54)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:44:10 +08:00
81dbccf468 mtd: nand: raw: gpmi-nand: fix the qxp clk name and runtime issues
fix the qxp clk name and some runtime suspend/resume issue

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 15:44:07 +08:00
9795bce29c mtd: nand: raw: gpmi-nand: add all supported platform info
add all supported platform info

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 15:44:06 +08:00
f528bbd0a9 mtd: nand: raw: gpmi-nand: fix the suspend/resume issue
leverage the runtime pm for system suspend/resume

Signed-off-by: Han Xu <han.xu@nxp.com>
2019-11-25 15:44:06 +08:00
2fe2372125 drivers/mtd: Add deep sleep support for IFC
Add support of suspend, resume function to support deep sleep.
Also make sure of SRAM initialization  during resume.

Signed-off-by: Raghav Dogra <raghav.dogra@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
2019-11-25 15:44:05 +08:00
f0b276a30d can: flexcan: add CAN wakeup function for i.MX8
The System Controller Firmware (SCFW) is a low-level system function
which runs on a dedicated Cortex-M core to provide power, clock, and
resource management. It exists on some i.MX8 processors. e.g. i.MX8QM
(QM, QP), and i.MX8QX (QXP, DX).

SCU driver manages the IPC interface between host CPU and the
SCU firmware running on M4.

For i.MX8, stop mode request is controlled by System Controller Unit(SCU)
firmware.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 15:44:04 +08:00
0948ca6544 can: flexcan: change the way of stop mode acknowledgment
Stop mode is entered when Stop mode is requested at chip level and
MCR[LPM_ACK] is asserted by the FlexCAN.

Double check with IP owner, should poll MCR[LPM_ACK] for stop mode
acknowledgment, not the acknowledgment from chip level.

Fixes: 5f186c257fa4(can: flexcan: fix stop mode acknowledgment)
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 15:44:04 +08:00
c849379b7f can: flexcan: fix deadlock when using self wakeup
When suspending, when there is still can traffic on the interfaces the
flexcan immediately wakes the platform again. As it should :-). But it
throws this error msg:
[ 3169.378661] PM: noirq suspend of devices failed

On the way down to suspend the interface that throws the error message does
call flexcan_suspend but fails to call flexcan_noirq_suspend. That means the
flexcan_enter_stop_mode is called, but on the way out of suspend the driver
only calls flexcan_resume and skips flexcan_noirq_resume, thus it doesn't call
flexcan_exit_stop_mode. This leaves the flexcan in stop mode, and with the
current driver it can't recover from this even with a soft reboot, it requires
a hard reboot.

This patch can fix deadlock when using self wakeup, it happenes to be
able to fix another issue that frames out-of-order in first IRQ handler
run after wakeup.

In wakeup case, after system resume, frames received out-of-order,the
problem is wakeup latency from frame reception to IRQ handler is much
bigger than the counter overflow. This means it's impossible to sort the
CAN frames by timestamp. The reason is that controller exits stop mode
during noirq resume, then it can receive the frame immediately. If
noirq reusme stage consumes much time, it will extend interrupt response
time.

Fixes: de3578c198 ("can: flexcan: add self wakeup support")
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 15:44:03 +08:00
ea65a8f469 can: flexcan: add LPSR mode support for i.MX7D
For i.MX7D LPSR mode, the controller will lost power and got the
configuration state lost after system resume back.
So we need to set pinctrl state again and re-start chip to do
re-configuration after resume.

For wakeup case, it should not set pinctrl to sleep state by
pinctrl_pm_select_sleep_state.
For interface is not up before suspend case, we don't need
re-configure as it will be configured by user later by interface up.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
2019-11-25 15:44:03 +08:00
710f0ba060 can: flexcan: add lx2160ar1 support
The Flexcan on lx2160ar1 supports CAN FD protocol.

signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:44:02 +08:00
1b18f96e16 can: flexcan: add imx8qm support
The Flexcan on i.MX8QM supports CAN FD protocol.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:44:01 +08:00
07b0f644e7 can: flexcan: add Transceiver Delay Compensation suopport
The CAN FD protocol allows the transmission and reception of data at a higher
bit rate than the nominal rate used in the arbitration phase when the message's
BRS bit is set.

The TDC mechanism is effective only during the data phase of FD frames
having BRS bit set. It has no effect either on non-FD frames, or on FD
frames transmitted at normal bit rate.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:44:01 +08:00
d0ca945f07 can: flexcan: add ISO CAN FD feature support
ISO CAN FD is introduced to increase the failture detection capability
than non-ISO CAN FD. The non-ISO CAN FD is still supported by FlexCAN so
that it can be used mainly during an intermediate phase, for evaluation
and development purposes.

Therefore, it is strongly recommended to configure FlexCAN to the ISO
CAN FD protocol by setting the ISOCANFDEN field in the CTRL2 register.

NOTE: If you only set "fd on", driver will use ISO FD mode by default.
You should set "fd-non-iso on" after setting "fd on" if you want to use
NON ISO FD mode.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:44:01 +08:00
46578d1633 can: flexcan: add CAN FD BRS support
This patch adds CAN FD BitRate Switch (BRS) support to driver.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:44:00 +08:00
34161b3391 can: flexcan: add CAN FD mode support
This patch intends to add CAN FD mode support in driver, it means that
payload size can extend up to 64 bytes.

Bit timing always set in CBT register other than CTRL1 register when
CANFD supports BRS, it will extend the range of all CAN bit timing
variables (PRESDIV, PROPSEG, PSEG1, PSEG2 and RJW), which will improve
the bit timing accuracy.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:59 +08:00
e95febfc9a can: flexcan: use struct canfd_frame for CAN classic frame
This patch prepares for CAN FD mode, using struct canfd_frame can both
for classic format frame and fd format frame.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:59 +08:00
fe5a47d106 can: flexcan: flexcan_mailbox_read() make use of flexcan_write64() to mark the mailbox as read
In the previous patch the function flexcan_write64() was introduced.

This patch replaces the open coded variant in flexcan_mailbox_read()
that marks a mailbox as read, by a single call to flexcan_write64().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:59 +08:00
6d2226cfba can: flexcan: flexcan_irq(): add support for TX mailbox in iflag1
The flexcan IP core has up to 64 mailboxes, each one has a corresponding
interrupt bit in the iflag1 or iflag2 registers and a mask bit in the
imask1 or imask2 registers.

The driver will always use the last mailbox for TX, which falls into the iflag2
register.

To support CANFD the payload size has to increase to 64 bytes and the number of
mailboxes will decrease so much that the TX mailbox will be handled in the
iflag1 register.

This patch add support to handle the TX mailbox independent whether it's
in iflag1 or iflag2 by introducing th flexcan_read_reg_iflag_tx()
function, similar to flexcan_read_reg_iflag_rx(), for the read path.

For the write path the function flexcan_write64() is added.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:58 +08:00
4439d376dc can: flexcan: flexcan_read_reg_iflag_rx(): optimize reading
The flexcan IP core has up to 64 mailboxes, each one has a corresponding
interrupt bit in the iflag1 or iflag2 registers and a mask bit in the
imask1 or imask2 registers.

In the timestamp (i.e. non FIFO) mode the driver needs to mask all non RX
interrupt sources, it uses the precomputed value rx_mask of struct flexcan_priv
for this.

In certain use cases, for example the CANFD mode, the contents of the iflag2
register is completely masked.

This patch optimizes the flexcan_read_reg_iflag_rx() function by not reading
the iflag1 or iflag2 register if the contents is masked.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:57 +08:00
46961d7731 can: flexcan: introduce struct flexcan_priv::tx_mask and make use of it
The current driver uses FLEXCAN_IFLAG2_MB() to generate the mask to check for
the TX complete interrupt. This works well, as the driver will always use the
last mailbox for TX, which falls into the iflag2 register.

To support CANFD the payload size has to increase to 64 bytes and the
number of mailboxes will decrease so much that the TX mailbox will be
handled in the iflag1 register.

This patch introduces a tx_mask in the struct flexcan_priv (similar to rx_mask)
and makes use of it. The actual support to handle the TX mailbox in iflag1 will
be added in the next patches.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:57 +08:00
f59aaf9260 can: flexcan: convert struct flexcan_priv::rx_mask{1,2} to rx_mask
The flexcan IP core has up to 64 mailboxes, each one has a corresponding
interrupt bit in the iflag1 or iflag2 registers and a mask bit in the
imask1 or imask2 registers.

In the timestamp (i.e. non FIFO) mode the driver needs to mask out all non RX
interrupt sources and uses the precomputed values rx_mask1 and rx_mask2 of
struct flexcan_priv for this.

This patch merges the two u32 rx_mask1 and rx_mask2 to a single u64 rx_mask
variable, which simplifies the code a bit.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:57 +08:00
e1f8dab2b3 can: flexcan: remove TX mailbox bit from struct flexcan_priv::rx_mask{1,2}
The flexcan IP core has up to 64 mailboxes, each one has a corresponding
interrupt bit in the iflag1 or iflag2 registers and a mask bit in the
imask1 or imask2 registers.

In the timestamp (i.e. non FIFO) mode the driver needs to mask out all
non RX interrupt sources and uses the precomputed values rx_mask1 and
rx_mask2 of struct flexcan_priv for this.

Currently these values cannot be used directly, as they contain the TX
mailbox flag. This patch removes the TX flag from flexcan_priv::rx_mask1
and flexcan_priv::rx_mask2, and sets the TX flag directly when writing
the regs->iflag1 and regs->iflag2 into the hardware.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:56 +08:00
d05716b100 can: flexcan: rename struct flexcan_priv::reg_imask{1,2}_default to rx_mask{1,2}
The flexcan IP core has up to 64 mailboxes, each one has a corresponding
interrupt bit in the iflag1 or iflag2 registers and a mask bit in the
imask1 or imask2 registers.

In the timestamp (i.e. non FIFO) mode the driver needs to mask out all
non RX interrupt sources and uses the precomputed values
reg_imask1_default and reg_imask2_default of struct flexcan_priv for
this.

However in the current driver the reg_imask{1,2}_default cannot be used
directly to get the pending RX interrupts. The TX interrupt is part of
these variables, so it needs to be masked out, too.

This is a preparation patch to clean up calculation of the pending RX
interrupts, it only renames the variables from

    reg_imask{1,2}_default

to

    rx_mask{1,2}

To better reflect their meaning after the complete conversion. This
change is done with the following sed command:

    sed -i -e "s/reg_imask\(1\|2\)_default/rx_mask\1/" drivers/net/can/flexcan.c

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:55 +08:00
bc90163db9 can: flexcan: flexcan_irq(): rename variable reg_iflag -> reg_iflag_rx
This patch renames the variable reg_iflag in the flexcan_irq() function
to reg_iflag_rx. This better reflects the contents of the varibale. It
does not hold the unmodified iflag registers, instead all non RX
interrupts have been masked.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:55 +08:00
325c394cb1 can: flexcan: rename macro FLEXCAN_IFLAG_MB() -> FLEXCAN_IFLAG2_MB()
The macro FLEXCAN_IFLAG_MB() is always used for the iflag2 register, so
rename it to FLEXCAN_IFLAG2_MB()

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:55 +08:00
90fae07dc6 can: flexcan: flexcan_irq_state(): only read timestamp if needed
The function flexcan_irq_state() checks the controller for CAN state
changes and pushes a skb with the new state and a timestamp into the
rx-offload framework.

This patch optimizes the function by only reading the timestamp, if a
state change is detected.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:54 +08:00
f5d4d366bc can: flexcan: use devm_platform_ioremap_resource() to simplify code
Use the new helper devm_platform_ioremap_resource() which wraps the
platform_get_resource() and devm_ioremap_resource() together to simplify
the code.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Reviewed-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:54 +08:00
d2b6a5c017 can: rx-offload: Prepare for CAN FD support
The skbs for classic CAN and CAN FD frames are allocated with seperate
functions: alloc_can_skb() and alloc_canfd_skb().

In order to support CAN FD frames via the rx-offload helper, the driver
itself has to allocate the skb (depending whether it received a classic
CAN or CAN FD frame), as the rx-offload helper cannot know which kind of
CAN frame the driver has received.

This patch moves the allocation of the skb into the struct
can_rx_offload::mailbox_read callbacks of the the flexcan and ti_hecc
driver and adjusts the rx-offload helper accordingly.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:53 +08:00
c8145b656d can: rx-offload: can_rx_offload_reset(): remove no-op function
This patch removes the function can_rx_offload_reset(), as it does
nothing. If we ever need this function, add it back again.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:53 +08:00
af53b7b455 can: rx-offload: can_rx_offload_irq_offload_timestamp(): don't use assignment in if condition
This patch moves the assignment of queue_len out of the if condition.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:52 +08:00
8ee65baa0d can: rx-offload: can_rx_offload_compare(): fix typo
This patch fixes a typo found by checkpatch.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:51 +08:00
852662af2c can: rx-offload: fix long lines
This patch fixes the checkpatch warnings about too long lines.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-11-25 15:43:51 +08:00
8e8dab7bc8 imx busfreq: Add API header file
Add sufficient enough definitions so that drivers which call
request_bus_freq and release_bus_freq can compile even if
CONFIG_HAVE_IMX_BUSFREQ is missing.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:43:51 +08:00
d92a35385e nvmem: imx: correct the fuse word index
iMX8 fuse word index represent as one 4-bytes word,
it should not be divided by 4.

Exp:
- MAC0 address layout in fuse:
offset 708: MAC[3] MAC[2] MAC[1] MAC[0]
offset 709: XX     xx     MAC[5] MAC[4]

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:43:49 +08:00
bb12203bdf nvmem: imx-ocotp: add support for the unaliged word count
When offset is not 4 bytes aligned, directly shift righty by 2 bits
will cause reading out wrong data. Since imx ocotp only supports
4 bytes reading once, we need handle offset is not 4 bytes aligned
and enlarge the bytes to 4 bytes aligned. After finished reading,
copy the needed data from buffer to caller and free buffer.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:43:48 +08:00
1186c5eb2c MA-11994 Add get phys address ioctl to dma-buf.
Add structure dma_buf_phys to store physical address.
Add DMA_BUF_IOCTL_PHYS to export physical address.

Change-Id: Ib2f24b33462d603f2cbeef975689aaf82447d088
Signed-off-by: ivan.liu <xiaowen.liu@nxp.com>
[ Aisheng: update ioctl NR to 2 due to the original 1 is used in upstream ]
[ Aisheng: update ioctl NR to 10 according to GPU team's request ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:43:48 +08:00
31b97fe170 staging: android: allow to compile ION unconditionally
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:43:47 +08:00
092146ab09 virt/vgic: Increase number of DeviceIDs to 17
FSL-MC bus devices uses device-ids from 0x10000 to 0x20000.
So to support MSI interrupts for mc-bus devices we need
vgi-ITS device-id table of size 2^17 to support deviceid
range from 0x10000 to 0x20000.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
2019-11-25 15:43:45 +08:00
4e1b20246e arm/arm64: KVM: drop qman mmio cacheable mapping hack
Instead of hardcoding checks for qman cacheable
mmio region physical addresses extract mapping
information from the user-space mapping.
The involves several steps;
 - get access to a pte part of the user-space mapping
   by using get_locked_pte() / pte_unmap_unlock() apis
 - extract memtype (normal / device), shareability from
   the pte
 - convert to S2 translation bits in newly added
   function stage1_to_stage2_pgprot()
 - finish making the s2 translation with the obtained bits

Another explored option was using vm_area_struct::vm_page_prot
which is set in vfio-mc mmap code to the correct page bits.
However, experiments show that these bits are later altered
in the generic mmap code (e.g. the shareability bit is always
set on arm64).
The only place where the original bits can still be found
is the user-space mapping, using the method described above.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
[Bharat - Fixed mem_type check issue]
[changed "ifdef ARM64" to CONFIG_ARM64]
Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
[Ioana - added a sanity check for hugepages]
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
[Fixed format issues]
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-25 15:43:43 +08:00
00ee06c621 arm/arm64 KVM: allow specifying s2 prot bits when mapping i/o
Add parameter allowing to specify s2 page table
protection and type bits and update the callers
accordingly.
The parameter will be used in a forthcoming patch.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
2019-11-25 15:43:41 +08:00
ebf350de6a arm64: KVM: support flushing device memory
In the current implementation, trying to flush
memory not covered by the linear map (e.g. device
memory) causes a crash. Add support for flushing
"non-normal" memory by explicitly ioremap()-ing
it when such a case appears and do the cache flush
through this temporary mapping.
This allows dropping the special checks for qman
cacheable region when doing cache flushes.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
[fixed formatting issue]
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
2019-11-25 15:43:41 +08:00
8172f73835 mm: Re-export ioremap_page_range
We need this in Jailhouse to map at specific virtual addresses, at
least for the moment.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2019-11-25 15:43:40 +08:00
9603b91376 arm64: export __hyp_stub_vectors
External hypervisors, like Jailhouse, need this address when they are
deactivated, in order to restore original state.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-25 15:43:39 +08:00
81632e4d97 jailhouse: Add simple debug console via the hypervisor
Jailhouse allows explicitly enabled cells to write character-wise
messages to the hypervisor debug console. Make use of this for a
platform-agnostic boot diagnosis channel, specifically for non-root
cells. This also comes with earlycon support.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 60685bd589aef4972d20724863079edf2039eaa2)
From http://git.kiszka.org/?p=linux.git;a=shortlog;h=refs/heads/queues/jailhouse
2019-11-25 15:43:39 +08:00
68ac48b39f ivshmem-net: Switch to netdev_xmit_more helper
The skb field has been removed by 4f296edeb9.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 80c301552ec0b500dd46a2b4f0c9fef78a610ee6)
2019-11-25 15:43:38 +08:00
0157417e68 ivshmem-net: Refactor and comment ivshm_net_state_change
This should make the state transitioning logic clearer. Also avoid the
harmless but redundant netif_carrier_on/ivshm_net_run in RUN state.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 8539efe70fbdf4a0bea75a97c1628fbb38b6590b)
2019-11-25 15:43:38 +08:00
c3f60880c3 ivshmem-net: Fix bogus transition to RESET state
If we are in READY but the remote is still in INIT, we so far fell back
to RESET which caused the setup to get stuck. Fix this by only
transitioning from READY/RUN to RESET in ivshm_net_state_change if the
remote is in RESET as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit b58915e11eba2643d5c68ea0328823a62c21dc49)
2019-11-25 15:43:38 +08:00
a9a6524d83 ivshmem-net: Silence compiler warning
At least Linaro's gcc 6.3 does not see the initialization and usage
dependency of fhead and num. Let's silence this false positive.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 4d067d37d835c35e8f85481b97c51f20b713ae71)
2019-11-25 15:43:37 +08:00
0de9da4365 ivshmem-net: add MAC changing interface
Allow ifconfig, ip and other such tools to change the MAC of the
virtual NIC.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 7744d59d11101f75afaa6f550cabba38c2c0d260)
2019-11-25 15:43:36 +08:00
1a300871de ivshmem-net: set and check descriptor flags
We do not support the use of any flags. Make sure the remote does not
confuse us using flags.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
[Jan: Remove wrong removal of next field initialization]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 986d58d84245e023a1a66ab6495b354b6b8cd2f0)
2019-11-25 15:43:35 +08:00
1ef8d65261 ivshmem-net: slightly improve debug output
There where two lines with the same error message, change one of them.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit d66af388dd2512ea7c7a776c731409854ed40a45)
2019-11-25 15:43:31 +08:00
3ef38ae661 ivshmem-net: fill in and check used descriptor chain len
We are using chains of len==1 make that explicit and expect that from
the remote.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit f958c360044184f58605815d428b83fe4329cafd)
2019-11-25 15:43:31 +08:00
4eccd3f763 ivshmem-net: Switch to pci_alloc_irq_vectors
Required by 4.12, and it also simplifies our code. Needs to be folded
into the initial patch eventually.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit ea6e78c89582711f15a2711f0a35ac3a61d9d074)
2019-11-25 15:43:30 +08:00
915f18dbd9 ivshmem-net: Switch to relative descriptor addresses
Make sure that we do not depend on identity-mapped shared memory
regions.

This also fixes an off-by-one in the range check of ivshm_net_desc_data.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit fe9c9dd6373892591a7d6b165c3c43045eb349c1)
2019-11-25 15:43:29 +08:00
f1e35f8583 ivshmem-net: Fix stuck state machine during setup
If the remote side is already in INIT state (or even higher) and has a
cached rstate of RESET, we won't make progress when signaling RESET
again because the remote side won't send a state update. Fix this by
enforcing a local check after probe completion.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit fceed9d0ab2486589c57c0793fbfbca4832442b9)
2019-11-25 15:43:28 +08:00
9daf55a918 ivshmem-net: Add ethtool register dump
Helps debugging inconsistent states.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 81674136b6936fb8219dac1dcdb6df8fe424143d)
2019-11-25 15:43:27 +08:00
2219bf0ef9 ivshmem-net: Switch to reset state on each net stop and on driver removal
Improves the state signaling to the remote side after ifconfig down and
driver removal.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit d0f632b2830146d9892a2b1ab93f866f072412bb)
2019-11-25 15:43:27 +08:00
6a8b7dac6c ivshmem-net: Improve identification of resources
Pass a device name consisting of driver name and PCI ID to request_irq
and alloc_ordered_workqueue. This helps correlating resources with
devices in case there are multiple of them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 43e2ff78b89cbdfaecba54601d85f3d40349a9b5)
2019-11-25 15:43:27 +08:00
5de6a73541 ivshmem-net: Enable INTx
Activate INTx notification when it has to be used instead of MSI-X,
disable it after use.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 8790717bdca6ea58f18baac1749ac347b23b7263)
2019-11-25 15:43:26 +08:00
56c70c4ac1 ivshmem-net: Remove unused variable
Became unused by previous change.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 3ea4b31deba3424784f0105c20dc90419e950e2c)
2019-11-25 15:43:25 +08:00
db011fdece ivshmem-net: fix race in state machine
(cherry picked from commit 5d663baed6a89d09bae4446f6509f9957c780bc7)
2019-11-25 15:43:25 +08:00
874fde9266 ivshmem-net: Map shmem region as RAM
No need for special caching, simply map the shared memory region like
RAM, thus write-back. This gives us another order of magnitude in
throughput.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit af59c6541a65622cab498851e01653dd378cd9f8)
2019-11-25 15:43:24 +08:00
ecdcbc098b ivshmem-net: virtual network device for Jailhouse
Work in progress.

(cherry picked from commit ed818547b45e652db57d5966efe336ed646feb45)
2019-11-25 15:43:24 +08:00
bb7f2bc98a encrypted_keys: Adds support for secure key-type as master key.
Encrypted keys can use secure key-type as master key along with
trusted/user keys.

Secure key as master key uses, secure key type payload derieved
using CAAM hardware.

Signed-off-by: Udit Agarwal <udit.agarwal@nxp.com>
Reviewed-by: Sahil Malhotra <sahil.malhotra@nxp.com>
2019-11-25 15:43:21 +08:00
e2173ee987 security/keys/secure_key: Adds the secure key support based on CAAM.
Secure keys are derieved using CAAM crypto block.

Secure keys derieved are the random number symmetric keys from CAAM.
Blobs corresponding to the key are formed using CAAM. User space
will only be able to view the blob of the key.

Signed-off-by: Udit Agarwal <udit.agarwal@nxp.com>
Reviewed-by: Sahil Malhotra <sahil.malhotra@nxp.com>
2019-11-25 15:43:20 +08:00
e1a845431d config/qe: add irq-qeic support.
Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 15:43:17 +08:00
ffc21ad04e QE: remove PPCisms for QE
QE was supported on PowerPC, and dependent on PPC,
Now it is supported on other platforms. so remove PPCisms.

Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 15:43:17 +08:00
6318feef83 irqchip/qeic: remove PPCisms for QEIC
QEIC was supported on PowerPC, and dependent on PPC,
Now it is supported on other platforms, so remove PPCisms.

Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 15:43:17 +08:00
2fc190c911 irqchip/qeic: merge qeic_of_init into qe_ic_init
qeic_of_init just get device_node of qeic from dtb and call qe_ic_init,
pass the device_node to qe_ic_init.
So merge qeic_of_init into qe_ic_init to get the qeic node in
qe_ic_init.

Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 15:43:16 +08:00
e2a1e27384 irqchip/qeic: merge qeic init code from platforms to a common function
The codes of qe_ic init from a variety of platforms are redundant,
merge them to a common function and put it to irqchip/irq-qeic.c

For non-p1021_mds mpc85xx_mds boards, use "qe_ic_init(np, 0,
qe_ic_cascade_low_mpic, qe_ic_cascade_high_mpic);" instead of
"qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);".

qe_ic_cascade_muxed_mpic was used for boards has the same interrupt
number for low interrupt and high interrupt, qe_ic_init has checked
if "low interrupt == high interrupt"

Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 15:43:15 +08:00
b3863641b7 irqchip/qeic: move qeic driver from drivers/soc/fsl/qe
move the driver from drivers/soc/fsl/qe to drivers/irqchip,
merge qe_ic.h and qe_ic.c into irq-qeic.c.

Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
2019-11-25 15:43:15 +08:00
055889789c pwm: imx27: Use 32k clock if it is supplied
The PWM in i.MX8qxp MIPI subsystem needs to use the
'32k' clock to work properly.  This patch gets this
clock in the PWM driver and uses it if it is supplied.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
2019-11-25 15:43:02 +08:00
2533 changed files with 863697 additions and 15614 deletions

View File

@ -0,0 +1,19 @@
What: /sys/bus/fsl-mc/devices/dprc.*/rescan
Date: November 2018
KernelVersion: 5.0
Contact: Ioana Ciornei <ioana.ciornei@nxp.com>
Description: Writing a non-zero value to this attribute will
force a rescan of dprc.X container in the system and
synchronize the objects under dprc.X and the
Management Complex firmware.
Users: Userspace drivers and management tools
What: /sys/bus/fsl-mc/rescan
Date: November 2018
KernelVersion: 5.0
Contact: Ioana Ciornei <ioana.ciornei@nxp.com>
Description: Writing a non-zero value to this attribute will
force a rescan of fsl-mc bus in the system and
synchronize the objects under fsl-mc bus and the
Management Complex firmware.
Users: Userspace drivers and management tools

View File

@ -0,0 +1,13 @@
What: /sys/devices/.../consumers
Date: October 2018
Contact: Ioana Ciornei <ioana.ciornei@nxp.com>
Description:
Read-only attribute that lists the current "consumers" of
a specific device.
What: /sys/devices/.../suppliers
Date: October 2018
Contact: Ioana Ciornei <ioana.ciornei@nxp.com>
Description:
Read-only attribute that lists the current "suppliers" of
a specific device.

View File

@ -0,0 +1,9 @@
What: /sys/bus/platform/devices/5b110000.usb3/role
Date: Jan 2019
Contact: Peter Chen <peter.chen@nxp.com>
Description:
It returns string "gadget", "host" and "none" when read it,
it indicates current controller role.
It will do role switch when write "gadget" or "host" to it.
Only controller at dual-role configuration supports writing.

View File

@ -0,0 +1,45 @@
What: Raise a uevent when a USB charger is inserted or removed
Date: 2019-11-11
KernelVersion: 5.5
Contact: linux-usb@vger.kernel.org
Description: There are two USB charger states:
USB_CHARGER_ABSENT
USB_CHARGER_PRESENT
There are five USB charger types:
USB_CHARGER_UNKNOWN_TYPE
USB_CHARGER_SDP_TYPE
USB_CHARGER_CDP_TYPE
USB_CHARGER_DCP_TYPE
USB_CHARGER_ACA_TYPE
Here are two examples taken using udevadm monitor -p when
USB charger is online:
UDEV [227.425096] change /devices/soc0/usbphynop1 (platform)
ACTION=change
DEVPATH=/devices/soc0/usbphynop1
DRIVER=usb_phy_generic
MODALIAS=of:Nusbphynop1T(null)Cusb-nop-xceiv
OF_COMPATIBLE_0=usb-nop-xceiv
OF_COMPATIBLE_N=1
OF_FULLNAME=/usbphynop1
OF_NAME=usbphynop1
SEQNUM=2493
SUBSYSTEM=platform
USB_CHARGER_STATE=USB_CHARGER_PRESENT
USB_CHARGER_TYPE=USB_CHARGER_SDP_TYPE
USEC_INITIALIZED=227422826
USB charger is offline:
KERNEL[229.533933] change /devices/soc0/usbphynop1 (platform)
ACTION=change
DEVPATH=/devices/soc0/usbphynop1
DRIVER=usb_phy_generic
MODALIAS=of:Nusbphynop1T(null)Cusb-nop-xceiv
OF_COMPATIBLE_0=usb-nop-xceiv
OF_COMPATIBLE_N=1
OF_FULLNAME=/usbphynop1
OF_NAME=usbphynop1
SEQNUM=2494
SUBSYSTEM=platform
USB_CHARGER_STATE=USB_CHARGER_ABSENT
USB_CHARGER_TYPE=USB_CHARGER_UNKNOWN_TYPE

View File

@ -265,8 +265,11 @@ time with the option "mds=". The valid arguments for this option are:
============ =============================================================
Not specifying this option is equivalent to "mds=full".
Not specifying this option is equivalent to "mds=full". For processors
that are affected by both TAA (TSX Asynchronous Abort) and MDS,
specifying just "mds=off" without an accompanying "tsx_async_abort=off"
will have no effect as the same mitigation is used for both
vulnerabilities.
Mitigation selection guide
--------------------------

View File

@ -174,7 +174,10 @@ the option "tsx_async_abort=". The valid arguments for this option are:
CPU is not vulnerable to cross-thread TAA attacks.
============ =============================================================
Not specifying this option is equivalent to "tsx_async_abort=full".
Not specifying this option is equivalent to "tsx_async_abort=full". For
processors that are affected by both TAA and MDS, specifying just
"tsx_async_abort=off" without an accompanying "mds=off" will have no
effect as the same mitigation is used for both vulnerabilities.
The kernel command line also allows to control the TSX feature using the
parameter "tsx=" on CPUs which support TSX control. MSR_IA32_TSX_CTRL is used

View File

@ -2473,6 +2473,12 @@
SMT on vulnerable CPUs
off - Unconditionally disable MDS mitigation
On TAA-affected machines, mds=off can be prevented by
an active TAA mitigation as both vulnerabilities are
mitigated with the same mechanism so in order to disable
this mitigation, you need to specify tsx_async_abort=off
too.
Not specifying this option is equivalent to
mds=full.
@ -4931,6 +4937,11 @@
vulnerable to cross-thread TAA attacks.
off - Unconditionally disable TAA mitigation
On MDS-affected machines, tsx_async_abort=off can be
prevented by an active MDS mitigation as both vulnerabilities
are mitigated with the same mechanism so in order to disable
this mitigation, you need to specify mds=off too.
Not specifying this option is equivalent to
tsx_async_abort=full. On CPUs which are MDS affected
and deploy MDS mitigation, TAA mitigation is not

View File

@ -17,36 +17,54 @@ The "format" directory describes format of the config (event ID) and config1
(AXI filtering) fields of the perf_event_attr structure, see /sys/bus/event_source/
devices/imx8_ddr0/format/. The "events" directory describes the events types
hardware supported that can be used with perf tool, see /sys/bus/event_source/
devices/imx8_ddr0/events/.
e.g.::
devices/imx8_ddr0/events/. The "caps" directory describes filter features implemented
in DDR PMU, see /sys/bus/events_source/devices/imx8_ddr0/caps/.
.. code-block:: bash
perf stat -a -e imx8_ddr0/cycles/ cmd
perf stat -a -e imx8_ddr0/read/,imx8_ddr0/write/ cmd
AXI filtering is only used by CSV modes 0x41 (axid-read) and 0x42 (axid-write)
to count reading or writing matches filter setting. Filter setting is various
from different DRAM controller implementations, which is distinguished by quirks
in the driver.
in the driver. You also can dump info from userspace, filter in "caps" directory
indicates whether PMU supports AXI ID filter or not; enhanced_filter indicates
whether PMU supports enhanced AXI ID filter or not. Value 0 for un-supported, and
value 1 for supported.
* With DDR_CAP_AXI_ID_FILTER quirk.
* With DDR_CAP_AXI_ID_FILTER quirk(filter: 1, enhanced_filter: 0).
Filter is defined with two configuration parts:
--AXI_ID defines AxID matching value.
--AXI_MASKING defines which bits of AxID are meaningful for the matching.
0corresponding bit is masked.
1: corresponding bit is not masked, i.e. used to do the matching.
- 0: corresponding bit is masked.
- 1: corresponding bit is not masked, i.e. used to do the matching.
AXI_ID and AXI_MASKING are mapped on DPCR1 register in performance counter.
When non-masked bits are matching corresponding AXI_ID bits then counter is
incremented. Perf counter is incremented if
AxID && AXI_MASKING == AXI_ID && AXI_MASKING
AxID && AXI_MASKING == AXI_ID && AXI_MASKING
This filter doesn't support filter different AXI ID for axid-read and axid-write
event at the same time as this filter is shared between counters.
e.g.::
perf stat -a -e imx8_ddr0/axid-read,axi_mask=0xMMMM,axi_id=0xDDDD/ cmd
perf stat -a -e imx8_ddr0/axid-write,axi_mask=0xMMMM,axi_id=0xDDDD/ cmd
NOTE: axi_mask is inverted in userspace(i.e. set bits are bits to mask), and
it will be reverted in driver automatically. so that the user can just specify
axi_id to monitor a specific id, rather than having to specify axi_mask.
e.g.::
perf stat -a -e imx8_ddr0/axid-read,axi_id=0x12/ cmd, which will monitor ARID=0x12
.. code-block:: bash
perf stat -a -e imx8_ddr0/axid-read,axi_mask=0xMMMM,axi_id=0xDDDD/ cmd
perf stat -a -e imx8_ddr0/axid-write,axi_mask=0xMMMM,axi_id=0xDDDD/ cmd
.. note::
axi_mask is inverted in userspace(i.e. set bits are bits to mask), and
it will be reverted in driver automatically. so that the user can just specify
axi_id to monitor a specific id, rather than having to specify axi_mask.
.. code-block:: bash
perf stat -a -e imx8_ddr0/axid-read,axi_id=0x12/ cmd, which will monitor ARID=0x12
* With DDR_CAP_AXI_ID_FILTER_ENHANCED quirk(filter: 1, enhanced_filter: 1).
This is an extension to the DDR_CAP_AXI_ID_FILTER quirk which permits
counting the number of bytes (as opposed to the number of bursts) from DDR
read and write transactions concurrently with another set of data counters.

View File

@ -8,6 +8,7 @@ Performance monitor support
:maxdepth: 1
hisi-pmu
imx-ddr
qcom_l2_pmu
qcom_l3_pmu
arm-ccn

View File

@ -8,7 +8,7 @@ Required properties:
- compatible: Should contain a chip-specific compatible string,
Chip-specific strings are of the form "fsl,<chip>-dcfg",
The following <chip>s are known to be supported:
ls1012a, ls1021a, ls1043a, ls1046a, ls2080a.
ls1012a, ls1021a, ls1043a, ls1046a, ls2080a, lx2160a
- reg : should contain base address and length of DCFG memory-mapped registers

View File

@ -89,7 +89,7 @@ Required properties:
"fsl,imx8qm-clock"
"fsl,imx8qxp-clock"
followed by "fsl,scu-clk"
- #clock-cells: Should be 1. Contains the Clock ID value.
- #clock-cells: Should be 2: Contains the Resource and Clock ID value.
- clocks: List of clock specifiers, must contain an entry for
each required entry in clock-names
- clock-names: Should include entries "xtal_32KHz", "xtal_24MHz"
@ -97,9 +97,6 @@ Required properties:
The clock consumer should specify the desired clock by having the clock
ID in its "clocks" phandle cell.
See the full list of clock IDs from:
include/dt-bindings/clock/imx8qxp-clock.h
Pinctrl bindings based on SCU Message Protocol
------------------------------------------------------------
@ -186,7 +183,7 @@ firmware {
clk: clk {
compatible = "fsl,imx8qxp-clk", "fsl,scu-clk";
#clock-cells = <1>;
#clock-cells = <2>;
};
iomuxc {
@ -231,8 +228,7 @@ serial@5a060000 {
...
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpuart0>;
clocks = <&clk IMX8QXP_UART0_CLK>,
<&clk IMX8QXP_UART0_IPG_CLK>;
clock-names = "per", "ipg";
clocks = <&uart0_clk IMX_SC_R_UART_0 IMX_SC_PM_CLK_PER>;
clock-names = "ipg";
power-domains = <&pd IMX_SC_R_UART_0>;
};

View File

@ -287,6 +287,7 @@ properties:
- ebs-systart,oxalis
- fsl,ls1012a-rdb
- fsl,ls1012a-frdm
- fsl,ls1012a-frwy
- fsl,ls1012a-qds
- const: fsl,ls1012a
@ -335,4 +336,11 @@ properties:
- fsl,ls2088a-rdb
- const: fsl,ls2088a
- description: LX2160A based Boards
items:
- enum:
- fsl,lx2160a-qds
- fsl,lx2160a-rdb
- const: fsl,lx2160a
...

View File

@ -0,0 +1,54 @@
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/bindings/clock/fsl,plldig.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: NXP QorIQ Layerscape LS1028A Display PIXEL Clock Binding
maintainers:
- Wen He <wen.he_1@nxp.com>
description: |
NXP LS1028A has a clock domain PXLCLK0 used for the Display output
interface in the display core, as implemented in TSMC CLN28HPM PLL.
which generate and offers pixel clocks to Display.
properties:
compatible:
const: fsl,ls1028a-plldig
reg:
maxItems: 1
'#clock-cells':
const: 0
vco-frequency:
$ref: '/schemas/types.yaml#/definitions/uint32'
description: Optional for VCO frequency of the PLL in Hertz.
The VCO frequency of this PLL cannot be changed during runtime
only at startup. Therefore, the output frequencies are very
limited and might not even closely match the requested frequency.
To work around this restriction the user may specify its own
desired VCO frequency for the PLL. The frequency has to be in the
range of 650000000 to 1300000000.
If not set, the default frequency is 1188000000.
required:
- compatible
- reg
- clocks
- '#clock-cells'
examples:
# Display PIXEL Clock node:
- |
dpclk: clock-display@f1f0000 {
compatible = "fsl,ls1028a-plldig";
reg = <0x0 0xf1f0000 0x0 0xffff>;
#clock-cells = <0>;
clocks = <&osc_27m>;
};
...

View File

@ -82,7 +82,6 @@ pcc2: pcc2@403f0000 {
<&scg1 IMX7ULP_CLK_APLL_PFD0>,
<&scg1 IMX7ULP_CLK_UPLL>,
<&scg1 IMX7ULP_CLK_SOSC_BUS_CLK>,
<&scg1 IMX7ULP_CLK_MIPI_PLL>,
<&scg1 IMX7ULP_CLK_FIRC_BUS_CLK>,
<&scg1 IMX7ULP_CLK_ROSC>,
<&scg1 IMX7ULP_CLK_SPLL_BUS_CLK>;

View File

@ -11,32 +11,38 @@ enabled by these control bits, it might still not be running based
on the base resource.
Required properties:
- compatible: Should be one of:
"fsl,imx8qxp-lpcg-adma",
"fsl,imx8qxp-lpcg-conn",
"fsl,imx8qxp-lpcg-dc",
"fsl,imx8qxp-lpcg-dsp",
"fsl,imx8qxp-lpcg-gpu",
"fsl,imx8qxp-lpcg-hsio",
"fsl,imx8qxp-lpcg-img",
"fsl,imx8qxp-lpcg-lsio",
"fsl,imx8qxp-lpcg-vpu"
- reg: Address and length of the register set
- #clock-cells: Should be <1>
- compatible: Should be one of:
"fsl,imx8qxp-lpcg"
"fsl,imx8qm-lpcg" followed by "fsl,imx8qxp-lpcg".
- reg: Address and length of the register set.
- #clock-cells: Should be 1. One LPCG supports multiple clocks.
- clocks: Input parent clocks phandle array for each clock.
- bit-offset: An integer array indicating the bit offset for each clock.
- hw-autogate: Boolean array indicating whether supports HW autogate for
each clock.
- clock-output-names: Shall be the corresponding names of the outputs.
NOTE this property must be specified in the same order
as the clock bit-offset and hw-autogate property.
- power-domains: Should contain the power domain used by this clock.
The clock consumer should specify the desired clock by having the clock
ID in its "clocks" phandle cell.
See the full list of clock IDs from:
include/dt-bindings/clock/imx8qxp-clock.h
Examples:
#include <dt-bindings/clock/imx8qxp-clock.h>
conn_lpcg: clock-controller@5b200000 {
compatible = "fsl,imx8qxp-lpcg-conn";
reg = <0x5b200000 0xb0000>;
sdhc0_lpcg: clock-controller@5b200000 {
compatible = "fsl,imx8qxp-lpcg";
reg = <0x5b200000 0x10000>;
#clock-cells = <1>;
clocks = <&sdhc0_clk IMX_SC_PM_CLK_PER>,
<&conn_ipg_clk>, <&conn_axi_clk>;
bit-offset = <0 16 20>;
clock-output-names = "sdhc0_lpcg_per_clk",
"sdhc0_lpcg_ipg_clk",
"sdhc0_lpcg_ahb_clk";
power-domains = <&pd IMX_SC_R_SDHC_0>;
};
usdhc1: mmc@5b010000 {
@ -44,8 +50,8 @@ usdhc1: mmc@5b010000 {
interrupt-parent = <&gic>;
interrupts = <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>;
reg = <0x5b010000 0x10000>;
clocks = <&conn_lpcg IMX8QXP_CONN_LPCG_SDHC0_IPG_CLK>,
<&conn_lpcg IMX8QXP_CONN_LPCG_SDHC0_PER_CLK>,
<&conn_lpcg IMX8QXP_CONN_LPCG_SDHC0_HCLK>;
clocks = <&sdhc0_lpcg 1>,
<&sdhc0_lpcg 0>,
<&sdhc0_lpcg 2>;
clock-names = "ipg", "per", "ahb";
};

View File

@ -44,6 +44,7 @@ Required properties:
* "fsl,ls1046a-clockgen"
* "fsl,ls1088a-clockgen"
* "fsl,ls2080a-clockgen"
* "fsl,lx2160a-clockgen"
Chassis-version clock strings include:
* "fsl,qoriq-clockgen-1.0": for chassis 1.0 clocks
* "fsl,qoriq-clockgen-2.0": for chassis 2.0 clocks

View File

@ -0,0 +1,31 @@
* NXP S32V234 Clock Generation Modules (MC_CGMs)
The SoC supports four Clock Generation Modules, which provide registers for
system and peripherals clock source selection and division. See chapters 22
("Clocking"), 23 ("Clock Generation Module (MC_CGM)") and 69 ("Mode Entry
Module (MC_ME)") in the reference manual[1].
This binding uses the common clock binding:
Documentation/devicetree/bindings/clock/clock-bindings.txt
Required properties:
- compatible:
Should be:
- "fsl,s32v234-mc_cgm0" for MC_CGM_0
- "fsl,s32v234-mc_cgm1" for MC_CGM_1
- "fsl,s32v234-mc_cgm2" for MC_CGM_2
- "fsl,s32v234-mc_cgm3" for MC_CGM_3
- reg:
Location and length of the register set
- #clock-cells (only for MC_CGM_0):
Should be <1>. See dt-bindings/clock/s32v234-clock.h for the clock
specifiers allowed in the clocks property of consumers.
Example:
clks: mc_cgm0@4003c000 {
compatible = "fsl,s32v234-mc_cgm0";
reg = <0x0 0x4003C000 0x0 0x1000>;
#clock-cells = <1>;
};
[1] https://www.nxp.com/webapp/Download?colCode=S32V234RM

View File

@ -0,0 +1,16 @@
* NXP S32V234 Mode Entry Module (MC_ME)
See chapters 22 ("Clocking") and 69 ("Mode Entry Module (MC_ME)") in the
reference manual[1].
Required properties:
- compatible: Should be "fsl,s32v234-mc_me"
- reg: Location and length of the register set
Example:
mc_me: mc_me@4004a000 {
compatible = "fsl,s32v234-mc_me";
reg = <0x0 0x4004A000 0x0 0x1000>;
};
[1] https://www.nxp.com/webapp/Download?colCode=S32V234RM

View File

@ -202,6 +202,26 @@ EXAMPLE
};
=====================================================================
Secure memory (SM) Node
- compatible
Usage: required
Value type: <string>
Definition: Must include "fsl,imx6q-caam-sm"
- reg
Usage: required
Value type: <prop-encoded-array>
Definition: Specifies a two SM parameters: an offset from
the parent physical address and the length the SM registers.
EXAMPLE
caam_sm: caam-sm@100000 {
compatible = "fsl,imx6q-caam-sm";
reg = <0x100000 0x4000>;
};
=====================================================================
Run Time Integrity Check (RTIC) Node
@ -365,6 +385,79 @@ EXAMPLE
interrupts = <93 2>;
};
=====================================================================
CAAM SNVS Node
Load the SECVIO node.
- compatible
Usage: required
Value type: <string>
Definition: Must include "fsl,imx6q-caam-snvs".
- reg
Usage: required
Value type: <prop-encoded-array>
Definition: A standard property. Specifies the physical
address and length of the SEC4 configuration
registers.
=====================================================================
Security Violation (SECVIO) Node
Reports security violations.
- compatible
Usage: required
Value type: <string>
Definition: Must include "fsl,imx6q-caam-secvio".
- interrupts
Usage: required
Value type: <prop_encoded-array>
Definition: Specifies the interrupts generated by this
device. The value of the interrupts property
consists of one interrupt specifier. The format
of the specifier is defined by the binding document
describing the node's interrupt parent.
- jtag-tamper
Usage: optional-but-recommended
Value type: <string>
Definition:
Security tamper on the JTAG
Must include "enabled" to enable.
- watchdog-tamper
Usage: optional-but-recommended
Value type: <string>
Definition:
Security tamper on the watchdog
Must include "enabled" to enable.
- internal-boot-tamper
Usage: optional-but-recommended
Value type: <string>
Definition:
Security tamper on the internal boot
Must include "enabled" to enable.
- external-pin-tamper
Usage: optional-but-recommended
Value type: <string>
Definition:
Security tamper on the external pin
Must include "enabled" to enable.
EXAMPLE
irq_sec_vio: caam_secvio {
compatible = "fsl,imx6q-caam-secvio";
interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
jtag-tamper = "disabled";
watchdog-tamper = "enabled";
internal-boot-tamper = "enabled";
external-pin-tamper = "disabled";
};
=====================================================================
Secure Non-Volatile Storage (SNVS) Low Power (LP) RTC Node
@ -394,18 +487,14 @@ Secure Non-Volatile Storage (SNVS) Low Power (LP) RTC Node
value type: <u32>
Definition: LP register offset. default it is 0x34.
- clocks
Usage: optional, required if SNVS LP RTC requires explicit
enablement of clocks
Value type: <prop_encoded-array>
Definition: a clock specifier describing the clock required for
enabling and disabling SNVS LP RTC.
- clock-names
Usage: optional, required if SNVS LP RTC requires explicit
enablement of clocks
Value type: <string>
Definition: clock name string should be "snvs-rtc".
- clocks
Usage: optional
Value type: <prop-encoded-array>
Definition: A standard property. Specifies the source clock for
snvs register access. If i.MX clk driver defines the clock node,
it needs user to specify the clocks in device tree for all modules
with snvs LP/HP registers access. The modules involved snvs LP/HP
registers access are snvs-power key, snvs-rtc, and caam.
EXAMPLE
sec_mon_rtc_lp@1 {
@ -550,4 +639,18 @@ FULL EXAMPLE
};
};
caam_snvs: caam-snvs@30370000 {
compatible = "fsl,imx6q-caam-snvs";
reg = <0x30370000 0x10000>;
};
irq_sec_vio: caam_secvio {
compatible = "fsl,imx6q-caam-secvio";
interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
jtag-tamper = "disabled";
watchdog-tamper = "enabled";
internal-boot-tamper = "enabled";
external-pin-tamper = "disabled";
};
=====================================================================

View File

@ -37,6 +37,8 @@ Optional properties:
Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt)
to be used for the framebuffer; if not present, the framebuffer may
be located anywhere in memory.
- arm,malidp-arqos-high-level: integer of u32 value describing the ARQoS
levels of DP500's QoS signaling.
Example:
@ -54,6 +56,7 @@ Example:
clocks = <&oscclk2>, <&fpgaosc0>, <&fpgaosc1>, <&fpgaosc1>;
clock-names = "pxlclk", "mclk", "aclk", "pclk";
arm,malidp-output-port-lines = /bits/ 8 <8 8 8>;
arm,malidp-arqos-high-level = <0xd000d000>;
port {
dp0_output: endpoint {
remote-endpoint = <&tda998x_2_input>;

View File

@ -1,10 +1,10 @@
Analog Device ADV7511(W)/13/33 HDMI Encoders
Analog Device ADV7511(W)/13/33/35 HDMI Encoders
-----------------------------------------
The ADV7511, ADV7511W, ADV7513 and ADV7533 are HDMI audio and video transmitters
compatible with HDMI 1.4 and DVI 1.0. They support color space conversion,
S/PDIF, CEC and HDCP. ADV7533 supports the DSI interface for input pixels, while
the others support RGB interface.
The ADV7511, ADV7511W, ADV7513, ADV7533 and ADV7535 are HDMI audio and video
transmitters compatible with HDMI 1.4 and DVI 1.0. They support color space
conversion, S/PDIF, CEC and HDCP. ADV7533 and ADV7535 support the DSI interface
for input pixels, while the others support RGB interface.
Required properties:
@ -13,6 +13,7 @@ Required properties:
"adi,adv7511w"
"adi,adv7513"
"adi,adv7533"
"adi,adv7535"
- reg: I2C slave addresses
The ADV7511 internal registers are split into four pages exposed through
@ -52,7 +53,7 @@ The following input format properties are required except in "rgb 1x" and
- bgvdd-supply: A 1.8V supply that powers up the BGVDD pin. This is
needed only for ADV7511.
The following properties are required for ADV7533:
The following properties are required for ADV7533 and ADV7535:
- adi,dsi-lanes: Number of DSI data lanes connected to the DSI host. It should
be one of 1, 2, 3 or 4.
@ -71,23 +72,31 @@ Optional properties:
- adi,embedded-sync: The input uses synchronization signals embedded in the
data stream (similar to BT.656). Defaults to separate H/V synchronization
signals.
- adi,disable-timing-generator: Only for ADV7533. Disables the internal timing
generator. The chip will rely on the sync signals in the DSI data lanes,
rather than generate its own timings for HDMI output.
- adi,disable-timing-generator: Only for ADV7533 and ADV7535. Disables the
internal timing generator. The chip will rely on the sync signals in the DSI
data lanes, rather than generate its own timings for HDMI output.
- clocks: from common clock binding: reference to the CEC clock.
- clock-names: from common clock binding: must be "cec".
- reg-names : Names of maps with programmable addresses.
It can contain any map needing a non-default address.
Possible maps names are : "main", "edid", "cec", "packet"
- adi,dsi-channel: Only for ADV7533 and ADV7535. DSI channel number to be used
when communicating with the DSI peripheral. It should be one of 0, 1, 2 or 3.
- adi,addr-cec: Only for ADV7533 and ADV7535. The I2C DSI-CEC register map
address to be programmed into the MAIN register map.
- adi,addr-edid: Only for ADV7533 and ADV7535. The I2C EDID register map
to be programmed into the MAIN register map.
- adi,addr-pkt: Only for ADV7533 and ADV7535. The I2C PACKET register map
to be programmed into the MAIN register map.
Required nodes:
The ADV7511 has two video ports. Their connections are modelled using the OF
graph bindings specified in Documentation/devicetree/bindings/graph.txt.
- Video port 0 for the RGB, YUV or DSI input. In the case of ADV7533, the
remote endpoint phandle should be a reference to a valid mipi_dsi_host device
node.
- Video port 0 for the RGB, YUV or DSI input. In the case of ADV7533 and
ADV7535, the remote endpoint phandle should be a reference to a valid
mipi_dsi_host device node.
- Video port 1 for the HDMI output
- Audio port 2 for the HDMI audio input

View File

@ -0,0 +1,27 @@
ITE IT6263 LVDS to HDMI bridge bindings
Required properties:
- compatible: "ite,it6263"
- reg: i2c address of the bridge
- video input: this subnode can contain a video input port node
to connect the bridge to a LVDS output interface (See this
documentation [1]).
Optional properties:
- split-mode: boolean. if this exists, split mode is enabled,
otherwise, single mode is enabled.
- reset-gpios: OF device-tree gpio specification for SYSRSTN pin.
[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
Example:
lvds-to-hdmi-bridge@4c {
compatible = "ite,it6263";
reg = <0x4c>;
port {
it6263_0_in: endpoint {
remote-endpoint = <&lvds0_out>;
};
};
};

View File

@ -0,0 +1,161 @@
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/display/bridge/nwl-dsi.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Northwest Logic MIPI-DSI controller on i.MX SoCs
maintainers:
- Guido Gúnther <agx@sigxcpu.org>
- Robert Chiras <robert.chiras@nxp.com>
description: |
NWL MIPI-DSI host controller found on i.MX8 platforms. This is a dsi bridge for
the SOCs NWL MIPI-DSI host controller.
properties:
compatible:
const: fsl,imx8mq-nwl-dsi
reg:
maxItems: 1
interrupts:
maxItems: 1
clocks:
items:
- description: DSI core clock
- description: RX_ESC clock (used in escape mode)
- description: TX_ESC clock (used in escape mode)
- description: PHY_REF clock
- description: VIDEO_PLL clock
clock-names:
items:
- const: core
- const: rx_esc
- const: tx_esc
- const: phy_ref
- const: video_pll
mux-controls:
description:
mux controller node to use for operating the input mux
phys:
maxItems: 1
description:
A phandle to the phy module representing the DPHY
phy-names:
items:
- const: dphy
power-domains:
maxItems: 1
description:
A phandle to the power domain
resets:
description:
phandles to the reset controller
items:
- description: dsi byte reset line
- description: dsi dpi reset line
- description: dsi esc reset line
- description: dsi pclk reset line
reset-names:
items:
- const: byte
- const: dpi
- const: esc
- const: pclk
ports:
type: object
description:
A node containing DSI input & output port nodes with endpoint
definitions as documented in
Documentation/devicetree/bindings/graph.txt.
port@0:
type: object
description:
Input port node to receive pixel data from the
display controller
port@1:
type: object
description:
DSI output port node to the panel or the next bridge
in the chain
fsl,clock-drop-level:
description:
Specifies the level at wich the crtc_clock should be dropped
patternProperties:
"^panel@[0-9]+$": true
required:
- clock-names
- clocks
- compatible
- interrupts
- mux-controls
- phy-names
- phys
- ports
- reg
- reset-names
- resets
examples:
- |
mipi_dsi: mipi_dsi@30a00000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,imx8mq-nwl-dsi";
reg = <0x30A00000 0x300>;
clocks = <&clk 163>, <&clk 244>, <&clk 245>, <&clk 164>;
clock-names = "core", "rx_esc", "tx_esc", "phy_ref";
interrupts = <0 34 4>;
mux-controls = <&mux 0>;
power-domains = <&pgc_mipi>;
resets = <&src 0>, <&src 1>, <&src 2>, <&src 3>;
reset-names = "byte", "dpi", "esc", "pclk";
phys = <&dphy>;
phy-names = "dphy";
panel@0 {
compatible = "rocktech,jh057n00900";
reg = <0>;
port@0 {
panel_in: endpoint {
remote-endpoint = <&mipi_dsi_out>;
};
};
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
mipi_dsi_in: endpoint {
remote-endpoint = <&lcdif_mipi_dsi>;
};
};
port@1 {
reg = <1>;
mipi_dsi_out: endpoint {
remote-endpoint = <&panel_in>;
};
};
};
};

View File

@ -0,0 +1,60 @@
Samsung MIPI DSIM bridge bindings
The MIPI DSIM host controller drives the video signals from
display controller to video peripherals using DSI protocol.
This is an un-managed DSI bridge. In order to use this bridge,
an encoder or bridge must be implemented to manage the platform
specific initializations.
Required properties:
- compatible: "fsl,imx8mm-mipi-dsim"
- reg: the register range of the MIPI DSIM controller
- interrupts: the interrupt number for this module
- clock, clock-names: phandles to the MIPI-DSI clocks described in
Documentation/devicetree/bindings/clock/clock-bindings.txt
"cfg" - DSIM access clock
"pll-ref" - DSIM PHY PLL reference clock
- assigned-clocks: phandles to clocks that requires initial configuration
- assigned-clock-rates: rates of the clocks that requires initial configuration
- pref-clk: Assign DPHY PLL reference clock frequency. If not exists,
DSIM bridge driver will use the default lock frequency
which is 27MHz.
- port: input and output port nodes with endpoint definitions as
defined in Documentation/devicetree/bindings/graph.txt;
the input port should be connected to an encoder or a
bridge that manages this MIPI DSIM host and the output
port should be connected to a panel or a bridge input
port
Optional properties:
-dsi-gpr: a phandle which provides the MIPI DSIM control and gpr registers
example:
mipi_dsi: mipi_dsi@32E10000 {
compatible = "fsl,imx8mm-mipi-dsim";
reg = <0x0 0x32e10000 0x0 0x400>;
clocks = <&clk IMX8MM_CLK_DSI_CORE_DIV>,
<&clk IMX8MM_CLK_DSI_PHY_REF_DIV>;
clock-names = "cfg", "pll-ref";
assigned-clocks = <&clk IMX8MM_CLK_DSI_CORE_SRC>,
<&clk IMX8MM_CLK_DSI_PHY_REF_SRC>;
assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_266M>,
<&clk IMX8MM_VIDEO_PLL1_OUT>;
assigned-clock-rates = <266000000>, <594000000>;
interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
dsi-gpr = <&dispmix_gpr>;
status = "disabled";
port@0 {
dsim_from_lcdif: endpoint {
remote-endpoint = <&lcdif_to_dsim>;
};
};
port@1 {
dsim_to_adv7535: endpoint {
remote-endpoint = <&adv7535_from_dsim>;
};
};
};

View File

@ -110,6 +110,218 @@ prg@21cc000 {
fsl,pres = <&pre1>, <&pre2>, <&pre3>;
};
Freescale i.MX DPU
====================
Required properties:
- compatible: Should be "fsl,<chip>-dpu"
- reg: should be register base and length as documented in the
datasheet
- interrupt-parent: phandle pointing to the parent interrupt controller.
- interrupts, interrupt-names: Should contain interrupts and names as
documented in the datasheet.
- clocks, clock-names: phandles to the DPU clocks described in
Documentation/devicetree/bindings/clock/clock-bindings.txt
The following clocks are expected on i.MX8qxp:
"pll0" - PLL clock for display interface 0
"pll1" - PLL clock for display interface 1
"disp0" - pixel clock for display interface 0
"disp1" - pixel clock for display interface 1
The needed clock numbers for each are documented in
Documentation/devicetree/bindings/clock/imx8qxp-lpcg.txt.
- power-domains: phandles pointing to power domain.
- power-domain-names: power domain names relevant to power-domains phandles.
- fsl,dpr-channels: phandles to the DPR channels attached to this DPU,
sorted by memory map addresses.
- fsl,pixel-combiner: phandle to the pixel combiner unit attached to this DPU.
Optional properties:
- port@[0-1]: Port nodes with endpoint definitions as defined in
Documentation/devicetree/bindings/media/video-interfaces.txt.
ports 0 and 1 should correspond to display interface 0 and
display interface 1, respectively.
example:
dpu: dpu@56180000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,imx8qxp-dpu";
reg = <0x56180000 0x40000>;
interrupt-parent = <&irqsteer_dpu>;
interrupts = <448>, <449>, <450>, <64>,
<65>, <66>, <67>, <68>,
<69>, <70>, <193>, <194>,
<195>, <196>, <197>, <72>,
<73>, <74>, <75>, <76>,
<77>, <78>, <79>, <80>,
<81>, <199>, <200>, <201>,
<202>, <203>, <204>, <205>,
<206>, <207>, <208>, <0>,
<1>, <2>, <3>, <4>,
<82>, <83>, <84>, <85>,
<209>, <210>, <211>, <212>;
interrupt-names = "store9_shdload",
"store9_framecomplete",
"store9_seqcomplete",
"extdst0_shdload",
"extdst0_framecomplete",
"extdst0_seqcomplete",
"extdst4_shdload",
"extdst4_framecomplete",
"extdst4_seqcomplete",
"extdst1_shdload",
"extdst1_framecomplete",
"extdst1_seqcomplete",
"extdst5_shdload",
"extdst5_framecomplete",
"extdst5_seqcomplete",
"disengcfg_shdload0",
"disengcfg_framecomplete0",
"disengcfg_seqcomplete0",
"framegen0_int0",
"framegen0_int1",
"framegen0_int2",
"framegen0_int3",
"sig0_shdload",
"sig0_valid",
"sig0_error",
"disengcfg_shdload1",
"disengcfg_framecomplete1",
"disengcfg_seqcomplete1",
"framegen1_int0",
"framegen1_int1",
"framegen1_int2",
"framegen1_int3",
"sig1_shdload",
"sig1_valid",
"sig1_error",
"cmdseq_error",
"comctrl_sw0",
"comctrl_sw1",
"comctrl_sw2",
"comctrl_sw3",
"framegen0_primsync_on",
"framegen0_primsync_off",
"framegen0_secsync_on",
"framegen0_secsync_off",
"framegen1_primsync_on",
"framegen1_primsync_off",
"framegen1_secsync_on",
"framegen1_secsync_off";
clocks = <&dc_lpcg IMX_DC0_PLL0_CLK>,
<&dc_lpcg IMX_DC0_PLL1_CLK>,
<&dc_lpcg IMX_DC0_DISP0_CLK>,
<&dc_lpcg IMX_DC0_DISP1_CLK>;
clock-names = "pll0", "pll1", "disp0", "disp1";
power-domains = <&pd IMX_SC_R_DC_0>,
<&pd IMX_SC_R_DC_0_PLL_0>,
<&pd IMX_SC_R_DC_0_PLL_1>;
power-domain-names = "dc", "pll0", "pll1";
fsl,dpr-channels = <&dc0_dpr1_channel1>, <&dc0_dpr1_channel2>,
<&dc0_dpr1_channel3>, <&dc0_dpr2_channel1>,
<&dc0_dpr2_channel2>, <&dc0_dpr2_channel3>;
fsl,pixel-combiner = <&dc0_pc>;
dpu_disp0: port@0 {
reg = <0>;
dpu_disp0_lvds0_ch0: endpoint@0 {
remote-endpoint = <&ldb1_ch0>;
};
dpu_disp0_lvds0_ch1: endpoint@1 {
remote-endpoint = <&ldb1_ch1>;
};
dpu_disp0_mipi_dsi: endpoint@2 {
};
};
dpu_disp1: port@1 {
reg = <1>;
dpu_disp1_lvds1_ch0: endpoint@0 {
remote-endpoint = <&ldb2_ch0>;
};
dpu_disp1_lvds1_ch1: endpoint@1 {
remote-endpoint = <&ldb2_ch1>;
};
dpu_disp1_mipi_dsi: endpoint@2 {
};
};
};
Freescale i.MX8 PC (Pixel Combiner)
=============================================
Required properties:
- compatible: should be "fsl,<chip>-pixel-combiner"
- reg: should be register base and length as documented in the
datasheet
- power-domains: phandle pointing to power domain
example:
pixel-combiner@56020000 {
compatible = "fsl,imx8qm-pixel-combiner";
reg = <0x56020000 0x10000>;
power-domains = <&pd IMX_SC_R_DC_0>;
};
Freescale i.MX8 PRG (Prefetch Resolve Gasket)
=============================================
Required properties:
- compatible: should be "fsl,<chip>-prg"
- reg: should be register base and length as documented in the
datasheet
- clocks: phandles to the PRG apb and rtram clocks, as described in
Documentation/devicetree/bindings/clock/clock-bindings.txt and
Documentation/devicetree/bindings/clock/imx8qxp-lpcg.txt.
- clock-names: should be "apb" and "rtram"
- power-domains: phandle pointing to power domain
example:
prg@56040000 {
compatible = "fsl,imx8qm-prg";
reg = <0x56040000 0x10000>;
clocks = <&dc0_prg0_lpcg 0>, <&dc0_prg0_lpcg 1>;
clock-names = "apb", "rtram";
power-domains = <&pd IMX_SC_R_DC_0>;
};
Freescale i.MX8 DPRC (Display Prefetch Resolve Channel)
=======================================================
Required properties:
- compatible: should be "fsl,<chip>-dpr-channel"
- reg: should be register base and length as documented in the
datasheet
- fsl,sc-resource: SCU resource number as defined in
include/dt-bindings/firmware/imx/rsrc.h
- fsl,prgs: phandles to the PRG unit(s) attached to this DPRC, the first one
is the primary PRG and the second one(if available) is the auxiliary PRG
which is used to fetch luma chunk of a YUV frame with 2 planars.
- clocks: phandles to the DPRC apb, b and rtram clocks, as described in
Documentation/devicetree/bindings/clock/clock-bindings.txt and
Documentation/devicetree/bindings/clock/imx8qxp-lpcg.txt.
- clock-names: should be "apb", "b" and "rtram"
- power-domains: phandle pointing to power domain
example:
dpr-channel@560e0000 {
compatible = "fsl,imx8qm-dpr-channel";
reg = <0x560e0000 0x10000>;
fsl,sc-resource = <IMX_SC_R_DC_0_BLIT1>;
fsl,prgs = <&dc0_prg2>, <&dc0_prg1>;
clocks = <&dc0_dpr0_lpcg 0>,
<&dc0_dpr0_lpcg 1>,
<&dc0_rtram0_lpcg 0>;
clock-names = "apb", "b", "rtram";
power-domains = <&pd IMX_SC_R_DC_0>;
};
Parallel display support
========================

View File

@ -9,15 +9,24 @@ nodes describing each of the two LVDS encoder channels of the bridge.
Required properties:
- #address-cells : should be <1>
- #size-cells : should be <0>
- compatible : should be "fsl,imx53-ldb" or "fsl,imx6q-ldb".
Both LDB versions are similar, but i.MX6 has an additional
multiplexer in the front to select any of the four IPU display
interfaces as input for each LVDS channel.
- compatible : should be "fsl,imx53-ldb" or "fsl,imx6q-ldb" or
"fsl,imx8qm-ldb" or "fsl,imx8qxp-ldb".
All LDB versions are similar.
i.MX6q/dl has an additional multiplexer in the front to select
any of the two or four IPU display interfaces as input for each
LVDS channel.
i.MX8qm LDB supports 10bit RGB input and needs an additional
phy.
i.MX8qxp LDB only supports one LVDS encoder channel(either
channel0 or channel1).
- gpr : should be <&gpr> on i.MX53 and i.MX6q.
The phandle points to the iomuxc-gpr region containing the LVDS
control register.
- fsl,auxldb : phandle to auxiliary LDB which is used in dual channel mode.
Only required by i.MX8qxp.
- clocks, clock-names : phandles to the LDB divider and selector clocks and to
the display interface selector clocks, as described in
the display interface selector clocks or pixel and
bypass clocks as described in
Documentation/devicetree/bindings/clock/clock-bindings.txt
The following clocks are expected on i.MX53:
"di0_pll" - LDB LVDS channel 0 mux
@ -29,14 +38,25 @@ Required properties:
On i.MX6q the following additional clocks are needed:
"di2_sel" - IPU2 DI0 mux
"di3_sel" - IPU2 DI1 mux
The following clocks are expected on i.MX8qm and i.MX8qxp:
"pixel" - pixel clock
"bypass" - bypass clock
The following clocks are expected on i.MX8qxp:
"aux_pixel" - auxiliary pixel clock in dual channel mode
"aux_bypass" - auxiliary bypass clock in dual channel mode
The needed clock numbers for each are documented in
Documentation/devicetree/bindings/clock/imx5-clock.txt, and in
Documentation/devicetree/bindings/clock/imx6q-clock.txt.
Documentation/devicetree/bindings/clock/imx6q-clock.txt, and in
Documentation/devicetree/bindings/clock/imx8qm-lpcg.txt, and in
Documentation/devicetree/bindings/clock/imx8qxp-lpcg.txt.
- power-domains : phandle pointing to power domain, only required by i.MX8qm and
i.MX8qxp.
Optional properties:
- pinctrl-names : should be "default" on i.MX53, not used on i.MX6q
- pinctrl-names : should be "default" on i.MX53, not used on i.MX6q, i.MX8qm
and i.MX8qxp
- pinctrl-0 : a phandle pointing to LVDS pin settings on i.MX53,
not used on i.MX6q
not used on i.MX6q, i.MX8qm and i.MX8qxp
- fsl,dual-channel : boolean. if it exists, only LVDS channel 0 should
be configured - one input will be distributed on both outputs in dual
channel mode
@ -57,9 +77,14 @@ Required properties:
(lvds-channel@[0,1], respectively).
On i.MX6, there should be four input ports (port@[0-3]) that correspond
to the four LVDS multiplexer inputs.
A single output port (port@2 on i.MX5, port@4 on i.MX6) must be connected
to a panel input port. Optionally, the output port can be left out if
display-timings are used instead.
On i.MX8qm, the two channels of LDB connect to one display interface of DPU.
A single output port (port@2 on i.MX5, port@4 on i.MX6, port@1 on i.MX8qm
and i.MX8qxp) must be connected to a panel input port or a bridge input port.
Optionally, the output port can be left out if display-timings are used
instead.
- phys: the phandle for the LVDS PHY device. Valid only on i.MX8qm and
i.MX8qxp.
- phy-names: should be "ldb_phy". Valid only on i.MX8qm and i.MX8qxp.
Optional properties (required if display-timings are used):
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
@ -69,6 +94,7 @@ Optional properties (required if display-timings are used):
This describes how the color bits are laid out in the
serialized LVDS signal.
- fsl,data-width : should be <18> or <24>
Additionally, <30> for i.MX8qm.
example:

View File

@ -0,0 +1,93 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
# Copyright 2019 NXP
%YAML 1.2
---
$id: "http://devicetree.org/schemas/display/imx/nxp,imx8mq-dcss.yaml#"
$schema: "http://devicetree.org/meta-schemas/core.yaml#"
title: iMX8MQ Display Controller Subsystem (DCSS)
maintainers:
- Laurentiu Palcu <laurentiu.palcu@nxp.com>
description:
The DCSS (display controller sub system) is used to source up to three
display buffers, compose them, and drive a display using HDMI 2.0a(with HDCP
2.2) or MIPI-DSI. The DCSS is intended to support up to 4kp60 displays. HDR10
image processing capabilities are included to provide a solution capable of
driving next generation high dynamic range displays.
properties:
compatible:
const: nxp,imx8mq-dcss
reg:
maxItems: 2
interrupts:
maxItems: 3
items:
- description: Context loader completion and error interrupt
- description: DTG interrupt used to signal context loader trigger time
- description: DTG interrupt for Vblank
interrupt-names:
maxItems: 3
items:
- const: ctx_ld
- const: ctxld_kick
- const: vblank
- const: dtrc_ch1
- const: dtrc_ch2
clocks:
maxItems: 5
items:
- description: Display APB clock for all peripheral PIO access interfaces
- description: Display AXI clock needed by DPR, Scaler, RTRAM_CTRL
- description: RTRAM clock
- description: Pixel clock, can be driver either by HDMI phy clock or MIPI
- description: DTRC clock, needed by video decompressor
- description: PLL source clock, usually VIDEO2_PLL, used when output is HDMI;
- description: PLL PHY reference clock, used when output is HDMI;
clock-names:
items:
- const: apb
- const: axi
- const: rtrm
- const: pix
- const: dtrc
- const: pll_src
- const: pll_phy_ref
port@0:
type: object
description: A port node pointing to a hdmi_in or mipi_in port node.
examples:
- |
dcss: display-controller@32e00000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "nxp,imx8mq-dcss";
reg = <0x32e00000 0x2d000>, <0x32e2f000 0x1000>;
interrupts = <6>, <8>, <9>, <16>, <17>;
interrupt-names = "ctx_ld", "ctxld_kick", "vblank", "dtrc_ch1", "dtrc_ch2";
interrupt-parent = <&irqsteer>;
clocks = <&clk 248>, <&clk 247>, <&clk 249>,
<&clk 254>,<&clk 122>, <&clk 266>, <&clk 267>;
clock-names = "apb", "axi", "rtrm", "pix", "dtrc",
"pll_src", "pll_phy_ref";
assigned-clocks = <&clk 107>, <&clk 109>, <&clk 266>;
assigned-clock-parents = <&clk 78>, <&clk 78>, <&clk 3>;
assigned-clock-rates = <800000000>,
<400000000>;
port@0 {
dcss_out: endpoint {
remote-endpoint = <&hdmi_in>;
};
};
};

View File

@ -14,6 +14,11 @@ Required properties:
- "pix" for the LCDIF block clock
- (MX6SX-only) "axi", "disp_axi" for the bus interface clock
Optional properties:
- max-memory-bandwidth: maximum bandwidth in bytes per second that the
controller can handle; if not present, the memory
interface is fast enough to handle all possible video modes
Required sub-nodes:
- port: The connection to an encoder chip.

View File

@ -0,0 +1,9 @@
Japan Display Inc. 10.1" WUXGA (1920x1200) TFT LCD panel
The panel has dual LVDS channels.
Required properties:
- compatible: should be "jdi,tx26d202vm0bwa"
This binding is compatible with the simple-panel binding, which is specified
in simple-panel.txt in this directory.

View File

@ -0,0 +1,82 @@
* Freescale enhanced Direct Memory Access(eDMA-v3) Controller
The eDMA-v3 controller is inherited from FSL eDMA, and firstly is intergrated
on Freescale i.MX8QM SOC chip. The eDMA channels have multiplex capability by
programmble memory-mapped registers. Specific DMA request source has fixed channel.
* eDMA Controller
Required properties:
- compatible :
- "fsl,imx8qm-edma" for eDMA used similar to that on i.MX8QM SoC
- "fsl,imx8qm-adma" for audio eDMA used on i.MX8QM
- reg : Specifies base physical address(s) and size of the eDMA channel registers.
Each eDMA channel has separated register's address and size.
- interrupts : A list of interrupt-specifiers, each channel has one interrupt.
- interrupt-names : Should contain below template:
"edmaX-chanX-Xx"
| | |---> receive/transmit, r or t
| |---> channel id, the max number is 32
|---> edma controller instance, 0, 1, 2,..etc
- #dma-cells : Must be <3>.
The 1st cell specifies the channel ID.
The 2nd cell specifies the channel priority.
The 3rd cell specifies the channel attributes which include below:
BIT(0): transmit or receive:
0: transmit, 1: receive.
BIT(1): local or remote access:
0: local, 1: remote.
BIT(2): dualfifo case or not(only in Audio cyclic now):
0: not dual fifo case, 1: dualfifo case.
See the SoC's reference manual for all the supported request sources.
- dma-channels : Number of channels supported by the controller
- power-domains: Power domains for edma channel used.
- power-domain-names: Power domains name for edma channel used.
Examples:
edma0: dma-controller@40018000 {
compatible = "fsl,imx8qm-edma";
reg = <0x0 0x5a2c0000 0x0 0x10000>, /* channel12 UART0 rx */
<0x0 0x5a2d0000 0x0 0x10000>, /* channel13 UART0 tx */
<0x0 0x5a2e0000 0x0 0x10000>, /* channel14 UART1 rx */
<0x0 0x5a2f0000 0x0 0x10000>; /* channel15 UART1 tx */
#dma-cells = <3>;
dma-channels = <4>;
interrupts = <GIC_SPI 434 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 435 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 436 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 437 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "edma0-chan12-rx", "edma0-chan13-tx",
"edma0-chan14-rx", "edma0-chan15-tx";
power-domains = <&pd IMX_SC_R_DMA_0_CH12>,
<&pd IMX_SC_R_DMA_0_CH13>,
<&pd IMX_SC_R_DMA_0_CH14>,
<&pd IMX_SC_R_DMA_0_CH15>;
power-domain-names = "edma0-chan12", "edma0-chan13",
"edma0-chan14", "edma0-chan15";
status = "okay";
};
* DMA clients
DMA client drivers that uses the DMA function must use the format described
in the dma.txt file, using a three-cell specifier for each channel: the 1st
specifies the channel number, the 2nd specifies the priority, and the 3rd
specifies the channel type is for transmit or receive: 0: transmit, 1: receive.
Examples:
lpuart1: serial@5a070000 {
compatible = "fsl,imx8qm-lpuart";
reg = <0x0 0x5a070000 0x0 0x1000>;
interrupts = <GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>;
interrupt-parent = <&gic>;
clocks = <&clk IMX8QM_UART1_CLK>;
clock-names = "ipg";
assigned-clock-names = <&clk IMX8QM_UART1_CLK>;
assigned-clock-rates = <80000000>;
power-domains = <&pd IMX_SC_R_UART_1>,
power-domain-names = "uart";
dma-names = "tx","rx";
dmas = <&edma0 15 0 0>,
<&edma0 14 0 1>;
status = "disabled";
};

View File

@ -16,6 +16,21 @@ Optional properties:
- #dma-channels : Number of DMA channels supported. Should be 16.
- #dma-requests : Number of DMA requests supported.
* DMA capability limitation
Specify the DMA capability limitations.
For example, some SoCs only support up to 32bit DMA capability, although
they are 64bit SoCs.
- only-dma-mask32: 1 means that the SoCs only suppot up to 32bit DMA
capability.
Example:
dma_cap: dma_cap {
compatible = "dma-capability";
only-dma-mask32 = <1>;
};
Example:
dma: dma@10001000 {

View File

@ -9,6 +9,8 @@ Required properties:
"fsl,imx53-sdma"
"fsl,imx6q-sdma"
"fsl,imx7d-sdma"
"fsl,imx6sx-sdma"
"fsl,imx6ul-sdma"
"fsl,imx8mq-sdma"
The -to variants should be preferred since they allow to determine the
correct ROM script addresses needed for the driver to work without additional
@ -51,8 +53,14 @@ The full ID of peripheral types can be found below.
22 SSI Dual FIFO (needs firmware ver >= 2)
23 Shared ASRC
24 SAI
25 HDMI Audio
The third cell specifies the transfer priority as below.
The third cell specifies the transfer priority and software done
as below.
Bit31: sw_done
Bit15~Bit8: selector
Bit7~Bit0: priority level
ID transfer priority
-------------------------
@ -60,6 +68,9 @@ The third cell specifies the transfer priority as below.
1 Medium
2 Low
For example: 0x80000000 means sw_done enabled for done0 sector and
High priority for PDM on i.mx8mm.
Optional properties:
- gpr : The phandle to the General Purpose Register (GPR) node.

View File

@ -0,0 +1,57 @@
Device-Tree bindings for drivers/gpio/gpio-imx-rpmsg.c gpio driver over
rpmsg. On i.mx7ULP PTA PTB are connected on M4 side, so rpmsg gpio driver
needed to get/set gpio status from M4 side by rpmsg.
Required properties:
- compatible : Should be "fsl,imx-rpmsg-gpio".
- port_idx : Specify the GPIO PORT index, PTA:0, PTB:1.
- gpio-controller : Mark the device node as a gpio controller.
- #gpio-cells : Should be two. The first cell is the pin number and
the second cell is used to specify the gpio polarity:
0 = active high
1 = active low
- interrupt-controller: Marks the device node as an interrupt controller.
- #interrupt-cells : Should be 2. The first cell is the GPIO number.
The second cell bits[3:0] is used to specify trigger type and level flags:
1 = low-to-high edge triggered.
2 = high-to-low edge triggered.
4 = active high level-sensitive.
8 = active low level-sensitive.
Note: Each GPIO port should have an alias correctly numbered in "aliases"
node.
Examples:
aliases {
gpio4 = &rpmsg_gpio0;
gpio5 = &rpmsg_gpio1;
};
rpmsg_gpio0: rpmsg-gpio0 {
compatible = "fsl,imx-rpmsg-gpio";
port_idx = <0>;
gpio-controller;
#gpio-cells = <2>;
#interrupt-cells = <2>;
interrupt-controller;
interrupt-parent = <&rpmsg_gpio0>;
status = "okay";
};
rpmsg_gpio1: rpmsg-gpio1 {
compatible = "fsl,imx-rpmsg-gpio";
port_idx = <1>;
gpio-controller;
#gpio-cells = <2>;
#interrupt-cells = <2>;
interrupt-controller;
interrupt-parent = <&rpmsg_gpio1>;
status = "okay";
};
&skeleton_node {
interrupt-parent = <&rpmsg_gpio1>;
interrupts = <7 2>;
wakeup-gpios = <&rpmsg_gpio1 7 GPIO_ACTIVE_LOW>;
};

View File

@ -31,6 +31,7 @@ Optional properties:
- first cell is the pin number
- second cell is used to specify flags
- interrupts: Interrupt specifier for the controllers interrupt.
- out-default: set the output IO default voltage. Exp: out-default = /bits/ 16 <mask val>;
Please refer to gpio.txt in this directory for details of the common GPIO
bindings used by client devices.

View File

@ -25,6 +25,8 @@ Required Properties:
Optional Properties:
- reset-gpios: Reference to the GPIO connected to the reset input.
- idle-state: if present, overrides i2c-mux-idle-disconnect,
Please refer to Documentation/devicetree/bindings/mux/mux-controller.txt
- i2c-mux-idle-disconnect: Boolean; if defined, forces mux to disconnect all
children in idle state. This is necessary for example, if there are several
multiplexers on the bus and the devices behind them use same I2C addresses.

View File

@ -0,0 +1,29 @@
* Freescale Virtual I2C RPMSG bus driver for i.MX
Required properties:
- compatible :
- "fsl,i2c-rpbus" for I2C bus over RPMSG compatible on i.MX8QXP/QM soc
The i2c-rpbus node should define its bus id (which is the node communicating
with M4) in alias.
Examples:
aliases {
...
i2c1 = &i2c_rpbus_1;
...
};
&i2c_rpbus_1 {
compatible = "fsl,i2c-rpbus";
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
devs_in_this_i2c_bus__for_example: pca6416@20 {
compatible = "ti,tca6416";
reg = <0x20>;
gpio-controller;
#gpio-cells = <2>;
};
};

View File

@ -0,0 +1,14 @@
* XEN frontend i2c controller
Required properties:
- compatible :
- "xen,i2c" for xen i2c frontend
- be-adapter : the backend i2c adapter name
Examples:
xen_i2c0: xen_i2c@0 {
compatible = "xen,i2c";
be-adapter = "5a800000.i2c";
status = "okay";
};

View File

@ -0,0 +1,22 @@
Device-Tree bindings for input/keyboard/imx_sc_pwrkey.c poweron/off driver
over SCU. On i.mx8QM/QXP poweron/off key is connected on SCU side, so need
to get key event by MU.
Required properties:
- compatible = "fsl,imx8-pwrkey";
Each button/key looked as the sub node:
Required properties:
- linux,code: the key value defined in
include/dt-bindings/input/input.h
Optional property:
- wakeup-source: wakeup feature, the keys can wakeup from
suspend if the keys with this property pressed.
Example nodes:
sc_pwrkey: sc-powerkey {
compatible = "fsl,imx8-pwrkey";
linux,keycode = <KEY_POWER>;
wakeup-source;
};

View File

@ -0,0 +1,33 @@
Device-Tree bindings for input/keyboard/rpmsg-keys.c keys driver over
rpmsg. On i.mx7ULP keys are connected on M4 side, so rpmsg-keys driver
needed to get the key status from M4 side by rpmsg.
Required properties:
- compatible = "fsl,rpmsg-keys";
Each button/key looked as the sub node:
Required properties:
- label: the key name
- linux,code: the key value defined in
include/dt-bindings/input/input.h
Optional property:
- rpmsg-key,wakeup: wakeup feature, the keys can wakeup from
suspend if the keys with this property pressed.
Example nodes:
rpmsg_keys: rpmsg-keys {
compatible = "fsl,rpmsg-keys";
volume-up {
label = "Volume Up";
rpmsg-key,wakeup;
linux,code = <KEY_VOLUMEUP>;
};
volume-down {
label = "Volume Down";
rpmsg-key,wakeup;
linux,code = <KEY_VOLUMEDOWN>;
};
};

View File

@ -0,0 +1,48 @@
FocalTech touch controller
The focaltech controller is connected to host processor via i2c.
The controller generates interrupts when the user touches the panel.
The host controller is expected to read the touch coordinates over
i2c and pass the coordinates to the rest of the system.
Required properties:
- compatible : should be "focaltech,fts"
- reg : i2c slave address of the device, should be <0x38>
- interrupt-parent : parent of interrupt
- interrupts : irq gpio, "0x02" stands for that the irq triggered by falling edge.
- focaltech,irq-gpio : irq gpio, same as "interrupts" node.
- focaltech,reset-gpio : reset gpio
- focaltech,num-max-touches : maximum number of touches support
- focaltech,display-coords : display resolution in pixels. A four tuple consisting of minX, minY, maxX and maxY.
Optional properties:
- focaltech,have-key : specify if virtual keys are supported
- focaltech,key-number : number of keys
- focaltech,keys : virtual key codes mapping to the coords
- focaltech,key-y-coord : constant y coordinate of keys, depends on the y resolution
- focaltech,key-x-coords : constant x coordinates of keys, depends on the x resolution
- focaltech,swap-xy : swap x-y coordinates
- focaltech,panel-type : set panel type, default is FT5416 panel
- focaltech,scaling-down-half : scale down the x-y coordiantes to half
Example:
i2c@f9927000 {
focaltech@38{
compatible = "focaltech,fts";
reg = <0x38>;
interrupt-parent = <&msm_gpio>;
interrupts = <13 0x02>;
focaltech,reset-gpio = <&msm_gpio 12 0x01>;
focaltech,irq-gpio = <&msm_gpio 13 0x02>;
focaltech,max-touch-number = <5>;
focaltech,display-coords = <0 0 1080 1920>;
focaltech,have-key;
focaltech,key-number = <3>;
focaltech,keys = <139 102 158>;
focaltech,key-y-coord = <2000>;
focaltech,key-x-coords = <200 600 800>;
focaltech,swap-xy;
};
};

View File

@ -0,0 +1,18 @@
* VTL Touchscreen Controller
Required properties:
- compatible: must be "vtl,ct365"
- reg: i2c slave address
- interrupt-parent: the phandle for the interrupt controller
- interrupts: touch controller interrupt
- gpios: the gpio pin to be used for reset
Example:
touchscreen@01 {
compatible = "vtl,ct365";
reg = <0x01>;
interrupt-parent = <&gpio6>;
interrupts = <14 0>;
gpios = <&gpio4 10 0>;
};

View File

@ -21,6 +21,8 @@ Required properties:
imx6sx, imx7s, imx8qxp, imx8qm.
The "fsl,imx6sx-mu" compatible is seen as generic and should
be included together with SoC specific compatible.
There is a version 1.0 MU on imx7ulp, use "fsl,imx7ulp-mu"
compatible to support it.
- reg : Should contain the registers location and length
- interrupts : Interrupt number. The interrupt specifier format depends
on the interrupt controller parent.

View File

@ -0,0 +1,33 @@
NXP Image Sensor Interface
========================
The Image Sensor Interface (ISI) is used to obtain the image data for
processing in its pipeline channels. Each pipeline processes the image
line from a configured source and performs one or more functions that
are configured by software, such as down scaling, color space conversion,
de-interlacing, alpha insertion, cropping and rotation (horizontal and
vertical). The processed image is stored into programmable memory locations.
Required properties:
- compatible: should be "fsl,imx8-isi", where SoC can be one of imx8qxp, imx8qm
- reg: the register base and size for the device registers
- interrupts: the ISI interrupt, high level active
- clock-names: should be "per"
- clocks: the ISI AXI clock
- interface: specify ISI input, virtual channel and output,
<Input MIPI_VCx Output>
Input : 0-DC0, 1-DC1, 2-MIPI CSI0, 3-MIPI CSI1, 4-HDMI, 5-MEM
VCx : 0-VC0, 1-VC1, 2-VC2, 3-VC3, MIPI CSI only
Output: 0-DC0, 1-DC1, 2-MEM
Example:
isi_0: isi@58100000 {
compatible = "fsl,imx8-isi";
reg = <0x58100000 0x10000>;
interrupts = <GIC_SPI 297 IRQ_TYPE_LEVEL_HIGH>;
interrupt-parent = <&gic>;
clocks = <&img_lpcg IMX_IMG_LPCG_PDMA0_CLK>;
clock-names = "per";
power-domains = <&pd IMX_SC_R_ISI_CH0>;
interface = <2 0 2>;
};

View File

@ -0,0 +1,107 @@
Freescale i.MX8QXP/QM JPEG encoder/decoder
=========================
jpegdec node
--------------
This is the device node for the JPEG decoder in i.MXQXP/QM SoC, an
ISO/IEC 10918-1 JPEG standard compliant decoder, for Baseline
and Extended Sequential DCT modes.
Required properties:
- compatible : "fsl,imx8-jpgdec";
- reg : base address and length of the register set for the device;
- interrupts : list of interrupts for jpeg decoder
- clocks : list of clock specifiers, see
Documentation/devicetree/bindings/clock/clock-bindings.txt for details;
- assigned-clock-rates : the value should be 200MHz;
- power-domains : a list of phandle to the power domain, see
Documentation/devicetree/bindings/power/power_domain.txt for details;
Optional properties:
- clock-names : must contain clock names to match entries in the
clock property;
- power-domain-name : must contain matching names for entries in the
the power-domains property.
example:
jpegdec: jpegdec@58400000 {
compatible = "fsl,imx8-jpgdec";
reg = <0x58400000 0x00050000 >;
interrupts = <GIC_SPI 309 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 310 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 311 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 312 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&img_jpeg_dec_clk 0>,
<&img_jpeg_dec_clk 1>;
clock-names = "per", "ipg";
assigned-clocks = <&img_jpeg_dec_clk 0>,
<&img_jpeg_dec_clk 1>;
assigned-clock-rates = <200000000>;
power-domains = <&pd IMX_SC_R_ISI_CH0>,
<&pd IMX_SC_R_MJPEG_DEC_MP>,
<&pd IMX_SC_R_MJPEG_DEC_S0>,
<&pd IMX_SC_R_MJPEG_DEC_S1>,
<&pd IMX_SC_R_MJPEG_DEC_S2>,
<&pd IMX_SC_R_MJPEG_DEC_S3>;
power-domain-names = "pd_isi_ch0", "pd_dec_mp",
"pd_dec_s0", "pd_dec_s1",
"pd_dec_s2", "pd_dec_s3";
status = "disabled";
jpegenc node
--------------
This is the device node for the JPEG encoder in i.MXQXP/QM SoC,
similar with the JPEG decoder above.
Required properties:
- compatible : "fsl,imx8-jpgenc";
- reg : base address and length of the register set for the device;
- interrupts : list of interrupts for jpeg encoder
- clocks : list of clock specifiers, see
Documentation/devicetree/bindings/clock/clock-bindings.txt for details;
- assigned-clock-rates : the value should be 200MHz;
- power-domains : a list of phandle to the power domain, see
Documentation/devicetree/bindings/power/power_domain.txt for details;
Optional properties:
- clock-names : must contain clock names to match entries in the
clock property;
- power-domain-name : must contain matching names for entries in the
the power-domains property.
example:
jpegenc: jpegenc@58450000 {
compatible = "fsl,imx8-jpgenc";
reg = <0x58450000 0x00050000 >;
interrupts = <GIC_SPI 305 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 306 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 307 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 308 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&img_jpeg_enc_clk 0>,
<&img_jpeg_enc_clk 1>;
clock-names = "per", "ipg";
assigned-clocks = <&img_jpeg_enc_clk 0>,
<&img_jpeg_enc_clk 1>;
assigned-clock-rates = <200000000>;
power-domains = <&pd IMX_SC_R_ISI_CH0>,
<&pd IMX_SC_R_MJPEG_ENC_MP>,
<&pd IMX_SC_R_MJPEG_ENC_S0>,
<&pd IMX_SC_R_MJPEG_ENC_S1>,
<&pd IMX_SC_R_MJPEG_ENC_S2>,
<&pd IMX_SC_R_MJPEG_ENC_S3>;
power-domain-names = "pd_isi_ch0", "pd_enc_mp",
"pd_enc_s0", "pd_enc_s1",
"pd_enc_s2", "pd_enc_s3";
status = "disabled";
};

View File

@ -0,0 +1,38 @@
Virtual Media device
-------------------------------
Virtual Media device is used to manage all modules in image capture subsystem
of imx8qxp/qm platform. ISI(Image Sensor Interface), MIPI CSI, Parallel CSI
device node should be under it.
Required properties:
- compatible : must be "fsl,mxc-md";
- reg : Must contain an entry for each entry in reg-names;
- #address-cells: should be <1>;
- #size-cells : should be <1>;
- ranges : use to handle address space
Optional properties:
- parallel_csi: indicate that camera sensor use parallel interface
For example:
cameradev: camera {
compatible = "fsl,mxc-md", "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
ranges;
isi@58100000 {
compatible = "fsl,imx8-isi";
reg = <0x58100000 0x10000>;
...
};
csi@58227000 {
compatible = "fsl,mxc-mipi-csi2";
...
};
...
};

View File

@ -0,0 +1,73 @@
Freescale i.MX8QXP/QM MIPI CSI2
=========================
mipi_csi2 node
--------------
This is the device node for the MIPI CSI-2 receiver core in i.MXQXP/QM SoC.
Required properties:
- compatible : "fsl,mxc-mipi-csi2";
- reg : base address and length of the register set for the device;
- clocks : list of clock specifiers, see
Documentation/devicetree/bindings/clock/clock-bindings.txt for details;
- clock-names : must contain "clk_core", "clk_esc" and "clk_pxl" entries,
matching entries in the clock property;
- assigned-clock-rates : the value should be 360MHz and 72MHz;
- power-domains : a phandle to the power domain, see
Documentation/devicetree/bindings/power/power_domain.txt for details;
- power-domain-name : must contain "pd_csi", "pd_isi_ch0".
Optional properties:
- virtual-channel: whether use mipi csi virtual channel
The device node should contain one 'port' child nodes with one child 'endpoint'
node, according to the bindings defined in:
Documentation/devicetree/bindings/ media/video-interfaces.txt.
The following are properties specific to those nodes.
port node
---------
- reg : (required) can take the values 0 which mean the port is a
sink port;
endpoint node
-------------
- data-lanes : (required) an array specifying active physical MIPI-CSI2
data input lanes and their mapping to logical lanes; this
shall only be applied to port 0 (sink port), the array's
content is unused only its length is meaningful,
in this case the maximum length supported is 2;
example:
mipi_csi: csi@58227000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,mxc-mipi-csi2";
reg = <0x58227000 0x1000>,
<0x58221000 0x1000>;
clocks = <&csi_lpcg IMX_CSI_LPCG_CSI0_CORE_CLK>,
<&csi_lpcg IMX_CSI_LPCG_CSI0_ESC_CLK>,
<&img_lpcg IMX_IMG_LPCG_CSI0_PXL_LINK_CLK>;
clock-names = "clk_core", "clk_esc", "clk_pxl";
assigned-clocks = <&csi_lpcg IMX_CSI_LPCG_CSI0_CORE_CLK>,
<&csi_lpcg IMX_CSI_LPCG_CSI0_ESC_CLK>;
assigned-clock-rates = <360000000>, <72000000>;
power-domains = <&pd IMX_SC_R_CSI_0>, <&pd IMX_SC_R_ISI_CH0>;
power-domain-names = "pd_csi", "pd_isi_ch0";
status = "okay";
port@0 {
reg = <0>;
mipi_csi0_ep: endpoint {
remote-endpoint = <&ov5640_mipi_ep>;
data-lanes = <1 2>;
};
};
};

View File

@ -0,0 +1,48 @@
Freescale i.MX8QXP Parallel Capture Interface
=========================
parallel interface node
--------------
This is the device node for the parallel capture interface in i.MX8QXP SoC.
Required properties:
- compatible : "fsl,mxc-parallel-csi";
- reg : base address and length of the register set for the device;
- clocks : list of clock specifiers
- clock-names : must contain "pixel", "ipg", "div" and "dpll" entries,
matching entries in the clock property;
- assigned-clocks : need to set the parent of pixel clock;
- assigned-clock-parent: set the pll as the parent of pixel clock;
- assigned-clock-rates : the value should be 160MHz;
- power-domains : a phandle to the power domain, see
- power-domain-name : must contain "pd_pi", "pd_isi_ch0".
port node
- reg : can take the values 0 which mean the port is a sink port
example:
parallel_csi: pcsi@58261000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,mxc-parallel-csi";
reg = <0x58261000 0x1000>;
clocks = <&pi_lpcg IMX_PI_LPCG_PI0_PIXEL_CLK>,
<&pi_lpcg IMX_PI_LPCG_PI0_IPG_CLK>,
<&clk IMX_PARALLEL_PER_DIV_CLK>,
<&clk IMX_PARALLEL_DPLL_CLK>;
clock-names = "pixel", "ipg", "div", "dpll";
assigned-clocks = <&clk IMX_PARALLEL_PER_DIV_CLK>;
assigned-clock-parents = <&clk IMX_PARALLEL_DPLL_CLK>;
assigned-clock-rates = <160000000>; /* 160MHz */
power-domains = <&pd IMX_SC_R_PI_0>, <&pd IMX_SC_R_ISI_CH0>;
power-domain-names = "pd_pi", "pd_isi_ch0";
port@0 {
reg = <0>;
parallel_csi_ep: endpoint {
remote-endpoint = <&ov5640_ep>;
};
};
};

View File

@ -0,0 +1,51 @@
* NXP PCA9450 Power Management Integrated Circuit (PMIC) bindings
Required properties:
- compatible : Should be "nxp,pca9450".
- reg : I2C slave address.
- pinctrl-0 : Pinctrl setting for pmic such as interrupt pin.
- gpio_intr : gpio pin used for interrupt pin.
- regulators: : List of child nodes that specify the regulator
initialization data. Including 6 buck regulators
and 5 ldo regulators.
Example:
pmic: pca9450@25 {
reg = <0x25>;
compatible = "nxp,pca9450";
/* PMIC PCA9450 PMIC_nINT GPIO1_IO3 */
pinctrl-0 = <&pinctrl_pmic>;
gpio_intr = <&gpio1 3 GPIO_ACTIVE_LOW>;
regulators {
#address-cells = <1>;
#size-cells = <0>;
pca9450,pmic-buck2-uses-i2c-dvs;
/* Run/Standby voltage */
pca9450,pmic-buck2-dvs-voltage = <950000>, <850000>;
buck1_reg: regulator@0 {
reg = <0>;
regulator-compatible = "buck1";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <2187500>;
regulator-boot-on;
regulator-always-on;
regulator-ramp-delay = <3125>;
};
buck2_reg: regulator@1 {
reg = <1>;
regulator-compatible = "buck2";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <2187500>;
regulator-boot-on;
regulator-always-on;
regulator-ramp-delay = <3125>;
};
.....
};
};

View File

@ -0,0 +1,27 @@
*MediaLB (MLB) for i.MX
Required properties:
- compatible :
- "fsl,imx6sx-mlb50" for MLB compatible with the one integrated on i.MX6SX soc
- "fsl,imx6q-mlb150" for MLB compatible with the one integrated on i.MX6Q
- "fsl,imx8qxp-mlb150" for MLB compatible with the one integrated on i.MX8 soc
- reg : address and length for mlb registers
- interrupt-parent : core interrupt controller
- interrupts : MLB Break/Error interrupt and ahb interrupt
Two ahb interrupt for imx6, ahb_int[0] and ahb_int[1]
One ahb interrupt for imx8, ahb_int[0]
- clocks : mlb clock specifier
Examples:
mlb: mlb@5B060000 {
compatible = "fsl,imx6q-mlb150";
reg = <0x0 0x5B060000 0x0 0x10000>;
interrupt-parent = <&gic>;
interrupts = <0 265 IRQ_TYPE_LEVEL_HIGH>,
<0 266 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8QM_MLB_CLK>,
<&clk IMX8QM_MLB_HCLK>,
<&clk IMX8QM_MLB_IPG_CLK>;
status = "disabled";
};

View File

@ -19,6 +19,7 @@ Required properties:
"fsl,imx7d-usdhc"
"fsl,imx7ulp-usdhc"
"fsl,imx8qxp-usdhc"
"fsl,imx8mm-usdhc"
Optional properties:
- fsl,wp-controller : Indicate to use controller internal write protection
@ -38,6 +39,19 @@ Optional properties:
This property allows user to change the tuning step to more than one delay
cells which is useful for some special boards or cards when the default
tuning step can't find the proper delay window within limited tuning retries.
- fsl,strobe-dll-delay-target: Specify the strobe dll control slave delay target.
This delay target programming host controller loopback read clock, and this
property allows user to change the delay target for the strobe input read clock.
If not use this property, driver default set the delay target to value 7.
Only eMMC HS400 mode need to take care of this property.
- auto-cmd23-broken: disable the ACMD23 function of USDHC.
This is required for eMMC on imx6qpdl/imx6sx/imx7d when it use ADMA mode. Because
for these SoC, it do not support the ACMD23 completely, only take the 16 bit block
count from the 0x4 register (BLK_ATT) as argument for the ACMD23, the upper 16 bit
of the CMD23's argument is ignored. This will impact the reliable write operation
and the RPMB block write operation, because these operations need to set the bit 31
of the CMD23's argument. SDMA mode will default disable the ACMD23 mode. SD card do
not has this limitation on these SoCs.
Examples:

View File

@ -283,6 +283,12 @@ properties:
description:
SDIO only. Enables wake up of host system on SDIO IRQ assertion.
pm-ignore-notify:
$ref: /schemas/types.yaml#/definitions/flag
description:
Ignore mmc PM notify. This will prevent MMC core automatically
to re-detect cards after sysem resume back.
vmmc-supply:
description:
Supply for the card power

View File

@ -12,9 +12,42 @@ Required properties:
- reg : Offset and length of the register set for this device
- interrupts : Interrupt tuple for this device
Optional properties:
Clocking information is must for flexcan. please refer below info for
understanding clocking in flexcan:
- clock-frequency : The oscillator frequency driving the flexcan device
• The FLEXCAN module is divided into two blocks. Controller host interface
("CHI") and Protocol Engine ("PE")
• Both these blocks require clock.
• CHI is responsible for registers read write including MB read/write.
While PE is responsible for Transfer/receive data on CAN bus.
• The clocks feeding to these two blocks can be synchronous (i.e. same clock)
or asynchronous (i.e. separate clocks).
• Selection is made in the CLK_SRC bit (bit 13) of Control 1 Register.
- CLK_SRC = 0, asynchronous i.e. separate clocks for CHI and PE
- CLK_SRC = 1, synchronous i.e. CHI clock is used for PE and PE
clock is not used.
• If this bit is not implemented in SOC, then SOC only supports asynchronous
clocks.
• Either of the clock can be generated by any of the clock source.
• When the two clocks are asynchronous, then following restrictions apply to
PE clock.
- PE clock must be less than CHI clock.
• If low jitter is required on CAN bus, dedicated oscillator can be used to
provide PE clock, but it must be less than CHI clock.
Base on above information clocking info in flexcan can be defined in two ways:
Method 1(Preferred):
- clocks: phandle to the clocks feeding the flexcan. Two can be given:
- "ipg": Protocol Engine clock
- "per": Controller host interface clock
- clock-names: Must contain the clock names described just above.
Method 2(Not Preferred):
- clock-frequency : The synchronous clock frequency supplied to both
Controller host interface and Protocol Engine
Optional properties:
- xceiver-supply: Regulator that powers the CAN transceiver
@ -51,3 +84,12 @@ Example:
clock-frequency = <200000000>; // filled in by bootloader
fsl,clk-source = <0>; // select clock source 0 for PE
};
can@2180000 {
compatible = "fsl,lx2160ar1-flexcan";
reg = <0x0 0x2180000 0x0 0x10000>;
interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&sysclk>, <&clockgen 4 7>;
clock-names = "ipg", "per";
status = "disabled";
};

View File

@ -34,6 +34,15 @@ properties:
to the device by the boot program is different from the
local-mac-address property.
nvmem-mac-address:
allOf:
- $ref: /schemas/types.yaml#definitions/uint8-array
- minItems: 6
maxItems: 6
description:
Specifies the MAC address that was read from nvmem-cells and dynamically
add the property in device node;
max-frame-size:
$ref: /schemas/types.yaml#definitions/uint32
description:
@ -54,6 +63,11 @@ properties:
nvmem-cells-names:
const: mac-address
nvmem_macaddr_swap:
$ref: /schemas/types.yaml#/definitions/flag
description:
swap bytes order for the 6 bytes of MAC address
phy-connection-type:
description:
Operation mode of the PHY interface

View File

@ -5,6 +5,19 @@ Required properties:
- reg : Address and length of the register set for the device
- interrupts : Should contain fec interrupt
- phy-mode : See ethernet.txt file in the same directory
- clock-name: Should be the names of the clocks
- "ipg", for MAC ipg_clk_s, ipg_clk_mac_s that are for register accessing
- "ahb", for MAC ipg_clk, ipg_clk_mac that are bus clock
- "ptp"(option), for IEEE1588 timer clock that requires the clock
- "enet_clk_ref"(option), for MAC transmit/receiver reference clock like
RGMII TXC clock or RMII reference clock. It depends on board design,
the clock is required if RGMII TXC and RMII reference clock source from
SOC internal PLL.
- "enet_out"(option), output clock for external device, like supply clock
for PHY. The clock is required if PHY clock source from SOC.
- "enet_2x_txclk"(option), for RGMII sampleing clock which fixed at 250Mhz.
The clock is required if SOC RGMII enable clock delay.
- clocks: Phandles to input clocks.
Optional properties:
- phy-supply : regulator that powers the Ethernet PHY.
@ -35,6 +48,11 @@ Optional properties:
For imx6sx, "int0" handles all 3 queues and ENET_MII. "pps" is for the pulse
per second interrupt associated with 1588 precision time protocol(PTP).
- fsl,wakeup_irq : The property defines the wakeup irq index in enet irq source.
- stop-mode : If present, indicates soc need to set gpr bit to request stop mode.
- mii-exclusive: If present, each MAC has their exclusive MDIO bus in current board
design, otherwise multiple MACs share one MDIO bus to reduce Pins utilize.
Optional subnodes:
- mdio : specifies the mdio bus in the FEC, used as a container for phy nodes
according to phy.txt in the same directory

View File

@ -0,0 +1,199 @@
=============================================================================
NXP Programmable Packet Forwarding Engine Device Bindings
CONTENTS
- PFE Node
- Ethernet Node
=============================================================================
PFE Node
DESCRIPTION
PFE Node has all the properties associated with Packet Forwarding Engine block.
PROPERTIES
- compatible
Usage: required
Value type: <stringlist>
Definition: Must include "fsl,pfe"
- reg
Usage: required
Value type: <prop-encoded-array>
Definition: A standard property.
Specifies the offset of the following registers:
- PFE configuration registers
- DDR memory used by PFE
- fsl,pfe-num-interfaces
Usage: required
Value type: <u32>
Definition: Must be present. Value can be either one or two.
- interrupts
Usage: required
Value type: <prop-encoded-array>
Definition: Three interrupts are specified in this property.
- HIF interrupt
- HIF NO COPY interrupt
- Wake On LAN interrupt
- interrupt-names
Usage: required
Value type: <stringlist>
Definition: Following strings are defined for the 3 interrupts.
"pfe_hif" - HIF interrupt
"pfe_hif_nocpy" - HIF NO COPY interrupt
"pfe_wol" - Wake On LAN interrupt
- memory-region
Usage: required
Value type: <phandle>
Definition: phandle to a node describing reserved memory used by pfe.
Refer:- Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
- fsl,pfe-scfg
Usage: required
Value type: <phandle>
Definition: phandle for scfg.
- fsl,rcpm-wakeup
Usage: required
Value type: <phandle>
Definition: phandle for rcpm.
- clocks
Usage: required
Value type: <phandle>
Definition: phandle for clockgen.
- clock-names
Usage: required
Value type: <string>
Definition: phandle for clock name.
EXAMPLE
pfe: pfe@04000000 {
compatible = "fsl,pfe";
reg = <0x0 0x04000000 0x0 0xc00000>, /* AXI 16M */
<0x0 0x83400000 0x0 0xc00000>; /* PFE DDR 12M */
reg-names = "pfe", "pfe-ddr";
fsl,pfe-num-interfaces = <0x2>;
interrupts = <0 172 0x4>, /* HIF interrupt */
<0 173 0x4>, /*HIF_NOCPY interrupt */
<0 174 0x4>; /* WoL interrupt */
interrupt-names = "pfe_hif", "pfe_hif_nocpy", "pfe_wol";
memory-region = <&pfe_reserved>;
fsl,pfe-scfg = <&scfg 0>;
fsl,rcpm-wakeup = <&rcpm 0xf0000020>;
clocks = <&clockgen 4 0>;
clock-names = "pfe";
status = "okay";
pfe_mac0: ethernet@0 {
};
pfe_mac1: ethernet@1 {
};
};
=============================================================================
Ethernet Node
DESCRIPTION
Ethernet Node has all the properties associated with PFE used by platforms to
connect to PHY:
PROPERTIES
- compatible
Usage: required
Value type: <stringlist>
Definition: Must include "fsl,pfe-gemac-port"
- reg
Usage: required
Value type: <prop-encoded-array>
Definition: A standard property.
Specifies the gemacid of the interface.
- fsl,gemac-bus-id
Usage: required
Value type: <u32>
Definition: Must be present. Value should be the id of the bus
connected to gemac.
- fsl,gemac-phy-id (deprecated binding)
Usage: required
Value type: <u32>
Definition: This binding shouldn't be used with new platforms.
Must be present. Value should be the id of the phy
connected to gemac.
- fsl,mdio-mux-val
Usage: required
Value type: <u32>
Definition: Must be present. Value can be either 0 or 2 or 3.
This value is used to configure the mux to enable mdio.
- phy-mode
Usage: required
Value type: <string>
Definition: Must include "sgmii"
- fsl,pfe-phy-if-flags (deprecated binding)
Usage: required
Value type: <u32>
Definition: This binding shouldn't be used with new platforms.
Must be present. Value should be 0 by default.
If there is not phy connected, this need to be 1.
- phy-handle
Usage: optional
Value type: <phandle>
Definition: phandle to the PHY device connected to this device.
- mdio : A required subnode which specifies the mdio bus in the PFE and used as
a container for phy nodes according to ../phy.txt.
EXAMPLE
ethernet@0 {
compatible = "fsl,pfe-gemac-port";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x0>; /* GEM_ID */
fsl,gemac-bus-id = <0x0>; /* BUS_ID */
fsl,mdio-mux-val = <0x0>;
phy-mode = "sgmii";
phy-handle = <&sgmii_phy1>;
};
ethernet@1 {
compatible = "fsl,pfe-gemac-port";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x1>; /* GEM_ID */
fsl,gemac-bus-id = <0x1>; /* BUS_ID */
fsl,mdio-mux-val = <0x0>;
phy-mode = "sgmii";
phy-handle = <&sgmii_phy2>;
};
mdio@0 {
#address-cells = <1>;
#size-cells = <0>;
sgmii_phy1: ethernet-phy@2 {
reg = <0x2>;
};
sgmii_phy2: ethernet-phy@1 {
reg = <0x1>;
};
};

View File

@ -0,0 +1,52 @@
IMX8 glue layer controller, NXP imx8 families support Synopsys MAC 5.10a IP.
This file documents platform glue layer for IMX.
Please see stmmac.txt for the other unchanged properties.
The device node has following properties.
Required properties:
- compatible: Should be "nxp,imx8mp-dwmac-eqos" to select glue layer
and "snps,dwmac-5.10a" to select IP version.
- clocks: Must contain a phandle for each entry in clock-names.
- clock-names: Should be "stmmaceth" for the host clock.
Should be "pclk" for the MAC apb clock.
Should be "ptp_ref" for the MAC timer clock.
Should be "tx" for the MAC RGMII TX clock:
- interrupt-names: Should contain a list of interrupt names corresponding to
the interrupts in the interrupts property, if available.
Should be "macirq" for the main MAC IRQ
Should be "eth_wake_irq" for the IT which wake up system
- intf_mode: Should be phandle/offset pair. The phandle to the syscon node which
encompases the GPR register, and the offset of the GPR register.
- required for imx8mp platform.
- is optional for imx8dxl platform.
Optional properties:
- intf_mode: is optional for imx8dxl platform.
Example:
eqos: ethernet@30bf0000 {
compatible = "nxp,imx8mp-dwmac-eqos", "snps,dwmac-5.10a";
reg = <0x30bf0000 0x10000>;
interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "eth_wake_irq", "macirq";
clocks = <&clk IMX8MP_CLK_ENET_QOS_ROOT>,
<&clk IMX8MP_CLK_QOS_ENET_ROOT>,
<&clk IMX8MP_CLK_ENET_QOS_TIMER>,
<&clk IMX8MP_CLK_ENET_QOS>;
clock-names = "stmmaceth", "pclk", "ptp_ref", "tx";
assigned-clocks = <&clk IMX8MP_CLK_ENET_AXI>,
<&clk IMX8MP_CLK_ENET_QOS_TIMER>,
<&clk IMX8MP_CLK_ENET_QOS>;
assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_266M>,
<&clk IMX8MP_SYS_PLL2_100M>,
<&clk IMX8MP_SYS_PLL2_125M>;
assigned-clock-rates = <0>, <100000000>, <125000000>;
nvmem-cells = <&eth_mac0>;
nvmem-cell-names = "mac-address";
nvmem_macaddr_swap;
intf_mode = <&gpr 0x4>;
status = "disabled";
};

View File

@ -11,6 +11,7 @@ Required properties:
Optional properties:
- brcm,drive-strength : drive strength used for SDIO pins on device in mA
(default = 6).
- brcm,use_board_type : suffix string for NVRAM
- interrupts : specifies attributes for the out-of-band interrupt (host-wake).
When not specified the device will use in-band SDIO interrupts.
- interrupt-names : name of the out-of-band interrupt, which must be set

View File

@ -81,6 +81,12 @@ Optional properties:
Definition: Name of external front end module used. Some valid FEM names
for example: "microsemi-lx5586", "sky85703-11"
and "sky85803" etc.
- qcom,snoc-host-cap-8bit-quirk:
Usage: Optional
Value type: <empty>
Definition: Quirk specifying that the firmware expects the 8bit version
of the host capability QMI request
Example (to supply PCI based wifi block details):

View File

@ -10,6 +10,9 @@ Required properties:
- "fsl,imx6qp-pcie"
- "fsl,imx7d-pcie"
- "fsl,imx8mq-pcie"
- "fsl,imx8mm-pcie"
- "fsl,imx8qm-pcie"
- "fsl,imx8qxp-pcie"
- reg: base address and length of the PCIe controller
- interrupts: A list of interrupt outputs of the controller. Must contain an
entry for each entry in the interrupt-names property.
@ -38,6 +41,15 @@ Optional properties:
The regulator will be enabled when initializing the PCIe host and
disabled either as part of the init process or when shutting down the
host.
- ext_osc: use the external oscillator as ref clock( 1: external OSC is
used, 0 internal PLL is used).
- hard_wired: the PCIe port is hard wired to the EP device(0: one slot
is connected).
- reserved-region: one reserved no-map memory used by PCIe EP/RC
validation system.
- interrupt-names: Optional include the following entries:
- "dma": The interrupt that is asserted when an DMA interrupter
is received
Additional required properties for imx6sx-pcie:
- clock names: Must include the following additional entries:
@ -60,6 +72,17 @@ Additional required properties for imx8mq-pcie:
- clock-names: Must include the following additional entries:
- "pcie_aux"
Additional required properties for imx8 pcie:
- hsio-cfg: hsio configration mode when the pcie node is supported.
mode 1: pciea 2 lanes and one sata ahci port.
mode 2: pciea 1 lane, pcieb 1 lane and one sata ahci port.
mode 3: pciea 2 lanes, pcieb 1 lane.
- local-addr: the local address used in hsio module.
Example:
hsio-cfg = <PCIEAX2PCIEBX1>;
hsio = <&hsio>;
local-addr = <0x80000000>;
Example:
pcie@01000000 {

View File

@ -21,13 +21,18 @@ Required properties:
"fsl,ls1046a-pcie"
"fsl,ls1043a-pcie"
"fsl,ls1012a-pcie"
"fsl,ls1028a-pcie"
EP mode:
"fsl,ls1046a-pcie-ep", "fsl,ls-pcie-ep"
- reg: base addresses and lengths of the PCIe controller register blocks.
- interrupts: A list of interrupt outputs of the controller. Must contain an
entry for each entry in the interrupt-names property.
- interrupt-names: Must include the following entries:
"intr": The interrupt that is asserted for controller interrupts
- interrupt-names: It could include the following entries:
"aer": Asserted for aer interrupt when chip support the aer interrupt with
none MSI/MSI-X/INTx mode,but there is interrupt line for aer.
"pme": Asserted for pme interrupt when chip support the pme interrupt with
none MSI/MSI-X/INTx mode,but there is interrupt line for pme.
......
- fsl,pcie-scfg: Must include two entries.
The first entry must be a link to the SCFG device node
The second entry must be '0' or '1' based on physical PCIe controller index.
@ -43,8 +48,9 @@ Example:
reg = <0x00 0x03400000 0x0 0x00010000 /* controller registers */
0x40 0x00000000 0x0 0x00002000>; /* configuration space */
reg-names = "regs", "config";
interrupts = <GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */
interrupt-names = "intr";
interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>, /* aer interrupt */
<GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>; /* pme interrupt */
interrupt-names = "aer", "pme";
fsl,pcie-scfg = <&scfg 0>;
#address-cells = <3>;
#size-cells = <2>;

View File

@ -0,0 +1,78 @@
NXP Layerscape PCIe Gen4 controller
This PCIe controller is based on the Mobiveil PCIe IP and thus inherits all
the common properties defined in mobiveil-pcie.txt.
HOST MODE
=========
Required properties:
- compatible: should contain the platform identifier such as:
"fsl,lx2160a-pcie"
- reg: base addresses and lengths of the PCIe controller register blocks.
"csr_axi_slave": Bridge config registers
"config_axi_slave": PCIe controller registers
- interrupts: A list of interrupt outputs of the controller. Must contain an
entry for each entry in the interrupt-names property.
- interrupt-names: It could include the following entries:
"intr": The interrupt that is asserted for controller interrupts
"aer": Asserted for aer interrupt when chip support the aer interrupt with
none MSI/MSI-X/INTx mode,but there is interrupt line for aer.
"pme": Asserted for pme interrupt when chip support the pme interrupt with
none MSI/MSI-X/INTx mode,but there is interrupt line for pme.
- dma-coherent: Indicates that the hardware IP block can ensure the coherency
of the data transferred from/to the IP block. This can avoid the software
cache flush/invalid actions, and improve the performance significantly.
- msi-parent : See the generic MSI binding described in
Documentation/devicetree/bindings/interrupt-controller/msi.txt.
DEVICE MODE
=========
Required properties:
- compatible: should contain the platform identifier such as:
"fsl,lx2160a-pcie-ep"
- reg: base addresses and lengths of the PCIe controller register blocks.
"regs": PCIe controller registers.
"addr_space" EP device CPU address.
- apio-wins: number of requested apio outbound windows.
Optional Property:
- max-functions: Maximum number of functions that can be configured (default 1).
RC Example:
pcie@3400000 {
compatible = "fsl,lx2160a-pcie";
reg = <0x00 0x03400000 0x0 0x00100000 /* controller registers */
0x80 0x00000000 0x0 0x00001000>; /* configuration space */
reg-names = "csr_axi_slave", "config_axi_slave";
interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>, /* AER interrupt */
<GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>, /* PME interrupt */
<GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */
interrupt-names = "aer", "pme", "intr";
#address-cells = <3>;
#size-cells = <2>;
device_type = "pci";
apio-wins = <8>;
ppio-wins = <8>;
dma-coherent;
bus-range = <0x0 0xff>;
msi-parent = <&its>;
ranges = <0x82000000 0x0 0x40000000 0x80 0x40000000 0x0 0x40000000>;
#interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 7>;
interrupt-map = <0000 0 0 1 &gic 0 0 GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
<0000 0 0 2 &gic 0 0 GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
<0000 0 0 3 &gic 0 0 GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>,
<0000 0 0 4 &gic 0 0 GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
};
EP Example:
pcie_ep@3400000 {
compatible = "fsl,lx2160a-pcie-ep";
reg = <0x00 0x03400000 0x0 0x00100000
0x80 0x00000000 0x8 0x00000000>;
reg-names = "regs", "addr_space";
apio-wins = <8>;
status = "disabled";
};

View File

@ -5,6 +5,7 @@ Required properties:
- compatible: should be one of:
"fsl,imx8-ddr-pmu"
"fsl,imx8m-ddr-pmu"
"fsl,imx8mp-ddr-pmu"
- reg: physical address and size

View File

@ -1,7 +1,7 @@
* Freescale i.MX8MQ USB3 PHY binding
Required properties:
- compatible: Should be "fsl,imx8mq-usb-phy"
- compatible: Should be "fsl,imx8mq-usb-phy" or "fsl,imx8mp-usb-phy"
- #phys-cells: must be 0 (see phy-bindings.txt in this directory)
- reg: The base address and length of the registers
- clocks: phandles to the clocks for each clock listed in clock-names

View File

@ -0,0 +1,19 @@
Mixel LVDS combo PHY
Required properties:
- compatible: must be "mixel,lvds-combo-phy".
- reg: offset and length of the register block.
- #phy-cells: see phy-bindings.txt in the same directory, must be <0>.
- clocks: clock phandle and specifier pair.
- clock-names: string, clock input name, must be "phy".
- power-domains: phandle pointing to power domain.
Example:
ldb_phy@56221000 {
compatible = "mixel,lvds-combo-phy";
reg = <0x0 0x56221000 0x0 0x100>, <0x0 0x56228000 0x0 0x1000>;
#phy-cells = <0>;
clocks = <&clk IMX_LVDS0_PHY_CLK>;
clock-names = "phy";
power-domains = <&pd IMX_SC_R_LVDS_0>;
};

View File

@ -0,0 +1,39 @@
Mixel LVDS PHY
This LVDS PHY supports two LVDS channels.
Required properties:
- compatible: must be "mixel,lvds-phy".
- reg: offset and length of the register block.
- #address-cells: number of address cells for the LVDS channel subnodes, must
be <1>.
- #size-cells: number of size cells for the LVDS channel subnodes, must be <0>.
- clocks: clock phandle and specifier pair.
- clock-names: string, clock input name, must be "phy".
- power-domains: phandle pointing to power domain.
The LVDS PHY device tree node should have the subnodes corresponding to the two
LVDS channels. These subnodes must contain the following properties:
- reg: the PHY ID.
- #phy-cells: see phy-bindings.txt in the same directory, must be <0>.
Example:
ldb_phy@56241000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "mixel,lvds-phy";
reg = <0x0 0x56241000 0x0 0x100>;
clocks = <&clk IMX_LVDS0_PHY_CLK>;
clock-names = "phy";
power-domains = <&pd IMX_SC_R_LVDS_0>;
ldb1_phy1: port@0 {
reg = <0>;
#phy-cells = <0>;
};
ldb1_phy2: port@1 {
reg = <1>;
#phy-cells = <0>;
};
};

View File

@ -0,0 +1,38 @@
* Freescale IMX8MP IOMUX Controller
Please refer to fsl,imx-pinctrl.txt and pinctrl-bindings.txt in this directory
for common binding part and usage.
Required properties:
- compatible: "fsl,imx8mp-iomuxc"
- reg: should contain the base physical address and size of the iomuxc
registers.
Required properties in sub-nodes:
- fsl,pins: each entry consists of 6 integers and represents the mux and config
setting for one pin. The first 5 integers <mux_reg conf_reg input_reg mux_val
input_val> are specified using a PIN_FUNC_ID macro, which can be found in
<arch/arm64/boot/dts/freescale/imx8mp-pinfunc.h>. The last integer CONFIG is
the pad setting value like pull-up on this pin. Please refer to i.MX8M Plus
Reference Manual for detailed CONFIG settings.
Examples:
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
};
iomuxc: pinctrl@30330000 {
compatible = "fsl,imx8mp-iomuxc";
reg = <0x30330000 0x10000>;
pinctrl_uart1: uart1grp {
fsl,pins = <
MX8MP_IOMUXC_UART1_RXD__UART1_DCE_RX 0x140
MX8MP_IOMUXC_UART1_TXD__UART1_DCE_TX 0x140
MX8MP_IOMUXC_UART3_RXD__UART1_DCE_CTS 0x140
MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS 0x140
>;
};
};

View File

@ -0,0 +1,19 @@
* Freescale SIUL2 iomux controller
See chapter 20 ("System Integration Unit Lite2 (SIUL2)") in the reference
manual[1].
Based on fsl,imx-pincontrol implementation.
Required properties:
- compatible: "fsl,s32v234-siul2"
- fsl,pins: two integers array, represents a group of pins mux and config
setting. The format is fsl,pins = <PIN_FUNC_ID CONFIG>
PIN_FUNC_ID - id of MSCR to be modified
CONFIG - configuration to be written in the MSCR/IMCR register
Even though IMCR register should be used as input register, it can be
set and addressed in the same way as MSCR, only instead of passing the
IMCR index, IMCR_IDX + 512 is passed[1].
[1] https://www.nxp.com/webapp/Download?colCode=S32V234RM

View File

@ -71,6 +71,13 @@ pinctrl-names: The list of names to assign states. List entry 0 defines the
name for integer state ID 0, list entry 1 for state ID 1, and
so on.
pinctrl-assert-gpios:
List of phandles, each pointing at a GPIO which is used by some
board design to steer pins between two peripherals on the board.
It plays like a board level pin multiplexer to choose different
functions for given pins by pulling up/down the GPIOs. See
bindings/gpio/gpio.txt for details of how to specify GPIO.
For example:
/* For a client device requiring named states */

View File

@ -0,0 +1,46 @@
Device Tree Bindings for Freescale i.MX8M Generic Power Domain
==============================================================
The binding for the i.MX8M Generic power Domain[1].
[1] Documentation/devicetree/bindings/power/power_domain.txt
Required properties:
- compatible: should be of:
- "fsl,imx8m-power-domain"
- #power-domain-cells: Number of cells in a PM domain Specifier, must be 0
- domain-index: should be the domain index number need to pass to TF-A
- domain-name: the name of this pm domain
Optional properties:
- clocks: a number of phandles to clocks that need to be enabled during
domain power-up sequence to ensure reset propagation into devices
located inside this power domain
- power-supply: Power supply used to power the domain
- parent-domains: the phandle to the parent power domain
example:
vpu_g1_pd: vpug1-pd {
compatible = "fsl,imx8mm-pm-domain";
#power-domain-cells = <0>;
domain-index = <6>;
domain-name = "vpu_g1";
parent-domains = <&vpumix_pd>;
clocks = <&clk IMX8MM_CLK_VPU_G1_ROOT>;
};
Specifying Power domain for IP modules
======================================
IP cores belonging to a power domain should contain a 'power-domains'
property that is a phandle for PGC node representing the domain.
Example of a device that is part of the vpu_g1 power domain:
vpu_g1: vpu_g1@38300000 {
/* ... */
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "irq_hantro";
/* ... */
power-domains = <&vpu_g1_pd>;
};

View File

@ -9,15 +9,20 @@ Properties:
"fsl,mpc8548-pmc" should be listed for any chip whose PMC is
compatible. "fsl,mpc8536-pmc" should also be listed for any chip
whose PMC is compatible, and implies deep-sleep capability.
whose PMC is compatible, and implies deep-sleep capability and
wake on user defined packet(wakeup on ARP).
"fsl,p1022-pmc" should be listed for any chip whose PMC is
compatible, and implies lossless Ethernet capability during sleep.
"fsl,mpc8641d-pmc" should be listed for any chip whose PMC is
compatible; all statements below that apply to "fsl,mpc8548-pmc" also
apply to "fsl,mpc8641d-pmc".
Compatibility does not include bit assignments in SCCR/PMCDR/DEVDISR; these
bit assignments are indicated via the sleep specifier in each device's
sleep property.
bit assignments are indicated via the clock nodes. Device which has a
controllable clock source should have a "fsl,pmc-handle" property pointing
to the clock node.
- reg: For devices compatible with "fsl,mpc8349-pmc", the first resource
is the PMC block, and the second resource is the Clock Configuration
@ -33,31 +38,35 @@ Properties:
this is a phandle to an "fsl,gtm" node on which timer 4 can be used as
a wakeup source from deep sleep.
Sleep specifiers:
Clock nodes:
The clock nodes are to describe the masks in PM controller registers for each
soc clock.
- fsl,pmcdr-mask: For "fsl,mpc8548-pmc"-compatible devices, the mask will be
ORed into PMCDR before suspend if the device using this clock is the wake-up
source and need to be running during low power mode; clear the mask if
otherwise.
fsl,mpc8349-pmc: Sleep specifiers consist of one cell. For each bit
that is set in the cell, the corresponding bit in SCCR will be saved
and cleared on suspend, and restored on resume. This sleep controller
supports disabling and resuming devices at any time.
- fsl,sccr-mask: For "fsl,mpc8349-pmc"-compatible devices, the corresponding
bit specified by the mask in SCCR will be saved and cleared on suspend, and
restored on resume.
fsl,mpc8536-pmc: Sleep specifiers consist of three cells, the third of
which will be ORed into PMCDR upon suspend, and cleared from PMCDR
upon resume. The first two cells are as described for fsl,mpc8578-pmc.
This sleep controller only supports disabling devices during system
sleep, or permanently.
fsl,mpc8548-pmc: Sleep specifiers consist of one or two cells, the
first of which will be ORed into DEVDISR (and the second into
DEVDISR2, if present -- this cell should be zero or absent if the
hardware does not have DEVDISR2) upon a request for permanent device
disabling. This sleep controller does not support configuring devices
to disable during system sleep (unless supported by another compatible
match), or dynamically.
- fsl,devdisr-mask: Contain one or two cells, depending on the availability of
DEVDISR2 register. For compatible devices, the mask will be ORed into DEVDISR
or DEVDISR2 when the clock should be permenently disabled.
Example:
power@b00 {
compatible = "fsl,mpc8313-pmc", "fsl,mpc8349-pmc";
reg = <0xb00 0x100 0xa00 0x100>;
interrupts = <80 8>;
power@e0070 {
compatible = "fsl,mpc8536-pmc", "fsl,mpc8548-pmc";
reg = <0xe0070 0x20>;
etsec1_clk: soc-clk@24 {
fsl,pmcdr-mask = <0x00000080>;
};
etsec2_clk: soc-clk@25 {
fsl,pmcdr-mask = <0x00000040>;
};
etsec3_clk: soc-clk@26 {
fsl,pmcdr-mask = <0x00000020>;
};
};

View File

@ -50,6 +50,10 @@ properties:
description: startup time in microseconds
$ref: /schemas/types.yaml#/definitions/uint32
off-on-delay-us:
description: off delay time in microseconds
$ref: /schemas/types.yaml#/definitions/uint32
enable-active-high:
description:
Polarity of GPIO is Active high. If this property is missing,

View File

@ -3,6 +3,8 @@ PFUZE100 family of regulators
Required properties:
- compatible: "fsl,pfuze100", "fsl,pfuze200", "fsl,pfuze3000", "fsl,pfuze3001"
- reg: I2C slave address
- fsl,lpsr-mode: some registers need to be saved and restored in lpsr mode
for pfuze3000
Optional properties:
- fsl,pfuze-support-disable-sw: Boolean, if present disable all unused switch

View File

@ -0,0 +1,36 @@
GPIO reset controller
=====================
A GPIO reset controller controls a single GPIO that is connected to the reset
pin of a peripheral IC. Please also refer to reset.txt in this directory for
common reset controller binding usage.
Required properties:
- compatible: Should be "gpio-reset"
- reset-gpios: A gpio used as reset line. The gpio specifier for this property
depends on the gpio controller that provides the gpio.
- #reset-cells: 0, see below
Optional properties:
- reset-delay-us: delay in microseconds. The gpio reset line will be asserted for
this duration to reset.
- reset-post-delay-ms: delay in milliseconds to wait after reset.
- initially-in-reset: boolean. If not set, the initial state should be a
deasserted reset line. If this property exists, the
reset line should be kept in reset.
example:
sii902x_reset: gpio-reset {
compatible = "gpio-reset";
reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
reset-delay-us = <10000>;
initially-in-reset;
#reset-cells = <0>;
};
/* Device with nRESET pin connected to GPIO5_0 */
sii902x@39 {
/* ... */
resets = <&sii902x_reset>; /* active-low GPIO5_0, 10 ms delay */
};

View File

@ -0,0 +1,58 @@
NXP Display Mix clk-en Reset Controller
=======================================
This binding describes a reset controller device that is used to enable
or disable the internal clocks for all the submodules(such as, LCDIF,
MIPI DSI, MIPI CSI, ISI and etc) included by the Display Mix subsystem
on IMX8MM and IMX8MN platforms. Like sft-rstn, only assert and deassert
functions are required for submodule internal clocks enable or disable,
that means the clk-en can be treated as a real reset controller.
Please also refer to reset.txt in this directory for common reset
controller binding usage.
Required properties:
- compatible: Should be "fsl,imx8mm-dispmix-clk-en" or
"fsl,imx8mn-dispmix-clk-en".
- reg: should be register base and length as documented in the datasheet.
- clocks: phandle and clock specifier to disp apb clock for register access.
- clock-names: should be "disp-apb".
- power-domains: phandle to dispmix power domain.
- reset-cells: 1, see below.
example:
dispmix_clk_en: dispmix-clk-en@32e28004 {
compatible = "fsl,imx8mn-dispmix-clk-en";
reg = <0x0 0x32e28004 0x0 0x4>;
clocks = <&clk IMX8MN_CLK_DISP_APB_ROOT>;
clock-names = "disp-apb";
power-domains = <&dispmix_pd>;
#reset-cells = <1>;
};
Specifying clk-en control of devices
====================================
Device nodes in Display Mix should specify the reset channel required in
their "resets" property, containing a phandle to the clk-en device node
and an index to specify which channel to use, as described in
Documentation/devicetree/bindings/reset/reset.txt.
example:
lcdif_resets: lcdif-resets {
#address-cells = <1>;
#size-cells = <0>;
#reset-cells = <0>;
lcdif-clk-enable {
compatible = "lcdif,clk-enable";
resets = <&dispmix_clk_en IMX8MN_LCDIF_APB_CLK_EN>,
<&dispmix_clk_en IMX8MN_LCDIF_PIXEL_CLK_EN>;
};
};
Macro definitions for the supported reset channels can be found in:
include/dt-bindings/reset/imx8mm-dispmix.h and
include/dt-bindings/reset/imx8mn-dispmix.h.

View File

@ -0,0 +1,57 @@
NXP Display Mix mipi-rst Reset Controller
=========================================
This binding describes a reset controller device that is used to reset
or de-reset the MIPI DPHY master direction(for MIPI DSI) and slave
direction(for MIPI CSI) included by the Display Mix subsystem on IMX8MM
and IMX8MN platforms. Like sft-rstn, only assert and deassert functions
are required for PHY reset or de-reset.
Please also refer to reset.txt in this directory for common reset
controller binding usage.
Required properties:
- compatible: Should be "fsl,imx8mm-dispmix-mipi-rst" or
"fsl,imx8mn-dispmix-mipi-rst".
- reg: should be register base and length as documented in the datasheet.
- clocks: phandle and clock specifier to disp apb clock for register access.
- clock-names: should be "disp-apb".
- power-domains: phandle to dispmix power domain.
- reset-cells: 1, see below.
example:
dispmix_mipi_rst: dispmix-mipi-rst@32e28008 {
compatible = "fsl,imx8mn-dispmix-mipi-rst";
reg = <0x0 0x32e28008 0x0 0x4>;
clocks = <&clk IMX8MN_CLK_DISP_APB_ROOT>;
clock-names = "disp-apb";
active_low;
power-domains = <&dispmix_pd>;
#reset-cells = <1>;
};
Specifying mipi-rst control of devices
======================================
Device nodes in Display Mix should specify the reset channel required in
their "resets" property, containing a phandle to the mipi-rst device node
and an index to specify which channel to use, as described in
Documentation/devicetree/bindings/reset/reset.txt.
example:
mipi_dsi_resets: mipi-dsi-resets {
#address-cells = <1>;
#size-cells = <0>;
#reset-cells = <0>;
dsi-mipi-reset {
compatible = "dsi,mipi-reset";
resets = <&dispmix_mipi_rst IMX8MN_MIPI_M_RESET>;
};
};
Macro definitions for the supported reset channels can be found in:
include/dt-bindings/reset/imx8mm-dispmix.h and
include/dt-bindings/reset/imx8mn-dispmix.h.

View File

@ -0,0 +1,58 @@
NXP Display Mix sft-rstn Reset Controller
=========================================
This binding describes a reset controller device that is used to reset
or de-reset all the submodules(such as, LCDIF, MIPI DSI, MIPI CSI, ISI
and etc) included by the Display Mix subsystem on IMX8MM and IMX8MN
platforms. Only assert and deassert functions are required for submodule
reset or de-reset.
Please also refer to reset.txt in this directory for common reset
controller binding usage.
Required properties:
- compatible: Should be "fsl,imx8mm-dispmix-sft-rstn" or
"fsl,imx8mn-dispmix-sft-rstn".
- reg: should be register base and length as documented in the datasheet.
- clocks: phandle and clock specifier to disp apb clock for register access.
- clock-names: should be "disp-apb".
- power-domains: phandle to dispmix power domain.
- reset-cells: 1, see below.
example:
dispmix_sft_rstn: dispmix-sft-rstn@32e28000 {
compatible = "fsl,imx8mm-dispmix-sft-rstn";
reg = <0x0 0x32e28000 0x0 0x4>;
clocks = <&clk IMX8MM_CLK_DISP_APB_ROOT>;
clock-names = "disp-apb";
active_low;
power-domains = <&dispmix_pd>;
#reset-cells = <1>;
};
Specifying sft-rstn control of devices
======================================
Device nodes in Display Mix should specify the reset channel required in
their "resets" property, containing a phandle to the sft-rstn device node
and an index to specify which channel to use, as described in
Documentation/devicetree/bindings/reset/reset.txt.
example:
lcdif_resets: lcdif-resets {
#address-cells = <1>;
#size-cells = <0>;
#reset-cells = <0>;
lcdif-soft-resetn {
compatible = "lcdif,soft-resetn";
resets = <&dispmix_sft_rstn IMX8MN_LCDIF_APB_CLK_RESET>,
<&dispmix_sft_rstn IMX8MN_LCDIF_PIXEL_CLK_RESET>;
};
};
Macro definitions for the supported reset channels can be found in:
include/dt-bindings/reset/imx8mm-dispmix.h and
include/dt-bindings/reset/imx8mn-dispmix.h.

View File

@ -0,0 +1,77 @@
i.MX RPMSG platform implementations
Distributed framework is used in IMX RPMSG implementation, refer to the
following requirements:
- The CAN functions contained in M core and RTOS should be ready and
complete functional in 50ms after AMP system is turned on.
- Partition reset. System wouldn't be stalled by the exceptions (e.x
the reset triggered by the system hang) occurred at the other side.
And the RPMSG mechanism should be recovered automactilly after the
partition reset is completed.
In this scenario, the M core and RTOS would be kicked off by bootloader
firstly, then A core and Linux would be loaded later. Both M core/RTOS
and A core/Linux are running independly.
One physical memory region used to store the vring is mandatory required
to pre-reserved and well-knowned by both A core and M core
Required properties:
- compatible: "fsl,imx8qxp-rpmsg", "fsl,imx8mq-rpmsg", "fsl,imx8mm-rpmsg",
"fsl,imx8qm-rpmsg", "fsl,imx7ulp-rpmsg", "fsl,imx7d-rpmsg",
"fsl,imx6sx-rpmsg".
- vdev-nums: The number of the remote virtual devices.
- reg: The reserved phisical DDR memory used to store vring descriptors.
Optional properties:
- rpmsg_dma_reserved: The reserved per device dma pool, that used to
allocate the shared memory buffers from the per device.
And it is optional for some platforms, since the system dma pool
is used to allocate the shared memory buffers directly on them.
- mub-partition: The partition ID of muB side, that's optional
and used on i.mx8qm/8qxp for partition reset. The default
value is 3 in driver without this property.
=====================================================================
Mailbox used by iMX RPMSG
- mboxes: mailboxes used in the RPMSG transactions.
- mbox-names: names of the mailboxes used in RPMSG.
- "tx":TX channel with 32bit transmit register and IRQ transmit
- "rx":RX channel with 32bit receive register and IRQ support
- "rxdb":RX doorbell channel.
Example:
Rpmsg node in board dts file.
&rpmsg{
/*
* 64K for one rpmsg instance:
*/
vdev-nums = <2>;
reg = <0x0 0x90000000 0x0 0x20000>;
status = "okay";
};
SOC level dts node definitions:
rpmsg_reserved: rpmsg@0x90000000 {
no-map;
reg = <0 0x90000000 0 0x400000>;
};
rpmsg_dma_reserved:rpmsg_dma@0x90400000 {
compatible = "shared-dma-pool";
no-map;
reg = <0 0x90400000 0 0x1C00000>;
};
rpmsg: rpmsg{
compatible = "fsl,imx8qxp-rpmsg";
/* up to now, the following channels are used in imx rpmsg
* - tx1/rx1: messages channel.
* - general interrupt1: remote proc finish re-init rpmsg stack
* when A core is partition reset.
*/
mbox-names = "tx", "rx", "rxdb";
mboxes = <&lsio_mu5 0 1
&lsio_mu5 1 1
&lsio_mu5 3 1>;
mub-partition = <3>;
memory-region = <&rpmsg_dma_reserved>;
status = "disabled";
};

View File

@ -5,7 +5,7 @@ and power management.
Required properites:
- reg : Offset and length of the register set of the RCPM block.
- fsl,#rcpm-wakeup-cells : The number of IPPDEXPCR register cells in the
- #fsl,rcpm-wakeup-cells : The number of IPPDEXPCR register cells in the
fsl,rcpm-wakeup property.
- compatible : Must contain a chip-specific RCPM block compatible string
and (if applicable) may contain a chassis-version RCPM compatible
@ -20,6 +20,7 @@ Required properites:
* "fsl,qoriq-rcpm-1.0": for chassis 1.0 rcpm
* "fsl,qoriq-rcpm-2.0": for chassis 2.0 rcpm
* "fsl,qoriq-rcpm-2.1": for chassis 2.1 rcpm
* "fsl,qoriq-rcpm-2.1+": for chassis 2.1+ rcpm
All references to "1.0" and "2.0" refer to the QorIQ chassis version to
which the chip complies.
@ -27,16 +28,42 @@ Chassis Version Example Chips
--------------- -------------------------------
1.0 p4080, p5020, p5040, p2041, p3041
2.0 t4240, b4860, b4420
2.1 t1040, ls1021
2.1 t1040,
2.1+ ls1021a, ls1012a, ls1043a, ls1046a
Optional properties:
- little-endian : RCPM register block is Little Endian. Without it RCPM
will be Big Endian (default case).
- fsl,ippdexpcr1-alt-addr : The property is related to a hardware issue
on SoC LS1021A and only needed on SoC LS1021A.
Must include 1 + 2 entries.
The first entry must be a link to the SCFG device node.
The non-first entry must be offset of registers of SCFG.
The second and third entry compose an alt offset address
for IPPDEXPCR1(SCFG_SPARECR8)
Example:
The RCPM node for T4240:
rcpm: global-utilities@e2000 {
compatible = "fsl,t4240-rcpm", "fsl,qoriq-rcpm-2.0";
reg = <0xe2000 0x1000>;
fsl,#rcpm-wakeup-cells = <2>;
#fsl,rcpm-wakeup-cells = <2>;
};
The RCPM node for LS1021A:
rcpm: rcpm@1ee2140 {
compatible = "fsl,ls1021a-rcpm", "fsl,qoriq-rcpm-2.1+";
reg = <0x0 0x1ee2140 0x0 0x8>;
#fsl,rcpm-wakeup-cells = <2>;
/*
* The second and third entry compose an alt offset
* address for IPPDEXPCR1(SCFG_SPARECR8)
*/
fsl,ippdexpcr1-alt-addr = <&scfg 0x0 0x51c>;
};
* Freescale RCPM Wakeup Source Device Tree Bindings
-------------------------------------------
Required fsl,rcpm-wakeup property should be added to a device node if the device
@ -44,7 +71,7 @@ can be used as a wakeup source.
- fsl,rcpm-wakeup: Consists of a phandle to the rcpm node and the IPPDEXPCR
register cells. The number of IPPDEXPCR register cells is defined in
"fsl,#rcpm-wakeup-cells" in the rcpm node. The first register cell is
"#fsl,rcpm-wakeup-cells" in the rcpm node. The first register cell is
the bit mask that should be set in IPPDEXPCR0, and the second register
cell is for IPPDEXPCR1, and so on.

View File

@ -8,7 +8,8 @@ three substreams within totally 10 channels.
Required properties:
- compatible : Contains "fsl,imx35-asrc" or "fsl,imx53-asrc".
- compatible : Contains "fsl,imx35-asrc", "fsl,imx53-asrc",
"fsl,imx8qm-asrc0" or "fsl,imx8qm-asrc1".
- reg : Offset and length of the register set for the device.

View File

@ -0,0 +1,16 @@
NXP DSP
The IP is from Cadence.
Required properties:
- compatible : Contains "fsl,imx8qxp-dsp".
- reg : Offset and length of the register set for the device.
Example:
dsp: dsp@596e8000 {
compatible = "fsl,imx8qxp-dsp";
reg = <0x0 0x596e8000 0x0 0x88000>;
status = "okay";
};

View File

@ -0,0 +1,53 @@
Freescale Asynchronous Sample Rate Converter (ASRC) Controller
The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a
signal associated with an input clock into a signal associated with a different
output clock. The driver currently works as a Front End of DPCM with other Back
Ends Audio controller such as ESAI, SSI and SAI. It has four context to support
four substreams within totally 32 channels.
Required properties:
- compatible : Contains "fsl,imx8mn-easrc".
- reg : Offset and length of the register set for the device.
- interrupts : Contains the asrc interrupt.
- dmas : Generic dma devicetree binding as described in
Documentation/devicetree/bindings/dma/dma.txt.
- dma-names : Contains "ctx0_rx", "ctx0_tx", "ctx1_rx", "ctx1_tx",
"ctx2_rx", "ctx2_tx", "ctx3_rx", "ctx3_tx".
- clocks : Contains an entry for each entry in clock-names.
- clock-names : Contains the following entries
"mem" Peripheral clock to driver module.
- fsl,easrc-ram-script-name : The coefficient table for the filters
- fsl,asrc-rate : Defines a mutual sample rate used by DPCM Back Ends.
- fsl,asrc-width : Defines a mutual sample width used by DPCM Back Ends.
Example:
easrc: easrc@300C0000 {
compatible = "fsl,imx8mn-easrc";
reg = <0x0 0x300C0000 0x0 0x10000>;
interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8MN_CLK_ASRC_ROOT>;
clock-names = "mem";
dmas = <&sdma2 16 23 0> , <&sdma2 17 23 0>,
<&sdma2 18 23 0> , <&sdma2 19 23 0>,
<&sdma2 20 23 0> , <&sdma2 21 23 0>,
<&sdma2 22 23 0> , <&sdma2 23 23 0>;
dma-names = "ctx0_rx", "ctx0_tx",
"ctx1_rx", "ctx1_tx",
"ctx2_rx", "ctx2_tx",
"ctx3_rx", "ctx3_tx";
fsl,easrc-ram-script-name = "imx/easrc/easrc-imx8mn.bin";
fsl,asrc-rate = <8000>;
fsl,asrc-width = <16>;
status = "disabled";
};

View File

@ -0,0 +1,23 @@
fsl,mqs audio CODEC
Required properties:
- compatible : must contain one of "fsl,imx6sx-mqs", "fsl,codec-mqs"
"fsl,imx8qm-mqs".
- clocks : a list of phandles + clock-specifiers, one for each entry in
clock-names
- clock-names : must contain "mclk"
- gpr : the gpr node.
Example:
mqs: mqs {
compatible = "fsl,imx6sx-mqs";
gpr = <&gpr>;
clocks = <&clks IMX6SX_CLK_SAI1>;
clock-names = "mclk";
status = "disabled";
};

View File

@ -0,0 +1,22 @@
Freescale rpmsg i2s interface.
The rpmsg i2s is based on RPMSG that used communicating with M4 core,
which provides a synchronous audio interface that supports fullduplex
serial interfaces with frame synchronization such as I2S.
Required properties:
- compatible : Compatible list, contains "fsl,imx7ulp-rpmsg-i2s".
"fsl,imx8mq-rpmsg-i2s", "fsl,imx8qxp-rpmsg-i2s"
"fsl,imx8qm-rpmsg-i2s"
- fsl,audioindex : This is an index indicating the audio device index in
the M4 side.
Example:
rpmsg_i2s: rpmsg-i2s {
compatible = "fsl,imx7ulp-rpmsg-i2s";
/* the audio device index in m4 domain */
fsl,audioindex = <0> ;
status = "okay";
};

View File

@ -6,7 +6,9 @@ a fibre cable.
Required properties:
- compatible : Compatible list, must contain "fsl,imx35-spdif".
- compatible : Compatible list, must contain "fsl,imx35-spdif",
"fsl,vf610-spdif", "fsl,imx8qm-spdif",
"fsl,imx8mm-spdif"
- reg : Offset and length of the register set for the device.

View File

@ -28,6 +28,7 @@ The compatible list for this generic sound card currently:
(compatible with CS4271 and CS4272)
"fsl,imx-audio-wm8962"
(compatible with Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt)
"fsl,imx-audio-sgtl5000"
(compatible with Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt)

View File

@ -0,0 +1,30 @@
Freescale i.MX audio complex with AK4458 DAC
Required properties:
- compatible : "fsl,imx-audio-ak4458", "fsl,imx-audio-ak4458-mq"
- model : The user-visible name of this sound complex
- audio-cpu : The phandle of CPU DAI
- audio-codec : The phandle of the AK4458 audio DAC
- audio-routing : A list of the connections between audio components. Each entry
is a pair of strings, the first being the connection's sink, the second being
the connection's source. Valid names could be power supplies, AK4458 pins,
and the jacks on the board.
Example:
sound {
compatible = "fsl,imx-audio-ak4458";
model = "ak4458-audio";
audio-cpu = <&sai1>;
audio-codec = <&codec>;
audio-routing =
"AOUTL1", "Playback",
"AOUTR1", "Playback",
"AOUTL2", "Playback",
"AOUTR2", "Playback",
"AOUTL3", "Playback",
"AOUTR3", "Playback",
"AOUTL4", "Playback",
"AOUTR4", "Playback";
};

View File

@ -0,0 +1,27 @@
Freescale i.MX audio complex with AK4497 DAC
Required properties:
- compatible : "fsl,imx-audio-ak4497", "fsl,imx-audio-ak4497-mq"
- model : The user-visible name of this sound complex
- audio-cpu : The phandle of CPU DAI
- audio-codec : The phandle of the ak4497 audio DAC
- audio-routing : A list of the connections between audio components. Each entry
is a pair of strings, the first being the connection's sink, the second being
the connection's source. Valid names could be power supplies, ak4497 pins,
and the jacks on the board.
Example:
sound {
compatible = "fsl,imx-audio-ak4497";
model = "ak4497-audio";
audio-cpu = <&sai3>;
audio-codec = <&codec>;
audio-routing =
"AOUTLN", "Playback",
"AOUTLP", "Playback",
"AOUTRN", "Playback",
"AOUTRP", "Playback",
};

View File

@ -0,0 +1,30 @@
Freescale i.MX audio complex with AK5558 ADC
Required properties:
- compatible : "fsl,imx-audio-ak5558", "fsl,imx-audio-ak5558-mq"
- model : The user-visible name of this sound complex
- audio-cpu : The phandle of CPU DAI
- audio-codec : The phandle of the AK5558 audio ADC
- audio-routing : A list of the connections between audio components. Each entry
is a pair of strings, the first being the connection's sink, the second being
the connection's source. Valid names could be power supplies, AK5558 pins,
and the jacks on the board.
Example:
sound {
compatible = "fsl,imx-audio-ak5558";
model = "ak5558-audio";
audio-cpu = <&sai1>;
audio-codec = <&codec>;
audio-routing =
"AIN1", "Capture",
"AIN2", "Capture",
"AIN3", "Capture",
"AIN4", "Capture",
"AIN5", "Capture",
"AIN6", "Capture",
"AIN7", "Capture",
"AIN8", "Capture";
};

View File

@ -0,0 +1,16 @@
Freescale i.MX audio complex with Cadence HDMI
Required properties:
- compatible : "fsl,imx-audio-cdnhdmi", "fsl,imx8mq-evk-cdnhdmi"
- model : The user-visible name of this sound complex
- audio-cpu : The phandle of the i.MX SAI controller
- protocol : 0 is hdmi, 1 is dp.
Example:
sound-hdmi {
compatible = "fsl,imx-audio-cdnhdmi";
model = "imx-audio-hdmi";
audio-cpu = <&sai4>;
protocol = <0>;
};

View File

@ -0,0 +1,25 @@
Freescale i.MX audio complex with CS42888 codec
Required properties:
- compatible : "fsl,imx-audio-cs42888"
- model : The user-visible name of this sound complex
- esai-controller : The phandle of the i.MX SSI controller
- audio-codec : The phandle of the CS42888 audio codec
Optional properties:
- asrc-controller : The phandle of the i.MX ASRC controller
- audio-routing : A list of the connections between audio components.
Each entry is a pair of strings, the first being the connection's sink,
the second being the connection's source. Valid names could be power
supplies, CS42888 pins, and the jacks on the board:
Example:
sound {
compatible = "fsl,imx6q-sabresd-wm8962",
"fsl,imx-audio-wm8962";
model = "cs42888-audio";
esai-controller = <&esai>;
asrc-controller = <&asrc_p2p>;
audio-codec = <&codec>;
};

View File

@ -0,0 +1,18 @@
Freescale i.MX audio complex with mqs codec
Required properties:
- compatible : "fsl,imx-audio-mqs", "fsl,imx8qm-lpddr4-arm2-mqs".
- model : The user-visible name of this sound complex
- cpu-dai : The phandle of the i.MX sai controller
- audio-codec : The phandle of the mqs audio codec
Example:
sound-mqs {
compatible = "fsl,imx6sx-sdb-mqs",
"fsl,imx-audio-mqs";
model = "mqs-audio";
cpu-dai = <&sai1>;
audio-codec = <&mqs>;
};

View File

@ -0,0 +1,13 @@
Freescale i.MX audio complex with rpmsg devices
Required properties:
- compatible : "fsl,imx-audio-rpmsg"
- model : The user-visible name of this sound complex
- cpu-dai : The phandle of the i.MX rpmsg i2s device.
Example:
sound-rpmsg {
compatible = "fsl,imx-audio-rpmsg";
model = "rpmsg-audio";
cpu-dai = <&rpmsg_i2s>;
};

View File

@ -0,0 +1,24 @@
Freescale i.MX audio complex with si476x codec
Required properties:
- compatible : "fsl,imx-audio-si476x"
- model : The user-visible name of this sound complex
- ssi-controller : The phandle of the i.MX SSI controller
- mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
- mux-ext-port : The external port of the i.MX audio muxer
Note: The AUDMUX port numbering should start at 1, which is consistent with
hardware manual.
Example:
sound {
compatible = "fsl,imx-audio-si476x",
"fsl,imx-tuner-si476x";
model = "imx-radio-si476x";
ssi-controller = <&ssi1>;
mux-int-port = <2>;
mux-ext-port = <5>;
};

View File

@ -0,0 +1,29 @@
Freescale i.MX audio complex with WM8524 codec
Required properties:
- compatible : "fsl,imx-audio-wm8524"
- model : The user-visible name of this sound complex
- audio-cpu : The phandle of CPU DAI
- audio-codec : The phandle of the WM8962 audio codec
- audio-routing : A list of the connections between audio components.
Each entry is a pair of strings, the first being the
connection's sink, the second being the connection's
source. Valid names could be power supplies, WM8524
pins, and the jacks on the board:
Example:
sound {
compatible = "fsl,imx-audio-wm8524";
model = "wm8524-audio";
audio-cpu = <&sai2>;
audio-codec = <&codec>;
audio-routing =
"Line Out Jack", "LINEVOUTL",
"Line Out Jack", "LINEVOUTR";
};

View File

@ -0,0 +1,61 @@
Freescale i.MX audio complex with WM8962 codec
Required properties:
- compatible : "fsl,imx-audio-wm8962"
- model : The user-visible name of this sound complex
- cpu-dai : The phandle of CPU DAI
- audio-codec : The phandle of the WM8962 audio codec
- audio-routing : A list of the connections between audio components.
Each entry is a pair of strings, the first being the
connection's sink, the second being the connection's
source. Valid names could be power supplies, WM8962
pins, and the jacks on the board:
Power supplies:
* Mic Bias
Board connectors:
* Mic Jack
* Headphone Jack
* Ext Spk
- mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
- mux-ext-port : The external port of the i.MX audio muxer
Note: The AUDMUX port numbering should start at 1, which is consistent with
hardware manual.
Optional properties:
- hp-det-gpios : The gpio pin to detect plug in/out event that happens to
Headphone jack.
- mic-det-gpios: The gpio pin to detect plug in/out event that happens to
Microphone jack.
Example:
sound {
compatible = "fsl,imx6q-sabresd-wm8962",
"fsl,imx-audio-wm8962";
model = "wm8962-audio";
cpu-dai = <&ssi2>;
audio-codec = <&codec>;
audio-routing =
"Headphone Jack", "HPOUTL",
"Headphone Jack", "HPOUTR",
"Ext Spk", "SPKOUTL",
"Ext Spk", "SPKOUTR",
"MICBIAS", "AMIC",
"IN3R", "MICBIAS",
"DMIC", "MICBIAS",
"DMICDAT", "DMIC";
mux-int-port = <2>;
mux-ext-port = <3>;
hp-det-gpios = <&gpio7 8 1>;
mic-det-gpios = <&gpio1 9 1>;
};

View File

@ -13,6 +13,14 @@ Optional properties:
of R51 (Class D Control 2) gets set, indicating that the speaker is
in mono mode.
- amic-mono: This is a boolean property. If present, indicating that the
analog micphone is hardware mono input, the driver would enable monomix
for it.
- dmic-mono: This is a boolean property. If present, indicating that the
digital micphone is hardware mono input, the driver would enable monomix
for it.
- mic-cfg : Default register value for R48 (Additional Control 4).
If absent, the default should be the register default.

View File

@ -10,6 +10,8 @@ Required properties:
- "fsl,imx35-cspi" for SPI compatible with the one integrated on i.MX35
- "fsl,imx51-ecspi" for SPI compatible with the one integrated on i.MX51
- "fsl,imx53-ecspi" for SPI compatible with the one integrated on i.MX53 and later Soc
- "fsl,imx6ul-ecspi" ERR009165 fixed on i.MX6UL and later Soc
(https://www.nxp.com/docs/en/errata/IMX6DQCE.pdf)
- "fsl,imx8mq-ecspi" for SPI compatible with the one integrated on i.MX8M
- reg : Offset and length of the register set for the device
- interrupts : Should contain CSPI/eCSPI interrupt

View File

@ -6,6 +6,8 @@ Required properties:
"fsl,ls1021a-qspi", "fsl,ls2080a-qspi"
or
"fsl,ls1043a-qspi" followed by "fsl,ls1021a-qspi"
"fsl,ls1012a-qspi" followed by "fsl,ls1021a-qspi"
"fsl,ls1088a-qspi" followed by "fsl,ls2080a-qspi"
- reg : the first contains the register location and length,
the second contains the memory mapping address and length
- reg-names: Should contain the reg names "QuadSPI" and "QuadSPI-memory"

View File

@ -0,0 +1,18 @@
* Thermal Monitoring Unit (TMU) on Freescale i.MX8MM SoC
Required properties:
- compatible : Must be one of the following:
- "fsl,imx8mm-tmu",
- "fsl,imx8mp-tmu".
- reg : Address range of TMU registers.
- clocks : TMU's clock source.
- #thermal-sensor-cells : Should be 1 for SoC that supports multi-site sensor,
otherwise, should be 0. See ./thermal.txt for a description.
Example:
tmu: tmu@30260000 {
compatible = "fsl,imx8mm-tmu";
reg = <0x30260000 0x10000>;
clocks = <&clk IMX8MM_CLK_TMU_ROOT>;
#thermal-sensor-cells = <0>;
};

View File

@ -1,45 +1,39 @@
Binding for the Cadence USBSS-DRD controller
* Cadence USB3 Controller
Required properties:
- reg: Physical base address and size of the controller's register areas.
Controller has 3 different regions:
- HOST registers area
- DEVICE registers area
- OTG/DRD registers area
- reg-names - register memory area names:
"xhci" - for HOST registers space
"dev" - for DEVICE registers space
"otg" - for OTG/DRD registers space
- compatible: Should contain: "cdns,usb3"
- interrupts: Interrupts used by cdns3 controller:
"host" - interrupt used by XHCI driver.
"peripheral" - interrupt used by device driver
"otg" - interrupt used by DRD/OTG part of driver
- compatible: "Cadence,usb3";
- reg: base address and length of the registers
- interrupts: interrupt for the USB controller
- interrupt-parent: the interrupt parent for this module
- clocks: reference to the USB clock
- clock-names: the name of clocks
- cdns3,usbphy: reference to the USB PHY
Optional properties:
- maximum-speed : valid arguments are "super-speed", "high-speed" and
"full-speed"; refer to usb/generic.txt
- dr_mode: Should be one of "host", "peripheral" or "otg".
- phys: reference to the USB PHY
- phy-names: from the *Generic PHY* bindings;
Supported names are:
- cdns3,usb2-phy
- cdns3,usb3-phy
- dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"
- extcon: extcon phandler for cdns3 device
- power-domains: the power domain for cdns3 controller and phy
- cdns,on-chip-buff-size : size of memory intended as internal memory for endpoints
buffers expressed in KB
Examples:
Example:
usb@f3000000 {
compatible = "cdns,usb3";
interrupts = <GIC_USB_IRQ 7 IRQ_TYPE_LEVEL_HIGH>,
<GIC_USB_IRQ 7 IRQ_TYPE_LEVEL_HIGH>,
<GIC_USB_IRQ 8 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "host", "peripheral", "otg";
reg = <0xf3000000 0x10000>, /* memory area for HOST registers */
<0xf3010000 0x10000>, /* memory area for DEVICE registers */
<0xf3020000 0x10000>; /* memory area for OTG/DRD registers */
reg-names = "xhci", "dev", "otg";
phys = <&usb2_phy>, <&usb3_phy>;
phy-names = "cdns3,usb2-phy", "cnds3,usb3-phy";
};
usbotg3: cdns3@5b110000 {
compatible = "Cadence,usb3";
reg = <0x0 0x5B110000 0x0 0x10000>,
<0x0 0x5B130000 0x0 0x10000>,
<0x0 0x5B140000 0x0 0x10000>,
<0x0 0x5B160000 0x0 0x40000>;
interrupt-parent = <&gic>;
interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8QM_USB3_LPM_CLK>,
<&clk IMX8QM_USB3_BUS_CLK>,
<&clk IMX8QM_USB3_ACLK>,
<&clk IMX8QM_USB3_IPG_CLK>,
<&clk IMX8QM_USB3_CORE_PCLK>;
clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
"usb3_ipg_clk", "usb3_core_pclk";
power-domains = <&pd_conn_usb2>;
cdns3,usbphy = <&usbphynop1>;
dr_mode = "otg";
extcon = <&typec_ptn5150>;
status = "disabled";
};

Some files were not shown because too many files have changed in this diff Show More