[ 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>
[ 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>
[ 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>
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)
[ 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>
[ 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>
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)
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
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)
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)
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)
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)
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)
[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>
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>
[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>
[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>
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)
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>
[ 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>
[ 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>
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>
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
...