Skip to content

Commit 7fcf1ef

Browse files
frank-wbebarino
authored andcommitted
clk: mediatek: add infracfg reset controller for mt7988
Infracfg can also operate as reset controller, add support for it. Signed-off-by: Frank Wunderlich <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent c9d9bea commit 7fcf1ef

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/clk/mediatek/clk-mt7988-infracfg.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#include "clk-gate.h"
1515
#include "clk-mux.h"
1616
#include <dt-bindings/clock/mediatek,mt7988-clk.h>
17+
#include <dt-bindings/reset/mediatek,mt7988-resets.h>
18+
19+
#define MT7988_INFRA_RST0_SET_OFFSET 0x70
20+
#define MT7988_INFRA_RST1_SET_OFFSET 0x80
1721

1822
static DEFINE_SPINLOCK(mt7988_clk_lock);
1923

@@ -249,12 +253,31 @@ static const struct mtk_gate infra_clks[] = {
249253
GATE_INFRA3(CLK_INFRA_133M_PCIE_CK_P3, "infra_133m_pcie_ck_p3", "sysaxi_sel", 31),
250254
};
251255

256+
static u16 infra_rst_ofs[] = {
257+
MT7988_INFRA_RST0_SET_OFFSET,
258+
MT7988_INFRA_RST1_SET_OFFSET,
259+
};
260+
261+
static u16 infra_idx_map[] = {
262+
[MT7988_INFRA_RST0_PEXTP_MAC_SWRST] = 0 * RST_NR_PER_BANK + 6,
263+
[MT7988_INFRA_RST1_THERM_CTRL_SWRST] = 1 * RST_NR_PER_BANK + 9,
264+
};
265+
266+
static struct mtk_clk_rst_desc infra_rst_desc = {
267+
.version = MTK_RST_SET_CLR,
268+
.rst_bank_ofs = infra_rst_ofs,
269+
.rst_bank_nr = ARRAY_SIZE(infra_rst_ofs),
270+
.rst_idx_map = infra_idx_map,
271+
.rst_idx_map_nr = ARRAY_SIZE(infra_idx_map),
272+
};
273+
252274
static const struct mtk_clk_desc infra_desc = {
253275
.clks = infra_clks,
254276
.num_clks = ARRAY_SIZE(infra_clks),
255277
.mux_clks = infra_muxes,
256278
.num_mux_clks = ARRAY_SIZE(infra_muxes),
257279
.clk_lock = &mt7988_clk_lock,
280+
.rst_desc = &infra_rst_desc,
258281
};
259282

260283
static const struct of_device_id of_match_clk_mt7988_infracfg[] = {

0 commit comments

Comments
 (0)