<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/4.6.6">
</HEAD>
<BODY>
Hi Andrew,<BR>
<BR>
Thanks for your comments~<BR>
<BR>
On Thu, 2019-12-12 at 14:25 +0100, Andrew Lunn wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
On Thu, Dec 12, 2019 at 10:41:44AM +0800, Biao Huang wrote:
<FONT COLOR="#737373">> MT2712 SoC can provide the rmii reference clock, and the clock</FONT>
<FONT COLOR="#737373">> will output from TXC pin only, which means ref_clk pin of external</FONT>
<FONT COLOR="#737373">> PHY should connect to TXC pin in this case.</FONT>
<FONT COLOR="#737373">> Add corresponding clock and timing settings.</FONT>
Hi Biao
Subject line has a typo.
</PRE>
</BLOCKQUOTE>
will fix in next version.
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#737373">> @@ -278,6 +296,7 @@ static int mediatek_dwmac_config_dt(struct mediatek_dwmac_plat_data *plat)</FONT>
<FONT COLOR="#737373">> mac_delay->tx_inv = of_property_read_bool(plat->np, "mediatek,txc-inverse");</FONT>
<FONT COLOR="#737373">> mac_delay->rx_inv = of_property_read_bool(plat->np, "mediatek,rxc-inverse");</FONT>
<FONT COLOR="#737373">> plat->rmii_rxc = of_property_read_bool(plat->np, "mediatek,rmii-rxc");</FONT>
<FONT COLOR="#737373">> + plat->rmii_clk_from_mac = of_property_read_bool(plat->np, "mediatek,rmii-clk-from-mac");</FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> return 0;</FONT>
<FONT COLOR="#737373">> }</FONT>
<FONT COLOR="#737373">> @@ -287,6 +306,16 @@ static int mediatek_dwmac_clk_init(struct mediatek_dwmac_plat_data *plat)</FONT>
<FONT COLOR="#737373">> const struct mediatek_dwmac_variant *variant = plat->variant;</FONT>
<FONT COLOR="#737373">> int i, num = variant->num_clks;</FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> + plat->mac_rmii_clk = NULL;</FONT>
<FONT COLOR="#737373">> + if (plat->phy_mode == PHY_INTERFACE_MODE_RMII &&</FONT>
<FONT COLOR="#737373">> + plat->rmii_clk_from_mac) {</FONT>
<FONT COLOR="#737373">> + plat->mac_rmii_clk = devm_clk_get(plat->dev, "rmii_internal");</FONT>
<FONT COLOR="#737373">> + if (IS_ERR(plat->mac_rmii_clk)) {</FONT>
<FONT COLOR="#737373">> + dev_err(plat->dev, "Failed to get reference clk from MAC\n");</FONT>
<FONT COLOR="#737373">> + return PTR_ERR(plat->mac_rmii_clk);</FONT>
<FONT COLOR="#737373">> + }</FONT>
<FONT COLOR="#737373">> + }</FONT>
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.
</PRE>
</BLOCKQUOTE>
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).<BR>
<BR>
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.<BR>
and this clock already documented in dt-binding in PATCH 2/2.<BR>
<BR>
For power saving, it should not be enabled in default, so can't add it to the existing list of clocks directly.<BR>
<BR>
Any advice for this special case?<BR>
<BR>
Thanks.
<BLOCKQUOTE TYPE=CITE>
<PRE>
Andrew
</PRE>
</BLOCKQUOTE>
Biao
</BODY>
</HTML>