aboutsummaryrefslogtreecommitdiff
path: root/drivers/mfd/altera-sysmgr.c
AgeCommit message (Collapse)AuthorFilesLines
2024-02-23mfd: altera-sysmgr: Call of_node_put() only when of_parse_phandle() takes a refPeter Griffin1-1/+3
of_parse_phandle() returns a device_node with refcount incremented, which the callee needs to call of_node_put() on when done. We should only call of_node_put() when the property argument is provided though as otherwise nothing has taken a reference on the node. Fixes: f36e789a1f8d ("mfd: altera-sysmgr: Add SOCFPGA System Manager") Signed-off-by: Peter Griffin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
2023-08-18mfd: Explicitly include correct DT includesRob Herring1-2/+1
The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
2023-04-13mfd: altera-sysmgr: remove MODULE_LICENSE in non-modulesNick Alcock1-1/+0
Since commit 8b41fc4454e ("kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations are used to identify modules. As a consequence, uses of the macro in non-modules will cause modprobe to misidentify their containing object file as a module when it is not (false positives), and modprobe might succeed rather than failing with a suitable error message. So remove it in the files in this commit, none of which can be built as modules. Signed-off-by: Nick Alcock <[email protected]> Suggested-by: Luis Chamberlain <[email protected]> Cc: Luis Chamberlain <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Hitomi Hasegawa <[email protected]> Cc: Thor Thayer <[email protected]> Cc: Lee Jones <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
2021-11-05mfd: altera-sysmgr: Fix a mistake caused by resource_size conversionKai Song1-1/+1
The resource_size defines that: res->end - res->start + 1; The origin original code is: sysmgr_config.max_register = res->end - res->start - 3; So, the correct fix is that: sysmgr_config.max_register = resource_size(res) - 4; Fixes: d12edf9661a4 ("mfd: altera-sysmgr: Use resource_size function on resource object") Signed-off-by: Kai Song <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-02-08mfd: altera-sysmgr: Fix physical address storing moreArnd Bergmann1-1/+2
A recent fix improved the way the resource gets passed to the low-level accessors, but left one warning that appears in configurations with a resource_size_t that is wider than a pointer: In file included from drivers/mfd/altera-sysmgr.c:19: drivers/mfd/altera-sysmgr.c: In function 'sysmgr_probe': drivers/mfd/altera-sysmgr.c:148:40: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 148 | regmap = devm_regmap_init(dev, NULL, (void *)res->start, | ^ include/linux/regmap.h:646:6: note: in definition of macro '__regmap_lockdep_wrapper' 646 | fn(__VA_ARGS__, &_key, \ | ^~~~~~~~~~~ drivers/mfd/altera-sysmgr.c:148:12: note: in expansion of macro 'devm_regmap_init' 148 | regmap = devm_regmap_init(dev, NULL, (void *)res->start, | ^~~~~~~~~~~~~~~~ I had tried a different approach that would store the address in the private data as a phys_addr_t, but the easiest solution now seems to be to add a double cast to shut up the warning. As the address is passed to an inline assembly, it is guaranteed to not be wider than a register anyway. Fixes: d9ca7801b6e5 ("mfd: altera-sysmgr: Fix physical address storing hacks") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Lee Jones <[email protected]>
2020-11-27mfd: altera-sysmgr: Use resource_size function on resource objectZou Wei1-1/+1
drivers/mfd/altera-sysmgr.c:155:36-39: WARNING: Suspicious code. resource_size is maybe missing with res Generated by: scripts/coccinelle/api/resource_size.cocci Signed-off-by: Zou Wei <[email protected]> Signed-off-by: Lee Jones <[email protected]>
2020-07-06mfd: altera-sysmgr: Supply descriptions for 'np' and 'property' function argsLee Jones1-0/+3
Kerneldoc syntax is used, but not complete. Arg descriptions are required. Fixes the following W=1 build warnings: drivers/mfd/altera-sysmgr.c:95: warning: Function parameter or member 'np' not described in 'altr_sysmgr_regmap_lookup_by_phandle' drivers/mfd/altera-sysmgr.c:95: warning: Function parameter or member 'property' not described in 'altr_sysmgr_regmap_lookup_by_phandle' Cc: Thor Thayer <[email protected]> Signed-off-by: Lee Jones <[email protected]>
2020-07-06mfd: altera-sysmgr: Fix physical address storing hacksLee Jones1-10/+6
Sparse reports: drivers/mfd/altera-sysmgr.c:150:30: warning: incorrect type in assignment (different address spaces) drivers/mfd/altera-sysmgr.c:150:30: expected unsigned int [usertype] *base drivers/mfd/altera-sysmgr.c:150:30: got void [noderef] <asn:2> * drivers/mfd/altera-sysmgr.c:156:26: warning: incorrect type in argument 3 (different address spaces) drivers/mfd/altera-sysmgr.c:156:26: expected void [noderef] <asn:2> *regs drivers/mfd/altera-sysmgr.c:156:26: got unsigned int [usertype] *base It appears as though the driver data property 'resource_size_t *base' was being used to store 2 different types of addresses (physical and IO-mapped) under a single declared type. Fortunately, no value is recalled from the driver data entry, so it can be easily omitted. Instead we can use the value obtained directly from the platform resource to pass through Regmap into the call-backs to be used for the SMCC call and use a local dedicated __iomem variable for IO-remapping. Cc: Thor Thayer <[email protected]> Signed-off-by: Lee Jones <[email protected]>
2019-07-30drivers: Introduce device lookup variants by of_nodeSuzuki K Poulose1-12/+2
Introduce wrappers for {bus/driver/class}_find_device() to locate devices by its of_node. Cc: Maarten Lankhorst <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: [email protected] Cc: David Airlie <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: [email protected] Cc: Florian Fainelli <[email protected]> Cc: Frank Rowand <[email protected]> Cc: Heiko Stuebner <[email protected]> Cc: Liam Girdwood <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: Mathieu Poirier <[email protected]> Cc: Rob Herring <[email protected]> Cc: Srinivas Kandagatla <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: Alan Tull <[email protected]> Cc: [email protected] Cc: Peter Rosin <[email protected]> Cc: Florian Fainelli <[email protected]> Cc: Heiner Kallweit <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Liam Girdwood <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Thor Thayer <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Peter Rosin <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Acked-by: Lee Jones <[email protected]> Acked-by: Wolfram Sang <[email protected]> # I2C part Acked-by: Moritz Fischer <[email protected]> # For FPGA part Acked-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-06-24driver_find_device: Unify the match function with class_find_device()Suzuki K Poulose1-2/+2
The driver_find_device() accepts a match function pointer to filter the devices for lookup, similar to bus/class_find_device(). However, there is a minor difference in the prototype for the match parameter for driver_find_device() with the now unified version accepted by {bus/class}_find_device(), where it doesn't accept a "const" qualifier for the data argument. This prevents us from reusing the generic match functions for driver_find_device(). For this reason, change the prototype of the driver_find_device() to make the "match" parameter in line with {bus/class}_find_device() and adjust its callers to use the const qualifier. Also, we could now promote the "data" parameter to const as we pass it down as a const parameter to the match functions. Cc: Corey Minyard <[email protected]> Cc: Russell King <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Will Deacon <[email protected]> Cc: Joerg Roedel <[email protected]> Cc: Peter Oberparleiter <[email protected]> Cc: Sebastian Ott <[email protected]> Cc: David Airlie <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Nehal Shah <[email protected]> Cc: Shyam Sundar S K <[email protected]> Cc: Lee Jones <[email protected]> Cc: Christian Borntraeger <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-02mfd: altera-sysmgr: Add SOCFPGA System ManagerThor Thayer1-0/+211
The SOCFPGA System Manager register block aggregates different peripheral functions into one area. On 32 bit ARM parts, handle in the same way as syscon. On 64 bit ARM parts, the System Manager can only be accessed by EL3 secure mode. Since a SMC call to EL3 is required, this new driver uses regmaps similar to syscon to handle the SMC call. Since regmaps abstract out the underlying register access, the changes to drivers accessing the System Manager are minimal. Signed-off-by: Thor Thayer <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Signed-off-by: Lee Jones <[email protected]>