Hi CK, On 26/2/20 6:32, CK Hu wrote: [snip] >> >> How do you see move mmsys to drivers/soc/mediatek and instantiate the clk and >> mediatek-drm driver >> >> mmsys: syscon@14000000 { >> compatible = "mediatek,mt8173-mmsys", "syscon", "simple-mfd"; >> reg = <0 0x14000000 0 0x1000>; >> power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>; >> >> clock-controller { >> compatible = "mediatek,clk-mt8173-mm" >> assigned-clocks = <&topckgen CLK_TOP_MM_SEL>; >> assigned-clock-rates = <400000000>; >> #clock-cells = <1>; >> }; >> >> display-subsystem { >> compatible = "mediatek,display-subsystem"; >> }; >> }; >> > > Let's start with the simple definition. > > mmsys: syscon at 14000000 { > compatible = "mediatek,mt8173-mmsys", "syscon"; > reg = <0 0x14000000 0 0x1000>; > power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>; > assigned-clocks = <&topckgen CLK_TOP_MM_SEL>; > assigned-clock-rates = <400000000>; > #clock-cells = <1>; > }; > > When we break clock control to a sub device of mmsys, the reason is that > 'Linux' generally categorize clock controller to a device. When we break > display control to a sub device of mmsys, the reason is that 'Linux' > generally categorize display controller to a device. All these seems > software-oriented reason, so I think we do not break any sub device and > keep mmsys simple. > > When I search of_clk_add_provider(), I find that not all clock provider > code is in drivers/clk. Maybe when a clock controller is not an > independent device, the driver code of clock controller could be placed > within the device driver it belonged to. We could place mmsys driver in > drivers/soc/mediatek/, and it control the clock, routing, fake engine, > memory delay,.... I would like drm driver to be placed in > drivers/gpu/drm/ because display function block, such as OVL, does not > belong to mmsys device. And finally let mmsys driver to probe > mediatek-drm driver. > You can apply the same reasoning in the clk subsystem, not all the drivers in drivers/clk are pure clock controllers, some of them are already system-controller or "simple-mfd" and some of them even instantiate other subdrivers via the platform register API. Note that moving clk-<chip>-mm drivers to drivers/soc/mediatek will imply move a lot of code, I'll focus only on mt8173 for now because is the only platform I can really test. Let me prepare a v9 and lets see how looks like. Thanks, Enric > Regards, > CK [snip]