public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 0/27] Create generic board init for ARM, x86, PPC
@ 2012-03-15  2:15 Simon Glass
  2012-03-15  2:15 ` [U-Boot] [PATCH v4 01/27] arm: Change board baud_rate to ulong Simon Glass
                   ` (27 more replies)
  0 siblings, 28 replies; 58+ messages in thread
From: Simon Glass @ 2012-03-15  2:15 UTC (permalink / raw)
  To: u-boot

This series creates a generic board.c implementation which contains
the essential functions of the major arch/xxx/lib/board.c files.

What is the motivation for this change?

1. There is a lot of repeated code in the board.c files. Any change to
things like setting up the baud rate requires a change in 10 separate
places.

2. Since there are 10 separate files, adding a new feature which requires
initialisation is painful since it must be independently added in 10
places.

3. As time goes by the architectures naturely diverge since there is limited
pressure to compare features or even CONFIG options against simiilar things
in other board.c files.

4. New architectures must implement all the features all over again, and
sometimes in subtley different ways. This places an unfair burden on getting
a new architecture fully functional and running with U-Boot.

5. While it is a bit of a tricky change, I believe it is worthwhile and
achievable. There is no requirement that all code be common, only that
the code that is common should be located in common/board.c rather than
arch/xxx/lib/board.c.

All the functions of board_init_f() and board_init_r() are broken into
separate function calls so that they can easily be included or excluded
for a particular architecture. It also makes it easier to adopt Graeme's
initcall proposal when it is ready.

http://lists.denx.de/pipermail/u-boot/2012-January/114499.html

This series removes the dependency on generic relocation. So relocation
happens as one big chunk and is still completely arch-specific. See the
relocation series for a proposed solution to this for ARM:

http://lists.denx.de/pipermail/u-boot/2011-December/112928.html

or Graeme's recent x86 series v2:

http://lists.denx.de/pipermail/u-boot/2012-January/114467.html

Instead of moving over a whole architecture, this series takes the approach
of simply enabling generic board support for an architecture. It is then up
to each board to opt in by defining CONFIG_SYS_GENERIC_BOARD in the board
config file. If this is not done, then the code will be generated as
before. This allows both sets of code to co-exist until we are comfortable
with the generic approach, and enough boards run.

ARM is a relatively large board.c file and one which I can test, therefore
I think it is a good target for this series. On the other hand, x86 is
relatively small and simple, but different enough that it introduces a
few issues to be solved. So I have chosen both ARM and x86 for this series.
After a suggestion from Wolfgang I have added PPC also. This is the
largest and most feature-full board, so hopefully we have all bases
covered in this RFC.

A generic global_data structure is also required. This might upset a few
people. Here is my basic reasoning: most fields are the same, all
architectures include and need it, most global_data.h files already have
 #ifdefs to select fields for a particular SOC, so it is hard to
see why architecures are different in this area. We can perhaps add a
way to put architecture-specific fields into a separate header file, but
for now I have judged that to be counter-productive.

Similarly we need a generic bd_info structure, since generic code will
be accessing it. I have done this in the same way as global_data and the
same comments apply.

There was dicussion on the list about passing gd_t around as a parameter
to pre-relocation init functions. I think this makes sense, but it can
be done as a separate change, and this series does not require it.

While this series needs to stand on its own (as with the link script
cleanup series and the generic relocation series) the goal is the
unification of the board init code. So I hope we can address issues with
this in mind, rather than focusing too narrowly on particular ARM, x86 or
PPC issues.

I have run-tested ARM on Tegra Seaboard only. To try it out, define
CONFIG_SYS_GENERIC_BOARD in your board file and rebuild. Most likely on
x86 and PPC at least it will hang, but if you are lucky it will print
something first :-)

I have run this though MAKEALL with CONFIG_SYS_GENERIC_BOARD on for all
ARM, PPC and x86 boards. There are a few failures due to errors in
the board config, which I have sent patches for. The main issue is
just the difference between __bss_end and __bss_end__.

Note: the first group of commits are required for this series to build,
but could be separated out if required. I have included them here for
convenience.

Comments welcome.

Changes in v2:
- Add CONFIG_SYS_GENERIC_BOARD to allow board to select generic board
- Add PowerPC support
- Change generic board to an opt-in system on a per-board basic
- Rebase to master

Changes in v3:
- Add header to new x86 relocate.c and init_helpers.c
- Cast away the volatile on gd for memcpy()
- Rebase on top of x86/master (which has not yet been pulled to master)
- Rebase to master

Changes in v4:
- Add asm/sections.h for each architecture
- Add three more fields required for ARM
- Drop sc520_timer.c patch (warning already fixed by previous patch)
- Rebase to master
- Updates to sit on top of earlier patches
- Use asm/sections.h instead of asm-generic/sections.h

Simon Glass (27):
  arm: Change board baud_rate to ulong
  x86: Change board baud_rate to ulong
  arm: Only display frame buffer info if there is LCD/video support
  x86: Remove dead code in eNET
  x86: Add initial memory barrier macros
  ppc: Add initial memory barrier macros
  Introduce generic global_data
  Introduce generic u-boot.h file
  Introduce generic link section.h symbol files
  arm: Use sections header to obtain link symbols
  x86: Change stub example to use asm-generic/sections.h
  Introduce a basic initcall implementation
  Define CONFIG_SYS_LEGACY_BOARD everywhere
  Introduce generic pre-relocation board_f.c
  Introduce generic post-relocation board_r.c
  Add spl load feature
  arm: Enable generic board support
  Add CONFIG_SYS_SYM_OFFSETS to support offset symbols
  x86: Use sections header to obtain link symbols
  Add x86 fields to generic global_data
  x86: Enable generic board support
  Add ppc fields to generic global data
  Adjust board_f for ppc
  Adjust board_r.c for PowerPC
  ppc: Enable generic board board
  tegra: Mark board init files for ARMv4t
  tegra: Enable generic board for Seaboard.

 README                                 |   17 +
 arch/arm/cpu/armv7/tegra2/config.mk    |    2 +
 arch/arm/include/asm/global_data.h     |    7 +
 arch/arm/include/asm/sections.h        |   27 +
 arch/arm/include/asm/u-boot-arm.h      |    4 -
 arch/arm/include/asm/u-boot.h          |   11 +-
 arch/arm/lib/Makefile                  |    4 +-
 arch/arm/lib/board.c                   |    1 +
 arch/avr32/config.mk                   |    3 +
 arch/avr32/cpu/start.S                 |    2 +-
 arch/avr32/cpu/u-boot.lds              |    2 +-
 arch/avr32/include/asm/sections.h      |    6 +-
 arch/avr32/lib/board.c                 |    2 +-
 arch/blackfin/config.mk                |    3 +
 arch/blackfin/include/asm/sections.h   |   27 +
 arch/m68k/config.mk                    |    3 +
 arch/m68k/include/asm/sections.h       |   27 +
 arch/microblaze/config.mk              |    3 +
 arch/microblaze/include/asm/sections.h |   27 +
 arch/mips/config.mk                    |    3 +
 arch/mips/include/asm/sections.h       |   27 +
 arch/nds32/config.mk                   |    3 +
 arch/nds32/include/asm/sections.h      |   27 +
 arch/nios2/config.mk                   |    3 +
 arch/nios2/include/asm/sections.h      |   27 +
 arch/openrisc/include/asm/sections.h   |   27 +
 arch/powerpc/include/asm/global_data.h |    7 +
 arch/powerpc/include/asm/io.h          |    8 +
 arch/powerpc/include/asm/sections.h    |   27 +
 arch/powerpc/include/asm/u-boot.h      |    7 +
 arch/powerpc/lib/Makefile              |    4 +-
 arch/sandbox/config.mk                 |    3 +
 arch/sandbox/include/asm/sections.h    |   27 +
 arch/sh/config.mk                      |    3 +
 arch/sh/include/asm/sections.h         |   27 +
 arch/sparc/config.mk                   |    3 +
 arch/sparc/include/asm/sections.h      |   27 +
 arch/x86/include/asm/global_data.h     |    7 +
 arch/x86/include/asm/io.h              |    8 +
 arch/x86/include/asm/sections.h        |   27 +
 arch/x86/include/asm/u-boot-x86.h      |    8 -
 arch/x86/include/asm/u-boot.h          |   13 +-
 arch/x86/lib/Makefile                  |    4 +-
 arch/x86/lib/board.c                   |    1 +
 arch/x86/lib/init_helpers.c            |    1 +
 arch/x86/lib/relocate.c                |    1 +
 board/cm4008/flash.c                   |    1 +
 board/cm41xx/flash.c                   |    1 +
 board/eNET/eNET.c                      |    5 -
 common/Makefile                        |    4 +
 common/board_f.c                       |  888 ++++++++++++++++++++++++++++++++
 common/board_r.c                       |  862 +++++++++++++++++++++++++++++++
 common/cmd_bdinfo.c                    |    6 +-
 config.mk                              |    8 +
 examples/standalone/stubs.c            |    7 +-
 include/asm-generic/global_data.h      |  241 +++++++++
 include/asm-generic/sections.h         |  124 +++++
 include/asm-generic/u-boot.h           |  160 ++++++
 include/common.h                       |   16 +
 include/configs/seaboard.h             |    2 +
 include/initcall.h                     |   25 +
 lib/Makefile                           |    1 +
 lib/initcall.c                         |   41 ++
 63 files changed, 2866 insertions(+), 34 deletions(-)
 create mode 100644 arch/arm/include/asm/sections.h
 create mode 100644 arch/blackfin/include/asm/sections.h
 create mode 100644 arch/m68k/include/asm/sections.h
 create mode 100644 arch/microblaze/include/asm/sections.h
 create mode 100644 arch/mips/include/asm/sections.h
 create mode 100644 arch/nds32/include/asm/sections.h
 create mode 100644 arch/nios2/include/asm/sections.h
 create mode 100644 arch/openrisc/include/asm/sections.h
 create mode 100644 arch/powerpc/include/asm/sections.h
 create mode 100644 arch/sandbox/include/asm/sections.h
 create mode 100644 arch/sh/include/asm/sections.h
 create mode 100644 arch/sparc/include/asm/sections.h
 create mode 100644 arch/x86/include/asm/sections.h
 create mode 100644 common/board_f.c
 create mode 100644 common/board_r.c
 create mode 100644 include/asm-generic/global_data.h
 create mode 100644 include/asm-generic/sections.h
 create mode 100644 include/asm-generic/u-boot.h
 create mode 100644 include/initcall.h
 create mode 100644 lib/initcall.c

-- 
1.7.7.3

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

end of thread, other threads:[~2012-03-24 23:54 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15  2:15 [U-Boot] [PATCH v4 0/27] Create generic board init for ARM, x86, PPC Simon Glass
2012-03-15  2:15 ` [U-Boot] [PATCH v4 01/27] arm: Change board baud_rate to ulong Simon Glass
2012-03-15  2:15 ` [U-Boot] [PATCH v4 02/27] x86: " Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 03/27] arm: Only display frame buffer info if there is LCD/video support Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 04/27] x86: Remove dead code in eNET Simon Glass
2012-03-15  2:27   ` Graeme Russ
2012-03-15  2:28     ` Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 05/27] x86: Add initial memory barrier macros Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 06/27] ppc: " Simon Glass
2012-03-15 17:56   ` Scott Wood
2012-03-15  2:16 ` [U-Boot] [PATCH v4 07/27] Introduce generic global_data Simon Glass
2012-03-15  2:30   ` Graeme Russ
2012-03-15  2:35   ` Graeme Russ
2012-03-15  2:50     ` Simon Glass
2012-03-15  3:02       ` Graeme Russ
2012-03-15  3:41         ` Simon Glass
2012-03-24  6:40           ` Simon Glass
2012-03-24 11:14             ` Graeme Russ
2012-03-24 23:10               ` Simon Glass
2012-03-24 23:54                 ` Graeme Russ
2012-03-15  2:16 ` [U-Boot] [PATCH v4 08/27] Introduce generic u-boot.h file Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 09/27] Introduce generic link section.h symbol files Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 10/27] arm: Use sections header to obtain link symbols Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 11/27] x86: Change stub example to use asm-generic/sections.h Simon Glass
2012-03-15  2:29   ` Graeme Russ
2012-03-15  2:44     ` Simon Glass
2012-03-15  2:48       ` Graeme Russ
2012-03-15  2:16 ` [U-Boot] [PATCH v4 12/27] Introduce a basic initcall implementation Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 13/27] Define CONFIG_SYS_LEGACY_BOARD everywhere Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 14/27] Introduce generic pre-relocation board_f.c Simon Glass
2012-03-15 19:09   ` Scott Wood
2012-03-15 21:23     ` Simon Glass
2012-03-15 21:25       ` Scott Wood
2012-03-16  5:31       ` Wolfgang Denk
2012-03-15  2:16 ` [U-Boot] [PATCH v4 15/27] Introduce generic post-relocation board_r.c Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 16/27] Add spl load feature Simon Glass
2012-03-15 19:29   ` Scott Wood
2012-03-15  2:16 ` [U-Boot] [PATCH v4 17/27] arm: Enable generic board support Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 18/27] Add CONFIG_SYS_SYM_OFFSETS to support offset symbols Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 19/27] x86: Use sections header to obtain link symbols Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 20/27] Add x86 fields to generic global_data Simon Glass
2012-03-15  2:36   ` Graeme Russ
2012-03-15  2:54     ` Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 21/27] x86: Enable generic board support Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 22/27] Add ppc fields to generic global data Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 23/27] Adjust board_f for ppc Simon Glass
2012-03-15 19:12   ` Scott Wood
2012-03-15 21:25     ` Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 24/27] Adjust board_r.c for PowerPC Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 25/27] ppc: Enable generic board board Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 26/27] tegra: Mark board init files for ARMv4t Simon Glass
2012-03-15  2:16 ` [U-Boot] [PATCH v4 27/27] tegra: Enable generic board for Seaboard Simon Glass
2012-03-16 19:23 ` [U-Boot] [PATCH v4 0/27] Create generic board init for ARM, x86, PPC Tom Rini
2012-03-16 19:34   ` Simon Glass
2012-03-16 20:07     ` Tom Rini
2012-03-16 21:53       ` Tom Rini
2012-03-16 22:19         ` Simon Glass
2012-03-16 22:26           ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox