blob: 0ce4f2bb352ac62857c61181b7794e0474429314 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From: Christopher Hill <ch6574@gmail.com>
2To: Mark Brown <broonie@kernel.org>
3Cc: Christopher Hill <ch6574@gmail.com>, linux-spi@vger.kernel.org,
4 linux-kernel@vger.kernel.org
5Subject: [PATCH 2/3] spi: rb4xx: update driver to be device tree aware
6Date: Thu, 21 May 2020 14:36:30 -0400
7Message-Id: <20200521183631.37806-2-ch6574@gmail.com>
8X-Mailer: git-send-email 2.25.1
9In-Reply-To: <20200521183631.37806-1-ch6574@gmail.com>
10References: <20200521183631.37806-1-ch6574@gmail.com>
11MIME-Version: 1.0
12Sender: linux-spi-owner@vger.kernel.org
13Precedence: bulk
14List-ID: <linux-spi.vger.kernel.org>
15X-Mailing-List: linux-spi@vger.kernel.org
16
17This patch updates the spi driver spi-rb4xx.c to be device tree aware
18
19Signed-off-by: Christopher Hill <ch6574@gmail.com>
20---
21 drivers/spi/spi-rb4xx.c | 9 +++++++++
22 1 file changed, 9 insertions(+)
23
24--- a/drivers/spi/spi-rb4xx.c
25+++ b/drivers/spi/spi-rb4xx.c
26@@ -14,6 +14,7 @@
27 #include <linux/platform_device.h>
28 #include <linux/clk.h>
29 #include <linux/spi/spi.h>
30+#include <linux/of.h>
31
32 #include <asm/mach-ath79/ar71xx_regs.h>
33
34@@ -150,6 +151,7 @@ static int rb4xx_spi_probe(struct platfo
35 if (IS_ERR(ahb_clk))
36 return PTR_ERR(ahb_clk);
37
38+ master->dev.of_node = pdev->dev.of_node;
39 master->bus_num = 0;
40 master->num_chipselect = 3;
41 master->mode_bits = SPI_TX_DUAL;
42@@ -188,11 +190,18 @@ static int rb4xx_spi_remove(struct platf
43 return 0;
44 }
45
46+static const struct of_device_id rb4xx_spi_dt_match[] = {
47+ { .compatible = "mikrotik,rb4xx-spi" },
48+ { },
49+};
50+MODULE_DEVICE_TABLE(of, rb4xx_spi_dt_match);
51+
52 static struct platform_driver rb4xx_spi_drv = {
53 .probe = rb4xx_spi_probe,
54 .remove = rb4xx_spi_remove,
55 .driver = {
56 .name = "rb4xx-spi",
57+ .of_match_table = of_match_ptr(rb4xx_spi_dt_match),
58 },
59 };
60