Re: [PATCH 1/2] net-next: stmmac: mediatek: add more suuport for RMII

From: Andrew Lunn
Date: Thu Dec 12 2019 - 08:25:40 EST


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.

> @@ -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.

Andrew