[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140901173245.GM2953@xora-haswell.xora.org.uk>
Date: Mon, 1 Sep 2014 18:32:45 +0100
From: Graeme Gregory <gg@...mlogic.co.uk>
To: Arnd Bergmann <arnd@...db.de>
Cc: linux-arm-kernel@...ts.infradead.org,
Catalin Marinas <catalin.marinas@....com>,
Hanjun Guo <hanjun.guo@...aro.org>,
Mark Rutland <Mark.Rutland@....com>,
"linaro-acpi@...ts.linaro.org" <linaro-acpi@...ts.linaro.org>,
Will Deacon <Will.Deacon@....com>,
Lv Zheng <lv.zheng@...el.com>, Rob Herring <robh@...nel.org>,
Lorenzo Pieralisi <Lorenzo.Pieralisi@....com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Robert Moore <robert.moore@...el.com>,
"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
"grant.likely@...aro.org" <grant.likely@...aro.org>,
Charles Garcia-Tobin <Charles.Garcia-Tobin@....com>,
Robert Richter <rric@...nel.org>,
Jason Cooper <jason@...edaemon.net>,
Marc Zyngier <Marc.Zyngier@....com>,
Liviu Dudau <Liviu.Dudau@....com>,
Mark Brown <broonie@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
"graeme.gregory@...aro.org" <graeme.gregory@...aro.org>,
Randy Dunlap <rdunlap@...radead.org>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Sudeep Holla <Sudeep.Holla@....com>,
Olof Johansson <olof@...om.net>
Subject: Re: [RFC PATCH for Juno 1/2] net: smsc911x add support for probing
from ACPI
On Mon, Sep 01, 2014 at 07:11:44PM +0200, 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.
>
This will of course most likely be replaced by _DSD values. I just
hardcoded for now as _DSD is not yet in the kernel and issues around
maintenance of bindings are not solved (unless this happened at KS where
I was not present).
> > > 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?
>
> > 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 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).
>
if (!acpi_disabled) is the equivalent if I understand you correctly.
But people until this point had expressed a preference for checking
.of_node and ACPI_HANDLE() to this point. This is obviously mutable
though depending on community preference.
Graeme
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists