mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] smc91x: add devicetree support
@ 2011-01-25  5:59 Thomas Chou
  2011-01-25  6:24 ` Grant Likely
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Chou @ 2011-01-25  5:59 UTC (permalink / raw)
  To: Grant Likely, Nicolas Pitre
  Cc: linux-kernel, nios2-dev, devicetree-discuss, netdev, Thomas Chou

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 drivers/net/smc91x.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 726df61..d29e18d 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -81,6 +81,7 @@ static const char version[] =
 #include <linux/ethtool.h>
 #include <linux/mii.h>
 #include <linux/workqueue.h>
+#include <linux/of.h>
 
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
@@ -2394,6 +2395,12 @@ static int smc_drv_resume(struct device *dev)
 	return 0;
 }
 
+static const struct of_device_id smc91x_match[] = {
+	{ .compatible = "smsc,smc91x", },
+	{},
+}
+MODULE_DEVICE_TABLE(of, smc91x_match);
+
 static struct dev_pm_ops smc_drv_pm_ops = {
 	.suspend	= smc_drv_suspend,
 	.resume		= smc_drv_resume,
@@ -2406,6 +2413,9 @@ static struct platform_driver smc_driver = {
 		.name	= CARDNAME,
 		.owner	= THIS_MODULE,
 		.pm	= &smc_drv_pm_ops,
+#ifdef CONFIG_OF
+		.of_match_table = smc91x_match,
+#endif
 	},
 };
 
-- 
1.7.3.5


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

* Re: [PATCH] smc91x: add devicetree support
  2011-01-25  5:59 [PATCH] smc91x: add devicetree support Thomas Chou
@ 2011-01-25  6:24 ` Grant Likely
  2011-01-25  7:09   ` [PATCH v2] " Thomas Chou
  0 siblings, 1 reply; 10+ messages in thread
From: Grant Likely @ 2011-01-25  6:24 UTC (permalink / raw)
  To: Thomas Chou
  Cc: Nicolas Pitre, linux-kernel, nios2-dev, devicetree-discuss, netdev

On Mon, Jan 24, 2011 at 10:59 PM, Thomas Chou <thomas@wytron.com.tw> wrote:
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
>  drivers/net/smc91x.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
> index 726df61..d29e18d 100644
> --- a/drivers/net/smc91x.c
> +++ b/drivers/net/smc91x.c
> @@ -81,6 +81,7 @@ static const char version[] =
>  #include <linux/ethtool.h>
>  #include <linux/mii.h>
>  #include <linux/workqueue.h>
> +#include <linux/of.h>
>
>  #include <linux/netdevice.h>
>  #include <linux/etherdevice.h>
> @@ -2394,6 +2395,12 @@ static int smc_drv_resume(struct device *dev)
>        return 0;
>  }
>
> +static const struct of_device_id smc91x_match[] = {
> +       { .compatible = "smsc,smc91x", },

Be specific.  What *exact* smsc device are you adding support for?
Wildcards like smc91x tend to cause problems in the future.

> +       {},
> +}
> +MODULE_DEVICE_TABLE(of, smc91x_match);
> +
>  static struct dev_pm_ops smc_drv_pm_ops = {
>        .suspend        = smc_drv_suspend,
>        .resume         = smc_drv_resume,
> @@ -2406,6 +2413,9 @@ static struct platform_driver smc_driver = {
>                .name   = CARDNAME,
>                .owner  = THIS_MODULE,
>                .pm     = &smc_drv_pm_ops,
> +#ifdef CONFIG_OF
> +               .of_match_table = smc91x_match,
> +#endif
>        },
>  };
>
> --
> 1.7.3.5
>
>



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

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

* [PATCH v2] smc91x: add devicetree support
  2011-01-25  6:24 ` Grant Likely
@ 2011-01-25  7:09   ` Thomas Chou
  2011-01-25 12:11     ` [PATCH v3] " Thomas Chou
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Chou @ 2011-01-25  7:09 UTC (permalink / raw)
  To: Grant Likely, Nicolas Pitre
  Cc: linux-kernel, nios2-dev, devicetree-discuss, netdev, Thomas Chou

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v2 specify part numbers in compat as Grant suggested.

 drivers/net/smc91x.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 726df61..de48ebd 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -81,6 +81,7 @@ static const char version[] =
 #include <linux/ethtool.h>
 #include <linux/mii.h>
 #include <linux/workqueue.h>
+#include <linux/of.h>
 
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
@@ -2394,6 +2395,13 @@ static int smc_drv_resume(struct device *dev)
 	return 0;
 }
 
+static const struct of_device_id smc91x_match[] = {
+	{ .compatible = "smsc,smc91c94", },
+	{ .compatible = "smsc,smc91c111", },
+	{},
+}
+MODULE_DEVICE_TABLE(of, smc91x_match);
+
 static struct dev_pm_ops smc_drv_pm_ops = {
 	.suspend	= smc_drv_suspend,
 	.resume		= smc_drv_resume,
@@ -2406,6 +2414,9 @@ static struct platform_driver smc_driver = {
 		.name	= CARDNAME,
 		.owner	= THIS_MODULE,
 		.pm	= &smc_drv_pm_ops,
+#ifdef CONFIG_OF
+		.of_match_table = smc91x_match,
+#endif
 	},
 };
 
-- 
1.7.3.5


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

* [PATCH v3] smc91x: add devicetree support
  2011-01-25  7:09   ` [PATCH v2] " Thomas Chou
@ 2011-01-25 12:11     ` Thomas Chou
  2011-01-26  3:45       ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Chou @ 2011-01-25 12:11 UTC (permalink / raw)
  To: Grant Likely, Nicolas Pitre
  Cc: linux-kernel, nios2-dev, devicetree-discuss, netdev, Thomas Chou

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v2 specify part numbers in compat as Grant suggested.
v3 more specific part name.

 drivers/net/smc91x.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 726df61..65b2a70 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -81,6 +81,7 @@ static const char version[] =
 #include <linux/ethtool.h>
 #include <linux/mii.h>
 #include <linux/workqueue.h>
+#include <linux/of.h>
 
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
@@ -2394,6 +2395,13 @@ static int smc_drv_resume(struct device *dev)
 	return 0;
 }
 
+static const struct of_device_id smc91x_match[] = {
+	{ .compatible = "smsc,lan91c94", },
+	{ .compatible = "smsc,lan91c111", },
+	{},
+}
+MODULE_DEVICE_TABLE(of, smc91x_match);
+
 static struct dev_pm_ops smc_drv_pm_ops = {
 	.suspend	= smc_drv_suspend,
 	.resume		= smc_drv_resume,
@@ -2406,6 +2414,9 @@ static struct platform_driver smc_driver = {
 		.name	= CARDNAME,
 		.owner	= THIS_MODULE,
 		.pm	= &smc_drv_pm_ops,
+#ifdef CONFIG_OF
+		.of_match_table = smc91x_match,
+#endif
 	},
 };
 
-- 
1.7.3.5


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

* Re: [PATCH v3] smc91x: add devicetree support
  2011-01-25 12:11     ` [PATCH v3] " Thomas Chou
@ 2011-01-26  3:45       ` David Miller
  2011-01-26  5:22         ` [PATCH v4] " Thomas Chou
  0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2011-01-26  3:45 UTC (permalink / raw)
  To: thomas
  Cc: grant.likely, nico, linux-kernel, nios2-dev, devicetree-discuss, netdev

From: Thomas Chou <thomas@wytron.com.tw>
Date: Tue, 25 Jan 2011 20:11:48 +0800

> @@ -2394,6 +2395,13 @@ static int smc_drv_resume(struct device *dev)
>  	return 0;
>  }
>  
> +static const struct of_device_id smc91x_match[] = {
> +	{ .compatible = "smsc,lan91c94", },
> +	{ .compatible = "smsc,lan91c111", },
> +	{},
> +}
> +MODULE_DEVICE_TABLE(of, smc91x_match);
> +
>  static struct dev_pm_ops smc_drv_pm_ops = {
>  	.suspend	= smc_drv_suspend,
>  	.resume		= smc_drv_resume,

You should not unconditionally put the 'of' device table into the
module image, otherwise the module will be marked as being able to
support OF based devices but the code to support that won't actually
be comiled into the module.

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

* [PATCH v4] smc91x: add devicetree support
  2011-01-26  3:45       ` David Miller
@ 2011-01-26  5:22         ` Thomas Chou
  2011-01-26  5:52           ` Grant Likely
  2011-01-26 15:17           ` Nicolas Pitre
  0 siblings, 2 replies; 10+ messages in thread
From: Thomas Chou @ 2011-01-26  5:22 UTC (permalink / raw)
  To: Grant Likely, David Miller
  Cc: linux-kernel, nios2-dev, devicetree-discuss, Nicolas Pitre,
	netdev, Thomas Chou

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v2 specify part numbers in compat as Grant suggested.
v3 more specific part name.
v4 include match table only for OF as David suggested.

 drivers/net/smc91x.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 726df61..43654a3 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -81,6 +81,7 @@ static const char version[] =
 #include <linux/ethtool.h>
 #include <linux/mii.h>
 #include <linux/workqueue.h>
+#include <linux/of.h>
 
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
@@ -2394,6 +2395,15 @@ static int smc_drv_resume(struct device *dev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id smc91x_match[] = {
+	{ .compatible = "smsc,lan91c94", },
+	{ .compatible = "smsc,lan91c111", },
+	{},
+}
+MODULE_DEVICE_TABLE(of, smc91x_match);
+#endif
+
 static struct dev_pm_ops smc_drv_pm_ops = {
 	.suspend	= smc_drv_suspend,
 	.resume		= smc_drv_resume,
@@ -2406,6 +2416,9 @@ static struct platform_driver smc_driver = {
 		.name	= CARDNAME,
 		.owner	= THIS_MODULE,
 		.pm	= &smc_drv_pm_ops,
+#ifdef CONFIG_OF
+		.of_match_table = smc91x_match,
+#endif
 	},
 };
 
-- 
1.7.3.5


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

* Re: [PATCH v4] smc91x: add devicetree support
  2011-01-26  5:22         ` [PATCH v4] " Thomas Chou
@ 2011-01-26  5:52           ` Grant Likely
  2011-01-26  6:42             ` David Miller
  2011-01-26 15:17           ` Nicolas Pitre
  1 sibling, 1 reply; 10+ messages in thread
From: Grant Likely @ 2011-01-26  5:52 UTC (permalink / raw)
  To: Thomas Chou
  Cc: David Miller, linux-kernel, nios2-dev, devicetree-discuss,
	Nicolas Pitre, netdev

On Tue, Jan 25, 2011 at 10:22 PM, Thomas Chou <thomas@wytron.com.tw> wrote:
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v2 specify part numbers in compat as Grant suggested.
> v3 more specific part name.
> v4 include match table only for OF as David suggested.
>
>  drivers/net/smc91x.c |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)

Looks okay to me.

Reviewed-by: Grant Likely <grant.likely@secretlab.ca>

>
> diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
> index 726df61..43654a3 100644
> --- a/drivers/net/smc91x.c
> +++ b/drivers/net/smc91x.c
> @@ -81,6 +81,7 @@ static const char version[] =
>  #include <linux/ethtool.h>
>  #include <linux/mii.h>
>  #include <linux/workqueue.h>
> +#include <linux/of.h>
>
>  #include <linux/netdevice.h>
>  #include <linux/etherdevice.h>
> @@ -2394,6 +2395,15 @@ static int smc_drv_resume(struct device *dev)
>        return 0;
>  }
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id smc91x_match[] = {
> +       { .compatible = "smsc,lan91c94", },
> +       { .compatible = "smsc,lan91c111", },
> +       {},
> +}
> +MODULE_DEVICE_TABLE(of, smc91x_match);
> +#endif
> +
>  static struct dev_pm_ops smc_drv_pm_ops = {
>        .suspend        = smc_drv_suspend,
>        .resume         = smc_drv_resume,
> @@ -2406,6 +2416,9 @@ static struct platform_driver smc_driver = {
>                .name   = CARDNAME,
>                .owner  = THIS_MODULE,
>                .pm     = &smc_drv_pm_ops,
> +#ifdef CONFIG_OF
> +               .of_match_table = smc91x_match,
> +#endif
>        },
>  };
>
> --
> 1.7.3.5
>
>



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

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

* Re: [PATCH v4] smc91x: add devicetree support
  2011-01-26  5:52           ` Grant Likely
@ 2011-01-26  6:42             ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2011-01-26  6:42 UTC (permalink / raw)
  To: grant.likely
  Cc: thomas, linux-kernel, nios2-dev, devicetree-discuss, nico, netdev

From: Grant Likely <grant.likely@secretlab.ca>
Date: Tue, 25 Jan 2011 22:52:36 -0700

> On Tue, Jan 25, 2011 at 10:22 PM, Thomas Chou <thomas@wytron.com.tw> wrote:
>> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
>> ---
>> v2 specify part numbers in compat as Grant suggested.
>> v3 more specific part name.
>> v4 include match table only for OF as David suggested.
>>
>>  drivers/net/smc91x.c |   13 +++++++++++++
>>  1 files changed, 13 insertions(+), 0 deletions(-)
> 
> Looks okay to me.
> 
> Reviewed-by: Grant Likely <grant.likely@secretlab.ca>

Applied to net-next-2.6, thanks.

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

* Re: [PATCH v4] smc91x: add devicetree support
  2011-01-26  5:22         ` [PATCH v4] " Thomas Chou
  2011-01-26  5:52           ` Grant Likely
@ 2011-01-26 15:17           ` Nicolas Pitre
  2011-01-26 15:32             ` Grant Likely
  1 sibling, 1 reply; 10+ messages in thread
From: Nicolas Pitre @ 2011-01-26 15:17 UTC (permalink / raw)
  To: Thomas Chou
  Cc: Grant Likely, David Miller, lkml, nios2-dev, devicetree-discuss, netdev

On Wed, 26 Jan 2011, Thomas Chou wrote:

> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v2 specify part numbers in compat as Grant suggested.
> v3 more specific part name.
> v4 include match table only for OF as David suggested.

The smc91x driver relies on many parameters which are platform specific, 
such as the bus width capabilities, register spacing due to special bus 
wiring, interrupt signal level, LED configuration, whether or not to 
configure the chip with a wait state, etc.  Will the device tree support 
take care of those things?


Nicolas

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

* Re: [PATCH v4] smc91x: add devicetree support
  2011-01-26 15:17           ` Nicolas Pitre
@ 2011-01-26 15:32             ` Grant Likely
  0 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2011-01-26 15:32 UTC (permalink / raw)
  To: Nicolas Pitre
  Cc: Thomas Chou, David Miller, lkml, nios2-dev, devicetree-discuss, netdev

On Wed, Jan 26, 2011 at 8:17 AM, Nicolas Pitre <nico@fluxnic.net> wrote:
> On Wed, 26 Jan 2011, Thomas Chou wrote:
>
>> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
>> ---
>> v2 specify part numbers in compat as Grant suggested.
>> v3 more specific part name.
>> v4 include match table only for OF as David suggested.
>
> The smc91x driver relies on many parameters which are platform specific,
> such as the bus width capabilities, register spacing due to special bus
> wiring, interrupt signal level, LED configuration, whether or not to
> configure the chip with a wait state, etc.  Will the device tree support
> take care of those things?

Short answer, yes

In general bindings are written and documented as they are needed.  In
this specific case,yes the device configuration should be encoded into
the device tree node.  It is okay for now to not wire up any of that
configuration if the defaults work for Thomas' platform, but to be
useful in the long run they do need to be added.

Typically a block or function call is added to the drivers .probe hook
to decode device tree data if the of_node pointer is set.

g.

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

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

end of thread, other threads:[~2011-01-26 15:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25  5:59 [PATCH] smc91x: add devicetree support Thomas Chou
2011-01-25  6:24 ` Grant Likely
2011-01-25  7:09   ` [PATCH v2] " Thomas Chou
2011-01-25 12:11     ` [PATCH v3] " Thomas Chou
2011-01-26  3:45       ` David Miller
2011-01-26  5:22         ` [PATCH v4] " Thomas Chou
2011-01-26  5:52           ` Grant Likely
2011-01-26  6:42             ` David Miller
2011-01-26 15:17           ` Nicolas Pitre
2011-01-26 15:32             ` Grant Likely

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

all inboxes | Powered by JetHome®