* [PATCH 1/7] Revert "syscon: Decrease driver registration priority"
@ 2016-07-14 6:10 Andrey Smirnov
2016-07-14 6:11 ` [PATCH 2/7] mfd: syscon: Don't call request_iomem_region() Andrey Smirnov
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: Andrey Smirnov @ 2016-07-14 6:10 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Fixing the i.MX6 specific issue this way breaks things on CLPS711x
target. Better fix for the problem is to follow this patch.
This reverts commit c203958f3bbf25fc3d612497057b962e96ad1c52.
Reported-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/mfd/syscon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index ee62da0..9589a03 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -111,7 +111,7 @@ static int __init syscon_init(void)
{
return platform_driver_register(&syscon_driver);
}
-device_initcall(syscon_init);
+core_initcall(syscon_init);
MODULE_AUTHOR("Dong Aisheng <dong.aisheng@linaro.org>");
MODULE_DESCRIPTION("System Control driver");
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/7] mfd: syscon: Don't call request_iomem_region()
2016-07-14 6:10 [PATCH 1/7] Revert "syscon: Decrease driver registration priority" Andrey Smirnov
@ 2016-07-14 6:11 ` Andrey Smirnov
2016-07-15 5:53 ` Sascha Hauer
2016-07-14 6:11 ` [PATCH 3/7] mfd: syscon: Decouple syscon interface from platform devices Andrey Smirnov
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Andrey Smirnov @ 2016-07-14 6:11 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
On platforms that mix dedicated IP block register space with
miscellaneous registers it is necessary to share register window between
syscon and dedicated IP block driver. Calling request_iomem_region()
implies exclusive ownership of the region, which, in the case above
could not happen.
This change also makes this driver's behaviour to that of its Linux
kernel counterpart.
Suggested-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/mfd/syscon.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 9589a03..ac46122 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -76,12 +76,6 @@ static int syscon_probe(struct device_d *dev)
return PTR_ERR(res);
}
- res = request_iomem_region(dev_name(dev), res->start, res->end);
- if (IS_ERR(res)) {
- free(syscon);
- return PTR_ERR(res);
- }
-
syscon->base = (void __iomem *)res->start;
dev->priv = syscon;
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/7] mfd: syscon: Decouple syscon interface from platform devices
2016-07-14 6:10 [PATCH 1/7] Revert "syscon: Decrease driver registration priority" Andrey Smirnov
2016-07-14 6:11 ` [PATCH 2/7] mfd: syscon: Don't call request_iomem_region() Andrey Smirnov
@ 2016-07-14 6:11 ` Andrey Smirnov
2016-07-15 5:59 ` Sascha Hauer
2016-07-14 6:11 ` [PATCH 4/7] mfd: syscon: Don't check xzalloc return for NULL Andrey Smirnov
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Andrey Smirnov @ 2016-07-14 6:11 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Follow Linux Kernel change introduced in
bdb0066df96e74a4002125467ebe459feff1ebef and avoid device/driver model
for DT-based platforms. See the original kernel commit for the rationale.
Also make syscon_base_lookup_by_pdevname() behave the same way as its
kernel counterpart in the case whern "property" argument is NULL.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/mfd/syscon.c | 79 ++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 61 insertions(+), 18 deletions(-)
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index ac46122..5fd22dd 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -17,15 +17,68 @@
#include <driver.h>
#include <malloc.h>
#include <xfuncs.h>
-
+#include <of_address.h>
#include <linux/err.h>
#include <mfd/syscon.h>
+static LIST_HEAD(syscon_list);
+
struct syscon {
+ struct device_node *np;
void __iomem *base;
+ struct list_head list;
};
+static struct syscon *of_syscon_register(struct device_node *np)
+{
+ int ret;
+ struct syscon *syscon;
+ struct resource res;
+
+ if (!of_device_is_compatible(np, "syscon"))
+ return ERR_PTR(-EINVAL);
+
+ syscon = xzalloc(sizeof(*syscon));
+
+ if (of_address_to_resource(np, 0, &res)) {
+ ret = -ENOMEM;
+ goto err_map;
+ }
+
+ syscon->base = IOMEM(res.start);
+ syscon->np = np;
+
+ list_add_tail(&syscon->list, &syscon_list);
+
+ return syscon;
+
+err_map:
+ kfree(syscon);
+ return ERR_PTR(ret);
+}
+
+void __iomem *syscon_node_to_base(struct device_node *np)
+{
+ struct syscon *entry, *syscon = NULL;
+
+ list_for_each_entry(entry, &syscon_list, list)
+ if (entry->np == np) {
+ syscon = entry;
+ break;
+ }
+
+ if (!syscon)
+ syscon = of_syscon_register(np);
+
+ if (IS_ERR(syscon))
+ return ERR_CAST(syscon);
+
+ return syscon->base;
+}
+EXPORT_SYMBOL_GPL(syscon_node_to_regmap);
+
+
void __iomem *syscon_base_lookup_by_pdevname(const char *s)
{
struct syscon *syscon;
@@ -44,21 +97,17 @@ void __iomem *syscon_base_lookup_by_pdevname(const char *s)
void __iomem *syscon_base_lookup_by_phandle(struct device_node *np,
const char *property)
{
- struct device_node *node;
- struct syscon *syscon;
- struct device_d *dev;
+ struct device_node *syscon_np;
- node = of_parse_phandle(np, property, 0);
- if (!node)
- return ERR_PTR(-ENODEV);
+ if (property)
+ syscon_np = of_parse_phandle(np, property, 0);
+ else
+ syscon_np = np;
- dev = of_find_device_by_node(node);
- if (!dev)
+ if (!syscon_np)
return ERR_PTR(-ENODEV);
- syscon = dev->priv;
-
- return syscon->base;
+ return syscon_node_to_base(syscon_np);
}
static int syscon_probe(struct device_d *dev)
@@ -89,16 +138,10 @@ static struct platform_device_id syscon_ids[] = {
{ }
};
-static struct of_device_id of_syscon_match[] = {
- { .compatible = "syscon" },
- { },
-};
-
static struct driver_d syscon_driver = {
.name = "syscon",
.probe = syscon_probe,
.id_table = syscon_ids,
- .of_compatible = DRV_OF_COMPAT(of_syscon_match),
};
static int __init syscon_init(void)
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/7] mfd: syscon: Don't check xzalloc return for NULL
2016-07-14 6:10 [PATCH 1/7] Revert "syscon: Decrease driver registration priority" Andrey Smirnov
2016-07-14 6:11 ` [PATCH 2/7] mfd: syscon: Don't call request_iomem_region() Andrey Smirnov
2016-07-14 6:11 ` [PATCH 3/7] mfd: syscon: Decouple syscon interface from platform devices Andrey Smirnov
@ 2016-07-14 6:11 ` Andrey Smirnov
2016-07-14 6:11 ` [PATCH 5/7] mfd: syscon: Use IOMEM instead of explicit cast Andrey Smirnov
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Andrey Smirnov @ 2016-07-14 6:11 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Xzalloc never returns NULL, so this check does not bring any value.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/mfd/syscon.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 5fd22dd..9b873fe 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -116,8 +116,6 @@ static int syscon_probe(struct device_d *dev)
struct resource *res;
syscon = xzalloc(sizeof(struct syscon));
- if (!syscon)
- return -ENOMEM;
res = dev_get_resource(dev, IORESOURCE_MEM, 0);
if (IS_ERR(res)) {
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 5/7] mfd: syscon: Use IOMEM instead of explicit cast
2016-07-14 6:10 [PATCH 1/7] Revert "syscon: Decrease driver registration priority" Andrey Smirnov
` (2 preceding siblings ...)
2016-07-14 6:11 ` [PATCH 4/7] mfd: syscon: Don't check xzalloc return for NULL Andrey Smirnov
@ 2016-07-14 6:11 ` Andrey Smirnov
2016-07-14 6:11 ` [PATCH 6/7] imx_thermal: Remove leftover debug output Andrey Smirnov
2016-07-14 6:11 ` [PATCH 7/7] i.MX: ocotp: Register regmap against orignal device Andrey Smirnov
5 siblings, 0 replies; 12+ messages in thread
From: Andrey Smirnov @ 2016-07-14 6:11 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/mfd/syscon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 9b873fe..fb9a2c6 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -123,7 +123,7 @@ static int syscon_probe(struct device_d *dev)
return PTR_ERR(res);
}
- syscon->base = (void __iomem *)res->start;
+ syscon->base = IOMEM(res->start);
dev->priv = syscon;
dev_dbg(dev, "map 0x%x-0x%x registered\n", res->start, res->end);
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 6/7] imx_thermal: Remove leftover debug output
2016-07-14 6:10 [PATCH 1/7] Revert "syscon: Decrease driver registration priority" Andrey Smirnov
` (3 preceding siblings ...)
2016-07-14 6:11 ` [PATCH 5/7] mfd: syscon: Use IOMEM instead of explicit cast Andrey Smirnov
@ 2016-07-14 6:11 ` Andrey Smirnov
2016-07-14 6:11 ` [PATCH 7/7] i.MX: ocotp: Register regmap against orignal device Andrey Smirnov
5 siblings, 0 replies; 12+ messages in thread
From: Andrey Smirnov @ 2016-07-14 6:11 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/aiodev/imx_thermal.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/aiodev/imx_thermal.c b/drivers/aiodev/imx_thermal.c
index 08532a7..f8b59c2 100644
--- a/drivers/aiodev/imx_thermal.c
+++ b/drivers/aiodev/imx_thermal.c
@@ -133,8 +133,6 @@ static int imx_thermal_probe(struct device_d *dev)
return -ENODEV;
}
- printf("node = %p\n", node);
-
ocotp = cdev_by_device_node(node);
if (!ocotp) {
dev_err(dev, "No OCOTP character device\n");
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 7/7] i.MX: ocotp: Register regmap against orignal device
2016-07-14 6:10 [PATCH 1/7] Revert "syscon: Decrease driver registration priority" Andrey Smirnov
` (4 preceding siblings ...)
2016-07-14 6:11 ` [PATCH 6/7] imx_thermal: Remove leftover debug output Andrey Smirnov
@ 2016-07-14 6:11 ` Andrey Smirnov
5 siblings, 0 replies; 12+ messages in thread
From: Andrey Smirnov @ 2016-07-14 6:11 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov, Trent Piepho
Register regmap against orignal device passed to probe, this way further
in the code/call-chain cdev's device_node will be correctly populated
and it will be discoverable via cdev_by_device_node()
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
Sascha, Trent, why do you guys keep hiding that OCOTP chardev from my
imx_thermal driver? :-D
arch/arm/mach-imx/ocotp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/ocotp.c b/arch/arm/mach-imx/ocotp.c
index 1dc9108..17b944b 100644
--- a/arch/arm/mach-imx/ocotp.c
+++ b/arch/arm/mach-imx/ocotp.c
@@ -404,7 +404,7 @@ static int imx_ocotp_probe(struct device_d *dev)
priv->map_config.reg_stride = 4;
priv->map_config.max_register = data->num_regs - 1;
- priv->map = regmap_init(&priv->dev, &imx_ocotp_regmap_bus, priv, &priv->map_config);
+ priv->map = regmap_init(dev, &imx_ocotp_regmap_bus, priv, &priv->map_config);
if (IS_ERR(priv->map))
return PTR_ERR(priv->map);
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/7] mfd: syscon: Don't call request_iomem_region()
2016-07-14 6:11 ` [PATCH 2/7] mfd: syscon: Don't call request_iomem_region() Andrey Smirnov
@ 2016-07-15 5:53 ` Sascha Hauer
2016-07-15 9:11 ` Re[2]: " Alexander Shiyan
0 siblings, 1 reply; 12+ messages in thread
From: Sascha Hauer @ 2016-07-15 5:53 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: Andrey Smirnov, barebox
Alexander,
Applying 1/7 and this one should make clps711x work again, right?
Sascha
On Wed, Jul 13, 2016 at 11:11:00PM -0700, Andrey Smirnov wrote:
> On platforms that mix dedicated IP block register space with
> miscellaneous registers it is necessary to share register window between
> syscon and dedicated IP block driver. Calling request_iomem_region()
> implies exclusive ownership of the region, which, in the case above
> could not happen.
>
> This change also makes this driver's behaviour to that of its Linux
> kernel counterpart.
>
> Suggested-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> drivers/mfd/syscon.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
> index 9589a03..ac46122 100644
> --- a/drivers/mfd/syscon.c
> +++ b/drivers/mfd/syscon.c
> @@ -76,12 +76,6 @@ static int syscon_probe(struct device_d *dev)
> return PTR_ERR(res);
> }
>
> - res = request_iomem_region(dev_name(dev), res->start, res->end);
> - if (IS_ERR(res)) {
> - free(syscon);
> - return PTR_ERR(res);
> - }
> -
> syscon->base = (void __iomem *)res->start;
> dev->priv = syscon;
>
> --
> 2.5.5
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/7] mfd: syscon: Decouple syscon interface from platform devices
2016-07-14 6:11 ` [PATCH 3/7] mfd: syscon: Decouple syscon interface from platform devices Andrey Smirnov
@ 2016-07-15 5:59 ` Sascha Hauer
2016-07-15 21:50 ` Andrey Smirnov
0 siblings, 1 reply; 12+ messages in thread
From: Sascha Hauer @ 2016-07-15 5:59 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: barebox
On Wed, Jul 13, 2016 at 11:11:01PM -0700, Andrey Smirnov wrote:
> Follow Linux Kernel change introduced in
> bdb0066df96e74a4002125467ebe459feff1ebef and avoid device/driver model
> for DT-based platforms. See the original kernel commit for the rationale.
>
> Also make syscon_base_lookup_by_pdevname() behave the same way as its
> kernel counterpart in the case whern "property" argument is NULL.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> drivers/mfd/syscon.c | 79 ++++++++++++++++++++++++++++++++++++++++------------
> 1 file changed, 61 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
> index ac46122..5fd22dd 100644
> --- a/drivers/mfd/syscon.c
> +++ b/drivers/mfd/syscon.c
> @@ -17,15 +17,68 @@
> #include <driver.h>
> #include <malloc.h>
> #include <xfuncs.h>
> -
> +#include <of_address.h>
> #include <linux/err.h>
>
> #include <mfd/syscon.h>
>
> +static LIST_HEAD(syscon_list);
> +
> struct syscon {
> + struct device_node *np;
> void __iomem *base;
> + struct list_head list;
> };
>
> +static struct syscon *of_syscon_register(struct device_node *np)
> +{
> + int ret;
> + struct syscon *syscon;
> + struct resource res;
> +
> + if (!of_device_is_compatible(np, "syscon"))
> + return ERR_PTR(-EINVAL);
> +
> + syscon = xzalloc(sizeof(*syscon));
> +
> + if (of_address_to_resource(np, 0, &res)) {
> + ret = -ENOMEM;
> + goto err_map;
> + }
> +
> + syscon->base = IOMEM(res.start);
> + syscon->np = np;
> +
> + list_add_tail(&syscon->list, &syscon_list);
> +
> + return syscon;
> +
> +err_map:
> + kfree(syscon);
> + return ERR_PTR(ret);
> +}
> +
> +void __iomem *syscon_node_to_base(struct device_node *np)
This should either be static or the prototype added to include/
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re[2]: [PATCH 2/7] mfd: syscon: Don't call request_iomem_region()
2016-07-15 5:53 ` Sascha Hauer
@ 2016-07-15 9:11 ` Alexander Shiyan
0 siblings, 0 replies; 12+ messages in thread
From: Alexander Shiyan @ 2016-07-15 9:11 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Andrey Smirnov, barebox
>Пятница, 15 июля 2016, 8:53 +03:00 от Sascha Hauer <s.hauer@pengutronix.de>:
>
>Alexander,
>
>Applying 1/7 and this one should make clps711x work again, right?
Yes, with first patch this works for me.
---
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/7] mfd: syscon: Decouple syscon interface from platform devices
2016-07-15 5:59 ` Sascha Hauer
@ 2016-07-15 21:50 ` Andrey Smirnov
2016-07-18 6:18 ` Sascha Hauer
0 siblings, 1 reply; 12+ messages in thread
From: Andrey Smirnov @ 2016-07-15 21:50 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On Thu, Jul 14, 2016 at 10:59 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Wed, Jul 13, 2016 at 11:11:01PM -0700, Andrey Smirnov wrote:
>> Follow Linux Kernel change introduced in
>> bdb0066df96e74a4002125467ebe459feff1ebef and avoid device/driver model
>> for DT-based platforms. See the original kernel commit for the rationale.
>>
>> Also make syscon_base_lookup_by_pdevname() behave the same way as its
>> kernel counterpart in the case whern "property" argument is NULL.
>>
>> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
>> ---
>> drivers/mfd/syscon.c | 79 ++++++++++++++++++++++++++++++++++++++++------------
>> 1 file changed, 61 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
>> index ac46122..5fd22dd 100644
>> --- a/drivers/mfd/syscon.c
>> +++ b/drivers/mfd/syscon.c
>> @@ -17,15 +17,68 @@
>> #include <driver.h>
>> #include <malloc.h>
>> #include <xfuncs.h>
>> -
>> +#include <of_address.h>
>> #include <linux/err.h>
>>
>> #include <mfd/syscon.h>
>>
>> +static LIST_HEAD(syscon_list);
>> +
>> struct syscon {
>> + struct device_node *np;
>> void __iomem *base;
>> + struct list_head list;
>> };
>>
>> +static struct syscon *of_syscon_register(struct device_node *np)
>> +{
>> + int ret;
>> + struct syscon *syscon;
>> + struct resource res;
>> +
>> + if (!of_device_is_compatible(np, "syscon"))
>> + return ERR_PTR(-EINVAL);
>> +
>> + syscon = xzalloc(sizeof(*syscon));
>> +
>> + if (of_address_to_resource(np, 0, &res)) {
>> + ret = -ENOMEM;
>> + goto err_map;
>> + }
>> +
>> + syscon->base = IOMEM(res.start);
>> + syscon->np = np;
>> +
>> + list_add_tail(&syscon->list, &syscon_list);
>> +
>> + return syscon;
>> +
>> +err_map:
>> + kfree(syscon);
>> + return ERR_PTR(ret);
>> +}
>> +
>> +void __iomem *syscon_node_to_base(struct device_node *np)
>
> This should either be static or the prototype added to include/
>
Oops, missed this one. It should be static. Will fix in v2.
Thanks,
Andrey
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/7] mfd: syscon: Decouple syscon interface from platform devices
2016-07-15 21:50 ` Andrey Smirnov
@ 2016-07-18 6:18 ` Sascha Hauer
0 siblings, 0 replies; 12+ messages in thread
From: Sascha Hauer @ 2016-07-18 6:18 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: barebox
On Fri, Jul 15, 2016 at 02:50:00PM -0700, Andrey Smirnov wrote:
> On Thu, Jul 14, 2016 at 10:59 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > On Wed, Jul 13, 2016 at 11:11:01PM -0700, Andrey Smirnov wrote:
> >> Follow Linux Kernel change introduced in
> >> bdb0066df96e74a4002125467ebe459feff1ebef and avoid device/driver model
> >> for DT-based platforms. See the original kernel commit for the rationale.
> >>
> >> Also make syscon_base_lookup_by_pdevname() behave the same way as its
> >> kernel counterpart in the case whern "property" argument is NULL.
> >>
> >> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> >> ---
> >> drivers/mfd/syscon.c | 79 ++++++++++++++++++++++++++++++++++++++++------------
> >> 1 file changed, 61 insertions(+), 18 deletions(-)
> >>
> >> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
> >> index ac46122..5fd22dd 100644
> >> --- a/drivers/mfd/syscon.c
> >> +++ b/drivers/mfd/syscon.c
> >> @@ -17,15 +17,68 @@
> >> #include <driver.h>
> >> #include <malloc.h>
> >> #include <xfuncs.h>
> >> -
> >> +#include <of_address.h>
> >> #include <linux/err.h>
> >>
> >> #include <mfd/syscon.h>
> >>
> >> +static LIST_HEAD(syscon_list);
> >> +
> >> struct syscon {
> >> + struct device_node *np;
> >> void __iomem *base;
> >> + struct list_head list;
> >> };
> >>
> >> +static struct syscon *of_syscon_register(struct device_node *np)
> >> +{
> >> + int ret;
> >> + struct syscon *syscon;
> >> + struct resource res;
> >> +
> >> + if (!of_device_is_compatible(np, "syscon"))
> >> + return ERR_PTR(-EINVAL);
> >> +
> >> + syscon = xzalloc(sizeof(*syscon));
> >> +
> >> + if (of_address_to_resource(np, 0, &res)) {
> >> + ret = -ENOMEM;
> >> + goto err_map;
> >> + }
> >> +
> >> + syscon->base = IOMEM(res.start);
> >> + syscon->np = np;
> >> +
> >> + list_add_tail(&syscon->list, &syscon_list);
> >> +
> >> + return syscon;
> >> +
> >> +err_map:
> >> + kfree(syscon);
> >> + return ERR_PTR(ret);
> >> +}
> >> +
> >> +void __iomem *syscon_node_to_base(struct device_node *np)
> >
> > This should either be static or the prototype added to include/
> >
>
> Oops, missed this one. It should be static. Will fix in v2.
Ok, thanks. The rest of the series looks fine.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-07-18 6:19 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 6:10 [PATCH 1/7] Revert "syscon: Decrease driver registration priority" Andrey Smirnov
2016-07-14 6:11 ` [PATCH 2/7] mfd: syscon: Don't call request_iomem_region() Andrey Smirnov
2016-07-15 5:53 ` Sascha Hauer
2016-07-15 9:11 ` Re[2]: " Alexander Shiyan
2016-07-14 6:11 ` [PATCH 3/7] mfd: syscon: Decouple syscon interface from platform devices Andrey Smirnov
2016-07-15 5:59 ` Sascha Hauer
2016-07-15 21:50 ` Andrey Smirnov
2016-07-18 6:18 ` Sascha Hauer
2016-07-14 6:11 ` [PATCH 4/7] mfd: syscon: Don't check xzalloc return for NULL Andrey Smirnov
2016-07-14 6:11 ` [PATCH 5/7] mfd: syscon: Use IOMEM instead of explicit cast Andrey Smirnov
2016-07-14 6:11 ` [PATCH 6/7] imx_thermal: Remove leftover debug output Andrey Smirnov
2016-07-14 6:11 ` [PATCH 7/7] i.MX: ocotp: Register regmap against orignal device Andrey Smirnov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox