[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120819205724.GA27555@electric-eye.fr.zoreil.com>
Date: Sun, 19 Aug 2012 22:57:24 +0200
From: Francois Romieu <romieu@...zoreil.com>
To: Timur Tabi <timur@...escale.com>
Cc: Andy Fleming <afleming@...escale.com>,
David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH] net/fsl: introduce Freescale 10G MDIO driver
Timur Tabi <timur@...escale.com> :
> Similar to fsl_pq_mdio.c, this driver is for the 10G MDIO controller on
> Freescale Frame Manager Ethernet controllers.
>
> Signed-off-by: Timur Tabi <timur@...escale.com>
> ---
[...]
> diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
> new file mode 100644
> index 0000000..1894476
> --- /dev/null
> +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
[...]
> +static int xgmac_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 value)
> +{
> + struct tgec_mdio_controller __iomem *regs = bus->priv;
> + uint16_t dev_addr = regnum >> 16;
> + uint32_t status;
> +
> + /* Setup the MII Mgmt clock speed */
> + out_be32(®s->mdio_stat, MDIO_STAT_CLKDIV(100));
> +
> + /* Wait till the bus is free */
> + status = spin_event_timeout(
> + !((in_be32(®s->mdio_stat)) & MDIO_STAT_BSY), TIMEOUT, 0);
> + if (!status) {
> + dev_dbg(&bus->dev, "%s: timeout waiting for stat\n", __func__);
> + return -ETIMEDOUT;
> + }
This code - comment included - is repeated several times. You may
consider factoring it out in some xgmac_mdio_free_bus_wait function.
--
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists