Skip to contentSkip to conversation

add support for rk3399 soc and evb

PATCH Superseded Kever Yang 4 participants 19 messages Jul 15, 2016 – Jul 19, 2016

Subsystems (6)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Kever Yang

author
#0 lore raw

v3 cover add support for rk3399 soc and evb

This patchset add support for rk3399 with ATF based on Rockchip miniloader as secondary bootloader instead of u-boot SPL.

Rockchip miniloader init the DRAM and load the ATF and u-boot to runing address, and then jump to ATF, ATM do some init and switch to EL2/EL1 mode before jump to next loader which is u-boot here.

Pls reference board/rockchip/evb_rk3399/README to setup the board.

Will migrate to SPL once its ready for ATF.

This patch set is based on below patch:
"board: move all the rockchip board in one folder"

This patch set has been test on rk3399 evb board.

Changes in v3:
Rebase on patch from Andreas:
[PATCH] rockchip: Exclude rk_timer for ARM64 [PATCH] rockchip: Clean up CPU selection

Changes in v2:
fix description error on board Kconfig
fix a binary path error

Kever Yang (5):
dts: add support for rkchichip rk3399 soc
ARM64: rockchip: add support for rk3399 SoC based evb-board
config: add config file for evb-rk3399
mmc: rockchip: add SDHCI driver support for rockchip soc
ARM64: evb-rk3399: add a README for this board setup

 arch/arm/Kconfig                       |    2 -
 arch/arm/dts/Makefile                  |    3 +-
 arch/arm/dts/rk3399-evb.dts            |  104 ++++
 arch/arm/dts/rk3399.dtsi               | 1028 ++++++++++++++++++++++++++++++++
 arch/arm/mach-rockchip/Kconfig         |   22 +-
 arch/arm/mach-rockchip/rk3399/Kconfig  |   14 +
 arch/arm/mach-rockchip/rk3399/Makefile |    5 +
 board/rockchip/evb_rk3399/Kconfig      |   15 +
 board/rockchip/evb_rk3399/MAINTAINERS  |    0
 board/rockchip/evb_rk3399/Makefile     |    7 +
 board/rockchip/evb_rk3399/README       |   73 +++
 board/rockchip/evb_rk3399/evb-rk3399.c |   41 ++
 configs/evb-rk3399_defconfig           |   32 +
 drivers/mmc/Kconfig                    |    6 +
 drivers/mmc/Makefile                   |    1 +
 drivers/mmc/rockchip_sdhci.c           |   58 ++
 include/configs/evb_rk3399.h           |   24 +
 include/configs/rk3399_common.h        |   84 +++
 include/dt-bindings/clock/rk3399-cru.h |  746 +++++++++++++++++++++++
 19 files changed, 2261 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/dts/rk3399-evb.dts
 create mode 100644 arch/arm/dts/rk3399.dtsi
 create mode 100644 arch/arm/mach-rockchip/rk3399/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rk3399/Makefile
 create mode 100644 board/rockchip/evb_rk3399/Kconfig
 create mode 100644 board/rockchip/evb_rk3399/MAINTAINERS
 create mode 100644 board/rockchip/evb_rk3399/Makefile
 create mode 100644 board/rockchip/evb_rk3399/README
 create mode 100644 board/rockchip/evb_rk3399/evb-rk3399.c
 create mode 100644 configs/evb-rk3399_defconfig
 create mode 100644 drivers/mmc/rockchip_sdhci.c
 create mode 100644 include/configs/evb_rk3399.h
 create mode 100644 include/configs/rk3399_common.h
 create mode 100644 include/dt-bindings/clock/rk3399-cru.h
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v3 1/5 dts: add support for rkchichip rk3399 soc

These files are from kernel upstream with some modification need by uboot:
- chosen with stdout-path to uart2.

---

Changes in v3: None
Changes in v2: None

 arch/arm/dts/Makefile                  |    3 +-
 arch/arm/dts/rk3399-evb.dts            |  104 ++++
 arch/arm/dts/rk3399.dtsi               | 1028 ++++++++++++++++++++++++++++++++
 include/dt-bindings/clock/rk3399-cru.h |  746 +++++++++++++++++++++++
 4 files changed, 1880 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/rk3399-evb.dts
 create mode 100644 arch/arm/dts/rk3399.dtsi
 create mode 100644 include/dt-bindings/clock/rk3399-cru.h
arch/arm/dts/Makefile +2 -1
index 0a41eb2..62173a4 100644
@@ -27,7 +27,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rk3288-firefly.dtb \
 	rk3288-jerry.dtb \
 	rk3288-rock2-square.dtb \
-	rk3036-sdk.dtb
+	rk3036-sdk.dtb \
+	rk3399-evb.dtb
 dtb-$(CONFIG_ARCH_MESON) += \
 	meson-gxbb-odroidc2.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
arch/arm/dts/rk3399-evb.dts new file +104 -0

104 lines not on this page · raw message

arch/arm/dts/rk3399.dtsi new file +1028 -0

1,028 lines not on this page · raw message

include/dt-bindings/clock/rk3399-cru.h new file +746 -0

746 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 1/5 dts: add support for rkchichip rk3399 soc

Hi Kever,

Quoted 3 lines · Kever Yang

These files are from kernel upstream with some modification need by uboot:
- chosen with stdout-path to uart2.

Please can you fix the typo in the subject?

Quoted 15 lines

---

Changes in v3: None
Changes in v2: None

 arch/arm/dts/Makefile                  |    3 +-
 arch/arm/dts/rk3399-evb.dts            |  104 ++++
 arch/arm/dts/rk3399.dtsi               | 1028 ++++++++++++++++++++++++++++++++
 include/dt-bindings/clock/rk3399-cru.h |  746 +++++++++++++++++++++++
 4 files changed, 1880 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/rk3399-evb.dts
 create mode 100644 arch/arm/dts/rk3399.dtsi
 create mode 100644 include/dt-bindings/clock/rk3399-cru.h
#3 lore raw

PATCH v3 1/5 dts: add support for rkchichip rk3399 soc

In reply to Kever Yang

Am 15.07.2016 um 10:42 schrieb Kever Yang:

Quoted 3 lines

These files are from kernel upstream with some modification need by uboot:
- chosen with stdout-path to uart2.

Please also mention:

- clock-frequency for uart2

Cost me quite some time to figure out this was necessary...

Regards,
Andreas

Quoted 2 lines

[snip]

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
author
#4 lore raw

PATCH v3 2/5 ARM64: rockchip: add support for rk3399 SoC based evb-board

In reply to Kever Yang

RK3399 is a SoC from Rockchip with dual-core Cortex-A72 and qual-core Cortex-A53 CPU. It supports two USB3.0 type-C ports and two USB2.0 EHCI ports. Other interfaces are very like RK3288, the DRAM are 32bit width address and support address from 0 to 4GB-128MB range.

---

Changes in v3:
Rebase on patch from Andreas:
[PATCH] rockchip: Exclude rk_timer for ARM64
[PATCH] rockchip: Clean up CPU selection

Changes in v2:
fix description error on board Kconfig

 arch/arm/Kconfig                       |  2 -
 arch/arm/mach-rockchip/Kconfig         | 22 ++++++++-
 arch/arm/mach-rockchip/rk3399/Kconfig  | 14 ++++++
 arch/arm/mach-rockchip/rk3399/Makefile |  5 ++
 board/rockchip/evb_rk3399/Kconfig      | 15 ++++++
 board/rockchip/evb_rk3399/MAINTAINERS  |  0
 board/rockchip/evb_rk3399/Makefile     |  7 +++
 board/rockchip/evb_rk3399/evb-rk3399.c | 41 +++++++++++++++++
 include/configs/evb_rk3399.h           | 24 ++++++++++
 include/configs/rk3399_common.h        | 84 ++++++++++++++++++++++++++++++++++
 10 files changed, 211 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/rk3399/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rk3399/Makefile
 create mode 100644 board/rockchip/evb_rk3399/Kconfig
 create mode 100644 board/rockchip/evb_rk3399/MAINTAINERS
 create mode 100644 board/rockchip/evb_rk3399/Makefile
 create mode 100644 board/rockchip/evb_rk3399/evb-rk3399.c
 create mode 100644 include/configs/evb_rk3399.h
 create mode 100644 include/configs/rk3399_common.h
arch/arm/Kconfig +0 -2
index a262145..6e4d78a 100644
@@ -846,8 +846,6 @@ config STM32
 
 config ARCH_ROCKCHIP
 	bool "Support Rockchip SoCs"
-	select SUPPORT_SPL
-	select SPL
 	select OF_CONTROL
 	select DM
 
arch/arm/mach-rockchip/Kconfig +21 -1
index d3f5ffd..8499692 100644
@@ -9,6 +9,10 @@ config ROCKCHIP_RK3288
 	  video interfaces supporting HDMI and eDP, several DDR3 options
 	  and video codec support. Peripherals include Gigabit Ethernet,
 	  USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.
+	select CPU_V7
+	select RK_TIMER
+	select SUPPORT_SPL
+	select SPL
 
 config ROCKCHIP_RK3036
 	bool "Support Rockchip RK3036"
@@ -18,6 +22,21 @@ config ROCKCHIP_RK3036
 	  including NEON and GPU, Mali-400 graphics, several DDR3 options
 	  and video codec support. Peripherals include Gigabit Ethernet,
 	  USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs.
+	select CPU_V7
+	select RK_TIMER
+	select SUPPORT_SPL
+	select SPL
+
+config ROCKCHIP_RK3399
+	bool "Support Rockchip RK3399"
+	help
+	  The Rockchip RK3399 is a ARM-based SoC with a dual-core Cortex-A72
+	  and qual-core Cortex-A53.
+	  including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two
+	  video interfaces supporting HDMI and eDP, several DDR3 options
+	  and video codec support. Peripherals include Gigabit Ethernet,
+	  USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.
+	select ARM64
 
 config SYS_MALLOC_F
 	default y
@@ -44,8 +63,9 @@ config DM_GPIO
 	default y
 
 config BLK
-	default y
+	default y if CPU_V7
 
 source "arch/arm/mach-rockchip/rk3288/Kconfig"
 source "arch/arm/mach-rockchip/rk3036/Kconfig"
+source "arch/arm/mach-rockchip/rk3399/Kconfig"
 endif
arch/arm/mach-rockchip/rk3399/Kconfig new file +14 -0
new file mode 100644
index 0000000..923a6de
@@ -0,0 +1,14 @@
+if ROCKCHIP_RK3399
+
+config TARGET_EVB_RK3399
+	bool "RK3399 evb board"
+
+config SYS_SOC
+	default "rockchip"
+
+config SYS_MALLOC_F_LEN
+	default 0x0800
+
+source "board/rockchip/evb_rk3399/Kconfig"
+
+endif
arch/arm/mach-rockchip/rk3399/Makefile new file +5 -0
new file mode 100644
index 0000000..ca69207
@@ -0,0 +1,5 @@
+#
+# Copyright (C) 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
board/rockchip/evb_rk3399/Kconfig new file +15 -0
new file mode 100644
index 0000000..412b81c
@@ -0,0 +1,15 @@
+if TARGET_EVB_RK3399
+
+config SYS_BOARD
+	default "evb_rk3399"
+
+config SYS_VENDOR
+	default "rockchip"
+
+config SYS_CONFIG_NAME
+	default "evb_rk3399"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+
+endif
board/rockchip/evb_rk3399/MAINTAINERS new file +0 -0
new file mode 100644
index 0000000..e69de29
board/rockchip/evb_rk3399/Makefile new file +7 -0
new file mode 100644
index 0000000..aaa51c2
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y	+= evb-rk3399.o
board/rockchip/evb_rk3399/evb-rk3399.c new file +41 -0

41 lines not on this page · raw message

include/configs/evb_rk3399.h new file +24 -0
new file mode 100644
index 0000000..0bf4f66
@@ -0,0 +1,24 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __EVB_RK3399_H
+#define __EVB_RK3399_H
+
+#include <configs/rk3399_common.h>
+
+
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV 0
+/* SPL @ 32k for ~36k
+ * ENV @ 96k
+ * u-boot @ 128K
+ */
+#define CONFIG_ENV_OFFSET (96 * 1024)
+
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define CONFIG_CONSOLE_SCROLL_LINES		10
+
+#endif
include/configs/rk3399_common.h new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH v3 2/5 ARM64: rockchip: add support for rk3399 SoC based evb-board

Quoted 28 lines · Kever Yang

RK3399 is a SoC from Rockchip with dual-core Cortex-A72 and qual-core Cortex-A53 CPU. It supports two USB3.0 type-C ports and two USB2.0 EHCI ports. Other interfaces are very like RK3288, the DRAM are 32bit width address and support address from 0 to 4GB-128MB range.

---

Changes in v3:
Rebase on patch from Andreas:
[PATCH] rockchip: Exclude rk_timer for ARM64
[PATCH] rockchip: Clean up CPU selection

Changes in v2:
fix description error on board Kconfig

 arch/arm/Kconfig                       |  2 -
 arch/arm/mach-rockchip/Kconfig         | 22 ++++++++-
 arch/arm/mach-rockchip/rk3399/Kconfig  | 14 ++++++
 arch/arm/mach-rockchip/rk3399/Makefile |  5 ++
 board/rockchip/evb_rk3399/Kconfig      | 15 ++++++
 board/rockchip/evb_rk3399/MAINTAINERS  |  0
 board/rockchip/evb_rk3399/Makefile     |  7 +++
 board/rockchip/evb_rk3399/evb-rk3399.c | 41 +++++++++++++++++
 include/configs/evb_rk3399.h           | 24 ++++++++++
 include/configs/rk3399_common.h        | 84 ++++++++++++++++++++++++++++++++++
 10 files changed, 211 insertions(+), 3 deletions(-)
Quoted 8 lines
 create mode 100644 arch/arm/mach-rockchip/rk3399/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rk3399/Makefile
 create mode 100644 board/rockchip/evb_rk3399/Kconfig
 create mode 100644 board/rockchip/evb_rk3399/MAINTAINERS
 create mode 100644 board/rockchip/evb_rk3399/Makefile
 create mode 100644 board/rockchip/evb_rk3399/evb-rk3399.c
 create mode 100644 include/configs/evb_rk3399.h
 create mode 100644 include/configs/rk3399_common.h

nits below.

[...]

Quoted 8 lines
include/configs/evb_rk3399.h new file +2 -0
new file mode 100644
index 0000000..0bf4f66
@@ -0,0 +1,24 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd

include/configs/evb_rk3399.h line 12

Quoted 10 lines
include/configs/evb_rk3399.h new file +10 -0
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __EVB_RK3399_H
+#define __EVB_RK3399_H
+
+#include <configs/rk3399_common.h>
+
+

Can you drop the extra blank line?

include/configs/evb_rk3399.h line 18

Quoted 6 lines
include/configs/evb_rk3399.h new file +6 -0
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV 0
+/* SPL @ 32k for ~36k
+ * ENV @ 96k
+ * u-boot @ 128K
+ */

Comment style:

/*
* SPL @ 32k
...
*/

include/configs/evb_rk3399.h line 24

Quoted 6 lines
include/configs/evb_rk3399.h new file +6 -0
+#define CONFIG_ENV_OFFSET (96 * 1024)
+
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define CONFIG_CONSOLE_SCROLL_LINES            10
+
+#endif

[...]

Regards,
Simon

#6 lore raw

PATCH v3 2/5 ARM64: rockchip: add support for rk3399 SoC based evb-board

In reply to Kever Yang

Am 15.07.2016 um 10:42 schrieb Kever Yang:

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3288 · line 12

Quoted 9 lines
arch/arm/mach-rockchip/Kconfig +1 -0
index d3f5ffd..8499692 100644
@@ -9,6 +9,10 @@ config ROCKCHIP_RK3288
 	  video interfaces supporting HDMI and eDP, several DDR3 options
 	  and video codec support. Peripherals include Gigabit Ethernet,
 	  USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.
+	select CPU_V7

This is duplicating the select I added above. Please move them all to above help. Same below.

Quoted 18 lines
arch/arm/mach-rockchip/Kconfig +11 -0
+	select RK_TIMER
+	select SUPPORT_SPL
+	select SPL
 
 config ROCKCHIP_RK3036
 	bool "Support Rockchip RK3036"
@@ -18,6 +22,21 @@ config ROCKCHIP_RK3036
 	  including NEON and GPU, Mali-400 graphics, several DDR3 options
 	  and video codec support. Peripherals include Gigabit Ethernet,
 	  USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs.
+	select CPU_V7
+	select RK_TIMER
+	select SUPPORT_SPL
+	select SPL
+
+config ROCKCHIP_RK3399
+	bool "Support Rockchip RK3399"
+	help

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3036 · line 42

Quoted 10 lines
arch/arm/mach-rockchip/Kconfig +7 -0
+	  The Rockchip RK3399 is a ARM-based SoC with a dual-core Cortex-A72
+	  and qual-core Cortex-A53.
+	  including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two
+	  video interfaces supporting HDMI and eDP, several DDR3 options
+	  and video codec support. Peripherals include Gigabit Ethernet,
+	  USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.
+	select ARM64
 
 config SYS_MALLOC_F
 	default y

[snip]

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
#7 lore raw

PATCH v3 2/5 ARM64: rockchip: add support for rk3399 SoC based evb-board

In reply to Kever Yang

Am 15.07.2016 um 10:42 schrieb Kever Yang:

