Hi Philipp:

On 2017年07月21日 18:55, Dr. Philipp Tomsich wrote:
On 21 Jul 2017, at 04:33, Andy Yan <andy....@rock-chips.com> wrote:

Hi:


On 2017年07月19日 04:35, Philipp Tomsich wrote:
Here's a series that has a lot going on, but I didn't want to split it
to allow everyone to understand the motivation between some of the
changes to the SPL/TPL framework.  The short summary of this is
"enablement for DRAM init on the RK3368 with everything else that's
necessary to do it using OF_PLATDATA in TPL".

Enabling the RK3368 created a few more challenges that I'd expected:
  - I needed different stack locations, text addresses and sizes for
    TPL and SPL
  - the TPL stage was to use OF_PLATDATA and SPL was to use full OF_CONTROL
  - with the RK3368 TPL stage, there was a need to extend the back-to-bootrom
    support for Rockchip to AArch64
  - I wanted to start folding some of the Rockchip specific SPL support
    (i.e. back-to-bootrom) back into the general SPL framework to allow
    using it as a general boot method
I have a confusion here: according to the README.TPL,  TPL is Third Program 
Loader, which loaded by the SPL. So I think it should run after the SPL. But 
from RK3188 and RK3368 TPL implementation , they all run before SPL.Maybe it is 
my misunderstanding, hope to get some guidance.:-)
I think you are right and most Rockchip boards have been using this the wrong 
way around.

    Only RK3188 uses TPL now.

With the fine-grained configurability that I created for the RK3368, it will be 
easy enough to switch this around on the RK3368.
However, this will then also be done for the other RK3xxx devices to restore 
consistency.

I would prefer to first add the RK3368 support with the “backwards TPL/SPL” 
(i.e. TPL before SPL) to remain consistent with current mach-rockchip usage of 
the TPL/SPL terminology.
Once this is merged, we can then switch this around for each board individually.

So I ended up separating quite a bit of features between SPL and TPL
while keeping things transparent to the few other boards using TPL (at
least I hope that things are transparent, as we didn't have any of
those in our lab to test on)...

Tested with: RK3368-uQ7, Debian 9, Linux 4.13-rc1.

Just one final remark: the DMC driver for the RK3368 currently covers
the configuration we use on the RK3368-uQ7 (i.e. 32bit wide, 2 ranks)
and is stress-tested (including 8-way SPEC runs) at all 3 supported
speeds.  I've built a bit of infrastructure (e.g. the way the
memory-schedule is determined) that I hope will be a useful
starting-point in unifying the drivers for the various closely related
DRAM controllers (e.g. for the RK3288) for Rockchip devices in the
future.



Klaus Goger (1):
   rockchip: board: puma_rk3399: rename ATF firmware

