linux.git
6 years agoMLK-20105 staging: typec: tcpm: keep non-PD session for no GoodCRC
Li Jun [Tue, 29 Jan 2019 05:57:58 +0000 (11:27 +0530)]
MLK-20105 staging: typec: tcpm: keep non-PD session for no GoodCRC

In case of vbus_never_low, if source setup a typye-c only session, sink
time out on waiting for source capability message and send soft reset,
the source does not response by goodcrc for the soft reset message, we
don't do hard reset, but keep a non-PD typec session, because the source
maybe PD capable, this hard reset will make the source terminate the
session by turn off vbus, if this type-c port is the system power supply,
the whole system will reboot.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-20113 spi: ecspi: add pio spi slave mode for imx6ul
Clark Wang [Fri, 2 Nov 2018 02:56:34 +0000 (10:56 +0800)]
MLK-20113 spi: ecspi: add pio spi slave mode for imx6ul

Add pio spi slave mode support for imx6ul which is based on the patch
cherry-pick from community(71abd29057cb17b6b9532421821dc443427399ed).

Because the original imx6ul is bound to mx51 in the dts file.
However, in the slave mode, the patch in the community only adds two
functions mx53_ecspi_rx_slave/mx53_ecspi_tx_slave. Therefore, configure
mx51/6ul to use these two functions for data transmission and reception
in slave mode.

Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-20165-1 mtd: spi-nor: Add flash id for GD25LQ16
Clark Wang [Thu, 1 Nov 2018 10:29:54 +0000 (18:29 +0800)]
MLK-20165-1 mtd: spi-nor: Add flash id for GD25LQ16

iMX8MM DDR3L validation board uses GD25LQ16 as spi-nor chip, but its
id is incorrect in ids table, so add a new id and parameters with the
same name into the ids table. For the same name of the chip info, the
log following we can ignore.

LOG: m25p80 spi0.0: found gd25q16, expected gd25q16

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-20171: mtd: flexspi: reset flexspi FLASHxCR2 registers during probe
Han Xu [Thu, 1 Nov 2018 20:01:27 +0000 (15:01 -0500)]
MLK-20171: mtd: flexspi: reset flexspi FLASHxCR2 registers during probe

Flexspi registers cannot be reset to default value, reset all FLASHxCR2
registers to 0 to avoid read data with invalid LUT commands.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-20170: mtd: flexspi: change the flexspi dummy pad settings
Han Xu [Thu, 1 Nov 2018 20:01:06 +0000 (15:01 -0500)]
MLK-20170: mtd: flexspi: change the flexspi dummy pad settings

The dummy pad settings should be align with data access mode, such as
set to PAD4 for all Quad read.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-19787 can: flexcan: fix CAN can't receive remote request frame
Joakim Zhang [Thu, 18 Oct 2018 05:06:19 +0000 (13:06 +0800)]
MLK-19787 can: flexcan: fix CAN can't receive remote request frame

The flexcan driver allocates canfd-skb no matter whether use CAN FD
mode or not, it's unreasonable due to it will affect the parse of the
remote request frame.

To fix the issue, allocating can-skb with "alloc_can_skb()" in normal
mode and canfd-skb with "alloc_canfd_skb()" in fd mode.

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-20004 spi: lpspi: Improve the stability of lpspi data transmission
Xiaoning Wang [Mon, 22 Oct 2018 04:42:57 +0000 (12:42 +0800)]
MLK-20004 spi: lpspi: Improve the stability of lpspi data transmission

Use SR_TDF to judge if need send data, and SR_FCF to judge if
transmission end to replace the waiting after transmission end. This
waiting has no actual meaning, for the real end will set the FCF
flag.

Resolved an issue that could cause a transmission timeout when
transferring large amounts of data.

After making these changes, there is no need to use
fsl_lpspi_txfifo_empty(), so remove it.

Signed-off-by: Xiaoning Wang <xiaoning.wang@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-19899 spi: lpspi: CLK pin becomes low when CR_RST=1
Xiaoning Wang [Mon, 22 Oct 2018 03:01:18 +0000 (11:01 +0800)]
MLK-19899 spi: lpspi: CLK pin becomes low when CR_RST=1

Remove Reset operation in fsl_lpspi_config(). This RST may cause both CLK and
CS pins go from high to low level under cs-gpio mode.
Add fsl_lpspi_reset() function after one message transfer to clear all
flags in use.

Signed-off-by: Xiaoning Wang <xiaoning.wang@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-19952 net: phy: tja110x: avoid PHY driver resume methods to take phydev->lock...
Andy Duan [Tue, 16 Oct 2018 09:46:59 +0000 (17:46 +0800)]
MLK-19952 net: phy: tja110x: avoid PHY driver resume methods to take phydev->lock mutex

commit f5e64032a799 ("net: phy: fix resume handling") and commit 6bccf8962b78
(net: phy: Restore phy_resume() locking assumption) make phy_resume() take
phydev->lock mutex, not PHY driver resume callback take that lock.
(The two commits enter kernel tree after v4.9, so v4.9 has no such issue)

