[RESEND PATCH v2 5/5] net: dwc_eth_qos: Add glue driver for Intel MAC
Marek Vasut
marex at denx.de
Sat Jul 13 17:55:57 CEST 2024
On 7/12/24 3:21 PM, Philip Oberfichtner wrote:
> Hi Marek,
Hi,
>>> +static int __serdes_powerup(struct udevice *dev)
>>> +{
>>> + /* Based on linux/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c */
>>> +
>>> + const unsigned char phyad = INTEL_MGBE_ADHOC_ADDR;
>>> + struct eqos_priv *eqos = dev_get_priv(dev);
>>> + unsigned short data;
>>> + int ret;
>>> + bool is_pse;
>>> +
>>> + /* Set the serdes rate and the PCLK rate */
>>> + miiphy_read(eqos->mii->name, phyad, SERDES_GCR0, &data);
>>> +
>>> + data &= ~SERDES_RATE_MASK;
>>> + data &= ~SERDES_PCLK_MASK;
>>> +
>>> + if (__serdes_link_mode_2500(dev))
>>> + data |= SERDES_RATE_PCIE_GEN2 << SERDES_RATE_PCIE_SHIFT |
>>> + SERDES_PCLK_37p5MHZ << SERDES_PCLK_SHIFT;
>>> + else
>>> + data |= SERDES_RATE_PCIE_GEN1 << SERDES_RATE_PCIE_SHIFT |
>>> + SERDES_PCLK_70MHZ << SERDES_PCLK_SHIFT;
>>> +
>>> + miiphy_write(eqos->mii->name, phyad, SERDES_GCR0, data);
>>> +
>>> + /* assert clk_req */
>>> + miiphy_read(eqos->mii->name, phyad, SERDES_GCR0, &data);
>>> + data |= SERDES_PLL_CLK;
>>> + miiphy_write(eqos->mii->name, phyad, SERDES_GCR0, data);
>>
>> Could this use phy_modify() ?
>>
>
>
> I do agree using the phy_read()-API all over the place would be nice.
> But I currently cannot do so, as I do not have a struct phy_device.
> I am not accessing an actual PHY here, but a MAC-internal submodule.
Oh ok, then miiphy_write() is fine. Thanks for clarifying.
More information about the U-Boot
mailing list