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