Philipp Tomsich (51):
   spl: add a 'return to bootrom' boot method
   spl: configure 'return to bootrom' separately for SPL and TPL
   rockchip: back-to-bootrom: add 'back-to-bootrom' support for AArch64
   rockchip: back-to-bootrom: split BACK_TO_BOOTROM for TPL/SPL
   rockchip: back-to-bootrom: simplify the #ifdef-check for LIBGENERIC in
     TPL/SPL
   spl: dm: Kconfig: use more specific prereqs for SPL_REGMAP and
     SPL_SYSCON
   spl: dm: Kconfig: split REGMAP/SYSCON support for TPL from SPL
   spl: dm: Kconfig: SPL_RAM depends on SPL_DM
   spl: dm: Kconfig: introduce TPL_RAM (in analogy to SPL_RAM)
   spl: dm: Kconfig: SPL_CLK depens on SPL_DM
   spl: dm: Kconfig: split CLK support for SPL and TPL
   spl: dm: Kconfig: split OF_CONTROL and OF_PLATDATA between SPL and TPL
   spl: dm: use CONFIG_IS_ENABLED to test for the DM option
   armv8: remove unused low-level modules from TPL
   armv8: spl: Support separate stack for TPL
   spl: allow a separate TEXT_BASE, LDSCRIPT and MAX_SIZE for TPL
   spl: Kconfig: split SYS_MALLOC_SIMPLE for TPL and SPL
   lib: spl: differentiate between TPL and SPL for
     libfdt/of_control/of_platdata
   spl: consistently use $(SPL_TPL_) to select features for SPL and TPL
     builds
   spl: add TPL_DRIVER_MISC_SUPPORT option
   drivers: spl: consistently use the $(SPL_TPL_) macro
   rockchip: Makefile: allow selective inclusion of sdram_common.o from
     TPL/SPL/U-Boot
   rockchip: rk3368: improve Kconfig text for the RK3368
   rockchip: rk3368: mkimage: add support for the RK3368
   rockchip: rk3368: pmugrf: add definitions for os_reg[0..3]
   rockchip: rk3368: define CONFIG_SYS_SDRAM_BASE
   rockchip: rk3368: spl: define COUNTER_FREQUENCY to 24MHz
   rockchip: rk3368: spl: add memory layout for TPL and SPL
   rockchip: rk3368: syscon: MSCH/PMUGRF/GRF support for OF_PLATDATA
   rockchip: rk3368: grf: use shifted-constants and prefix with RK3368_
   rockchip: pinctrl: rk3368: add GMAC (RGMII only) support
   rockchip: pinctrl: rk3368: add support for configuring the MMC pins
   rockchip: clk: rk3368: implement bandwidth adjust for PLLs
   rockchip: clk: rk3368: support OF_PLATDATA for the RK3368 clk driver
   rockchip: clk: rk3368: do not change CPLL/GPLL before returning to
     BROM
   rockchip: clk: rk3368: implement DPLL (DRAM PLL) support
   rockchip: clk: rk3368: define DMA1_SRST_REQ and DMA2_SRST_REQ
   rockchip: clk: rk3368: implement MMC/SD clock reparenting
   rockchip: clk: rk3368: support configuring the DRAM PLL (from TPL)
   rockchip: clk: rk3368: add support for GMAC (SLCK_MAC) clock
   rockchip: clk: rk3368: mark 'priv' __maybe_unused in
     rk3368_clk_set_rate()
   net: gmac_rockchip: Add support for the RK3368 GMAC
   rockchip: Makefile: streamline SPL/TPL configuration
   rockchip: rk3368: add DRAM controller driver with DRAM initialisation
   rockchip: dts: rk3368: add DMC node in rk3368.dtsi
   rockchip: rk3368: spl: enable SPL_FRAMEWORK in rk3368_common.h
   rockchip: rk3368: spl: add TPL support
   rockchip: rk3368: spl: add SPL support
   rockchip: rk3368: spl: mark SPL and TPL as supported for
     ROCKCHIP_RK3368
   rockchip: board: lion-rk3368: add support for the RK3368-uQ7
   rockchip: board: puma-rk3399: fix warnings in
     puma_rk3399/fit_spl_atf.its

  Makefile                                           |   2 +-
  arch/arm/cpu/armv8/Makefile                        |   4 +-
  arch/arm/dts/Makefile                              |   1 +
  arch/arm/dts/rk3368-lion.dts                       | 209 +++++
  arch/arm/dts/rk3368.dtsi                           |  26 +-
  arch/arm/include/asm/arch-rockchip/cru_rk3368.h    |  15 +-
  arch/arm/include/asm/arch-rockchip/ddr_rk3368.h    | 187 ++++
  arch/arm/include/asm/arch-rockchip/grf_rk3368.h    | 615 +++++++------
  arch/arm/include/asm/spl.h                         |   1 +
  arch/arm/lib/crt0_64.S                             |   4 +-
  arch/arm/mach-rockchip/Kconfig                     |  37 +-
  arch/arm/mach-rockchip/Makefile                    |  51 +-
  arch/arm/mach-rockchip/bootrom.c                   |   4 +-
  arch/arm/mach-rockchip/rk3188-board-spl.c          |   5 +-
  arch/arm/mach-rockchip/rk3188-board.c              |   2 +-
  arch/arm/mach-rockchip/rk3288-board-spl.c          |   4 +-
  arch/arm/mach-rockchip/rk3288-board.c              |   4 +-
  arch/arm/mach-rockchip/rk3368-board-spl.c          |  91 ++
  arch/arm/mach-rockchip/rk3368-board-tpl.c          | 158 ++++
  arch/arm/mach-rockchip/rk3368/Kconfig              |  21 +
  arch/arm/mach-rockchip/rk3368/Makefile             |   1 -
  arch/arm/mach-rockchip/rk3368/sdram_rk3368.c       |  60 --
  arch/arm/mach-rockchip/rk3368/syscon_rk3368.c      |  35 +
  arch/arm/mach-rockchip/rk3368/u-boot-tpl.lds       |  13 +
  arch/arm/mach-rockchip/rk3399-board-spl.c          |   4 +-
  arch/arm/mach-rockchip/save_boot_param.S           |  37 +
  board/theobroma-systems/lion_rk3368/Kconfig        |  15 +
  board/theobroma-systems/lion_rk3368/MAINTAINERS    |  10 +
  board/theobroma-systems/lion_rk3368/Makefile       |   7 +
  board/theobroma-systems/lion_rk3368/README         |  60 ++
  .../theobroma-systems/lion_rk3368/fit_spl_atf.its  |  51 ++
  board/theobroma-systems/lion_rk3368/lion_rk3368.c  |  25 +
  board/theobroma-systems/puma_rk3399/README         |   2 +-
  .../theobroma-systems/puma_rk3399/fit_spl_atf.its  |  20 +-
  common/Makefile                                    |   8 +-
  common/spl/Kconfig                                 |  39 +
  common/spl/Makefile                                |  35 +-
  common/spl/spl.c                                   |   5 +-
  common/spl/spl_bootrom.c                           |  27 +
  configs/evb-rk3288_defconfig                       |   2 +-
  configs/fennec-rk3288_defconfig                    |   2 +-
  configs/firefly-rk3288_defconfig                   |   2 +-
  configs/lion-rk3368_defconfig                      |  79 ++
  configs/miqi-rk3288_defconfig                      |   2 +-
  configs/popmetal-rk3288_defconfig                  |   2 +-
  configs/rock2_defconfig                            |   2 +-
  configs/rock_defconfig                             |   2 +-
  configs/tinker-rk3288_defconfig                    |   2 +-
  doc/README.rockchip                                |   2 +-
  .../clock/rockchip,rk3368-dmc.txt                  |  67 ++
  drivers/Makefile                                   |  36 +-
  drivers/clk/Kconfig                                |  12 +-
  drivers/clk/Makefile                               |   2 +-
  drivers/clk/rockchip/clk_rk3368.c                  | 222 ++++-
  drivers/core/Kconfig                               |  23 +-
  drivers/core/Makefile                              |   4 +-
  drivers/net/gmac_rockchip.c                        |  54 ++
  drivers/pinctrl/rockchip/pinctrl_rk3368.c          | 101 ++-
  drivers/ram/Kconfig                                |  11 +-
  drivers/ram/Makefile                               |   2 +
  drivers/ram/rockchip/Makefile                      |   7 +
  drivers/ram/rockchip/dmc-rk3368.c                  | 990 +++++++++++++++++++++
  dts/Kconfig                                        |  29 +
  include/configs/lion_rk3368.h                      |  19 +
  include/configs/rk3188_common.h                    |   2 +-
  include/configs/rk3288_common.h                    |   2 +-
  include/configs/rk3368_common.h                    |  15 +
  include/configs/rock.h                             |   2 +-
  include/configs/rockchip-common.h                  |   2 +-
  include/dt-bindings/memory/rk3368-dmc.h            |  30 +
  include/linux/kconfig.h                            |  13 +
  include/spl.h                                      |  10 +
  lib/Makefile                                       |  10 +-
  scripts/Makefile.spl                               |  14 +-
  scripts/config_whitelist.txt                       |   4 +
  tools/rkcommon.c                                   |   1 +
  76 files changed, 3142 insertions(+), 534 deletions(-)
  create mode 100644 arch/arm/dts/rk3368-lion.dts
  create mode 100644 arch/arm/include/asm/arch-rockchip/ddr_rk3368.h
  create mode 100644 arch/arm/mach-rockchip/rk3368-board-spl.c
  create mode 100644 arch/arm/mach-rockchip/rk3368-board-tpl.c
  delete mode 100644 arch/arm/mach-rockchip/rk3368/sdram_rk3368.c
  create mode 100644 arch/arm/mach-rockchip/rk3368/u-boot-tpl.lds
  create mode 100644 board/theobroma-systems/lion_rk3368/Kconfig
  create mode 100644 board/theobroma-systems/lion_rk3368/MAINTAINERS
  create mode 100644 board/theobroma-systems/lion_rk3368/Makefile
  create mode 100644 board/theobroma-systems/lion_rk3368/README
  create mode 100644 board/theobroma-systems/lion_rk3368/fit_spl_atf.its
  create mode 100644 board/theobroma-systems/lion_rk3368/lion_rk3368.c
  create mode 100644 common/spl/spl_bootrom.c
  create mode 100644 configs/lion-rk3368_defconfig
  create mode 100644 doc/device-tree-bindings/clock/rockchip,rk3368-dmc.txt
  create mode 100644 drivers/ram/rockchip/Makefile
  create mode 100644 drivers/ram/rockchip/dmc-rk3368.c
  create mode 100644 include/configs/lion_rk3368.h
  create mode 100644 include/dt-bindings/memory/rk3368-dmc.h





_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to