[Linux-stm32] [PATCH 1/2] net-next: stmmac: mediatek: add more suuport for RMII
biao huang
biao.huang at mediatek.com
Fri Dec 13 01:36:21 UTC 2019
Hi Andrew,
Thanks for your comments~
On Thu, 2019-12-12 at 14:25 +0100, Andrew Lunn wrote:
> On Thu, Dec 12, 2019 at 10:41:44AM +0800, Biao Huang wrote:
> > MT2712 SoC can provide the rmii reference clock, and the clock
> > will output from TXC pin only, which means ref_clk pin of external
> > PHY should connect to TXC pin in this case.
> > Add corresponding clock and timing settings.
>
> Hi Biao
>
> Subject line has a typo.
will fix in next version.
>
> > @@ -278,6 +296,7 @@ static int mediatek_dwmac_config_dt(struct mediatek_dwmac_plat_data *plat)
> > mac_delay->tx_inv = of_property_read_bool(plat->np, "mediatek,txc-inverse");
> > mac_delay->rx_inv = of_property_read_bool(plat->np, "mediatek,rxc-inverse");
> > plat->rmii_rxc = of_property_read_bool(plat->np, "mediatek,rmii-rxc");
> > + plat->rmii_clk_from_mac = of_property_read_bool(plat->np, "mediatek,rmii-clk-from-mac");
> >
> > return 0;
> > }
> > @@ -287,6 +306,16 @@ static int mediatek_dwmac_clk_init(struct mediatek_dwmac_plat_data *plat)
> > const struct mediatek_dwmac_variant *variant = plat->variant;
> > int i, num = variant->num_clks;
> >
> > + plat->mac_rmii_clk = NULL;
> > + if (plat->phy_mode == PHY_INTERFACE_MODE_RMII &&
> > + plat->rmii_clk_from_mac) {
> > + plat->mac_rmii_clk = devm_clk_get(plat->dev, "rmii_internal");
> > + if (IS_ERR(plat->mac_rmii_clk)) {
> > + dev_err(plat->dev, "Failed to get reference clk from MAC\n");
> > + return PTR_ERR(plat->mac_rmii_clk);
> > + }
> > + }
>
> Please don't use a binary property. This is a clock, so describe it in
> DT as a clock. Add it to the existing list of clocks.
The clock labeled as "rmii_internal" is needed only in RMII(when MAC
provides reference clock), and useless for RGMII/MII/RMII(when phy
provides reference clock).
So, add a boolean flag to indicate where the RMII reference clock is
from, MAC or PHY, if MAC, enable the "rmii_internal", or disable it.
and this clock already documented in dt-binding in PATCH 2/2.
For power saving, it should not be enabled in default, so can't add it
to the existing list of clocks directly.
Any advice for this special case?
Thanks.
>
> Andrew
Biao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://st-md-mailman.stormreply.com/pipermail/linux-stm32/attachments/20191213/f8fee2aa/attachment.html>
More information about the Linux-stm32
mailing list