mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/1] arm: rockchip: add support for the quartz64 board
@ 2021-11-10 10:45 Michael Riesch
  2021-11-10 10:45 ` [PATCH] " Michael Riesch
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michael Riesch @ 2021-11-10 10:45 UTC (permalink / raw)
  To: barebox; +Cc: Michael Riesch

Hi all,

This patch introduces support for the Pine64 Quartz64 board that features
the Rockchip RK3566, a reduced but largely identical version of the RK3568.

Please note that the corresponding board device tree is not yet available
in barebox. It is going to appear in Linux v5.16-rc1 and will be synced
shortly afterwards (hopefully :-).

Looking forward to your comments!

Best regards,
Michael

Michael Riesch (1):
  arm: rockchip: add support for the quartz64 board

 Documentation/boards/rockchip.rst          | 28 +++++++++++----
 arch/arm/boards/Makefile                   |  1 +
 arch/arm/boards/pine64-quartz64/Makefile   |  3 ++
 arch/arm/boards/pine64-quartz64/board.c    | 40 ++++++++++++++++++++++
 arch/arm/boards/pine64-quartz64/lowlevel.c | 39 +++++++++++++++++++++
 arch/arm/dts/Makefile                      |  1 +
 arch/arm/mach-rockchip/Kconfig             |  6 ++++
 arch/arm/mach-rockchip/rockchip.c          |  2 ++
 images/Makefile.rockchip                   |  7 ++++
 9 files changed, 121 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boards/pine64-quartz64/Makefile
 create mode 100644 arch/arm/boards/pine64-quartz64/board.c
 create mode 100644 arch/arm/boards/pine64-quartz64/lowlevel.c

-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [PATCH] arm: rockchip: add support for the quartz64 board
  2021-11-10 10:45 [PATCH 0/1] arm: rockchip: add support for the quartz64 board Michael Riesch
@ 2021-11-10 10:45 ` Michael Riesch
  2021-11-11 13:11 ` [PATCH 0/1] " Sascha Hauer
  2021-11-17  7:50 ` [PATCH 0/1] " Sascha Hauer
  2 siblings, 0 replies; 7+ messages in thread
From: Michael Riesch @ 2021-11-10 10:45 UTC (permalink / raw)
  To: barebox; +Cc: Michael Riesch

The Pine64 Quartz64 board features the Rockchip RK3566, a reduced but
largely identical version of the RK3568.

Two models (A and B) of the Quartz64 board are envisaged, where
this patch targets the already available model A.

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 Documentation/boards/rockchip.rst          | 28 +++++++++++----
 arch/arm/boards/Makefile                   |  1 +
 arch/arm/boards/pine64-quartz64/Makefile   |  3 ++
 arch/arm/boards/pine64-quartz64/board.c    | 40 ++++++++++++++++++++++
 arch/arm/boards/pine64-quartz64/lowlevel.c | 39 +++++++++++++++++++++
 arch/arm/dts/Makefile                      |  1 +
 arch/arm/mach-rockchip/Kconfig             |  6 ++++
 arch/arm/mach-rockchip/rockchip.c          |  2 ++
 images/Makefile.rockchip                   |  7 ++++
 9 files changed, 121 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boards/pine64-quartz64/Makefile
 create mode 100644 arch/arm/boards/pine64-quartz64/board.c
 create mode 100644 arch/arm/boards/pine64-quartz64/lowlevel.c

diff --git a/Documentation/boards/rockchip.rst b/Documentation/boards/rockchip.rst
index d52d979cb..68c3e1126 100644
--- a/Documentation/boards/rockchip.rst
+++ b/Documentation/boards/rockchip.rst
@@ -46,19 +46,31 @@ Instructions.
 * Insert SD card and run "dd if=rrboot.bin of=</dev/sdcard> bs=$((0x200)) seek=$((0x40))"
 * SD card is ready
 
-Rockchip RK3568
+Rockchip RK356x
 ===============
 
-RK3568 EVB
-----------
+Barebox features support for the Rockchip RK3566 and RK3568 SoCs, where the
+RK3566 can be considered as reduced but largely identical version of the
+RK3568.
+
+Supported Boards
+----------------
+
+- Rockchip RK3568 EVB
+- Pine64 Quartz64 Model A
+
+The steps described in the following target the RK3568 and the RK3568 EVB but
+generally apply to both SoCs and all boards.
+Differences between the SoCs or boards are outlined where required.
 
 Building
-^^^^^^^^
+--------
 
 The build process needs three binary files which have to be copied from the
 `rkbin https://github.com/rockchip-linux/rkbin` repository to the barebox source tree:
 
 .. code-block:: sh
