From: Arnd Bergmann <arnd@arndb.de>
To: Alexander Shiyan <shc_work@mail.ru>
Cc: Dong Aisheng <dong.aisheng@linaro.org>,
linux-kernel@vger.kernel.org,
Samuel Ortiz <sameo@linux.intel.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: Re[10]: [PATCH v3] mfd: syscon: Add non-DT support
Date: Wed, 20 Feb 2013 15:00:18 +0000 [thread overview]
Message-ID: <201302201500.18803.arnd@arndb.de> (raw)
In-Reply-To: <1361364471.967042408@f233.mail.ru>
On Wednesday 20 February 2013, Alexander Shiyan wrote:
> OK. I can convert platform to DT, no so easy, but possible.
> But I will use syscon as way to using DT (and MULTIPLATFORM in the future),
> this mean that I should completely drop ATAG support from this platform
> (since I cannot use syscon device without DT support, but several platform devices
> need to use system-wide registers).
> Arnd, if its OK for you, I will use this way. (I talking about CLPS711X, you know it :) ).
Ah, I should have realized that this is about clps711x when the patch
is coming from you ;-)
This is an existing platform, and I would not require you to move it to
devicetree just for supporting syscon, although it may be a good idea
to make that move in the long run.
For clps711x, we know that there is only one syscon register set, so you
could do a very simple patch like below. Basically we don't need to
treat the absence of DT information as an error, and a call to
syscon_regmap_lookup_by_compatible or syscon_regmap_lookup_by_phandle
will always return the syscon device that was registered first, or
-EPROBE_DEFER for any error.
Arnd
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 3f10591..d3c06c6 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -59,9 +59,6 @@ struct regmap *syscon_regmap_lookup_by_compatible(const char *s)
struct regmap *regmap;
syscon_np = of_find_compatible_node(NULL, NULL, s);
- if (!syscon_np)
- return ERR_PTR(-ENODEV);
-
regmap = syscon_node_to_regmap(syscon_np);
of_node_put(syscon_np);
@@ -76,9 +73,6 @@ struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np,
struct regmap *regmap;
syscon_np = of_parse_phandle(np, property, 0);
- if (!syscon_np)
- return ERR_PTR(-ENODEV);
-
regmap = syscon_node_to_regmap(syscon_np);
of_node_put(syscon_np);
@@ -100,26 +94,22 @@ static struct regmap_config syscon_regmap_config = {
static int syscon_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- struct device_node *np = dev->of_node;
struct syscon *syscon;
- struct resource res;
+ struct resource *res;
int ret;
- if (!np)
- return -ENOENT;
-
syscon = devm_kzalloc(dev, sizeof(struct syscon),
GFP_KERNEL);
if (!syscon)
return -ENOMEM;
- syscon->base = of_iomap(np, 0);
- if (!syscon->base)
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
return -EADDRNOTAVAIL;
- ret = of_address_to_resource(np, 0, &res);
- if (ret)
- return ret;
+ syscon->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+ if (!syscon->base)
+ return -ENOMEM;
syscon_regmap_config.max_register = res.end - res.start - 3;
syscon->regmap = devm_regmap_init_mmio(dev, syscon->base,
next prev parent reply other threads:[~2013-02-20 15:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-18 14:42 [PATCH v3] mfd: syscon: Add non-DT support Alexander Shiyan
2013-02-18 16:02 ` Arnd Bergmann
2013-02-19 5:52 ` Dong Aisheng
2013-02-19 7:03 ` Re[2]: " Alexander Shiyan
2013-02-19 7:55 ` Dong Aisheng
2013-02-19 8:02 ` Dong Aisheng
2013-02-19 8:56 ` Re[4]: " Alexander Shiyan
2013-02-19 9:58 ` Dong Aisheng
2013-02-19 10:54 ` Re[6]: " Alexander Shiyan
2013-02-20 5:20 ` Dong Aisheng
2013-02-20 5:41 ` Re[8]: " Alexander Shiyan
2013-02-20 6:01 ` Dong Aisheng
2013-02-20 10:06 ` Arnd Bergmann
2013-02-20 11:05 ` Dong Aisheng
2013-02-20 11:14 ` Arnd Bergmann
2013-02-20 11:28 ` Dong Aisheng
2013-02-20 12:16 ` Arnd Bergmann
2013-02-20 12:47 ` Re[10]: " Alexander Shiyan
2013-02-20 15:00 ` Arnd Bergmann [this message]
2013-02-20 16:06 ` Re[12]: " Alexander Shiyan
2013-02-20 17:16 ` Arnd Bergmann
2013-02-20 17:27 ` Re[14]: " Alexander Shiyan
2013-02-20 21:27 ` Arnd Bergmann
2013-02-21 15:27 ` Re[16]: " Alexander Shiyan
2013-02-19 10:49 ` Re[2]: " Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201302201500.18803.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dong.aisheng@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=shc_work@mail.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox