netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kenneth Klette Jonassen <kennetkl@ifi.uio.no>
To: igal.liberman@freescale.com
Cc: netdev <netdev@vger.kernel.org>,
	linuxppc-dev@lists.ozlabs.org, scottwood@freescale.com,
	madalin.bucur@freescale.com, pebolle@tiscali.nl,
	joakim.tjernlund@transmode.se, ppc@mindchasers.com,
	Stephen Hemminger <stephen@networkplumber.org>,
	David Miller <davem@davemloft.net>,
	Kapil Juneja <Kapil.Juneja@freescale.com>
Subject: Re: [v9, 3/6] fsl/fman: Add FMan MAC support
Date: Thu, 3 Dec 2015 23:42:03 +0100	[thread overview]
Message-ID: <CA++eYdvVe1qDhpZ8NGVnHeefBnpWMUyn4CFBu8g6TERAr-4B8Q@mail.gmail.com> (raw)
In-Reply-To: <1449127157-9400-4-git-send-email-igal.liberman@freescale.com>

> +/* PHY Control Register */
> +#define PHY_CR_PHY_RESET       0x8000
> +#define PHY_CR_SPEED0          0x2000
> +#define PHY_CR_ANE             0x1000
> +#define PHY_CR_RESET_AN                0x0200
> +#define PHY_CR_FULLDUPLEX      0x0100
> +#define PHY_CR_SPEED1          0x0040

Reuse defines in mii.h? BMCR_SPEED1000, BMCR_*, etc.

> +#define PHY_TBICON_SRESET      0x8000
> +#define PHY_TBICON_CLK_SEL     0x0020

This is similarly named TBICON_CLK_SELECT in freescale/gianfar.h.
Perhaps use the same names, and if possible, use a shared header file?

It would be nice to define all bits of the TBI registers, if only for
completeness. Maybe along with a succinct description, e.g., that
"sreset" means soft reset. (Or just call it TBICON_SOFT_RESET.)

> +/* MII Configuration Control Memory Map Registers */
> +struct dtsec_mii_regs {
> +/* dTSEC Memory Map registers */
> +struct dtsec_regs {
> +static int mii_write_reg(struct fman_mac *dtsec, u8 addr, u8 reg, u16 data)
> +static int mii_read_reg(struct fman_mac *dtsec, u8 addr, u8 reg, u16 *data)

Any chance this patch overlaps significantly with fsl_pq_mdio.c?

http://lxr.free-electrons.com/source/drivers/net/ethernet/freescale/fsl_pq_mdio.c?v=4.3#L44
fsl_pq_mdio_write(),
fsl_pq_mdio_read(),
etc.

> +       if (dtsec->phy_if == PHY_INTERFACE_MODE_SGMII) {
> +               u16 tmp_reg16;
> +
> +               /* Configure the TBI PHY Control Register */
> +               tmp_reg16 = PHY_TBICON_CLK_SEL | PHY_TBICON_SRESET;
> +               mii_write_reg(dtsec, (u8)dtsec_drv_param->tbipa, 17,
> +                             tmp_reg16);
> +
> +               tmp_reg16 = PHY_TBICON_CLK_SEL;
> +               mii_write_reg(dtsec, (u8)dtsec_drv_param->tbipa, 17,
> +                             tmp_reg16);
> +
> +               tmp_reg16 =
> +                   (PHY_CR_PHY_RESET | PHY_CR_ANE | PHY_CR_FULLDUPLEX |
> +                    PHY_CR_SPEED1);
> +               mii_write_reg(dtsec, (u8)dtsec_drv_param->tbipa, 0, tmp_reg16);
> +
> +               if (dtsec->basex_if)
> +                       tmp_reg16 = PHY_TBIANA_1000X;
> +               else
> +                       tmp_reg16 = PHY_TBIANA_SGMII;
> +               mii_write_reg(dtsec, (u8)dtsec_drv_param->tbipa, 4, tmp_reg16);
> +
> +               tmp_reg16 =
> +                   (PHY_CR_ANE | PHY_CR_RESET_AN | PHY_CR_FULLDUPLEX |
> +                    PHY_CR_SPEED1);
> +
> +               mii_write_reg(dtsec, (u8)dtsec_drv_param->tbipa, 0, tmp_reg16);
> +       }

Afaik, programming the TBI belongs in a separate PHY driver. See
drivers/net/phy/phy_device.c.

The same logic applies to gfar_configure_serdes() and uec_configure_serdes().

> +/* Internal PHY Registers - SGMII */
> +#define PHY_SGMII_CR_RESET_AN           0x0200
> +#define PHY_SGMII_CR_AN_ENABLE          0x1000

This namespace duplicates the intention of PHY_CR_*? (Which in turn
duplicated BMCR_*, ..)

  parent reply	other threads:[~2015-12-03 22:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03  7:19 [v9, 0/6] Freescale DPAA FMan igal.liberman
2015-12-03  7:19 ` [v9, 1/6] fsl/fman: Add FMan MURAM support igal.liberman
2015-12-03  7:19 ` [v9, 2/6] fsl/fman: Add FMan support igal.liberman
2015-12-03  7:19 ` [v9, 3/6] fsl/fman: Add FMan MAC support igal.liberman
2015-12-03 20:23   ` David Miller
2015-12-08 11:20     ` Liberman Igal
2015-12-03 22:42   ` Kenneth Klette Jonassen [this message]
2015-12-03  7:19 ` [v9, 4/6] fsl/fman: Add FMan SP support igal.liberman
2015-12-03  7:19 ` [v9, 5/6] fsl/fman: Add FMan Port Support igal.liberman
2015-12-03  7:19 ` [v9, 6/6] fsl/fman: Add FMan MAC driver igal.liberman
2015-12-08 20:18   ` Andy Fleming
2015-12-08 22:44     ` Scott Wood
2015-12-09  2:17       ` David Miller
2015-12-09 10:10         ` Madalin-Cristian Bucur
2015-12-09 17:07           ` Scott Wood
2015-12-15 11:55     ` Liberman Igal

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=CA++eYdvVe1qDhpZ8NGVnHeefBnpWMUyn4CFBu8g6TERAr-4B8Q@mail.gmail.com \
    --to=kennetkl@ifi.uio.no \
    --cc=Kapil.Juneja@freescale.com \
    --cc=davem@davemloft.net \
    --cc=igal.liberman@freescale.com \
    --cc=joakim.tjernlund@transmode.se \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=madalin.bucur@freescale.com \
    --cc=netdev@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=ppc@mindchasers.com \
    --cc=scottwood@freescale.com \
    --cc=stephen@networkplumber.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).