Commit 931c05a8 authored by Chunfeng Yun's avatar Chunfeng Yun Committed by Vinod Koul

phy: phy-mtk-tphy: fix the phy type setting issue

The PHY type is not set if the index is non zero, prepare type
value according to the index, like as mask value.

Fixes: 39099a44 ("phy: phy-mtk-tphy: support type switch by pericfg")
Signed-off-by: default avatarChunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220914060746.10004-7-chunfeng.yun@mediatek.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 1e77f026
......@@ -915,7 +915,7 @@ static int phy_type_syscon_get(struct mtk_phy_instance *instance,
static int phy_type_set(struct mtk_phy_instance *instance)
{
int type;
u32 mask;
u32 offset;
if (!instance->type_sw)
return 0;
......@@ -938,8 +938,9 @@ static int phy_type_set(struct mtk_phy_instance *instance)
return 0;
}
mask = RG_PHY_SW_TYPE << (instance->type_sw_index * BITS_PER_BYTE);
regmap_update_bits(instance->type_sw, instance->type_sw_reg, mask, type);
offset = instance->type_sw_index * BITS_PER_BYTE;
regmap_update_bits(instance->type_sw, instance->type_sw_reg,
RG_PHY_SW_TYPE << offset, type << offset);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment