summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAlison Wang <b18965@freescale.com>2012-07-26 15:48:17 +0800
committerJustin Waters <justin.waters@timesys.com>2012-09-12 16:49:43 -0400
commit4573f0e4d46c09dfaf857d9c085cbdefe4a756c5 (patch)
tree55ee166394a6c972da9a6a5a91c2c47af60e7b37 /drivers
parent6d095ab8a4a476c4ffd686021855cfcbb6211396 (diff)
ENGR00181358-2: fec: add FEC driver support for MVF
Add FEC driver support for MVF. Update the phyid for micrel ksz8041 phy. There are several version sz8041 with different phyid. Those id: 0x00221510, 0x00221512, 0x00221513 were found on different version SER board. So change the mask to 0x00fffff0 to fit the different version. Signed-off-by: Jason Jin <Jason.jin@freescale.com>
Diffstat (limited to 'drivers')
-rwxr-xr-xdrivers/net/fec.c14
-rw-r--r--drivers/net/phy/Kconfig5
-rw-r--r--drivers/net/phy/Makefile1
-rw-r--r--drivers/net/phy/micrel.c2
-rw-r--r--drivers/net/phy/national8384x.c109
5 files changed, 126 insertions, 5 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 872b7c4c5cc6..73f3f2b49a61 100755
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -71,7 +71,7 @@
#define FEC_QUIRK_SWAP_FRAME (1 << 1)
static struct platform_device_id fec_devtype[] = {
-#ifdef CONFIG_SOC_IMX6Q
+#if defined(CONFIG_SOC_IMX6Q) || defined(CONFIG_SOC_MVFA5)
{
.name = DRIVER_NAME,
.driver_data = FEC_QUIRK_ENET_MAC,
@@ -170,7 +170,8 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
*/
#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
defined(CONFIG_M520x) || defined(CONFIG_M532x) || \
- defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28)
+ defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28) || \
+ defined(CONFIG_SOC_MVFA5)
#define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16)
#else
#define OPT_FRAME_SIZE 0
@@ -905,6 +906,8 @@ static int fec_enet_mii_init(struct platform_device *pdev)
fep->phy_speed = DIV_ROUND_UP(clk_get_rate(fep->clk),
(FEC_ENET_MII_CLK << 2)) << 1;
+ fep->phy_speed |= 0x10;
+
/* set hold time to 2 internal clock cycle */
if (cpu_is_mx6())
fep->phy_speed |= FEC_ENET_HOLD_TIME;
@@ -1464,7 +1467,7 @@ fec_restart(struct net_device *dev, int duplex)
fep->phy_dev->speed == SPEED_1000)
val |= (0x1 << 5);
- if (cpu_is_mx6()) {
+ if (cpu_is_mx6() || cpu_is_mvf()) {
/* enable endian swap */
val |= (0x1 << 8);
/* enable ENET store and forward mode */
@@ -1495,11 +1498,12 @@ fec_stop(struct net_device *dev)
writel(1, fep->hwp + FEC_ECNTRL);
udelay(10);
- if (cpu_is_mx6())
+ if (cpu_is_mx6() || cpu_is_mvf())
/* FIXME: we have to enable enet to keep mii interrupt works. */
writel(2, fep->hwp + FEC_ECNTRL);
writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
+
if (fep->ptimer_present)
fec_ptp_stop(fep->ptp_priv);
writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
@@ -1535,6 +1539,7 @@ fec_probe(struct platform_device *pdev)
fep = netdev_priv(ndev);
fep->hwp = ioremap(r->start, resource_size(r));
+
fep->pdev = pdev;
if (!fep->hwp) {
@@ -1564,6 +1569,7 @@ fec_probe(struct platform_device *pdev)
}
fep->clk = clk_get(&pdev->dev, "fec_clk");
+
if (IS_ERR(fep->clk)) {
ret = PTR_ERR(fep->clk);
goto failed_clk;
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index a70244306c94..3cff233db5b6 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -77,6 +77,11 @@ config NATIONAL_PHY
---help---
Currently supports the DP83865 PHY.
+config NATIONAL8384x_PHY
+ tristate "Drivers for National Semiconductor dp83848 dp83849 PHYs"
+ ---help---
+ Currently supports the DP83848/9 PHY.
+
config STE10XP
tristate "Driver for STMicroelectronics STe10Xp PHYs"
---help---
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 2333215bbb32..e0a2d52941db 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_FIXED_PHY) += fixed.o
obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o
obj-$(CONFIG_NATIONAL_PHY) += national.o
+obj-$(CONFIG_NATIONAL8384x_PHY) += national8384x.o
obj-$(CONFIG_DP83640_PHY) += dp83640.o
obj-$(CONFIG_STE10XP) += ste10Xp.o
obj-$(CONFIG_MICREL_PHY) += micrel.o
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 80747d2d1118..1d18fdbebf6c 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -130,7 +130,7 @@ static struct phy_driver ks8737_driver = {
static struct phy_driver ks8041_driver = {
.phy_id = PHY_ID_KS8041,
- .phy_id_mask = 0x00ffffff,
+ .phy_id_mask = 0x00fffff0,
.name = "Micrel KS8041",
.features = (PHY_BASIC_FEATURES | SUPPORTED_Pause
| SUPPORTED_Asym_Pause),
diff --git a/drivers/net/phy/national8384x.c b/drivers/net/phy/national8384x.c
new file mode 100644
index 000000000000..775e56235343
--- /dev/null
+++ b/drivers/net/phy/national8384x.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2009-2012 Freescale Semiconductor, Inc.
+ *
+ * Driver for National Semiconductor PHYs 8384x
+ *
+ * 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 <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/mii.h>
+#include <linux/ethtool.h>
+#include <linux/phy.h>
+#include <linux/netdevice.h>
+
+/* DP8384x phy identifier values */
+#define DP83848_PHY_ID 0x20005c90
+#define DP83849_PHY_ID 0x20005ca0
+/* PHY Status Register */
+#define MII_DP8384X_PHYSTST 16
+
+static int ns8384x_config_intr(struct phy_device *phydev)
+{
+ int err = 0;
+
+ return err;
+}
+
+static int ns8384x_ack_interrupt(struct phy_device *phydev)
+{
+ return 0;
+}
+
+static int ns8384x_config_init(struct phy_device *phydev)
+{
+ int ret = phy_read(phydev, MII_DP8384X_PHYSTST);
+ if (ret < 0) {
+ printk(KERN_INFO "%s MII_DP83640_ISR %x\n",
+ __func__, ret);
+ }
+
+ return ns8384x_ack_interrupt(phydev);
+}
+
+static struct phy_driver dp83848_driver = {
+ .phy_id = DP83848_PHY_ID,
+ .phy_id_mask = 0xfffffff0,
+ .name = "NatSemi DP83848",
+ .features = PHY_BASIC_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_init = ns8384x_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = ns8384x_ack_interrupt,
+ .config_intr = ns8384x_config_intr,
+ .driver = {.owner = THIS_MODULE,}
+};
+
+static struct phy_driver dp83849_driver = {
+ .phy_id = DP83849_PHY_ID,
+ .phy_id_mask = 0xfffffff0,
+ .name = "NatSemi DP83849",
+ .features = PHY_BASIC_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_init = ns8384x_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = ns8384x_ack_interrupt,
+ .config_intr = ns8384x_config_intr,
+ .driver = {.owner = THIS_MODULE,}
+};
+
+static int __init ns8384x_init(void)
+{
+ int ret;
+
+ ret = phy_driver_register(&dp83848_driver);
+ if (ret)
+ goto err1;
+
+ ret = phy_driver_register(&dp83849_driver);
+ if (ret)
+ goto err2;
+
+ return 0;
+err2:
+ printk(KERN_INFO "register dp83849 PHY driver fail\n");
+ phy_driver_unregister(&dp83848_driver);
+err1:
+ printk(KERN_INFO "register dp83848 PHY driver fail\n");
+ return ret;
+}
+
+static void __exit ns8384x_exit(void)
+{
+ phy_driver_unregister(&dp83848_driver);
+ phy_driver_unregister(&dp83849_driver);
+}
+
+MODULE_DESCRIPTION("NatSemi PHY driver");
+MODULE_AUTHOR("Chenghu Wu <b16972@freescale.com>");
+MODULE_LICENSE("GPL v2");
+
+module_init(ns8384x_init);
+module_exit(ns8384x_exit);