All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Calvin Johnson (OSS)" <calvin.johnson@oss.nxp.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "linux.cj@gmail.com" <linux.cj@gmail.com>,
	Jon Nettleton <jon@solid-run.com>,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	Makarand Pawagi <makarand.pawagi@nxp.com>,
	Cristi Sovaiala <cristian.sovaiala@nxp.com>,
	Laurentiu Tudor <laurentiu.tudor@nxp.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Varun Sethi <V.Sethi@nxp.com>,
	Pankaj Bansal <pankaj.bansal@nxp.com>,
	"Rajesh V. Bikkina" <rajesh.bikkina@nxp.com>,
	"Calvin Johnson (OSS)" <calvin.johnson@oss.nxp.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Madalin Bucur (OSS)" <madalin.bucur@oss.nxp.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>
Subject: RE: [PATCH v1 3/7] net/fsl: add ACPI support for mdio bus
Date: Tue, 4 Feb 2020 07:18:24 +0000	[thread overview]
Message-ID: <AM0PR04MB5636EA716C9D029C97C5854293030@AM0PR04MB5636.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <CAHp75VeRq8XT67LJOM+9R9xVpsfv7MxZpaCHYkfnCqAzgjXo9A@mail.gmail.com>


> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> Subject: Re: [PATCH v1 3/7] net/fsl: add ACPI support for mdio bus
> 
> On Fri, Jan 31, 2020 at 5:37 PM Calvin Johnson <calvin.johnson@nxp.com>
> wrote:
> >
> > From: Calvin Johnson <calvin.johnson@oss.nxp.com>
> >
> > Add ACPI support for MDIO bus registration while maintaining the
> > existing DT support.
> 
> ...
> 
> > -       ret = of_address_to_resource(np, 0, &res);
> > -       if (ret) {
> > +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +       if (!res) {
> >                 dev_err(&pdev->dev, "could not obtain address\n");
> > -               return ret;
> > +               return -ENODEV;
> >         }
> 
> ...
> 
> > -       snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", (unsigned long
> long)res.start);
> > +       snprintf(bus->id, MII_BUS_ID_SIZE, "%llx",
> > +                (unsigned long long)res->start);
> 
> Why this has been touched?

Without this change, I get:
---------------------------------------------------------
drivers/net/ethernet/freescale/xgmac_mdio.c: In function 'xgmac_mdio_probe':
drivers/net/ethernet/freescale/xgmac_mdio.c:269:27: error: request for member 'start' in something not a structure or union
    (unsigned long long)res.start);
                           ^
scripts/Makefile.build:265: recipe for target 'drivers/net/ethernet/freescale/xgmac_mdio.o' failed
make[4]: *** [drivers/net/ethernet/freescale/xgmac_mdio.o] Error 1
---------------------------------------------------------

On checking other files that calls platform_get_resource, I can see that this is the way they refer 'start'.

> 
> ...
> 
> > -       priv->mdio_base = of_iomap(np, 0);
> > +       priv->mdio_base = devm_ioremap_resource(&pdev->dev, res);
> >         if (!priv->mdio_base) {
> 
> Are you sure the check is correct now?
devm_ioremap_resource returns non-NULL error values. So, this doesn't look right. 
I'll work on it for v2.

> >                 ret = -ENOMEM;
> >                 goto err_ioremap;
> >         }
> 
> ...
> 
> >
> > -       priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
> > -                                                      "little-endian");
> > -
> > -       priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
> > -                                                 "fsl,erratum-a011043");
> > -
> > -       ret = of_mdiobus_register(bus, np);
> > -       if (ret) {
> > -               dev_err(&pdev->dev, "cannot register MDIO bus\n");
> 
> > +       if (is_of_node(pdev->dev.fwnode)) {
> 
> > +       } else if (is_acpi_node(pdev->dev.fwnode)) {
> 
> Oh, no, this is wrong. Pure approach AFAICS is to use fwnode API or device
> property API.
> 
> And actually what you need to include is rather <linux/property.h>, and not
> acpi.h.

Understood. I had got some issues while using fwnode API to handle DT case due to which
DT/ACPI checks were done and both are handled separately.  Let me see if I can root cause it.

> 
> > +       } else {
> > +               dev_err(&pdev->dev, "Cannot get cfg data from DT or ACPI\n");
> > +               ret = -ENXIO;
> >                 goto err_registration;
> >         }
> 
> > +static const struct acpi_device_id xgmac_mdio_acpi_match[] = {
> > +       {"NXP0006", 0}
> 
> How did you test this on platforms with the same IP and without device  of
> this ACPI ID present?

I didn't test it on any other platforms other than LX2160ARDB.  AFAIU, without
device of this ACPI ID present, the driver won't get probed. 
 
> (Hint: missed terminator)
static const struct acpi_device_id xgmac_mdio_acpi_match[] = {
        { "NXP0006", 0 },
        { }
};
Is this what you meant?

> 
> > +};
> > +MODULE_DEVICE_TABLE(acpi, xgmac_mdio_acpi_match);
> 
> > +               .acpi_match_table = ACPI_PTR(xgmac_mdio_acpi_match),
> 
> ACPI_PTR is not needed otherwise you will get a compiler warning.

No compiler warning was observed in both cases.
I can see other drivers using this macro.
drivers/net/ethernet/apm/xgene-v2/main.c:734:              .acpi_match_table = ACPI_PTR(xge_acpi_match),
drivers/net/ethernet/apm/xgene/xgene_enet_main.c:2172:             .acpi_match_table = ACPI_PTR(xgene_enet_acpi_match),
drivers/net/ethernet/hisilicon/hns/hns_enet.c:2445:             .acpi_match_table = ACPI_PTR(hns_enet_acpi_match),
drivers/net/ethernet/hisilicon/hns_mdio.c:566:             .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match),
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:5997:           .acpi_match_table = ACPI_PTR(mvpp2_acpi_match),
drivers/net/ethernet/qualcomm/emac/emac.c:766:          .acpi_match_table = ACPI_PTR(emac_acpi_match),
drivers/net/ethernet/smsc/smsc911x.c:2667:              .acpi_match_table = ACPI_PTR(smsc911x_acpi_match),
drivers/net/ethernet/socionext/netsec.c:2187:           .acpi_match_table = ACPI_PTR(netsec_acpi_ids),
drivers/net/phy/mdio-xgene.c:456:               .acpi_match_table = ACPI_PTR(xgene_mdio_acpi_match), 


Thanks
Calvin


  reply	other threads:[~2020-02-04  7:19 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 15:34 [PATCH v1 0/7] ACPI support for xgmac_mdio and dpaa2-mac drivers Calvin Johnson
2020-01-31 15:34 ` [PATCH v1 1/7] mdio_bus: Introduce fwnode MDIO helpers Calvin Johnson
2020-01-31 16:28   ` Andrew Lunn
2020-02-05  7:11     ` [EXT] " Calvin Johnson (OSS)
2020-02-03  9:49   ` kbuild test robot
2020-02-03  9:49     ` kbuild test robot
2020-02-05 14:17   ` Jeremy Linton
2020-02-07  9:42     ` [EXT] " Calvin Johnson (OSS)
2020-02-25 10:12       ` Calvin Johnson
2020-02-25 20:42         ` Jeremy Linton
2020-03-17 11:36   ` Calvin Johnson
2020-03-17 14:04     ` Andrew Lunn
2020-03-18  6:03       ` Calvin Johnson
2020-01-31 15:34 ` [PATCH v1 2/7] mdio_bus: modify fwnode phy related functions Calvin Johnson
2020-01-31 15:34 ` [PATCH v1 3/7] net/fsl: add ACPI support for mdio bus Calvin Johnson
2020-01-31 16:08   ` Andy Shevchenko
2020-02-04  7:18     ` Calvin Johnson (OSS) [this message]
2020-02-04 11:17       ` Andy Shevchenko
2020-02-03  3:44   ` Florian Fainelli
2020-02-04 18:46     ` Calvin Johnson
2020-01-31 15:34 ` [PATCH v1 4/7] device property: fwnode_get_phy_mode: Change API to solve int/unit warnings Calvin Johnson
2020-01-31 15:55   ` Andy Shevchenko
2020-02-03  9:13     ` Calvin Johnson (OSS)
2020-02-03  9:22       ` Andy Shevchenko
2020-02-03  2:32   ` kbuild test robot
2020-02-03  2:32     ` kbuild test robot
2020-02-03  8:41   ` kbuild test robot
2020-02-03  8:41     ` kbuild test robot
2020-01-31 15:34 ` [PATCH v1 5/7] device property: Introduce fwnode_phy_is_fixed_link() Calvin Johnson
2020-01-31 15:57   ` Andy Shevchenko
2020-02-03  9:21     ` Calvin Johnson (OSS)
2020-01-31 15:34 ` [PATCH v1 6/7] net: phylink: Introduce phylink_fwnode_phy_connect() Calvin Johnson
2020-02-03 18:21   ` kbuild test robot
2020-02-03 18:21     ` kbuild test robot
2020-02-03 18:41   ` Russell King - ARM Linux admin
2020-02-03 18:43     ` Russell King - ARM Linux admin
2020-02-05 11:33     ` [EXT] " Calvin Johnson (OSS)
2020-01-31 15:34 ` [PATCH v1 7/7] dpaa2-eth: Add ACPI support for DPAA2 MAC driver Calvin Johnson
2020-02-03 18:02 ` [PATCH v1 0/7] ACPI support for xgmac_mdio and dpaa2-mac drivers Florian Fainelli
2020-02-05  8:31   ` [EXT] " Calvin Johnson (OSS)

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=AM0PR04MB5636EA716C9D029C97C5854293030@AM0PR04MB5636.eurprd04.prod.outlook.com \
    --to=calvin.johnson@oss.nxp.com \
    --cc=V.Sethi@nxp.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=cristian.sovaiala@nxp.com \
    --cc=davem@davemloft.net \
    --cc=ioana.ciornei@nxp.com \
    --cc=jon@solid-run.com \
    --cc=laurentiu.tudor@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux.cj@gmail.com \
    --cc=linux@armlinux.org.uk \
    --cc=madalin.bucur@oss.nxp.com \
    --cc=makarand.pawagi@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=pankaj.bansal@nxp.com \
    --cc=rajesh.bikkina@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.