All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Six <mario.six@gdsys.cc>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 02/18] net: phy: Support Marvell 88E1680
Date: Wed, 11 Jan 2017 16:00:46 +0100	[thread overview]
Message-ID: <20170111150102.7399-3-mario.six@gdsys.cc> (raw)
In-Reply-To: <20170111150102.7399-1-mario.six@gdsys.cc>

From: Dirk Eibach <dirk.eibach@gdsys.cc>

Add support for Marvell 88E1680 Integrated Octal
10/100/1000 Mbps Energy Efficient Ethernet Transceiver.

Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
---
Changes in v2:

* Switched to usage of pre-defined constant names where possible
* Added error handling for genphy_config_aneg call
---
 drivers/net/phy/marvell.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 4eeb0f6..c3058a4 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -480,6 +480,49 @@ static int m88e1310_config(struct phy_device *phydev)
 	return genphy_config_aneg(phydev);
 }

+static int m88e1680_config(struct phy_device *phydev)
+{
+	/*
+	 * As per Marvell Release Notes - Alaska V 88E1680 Rev A2
+	 * Errata Section 4.1
+	 */
+	u16 reg;
+	int res;
+
+	/* Matrix LED mode (not neede if single LED mode is used */
+	phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x0004);
+	reg = phy_read(phydev, MDIO_DEVAD_NONE, 27);
+	reg |= (1 << 5);
+	phy_write(phydev, MDIO_DEVAD_NONE, 27, reg);
+
+	/* QSGMII TX amplitude change */
+	phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x00fd);
+	phy_write(phydev, MDIO_DEVAD_NONE,  8, 0x0b53);
+	phy_write(phydev, MDIO_DEVAD_NONE,  7, 0x200d);
+	phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x0000);
+
+	/* EEE initialization */
+	phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x00ff);
+	phy_write(phydev, MDIO_DEVAD_NONE, 17, 0xb030);
+	phy_write(phydev, MDIO_DEVAD_NONE, 16, 0x215c);
+	phy_write(phydev, MDIO_DEVAD_NONE, 22, 0x00fc);
+	phy_write(phydev, MDIO_DEVAD_NONE, 24, 0x888c);
+	phy_write(phydev, MDIO_DEVAD_NONE, 25, 0x888c);
+	phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x0000);
+	phy_write(phydev, MDIO_DEVAD_NONE,  0, 0x9140);
+
+	res = genphy_config_aneg(phydev);
+	if (res < 0)
+		return res;
+
+	/* soft reset */
+	reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
+	reg |= BMCR_RESET;
+	phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, reg);
+
+	return 0;
+}
+
 static struct phy_driver M88E1011S_driver = {
 	.name = "Marvell 88E1011S",
 	.uid = 0x1410c60,
@@ -580,6 +623,16 @@ static struct phy_driver M88E1310_driver = {
 	.shutdown = &genphy_shutdown,
 };

+static struct phy_driver M88E1680_driver = {
+	.name = "Marvell 88E1680",
+	.uid = 0x1410ed0,
+	.mask = 0xffffff0,
+	.features = PHY_GBIT_FEATURES,
+	.config = &m88e1680_config,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
 int phy_marvell_init(void)
 {
 	phy_register(&M88E1310_driver);
@@ -592,6 +645,7 @@ int phy_marvell_init(void)
 	phy_register(&M88E1011S_driver);
 	phy_register(&M88E1510_driver);
 	phy_register(&M88E1518_driver);
+	phy_register(&M88E1680_driver);

 	return 0;
 }
--
2.9.0

  parent reply	other threads:[~2017-01-11 15:00 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 15:00 [U-Boot] [PATCH v2 00/18] arm: mvebu: Add gdsys ControlCenter-Compact board Mario Six
2017-01-11 15:00 ` [U-Boot] [PATCH v2 01/18] pci: mvebu: Fix Armada 38x support Mario Six
2017-01-18 15:56   ` Stefan Roese
2017-02-01 11:40   ` Stefan Roese
2017-01-11 15:00 ` Mario Six [this message]
2017-01-18 15:57   ` [U-Boot] [PATCH v2 02/18] net: phy: Support Marvell 88E1680 Stefan Roese
2017-01-18 22:45     ` Joe Hershberger
2017-01-18 22:48   ` Joe Hershberger
2017-02-01 11:40   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 03/18] mvebu: Add board_pex_config() Mario Six
2017-01-18 15:58   ` Stefan Roese
2017-02-01 11:40   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 04/18] arm: mvebu: spl.c: Remove useless gd declaration Mario Six
2017-01-18 15:58   ` Stefan Roese
2017-02-01 11:40   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 05/18] dm: Add callback to modify the device tree Mario Six
2017-01-18 16:03   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 06/18] lib: tpm: Add command to flush resources Mario Six
2017-01-18 16:07   ` Stefan Roese
2017-01-19 13:57   ` Simon Glass
2017-02-01 11:41   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 07/18] core: device: Add dev_get_by_ofname function Mario Six
2017-01-18 16:23   ` Stefan Roese
2017-01-19 13:57     ` Simon Glass
2017-01-11 15:00 ` [U-Boot] [PATCH v2 08/18] gpio: Add gpio_request_simple function Mario Six
2017-01-18 16:34   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 09/18] tools: kwbimage: Fix dest addr Mario Six
2017-01-18 16:36   ` Stefan Roese
2017-02-01 11:41   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 10/18] tools: kwbimage: Fix style violations Mario Six
2017-01-18 16:37   ` Stefan Roese
2017-02-01 11:41   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 11/18] tools: kwbimage: Fix arithmetic with void pointers Mario Six
2017-01-18 16:38   ` Stefan Roese
2017-02-01 11:41   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 12/18] tools: kwbimage: Reduce scope of variables Mario Six
2017-01-18 16:39   ` Stefan Roese
2017-02-01 11:41   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 13/18] tools: kwbimage: Remove unused parameter Mario Six
2017-01-18 16:39   ` Stefan Roese
2017-02-01 11:42   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 14/18] tools: kwbimage: Factor out add_binary_header_v1 Mario Six
2017-01-18 16:40   ` Stefan Roese
2017-02-01 11:42   ` Stefan Roese
2017-01-11 15:00 ` [U-Boot] [PATCH v2 15/18] tools: kwbimage: Refactor line parsing and fix error Mario Six
2017-01-18 16:47   ` Stefan Roese
2017-02-01 11:42   ` Stefan Roese
2017-01-11 15:01 ` [U-Boot] [PATCH v2 16/18] arm: mvebu: Implement secure boot Mario Six
2017-01-18 16:58   ` Stefan Roese
2017-01-19 13:57   ` Simon Glass
2017-02-01 11:42   ` Stefan Roese
2017-01-11 15:01 ` [U-Boot] [PATCH v2 17/18] arm: mvebu: Add gdsys ControlCenter-Compact board Mario Six
2017-01-18 17:09   ` Stefan Roese
2017-01-11 15:01 ` [U-Boot] [PATCH v2 18/18] controlcenterdc: Make secure boot available Mario Six
2017-01-18 17:10   ` Stefan Roese

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=20170111150102.7399-3-mario.six@gdsys.cc \
    --to=mario.six@gdsys.cc \
    --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.