diff mbox

[V4,5/5] net/fec: add device tree matching support

Message ID 1299733185-2172-6-git-send-email-jason.hui@linaro.org
State New
Headers show

Commit Message

Jason Hui March 10, 2011, 4:59 a.m. UTC
Signed-off-by: Jason Liu <jason.hui@linaro.org>
Signed-off-by: Jason Liu <r64343@freescale.com>
---
 drivers/net/fec.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

Comments

Grant Likely March 15, 2011, 7:14 a.m. UTC | #1
On Thu, Mar 10, 2011 at 12:59:45PM +0800, Jason Liu wrote:
> Signed-off-by: Jason Liu <jason.hui@linaro.org>
> Signed-off-by: Jason Liu <r64343@freescale.com>
> ---
>  drivers/net/fec.c |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index 02cdd71..fcb9768 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -45,6 +45,9 @@
>  #include <linux/phy.h>
>  #include <linux/fec.h>
>  
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +

Should be mixed in with the rest of the linux/*.h includes (don't put
a blank line between them.

>  #include <asm/cacheflush.h>
>  
>  #ifndef CONFIG_ARM
> @@ -1523,6 +1526,13 @@ static const struct dev_pm_ops fec_pm_ops = {
>  };
>  #endif
>  
> +#ifdef CONFIG_OF
> +static struct of_device_id fec_matches[] = {
> +	{ .compatible = "fsl,imx-fec" },

Must have documentation for this binding in
Documentation/devicetree/bindings before I can pick this up.  Same
goes for the uart driver patch.

Also, I recommend being more specific on the compatible property.
fsl,imx51-fec would be better.  Newer parts can claim compatibility
with this one if you're concerned about supporting multiple parts.

ie. for imx 53, this would be appropriate:

	compatible = "fsl,imx53-fec", "fsl,imx51-fec";

> +	{},
> +};
> +#endif
> +
>  static struct platform_driver fec_driver = {
>  	.driver	= {
>  		.name	= DRIVER_NAME,
> @@ -1530,6 +1540,9 @@ static struct platform_driver fec_driver = {
>  #ifdef CONFIG_PM
>  		.pm	= &fec_pm_ops,
>  #endif
> +#ifdef CONFIG_OF
> +		.of_match_table = fec_matches,
> +#endif
>  	},
>  	.id_table = fec_devtype,
>  	.probe	= fec_probe,
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> linaro-dev mailing list
> linaro-dev@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev
Jason Hui March 16, 2011, 3:36 a.m. UTC | #2
Hi, Grant,

On Tue, Mar 15, 2011 at 3:14 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Thu, Mar 10, 2011 at 12:59:45PM +0800, Jason Liu wrote:
>> Signed-off-by: Jason Liu <jason.hui@linaro.org>
>> Signed-off-by: Jason Liu <r64343@freescale.com>
>> ---
>>  drivers/net/fec.c |   13 +++++++++++++
>>  1 files changed, 13 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
>> index 02cdd71..fcb9768 100644
>> --- a/drivers/net/fec.c
>> +++ b/drivers/net/fec.c
>> @@ -45,6 +45,9 @@
>>  #include <linux/phy.h>
>>  #include <linux/fec.h>
>>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +
>
> Should be mixed in with the rest of the linux/*.h includes (don't put
> a blank line between them.

OK,

>
>>  #include <asm/cacheflush.h>
>>
>>  #ifndef CONFIG_ARM
>> @@ -1523,6 +1526,13 @@ static const struct dev_pm_ops fec_pm_ops = {
>>  };
>>  #endif
>>
>> +#ifdef CONFIG_OF
>> +static struct of_device_id fec_matches[] = {
>> +     { .compatible = "fsl,imx-fec" },
>
> Must have documentation for this binding in
> Documentation/devicetree/bindings before I can pick this up.  Same
> goes for the uart driver patch.

OK, I will write one documentation for it and the same with uart.

>
> Also, I recommend being more specific on the compatible property.
> fsl,imx51-fec would be better.  Newer parts can claim compatibility
> with this one if you're concerned about supporting multiple parts.
>
> ie. for imx 53, this would be appropriate:
>
>        compatible = "fsl,imx53-fec", "fsl,imx51-fec";

OK,

>
>> +     {},
>> +};
>> +#endif
>> +
>>  static struct platform_driver fec_driver = {
>>       .driver = {
>>               .name   = DRIVER_NAME,
>> @@ -1530,6 +1540,9 @@ static struct platform_driver fec_driver = {
>>  #ifdef CONFIG_PM
>>               .pm     = &fec_pm_ops,
>>  #endif
>> +#ifdef CONFIG_OF
>> +             .of_match_table = fec_matches,
>> +#endif
>>       },
>>       .id_table = fec_devtype,
>>       .probe  = fec_probe,
>> --
>> 1.7.1
>>
>>
>> _______________________________________________
>> linaro-dev mailing list
>> linaro-dev@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/linaro-dev
>
diff mbox

Patch

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 02cdd71..fcb9768 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -45,6 +45,9 @@ 
 #include <linux/phy.h>
 #include <linux/fec.h>
 
+#include <linux/of.h>
+#include <linux/of_address.h>
+
 #include <asm/cacheflush.h>
 
 #ifndef CONFIG_ARM
@@ -1523,6 +1526,13 @@  static const struct dev_pm_ops fec_pm_ops = {
 };
 #endif
 
+#ifdef CONFIG_OF
+static struct of_device_id fec_matches[] = {
+	{ .compatible = "fsl,imx-fec" },
+	{},
+};
+#endif
+
 static struct platform_driver fec_driver = {
 	.driver	= {
 		.name	= DRIVER_NAME,
@@ -1530,6 +1540,9 @@  static struct platform_driver fec_driver = {
 #ifdef CONFIG_PM
 		.pm	= &fec_pm_ops,
 #endif
+#ifdef CONFIG_OF
+		.of_match_table = fec_matches,
+#endif
 	},
 	.id_table = fec_devtype,
 	.probe	= fec_probe,