[net-next PATCH v3 3/3] net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY
Maxime Chevallier
maxime.chevallier at bootlin.com
Wed Nov 6 06:54:58 PST 2024
Hello Christian,
On Wed, 6 Nov 2024 13:22:38 +0100
Christian Marangi <ansuelsmth at gmail.com> wrote:
> Add support for Airoha AN8855 Internal Switch Gigabit PHY.
>
> This is a simple PHY driver to configure and calibrate the PHY for the
> AN8855 Switch with the use of NVMEM cells.
>
> Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
[...]
> +static int an8855_get_downshift(struct phy_device *phydev, u8 *data)
> +{
> + int saved_page;
> + int val;
> + int ret;
> +
> + saved_page = phy_select_page(phydev, AN8855_PHY_PAGE_EXTENDED_1);
> + if (saved_page >= 0)
> + val = __phy_read(phydev, AN8855_PHY_EXT_REG_14);
> + ret = phy_restore_page(phydev, saved_page, val);
I think this can be replaced with phy_read_paged()
[...]
> +static int an8855_set_downshift(struct phy_device *phydev, u8 cnt)
> +{
> + int saved_page;
> + int ret;
> +
> + saved_page = phy_select_page(phydev, AN8855_PHY_PAGE_EXTENDED_1);
> + if (saved_page >= 0) {
> + if (cnt != DOWNSHIFT_DEV_DISABLE)
> + ret = __phy_set_bits(phydev, AN8855_PHY_EXT_REG_14,
> + AN8855_PHY_EN_DOWN_SHFIT);
> + else
> + ret = __phy_clear_bits(phydev, AN8855_PHY_EXT_REG_14,
> + AN8855_PHY_EN_DOWN_SHFIT);
> + }
> +
> + return phy_restore_page(phydev, saved_page, ret);
And this by phy_modify_paged() :)
Thanks,
Maxime
More information about the linux-arm-kernel
mailing list