[PATCH v3 33/33] iommu/mediatek: mt8195: Enable multi banks for infra iommu

2021-09-23 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 v3 32/33] iommu/mediatek: Backup/restore regsiters for multi banks

2021-09-23 Thread Yong Wu
Each bank has some independent registers. thus backup/restore them for each a bank when suspend and resume. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 39 +++ drivers/iommu/mtk_iommu.h | 14 +++--- 2 files changed, 38 insertions(+), 15

[PATCH v3 31/33] iommu/mediatek: Initialise/Remove for multi bank dev

2021-09-23 Thread Yong Wu
it depend on if there is masters for that bank. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 44 +++ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 5d648f50cbe1..3925d1d4f

[PATCH v3 30/33] iommu/mediatek: Get the proper bankid for multi banks

2021-09-23 Thread Yong Wu
the IOMMU bank HW. Each a bank has the independent pgtable(4GB iova range). 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

[PATCH v3 29/33] iommu/mediatek: Change the domid to iova_region_id

2021-09-23 Thread Yong Wu
Prepare for adding bankid, also no functional change. In the previous SoC, each a iova_region is a domain; In the multi-banks case, each a bank is a domain, then the original function name "mtk_iommu_get_domain_id" is not proper. Use "iova_region_id" instead of "domain_

[PATCH v3 28/33] iommu/mediatek: Add bank_nr and bank_enable

2021-09-23 Thread Yong Wu
Prepare for supporting multi banks, Adds two variables in the plat_data: bank_nr: the bank number that this SoC support; bank_enable: list if the banks is enabled. Add them for all the current SoC, bank_nr always is 1 and only bank_enable[0] is enabled. Signed-off-by: Yong Wu --- drivers/iommu

[PATCH v3 27/33] iommu/mediatek: Initialise bank HW for each a bank

2021-09-23 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 v3 26/33] iommu/mediatek: Add mtk_iommu_bank_data structure

2021-09-23 Thread Yong Wu
information 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 parameter. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 137

[PATCH v3 25/33] iommu/mediatek: Just move code position in hw_init

2021-09-23 Thread Yong Wu
No functional change too, prepare for mt8195 IOMMU support bank functions. Some global control settings are in bank0 while the other banks have their bank independent setting. Here only move the global control settings and the independent registers together. Signed-off-by: Yong Wu --- drivers

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

2021-09-23 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 | 51 +-- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/

[PATCH v3 23/33] iommu/mediatek: Add mt8195 support

2021-09-23 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 v3 22/33] iommu/mediatek: Add PCIe support

2021-09-23 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 | 21 +

[PATCH v3 21/33] iommu/mediatek: Add infra iommu support

2021-09-23 Thread Yong Wu
-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 36 +--- drivers/iommu/mtk_iommu.h | 2 ++ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d103e4f33078..37d6dfb4feab 100644 --- a/drivers

[PATCH v3 20/33] iommu/mediatek: Allow IOMMU_DOMAIN_UNMANAGED for PCIe VFIO

2021-09-23 Thread Yong Wu
Allow the type IOMMU_DOMAIN_UNMANAGED since vfio_iommu_type1.c always call iommu_domain_alloc. The PCIe EP works ok when going through vfio. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b

[PATCH v3 19/33] iommu/mediatek: Add list_del in mtk_iommu_remove

2021-09-23 Thread Yong Wu
Lack the list_del in the mtk_iommu_remove, and remove bus_set_iommu(*, NULL) since there may be several iommu HWs. we can not bus_set_iommu null when one iommu driver unbind. This issue is not so important, No need fix tags. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 3 +-- 1 file

[PATCH v3 18/33] iommu/mediatek: Adjust device link when it is sub-common

2021-09-23 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 | 18 ++ 1 file

[PATCH v3 17/33] iommu/mediatek: Contain MM IOMMU flow with the MM TYPE

2021-09-23 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 | 193 +- 1 file changed, 109 insertions(+), 84 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 2665b0707f13.

[PATCH v3 16/33] iommu/mediatek: Add IOMMU_TYPE flag

2021-09-23 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 v3 15/33] iommu/mediatek: Add SUB_COMMON_3BITS flag

2021-09-23 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 v3 14/33] iommu/mediatek: Always enable output PA over 32bits in isr

2021-09-23 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 4a33b6c6b1db

[PATCH v3 13/33] iommu/mediatek: Remove the power status checking in tlb flush all

2021-09-23 Thread Yong Wu
alled frm pm_runtime_resume cb. From this point, we can not add this code above in this tlb_flush_all. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 20 +++- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iomm

[PATCH v3 12/33] iommu/mediatek: Always tlb_flush_all when each PM resume

2021-09-23 Thread Yong Wu
is enabled. thus no need fix tags here. Prepare for mt8195. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 44cf5547d084..e9e94944ed91 100644 --- a/drivers/iommu

[PATCH v3 11/33] iommu/mediatek: Remove the granule in the tlb flush

2021-09-23 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 ab484d20b441

[PATCH v3 10/33] iommu/mediatek: Add tlb_lock in tlb_flush_all

2021-09-23 Thread Yong Wu
The tlb_flush_all also touches the registers about tlb operations. Add spinlock in it to protect the tlb registers. since the tlb_range already hold the spinlock, move it a bit outside the spinlock to print log. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 25

[PATCH v3 09/33] iommu/mediatek: Remove for_each_m4u in tlb_sync_all

2021-09-23 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 6f4f6624e3ac..0b4c30baa864 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c

[PATCH v3 08/33] iommu/mediatek: Add a flag NON_STD_AXI

2021-09-23 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 v3 07/33] iommu/mediatek: Add a flag DCM_DISABLE

2021-09-23 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 00d9ae3dc88a..4e1b01fd58b0 100644

[PATCH v3 06/33] iommu/mediatek: Add 12G~16G support for multi domains

2021-09-23 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 ee10c56e8f96..00d9ae3dc88a 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/m

[PATCH v3 05/33] iommu/mediatek: Adapt sharing and non-sharing pgtable case

2021-09-23 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 v3 04/33] iommu/mediatek: Remove clk_disable in mtk_iommu_remove

2021-09-23 Thread Yong Wu
op_write_iter+0x164/0x1e0 Fixes: b34ea31fe013 ("iommu/mediatek: Always enable the clk on resume") Reported-by: Hsin-Yi Wang Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 3e8

[PATCH v3 03/33] iommu/mediatek: Fix 2 HW sharing pgtable issue

2021-09-23 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 v3 02/33] dt-bindings: mediatek: mt8195: Add binding for infra IOMMU

2021-09-23 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 v3 01/33] dt-bindings: mediatek: mt8195: Add binding for MM IOMMU

2021-09-23 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 v3 00/33] MT8195 IOMMU SUPPORT

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

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

2021-09-14 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 eeb4c70b3d5b..52b956fedfbc 100644

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

2021-09-14 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 v4 11/13] memory: mtk-smi: mt8195: Add initial setting for smi-common

2021-09-14 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 v4 10/13] memory: mtk-smi: mt8195: Add smi support

2021-09-14 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 v4 09/13] memory: mtk-smi: Use devm_platform_ioremap_resource

2021-09-14 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 v4 08/13] memory: mtk-smi: Add clocks for smi-sub-common

2021-09-14 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 v4 07/13] memory: mtk-smi: Add device link for smi-sub-common

2021-09-14 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 v4 06/13] memory: mtk-smi: Add error handle for smi_probe

2021-09-14 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 v4 05/13] memory: mtk-smi: Adjust some code position

2021-09-14 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 v4 04/13] memory: mtk-smi: Rename smi_gen to smi_type

2021-09-14 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 v4 03/13] memory: mtk-smi: Use clk_bulk clock ops

2021-09-14 Thread Yong Wu
Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 143 +++ 1 file changed, 55 insertions(+), 88 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index c5fb51f73b34..f91eaf5c3ab0 100644 --- a/drivers/memory/mtk-smi.c +++ b/driv

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

2021-09-14 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 --- change note: add "else mediatek,smi: false". --- .../mediatek,smi-common.yaml | 28 +++ 1 file changed, 28 insertions(+) diff --gi

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

2021-09-14 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 v4 00/13] MT8195 SMI support

2021-09-14 Thread Yong Wu
ap_resource b) Add error handle for smi_probe 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: Us

[PATCH v2 29/29] iommu/mediatek: mt8195: Enable multi banks for infra iommu

2021-08-13 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 v2 28/29] iommu/mediatek: Backup/restore regsiters for multi banks

2021-08-13 Thread Yong Wu
Each bank has some independent registers. thus backup/restore them for each a bank when suspend and resume. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 39 +++ drivers/iommu/mtk_iommu.h | 14 +++--- 2 files changed, 38 insertions(+), 15

[PATCH v2 27/29] iommu/mediatek: Initialise/Remove for multi bank dev

2021-08-13 Thread Yong Wu
it depend on if there is masters for some banks. thus, use a register to confirm this. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 51 +-- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iom

[PATCH v2 26/29] iommu/mediatek: Get the proper bankid for multi banks

2021-08-13 Thread Yong Wu
the IOMMU bank HW. Each a bank has the independent pgtable(4GB iova range). 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

[PATCH v2 25/29] iommu/mediatek: Change the domid to iova_region_id

2021-08-13 Thread Yong Wu
is patch only rename the domid to iova_region_id. 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.c index 5b9891b2be6c.

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

2021-08-13 Thread Yong Wu
Prepare for supporting multi banks, Adds two variables in the plat_data: bank_nr: the bank number that this SoC support; bank_enable: list if the banks is enabled. Add them for all the current SoC, bank_nr always is 1 and only bank_enable[0] is enabled. Signed-off-by: Yong Wu --- drivers/iommu

[PATCH v2 23/29] iommu/mediatek: Initialise bank HW for each a bank

2021-08-13 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 v2 22/29] iommu/mediatek: Add mtk_iommu_bank_data structure

2021-08-13 Thread Yong Wu
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 parameter. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 151

[PATCH v2 21/29] iommu/mediatek: Just move code position in hw_init

2021-08-13 Thread Yong Wu
No functional change too. mt8195 IOMMU support bank functions. some global control settings are in bank0. and the other banks have their bank independent setting. Here only move the global control settings and the independent registers together. Signed-off-by: Yong Wu --- drivers/iommu

[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

  1   2   3   4   5   6   7   8   9   10   >