Message ID | 20220829080830.5378-7-chunfeng.yun@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2,1/7] dt-bindings: phy: mediatek,tphy: add support type of SGMII | expand |
Il 29/08/22 10:08, Chunfeng Yun ha scritto: > The PHY type is not set if the index is non zero, prepare type > value according to the index, like as mask value. > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> I agree with this change and I'd be happy to give you my R-b tag, but this commit clearly needs to be backported, so you need a Fixes tag, or a Cc to stable. Thanks, Angelo > --- > v2: no changes > --- > drivers/phy/mediatek/phy-mtk-tphy.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c > index e0f227a0d3cc..cc10298bc70d 100644 > --- a/drivers/phy/mediatek/phy-mtk-tphy.c > +++ b/drivers/phy/mediatek/phy-mtk-tphy.c > @@ -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; > } >
On Wed, 2022-08-31 at 10:31 +0200, AngeloGioacchino Del Regno wrote: > Il 29/08/22 10:08, Chunfeng Yun ha scritto: > > The PHY type is not set if the index is non zero, prepare type > > value according to the index, like as mask value. > > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > > I agree with this change and I'd be happy to give you my R-b tag, but > this > commit clearly needs to be backported, so you need a Fixes tag, or a > Cc to stable. A good point, will add it in next version, thanks a lot > > Thanks, > Angelo > > > --- > > v2: no changes > > --- > > drivers/phy/mediatek/phy-mtk-tphy.c | 7 ++++--- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c > > b/drivers/phy/mediatek/phy-mtk-tphy.c > > index e0f227a0d3cc..cc10298bc70d 100644 > > --- a/drivers/phy/mediatek/phy-mtk-tphy.c > > +++ b/drivers/phy/mediatek/phy-mtk-tphy.c > > @@ -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; > > } > > > >
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c index e0f227a0d3cc..cc10298bc70d 100644 --- a/drivers/phy/mediatek/phy-mtk-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c @@ -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; }
The PHY type is not set if the index is non zero, prepare type value according to the index, like as mask value. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> --- v2: no changes --- drivers/phy/mediatek/phy-mtk-tphy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)