[PATCH v2 20/29] iommu/mediatek: Only adjust code about register base

2021-08-13 Thread Yong Wu
No functional change. Use "base" instead of the data->base. This is avoid to touch too many lines in the next patches. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 45 +-- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/

[PATCH v2 19/29] iommu/mediatek: Add mt8195 support

2021-08-13 Thread Yong Wu
mt8195 has 3 IOMMU, containing 2 MM IOMMUs, one is for vdo, the other is for vpp. and 1 INFRA IOMMU. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 42 +++ drivers/iommu/mtk_iommu.h | 1 + 2 files changed, 43 insertions(+) diff --git a/drivers/iommu

[PATCH v2 18/29] iommu/mediatek: Add PCIe support

2021-08-13 Thread Yong Wu
if we should change of_map_id to support output MAX_PHANDLE_ARGS. Here add the solution in ourselve drivers. If it's pcie case, enable one more bit. Not all infra iommu support PCIe, thus add a PCIe support flag here. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 17 -

[PATCH v2 17/29] iommu/mediatek: Add infra iommu support

2021-08-13 Thread Yong Wu
-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 36 +--- drivers/iommu/mtk_iommu.h | 3 +++ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index a72241724adb..45b34f4e99fb 100644 --- a/drivers

[PATCH v2 16/29] iommu/mediatek: Adjust device link when it is sub-common

2021-08-13 Thread Yong Wu
For MM IOMMU, We always add device link between smi-common and IOMMU HW. In mt8195, we add smi-sub-common. Thus, if the node is sub-common, we still need find again to get smi-common, then do device link. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 11 +++ 1 file changed, 11

[PATCH v2 15/29] iommu/mediatek: Contain MM IOMMU flow with the MM TYPE

2021-08-13 Thread Yong Wu
needed for MM IOMMU. and all the current SoC are MM_IOMMU. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 190 +- 1 file changed, 107 insertions(+), 83 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 20d15f80dd6e.

[PATCH v2 14/29] iommu/mediatek: Add IOMMU_TYPE flag

2021-08-13 Thread Yong Wu
Add IOMMU_TYPE definition. In the mt8195, we have another IOMMU_TYPE: infra iommu, also there will be another APU_IOMMU, thus, use 2bits for the IOMMU_TYPE. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git

[PATCH v2 13/29] iommu/mediatek: Add SUB_COMMON_3BITS flag

2021-08-13 Thread Yong Wu
In prevous SoC, the sub common id occupy 2 bits. the mt8195's sub common id has 3bits. Add a new flag for this. and rename the prevous flag to _2BITS. For readable, I put these two flags together, then move the other flags. no functional change. Signed-off-by: Yong Wu --- drivers/iommu

[PATCH v2 12/29] iommu/mediatek: Always enable output PA over 32bits in isr

2021-08-13 Thread Yong Wu
flag. Prepare for the IOMMU that still use IOVA 32bits but its dram size may be over 4GB. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index abc721a1da21

[PATCH v2 11/29] iommu/mediatek: Always pm_runtime_get while tlb flush

2021-08-13 Thread Yong Wu
expect the user could pm_runtime_get_sync before dma_alloc_attrs which need tlb ops. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index add23a36a5e2..abc721a1da21

[PATCH v2 10/29] iommu/mediatek: Remove the granule in the tlb flush

2021-08-13 Thread Yong Wu
The MediaTek IOMMU don't care about granule when tlb flushing. Remove this variable. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d64139ab59d0

[PATCH v2 09/29] iommu/mediatek: Add tlb_lock in tlb_flush_all

2021-08-13 Thread Yong Wu
The tlb_flush_all also touches the registers about tlb operations. Add spinlock in it to protect the tlb registers. If flush_all is called from tlb_flush_range, then no need this spinlock as tlb_flush_range already hold the tlb_lock. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 19

[PATCH v2 08/29] iommu/mediatek: Remove for_each_m4u in tlb_sync_all

2021-08-13 Thread Yong Wu
it. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 175065b76509..1e18fff76e61 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c

[PATCH v2 07/29] iommu/mediatek: Add a flag NON_STD_AXI

2021-08-13 Thread Yong Wu
Add a new flag NON_STD_AXI, All the previous SoC support this flag. Prepare for adding infra and apu iommu which don't support this. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/iommu

[PATCH v2 06/29] iommu/mediatek: Add a flag DCM_DISABLE

