[v11,0/2] spi: loongson: add bus driver for the loongson spi

Message ID 20230522071030.5193-1-zhuyinbo@loongson.cn
Headers
Series spi: loongson: add bus driver for the loongson spi |

Message

Yinbo Zhu May 22, 2023, 7:10 a.m. UTC
  Loongson platform support spi hardware controller and this series patch
was to add spi driver and binding support.

Change in v2:
		1. This [PATCH v2 1/2] dt-bindings patch need depend on clk patch:
	 	   https://
		   lore.kernel.org/all/20230307115022.12846-1-zhuyinbo@loongson.cn/
		2. Remove the clock-names in spi yaml file.
		3. Add "loongson,ls7a-spi" compatible in spi yaml file.
		4. Add an || COMPILE_TEST and drop && PCI then add some CONFIG_PCI
		   macro to limit some pci code.
		5. Make the spi driver top code comment block that use C++ style.
		6. Drop spi->max_speed_hz.
		7. Add a spin_lock for loongson_spi_setup.
		8. Add a timeout and cpu_relax() in loongson_spi_write_read_8bit.
		9. Add spi_transfer_one and drop transfer and rework entire spi
		   driver that include some necessary changes.
		10. Use module_init replace subsys_initcall.
		11. About PM interface that I don't find any issue so I don't add
		    any changes.
Change in v3:
		1. This [PATCH v3 1/2] dt-bindings patch need depend on clk patch:
		   https://
		   lore.kernel.org/all/20230323025229.2971-1-zhuyinbo@loongson.cn/
		2. Drop the unused blank line in loongson,ls-spi.yaml file.
		3. Replace clock minItems with clock maxItems in yaml file.
		4. Separate spi driver into platform module, pci module and core
		   module.
		5. Replace DIV_ROUND_UP with DIV_ROUND_UP_ULL to fix compile error
		   "undefined reference to `__aeabi_uldivmod'" and  "__udivdi3 undefined"
		   that reported by test robot.
		6. Remove the spin lock.
		7. Clear the loongson_spi->hz and loongson_spi->mode in setup to fixup
		   the issue that multiple spi device transfer that maybe cause spi was
		   be misconfigured.
Change in v4:
		1. This [PATCH v4 1/2] dt-bindings patch need depend on clk patch:
		   https://
		   lore.kernel.org/all/20230323025229.2971-1-zhuyinbo@loongson.cn/
		2. Add "#include <linux/io.h>" in spi-loongson-core.c for fix the compile
		   issue which devm_ioremap no declaration.
		3. Add "EXPORT_SYMBOL_GPL(loongson_spi_dev_pm_ops)" in
		   spi-loongson-core.c for fix the compile issue which
		   loongson_spi_dev_pm_ops undefined.
Change in v5:
		1. Get rid of the clock patch's dependency and open-code the clock IDs.
		2. Fixup checkpatch issue that by installed ply and gitpython package
		   locally, but this series of patch's code doesn't have any change.
Change in v6:
		1. Remove the "#include <dt-bindings/clock/loongson,ls2k-clk.h>" in
		   yaml file.
Change in v7:
		1. Remove the "loongson,ls7a-spi" and change yaml file name as
		   "loongson,ls2k-spi.yaml".
		2. Use module_pci_driver and module_platform_driver to replace
		   module_init and module_exit.
		3. Drop ".owner	= THIS_MODULE" in spi platform driver.
		4. Add devm_spi_alloc_master devm_spi_register_master to simplify code.
		5. Add pci_disable_device() in loongson_spi_pci_unregister.
Change in v8:
		1. Add reviewed-by information for spi bindings patch.
		2. Fixup the uncorrect spi yaml file path in MAINTAINERS file.
		3. Add spi_master_suspend and spi_master_resume in spi pm function.
Change in v9:
		1. Make spi_master_suspend go first in pm suspend.
Change in v10:
		1. Fix the compile issue about of_node_get and of_get_property no
		   declaration.
		2. set config SPI_LOONGSON_CORE invisible.
		3. Captial "spi" in commit log and Kconfig file.
		4. Write header files in alphabetical order.
		5. Use clamp_val, GENMASK() and BIT() in spi clock setting.
		6. Optimize clock and mode setting code.
		7. Use readb_poll_timeout in loongson_spi_write_read_8bit.
		8. Remove some useless dmesg print.
		9. Use device_set_node replace of_node_get.
		10. Use dev_err_probe in code.
		11. Use devm_clk_get_optional replace devm_clk_get.
		12. Remove SPI_NO_CS for drop 2k500 non common type spi.
		13. Use pcim_enable_device() and pcim_iomap_regions() in spi pci
		    driver.
		14. Passing the remapped address in loongson_spi_init_master.
		15. Remove the useless goto flag "err_out".
		16. Use pci vendor id in pci_ids.h.
		17. Use devm_platform_ioremap_resource in spi platform driver.
		18. Remove the useless item in pci_device_id.
		19. Remove the inned comma in of_device_id.
		20. Add some headfile in spi_loongson.h.
		21. Remove the useless extern for loongson_spi_init_master in
		    spi_loongson.h.
Change in v11:
		1. Use spi_get_chipselect() to replace all spi->chip_select in
		   spi driver

Yinbo Zhu (2):
  dt-bindings: spi: add loongson spi
  spi: loongson: add bus driver for the loongson spi controller

 .../bindings/spi/loongson,ls2k-spi.yaml       |  41 +++
 MAINTAINERS                                   |  10 +
 drivers/spi/Kconfig                           |  26 ++
 drivers/spi/Makefile                          |   3 +
 drivers/spi/spi-loongson-core.c               | 279 ++++++++++++++++++
 drivers/spi/spi-loongson-pci.c                |  61 ++++
 drivers/spi/spi-loongson-plat.c               |  46 +++
 drivers/spi/spi-loongson.h                    |  47 +++
 8 files changed, 513 insertions(+)
  

Comments

Mark Brown May 22, 2023, 10:34 a.m. UTC | #1
On Mon, May 22, 2023 at 03:10:28PM +0800, Yinbo Zhu wrote:
> Loongson platform support spi hardware controller and this series patch
> was to add spi driver and binding support.

To repeat what I previously asked you *please* send patches against my
current tree, this doesn't even apply cleanly against Linus' tree never
mind any of the branches in mine.
  
Yinbo Zhu May 22, 2023, 11:44 a.m. UTC | #2
在 2023/5/22 下午6:34, Mark Brown 写道:
> On Mon, May 22, 2023 at 03:10:28PM +0800, Yinbo Zhu wrote:
>> Loongson platform support spi hardware controller and this series patch
>> was to add spi driver and binding support.
> 
> To repeat what I previously asked you *please* send patches against my
> current tree, this doesn't even apply cleanly against Linus' tree never
> mind any of the branches in mine.

Hi Mark,

I was base on following tree and branch to apply my patch then to send
it to upstrem:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 
branch: for-next

The recently patch was as follows, It seems no issue for patch apply
them, Maybe it is the 0/2 patch issue ? this 0/2 patch wasn't a valid
patch and it need was skipped.

8f7b91d47211 spi: loongson: add bus driver for the loongson spi
controller
193a72146430 dt-bindings: spi: add loongson spi
b1f4091a9eff (spi/for-next) Merge remote-tracking branch 'spi/for-6.5'
into spi-next
120e1aa2f2e6 (spi/for-6.5) spi: hisi-kunpeng: Fix error checking
f2156989bf30 spi: cdns: Add compatible for AMD Pensando Elba SoC


Thanks,
Yinbo.


>
  
Mark Brown May 22, 2023, 11:56 a.m. UTC | #3
On Mon, May 22, 2023 at 07:44:49PM +0800, zhuyinbo wrote:

> The recently patch was as follows, It seems no issue for patch apply
> them, Maybe it is the 0/2 patch issue ? this 0/2 patch wasn't a valid
> patch and it need was skipped.

What's causing problem is that you patched MAINTAINERS in both patches
but also used the wrong subject line for the first patch so I was having
to fix it up by hand every time.
  
Yinbo Zhu May 22, 2023, 1:07 p.m. UTC | #4
在 2023/5/22 下午7:56, Mark Brown 写道:
> On Mon, May 22, 2023 at 07:44:49PM +0800, zhuyinbo wrote:
> 
>> The recently patch was as follows, It seems no issue for patch apply
>> them, Maybe it is the 0/2 patch issue ? this 0/2 patch wasn't a valid
>> patch and it need was skipped.
> 
> What's causing problem is that you patched MAINTAINERS in both patches
> but also used the wrong subject line for the first patch so I was having
> to fix it up by hand every time.

Hi Mark,

I learn about what you said that bindings patch and spi driver change a
same MAINTAINERS file, but It seems not cause apply fail if the patch
series apply in order.  I'm sorry, I don't understand the reason why my
spi series patch apply failed,  then I have a look about your spi ci
tree and that what I need to do is just change the title of [1/2] patch
like this in next version ?  Correcting the title can solve the problem
of patch series apply failure in your tree ? actually, I don't reproduce
that apply faile issue in your current spi tree and for-next branch.


spi: add loongson spi bindings

Thanks
Yinbo
  
Mark Brown May 22, 2023, 1:10 p.m. UTC | #5
On Mon, May 22, 2023 at 09:07:47PM +0800, zhuyinbo wrote:
> 在 2023/5/22 下午7:56, Mark Brown 写道:

> > What's causing problem is that you patched MAINTAINERS in both patches
> > but also used the wrong subject line for the first patch so I was having
> > to fix it up by hand every time.

> spi series patch apply failed,  then I have a look about your spi ci
> tree and that what I need to do is just change the title of [1/2] patch
> like this in next version ?  Correcting the title can solve the problem
> of patch series apply failure in your tree ? actually, I don't reproduce
> that apply faile issue in your current spi tree and for-next branch.

> spi: add loongson spi bindings

That's a good title.  The patches get reordered in the mailbox when I
rewrite the title prior to applying them.
  
Yinbo Zhu May 23, 2023, 2:08 a.m. UTC | #6
在 2023/5/22 下午9:10, Mark Brown 写道:
> On Mon, May 22, 2023 at 09:07:47PM +0800, zhuyinbo wrote:
>> 在 2023/5/22 下午7:56, Mark Brown 写道:
> 
>>> What's causing problem is that you patched MAINTAINERS in both patches
>>> but also used the wrong subject line for the first patch so I was having
>>> to fix it up by hand every time.
> 
>> spi series patch apply failed,  then I have a look about your spi ci
>> tree and that what I need to do is just change the title of [1/2] patch
>> like this in next version ?  Correcting the title can solve the problem
>> of patch series apply failure in your tree ? actually, I don't reproduce
>> that apply faile issue in your current spi tree and for-next branch.
> 
>> spi: add loongson spi bindings
> 
> That's a good title.  The patches get reordered in the mailbox when I
> rewrite the title prior to applying them.


okay, I got it.  thanks!  and I noticed my v11 patch already exists in
your ci tree that contain the title change and I whether need send the
v12 that for fix the binding patch title ?

Thanks,
Yinbo
>
  
Mark Brown May 23, 2023, 9:57 a.m. UTC | #7
On Tue, May 23, 2023 at 10:08:25AM +0800, zhuyinbo wrote:

> okay, I got it.  thanks!  and I noticed my v11 patch already exists in
> your ci tree that contain the title change and I whether need send the
> v12 that for fix the binding patch title ?

No, it's fine.
  
Yinbo Zhu May 23, 2023, 11:01 a.m. UTC | #8
在 2023/5/23 下午5:57, Mark Brown 写道:
> On Tue, May 23, 2023 at 10:08:25AM +0800, zhuyinbo wrote:
> 
>> okay, I got it.  thanks!  and I noticed my v11 patch already exists in
>> your ci tree that contain the title change and I whether need send the
>> v12 that for fix the binding patch title ?
> 
> No, it's fine.


okay, I got it.

Thanks.
  
Mark Brown July 31, 2023, 7:57 p.m. UTC | #9
On Mon, 22 May 2023 15:10:28 +0800, Yinbo Zhu wrote:
> Loongson platform support spi hardware controller and this series patch
> was to add spi driver and binding support.
> 
> Change in v2:
> 		1. This [PATCH v2 1/2] dt-bindings patch need depend on clk patch:
> 	 	   https://
> 		   lore.kernel.org/all/20230307115022.12846-1-zhuyinbo@loongson.cn/
> 		2. Remove the clock-names in spi yaml file.
> 		3. Add "loongson,ls7a-spi" compatible in spi yaml file.
> 		4. Add an || COMPILE_TEST and drop && PCI then add some CONFIG_PCI
> 		   macro to limit some pci code.
> 		5. Make the spi driver top code comment block that use C++ style.
> 		6. Drop spi->max_speed_hz.
> 		7. Add a spin_lock for loongson_spi_setup.
> 		8. Add a timeout and cpu_relax() in loongson_spi_write_read_8bit.
> 		9. Add spi_transfer_one and drop transfer and rework entire spi
> 		   driver that include some necessary changes.
> 		10. Use module_init replace subsys_initcall.
> 		11. About PM interface that I don't find any issue so I don't add
> 		    any changes.
> Change in v3:
> 		1. This [PATCH v3 1/2] dt-bindings patch need depend on clk patch:
> 		   https://
> 		   lore.kernel.org/all/20230323025229.2971-1-zhuyinbo@loongson.cn/
> 		2. Drop the unused blank line in loongson,ls-spi.yaml file.
> 		3. Replace clock minItems with clock maxItems in yaml file.
> 		4. Separate spi driver into platform module, pci module and core
> 		   module.
> 		5. Replace DIV_ROUND_UP with DIV_ROUND_UP_ULL to fix compile error
> 		   "undefined reference to `__aeabi_uldivmod'" and  "__udivdi3 undefined"
> 		   that reported by test robot.
> 		6. Remove the spin lock.
> 		7. Clear the loongson_spi->hz and loongson_spi->mode in setup to fixup
> 		   the issue that multiple spi device transfer that maybe cause spi was
> 		   be misconfigured.
> Change in v4:
> 		1. This [PATCH v4 1/2] dt-bindings patch need depend on clk patch:
> 		   https://
> 		   lore.kernel.org/all/20230323025229.2971-1-zhuyinbo@loongson.cn/
> 		2. Add "#include <linux/io.h>" in spi-loongson-core.c for fix the compile
> 		   issue which devm_ioremap no declaration.
> 		3. Add "EXPORT_SYMBOL_GPL(loongson_spi_dev_pm_ops)" in
> 		   spi-loongson-core.c for fix the compile issue which
> 		   loongson_spi_dev_pm_ops undefined.
> Change in v5:
> 		1. Get rid of the clock patch's dependency and open-code the clock IDs.
> 		2. Fixup checkpatch issue that by installed ply and gitpython package
> 		   locally, but this series of patch's code doesn't have any change.
> Change in v6:
> 		1. Remove the "#include <dt-bindings/clock/loongson,ls2k-clk.h>" in
> 		   yaml file.
> Change in v7:
> 		1. Remove the "loongson,ls7a-spi" and change yaml file name as
> 		   "loongson,ls2k-spi.yaml".
> 		2. Use module_pci_driver and module_platform_driver to replace
> 		   module_init and module_exit.
> 		3. Drop ".owner	= THIS_MODULE" in spi platform driver.
> 		4. Add devm_spi_alloc_master devm_spi_register_master to simplify code.
> 		5. Add pci_disable_device() in loongson_spi_pci_unregister.
> Change in v8:
> 		1. Add reviewed-by information for spi bindings patch.
> 		2. Fixup the uncorrect spi yaml file path in MAINTAINERS file.
> 		3. Add spi_master_suspend and spi_master_resume in spi pm function.
> Change in v9:
> 		1. Make spi_master_suspend go first in pm suspend.
> Change in v10:
> 		1. Fix the compile issue about of_node_get and of_get_property no
> 		   declaration.
> 		2. set config SPI_LOONGSON_CORE invisible.
> 		3. Captial "spi" in commit log and Kconfig file.
> 		4. Write header files in alphabetical order.
> 		5. Use clamp_val, GENMASK() and BIT() in spi clock setting.
> 		6. Optimize clock and mode setting code.
> 		7. Use readb_poll_timeout in loongson_spi_write_read_8bit.
> 		8. Remove some useless dmesg print.
> 		9. Use device_set_node replace of_node_get.
> 		10. Use dev_err_probe in code.
> 		11. Use devm_clk_get_optional replace devm_clk_get.
> 		12. Remove SPI_NO_CS for drop 2k500 non common type spi.
> 		13. Use pcim_enable_device() and pcim_iomap_regions() in spi pci
> 		    driver.
> 		14. Passing the remapped address in loongson_spi_init_master.
> 		15. Remove the useless goto flag "err_out".
> 		16. Use pci vendor id in pci_ids.h.
> 		17. Use devm_platform_ioremap_resource in spi platform driver.
> 		18. Remove the useless item in pci_device_id.
> 		19. Remove the inned comma in of_device_id.
> 		20. Add some headfile in spi_loongson.h.
> 		21. Remove the useless extern for loongson_spi_init_master in
> 		    spi_loongson.h.
> Change in v11:
> 		1. Use spi_get_chipselect() to replace all spi->chip_select in
> 		   spi driver
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/2] dt-bindings: spi: add loongson spi
      (no commit info)
[2/2] spi: loongson: add bus driver for the loongson spi controller
      commit: 6c7a864007b66e60a3f64858a9555efed408b048

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark