Re: [PATCH 1/2] Fix error checking in Vitesse IRQ config

2007-07-19 Thread Jon Loeliger
On Wed, 2007-07-18 at 01:35, Andy Fleming wrote:
> phy_read() returns a negative number if there's an error, but the
> error-checking code in the Vitesse driver's config_intr function
> triggers if phy_read() returns non-zero.  Correct that.
> 
> Signed-off-by: Andy Fleming <[EMAIL PROTECTED]>
> ---
> I made a really stupid mistake in the 4 patches I sent out, earlier.  I
> thought those patches had been tested, but they hadn't been.  This one
> corrects a tiny error in the patch, and they have now been tested.  As before
> this change can be pulled from:
> 
> http://opensource.freescale.com/pub/scm/linux-2.6-85xx.git netdev
> 
> Really, REALLY sorry about that.  I have been given a paper bag of appropriate
> size and shape to fit over my head.
> 
>  drivers/net/phy/vitesse.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
> index 6a53856..8874497 100644


Acked-by: Jon Loeliger <[EMAIL PROTECTED]>

Tested on the 8641HPCN.

Thanks,
jdl


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/9 v3] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-17 Thread Jon Loeliger
Signed-off-by: Kriston Carson <[EMAIL PROTECTED]>
Signed-off-by: Xianghua Xiao <[EMAIL PROTECTED]>
Signed-off-by: Jon Loeliger <[EMAIL PROTECTED]>
Acked-by: Jeff Garzik <[EMAIL PROTECTED]>

---

 drivers/net/Kconfig   |6 +-
 drivers/net/phy/Kconfig   |5 ++
 drivers/net/phy/Makefile  |1
 drivers/net/phy/vitesse.c |  112 +
 4 files changed, 121 insertions(+), 3 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index bdaaad8..c1c2758 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2179,11 +2179,11 @@ config SPIDER_NET
 
 config GIANFAR
tristate "Gianfar Ethernet"
-   depends on 85xx || 83xx
+   depends on 85xx || 83xx || PPC_86xx
select PHYLIB
help
- This driver supports the Gigabit TSEC on the MPC85xx 
- family of chips, and the FEC on the 8540
+ This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
+ and MPC86xx family of chips, and the FEC on the 8540.
 
 config GFAR_NAPI
bool "NAPI Support"
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index fa39b94..76e51b1 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -44,6 +44,11 @@ config CICADA_PHY
depends on PHYLIB
---help---
  Currently supports the cis8204
+config VITESSE_PHY
+tristate "Drivers for the Vitesse PHYs"
+depends on PHYLIB
+---help---
+  Currently supports the vsc8244
 
 endmenu
 
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index e4116a5..a8d066e 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_DAVICOM_PHY)   += davicom.o
 obj-$(CONFIG_CICADA_PHY)   += cicada.o
 obj-$(CONFIG_LXT_PHY)  += lxt.o
 obj-$(CONFIG_QSEMI_PHY)+= qsemi.o
+obj-$(CONFIG_VITESSE_PHY)  += vitesse.o
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
new file mode 100644
index 000..ffd215d
--- /dev/null
+++ b/drivers/net/phy/vitesse.c
@@ -0,0 +1,112 @@
+/*
+ * Driver for Vitesse PHYs
+ *
+ * Author: Kriston Carson
+ *
+ * Copyright (c) 2005 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Vitesse Extended Control Register 1 */
+#define MII_VSC8244_EXT_CON1   0x17
+#define MII_VSC8244_EXTCON1_INIT   0x
+
+/* Vitesse Interrupt Mask Register */
+#define MII_VSC8244_IMASK  0x19
+#define MII_VSC8244_IMASK_IEN  0x8000
+#define MII_VSC8244_IMASK_SPEED0x4000
+#define MII_VSC8244_IMASK_LINK 0x2000
+#define MII_VSC8244_IMASK_DUPLEX   0x1000
+#define MII_VSC8244_IMASK_MASK 0xf000
+
+/* Vitesse Interrupt Status Register */
+#define MII_VSC8244_ISTAT  0x1a
+#define MII_VSC8244_ISTAT_STATUS   0x8000
+#define MII_VSC8244_ISTAT_SPEED0x4000
+#define MII_VSC8244_ISTAT_LINK 0x2000
+#define MII_VSC8244_ISTAT_DUPLEX   0x1000
+
+/* Vitesse Auxiliary Control/Status Register */
+#define MII_VSC8244_AUX_CONSTAT0x1c
+#define MII_VSC8244_AUXCONSTAT_INIT0x0004
+#define MII_VSC8244_AUXCONSTAT_DUPLEX  0x0020
+#define MII_VSC8244_AUXCONSTAT_SPEED   0x0018
+#define MII_VSC8244_AUXCONSTAT_GBIT0x0010
+#define MII_VSC8244_AUXCONSTAT_100 0x0008
+
+MODULE_DESCRIPTION("Vitesse PHY driver");
+MODULE_AUTHOR("Kriston Carson");
+MODULE_LICENSE("GPL");
+
+static int vsc824x_config_init(struct phy_device *phydev)
+{
+   int err;
+
+   err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT,
+   MII_VSC8244_AUXCONSTAT_INIT);
+   if (err < 0)
+   return err;
+
+   err = phy_write(phydev, MII_VSC8244_EXT_CON1,
+   MII_VSC8244_EXTCON1_INIT);
+   return err;
+}
+
+static int vsc824x_ack_interrupt(struct phy_device *phydev)
+{
+   int err = phy_read(phydev, MII_VSC8244_ISTAT);
+
+   return (err < 0) ? err : 0;
+}
+
+static int vsc824x_config_intr(struct phy_device *phydev)
+{
+   int err;
+
+   if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+   err = phy_write(phydev, MII_VSC8244_IMASK,
+   MII_VSC8244_IMASK_MASK);
+   else
+   err = phy_write(phydev, MII_VSC8244_IMASK, 0);
+   return err;
+}
+
+/* Vitesse 824x */
+static struct phy_driver vsc8244_driver = {
+   .phy_id = 0x000fc6c2,
+   .name   = "Vitesse VSC8244",
+   .phy_id_mask= 0x000fffc0,
+  

[PATCH 8/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jon Loeliger

Signed-off-by: Kriston Carson <[EMAIL PROTECTED]>
Signed-off-by: Xianghua Xiao <[EMAIL PROTECTED]>
Signed-off-by: Jon Loeliger <[EMAIL PROTECTED]>
Acked-by: Jeff Garzik <[EMAIL PROTECTED]>

---

 drivers/net/Kconfig   |6 +-
 drivers/net/phy/Kconfig   |5 ++
 drivers/net/phy/Makefile  |1 
 drivers/net/phy/vitesse.c |  112 +
 4 files changed, 121 insertions(+), 3 deletions(-)


diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index bdaaad8..c1c2758 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2179,11 +2179,11 @@ config SPIDER_NET
 
 config GIANFAR
tristate "Gianfar Ethernet"
-   depends on 85xx || 83xx
+   depends on 85xx || 83xx || PPC_86xx
select PHYLIB
help
- This driver supports the Gigabit TSEC on the MPC85xx 
- family of chips, and the FEC on the 8540
+ This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
+ and MPC86xx family of chips, and the FEC on the 8540.
 
 config GFAR_NAPI
bool "NAPI Support"
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index fa39b94..76e51b1 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -44,6 +44,11 @@ config CICADA_PHY
depends on PHYLIB
---help---
  Currently supports the cis8204
+config VITESSE_PHY
+tristate "Drivers for the Vitesse PHYs"
+depends on PHYLIB
+---help---
+  Currently supports the vsc8244
 
 endmenu
 
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index e4116a5..a8d066e 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_DAVICOM_PHY)   += davicom.o
 obj-$(CONFIG_CICADA_PHY)   += cicada.o
 obj-$(CONFIG_LXT_PHY)  += lxt.o
 obj-$(CONFIG_QSEMI_PHY)+= qsemi.o
+obj-$(CONFIG_VITESSE_PHY)  += vitesse.o
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
new file mode 100644
index 000..ffd215d
--- /dev/null
+++ b/drivers/net/phy/vitesse.c
@@ -0,0 +1,112 @@
+/*
+ * Driver for Vitesse PHYs
+ *
+ * Author: Kriston Carson
+ *
+ * Copyright (c) 2005 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Vitesse Extended Control Register 1 */
+#define MII_VSC8244_EXT_CON1   0x17
+#define MII_VSC8244_EXTCON1_INIT   0x
+
+/* Vitesse Interrupt Mask Register */
+#define MII_VSC8244_IMASK  0x19
+#define MII_VSC8244_IMASK_IEN  0x8000
+#define MII_VSC8244_IMASK_SPEED0x4000
+#define MII_VSC8244_IMASK_LINK 0x2000
+#define MII_VSC8244_IMASK_DUPLEX   0x1000
+#define MII_VSC8244_IMASK_MASK 0xf000
+
+/* Vitesse Interrupt Status Register */
+#define MII_VSC8244_ISTAT  0x1a
+#define MII_VSC8244_ISTAT_STATUS   0x8000
+#define MII_VSC8244_ISTAT_SPEED0x4000
+#define MII_VSC8244_ISTAT_LINK 0x2000
+#define MII_VSC8244_ISTAT_DUPLEX   0x1000
+
+/* Vitesse Auxiliary Control/Status Register */
+#define MII_VSC8244_AUX_CONSTAT0x1c
+#define MII_VSC8244_AUXCONSTAT_INIT0x0004
+#define MII_VSC8244_AUXCONSTAT_DUPLEX  0x0020
+#define MII_VSC8244_AUXCONSTAT_SPEED   0x0018
+#define MII_VSC8244_AUXCONSTAT_GBIT0x0010
+#define MII_VSC8244_AUXCONSTAT_100 0x0008
+
+MODULE_DESCRIPTION("Vitesse PHY driver");
+MODULE_AUTHOR("Kriston Carson");
+MODULE_LICENSE("GPL");
+
+static int vsc824x_config_init(struct phy_device *phydev)
+{
+   int err;
+
+   err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT,
+   MII_VSC8244_AUXCONSTAT_INIT);
+   if (err < 0)
+   return err;
+
+   err = phy_write(phydev, MII_VSC8244_EXT_CON1,
+   MII_VSC8244_EXTCON1_INIT);
+   return err;
+}
+
+static int vsc824x_ack_interrupt(struct phy_device *phydev)
+{
+   int err = phy_read(phydev, MII_VSC8244_ISTAT);
+
+   return (err < 0) ? err : 0;
+}
+
+static int vsc824x_config_intr(struct phy_device *phydev)
+{
+   int err;
+
+   if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+   err = phy_write(phydev, MII_VSC8244_IMASK,
+   MII_VSC8244_IMASK_MASK);
+   else
+   err = phy_write(phydev, MII_VSC8244_IMASK, 0);
+   return err;
+}
+
+/* Vitesse 824x */
+static struct phy_driver vsc8244_driver = {
+   .phy_id = 0x000fc6c2,
+   .name   = "Vitesse VSC8244",
+   .phy_id_mask= 0x000fffc0,
+  

Re: [PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jon Loeliger
On Thu, 2006-06-08 at 15:46, Jeff Garzik wrote:

> I leave it up to you and Paul to coordinate, then :)
> 
> I'm fine with the patch, and if its better to merge via linuxppc.git, 
> that's OK with me.  If you would prefer to send it via my tree, to go 
> ahead and get it in, that's fine too.

OK, thanks.  I need to re-submit 5 of 10 parts for
other cleanup issues anyway, so I think I will:

- Resubmit the entire patch set,
- Resubmit netdev parts to Paul, and netdev with
  an added ACK: by you line (OK?),
- Throw myself on the mercy of "Help us Obi-wan Mackerras"
  and see what he says when he wakes up!

Thanks!
jdl


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jon Loeliger
On Thu, 2006-06-08 at 15:36, Jeff Garzik wrote:
> Is it dependent on other stuff in Paul's tree?

Yes, very much so.  Most of this patch set is an
entirely new PPC board port against his arch/powerpc
basis.  The new PHY is incidentally on that board,
but the patches for its introduction could be
introduced through the netdev tree if needed.
It would just need to be coordinated some.  I am,
of course, willing to work it either way as needed.

jdl


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jon Loeliger
On Thu, 2006-06-08 at 14:34, Jeff Garzik wrote:
> Jon Loeliger wrote:
> > Signed-off-by: Kriston Carson <[EMAIL PROTECTED]>
> > Signed-off-by: Xianghua Xiao <[EMAIL PROTECTED]>
> > Signed-off-by: Jon Loeliger <[EMAIL PROTECTED]>
> 
> ACK, but patch does not apply to netdev-2.6.git#upstream.
> 
>   Jeff

Thanks, Jeff.

Are you willing to take the netdev parts as-is, then?
Or would you like me to reformat the netdev parts to
apply against the netdev-2.6.git#upstream branch?
The patch is currently for the Paul Mackerras powerpc.git
tree as it stands now.  Should we apply it through that
path now as you have ACK'ed it?

Thanks,
jdl


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-07 Thread Jon Loeliger

Signed-off-by: Kriston Carson <[EMAIL PROTECTED]>
Signed-off-by: Xianghua Xiao <[EMAIL PROTECTED]>
Signed-off-by: Jon Loeliger <[EMAIL PROTECTED]>

---

 drivers/net/Kconfig   |6 +-
 drivers/net/phy/Kconfig   |5 ++
 drivers/net/phy/Makefile  |1 
 drivers/net/phy/vitesse.c |  136 +
 4 files changed, 145 insertions(+), 3 deletions(-)


diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index bdaaad8..c1c2758 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2179,11 +2179,11 @@ config SPIDER_NET
 
 config GIANFAR
tristate "Gianfar Ethernet"
-   depends on 85xx || 83xx
+   depends on 85xx || 83xx || PPC_86xx
select PHYLIB
help
- This driver supports the Gigabit TSEC on the MPC85xx 
- family of chips, and the FEC on the 8540
+ This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
+ and MPC86xx family of chips, and the FEC on the 8540.
 
 config GFAR_NAPI
bool "NAPI Support"
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index fa39b94..76e51b1 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -44,6 +44,11 @@ config CICADA_PHY
depends on PHYLIB
---help---
  Currently supports the cis8204
+config VITESSE_PHY
+tristate "Drivers for the Vitesse PHYs"
+depends on PHYLIB
+---help---
+  Currently supports the vsc8244
 
 endmenu
 
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index e4116a5..a8d066e 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_DAVICOM_PHY)   += davicom.o
 obj-$(CONFIG_CICADA_PHY)   += cicada.o
 obj-$(CONFIG_LXT_PHY)  += lxt.o
 obj-$(CONFIG_QSEMI_PHY)+= qsemi.o
+obj-$(CONFIG_VITESSE_PHY)  += vitesse.o
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
new file mode 100644
index 000..45a605f
--- /dev/null
+++ b/drivers/net/phy/vitesse.c
@@ -0,0 +1,136 @@
+/*
+ * Driver for Vitesse PHYs
+ *
+ * Author: Kriston Carson
+ *
+ * Copyright (c) 2005 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+/* Vitesse Extended Control Register 1 */
+#define MII_VSC8244_EXT_CON1   0x17
+#define MII_VSC8244_EXTCON1_INIT   0x
+
+/* Vitesse Interrupt Mask Register */
+#define MII_VSC8244_IMASK  0x19
+#define MII_VSC8244_IMASK_IEN  0x8000
+#define MII_VSC8244_IMASK_SPEED0x4000
+#define MII_VSC8244_IMASK_LINK 0x2000
+#define MII_VSC8244_IMASK_DUPLEX   0x1000
+#define MII_VSC8244_IMASK_MASK 0xf000
+
+/* Vitesse Interrupt Status Register */
+#define MII_VSC8244_ISTAT  0x1a
+#define MII_VSC8244_ISTAT_STATUS   0x8000
+#define MII_VSC8244_ISTAT_SPEED0x4000
+#define MII_VSC8244_ISTAT_LINK 0x2000
+#define MII_VSC8244_ISTAT_DUPLEX   0x1000
+
+/* Vitesse Auxiliary Control/Status Register */
+#define MII_VSC8244_AUX_CONSTAT0x1c
+#define MII_VSC8244_AUXCONSTAT_INIT0x0004
+#define MII_VSC8244_AUXCONSTAT_DUPLEX  0x0020
+#define MII_VSC8244_AUXCONSTAT_SPEED   0x0018
+#define MII_VSC8244_AUXCONSTAT_GBIT0x0010
+#define MII_VSC8244_AUXCONSTAT_100 0x0008
+
+MODULE_DESCRIPTION("Vitesse PHY driver");
+MODULE_AUTHOR("Kriston Carson");
+MODULE_LICENSE("GPL");
+
+static int vsc824x_config_init(struct phy_device *phydev)
+{
+   int err;
+
+   err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT,
+   MII_VSC8244_AUXCONSTAT_INIT);
+
+   if (err < 0)
+   return err;
+
+   err = phy_write(phydev, MII_VSC8244_EXT_CON1,
+   MII_VSC8244_EXTCON1_INIT);
+
+   return err;
+
+}
+
+static int vsc824x_ack_interrupt(struct phy_device *phydev)
+{
+   int err = phy_read(phydev, MII_VSC8244_ISTAT);
+
+   return (err < 0) ? err : 0;
+
+}
+
+static int vsc824x_config_intr(struct phy_device *phydev)
+{
+   int err;
+
+   if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+   err = phy_write(phydev, MII_VSC8244_IMASK,
+   MII_VSC8244_IMASK_MASK);
+   else
+   err = phy_write(phydev, MII_VSC8244_IMASK, 0);
+
+   return err;
+
+}
+
+/* Vitesse 824x */
+static struct phy_driver vsc8244_driv