* Micrel PHY KSZ8001 on MPC5200B FEC
@ 2009-10-27 12:17 Roman Fietze
0 siblings, 0 replies; 6+ messages in thread
From: Roman Fietze @ 2009-10-27 12:17 UTC (permalink / raw)
To: linuxppc-dev
Hello,
We would need some help on how to make a Micrel KSZ8001 work on the
MPC5200B FEC using the kernel DENX-v2.6.3[01].
We can already boot the kernel and device tree using TFTP and this PHY
using a recent U-Boot version, so we would need some pointers how to
acomplish that.
Add a proper PHY driver in the drivers/net/phy/ directory?
Modify the DTS? If yes, how? A link to some documentation that's not
already in the kernel sources would already help.
Is it correct, when looking at the sources, that the MPC's FEC driver
switched to the generic PHY driver interface?
Roman
=2D-=20
Roman Fietze Telemotive AG B=FCro M=FChlhausen
Breitwiesen 73347 M=FChlhausen
Tel.: +49(0)7335/18493-45 http://www.telemotive.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Micrel PHY KSZ8001 on MPC5200B FEC
2009-10-27 16:47 ` suvidh kankariya
@ 2009-10-27 19:54 ` Roman Fietze
2009-10-27 20:08 ` Grant Likely
0 siblings, 1 reply; 6+ messages in thread
From: Roman Fietze @ 2009-10-27 19:54 UTC (permalink / raw)
To: linuxppc-dev
Hello Suvidh,
On Tuesday 27 October 2009 17:47:51 suvidh kankariya wrote:
> A driver for micrel phy exists in /drivers/net/phy/micrel.c. in
> 2.6.30.
Am I somewhat blind, or do you have access to other 2.6.30's than I
have?
I searched git.kernel.org, git.denx.de and git.secretlab.ca, but could
not find that file, neither in the current master, nor in older tags
somewhat related to "2.6.30", nor in any local clone in any version of
the 2.6 since "He" created the repos.
> If you are using older kernel you may want to copy it.
2.6.30 and 2.6.31 from DENX or kernel.org.
Roman
=2D-=20
Roman Fietze Telemotive AG B=FCro M=FChlhausen
Breitwiesen 73347 M=FChlhausen
Tel.: +49(0)7335/18493-45 http://www.telemotive.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Micrel PHY KSZ8001 on MPC5200B FEC
2009-10-27 19:54 ` Micrel " Roman Fietze
@ 2009-10-27 20:08 ` Grant Likely
0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2009-10-27 20:08 UTC (permalink / raw)
To: Roman Fietze; +Cc: linuxppc-dev
On Tue, Oct 27, 2009 at 1:54 PM, Roman Fietze
<roman.fietze@telemotive.de> wrote:
> Hello Suvidh,
>
> On Tuesday 27 October 2009 17:47:51 suvidh kankariya wrote:
>
>> A driver for micrel phy exists in /drivers/net/phy/micrel.c. in
>> 2.6.30.
>
> Am I somewhat blind, or do you have access to other 2.6.30's than I
> have?
>
> I searched git.kernel.org, git.denx.de and git.secretlab.ca, but could
> not find that file, neither in the current master, nor in older tags
> somewhat related to "2.6.30", nor in any local clone in any version of
> the 2.6 since "He" created the repos.
No, there is a marvell driver, but not a micrel one. If the generic
phy driver doesn't work for you, then yes, add a new micrel driver.
To hook it up to the MPC5200 FEC, you just need to have the correct
PHY address in your board's .dts file.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Micrel PHY KSZ8001 on MPC5200B FEC
[not found] ` <mailman.1198.1256674402.12812.linuxppc-dev@lists.ozlabs.or g>
@ 2009-10-28 15:19 ` suvidh kankariya
2009-11-12 6:33 ` Roman Fietze
0 siblings, 1 reply; 6+ messages in thread
From: suvidh kankariya @ 2009-10-28 15:19 UTC (permalink / raw)
To: linuxppc-dev
Romen,
I am sorry for the misguided statement.
I indeed had patched it .
I am copying the patch here. Hope it helps you.
diff --exclude CVS -uNr linux-2.6.30/drivers/net/phy/Kconfig
linux-2.6.30.modified/drivers/net/phy/Kconfig
--- linux-2.6.30/drivers/net/phy/Kconfig 2009-06-09
23:05:27.000000000 -0400
+++ linux-2.6.30.modified/drivers/net/phy/Kconfig 2009-10-09
15:43:09.000000000 -0400
@@ -82,6 +82,12 @@
---help---
Supports the LSI ET1011C PHY.
+config MICREL_PHY
+ tristate "Drivers for MICREL PHYs"
+ depends on PHYLIB
+ ---help---
+ Currently supports the KS8721BL, KSZ8041NL
+
config FIXED_PHY
bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
depends on PHYLIB=y
diff --exclude CVS -uNr linux-2.6.30/drivers/net/phy/Makefile
linux-2.6.30.modified/drivers/net/phy/Makefile
--- linux-2.6.30/drivers/net/phy/Makefile 2009-06-09
23:05:27.000000000 -0400
+++ linux-2.6.30.modified/drivers/net/phy/Makefile 2009-10-09
16:07:37.000000000 -0400
@@ -14,6 +14,7 @@
obj-$(CONFIG_ICPLUS_PHY) += icplus.o
obj-$(CONFIG_REALTEK_PHY) += realtek.o
obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
+obj-$(CONFIG_MICREL_PHY) += micrel.o
obj-$(CONFIG_FIXED_PHY) += fixed.o
obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o
diff --exclude CVS -uNr linux-2.6.30/drivers/net/phy/micrel.c
linux-2.6.30.modified/drivers/net/phy/micrel.c
--- linux-2.6.30/drivers/net/phy/micrel.c 1969-12-31
19:00:00.000000000 -0500
+++ linux-2.6.30.modified/drivers/net/phy/micrel.c 2009-09-23
16:04:53.000000000 -0400
@@ -0,0 +1,129 @@
+ /* drivers/net/phy/micrel.c
+ *
+ * Driver for Micrel PHY
+ * based on drivers/net/phy/marvell.c *
+ *
+ *
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/errno.h>
+#include <linux/unistd.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/spinlock.h>
+#include <linux/mm.h>
+#include <linux/module.h>
+#include <linux/mii.h>
+#include <linux/ethtool.h>
+#include <linux/phy.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/uaccess.h>
+#define MII_MICRELL_RXERCR 0x15
+#define MII_MICRELL_ICSR 0x1B
+#define MII_MICRELL_PHYCR 0x1F
+
+
+MODULE_DESCRIPTION("Micrel PHY driver");
+MODULE_AUTHOR("Suvidh Kankariya");
+MODULE_LICENSE("GPL");
+
+
+static int micrel_config_intr(struct phy_device *phydev)
+{
+ int err;
+
+ if(phydev->interrupts == PHY_INTERRUPT_ENABLED)
+ {
+ err = phy_write(phydev, MII_MICRELL_ICSR, 0xFF00);
+ err = phy_write(phydev, 0, 0x1200); /* control register */
+ }
+ else
+ err = phy_write(phydev, MII_MICRELL_ICSR, 0);
+
+ return err;
+}
+
+static int micrel_config_init(struct phy_device *phydev)
+{
+ printk("Phy config done");
+
+ phy_write(phydev, MII_MICRELL_ICSR, 0);
+ return 0;
+}
+
+
+static int micrel_ack_interrupt(struct phy_device *phydev)
+{
+ int err = phy_read(phydev, MII_MICRELL_ICSR);
+ if (err < 0)
+ return err;
+
+ return 0;
+}
+
+static struct phy_driver ks8721bl_driver = {
+ .phy_id = 0x000221619,
+ .name = "KS8721BL",
+ .phy_id_mask = 0xfffffff0,
+ .features = PHY_BASIC_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_init = micrel_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = micrel_ack_interrupt,
+ .config_intr = micrel_config_intr,
+ .driver = { .owner = THIS_MODULE,},
+};
+
+
+
+static struct phy_driver ksz8041nl_driver = {
+ .phy_id = 0x00022151,
+ .name = "KSZ8041NL",
+ .phy_id_mask = 0xfffffff0,
+ .features = PHY_BASIC_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_init = micrel_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = micrel_ack_interrupt,
+ .config_intr = micrel_config_intr,
+ .driver = { .owner = THIS_MODULE,},
+};
+
+static int __init micrel_init(void)
+{
+ int ret;
+
+ ret = phy_driver_register(&ks8721bl_driver);
+ if (ret)
+ return ret;
+ ret = phy_driver_register(&ksz8041nl_driver);
+ printk("Phy Init done");
+ if (ret)
+ goto err8041;
+
+ return 0;
+ err8041:
+ phy_driver_unregister(&ks8721bl_driver);
+ return ret;
+}
+
+static void __exit micrel_exit(void)
+{
+ phy_driver_unregister(&ks8721bl_driver);
+ phy_driver_unregister(&ksz8041nl_driver);
+}
+
+module_init(micrel_init);
+module_exit(micrel_exit);
Suvidh
>------------------------------
>
>Message: 6
>Date: Tue, 27 Oct 2009 20:54:47 +0100
>From: Roman Fietze <roman.fietze@telemotive.de>
>To: linuxppc-dev@lists.ozlabs.org
>Subject: Re: Micrel PHY KSZ8001 on MPC5200B FEC
>Message-ID: <200910272054.47398.roman.fietze@telemotive.de>
>Content-Type: Text/Plain; charset="iso-8859-1"
>
>Hello Suvidh,
>
>On Tuesday 27 October 2009 17:47:51 suvidh kankariya wrote:
>
> > A driver for micrel phy exists in /drivers/net/phy/micrel.c. in
> > 2.6.30.
>
>Am I somewhat blind, or do you have access to other 2.6.30's than I
>have?
>
>I searched git.kernel.org, git.denx.de and git.secretlab.ca, but could
>not find that file, neither in the current master, nor in older tags
>somewhat related to "2.6.30", nor in any local clone in any version of
>the 2.6 since "He" created the repos.
>
>
> > If you are using older kernel you may want to copy it.
>
>2.6.30 and 2.6.31 from DENX or kernel.org.
>
>
>Roman
>
>--
>Roman Fietze Telemotive AG B?ro M?hlhausen
>Breitwiesen 73347 M?hlhausen
>Tel.: +49(0)7335/18493-45 http://www.telemotive.de
>
>
>------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Micrel PHY KSZ8001 on MPC5200B FEC
2009-10-28 15:19 ` Micrel PHY KSZ8001 on MPC5200B FEC suvidh kankariya
@ 2009-11-12 6:33 ` Roman Fietze
2009-11-12 7:03 ` Grant Likely
0 siblings, 1 reply; 6+ messages in thread
From: Roman Fietze @ 2009-11-12 6:33 UTC (permalink / raw)
To: linuxppc-dev
Hello Suvidh,
On Wednesday 28 October 2009 16:19:04 suvidh kankariya wrote:
> I am sorry for the misguided statement.
No problem, help is always welcome.
> I indeed had patched it.
Allthough Grant's mail got stuck in our beloved Notes spam filter, we
found out how to use that KSZ8001 on our board.
As Grant mentioned as well, the key was and is a correct DTS. (At
least) one statement was missing:
interrupt-parent =3D <&mpc5200_pic>;
This statement seemed to move all the way up from the devices to the
root of the tree, and somehow we missed that move.
Thanks again to all who answered.
Roman
=2D-=20
Roman Fietze Telemotive AG B=FCro M=FChlhausen
Breitwiesen 73347 M=FChlhausen
Tel.: +49(0)7335/18493-45 http://www.telemotive.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Micrel PHY KSZ8001 on MPC5200B FEC
2009-11-12 6:33 ` Roman Fietze
@ 2009-11-12 7:03 ` Grant Likely
0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2009-11-12 7:03 UTC (permalink / raw)
To: Roman Fietze; +Cc: linuxppc-dev
On Wed, Nov 11, 2009 at 11:33 PM, Roman Fietze
<roman.fietze@telemotive.de> wrote:
> As Grant mentioned as well, the key was and is a correct DTS. (At
> least) one statement was missing:
>
> =A0interrupt-parent =3D <&mpc5200_pic>;
>
> This statement seemed to move all the way up from the devices to the
> root of the tree, and somehow we missed that move.
Yes, nodes inherit the interrupt-parent property from their parent. I
took advantage of that to tidy up all the mpc5200 device trees.
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-11-12 7:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.1198.1256674402.12812.linuxppc-dev@lists.ozlabs.org>
[not found] ` <mailman.1198.1256674402.12812.linuxppc-dev@lists.ozlabs.or g>
2009-10-28 15:19 ` Micrel PHY KSZ8001 on MPC5200B FEC suvidh kankariya
2009-11-12 6:33 ` Roman Fietze
2009-11-12 7:03 ` Grant Likely
[not found] <mailman.1186.1256651657.12812.linuxppc-dev@lists.ozlabs.org>
2009-10-27 16:47 ` suvidh kankariya
2009-10-27 19:54 ` Micrel " Roman Fietze
2009-10-27 20:08 ` Grant Likely
2009-10-27 12:17 Roman Fietze
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).