Skip to contentSkip to conversation

mfd: syscon: Add non-DT support

PATCH In review Alexander Shiyan 5 participants 14 messages Feb 21, 2013 – Feb 23, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 mfd: syscon: Add non-DT support

This patch allow using syscon driver from the platform data, i.e. possibility using driver on systems without oftree support. For search syscon device from the client drivers, "syscon_regmap_lookup_by_pdevname" function was added.

---
 drivers/mfd/Kconfig        |  1 -
 drivers/mfd/syscon.c       | 64 +++++++++++++++++++++++++++++++++-------------
 include/linux/mfd/syscon.h |  1 +
 3 files changed, 47 insertions(+), 19 deletions(-)
drivers/mfd/Kconfig +0 -1
index 671f5b1..8fdd87e 100644
@@ -1070,7 +1070,6 @@ config MFD_STA2X11
 
 config MFD_SYSCON
 	bool "System Controller Register R/W Based on Regmap"
-	depends on OF
 	select REGMAP_MMIO
 	help
 	  Select this option to enable accessing system control registers
drivers/mfd/syscon.c +46 -18

113 lines not on this page · raw message

include/linux/mfd/syscon.h +1 -0
index 6aeb6b8..5c9ee6e 100644
@@ -17,6 +17,7 @@
 
 extern struct regmap *syscon_node_to_regmap(struct device_node *np);
 extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
+extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s);
 extern struct regmap *syscon_regmap_lookup_by_phandle(
 					struct device_node *np,
 					const char *property);
Signature · 1 line
1.7.12.4
maintainer Acked-by on v4 1/1
#1 lore raw

Re: [PATCH v4] mfd: syscon: Add non-DT suppor

Quoted 6 lines · Alexander Shiyan

This patch allow using syscon driver from the platform data, i.e. possibility using driver on systems without oftree support. For search syscon device from the client drivers, "syscon_regmap_lookup_by_pdevname" function was added.

Looks good to me now.

Acked-by on v4 1/1
#2 lore raw
In reply to Alexander Shiyan
Quoted 6 lines · Alexander Shiyan

This patch allow using syscon driver from the platform data, i.e. possibility using driver on systems without oftree support. For search syscon device from the client drivers, "syscon_regmap_lookup_by_pdevname" function was added.

[...]

drivers/mfd/syscon.c static struct regmap_config syscon_regmap_config = { · line 141

Quoted 2 lines
drivers/mfd/syscon.c +2 -0
+	syscon->base = devm_ioremap_resource(dev, res);
+	if (!syscon->base)

Is this correct?

drivers/mfd/syscon.c static struct regmap_config syscon_regmap_config = { · line 142

Quoted 2 lines
drivers/mfd/syscon.c +1 -0
+		return -EBUSY;

Otherwise, i'm also ok with this patch.

BTW, i did not see Samuel's tree having this new API. So, who will pick this patch?

Regards
Dong Aisheng

#3 lore raw
Quoted 6 lines · Alexander Shiyan
Quoted 5 lines

This patch allow using syscon driver from the platform data, i.e. possibility using driver on systems without oftree support. For search syscon device from the client drivers, "syscon_regmap_lookup_by_pdevname" function was added.

Quoted 8 lines
Quoted 1 line

[...]

drivers/mfd/syscon.c static struct regmap_config syscon_regmap_config = { · line 141

Quoted 2 lines
drivers/mfd/syscon.c +2 -0
+	syscon->base = devm_ioremap_resource(dev, res);
+	if (!syscon->base)

Is this correct?

Hmm, of course IS_ERR should be used here...
v5?

Quoted 9 lines

drivers/mfd/syscon.c static struct regmap_config syscon_regmap_config = { · line 142

Quoted 3 lines
drivers/mfd/syscon.c +1 -0
+		return -EBUSY;

Otherwise, i'm also ok with this patch.

BTW, i did not see Samuel's tree having this new API. So, who will pick this patch?

I have same question.

---
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#4 lore raw
Quoted 10 lines · Alexander Shiyan
Quoted 10 lines · Alexander Shiyan
Quoted 6 lines

This patch allow using syscon driver from the platform data, i.e. possibility using driver on systems without oftree support. For search syscon device from the client drivers, "syscon_regmap_lookup_by_pdevname" function was added.

[...]

Quoted 8 lines
Quoted 4 lines

drivers/mfd/syscon.c static struct regmap_config syscon_regmap_config = { · line 141

Quoted 2 lines
drivers/mfd/syscon.c +2 -0
+	syscon->base = devm_ioremap_resource(dev, res);
+	if (!syscon->base)

Is this correct?

Hmm, of course IS_ERR should be used here...
v5?

Yes.

Quoted 1 line

From here:

https://lkml.org/lkml/2013/1/21/140
It seems it is.

Quoted 2 lines
Quoted 2 lines

drivers/mfd/syscon.c static struct regmap_config syscon_regmap_config = { · line 142

Quoted 2 lines
drivers/mfd/syscon.c +1 -0
+		return -EBUSY;

Both this line could also be changed.

Quoted 9 lines
Quoted 7 lines
Quoted 1 line

Otherwise, i'm also ok with this patch.

BTW, i did not see Samuel's tree having this new API. So, who will pick this patch?

I have same question.

I CCed Thierry and Greg who may know it.

Regards
Dong Aisheng

#5 lore raw
Quoted 35 lines · Dong Aisheng
Quoted 10 lines · Alexander Shiyan
Quoted 10 lines · Alexander Shiyan
Quoted 6 lines

This patch allow using syscon driver from the platform data, i.e. possibility using driver on systems without oftree support. For search syscon device from the client drivers, "syscon_regmap_lookup_by_pdevname" function was added.

[...]

Quoted 8 lines
Quoted 4 lines

drivers/mfd/syscon.c static struct regmap_config syscon_regmap_config = { · line 141

Quoted 2 lines
drivers/mfd/syscon.c +2 -0
+	syscon->base = devm_ioremap_resource(dev, res);
+	if (!syscon->base)

Is this correct?

Hmm, of course IS_ERR should be used here...
v5?

Yes.

Quoted 1 line

From here:

https://lkml.org/lkml/2013/1/21/140
It seems it is.

Quoted 2 lines
Quoted 2 lines

drivers/mfd/syscon.c static struct regmap_config syscon_regmap_config = { · line 142

Quoted 2 lines
drivers/mfd/syscon.c +1 -0
+		return -EBUSY;

Both this line could also be changed.

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Otherwise, i'm also ok with this patch.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

BTW, i did not see Samuel's tree having this new API. So, who will pick this patch?

I have same question.

I CCed Thierry and Greg who may know it.

Yes, devm_ioremap_resource() never returns NULL. You always need to check the returned pointer with IS_ERR(). The value that you return should be extracted from the pointer with PTR_ERR().

Thierry

#6 lore raw

On Fri, Feb 22, 2013 at 08:27:19AM +0100, Thierry Reding wrote:
...

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Otherwise, i'm also ok with this patch.

BTW, i did not see Samuel's tree having this new API. So, who will pick this patch?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I have same question.

I CCed Thierry and Greg who may know it.

Yes, devm_ioremap_resource() never returns NULL. You always need to check the returned pointer with IS_ERR(). The value that you return should be extracted from the pointer with PTR_ERR().

Thanks Thierry.
Since Samuel's mdf tree does not have your patch introducing the new API of devm_ioremap_resource,
do you know which tree this patch can go through, Greg's driver core tree?

Regards
Dong Aisheng

#7 lore raw
Quoted 12 lines · Dong Aisheng

On Fri, Feb 22, 2013 at 08:27:19AM +0100, Thierry Reding wrote:
...

Quoted 10 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

Otherwise, i'm also ok with this patch.

BTW, i did not see Samuel's tree having this new API. So, who will pick this patch?

I have same question.

I CCed Thierry and Greg who may know it.

Quoted 8 lines
Quoted 3 lines

Yes, devm_ioremap_resource() never returns NULL. You always need to check the returned pointer with IS_ERR(). The value that you return should be extracted from the pointer with PTR_ERR().

Thanks Thierry.
Since Samuel's mdf tree does not have your patch introducing the new API of devm_ioremap_resource,
do you know which tree this patch can go through, Greg's driver core tree?

I don't think it matters much at this point because Linus merged the driver core tree yesterday, so anything that gets applied now should automatically have the new API available.

Thierry

#8 lore raw
Quoted 17 lines · Thierry Reding
Quoted 16 lines · Dong Aisheng

On Fri, Feb 22, 2013 at 08:27:19AM +0100, Thierry Reding wrote:
...

Quoted 13 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

Otherwise, i'm also ok with this patch.

BTW, i did not see Samuel's tree having this new API. So, who will pick this patch?

I have same question.

I CCed Thierry and Greg who may know it.

Yes, devm_ioremap_resource() never returns NULL. You always need to check the returned pointer with IS_ERR(). The value that you return should be extracted from the pointer with PTR_ERR().

Quoted 9 lines
Quoted 4 lines

Thanks Thierry.
Since Samuel's mdf tree does not have your patch introducing the new API of devm_ioremap_resource,
do you know which tree this patch can go through, Greg's driver core tree?

I don't think it matters much at this point because Linus merged the driver core tree yesterday, so anything that gets applied now should automatically have the new API available.

I just tried update to latest linus tree, still did not find this API defined in include/linux/io.h.
Would you mind point it out for me?

Regards
Dong Aisheng

#9 lore raw
Quoted 23 lines · Dong Aisheng
Quoted 22 lines · Thierry Reding
Quoted 20 lines · Dong Aisheng

On Fri, Feb 22, 2013 at 08:27:19AM +0100, Thierry Reding wrote:
...

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Otherwise, i'm also ok with this patch.

BTW, i did not see Samuel's tree having this new API. So, who will pick this patch?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I have same question.

I CCed Thierry and Greg who may know it.

Yes, devm_ioremap_resource() never returns NULL. You always need to check the returned pointer with IS_ERR(). The value that you return should be extracted from the pointer with PTR_ERR().

Thanks Thierry.
Since Samuel's mdf tree does not have your patch introducing the new API of devm_ioremap_resource,
do you know which tree this patch can go through, Greg's driver core tree?

Quoted 7 lines
Quoted 4 lines

I don't think it matters much at this point because Linus merged the driver core tree yesterday, so anything that gets applied now should automatically have the new API available.

I just tried update to latest linus tree, still did not find this API defined in include/linux/io.h.
Would you mind point it out for me?

Commit 75096579c3ac39ddc2f8b0d9a8924eba31f4d920 introduced it. The prototype is in include/linux/device.h and the implementation in lib/devres.c.

Thierry

#10 lore raw

On 22 February 2013 17:24, Thierry Reding
<[email protected]> wrote:
...

Quoted 8 lines
Quoted 3 lines

I just tried update to latest linus tree, still did not find this API defined in include/linux/io.h.
Would you mind point it out for me?

Commit 75096579c3ac39ddc2f8b0d9a8924eba31f4d920 introduced it. The prototype is in include/linux/device.h and the implementation in lib/devres.c.

Got it.
Thanks.

Regards
Dong Aisheng

#11 lore raw
In reply to Thierry Reding
Quoted 17 lines · Dong Aisheng
Quoted 16 lines · Thierry Reding

...

Quoted 13 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

Otherwise, i'm also ok with this patch.

BTW, i did not see Samuel's tree having this new API. So, who will pick this patch?

I have same question.

I CCed Thierry and Greg who may know it.

Yes, devm_ioremap_resource() never returns NULL. You always need to check the returned pointer with IS_ERR(). The value that you return should be extracted from the pointer with PTR_ERR().

Quoted 8 lines
Quoted 4 lines

Thanks Thierry.
Since Samuel's mdf tree does not have your patch introducing the new API of devm_ioremap_resource,
do you know which tree this patch can go through, Greg's driver core tree?

I don't think it matters much at this point because Linus merged the driver core tree yesterday, so anything that gets applied now should automatically have the new API available.

So, i will send all the three parts of the patch as v5 and keep all current CCs. Thanks.

---
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

maintainer
#12 lore raw
In reply to Thierry Reding
Quoted 21 lines · Thierry Reding
Quoted 20 lines · Dong Aisheng
Quoted 18 lines · Alexander Shiyan
Quoted 6 lines · Alexander Shiyan
Quoted 5 lines

This patch allow using syscon driver from the platform data, i.e. possibility using driver on systems without oftree support. For search syscon device from the client drivers, "syscon_regmap_lookup_by_pdevname" function was added.

Quoted 8 lines
Quoted 1 line

[...]

drivers/mfd/syscon.c static struct regmap_config syscon_regmap_config = { · line 141

Quoted 2 lines
drivers/mfd/syscon.c +2 -0
+       syscon->base = devm_ioremap_resource(dev, res);
+       if (!syscon->base)

Is this correct?

Hmm, of course IS_ERR should be used here...
v5?

Quoted 9 lines
Quoted 4 lines

Yes.

Quoted 1 line

From here:

https://lkml.org/lkml/2013/1/21/140
It seems it is.

Yes, devm_ioremap_resource() never returns NULL. You always need to check the returned pointer with IS_ERR(). The value that you return should be extracted from the pointer with PTR_ERR().

Well, devm_ioremap_resource also tries to request the resource, which as someone (Dong or Shawn?) pointed out, we should not do for the imx6q case. I think this has to be reverted to platform_get_resource and dev_ioremap.

Arnd

#13 lore raw
Quoted 32 lines · Arnd Bergmann
Quoted 21 lines · Thierry Reding
Quoted 20 lines · Dong Aisheng
Quoted 18 lines · Alexander Shiyan
Quoted 6 lines · Alexander Shiyan
Quoted 5 lines

This patch allow using syscon driver from the platform data, i.e. possibility using driver on systems without oftree support. For search syscon device from the client drivers, "syscon_regmap_lookup_by_pdevname" function was added.

Quoted 8 lines
Quoted 1 line

[...]

drivers/mfd/syscon.c static struct regmap_config syscon_regmap_config = { · line 141

Quoted 2 lines
drivers/mfd/syscon.c +2 -0
+       syscon->base = devm_ioremap_resource(dev, res);
+       if (!syscon->base)

Is this correct?

Hmm, of course IS_ERR should be used here...
v5?

Quoted 9 lines
Quoted 4 lines

Yes.

Quoted 1 line

From here:

https://lkml.org/lkml/2013/1/21/140
It seems it is.

Yes, devm_ioremap_resource() never returns NULL. You always need to check the returned pointer with IS_ERR(). The value that you return should be extracted from the pointer with PTR_ERR().

Quoted 5 lines

Well, devm_ioremap_resource also tries to request the resource, which as someone (Dong or Shawn?) pointed out, we should not do for the imx6q case. I think this has to be reverted to platform_get_resource and dev_ioremap.

Yes, i did not see detailed devm_ioremap_resource implementation, but if it requests the resource then right, it may fail on imx6q due to request overlapped resources.

Regards
Dong Aisheng