[PATCH] ARM: rockchip: Add support for Pine64 PineTab 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The Pine64 PineTab 2 tablet is basically the Quartz64 but as
a finished product.

There are (currently) two revisions, v0.1 and v2.0.

v0.1 was sent to developers and there are a few units around
(probably less than 10?)

v2.0 is the consumer available version, this version changed the
display reset pin and hooked WLAN/BT chip to a GPIO.

There are currently no easy way to detect both revisions. For now,
we'll only support v2.0.

Signed-off-by: Dang Huynh <danct12@xxxxxxxxxx>
---
 arch/arm/boards/Makefile                   |  1 +
 arch/arm/boards/pine64-pinetab2/.gitignore |  1 +
 arch/arm/boards/pine64-pinetab2/Makefile   |  3 ++
 arch/arm/boards/pine64-pinetab2/board.c    | 54 ++++++++++++++++++++++++++++++
 arch/arm/boards/pine64-pinetab2/lowlevel.c | 35 +++++++++++++++++++
 arch/arm/dts/Makefile                      |  1 +
 arch/arm/dts/rk3566-pinetab2-v0-1.dts      |  6 ++++
 arch/arm/dts/rk3566-pinetab2-v2-0.dts      |  6 ++++
 arch/arm/dts/rk3566-pinetab2.dtsi          | 53 +++++++++++++++++++++++++++++
 arch/arm/mach-rockchip/Kconfig             | 27 +++++++++++++++
 images/Makefile.rockchip                   |  2 ++
 11 files changed, 189 insertions(+)

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 67d91616f623be9eddd370485707eeb25d3ebe40..b6b3894c6b40eb1c4129a55145fd8a2e77efe066 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -172,6 +172,7 @@ 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_RK3568_BPI_R2PRO)			+= rockchip-rk3568-bpi-r2pro/
+obj-$(CONFIG_MACH_PINE64_PINETAB2)		+= pine64-pinetab2/
 obj-$(CONFIG_MACH_PINE64_QUARTZ64)		+= pine64-quartz64/
 obj-$(CONFIG_MACH_RADXA_ROCK3)			+= radxa-rock3/
 obj-$(CONFIG_MACH_RADXA_ROCK5)			+= radxa-rock5/
diff --git a/arch/arm/boards/pine64-pinetab2/.gitignore b/arch/arm/boards/pine64-pinetab2/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..f458f794b54c96b74489d368cb9f44955db11126
--- /dev/null
+++ b/arch/arm/boards/pine64-pinetab2/.gitignore
@@ -0,0 +1 @@
+sdram-init.bin
diff --git a/arch/arm/boards/pine64-pinetab2/Makefile b/arch/arm/boards/pine64-pinetab2/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..b37b6c870bb4d88cbc6f45435caa0a4a8a3d12d6
--- /dev/null
+++ b/arch/arm/boards/pine64-pinetab2/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-pinetab2/board.c b/arch/arm/boards/pine64-pinetab2/board.c
new file mode 100644
index 0000000000000000000000000000000000000000..29f81adb4d34e542d188dac91b0c1d38b87e3c02
--- /dev/null
+++ b/arch/arm/boards/pine64-pinetab2/board.c
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <bootsource.h>
+#include <common.h>
+#include <init.h>
+#include <mach/rockchip/bbu.h>
+
+struct pinetab2_model {
+	const char *name;
+	const char *shortname;
+};
+
+static int pinetab2_probe(struct device *dev)
+{
+	const struct pinetab2_model *model = device_get_match_data(dev);
+	enum bootsource bootsource = bootsource_get();
+	int instance = bootsource_get_instance();
+
+	barebox_set_model(model->name);
+	barebox_set_hostname(model->shortname);
+
+	if (bootsource == BOOTSOURCE_MMC && instance == 0)
+		of_device_enable_path("/chosen/environment-sd");
+	else
+		of_device_enable_path("/chosen/environment-emmc");
+
+	rockchip_bbu_mmc_register("sd", 0, "/dev/mmc0");
+	rockchip_bbu_mmc_register("emmc", BBU_HANDLER_FLAG_DEFAULT, "/dev/mmc1");
+
+	return 0;
+}
+
+static const struct pinetab2_model pinetab2_v01 = {
+	.name = "Pine64 PineTab 2 v0.1",
+	.shortname = "pinetab2-v01",
+};
+
+static const struct pinetab2_model pinetab2_v20 = {
+	.name = "Pine64 PineTab 2 v2.0",
+	.shortname = "pinetab2-v20",
+};
+
+static const struct of_device_id pinetab2_of_match[] = {
+	{ .compatible = "pine64,pinetab2-v0.1", .data = &pinetab2_v01, },
+	{ .compatible = "pine64,pinetab2-v2.0", .data = &pinetab2_v20, },
+	{ /* sentinel */ },
+};
+BAREBOX_DEEP_PROBE_ENABLE(pinetab2_of_match);
+
+static struct driver pinetab2_board_driver = {
+	.name = "board-pinetab2",
+	.probe = pinetab2_probe,
+	.of_compatible = pinetab2_of_match,
+};
+coredevice_platform_driver(pinetab2_board_driver);
diff --git a/arch/arm/boards/pine64-pinetab2/lowlevel.c b/arch/arm/boards/pine64-pinetab2/lowlevel.c
new file mode 100644
index 0000000000000000000000000000000000000000..2f89bfd2ae6aa1e8ce80d730c933fc0320a3ccad
--- /dev/null
+++ b/arch/arm/boards/pine64-pinetab2/lowlevel.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <common.h>
+#include <asm/barebox-arm.h>
+#include <mach/rockchip/hardware.h>
+#include <mach/rockchip/atf.h>
+#include <debug_ll.h>
+
+extern char __dtb_rk3566_pinetab2_v0_1_start[];
+extern char __dtb_rk3566_pinetab2_v2_0_start[];
+
+static void setup_relocation(void)
+{
+	if (current_el() == 3)
+		relocate_to_adr_full(RK3568_BAREBOX_LOAD_ADDRESS);
+	else
+		relocate_to_current_adr();
+
+	setup_c();
+}
+
+ENTRY_FUNCTION(start_pinetab2_v0, r0, r1, r2)
+{
+	putc_ll('>');
+
+	setup_relocation();
+	rk3568_barebox_entry(__dtb_rk3566_pinetab2_v0_1_start);
+}
+
+ENTRY_FUNCTION(start_pinetab2_v2, r0, r1, r2)
+{
+	putc_ll('>');
+
+	setup_relocation();
+	rk3568_barebox_entry(__dtb_rk3566_pinetab2_v2_0_start);
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index fe32b812f6037f382954a84f9ab40cfc8715e367..b9727fd5f91bc7681c910df7e8f18d694fd9f0e4 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -83,6 +83,7 @@ lwl-$(CONFIG_MACH_PHYTEC_PHYCORE_IMX7) += imx7d-phyboard-zeta.dtb.o
 lwl-$(CONFIG_MACH_PHYTEC_PHYCORE_STM32MP1) += stm32mp157c-phycore-stm32mp1-3.dtb.o
 lwl-$(CONFIG_MACH_PHYTEC_SOM_IMX8MM) += imx8mm-phyboard-polis-rdk.dtb.o
 lwl-$(CONFIG_MACH_PHYTEC_SOM_IMX8MQ) += imx8mq-phytec-phycore-som.dtb.o
+lwl-$(CONFIG_MACH_PINE64_PINETAB2) += rk3566-pinetab2-v0-1.dtb.o rk3566-pinetab2-v2-0.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
diff --git a/arch/arm/dts/rk3566-pinetab2-v0-1.dts b/arch/arm/dts/rk3566-pinetab2-v0-1.dts
new file mode 100644
index 0000000000000000000000000000000000000000..2b89d69775df637f663c257295335db878d28442
--- /dev/null
+++ b/arch/arm/dts/rk3566-pinetab2-v0-1.dts
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+
+#include <arm64/rockchip/rk3566-pinetab2-v0.1.dts>
+#include "rk3566-pinetab2.dtsi"
diff --git a/arch/arm/dts/rk3566-pinetab2-v2-0.dts b/arch/arm/dts/rk3566-pinetab2-v2-0.dts
new file mode 100644
index 0000000000000000000000000000000000000000..404ada593c5ca970fb3144f1829cef4e3ce5160d
--- /dev/null
+++ b/arch/arm/dts/rk3566-pinetab2-v2-0.dts
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+
+#include <arm64/rockchip/rk3566-pinetab2-v2.0.dts>
+#include "rk3566-pinetab2.dtsi"
diff --git a/arch/arm/dts/rk3566-pinetab2.dtsi b/arch/arm/dts/rk3566-pinetab2.dtsi
new file mode 100644
index 0000000000000000000000000000000000000000..cda106f185787343312db3e07ffdd6dae82e0c3a
--- /dev/null
+++ b/arch/arm/dts/rk3566-pinetab2.dtsi
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include <arm64/rockchip/rk3566-pinetab2.dtsi>
+#include "rk356x.dtsi"
+
+/ {
+	chosen: chosen {
+		environment-sd {
+			compatible = "barebox,environment";
+			device-path = &environment_sd;
+			status = "disabled";
+		};
+
+		environment-emmc {
+			compatible = "barebox,environment";
+			device-path = &environment_emmc;
+			status = "disabled";
+		};
+	};
+
+	memory@a00000 {
+		device_type = "memory";
+		reg = <0x0 0x00a00000 0x0 0x7f600000>;
+	};
+};
+
+&sdhci {
+	no-sd;
+
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <2>;
+		#size-cells = <2>;
+
+		environment_emmc: partition@408000 {
+			label = "barebox-environment";
+			reg = <0x0 0x408000 0x0 0x8000>;
+		};
+	};
+};
+
+&sdmmc0 {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <2>;
+		#size-cells = <2>;
+
+		environment_sd: partition@408000 {
+			label = "barebox-environment";
+			reg = <0x0 0x408000 0x0 0x8000>;
+		};
+	};
+};
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index ddaab7c2841481ff10a59becf011c0762ee54b27..b1df25ad6431e1a78e219028fb3fb67cc0277a4c 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -79,6 +79,33 @@ config MACH_RK3568_BPI_R2PRO
 	help
 	  Say Y here if you are using a RK3568 Bananpi R2 Pro
 
+config MACH_PINE64_PINETAB2
+	select ARCH_RK3568
+	bool "Pine64 PineTab 2"
+	help
+	  Say Y here if you are using a Pine64 PineTab 2
+
+if MACH_PINE64_PINETAB2
+config MACH_PINE64_PINETAB2_V0
+	bool "Pine64 PineTab 2 - Rev 0.1"
+	help
+	  Say Y here if you are using revision 0.1 of the tablet.
+
+	  This revision was distributed to several OS developers
+	  for early OS bring up. Not many of them are available and
+	  was superseded by rev 2.0.
+
+config MACH_PINE64_PINETAB2_V2
+	bool "Pine64 PineTab 2 - Rev 2.0"
+	help
+	  Say Y here if you are using revision 2.0 of the tablet.
+
+	  This is the one that's being sold to consumers, this
+	  is probably the one you would use if you intend to ship
+	  Barebox to the general public.
+
+endif
+
 config MACH_PINE64_QUARTZ64
 	select ARCH_RK3568
 	bool "Pine64 Quartz64"
diff --git a/images/Makefile.rockchip b/images/Makefile.rockchip
index 6619beae73e2a527b9b9343c229001c8b46a7642..ec3b144ccdc1e8302e522953d094d9153367f6b2 100644
--- a/images/Makefile.rockchip
+++ b/images/Makefile.rockchip
@@ -31,6 +31,8 @@ image-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += barebox-rk3288-phycore-som.img
 
 $(call build_rockchip_image, CONFIG_MACH_RK3568_EVB, start_rk3568_evb, rockchip-rk3568-evb/sdram-init.bin, rk3568-evb)
 $(call build_rockchip_image, CONFIG_MACH_RK3568_BPI_R2PRO, start_rk3568_bpi_r2pro, rockchip-rk3568-bpi-r2pro/sdram-init.bin, rk3568-bpi-r2pro)
+$(call build_rockchip_image, CONFIG_MACH_PINE64_PINETAB2_V0, start_pinetab2_v0, pine64-pinetab2/sdram-init.bin, pinetab2-v0)
+$(call build_rockchip_image, CONFIG_MACH_PINE64_PINETAB2_V2, start_pinetab2_v2, pine64-pinetab2/sdram-init.bin, pinetab2-v2)
 $(call build_rockchip_image, CONFIG_MACH_PINE64_QUARTZ64, start_quartz64a, pine64-quartz64/sdram-init.bin, quartz64a)
 $(call build_rockchip_image, CONFIG_MACH_PROTONIC_MECSBC, start_mecsbc, protonic-mecsbc/sdram-init.bin, mecsbc)
 $(call build_rockchip_image, CONFIG_MACH_RADXA_ROCK3, start_rock3a, radxa-rock3/sdram-init.bin, rock3a)

---
base-commit: 7a3cb7e6fd6338144972b7c83675fb5c709ea6f8
change-id: 20241202-pt2-init-7122fe34f0d6

Best regards,
-- 
Dang Huynh <danct12@xxxxxxxxxx>





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux