Re: [PATCH] net/fsl: introduce Freescale 10G MDIO driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Timur Tabi <timur@xxxxxxxxxxxxx> :
> 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@xxxxxxxxxxxxx>
> ---
[...]
> 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(&regs->mdio_stat, MDIO_STAT_CLKDIV(100));
> +
> +	/* Wait till the bus is free */
> +	status = spin_event_timeout(
> +		!((in_be32(&regs->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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux Kernel Discussion]     [Ethernet Bridging]     [Linux Wireless Networking]     [Linux Bluetooth Networking]     [Linux Networking Users]     [VLAN]     [Git]     [IETF Annouce]     [Linux Assembly]     [Security]     [Bugtraq]     [Photo]     [Singles Social Networking]     [Yosemite Information]     [MIPS Linux]     [ARM Linux Kernel]     [ARM Linux]     [Linux Virtualization]     [Linux Security]     [Linux IDE]     [Linux RAID]     [Linux SCSI]     [Free Dating]

Add to Google Powered by Linux