clk: mediatek: reset: Fix written reset bit offset
authorRex-BC Chen <rex-bc.chen@mediatek.com>
Mon, 23 May 2022 09:33:29 +0000 (17:33 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:43 +0000 (14:23 +0200)
[ Upstream commit edabcf71d100fd433a0fc2d0c97057c446c33b2a ]

Original assert/deassert bit is BIT(0), but it's more resonable to modify
them to BIT(id % 32) which is based on id.

This patch will not influence any previous driver because the reset is
only used for thermal. The id (MT8183_INFRACFG_AO_THERM_SW_RST) is 0.

Fixes: 64ebb57a3df6 ("clk: reset: Modify reset-controller driver")
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com>
Link: https://lore.kernel.org/r/20220523093346.28493-3-rex-bc.chen@mediatek.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/mediatek/reset.c

index e562dc3c10a4b47c9ad07b0922ac326bfbb91b9d..d311da574499f786db5b7dd4ef8db7f4e0905522 100644 (file)
@@ -25,7 +25,7 @@ static int mtk_reset_assert_set_clr(struct reset_controller_dev *rcdev,
        struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);
        unsigned int reg = data->regofs + ((id / 32) << 4);
 
-       return regmap_write(data->regmap, reg, 1);
+       return regmap_write(data->regmap, reg, BIT(id % 32));
 }
 
 static int mtk_reset_deassert_set_clr(struct reset_controller_dev *rcdev,
@@ -34,7 +34,7 @@ static int mtk_reset_deassert_set_clr(struct reset_controller_dev *rcdev,
        struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);
        unsigned int reg = data->regofs + ((id / 32) << 4) + 0x4;
 
-       return regmap_write(data->regmap, reg, 1);
+       return regmap_write(data->regmap, reg, BIT(id % 32));
 }
 
 static int mtk_reset_assert(struct reset_controller_dev *rcdev,