public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH v2 0/28] Create generic board init for ARM, x86, PPC
@ 2012-01-07  0:24 Simon Glass
  2012-01-07  0:24 ` [U-Boot] [RFC PATCH v2 01/28] arm: Change board baud_rate to ulong Simon Glass
                   ` (28 more replies)
  0 siblings, 29 replies; 38+ messages in thread
From: Simon Glass @ 2012-01-07  0:24 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, some due to errors in
the board config, some due to things that need fixing. I will address
these with the final series if required.

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:
- Change generic board to an opt-in system on a per-board basic
- Add CONFIG_SYS_GENERIC_BOARD to allow board to select generic board
- Add PowerPC support
- Rebase to master

Simon Glass (28):
  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 compiler warning in sc520_timer.c
  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 symbol file
  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/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/blackfin/config.mk                |    3 +
 arch/m68k/config.mk                    |    3 +
 arch/microblaze/config.mk              |    3 +
 arch/mips/config.mk                    |    3 +
 arch/nds32/config.mk                   |    3 +
 arch/nios2/config.mk                   |    3 +
 arch/powerpc/include/asm/global_data.h |    7 +
 arch/powerpc/include/asm/io.h          |    8 +
 arch/powerpc/include/asm/u-boot.h      |    7 +
 arch/powerpc/lib/Makefile              |    4 +-
 arch/sandbox/config.mk                 |    3 +
 arch/sh/config.mk                      |    3 +
 arch/sparc/config.mk                   |    3 +
 arch/x86/cpu/sc520/sc520_timer.c       |    2 +-
 arch/x86/include/asm/global_data.h     |    7 +
 arch/x86/include/asm/io.h              |    8 +
 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 +
 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                       |  863 +++++++++++++++++++++++++++++++
 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           |  155 ++++++
 include/common.h                       |   16 +
 include/configs/seaboard.h             |    2 +
 include/initcall.h                     |   25 +
 lib/Makefile                           |    1 +
 lib/initcall.c                         |   41 ++
 45 files changed, 2504 insertions(+), 29 deletions(-)
 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.3.1

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

end of thread, other threads:[~2012-02-16 16:32 UTC | newest]

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

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