[PATCH] spi: imx: add a check for speed_hz before calculating the clock

2021-04-08 Thread Clark Wang
signed. Signed-off-by: Clark Wang --- drivers/spi/spi-imx.c | 37 + 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 24ba7ab1b05d..01f27b4d7384 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/s

[PATCH] spi: imx: add 16/32 bits per word support for slave mode

2021-04-08 Thread Clark Wang
Enable 16/32 bits per word support for spi-imx slave mode. It only support 8 bits per word in slave mode before. Signed-off-by: Clark Wang Reviewed-by: Haibo Chen --- drivers/spi/spi-imx.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-imx.c

RE: [PATCH V2 14/18] i2c: imx-lpi2c: add edma mode support

2021-04-06 Thread Clark Wang
> -Original Message- > From: Clark Wang > Sent: Tuesday, April 6, 2021 19:33 > To: Aisheng Dong ; robh...@kernel.org; > shawn...@kernel.org; s.ha...@pengutronix.de; feste...@gmail.com > Cc: ker...@pengutronix.de; dl-linux-imx ; linux- > i...@vger.kernel.org; devic

[PATCH V2 18/18] i2c: imx-lpi2c: fix pio mode cannot send 256+ bytes in one frame

2021-04-06 Thread Clark Wang
The next MTDR command should be filled before the last receive command is fininshed. Otherwise, a NACK will be sent when the current MTDR command is finished. It causes lpi2c cannot send the next chunk data successfully. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2

[PATCH V2 17/18] ARM: dts: imx7ulp: add the missing status property of lpi2c5

2021-04-06 Thread Clark Wang
Add the missing lpi2c5 status property. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- arch/arm/boot/dts/imx7ulp.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi index a6681836ca05..b16441e18231

[PATCH V2 16/18] ARM: dts: imx7ulp: add dma configurations for lpi2c

2021-04-06 Thread Clark Wang
Enable dma support for all lpi2c nodes. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- arch/arm/boot/dts/imx7ulp.dtsi | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi index 0c51fa79c0bc

[PATCH V2 14/18] i2c: imx-lpi2c: add edma mode support

2021-04-06 Thread Clark Wang
Add eDMA receive and send mode support. Support to read and write data larger than 256 bytes in one frame. Signed-off-by: Clark Wang Reviewed-by: Li Jun --- V2 changes: - change marco I2C_USE_PIO to DMA_ERR_I2C_USE_PIO. It is a error code defined in this driver to --- drivers/i2c/busses

[PATCH V2 15/18] dt-bindings: i2c: imx-lpi2c: Add dma configuration example

2021-04-06 Thread Clark Wang
Add i2c bus dma mode configuration example. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- .../devicetree/bindings/i2c/i2c-imx-lpi2c.yaml | 12 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml b

[PATCH V2 12/18] i2c: imx-lpi2c: fix i2c timing issue

2021-04-06 Thread Clark Wang
The clkhi and clklo ratio was not very precise before that can make the time of START/STOP/HIGH LEVEL out of specification. Therefore, the calculation of these times has been modified in this patch. At the same time, the mode rate definition of i2c is corrected. Signed-off-by: Clark Wang

[PATCH V2 13/18] i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle

2021-04-06 Thread Clark Wang
Claim clkhi and clklo as integer type to avoid possible calculation errors caused by data overflow. Signed-off-by: Clark Wang Reviewed-by: Fugang Duan Reviewed-by: Dong Aisheng --- V2 changes: - No change. Has been reviewed by Dong Aisheng in V1. --- drivers/i2c/busses/i2c-imx-lpi2c.c | 4

[PATCH V2 11/18] dt-bindings: i2c: imx-lpi2c: Add bus recovery example

2021-04-06 Thread Clark Wang
Add i2c bus recovery configuration example. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- .../devicetree/bindings/i2c/i2c-imx-lpi2c.yaml | 14 ++ 1 file changed, 14 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml b

[PATCH V2 09/18] i2c: imx-lpi2c: increase PM timeout to avoid operate clk frequently

2021-04-06 Thread Clark Wang
Switching the clock frequently will affect the data transmission efficiency, and prolong the timeout to reduce autosuspend times for lpi2c. Signed-off-by: Clark Wang Acked-by: Fugang Duan Reviewed-by: Dong Aisheng --- V2 changes: - No change. Has been reviewed by Dong Aisheng in V1

[PATCH V2 10/18] i2c: imx-lpi2c: add bus recovery feature

2021-04-06 Thread Clark Wang
Add bus recovery feature for LPI2C. Need add gpio pinctrl, scl-gpios and sda-gpios configuration in dts. Signed-off-by: Clark Wang --- V2 changes: - No change. Add dt-bindings in the next patch. --- drivers/i2c/busses/i2c-imx-lpi2c.c | 83 ++ 1 file changed, 83

[PATCH V2 08/18] i2c: imx-lpi2c: add debug message when i2c peripheral clk doesn't work

2021-04-06 Thread Clark Wang
From: Gao Pan add debug message when i2c peripheral clk rate is 0, then directly return -EINVAL. Signed-off-by: Clark Wang Signed-off-by: Gao Pan Reviewed-by: Andy Duan --- V2 changes: - Add my signed-off. --- drivers/i2c/busses/i2c-imx-lpi2c.c | 5 + 1 file changed, 5 insertions

[PATCH V2 07/18] i2c: imx-lpi2c: manage irq resource request/release in runtime pm

2021-04-06 Thread Clark Wang
From: Fugang Duan Manage irq resource request/release in runtime pm to save irq domain's power. Signed-off-by: Frank Li Signed-off-by: Fugang Duan Signed-off-by: Clark Wang Reviewed-by: Frank Li --- V2 changes: - Change to use request_irq/free_irq. --- drivers/i2c/busses/i2c-imx-lpi2c.c

[PATCH V2 06/18] ARM64: dts: imx8: change i2c irq number to non-combined

2021-04-06 Thread Clark Wang
Combined interrupt number may cause unexcepted irq event when using DMA and too many interrupts will be generated. So change all i2c interrupts number to non-combined for imx8qxp/8qm/8dxl. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- arch/arm64/boot/dts/freescale/imx8

[PATCH V2 05/18] ARM64: dts: imx8: add the missing lpi2c ipg clock

2021-04-06 Thread Clark Wang
The lpi2c driver has add the missing ipg clock. So add the ipg clock here for all lpi2c nodes. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- .../arm64/boot/dts/freescale/imx8-ss-dma.dtsi | 24 --- 1 file changed, 16 insertions(+), 8 deletions(-) diff

[PATCH V2 04/18] ARM: dts: imx7ulp: add the missing lpi2c nodes

2021-04-06 Thread Clark Wang
Add the missing lpi2c4/5 nodes for imx7ulp. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- arch/arm/boot/dts/imx7ulp.dtsi | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot

[PATCH V2 03/18] ARM: dts: imx7ulp: add the missing lpi2c ipg clock

2021-04-06 Thread Clark Wang
The lpi2c driver has add the missing ipg clock. So add the ipg clock here for all lpi2c nodes. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- arch/arm/boot/dts/imx7ulp.dtsi | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts

[PATCH V2 02/18] i2c: imx-lpi2c: add ipg clk for lpi2c driver

2021-04-06 Thread Clark Wang
The lpi2c IP needs two clks: ipg clk and per clk. The old lpi2c driver missed ipg clk. This patch adds ipg clk for lpi2c driver. Signed-off-by: Gao Pan Signed-off-by: Clark Wang Acked-by: Fugang Duan --- V2 changes: - Merge two clocks' prepare funtions to lpi2c_imx_clocks_prepare

[PATCH V2 01/18] i2c: imx-lpi2c: directly retrun ISR when detect a NACK

2021-04-06 Thread Clark Wang
From: Gao Pan 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 Signed-off-by: Clark Wang Reviewed-by: Dong Aisheng --- V2 changes: - No change. Has

[PATCH V2 00/18] i2c: imx-lpi2c: New features and bug fixes

2021-04-06 Thread Clark Wang
mode. Clark Wang (14): i2c: imx-lpi2c: add ipg clk for lpi2c driver ARM: dts: imx7ulp: add the missing lpi2c ipg clock ARM: dts: imx7ulp: add the missing lpi2c nodes ARM64: dts: imx8: add the missing lpi2c ipg clock ARM64: dts: imx8: change i2c irq number to non-combined i2c: imx-lpi2c

RE: [PATCH 02/11] i2c: imx-lpi2c: add runtime pm support

2021-03-19 Thread Clark Wang
> -Original Message- > From: Clark Wang > Sent: Friday, March 19, 2021 14:16 > To: Aisheng Dong ; shawn...@kernel.org; > s.ha...@pengutronix.de > Cc: ker...@pengutronix.de; feste...@gmail.com; dl-linux-imx i...@nxp.com>; sumit.sem...@linaro.org; christian.ko

RE: [EXT] Re: [PATCH 06/11] i2c: imx-lpi2c: improve i2c driver probe priority

2021-03-19 Thread Clark Wang
> -Original Message- > From: Wolfram Sang > Sent: Friday, March 19, 2021 13:39 > To: Clark Wang > Cc: Aisheng Dong ; shawn...@kernel.org; > s.ha...@pengutronix.de; ker...@pengutronix.de; feste...@gmail.com; > dl-linux-imx ; sumit.sem...@linaro.org; > christi

RE: [PATCH 09/11] i2c: imx-lpi2c: fix i2c timing issue

2021-03-19 Thread Clark Wang
> -Original Message- > From: Aisheng Dong > Sent: Friday, March 19, 2021 13:15 > To: Clark Wang ; shawn...@kernel.org; > s.ha...@pengutronix.de > Cc: ker...@pengutronix.de; feste...@gmail.com; dl-linux-imx i...@nxp.com>; sumit.sem...@linaro.org; christian.ko

RE: [PATCH 05/11] i2c: imx-lpi2c: add debug message when i2c peripheral clk doesn't work

2021-03-19 Thread Clark Wang
> -Original Message- > From: Aisheng Dong > Sent: Friday, March 19, 2021 12:57 > To: Clark Wang ; shawn...@kernel.org; > s.ha...@pengutronix.de > Cc: ker...@pengutronix.de; feste...@gmail.com; dl-linux-imx i...@nxp.com>; sumit.sem...@linaro.org; christian.ko

RE: [PATCH 04/11] i2c: imx-lpi2c: manage irq resource request/release in runtime pm

2021-03-19 Thread Clark Wang
> -Original Message- > From: Aisheng Dong > Sent: Friday, March 19, 2021 12:54 > To: Clark Wang ; shawn...@kernel.org; > s.ha...@pengutronix.de > Cc: ker...@pengutronix.de; feste...@gmail.com; dl-linux-imx i...@nxp.com>; sumit.sem...@linaro.org; christian.ko

RE: [PATCH 03/11] i2c: imx-lpi2c: add ipg clk for lpi2c driver

2021-03-19 Thread Clark Wang
> -Original Message- > From: Aisheng Dong > Sent: Friday, March 19, 2021 12:46 > To: Clark Wang ; shawn...@kernel.org; > s.ha...@pengutronix.de > Cc: ker...@pengutronix.de; feste...@gmail.com; dl-linux-imx i...@nxp.com>; sumit.sem...@linaro.org; christian.ko

RE: [PATCH 02/11] i2c: imx-lpi2c: add runtime pm support

2021-03-19 Thread Clark Wang
> -Original Message- > From: Aisheng Dong > Sent: Friday, March 19, 2021 12:40 > To: Clark Wang ; shawn...@kernel.org; > s.ha...@pengutronix.de > Cc: ker...@pengutronix.de; feste...@gmail.com; dl-linux-imx i...@nxp.com>; sumit.sem...@linaro.org; christian.ko

RE: [PATCH 02/11] i2c: imx-lpi2c: add runtime pm support

2021-03-18 Thread Clark Wang
> -Original Message- > From: Aisheng Dong > Sent: Friday, March 19, 2021 12:40 > To: Clark Wang ; shawn...@kernel.org; > s.ha...@pengutronix.de > Cc: ker...@pengutronix.de; feste...@gmail.com; dl-linux-imx i...@nxp.com>; sumit.sem...@linaro.org; christian.ko

[PATCH 11/11] i2c: imx-lpi2c: add edma mode support

2021-03-17 Thread Clark Wang
Add eDMA receive and send mode support. Support to read and write data larger than 256 bytes in one frame. Signed-off-by: Clark Wang Reviewed-by: Li Jun --- drivers/i2c/busses/i2c-imx-lpi2c.c | 291 - 1 file changed, 289 insertions(+), 2 deletions(-) diff --git

[PATCH 10/11] i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle

2021-03-17 Thread Clark Wang
Claim clkhi and clklo as integer type to avoid possible calculation errors caused by data overflow. Reviewed-by: Fugang Duan Signed-off-by: Clark Wang --- drivers/i2c/busses/i2c-imx-lpi2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx

[PATCH 09/11] i2c: imx-lpi2c: fix i2c timing issue

2021-03-17 Thread Clark Wang
-off-by: Clark Wang --- drivers/i2c/busses/i2c-imx-lpi2c.c | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 7216a393095d..5dbe85126f24 100644 --- a/drivers/i2c/busses/i2c

[PATCH 08/11] i2c: imx-lpi2c: add bus recovery feature

2021-03-17 Thread Clark Wang
Add bus recovery feature for LPI2C. Need add gpio pinctrl, scl-gpios and sda-gpios configuration in dts. Signed-off-by: Clark Wang --- drivers/i2c/busses/i2c-imx-lpi2c.c | 83 ++ 1 file changed, 83 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b

[PATCH 07/11] i2c: imx-lpi2c: increase PM timeout to avoid operate clk frequently

2021-03-17 Thread Clark Wang
Switching the clock frequently will affect the data transmission efficiency, and prolong the timeout to reduce autosuspend times for lpi2c. Acked-by: Fugang Duan Signed-off-by: Clark Wang --- drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 04/11] i2c: imx-lpi2c: manage irq resource request/release in runtime pm

2021-03-17 Thread Clark Wang
From: Fugang Duan Manage irq resource request/release in runtime pm to save irq domain's power. Signed-off-by: Frank Li Signed-off-by: Fugang Duan Reviewed-by: Frank Li --- drivers/i2c/busses/i2c-imx-lpi2c.c | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-)

[PATCH 06/11] i2c: imx-lpi2c: improve i2c driver probe priority

2021-03-17 Thread Clark Wang
From: Gao Pan use subsys_initcall for i2c driver to improve i2c driver probe priority Signed-off-by: Gao Pan --- drivers/i2c/busses/i2c-imx-lpi2c.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c

[PATCH 05/11] i2c: imx-lpi2c: add debug message when i2c peripheral clk doesn't work

2021-03-17 Thread Clark Wang
From: Gao Pan add debug message when i2c peripheral clk rate is 0, then directly return -EINVAL. Signed-off-by: Gao Pan Reviewed-by: Andy Duan --- drivers/i2c/busses/i2c-imx-lpi2c.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c

[PATCH 02/11] i2c: imx-lpi2c: add runtime pm support

2021-03-17 Thread Clark Wang
From: Fugang Duan - Add runtime pm support to dynamicly manage the clock. - Put the suspend to suspend_noirq. - Call .pm_runtime_force_suspend() to force runtime pm suspended in .suspend_noirq(). Signed-off-by: Fugang Duan Signed-off-by: Gao Pan Reviewed-by: Anson Huang ---

[PATCH 01/11] i2c: imx-lpi2c: directly retrun ISR when detect a NACK

2021-03-17 Thread Clark Wang
From: Gao Pan 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 Signed-off-by: Clark Wang --- drivers/i2c/busses/i2c-imx-lpi2c.c | 12 +++- 1

[PATCH 03/11] i2c: imx-lpi2c: add ipg clk for lpi2c driver

2021-03-17 Thread Clark Wang
The lpi2c IP needs two clks: ipg clk and per clk. The old lpi2c driver missed ipg clk. This patch adds ipg clk for lpi2c driver. Signed-off-by: Gao Pan Signed-off-by: Clark Wang Acked-by: Fugang Duan --- drivers/i2c/busses/i2c-imx-lpi2c.c | 28 +--- 1 file changed, 21

[PATCH 00/11] i2c: imx-lpi2c: New features and bug fixes

2021-03-17 Thread Clark Wang
clk Best Regards, Clark Wang drivers/i2c/busses/i2c-imx-lpi2c.c | 536 + 1 file changed, 478 insertions(+), 58 deletions(-) -- 2.25.1

RE: [EXT] [PATCH] spi: imx: enable runtime pm support

2020-11-24 Thread Clark Wang
for !CONFIG_PM You may try the latest upstream driver again. I also fix a warning dump issue with CONFIG_PM enabled. It is under reviewed. So that, this driver can work well in both cases. Thanks! Best Regards, Clark Wang > -Original Message- > From: Nikita Shubin > Sen

[PATCH] spi: imx: fix the unbalanced spi runtime pm management

2020-11-24 Thread Clark Wang
already disabled [ 129.384005] WARNING: CPU: 1 PID: 33 at drivers/clk/clk.c:952 clk_core_disable+0xa4/0xb0 So add the get noresume function before set active. Fixes: 43b6bf406cd0 spi: imx: fix runtime pm support for !CONFIG_PM Signed-off-by: Clark Wang --- drivers/spi/spi-imx.c | 1 + 1 file changed

RE: [EXT] Re: [PATCH V2 1/4] spi: lpspi: Fix kernel warning dump when probe fail after calling spi_register

2020-07-30 Thread Clark Wang
> -Original Message- > From: Mark Brown > Sent: Monday, July 27, 2020 19:11 > To: Clark Wang > Cc: linux-...@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: [EXT] Re: [PATCH V2 1/4] spi: lpspi: Fix kernel warning dump when > probe fail after calling spi

[PATCH] spi: imx: enable runtime pm support

2020-07-27 Thread Clark Wang
Enable runtime pm support for spi-imx driver. Signed-off-by: Clark Wang --- drivers/spi/spi-imx.c | 121 ++ 1 file changed, 88 insertions(+), 33 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index fdc25f549378..38a5f1304cec

[PATCH V2 2/4] spi: lpspi: remove unused fsl_lpspi->chipselect

2020-07-26 Thread Clark Wang
The cs-gpio is initailized by spi_get_gpio_descs() now. Remove the chipselect. Signed-off-by: Clark Wang --- Changes: V2: - New patch added in the v2 patchset. --- drivers/spi/spi-fsl-lpspi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl

[PATCH V2 4/4] dt-bindings: lpspi: New property in document DT bindings for LPSPI

