From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Michael Walle <michael@walle.cc>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Vladimir Oltean <olteanv@gmail.com>,
Alex Marginean <alexandru.marginean@nxp.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Heiko Thiery <heiko.thiery@gmail.com>
Subject: Re: [PATCH net-next v4 1/3] net: dsa: felix: move USXGMII defines to common place
Date: Tue, 7 Jul 2020 10:18:31 +0100 [thread overview]
Message-ID: <20200707091831.GX1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200706220255.14738-2-michael@walle.cc>
On Tue, Jul 07, 2020 at 12:02:53AM +0200, Michael Walle wrote:
> The ENETC has the same PCS PHY and thus needs the same definitions. Move
> them into the common enetc_mdio.h header which has already the macros
> for the SGMII PCS.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> drivers/net/dsa/ocelot/felix_vsc9959.c | 21 ---------------------
> include/linux/fsl/enetc_mdio.h | 19 +++++++++++++++++++
> 2 files changed, 19 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
> index 19614537b1ba..53453c7015f6 100644
> --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
> +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
> @@ -16,29 +16,8 @@
> #define VSC9959_VCAP_IS2_CNT 1024
> #define VSC9959_VCAP_IS2_ENTRY_WIDTH 376
> #define VSC9959_VCAP_PORT_CNT 6
> -
> -/* TODO: should find a better place for these */
> -#define USXGMII_BMCR_RESET BIT(15)
> -#define USXGMII_BMCR_AN_EN BIT(12)
> -#define USXGMII_BMCR_RST_AN BIT(9)
> -#define USXGMII_BMSR_LNKS(status) (((status) & GENMASK(2, 2)) >> 2)
> -#define USXGMII_BMSR_AN_CMPL(status) (((status) & GENMASK(5, 5)) >> 5)
> -#define USXGMII_ADVERTISE_LNKS(x) (((x) << 15) & BIT(15))
> -#define USXGMII_ADVERTISE_FDX BIT(12)
> -#define USXGMII_ADVERTISE_SPEED(x) (((x) << 9) & GENMASK(11, 9))
> -#define USXGMII_LPA_LNKS(lpa) ((lpa) >> 15)
> -#define USXGMII_LPA_DUPLEX(lpa) (((lpa) & GENMASK(12, 12)) >> 12)
> -#define USXGMII_LPA_SPEED(lpa) (((lpa) & GENMASK(11, 9)) >> 9)
> -
> #define VSC9959_TAS_GCL_ENTRY_MAX 63
>
> -enum usxgmii_speed {
> - USXGMII_SPEED_10 = 0,
> - USXGMII_SPEED_100 = 1,
> - USXGMII_SPEED_1000 = 2,
> - USXGMII_SPEED_2500 = 4,
> -};
> -
> static const u32 vsc9959_ana_regmap[] = {
> REG(ANA_ADVLEARN, 0x0089a0),
> REG(ANA_VLANMASK, 0x0089a4),
> diff --git a/include/linux/fsl/enetc_mdio.h b/include/linux/fsl/enetc_mdio.h
> index 2d9203314865..611a7b0d5f10 100644
> --- a/include/linux/fsl/enetc_mdio.h
> +++ b/include/linux/fsl/enetc_mdio.h
> @@ -28,6 +28,25 @@ enum enetc_pcs_speed {
> ENETC_PCS_SPEED_2500 = 2,
> };
>
> +#define USXGMII_BMCR_RESET BIT(15)
> +#define USXGMII_BMCR_AN_EN BIT(12)
> +#define USXGMII_BMCR_RST_AN BIT(9)
Aren't these just redefinitions of the standard BMCR definitions?
> +#define USXGMII_BMSR_LNKS(status) (((status) & GENMASK(2, 2)) >> 2)
> +#define USXGMII_BMSR_AN_CMPL(status) (((status) & GENMASK(5, 5)) >> 5)
Aren't these just redefinitions of the standard BMSR definitions just
differently?
Maybe convert the code to use the standard definitions found in
include/uapi/linux/mii.h and include/uapi/linux/mdio.h?
> +#define USXGMII_ADVERTISE_LNKS(x) (((x) << 15) & BIT(15))
> +#define USXGMII_ADVERTISE_FDX BIT(12)
> +#define USXGMII_ADVERTISE_SPEED(x) (((x) << 9) & GENMASK(11, 9))
> +#define USXGMII_LPA_LNKS(lpa) ((lpa) >> 15)
> +#define USXGMII_LPA_DUPLEX(lpa) (((lpa) & GENMASK(12, 12)) >> 12)
> +#define USXGMII_LPA_SPEED(lpa) (((lpa) & GENMASK(11, 9)) >> 9)
> +
> +enum usxgmii_speed {
> + USXGMII_SPEED_10 = 0,
> + USXGMII_SPEED_100 = 1,
> + USXGMII_SPEED_1000 = 2,
> + USXGMII_SPEED_2500 = 4,
> +};
> +
I've asked in other patch sets for the USXGMII definitions to be moved
into some header that everyone can use - there is nothing enetc specific
about the USXGMII word definitions. Please move them to a header file
so that everyone can use them.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2020-07-07 9:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 22:02 [PATCH net-next v4 0/3] net: enetc: remove bootloader dependency Michael Walle
2020-07-06 22:02 ` [PATCH net-next v4 1/3] net: dsa: felix: move USXGMII defines to common place Michael Walle
2020-07-07 7:53 ` Claudiu Manoil
2020-07-07 9:18 ` Russell King - ARM Linux admin [this message]
2020-07-06 22:02 ` [PATCH net-next v4 2/3] net: enetc: Initialize SerDes for SGMII and USXGMII protocols Michael Walle
2020-07-07 7:53 ` Claudiu Manoil
2020-07-06 22:02 ` [PATCH net-next v4 3/3] net: enetc: Use DT protocol information to set up the ports Michael Walle
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=20200707091831.GX1551@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=alexandru.marginean@nxp.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=heiko.thiery@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael@walle.cc \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.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 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).