Re: [U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files

2019-10-24 Thread Simon Goldschmidt

Am 24.10.2019 um 19:29 schrieb Dalon L Westergreen:



On Thu, 2019-10-24 at 16:29 +0200, Simon Goldschmidt wrote:

On Thu, Oct 24, 2019 at 4:25 PM Dalon L Westergreen
<
dalon.westergr...@linux.intel.com
 
> wrote:




On Wed, 2019-10-23 at 21:22 +0200, Simon Goldschmidt wrote:

Am 23.10.2019 um 18:03 schrieb Dalon L Westergreen:



On Tue, 2019-10-22 at 19:13 +0200, Simon Goldschmidt wrote:



Dalon L Westergreen <

dalon.westergr...@linux.intel.com
 




mailto:dalon.westergr...@linux.intel.com>



schrieb am Di., 22. Okt.


2019, 19:10:

I mentioned this before, it would be great to not rely on the

generated files

and do this based purely on the handoff data generated during a quartus

build. Did you look at the python source i pointed you to?


No, not yet. But I don't think that will be a problem. I sent this

series mainly to discuss the dts format (boardspecific handoff dtsi vs

genetic dtsi plus boardspecific header file).


The board specific dtsi does look cleaner, but i do like the simplicity

of generating the header in arria10.


I could easily replicate what you do, generate the header, and use it to

create the dtsi.


I'm not too fond myself of that tool I created, as it requires you to

have a compiler. I just was too lazy write a script for that.


However, I would prefer having a script that does it. And if the sources

are quartus output files instead of existing qts files, my tool doesn't

work any more, anway.


So I think we should come up with a script (e.g. sh or py) that parses

quartus output and creates a handoff dtsi (without a header). We'll only

need something different for converting existing qts files then...


In that case, i would stick with adding a .h file along with a common handoff 
dtsi as i did
in the a10 filter script i sent the other week. I would suggest your source is 
perfect
for migrating existing c5/a5 platforms.


Why can't we change that a10 script to create handoff dtsi files as well?


I just dont like building the dtsi in source, the code to create a 
header is simpler and cleaner. From
a files perspective, 1 dtsi + a header for each board, or a dtsi for 
each board, not sure there is much

difference either way. but using headers keeps the utility simpler.


Well, you're right that writing the conversion tool is probably simpler 
when creating a header file compared to a dtsi. On the other hand, it 
only has to be written once, so it should not be too much of an issue?


However, looking at arch/arm/dts, socfpga would be the first mach to add 
board specific header files. I don't know if it's acceptable to do it 
like that? I'm not the gatekeeper here :-)


Regards,
Simon



--dalon





Is there a preference for python? It would fit nicely b/c we could re-use the 
code
I pointed out previously for binary parsing.


Well, *my* preference would be to not depend on having gcc installed to convert
from quartus output to dtsi. I just did that because C was easier to
get started.

I'm not a big fan of python, but since it's used everywhere in U-Boot, I
figured it should be ok? Having a standard shell script do the job would even
lower the requirements of course.

Regards,
Simon



Dinh, Marek, Ley Foon, comments?

--dalon


Regards,

Simon



--dalon



I still favor boardspecific handoff dtsi, but I would like to use the

same style for all socfpga flavours.


Plus this tool is required to convert existing boards where we don't

have the quartus project files at hand.


Regards,

Simon



--dalon


On Tue, 2019-10-15 at 22:10 +0200, Simon Goldschmidt wrote:

This new tool converts handoff information from quartus to "*_handoff.dtsi"

devicetree files. This is in preparation to move from ad-hoc code in arch

that parses the 'qts' header files to drivers parsing the same information

from devicetree.


Converting existing U-Boot 'qts' files is also supported.


Signed-off-by: Simon Goldschmidt <

simon.k.r.goldschm...@gmail.com
 



  mailto:simon.k.r.goldschm...@gmail.com>







---


Changes in v2: None


   arch/arm/mach-socfpga/create_handoff_gen5.c | 660 

   arch/arm/mach-socfpga/qts-to-handoff.sh |  83 +++

   2 files changed, 743 insertions(+)

   create mode 100644 arch/arm/mach-socfpga/create_handoff_gen5.c

   create mode 100755 arch/arm/mach-socfpga/qts-to-handoff.sh


diff --git a/arch/arm/mach-socfpga/create_handoff_gen5.c 
b/arch/arm/mach-socfpga/create_handoff_gen5.c

new file mode 100644

index 00..6ec436719d

--- /dev/null

+++ b/arch/arm/mach-socfpga/create_handoff_gen5.c

@@ -0,0 +1,660 @@

+// SPDX-License-Identifier: GPL-2.0

+/*

+ * This is a host-tool that needs to be compiled per board and prints the

+ * handoff.dtsi to stdout.

+ */

+

+#include 

+#include 

+

+/* Define kernel types */

+typedef uint8_t u8;

+typedef uint32_t u32;

+

+#ifdef USE_QUARTUS_OUTPUT

+#ifdef

Re: [U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files

2019-10-24 Thread Dalon L Westergreen


On Thu, 2019-10-24 at 16:29 +0200, Simon Goldschmidt wrote:
> On Thu, Oct 24, 2019 at 4:25 PM Dalon L Westergreen<
> dalon.westergr...@linux.intel.com> wrote:
> > 
> > On Wed, 2019-10-23 at 21:22 +0200, Simon Goldschmidt wrote:
> > Am 23.10.2019 um 18:03 schrieb Dalon L Westergreen:
> > 
> > 
> > On Tue, 2019-10-22 at 19:13 +0200, Simon Goldschmidt wrote:
> > 
> > 
> > Dalon L Westergreen <
> > dalon.westergr...@linux.intel.com
> > 
> > 
> > 
> >  > dalon.westergr...@linux.intel.com
> > 
> > > > schrieb am Di., 22. Okt.
> > 
> > 2019, 19:10:
> > I mentioned this before, it would be great to not rely on the
> > generated files
> > and do this based purely on the handoff data generated during a quartus
> > build. Did you look at the python source i pointed you to?
> > 
> > No, not yet. But I don't think that will be a problem. I sent this
> > series mainly to discuss the dts format (boardspecific handoff dtsi vs
> > genetic dtsi plus boardspecific header file).
> > 
> > The board specific dtsi does look cleaner, but i do like the simplicity
> > of generating the header in arria10.
> > 
> > I could easily replicate what you do, generate the header, and use it to
> > create the dtsi.
> > 
> > I'm not too fond myself of that tool I created, as it requires you to
> > have a compiler. I just was too lazy write a script for that.
> > 
> > However, I would prefer having a script that does it. And if the sources
> > are quartus output files instead of existing qts files, my tool doesn't
> > work any more, anway.
> > 
> > So I think we should come up with a script (e.g. sh or py) that parses
> > quartus output and creates a handoff dtsi (without a header). We'll only
> > need something different for converting existing qts files then...
> > 
> > In that case, i would stick with adding a .h file along with a common
> > handoff dtsi as i didin the a10 filter script i sent the other week. I would
> > suggest your source is perfectfor migrating existing c5/a5 platforms.
> 
> Why can't we change that a10 script to create handoff dtsi files as well?

I just dont like building the dtsi in source, the code to create a header is
simpler and cleaner.  Froma files perspective, 1 dtsi + a header for each board,
or a dtsi for each board, not sure there is muchdifference either way.  but
using headers keeps the utility simpler.
--dalon
> > Is there a preference for python? It would fit nicely b/c we could re-use
> > the codeI pointed out previously for binary parsing.
> 
> Well, *my* preference would be to not depend on having gcc installed to
> convertfrom quartus output to dtsi. I just did that because C was easier toget
> started.
> I'm not a big fan of python, but since it's used everywhere in U-Boot,
> Ifigured it should be ok? Having a standard shell script do the job would
> evenlower the requirements of course.
> Regards,Simon
> > Dinh, Marek, Ley Foon, comments?
> > --dalon
> > 
> > Regards,
> > Simon
> > 
> > 
> > --dalon
> > 
> > 
> > I still favor boardspecific handoff dtsi, but I would like to use the
> > same style for all socfpga flavours.
> > 
> > Plus this tool is required to convert existing boards where we don't
> > have the quartus project files at hand.
> > 
> > Regards,
> > Simon
> > 
> > 
> > --dalon
> > 
> > On Tue, 2019-10-15 at 22:10 +0200, Simon Goldschmidt wrote:
> > This new tool converts handoff information from quartus to "*_handoff.dtsi"
> > devicetree files. This is in preparation to move from ad-hoc code in arch
> > that parses the 'qts' header files to drivers parsing the same information
> > from devicetree.
> > 
> > Converting existing U-Boot 'qts' files is also supported.
> > 
> > Signed-off-by: Simon Goldschmidt <
> > simon.k.r.goldschm...@gmail.com
> > 
> > 
> >   > simon.k.r.goldschm...@gmail.com
> > 
> > 
> > ---
> > 
> > Changes in v2: None
> > 
> >   arch/arm/mach-socfpga/create_handoff_gen5.c | 660 
> >   arch/arm/mach-socfpga/qts-to-handoff.sh |  83 +++
> >   2 files changed, 743 insertions(+)
> >   create mode 100644 arch/arm/mach-socfpga/create_handoff_gen5.c
> >   create mode 100755 arch/arm/mach-socfpga/qts-to-handoff.sh
> > 
> > diff --git a/arch/arm/mach-socfpga/create_handoff_gen5.c b/arch/arm/mach-
> > socfpga/create_handoff_gen5.c
> > new file mode 100644
> > index 00..6ec436719d
> > --- /dev/null
> > +++ b/arch/arm/mach-socfpga/create_handoff_gen5.c
> > @@ -0,0 +1,660 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * This is a host-tool that needs to be compiled per board and prints the
> > + * handoff.dtsi to stdout.
> > + */
> > +
> > +#include 
> > +#include 
> > +
> > +/* Define kernel types */
> > +typedef uint8_t u8;
> > +typedef uint32_t u32;
> > +
> > +#ifdef USE_QUARTUS_OUTPUT
> > +#ifdef ARRIA5
> > +#include "iocsr_config_arria5.c"
> > +#include "pinmux_config_arria5.c"
> > +#else
> > +#include "iocsr_config_cyclone5.c"
> > +#include "pinmux_config_cyclone5.c"
> > +#endif
> > +#include "pll_config.h"
> > +#include "sdram/s

Re: [U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files

2019-10-24 Thread Simon Goldschmidt
On Thu, Oct 24, 2019 at 4:25 PM Dalon L Westergreen
 wrote:
>
>
>
> On Wed, 2019-10-23 at 21:22 +0200, Simon Goldschmidt wrote:
>
> Am 23.10.2019 um 18:03 schrieb Dalon L Westergreen:
>
>
>
> On Tue, 2019-10-22 at 19:13 +0200, Simon Goldschmidt wrote:
>
>
>
> Dalon L Westergreen <
>
> dalon.westergr...@linux.intel.com
>
>
>
> 
> dalon.westergr...@linux.intel.com
>
> >> schrieb am Di., 22. Okt.
>
> 2019, 19:10:
>
> I mentioned this before, it would be great to not rely on the
>
> generated files
>
> and do this based purely on the handoff data generated during a quartus
>
> build. Did you look at the python source i pointed you to?
>
>
> No, not yet. But I don't think that will be a problem. I sent this
>
> series mainly to discuss the dts format (boardspecific handoff dtsi vs
>
> genetic dtsi plus boardspecific header file).
>
>
> The board specific dtsi does look cleaner, but i do like the simplicity
>
> of generating the header in arria10.
>
>
> I could easily replicate what you do, generate the header, and use it to
>
> create the dtsi.
>
>
> I'm not too fond myself of that tool I created, as it requires you to
>
> have a compiler. I just was too lazy write a script for that.
>
>
> However, I would prefer having a script that does it. And if the sources
>
> are quartus output files instead of existing qts files, my tool doesn't
>
> work any more, anway.
>
>
> So I think we should come up with a script (e.g. sh or py) that parses
>
> quartus output and creates a handoff dtsi (without a header). We'll only
>
> need something different for converting existing qts files then...
>
>
> In that case, i would stick with adding a .h file along with a common handoff 
> dtsi as i did
> in the a10 filter script i sent the other week. I would suggest your source 
> is perfect
> for migrating existing c5/a5 platforms.

Why can't we change that a10 script to create handoff dtsi files as well?

>
> Is there a preference for python? It would fit nicely b/c we could re-use the 
> code
> I pointed out previously for binary parsing.

Well, *my* preference would be to not depend on having gcc installed to convert
from quartus output to dtsi. I just did that because C was easier to
get started.

I'm not a big fan of python, but since it's used everywhere in U-Boot, I
figured it should be ok? Having a standard shell script do the job would even
lower the requirements of course.

Regards,
Simon

>
> Dinh, Marek, Ley Foon, comments?
>
> --dalon
>
>
> Regards,
>
> Simon
>
>
>
> --dalon
>
>
>
> I still favor boardspecific handoff dtsi, but I would like to use the
>
> same style for all socfpga flavours.
>
>
> Plus this tool is required to convert existing boards where we don't
>
> have the quartus project files at hand.
>
>
> Regards,
>
> Simon
>
>
>
> --dalon
>
>
> On Tue, 2019-10-15 at 22:10 +0200, Simon Goldschmidt wrote:
>
> This new tool converts handoff information from quartus to "*_handoff.dtsi"
>
> devicetree files. This is in preparation to move from ad-hoc code in arch
>
> that parses the 'qts' header files to drivers parsing the same information
>
> from devicetree.
>
>
> Converting existing U-Boot 'qts' files is also supported.
>
>
> Signed-off-by: Simon Goldschmidt <
>
> simon.k.r.goldschm...@gmail.com
>
>
>  
> simon.k.r.goldschm...@gmail.com
>
> >
>
>
> ---
>
>
> Changes in v2: None
>
>
>   arch/arm/mach-socfpga/create_handoff_gen5.c | 660 
>
>   arch/arm/mach-socfpga/qts-to-handoff.sh |  83 +++
>
>   2 files changed, 743 insertions(+)
>
>   create mode 100644 arch/arm/mach-socfpga/create_handoff_gen5.c
>
>   create mode 100755 arch/arm/mach-socfpga/qts-to-handoff.sh
>
>
> diff --git a/arch/arm/mach-socfpga/create_handoff_gen5.c 
> b/arch/arm/mach-socfpga/create_handoff_gen5.c
>
> new file mode 100644
>
> index 00..6ec436719d
>
> --- /dev/null
>
> +++ b/arch/arm/mach-socfpga/create_handoff_gen5.c
>
> @@ -0,0 +1,660 @@
>
> +// SPDX-License-Identifier: GPL-2.0
>
> +/*
>
> + * This is a host-tool that needs to be compiled per board and prints the
>
> + * handoff.dtsi to stdout.
>
> + */
>
> +
>
> +#include 
>
> +#include 
>
> +
>
> +/* Define kernel types */
>
> +typedef uint8_t u8;
>
> +typedef uint32_t u32;
>
> +
>
> +#ifdef USE_QUARTUS_OUTPUT
>
> +#ifdef ARRIA5
>
> +#include "iocsr_config_arria5.c"
>
> +#include "pinmux_config_arria5.c"
>
> +#else
>
> +#include "iocsr_config_cyclone5.c"
>
> +#include "pinmux_config_cyclone5.c"
>
> +#endif
>
> +#include "pll_config.h"
>
> +#include "sdram/sdram_config.h"
>
> +#include "sequencer_auto.h"
>
> +#include "sequencer_defines.h"
>
> +#include "sequencer_auto_ac_init.c"
>
> +#include "sequencer_auto_inst_init.c"
>
> +#define RW_MGR(x) __RW_MGR_##x
>
> +#else
>
> +#define RW_MGR(x) RW_MGR_##x
>
> +#include 
>
> +#include 
>
> +#include 
>
> +#include 
>
> +#endif
>
> +
>
> +#include "include/mach/clock_manager_gen5.h"
>
> +#include "include/mach/sdram_gen5.h"
>
> +
>
> +#ifndef ARRAY_SIZE
>
> +#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))

Re: [U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files

2019-10-24 Thread Dalon L Westergreen


On Wed, 2019-10-23 at 21:22 +0200, Simon Goldschmidt wrote:
> Am 23.10.2019 um 18:03 schrieb Dalon L Westergreen:
> > On Tue, 2019-10-22 at 19:13 +0200, Simon Goldschmidt wrote:
> > > Dalon L Westergreen  > > dalon.westergr...@linux.intel.com>> schrieb am Di., 22. Okt. 2019, 19:10:
> > > > I mentioned this before, it would be great to not rely on the generated
> > > > filesand do this based purely on the handoff data generated during a
> > > > quartusbuild. Did you look at the python source i pointed you to?
> > > 
> > > No, not yet. But I don't think that will be a problem. I sent this series
> > > mainly to discuss the dts format (boardspecific handoff dtsi vs genetic
> > > dtsi plus boardspecific header file).
> > 
> > The board specific dtsi does look cleaner, but i do like the simplicity of
> > generating the header in arria10.
> > I could easily replicate what you do, generate the header, and use it to
> > create the dtsi.
> 
> I'm not too fond myself of that tool I created, as it requires you to have a
> compiler. I just was too lazy write a script for that.
> However, I would prefer having a script that does it. And if the sources are
> quartus output files instead of existing qts files, my tool doesn't work any
> more, anway.
> So I think we should come up with a script (e.g. sh or py) that parses quartus
> output and creates a handoff dtsi (without a header). We'll only need
> something different for converting existing qts files then...

In that case, i would stick with adding a .h file along with a common handoff
dtsi as i didin the a10 filter script i sent the other week. I would suggest
your source is perfectfor migrating existing c5/a5 platforms.
Is there a preference for python?  It would fit nicely b/c we could re-use the
codeI pointed out previously for binary parsing.
Dinh, Marek, Ley Foon, comments?
--dalon
> Regards,Simon
> > --dalon
> > > I still favor boardspecific handoff dtsi, but I would like to use the same
> > > style for all socfpga flavours.
> > > Plus this tool is required to convert existing boards where we don't have
> > > the quartus project files at hand.
> > > Regards,Simon
> > > > --dalon
> > > > On Tue, 2019-10-15 at 22:10 +0200, Simon Goldschmidt wrote:
> > > > > This new tool converts handoff information from quartus to
> > > > > "*_handoff.dtsi"devicetree files. This is in preparation to move from
> > > > > ad-hoc code in archthat parses the 'qts' header files to drivers
> > > > > parsing the same informationfrom devicetree.
> > > > > Converting existing U-Boot 'qts' files is also supported.
> > > > > Signed-off-by: Simon Goldschmidt  > > > >  
> > > > > ---
> > > > > Changes in v2: None
> > > > >   arch/arm/mach-socfpga/create_handoff_gen5.c | 660
> > > > >   arch/arm/mach-socfpga/qts-to-
> > > > > handoff.sh |  83 +++  2 files changed, 743 insertions(+)  create
> > > > > mode 100644 arch/arm/mach-socfpga/create_handoff_gen5.c  create mode
> > > > > 100755 arch/arm/mach-socfpga/qts-to-handoff.sh
> > > > > diff --git a/arch/arm/mach-socfpga/create_handoff_gen5.c
> > > > > b/arch/arm/mach-socfpga/create_handoff_gen5.cnew file mode 100644index
> > > > > 00..6ec436719d--- /dev/null+++ b/arch/arm/mach-
> > > > > socfpga/create_handoff_gen5.c@@ -0,0 +1,660 @@+// SPDX-License-
> > > > > Identifier: GPL-2.0+/*+ * This is a host-tool that needs to be
> > > > > compiled per board and prints the+ * handoff.dtsi to stdout.+
> > > > > */++#include +#include ++/* Define kernel types
> > > > > */+typedef uint8_t u8;+typedef uint32_t u32;++#ifdef
> > > > > USE_QUARTUS_OUTPUT+#ifdef ARRIA5+#include
> > > > > "iocsr_config_arria5.c"+#include
> > > > > "pinmux_config_arria5.c"+#else+#include
> > > > > "iocsr_config_cyclone5.c"+#include
> > > > > "pinmux_config_cyclone5.c"+#endif+#include "pll_config.h"+#include
> > > > > "sdram/sdram_config.h"+#include "sequencer_auto.h"+#include
> > > > > "sequencer_defines.h"+#include "sequencer_auto_ac_init.c"+#include
> > > > > "sequencer_auto_inst_init.c"+#define RW_MGR(x)
> > > > > __RW_MGR_##x+#else+#define RW_MGR(x) RW_MGR_##x+#include
> > > > > +#include +#include
> > > > > +#include +#endif++#include
> > > > > "include/mach/clock_manager_gen5.h"+#include
> > > > > "include/mach/sdram_gen5.h"++#ifndef ARRAY_SIZE+#define ARRAY_SIZE(x)
> > > > > (sizeof(x)/sizeof((x)[0]))+#endif++const char handoff_dtsi_hdr[] =+   
> > > > > "// SPDX-License-Identifier: GPL-2.0\n"+  "/*\n"+ " * > > > > generated>\n"+" * This code was generated by a tool
> > > > > based on\n"+  " * handoffs from both Qsys and Quartus.\n"+
> > > > > " *\n"+   " * Changes to this file may be lost if\n"+ " * 
> > > > > the code is regenerated.\n"+  " *\n"+" 
> > > > > */\n";++/*
> > > > > Wrap PLL config */++#define MAIN_VCO_BASE (   
> > > > > 
> > > > > \+(CONFIG_HPS_MAINPLLGRP_VCO_DENOM << \+  
> > 

Re: [U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files

2019-10-23 Thread Simon Goldschmidt

Am 23.10.2019 um 18:03 schrieb Dalon L Westergreen:



On Tue, 2019-10-22 at 19:13 +0200, Simon Goldschmidt wrote:



Dalon L Westergreen > schrieb am Di., 22. Okt. 
2019, 19:10:
I mentioned this before, it would be great to not rely on the 
generated files

and do this based purely on the handoff data generated during a quartus
build. Did you look at the python source i pointed you to?


No, not yet. But I don't think that will be a problem. I sent this 
series mainly to discuss the dts format (boardspecific handoff dtsi vs 
genetic dtsi plus boardspecific header file).


The board specific dtsi does look cleaner, but i do like the simplicity 
of generating the header in arria10.


I could easily replicate what you do, generate the header, and use it to 
create the dtsi.


I'm not too fond myself of that tool I created, as it requires you to 
have a compiler. I just was too lazy write a script for that.


However, I would prefer having a script that does it. And if the sources 
are quartus output files instead of existing qts files, my tool doesn't 
work any more, anway.


So I think we should come up with a script (e.g. sh or py) that parses 
quartus output and creates a handoff dtsi (without a header). We'll only 
need something different for converting existing qts files then...


Regards,
Simon



--dalon



I still favor boardspecific handoff dtsi, but I would like to use the 
same style for all socfpga flavours.


Plus this tool is required to convert existing boards where we don't 
have the quartus project files at hand.


Regards,
Simon



--dalon

On Tue, 2019-10-15 at 22:10 +0200, Simon Goldschmidt wrote:

This new tool converts handoff information from quartus to "*_handoff.dtsi"
devicetree files. This is in preparation to move from ad-hoc code in arch
that parses the 'qts' header files to drivers parsing the same information
from devicetree.

Converting existing U-Boot 'qts' files is also supported.

Signed-off-by: Simon Goldschmidt <
simon.k.r.goldschm...@gmail.com
 
>
---

Changes in v2: None

  arch/arm/mach-socfpga/create_handoff_gen5.c | 660 
  arch/arm/mach-socfpga/qts-to-handoff.sh |  83 +++
  2 files changed, 743 insertions(+)
  create mode 100644 arch/arm/mach-socfpga/create_handoff_gen5.c
  create mode 100755 arch/arm/mach-socfpga/qts-to-handoff.sh

diff --git a/arch/arm/mach-socfpga/create_handoff_gen5.c 
b/arch/arm/mach-socfpga/create_handoff_gen5.c
new file mode 100644
index 00..6ec436719d
--- /dev/null
+++ b/arch/arm/mach-socfpga/create_handoff_gen5.c
@@ -0,0 +1,660 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * This is a host-tool that needs to be compiled per board and prints the
+ * handoff.dtsi to stdout.
+ */
+
+#include 
+#include 
+
+/* Define kernel types */
+typedef uint8_t u8;
+typedef uint32_t u32;
+
+#ifdef USE_QUARTUS_OUTPUT
+#ifdef ARRIA5
+#include "iocsr_config_arria5.c"
+#include "pinmux_config_arria5.c"
+#else
+#include "iocsr_config_cyclone5.c"
+#include "pinmux_config_cyclone5.c"
+#endif
+#include "pll_config.h"
+#include "sdram/sdram_config.h"
+#include "sequencer_auto.h"
+#include "sequencer_defines.h"
+#include "sequencer_auto_ac_init.c"
+#include "sequencer_auto_inst_init.c"
+#define RW_MGR(x) __RW_MGR_##x
+#else
+#define RW_MGR(x) RW_MGR_##x
+#include 
+#include 
+#include 
+#include 
+#endif
+
+#include "include/mach/clock_manager_gen5.h"
+#include "include/mach/sdram_gen5.h"
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
+#endif
+
+const char handoff_dtsi_hdr[] =
+   "// SPDX-License-Identifier: GPL-2.0\n"
+   "/*\n"
+   " *\n"
+   " *This code was generated by a tool based on\n"
+   " *handoffs from both Qsys and Quartus.\n"
+   " *\n"
+   " *Changes to this file may be lost if\n"
+   " *the code is regenerated.\n"
+   " *\n"
+   " */\n";
+
+/* Wrap PLL config */
+
+#define MAIN_VCO_BASE (\
+   (CONFIG_HPS_MAINPLLGRP_VCO_DENOM <<   \
+   CLKMGR_MAINPLLGRP_VCO_DENOM_OFFSET) |   \
+   (CONFIG_HPS_MAINPLLGRP_VCO_NUMER <<   \
+   CLKMGR_MAINPLLGRP_VCO_NUMER_OFFSET) \
+   )
+
+#define PERI_VCO_BASE (\
+   (CONFIG_HPS_PERPLLGRP_VCO_PSRC << \
+   CLKMGR_PERPLLGRP_VCO_PSRC_OFFSET) | \
+   (CONFIG_HPS_PERPLLGRP_VCO_DENOM <<\
+   CLKMGR_PERPLLGRP_VCO_DENOM_OFFSET) |\
+   (CONFIG_HPS_PERPLLGRP_VCO_NUMER <<\
+   CLKMGR_PERPLLGRP_VCO_NUMER_OFFSET)  \
+   )
+
+#define SDR_VCO_BASE ( \
+   (CONFIG_HPS_SDRPLLGRP_VCO_SSRC << \
+   CLKMGR_SDRPLLGRP_VCO_SSRC_OFFSET) | \
+   (CONFIG_HPS_SDRPLLGRP_VCO_DENOM <<\
+   CLKMGR_SDRPLLGRP

Re: [U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files

2019-10-23 Thread Dalon L Westergreen


On Tue, 2019-10-22 at 19:13 +0200, Simon Goldschmidt wrote:
> Dalon L Westergreen  schrieb am Di., 22.
> Okt. 2019, 19:10:
> > I mentioned this before, it would be great to not rely on the generated
> > files
> > and do this based purely on the handoff data generated during a quartus
> > build.  Did you look at the python source i pointed you to?
> 
> No, not yet. But I don't think that will be a problem. I sent this series
> mainly to discuss the dts format (boardspecific handoff dtsi vs genetic dtsi
> plus boardspecific header file).

The board specific dtsi does look cleaner, but i do like the simplicity of
generating the header in arria10.
I could easily replicate what you do, generate the header, and use it to create
the dtsi.
--dalon
> I still favor boardspecific handoff dtsi, but I would like to use the same
> style for all socfpga flavours.
> 
> Plus this tool is required to convert existing boards where we don't have the
> quartus project files at hand.
> 
> Regards,
> Simon
> 
> > --dalon
> > On Tue, 2019-10-15 at 22:10 +0200, Simon Goldschmidt wrote:
> > > This new tool converts handoff information from quartus to
> > > "*_handoff.dtsi"devicetree files. This is in preparation to move from ad-
> > > hoc code in archthat parses the 'qts' header files to drivers parsing the
> > > same informationfrom devicetree.
> > > Converting existing U-Boot 'qts' files is also supported.
> > > Signed-off-by: Simon Goldschmidt ---
> > > Changes in v2: None
> > >  arch/arm/mach-socfpga/create_handoff_gen5.c | 660 
> > > arch/arm/mach-socfpga/qts-to-handoff.sh |  83 +++ 2 files changed, 743
> > > insertions(+) create mode 100644 arch/arm/mach-
> > > socfpga/create_handoff_gen5.c create mode 100755 arch/arm/mach-
> > > socfpga/qts-to-handoff.sh
> > > diff --git a/arch/arm/mach-socfpga/create_handoff_gen5.c b/arch/arm/mach-
> > > socfpga/create_handoff_gen5.cnew file mode 100644index
> > > 00..6ec436719d--- /dev/null+++ b/arch/arm/mach-
> > > socfpga/create_handoff_gen5.c@@ -0,0 +1,660 @@+// 
> > > SPDX-License-Identifier: 
> > > GPL-2.0+/*+ * This is a host-tool that needs to be compiled per board and
> > > prints the+ * handoff.dtsi to stdout.+ */++#include +#include
> > > ++/* Define kernel types */+typedef uint8_t u8;+typedef uint32_t
> > > u32;++#ifdef USE_QUARTUS_OUTPUT+#ifdef ARRIA5+#include
> > > "iocsr_config_arria5.c"+#include "pinmux_config_arria5.c"+#else+#include
> > > "iocsr_config_cyclone5.c"+#include
> > > "pinmux_config_cyclone5.c"+#endif+#include "pll_config.h"+#include
> > > "sdram/sdram_config.h"+#include "sequencer_auto.h"+#include
> > > "sequencer_defines.h"+#include "sequencer_auto_ac_init.c"+#include
> > > "sequencer_auto_inst_init.c"+#define RW_MGR(x) __RW_MGR_##x+#else+#define
> > > RW_MGR(x) RW_MGR_##x+#include +#include
> > > +#include +#include
> > > +#endif++#include
> > > "include/mach/clock_manager_gen5.h"+#include
> > > "include/mach/sdram_gen5.h"++#ifndef ARRAY_SIZE+#define ARRAY_SIZE(x)
> > > (sizeof(x)/sizeof((x)[0]))+#endif++const char handoff_dtsi_hdr[] =+   
> > > "// SPDX-License-Identifier: GPL-2.0\n"+  "/*\n"+ " * > > generated>\n"+" * This code was generated by a tool based on\n"+  
> > > "
> > > * handoffs from both Qsys and Quartus.\n"+" *\n"+ " * Changes 
> > > to
> > > this file may be lost if\n"+  " * the code is regenerated.\n"+
> > > "
> > > *\n"+" */\n";++/* Wrap PLL config */++#define
> > > MAIN_VCO_BASE (   \+  
> > > (CONFIG_HPS_MAINPL
> > > LGRP_VCO_DENOM << \+  
> > > CLKMGR_MAINPLLGRP_VCO_DENOM_OFFSET
> > > ) |   \+  (CONFIG_HPS_MAINPLLGRP_VCO_NUMER << \+  
> > > 
> > > CLKMGR_MAINPLLGRP_VCO_NUMER_OFFSET)   \+  )++#define 
> > > PERI_VCO_BASE (
> > >   \+  (CONFIG_HPS_PERPLLGRP_VCO_
> > > PSRC <<   \+  CLKMGR_PERPLLGRP_VCO_PSRC_OFFSET) | 
> > > \+
> > >   (CONFIG_HPS_PERPLLGRP_VCO_DENOM <<  \+  CL
> > > KMGR_PERPLLGRP_VCO_DENOM_OFFSET) |\+  
> > > (CONFIG_HPS_PERPLLGRP_VCO_
> > > NUMER <<  \+  CLKMGR_PERPLLGRP_VCO_NUMER_OFFSET)  
> > > \+
> > >   )++#define SDR_VCO_BASE (   \+
> > >   (CONFIG_HPS_SDRPLLGRP_VCO_SSRC <<   \+  CL
> > > KMGR_SDRPLLGRP_VCO_SSRC_OFFSET) | \+  (CONFIG_HPS_SDRPLLGRP_VCO_DENOM 
> > > <<
> > >   \+  CLKMGR_SDRPLLGRP_VCO_DENOM_OFFSET) |\+
> > >   (CONFIG_HPS_SDRPLLGRP_VCO_NUMER <<  \+  CL
> > > KMGR_SDRPLLGRP_VCO_NUMER_OFFSET)  \+  )++static const struct cm_config
> > > cm_default = {+   /* main group */+   MAIN_VCO_BASE,+ 
> > > (CONFIG_HPS_MAINPL
> > > LGRP_MPUCLK_CNT <<+   CLKMGR_MAINPLLGRP_MPUCLK_CNT_OFFSET),+  
> > > (CONFIG_HPS_MAINPLLGRP_MAINCLK_CNT <<+CLKMGR_MAINPLLGRP_MAINCL
> > > K_CNT_OFFSET),+   (CON

Re: [U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files

2019-10-22 Thread Simon Goldschmidt
Dalon L Westergreen  schrieb am Di., 22.
Okt. 2019, 19:10:

> I mentioned this before, it would be great to not rely on the generated
> files
> and do this based purely on the handoff data generated during a quartus
> build. Did you look at the python source i pointed you to?
>

No, not yet. But I don't think that will be a problem. I sent this series
mainly to discuss the dts format (boardspecific handoff dtsi vs genetic
dtsi plus boardspecific header file).

I still favor boardspecific handoff dtsi, but I would like to use the same
style for all socfpga flavours.

Plus this tool is required to convert existing boards where we don't have
the quartus project files at hand.

Regards,
Simon


> --dalon
>
> On Tue, 2019-10-15 at 22:10 +0200, Simon Goldschmidt wrote:
>
> This new tool converts handoff information from quartus to "*_handoff.dtsi"
>
> devicetree files. This is in preparation to move from ad-hoc code in arch
>
> that parses the 'qts' header files to drivers parsing the same information
>
> from devicetree.
>
>
> Converting existing U-Boot 'qts' files is also supported.
>
>
> Signed-off-by: Simon Goldschmidt <
>
> simon.k.r.goldschm...@gmail.com
>
> >
>
> ---
>
>
> Changes in v2: None
>
>
>  arch/arm/mach-socfpga/create_handoff_gen5.c | 660 
>
>  arch/arm/mach-socfpga/qts-to-handoff.sh |  83 +++
>
>  2 files changed, 743 insertions(+)
>
>  create mode 100644 arch/arm/mach-socfpga/create_handoff_gen5.c
>
>  create mode 100755 arch/arm/mach-socfpga/qts-to-handoff.sh
>
>
> diff --git a/arch/arm/mach-socfpga/create_handoff_gen5.c 
> b/arch/arm/mach-socfpga/create_handoff_gen5.c
>
> new file mode 100644
>
> index 00..6ec436719d
>
> --- /dev/null
>
> +++ b/arch/arm/mach-socfpga/create_handoff_gen5.c
>
> @@ -0,0 +1,660 @@
>
> +// SPDX-License-Identifier: GPL-2.0
>
> +/*
>
> + * This is a host-tool that needs to be compiled per board and prints the
>
> + * handoff.dtsi to stdout.
>
> + */
>
> +
>
> +#include 
>
> +#include 
>
> +
>
> +/* Define kernel types */
>
> +typedef uint8_t u8;
>
> +typedef uint32_t u32;
>
> +
>
> +#ifdef USE_QUARTUS_OUTPUT
>
> +#ifdef ARRIA5
>
> +#include "iocsr_config_arria5.c"
>
> +#include "pinmux_config_arria5.c"
>
> +#else
>
> +#include "iocsr_config_cyclone5.c"
>
> +#include "pinmux_config_cyclone5.c"
>
> +#endif
>
> +#include "pll_config.h"
>
> +#include "sdram/sdram_config.h"
>
> +#include "sequencer_auto.h"
>
> +#include "sequencer_defines.h"
>
> +#include "sequencer_auto_ac_init.c"
>
> +#include "sequencer_auto_inst_init.c"
>
> +#define RW_MGR(x) __RW_MGR_##x
>
> +#else
>
> +#define RW_MGR(x) RW_MGR_##x
>
> +#include 
>
> +#include 
>
> +#include 
>
> +#include 
>
> +#endif
>
> +
>
> +#include "include/mach/clock_manager_gen5.h"
>
> +#include "include/mach/sdram_gen5.h"
>
> +
>
> +#ifndef ARRAY_SIZE
>
> +#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
>
> +#endif
>
> +
>
> +const char handoff_dtsi_hdr[] =
>
> + "// SPDX-License-Identifier: GPL-2.0\n"
>
> + "/*\n"
>
> + " *\n"
>
> + " * This code was generated by a tool based on\n"
>
> + " * handoffs from both Qsys and Quartus.\n"
>
> + " *\n"
>
> + " * Changes to this file may be lost if\n"
>
> + " * the code is regenerated.\n"
>
> + " *\n"
>
> + " */\n";
>
> +
>
> +/* Wrap PLL config */
>
> +
>
> +#define MAIN_VCO_BASE (  \
>
> + (CONFIG_HPS_MAINPLLGRP_VCO_DENOM << \
>
> + CLKMGR_MAINPLLGRP_VCO_DENOM_OFFSET) |   \
>
> + (CONFIG_HPS_MAINPLLGRP_VCO_NUMER << \
>
> + CLKMGR_MAINPLLGRP_VCO_NUMER_OFFSET) \
>
> + )
>
> +
>
> +#define PERI_VCO_BASE (  \
>
> + (CONFIG_HPS_PERPLLGRP_VCO_PSRC <<   \
>
> + CLKMGR_PERPLLGRP_VCO_PSRC_OFFSET) | \
>
> + (CONFIG_HPS_PERPLLGRP_VCO_DENOM <<  \
>
> + CLKMGR_PERPLLGRP_VCO_DENOM_OFFSET) |\
>
> + (CONFIG_HPS_PERPLLGRP_VCO_NUMER <<  \
>
> + CLKMGR_PERPLLGRP_VCO_NUMER_OFFSET)  \
>
> + )
>
> +
>
> +#define SDR_VCO_BASE (   \
>
> + (CONFIG_HPS_SDRPLLGRP_VCO_SSRC <<   \
>
> + CLKMGR_SDRPLLGRP_VCO_SSRC_OFFSET) | \
>
> + (CONFIG_HPS_SDRPLLGRP_VCO_DENOM <<  \
>
> + CLKMGR_SDRPLLGRP_VCO_DENOM_OFFSET) |\
>
> + (CONFIG_HPS_SDRPLLGRP_VCO_NUMER <<  \
>
> + CLKMGR_SDRPLLGRP_VCO_NUMER_OFFSET)  \
>
> + )
>
> +
>
> +static const struct cm_config cm_default = {
>
> + /* main group */
>
> + MAIN_VCO_BASE,
>
> + (CONFIG_HPS_MAINPLLGRP_MPUCLK_CNT <<
>
> + CLKMGR_MAINPLLGRP_MPUCLK_CNT_OFFSET),
>
> + (CONFIG_HPS_MAINPLLGRP_MAINCLK_CNT <<
>
> + CLKMGR_MAINPLLGRP_MAINCLK_CNT_OFFSET),
>
> + (CONFIG_HPS_MAINPLLGRP_DBGATCLK_CNT <<
>
> + CLKMGR_MAINPLLGRP_DBGATCLK_CNT_OFFSET),
>
> + (CONFIG_HPS_MAINPLLGRP_MAIN

Re: [U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files

2019-10-22 Thread Dalon L Westergreen
I mentioned this before, it would be great to not rely on the generated filesand
do this based purely on the handoff data generated during a quartusbuild.  Did
you look at the python source i pointed you to?
--dalon
On Tue, 2019-10-15 at 22:10 +0200, Simon Goldschmidt wrote:
> This new tool converts handoff information from quartus to
> "*_handoff.dtsi"devicetree files. This is in preparation to move from ad-hoc
> code in archthat parses the 'qts' header files to drivers parsing the same
> informationfrom devicetree.
> Converting existing U-Boot 'qts' files is also supported.
> Signed-off-by: Simon Goldschmidt ---
> Changes in v2: None
>  arch/arm/mach-socfpga/create_handoff_gen5.c | 660 
> arch/arm/mach-socfpga/qts-to-handoff.sh |  83 +++ 2 files changed, 743
> insertions(+) create mode 100644 arch/arm/mach-socfpga/create_handoff_gen5.c
> create mode 100755 arch/arm/mach-socfpga/qts-to-handoff.sh
> diff --git a/arch/arm/mach-socfpga/create_handoff_gen5.c b/arch/arm/mach-
> socfpga/create_handoff_gen5.cnew file mode 100644index 00..6ec436719d-
> -- /dev/null+++ b/arch/arm/mach-socfpga/create_handoff_gen5.c@@ -0,0 +1,660
> @@+// SPDX-License-Identifier: GPL-2.0+/*+ * This is a host-tool that needs to
> be compiled per board and prints the+ * handoff.dtsi to stdout.+ */++#include
> +#include ++/* Define kernel types */+typedef uint8_t
> u8;+typedef uint32_t u32;++#ifdef USE_QUARTUS_OUTPUT+#ifdef ARRIA5+#include
> "iocsr_config_arria5.c"+#include "pinmux_config_arria5.c"+#else+#include
> "iocsr_config_cyclone5.c"+#include "pinmux_config_cyclone5.c"+#endif+#include
> "pll_config.h"+#include "sdram/sdram_config.h"+#include
> "sequencer_auto.h"+#include "sequencer_defines.h"+#include
> "sequencer_auto_ac_init.c"+#include "sequencer_auto_inst_init.c"+#define
> RW_MGR(x) __RW_MGR_##x+#else+#define RW_MGR(x) RW_MGR_##x+#include
> +#include +#include +#include
> +#endif++#include "include/mach/clock_manager_gen5.h"+#include
> "include/mach/sdram_gen5.h"++#ifndef ARRAY_SIZE+#define ARRAY_SIZE(x)
> (sizeof(x)/sizeof((x)[0]))+#endif++const char handoff_dtsi_hdr[] =+   "//
> SPDX-License-Identifier: GPL-2.0\n"+  "/*\n"+ " *\n"+ " * 
> This code was generated by a tool based on\n"+" * handoffs from
> both Qsys and Quartus.\n"+" *\n"+ " * Changes to this file may be
> lost if\n"+   " * the code is regenerated.\n"+" * generated>\n"+" */\n";++/* Wrap PLL config */++#define MAIN_VCO_BASE (
>   \+  (CONFIG_HPS_MAINPLLGRP_VCO_DEN
> OM << \+  CLKMGR_MAINPLLGRP_VCO_DENOM_OFFSET) |   \+  
> (CONFIG_HPS_MAINPLLGRP_VCO_NUMER <<   \+  CLKMGR_MAINPLL
> GRP_VCO_NUMER_OFFSET) \+  )++#define PERI_VCO_BASE (  
>   \+  (CONFIG_HPS_PERPLLGRP_VCO_PSRC <<   \+  
>   CLKMGR_PERPLLGRP_VCO_PSRC_OFFSET) | \+  (CONFIG_HPS_PERPLLGRP_
> VCO_DENOM <<  \+  CLKMGR_PERPLLGRP_VCO_DENOM_OFFSET) |
> \+(CONFIG_HPS_PERPLLGRP_VCO_NUMER <<  \+  CLKMGR
> _PERPLLGRP_VCO_NUMER_OFFSET)  \+  )++#define SDR_VCO_BASE (   
>   \+  (CONFIG_HPS_SDRPLLGRP_VCO_SSRC <<   
> \+CLKMGR_SDRPLLGRP_VCO_SSRC_OFFSET) | \+  (CONFIG_HPS_SD
> RPLLGRP_VCO_DENOM <<  \+  CLKMGR_SDRPLLGRP_VCO_DENOM_OFF
> SET) |\+  (CONFIG_HPS_SDRPLLGRP_VCO_NUMER <<  \+  
>   CLKMGR_SDRPLLGRP_VCO_NUMER_OFFSET)  \+  )++static const struct
> cm_config cm_default = {+ /* main group */+   MAIN_VCO_BASE,+ 
> (CONFIG_HPS_MA
> INPLLGRP_MPUCLK_CNT <<+   CLKMGR_MAINPLLGRP_MPUCLK_CNT_OFFSET),+  
> (CONFIG_HPS_MAINPLLGRP_MAINCLK_CNT <<+CLKMGR_MAINPLLGRP_MAINCL
> K_CNT_OFFSET),+   (CONFIG_HPS_MAINPLLGRP_DBGATCLK_CNT <<+ CLKMGR
> _MAINPLLGRP_DBGATCLK_CNT_OFFSET),+(CONFIG_HPS_MAINPLLGRP_MAINQSPICLK_CNT
> <<+   CLKMGR_MAINPLLGRP_MAINQSPICLK_CNT_OFFSET),+ (CONFIG_HPS_MA
> INPLLGRP_MAINNANDSDMMCCLK_CNT <<+ CLKMGR_PERPLLGRP_PERNANDSDMMCCLK
> _CNT_OFFSET),+(CONFIG_HPS_MAINPLLGRP_CFGS2FUSER0CLK_CNT <<+   
> CLKMGR_MAINPLLGRP_CFGS2FUSER0CLK_CNT_OFFSET),+(CONFIG_HPS_MAINPLLGRP_M
> AINDIV_L3MPCLK <<+CLKMGR_MAINPLLGRP_MAINDIV_L3MPCLK_OFFSET) |+
> (CONFIG_HPS_MAINPLLGRP_MAINDIV_L3SPCLK <<+CLKMGR_MAINPLLGRP_MAINDI
> V_L3SPCLK_OFFSET) |+  (CONFIG_HPS_MAINPLLGRP_MAINDIV_L4MPCLK <<+  
> CLKMGR_MAINPLLGRP_MAINDIV_L4MPCLK_OFFSET) |+  (CONFIG_HPS_MAINPLLGRP_MAINDIV_L
> 4SPCLK <<+CLKMGR_MAINPLLGRP_MAINDIV_L4SPCLK_OFFSET),+ (CONFI
> G_HPS_MAINPLLGRP_DBGDIV_DBGATCLK <<+  CLKMGR_MAINPLLGRP_DBGDIV_DBGATCL
> K_OFFSET) |+  (CONFIG_HPS_MAINPLLGRP_DBGDIV_DBGCLK <<+
> CLKMGR_MAINPLL
> GRP_DBGDIV_DBGCLK_OFFSET),+   (CONFIG_HPS_MAINPLLGRP_TRACEDIV_TRACECLK <<+
> 

[U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files

2019-10-15 Thread Simon Goldschmidt
This new tool converts handoff information from quartus to "*_handoff.dtsi"
devicetree files. This is in preparation to move from ad-hoc code in arch
that parses the 'qts' header files to drivers parsing the same information
from devicetree.

Converting existing U-Boot 'qts' files is also supported.

Signed-off-by: Simon Goldschmidt 
---

Changes in v2: None

 arch/arm/mach-socfpga/create_handoff_gen5.c | 660 
 arch/arm/mach-socfpga/qts-to-handoff.sh |  83 +++
 2 files changed, 743 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/create_handoff_gen5.c
 create mode 100755 arch/arm/mach-socfpga/qts-to-handoff.sh

diff --git a/arch/arm/mach-socfpga/create_handoff_gen5.c 
b/arch/arm/mach-socfpga/create_handoff_gen5.c
new file mode 100644
index 00..6ec436719d
--- /dev/null
+++ b/arch/arm/mach-socfpga/create_handoff_gen5.c
@@ -0,0 +1,660 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * This is a host-tool that needs to be compiled per board and prints the
+ * handoff.dtsi to stdout.
+ */
+
+#include 
+#include 
+
+/* Define kernel types */
+typedef uint8_t u8;
+typedef uint32_t u32;
+
+#ifdef USE_QUARTUS_OUTPUT
+#ifdef ARRIA5
+#include "iocsr_config_arria5.c"
+#include "pinmux_config_arria5.c"
+#else
+#include "iocsr_config_cyclone5.c"
+#include "pinmux_config_cyclone5.c"
+#endif
+#include "pll_config.h"
+#include "sdram/sdram_config.h"
+#include "sequencer_auto.h"
+#include "sequencer_defines.h"
+#include "sequencer_auto_ac_init.c"
+#include "sequencer_auto_inst_init.c"
+#define RW_MGR(x) __RW_MGR_##x
+#else
+#define RW_MGR(x) RW_MGR_##x
+#include 
+#include 
+#include 
+#include 
+#endif
+
+#include "include/mach/clock_manager_gen5.h"
+#include "include/mach/sdram_gen5.h"
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
+#endif
+
+const char handoff_dtsi_hdr[] =
+   "// SPDX-License-Identifier: GPL-2.0\n"
+   "/*\n"
+   " *\n"
+   " * This code was generated by a tool based on\n"
+   " * handoffs from both Qsys and Quartus.\n"
+   " *\n"
+   " * Changes to this file may be lost if\n"
+   " * the code is regenerated.\n"
+   " *\n"
+   " */\n";
+
+/* Wrap PLL config */
+
+#define MAIN_VCO_BASE (\
+   (CONFIG_HPS_MAINPLLGRP_VCO_DENOM << \
+   CLKMGR_MAINPLLGRP_VCO_DENOM_OFFSET) |   \
+   (CONFIG_HPS_MAINPLLGRP_VCO_NUMER << \
+   CLKMGR_MAINPLLGRP_VCO_NUMER_OFFSET) \
+   )
+
+#define PERI_VCO_BASE (\
+   (CONFIG_HPS_PERPLLGRP_VCO_PSRC <<   \
+   CLKMGR_PERPLLGRP_VCO_PSRC_OFFSET) | \
+   (CONFIG_HPS_PERPLLGRP_VCO_DENOM <<  \
+   CLKMGR_PERPLLGRP_VCO_DENOM_OFFSET) |\
+   (CONFIG_HPS_PERPLLGRP_VCO_NUMER <<  \
+   CLKMGR_PERPLLGRP_VCO_NUMER_OFFSET)  \
+   )
+
+#define SDR_VCO_BASE ( \
+   (CONFIG_HPS_SDRPLLGRP_VCO_SSRC <<   \
+   CLKMGR_SDRPLLGRP_VCO_SSRC_OFFSET) | \
+   (CONFIG_HPS_SDRPLLGRP_VCO_DENOM <<  \
+   CLKMGR_SDRPLLGRP_VCO_DENOM_OFFSET) |\
+   (CONFIG_HPS_SDRPLLGRP_VCO_NUMER <<  \
+   CLKMGR_SDRPLLGRP_VCO_NUMER_OFFSET)  \
+   )
+
+static const struct cm_config cm_default = {
+   /* main group */
+   MAIN_VCO_BASE,
+   (CONFIG_HPS_MAINPLLGRP_MPUCLK_CNT <<
+   CLKMGR_MAINPLLGRP_MPUCLK_CNT_OFFSET),
+   (CONFIG_HPS_MAINPLLGRP_MAINCLK_CNT <<
+   CLKMGR_MAINPLLGRP_MAINCLK_CNT_OFFSET),
+   (CONFIG_HPS_MAINPLLGRP_DBGATCLK_CNT <<
+   CLKMGR_MAINPLLGRP_DBGATCLK_CNT_OFFSET),
+   (CONFIG_HPS_MAINPLLGRP_MAINQSPICLK_CNT <<
+   CLKMGR_MAINPLLGRP_MAINQSPICLK_CNT_OFFSET),
+   (CONFIG_HPS_MAINPLLGRP_MAINNANDSDMMCCLK_CNT <<
+   CLKMGR_PERPLLGRP_PERNANDSDMMCCLK_CNT_OFFSET),
+   (CONFIG_HPS_MAINPLLGRP_CFGS2FUSER0CLK_CNT <<
+   CLKMGR_MAINPLLGRP_CFGS2FUSER0CLK_CNT_OFFSET),
+   (CONFIG_HPS_MAINPLLGRP_MAINDIV_L3MPCLK <<
+   CLKMGR_MAINPLLGRP_MAINDIV_L3MPCLK_OFFSET) |
+   (CONFIG_HPS_MAINPLLGRP_MAINDIV_L3SPCLK <<
+   CLKMGR_MAINPLLGRP_MAINDIV_L3SPCLK_OFFSET) |
+   (CONFIG_HPS_MAINPLLGRP_MAINDIV_L4MPCLK <<
+   CLKMGR_MAINPLLGRP_MAINDIV_L4MPCLK_OFFSET) |
+   (CONFIG_HPS_MAINPLLGRP_MAINDIV_L4SPCLK <<
+   CLKMGR_MAINPLLGRP_MAINDIV_L4SPCLK_OFFSET),
+   (CONFIG_HPS_MAINPLLGRP_DBGDIV_DBGATCLK <<
+   CLKMGR_MAINPLLGRP_DBGDIV_DBGATCLK_OFFSET) |
+   (CONFIG_HPS_MAINPLLGRP_DBGDIV_DBGCLK <<
+   CLKMGR_MAINPLLGRP_DBGDIV_DBGCLK_OFFSET),
+   (CONFIG_HPS_MAINPLLGRP_TRACEDIV_TRACECLK <<
+   CLKMGR_MAINPLLGRP_TRACEDIV_TRACECLK_OFFSET),
+   (CONFIG_HPS_MAINPLLGRP_L4SRC_L4MP <<
+   CLKMGR_MAINPLLGRP_L4SRC_L4MP_OFFSET) |
+   (CONFIG_HPS_M