summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJae Hyun Yoo <jae.hyun.yoo@intel.com>2021-03-10 01:01:00 +0300
committerJae Hyun Yoo <jae.hyun.yoo@intel.com>2021-07-14 20:07:04 +0300
commit516055e6f8cf2093a34e3a5d5be7ac327661f11e (patch)
tree2fdb564ab3328ae2bdc2c555ca091ff50096f5d6
parentcd80200d3e60a62c1c3e16669e6cea1a5f887605 (diff)
downloadlinux-516055e6f8cf2093a34e3a5d5be7ac327661f11e.tar.xz
i3c: aspeed: fix a module probe error
Modified the Aspeed global driver as a platform driver instead of a postcore initialized one to make it get a reset control resource properly while probing the module. To make it probed ahead of bus modules, it also modifies the object order in makefile. Change-Id: Icefb06c1a4548417aa09f53da5cb2f61ba6f8d09 Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
-rw-r--r--drivers/i3c/master/Makefile2
-rw-r--r--drivers/i3c/master/aspeed-i3c-global.c25
2 files changed, 12 insertions, 15 deletions
diff --git a/drivers/i3c/master/Makefile b/drivers/i3c/master/Makefile
index 2dbfed073cb8..1fb766509ff2 100644
--- a/drivers/i3c/master/Makefile
+++ b/drivers/i3c/master/Makefile
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_ASPEED_I3C_MASTER) += aspeed-i3c-global.o
obj-$(CONFIG_CDNS_I3C_MASTER) += i3c-master-cdns.o
obj-$(CONFIG_DW_I3C_MASTER) += dw-i3c-master.o
-obj-$(CONFIG_ASPEED_I3C_MASTER) += aspeed-i3c-global.o
diff --git a/drivers/i3c/master/aspeed-i3c-global.c b/drivers/i3c/master/aspeed-i3c-global.c
index feb6c9361f24..93292ad6652d 100644
--- a/drivers/i3c/master/aspeed-i3c-global.c
+++ b/drivers/i3c/master/aspeed-i3c-global.c
@@ -41,28 +41,28 @@ struct aspeed_i3c_global {
struct reset_control *rst;
};
-static const struct of_device_id aspeed_i3c_of_match[] = {
+static const struct of_device_id aspeed_i3c_global_of_table[] = {
{ .compatible = "aspeed,ast2600-i3c-global", },
{},
};
+MODULE_DEVICE_TABLE(of, aspeed_i3c_global_of_table);
static int aspeed_i3c_global_probe(struct platform_device *pdev)
{
struct aspeed_i3c_global *i3c_global;
- struct device_node *node = pdev->dev.of_node;
union i3c_set_reg reg;
int i, ret;
u32 num_of_i3cs;
- i3c_global = kzalloc(sizeof(*i3c_global), GFP_KERNEL);
+ i3c_global = devm_kzalloc(&pdev->dev, sizeof(*i3c_global), GFP_KERNEL);
if (!i3c_global)
return -ENOMEM;
- i3c_global->base = of_iomap(node, 0);
- if (!i3c_global->base)
- return -ENOMEM;
+ i3c_global->base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(i3c_global->base))
+ return PTR_ERR(i3c_global->base);
- i3c_global->rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);
+ i3c_global->rst = devm_reset_control_get(&pdev->dev, NULL);
if (IS_ERR(i3c_global->rst)) {
dev_err(&pdev->dev,
"missing or invalid reset controller device tree entry");
@@ -87,6 +87,8 @@ static int aspeed_i3c_global_probe(struct platform_device *pdev)
for (i = 0; i < num_of_i3cs; i++)
writel(reg.value, i3c_global->base + ASPEED_I3CG_SET(i));
+ dev_info(&pdev->dev, "i3c global control registered\n");
+
return 0;
}
@@ -94,15 +96,10 @@ static struct platform_driver aspeed_i3c_driver = {
.probe = aspeed_i3c_global_probe,
.driver = {
.name = KBUILD_MODNAME,
- .of_match_table = aspeed_i3c_of_match,
+ .of_match_table = of_match_ptr(aspeed_i3c_global_of_table),
},
};
-
-static int __init aspeed_i3c_global_init(void)
-{
- return platform_driver_register(&aspeed_i3c_driver);
-}
-postcore_initcall(aspeed_i3c_global_init);
+module_platform_driver(aspeed_i3c_driver);
MODULE_AUTHOR("Ryan Chen");
MODULE_DESCRIPTION("ASPEED I3C Global Driver");