b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 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 | --- 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 | |