linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"hanjun.guo@linaro.org" <hanjun.guo@linaro.org>,
	Mark Rutland <Mark.Rutland@arm.com>,
	"linaro-acpi@lists.linaro.org" <linaro-acpi@lists.linaro.org>,
	Will Deacon <Will.Deacon@arm.com>, Lv Zheng <lv.zheng@intel.com>,
	Rob Herring <robh@kernel.org>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Robert Moore <robert.moore@intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"grant.likely@linaro.org" <grant.likely@linaro.org>,
	Charles Garcia-Tobin <Charles.Garcia-Tobin@arm.com>,
	Robert Richter <rric@kernel.org>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <Marc.Zyngier@arm.com>,
	Liviu Dudau <Liviu.Dudau@arm.com>,
	Mark Brown <broonie@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"graeme.gregory@linaro.org" <graeme.gregory@linaro.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sudeep Holla <Sudeep.Holla@arm.com>,
	Olof Johansson <olof@lixom.net>
Subject: Re: [RFC PATCH for Juno 1/2] net: smsc911x add support for probing from ACPI
Date: Mon, 1 Sep 2014 18:27:11 +0100	[thread overview]
Message-ID: <20140901172711.GI608@arm.com> (raw)
In-Reply-To: <21764799.KDNDm9XRax@wuerfel>

On Mon, Sep 01, 2014 at 06:11:44PM +0100, Arnd Bergmann wrote:
> On Monday 01 September 2014 18:04:47 Catalin Marinas wrote:
> > On Mon, Sep 01, 2014 at 04:06:00PM +0100, Hanjun Guo wrote:
> > > +#ifdef CONFIG_ACPI
> > > +/* Configure some sensible defaults for ACPI mode */
> > > +static int smsc911x_probe_config_acpi(struct smsc911x_platform_config *config,
> > > +                                 acpi_handle *ahandle)
> > > +{
> > > +     if (!ahandle)
> > > +             return -ENOSYS;
> > > +
> > > +     config->phy_interface = PHY_INTERFACE_MODE_MII;
> > > +
> > > +     config->flags |= SMSC911X_USE_32BIT;
> > > +
> > > +     config->irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH;
> > > +
> > > +     config->irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL;
> > > +
> > > +     return 0;
> > > +}
> > > +#else
> > 
> > I don't like this and it shows issues we have with ACPI on certain ARM
> > platforms. You hard-code these values to match the Juno platform. What
> > if we get another SoC which has different configuration here? For DT, we
> > have the smsc911x_probe_config_dt() which reads the relevant information
> > from DT. I think this kind of configuration would be more suitable as
> > _DSD properties and sharing the similar names with DT (but we go back to
> > the question about who's in charge of the _DSD properties).
> 
> Good point, I totally missed that.
> 
> There is of course the possibility to set those values based on the
> acpi_device_id, but that is exactly the part that _DSD is trying to
> avoid.

I would prefer to avoid acpi_device_id checks. This would defeat the
alleged aim of ACPI to run newer hardware configuration with older
kernels.

> > >  static int smsc911x_drv_probe(struct platform_device *pdev)
> > >  {
> > >       struct device_node *np = pdev->dev.of_node;
> > > +     acpi_handle *ahandle = ACPI_HANDLE(&pdev->dev);
> > >       struct net_device *dev;
> > >       struct smsc911x_data *pdata;
> > >       struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev);
> > > @@ -2436,6 +2464,9 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
> > >       }
> > >  
> > >       retval = smsc911x_probe_config_dt(&pdata->config, np);
> > > +     if (retval)
> > > +             retval = smsc911x_probe_config_acpi(&pdata->config, ahandle);
> > > +
> > 
> > In most of the ACPI patches so far we check for ACPI first with DT as a
> > fall-back if ACPI is not enabled. This changes here.
> 
> Does this really make a difference?

Not the order (well, someone may think that if they unflatten the DT in
a vendor kernel even though it boot as ACPI, they could get away with a
mix of DT and ACPI ;)).

> > I would prefer
> > something which probes only ACPI if the ACPI is enabled (run-time, not
> > config) otherwise DT only. E.g.
> 
> (example missing?)

I was looking through the code and forgot. Something like:

	if (acpi_disabled)
		retval = smsc911x_probe_config_dt();
	else
		retval = smsc911x_probe_config_acpi();

> I think we should have the equivalent of of_have_populated_dt(), to
> check whether acpi is being used to boot, and have that new function
> be hardcoded to zero in case of !IS_ENABLED(CONFIG_ACPI).

I think you meant hardcoded to 1 when !ACPI. That would work as well.

-- 
Catalin

  reply	other threads:[~2014-09-01 17:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-01 15:05 [RFC PATCH for Juno 0/2] Drivers for Juno to boot from ACPI Hanjun Guo
2014-09-01 15:06 ` [RFC PATCH for Juno 1/2] net: smsc911x add support for probing " Hanjun Guo
2014-09-01 15:17   ` [Linaro-acpi] " Arnd Bergmann
2014-09-01 15:28     ` Graeme Gregory
2014-09-01 15:32       ` Arnd Bergmann
2014-09-01 16:53       ` Catalin Marinas
2014-09-01 16:58         ` Mark Brown
2014-09-01 17:08           ` Sudeep Holla
2014-09-01 17:14             ` Catalin Marinas
2014-09-01 17:33               ` Sudeep Holla
2014-09-01 17:03         ` Graeme Gregory
2014-09-15  4:08       ` Grant Likely
2014-09-15  9:24         ` Catalin Marinas
2014-09-01 17:04   ` Catalin Marinas
2014-09-01 17:11     ` Arnd Bergmann
2014-09-01 17:27       ` Catalin Marinas [this message]
2014-09-01 17:32       ` Graeme Gregory
2014-09-01 18:11         ` Mark Brown
2014-09-02 13:26         ` Catalin Marinas
2014-09-02 13:42           ` [Linaro-acpi] " Arnd Bergmann
2014-09-02 16:26             ` Mark Brown
2014-09-02 23:00               ` Rafael J. Wysocki
2014-09-03 15:09                 ` Arnd Bergmann
2014-09-09  6:51                   ` Jon Masters
2014-09-15  4:14       ` Grant Likely
2014-09-15 16:12         ` Mark Brown
2014-09-01 15:06 ` [RFC PATCH for Juno 2/2] tty: SBSA compatible UART Hanjun Guo
2014-09-01 15:26   ` Mark Brown
2014-09-01 17:12   ` Catalin Marinas
2014-09-01 17:18     ` Graeme Gregory
2014-09-01 17:29       ` Catalin Marinas
2014-09-01 15:29 ` [RFC PATCH for Juno 0/2] Drivers for Juno to boot from ACPI Arnd Bergmann

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=20140901172711.GI608@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=Charles.Garcia-Tobin@arm.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=Marc.Zyngier@arm.com \
    --cc=Mark.Rutland@arm.com \
    --cc=Sudeep.Holla@arm.com \
    --cc=Will.Deacon@arm.com \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=broonie@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=graeme.gregory@linaro.org \
    --cc=grant.likely@linaro.org \
    --cc=hanjun.guo@linaro.org \
    --cc=jason@lakedaemon.net \
    --cc=linaro-acpi@lists.linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=olof@lixom.net \
    --cc=rdunlap@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=robert.moore@intel.com \
    --cc=robh@kernel.org \
    --cc=rric@kernel.org \
    /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).