2021-08-13 Thread Yong Wu
In the infra iommu, we should disable DCM. add a new flag for this. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 259ff7b90ff3..bd50f3020bc1 100644

[PATCH v2 05/29] iommu/mediatek: Add 12G~16G support for multi domains

2021-08-13 Thread Yong Wu
n't change it here. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 287dfc0fc6f8..259ff7b90ff3 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/m

[PATCH v2 04/29] iommu/mediatek: Adapt sharing and non-sharing pgtable case

2021-08-13 Thread Yong Wu
for_each_m4u to loop the 2 HWs. Add the list_head into this macro. In the sharing pgtable case, the list_head is the global "m4ulist". In the non-sharing pgtable case, the list_head is hw_list_head which is a variable in the "data". then for_each_m4u will only loop itself. Signed-off-by: Y

[PATCH v2 03/29] iommu/mediatek: Fix 2 HW sharing pgtable issue

2021-08-13 Thread Yong Wu
affect mt2712 which is the only SoC that share pgtable currently. Fixes: 4f956c97d26b ("iommu/mediatek: Move domain_finalise into attach_device") Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iom

[PATCH v2 02/29] dt-bindings: mediatek: mt8195: Add binding for infra IOMMU

2021-08-13 Thread Yong Wu
"of_iommu_configure_dev_id" only support the id number is 1, But our PCIe have two ports, one is for reading and the other is for writing. see more about the PCIe patch in this patchset. Thus, I only list the reading id here and add the other id in our driver. Signed-off-by: Yong Wu Acked-by: Krzysztof

[PATCH v2 01/29] dt-bindings: mediatek: mt8195: Add binding for MM IOMMU

2021-08-13 Thread Yong Wu
it "m4u" which means "MultiMedia Memory Management UNIT". thus, use the "iommu" as the compatiable string. Signed-off-by: Yong Wu Acked-by: Krzysztof Kozlowski Reviewed-by: Rob Herring --- .../bindings/iommu/mediatek,iommu.yaml| 7 + .../dt-bindings/memor

[PATCH v2 00/29] MT8195 IOMMU SUPPORT

2021-08-13 Thread Yong Wu
veral patches. v1: https://lore.kernel.org/linux-mediatek/20210630023504.18177-1-yong...@mediatek.com/ Base on v5.13-rc1. Yong Wu (29): dt-bindings: mediatek: mt8195: Add binding for MM IOMMU dt-bindings: mediatek: mt8195: Add binding for infra IOMMU iommu/mediatek: Fix 2 HW sharing

[PATCH v3 13/13] MAINTAINERS: Add entry for MediaTek SMI

2021-08-10 Thread Yong Wu
I am the author of MediaTek SMI driver, and will to maintain and develop it further. Add myself to cover these items. Signed-off-by: Yong Wu --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a61f4f3b78a9..91af55b45e80 100644

[PATCH v3 12/13] memory: mtk-smi: mt8195: Add initial setting for smi-larb

2021-08-10 Thread Yong Wu
here. b. SW_FLAG: Set 1 to the FLAG register. this is only for helping debug. We could confirm if the larb is reset from this value is 1 or 0. In some SoC, this setting maybe changed dynamically for some special case like 4K, and this initial setting is enough in mt8195. Signed-off-by: Yong

[PATCH v3 11/13] memory: mtk-smi: mt8195: Add initial setting for smi-common

2021-08-10 Thread Yong Wu
To improve the performance, add initial setting for smi-common. some register use some fix setting(suggested from DE). Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 42 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/drivers/memory

[PATCH v3 10/13] memory: mtk-smi: mt8195: Add smi support

2021-08-10 Thread Yong Wu
MT8195 has two smi-common, their IP are the same. Only the larbs that connect with the smi-common are different. thus the bus_sel are different for the two smi-common. Signed-off-by: Yong Wu Reviewed-by: Ikjoon Jang --- drivers/memory/mtk-smi.c | 26 ++ 1 file changed

[PATCH v3 09/13] memory: mtk-smi: Use devm_platform_ioremap_resource

2021-08-10 Thread Yong Wu
No functional change. Simplify probing code. Signed-off-by: Yong Wu Reviewed-by: Ikjoon Jang --- drivers/memory/mtk-smi.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 58d9f7667490..a001e41f5074 100644

[PATCH v3 08/13] memory: mtk-smi: Add clocks for smi-sub-common

2021-08-10 Thread Yong Wu
SMI sub common only have one output port. thus it has only one gals clocks(gals0). then, smi-sub-common require the three clocks(apb/smi/gals0) in has_gals case. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git

[PATCH v3 07/13] memory: mtk-smi: Add device link for smi-sub-common

2021-08-10 Thread Yong Wu
-common. This is for enabling clock/power automatically. Move the device link code to a new interface for reusing. Signed-off-by: Yong Wu Reviewed-by: Ikjoon Jang --- drivers/memory/mtk-smi.c | 75 +++- 1 file changed, 51 insertions(+), 24 deletions(-) diff

[PATCH v3 06/13] memory: mtk-smi: Add error handle for smi_probe

2021-08-10 Thread Yong Wu
Add error handle while component_add fail. Signed-off-by: Yong Wu Reviewed-by: Ikjoon Jang --- drivers/memory/mtk-smi.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 33b6c5efe102..b362d528944e 100644

[PATCH v3 05/13] memory: mtk-smi: Adjust some code position

2021-08-10 Thread Yong Wu
as the current kernel allow it. Signed-off-by: Yong Wu Reviewed-by: Ikjoon Jang --- drivers/memory/mtk-smi.c | 188 --- 1 file changed, 75 insertions(+), 113 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 02a584dfb9b1..33b6c5efe102

[PATCH v3 04/13] memory: mtk-smi: Rename smi_gen to smi_type

2021-08-10 Thread Yong Wu
Prepare for adding smi sub common. Only rename from smi_gen to smi_type. No functional change. About the current "smi_gen", we have gen1/gen2 that stand for the generation number for HW. I plan to add a new type(sub_common), then the name "gen" is not proper. Signed-off-b

[PATCH v3 03/13] memory: mtk-smi: Use clk_bulk clock ops

2021-08-10 Thread Yong Wu
Signed-off-by: Yong Wu --- change note: still keep smi-common's has_glas flag. it is more strict. But it did change many code, thus I didn't keep Ikjoon's R-b. --- drivers/memory/mtk-smi.c | 143 +++ 1 file changed, 55 insertions(+), 88 deletions(-) diff --git

[PATCH v3 02/13] dt-bindings: memory: mediatek: Add mt8195 smi sub common

2021-08-10 Thread Yong Wu
e add the smi-sub-common here, the IOMMU driver still need to find the smi-common device. thus, add this bool property to indicate if it is sub-common. Signed-off-by: Yong Wu --- change note: a. change mediatek, smi type from phandle-array to phandle from Rob. b. Add a new bool property (mediate

[PATCH v3 01/13] dt-bindings: memory: mediatek: Add mt8195 smi binding

2021-08-10 Thread Yong Wu
like this: IOMMU(VDO) IOMMU(VPP) | | SMI_COMMON_VDO SMI_COMMON_VPP | | ... | | ... larb0 larb2 ...larb1 larb3... Signed-off-by: Yong Wu Acked-by: Rob Herring --- .../bindings/memory

[PATCH v3 00/13] MT8195 SMI support

2021-08-10 Thread Yong Wu
v1: https://lore.kernel.org/linux-mediatek/20210616114346.18812-1-yong...@mediatek.com/ Yong Wu (13): dt-bindings: memory: mediatek: Add mt8195 smi binding dt-bindings: memory: mediatek: Add mt8195 smi sub common memory: mtk-smi: Use clk_bulk clock ops memory: mtk-smi: Rename smi_gen

[PATCH v7 12/12] arm64: dts: mediatek: Get rid of mediatek, larb for MM nodes

2021-07-29 Thread Yong Wu
After adding device_link between the IOMMU consumer and smi, the mediatek,larb is unnecessary now. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green Tested-by: Dafna Hirschfeld --- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 arch/arm64/boot/dts/mediatek

[PATCH v7 11/12] arm: dts: mediatek: Get rid of mediatek, larb for MM nodes

2021-07-29 Thread Yong Wu
After adding device_link between the IOMMU consumer and smi, the mediatek,larb is unnecessary now. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green --- arch/arm/boot/dts/mt2701.dtsi | 2 -- arch/arm/boot/dts/mt7623n.dtsi | 5 - 2 files changed, 7 deletions(-) diff

[PATCH v7 10/12] memory: mtk-smi: Get rid of mtk_smi_larb_get/put

2021-07-29 Thread Yong Wu
After adding device_link between the iommu consumer and smi-larb, the pm_runtime_get(_sync) of smi-larb and smi-common will be called automatically. we can get rid of mtk_smi_larb_get/put. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Krzysztof Kozlowski Acked

[PATCH v7 09/12] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2021-07-29 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the vcodec device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Tiffany Lin CC: Irui Wang Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked

[PATCH v7 08/12] drm/mediatek: Get rid of mtk_smi_larb_get/put

2021-07-29 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the drm device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: CK Hu CC: Philipp Zabel Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Chun

[PATCH v7 07/12] drm/mediatek: Add pm runtime support for ovl and rdma

2021-07-29 Thread Yong Wu
or rdma device. CC: CK Hu Signed-off-by: Yongqiang Niu Signed-off-by: Yong Wu (Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync) Acked-by: Chun-Kuang Hu Tested-by: Dafna Hirschfeld # on mt8173 --- change log: add return fail when pm_runtime_resume_and_get fail. --- driv

[PATCH v7 06/12] media: mtk-mdp: Get rid of mtk_smi_larb_get/put

2021-07-29 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the mdp device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Minghsiu Tsai CC: Houlong Wei Signed-off-by: Yong Wu Reviewed-by: Evan Green Reviewed

[PATCH v7 05/12] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put

2021-07-29 Thread Yong Wu
. CC: Rick Chang CC: Xia Jiang Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Rick Chang Reviewed-by: Dafna Hirschfeld Tested-by: Dafna Hirschfeld # on mt8173 --- .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 45 +-- .../media/platform/mtk-jpeg/mtk_jpeg_core.h

[PATCH v7 04/12] iommu/mediatek: Add device_link between the consumer and the larb devices

2021-07-29 Thread Yong Wu
iga Signed-off-by: Yong Wu Tested-by: Dafna Hirschfeld # on mt8173 --- drivers/iommu/mtk_iommu.c| 22 ++ drivers/iommu/mtk_iommu_v1.c | 20 +++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/io

[PATCH v7 03/12] iommu/mediatek: Add probe_defer for smi-larb

2021-07-29 Thread Yong Wu
there is no this patch, if some consumer drivers run before smi-larb, the supplier link_status is DL_DEV_NO_DRIVER(0) in the device_link_add, then device_links_driver_bound will use WARN_ON to complain that the link_status of supplier is not right. Signed-off-by: Yong Wu Tested-by: Dafna

[PATCH v7 01/12] dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW

2021-07-29 Thread Yong Wu
connects with from iommu id in the "iommus=" property. Signed-off-by: Yong Wu Reviewed-by: Rob Herring Reviewed-by: Evan Green --- .../bindings/display/mediatek/mediatek,disp.txt | 9 - .../devicetree/bindings/media/mediatek-jpeg-decoder.yaml | 9 - .../devicetre

[PATCH v7 02/12] iommu/mediatek-v1: Free the existed fwspec if the master dev already has

2021-07-29 Thread Yong Wu
eturn -EINVAL; } ... } Thus, Free the existed fwspec if the master device already has fwspec. This issue is reported at: https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/ Reported-by: Frank Wunderlich Signed-off

[PATCH v7 00/12] Clean up "mediatek,larb"

2021-07-29 Thread Yong Wu
gh the smi is built-in from Evan. 4) Remove the shutdown callback in iommu. v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong...@mediatek.com/ Yong Wu (11): dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW iommu/mediatek-v1: Free the exis

Re: [PATCH v2 11/11] memory: mtk-smi: mt8195: Add initial setting for smi-larb

2021-07-29 Thread Yong Wu
Hi Ikjoon, Just a ping. On Thu, 2021-07-22 at 14:38 +0800, Yong Wu wrote: > On Wed, 2021-07-21 at 21:40 +0800, Ikjoon Jang wrote: > > On Thu, Jul 15, 2021 at 8:23 PM Yong Wu wrote: > > > > > > To improve the performance, We add some initial setting for smi larb

Re: [PATCH v2 10/11] memory: mtk-smi: mt8195: Add initial setting for smi-common

2021-07-22 Thread Yong Wu
On Wed, 2021-07-21 at 20:54 +0800, Ikjoon Jang wrote: > On Thu, Jul 15, 2021 at 8:25 PM Yong Wu wrote: > > > > To improve the performance, add initial setting for smi-common. > > some register use some fix setting(suggested from DE). > > > > Signed-off-by: Yong Wu

Re: [PATCH v2 11/11] memory: mtk-smi: mt8195: Add initial setting for smi-larb

2021-07-22 Thread Yong Wu
On Wed, 2021-07-21 at 21:40 +0800, Ikjoon Jang wrote: > On Thu, Jul 15, 2021 at 8:23 PM Yong Wu wrote: > > > > To improve the performance, We add some initial setting for smi larbs. > > there are two part: > > 1), Each port has the special ostd(outstanding) value in eac

Re: [PATCH v2 07/11] memory: mtk-smi: Add smi sub common support

2021-07-22 Thread Yong Wu
Hi Ikjoon, Thanks very much for your help reviewing.. On Wed, 2021-07-21 at 19:43 +0800, Ikjoon Jang wrote: > On Thu, Jul 15, 2021 at 8:25 PM Yong Wu wrote: > > > > In mt8195, there are some larbs connect with the smi-sub-common, then > > connect with smi-common. > >

[PATCH v2 11/11] memory: mtk-smi: mt8195: Add initial setting for smi-larb

2021-07-15 Thread Yong Wu
setting is enough in mt8195. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 74 +++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index c52bf02458ff..1d9e67520433 100644 --- a/drivers

[PATCH v2 10/11] memory: mtk-smi: mt8195: Add initial setting for smi-common

2021-07-15 Thread Yong Wu
To improve the performance, add initial setting for smi-common. some register use some fix setting(suggested from DE). Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 42 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/drivers/memory

[PATCH v2 09/11] memory: mtk-smi: mt8195: Add smi support

2021-07-15 Thread Yong Wu
MT8195 has two smi-common, their IP are the same. Only the larbs that connect with the smi-common are different. thus the bus_sel are different for the two smi-common. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 23 +++ 1 file changed, 23 insertions(+) diff --git

[PATCH v2 08/11] memory: mtk-smi: Use devm_platform_ioremap_resource

2021-07-15 Thread Yong Wu
No functional change. Simplify probing code. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index ee49bb50f5f5..e5a34b3952a0 100644 --- a/drivers/memory/mtk

[PATCH v2 07/11] memory: mtk-smi: Add smi sub common support

2021-07-15 Thread Yong Wu
-common. This is for enabling clock/power automatically. Move the device link code to a new interface for reusing. There is no SW extra setting for smi-sub-common. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 75 +++- 1 file changed, 51 insertions

[PATCH v2 06/11] memory: mtk-smi: Add error handle for smi_probe

2021-07-15 Thread Yong Wu
Add error handle while component_add fail. Signed-off-by: Yong Wu --- It don't have the error handle when v1. it is not a fatal error. thus don't add fix tags. --- drivers/memory/mtk-smi.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b

[PATCH v2 05/11] memory: mtk-smi: Adjust some code position

2021-07-15 Thread Yong Wu
as the current kernel allow it. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 185 +++ 1 file changed, 73 insertions(+), 112 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index ff07b14bcd66..6f8e582bace5 100644 --- a/drivers/memory

[PATCH v2 04/11] memory: mtk-smi: Rename smi_gen to smi_type

2021-07-15 Thread Yong Wu
Prepare for adding smi sub common. Only rename from smi_gen to smi_type. No functional change. About the current "smi_gen", we have gen1/gen2 that stand for the generation number for HW. I plan to add a new type(sub_common), then the name "gen" is not prober. Signed-off-by: Y

[PATCH v2 03/11] memory: mtk-smi: Use clk_bulk clock ops

2021-07-15 Thread Yong Wu
. For gals clocks, we already use get_optional for it, then the flag "has_gals" is not helpful now, remove it. Also remove clk fail logs since bulk interface already output fail log. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 138 +-- 1 fi

[PATCH v2 02/11] dt-bindings: memory: mediatek: Add mt8195 smi sub common

2021-07-15 Thread Yong Wu
k,smi" phandle to point to its smi-common. meanwhile, the sub-common only has one gals clock. Signed-off-by: Yong Wu --- .../mediatek,smi-common.yaml | 25 +++ 1 file changed, 25 insertions(+) diff --git a/Documentation/devicetree/bindings/memory-contr

[PATCH v2 01/11] dt-bindings: memory: mediatek: Add mt8195 smi binding

