265 Commits

Author SHA1 Message Date
Vaisakh Murali
d47f134534 drivers: memory: Conditionally compile SMI debug
Signed-off-by: Vaisakh Murali <mvaisakh@statixos.com>
Signed-off-by: LinkBoi00 <linkdevel@protonmail.com>
2025-09-03 18:13:50 +00:00
SamarV-121
824eaaf5e1 Merge branch 'android-4.14-stable' of https://android.googlesource.com/kernel/common into lineage-20
Change-Id: Iccdace15866873e0dc67ca6b876201b96b245f19
2022-11-03 14:44:57 +05:30
Liang He
a4f7eb8385 memory: of: Fix refcount leak bug in of_get_ddr_timings()
[ Upstream commit 05215fb32010d4afb68fbdbb4d237df6e2d4567b ]

We should add the of_node_put() when breaking out of
for_each_child_of_node() as it will automatically increase
and decrease the refcount.

Fixes: e6b42eb6a6 ("memory: emif: add device tree support to emif driver")
Signed-off-by: Liang He <windhl@126.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220719085640.1210583-1-windhl@126.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-10-26 13:17:02 +02:00
SamarV-121
86024a79cc Merge branch 'android-4.14-stable' of https://android.googlesource.com/kernel/common into lineage-19.1
Change-Id: I927eeeebbad4008bede5fec67ae92bc3c49acf3d
2022-04-28 21:02:36 +05:30
Miaoqian Lin
0b9cafcabd memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
[ Upstream commit 6f296a9665ba5ac68937bf11f96214eb9de81baa ]

The device_node pointer is returned by of_parse_phandle() with refcount
incremented. We should use of_node_put() on it when done.

Fixes: 87108dc78e ("memory: atmel-ebi: Enable the SMC clock if specified")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20220309110144.22412-1-linmq006@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-20 09:08:31 +02:00
Jia-Ju Bai
c4733b0a25 memory: emif: check the pointer temp in get_device_details()
[ Upstream commit 5b5ab1bfa1898c6d52936a57c25c5ceba2cb2f87 ]

The pointer temp is allocated by devm_kzalloc(), so it should be
checked for error handling.

Fixes: 7ec944538d ("memory: emif: add basic infrastructure for EMIF driver")
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20220225132552.27894-1-baijiaju1990@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-20 09:08:15 +02:00
Jiasheng Jiang
54eee30e4f memory: emif: Add check for setup_interrupts
[ Upstream commit fd7bd80b46373887b390852f490f21b07e209498 ]

As the potential failure of the devm_request_threaded_irq(),
it should be better to check the return value of the
setup_interrupts() and return error if fails.

Fixes: 68b4aee35d ("memory: emif: add interrupt and temperature handling")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220224025444.3256530-1-jiasheng@iscas.ac.cn
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-20 09:08:15 +02:00
SamarV-121
2a336c668c Merge branch 'android-4.14-stable' of https://android.googlesource.com/kernel/common into lineage-19.0
Signed-off-by: SamarV-121 <samarvispute121@pm.me>
Change-Id: I26530a14b3cf6acfacd310d46d1e45b03ecaeff9
2022-01-03 23:21:18 +05:30
Pranaya Deomani
215d9a1b66 drivers: Import oplus changes
Change-Id: I656544fa0ed802622ce7f40d50063a7bcf48c914
Signed-off-by: Pranaya Deomani <pranayadeomani@protonmail.com>
2021-12-25 17:59:56 +05:30
Dongliang Mu
eeda1315a3 memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probe
[ Upstream commit 4ed2f3545c2e5acfbccd7f85fea5b1a82e9862d7 ]

The error handling code of fsl_ifc_ctrl_probe is problematic. When
fsl_ifc_ctrl_init fails or request_irq of fsl_ifc_ctrl_dev->irq fails,
it forgets to free the irq and nand_irq. Meanwhile, if request_irq of
fsl_ifc_ctrl_dev->nand_irq fails, it will still free nand_irq even if
the request_irq is not successful.

Fix this by refactoring the error handling code.

