[v2,3/3] mfd: core: Add OF_MFD_CELL_REG() helper

Message ID 20200611191002.2256570-3-lee.jones@linaro.org
State Accepted
Commit 44e6171ed04a0cd0378e2503f03a444ebdd4e8e3
Headers show
Series
  • [v2,1/3] mfd: core: Make a best effort attempt to match devices with the correct of_nodes
Related show

Commit Message

Lee Jones June 11, 2020, 7:10 p.m.
Extend current list of helpers to provide support for parent drivers
wishing to match specific child devices to particular OF nodes.

Signed-off-by: Lee Jones <lee.jones@linaro.org>

---
 include/linux/mfd/core.h | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

-- 
2.25.1

Comments

Frank Rowand June 12, 2020, 12:28 p.m. | #1
+Frank (me)

On 2020-06-11 14:10, Lee Jones wrote:
> Extend current list of helpers to provide support for parent drivers

> wishing to match specific child devices to particular OF nodes.

> 

> Signed-off-by: Lee Jones <lee.jones@linaro.org>

> ---

>  include/linux/mfd/core.h | 17 +++++++++++------

>  1 file changed, 11 insertions(+), 6 deletions(-)

> 

> diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h

> index ae1c6f90388ba..7ce1de99cd8b8 100644

> --- a/include/linux/mfd/core.h

> +++ b/include/linux/mfd/core.h

> @@ -14,7 +14,7 @@

>  

>  #define MFD_RES_SIZE(arr) (sizeof(arr) / sizeof(struct resource))

>  

> -#define MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, _match)\

> +#define MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, _of_reg, _use_of_reg,_match) \

>  	{								\

>  		.name = (_name),					\

>  		.resources = (_res),					\

> @@ -22,24 +22,29 @@

>  		.platform_data = (_pdata),				\

>  		.pdata_size = (_pdsize),				\

>  		.of_compatible = (_compat),				\

> +		.of_reg = (_of_reg),					\

> +		.use_of_reg = (_use_of_reg),				\

>  		.acpi_match = (_match),					\

>  		.id = (_id),						\

>  	}

>  

> +#define OF_MFD_CELL_REG(_name, _res, _pdata, _pdsize,_id, _compat, _of_reg) \

> +	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, _of_reg, true, NULL)

> +

>  #define OF_MFD_CELL(_name, _res, _pdata, _pdsize,_id, _compat) \

> -	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, NULL)

> +	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, 0, false, NULL)

>  

>  #define ACPI_MFD_CELL(_name, _res, _pdata, _pdsize, _id, _match) \

> -	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, _match)

> +	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, 0, false, _match)

>  

>  #define MFD_CELL_BASIC(_name, _res, _pdata, _pdsize, _id) \

> -	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, NULL)

> +	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, 0, false, NULL)

>  

>  #define MFD_CELL_RES(_name, _res) \

> -	MFD_CELL_ALL(_name, _res, NULL, 0, 0, NULL, NULL)

> +	MFD_CELL_ALL(_name, _res, NULL, 0, 0, NULL, 0, false, NULL)

>  

>  #define MFD_CELL_NAME(_name) \

> -	MFD_CELL_ALL(_name, NULL, NULL, 0, 0, NULL, NULL)

> +	MFD_CELL_ALL(_name, NULL, NULL, 0, 0, NULL, 0, false, NULL)

>  

>  struct irq_domain;

>  struct property_entry;

>

Patch

diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index ae1c6f90388ba..7ce1de99cd8b8 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -14,7 +14,7 @@ 
 
 #define MFD_RES_SIZE(arr) (sizeof(arr) / sizeof(struct resource))
 
-#define MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, _match)\
+#define MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, _of_reg, _use_of_reg,_match) \
 	{								\
 		.name = (_name),					\
 		.resources = (_res),					\
@@ -22,24 +22,29 @@ 
 		.platform_data = (_pdata),				\
 		.pdata_size = (_pdsize),				\
 		.of_compatible = (_compat),				\
+		.of_reg = (_of_reg),					\
+		.use_of_reg = (_use_of_reg),				\
 		.acpi_match = (_match),					\
 		.id = (_id),						\
 	}
 
+#define OF_MFD_CELL_REG(_name, _res, _pdata, _pdsize,_id, _compat, _of_reg) \
+	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, _of_reg, true, NULL)
+
 #define OF_MFD_CELL(_name, _res, _pdata, _pdsize,_id, _compat) \
-	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, NULL)
+	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, 0, false, NULL)
 
 #define ACPI_MFD_CELL(_name, _res, _pdata, _pdsize, _id, _match) \
-	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, _match)
+	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, 0, false, _match)
 
 #define MFD_CELL_BASIC(_name, _res, _pdata, _pdsize, _id) \
-	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, NULL)
+	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, 0, false, NULL)
 
 #define MFD_CELL_RES(_name, _res) \
-	MFD_CELL_ALL(_name, _res, NULL, 0, 0, NULL, NULL)
+	MFD_CELL_ALL(_name, _res, NULL, 0, 0, NULL, 0, false, NULL)
 
 #define MFD_CELL_NAME(_name) \
-	MFD_CELL_ALL(_name, NULL, NULL, 0, 0, NULL, NULL)
+	MFD_CELL_ALL(_name, NULL, NULL, 0, 0, NULL, 0, false, NULL)
 
 struct irq_domain;
 struct property_entry;