diff mbox

[1/3] mmc: host: add slot argument to mmc_of_parse

Message ID 1400840721-11050-2-git-send-email-jh80.chung@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jaehoon Chung May 23, 2014, 10:25 a.m. UTC
From: Ludovic Desroches <ludovic.desroches@atmel.com>

Some hosts manage several slots. In these case information such as the
bus width, chi detect and others are into the slot node. So we have to
parse child node. If not NULL, slot node will be used instead of the
device node.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/core/host.c  |   13 +++++++++----
 include/linux/mmc/host.h |   10 +++++++++-
 2 files changed, 18 insertions(+), 5 deletions(-)

Comments

Tushar Behera May 23, 2014, 10:44 a.m. UTC | #1
On 23 May 2014 15:55, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>
> Some hosts manage several slots. In these case information such as the
> bus width, chi detect and others are into the slot node. So we have to
> parse child node. If not NULL, slot node will be used instead of the
> device node.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/core/host.c  |   13 +++++++++----
>  include/linux/mmc/host.h |   10 +++++++++-
>  2 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 95cceae..0f677b3 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -298,15 +298,17 @@ static inline void mmc_host_clk_sysfs_init(struct mmc_host *host)
>  #endif
>
>  /**
> - *     mmc_of_parse() - parse host's device-tree node
> + *     __mmc_of_parse() - parse host's device-tree node

IMO it would be better to rename this function, something like
mmc_of_parse_slot().
Ludovic Desroches May 26, 2014, 8:09 a.m. UTC | #2
On Fri, May 23, 2014 at 07:25:19PM +0900, Jaehoon Chung wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Some hosts manage several slots. In these case information such as the
> bus width, chi detect and others are into the slot node. So we have to

/s/chi detect/chip detect

> parse child node. If not NULL, slot node will be used instead of the
> device node.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/core/host.c  |   13 +++++++++----
>  include/linux/mmc/host.h |   10 +++++++++-
>  2 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 95cceae..0f677b3 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -298,15 +298,17 @@ static inline void mmc_host_clk_sysfs_init(struct mmc_host *host)
>  #endif
>  
>  /**
> - *	mmc_of_parse() - parse host's device-tree node
> + *	__mmc_of_parse() - parse host's device-tree node
>   *	@host: host whose node should be parsed.
> + *	@slot : some device provide several slots so the node to parse
> + *		is not the host one.
>   *
>   * To keep the rest of the MMC subsystem unaware of whether DT has been
>   * used to to instantiate and configure this host instance or not, we
>   * parse the properties and set respective generic mmc-host flags and
>   * parameters.
>   */
> -int mmc_of_parse(struct mmc_host *host)
> +int __mmc_of_parse(struct mmc_host *host, struct device_node *slot)
>  {
>  	struct device_node *np;
>  	u32 bus_width;
> @@ -317,7 +319,10 @@ int mmc_of_parse(struct mmc_host *host)
>  	if (!host->parent || !host->parent->of_node)
>  		return 0;
>  
> -	np = host->parent->of_node;
> +	if (slot)
> +		np = slot;
> +	else
> +		np = host->parent->of_node;
>  
>  	/* "bus-width" is translated to MMC_CAP_*_BIT_DATA flags */
>  	if (of_property_read_u32(np, "bus-width", &bus_width) < 0) {
> @@ -459,7 +464,7 @@ out:
>  	return ret;
>  }
>  
> -EXPORT_SYMBOL(mmc_of_parse);
> +EXPORT_SYMBOL(__mmc_of_parse);
>  
>  /**
>   *	mmc_alloc_host - initialise the per-host structure.
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 7960424..c62af91 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -372,7 +372,15 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *);
>  int mmc_add_host(struct mmc_host *);
>  void mmc_remove_host(struct mmc_host *);
>  void mmc_free_host(struct mmc_host *);
> -int mmc_of_parse(struct mmc_host *host);
> +int __mmc_of_parse(struct mmc_host *host, struct device_node *slot);
> +/*
> + * mmc_of_parse - parse host's device-tree node
> + *	@host: host whose node should be parsed.
> + */
> +static inline int mmc_of_parse(struct mmc_host *host)
> +{
> +	return __mmc_of_parse(host, NULL);
> +}
>  
>  static inline void *mmc_priv(struct mmc_host *host)
>  {
> -- 
> 1.7.9.5
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jaehoon Chung May 26, 2014, 8:38 a.m. UTC | #3
Hi,

On 05/26/2014 05:09 PM, Ludovic Desroches wrote:
> On Fri, May 23, 2014 at 07:25:19PM +0900, Jaehoon Chung wrote:
>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>
>> Some hosts manage several slots. In these case information such as the
>> bus width, chi detect and others are into the slot node. So we have to
> 
> /s/chi detect/chip detect
Will fix.

Tushar have suggested the rename mmc_of_parse_slot() instead of __mmc_of_parse().
I'm not sure which name is better. How about?

If never mind, i will change to mmc_of_parse_slot(), then send patch-v2.

Best Regards,
Jaehoon Chung
> 
>> parse child node. If not NULL, slot node will be used instead of the
>> device node.
>>
>> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>  drivers/mmc/core/host.c  |   13 +++++++++----
>>  include/linux/mmc/host.h |   10 +++++++++-
>>  2 files changed, 18 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
>> index 95cceae..0f677b3 100644
>> --- a/drivers/mmc/core/host.c
>> +++ b/drivers/mmc/core/host.c
>> @@ -298,15 +298,17 @@ static inline void mmc_host_clk_sysfs_init(struct mmc_host *host)
>>  #endif
>>  
>>  /**
>> - *	mmc_of_parse() - parse host's device-tree node
>> + *	__mmc_of_parse() - parse host's device-tree node
>>   *	@host: host whose node should be parsed.
>> + *	@slot : some device provide several slots so the node to parse
>> + *		is not the host one.
>>   *
>>   * To keep the rest of the MMC subsystem unaware of whether DT has been
>>   * used to to instantiate and configure this host instance or not, we
>>   * parse the properties and set respective generic mmc-host flags and
>>   * parameters.
>>   */
>> -int mmc_of_parse(struct mmc_host *host)
>> +int __mmc_of_parse(struct mmc_host *host, struct device_node *slot)
>>  {
>>  	struct device_node *np;
>>  	u32 bus_width;
>> @@ -317,7 +319,10 @@ int mmc_of_parse(struct mmc_host *host)
>>  	if (!host->parent || !host->parent->of_node)
>>  		return 0;
>>  
>> -	np = host->parent->of_node;
>> +	if (slot)
>> +		np = slot;
>> +	else
>> +		np = host->parent->of_node;
>>  
>>  	/* "bus-width" is translated to MMC_CAP_*_BIT_DATA flags */
>>  	if (of_property_read_u32(np, "bus-width", &bus_width) < 0) {
>> @@ -459,7 +464,7 @@ out:
>>  	return ret;
>>  }
>>  
>> -EXPORT_SYMBOL(mmc_of_parse);
>> +EXPORT_SYMBOL(__mmc_of_parse);
>>  
>>  /**
>>   *	mmc_alloc_host - initialise the per-host structure.
>> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
>> index 7960424..c62af91 100644
>> --- a/include/linux/mmc/host.h
>> +++ b/include/linux/mmc/host.h
>> @@ -372,7 +372,15 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *);
>>  int mmc_add_host(struct mmc_host *);
>>  void mmc_remove_host(struct mmc_host *);
>>  void mmc_free_host(struct mmc_host *);
>> -int mmc_of_parse(struct mmc_host *host);
>> +int __mmc_of_parse(struct mmc_host *host, struct device_node *slot);
>> +/*
>> + * mmc_of_parse - parse host's device-tree node
>> + *	@host: host whose node should be parsed.
>> + */
>> +static inline int mmc_of_parse(struct mmc_host *host)
>> +{
>> +	return __mmc_of_parse(host, NULL);
>> +}
>>  
>>  static inline void *mmc_priv(struct mmc_host *host)
>>  {
>> -- 
>> 1.7.9.5
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson May 26, 2014, 8:44 a.m. UTC | #4
On 26 May 2014 10:38, Jaehoon Chung <jh80.chung@gmail.com> wrote:
> Hi,
>
> On 05/26/2014 05:09 PM, Ludovic Desroches wrote:
>> On Fri, May 23, 2014 at 07:25:19PM +0900, Jaehoon Chung wrote:
>>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>>
>>> Some hosts manage several slots. In these case information such as the
>>> bus width, chi detect and others are into the slot node. So we have to
>>
>> /s/chi detect/chip detect
> Will fix.
>
> Tushar have suggested the rename mmc_of_parse_slot() instead of __mmc_of_parse().
> I'm not sure which name is better. How about?
>
> If never mind, i will change to mmc_of_parse_slot(), then send patch-v2.

I would prefer to keep it as is, but just because that's my taste. :-)

Kind regards
Ulf Hansson
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jaehoon Chung May 26, 2014, 9:11 a.m. UTC | #5
Hi, Ulf.

On 05/26/2014 05:44 PM, Ulf Hansson wrote:
> On 26 May 2014 10:38, Jaehoon Chung <jh80.chung@gmail.com> wrote:
>> Hi,
>>
>> On 05/26/2014 05:09 PM, Ludovic Desroches wrote:
>>> On Fri, May 23, 2014 at 07:25:19PM +0900, Jaehoon Chung wrote:
>>>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>>>
>>>> Some hosts manage several slots. In these case information such as the
>>>> bus width, chi detect and others are into the slot node. So we have to
>>>
>>> /s/chi detect/chip detect
>> Will fix.
>>
>> Tushar have suggested the rename mmc_of_parse_slot() instead of __mmc_of_parse().
>> I'm not sure which name is better. How about?
>>
>> If never mind, i will change to mmc_of_parse_slot(), then send patch-v2.
> 
> I would prefer to keep it as is, but just because that's my taste. :-)
Ok. I think so.
I want to merge this patch-set for fixing the dw-mmc problem, before release the 3.16.

dw-mmc controller also used the slot concept, so some property didn't parse with mmc_of_parse().

Best Regards,
Jaehoon Chung
 
> 
> Kind regards
> Ulf Hansson
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 95cceae..0f677b3 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -298,15 +298,17 @@  static inline void mmc_host_clk_sysfs_init(struct mmc_host *host)
 #endif
 
 /**
- *	mmc_of_parse() - parse host's device-tree node
+ *	__mmc_of_parse() - parse host's device-tree node
  *	@host: host whose node should be parsed.
+ *	@slot : some device provide several slots so the node to parse
+ *		is not the host one.
  *
  * To keep the rest of the MMC subsystem unaware of whether DT has been
  * used to to instantiate and configure this host instance or not, we
  * parse the properties and set respective generic mmc-host flags and
  * parameters.
  */
-int mmc_of_parse(struct mmc_host *host)
+int __mmc_of_parse(struct mmc_host *host, struct device_node *slot)
 {
 	struct device_node *np;
 	u32 bus_width;
@@ -317,7 +319,10 @@  int mmc_of_parse(struct mmc_host *host)
 	if (!host->parent || !host->parent->of_node)
 		return 0;
 
-	np = host->parent->of_node;
+	if (slot)
+		np = slot;
+	else
+		np = host->parent->of_node;
 
 	/* "bus-width" is translated to MMC_CAP_*_BIT_DATA flags */
 	if (of_property_read_u32(np, "bus-width", &bus_width) < 0) {
@@ -459,7 +464,7 @@  out:
 	return ret;
 }
 
-EXPORT_SYMBOL(mmc_of_parse);
+EXPORT_SYMBOL(__mmc_of_parse);
 
 /**
  *	mmc_alloc_host - initialise the per-host structure.
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7960424..c62af91 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -372,7 +372,15 @@  struct mmc_host *mmc_alloc_host(int extra, struct device *);
 int mmc_add_host(struct mmc_host *);
 void mmc_remove_host(struct mmc_host *);
 void mmc_free_host(struct mmc_host *);
-int mmc_of_parse(struct mmc_host *host);
+int __mmc_of_parse(struct mmc_host *host, struct device_node *slot);
+/*
+ * mmc_of_parse - parse host's device-tree node
+ *	@host: host whose node should be parsed.
+ */
+static inline int mmc_of_parse(struct mmc_host *host)
+{
+	return __mmc_of_parse(host, NULL);
+}
 
 static inline void *mmc_priv(struct mmc_host *host)
 {