Fixes: d2ae2e20fb ("driver/memory:Move Freescale IFC driver to a common driver")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Link: https://lore.kernel.org/r/20210925151434.8170-1-mudongliangabcd@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-26 11:40:33 +01:00
Krzysztof Kozlowski
7626ffbea7 memory: fsl_ifc: fix leak of private memory on probe failure
[ Upstream commit 8e0d09b1232d0538066c40ed4c13086faccbdff6 ]

On probe error the driver should free the memory allocated for private
structure.  Fix this by using resource-managed allocation.

Fixes: a20cbdeffc ("powerpc/fsl: Add support for Integrated Flash Controller")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210527154322.81253-2-krzysztof.kozlowski@canonical.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-20 16:17:55 +02:00
Krzysztof Kozlowski
6b3b002de9 memory: fsl_ifc: fix leak of IO mapping on probe failure
[ Upstream commit 3b132ab67fc7a358fff35e808fa65d4bea452521 ]

On probe error the driver should unmap the IO memory.  Smatch reports:

  drivers/memory/fsl_ifc.c:298 fsl_ifc_ctrl_probe() warn: 'fsl_ifc_ctrl_dev->gregs' not released on lines: 298.

Fixes: a20cbdeffc ("powerpc/fsl: Add support for Integrated Flash Controller")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210527154322.81253-1-krzysztof.kozlowski@canonical.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-20 16:17:55 +02:00
Krzysztof Kozlowski
b8867ff3b1 memory: atmel-ebi: add missing of_node_put for loop iteration
[ Upstream commit 907c5bbb514a4676160e79764522fff56ce3448e ]

Early exits from for_each_available_child_of_node() should decrement the
node reference counter.  Reported by Coccinelle:

  drivers/memory/atmel-ebi.c:593:1-33: WARNING:
    Function "for_each_available_child_of_node" should have of_node_put() before return around line 604.

Fixes: 6a4ec4cd08 ("memory: add Atmel EBI (External Bus Interface) driver")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210423101815.119341-2-krzysztof.kozlowski@canonical.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-20 16:17:54 +02:00
Colin Ian King
a8a31682e3 memory: gpmc: fix out of bounds read and dereference on gpmc_cs[]
[ Upstream commit e004c3e67b6459c99285b18366a71af467d869f5 ]

Currently the array gpmc_cs is indexed by cs before it cs is range checked
and the pointer read from this out-of-index read is dereferenced. Fix this
by performing the range check on cs before the read and the following
pointer dereference.

Addresses-Coverity: ("Negative array index read")
Fixes: 9ed7a776eb ("ARM: OMAP2+: Fix support for multiple devices on a GPMC chip select")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20210223193821.17232-1-colin.king@canonical.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-22 10:57:26 +02:00
mtk21827
601a990867 [ALPS05439186] memory: check null pointer
Check null pointer before kfree().

MTK-Commit-Id: 7b0654dc1779569310857449ae8bef9781552578

Change-Id: Icaaf39cf4cb2accbe0b09c7fdd5d3b377ca306d8
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05439186
Feature: External Memory Interface(emi)
2020-12-01 11:47:47 +08:00
mtk21827
dabe55cb70 [ALPS05434742] memory: Fix a bug of addr2dram
The addr2dram function needs to check the integrity of the input
address.  If the address is over the maximal DRAM size, it should
return failure directly.

The input address is given from the CPUs point of view(1GB register
offset + DRAM offset). On checking out-of-DRAM-max-size, the input
address should be adjusted (-1GB offset) first.

This patch fixes a software bug. Adjust the input address before
compare it with the maximal DRAM size.

MTK-Commit-Id: 7ae63384c6022419184d550141a318d760391858

Change-Id: I92cdff6748ab3dec71d662bac9478dce41e59a3e
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05434742
Feature: External Memory Interface(emi)
2020-11-18 10:16:11 +08:00
Dan Carpenter
4637a4bde9 memory: emif: Remove bogus debugfs error handling
[ Upstream commit fd22781648080cc400772b3c68aa6b059d2d5420 ]

Callers are generally not supposed to check the return values from
debugfs functions.  Debugfs functions never return NULL so this error
handling will never trigger.  (Historically debugfs functions used to
return a mix of NULL and error pointers but it was eventually deemed too
complicated for something which wasn't intended to be used in normal
situations).

