From 125b70af79aabc7052bf732aa554f61044bdec1d Mon Sep 17 00:00:00 2001 From: Jason Jin Date: Sat, 19 Apr 2008 15:07:56 +0800 Subject: [PATCH] --- yaml --- r: 95845 b: refs/heads/master c: aecb2b6eac6ee596f34a54fb164138756895c78a h: refs/heads/master i: 95843: 1cd7c5cdc1f2f7c4aa185dde974024ec12853aca v: v3 --- [refs] | 2 +- .../powerpc/mpc52xx-device-tree-bindings.txt | 11 --- trunk/arch/powerpc/boot/dts/mpc8610_hpcd.dts | 2 +- trunk/drivers/net/fec_mpc52xx.c | 97 +++++-------------- trunk/drivers/net/fec_mpc52xx.h | 19 ++++ trunk/drivers/serial/mpc52xx_uart.c | 2 - 6 files changed, 44 insertions(+), 89 deletions(-) diff --git a/[refs] b/[refs] index cab9c3b472c7..de786fadecda 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fbe543b412cef02350fab35526a6d4dc3d20d182 +refs/heads/master: aecb2b6eac6ee596f34a54fb164138756895c78a diff --git a/trunk/Documentation/powerpc/mpc52xx-device-tree-bindings.txt b/trunk/Documentation/powerpc/mpc52xx-device-tree-bindings.txt index 6f12f1c79c0c..cda7a7dffa6d 100644 --- a/trunk/Documentation/powerpc/mpc52xx-device-tree-bindings.txt +++ b/trunk/Documentation/powerpc/mpc52xx-device-tree-bindings.txt @@ -237,17 +237,6 @@ Each GPIO controller node should have the empty property gpio-controller and according to the bit numbers in the GPIO control registers. The second cell is for flags which is currently unsused. -8) FEC nodes -The FEC node can specify one of the following properties to configure -the MII link: -"fsl,7-wire-mode" - An empty property that specifies the link uses 7-wire - mode instead of MII -"current-speed" - Specifies that the MII should be configured for a fixed - speed. This property should contain two cells. The - first cell specifies the speed in Mbps and the second - should be '0' for half duplex and '1' for full duplex -"phy-handle" - Contains a phandle to an Ethernet PHY. - IV - Extra Notes ================ diff --git a/trunk/arch/powerpc/boot/dts/mpc8610_hpcd.dts b/trunk/arch/powerpc/boot/dts/mpc8610_hpcd.dts index 1f2f1e0a5571..255dfefc2d6d 100644 --- a/trunk/arch/powerpc/boot/dts/mpc8610_hpcd.dts +++ b/trunk/arch/powerpc/boot/dts/mpc8610_hpcd.dts @@ -105,7 +105,7 @@ compatible = "ns16550"; reg = <0x4600 0x100>; clock-frequency = <0>; - interrupts = <28 2>; + interrupts = <42 2>; interrupt-parent = <&mpic>; }; diff --git a/trunk/drivers/net/fec_mpc52xx.c b/trunk/drivers/net/fec_mpc52xx.c index 5f9c42e7a7f1..d21b7ab64bd1 100644 --- a/trunk/drivers/net/fec_mpc52xx.c +++ b/trunk/drivers/net/fec_mpc52xx.c @@ -43,29 +43,6 @@ #define DRIVER_NAME "mpc52xx-fec" -#define FEC5200_PHYADDR_NONE (-1) -#define FEC5200_PHYADDR_7WIRE (-2) - -/* Private driver data structure */ -struct mpc52xx_fec_priv { - int duplex; - int speed; - int r_irq; - int t_irq; - struct mpc52xx_fec __iomem *fec; - struct bcom_task *rx_dmatsk; - struct bcom_task *tx_dmatsk; - spinlock_t lock; - int msg_enable; - - /* MDIO link details */ - int phy_addr; - unsigned int phy_speed; - struct phy_device *phydev; - enum phy_state link; -}; - - static irqreturn_t mpc52xx_fec_interrupt(int, void *); static irqreturn_t mpc52xx_fec_rx_interrupt(int, void *); static irqreturn_t mpc52xx_fec_tx_interrupt(int, void *); @@ -246,7 +223,7 @@ static int mpc52xx_fec_phy_start(struct net_device *dev) struct mpc52xx_fec_priv *priv = netdev_priv(dev); int err; - if (priv->phy_addr < 0) + if (!priv->has_phy) return 0; err = mpc52xx_fec_init_phy(dev); @@ -266,7 +243,7 @@ static void mpc52xx_fec_phy_stop(struct net_device *dev) { struct mpc52xx_fec_priv *priv = netdev_priv(dev); - if (!priv->phydev) + if (!priv->has_phy) return; phy_disconnect(priv->phydev); @@ -278,7 +255,7 @@ static void mpc52xx_fec_phy_stop(struct net_device *dev) static int mpc52xx_fec_phy_mii_ioctl(struct mpc52xx_fec_priv *priv, struct mii_ioctl_data *mii_data, int cmd) { - if (!priv->phydev) + if (!priv->has_phy) return -ENOTSUPP; return phy_mii_ioctl(priv->phydev, mii_data, cmd); @@ -288,7 +265,7 @@ static void mpc52xx_fec_phy_hw_init(struct mpc52xx_fec_priv *priv) { struct mpc52xx_fec __iomem *fec = priv->fec; - if (priv->phydev) + if (!priv->has_phy) return; out_be32(&fec->mii_speed, priv->phy_speed); @@ -727,7 +704,7 @@ static void mpc52xx_fec_start(struct net_device *dev) rcntrl = FEC_RX_BUFFER_SIZE << 16; /* max frame length */ rcntrl |= FEC_RCNTRL_FCE; - if (priv->phy_addr != FEC5200_PHYADDR_7WIRE) + if (priv->has_phy) rcntrl |= FEC_RCNTRL_MII_MODE; if (priv->duplex == DUPLEX_FULL) @@ -887,10 +864,7 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) struct net_device *ndev; struct mpc52xx_fec_priv *priv = NULL; struct resource mem; - struct device_node *phy_node; - const phandle *phy_handle; - const u32 *prop; - int prop_size; + const phandle *ph; phys_addr_t rx_fifo; phys_addr_t tx_fifo; @@ -974,37 +948,26 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) mpc52xx_fec_get_paddr(ndev, ndev->dev_addr); priv->msg_enable = netif_msg_init(debug, MPC52xx_MESSAGES_DEFAULT); + priv->duplex = DUPLEX_FULL; - /* - * Link mode configuration - */ + /* is the phy present in device tree? */ + ph = of_get_property(op->node, "phy-handle", NULL); + if (ph) { + const unsigned int *prop; + struct device_node *phy_dn; + priv->has_phy = 1; - /* Start with safe defaults for link connection */ - priv->phy_addr = FEC5200_PHYADDR_NONE; - priv->speed = 100; - priv->duplex = DUPLEX_HALF; - priv->phy_speed = ((mpc52xx_find_ipb_freq(op->node) >> 20) / 5) << 1; - - /* the 7-wire property means don't use MII mode */ - if (of_find_property(op->node, "fsl,7-wire-mode", NULL)) - priv->phy_addr = FEC5200_PHYADDR_7WIRE; - - /* The current speed preconfigures the speed of the MII link */ - prop = of_get_property(op->node, "current-speed", &prop_size); - if (prop && (prop_size >= sizeof(u32) * 2)) { - priv->speed = prop[0]; - priv->duplex = prop[1] ? DUPLEX_FULL : DUPLEX_HALF; - } + phy_dn = of_find_node_by_phandle(*ph); + prop = of_get_property(phy_dn, "reg", NULL); + priv->phy_addr = *prop; + + of_node_put(phy_dn); - /* If there is a phy handle, setup link to that phy */ - phy_handle = of_get_property(op->node, "phy-handle", &prop_size); - if (phy_handle && (prop_size >= sizeof(phandle))) { - phy_node = of_find_node_by_phandle(*phy_handle); - prop = of_get_property(phy_node, "reg", &prop_size); - if (prop && (prop_size >= sizeof(u32))) - if ((*prop >= 0) && (*prop < PHY_MAX_ADDR)) - priv->phy_addr = *prop; - of_node_put(phy_node); + /* Phy speed */ + priv->phy_speed = ((mpc52xx_find_ipb_freq(op->node) >> 20) / 5) << 1; + } else { + dev_info(&ndev->dev, "can't find \"phy-handle\" in device" + " tree, using 7-wire mode\n"); } /* Hardware init */ @@ -1019,20 +982,6 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) if (rv < 0) goto probe_error; - /* Now report the link setup */ - switch (priv->phy_addr) { - case FEC5200_PHYADDR_NONE: - dev_info(&ndev->dev, "Fixed speed MII link: %i%cD\n", - priv->speed, priv->duplex ? 'F' : 'H'); - break; - case FEC5200_PHYADDR_7WIRE: - dev_info(&ndev->dev, "using 7-wire PHY mode\n"); - break; - default: - dev_info(&ndev->dev, "Using PHY at MDIO address %i\n", - priv->phy_addr); - } - /* We're done ! */ dev_set_drvdata(&op->dev, ndev); diff --git a/trunk/drivers/net/fec_mpc52xx.h b/trunk/drivers/net/fec_mpc52xx.h index a227a525bdbb..8b1f75397b9a 100644 --- a/trunk/drivers/net/fec_mpc52xx.h +++ b/trunk/drivers/net/fec_mpc52xx.h @@ -26,6 +26,25 @@ #define FEC_WATCHDOG_TIMEOUT ((400*HZ)/1000) +struct mpc52xx_fec_priv { + int duplex; + int r_irq; + int t_irq; + struct mpc52xx_fec __iomem *fec; + struct bcom_task *rx_dmatsk; + struct bcom_task *tx_dmatsk; + spinlock_t lock; + int msg_enable; + + int has_phy; + unsigned int phy_speed; + unsigned int phy_addr; + struct phy_device *phydev; + enum phy_state link; + int speed; +}; + + /* ======================================================================== */ /* Hardware register sets & bits */ /* ======================================================================== */ diff --git a/trunk/drivers/serial/mpc52xx_uart.c b/trunk/drivers/serial/mpc52xx_uart.c index efc971d9647b..7a3625f52a03 100644 --- a/trunk/drivers/serial/mpc52xx_uart.c +++ b/trunk/drivers/serial/mpc52xx_uart.c @@ -783,9 +783,7 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port) } } - spin_unlock(&port->lock); tty_flip_buffer_push(tty); - spin_lock(&port->lock); return psc_ops->raw_rx_rdy(port); }