From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/5] drivers: net: phy: Add MDIO driver
Date: Wed, 1 Jun 2016 03:11:48 +0200 [thread overview]
Message-ID: <20160601011148.GD31982@lunn.ch> (raw)
In-Reply-To: <1464739840-21971-4-git-send-email-isubramanian@apm.com>
On Tue, May 31, 2016 at 05:10:38PM -0700, Iyappan Subramanian wrote:
> +static int xgene_mdio_reset(struct xgene_mdio_pdata *pdata)
> +{
> + int ret;
> +
> + if (pdata->mdio_id == XGENE_MDIO_RGMII) {
> + if (pdata->dev->of_node) {
> + clk_prepare_enable(pdata->clk);
> + clk_disable_unprepare(pdata->clk);
> + clk_prepare_enable(pdata->clk);
Hi Iyappan
Is that a workaround for a hardware problem? If so, i would suggest
adding a comment, to stop people submitting a patch simplifying it.
> +static int xgene_mdio_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct mii_bus *mdio_bus;
> + const struct of_device_id *of_id;
> + struct resource *res;
> + struct xgene_mdio_pdata *pdata;
> + void __iomem *csr_addr;
> + int mdio_id = 0, ret = 0;
> +
> + of_id = of_match_device(xgene_mdio_of_match, &pdev->dev);
> + if (mdio_id == XGENE_MDIO_RGMII) {
> + mdio_bus->read = xgene_mdio_rgmii_read;
> + mdio_bus->write = xgene_mdio_rgmii_write;
> + } else {
> + mdio_bus->read = xgene_xfi_mdio_read;
> + mdio_bus->write = xgene_xfi_mdio_write;
> + }
> +static const struct of_device_id xgene_mdio_of_match[] = {
> + {
> + .compatible = "apm,xgene-mdio-rgmii",
> + .data = (void *)XGENE_MDIO_RGMII
> + },
> + {
> + .compatible = "apm,xgene-mdio-xfi",
> + .data = (void *)XGENE_MDIO_XFI},
> + {},
> +};
This all makes me think you should have two separate MDIO drivers, one
for each compatible string. There is not that much shared code.
Andrew
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
To: Iyappan Subramanian <isubramanian-qTEPVZfXA3Y@public.gmane.org>
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
patches-qTEPVZfXA3Y@public.gmane.org,
matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH v2 3/5] drivers: net: phy: Add MDIO driver
Date: Wed, 1 Jun 2016 03:11:48 +0200 [thread overview]
Message-ID: <20160601011148.GD31982@lunn.ch> (raw)
In-Reply-To: <1464739840-21971-4-git-send-email-isubramanian-qTEPVZfXA3Y@public.gmane.org>
On Tue, May 31, 2016 at 05:10:38PM -0700, Iyappan Subramanian wrote:
> +static int xgene_mdio_reset(struct xgene_mdio_pdata *pdata)
> +{
> + int ret;
> +
> + if (pdata->mdio_id == XGENE_MDIO_RGMII) {
> + if (pdata->dev->of_node) {
> + clk_prepare_enable(pdata->clk);
> + clk_disable_unprepare(pdata->clk);
> + clk_prepare_enable(pdata->clk);
Hi Iyappan
Is that a workaround for a hardware problem? If so, i would suggest
adding a comment, to stop people submitting a patch simplifying it.
> +static int xgene_mdio_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct mii_bus *mdio_bus;
> + const struct of_device_id *of_id;
> + struct resource *res;
> + struct xgene_mdio_pdata *pdata;
> + void __iomem *csr_addr;
> + int mdio_id = 0, ret = 0;
> +
> + of_id = of_match_device(xgene_mdio_of_match, &pdev->dev);
> + if (mdio_id == XGENE_MDIO_RGMII) {
> + mdio_bus->read = xgene_mdio_rgmii_read;
> + mdio_bus->write = xgene_mdio_rgmii_write;
> + } else {
> + mdio_bus->read = xgene_xfi_mdio_read;
> + mdio_bus->write = xgene_xfi_mdio_write;
> + }
> +static const struct of_device_id xgene_mdio_of_match[] = {
> + {
> + .compatible = "apm,xgene-mdio-rgmii",
> + .data = (void *)XGENE_MDIO_RGMII
> + },
> + {
> + .compatible = "apm,xgene-mdio-xfi",
> + .data = (void *)XGENE_MDIO_XFI},
> + {},
> +};
This all makes me think you should have two separate MDIO drivers, one
for each compatible string. There is not that much shared code.
Andrew
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-06-01 1:11 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-01 0:10 [PATCH v2 0/5] drivers: net: xgene: Fix 1G hot-plug and module support Iyappan Subramanian
2016-06-01 0:10 ` Iyappan Subramanian
2016-06-01 0:10 ` [PATCH v2 1/5] drivers: net: xgene: MAC and PHY configuration changes Iyappan Subramanian
2016-06-01 0:10 ` Iyappan Subramanian
2016-06-01 0:10 ` [PATCH v2 2/5] drivers: net: xgene: Backward compatibility with older firmware Iyappan Subramanian
2016-06-01 0:10 ` Iyappan Subramanian
2016-06-01 0:10 ` [PATCH v2 3/5] drivers: net: phy: Add MDIO driver Iyappan Subramanian
2016-06-01 0:10 ` Iyappan Subramanian
2016-06-01 1:11 ` Andrew Lunn [this message]
2016-06-01 1:11 ` Andrew Lunn
2016-06-06 17:12 ` Iyappan Subramanian
2016-07-05 4:40 ` Iyappan Subramanian
2016-07-05 13:49 ` Andrew Lunn
2016-07-05 13:49 ` Andrew Lunn
2016-07-06 23:44 ` Iyappan Subramanian
2016-07-06 23:44 ` Iyappan Subramanian
2016-07-07 14:03 ` Andrew Lunn
2016-07-07 14:03 ` Andrew Lunn
2016-07-07 14:14 ` Russell King - ARM Linux
2016-07-07 14:14 ` Russell King - ARM Linux
2016-07-07 22:58 ` Iyappan Subramanian
2016-07-07 22:58 ` Iyappan Subramanian
2016-07-07 22:57 ` Iyappan Subramanian
2016-07-07 22:57 ` Iyappan Subramanian
2016-06-01 0:10 ` [PATCH v2 4/5] dtb: xgene: Add MDIO node Iyappan Subramanian
2016-06-01 0:10 ` Iyappan Subramanian
2016-06-01 0:10 ` [PATCH v2 5/5] drivers: net: xgene: Fix module load/unload crash Iyappan Subramanian
2016-06-01 0:10 ` Iyappan Subramanian
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=20160601011148.GD31982@lunn.ch \
--to=andrew@lunn.ch \
--cc=linux-arm-kernel@lists.infradead.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 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.