linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC] add PHY support to AM79C874
@ 2005-11-28 14:10 Aristeu Sergio Rozanski Filho
  2005-11-28 21:00 ` Pantelis Antoniou
  2005-11-30  5:51 ` Kumar Gala
  0 siblings, 2 replies; 4+ messages in thread
From: Aristeu Sergio Rozanski Filho @ 2005-11-28 14:10 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

This is a simple port from old fec driver to PHY layer to support AMD
AM79C874 PHY.
As I don't have the hardware to test this, all kinds of feedback are
most welcome.
Thanks,

-- 
Aristeu


[-- Attachment #2: phy-add_am79c874_phy.patch --]
[-- Type: text/plain, Size: 2901 bytes --]

Index: testing/drivers/net/phy/Kconfig
===================================================================
--- testing.orig/drivers/net/phy/Kconfig	2005-11-25 15:26:38.000000000 -0200
+++ testing/drivers/net/phy/Kconfig	2005-11-25 15:28:55.000000000 -0200
@@ -53,5 +53,11 @@
 	---help---
 	  Currently supports the cis8204
 
+config AMD_PHY
+	tristate "Drivers for the AMD PHYs"
+	depends on PHYLIB
+	---help---
+	  Currenty supports AM79C874
+
 endmenu
 
Index: testing/drivers/net/phy/Makefile
===================================================================
--- testing.orig/drivers/net/phy/Makefile	2005-11-25 15:26:38.000000000 -0200
+++ testing/drivers/net/phy/Makefile	2005-11-25 15:26:56.000000000 -0200
@@ -8,3 +8,5 @@
 obj-$(CONFIG_CICADA_PHY)	+= cicada.o
 obj-$(CONFIG_LXT_PHY)		+= lxt.o
 obj-$(CONFIG_QSEMI_PHY)		+= qsemi.o
+obj-$(CONFIG_AMD_PHY)		+= amd.o
+
Index: testing/drivers/net/phy/amd.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ testing/drivers/net/phy/amd.c	2005-11-28 11:39:34.000000000 -0200
@@ -0,0 +1,71 @@
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/version.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_AM79C874_MFR	16  /* Miscellaneous Features Register      */
+#define MII_AM79C874_ICSR	17  /* Interrupt Control/Status Register    */
+#define MII_AM79C874_DR		18  /* Diagnostic Register		    */
+#define MII_AM79C874_PMLR	19  /* Power Management & Loopback Register */
+#define MII_AM79C874_MCR	21  /* Mode Control Register		    */
+#define MII_AM79C874_DC		23  /* Disconnect Counter		    */
+#define MII_AM79C874_REC	24  /* Receiver Error Counter		    */
+
+static int am79c874_ack_interrupt(struct phy_device *phy)
+{
+	int err;
+
+	err = phy_read(phy, MII_AM79C874_ICSR);
+
+	if (err < 0)
+		return err;
+	return 0;
+}
+
+static int am79c874_config_intr(struct phy_device *phy)
+{
+	int err;
+
+	if (phy->interrupts == PHY_INTERRUPT_ENABLED)
+		err = phy_write(phy, MII_AM79C874_ICSR, 0xff00);
+	else
+		err = phy_write(phy, MII_AM79C874_ICSR, 0);
+
+	if (err < 0)
+		return err;
+
+	return 0;
+}
+
+static struct phy_driver am79c874 = {
+	.phy_id		= 0x00022561,
+	.name		= "AM79C874",
+	.phy_id_mask	= 0x0fffffff,
+	.features	= PHY_BASIC_FEATURES,
+	.flags		= PHY_HAS_INTERRUPT,
+	.config_aneg	= genphy_config_aneg,
+	.read_status	= genphy_read_status,
+	.ack_interrupt	= am79c874_ack_interrupt,
+	.config_intr	= am79c874_config_intr,
+	.driver 	= { .owner = THIS_MODULE,},
+};
+
+static __init int am79c874_init(void)
+{
+	return phy_driver_register(&am79c874);
+}
+
+static __exit void am79c874_exit(void)
+{
+	phy_driver_unregister(&am79c874);
+}
+module_init(am79c874_init);
+module_exit(am79c874_exit);
+

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] add PHY support to AM79C874
  2005-11-28 14:10 [RFC] add PHY support to AM79C874 Aristeu Sergio Rozanski Filho
@ 2005-11-28 21:00 ` Pantelis Antoniou
  2005-11-30  5:51 ` Kumar Gala
  1 sibling, 0 replies; 4+ messages in thread
From: Pantelis Antoniou @ 2005-11-28 21:00 UTC (permalink / raw)
  To: Aristeu Sergio Rozanski Filho; +Cc: linuxppc-embedded

On Monday 28 November 2005 16:10, Aristeu Sergio Rozanski Filho wrote:
> This is a simple port from old fec driver to PHY layer to support AMD
> AM79C874 PHY.
> As I don't have the hardware to test this, all kinds of feedback are
> most welcome.
> Thanks,
> 
> -- 
> Aristeu
> 
> 

Looks fine to me...

Regards

Pantelis

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] add PHY support to AM79C874
  2005-11-28 14:10 [RFC] add PHY support to AM79C874 Aristeu Sergio Rozanski Filho
  2005-11-28 21:00 ` Pantelis Antoniou
@ 2005-11-30  5:51 ` Kumar Gala
  2005-11-30 13:56   ` Aristeu Sergio Rozanski Filho
  1 sibling, 1 reply; 4+ messages in thread
From: Kumar Gala @ 2005-11-30  5:51 UTC (permalink / raw)
  To: Aristeu Sergio Rozanski Filho; +Cc: linuxppc-embedded

I would suggest sending this to the netdev list for review and  
acceptance.

- kumar

On Nov 28, 2005, at 8:10 AM, Aristeu Sergio Rozanski Filho wrote:

> This is a simple port from old fec driver to PHY layer to support AMD
> AM79C874 PHY.
> As I don't have the hardware to test this, all kinds of feedback are
> most welcome.
> Thanks,
>
> -- 
> Aristeu
>
> <phy-add_am79c874_phy.patch>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] add PHY support to AM79C874
  2005-11-30  5:51 ` Kumar Gala
@ 2005-11-30 13:56   ` Aristeu Sergio Rozanski Filho
  0 siblings, 0 replies; 4+ messages in thread
From: Aristeu Sergio Rozanski Filho @ 2005-11-30 13:56 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-embedded

> I would suggest sending this to the netdev list for review and  
> acceptance.
ok! sending it now, thanks Kumar

-- 
Aristeu

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-30 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-28 14:10 [RFC] add PHY support to AM79C874 Aristeu Sergio Rozanski Filho
2005-11-28 21:00 ` Pantelis Antoniou
2005-11-30  5:51 ` Kumar Gala
2005-11-30 13:56   ` Aristeu Sergio Rozanski Filho

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).