summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/ti-abb-regulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/ti-abb-regulator.c')
-rw-r--r--drivers/regulator/ti-abb-regulator.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
index 86d2d80b4b..04133510e5 100644
--- a/drivers/regulator/ti-abb-regulator.c
+++ b/drivers/regulator/ti-abb-regulator.c
@@ -14,7 +14,6 @@
#include <linux/err.h>
#include <linux/io.h>
#include <linux/module.h>
-#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
@@ -688,7 +687,6 @@ MODULE_DEVICE_TABLE(of, ti_abb_of_match);
static int ti_abb_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- const struct of_device_id *match;
struct resource *res;
struct ti_abb *abb;
struct regulator_init_data *initdata = NULL;
@@ -699,21 +697,15 @@ static int ti_abb_probe(struct platform_device *pdev)
char *pname;
int ret = 0;
- match = of_match_device(ti_abb_of_match, dev);
- if (!match) {
- /* We do not expect this to happen */
- dev_err(dev, "%s: Unable to match device\n", __func__);
- return -ENODEV;
- }
- if (!match->data) {
- dev_err(dev, "%s: Bad data in match\n", __func__);
- return -EINVAL;
- }
-
abb = devm_kzalloc(dev, sizeof(struct ti_abb), GFP_KERNEL);
if (!abb)
return -ENOMEM;
- abb->regs = match->data;
+
+ abb->regs = device_get_match_data(dev);
+ if (!abb->regs) {
+ dev_err(dev, "%s: Bad data in match\n", __func__);
+ return -EINVAL;
+ }
/* Map ABB resources */
if (abb->regs->setup_off || abb->regs->control_off) {
@@ -734,9 +726,25 @@ static int ti_abb_probe(struct platform_device *pdev)
return PTR_ERR(abb->setup_reg);
}
- abb->int_base = devm_platform_ioremap_resource_byname(pdev, "int-address");
- if (IS_ERR(abb->int_base))
- return PTR_ERR(abb->int_base);
+ pname = "int-address";
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname);
+ if (!res) {
+ dev_err(dev, "Missing '%s' IO resource\n", pname);
+ return -ENODEV;
+ }
+ /*
+ * The MPU interrupt status register (PRM_IRQSTATUS_MPU) is
+ * shared between regulator-abb-{ivahd,dspeve,gpu} driver
+ * instances. Therefore use devm_ioremap() rather than
+ * devm_platform_ioremap_resource_byname() to avoid busy
+ * resource region conflicts.
+ */
+ abb->int_base = devm_ioremap(dev, res->start,
+ resource_size(res));
+ if (!abb->int_base) {
+ dev_err(dev, "Unable to map '%s'\n", pname);
+ return -ENOMEM;
+ }
/* Map Optional resources */
pname = "efuse-address";
@@ -866,7 +874,7 @@ static struct platform_driver ti_abb_driver = {
.driver = {
.name = "ti_abb",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
- .of_match_table = of_match_ptr(ti_abb_of_match),
+ .of_match_table = ti_abb_of_match,
},
};
module_platform_driver(ti_abb_driver);