All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH 1/1] dm: core: add clocks node scan
@ 2017-07-31 15:12 patrice.chotard at st.com
  2017-08-06  5:16 ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: patrice.chotard at st.com @ 2017-07-31 15:12 UTC (permalink / raw)
  To: u-boot

From: Patrice Chotard <patrice.chotard@st.com>

Currently, all fixed-clock declared in "clocks" node in device tree
can be binded by clk_fixed_rate.c driver only if the "simple-bus"
compatible string is set inside "clocks" node.
This constraint has been invoked here [1].

This patch offers a solution to avoid adding "simple-bus" compatible
string to "clocks" node.

[1] https://patchwork.ozlabs.org/patch/558837/

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
 drivers/core/root.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index d691d6f..f285df8 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -312,6 +312,12 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
 #endif
 	return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
 }
+#else
+static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
+			    int offset, bool pre_reloc_only)
+{
+	return 0;
+}
 #endif
 
 __weak int dm_scan_other(bool pre_reloc_only)
@@ -322,6 +328,7 @@ __weak int dm_scan_other(bool pre_reloc_only)
 int dm_init_and_scan(bool pre_reloc_only)
 {
 	int ret;
+	int node;
 
 	ret = dm_init(IS_ENABLED(CONFIG_OF_LIVE));
 	if (ret) {
@@ -340,6 +347,12 @@ int dm_init_and_scan(bool pre_reloc_only)
 			debug("dm_scan_fdt() failed: %d\n", ret);
 			return ret;
 		}
+
+		/* bind fixed-clock */
+		node = fdt_path_offset(gd->fdt_blob, "/clocks");
+		if (node >= 0)
+			dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
+					 pre_reloc_only);
 	}
 
 	ret = dm_scan_other(pre_reloc_only);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [RFC PATCH 1/1] dm: core: add clocks node scan
  2017-07-31 15:12 [U-Boot] [RFC PATCH 1/1] dm: core: add clocks node scan patrice.chotard at st.com
@ 2017-08-06  5:16 ` Simon Glass
  2017-08-08  9:13   ` Patrice CHOTARD
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Glass @ 2017-08-06  5:16 UTC (permalink / raw)
  To: u-boot

Hi Patrice,

On 31 July 2017 at 09:12,  <patrice.chotard@st.com> wrote:
> From: Patrice Chotard <patrice.chotard@st.com>
>
> Currently, all fixed-clock declared in "clocks" node in device tree
> can be binded by clk_fixed_rate.c driver only if the "simple-bus"
> compatible string is set inside "clocks" node.
> This constraint has been invoked here [1].
>
> This patch offers a solution to avoid adding "simple-bus" compatible
> string to "clocks" node.
>
> [1] https://patchwork.ozlabs.org/patch/558837/
>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> ---
>  drivers/core/root.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/drivers/core/root.c b/drivers/core/root.c
> index d691d6f..f285df8 100644
> --- a/drivers/core/root.c
> +++ b/drivers/core/root.c
> @@ -312,6 +312,12 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
>  #endif
>         return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
>  }
> +#else
> +static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
> +                           int offset, bool pre_reloc_only)
> +{
> +       return 0;
> +}
>  #endif
>
>  __weak int dm_scan_other(bool pre_reloc_only)
> @@ -322,6 +328,7 @@ __weak int dm_scan_other(bool pre_reloc_only)
>  int dm_init_and_scan(bool pre_reloc_only)
>  {
>         int ret;
> +       int node;
>
>         ret = dm_init(IS_ENABLED(CONFIG_OF_LIVE));
>         if (ret) {
> @@ -340,6 +347,12 @@ int dm_init_and_scan(bool pre_reloc_only)
>                         debug("dm_scan_fdt() failed: %d\n", ret);
>                         return ret;
>                 }
> +
> +               /* bind fixed-clock */
> +               node = fdt_path_offset(gd->fdt_blob, "/clocks");

This needs to support livetree, so I think you want ofnode_path() here.

> +               if (node >= 0)
> +                       dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
> +                                        pre_reloc_only);

See dm_scan_fdt() for what you need to do here.

>         }
>
>         ret = dm_scan_other(pre_reloc_only);
> --
> 1.9.1
>

Also please can you make sandbox have a clock in this node, and add a
test for it to test/dm/clk.c ?

Regards,
Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [RFC PATCH 1/1] dm: core: add clocks node scan
  2017-08-06  5:16 ` Simon Glass
@ 2017-08-08  9:13   ` Patrice CHOTARD
  0 siblings, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2017-08-08  9:13 UTC (permalink / raw)
  To: u-boot

Hi Simon

On 08/06/2017 07:16 AM, Simon Glass wrote:
> Hi Patrice,
> 
> On 31 July 2017 at 09:12,  <patrice.chotard@st.com> wrote:
>> From: Patrice Chotard <patrice.chotard@st.com>
>>
>> Currently, all fixed-clock declared in "clocks" node in device tree
>> can be binded by clk_fixed_rate.c driver only if the "simple-bus"
>> compatible string is set inside "clocks" node.
>> This constraint has been invoked here [1].
>>
>> This patch offers a solution to avoid adding "simple-bus" compatible
>> string to "clocks" node.
>>
>> [1] https://patchwork.ozlabs.org/patch/558837/
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
>> ---
>>   drivers/core/root.c | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/core/root.c b/drivers/core/root.c
>> index d691d6f..f285df8 100644
>> --- a/drivers/core/root.c
>> +++ b/drivers/core/root.c
>> @@ -312,6 +312,12 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
>>   #endif
>>          return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
>>   }
>> +#else
>> +static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
>> +                           int offset, bool pre_reloc_only)
>> +{
>> +       return 0;
>> +}
>>   #endif
>>
>>   __weak int dm_scan_other(bool pre_reloc_only)
>> @@ -322,6 +328,7 @@ __weak int dm_scan_other(bool pre_reloc_only)
>>   int dm_init_and_scan(bool pre_reloc_only)
>>   {
>>          int ret;
>> +       int node;
>>
>>          ret = dm_init(IS_ENABLED(CONFIG_OF_LIVE));
>>          if (ret) {
>> @@ -340,6 +347,12 @@ int dm_init_and_scan(bool pre_reloc_only)
>>                          debug("dm_scan_fdt() failed: %d\n", ret);
>>                          return ret;
>>                  }
>> +
>> +               /* bind fixed-clock */
>> +               node = fdt_path_offset(gd->fdt_blob, "/clocks");
> 
> This needs to support livetree, so I think you want ofnode_path() here.

Yes, i will update it

> 
>> +               if (node >= 0)
>> +                       dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
>> +                                        pre_reloc_only);
> 
> See dm_scan_fdt() for what you need to do here.

I have no choice, i need to use dm_scan_fdt_node() with clocks node's 
offset to force dt scan of clocks node to ensure that all its sub-node 
will be binded.

> 
>>          }
>>
>>          ret = dm_scan_other(pre_reloc_only);
>> --
>> 1.9.1
>>
> 
> Also please can you make sandbox have a clock in this node, and add a
> test for it to test/dm/clk.c ?

yes, sure

> 
> Regards,
> Simon

Thanks

Patrice

> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-08  9:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-31 15:12 [U-Boot] [RFC PATCH 1/1] dm: core: add clocks node scan patrice.chotard at st.com
2017-08-06  5:16 ` Simon Glass
2017-08-08  9:13   ` Patrice CHOTARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.