2020-07-26 Thread Clark Wang
Add "fsl,spi-only-use-cs1-sel" to fit i.MX8DXL-EVK. Spi common code does not support use of CS signals discontinuously. It only uses CS1 without using CS0. So, add this property to re-config chipselect value. Signed-off-by: Clark Wang --- Changes: V2: - New patch added in the v

[PATCH V2 3/4] spi: lpspi: fix using CS discontinuously on i.MX8DXLEVK

2020-07-26 Thread Clark Wang
SPI common code does not support using CS discontinuously for now. However, i.MX8DXL-EVK only uses CS1 without CS0. Therefore, add a flag is_only_cs1 to set the correct TCR[PCS]. Signed-off-by: Clark Wang --- Changes: V2: - No changes. --- drivers/spi/spi-fsl-lpspi.c | 11 --- 1 file

[PATCH V2 0/4] Some bug fix for lpspi

2020-07-26 Thread Clark Wang
Hi, This patchset mainly fixes some recently discovered problems about CS for LPSPI module on i.MX8DXLEVK. Add the dt-bindings description for the new property. Clark Wang (4): spi: lpspi: Fix kernel warning dump when probe fail after calling spi_register spi: lpspi: remove unused

[PATCH V2 1/4] spi: lpspi: Fix kernel warning dump when probe fail after calling spi_register

2020-07-26 Thread Clark Wang
] ---[ end trace 58abcdfae01bd3c7 ]--- So put this function at the end of the probe sequence. Signed-off-by: Clark Wang --- Changes: V2: - redo the patch base on the new code. --- drivers/spi/spi-fsl-lpspi.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers

[PATCH 5/5] spi: lpspi: fix using CS discontinuously on i.MX8DXLEVK

2020-07-14 Thread Clark Wang
SPI common code does not support using CS discontinuously for now. However, i.MX8DXL-EVK only uses CS1 without CS0. Therefore, add a flag is_only_cs1 to set the correct TCR[PCS]. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 11 --- 1 file changed, 8 insertions(+), 3

[PATCH 1/5] spi: lpspi: fix the imbalance of runtime pm function call

2020-07-14 Thread Clark Wang
Call the put function after probe successfully. Otherwise, the lpspi module will keep active status until the first spi transfer called. Disable runtime pm when probe fails. There is no need to active runtime pm after probe failed. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 7

[PATCH 3/5] spi: lpspi: fix kernel warning dump when probe fail after calling spi_register

2020-07-14 Thread Clark Wang
] ---[ end trace 58abcdfae01bd3c7 ]--- So put this function at the end of the probe sequence. Meanwhile, in order to keep the multi-CS working, add "fsl,spi-num-chipselects" check. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 24 +--- 1 file c

[PATCH 4/5] spi: lpspi: handle EPROBE_DEFER when get cs-gpios number

2020-07-14 Thread Clark Wang
From: Fabrice Goucem If SPI is probed before the GPIO driver, it may miss the cs-gpio configuration in dtb. Add defer probe handler to wait GPIO driver probe. Signed-off-by: Fabrice Goucem Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 5 + 1 file changed, 5 insertions

[PATCH 0/5] Some bug fix for lpspi

2020-07-14 Thread Clark Wang
Hi, This series mainly fixes some recently discovered problems about CS for LPSPI module. And two patches to improve the reliability of the driver. Regards, Clark Clark Wang (4): spi: lpspi: fix the imbalance of runtime pm function call spi: lpspi: add NULL check when probe device spi

[PATCH 2/5] spi: lpspi: add NULL check when probe device

2020-07-14 Thread Clark Wang
Add a NULL check for device node and lpspi_platform_info when lpspi device probe. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index a1555bbc5e5a..ca43d93adf30 100644

[PATCH 0/3] spi: lpspi: SS function related changes

2019-04-23 Thread Clark Wang
Hi Mark, These three patches do some code clean up works and fix a problem when use multi SS in PIO mode. Clark Wang (3): spi: lpspi: add NULL check when probe device spi: lpspi: add multi SS support in PIO mode spi: lpspi: remove fsl_lpspi->chipselect drivers/spi/spi-fsl-lpspi.c |

[PATCH 2/3] spi: lpspi: add multi SS support in PIO mode

2019-04-23 Thread Clark Wang
Add "fsl,spi-num-chipselects" check to support multi SS function in PIO mode. Signed-off-by: Clark Wang Acked-by: Fugang Duan --- drivers/spi/spi-fsl-lpspi.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/s

[PATCH 3/3] spi: lpspi: remove fsl_lpspi->chipselect

2019-04-23 Thread Clark Wang
Replace fsl_lpspi->chipselect by controller->cs_gpios. Clean up the code. Signed-off-by: Clark Wang Acked-by: Fugang Duan --- drivers/spi/spi-fsl-lpspi.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-l

[PATCH 1/3] spi: lpspi: add NULL check when probe device

2019-04-23 Thread Clark Wang
Add a NULL check for device node and lpspi_platform_info when lpspi device probe. Signed-off-by: Clark Wang Acked-by: Fugang Duan --- drivers/spi/spi-fsl-lpspi.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index

[PATCH] spi: lpspi: add missing complete in abort func at dma mode

2019-04-02 Thread Clark Wang
Add the missing complete operations for dma_completion to fix the problem of blocking at the wait_for_completion_interruptible() function when use spi_slave_abort(). Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff

[PATCH] spi: lpspi: fix dataloss when SS is inactivated between every words

2019-03-21 Thread Clark Wang
the value of FSR_RXCOUNT cannot reflect whether there is still data not sent timely. So do this judgement by FSR_TXCOUNT. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi

[PATCH V2 4/8] spi: lpspi: add the error info of transfer speed setting

2019-03-05 Thread Clark Wang
Add a error info when set a speed which greater than half of per-clk of spi module. The minimum SCK period is 2 cycles(CCR[SCKDIV]). So the maximum transfer speed is half of spi per-clk. Signed-off-by: Clark Wang --- V2: - No change. Resend for applying. --- drivers/spi/spi-fsl-lpspi.c | 16

[PATCH V2 2/8] doc: lpspi: Document DT bindings for LPSPI clocks

2019-03-05 Thread Clark Wang
Add introductions of clocks and clock-names strings. Signed-off-by: Clark Wang --- V2: - Add this DT-bindings string in this version. --- .../devicetree/bindings/spi/spi-fsl-lpspi.txt | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Documentation

[PATCH V2 3/8] spi: lpspi: enable runtime pm for lpspi

2019-03-05 Thread Clark Wang
From: Han Xu Enable the runtime power management for lpspi module. Do some adaptation work from kernel 4.9 to 4.14. Signed-off-by: Clark Wang Signed-off-by: Han Xu Reviewed-by: Frank Li --- V2: - Fix the comment format. --- drivers/spi/spi-fsl-lpspi.c | 117

[PATCH V2 5/8] spi: lpspi: use the core way to implement cs-gpio function

2019-03-05 Thread Clark Wang
Use the default implementation of transfer_one_msg/chipselect/setup functions in spi core to implement cs-gpio control. Use fsl_lpspi_prepare_message to init the cs_gpio pin. Signed-off-by: Clark Wang Acked-by: Fugang Duan --- V2: - use core way to implement cs-gpio control. Removed

[PATCH V2 0/8] spi: lpspi: Fix bugs and Add some functions support

2019-03-05 Thread Clark Wang
). In order to reach the maximum speed which is mentioned in datasheet, the load of connect wires between master and slave should be less than 15pF. Each patch in this patchset should base on the previous one when applied. Thank you! Clark Wang (7): spi: lpspi: Add i.MX8 boards

[PATCH V2 8/8] spi: lpspi: Code cleanup

2019-03-05 Thread Clark Wang
Delete the extra space. Signed-off-by: Clark Wang --- V2: - add this patch in this version --- drivers/spi/spi-fsl-lpspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index 2ac3ac5ea50a..1860f066f838 100644

[PATCH V2 6/8] spi: lpspi: add dma mode support

2019-03-05 Thread Clark Wang
speed in slave mode is 15MHz(imx7ulp), 22MHz(8qm/qxp). In order to reach the maximum speed which is mentioned in datasheet, the load of connect wires between master and slave should be less than 15pF. Signed-off-by: Clark Wang Acked-by: Fugang Duan --- V2: - replace a if judgement

[PATCH V2 7/8] spi: lpspi: Add the missing NULL check

2019-03-05 Thread Clark Wang
The spi_transfer *t will be used in one transfer whatever. If t is NULL, there has no need to try sending data, so add an error return here. Signed-off-by: Clark Wang Acked-by: Fugang Duan --- V2: - add this patch in this version --- drivers/spi/spi-fsl-lpspi.c | 7 +-- 1 file changed, 5

[PATCH V2 1/8] spi: lpspi: Add i.MX8 boards support for lpspi

2019-03-05 Thread Clark Wang
Add both ipg and per clock for lpspi to support i.MX8QM/QXP boards. Signed-off-by: Clark Wang --- V2: - No change. But add DT-bindings string at the next patch. --- drivers/spi/spi-fsl-lpspi.c | 52 + 1 file changed, 41 insertions(+), 11 deletions(-) diff

[PATCH 8/8] spi: lpspi: add dma mode support

2019-01-06 Thread Clark Wang
. The maximum transfer speed in slave mode is 15MHz(i.MX7ULP), 22MHz(i.MX8 series). Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 318 ++-- 1 file changed, 306 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl

[PATCH 6/8] spi: lpspi: add the error info of transfer speed setting

2019-01-06 Thread Clark Wang
Add a error info when set a speed which greater than half of per-clk of spi module. The minimum SCK period is 2 cycles(CCR[SCKDIV]). So the maximum transfer speed is half of spi per-clk. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 16 +--- 1 file changed, 13

[PATCH 4/8] spi: lpspi: Fix wrong transmission when don't use CONT

2019-01-06 Thread Clark Wang
of whole data. This will cause the transfer ending early. This patch add a register reading in isr function, it might lead to a slight decrease in the max transmission speed in PIO mode. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 9 + 1 file changed, 9 insertions

[PATCH 1/8] spi: lpspi: Add i.MX8 boards support for lpspi

2019-01-06 Thread Clark Wang
Add both ipg and per clock for lpspi to support i.MX8QM/QXP boards. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 52 + 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c

[PATCH 7/8] spi: lpspi: Add cs-gpio support

2019-01-06 Thread Clark Wang
Add cs-gpio feature for LPSPI. The cs line will be controlled in fsl_lpspi_transfe_one_msg() function. Still support using the mode without cs-gpio. It depends on if attribute cs-gpio has been configured in dts file. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 89

[PATCH 2/8] spi: lpspi: enable runtime pm for lpspi

2019-01-06 Thread Clark Wang
From: Han Xu Enable the runtime power management for lpspi module. Do some adaptation work from kernel 4.9 to 4.14. Signed-off-by: Clark Wang Signed-off-by: Han Xu Reviewed-by: Frank Li --- drivers/spi/spi-fsl-lpspi.c | 117 1 file

[PATCH 0/8] spi: lpspi: Fix bugs and Add some functions support

2019-01-06 Thread Clark Wang
MX8 series). Clark Wang (8): spi: lpspi: Add i.MX8 boards support for lpspi spi: lpspi: enable runtime pm for lpspi spi: lpspi: Improve the stability of lpspi data transmission spi: lpspi: Fix wrong transmission when don't use CONT spi: lpspi: Fix CLK pin becomes low before one transfer

[PATCH 3/8] spi: lpspi: Improve the stability of lpspi data transmission

2019-01-06 Thread Clark Wang
fsl_lpspi_txfifo_empty(), so remove it. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 61 - 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index 3e935db5ff02..f32a2e0d7ae1 100644

[PATCH 5/8] spi: lpspi: Fix CLK pin becomes low before one transfer

2019-01-06 Thread Clark Wang
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: Clark Wang Reviewed-by: Fugang Duan --- drivers/spi/spi-fsl

RE: [PATCH] spi: lpspi: enable runtime pm for lpspi

2018-12-11 Thread Clark Wang
> -Original Message- > From: Mark Brown > Sent: Tuesday, December 11, 2018 22:28 > To: Clark Wang > Cc: linux-...@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] spi: lpspi: enable runtime pm for lpspi > > On Tue, Dec 04, 2018 at 06:19:48AM

RE: [PATCH] spi: lpspi: Add cs-gpio support

2018-12-11 Thread Clark Wang
> -Original Message- > From: Mark Brown > Sent: Tuesday, December 11, 2018 22:26 > To: Clark Wang > Cc: linux-...@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] spi: lpspi: Add cs-gpio support > > On Tue, Dec 04, 2018 at 06:24:59AM

RE: [PATCH] spi: lpspi: Fix CLK pin becomes low before one transfer

2018-12-11 Thread Clark Wang
Hi Mark, These five patches are based on patch series spi: lpspi: Add Slave Mode support for LPSPI. For the patch series make a big change, should I hold these five patches until the patch series are applied in your git branch? Thanks for your patience. Regards, Clark Wang > -Origi

RE: [PATCH V3 1/4] spi: lpspi: Replace all "master" with "controller"

2018-12-07 Thread Clark Wang
the structure of slave mode will cause confusion. When Geert Uytterhoeven add the slave support for spi, he had done " Generalize SPI 'master' to 'controller'" step, too. The commit ID is 8caab75fd2c2a92667cbb1cd315720bede3feaa9. Thank you. Regards, Clark Wang > -Original Message

RE: [PATCH V3 1/4] spi: lpspi: Replace all "master" with "controller"

2018-12-07 Thread Clark Wang
the structure of slave mode will cause confusion. When Geert Uytterhoeven add the slave support for spi, he had done " Generalize SPI 'master' to 'controller'" step, too. The commit ID is 8caab75fd2c2a92667cbb1cd315720bede3feaa9. Thank you. Regards, Clark Wang > -Original Message

[PATCH V3 3/4] spi: lpspi: Let watermark change with send data length

2018-12-06 Thread Clark Wang
Configure watermark to change with the length of the sent data. Support LPSPI sending message shorter than tx/rxfifosize. Signed-off-by: Clark Wang --- Change log: V2/V3: - No change. --- drivers/spi/spi-fsl-lpspi.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git

[PATCH V3 4/4] doc: lpspi: Document DT bindings for LPSPI slave mode

2018-12-06 Thread Clark Wang
Add introductions of interrupt-parent and spi-slave. Signed-off-by: Clark Wang --- Change log: V2: - No change. V3: - Keep the description of "fsl,imx8qxp-spi" in spi-fsl-lpspi.txt. --- Documentation/devicetree/bindings/spi/spi-fsl-lpspi.txt | 4 1 file changed, 4 insertion

[PATCH V3 3/4] spi: lpspi: Let watermark change with send data length

2018-12-06 Thread Clark Wang
Configure watermark to change with the length of the sent data. Support LPSPI sending message shorter than tx/rxfifosize. Signed-off-by: Clark Wang --- Change log: V2/V3: - No change. --- drivers/spi/spi-fsl-lpspi.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git

[PATCH V3 4/4] doc: lpspi: Document DT bindings for LPSPI slave mode

2018-12-06 Thread Clark Wang
Add introductions of interrupt-parent and spi-slave. Signed-off-by: Clark Wang --- Change log: V2: - No change. V3: - Keep the description of "fsl,imx8qxp-spi" in spi-fsl-lpspi.txt. --- Documentation/devicetree/bindings/spi/spi-fsl-lpspi.txt | 4 1 file changed, 4 insertion

[PATCH V3 2/4] spi: lpspi: Add slave mode support

2018-12-06 Thread Clark Wang
ection: GND, SCK, MISO(to MISO of slave), MOSI(to MOSI of slave), SCS Signed-off-by: Clark Wang --- Change log: V2: - No change. V3: - Add more detailed description in commit message. --- drivers/spi/spi-fsl-lpspi.c | 107 ++-- 1 file changed, 79 insertions(

[PATCH V3 1/4] spi: lpspi: Replace all "master" with "controller"

2018-12-06 Thread Clark Wang
In order to enable the slave mode and make the code more readable, replace all related structure names and object names which is named "master" with "controller". Signed-off-by: Clark Wang --- Change log: V2/V3: - No change. --- drivers/spi/

[PATCH V3 2/4] spi: lpspi: Add slave mode support

2018-12-06 Thread Clark Wang
ection: GND, SCK, MISO(to MISO of slave), MOSI(to MOSI of slave), SCS Signed-off-by: Clark Wang --- Change log: V2: - No change. V3: - Add more detailed description in commit message. --- drivers/spi/spi-fsl-lpspi.c | 107 ++-- 1 file changed, 79 insertions(

[PATCH V3 1/4] spi: lpspi: Replace all "master" with "controller"

2018-12-06 Thread Clark Wang
In order to enable the slave mode and make the code more readable, replace all related structure names and object names which is named "master" with "controller". Signed-off-by: Clark Wang --- Change log: V2/V3: - No change. --- drivers/spi/

[PATCH V3 0/4] spi: lpspi: Add Slave Mode support for LPSPI

2018-12-06 Thread Clark Wang
x8qxp-spi" in spi-fsl-lpspi.txt in the fourth patch. Clark Wang (4): spi: lpspi: Replace all "master" with "controller" spi: lpspi: Add slave mode support spi: lpspi: Let watermark change with send data length doc: lpspi: Document DT bindings for LPSPI slave mode .../device

[PATCH V3 0/4] spi: lpspi: Add Slave Mode support for LPSPI

2018-12-06 Thread Clark Wang
x8qxp-spi" in spi-fsl-lpspi.txt in the fourth patch. Clark Wang (4): spi: lpspi: Replace all "master" with "controller" spi: lpspi: Add slave mode support spi: lpspi: Let watermark change with send data length doc: lpspi: Document DT bindings for LPSPI slave mode .../device

[PATCH] spi: lpspi: Add cs-gpio support

2018-12-03 Thread Clark Wang
cs-gpio has been configured in dts file. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 79 - 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index a7d01b79827b..c6fe3f94de19

[PATCH] spi: lpspi: Add cs-gpio support

2018-12-03 Thread Clark Wang
cs-gpio has been configured in dts file. Signed-off-by: Clark Wang --- drivers/spi/spi-fsl-lpspi.c | 79 - 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index a7d01b79827b..c6fe3f94de19

[PATCH] spi: lpspi: Fix CLK pin becomes low before one transfer

2018-12-03 Thread Clark Wang
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: Clark Wang Reviewed-by: Fugang Duan --- drivers/spi/spi-fsl

[PATCH] spi: lpspi: Fix CLK pin becomes low before one transfer

2018-12-03 Thread Clark Wang
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: Clark Wang Reviewed-by: Fugang Duan --- drivers/spi/spi-fsl

  1   2   >