Linux-SPI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/4] Add Mediatek MT8195 SPI driver support
@ 2021-03-22  5:52 Leilk Liu
  2021-03-22  5:52 ` [PATCH 1/4] spi: update spi master bindings for MT8195 SoC Leilk Liu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Leilk Liu @ 2021-03-22  5:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: Mark Rutland, Matthias Brugger, devicetree, linux-kernel,
	linux-arm-kernel, linux-spi, linux-mediatek, fparent

This series are based on spi/for-next, and provide 4 patches to add MT8195 spi support.

Leilk Liu (4):
  spi: update spi master bindings for MT8195 SoC
  spi: update spi slave bindings for MT8195 SoC
  spi: mediatek: add mtk_spi_compatible support
  spi: mediatek: add mt8195 spi slave support

 .../devicetree/bindings/spi/spi-mt65xx.txt    |  1 +
 .../bindings/spi/spi-slave-mt27xx.txt         |  1 +
 drivers/spi/spi-slave-mt27xx.c                | 36 ++++++++++++++++---
 3 files changed, 34 insertions(+), 4 deletions(-)

-- 
2.25.1



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

* [PATCH 1/4] spi: update spi master bindings for MT8195 SoC
  2021-03-22  5:52 [PATCH 0/4] Add Mediatek MT8195 SPI driver support Leilk Liu
@ 2021-03-22  5:52 ` Leilk Liu
  2021-03-22  5:52 ` [PATCH 2/4] spi: update spi slave " Leilk Liu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Leilk Liu @ 2021-03-22  5:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: Mark Rutland, Matthias Brugger, devicetree, linux-kernel,
	linux-arm-kernel, linux-spi, linux-mediatek, fparent, Leilk Liu

Add a DT binding documentation for the MT8195 soc.

Signed-off-by: leilk.liu <leilk.liu@mediatek.com>
---
 Documentation/devicetree/bindings/spi/spi-mt65xx.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
index 7bae7eef26c7..4d0e4c15c4ea 100644
--- a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
+++ b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
@@ -12,6 +12,7 @@ Required properties:
     - mediatek,mt8173-spi: for mt8173 platforms
     - mediatek,mt8183-spi: for mt8183 platforms
     - "mediatek,mt8192-spi", "mediatek,mt6765-spi": for mt8192 platforms
+    - "mediatek,mt8195-spi", "mediatek,mt6765-spi": for mt8195 platforms
     - "mediatek,mt8516-spi", "mediatek,mt2712-spi": for mt8516 platforms
     - "mediatek,mt6779-spi", "mediatek,mt6765-spi": for mt6779 platforms
 
-- 
2.18.0


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

* [PATCH 2/4] spi: update spi slave bindings for MT8195 SoC
  2021-03-22  5:52 [PATCH 0/4] Add Mediatek MT8195 SPI driver support Leilk Liu
  2021-03-22  5:52 ` [PATCH 1/4] spi: update spi master bindings for MT8195 SoC Leilk Liu
@ 2021-03-22  5:52 ` Leilk Liu
  2021-03-22  5:52 ` [PATCH 3/4] spi: mediatek: add mtk_spi_compatible support Leilk Liu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Leilk Liu @ 2021-03-22  5:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: Mark Rutland, Matthias Brugger, devicetree, linux-kernel,
	linux-arm-kernel, linux-spi, linux-mediatek, fparent, Leilk Liu

Add a DT binding documentation for the MT8195 soc.

Signed-off-by: Leilk Liu <leilk.liu@mediatek.com>
---
 Documentation/devicetree/bindings/spi/spi-slave-mt27xx.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/spi/spi-slave-mt27xx.txt b/Documentation/devicetree/bindings/spi/spi-slave-mt27xx.txt
index c37e5a179b21..9192724540fd 100644
--- a/Documentation/devicetree/bindings/spi/spi-slave-mt27xx.txt
+++ b/Documentation/devicetree/bindings/spi/spi-slave-mt27xx.txt
@@ -3,6 +3,7 @@ Binding for MTK SPI Slave controller
 Required properties:
 - compatible: should be one of the following.
     - mediatek,mt2712-spi-slave: for mt2712 platforms
+    - mediatek,mt8195-spi-slave: for mt8195 platforms
 - reg: Address and length of the register set for the device.
 - interrupts: Should contain spi interrupt.
 - clocks: phandles to input clocks.
-- 
2.18.0


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

* [PATCH 3/4] spi: mediatek: add mtk_spi_compatible support
  2021-03-22  5:52 [PATCH 0/4] Add Mediatek MT8195 SPI driver support Leilk Liu
  2021-03-22  5:52 ` [PATCH 1/4] spi: update spi master bindings for MT8195 SoC Leilk Liu
  2021-03-22  5:52 ` [PATCH 2/4] spi: update spi slave " Leilk Liu
@ 2021-03-22  5:52 ` Leilk Liu
  2021-03-22  5:52 ` [PATCH 4/4] spi: mediatek: add mt8195 spi slave support Leilk Liu
  2021-03-23 22:12 ` [PATCH 0/4] Add Mediatek MT8195 SPI driver support Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Leilk Liu @ 2021-03-22  5:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: Mark Rutland, Matthias Brugger, devicetree, linux-kernel,
	linux-arm-kernel, linux-spi, linux-mediatek, fparent, Leilk Liu

this patch adds max_fifo_size and must_rx compat support.

Signed-off-by: Leilk Liu <leilk.liu@mediatek.com>
---
 drivers/spi/spi-slave-mt27xx.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-slave-mt27xx.c b/drivers/spi/spi-slave-mt27xx.c
index 44edaa360405..7e6fadc88cef 100644
--- a/drivers/spi/spi-slave-mt27xx.c
+++ b/drivers/spi/spi-slave-mt27xx.c
@@ -10,6 +10,8 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/spi/spi.h>
+#include <linux/of.h>
+
 
 #define SPIS_IRQ_EN_REG		0x0
 #define SPIS_IRQ_CLR_REG	0x4
@@ -61,8 +63,6 @@
 #define SPIS_DMA_ADDR_EN	BIT(1)
 #define SPIS_SOFT_RST		BIT(0)
 
-#define MTK_SPI_SLAVE_MAX_FIFO_SIZE 512U
-
 struct mtk_spi_slave {
 	struct device *dev;
 	void __iomem *base;
@@ -70,10 +70,19 @@ struct mtk_spi_slave {
 	struct completion xfer_done;
 	struct spi_transfer *cur_transfer;
 	bool slave_aborted;
+	const struct mtk_spi_compatible *dev_comp;
 };
 
+struct mtk_spi_compatible {
+	const u32 max_fifo_size;
+	bool must_rx;
+};
+static const struct mtk_spi_compatible mt2712_compat = {
+	.max_fifo_size = 512,
+};
 static const struct of_device_id mtk_spi_slave_of_match[] = {
-	{ .compatible = "mediatek,mt2712-spi-slave", },
+	{ .compatible = "mediatek,mt2712-spi-slave",
+	  .data = (void *)&mt2712_compat,},
 	{}
 };
 MODULE_DEVICE_TABLE(of, mtk_spi_slave_of_match);
@@ -272,7 +281,7 @@ static int mtk_spi_slave_transfer_one(struct spi_controller *ctlr,
 	mdata->slave_aborted = false;
 	mdata->cur_transfer = xfer;
 
-	if (xfer->len > MTK_SPI_SLAVE_MAX_FIFO_SIZE)
+	if (xfer->len > mdata->dev_comp->max_fifo_size)
 		return mtk_spi_slave_dma_transfer(ctlr, spi, xfer);
 	else
 		return mtk_spi_slave_fifo_transfer(ctlr, spi, xfer);
@@ -369,6 +378,7 @@ static int mtk_spi_slave_probe(struct platform_device *pdev)
 	struct spi_controller *ctlr;
 	struct mtk_spi_slave *mdata;
 	int irq, ret;
+	const struct of_device_id *of_id;
 
 	ctlr = spi_alloc_slave(&pdev->dev, sizeof(*mdata));
 	if (!ctlr) {
@@ -386,7 +396,17 @@ static int mtk_spi_slave_probe(struct platform_device *pdev)
 	ctlr->setup = mtk_spi_slave_setup;
 	ctlr->slave_abort = mtk_slave_abort;
 
+	of_id = of_match_node(mtk_spi_slave_of_match, pdev->dev.of_node);
+	if (!of_id) {
+		dev_err(&pdev->dev, "failed to probe of_node\n");
+		ret = -EINVAL;
+		goto err_put_ctlr;
+	}
 	mdata = spi_controller_get_devdata(ctlr);
+	mdata->dev_comp = of_id->data;
+
+	if (mdata->dev_comp->must_rx)
+		ctlr->flags = SPI_MASTER_MUST_RX;
 
 	platform_set_drvdata(pdev, ctlr);
 
-- 
2.18.0


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

* [PATCH 4/4] spi: mediatek: add mt8195 spi slave support
  2021-03-22  5:52 [PATCH 0/4] Add Mediatek MT8195 SPI driver support Leilk Liu
                   ` (2 preceding siblings ...)
  2021-03-22  5:52 ` [PATCH 3/4] spi: mediatek: add mtk_spi_compatible support Leilk Liu
@ 2021-03-22  5:52 ` Leilk Liu
  2021-03-23 22:12 ` [PATCH 0/4] Add Mediatek MT8195 SPI driver support Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Leilk Liu @ 2021-03-22  5:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: Mark Rutland, Matthias Brugger, devicetree, linux-kernel,
	linux-arm-kernel, linux-spi, linux-mediatek, fparent, Leilk Liu

this patch adds mt8195 spi slave compatible support.

Signed-off-by: Leilk Liu <leilk.liu@mediatek.com>
---
 drivers/spi/spi-slave-mt27xx.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/spi/spi-slave-mt27xx.c b/drivers/spi/spi-slave-mt27xx.c
index 7e6fadc88cef..f199a6c4738a 100644
--- a/drivers/spi/spi-slave-mt27xx.c
+++ b/drivers/spi/spi-slave-mt27xx.c
@@ -77,12 +77,20 @@ struct mtk_spi_compatible {
 	const u32 max_fifo_size;
 	bool must_rx;
 };
+
 static const struct mtk_spi_compatible mt2712_compat = {
 	.max_fifo_size = 512,
 };
+static const struct mtk_spi_compatible mt8195_compat = {
+	.max_fifo_size = 128,
+	.must_rx = true,
+};
+
 static const struct of_device_id mtk_spi_slave_of_match[] = {
 	{ .compatible = "mediatek,mt2712-spi-slave",
 	  .data = (void *)&mt2712_compat,},
+	{ .compatible = "mediatek,mt8195-spi-slave",
+	  .data = (void *)&mt8195_compat,},
 	{}
 };
 MODULE_DEVICE_TABLE(of, mtk_spi_slave_of_match);
-- 
2.18.0


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

* Re: [PATCH 0/4] Add Mediatek MT8195 SPI driver support
  2021-03-22  5:52 [PATCH 0/4] Add Mediatek MT8195 SPI driver support Leilk Liu
                   ` (3 preceding siblings ...)
  2021-03-22  5:52 ` [PATCH 4/4] spi: mediatek: add mt8195 spi slave support Leilk Liu
@ 2021-03-23 22:12 ` Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2021-03-23 22:12 UTC (permalink / raw)
  To: Leilk Liu
  Cc: Mark Brown, linux-arm-kernel, linux-kernel, Matthias Brugger,
	linux-mediatek, Mark Rutland, linux-spi, devicetree, fparent

On Mon, 22 Mar 2021 13:52:40 +0800, Leilk Liu wrote:
> This series are based on spi/for-next, and provide 4 patches to add MT8195 spi support.
> 
> Leilk Liu (4):
>   spi: update spi master bindings for MT8195 SoC
>   spi: update spi slave bindings for MT8195 SoC
>   spi: mediatek: add mtk_spi_compatible support
>   spi: mediatek: add mt8195 spi slave support
> 
> [...]

Applied to

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

Thanks!

[1/4] spi: update spi master bindings for MT8195 SoC
      commit: 08b020d3e9a87fb6d94b02782c42c001a4e084f4
[2/4] spi: update spi slave bindings for MT8195 SoC
      commit: f42698a8dc589dc7cc8e36641e86e6a9b3b32f9b
[3/4] spi: mediatek: add mtk_spi_compatible support
      commit: d666a833b0b9f5b8e08ecdc002a4cf5d34932b7a
[4/4] spi: mediatek: add mt8195 spi slave support
      commit: 1527b09bc80018f02fe0b6d14e97c95f93596221

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

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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22  5:52 [PATCH 0/4] Add Mediatek MT8195 SPI driver support Leilk Liu
2021-03-22  5:52 ` [PATCH 1/4] spi: update spi master bindings for MT8195 SoC Leilk Liu
2021-03-22  5:52 ` [PATCH 2/4] spi: update spi slave " Leilk Liu
2021-03-22  5:52 ` [PATCH 3/4] spi: mediatek: add mtk_spi_compatible support Leilk Liu
2021-03-22  5:52 ` [PATCH 4/4] spi: mediatek: add mt8195 spi slave support Leilk Liu
2021-03-23 22:12 ` [PATCH 0/4] Add Mediatek MT8195 SPI driver support Mark Brown

Linux-SPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-spi/0 linux-spi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-spi linux-spi/ https://lore.kernel.org/linux-spi \
		linux-spi@vger.kernel.org
	public-inbox-index linux-spi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-spi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git