[U-Boot,i.MX8MM+CCF,12/41] clk: fixed_rate: add pre reloc flag
diff mbox series

Message ID 20190430103056.32537-13-peng.fan@nxp.com
State Needs Review / ACK
Delegated to: Stefano Babic
Headers show
Series
  • i.MX8MM + CCF
Related show

Commit Message

Peng Fan April 30, 2019, 10:18 a.m. UTC
Add pre reloc flag to use this driver before relocation

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/clk/clk_fixed_rate.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Lukasz Majewski May 6, 2019, 10:16 p.m. UTC | #1
On Tue, 30 Apr 2019 10:18:12 +0000
Peng Fan <peng.fan@nxp.com> wrote:

> Add pre reloc flag to use this driver before relocation
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/clk/clk_fixed_rate.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/clk_fixed_rate.c
> b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644
> --- a/drivers/clk/clk_fixed_rate.c
> +++ b/drivers/clk/clk_fixed_rate.c
> @@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
>  	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
>  	.platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
>  	.ops = &clk_fixed_rate_ops,
> +	.flags = DM_FLAG_PRE_RELOC,
>  };

This probably shall be done with proper dts file (from TPC70 - imx6q
conversion code):

+#include "imx6qdl-u-boot.dtsi"
+
+/ {
+	clocks {
+		u-boot,dm-spl;
+		osc {
+			u-boot,dm-spl;
+		};
+	};
+};
+
+&clks {
+	u-boot,dm-pre-reloc;
+};



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Peng Fan May 7, 2019, 1:29 p.m. UTC | #2
> Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag
> 
> On Tue, 30 Apr 2019 10:18:12 +0000
> Peng Fan <peng.fan@nxp.com> wrote:
> 
> > Add pre reloc flag to use this driver before relocation
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  drivers/clk/clk_fixed_rate.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/clk/clk_fixed_rate.c
> > b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644
> > --- a/drivers/clk/clk_fixed_rate.c
> > +++ b/drivers/clk/clk_fixed_rate.c
> > @@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
> >  	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
> >  	.platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
> >  	.ops = &clk_fixed_rate_ops,
> > +	.flags = DM_FLAG_PRE_RELOC,
> >  };
> 
> This probably shall be done with proper dts file (from TPC70 - imx6q
> conversion code):

My understanding is DM_FLAG_PRE_RELOC will let the driver could be used
before relocation. The dts u-boot,dm-spl or u-boot,dm-pre-reloc
is just to mark the device could be used at the corresponding stage.
Only modify dts will not make it work without the DM_FLAG_PRE_RELOC,
Right?

Thanks,
Peng.

> 
> +#include "imx6qdl-u-boot.dtsi"
> +
> +/ {
> +	clocks {
> +		u-boot,dm-spl;
> +		osc {
> +			u-boot,dm-spl;
> +		};
> +	};
> +};
> +
> +&clks {
> +	u-boot,dm-pre-reloc;
> +};
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de
Bin Meng May 7, 2019, 2 p.m. UTC | #3
Hi Peng,

On Tue, May 7, 2019 at 9:30 PM Peng Fan <peng.fan@nxp.com> wrote:
>
> > Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag
> >
> > On Tue, 30 Apr 2019 10:18:12 +0000
> > Peng Fan <peng.fan@nxp.com> wrote:
> >
> > > Add pre reloc flag to use this driver before relocation
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > >  drivers/clk/clk_fixed_rate.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/clk/clk_fixed_rate.c
> > > b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644
> > > --- a/drivers/clk/clk_fixed_rate.c
> > > +++ b/drivers/clk/clk_fixed_rate.c
> > > @@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
> > >     .ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
> > >     .platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
> > >     .ops = &clk_fixed_rate_ops,
> > > +   .flags = DM_FLAG_PRE_RELOC,
> > >  };
> >
> > This probably shall be done with proper dts file (from TPC70 - imx6q
> > conversion code):
>
> My understanding is DM_FLAG_PRE_RELOC will let the driver could be used
> before relocation. The dts u-boot,dm-spl or u-boot,dm-pre-reloc
> is just to mark the device could be used at the corresponding stage.
> Only modify dts will not make it work without the DM_FLAG_PRE_RELOC,
> Right?
>