Delete all the error handling.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
Link: https://lore.kernel.org/r/20200826113759.GF393664@mwanda
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-11-05 11:06:57 +01:00
Krzysztof Kozlowski
8db94d7945 memory: fsl-corenet-cf: Fix handling of platform_get_irq() error
[ Upstream commit dd85345abca60a8916617e8d75c0f9ce334336dd ]

platform_get_irq() returns -ERRNO on error.  In such case comparison
to 0 would pass the check.

Fixes: 54afbec0d5 ("memory: Freescale CoreNet Coherency Fabric error reporting driver")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200827073315.29351-1-krzk@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-29 09:07:13 +01:00
Dan Carpenter
9bff692ae2 memory: omap-gpmc: Fix a couple off by ones
[ Upstream commit 4c54228ac8fd55044195825873c50a524131fa53 ]

These comparisons should be >= instead of > to prevent reading one
element beyond the end of the gpmc_cs[] array.

Fixes: cdd6928c58 ("ARM: OMAP2+: Add device-tree support for NOR flash")
Fixes: f37e4580c4 ("ARM: OMAP2: Dynamic allocator for GPMC memory space")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Link: https://lore.kernel.org/r/20200825104707.GB278587@mwanda
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-29 09:07:13 +01:00
mtk21827
75bd7b6b99 [ALPS05377669] memory: config emimpu sysfs(eng)
Only allow eng load built in emimpu sysfs.

MTK-Commit-Id: d43a97a0d48e41ba361ea94cd9f392ca2a179c58

Change-Id: I37e409faee83bf480e9b6d15be46d18737d81611
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05377669
Feature: External Memory Interface(emi)
2020-10-20 16:08:57 +08:00
mtk21827
922bc04b2b [ALPS05328717] memory: enable EMI MPU AP region
Enable EMI MPU AP region after other region owners to
setting their region permission.

MTK-Commit-Id: 63d0a8d42f50ff04fc400df2f544cef2727ba30a

Change-Id: I60186d22c6a7753749a7d4dffcbfdb984b23bb94
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05328717
Feature: External Memory Interface(emi)
2020-10-07 16:33:43 +08:00
mtk20497
dd2361d1bb [ALPS05340604] DRAM:modify dram driver for DDR400.fix f meters calculate
modify dram driver for DDR400.fix f meters calculate

MTK-Commit-Id: 437bf94112fda16d4dd6015cbe95bdee2ff4e386

Change-Id: Ie3ff51da6f36bf1b43a42b1c94b185c7c18fe21c
Signed-off-by: jay dong <jay.dong@mediatek.com>
CR-Id: ALPS05340604
Feature: DRAM
2020-09-14 12:22:33 +08:00
mtk21827
6a924704b7 [ALPS05328717] memory: disable EMI AP MPU
Disable EMI AP MPU for other region owners to
setting their region permission.

MTK-Commit-Id: 262e546287bf30da1ba405e109a4a46627f6aa62

Change-Id: Iff4bc2fcf63b393fcb40410fc4ca1cc2d4d29f2f
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05328717
Feature: External Memory Interface(emi)
(cherry picked from commit fb9afe2f9171369202f85511d30449c19b486546)
2020-09-14 12:20:08 +08:00
mtk21827
96a2c5c936 [ALPS05313102] memory: fix callback bypass rule
Add flag to check if process need to do aee dump.

MTK-Commit-Id: 4072cb23b3881e5b2d946794fc322405db8f7782

Change-Id: I5167d450e1e10828c03f29cc49515d2c9fa1e803
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05313102
Feature: External Memory Interface(emi)
2020-08-28 00:02:13 +08:00
mtk21827
2a4521f02a [ALPS05241110] memory: Fix memcpy cause crash
Use assign function pointer directly
instead of memcpy to fix device carsh.

mtk_emimpu_register_callback+0x50/0x120
tmem_mpu_vio_init+0x18/0x4c
do_one_initcall+0x238/0xd44
kernel_init_freeable+0x2f0/0x438
kernel_init+0x10/0x378

MTK-Commit-Id: 3b8310fd4c3f6666d3ca9ee5aef73dd6a2c5a9c1