To avoid dead lock, fix it by ensuring that the PHY driver resume methods
do not take the phydev->lock mutex themselves, but phy_resume() only take
that lock.

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>
6 years agoMLK-19931-2: dmaengine: fsl-edma: fix potential kernel crash in cyclic
Robin Gong [Mon, 15 Oct 2018 17:33:35 +0000 (01:33 +0800)]
MLK-19931-2: dmaengine: fsl-edma: fix potential kernel crash in cyclic

Fix potential kernel crash issue  on fsl-edma as fsl-edma-v3.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-19931-1: dmaengine: fsl-edma-v3: fix potential kernel crash in cyclic
Robin Gong [Mon, 15 Oct 2018 17:06:29 +0000 (01:06 +0800)]
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>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-20314: drivers: crypto: caam: alg: Enable GCM for newer LP CAAM
Franck LENORMAND [Fri, 9 Nov 2018 17:21:35 +0000 (18:21 +0100)]
MLK-20314: drivers: crypto: caam: alg: Enable GCM for newer LP CAAM

The iMX6 platform does not support fardware GCM, more
recent iMX does so we enable it.

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
(cherry picked from commit 2a4e35399f37caff111d420866a9d4beb494e2e9)
(Vipul: Fixed merge conflicts)
Conflicts:
drivers/crypto/caam/caamalg.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19801: Add support of tagged keys in caamalg
Franck LENORMAND [Fri, 5 Oct 2018 14:41:54 +0000 (16:41 +0200)]
MLK-19801: 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>
6 years agoMLK-19801: Add tag functionality
Franck LENORMAND [Fri, 5 Oct 2018 14:08:25 +0000 (16:08 +0200)]
MLK-19801: 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>
6 years agoMLK-20142-2 PCI: imx: refine codes in the initialization
Richard Zhu [Tue, 29 Jan 2019 10:01:05 +0000 (15:31 +0530)]
MLK-20142-2 PCI: imx: refine codes in the initialization

- replace the sleep by the udelay, since it would be used
in the no_irq_suspend/resume callbacks.
- aligned the retries to the PHY_PLL_LOCK_WAIT_MAX_RETRIES

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
(Vipul: apply manually while rebase on v4.19)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19959 PCI: imx: make sure the sysfile api is add properly
Richard Zhu [Tue, 29 Jan 2019 09:52:15 +0000 (15:22 +0530)]
MLK-19959 PCI: imx: make sure the sysfile api is add properly

Make sure that the sysfile api of the pcie ep is add properly.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: apply manually whilre rebase on v4.19)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20346 usb: chipidea: change power_lost workqueue as freezable
Peter Chen [Fri, 16 Nov 2018 08:40:48 +0000 (16:40 +0800)]
MLK-20346 usb: chipidea: change power_lost workqueue as freezable

