From 804c57dd5925e67383a3d82c85f18868a6173d4b Mon Sep 17 00:00:00 2001 From: Piotr Szczepanik Date: Tue, 26 Jan 2021 21:22:37 +0100 Subject: [PATCH] Enable RTC (hym8563) for Station P1 in mainline (renaming DT in process) (#2577) * Enable RTC (hym8563) for Station P1 in mainline (renaming DT in process) * Switch Station P1 to rockchip64 * Fix linking for Station P1 device tree in legacy --- config/boards/station-p1.csc | 4 +- config/kernel/linux-rockchip64-current.config | 2 +- config/kernel/linux-rockchip64-dev.config | 2 +- .../add-board-rk3399-roc-pc-plus.patch | 38 ++++++++++++++ .../add-boards-to-dts-makefile.patch | 3 +- ...l-possibility-of-disabling-rk808-rtc.patch | 51 +++++++++++++++++++ .../add-board-rk3399-roc-pc-plus.patch | 38 ++++++++++++++ .../add-boards-to-dts-makefile.patch | 3 +- ...l-possibility-of-disabling-rk808-rtc.patch | 51 +++++++++++++++++++ .../zz-add-rk3399-roc-pc-make.patch | 3 +- ...ch => zz-add-rk3399-roc-pc-plus-dts.patch} | 11 +++- 11 files changed, 198 insertions(+), 8 deletions(-) create mode 100644 patch/kernel/rockchip64-current/add-board-rk3399-roc-pc-plus.patch create mode 100644 patch/kernel/rockchip64-current/general-possibility-of-disabling-rk808-rtc.patch create mode 100644 patch/kernel/rockchip64-dev/add-board-rk3399-roc-pc-plus.patch create mode 100644 patch/kernel/rockchip64-dev/general-possibility-of-disabling-rk808-rtc.patch rename patch/kernel/rockchip64-legacy/{zz-add-rk3399-roc-pc-mezzanine-dts.patch => zz-add-rk3399-roc-pc-plus-dts.patch} (98%) diff --git a/config/boards/station-p1.csc b/config/boards/station-p1.csc index 4cea344acc..8d4e4a230a 100644 --- a/config/boards/station-p1.csc +++ b/config/boards/station-p1.csc @@ -1,8 +1,8 @@ # Rockchip RK3399 hexa core 4GB LPDDR4 SoC eMMC GBE USB3 BOARD_NAME="Station P1" -BOARDFAMILY="rk3399" +BOARDFAMILY="rockchip64" BOOTCONFIG="roc-pc-mezzanine-rk3399_defconfig" KERNEL_TARGET="legacy,current,dev" FULL_DESKTOP="yes" BOOT_LOGO="desktop" -BOOT_FDT_FILE="rockchip/rk3399-roc-pc-mezzanine.dtb" +BOOT_FDT_FILE="rockchip/rk3399-roc-pc-plus.dtb" diff --git a/config/kernel/linux-rockchip64-current.config b/config/kernel/linux-rockchip64-current.config index 30e40781e0..3869a202d8 100644 --- a/config/kernel/linux-rockchip64-current.config +++ b/config/kernel/linux-rockchip64-current.config @@ -6741,7 +6741,7 @@ CONFIG_RTC_DRV_DS1307=y # CONFIG_RTC_DRV_DS1307_CENTURY is not set # CONFIG_RTC_DRV_DS1374 is not set # CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_HYM8563 is not set +CONFIG_RTC_DRV_HYM8563=y # CONFIG_RTC_DRV_MAX6900 is not set CONFIG_RTC_DRV_MAX77686=y CONFIG_RTC_DRV_RK808=y diff --git a/config/kernel/linux-rockchip64-dev.config b/config/kernel/linux-rockchip64-dev.config index a46217eef9..aa9ab04de6 100644 --- a/config/kernel/linux-rockchip64-dev.config +++ b/config/kernel/linux-rockchip64-dev.config @@ -6741,7 +6741,7 @@ CONFIG_RTC_DRV_DS1307=y # CONFIG_RTC_DRV_DS1307_CENTURY is not set # CONFIG_RTC_DRV_DS1374 is not set # CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_HYM8563 is not set +CONFIG_RTC_DRV_HYM8563=y # CONFIG_RTC_DRV_MAX6900 is not set CONFIG_RTC_DRV_MAX77686=y CONFIG_RTC_DRV_RK808=y diff --git a/patch/kernel/rockchip64-current/add-board-rk3399-roc-pc-plus.patch b/patch/kernel/rockchip64-current/add-board-rk3399-roc-pc-plus.patch new file mode 100644 index 0000000000..cecfb32a51 --- /dev/null +++ b/patch/kernel/rockchip64-current/add-board-rk3399-roc-pc-plus.patch @@ -0,0 +1,38 @@ +new file mode 100644 +index 000000000000..b85508c12742 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts +@@ -0,0 +1,33 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2017 T-Chip Intelligent Technology Co., Ltd ++ */ ++ ++/dts-v1/; ++#include "rk3399-roc-pc-mezzanine.dts" ++ ++/ { ++ model = "Firefly roc-rk3399-pc PLUS"; ++ compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399"; ++}; ++ ++&rk808{ ++ rtc { ++ compatible = "rk808-rtc"; ++ status = "disabled"; ++ }; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ hym8563: hym8563@51 { ++ compatible = "haoyu,hym8563"; ++ reg = <0x51>; ++ interrupt-parent = <&gpio0>; ++ interrupts = <5 IRQ_TYPE_EDGE_FALLING>; ++ pinctrl-names = "default"; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ }; ++}; diff --git a/patch/kernel/rockchip64-current/add-boards-to-dts-makefile.patch b/patch/kernel/rockchip64-current/add-boards-to-dts-makefile.patch index 212b06a271..39e0b01fe0 100644 --- a/patch/kernel/rockchip64-current/add-boards-to-dts-makefile.patch +++ b/patch/kernel/rockchip64-current/add-boards-to-dts-makefile.patch @@ -2,7 +2,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchi index 26661c7b7..1462ed38b 100644 --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -1,4 +1,16 @@ +@@ -1,4 +1,17 @@ # SPDX-License-Identifier: GPL-2.0 +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3308-rock-pi-s.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2-rev00.dtb @@ -15,6 +15,7 @@ index 26661c7b7..1462ed38b 100644 +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4v2.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-r4s.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-orangepi-4.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-plus.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += px30-evb.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3308-evb.dtb diff --git a/patch/kernel/rockchip64-current/general-possibility-of-disabling-rk808-rtc.patch b/patch/kernel/rockchip64-current/general-possibility-of-disabling-rk808-rtc.patch new file mode 100644 index 0000000000..1130ee368f --- /dev/null +++ b/patch/kernel/rockchip64-current/general-possibility-of-disabling-rk808-rtc.patch @@ -0,0 +1,51 @@ +From 2fbbbde230c0c488412f2a376b13adbcbcbae28b Mon Sep 17 00:00:00 2001 +From: Piotr Szczepanik +Date: Sun, 24 Jan 2021 16:14:06 +0100 +Subject: [PATCH] add possibility of disabling rk808-rtc + +To disable rk808-rtc driver from loading for specific board +add the following stanza to rk808 node in device tree: + + rtc { + compatible = "rk808-rtc"; + status = "disabled"; + } + +This is needed for roc-rk3399-pc plus (a.k.a. Station P1). +Without the change rk808's rtc is initialised and used for time keeping +although there is another rtc (hym8563) that should be actually used. + +Signed-off-by: Piotr Szczepanik +--- + drivers/mfd/mfd-core.c | 2 +- + drivers/mfd/rk808.c | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c +index fc00aaccb..5c13cc9e2 100644 +--- a/drivers/mfd/mfd-core.c ++++ b/drivers/mfd/mfd-core.c +@@ -225,7 +225,7 @@ static int mfd_add_device(struct device *parent, int id, + } + + if (!pdev->dev.of_node) +- pr_warn("%s: Failed to locate of_node [id: %d]\n", ++ pr_debug("%s: Failed to locate of_node [id: %d]\n", + cell->name, platform_id); + } + +diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c +index d109b9f14..d90c45cd5 100644 +--- a/drivers/mfd/rk808.c ++++ b/drivers/mfd/rk808.c +@@ -145,6 +145,7 @@ static const struct mfd_cell rk808s[] = { + { .name = "rk808-regulator", }, + { + .name = "rk808-rtc", ++ .of_compatible = "rk808-rtc", + .num_resources = ARRAY_SIZE(rtc_resources), + .resources = rtc_resources, + }, +-- +Created with Armbian build tools https://github.com/armbian/build + diff --git a/patch/kernel/rockchip64-dev/add-board-rk3399-roc-pc-plus.patch b/patch/kernel/rockchip64-dev/add-board-rk3399-roc-pc-plus.patch new file mode 100644 index 0000000000..cecfb32a51 --- /dev/null +++ b/patch/kernel/rockchip64-dev/add-board-rk3399-roc-pc-plus.patch @@ -0,0 +1,38 @@ +new file mode 100644 +index 000000000000..b85508c12742 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts +@@ -0,0 +1,33 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2017 T-Chip Intelligent Technology Co., Ltd ++ */ ++ ++/dts-v1/; ++#include "rk3399-roc-pc-mezzanine.dts" ++ ++/ { ++ model = "Firefly roc-rk3399-pc PLUS"; ++ compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399"; ++}; ++ ++&rk808{ ++ rtc { ++ compatible = "rk808-rtc"; ++ status = "disabled"; ++ }; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ hym8563: hym8563@51 { ++ compatible = "haoyu,hym8563"; ++ reg = <0x51>; ++ interrupt-parent = <&gpio0>; ++ interrupts = <5 IRQ_TYPE_EDGE_FALLING>; ++ pinctrl-names = "default"; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ }; ++}; diff --git a/patch/kernel/rockchip64-dev/add-boards-to-dts-makefile.patch b/patch/kernel/rockchip64-dev/add-boards-to-dts-makefile.patch index 212b06a271..39e0b01fe0 100644 --- a/patch/kernel/rockchip64-dev/add-boards-to-dts-makefile.patch +++ b/patch/kernel/rockchip64-dev/add-boards-to-dts-makefile.patch @@ -2,7 +2,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchi index 26661c7b7..1462ed38b 100644 --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -1,4 +1,16 @@ +@@ -1,4 +1,17 @@ # SPDX-License-Identifier: GPL-2.0 +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3308-rock-pi-s.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2-rev00.dtb @@ -15,6 +15,7 @@ index 26661c7b7..1462ed38b 100644 +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4v2.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-r4s.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-orangepi-4.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-plus.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += px30-evb.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3308-evb.dtb diff --git a/patch/kernel/rockchip64-dev/general-possibility-of-disabling-rk808-rtc.patch b/patch/kernel/rockchip64-dev/general-possibility-of-disabling-rk808-rtc.patch new file mode 100644 index 0000000000..1130ee368f --- /dev/null +++ b/patch/kernel/rockchip64-dev/general-possibility-of-disabling-rk808-rtc.patch @@ -0,0 +1,51 @@ +From 2fbbbde230c0c488412f2a376b13adbcbcbae28b Mon Sep 17 00:00:00 2001 +From: Piotr Szczepanik +Date: Sun, 24 Jan 2021 16:14:06 +0100 +Subject: [PATCH] add possibility of disabling rk808-rtc + +To disable rk808-rtc driver from loading for specific board +add the following stanza to rk808 node in device tree: + + rtc { + compatible = "rk808-rtc"; + status = "disabled"; + } + +This is needed for roc-rk3399-pc plus (a.k.a. Station P1). +Without the change rk808's rtc is initialised and used for time keeping +although there is another rtc (hym8563) that should be actually used. + +Signed-off-by: Piotr Szczepanik +--- + drivers/mfd/mfd-core.c | 2 +- + drivers/mfd/rk808.c | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c +index fc00aaccb..5c13cc9e2 100644 +--- a/drivers/mfd/mfd-core.c ++++ b/drivers/mfd/mfd-core.c +@@ -225,7 +225,7 @@ static int mfd_add_device(struct device *parent, int id, + } + + if (!pdev->dev.of_node) +- pr_warn("%s: Failed to locate of_node [id: %d]\n", ++ pr_debug("%s: Failed to locate of_node [id: %d]\n", + cell->name, platform_id); + } + +diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c +index d109b9f14..d90c45cd5 100644 +--- a/drivers/mfd/rk808.c ++++ b/drivers/mfd/rk808.c +@@ -145,6 +145,7 @@ static const struct mfd_cell rk808s[] = { + { .name = "rk808-regulator", }, + { + .name = "rk808-rtc", ++ .of_compatible = "rk808-rtc", + .num_resources = ARRAY_SIZE(rtc_resources), + .resources = rtc_resources, + }, +-- +Created with Armbian build tools https://github.com/armbian/build + diff --git a/patch/kernel/rockchip64-legacy/zz-add-rk3399-roc-pc-make.patch b/patch/kernel/rockchip64-legacy/zz-add-rk3399-roc-pc-make.patch index d4d04bd893..f87c3afb80 100644 --- a/patch/kernel/rockchip64-legacy/zz-add-rk3399-roc-pc-make.patch +++ b/patch/kernel/rockchip64-legacy/zz-add-rk3399-roc-pc-make.patch @@ -1,10 +1,11 @@ --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -86,6 +86,7 @@ +@@ -86,6 +86,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-evb-rev3-cros.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-firefly-android.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-firefly-linux.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-mezzanine.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-plus.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-fpga.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-gru.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin-r0.dtb diff --git a/patch/kernel/rockchip64-legacy/zz-add-rk3399-roc-pc-mezzanine-dts.patch b/patch/kernel/rockchip64-legacy/zz-add-rk3399-roc-pc-plus-dts.patch similarity index 98% rename from patch/kernel/rockchip64-legacy/zz-add-rk3399-roc-pc-mezzanine-dts.patch rename to patch/kernel/rockchip64-legacy/zz-add-rk3399-roc-pc-plus-dts.patch index c0806190d2..fadb89d360 100644 --- a/patch/kernel/rockchip64-legacy/zz-add-rk3399-roc-pc-mezzanine-dts.patch +++ b/patch/kernel/rockchip64-legacy/zz-add-rk3399-roc-pc-plus-dts.patch @@ -1,7 +1,16 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts +new file mode 120000 +index 00000000..5a62cd6b +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts +@@ -0,0 +1 @@ ++rk3399-roc-pc-plus.dts +\ No newline at end of file +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts new file mode 100644 index 0000000..7b82b78 --- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts @@ -0,0 +1,1301 @@ +/dts-v1/; +