Change-Id: I5954b793fdcc523f5752301b8c707adfb6c14515
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05241110
Feature: External Memory Interface(emi)
2020-08-14 22:52:07 +08:00
mtk21827
72318a5f6e [ALPS05258267] memory: mediatek: fix use of test_bit() in EMI addr2dram
KASAN found a problem in emi-cen.c.
        vmlinux  test_bit() + 4676
        <include/asm-generic/bitops/non-atomic.h:106>

        vmlinux  prepare_a2d() + 5276
        <drivers/memory/mediatek/emicen.c:146>

        vmlinux  emicen_probe(pdev=0xFFFFFFC1B1C08900) + 7416
        <drivers/memory/mediatek/emicen.c:675>

The problem is caused by passing a parameter of type unsigned int to
test_bit(). But test_bit() expects a parameter of type unsigned long.

This patch fixed the problem by using variables of type usngiend long.

MTK-Commit-Id: d44e7a54e6c648ec25f17d73fe83f97911c0365c

Change-Id: I6921673adeb4a49d0c810ce9cf712c4c1e36fa5b
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05258267
Feature: External Memory Interface(emi)
2020-08-14 22:51:44 +08:00
mtk21827
8626bf2364 [ALPS05241110] memory: add mpu callback list
Purpose: Provide a common callback register function for
other users to debug when mpu violation.

MTK-Commit-Id: 1ee51e035ee21c33fa6f5620667280df6c96d696

Change-Id: I52f465d46735e871c596d8d73dfb57b407f2d4b9
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05241110
Feature: External Memory Interface(emi)
2020-08-14 22:51:44 +08:00
mtk21827
d5f460fcfc [ALPS05258267] memory: mediatek: add mtk_emicen_addr2dram
Background:
    DRAM devices uses rank/bank/row/column addresses to locate data.
    EMI has multiple channels connecting to multiple DRAM devices.
    When accessing DRAM, the given linear address needed to be translated
    into rank/bank/row/column addresses. This translation is done by EMI
    according to settings of hardware reigsters: emi_cona/f/h/k (which are
    programmed based on the using DRAM device).

For debugging a DRAM issue (such as a DRAM bit-flip issue), the linear
address at which the issue was seen needs to be translated (to address
from DRAM point of view) to idenfiy the EMI channel number and DRAM
rank/bank numbers. This can help narrow down the issue to the exact
hardware component.

This patch adds a new function mtk_emicen_addr2dram() and export it for
translating an input address to addresses from DRAM point of view. For
compatibility, create new properties (hash value, dispatch value, version)
of the emicen device node since hash/dispatch values differ from platform
to platform and there is a new formula of translation for LPDDR5.

MTK-Commit-Id: 48d786cefe23d950e04ab1c535863bda4d9b466d

Change-Id: I7e9a8975fb56ce6e102bff2b1dfe27648d9e1bbe
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05258267
Feature: External Memory Interface(emi)
2020-08-14 22:46:42 +08:00
Scott Wang
908ab8961c [ALPS04877382] ion/iommu/smi: support mt8168
[Detail]
support mt8168 ion/iommu/smi
Test: build ok

MTK-Commit-Id: ded5548261cdaf9889ffd89911745f60573e1915

Change-Id: I4b799afbc5ba6631b6a17bb3ee6f462f52c5e1d5
CR-Id: ALPS04877382
Feature: [Module]ION/M4U
Signed-off-by: Scott Wang <scott.wang@mediatek.com>
2020-06-19 14:55:52 +08:00
Juju Sung
06960d0abf [ALPS05014853] memory: emi undefined symbol error
[Detail]
error: undefined symbol:
emimpu_read_protection
mtk_emimpu_init_region..
This patch merge lost from q to r.

MTK-Commit-Id: 0b2bd448fdfe8d54af8db3cd9abb01bbb20e5854

Change-Id: I51b409ca5a8478c51138810642614c717ba1745d
Signed-off-by: Juju Sung <juju.sung@mediatek.com>
CR-Id: ALPS05014853
Feature: [Module]Kernel Maintenance
2020-04-09 10:02:19 +08:00
Ming-Fan Chen
74af1e0b4a [ALPS04762481] smi: fix coverity issues for mt6771
Fix smi coverity issues for mt6771: Uninitialized scalar variable

MTK-Commit-Id: 7d3297118cd5318e963bdffddd57ae13dc9ee062