I think your understanding is correct. For device tree that cannot be
modified by U-Boot, eg: DT passed from previous bootloader, the only
way to support pre-relocation binding is to add DM_FLAG_PRE_RELOC in
the U-Boot driver.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Regards,
Bin
Lukasz Majewski May 8, 2019, 6:57 a.m. UTC | #4
On Tue, 7 May 2019 13:29:41 +0000
Peng Fan <peng.fan@nxp.com> wrote:

> > Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag
> > 
> > On Tue, 30 Apr 2019 10:18:12 +0000
> > Peng Fan <peng.fan@nxp.com> wrote:
> >   
> > > Add pre reloc flag to use this driver before relocation
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > >  drivers/clk/clk_fixed_rate.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/clk/clk_fixed_rate.c
> > > b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644
> > > --- a/drivers/clk/clk_fixed_rate.c
> > > +++ b/drivers/clk/clk_fixed_rate.c
> > > @@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
> > >  	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
> > >  	.platdata_auto_alloc_size = sizeof(struct
> > > clk_fixed_rate), .ops = &clk_fixed_rate_ops,
> > > +	.flags = DM_FLAG_PRE_RELOC,
> > >  };  
> > 
> > This probably shall be done with proper dts file (from TPC70 - imx6q
> > conversion code):  
> 
> My understanding is DM_FLAG_PRE_RELOC will let the driver could be
> used before relocation. 

I think that there is OR -> DM_FLAG_PRE_RELOC OR DTS
attribute (u-boot,dm-spl {pre-reloc}) to use device in early SPL.

Please look into drivers/core/lists.c Line 175:

if (pre_reloc_only) {
if (!dm_ofnode_pre_reloc(node)·&&
	!(entry->flags & DM_FLAG_PRE_RELOC))
	return 0;
}                                                                                                                                                                                                                             

We do not bind device only if there is NO DM_FLAG_PRE_RELOC set AND the
u-boot,dm-* property is not set in corresponding DTS node.

> The dts u-boot,dm-spl or u-boot,dm-pre-reloc
> is just to mark the device could be used at the corresponding stage.
> Only modify dts will not make it work without the DM_FLAG_PRE_RELOC,
> Right?
> 
> Thanks,
> Peng.
> 
> > 
> > +#include "imx6qdl-u-boot.dtsi"
> > +
> > +/ {
> > +	clocks {
> > +		u-boot,dm-spl;
> > +		osc {
> > +			u-boot,dm-spl;
> > +		};
> > +	};
> > +};
> > +
> > +&clks {
> > +	u-boot,dm-pre-reloc;
> > +};
> > 
> > 
> > 
> > Best regards,
> > 
> > Lukasz Majewski
> > 
> > --
> > 
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > lukma@denx.de  




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Lukasz Majewski May 8, 2019, 7 a.m. UTC | #5
On Tue, 7 May 2019 22:00:14 +0800
Bin Meng <bmeng.cn@gmail.com> wrote:

> Hi Peng,
> 
> On Tue, May 7, 2019 at 9:30 PM Peng Fan <peng.fan@nxp.com> wrote:
> >  
> > > Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc
> > > flag
> > >
> > > On Tue, 30 Apr 2019 10:18:12 +0000
> > > Peng Fan <peng.fan@nxp.com> wrote:
> > >  
> > > > Add pre reloc flag to use this driver before relocation
> > > >
> > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > ---
> > > >  drivers/clk/clk_fixed_rate.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/drivers/clk/clk_fixed_rate.c
> > > > b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463
> > > > 100644 --- a/drivers/clk/clk_fixed_rate.c
> > > > +++ b/drivers/clk/clk_fixed_rate.c
> > > > @@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
> > > >     .ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
> > > >     .platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
> > > >     .ops = &clk_fixed_rate_ops,
> > > > +   .flags = DM_FLAG_PRE_RELOC,
> > > >  };  
> > >
> > > This probably shall be done with proper dts file (from TPC70 -
> > > imx6q conversion code):  
> >
> > My understanding is DM_FLAG_PRE_RELOC will let the driver could be
> > used before relocation. The dts u-boot,dm-spl or u-boot,dm-pre-reloc
> > is just to mark the device could be used at the corresponding stage.
> > Only modify dts will not make it work without the DM_FLAG_PRE_RELOC,
> > Right?
> >  
> 
> I think your understanding is correct. For device tree that cannot be
> modified by U-Boot, eg: DT passed from previous bootloader, the only
> way to support pre-relocation binding is to add DM_FLAG_PRE_RELOC in
> the U-Boot driver.

But as fair as I understand - the discussion is about SPL, not u-boot's
proper pre-location stage.

Please correct me if I'm wrong, but the recent code removes from
u-boot's proper DTS u-boot,dm-* properties.

> 
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> 
> Regards,
> Bin




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Peng Fan May 8, 2019, 7:21 a.m. UTC | #6
> Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag
> 
> On Tue, 7 May 2019 13:29:41 +0000
> Peng Fan <peng.fan@nxp.com> wrote:
> 
> > > Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag
> > >
> > > On Tue, 30 Apr 2019 10:18:12 +0000
> > > Peng Fan <peng.fan@nxp.com> wrote:
> > >
> > > > Add pre reloc flag to use this driver before relocation
> > > >
> > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > ---
> > > >  drivers/clk/clk_fixed_rate.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/drivers/clk/clk_fixed_rate.c
> > > > b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644
> > > > --- a/drivers/clk/clk_fixed_rate.c
> > > > +++ b/drivers/clk/clk_fixed_rate.c
> > > > @@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
> > > >  	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
> > > >  	.platdata_auto_alloc_size = sizeof(struct clk_fixed_rate), .ops
> > > > = &clk_fixed_rate_ops,
> > > > +	.flags = DM_FLAG_PRE_RELOC,
> > > >  };
> > >
> > > This probably shall be done with proper dts file (from TPC70 - imx6q
> > > conversion code):
> >
> > My understanding is DM_FLAG_PRE_RELOC will let the driver could be
> > used before relocation.
> 
> I think that there is OR -> DM_FLAG_PRE_RELOC OR DTS attribute
> (u-boot,dm-spl {pre-reloc}) to use device in early SPL.
> 
> Please look into drivers/core/lists.c Line 175:
> 
> if (pre_reloc_only) {
> if (!dm_ofnode_pre_reloc(node)·&&
> 	!(entry->flags & DM_FLAG_PRE_RELOC))
> 	return 0;
> }

ok, this is new code from Bin.
According this code, only need dts change is enough, no need this driver flag.
I'll drop this patch.

Thanks,
Peng.


> 
> We do not bind device only if there is NO DM_FLAG_PRE_RELOC set AND the
> u-boot,dm-* property is not set in corresponding DTS node.
> 
> > The dts u-boot,dm-spl or u-boot,dm-pre-reloc is just to mark the
> > device could be used at the corresponding stage.
> > Only modify dts will not make it work without the DM_FLAG_PRE_RELOC,
> > Right?
> >
> > Thanks,
> > Peng.
> >
> > >
> > > +#include "imx6qdl-u-boot.dtsi"
> > > +
> > > +/ {
> > > +	clocks {
> > > +		u-boot,dm-spl;
> > > +		osc {
> > > +			u-boot,dm-spl;
> > > +		};
> > > +	};
> > > +};
> > > +
> > > +&clks {
> > > +	u-boot,dm-pre-reloc;
> > > +};
> > >
> > >
> > >
> > > Best regards,
> > >
> > > Lukasz Majewski
> > >
> > > --
> > >
> > > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > > Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > > lukma@denx.de
> 
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de

Patch
diff mbox series

diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c
index 069e643fbc..debada1463 100644
--- a/drivers/clk/clk_fixed_rate.c
+++ b/drivers/clk/clk_fixed_rate.c
@@ -45,4 +45,5 @@  U_BOOT_DRIVER(clk_fixed_rate) = {
 	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
 	.ops = &clk_fixed_rate_ops,
+	.flags = DM_FLAG_PRE_RELOC,
 };