This series adds common code for reading PHY connection data out of the OpenFirmware device tree. This simplifies the network drivers which use the device tree and which currently implement their own solutions for reading the PHY data out of the device tree directly. This series was depending on changes in both the netdev and powerpc -next trees. Now that both trees have been merged by Linus, I'm able to post this series in a usable form. David, as I mentioned below, I'd really like to get the core changes (1, 4, 5 6) merged into 2.6.30 (assuming Andy confirms they are okay). Due to dependencies, I think it is easiest if all of them go in via the same tree. Are you willing to merge them via yours? Two of the patches are outside of drivers/net (patches 1 and 6 touch drivers/of/), but I personally have no issues if those changes go through you. I just need to double check with BenH. Patches 1, 4, 5 and 6 are the core changes. They have been tested and I think they are ready to be merged. Andy, can you please reply and confirm that you're okay with these 4? I'd like to see them go in the 2.6.30 merge window. [01/14] of: add of_parse_phandle() helper for parsing phandle [04/14] phylib: rework to prepare for OF registration of PHYs [05/14] phylib: add *_direct() variants of phy_connect and phy_attach [06/14] openfirmware: Add OF phylib support code Patches 2, 3, and 7 (sorry about the funny ordering) are changes to the fec_mpc52xx driver. Actually, 2 & 3 are a cleanup and bug fix, but patch 7 depends on them so I'm including them here. All three are tested and working. [02/14] net/fec_mpc52xx: Migrate to net_device_ops. [03/14] net/fec_mpc52xx: Don't dereference phy_device if it is NULL [07/14] net: Rework mpc5200 fec driver to use of_mdio infrastructure. Patches 8, 9, 10, 12 & 13 are compile tested, but not tested with hardware. They are not ready to be merged, and I would like it if someone with hardware can try them out. I need to review these ...
From: Grant Likely <grant.likely@secretlab.ca>
of_parse_phandle() is a helper function to read and parse a phandle
property and return a pointer to the resulting device_node.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
CC: Michael Ellerman <michael@ellerman.id.au>
---
drivers/of/base.c | 24 ++++++++++++++++++++++++
include/linux/of.h | 3 +++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index cd17092..104b8c0 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -494,6 +494,30 @@ int of_modalias_node(struct device_node *node, char *modalias, int len)
EXPORT_SYMBOL_GPL(of_modalias_node);
/**
+ * of_parse_phandle - Resolve a phandle property to a device_node pointer
+ * @np: Pointer to device node holding phandle property
+ * @phandle_name: Name of property holding a phandle value
+ * @index: For properties holding a table of phandles, this is the index into
+ * the table
+ *
+ * Returns the device_node pointer with refcount incremented. Use
+ * of_node_put() on it when done.
+ */
+struct device_node *
+of_parse_phandle(struct device_node *np, const char *phandle_name, int index)
+{
+ const phandle *phandle;
+ int size;
+
+ phandle = of_get_property(np, phandle_name, &size);
+ if ((!phandle) || (size < sizeof(*phandle) * (index + 1)))
+ return NULL;
+
+ return of_find_node_by_phandle(phandle[index]);
+}
+EXPORT_SYMBOL(of_parse_phandle);
+
+/**
* of_parse_phandles_with_args - Find a node pointed by phandle in a list
* @np: pointer to a device tree node containing a list
* @list_name: property name that contains a list
diff --git a/include/linux/of.h b/include/linux/of.h
index 6a7efa2..7be2d10 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -77,6 +77,9 @@ extern int of_n_size_cells(struct device_node *np);
extern const struct of_device_id *of_match_node(
const struct of_device_id *matches, const struct device_node *node);
extern int ...From: Grant Likely <grant.likely@secretlab.ca>
The FEC Ethernet device isn't always attached to a phy. Be careful
not to dereference phy_device if it is NULL.
Reported-by: Henk Stegeman <henk.stegeman@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/net/fec_mpc52xx.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 75d0569..e10eb2c 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -271,15 +271,6 @@ static void mpc52xx_fec_phy_stop(struct net_device *dev)
phy_write(priv->phydev, MII_BMCR, BMCR_PDOWN);
}
-static int mpc52xx_fec_phy_mii_ioctl(struct mpc52xx_fec_priv *priv,
- struct mii_ioctl_data *mii_data, int cmd)
-{
- if (!priv->phydev)
- return -ENOTSUPP;
-
- return phy_mii_ioctl(priv->phydev, mii_data, cmd);
-}
-
static void mpc52xx_fec_phy_hw_init(struct mpc52xx_fec_priv *priv)
{
struct mpc52xx_fec __iomem *fec = priv->fec;
@@ -852,12 +843,20 @@ static void mpc52xx_fec_get_drvinfo(struct net_device *dev,
static int mpc52xx_fec_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
+
+ if (!priv->phydev)
+ return -ENODEV;
+
return phy_ethtool_gset(priv->phydev, cmd);
}
static int mpc52xx_fec_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
+
+ if (!priv->phydev)
+ return -ENODEV;
+
return phy_ethtool_sset(priv->phydev, cmd);
}
@@ -887,7 +886,10 @@ static int mpc52xx_fec_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
- return mpc52xx_fec_phy_mii_ioctl(priv, if_mii(rq), cmd);
+ if (!priv->phydev)
+ return -ENOTSUPP;
+
+ return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
}
static const struct net_device_ops mpc52xx_fec_netdev_ops = {
--
From: Grant Likely <grant.likely@secretlab.ca> Add support for parsing the device tree for PHY devices on an MDIO bus CC: Andy Fleming <afleming@freescale.com> CC: linuxppc-dev@ozlabs.org CC: devtree-discuss@ozlabs.org Signed-off-by: Grant Likely <grant.likely@secretlab.ca> --- drivers/of/Kconfig | 6 ++ drivers/of/Makefile | 1 drivers/of/of_mdio.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/of_mdio.h | 22 +++++++ 4 files changed, 168 insertions(+), 0 deletions(-) create mode 100644 drivers/of/of_mdio.c create mode 100644 include/linux/of_mdio.h diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index f821dbc..6fe043b 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -19,3 +19,9 @@ config OF_SPI depends on OF && PPC_OF && SPI help OpenFirmware SPI accessors + +config OF_MDIO + def_tristate PHYLIB + depends on OF && PHYLIB + help + OpenFirmware MDIO bus (Ethernet PHY) accessors diff --git a/drivers/of/Makefile b/drivers/of/Makefile index 4c3c6f8..bdfb5f5 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile @@ -3,3 +3,4 @@ obj-$(CONFIG_OF_DEVICE) += device.o platform.o obj-$(CONFIG_OF_GPIO) += gpio.o obj-$(CONFIG_OF_I2C) += of_i2c.o obj-$(CONFIG_OF_SPI) += of_spi.o +obj-$(CONFIG_OF_MDIO) += of_mdio.o diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c new file mode 100644 index 0000000..aee967d --- /dev/null +++ b/drivers/of/of_mdio.c @@ -0,0 +1,139 @@ +/* + * OF helpers for the MDIO (Ethernet PHY) API + * + * Copyright (c) 2009 Secret Lab Technologies, Ltd. + * + * This file is released under the GPLv2 + * + * This file provides helper functions for extracting PHY device information + * out of the OpenFirmware device tree and using it to populate an mii_bus. + */ + +#include <linux/phy.h> +#include <linux/of.h> +#include <linux/of_mdio.h> +#include <linux/module.h> + +MODULE_AUTHOR("Grant Likely ...
From: Grant Likely <grant.likely@secretlab.ca>
This patch simplifies the driver by making use of more common code.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/net/fsl_pq_mdio.c | 53 +++------------------------------------------
1 files changed, 4 insertions(+), 49 deletions(-)
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index b3079a5..83a98f4 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -34,6 +34,7 @@
#include <linux/mii.h>
#include <linux/phy.h>
#include <linux/of.h>
+#include <linux/of_mdio.h>
#include <linux/of_platform.h>
#include <asm/io.h>
@@ -154,44 +155,6 @@ static int fsl_pq_mdio_reset(struct mii_bus *bus)
return 0;
}
-/* Allocate an array which provides irq #s for each PHY on the given bus */
-static int *create_irq_map(struct device_node *np)
-{
- int *irqs;
- int i;
- struct device_node *child = NULL;
-
- irqs = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
-
- if (!irqs)
- return NULL;
-
- for (i = 0; i < PHY_MAX_ADDR; i++)
- irqs[i] = PHY_POLL;
-
- while ((child = of_get_next_child(np, child)) != NULL) {
- int irq = irq_of_parse_and_map(child, 0);
- const u32 *id;
-
- if (irq == NO_IRQ)
- continue;
-
- id = of_get_property(child, "reg", NULL);
-
- if (!id)
- continue;
-
- if (*id < PHY_MAX_ADDR && *id >= 0)
- irqs[*id] = irq;
- else
- printk(KERN_WARNING "%s: "
- "%d is not a valid PHY address\n",
- np->full_name, *id);
- }
-
- return irqs;
-}
-
void fsl_pq_mdio_bus_name(char *name, struct device_node *np)
{
const u32 *addr;
@@ -314,7 +277,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
new_bus->priv = (void __force *)regs;
- new_bus->irq = create_irq_map(np);
+ new_bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
if (NULL == new_bus->irq) {
err = -ENOMEM;
@@ -383,16 +346,8 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
out_be32(tbipa, ...From: Grant Likely <grant.likely@secretlab.ca>
The patch reworks the MPC5200 Fast Ethernet Controller (FEC) driver to
use the of_mdio infrastructure for registering PHY devices from data out
openfirmware device tree, and eliminates the assumption that the PHY
for the FEC is always attached to the FEC's own MDIO bus. With this
patch, the FEC can use a PHY attached to any MDIO bus if it is described
in the device tree.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/net/fec_mpc52xx.c | 180 ++++++++++++-----------------------------
drivers/net/fec_mpc52xx_phy.c | 26 +-----
2 files changed, 59 insertions(+), 147 deletions(-)
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index e10eb2c..0ebd4ec 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -25,6 +25,7 @@
#include <linux/hardirq.h>
#include <linux/delay.h>
#include <linux/of_device.h>
+#include <linux/of_mdio.h>
#include <linux/of_platform.h>
#include <linux/netdevice.h>
@@ -43,11 +44,9 @@
#define DRIVER_NAME "mpc52xx-fec"
-#define FEC5200_PHYADDR_NONE (-1)
-#define FEC5200_PHYADDR_7WIRE (-2)
-
/* Private driver data structure */
struct mpc52xx_fec_priv {
+ struct net_device *ndev;
int duplex;
int speed;
int r_irq;
@@ -59,10 +58,11 @@ struct mpc52xx_fec_priv {
int msg_enable;
/* MDIO link details */
- int phy_addr;
- unsigned int phy_speed;
+ unsigned int mdio_speed;
+ struct device_node *phy_node;
struct phy_device *phydev;
enum phy_state link;
+ int seven_wire_mode;
};
@@ -211,85 +211,25 @@ static void mpc52xx_fec_adjust_link(struct net_device *dev)
phy_print_status(phydev);
}
-static int mpc52xx_fec_init_phy(struct net_device *dev)
-{
- struct mpc52xx_fec_priv *priv = netdev_priv(dev);
- struct phy_device *phydev;
- char phy_id[BUS_ID_SIZE];
-
- snprintf(phy_id, sizeof(phy_id), "%x:%02x",
- (unsigned int)dev->base_addr, priv->phy_addr);
-
- priv->link = ...From: Grant Likely <grant.likely@secretlab.ca>
This patch simplifies the driver by making use of more common code.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/net/gianfar.c | 103 ++++++++++++++++++-------------------------------
drivers/net/gianfar.h | 3 +
2 files changed, 40 insertions(+), 66 deletions(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 65f5587..c22eba9 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -75,6 +75,7 @@
#include <linux/if_vlan.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
+#include <linux/of_mdio.h>
#include <linux/of_platform.h>
#include <linux/ip.h>
#include <linux/tcp.h>
@@ -168,17 +169,13 @@ static inline int gfar_uses_fcb(struct gfar_private *priv)
static int gfar_of_init(struct net_device *dev)
{
- struct device_node *phy, *mdio;
- const unsigned int *id;
const char *model;
const char *ctype;
const void *mac_addr;
- const phandle *ph;
u64 addr, size;
int err = 0;
struct gfar_private *priv = netdev_priv(dev);
struct device_node *np = priv->node;
- char bus_name[MII_BUS_ID_SIZE];
const u32 *stash;
const u32 *stash_len;
const u32 *stash_idx;
@@ -264,8 +261,8 @@ static int gfar_of_init(struct net_device *dev)
if (of_get_property(np, "fsl,magic-packet", NULL))
priv->device_flags |= FSL_GIANFAR_DEV_HAS_MAGIC_PACKET;
- ph = of_get_property(np, "phy-handle", NULL);
- if (ph == NULL) {
+ priv->phy_node = of_parse_phandle(np, "phy-device", 0);
+ if (!priv->phy_node) {
u32 *fixed_link;
fixed_link = (u32 *)of_get_property(np, "fixed-link", NULL);
@@ -273,57 +270,10 @@ static int gfar_of_init(struct net_device *dev)
err = -ENODEV;
goto err_out;
}
-
- snprintf(priv->phy_bus_id, sizeof(priv->phy_bus_id),
- PHY_ID_FMT, "0", fixed_link[0]);
- } else {
- phy = of_find_node_by_phandle(*ph);
-
- if (phy == NULL) {
- err = -ENODEV;
- goto err_out;
- }
-
- mdio = ...I don't believe we need this. Certainly, the current code doesn't do anything like this. The TBI node is a special internal PHY used to manage SGMII/TBI links. Andy --
Actually, it does. gianfar_of_init() used to parse the tbi-handle, and I've replaced that code with a call to of_parse_phandle() in init and an of_phy_connect() in init_phy() to get a pointer to the TBI phy_device. However, you are completely right that calling of_phy_connect() is entirely the wrong thing to do on the TBI phy. It should be retrieving the pointer to the phydevice without actually connecting to it (which forces the phy_driver probe and starts the state machine). I need to fix this. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. --
From: Grant Likely <grant.likely@secretlab.ca> This patch modifies the bitbanged MDIO driver in the ep8248e platform code to use the common of_mdio infrastructure. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> --- arch/powerpc/platforms/82xx/ep8248e.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c index 0eb6d7f..51fcae4 100644 --- a/arch/powerpc/platforms/82xx/ep8248e.c +++ b/arch/powerpc/platforms/82xx/ep8248e.c @@ -14,6 +14,7 @@ #include <linux/interrupt.h> #include <linux/fsl_devices.h> #include <linux/mdio-bitbang.h> +#include <linux/of_mdio.h> #include <linux/of_platform.h> #include <asm/io.h> @@ -115,7 +116,7 @@ static int __devinit ep8248e_mdio_probe(struct of_device *ofdev, struct mii_bus *bus; struct resource res; struct device_node *node; - int ret, i; + int ret; node = of_get_parent(ofdev->node); of_node_put(node); @@ -130,17 +131,13 @@ static int __devinit ep8248e_mdio_probe(struct of_device *ofdev, if (!bus) return -ENOMEM; - bus->phy_mask = 0; bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL); - for (i = 0; i < PHY_MAX_ADDR; i++) - bus->irq[i] = -1; - bus->name = "ep8248e-mdio-bitbang"; bus->parent = &ofdev->dev; snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start); - return mdiobus_register(bus); + return of_mdiobus_register(bus, ofdev->node); } static int ep8248e_mdio_remove(struct of_device *ofdev) --
From: Grant Likely <grant.likely@secretlab.ca>
This patch simplifies the driver by making use of more common code.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/net/ucc_geth.c | 47 ++++++++++++-----------------------------------
drivers/net/ucc_geth.h | 2 +-
2 files changed, 13 insertions(+), 36 deletions(-)
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 933fcfb..471a30a 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -28,6 +28,7 @@
#include <linux/mii.h>
#include <linux/phy.h>
#include <linux/workqueue.h>
+#include <linux/of_mdio.h>
#include <linux/of_platform.h>
#include <asm/uaccess.h>
@@ -1543,12 +1544,14 @@ static int init_phy(struct net_device *dev)
priv->oldspeed = 0;
priv->oldduplex = -1;
- phydev = phy_connect(dev, ug_info->phy_bus_id, &adjust_link, 0,
- priv->phy_interface);
+ if (!ug_info->phy_node)
+ return 0;
- if (IS_ERR(phydev)) {
+ phydev = of_phy_connect(dev, ug_info->phy_node, &adjust_link, 0,
+ priv->phy_interface);
+ if (!phydev) {
printk("%s: Could not attach to PHY\n", dev->name);
- return PTR_ERR(phydev);
+ return -ENODEV;
}
phydev->supported &= (ADVERTISED_10baseT_Half |
@@ -3520,14 +3523,12 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
{
struct device *device = &ofdev->dev;
struct device_node *np = ofdev->node;
- struct device_node *mdio;
struct net_device *dev = NULL;
struct ucc_geth_private *ugeth = NULL;
struct ucc_geth_info *ug_info;
struct resource res;
struct device_node *phy;
int err, ucc_num, max_speed = 0;
- const phandle *ph;
const u32 *fixed_link;
const unsigned int *prop;
const char *sprop;
@@ -3627,45 +3628,21 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
fixed_link = of_get_property(np, "fixed-link", NULL);
if (fixed_link) ...From: Grant Likely <grant.likely@secretlab.ca>
This patch simplifies the driver by making use of more common code.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/net/fs_enet/fs_enet-main.c | 69 ++++++------------------------------
drivers/net/fs_enet/mii-bitbang.c | 29 +--------------
drivers/net/fs_enet/mii-fec.c | 26 +-------------
include/linux/fs_enet_pd.h | 6 +--
4 files changed, 16 insertions(+), 114 deletions(-)
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index b037ce9..387e0e9 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -36,6 +36,8 @@
#include <linux/fs.h>
#include <linux/platform_device.h>
#include <linux/phy.h>
+#include <linux/of.h>
+#include <linux/of_mdio.h>
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
@@ -752,9 +754,10 @@ static int fs_init_phy(struct net_device *dev)
fep->oldlink = 0;
fep->oldspeed = 0;
fep->oldduplex = -1;
- if(fep->fpi->bus_id)
- phydev = phy_connect(dev, fep->fpi->bus_id, &fs_adjust_link, 0,
- PHY_INTERFACE_MODE_MII);
+ if(fep->fpi->phy_node)
+ phydev = of_phy_connect(dev, fep->fpi->phy_node,
+ &fs_adjust_link, 0,
+ PHY_INTERFACE_MODE_MII);
else {
printk("No phy bus ID specified in BSP code\n");
return -EINVAL;
@@ -962,57 +965,6 @@ static void cleanup_immap(void)
/**************************************************************************************/
-static int __devinit find_phy(struct device_node *np,
- struct fs_platform_info *fpi)
-{
- struct device_node *phynode, *mdionode;
- int ret = 0, len, bus_id;
- const u32 *data;
-
- data = of_get_property(np, "fixed-link", NULL);
- if (data) {
- snprintf(fpi->bus_id, 16, "%x:%02x", 0, *data);
- return 0;
- }
-
- data = of_get_property(np, "phy-handle", &len);
- if (!data || len != 4)
- return -EINVAL;
-
- phynode = ...From: Grant Likely <grant.likely@secretlab.ca>
This patch simplifies the driver by making use of more common code.
Tested-by: Olof Johansson <olof@lixom.net>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/powerpc/platforms/pasemi/gpio_mdio.c | 32 +++++------------------------
drivers/net/pasemi_mac.c | 28 ++++---------------------
drivers/net/pasemi_mac.h | 1 -
3 files changed, 9 insertions(+), 52 deletions(-)
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index 75cc165..3bf5467 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -29,7 +29,7 @@
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/phy.h>
-#include <linux/platform_device.h>
+#include <linux/of_mdio.h>
#include <linux/of_platform.h>
#define DELAY 1
@@ -39,6 +39,7 @@ static void __iomem *gpio_regs;
struct gpio_priv {
int mdc_pin;
int mdio_pin;
+ int mdio_irqs[PHY_MAX_ADDR];
};
#define MDC_PIN(bus) (((struct gpio_priv *)bus->priv)->mdc_pin)
@@ -218,12 +219,11 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
const struct of_device_id *match)
{
struct device *dev = &ofdev->dev;
- struct device_node *phy_dn, *np = ofdev->node;
+ struct device_node *np = ofdev->node;
struct mii_bus *new_bus;
struct gpio_priv *priv;
const unsigned int *prop;
int err;
- int i;
err = -ENOMEM;
priv = kzalloc(sizeof(struct gpio_priv), GFP_KERNEL);
@@ -244,27 +244,7 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", *prop);
new_bus->priv = priv;
- new_bus->phy_mask = 0;
-
- new_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
-
- if (!new_bus->irq)
- goto out_free_bus;
-
- for (i = 0; i < PHY_MAX_ADDR; i++)
- new_bus->irq[i] = NO_IRQ;
-
- for ...From: Grant Likely <grant.likely@secretlab.ca> This patch adds support for the Xilinx ll_temac 10/100/1000 Ethernet device. The ll_temac ipcore is typically used on Xilinx Virtex and Spartan designs attached to either a PowerPC 4xx or Microblaze processor. At the present moment, this driver only works with Virtex5 PowerPC designs because it assumes DCR is used to access the DMA registers. However, the low level access to DMA registers is abstracted and it should be easy to adapt for the other implementations. I'm posting this driver now as an RFC. There are still some things that need to be tightened up, but it does appear to be stable. Derived from driver code written by Yoshio Kashiwagi and David H. Lynch Jr. CC: Yoshio Kashiwagi <kashiwagi@co-nss.co.jp> CC: David H. Lynch Jr. <dhlii@dlasys.net> CC: John Linn <john.linn@xilinx.com> CC: John Bonesio <john.bonesio@xilinx.com> CC: David DeBonis <ddeboni@xilinx.com> CC: Wilson Yang <wyang@xilinx.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> --- drivers/net/Kconfig | 8 drivers/net/Makefile | 2 drivers/net/xilinx_temac.c | 970 +++++++++++++++++++++++++++++++++++++++ drivers/net/xilinx_temac.h | 374 +++++++++++++++ drivers/net/xilinx_temac_mdio.c | 119 +++++ 5 files changed, 1473 insertions(+), 0 deletions(-) create mode 100644 drivers/net/xilinx_temac.c create mode 100644 drivers/net/xilinx_temac.h create mode 100644 drivers/net/xilinx_temac_mdio.c diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index f062b42..9578ee0 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -2339,6 +2339,14 @@ config MV643XX_ETH Some boards that use the Discovery chipset are the Momenco Ocelot C and Jaguar ATX and Pegasos II. +config XILINX_TEMAC + tristate "Xilinx TEMAC 10/100/1000 Ethernet MAC driver" + select PHYLIB + depends on PPC_DCR_NATIVE + help + This driver supports the Xilinx 10/100/1000 LocalLink TEMAC + device ...
From: Grant Likely <grant.likely@secretlab.ca> No, sorry. We could have worked out the interdependencies before the merge window openned up. There is no reason this could not have sat in at least somebody's tree before the merge window started. It therefore didn't get any -next exposure, so it's unreasonable to merge this stuff now. --
It's been out there on the list since before the merge window, getting tested by more than just me. This is not series which has simply dropped out of thin air. I've been working hard to address issues reported by others (Thanks Olof!) and to keep it building and applying Since when has sitting in a -next tree been a requirement for merging when the series has been kept up to date and tested? I purposefully kept it out of -next to ensure that when it was applied for real to a -next tree it would be as complete, bug free, and bisectable as possible since once it hits a signed-off -next branch the individual commit cannot be modified. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. --
From: Grant Likely <grant.likely@secretlab.ca> I know your pissed off, but take a deep breath and consider this from my position. If I don't put a line in the sand somewhere, everyone can say "I've been working so hard, I posted it to the lists a thousand times, I have tons of testers" and I have to put the change in. That doesn't work, so please wait until the next release to get your changes in. And get them into a tree that gets exposure in linux-next. Then you have nothing to worry about. Thank you. --
Dammit. Why did you have to go and sound so reasonable when I was all geared up for a pointless flame war. well... alright... but I reserve the right to be grumpy and surly for a few days. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. --
From: Grant Likely <grant.likely@secretlab.ca> Just in case you decided to continue, I did cover my ass by making an explicit posting explaining the policy and the intent on netdev last week: http://marc.info/?l=linux-netdev&m=123814105015481&w=2 --
At the very least, please consider picking up patches 2 & 3. They address a real bug (unrelated to the MDIO rework), and only touch the MPC5200 FEC driver. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. --
From: Grant Likely <grant.likely@secretlab.ca> Please submit them seperately, and I will look them over. Thanks. --
Will do. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. --
Other than the previous comments, all appropriate patches can be marked: Acked-by: Andy Fleming <afleming@freescale.com> --
