From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 05/12] net: phy: ti: Add lane swapping support in the DP83867 TI's PHY driver
Date: Fri, 15 Jun 2018 09:24:03 +0200 [thread overview]
Message-ID: <20180615092403.756ef68f@jawa> (raw)
In-Reply-To: <1528969736-44037-5-git-send-email-j.hagemann@phytec.de>
Hi Janine,
> This patch adds support for enabling or disabling the lane swapping
> (called "port mirroring" in PHY's CFG4 register) feature of the
> DP83867 TI's PHY device.
>
> One use case is when bootstrap configuration enables this feature
> (because of e.g. LED_0 wrong wiring) so then one needs to disable it
> in software (at u-boot/Linux).
>
> Based on commit 'fc6d39c39581f3c12c95f166ce95ef8beb2047e8' of mainline
> linux kernel
>
> Signed-off-by: Janine Hagemann <j.hagemann@phytec.de>
Thanks for bringing it into u-boot.
Acked-by: Lukasz Majewski <lukma@denx.de>
> ---
> drivers/net/phy/ti.c | 40 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
> index d7ae881..086ea4a 100644
> --- a/drivers/net/phy/ti.c
> +++ b/drivers/net/phy/ti.c
> @@ -24,6 +24,7 @@ DECLARE_GLOBAL_DATA_PTR;
> #define DP83867_CTRL 0x1f
>
> /* Extended Registers */
> +#define DP83867_CFG4 0x0031
> #define DP83867_RGMIICTL 0x0032
> #define DP83867_RGMIIDCTL 0x0086
> #define DP83867_IO_MUX_CFG 0x0170
> @@ -92,11 +93,21 @@ DECLARE_GLOBAL_DATA_PTR;
> #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX 0x0
> #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN 0x1f
>
> +/* CFG4 bits */
> +#define DP83867_CFG4_PORT_MIRROR_EN BIT(0)
> +
> +enum {
> + DP83867_PORT_MIRRORING_KEEP,
> + DP83867_PORT_MIRRORING_EN,
> + DP83867_PORT_MIRRORING_DIS,
> +};
> +
> struct dp83867_private {
> int rx_id_delay;
> int tx_id_delay;
> int fifo_depth;
> int io_impedance;
> + int port_mirroring;
> };
>
> /**
> @@ -165,6 +176,26 @@ void phy_write_mmd_indirect(struct phy_device
> *phydev, int prtad, phy_write(phydev, addr, MII_MMD_DATA, data);
> }
>
> +static int dp83867_config_port_mirroring(struct phy_device *phydev)
> +{
> + struct dp83867_private *dp83867 =
> + (struct dp83867_private *)phydev->priv;
> + u16 val;
> +
> + val = phy_read_mmd_indirect(phydev, DP83867_CFG4,
> DP83867_DEVADDR,
> + phydev->addr);
> +
> + if (dp83867->port_mirroring == DP83867_PORT_MIRRORING_EN)
> + val |= DP83867_CFG4_PORT_MIRROR_EN;
> + else
> + val &= ~DP83867_CFG4_PORT_MIRROR_EN;
> +
> + phy_write_mmd_indirect(phydev, DP83867_CFG4, DP83867_DEVADDR,
> + phydev->addr, val);
> +
> + return 0;
> +}
> +
> #if defined(CONFIG_DM_ETH)
> /**
> * dp83867_data_init - Convenience function for setting PHY specific
> data @@ -191,6 +222,12 @@ static int dp83867_of_init(struct
> phy_device *phydev) dp83867->tx_id_delay =
> fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
> "ti,tx-internal-delay", -1);
> + if (fdtdec_get_bool(fdt, node, "enet-phy-lane-swap"))
> + dp83867->port_mirroring = DP83867_PORT_MIRRORING_EN;
> +
> + if (fdtdec_get_bool(fdt, node, "enet-phy-lane-no-swap"))
> + dp83867->port_mirroring = DP83867_PORT_MIRRORING_DIS;
> +
> dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob,
> dev_of_offset(dev), "ti,fifo-depth", -1);
>
> @@ -307,6 +344,9 @@ static int dp83867_config(struct phy_device
> *phydev) }
> }
>
> + if (dp83867->port_mirroring != DP83867_PORT_MIRRORING_KEEP)
> + dp83867_config_port_mirroring(phydev);
> +
> genphy_config_aneg(phydev);
> return 0;
>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180615/d0a644e9/attachment.sig>
next prev parent reply other threads:[~2018-06-15 7:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-14 9:48 [U-Boot] [PATCH 01/12] arch: arm: mach-rockchip: rk3288: Enable regulators in board_init Janine Hagemann
2018-06-14 9:48 ` [U-Boot] [PATCH 02/12] config: phycore-rk3288_defconfig: add PHY_TI Janine Hagemann
2018-06-14 9:48 ` [U-Boot] [PATCH 03/12] net: gmac_rockchip: Fix a register write in rk3328_gmac_set_to_rgmii Janine Hagemann
2018-06-14 17:39 ` Joe Hershberger
2018-06-14 18:12 ` Dr. Philipp Tomsich
2018-06-14 18:26 ` Joe Hershberger
2018-07-13 10:42 ` Dr. Philipp Tomsich
2018-06-14 9:48 ` [U-Boot] [PATCH 04/12] Net: phy: ti: Fix fifo_depth register write Janine Hagemann
2018-06-14 9:48 ` [U-Boot] [PATCH 05/12] net: phy: ti: Add lane swapping support in the DP83867 TI's PHY driver Janine Hagemann
2018-06-14 17:47 ` Joe Hershberger
2018-06-15 7:24 ` Lukasz Majewski [this message]
2018-06-14 9:48 ` [U-Boot] [PATCH 06/12] net: phy: ti: Recover from "port mirroring" N/A MODE4 Janine Hagemann
2018-06-14 17:49 ` Joe Hershberger
2018-06-15 7:24 ` Lukasz Majewski
2018-06-14 9:48 ` [U-Boot] [PATCH 07/12] net: phy: ti: add workaround for incorrect RX_CTRL pin strap Janine Hagemann
2018-06-14 17:51 ` Joe Hershberger
2018-06-14 9:48 ` [U-Boot] [PATCH 08/12] net: gmac_rockchip: Add handeling for RGMII_ID/RXID/TXID Janine Hagemann
2018-06-14 17:53 ` Joe Hershberger
2018-06-14 9:48 ` [U-Boot] [PATCH 09/12] drivers: net: designware: Add reading of DT phy-handle node Janine Hagemann
2018-06-14 17:53 ` Joe Hershberger
2018-06-14 9:48 ` [U-Boot] [PATCH 10/12] net: phy: ti: Add binding for the CLK_OUT pin muxing Janine Hagemann
2018-06-14 18:01 ` Joe Hershberger
2018-06-14 9:48 ` [U-Boot] [PATCH 11/12] ARM: dts: rockchip: ADD dp83867 CLK_OUT muxing Janine Hagemann
2018-06-14 9:48 ` [U-Boot] [PATCH 12/12] rockchip: rk3288-phycore: set flash1 iodomain to 1.8V Janine Hagemann
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=20180615092403.756ef68f@jawa \
--to=lukma@denx.de \
--cc=u-boot@lists.denx.de \
/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.