linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Stefan Wahren <wahrenst@gmx.net>,
	Matthias Brugger <matthias.bgg@kernel.org>,
	Matthias Brugger <mbrugger@suse.com>,
	"David S . Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: Doug Berger <opendmb@gmail.com>,
	netdev@vger.kernel.org, Eric Anholt <eric@anholt.net>,
	bcm-kernel-feedback-list@broadcom.com,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V3 net-next 5/7] net: bcmgenet: Refactor register access in bcmgenet_mii_config
Date: Sun, 10 Nov 2019 12:34:02 -0800	[thread overview]
Message-ID: <0a6ba358-b1a8-9a57-1e29-6443f07929e5@gmail.com> (raw)
In-Reply-To: <1573326009-2275-6-git-send-email-wahrenst@gmx.net>



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> The register access in bcmgenet_mii_config() is a little bit opaque and
> not easy to extend. In preparation for the missing RGMII PHY modes
> move the real register access to the end of the function. This make
> the code easier to read and extend.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

You will most likely have to resubmit this patch series after Doug's
recent GENET changes:

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=3a55402c93877d291b0a612d25edb03d1b4b93ac
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=6b6d017fccb4693767d2fcae9ef2fd05243748bb
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=0686bd9d5e6863f60e4bb1e78e6fe7bb217a0890

And while you are at it with this patch, you may even take a step
further and do something like this for the INTERNAL and MOCA PHYs:

diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c
b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index dbe18cdf6c1b..e363a824d662 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -218,6 +218,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool
init)

        switch (priv->phy_interface) {
        case PHY_INTERFACE_MODE_INTERNAL:
+               phy_name = "internal PHY";
        case PHY_INTERFACE_MODE_MOCA:
                /* Irrespective of the actually configured PHY speed (100 or
                 * 1000) GENETv4 only has an internal GPHY so we will
just end
@@ -229,14 +230,8 @@ int bcmgenet_mii_config(struct net_device *dev,
bool init)
                else
                        port_ctrl = PORT_MODE_INT_EPHY;

-               bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
-
-               if (priv->internal_phy) {
-                       phy_name = "internal PHY";
-               } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
+               if (!phy_name)
                        phy_name = "MoCA";
-                       bcmgenet_moca_phy_setup(priv);
-               }
                break;

such that all the port_ctrl and the phy_name are set within the same
location and the register write/configuration is done after the mode has
been determined.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-11-10 20:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-09 19:00 [PATCH V3 net-next 0/7] ARM: Enable GENET support for RPi 4 Stefan Wahren
2019-11-09 19:00 ` [PATCH V3 net-next 1/7] net: bcmgenet: Avoid touching non-existent interrupt Stefan Wahren
2019-11-10 20:23   ` Florian Fainelli
2019-11-10 20:57     ` Stefan Wahren
2019-11-10 21:10       ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 2/7] net: bcmgenet: Fix error handling on IRQ retrieval Stefan Wahren
2019-11-10 20:24   ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 3/7] dt-bindings: net: bcmgenet: Add BCM2711 support Stefan Wahren
2019-11-10 20:23   ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 4/7] " Stefan Wahren
2019-11-10 20:26   ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 5/7] net: bcmgenet: Refactor register access in bcmgenet_mii_config Stefan Wahren
2019-11-10 20:34   ` Florian Fainelli [this message]
2019-11-09 19:00 ` [PATCH V3 net-next 6/7] net: bcmgenet: Add RGMII_RXID and RGMII_ID support Stefan Wahren
2019-11-10 20:32   ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 7/7] ARM: dts: bcm2711-rpi-4: Enable GENET support Stefan Wahren
2019-11-10 20:26 ` [PATCH V3 net-next 0/7] ARM: Enable GENET support for RPi 4 Florian Fainelli

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=0a6ba358-b1a8-9a57-1e29-6443f07929e5@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=eric@anholt.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=matthias.bgg@kernel.org \
    --cc=mbrugger@suse.com \
    --cc=netdev@vger.kernel.org \
    --cc=nsaenzjulienne@suse.de \
    --cc=opendmb@gmail.com \
    --cc=wahrenst@gmx.net \
    /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).