All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND v3] iio: Add device tree support to LPC32xx ADC
@ 2012-04-20 14:38 Roland Stigge
  2012-04-20 15:04 ` Lars-Peter Clausen
  0 siblings, 1 reply; 6+ messages in thread
From: Roland Stigge @ 2012-04-20 14:38 UTC (permalink / raw)
  To: jic23, gregkh, grant.likely, rob.herring, linux-iio, devel, linux-kernel
  Cc: Roland Stigge

This patch adds device tree support to the LPC32xx's ADC.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>

---

NOTE: I separated out this patch from the first patch series of the LPC32xx
device tree conversion because most of those patches are already applied to
-next and are basically unrelated. The LPC32xx devicetree conversion builds
upon this patch.

Applies to v3.4-rc3

 Documentation/devicetree/bindings/staging/iio/adc/lpc32xx-adc.txt |   16 ++++++++++
 drivers/staging/iio/adc/lpc32xx_adc.c                             |   10 ++++++
 2 files changed, 26 insertions(+)

--- /dev/null
+++ linux-2.6/Documentation/devicetree/bindings/staging/iio/adc/lpc32xx-adc.txt
@@ -0,0 +1,16 @@
+* NXP LPC32xx SoC ADC controller
+
+Required properties:
+- compatible: must be "nxp,lpc32xx-adc"
+- reg: physical base address of the controller and length of memory mapped
+  region.
+- interrupts: The ADC interrupt
+
+Example:
+
+	adc@40048000 {
+		compatible = "nxp,lpc32xx-adc";
+		reg = <0x40048000 0x1000>;
+		interrupt-parent = <&mic>;
+		interrupts = <39 0>;
+	};
--- linux-2.6.orig/drivers/staging/iio/adc/lpc32xx_adc.c
+++ linux-2.6/drivers/staging/iio/adc/lpc32xx_adc.c
@@ -30,6 +30,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/completion.h>
+#include <linux/of.h>
 
 #include "../iio.h"
 #include "../sysfs.h"
@@ -221,12 +222,21 @@ static int __devexit lpc32xx_adc_remove(
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id lpc32xx_adc_match[] = {
+	{ .compatible = "nxp,lpc32xx-adc" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, lpc32xx_adc_match);
+#endif
+
 static struct platform_driver lpc32xx_adc_driver = {
 	.probe		= lpc32xx_adc_probe,
 	.remove		= __devexit_p(lpc32xx_adc_remove),
 	.driver		= {
 		.name	= MOD_NAME,
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(lpc32xx_adc_match),
 	},
 };
 

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

* Re: [PATCH RESEND v3] iio: Add device tree support to LPC32xx ADC
  2012-04-20 14:38 [PATCH RESEND v3] iio: Add device tree support to LPC32xx ADC Roland Stigge
@ 2012-04-20 15:04 ` Lars-Peter Clausen
  2012-04-20 15:35     ` Roland Stigge
  0 siblings, 1 reply; 6+ messages in thread
From: Lars-Peter Clausen @ 2012-04-20 15:04 UTC (permalink / raw)
  To: Roland Stigge
  Cc: jic23, gregkh, grant.likely, rob.herring, linux-iio, devel, linux-kernel

> [...]
> 
> --- /dev/null
> +++ linux-2.6/Documentation/devicetree/bindings/staging/iio/adc/lpc32xx-adc.txt
> @@ -0,0 +1,16 @@
> +* NXP LPC32xx SoC ADC controller
> +
> +Required properties:
> +- compatible: must be "nxp,lpc32xx-adc"
> +- reg: physical base address of the controller and length of memory mapped
> +  region.
> +- interrupts: The ADC interrupt
> +
> +Example:
> +
> +	adc@40048000 {
> +		compatible = "nxp,lpc32xx-adc";

In my opinion it seems to be a bad idea to use wildcard names in devicetree
compatible strings.

> +		reg = <0x40048000 0x1000>;
> +		interrupt-parent = <&mic>;
> +		interrupts = <39 0>;
> +	};


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

* Re: [PATCH RESEND v3] iio: Add device tree support to LPC32xx ADC
  2012-04-20 15:04 ` Lars-Peter Clausen
@ 2012-04-20 15:35     ` Roland Stigge
  0 siblings, 0 replies; 6+ messages in thread
From: Roland Stigge @ 2012-04-20 15:35 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: jic23, gregkh, grant.likely, rob.herring, linux-iio, devel,
	linux-kernel, Kevin Wells, Srinivas Bakki, arm, linux-kernel,
	linux-arm-kernel

Hi,

On 04/20/2012 05:04 PM, Lars-Peter Clausen wrote:
>> --- /dev/null
>> +++ linux-2.6/Documentation/devicetree/bindings/staging/iio/adc/lpc32xx-adc.txt
>> @@ -0,0 +1,16 @@
>> +* NXP LPC32xx SoC ADC controller
>> +
>> +Required properties:
>> +- compatible: must be "nxp,lpc32xx-adc"
>> +- reg: physical base address of the controller and length of memory mapped
>> +  region.
>> +- interrupts: The ADC interrupt
>> +
>> +Example:
>> +
>> +	adc@40048000 {
>> +		compatible = "nxp,lpc32xx-adc";
> 
> In my opinion it seems to be a bad idea to use wildcard names in devicetree
> compatible strings.

In the above case, the situation is as follows:

* NXP has LPC3220, LPC3230, LPC3240 and LPC3250 (differing in SRAM size
  and in the existence of its Ethernet and LCD controllers)
* The ADC controller is present in every single one of those
* We already have "lpc32xx" in the kernel everywhere
* Current state is that NXP isn't planning to issue LPC32xx without ADC
* I'm providing a lpc32xx.dtsi file to be used by all LPC32xx variants.
  This one is referencing the above "compatible" string. Splitting up
  in all possible numbers (see below) doesn't help much, here.

What would you prefer?

+static const struct of_device_id lpc32xx_adc_match[] = {
+       { .compatible = "nxp,lpc3220-adc" },
+       { .compatible = "nxp,lpc3230-adc" },
+       { .compatible = "nxp,lpc3240-adc" },
+       { .compatible = "nxp,lpc3250-adc" },
+       {},
+};

?

What is a better strategy here?

Thanks in advance,

Roland

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

* [PATCH RESEND v3] iio: Add device tree support to LPC32xx ADC
@ 2012-04-20 15:35     ` Roland Stigge
  0 siblings, 0 replies; 6+ messages in thread
From: Roland Stigge @ 2012-04-20 15:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 04/20/2012 05:04 PM, Lars-Peter Clausen wrote:
>> --- /dev/null
>> +++ linux-2.6/Documentation/devicetree/bindings/staging/iio/adc/lpc32xx-adc.txt
>> @@ -0,0 +1,16 @@
>> +* NXP LPC32xx SoC ADC controller
>> +
>> +Required properties:
>> +- compatible: must be "nxp,lpc32xx-adc"
>> +- reg: physical base address of the controller and length of memory mapped
>> +  region.
>> +- interrupts: The ADC interrupt
>> +
>> +Example:
>> +
>> +	adc at 40048000 {
>> +		compatible = "nxp,lpc32xx-adc";
> 
> In my opinion it seems to be a bad idea to use wildcard names in devicetree
> compatible strings.

In the above case, the situation is as follows:

* NXP has LPC3220, LPC3230, LPC3240 and LPC3250 (differing in SRAM size
  and in the existence of its Ethernet and LCD controllers)
* The ADC controller is present in every single one of those
* We already have "lpc32xx" in the kernel everywhere
* Current state is that NXP isn't planning to issue LPC32xx without ADC
* I'm providing a lpc32xx.dtsi file to be used by all LPC32xx variants.
  This one is referencing the above "compatible" string. Splitting up
  in all possible numbers (see below) doesn't help much, here.

What would you prefer?

+static const struct of_device_id lpc32xx_adc_match[] = {
+       { .compatible = "nxp,lpc3220-adc" },
+       { .compatible = "nxp,lpc3230-adc" },
+       { .compatible = "nxp,lpc3240-adc" },
+       { .compatible = "nxp,lpc3250-adc" },
+       {},
+};

?

What is a better strategy here?

Thanks in advance,

Roland

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

* Re: [PATCH RESEND v3] iio: Add device tree support to LPC32xx ADC
  2012-04-20 15:35     ` Roland Stigge
@ 2012-04-20 15:58       ` Arnd Bergmann
  -1 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2012-04-20 15:58 UTC (permalink / raw)
  To: Roland Stigge
  Cc: Lars-Peter Clausen, jic23, gregkh, grant.likely, rob.herring,
	linux-iio, devel, linux-kernel, Kevin Wells, Srinivas Bakki, arm,
	linux-arm-kernel

On Friday 20 April 2012, Roland Stigge wrote:
> In the above case, the situation is as follows:
> 
> * NXP has LPC3220, LPC3230, LPC3240 and LPC3250 (differing in SRAM size
>   and in the existence of its Ethernet and LCD controllers)
> * The ADC controller is present in every single one of those
> * We already have "lpc32xx" in the kernel everywhere
> * Current state is that NXP isn't planning to issue LPC32xx without ADC
> * I'm providing a lpc32xx.dtsi file to be used by all LPC32xx variants.
>   This one is referencing the above "compatible" string. Splitting up
>   in all possible numbers (see below) doesn't help much, here.
> 
> What would you prefer?
> 
> +static const struct of_device_id lpc32xx_adc_match[] = {
> +       { .compatible = "nxp,lpc3220-adc" },
> +       { .compatible = "nxp,lpc3230-adc" },
> +       { .compatible = "nxp,lpc3240-adc" },
> +       { .compatible = "nxp,lpc3250-adc" },
> +       {},
> +};

This looks ok to me.

> What is a better strategy here?

One way we sometimes do these things is to match only the earliest
model, e.g. nxp,lpc3220-adc, and put that one and the new model
into the device tree, to state the the device is compatible with
both the original implementation and the new one.

	Arnd

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

* [PATCH RESEND v3] iio: Add device tree support to LPC32xx ADC
@ 2012-04-20 15:58       ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2012-04-20 15:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 20 April 2012, Roland Stigge wrote:
> In the above case, the situation is as follows:
> 
> * NXP has LPC3220, LPC3230, LPC3240 and LPC3250 (differing in SRAM size
>   and in the existence of its Ethernet and LCD controllers)
> * The ADC controller is present in every single one of those
> * We already have "lpc32xx" in the kernel everywhere
> * Current state is that NXP isn't planning to issue LPC32xx without ADC
> * I'm providing a lpc32xx.dtsi file to be used by all LPC32xx variants.
>   This one is referencing the above "compatible" string. Splitting up
>   in all possible numbers (see below) doesn't help much, here.
> 
> What would you prefer?
> 
> +static const struct of_device_id lpc32xx_adc_match[] = {
> +       { .compatible = "nxp,lpc3220-adc" },
> +       { .compatible = "nxp,lpc3230-adc" },
> +       { .compatible = "nxp,lpc3240-adc" },
> +       { .compatible = "nxp,lpc3250-adc" },
> +       {},
> +};

This looks ok to me.

> What is a better strategy here?

One way we sometimes do these things is to match only the earliest
model, e.g. nxp,lpc3220-adc, and put that one and the new model
into the device tree, to state the the device is compatible with
both the original implementation and the new one.

	Arnd

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

end of thread, other threads:[~2012-04-20 15:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-20 14:38 [PATCH RESEND v3] iio: Add device tree support to LPC32xx ADC Roland Stigge
2012-04-20 15:04 ` Lars-Peter Clausen
2012-04-20 15:35   ` Roland Stigge
2012-04-20 15:35     ` Roland Stigge
2012-04-20 15:58     ` Arnd Bergmann
2012-04-20 15:58       ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.