Skip to contentSkip to conversation

net fec_imx: add support for i.MX6 1000Mbps mode

PATCH Applied Hubert Feurstein 3 participants 4 messages Feb 7, 2013 – Feb 11, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net fec_imx: add support for i.MX6 1000Mbps mode

---
 drivers/net/fec_imx.c | 14 ++++++++++----
 drivers/net/fec_imx.h |  1 +
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/net/fec_imx.c +10 -4
index 2378a19..7320f07 100644
@@ -361,12 +361,18 @@ static int fec_init(struct eth_device *dev)
 static void fec_update_linkspeed(struct eth_device *edev)
 {
 	struct fec_priv *fec = (struct fec_priv *)edev->priv;
+	int speed = edev->phydev->speed;
+	u32 rcntl = readl(fec->regs + FEC_R_CNTRL) & ~FEC_R_CNTRL_RMII_10T;
+	u32 ecntl = readl(fec->regs + FEC_ECNTRL) & ~FEC_ECNTRL_SPEED;
 
-	if (edev->phydev->speed == SPEED_10) {
-		u32 rcntl = readl(fec->regs + FEC_R_CNTRL);
+	if (speed == SPEED_10)
 		rcntl |= FEC_R_CNTRL_RMII_10T;
-		writel(rcntl, fec->regs + FEC_R_CNTRL);
-	}
+
+	if (speed == SPEED_1000)
+		ecntl |= FEC_ECNTRL_SPEED;
+
+	writel(rcntl, fec->regs + FEC_R_CNTRL);
+	writel(ecntl, fec->regs + FEC_ECNTRL);
 }
 
 /**
drivers/net/fec_imx.h +1 -0
index 1eb1eba..29aea85 100644
@@ -92,6 +92,7 @@
 
 #define FEC_ECNTRL_RESET                0x00000001	/**< reset the FEC */
 #define FEC_ECNTRL_ETHER_EN             0x00000002	/**< enable the FEC */
+#define FEC_ECNTRL_SPEED                0x00000020	/**< i.MX6: enable 1000Mbps mode */
 
 /**
  * @brief Descriptor buffer alignment
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

Any comments on this?

2013/2/7 Hubert Feurstein <[email protected]>:

Quoted 46 lines
---
 drivers/net/fec_imx.c | 14 ++++++++++----
 drivers/net/fec_imx.h |  1 +
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/net/fec_imx.c +10 -4
index 2378a19..7320f07 100644
@@ -361,12 +361,18 @@ static int fec_init(struct eth_device *dev)
 static void fec_update_linkspeed(struct eth_device *edev)
 {
        struct fec_priv *fec = (struct fec_priv *)edev->priv;
+       int speed = edev->phydev->speed;
+       u32 rcntl = readl(fec->regs + FEC_R_CNTRL) & ~FEC_R_CNTRL_RMII_10T;
+       u32 ecntl = readl(fec->regs + FEC_ECNTRL) & ~FEC_ECNTRL_SPEED;
 
-       if (edev->phydev->speed == SPEED_10) {
-               u32 rcntl = readl(fec->regs + FEC_R_CNTRL);
+       if (speed == SPEED_10)
                rcntl |= FEC_R_CNTRL_RMII_10T;
-               writel(rcntl, fec->regs + FEC_R_CNTRL);
-       }
+
+       if (speed == SPEED_1000)
+               ecntl |= FEC_ECNTRL_SPEED;
+
+       writel(rcntl, fec->regs + FEC_R_CNTRL);
+       writel(ecntl, fec->regs + FEC_ECNTRL);
 }
 
 /**
drivers/net/fec_imx.h +1 -1
index 1eb1eba..29aea85 100644
@@ -92,6 +92,7 @@
 
 #define FEC_ECNTRL_RESET                0x00000001     /**< reset the FEC */
 #define FEC_ECNTRL_ETHER_EN             0x00000002     /**< enable the FEC */
+#define FEC_ECNTRL_SPEED                0x00000020     /**< i.MX6: enable 1000Mbps mode */
 
 /**
  * @brief Descriptor buffer alignment
--
Quoted 2 lines

1.8.1

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw
Quoted 1 line · Hubert Feurstein

Any comments on this?

I've been said that a co-worker tested it successfully. If that's of any help.

Have a nice weekend.

Signature · 9 lines
Mierswa, Daniel

If you still don't like it, that's ok: that's why I'm boss. I simply know better than you do.
               --- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer Applied
#3 lore raw
In reply to Hubert Feurstein
Quoted 5 lines · Hubert Feurstein
---
 drivers/net/fec_imx.c | 14 ++++++++++----
 drivers/net/fec_imx.h |  1 +
 2 files changed, 11 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

Quoted 44 lines
drivers/net/fec_imx.c +10 -4
index 2378a19..7320f07 100644
@@ -361,12 +361,18 @@ static int fec_init(struct eth_device *dev)
 static void fec_update_linkspeed(struct eth_device *edev)
 {
 	struct fec_priv *fec = (struct fec_priv *)edev->priv;
+	int speed = edev->phydev->speed;
+	u32 rcntl = readl(fec->regs + FEC_R_CNTRL) & ~FEC_R_CNTRL_RMII_10T;
+	u32 ecntl = readl(fec->regs + FEC_ECNTRL) & ~FEC_ECNTRL_SPEED;
 
-	if (edev->phydev->speed == SPEED_10) {
-		u32 rcntl = readl(fec->regs + FEC_R_CNTRL);
+	if (speed == SPEED_10)
 		rcntl |= FEC_R_CNTRL_RMII_10T;
-		writel(rcntl, fec->regs + FEC_R_CNTRL);
-	}
+
+	if (speed == SPEED_1000)
+		ecntl |= FEC_ECNTRL_SPEED;
+
+	writel(rcntl, fec->regs + FEC_R_CNTRL);
+	writel(ecntl, fec->regs + FEC_ECNTRL);
 }
 
 /**
drivers/net/fec_imx.h +1 -0
index 1eb1eba..29aea85 100644
@@ -92,6 +92,7 @@
 
 #define FEC_ECNTRL_RESET                0x00000001	/**< reset the FEC */
 #define FEC_ECNTRL_ETHER_EN             0x00000002	/**< enable the FEC */
+#define FEC_ECNTRL_SPEED                0x00000020	/**< i.MX6: enable 1000Mbps mode */
 
 /**
  * @brief Descriptor buffer alignment
Signature · 1 line
1.8.1
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox