aboutsummaryrefslogtreecommitdiff
path: root/drivers/soc/aspeed/aspeed-lpc-ctrl.c
AgeCommit message (Collapse)AuthorFilesLines
2023-10-13soc/aspeed: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Andrew Jeffery <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2022-02-08soc: aspeed: lpc-ctrl: Block error printing on probe defer casesJae Hyun Yoo1-4/+3
Add a checking code when it gets -EPROBE_DEFER while getting a clock resource. In this case, it doesn't need to print out an error message because the probing will be re-visited. Signed-off-by: Jae Hyun Yoo <[email protected]> Signed-off-by: Joel Stanley <[email protected]> Reviewed-by: Andrew Jeffery <[email protected]> Reviewed-by: Iwona Winiarska <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]' Signed-off-by: Arnd Bergmann <[email protected]>
2021-08-26soc: aspeed-lpc-ctrl: Fix clock cleanup in error pathYang Yingliang1-10/+10
Move syscon_regmap_lookup_by_compatible() above the devm_clk_get() to avoid missing clk_disable_unprepare(). Fixes: 2f9b25fa6682 ("soc: aspeed: Re-enable FWH2AHB on AST2600") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Yang Yingliang <[email protected]> Signed-off-by: Joel Stanley <[email protected]> Reviewed-by: Joel Stanley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]' Signed-off-by: Arnd Bergmann <[email protected]>
2021-08-19soc: aspeed: Re-enable FWH2AHB on AST2600Joel Stanley1-6/+23
Recent builds of the vendor u-boot tree disable features of the BMC that may allow unwanted access if not correctly configured. This includes the firmware hub to ahb bridge (FWH2AHB), which is used by this driver. The bit to "un-disable" it is in the SCU. Set it only when the ioctl is called and we are running on the ast2600, as to not open up the 'backdoor' unless there's userspace trying to use it. Fixes: deb50313ba83 ("soc: aspeed-lpc-ctrl: LPC to AHB mapping on ast2600") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2021-08-17soc: aspeed: lpc-ctrl: Fix boundary check for mmapIwona Winiarska1-1/+1
The check mixes pages (vm_pgoff) with bytes (vm_start, vm_end) on one side of the comparison, and uses resource address (rather than just the resource size) on the other side of the comparison. This can allow malicious userspace to easily bypass the boundary check and map pages that are located outside memory-region reserved by the driver. Fixes: 6c4e97678501 ("drivers/misc: Add Aspeed LPC control driver") Cc: [email protected] Signed-off-by: Iwona Winiarska <[email protected]> Reviewed-by: Andrew Jeffery <[email protected]> Tested-by: Andrew Jeffery <[email protected]> Reviewed-by: Joel Stanley <[email protected]> Signed-off-by: Joel Stanley <[email protected]>
2021-04-09soc: aspeed: Adapt to new LPC device tree layoutChia-Wei, Wang1-6/+14
Add check against LPC device v2 compatible string to ensure that the fixed device tree layout is adopted. The LPC register offsets are also fixed accordingly. Signed-off-by: Chia-Wei Wang <[email protected]> Reviewed-by: Andrew Jeffery <[email protected]> Reviewed-by: Joel Stanley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2020-09-25soc: aspeed-lpc-ctrl: Fix driver nameJoel Stanley1-1/+1
Clarify the string now that it supports the AST2600 too. Signed-off-by: Joel Stanley <[email protected]>
2020-09-25soc: aspeed-lpc-ctrl: Fix whitespaceJoel Stanley1-2/+2
Some misaligned indentation I noticed when applying another patch. Signed-off-by: Joel Stanley <[email protected]>
2020-09-25soc: aspeed-lpc-ctrl: LPC to AHB mapping on ast2600Joel Stanley1-0/+17
The ast2600 disables the mapping of AHB memory regions by default, only allowing the LPC window to point to SPI NOR. In order to point the window to any AHB address, an ast2600 specific bit must be toggled. Reviewed-by: Andrew Jeffery <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2020-09-25soc: aspeed-lpc-ctrl: Fail probe of lpc-ctrl if reserved memory is not alignedAndrew Jeffery1-0/+13
Alignment is a hardware constraint of the LPC2AHB bridge, and misaligned reserved memory will present as corrupted data. Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Joel Stanley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2020-09-25soc: aspeed: lpc: Add AST2600 compatible stringsBrad Bishop1-0/+1
The AST2600 has the same lpc-ctrl and lpc-snoop devices as the AST2500. Signed-off-by: Brad Bishop <[email protected]> Acked-by: Andrew Jeffery <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2019-06-25Merge tag 'aspeed-5.3-soc' of ↵Olof Johansson1-23/+38
git://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed into arm/drivers ASPEED SoC updates for 5.3 LPC control driver changes and a fix. * tag 'aspeed-5.3-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed: soc: aspeed: lpc-ctrl: Fix probe error handling soc: aspeed: lpc-ctrl: make parameter optional Signed-off-by: Olof Johansson <[email protected]>
2019-06-22soc: aspeed: lpc-ctrl: Fix probe error handlingJoel Stanley1-2/+3
gcc warns that a mising "flash" phandle node leads to undefined behavior later: drivers/soc/aspeed/aspeed-lpc-ctrl.c: In function 'aspeed_lpc_ctrl_probe': drivers/soc/aspeed/aspeed-lpc-ctrl.c:201:18: error: '*((void *)&resm+8)' may be used uninitialized in this function [-Werror=maybe-uninitialized] Only set the flash base and size if we find a phandle in the device tree. Reported-by: Arnd Bergmann <[email protected]> Reviewed-by: Andrew Jeffery <[email protected]> Reviewed-by: Vijay Khemka <[email protected]> Signed-off-by: Joel Stanley <[email protected]>
2019-06-17soc: aspeed: lpc-ctrl: make parameter optionalVijay Khemka1-22/+36
Making memory-region and flash as optional parameter in device tree if user needs to use these parameter through ioctl then need to define in devicetree. Signed-off-by: Vijay Khemka <[email protected]> Reviewed-by: Andrew Jeffery <[email protected]> Signed-off-by: Joel Stanley <[email protected]>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner1-5/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-29soc: add aspeed folder and misc driversPatrick Venture1-0/+300
Create a SoC folder for the ASPEED parts and place the misc drivers currently present into this folder. These drivers are not generic part drivers, but rather only apply to the ASPEED SoCs. Signed-off-by: Patrick Venture <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Olof Johansson <[email protected]>