xref: /openbmc/linux/drivers/clk/mediatek/clk-mt6765-mipi0a.c (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
11aca9939SOwen Chen // SPDX-License-Identifier: GPL-2.0
21aca9939SOwen Chen /*
31aca9939SOwen Chen  * Copyright (c) 2018 MediaTek Inc.
41aca9939SOwen Chen  * Author: Owen Chen <owen.chen@mediatek.com>
51aca9939SOwen Chen  */
61aca9939SOwen Chen 
71aca9939SOwen Chen #include <linux/clk-provider.h>
81aca9939SOwen Chen #include <linux/platform_device.h>
91aca9939SOwen Chen 
101aca9939SOwen Chen #include "clk-mtk.h"
111aca9939SOwen Chen #include "clk-gate.h"
121aca9939SOwen Chen 
131aca9939SOwen Chen #include <dt-bindings/clock/mt6765-clk.h>
141aca9939SOwen Chen 
151aca9939SOwen Chen static const struct mtk_gate_regs mipi0a_cg_regs = {
161aca9939SOwen Chen 	.set_ofs = 0x80,
171aca9939SOwen Chen 	.clr_ofs = 0x80,
181aca9939SOwen Chen 	.sta_ofs = 0x80,
191aca9939SOwen Chen };
201aca9939SOwen Chen 
214c85e20bSAngeloGioacchino Del Regno #define GATE_MIPI0A(_id, _name, _parent, _shift)			\
224c85e20bSAngeloGioacchino Del Regno 	GATE_MTK(_id, _name, _parent, &mipi0a_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
231aca9939SOwen Chen 
241aca9939SOwen Chen static const struct mtk_gate mipi0a_clks[] = {
251aca9939SOwen Chen 	GATE_MIPI0A(CLK_MIPI0A_CSR_CSI_EN_0A,
261aca9939SOwen Chen 		    "mipi0a_csr_0a", "f_fseninf_ck", 1),
271aca9939SOwen Chen };
281aca9939SOwen Chen 
292b74c1f6SMiles Chen static const struct mtk_clk_desc mipi0a_desc = {
302b74c1f6SMiles Chen 	.clks = mipi0a_clks,
312b74c1f6SMiles Chen 	.num_clks = ARRAY_SIZE(mipi0a_clks),
322b74c1f6SMiles Chen };
331aca9939SOwen Chen 
341aca9939SOwen Chen static const struct of_device_id of_match_clk_mt6765_mipi0a[] = {
352b74c1f6SMiles Chen 	{
362b74c1f6SMiles Chen 		.compatible = "mediatek,mt6765-mipi0a",
372b74c1f6SMiles Chen 		.data = &mipi0a_desc,
382b74c1f6SMiles Chen 	}, {
392b74c1f6SMiles Chen 		/* sentinel */
402b74c1f6SMiles Chen 	}
411aca9939SOwen Chen };
42*65c9ad77SAngeloGioacchino Del Regno MODULE_DEVICE_TABLE(of, of_match_clk_mt6765_mipi0a);
431aca9939SOwen Chen 
441aca9939SOwen Chen static struct platform_driver clk_mt6765_mipi0a_drv = {
452b74c1f6SMiles Chen 	.probe = mtk_clk_simple_probe,
462b74c1f6SMiles Chen 	.remove_new = mtk_clk_simple_remove,
471aca9939SOwen Chen 	.driver = {
481aca9939SOwen Chen 		.name = "clk-mt6765-mipi0a",
491aca9939SOwen Chen 		.of_match_table = of_match_clk_mt6765_mipi0a,
501aca9939SOwen Chen 	},
511aca9939SOwen Chen };
52164d240dSAngeloGioacchino Del Regno module_platform_driver(clk_mt6765_mipi0a_drv);
53a451da86SAngeloGioacchino Del Regno MODULE_LICENSE("GPL");
54