linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] spi: loongson: add bus driver for the loongson spi
@ 2023-03-24  6:33 Yinbo Zhu
  2023-03-24  6:33 ` [PATCH v3 1/2] dt-bindings: spi: add " Yinbo Zhu
  2023-03-24  6:33 ` [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller Yinbo Zhu
  0 siblings, 2 replies; 17+ messages in thread
From: Yinbo Zhu @ 2023-03-24  6:33 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Krzysztof Kozlowski, linux-spi,
	devicetree, linux-kernel
  Cc: Jianmin Lv, wanghongliang, Liu Peibao, loongson-kernel, Yinbo Zhu

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.

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

 .../bindings/spi/loongson,ls-spi.yaml         |  43 +++
 MAINTAINERS                                   |  10 +
 drivers/spi/Kconfig                           |  31 ++
 drivers/spi/Makefile                          |   3 +
 drivers/spi/spi-loongson-core.c               | 302 ++++++++++++++++++
 drivers/spi/spi-loongson-pci.c                |  89 ++++++
 drivers/spi/spi-loongson-plat.c               |  66 ++++
 drivers/spi/spi-loongson.h                    |  41 +++
 8 files changed, 585 insertions(+)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v3 1/2] dt-bindings: spi: add loongson spi
  2023-03-24  6:33 [PATCH v3 0/2] spi: loongson: add bus driver for the loongson spi Yinbo Zhu
@ 2023-03-24  6:33 ` Yinbo Zhu
  2023-03-24  6:36   ` zhuyinbo
  2023-03-24 13:07   ` Rob Herring
  2023-03-24  6:33 ` [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller Yinbo Zhu
  1 sibling, 2 replies; 17+ messages in thread
From: Yinbo Zhu @ 2023-03-24  6:33 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Krzysztof Kozlowski, linux-spi,
	devicetree, linux-kernel
  Cc: Jianmin Lv, wanghongliang, Liu Peibao, loongson-kernel, Yinbo Zhu

Add the Loongson platform spi binding with DT schema format using
json-schema.

Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
---
 .../bindings/spi/loongson,ls-spi.yaml         | 43 +++++++++++++++++++
 MAINTAINERS                                   |  6 +++
 2 files changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml

diff --git a/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
new file mode 100644
index 000000000000..ee80049b1258
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/loongson,ls-spi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Loongson SPI controller
+
+maintainers:
+  - Yinbo Zhu <zhuyinbo@loongson.cn>
+
+allOf:
+  - $ref: /schemas/spi/spi-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - loongson,ls2k-spi
+      - loongson,ls7a-spi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/loongson,ls2k-clk.h>
+    spi0: spi@1fff0220{
+        compatible = "loongson,ls2k-spi";
+        reg = <0x1fff0220 0x10>;
+        clocks = <&clk LOONGSON2_BOOT_CLK>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 25a0981c74b6..9bc2158c735d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12157,6 +12157,12 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/clock/loongson,ls2k-clk.yaml
 F:	include/dt-bindings/clock/loongson,ls2k-clk.h
 
+LOONGSON SPI DRIVER
+M:	Yinbo Zhu <zhuyinbo@loongson.cn>
+L:	linux-spi@vger.kernel.org
+S:	Maintained
+F:	Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M:	Sathya Prakash <sathya.prakash@broadcom.com>
 M:	Sreekanth Reddy <sreekanth.reddy@broadcom.com>
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
  2023-03-24  6:33 [PATCH v3 0/2] spi: loongson: add bus driver for the loongson spi Yinbo Zhu
  2023-03-24  6:33 ` [PATCH v3 1/2] dt-bindings: spi: add " Yinbo Zhu
@ 2023-03-24  6:33 ` Yinbo Zhu
  2023-03-24 10:15   ` kernel test robot
                     ` (2 more replies)
  1 sibling, 3 replies; 17+ messages in thread
From: Yinbo Zhu @ 2023-03-24  6:33 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Krzysztof Kozlowski, linux-spi,
	devicetree, linux-kernel
  Cc: Jianmin Lv, wanghongliang, Liu Peibao, loongson-kernel, Yinbo Zhu

This bus driver supports the Loongson spi hardware controller in the
Loongson platforms and supports to use DTS and PCI framework to
register spi device resources.

Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
---
 MAINTAINERS                     |   4 +
 drivers/spi/Kconfig             |  31 ++++
 drivers/spi/Makefile            |   3 +
 drivers/spi/spi-loongson-core.c | 302 ++++++++++++++++++++++++++++++++
 drivers/spi/spi-loongson-pci.c  |  89 ++++++++++
 drivers/spi/spi-loongson-plat.c |  66 +++++++
 drivers/spi/spi-loongson.h      |  41 +++++
 7 files changed, 536 insertions(+)
 create mode 100644 drivers/spi/spi-loongson-core.c
 create mode 100644 drivers/spi/spi-loongson-pci.c
 create mode 100644 drivers/spi/spi-loongson-plat.c
 create mode 100644 drivers/spi/spi-loongson.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 9bc2158c735d..f2b1ad2c785a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12162,6 +12162,10 @@ M:	Yinbo Zhu <zhuyinbo@loongson.cn>
 L:	linux-spi@vger.kernel.org
 S:	Maintained
 F:	Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
+F:	drivers/spi/spi-loongson-core.c
+F:	drivers/spi/spi-loongson-pci.c
+F:	drivers/spi/spi-loongson-plat.c
+F:	drivers/spi/spi-loongson.h
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M:	Sathya Prakash <sathya.prakash@broadcom.com>
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index cbf60b6a931c..87f87ee35d27 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -509,6 +509,37 @@ config SPI_LM70_LLP
 	  which interfaces to an LM70 temperature sensor using
 	  a parallel port.
 
+config SPI_LOONGSON_CORE
+	tristate "Loongson SPI Controller Core Driver Support"
+	depends on LOONGARCH || COMPILE_TEST
+	help
+	  This core driver supports the Loongson spi hardware controller in
+	  the Loongson platforms.
+	  Say Y or M here if you want to use the SPI controller on
+	  Loongson platform.
+
+config SPI_LOONGSON_PCI
+	tristate "Loongson SPI Controller PCI Driver Support"
+	select SPI_LOONGSON_CORE
+	depends on PCI && (LOONGARCH || COMPILE_TEST)
+	help
+	  This bus driver supports the Loongson spi hardware controller in
+	  the Loongson platforms and supports to use PCI framework to
+	  register spi device resources.
+	  Say Y or M here if you want to use the SPI controller on
+	  Loongson platform.
+
+config SPI_LOONGSON_PLATFORM
+	tristate "Loongson SPI Controller Platform Driver Support"
+	select SPI_LOONGSON_CORE
+	depends on OF && (LOONGARCH || COMPILE_TEST)
+	help
+	  This bus driver supports the Loongson spi hardware controller in
+	  the Loongson platforms and supports to use DTS framework to
+	  register spi device resources.
+	  Say Y or M here if you want to use the SPI controller on
+	  Loongson platform.
+
 config SPI_LP8841_RTC
 	tristate "ICP DAS LP-8841 SPI Controller for RTC"
 	depends on MACH_PXA27X_DT || COMPILE_TEST
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index d87cf75bee6a..a4931aa64476 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -70,6 +70,9 @@ obj-$(CONFIG_SPI_INTEL_PLATFORM)	+= spi-intel-platform.o
 obj-$(CONFIG_SPI_LANTIQ_SSC)		+= spi-lantiq-ssc.o
 obj-$(CONFIG_SPI_JCORE)			+= spi-jcore.o
 obj-$(CONFIG_SPI_LM70_LLP)		+= spi-lm70llp.o
+obj-$(CONFIG_SPI_LOONGSON_CORE)		+= spi-loongson-core.o
+obj-$(CONFIG_SPI_LOONGSON_PCI)		+= spi-loongson-pci.o
+obj-$(CONFIG_SPI_LOONGSON_PLATFORM)	+= spi-loongson-plat.o
 obj-$(CONFIG_SPI_LP8841_RTC)		+= spi-lp8841-rtc.o
 obj-$(CONFIG_SPI_MESON_SPICC)		+= spi-meson-spicc.o
 obj-$(CONFIG_SPI_MESON_SPIFC)		+= spi-meson-spifc.o
diff --git a/drivers/spi/spi-loongson-core.c b/drivers/spi/spi-loongson-core.c
new file mode 100644
index 000000000000..9c13a92c0926
--- /dev/null
+++ b/drivers/spi/spi-loongson-core.c
@@ -0,0 +1,302 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Loongson SPI Support
+// Copyright (C) 2023 Loongson Technology Corporation Limited
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/spi/spi.h>
+#include <linux/clk.h>
+
+#include "spi-loongson.h"
+
+static inline void loongson_spi_write_reg(struct loongson_spi *spi, unsigned char reg,
+					  unsigned char data)
+{
+	writeb(data, spi->base + reg);
+}
+
+static inline char loongson_spi_read_reg(struct loongson_spi *spi, unsigned char reg)
+{
+	return readb(spi->base + reg);
+}
+
+static void loongson_spi_set_cs(struct spi_device *spi, bool val)
+{
+	int cs;
+	struct loongson_spi *loongson_spi = spi_master_get_devdata(spi->master);
+
+	if (loongson_spi->mode & SPI_NO_CS)
+		loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_SFCS_REG, 0);
+	else {
+		cs = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_SFCS_REG)
+					   & ~(0x11 << spi->chip_select);
+		loongson_spi_write_reg(loongson_spi,
+				       LOONGSON_SPI_SFCS_REG,
+				       (val ? (0x11 << spi->chip_select) :
+				       (0x1 << spi->chip_select)) | cs);
+	}
+}
+
+static int loongson_spi_update_state(struct loongson_spi *loongson_spi,
+				     struct spi_device *spi, struct spi_transfer *t)
+{
+	unsigned int hz;
+	unsigned int div, div_tmp;
+	unsigned int bit;
+	unsigned char val;
+	const char rdiv[12] = {0, 1, 4, 2, 3, 5, 6, 7, 8, 9, 10, 11};
+
+	if (t)
+		hz = t->speed_hz;
+
+	if ((hz && loongson_spi->hz != hz) ||
+	    ((spi->mode ^ loongson_spi->mode) & (SPI_CPOL | SPI_CPHA))) {
+		div = DIV_ROUND_UP_ULL(loongson_spi->clk_rate, hz);
+		if (div < 2)
+			div = 2;
+		if (div > 4096)
+			div = 4096;
+
+		bit = fls(div) - 1;
+		if ((1<<bit) == div)
+			bit--;
+		div_tmp = rdiv[bit];
+		dev_dbg(&spi->dev, "clk_rate = %llu hz = %d div_tmp = %d bit = %d\n",
+			loongson_spi->clk_rate, hz, div_tmp, bit);
+
+		loongson_spi->hz = hz;
+		loongson_spi->spcr = div_tmp & 3;
+		loongson_spi->sper = (div_tmp >> 2) & 3;
+		val = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_SPCR_REG);
+		val &= ~0xc;
+		if (spi->mode & SPI_CPOL)
+			val |= 8;
+		if (spi->mode & SPI_CPHA)
+			val |= 4;
+
+		loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_SPCR_REG, (val & ~3) |
+				       loongson_spi->spcr);
+		val = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_SPER_REG);
+		loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_SPER_REG, (val & ~3) |
+				       loongson_spi->sper);
+		loongson_spi->mode &= SPI_NO_CS;
+		loongson_spi->mode |= spi->mode;
+	}
+
+	return 0;
+}
+
+static int loongson_spi_setup(struct spi_device *spi)
+{
+	struct loongson_spi *loongson_spi;
+
+	loongson_spi = spi_master_get_devdata(spi->master);
+	if (spi->bits_per_word % 8)
+		return -EINVAL;
+
+	if (spi->chip_select >= spi->master->num_chipselect)
+		return -EINVAL;
+
+	loongson_spi->hz = 0;
+	loongson_spi->mode &= SPI_NO_CS;
+	loongson_spi_set_cs(spi, 1);
+
+	return 0;
+}
+
+static int loongson_spi_write_read_8bit(struct spi_device *spi, const u8 **tx_buf,
+					u8 **rx_buf, unsigned int num)
+{
+	struct loongson_spi *loongson_spi = spi_master_get_devdata(spi->master);
+	unsigned long timeout = jiffies + SPI_COMPLETION_TIMEOUT;
+
+	if (tx_buf && *tx_buf) {
+		loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_FIFO_REG, *((*tx_buf)++));
+		while ((loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_SPSR_REG) & 0x1) == 1 &&
+			time_after(timeout, jiffies))
+			cpu_relax();
+	} else {
+		loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_FIFO_REG, 0);
+		while ((loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_SPSR_REG) & 0x1) == 1 &&
+			time_after(timeout, jiffies))
+			cpu_relax();
+	}
+
+	if (rx_buf && *rx_buf)
+		*(*rx_buf)++ = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_FIFO_REG);
+	else
+		loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_FIFO_REG);
+
+	return 0;
+}
+
+static unsigned int loongson_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
+{
+	unsigned int count;
+	const u8 *tx = xfer->tx_buf;
+	u8 *rx = xfer->rx_buf;
+
+	count = xfer->len;
+
+	do {
+		if (loongson_spi_write_read_8bit(spi, &tx, &rx, count) < 0)
+			goto out;
+		count--;
+	} while (count);
+
+out:
+	return xfer->len - count;
+}
+
+static int loongson_spi_prepare_message(struct spi_controller *ctlr, struct spi_message *m)
+{
+	struct loongson_spi *loongson_spi = spi_controller_get_devdata(ctlr);
+
+	loongson_spi->para = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_PARA_REG);
+	loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_PARA_REG, loongson_spi->para & ~1);
+
+	return 0;
+}
+
+static int loongson_spi_transfer_one(struct spi_controller *ctrl, struct spi_device *spi,
+				     struct spi_transfer *xfer)
+{
+	struct loongson_spi *loongson_spi = spi_master_get_devdata(spi->master);
+
+	loongson_spi_update_state(loongson_spi, spi, xfer);
+	if (xfer->len)
+		xfer->len = loongson_spi_write_read(spi, xfer);
+
+	return 0;
+}
+
+static int loongson_spi_unprepare_message(struct spi_controller *ctrl, struct spi_message *m)
+{
+	struct loongson_spi *loongson_spi = spi_controller_get_devdata(ctrl);
+
+	loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_PARA_REG, loongson_spi->para);
+
+	return 0;
+}
+
+static void loongson_spi_reginit(struct loongson_spi *loongson_spi_dev)
+{
+	unsigned char val;
+
+	val = loongson_spi_read_reg(loongson_spi_dev, LOONGSON_SPI_SPCR_REG);
+	val &= ~LOONGSON_SPI_SPCR_SPE;
+	loongson_spi_write_reg(loongson_spi_dev, LOONGSON_SPI_SPCR_REG, val);
+
+	loongson_spi_write_reg(loongson_spi_dev, LOONGSON_SPI_SPSR_REG,
+			       (LOONGSON_SPI_SPSR_SPIF | LOONGSON_SPI_SPSR_WCOL));
+
+	val = loongson_spi_read_reg(loongson_spi_dev, LOONGSON_SPI_SPCR_REG);
+	val |= LOONGSON_SPI_SPCR_SPE;
+	loongson_spi_write_reg(loongson_spi_dev, LOONGSON_SPI_SPCR_REG, val);
+}
+
+int loongson_spi_init_master(struct device *dev, struct resource *res)
+{
+	struct spi_master *master;
+	struct loongson_spi *spi;
+	struct clk *clk;
+	int ret;
+
+	master = spi_alloc_master(dev, sizeof(struct loongson_spi));
+	if (master == NULL) {
+		dev_dbg(dev, "master allocation failed\n");
+		return -ENOMEM;
+	}
+
+	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
+	master->setup = loongson_spi_setup;
+	master->prepare_message = loongson_spi_prepare_message;
+	master->transfer_one = loongson_spi_transfer_one;
+	master->unprepare_message = loongson_spi_unprepare_message;
+	master->set_cs = loongson_spi_set_cs;
+	master->num_chipselect = 4;
+	master->dev.of_node = of_node_get(dev->of_node);
+	dev_set_drvdata(dev, master);
+
+	spi = spi_master_get_devdata(master);
+
+	spi->master = master;
+
+	spi->base = devm_ioremap(dev, res->start, resource_size(res));
+	if (spi->base == NULL) {
+		dev_err(dev, "cannot map io\n");
+		ret = -ENXIO;
+		goto free_master;
+	}
+
+	clk = devm_clk_get(dev, NULL);
+	if (!IS_ERR(clk))
+		spi->clk_rate = clk_get_rate(clk);
+
+	loongson_spi_reginit(spi);
+
+	spi->mode = 0;
+	if (of_get_property(dev->of_node, "spi-nocs", NULL))
+		spi->mode |= SPI_NO_CS;
+
+	ret = spi_register_master(master);
+	if (ret < 0)
+		goto free_master;
+
+	return ret;
+
+free_master:
+	kfree(master);
+	spi_master_put(master);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(loongson_spi_init_master);
+
+static int __maybe_unused loongson_spi_suspend(struct device *dev)
+{
+	struct loongson_spi *loongson_spi;
+	struct spi_master *master;
+
+	master = dev_get_drvdata(dev);
+	loongson_spi = spi_master_get_devdata(master);
+
+	loongson_spi->spcr = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_SPCR_REG);
+	loongson_spi->sper = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_SPER_REG);
+	loongson_spi->spsr = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_SPSR_REG);
+	loongson_spi->para = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_PARA_REG);
+	loongson_spi->sfcs = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_SFCS_REG);
+	loongson_spi->timi = loongson_spi_read_reg(loongson_spi, LOONGSON_SPI_TIMI_REG);
+
+	return 0;
+}
+
+static int __maybe_unused loongson_spi_resume(struct device *dev)
+{
+	struct loongson_spi *loongson_spi;
+	struct spi_master *master;
+
+	master = dev_get_drvdata(dev);
+	loongson_spi = spi_master_get_devdata(master);
+
+	loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_SPCR_REG, loongson_spi->spcr);
+	loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_SPER_REG, loongson_spi->sper);
+	loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_SPSR_REG, loongson_spi->spsr);
+	loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_PARA_REG, loongson_spi->para);
+	loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_SFCS_REG, loongson_spi->sfcs);
+	loongson_spi_write_reg(loongson_spi, LOONGSON_SPI_TIMI_REG, loongson_spi->timi);
+
+	return 0;
+}
+
+const struct dev_pm_ops loongson_spi_dev_pm_ops = {
+	.suspend = loongson_spi_suspend,
+	.resume = loongson_spi_resume,
+};
+
+MODULE_DESCRIPTION("Loongson spi core driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/spi/spi-loongson-pci.c b/drivers/spi/spi-loongson-pci.c
new file mode 100644
index 000000000000..b811de769ecb
--- /dev/null
+++ b/drivers/spi/spi-loongson-pci.c
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: GPL-2.0+
+// PCI interface driver for Loongson SPI Support
+// Copyright (C) 2023 Loongson Technology Corporation Limited
+
+#include <linux/pci.h>
+
+#include "spi-loongson.h"
+
+static int loongson_spi_pci_register(struct pci_dev *pdev,
+			const struct pci_device_id *ent)
+{
+	int ret;
+	unsigned char v8;
+	struct resource res[2];
+	struct device *dev = &pdev->dev;
+
+	ret = pci_enable_device(pdev);
+	if (ret < 0) {
+		dev_err(dev, "cannot enable pci device\n");
+		goto err_out;
+	}
+
+	ret = pci_request_region(pdev, 0, "loongson-spi io");
+	if (ret < 0) {
+		dev_err(dev, "cannot request region 0.\n");
+		goto err_out;
+	}
+
+	res[0].start = pci_resource_start(pdev, 0);
+	res[0].end = pci_resource_end(pdev, 0);
+	ret = pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &v8);
+
+	if (ret == PCIBIOS_SUCCESSFUL) {
+		res[1].start = v8;
+		res[1].end = v8;
+	}
+
+	ret = loongson_spi_init_master(dev, res);
+	if (ret)
+		dev_err(dev, "failed to initialize master\n");
+
+err_out:
+	return ret;
+}
+
+static void loongson_spi_pci_unregister(struct pci_dev *pdev)
+{
+	pci_release_region(pdev, 0);
+}
+
+static struct pci_device_id loongson_spi_devices[] = {
+	{PCI_DEVICE(0x14, 0x7a0b)},
+	{PCI_DEVICE(0x14, 0x7a1b)},
+	{0, 0, 0, 0, 0, 0, 0}
+};
+MODULE_DEVICE_TABLE(pci, loongson_spi_devices);
+
+static struct pci_driver loongson_spi_pci_driver = {
+	.name       = "loongson-spi-pci",
+	.id_table   = loongson_spi_devices,
+	.probe      = loongson_spi_pci_register,
+	.remove     = loongson_spi_pci_unregister,
+	.driver	= {
+		.bus = &pci_bus_type,
+		.pm = &loongson_spi_dev_pm_ops,
+	},
+};
+
+static int __init loongson_spi_pci_init(void)
+{
+	int ret;
+
+	ret = pci_register_driver(&loongson_spi_pci_driver);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static void __exit loongson_spi_pci_exit(void)
+{
+	pci_unregister_driver(&loongson_spi_pci_driver);
+}
+
+module_init(loongson_spi_pci_init);
+module_exit(loongson_spi_pci_exit);
+
+MODULE_DESCRIPTION("Loongson spi pci driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/spi/spi-loongson-plat.c b/drivers/spi/spi-loongson-plat.c
new file mode 100644
index 000000000000..8f4aa70168f3
--- /dev/null
+++ b/drivers/spi/spi-loongson-plat.c
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Platform driver for Loongson SPI Support
+// Copyright (C) 2023 Loongson Technology Corporation Limited
+
+#include <linux/platform_device.h>
+#include <linux/of.h>
+
+#include "spi-loongson.h"
+
+static int loongson_spi_platform_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct resource *res;
+	int ret;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (res == NULL) {
+		dev_err(dev, "cannot get io resource memory\n");
+		return -ENOENT;
+	}
+
+	ret = loongson_spi_init_master(dev, res);
+	if (ret)
+		dev_err(dev, "failed to initialize master\n");
+
+	return ret;
+}
+
+static const struct of_device_id loongson_spi_id_table[] = {
+	{ .compatible = "loongson,ls2k-spi", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, loongson_spi_id_table);
+
+static struct platform_driver loongson_spi_plat_driver = {
+	.probe = loongson_spi_platform_probe,
+	.driver	= {
+		.name	= "loongson-spi",
+		.owner	= THIS_MODULE,
+		.bus = &platform_bus_type,
+		.pm = &loongson_spi_dev_pm_ops,
+		.of_match_table = loongson_spi_id_table,
+	},
+};
+
+static int __init loongson_spi_plat_init(void)
+{
+	int ret;
+
+	ret = platform_driver_register(&loongson_spi_plat_driver);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static void __exit loongson_spi_plat_exit(void)
+{
+	platform_driver_unregister(&loongson_spi_plat_driver);
+}
+
+module_init(loongson_spi_plat_init);
+module_exit(loongson_spi_plat_exit);
+
+MODULE_DESCRIPTION("Loongson spi platform driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/spi/spi-loongson.h b/drivers/spi/spi-loongson.h
new file mode 100644
index 000000000000..44818340188d
--- /dev/null
+++ b/drivers/spi/spi-loongson.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/* Header File for Loongson SPI Driver. */
+/* Copyright (C) 2023 Loongson Technology Corporation Limited */
+
+#ifndef __LINUX_SPI_LOONGSON_H
+#define __LINUX_SPI_LOONGSON_H
+
+#define	LOONGSON_SPI_SPCR_REG	0x00
+#define	LOONGSON_SPI_SPSR_REG	0x01
+#define	LOONGSON_SPI_FIFO_REG	0x02
+#define	LOONGSON_SPI_SPER_REG	0x03
+#define	LOONGSON_SPI_PARA_REG	0x04
+#define	LOONGSON_SPI_SFCS_REG	0x05
+#define	LOONGSON_SPI_TIMI_REG	0x06
+
+/* Bits definition for Loongson SPI register */
+#define	LOONGSON_SPI_PARA_MEM_EN	BIT(0)
+#define	LOONGSON_SPI_SPSR_SPIF	BIT(7)
+#define	LOONGSON_SPI_SPSR_WCOL	BIT(6)
+#define	LOONGSON_SPI_SPCR_SPE	BIT(6)
+
+#define SPI_COMPLETION_TIMEOUT	msecs_to_jiffies(2000)
+
+struct loongson_spi {
+	struct	spi_master	*master;
+	void __iomem		*base;
+	int			cs_active;
+	unsigned int		hz;
+	unsigned char		spcr;
+	unsigned char		sper;
+	unsigned char		spsr;
+	unsigned char		para;
+	unsigned char		sfcs;
+	unsigned char		timi;
+	unsigned int		mode;
+	u64			clk_rate;
+};
+
+extern int loongson_spi_init_master(struct device *dev, struct resource *res);
+extern const struct dev_pm_ops loongson_spi_dev_pm_ops;
+#endif /* __LINUX_SPI_LOONGSON_H */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: spi: add loongson spi
  2023-03-24  6:33 ` [PATCH v3 1/2] dt-bindings: spi: add " Yinbo Zhu
@ 2023-03-24  6:36   ` zhuyinbo
  2023-03-24 19:09     ` Rob Herring
  2023-03-24 13:07   ` Rob Herring
  1 sibling, 1 reply; 17+ messages in thread
From: zhuyinbo @ 2023-03-24  6:36 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Krzysztof Kozlowski, linux-spi,
	devicetree, linux-kernel
  Cc: Jianmin Lv, wanghongliang, Liu Peibao, loongson-kernel

This patch need depend on 
https://lore.kernel.org/all/20230323025229.2971-1-zhuyinbo@loongson.cn/ .


在 2023/3/24 下午2:33, Yinbo Zhu 写道:
> Add the Loongson platform spi binding with DT schema format using
> json-schema.
>
> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
> ---
>   .../bindings/spi/loongson,ls-spi.yaml         | 43 +++++++++++++++++++
>   MAINTAINERS                                   |  6 +++
>   2 files changed, 49 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>
> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
> new file mode 100644
> index 000000000000..ee80049b1258
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
> @@ -0,0 +1,43 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/spi/loongson,ls-spi.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Loongson SPI controller
> +
> +maintainers:
> +  - Yinbo Zhu <zhuyinbo@loongson.cn>
> +
> +allOf:
> +  - $ref: /schemas/spi/spi-controller.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - loongson,ls2k-spi
> +      - loongson,ls7a-spi
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/loongson,ls2k-clk.h>
> +    spi0: spi@1fff0220{
> +        compatible = "loongson,ls2k-spi";
> +        reg = <0x1fff0220 0x10>;
> +        clocks = <&clk LOONGSON2_BOOT_CLK>;
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 25a0981c74b6..9bc2158c735d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -12157,6 +12157,12 @@ S:	Maintained
>   F:	Documentation/devicetree/bindings/clock/loongson,ls2k-clk.yaml
>   F:	include/dt-bindings/clock/loongson,ls2k-clk.h
>   
> +LOONGSON SPI DRIVER
> +M:	Yinbo Zhu <zhuyinbo@loongson.cn>
> +L:	linux-spi@vger.kernel.org
> +S:	Maintained
> +F:	Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
> +
>   LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
>   M:	Sathya Prakash <sathya.prakash@broadcom.com>
>   M:	Sreekanth Reddy <sreekanth.reddy@broadcom.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
  2023-03-24  6:33 ` [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller Yinbo Zhu
@ 2023-03-24 10:15   ` kernel test robot
  2023-03-27  8:24     ` zhuyinbo
  2023-03-24 11:31   ` Krzysztof Kozlowski
  2023-03-24 21:53   ` kernel test robot
  2 siblings, 1 reply; 17+ messages in thread
From: kernel test robot @ 2023-03-24 10:15 UTC (permalink / raw)
  To: Yinbo Zhu, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	linux-spi, devicetree, linux-kernel
  Cc: oe-kbuild-all, Jianmin Lv, wanghongliang, Liu Peibao,
	loongson-kernel, Yinbo Zhu

Hi Yinbo,

I love your patch! Yet something to improve:

[auto build test ERROR on broonie-spi/for-next]
[also build test ERROR on robh/for-next krzk-dt/for-next linus/master v6.3-rc3 next-20230324]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yinbo-Zhu/dt-bindings-spi-add-loongson-spi/20230324-143432
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
patch link:    https://lore.kernel.org/r/20230324063317.14664-3-zhuyinbo%40loongson.cn
patch subject: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230324/202303241811.OXj9KxAr-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/3742622c455d25c4a110d2caf2f5b2ceefe88f91
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yinbo-Zhu/dt-bindings-spi-add-loongson-spi/20230324-143432
        git checkout 3742622c455d25c4a110d2caf2f5b2ceefe88f91
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303241811.OXj9KxAr-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   drivers/spi/spi-loongson-core.c: In function 'loongson_spi_init_master':
>> drivers/spi/spi-loongson-core.c:229:21: error: implicit declaration of function 'devm_ioremap'; did you mean 'of_ioremap'? [-Werror=implicit-function-declaration]
     229 |         spi->base = devm_ioremap(dev, res->start, resource_size(res));
         |                     ^~~~~~~~~~~~
         |                     of_ioremap
>> drivers/spi/spi-loongson-core.c:229:19: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     229 |         spi->base = devm_ioremap(dev, res->start, resource_size(res));
         |                   ^
   cc1: some warnings being treated as errors


vim +229 drivers/spi/spi-loongson-core.c

   201	
   202	int loongson_spi_init_master(struct device *dev, struct resource *res)
   203	{
   204		struct spi_master *master;
   205		struct loongson_spi *spi;
   206		struct clk *clk;
   207		int ret;
   208	
   209		master = spi_alloc_master(dev, sizeof(struct loongson_spi));
   210		if (master == NULL) {
   211			dev_dbg(dev, "master allocation failed\n");
   212			return -ENOMEM;
   213		}
   214	
   215		master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
   216		master->setup = loongson_spi_setup;
   217		master->prepare_message = loongson_spi_prepare_message;
   218		master->transfer_one = loongson_spi_transfer_one;
   219		master->unprepare_message = loongson_spi_unprepare_message;
   220		master->set_cs = loongson_spi_set_cs;
   221		master->num_chipselect = 4;
   222		master->dev.of_node = of_node_get(dev->of_node);
   223		dev_set_drvdata(dev, master);
   224	
   225		spi = spi_master_get_devdata(master);
   226	
   227		spi->master = master;
   228	
 > 229		spi->base = devm_ioremap(dev, res->start, resource_size(res));
   230		if (spi->base == NULL) {
   231			dev_err(dev, "cannot map io\n");
   232			ret = -ENXIO;
   233			goto free_master;
   234		}
   235	
   236		clk = devm_clk_get(dev, NULL);
   237		if (!IS_ERR(clk))
   238			spi->clk_rate = clk_get_rate(clk);
   239	
   240		loongson_spi_reginit(spi);
   241	
   242		spi->mode = 0;
   243		if (of_get_property(dev->of_node, "spi-nocs", NULL))
   244			spi->mode |= SPI_NO_CS;
   245	
   246		ret = spi_register_master(master);
   247		if (ret < 0)
   248			goto free_master;
   249	
   250		return ret;
   251	
   252	free_master:
   253		kfree(master);
   254		spi_master_put(master);
   255	
   256		return ret;
   257	}
   258	EXPORT_SYMBOL_GPL(loongson_spi_init_master);
   259	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
  2023-03-24  6:33 ` [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller Yinbo Zhu
  2023-03-24 10:15   ` kernel test robot
@ 2023-03-24 11:31   ` Krzysztof Kozlowski
  2023-03-27  8:42     ` zhuyinbo
  2023-03-24 21:53   ` kernel test robot
  2 siblings, 1 reply; 17+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-24 11:31 UTC (permalink / raw)
  To: Yinbo Zhu, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	linux-spi, devicetree, linux-kernel
  Cc: Jianmin Lv, wanghongliang, Liu Peibao, loongson-kernel

On 24/03/2023 07:33, Yinbo Zhu wrote:
> This bus driver supports the Loongson spi hardware controller in the
> Loongson platforms and supports to use DTS and PCI framework to
> register spi device resources.
> 
> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
> ---
>  MAINTAINERS                     |   4 +
>  drivers/spi/Kconfig             |  31 ++++
>  drivers/spi/Makefile            |   3 +
>  drivers/spi/spi-loongson-core.c | 302 ++++++++++++++++++++++++++++++++
>  drivers/spi/spi-loongson-pci.c  |  89 ++++++++++
>  drivers/spi/spi-loongson-plat.c |  66 +++++++
>  drivers/spi/spi-loongson.h      |  41 +++++
>  7 files changed, 536 insertions(+)
>  create mode 100644 drivers/spi/spi-loongson-core.c
>  create mode 100644 drivers/spi/spi-loongson-pci.c
>  create mode 100644 drivers/spi/spi-loongson-plat.c
>  create mode 100644 drivers/spi/spi-loongson.h

Your patches still have build warnings. Are these false postives or you
forgot to build it? Anyway, please respond to the report.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: spi: add loongson spi
  2023-03-24  6:33 ` [PATCH v3 1/2] dt-bindings: spi: add " Yinbo Zhu
  2023-03-24  6:36   ` zhuyinbo
@ 2023-03-24 13:07   ` Rob Herring
  2023-03-27  8:39     ` zhuyinbo
  1 sibling, 1 reply; 17+ messages in thread
From: Rob Herring @ 2023-03-24 13:07 UTC (permalink / raw)
  To: Yinbo Zhu
  Cc: Mark Brown, loongson-kernel, wanghongliang, Liu Peibao,
	linux-spi, devicetree, Jianmin Lv, linux-kernel,
	Krzysztof Kozlowski, Rob Herring


On Fri, 24 Mar 2023 14:33:16 +0800, Yinbo Zhu wrote:
> Add the Loongson platform spi binding with DT schema format using
> json-schema.
> 
> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
> ---
>  .../bindings/spi/loongson,ls-spi.yaml         | 43 +++++++++++++++++++
>  MAINTAINERS                                   |  6 +++
>  2 files changed, 49 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dts:22.28-29 syntax error
FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dtb] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1512: dt_binding_check] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230324063317.14664-2-zhuyinbo@loongson.cn

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: spi: add loongson spi
  2023-03-24  6:36   ` zhuyinbo
@ 2023-03-24 19:09     ` Rob Herring
  0 siblings, 0 replies; 17+ messages in thread
From: Rob Herring @ 2023-03-24 19:09 UTC (permalink / raw)
  To: zhuyinbo
  Cc: Mark Brown, Krzysztof Kozlowski, linux-spi, devicetree,
	linux-kernel, Jianmin Lv, wanghongliang, Liu Peibao,
	loongson-kernel

On Fri, Mar 24, 2023 at 02:36:17PM +0800, zhuyinbo wrote:
> This patch need depend on
> https://lore.kernel.org/all/20230323025229.2971-1-zhuyinbo@loongson.cn/ .

It's best to remove that dependency if you want to merge both in the 
same cycle.

Rob

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
  2023-03-24  6:33 ` [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller Yinbo Zhu
  2023-03-24 10:15   ` kernel test robot
  2023-03-24 11:31   ` Krzysztof Kozlowski
@ 2023-03-24 21:53   ` kernel test robot
  2023-03-27  7:47     ` zhuyinbo
  2 siblings, 1 reply; 17+ messages in thread
From: kernel test robot @ 2023-03-24 21:53 UTC (permalink / raw)
  To: Yinbo Zhu, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	linux-spi, devicetree, linux-kernel
  Cc: oe-kbuild-all, Jianmin Lv, wanghongliang, Liu Peibao,
	loongson-kernel, Yinbo Zhu

Hi Yinbo,

I love your patch! Yet something to improve:

[auto build test ERROR on broonie-spi/for-next]
[also build test ERROR on robh/for-next krzk-dt/for-next linus/master v6.3-rc3 next-20230324]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yinbo-Zhu/dt-bindings-spi-add-loongson-spi/20230324-143432
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
patch link:    https://lore.kernel.org/r/20230324063317.14664-3-zhuyinbo%40loongson.cn
patch subject: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20230325/202303250536.OV1LR58y-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/3742622c455d25c4a110d2caf2f5b2ceefe88f91
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yinbo-Zhu/dt-bindings-spi-add-loongson-spi/20230324-143432
        git checkout 3742622c455d25c4a110d2caf2f5b2ceefe88f91
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303250536.OV1LR58y-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "loongson_spi_dev_pm_ops" [drivers/spi/spi-loongson-pci.ko] undefined!
>> ERROR: modpost: "loongson_spi_dev_pm_ops" [drivers/spi/spi-loongson-plat.ko] undefined!

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
  2023-03-24 21:53   ` kernel test robot
@ 2023-03-27  7:47     ` zhuyinbo
  0 siblings, 0 replies; 17+ messages in thread
From: zhuyinbo @ 2023-03-27  7:47 UTC (permalink / raw)
  To: kernel test robot, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	linux-spi, devicetree, linux-kernel
  Cc: oe-kbuild-all, Jianmin Lv, wanghongliang, Liu Peibao,
	loongson-kernel, zhuyinbo



在 2023/3/25 上午5:53, kernel test robot 写道:
> Hi Yinbo,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on broonie-spi/for-next]
> [also build test ERROR on robh/for-next krzk-dt/for-next linus/master v6.3-rc3 next-20230324]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Yinbo-Zhu/dt-bindings-spi-add-loongson-spi/20230324-143432
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
> patch link:    https://lore.kernel.org/r/20230324063317.14664-3-zhuyinbo%40loongson.cn
> patch subject: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
> config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20230325/202303250536.OV1LR58y-lkp@intel.com/config)
> compiler: powerpc-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # https://github.com/intel-lab-lkp/linux/commit/3742622c455d25c4a110d2caf2f5b2ceefe88f91
>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>          git fetch --no-tags linux-review Yinbo-Zhu/dt-bindings-spi-add-loongson-spi/20230324-143432
>          git checkout 3742622c455d25c4a110d2caf2f5b2ceefe88f91
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Link: https://lore.kernel.org/oe-kbuild-all/202303250536.OV1LR58y-lkp@intel.com/
> 
> All errors (new ones prefixed by >>, old ones prefixed by <<):
> 
>>> ERROR: modpost: "loongson_spi_dev_pm_ops" [drivers/spi/spi-loongson-pci.ko] undefined!
>>> ERROR: modpost: "loongson_spi_dev_pm_ops" [drivers/spi/spi-loongson-plat.ko] undefined!
> 
This compile issue when spi config was set as module then 
"loongson_spi_dev_pm_ops undefined" will occur, but if set spi config as 
built-in and not this issue, and my patch was tested that use spi config 
built-in so not this error occur,  and this compile fail issue's reason 
was "loongson_spi_dev_pm_ops" not use EXPORT_SYMBOL_GPL to export, I 
will add following change to fix this compile error issue.

--- a/drivers/spi/spi-loongson-core.c
+++ b/drivers/spi/spi-loongson-core.c
@@ -297,6 +297,7 @@ const struct dev_pm_ops loongson_spi_dev_pm_ops = {
         .suspend = loongson_spi_suspend,
         .resume = loongson_spi_resume,
  };
+EXPORT_SYMBOL_GPL(loongson_spi_dev_pm_ops);


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
  2023-03-24 10:15   ` kernel test robot
@ 2023-03-27  8:24     ` zhuyinbo
  0 siblings, 0 replies; 17+ messages in thread
From: zhuyinbo @ 2023-03-27  8:24 UTC (permalink / raw)
  To: kernel test robot, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	linux-spi, devicetree, linux-kernel
  Cc: oe-kbuild-all, Jianmin Lv, wanghongliang, Liu Peibao,
	loongson-kernel, zhuyinbo



在 2023/3/24 下午6:15, kernel test robot 写道:
> Hi Yinbo,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on broonie-spi/for-next]
> [also build test ERROR on robh/for-next krzk-dt/for-next linus/master v6.3-rc3 next-20230324]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Yinbo-Zhu/dt-bindings-spi-add-loongson-spi/20230324-143432
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
> patch link:    https://lore.kernel.org/r/20230324063317.14664-3-zhuyinbo%40loongson.cn
> patch subject: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
> config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230324/202303241811.OXj9KxAr-lkp@intel.com/config)
> compiler: sparc64-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # https://github.com/intel-lab-lkp/linux/commit/3742622c455d25c4a110d2caf2f5b2ceefe88f91
>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>          git fetch --no-tags linux-review Yinbo-Zhu/dt-bindings-spi-add-loongson-spi/20230324-143432
>          git checkout 3742622c455d25c4a110d2caf2f5b2ceefe88f91
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Link: https://lore.kernel.org/oe-kbuild-all/202303241811.OXj9KxAr-lkp@intel.com/
> 
> All error/warnings (new ones prefixed by >>):
> 
>     drivers/spi/spi-loongson-core.c: In function 'loongson_spi_init_master':
>>> drivers/spi/spi-loongson-core.c:229:21: error: implicit declaration of function 'devm_ioremap'; did you mean 'of_ioremap'? [-Werror=implicit-function-declaration]
>       229 |         spi->base = devm_ioremap(dev, res->start, resource_size(res));
>           |                     ^~~~~~~~~~~~
>           |                     of_ioremap
>>> drivers/spi/spi-loongson-core.c:229:19: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>       229 |         spi->base = devm_ioremap(dev, res->start, resource_size(res));
>           |                   ^
>     cc1: some warnings being treated as errorThe devm_ioremap was declared in linux/io.h, and I think add include 
<linux/io.h> in spi-loongson-core.c that compile issue will be fixed.
> 
> 
> vim +229 drivers/spi/spi-loongson-core.c
> 
>     201	
>     202	int loongson_spi_init_master(struct device *dev, struct resource *res)
>     203	{
>     204		struct spi_master *master;
>     205		struct loongson_spi *spi;
>     206		struct clk *clk;
>     207		int ret;
>     208	
>     209		master = spi_alloc_master(dev, sizeof(struct loongson_spi));
>     210		if (master == NULL) {
>     211			dev_dbg(dev, "master allocation failed\n");
>     212			return -ENOMEM;
>     213		}
>     214	
>     215		master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
>     216		master->setup = loongson_spi_setup;
>     217		master->prepare_message = loongson_spi_prepare_message;
>     218		master->transfer_one = loongson_spi_transfer_one;
>     219		master->unprepare_message = loongson_spi_unprepare_message;
>     220		master->set_cs = loongson_spi_set_cs;
>     221		master->num_chipselect = 4;
>     222		master->dev.of_node = of_node_get(dev->of_node);
>     223		dev_set_drvdata(dev, master);
>     224	
>     225		spi = spi_master_get_devdata(master);
>     226	
>     227		spi->master = master;
>     228	
>   > 229		spi->base = devm_ioremap(dev, res->start, resource_size(res));
>     230		if (spi->base == NULL) {
>     231			dev_err(dev, "cannot map io\n");
>     232			ret = -ENXIO;
>     233			goto free_master;
>     234		}
>     235	
>     236		clk = devm_clk_get(dev, NULL);
>     237		if (!IS_ERR(clk))
>     238			spi->clk_rate = clk_get_rate(clk);
>     239	
>     240		loongson_spi_reginit(spi);
>     241	
>     242		spi->mode = 0;
>     243		if (of_get_property(dev->of_node, "spi-nocs", NULL))
>     244			spi->mode |= SPI_NO_CS;
>     245	
>     246		ret = spi_register_master(master);
>     247		if (ret < 0)
>     248			goto free_master;
>     249	
>     250		return ret;
>     251	
>     252	free_master:
>     253		kfree(master);
>     254		spi_master_put(master);
>     255	
>     256		return ret;
>     257	}
>     258	EXPORT_SYMBOL_GPL(loongson_spi_init_master);
>     259	
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: spi: add loongson spi
  2023-03-24 13:07   ` Rob Herring
@ 2023-03-27  8:39     ` zhuyinbo
  2023-03-27  8:52       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 17+ messages in thread
From: zhuyinbo @ 2023-03-27  8:39 UTC (permalink / raw)
  To: Rob Herring
  Cc: Mark Brown, loongson-kernel, wanghongliang, Liu Peibao,
	linux-spi, devicetree, Jianmin Lv, linux-kernel,
	Krzysztof Kozlowski, Rob Herring, zhuyinbo



在 2023/3/24 下午9:07, Rob Herring 写道:
> 
> On Fri, 24 Mar 2023 14:33:16 +0800, Yinbo Zhu wrote:
>> Add the Loongson platform spi binding with DT schema format using
>> json-schema.
>>
>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>> ---
>>   .../bindings/spi/loongson,ls-spi.yaml         | 43 +++++++++++++++++++
>>   MAINTAINERS                                   |  6 +++
>>   2 files changed, 49 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>
> 
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> Error: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dts:22.28-29 syntax error
> FATAL ERROR: Unable to parse input tree
> make[1]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dtb] Error 1
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:1512: dt_binding_check] Error 2
Hi Rob Herring,

This error was still appears on 22 line, this line was 
LOONGSON2_BOOT_CLK not refer, it need depend on 
https://lore.kernel.org/all/20230323025229.2971-1-zhuyinbo@loongson.cn/ 
then compile will be successful. and I had added this depend on 
description in v2, v3 patch changelog, I was also send a email to remind 
your bot for the test my patch need dpend on other clock patch.
> 
> doc reference errors (make refcheckdocs):
> 
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230324063317.14664-2-zhuyinbo@loongson.cn
> 
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit after running the above command yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
  2023-03-24 11:31   ` Krzysztof Kozlowski
@ 2023-03-27  8:42     ` zhuyinbo
  2023-03-27  8:53       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 17+ messages in thread
From: zhuyinbo @ 2023-03-27  8:42 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Rob Herring,
	Krzysztof Kozlowski, linux-spi, devicetree, linux-kernel
  Cc: Jianmin Lv, wanghongliang, Liu Peibao, loongson-kernel, zhuyinbo



在 2023/3/24 下午7:31, Krzysztof Kozlowski 写道:
> On 24/03/2023 07:33, Yinbo Zhu wrote:
>> This bus driver supports the Loongson spi hardware controller in the
>> Loongson platforms and supports to use DTS and PCI framework to
>> register spi device resources.
>>
>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>> ---
>>   MAINTAINERS                     |   4 +
>>   drivers/spi/Kconfig             |  31 ++++
>>   drivers/spi/Makefile            |   3 +
>>   drivers/spi/spi-loongson-core.c | 302 ++++++++++++++++++++++++++++++++
>>   drivers/spi/spi-loongson-pci.c  |  89 ++++++++++
>>   drivers/spi/spi-loongson-plat.c |  66 +++++++
>>   drivers/spi/spi-loongson.h      |  41 +++++
>>   7 files changed, 536 insertions(+)
>>   create mode 100644 drivers/spi/spi-loongson-core.c
>>   create mode 100644 drivers/spi/spi-loongson-pci.c
>>   create mode 100644 drivers/spi/spi-loongson-plat.c
>>   create mode 100644 drivers/spi/spi-loongson.h
> 
> Your patches still have build warnings. Are these false postives or you
> forgot to build it? Anyway, please respond to the report.
> 
> Best regards,
> Krzysztof
thanks your reminder, I have already provided feedback about compile issue.
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: spi: add loongson spi
  2023-03-27  8:39     ` zhuyinbo
@ 2023-03-27  8:52       ` Krzysztof Kozlowski
  2023-03-27  9:11         ` zhuyinbo
  0 siblings, 1 reply; 17+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-27  8:52 UTC (permalink / raw)
  To: zhuyinbo, Rob Herring
  Cc: Mark Brown, loongson-kernel, wanghongliang, Liu Peibao,
	linux-spi, devicetree, Jianmin Lv, linux-kernel,
	Krzysztof Kozlowski, Rob Herring

On 27/03/2023 10:39, zhuyinbo wrote:
> 
> 
> 在 2023/3/24 下午9:07, Rob Herring 写道:
>>
>> On Fri, 24 Mar 2023 14:33:16 +0800, Yinbo Zhu wrote:
>>> Add the Loongson platform spi binding with DT schema format using
>>> json-schema.
>>>
>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>> ---
>>>   .../bindings/spi/loongson,ls-spi.yaml         | 43 +++++++++++++++++++
>>>   MAINTAINERS                                   |  6 +++
>>>   2 files changed, 49 insertions(+)
>>>   create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>>
>>
>> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
>> on your patch (DT_CHECKER_FLAGS is new in v5.13):
>>
>> yamllint warnings/errors:
>>
>> dtschema/dtc warnings/errors:
>> Error: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dts:22.28-29 syntax error
>> FATAL ERROR: Unable to parse input tree
>> make[1]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dtb] Error 1
>> make[1]: *** Waiting for unfinished jobs....
>> make: *** [Makefile:1512: dt_binding_check] Error 2
> Hi Rob Herring,
> 
> This error was still appears on 22 line, this line was 
> LOONGSON2_BOOT_CLK not refer, it need depend on 
> https://lore.kernel.org/all/20230323025229.2971-1-zhuyinbo@loongson.cn/ 
> then compile will be successful. and I had added this depend on 
> description in v2, v3 patch changelog, I was also send a email to remind 
> your bot for the test my patch need dpend on other clock patch.

... and did you read Rob's advice? For some reason you responded to
automated bot's email, but not to actual email from Rob.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
  2023-03-27  8:42     ` zhuyinbo
@ 2023-03-27  8:53       ` Krzysztof Kozlowski
  2023-03-28  3:25         ` zhuyinbo
  0 siblings, 1 reply; 17+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-27  8:53 UTC (permalink / raw)
  To: zhuyinbo, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	linux-spi, devicetree, linux-kernel
  Cc: Jianmin Lv, wanghongliang, Liu Peibao, loongson-kernel

On 27/03/2023 10:42, zhuyinbo wrote:
> 
> 
> 在 2023/3/24 下午7:31, Krzysztof Kozlowski 写道:
>> On 24/03/2023 07:33, Yinbo Zhu wrote:
>>> This bus driver supports the Loongson spi hardware controller in the
>>> Loongson platforms and supports to use DTS and PCI framework to
>>> register spi device resources.
>>>
>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>> ---
>>>   MAINTAINERS                     |   4 +
>>>   drivers/spi/Kconfig             |  31 ++++
>>>   drivers/spi/Makefile            |   3 +
>>>   drivers/spi/spi-loongson-core.c | 302 ++++++++++++++++++++++++++++++++
>>>   drivers/spi/spi-loongson-pci.c  |  89 ++++++++++
>>>   drivers/spi/spi-loongson-plat.c |  66 +++++++
>>>   drivers/spi/spi-loongson.h      |  41 +++++
>>>   7 files changed, 536 insertions(+)
>>>   create mode 100644 drivers/spi/spi-loongson-core.c
>>>   create mode 100644 drivers/spi/spi-loongson-pci.c
>>>   create mode 100644 drivers/spi/spi-loongson-plat.c
>>>   create mode 100644 drivers/spi/spi-loongson.h
>>
>> Your patches still have build warnings. Are these false postives or you
>> forgot to build it? Anyway, please respond to the report.
>>
>> Best regards,
>> Krzysztof
> thanks your reminder, I have already provided feedback about compile issue.

Then please test your patches before sending...

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: spi: add loongson spi
  2023-03-27  8:52       ` Krzysztof Kozlowski
@ 2023-03-27  9:11         ` zhuyinbo
  0 siblings, 0 replies; 17+ messages in thread
From: zhuyinbo @ 2023-03-27  9:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring
  Cc: Mark Brown, loongson-kernel, wanghongliang, Liu Peibao,
	linux-spi, devicetree, Jianmin Lv, linux-kernel,
	Krzysztof Kozlowski, Rob Herring, zhuyinbo



在 2023/3/27 下午4:52, Krzysztof Kozlowski 写道:
> On 27/03/2023 10:39, zhuyinbo wrote:
>>
>>
>> 在 2023/3/24 下午9:07, Rob Herring 写道:
>>>
>>> On Fri, 24 Mar 2023 14:33:16 +0800, Yinbo Zhu wrote:
>>>> Add the Loongson platform spi binding with DT schema format using
>>>> json-schema.
>>>>
>>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>>> ---
>>>>    .../bindings/spi/loongson,ls-spi.yaml         | 43 +++++++++++++++++++
>>>>    MAINTAINERS                                   |  6 +++
>>>>    2 files changed, 49 insertions(+)
>>>>    create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>>>
>>>
>>> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
>>> on your patch (DT_CHECKER_FLAGS is new in v5.13):
>>>
>>> yamllint warnings/errors:
>>>
>>> dtschema/dtc warnings/errors:
>>> Error: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dts:22.28-29 syntax error
>>> FATAL ERROR: Unable to parse input tree
>>> make[1]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dtb] Error 1
>>> make[1]: *** Waiting for unfinished jobs....
>>> make: *** [Makefile:1512: dt_binding_check] Error 2
>> Hi Rob Herring,
>>
>> This error was still appears on 22 line, this line was
>> LOONGSON2_BOOT_CLK not refer, it need depend on
>> https://lore.kernel.org/all/20230323025229.2971-1-zhuyinbo@loongson.cn/
>> then compile will be successful. and I had added this depend on
>> description in v2, v3 patch changelog, I was also send a email to remind
>> your bot for the test my patch need dpend on other clock patch.
> 
> ... and did you read Rob's advice?yes
For some reason you responded to
> automated bot's email, but not to actual email from Rob.
okay, I got it.
> 
> Best regards,
> Krzysztof
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller
  2023-03-27  8:53       ` Krzysztof Kozlowski
@ 2023-03-28  3:25         ` zhuyinbo
  0 siblings, 0 replies; 17+ messages in thread
From: zhuyinbo @ 2023-03-28  3:25 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Rob Herring,
	Krzysztof Kozlowski, linux-spi, devicetree, linux-kernel
  Cc: Jianmin Lv, wanghongliang, Liu Peibao, loongson-kernel, zhuyinbo



在 2023/3/27 下午4:53, Krzysztof Kozlowski 写道:
> On 27/03/2023 10:42, zhuyinbo wrote:
>>
>>
>> 在 2023/3/24 下午7:31, Krzysztof Kozlowski 写道:
>>> On 24/03/2023 07:33, Yinbo Zhu wrote:
>>>> This bus driver supports the Loongson spi hardware controller in the
>>>> Loongson platforms and supports to use DTS and PCI framework to
>>>> register spi device resources.
>>>>
>>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>>> ---
>>>>    MAINTAINERS                     |   4 +
>>>>    drivers/spi/Kconfig             |  31 ++++
>>>>    drivers/spi/Makefile            |   3 +
>>>>    drivers/spi/spi-loongson-core.c | 302 ++++++++++++++++++++++++++++++++
>>>>    drivers/spi/spi-loongson-pci.c  |  89 ++++++++++
>>>>    drivers/spi/spi-loongson-plat.c |  66 +++++++
>>>>    drivers/spi/spi-loongson.h      |  41 +++++
>>>>    7 files changed, 536 insertions(+)
>>>>    create mode 100644 drivers/spi/spi-loongson-core.c
>>>>    create mode 100644 drivers/spi/spi-loongson-pci.c
>>>>    create mode 100644 drivers/spi/spi-loongson-plat.c
>>>>    create mode 100644 drivers/spi/spi-loongson.h
>>>
>>> Your patches still have build warnings. Are these false postives or you
>>> forgot to build it? Anyway, please respond to the report.
>>>
>>> Best regards,
>>> Krzysztof
>> thanks your reminder, I have already provided feedback about compile issue.
> 
> Then please test your patches before sending...
That's for sure, I tested it on LoongArch platform.
> 
> Best regards,
> Krzysztof
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-03-28  3:25 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24  6:33 [PATCH v3 0/2] spi: loongson: add bus driver for the loongson spi Yinbo Zhu
2023-03-24  6:33 ` [PATCH v3 1/2] dt-bindings: spi: add " Yinbo Zhu
2023-03-24  6:36   ` zhuyinbo
2023-03-24 19:09     ` Rob Herring
2023-03-24 13:07   ` Rob Herring
2023-03-27  8:39     ` zhuyinbo
2023-03-27  8:52       ` Krzysztof Kozlowski
2023-03-27  9:11         ` zhuyinbo
2023-03-24  6:33 ` [PATCH v3 2/2] spi: loongson: add bus driver for the loongson spi controller Yinbo Zhu
2023-03-24 10:15   ` kernel test robot
2023-03-27  8:24     ` zhuyinbo
2023-03-24 11:31   ` Krzysztof Kozlowski
2023-03-27  8:42     ` zhuyinbo
2023-03-27  8:53       ` Krzysztof Kozlowski
2023-03-28  3:25         ` zhuyinbo
2023-03-24 21:53   ` kernel test robot
2023-03-27  7:47     ` zhuyinbo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).