netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Jeremy Linton <Jeremy.Linton@arm.com>,
	"steve.glendinning@shawell.net" <steve.glendinning@shawell.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"rafael.j.wysocki@intel.com" <rafael.j.wysocki@intel.com>,
	"suravee.suthikulpanit@amd.com" <suravee.suthikulpanit@amd.com>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	"grant.likely@linaro.org" <grant.likely@linaro.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 2/2] Convert smsc911x to use ACPI as well as DT
Date: Thu, 13 Aug 2015 10:01:17 +0100	[thread overview]
Message-ID: <20150813090117.GA13833@red-moon> (raw)
In-Reply-To: <20150813082759.GB5468@xora-haswell.xora.org.uk>

On Thu, Aug 13, 2015 at 09:27:59AM +0100, Graeme Gregory wrote:
> On Wed, Aug 12, 2015 at 05:06:27PM -0500, Jeremy Linton wrote:
> > Add ACPI bindings for the smsc911x driver. Convert the DT specific calls
> > to nonspecific device* calls, This allows the driver to work
> > with both ACPI and DT configurations. Ethernet should now work when using
> > ACPI on ARM Juno.

Last sentence does not belong in the commit log.

> > 
> > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> 
> The code looks fine to me.
> 
> Currently the compulsary DT properties seem to match the "approved" ACPI
> NIC properties from here
> 
> http://www.uefi.org/sites/default/files/resources/nic-request-v2.pdf

What about _DSD device specific properties (eg "smsc,save-mac-address") ?
Are we taking 1:1 translation between DT and ACPI for granted ?

I thought some process must be put in place to define the corresponding
bindings in ACPI before starting this mechanical translation or maybe
I missed something, I would like to understand.

How does the device specific _DSD definitions work in ACPI world ? Where
are they published ? How will we translate those to DT bindings if there
is need ?

Lorenzo

> Reviewed-by: Graeme Gregory <graeme.gregory@linaro.org>
> 
> Thanks
> 
> > ---
> >  drivers/net/ethernet/smsc/smsc911x.c | 48 +++++++++++++++++-------------------
> >  1 file changed, 22 insertions(+), 26 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
> > index 959aeea..0f21aa3 100644
> > --- a/drivers/net/ethernet/smsc/smsc911x.c
> > +++ b/drivers/net/ethernet/smsc/smsc911x.c
> > @@ -59,7 +59,9 @@
> >  #include <linux/of_device.h>
> >  #include <linux/of_gpio.h>
> >  #include <linux/of_net.h>
> > +#include <linux/acpi.h>
> >  #include <linux/pm_runtime.h>
> > +#include <linux/property.h>
> >  
> >  #include "smsc911x.h"
> >  
> > @@ -2362,59 +2364,46 @@ static const struct smsc911x_ops shifted_smsc911x_ops = {
> >  	.tx_writefifo = smsc911x_tx_writefifo_shift,
> >  };
> >  
> > -#ifdef CONFIG_OF
> > -static int smsc911x_probe_config_dt(struct smsc911x_platform_config *config,
> > -				    struct device_node *np)
> > +static int smsc911x_probe_config(struct smsc911x_platform_config *config,
> > +				 struct device *dev)
> >  {
> > -	const char *mac;
> >  	u32 width = 0;
> >  
> > -	if (!np)
> > +	if (!dev)
> >  		return -ENODEV;
> >  
> > -	config->phy_interface = of_get_phy_mode(np);
> > +	config->phy_interface = device_get_phy_mode(dev);
> >  
> > -	mac = of_get_mac_address(np);
> > -	if (mac)
> > -		memcpy(config->mac, mac, ETH_ALEN);
> > +	device_get_mac_address(dev, config->mac, ETH_ALEN);
> >  
> > -	of_property_read_u32(np, "reg-shift", &config->shift);
> > +	device_property_read_u32(dev, "reg-shift", &config->shift);
> >  
> > -	of_property_read_u32(np, "reg-io-width", &width);
> > +	device_property_read_u32(dev, "reg-io-width", &width);
> >  	if (width == 4)
> >  		config->flags |= SMSC911X_USE_32BIT;
> >  	else
> >  		config->flags |= SMSC911X_USE_16BIT;
> >  
> > -	if (of_get_property(np, "smsc,irq-active-high", NULL))
> > +	if (device_property_present(dev, "smsc,irq-active-high"))
> >  		config->irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH;
> >  
> > -	if (of_get_property(np, "smsc,irq-push-pull", NULL))
> > +	if (device_property_present(dev, "smsc,irq-push-pull"))
> >  		config->irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL;
> >  
> > -	if (of_get_property(np, "smsc,force-internal-phy", NULL))
> > +	if (device_property_present(dev, "smsc,force-internal-phy"))
> >  		config->flags |= SMSC911X_FORCE_INTERNAL_PHY;
> >  
> > -	if (of_get_property(np, "smsc,force-external-phy", NULL))
> > +	if (device_property_present(dev, "smsc,force-external-phy"))
> >  		config->flags |= SMSC911X_FORCE_EXTERNAL_PHY;
> >  
> > -	if (of_get_property(np, "smsc,save-mac-address", NULL))
> > +	if (device_property_present(dev, "smsc,save-mac-address"))
> >  		config->flags |= SMSC911X_SAVE_MAC_ADDRESS;
> >  
> >  	return 0;
> >  }
> > -#else
> > -static inline int smsc911x_probe_config_dt(
> > -				struct smsc911x_platform_config *config,
> > -				struct device_node *np)
> > -{
> > -	return -ENODEV;
> > -}
> > -#endif /* CONFIG_OF */
> >  
> >  static int smsc911x_drv_probe(struct platform_device *pdev)
> >  {
> > -	struct device_node *np = pdev->dev.of_node;
> >  	struct net_device *dev;
> >  	struct smsc911x_data *pdata;
> >  	struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev);
> > @@ -2478,7 +2467,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
> >  		goto out_disable_resources;
> >  	}
> >  
> > -	retval = smsc911x_probe_config_dt(&pdata->config, np);
> > +	retval = smsc911x_probe_config(&pdata->config, &pdev->dev);
> >  	if (retval && config) {
> >  		/* copy config parameters across to pdata */
> >  		memcpy(&pdata->config, config, sizeof(pdata->config));
> > @@ -2654,6 +2643,12 @@ static const struct of_device_id smsc911x_dt_ids[] = {
> >  MODULE_DEVICE_TABLE(of, smsc911x_dt_ids);
> >  #endif
> >  
> > +static const struct acpi_device_id smsc911x_acpi_match[] = {
> > +	{ "ARMH9118", 0 },
> > +	{ }
> > +};
> > +MODULE_DEVICE_TABLE(acpi, smsc911x_acpi_match);
> > +
> >  static struct platform_driver smsc911x_driver = {
> >  	.probe = smsc911x_drv_probe,
> >  	.remove = smsc911x_drv_remove,
> > @@ -2661,6 +2656,7 @@ static struct platform_driver smsc911x_driver = {
> >  		.name	= SMSC_CHIPNAME,
> >  		.pm	= SMSC911X_PM_OPS,
> >  		.of_match_table = of_match_ptr(smsc911x_dt_ids),
> > +		.acpi_match_table = ACPI_PTR(smsc911x_acpi_match),
> >  	},
> >  };
> >  
> > -- 
> > 2.4.3
> > 
> > 
> > 
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

  reply	other threads:[~2015-08-13  9:01 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 22:06 [PATCH 0/2] Enable smsc911x for use with ACPI Jeremy Linton
2015-08-12 22:06 ` [PATCH 1/2] Add a matching set of device_ functions for determining mac/phy Jeremy Linton
2015-08-12 22:13   ` Florian Fainelli
2015-08-14 15:55     ` Jeremy Linton
2015-08-13 11:57   ` Robin Murphy
2015-08-13 14:24     ` Jeremy Linton
2015-08-12 22:06 ` [PATCH 2/2] Convert smsc911x to use ACPI as well as DT Jeremy Linton
2015-08-13  8:27   ` Graeme Gregory
2015-08-13  9:01     ` Lorenzo Pieralisi [this message]
2015-08-13  9:38       ` Graeme Gregory
2015-08-13 10:30         ` Lorenzo Pieralisi
2015-09-09 16:10   ` Marc Zyngier
2015-09-23 17:22     ` Jeremy Linton
2015-09-23 17:46       ` Marc Zyngier
2015-09-23 17:57       ` Sudeep Holla
2015-09-24  9:20         ` Catalin Marinas
2015-11-02 15:48     ` Jeremy Linton
2015-09-23 18:41   ` David Woodhouse
2015-09-23 20:51     ` Rafael J. Wysocki
2015-09-23 21:03       ` David Woodhouse
2015-09-23 23:56         ` Hanjun Guo
2015-09-24  8:16           ` David Woodhouse
2015-09-24 10:31             ` Catalin Marinas
2015-09-24 11:52               ` David Woodhouse
2015-09-24 14:01                 ` Lorenzo Pieralisi
2015-09-24 14:31                   ` David Woodhouse
2015-09-24 15:15                 ` Catalin Marinas
2015-09-24 18:10                   ` David Woodhouse
2015-09-25 15:28                     ` Catalin Marinas
2015-09-26  2:16                       ` Rafael J. Wysocki
2015-09-26 15:20                       ` David Woodhouse
2015-10-01  2:23                       ` Al Stone
2015-10-06  0:20                         ` Charles Garcia-Tobin
2015-10-06 11:08                           ` David Woodhouse
2015-10-08  0:11                             ` Rafael J. Wysocki
2015-08-14  0:00 ` [PATCH 0/2] Enable smsc911x for use with ACPI David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150813090117.GA13833@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=Jeremy.Linton@arm.com \
    --cc=gg@slimlogic.co.uk \
    --cc=grant.likely@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=steve.glendinning@shawell.net \
    --cc=suravee.suthikulpanit@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).