All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/7] fm-eth: add function fm_info_get_phy_address()
Date: Tue, 14 Aug 2012 11:47:22 -0500	[thread overview]
Message-ID: <1344962847-15448-2-git-send-email-timur@freescale.com> (raw)
In-Reply-To: <1344962847-15448-1-git-send-email-timur@freescale.com>

Function fm_info_get_phy_address() returns the PHY address for a given
Fman port.  This is handy when the MDIO code needs to fixup the Ethernet
nodes in the device tree to point to PHY nodes for a specific PHY address.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 drivers/net/fm/init.c |   16 ++++++++++++++++
 include/fm_eth.h      |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/net/fm/init.c b/drivers/net/fm/init.c
index 9834cd9..8a5311c 100644
--- a/drivers/net/fm/init.c
+++ b/drivers/net/fm/init.c
@@ -155,6 +155,22 @@ void fm_info_set_phy_address(enum fm_port port, int address)
 }
 
 /*
+ * Returns the PHY address for a given Fman port
+ *
+ * The port must be set via a prior call to fm_info_set_phy_address().
+ * A negative error code is returned if the port is invalid.
+ */
+int fm_info_get_phy_address(enum fm_port port)
+{
+	int i = fm_port_to_index(port);
+
+	if (i == -1)
+		return -1;
+
+	return fm_info[i].phy_addr;
+}
+
+/*
  * Returns the type of the data interface between the given MAC and its PHY.
  * This is typically determined by the RCW.
  */
diff --git a/include/fm_eth.h b/include/fm_eth.h
index 05121ea..e56541d 100644
--- a/include/fm_eth.h
+++ b/include/fm_eth.h
@@ -110,6 +110,7 @@ void fman_enet_init(void);
 void fdt_fixup_fman_ethernet(void *fdt);
 phy_interface_t fm_info_get_enet_if(enum fm_port port);
 void fm_info_set_phy_address(enum fm_port port, int address);
+int fm_info_get_phy_address(enum fm_port port);
 void fm_info_set_mdio(enum fm_port port, struct mii_dev *bus);
 void fm_disable_port(enum fm_port port);
 
-- 
1.7.3.4

  reply	other threads:[~2012-08-14 16:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-14 16:47 [U-Boot] [PATCH 1/7] powerpc/85xx: add support for FM2 DTSEC5 Timur Tabi
2012-08-14 16:47 ` Timur Tabi [this message]
2012-08-14 16:47 ` [U-Boot] [PATCH 3/7] [v2] powerpc/85xx: introduce function serdes_device_from_fm_port() Timur Tabi
2012-08-14 16:47 ` [U-Boot] [PATCH 4/7] fm-eth: use fdt_status_disabled() function in ft_fixup_port() Timur Tabi
2012-08-14 16:47 ` [U-Boot] [PATCH 5/7] powerpc/85xx: get rid of enum board_slots in P4080 MDIO driver Timur Tabi
2012-08-14 16:47 ` [U-Boot] [PATCH 6/7] powerpc/85xx: update P4080DS MDIO bus multiplexer support Timur Tabi
2012-08-16 21:39   ` Kumar Gala
2012-08-16 21:43     ` Timur Tabi
2012-08-16 21:40   ` Kumar Gala
2012-08-14 16:47 ` [U-Boot] [PATCH 7/7] powerpc/85xx: remove support for the Freescale P3060 Timur Tabi

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=1344962847-15448-2-git-send-email-timur@freescale.com \
    --to=timur@freescale.com \
    --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.