mediatek: backport upstream mediatek patches
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.14 / 0193-clk-mediatek-adjust-dependency-of-reset.c-to-avoid-u.patch
1 From 0f9391b4ee12cad5c93e109b9eb6c0c6298da0d3 Mon Sep 17 00:00:00 2001
2 From: Sean Wang <sean.wang@mediatek.com>
3 Date: Fri, 5 Jan 2018 16:14:06 +0800
4 Subject: [PATCH 193/224] clk: mediatek: adjust dependency of reset.c to avoid
5 unexpectedly being built
6
7 Changes from v1->v2:
8 Add 'select RESET_CONTROLLER' under COMMON_CLK_MEDIATEK and enable
9 reset.c to be built when COMMON_CLK_MEDIATEK is selected. That should
10 be quite reasonable because the reset controller is tightly embedded
11 inside and exported from these clock subsystems. At least it can be found
12 on infracfg and pericfg subsystem that both are really fundamental block
13 lots of devices must depend on.
14
15 commit 74cb0d6dde8 ("clk: mediatek: fixup test-building of MediaTek clock
16 drivers") can let the build system looking into the directory where the
17 clock drivers resides and then allow test-building the drivers.
18
19 But the change also gives rise to certain incorrect behavior which is
20 reset.c being built even not depending on either COMPILE_TEST or
21 ARCH_MEDIATEK alternative dependency. To get rid of reset.c being built
22 unexpectedly on the other platforms, it would be a good change that the
23 file should be built depending on its own specific configuration rather
24 than just on generic RESET_CONTROLLER one.
25
26 Signed-off-by: Sean Wang <sean.wang@mediatek.com>
27 Cc: Jean Delvare <jdelvare@suse.de>
28 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
29 ---
30 drivers/clk/mediatek/Kconfig | 1 +
31 drivers/clk/mediatek/Makefile | 4 ++--
32 drivers/clk/mediatek/clk-mtk.h | 7 -------
33 3 files changed, 3 insertions(+), 9 deletions(-)
34
35 Index: linux-4.14.25/drivers/clk/mediatek/Kconfig
36 ===================================================================
37 --- linux-4.14.25.orig/drivers/clk/mediatek/Kconfig
38 +++ linux-4.14.25/drivers/clk/mediatek/Kconfig
39 @@ -6,6 +6,7 @@ menu "Clock driver for MediaTek SoC"
40
41 config COMMON_CLK_MEDIATEK
42 bool
43 + select RESET_CONTROLLER
44 ---help---
45 MediaTek SoCs' clock support.
46
47 Index: linux-4.14.25/drivers/clk/mediatek/Makefile
48 ===================================================================
49 --- linux-4.14.25.orig/drivers/clk/mediatek/Makefile
50 +++ linux-4.14.25/drivers/clk/mediatek/Makefile
51 @@ -1,6 +1,5 @@
52 # SPDX-License-Identifier: GPL-2.0
53 -obj-$(CONFIG_COMMON_CLK_MEDIATEK) += clk-mtk.o clk-pll.o clk-gate.o clk-apmixed.o clk-cpumux.o
54 -obj-$(CONFIG_RESET_CONTROLLER) += reset.o
55 +obj-$(CONFIG_COMMON_CLK_MEDIATEK) += clk-mtk.o clk-pll.o clk-gate.o clk-apmixed.o clk-cpumux.o reset.o
56 obj-$(CONFIG_COMMON_CLK_MT6797) += clk-mt6797.o
57 obj-$(CONFIG_COMMON_CLK_MT6797_IMGSYS) += clk-mt6797-img.o
58 obj-$(CONFIG_COMMON_CLK_MT6797_MMSYS) += clk-mt6797-mm.o
59 Index: linux-4.14.25/drivers/clk/mediatek/clk-mtk.h
60 ===================================================================
61 --- linux-4.14.25.orig/drivers/clk/mediatek/clk-mtk.h
62 +++ linux-4.14.25/drivers/clk/mediatek/clk-mtk.h
63 @@ -229,14 +229,7 @@ void mtk_clk_register_plls(struct device
64 struct clk *mtk_clk_register_ref2usb_tx(const char *name,
65 const char *parent_name, void __iomem *reg);
66
67 -#ifdef CONFIG_RESET_CONTROLLER
68 void mtk_register_reset_controller(struct device_node *np,
69 unsigned int num_regs, int regofs);
70 -#else
71 -static inline void mtk_register_reset_controller(struct device_node *np,
72 - unsigned int num_regs, int regofs)
73 -{
74 -}
75 -#endif
76
77 #endif /* __DRV_CLK_MTK_H */