Commit Graph

14 Commits

Author SHA1 Message Date
Clark Wang d229e2c9b5 MLK-23000-1 mxc: mlb: fix kernel dump when use gen_pool_dma_alloc
If use dma pool when iram does not exist, the iram_pool will be NULL.
The previous version of lib/genalloc.c will check the pointer status
first. In 5.4, it will not check NULL pointer.
Therefore, add NULL check here.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(reported by coverity check)

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

Interrupt variable must be signed type.

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

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

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

Signed-off-by: Gao Pan <b54642@freescale.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
(cherry picked from commit 24e36b318a29d85c0c4491076416343ade1f344e)
2019-11-25 15:48:04 +08:00