Change-Id: I439bedcbc675d12041d7fd7e6a8ce5162ea9b550
CR-Id: ALPS04762481
Feature: [Module]SMI Driver
Signed-off-by: Ming-Fan Chen <ming-fan.chen@mediatek.com>
2020-03-03 04:10:13 +08:00
Ming-Fan Chen
0f92e1868a [ALPS04694084] smi: support multiple commons for mt6885
1. Support multiple smi-commons for mt6885.
2. Update public functions used by m4u for mt6885.
3. Build mmdvfs for mt6885.

MTK-Commit-Id: ac5c3f35b90f6d56948112ba317b62d35dd1f869

Change-Id: I9ebf253d28f9a7e1937e345820e75fab4c6fa614
CR-Id: ALPS04694084
Feature: [Module]SMI Driver
Signed-off-by: Ming-Fan Chen <ming-fan.chen@mediatek.com>
2020-03-03 04:05:47 +08:00
Scott Wang
f4da105f79 [ALPS04589945] smi: add pm_runtime_get_sync for disp
[Detail]
In mtk_smi_commmon_probe, the disp power domain would be turn off
if there is not pm_runtime_get_sync(dev) after pm_runtime_enable(dev).
Meanwhile disp hw are still access register,
this would cause system abnormal.

MTK-Commit-Id: 2e5ea74c24a94c0f73bd5e15032b8df4ba2e57fc

Change-Id: I118af57696f9e9d38a7396ca375d6ccac12ff1d3
CR-Id: ALPS04589945
Feature: [Module]SMI Driver
Signed-off-by: Scott Wang <scott.wang@mediatek.com>
2020-03-03 04:05:46 +08:00
Scott Wang
f3f57c61e4 [ALPS04589945] ION/IOMMU/SMI: support mt8167
[Detail]
support mt8167 ion/iommu/smi
Test: build ok

MTK-Commit-Id: 0f1c0bd35f151883e900fc5d9f83efcf743b38f7

Change-Id: Ibbe828f3b2356ff81d61d95c7ba3a25d3da952c8
CR-Id: ALPS04589945
Feature: [Module]ION/M4U
Signed-off-by: Scott Wang <scott.wang@mediatek.com>
2020-03-03 04:05:35 +08:00
Anan.Sun
41ab7ec8f2 [ALPS04617024] smi: debug: fix out of bounds read issue
fix out-of-bounds read issue for larbid in smi_debug_set
Test: ok

MTK-Commit-Id: 0cfb81e238b7c719f3b3fd422626673fc5eaa0e2

Change-Id: Ie55d4adef63792f86b9a2ef163956dc02aa25aca
Signed-off-by: Anan.Sun <anan.sun@mediatek.com>
CR-Id: ALPS04617024
Feature: [Module]SMI Driver
(cherry picked from commit 5d4906210c77bf519a551f6a7f67e12c4918bf2c)
2020-03-03 04:04:10 +08:00
chienwei.chang
a4027bcdf8 [ALPS04648971] [Do NOT Sync]Merge branch android-4.14-q into alps-trunk-q0.basic
[Detail]
	Parent: 817de622e8
		Merge 4.14.121 into android-4.14-q
	Start: 0585d8f153
		Enable CONFIG_ION_SYSTEM_HEAP
	Target: 9e4f3e0a04
		Merge 4.14.123 into android-4.14-q

MTK-Commit-Id: ad1acb4c349e30a7b5c5daaf333ee8c5f0f5a257

Feature: Others
Change-Id: If00705a9825c6992d2c11e0e1deccd6225000aef
CR-Id: ALPS04648971
Signed-off-by: Breeze.Li <breeze.li@mediatek.com>
2020-03-03 04:04:06 +08:00
Ming-Fan Chen
2b2b737a49 [ALPS04292155] SMI: mt6739 driver porting
[Detail] mt6739 smi driver porting
Need SMI_EXT

MTK-Commit-Id: fcfbb2b52dd9d63bac25c33e627568612ca3a5fb

Change-Id: Ic2ec011ac0c5dfa86649521ac3df4c1214bbebf3
CR-Id: ALPS04292155
Feature: [Module]SMI Driver
Signed-off-by: Ming-Fan Chen <ming-fan.chen@mediatek.com>
2020-03-03 02:06:37 +08:00
Anan.Sun
32f0fceb7c [ALPS04242658] memory: mtk-smi: add smi larb regs for debug
add smi larb regs:
	+0x00c (sleep)
	+0x0c8 (ext ongoing)
  for 8168 debug print

