summaryrefslogtreecommitdiffstats
path: root/drivers/soc/fsl/guts.c
Commit message (Collapse)AuthorAgeFilesLines
* soc: fsl: guts: check return value after calling of_iomap() in ↵Yang Yingliang2022-07-051-0/+4
| | | | | | | | | | | fsl_guts_get_soc_uid() of_iomap() may return NULL, so we need check the return value. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Michael Walle <michael@walle.cc> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
* soc: fsl: guts: fix return value check in fsl_guts_init()Yang Yingliang2022-07-051-2/+2
| | | | | | | | | | | In case of error, of_iomap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test and return -ENOMEM as error value. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Michael Walle <michael@walle.cc> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
* soc: fsl: guts: add serial_number supportMichael Walle2022-06-271-2/+46
| | | | | | | | | | | | | | | | | | | Most layerscapes provide a security fuse processor where the vendor will store a unique id per part. Unfortunately, we cannot use the corresponding efuse driver because this driver needs to be ready early during the boot phase. To get the unique identifier, we just need to access two registers. Thus we just search the device tree for the corresponding device, map its memory to read the id and then unmap it again. Because it is likely that the offset within the fuses is dependent on the SoC, we need a per SoC data. Also, the compatible string is different among the SoCs. For now, this add support for the LS1028A SoC. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
* soc: fsl: guts: drop platform driverMichael Walle2022-06-271-63/+71
| | | | | | | | | | | This driver cannot be unloaded and it will be needed very early in the boot process because other driver (weakly) depend on it (eg. for chip errata handling). Drop all the platform driver and devres stuff and simply make it a core_initcall. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
* soc: fsl: guts: use of_root instead of own referenceMichael Walle2022-06-271-8/+4
| | | | | | | | | | There is already a global of_root reference. Use that instead of getting one on our own. We don't need to care about the reference count either this way. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
* soc: fsl: guts: allocate soc_dev_attr on the heapMichael Walle2022-06-271-19/+21
| | | | | | | | | This is the last global static variable. Drop it and allocate the memory on the heap instead. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
* soc: fsl: guts: embed fsl_guts_get_svr() in probe()Michael Walle2022-06-271-31/+11
| | | | | | | | | | | | Move the reading of the SVR into the probe function as fsl_guts_get_svr() is the only user of the static guts variable and this lets us drop that as well as the malloc() for this variable. Also, we can unmap the memory region after we accessed it, which will simplify error handling later. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
* soc: fsl: guts: remove module_exit() and fsl_guts_remove()Michael Walle2022-06-271-14/+1
| | | | | | | | | | This driver will never be unloaded. Firstly, it is not available as a module, but more importantly, other drivers will depend on this one to apply possible chip errata. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
* soc: fsl: guts: machine variable might be unsetMichael Walle2022-06-271-1/+1
| | | | | | | | | | If both the model and the compatible properties are missing, then machine will not be set. Initialize it with NULL. Fixes: 34c1c21e94ac ("soc: fsl: fix section mismatch build warnings") Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
* soc: fsl: guts: Add a missing memory allocation failure checkChristophe JAILLET2022-02-181-2/+7
| | | | | | | | | | | | | | If 'devm_kstrdup()' fails, we should return -ENOMEM. While at it, move the 'of_node_put()' call in the error handling path and after the 'machine' has been copied. Better safe than sorry. Fixes: a6fc3b698130 ("soc: fsl: add GUTS driver for QorIQ platforms") Depends-on: fddacc7ff4dd ("soc: fsl: guts: Revert commit 3c0d64e867ed") Suggested-by: Tyrel Datwyler <tyreld@linux.ibm.com> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* soc: fsl: guts: Revert commit 3c0d64e867edChristophe JAILLET2022-02-181-4/+3
| | | | | | | | | | | | This reverts commit 3c0d64e867ed ("soc: fsl: guts: reuse machine name from device tree"). A following patch will fix the missing memory allocation failure check instead. Suggested-by: Tyrel Datwyler <tyreld@linux.ibm.com> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* soc: fsl: guts: Make use of the helper function devm_platform_ioremap_resource()Cai Huoqing2021-10-211-3/+1
| | | | | | | | | Use the devm_platform_ioremap_resource() helper instead of calling platform_get_resource() and devm_ioremap_resource() separately Signed-off-by: Cai Huoqing <caihuoqing@baidu.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* soc: fsl: guts: remove unneeded semicolonYang Li2021-04-061-1/+1
| | | | | | | | | Eliminate the following coccicheck warning: ./drivers/soc/fsl/guts.c:120:2-3: Unneeded semicolon Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* soc: fsl: guts: Add definition for LS1028AYinbo Zhu2019-08-151-0/+6
| | | | | | | | Adding compatible string "ls1028a-dcfg" to initialize guts driver for ls1028 and SoC die attribute definition for LS1028A Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* Merge tag 'soc-fsl-next-v5.3' of ↵Olof Johansson2019-06-171-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/leo/linux into arm/drivers NXP/FSL SoC driver updates for v5.3 DPAA2 Console driver - Add driver to export two char devices to dump logs for MC and AIOP DPAA2 DPIO driver - Add support for memory backed QBMan portals - Increase the timeout period to prevent false error - Add APIs to retrieve QBMan portal probing status DPAA Qman driver - Only make liodn fixup on powerpc SoCs with PAMU iommu * tag 'soc-fsl-next-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/leo/linux: soc: fsl: qbman_portals: add APIs to retrieve the probing status soc: fsl: qman: fixup liodns only on ppc targets soc: fsl: dpio: Add support for memory backed QBMan portals bus: mc-bus: Add support for mapping shareable portals soc: fsl: dpio: Increase timeout for QBMan Management Commands soc: fsl: add DPAA2 console support Documentation: DT: Add entry for DPAA2 console soc: fsl: guts: Add definition for LX2160A Signed-off-by: Olof Johansson <olof@lixom.net>
| * soc: fsl: guts: Add definition for LX2160AVabhav Sharma2019-05-201-0/+6
| | | | | | | | | | | | | | | | | | | | Adding compatible string "lx2160a-dcfg" to initialize guts driver for lx2160 and SoC die attribute definition for LX2160A Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com> Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* | treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner2019-05-301-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 <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* soc: fsl: guts: make fsl_guts_get_svr() staticHoria Geantă2019-02-261-2/+1
| | | | | | | | | | The export of fsl_guts_get_svr() is a left-over, it's currently used only internally and users needing SoC information should use the generic soc_device infrastructure. Signed-off-by: Horia Geantă <horia.geanta@nxp.com> Acked-by: Yangbo Lu <yangbo.lu@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* soc: fsl: guts: reuse machine name from device treeLi Yang2019-01-111-3/+4
| | | | | | | | | | Reuse the string machine from the device tree data structure instead of duplicating the data again. This also prevents a potential memory allocation failure that was not handled previously. Also fixes an early put of root device node. Reported-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* soc: fsl: guts: Add a NULL check for devm_kasprintf()Fabio Estevam2018-01-221-0/+6
| | | | | | | | | devm_kasprintf() may fail, so we should better add a NULL check and propagate an error on failure. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Acked-by: Yangbo Lu <yangbo.lu@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* soc: fsl: support GUTS driver for ls1012a/ls1046ayangbo lu2017-12-081-0/+2
| | | | | | | | This patch is to add compatible strings "fsl,ls1021a-dcfg" and "fsl,ls1043a-dcfg" into device match table of GUTS driver. Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* soc/fsl/guts: Add compatible string for LS1088ashish kumar2017-09-221-0/+1
| | | | | | | | | Adding compatible string "ls1088a-dcfg" so that guts driver can be init for ls1088 Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com> Signed-off-by: Amrita Kumari <amrita.kumari@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
* soc: fsl: fix section mismatch build warningsSudeep Holla2016-11-291-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We get the following warning with the driver is compiled in: WARNING: modpost: Found 1 section mismatch(es). To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y' With CONFIG_DEBUG_SECTION_MISMATCH enabled, the details are reported: WARNING: vmlinux.o(.text+0x55d014): Section mismatch in reference from the function fsl_guts_probe() to the function .init.text:of_flat_dt_get_machine_name() The function fsl_guts_probe() references the function __init of_flat_dt_get_machine_name(). This is often because fsl_guts_probe lacks a __init annotation or the annotation of of_flat_dt_get_machine_name is wrong. This patch fixes the issue by using the normal DT/OF API rather than the of_flat_* one. Cc: Scott Wood <oss@buserror.net> Cc: Yangbo Lu <yangbo.lu@nxp.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
* soc: fsl: add GUTS driver for QorIQ platformsyangbo lu2016-11-291-0/+236
The global utilities block controls power management, I/O device enabling, power-onreset(POR) configuration monitoring, alternate function selection for multiplexed signals,and clock control. This patch adds a driver to manage and access global utilities block. Initially only reading SVR and registering soc device are supported. Other guts accesses, such as reading RCW, should eventually be moved into this driver as well. Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>