Like commit d144dfea8af7 ("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>
(cherry picked from commit d217dacbe793641497b38f48d063a6332242e8a9)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20343 usb: chipidea: udc: using structure ci_hdrc device for runtime PM
Peter Chen [Wed, 14 Nov 2018 08:43:52 +0000 (16:43 +0800)]
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>
(cherry picked from commit d436b3a0a81b073b195d0ad29e7a4f39a1a532f3)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20158-3 usb: phy: mxs: add wakeup enable for imx7ulp
Peter Chen [Thu, 15 Mar 2018 08:56:41 +0000 (16:56 +0800)]
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20158-1 usb: chipidea: ci_hdrc_imx: restore pinctrl
Peter Chen [Thu, 1 Nov 2018 06:47:20 +0000 (14:47 +0800)]
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19240 usb: chipidea: udc: keep suspended after charger detection
Li Jun [Tue, 30 Oct 2018 01:44:47 +0000 (09:44 +0800)]
MLK-19240 usb: chipidea: udc: keep suspended after charger detection

If the otg port is only for charging, we don't need keep the usb
port active, so let's keep it suspended after charger detection.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20045-2 usb: chipidea: usbmisc_imx: delete the HSIC operation for imx7d
Peter Chen [Wed, 24 Oct 2018 07:21:41 +0000 (15:21 +0800)]
MLK-20045-2 usb: chipidea: usbmisc_imx: delete the HSIC operation for imx7d

For imx7d, no software operation is needed for HSIC controller, so delete
related operation.

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>
6 years agoMLK-20045-1 usb: chipidea: usbmisc_imx: using different .init for imx7ulp
Peter Chen [Wed, 24 Oct 2018 06:41:10 +0000 (14:41 +0800)]
MLK-20045-1 usb: chipidea: usbmisc_imx: using different .init 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.

Since imx7d has dedicated .init function, so the flag for imx7d PHY
(picophy) can be deleted.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20011-2 usb: chipidea: delete DP pullup for secondary charger detection
Peter Chen [Mon, 22 Oct 2018 08:20:02 +0000 (16:20 +0800)]
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>
6 years agoMLK-20011-1 usb: chipidea: imx: using non-core register to pull up DP
Peter Chen [Mon, 22 Oct 2018 08:15:16 +0000 (16:15 +0800)]
MLK-20011-1 usb: chipidea: imx: using non-core register to pull up DP

For Samsung PHY SoCs (imx7d/imx845), we used core register usbcmd.rs
to pull up DP to finish the pre-condition for secondary USB charger
detection before. In fact, there are some non-core registers can
fulfill the same task, in that way, we could not touch the common
chipidea registers.

Meanwhile, we delete the secondary charger detection operation and
clean up related code.

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>
6 years agoMLK-19850-6 usb: chipidea: introduce flag for enable USB PHY charger detection
Peter Chen [Mon, 8 Oct 2018 09:43:45 +0000 (17:43 +0800)]
MLK-19850-6 usb: chipidea: introduce flag for enable USB PHY charger detection

Some platforms may want to use USB PHY charger detection function
when VBUS is there, add one flag for it. The user can enable it
at firmware.

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>
6 years agoMLK-19850-5 usb: chipidea: imx: using USB PHY charger structure for detection
Peter Chen [Mon, 8 Oct 2018 09:38:48 +0000 (17:38 +0800)]
MLK-19850-5 usb: chipidea: imx: using USB PHY charger structure for detection

We can assign the charger detection results for common USB PHY
structure directly now, so delete the imx usb charger structure.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(Vipul: fixed merge conflicts)
Conflicts:
drivers/usb/chipidea/ci_hdrc_imx.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19850-4 usb: chipidea: udc: using USB PHY charger framework for detection
Peter Chen [Mon, 8 Oct 2018 09:33:58 +0000 (17:33 +0800)]
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.

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>
6 years agoMLK-19850-1 usb: phy: mxs: add DCD implementation
Peter Chen [Tue, 29 Jan 2019 07:33:22 +0000 (13:03 +0530)]
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>
(Vipul: apply manually while rebase on v4.19)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-17817-2: ASoC: imx-ak4458: enable 16 channels in TDM mode
Viorel Suman [Tue, 4 Dec 2018 15:03:20 +0000 (17:03 +0200)]
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>
(cherry picked from commit bc8b6a74175c2d120383875b00b5a2a44def9dd0)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-17817-1: ASoC: ak4458: enable daisy chain
Viorel Suman [Tue, 29 Jan 2019 06:54:38 +0000 (12:24 +0530)]
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>
6 years agoMLK-20328-1: ASoC: fsl_sai: map number of pins to dataline masks
Viorel Suman [Wed, 21 Nov 2018 14:09:44 +0000 (16:09 +0200)]
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>
(cherry picked from commit 707fdf7759c0e11abf84573eb60bba104d681736)
(Vipul: Fixed merge conflicts)
Conflicts:
sound/soc/fsl/fsl_sai.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20428-2: ASoC: imx-cs42xx8: The FMT should be same for tx and rx
Shengjiu Wang [Thu, 22 Nov 2018 08:18:04 +0000 (16:18 +0800)]
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>
(cherry picked from commit 897e9e8b4e7a59d81048d05f9377b8c68fc7cd64)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20428-1: ASoC: cs42xx8: add constraint for tdm mode
Shengjiu Wang [Wed, 21 Nov 2018 10:55:21 +0000 (18:55 +0800)]
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>
(cherry picked from commit 769121ead6ef8919b7f6869defe594be978d82cd)
(Vipul: replace codec wirh component whire rebase on v4.19)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20434: ASoC: fsl_rpmsg_i2s: add more rates in constraint list
Shengjiu Wang [Wed, 21 Nov 2018 06:20:36 +0000 (14:20 +0800)]
MLK-20434: ASoC: fsl_rpmsg_i2s: add more rates in constraint list

add more rates in constraint list, Fixes commit ee959e2c9b18
("MLK-19581-3: ASoC: fsl_rpmsg_i2s: support multipul rate and DSD format")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit bcc6185a392b46d2b5af315894b06e6ebaff8046)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20357-1: ASoC: imx-rpmsg: add audio routing for wm8960
Shengjiu Wang [Wed, 14 Nov 2018 06:49:34 +0000 (14:49 +0800)]
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoASoC: sgtl5000: avoid division by zero if lo_vag is zero
Colin Ian King [Thu, 6 Sep 2018 10:41:52 +0000 (11:41 +0100)]
ASoC: sgtl5000: avoid division by zero if lo_vag is zero

In the case where lo_vag <= SGTL5000_LINE_OUT_GND_BASE, lo_vag
is set to zero and later vol_quot is computed by dividing by
lo_vag causing a division by zero error.  Fix this by avoiding
a zero division and set vol_quot to zero in this specific case
so that the lowest setting for i is correctly set.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20189-8: ASoC: fsl_sai: use signed offset variable
Viorel Suman [Tue, 13 Nov 2018 09:36:29 +0000 (11:36 +0200)]
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20189-7: ASoC: ak4458: check reset control status
Viorel Suman [Tue, 29 Jan 2019 06:28:50 +0000 (11:58 +0530)]
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>
6 years agoMLK-20247: ASoC: imx-rpmsg: fix error when m4 image is not loaded
Shengjiu Wang [Fri, 9 Nov 2018 07:16:23 +0000 (15:16 +0800)]
MLK-20247: ASoC: imx-rpmsg: fix error when m4 image is not loaded

