From: Andrew Lunn <andrew@lunn.ch>
To: David Thompson <davthompson@nvidia.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
limings@nvidia.com, Asmaa Mnebhi <asmaa@nvidia.com>
Subject: Re: [PATCH net-next v4] Add Mellanox BlueField Gigabit Ethernet driver
Date: Fri, 12 Mar 2021 03:19:30 +0100 [thread overview]
Message-ID: <YErPsvwjcmOMMIos@lunn.ch> (raw)
In-Reply-To: <1615380399-31970-1-git-send-email-davthompson@nvidia.com>
> +#define DRV_VERSION 1.19
> +static int mlxbf_gige_probe(struct platform_device *pdev)
> +{
> + unsigned int phy_int_gpio;
> + struct phy_device *phydev;
> + struct net_device *netdev;
> + struct resource *mac_res;
> + struct resource *llu_res;
> + struct resource *plu_res;
> + struct mlxbf_gige *priv;
> + void __iomem *llu_base;
> + void __iomem *plu_base;
> + void __iomem *base;
> + int addr, version;
> + u64 control;
> + int err = 0;
> +
> + if (device_property_read_u32(&pdev->dev, "version", &version)) {
> + dev_err(&pdev->dev, "Version Info not found\n");
> + return -EINVAL;
> + }
Is this a device tree property? ACPI? If it is device tree property
you need to document the binding, Documentation/devicetree/bindinds/...
> +
> + if (version != (int)DRV_VERSION) {
> + dev_err(&pdev->dev, "Version Mismatch. Expected %d Returned %d\n",
> + (int)DRV_VERSION, version);
> + return -EINVAL;
> + }
That is odd. Doubt odd. First of, why (int)1.19? Why not just set
DRV_VERSION to 1? This is the only place you use this, so the .19
seems pointless. Secondly, what does this version in DT/ACPI actually
represent? The hardware version? Then you should be using a compatible
string? Or read a hardware register which tells you have hardware
version.
> +
> + err = device_property_read_u32(&pdev->dev, "phy-int-gpio", &phy_int_gpio);
> + if (err < 0)
> + phy_int_gpio = MLXBF_GIGE_DEFAULT_PHY_INT_GPIO;
Again, this probably needs documenting. This is not how you do
interrupts with DT. I also don't think it is correct for ACPI, but i
don't know ACPI.
> + phydev = phy_find_first(priv->mdiobus);
> + if (!phydev) {
> + mlxbf_gige_mdio_remove(priv);
> + return -ENODEV;
> + }
If you are using DT, please use a phandle to the device on the MDIO
bus.
> + /* Sets netdev->phydev to phydev; which will eventually
> + * be used in ioctl calls.
> + * Cannot pass NULL handler.
> + */
> + err = phy_connect_direct(netdev, phydev,
> + mlxbf_gige_adjust_link,
> + PHY_INTERFACE_MODE_GMII);
It does a lot more than just set netdev->phydev. I'm not sure this
comment has any real value.
Andrew
next prev parent reply other threads:[~2021-03-12 2:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 12:46 [PATCH net-next v4] Add Mellanox BlueField Gigabit Ethernet driver David Thompson
2021-03-12 1:56 ` Andrew Lunn
2021-03-16 23:16 ` David Thompson
2021-03-12 2:19 ` Andrew Lunn [this message]
2021-03-16 23:28 ` David Thompson
2021-03-18 1:14 ` Andrew Lunn
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=YErPsvwjcmOMMIos@lunn.ch \
--to=andrew@lunn.ch \
--cc=asmaa@nvidia.com \
--cc=davem@davemloft.net \
--cc=davthompson@nvidia.com \
--cc=kuba@kernel.org \
--cc=limings@nvidia.com \
--cc=netdev@vger.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).