Re: [PATCH net-next 2/2] net: phy: dp83822: Add support for GPIO2 clock output

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

 



>  #define MII_DP83822_RCSR	0x17
>  #define MII_DP83822_RESET_CTRL	0x1f
>  #define MII_DP83822_GENCFG	0x465
> +#define MII_DP83822_IOCTRL2	0x463
>  #define MII_DP83822_SOR1	0x467

These are sorted, so the MII_DP83822_IOCTRL2 should go before
MII_DP83822_GENCFG.

> +	if (dp83822->set_gpio2_clk_out)
> +		phy_modify_mmd(phydev, DP83822_DEVADDR, MII_DP83822_IOCTRL2,

I would of preferred MDIO_MMD_VEND2 rather than DP83822_DEVADDR, but
having just this one instance correct would look a bit odd.

> +	ret = of_property_read_u32(dev->of_node, "ti,gpio2-clk-out",
> +				   &dp83822->gpio2_clk_out);
> +	if (!ret) {
> +		dp83822->set_gpio2_clk_out = true;
> +		switch (dp83822->gpio2_clk_out) {
> +		case DP83822_CLK_SRC_MAC_IF:
> +			break;
> +		case DP83822_CLK_SRC_XI:
> +			break;
> +		case DP83822_CLK_SRC_INT_REF:
> +			break;
> +		case DP83822_CLK_SRC_RMII_MASTER_MODE_REF:
> +			break;
> +		case DP83822_CLK_SRC_FREE_RUNNING:
> +			break;
> +		case DP83822_CLK_SRC_RECOVERED:
> +			break;

You can list multiple case statements together, and have one break at
the end.

I would personally also only have:

> +		dp83822->set_gpio2_clk_out = true;

if validation passes, not that it really matters because:


> +		default:
> +			phydev_err(phydev, "ti,gpio2-clk-out value %u not valid\n",
> +				   dp83822->gpio2_clk_out);
> +			return -EINVAL;
> +		}
> +	}


    Andrew

---
pw-bot: cr




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux