spi/tegra: add devicetree support
Subsystems (4)
PATCH 1/1 spi/tegra: add devicetree support
Allow the tegra spi driver to obtain populate the spi bus with devices from the device tree.
--- .../devicetree/bindings/spi/spi_nvidia.txt | 5 +++++ drivers/spi/spi-tegra.c | 12 ++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi_nvidia.txt
Documentation/devicetree/bindings/spi/spi_nvidia.txt new file +5 -0
@@ -0,0 +1,5 @@ +NVIDIA Tegra 2 SPI device + +Required properties: +- compatible : should be "nvidia,tegra250-spi". +- gpios : should specify GPIOs used for chipselect.
drivers/spi/spi-tegra.c +12 -0
@@ -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,tegra250-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), };
Quoted 4 lines · Grant Likely
Allow the tegra spi driver to obtain populate the spi bus with devices from the device tree.
Signed-off-by Grant Likely <[email protected]>
I'll commit this to spi/next in a few days if nobody objects.
g.
Quoted 53 lines
---
.../devicetree/bindings/spi/spi_nvidia.txt | 5 +++++drivers/spi/spi-tegra.c| 12 ++++++++++++2 files changed, 17 insertions(+), 0 deletions(-)create mode 100644
Documentation/devicetree/bindings/spi/spi_nvidia.txtDocumentation/devicetree/bindings/spi/spi_nvidia.txt new file +5
-0@@ -0,0 +1,5 @@ +NVIDIA Tegra 2 SPI device + +Required properties: +- compatible : should be "nvidia,tegra250-spi". +- gpios : should specify GPIOs used for chipselect.drivers/spi/spi-tegra.c +12
-0@@ -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,tegra250-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), };
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
Grant Likely wrote at Wednesday, June 15, 2011 1:08 PM:
Quoted 1 line
Allow the tegra spi driver to obtain populate the spi bus with devices
Remote "obtain"?
Quoted 15 lines
from the device tree.
Signed-off-by Grant Likely <[email protected]>--- .../devicetree/bindings/spi/spi_nvidia.txt | 5 +++++ drivers/spi/spi-tegra.c | 12 ++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi_nvidia.txtDocumentation/devicetree/bindings/spi/spi_nvidia.txt new file +0
-0
Documentation/devicetree/bindings/spi/spi_nvidia.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/spi/spi_nvidia.txt new file +5
-0@@ -0,0 +1,5 @@ +NVIDIA Tegra 2 SPI device + +Required properties: +- compatible : should be "nvidia,tegra250-spi". +- gpios : should specify GPIOs used for chipselect.
Are things like reg, interrupts, and other general stuff implicit? I notice that fsl-spi.txt does specify those, but spi_altera.txt and spi_oc_tiny.txt don't.
Otherwise, LGTM.
Quoted 36 lines
drivers/spi/spi-tegra.c +1
-0@@ -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);drivers/spi/spi-tegra.c +11
-0if (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,tegra250-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),};
Signature · 1 line
nvpublic
Quoted 4 lines · Stephen Warren
Grant Likely wrote at Wednesday, June 15, 2011 1:08 PM:
Quoted 1 line
Allow the tegra spi driver to obtain populate the spi bus with devices
Remote "obtain"?
heh, oops.
Quoted 10 lines
Quoted 10 lines
from the device tree.
Signed-off-by Grant Likely <[email protected]>---
.../devicetree/bindings/spi/spi_nvidia.txt | 5 +++++drivers/spi/spi-tegra.c| 12 ++++++++++++2 files changed, 17 insertions(+), 0 deletions(-)create mode 100644
Documentation/devicetree/bindings/spi/spi_nvidia.txt
Quoted 15 lines
Documentation/devicetree/bindings/spi/spi_nvidia.txt line 5
Quoted 11 lines
Documentation/devicetree/bindings/spi/spi_nvidia.txt new file +5
-0@@ -0,0 +1,5 @@ +NVIDIA Tegra 2 SPI device + +Required properties: +- compatible : should be "nvidia,tegra250-spi". +- gpios : should specify GPIOs used for chipselect.Are things like reg, interrupts, and other general stuff implicit? I notice that fsl-spi.txt does specify those, but spi_altera.txt and spi_oc_tiny.txt don't.
yeah, standard properties are pretty much implicit. I don't bother writing the words if there isn't much value to them. I've been contemplating a tool that will take DT documentation written in a certain form, and automatically fill in standard properties as needed, but that's a project for another day.
g.