Skip to content

Commit 9a436c6

Browse files
ch6574broonie
authored andcommitted
spi: rb4xx: update driver to be device tree aware
This patch updates the spi driver spi-rb4xx.c to be device tree aware Signed-off-by: Christopher Hill <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 678e5e1 commit 9a436c6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/spi/spi-rb4xx.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/platform_device.h>
1515
#include <linux/clk.h>
1616
#include <linux/spi/spi.h>
17+
#include <linux/of.h>
1718

1819
#include <asm/mach-ath79/ar71xx_regs.h>
1920

@@ -150,6 +151,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
150151
if (IS_ERR(ahb_clk))
151152
return PTR_ERR(ahb_clk);
152153

154+
master->dev.of_node = pdev->dev.of_node;
153155
master->bus_num = 0;
154156
master->num_chipselect = 3;
155157
master->mode_bits = SPI_TX_DUAL;
@@ -188,11 +190,18 @@ static int rb4xx_spi_remove(struct platform_device *pdev)
188190
return 0;
189191
}
190192

193+
static const struct of_device_id rb4xx_spi_dt_match[] = {
194+
{ .compatible = "mikrotik,rb4xx-spi" },
195+
{ },
196+
};
197+
MODULE_DEVICE_TABLE(of, rb4xx_spi_dt_match);
198+
191199
static struct platform_driver rb4xx_spi_drv = {
192200
.probe = rb4xx_spi_probe,
193201
.remove = rb4xx_spi_remove,
194202
.driver = {
195203
.name = "rb4xx-spi",
204+
.of_match_table = of_match_ptr(rb4xx_spi_dt_match),
196205
},
197206
};
198207

0 commit comments

Comments
 (0)