162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2022, Linaro Ltd.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef __QCOM_CLK_REGMAP_PHY_MUX_H__
762306a36Sopenharmony_ci#define __QCOM_CLK_REGMAP_PHY_MUX_H__
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include "clk-regmap.h"
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/*
1262306a36Sopenharmony_ci * A clock implementation for PHY pipe and symbols clock muxes.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * If the clock is running off the from-PHY source, report it as enabled.
1562306a36Sopenharmony_ci * Report it as disabled otherwise (if it uses reference source).
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci * This way the PHY will disable the pipe clock before turning off the GDSC,
1862306a36Sopenharmony_ci * which in turn would lead to disabling corresponding pipe_clk_src (and thus
1962306a36Sopenharmony_ci * it being parked to a safe, reference clock source). And vice versa, after
2062306a36Sopenharmony_ci * enabling the GDSC the PHY will enable the pipe clock, which would cause
2162306a36Sopenharmony_ci * pipe_clk_src to be switched from a safe source to the working one.
2262306a36Sopenharmony_ci *
2362306a36Sopenharmony_ci * For some platforms this should be used for the UFS symbol_clk_src clocks
2462306a36Sopenharmony_ci * too.
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_cistruct clk_regmap_phy_mux {
2762306a36Sopenharmony_ci	u32			reg;
2862306a36Sopenharmony_ci	struct clk_regmap	clkr;
2962306a36Sopenharmony_ci};
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciextern const struct clk_ops clk_regmap_phy_mux_ops;
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#endif
34