mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spi/tegra: add devicetree support
@ 2011-06-15 19:07 Grant Likely
  2011-06-15 19:08 ` Grant Likely
  2011-06-15 19:25 ` Stephen Warren
  0 siblings, 2 replies; 4+ messages in thread
From: Grant Likely @ 2011-06-15 19:07 UTC (permalink / raw)
  To: spi-devel-general, linux-kernel, Erik Gilling; +Cc: Stephen Warren

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>
---
 .../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

diff --git a/Documentation/devicetree/bindings/spi/spi_nvidia.txt b/Documentation/devicetree/bindings/spi/spi_nvidia.txt
new file mode 100644
index 0000000..bde450b
--- /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,tegra250-spi".
+- gpios : should specify GPIOs used for chipselect.
diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c
index 8e30727..a43ceeb 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,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),
 };


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi/tegra: add devicetree support
  2011-06-15 19:07 [PATCH] spi/tegra: add devicetree support Grant Likely
@ 2011-06-15 19:08 ` Grant Likely
  2011-06-15 19:25 ` Stephen Warren
  1 sibling, 0 replies; 4+ messages in thread
From: Grant Likely @ 2011-06-15 19:08 UTC (permalink / raw)
  To: spi-devel-general, linux-kernel, Erik Gilling; +Cc: Stephen Warren

On Wed, Jun 15, 2011 at 1:07 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> 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>

I'll commit this to spi/next in a few days if nobody objects.

g.

> ---
>  .../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
>
> diff --git a/Documentation/devicetree/bindings/spi/spi_nvidia.txt b/Documentation/devicetree/bindings/spi/spi_nvidia.txt
> new file mode 100644
> index 0000000..bde450b
> --- /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,tegra250-spi".
> +- gpios : should specify GPIOs used for chipselect.
> diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c
> index 8e30727..a43ceeb 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,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),
>  };
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] spi/tegra: add devicetree support
  2011-06-15 19:07 [PATCH] spi/tegra: add devicetree support Grant Likely
  2011-06-15 19:08 ` Grant Likely
@ 2011-06-15 19:25 ` Stephen Warren
  2011-06-15 19:29   ` Grant Likely
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Warren @ 2011-06-15 19:25 UTC (permalink / raw)
  To: Grant Likely, spi-devel-general, linux-kernel, Erik Gilling

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2418 bytes --]

Grant Likely wrote at Wednesday, June 15, 2011 1:08 PM:
> Allow the tegra spi driver to obtain populate the spi bus with devices

Remote "obtain"?

> from the device tree.
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>  .../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
> 
> diff --git a/Documentation/devicetree/bindings/spi/spi_nvidia.txt b/Documentation/devicetree/bindings/spi/spi_nvidia.txt
> new file mode 100644
> index 0000000..bde450b
> --- /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,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.

> diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c
> index 8e30727..a43ceeb 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,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),
>  };

-- 
nvpublic

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi/tegra: add devicetree support
  2011-06-15 19:25 ` Stephen Warren
@ 2011-06-15 19:29   ` Grant Likely
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Likely @ 2011-06-15 19:29 UTC (permalink / raw)
  To: Stephen Warren; +Cc: spi-devel-general, linux-kernel, Erik Gilling

On Wed, Jun 15, 2011 at 1:25 PM, Stephen Warren <swarren@nvidia.com> wrote:
> Grant Likely wrote at Wednesday, June 15, 2011 1:08 PM:
>> Allow the tegra spi driver to obtain populate the spi bus with devices
>
> Remote "obtain"?

heh, oops.

>
>> from the device tree.
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>>  .../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
>>
>> diff --git a/Documentation/devicetree/bindings/spi/spi_nvidia.txt b/Documentation/devicetree/bindings/spi/spi_nvidia.txt
>> new file mode 100644
>> index 0000000..bde450b
>> --- /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,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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-15 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-15 19:07 [PATCH] spi/tegra: add devicetree support Grant Likely
2011-06-15 19:08 ` Grant Likely
2011-06-15 19:25 ` Stephen Warren
2011-06-15 19:29   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome