mbox series

[U-Boot,v3,00/22] rockchip: ram: add common code for sdram driver

Message ID 20191115030507.5781-1-kever.yang@rock-chips.com
Headers show
Series rockchip: ram: add common code for sdram driver | expand

Message

Kever Yang Nov. 15, 2019, 3:04 a.m. UTC
The sdram drivers for Rockchip SoCs was all separate, some of the SoCs
has similar hardware controller and phy, so we have a change to share
the flow and some of the functions between different SoCs.
This patch set implement a first version common code based on PX30,
other SoCs has similar hardware can migrate to this common code, eg.
rk3328 and rk3399 can use this common code.

This patch set also fix some bug for rk3399 by sync code from latest
rockchip vendor code.

V3 split the patch in more detail, and also fix support for px30.


Changes in v3:
- add dm based driver for non-TPL and update commit message
- split code other than migration to separate patches.
- update commit message

Changes in v2:
- Split the patches into multi smaller patches for easy to maintain,
review and test;
- Keep the DRAM_ROCKCHIP_DEBUG macro and enable it by default;
- Update the rockchip_sdram_size to support sys_reg3;

Kever Yang (14):
  ram: rockchip: rename sdram.h to sdram_rk3288.h
  ram: rockchip: rename sdram_common.c/h to sdram.c
  rockchip: sdram: move cap structure and debug function to
    sdram_common.h
  rockchip: sdram: extend to use sys_reg3 for capacity info
  rockchip: sdram: update the sys_reg to sys_reg2
  ram: rockchip: add common code for sdram driver
  ram: rockchip: move sdram_debug function into sdram_common
  ram: rockchip: Default enable DRAM debug info
  ram: rockchip: add controller code for PX30
  ram: rockchip: add phy driver code for PX30
  ram: rockchip: add common msch reg definition
  ram: rockchip: update lpddr4 timing for rk3399
  ram: rk3399: Sync the io setting from Rockchip vendor code
  ram: rk3399: update calculate_stride