+
   cp $RKBIN/bin/rk35/rk3568_bl31_v1.24.elf firmware/rk3568-bl31.bin
   cp $RKBIN/bin/rk35/rk3568_bl32_v1.05.bin firmware/rk3568-op-tee.bin
   cp $RKBIN/bin/rk35/rk3568_ddr_1560MHz_v1.08.bin arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
@@ -72,8 +84,11 @@ With these barebox can be compiled as:
 
 **NOTE** I found the bl32 firmware non working for me as of 7d631e0d5b2d373b54d4533580d08fb9bd2eaad4 in the rkbin repository.
 
+**NOTE** The RK3566 and RK3568 seem to share the bl31 and bl32 firmware files,
+whereas the memory initialization blob is different.
+
 Creating a bootable SD card
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
+---------------------------
 
 A bootable SD card can be created with:
 
@@ -86,7 +101,7 @@ doesn't conflict with the are barebox is written to. Starting the first
 partition at offset 8MiB is a safe bet.
 
 USB bootstrapping
-^^^^^^^^^^^^^^^^^
+-----------------
 
 The RK3568 can be bootstrapped via USB for which the rk-usb-loader tool in the barebox
 repository can be used. The tool takes the same images as written on SD cards:
@@ -99,3 +114,4 @@ Note that the boot order of the RK3568 is not configurable. The SoC will only en
 MaskROM mode when no other bootsource contains a valid bootloader. This means to use USB
 you have to make all other bootsources invalid by removing SD cards and shortcircuiting
 eMMCs. The RK3568 EVB has a pushbutton to disable the eMMC.
+On the Quartz64 boards, remove the eMMC module if present.
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index a841053c2..b7a72d5ba 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -184,3 +184,4 @@ obj-$(CONFIG_MACH_TQMLS1046A)			+= tqmls1046a/
 obj-$(CONFIG_MACH_MNT_REFORM)			+= mnt-reform/
 obj-$(CONFIG_MACH_SKOV_ARM9CPU)			+= skov-arm9cpu/
 obj-$(CONFIG_MACH_RK3568_EVB)			+= rockchip-rk3568-evb/
+obj-$(CONFIG_MACH_PINE64_QUARTZ64)		+= pine64-quartz64/
diff --git a/arch/arm/boards/pine64-quartz64/Makefile b/arch/arm/boards/pine64-quartz64/Makefile
new file mode 100644
index 000000000..b37b6c870
--- /dev/null
+++ b/arch/arm/boards/pine64-quartz64/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-y += board.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/pine64-quartz64/board.c b/arch/arm/boards/pine64-quartz64/board.c
new file mode 100644
index 000000000..db2d921c3
--- /dev/null
+++ b/arch/arm/boards/pine64-quartz64/board.c
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <common.h>
+#include <init.h>
+
+struct quartz64_model {
+	const char *name;
+	const char *shortname;
+};
+
+static int quartz64_probe(struct device_d *dev)
+{
+	struct quartz64_model *model;
+
+	model = device_get_match_data(dev);
+
+	barebox_set_model(model->name);
+	barebox_set_hostname(model->shortname);
+
+	return 0;
+}
+
+static const struct quartz64_model quartz64a = {
+	.name = "Pine64 Quartz64 Model A",
+	.shortname = "quartz64a",
+};
+
+static const struct of_device_id quartz64_of_match[] = {
+	{
+		.compatible = "pine64,quartz64-a",
+		.data = &quartz64a,
+	},
+	{ /* sentinel */ },
+};
+
+static struct driver_d quartz64_board_driver = {
+	.name = "board-quartz64",
+	.probe = quartz64_probe,
+	.of_compatible = quartz64_of_match,
+};
+coredevice_platform_driver(quartz64_board_driver);
diff --git a/arch/arm/boards/pine64-quartz64/lowlevel.c b/arch/arm/boards/pine64-quartz64/lowlevel.c
new file mode 100644
index 000000000..b29588552
--- /dev/null
+++ b/arch/arm/boards/pine64-quartz64/lowlevel.c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <common.h>
+#include <linux/sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/hardware.h>
+#include <mach/atf.h>
+#include <debug_ll.h>
+#include <mach/rockchip.h>
+
+extern char __dtb_rk3566_quartz64_a_start[];
+
+static noinline void start_quartz64(void *fdt)
+{
+	/*
+	 * Image execution starts at 0x0, but this is used for ATF and
+	 * OP-TEE later, so move away from here.
+	 */
+	if (current_el() == 3)
+		relocate_to_adr_full(RK3568_BAREBOX_LOAD_ADDRESS);
+	else
+		relocate_to_current_adr();
+
+	setup_c();
+
+	if (current_el() == 3) {
+		rk3568_lowlevel_init();
+		rk3568_atf_load_bl31(fdt);
+		/* not reached */
+	}
+
+	barebox_arm_entry(RK3568_DRAM_BOTTOM, 0x80000000 - RK3568_DRAM_BOTTOM,
+			  fdt);
+}
+
+ENTRY_FUNCTION(start_quartz64a, r0, r1, r2)
+{
+	start_quartz64(__dtb_rk3566_quartz64_a_start);
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 88a079497..7da366bda 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -74,6 +74,7 @@ lwl-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += imx6q-phytec-phycard.dtb.o \
 				imx6ull-phytec-phycore-som-emmc.dtb.o
 lwl-$(CONFIG_MACH_PHYTEC_PHYCORE_IMX7) += imx7d-phyboard-zeta.dtb.o
 lwl-$(CONFIG_MACH_PHYTEC_SOM_IMX8MQ) += imx8mq-phytec-phycore-som.dtb.o
+lwl-$(CONFIG_MACH_PINE64_QUARTZ64) += rk3566-quartz64-a.dtb.o
 lwl-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += armada-xp-openblocks-ax3-4-bb.dtb.o
 lwl-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6) += kirkwood-openblocks_a6-bb.dtb.o
 lwl-$(CONFIG_MACH_PROTONIC_IMX6) += \
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 1ad7ccedf..5603fc12c 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -50,6 +50,12 @@ config MACH_RK3568_EVB
 	help
 	  Say Y here if you are using a RK3568 EVB
 
+config MACH_PINE64_QUARTZ64
+	select ARCH_RK3568
+	bool "Pine64 Quartz64"
+	help
+	  Say Y here if you are using a Pine64 Quartz64
+
 comment "select board features:"
 
 config ARCH_RK3568_OPTEE
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index c185b0cc2..698d23e3a 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -9,6 +9,8 @@ static int rockchip_init(void)
 		return rk3188_init();
 	if (of_machine_is_compatible("rockchip,rk3288"))
 		return rk3288_init();
+	if (of_machine_is_compatible("rockchip,rk3566"))
+		return rk3568_init();
 	if (of_machine_is_compatible("rockchip,rk3568"))
 		return rk3568_init();
 
diff --git a/images/Makefile.rockchip b/images/Makefile.rockchip
index e64fccec6..19980914b 100644
--- a/images/Makefile.rockchip
+++ b/images/Makefile.rockchip
@@ -13,9 +13,16 @@ image-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += barebox-rk3288-phycore-som.img
 pblb-$(CONFIG_MACH_RK3568_EVB) += start_rk3568_evb
 image-$(CONFIG_MACH_RK3568_EVB) += barebox-rk3568-evb.img
 
+pblb-$(CONFIG_MACH_PINE64_QUARTZ64) += start_quartz64a
+image-$(CONFIG_MACH_PINE64_QUARTZ64) += barebox-quartz64a.img
+
 quiet_cmd_rkimg_image = RK-IMG $@
       cmd_rkimg_image = $(objtree)/scripts/rkimage -o $@ $(word 2,$^) $(word 1,$^)
 
 $(obj)/barebox-rk3568-evb.img: $(obj)/start_rk3568_evb.pblb \
                 $(board)/rockchip-rk3568-evb/sdram-init.bin
 	$(call if_changed,rkimg_image)
+
+$(obj)/barebox-quartz64a.img: $(obj)/start_quartz64a.pblb \
+                $(board)/pine64-quartz64/sdram-init.bin
+	$(call if_changed,rkimg_image)
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [PATCH 0/1] arm: rockchip: add support for the quartz64 board
  2021-11-10 10:45 [PATCH 0/1] arm: rockchip: add support for the quartz64 board Michael Riesch
  2021-11-10 10:45 ` [PATCH] " Michael Riesch
@ 2021-11-11 13:11 ` Sascha Hauer
  2021-11-11 13:40   ` [FIXUP 0/2] " Michael Riesch
  2021-11-17  7:50 ` [PATCH 0/1] " Sascha Hauer
  2 siblings, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2021-11-11 13:11 UTC (permalink / raw)
  To: Michael Riesch; +Cc: barebox

On Wed, Nov 10, 2021 at 11:45:29AM +0100, Michael Riesch wrote:
> Hi all,
> 
> This patch introduces support for the Pine64 Quartz64 board that features
> the Rockchip RK3566, a reduced but largely identical version of the RK3568.
> 
> Please note that the corresponding board device tree is not yet available
> in barebox. It is going to appear in Linux v5.16-rc1 and will be synced
> shortly afterwards (hopefully :-).
> 
> Looking forward to your comments!

Looks good to me. We can merge it once the v5.16-rc1 dts changes hit
barebox.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [FIXUP 0/2] arm: rockchip: add support for the quartz64 board
  2021-11-11 13:11 ` [PATCH 0/1] " Sascha Hauer
@ 2021-11-11 13:40   ` Michael Riesch
  2021-11-11 13:40     ` [FIXUP 1/2] fixup! " Michael Riesch
  2021-11-11 13:40     ` [FIXUP 2/2] " Michael Riesch
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Riesch @ 2021-11-11 13:40 UTC (permalink / raw)
  To: barebox; +Cc: Michael Riesch

Hi Sascha,

For what it is worth:

Fixup 1 fixes a constness warning.

Fixup 2 provides a minimal barebox-specific dts, featuring the
required memory node. However, it is pretty much copied directly from the
RK3568. It boots but could possibly use some revision.

Best regards,
Michael

Michael Riesch (2):
  fixup! arm: rockchip: add support for the quartz64 board
  fixup! arm: rockchip: add support for the quartz64 board

 arch/arm/boards/pine64-quartz64/board.c |  2 +-
 arch/arm/dts/rk3566-quartz64-a.dts      | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/rk3566-quartz64-a.dts

-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [FIXUP 1/2] fixup! arm: rockchip: add support for the quartz64 board
  2021-11-11 13:40   ` [FIXUP 0/2] " Michael Riesch
@ 2021-11-11 13:40     ` Michael Riesch
  2021-11-11 13:40     ` [FIXUP 2/2] " Michael Riesch
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Riesch @ 2021-11-11 13:40 UTC (permalink / raw)
  To: barebox; +Cc: Michael Riesch

---
 arch/arm/boards/pine64-quartz64/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boards/pine64-quartz64/board.c b/arch/arm/boards/pine64-quartz64/board.c
index db2d921c3..981de90dd 100644
--- a/arch/arm/boards/pine64-quartz64/board.c
+++ b/arch/arm/boards/pine64-quartz64/board.c
@@ -9,7 +9,7 @@ struct quartz64_model {
 
 static int quartz64_probe(struct device_d *dev)
 {
-	struct quartz64_model *model;
+	const struct quartz64_model *model;
 
 	model = device_get_match_data(dev);
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [FIXUP 2/2] fixup! arm: rockchip: add support for the quartz64 board
  2021-11-11 13:40   ` [FIXUP 0/2] " Michael Riesch
  2021-11-11 13:40     ` [FIXUP 1/2] fixup! " Michael Riesch
@ 2021-11-11 13:40     ` Michael Riesch
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Riesch @ 2021-11-11 13:40 UTC (permalink / raw)
  To: barebox; +Cc: Michael Riesch

---
 arch/arm/dts/rk3566-quartz64-a.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 arch/arm/dts/rk3566-quartz64-a.dts

diff --git a/arch/arm/dts/rk3566-quartz64-a.dts b/arch/arm/dts/rk3566-quartz64-a.dts
new file mode 100644
index 000000000..8639ca088
--- /dev/null
+++ b/arch/arm/dts/rk3566-quartz64-a.dts
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+
+#include <arm64/rockchip/rk3566-quartz64-a.dts>
+
+/ {
+	memory@a00000 {
+		device_type = "memory";
+		reg = <0x0 0x00a00000 0x0 0x7f600000>;
+	};
+};
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [PATCH 0/1] arm: rockchip: add support for the quartz64 board
  2021-11-10 10:45 [PATCH 0/1] arm: rockchip: add support for the quartz64 board Michael Riesch
  2021-11-10 10:45 ` [PATCH] " Michael Riesch
  2021-11-11 13:11 ` [PATCH 0/1] " Sascha Hauer
@ 2021-11-17  7:50 ` Sascha Hauer
  2 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2021-11-17  7:50 UTC (permalink / raw)
  To: Michael Riesch; +Cc: barebox

On Wed, Nov 10, 2021 at 11:45:29AM +0100, Michael Riesch wrote:
> Hi all,
> 
> This patch introduces support for the Pine64 Quartz64 board that features
> the Rockchip RK3566, a reduced but largely identical version of the RK3568.
> 
> Please note that the corresponding board device tree is not yet available
> in barebox. It is going to appear in Linux v5.16-rc1 and will be synced
> shortly afterwards (hopefully :-).

DTS changes for v5.16-rc1 are now in barebox and so I merged Quartz64
support. I also added a patch enabling this board in
rockchip_v8_defconfig.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2021-11-17  7:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 10:45 [PATCH 0/1] arm: rockchip: add support for the quartz64 board Michael Riesch
2021-11-10 10:45 ` [PATCH] " Michael Riesch
2021-11-11 13:11 ` [PATCH 0/1] " Sascha Hauer
2021-11-11 13:40   ` [FIXUP 0/2] " Michael Riesch
2021-11-11 13:40     ` [FIXUP 1/2] fixup! " Michael Riesch
2021-11-11 13:40     ` [FIXUP 2/2] " Michael Riesch
2021-11-17  7:50 ` [PATCH 0/1] " Sascha Hauer

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git