1710774e0Smtk01761 // SPDX-License-Identifier: GPL-2.0 2710774e0Smtk01761 /* 3710774e0Smtk01761 * Copyright (c) 2019 MediaTek Inc. 4710774e0Smtk01761 * Author: Wendell Lin <wendell.lin@mediatek.com> 5710774e0Smtk01761 */ 6710774e0Smtk01761 7f09b9460SMiles Chen #include <linux/module.h> 8710774e0Smtk01761 #include <linux/clk-provider.h> 9710774e0Smtk01761 #include <linux/platform_device.h> 10710774e0Smtk01761 #include <dt-bindings/clock/mt6779-clk.h> 11710774e0Smtk01761 12710774e0Smtk01761 #include "clk-mtk.h" 13710774e0Smtk01761 #include "clk-gate.h" 14710774e0Smtk01761 15710774e0Smtk01761 static const struct mtk_gate_regs img_cg_regs = { 16710774e0Smtk01761 .set_ofs = 0x0004, 17710774e0Smtk01761 .clr_ofs = 0x0008, 18710774e0Smtk01761 .sta_ofs = 0x0000, 19710774e0Smtk01761 }; 20710774e0Smtk01761 21710774e0Smtk01761 #define GATE_IMG(_id, _name, _parent, _shift) \ 22710774e0Smtk01761 GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, \ 23710774e0Smtk01761 &mtk_clk_gate_ops_setclr) 24710774e0Smtk01761 25710774e0Smtk01761 static const struct mtk_gate img_clks[] = { 26710774e0Smtk01761 GATE_IMG(CLK_IMG_LARB5, "imgsys_larb5", "img_sel", 0), 27710774e0Smtk01761 GATE_IMG(CLK_IMG_LARB6, "imgsys_larb6", "img_sel", 1), 28710774e0Smtk01761 GATE_IMG(CLK_IMG_DIP, "imgsys_dip", "img_sel", 2), 29710774e0Smtk01761 GATE_IMG(CLK_IMG_MFB, "imgsys_mfb", "img_sel", 6), 30710774e0Smtk01761 GATE_IMG(CLK_IMG_WPE_A, "imgsys_wpe_a", "img_sel", 7), 31710774e0Smtk01761 }; 32710774e0Smtk01761 33dc6fdd8aSMiles Chen static const struct mtk_clk_desc img_desc = { 34dc6fdd8aSMiles Chen .clks = img_clks, 35dc6fdd8aSMiles Chen .num_clks = ARRAY_SIZE(img_clks), 36710774e0Smtk01761 }; 37710774e0Smtk01761 38dc6fdd8aSMiles Chen static const struct of_device_id of_match_clk_mt6779_img[] = { 39710774e0Smtk01761 { 40dc6fdd8aSMiles Chen .compatible = "mediatek,mt6779-imgsys", 41dc6fdd8aSMiles Chen .data = &img_desc, 42dc6fdd8aSMiles Chen }, { 43dc6fdd8aSMiles Chen /* sentinel */ 44710774e0Smtk01761 } 45dc6fdd8aSMiles Chen }; 4665c9ad77SAngeloGioacchino Del Regno MODULE_DEVICE_TABLE(of, of_match_clk_mt6779_img); 47710774e0Smtk01761 48710774e0Smtk01761 static struct platform_driver clk_mt6779_img_drv = { 49dc6fdd8aSMiles Chen .probe = mtk_clk_simple_probe, 50*f00b45dbSUwe Kleine-König .remove = mtk_clk_simple_remove, 51710774e0Smtk01761 .driver = { 52710774e0Smtk01761 .name = "clk-mt6779-img", 53710774e0Smtk01761 .of_match_table = of_match_clk_mt6779_img, 54710774e0Smtk01761 }, 55710774e0Smtk01761 }; 56710774e0Smtk01761 57f09b9460SMiles Chen module_platform_driver(clk_mt6779_img_drv); 58f5100c41SAngeloGioacchino Del Regno 59f5100c41SAngeloGioacchino Del Regno MODULE_DESCRIPTION("MediaTek MT6779 imgsys clocks driver"); 60f09b9460SMiles Chen MODULE_LICENSE("GPL"); 61