YouMin Chen (8):
  ram: px30: add sdram driver
  ram: rk3328: use common sdram driver
  ram: rk3399: migrate to use common code
  ram: rk3399: Clean up code
  ram: rk3399: fix error about get_ddrc0_con reg addr
  ram: rk3399: update the function of sdram_init
  ram: rk3399: add support detect capacity
  ram: rk3399: Fix dram setting to make dram more stable

 arch/arm/dts/rk3328-sdram-ddr3-666.dtsi       |    4 +
 arch/arm/dts/rk3328-sdram-lpddr3-1600.dtsi    |    4 +
 arch/arm/dts/rk3328-sdram-lpddr3-666.dtsi     |    4 +
 arch/arm/dts/rk3399-sdram-ddr3-1333.dtsi      |    4 +
 arch/arm/dts/rk3399-sdram-ddr3-1600.dtsi      |    4 +
 arch/arm/dts/rk3399-sdram-ddr3-1866.dtsi      |    4 +
 .../arm/dts/rk3399-sdram-lpddr3-2GB-1600.dtsi |    4 +
 .../arm/dts/rk3399-sdram-lpddr3-4GB-1600.dtsi |    4 +
 .../rk3399-sdram-lpddr3-samsung-4GB-1866.dtsi |    4 +
 arch/arm/dts/rk3399-sdram-lpddr4-100.dtsi     |    4 +
 arch/arm/include/asm/arch-rockchip/sdram.h    |  168 ++-
 .../include/asm/arch-rockchip/sdram_common.h  |  116 +-
 .../include/asm/arch-rockchip/sdram_msch.h    |   85 ++
 .../asm/arch-rockchip/sdram_pctl_px30.h       |  139 ++
 .../asm/arch-rockchip/sdram_phy_px30.h        |   62 +
 .../arch-rockchip/sdram_phy_ron_rtt_px30.h    |   59 +
 .../include/asm/arch-rockchip/sdram_px30.h    |  134 ++
 .../include/asm/arch-rockchip/sdram_rk3288.h  |  102 ++
 .../include/asm/arch-rockchip/sdram_rk3328.h  |  420 ++----
 .../include/asm/arch-rockchip/sdram_rk3399.h  |   98 +-
 arch/arm/mach-rockchip/Kconfig                |    2 +
 arch/arm/mach-rockchip/Makefile               |    2 +-
 arch/arm/mach-rockchip/rk3036/rk3036.c        |    2 +-
 arch/arm/mach-rockchip/rk3288/rk3288.c        |    2 +-
 .../mach-rockchip/{sdram_common.c => sdram.c} |   85 +-
 arch/arm/mach-rockchip/spl.c                  |    1 -
 configs/evb-rk3328_defconfig                  |    2 +-
 configs/rock64-rk3328_defconfig               |    2 +-
 drivers/ram/Kconfig                           |    2 +-
 drivers/ram/rockchip/Kconfig                  |   17 +-
 drivers/ram/rockchip/Makefile                 |    7 +-
 drivers/ram/rockchip/dmc-rk3368.c             |    2 +-
 .../rockchip/sdram-px30-ddr3-detect-333.inc   |   72 +
 .../rockchip/sdram-px30-ddr4-detect-333.inc   |   75 +
 drivers/ram/rockchip/sdram-px30-ddr_skew.inc  |  121 ++
 .../rockchip/sdram-px30-lpddr2-detect-333.inc |   73 +
 .../rockchip/sdram-px30-lpddr3-detect-333.inc |   74 +
 .../ram/rockchip/sdram-rk3399-lpddr4-400.inc  |   28 +-
 .../ram/rockchip/sdram-rk3399-lpddr4-800.inc  |   28 +-
 drivers/ram/rockchip/sdram_common.c           |  429 ++++++
 drivers/ram/rockchip/sdram_debug.c            |  147 --
 drivers/ram/rockchip/sdram_pctl_px30.c        |  205 +++
 drivers/ram/rockchip/sdram_phy_px30.c         |  205 +++
 drivers/ram/rockchip/sdram_px30.c             |  751 +++++++++++
 drivers/ram/rockchip/sdram_rk3128.c           |    2 +-
 drivers/ram/rockchip/sdram_rk3188.c           |    2 +-
 drivers/ram/rockchip/sdram_rk322x.c           |    2 +-
 drivers/ram/rockchip/sdram_rk3288.c           |    2 +-
 drivers/ram/rockchip/sdram_rk3328.c           |  765 +++--------
 drivers/ram/rockchip/sdram_rk3399.c           | 1201 +++++++++++------
 50 files changed, 4035 insertions(+), 1696 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_msch.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_pctl_px30.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_phy_px30.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_phy_ron_rtt_px30.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_px30.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_rk3288.h
 rename arch/arm/mach-rockchip/{sdram_common.c => sdram.c} (60%)
 create mode 100644 drivers/ram/rockchip/sdram-px30-ddr3-detect-333.inc
 create mode 100644 drivers/ram/rockchip/sdram-px30-ddr4-detect-333.inc
 create mode 100644 drivers/ram/rockchip/sdram-px30-ddr_skew.inc
 create mode 100644 drivers/ram/rockchip/sdram-px30-lpddr2-detect-333.inc
 create mode 100644 drivers/ram/rockchip/sdram-px30-lpddr3-detect-333.inc
 create mode 100644 drivers/ram/rockchip/sdram_common.c
 delete mode 100644 drivers/ram/rockchip/sdram_debug.c
 create mode 100644 drivers/ram/rockchip/sdram_pctl_px30.c
 create mode 100644 drivers/ram/rockchip/sdram_phy_px30.c
 create mode 100644 drivers/ram/rockchip/sdram_px30.c

Comments

Kever Yang Nov. 18, 2019, 3:06 a.m. UTC | #1
On 2019/11/15 上午11:04, Kever Yang wrote:
> The sdram drivers for Rockchip SoCs was all separate, some of the SoCs
> has similar hardware controller and phy, so we have a change to share
> the flow and some of the functions between different SoCs.
> This patch set implement a first version common code based on PX30,
> other SoCs has similar hardware can migrate to this common code, eg.
> rk3328 and rk3399 can use this common code.
>
> This patch set also fix some bug for rk3399 by sync code from latest
> rockchip vendor code.
>
> V3 split the patch in more detail, and also fix support for px30.
>
>
> Changes in v3:
> - add dm based driver for non-TPL and update commit message
> - split code other than migration to separate patches.
> - update commit message
>
> Changes in v2:
> - Split the patches into multi smaller patches for easy to maintain,
> review and test;
> - Keep the DRAM_ROCKCHIP_DEBUG macro and enable it by default;
> - Update the rockchip_sdram_size to support sys_reg3;
>
> Kever Yang (14):
>    ram: rockchip: rename sdram.h to sdram_rk3288.h
>    ram: rockchip: rename sdram_common.c/h to sdram.c
>    rockchip: sdram: move cap structure and debug function to
>      sdram_common.h
>    rockchip: sdram: extend to use sys_reg3 for capacity info
>    rockchip: sdram: update the sys_reg to sys_reg2
>    ram: rockchip: add common code for sdram driver
>    ram: rockchip: move sdram_debug function into sdram_common
>    ram: rockchip: Default enable DRAM debug info
>    ram: rockchip: add controller code for PX30
>    ram: rockchip: add phy driver code for PX30
>    ram: rockchip: add common msch reg definition
>    ram: rockchip: update lpddr4 timing for rk3399
>    ram: rk3399: Sync the io setting from Rockchip vendor code
>    ram: rk3399: update calculate_stride
>
> YouMin Chen (8):
>    ram: px30: add sdram driver
>    ram: rk3328: use common sdram driver
>    ram: rk3399: migrate to use common code
>    ram: rk3399: Clean up code
>    ram: rk3399: fix error about get_ddrc0_con reg addr
>    ram: rk3399: update the function of sdram_init
>    ram: rk3399: add support detect capacity
>    ram: rk3399: Fix dram setting to make dram more stable

Applied to u-boot-rockchip master.

Thanks,
- Kever
>
>   arch/arm/dts/rk3328-sdram-ddr3-666.dtsi       |    4 +
>   arch/arm/dts/rk3328-sdram-lpddr3-1600.dtsi    |    4 +
>   arch/arm/dts/rk3328-sdram-lpddr3-666.dtsi     |    4 +
>   arch/arm/dts/rk3399-sdram-ddr3-1333.dtsi      |    4 +
>   arch/arm/dts/rk3399-sdram-ddr3-1600.dtsi      |    4 +
>   arch/arm/dts/rk3399-sdram-ddr3-1866.dtsi      |    4 +
>   .../arm/dts/rk3399-sdram-lpddr3-2GB-1600.dtsi |    4 +
>   .../arm/dts/rk3399-sdram-lpddr3-4GB-1600.dtsi |    4 +
>   .../rk3399-sdram-lpddr3-samsung-4GB-1866.dtsi |    4 +
>   arch/arm/dts/rk3399-sdram-lpddr4-100.dtsi     |    4 +
>   arch/arm/include/asm/arch-rockchip/sdram.h    |  168 ++-
>   .../include/asm/arch-rockchip/sdram_common.h  |  116 +-
>   .../include/asm/arch-rockchip/sdram_msch.h    |   85 ++
>   .../asm/arch-rockchip/sdram_pctl_px30.h       |  139 ++
>   .../asm/arch-rockchip/sdram_phy_px30.h        |   62 +
>   .../arch-rockchip/sdram_phy_ron_rtt_px30.h    |   59 +
>   .../include/asm/arch-rockchip/sdram_px30.h    |  134 ++
>   .../include/asm/arch-rockchip/sdram_rk3288.h  |  102 ++
>   .../include/asm/arch-rockchip/sdram_rk3328.h  |  420 ++----
>   .../include/asm/arch-rockchip/sdram_rk3399.h  |   98 +-
>   arch/arm/mach-rockchip/Kconfig                |    2 +
>   arch/arm/mach-rockchip/Makefile               |    2 +-
>   arch/arm/mach-rockchip/rk3036/rk3036.c        |    2 +-
>   arch/arm/mach-rockchip/rk3288/rk3288.c        |    2 +-
>   .../mach-rockchip/{sdram_common.c => sdram.c} |   85 +-
>   arch/arm/mach-rockchip/spl.c                  |    1 -
>   configs/evb-rk3328_defconfig                  |    2 +-
>   configs/rock64-rk3328_defconfig               |    2 +-
>   drivers/ram/Kconfig                           |    2 +-
>   drivers/ram/rockchip/Kconfig                  |   17 +-
>   drivers/ram/rockchip/Makefile                 |    7 +-
>   drivers/ram/rockchip/dmc-rk3368.c             |    2 +-
>   .../rockchip/sdram-px30-ddr3-detect-333.inc   |   72 +
>   .../rockchip/sdram-px30-ddr4-detect-333.inc   |   75 +
>   drivers/ram/rockchip/sdram-px30-ddr_skew.inc  |  121 ++
>   .../rockchip/sdram-px30-lpddr2-detect-333.inc |   73 +
>   .../rockchip/sdram-px30-lpddr3-detect-333.inc |   74 +
>   .../ram/rockchip/sdram-rk3399-lpddr4-400.inc  |   28 +-
>   .../ram/rockchip/sdram-rk3399-lpddr4-800.inc  |   28 +-
>   drivers/ram/rockchip/sdram_common.c           |  429 ++++++
>   drivers/ram/rockchip/sdram_debug.c            |  147 --
>   drivers/ram/rockchip/sdram_pctl_px30.c        |  205 +++
>   drivers/ram/rockchip/sdram_phy_px30.c         |  205 +++
>   drivers/ram/rockchip/sdram_px30.c             |  751 +++++++++++
>   drivers/ram/rockchip/sdram_rk3128.c           |    2 +-
>   drivers/ram/rockchip/sdram_rk3188.c           |    2 +-
>   drivers/ram/rockchip/sdram_rk322x.c           |    2 +-
>   drivers/ram/rockchip/sdram_rk3288.c           |    2 +-
>   drivers/ram/rockchip/sdram_rk3328.c           |  765 +++--------
>   drivers/ram/rockchip/sdram_rk3399.c           | 1201 +++++++++++------
>   50 files changed, 4035 insertions(+), 1696 deletions(-)
>   create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_msch.h
>   create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_pctl_px30.h
>   create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_phy_px30.h
>   create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_phy_ron_rtt_px30.h
>   create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_px30.h
>   create mode 100644 arch/arm/include/asm/arch-rockchip/sdram_rk3288.h
>   rename arch/arm/mach-rockchip/{sdram_common.c => sdram.c} (60%)
>   create mode 100644 drivers/ram/rockchip/sdram-px30-ddr3-detect-333.inc
>   create mode 100644 drivers/ram/rockchip/sdram-px30-ddr4-detect-333.inc
>   create mode 100644 drivers/ram/rockchip/sdram-px30-ddr_skew.inc
>   create mode 100644 drivers/ram/rockchip/sdram-px30-lpddr2-detect-333.inc
>   create mode 100644 drivers/ram/rockchip/sdram-px30-lpddr3-detect-333.inc
>   create mode 100644 drivers/ram/rockchip/sdram_common.c
>   delete mode 100644 drivers/ram/rockchip/sdram_debug.c
>   create mode 100644 drivers/ram/rockchip/sdram_pctl_px30.c
>   create mode 100644 drivers/ram/rockchip/sdram_phy_px30.c
>   create mode 100644 drivers/ram/rockchip/sdram_px30.c
>