Test: build ok

MTK-Commit-Id: 73168dc599b98f5ed231e9c55388f758457f8a81

Change-Id: If2582e635f570abb2783bde34a24c68694d841d5
Signed-off-by: Anan.Sun <anan.sun@mediatek.com>
CR-Id: ALPS04242658
Feature: [Module]SMI Driver
(cherry-pick from d7e2a26b01492803f4b54a2c0dc2915965d25d84)
2020-03-03 02:05:33 +08:00
Ming-Fan Chen
965298239b [ALPS04084556] SMI: migrate mt6779 new functions
[Detail] migrate mt6779 new functions
1. MMP and MTCMOS record functions
2. DRAM init and dump functions
3. PMQoS update functions

MTK-Commit-Id: 15ec00f91aa728e9a6637e6da33abf334bf72135

Change-Id: Ide184ae8081c4c90c4771b22a44ed6538acbc889
CR-Id: ALPS04084556
Feature: [Module]SMI Driver
Signed-off-by: Ming-Fan Chen <ming-fan.chen@mediatek.com>
(cherry-pick from 6f488721fd051ceff58056f17a9c38ca31719bb6)
2020-03-03 02:03:29 +08:00
Yong Wu
010aa519b3 [ALPS04117440] memory: mtk-smi: Add smi debug for mt8168
Add smi-debug

MTK-Commit-Id: e5a3fa15171c98aef8ddabafce68af20f91a592f

Change-Id: I755230ce078396a1d8d6b44b7bd506b544da8676
CR-Id: ALPS04117440
Feature: [Module]SMI Driver
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
(cherry-pick from 318ad8879ad1a23539490e20b2e25a4c57245ba0)
2020-03-03 02:02:51 +08:00
Yong Wu
8dd523ba4c [ALPS04117440] memory: mtk-smi: Get rid of mtk_smi_larb_get/put
After the commit <xxx> ("memory: mtk-smi: Invoke pm runtime_callback
to enable clocks"),  we can get rid of mtk_smi_larb_get/put,
Use the standard pm_runtime_sync_get/put instead.

MTK-Commit-Id: 7d481ad606fb4a50b9f3359d4da71895a5a6da6d

Change-Id: I47870e7397d52cf0ea262000f3a84d8f8764ac1f
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Feature: [Module]SMI Driver
CR-Id: ALPS04117440
(cherry-pick from eeb9227dc5f1f4e7cc93a029ffd3d907b723fca1)
2020-03-03 02:02:13 +08:00
Ming-Fan Chen
f0cbf43a82 [ALPS04084556] SMI: fix build error for 32bit
[Detail] fix build error for 32bit project

MTK-Commit-Id: cda9e44b6d15a6765d4f2cc2efce5fc16f7236b7

Change-Id: Ia9d3d055b3e5fe428ac23178781c8d12adcd2a3b
CR-Id: ALPS04084556
Feature: [Module]SMI Driver
Signed-off-by: Ming-Fan Chen <ming-fan.chen@mediatek.com>
(cherry-pick from 72cb39d408a4a3c2836fe5e3823c899f84c12bfa)
2020-03-03 02:00:05 +08:00
Ming-Fan Chen
8ca1ade7ca [ALPS04084556] SMI: add SMI driver for mt6771
[Detail] add SMI driver for mt6771

MTK-Commit-Id: 8bd6f8e1aa2d9a5684e00808fa56df822f5849ad

Change-Id: Id220c48380f6997a5c66c28eae623f236e785e1e
CR-Id: ALPS04084556
Feature: [Module]SMI Driver
Signed-off-by: Ming-Fan Chen <ming-fan.chen@mediatek.com>
(cherry-pick from 2059fb3f11c6c2e7bed31703a51616d44dec66be)
2020-03-03 01:59:22 +08:00
Yong Wu
265ac6ec66 [ALPS04117440] iommu/mediatek: Add iommu support for mt8168
IOMMU/SMI support for mt8168

MTK-Commit-Id: 6802234a76dbdb37391290fd1f4e6f6b0c3ac0db

Change-Id: I8ed214c6e2909ed742d5d1058d3a0c3acd59d471
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
CR-Id: ALPS04117440
Feature: [Module]SMI Driver
(cherry-pick from 797cd3af03025f9d51e36cadafe907e1592bf99b)
2020-03-03 00:37:05 +08:00
season chen
5e0579f23f [ALPS04079775] Platform: Kernel-4.14 Migration
[Detail] Code merged from yocto

MTK-Commit-Id: 4d1482911601922594964945fb3b831a66b762ae

Change-Id: I89df40172a12826b990d4899a227edae1ee9647e
CR-Id: ALPS04079775
Feature: [Module]Kernel Maintenance
Signed-off-by: season chen <season.chen@mediatek.com>
(cherry-pick from 1a3ac023e6ba213a6f43e5ec432763b77579ee63)
2020-03-03 00:22:54 +08:00
Dmitry Osipenko
a36b2d6ae6 memory: tegra: Fix integer overflow on tick value calculation
commit b906c056b6023c390f18347169071193fda57dde upstream.

Multiplying the Memory Controller clock rate by the tick count results
in an integer overflow and in result the truncated tick value is being
programmed into hardware, such that the GR3D memory client performance is
reduced by two times.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-25 18:25:25 +02:00
Dmitry Osipenko
503f22cf7b memory: tegra: Apply interrupts mask per SoC
[ Upstream commit 1c74d5c0de0c2cc29fef97a19251da2ad6f579bd ]

Currently we are enabling handling of interrupts specific to Tegra124+
which happen to overlap with previous generations. Let's specify
interrupts mask per SoC generation for consistency and in a preparation
of squashing of Tegra20 driver into the common one that will enable
handling of GART faults which may be undesirable by newer generations.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-03 07:50:38 +02:00
Dmitry Osipenko
9746d3696d memory: tegra: Do not handle spurious interrupts
[ Upstream commit bf3fbdfbec947cdd04b2f2c4bce11534c8786eee ]

The ISR reads interrupts-enable mask, but doesn't utilize it. Apply the
mask to the interrupt status and don't handle interrupts that MC driver
haven't asked for. Kernel would disable spurious MC IRQ and report the
error. This would happen only in a case of a very severe bug.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-03 07:50:38 +02:00
Greg Kroah-Hartman
b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Linus Torvalds
ae46654bcf Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver updates from Olof Johansson:
 "This branch contains platform-related driver updates for ARM and ARM64.

  Among them:

   - Reset driver updates:
     + New API for dealing with arrays of resets
     + Make unimplemented {de,}assert return success on shared resets
     + MSDKv1 driver
     + Removal of obsolete Gemini reset driver
     + Misc updates for sunxi and Uniphier

   - SoC drivers:
     + Platform SoC driver registration on Tegra
     + Shuffle of Qualcomm drivers into a submenu
     + Allwinner A64 support for SRAM
     + Renesas R-Car R3 support
     + Power domains for Rockchip RK3366

   - Misc updates and smaller fixes for TEE and memory driver
     subsystems"

* tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (54 commits)
  firmware: arm_scpi: fix endianness of dev_id in struct dev_pstate_set
  soc/tegra: fuse: Add missing semi-colon
  soc/tegra: Restrict SoC device registration to Tegra
  drivers: soc: sunxi: add support for A64 and its SRAM C
  drivers: soc: sunxi: add support for remapping func value to reg value
  drivers: soc: sunxi: fix error processing on base address when claiming
  dt-bindings: add binding for Allwinner A64 SRAM controller and SRAM C
  bus: sunxi-rsb: Enable by default for ARM64
  soc/tegra: Register SoC device
  firmware: tegra: set drvdata earlier
  memory: Convert to using %pOF instead of full_name
  soc: Convert to using %pOF instead of full_name
  bus: Convert to using %pOF instead of full_name
  firmware: Convert to using %pOF instead of full_name
  soc: mediatek: add SCPSYS power domain driver for MediaTek MT7622 SoC
  soc: mediatek: add header files required for MT7622 SCPSYS dt-binding
  soc: mediatek: reduce code duplication of scpsys_probe across all SoCs
  dt-bindings: soc: update the binding document for SCPSYS on MediaTek MT7622 SoC
  reset: uniphier: add analog amplifiers reset control
  reset: uniphier: add video input subsystem reset control
  ...
2017-09-10 20:40:00 -07:00