Quoted 26 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +20 -0
new file mode 100644
index 0000000..357b08b
@@ -0,0 +1,41 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+#include <dm.h>
+#include <common.h>
+#include <asm/armv8/mmu.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct mm_region rk3399_mem_map[] = {
+	{
+		.base = 0x0UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		.base = 0xf0000000UL,
+		.size = 0x10000000UL,

board/rockchip/evb_rk3399/evb-rk3399.c line 30

Quoted 10 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +10 -0
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		/* List terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = rk3399_mem_map;

[snip]

Why have this at board level? Wouldn't this be better kept in mach-rockchip?

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
#8 lore raw

PATCH v3 2/5 ARM64: rockchip: add support for rk3399 SoC based evb-board

In reply to Kever Yang

Hi,

Isn't evb short for evaluation board? That makes board board then. ;)

Am 15.07.2016 um 10:42 schrieb Kever Yang:

Quoted 2 lines

RK3399 is a SoC from Rockchip with dual-core Cortex-A72 and qual-core Cortex-A53 CPU. It supports two USB3.0

quad-core

Quoted 2 lines

type-C ports and two USB2.0 EHCI ports. Other interfaces are very like RK3288, the DRAM are 32bit width address

"very much like" or "very similar to"

Quoted 51 lines

and support address from 0 to 4GB-128MB range.

---

Changes in v3:
Rebase on patch from Andreas:
[PATCH] rockchip: Exclude rk_timer for ARM64
[PATCH] rockchip: Clean up CPU selection

Changes in v2:
fix description error on board Kconfig

 arch/arm/Kconfig                       |  2 -
 arch/arm/mach-rockchip/Kconfig         | 22 ++++++++-
 arch/arm/mach-rockchip/rk3399/Kconfig  | 14 ++++++
 arch/arm/mach-rockchip/rk3399/Makefile |  5 ++
 board/rockchip/evb_rk3399/Kconfig      | 15 ++++++
 board/rockchip/evb_rk3399/MAINTAINERS  |  0
 board/rockchip/evb_rk3399/Makefile     |  7 +++
 board/rockchip/evb_rk3399/evb-rk3399.c | 41 +++++++++++++++++
 include/configs/evb_rk3399.h           | 24 ++++++++++
 include/configs/rk3399_common.h        | 84 ++++++++++++++++++++++++++++++++++
 10 files changed, 211 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/rk3399/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rk3399/Makefile
 create mode 100644 board/rockchip/evb_rk3399/Kconfig
 create mode 100644 board/rockchip/evb_rk3399/MAINTAINERS
 create mode 100644 board/rockchip/evb_rk3399/Makefile
 create mode 100644 board/rockchip/evb_rk3399/evb-rk3399.c
 create mode 100644 include/configs/evb_rk3399.h
 create mode 100644 include/configs/rk3399_common.h
arch/arm/Kconfig +0 -2
index a262145..6e4d78a 100644
@@ -846,8 +846,6 @@ config STM32
 
 config ARCH_ROCKCHIP
 	bool "Support Rockchip SoCs"
-	select SUPPORT_SPL
-	select SPL
 	select OF_CONTROL
 	select DM
 
arch/arm/mach-rockchip/Kconfig +0 -0
index d3f5ffd..8499692 100644

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3288 · line 13

Quoted 5 lines
arch/arm/mach-rockchip/Kconfig +2 -0
@@ -9,6 +9,10 @@ config ROCKCHIP_RK3288
 	  video interfaces supporting HDMI and eDP, several DDR3 options
 	  and video codec support. Peripherals include Gigabit Ethernet,
 	  USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.
+	select CPU_V7
+	select RK_TIMER

You no longer define RK_TIMER - either please do (I liked it) or drop the selection, it leads to warnings on, e.g., firefly-rk3288_defconfig otherwise.

Quoted 9 lines
arch/arm/mach-rockchip/Kconfig +2 -0
+	select SUPPORT_SPL
+	select SPL
 
 config ROCKCHIP_RK3036
 	bool "Support Rockchip RK3036"
@@ -18,6 +22,21 @@ config ROCKCHIP_RK3036
 	  including NEON and GPU, Mali-400 graphics, several DDR3 options
 	  and video codec support. Peripherals include Gigabit Ethernet,
 	  USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs.

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3036 · line 34

Quoted 10 lines
arch/arm/mach-rockchip/Kconfig +10 -0
+	select CPU_V7
+	select RK_TIMER
+	select SUPPORT_SPL
+	select SPL
+
+config ROCKCHIP_RK3399
+	bool "Support Rockchip RK3399"
+	help
+	  The Rockchip RK3399 is a ARM-based SoC with a dual-core Cortex-A72
+	  and qual-core Cortex-A53.

quad-core

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3036 · line 38

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +4 -0
+	  including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two
+	  video interfaces supporting HDMI and eDP, several DDR3 options
+	  and video codec support. Peripherals include Gigabit Ethernet,
+	  USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.

UARTs

arch/arm/mach-rockchip/Kconfig config DM_GPIO · line 66

Quoted 10 lines
arch/arm/mach-rockchip/Kconfig +2 -1
+	select ARM64
 
 config SYS_MALLOC_F
 	default y
@@ -44,8 +63,9 @@ config DM_GPIO
 	default y
 
 config BLK
-	default y
+	default y if CPU_V7

Needs rebasing onto u-boot-rockchip.git.

Quoted 11 lines
arch/arm/mach-rockchip/Kconfig +1 -0
 source "arch/arm/mach-rockchip/rk3288/Kconfig"
 source "arch/arm/mach-rockchip/rk3036/Kconfig"
+source "arch/arm/mach-rockchip/rk3399/Kconfig"
 endif
arch/arm/mach-rockchip/rk3399/Kconfig new file +0 -0
new file mode 100644
index 0000000..923a6de

arch/arm/mach-rockchip/rk3399/Kconfig line 4

Quoted 4 lines
arch/arm/mach-rockchip/rk3399/Kconfig new file +4 -0
@@ -0,0 +1,14 @@
+if ROCKCHIP_RK3399
+
+config TARGET_EVB_RK3399
+	bool "RK3399 evb board"

Should this be enclosed in a choice section for futureproofness?

Quoted 16 lines
arch/arm/mach-rockchip/rk3399/Kconfig new file +10 -0
+
+config SYS_SOC
+	default "rockchip"
+
+config SYS_MALLOC_F_LEN
+	default 0x0800
+
+source "board/rockchip/evb_rk3399/Kconfig"
+
+endif
arch/arm/mach-rockchip/rk3399/Makefile new file +0 -0
new file mode 100644
index 0000000..ca69207

arch/arm/mach-rockchip/rk3399/Makefile line 5

Quoted 5 lines
arch/arm/mach-rockchip/rk3399/Makefile new file +5 -0
@@ -0,0 +1,5 @@
+#
+# Copyright (C) 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#

Needed?

Quoted 43 lines
board/rockchip/evb_rk3399/Kconfig new file +15 -0
new file mode 100644
index 0000000..412b81c
@@ -0,0 +1,15 @@
+if TARGET_EVB_RK3399
+
+config SYS_BOARD
+	default "evb_rk3399"
+
+config SYS_VENDOR
+	default "rockchip"
+
+config SYS_CONFIG_NAME
+	default "evb_rk3399"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+
+endif
board/rockchip/evb_rk3399/MAINTAINERS new file +0 -0
new file mode 100644
index 0000000..e69de29
board/rockchip/evb_rk3399/Makefile new file +7 -0
new file mode 100644
index 0000000..aaa51c2
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y	+= evb-rk3399.o
board/rockchip/evb_rk3399/evb-rk3399.c new file +0 -0
new file mode 100644
index 0000000..357b08b

board/rockchip/evb_rk3399/evb-rk3399.c line 6

Quoted 6 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +6 -0
@@ -0,0 +1,41 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+#include <dm.h>

Needed? Order/spacing.

Quoted 25 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +25 -0
+#include <common.h>
+#include <asm/armv8/mmu.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct mm_region rk3399_mem_map[] = {
+	{
+		.base = 0x0UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		.base = 0xf0000000UL,
+		.size = 0x10000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		/* List terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = rk3399_mem_map;
+

board/rockchip/evb_rk3399/evb-rk3399.c line 41

Quoted 10 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +10 -0
+int board_init(void)
+{
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->ram_size = 0x80000000;
+	return 0;
+}

You'll need to implement dram_init_banksize() to avoid "DRAM: 0 Bytes"?

Quoted 20 lines
include/configs/rk3399_common.h new file +14 -0
new file mode 100644
index 0000000..1c13e2e
@@ -0,0 +1,84 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_RK3399_COMMON_H
+#define __CONFIG_RK3399_COMMON_H
+
+#define CONFIG_SYS_CACHELINE_SIZE	64
+
+#include <asm/arch/hardware.h>
+
+#define CONFIG_SYS_NO_FLASH

include/configs/rk3399_common.h line 24

Quoted 10 lines
include/configs/rk3399_common.h new file +10 -0
+#define CONFIG_NR_DRAM_BANKS		1
+#define CONFIG_ENV_SIZE			0x2000
+#define CONFIG_SYS_MAXARGS		16
+#define CONFIG_BAUDRATE			1500000
+#define CONFIG_SYS_MALLOC_LEN		(32 << 20)
+#define CONFIG_SYS_CBSIZE		1024
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_NS16550

Please make this a Kconfig selection to avoid confusion.

include/configs/rk3399_common.h line 31

Quoted 7 lines
include/configs/rk3399_common.h new file +7 -0
+#define CONFIG_SYS_NS16550_MEM32
+
+#define CONFIG_SYS_TEXT_BASE		0x00200000
+#define CONFIG_SYS_INIT_SP_ADDR		0x00300000
+#define CONFIG_SYS_LOAD_ADDR		0x00800800
+
+#define CONFIG_ROCKCHIP_COMMON

This is defined by other boards, but no one seems to checks it. Suggest to drop it here and elsewhere.

include/configs/rk3399_common.h line 41

Quoted 10 lines
include/configs/rk3399_common.h new file +10 -0
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* 64M */
+
+/* MMC/SD IP block */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_SDHCI
+#define CONFIG_BOUNCE_BUFFER
+#define CONFIG_ROCKCHIP_SDHCI_MAX_FREQ	200000000
+
+#define CONFIG_DOS_PARTITION

This one is selected by config_distro_defaults.h already.

include/configs/rk3399_common.h line 44

Quoted 3 lines
include/configs/rk3399_common.h new file +3 -0
+#define CONFIG_FAT_WRITE
+#define CONFIG_PARTITION_UUIDS
+#define CONFIG_CMD_PART

These two are selected by config_distro_bootcmd.h already.

include/configs/rk3399_common.h line 56

Quoted 12 lines
include/configs/rk3399_common.h new file +12 -0
+
+/* RAW SD card / eMMC locations. */
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	256
+#define CONFIG_SYS_SPI_U_BOOT_OFFS	(128 << 10)
+
+/* FAT sd card locations. */
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
+#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot.img"
+
+#define CONFIG_SPL_PINCTRL_SUPPORT
+#define CONFIG_SPL_RAM_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT

Given that you moved SPL to rk3288, these are quite a few unneeded SPL symbols?

include/configs/rk3399_common.h line 60

Quoted 4 lines
include/configs/rk3399_common.h new file +4 -0
+
+#define CONFIG_SYS_SDRAM_BASE		0
+#define CONFIG_NR_DRAM_BANKS		1
+#define SDRAM_BANK_SIZE			(2UL << 30)

Move size into evb config? (commit message says up to ~4GB) Possibly move banks too or is it always 1?

Quoted 6 lines
include/configs/rk3399_common.h new file +6 -0
+
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI
+#define CONFIG_SF_DEFAULT_SPEED 20000000
+
+#ifndef CONFIG_SPL_BUILD

include/configs/rk3399_common.h line 76

Quoted 10 lines
include/configs/rk3399_common.h new file +10 -0
+#include <config_distro_defaults.h>
+
+#define ENV_MEM_LAYOUT_SETTINGS \
+	"scriptaddr=0x00000000\0" \
+	"pxefile_addr_r=0x00100000\0" \
+	"fdt_addr_r=0x01f00000\0" \
+	"kernel_addr_r=0x02000000\0" \
+	"ramdisk_addr_r=0x04000000\0"
+
+/* First try to boot from SD (index 0), then eMMC (index 1 */

")" missing.

include/configs/rk3399_common.h line 84

Quoted 8 lines
include/configs/rk3399_common.h new file +8 -0
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0) \
+	func(MMC, mmc, 1)
+
+#include <config_distro_bootcmd.h>
+#endif
+
+#endif

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
author
#9 lore raw

PATCH v3 2/5 ARM64: rockchip: add support for rk3399 SoC based evb-board

Hi Andreas,

Thanks for you comments, I will apply them one by one except some
confuse below.

Quoted 231 lines · Andreas F?rber

Hi,

Isn't evb short for evaluation board? That makes board board then. ;)

Am 15.07.2016 um 10:42 schrieb Kever Yang:

Quoted 2 lines

RK3399 is a SoC from Rockchip with dual-core Cortex-A72 and qual-core Cortex-A53 CPU. It supports two USB3.0

quad-core

Quoted 2 lines

type-C ports and two USB2.0 EHCI ports. Other interfaces are very like RK3288, the DRAM are 32bit width address

"very much like" or "very similar to"

Quoted 51 lines

and support address from 0 to 4GB-128MB range.

---

Changes in v3:
Rebase on patch from Andreas:
[PATCH] rockchip: Exclude rk_timer for ARM64
[PATCH] rockchip: Clean up CPU selection

Changes in v2:
fix description error on board Kconfig

  arch/arm/Kconfig                       |  2 -
  arch/arm/mach-rockchip/Kconfig         | 22 ++++++++-
  arch/arm/mach-rockchip/rk3399/Kconfig  | 14 ++++++
  arch/arm/mach-rockchip/rk3399/Makefile |  5 ++
  board/rockchip/evb_rk3399/Kconfig      | 15 ++++++
  board/rockchip/evb_rk3399/MAINTAINERS  |  0
  board/rockchip/evb_rk3399/Makefile     |  7 +++
  board/rockchip/evb_rk3399/evb-rk3399.c | 41 +++++++++++++++++
  include/configs/evb_rk3399.h           | 24 ++++++++++
  include/configs/rk3399_common.h        | 84 ++++++++++++++++++++++++++++++++++
  10 files changed, 211 insertions(+), 3 deletions(-)

create mode 100644 arch/arm/mach-rockchip/rk3399/Kconfig create mode 100644 arch/arm/mach-rockchip/rk3399/Makefile create mode 100644 board/rockchip/evb_rk3399/Kconfig create mode 100644 board/rockchip/evb_rk3399/MAINTAINERS create mode 100644 board/rockchip/evb_rk3399/Makefile create mode 100644 board/rockchip/evb_rk3399/evb-rk3399.c create mode 100644 include/configs/evb_rk3399.h create mode 100644 include/configs/rk3399_common.h

arch/arm/Kconfig +0 -2
index a262145..6e4d78a 100644
@@ -846,8 +846,6 @@ config STM32
 
  config ARCH_ROCKCHIP
  	bool "Support Rockchip SoCs"
-	select SUPPORT_SPL
-	select SPL
  	select OF_CONTROL
  	select DM
 
arch/arm/mach-rockchip/Kconfig +0 -0
index d3f5ffd..8499692 100644

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3288 · line 13

Quoted 5 lines
arch/arm/mach-rockchip/Kconfig +2 -0
@@ -9,6 +9,10 @@ config ROCKCHIP_RK3288
  	  video interfaces supporting HDMI and eDP, several DDR3 options
  	  and video codec support. Peripherals include Gigabit Ethernet,
  	  USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.
+	select CPU_V7
+	select RK_TIMER

You no longer define RK_TIMER - either please do (I liked it) or drop the selection, it leads to warnings on, e.g., firefly-rk3288_defconfig otherwise.

Quoted 9 lines
arch/arm/mach-rockchip/Kconfig +2 -0
+	select SUPPORT_SPL
+	select SPL
 
  config ROCKCHIP_RK3036
  	bool "Support Rockchip RK3036"
@@ -18,6 +22,21 @@ config ROCKCHIP_RK3036
  	  including NEON and GPU, Mali-400 graphics, several DDR3 options
  	  and video codec support. Peripherals include Gigabit Ethernet,
  	  USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs.

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3036 · line 34

Quoted 10 lines
arch/arm/mach-rockchip/Kconfig +10 -0
+	select CPU_V7
+	select RK_TIMER
+	select SUPPORT_SPL
+	select SPL
+
+config ROCKCHIP_RK3399
+	bool "Support Rockchip RK3399"
+	help
+	  The Rockchip RK3399 is a ARM-based SoC with a dual-core Cortex-A72
+	  and qual-core Cortex-A53.

quad-core

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3036 · line 38

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +4 -0
+	  including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two
+	  video interfaces supporting HDMI and eDP, several DDR3 options
+	  and video codec support. Peripherals include Gigabit Ethernet,
+	  USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.

UARTs

arch/arm/mach-rockchip/Kconfig config DM_GPIO · line 66

Quoted 10 lines
arch/arm/mach-rockchip/Kconfig +2 -1
+	select ARM64
 
  config SYS_MALLOC_F
  	default y
@@ -44,8 +63,9 @@ config DM_GPIO
  	default y
 
  config BLK
-	default y
+	default y if CPU_V7

Needs rebasing onto u-boot-rockchip.git.

Quoted 11 lines
arch/arm/mach-rockchip/Kconfig +1 -0
  source "arch/arm/mach-rockchip/rk3288/Kconfig"
  source "arch/arm/mach-rockchip/rk3036/Kconfig"
+source "arch/arm/mach-rockchip/rk3399/Kconfig"
  endif
arch/arm/mach-rockchip/rk3399/Kconfig new file +0 -0
new file mode 100644
index 0000000..923a6de

arch/arm/mach-rockchip/rk3399/Kconfig line 4

Quoted 4 lines
arch/arm/mach-rockchip/rk3399/Kconfig new file +4 -0
@@ -0,0 +1,14 @@
+if ROCKCHIP_RK3399
+
+config TARGET_EVB_RK3399
+	bool "RK3399 evb board"

Should this be enclosed in a choice section for futureproofness?

Quoted 16 lines
arch/arm/mach-rockchip/rk3399/Kconfig new file +10 -0
+
+config SYS_SOC
+	default "rockchip"
+
+config SYS_MALLOC_F_LEN
+	default 0x0800
+
+source "board/rockchip/evb_rk3399/Kconfig"
+
+endif
arch/arm/mach-rockchip/rk3399/Makefile new file +0 -0
new file mode 100644
index 0000000..ca69207

arch/arm/mach-rockchip/rk3399/Makefile line 5

Quoted 5 lines
arch/arm/mach-rockchip/rk3399/Makefile new file +5 -0
@@ -0,0 +1,5 @@
+#
+# Copyright (C) 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#

Needed?

Quoted 43 lines
board/rockchip/evb_rk3399/Kconfig new file +15 -0
new file mode 100644
index 0000000..412b81c
@@ -0,0 +1,15 @@
+if TARGET_EVB_RK3399
+
+config SYS_BOARD
+	default "evb_rk3399"
+
+config SYS_VENDOR
+	default "rockchip"
+
+config SYS_CONFIG_NAME
+	default "evb_rk3399"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+
+endif
board/rockchip/evb_rk3399/MAINTAINERS new file +0 -0
new file mode 100644
index 0000000..e69de29
board/rockchip/evb_rk3399/Makefile new file +7 -0
new file mode 100644
index 0000000..aaa51c2
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y	+= evb-rk3399.o
board/rockchip/evb_rk3399/evb-rk3399.c new file +0 -0
new file mode 100644
index 0000000..357b08b

board/rockchip/evb_rk3399/evb-rk3399.c line 6

Quoted 6 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +6 -0
@@ -0,0 +1,41 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+#include <dm.h>

Needed? Order/spacing.

Quoted 28 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +28 -0
+#include <common.h>
+#include <asm/armv8/mmu.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct mm_region rk3399_mem_map[] = {
+	{
+		.base = 0x0UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		.base = 0xf0000000UL,
+		.size = 0x10000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		/* List terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = rk3399_mem_map;
+
+int board_init(void)
+{
+	return 0;
Quoted 8 lines

board/rockchip/evb_rk3399/evb-rk3399.c line 41

Quoted 7 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +7 -0
+}
+
+int dram_init(void)
+{
+	gd->ram_size = 0x80000000;
+	return 0;
+}

You'll need to implement dram_init_banksize() to avoid "DRAM: 0 Bytes"?

I doesn't get "DRAM: 0 Bytes", I get "DRAM: 2 GiB"

Quoted 24 lines
Quoted 24 lines
include/configs/rk3399_common.h new file +17 -0
new file mode 100644
index 0000000..1c13e2e
@@ -0,0 +1,84 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_RK3399_COMMON_H
+#define __CONFIG_RK3399_COMMON_H
+
+#define CONFIG_SYS_CACHELINE_SIZE	64
+
+#include <asm/arch/hardware.h>
+
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_NR_DRAM_BANKS		1
+#define CONFIG_ENV_SIZE			0x2000
+#define CONFIG_SYS_MAXARGS		16
Quoted 8 lines

include/configs/rk3399_common.h line 24

Quoted 7 lines
include/configs/rk3399_common.h new file +7 -0
+#define CONFIG_BAUDRATE			1500000
+#define CONFIG_SYS_MALLOC_LEN		(32 << 20)
+#define CONFIG_SYS_CBSIZE		1024
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_NS16550

Please make this a Kconfig selection to avoid confusion.

OK, actually, I want to know how to decide where to put the CONFIG_ MACROs, we have defconfig, common config for soc, and common config for board.

Quoted 10 lines

include/configs/rk3399_common.h line 31

Quoted 8 lines
include/configs/rk3399_common.h new file +7 -0
+#define CONFIG_SYS_NS16550_MEM32
+
+#define CONFIG_SYS_TEXT_BASE		0x00200000
+#define CONFIG_SYS_INIT_SP_ADDR		0x00300000
+#define CONFIG_SYS_LOAD_ADDR		0x00800800
+
+#define CONFIG_ROCKCHIP_COMMON

This is defined by other boards, but no one seems to checks it. Suggest to drop it here and elsewhere.

Yes, the content for CONFIG_ROCKCHIP_COMMON has been removed, sot this MACRO is no use now.

Quoted 33 lines

include/configs/rk3399_common.h line 41

Quoted 11 lines
include/configs/rk3399_common.h new file +10 -0
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* 64M */
+
+/* MMC/SD IP block */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_SDHCI
+#define CONFIG_BOUNCE_BUFFER
+#define CONFIG_ROCKCHIP_SDHCI_MAX_FREQ	200000000
+
+#define CONFIG_DOS_PARTITION

This one is selected by config_distro_defaults.h already.

include/configs/rk3399_common.h line 44

Quoted 3 lines
include/configs/rk3399_common.h new file +3 -0
+#define CONFIG_FAT_WRITE
+#define CONFIG_PARTITION_UUIDS
+#define CONFIG_CMD_PART

These two are selected by config_distro_bootcmd.h already.

include/configs/rk3399_common.h line 56

Quoted 12 lines
include/configs/rk3399_common.h new file +12 -0
+
+/* RAW SD card / eMMC locations. */
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	256
+#define CONFIG_SYS_SPI_U_BOOT_OFFS	(128 << 10)
+
+/* FAT sd card locations. */
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
+#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot.img"
+
+#define CONFIG_SPL_PINCTRL_SUPPORT
+#define CONFIG_SPL_RAM_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT

Given that you moved SPL to rk3288, these are quite a few unneeded SPL symbols?

Quoted 6 lines

include/configs/rk3399_common.h line 60

Quoted 4 lines
include/configs/rk3399_common.h new file +4 -0
+
+#define CONFIG_SYS_SDRAM_BASE		0
+#define CONFIG_NR_DRAM_BANKS		1
+#define SDRAM_BANK_SIZE			(2UL << 30)

Move size into evb config? (commit message says up to ~4GB) Possibly move banks too or is it always 1?

Rockchip evb is is combined by a mainboard and a daughter board which daughter board usually including rk3399, DRAM, eMMC, the DRAM could be 2GB or 4GB. The rk3399 SoC can support up to 4G-128M, but for U-Boot, we don't actually using so large space, maybe 128MB is enough.
So we prefer to using a 2GB config for compatible, which also easy to setup to MMU table.

Thanks,
- Kever

Quoted 30 lines
Quoted 7 lines
include/configs/rk3399_common.h new file +6 -0
+
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI
+#define CONFIG_SF_DEFAULT_SPEED 20000000
+
+#ifndef CONFIG_SPL_BUILD

include/configs/rk3399_common.h line 76

Quoted 10 lines
include/configs/rk3399_common.h new file +10 -0
+#include <config_distro_defaults.h>
+
+#define ENV_MEM_LAYOUT_SETTINGS \
+	"scriptaddr=0x00000000\0" \
+	"pxefile_addr_r=0x00100000\0" \
+	"fdt_addr_r=0x01f00000\0" \
+	"kernel_addr_r=0x02000000\0" \
+	"ramdisk_addr_r=0x04000000\0"
+
+/* First try to boot from SD (index 0), then eMMC (index 1 */

")" missing.

include/configs/rk3399_common.h line 84

Quoted 8 lines
include/configs/rk3399_common.h new file +8 -0
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0) \
+	func(MMC, mmc, 1)
+
+#include <config_distro_bootcmd.h>
+#endif
+
+#endif

Regards,
Andreas

#10 lore raw

PATCH v3 2/5 ARM64: rockchip: add support for rk3399 SoC based evb-board

Hi Kever,

Am 18.07.2016 um 06:54 schrieb Kever Yang:

Quoted 248 lines

Hi Andreas,

Thanks for you comments, I will apply them one by one except some
confuse below.

Quoted 234 lines · Andreas F?rber

Hi,

Isn't evb short for evaluation board? That makes board board then. ;)

Am 15.07.2016 um 10:42 schrieb Kever Yang:

Quoted 2 lines

RK3399 is a SoC from Rockchip with dual-core Cortex-A72 and qual-core Cortex-A53 CPU. It supports two USB3.0

quad-core

Quoted 2 lines

type-C ports and two USB2.0 EHCI ports. Other interfaces are very like RK3288, the DRAM are 32bit width address

"very much like" or "very similar to"

Quoted 51 lines

and support address from 0 to 4GB-128MB range.

---

Changes in v3:
Rebase on patch from Andreas:
[PATCH] rockchip: Exclude rk_timer for ARM64 [PATCH] rockchip: Clean up CPU selection

Changes in v2:
fix description error on board Kconfig

  arch/arm/Kconfig                       |  2 -
  arch/arm/mach-rockchip/Kconfig         | 22 ++++++++-
  arch/arm/mach-rockchip/rk3399/Kconfig  | 14 ++++++
  arch/arm/mach-rockchip/rk3399/Makefile |  5 ++
  board/rockchip/evb_rk3399/Kconfig      | 15 ++++++
  board/rockchip/evb_rk3399/MAINTAINERS  |  0
  board/rockchip/evb_rk3399/Makefile     |  7 +++
  board/rockchip/evb_rk3399/evb-rk3399.c | 41 +++++++++++++++++
  include/configs/evb_rk3399.h           | 24 ++++++++++
  include/configs/rk3399_common.h        | 84
++++++++++++++++++++++++++++++++++
  10 files changed, 211 insertions(+), 3 deletions(-)

create mode 100644 arch/arm/mach-rockchip/rk3399/Kconfig create mode 100644 arch/arm/mach-rockchip/rk3399/Makefile create mode 100644 board/rockchip/evb_rk3399/Kconfig create mode 100644 board/rockchip/evb_rk3399/MAINTAINERS create mode 100644 board/rockchip/evb_rk3399/Makefile create mode 100644 board/rockchip/evb_rk3399/evb-rk3399.c create mode 100644 include/configs/evb_rk3399.h create mode 100644 include/configs/rk3399_common.h

arch/arm/Kconfig +0 -2
index a262145..6e4d78a 100644
@@ -846,8 +846,6 @@ config STM32
    config ARCH_ROCKCHIP
      bool "Support Rockchip SoCs"
-    select SUPPORT_SPL
-    select SPL
      select OF_CONTROL
      select DM
  diff --git a/arch/arm/mach-rockchip/Kconfig

b/arch/arm/mach-rockchip/Kconfig
index d3f5ffd..8499692 100644

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3288 · line 13

Quoted 5 lines
arch/arm/mach-rockchip/Kconfig +2 -0
@@ -9,6 +9,10 @@ config ROCKCHIP_RK3288
        video interfaces supporting HDMI and eDP, several DDR3 options
        and video codec support. Peripherals include Gigabit Ethernet,
        USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.
+    select CPU_V7
+    select RK_TIMER

You no longer define RK_TIMER - either please do (I liked it) or drop the selection, it leads to warnings on, e.g., firefly-rk3288_defconfig otherwise.

Quoted 17 lines
arch/arm/mach-rockchip/Kconfig +11 -0
+    select SUPPORT_SPL
+    select SPL
    config ROCKCHIP_RK3036
      bool "Support Rockchip RK3036"
@@ -18,6 +22,21 @@ config ROCKCHIP_RK3036
        including NEON and GPU, Mali-400 graphics, several DDR3 options
        and video codec support. Peripherals include Gigabit Ethernet,
        USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs.
+    select CPU_V7
+    select RK_TIMER
+    select SUPPORT_SPL
+    select SPL
+
+config ROCKCHIP_RK3399
+    bool "Support Rockchip RK3399"
+    help
+      The Rockchip RK3399 is a ARM-based SoC with a dual-core
Quoted 2 lines

Cortex-A72
+ and qual-core Cortex-A53.

quad-core

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3036 · line 38

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +4 -0
+      including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two
+      video interfaces supporting HDMI and eDP, several DDR3 options
+      and video codec support. Peripherals include Gigabit Ethernet,
+      USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.

UARTs

arch/arm/mach-rockchip/Kconfig config DM_GPIO · line 65

Quoted 8 lines
arch/arm/mach-rockchip/Kconfig +2 -1
+    select ARM64
    config SYS_MALLOC_F
      default y
@@ -44,8 +63,9 @@ config DM_GPIO
      default y
    config BLK
-    default y
+    default y if CPU_V7

Needs rebasing onto u-boot-rockchip.git.

Quoted 11 lines
arch/arm/mach-rockchip/Kconfig +1 -0
    source "arch/arm/mach-rockchip/rk3288/Kconfig"
  source "arch/arm/mach-rockchip/rk3036/Kconfig"
+source "arch/arm/mach-rockchip/rk3399/Kconfig"
  endif
arch/arm/mach-rockchip/rk3399/Kconfig new file +0 -0
new file mode 100644
index 0000000..923a6de

arch/arm/mach-rockchip/rk3399/Kconfig line 4

Quoted 4 lines
arch/arm/mach-rockchip/rk3399/Kconfig new file +4 -0
@@ -0,0 +1,14 @@
+if ROCKCHIP_RK3399
+
+config TARGET_EVB_RK3399
+    bool "RK3399 evb board"

Should this be enclosed in a choice section for futureproofness?

Quoted 17 lines
arch/arm/mach-rockchip/rk3399/Kconfig new file +10 -0
+
+config SYS_SOC
+    default "rockchip"
+
+config SYS_MALLOC_F_LEN
+    default 0x0800
+
+source "board/rockchip/evb_rk3399/Kconfig"
+
+endif
arch/arm/mach-rockchip/rk3399/Makefile new file +0 -0
new file mode 100644
index 0000000..ca69207

arch/arm/mach-rockchip/rk3399/Makefile line 5

Quoted 5 lines
arch/arm/mach-rockchip/rk3399/Makefile new file +5 -0
@@ -0,0 +1,5 @@
+#
+# Copyright (C) 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#

Needed?

Quoted 47 lines
board/rockchip/evb_rk3399/Kconfig new file +15 -0
new file mode 100644
index 0000000..412b81c
@@ -0,0 +1,15 @@
+if TARGET_EVB_RK3399
+
+config SYS_BOARD
+    default "evb_rk3399"
+
+config SYS_VENDOR
+    default "rockchip"
+
+config SYS_CONFIG_NAME
+    default "evb_rk3399"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+    def_bool y
+
+endif
board/rockchip/evb_rk3399/MAINTAINERS new file +0 -0
new file mode 100644
index 0000000..e69de29
board/rockchip/evb_rk3399/Makefile new file +7 -0
new file mode 100644
index 0000000..aaa51c2
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y    += evb-rk3399.o
board/rockchip/evb_rk3399/evb-rk3399.c new file +0 -0
new file mode 100644
index 0000000..357b08b

board/rockchip/evb_rk3399/evb-rk3399.c line 6

Quoted 6 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +6 -0
@@ -0,0 +1,41 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+#include <dm.h>

Needed? Order/spacing.

Quoted 28 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +28 -0
+#include <common.h>
+#include <asm/armv8/mmu.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct mm_region rk3399_mem_map[] = {
+    {
+        .base = 0x0UL,
+        .size = 0x80000000UL,
+        .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+             PTE_BLOCK_INNER_SHARE
+    }, {
+        .base = 0xf0000000UL,
+        .size = 0x10000000UL,
+        .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+             PTE_BLOCK_NON_SHARE |
+             PTE_BLOCK_PXN | PTE_BLOCK_UXN
+    }, {
+        /* List terminator */
+        0,
+    }
+};
+
+struct mm_region *mem_map = rk3399_mem_map;
+
+int board_init(void)
+{
+    return 0;
Quoted 8 lines

board/rockchip/evb_rk3399/evb-rk3399.c line 41

Quoted 7 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +7 -0
+}
+
+int dram_init(void)
+{
+    gd->ram_size = 0x80000000;
+    return 0;
+}

You'll need to implement dram_init_banksize() to avoid "DRAM: 0 Bytes"?

Quoted 1 line

I doesn't get "DRAM: 0 Bytes", I get "DRAM: 2 GiB"

Okay, not sure what the difference between our patches was then.

But please remember to leave a white line before and after your inline comments or they are really hard to spot among a huge quote!

Note that this happens among others in Thunderbird when writing in HTML mode but sending as text mode. (That's why I force my account to always use text mode also for composing, which works around that.)

Quoted 33 lines
Quoted 25 lines
Quoted 25 lines
include/configs/rk3399_common.h new file +17 -0
new file mode 100644
index 0000000..1c13e2e
@@ -0,0 +1,84 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_RK3399_COMMON_H
+#define __CONFIG_RK3399_COMMON_H
+
+#define CONFIG_SYS_CACHELINE_SIZE    64
+
+#include <asm/arch/hardware.h>
+
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_NR_DRAM_BANKS        1
+#define CONFIG_ENV_SIZE            0x2000
+#define CONFIG_SYS_MAXARGS        16
Quoted 8 lines

include/configs/rk3399_common.h line 24

Quoted 7 lines
include/configs/rk3399_common.h new file +7 -0
+#define CONFIG_BAUDRATE            1500000
+#define CONFIG_SYS_MALLOC_LEN        (32 << 20)
+#define CONFIG_SYS_CBSIZE        1024
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_NS16550

Please make this a Kconfig selection to avoid confusion.

Quoted 3 lines

OK, actually, I want to know how to decide where to put the CONFIG_ MACROs, we have defconfig, common config for soc, and common config for board.

I don't have a definitive answer, but defconfig is per board, so if something is always needed for the SoC it should go into the mach-rockchip or rk3399 Kconfig, I think.

Whether that applies here ... Simon?

Quoted 50 lines
Quoted 9 lines

include/configs/rk3399_common.h line 31

Quoted 7 lines
include/configs/rk3399_common.h new file +7 -0
+#define CONFIG_SYS_NS16550_MEM32
+
+#define CONFIG_SYS_TEXT_BASE        0x00200000
+#define CONFIG_SYS_INIT_SP_ADDR        0x00300000
+#define CONFIG_SYS_LOAD_ADDR        0x00800800
+
+#define CONFIG_ROCKCHIP_COMMON

This is defined by other boards, but no one seems to checks it. Suggest to drop it here and elsewhere.

Yes, the content for CONFIG_ROCKCHIP_COMMON has been removed, sot this MACRO is no use now.

Quoted 33 lines

include/configs/rk3399_common.h line 41

Quoted 11 lines
include/configs/rk3399_common.h new file +10 -0
+#define CONFIG_SYS_BOOTM_LEN    (64 << 20)    /* 64M */
+
+/* MMC/SD IP block */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_SDHCI
+#define CONFIG_BOUNCE_BUFFER
+#define CONFIG_ROCKCHIP_SDHCI_MAX_FREQ    200000000
+
+#define CONFIG_DOS_PARTITION

This one is selected by config_distro_defaults.h already.

include/configs/rk3399_common.h line 44

Quoted 3 lines
include/configs/rk3399_common.h new file +3 -0
+#define CONFIG_FAT_WRITE
+#define CONFIG_PARTITION_UUIDS
+#define CONFIG_CMD_PART

These two are selected by config_distro_bootcmd.h already.

include/configs/rk3399_common.h line 56

Quoted 12 lines
include/configs/rk3399_common.h new file +12 -0
+
+/* RAW SD card / eMMC locations. */
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR    256
+#define CONFIG_SYS_SPI_U_BOOT_OFFS    (128 << 10)
+
+/* FAT sd card locations. */
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION    1
+#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME        "u-boot.img"
+
+#define CONFIG_SPL_PINCTRL_SUPPORT
+#define CONFIG_SPL_RAM_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT

Given that you moved SPL to rk3288, these are quite a few unneeded SPL symbols?

Quoted 6 lines

include/configs/rk3399_common.h line 60

Quoted 4 lines
include/configs/rk3399_common.h new file +4 -0
+
+#define CONFIG_SYS_SDRAM_BASE        0
+#define CONFIG_NR_DRAM_BANKS        1
+#define SDRAM_BANK_SIZE            (2UL << 30)

Move size into evb config? (commit message says up to ~4GB) Possibly move banks too or is it always 1?

Quoted 7 lines

Rockchip evb is is combined by a mainboard and a daughter board which daughter board usually including rk3399, DRAM, eMMC, the DRAM could be 2GB or 4GB. The rk3399 SoC can support up to 4G-128M, but for U-Boot, we don't actually using so large space, maybe 128MB is enough.
So we prefer to using a 2GB config for compatible, which also easy to setup to MMU table.

I don't see a problem with configuring less DRAM than available, but it will become an issue once there are boards or TV boxes with 1 GB or less. Therefore it's safer to place the SDRAM_BANK_SIZE into the evb's config to force new boards to set it to a sane value.

How much RAM does the DDR blob enable? If it's more than 128 MB then we should use the full 2GB or whatever here, since it affects loading of kernels and operation of EFI applications such as GRUB (which will allocate from top of RAM).

Note to self: In my patch I seem not to set SDRAM_BANK_SIZE at all, which may be why I was seeing "DRAM: 0 Bytes".

Thanks,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
author
#11 lore raw

PATCH v3 2/5 ARM64: rockchip: add support for rk3399 SoC based evb-board

Hi Andreas,

Quoted 17 lines · Andreas F?rber

Hi Kever,

Am 18.07.2016 um 06:54 schrieb Kever Yang:

Quoted 14 lines

Hi Andreas,

Thanks for you comments, I will apply them one by one except some
confuse below.

Quoted 8 lines · Andreas F?rber

Hi,

Isn't evb short for evaluation board? That makes board board then. ;)

Am 15.07.2016 um 10:42 schrieb Kever Yang:

Quoted 2 lines

RK3399 is a SoC from Rockchip with dual-core Cortex-A72 and qual-core Cortex-A53 CPU. It supports two USB3.0

quad-core

Fixed.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

type-C ports and two USB2.0 EHCI ports. Other interfaces are very like RK3288, the DRAM are 32bit width address

"very much like" or "very similar to"

Fixed.

Quoted 52 lines
Quoted 52 lines
Quoted 52 lines
Quoted 52 lines

and support address from 0 to 4GB-128MB range.

---

Changes in v3:
Rebase on patch from Andreas:
[PATCH] rockchip: Exclude rk_timer for ARM64 [PATCH] rockchip: Clean up CPU selection

Changes in v2:
fix description error on board Kconfig

   arch/arm/Kconfig                       |  2 -
   arch/arm/mach-rockchip/Kconfig         | 22 ++++++++-
   arch/arm/mach-rockchip/rk3399/Kconfig  | 14 ++++++
   arch/arm/mach-rockchip/rk3399/Makefile |  5 ++
   board/rockchip/evb_rk3399/Kconfig      | 15 ++++++
   board/rockchip/evb_rk3399/MAINTAINERS  |  0
   board/rockchip/evb_rk3399/Makefile     |  7 +++
   board/rockchip/evb_rk3399/evb-rk3399.c | 41 +++++++++++++++++
   include/configs/evb_rk3399.h           | 24 ++++++++++
   include/configs/rk3399_common.h        | 84
++++++++++++++++++++++++++++++++++
   10 files changed, 211 insertions(+), 3 deletions(-)

create mode 100644 arch/arm/mach-rockchip/rk3399/Kconfig create mode 100644 arch/arm/mach-rockchip/rk3399/Makefile create mode 100644 board/rockchip/evb_rk3399/Kconfig create mode 100644 board/rockchip/evb_rk3399/MAINTAINERS create mode 100644 board/rockchip/evb_rk3399/Makefile create mode 100644 board/rockchip/evb_rk3399/evb-rk3399.c create mode 100644 include/configs/evb_rk3399.h create mode 100644 include/configs/rk3399_common.h

arch/arm/Kconfig +0 -2
index a262145..6e4d78a 100644
@@ -846,8 +846,6 @@ config STM32
     config ARCH_ROCKCHIP
       bool "Support Rockchip SoCs"
-    select SUPPORT_SPL
-    select SPL
       select OF_CONTROL
       select DM
   diff --git a/arch/arm/mach-rockchip/Kconfig

b/arch/arm/mach-rockchip/Kconfig
index d3f5ffd..8499692 100644

arch/arm/mach-rockchip/Kconfig +0 -0
@@ -9,6 +9,10 @@ config ROCKCHIP_RK3288
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3288 · line 13

Quoted 5 lines
arch/arm/mach-rockchip/Kconfig +2 -0
         video interfaces supporting HDMI and eDP, several DDR3 options
         and video codec support. Peripherals include Gigabit Ethernet,
         USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.
+    select CPU_V7
+    select RK_TIMER

You no longer define RK_TIMER - either please do (I liked it) or drop the selection, it leads to warnings on, e.g., firefly-rk3288_defconfig otherwise.

Fixed.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
arch/arm/mach-rockchip/Kconfig +6 -0
+    select SUPPORT_SPL
+    select SPL
     config ROCKCHIP_RK3036
       bool "Support Rockchip RK3036"
@@ -18,6 +22,21 @@ config ROCKCHIP_RK3036
         including NEON and GPU, Mali-400 graphics, several DDR3 options
         and video codec support. Peripherals include Gigabit Ethernet,
         USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs.
+    select CPU_V7
+    select RK_TIMER
+    select SUPPORT_SPL
+    select SPL
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
arch/arm/mach-rockchip/Kconfig +5 -0
+
+config ROCKCHIP_RK3399
+    bool "Support Rockchip RK3399"
+    help
+      The Rockchip RK3399 is a ARM-based SoC with a dual-core

Cortex-A72
+ and qual-core Cortex-A53.

quad-core

Fixed.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3036 · line 38

Quoted 5 lines
arch/arm/mach-rockchip/Kconfig +4 -0
+      including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two
+      video interfaces supporting HDMI and eDP, several DDR3 options
+      and video codec support. Peripherals include Gigabit Ethernet,
+      USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.

UARTs

Fixed.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

arch/arm/mach-rockchip/Kconfig config DM_GPIO · line 65

Quoted 9 lines
arch/arm/mach-rockchip/Kconfig +2 -1
+    select ARM64
     config SYS_MALLOC_F
       default y
@@ -44,8 +63,9 @@ config DM_GPIO
       default y
     config BLK
-    default y
+    default y if CPU_V7

Needs rebasing onto u-boot-rockchip.git.

Will fix in V5.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 12 lines
arch/arm/mach-rockchip/Kconfig +1 -0
     source "arch/arm/mach-rockchip/rk3288/Kconfig"
   source "arch/arm/mach-rockchip/rk3036/Kconfig"
+source "arch/arm/mach-rockchip/rk3399/Kconfig"
   endif
arch/arm/mach-rockchip/rk3399/Kconfig new file +0 -0
new file mode 100644
index 0000000..923a6de

arch/arm/mach-rockchip/rk3399/Kconfig line 4

Quoted 4 lines
arch/arm/mach-rockchip/rk3399/Kconfig new file +4 -0
@@ -0,0 +1,14 @@
+if ROCKCHIP_RK3399
+
+config TARGET_EVB_RK3399
+    bool "RK3399 evb board"

Should this be enclosed in a choice section for futureproofness?

Will fix in V5.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
arch/arm/mach-rockchip/rk3399/Kconfig new file +10 -0
+
+config SYS_SOC
+    default "rockchip"
+
+config SYS_MALLOC_F_LEN
+    default 0x0800
+
+source "board/rockchip/evb_rk3399/Kconfig"
+
+endif
arch/arm/mach-rockchip/rk3399/Makefile new file +0 -1
new file mode 100644
index 0000000..ca69207
--- /dev/null
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-rockchip/rk3399/Makefile line 5

Quoted 7 lines

+++ b/arch/arm/mach-rockchip/rk3399/Makefile

arch/arm/mach-rockchip/rk3399/Makefile new file +5 -0
@@ -0,0 +1,5 @@
+#
+# Copyright (C) 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#

Needed?

Fixed.

Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
board/rockchip/evb_rk3399/Kconfig new file +15 -0
new file mode 100644
index 0000000..412b81c
@@ -0,0 +1,15 @@
+if TARGET_EVB_RK3399
+
+config SYS_BOARD
+    default "evb_rk3399"
+
+config SYS_VENDOR
+    default "rockchip"
+
+config SYS_CONFIG_NAME
+    default "evb_rk3399"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+    def_bool y
+
+endif
board/rockchip/evb_rk3399/MAINTAINERS new file +0 -0
new file mode 100644
index 0000000..e69de29
board/rockchip/evb_rk3399/Makefile new file +7 -0
new file mode 100644
index 0000000..aaa51c2
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y    += evb-rk3399.o
board/rockchip/evb_rk3399/evb-rk3399.c new file +0 -0
new file mode 100644
index 0000000..357b08b
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

board/rockchip/evb_rk3399/evb-rk3399.c line 6

Quoted 7 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +6 -0
@@ -0,0 +1,41 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+#include <dm.h>

Needed? Order/spacing.

Fixed.

Quoted 79 lines
Quoted 37 lines
Quoted 29 lines
Quoted 29 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +28 -0
+#include <common.h>
+#include <asm/armv8/mmu.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct mm_region rk3399_mem_map[] = {
+    {
+        .base = 0x0UL,
+        .size = 0x80000000UL,
+        .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+             PTE_BLOCK_INNER_SHARE
+    }, {
+        .base = 0xf0000000UL,
+        .size = 0x10000000UL,
+        .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+             PTE_BLOCK_NON_SHARE |
+             PTE_BLOCK_PXN | PTE_BLOCK_UXN
+    }, {
+        /* List terminator */
+        0,
+    }
+};
+
+struct mm_region *mem_map = rk3399_mem_map;
+
+int board_init(void)
+{
+    return 0;
Quoted 8 lines

board/rockchip/evb_rk3399/evb-rk3399.c line 41

Quoted 7 lines
board/rockchip/evb_rk3399/evb-rk3399.c new file +7 -0
+}
+
+int dram_init(void)
+{
+    gd->ram_size = 0x80000000;
+    return 0;
+}

You'll need to implement dram_init_banksize() to avoid "DRAM: 0 Bytes"?

Quoted 1 line

I doesn't get "DRAM: 0 Bytes", I get "DRAM: 2 GiB"

Okay, not sure what the difference between our patches was then.

But please remember to leave a white line before and after your inline comments or they are really hard to spot among a huge quote!

Note that this happens among others in Thunderbird when writing in HTML mode but sending as text mode. (That's why I force my account to always use text mode also for composing, which works around that.)

Quoted 32 lines
Quoted 32 lines
Quoted 21 lines
include/configs/rk3399_common.h new file +14 -0
new file mode 100644
index 0000000..1c13e2e
@@ -0,0 +1,84 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_RK3399_COMMON_H
+#define __CONFIG_RK3399_COMMON_H
+
+#define CONFIG_SYS_CACHELINE_SIZE    64
+
+#include <asm/arch/hardware.h>
+
+#define CONFIG_SYS_NO_FLASH

include/configs/rk3399_common.h line 24

Quoted 10 lines
include/configs/rk3399_common.h new file +10 -0
+#define CONFIG_NR_DRAM_BANKS        1
+#define CONFIG_ENV_SIZE            0x2000
+#define CONFIG_SYS_MAXARGS        16
+#define CONFIG_BAUDRATE            1500000
+#define CONFIG_SYS_MALLOC_LEN        (32 << 20)
+#define CONFIG_SYS_CBSIZE        1024
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_SYS_NS16550

Please make this a Kconfig selection to avoid confusion.

Quoted 8 lines
Quoted 3 lines

OK, actually, I want to know how to decide where to put the CONFIG_ MACROs, we have defconfig, common config for soc, and common config for board.

I don't have a definitive answer, but defconfig is per board, so if something is always needed for the SoC it should go into the mach-rockchip or rk3399 Kconfig, I think.

Whether that applies here ... Simon?

People add "CONFIG_SYS_NS16550=y" in defconfig, so I will do that too.

Quoted 12 lines
Quoted 12 lines
Quoted 10 lines

include/configs/rk3399_common.h line 31

Quoted 8 lines
include/configs/rk3399_common.h new file +7 -0
+#define CONFIG_SYS_NS16550_MEM32
+
+#define CONFIG_SYS_TEXT_BASE        0x00200000
+#define CONFIG_SYS_INIT_SP_ADDR        0x00300000
+#define CONFIG_SYS_LOAD_ADDR        0x00800800
+
+#define CONFIG_ROCKCHIP_COMMON

This is defined by other boards, but no one seems to checks it. Suggest to drop it here and elsewhere.

Yes, the content for CONFIG_ROCKCHIP_COMMON has been removed, sot this MACRO is no use now.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

include/configs/rk3399_common.h line 41

Quoted 10 lines
include/configs/rk3399_common.h new file +10 -0
+#define CONFIG_SYS_BOOTM_LEN    (64 << 20)    /* 64M */
+
+/* MMC/SD IP block */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_SDHCI
+#define CONFIG_BOUNCE_BUFFER
+#define CONFIG_ROCKCHIP_SDHCI_MAX_FREQ    200000000
+
+#define CONFIG_DOS_PARTITION

This one is selected by config_distro_defaults.h already.

Fixed

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

include/configs/rk3399_common.h line 44

Quoted 4 lines
include/configs/rk3399_common.h new file +3 -0
+#define CONFIG_FAT_WRITE
+#define CONFIG_PARTITION_UUIDS
+#define CONFIG_CMD_PART

These two are selected by config_distro_bootcmd.h already.

Fixed

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

include/configs/rk3399_common.h line 56

Quoted 13 lines
include/configs/rk3399_common.h new file +12 -0
+
+/* RAW SD card / eMMC locations. */
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR    256
+#define CONFIG_SYS_SPI_U_BOOT_OFFS    (128 << 10)
+
+/* FAT sd card locations. */
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION    1
+#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME        "u-boot.img"
+
+#define CONFIG_SPL_PINCTRL_SUPPORT
+#define CONFIG_SPL_RAM_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT

Given that you moved SPL to rk3288, these are quite a few unneeded SPL symbols?

Fixed

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines

include/configs/rk3399_common.h line 60

Quoted 5 lines
include/configs/rk3399_common.h new file +4 -0
+
+#define CONFIG_SYS_SDRAM_BASE        0
+#define CONFIG_NR_DRAM_BANKS        1
+#define SDRAM_BANK_SIZE            (2UL << 30)

Move size into evb config? (commit message says up to ~4GB) Possibly move banks too or is it always 1?

Quoted 7 lines

Rockchip evb is is combined by a mainboard and a daughter board which daughter board usually including rk3399, DRAM, eMMC, the DRAM could be 2GB or 4GB. The rk3399 SoC can support up to 4G-128M, but for U-Boot, we don't actually using so large space, maybe 128MB is enough.
So we prefer to using a 2GB config for compatible, which also easy to setup to MMU table.

Quoted 4 lines

I don't see a problem with configuring less DRAM than available, but it will become an issue once there are boards or TV boxes with 1 GB or less. Therefore it's safer to place the SDRAM_BANK_SIZE into the evb's config to force new boards to set it to a sane value.

Moved the SDRAM_BANK_SIZE to evb's config in V5. The CONFIG_NR_DRAM_BANKS is always 1 for Rockchip SoCs.

Quoted 2 lines

How much RAM does the DDR blob enable? If it's more than 128 MB then we

What do your mean by "How much RAM does the DDR blob enable?"?

Thanks,
- Kever

Quoted 10 lines

should use the full 2GB or whatever here, since it affects loading of kernels and operation of EFI applications such as GRUB (which will allocate from top of RAM).

Note to self: In my patch I seem not to set SDRAM_BANK_SIZE at all, which may be why I was seeing "DRAM: 0 Bytes".

Thanks,
Andreas

#12 lore raw

PATCH v3 2/5 ARM64: rockchip: add support for rk3399 SoC based evb-board

In reply to Kever Yang

Am 15.07.2016 um 10:42 schrieb Kever Yang:

Quoted 5 lines
include/configs/rk3399_common.h new file +0 -0
new file mode 100644
index 0000000..1c13e2e

[...]

Quoted 6 lines
include/configs/rk3399_common.h new file +6 -0
+#ifndef CONFIG_SPL_BUILD
+#include <config_distro_defaults.h>
+
+#define ENV_MEM_LAYOUT_SETTINGS \
+	"scriptaddr=0x00000000\0" \
+	"pxefile_addr_r=0x00100000\0" \

include/configs/rk3399_common.h line 81

Quoted 10 lines
include/configs/rk3399_common.h new file +10 -0
+	"fdt_addr_r=0x01f00000\0" \
+	"kernel_addr_r=0x02000000\0" \
+	"ramdisk_addr_r=0x04000000\0"
+
+/* First try to boot from SD (index 0), then eMMC (index 1 */
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0) \
+	func(MMC, mmc, 1)
+
+#include <config_distro_bootcmd.h>

Lacking CONFIG_EXTRA_ENV_SETTINGS that incorporates BOOTENV, otherwise leads to error message about missing $distro_bootcmd.

include/configs/rk3399_common.h line 84

Quoted 3 lines
include/configs/rk3399_common.h new file +3 -0
+#endif
+
+#endif

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
author
#13 lore raw

PATCH v3 3/5 config: add config file for evb-rk3399

In reply to Kever Yang

This patch add basic config option for evb-rk3399 board.

---

Changes in v3: None
Changes in v2: None

 configs/evb-rk3399_defconfig | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 configs/evb-rk3399_defconfig
configs/evb-rk3399_defconfig new file +32 -0
new file mode 100644
index 0000000..5c82cb1
@@ -0,0 +1,32 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_ROCKCHIP_RK3399=y
+CONFIG_TARGET_EVB_RK3399=y
+CONFIG_DEFAULT_DEVICE_TREE="rk3399-evb"
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_IMLS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_TIME=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_CLK=y
+CONFIG_FIT=y
+CONFIG_SYSRESET=y
+CONFIG_DM_MMC=y
+CONFIG_ROCKCHIP_SDHCI=y
+CONFIG_PINCTRL=y
+CONFIG_RAM=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_BASE=0xFF1A0000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_USE_TINY_PRINTF=y
+CONFIG_ERRNO_STR=y
Signature · 1 line
1.9.1
#14 lore raw

PATCH v3 3/5 config: add config file for evb-rk3399

Quoted 11 lines · Kever Yang

This patch add basic config option for evb-rk3399 board.

---

Changes in v3: None
Changes in v2: None

 configs/evb-rk3399_defconfig | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 configs/evb-rk3399_defconfig
author
#15 lore raw

PATCH v3 4/5 mmc: rockchip: add SDHCI driver support for rockchip soc

In reply to Kever Yang

Rockchip rk3399 using arasan sdhci-5.1 controller.
This patch add the controller support to enable mmc device and tested on rk3399 evb board.

---

Changes in v3: None
Changes in v2: None

 drivers/mmc/Kconfig          |  6 +++++
 drivers/mmc/Makefile         |  1 +
 drivers/mmc/rockchip_sdhci.c | 58 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+)
 create mode 100644 drivers/mmc/rockchip_sdhci.c
drivers/mmc/Kconfig +6 -0
index c80efc3..75c2d92 100644
@@ -52,6 +52,12 @@ config ZYNQ_SDHCI
 	help
 	  Support for Arasan SDHCI host controller on Zynq/ZynqMP ARM SoCs platform
 
+config ROCKCHIP_SDHCI
+	bool "Arasan SDHCI controller for Rockchip support"
+	depends on DM_MMC && OF_CONTROL
+	help
+	  Support for Arasan SDHCI host controller on Rockchip ARM SoCs platform
+
 config MMC_UNIPHIER
 	bool "UniPhier SD/MMC Host Controller support"
 	depends on ARCH_UNIPHIER
drivers/mmc/Makefile +1 -0
index 3da4817..7cb2ab0 100644
@@ -53,6 +53,7 @@ obj-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.o
 obj-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
 obj-$(CONFIG_MMC_UNIPHIER) += uniphier-sd.o
 obj-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o
+obj-$(CONFIG_ROCKCHIP_SDHCI) += rockchip_sdhci.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
drivers/mmc/rockchip_sdhci.c new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
1.9.1
#16 lore raw

PATCH v3 4/5 mmc: rockchip: add SDHCI driver support for rockchip soc

Hi Kever,

Quoted 7 lines · Kever Yang

Rockchip rk3399 using arasan sdhci-5.1 controller.
This patch add the controller support to enable mmc device and tested on rk3399 evb board.

---

Quoted 9 lines

Changes in v3: None
Changes in v2: None

 drivers/mmc/Kconfig          |  6 +++++
 drivers/mmc/Makefile         |  1 +
 drivers/mmc/rockchip_sdhci.c | 58 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+)
 create mode 100644 drivers/mmc/rockchip_sdhci.c

Please can you enable CONFIG_BLK and CONFIG_DM_MMC_OPS? See msm_sdhci.c for an example.

Regards,
Simon

maintainer
#17 lore raw

v3 cover add support for rk3399 soc and evb

In reply to Kever Yang

Hi Kever,

Am Freitag, 15. Juli 2016, 16:42:08 schrieb Kever Yang:

Quoted 12 lines

This patchset add support for rk3399 with ATF based on Rockchip miniloader as secondary bootloader instead of u-boot SPL.

Rockchip miniloader init the DRAM and load the ATF and u-boot to runing address, and then jump to ATF, ATM do some init and switch to EL2/EL1 mode before jump to next loader which is u-boot here.

Pls reference board/rockchip/evb_rk3399/README to setup the board.

Quoted 6 lines

Will migrate to SPL once its ready for ATF.

This patch set is based on below patch:
"board: move all the rockchip board in one folder"

This patch set has been test on rk3399 evb board.

just for my own little board-farm, for the rk3368 the bringup should be similar, right?

Quoted 9 lines

Changes in v3:
Rebase on patch from Andreas:
[PATCH] rockchip: Exclude rk_timer for ARM64 [PATCH] rockchip: Clean up CPU selection

Changes in v2:
fix description error on board Kconfig
fix a binary path error

Quoted 6 lines

Kever Yang (5):
dts: add support for rkchichip rk3399 soc
ARM64: rockchip: add support for rk3399 SoC based evb-board
config: add config file for evb-rk3399
mmc: rockchip: add SDHCI driver support for rockchip soc
ARM64: evb-rk3399: add a README for this board setup

somehow this last patch never makes it to the lists in all 3 versions till now.

Heiko

author
#18 lore raw

v3 cover add support for rk3399 soc and evb

Hi Heiko,

Quoted 15 lines · Heiko St?bner

Hi Kever,

Am Freitag, 15. Juli 2016, 16:42:08 schrieb Kever Yang:

Quoted 12 lines

This patchset add support for rk3399 with ATF based on Rockchip miniloader as secondary bootloader instead of u-boot SPL.

Rockchip miniloader init the DRAM and load the ATF and u-boot to runing address, and then jump to ATF, ATM do some init and switch to EL2/EL1 mode before jump to next loader which is u-boot here.

Pls reference board/rockchip/evb_rk3399/README to setup the board.

Quoted 8 lines
Quoted 6 lines

Will migrate to SPL once its ready for ATF.

This patch set is based on below patch:
"board: move all the rockchip board in one folder"

This patch set has been test on rk3399 evb board.

just for my own little board-farm, for the rk3368 the bringup should be similar, right?

Yes, similar for uboot part, both ARM v8 cpu, but they have different DDR/MMC controller.
Andreas has send out patch to support rk3368.

Quoted 11 lines
Quoted 11 lines

Changes in v3:
Rebase on patch from Andreas:
[PATCH] rockchip: Exclude rk_timer for ARM64 [PATCH] rockchip: Clean up CPU selection

Changes in v2:
fix description error on board Kconfig
fix a binary path error

Quoted 8 lines
Quoted 6 lines

Kever Yang (5):
dts: add support for rkchichip rk3399 soc
ARM64: rockchip: add support for rk3399 SoC based evb-board
config: add config file for evb-rk3399
mmc: rockchip: add SDHCI driver support for rockchip soc
ARM64: evb-rk3399: add a README for this board setup

somehow this last patch never makes it to the lists in all 3 versions till now.

I don't now why, I will send it with git send-email again.

Thanks,
- Kever

Quoted 6 lines

Heiko