diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-07-05 23:45:36 -0600 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-07-21 15:45:02 -0600 |
commit | 3dbcc08accc9900c750f17e6c38643f814127bf7 (patch) | |
tree | a164f3b762f4105130ad1b35d82a100e0707e5e3 | |
parent | 359ece7ae3a0e3640b6f40dd8caa85cf2aec7aac (diff) |
spi/tegra: add devicetree support
Allow the tegra spi driver to obtain populate the spi bus with devices
from the device tree.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r-- | Documentation/devicetree/bindings/spi/spi_nvidia.txt | 5 | ||||
-rw-r--r-- | drivers/spi/spi_tegra.c | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/spi/spi_nvidia.txt b/Documentation/devicetree/bindings/spi/spi_nvidia.txt new file mode 100644 index 00000000000..6b9e5189669 --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi_nvidia.txt @@ -0,0 +1,5 @@ +NVIDIA Tegra 2 SPI device + +Required properties: +- compatible : should be "nvidia,tegra20-spi". +- gpios : should specify GPIOs used for chipselect. diff --git a/drivers/spi/spi_tegra.c b/drivers/spi/spi_tegra.c index 6c3aa6ecaad..b0e3586d1e1 100644 --- a/drivers/spi/spi_tegra.c +++ b/drivers/spi/spi_tegra.c @@ -546,6 +546,7 @@ static int __init spi_tegra_probe(struct platform_device *pdev) tspi->rx_dma_req.req_sel = spi_tegra_req_sels[pdev->id]; tspi->rx_dma_req.dev = tspi; + master->dev.of_node = pdev->dev.of_node; ret = spi_register_master(master); if (ret < 0) @@ -595,10 +596,21 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev) MODULE_ALIAS("platform:spi_tegra"); +#ifdef CONFIG_OF +static struct of_device_id spi_tegra_of_match_table[] __devinitdata = { + { .compatible = "nvidia,tegra20-spi", }, + {} +}; +MODULE_DEVICE_TABLE(of, spi_tegra_of_match_table); +#else /* CONFIG_OF */ +#define spi_tegra_of_match_table NULL +#endif /* CONFIG_OF */ + static struct platform_driver spi_tegra_driver = { .driver = { .name = "spi_tegra", .owner = THIS_MODULE, + .of_match_table = spi_tegra_of_match_table, }, .remove = __devexit_p(spi_tegra_remove), }; |