The reason is same as commit d4eb8ab26399 ("MLK-19854-1: ASoC:
imx-cs42888: fix error when m4 image is not loaded")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(Vipul: Fixed merge conflicts)
Conflicts:
sound/soc/fsl/imx-rpmsg.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20277-3: ASoC: imx-pcm-rpmsg: change the state of substream in resume
Shengjiu Wang [Thu, 8 Nov 2018 07:15:42 +0000 (15:15 +0800)]
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20277-2: ASoC: rpmsg_ak4497: remove digital_mute function
Shengjiu Wang [Thu, 8 Nov 2018 07:12:25 +0000 (15:12 +0800)]
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>
(Vipul: fixed merge conflicts)
Conflicts:
sound/soc/codecs/rpmsg_ak4497.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20277-1: ASoC: imx-pcm-rpmsg: reset the period index at stop
Shengjiu Wang [Thu, 8 Nov 2018 07:07:13 +0000 (15:07 +0800)]
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19750-3: ASoC: rpmsg_cs42xx8: enhance async mode for rpmsg_cs42xx8
Shengjiu Wang [Wed, 31 Oct 2018 08:45:27 +0000 (16:45 +0800)]
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>
(Vipul: fixed merge conflicts)
Conflicts:
sound/soc/codecs/rpmsg_cs42xx8.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19750-2: ASoC: cs42xx8: enhance the async mode for cs42xx8
Shengjiu Wang [Wed, 31 Oct 2018 08:35:15 +0000 (16:35 +0800)]
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>
(Vipul: Fixed merge conflicts)
Conflicts:
sound/soc/codecs/cs42xx8.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19750-1: ASoC: fsl_esai: enhance async mode
Shengjiu Wang [Wed, 31 Oct 2018 08:29:57 +0000 (16:29 +0800)]
MLK-19750-1: ASoC: fsl_esai: enhance async mode

With this patch, esai driver can support tx and rx in
different master/slave mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19972-2: ASoC: fsl: dsp: Fix component creation cleanup path
Daniel Baluta [Fri, 19 Oct 2018 11:09:17 +0000 (14:09 +0300)]
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19972-1: ASoC: fsl: dsp: Fix compr_set_param cleanup path
Daniel Baluta [Wed, 17 Oct 2018 13:04:28 +0000 (16:04 +0300)]
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-20034-1: ASoC: imx-ak4458: constrain the mclk rate for DSD
Shengjiu Wang [Tue, 23 Oct 2018 07:58:24 +0000 (15:58 +0800)]
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-17951 ARM: imx_v7_defconfig: enable AHCI_IMX in default
Richard Zhu [Tue, 10 Apr 2018 02:43:26 +0000 (10:43 +0800)]
MLK-17951 ARM: imx_v7_defconfig: enable AHCI_IMX in default

Enable the AHCI_IMX defaultly in imx_v7_defconfig

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19931-3: dmaengine: imx-sdma: fix potential kernel crash in cyclic
Robin Gong [Mon, 15 Oct 2018 17:35:42 +0000 (01:35 +0800)]
MLK-19931-3: dmaengine: imx-sdma: fix potential kernel crash in cyclic

Fix potential kernel crash issue  on imx-sdma as fsl-edma-v3.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
6 years agoMLK-18082: defconfig: Add caam to 7ulp conf
Franck LENORMAND [Wed, 25 Apr 2018 13:17:32 +0000 (15:17 +0200)]
MLK-18082: defconfig: Add caam to 7ulp conf

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
[Arul: Fix merge conflicts]
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-13520-04 ARM: defconfig: enable imx7ulp wdog driver in defconfig
Bai Ping [Thu, 24 Nov 2016 06:56:51 +0000 (14:56 +0800)]
MLK-13520-04 ARM: defconfig: enable imx7ulp wdog driver in defconfig

Enable wdog driver in defconfig.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-13441-8 ARM: configs: enable i.mx7ulp by default
Anson Huang [Mon, 7 Nov 2016 16:07:58 +0000 (00:07 +0800)]
MLK-13441-8 ARM: configs: enable i.mx7ulp by default

Enable i.MX7ULP SoC by default.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMGS-1132 ARM: Kconfig: increase FORCE_MAX_ZONEORDER for ARCH_MXC
Xianzhong [Tue, 13 Oct 2015 08:50:25 +0000 (16:50 +0800)]
MGS-1132 ARM: Kconfig: increase FORCE_MAX_ZONEORDER for ARCH_MXC

Need increase the FORCE_MAX_ZONEORDER to 14 for high resolution camera
(GPU 2D user case). The default value 11(4MB) is not enough now.

Signed-off-by: Jason Liu <r64343@freescale.com>
(cherry picked from commit fff642ffe868cb55f5caec0501e36fd28b6ece50)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-11556-4 defconfig: enable epdc driver
Robby Cai [Wed, 16 Sep 2015 08:03:48 +0000 (16:03 +0800)]
MLK-11556-4 defconfig: enable epdc driver

Enable epdc driver of both version

Signed-off-by: Robby Cai <r63905@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-16750-1 arch: arm: imx_v7_defconfig Enable PSCI and TEE
Peng Fan [Thu, 2 Nov 2017 01:35:55 +0000 (09:35 +0800)]
MLK-16750-1 arch: arm: imx_v7_defconfig Enable PSCI and TEE

Default enable PSCI and TEE.
If no psci optee node in dts, it works as before.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agotee: add kernel internal client interface **not for mainline**
Jens Wiklander [Tue, 15 Jan 2019 08:59:40 +0000 (14:29 +0530)]
tee: add kernel internal client interface **not for mainline**

Adds a kernel internal TEE client interface to be used by other drivers.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
From: https://github.com/linaro-swg/linux.git
(cherry picked from commit 860c46087c99c24073cc722b12c0017bb0ce0a79)

Vipul: while rebase on v4.19, apply manually
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agotee: new ioctl to a register tee_shm from a dmabuf file descriptor
Etienne Carriere [Thu, 27 Oct 2016 21:18:35 +0000 (23:18 +0200)]
tee: new ioctl to a register tee_shm from a dmabuf file descriptor

This change allows userland to create a tee_shm object that refers
to a dmabuf reference.

Userland provides a dmabuf file descriptor as buffer reference.
The created tee_shm object exported as a brand new dmabuf reference
used to provide a clean fd to userland. Userland shall closed this new
fd to release the tee_shm object resources. The initial dmabuf resources
are tracked independently through original dmabuf file descriptor.

Once the buffer is registered and until it is released, TEE driver
keeps a refcount on the registered dmabuf structure.

This change only support dmabuf references that relates to physically
contiguous memory buffers.

New tee_shm flag to identify tee_shm objects built from a registered
dmabuf: TEE_SHM_EXT_DMA_BUF. Such tee_shm structures are flagged both
TEE_SHM_DMA_BUF and TEE_SHM_EXT_DMA_BUF.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
From: https://github.com/linaro-swg/linux.git
(cherry picked from commit 41e21e5c405530590dc2dd10b2a8dbe64589840f)

(Vipul: Fixed merge conflicts)
Conflicts:
drivers/tee/tee_core.c
drivers/tee/tee_shm.c
include/linux/tee_drv.h
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-15007-1 iommu: arm: pgtable: alloc pagetable in DMA area
Peng Fan [Tue, 15 Jan 2019 05:43:02 +0000 (11:13 +0530)]
MLK-15007-1 iommu: arm: pgtable: alloc pagetable in DMA area

Normally the iommu pagetable could be in 64bit address space,
but we have one patch to address PCIE driver, 'commit 9e03e5076269
("MLK-15064-2 ARM64: DMA: limit the dma mask to be 32bit")'

The patch restrict swiotlb and iommu dma to be in 32bit address.

So if we allocate pages in highmem, then dma_map_single will return
a 32bit address. Then, we will get "Cannot accommodate DMA
translation for IOMMU page tables", because `dma != virt_to_phys(pages)`.

So we strict the lpae iommu pgtable in DMA area to fix this issue.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Vipul: while rebase on v4.19, apply manually and use
commit 4b123757eeaa iommu/io-pgtable-arm: Make allocations NUMA-aware
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-11438-4 lcdif: enable lpsr mode
Robby Cai [Thu, 27 Aug 2015 12:34:32 +0000 (20:34 +0800)]
MLK-11438-4 lcdif: enable lpsr mode

restore the pinmux when resume from LPSR mode in suspend.

Signed-off-by: Robby Cai <r63905@freescale.com>
(cherry picked from commit 0462eb2cb8b64508260d9c6daa9f163d68ea6be0)

Conflicts:
drivers/video/mxsfb.c

(cherry picked from commit 8ddaa850df8cc9fe4dda4f505053eaa3f704ef69)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19932 PCI: imx: make sure the ref_clk is enabled
Richard Zhu [Mon, 14 Jan 2019 12:51:53 +0000 (18:21 +0530)]
MLK-19932 PCI: imx: make sure the ref_clk is enabled

In the EP RC validation system, EP wouldn't set RC's
CLK_REQ# to low, like one real inserted EP device to do.
Let RC to set the over ride low and enabled, make sure that
REF_CLK of RC side is turned on.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 9dbd35f429a8383b13ca758fd14c6dad926e16e6)
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19412 PCI: imx: keep clkreq# active in compliance tests
Richard Zhu [Mon, 14 Jan 2019 12:49:33 +0000 (18:19 +0530)]
MLK-19412 PCI: imx: keep clkreq# active in compliance tests

- Do not de-assert the clkreq# when compliance tests mode
is enabled, make sure that the ref_clk is turned on.
- Correct the PLL lock bit check point.
- Adjust the TRSV PHY registers to pass the compliance tests.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19113-2 PCI: imx: enable the l1.1 aspm on imx8mm
Richard Zhu [Mon, 14 Jan 2019 12:47:10 +0000 (18:17 +0530)]
MLK-19113-2 PCI: imx: enable the l1.1 aspm on imx8mm

Enable the L1.1 ASPM support on iMX8MM, and
verified the EVK board.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19088-2 PCI: imx: enable the l1.1 aspm support on imx8mq
Richard Zhu [Mon, 14 Jan 2019 12:43:12 +0000 (18:13 +0530)]
MLK-19088-2 PCI: imx: enable the l1.1 aspm support on imx8mq

- Enable the L1.1 ASPM support on iMX8MQ, and verified
  on the both PCIe ports of the EVK board.
- Fix the L1 exit latency larger than 64us issue
  Otherwise, the L1/L1.1 ASPM would be disabled in the
  initialization.
- Add the internal PLL of the PCIe REF_CLK support, and
  verify the L1.1 ASPM on port0 of 8MQ EVK board

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Refactor and comment ivshm_net_state_change
Jan Kiszka [Sun, 4 Mar 2018 12:50:24 +0000 (13:50 +0100)]
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 d0791721836578640fb8a1980ce61f1afb90aeb2)
(cherry picked from commit 1ce077a1eabb2897c5f5ee94e83959457dbd2b59)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Fix bogus transition to RESET state
Jan Kiszka [Sun, 4 Mar 2018 12:16:04 +0000 (13:16 +0100)]
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 4491a937f11ac089767b298747677f649119d4b3)
(cherry picked from commit 7156f81809012e225d6666ca2635bd87210c53c1)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Silence compiler warning
Jan Kiszka [Tue, 3 Oct 2017 10:24:59 +0000 (12:24 +0200)]
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 9ef8e844923938d2080b78c42b7911276cde3718)
(cherry picked from commit edada13e41fdbfea14529d2ca1278ab251bcdfe3)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: add MAC changing interface
Henning Schild [Wed, 27 Sep 2017 10:59:49 +0000 (12:59 +0200)]
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 e051b06a5bd6054d1981140b66ffcabcb0c5405b)
(cherry picked from commit 7f4afa1d54d5857421953d2548bf1e6ac8c93eaa)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: set and check descriptor flags
Henning Schild [Mon, 18 Sep 2017 16:02:11 +0000 (18:02 +0200)]
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 81ef582bb0aa6ab0c6206d0a3bc18b8af7b6e41b)
(cherry picked from commit 4526da548c14df3643a7a72b4676fb09adeaf6d5)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: slightly improve debug output
Henning Schild [Mon, 18 Sep 2017 16:02:10 +0000 (18:02 +0200)]
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 55db983c36cd57c003884d497f17df7f0b89a8b8)
(cherry picked from commit 90116595852af9b58eb17424fe7b17d3d4d9ba18)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: fill in and check used descriptor chain len
Henning Schild [Mon, 18 Sep 2017 16:02:08 +0000 (18:02 +0200)]
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 6a47140bcdaa3ce6062f7cf9fc3d50a7d3544293)
(cherry picked from commit 6477743f591e452d33e36a51d092a5c2fad795a4)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Switch to pci_alloc_irq_vectors
Jan Kiszka [Tue, 23 May 2017 15:41:00 +0000 (17:41 +0200)]
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 e2401b8567da9e02d5f674584ef7363f810525f1)
(cherry picked from commit 8d2959392ca3accaa25223308a075f64afd66464)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Switch to relative descriptor addresses
Jan Kiszka [Tue, 3 Jan 2017 07:50:01 +0000 (08:50 +0100)]
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 426eccbb2dba3b44b3e24e374ab46a0c5f32b65d)
(cherry picked from commit a44ee5c43841a160126e2e183058801a13f379bb)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Fix stuck state machine during setup
Jan Kiszka [Sun, 1 Jan 2017 14:54:55 +0000 (15:54 +0100)]
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 7f0fb24dae8f5782c802d1d1664d9f75007b05bb)
(cherry picked from commit 6778eef520677fbdefe3b854c7096acd9b3c133b)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Add ethtool register dump
Jan Kiszka [Sun, 1 Jan 2017 14:46:26 +0000 (15:46 +0100)]
ivshmem-net: Add ethtool register dump

Helps debugging inconsistent states.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 78591727e5d0330ed0010044829204a847ed3978)
(cherry picked from commit cf7bf53533ed28d23e84abb91d8a19799b1be7dd)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Switch to reset state on each net stop and on driver removal
Jan Kiszka [Sun, 1 Jan 2017 14:43:37 +0000 (15:43 +0100)]
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 ad284cd4585de7021222fd354d4c65814c405cb5)
(cherry picked from commit 26daabdce2b0c9d46a95c57809327f8deeb72053)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Improve identification of resources
Jan Kiszka [Wed, 21 Dec 2016 07:20:18 +0000 (08:20 +0100)]
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 cb9e649c0ebe69651cc203a8617f4f1e42e61d1f)
(cherry picked from commit 68cedb7ce6f2bc8954a63f179ca6101b53116f26)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Enable INTx
Jan Kiszka [Sun, 27 Nov 2016 14:15:51 +0000 (15:15 +0100)]
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 3188f843e812973aff8c0ec5415c106f284c6c96)
(cherry picked from commit bc6b9e4b560e9850c5db4defb62dd5e86cd69887)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Remove unused variable
Jan Kiszka [Fri, 25 Nov 2016 16:31:51 +0000 (17:31 +0100)]
ivshmem-net: Remove unused variable

Became unused by previous change.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 5c63dd6c54a2943457da8a19ed98b04f80158698)
(cherry picked from commit bd40e624f77dec1eb4cf50cf8aedf91427ccf276)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: fix race in state machine
Mans Rullgard [Thu, 24 Nov 2016 18:46:41 +0000 (18:46 +0000)]
ivshmem-net: fix race in state machine

(cherry picked from commit 615bca5306e422b633c0ff6296077da4469a4b27)
(cherry picked from commit 139f14253d76fa593299a416c6916e01862a7e15)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: Map shmem region as RAM
Jan Kiszka [Thu, 24 Nov 2016 07:27:45 +0000 (08:27 +0100)]
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 95d11c2afb75fd3fd04006aeb94539feab1a49a0)
(cherry picked from commit fcf51a6ab4ce6a3dc0456d65ee597bef9c806477)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoivshmem-net: virtual network device for Jailhouse
Mans Rullgard [Thu, 26 May 2016 15:04:02 +0000 (16:04 +0100)]
ivshmem-net: virtual network device for Jailhouse

Work in progress.

(cherry picked from commit d14d3ad0a3652f819f6b0341404a1c5e8d6eaac8)
(cherry picked from commit e0751250a0c0e0dab091ab4564127e6e38b363ac)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18953 PCI: imx: fix the building warning
Richard Zhu [Mon, 14 Jan 2019 12:27:06 +0000 (17:57 +0530)]
MLK-18953 PCI: imx: fix the building warning

- warning: ‘retries’ may be used uninitialized in this function
- WARNING: vmlinux.o(.data+0x5d2d8): Section mismatch in reference from the
variable imx_pcie_driver to the function .init.text:imx_pcie_probe()

The variable imx_pcie_driver references the function __init
imx_pcie_probe().
If the reference is valid then annotate the variable with
__init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18559 PCI: imx: fix crash when request reserved region
Richard Zhu [Mon, 14 Jan 2019 12:24:37 +0000 (17:54 +0530)]
MLK-18559 PCI: imx: fix crash when request reserved region

Fix the crash when pcie request the reserved memory region
after the -EPROBE_DEFER in the probe.
The pointer of the resource parameter would be invalided
in the second probe. Use one structure varible to replace
it.
Put node after done with it, after call of_parse_phandle.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18515-2 PCI: imx: get reserved region for ep rc ddr test region
Richard Zhu [Mon, 14 Jan 2019 12:19:31 +0000 (17:49 +0530)]
MLK-18515-2 PCI: imx: get reserved region for ep rc ddr test region

PCIe ep rc validation is one remote processors communications.
Remove the hard-coded ep rc ddr test region on imx8 platforms.
Get the reserved region for ep rc ddr test region.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-17880 PCI: imx: fix the imx6q pcie resume hang
Richard Zhu [Mon, 14 Jan 2019 12:16:39 +0000 (17:46 +0530)]
MLK-17880 PCI: imx: fix the imx6q pcie resume hang

iThe perst signal shouldn't be asserted during imx6q/dl
pcie suspend.
Otherwise, the link would be down during resume,
and system would be hang.
Fix it by one return in imx6q switch case.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18298-4 PCI: imx: enable imx8mm pcie support
Richard Zhu [Mon, 14 Jan 2019 12:13:55 +0000 (17:43 +0530)]
MLK-18298-4 PCI: imx: enable imx8mm pcie support

enable imx8mm pcie support.
BTW, the power management is not supported yet.
Disable pcie module, if you test power management
on the imx8mm platforms.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-11780 PCI: imx: correct some type mistakes
Richard Zhu [Mon, 14 Jan 2019 11:55:26 +0000 (17:25 +0530)]
MLK-11780 PCI: imx: correct some type mistakes

- They should be bitwise logic, not the boolean logic.
- Correct the error return values.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-17544 PCI: imx: change the imx6 specific name
Richard Zhu [Mon, 14 Jan 2019 11:20:55 +0000 (16:50 +0530)]
MLK-17544 PCI: imx: change the imx6 specific name

Replace the specific name imx6_xxx by imx_xxx.
Since all imx6/7/8 PCIe use the same driver.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
During 4.14 rebase remade this manually

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-17552-2 PCI: imx: enable imx pcie ep dma
Richard Zhu [Mon, 14 Jan 2019 11:05:51 +0000 (16:35 +0530)]
MLK-17552-2 PCI: imx: enable imx pcie ep dma

Enable the imx pcie ep dma in the pcie ep rc
validation system.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16982 PCI: imx: fix the failure of the msi verification
Richard Zhu [Mon, 14 Jan 2019 10:58:35 +0000 (16:28 +0530)]
MLK-16982 PCI: imx: fix the failure of the msi verification

Failed to verify the MSI in the EP RC system.
Root cause: the MSI address is not fetched corretly.
The second port of iMX8MQ EVK board should be used
as EP port, not the first one.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16818-2 PCI: imx: enable the pcie ep rc for imx8
Richard Zhu [Mon, 14 Jan 2019 10:48:52 +0000 (16:18 +0530)]
MLK-16818-2 PCI: imx: enable the pcie ep rc for imx8

Enable the PCIE EP RC for iMX8

RC access memory of EP:
- EP:
  write the <ddr_region_address> to the bar0 of ep.
- RC:
  access the <mem_base_address>, and this address
  would be mapped to the <ddr_region_address> of ep.
Note:
ddr_region_address    mem_base_addr  bar0_addr
imx8mq  0xb820_0000           0x2000_0000    0x33c0_0010
imx8qxp 0xb820_0000           0x6000_0000    0x5f00_0010
imx8qm  0xb820_0000           0x7000_0000    0x5f01_0010

MSI verification:
- EP:
  write 0 to the <msi_addr>, for example ./memtool -32 <msi_addr>=0
- RC:
  check the msi is triggered or not.
  cat /proc/interrupts | grep msi
Note:
The msi_addr can be get by the following command after RC platform
is boot up.
For example
root@imx8_all:~# dmesg | grep msi_addr
[    2.670247] pci_msi_addr = 0x7ff80000, cpu_base 0x80000000

msi_addr
imx8mq  0x27f8_0000
imx8qxp 0x6ff8_0000
imx8qm  0x7ff8_0000

iMX8QM:
BuildInfo:
- SCFW daabd5d3, IMX-MKIMAGE 0ad6069a, ATF 93dd1cc
- U-Boot 2017.03-imx_v2017.03+gc662e0a
iMX8QXP:
BuildInfo:
- SCFW daabd5d3, IMX-MKIMAGE 0ad6069a, ATF 93dd1cc
- U-Boot 2017.03-imx_v2017.03+gc662e0a

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16836 PCI: imx: add the bus freq sysfile interface
Richard Zhu [Mon, 14 Jan 2019 10:40:20 +0000 (16:10 +0530)]
MLK-16836 PCI: imx: add the bus freq sysfile interface

To support the bus freq power saving mode, add the
sysfile interface.
request bus high: echo 1 > /sys/devices/platform/xxxxxxxx.pcie/bus_freq
release bus high: echo 1 > /sys/devices/platform/xxxxxxxx.pcie/bus_freq

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16830 PCI: imx: fix boot failulre when the pll is not locked
Richard Zhu [Mon, 14 Jan 2019 10:37:30 +0000 (16:07 +0530)]
MLK-16830 PCI: imx: fix boot failulre when the pll is not locked

Return the error when the pll is not locked.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16817-2 PCI: imx: enable the pm on imx8qm/qxp
Richard Zhu [Mon, 14 Jan 2019 10:34:50 +0000 (16:04 +0530)]
MLK-16817-2 PCI: imx: enable the pm on imx8qm/qxp

Enable the pcie pm on imx8qm/qxp

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16777 PCI: imx: enable pcie pm on mscale
Richard Zhu [Mon, 14 Jan 2019 09:48:16 +0000 (15:18 +0530)]
MLK-16777 PCI: imx: enable pcie pm on mscale

Enable the PCIE PM on mScale.
- Refine the codes.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16485 PCI: imx6: Defer probing if .of_get_named_gpio() returns -EPROBE_DEFER
Fugang Duan [Fri, 11 Jan 2019 11:28:54 +0000 (16:58 +0530)]
MLK-16485 PCI: imx6: Defer probing if .of_get_named_gpio() returns -EPROBE_DEFER

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

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

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-15141-1: PCI: imx: Add epdev_on regulator for 8QM WiFi
Tiberiu Breana [Mon, 14 Jan 2019 09:20:16 +0000 (14:50 +0530)]
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>
6 years agoMLK-16345 PCI: imx: final workaround of ERR010728 for pcie
Richard Zhu [Fri, 11 Jan 2019 11:03:42 +0000 (16:33 +0530)]
MLK-16345 PCI: imx: final workaround of ERR010728 for pcie

Description:
Initial VCO oscillation may fail under corner conditions such as
cold temperature. It causes PCIe PLL fail to lock in
initialization phase.

Project Impact:
iMX7D PCIe PLL fails to lock and PCIe doesn.t work.

workarounds:
To disable Duty-cycle Corrector(DCC) calibration after G_RST
signal is de-asserted by following the sequences:
1. De-assert the G_RST signal by clearing
SRC_PCIEPHY_RCR[PCIEPHY_G_RST].
2. de-assert DCC_FB_EN in Reg4 by writing data '0x29' to the register
address 0x306d0014.
3. assert RX_EQS, RX_EQ_SEL in Reg24 by writing data '0x48' to the
register address 0x306d0090.
4.assert ATT_MODE in Reg26 by writing data '0xbc' to the register
address 0x306d0098.
5.De-assert the CMN_RST signal by clearing register bit
SRC_PCIEPHY_RCR[PCIEPHY_BTN].

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>