Add driver for dvfsrc, support for active state of scpsys
Subsystems (4)
v5 cover Add driver for dvfsrc, support for active state of scpsys
This series is based on v5.9-rc1 and have dependency patches as following, [v17,00/12] Mediatek MT8183 scpsys support
https://patchwork.kernel.org/cover/11703253/
[0/3] Mediatek MT8192 scpsys support
https://patchwork.kernel.org/cover/11755897/
The patchsets add support for MediaTek hardware module named DVFSRC (dynamic voltage and frequency scaling resource collector). The DVFSRC is a HW module which is used to collect all the requests from both software and hardware and turn into the decision of minimum operating voltage and minimum DRAM frequency to fulfill those requests.
So, This series is to implement the dvfsrc driver to collect all the requests of operating voltage or DRAM bandwidth from other device drivers likes GPU/Camera through 3 frameworks basically:
1. interconnect framework: to aggregate the bandwidth requirements from different clients
[1] https://patchwork.kernel.org/cover/10766329/
There has a hw module "DRAM scheduler", which used to control the throughput. The DVFSRC will collect forecast data of dram bandwidth from
SW consumers(camera/gpu...), and according the forecast to change the DRAM frequency
2. Active state management of power domains[1]: to handle the operating voltage/dram opp requirement from different power domains
[2] https://lwn.net/Articles/744047/
3. Regualtor framework: to handle the operating voltage requirement from user or cosumer which not belong any power domain
Changes in V5:
* Support more platform mt6873/mt8192
* Drop the compatible and interconnect provider node and make the parent node an interconnect provider. (Rob/Georgi)
* Make modification of interconnect driver from coding suggestion. (Georgi)
* Move interconnect diagram into the commit text of patch. (Georgi)
* Register the interconnect provider as a platform sub-device. (Georgi)
Changes in V4:
* Add acked TAG on dt-bindings patches. (Rob)
* Declaration of emi_icc_aggregate since the prototype of aggregate function has changed meanwhile. (Georgi)
* Used emi_icc_remove instead of icc_provider_del on probe. (Georgi)
* Add dvfsrc regulator driver into series.
* Bug fixed of mt8183_get_current_level.
* Add mutex protection for pstate operation on dvfsrc_set_performance.
Changes in V3:
* Remove RFC from the subject prefix of the series
* Combine dt-binding patch and move interconnect dt-binding document into dvfsrc. (Rob)
* Remove unused header, add unit descirption to the bandwidth, rename compatible name on interconnect driver. (Georgi)
* Fixed some coding style: check flow, naming, used readx_poll_timeout on dvfsrc driver. (Ryan)
* Rename interconnect driver mt8183.c to mtk-emi.c
* Rename interconnect header mtk,mt8183.h to mtk,emi.h
* mtk-scpsys.c: Add opp table check first to avoid OF runtime parse failed
Changes in RFC V2:
* Remove the DT property dram_type. (Rob)
* Used generic dts property 'opp-level' to get the performace state. (Stephen)
* Remove unecessary dependency config on Kconfig. (Stephen)
* Remove unused header file, fixed some coding style issue, typo, error handling on dvfsrc driver. (Nicolas/Stephen)
* Remove irq handler on dvfsrc driver. (Stephen)
* Remove init table on dvfsrc driver, combine hw init on trustzone.
* Add interconnect support of mt8183 to aggregate the emi bandwidth. (Georgi)
V4: https://lore.kernel.org/patchwork/cover/1209284/
V3: https://patchwork.kernel.org/cover/11118867/
RFC V2: https://lore.kernel.org/patchwork/patch/1068113/
RFC V1: https://lore.kernel.org/patchwork/cover/1028535/
PATCH v5 1/17 dt-bindings: soc: Add dvfsrc driver bindings
Document the binding for enabling dvfsrc on MediaTek SoC.
--- .../devicetree/bindings/soc/mediatek/dvfsrc.txt | 25 ++++++++++++++++++++++ include/dt-bindings/soc/mtk,dvfsrc.h | 14 ++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/mediatek/dvfsrc.txt create mode 100644 include/dt-bindings/soc/mtk,dvfsrc.h
Documentation/devicetree/bindings/soc/mediatek/dvfsrc.txt new file +25 -0
@@ -0,0 +1,25 @@ +MediaTek DVFSRC + +The Dynamic Voltage and Frequency Scaling Resource Collector (DVFSRC) is a +HW module which is used to collect all the requests from both software and +hardware and turn into the decision of minimum operating voltage and minimum +DRAM frequency to fulfill those requests. + +Required Properties: +- compatible: Should be one of the following + - "mediatek,mt6873-dvfsrc": For MT6873 SoC + - "mediatek,mt8183-dvfsrc": For MT8183 SoC + - "mediatek,mt8192-dvfsrc": For MT8192 SoC +- reg: Address range of the DVFSRC unit +- clock-names: Must include the following entries: + "dvfsrc": DVFSRC module clock +- clocks: Must contain an entry for each entry in clock-names. + +Example: + + dvfsrc@10012000 { + compatible = "mediatek,mt8183-dvfsrc"; + reg = <0 0x10012000 0 0x1000>; + clocks = <&infracfg CLK_INFRA_DVFSRC>; + clock-names = "dvfsrc"; + };
include/dt-bindings/soc/mtk,dvfsrc.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (c) 2018 MediaTek Inc. +*/ + +#ifndef _DT_BINDINGS_POWER_MTK_DVFSRC_H +#define _DT_BINDINGS_POWER_MTK_DVFSRC_H + +#define MT8183_DVFSRC_LEVEL_1 1 +#define MT8183_DVFSRC_LEVEL_2 2 +#define MT8183_DVFSRC_LEVEL_3 3 +#define MT8183_DVFSRC_LEVEL_4 4 + +#endif /* _DT_BINDINGS_POWER_MTK_DVFSRC_H */
Signature · 1 line
1.9.1
Rob Herring
maintainerRe: [PATCH V5 01/17] dt-bindings: soc: Add dvfsrc driver bindings
Quoted 4 lines · Henry Chen
Document the binding for enabling dvfsrc on MediaTek SoC.
Signed-off-by Henry Chen <[email protected]>Reviewed-by Rob Herring <[email protected]>
I did, but bindings are in DT schema format now. We had a grace period for some time, but please convert this to DT schema.
Rob
Quoted 60 lines
--- .../devicetree/bindings/soc/mediatek/dvfsrc.txt | 25 ++++++++++++++++++++++ include/dt-bindings/soc/mtk,dvfsrc.h | 14 ++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/mediatek/dvfsrc.txt create mode 100644 include/dt-bindings/soc/mtk,dvfsrc.hDocumentation/devicetree/bindings/soc/mediatek/dvfsrc.txt new file +25
-0@@ -0,0 +1,25 @@ +MediaTek DVFSRC + +The Dynamic Voltage and Frequency Scaling Resource Collector (DVFSRC) is a +HW module which is used to collect all the requests from both software and +hardware and turn into the decision of minimum operating voltage and minimum +DRAM frequency to fulfill those requests. + +Required Properties: +- compatible: Should be one of the following + - "mediatek,mt6873-dvfsrc": For MT6873 SoC + - "mediatek,mt8183-dvfsrc": For MT8183 SoC + - "mediatek,mt8192-dvfsrc": For MT8192 SoC +- reg: Address range of the DVFSRC unit +- clock-names: Must include the following entries: + "dvfsrc": DVFSRC module clock +- clocks: Must contain an entry for each entry in clock-names. + +Example: + + dvfsrc@10012000 { + compatible = "mediatek,mt8183-dvfsrc"; + reg = <0 0x10012000 0 0x1000>; + clocks = <&infracfg CLK_INFRA_DVFSRC>; + clock-names = "dvfsrc"; + };include/dt-bindings/soc/mtk,dvfsrc.h new file +14
-0@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (c) 2018 MediaTek Inc. +*/ + +#ifndef _DT_BINDINGS_POWER_MTK_DVFSRC_H +#define _DT_BINDINGS_POWER_MTK_DVFSRC_H + +#define MT8183_DVFSRC_LEVEL_1 1 +#define MT8183_DVFSRC_LEVEL_2 2 +#define MT8183_DVFSRC_LEVEL_3 3 +#define MT8183_DVFSRC_LEVEL_4 4 + +#endif /* _DT_BINDINGS_POWER_MTK_DVFSRC_H */ Signature · 1 line
1.9.1
PATCH v5 2/17 dt-bindings: soc: Add opp table on scpsys bindings
In reply to Henry ChenAdd opp table on scpsys dt-bindings for Mediatek SoC.
--- .../devicetree/bindings/soc/mediatek/scpsys.txt | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+)
Documentation/devicetree/bindings/soc/mediatek/scpsys.txt +38 -0
@@ -90,6 +90,27 @@ Example: <&topckgen CLK_TOP_VENC_SEL>, <&topckgen CLK_TOP_VENC_LT_SEL>; clock-names = "mfg", "mm", "venc", "venc_lt"; + operating-points-v2 = <&dvfsrc_opp_table>; + + dvfsrc_opp_table: opp-table { + compatible = "operating-points-v2-level"; + + dvfsrc_vol_min: opp1 { + opp,level = <MT8183_DVFSRC_LEVEL_1>; + }; + + dvfsrc_freq_medium: opp2 { + opp,level = <MT8183_DVFSRC_LEVEL_2>; + }; + + dvfsrc_freq_max: opp3 { + opp,level = <MT8183_DVFSRC_LEVEL_3>; + }; + + dvfsrc_vol_max: opp4 { + opp,level = <MT8183_DVFSRC_LEVEL_4>; + }; + }; }; Example(power domain sub node within power controller):
@@ -151,4 +172,21 @@ Example consumer: afe: mt8173-afe-pcm@11220000 { compatible = "mediatek,mt8173-afe-pcm"; power-domains = <&scpsys MT8173_POWER_DOMAIN_AUDIO>; + operating-points-v2 = <&aud_opp_table>; + }; + + aud_opp_table: aud-opp-table { + compatible = "operating-points-v2"; + opp1 { + opp-hz = /bits/ 64 <793000000>; + required-opps = <&dvfsrc_vol_min>; + }; + opp2 { + opp-hz = /bits/ 64 <910000000>; + required-opps = <&dvfsrc_vol_max>; + }; + opp3 { + opp-hz = /bits/ 64 <1014000000>; + required-opps = <&dvfsrc_vol_max>; + }; };
Signature · 1 line
1.9.1
PATCH v5 3/17 soc: mediatek: add support for the performance state
In reply to Henry ChenSupport power domain performance state, add header file for scp event.
--- drivers/soc/mediatek/mtk-scpsys.c | 58 +++++++++++++++++++++++++++++++++++++++ drivers/soc/mediatek/mtk-scpsys.h | 22 +++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 drivers/soc/mediatek/mtk-scpsys.h
drivers/soc/mediatek/mtk-scpsys.c +58 -0
@@ -11,8 +11,10 @@#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/pm_domain.h> +#include <linux/pm_opp.h> #include <linux/regmap.h> #include <linux/regulator/consumer.h> +#include <linux/slab.h> #include <dt-bindings/power/mt2701-power.h> #include <dt-bindings/power/mt2712-power.h>
@@ -22,6 +24,7 @@#include <dt-bindings/power/mt8173-power.h> #include <dt-bindings/power/mt8183-power.h> #include <dt-bindings/power/mt8192-power.h> +#include "mtk-scpsys.h" #define MTK_POLL_DELAY_US 10#define MTK_POLL_TIMEOUT USEC_PER_SEC
@@ -272,6 +275,18 @@ struct scp_soc_data {const struct scp_ctrl_reg regs; }; +static BLOCKING_NOTIFIER_HEAD (scpsys_notifier_list); + +int register_scpsys_notifier (struct notifier_block *nb) +{ +return blocking_notifier_chain_register (&scpsys_notifier_list, nb); +} + +int unregister_scpsys_notifier (struct notifier_block *nb) +{ +return blocking_notifier_chain_unregister (&scpsys_notifier_list, nb); +} +static int scpsys_domain_is_on (struct scp_domain *scpd) {struct scp *scp = scpd->scp;
@@ -294,6 +309,41 @@ static int scpsys_domain_is_on(struct scp_domain *scpd)return -EINVAL ; } +static int mtk_pd_set_performance (struct generic_pm_domain *genpd, +unsigned int state) +{ +int i; +struct scp_domain *scpd = + container_of(genpd, struct scp_domain, genpd); +struct scp_event_data scpe; +struct scp *scp = scpd->scp; +struct genpd_onecell_data *pd_data = &scp->pd_data; + +for (i =0 ; i < pd_data->num_domains; i++) { +if (genpd == pd_data->domains[i]) { +dev_dbg (scp->dev,"%d. %s = %d\n" , + i, genpd->name, state); +break ; + } + } + +if (i == pd_data->num_domains) +return 0 ; + + scpe.event_type =MTK_SCPSYS_PSTATE ; + scpe.genpd = genpd; + scpe.domain_id = i; +blocking_notifier_call_chain (&scpsys_notifier_list, state, &scpe); + +return 0 ; +} + +static unsigned int mtk_pd_get_performance (struct generic_pm_domain *genpd, +struct dev_pm_opp *opp) +{ +return dev_pm_opp_get_level (opp); +} +static int scpsys_regulator_enable (struct scp_domain *scpd) {if (!scpd->supply)
@@ -800,6 +850,14 @@ static struct scp *init_scp(struct platform_device *pdev, genpd->power_on = scpsys_power_on;if (MTK_SCPD_CAPS (scpd,MTK_SCPD_ACTIVE_WAKEUP )) genpd->flags |=GENPD_FLAG_ACTIVE_WAKEUP ; + +/* Add opp table check first to avoid OF runtime parse failed */ +if (of_count_phandle_with_args (pdev->dev.of_node, +"operating-points-v2" ,NULL ) >0 ) { + genpd->set_performance_state = mtk_pd_set_performance; + genpd->opp_to_performance_state = + mtk_pd_get_performance; + } }return scp;
drivers/soc/mediatek/mtk-scpsys.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (c) 2018 MediaTek Inc. +*/ + +#ifndef __MTK_SCPSYS_H__ +#define __MTK_SCPSYS_H__ + +struct scp_event_data { +int event_type; +int domain_id; +struct generic_pm_domain *genpd; +}; + +enum scp_event_type { +MTK_SCPSYS_PSTATE , +}; + +int register_scpsys_notifier (struct notifier_block *nb); +int unregister_scpsys_notifier (struct notifier_block *nb); + +#endif /* __MTK_SCPSYS_H__ */
Signature · 1 line
1.9.1
PATCH v5 4/17 arm64: dts: mt8183: add performance state support of scpsys
In reply to Henry ChenAdd support for performance state of scpsys on mt8183 platform
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/mediatek/mt8183.dtsi +22 -0
@@ -12,6 +12,7 @@ #include <dt-bindings/reset-controller/mt8183-resets.h> #include <dt-bindings/phy/phy.h> #include "mt8183-pinfunc.h" +#include <dt-bindings/soc/mtk,dvfsrc.h> / { compatible = "mediatek,mt8183";
@@ -340,6 +341,27 @@ #address-cells = <1>; #size-cells = <0>; + operating-points-v2 = <&dvfsrc_opp_table>; + dvfsrc_opp_table: opp-table { + compatible = "operating-points-v2-level"; + + dvfsrc_vol_min: opp1 { + opp,level = <MT8183_DVFSRC_LEVEL_1>; + }; + + dvfsrc_freq_medium: opp2 { + opp,level = <MT8183_DVFSRC_LEVEL_2>; + }; + + dvfsrc_freq_max: opp3 { + opp,level = <MT8183_DVFSRC_LEVEL_3>; + }; + + dvfsrc_vol_max: opp4 { + opp,level = <MT8183_DVFSRC_LEVEL_4>; + }; + }; + audio@MT8183_POWER_DOMAIN_AUDIO { reg = <MT8183_POWER_DOMAIN_AUDIO>; };
Signature · 1 line
1.9.1
PATCH v5 5/17 soc: mediatek: add header for mediatek SIP interface
In reply to Henry ChenFrom: Arvin Wang <[email protected]>
Add a header to collect SIPs and add one SIP call to initialize power management hardware for the SIP interface defined to access the SPM handling vcore voltage and ddr rate changes on mt8183 (and most likely later socs).
--- include/linux/soc/mediatek/mtk_sip_svc.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/soc/mediatek/mtk_sip_svc.h +4 -0
@@ -22,4 +22,8 @@ARM_SMCCC_CALL_VAL (ARM_SMCCC_FAST_CALL ,MTK_SIP_SMC_CONVENTION , \ARM_SMCCC_OWNER_SIP , fn_id) +/* VCOREFS */ +#define MTK_SIP_VCOREFS_CONTROL \ + MTK_SIP_SMC_CMD(0x506) +#endif
Signature · 1 line
1.9.1
PATCH v5 6/17 soc: mediatek: add driver for dvfsrc support
In reply to Henry ChenAdd dvfsrc driver for MT6873/MT8183/MT8192
--- drivers/soc/mediatek/Kconfig | 12 + drivers/soc/mediatek/Makefile | 1 + drivers/soc/mediatek/mtk-dvfsrc.c | 618 ++++++++++++++++++++++++++++++++ include/linux/soc/mediatek/mtk_dvfsrc.h | 34 ++ 4 files changed, 665 insertions(+) create mode 100644 drivers/soc/mediatek/mtk-dvfsrc.c create mode 100644 include/linux/soc/mediatek/mtk_dvfsrc.h
drivers/soc/mediatek/Kconfig +12 -0
@@ -16,6 +16,18 @@ config MTK_CMDQ time limitation, such as updating display configuration during the vblank. +config MTK_DVFSRC + tristate "MediaTek DVFSRC Support" + depends on ARCH_MEDIATEK + depends on MTK_SCPSYS + help + Say yes here to add support for the MediaTek DVFSRC (dynamic voltage + and frequency scaling resource collector) found + on different MediaTek SoCs. The DVFSRC is a proprietary + hardware which is used to collect all the requests from + system and turn into the decision of minimum Vcore voltage + and minimum DRAM frequency to fulfill those requests. + config MTK_PMIC_WRAP tristate "MediaTek PMIC Wrapper Support" depends on RESET_CONTROLLER
drivers/soc/mediatek/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_MTK_CMDQ) += mtk-cmdq-helper.o +obj-$(CONFIG_MTK_DVFSRC) += mtk-dvfsrc.o obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o
drivers/soc/mediatek/mtk-dvfsrc.c new file +618 -0
618 lines not on this page · raw message
include/linux/soc/mediatek/mtk_dvfsrc.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (c) 2018 MediaTek Inc. +*/ +#ifndef __SOC_MTK_DVFSRC_H +#define __SOC_MTK_DVFSRC_H + +#define MTK_DVFSRC_CMD_BW_REQUEST 0 +#define MTK_DVFSRC_CMD_OPP_REQUEST 1 +#define MTK_DVFSRC_CMD_VCORE_REQUEST 2 +#define MTK_DVFSRC_CMD_HRTBW_REQUEST 3 +#define MTK_DVFSRC_CMD_VSCP_REQUEST 4 +#define MTK_DVFSRC_CMD_PEAK_BW_REQUEST 5 + +#define MTK_DVFSRC_CMD_VCORE_LEVEL_QUERY 0 +#define MTK_DVFSRC_CMD_VSCP_LEVEL_QUERY 1 + +#if IS_ENABLED (CONFIG_MTK_DVFSRC ) +void mtk_dvfsrc_send_request (const struct device *dev,u32 cmd,u64 data); +int mtk_dvfsrc_query_info (const struct device *dev,u32 cmd,int *data); + +#else + +static inline void mtk_dvfsrc_send_request (const struct device *dev,u32 cmd, +u64 data) +{return -ENODEV ; } + +static inline int mtk_dvfsrc_query_info (const struct device *dev,u32 cmd, +int *data); +{return -ENODEV ; } + +#endif /* CONFIG_MTK_DVFSRC */ + +#endif
Signature · 1 line
1.9.1
PATCH v5 7/17 arm64: dts: mt8183: add dvfsrc related nodes
In reply to Henry ChenEnable dvfsrc on mt8183 platform.
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/mediatek/mt8183.dtsi +5 -0
@@ -469,6 +469,11 @@ #clock-cells = <1>; }; + ddr_emi: dvfsrc@10012000 { + compatible = "mediatek,mt8183-dvfsrc"; + reg = <0 0x10012000 0 0x1000>; + }; + pwrap: pwrap@1000d000 { compatible = "mediatek,mt8183-pwrap"; reg = <0 0x1000d000 0 0x1000>;
Signature · 1 line
1.9.1
PATCH v5 8/17 arm64: dts: mt8192: add dvfsrc related nodes
In reply to Henry ChenFrom: "henryc.chen" <[email protected]>
Enable dvfsrc on mt8192 platform.
--- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +5 -0
@@ -417,6 +417,11 @@ #clock-cells = <1>; }; + ddr_emi: dvfsrc@10012000 { + compatible = "mediatek,mt8192-dvfsrc"; + reg = <0 0x10012000 0 0x1000>; + }; + systimer: timer@10017000 { compatible = "mediatek,mt8192-timer", "mediatek,mt6765-timer";
Signature · 5 lines
1.9.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v5 9/17 dt-bindings: interconnect: add MT8183 interconnect dt-bindings
In reply to Henry ChenAdd interconnect provider dt-bindings for MT8183.
--- .../devicetree/bindings/soc/mediatek/dvfsrc.txt | 2 ++ include/dt-bindings/interconnect/mtk,mt8183-emi.h | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 include/dt-bindings/interconnect/mtk,mt8183-emi.h
Documentation/devicetree/bindings/soc/mediatek/dvfsrc.txt +2 -0
@@ -14,6 +14,7 @@ Required Properties: - clock-names: Must include the following entries: "dvfsrc": DVFSRC module clock - clocks: Must contain an entry for each entry in clock-names. +- #interconnect-cells : should contain 1 Example:
@@ -22,4 +23,5 @@ Example: reg = <0 0x10012000 0 0x1000>; clocks = <&infracfg CLK_INFRA_DVFSRC>; clock-names = "dvfsrc"; + #interconnect-cells = <1>; };
include/dt-bindings/interconnect/mtk,mt8183-emi.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __DT_BINDINGS_INTERCONNECT_MTK_MT8183_EMI_H +#define __DT_BINDINGS_INTERCONNECT_MTK_MT8183_EMI_H + +#define MT8183_SLAVE_DDR_EMI 0 +#define MT8183_MASTER_MCUSYS 1 +#define MT8183_MASTER_GPU 2 +#define MT8183_MASTER_MMSYS 3 +#define MT8183_MASTER_MM_VPU 4 +#define MT8183_MASTER_MM_DISP 5 +#define MT8183_MASTER_MM_VDEC 6 +#define MT8183_MASTER_MM_VENC 7 +#define MT8183_MASTER_MM_CAM 8 +#define MT8183_MASTER_MM_IMG 9 +#define MT8183_MASTER_MM_MDP 10 + +#endif
Signature · 1 line
1.9.1
PATCH v5 10/17 dt-bindings: interconnect: add MT6873 interconnect dt-bindings
In reply to Henry ChenFrom: "henryc.chen" <[email protected]>
Add interconnect provider dt-bindings for MT6873.
--- include/dt-bindings/interconnect/mtk,mt6873-emi.h | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 include/dt-bindings/interconnect/mtk,mt6873-emi.h
include/dt-bindings/interconnect/mtk,mt6873-emi.h new file +42 -0
@@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2020 MediaTek Inc. +*/ + + +#ifndef __DT_BINDINGS_INTERCONNECT_MTK_MT6873_EMI_H +#define __DT_BINDINGS_INTERCONNECT_MTK_MT6873_EMI_H + +#define MT6873_SLAVE_DDR_EMI 0 +#define MT6873_MASTER_MCUSYS 1 +#define MT6873_MASTER_GPUSYS 2 +#define MT6873_MASTER_MMSYS 3 +#define MT6873_MASTER_MM_VPU 4 +#define MT6873_MASTER_MM_DISP 5 +#define MT6873_MASTER_MM_VDEC 6 +#define MT6873_MASTER_MM_VENC 7 +#define MT6873_MASTER_MM_CAM 8 +#define MT6873_MASTER_MM_IMG 9 +#define MT6873_MASTER_MM_MDP 10 +#define MT6873_MASTER_VPUSYS 11 +#define MT6873_MASTER_VPU_0 12 +#define MT6873_MASTER_VPU_1 13 +#define MT6873_MASTER_MDLASYS 14 +#define MT6873_MASTER_MDLA_0 15 +#define MT6873_MASTER_UFS 16 +#define MT6873_MASTER_PCIE 17 +#define MT6873_MASTER_USB 18 +#define MT6873_MASTER_DBGIF 19 +#define MT6873_SLAVE_HRT_DDR_EMI 20 +#define MT6873_MASTER_HRT_MMSYS 21 +#define MT6873_MASTER_HRT_MM_DISP 22 +#define MT6873_MASTER_HRT_MM_VDEC 23 +#define MT6873_MASTER_HRT_MM_VENC 24 +#define MT6873_MASTER_HRT_MM_CAM 25 +#define MT6873_MASTER_HRT_MM_IMG 26 +#define MT6873_MASTER_HRT_MM_MDP 27 +#define MT6873_MASTER_HRT_DBGIF 28 +#define MT6873_MASTER_WIFI 29 +#define MT6873_MASTER_BT 30 +#define MT6873_MASTER_NETSYS 31 +#endif
Signature · 5 lines
1.9.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v5 11/17 interconnect: mediatek: Add interconnect provider driver
In reply to Henry ChenIntroduce Mediatek MT6873/MT8183/MT8192 specific provider driver using the interconnect framework.
ICC provider ICC Nodes
---- ----
--------- |CPU | |--- |VPU |
----- | |----- ---- | ----
|DRAM |--|DRAM | ---- | ----
| |--|scheduler|----- |GPU | |--- |DISP|
| |--|(EMI) | ---- | ----
| |--| | ----- | ----
----- | |----- |MMSYS|--|--- |VDEC|
--------- ----- | ----
/|\ | ----
|change DRAM freq |--- |VENC|
---------- | ----
| DVFSR | |
| | | ----
---------- |--- |IMG |
| ----
| ----
|--- |CAM |
------- drivers/interconnect/Kconfig | 1 + drivers/interconnect/Makefile | 1 + drivers/interconnect/mediatek/Kconfig | 13 ++ drivers/interconnect/mediatek/Makefile | 3 + drivers/interconnect/mediatek/mtk-emi.c | 330 ++++++++++++++++++++++++++++++++ 5 files changed, 348 insertions(+) create mode 100644 drivers/interconnect/mediatek/Kconfig create mode 100644 drivers/interconnect/mediatek/Makefile create mode 100644 drivers/interconnect/mediatek/mtk-emi.c
drivers/interconnect/Kconfig +1 -0
@@ -13,5 +13,6 @@ if INTERCONNECT source "drivers/interconnect/imx/Kconfig" source "drivers/interconnect/qcom/Kconfig" +source "drivers/interconnect/mediatek/Kconfig" endif
drivers/interconnect/Makefile +1 -0
@@ -6,3 +6,4 @@ icc-core-objs := core.o obj-$(CONFIG_INTERCONNECT) += icc-core.o obj-$(CONFIG_INTERCONNECT_IMX) += imx/ obj-$(CONFIG_INTERCONNECT_QCOM) += qcom/ +obj-$(CONFIG_INTERCONNECT_MTK) += mediatek/
drivers/interconnect/mediatek/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +config INTERCONNECT_MTK + bool "Mediatek Network-on-Chip interconnect drivers" + depends on ARCH_MEDIATEK + help + Support for Mediatek's Network-on-Chip interconnect hardware. + +config INTERCONNECT_MTK_EMI + tristate "Mediatek EMI interconnect driver" + depends on INTERCONNECT_MTK + depends on (MTK_DVFSRC && OF) + help + This is a driver for the Mediatek Network-on-Chip on DVFSRC-based + platforms.
drivers/interconnect/mediatek/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_INTERCONNECT_MTK_EMI) += mtk-emi.o
drivers/interconnect/mediatek/mtk-emi.c new file +330 -0
330 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v5 12/17 arm64: dts: mt8183: add dvfsrc related nodes
In reply to Henry ChenAdd DDR EMI provider dictating dram interconnect bus performance found on MT8192-based platforms
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/mediatek/mt8183.dtsi +2 -0
@@ -13,6 +13,7 @@ #include <dt-bindings/phy/phy.h> #include "mt8183-pinfunc.h" #include <dt-bindings/soc/mtk,dvfsrc.h> +#include <dt-bindings/interconnect/mtk,mt8183-emi.h> / { compatible = "mediatek,mt8183";
@@ -472,6 +473,7 @@ ddr_emi: dvfsrc@10012000 { compatible = "mediatek,mt8183-dvfsrc"; reg = <0 0x10012000 0 0x1000>; + #interconnect-cells = <1>; }; pwrap: pwrap@1000d000 {
Signature · 1 line
1.9.1
PATCH v5 13/17 arm64: dts: mt8192: add dvfsrc related nodes
In reply to Henry ChenAdd DDR EMI provider dictating dram interconnect bus performance found on MT8183-based platforms
--- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +2 -0
@@ -10,6 +10,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/pinctrl/mt8192-pinfunc.h> #include <dt-bindings/power/mt8192-power.h> +#include <dt-bindings/interconnect/mtk,mt6873-emi.h> / { compatible = "mediatek,mt8192";
@@ -420,6 +421,7 @@ ddr_emi: dvfsrc@10012000 { compatible = "mediatek,mt8192-dvfsrc"; reg = <0 0x10012000 0 0x1000>; + #interconnect-cells = <1>; }; systimer: timer@10017000 {
Signature · 1 line
1.9.1
PATCH v5 14/17 dt-bindings: regulator: add DVFSRC regulator dt-bindings
In reply to Henry ChenFrom: "henryc.chen" <[email protected]>
Add a regulator as sub device into dvfsrc dt-bindings for MT8183.
--- Documentation/devicetree/bindings/soc/mediatek/dvfsrc.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/soc/mediatek/dvfsrc.txt +14 -0
@@ -15,6 +15,11 @@ Required Properties: "dvfsrc": DVFSRC module clock - clocks: Must contain an entry for each entry in clock-names. - #interconnect-cells : should contain 1 +- regulator : The DVFSRC regulator is modelled as a subdevice of the DVFSRC. + Because DVFSRC can request power directly via register read/write, likes + vcore which is a core power of mt8183. As such, the DVFSRC regulator + requires that DVFSRC nodes be present. shall contain only one of the + following: "mediatek,mt8183-dvfsrc-regulator" Example:
@@ -24,4 +29,13 @@ Example: clocks = <&infracfg CLK_INFRA_DVFSRC>; clock-names = "dvfsrc"; #interconnect-cells = <1>; + dvfsrc-regulator { + compatible = "mediatek,mt8183-dvfsrc-regulator"; + dvfsrc_vcore: dvfsrc-vcore { + regulator-name = "dvfsrc-vcore"; + regulator-min-microvolt = <725000>; + regulator-max-microvolt = <800000>; + regulator-always-on; + }; + }; };
Signature · 5 lines
1.9.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Mark Brown
maintainerRe: [PATCH V5 14/17] dt-bindings: regulator: add DVFSRC regulator dt-bindings
Documentation/devicetree/bindings/soc/mediatek/dvfsrc.txt Example: · line 33
Quoted 5 lines · Henry Chen
Documentation/devicetree/bindings/soc/mediatek/dvfsrc.txt +2
-0clocks = <&infracfg CLK_INFRA_DVFSRC>; clock-names = "dvfsrc"; #interconnect-cells = <1>; + dvfsrc-regulator { + compatible = "mediatek,mt8183-dvfsrc-regulator";
This device has only one possible parent, why does it need a compatible string?
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH V5 14/17] dt-bindings: regulator: add DVFSRC regulator dt-bindings
Quoted 10 lines · Mark Brown
Documentation/devicetree/bindings/soc/mediatek/dvfsrc.txt Example: · line 33
Quoted 5 lines · Henry Chen
Documentation/devicetree/bindings/soc/mediatek/dvfsrc.txt +2
-0clocks = <&infracfg CLK_INFRA_DVFSRC>; clock-names = "dvfsrc"; #interconnect-cells = <1>; + dvfsrc-regulator { + compatible = "mediatek,mt8183-dvfsrc-regulator";This device has only one possible parent, why does it need a compatible string?
Sorry, that was a mistake, it will be removed on next version.
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v5 15/17 regulator: Regulator driver for the Mediatek DVFSRC
In reply to Henry ChenFrom: "henryc.chen" <[email protected]>
Driver for regulators exposed by the DVFSRC (dynamic voltage and frequency scaling resource collector) found in devices based on mt8183 and newer platforms.
--- drivers/regulator/Kconfig | 10 ++ drivers/regulator/Makefile | 1 + drivers/regulator/mtk-dvfsrc-regulator.c | 224 +++++++++++++++++++++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 drivers/regulator/mtk-dvfsrc-regulator.c
drivers/regulator/Kconfig +10 -0
@@ -729,6 +729,16 @@ config REGULATOR_MT6397 This driver supports the control of different power rails of device through regulator interface. +config REGULATOR_MTK_DVFSRC + tristate "MediaTek DVFSRC regulator driver" + depends on MTK_DVFSRC + help + Say y here to control regulator by DVFSRC (dynamic voltage + and frequency scaling resource collector). + This driver supports to control regulators via the DVFSRC + of Mediatek. It allows for voting on regulator state + between multiple users. + config REGULATOR_PALMAS tristate "TI Palmas PMIC Regulators" depends on MFD_PALMAS
drivers/regulator/Makefile +1 -0
@@ -90,6 +90,7 @@ obj-$(CONFIG_REGULATOR_MT6323) += mt6323-regulator.o obj-$(CONFIG_REGULATOR_MT6358) += mt6358-regulator.o obj-$(CONFIG_REGULATOR_MT6380) += mt6380-regulator.o obj-$(CONFIG_REGULATOR_MT6397) += mt6397-regulator.o +obj-$(CONFIG_REGULATOR_MTK_DVFSRC) += mtk-dvfsrc-regulator.o obj-$(CONFIG_REGULATOR_QCOM_LABIBB) += qcom-labibb-regulator.o obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o obj-$(CONFIG_REGULATOR_QCOM_RPMH) += qcom-rpmh-regulator.o
drivers/regulator/mtk-dvfsrc-regulator.c new file +224 -0
224 lines not on this page · raw message
Signature · 5 lines
1.9.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Mark Brown
maintainerRe: [PATCH V5 15/17] regulator: Regulator driver for the Mediatek DVFSRC
drivers/regulator/mtk-dvfsrc-regulator.c line 4
Quoted 4 lines · Henry Chen
drivers/regulator/mtk-dvfsrc-regulator.c new file +4
-0+// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2019 MediaTek Inc. +*/
Please make the entire comment a C++ one so things look more intentional, and are you sure about that copyright date?
Quoted 7 lines
drivers/regulator/mtk-dvfsrc-regulator.c new file +7
-0+static int dvfsrc_set_voltage_sel (struct regulator_dev *rdev, +unsigned int selector) +{ +struct device *dvfsrc_dev =to_dvfsrc_dev (rdev); +int id =rdev_get_id (rdev); + +switch (id) {
drivers/regulator/mtk-dvfsrc-regulator.c line 77
Quoted 10 lines
drivers/regulator/mtk-dvfsrc-regulator.c new file +10
-0+case DVFSRC_ID_VCORE : +mtk_dvfsrc_send_request (dvfsrc_dev, +MTK_DVFSRC_CMD_VCORE_REQUEST , + selector); +break ; +case DVFSRC_ID_VSCP : +mtk_dvfsrc_send_request (dvfsrc_dev, +MTK_DVFSRC_CMD_VSCP_REQUEST , + selector); +break ;
Just have two separate operations rather than the switch statement, and where you do have switch statements please follow the kernel coding style.
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH V5 15/17] regulator: Regulator driver for the Mediatek DVFSRC
Hi Mark,
Thank you for reviewing.
Quoted 9 lines · Mark Brown
drivers/regulator/mtk-dvfsrc-regulator.c line 4
Quoted 4 lines · Henry Chen
drivers/regulator/mtk-dvfsrc-regulator.c new file +4
-0+// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2019 MediaTek Inc. +*/ Please make the entire comment a C++ one so things look more intentional, and are you sure about that copyright date?
Ok, it will be modified on next version.
Quoted 14 lines
Quoted 14 lines
drivers/regulator/mtk-dvfsrc-regulator.c new file +13
-0+static int dvfsrc_set_voltage_sel (struct regulator_dev *rdev, +unsigned int selector) +{ +struct device *dvfsrc_dev =to_dvfsrc_dev (rdev); +int id =rdev_get_id (rdev); + +switch (id) { +case DVFSRC_ID_VCORE : +mtk_dvfsrc_send_request (dvfsrc_dev, +MTK_DVFSRC_CMD_VCORE_REQUEST , + selector); +break ; +case DVFSRC_ID_VSCP :
Quoted 8 lines
drivers/regulator/mtk-dvfsrc-regulator.c line 77
Quoted 4 lines
drivers/regulator/mtk-dvfsrc-regulator.c new file +4
-0+mtk_dvfsrc_send_request (dvfsrc_dev, +MTK_DVFSRC_CMD_VSCP_REQUEST , + selector); +break ;Just have two separate operations rather than the switch statement, and where you do have switch statements please follow the kernel coding style.
Ok, it will be modified on next version.
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v5 16/17 arm64: dts: mt8183: add dvfsrc regulator nodes
In reply to Henry ChenAdd dvfsrc regulator nodes which is for MT8183-based platforms
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/mediatek/mt8183.dtsi +6 -0
@@ -474,6 +474,12 @@ compatible = "mediatek,mt8183-dvfsrc"; reg = <0 0x10012000 0 0x1000>; #interconnect-cells = <1>; + dvfsrc_vcore: dvfsrc-vcore { + regulator-name = "dvfsrc-vcore"; + regulator-min-microvolt = <725000>; + regulator-max-microvolt = <800000>; + regulator-always-on; + }; }; pwrap: pwrap@1000d000 {
Signature · 5 lines
1.9.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v5 17/17 arm64: dts: mt8192: add dvfsrc regulator nodes
In reply to Henry ChenFrom: "henryc.chen" <[email protected]>
Add dvfsrc regulator nodes which is for MT8192-based platforms
--- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +6 -0
@@ -422,6 +422,12 @@ compatible = "mediatek,mt8192-dvfsrc"; reg = <0 0x10012000 0 0x1000>; #interconnect-cells = <1>; + dvfsrc_vcore: dvfsrc-vcore { + regulator-name = "dvfsrc-vcore"; + regulator-min-microvolt = <575000>; + regulator-max-microvolt = <725000>; + regulator-always-on; + }; }; systimer: timer@10017000 {
Signature · 5 lines
1.9.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek