From: Vitaly Bordug <vitb@kernel.crashing.org>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev <linuxppc-dev@ozlabs.org>
Subject: [PATCH] POWERPC: add support of the GiGE switch for mpc8313RDB via fixed PHY
Date: Tue, 17 Jul 2007 04:49:37 +0400 [thread overview]
Message-ID: <20070717004936.21700.67900.stgit@localhost.localdomain> (raw)
This utilises pretend phy, making access to it via device tree. GiGE switch
is connected to TSEC1 with fixed gigE link, so we need to emulate it
via artificial PHY to make it work.
Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
---
arch/powerpc/boot/dts/mpc8313erdb.dts | 1 +
arch/powerpc/platforms/83xx/mpc8313_rdb.c | 43 +++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts
index a1533cc..1b351dc 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -100,6 +100,7 @@
#size-cells = <0>;
phy1: ethernet-phy@1 {
interrupt-parent = < &ipic >;
+ compatible = "fixed";
interrupts = <13 8>;
reg = <1>;
device_type = "ethernet-phy";
diff --git a/arch/powerpc/platforms/83xx/mpc8313_rdb.c b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
index b410e67..5ee08fc 100644
--- a/arch/powerpc/platforms/83xx/mpc8313_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
@@ -115,6 +115,49 @@ static int __init rtc_hookup(void)
late_initcall(rtc_hookup);
#endif
+#if defined(CONFIG_FIXED_MII_1000_FDX)
+
+static int fixed_set_link (void)
+{
+ struct fixed_info *phyinfo = fixed_mdio_get_phydev(0); /* only one fixed phy on this platform */
+ struct phy_device *phydev;
+ struct device_node *np;
+ struct device_node *child;
+ unsigned int i;
+ struct resource res;
+ int ret;
+ u32 *id = NULL;
+
+ if (!phyinfo)
+ return -ENXIO;
+ phydev = phyinfo->phydev;
+ if (!phydev)
+ return -ENXIO;
+ for (np = NULL, i = 0;
+ (np = of_find_compatible_node(np, "mdio", "gianfar")) != NULL;
+ i++) {
+
+ memset(&res, 0, sizeof(res));
+
+ ret = of_address_to_resource(np, 0, &res);
+ if (ret)
+ return ret;
+ child = of_find_compatible_node(np, "ethernet-phy","fixed");
+ if (!child)
+ return -ENXIO;
+ id = (u32*)of_get_property(child, "reg", NULL);
+ if (!id)
+ return -ENXIO;
+ break;
+ }
+ snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT, res.start, *id);
+ memset(phyinfo->regs,0xff,sizeof(phyinfo->regs[0])*phyinfo->regs_num);
+
+ return 0;
+}
+late_initcall(fixed_set_link);
+#endif
+
/*
* Called very early, MMU is off, device-tree isn't unflattened
*/
next reply other threads:[~2007-07-17 0:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-17 0:49 Vitaly Bordug [this message]
2007-07-17 13:09 ` [PATCH] POWERPC: add support of the GiGE switch for mpc8313RDB via fixed PHY Segher Boessenkool
2007-07-17 16:43 ` Scott Wood
2007-07-17 17:50 ` Vitaly Bordug
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=20070717004936.21700.67900.stgit@localhost.localdomain \
--to=vitb@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.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