2021-07-15 Thread Yong Wu
like this: IOMMU(VDO) IOMMU(VPP) | | SMI_COMMON_VDO SMI_COMMON_VPP | | ... | | ... larb0 larb2 ...larb1 larb3... Signed-off-by: Yong Wu --- .../bindings/memory-controllers/mediatek

[PATCH v2 00/11] MT8195 SMI support

2021-07-15 Thread Yong Wu
. 2) Add two new little patches: a) use devm_platform_ioremap_resource b) Add error handle for smi_probe v1: https://lore.kernel.org/linux-mediatek/20210616114346.18812-1-yong...@mediatek.com/ Yong Wu (11): dt-bindings: memory: mediatek: Add mt8195 smi binding dt-bindings

Re: Aw: [PATCH v6 00/11] Clean up "mediatek,larb"

2021-07-14 Thread Yong Wu
r4: > [6.845669] [] (bus_for_each_drv) from [] > (__device_atta) > [6.854044] r6:0001 r5:c21f9c54 r4:c21f9c10 > [6.858662] [] (__device_attach) from [] > (device_initial) > [6.867207] r6:c21f9c10 r5:c1406f58 r4:c1406ca0 > [6.871825] [] (dev

Re: [PATCH v6 00/11] Clean up "mediatek,larb"

2021-07-14 Thread Yong Wu
sometimes passed and sometimes failed with 'context deadline exceeded'. > With this patchset it seems that the test always passes so I added tested-by: > > Tested-by: Dafna Hirschfeld Thanks very much for your quick review and testing:) > > Thanks, > Dafna > > > >

Re: [PATCH v6 06/11] drm/mediatek: Add pm runtime support for ovl and rdma

2021-07-14 Thread Yong Wu
On Wed, 2021-07-14 at 10:44 +0200, Dafna Hirschfeld wrote: > > On 14.07.21 04:56, Yong Wu wrote: > > From: Yongqiang Niu > > > > Prepare for smi cleaning up "mediatek,larb". > > > > Display use the dispsys device to call pm_rumtime_get_sync bef

Re: [PATCH v6 03/11] iommu/mediatek: Add device_link between the consumer and the larb devices

2021-07-14 Thread Yong Wu
On Wed, 2021-07-14 at 10:26 +0200, Dafna Hirschfeld wrote: > > On 14.07.21 04:56, Yong Wu wrote: > > MediaTek IOMMU-SMI diagram is like below. all the consumer connect with > > smi-larb, then connect with smi-common. > > > > M4U >

[PATCH v6 11/11] arm64: dts: mediatek: Get rid of mediatek, larb for MM nodes

2021-07-13 Thread Yong Wu
After adding device_link between the IOMMU consumer and smi, the mediatek,larb is unnecessary now. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green --- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 arch/arm64/boot/dts/mediatek/mt8183.dtsi | 6 -- 2

[PATCH v6 10/11] arm: dts: mediatek: Get rid of mediatek, larb for MM nodes

2021-07-13 Thread Yong Wu
After adding device_link between the IOMMU consumer and smi, the mediatek,larb is unnecessary now. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green --- arch/arm/boot/dts/mt2701.dtsi | 2 -- arch/arm/boot/dts/mt7623n.dtsi | 5 - 2 files changed, 7 deletions(-) diff

[PATCH v6 09/11] memory: mtk-smi: Get rid of mtk_smi_larb_get/put

2021-07-13 Thread Yong Wu
After adding device_link between the iommu consumer and smi-larb, the pm_runtime_get(_sync) of smi-larb and smi-common will be called automatically. we can get rid of mtk_smi_larb_get/put. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Krzysztof Kozlowski Acked

[PATCH v6 08/11] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2021-07-13 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the vcodec device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Tiffany Lin CC: Irui Wang Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked

[PATCH v6 07/11] drm/mediatek: Get rid of mtk_smi_larb_get/put

2021-07-13 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the drm device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: CK Hu CC: Philipp Zabel Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Chun

[PATCH v6 06/11] drm/mediatek: Add pm runtime support for ovl and rdma

2021-07-13 Thread Yong Wu
or rdma device. CC: CK Hu Signed-off-by: Yongqiang Niu Signed-off-by: Yong Wu (Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync) Acked-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 9 - drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 9 - driv

[PATCH v6 05/11] media: mtk-mdp: Get rid of mtk_smi_larb_get/put

2021-07-13 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the mdp device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Minghsiu Tsai CC: Houlong Wei Signed-off-by: Yong Wu Reviewed-by: Evan Green Reviewed

[PATCH v6 04/11] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put

2021-07-13 Thread Yong Wu
. CC: Rick Chang CC: Xia Jiang Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Rick Chang --- .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 45 +-- .../media/platform/mtk-jpeg/mtk_jpeg_core.h | 2 - 2 files changed, 2 insertions(+), 45 deletions(-) diff --git

[PATCH v6 03/11] iommu/mediatek: Add device_link between the consumer and the larb devices

2021-07-13 Thread Yong Wu
iga Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c| 22 ++ drivers/iommu/mtk_iommu_v1.c | 20 +++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index a02dde094788..ee742900c

[PATCH v6 02/11] iommu/mediatek: Add probe_defer for smi-larb

2021-07-13 Thread Yong Wu
there is no this patch, if some consumer drivers run before smi-larb, the supplier link_status is DL_DEV_NO_DRIVER(0) in the device_link_add, then device_links_driver_bound will use WARN_ON to complain that the link_status of supplier is not right. Signed-off-by: Yong Wu --- since [1

[PATCH v6 01/11] dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW

2021-07-13 Thread Yong Wu
connects with from iommu id in the "iommus=" property. Signed-off-by: Yong Wu Reviewed-by: Rob Herring Reviewed-by: Evan Green --- .../bindings/display/mediatek/mediatek,disp.txt | 9 - .../devicetree/bindings/media/mediatek-jpeg-decoder.yaml | 9 - .../devicetre

[PATCH v6 00/11] Clean up "mediatek,larb"

2021-07-13 Thread Yong Wu
mu. v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong...@mediatek.com/ Yong Wu (10): dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW iommu/mediatek: Add probe_defer for smi-larb iommu/mediatek: Add device_link between the consumer an

Re: [PATCH 3/9] memory: mtk-smi: Use clk_bulk instead of the clk ops

2021-07-11 Thread Yong Wu
On Thu, 2021-07-08 at 11:32 +0200, Krzysztof Kozlowski wrote: > On 16/06/2021 13:43, Yong Wu wrote: > > smi have many clocks: apb/smi/gals. > > This patch use clk_bulk interface instead of the orginal one to simply > > the code. > > > > gals is optional clk(som

Re: [PATCH 4/9] memory: mtk-smi: Rename smi_gen to smi_type

2021-07-11 Thread Yong Wu
On Thu, 2021-07-08 at 11:34 +0200, Krzysztof Kozlowski wrote: > On 16/06/2021 13:43, Yong Wu wrote: > > This is a preparing patch for adding smi sub common. > > Don't write "This patch". Use simple imperative: > "Prepare for adding smi sub common." >

Re: [PATCH 1/9] dt-bindings: memory: mediatek: Add mt8195 smi binding

2021-07-11 Thread Yong Wu
On Thu, 2021-07-08 at 11:26 +0200, Krzysztof Kozlowski wrote: > On 16/06/2021 13:43, Yong Wu wrote: > > This patch adds mt8195 smi supporting in the bindings. > > > > In mt8195, there are two smi-common HW, one is for vdo(video output), > > the other is fo

Re: [PATCH 01/24] dt-bindings: mediatek: mt8195: Add binding for MM IOMMU

2021-06-30 Thread Yong Wu
On Wed, 2021-06-30 at 08:26 +0200, Krzysztof Kozlowski wrote: > On 30/06/2021 04:34, Yong Wu wrote: > > This patch adds descriptions for mt8195 IOMMU which also use ARM > > Short-Descriptor translation table format. > > > > In mt8195, there are two smi-common HW and

[PATCH 23/24] iommu/mediatek: Add multi bank support

2021-06-29 Thread Yong Wu
llow bank0 always go. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 78 +-- drivers/iommu/mtk_iommu.h | 6 +-- 2 files changed, 61 insertions(+), 23 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index e297a50adced..3a

[PATCH 21/24] iommu/mediatek: Change the domid to iova_region_id

2021-06-29 Thread Yong Wu
nly rename the domid to iova_region_id. This is preparing for adding bankid. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 46 +++ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.

[PATCH 20/24] iommu/mediatek: Add bank_nr and bank_enable

2021-06-29 Thread Yong Wu
-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 18 ++ drivers/iommu/mtk_iommu.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index ed3cf75850ce..042489b8e402 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu

[PATCH 17/24] iommu/mediatek: Just move code position in hw_init

2021-06-29 Thread Yong Wu
No functional change too. mt8195 IOMMU support bank functions. some global control etting is in bank0. and the other banks have its bank independent setting. this patch only moves the control settings and the independent registers together. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c

[PATCH 15/24] iommu/mediatek: Add mt8195 support

2021-06-29 Thread Yong Wu
mt8195 has 3 IOMMU, containing 2 MM IOMMUs, one is for vdo, the other is for vpp. and 1 INFRA IOMMU. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 42 +++ drivers/iommu/mtk_iommu.h | 1 + 2 files changed, 43 insertions(+) diff --git a/drivers/iommu

[PATCH 13/24] iommu/mediatek: Add infra iommu support

2021-06-29 Thread Yong Wu
return value for mtk_iommu_config. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 36 +--- drivers/iommu/mtk_iommu.h | 3 +++ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index

[PATCH 11/24] iommu/mediatek: Add SUB_COMMON_3BITS flag

2021-06-29 Thread Yong Wu
In prevous SoC, the sub common id occupy 2 bits. the mt8195's sub common id has 3bits. Add a new flag for this. and rename the prevous flag to _2BITS. For readable, I put these two flags together, then move the other flags. no functional change. Signed-off-by: Yong Wu --- drivers/iommu

[PATCH 10/24] iommu/mediatek: Always enable output PA over 32bits in isr

2021-06-29 Thread Yong Wu
has this IOVA_34 flag. This is preparing for the IOMMU that still use IOVA 32bits. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index fcf70787d3d1..35e321ed6d3d

[PATCH 07/24] iommu/mediatek: Add flag NON_STD_AXI

2021-06-29 Thread Yong Wu
This patch add a new flag NON_STD_AXI, All the previous SoC support this flag. this is a preparing patch for adding infra iommu and apu iommu which don't support this flag. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions

[PATCH 06/24] iommu/mediatek: Add a flag DCM_DISABLE

2021-06-29 Thread Yong Wu
In the infra iommu, we should disable DCM. add a new flag for this. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 78b35e187c78..a026e2ee4007 100644

[PATCH 02/24] dt-bindings: mediatek: mt8195: Add binding for infra IOMMU

2021-06-29 Thread Yong Wu
"of_iommu_configure_dev_id" only support the id number is 1, But our PCIe have two ports, one is for reading and the other is for writing. see more about the PCIe patch in this patchset. Thus, I only list the reading id here and add the other id in our driver. Signed-off-by: Yong Wu --- .../bindings/iomm

[PATCH 24/24] iommu/mediatek: mt8195: Enable multi-bank for infra iommu

2021-06-29 Thread Yong Wu
Enable the multi-bank functions for infra-iommu. We put PCIE in bank0 and USB in the last bank(bank4). and we don't use the other banks currently, disable them. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git

[PATCH 22/24] iommu/mediatek: Get the proper bankid for multi banks

2021-06-29 Thread Yong Wu
). Each a bank is a independent iommu domain/group. Currently we don't separate different iova ranges inside a bank. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 38 +++--- drivers/iommu/mtk_iommu.h | 1 + 2 files changed, 36 insertions(+), 3 deletions

[PATCH 19/24] iommu/mediatek: Initialise bank HW for each a bank

2021-06-29 Thread Yong Wu
the bank hw with the bankid. In the hw_init, we always initialise bank0's control register since we don't know if the bank0 is initialised. Additionally, About each bank's register base, always delta 0x1000. like bank[x + 1] = bank[x] + 0x1000. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c

[PATCH 18/24] iommu/mediatek: Add mtk_iommu_bank_data structure

2021-06-29 Thread Yong Wu
(independent pgtable), thus, also move the domain information and tlb_lock into it. In previous SoC, we have only one bank which could be treated as bank0( bankid always is 0 for the previous SoC). After adding this structure, the tlb operations and irq could use bank_data as unit. Signed-off-by: Yong Wu

[PATCH 16/24] iommu/mediatek: Only adjust code about register base

2021-06-29 Thread Yong Wu
This patch have no functional change. Use "base" instead of the data->base. This is avoid to touch too many lines in the next patches. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 43 --- 1 file changed, 22 insertions(+), 21 deletions(-

<    1   2   3   4   5   6   7   8   9   10   >