Hi Anshuman,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/acpi-bus soc/for-next atorgue-stm32/stm32-next linus/master v6.6-rc7 next-20231027]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Anshuman-Khandual/coresight-replicator-Move-ACPI-support-from-AMBA-driver-to-platform-driver/20231027-153540
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/r/20231027072943.3418997-7-anshuman.khandual%40arm.com
patch subject: [PATCH 6/7] coresight: stm: Move ACPI support from AMBA driver to platform driver
config: arm-randconfig-003-20231028 (https://download.01.org/0day-ci/archive/20231028/202310282130.HCHZyX0e-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231028/202310282130.HCHZyX0e-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310282130.HCHZyX0e-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/hwtracing/coresight/coresight-stm.c:151: warning: Function parameter or member 'pclk' not described in 'stm_drvdata'
vim +151 drivers/hwtracing/coresight/coresight-stm.c
0f5f9b6ba9e1a7 Suzuki K Poulose 2019-06-19 115
237483aa5cf431 Pratik Patel 2016-05-03 116 /**
237483aa5cf431 Pratik Patel 2016-05-03 117 * struct stm_drvdata - specifics associated to an STM component
237483aa5cf431 Pratik Patel 2016-05-03 118 * @base: memory mapped base address for this component.
237483aa5cf431 Pratik Patel 2016-05-03 119 * @atclk: optional clock for the core parts of the STM.
237483aa5cf431 Pratik Patel 2016-05-03 120 * @csdev: component vitals needed by the framework.
237483aa5cf431 Pratik Patel 2016-05-03 121 * @spinlock: only one at a time pls.
237483aa5cf431 Pratik Patel 2016-05-03 122 * @chs: the channels accociated to this STM.
237483aa5cf431 Pratik Patel 2016-05-03 123 * @stm: structure associated to the generic STM interface.
9fa3682869d4e1 James Clark 2023-04-25 124 * @mode: this tracer's mode (enum cs_mode), i.e sysFS, or disabled.
237483aa5cf431 Pratik Patel 2016-05-03 125 * @traceid: value of the current ID for this component.
237483aa5cf431 Pratik Patel 2016-05-03 126 * @write_bytes: Maximus bytes this STM can write at a time.
237483aa5cf431 Pratik Patel 2016-05-03 127 * @stmsper: settings for register STMSPER.
237483aa5cf431 Pratik Patel 2016-05-03 128 * @stmspscr: settings for register STMSPSCR.
237483aa5cf431 Pratik Patel 2016-05-03 129 * @numsp: the total number of stimulus port support by this STM.
237483aa5cf431 Pratik Patel 2016-05-03 130 * @stmheer: settings for register STMHEER.
237483aa5cf431 Pratik Patel 2016-05-03 131 * @stmheter: settings for register STMHETER.
237483aa5cf431 Pratik Patel 2016-05-03 132 * @stmhebsr: settings for register STMHEBSR.
237483aa5cf431 Pratik Patel 2016-05-03 133 */
237483aa5cf431 Pratik Patel 2016-05-03 134 struct stm_drvdata {
237483aa5cf431 Pratik Patel 2016-05-03 135 void __iomem *base;
237483aa5cf431 Pratik Patel 2016-05-03 136 struct clk *atclk;
ec77ffb6c05951 Anshuman Khandual 2023-10-27 137 struct clk *pclk;
237483aa5cf431 Pratik Patel 2016-05-03 138 struct coresight_device *csdev;
237483aa5cf431 Pratik Patel 2016-05-03 139 spinlock_t spinlock;
237483aa5cf431 Pratik Patel 2016-05-03 140 struct channel_space chs;
237483aa5cf431 Pratik Patel 2016-05-03 141 struct stm_data stm;
237483aa5cf431 Pratik Patel 2016-05-03 142 local_t mode;
237483aa5cf431 Pratik Patel 2016-05-03 143 u8 traceid;
237483aa5cf431 Pratik Patel 2016-05-03 144 u32 write_bytes;
237483aa5cf431 Pratik Patel 2016-05-03 145 u32 stmsper;
237483aa5cf431 Pratik Patel 2016-05-03 146 u32 stmspscr;
237483aa5cf431 Pratik Patel 2016-05-03 147 u32 numsp;
237483aa5cf431 Pratik Patel 2016-05-03 148 u32 stmheer;
237483aa5cf431 Pratik Patel 2016-05-03 149 u32 stmheter;
237483aa5cf431 Pratik Patel 2016-05-03 150 u32 stmhebsr;
237483aa5cf431 Pratik Patel 2016-05-03 @151 };
237483aa5cf431 Pratik Patel 2016-05-03 152
@@ -22,7 +22,6 @@
static const struct acpi_device_id amba_id_list[] = {
{"ARMH0061", 0}, /* PL061 GPIO Device */
{"ARMH0330", 0}, /* ARM DMA Controller DMA-330 */
- {"ARMHC502", 0}, /* ARM CoreSight STM */
{"ARMHC503", 0}, /* ARM CoreSight Debug */
{"", 0},
};
@@ -29,6 +29,8 @@
#include <linux/perf_event.h>
#include <linux/pm_runtime.h>
#include <linux/stm.h>
+#include <linux/platform_device.h>
+#include <linux/acpi.h>
#include "coresight-priv.h"
#include "coresight-trace-id.h"
@@ -132,6 +134,7 @@ DEFINE_CORESIGHT_DEVLIST(stm_devs, "stm");
struct stm_drvdata {
void __iomem *base;
struct clk *atclk;
+ struct clk *pclk;
struct coresight_device *csdev;
spinlock_t spinlock;
struct channel_space chs;
@@ -804,14 +807,12 @@ static void stm_init_generic_data(struct stm_drvdata *drvdata,
drvdata->stm.set_options = stm_generic_set_options;
}
-static int stm_probe(struct amba_device *adev, const struct amba_id *id)
+static int __stm_probe(struct device *dev, struct resource *res, void *dev_caps)
{
int ret, trace_id;
void __iomem *base;
- struct device *dev = &adev->dev;
struct coresight_platform_data *pdata = NULL;
struct stm_drvdata *drvdata;
- struct resource *res = &adev->res;
struct resource ch_res;
struct coresight_desc desc = { 0 };
@@ -823,12 +824,16 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
if (!drvdata)
return -ENOMEM;
- drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */
+ drvdata->atclk = devm_clk_get(dev, "atclk"); /* optional */
if (!IS_ERR(drvdata->atclk)) {
ret = clk_prepare_enable(drvdata->atclk);
if (ret)
return ret;
}
+
+ drvdata->pclk = coresight_get_enable_apb_pclk(dev);
+ if (IS_ERR(drvdata->pclk))
+ return -ENODEV;
dev_set_drvdata(dev, drvdata);
base = devm_ioremap_resource(dev, res);
@@ -876,7 +881,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
ret = PTR_ERR(pdata);
goto stm_unregister;
}
- adev->dev.platform_data = pdata;
+ dev->platform_data = pdata;
desc.type = CORESIGHT_DEV_TYPE_SOURCE;
desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE;
@@ -897,10 +902,10 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
}
drvdata->traceid = (u8)trace_id;
- pm_runtime_put(&adev->dev);
+ pm_runtime_put(dev);
dev_info(&drvdata->csdev->dev, "%s initialized\n",
- (char *)coresight_get_uci_data(id));
+ (char *)dev_caps);
return 0;
cs_unregister:
@@ -911,9 +916,14 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
return ret;
}
-static void stm_remove(struct amba_device *adev)
+static int stm_probe(struct amba_device *adev, const struct amba_id *id)
+{
+ return __stm_probe(&adev->dev, &adev->res, coresight_get_uci_data(id));
+}
+
+static void __stm_remove(struct device *dev)
{
- struct stm_drvdata *drvdata = dev_get_drvdata(&adev->dev);
+ struct stm_drvdata *drvdata = dev_get_drvdata(dev);
coresight_trace_id_put_system_id(drvdata->traceid);
coresight_unregister(drvdata->csdev);
@@ -921,6 +931,11 @@ static void stm_remove(struct amba_device *adev)
stm_unregister_device(&drvdata->stm);
}
+static void stm_remove(struct amba_device *adev)
+{
+ __stm_remove(&adev->dev);
+}
+
#ifdef CONFIG_PM
static int stm_runtime_suspend(struct device *dev)
{
@@ -929,6 +944,8 @@ static int stm_runtime_suspend(struct device *dev)
if (drvdata && !IS_ERR(drvdata->atclk))
clk_disable_unprepare(drvdata->atclk);
+ if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk))
+ clk_disable_unprepare(drvdata->pclk);
return 0;
}
@@ -939,6 +956,8 @@ static int stm_runtime_resume(struct device *dev)
if (drvdata && !IS_ERR(drvdata->atclk))
clk_prepare_enable(drvdata->atclk);
+ if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk))
+ clk_prepare_enable(drvdata->pclk);
return 0;
}
#endif
@@ -969,6 +988,49 @@ static struct amba_driver stm_driver = {
module_amba_driver(stm_driver);
+static int stm_platform_probe(struct platform_device *pdev)
+{
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ int ret = 0;
+
+ pm_runtime_get_noresume(&pdev->dev);
+ pm_runtime_set_active(&pdev->dev);
+ pm_runtime_enable(&pdev->dev);
+
+ ret = __stm_probe(&pdev->dev, res, NULL);
+ if (ret) {
+ pm_runtime_put_noidle(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+ }
+ return ret;
+}
+
+static int stm_platform_remove(struct platform_device *pdev)
+{
+ __stm_remove(&pdev->dev);
+ return 0;
+}
+
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id stm_acpi_ids[] = {
+ {"ARMHC502", 0}, /* ARM CoreSight STM */
+ {},
+};
+MODULE_DEVICE_TABLE(acpi, stm_acpi_ids);
+#endif
+
+static struct platform_driver stm_platform_driver = {
+ .probe = stm_platform_probe,
+ .remove = stm_platform_remove,
+ .driver = {
+ .name = "coresight-stm-platform",
+ .acpi_match_table = ACPI_PTR(stm_acpi_ids),
+ .suppress_bind_attrs = true,
+ .pm = &stm_dev_pm_ops,
+ },
+};
+module_platform_driver(stm_platform_driver);
+
MODULE_AUTHOR("Pratik Patel <pratikp@codeaurora.org>");
MODULE_DESCRIPTION("Arm CoreSight System Trace Macrocell driver");
MODULE_LICENSE("GPL v2");