aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/fec.c22
-rw-r--r--drivers/net/fec.h2
-rw-r--r--include/linux/fec.h21
3 files changed, 45 insertions, 0 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 42d9ac9ba39..326465ffbb2 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -41,6 +41,7 @@
41#include <linux/clk.h> 41#include <linux/clk.h>
42#include <linux/platform_device.h> 42#include <linux/platform_device.h>
43#include <linux/phy.h> 43#include <linux/phy.h>
44#include <linux/fec.h>
44 45
45#include <asm/cacheflush.h> 46#include <asm/cacheflush.h>
46 47
@@ -182,6 +183,7 @@ struct fec_enet_private {
182 struct phy_device *phy_dev; 183 struct phy_device *phy_dev;
183 int mii_timeout; 184 int mii_timeout;
184 uint phy_speed; 185 uint phy_speed;
186 phy_interface_t phy_interface;
185 int index; 187 int index;
186 int link; 188 int link;
187 int full_duplex; 189 int full_duplex;
@@ -1191,6 +1193,21 @@ fec_restart(struct net_device *dev, int duplex)
1191 /* Set MII speed */ 1193 /* Set MII speed */
1192 writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); 1194 writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
1193 1195
1196#ifdef FEC_MIIGSK_ENR
1197 if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) {
1198 /* disable the gasket and wait */
1199 writel(0, fep->hwp + FEC_MIIGSK_ENR);
1200 while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4)
1201 udelay(1);
1202
1203 /* configure the gasket: RMII, 50 MHz, no loopback, no echo */
1204 writel(1, fep->hwp + FEC_MIIGSK_CFGR);
1205
1206 /* re-enable the gasket */
1207 writel(2, fep->hwp + FEC_MIIGSK_ENR);
1208 }
1209#endif
1210
1194 /* And last, enable the transmit and receive processing */ 1211 /* And last, enable the transmit and receive processing */
1195 writel(2, fep->hwp + FEC_ECNTRL); 1212 writel(2, fep->hwp + FEC_ECNTRL);
1196 writel(0, fep->hwp + FEC_R_DES_ACTIVE); 1213 writel(0, fep->hwp + FEC_R_DES_ACTIVE);
@@ -1226,6 +1243,7 @@ static int __devinit
1226fec_probe(struct platform_device *pdev) 1243fec_probe(struct platform_device *pdev)
1227{ 1244{
1228 struct fec_enet_private *fep; 1245 struct fec_enet_private *fep;
1246 struct fec_platform_data *pdata;
1229 struct net_device *ndev; 1247 struct net_device *ndev;
1230 int i, irq, ret = 0; 1248 int i, irq, ret = 0;
1231 struct resource *r; 1249 struct resource *r;
@@ -1259,6 +1277,10 @@ fec_probe(struct platform_device *pdev)
1259 1277
1260 platform_set_drvdata(pdev, ndev); 1278 platform_set_drvdata(pdev, ndev);
1261 1279
1280 pdata = pdev->dev.platform_data;
1281 if (pdata)
1282 fep->phy_interface = pdata->phy;
1283
1262 /* This device has up to three irqs on some platforms */ 1284 /* This device has up to three irqs on some platforms */
1263 for (i = 0; i < 3; i++) { 1285 for (i = 0; i < 3; i++) {
1264 irq = platform_get_irq(pdev, i); 1286 irq = platform_get_irq(pdev, i);
diff --git a/drivers/net/fec.h b/drivers/net/fec.h
index cc47f3f057c..2c48b25668d 100644
--- a/drivers/net/fec.h
+++ b/drivers/net/fec.h
@@ -43,6 +43,8 @@
43#define FEC_R_DES_START 0x180 /* Receive descriptor ring */ 43#define FEC_R_DES_START 0x180 /* Receive descriptor ring */
44#define FEC_X_DES_START 0x184 /* Transmit descriptor ring */ 44#define FEC_X_DES_START 0x184 /* Transmit descriptor ring */
45#define FEC_R_BUFF_SIZE 0x188 /* Maximum receive buff size */ 45#define FEC_R_BUFF_SIZE 0x188 /* Maximum receive buff size */
46#define FEC_MIIGSK_CFGR 0x300 /* MIIGSK Configuration reg */
47#define FEC_MIIGSK_ENR 0x308 /* MIIGSK Enable reg */
46 48
47#else 49#else
48 50
diff --git a/include/linux/fec.h b/include/linux/fec.h
new file mode 100644
index 00000000000..5d3523d8dd0
--- /dev/null
+++ b/include/linux/fec.h
@@ -0,0 +1,21 @@
1/* include/linux/fec.h
2 *
3 * Copyright (c) 2009 Orex Computed Radiography
4 * Baruch Siach <baruch@tkos.co.il>
5 *
6 * Header file for the FEC platform data
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __LINUX_FEC_H__
13#define __LINUX_FEC_H__
14
15#include <linux/phy.h>
16
17struct fec_platform_data {
18 phy_interface_t phy;
19};
20
21#endif